liveroom-client-element 0.0.36 → 0.0.37

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.
@@ -1 +1 @@
1
- "use strict";const e="liveroom-client-element",t="0.0.36",i="module",s="./dist/main.js",o="./dist/main.cjs",n=["dist","!dist/vite.svg"],_={".":{import:"./dist/main.js",require:"./dist/main.cjs"},"./liveroom-client-element":{import:"./dist/liveroom-client-element.js",require:"./dist/liveroom-client-element.cjs"}},c={dev:"vite",build:"vite build",preview:"vite preview",format:"prettier --write .","check-format":"prettier . --check",check:"svelte-check --tsconfig ./tsconfig.json",lint:"npm run check-format && npm run check"},E={"livekit-client":"1.13.4","phx-live-state":"0.10.2"},r={"@sveltejs/vite-plugin-svelte":"2.4.6","@tsconfig/svelte":"5.0.2",prettier:"3.0.3",svelte:"4.2.1","svelte-check":"3.5.2",tslib:"2.6.2",typescript:"5.2.2",vite:"4.4.9"},l={name:e,private:!1,version:t,type:i,module:s,main:o,files:n,exports:_,scripts:c,dependencies:E,devDependencies:r},m=l.version,R="liveroom-client-element",v="_liveroom",S="_liveroom_user_name",O="_liveroom_user_color",p="liveroom-room-id",A="liveroom-user-name",d="liveroom-user-color";exports.ELEMENT_TAG=R;exports.QUERY_PARAM_KEY_ROOM_ID=v;exports.QUERY_PARAM_KEY_USER_COLOR=O;exports.QUERY_PARAM_KEY_USER_NAME=S;exports.SESSION_STORAGE_KEY_ROOM_ID=p;exports.SESSION_STORAGE_KEY_USER_COLOR=d;exports.SESSION_STORAGE_KEY_USER_NAME=A;exports.VERSION=m;
1
+ "use strict";const e="liveroom-client-element",t="0.0.37",i="module",s="./dist/main.js",o="./dist/main.cjs",n=["dist","!dist/vite.svg"],_={".":{import:"./dist/main.js",require:"./dist/main.cjs"},"./liveroom-client-element":{import:"./dist/liveroom-client-element.js",require:"./dist/liveroom-client-element.cjs"}},c={dev:"vite",build:"vite build",preview:"vite preview",format:"prettier --write .","check-format":"prettier . --check",check:"svelte-check --tsconfig ./tsconfig.json",lint:"npm run check-format && npm run check"},E={"livekit-client":"1.13.4","phx-live-state":"0.10.2"},r={"@sveltejs/vite-plugin-svelte":"2.4.6","@tsconfig/svelte":"5.0.2",prettier:"3.0.3",svelte:"4.2.1","svelte-check":"3.5.2",tslib:"2.6.2",typescript:"5.2.2",vite:"4.4.9"},l={name:e,private:!1,version:t,type:i,module:s,main:o,files:n,exports:_,scripts:c,dependencies:E,devDependencies:r},m=l.version,R="liveroom-client-element",v="_liveroom",S="_liveroom_user_name",O="_liveroom_user_color",p="liveroom-room-id",A="liveroom-user-name",d="liveroom-user-color";exports.ELEMENT_TAG=R;exports.QUERY_PARAM_KEY_ROOM_ID=v;exports.QUERY_PARAM_KEY_USER_COLOR=O;exports.QUERY_PARAM_KEY_USER_NAME=S;exports.SESSION_STORAGE_KEY_ROOM_ID=p;exports.SESSION_STORAGE_KEY_USER_COLOR=d;exports.SESSION_STORAGE_KEY_USER_NAME=A;exports.VERSION=m;
@@ -1,4 +1,4 @@
1
- const e = "liveroom-client-element", t = "0.0.36", s = "module", i = "./dist/main.js", o = "./dist/main.cjs", n = [
1
+ const e = "liveroom-client-element", t = "0.0.37", s = "module", i = "./dist/main.js", o = "./dist/main.cjs", n = [
2
2
  "dist",
3
3
  "!dist/vite.svg"
4
4
  ], c = {
@@ -1,4 +1,4 @@
1
- "use strict";var Fo=Object.defineProperty;var Bo=(i,e,t)=>e in i?Fo(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var x=(i,e,t)=>(Bo(i,typeof e!="symbol"?e+"":e,t),t);const $s=require("./constants-d9d958c9.cjs");function Gi(){}function qr(i){return i()}function qs(){return Object.create(null)}function tn(i){i.forEach(qr)}function Hr(i){return typeof i=="function"}function Jo(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function jo(i){return Object.keys(i).length===0}function Ne(i,e){i.appendChild(e)}function Vo(i,e,t){const n=$o(i);if(!n.getElementById(e)){const s=Ye("style");s.id=e,s.textContent=t,qo(n,s)}}function $o(i){if(!i)return document;const e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function qo(i,e){return Ne(i.head||i,e),e.sheet}function Nn(i,e,t){i.insertBefore(e,t||null)}function nn(i){i.parentNode&&i.parentNode.removeChild(i)}function Ye(i){return document.createElement(i)}function Hs(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Wr(i){return document.createTextNode(i)}function cn(){return Wr(" ")}function z(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Ho(i){return Array.from(i.childNodes)}function Wo(i,e){e=""+e,i.data!==e&&(i.data=e)}function hi(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}function Go(i){const e={};return i.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let zi;function Fi(i){zi=i}function Gr(){if(!zi)throw new Error("Function called outside component initialization");return zi}function zo(i){Gr().$$.on_mount.push(i)}function Ko(i){Gr().$$.on_destroy.push(i)}const mi=[],is=[];let yi=[];const Ws=[],Yo=Promise.resolve();let ns=!1;function Xo(){ns||(ns=!0,Yo.then(ii))}function ss(i){yi.push(i)}const $n=new Set;let fi=0;function ii(){if(fi!==0)return;const i=zi;do{try{for(;fi<mi.length;){const e=mi[fi];fi++,Fi(e),Qo(e.$$)}}catch(e){throw mi.length=0,fi=0,e}for(Fi(null),mi.length=0,fi=0;is.length;)is.pop()();for(let e=0;e<yi.length;e+=1){const t=yi[e];$n.has(t)||($n.add(t),t())}yi.length=0}while(mi.length);for(;Ws.length;)Ws.pop()();ns=!1,$n.clear(),Fi(i)}function Qo(i){if(i.fragment!==null){i.update(),tn(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(ss)}}function Zo(i){const e=[],t=[];yi.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),yi=e}const ec=new Set;function zr(i,e){i&&i.i&&(ec.delete(i),i.i(e))}function Gs(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function tc(i,e){i.d(1),e.delete(i.key)}function ic(i,e,t,n,s,r,a,o,c,u,d,h){let f=i.length,p=r.length,b=f;const T={};for(;b--;)T[i[b].key]=b;const w=[],_=new Map,M=new Map,Q=[];for(b=p;b--;){const q=h(s,r,b),K=t(q);let A=a.get(K);A?n&&Q.push(()=>A.p(q,e)):(A=u(K,q),A.c()),_.set(K,w[b]=A),K in T&&M.set(K,Math.abs(b-T[K]))}const j=new Set,he=new Set;function ae(q){zr(q,1),q.m(o,d),a.set(q.key,q),d=q.first,p--}for(;f&&p;){const q=w[p-1],K=i[f-1],A=q.key,F=K.key;q===K?(d=q.first,f--,p--):_.has(F)?!a.has(A)||j.has(A)?ae(q):he.has(F)?f--:M.get(A)>M.get(F)?(he.add(A),ae(q)):(j.add(F),f--):(c(K,a),f--)}for(;f--;){const q=i[f];_.has(q.key)||c(q,a)}for(;p;)ae(w[p-1]);return tn(Q),w}function nc(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ss(()=>{const r=i.$$.on_mount.map(qr).filter(Hr);i.$$.on_destroy?i.$$.on_destroy.push(...r):tn(r),i.$$.on_mount=[]}),s.forEach(ss)}function sc(i,e){const t=i.$$;t.fragment!==null&&(Zo(t.after_update),tn(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function rc(i,e){i.$$.dirty[0]===-1&&(mi.push(i),Xo(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function ac(i,e,t,n,s,r,a=null,o=[-1]){const c=zi;Fi(i);const u=i.$$={fragment:null,ctx:[],props:r,update:Gi,not_equal:s,bound:qs(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:qs(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};a&&a(u.root);let d=!1;if(u.ctx=t?t(i,e.props||{},(h,f,...p)=>{const b=p.length?p[0]:f;return u.ctx&&s(u.ctx[h],u.ctx[h]=b)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](b),d&&rc(i,h)),f}):[],u.update(),d=!0,tn(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=Ho(e.target);u.fragment&&u.fragment.l(h),h.forEach(nn)}else u.fragment&&u.fragment.c();e.intro&&zr(i.$$.fragment),nc(i,e.target,e.anchor),ii()}Fi(c)}let Kr;typeof HTMLElement=="function"&&(Kr=class extends HTMLElement{constructor(e,t,n){super();x(this,"$$ctor");x(this,"$$s");x(this,"$$c");x(this,"$$cn",!1);x(this,"$$d",{});x(this,"$$r",!1);x(this,"$$p_d",{});x(this,"$$l",{});x(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const s=this.$$c.$on(e,t);this.$$l_u.set(t,s)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){const s=this.$$l_u.get(t);s&&(s(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(r){return()=>{let a;return{c:function(){a=Ye("slot"),r!=="default"&&z(a,"name",r)},m:function(u,d){Nn(u,a,d)},d:function(u){u&&nn(a)}}}};if(await Promise.resolve(),!this.$$cn)return;const t={},n=Go(this);for(const r of this.$$s)r in n&&(t[r]=[e(r)]);for(const r of this.attributes){const a=this.$$g_p(r.name);a in this.$$d||(this.$$d[a]=pn(a,r.value,this.$$p_d,"toProp"))}this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const s=()=>{this.$$r=!0;for(const r in this.$$p_d)if(this.$$d[r]=this.$$c.$$.ctx[this.$$c.$$.props[r]],this.$$p_d[r].reflect){const a=pn(r,this.$$d[r],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,a)}this.$$r=!1};this.$$c.$$.after_update.push(s),s();for(const r in this.$$l)for(const a of this.$$l[r]){const o=this.$$c.$on(r,a);this.$$l_u.set(a,o)}this.$$l={}}}attributeChangedCallback(e,t,n){var s;this.$$r||(e=this.$$g_p(e),this.$$d[e]=pn(e,n,this.$$p_d,"toProp"),(s=this.$$c)==null||s.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function pn(i,e,t,n){var r;const s=(r=t[i])==null?void 0:r.type;if(e=s==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[i])return e;if(n==="toAttribute")switch(s){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(s){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function oc(i,e,t,n,s,r){let a=class extends Kr{constructor(){super(i,t,s),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(o=>(e[o].attribute||o).toLowerCase())}};return Object.keys(e).forEach(o=>{Object.defineProperty(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(c){var u;c=pn(o,c,e),this.$$d[o]=c,(u=this.$$c)==null||u.$set({[o]:c})}})}),n.forEach(o=>{Object.defineProperty(a.prototype,o,{get(){var c;return(c=this.$$c)==null?void 0:c[o]}})}),r&&(a=r(a)),i.element=a,a}class cc{constructor(){x(this,"$$");x(this,"$$set")}$destroy(){sc(this,1),this.$destroy=Gi}$on(e,t){if(!Hr(t))return Gi;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!jo(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const uc="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(uc);const{isArray:dc}=Array,lc=Object.keys,Ki=i=>{if(!i)return i;if(dc(i)){const e=[],t=i.length;for(let n=0;n<t;n++)e.push(Ki(i[n]));return e}else if(typeof i=="object"){const e=lc(i),t=e.length,n={};for(let s=0;s<t;s++){const r=e[s];n[r]=Ki(i[r])}return n}return i};class Ue{constructor(e){x(this,"path");x(this,"from");this.path=e}}const hc=/~1/g,fc=/~0/g,pc=/~/g,mc=/\//g;function gc(i){return i.indexOf("~")===-1?i:i.replace(hc,"/").replace(fc,"~")}function vc(i){return i.indexOf("/")===-1&&i.indexOf("~")===-1?i:i.replace(pc,"~0").replace(mc,"~1")}function yc(i){return i?i.slice(1).split("/").map(gc):[]}function G(i){return bc(i)?"":"/"+i.map(e=>vc(String(e))).join("/")}const $=i=>typeof i=="string"?yc(i):i,bc=i=>!i.length,kc=Object.prototype.hasOwnProperty;function Tc(i,e){return kc.call(i,e)}const{isArray:Yr}=Array,te=(i,e)=>{const t=e.length;if(!t)return{val:i};let n,s;for(let a=0;a<t;a++)if(n=i,s=e[a],Yr(n)){const o=n.length;if(s==="-")s=o;else if(typeof s=="string"){const c=~~s;if(""+c!==s)throw new Error("INVALID_INDEX");if(s=c,s<0)throw new Error("INVALID_INDEX")}i=n[s]}else if(typeof n=="object"&&n)i=Tc(n,s)?n[s]:void 0;else throw new Error("NOT_FOUND");return{val:i,obj:n,key:s}},sn=i=>Yr(i.obj)&&typeof i.key=="number",xn=i=>typeof i.obj=="object"&&typeof i.key=="string";class Is extends Ue{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"add"}code(){return 0}apply(t){const{val:n,key:s,obj:r}=te(t,this.path),a=Ki(this.value);if(!r)t=a;else if(typeof s=="string")r[s]=a;else{const o=r.length;if(s<o)r.splice(s,0,a);else{if(s>o)throw new Error("INVALID_INDEX");r.push(a)}}return{doc:t,old:n}}toJson(t){return{op:"add",path:G(this.path),value:this.value}}toCompact(t,n){return[n?"add":0,this.path,this.value]}encode(t){t.encodeArrayHeader(3),t.writer.u8(0),t.encodeArray(this.path),t.encodeAny(this.value)}}class Xr extends Ue{constructor(t,n){super(t);x(this,"oldValue");this.oldValue=n}op(){return"remove"}code(){return 1}apply(t){const n=te(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");return xn(n)?delete n.obj[n.key]:sn(n)?n.val!==void 0&&n.obj.splice(n.key,1):t=null,{doc:t,old:n.val}}toJson(t){const n={op:"remove",path:G(this.path)};return this.oldValue!==void 0&&(n.oldValue=this.oldValue),n}toCompact(t,n){const s=n?"remove":1;return this.oldValue===void 0?[s,this.path]:[s,this.path,this.oldValue]}encode(t,n){const s=this.oldValue!==void 0;t.encodeArrayHeader(s?3:2),t.writer.u8(1),t.encodeArray(this.path),s&&t.encodeAny(this.oldValue)}}class Sc extends Ue{constructor(t,n,s){super(t);x(this,"value");x(this,"oldValue");this.value=n,this.oldValue=s}op(){return"replace"}code(){return 2}apply(t){const n=te(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");return xn(n)?n.obj[n.key]=this.value:sn(n)?n.obj[n.key]=this.value:t=this.value,{doc:t,old:n.val}}toJson(t){const n={op:"replace",path:G(this.path),value:this.value};return this.oldValue!==void 0&&(n.oldValue=this.oldValue),n}toCompact(t,n){const s=n?"replace":2;return this.oldValue===void 0?[s,this.path,this.value]:[s,this.path,this.value,this.oldValue]}encode(t,n){const s=this.oldValue!==void 0;t.encodeArrayHeader(s?4:3),t.writer.u8(2),t.encodeArray(this.path),t.encodeAny(this.value),s&&t.encodeAny(this.oldValue)}}class Cc extends Ue{constructor(t,n){super(t);x(this,"from");this.from=n}op(){return"move"}code(){return 4}apply(t){const n=new Xr($(this.from),void 0).apply(t);return new Is(this.path,n.old).apply(n.doc)}toJson(t){return{op:"move",path:G(this.path),from:G(this.from)}}toCompact(t,n){return[n?"move":4,this.path,this.from]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(4),t.encodeArray(this.path),t.encodeArray(this.from)}}class wc extends Ue{constructor(t,n){super(t);x(this,"from");this.from=n}op(){return"copy"}code(){return 3}apply(t){const{val:n}=te(t,this.from);if(n===void 0)throw new Error("NOT_FOUND");return new Is(this.path,Ki(n)).apply(t)}toJson(t){return{op:"copy",path:G(this.path),from:G(this.from)}}toCompact(t,n){return[n?"copy":3,this.path,this.from]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(3),t.encodeArray(this.path),t.encodeArray(this.from)}}class Ce extends Ue{apply(e){if(!this.test(e))throw new Error("TEST");return{doc:e}}}const Pn=(i,e)=>{if(i===e)return!0;if(i&&e&&typeof i=="object"&&typeof e=="object"){if(i.constructor!==e.constructor)return!1;let t,n,s;if(Array.isArray(i)){if(t=i.length,t!==e.length)return!1;for(n=t;n--!==0;)if(!Pn(i[n],e[n]))return!1;return!0}if(s=Object.keys(i),t=s.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;){const r=s[n];if(!Pn(i[r],e[r]))return!1}return!0}return!1};class Ec extends Ce{constructor(t,n,s){super(t);x(this,"value");x(this,"not");this.value=n,this.not=s}op(){return"test"}code(){return 5}test(t){const{val:n}=te(t,this.path);if(n===void 0)return!!this.not;const s=Pn(n,this.value);return this.not?!s:s}toJson(t){const n={op:"test",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.not&&(n.not=this.not),n}toCompact(t,n){const s=t?this.path.slice(t.path.length):this.path,r=n?"test":5;return this.not?[r,s,this.value,1]:[r,s,this.value]}encode(t,n){t.encodeArrayHeader(this.not?4:3),t.writer.u8(5),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeAny(this.value),this.not&&t.writer.u8(1)}}class Pc extends Ue{constructor(e){super(e)}op(){return"flip"}code(){return 8}apply(e){const t=te(e,this.path);return t.obj?t.obj[t.key]=!t.val:e=!t.val,{doc:e,old:t.val}}toJson(e){return{op:"flip",path:G(this.path)}}toCompact(e,t){return[t?"flip":8,this.path]}encode(e,t){e.encodeArrayHeader(2),e.writer.u8(8),e.encodeArray(this.path)}}class Rc extends Ue{constructor(t,n){super(t);x(this,"inc");this.inc=n}op(){return"inc"}code(){return 9}apply(t){const n=te(t,this.path),s=this.inc+Number(n.val);return n.obj?n.obj[n.key]=s:t=s,{doc:t,old:n.val}}toJson(t){return{op:"inc",path:G(this.path),inc:this.inc}}toCompact(t,n){return[n?"inc":9,this.path,this.inc]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(9),t.encodeArray(this.path),t.encodeNumber(this.inc)}}class _c extends Ue{constructor(t,n,s){super(t);x(this,"pos");x(this,"str");this.pos=n,this.str=s}op(){return"str_ins"}code(){return 6}apply(t){const{val:n,key:s,obj:r}=te(t,this.path);if(typeof n!="string"){if(n!==void 0)throw new Error("NOT_A_STRING");if(this.pos!==0)throw new Error("POS")}const a=typeof n=="string"?n:"",o=Math.min(this.pos,a.length),c=a.slice(0,o),u=a.slice(o),d=c+this.str+u;return r?r[s]=d:t=d,{doc:t,old:n}}toJson(t){return{op:"str_ins",path:G(this.path),pos:this.pos,str:this.str}}toCompact(t,n){return[n?"str_ins":6,this.path,this.pos,this.str]}encode(t,n){t.encodeArrayHeader(4),t.writer.u8(6),t.encodeArray(this.path),t.encodeNumber(this.pos),t.encodeString(this.str)}}class Ic extends Ue{constructor(t,n,s,r){super(t);x(this,"pos");x(this,"str");x(this,"len");this.pos=n,this.str=s,this.len=r}op(){return"str_del"}code(){return 7}deleteLength(){return typeof this.str=="string"?this.str.length:this.len}apply(t){const{val:n,key:s,obj:r}=te(t,this.path);if(typeof n!="string")throw new Error("NOT_A_STRING");const a=n.length,o=Math.min(this.pos,n.length),c=Math.min(o,a),u=this.str!==void 0?this.str.length:this.len,d=Math.min(o+u,a),h=n.slice(0,c),f=n.substr(d),p=h+f;return r?r[s]=p:t=p,{doc:t,old:n}}toJson(t){return typeof this.str=="string"?{op:"str_del",path:G(this.path),pos:this.pos,str:this.str}:{op:"str_del",path:G(this.path),pos:this.pos,len:this.len}}toCompact(t,n){const s=n?"str_del":7;return typeof this.str=="string"?[s,this.path,this.pos,this.str]:[s,this.path,this.pos,0,this.len]}encode(t,n){const s=typeof this.str=="string";t.encodeArrayHeader(s?4:5),t.writer.u8(7),t.encodeArray(this.path),t.encodeNumber(this.pos),s?t.encodeString(this.str):(t.writer.u8(0),t.encodeNumber(this.len))}}const{isArray:Ac}=Array,rs=i=>!!i&&typeof i=="object"&&typeof i.text=="string",as=i=>!!i&&typeof i=="object"&&Ac(i.children),Oc=(i,e)=>{const t=new RegExp(i,e?"i":void 0);return n=>t.test(n)};class Lc extends Ue{constructor(t,n,s){super(t);x(this,"pos");x(this,"props");this.pos=n,this.props=s}op(){return"split"}code(){return 10}apply(t){const n=te(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");const s=this.split(n.val);return xn(n)?n.obj[n.key]=s:sn(n)?(n.obj[n.key]=s[0],n.obj.splice(n.key+1,0,s[1])):t=s,{doc:t,old:n.val}}split(t){if(typeof t=="string"){const{pos:n,props:s}=this,r=t.slice(0,n),a=t.slice(n);return s?[{...s,text:r},{...s,text:a}]:[r,a]}else if(rs(t)){const{pos:n,props:s}=this,r=t.text.slice(0,n),a=t.text.slice(n);return[{...t,...s,text:r},{...t,...s,text:a}]}else if(as(t)){const{pos:n,props:s}=this,r=t.children.slice(0,n),a=t.children.slice(n);return[{...t,...s,children:r},{...t,...s,children:a}]}else if(typeof t=="number"){const{pos:n}=this;return[n,t-n]}else return[t,t]}toJson(t){const n={op:"split",path:G(this.path),pos:this.pos};return this.props&&(n.props=this.props),n}toCompact(t,n){const s=n?"split":10;return this.props?[s,this.path,this.pos,this.props]:[s,this.path,this.pos]}encode(t,n){t.encodeArrayHeader(this.props?4:3),t.writer.u8(10),t.encodeArray(this.path),t.encodeNumber(this.pos),this.props&&t.encodeObject(this.props)}}class Nc extends Ue{constructor(t,n,s){super(t);x(this,"pos");x(this,"props");this.pos=n,this.props=s}op(){return"merge"}code(){return 11}apply(t){const n=te(t,this.path);if(!sn(n))throw new Error("INVALID_TARGET");if(n.key<=0)throw new Error("INVALID_KEY");const s=n.obj[n.key-1],r=n.obj[n.key],a=this.merge(s,r);return n.obj[n.key-1]=a,n.obj.splice(n.key,1),{doc:t,old:[s,r]}}merge(t,n){return typeof t=="string"&&typeof n=="string"||typeof t=="number"&&typeof n=="number"?t+n:rs(t)&&rs(n)?{...t,...n,text:t.text+n.text}:as(t)&&as(n)?{...t,...n,children:[...t.children,...n.children]}:[t,n]}toJson(t){const n={op:"merge",path:G(this.path),pos:this.pos};return this.props&&(n.props=this.props),n}toCompact(t,n){const s=n?"merge":11;return this.props?[s,this.path,this.pos,this.props]:[s,this.path,this.pos]}encode(t,n){t.encodeArrayHeader(this.props?4:3),t.writer.u8(11),t.encodeArray(this.path),t.encodeNumber(this.pos),this.props&&t.encodeAny(this.props)}}const{isArray:xc}=Array;class Dc extends Ue{constructor(t,n,s){super(t);x(this,"props");x(this,"deleteNull");this.props=n,this.deleteNull=s}op(){return"extend"}code(){return 12}apply(t){const n=te(t,this.path);return sn(n)?n.val!==void 0&&(n.obj[n.key]=this.extend(n.val)):xn(n)?n.obj[n.key]=this.extend(n.val):t=this.extend(t),{doc:t}}extend(t){if(xc(t)||typeof t!="object"||!t)return t;for(const[n,s]of Object.entries(this.props)){if(n==="__proto__")throw new Error("NO_PROTO");if(s===null&&this.deleteNull){delete t[n];continue}t[n]=s}return t}toJson(t){const n={op:"extend",path:G(this.path),props:this.props};return this.deleteNull&&(n.deleteNull=this.deleteNull),n}toCompact(t,n){const s=n?"extend":12;return this.deleteNull?[s,this.path,this.props,1]:[s,this.path,this.props]}encode(t,n){const{deleteNull:s}=this;t.encodeArrayHeader(s?4:3),t.writer.u8(12),t.encodeArray(this.path),t.encodeObject(this.props),s&&t.writer.u8(1)}}class Mc extends Ce{constructor(e){super(e)}op(){return"defined"}code(){return 31}test(e){const{val:t}=te(e,this.path);return t!==void 0}toJson(e){return{op:"defined",path:G(e?this.path.slice(e.path.length):this.path)}}toCompact(e,t){return[t?"defined":31,e?this.path.slice(e.path.length):this.path]}encode(e,t){e.encodeArrayHeader(2),e.writer.u8(31),e.encodeArray(t?this.path.slice(t.path.length):this.path)}}class Uc extends Ce{constructor(e){super(e)}op(){return"undefined"}code(){return 38}test(e){try{const{val:t}=te(e,this.path);return t===void 0}catch(t){if(t.message==="NOT_FOUND")return!0;throw t}}toJson(e){return{op:"undefined",path:G(e?this.path.slice(e.path.length):this.path)}}toCompact(e,t){return[t?"undefined":38,e?this.path.slice(e.path.length):this.path]}encode(e,t){e.encodeArrayHeader(2),e.writer.u8(38),e.encodeArray(t?this.path.slice(t.path.length):this.path)}}const{isArray:Fc}=Array;class Bc extends Ce{constructor(t,n){super(t);x(this,"type");this.type=n}op(){return"test_type"}code(){return 39}test(t){const{val:n}=te(t,this.path);return n===null?this.type.indexOf("null")>-1:Fc(n)?this.type.indexOf("array")>-1:this.type.indexOf(typeof n)>-1||typeof n=="number"&&n===Math.round(n)&&this.type.indexOf("integer")>-1}toJson(t){return{op:"test_type",path:G(t?this.path.slice(t.path.length):this.path),type:this.type}}toCompact(t,n){return[n?"test_type":39,t?this.path.slice(t.path.length):this.path,this.type]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(39),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeArray(this.type)}}class Jc extends Ce{constructor(t,n,s,r){super(t);x(this,"pos");x(this,"str");x(this,"not");this.pos=n,this.str=s,this.not=r}op(){return"test_string"}code(){return 40}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const s=n.length,r=Math.min(this.pos,s),a=Math.min(this.pos+this.str.length,s),o=n.substring(r,a)===this.str;return this.not?!o:o}toJson(t){const n={op:"test_string",path:G(t?this.path.slice(t.path.length):this.path),pos:this.pos,str:this.str};return this.not&&(n.not=this.not),n}toCompact(t,n){const s=n?"test_string":40,r=t?this.path.slice(t.path.length):this.path;return this.not?[s,r,this.pos,this.str,1]:[s,r,this.pos,this.str]}encode(t,n){t.encodeArrayHeader(this.not?5:4),t.writer.u8(40),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeNumber(this.pos),t.encodeString(this.str),this.not&&t.writer.u8(1)}}class jc extends Ce{constructor(t,n,s){super(t);x(this,"len");x(this,"not");this.len=n,this.not=s}op(){return"test_string_len"}code(){return 41}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const r=n.length>=this.len;return this.not?!r:r}toJson(t){const n={op:"test_string_len",path:G(t?this.path.slice(t.path.length):this.path),len:this.len};return this.not&&(n.not=this.not),n}toCompact(t,n){const s=n?"test_string_len":41,r=t?this.path.slice(t.path.length):this.path;return this.not?[s,r,this.len,1]:[s,r,this.len]}encode(t,n){t.encodeArrayHeader(this.not?4:3),t.writer.u8(41),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeNumber(this.len),this.not&&t.writer.u8(1)}}class Vc extends Ce{constructor(t,n,s){super(t);x(this,"value");x(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"contains"}code(){return 30}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const s=this.ignore_case?n.toLowerCase():n,r=this.ignore_case?this.value.toLowerCase():this.value;return s.indexOf(r)>-1}toJson(t){const n={op:"contains",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(n.ignore_case=this.ignore_case),n}toCompact(t,n){const s=n?"contains":30;return this.ignore_case?[s,t?this.path.slice(t.path.length):this.path,this.value,1]:[s,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){const s=this.ignore_case;t.encodeArrayHeader(s?4:3),t.writer.u8(30),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value),s&&t.writer.u8(1)}}class $c extends Ce{constructor(t,n,s){super(t);x(this,"value");x(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"ends"}code(){return 32}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const s=this.ignore_case?n.toLowerCase():n,r=this.ignore_case?this.value.toLowerCase():this.value;return s.endsWith(r)}toJson(t){const n={op:"ends",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(n.ignore_case=this.ignore_case),n}toCompact(t,n){const s=n?"ends":32;return this.ignore_case?[s,t?this.path.slice(t.path.length):this.path,this.value,1]:[s,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){const s=this.ignore_case;t.encodeArrayHeader(s?4:3),t.writer.u8(32),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value),s&&t.writer.u8(1)}}class qc extends Ce{constructor(t,n,s){super(t);x(this,"value");x(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"starts"}code(){return 37}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const s=this.ignore_case?n.toLowerCase():n,r=this.ignore_case?this.value.toLowerCase():this.value;return s.startsWith(r)}toJson(t){const n={op:"starts",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(n.ignore_case=this.ignore_case),n}toCompact(t,n){const s=n?"starts":37;return this.ignore_case?[s,t?this.path.slice(t.path.length):this.path,this.value,1]:[s,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){const s=this.ignore_case;t.encodeArrayHeader(s?4:3),t.writer.u8(37),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value),s&&t.writer.u8(1)}}class Hc extends Ce{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"in"}code(){return 33}test(t){const{val:n}=te(t,this.path);for(const s of this.value)if(Pn(n,s))return!0;return!1}toJson(t){return{op:"in",path:G(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,n){return[n?"in":33,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(33),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeArray(this.value)}}class Wc extends Ce{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"less"}code(){return 34}test(t){const{val:n}=te(t,this.path);return typeof n!="number"?!1:n<this.value}toJson(t){return{op:"less",path:G(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,n){return[n?"less":34,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(34),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeNumber(this.value)}}class Gc extends Ce{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"more"}code(){return 36}test(t){const{val:n}=te(t,this.path);return typeof n!="number"?!1:n>this.value}toJson(t){return{op:"more",path:G(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,n){return[n?"more":36,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(36),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeNumber(this.value)}}class As extends Ce{constructor(t,n){super(t);x(this,"ops");this.ops=n}}class zc extends As{constructor(t,n){super(t,n);x(this,"ops");this.ops=n}op(){return"and"}code(){return 43}test(t){for(const n of this.ops)if(!n.test(t))return!1;return!0}toJson(t){return{op:"and",path:G(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(s=>s.toJson(this))}}toCompact(t,n){return[n?"and":43,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,n))]}encode(t,n){const s=n?this.path.slice(n.path.length):this.path;t.encodeArrayHeader(3),t.writer.u8(43),t.encodeArray(s);const r=this.ops.length;t.encodeArrayHeader(r);for(let a=0;a<r;a++)this.ops[a].encode(t,this)}}class Kc extends As{constructor(t,n){super(t,n);x(this,"ops");this.ops=n}op(){return"or"}code(){return 45}test(t){for(const n of this.ops)if(n.test(t))return!0;return!1}toJson(t){return{op:"or",path:G(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(s=>s.toJson(this))}}toCompact(t,n){return[n?"or":45,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,n))]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(45),t.encodeArray(n?this.path.slice(n.path.length):this.path);const s=this.ops.length;t.encodeArrayHeader(s);for(let r=0;r<s;r++)this.ops[r].encode(t,this)}}class Yc extends As{constructor(t,n){super(t,n);x(this,"ops");this.ops=n}op(){return"not"}code(){return 44}test(t){for(const n of this.ops)if(n.test(t))return!1;return!0}toJson(t){return{op:"not",path:G(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(s=>s.toJson(this))}}toCompact(t,n){return[n?"not":44,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,n))]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(44),t.encodeArray(n?this.path.slice(n.path.length):this.path);const s=this.ops.length;t.encodeArrayHeader(s);for(let r=0;r<s;r++)this.ops[r].encode(t,this)}}class Xc extends Ce{constructor(t,n,s,r){super(t);x(this,"value");x(this,"ignore_case");x(this,"matcher");this.value=n,this.ignore_case=s,this.matcher=r(n,s)}op(){return"matches"}code(){return 35}test(t){const{val:n}=te(t,this.path);return typeof n!="string"?!1:this.matcher(n)}toJson(t){const n={op:"matches",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(n.ignore_case=this.ignore_case),n}toCompact(t,n){const s=n?"matches":35;return this.ignore_case?[s,t?this.path.slice(t.path.length):this.path,this.value,1]:[s,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){const s=this.ignore_case;t.encodeArrayHeader(s?4:3),t.writer.u8(35),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value),s&&t.writer.u8(1)}}const{isArray:Qc}=Array;class Zc extends Ce{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"type"}code(){return 42}test(t){const{val:n}=te(t,this.path);return n===null?this.value==="null":Qc(n)?this.value==="array":typeof n===this.value||typeof n=="number"&&n===Math.round(n)&&this.value==="integer"}toJson(t){return{op:"type",path:G(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,n){return[n?"type":42,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(42),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value)}}const eu=(i,e)=>{switch(i.op){case"add":return new Is($(i.path),i.value);case"remove":return new Xr($(i.path),i.oldValue);case"replace":return new Sc($(i.path),i.value,i.oldValue);case"move":return new Cc($(i.path),$(i.from));case"copy":return new wc($(i.path),$(i.from));case"flip":return new Pc($(i.path));case"inc":return new Rc($(i.path),i.inc);case"str_ins":return new _c($(i.path),i.pos,i.str);case"str_del":return new Ic($(i.path),i.pos,i.str,i.len);case"split":return new Lc($(i.path),i.pos,i.props||null);case"merge":return new Nc($(i.path),i.pos,i.props||null);case"extend":return new Dc($(i.path),i.props,!!i.deleteNull);default:return mn(i,e)}},mn=(i,e)=>{switch(i.op){case"test":return new Ec($(i.path),i.value,!!i.not);case"defined":return new Mc($(i.path));case"undefined":return new Uc($(i.path));case"type":return new Zc($(i.path),i.value);case"test_type":return new Bc($(i.path),i.type);case"test_string":return new Jc($(i.path),i.pos,i.str,!!i.not);case"test_string_len":return new jc($(i.path),i.len,!!i.not);case"contains":return new Vc($(i.path),i.value,!!i.ignore_case);case"ends":return new $c($(i.path),i.value,!!i.ignore_case);case"starts":return new qc($(i.path),i.value,!!i.ignore_case);case"matches":return new Xc($(i.path),i.value,!!i.ignore_case,e.createMatcher||Oc);case"in":return new Hc($(i.path),i.value);case"less":return new Wc($(i.path),i.value);case"more":return new Gc($(i.path),i.value);case"and":{const t=$(i.path);return new zc(t,i.apply.map(n=>mn({...n,path:[...t,...$(n.path)]},e)))}case"or":{const t=$(i.path);return new Kc(t,i.apply.map(n=>mn({...n,path:[...t,...$(n.path)]},e)))}case"not":{const t=$(i.path);return new Yc(t,i.apply.map(n=>mn({...n,path:[...t,...$(n.path)]},e)))}default:throw new Error("OP_UNKNOWN")}};function tu(i,e,t){t.mutate||(i=Ki(i));const n=[],s=e.length;for(let r=0;r<s;r++){const o=eu(e[r],t).apply(i);i=o.doc,n.push(o)}return{doc:i,res:n}}var Bi=i=>typeof i=="function"?i:function(){return i},iu=typeof self<"u"?self:null,Di=typeof window<"u"?window:null,Ji=iu||Di||Ji,nu="2.0.0",Xe={connecting:0,open:1,closing:2,closed:3},su=1e4,ru=1e3,Le={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},yt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},os={longpoll:"longpoll",websocket:"websocket"},au={complete:4},un=class{constructor(i,e,t,n){this.channel=i,this.event=e,this.payload=t||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(i){this.timeout=i,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(i,e){return this.hasReceived(i)&&e(this.receivedResp.response),this.recHooks.push({status:i,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:i,response:e,_ref:t}){this.recHooks.filter(n=>n.status===i).forEach(n=>n.callback(e))}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,i=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=i,this.matchReceive(i)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(i){return this.receivedResp&&this.receivedResp.status===i}trigger(i,e){this.channel.trigger(this.refEvent,{status:i,response:e})}},Qr=class{constructor(i,e){this.callback=i,this.timerCalc=e,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))}},ou=class{constructor(i,e,t){this.state=Le.closed,this.topic=i,this.params=Bi(e||{}),this.socket=t,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new un(this,yt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Qr(()=>{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=Le.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=Le.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=Le.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Le.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 un(this,yt.leave,Bi({}),this.timeout).send(),this.state=Le.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(yt.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(i=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=i,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(i){this.on(yt.close,i)}onError(i){return this.on(yt.error,e=>i(e))}on(i,e){let t=this.bindingRef++;return this.bindings.push({event:i,ref:t,callback:e}),t}off(i,e){this.bindings=this.bindings.filter(t=>!(t.event===i&&(typeof e>"u"||e===t.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(i,e,t=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${i}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new un(this,i,function(){return e},t);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(i=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Le.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(yt.close,"leave")},t=new un(this,yt.leave,Bi({}),i);return t.receive("ok",()=>e()).receive("timeout",()=>e()),t.send(),this.canPush()||t.trigger("ok",{}),t}onMessage(i,e,t){return e}isMember(i,e,t,n){return this.topic!==i?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:i,event:e,payload:t,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(i=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Le.joining,this.joinPush.resend(i))}trigger(i,e,t,n){let s=this.onMessage(i,e,t,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(a=>a.event===i);for(let a=0;a<r.length;a++)r[a].callback(s,t,n||this.joinRef())}replyEventName(i){return`chan_reply_${i}`}isClosed(){return this.state===Le.closed}isErrored(){return this.state===Le.errored}isJoined(){return this.state===Le.joined}isJoining(){return this.state===Le.joining}isLeaving(){return this.state===Le.leaving}},Rn=class{static request(i,e,t,n,s,r,a){if(Ji.XDomainRequest){let o=new Ji.XDomainRequest;return this.xdomainRequest(o,i,e,n,s,r,a)}else{let o=new Ji.XMLHttpRequest;return this.xhrRequest(o,i,e,t,n,s,r,a)}}static xdomainRequest(i,e,t,n,s,r,a){return i.timeout=s,i.open(e,t),i.onload=()=>{let o=this.parseJSON(i.responseText);a&&a(o)},r&&(i.ontimeout=r),i.onprogress=()=>{},i.send(n),i}static xhrRequest(i,e,t,n,s,r,a,o){return i.open(e,t,!0),i.timeout=r,i.setRequestHeader("Content-Type",n),i.onerror=()=>o&&o(null),i.onreadystatechange=()=>{if(i.readyState===au.complete&&o){let c=this.parseJSON(i.responseText);o(c)}},a&&(i.ontimeout=a),i.send(s),i}static parseJSON(i){if(!i||i==="")return null;try{return JSON.parse(i)}catch{return console&&console.log("failed to parse JSON response",i),null}}static serialize(i,e){let t=[];for(var n in i){if(!Object.prototype.hasOwnProperty.call(i,n))continue;let s=e?`${e}[${n}]`:n,r=i[n];typeof r=="object"?t.push(this.serialize(r,s)):t.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return t.join("&")}static appendParams(i,e){if(Object.keys(e).length===0)return i;let t=i.match(/\?/)?"&":"?";return`${i}${t}${this.serialize(e)}`}},qn=class{constructor(i){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(i),this.readyState=Xe.connecting,this.poll()}normalizeEndpoint(i){return i.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+os.websocket),"$1/"+os.longpoll)}endpointURL(){return Rn.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(i,e,t){this.close(i,e,t),this.readyState=Xe.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Xe.open||this.readyState===Xe.connecting}poll(){this.ajax("GET",null,()=>this.ontimeout(),i=>{if(i){var{status:e,token:t,messages:n}=i;this.token=t}else e=0;switch(e){case 200:n.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Xe.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${e}`)}})}send(i){this.ajax("POST",i,()=>this.onerror("timeout"),e=>{(!e||e.status!==200)&&(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(i,e,t){for(let s of this.reqs)s.abort();this.readyState=Xe.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:i,reason:e,wasClean:t});typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(i,e,t,n){let s,r=()=>{this.reqs.delete(s),t()};s=Rn.request(i,this.endpointURL(),"application/json",e,this.timeout,r,a=>{this.reqs.delete(s),this.isActive()&&n(a)}),this.reqs.add(s)}},dn={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(i,e){if(i.payload.constructor===ArrayBuffer)return e(this.binaryEncode(i));{let t=[i.join_ref,i.ref,i.topic,i.event,i.payload];return e(JSON.stringify(t))}},decode(i,e){if(i.constructor===ArrayBuffer)return e(this.binaryDecode(i));{let[t,n,s,r,a]=JSON.parse(i);return e({join_ref:t,ref:n,topic:s,event:r,payload:a})}},binaryEncode(i){let{join_ref:e,ref:t,event:n,topic:s,payload:r}=i,a=this.META_LENGTH+e.length+t.length+s.length+n.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),c=new DataView(o),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,e.length),c.setUint8(u++,t.length),c.setUint8(u++,s.length),c.setUint8(u++,n.length),Array.from(e,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(t,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(s,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(n,h=>c.setUint8(u++,h.charCodeAt(0)));var d=new Uint8Array(o.byteLength+r.byteLength);return d.set(new Uint8Array(o),0),d.set(new Uint8Array(r),o.byteLength),d.buffer},binaryDecode(i){let e=new DataView(i),t=e.getUint8(0),n=new TextDecoder;switch(t){case this.KINDS.push:return this.decodePush(i,e,n);case this.KINDS.reply:return this.decodeReply(i,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(i,e,n)}},decodePush(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=e.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=t.decode(i.slice(a,a+n));a=a+n;let c=t.decode(i.slice(a,a+s));a=a+s;let u=t.decode(i.slice(a,a+r));a=a+r;let d=i.slice(a,i.byteLength);return{join_ref:o,ref:null,topic:c,event:u,payload:d}},decodeReply(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=e.getUint8(3),a=e.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,c=t.decode(i.slice(o,o+n));o=o+n;let u=t.decode(i.slice(o,o+s));o=o+s;let d=t.decode(i.slice(o,o+r));o=o+r;let h=t.decode(i.slice(o,o+a));o=o+a;let f=i.slice(o,i.byteLength),p={status:h,response:f};return{join_ref:c,ref:u,topic:d,event:yt.reply,payload:p}},decodeBroadcast(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=this.HEADER_LENGTH+2,a=t.decode(i.slice(r,r+n));r=r+n;let o=t.decode(i.slice(r,r+s));r=r+s;let c=i.slice(r,i.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:c}}},cu=class{constructor(i,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=e.timeout||su,this.transport=e.transport||Ji.WebSocket||qn,this.establishedConnections=0,this.defaultEncoder=dn.encode.bind(dn),this.defaultDecoder=dn.decode.bind(dn),this.closeWasClean=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.transport!==qn?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let t=null;Di&&Di.addEventListener&&(Di.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),t=this.connectClock)}),Di.addEventListener("pageshow",n=>{t===this.connectClock&&(t=null,this.connect())})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.rejoinAfterMs=n=>e.rejoinAfterMs?e.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>e.reconnectAfterMs?e.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=e.logger||null,this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Bi(e.params||{}),this.endPoint=`${i}/${os.websocket}`,this.vsn=e.vsn||nu,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Qr(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return qn}replaceTransport(i){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=i}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let i=Rn.appendParams(Rn.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return i.charAt(0)!=="/"?i:i.charAt(1)==="/"?`${this.protocol()}:${i}`:`${this.protocol()}://${location.host}${i}`}disconnect(i,e,t){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(i,e,t)}connect(i){i&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Bi(i)),!this.conn&&(this.connectClock++,this.closeWasClean=!1,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))}log(i,e,t){this.logger(i,e,t)}hasLogger(){return this.logger!==null}onOpen(i){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,i]),e}onClose(i){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,i]),e}onError(i){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,i]),e}onMessage(i){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,i]),e}ping(i){if(!this.isConnected())return!1;let e=this.makeRef(),t=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),i(Date.now()-t))});return!0}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,i])=>i())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),ru,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(i,e,t){if(!this.conn)return i&&i();this.waitForBufferDone(()=>{this.conn&&(e?this.conn.close(e,t||""):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),i&&i()})})}waitForBufferDone(i,e=1){if(e===5||!this.conn||!this.conn.bufferedAmount){i();return}setTimeout(()=>{this.waitForBufferDone(i,e+1)},150*e)}waitForSocketClosed(i,e=1){if(e===5||!this.conn||this.conn.readyState===Xe.closed){i();return}setTimeout(()=>{this.waitForSocketClosed(i,e+1)},150*e)}onConnClose(i){let e=i&&i.code;this.hasLogger()&&this.log("transport","close",i),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&e!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,t])=>t(i))}onConnError(i){this.hasLogger()&&this.log("transport",i);let e=this.transport,t=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,n])=>{n(i,e,t)}),(e===this.transport||t>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(i=>{i.isErrored()||i.isLeaving()||i.isClosed()||i.trigger(yt.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case Xe.connecting:return"connecting";case Xe.open:return"open";case Xe.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(i){this.off(i.stateChangeRefs),this.channels=this.channels.filter(e=>e.joinRef()!==i.joinRef())}off(i){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([t])=>i.indexOf(t)===-1)}channel(i,e={}){let t=new ou(i,e,this);return this.channels.push(t),t}push(i){if(this.hasLogger()){let{topic:e,event:t,payload:n,ref:s,join_ref:r}=i;this.log("push",`${e} ${t} (${r}, ${s})`,n)}this.isConnected()?this.encode(i,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(i,e=>this.conn.send(e)))}makeRef(){let i=this.ref+1;return i===this.ref?this.ref=0:this.ref=i,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(i=>i()),this.sendBuffer=[])}onConnMessage(i){this.decode(i.data,e=>{let{topic:t,event:n,payload:s,ref:r,join_ref:a}=e;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${s.status||""} ${t} ${n} ${r&&"("+r+")"||""}`,s);for(let o=0;o<this.channels.length;o++){const c=this.channels[o];c.isMember(t,n,s,a)&&c.trigger(n,s,r,a)}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,c]=this.stateChangeCallbacks.message[o];c(e)}})}leaveOpenTopic(i){let e=this.channels.find(t=>t.topic===i&&(t.isJoined()||t.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${i}"`),e.leave())}};class uu{constructor(e){this.connected=!1,this.config=e,this.socket=new cu(this.config.url,this.config.socketOptions||{logger:(t,n,s)=>{console.debug(`${t}: ${n}`,s)}}),this.channel=this.socket.channel(this.config.topic,this.config.params),this.eventTarget=new EventTarget}connect(){this.connected||(this.socket.onError(e=>this.emitError("socket error",e)),this.socket.connect(),this.channel.onError(e=>this.emitError("channel error",e)),this.channel.join().receive("ok",e=>{console.debug("channel joined",e)}).receive("error",e=>{this.emitError("channel join error",e)}),this.channel.on("state:change",e=>this.handleChange(e)),this.channel.on("state:patch",e=>this.handlePatch(e)),this.connected=!0)}disconnect(){this.channel&&this.channel.leave(),this.socket.disconnect(),this.connected=!1}addEventListener(e,t,n){var s;this.eventTarget.addEventListener(e,t,n),e.startsWith("livestate-")||(s=this.channel)==null||s.on(e,r=>{this.eventTarget.dispatchEvent(new CustomEvent(e,{detail:r}))})}removeEventListener(e,t,n){return this.eventTarget.removeEventListener(e,t,n)}subscribe(e){this.addEventListener("livestate-change",e)}unsubscribe(e){this.removeEventListener("livestate-change",e)}emitError(e,t){this.eventTarget.dispatchEvent(new CustomEvent("livestate-error",{detail:{kind:e,error:t}}))}handleChange({state:e,version:t}){this.state=e,this.stateVersion=t,this.eventTarget.dispatchEvent(new CustomEvent("livestate-change",{detail:{state:this.state,version:this.stateVersion}}))}handlePatch({patch:e,version:t}){if(this.eventTarget.dispatchEvent(new CustomEvent("livestate-patch",{detail:{patch:e,version:t}})),this.versionMatches(t)){const{doc:n,res:s}=tu(this.state,e,{mutate:!1});this.state=n,this.stateVersion=t,this.eventTarget.dispatchEvent(new CustomEvent("livestate-change",{detail:{state:this.state,version:this.stateVersion}}))}else this.channel.push("lvs_refresh")}versionMatches(e){return e===this.stateVersion+1||e===0}pushEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}dispatchEvent(e){return this.channel.push(`lvs_evt:${e.type}`,e.detail),!0}pushCustomEvent(e){this.dispatchEvent(e)}}Promise.resolve();var zs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/*! *****************************************************************************
1
+ "use strict";var Fo=Object.defineProperty;var Bo=(i,e,t)=>e in i?Fo(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var x=(i,e,t)=>(Bo(i,typeof e!="symbol"?e+"":e,t),t);const $s=require("./constants-20cb42a4.cjs");function Gi(){}function qr(i){return i()}function qs(){return Object.create(null)}function tn(i){i.forEach(qr)}function Hr(i){return typeof i=="function"}function Jo(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function jo(i){return Object.keys(i).length===0}function Ne(i,e){i.appendChild(e)}function Vo(i,e,t){const n=$o(i);if(!n.getElementById(e)){const s=Ye("style");s.id=e,s.textContent=t,qo(n,s)}}function $o(i){if(!i)return document;const e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function qo(i,e){return Ne(i.head||i,e),e.sheet}function Nn(i,e,t){i.insertBefore(e,t||null)}function nn(i){i.parentNode&&i.parentNode.removeChild(i)}function Ye(i){return document.createElement(i)}function Hs(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Wr(i){return document.createTextNode(i)}function cn(){return Wr(" ")}function z(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Ho(i){return Array.from(i.childNodes)}function Wo(i,e){e=""+e,i.data!==e&&(i.data=e)}function hi(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}function Go(i){const e={};return i.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let zi;function Fi(i){zi=i}function Gr(){if(!zi)throw new Error("Function called outside component initialization");return zi}function zo(i){Gr().$$.on_mount.push(i)}function Ko(i){Gr().$$.on_destroy.push(i)}const mi=[],is=[];let yi=[];const Ws=[],Yo=Promise.resolve();let ns=!1;function Xo(){ns||(ns=!0,Yo.then(ii))}function ss(i){yi.push(i)}const $n=new Set;let fi=0;function ii(){if(fi!==0)return;const i=zi;do{try{for(;fi<mi.length;){const e=mi[fi];fi++,Fi(e),Qo(e.$$)}}catch(e){throw mi.length=0,fi=0,e}for(Fi(null),mi.length=0,fi=0;is.length;)is.pop()();for(let e=0;e<yi.length;e+=1){const t=yi[e];$n.has(t)||($n.add(t),t())}yi.length=0}while(mi.length);for(;Ws.length;)Ws.pop()();ns=!1,$n.clear(),Fi(i)}function Qo(i){if(i.fragment!==null){i.update(),tn(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(ss)}}function Zo(i){const e=[],t=[];yi.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),yi=e}const ec=new Set;function zr(i,e){i&&i.i&&(ec.delete(i),i.i(e))}function Gs(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function tc(i,e){i.d(1),e.delete(i.key)}function ic(i,e,t,n,s,r,a,o,c,u,d,h){let f=i.length,p=r.length,b=f;const T={};for(;b--;)T[i[b].key]=b;const w=[],_=new Map,M=new Map,Q=[];for(b=p;b--;){const q=h(s,r,b),K=t(q);let A=a.get(K);A?n&&Q.push(()=>A.p(q,e)):(A=u(K,q),A.c()),_.set(K,w[b]=A),K in T&&M.set(K,Math.abs(b-T[K]))}const j=new Set,he=new Set;function ae(q){zr(q,1),q.m(o,d),a.set(q.key,q),d=q.first,p--}for(;f&&p;){const q=w[p-1],K=i[f-1],A=q.key,F=K.key;q===K?(d=q.first,f--,p--):_.has(F)?!a.has(A)||j.has(A)?ae(q):he.has(F)?f--:M.get(A)>M.get(F)?(he.add(A),ae(q)):(j.add(F),f--):(c(K,a),f--)}for(;f--;){const q=i[f];_.has(q.key)||c(q,a)}for(;p;)ae(w[p-1]);return tn(Q),w}function nc(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ss(()=>{const r=i.$$.on_mount.map(qr).filter(Hr);i.$$.on_destroy?i.$$.on_destroy.push(...r):tn(r),i.$$.on_mount=[]}),s.forEach(ss)}function sc(i,e){const t=i.$$;t.fragment!==null&&(Zo(t.after_update),tn(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function rc(i,e){i.$$.dirty[0]===-1&&(mi.push(i),Xo(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function ac(i,e,t,n,s,r,a=null,o=[-1]){const c=zi;Fi(i);const u=i.$$={fragment:null,ctx:[],props:r,update:Gi,not_equal:s,bound:qs(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:qs(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};a&&a(u.root);let d=!1;if(u.ctx=t?t(i,e.props||{},(h,f,...p)=>{const b=p.length?p[0]:f;return u.ctx&&s(u.ctx[h],u.ctx[h]=b)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](b),d&&rc(i,h)),f}):[],u.update(),d=!0,tn(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=Ho(e.target);u.fragment&&u.fragment.l(h),h.forEach(nn)}else u.fragment&&u.fragment.c();e.intro&&zr(i.$$.fragment),nc(i,e.target,e.anchor),ii()}Fi(c)}let Kr;typeof HTMLElement=="function"&&(Kr=class extends HTMLElement{constructor(e,t,n){super();x(this,"$$ctor");x(this,"$$s");x(this,"$$c");x(this,"$$cn",!1);x(this,"$$d",{});x(this,"$$r",!1);x(this,"$$p_d",{});x(this,"$$l",{});x(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const s=this.$$c.$on(e,t);this.$$l_u.set(t,s)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){const s=this.$$l_u.get(t);s&&(s(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(r){return()=>{let a;return{c:function(){a=Ye("slot"),r!=="default"&&z(a,"name",r)},m:function(u,d){Nn(u,a,d)},d:function(u){u&&nn(a)}}}};if(await Promise.resolve(),!this.$$cn)return;const t={},n=Go(this);for(const r of this.$$s)r in n&&(t[r]=[e(r)]);for(const r of this.attributes){const a=this.$$g_p(r.name);a in this.$$d||(this.$$d[a]=pn(a,r.value,this.$$p_d,"toProp"))}this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const s=()=>{this.$$r=!0;for(const r in this.$$p_d)if(this.$$d[r]=this.$$c.$$.ctx[this.$$c.$$.props[r]],this.$$p_d[r].reflect){const a=pn(r,this.$$d[r],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,a)}this.$$r=!1};this.$$c.$$.after_update.push(s),s();for(const r in this.$$l)for(const a of this.$$l[r]){const o=this.$$c.$on(r,a);this.$$l_u.set(a,o)}this.$$l={}}}attributeChangedCallback(e,t,n){var s;this.$$r||(e=this.$$g_p(e),this.$$d[e]=pn(e,n,this.$$p_d,"toProp"),(s=this.$$c)==null||s.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function pn(i,e,t,n){var r;const s=(r=t[i])==null?void 0:r.type;if(e=s==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[i])return e;if(n==="toAttribute")switch(s){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(s){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function oc(i,e,t,n,s,r){let a=class extends Kr{constructor(){super(i,t,s),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(o=>(e[o].attribute||o).toLowerCase())}};return Object.keys(e).forEach(o=>{Object.defineProperty(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(c){var u;c=pn(o,c,e),this.$$d[o]=c,(u=this.$$c)==null||u.$set({[o]:c})}})}),n.forEach(o=>{Object.defineProperty(a.prototype,o,{get(){var c;return(c=this.$$c)==null?void 0:c[o]}})}),r&&(a=r(a)),i.element=a,a}class cc{constructor(){x(this,"$$");x(this,"$$set")}$destroy(){sc(this,1),this.$destroy=Gi}$on(e,t){if(!Hr(t))return Gi;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!jo(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const uc="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(uc);const{isArray:dc}=Array,lc=Object.keys,Ki=i=>{if(!i)return i;if(dc(i)){const e=[],t=i.length;for(let n=0;n<t;n++)e.push(Ki(i[n]));return e}else if(typeof i=="object"){const e=lc(i),t=e.length,n={};for(let s=0;s<t;s++){const r=e[s];n[r]=Ki(i[r])}return n}return i};class Ue{constructor(e){x(this,"path");x(this,"from");this.path=e}}const hc=/~1/g,fc=/~0/g,pc=/~/g,mc=/\//g;function gc(i){return i.indexOf("~")===-1?i:i.replace(hc,"/").replace(fc,"~")}function vc(i){return i.indexOf("/")===-1&&i.indexOf("~")===-1?i:i.replace(pc,"~0").replace(mc,"~1")}function yc(i){return i?i.slice(1).split("/").map(gc):[]}function G(i){return bc(i)?"":"/"+i.map(e=>vc(String(e))).join("/")}const $=i=>typeof i=="string"?yc(i):i,bc=i=>!i.length,kc=Object.prototype.hasOwnProperty;function Tc(i,e){return kc.call(i,e)}const{isArray:Yr}=Array,te=(i,e)=>{const t=e.length;if(!t)return{val:i};let n,s;for(let a=0;a<t;a++)if(n=i,s=e[a],Yr(n)){const o=n.length;if(s==="-")s=o;else if(typeof s=="string"){const c=~~s;if(""+c!==s)throw new Error("INVALID_INDEX");if(s=c,s<0)throw new Error("INVALID_INDEX")}i=n[s]}else if(typeof n=="object"&&n)i=Tc(n,s)?n[s]:void 0;else throw new Error("NOT_FOUND");return{val:i,obj:n,key:s}},sn=i=>Yr(i.obj)&&typeof i.key=="number",xn=i=>typeof i.obj=="object"&&typeof i.key=="string";class Is extends Ue{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"add"}code(){return 0}apply(t){const{val:n,key:s,obj:r}=te(t,this.path),a=Ki(this.value);if(!r)t=a;else if(typeof s=="string")r[s]=a;else{const o=r.length;if(s<o)r.splice(s,0,a);else{if(s>o)throw new Error("INVALID_INDEX");r.push(a)}}return{doc:t,old:n}}toJson(t){return{op:"add",path:G(this.path),value:this.value}}toCompact(t,n){return[n?"add":0,this.path,this.value]}encode(t){t.encodeArrayHeader(3),t.writer.u8(0),t.encodeArray(this.path),t.encodeAny(this.value)}}class Xr extends Ue{constructor(t,n){super(t);x(this,"oldValue");this.oldValue=n}op(){return"remove"}code(){return 1}apply(t){const n=te(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");return xn(n)?delete n.obj[n.key]:sn(n)?n.val!==void 0&&n.obj.splice(n.key,1):t=null,{doc:t,old:n.val}}toJson(t){const n={op:"remove",path:G(this.path)};return this.oldValue!==void 0&&(n.oldValue=this.oldValue),n}toCompact(t,n){const s=n?"remove":1;return this.oldValue===void 0?[s,this.path]:[s,this.path,this.oldValue]}encode(t,n){const s=this.oldValue!==void 0;t.encodeArrayHeader(s?3:2),t.writer.u8(1),t.encodeArray(this.path),s&&t.encodeAny(this.oldValue)}}class Sc extends Ue{constructor(t,n,s){super(t);x(this,"value");x(this,"oldValue");this.value=n,this.oldValue=s}op(){return"replace"}code(){return 2}apply(t){const n=te(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");return xn(n)?n.obj[n.key]=this.value:sn(n)?n.obj[n.key]=this.value:t=this.value,{doc:t,old:n.val}}toJson(t){const n={op:"replace",path:G(this.path),value:this.value};return this.oldValue!==void 0&&(n.oldValue=this.oldValue),n}toCompact(t,n){const s=n?"replace":2;return this.oldValue===void 0?[s,this.path,this.value]:[s,this.path,this.value,this.oldValue]}encode(t,n){const s=this.oldValue!==void 0;t.encodeArrayHeader(s?4:3),t.writer.u8(2),t.encodeArray(this.path),t.encodeAny(this.value),s&&t.encodeAny(this.oldValue)}}class Cc extends Ue{constructor(t,n){super(t);x(this,"from");this.from=n}op(){return"move"}code(){return 4}apply(t){const n=new Xr($(this.from),void 0).apply(t);return new Is(this.path,n.old).apply(n.doc)}toJson(t){return{op:"move",path:G(this.path),from:G(this.from)}}toCompact(t,n){return[n?"move":4,this.path,this.from]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(4),t.encodeArray(this.path),t.encodeArray(this.from)}}class wc extends Ue{constructor(t,n){super(t);x(this,"from");this.from=n}op(){return"copy"}code(){return 3}apply(t){const{val:n}=te(t,this.from);if(n===void 0)throw new Error("NOT_FOUND");return new Is(this.path,Ki(n)).apply(t)}toJson(t){return{op:"copy",path:G(this.path),from:G(this.from)}}toCompact(t,n){return[n?"copy":3,this.path,this.from]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(3),t.encodeArray(this.path),t.encodeArray(this.from)}}class Ce extends Ue{apply(e){if(!this.test(e))throw new Error("TEST");return{doc:e}}}const Pn=(i,e)=>{if(i===e)return!0;if(i&&e&&typeof i=="object"&&typeof e=="object"){if(i.constructor!==e.constructor)return!1;let t,n,s;if(Array.isArray(i)){if(t=i.length,t!==e.length)return!1;for(n=t;n--!==0;)if(!Pn(i[n],e[n]))return!1;return!0}if(s=Object.keys(i),t=s.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;){const r=s[n];if(!Pn(i[r],e[r]))return!1}return!0}return!1};class Ec extends Ce{constructor(t,n,s){super(t);x(this,"value");x(this,"not");this.value=n,this.not=s}op(){return"test"}code(){return 5}test(t){const{val:n}=te(t,this.path);if(n===void 0)return!!this.not;const s=Pn(n,this.value);return this.not?!s:s}toJson(t){const n={op:"test",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.not&&(n.not=this.not),n}toCompact(t,n){const s=t?this.path.slice(t.path.length):this.path,r=n?"test":5;return this.not?[r,s,this.value,1]:[r,s,this.value]}encode(t,n){t.encodeArrayHeader(this.not?4:3),t.writer.u8(5),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeAny(this.value),this.not&&t.writer.u8(1)}}class Pc extends Ue{constructor(e){super(e)}op(){return"flip"}code(){return 8}apply(e){const t=te(e,this.path);return t.obj?t.obj[t.key]=!t.val:e=!t.val,{doc:e,old:t.val}}toJson(e){return{op:"flip",path:G(this.path)}}toCompact(e,t){return[t?"flip":8,this.path]}encode(e,t){e.encodeArrayHeader(2),e.writer.u8(8),e.encodeArray(this.path)}}class Rc extends Ue{constructor(t,n){super(t);x(this,"inc");this.inc=n}op(){return"inc"}code(){return 9}apply(t){const n=te(t,this.path),s=this.inc+Number(n.val);return n.obj?n.obj[n.key]=s:t=s,{doc:t,old:n.val}}toJson(t){return{op:"inc",path:G(this.path),inc:this.inc}}toCompact(t,n){return[n?"inc":9,this.path,this.inc]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(9),t.encodeArray(this.path),t.encodeNumber(this.inc)}}class _c extends Ue{constructor(t,n,s){super(t);x(this,"pos");x(this,"str");this.pos=n,this.str=s}op(){return"str_ins"}code(){return 6}apply(t){const{val:n,key:s,obj:r}=te(t,this.path);if(typeof n!="string"){if(n!==void 0)throw new Error("NOT_A_STRING");if(this.pos!==0)throw new Error("POS")}const a=typeof n=="string"?n:"",o=Math.min(this.pos,a.length),c=a.slice(0,o),u=a.slice(o),d=c+this.str+u;return r?r[s]=d:t=d,{doc:t,old:n}}toJson(t){return{op:"str_ins",path:G(this.path),pos:this.pos,str:this.str}}toCompact(t,n){return[n?"str_ins":6,this.path,this.pos,this.str]}encode(t,n){t.encodeArrayHeader(4),t.writer.u8(6),t.encodeArray(this.path),t.encodeNumber(this.pos),t.encodeString(this.str)}}class Ic extends Ue{constructor(t,n,s,r){super(t);x(this,"pos");x(this,"str");x(this,"len");this.pos=n,this.str=s,this.len=r}op(){return"str_del"}code(){return 7}deleteLength(){return typeof this.str=="string"?this.str.length:this.len}apply(t){const{val:n,key:s,obj:r}=te(t,this.path);if(typeof n!="string")throw new Error("NOT_A_STRING");const a=n.length,o=Math.min(this.pos,n.length),c=Math.min(o,a),u=this.str!==void 0?this.str.length:this.len,d=Math.min(o+u,a),h=n.slice(0,c),f=n.substr(d),p=h+f;return r?r[s]=p:t=p,{doc:t,old:n}}toJson(t){return typeof this.str=="string"?{op:"str_del",path:G(this.path),pos:this.pos,str:this.str}:{op:"str_del",path:G(this.path),pos:this.pos,len:this.len}}toCompact(t,n){const s=n?"str_del":7;return typeof this.str=="string"?[s,this.path,this.pos,this.str]:[s,this.path,this.pos,0,this.len]}encode(t,n){const s=typeof this.str=="string";t.encodeArrayHeader(s?4:5),t.writer.u8(7),t.encodeArray(this.path),t.encodeNumber(this.pos),s?t.encodeString(this.str):(t.writer.u8(0),t.encodeNumber(this.len))}}const{isArray:Ac}=Array,rs=i=>!!i&&typeof i=="object"&&typeof i.text=="string",as=i=>!!i&&typeof i=="object"&&Ac(i.children),Oc=(i,e)=>{const t=new RegExp(i,e?"i":void 0);return n=>t.test(n)};class Lc extends Ue{constructor(t,n,s){super(t);x(this,"pos");x(this,"props");this.pos=n,this.props=s}op(){return"split"}code(){return 10}apply(t){const n=te(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");const s=this.split(n.val);return xn(n)?n.obj[n.key]=s:sn(n)?(n.obj[n.key]=s[0],n.obj.splice(n.key+1,0,s[1])):t=s,{doc:t,old:n.val}}split(t){if(typeof t=="string"){const{pos:n,props:s}=this,r=t.slice(0,n),a=t.slice(n);return s?[{...s,text:r},{...s,text:a}]:[r,a]}else if(rs(t)){const{pos:n,props:s}=this,r=t.text.slice(0,n),a=t.text.slice(n);return[{...t,...s,text:r},{...t,...s,text:a}]}else if(as(t)){const{pos:n,props:s}=this,r=t.children.slice(0,n),a=t.children.slice(n);return[{...t,...s,children:r},{...t,...s,children:a}]}else if(typeof t=="number"){const{pos:n}=this;return[n,t-n]}else return[t,t]}toJson(t){const n={op:"split",path:G(this.path),pos:this.pos};return this.props&&(n.props=this.props),n}toCompact(t,n){const s=n?"split":10;return this.props?[s,this.path,this.pos,this.props]:[s,this.path,this.pos]}encode(t,n){t.encodeArrayHeader(this.props?4:3),t.writer.u8(10),t.encodeArray(this.path),t.encodeNumber(this.pos),this.props&&t.encodeObject(this.props)}}class Nc extends Ue{constructor(t,n,s){super(t);x(this,"pos");x(this,"props");this.pos=n,this.props=s}op(){return"merge"}code(){return 11}apply(t){const n=te(t,this.path);if(!sn(n))throw new Error("INVALID_TARGET");if(n.key<=0)throw new Error("INVALID_KEY");const s=n.obj[n.key-1],r=n.obj[n.key],a=this.merge(s,r);return n.obj[n.key-1]=a,n.obj.splice(n.key,1),{doc:t,old:[s,r]}}merge(t,n){return typeof t=="string"&&typeof n=="string"||typeof t=="number"&&typeof n=="number"?t+n:rs(t)&&rs(n)?{...t,...n,text:t.text+n.text}:as(t)&&as(n)?{...t,...n,children:[...t.children,...n.children]}:[t,n]}toJson(t){const n={op:"merge",path:G(this.path),pos:this.pos};return this.props&&(n.props=this.props),n}toCompact(t,n){const s=n?"merge":11;return this.props?[s,this.path,this.pos,this.props]:[s,this.path,this.pos]}encode(t,n){t.encodeArrayHeader(this.props?4:3),t.writer.u8(11),t.encodeArray(this.path),t.encodeNumber(this.pos),this.props&&t.encodeAny(this.props)}}const{isArray:xc}=Array;class Dc extends Ue{constructor(t,n,s){super(t);x(this,"props");x(this,"deleteNull");this.props=n,this.deleteNull=s}op(){return"extend"}code(){return 12}apply(t){const n=te(t,this.path);return sn(n)?n.val!==void 0&&(n.obj[n.key]=this.extend(n.val)):xn(n)?n.obj[n.key]=this.extend(n.val):t=this.extend(t),{doc:t}}extend(t){if(xc(t)||typeof t!="object"||!t)return t;for(const[n,s]of Object.entries(this.props)){if(n==="__proto__")throw new Error("NO_PROTO");if(s===null&&this.deleteNull){delete t[n];continue}t[n]=s}return t}toJson(t){const n={op:"extend",path:G(this.path),props:this.props};return this.deleteNull&&(n.deleteNull=this.deleteNull),n}toCompact(t,n){const s=n?"extend":12;return this.deleteNull?[s,this.path,this.props,1]:[s,this.path,this.props]}encode(t,n){const{deleteNull:s}=this;t.encodeArrayHeader(s?4:3),t.writer.u8(12),t.encodeArray(this.path),t.encodeObject(this.props),s&&t.writer.u8(1)}}class Mc extends Ce{constructor(e){super(e)}op(){return"defined"}code(){return 31}test(e){const{val:t}=te(e,this.path);return t!==void 0}toJson(e){return{op:"defined",path:G(e?this.path.slice(e.path.length):this.path)}}toCompact(e,t){return[t?"defined":31,e?this.path.slice(e.path.length):this.path]}encode(e,t){e.encodeArrayHeader(2),e.writer.u8(31),e.encodeArray(t?this.path.slice(t.path.length):this.path)}}class Uc extends Ce{constructor(e){super(e)}op(){return"undefined"}code(){return 38}test(e){try{const{val:t}=te(e,this.path);return t===void 0}catch(t){if(t.message==="NOT_FOUND")return!0;throw t}}toJson(e){return{op:"undefined",path:G(e?this.path.slice(e.path.length):this.path)}}toCompact(e,t){return[t?"undefined":38,e?this.path.slice(e.path.length):this.path]}encode(e,t){e.encodeArrayHeader(2),e.writer.u8(38),e.encodeArray(t?this.path.slice(t.path.length):this.path)}}const{isArray:Fc}=Array;class Bc extends Ce{constructor(t,n){super(t);x(this,"type");this.type=n}op(){return"test_type"}code(){return 39}test(t){const{val:n}=te(t,this.path);return n===null?this.type.indexOf("null")>-1:Fc(n)?this.type.indexOf("array")>-1:this.type.indexOf(typeof n)>-1||typeof n=="number"&&n===Math.round(n)&&this.type.indexOf("integer")>-1}toJson(t){return{op:"test_type",path:G(t?this.path.slice(t.path.length):this.path),type:this.type}}toCompact(t,n){return[n?"test_type":39,t?this.path.slice(t.path.length):this.path,this.type]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(39),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeArray(this.type)}}class Jc extends Ce{constructor(t,n,s,r){super(t);x(this,"pos");x(this,"str");x(this,"not");this.pos=n,this.str=s,this.not=r}op(){return"test_string"}code(){return 40}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const s=n.length,r=Math.min(this.pos,s),a=Math.min(this.pos+this.str.length,s),o=n.substring(r,a)===this.str;return this.not?!o:o}toJson(t){const n={op:"test_string",path:G(t?this.path.slice(t.path.length):this.path),pos:this.pos,str:this.str};return this.not&&(n.not=this.not),n}toCompact(t,n){const s=n?"test_string":40,r=t?this.path.slice(t.path.length):this.path;return this.not?[s,r,this.pos,this.str,1]:[s,r,this.pos,this.str]}encode(t,n){t.encodeArrayHeader(this.not?5:4),t.writer.u8(40),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeNumber(this.pos),t.encodeString(this.str),this.not&&t.writer.u8(1)}}class jc extends Ce{constructor(t,n,s){super(t);x(this,"len");x(this,"not");this.len=n,this.not=s}op(){return"test_string_len"}code(){return 41}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const r=n.length>=this.len;return this.not?!r:r}toJson(t){const n={op:"test_string_len",path:G(t?this.path.slice(t.path.length):this.path),len:this.len};return this.not&&(n.not=this.not),n}toCompact(t,n){const s=n?"test_string_len":41,r=t?this.path.slice(t.path.length):this.path;return this.not?[s,r,this.len,1]:[s,r,this.len]}encode(t,n){t.encodeArrayHeader(this.not?4:3),t.writer.u8(41),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeNumber(this.len),this.not&&t.writer.u8(1)}}class Vc extends Ce{constructor(t,n,s){super(t);x(this,"value");x(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"contains"}code(){return 30}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const s=this.ignore_case?n.toLowerCase():n,r=this.ignore_case?this.value.toLowerCase():this.value;return s.indexOf(r)>-1}toJson(t){const n={op:"contains",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(n.ignore_case=this.ignore_case),n}toCompact(t,n){const s=n?"contains":30;return this.ignore_case?[s,t?this.path.slice(t.path.length):this.path,this.value,1]:[s,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){const s=this.ignore_case;t.encodeArrayHeader(s?4:3),t.writer.u8(30),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value),s&&t.writer.u8(1)}}class $c extends Ce{constructor(t,n,s){super(t);x(this,"value");x(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"ends"}code(){return 32}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const s=this.ignore_case?n.toLowerCase():n,r=this.ignore_case?this.value.toLowerCase():this.value;return s.endsWith(r)}toJson(t){const n={op:"ends",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(n.ignore_case=this.ignore_case),n}toCompact(t,n){const s=n?"ends":32;return this.ignore_case?[s,t?this.path.slice(t.path.length):this.path,this.value,1]:[s,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){const s=this.ignore_case;t.encodeArrayHeader(s?4:3),t.writer.u8(32),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value),s&&t.writer.u8(1)}}class qc extends Ce{constructor(t,n,s){super(t);x(this,"value");x(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"starts"}code(){return 37}test(t){const{val:n}=te(t,this.path);if(typeof n!="string")return!1;const s=this.ignore_case?n.toLowerCase():n,r=this.ignore_case?this.value.toLowerCase():this.value;return s.startsWith(r)}toJson(t){const n={op:"starts",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(n.ignore_case=this.ignore_case),n}toCompact(t,n){const s=n?"starts":37;return this.ignore_case?[s,t?this.path.slice(t.path.length):this.path,this.value,1]:[s,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){const s=this.ignore_case;t.encodeArrayHeader(s?4:3),t.writer.u8(37),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value),s&&t.writer.u8(1)}}class Hc extends Ce{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"in"}code(){return 33}test(t){const{val:n}=te(t,this.path);for(const s of this.value)if(Pn(n,s))return!0;return!1}toJson(t){return{op:"in",path:G(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,n){return[n?"in":33,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(33),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeArray(this.value)}}class Wc extends Ce{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"less"}code(){return 34}test(t){const{val:n}=te(t,this.path);return typeof n!="number"?!1:n<this.value}toJson(t){return{op:"less",path:G(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,n){return[n?"less":34,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(34),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeNumber(this.value)}}class Gc extends Ce{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"more"}code(){return 36}test(t){const{val:n}=te(t,this.path);return typeof n!="number"?!1:n>this.value}toJson(t){return{op:"more",path:G(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,n){return[n?"more":36,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(36),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeNumber(this.value)}}class As extends Ce{constructor(t,n){super(t);x(this,"ops");this.ops=n}}class zc extends As{constructor(t,n){super(t,n);x(this,"ops");this.ops=n}op(){return"and"}code(){return 43}test(t){for(const n of this.ops)if(!n.test(t))return!1;return!0}toJson(t){return{op:"and",path:G(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(s=>s.toJson(this))}}toCompact(t,n){return[n?"and":43,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,n))]}encode(t,n){const s=n?this.path.slice(n.path.length):this.path;t.encodeArrayHeader(3),t.writer.u8(43),t.encodeArray(s);const r=this.ops.length;t.encodeArrayHeader(r);for(let a=0;a<r;a++)this.ops[a].encode(t,this)}}class Kc extends As{constructor(t,n){super(t,n);x(this,"ops");this.ops=n}op(){return"or"}code(){return 45}test(t){for(const n of this.ops)if(n.test(t))return!0;return!1}toJson(t){return{op:"or",path:G(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(s=>s.toJson(this))}}toCompact(t,n){return[n?"or":45,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,n))]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(45),t.encodeArray(n?this.path.slice(n.path.length):this.path);const s=this.ops.length;t.encodeArrayHeader(s);for(let r=0;r<s;r++)this.ops[r].encode(t,this)}}class Yc extends As{constructor(t,n){super(t,n);x(this,"ops");this.ops=n}op(){return"not"}code(){return 44}test(t){for(const n of this.ops)if(n.test(t))return!1;return!0}toJson(t){return{op:"not",path:G(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(s=>s.toJson(this))}}toCompact(t,n){return[n?"not":44,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,n))]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(44),t.encodeArray(n?this.path.slice(n.path.length):this.path);const s=this.ops.length;t.encodeArrayHeader(s);for(let r=0;r<s;r++)this.ops[r].encode(t,this)}}class Xc extends Ce{constructor(t,n,s,r){super(t);x(this,"value");x(this,"ignore_case");x(this,"matcher");this.value=n,this.ignore_case=s,this.matcher=r(n,s)}op(){return"matches"}code(){return 35}test(t){const{val:n}=te(t,this.path);return typeof n!="string"?!1:this.matcher(n)}toJson(t){const n={op:"matches",path:G(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(n.ignore_case=this.ignore_case),n}toCompact(t,n){const s=n?"matches":35;return this.ignore_case?[s,t?this.path.slice(t.path.length):this.path,this.value,1]:[s,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){const s=this.ignore_case;t.encodeArrayHeader(s?4:3),t.writer.u8(35),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value),s&&t.writer.u8(1)}}const{isArray:Qc}=Array;class Zc extends Ce{constructor(t,n){super(t);x(this,"value");this.value=n}op(){return"type"}code(){return 42}test(t){const{val:n}=te(t,this.path);return n===null?this.value==="null":Qc(n)?this.value==="array":typeof n===this.value||typeof n=="number"&&n===Math.round(n)&&this.value==="integer"}toJson(t){return{op:"type",path:G(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,n){return[n?"type":42,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,n){t.encodeArrayHeader(3),t.writer.u8(42),t.encodeArray(n?this.path.slice(n.path.length):this.path),t.encodeString(this.value)}}const eu=(i,e)=>{switch(i.op){case"add":return new Is($(i.path),i.value);case"remove":return new Xr($(i.path),i.oldValue);case"replace":return new Sc($(i.path),i.value,i.oldValue);case"move":return new Cc($(i.path),$(i.from));case"copy":return new wc($(i.path),$(i.from));case"flip":return new Pc($(i.path));case"inc":return new Rc($(i.path),i.inc);case"str_ins":return new _c($(i.path),i.pos,i.str);case"str_del":return new Ic($(i.path),i.pos,i.str,i.len);case"split":return new Lc($(i.path),i.pos,i.props||null);case"merge":return new Nc($(i.path),i.pos,i.props||null);case"extend":return new Dc($(i.path),i.props,!!i.deleteNull);default:return mn(i,e)}},mn=(i,e)=>{switch(i.op){case"test":return new Ec($(i.path),i.value,!!i.not);case"defined":return new Mc($(i.path));case"undefined":return new Uc($(i.path));case"type":return new Zc($(i.path),i.value);case"test_type":return new Bc($(i.path),i.type);case"test_string":return new Jc($(i.path),i.pos,i.str,!!i.not);case"test_string_len":return new jc($(i.path),i.len,!!i.not);case"contains":return new Vc($(i.path),i.value,!!i.ignore_case);case"ends":return new $c($(i.path),i.value,!!i.ignore_case);case"starts":return new qc($(i.path),i.value,!!i.ignore_case);case"matches":return new Xc($(i.path),i.value,!!i.ignore_case,e.createMatcher||Oc);case"in":return new Hc($(i.path),i.value);case"less":return new Wc($(i.path),i.value);case"more":return new Gc($(i.path),i.value);case"and":{const t=$(i.path);return new zc(t,i.apply.map(n=>mn({...n,path:[...t,...$(n.path)]},e)))}case"or":{const t=$(i.path);return new Kc(t,i.apply.map(n=>mn({...n,path:[...t,...$(n.path)]},e)))}case"not":{const t=$(i.path);return new Yc(t,i.apply.map(n=>mn({...n,path:[...t,...$(n.path)]},e)))}default:throw new Error("OP_UNKNOWN")}};function tu(i,e,t){t.mutate||(i=Ki(i));const n=[],s=e.length;for(let r=0;r<s;r++){const o=eu(e[r],t).apply(i);i=o.doc,n.push(o)}return{doc:i,res:n}}var Bi=i=>typeof i=="function"?i:function(){return i},iu=typeof self<"u"?self:null,Di=typeof window<"u"?window:null,Ji=iu||Di||Ji,nu="2.0.0",Xe={connecting:0,open:1,closing:2,closed:3},su=1e4,ru=1e3,Le={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},yt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},os={longpoll:"longpoll",websocket:"websocket"},au={complete:4},un=class{constructor(i,e,t,n){this.channel=i,this.event=e,this.payload=t||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(i){this.timeout=i,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(i,e){return this.hasReceived(i)&&e(this.receivedResp.response),this.recHooks.push({status:i,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:i,response:e,_ref:t}){this.recHooks.filter(n=>n.status===i).forEach(n=>n.callback(e))}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,i=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=i,this.matchReceive(i)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(i){return this.receivedResp&&this.receivedResp.status===i}trigger(i,e){this.channel.trigger(this.refEvent,{status:i,response:e})}},Qr=class{constructor(i,e){this.callback=i,this.timerCalc=e,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))}},ou=class{constructor(i,e,t){this.state=Le.closed,this.topic=i,this.params=Bi(e||{}),this.socket=t,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new un(this,yt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Qr(()=>{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=Le.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=Le.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=Le.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Le.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 un(this,yt.leave,Bi({}),this.timeout).send(),this.state=Le.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(yt.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(i=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=i,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(i){this.on(yt.close,i)}onError(i){return this.on(yt.error,e=>i(e))}on(i,e){let t=this.bindingRef++;return this.bindings.push({event:i,ref:t,callback:e}),t}off(i,e){this.bindings=this.bindings.filter(t=>!(t.event===i&&(typeof e>"u"||e===t.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(i,e,t=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${i}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new un(this,i,function(){return e},t);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(i=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Le.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(yt.close,"leave")},t=new un(this,yt.leave,Bi({}),i);return t.receive("ok",()=>e()).receive("timeout",()=>e()),t.send(),this.canPush()||t.trigger("ok",{}),t}onMessage(i,e,t){return e}isMember(i,e,t,n){return this.topic!==i?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:i,event:e,payload:t,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(i=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Le.joining,this.joinPush.resend(i))}trigger(i,e,t,n){let s=this.onMessage(i,e,t,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(a=>a.event===i);for(let a=0;a<r.length;a++)r[a].callback(s,t,n||this.joinRef())}replyEventName(i){return`chan_reply_${i}`}isClosed(){return this.state===Le.closed}isErrored(){return this.state===Le.errored}isJoined(){return this.state===Le.joined}isJoining(){return this.state===Le.joining}isLeaving(){return this.state===Le.leaving}},Rn=class{static request(i,e,t,n,s,r,a){if(Ji.XDomainRequest){let o=new Ji.XDomainRequest;return this.xdomainRequest(o,i,e,n,s,r,a)}else{let o=new Ji.XMLHttpRequest;return this.xhrRequest(o,i,e,t,n,s,r,a)}}static xdomainRequest(i,e,t,n,s,r,a){return i.timeout=s,i.open(e,t),i.onload=()=>{let o=this.parseJSON(i.responseText);a&&a(o)},r&&(i.ontimeout=r),i.onprogress=()=>{},i.send(n),i}static xhrRequest(i,e,t,n,s,r,a,o){return i.open(e,t,!0),i.timeout=r,i.setRequestHeader("Content-Type",n),i.onerror=()=>o&&o(null),i.onreadystatechange=()=>{if(i.readyState===au.complete&&o){let c=this.parseJSON(i.responseText);o(c)}},a&&(i.ontimeout=a),i.send(s),i}static parseJSON(i){if(!i||i==="")return null;try{return JSON.parse(i)}catch{return console&&console.log("failed to parse JSON response",i),null}}static serialize(i,e){let t=[];for(var n in i){if(!Object.prototype.hasOwnProperty.call(i,n))continue;let s=e?`${e}[${n}]`:n,r=i[n];typeof r=="object"?t.push(this.serialize(r,s)):t.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return t.join("&")}static appendParams(i,e){if(Object.keys(e).length===0)return i;let t=i.match(/\?/)?"&":"?";return`${i}${t}${this.serialize(e)}`}},qn=class{constructor(i){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(i),this.readyState=Xe.connecting,this.poll()}normalizeEndpoint(i){return i.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+os.websocket),"$1/"+os.longpoll)}endpointURL(){return Rn.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(i,e,t){this.close(i,e,t),this.readyState=Xe.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Xe.open||this.readyState===Xe.connecting}poll(){this.ajax("GET",null,()=>this.ontimeout(),i=>{if(i){var{status:e,token:t,messages:n}=i;this.token=t}else e=0;switch(e){case 200:n.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Xe.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${e}`)}})}send(i){this.ajax("POST",i,()=>this.onerror("timeout"),e=>{(!e||e.status!==200)&&(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(i,e,t){for(let s of this.reqs)s.abort();this.readyState=Xe.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:i,reason:e,wasClean:t});typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(i,e,t,n){let s,r=()=>{this.reqs.delete(s),t()};s=Rn.request(i,this.endpointURL(),"application/json",e,this.timeout,r,a=>{this.reqs.delete(s),this.isActive()&&n(a)}),this.reqs.add(s)}},dn={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(i,e){if(i.payload.constructor===ArrayBuffer)return e(this.binaryEncode(i));{let t=[i.join_ref,i.ref,i.topic,i.event,i.payload];return e(JSON.stringify(t))}},decode(i,e){if(i.constructor===ArrayBuffer)return e(this.binaryDecode(i));{let[t,n,s,r,a]=JSON.parse(i);return e({join_ref:t,ref:n,topic:s,event:r,payload:a})}},binaryEncode(i){let{join_ref:e,ref:t,event:n,topic:s,payload:r}=i,a=this.META_LENGTH+e.length+t.length+s.length+n.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),c=new DataView(o),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,e.length),c.setUint8(u++,t.length),c.setUint8(u++,s.length),c.setUint8(u++,n.length),Array.from(e,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(t,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(s,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(n,h=>c.setUint8(u++,h.charCodeAt(0)));var d=new Uint8Array(o.byteLength+r.byteLength);return d.set(new Uint8Array(o),0),d.set(new Uint8Array(r),o.byteLength),d.buffer},binaryDecode(i){let e=new DataView(i),t=e.getUint8(0),n=new TextDecoder;switch(t){case this.KINDS.push:return this.decodePush(i,e,n);case this.KINDS.reply:return this.decodeReply(i,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(i,e,n)}},decodePush(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=e.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=t.decode(i.slice(a,a+n));a=a+n;let c=t.decode(i.slice(a,a+s));a=a+s;let u=t.decode(i.slice(a,a+r));a=a+r;let d=i.slice(a,i.byteLength);return{join_ref:o,ref:null,topic:c,event:u,payload:d}},decodeReply(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=e.getUint8(3),a=e.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,c=t.decode(i.slice(o,o+n));o=o+n;let u=t.decode(i.slice(o,o+s));o=o+s;let d=t.decode(i.slice(o,o+r));o=o+r;let h=t.decode(i.slice(o,o+a));o=o+a;let f=i.slice(o,i.byteLength),p={status:h,response:f};return{join_ref:c,ref:u,topic:d,event:yt.reply,payload:p}},decodeBroadcast(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=this.HEADER_LENGTH+2,a=t.decode(i.slice(r,r+n));r=r+n;let o=t.decode(i.slice(r,r+s));r=r+s;let c=i.slice(r,i.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:c}}},cu=class{constructor(i,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=e.timeout||su,this.transport=e.transport||Ji.WebSocket||qn,this.establishedConnections=0,this.defaultEncoder=dn.encode.bind(dn),this.defaultDecoder=dn.decode.bind(dn),this.closeWasClean=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.transport!==qn?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let t=null;Di&&Di.addEventListener&&(Di.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),t=this.connectClock)}),Di.addEventListener("pageshow",n=>{t===this.connectClock&&(t=null,this.connect())})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.rejoinAfterMs=n=>e.rejoinAfterMs?e.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>e.reconnectAfterMs?e.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=e.logger||null,this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Bi(e.params||{}),this.endPoint=`${i}/${os.websocket}`,this.vsn=e.vsn||nu,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Qr(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return qn}replaceTransport(i){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=i}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let i=Rn.appendParams(Rn.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return i.charAt(0)!=="/"?i:i.charAt(1)==="/"?`${this.protocol()}:${i}`:`${this.protocol()}://${location.host}${i}`}disconnect(i,e,t){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(i,e,t)}connect(i){i&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Bi(i)),!this.conn&&(this.connectClock++,this.closeWasClean=!1,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))}log(i,e,t){this.logger(i,e,t)}hasLogger(){return this.logger!==null}onOpen(i){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,i]),e}onClose(i){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,i]),e}onError(i){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,i]),e}onMessage(i){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,i]),e}ping(i){if(!this.isConnected())return!1;let e=this.makeRef(),t=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),i(Date.now()-t))});return!0}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,i])=>i())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),ru,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(i,e,t){if(!this.conn)return i&&i();this.waitForBufferDone(()=>{this.conn&&(e?this.conn.close(e,t||""):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),i&&i()})})}waitForBufferDone(i,e=1){if(e===5||!this.conn||!this.conn.bufferedAmount){i();return}setTimeout(()=>{this.waitForBufferDone(i,e+1)},150*e)}waitForSocketClosed(i,e=1){if(e===5||!this.conn||this.conn.readyState===Xe.closed){i();return}setTimeout(()=>{this.waitForSocketClosed(i,e+1)},150*e)}onConnClose(i){let e=i&&i.code;this.hasLogger()&&this.log("transport","close",i),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&e!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,t])=>t(i))}onConnError(i){this.hasLogger()&&this.log("transport",i);let e=this.transport,t=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,n])=>{n(i,e,t)}),(e===this.transport||t>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(i=>{i.isErrored()||i.isLeaving()||i.isClosed()||i.trigger(yt.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case Xe.connecting:return"connecting";case Xe.open:return"open";case Xe.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(i){this.off(i.stateChangeRefs),this.channels=this.channels.filter(e=>e.joinRef()!==i.joinRef())}off(i){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([t])=>i.indexOf(t)===-1)}channel(i,e={}){let t=new ou(i,e,this);return this.channels.push(t),t}push(i){if(this.hasLogger()){let{topic:e,event:t,payload:n,ref:s,join_ref:r}=i;this.log("push",`${e} ${t} (${r}, ${s})`,n)}this.isConnected()?this.encode(i,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(i,e=>this.conn.send(e)))}makeRef(){let i=this.ref+1;return i===this.ref?this.ref=0:this.ref=i,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(i=>i()),this.sendBuffer=[])}onConnMessage(i){this.decode(i.data,e=>{let{topic:t,event:n,payload:s,ref:r,join_ref:a}=e;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${s.status||""} ${t} ${n} ${r&&"("+r+")"||""}`,s);for(let o=0;o<this.channels.length;o++){const c=this.channels[o];c.isMember(t,n,s,a)&&c.trigger(n,s,r,a)}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,c]=this.stateChangeCallbacks.message[o];c(e)}})}leaveOpenTopic(i){let e=this.channels.find(t=>t.topic===i&&(t.isJoined()||t.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${i}"`),e.leave())}};class uu{constructor(e){this.connected=!1,this.config=e,this.socket=new cu(this.config.url,this.config.socketOptions||{logger:(t,n,s)=>{console.debug(`${t}: ${n}`,s)}}),this.channel=this.socket.channel(this.config.topic,this.config.params),this.eventTarget=new EventTarget}connect(){this.connected||(this.socket.onError(e=>this.emitError("socket error",e)),this.socket.connect(),this.channel.onError(e=>this.emitError("channel error",e)),this.channel.join().receive("ok",e=>{console.debug("channel joined",e)}).receive("error",e=>{this.emitError("channel join error",e)}),this.channel.on("state:change",e=>this.handleChange(e)),this.channel.on("state:patch",e=>this.handlePatch(e)),this.connected=!0)}disconnect(){this.channel&&this.channel.leave(),this.socket.disconnect(),this.connected=!1}addEventListener(e,t,n){var s;this.eventTarget.addEventListener(e,t,n),e.startsWith("livestate-")||(s=this.channel)==null||s.on(e,r=>{this.eventTarget.dispatchEvent(new CustomEvent(e,{detail:r}))})}removeEventListener(e,t,n){return this.eventTarget.removeEventListener(e,t,n)}subscribe(e){this.addEventListener("livestate-change",e)}unsubscribe(e){this.removeEventListener("livestate-change",e)}emitError(e,t){this.eventTarget.dispatchEvent(new CustomEvent("livestate-error",{detail:{kind:e,error:t}}))}handleChange({state:e,version:t}){this.state=e,this.stateVersion=t,this.eventTarget.dispatchEvent(new CustomEvent("livestate-change",{detail:{state:this.state,version:this.stateVersion}}))}handlePatch({patch:e,version:t}){if(this.eventTarget.dispatchEvent(new CustomEvent("livestate-patch",{detail:{patch:e,version:t}})),this.versionMatches(t)){const{doc:n,res:s}=tu(this.state,e,{mutate:!1});this.state=n,this.stateVersion=t,this.eventTarget.dispatchEvent(new CustomEvent("livestate-change",{detail:{state:this.state,version:this.stateVersion}}))}else this.channel.push("lvs_refresh")}versionMatches(e){return e===this.stateVersion+1||e===0}pushEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}dispatchEvent(e){return this.channel.push(`lvs_evt:${e.type}`,e.detail),!0}pushCustomEvent(e){this.dispatchEvent(e)}}Promise.resolve();var zs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/*! *****************************************************************************
2
2
  Copyright (C) Microsoft. All rights reserved.
3
3
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
4
  this file except in compliance with the License. You may obtain a copy of the
@@ -57,4 +57,4 @@ a=extmap-allow-mixed`)!==-1){const r=s.sdp.split(`
57
57
  pointer-events: none !important;
58
58
  user-select: none !important;
59
59
  }
60
- `,i}function xl(i){Vo(i,"svelte-uiimm6",'#liveroom-client-element.svelte-uiimm6.svelte-uiimm6{font-family:Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;line-height:1.5;font-weight:400;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}#users-container.svelte-uiimm6.svelte-uiimm6{z-index:99999;position:fixed;inset:0;overflow:hidden;pointer-events:none}.user.svelte-uiimm6.svelte-uiimm6{z-index:10;position:absolute;top:0;left:0;user-select:none;transform:translate(var(--x), var(--y));transition:transform 100ms linear;will-change:transform}.user.svelte-uiimm6 .cursor.svelte-uiimm6{position:absolute;top:0;left:0;color:var(--color);transform-origin:top left;transform:rotate(6deg)}.user[data-isself="true"].svelte-uiimm6 .cursor.svelte-uiimm6{display:none}.user-label.svelte-uiimm6.svelte-uiimm6{font-weight:600;color:black;background-color:var(--color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:9999px;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-uiimm6 .user-label.svelte-uiimm6{display:flex;flex-direction:column;justify-content:center;align-items:center}.user.svelte-uiimm6 .user-label[data-hidevideo="true"].svelte-uiimm6{position:absolute;top:20px;left:16px}.user.svelte-uiimm6 .user-label[data-hidevideo="false"].svelte-uiimm6{position:relative;margin:12px 6px}.user[data-isself="true"].svelte-uiimm6 .user-label.svelte-uiimm6{display:none}.user-label.svelte-uiimm6 .user-name.svelte-uiimm6{display:flex;justify-content:center;align-items:center;background-color:var(--color);font-size:0.7rem}.user.svelte-uiimm6 .user-label[data-hidevideo="true"] .user-name.svelte-uiimm6{padding:0.15rem 0.5rem}.user.svelte-uiimm6 .user-label[data-hidevideo="false"] .user-name.svelte-uiimm6{position:absolute;inset-inline:0;bottom:-2px;padding:0.15rem 0.5rem 0.35rem 0.5rem}.user.svelte-uiimm6 .user-label #video-container.svelte-uiimm6{height:7rem;width:7rem;overflow:hidden;display:flex;justify-content:center;align-items:center}.user.svelte-uiimm6 .user-label[data-hidevideo="true"] #video-container.svelte-uiimm6{display:none}.user.svelte-uiimm6 .user-label #video-container video.svelte-uiimm6{height:100%;aspect-ratio:16 / 9;transform:scaleX(-1)}.user.svelte-uiimm6 .halo.svelte-uiimm6{transform:scale(0);z-index:-1;position:absolute;top:-60px;left:-60px;width:120px;height:120px;border-radius:9999px;background-color:var(--color);opacity:0.25;transition:transform 100ms ease-out;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-uiimm6 .halo[data-show="true"].svelte-uiimm6{transform:scale(1)}')}function jr(i,e,t){const n=i.slice();return n[29]=e[t],n[30]=e,n[31]=t,n}function Vr(i){let e,t=[],n=new Map,s=Gs(Object.values(i[1]));const r=a=>a[29].id;for(let a=0;a<s.length;a+=1){let o=jr(i,s,a),c=r(o);n.set(c,t[a]=$r(c,o))}return{c(){e=Ye("div");for(let a=0;a<t.length;a+=1)t[a].c();z(e,"id","users-container"),z(e,"class","svelte-uiimm6")},m(a,o){Nn(a,e,o);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null)},p(a,o){o[0]&15&&(s=Gs(Object.values(a[1])),t=ic(t,o,r,1,a,s,n,e,tc,$r,null,jr))},d(a){a&&nn(e);for(let o=0;o<t.length;o+=1)t[o].d()}}}function $r(i,e){let t,n,s,r,a,o,c,u,d=e[29],h,f,p=e[29].name+"",b,T,w,_,M,Q,j,he;const ae=()=>e[13](c,d),q=()=>e[13](null,d);return{key:i,first:null,c(){t=Ye("div"),n=Hs("svg"),s=Hs("path"),r=cn(),a=Ye("div"),o=Ye("div"),c=Ye("video"),h=cn(),f=Ye("div"),b=Wr(p),w=cn(),_=Ye("div"),Q=cn(),z(s,"d","M2.2706 0.0593359L25.4277 8.05957H25.45926C25.65896 8.13153 25.83096 8.25952 25.95221 8.42653C26.07357 8.59354 26.13851 8.79166 26.13851 8.99459C26.13851 9.19751 26.07357 9.39564 25.95221 9.56265C25.83096 9.72966 25.65896 9.85765 25.45926 9.92962L15.3543 13.7698L11.3124 23.37C11.2344 23.5561 11.0994 23.7156 10.9248 23.828C10.7503 23.9402 10.5443 24.0002 10.3335 24C10.1172 24 9.9061 23.9365 9.7291 23.8184C9.552 23.7004 9.4176 23.5332 9.344 23.34L0.9233 1.33937C0.8555 1.16076 0.8426 0.967504 0.8861 0.782189C0.9297 0.596873 1.0278 0.427163 1.1691 0.292901C1.3105 0.158639 1.4891 0.0653762 1.6841 0.0240151C1.8792 -0.0173461 2.0826 -0.00509504 2.2706 0.0593359Z"),z(n,"width","23"),z(n,"viewBox","0 0 27 24"),z(n,"fill","currentColor"),z(n,"aria-hidden","true"),z(n,"xmlns","http://www.w3.org/2000/svg"),z(n,"class","cursor svelte-uiimm6"),z(c,"id",u=`user-video-${e[29].id}`),z(c,"class","svelte-uiimm6"),z(o,"id","video-container"),z(o,"class","svelte-uiimm6"),z(f,"class","user-name svelte-uiimm6"),z(a,"class","user-label svelte-uiimm6"),z(a,"data-hidevideo",T=!e[29].camera_enabled),z(_,"class","halo svelte-uiimm6"),z(_,"data-show",M=(e[29].id==e[0].id&&e[29].is_shift_key_down||e[29].id!=e[0].id&&(e[29].is_shift_key_down||e[29].is_mouse_down))&&e[3]>1),z(t,"id",j="user-"+e[29].id),z(t,"class","user svelte-uiimm6"),z(t,"data-isself",he=e[29].id==e[0].id),hi(t,"--color",e[29].color),hi(t,"--x",parseFloat(e[29].x)+"vw"),hi(t,"--y",parseFloat(e[29].y)+"vh"),this.first=t},m(K,A){Nn(K,t,A),Ne(t,n),Ne(n,s),Ne(t,r),Ne(t,a),Ne(a,o),Ne(o,c),ae(),Ne(a,h),Ne(a,f),Ne(f,b),Ne(t,w),Ne(t,_),Ne(t,Q)},p(K,A){e=K,A[0]&2&&u!==(u=`user-video-${e[29].id}`)&&z(c,"id",u),d!==e[29]&&(q(),d=e[29],ae()),A[0]&2&&p!==(p=e[29].name+"")&&Wo(b,p),A[0]&2&&T!==(T=!e[29].camera_enabled)&&z(a,"data-hidevideo",T),A[0]&11&&M!==(M=(e[29].id==e[0].id&&e[29].is_shift_key_down||e[29].id!=e[0].id&&(e[29].is_shift_key_down||e[29].is_mouse_down))&&e[3]>1)&&z(_,"data-show",M),A[0]&2&&j!==(j="user-"+e[29].id)&&z(t,"id",j),A[0]&3&&he!==(he=e[29].id==e[0].id)&&z(t,"data-isself",he),A[0]&2&&hi(t,"--color",e[29].color),A[0]&2&&hi(t,"--x",parseFloat(e[29].x)+"vw"),A[0]&2&&hi(t,"--y",parseFloat(e[29].y)+"vh")},d(K){K&&nn(t),q()}}}function Dl(i){let e,t=i[0]&&i[1]&&Vr(i);return{c(){e=Ye("div"),t&&t.c(),z(e,"id","liveroom-client-element"),z(e,"class","svelte-uiimm6")},m(n,s){Nn(n,e,s),t&&t.m(e,null)},p(n,s){n[0]&&n[1]?t?t.p(n,s):(t=Vr(n),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},i:Gi,o:Gi,d(n){n&&nn(e),t&&t.d()}}}function _s(i,e){if(i.tagName==="BODY")return window;const{overflowY:t,overflowX:n}=getComputedStyle(i);return e==="vertical"&&["auto","scroll"].includes(t)&&i.scrollHeight>i.clientHeight||e==="horizontal"&&["auto","scroll"].includes(n)&&i.scrollWidth>i.clientWidth?i:i.parentElement?_s(i.parentElement,e):window}function Ml(i,e,t){let{version:n}=e,{url:s}=e,{room_id:r}=e,{user_name:a=void 0}=e,{user_color:o=void 0}=e,c,u,d=!1,h=Ll(),f=Nl(),p,b,T,w,_={},M;zo(async()=>{console.log(`[Liveroom] Starting in room '${r}' (user name: '${a}')... (v${n})`),j()}),Ko(()=>{he(),di()});async function Q(){if(console.log("[LiveKit] Beginning setup..."),t(9,u=new wo({dynacast:!0}).on(P.TrackSubscribed,async(O,oe,ce)=>{switch(console.log("[LiveKit] Track Subscribed",O,oe,ce),console.table({identity:ce.identity,source:oe.source}),oe.source){case C.Source.Camera:{const Ae=_[ce.identity];Ae&&(console.log(`[LiveKit] Attaching user camera (identity ${ce.identity})`),O.attach(Ae));break}}})),console.log("[LiveKit] Created room",u.name),!T)throw new Error("LiveKit websocket URL not set");if(!w)throw new Error("LiveKit token not set");console.log(`[LiveKit] Connecting to '${T}'...`),await u.connect(T,w,{autoSubscribe:!0}),console.log("[LiveKit] Connected to room",u.name),await Promise.all([u.localParticipant.enableCameraAndMicrophone().then(()=>console.log("[LiveKit] Local camera & mic enabled")).then(async()=>{var Ae,Oe,Z;const O=(Oe=(Ae=u==null?void 0:u.localParticipant)==null?void 0:Ae.videoTracks)==null?void 0:Oe.values(),oe=O&&((Z=Array.from(O)[0])==null?void 0:Z.track),ce=p&&_[p.id];ce&&oe&&(console.log("[LiveKit] Attaching local user camera"),oe.attach(ce))})])}function j(){c=new uu({url:s,topic:`liveroom-livestate:${r}`,params:{room_id:r,user_name:a,user_color:o,referrer:document.referrer,current_url:window.location.href,inner_width:window.innerWidth,inner_height:window.innerHeight,language:window.navigator.language,user_agent:window.navigator.userAgent},socketOptions:{logger:null}}),c.addEventListener("wheel-from-another-user",({detail:{delta_x:O,delta_y:oe,x:ce,y:Ae}})=>{const Oe=parseInt(O),Z=parseInt(oe),gt=new WheelEvent("wheel",{view:window,bubbles:!0,cancelable:!0,clientX:window.innerWidth*parseFloat(ce)/100,clientY:window.innerHeight*parseFloat(Ae)/100,deltaX:Oe,deltaY:Z,deltaMode:0}),on=document.head.contains(f);on&&document.head.removeChild(f);const ie=document.elementFromPoint(gt.clientX,gt.clientY);on&&document.head.appendChild(f),(ie instanceof HTMLElement||ie instanceof SVGElement)&&(Math.abs(Z)>=Math.abs(Oe)?_s(ie,"vertical").scrollBy({top:Z,left:0,behavior:"instant"}):_s(ie,"horizontal").scrollBy({top:0,left:Oe,behavior:"instant"}))}),c.addEventListener("click-from-another-user",({detail:{x:O,y:oe}})=>{const ce=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0,clientX:window.innerWidth*parseFloat(O)/100,clientY:window.innerHeight*parseFloat(oe)/100}),Ae=document.head.contains(f);Ae&&document.head.removeChild(f);const Oe=document.elementFromPoint(ce.clientX,ce.clientY);Ae&&document.head.appendChild(f),(Oe instanceof HTMLElement||Oe instanceof SVGElement)&&Oe.dispatchEvent(ce)}),c.addEventListener("livestate-change",({detail:{state:O}})=>{var oe,ce;(oe=O==null?void 0:O.me)!=null&&oe.name&&O.me.name!=(p==null?void 0:p.name)&&(sessionStorage==null||sessionStorage.setItem($s.SESSION_STORAGE_KEY_USER_NAME,O.me.name)),(ce=O==null?void 0:O.me)!=null&&ce.color&&O.me.color!=(p==null?void 0:p.color)&&(sessionStorage==null||sessionStorage.setItem($s.SESSION_STORAGE_KEY_USER_COLOR,O.me.color)),t(4,r=O.room_id),t(0,p=O.me),t(1,b=O.users),t(11,T=O.livekit_ws_url),t(12,w=O.livekit_token)}),c.connect(),window.addEventListener("mousemove",ae),window.addEventListener("mousedown",q),window.addEventListener("mouseup",K),window.addEventListener("keydown",F),window.addEventListener("keyup",fe),window.addEventListener("resize",Ie)}function he(){window.removeEventListener("resize",Ie),window.removeEventListener("keyup",fe),window.removeEventListener("keydown",F),window.removeEventListener("mouseup",K),window.removeEventListener("mousedown",q),window.removeEventListener("mousemove",ae),c==null||c.disconnect(),c=void 0,u==null||u.disconnect(),t(9,u=void 0)}function ae(O){c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("mouse_move",{detail:{user_id:p.id,x:Number(O.clientX/window.innerWidth*100).toFixed(2),y:Number(O.clientY/window.innerHeight*100).toFixed(2)}}))}function q(){c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("mouse_down",{detail:{user_id:p.id}}))}function K(){c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("mouse_up",{detail:{user_id:p.id}}))}const A=["Shift"];function F(O){!O.repeat&&A.includes(O.key)&&c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("key_down",{detail:{key:O.key,user_id:p.id}}))}function fe(O){A.includes(O.key)&&c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("key_up",{detail:{key:O.key,user_id:p.id}}))}function Ie(){c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("window_resize",{detail:{inner_width:window.innerWidth,inner_height:window.innerHeight,user_id:p.id}}))}function rn(){document.head.appendChild(h),document.head.appendChild(f),t(10,d=!0)}function di(){document.head.removeChild(h),document.head.removeChild(f),t(10,d=!1)}function an(O,oe){is[O?"unshift":"push"](()=>{_[oe.id]=O,t(2,_)})}return i.$$set=O=>{"version"in O&&t(5,n=O.version),"url"in O&&t(6,s=O.url),"room_id"in O&&t(4,r=O.room_id),"user_name"in O&&t(7,a=O.user_name),"user_color"in O&&t(8,o=O.user_color)},i.$$.update=()=>{i.$$.dirty[0]&6659&&!u&&p&&b&&T&&w&&Q(),i.$$.dirty[0]&2&&t(3,M=Object.keys(b||{}).length),i.$$.dirty[0]&1026&&!d&&b&&Object.values(b).some(O=>O.type=="admin"&&O.is_space_key_down)&&rn(),i.$$.dirty[0]&1026&&d&&b&&Object.values(b).filter(O=>O.type=="admin").every(O=>!O.is_space_key_down)&&di()},[p,b,_,M,r,n,s,a,o,u,d,T,w,an]}class Po extends cc{constructor(e){super(),ac(this,e,Ml,Dl,Jo,{version:5,url:6,room_id:4,user_name:7,user_color:8},xl,[-1,-1])}get version(){return this.$$.ctx[5]}set version(e){this.$$set({version:e}),ii()}get url(){return this.$$.ctx[6]}set url(e){this.$$set({url:e}),ii()}get room_id(){return this.$$.ctx[4]}set room_id(e){this.$$set({room_id:e}),ii()}get user_name(){return this.$$.ctx[7]}set user_name(e){this.$$set({user_name:e}),ii()}get user_color(){return this.$$.ctx[8]}set user_color(e){this.$$set({user_color:e}),ii()}}customElements.define("liveroom-client-element",oc(Po,{version:{},url:{},room_id:{},user_name:{},user_color:{}},[],[],!0));module.exports=Po;
60
+ `,i}function xl(i){Vo(i,"svelte-1g24uwa",'#liveroom-client-element.svelte-1g24uwa.svelte-1g24uwa{font-family:Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;line-height:1.5;font-weight:400;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}#users-container.svelte-1g24uwa.svelte-1g24uwa{z-index:99999;position:fixed;inset:0;overflow:hidden;pointer-events:none}.user.svelte-1g24uwa.svelte-1g24uwa{z-index:10;position:absolute;top:0;left:0;user-select:none;transform:translate(var(--x), var(--y));transition:transform 100ms linear;will-change:transform}.user.svelte-1g24uwa .cursor.svelte-1g24uwa{position:absolute;top:0;left:0;color:var(--color);transform-origin:top left;transform:rotate(6deg)}.user[data-isself="true"].svelte-1g24uwa .cursor.svelte-1g24uwa{display:none}.user-label.svelte-1g24uwa.svelte-1g24uwa{font-weight:600;color:black;background-color:var(--color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:9999px;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-1g24uwa .user-label.svelte-1g24uwa{display:flex;flex-direction:column;justify-content:center;align-items:center}.user.svelte-1g24uwa .user-label[data-hidevideo="true"].svelte-1g24uwa{position:absolute;top:20px;left:16px}.user.svelte-1g24uwa .user-label[data-hidevideo="false"].svelte-1g24uwa{position:relative;margin:12px 6px}.user[data-isself="true"].svelte-1g24uwa .user-label.svelte-1g24uwa{display:none}.user-label.svelte-1g24uwa .user-name.svelte-1g24uwa{display:flex;justify-content:center;align-items:center;background-color:var(--color);font-size:0.7rem}.user.svelte-1g24uwa .user-label[data-hidevideo="true"] .user-name.svelte-1g24uwa{padding:0.15rem 0.5rem}.user.svelte-1g24uwa .user-label[data-hidevideo="false"] .user-name.svelte-1g24uwa{position:absolute;inset-inline:0;bottom:-2px;padding:0.15rem 0.5rem 0.35rem 0.5rem}.user.svelte-1g24uwa .user-label #video-container.svelte-1g24uwa{height:7rem;width:7rem;overflow:hidden;display:flex;justify-content:center;align-items:center}.user.svelte-1g24uwa .user-label[data-hidevideo="true"] #video-container.svelte-1g24uwa{display:none}.user.svelte-1g24uwa .user-label #video-container video.svelte-1g24uwa{height:100%;aspect-ratio:16 / 9;transform:scaleX(-1);margin-bottom:30px}.user.svelte-1g24uwa .halo.svelte-1g24uwa{transform:scale(0);z-index:-1;position:absolute;top:-60px;left:-60px;width:120px;height:120px;border-radius:9999px;background-color:var(--color);opacity:0.25;transition:transform 100ms ease-out;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-1g24uwa .halo[data-show="true"].svelte-1g24uwa{transform:scale(1)}')}function jr(i,e,t){const n=i.slice();return n[29]=e[t],n[30]=e,n[31]=t,n}function Vr(i){let e,t=[],n=new Map,s=Gs(Object.values(i[1]));const r=a=>a[29].id;for(let a=0;a<s.length;a+=1){let o=jr(i,s,a),c=r(o);n.set(c,t[a]=$r(c,o))}return{c(){e=Ye("div");for(let a=0;a<t.length;a+=1)t[a].c();z(e,"id","users-container"),z(e,"class","svelte-1g24uwa")},m(a,o){Nn(a,e,o);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null)},p(a,o){o[0]&15&&(s=Gs(Object.values(a[1])),t=ic(t,o,r,1,a,s,n,e,tc,$r,null,jr))},d(a){a&&nn(e);for(let o=0;o<t.length;o+=1)t[o].d()}}}function $r(i,e){let t,n,s,r,a,o,c,u,d=e[29],h,f,p=e[29].name+"",b,T,w,_,M,Q,j,he;const ae=()=>e[13](c,d),q=()=>e[13](null,d);return{key:i,first:null,c(){t=Ye("div"),n=Hs("svg"),s=Hs("path"),r=cn(),a=Ye("div"),o=Ye("div"),c=Ye("video"),h=cn(),f=Ye("div"),b=Wr(p),w=cn(),_=Ye("div"),Q=cn(),z(s,"d","M2.2706 0.0593359L25.4277 8.05957H25.45926C25.65896 8.13153 25.83096 8.25952 25.95221 8.42653C26.07357 8.59354 26.13851 8.79166 26.13851 8.99459C26.13851 9.19751 26.07357 9.39564 25.95221 9.56265C25.83096 9.72966 25.65896 9.85765 25.45926 9.92962L15.3543 13.7698L11.3124 23.37C11.2344 23.5561 11.0994 23.7156 10.9248 23.828C10.7503 23.9402 10.5443 24.0002 10.3335 24C10.1172 24 9.9061 23.9365 9.7291 23.8184C9.552 23.7004 9.4176 23.5332 9.344 23.34L0.9233 1.33937C0.8555 1.16076 0.8426 0.967504 0.8861 0.782189C0.9297 0.596873 1.0278 0.427163 1.1691 0.292901C1.3105 0.158639 1.4891 0.0653762 1.6841 0.0240151C1.8792 -0.0173461 2.0826 -0.00509504 2.2706 0.0593359Z"),z(n,"width","23"),z(n,"viewBox","0 0 27 24"),z(n,"fill","currentColor"),z(n,"aria-hidden","true"),z(n,"xmlns","http://www.w3.org/2000/svg"),z(n,"class","cursor svelte-1g24uwa"),z(c,"id",u=`user-video-${e[29].id}`),z(c,"class","svelte-1g24uwa"),z(o,"id","video-container"),z(o,"class","svelte-1g24uwa"),z(f,"class","user-name svelte-1g24uwa"),z(a,"class","user-label svelte-1g24uwa"),z(a,"data-hidevideo",T=!e[29].camera_enabled),z(_,"class","halo svelte-1g24uwa"),z(_,"data-show",M=(e[29].id==e[0].id&&e[29].is_shift_key_down||e[29].id!=e[0].id&&(e[29].is_shift_key_down||e[29].is_mouse_down))&&e[3]>1),z(t,"id",j="user-"+e[29].id),z(t,"class","user svelte-1g24uwa"),z(t,"data-isself",he=e[29].id==e[0].id),hi(t,"--color",e[29].color),hi(t,"--x",parseFloat(e[29].x)+"vw"),hi(t,"--y",parseFloat(e[29].y)+"vh"),this.first=t},m(K,A){Nn(K,t,A),Ne(t,n),Ne(n,s),Ne(t,r),Ne(t,a),Ne(a,o),Ne(o,c),ae(),Ne(a,h),Ne(a,f),Ne(f,b),Ne(t,w),Ne(t,_),Ne(t,Q)},p(K,A){e=K,A[0]&2&&u!==(u=`user-video-${e[29].id}`)&&z(c,"id",u),d!==e[29]&&(q(),d=e[29],ae()),A[0]&2&&p!==(p=e[29].name+"")&&Wo(b,p),A[0]&2&&T!==(T=!e[29].camera_enabled)&&z(a,"data-hidevideo",T),A[0]&11&&M!==(M=(e[29].id==e[0].id&&e[29].is_shift_key_down||e[29].id!=e[0].id&&(e[29].is_shift_key_down||e[29].is_mouse_down))&&e[3]>1)&&z(_,"data-show",M),A[0]&2&&j!==(j="user-"+e[29].id)&&z(t,"id",j),A[0]&3&&he!==(he=e[29].id==e[0].id)&&z(t,"data-isself",he),A[0]&2&&hi(t,"--color",e[29].color),A[0]&2&&hi(t,"--x",parseFloat(e[29].x)+"vw"),A[0]&2&&hi(t,"--y",parseFloat(e[29].y)+"vh")},d(K){K&&nn(t),q()}}}function Dl(i){let e,t=i[0]&&i[1]&&Vr(i);return{c(){e=Ye("div"),t&&t.c(),z(e,"id","liveroom-client-element"),z(e,"class","svelte-1g24uwa")},m(n,s){Nn(n,e,s),t&&t.m(e,null)},p(n,s){n[0]&&n[1]?t?t.p(n,s):(t=Vr(n),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},i:Gi,o:Gi,d(n){n&&nn(e),t&&t.d()}}}function _s(i,e){if(i.tagName==="BODY")return window;const{overflowY:t,overflowX:n}=getComputedStyle(i);return e==="vertical"&&["auto","scroll"].includes(t)&&i.scrollHeight>i.clientHeight||e==="horizontal"&&["auto","scroll"].includes(n)&&i.scrollWidth>i.clientWidth?i:i.parentElement?_s(i.parentElement,e):window}function Ml(i,e,t){let{version:n}=e,{url:s}=e,{room_id:r}=e,{user_name:a=void 0}=e,{user_color:o=void 0}=e,c,u,d=!1,h=Ll(),f=Nl(),p,b,T,w,_={},M;zo(async()=>{console.log(`[Liveroom] Starting in room '${r}' (user name: '${a}')... (v${n})`),j()}),Ko(()=>{he(),di()});async function Q(){if(console.log("[LiveKit] Beginning setup..."),t(9,u=new wo({dynacast:!0}).on(P.TrackSubscribed,async(O,oe,ce)=>{switch(console.log("[LiveKit] Track Subscribed",O,oe,ce),console.table({identity:ce.identity,source:oe.source}),oe.source){case C.Source.Camera:{const Ae=_[ce.identity];Ae&&(console.log(`[LiveKit] Attaching user camera (identity ${ce.identity})`),O.attach(Ae));break}}})),console.log("[LiveKit] Created room",u.name),!T)throw new Error("LiveKit websocket URL not set");if(!w)throw new Error("LiveKit token not set");console.log(`[LiveKit] Connecting to '${T}'...`),await u.connect(T,w,{autoSubscribe:!0}),console.log("[LiveKit] Connected to room",u.name),await Promise.all([u.localParticipant.enableCameraAndMicrophone().then(()=>console.log("[LiveKit] Local camera & mic enabled")).then(async()=>{var Ae,Oe,Z;const O=(Oe=(Ae=u==null?void 0:u.localParticipant)==null?void 0:Ae.videoTracks)==null?void 0:Oe.values(),oe=O&&((Z=Array.from(O)[0])==null?void 0:Z.track),ce=p&&_[p.id];ce&&oe&&(console.log("[LiveKit] Attaching local user camera"),oe.attach(ce))})])}function j(){c=new uu({url:s,topic:`liveroom-livestate:${r}`,params:{room_id:r,user_name:a,user_color:o,referrer:document.referrer,current_url:window.location.href,inner_width:window.innerWidth,inner_height:window.innerHeight,language:window.navigator.language,user_agent:window.navigator.userAgent},socketOptions:{logger:null}}),c.addEventListener("wheel-from-another-user",({detail:{delta_x:O,delta_y:oe,x:ce,y:Ae}})=>{const Oe=parseInt(O),Z=parseInt(oe),gt=new WheelEvent("wheel",{view:window,bubbles:!0,cancelable:!0,clientX:window.innerWidth*parseFloat(ce)/100,clientY:window.innerHeight*parseFloat(Ae)/100,deltaX:Oe,deltaY:Z,deltaMode:0}),on=document.head.contains(f);on&&document.head.removeChild(f);const ie=document.elementFromPoint(gt.clientX,gt.clientY);on&&document.head.appendChild(f),(ie instanceof HTMLElement||ie instanceof SVGElement)&&(Math.abs(Z)>=Math.abs(Oe)?_s(ie,"vertical").scrollBy({top:Z,left:0,behavior:"instant"}):_s(ie,"horizontal").scrollBy({top:0,left:Oe,behavior:"instant"}))}),c.addEventListener("click-from-another-user",({detail:{x:O,y:oe}})=>{const ce=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0,clientX:window.innerWidth*parseFloat(O)/100,clientY:window.innerHeight*parseFloat(oe)/100}),Ae=document.head.contains(f);Ae&&document.head.removeChild(f);const Oe=document.elementFromPoint(ce.clientX,ce.clientY);Ae&&document.head.appendChild(f),(Oe instanceof HTMLElement||Oe instanceof SVGElement)&&Oe.dispatchEvent(ce)}),c.addEventListener("livestate-change",({detail:{state:O}})=>{var oe,ce;(oe=O==null?void 0:O.me)!=null&&oe.name&&O.me.name!=(p==null?void 0:p.name)&&(sessionStorage==null||sessionStorage.setItem($s.SESSION_STORAGE_KEY_USER_NAME,O.me.name)),(ce=O==null?void 0:O.me)!=null&&ce.color&&O.me.color!=(p==null?void 0:p.color)&&(sessionStorage==null||sessionStorage.setItem($s.SESSION_STORAGE_KEY_USER_COLOR,O.me.color)),t(4,r=O.room_id),t(0,p=O.me),t(1,b=O.users),t(11,T=O.livekit_ws_url),t(12,w=O.livekit_token)}),c.connect(),window.addEventListener("mousemove",ae),window.addEventListener("mousedown",q),window.addEventListener("mouseup",K),window.addEventListener("keydown",F),window.addEventListener("keyup",fe),window.addEventListener("resize",Ie)}function he(){window.removeEventListener("resize",Ie),window.removeEventListener("keyup",fe),window.removeEventListener("keydown",F),window.removeEventListener("mouseup",K),window.removeEventListener("mousedown",q),window.removeEventListener("mousemove",ae),c==null||c.disconnect(),c=void 0,u==null||u.disconnect(),t(9,u=void 0)}function ae(O){c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("mouse_move",{detail:{user_id:p.id,x:Number(O.clientX/window.innerWidth*100).toFixed(2),y:Number(O.clientY/window.innerHeight*100).toFixed(2)}}))}function q(){c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("mouse_down",{detail:{user_id:p.id}}))}function K(){c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("mouse_up",{detail:{user_id:p.id}}))}const A=["Shift"];function F(O){!O.repeat&&A.includes(O.key)&&c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("key_down",{detail:{key:O.key,user_id:p.id}}))}function fe(O){A.includes(O.key)&&c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("key_up",{detail:{key:O.key,user_id:p.id}}))}function Ie(){c&&(p!=null&&p.id)&&c.dispatchEvent(new CustomEvent("window_resize",{detail:{inner_width:window.innerWidth,inner_height:window.innerHeight,user_id:p.id}}))}function rn(){document.head.appendChild(h),document.head.appendChild(f),t(10,d=!0)}function di(){document.head.removeChild(h),document.head.removeChild(f),t(10,d=!1)}function an(O,oe){is[O?"unshift":"push"](()=>{_[oe.id]=O,t(2,_)})}return i.$$set=O=>{"version"in O&&t(5,n=O.version),"url"in O&&t(6,s=O.url),"room_id"in O&&t(4,r=O.room_id),"user_name"in O&&t(7,a=O.user_name),"user_color"in O&&t(8,o=O.user_color)},i.$$.update=()=>{i.$$.dirty[0]&6659&&!u&&p&&b&&T&&w&&Q(),i.$$.dirty[0]&2&&t(3,M=Object.keys(b||{}).length),i.$$.dirty[0]&1026&&!d&&b&&Object.values(b).some(O=>O.type=="admin"&&O.is_space_key_down)&&rn(),i.$$.dirty[0]&1026&&d&&b&&Object.values(b).filter(O=>O.type=="admin").every(O=>!O.is_space_key_down)&&di()},[p,b,_,M,r,n,s,a,o,u,d,T,w,an]}class Po extends cc{constructor(e){super(),ac(this,e,Ml,Dl,Jo,{version:5,url:6,room_id:4,user_name:7,user_color:8},xl,[-1,-1])}get version(){return this.$$.ctx[5]}set version(e){this.$$set({version:e}),ii()}get url(){return this.$$.ctx[6]}set url(e){this.$$set({url:e}),ii()}get room_id(){return this.$$.ctx[4]}set room_id(e){this.$$set({room_id:e}),ii()}get user_name(){return this.$$.ctx[7]}set user_name(e){this.$$set({user_name:e}),ii()}get user_color(){return this.$$.ctx[8]}set user_color(e){this.$$set({user_color:e}),ii()}}customElements.define("liveroom-client-element",oc(Po,{version:{},url:{},room_id:{},user_name:{},user_color:{}},[],[],!0));module.exports=Po;
@@ -1,7 +1,7 @@
1
1
  var Mo = Object.defineProperty;
2
2
  var Uo = (i, e, t) => e in i ? Mo(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var x = (i, e, t) => (Uo(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { a as Fo, c as Bo } from "./constants-0103de6d.js";
4
+ import { a as Fo, c as Bo } from "./constants-71d35493.js";
5
5
  function Gi() {
6
6
  }
7
7
  function $r(i) {
@@ -16730,7 +16730,7 @@ function Nl() {
16730
16730
  `, i;
16731
16731
  }
16732
16732
  function xl(i) {
16733
- Vo(i, "svelte-uiimm6", '#liveroom-client-element.svelte-uiimm6.svelte-uiimm6{font-family:Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;line-height:1.5;font-weight:400;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}#users-container.svelte-uiimm6.svelte-uiimm6{z-index:99999;position:fixed;inset:0;overflow:hidden;pointer-events:none}.user.svelte-uiimm6.svelte-uiimm6{z-index:10;position:absolute;top:0;left:0;user-select:none;transform:translate(var(--x), var(--y));transition:transform 100ms linear;will-change:transform}.user.svelte-uiimm6 .cursor.svelte-uiimm6{position:absolute;top:0;left:0;color:var(--color);transform-origin:top left;transform:rotate(6deg)}.user[data-isself="true"].svelte-uiimm6 .cursor.svelte-uiimm6{display:none}.user-label.svelte-uiimm6.svelte-uiimm6{font-weight:600;color:black;background-color:var(--color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:9999px;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-uiimm6 .user-label.svelte-uiimm6{display:flex;flex-direction:column;justify-content:center;align-items:center}.user.svelte-uiimm6 .user-label[data-hidevideo="true"].svelte-uiimm6{position:absolute;top:20px;left:16px}.user.svelte-uiimm6 .user-label[data-hidevideo="false"].svelte-uiimm6{position:relative;margin:12px 6px}.user[data-isself="true"].svelte-uiimm6 .user-label.svelte-uiimm6{display:none}.user-label.svelte-uiimm6 .user-name.svelte-uiimm6{display:flex;justify-content:center;align-items:center;background-color:var(--color);font-size:0.7rem}.user.svelte-uiimm6 .user-label[data-hidevideo="true"] .user-name.svelte-uiimm6{padding:0.15rem 0.5rem}.user.svelte-uiimm6 .user-label[data-hidevideo="false"] .user-name.svelte-uiimm6{position:absolute;inset-inline:0;bottom:-2px;padding:0.15rem 0.5rem 0.35rem 0.5rem}.user.svelte-uiimm6 .user-label #video-container.svelte-uiimm6{height:7rem;width:7rem;overflow:hidden;display:flex;justify-content:center;align-items:center}.user.svelte-uiimm6 .user-label[data-hidevideo="true"] #video-container.svelte-uiimm6{display:none}.user.svelte-uiimm6 .user-label #video-container video.svelte-uiimm6{height:100%;aspect-ratio:16 / 9;transform:scaleX(-1)}.user.svelte-uiimm6 .halo.svelte-uiimm6{transform:scale(0);z-index:-1;position:absolute;top:-60px;left:-60px;width:120px;height:120px;border-radius:9999px;background-color:var(--color);opacity:0.25;transition:transform 100ms ease-out;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-uiimm6 .halo[data-show="true"].svelte-uiimm6{transform:scale(1)}');
16733
+ Vo(i, "svelte-1g24uwa", '#liveroom-client-element.svelte-1g24uwa.svelte-1g24uwa{font-family:Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;line-height:1.5;font-weight:400;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}#users-container.svelte-1g24uwa.svelte-1g24uwa{z-index:99999;position:fixed;inset:0;overflow:hidden;pointer-events:none}.user.svelte-1g24uwa.svelte-1g24uwa{z-index:10;position:absolute;top:0;left:0;user-select:none;transform:translate(var(--x), var(--y));transition:transform 100ms linear;will-change:transform}.user.svelte-1g24uwa .cursor.svelte-1g24uwa{position:absolute;top:0;left:0;color:var(--color);transform-origin:top left;transform:rotate(6deg)}.user[data-isself="true"].svelte-1g24uwa .cursor.svelte-1g24uwa{display:none}.user-label.svelte-1g24uwa.svelte-1g24uwa{font-weight:600;color:black;background-color:var(--color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:9999px;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-1g24uwa .user-label.svelte-1g24uwa{display:flex;flex-direction:column;justify-content:center;align-items:center}.user.svelte-1g24uwa .user-label[data-hidevideo="true"].svelte-1g24uwa{position:absolute;top:20px;left:16px}.user.svelte-1g24uwa .user-label[data-hidevideo="false"].svelte-1g24uwa{position:relative;margin:12px 6px}.user[data-isself="true"].svelte-1g24uwa .user-label.svelte-1g24uwa{display:none}.user-label.svelte-1g24uwa .user-name.svelte-1g24uwa{display:flex;justify-content:center;align-items:center;background-color:var(--color);font-size:0.7rem}.user.svelte-1g24uwa .user-label[data-hidevideo="true"] .user-name.svelte-1g24uwa{padding:0.15rem 0.5rem}.user.svelte-1g24uwa .user-label[data-hidevideo="false"] .user-name.svelte-1g24uwa{position:absolute;inset-inline:0;bottom:-2px;padding:0.15rem 0.5rem 0.35rem 0.5rem}.user.svelte-1g24uwa .user-label #video-container.svelte-1g24uwa{height:7rem;width:7rem;overflow:hidden;display:flex;justify-content:center;align-items:center}.user.svelte-1g24uwa .user-label[data-hidevideo="true"] #video-container.svelte-1g24uwa{display:none}.user.svelte-1g24uwa .user-label #video-container video.svelte-1g24uwa{height:100%;aspect-ratio:16 / 9;transform:scaleX(-1);margin-bottom:30px}.user.svelte-1g24uwa .halo.svelte-1g24uwa{transform:scale(0);z-index:-1;position:absolute;top:-60px;left:-60px;width:120px;height:120px;border-radius:9999px;background-color:var(--color);opacity:0.25;transition:transform 100ms ease-out;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-1g24uwa .halo[data-show="true"].svelte-1g24uwa{transform:scale(1)}');
16734
16734
  }
16735
16735
  function Jr(i, e, t) {
16736
16736
  const n = i.slice();
@@ -16754,7 +16754,7 @@ function jr(i) {
16754
16754
  e = Ye("div");
16755
16755
  for (let a = 0; a < t.length; a += 1)
16756
16756
  t[a].c();
16757
- z(e, "id", "users-container"), z(e, "class", "svelte-uiimm6");
16757
+ z(e, "id", "users-container"), z(e, "class", "svelte-1g24uwa");
16758
16758
  },
16759
16759
  m(a, o) {
16760
16760
  Nn(a, e, o);
@@ -16794,9 +16794,9 @@ function Vr(i, e) {
16794
16794
  key: i,
16795
16795
  first: null,
16796
16796
  c() {
16797
- t = Ye("div"), n = qs("svg"), s = qs("path"), r = cn(), a = Ye("div"), o = Ye("div"), c = Ye("video"), h = cn(), f = Ye("div"), b = Hr(p), w = cn(), _ = Ye("div"), Q = cn(), z(s, "d", "M2.2706 0.0593359L25.4277 8.05957H25.45926C25.65896 8.13153 25.83096 8.25952 25.95221 8.42653C26.07357 8.59354 26.13851 8.79166 26.13851 8.99459C26.13851 9.19751 26.07357 9.39564 25.95221 9.56265C25.83096 9.72966 25.65896 9.85765 25.45926 9.92962L15.3543 13.7698L11.3124 23.37C11.2344 23.5561 11.0994 23.7156 10.9248 23.828C10.7503 23.9402 10.5443 24.0002 10.3335 24C10.1172 24 9.9061 23.9365 9.7291 23.8184C9.552 23.7004 9.4176 23.5332 9.344 23.34L0.9233 1.33937C0.8555 1.16076 0.8426 0.967504 0.8861 0.782189C0.9297 0.596873 1.0278 0.427163 1.1691 0.292901C1.3105 0.158639 1.4891 0.0653762 1.6841 0.0240151C1.8792 -0.0173461 2.0826 -0.00509504 2.2706 0.0593359Z"), z(n, "width", "23"), z(n, "viewBox", "0 0 27 24"), z(n, "fill", "currentColor"), z(n, "aria-hidden", "true"), z(n, "xmlns", "http://www.w3.org/2000/svg"), z(n, "class", "cursor svelte-uiimm6"), z(c, "id", u = `user-video-${/*user*/
16798
- e[29].id}`), z(c, "class", "svelte-uiimm6"), z(o, "id", "video-container"), z(o, "class", "svelte-uiimm6"), z(f, "class", "user-name svelte-uiimm6"), z(a, "class", "user-label svelte-uiimm6"), z(a, "data-hidevideo", T = !/*user*/
16799
- e[29].camera_enabled), z(_, "class", "halo svelte-uiimm6"), z(_, "data-show", M = /*user*/
16797
+ t = Ye("div"), n = qs("svg"), s = qs("path"), r = cn(), a = Ye("div"), o = Ye("div"), c = Ye("video"), h = cn(), f = Ye("div"), b = Hr(p), w = cn(), _ = Ye("div"), Q = cn(), z(s, "d", "M2.2706 0.0593359L25.4277 8.05957H25.45926C25.65896 8.13153 25.83096 8.25952 25.95221 8.42653C26.07357 8.59354 26.13851 8.79166 26.13851 8.99459C26.13851 9.19751 26.07357 9.39564 25.95221 9.56265C25.83096 9.72966 25.65896 9.85765 25.45926 9.92962L15.3543 13.7698L11.3124 23.37C11.2344 23.5561 11.0994 23.7156 10.9248 23.828C10.7503 23.9402 10.5443 24.0002 10.3335 24C10.1172 24 9.9061 23.9365 9.7291 23.8184C9.552 23.7004 9.4176 23.5332 9.344 23.34L0.9233 1.33937C0.8555 1.16076 0.8426 0.967504 0.8861 0.782189C0.9297 0.596873 1.0278 0.427163 1.1691 0.292901C1.3105 0.158639 1.4891 0.0653762 1.6841 0.0240151C1.8792 -0.0173461 2.0826 -0.00509504 2.2706 0.0593359Z"), z(n, "width", "23"), z(n, "viewBox", "0 0 27 24"), z(n, "fill", "currentColor"), z(n, "aria-hidden", "true"), z(n, "xmlns", "http://www.w3.org/2000/svg"), z(n, "class", "cursor svelte-1g24uwa"), z(c, "id", u = `user-video-${/*user*/
16798
+ e[29].id}`), z(c, "class", "svelte-1g24uwa"), z(o, "id", "video-container"), z(o, "class", "svelte-1g24uwa"), z(f, "class", "user-name svelte-1g24uwa"), z(a, "class", "user-label svelte-1g24uwa"), z(a, "data-hidevideo", T = !/*user*/
16799
+ e[29].camera_enabled), z(_, "class", "halo svelte-1g24uwa"), z(_, "data-show", M = /*user*/
16800
16800
  (e[29].id == /*me*/
16801
16801
  e[0].id && /*user*/
16802
16802
  e[29].is_shift_key_down || /*user*/
@@ -16805,7 +16805,7 @@ function Vr(i, e) {
16805
16805
  (e[29].is_shift_key_down || /*user*/
16806
16806
  e[29].is_mouse_down)) && /*users_count*/
16807
16807
  e[3] > 1), z(t, "id", j = "user-" + /*user*/
16808
- e[29].id), z(t, "class", "user svelte-uiimm6"), z(t, "data-isself", he = /*user*/
16808
+ e[29].id), z(t, "class", "user svelte-1g24uwa"), z(t, "data-isself", he = /*user*/
16809
16809
  e[29].id == /*me*/
16810
16810
  e[0].id), hi(
16811
16811
  t,
@@ -16875,7 +16875,7 @@ function Dl(i) {
16875
16875
  );
16876
16876
  return {
16877
16877
  c() {
16878
- e = Ye("div"), t && t.c(), z(e, "id", "liveroom-client-element"), z(e, "class", "svelte-uiimm6");
16878
+ e = Ye("div"), t && t.c(), z(e, "id", "liveroom-client-element"), z(e, "class", "svelte-1g24uwa");
16879
16879
  },
16880
16880
  m(n, s) {
16881
16881
  Nn(n, e, s), t && t.m(e, null);
package/dist/main.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const s=require("./constants-d9d958c9.cjs"),l=e=>Object.freeze(Object.defineProperty({__proto__:null,default:e},Symbol.toStringTag,{value:"Module"}));let a,n;c();i();function i(){window.addEventListener("popstate",c)}async function c(){const e=document.querySelector("script[src*='/liveroom-client-element']");e==null||e.setAttribute("version",s.VERSION);const t=S(e);if(t&&t!=a){a=t,sessionStorage==null||sessionStorage.setItem(s.SESSION_STORAGE_KEY_ROOM_ID,a),n&&(n.remove(),n=void 0);const o=e==null?void 0:e.getAttribute("data-url");await _(o||"wss://liveroom.app/client_socket",a)}}async function _(e,t){if(!t)return!1;await Promise.resolve().then(()=>l(require("./liveroom-client-element.cjs"))),console.log(`[Liveroom] Installed successfully (v${s.VERSION})`),n=document.createElement(s.ELEMENT_TAG),n.setAttribute("url",e),n.setAttribute("version",s.VERSION),t&&n.setAttribute("room_id",t);const o=m();o&&n.setAttribute("user_name",o);const r=E();return r&&n.setAttribute("user_color",r),document.body.appendChild(n),console.log("[Liveroom] Injected successfully"),!0}function m(){const t=new URLSearchParams(window.location.search).get(s.QUERY_PARAM_KEY_USER_NAME),o=sessionStorage==null?void 0:sessionStorage.getItem(s.SESSION_STORAGE_KEY_USER_NAME);return t||o||null}function E(){const t=new URLSearchParams(window.location.search).get(s.QUERY_PARAM_KEY_USER_COLOR),o=sessionStorage==null?void 0:sessionStorage.getItem(s.SESSION_STORAGE_KEY_USER_COLOR);return t||o||null}function S(e){const o=new URLSearchParams(window.location.search).get(s.QUERY_PARAM_KEY_ROOM_ID),r=sessionStorage==null?void 0:sessionStorage.getItem(s.SESSION_STORAGE_KEY_ROOM_ID),u=(e==null?void 0:e.getAttribute("data-roomid"))||null;return R(o||r||u)}function R(e){const t=e==null?void 0:e.split("https://meet.google.com/"),o=t==null?void 0:t[1];return(o?o.split("?")[0]:t==null?void 0:t[0])||null}
1
+ "use strict";const s=require("./constants-20cb42a4.cjs"),l=e=>Object.freeze(Object.defineProperty({__proto__:null,default:e},Symbol.toStringTag,{value:"Module"}));let a,n;c();i();function i(){window.addEventListener("popstate",c)}async function c(){const e=document.querySelector("script[src*='/liveroom-client-element']");e==null||e.setAttribute("version",s.VERSION);const t=S(e);if(t&&t!=a){a=t,sessionStorage==null||sessionStorage.setItem(s.SESSION_STORAGE_KEY_ROOM_ID,a),n&&(n.remove(),n=void 0);const o=e==null?void 0:e.getAttribute("data-url");await _(o||"wss://liveroom.app/client_socket",a)}}async function _(e,t){if(!t)return!1;await Promise.resolve().then(()=>l(require("./liveroom-client-element.cjs"))),console.log(`[Liveroom] Installed successfully (v${s.VERSION})`),n=document.createElement(s.ELEMENT_TAG),n.setAttribute("url",e),n.setAttribute("version",s.VERSION),t&&n.setAttribute("room_id",t);const o=m();o&&n.setAttribute("user_name",o);const r=E();return r&&n.setAttribute("user_color",r),document.body.appendChild(n),console.log("[Liveroom] Injected successfully"),!0}function m(){const t=new URLSearchParams(window.location.search).get(s.QUERY_PARAM_KEY_USER_NAME),o=sessionStorage==null?void 0:sessionStorage.getItem(s.SESSION_STORAGE_KEY_USER_NAME);return t||o||null}function E(){const t=new URLSearchParams(window.location.search).get(s.QUERY_PARAM_KEY_USER_COLOR),o=sessionStorage==null?void 0:sessionStorage.getItem(s.SESSION_STORAGE_KEY_USER_COLOR);return t||o||null}function S(e){const o=new URLSearchParams(window.location.search).get(s.QUERY_PARAM_KEY_ROOM_ID),r=sessionStorage==null?void 0:sessionStorage.getItem(s.SESSION_STORAGE_KEY_ROOM_ID),u=(e==null?void 0:e.getAttribute("data-roomid"))||null;return R(o||r||u)}function R(e){const t=e==null?void 0:e.split("https://meet.google.com/"),o=t==null?void 0:t[1];return(o?o.split("?")[0]:t==null?void 0:t[0])||null}
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import { V as a, S as c, E as m, Q as l, a as _, b as E, c as S, d as R } from "./constants-0103de6d.js";
1
+ import { V as a, S as c, E as m, Q as l, a as _, b as E, c as S, d as R } from "./constants-71d35493.js";
2
2
  let r, o;
3
3
  u();
4
4
  f();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "liveroom-client-element",
3
3
  "private": false,
4
- "version": "0.0.36",
4
+ "version": "0.0.37",
5
5
  "type": "module",
6
6
  "module": "./dist/main.js",
7
7
  "main": "./dist/main.cjs",