@maveio/components 0.0.167 → 0.0.169

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/chunk-2E5GLLOS.cjs +19 -0
  2. package/dist/chunk-2EIQ3VMA.cjs +1 -0
  3. package/dist/chunk-2FUCHY2J.cjs +35 -0
  4. package/dist/chunk-2JCNQPEK.js +1 -0
  5. package/dist/chunk-5PIHL662.js +19 -0
  6. package/dist/chunk-5QLIDHRT.cjs +33 -0
  7. package/dist/chunk-AOBEOJ2U.cjs +10 -0
  8. package/dist/chunk-B6P2GJBQ.js +9 -0
  9. package/dist/chunk-BL2IUHCP.cjs +1663 -0
  10. package/dist/chunk-BTCK3T4L.cjs +24 -0
  11. package/dist/{chunk-DITZCOYN.cjs → chunk-C3CI3U2Z.js} +6 -6
  12. package/dist/{chunk-SF36AD3G.js → chunk-CNPQ5Q2M.js} +1 -1
  13. package/dist/chunk-CVXHA76S.js +3 -0
  14. package/dist/chunk-DL4BV5IH.cjs +24 -0
  15. package/dist/chunk-EVKPEPYP.cjs +2 -0
  16. package/dist/chunk-FAONFKQ2.cjs +9 -0
  17. package/dist/{chunk-E2IDHUN5.js → chunk-GHE5KR7E.js} +4 -4
  18. package/dist/chunk-GSVKVWEI.js +33 -0
  19. package/dist/chunk-IBQULJZC.cjs +3 -0
  20. package/dist/chunk-IETV3B4F.cjs +38 -0
  21. package/dist/{chunk-AJ33W3DD.cjs → chunk-IMY6Z3YA.cjs} +3 -3
  22. package/dist/{chunk-YKO34INI.cjs → chunk-K5Z7QHTN.cjs} +1 -1
  23. package/dist/{chunk-7MR3ZC3G.js → chunk-KLJGACPT.js} +3 -3
  24. package/dist/{chunk-HS74B6NF.cjs → chunk-L667KKJP.cjs} +4 -4
  25. package/dist/{chunk-BS3IICLO.cjs → chunk-MU4WLTQR.cjs} +4 -4
  26. package/dist/chunk-N2L5GXPF.cjs +211 -0
  27. package/dist/chunk-NPP5B5PV.cjs +16 -0
  28. package/dist/chunk-OVZCXWUJ.js +1663 -0
  29. package/dist/{chunk-WO4HFIOO.js → chunk-OX42Y2HR.js} +1 -1
  30. package/dist/{chunk-BN4D4W23.js → chunk-P5OWX4UR.js} +4 -4
  31. package/dist/chunk-PTN427IG.js +24 -0
  32. package/dist/chunk-Q3FGRSLA.js +38 -0
  33. package/dist/chunk-QFF6OUH6.js +9 -0
  34. package/dist/chunk-QOM4AP6R.cjs +9 -0
  35. package/dist/chunk-QQDH35OW.cjs +9 -0
  36. package/dist/{chunk-ZZBI6DXY.js → chunk-R3SDTEHC.js} +1 -1
  37. package/dist/chunk-RHTBV6KZ.js +24 -0
  38. package/dist/{chunk-PXLLLBZ3.cjs → chunk-RQN3DXJB.cjs} +1 -1
  39. package/dist/{chunk-E7TZALBH.js → chunk-SWRFZ3FV.js} +1 -1
  40. package/dist/chunk-TFOTA27Y.js +211 -0
  41. package/dist/chunk-TH3DUBVR.js +35 -0
  42. package/dist/{chunk-JUDFZS5N.cjs → chunk-TKJYRGEU.cjs} +1 -1
  43. package/dist/{chunk-T2P4BAWY.js → chunk-V54NMMTT.cjs} +6 -6
  44. package/dist/chunk-WOXKZOJ3.js +10 -0
  45. package/dist/chunk-WTS6WHUH.js +1 -0
  46. package/dist/chunk-X7OGQ4KH.cjs +1 -0
  47. package/dist/chunk-YPCQNE3R.js +16 -0
  48. package/dist/chunk-ZTDQPDC6.js +2 -0
  49. package/dist/components/audio-track-menu.cjs +1 -1
  50. package/dist/components/audio-track-menu.js +1 -1
  51. package/dist/components/clip.cjs +1 -1
  52. package/dist/components/clip.js +1 -1
  53. package/dist/components/files.cjs +1 -1
  54. package/dist/components/files.js +1 -1
  55. package/dist/components/img.cjs +1 -1
  56. package/dist/components/img.js +1 -1
  57. package/dist/components/list.cjs +1 -1
  58. package/dist/components/list.js +1 -1
  59. package/dist/components/player.cjs +1 -1
  60. package/dist/components/player.js +1 -1
  61. package/dist/components/pop.cjs +1 -1
  62. package/dist/components/pop.js +1 -1
  63. package/dist/components/text.cjs +1 -1
  64. package/dist/components/text.js +1 -1
  65. package/dist/components/upload.cjs +1 -1
  66. package/dist/components/upload.js +1 -1
  67. package/dist/config.cjs +1 -1
  68. package/dist/config.d.cts +1 -1
  69. package/dist/config.d.ts +1 -1
  70. package/dist/config.js +1 -1
  71. package/dist/embed/api.cjs +1 -1
  72. package/dist/embed/api.js +1 -1
  73. package/dist/embed/caption.cjs +1 -1
  74. package/dist/embed/caption.js +1 -1
  75. package/dist/embed/controller.cjs +1 -1
  76. package/dist/embed/controller.js +1 -1
  77. package/dist/embed/socket.cjs +1 -1
  78. package/dist/embed/socket.js +1 -1
  79. package/dist/index.cjs +1 -1
  80. package/dist/index.js +1 -1
  81. package/dist/react.cjs +1 -1
  82. package/dist/react.js +1 -1
  83. package/dist/themes/loader.cjs +1 -1
  84. package/dist/themes/loader.js +1 -1
  85. package/dist/utils/localization.cjs +1 -1
  86. package/dist/utils/localization.d.cts +2 -2
  87. package/dist/utils/localization.d.ts +2 -2
  88. package/dist/utils/localization.js +1 -1
  89. package/dist/utils/mave_element.cjs +1 -1
  90. package/dist/utils/mave_element.js +1 -1
  91. package/dist/vue.cjs +1 -1
  92. package/dist/vue.d.cts +16 -16
  93. package/dist/vue.d.ts +16 -16
  94. package/dist/vue.js +1 -1
  95. package/package.json +2 -2
  96. package/dist/chunk-27BWRXCN.js +0 -29
  97. package/dist/chunk-3T573OW4.cjs +0 -35
  98. package/dist/chunk-55JWHJJ5.cjs +0 -211
  99. package/dist/chunk-5STN56TL.cjs +0 -2
  100. package/dist/chunk-6XBQ5C3V.js +0 -17
  101. package/dist/chunk-BSJIDMTZ.js +0 -18
  102. package/dist/chunk-BZKKXYJP.js +0 -37
  103. package/dist/chunk-D75M3UFL.js +0 -1
  104. package/dist/chunk-D7LG2SMD.cjs +0 -33
  105. package/dist/chunk-ES5FUTSE.cjs +0 -1
  106. package/dist/chunk-F6EKAS27.js +0 -1
  107. package/dist/chunk-FUSQ4EZG.cjs +0 -3
  108. package/dist/chunk-GO6BV3T4.cjs +0 -29
  109. package/dist/chunk-HT464LCH.js +0 -10
  110. package/dist/chunk-J74VK4RB.cjs +0 -9
  111. package/dist/chunk-JBV2AYRP.js +0 -2
  112. package/dist/chunk-JR7IABIG.cjs +0 -18
  113. package/dist/chunk-KNAAIER3.js +0 -3
  114. package/dist/chunk-KUPCZDOX.cjs +0 -10
  115. package/dist/chunk-M22WSPSU.js +0 -9
  116. package/dist/chunk-NB5PC42C.js +0 -33
  117. package/dist/chunk-NROHM3YR.cjs +0 -1532
  118. package/dist/chunk-O2WRWRDO.cjs +0 -9
  119. package/dist/chunk-OIZ5B5LE.cjs +0 -17
  120. package/dist/chunk-TSTFPNEM.js +0 -211
  121. package/dist/chunk-TVXCJNTZ.js +0 -1532
  122. package/dist/chunk-UHJ4X2NY.cjs +0 -37
  123. package/dist/chunk-WIS6FQDY.cjs +0 -24
  124. package/dist/chunk-ZJWT7IOI.js +0 -24
  125. package/dist/chunk-ZODBVQLM.cjs +0 -1
  126. package/dist/chunk-ZUM5T3HV.js +0 -35
