@maveio/components 0.0.166 → 0.0.168

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 (75) hide show
  1. package/dist/chunk-2JCNQPEK.js +1 -0
  2. package/dist/chunk-3J6Q5HPF.js +37 -0
  3. package/dist/{chunk-NROHM3YR.cjs → chunk-3SSU5VNZ.cjs} +101 -101
  4. package/dist/{chunk-JUDFZS5N.cjs → chunk-42VJWULJ.cjs} +1 -1
  5. package/dist/chunk-43KJ6TMU.cjs +17 -0
  6. package/dist/{chunk-BS3IICLO.cjs → chunk-4UB3XJZV.cjs} +1 -1
  7. package/dist/{chunk-E2IDHUN5.js → chunk-62PQDUAE.js} +1 -1
  8. package/dist/{chunk-HS74B6NF.cjs → chunk-6KO66K2G.cjs} +1 -1
  9. package/dist/{chunk-KNAAIER3.js → chunk-6PSWE4MR.js} +1 -1
  10. package/dist/{chunk-HT464LCH.js → chunk-7SJMIXXD.js} +1 -1
  11. package/dist/{chunk-KUPCZDOX.cjs → chunk-ETDEE7EL.cjs} +1 -1
  12. package/dist/chunk-EVKPEPYP.cjs +2 -0
  13. package/dist/{chunk-WO4HFIOO.js → chunk-FLXLRYLI.js} +1 -1
  14. package/dist/{chunk-E7TZALBH.js → chunk-FQRZLSBE.js} +1 -1
  15. package/dist/{chunk-SF36AD3G.js → chunk-H5YWUSBE.js} +1 -1
  16. package/dist/{chunk-YKO34INI.cjs → chunk-LGKQ3C7I.cjs} +1 -1
  17. package/dist/{chunk-7MR3ZC3G.js → chunk-LHWG7RHD.js} +1 -1
  18. package/dist/chunk-N27UPJGV.cjs +37 -0
  19. package/dist/{chunk-BN4D4W23.js → chunk-NX7L7P75.js} +1 -1
  20. package/dist/chunk-O4QBLS42.js +17 -0
  21. package/dist/{chunk-TSTFPNEM.js → chunk-PJMR6NFX.js} +1 -1
  22. package/dist/{chunk-FUSQ4EZG.cjs → chunk-QPYU4D32.cjs} +2 -2
  23. package/dist/{chunk-PXLLLBZ3.cjs → chunk-RBBM42XM.cjs} +1 -1
  24. package/dist/{chunk-AJ33W3DD.cjs → chunk-RIIKHYMD.cjs} +2 -2
  25. package/dist/{chunk-ZUM5T3HV.js → chunk-VMGLCRPK.js} +1 -1
  26. package/dist/{chunk-55JWHJJ5.cjs → chunk-WYXWOUKN.cjs} +2 -2
  27. package/dist/chunk-X7OGQ4KH.cjs +1 -0
  28. package/dist/{chunk-TVXCJNTZ.js → chunk-XKFWCRVL.js} +102 -102
  29. package/dist/{chunk-3T573OW4.cjs → chunk-ZQ3G5EQT.cjs} +1 -1
  30. package/dist/chunk-ZTDQPDC6.js +2 -0
  31. package/dist/components/clip.cjs +1 -1
  32. package/dist/components/clip.js +1 -1
  33. package/dist/components/files.cjs +1 -1
  34. package/dist/components/files.js +1 -1
  35. package/dist/components/img.cjs +1 -1
  36. package/dist/components/img.js +1 -1
  37. package/dist/components/list.cjs +1 -1
  38. package/dist/components/list.js +1 -1
  39. package/dist/components/player.cjs +1 -1
  40. package/dist/components/player.js +1 -1
  41. package/dist/components/pop.cjs +1 -1
  42. package/dist/components/pop.js +1 -1
  43. package/dist/components/text.cjs +1 -1
  44. package/dist/components/text.js +1 -1
  45. package/dist/components/upload.cjs +1 -1
  46. package/dist/components/upload.js +1 -1
  47. package/dist/config.cjs +1 -1
  48. package/dist/config.d.cts +1 -1
  49. package/dist/config.d.ts +1 -1
  50. package/dist/config.js +1 -1
  51. package/dist/embed/api.cjs +1 -1
  52. package/dist/embed/api.js +1 -1
  53. package/dist/embed/caption.cjs +1 -1
  54. package/dist/embed/caption.js +1 -1
  55. package/dist/embed/controller.cjs +1 -1
  56. package/dist/embed/controller.js +1 -1
  57. package/dist/embed/socket.cjs +1 -1
  58. package/dist/embed/socket.js +1 -1
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/react.cjs +1 -1
  62. package/dist/react.js +1 -1
  63. package/dist/utils/mave_element.cjs +1 -1
  64. package/dist/utils/mave_element.js +1 -1
  65. package/dist/vue.cjs +1 -1
  66. package/dist/vue.js +1 -1
  67. package/package.json +2 -2
  68. package/dist/chunk-5STN56TL.cjs +0 -2
  69. package/dist/chunk-BSJIDMTZ.js +0 -18
  70. package/dist/chunk-F6EKAS27.js +0 -1
  71. package/dist/chunk-JBV2AYRP.js +0 -2
  72. package/dist/chunk-JR7IABIG.cjs +0 -18
  73. package/dist/chunk-PZSV3LCB.js +0 -37
  74. package/dist/chunk-QLCBHFAG.cjs +0 -37
  75. package/dist/chunk-ZODBVQLM.cjs +0 -1
