{"version":3,"sources":["jsdelivr-header.js","/npm/custom-media-element@1.4.6/dist/custom-media-element.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNK,MAAC,EAAS,CACb,QACA,UACA,iBACA,iBACA,UACA,YACA,QACA,QACA,aACA,iBACA,YACA,QACA,OACA,UACA,WACA,aACA,SACA,UACA,UACA,UACA,aACA,eACA,UACA,gBACA,SACA,wBACA,wBACA,wBACA,sBACA,iCAEI,EAAa,CACjB,uBACA,0BACA,wBACA,WACA,WACA,eACA,cACA,OACA,QACA,cACA,SACA,UACA,OAEF,SAAS,EAAqB,GAC5B,2QAgBY,EAAoB,iDAKlC,CACA,SAAS,EAAqB,GAC5B,olBAwBY,EAAoB,iDAKlC,CACA,SAAS,EAAiB,GAAY,IAAE,EAAG,GAAE,IAC3C,MAAM,EAAe,WAAW,UAAU,gBAAgB,EAAK,CAAE,OAC3D,EAAgB,EA4NxB,SAA0B,GACxB,MAAM,EAAgB,GACtB,IAAK,IAAI,EAAQ,OAAO,eAAe,GAAe,GAAS,IAAU,YAAY,UAAW,EAAQ,OAAO,eAAe,GAAQ,CACpI,MAAM,EAAQ,OAAO,oBAAoB,GACzC,EAAc,QAAQ,EAC1B,CACE,OAAO,CACT,CAnOuC,CAAiB,GAAgB,GACtE,OAAO,MAAM,UAAoB,EAC/B,uBAAyB,EAAI,SAAS,SAAW,EAAuB,EACxE,yBAA2B,CAAE,KAAM,QACnC,cAAgB,EAChB,UAAoB,EACpB,6BAAW,GACT,GAAY,IAEZ,MAAO,IADU,GAAc,aAAa,oBAAsB,MAG7D,EAEX,CACI,QAAO,GACL,GAAI,MAAK,EAAY,OACrB,MAAK,GAAa,EAClB,MAAM,EAAe,IAAI,IAAI,KAAK,oBAClC,EAAa,OAAO,SACpB,IAAK,MAAM,KAAQ,EACjB,KAAI,KAAQ,KAAK,WACjB,GAAkC,mBAAvB,EAAa,GACtB,KAAK,UAAU,GAAQ,YAAY,GACjC,MAAK,IAML,MALW,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IAAK,EAAW,SAAS,GAAM,SAC/B,MAAM,EAAQ,EAAM,GACF,GAAJ,KAAV,EAAsB,IAAI,IACjB,IAAI,MAAQ,IAC7B,CACE,OAAO,CACT,CAQK,MAAC,EAAqB,EAAiB,WAAW,aAAe,QACnE,CACD,IAAK,UAED,EAAqB,EAAiB,WAAW,aAAe,QACnE,CACD,IAAK,iB","file":"/npm/custom-media-element@1.4.6/dist/custom-media-element.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/custom-media-element@1.4.6/dist/custom-media-element.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const Events = [\n  \"abort\",\n  \"canplay\",\n  \"canplaythrough\",\n  \"durationchange\",\n  \"emptied\",\n  \"encrypted\",\n  \"ended\",\n  \"error\",\n  \"loadeddata\",\n  \"loadedmetadata\",\n  \"loadstart\",\n  \"pause\",\n  \"play\",\n  \"playing\",\n  \"progress\",\n  \"ratechange\",\n  \"seeked\",\n  \"seeking\",\n  \"stalled\",\n  \"suspend\",\n  \"timeupdate\",\n  \"volumechange\",\n  \"waiting\",\n  \"waitingforkey\",\n  \"resize\",\n  \"enterpictureinpicture\",\n  \"leavepictureinpicture\",\n  \"webkitbeginfullscreen\",\n  \"webkitendfullscreen\",\n  \"webkitpresentationmodechanged\"\n];\nconst Attributes = [\n  \"autopictureinpicture\",\n  \"disablepictureinpicture\",\n  \"disableremoteplayback\",\n  \"autoplay\",\n  \"controls\",\n  \"controlslist\",\n  \"crossorigin\",\n  \"loop\",\n  \"muted\",\n  \"playsinline\",\n  \"poster\",\n  \"preload\",\n  \"src\"\n];\nfunction getAudioTemplateHTML(attrs) {\n  return (\n    /*html*/\n    `\n    <style>\n      :host {\n        display: inline-flex;\n        line-height: 0;\n        flex-direction: column;\n        justify-content: end;\n      }\n\n      audio {\n        width: 100%;\n      }\n    </style>\n    <slot name=\"media\">\n      <audio${serializeAttributes(attrs)}></audio>\n    </slot>\n    <slot></slot>\n  `\n  );\n}\nfunction getVideoTemplateHTML(attrs) {\n  return (\n    /*html*/\n    `\n    <style>\n      :host {\n        display: inline-block;\n        line-height: 0;\n      }\n\n      video {\n        max-width: 100%;\n        max-height: 100%;\n        min-width: 100%;\n        min-height: 100%;\n        object-fit: var(--media-object-fit, contain);\n        object-position: var(--media-object-position, 50% 50%);\n      }\n\n      video::-webkit-media-text-track-container {\n        transform: var(--media-webkit-text-track-transform);\n        transition: var(--media-webkit-text-track-transition);\n      }\n    </style>\n    <slot name=\"media\">\n      <video${serializeAttributes(attrs)}></video>\n    </slot>\n    <slot></slot>\n  `\n  );\n}\nfunction CustomMediaMixin(superclass, { tag, is }) {\n  const nativeElTest = globalThis.document?.createElement?.(tag, { is });\n  const nativeElProps = nativeElTest ? getNativeElProps(nativeElTest) : [];\n  return class CustomMedia extends superclass {\n    static getTemplateHTML = tag.endsWith(\"audio\") ? getAudioTemplateHTML : getVideoTemplateHTML;\n    static shadowRootOptions = { mode: \"open\" };\n    static Events = Events;\n    static #isDefined = false;\n    static get observedAttributes() {\n      CustomMedia.#define();\n      const natAttrs = nativeElTest?.constructor?.observedAttributes ?? [];\n      return [\n        ...natAttrs,\n        ...Attributes\n      ];\n    }\n    static #define() {\n      if (this.#isDefined) return;\n      this.#isDefined = true;\n      const propsToAttrs = new Set(this.observedAttributes);\n      propsToAttrs.delete(\"muted\");\n      for (const prop of nativeElProps) {\n        if (prop in this.prototype) continue;\n        if (typeof nativeElTest[prop] === \"function\") {\n          this.prototype[prop] = function(...args) {\n            this.#init();\n            const fn = () => {\n              if (this.call) return this.call(prop, ...args);\n              const nativeFn = this.nativeEl?.[prop];\n              return nativeFn?.apply(this.nativeEl, args);\n            };\n            return fn();\n          };\n        } else {\n          const config = {\n            get() {\n              this.#init();\n              const attr = prop.toLowerCase();\n              if (propsToAttrs.has(attr)) {\n                const val = this.getAttribute(attr);\n                return val === null ? false : val === \"\" ? true : val;\n              }\n              return this.get?.(prop) ?? this.nativeEl?.[prop];\n            }\n          };\n          if (prop !== prop.toUpperCase()) {\n            config.set = function(val) {\n              this.#init();\n              const attr = prop.toLowerCase();\n              if (propsToAttrs.has(attr)) {\n                if (val === true || val === false || val == null) {\n                  this.toggleAttribute(attr, Boolean(val));\n                } else {\n                  this.setAttribute(attr, val);\n                }\n                return;\n              }\n              if (this.set) {\n                this.set(prop, val);\n                return;\n              }\n              if (this.nativeEl) {\n                this.nativeEl[prop] = val;\n              }\n            };\n          }\n          Object.defineProperty(this.prototype, prop, config);\n        }\n      }\n    }\n    // Private fields\n    #isInit = false;\n    #nativeEl = null;\n    #childMap = /* @__PURE__ */ new Map();\n    #childObserver;\n    #slotChangeHandler;\n    get;\n    set;\n    call;\n    // If the custom element is defined before the custom element's HTML is parsed\n    // no attributes will be available in the constructor (construction process).\n    // Wait until initializing in the attributeChangedCallback or\n    // connectedCallback or accessing any properties.\n    get nativeEl() {\n      this.#init();\n      return this.#nativeEl ?? this.querySelector(\":scope > [slot=media]\") ?? this.querySelector(tag) ?? this.shadowRoot?.querySelector(tag) ?? null;\n    }\n    set nativeEl(val) {\n      this.#nativeEl = val;\n    }\n    get defaultMuted() {\n      return this.hasAttribute(\"muted\");\n    }\n    set defaultMuted(val) {\n      this.toggleAttribute(\"muted\", val);\n    }\n    get src() {\n      return this.getAttribute(\"src\");\n    }\n    set src(val) {\n      this.setAttribute(\"src\", `${val}`);\n    }\n    get preload() {\n      return this.getAttribute(\"preload\") ?? this.nativeEl?.preload;\n    }\n    set preload(val) {\n      this.setAttribute(\"preload\", `${val}`);\n    }\n    #init() {\n      if (this.#isInit) return;\n      this.#isInit = true;\n      this.init();\n    }\n    init() {\n      if (!this.shadowRoot) {\n        this.attachShadow({ mode: \"open\" });\n        const attrs = namedNodeMapToObject(this.attributes);\n        if (is) attrs.is = is;\n        if (tag) attrs.part = tag;\n        this.shadowRoot.innerHTML = this.constructor.getTemplateHTML(attrs);\n      }\n      this.nativeEl.muted = this.hasAttribute(\"muted\");\n      for (const prop of nativeElProps) {\n        this.#upgradeProperty(prop);\n      }\n      this.#setupListeners();\n    }\n    #setupListeners() {\n      this.#childObserver = new MutationObserver(this.#syncMediaChildAttribute.bind(this));\n      this.#slotChangeHandler = () => this.#syncMediaChildren();\n      this.shadowRoot?.addEventListener(\"slotchange\", this.#slotChangeHandler);\n      this.#syncMediaChildren();\n      for (const type of this.constructor.Events) {\n        this.shadowRoot?.addEventListener(type, this, true);\n      }\n    }\n    handleEvent(event) {\n      if (event.target === this.nativeEl) {\n        this.dispatchEvent(new CustomEvent(event.type, { detail: event.detail }));\n      }\n    }\n    #syncMediaChildren() {\n      const removeNativeChildren = new Map(this.#childMap);\n      const defaultSlot = this.shadowRoot?.querySelector(\"slot:not([name])\");\n      const mediaChildren = defaultSlot?.assignedElements({ flatten: true }).filter((el) => [\"track\", \"source\"].includes(el.localName));\n      mediaChildren.forEach((el) => {\n        removeNativeChildren.delete(el);\n        let clone = this.#childMap.get(el);\n        if (!clone) {\n          clone = el.cloneNode();\n          this.#childMap.set(el, clone);\n          this.#childObserver?.observe(el, { attributes: true });\n        }\n        this.nativeEl?.append(clone);\n        this.#enableDefaultTrack(clone);\n      });\n      removeNativeChildren.forEach((clone, el) => {\n        clone.remove();\n        this.#childMap.delete(el);\n      });\n    }\n    #syncMediaChildAttribute(mutations) {\n      for (const mutation of mutations) {\n        if (mutation.type === \"attributes\") {\n          const { target, attributeName } = mutation;\n          const clone = this.#childMap.get(target);\n          if (clone && attributeName) {\n            clone.setAttribute(attributeName, target.getAttribute(attributeName) ?? \"\");\n            this.#enableDefaultTrack(clone);\n          }\n        }\n      }\n    }\n    #enableDefaultTrack(trackEl) {\n      if (trackEl && trackEl.localName === \"track\" && trackEl.default && (trackEl.kind === \"chapters\" || trackEl.kind === \"metadata\") && trackEl.track.mode === \"disabled\") {\n        trackEl.track.mode = \"hidden\";\n      }\n    }\n    #upgradeProperty(prop) {\n      if (Object.prototype.hasOwnProperty.call(this, prop)) {\n        const value = this[prop];\n        delete this[prop];\n        this[prop] = value;\n      }\n    }\n    attributeChangedCallback(attrName, oldValue, newValue) {\n      this.#init();\n      this.#forwardAttribute(attrName, oldValue, newValue);\n    }\n    #forwardAttribute(attrName, _oldValue, newValue) {\n      if ([\"id\", \"class\"].includes(attrName)) return;\n      if (!CustomMedia.observedAttributes.includes(attrName) && this.constructor.observedAttributes.includes(attrName)) {\n        return;\n      }\n      if (newValue === null) {\n        this.nativeEl?.removeAttribute(attrName);\n      } else if (this.nativeEl?.getAttribute(attrName) !== newValue) {\n        this.nativeEl?.setAttribute(attrName, newValue);\n      }\n    }\n    connectedCallback() {\n      this.#init();\n      if (!this.#slotChangeHandler) {\n        this.#setupListeners();\n      }\n    }\n    disconnectedCallback() {\n      this.#childObserver?.disconnect();\n      this.#childObserver = void 0;\n      if (this.#slotChangeHandler) {\n        this.shadowRoot?.removeEventListener(\"slotchange\", this.#slotChangeHandler);\n        this.#slotChangeHandler = void 0;\n      }\n      for (const type of this.constructor.Events) {\n        this.shadowRoot?.removeEventListener(type, this, true);\n      }\n      this.#childMap.forEach((clone) => clone.remove());\n      this.#childMap.clear();\n      this.#nativeEl = null;\n    }\n  };\n}\nfunction getNativeElProps(nativeElTest) {\n  const nativeElProps = [];\n  for (let proto = Object.getPrototypeOf(nativeElTest); proto && proto !== HTMLElement.prototype; proto = Object.getPrototypeOf(proto)) {\n    const props = Object.getOwnPropertyNames(proto);\n    nativeElProps.push(...props);\n  }\n  return nativeElProps;\n}\nfunction serializeAttributes(attrs) {\n  let html = \"\";\n  for (const key in attrs) {\n    if (!Attributes.includes(key)) continue;\n    const value = attrs[key];\n    if (value === \"\") html += ` ${key}`;\n    else html += ` ${key}=\"${value}\"`;\n  }\n  return html;\n}\nfunction namedNodeMapToObject(namedNodeMap) {\n  const obj = {};\n  for (const attr of namedNodeMap) {\n    obj[attr.name] = attr.value;\n  }\n  return obj;\n}\nconst CustomVideoElement = CustomMediaMixin(globalThis.HTMLElement ?? class {\n}, {\n  tag: \"video\"\n});\nconst CustomAudioElement = CustomMediaMixin(globalThis.HTMLElement ?? class {\n}, {\n  tag: \"audio\"\n});\nexport {\n  Attributes,\n  CustomAudioElement,\n  CustomMediaMixin,\n  CustomVideoElement,\n  Events\n};\n"]}