@@ -0,0 +1,24 @@
1
+ 'use strict';var chunkRRCW5BBR_cjs=require('./chunk-RRCW5BBR.cjs'),chunk2E5GLLOS_cjs=require('./chunk-2E5GLLOS.cjs');var fe=class{constructor(e,{target:s,config:r,callback:d,skipInitial:y}){this.t=new Set,this.o=false,this.i=false,this.h=e,s!==null&&this.t.add(s??e),this.o=y??this.o,this.callback=d,window.IntersectionObserver?(this.u=new IntersectionObserver(B=>{let _=this.i;this.i=false,this.o&&_||(this.handleChanges(B),this.h.requestUpdate());},r),e.addController(this)):console.warn("IntersectionController error: browser does not support IntersectionObserver.");}handleChanges(e){this.value=this.callback?.(e,this.u);}hostConnected(){for(let e of this.t)this.observe(e);}hostDisconnected(){this.disconnect();}async hostUpdated(){let e=this.u.takeRecords();e.length&&this.handleChanges(e);}observe(e){this.t.add(e),this.u.observe(e),this.i=true;}unobserve(e){this.t.delete(e),this.u.unobserve(e);}disconnect(){this.u.disconnect();}};var pe=i=>{throw TypeError(i)},ie=(i,e,s)=>e.has(i)||pe("Cannot "+s),t=(i,e,s)=>(ie(i,e,"read from private field"),s?s.call(i):e.get(i)),o=(i,e,s)=>e.has(i)?pe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),n=(i,e,s,r)=>(ie(i,e,"write to private field"),e.set(i,s),s),h=(i,e,s)=>(ie(i,e,"access private method"),s),G,_e=class R{static setDebug(e){n(R,G,e);}static debugEnabled(){if(t(R,G))return true;try{let e=globalThis;if(e.__MAVE_DATA_DEBUG__===!0||e.localStorage?.getItem("MAVE_DATA_DEBUG")==="1")return !0}catch{}return false}static log(e){console.log(`[mave_data]: ${e}`);}static error(e,s){typeof s>"u"?console.error(`[mave_data]: ${e}`):console.error(`[mave_data]: ${e}`,s);}static debug(e,s){R.debugEnabled()&&(typeof s>"u"?console.debug(`[mave_data]: ${e}`):console.debug(`[mave_data]: ${e}`,s));}};G=new WeakMap;o(_e,G,false);var f=_e,q,m,I,S,se,Y,z,W,p,me,ve,$,ne,ge,ye,be,we,ke,Ae,Be=class g{constructor(){if(o(this,p),o(this,q,{apiEndpoint:""}),o(this,m,[]),o(this,I,null),o(this,S,null),o(this,se,5e3),o(this,Y,50),o(this,z,48*1024),o(this,W,null),typeof window<"u"){let e=h(this,p,Ae).bind(this);n(this,S,e),document.addEventListener("visibilitychange",e),window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e);}}static get instance_(){return g.instance||(g.instance=new g),g.instance}static set config(e){n(g.instance_,q,e),typeof e.debug=="boolean"&&f.setDebug(e.debug);}static push(e){var s;h(s=g.instance_,p,me).call(s,e);}static flush(){var e;h(e=g.instance_,p,$).call(e);}static flushAsync(){var e;return h(e=g.instance_,p,ve).call(e)}static flushOnExit(){var e;h(e=g.instance_,p,$).call(e,{keepalive:true,preferBeacon:true});}static __resetForTests(){var e;g.instance&&h(e=g.instance,p,ge).call(e),g.instance=void 0;}};q=new WeakMap;m=new WeakMap;I=new WeakMap;S=new WeakMap;se=new WeakMap;Y=new WeakMap;z=new WeakMap;W=new WeakMap;p=new WeakSet;me=function(i){let e={name:i.name||"unknown",timestamp:i.timestamp||Date.now(),session_id:i.session_id||"",...i};t(this,m).push(e),f.debug("Data.push",{name:e.name,session_id:e.session_id,embed_id:e.embed_id,video_time:e.video_time,buffer_size:t(this,m).length}),!t(this,I)&&typeof globalThis.setInterval=="function"&&n(this,I,globalThis.setInterval(()=>h(this,p,$).call(this),t(this,se))),t(this,m).length>=t(this,Y)&&h(this,p,$).call(this);};ve=function(i){return h(this,p,$).call(this,i),t(this,W)??Promise.resolve(true)};$=function(i){if(t(this,m).length===0||t(this,W))return;let e=[...t(this,m)];n(this,m,[]);let s=t(this,q).apiEndpoint||"https://metrics.video-dns.com/v1/events",r=i?.keepalive??(typeof document<"u"&&document.visibilityState==="hidden"),d=i?.preferBeacon??false,y=h(this,p,ye).call(this,e);f.debug("Data.flush.start",{url:s,buffered:e.length,batches:y.map(_=>_.length),keepalive:r,preferBeacon:d});let B=false;n(this,W,(async()=>{for(let _ of y){let Ce={events:_};if(f.debug("Data.flush.batch",{size:_.length,first:_[0]?.name,last:_[_.length-1]?.name}),!await h(this,p,we).call(this,s,Ce,r,d))return n(this,m,[..._,...t(this,m)]),false}return true})().catch(_=>(f.error("Failed to send metrics",_),n(this,m,[...e,...t(this,m)]),false)).then(_=>(f.debug("Data.flush.done",{ok:_,remaining_buffer:t(this,m).length}),_&&t(this,m).length>0&&(B=true),_)).finally(()=>{n(this,W,null),t(this,m).length===0&&h(this,p,ne).call(this),B&&h(this,p,$).call(this);}));};ne=function(){t(this,I)!=null&&(typeof globalThis.clearInterval=="function"&&globalThis.clearInterval(t(this,I)),n(this,I,null));};ge=function(){typeof window<"u"&&t(this,S)&&(document.removeEventListener("visibilitychange",t(this,S)),window.removeEventListener("pagehide",t(this,S)),window.removeEventListener("beforeunload",t(this,S))),h(this,p,ne).call(this),n(this,m,[]),n(this,W,null);};ye=function(i){let e=[],s=[],r=0;for(let d of i){let y=h(this,p,be).call(this,d),B=r+y>t(this,z),_=s.length>=t(this,Y);s.length>0&&(B||_)&&(e.push(s),s=[],r=0),s.push(d),r+=y;}return s.length>0&&e.push(s),e};be=function(i){try{return JSON.stringify(i).length}catch{return 1024}};we=async function(i,e,s,r){if(r&&s&&h(this,p,ke).call(this,i,e))return f.debug("Data.send.beacon",{url:i,bytes:JSON.stringify(e).length}),true;try{let d=await fetch(i,{method:"POST",keepalive:s,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return f.debug("Data.send.fetch",{url:i,ok:d.ok,status:d.status}),d.ok}catch(d){return f.error("Failed to send metrics",d),f.debug("Data.send.fetch.error",d),false}};ke=function(i,e){try{if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return !1;let s=JSON.stringify(e);if(s.length>t(this,z))return !1;let r=new Blob([s],{type:"application/json"});return navigator.sendBeacon(i,r)}catch{return false}};Ae=function(i){let e=i?.type==="pagehide"||i?.type==="beforeunload",s=document.visibilityState==="hidden";(e||s)&&(f.debug(`Data.handleVisibilityChange (${i?.type||"visibility"})`,{state:document.visibilityState}),h(this,p,$).call(this,{keepalive:true,preferBeacon:true}));};var u=Be;function Ne(){let i=globalThis.crypto;if(i?.randomUUID)return i.randomUUID();if(i?.getRandomValues)return "10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>{let d=i.getRandomValues(new Uint8Array(1))[0]??0;return (Number(r)^(d&15)>>Number(r)/4).toString(16)});let e=Math.random().toString(16).slice(2).padEnd(12,"0"),s=Date.now().toString(16).padStart(12,"0");return `${s.slice(0,8)}-${s.slice(8,12)}-4000-8000-${e.slice(0,12)}`}var ae=(i=>(i.PLAYING="playing",i.ENDED="ended",i.PAUSE="pause",i))(ae||{}),a,c,b,w,C,M,O,P,k,D,v,A,he,re,le,E,J,l,U,j,X,H,x,L,Me,Te,Ee,F,te,$e,Se,Pe,N,T,De,Ge=class{constructor(...i){if(o(this,l),this.VERSION="0.1.0",o(this,a),o(this,c,null),o(this,b,false),o(this,w,false),o(this,C,null),o(this,M,false),o(this,O,0),o(this,P,0),o(this,k,null),o(this,D,null),o(this,v,null),o(this,A,null),o(this,he,750),o(this,re,1),o(this,le,300),o(this,E,false),o(this,J,e=>h(this,l,De).call(this,e)),o(this,j,()=>{if(!t(this,b)||!t(this,a))return;h(this,l,U).call(this),f.debug("Metrics.native.seeking",{currentTime:t(this,a).currentTime,lastObservedVideoTime:t(this,P),paused:t(this,a).paused,seeking:t(this,a).seeking,lastEventType:t(this,c)});let e=t(this,c)==="play"||!t(this,a).paused&&!t(this,a).ended;if(e&&t(this,c)!=="pause"){n(this,w,true),n(this,M,false),h(this,l,F).call(this),h(this,l,T).call(this);let s=t(this,P)||t(this,a).currentTime||0,r=h(this,l,L).call(this,"pause");u.push({...r,name:"pause",video_time:s}),n(this,c,"pause"),u.flush(),f.debug("Metrics.scrub.pause_sent",{pauseTime:s,currentTime:t(this,a).currentTime});}else f.debug("Metrics.scrub.pause_not_sent",{wasPlaying:e,lastEventType:t(this,c)});}),o(this,X,()=>{t(this,b)&&t(this,a)&&(f.debug("Metrics.native.seeked",{currentTime:t(this,a).currentTime,paused:t(this,a).paused,seeking:t(this,a).seeking,wasPlayingBeforeSeek:t(this,w),lastEventType:t(this,c)}),t(this,w)&&(h(this,l,U).call(this),n(this,C,window.setTimeout(()=>{if(n(this,C,null),!!t(this,b)&&t(this,a)){if(t(this,c)==="play"){n(this,w,false),n(this,M,false);return}if(!t(this,a).seeking&&!t(this,a).paused&&!t(this,a).ended){let e=h(this,l,L).call(this,"play");u.push({...e,name:"play"}),n(this,c,"play"),n(this,D,Date.now()),n(this,E,true),n(this,O,Date.now()+1500),h(this,l,N).call(this),n(this,M,false),u.flush(),n(this,w,false);}else n(this,M,true),n(this,w,false);}},200))));}),o(this,H,()=>{t(this,b)&&document.visibilityState==="hidden"&&u.flush();}),o(this,x,e=>{if(t(this,b)){if(e.persisted){u.flush();return}h(this,l,te).call(this),h(this,l,Ee).call(this),u.flushOnExit();}}),this.sessionId=Ne(),i.length<2)f.error("Metrics requires two arguments: a querySelectorable, hls instance or HTMLMediaElement/HTMLVideoElement and a unique embedId for your video.");else if(typeof i[0]=="string"&&(this.querySelectorable=i[0],this.embedId=i[1]),i[0]instanceof HTMLVideoElement||i[0]instanceof HTMLMediaElement?n(this,a,i[0]):typeof i[0]=="object"&&(this.hls=i[0]),this.embedId=i[1],i[2]){let e=i[2];this.component=e.component;}}static set config(i){u.config=i,typeof i.debug=="boolean"&&f.setDebug(i.debug);}monitor(){let i=this.querySelectorable?document.querySelector(this.querySelectorable):this.hls?.media;return t(this,b)?this:(i||t(this,a)?(t(this,a)||n(this,a,i),f.debug("Metrics.monitor",{embed_id:this.embedId,session_id:this.sessionId,currentTime:t(this,a).currentTime,paused:t(this,a).paused,seeking:t(this,a).seeking,readyState:t(this,a).readyState}),h(this,l,Se).call(this),n(this,P,t(this,a).currentTime||0),window.addEventListener("visibilitychange",t(this,H)),window.addEventListener("pagehide",t(this,x)),n(this,b,true)):f.error(`${this.querySelectorable} is not a valid reference to a HTMLVideoElement.`),this)}demonitor(){t(this,b)&&(h(this,l,te).call(this),h(this,l,Me).call(this),h(this,l,U).call(this),h(this,l,T).call(this),h(this,l,Pe).call(this),window.removeEventListener("visibilitychange",t(this,H)),window.removeEventListener("pagehide",t(this,x)),n(this,b,false));}};a=new WeakMap;c=new WeakMap;b=new WeakMap;w=new WeakMap;C=new WeakMap;M=new WeakMap;O=new WeakMap;P=new WeakMap;k=new WeakMap;D=new WeakMap;v=new WeakMap;A=new WeakMap;he=new WeakMap;re=new WeakMap;le=new WeakMap;E=new WeakMap;J=new WeakMap;l=new WeakSet;U=function(){t(this,C)!=null&&(window.clearTimeout(t(this,C)),n(this,C,null));};j=new WeakMap;X=new WeakMap;H=new WeakMap;x=new WeakMap;L=function(i){return {name:i,duration:t(this,a)?.duration,video_time:t(this,a)?.currentTime,session_id:this.sessionId,embed_id:this.embedId||"unknown",component:this.component,source_url:window.location.href,timestamp:Date.now()}};Me=function(){t(this,a)&&(t(this,a).paused||t(this,c)!=="pause"&&(t(this,v)||(h(this,l,Te).call(this),u.flush())));};Te=function(){t(this,a)&&t(this,c)!=="pause"&&(t(this,v)||(u.push(h(this,l,L).call(this,"pause")),n(this,c,"pause")));};Ee=function(){t(this,a)&&t(this,c)==="play"&&(t(this,v)||(u.push(h(this,l,L).call(this,"pause")),n(this,c,"pause")));};F=function(){t(this,v)&&(window.clearTimeout(t(this,v)),n(this,v,null)),n(this,A,null);};te=function(){if(!t(this,v)||!t(this,A))return;window.clearTimeout(t(this,v));let i=t(this,A);n(this,v,null),n(this,A,null),u.push(i),n(this,c,"pause"),n(this,E,false),u.flush();};$e=function(i){t(this,v)||(n(this,A,i),n(this,v,window.setTimeout(()=>{if(!t(this,A)){n(this,v,null);return}let e=t(this,A);n(this,A,null),n(this,v,null),u.push(e),n(this,c,"pause"),u.flush();},t(this,le))));};Se=function(){f.debug("Metrics.listeners.attach",{embed_id:this.embedId,session_id:this.sessionId});for(let i of Object.values(ae))t(this,a).addEventListener(i,t(this,J));t(this,a).addEventListener("seeking",t(this,j)),t(this,a).addEventListener("seeked",t(this,X));};Pe=function(){for(let i of Object.values(ae))t(this,a).removeEventListener(i,t(this,J));t(this,a).removeEventListener("seeking",t(this,j)),t(this,a).removeEventListener("seeked",t(this,X));};N=function(){if(!t(this,a)||t(this,k)!=null)return;let i=()=>{if(!t(this,a)){n(this,k,null);return}n(this,P,t(this,a).currentTime||t(this,P)),t(this,b)&&!t(this,a).paused&&!t(this,a).ended?n(this,k,window.requestAnimationFrame(i)):n(this,k,null);};n(this,k,window.requestAnimationFrame(i));};T=function(){t(this,k)!=null&&(window.cancelAnimationFrame(t(this,k)),n(this,k,null));};De=function(i){let e=h(this,l,L).call(this,i.type);switch(f.debug("Metrics.native.event",{type:i.type,currentTime:t(this,a)?.currentTime,paused:t(this,a)?.paused,seeking:t(this,a)?.seeking,readyState:t(this,a)?.readyState,lastEventType:t(this,c),wasPlayingBeforeSeek:t(this,w),awaitingSeekResumePlay:t(this,M)}),i.type){case "playing":if(h(this,l,F).call(this),t(this,M)){if(t(this,c)!=="play"){let d=h(this,l,L).call(this,"play");u.push({...d,name:"play"}),n(this,c,"play"),n(this,D,Date.now()),n(this,E,true),n(this,O,Date.now()+1500),h(this,l,N).call(this),u.flush();}n(this,M,false);break}if(t(this,a)?.seeking||t(this,w))break;if(Date.now()<t(this,O)){n(this,c,"play"),h(this,l,N).call(this);break}if(t(this,c)==="play")break;u.push({...e,name:"play"}),n(this,c,"play"),n(this,D,Date.now()),n(this,E,false),h(this,l,N).call(this);break;case "pause":if(t(this,a)?.seeking){h(this,l,T).call(this);break}if(t(this,c)==="pause"){h(this,l,T).call(this);break}let s=t(this,D)==null?Number.POSITIVE_INFINITY:Date.now()-t(this,D),r=t(this,a)?.currentTime??0;if(s<=t(this,he)&&(r<=t(this,re)||t(this,E))){h(this,l,$e).call(this,{...e,name:"pause"}),h(this,l,T).call(this);break}u.push({...e,name:"pause"}),n(this,c,"pause"),n(this,E,false),h(this,l,T).call(this),u.flush();break;case "ended":h(this,l,F).call(this),h(this,l,T).call(this),t(this,c)!=="pause"&&(u.push({...e,name:"pause"}),n(this,c,"pause"),u.flush());break;}};var{I:ze}=chunk2E5GLLOS_cjs.f;var Ie=i=>i.strings===void 0;var V=(i,e)=>{let s=i._$AN;if(s===void 0)return false;for(let r of s)r._$AO?.(e,false),V(r,e);return true},Q=i=>{let e,s;do{if((e=i._$AM)===void 0)break;s=e._$AN,s.delete(i),i=e;}while(s?.size===0)},We=i=>{for(let e;e=i._$AM;i=e){let s=e._$AN;if(s===void 0)e._$AN=s=new Set;else if(s.has(i))break;s.add(i),Re(e);}};function Oe(i){this._$AN!==void 0?(Q(this),this._$AM=i,We(this)):this._$AM=i;}function Ve(i,e=false,s=0){let r=this._$AH,d=this._$AN;if(d!==void 0&&d.size!==0)if(e)if(Array.isArray(r))for(let y=s;y<r.length;y++)V(r[y],false),Q(r[y]);else r!=null&&(V(r,false),Q(r));else V(this,i);}var Re=i=>{i.type==chunkRRCW5BBR_cjs.a.CHILD&&(i._$AP??(i._$AP=Ve),i._$AQ??(i._$AQ=Oe));},K=class extends chunkRRCW5BBR_cjs.c{constructor(){super(...arguments),this._$AN=void 0;}_$AT(e,s,r){super._$AT(e,s,r),We(this),this.isConnected=e._$AU;}_$AO(e,s=true){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),s&&(V(this,e),Q(this));}setValue(e){if(Ie(this._$Ct))this._$Ct._$AI(e,this);else {let s=[...this._$Ct._$AH];s[this._$Ci]=e,this._$Ct._$AI(s,this,0);}}disconnected(){}reconnected(){}};var oe=new WeakMap,it=chunkRRCW5BBR_cjs.b(class extends K{render(i){return chunk2E5GLLOS_cjs.e}update(i,[e]){let s=e!==this.G;return s&&this.G!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.G=e,this.ht=i.options?.host,this.rt(this.ct=i.element)),chunk2E5GLLOS_cjs.e}rt(i){if(this.isConnected||(i=void 0),typeof this.G=="function"){let e=this.ht??globalThis,s=oe.get(e);s===void 0&&(s=new WeakMap,oe.set(e,s)),s.get(this.G)!==void 0&&this.G.call(this.ht,void 0),s.set(this.G,i),i!==void 0&&this.G.call(this.ht,i);}else this.G.value=i;}get lt(){return typeof this.G=="function"?oe.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});/*! Bundled license information:
2
+
3
+ @lit-labs/observers/intersection-controller.js:
4
+ (**
5
+ * @license
6
+ * Copyright 2021 Google LLC
7
+ * SPDX-License-Identifier: BSD-3-Clause
8
+ *)
9
+
10
+ lit-html/directive-helpers.js:
11
+ lit-html/directives/ref.js:
12
+ (**
13
+ * @license
14
+ * Copyright 2020 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ *)
17
+
18
+ lit-html/async-directive.js:
19
+ (**
20
+ * @license
21
+ * Copyright 2017 Google LLC
22
+ * SPDX-License-Identifier: BSD-3-Clause
23
+ *)
24
+ */exports.a=fe;exports.b=Ge;exports.c=it;
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var ct={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},E={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},Wt={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},ut=Object.entries(Wt),K=ut.reduce((t,[e,i])=>(t[e]=i.toLowerCase(),t),{}),Bt={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},ht=ut.reduce((t,[e,i])=>(t[e]=i.toLowerCase(),t),{...Bt});Object.entries(ht).reduce((t,[e,i])=>{let o=K[e];return o&&(t[i]=o),t},{userinactivechange:"userinactive"});var ni=Object.entries(K).reduce((t,[e,i])=>{let o=ht[e];return o&&(t[i]=o),t},{userinactive:"userinactivechange"}),ai={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},ri={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var si={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},li={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},di={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var ci={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};var le=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return true}},de=class extends le{},ce=class extends de{constructor(){super(...arguments),this.role=null;}},xe=class{observe(){}unobserve(){}disconnect(){}},mt={createElement:function(){return new z.HTMLElement},createElementNS:function(){return new z.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(t){return false}},z={ResizeObserver:xe,document:mt,Node:de,Element:ce,HTMLElement:class extends ce{constructor(){super(...arguments),this.innerHTML="";}get content(){return new z.DocumentFragment}},DocumentFragment:class extends le{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(t){return null},setItem(t,e){},removeItem(t){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return ""}},matchMedia(t){return {matches:false,media:t}},DOMParser:class{parseFromString(e,i){return {body:{textContent:e}}}}},pt=typeof window>"u"||typeof window.customElements>"u",ft=Object.keys(z).every(t=>t in globalThis),u=pt&&!ft?z:globalThis,Le=pt&&!ft?mt:globalThis.document;function Et({anchor:t,floating:e,placement:i}){let o=qt({anchor:t,floating:e}),{x:n,y:a}=$t(o,i);return {x:n,y:a}}function qt({anchor:t,floating:e}){return {anchor:Vt(t,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function Vt(t,e){var i;let o=t.getBoundingClientRect(),n=(i=e?.getBoundingClientRect())!=null?i:{x:0,y:0};return {x:o.x-n.x,y:o.y-n.y,width:o.width,height:o.height}}function $t({anchor:t,floating:e},i){let o=Gt(i)==="x"?"y":"x",n=o==="y"?"height":"width",a=vt(i),r=t.x+t.width/2-e.width/2,h=t.y+t.height/2-e.height/2,c=t[n]/2-e[n]/2,p;switch(a){case "top":p={x:r,y:t.y-e.height};break;case "bottom":p={x:r,y:t.y+t.height};break;case "right":p={x:t.x+t.width,y:h};break;case "left":p={x:t.x-e.width,y:h};break;default:p={x:t.x,y:t.y};}switch(i.split("-")[1]){case "start":p[o]-=c;break;case "end":p[o]+=c;break}return p}function vt(t){return t.split("-")[0]}function Gt(t){return ["top","bottom"].includes(vt(t))?"y":"x"}var gt=new WeakMap,Re=t=>{let e=gt.get(t);return e||gt.set(t,e=new Set),e},bt=new u.ResizeObserver(t=>{for(let e of t)for(let i of Re(e.target))i(e);});function Y(t,e){Re(t).add(e),bt.observe(t);}function X(t,e){let i=Re(t);i.delete(e),i.size||bt.unobserve(t);}var O=class extends Event{constructor({action:e="auto",relatedTarget:i,...o}){super("invoke",o),this.action=e,this.relatedTarget=i;}},ue=class extends Event{constructor({newState:e,oldState:i,...o}){super("toggle",o),this.newState=e,this.oldState=i;}};function P(t){let e={};for(let i of t)e[i.name]=i.value;return e}function he(t){var e;return (e=me(t))!=null?e:N(t,"media-controller")}function me(t){var e;let{MEDIA_CONTROLLER:i}=E,o=t.getAttribute(i);if(o)return (e=Z(t))==null?void 0:e.getElementById(o)}var Ai=(t,e,i=".value")=>{let o=t.querySelector(i);o&&(o.textContent=e);},Qt=(t,e)=>{let i=`slot[name="${e}"]`,o=t.shadowRoot.querySelector(i);return o?o.children:[]},Ti=(t,e)=>Qt(t,e)[0],pe=(t,e)=>!t||!e?false:t?.contains(e)?true:pe(t,e.getRootNode().host),N=(t,e)=>{if(!t)return null;let i=t.closest(e);return i||N(t.getRootNode().host,e)};function De(t=document){var e;let i=t?.activeElement;return i?(e=De(i.shadowRoot))!=null?e:i:null}function Z(t){var e;let i=(e=t?.getRootNode)==null?void 0:e.call(t);return i instanceof ShadowRoot||i instanceof Document?i:null}function _t(t,{depth:e=3,checkOpacity:i=true,checkVisibilityCSS:o=true}={}){if(t.checkVisibility)return t.checkVisibility({checkOpacity:i,checkVisibilityCSS:o});let n=t;for(;n&&e>0;){let a=getComputedStyle(n);if(i&&a.opacity==="0"||o&&a.visibility==="hidden"||a.display==="none")return false;n=n.parentElement,e--;}return true}function yi(t,e,i,o){let n=o.x-i.x,a=o.y-i.y,r=n*n+a*a;if(r===0)return 0;let h=((t-i.x)*n+(e-i.y)*a)/r;return Math.max(0,Math.min(1,h))}function At(t,e){let i=Ft(t,o=>o===e);return i||Ce(t,e)}function Ft(t,e){var i,o;let n;for(n of (i=t.querySelectorAll("style:not([media])"))!=null?i:[]){let a;try{a=(o=n.sheet)==null?void 0:o.cssRules;}catch{continue}for(let r of a??[])if(e(r.selectorText))return r}}function Ce(t,e){var i,o;let n=(i=t.querySelectorAll("style:not([media])"))!=null?i:[],a=n?.[n.length-1];return a?.sheet?(a?.sheet.insertRule(`${e}{}`,a.sheet.cssRules.length),(o=a.sheet.cssRules)==null?void 0:o[a.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",t),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function Kt(t,e,i=Number.NaN){let o=t.getAttribute(e);return o!=null?+o:i}function ki(t,e,i){let o=+i;if(i==null||Number.isNaN(o)){t.hasAttribute(e)&&t.removeAttribute(e);return}Kt(t,e,void 0)!==o&&t.setAttribute(e,`${o}`);}function fe(t,e){return t.hasAttribute(e)}function Oe(t,e,i){if(i==null){t.hasAttribute(e)&&t.removeAttribute(e);return}fe(t,e)!=i&&t.toggleAttribute(e,i);}function M(t,e,i=null){var o;return (o=t.getAttribute(e))!=null?o:i}function U(t,e,i){if(i==null){t.hasAttribute(e)&&t.removeAttribute(e);return}let o=`${i}`;M(t,e,void 0)!==o&&t.setAttribute(e,o);}var Fe=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},s=(t,e,i)=>(Fe(t,e,"read from private field"),i?i.call(t):e.get(t)),l=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i);},v=(t,e,i,o)=>(Fe(t,e,"write to private field"),e.set(t,i),i),d=(t,e,i)=>(Fe(t,e,"access private method"),i),g,L,S,Ee,ve,R,ee,Pe,Tt,_e,Ke,Ae,ge,Ne,Ue,yt,He,kt,We,St,H,W,B,te,Te,ze,Be,It,Ye,wt,qe,Mt,Xe,xt,Ve,Lt,$e,Rt,J,ye,Ge,Dt,j,ke,be,Qe;function Ct({type:t,text:e,value:i,checked:o}){let n=Le.createElement("media-chrome-menu-item");n.type=t??"",n.part.add("menu-item"),t&&n.part.add(t),n.value=i,n.checked=o;let a=Le.createElement("span");return a.textContent=e,n.append(a),n}function Ot(t,e){let i=t.querySelector(`:scope > [slot="${e}"]`);if(i?.nodeName=="SLOT"&&(i=i.assignedElements({flatten:true})[0]),i)return i=i.cloneNode(true),i;let o=t.shadowRoot.querySelector(`[name="${e}"] > svg`);return o?o.cloneNode(true):""}function zt(t){return `
1
+ import {e,g as g$1,d as d$1,f}from'./chunk-KA24PL7V.js';var ct={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_LOOP_REQUEST:"medialooprequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},E={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},Wt={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_LOOP:"mediaLoop",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},ut=Object.entries(Wt),K=ut.reduce((t,[e,i])=>(t[e]=i.toLowerCase(),t),{}),Bt={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},ht=ut.reduce((t,[e,i])=>(t[e]=i.toLowerCase(),t),{...Bt});Object.entries(ht).reduce((t,[e,i])=>{let o=K[e];return o&&(t[i]=o),t},{userinactivechange:"userinactive"});var ni=Object.entries(K).reduce((t,[e,i])=>{let o=ht[e];return o&&(t[i]=o),t},{userinactive:"userinactivechange"}),ai={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},ri={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var si={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},li={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},di={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var ci={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};var le=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return true}},de=class extends le{},ce=class extends de{constructor(){super(...arguments),this.role=null;}},xe=class{observe(){}unobserve(){}disconnect(){}},mt={createElement:function(){return new z.HTMLElement},createElementNS:function(){return new z.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(t){return false}},z={ResizeObserver:xe,document:mt,Node:de,Element:ce,HTMLElement:class extends ce{constructor(){super(...arguments),this.innerHTML="";}get content(){return new z.DocumentFragment}},DocumentFragment:class extends le{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(t){return null},setItem(t,e){},removeItem(t){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return ""}},matchMedia(t){return {matches:false,media:t}},DOMParser:class{parseFromString(e,i){return {body:{textContent:e}}}}},pt="global"in globalThis&&globalThis?.global===globalThis||typeof window>"u"||typeof window.customElements>"u",ft=Object.keys(z).every(t=>t in globalThis),u=pt&&!ft?z:globalThis,Le=pt&&!ft?mt:globalThis.document;function Et({anchor:t,floating:e,placement:i}){let o=qt({anchor:t,floating:e}),{x:n,y:a}=$t(o,i);return {x:n,y:a}}function qt({anchor:t,floating:e}){return {anchor:Vt(t,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function Vt(t,e){var i;let o=t.getBoundingClientRect(),n=(i=e?.getBoundingClientRect())!=null?i:{x:0,y:0};return {x:o.x-n.x,y:o.y-n.y,width:o.width,height:o.height}}function $t({anchor:t,floating:e},i){let o=Qt(i)==="x"?"y":"x",n=o==="y"?"height":"width",a=vt(i),r=t.x+t.width/2-e.width/2,h=t.y+t.height/2-e.height/2,c=t[n]/2-e[n]/2,p;switch(a){case "top":p={x:r,y:t.y-e.height};break;case "bottom":p={x:r,y:t.y+t.height};break;case "right":p={x:t.x+t.width,y:h};break;case "left":p={x:t.x-e.width,y:h};break;default:p={x:t.x,y:t.y};}switch(i.split("-")[1]){case "start":p[o]-=c;break;case "end":p[o]+=c;break}return p}function vt(t){return t.split("-")[0]}function Qt(t){return ["top","bottom"].includes(vt(t))?"y":"x"}var gt=new WeakMap,Re=t=>{let e=gt.get(t);return e||gt.set(t,e=new Set),e},bt=new u.ResizeObserver(t=>{for(let e of t)for(let i of Re(e.target))i(e);});function Y(t,e){Re(t).add(e),bt.observe(t);}function X(t,e){let i=Re(t);i.delete(e),i.size||bt.unobserve(t);}var O=class extends Event{constructor({action:e="auto",relatedTarget:i,...o}){super("invoke",o),this.action=e,this.relatedTarget=i;}},ue=class extends Event{constructor({newState:e,oldState:i,...o}){super("toggle",o),this.newState=e,this.oldState=i;}};function P(t){let e={};for(let i of t)e[i.name]=i.value;return e}function he(t){var e;return (e=me(t))!=null?e:N(t,"media-controller")}function me(t){var e;let{MEDIA_CONTROLLER:i}=E,o=t.getAttribute(i);if(o)return (e=Z(t))==null?void 0:e.getElementById(o)}var Ai=(t,e,i=".value")=>{let o=t.querySelector(i);o&&(o.textContent=e);},Gt=(t,e)=>{let i=`slot[name="${e}"]`,o=t.shadowRoot.querySelector(i);return o?o.children:[]},Ti=(t,e)=>Gt(t,e)[0],pe=(t,e)=>!t||!e?false:t?.contains(e)?true:pe(t,e.getRootNode().host),N=(t,e)=>{if(!t)return null;let i=t.closest(e);return i||N(t.getRootNode().host,e)};function De(t=document){var e;let i=t?.activeElement;return i?(e=De(i.shadowRoot))!=null?e:i:null}function Z(t){var e;let i=(e=t?.getRootNode)==null?void 0:e.call(t);return i instanceof ShadowRoot||i instanceof Document?i:null}function _t(t,{depth:e=3,checkOpacity:i=true,checkVisibilityCSS:o=true}={}){if(t.checkVisibility)return t.checkVisibility({checkOpacity:i,checkVisibilityCSS:o});let n=t;for(;n&&e>0;){let a=getComputedStyle(n);if(i&&a.opacity==="0"||o&&a.visibility==="hidden"||a.display==="none")return false;n=n.parentElement,e--;}return true}function yi(t,e,i,o){let n=o.x-i.x,a=o.y-i.y,r=n*n+a*a;if(r===0)return 0;let h=((t-i.x)*n+(e-i.y)*a)/r;return Math.max(0,Math.min(1,h))}function At(t,e){let i=Ft(t,o=>o===e);return i||Ce(t,e)}function Ft(t,e){var i,o;let n;for(n of (i=t.querySelectorAll("style:not([media])"))!=null?i:[]){let a;try{a=(o=n.sheet)==null?void 0:o.cssRules;}catch{continue}for(let r of a??[])if(e(r.selectorText))return r}}function Ce(t,e){var i,o;let n=(i=t.querySelectorAll("style:not([media])"))!=null?i:[],a=n?.[n.length-1];return a?.sheet?(a?.sheet.insertRule(`${e}{}`,a.sheet.cssRules.length),(o=a.sheet.cssRules)==null?void 0:o[a.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",t),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function Kt(t,e,i=Number.NaN){let o=t.getAttribute(e);return o!=null?+o:i}function ki(t,e,i){let o=+i;if(i==null||Number.isNaN(o)){t.hasAttribute(e)&&t.removeAttribute(e);return}Kt(t,e,void 0)!==o&&t.setAttribute(e,`${o}`);}function fe(t,e){return t.hasAttribute(e)}function Oe(t,e,i){if(i==null){t.hasAttribute(e)&&t.removeAttribute(e);return}fe(t,e)!=i&&t.toggleAttribute(e,i);}function M(t,e,i=null){var o;return (o=t.getAttribute(e))!=null?o:i}function U(t,e,i){if(i==null){t.hasAttribute(e)&&t.removeAttribute(e);return}let o=`${i}`;M(t,e,void 0)!==o&&t.setAttribute(e,o);}var Fe=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},s=(t,e,i)=>(Fe(t,e,"read from private field"),i?i.call(t):e.get(t)),l=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i);},v=(t,e,i,o)=>(Fe(t,e,"write to private field"),e.set(t,i),i),d=(t,e,i)=>(Fe(t,e,"access private method"),i),g,L,S,Ee,ve,R,ee,Pe,Tt,_e,Ke,Ae,ge,Ne,Ue,yt,He,kt,We,St,H,W,B,te,Te,ze,Be,It,Ye,wt,qe,Mt,Xe,xt,Ve,Lt,$e,Rt,J,ye,Qe,Dt,j,ke,be,Ge;function Ct({type:t,text:e,value:i,checked:o}){let n=Le.createElement("media-chrome-menu-item");n.type=t??"",n.part.add("menu-item"),t&&n.part.add(t),n.value=i,n.checked=o;let a=Le.createElement("span");return a.textContent=e,n.append(a),n}function Ot(t,e){let i=t.querySelector(`:scope > [slot="${e}"]`);if(i?.nodeName=="SLOT"&&(i=i.assignedElements({flatten:true})[0]),i)return i=i.cloneNode(true),i;let o=t.shadowRoot.querySelector(`[name="${e}"] > svg`);return o?o.cloneNode(true):""}function zt(t){return `
2
2
  <style>
3
3
  :host {
4
4
  font: var(--media-font,
@@ -173,7 +173,7 @@
173
173
  <slot></slot>
174
174
  </div>
175
175
  <slot name="checked-indicator" hidden></slot>
176
- `}var x={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},D=class extends u.HTMLElement{constructor(){if(super(),l(this,Pe),l(this,_e),l(this,ge),l(this,Ue),l(this,He),l(this,We),l(this,B),l(this,Te),l(this,Be),l(this,Ye),l(this,qe),l(this,Xe),l(this,Ve),l(this,$e),l(this,J),l(this,Ge),l(this,j),l(this,be),l(this,g,null),l(this,L,null),l(this,S,null),l(this,Ee,new Set),l(this,ve,void 0),l(this,R,false),l(this,ee,null),l(this,Ae,()=>{let e=s(this,Ee),i=new Set(this.items);for(let o of e)i.has(o)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:o}));for(let o of i)e.has(o)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:o}));v(this,Ee,i);}),l(this,H,()=>{d(this,B,te).call(this),d(this,Te,ze).call(this,false);}),l(this,W,()=>{d(this,B,te).call(this);}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=P(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e);}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),v(this,ve,new MutationObserver(s(this,Ae))),s(this,ve).observe(this.defaultSlot,{childList:true});}static get observedAttributes(){return [x.DISABLED,x.HIDDEN,x.STYLE,x.ANCHOR,E.MEDIA_CONTROLLER]}static formatMenuItemText(e,i){return e}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this);}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this);}handleEvent(e){switch(e.type){case "slotchange":d(this,Pe,Tt).call(this,e);break;case "invoke":d(this,Ue,yt).call(this,e);break;case "click":d(this,Be,It).call(this,e);break;case "toggle":d(this,qe,Mt).call(this,e);break;case "focusout":d(this,Ve,Lt).call(this,e);break;case "keydown":d(this,$e,Rt).call(this,e);break}}connectedCallback(){var e,i;v(this,ee,Ce(this.shadowRoot,":host")),d(this,ge,Ne).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),v(this,g,me(this)),(i=(e=s(this,g))==null?void 0:e.associateElement)==null||i.call(e,this),this.hidden||(Y(ie(this),s(this,H)),Y(this,s(this,W))),d(this,_e,Ke).call(this);}disconnectedCallback(){var e,i;X(ie(this),s(this,H)),X(this,s(this,W)),this.disable(),(i=(e=s(this,g))==null?void 0:e.unassociateElement)==null||i.call(e,this),v(this,g,null);}attributeChangedCallback(e,i,o){var n,a,r,h;e===x.HIDDEN&&o!==i?(s(this,R)||v(this,R,true),this.hidden?d(this,We,St).call(this):d(this,He,kt).call(this),this.dispatchEvent(new ue({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:true}))):e===E.MEDIA_CONTROLLER?(i&&((a=(n=s(this,g))==null?void 0:n.unassociateElement)==null||a.call(n,this),v(this,g,null)),o&&this.isConnected&&(v(this,g,me(this)),(h=(r=s(this,g))==null?void 0:r.associateElement)==null||h.call(r,this))):e===x.DISABLED&&o!==i?o==null?this.enable():this.disable():e===x.STYLE&&o!==i&&d(this,ge,Ne).call(this);}formatMenuItemText(e,i){return this.constructor.formatMenuItemText(e,i)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`);}get anchorElement(){var e;return this.anchor?(e=Z(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:true}).filter(Yt)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,i;return (i=(e=this.checkedItems[0])==null?void 0:e.value)!=null?i:""}set value(e){let i=this.items.find(o=>o.value===e);i&&d(this,be,Qe).call(this,i);}focus(){if(v(this,L,De()),this.items.length){d(this,j,ke).call(this,this.items[0]),this.items[0].focus();return}let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e?.focus();}handleSelect(e){var i;let o=d(this,J,ye).call(this,e);o&&(d(this,be,Qe).call(this,o,o.type==="checkbox"),s(this,S)&&!this.hidden&&((i=s(this,L))==null||i.focus(),this.hidden=true));}get keysUsed(){return ["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var i,o;let{key:n}=e,a=this.items,r=(o=(i=d(this,J,ye).call(this,e))!=null?i:d(this,Ge,Dt).call(this))!=null?o:a[0],h=a.indexOf(r),c=Math.max(0,h);n==="ArrowDown"?c++:n==="ArrowUp"?c--:e.key==="Home"?c=0:e.key==="End"&&(c=a.length-1),c<0&&(c=a.length-1),c>a.length-1&&(c=0),d(this,j,ke).call(this,a[c]),a[c].focus();}};g=new WeakMap;L=new WeakMap;S=new WeakMap;Ee=new WeakMap;ve=new WeakMap;R=new WeakMap;ee=new WeakMap;Pe=new WeakSet;Tt=function(t){let e=t.target;for(let i of e.assignedNodes({flatten:true}))i.nodeType===3&&i.textContent.trim()===""&&i.remove();["header","title"].includes(e.name)&&d(this,_e,Ke).call(this),e.name||s(this,Ae).call(this);};_e=new WeakSet;Ke=function(){let t=this.shadowRoot.querySelector('slot[name="header"]'),e=this.shadowRoot.querySelector('slot[name="title"]');t.hidden=e.assignedNodes().length===0&&t.assignedNodes().length===0;};Ae=new WeakMap;ge=new WeakSet;Ne=function(){var t;let e=this.shadowRoot.querySelector("#layout-row"),i=(t=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:t.trim();e.setAttribute("media",i==="row"?"":"width:0");};Ue=new WeakSet;yt=function(t){v(this,S,t.relatedTarget),pe(this,t.relatedTarget)||(this.hidden=!this.hidden);};He=new WeakSet;kt=function(){var t;(t=s(this,S))==null||t.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:true}),Y(ie(this),s(this,H)),Y(this,s(this,W));};We=new WeakSet;St=function(){var t;(t=s(this,S))==null||t.setAttribute("aria-expanded","false"),X(ie(this),s(this,H)),X(this,s(this,W));};H=new WeakMap;W=new WeakMap;B=new WeakSet;te=function(t){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:e,y:i}=Et({anchor:this.anchorElement,floating:this,placement:"top-start"});t??(t=this.offsetWidth);let n=ie(this).getBoundingClientRect(),a=n.width-e-t,r=n.height-i-this.offsetHeight,{style:h}=s(this,ee);h.setProperty("position","absolute"),h.setProperty("right",`${Math.max(0,a)}px`),h.setProperty("--_menu-bottom",`${r}px`);let c=getComputedStyle(this),Me=h.getPropertyValue("--_menu-bottom")===c.bottom?r:parseFloat(c.bottom),se=n.height-Me-parseFloat(c.marginBottom);this.style.setProperty("--_menu-max-height",`${se}px`);};Te=new WeakSet;ze=function(t){let e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),i=e?.querySelector('[role="menu"]'),{style:o}=s(this,ee);if(t||o.setProperty("--media-menu-transition-in","none"),i){let n=i.offsetHeight,a=Math.max(i.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${a}px`),this.style.setProperty("min-height",`${n}px`),d(this,B,te).call(this,a);}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),d(this,B,te).call(this);o.removeProperty("--media-menu-transition-in");};Be=new WeakSet;It=function(t){var e;if(t.stopPropagation(),t.composedPath().includes(s(this,Ye,wt))){(e=s(this,L))==null||e.focus(),this.hidden=true;return}let i=d(this,J,ye).call(this,t);!i||i.hasAttribute("disabled")||(d(this,j,ke).call(this,i),this.handleSelect(t));};Ye=new WeakSet;wt=function(){var t;return (t=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:true}))==null?void 0:t.find(i=>i.matches('button[part~="back"]'))};qe=new WeakSet;Mt=function(t){if(t.target===this)return;d(this,Xe,xt).call(this);let e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let i of e)i.invokeTargetElement!=t.target&&t.newState=="open"&&i.getAttribute("aria-expanded")=="true"&&!i.invokeTargetElement.hidden&&i.invokeTargetElement.dispatchEvent(new O({relatedTarget:i}));for(let i of e)i.setAttribute("aria-expanded",`${!i.submenuElement.hidden}`);d(this,Te,ze).call(this,true);};Xe=new WeakSet;xt=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e);};Ve=new WeakSet;Lt=function(t){var e;pe(this,t.relatedTarget)||(s(this,R)&&((e=s(this,L))==null||e.focus()),s(this,S)&&s(this,S)!==t.relatedTarget&&!this.hidden&&(this.hidden=true));};$e=new WeakSet;Rt=function(t){var e,i,o,n,a;let{key:r,ctrlKey:h,altKey:c,metaKey:p}=t;if(!(h||c||p)&&this.keysUsed.includes(r))if(t.preventDefault(),t.stopPropagation(),r==="Tab"){if(s(this,R)){this.hidden=true;return}t.shiftKey?(i=(e=this.previousElementSibling)==null?void 0:e.focus)==null||i.call(e):(n=(o=this.nextElementSibling)==null?void 0:o.focus)==null||n.call(o),this.blur();}else r==="Escape"?((a=s(this,L))==null||a.focus(),s(this,R)&&(this.hidden=true)):r==="Enter"||r===" "?this.handleSelect(t):this.handleMove(t);};J=new WeakSet;ye=function(t){return t.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};Ge=new WeakSet;Dt=function(){return this.items.find(t=>t.tabIndex===0)};j=new WeakSet;ke=function(t){for(let e of this.items)e.tabIndex=e===t?0:-1;};be=new WeakSet;Qe=function(t,e){let i=[...this.checkedItems];t.type==="radio"&&this.radioGroupItems.forEach(o=>o.checked=false),e?t.checked=!t.checked:t.checked=true,this.checkedItems.some((o,n)=>o!=i[n])&&this.dispatchEvent(new Event("change",{bubbles:true,composed:true}));};D.shadowRootOptions={mode:"open"};D.getTemplateHTML=zt;function Yt(t){return ["menuitem","menuitemradio","menuitemcheckbox"].includes(t?.role)}function ie(t){var e;return (e=t.getAttribute("bounds")?N(t,`#${t.getAttribute("bounds")}`):he(t)||t.parentElement)!=null?e:t}u.customElements.get("media-chrome-menu")||u.customElements.define("media-chrome-menu",D);var q={PLACEMENT:"placement",BOUNDS:"bounds"};function Xt(t){return `
176
+ `}var x={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},D=class extends u.HTMLElement{constructor(){if(super(),l(this,Pe),l(this,_e),l(this,ge),l(this,Ue),l(this,He),l(this,We),l(this,B),l(this,Te),l(this,Be),l(this,Ye),l(this,qe),l(this,Xe),l(this,Ve),l(this,$e),l(this,J),l(this,Qe),l(this,j),l(this,be),l(this,g,null),l(this,L,null),l(this,S,null),l(this,Ee,new Set),l(this,ve,void 0),l(this,R,false),l(this,ee,null),l(this,Ae,()=>{let e=s(this,Ee),i=new Set(this.items);for(let o of e)i.has(o)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:o}));for(let o of i)e.has(o)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:o}));v(this,Ee,i);}),l(this,H,()=>{d(this,B,te).call(this),d(this,Te,ze).call(this,false);}),l(this,W,()=>{d(this,B,te).call(this);}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=P(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e);}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),v(this,ve,new MutationObserver(s(this,Ae))),s(this,ve).observe(this.defaultSlot,{childList:true});}static get observedAttributes(){return [x.DISABLED,x.HIDDEN,x.STYLE,x.ANCHOR,E.MEDIA_CONTROLLER]}static formatMenuItemText(e,i){return e}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this);}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this);}handleEvent(e){switch(e.type){case "slotchange":d(this,Pe,Tt).call(this,e);break;case "invoke":d(this,Ue,yt).call(this,e);break;case "click":d(this,Be,It).call(this,e);break;case "toggle":d(this,qe,Mt).call(this,e);break;case "focusout":d(this,Ve,Lt).call(this,e);break;case "keydown":d(this,$e,Rt).call(this,e);break}}connectedCallback(){var e,i;v(this,ee,Ce(this.shadowRoot,":host")),d(this,ge,Ne).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),v(this,g,me(this)),(i=(e=s(this,g))==null?void 0:e.associateElement)==null||i.call(e,this),this.hidden||(Y(ie(this),s(this,H)),Y(this,s(this,W))),d(this,_e,Ke).call(this);}disconnectedCallback(){var e,i;X(ie(this),s(this,H)),X(this,s(this,W)),this.disable(),(i=(e=s(this,g))==null?void 0:e.unassociateElement)==null||i.call(e,this),v(this,g,null);}attributeChangedCallback(e,i,o){var n,a,r,h;e===x.HIDDEN&&o!==i?(s(this,R)||v(this,R,true),this.hidden?d(this,We,St).call(this):d(this,He,kt).call(this),this.dispatchEvent(new ue({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:true}))):e===E.MEDIA_CONTROLLER?(i&&((a=(n=s(this,g))==null?void 0:n.unassociateElement)==null||a.call(n,this),v(this,g,null)),o&&this.isConnected&&(v(this,g,me(this)),(h=(r=s(this,g))==null?void 0:r.associateElement)==null||h.call(r,this))):e===x.DISABLED&&o!==i?o==null?this.enable():this.disable():e===x.STYLE&&o!==i&&d(this,ge,Ne).call(this);}formatMenuItemText(e,i){return this.constructor.formatMenuItemText(e,i)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`);}get anchorElement(){var e;return this.anchor?(e=Z(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:true}).filter(Yt)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,i;return (i=(e=this.checkedItems[0])==null?void 0:e.value)!=null?i:""}set value(e){let i=this.items.find(o=>o.value===e);i&&d(this,be,Ge).call(this,i);}focus(){if(v(this,L,De()),this.items.length){d(this,j,ke).call(this,this.items[0]),this.items[0].focus();return}let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e?.focus();}handleSelect(e){var i;let o=d(this,J,ye).call(this,e);o&&(d(this,be,Ge).call(this,o,o.type==="checkbox"),s(this,S)&&!this.hidden&&((i=s(this,L))==null||i.focus(),this.hidden=true));}get keysUsed(){return ["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var i,o;let{key:n}=e,a=this.items,r=(o=(i=d(this,J,ye).call(this,e))!=null?i:d(this,Qe,Dt).call(this))!=null?o:a[0],h=a.indexOf(r),c=Math.max(0,h);n==="ArrowDown"?c++:n==="ArrowUp"?c--:e.key==="Home"?c=0:e.key==="End"&&(c=a.length-1),c<0&&(c=a.length-1),c>a.length-1&&(c=0),d(this,j,ke).call(this,a[c]),a[c].focus();}};g=new WeakMap;L=new WeakMap;S=new WeakMap;Ee=new WeakMap;ve=new WeakMap;R=new WeakMap;ee=new WeakMap;Pe=new WeakSet;Tt=function(t){let e=t.target;for(let i of e.assignedNodes({flatten:true}))i.nodeType===3&&i.textContent.trim()===""&&i.remove();["header","title"].includes(e.name)&&d(this,_e,Ke).call(this),e.name||s(this,Ae).call(this);};_e=new WeakSet;Ke=function(){let t=this.shadowRoot.querySelector('slot[name="header"]'),e=this.shadowRoot.querySelector('slot[name="title"]');t.hidden=e.assignedNodes().length===0&&t.assignedNodes().length===0;};Ae=new WeakMap;ge=new WeakSet;Ne=function(){var t;let e=this.shadowRoot.querySelector("#layout-row"),i=(t=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:t.trim();e.setAttribute("media",i==="row"?"":"width:0");};Ue=new WeakSet;yt=function(t){v(this,S,t.relatedTarget),pe(this,t.relatedTarget)||(this.hidden=!this.hidden);};He=new WeakSet;kt=function(){var t;(t=s(this,S))==null||t.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:true}),Y(ie(this),s(this,H)),Y(this,s(this,W));};We=new WeakSet;St=function(){var t;(t=s(this,S))==null||t.setAttribute("aria-expanded","false"),X(ie(this),s(this,H)),X(this,s(this,W));};H=new WeakMap;W=new WeakMap;B=new WeakSet;te=function(t){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:e,y:i}=Et({anchor:this.anchorElement,floating:this,placement:"top-start"});t??(t=this.offsetWidth);let n=ie(this).getBoundingClientRect(),a=n.width-e-t,r=n.height-i-this.offsetHeight,{style:h}=s(this,ee);h.setProperty("position","absolute"),h.setProperty("right",`${Math.max(0,a)}px`),h.setProperty("--_menu-bottom",`${r}px`);let c=getComputedStyle(this),Me=h.getPropertyValue("--_menu-bottom")===c.bottom?r:parseFloat(c.bottom),se=n.height-Me-parseFloat(c.marginBottom);this.style.setProperty("--_menu-max-height",`${se}px`);};Te=new WeakSet;ze=function(t){let e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),i=e?.querySelector('[role="menu"]'),{style:o}=s(this,ee);if(t||o.setProperty("--media-menu-transition-in","none"),i){let n=i.offsetHeight,a=Math.max(i.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${a}px`),this.style.setProperty("min-height",`${n}px`),d(this,B,te).call(this,a);}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),d(this,B,te).call(this);o.removeProperty("--media-menu-transition-in");};Be=new WeakSet;It=function(t){var e;if(t.stopPropagation(),t.composedPath().includes(s(this,Ye,wt))){(e=s(this,L))==null||e.focus(),this.hidden=true;return}let i=d(this,J,ye).call(this,t);!i||i.hasAttribute("disabled")||(d(this,j,ke).call(this,i),this.handleSelect(t));};Ye=new WeakSet;wt=function(){var t;return (t=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:true}))==null?void 0:t.find(i=>i.matches('button[part~="back"]'))};qe=new WeakSet;Mt=function(t){if(t.target===this)return;d(this,Xe,xt).call(this);let e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let i of e)i.invokeTargetElement!=t.target&&t.newState=="open"&&i.getAttribute("aria-expanded")=="true"&&!i.invokeTargetElement.hidden&&i.invokeTargetElement.dispatchEvent(new O({relatedTarget:i}));for(let i of e)i.setAttribute("aria-expanded",`${!i.submenuElement.hidden}`);d(this,Te,ze).call(this,true);};Xe=new WeakSet;xt=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e);};Ve=new WeakSet;Lt=function(t){var e;pe(this,t.relatedTarget)||(s(this,R)&&((e=s(this,L))==null||e.focus()),s(this,S)&&s(this,S)!==t.relatedTarget&&!this.hidden&&(this.hidden=true));};$e=new WeakSet;Rt=function(t){var e,i,o,n,a;let{key:r,ctrlKey:h,altKey:c,metaKey:p}=t;if(!(h||c||p)&&this.keysUsed.includes(r))if(t.preventDefault(),t.stopPropagation(),r==="Tab"){if(s(this,R)){this.hidden=true;return}t.shiftKey?(i=(e=this.previousElementSibling)==null?void 0:e.focus)==null||i.call(e):(n=(o=this.nextElementSibling)==null?void 0:o.focus)==null||n.call(o),this.blur();}else r==="Escape"?((a=s(this,L))==null||a.focus(),s(this,R)&&(this.hidden=true)):r==="Enter"||r===" "?this.handleSelect(t):this.handleMove(t);};J=new WeakSet;ye=function(t){return t.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};Qe=new WeakSet;Dt=function(){return this.items.find(t=>t.tabIndex===0)};j=new WeakSet;ke=function(t){for(let e of this.items)e.tabIndex=e===t?0:-1;};be=new WeakSet;Ge=function(t,e){let i=[...this.checkedItems];t.type==="radio"&&this.radioGroupItems.forEach(o=>o.checked=false),e?t.checked=!t.checked:t.checked=true,this.checkedItems.some((o,n)=>o!=i[n])&&this.dispatchEvent(new Event("change",{bubbles:true,composed:true}));};D.shadowRootOptions={mode:"open"};D.getTemplateHTML=zt;function Yt(t){return ["menuitem","menuitemradio","menuitemcheckbox"].includes(t?.role)}function ie(t){var e;return (e=t.getAttribute("bounds")?N(t,`#${t.getAttribute("bounds")}`):he(t)||t.parentElement)!=null?e:t}u.customElements.get("media-chrome-menu")||u.customElements.define("media-chrome-menu",D);var q={PLACEMENT:"placement",BOUNDS:"bounds"};function Xt(t){return `
177
177
  <style>
178
178
  :host {
179
179
  --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7)));
@@ -282,7 +282,7 @@
282
282
  </style>
283
283
  <slot></slot>
284
284
  <div id="arrow"></div>
285
- `}var V=class extends u.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!_t(this,{checkOpacity:false,checkVisibilityCSS:false}))return;let i=this.placement;if(i==="left"||i==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}let o=getComputedStyle(this),n=(e=N(this,"#"+this.bounds))!=null?e:he(this);if(!n)return;let{x:a,width:r}=n.getBoundingClientRect(),{x:h,width:c}=this.getBoundingClientRect(),p=h+c,Me=a+r,se=o.getPropertyValue("--media-tooltip-offset-x"),at=se?parseFloat(se.replace("px","")):0,rt=o.getPropertyValue("--media-tooltip-container-margin"),st=rt?parseFloat(rt.replace("px","")):0,lt=h-a+at-st,dt=p-Me+at+st;if(lt<0){this.style.setProperty("--media-tooltip-offset-x",`${lt}px`);return}if(dt>0){this.style.setProperty("--media-tooltip-offset-x",`${dt}px`);return}this.style.removeProperty("--media-tooltip-offset-x");},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=P(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e);}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){let e=this.placement;delete this.placement,this.placement=e;}}static get observedAttributes(){return [q.PLACEMENT,q.BOUNDS]}get placement(){return M(this,q.PLACEMENT)}set placement(e){U(this,q.PLACEMENT,e);}get bounds(){return M(this,q.BOUNDS)}set bounds(e){U(this,q.BOUNDS,e);}};V.shadowRootOptions={mode:"open"};V.getTemplateHTML=Xt;u.customElements.get("media-tooltip")||u.customElements.define("media-tooltip",V);var Ze=V;var je=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},m=(t,e,i)=>(je(t,e,"read from private field"),i?i.call(t):e.get(t)),$=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i);},Se=(t,e,i,o)=>(je(t,e,"write to private field"),e.set(t,i),i),Zt=(t,e,i)=>(je(t,e,"access private method"),i),b,Q,w,G,Ie,Je,Pt,I={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function Jt(t,e={}){return `
285
+ `}var V=class extends u.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!_t(this,{checkOpacity:false,checkVisibilityCSS:false}))return;let i=this.placement;if(i==="left"||i==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}let o=getComputedStyle(this),n=(e=N(this,"#"+this.bounds))!=null?e:he(this);if(!n)return;let{x:a,width:r}=n.getBoundingClientRect(),{x:h,width:c}=this.getBoundingClientRect(),p=h+c,Me=a+r,se=o.getPropertyValue("--media-tooltip-offset-x"),at=se?parseFloat(se.replace("px","")):0,rt=o.getPropertyValue("--media-tooltip-container-margin"),st=rt?parseFloat(rt.replace("px","")):0,lt=h-a+at-st,dt=p-Me+at+st;if(lt<0){this.style.setProperty("--media-tooltip-offset-x",`${lt}px`);return}if(dt>0){this.style.setProperty("--media-tooltip-offset-x",`${dt}px`);return}this.style.removeProperty("--media-tooltip-offset-x");},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=P(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e);}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){let e=this.placement;delete this.placement,this.placement=e;}}static get observedAttributes(){return [q.PLACEMENT,q.BOUNDS]}get placement(){return M(this,q.PLACEMENT)}set placement(e){U(this,q.PLACEMENT,e);}get bounds(){return M(this,q.BOUNDS)}set bounds(e){U(this,q.BOUNDS,e);}};V.shadowRootOptions={mode:"open"};V.getTemplateHTML=Xt;u.customElements.get("media-tooltip")||u.customElements.define("media-tooltip",V);var Ze=V;var je=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},m=(t,e,i)=>(je(t,e,"read from private field"),i?i.call(t):e.get(t)),$=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i);},Se=(t,e,i,o)=>(je(t,e,"write to private field"),e.set(t,i),i),Zt=(t,e,i)=>(je(t,e,"access private method"),i),b,G,w,Q,Ie,Je,Pt,I={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function Jt(t,e={}){return `
286
286
  <style>
287
287
  :host {
288
288
  position: relative;
@@ -366,14 +366,14 @@
366
366
  </slot>
367
367
  `}function jt(t,e){return `
368
368
  <slot></slot>
369
- `}function ei(){return ""}var T=class extends u.HTMLElement{constructor(){if(super(),$(this,Je),$(this,b,void 0),this.preventClick=false,this.tooltipEl=null,$(this,Q,e=>{this.preventClick||this.handleClick(e),setTimeout(m(this,w),0);}),$(this,w,()=>{var e,i;(i=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||i.call(e);}),$(this,G,e=>{let{key:i}=e;if(!this.keysUsed.includes(i)){this.removeEventListener("keyup",m(this,G));return}this.preventClick||this.handleClick(e);}),$(this,Ie,e=>{let{metaKey:i,altKey:o,key:n}=e;if(i||o||!this.keysUsed.includes(n)){this.removeEventListener("keyup",m(this,G));return}this.addEventListener("keyup",m(this,G),{once:true});}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=P(this.attributes),i=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(i):this.shadowRoot.innerHTML=i;}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip");}static get observedAttributes(){return ["disabled",I.TOOLTIP_PLACEMENT,E.MEDIA_CONTROLLER,K.MEDIA_LANG]}enable(){this.addEventListener("click",m(this,Q)),this.addEventListener("keydown",m(this,Ie)),this.tabIndex=0;}disable(){this.removeEventListener("click",m(this,Q)),this.removeEventListener("keydown",m(this,Ie)),this.removeEventListener("keyup",m(this,G)),this.tabIndex=-1;}attributeChangedCallback(e,i,o){var n,a,r,h,c;e===E.MEDIA_CONTROLLER?(i&&((a=(n=m(this,b))==null?void 0:n.unassociateElement)==null||a.call(n,this),Se(this,b,null)),o&&this.isConnected&&(Se(this,b,(r=this.getRootNode())==null?void 0:r.getElementById(o)),(c=(h=m(this,b))==null?void 0:h.associateElement)==null||c.call(h,this))):e==="disabled"&&o!==i?o==null?this.enable():this.disable():e===I.TOOLTIP_PLACEMENT&&this.tooltipEl&&o!==i?this.tooltipEl.placement=o:e===K.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),m(this,w).call(this);}connectedCallback(){var e,i,o;let{style:n}=At(this.shadowRoot,":host");n.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");let a=this.getAttribute(E.MEDIA_CONTROLLER);a&&(Se(this,b,(e=this.getRootNode())==null?void 0:e.getElementById(a)),(o=(i=m(this,b))==null?void 0:i.associateElement)==null||o.call(i,this)),u.customElements.whenDefined("media-tooltip").then(()=>Zt(this,Je,Pt).call(this));}disconnectedCallback(){var e,i;this.disable(),(i=(e=m(this,b))==null?void 0:e.unassociateElement)==null||i.call(e,this),Se(this,b,null),this.removeEventListener("mouseenter",m(this,w)),this.removeEventListener("focus",m(this,w)),this.removeEventListener("click",m(this,Q));}get keysUsed(){return ["Enter"," "]}get tooltipPlacement(){return M(this,I.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){U(this,I.TOOLTIP_PLACEMENT,e);}get mediaController(){return M(this,E.MEDIA_CONTROLLER)}set mediaController(e){U(this,E.MEDIA_CONTROLLER,e);}get disabled(){return fe(this,I.DISABLED)}set disabled(e){Oe(this,I.DISABLED,e);}get noTooltip(){return fe(this,I.NO_TOOLTIP)}set noTooltip(e){Oe(this,I.NO_TOOLTIP,e);}handleClick(e){}};b=new WeakMap;Q=new WeakMap;w=new WeakMap;G=new WeakMap;Ie=new WeakMap;Je=new WeakSet;Pt=function(){this.addEventListener("mouseenter",m(this,w)),this.addEventListener("focus",m(this,w)),this.addEventListener("click",m(this,Q));let t=this.tooltipPlacement;t&&this.tooltipEl&&(this.tooltipEl.placement=t);};T.shadowRootOptions={mode:"open"};T.getTemplateHTML=Jt;T.getSlotTemplateHTML=jt;T.getTooltipContentHTML=ei;u.customElements.get("media-chrome-button")||u.customElements.define("media-chrome-button",T);var oe=class extends T{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu");}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`);}get invokeTargetElement(){var e;return this.invokeTarget?(e=Z(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){var e;(e=this.invokeTargetElement)==null||e.dispatchEvent(new O({relatedTarget:this}));}};u.customElements.get("media-chrome-menu-button")||u.customElements.define("media-chrome-menu-button",oe);var Nt={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var Ut,et={en:Nt},tt=((Ut=globalThis.navigator)==null?void 0:Ut.language)||"en",zi=t=>{tt=t;};var ti=t=>{var e,i,o;let[n]=tt.split("-");return ((e=et[tt])==null?void 0:e[t])||((i=et[n])==null?void 0:i[t])||((o=et.en)==null?void 0:o[t])||t},it=(t,e={})=>ti(t).replace(/\{(\w+)\}/g,(i,o)=>o in e?String(e[o]):`{${o}}`);var ii=`<svg aria-hidden="true" viewBox="0 0 24 24">
369
+ `}function ei(){return ""}var T=class extends u.HTMLElement{constructor(){if(super(),$(this,Je),$(this,b,void 0),this.preventClick=false,this.tooltipEl=null,$(this,G,e=>{this.preventClick||this.handleClick(e),setTimeout(m(this,w),0);}),$(this,w,()=>{var e,i;(i=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||i.call(e);}),$(this,Q,e=>{let{key:i}=e;if(!this.keysUsed.includes(i)){this.removeEventListener("keyup",m(this,Q));return}this.preventClick||this.handleClick(e);}),$(this,Ie,e=>{let{metaKey:i,altKey:o,key:n}=e;if(i||o||!this.keysUsed.includes(n)){this.removeEventListener("keyup",m(this,Q));return}this.addEventListener("keyup",m(this,Q),{once:true});}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=P(this.attributes),i=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(i):this.shadowRoot.innerHTML=i;}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip");}static get observedAttributes(){return ["disabled",I.TOOLTIP_PLACEMENT,E.MEDIA_CONTROLLER,K.MEDIA_LANG]}enable(){this.addEventListener("click",m(this,G)),this.addEventListener("keydown",m(this,Ie)),this.tabIndex=0;}disable(){this.removeEventListener("click",m(this,G)),this.removeEventListener("keydown",m(this,Ie)),this.removeEventListener("keyup",m(this,Q)),this.tabIndex=-1;}attributeChangedCallback(e,i,o){var n,a,r,h,c;e===E.MEDIA_CONTROLLER?(i&&((a=(n=m(this,b))==null?void 0:n.unassociateElement)==null||a.call(n,this),Se(this,b,null)),o&&this.isConnected&&(Se(this,b,(r=this.getRootNode())==null?void 0:r.getElementById(o)),(c=(h=m(this,b))==null?void 0:h.associateElement)==null||c.call(h,this))):e==="disabled"&&o!==i?o==null?this.enable():this.disable():e===I.TOOLTIP_PLACEMENT&&this.tooltipEl&&o!==i?this.tooltipEl.placement=o:e===K.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),m(this,w).call(this);}connectedCallback(){var e,i,o;let{style:n}=At(this.shadowRoot,":host");n.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");let a=this.getAttribute(E.MEDIA_CONTROLLER);a&&(Se(this,b,(e=this.getRootNode())==null?void 0:e.getElementById(a)),(o=(i=m(this,b))==null?void 0:i.associateElement)==null||o.call(i,this)),u.customElements.whenDefined("media-tooltip").then(()=>Zt(this,Je,Pt).call(this));}disconnectedCallback(){var e,i;this.disable(),(i=(e=m(this,b))==null?void 0:e.unassociateElement)==null||i.call(e,this),Se(this,b,null),this.removeEventListener("mouseenter",m(this,w)),this.removeEventListener("focus",m(this,w)),this.removeEventListener("click",m(this,G));}get keysUsed(){return ["Enter"," "]}get tooltipPlacement(){return M(this,I.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){U(this,I.TOOLTIP_PLACEMENT,e);}get mediaController(){return M(this,E.MEDIA_CONTROLLER)}set mediaController(e){U(this,E.MEDIA_CONTROLLER,e);}get disabled(){return fe(this,I.DISABLED)}set disabled(e){Oe(this,I.DISABLED,e);}get noTooltip(){return fe(this,I.NO_TOOLTIP)}set noTooltip(e){Oe(this,I.NO_TOOLTIP,e);}handleClick(e){}};b=new WeakMap;G=new WeakMap;w=new WeakMap;Q=new WeakMap;Ie=new WeakMap;Je=new WeakSet;Pt=function(){this.addEventListener("mouseenter",m(this,w)),this.addEventListener("focus",m(this,w)),this.addEventListener("click",m(this,G));let t=this.tooltipPlacement;t&&this.tooltipEl&&(this.tooltipEl.placement=t);};T.shadowRootOptions={mode:"open"};T.getTemplateHTML=Jt;T.getSlotTemplateHTML=jt;T.getTooltipContentHTML=ei;u.customElements.get("media-chrome-button")||u.customElements.define("media-chrome-button",T);var oe=class extends T{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu");}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`);}get invokeTargetElement(){var e;return this.invokeTarget?(e=Z(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){var e;(e=this.invokeTargetElement)==null||e.dispatchEvent(new O({relatedTarget:this}));}};u.customElements.get("media-chrome-menu-button")||u.customElements.define("media-chrome-menu-button",oe);var Nt={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute",Loop:"Loop","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var Ut,et={en:Nt},tt=((Ut=globalThis.navigator)==null?void 0:Ut.language)||"en",zi=t=>{tt=t;};var ti=t=>{var e,i,o;let[n]=tt.split("-");return ((e=et[tt])==null?void 0:e[t])||((i=et[n])==null?void 0:i[t])||((o=et.en)==null?void 0:o[t])||t},it=(t,e={})=>ti(t).replace(/\{(\w+)\}/g,(i,o)=>o in e?String(e[o]):`{${o}}`);var ii=`<svg aria-hidden="true" viewBox="0 0 24 24">
370
370
  <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/>
371
371
  <path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/>
372
- </svg>`,y,_,A,nt,ne,re,ot=class extends D{constructor(){super(...arguments);chunkJHSFSCC2_cjs.e(this,A);chunkJHSFSCC2_cjs.e(this,y,[]);chunkJHSFSCC2_cjs.e(this,_);chunkJHSFSCC2_cjs.e(this,re,()=>{let i=this.value??chunkJHSFSCC2_cjs.d(this,_);i!=null&&(chunkJHSFSCC2_cjs.f(this,_,String(i)),this.dispatchEvent(new u.CustomEvent(ct.MEDIA_AUDIO_TRACK_REQUEST,{detail:chunkJHSFSCC2_cjs.d(this,_),composed:true,bubbles:true})),chunkJHSFSCC2_cjs.g(this,A,ne).call(this));});}get tracks(){return chunkJHSFSCC2_cjs.d(this,y)}set tracks(i){chunkJHSFSCC2_cjs.f(this,y,[...i??[]]),chunkJHSFSCC2_cjs.g(this,A,nt).call(this);}get selected(){return chunkJHSFSCC2_cjs.d(this,_)}set selected(i){chunkJHSFSCC2_cjs.f(this,_,i??void 0),chunkJHSFSCC2_cjs.g(this,A,ne).call(this);}connectedCallback(){super.connectedCallback(),this.addEventListener("change",chunkJHSFSCC2_cjs.d(this,re)),chunkJHSFSCC2_cjs.g(this,A,nt).call(this),chunkJHSFSCC2_cjs.g(this,A,ne).call(this);}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",chunkJHSFSCC2_cjs.d(this,re));}};y=new WeakMap,_=new WeakMap,A=new WeakSet,nt=function(){let i=this.defaultSlot;if(i){i.textContent="";for(let o of chunkJHSFSCC2_cjs.d(this,y)){let n=Ct({type:"radio",text:o.label??o.language??"",value:o.id,checked:!!o.enabled});n.prepend(Ot(this,"checked-indicator")),i.append(n);}chunkJHSFSCC2_cjs.g(this,A,ne).call(this);}},ne=function(){let i=chunkJHSFSCC2_cjs.d(this,y).find(r=>r.enabled)??(chunkJHSFSCC2_cjs.d(this,y).length?chunkJHSFSCC2_cjs.d(this,y)[0]:void 0),o=chunkJHSFSCC2_cjs.d(this,_)??i?.id;chunkJHSFSCC2_cjs.f(this,_,o);let a=this.defaultSlot?.querySelectorAll("media-chrome-menu-item")??this.querySelectorAll("media-chrome-menu-item");for(let r of Array.from(a))"checked"in r&&"value"in r&&(r.checked=r.value===o);o!=null?this.value=o:(this.value="",this.removeAttribute("value"));},re=new WeakMap;var we,Ht,ae=class extends oe{constructor(){super(...arguments);chunkJHSFSCC2_cjs.e(this,we);}connectedCallback(){super.connectedCallback(),chunkJHSFSCC2_cjs.g(this,we,Ht).call(this);}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:this.closest("media-controller, mave-player")?.querySelector("mave-audio-track-menu")??null}};we=new WeakSet,Ht=function(){let i=it("Audio");this.setAttribute("aria-label",i);},ae.getSlotTemplateHTML=()=>`
372
+ </svg>`,y,_,A,nt,ne,re,ot=class extends D{constructor(){super(...arguments);e(this,A);e(this,y,[]);e(this,_);e(this,re,()=>{let i=this.value??d$1(this,_);i!=null&&(f(this,_,String(i)),this.dispatchEvent(new u.CustomEvent(ct.MEDIA_AUDIO_TRACK_REQUEST,{detail:d$1(this,_),composed:true,bubbles:true})),g$1(this,A,ne).call(this));});}get tracks(){return d$1(this,y)}set tracks(i){f(this,y,[...i??[]]),g$1(this,A,nt).call(this);}get selected(){return d$1(this,_)}set selected(i){f(this,_,i??void 0),g$1(this,A,ne).call(this);}connectedCallback(){super.connectedCallback(),this.addEventListener("change",d$1(this,re)),g$1(this,A,nt).call(this),g$1(this,A,ne).call(this);}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",d$1(this,re));}};y=new WeakMap,_=new WeakMap,A=new WeakSet,nt=function(){let i=this.defaultSlot;if(i){i.textContent="";for(let o of d$1(this,y)){let n=Ct({type:"radio",text:o.label??o.language??"",value:o.id,checked:!!o.enabled});n.prepend(Ot(this,"checked-indicator")),i.append(n);}g$1(this,A,ne).call(this);}},ne=function(){let i=d$1(this,y).find(r=>r.enabled)??(d$1(this,y).length?d$1(this,y)[0]:void 0),o=d$1(this,_)??i?.id;f(this,_,o);let a=this.defaultSlot?.querySelectorAll("media-chrome-menu-item")??this.querySelectorAll("media-chrome-menu-item");for(let r of Array.from(a))"checked"in r&&"value"in r&&(r.checked=r.value===o);o!=null?this.value=o:(this.value="",this.removeAttribute("value"));},re=new WeakMap;var we,Ht,ae=class extends oe{constructor(){super(...arguments);e(this,we);}connectedCallback(){super.connectedCallback(),g$1(this,we,Ht).call(this);}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:this.closest("media-controller, mave-player")?.querySelector("mave-audio-track-menu")??null}};we=new WeakSet,Ht=function(){let i=it("Audio");this.setAttribute("aria-label",i);},ae.getSlotTemplateHTML=()=>`
373
373
  <style>
374
374
  :host([aria-expanded="true"]) slot[name='tooltip'] {
375
375
  display: none;
376
376
  }
377
377
  </style>
378
378
  <slot name="icon">${ii}</slot>
379
- `,ae.getTooltipContentHTML=()=>it("Audio");u.customElements.get("mave-audio-track-menu")||u.customElements.define("mave-audio-track-menu",ot);u.customElements.get("mave-audio-track-menu-button")||u.customElements.define("mave-audio-track-menu-button",ae);exports.A=_t;exports.B=yi;exports.C=At;exports.D=Kt;exports.E=ki;exports.F=fe;exports.G=Oe;exports.H=M;exports.I=U;exports.J=T;exports.K=O;exports.L=Ct;exports.M=Ot;exports.N=D;exports.O=oe;exports.P=ot;exports.Q=ae;exports.a=ct;exports.b=E;exports.c=Wt;exports.d=K;exports.e=ht;exports.f=ni;exports.g=ai;exports.h=ri;exports.i=si;exports.j=li;exports.k=di;exports.l=ci;exports.m=zi;exports.n=it;exports.o=u;exports.p=Le;exports.q=Y;exports.r=X;exports.s=P;exports.t=he;exports.u=Ai;exports.v=Ti;exports.w=pe;exports.x=N;exports.y=De;exports.z=Z;
379
+ `,ae.getTooltipContentHTML=()=>it("Audio");u.customElements.get("mave-audio-track-menu")||u.customElements.define("mave-audio-track-menu",ot);u.customElements.get("mave-audio-track-menu-button")||u.customElements.define("mave-audio-track-menu-button",ae);export{_t as A,yi as B,At as C,Ce as D,Kt as E,ki as F,fe as G,Oe as H,M as I,U as J,T as K,O as L,Ct as M,Ot as N,D as O,oe as P,ot as Q,ae as R,ct as a,E as b,Wt as c,K as d,ht as e,ni as f,ai as g,ri as h,si as i,li as j,di as k,ci as l,zi as m,it as n,u as o,Le as p,Y as q,X as r,P as s,he as t,Ai as u,Ti as v,pe as w,N as x,De as y,Z as z};
@@ -1 +1 @@
1
- import {a}from'./chunk-6XBQ5C3V.js';import {a as a$1}from'./chunk-JBV2AYRP.js';var p=class{constructor(e,d){this.host=e,this.embed=d,this.task=new a(this.host,async()=>{try{let i=this.embedFile("subtitle.json"),c=await fetch(i);if(c.status!==200)throw new Error;let u=await c.json(),f=u.segments.flatMap(t=>t.words).map(t=>({start:t.start,end:t.end,word:t.word.trim()})),r=[],n={start:0,end:0,text:"",words:[]};f.forEach(t=>{let{start:a,end:o,word:s}=t;n.start===0&&(n.start=a),n.end=o,n.words.push(t),n.text+=(n.text?" ":"")+s,/[.!?]$/.test(s)&&(r.push({...n}),n={start:0,end:0,text:"",words:[]});}),n.words.length>0&&r.push({...n});let h=[],l=1,w=5;if(r.length>0){let t={start:r[0].start,end:r[0].end,text:r[0].text,words:r[0].words},a=1;for(let o=1;o<r.length;o++){let s=r[o],b=r[o-1],S=s.start??0,k=b.end??0;S-k<=l&&a<w?(t.end=s.end,t.text+=" "+s.text,t.words=[...t.words,...s.words],a++):(h.push({...t}),t={start:s.start,end:s.end,text:s.text,words:s.words},a=1);}t.words.length>0&&h.push(t);}return {text:u.text,segments:h}}catch{throw console.warn(`Failed to fetch language file for "${this.embed}"`),new Error}},()=>[this.embed]);}set embed(e){this._embed!=e&&(this._embed=e,this.host.requestUpdate());}get embed(){return this._embed}set token(e){this._token!=e&&(this._token=e,this.host.requestUpdate());}get token(){return this._token}get spaceId(){return this.embed.substring(0,5)}get embedId(){return this.embed.substring(5,this.embed.length)}get version(){return this._version?`/v${this._version}/`:"/"}set version(e){this._version!=e&&(this._version=e,this.host.requestUpdate());}get cdnRoot(){return a$1.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}embedFile(e,d=new URLSearchParams){let i=new URL(`${this.cdnRoot}/${this.embedId}${e=="manifest.json"?"/":this.version}${e}`);return this.token&&d.append("token",this.token),i.search=d.toString(),i.toString()}render(e){return this.task?.render(e)}};export{p as a};
1
+ import {a}from'./chunk-QFF6OUH6.js';import {a as a$1}from'./chunk-ZTDQPDC6.js';var p=class{constructor(e,d){this.host=e,this.embed=d,this.task=new a(this.host,async()=>{try{let i=this.embedFile("subtitle.json"),c=await fetch(i);if(c.status!==200)throw new Error;let u=await c.json(),f=u.segments.flatMap(t=>t.words).map(t=>({start:t.start,end:t.end,word:t.word.trim()})),r=[],n={start:0,end:0,text:"",words:[]};f.forEach(t=>{let{start:a,end:o,word:s}=t;n.start===0&&(n.start=a),n.end=o,n.words.push(t),n.text+=(n.text?" ":"")+s,/[.!?]$/.test(s)&&(r.push({...n}),n={start:0,end:0,text:"",words:[]});}),n.words.length>0&&r.push({...n});let h=[],l=1,w=5;if(r.length>0){let t={start:r[0].start,end:r[0].end,text:r[0].text,words:r[0].words},a=1;for(let o=1;o<r.length;o++){let s=r[o],b=r[o-1],S=s.start??0,k=b.end??0;S-k<=l&&a<w?(t.end=s.end,t.text+=" "+s.text,t.words=[...t.words,...s.words],a++):(h.push({...t}),t={start:s.start,end:s.end,text:s.text,words:s.words},a=1);}t.words.length>0&&h.push(t);}return {text:u.text,segments:h}}catch{throw console.warn(`Failed to fetch language file for "${this.embed}"`),new Error}},()=>[this.embed]);}set embed(e){this._embed!=e&&(this._embed=e,this.host.requestUpdate());}get embed(){return this._embed}set token(e){this._token!=e&&(this._token=e,this.host.requestUpdate());}get token(){return this._token}get spaceId(){return this.embed.substring(0,5)}get embedId(){return this.embed.substring(5,this.embed.length)}get version(){return this._version?`/v${this._version}/`:"/"}set version(e){this._version!=e&&(this._version=e,this.host.requestUpdate());}get cdnRoot(){return a$1.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}embedFile(e,d=new URLSearchParams){let i=new URL(`${this.cdnRoot}/${this.embedId}${e=="manifest.json"?"/":this.version}${e}`);return this.token&&d.append("token",this.token),i.search=d.toString(),i.toString()}render(e){return this.task?.render(e)}};export{p as a};
@@ -0,0 +1,3 @@
1
+ import {a}from'./chunk-ZTDQPDC6.js';var b=e=>typeof e=="function"?e:function(){return e},_=typeof self<"u"?self:null,m=typeof window<"u"?window:null,f=_||m||globalThis,H="2.0.0",u={connecting:0,open:1,closing:2,closed:3},P=1e4,x=1e3,c={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},p={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},R={longpoll:"longpoll",websocket:"websocket"},B={complete:4},k="base64url.bearer.phx.",v=class{constructor(e,t,i,s){this.channel=e,this.event=t,this.payload=i||function(){return {}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=false;}resend(e){this.timeout=e,this.reset(),this.send();}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=true,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}));}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=false;}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t));}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent);}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null;}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e);}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{});},this.timeout);}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t});}},j=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0;}reset(){this.tries=0,clearTimeout(this.timer);}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback();},this.timerCalc(this.tries+1));}},$=class{constructor(e,t,i){this.state=c.closed,this.topic=e,this.params=b(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=false,this.joinPush=new v(this,p.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new j(()=>{this.socket.isConnected()&&this.rejoin();},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin();})),this.joinPush.receive("ok",()=>{this.state=c.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[];}),this.joinPush.receive("error",()=>{this.state=c.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=c.closed,this.socket.remove(this);}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=c.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new v(this,p.leave,b({}),this.timeout).send(),this.state=c.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.on(p.reply,(s,r)=>{this.trigger(this.replyEventName(r),s);});}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=true,this.rejoin(),this.joinPush}onClose(e){this.on(p.close,e);}onError(e){return this.on(p.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t>"u"||t===i.ref)));}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new v(this,e,function(){return t},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=c.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(p.close,"leave");},i=new v(this,p.leave,b({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,s){return this.topic!==e?false:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:s}),false):true}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=c.joining,this.joinPush.resend(e));}trigger(e,t,i,s){let r=this.onMessage(e,t,i,s);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let n=this.bindings.filter(h=>h.event===e);for(let h=0;h<n.length;h++)n[h].callback(r,i,s||this.joinRef());}replyEventName(e){return `chan_reply_${e}`}isClosed(){return this.state===c.closed}isErrored(){return this.state===c.errored}isJoined(){return this.state===c.joined}isJoining(){return this.state===c.joining}isLeaving(){return this.state===c.leaving}},E=class{static request(e,t,i,s,r,n,h){if(f.XDomainRequest){let o=new f.XDomainRequest;return this.xdomainRequest(o,e,t,s,r,n,h)}else if(f.XMLHttpRequest){let o=new f.XMLHttpRequest;return this.xhrRequest(o,e,t,i,s,r,n,h)}else {if(f.fetch&&f.AbortController)return this.fetchRequest(e,t,i,s,r,n,h);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,i,s,r,n,h){let o={method:e,headers:i,body:s},a=null;if(r){a=new AbortController;setTimeout(()=>a.abort(),r);o.signal=a.signal;}return f.fetch(t,o).then(l=>l.text()).then(l=>this.parseJSON(l)).then(l=>h&&h(l)).catch(l=>{l.name==="AbortError"&&n?n():h&&h(null);}),a}static xdomainRequest(e,t,i,s,r,n,h){return e.timeout=r,e.open(t,i),e.onload=()=>{let o=this.parseJSON(e.responseText);h&&h(o);},n&&(e.ontimeout=n),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,i,s,r,n,h,o){e.open(t,i,true),e.timeout=n;for(let[a,l]of Object.entries(s))e.setRequestHeader(a,l);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===B.complete&&o){let a=this.parseJSON(e.responseText);o(a);}},h&&(e.ontimeout=h),e.send(r),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let r=t?`${t}[${s}]`:s,n=e[s];typeof n=="object"?i.push(this.serialize(n,r)):i.push(encodeURIComponent(r)+"="+encodeURIComponent(n));}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return `${e}${i}${this.serialize(t)}`}},O=e=>{let t="",i=new Uint8Array(e),s=i.byteLength;for(let r=0;r<s;r++)t+=String.fromCharCode(i[r]);return btoa(t)},T=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(k)&&(this.authToken=atob(t[1].slice(k.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=true,this.reqs=new Set,this.awaitingBatchAck=false,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=u.connecting,setTimeout(()=>this.poll(),0);}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R.websocket),"$1/"+R.longpoll)}endpointURL(){return E.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=u.connecting;}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",false);}isActive(){return this.readyState===u.open||this.readyState===u.connecting}poll(){let e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:i,token:s,messages:r}=t;if(i===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",false);return}this.token=s;}else i=0;switch(i){case 200:r.forEach(n=>{setTimeout(()=>this.onmessage({data:n}),0);}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=u.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",false);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${i}`)}});}send(e){typeof e!="string"&&(e=O(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null;},0));}batchSend(e){this.awaitingBatchAck=true,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
2
+ `),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=false,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",false)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]);});}close(e,t,i){for(let r of this.reqs)r.abort();this.readyState=u.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:true},{code:e,reason:t,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s);}ajax(e,t,i,s,r){let n,h=()=>{this.reqs.delete(n),s();};n=E.request(e,this.endpointURL(),t,i,this.timeout,h,o=>{this.reqs.delete(n),this.isActive()&&r(o);}),this.reqs.add(n);}};var C={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,s,r,n,h]=JSON.parse(e);return t({join_ref:i,ref:s,topic:r,event:n,payload:h})}},binaryEncode(e){let{join_ref:t,ref:i,event:s,topic:r,payload:n}=e,h=this.META_LENGTH+t.length+i.length+r.length+s.length,o=new ArrayBuffer(this.HEADER_LENGTH+h),a=new DataView(o),l=0;a.setUint8(l++,this.KINDS.push),a.setUint8(l++,t.length),a.setUint8(l++,i.length),a.setUint8(l++,r.length),a.setUint8(l++,s.length),Array.from(t,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(i,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(r,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(s,d=>a.setUint8(l++,d.charCodeAt(0)));var g=new Uint8Array(o.byteLength+n.byteLength);return g.set(new Uint8Array(o),0),g.set(new Uint8Array(n),o.byteLength),g.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,o=i.decode(e.slice(h,h+s));h=h+s;let a=i.decode(e.slice(h,h+r));h=h+r;let l=i.decode(e.slice(h,h+n));h=h+n;let g=e.slice(h,e.byteLength);return {join_ref:o,ref:null,topic:a,event:l,payload:g}},decodeReply(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),h=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,a=i.decode(e.slice(o,o+s));o=o+s;let l=i.decode(e.slice(o,o+r));o=o+r;let g=i.decode(e.slice(o,o+n));o=o+n;let d=i.decode(e.slice(o,o+h));o=o+h;let A=e.slice(o,e.byteLength),L={status:d,response:A};return {join_ref:a,ref:l,topic:g,event:p.reply,payload:L}},decodeBroadcast(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=this.HEADER_LENGTH+2,h=i.decode(e.slice(n,n+s));n=n+s;let o=i.decode(e.slice(n,n+r));n=n+r;let a=e.slice(n,e.byteLength);return {join_ref:null,ref:null,topic:h,event:o,payload:a}}},w=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||P,this.transport=t.transport||f.WebSocket||T,this.primaryPassedHealthCheck=false,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||f&&f.sessionStorage,this.establishedConnections=0,this.defaultEncoder=C.encode.bind(C),this.defaultDecoder=C.decode.bind(C),this.closeWasClean=false,this.disconnecting=false,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=false,this.transport!==T?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;m&&m.addEventListener&&(m.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock);}),m.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect());}),m.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=true:(this.pageHidden=false,this.isConnected()||this.teardown(()=>this.connect()));})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,r,n)=>{console.log(`${s}: ${r}`,n);}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=b(t.params||{}),this.endPoint=`${e}/${R.websocket}`,this.vsn=t.vsn||H,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new j(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect());},this.reconnectAfterMs),this.authToken=t.authToken;}getLongPollTransport(){return T}replaceTransport(e){this.connectClock++,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e;}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=E.appendParams(E.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.disconnecting=true,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=false,e&&e();},t,i);}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=b(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==T?this.connectWithFallback(T,this.longPollFallbackMs):this.transportConnect());}log(e,t,i){this.logger&&this.logger(e,t,i);}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return false;let t=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(r=>{r.ref===t&&(this.off([s]),e(Date.now()-i));});return true}transportConnect(){this.connectClock++,this.closeWasClean=false;let e;this.authToken&&(e=["phoenix",`${k}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t);}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t);}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let i=false,s=true,r,n,h=o=>{this.log("transport",`falling back to ${e.name}...`,o),this.off([r,n]),s=false,this.replaceTransport(e),this.transportConnect();};if(this.getSession(`phx:fallback:${e.name}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),n=this.onError(o=>{this.log("transport","error",o),s&&!i&&(clearTimeout(this.fallbackTimer),h(o));}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=true,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(o=>{this.log("transport","connected to primary after",o),this.primaryPassedHealthCheck=true,clearTimeout(this.fallbackTimer);});}),this.transportConnect();}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer);}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=false,this.disconnecting=false,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e());}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=false,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),x,"heartbeat timeout"));}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs));}teardown(e,t,i){if(!this.conn)return e&&e();let s=this.connectClock;this.waitForBufferDone(()=>{s===this.connectClock&&(this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{s===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e());}));});}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1);},150*t);}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===u.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1);},150*t);}onConnClose(e){this.conn&&(this.conn.onclose=()=>{});let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e));}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(e,t,i);}),(t===this.transport||i>0)&&this.triggerChanError();}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(p.error);});}connectionState(){switch(this.conn&&this.conn.readyState){case u.connecting:return "connecting";case u.open:return "open";case u.closing:return "closing";default:return "closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e);}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1);}channel(e,t={}){let i=new $(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:s,ref:r,join_ref:n}=e;this.log("push",`${t} ${i} (${n}, ${r})`,s);}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)));}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs));}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[]);}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:s,payload:r,ref:n,join_ref:h}=t;n&&n===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${i} ${s} ${n&&"("+n+")"||""}`,r);for(let o=0;o<this.channels.length;o++){let a=this.channels[o];a.isMember(i,s,r,h)&&a.trigger(s,r,n,h);}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,a]=this.stateChangeCallbacks.message[o];a(t);}});}leaveOpenTopic(e){let t=this.channels.find(i=>i.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave());}};var y=class{static connect(t){if(typeof window>"u"){let n={on:()=>n,push:()=>n,join:()=>n,leave:()=>Promise.resolve(),off:()=>{}};return {token:t,channel:n}}let i=new w(a.upload.socket,{params:{token:t},reconnectAfterMs:n=>[1e3,3e3,5e3,1e4][n-1]||1e4});i.connect();let s=i.channel(`embed:${t}`),r={token:t,channel:s,socket:i};return s.on("initiate",({upload_id:n})=>{r.upload_id=n;}),s.join(),r}static async disconnect(t){if(t){try{await t.channel.leave();}catch{}t.socket?.disconnect();}}};
3
+ export{y as a};
@@ -0,0 +1,24 @@
1
+ 'use strict';var chunkNPP5B5PV_cjs=require('./chunk-NPP5B5PV.cjs');var f={attribute:true,type:String,converter:chunkNPP5B5PV_cjs.b,reflect:false,hasChanged:chunkNPP5B5PV_cjs.c},h=(e=f,o,t)=>{let{kind:a,metadata:c}=t,i=globalThis.litPropertyMetadata.get(c);if(i===void 0&&globalThis.litPropertyMetadata.set(c,i=new Map),a==="setter"&&((e=Object.create(e)).wrapped=true),i.set(t.name,e),a==="accessor"){let{name:n}=t;return {set(s){let r=o.get.call(this);o.set.call(this,s),this.requestUpdate(n,r,e,true,s);},init(s){return s!==void 0&&this.C(n,void 0,e,s),s}}}if(a==="setter"){let{name:n}=t;return function(s){let r=this[n];o.call(this,s),this.requestUpdate(n,r,e,true,s);}}throw Error("Unsupported decorator location: "+a)};function d(e){return (o,t)=>typeof t=="object"?h(e,o,t):((a,c,i)=>{let n=c.hasOwnProperty(i);return c.constructor.createProperty(i,a),n?Object.getOwnPropertyDescriptor(c,i):void 0})(e,o,t)}function b(e){return d({...e,state:true,attribute:false})}var u=(e,o,t)=>(t.configurable=true,t.enumerable=true,Reflect.decorate&&typeof o!="object"&&Object.defineProperty(e,o,t),t);function E(e,o){return (t,a,c)=>{let i=n=>n.renderRoot?.querySelector(e)??null;if(o){let{get:n,set:s}=typeof a=="object"?t:c??(()=>{let r=Symbol();return {get(){return this[r]},set(m){this[r]=m;}}})();return u(t,a,{get(){let r=n.call(this);return r===void 0&&(r=i(this),(r!==null||this.hasUpdated)&&s.call(this,r)),r}})}return u(t,a,{get(){return i(this)}})}}/*! Bundled license information:
2
+
3
+ @lit/reactive-element/decorators/property.js:
4
+ @lit/reactive-element/decorators/state.js:
5
+ @lit/reactive-element/decorators/base.js:
6
+ @lit/reactive-element/decorators/query.js:
7
+ @lit/reactive-element/decorators/custom-element.js:
8
+ @lit/reactive-element/decorators/event-options.js:
9
+ @lit/reactive-element/decorators/query-all.js:
10
+ @lit/reactive-element/decorators/query-async.js:
11
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
12
+ (**
13
+ * @license
14
+ * Copyright 2017 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ *)
17
+
18
+ @lit/reactive-element/decorators/query-assigned-elements.js:
19
+ (**
20
+ * @license
21
+ * Copyright 2021 Google LLC
22
+ * SPDX-License-Identifier: BSD-3-Clause
23
+ *)
24
+ */exports.a=d;exports.b=b;exports.c=E;
@@ -0,0 +1,2 @@
1
+ 'use strict';var e={metrics:{enabled:true,endpoint:"https://metrics.video-dns.com/v1/events"},upload:{socket:"wss://app.mave.io/api/v1/socket",endpoint:"https://upload.mave.io/files"},api:{endpoint:"https://mave.io/api/v1"},cdn:{endpoint:"https://space-${this.spaceId}.video-dns.com"}};function o(t){Object.assign(e,t);}
2
+ exports.a=e;exports.b=o;
@@ -0,0 +1,9 @@
1
+ 'use strict';var chunk2E5GLLOS_cjs=require('./chunk-2E5GLLOS.cjs');var e=t=>t??chunk2E5GLLOS_cjs.e;/*! Bundled license information:
2
+
3
+ lit-html/directives/if-defined.js:
4
+ (**
5
+ * @license
6
+ * Copyright 2018 Google LLC
7
+ * SPDX-License-Identifier: BSD-3-Clause
8
+ *)
9
+ */exports.a=e;
@@ -1,7 +1,7 @@
1
- import {b as b$2}from'./chunk-7MR3ZC3G.js';import {b as b$1}from'./chunk-WO4HFIOO.js';import {a as a$1}from'./chunk-E7TZALBH.js';import {a}from'./chunk-ZJWT7IOI.js';import {h as h$1,c as c$1,f as f$1}from'./chunk-27BWRXCN.js';import {c,e,g}from'./chunk-KA24PL7V.js';var n,C,b,h,f,p,u=class extends a$1{constructor(){super(...arguments);e(this,n);this.order="newest";this.embedController=new b$1(this,0);}connectedCallback(){super.connectedCallback(),this.embedController.token=this.token;}requestUpdate(e,o){super.requestUpdate(e,o),e==="embed"&&(this.embedController.token=this.token);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}updated(){this.shadowRoot&&b$2(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(e){return this._collection?.videos?.some(o=>o.id===e)}getNextForEmbed(e){let o=g(this,n,C).call(this),t=o.findIndex(s=>s.id===e);if(t!==-1)return o[t+1]}render(){return c$1`
2
- ${this.embedController.render({pending:this.renderPending,error:e=>c$1`<p>${e instanceof Error?e.message:f$1}</p>`,complete:e=>{if(this._collection=e,!e)return this.renderPending();if(e.error)return console.warn(e.error);let o=this._slottedChildren.map(t=>{function s(){let l;return t.nodeName==="TEMPLATE"?l=t.content.cloneNode(true):l=t.cloneNode(true),l}if(t.getAttribute("name")=="list-title"){let l=s();return l.textContent=this._collection?.name,c$1`${l}`}if(t.getAttribute("name")=="mave-list-root"&&this.embedController.embed){let l=s(),i=g(this,n,f).call(this,l,"root-link");return i&&(i.addEventListener("click",a=>{a.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"back",embedId:""}),this.embedController.embed="";}),g(this,n,p).call(this,i)),c$1`${l}`}if(t.getAttribute("name")=="mave-list-folder"){let l=this._collection.collections?.map(i=>{let a=s(),m=g(this,n,f).call(this,a,"folder-link");return [t,m].forEach(d=>{d instanceof Element&&(d.addEventListener("click",g=>{g.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"show_collection",collectionId:i.id}),this.embedController.embed=i.id;}),g(this,n,p).call(this,d));}),g(this,n,h).call(this,a,"folder-title",i.name),typeof i.video_count=="number"&&g(this,n,h).call(this,a,"folder-count",i.video_count.toString()),c$1`${a}`});return c$1`${l}`}if(t.getAttribute("name")=="mave-list-item"||!["mave-list-folder","mave-list-item","mave-list-root","list-title"].includes(t.hasAttribute("name")?t.getAttribute("name"):"")&&t.nodeName=="TEMPLATE"){let l=g(this,n,C).call(this).map((i,a)=>{let m=s(),d=a+1;g(this,n,h).call(this,m,"item-title",i.name),g(this,n,h).call(this,m,"item-position",d.toString()),g(this,n,h).call(this,m,"item-duration",this.durationToTime(i.duration)),g(this,n,b).call(this,m,"mave-clip",i.id),g(this,n,b).call(this,m,"mave-player",i.id),g(this,n,b).call(this,m,"mave-img",i.id);let g$1=m.querySelector("mave-clip"),S=g(this,n,f).call(this,m,"item-title"),$=m.querySelector("mave-img");return [g$1,S,$,m].forEach(P=>{P?.addEventListener("click",x=>{this.emit(this.EVENT_TYPES.CLICK,{action:"show_embed",embedId:i.id,position:d});});}),c$1`${m}`});return c$1`${l}`}}).filter(t=>t);return c$1`${this._stylesheets} ${o}`}})}
3
- `}renderPending(){return c$1`<slot style="display: none"></slot>`}};n=new WeakSet,C=function(){if(!this._collection)return [];let e=this._collection.videos;return this.order=="newest"&&(e=this._collection.videos?.sort((o,t)=>t.created-o.created)),this.order=="oldest"&&(e=this._collection.videos?.sort((o,t)=>o.created-t.created)),this.order=="az"&&(e=this._collection.videos?.sort((o,t)=>o.name.localeCompare(t.name))),this.order=="za"&&(e=this._collection.videos?.sort((o,t)=>t.name.localeCompare(o.name))),e},b=function(e,o,t){let s=e.querySelector(o);s&&(s.setAttribute("embed",t),g(this,n,p).call(this,s));},h=function(e,o,t){let s=g(this,n,f).call(this,e,o);s&&(s.textContent=t,g(this,n,p).call(this,s));},f=function(e,o){return e.querySelector(`[slot="${o}"], [data-slot="${o}"]`)},p=function(e){e&&(e.removeAttribute("slot"),e.removeAttribute("data-slot"));},u.styles=h$1`
1
+ import {b as b$2}from'./chunk-KLJGACPT.js';import {b as b$1}from'./chunk-OX42Y2HR.js';import {a as a$2}from'./chunk-SWRFZ3FV.js';import {a as a$1}from'./chunk-PTN427IG.js';import {a as a$3,e as e$1}from'./chunk-5PIHL662.js';import {a}from'./chunk-YPCQNE3R.js';import {c,e,g}from'./chunk-KA24PL7V.js';var n,C,b,h,f,p,u=class extends a$2{constructor(){super(...arguments);e(this,n);this.order="newest";this.embedController=new b$1(this,0);}connectedCallback(){super.connectedCallback(),this.embedController.token=this.token;}requestUpdate(e,o){super.requestUpdate(e,o),e==="embed"&&(this.embedController.token=this.token);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}updated(){this.shadowRoot&&b$2(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(e){return this._collection?.videos?.some(o=>o.id===e)}getNextForEmbed(e){let o=g(this,n,C).call(this),t=o.findIndex(s=>s.id===e);if(t!==-1)return o[t+1]}render(){return a$3`
2
+ ${this.embedController.render({pending:this.renderPending,error:e=>a$3`<p>${e instanceof Error?e.message:e$1}</p>`,complete:e=>{if(this._collection=e,!e)return this.renderPending();if(e.error)return console.warn(e.error);let o=this._slottedChildren.map(t=>{function s(){let l;return t.nodeName==="TEMPLATE"?l=t.content.cloneNode(true):l=t.cloneNode(true),l}if(t.getAttribute("name")=="list-title"){let l=s();return l.textContent=this._collection?.name,a$3`${l}`}if(t.getAttribute("name")=="mave-list-root"&&this.embedController.embed){let l=s(),i=g(this,n,f).call(this,l,"root-link");return i&&(i.addEventListener("click",a=>{a.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"back",embedId:""}),this.embedController.embed="";}),g(this,n,p).call(this,i)),a$3`${l}`}if(t.getAttribute("name")=="mave-list-folder"){let l=this._collection.collections?.map(i=>{let a=s(),m=g(this,n,f).call(this,a,"folder-link");return [t,m].forEach(d=>{d instanceof Element&&(d.addEventListener("click",g=>{g.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"show_collection",collectionId:i.id}),this.embedController.embed=i.id;}),g(this,n,p).call(this,d));}),g(this,n,h).call(this,a,"folder-title",i.name),typeof i.video_count=="number"&&g(this,n,h).call(this,a,"folder-count",i.video_count.toString()),a$3`${a}`});return a$3`${l}`}if(t.getAttribute("name")=="mave-list-item"||!["mave-list-folder","mave-list-item","mave-list-root","list-title"].includes(t.hasAttribute("name")?t.getAttribute("name"):"")&&t.nodeName=="TEMPLATE"){let l=g(this,n,C).call(this).map((i,a)=>{let m=s(),d=a+1;g(this,n,h).call(this,m,"item-title",i.name),g(this,n,h).call(this,m,"item-position",d.toString()),g(this,n,h).call(this,m,"item-duration",this.durationToTime(i.duration)),g(this,n,b).call(this,m,"mave-clip",i.id),g(this,n,b).call(this,m,"mave-player",i.id),g(this,n,b).call(this,m,"mave-img",i.id);let g$1=m.querySelector("mave-clip"),S=g(this,n,f).call(this,m,"item-title"),$=m.querySelector("mave-img");return [g$1,S,$,m].forEach(P=>{P?.addEventListener("click",x=>{this.emit(this.EVENT_TYPES.CLICK,{action:"show_embed",embedId:i.id,position:d});});}),a$3`${m}`});return a$3`${l}`}}).filter(t=>t);return a$3`${this._stylesheets} ${o}`}})}
3
+ `}renderPending(){return a$3`<slot style="display: none"></slot>`}};n=new WeakSet,C=function(){if(!this._collection)return [];let e=this._collection.videos;return this.order=="newest"&&(e=this._collection.videos?.sort((o,t)=>t.created-o.created)),this.order=="oldest"&&(e=this._collection.videos?.sort((o,t)=>o.created-t.created)),this.order=="az"&&(e=this._collection.videos?.sort((o,t)=>o.name.localeCompare(t.name))),this.order=="za"&&(e=this._collection.videos?.sort((o,t)=>t.name.localeCompare(o.name))),e},b=function(e,o,t){let s=e.querySelector(o);s&&(s.setAttribute("embed",t),g(this,n,p).call(this,s));},h=function(e,o,t){let s=g(this,n,f).call(this,e,o);s&&(s.textContent=t,g(this,n,p).call(this,s));},f=function(e,o){return e.querySelector(`[slot="${o}"], [data-slot="${o}"]`)},p=function(e){e&&(e.removeAttribute("slot"),e.removeAttribute("data-slot"));},u.styles=a`
4
4
  :host {
5
5
  display: block;
6
6
  }
