@maveio/components 0.0.164 → 0.0.166
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.
- package/dist/chunk-27BWRXCN.js +29 -0
- package/dist/{chunk-B3QILQEE.cjs → chunk-3T573OW4.cjs} +10 -10
- package/dist/chunk-55JWHJJ5.cjs +211 -0
- package/dist/chunk-6XBQ5C3V.js +17 -0
- package/dist/{chunk-SPEXAKNG.js → chunk-7MR3ZC3G.js} +1 -1
- package/dist/{chunk-R7WAA5YV.cjs → chunk-AJ33W3DD.cjs} +3 -3
- package/dist/chunk-BN4D4W23.js +20 -0
- package/dist/chunk-BS3IICLO.cjs +20 -0
- package/dist/{chunk-XLUB3ATV.js → chunk-BSJIDMTZ.js} +3 -9
- package/dist/{chunk-HKQCX6NF.js → chunk-D75M3UFL.js} +1 -1
- package/dist/chunk-D7LG2SMD.cjs +33 -0
- package/dist/{chunk-X6N2CG2U.js → chunk-E2IDHUN5.js} +1 -1
- package/dist/{chunk-24TUG5TP.js → chunk-E7TZALBH.js} +1 -1
- package/dist/{chunk-FS4URBZN.cjs → chunk-ES5FUTSE.cjs} +1 -1
- package/dist/chunk-GO6BV3T4.cjs +29 -0
- package/dist/{chunk-VQQSFP4G.cjs → chunk-HS74B6NF.cjs} +4 -4
- package/dist/{chunk-6XR2OUZW.js → chunk-HT464LCH.js} +1 -1
- package/dist/chunk-J74VK4RB.cjs +9 -0
- package/dist/{chunk-KVMGCTLR.cjs → chunk-JR7IABIG.cjs} +3 -9
- package/dist/{chunk-EOHKHSQ3.cjs → chunk-JUDFZS5N.cjs} +1 -1
- package/dist/chunk-KUPCZDOX.cjs +10 -0
- package/dist/chunk-M22WSPSU.js +9 -0
- package/dist/chunk-NB5PC42C.js +33 -0
- package/dist/{chunk-MHLFWRN3.cjs → chunk-NROHM3YR.cjs} +21 -22
- package/dist/chunk-O2WRWRDO.cjs +9 -0
- package/dist/chunk-OIZ5B5LE.cjs +17 -0
- package/dist/{chunk-YT56YDUY.cjs → chunk-PXLLLBZ3.cjs} +1 -1
- package/dist/{chunk-CHHWULL2.js → chunk-PZSV3LCB.js} +1 -1
- package/dist/{chunk-MLZIA6JO.cjs → chunk-QLCBHFAG.cjs} +9 -9
- package/dist/{chunk-ZWTODZDA.js → chunk-SF36AD3G.js} +1 -1
- package/dist/chunk-TSTFPNEM.js +211 -0
- package/dist/{chunk-WKYQVBXK.js → chunk-TVXCJNTZ.js} +7 -8
- package/dist/{chunk-FUBUUA7Y.cjs → chunk-WIS6FQDY.cjs} +2 -50
- package/dist/{chunk-HX6F65VL.js → chunk-WO4HFIOO.js} +1 -1
- package/dist/{chunk-QJHVSRHC.cjs → chunk-YKO34INI.cjs} +1 -1
- package/dist/{chunk-HMISRRKC.js → chunk-ZJWT7IOI.js} +2 -50
- package/dist/{chunk-QSQE5WBN.js → chunk-ZUM5T3HV.js} +1 -1
- package/dist/{chunk-3R7TX6NC.js → chunk-ZZBI6DXY.js} +1 -1
- package/dist/components/clip.cjs +1 -1
- package/dist/components/clip.js +1 -1
- package/dist/components/files.cjs +1 -1
- package/dist/components/files.js +1 -1
- package/dist/components/img.cjs +1 -1
- package/dist/components/img.js +1 -1
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/player.cjs +1 -1
- package/dist/components/player.js +1 -1
- package/dist/components/pop.cjs +1 -1
- package/dist/components/pop.js +1 -1
- package/dist/components/text.cjs +1 -1
- package/dist/components/text.js +1 -1
- package/dist/components/upload.cjs +1 -1
- package/dist/components/upload.js +1 -1
- package/dist/embed/api.d.cts +1 -1
- package/dist/embed/api.d.ts +1 -1
- package/dist/embed/caption.cjs +1 -1
- package/dist/embed/caption.js +1 -1
- package/dist/embed/controller.cjs +1 -1
- package/dist/embed/controller.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/themes/default.cjs +1 -0
- package/dist/themes/default.js +1 -0
- package/dist/themes/dolphin.cjs +1 -0
- package/dist/themes/dolphin.js +1 -0
- package/dist/themes/loader.cjs +1 -1
- package/dist/themes/loader.js +1 -1
- package/dist/themes/synthwave.cjs +1 -0
- package/dist/themes/synthwave.js +1 -0
- package/dist/utils/localization.cjs +1 -1
- package/dist/utils/localization.js +1 -1
- package/dist/utils/mave_element.cjs +1 -1
- package/dist/utils/mave_element.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-5NSCV6C2.cjs +0 -53
- package/dist/chunk-7ZRXZY5C.js +0 -20
- package/dist/chunk-A4GZBQEB.js +0 -53
- package/dist/chunk-H57FX4I6.cjs +0 -9
- package/dist/chunk-LCTGZL3L.js +0 -23
- package/dist/chunk-LG2O4WV2.cjs +0 -23
- package/dist/chunk-MPAP64ZM.js +0 -213
- package/dist/chunk-MS5NFI3Q.js +0 -9
- package/dist/chunk-MSWONVA7.cjs +0 -20
- package/dist/chunk-OJEB4F36.cjs +0 -213
- package/dist/chunk-PECDDGPS.js +0 -93
- package/dist/chunk-Q22T22LT.cjs +0 -9
- package/dist/chunk-SQUDVIWI.cjs +0 -93
- package/dist/chunk-ZLS57S3I.cjs +0 -10
|
@@ -0,0 +1,20 @@
|
|
|
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`
|
|
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
|
+
`}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
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
--link-color: #006fc6;
|
|
7
|
+
--link-decoration: underline;
|
|
8
|
+
--link-decoration-thickness: 1px;
|
|
9
|
+
--link-decoration-offset: 1px;
|
|
10
|
+
--link-cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
a {
|
|
14
|
+
text-decoration: var(--link-decoration);
|
|
15
|
+
text-decoration-thickness: var(--link-decoration-thickness);
|
|
16
|
+
text-underline-offset: var(--link-decoration-thickness);
|
|
17
|
+
color: var(--link-color);
|
|
18
|
+
cursor: var(--link-cursor);
|
|
19
|
+
}
|
|
20
|
+
`,c([a({type:String})],f.prototype,"embed",1);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-files")||window.customElements.define("mave-files",f));export{f as a};
|
|
@@ -0,0 +1,20 @@
|
|
|
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`
|
|
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
|
+
`}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
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
--link-color: #006fc6;
|
|
7
|
+
--link-decoration: underline;
|
|
8
|
+
--link-decoration-thickness: 1px;
|
|
9
|
+
--link-decoration-offset: 1px;
|
|
10
|
+
--link-cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
a {
|
|
14
|
+
text-decoration: var(--link-decoration);
|
|
15
|
+
text-decoration-thickness: var(--link-decoration-thickness);
|
|
16
|
+
text-underline-offset: var(--link-decoration-thickness);
|
|
17
|
+
color: var(--link-color);
|
|
18
|
+
cursor: var(--link-cursor);
|
|
19
|
+
}
|
|
20
|
+
`,chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a({type:String})],f.prototype,"embed",1);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-files")||window.customElements.define("mave-files",f));exports.a=f;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {b,c,a as a$1}from'./chunk-MMHEOMF5.js';import {g,f}from'./chunk-
|
|
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,s){for(let n of this.reqs)n.abort();this.readyState=g.closed;let i=Object.assign({code:1e3,reason:void 0,wasClean:true},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",i)):this.onclose(i);}ajax(e,t,s,i,n){let r,a=()=>{this.reqs.delete(r),i();};r=x.request(e,this.endpointURL(),t,s,this.timeout,a,o=>{this.reqs.delete(r),this.isActive()&&n(o);}),this.reqs.add(r);}},D={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 s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,r,a]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:r,payload:a})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:r}=e,a=this.META_LENGTH+t.length+s.length+n.length+i.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),l=new DataView(o),f=0;l.setUint8(f++,this.KINDS.push),l.setUint8(f++,t.length),l.setUint8(f++,s.length),l.setUint8(f++,n.length),l.setUint8(f++,i.length),Array.from(t,b=>l.setUint8(f++,b.charCodeAt(0))),Array.from(s,b=>l.setUint8(f++,b.charCodeAt(0))),Array.from(n,b=>l.setUint8(f++,b.charCodeAt(0))),Array.from(i,b=>l.setUint8(f++,b.charCodeAt(0)));var T=new Uint8Array(o.byteLength+r.byteLength);return T.set(new Uint8Array(o),0),T.set(new Uint8Array(r),o.byteLength),T.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=s.decode(e.slice(a,a+i));a=a+i;let l=s.decode(e.slice(a,a+n));a=a+n;let f=s.decode(e.slice(a,a+r));a=a+r;let T=e.slice(a,e.byteLength);return {join_ref:o,ref:null,topic:l,event:f,payload:T}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(o,o+i));o=o+i;let f=s.decode(e.slice(o,o+n));o=o+n;let T=s.decode(e.slice(o,o+r));o=o+r;let b=s.decode(e.slice(o,o+a));o=o+a;let ge=e.slice(o,e.byteLength),be={status:b,response:ge};return {join_ref:l,ref:f,topic:T,event:v.reply,payload:be}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),r=this.HEADER_LENGTH+2,a=s.decode(e.slice(r,r+i));r=r+i;let o=s.decode(e.slice(r,r+n));r=r+n;let l=e.slice(r,e.byteLength);return {join_ref:null,ref:null,topic:a,event:o,payload:l}}},He=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||je,this.transport=t.transport||E.WebSocket||_,this.primaryPassedHealthCheck=false,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||E&&E.sessionStorage,this.establishedConnections=0,this.defaultEncoder=D.encode.bind(D),this.defaultDecoder=D.decode.bind(D),this.closeWasClean=false,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==_?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;R&&R.addEventListener&&(R.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),s=this.connectClock);}),R.addEventListener("pageshow",i=>{s===this.connectClock&&(s=null,this.connect());})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=i=>t.rejoinAfterMs?t.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>t.reconnectAfterMs?t.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(i,n,r)=>{console.log(`${i}: ${n}`,r);}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=H(t.params||{}),this.endPoint=`${e}/${z.websocket}`,this.vsn=t.vsn||$e,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new ce(()=>{this.teardown(()=>this.connect());},this.reconnectAfterMs);}getLongPollTransport(){return _}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=x.appendParams(x.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,s){this.connectClock++,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,s);}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=H(e)),!this.conn&&(this.longPollFallbackMs&&this.transport!==_?this.connectWithFallback(_,this.longPollFallbackMs):this.transportConnect());}log(e,t,s){this.logger&&this.logger(e,t,s);}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(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s));});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 s=false,i=true,n,r,a=o=>{this.log("transport",`falling back to ${e.name}...`,o),this.off([n,r]),i=false,this.replaceTransport(e),this.transportConnect();};if(this.getSession(`phx:fallback:${e.name}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),r=this.onError(o=>{this.log("transport","error",o),i&&!s&&(clearTimeout(this.fallbackTimer),a(o));}),this.onOpen(()=>{if(s=true,!i)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,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.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(),_e,"heartbeat timeout"));}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs));}teardown(e,t,s){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,s||""):this.conn.close()),this.waitForSocketClosed(()=>{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===g.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(([,s])=>s(e));}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,s=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(e,t,s);}),(t===this.transport||s>0)&&this.triggerChanError();}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(v.error);});}connectionState(){switch(this.conn&&this.conn.readyState){case g.connecting:return "connecting";case g.open:return "open";case g.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(([s])=>e.indexOf(s)===-1);}channel(e,t={}){let s=new Se(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:r}=e;this.log("push",`${t} ${s} (${r}, ${n})`,i);}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:s,event:i,payload:n,ref:r,join_ref:a}=t;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${n.status||""} ${s} ${i} ${r&&"("+r+")"||""}`,n);for(let o=0;o<this.channels.length;o++){let l=this.channels[o];l.isMember(s,i,n,a)&&l.trigger(i,n,r,a);}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,l]=this.stateChangeCallbacks.message[o];l(t);}});}leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s.isJoined()||s.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave());}};function Le(){return crypto.getRandomValues(new Uint8Array(21)).reduce((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t<63?"_":"-","")}var y,S,$,O,B,j,c=class{constructor(){d(this,y,void 0),d(this,S,void 0),d(this,$,void 0),d(this,O,false),d(this,B,false),d(this,j,new Map);}static set config(e){c.instance||(c.instance=new c),p(c.instance,S,e.socketPath),p(c.instance,$,e.apiKey);}static connect(){if(c.instance||(c.instance=new c),!h(c.instance,$)&&!h(c.instance,B)&&(console.warn("[metrics]: Set apiKey using `Metrics.config = {apiKey: 'your_key'}`"),p(c.instance,B,true)),!h(c.instance,S)&&!h(c.instance,O)&&(console.warn("[metrics]: Set path using `Metrics.config = {socketPath: 'ws://localhost:3000/socket`}"),p(c.instance,O,true)),!h(c.instance,y)&&window){let e=t=>[1e3,5e3,1e4][t-1]||25e3;p(c.instance,y,new He(h(c.instance,S)||"ws://localhost:3000/socket",{params:{source_url:`${window.location.protocol}//${window.location.host}${window.location.pathname}`,key:h(c.instance,$)},reconnectAfterMs:e,rejoinAfterMs:e})),h(c.instance,y).connect();}return h(c.instance,y)}static startSession(e,t){let s=h(c.instance,j).get(e);if(s)return s;let i=h(c.instance,y).channel(`session:${Le()}`,{...t,source_url:window.location.href,key:h(c.instance,$)});return h(c.instance,j).set(e,i),i.join(),i}static stopSession(e){let t=h(c.instance,j).get(e);t&&(t.leave(),h(c.instance,j).delete(e));}},I=c;y=new WeakMap,S=new WeakMap,$=new WeakMap,O=new WeakMap,B=new WeakMap,j=new WeakMap;var ae=class{static log(e){console.log(`[mave_metrics]: ${e}`);}static error(e){console.error(`[mave_metrics]: ${e}`);}},X=(e=>(e.DURATIONCHANGE="durationchange",e.LOADEDMETADATA="loadedmetadata",e.TIMEUPDATE="timeupdate",e.LOADEDDATA="loadeddata",e.CANPLAY="canplay",e.CANPLAYTHROUGH="canplaythrough",e.SEEKING="seeking",e.SEEKED="seeked",e.RATECHANGE="ratechange",e.VOLUMECHANGE="volumechange",e.PLAYING="playing",e.ENDED="ended",e.PLAY="play",e.PAUSE="pause",e.ERROR="error",e))(X||{}),u,A,C,k,Q,M,Z,le,ee,ue,te,de,N,V,U,K,Pe=class{constructor(...e){d(this,Z),d(this,ee),d(this,te),d(this,N),d(this,U),this.VERSION="0.1.5",this.timeout=1e4,d(this,u,void 0),d(this,A,void 0),d(this,C,void 0),d(this,k,null),this.bufferTimeInterval=50,this.bufferOffset=(this.bufferTimeInterval-40)/1e3,this.fullscreen=false,d(this,Q,void 0),d(this,M,false),e.length<=1?ae.error("Metrics requires at least two arguments: a querySelectorable, hls instance or HTMLMediaElement/HTMLVideoElement and a metadata object to identify your video."):(typeof e[0]=="string"&&(this.querySelectorable=e[0],this.identifier=e[1]),e[0]instanceof HTMLVideoElement||e[0]instanceof HTMLMediaElement?p(this,u,e[0]):typeof e[0]=="object"&&(this.hls=e[0]),e.length==2&&typeof e[1]=="object"?this.metadata=e[1]:this.identifier=e[1],e[2]&&(this.metadata=e[2]),e[3]&&(this.session_data=e[3]));}static set config(e){I.config=e;}monitor(){let e=this.querySelectorable?document.querySelector(this.querySelectorable):this.hls?.media;return h(this,M)?this:(e||h(this,u)?(h(this,u)||p(this,u,e),p(this,A,w(this,Z,le).call(this,h(this,u))),w(this,ee,ue).call(this),p(this,M,true)):ae.error(`${this.querySelectorable} is not a valid reference to a HTMLVideoElement.`),this)}demonitor(){h(this,M)&&(h(this,Q)?.unobserve(h(this,u)),w(this,te,de).call(this),h(this,A)&&h(this,u)&&I.stopSession(h(this,u)));}};u=new WeakMap,A=new WeakMap,C=new WeakMap,k=new WeakMap,Q=new WeakMap,M=new WeakMap,Z=new WeakSet,le=function(e){return I.connect(),I.startSession(e,{identifier:this.identifier,metadata:this.metadata,session_data:this.session_data})},ee=new WeakSet,ue=function(){for(let e of Object.values(X))h(this,u).addEventListener(e,w(this,N,V).bind(this));},te=new WeakSet,de=function(){for(let e of Object.values(X))h(this,u).removeEventListener(e,w(this,N,V).bind(this));},N=new WeakSet,V=function(e){let t={name:e.type,duration:h(this,u)?.duration};switch(e.type){case "playing":if(h(this,k)==="play")break;h(this,A)?.push("event",{...t,name:"play",from:h(this,u)?.currentTime<1?0:w(this,U,K).call(this)},this.timeout),p(this,k,"play");break;case "pause":if(h(this,u)?.readyState===4){if(h(this,k)==="pause")break;h(this,A)?.push("event",{...t,to:w(this,U,K).call(this)},this.timeout);}p(this,k,"pause");break;case "timeupdate":if(h(this,u)?.ended){p(this,C,void 0);break}if(h(this,C)&&!h(this,u).paused&&Math.abs(h(this,u)?.currentTime-h(this,C))>.5){if(h(this,k)==="pause")break;h(this,A)?.push("event",{...t,name:"pause",to:h(this,C)},this.timeout),p(this,k,"pause");}p(this,C,h(this,u)?.currentTime);break}},U=new WeakSet,K=function(){return h(this,u)?.currentTime.toFixed(2)};});var oe=class{constructor(t,{target:s,config:i,callback:n,skipInitial:r}){this.t=new Set,this.o=false,this.i=false,this.h=t,s!==null&&this.t.add(s??t),this.o=r??this.o,this.callback=n,window.IntersectionObserver?(this.u=new IntersectionObserver(a=>{let o=this.i;this.i=false,this.o&&o||(this.handleChanges(a),this.h.requestUpdate());},i),t.addController(this)):console.warn("IntersectionController error: browser does not support IntersectionObserver.");}handleChanges(t){this.value=this.callback?.(t,this.u);}hostConnected(){for(let t of this.t)this.observe(t);}hostDisconnected(){this.disconnect();}async hostUpdated(){let t=this.u.takeRecords();t.length&&this.handleChanges(t);}observe(t){this.t.add(t),this.u.observe(t),this.i=true;}unobserve(t){this.t.delete(t),this.u.unobserve(t);}disconnect(){this.u.disconnect();}};var{I:Xe}=g;var fe=e=>e.strings===void 0;var L=(e,t)=>{let s=e._$AN;if(s===void 0)return false;for(let i of s)i._$AO?.(t,false),L(i,t);return true},W=e=>{let t,s;do{if((t=e._$AM)===void 0)break;s=t._$AN,s.delete(e),e=t;}while(s?.size===0)},me=e=>{for(let t;t=e._$AM;e=t){let s=t._$AN;if(s===void 0)t._$AN=s=new Set;else if(s.has(e))break;s.add(e),Ne(t);}};function Oe(e){this._$AN!==void 0?(W(this),this._$AM=e,me(this)):this._$AM=e;}function Be(e,t=false,s=0){let i=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(i))for(let r=s;r<i.length;r++)L(i[r],false),W(i[r]);else i!=null&&(L(i,false),W(i));else L(this,e);}var Ne=e=>{e.type==a$1.CHILD&&(e._$AP??(e._$AP=Be),e._$AQ??(e._$AQ=Oe));},q=class extends c{constructor(){super(...arguments),this._$AN=void 0;}_$AT(t,s,i){super._$AT(t,s,i),me(this),this.isConnected=t._$AU;}_$AO(t,s=true){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),s&&(L(this,t),W(this));}setValue(t){if(fe(this._$Ct))this._$Ct._$AI(t,this);else {let s=[...this._$Ct._$AH];s[this._$Ci]=t,this._$Ct._$AI(s,this,0);}}disconnected(){}reconnected(){}};var ne=new WeakMap,ot=b(class extends q{render(e){return f}update(e,[t]){let s=t!==this.Y;return s&&this.Y!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),f}rt(e){if(typeof this.Y=="function"){let t=this.ht??globalThis,s=ne.get(t);s===void 0&&(s=new WeakMap,ne.set(t,s)),s.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),s.set(this.Y,e),e!==void 0&&this.Y.call(this.ht,e);}else this.Y.value=e;}get lt(){return typeof this.Y=="function"?ne.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:
|
|
1
|
+
import {b,c,a as a$1}from'./chunk-MMHEOMF5.js';import {g,f}from'./chunk-27BWRXCN.js';import {a}from'./chunk-KA24PL7V.js';var De=a((xe,pe)=>{var se=Object.defineProperty,ke=Object.getOwnPropertyDescriptor,Te=Object.getOwnPropertyNames,ye=Object.prototype.hasOwnProperty,Ce=(e,t)=>{for(var s in t)se(e,s,{get:t[s],enumerable:true});},we=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Te(t))!ye.call(e,n)&&n!==s&&se(e,n,{get:()=>t[n],enumerable:!(i=ke(t,n))||i.enumerable});return e},Ae=e=>we(se({},"__esModule",{value:true}),e),ie=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},h=(e,t,s)=>(ie(e,t,"read from private field"),s?s.call(e):t.get(e)),d=(e,t,s)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,s);},p=(e,t,s,i)=>(ie(e,t,"write to private field"),t.set(e,s),s),w=(e,t,s)=>(ie(e,t,"access private method"),s),he={};Ce(he,{Metrics:()=>Pe});pe.exports=Ae(he);var H=e=>typeof e=="function"?e:function(){return e},Ee=typeof self<"u"?self:null,R=typeof window<"u"?window:null,E=Ee||R||E,$e="2.0.0",g={connecting:0,open:1,closing:2,closed:3},je=1e4,_e=1e3,m={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},v={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},z={longpoll:"longpoll",websocket:"websocket"},Re={complete:4},P=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return {}},this.receivedResp=null,this.timeout=i,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:s}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.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});}},ce=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));}},Se=class{constructor(e,t,s){this.state=m.closed,this.topic=e,this.params=H(t||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=false,this.joinPush=new P(this,v.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new ce(()=>{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=m.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[];}),this.joinPush.receive("error",()=>{this.state=m.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=m.closed,this.socket.remove(this);}),this.onError(i=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,i),this.isJoining()&&this.joinPush.reset(),this.state=m.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 P(this,v.leave,H({}),this.timeout).send(),this.state=m.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.on(v.reply,(i,n)=>{this.trigger(this.replyEventName(n),i);});}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(v.close,e);}onError(e){return this.on(v.error,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(typeof t>"u"||t===s.ref)));}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=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 i=new P(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(v.close,"leave");},s=new P(this,v.leave,H({}),e);return s.receive("ok",()=>t()).receive("timeout",()=>t()),s.send(),this.canPush()||s.trigger("ok",{}),s}onMessage(e,t,s){return t}isMember(e,t,s,i){return this.topic!==e?false:i&&i!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),false):true}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=m.joining,this.joinPush.resend(e));}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(a=>a.event===e);for(let a=0;a<r.length;a++)r[a].callback(n,s,i||this.joinRef());}replyEventName(e){return `chan_reply_${e}`}isClosed(){return this.state===m.closed}isErrored(){return this.state===m.errored}isJoined(){return this.state===m.joined}isJoining(){return this.state===m.joining}isLeaving(){return this.state===m.leaving}},x=class{static request(e,t,s,i,n,r,a){if(E.XDomainRequest){let o=new E.XDomainRequest;return this.xdomainRequest(o,e,t,i,n,r,a)}else {let o=new E.XMLHttpRequest;return this.xhrRequest(o,e,t,s,i,n,r,a)}}static xdomainRequest(e,t,s,i,n,r,a){return e.timeout=n,e.open(t,s),e.onload=()=>{let o=this.parseJSON(e.responseText);a&&a(o);},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,r,a,o){return e.open(t,s,true),e.timeout=r,e.setRequestHeader("Content-Type",i),e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===Re.complete&&o){let l=this.parseJSON(e.responseText);o(l);}},a&&(e.ontimeout=a),e.send(n),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 s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,r=e[i];typeof r=="object"?s.push(this.serialize(r,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(r));}return s.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let s=e.match(/\?/)?"&":"?";return `${e}${s}${this.serialize(t)}`}},Me=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let n=0;n<i;n++)t+=String.fromCharCode(s[n]);return btoa(t)},_=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=g.connecting,setTimeout(()=>this.poll(),0);}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+z.websocket),"$1/"+z.longpoll)}endpointURL(){return x.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=g.connecting;}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",false);}isActive(){return this.readyState===g.open||this.readyState===g.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;this.token=s;}else t=0;switch(t){case 200:i.forEach(n=>{setTimeout(()=>this.onmessage({data:n}),0);}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=g.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=Me(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
|
+
`),()=>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,s){for(let n of this.reqs)n.abort();this.readyState=g.closed;let i=Object.assign({code:1e3,reason:void 0,wasClean:true},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",i)):this.onclose(i);}ajax(e,t,s,i,n){let r,a=()=>{this.reqs.delete(r),i();};r=x.request(e,this.endpointURL(),t,s,this.timeout,a,o=>{this.reqs.delete(r),this.isActive()&&n(o);}),this.reqs.add(r);}},D={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 s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,r,a]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:r,payload:a})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:r}=e,a=this.META_LENGTH+t.length+s.length+n.length+i.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),l=new DataView(o),f=0;l.setUint8(f++,this.KINDS.push),l.setUint8(f++,t.length),l.setUint8(f++,s.length),l.setUint8(f++,n.length),l.setUint8(f++,i.length),Array.from(t,b=>l.setUint8(f++,b.charCodeAt(0))),Array.from(s,b=>l.setUint8(f++,b.charCodeAt(0))),Array.from(n,b=>l.setUint8(f++,b.charCodeAt(0))),Array.from(i,b=>l.setUint8(f++,b.charCodeAt(0)));var T=new Uint8Array(o.byteLength+r.byteLength);return T.set(new Uint8Array(o),0),T.set(new Uint8Array(r),o.byteLength),T.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=s.decode(e.slice(a,a+i));a=a+i;let l=s.decode(e.slice(a,a+n));a=a+n;let f=s.decode(e.slice(a,a+r));a=a+r;let T=e.slice(a,e.byteLength);return {join_ref:o,ref:null,topic:l,event:f,payload:T}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(o,o+i));o=o+i;let f=s.decode(e.slice(o,o+n));o=o+n;let T=s.decode(e.slice(o,o+r));o=o+r;let b=s.decode(e.slice(o,o+a));o=o+a;let ge=e.slice(o,e.byteLength),be={status:b,response:ge};return {join_ref:l,ref:f,topic:T,event:v.reply,payload:be}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),r=this.HEADER_LENGTH+2,a=s.decode(e.slice(r,r+i));r=r+i;let o=s.decode(e.slice(r,r+n));r=r+n;let l=e.slice(r,e.byteLength);return {join_ref:null,ref:null,topic:a,event:o,payload:l}}},He=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||je,this.transport=t.transport||E.WebSocket||_,this.primaryPassedHealthCheck=false,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||E&&E.sessionStorage,this.establishedConnections=0,this.defaultEncoder=D.encode.bind(D),this.defaultDecoder=D.decode.bind(D),this.closeWasClean=false,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==_?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;R&&R.addEventListener&&(R.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),s=this.connectClock);}),R.addEventListener("pageshow",i=>{s===this.connectClock&&(s=null,this.connect());})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=i=>t.rejoinAfterMs?t.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>t.reconnectAfterMs?t.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(i,n,r)=>{console.log(`${i}: ${n}`,r);}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=H(t.params||{}),this.endPoint=`${e}/${z.websocket}`,this.vsn=t.vsn||$e,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new ce(()=>{this.teardown(()=>this.connect());},this.reconnectAfterMs);}getLongPollTransport(){return _}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=x.appendParams(x.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,s){this.connectClock++,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,s);}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=H(e)),!this.conn&&(this.longPollFallbackMs&&this.transport!==_?this.connectWithFallback(_,this.longPollFallbackMs):this.transportConnect());}log(e,t,s){this.logger&&this.logger(e,t,s);}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(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s));});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 s=false,i=true,n,r,a=o=>{this.log("transport",`falling back to ${e.name}...`,o),this.off([n,r]),i=false,this.replaceTransport(e),this.transportConnect();};if(this.getSession(`phx:fallback:${e.name}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),r=this.onError(o=>{this.log("transport","error",o),i&&!s&&(clearTimeout(this.fallbackTimer),a(o));}),this.onOpen(()=>{if(s=true,!i)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,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.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(),_e,"heartbeat timeout"));}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs));}teardown(e,t,s){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,s||""):this.conn.close()),this.waitForSocketClosed(()=>{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===g.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(([,s])=>s(e));}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,s=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(e,t,s);}),(t===this.transport||s>0)&&this.triggerChanError();}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(v.error);});}connectionState(){switch(this.conn&&this.conn.readyState){case g.connecting:return "connecting";case g.open:return "open";case g.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(([s])=>e.indexOf(s)===-1);}channel(e,t={}){let s=new Se(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:r}=e;this.log("push",`${t} ${s} (${r}, ${n})`,i);}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:s,event:i,payload:n,ref:r,join_ref:a}=t;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${n.status||""} ${s} ${i} ${r&&"("+r+")"||""}`,n);for(let o=0;o<this.channels.length;o++){let l=this.channels[o];l.isMember(s,i,n,a)&&l.trigger(i,n,r,a);}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,l]=this.stateChangeCallbacks.message[o];l(t);}});}leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s.isJoined()||s.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave());}};function Le(){return crypto.getRandomValues(new Uint8Array(21)).reduce((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t<63?"_":"-","")}var y,S,$,O,B,j,c=class{constructor(){d(this,y,void 0),d(this,S,void 0),d(this,$,void 0),d(this,O,false),d(this,B,false),d(this,j,new Map);}static set config(e){c.instance||(c.instance=new c),p(c.instance,S,e.socketPath),p(c.instance,$,e.apiKey);}static connect(){if(c.instance||(c.instance=new c),!h(c.instance,$)&&!h(c.instance,B)&&(console.warn("[metrics]: Set apiKey using `Metrics.config = {apiKey: 'your_key'}`"),p(c.instance,B,true)),!h(c.instance,S)&&!h(c.instance,O)&&(console.warn("[metrics]: Set path using `Metrics.config = {socketPath: 'ws://localhost:3000/socket`}"),p(c.instance,O,true)),!h(c.instance,y)&&window){let e=t=>[1e3,5e3,1e4][t-1]||25e3;p(c.instance,y,new He(h(c.instance,S)||"ws://localhost:3000/socket",{params:{source_url:`${window.location.protocol}//${window.location.host}${window.location.pathname}`,key:h(c.instance,$)},reconnectAfterMs:e,rejoinAfterMs:e})),h(c.instance,y).connect();}return h(c.instance,y)}static startSession(e,t){let s=h(c.instance,j).get(e);if(s)return s;let i=h(c.instance,y).channel(`session:${Le()}`,{...t,source_url:window.location.href,key:h(c.instance,$)});return h(c.instance,j).set(e,i),i.join(),i}static stopSession(e){let t=h(c.instance,j).get(e);t&&(t.leave(),h(c.instance,j).delete(e));}},I=c;y=new WeakMap,S=new WeakMap,$=new WeakMap,O=new WeakMap,B=new WeakMap,j=new WeakMap;var ae=class{static log(e){console.log(`[mave_metrics]: ${e}`);}static error(e){console.error(`[mave_metrics]: ${e}`);}},X=(e=>(e.DURATIONCHANGE="durationchange",e.LOADEDMETADATA="loadedmetadata",e.TIMEUPDATE="timeupdate",e.LOADEDDATA="loadeddata",e.CANPLAY="canplay",e.CANPLAYTHROUGH="canplaythrough",e.SEEKING="seeking",e.SEEKED="seeked",e.RATECHANGE="ratechange",e.VOLUMECHANGE="volumechange",e.PLAYING="playing",e.ENDED="ended",e.PLAY="play",e.PAUSE="pause",e.ERROR="error",e))(X||{}),u,A,C,k,Q,M,Z,le,ee,ue,te,de,N,V,U,K,Pe=class{constructor(...e){d(this,Z),d(this,ee),d(this,te),d(this,N),d(this,U),this.VERSION="0.1.5",this.timeout=1e4,d(this,u,void 0),d(this,A,void 0),d(this,C,void 0),d(this,k,null),this.bufferTimeInterval=50,this.bufferOffset=(this.bufferTimeInterval-40)/1e3,this.fullscreen=false,d(this,Q,void 0),d(this,M,false),e.length<=1?ae.error("Metrics requires at least two arguments: a querySelectorable, hls instance or HTMLMediaElement/HTMLVideoElement and a metadata object to identify your video."):(typeof e[0]=="string"&&(this.querySelectorable=e[0],this.identifier=e[1]),e[0]instanceof HTMLVideoElement||e[0]instanceof HTMLMediaElement?p(this,u,e[0]):typeof e[0]=="object"&&(this.hls=e[0]),e.length==2&&typeof e[1]=="object"?this.metadata=e[1]:this.identifier=e[1],e[2]&&(this.metadata=e[2]),e[3]&&(this.session_data=e[3]));}static set config(e){I.config=e;}monitor(){let e=this.querySelectorable?document.querySelector(this.querySelectorable):this.hls?.media;return h(this,M)?this:(e||h(this,u)?(h(this,u)||p(this,u,e),p(this,A,w(this,Z,le).call(this,h(this,u))),w(this,ee,ue).call(this),p(this,M,true)):ae.error(`${this.querySelectorable} is not a valid reference to a HTMLVideoElement.`),this)}demonitor(){h(this,M)&&(h(this,Q)?.unobserve(h(this,u)),w(this,te,de).call(this),h(this,A)&&h(this,u)&&I.stopSession(h(this,u)));}};u=new WeakMap,A=new WeakMap,C=new WeakMap,k=new WeakMap,Q=new WeakMap,M=new WeakMap,Z=new WeakSet,le=function(e){return I.connect(),I.startSession(e,{identifier:this.identifier,metadata:this.metadata,session_data:this.session_data})},ee=new WeakSet,ue=function(){for(let e of Object.values(X))h(this,u).addEventListener(e,w(this,N,V).bind(this));},te=new WeakSet,de=function(){for(let e of Object.values(X))h(this,u).removeEventListener(e,w(this,N,V).bind(this));},N=new WeakSet,V=function(e){let t={name:e.type,duration:h(this,u)?.duration};switch(e.type){case "playing":if(h(this,k)==="play")break;h(this,A)?.push("event",{...t,name:"play",from:h(this,u)?.currentTime<1?0:w(this,U,K).call(this)},this.timeout),p(this,k,"play");break;case "pause":if(h(this,u)?.readyState===4){if(h(this,k)==="pause")break;h(this,A)?.push("event",{...t,to:w(this,U,K).call(this)},this.timeout);}p(this,k,"pause");break;case "timeupdate":if(h(this,u)?.ended){p(this,C,void 0);break}if(h(this,C)&&!h(this,u).paused&&Math.abs(h(this,u)?.currentTime-h(this,C))>.5){if(h(this,k)==="pause")break;h(this,A)?.push("event",{...t,name:"pause",to:h(this,C)},this.timeout),p(this,k,"pause");}p(this,C,h(this,u)?.currentTime);break}},U=new WeakSet,K=function(){return h(this,u)?.currentTime.toFixed(2)};});var oe=class{constructor(t,{target:s,config:i,callback:n,skipInitial:r}){this.t=new Set,this.o=false,this.i=false,this.h=t,s!==null&&this.t.add(s??t),this.o=r??this.o,this.callback=n,window.IntersectionObserver?(this.u=new IntersectionObserver((a=>{let o=this.i;this.i=false,this.o&&o||(this.handleChanges(a),this.h.requestUpdate());}),i),t.addController(this)):console.warn("IntersectionController error: browser does not support IntersectionObserver.");}handleChanges(t){this.value=this.callback?.(t,this.u);}hostConnected(){for(let t of this.t)this.observe(t);}hostDisconnected(){this.disconnect();}async hostUpdated(){let t=this.u.takeRecords();t.length&&this.handleChanges(t);}observe(t){this.t.add(t),this.u.observe(t),this.i=true;}unobserve(t){this.t.delete(t),this.u.unobserve(t);}disconnect(){this.u.disconnect();}};var{I:Xe}=g;var fe=e=>e.strings===void 0;var L=(e,t)=>{let s=e._$AN;if(s===void 0)return false;for(let i of s)i._$AO?.(t,false),L(i,t);return true},W=e=>{let t,s;do{if((t=e._$AM)===void 0)break;s=t._$AN,s.delete(e),e=t;}while(s?.size===0)},me=e=>{for(let t;t=e._$AM;e=t){let s=t._$AN;if(s===void 0)t._$AN=s=new Set;else if(s.has(e))break;s.add(e),Ne(t);}};function Oe(e){this._$AN!==void 0?(W(this),this._$AM=e,me(this)):this._$AM=e;}function Be(e,t=false,s=0){let i=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(i))for(let r=s;r<i.length;r++)L(i[r],false),W(i[r]);else i!=null&&(L(i,false),W(i));else L(this,e);}var Ne=e=>{e.type==a$1.CHILD&&(e._$AP??(e._$AP=Be),e._$AQ??(e._$AQ=Oe));},q=class extends c{constructor(){super(...arguments),this._$AN=void 0;}_$AT(t,s,i){super._$AT(t,s,i),me(this),this.isConnected=t._$AU;}_$AO(t,s=true){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),s&&(L(this,t),W(this));}setValue(t){if(fe(this._$Ct))this._$Ct._$AI(t,this);else {let s=[...this._$Ct._$AH];s[this._$Ci]=t,this._$Ct._$AI(s,this,0);}}disconnected(){}reconnected(){}};var ne=new WeakMap,ot=b(class extends q{render(e){return f}update(e,[t]){let s=t!==this.Y;return s&&this.Y!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),f}rt(e){if(typeof this.Y=="function"){let t=this.ht??globalThis,s=ne.get(t);s===void 0&&(s=new WeakMap,ne.set(t,s)),s.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),s.set(this.Y,e),e!==void 0&&this.Y.call(this.ht,e);}else this.Y.value=e;}get lt(){return typeof this.Y=="function"?ne.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:
|
|
3
3
|
|
|
4
4
|
lit-html/directive-helpers.js:
|
|
5
|
+
lit-html/directives/ref.js:
|
|
5
6
|
(**
|
|
6
7
|
* @license
|
|
7
8
|
* Copyright 2020 Google LLC
|
|
@@ -14,11 +15,4 @@ lit-html/async-directive.js:
|
|
|
14
15
|
* Copyright 2017 Google LLC
|
|
15
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
17
|
*)
|
|
17
|
-
|
|
18
|
-
lit-html/directives/ref.js:
|
|
19
|
-
(**
|
|
20
|
-
* @license
|
|
21
|
-
* Copyright 2020 Google LLC
|
|
22
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*)
|
|
24
18
|
*/export{oe as a,De as b,ot as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-P6SBZPDR.js';import {i,c as c$1,h as h$1}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-P6SBZPDR.js';import {i,c as c$1,h as h$1}from'./chunk-27BWRXCN.js';var a=["default","synthwave","dolphin"],h={default:()=>import('./themes/default.js'),synthwave:()=>import('./themes/synthwave.js'),dolphin:()=>import('./themes/dolphin.js')};async function p(t){if(!a.includes(t))return;if(!!a$1()){let e=`./dist/themes/${t}.js`;return c(e)}let s=h[t];return s?s():void 0}async function c(t){return import(t)}var d=class t{constructor(){this.themes=[];}static async get(n,s){if(t.instance||(t.instance=new t),t.instance.themes.find(e=>e.name===n))return Promise.resolve(t.instance);t.instance.themes.push({name:n}),t.instance.currentTheme=n;try{if(typeof document<"u"&&!a.includes(n)){let e=document.createElement("link");e.rel="stylesheet",e.href=`${s}/${n}.css`,document.head.appendChild(e);}}catch(e){console.log("[mave-player]: theme css not loaded",e);}try{if(s&&!a.includes(n)){let{build:e}=await c(`${s}/${n}.js`);e(n,i,c$1,h$1);}else {let e=await p(n);if(e)e.build(n,i,c$1,h$1);else {let m=`./${a$1()}themes/${n}.js`,{build:u}=await c(m);u(n,i,c$1,h$1);}}}catch(e){console.log("[mave-player]: theme not loaded",e);}return Promise.resolve(t.instance)}static async external(n){t.instance||(t.instance=new t);let s=n.split("/").pop()?.replace(".js","")||"";try{if(typeof document<"u"){let e=document.createElement("link");e.rel="stylesheet",e.href=`${n.replace(".js","")}.css`,document.head.appendChild(e);}}catch(e){console.log("[mave-player]: theme css not loaded",e);}if(t.instance.themes.find(e=>e.name===s))return Promise.resolve(t.instance);t.instance.themes.push({name:s}),t.instance.currentTheme=s;try{let{build:e}=await c(n);e(s,i,c$1,h$1);}catch(e){console.log("[mave-player]: theme not loaded",e);}return Promise.resolve(t.instance)}static getTheme(){return t.instance?t.instance.currentTheme:""}};export{d as a};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';var chunkJ7OISSKU_cjs=require('./chunk-J7OISSKU.cjs');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;var M=e=>typeof e!="string"&&"strTag"in e,p=(e,t,o)=>{let n=e[0];for(let r=1;r<e.length;r++)n+=t[o?o[r-1]:r-1],n+=e[r];return n};var c=(e=>M(e)?p(e.strings,e.values):e);var d="lit-localize-status";var x=class{constructor(t){this.__litLocalizeEventHandler=o=>{o.detail.status==="ready"&&this.host.requestUpdate();},this.host=t;}hostConnected(){window.addEventListener(d,this.__litLocalizeEventHandler);}hostDisconnected(){window.removeEventListener(d,this.__litLocalizeEventHandler);}},F=e=>e.addController(new x(e)),I=F;var N=()=>(e,t)=>(e.addInitializer(I),e);var u=class{constructor(){this.settled=false,this.promise=new Promise((t,o)=>{this._resolve=t,this._reject=o;});}resolve(t){this.settled=true,this._resolve(t);}reject(t){this.settled=true,this._reject(t);}};var i=[];for(let e=0;e<256;e++)i[e]=(e>>4&15).toString(16)+(e&15).toString(16);function C(e){let t=0,o=8997,n=0,r=33826,s=0,a=40164,L=0,f=52210;for(let v=0;v<e.length;v++)o^=e.charCodeAt(v),t=o*435,n=r*435,s=a*435,L=f*435,s+=o<<8,L+=r<<8,n+=t>>>16,o=t&65535,s+=n>>>16,r=n&65535,f=L+(s>>>16)&65535,a=s&65535;return i[f>>8]+i[f&255]+i[a>>8]+i[a&255]+i[r>>8]+i[r&255]+i[o>>8]+i[o&255]}var W="",$="h",b="s";function z(e,t){return (t?$:b)+C(typeof e=="string"?e:e.join(W))}var A=new WeakMap,R=new Map;function j(e,t,o){if(e){let n=o?.id??O(t),r=e[n];if(r){if(typeof r=="string")return r;if("strTag"in r)return p(r.strings,t.values,r.values);{let s=A.get(r);return s===void 0&&(s=r.values,A.set(r,s)),{...r,values:s.map(a=>t.values[a])}}}}return c(t)}function O(e){let t=typeof e=="string"?e:e.strings,o=R.get(t);return o===void 0&&(o=z(t,typeof e!="string"&&!("strTag"in e)),R.set(t,o)),o}function _(e){window.dispatchEvent(new CustomEvent(d,{detail:e}));}var g="",E,H,h,w,P,l=new u;l.resolve();var m=0,U=e=>(S(((t,o)=>j(P,t,o))),g=H=e.sourceLocale,h=new Set(e.targetLocales),h.add(e.sourceLocale),w=e.loadLocale,{getLocale:k,setLocale:X}),k=()=>g,X=e=>{if(e===(E??g))return l.promise;if(!h||!w)throw new Error("Internal error");if(!h.has(e))throw new Error("Invalid locale code");m++;let t=m;return E=e,l.settled&&(l=new u),_({status:"loading",loadingLocale:e}),(e===H?Promise.resolve({templates:void 0}):w(e)).then(n=>{m===t&&(g=e,E=void 0,P=n.templates,_({status:"ready",readyLocale:e}),l.resolve());},n=>{m===t&&(_({status:"error",errorLocale:e,errorMessage:n.toString()}),l.reject(n));}),l.promise};exports.b=c;var V=false;function S(e){if(V)throw new Error("lit-localize can only be configured once");exports.b=e,V=true;}var G={en:()=>import('./generated/locales/en.cjs'),nl:()=>import('./generated/locales/nl.cjs'),de:()=>import('./generated/locales/de.cjs'),fr:()=>import('./generated/locales/fr.cjs')};function B(e){return G[e]}async function J(e){let t=chunkJ7OISSKU_cjs.a();if(!t)return null;try{return await import(new URL(`./${t}generated/locales/${e}.js`,(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-D7LG2SMD.cjs', document.baseURI).href))).href)}catch{return null}}var K=U({sourceLocale:"default",targetLocales:["en","nl","de","fr"],loadLocale:async e=>{let t=B(e);if(t)try{return await t()}catch(n){console.error(`[mave-player]: failed to load locale ${e}`,n);}let o=await J(e);return o||(console.log(`[mave-player]: locale not loaded for ${e}`),null)}}),y=false,D=class{constructor(t){this._onLoad=t=>{t.detail.status==="loading"?y=false:t.detail.status==="ready"&&(y=true),this.host.requestUpdate();};this.host=t,t.addController(this);}get loaded(){return y}set locale(t){this._locale!==t&&(K.setLocale(t),this.host.requestUpdate());}get locale(){return this._locale}hostConnected(){typeof window<"u"&&window.addEventListener("lit-localize-status",this._onLoad);}hostDisconnected(){typeof window<"u"&&window.removeEventListener("lit-localize-status",this._onLoad);}};/*! Bundled license information:
|
|
2
|
+
|
|
3
|
+
@lit/localize/internal/str-tag.js:
|
|
4
|
+
@lit/localize/internal/default-msg.js:
|
|
5
|
+
@lit/localize/internal/locale-status-event.js:
|
|
6
|
+
@lit/localize/internal/types.js:
|
|
7
|
+
@lit/localize/internal/localized-controller.js:
|
|
8
|
+
@lit/localize/internal/localized-decorator.js:
|
|
9
|
+
@lit/localize/internal/runtime-msg.js:
|
|
10
|
+
@lit/localize/init/runtime.js:
|
|
11
|
+
@lit/localize/init/transform.js:
|
|
12
|
+
(**
|
|
13
|
+
* @license
|
|
14
|
+
* Copyright 2021 Google LLC
|
|
15
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
+
*)
|
|
17
|
+
|
|
18
|
+
@lit/localize/internal/deferred.js:
|
|
19
|
+
@lit/localize/internal/id-generation.js:
|
|
20
|
+
@lit/localize/lit-localize.js:
|
|
21
|
+
(**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2020 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*)
|
|
26
|
+
|
|
27
|
+
@lit/localize/internal/fnv1a64.js:
|
|
28
|
+
(**
|
|
29
|
+
* @license
|
|
30
|
+
* Copyright 2014 Travis Webb
|
|
31
|
+
* SPDX-License-Identifier: MIT
|
|
32
|
+
*)
|
|
33
|
+
*/exports.a=N;exports.c=K;exports.d=D;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as b$2}from'./chunk-
|
|
1
|
+
import {b as b$2}from'./chunk-7MR3ZC3G.js';import {b as b$1}from'./chunk-WO4HFIOO.js';import {a as a$1}from'./chunk-E7TZALBH.js';import {a}from'./chunk-ZJWT7IOI.js';import {h as h$1,c as c$1,f as f$1}from'./chunk-27BWRXCN.js';import {c,e,g}from'./chunk-KA24PL7V.js';var n,C,b,h,f,p,u=class extends a$1{constructor(){super(...arguments);e(this,n);this.order="newest";this.embedController=new b$1(this,0);}connectedCallback(){super.connectedCallback(),this.embedController.token=this.token;}requestUpdate(e,o){super.requestUpdate(e,o),e==="embed"&&(this.embedController.token=this.token);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}updated(){this.shadowRoot&&b$2(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(e){return this._collection?.videos?.some(o=>o.id===e)}getNextForEmbed(e){let o=g(this,n,C).call(this),t=o.findIndex(s=>s.id===e);if(t!==-1)return o[t+1]}render(){return c$1`
|
|
2
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 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
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 +1 @@
|
|
|
1
|
-
'use strict';var chunkJ7OISSKU_cjs=require('./chunk-J7OISSKU.cjs'),
|
|
1
|
+
'use strict';var chunkJ7OISSKU_cjs=require('./chunk-J7OISSKU.cjs'),chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs');var a=["default","synthwave","dolphin"],h={default:()=>import('./themes/default.cjs'),synthwave:()=>import('./themes/synthwave.cjs'),dolphin:()=>import('./themes/dolphin.cjs')};async function p(t){if(!a.includes(t))return;if(!!chunkJ7OISSKU_cjs.a()){let e=`./dist/themes/${t}.js`;return c(e)}let s=h[t];return s?s():void 0}async function c(t){return import(t)}var d=class t{constructor(){this.themes=[];}static async get(n,s){if(t.instance||(t.instance=new t),t.instance.themes.find(e=>e.name===n))return Promise.resolve(t.instance);t.instance.themes.push({name:n}),t.instance.currentTheme=n;try{if(typeof document<"u"&&!a.includes(n)){let e=document.createElement("link");e.rel="stylesheet",e.href=`${s}/${n}.css`,document.head.appendChild(e);}}catch(e){console.log("[mave-player]: theme css not loaded",e);}try{if(s&&!a.includes(n)){let{build:e}=await c(`${s}/${n}.js`);e(n,chunkGO6BV3T4_cjs.i,chunkGO6BV3T4_cjs.c,chunkGO6BV3T4_cjs.h);}else {let e=await p(n);if(e)e.build(n,chunkGO6BV3T4_cjs.i,chunkGO6BV3T4_cjs.c,chunkGO6BV3T4_cjs.h);else {let m=`./${chunkJ7OISSKU_cjs.a()}themes/${n}.js`,{build:u}=await c(m);u(n,chunkGO6BV3T4_cjs.i,chunkGO6BV3T4_cjs.c,chunkGO6BV3T4_cjs.h);}}}catch(e){console.log("[mave-player]: theme not loaded",e);}return Promise.resolve(t.instance)}static async external(n){t.instance||(t.instance=new t);let s=n.split("/").pop()?.replace(".js","")||"";try{if(typeof document<"u"){let e=document.createElement("link");e.rel="stylesheet",e.href=`${n.replace(".js","")}.css`,document.head.appendChild(e);}}catch(e){console.log("[mave-player]: theme css not loaded",e);}if(t.instance.themes.find(e=>e.name===s))return Promise.resolve(t.instance);t.instance.themes.push({name:s}),t.instance.currentTheme=s;try{let{build:e}=await c(n);e(s,chunkGO6BV3T4_cjs.i,chunkGO6BV3T4_cjs.c,chunkGO6BV3T4_cjs.h);}catch(e){console.log("[mave-player]: theme not loaded",e);}return Promise.resolve(t.instance)}static getTheme(){return t.instance?t.instance.currentTheme:""}};exports.a=d;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';var x=globalThis,L=x.trustedTypes,rt=L?L.createPolicy("lit-html",{createHTML:r=>r}):void 0,Q="$lit$",$=`lit$${(Math.random()+"").slice(9)}$`,X="?"+$,Ut=`<${X}>`,A=document,O=()=>A.createComment(""),R=r=>r===null||typeof r!="object"&&typeof r!="function",ct=Array.isArray,pt=r=>ct(r)||typeof r?.[Symbol.iterator]=="function",G=`[
|
|
2
|
+
\f\r]`,U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ot=/-->/g,nt=/>/g,S=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ht=/'/g,at=/"/g,dt=/^(?:script|style|textarea|title)$/i,ut=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),Zt=ut(1),Ft=ut(2),E=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),lt=new WeakMap,g=A.createTreeWalker(A,129);function $t(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return rt!==void 0?rt.createHTML(t):t}var _t=(r,t)=>{let e=r.length-1,s=[],i,o=t===2?"<svg>":"",n=U;for(let d=0;d<e;d++){let h=r[d],l,p,a=-1,u=0;for(;u<h.length&&(n.lastIndex=u,p=n.exec(h),p!==null);)u=n.lastIndex,n===U?p[1]==="!--"?n=ot:p[1]!==void 0?n=nt:p[2]!==void 0?(dt.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=S):p[3]!==void 0&&(n=S):n===S?p[0]===">"?(n=i??U,a=-1):p[1]===void 0?a=-2:(a=n.lastIndex-p[2].length,l=p[1],n=p[3]===void 0?S:p[3]==='"'?at:ht):n===at||n===ht?n=S:n===ot||n===nt?n=U:(n=S,i=void 0);let f=n===S&&r[d+1].startsWith("/>")?" ":"";o+=n===U?h+Ut:a>=0?(s.push(l),h.slice(0,a)+Q+h.slice(a)+$+f):h+$+(a===-2?d:f);}return [$t(r,o+(r[e]||"<?>")+(t===2?"</svg>":"")),s]},T=class r{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0,d=t.length-1,h=this.parts,[l,p]=_t(t,e);if(this.el=r.createElement(l,s),g.currentNode=this.el.content,e===2){let a=this.el.content.firstChild;a.replaceWith(...a.childNodes);}for(;(i=g.nextNode())!==null&&h.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let a of i.getAttributeNames())if(a.endsWith(Q)){let u=p[n++],f=i.getAttribute(a).split($),k=/([.?@])?(.*)/.exec(u);h.push({type:1,index:o,name:k[2],strings:f,ctor:k[1]==="."?j:k[1]==="?"?D:k[1]==="@"?B:b}),i.removeAttribute(a);}else a.startsWith($)&&(h.push({type:6,index:o}),i.removeAttribute(a));if(dt.test(i.tagName)){let a=i.textContent.split($),u=a.length-1;if(u>0){i.textContent=L?L.emptyScript:"";for(let f=0;f<u;f++)i.append(a[f],O()),g.nextNode(),h.push({type:2,index:++o});i.append(a[u],O());}}}else if(i.nodeType===8)if(i.data===X)h.push({type:2,index:o});else {let a=-1;for(;(a=i.data.indexOf($,a+1))!==-1;)h.push({type:7,index:o}),a+=$.length-1;}o++;}}static createElement(t,e){let s=A.createElement("template");return s.innerHTML=t,s}};function v(r,t,e=r,s){if(t===E)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl,o=R(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(false),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=i:e._$Cl=i),i!==void 0&&(t=v(r,i._$AS(r,t.values),i,s)),t}var z=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??A).importNode(e,true);g.currentNode=i;let o=g.nextNode(),n=0,d=0,h=s[0];for(;h!==void 0;){if(n===h.index){let l;h.type===2?l=new w(o,o.nextSibling,this,t):h.type===1?l=new h.ctor(o,h.name,h.strings,this,t):h.type===6&&(l=new I(o,this,t)),this._$AV.push(l),h=s[++d];}n!==h?.index&&(o=g.nextNode(),n++);}return g.currentNode=A,i}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++;}},w=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=v(this,t,e),R(t)?t===c||t==null||t===""?(this._$AH!==c&&this._$AR(),this._$AH=c):t!==this._$AH&&t!==E&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):pt(t)?this.k(t):this._(t);}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t));}_(t){this._$AH!==c&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(A.createTextNode(t)),this._$AH=t;}$(t){let{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=T.createElement($t(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else {let o=new z(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o;}}_$AC(t){let e=lt.get(t.strings);return e===void 0&<.set(t.strings,e=new T(t)),e}k(t){ct(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,i=0;for(let o of t)i===e.length?e.push(s=new r(this.S(O()),this.S(O()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i);}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(false,true,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s;}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t));}},b=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=c,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=c;}_$AI(t,e=this,s,i){let o=this.strings,n=false;if(o===void 0)t=v(this,t,e,0),n=!R(t)||t!==this._$AH&&t!==E,n&&(this._$AH=t);else {let d=t,h,l;for(t=o[0],h=0;h<o.length-1;h++)l=v(this,d[s+h],e,h),l===E&&(l=this._$AH[h]),n||(n=!R(l)||l!==this._$AH[h]),l===c?t=c:t!==c&&(t+=(l??"")+o[h+1]),this._$AH[h]=l;}n&&!i&&this.j(t);}j(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}},j=class extends b{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===c?void 0:t;}},D=class extends b{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==c);}},B=class extends b{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5;}_$AI(t,e=this){if((t=v(this,t,e,0)??c)===E)return;let s=this._$AH,i=t===c&&s!==c||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==c&&(s===c||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}},I=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){v(this,t);}},Gt={P:Q,A:$,C:X,M:1,L:_t,R:z,D:pt,V:v,I:w,H:b,N:D,U:B,B:j,F:I},xt=x.litHtmlPolyfillSupport;xt?.(T,w),(x.litHtmlVersions??(x.litHtmlVersions=[])).push("3.1.2");var ft=(r,t,e)=>{let s=e?.renderBefore??t,i=s._$litPart$;if(i===void 0){let o=e?.renderBefore??null;s._$litPart$=i=new w(t.insertBefore(O(),o),o,void 0,e??{});}return i._$AI(r),i};var W=globalThis,V=W.ShadowRoot&&(W.ShadyCSS===void 0||W.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Y=Symbol(),mt=new WeakMap,M=class{constructor(t,e,s){if(this._$cssResult$=true,s!==Y)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o,e=this.t;if(V&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=mt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&mt.set(e,t));}return t}toString(){return this.cssText}},yt=r=>new M(typeof r=="string"?r:r+"",void 0,Y),Ot=(r,...t)=>{let e=r.length===1?r[0]:t.reduce(((s,i,o)=>s+(n=>{if(n._$cssResult$===true)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1]),r[0]);return new M(e,r,Y)},tt=(r,t)=>{if(V)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let s=document.createElement("style"),i=W.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s);}},q=V?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return yt(e)})(r):r;var{is:Rt,defineProperty:Tt,getOwnPropertyDescriptor:Mt,getOwnPropertyNames:Nt,getOwnPropertySymbols:Ht,getPrototypeOf:kt}=Object,m=globalThis,St=m.trustedTypes,Lt=St?St.emptyScript:"",zt=m.reactiveElementPolyfillSupport,N=(r,t)=>r,et={toAttribute(r,t){switch(t){case Boolean:r=r?Lt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r);}catch{e=null;}}return e}},At=(r,t)=>!Rt(r,t),gt={attribute:true,type:String,converter:et,reflect:false,hasChanged:At};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=gt){if(e.state&&(e.attribute=false),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Tt(this.prototype,t,i);}}static getPropertyDescriptor(t,e,s){let{get:i,set:o}=Mt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n;}};return {get(){return i?.call(this)},set(n){let d=i?.call(this);o.call(this,n),this.requestUpdate(t,d,s);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??gt}static _$Ei(){if(this.hasOwnProperty(N("elementProperties")))return;let t=kt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(N("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(N("properties"))){let e=this.properties,s=[...Nt(e),...Ht(e)];for(let i of s)this.createProperty(i,e[i]);}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,i]of e)this.elementProperties.set(s,i);}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let i of s)e.unshift(q(i));}else t!==void 0&&e.push(q(t));return e}static _$Eu(t,e){let s=e.attribute;return s===false?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t);}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return tt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,e,s){this._$AK(t,s);}_$EC(t,e){let s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===true){let o=(s.converter?.toAttribute!==void 0?s.converter:et).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null;}}_$AK(t,e){let s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:et;this._$Em=i,this[i]=n.fromAttribute(e,o.type),this._$Em=null;}}requestUpdate(t,e,s){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??At)(this[t],e))return;this.P(t,e,s);}this.isUpdatePending===false&&(this._$ES=this._$ET());}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===true&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t);}async _$ET(){this.isUpdatePending=true;try{await this._$ES;}catch(e){Promise.reject(e);}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0;}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,o]of s)o.wrapped!==true||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],o);}let t=false,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EU();}catch(s){throw t=false,this._$EU(),s}t&&this._$AE(e);}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach((e=>this._$EC(e,this[e])))),this._$EU();}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[N("elementProperties")]=new Map,_[N("finalized")]=new Map,zt?.({ReactiveElement:_}),(m.reactiveElementVersions??(m.reactiveElementVersions=[])).push("2.0.4");var P=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){var e;let t=super.createRenderRoot();return (e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ft(e,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};P._$litElement$=true,P.finalized=true,globalThis.litElementHydrateSupport?.({LitElement:P});var jt=globalThis.litElementPolyfillSupport;jt?.({LitElement:P});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");var K=globalThis,Z=K.ShadowRoot&&(K.ShadyCSS===void 0||K.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vt=Symbol(),Et=new WeakMap,J=class{constructor(t,e,s){if(this._$cssResult$=true,s!==vt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o,e=this.t;if(Z&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=Et.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Et.set(e,t));}return t}toString(){return this.cssText}},bt=r=>new J(typeof r=="string"?r:r+"",void 0,vt);var st=(r,t)=>{if(Z)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let s=document.createElement("style"),i=K.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s);}},F=Z?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return bt(e)})(r):r;var {is:Dt,defineProperty:Bt,getOwnPropertyDescriptor:It,getOwnPropertyNames:Wt,getOwnPropertySymbols:Vt,getPrototypeOf:qt}=Object,y=globalThis,Ct=y.trustedTypes,Kt=Ct?Ct.emptyScript:"",Jt=y.reactiveElementPolyfillSupport,H=(r,t)=>r,it={toAttribute(r,t){switch(t){case Boolean:r=r?Kt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r);}catch{e=null;}}return e}},Pt=(r,t)=>!Dt(r,t),wt={attribute:true,type:String,converter:it,reflect:false,hasChanged:Pt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),y.litPropertyMetadata??(y.litPropertyMetadata=new WeakMap);var C=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=wt){if(e.state&&(e.attribute=false),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Bt(this.prototype,t,i);}}static getPropertyDescriptor(t,e,s){let{get:i,set:o}=It(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n;}};return {get(){return i?.call(this)},set(n){let d=i?.call(this);o.call(this,n),this.requestUpdate(t,d,s);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??wt}static _$Ei(){if(this.hasOwnProperty(H("elementProperties")))return;let t=qt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(H("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(H("properties"))){let e=this.properties,s=[...Wt(e),...Vt(e)];for(let i of s)this.createProperty(i,e[i]);}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,i]of e)this.elementProperties.set(s,i);}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let i of s)e.unshift(F(i));}else t!==void 0&&e.push(F(t));return e}static _$Eu(t,e){let s=e.attribute;return s===false?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t);}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return st(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,e,s){this._$AK(t,s);}_$EC(t,e){let s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===true){let o=(s.converter?.toAttribute!==void 0?s.converter:it).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null;}}_$AK(t,e){let s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=s.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:it;this._$Em=i,this[i]=n.fromAttribute(e,o.type),this._$Em=null;}}requestUpdate(t,e,s){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??Pt)(this[t],e))return;this.P(t,e,s);}this.isUpdatePending===false&&(this._$ES=this._$ET());}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===true&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t);}async _$ET(){this.isUpdatePending=true;try{await this._$ES;}catch(e){Promise.reject(e);}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0;}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,o]of s)o.wrapped!==true||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],o);}let t=false,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(e)):this._$EU();}catch(s){throw t=false,this._$EU(),s}t&&this._$AE(e);}willUpdate(t){}_$AE(t){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach((e=>this._$EC(e,this[e])))),this._$EU();}updated(t){}firstUpdated(t){}};C.elementStyles=[],C.shadowRootOptions={mode:"open"},C[H("elementProperties")]=new Map,C[H("finalized")]=new Map,Jt?.({ReactiveElement:C}),(y.reactiveElementVersions??(y.reactiveElementVersions=[])).push("2.0.4");/*! Bundled license information:
|
|
4
|
+
|
|
5
|
+
lit-html/lit-html.js:
|
|
6
|
+
@lit/reactive-element/reactive-element.js:
|
|
7
|
+
lit-element/lit-element.js:
|
|
8
|
+
@lit/reactive-element/reactive-element.js:
|
|
9
|
+
(**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2017 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*)
|
|
14
|
+
|
|
15
|
+
@lit/reactive-element/css-tag.js:
|
|
16
|
+
@lit/reactive-element/css-tag.js:
|
|
17
|
+
(**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright 2019 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
+
*)
|
|
22
|
+
|
|
23
|
+
lit-html/is-server.js:
|
|
24
|
+
(**
|
|
25
|
+
* @license
|
|
26
|
+
* Copyright 2022 Google LLC
|
|
27
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
+
*)
|
|
29
|
+
*/exports.a=it;exports.b=Pt;exports.c=Zt;exports.d=Ft;exports.e=E;exports.f=c;exports.g=Gt;exports.h=Ot;exports.i=P;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
${this.embedController.render({pending:this.renderPending,error:e=>
|
|
3
|
-
`}renderPending(){return
|
|
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`
|
|
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
|
+
`}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 {
|
|
5
5
|
display: block;
|
|
6
6
|
}
|
|
7
|
-
`,chunkJHSFSCC2_cjs.c([
|
|
7
|
+
`,chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],u.prototype,"token",2),chunkJHSFSCC2_cjs.c([chunkWIS6FQDY_cjs.a()],u.prototype,"order",2);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-list")||window.customElements.define("mave-list",u));exports.a=u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
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`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';var chunkGO6BV3T4_cjs=require('./chunk-GO6BV3T4.cjs');var e=t=>t??chunkGO6BV3T4_cjs.f;/*! Bundled license information:
|
|
2
|
+
|
|
3
|
+
lit-html/directives/if-defined.js:
|
|
4
|
+
(**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2018 Google LLC
|
|
7
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
+
*)
|
|
9
|
+
*/exports.a=e;
|