@@ -1 +1 @@
1
- 'use strict';var chunkWIS6FQDY_cjs=require('./chunk-WIS6FQDY.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var s=class extends chunkGO6BV3T4_cjs.i{constructor(){super(...arguments);this.EVENT_TYPES={CLICK:"user_click"};}get embed(){return this._embed}set embed(t){this._embed=t;}get embedId(){return this._embed?.substring(5,this._embed?.length)}get spaceId(){return this.embed?.substring(0,5)}get cdn_root(){return chunk5STN56TL_cjs.a.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}get _stylesheets(){if(typeof document>"u")return chunkGO6BV3T4_cjs.c``;let t=document.querySelectorAll('style, link[rel="stylesheet"]');return chunkGO6BV3T4_cjs.c`${Array.from(t).map(e=>e.cloneNode(true))}`}durationToTime(t){let e=Math.floor(t),n=Math.floor(e/3600),i=Math.floor(e%3600/60),o=e%60;return n>0?`${n}:${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${i}:${o.toString().padStart(2,"0")}`}emit(t,e){this.dispatchEvent(new CustomEvent(`mave:${t}`,{detail:{...e,eventType:t}})),this.dispatchEvent(new CustomEvent("mave:*",{detail:{...e,eventType:t}}));}};chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a({type:String})],s.prototype,"embed",1);exports.a=s;
1
+ 'use strict';var chunkWIS6FQDY_cjs=require('./chunk-WIS6FQDY.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs'),chunkEVKPEPYP_cjs=require('./chunk-EVKPEPYP.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var s=class extends chunkGO6BV3T4_cjs.i{constructor(){super(...arguments);this.EVENT_TYPES={CLICK:"user_click"};}get embed(){return this._embed}set embed(t){this._embed=t;}get embedId(){return this._embed?.substring(5,this._embed?.length)}get spaceId(){return this.embed?.substring(0,5)}get cdn_root(){return chunkEVKPEPYP_cjs.a.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}get _stylesheets(){if(typeof document>"u")return chunkGO6BV3T4_cjs.c``;let t=document.querySelectorAll('style, link[rel="stylesheet"]');return chunkGO6BV3T4_cjs.c`${Array.from(t).map(e=>e.cloneNode(true))}`}durationToTime(t){let e=Math.floor(t),n=Math.floor(e/3600),i=Math.floor(e%3600/60),o=e%60;return n>0?`${n}:${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${i}:${o.toString().padStart(2,"0")}`}emit(t,e){this.dispatchEvent(new CustomEvent(`mave:${t}`,{detail:{...e,eventType:t}})),this.dispatchEvent(new CustomEvent("mave:*",{detail:{...e,eventType:t}}));}};chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a({type:String})],s.prototype,"embed",1);exports.a=s;
@@ -0,0 +1,17 @@
1
+ 'use strict';var chunkRRCW5BBR_cjs=require('./chunk-RRCW5BBR.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs');var fe=class{constructor(e,{target:s,config:r,callback:d,skipInitial:b}){this.t=new Set,this.o=false,this.i=false,this.h=e,s!==null&&this.t.add(s??e),this.o=b??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)},ne=(i,e,s)=>e.has(i)||pe("Cannot "+s),t=(i,e,s)=>(ne(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)=>(ne(i,e,"write to private field"),e.set(i,s),s),h=(i,e,s)=>(ne(i,e,"access private method"),s),H,_e=class x{static setDebug(e){n(x,H,e);}static debugEnabled(){if(t(x,H))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){x.debugEnabled()&&(typeof s>"u"?console.debug(`[mave_data]: ${e}`):console.debug(`[mave_data]: ${e}`,s));}};H=new WeakMap;o(_e,H,false);var f=_e,q,m,I,S,ae,G,z,W,p,me,ve,$,he,ge,be,ye,we,ke,Ae,Le=class g{constructor(){if(o(this,p),o(this,q,{apiEndpoint:""}),o(this,m,[]),o(this,I,null),o(this,S,null),o(this,ae,5e3),o(this,G,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;ae=new WeakMap;G=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,ae))),t(this,m).length>=t(this,G)&&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,b=h(this,p,be).call(this,e);f.debug("Data.flush.start",{url:s,buffered:e.length,batches:b.map(_=>_.length),keepalive:r,preferBeacon:d});let B=false;n(this,W,(async()=>{for(let _ of b){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,he).call(this),B&&h(this,p,$).call(this);}));};he=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,he).call(this),n(this,m,[]),n(this,W,null);};be=function(i){let e=[],s=[],r=0;for(let d of i){let b=h(this,p,ye).call(this,d),B=r+b>t(this,z),_=s.length>=t(this,G);s.length>0&&(B||_)&&(e.push(s),s=[],r=0),s.push(d),r+=b;}return s.length>0&&e.push(s),e};ye=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=Le;function Be(){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 re=(i=>(i.PLAYING="playing",i.ENDED="ended",i.PAUSE="pause",i))(re||{}),a,c,y,w,C,T,O,P,k,D,v,A,le,oe,ce,M,J,l,U,j,X,R,Y,L,Te,Ee,Me,F,se,$e,Se,Pe,N,E,De,Re=class{constructor(...i){if(o(this,l),this.VERSION="0.1.0",o(this,a),o(this,c,null),o(this,y,false),o(this,w,false),o(this,C,null),o(this,T,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,le,750),o(this,oe,1),o(this,ce,300),o(this,M,false),o(this,J,e=>h(this,l,De).call(this,e)),o(this,j,()=>{if(!t(this,y)||!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,T,false),h(this,l,F).call(this),h(this,l,E).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,y)&&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,y)&&t(this,a)){if(t(this,c)==="play"){n(this,w,false),n(this,T,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,M,true),n(this,O,Date.now()+1500),h(this,l,N).call(this),n(this,T,false),u.flush(),n(this,w,false);}else n(this,T,true),n(this,w,false);}},200))));}),o(this,R,()=>{t(this,y)&&document.visibilityState==="hidden"&&u.flush();}),o(this,Y,e=>{if(t(this,y)){if(e.persisted){u.flush();return}h(this,l,se).call(this),h(this,l,Me).call(this),u.flushOnExit();}}),this.sessionId=Be(),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,y)?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,R)),window.addEventListener("pagehide",t(this,Y)),n(this,y,true)):f.error(`${this.querySelectorable} is not a valid reference to a HTMLVideoElement.`),this)}demonitor(){t(this,y)&&(h(this,l,se).call(this),h(this,l,Te).call(this),h(this,l,U).call(this),h(this,l,E).call(this),h(this,l,Pe).call(this),window.removeEventListener("visibilitychange",t(this,R)),window.removeEventListener("pagehide",t(this,Y)),n(this,y,false));}};a=new WeakMap;c=new WeakMap;y=new WeakMap;w=new WeakMap;C=new WeakMap;T=new WeakMap;O=new WeakMap;P=new WeakMap;k=new WeakMap;D=new WeakMap;v=new WeakMap;A=new WeakMap;le=new WeakMap;oe=new WeakMap;ce=new WeakMap;M=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;R=new WeakMap;Y=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()}};Te=function(){t(this,a)&&(t(this,a).paused||t(this,c)!=="pause"&&(t(this,v)||(h(this,l,Ee).call(this),u.flush())));};Ee=function(){t(this,a)&&t(this,c)!=="pause"&&(t(this,v)||(u.push(h(this,l,L).call(this,"pause")),n(this,c,"pause")));};Me=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);};se=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,M,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,ce))));};Se=function(){f.debug("Metrics.listeners.attach",{embed_id:this.embedId,session_id:this.sessionId});for(let i of Object.values(re))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(re))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,y)&&!t(this,a).paused&&!t(this,a).ended?n(this,k,window.requestAnimationFrame(i)):n(this,k,null);};n(this,k,window.requestAnimationFrame(i));};E=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,T)}),i.type){case "playing":if(h(this,l,F).call(this),t(this,T)){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,M,true),n(this,O,Date.now()+1500),h(this,l,N).call(this),u.flush();}n(this,T,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,M,false),h(this,l,N).call(this);break;case "pause":if(t(this,a)?.seeking){h(this,l,E).call(this);break}if(t(this,c)==="pause"){h(this,l,E).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,le)&&(r<=t(this,oe)||t(this,M))){h(this,l,$e).call(this,{...e,name:"pause"}),h(this,l,E).call(this);break}u.push({...e,name:"pause"}),n(this,c,"pause"),n(this,M,false),h(this,l,E).call(this),u.flush();break;case "ended":h(this,l,F).call(this),h(this,l,E).call(this),t(this,c)!=="pause"&&(u.push({...e,name:"pause"}),n(this,c,"pause"),u.flush());break;}};var{I:Fe}=chunkGO6BV3T4_cjs.g;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),Ve(e);}};function Ne(i){this._$AN!==void 0?(Q(this),this._$AM=i,We(this)):this._$AM=i;}function Oe(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 b=s;b<r.length;b++)V(r[b],false),Q(r[b]);else r!=null&&(V(r,false),Q(r));else V(this,i);}var Ve=i=>{i.type==chunkRRCW5BBR_cjs.a.CHILD&&(i._$AP??(i._$AP=Oe),i._$AQ??(i._$AQ=Ne));},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 ue=new WeakMap,et=chunkRRCW5BBR_cjs.b(class extends K{render(i){return chunkGO6BV3T4_cjs.f}update(i,[e]){let s=e!==this.Y;return s&&this.Y!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.Y=e,this.ht=i.options?.host,this.rt(this.ct=i.element)),chunkGO6BV3T4_cjs.f}rt(i){if(typeof this.Y=="function"){let e=this.ht??globalThis,s=ue.get(e);s===void 0&&(s=new WeakMap,ue.set(e,s)),s.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),s.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i);}else this.Y.value=i;}get lt(){return typeof this.Y=="function"?ue.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});/*! Bundled license information:
2
+
3
+ lit-html/directive-helpers.js:
4
+ lit-html/directives/ref.js:
5
+ (**
6
+ * @license
7
+ * Copyright 2020 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ *)
10
+
11
+ lit-html/async-directive.js:
12
+ (**
13
+ * @license
14
+ * Copyright 2017 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ *)
17
+ */exports.a=fe;exports.b=Re;exports.c=et;
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkPXLLLBZ3_cjs=require('./chunk-PXLLLBZ3.cjs'),chunkJUDFZS5N_cjs=require('./chunk-JUDFZS5N.cjs'),chunkWIS6FQDY_cjs=require('./chunk-WIS6FQDY.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var i,l,C,R,g,v,w,z,L,U,F,y,f=class extends chunkJUDFZS5N_cjs.a{constructor(){super(...arguments);chunkJHSFSCC2_cjs.e(this,i);this.embedController=new chunkPXLLLBZ3_cjs.b(this);}get embed(){return this._embed}set embed(e){this._embed!==e&&(this._embed=e,this.requestUpdate("embed"),this.embedController.embed=this.embed);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}render(){return chunkGO6BV3T4_cjs.c`
1
+ 'use strict';var chunkRBBM42XM_cjs=require('./chunk-RBBM42XM.cjs'),chunk42VJWULJ_cjs=require('./chunk-42VJWULJ.cjs'),chunkWIS6FQDY_cjs=require('./chunk-WIS6FQDY.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var i,l,C,R,g,v,w,z,L,U,F,y,f=class extends chunk42VJWULJ_cjs.a{constructor(){super(...arguments);chunkJHSFSCC2_cjs.e(this,i);this.embedController=new chunkRBBM42XM_cjs.b(this);}get embed(){return this._embed}set embed(e){this._embed!==e&&(this._embed=e,this.requestUpdate("embed"),this.embedController.embed=this.embed);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}render(){return chunkGO6BV3T4_cjs.c`
2
2
  ${this.embedController.render({pending:this.renderPending,complete:e=>{if(this._data=e,!e)return;let n=chunkJHSFSCC2_cjs.g(this,i,U).call(this),t=chunkJHSFSCC2_cjs.g(this,i,F).call(this),o=this._slottedChildren.map(a=>{function h(){let s;return a.nodeName==="TEMPLATE"?s=a.content.cloneNode(true):s=a.cloneNode(true),s}if(a.getAttribute("name")=="mave-files-video"){if(!n)return;let s=h(),d=Number(this._data.created_at),m=d&&d<1e12?d*1e3:d;Number.isFinite(m)&&chunkJHSFSCC2_cjs.g(this,i,l).call(this,s,"date",new Date(m).toLocaleDateString().replaceAll("/","-"));let p=this._data.video.duration;p&&chunkJHSFSCC2_cjs.g(this,i,l).call(this,s,"duration",this.durationToTime(p));let u=this._data.video.filetype;u&&chunkJHSFSCC2_cjs.g(this,i,l).call(this,s,"filetype",u);let k=n.file_size||this._data.video.size;k&&chunkJHSFSCC2_cjs.g(this,i,l).call(this,s,"size",chunkJHSFSCC2_cjs.g(this,i,v).call(this,k));let M=chunkJHSFSCC2_cjs.g(this,i,z).call(this,n),S=n.container||"mp4",b=chunkJHSFSCC2_cjs.g(this,i,g).call(this,M,`${this._data.name}.${S}`);return b.setAttribute("aria-label","Download video"),b.appendChild(s),chunkGO6BV3T4_cjs.c`${b}`}if(t&&a.getAttribute("name")=="mave-files-audio"){let s=h(),d=t.codec||chunkJHSFSCC2_cjs.g(this,i,y).call(this,t.filename)||"mp3";chunkJHSFSCC2_cjs.g(this,i,l).call(this,s,"filetype",d);let m=t.file_size;m&&chunkJHSFSCC2_cjs.g(this,i,l).call(this,s,"size",chunkJHSFSCC2_cjs.g(this,i,v).call(this,m));let p=chunkJHSFSCC2_cjs.g(this,i,L).call(this,t),u=chunkJHSFSCC2_cjs.g(this,i,g).call(this,p,t.filename||`${this._data.name}.${d}`);return u.setAttribute("aria-label","Download audio"),u.appendChild(s),chunkGO6BV3T4_cjs.c`${u}`}let _=this._data.subtitles.find(s=>s.language==this._data.video.language);if(_&&a.getAttribute("name")=="mave-files-subtitles"){let s=h();chunkJHSFSCC2_cjs.g(this,i,l).call(this,s,"filetype","vtt");let d=chunkJHSFSCC2_cjs.g(this,i,g).call(this,_.path,`${this._data.name}.vtt`);return d.setAttribute("aria-label","Download subtitles"),d.appendChild(s),chunkGO6BV3T4_cjs.c`${d}`}});return chunkGO6BV3T4_cjs.c`${this._stylesheets} ${o}`}})}
3
3
  `}renderPending(){return chunkGO6BV3T4_cjs.c`<slot style="display: none"></slot>`}};i=new WeakSet,l=function(e,n,t){let o=e.querySelector(`[slot="${n}"], [data-slot="${n}"]`);o&&(o.textContent=t,o.removeAttribute("slot"),o.removeAttribute("data-slot"));},C=function(e,n){let t=window.URL.createObjectURL(e),o=document.createElement("a");o.style.display="none",o.href=t,o.download=n,this.appendChild(o),o.click(),window.URL.revokeObjectURL(t),this.removeChild(o);},R=function(e,n){return fetch(e).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.blob()}).then(t=>chunkJHSFSCC2_cjs.g(this,i,C).call(this,t,n)).catch(t=>console.error("Something went wrong:",t))},g=function(e,n){let t=document.createElement("a");t.classList.add("link"),t.setAttribute("href",e),t.setAttribute("download",n),t.setAttribute("target","new");let o=false;return t.addEventListener("click",a=>{a.preventDefault(),!o&&(o=true,t.style.cursor="wait",t.style.opacity="0.5",chunkJHSFSCC2_cjs.g(this,i,R).call(this,e,n).then(()=>{o=false,t.style.cursor="pointer",t.style.opacity="1";}));}),t},v=function(e){let n=e/1e6;if(n<10)return `${n.toFixed(1)} MB`;let t=n%1!==0;return `${n.toFixed(t?1:0)} MB`},w=function(e){let n=this._data?.video?.version&&this._data.video.version>0?`v${this._data.video.version}/`:"";return `${this.cdn_root}/${this.embedId}/${n}${e}`},z=function(e){let n=e?.codec||"h264",t=e?.size||"hd",o=e?.container||"mp4";return chunkJHSFSCC2_cjs.g(this,i,w).call(this,`${n}_${t}.${o}`)},L=function(e){if(e?.path)return e.path;let n=e?.codec||chunkJHSFSCC2_cjs.g(this,i,y).call(this,e?.filename||"")||"mp3";return chunkJHSFSCC2_cjs.g(this,i,w).call(this,`audio.${n}`)},U=function(){let e=this._data?.video?.renditions||[];if(!e.length)return;let n=e.filter(o=>o.container==="mp4"&&o.codec==="h264"&&(!o.type||o.type==="video")),t=["hd","fhd","sd","qhd","uhd"];for(let o of t){let a=n.find(h=>h.size===o);if(a)return a}return n[0]||e.find(o=>o.type==="video")},F=function(){let e=this._data?.audio_tracks||[];if(e.length)return e.find(n=>n.default)||e[0]},y=function(e){if(!e)return;let n=e.split(".");return n.length>1?n.pop():void 0},f.styles=chunkGO6BV3T4_cjs.h`
4
4
  :host {
@@ -1,4 +1,4 @@
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`
1
+ import {b as b$2}from'./chunk-LHWG7RHD.js';import {b as b$1}from'./chunk-FLXLRYLI.js';import {a as a$1}from'./chunk-FQRZLSBE.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
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
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`
4
4
  :host {
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkAJ33W3DD_cjs=require('./chunk-AJ33W3DD.cjs'),chunkPXLLLBZ3_cjs=require('./chunk-PXLLLBZ3.cjs'),chunkJUDFZS5N_cjs=require('./chunk-JUDFZS5N.cjs'),chunkWIS6FQDY_cjs=require('./chunk-WIS6FQDY.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var n,C,b,h,f,p,u=class extends chunkJUDFZS5N_cjs.a{constructor(){super(...arguments);chunkJHSFSCC2_cjs.e(this,n);this.order="newest";this.embedController=new chunkPXLLLBZ3_cjs.b(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&&chunkAJ33W3DD_cjs.b(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(e){return this._collection?.videos?.some(o=>o.id===e)}getNextForEmbed(e){let o=chunkJHSFSCC2_cjs.g(this,n,C).call(this),t=o.findIndex(s=>s.id===e);if(t!==-1)return o[t+1]}render(){return chunkGO6BV3T4_cjs.c`
1
+ 'use strict';var chunkRIIKHYMD_cjs=require('./chunk-RIIKHYMD.cjs'),chunkRBBM42XM_cjs=require('./chunk-RBBM42XM.cjs'),chunk42VJWULJ_cjs=require('./chunk-42VJWULJ.cjs'),chunkWIS6FQDY_cjs=require('./chunk-WIS6FQDY.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var n,C,b,h,f,p,u=class extends chunk42VJWULJ_cjs.a{constructor(){super(...arguments);chunkJHSFSCC2_cjs.e(this,n);this.order="newest";this.embedController=new chunkRBBM42XM_cjs.b(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&&chunkRIIKHYMD_cjs.b(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(e){return this._collection?.videos?.some(o=>o.id===e)}getNextForEmbed(e){let o=chunkJHSFSCC2_cjs.g(this,n,C).call(this),t=o.findIndex(s=>s.id===e);if(t!==-1)return o[t+1]}render(){return chunkGO6BV3T4_cjs.c`
2
2
  ${this.embedController.render({pending:this.renderPending,error:e=>chunkGO6BV3T4_cjs.c`<p>${e instanceof Error?e.message:chunkGO6BV3T4_cjs.f}</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,chunkGO6BV3T4_cjs.c`${l}`}if(t.getAttribute("name")=="mave-list-root"&&this.embedController.embed){let l=s(),i=chunkJHSFSCC2_cjs.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="";}),chunkJHSFSCC2_cjs.g(this,n,p).call(this,i)),chunkGO6BV3T4_cjs.c`${l}`}if(t.getAttribute("name")=="mave-list-folder"){let l=this._collection.collections?.map(i=>{let a=s(),m=chunkJHSFSCC2_cjs.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;}),chunkJHSFSCC2_cjs.g(this,n,p).call(this,d));}),chunkJHSFSCC2_cjs.g(this,n,h).call(this,a,"folder-title",i.name),typeof i.video_count=="number"&&chunkJHSFSCC2_cjs.g(this,n,h).call(this,a,"folder-count",i.video_count.toString()),chunkGO6BV3T4_cjs.c`${a}`});return chunkGO6BV3T4_cjs.c`${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=chunkJHSFSCC2_cjs.g(this,n,C).call(this).map((i,a)=>{let m=s(),d=a+1;chunkJHSFSCC2_cjs.g(this,n,h).call(this,m,"item-title",i.name),chunkJHSFSCC2_cjs.g(this,n,h).call(this,m,"item-position",d.toString()),chunkJHSFSCC2_cjs.g(this,n,h).call(this,m,"item-duration",this.durationToTime(i.duration)),chunkJHSFSCC2_cjs.g(this,n,b).call(this,m,"mave-clip",i.id),chunkJHSFSCC2_cjs.g(this,n,b).call(this,m,"mave-player",i.id),chunkJHSFSCC2_cjs.g(this,n,b).call(this,m,"mave-img",i.id);let g=m.querySelector("mave-clip"),S=chunkJHSFSCC2_cjs.g(this,n,f).call(this,m,"item-title"),$=m.querySelector("mave-img");return [g,S,$,m].forEach(P=>{P?.addEventListener("click",x=>{this.emit(this.EVENT_TYPES.CLICK,{action:"show_embed",embedId:i.id,position:d});});}),chunkGO6BV3T4_cjs.c`${m}`});return chunkGO6BV3T4_cjs.c`${l}`}}).filter(t=>t);return chunkGO6BV3T4_cjs.c`${this._stylesheets} ${o}`}})}
3
3
  `}renderPending(){return chunkGO6BV3T4_cjs.c`<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),chunkJHSFSCC2_cjs.g(this,n,p).call(this,s));},h=function(e,o,t){let s=chunkJHSFSCC2_cjs.g(this,n,f).call(this,e,o);s&&(s.textContent=t,chunkJHSFSCC2_cjs.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=chunkGO6BV3T4_cjs.h`
4
4
  :host {
@@ -1,3 +1,3 @@
1
- import {a}from'./chunk-JBV2AYRP.js';var C=e=>typeof e=="function"?e:function(){return e},L=typeof self<"u"?self:null,T=typeof window<"u"?window:null,g=L||T||g,_="2.0.0",f={connecting:0,open:1,closing:2,closed:3},P=1e4,H=1e3,c={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},d={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},y={longpoll:"longpoll",websocket:"websocket"},B={complete:4},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});}},S=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));}},x=class{constructor(e,t,i){this.state=c.closed,this.topic=e,this.params=C(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=false,this.joinPush=new v(this,d.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new S(()=>{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,d.leave,C({}),this.timeout).send(),this.state=c.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.on(d.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(d.close,e);}onError(e){return this.on(d.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(d.close,"leave");},i=new v(this,d.leave,C({}),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(g.XDomainRequest){let o=new g.XDomainRequest;return this.xdomainRequest(o,e,t,s,r,n,h)}else {let o=new g.XMLHttpRequest;return this.xhrRequest(o,e,t,i,s,r,n,h)}}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){return e.open(t,i,true),e.timeout=n,e.setRequestHeader("Content-Type",s),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)}`}},$=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)},m=class{constructor(e){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=f.connecting,setTimeout(()=>this.poll(),0);}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+y.websocket),"$1/"+y.longpoll)}endpointURL(){return E.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=f.connecting;}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",false);}isActive(){return this.readyState===f.open||this.readyState===f.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:i,messages:s}=e;this.token=i;}else t=0;switch(t){case 200:s.forEach(r=>{setTimeout(()=>this.onmessage({data:r}),0);}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=f.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 ${t}`)}});}send(e){typeof e!="string"&&(e=$(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","application/x-ndjson",e.join(`
1
+ import {a}from'./chunk-ZTDQPDC6.js';var C=e=>typeof e=="function"?e:function(){return e},L=typeof self<"u"?self:null,T=typeof window<"u"?window:null,g=L||T||g,_="2.0.0",f={connecting:0,open:1,closing:2,closed:3},P=1e4,H=1e3,c={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},d={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},y={longpoll:"longpoll",websocket:"websocket"},B={complete:4},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});}},S=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));}},x=class{constructor(e,t,i){this.state=c.closed,this.topic=e,this.params=C(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=false,this.joinPush=new v(this,d.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new S(()=>{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,d.leave,C({}),this.timeout).send(),this.state=c.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.on(d.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(d.close,e);}onError(e){return this.on(d.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(d.close,"leave");},i=new v(this,d.leave,C({}),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(g.XDomainRequest){let o=new g.XDomainRequest;return this.xdomainRequest(o,e,t,s,r,n,h)}else {let o=new g.XMLHttpRequest;return this.xhrRequest(o,e,t,i,s,r,n,h)}}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){return e.open(t,i,true),e.timeout=n,e.setRequestHeader("Content-Type",s),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)}`}},$=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)},m=class{constructor(e){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=f.connecting,setTimeout(()=>this.poll(),0);}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+y.websocket),"$1/"+y.longpoll)}endpointURL(){return E.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=f.connecting;}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",false);}isActive(){return this.readyState===f.open||this.readyState===f.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:i,messages:s}=e;this.token=i;}else t=0;switch(t){case 200:s.forEach(r=>{setTimeout(()=>this.onmessage({data:r}),0);}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=f.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 ${t}`)}});}send(e){typeof e!="string"&&(e=$(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","application/x-ndjson",e.join(`
2
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=f.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 b={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,u=>a.setUint8(l++,u.charCodeAt(0))),Array.from(i,u=>a.setUint8(l++,u.charCodeAt(0))),Array.from(r,u=>a.setUint8(l++,u.charCodeAt(0))),Array.from(s,u=>a.setUint8(l++,u.charCodeAt(0)));var p=new Uint8Array(o.byteLength+n.byteLength);return p.set(new Uint8Array(o),0),p.set(new Uint8Array(n),o.byteLength),p.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 p=e.slice(h,e.byteLength);return {join_ref:o,ref:null,topic:a,event:l,payload:p}},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 p=i.decode(e.slice(o,o+n));o=o+n;let u=i.decode(e.slice(o,o+h));o=o+h;let w=e.slice(o,e.byteLength),A={status:u,response:w};return {join_ref:a,ref:l,topic:p,event:d.reply,payload:A}},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}}},j=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||P,this.transport=t.transport||g.WebSocket||m,this.primaryPassedHealthCheck=false,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||g&&g.sessionStorage,this.establishedConnections=0,this.defaultEncoder=b.encode.bind(b),this.defaultDecoder=b.decode.bind(b),this.closeWasClean=false,this.disconnecting=false,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==m?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;T&&T.addEventListener&&(T.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock);}),T.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,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=C(t.params||{}),this.endPoint=`${e}/${y.websocket}`,this.vsn=t.vsn||_,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new S(()=>{this.teardown(()=>this.connect());},this.reconnectAfterMs);}getLongPollTransport(){return m}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=C(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==m?this.connectWithFallback(m,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,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e);}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.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(),H,"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===f.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1);},150*t);}onConnClose(e){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(d.error);});}connectionState(){switch(this.conn&&this.conn.readyState){case f.connecting:return "connecting";case f.open:return "open";case f.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 x(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 R=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 j(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
3
  export{R as a};
@@ -1,4 +1,4 @@
1
- import {a}from'./chunk-E7TZALBH.js';import {h,c}from'./chunk-27BWRXCN.js';var e=class extends a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return c`<img src=${this.poster} />`}};e.styles=h`
1
+ import {a}from'./chunk-FQRZLSBE.js';import {h,c}from'./chunk-27BWRXCN.js';var e=class extends a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return c`<img src=${this.poster} />`}};e.styles=h`
2
2
  :host {
3
3
  display: block;
4
4
  }
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkJUDFZS5N_cjs=require('./chunk-JUDFZS5N.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs');var e=class extends chunkJUDFZS5N_cjs.a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return chunkGO6BV3T4_cjs.c`<img src=${this.poster} />`}};e.styles=chunkGO6BV3T4_cjs.h`
1
+ 'use strict';var chunk42VJWULJ_cjs=require('./chunk-42VJWULJ.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs');var e=class extends chunk42VJWULJ_cjs.a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return chunkGO6BV3T4_cjs.c`<img src=${this.poster} />`}};e.styles=chunkGO6BV3T4_cjs.h`
2
2
  :host {
3
3
  display: block;
4
4
  }
@@ -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;
@@ -1 +1 @@
1
- import {a as a$2}from'./chunk-F6EKAS27.js';import {a as a$1}from'./chunk-6XBQ5C3V.js';import {a as a$3}from'./chunk-JBV2AYRP.js';var c=(t=>(t[t.Collection=0]="Collection",t[t.Embed=1]="Embed",t))(c||{}),a=class{constructor(e,t=1){this.caching=true;this.loading=true;this.host=e,this.type=t,this.loading=true,this.task=new a$1(this.host,async()=>{try{if(this.type==1&&!this.embed)return;if(this.type==0&&!this.token){console.warn("No token attr provided for mave-list");return}let i=await(await fetch(this.manifest_url)).json();return this.loading=!1,this.type==1?(this._embedData=i,this.version=this._embedData.video?.version||0,this._embedData):i}catch(s){throw console.log(s),new Error(`Failed to fetch "${this.embed}"`)}},()=>[this.embed]);}get manifest_url(){if(this.type==1)return this.embedFile("manifest.json");{let e=new URL(`${a$2}/collection/${this.token}`);return this.embed&&this.embed?.length>1&&e.searchParams.append("embed",this.embed),e.toString()}}set embed(e){this._embed!=e&&(this._embed=e,this.loading=true,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$3.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}refresh(){return this.loading=true,this.task?.run()}embedFile(e,t=new URLSearchParams){let s=new URL(`${this.cdnRoot}/${this.embedId}${e=="manifest.json"?"/":this.version}${e}`);if(e.includes("?")){let[i,h]=e.split("?");new URLSearchParams(h).forEach((d,m)=>{t.append(m,d);});}return this.token&&t.append("token",this.token),e=="manifest.json"&&(t.has("e")&&t.delete("e"),t.append("e",new Date().getTime().toString())),e!=="manifest.json"&&!this.caching&&(t.has("e")||t.append("e",new Date().getTime().toString())),s.search=t.toString(),s.toString()}render(e){return this.task?.render(e)}};export{c as a,a as b};
1
+ import {a as a$2}from'./chunk-2JCNQPEK.js';import {a as a$1}from'./chunk-6XBQ5C3V.js';import {a as a$3}from'./chunk-ZTDQPDC6.js';var c=(t=>(t[t.Collection=0]="Collection",t[t.Embed=1]="Embed",t))(c||{}),a=class{constructor(e,t=1){this.caching=true;this.loading=true;this.host=e,this.type=t,this.loading=true,this.task=new a$1(this.host,async()=>{try{if(this.type==1&&!this.embed)return;if(this.type==0&&!this.token){console.warn("No token attr provided for mave-list");return}let i=await(await fetch(this.manifest_url)).json();return this.loading=!1,this.type==1?(this._embedData=i,this.version=this._embedData.video?.version||0,this._embedData):i}catch(s){throw console.log(s),new Error(`Failed to fetch "${this.embed}"`)}},()=>[this.embed]);}get manifest_url(){if(this.type==1)return this.embedFile("manifest.json");{let e=new URL(`${a$2}/collection/${this.token}`);return this.embed&&this.embed?.length>1&&e.searchParams.append("embed",this.embed),e.toString()}}set embed(e){this._embed!=e&&(this._embed=e,this.loading=true,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$3.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}refresh(){return this.loading=true,this.task?.run()}embedFile(e,t=new URLSearchParams){let s=new URL(`${this.cdnRoot}/${this.embedId}${e=="manifest.json"?"/":this.version}${e}`);if(e.includes("?")){let[i,h]=e.split("?");new URLSearchParams(h).forEach((d,m)=>{t.append(m,d);});}return this.token&&t.append("token",this.token),e=="manifest.json"&&(t.has("e")&&t.delete("e"),t.append("e",new Date().getTime().toString())),e!=="manifest.json"&&!this.caching&&(t.has("e")||t.append("e",new Date().getTime().toString())),s.search=t.toString(),s.toString()}render(e){return this.task?.render(e)}};export{c as a,a as b};
@@ -1 +1 @@
1
- import {a}from'./chunk-ZJWT7IOI.js';import {i,c as c$1}from'./chunk-27BWRXCN.js';import {a as a$1}from'./chunk-JBV2AYRP.js';import {c}from'./chunk-KA24PL7V.js';var s=class extends i{constructor(){super(...arguments);this.EVENT_TYPES={CLICK:"user_click"};}get embed(){return this._embed}set embed(t){this._embed=t;}get embedId(){return this._embed?.substring(5,this._embed?.length)}get spaceId(){return this.embed?.substring(0,5)}get cdn_root(){return a$1.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}get _stylesheets(){if(typeof document>"u")return c$1``;let t=document.querySelectorAll('style, link[rel="stylesheet"]');return c$1`${Array.from(t).map(e=>e.cloneNode(true))}`}durationToTime(t){let e=Math.floor(t),n=Math.floor(e/3600),i=Math.floor(e%3600/60),o=e%60;return n>0?`${n}:${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${i}:${o.toString().padStart(2,"0")}`}emit(t,e){this.dispatchEvent(new CustomEvent(`mave:${t}`,{detail:{...e,eventType:t}})),this.dispatchEvent(new CustomEvent("mave:*",{detail:{...e,eventType:t}}));}};c([a({type:String})],s.prototype,"embed",1);export{s as a};
1
+ import {a}from'./chunk-ZJWT7IOI.js';import {i,c as c$1}from'./chunk-27BWRXCN.js';import {a as a$1}from'./chunk-ZTDQPDC6.js';import {c}from'./chunk-KA24PL7V.js';var s=class extends i{constructor(){super(...arguments);this.EVENT_TYPES={CLICK:"user_click"};}get embed(){return this._embed}set embed(t){this._embed=t;}get embedId(){return this._embed?.substring(5,this._embed?.length)}get spaceId(){return this.embed?.substring(0,5)}get cdn_root(){return a$1.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}get _stylesheets(){if(typeof document>"u")return c$1``;let t=document.querySelectorAll('style, link[rel="stylesheet"]');return c$1`${Array.from(t).map(e=>e.cloneNode(true))}`}durationToTime(t){let e=Math.floor(t),n=Math.floor(e/3600),i=Math.floor(e%3600/60),o=e%60;return n>0?`${n}:${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${i}:${o.toString().padStart(2,"0")}`}emit(t,e){this.dispatchEvent(new CustomEvent(`mave:${t}`,{detail:{...e,eventType:t}})),this.dispatchEvent(new CustomEvent("mave:*",{detail:{...e,eventType:t}}));}};c([a({type:String})],s.prototype,"embed",1);export{s as a};
@@ -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-6XBQ5C3V.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};
@@ -1 +1 @@
1
- 'use strict';var chunkOIZ5B5LE_cjs=require('./chunk-OIZ5B5LE.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs');var p=class{constructor(e,d){this.host=e,this.embed=d,this.task=new chunkOIZ5B5LE_cjs.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 chunk5STN56TL_cjs.a.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)}};exports.a=p;
1
+ 'use strict';var chunkOIZ5B5LE_cjs=require('./chunk-OIZ5B5LE.cjs'),chunkEVKPEPYP_cjs=require('./chunk-EVKPEPYP.cjs');var p=class{constructor(e,d){this.host=e,this.embed=d,this.task=new chunkOIZ5B5LE_cjs.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 chunkEVKPEPYP_cjs.a.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)}};exports.a=p;
@@ -1,4 +1,4 @@
1
- import {a as a$2}from'./chunk-TVXCJNTZ.js';import {a as a$1}from'./chunk-M22WSPSU.js';import {c as c$1,a}from'./chunk-ZJWT7IOI.js';import {h,i,c as c$2}from'./chunk-27BWRXCN.js';import {c}from'./chunk-KA24PL7V.js';var n=class extends i{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return a$1(t)}open(t){if(this._player=t,t.aspect_ratio){let[i,s]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",i),this.style.setProperty("--frame-ratio-h",s);}this.style.display="block";let o=i=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",s=>{s.preventDefault(),this.close();},{once:true}),i(this);};return new Promise(i=>{if(this._dialog)o(i);else {let s=setInterval(()=>{this._dialog&&(o(i),clearInterval(s));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return c$2`
1
+ import {a as a$2}from'./chunk-XKFWCRVL.js';import {a as a$1}from'./chunk-M22WSPSU.js';import {c as c$1,a}from'./chunk-ZJWT7IOI.js';import {h,i,c as c$2}from'./chunk-27BWRXCN.js';import {c}from'./chunk-KA24PL7V.js';var n=class extends i{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return a$1(t)}open(t){if(this._player=t,t.aspect_ratio){let[i,s]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",i),this.style.setProperty("--frame-ratio-h",s);}this.style.display="block";let o=i=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",s=>{s.preventDefault(),this.close();},{once:true}),i(this);};return new Promise(i=>{if(this._dialog)o(i);else {let s=setInterval(()=>{this._dialog&&(o(i),clearInterval(s));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return c$2`
2
2
  <dialog style=${this.styles}>
3
3
  <div class="backdrop"></div>
4
4
  <div class="content" @click=${this.possibleClose}>
@@ -0,0 +1,37 @@
1
+ 'use strict';var chunk43KJ6TMU_cjs=require('./chunk-43KJ6TMU.cjs'),chunkSDKTBB4N_cjs=require('./chunk-SDKTBB4N.cjs'),chunkJ74VK4RB_cjs=require('./chunk-J74VK4RB.cjs'),chunkRBBM42XM_cjs=require('./chunk-RBBM42XM.cjs'),chunkWIS6FQDY_cjs=require('./chunk-WIS6FQDY.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.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 chunkGO6BV3T4_cjs.i{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 chunk43KJ6TMU_cjs.a(this,{callback:chunkJHSFSCC2_cjs.g(this,i,S).bind(this)});this.embedController=new chunkRBBM42XM_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 chunkGO6BV3T4_cjs.c`
2
+ ${this.embedController.render({complete:t=>{if(this._embed=t,!!t)return chunkGO6BV3T4_cjs.c`
3
+ <video
4
+ @click=${chunkJHSFSCC2_cjs.g(this,i,T)}
5
+ preload="metadata"
6
+ style=${chunkJ74VK4RB_cjs.a(this._failedPlay||this.autoplay==="off"?"cursor: pointer":void 0)}
7
+ muted
8
+ playsinline
9
+ poster=${chunkJ74VK4RB_cjs.a(this._failedPlay?this.poster:void 0)}
10
+ ${chunk43KJ6TMU_cjs.c(chunkJHSFSCC2_cjs.g(this,i,I))}
11
+ ?autoplay=${this.autoplay==="always"}
12
+ ?loop=${this.loop||true}
13
+ >
14
+ ${this.sources.map(s=>chunkGO6BV3T4_cjs.c`
15
+ <source
16
+ media=${chunkJ74VK4RB_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});chunk43KJ6TMU_cjs.b.config={apiEndpoint:chunkEVKPEPYP_cjs.a.metrics.endpoint},chunkEVKPEPYP_cjs.a.metrics.enabled&&(this._metricsInstance=new chunk43KJ6TMU_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=chunkGO6BV3T4_cjs.h`
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: cover;
36
+ }
37
+ `,chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],r.prototype,"embed",1),chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],r.prototype,"autoplay",2),chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],r.prototype,"quality",2),chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],r.prototype,"fallback",2),chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],r.prototype,"loop",1),chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],r.prototype,"poster",1),chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],r.prototype,"token",1),chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_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;
@@ -1,4 +1,4 @@
1
- import {b}from'./chunk-WO4HFIOO.js';import {a as a$1}from'./chunk-E7TZALBH.js';import {a}from'./chunk-ZJWT7IOI.js';import {h,c as c$1}from'./chunk-27BWRXCN.js';import {c,e,g as g$1}from'./chunk-KA24PL7V.js';var i,l,C,R,g,v,w,z,L,U,F,y,f=class extends a$1{constructor(){super(...arguments);e(this,i);this.embedController=new b(this);}get embed(){return this._embed}set embed(e){this._embed!==e&&(this._embed=e,this.requestUpdate("embed"),this.embedController.embed=this.embed);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}render(){return c$1`
1
+ import {b}from'./chunk-FLXLRYLI.js';import {a as a$1}from'./chunk-FQRZLSBE.js';import {a}from'./chunk-ZJWT7IOI.js';import {h,c as c$1}from'./chunk-27BWRXCN.js';import {c,e,g as g$1}from'./chunk-KA24PL7V.js';var i,l,C,R,g,v,w,z,L,U,F,y,f=class extends a$1{constructor(){super(...arguments);e(this,i);this.embedController=new b(this);}get embed(){return this._embed}set embed(e){this._embed!==e&&(this._embed=e,this.requestUpdate("embed"),this.embedController.embed=this.embed);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}render(){return c$1`
2
2
  ${this.embedController.render({pending:this.renderPending,complete:e=>{if(this._data=e,!e)return;let n=g$1(this,i,U).call(this),t=g$1(this,i,F).call(this),o=this._slottedChildren.map(a=>{function h(){let s;return a.nodeName==="TEMPLATE"?s=a.content.cloneNode(true):s=a.cloneNode(true),s}if(a.getAttribute("name")=="mave-files-video"){if(!n)return;let s=h(),d=Number(this._data.created_at),m=d&&d<1e12?d*1e3:d;Number.isFinite(m)&&g$1(this,i,l).call(this,s,"date",new Date(m).toLocaleDateString().replaceAll("/","-"));let p=this._data.video.duration;p&&g$1(this,i,l).call(this,s,"duration",this.durationToTime(p));let u=this._data.video.filetype;u&&g$1(this,i,l).call(this,s,"filetype",u);let k=n.file_size||this._data.video.size;k&&g$1(this,i,l).call(this,s,"size",g$1(this,i,v).call(this,k));let M=g$1(this,i,z).call(this,n),S=n.container||"mp4",b=g$1(this,i,g).call(this,M,`${this._data.name}.${S}`);return b.setAttribute("aria-label","Download video"),b.appendChild(s),c$1`${b}`}if(t&&a.getAttribute("name")=="mave-files-audio"){let s=h(),d=t.codec||g$1(this,i,y).call(this,t.filename)||"mp3";g$1(this,i,l).call(this,s,"filetype",d);let m=t.file_size;m&&g$1(this,i,l).call(this,s,"size",g$1(this,i,v).call(this,m));let p=g$1(this,i,L).call(this,t),u=g$1(this,i,g).call(this,p,t.filename||`${this._data.name}.${d}`);return u.setAttribute("aria-label","Download audio"),u.appendChild(s),c$1`${u}`}let _=this._data.subtitles.find(s=>s.language==this._data.video.language);if(_&&a.getAttribute("name")=="mave-files-subtitles"){let s=h();g$1(this,i,l).call(this,s,"filetype","vtt");let d=g$1(this,i,g).call(this,_.path,`${this._data.name}.vtt`);return d.setAttribute("aria-label","Download subtitles"),d.appendChild(s),c$1`${d}`}});return c$1`${this._stylesheets} ${o}`}})}
3
3
  `}renderPending(){return c$1`<slot style="display: none"></slot>`}};i=new WeakSet,l=function(e,n,t){let o=e.querySelector(`[slot="${n}"], [data-slot="${n}"]`);o&&(o.textContent=t,o.removeAttribute("slot"),o.removeAttribute("data-slot"));},C=function(e,n){let t=window.URL.createObjectURL(e),o=document.createElement("a");o.style.display="none",o.href=t,o.download=n,this.appendChild(o),o.click(),window.URL.revokeObjectURL(t),this.removeChild(o);},R=function(e,n){return fetch(e).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.blob()}).then(t=>g$1(this,i,C).call(this,t,n)).catch(t=>console.error("Something went wrong:",t))},g=function(e,n){let t=document.createElement("a");t.classList.add("link"),t.setAttribute("href",e),t.setAttribute("download",n),t.setAttribute("target","new");let o=false;return t.addEventListener("click",a=>{a.preventDefault(),!o&&(o=true,t.style.cursor="wait",t.style.opacity="0.5",g$1(this,i,R).call(this,e,n).then(()=>{o=false,t.style.cursor="pointer",t.style.opacity="1";}));}),t},v=function(e){let n=e/1e6;if(n<10)return `${n.toFixed(1)} MB`;let t=n%1!==0;return `${n.toFixed(t?1:0)} MB`},w=function(e){let n=this._data?.video?.version&&this._data.video.version>0?`v${this._data.video.version}/`:"";return `${this.cdn_root}/${this.embedId}/${n}${e}`},z=function(e){let n=e?.codec||"h264",t=e?.size||"hd",o=e?.container||"mp4";return g$1(this,i,w).call(this,`${n}_${t}.${o}`)},L=function(e){if(e?.path)return e.path;let n=e?.codec||g$1(this,i,y).call(this,e?.filename||"")||"mp3";return g$1(this,i,w).call(this,`audio.${n}`)},U=function(){let e=this._data?.video?.renditions||[];if(!e.length)return;let n=e.filter(o=>o.container==="mp4"&&o.codec==="h264"&&(!o.type||o.type==="video")),t=["hd","fhd","sd","qhd","uhd"];for(let o of t){let a=n.find(h=>h.size===o);if(a)return a}return n[0]||e.find(o=>o.type==="video")},F=function(){let e=this._data?.audio_tracks||[];if(e.length)return e.find(n=>n.default)||e[0]},y=function(e){if(!e)return;let n=e.split(".");return n.length>1?n.pop():void 0},f.styles=h`
4
4
  :host {
@@ -0,0 +1,17 @@
1
+ import {b,c as c$1,a as a$1}from'./chunk-MMHEOMF5.js';import {g,f as f$1}from'./chunk-27BWRXCN.js';var fe=class{constructor(e,{target:s,config:r,callback:d,skipInitial:b}){this.t=new Set,this.o=false,this.i=false,this.h=e,s!==null&&this.t.add(s??e),this.o=b??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)},ne=(i,e,s)=>e.has(i)||pe("Cannot "+s),t=(i,e,s)=>(ne(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)=>(ne(i,e,"write to private field"),e.set(i,s),s),h=(i,e,s)=>(ne(i,e,"access private method"),s),H,_e=class x{static setDebug(e){n(x,H,e);}static debugEnabled(){if(t(x,H))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){x.debugEnabled()&&(typeof s>"u"?console.debug(`[mave_data]: ${e}`):console.debug(`[mave_data]: ${e}`,s));}};H=new WeakMap;o(_e,H,false);var f=_e,q,m,I,S,ae,G,z,W,p,me,ve,$,he,ge,be,ye,we,ke,Ae,Le=class g{constructor(){if(o(this,p),o(this,q,{apiEndpoint:""}),o(this,m,[]),o(this,I,null),o(this,S,null),o(this,ae,5e3),o(this,G,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;ae=new WeakMap;G=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,ae))),t(this,m).length>=t(this,G)&&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,b=h(this,p,be).call(this,e);f.debug("Data.flush.start",{url:s,buffered:e.length,batches:b.map(_=>_.length),keepalive:r,preferBeacon:d});let B=false;n(this,W,(async()=>{for(let _ of b){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,he).call(this),B&&h(this,p,$).call(this);}));};he=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,he).call(this),n(this,m,[]),n(this,W,null);};be=function(i){let e=[],s=[],r=0;for(let d of i){let b=h(this,p,ye).call(this,d),B=r+b>t(this,z),_=s.length>=t(this,G);s.length>0&&(B||_)&&(e.push(s),s=[],r=0),s.push(d),r+=b;}return s.length>0&&e.push(s),e};ye=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=Le;function Be(){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 re=(i=>(i.PLAYING="playing",i.ENDED="ended",i.PAUSE="pause",i))(re||{}),a,c,y,w,C,T,O,P,k,D,v,A,le,oe,ce,M,J,l,U,j,X,R,Y,L,Te,Ee,Me,F,se,$e,Se,Pe,N,E,De,Re=class{constructor(...i){if(o(this,l),this.VERSION="0.1.0",o(this,a),o(this,c,null),o(this,y,false),o(this,w,false),o(this,C,null),o(this,T,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,le,750),o(this,oe,1),o(this,ce,300),o(this,M,false),o(this,J,e=>h(this,l,De).call(this,e)),o(this,j,()=>{if(!t(this,y)||!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,T,false),h(this,l,F).call(this),h(this,l,E).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,y)&&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,y)&&t(this,a)){if(t(this,c)==="play"){n(this,w,false),n(this,T,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,M,true),n(this,O,Date.now()+1500),h(this,l,N).call(this),n(this,T,false),u.flush(),n(this,w,false);}else n(this,T,true),n(this,w,false);}},200))));}),o(this,R,()=>{t(this,y)&&document.visibilityState==="hidden"&&u.flush();}),o(this,Y,e=>{if(t(this,y)){if(e.persisted){u.flush();return}h(this,l,se).call(this),h(this,l,Me).call(this),u.flushOnExit();}}),this.sessionId=Be(),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,y)?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,R)),window.addEventListener("pagehide",t(this,Y)),n(this,y,true)):f.error(`${this.querySelectorable} is not a valid reference to a HTMLVideoElement.`),this)}demonitor(){t(this,y)&&(h(this,l,se).call(this),h(this,l,Te).call(this),h(this,l,U).call(this),h(this,l,E).call(this),h(this,l,Pe).call(this),window.removeEventListener("visibilitychange",t(this,R)),window.removeEventListener("pagehide",t(this,Y)),n(this,y,false));}};a=new WeakMap;c=new WeakMap;y=new WeakMap;w=new WeakMap;C=new WeakMap;T=new WeakMap;O=new WeakMap;P=new WeakMap;k=new WeakMap;D=new WeakMap;v=new WeakMap;A=new WeakMap;le=new WeakMap;oe=new WeakMap;ce=new WeakMap;M=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;R=new WeakMap;Y=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()}};Te=function(){t(this,a)&&(t(this,a).paused||t(this,c)!=="pause"&&(t(this,v)||(h(this,l,Ee).call(this),u.flush())));};Ee=function(){t(this,a)&&t(this,c)!=="pause"&&(t(this,v)||(u.push(h(this,l,L).call(this,"pause")),n(this,c,"pause")));};Me=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);};se=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,M,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,ce))));};Se=function(){f.debug("Metrics.listeners.attach",{embed_id:this.embedId,session_id:this.sessionId});for(let i of Object.values(re))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(re))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,y)&&!t(this,a).paused&&!t(this,a).ended?n(this,k,window.requestAnimationFrame(i)):n(this,k,null);};n(this,k,window.requestAnimationFrame(i));};E=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,T)}),i.type){case "playing":if(h(this,l,F).call(this),t(this,T)){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,M,true),n(this,O,Date.now()+1500),h(this,l,N).call(this),u.flush();}n(this,T,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,M,false),h(this,l,N).call(this);break;case "pause":if(t(this,a)?.seeking){h(this,l,E).call(this);break}if(t(this,c)==="pause"){h(this,l,E).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,le)&&(r<=t(this,oe)||t(this,M))){h(this,l,$e).call(this,{...e,name:"pause"}),h(this,l,E).call(this);break}u.push({...e,name:"pause"}),n(this,c,"pause"),n(this,M,false),h(this,l,E).call(this),u.flush();break;case "ended":h(this,l,F).call(this),h(this,l,E).call(this),t(this,c)!=="pause"&&(u.push({...e,name:"pause"}),n(this,c,"pause"),u.flush());break;}};var{I:Fe}=g;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),Ve(e);}};function Ne(i){this._$AN!==void 0?(Q(this),this._$AM=i,We(this)):this._$AM=i;}function Oe(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 b=s;b<r.length;b++)V(r[b],false),Q(r[b]);else r!=null&&(V(r,false),Q(r));else V(this,i);}var Ve=i=>{i.type==a$1.CHILD&&(i._$AP??(i._$AP=Oe),i._$AQ??(i._$AQ=Ne));},K=class extends c$1{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 ue=new WeakMap,et=b(class extends K{render(i){return f$1}update(i,[e]){let s=e!==this.Y;return s&&this.Y!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.Y=e,this.ht=i.options?.host,this.rt(this.ct=i.element)),f$1}rt(i){if(typeof this.Y=="function"){let e=this.ht??globalThis,s=ue.get(e);s===void 0&&(s=new WeakMap,ue.set(e,s)),s.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),s.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i);}else this.Y.value=i;}get lt(){return typeof this.Y=="function"?ue.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});/*! Bundled license information:
2
+
3
+ lit-html/directive-helpers.js:
4
+ lit-html/directives/ref.js:
5
+ (**
6
+ * @license
7
+ * Copyright 2020 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ *)
10
+
11
+ lit-html/async-directive.js:
12
+ (**
13
+ * @license
14
+ * Copyright 2017 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ *)
17
+ */export{fe as a,Re as b,et as c};