7
- `,c([a()],u.prototype,"token",2),c([a()],u.prototype,"order",2);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-list")||window.customElements.define("mave-list",u));export{u as a};
7
+ `,c([a$1()],u.prototype,"token",2),c([a$1()],u.prototype,"order",2);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-list")||window.customElements.define("mave-list",u));export{u as a};
@@ -0,0 +1,33 @@
1
+ import {a}from'./chunk-P6SBZPDR.js';var c="lit-localize-status";var I=e=>typeof e!="string"&&"strTag"in e,p=(e,t,o)=>{let n=e[0];for(let r=1;r<e.length;r++)n+=t[o?o[r-1]:r-1],n+=e[r];return n};var d=(e=>I(e)?p(e.strings,e.values):e);var x=d,C=false;function _(e){if(C)throw new Error("lit-localize can only be configured once");x=e,C=true;}var E=class{constructor(t){this.__litLocalizeEventHandler=o=>{o.detail.status==="ready"&&this.host.requestUpdate();},this.host=t;}hostConnected(){window.addEventListener(c,this.__litLocalizeEventHandler);}hostDisconnected(){window.removeEventListener(c,this.__litLocalizeEventHandler);}},F=e=>e.addController(new E(e)),z=F;var N=()=>(e,t)=>(e.addInitializer(z),e);var u=class{constructor(){this.settled=false,this.promise=new Promise((t,o)=>{this._resolve=t,this._reject=o;});}resolve(t){this.settled=true,this._resolve(t);}reject(t){this.settled=true,this._reject(t);}};var i=[];for(let e=0;e<256;e++)i[e]=(e>>4&15).toString(16)+(e&15).toString(16);function A(e){let t=0,o=8997,n=0,r=33826,s=0,a=40164,L=0,f=52210;for(let v=0;v<e.length;v++)o^=e.charCodeAt(v),t=o*435,n=r*435,s=a*435,L=f*435,s+=o<<8,L+=r<<8,n+=t>>>16,o=t&65535,s+=n>>>16,r=n&65535,f=L+(s>>>16)&65535,a=s&65535;return i[f>>8]+i[f&255]+i[a>>8]+i[a&255]+i[r>>8]+i[r&255]+i[o>>8]+i[o&255]}var W="",$="h",b="s";function R(e,t){return (t?$:b)+A(typeof e=="string"?e:e.join(W))}var j=new WeakMap,H=new Map;function P(e,t,o){if(e){let n=o?.id??O(t),r=e[n];if(r){if(typeof r=="string")return r;if("strTag"in r)return p(r.strings,t.values,r.values);{let s=j.get(r);return s===void 0&&(s=r.values,j.set(r,s)),{...r,values:s.map(a=>t.values[a])}}}}return d(t)}function O(e){let t=typeof e=="string"?e:e.strings,o=H.get(t);return o===void 0&&(o=R(t,typeof e!="string"&&!("strTag"in e)),H.set(t,o)),o}function w(e){window.dispatchEvent(new CustomEvent(c,{detail:e}));}var g="",S,U,h,y,V,l=new u;l.resolve();var m=0,q=e=>(_(((t,o)=>P(V,t,o))),g=U=e.sourceLocale,h=new Set(e.targetLocales),h.add(e.sourceLocale),y=e.loadLocale,{getLocale:k,setLocale:X}),k=()=>g,X=e=>{if(e===(S??g))return l.promise;if(!h||!y)throw new Error("Internal error");if(!h.has(e))throw new Error("Invalid locale code");m++;let t=m;return S=e,l.settled&&(l=new u),w({status:"loading",loadingLocale:e}),(e===U?Promise.resolve({templates:void 0}):y(e)).then(n=>{m===t&&(g=e,S=void 0,V=n.templates,w({status:"ready",readyLocale:e}),l.resolve());},n=>{m===t&&(w({status:"error",errorLocale:e,errorMessage:n.toString()}),l.reject(n));}),l.promise};var G={en:()=>import('./generated/locales/en.js'),nl:()=>import('./generated/locales/nl.js'),de:()=>import('./generated/locales/de.js'),fr:()=>import('./generated/locales/fr.js')};function B(e){return G[e]}async function J(e){let t=a();if(!t)return null;try{return await import(new URL(`./${t}generated/locales/${e}.js`,import.meta.url).href)}catch{return null}}var K=q({sourceLocale:"default",targetLocales:["en","nl","de","fr"],loadLocale:async e=>{let t=B(e);if(t)try{return await t()}catch(n){console.error(`[mave-player]: failed to load locale ${e}`,n);}let o=await J(e);return o||(console.log(`[mave-player]: locale not loaded for ${e}`),null)}}),T=false,D=class{constructor(t){this._onLoad=t=>{t.detail.status==="loading"?T=false:t.detail.status==="ready"&&(T=true),this.host.requestUpdate();};this.host=t,t.addController(this);}get loaded(){return T}set locale(t){this._locale!==t&&(K.setLocale(t),this.host.requestUpdate());}get locale(){return this._locale}hostConnected(){typeof window<"u"&&window.addEventListener("lit-localize-status",this._onLoad);}hostDisconnected(){typeof window<"u"&&window.removeEventListener("lit-localize-status",this._onLoad);}};/*! Bundled license information:
2
+
3
+ @lit/localize/internal/locale-status-event.js:
4
+ @lit/localize/internal/str-tag.js:
5
+ @lit/localize/internal/types.js:
6
+ @lit/localize/internal/default-msg.js:
7
+ @lit/localize/internal/localized-controller.js:
8
+ @lit/localize/internal/localized-decorator.js:
9
+ @lit/localize/internal/runtime-msg.js:
10
+ @lit/localize/init/runtime.js:
11
+ @lit/localize/init/transform.js:
12
+ (**
13
+ * @license
14
+ * Copyright 2021 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ *)
17
+
18
+ @lit/localize/internal/deferred.js:
19
+ @lit/localize/internal/id-generation.js:
20
+ @lit/localize/lit-localize.js:
21
+ (**
22
+ * @license
23
+ * Copyright 2020 Google LLC
24
+ * SPDX-License-Identifier: BSD-3-Clause
25
+ *)
26
+
27
+ @lit/localize/internal/fnv1a64.js:
28
+ (**
29
+ * @license
30
+ * Copyright 2014 Travis Webb
31
+ * SPDX-License-Identifier: MIT
32
+ *)
33
+ */export{x as a,N as b,K as c,D as d};
@@ -0,0 +1,3 @@
1
+ 'use strict';var chunkEVKPEPYP_cjs=require('./chunk-EVKPEPYP.cjs');var b=e=>typeof e=="function"?e:function(){return e},_=typeof self<"u"?self:null,m=typeof window<"u"?window:null,f=_||m||globalThis,H="2.0.0",u={connecting:0,open:1,closing:2,closed:3},P=1e4,x=1e3,c={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},p={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},R={longpoll:"longpoll",websocket:"websocket"},B={complete:4},k="base64url.bearer.phx.",v=class{constructor(e,t,i,s){this.channel=e,this.event=t,this.payload=i||function(){return {}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=false;}resend(e){this.timeout=e,this.reset(),this.send();}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=true,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}));}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=false;}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t));}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent);}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null;}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e);}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{});},this.timeout);}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t});}},j=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0;}reset(){this.tries=0,clearTimeout(this.timer);}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback();},this.timerCalc(this.tries+1));}},$=class{constructor(e,t,i){this.state=c.closed,this.topic=e,this.params=b(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=false,this.joinPush=new v(this,p.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new j(()=>{this.socket.isConnected()&&this.rejoin();},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin();})),this.joinPush.receive("ok",()=>{this.state=c.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[];}),this.joinPush.receive("error",()=>{this.state=c.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=c.closed,this.socket.remove(this);}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=c.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new v(this,p.leave,b({}),this.timeout).send(),this.state=c.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.on(p.reply,(s,r)=>{this.trigger(this.replyEventName(r),s);});}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=true,this.rejoin(),this.joinPush}onClose(e){this.on(p.close,e);}onError(e){return this.on(p.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t>"u"||t===i.ref)));}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new v(this,e,function(){return t},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=c.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(p.close,"leave");},i=new v(this,p.leave,b({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,s){return this.topic!==e?false:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:s}),false):true}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=c.joining,this.joinPush.resend(e));}trigger(e,t,i,s){let r=this.onMessage(e,t,i,s);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let n=this.bindings.filter(h=>h.event===e);for(let h=0;h<n.length;h++)n[h].callback(r,i,s||this.joinRef());}replyEventName(e){return `chan_reply_${e}`}isClosed(){return this.state===c.closed}isErrored(){return this.state===c.errored}isJoined(){return this.state===c.joined}isJoining(){return this.state===c.joining}isLeaving(){return this.state===c.leaving}},E=class{static request(e,t,i,s,r,n,h){if(f.XDomainRequest){let o=new f.XDomainRequest;return this.xdomainRequest(o,e,t,s,r,n,h)}else if(f.XMLHttpRequest){let o=new f.XMLHttpRequest;return this.xhrRequest(o,e,t,i,s,r,n,h)}else {if(f.fetch&&f.AbortController)return this.fetchRequest(e,t,i,s,r,n,h);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,i,s,r,n,h){let o={method:e,headers:i,body:s},a=null;if(r){a=new AbortController;setTimeout(()=>a.abort(),r);o.signal=a.signal;}return f.fetch(t,o).then(l=>l.text()).then(l=>this.parseJSON(l)).then(l=>h&&h(l)).catch(l=>{l.name==="AbortError"&&n?n():h&&h(null);}),a}static xdomainRequest(e,t,i,s,r,n,h){return e.timeout=r,e.open(t,i),e.onload=()=>{let o=this.parseJSON(e.responseText);h&&h(o);},n&&(e.ontimeout=n),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,i,s,r,n,h,o){e.open(t,i,true),e.timeout=n;for(let[a,l]of Object.entries(s))e.setRequestHeader(a,l);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===B.complete&&o){let a=this.parseJSON(e.responseText);o(a);}},h&&(e.ontimeout=h),e.send(r),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let r=t?`${t}[${s}]`:s,n=e[s];typeof n=="object"?i.push(this.serialize(n,r)):i.push(encodeURIComponent(r)+"="+encodeURIComponent(n));}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return `${e}${i}${this.serialize(t)}`}},O=e=>{let t="",i=new Uint8Array(e),s=i.byteLength;for(let r=0;r<s;r++)t+=String.fromCharCode(i[r]);return btoa(t)},T=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(k)&&(this.authToken=atob(t[1].slice(k.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=true,this.reqs=new Set,this.awaitingBatchAck=false,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=u.connecting,setTimeout(()=>this.poll(),0);}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R.websocket),"$1/"+R.longpoll)}endpointURL(){return E.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=u.connecting;}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",false);}isActive(){return this.readyState===u.open||this.readyState===u.connecting}poll(){let e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:i,token:s,messages:r}=t;if(i===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",false);return}this.token=s;}else i=0;switch(i){case 200:r.forEach(n=>{setTimeout(()=>this.onmessage({data:n}),0);}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=u.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",false);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${i}`)}});}send(e){typeof e!="string"&&(e=O(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null;},0));}batchSend(e){this.awaitingBatchAck=true,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
2
+ `),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=false,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",false)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]);});}close(e,t,i){for(let r of this.reqs)r.abort();this.readyState=u.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:true},{code:e,reason:t,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s);}ajax(e,t,i,s,r){let n,h=()=>{this.reqs.delete(n),s();};n=E.request(e,this.endpointURL(),t,i,this.timeout,h,o=>{this.reqs.delete(n),this.isActive()&&r(o);}),this.reqs.add(n);}};var C={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,s,r,n,h]=JSON.parse(e);return t({join_ref:i,ref:s,topic:r,event:n,payload:h})}},binaryEncode(e){let{join_ref:t,ref:i,event:s,topic:r,payload:n}=e,h=this.META_LENGTH+t.length+i.length+r.length+s.length,o=new ArrayBuffer(this.HEADER_LENGTH+h),a=new DataView(o),l=0;a.setUint8(l++,this.KINDS.push),a.setUint8(l++,t.length),a.setUint8(l++,i.length),a.setUint8(l++,r.length),a.setUint8(l++,s.length),Array.from(t,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(i,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(r,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(s,d=>a.setUint8(l++,d.charCodeAt(0)));var g=new Uint8Array(o.byteLength+n.byteLength);return g.set(new Uint8Array(o),0),g.set(new Uint8Array(n),o.byteLength),g.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,o=i.decode(e.slice(h,h+s));h=h+s;let a=i.decode(e.slice(h,h+r));h=h+r;let l=i.decode(e.slice(h,h+n));h=h+n;let g=e.slice(h,e.byteLength);return {join_ref:o,ref:null,topic:a,event:l,payload:g}},decodeReply(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),h=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,a=i.decode(e.slice(o,o+s));o=o+s;let l=i.decode(e.slice(o,o+r));o=o+r;let g=i.decode(e.slice(o,o+n));o=o+n;let d=i.decode(e.slice(o,o+h));o=o+h;let A=e.slice(o,e.byteLength),L={status:d,response:A};return {join_ref:a,ref:l,topic:g,event:p.reply,payload:L}},decodeBroadcast(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=this.HEADER_LENGTH+2,h=i.decode(e.slice(n,n+s));n=n+s;let o=i.decode(e.slice(n,n+r));n=n+r;let a=e.slice(n,e.byteLength);return {join_ref:null,ref:null,topic:h,event:o,payload:a}}},w=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||P,this.transport=t.transport||f.WebSocket||T,this.primaryPassedHealthCheck=false,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||f&&f.sessionStorage,this.establishedConnections=0,this.defaultEncoder=C.encode.bind(C),this.defaultDecoder=C.decode.bind(C),this.closeWasClean=false,this.disconnecting=false,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=false,this.transport!==T?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;m&&m.addEventListener&&(m.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock);}),m.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect());}),m.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=true:(this.pageHidden=false,this.isConnected()||this.teardown(()=>this.connect()));})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,r,n)=>{console.log(`${s}: ${r}`,n);}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=b(t.params||{}),this.endPoint=`${e}/${R.websocket}`,this.vsn=t.vsn||H,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new j(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect());},this.reconnectAfterMs),this.authToken=t.authToken;}getLongPollTransport(){return T}replaceTransport(e){this.connectClock++,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e;}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=E.appendParams(E.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.disconnecting=true,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=false,e&&e();},t,i);}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=b(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==T?this.connectWithFallback(T,this.longPollFallbackMs):this.transportConnect());}log(e,t,i){this.logger&&this.logger(e,t,i);}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return false;let t=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(r=>{r.ref===t&&(this.off([s]),e(Date.now()-i));});return true}transportConnect(){this.connectClock++,this.closeWasClean=false;let e;this.authToken&&(e=["phoenix",`${k}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t);}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t);}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let i=false,s=true,r,n,h=o=>{this.log("transport",`falling back to ${e.name}...`,o),this.off([r,n]),s=false,this.replaceTransport(e),this.transportConnect();};if(this.getSession(`phx:fallback:${e.name}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),n=this.onError(o=>{this.log("transport","error",o),s&&!i&&(clearTimeout(this.fallbackTimer),h(o));}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=true,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(o=>{this.log("transport","connected to primary after",o),this.primaryPassedHealthCheck=true,clearTimeout(this.fallbackTimer);});}),this.transportConnect();}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer);}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=false,this.disconnecting=false,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e());}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=false,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),x,"heartbeat timeout"));}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs));}teardown(e,t,i){if(!this.conn)return e&&e();let s=this.connectClock;this.waitForBufferDone(()=>{s===this.connectClock&&(this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{s===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e());}));});}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1);},150*t);}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===u.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1);},150*t);}onConnClose(e){this.conn&&(this.conn.onclose=()=>{});let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e));}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(e,t,i);}),(t===this.transport||i>0)&&this.triggerChanError();}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(p.error);});}connectionState(){switch(this.conn&&this.conn.readyState){case u.connecting:return "connecting";case u.open:return "open";case u.closing:return "closing";default:return "closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e);}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1);}channel(e,t={}){let i=new $(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:s,ref:r,join_ref:n}=e;this.log("push",`${t} ${i} (${n}, ${r})`,s);}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)));}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs));}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[]);}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:s,payload:r,ref:n,join_ref:h}=t;n&&n===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${i} ${s} ${n&&"("+n+")"||""}`,r);for(let o=0;o<this.channels.length;o++){let a=this.channels[o];a.isMember(i,s,r,h)&&a.trigger(s,r,n,h);}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,a]=this.stateChangeCallbacks.message[o];a(t);}});}leaveOpenTopic(e){let t=this.channels.find(i=>i.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave());}};var y=class{static connect(t){if(typeof window>"u"){let n={on:()=>n,push:()=>n,join:()=>n,leave:()=>Promise.resolve(),off:()=>{}};return {token:t,channel:n}}let i=new w(chunkEVKPEPYP_cjs.a.upload.socket,{params:{token:t},reconnectAfterMs:n=>[1e3,3e3,5e3,1e4][n-1]||1e4});i.connect();let s=i.channel(`embed:${t}`),r={token:t,channel:s,socket:i};return s.on("initiate",({upload_id:n})=>{r.upload_id=n;}),s.join(),r}static async disconnect(t){if(t){try{await t.channel.leave();}catch{}t.socket?.disconnect();}}};
3
+ exports.a=y;
@@ -0,0 +1,38 @@
1
+ 'use strict';var chunkBTCK3T4L_cjs=require('./chunk-BTCK3T4L.cjs'),chunkSDKTBB4N_cjs=require('./chunk-SDKTBB4N.cjs'),chunkFAONFKQ2_cjs=require('./chunk-FAONFKQ2.cjs'),chunkRQN3DXJB_cjs=require('./chunk-RQN3DXJB.cjs'),chunkDL4BV5IH_cjs=require('./chunk-DL4BV5IH.cjs'),chunk2E5GLLOS_cjs=require('./chunk-2E5GLLOS.cjs'),chunkNPP5B5PV_cjs=require('./chunk-NPP5B5PV.cjs'),chunkEVKPEPYP_cjs=require('./chunk-EVKPEPYP.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var i,v,c,u,y,M,p,I,S,T,r=class extends chunk2E5GLLOS_cjs.g{constructor(){super(...arguments);chunkJHSFSCC2_cjs.e(this,i);this.autoplay="lazy";this.quality="auto";this.fallback="placeholder";this._queue=[];this._failedPlay=false;this._intersectionObserver=new chunkBTCK3T4L_cjs.a(this,{callback:chunkJHSFSCC2_cjs.g(this,i,S).bind(this)});this.embedController=new chunkRQN3DXJB_cjs.b(this);}get embed(){return this._embedId}set embed(t){this._embedId!=t&&(this._embedId=t,this.requestUpdate("embed"),this.embedController.embed=this.embed);}set loop(t){this._loop=(t===""||t=="true"||t==true)??false;}get loop(){return this._loop}get poster(){return this.embedController.embedFile(`${this.fallback}.jpg`)}set poster(t){if(t){let s=this._poster;this._poster=t,this.requestUpdate("poster",s);}}get token(){return this._token}set token(t){this._token!=t&&(this._token=t,this.requestUpdate("token"),this.embedController.token=this._token);}get sources(){let t=this.autoplay==="scroll"?["clip_keyframes"]:["video","clip"],s=this._embed.video.renditions.filter(e=>(this.quality=="auto"?e.size!=="uhd":chunkJHSFSCC2_cjs.d(this,i,c).indexOf(e.size)<=chunkJHSFSCC2_cjs.d(this,i,c).indexOf(this.quality))&&e.container==="mp4"&&chunkJHSFSCC2_cjs.d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>e.size===o.size?chunkJHSFSCC2_cjs.d(this,i,u).indexOf(e.codec)-chunkJHSFSCC2_cjs.d(this,i,u).indexOf(o.codec):chunkJHSFSCC2_cjs.d(this,i,c).indexOf(o.size)-chunkJHSFSCC2_cjs.d(this,i,c).indexOf(e.size)).map(e=>{let o=chunkJHSFSCC2_cjs.d(this,i,M).find(g=>g.size===e.size)?.media,m=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`;return {media:o,src:this.embedController.embedFile(m),codec:chunkJHSFSCC2_cjs.d(this,i,y)[e.codec]??e.codec}}),d=this._embed.video.renditions.filter(e=>chunkJHSFSCC2_cjs.d(this,i,c).indexOf(e.size)<=chunkJHSFSCC2_cjs.d(this,i,c).indexOf("fhd")&&e.container==="mp4"&&chunkJHSFSCC2_cjs.d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>chunkJHSFSCC2_cjs.d(this,i,c).indexOf(o.size)-chunkJHSFSCC2_cjs.d(this,i,c).indexOf(e.size));if(d.length>0){let e=d[0],o=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`,m={media:void 0,src:this.embedController.embedFile(o),codec:chunkJHSFSCC2_cjs.d(this,i,y)[e.codec]??e.codec};s.push(m);}return s}connectedCallback(){super.connectedCallback(),typeof document<"u"&&this.autoplay==="scroll"&&document.addEventListener("scroll",chunkJHSFSCC2_cjs.g(this,i,v).bind(this));}disconnectedCallback(){super.disconnectedCallback(),typeof document<"u"&&this.autoplay==="scroll"&&document.removeEventListener("scroll",chunkJHSFSCC2_cjs.g(this,i,v).bind(this)),this._metricsInstance?.demonitor();}set muted(t){this._videoElement?this._videoElement.muted=t:this._queue.push(()=>this._videoElement.muted=t);}get muted(){return this._videoElement?.muted||false}get paused(){return this._videoElement?.paused??true}get duration(){return new Promise((t,s)=>{if(this._videoElement&&!isNaN(this._videoElement.duration))return t(this._videoElement.duration);let d=()=>{this._videoElement?.addEventListener("loadedmetadata",()=>{this._videoElement&&t(this._videoElement.duration);}),this._videoElement?.addEventListener("error",e=>{s(new Error("Failed to load video metadata."));});};this._videoElement?d():this.addEventListener("mave:video_element_ready",()=>{d();});})}set currentTime(t){this._videoElement?this._videoElement.currentTime=t:this._queue.push(()=>this._videoElement.currentTime=t);}get currentTime(){return this._videoElement?this._videoElement?.currentTime:0}play(){this._videoElement?chunkJHSFSCC2_cjs.g(this,i,p).call(this):this._queue.push(()=>chunkJHSFSCC2_cjs.g(this,i,p).call(this));}pause(){this._videoElement?this._videoElement.pause():this._queue.push(()=>this._videoElement?.pause());}render(){return chunk2E5GLLOS_cjs.a`
2
+ ${this.embedController.render({complete:t=>{if(this._embed=t,!!t)return chunk2E5GLLOS_cjs.a`
3
+ <video
4
+ @click=${chunkJHSFSCC2_cjs.g(this,i,T)}
5
+ preload="metadata"
6
+ style=${chunkFAONFKQ2_cjs.a(this._failedPlay||this.autoplay==="off"?"cursor: pointer":void 0)}
7
+ muted
8
+ playsinline
9
+ poster=${chunkFAONFKQ2_cjs.a(this._failedPlay?this.poster:void 0)}
10
+ ${chunkBTCK3T4L_cjs.c(chunkJHSFSCC2_cjs.g(this,i,I))}
11
+ ?autoplay=${this.autoplay==="always"}
12
+ ?loop=${this.loop||true}
13
+ >
14
+ ${this.sources.map(s=>chunk2E5GLLOS_cjs.a`
15
+ <source
16
+ media=${chunkFAONFKQ2_cjs.a(s.media?`(min-width: ${s.media}px)`:void 0)}
17
+ src=${s.src}
18
+ type=${`video/mp4; ${s.codec}`}
19
+ />
20
+ `)}
21
+ </video>
22
+ `}})}
23
+ `}};i=new WeakSet,v=function(){if(typeof window>"u")return;let{height:t,top:s,bottom:d}=this.getBoundingClientRect(),e=window.innerHeight;if(this._videoElement){this._videoElement.duration||this._videoElement.load();let o=0;if(s<e&&d>0){let m=t+e;o=(e-s)/m*this._videoElement.duration;}o>=0&&o<=this._videoElement.duration&&(this._videoElement.currentTime=o);}},c=function(){return ["sd","hd","fhd","qhd","uhd"]},u=function(){let t=navigator.userAgent,s=/Edg/.test(t)&&/Mac OS/.test(t),d=/Safari/.test(t)&&!/Chrome/.test(t),e=/Mac OS/.test(t),o=/iPhone|iPad/.test(t);return e&&(d||s)||o?["hevc","h264"]:["av1","h264"]},y=function(){return {av1:"av01.0.08M.08.0.110.01.01.01.0,opus",hevc:"hevc.01.00.78,mp4a.40.2",h264:"avc1.64.00.28,mp4a.40.2"}},M=function(){return [{size:"qhd",media:1280},{size:"fhd",media:1080},{size:"hd",media:720},{size:"sd",media:640}]},p=function(){this._metricsInstance?.monitor(),this._videoElement&&(this._videoElement.muted=true,this._videoElement.play().catch(t=>{this._failedPlay=true;}));},I=function(t){if(this._videoElement||(this._videoElement=t,this.dispatchEvent(new CustomEvent("mave:video_element_ready",{detail:this._videoElement,bubbles:true,composed:true}))),this._intersectionObserver.observe(this._videoElement),this._videoElement&&this._embed){chunkSDKTBB4N_cjs.a.forEach(d=>{this._videoElement?.addEventListener(d,e=>{!this._canPlay&&this.autoplay==="scroll"&&d==="canplay"&&(this._canPlay=true,chunkJHSFSCC2_cjs.g(this,i,v).call(this)),this.dispatchEvent(new CustomEvent(d,{detail:e,bubbles:true,composed:true}));});});({video_id:this._embed.video.id,space_id:this._embed.space_id});chunkBTCK3T4L_cjs.b.config={apiEndpoint:chunkEVKPEPYP_cjs.a.metrics.endpoint},chunkEVKPEPYP_cjs.a.metrics.enabled&&(this._metricsInstance=new chunkBTCK3T4L_cjs.b(this._videoElement,this.embed,{component:"clip"}));}this._queue.length&&(this._queue.forEach(s=>s()),this._queue=[]);},S=function(t){for(let{isIntersecting:s}of t){if(this.autoplay==="always")return;s&&(this.autoplay==="lazy"||this.autoplay==="true")?this._videoElement?.paused&&chunkJHSFSCC2_cjs.g(this,i,p).call(this):this._videoElement?.paused||this._videoElement?.pause();}},T=function(){(this.autoplay==="off"||this._failedPlay)&&(this._videoElement?.paused?chunkJHSFSCC2_cjs.g(this,i,p).call(this):this._videoElement?.pause());},r.styles=chunkNPP5B5PV_cjs.a`
24
+ :host {
25
+ display: block;
26
+ position: relative;
27
+ overflow: hidden;
28
+ }
29
+
30
+ video {
31
+ all: initial;
32
+ display: block;
33
+ width: 100%;
34
+ height: 100%;
35
+ object-fit: var(--clip-fit, cover);
36
+ object-position: var(--clip-position, 50% 50%);
37
+ }
38
+ `,chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a()],r.prototype,"embed",1),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a()],r.prototype,"autoplay",2),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a()],r.prototype,"quality",2),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a()],r.prototype,"fallback",2),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a()],r.prototype,"loop",1),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a()],r.prototype,"poster",1),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a()],r.prototype,"token",1),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.b()],r.prototype,"_failedPlay",2);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-clip")||window.customElements.define("mave-clip",r));exports.a=r;