liveroom-client-element 0.0.45 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{constants-C3YM3f23.js → constants-DJD2AXO4.js} +1 -1
- package/dist/{constants-CSWpxxUh.cjs → constants-DfeL-H6H.cjs} +1 -1
- package/dist/liveroom-client-element.cjs +2 -2
- package/dist/liveroom-client-element.js +3 -2
- package/dist/main.cjs +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = "liveroom-client-element", t = "0.0.
|
|
1
|
+
const e = "liveroom-client-element", t = "0.0.46", s = "module", i = "./dist/main.js", o = "./dist/main.cjs", n = [
|
|
2
2
|
"dist",
|
|
3
3
|
"!dist/vite.svg"
|
|
4
4
|
], c = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="liveroom-client-element",t="0.0.
|
|
1
|
+
"use strict";const e="liveroom-client-element",t="0.0.46",i="module",_="./dist/main.js",s="./dist/main.cjs",o=["dist","!dist/vite.svg"],n={".":{import:"./dist/main.js",require:"./dist/main.cjs"},"./liveroom-client-element":{import:"./dist/liveroom-client-element.js",require:"./dist/liveroom-client-element.cjs"}},E={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"},c={"livekit-client":"2.0.2","phx-live-state":"0.11.2"},r={"@sveltejs/vite-plugin-svelte":"3.0.2","@tsconfig/svelte":"5.0.2",prettier:"3.2.5",svelte:"4.2.11","svelte-check":"3.6.4",tslib:"2.6.2",typescript:"5.3.3",vite:"5.1.3"},O={name:e,private:!1,version:t,type:i,module:_,main:s,files:o,exports:n,scripts:E,dependencies:c,devDependencies:r},R=O.version,l="liveroom-client-element",S="_liveroom_id",m="_liveroom_token",v="_liveroom_user_name",A="_liveroom_user_color",p="liveroom-id",d="liveroom-token",Y="liveroom-user-name",M="liveroom-user-color";exports.ELEMENT_TAG=l;exports.QUERY_PARAM_KEY_ROOM_ID=S;exports.QUERY_PARAM_KEY_ROOM_TOKEN=m;exports.QUERY_PARAM_KEY_USER_COLOR=A;exports.QUERY_PARAM_KEY_USER_NAME=v;exports.SESSION_STORAGE_KEY_ROOM_ID=p;exports.SESSION_STORAGE_KEY_ROOM_TOKEN=d;exports.SESSION_STORAGE_KEY_USER_COLOR=M;exports.SESSION_STORAGE_KEY_USER_NAME=Y;exports.VERSION=R;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Pc=Object.defineProperty;var _c=(i,e,t)=>e in i?Pc(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var A=(i,e,t)=>(_c(i,typeof e!="symbol"?e+"":e,t),t);const Pr=require("./constants-CSWpxxUh.cjs");function kn(){}function Ro(i){return i()}function _r(){return Object.create(null)}function On(i){i.forEach(Ro)}function Oo(i){return typeof i=="function"}function Rc(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Oc(i){return Object.keys(i).length===0}function Me(i,e){i.appendChild(e)}function xc(i,e,t){const n=Ic(i);if(!n.getElementById(e)){const s=$e("style");s.id=e,s.textContent=t,Nc(n,s)}}function Ic(i){if(!i)return document;const e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function Nc(i,e){return Me(i.head||i,e),e.sheet}function Ti(i,e,t){i.insertBefore(e,t||null)}function yi(i){i.parentNode&&i.parentNode.removeChild(i)}function $e(i){return document.createElement(i)}function Rr(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function or(i){return document.createTextNode(i)}function an(){return or(" ")}function Ac(){return or("")}function q(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Mc(i){return Array.from(i.childNodes)}function Dc(i,e){e=""+e,i.data!==e&&(i.data=e)}function it(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}function Lc(i){const e={};return i.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let Cn;function dn(i){Cn=i}function xo(){if(!Cn)throw new Error("Function called outside component initialization");return Cn}function Uc(i){xo().$$.on_mount.push(i)}function Fc(i){xo().$$.on_destroy.push(i)}const Ui=[],_s=[];let Bi=[];const Or=[],jc=Promise.resolve();let Rs=!1;function Bc(){Rs||(Rs=!0,jc.then(hi))}function Os(i){Bi.push(i)}const ps=new Set;let Mi=0;function hi(){if(Mi!==0)return;const i=Cn;do{try{for(;Mi<Ui.length;){const e=Ui[Mi];Mi++,dn(e),Jc(e.$$)}}catch(e){throw Ui.length=0,Mi=0,e}for(dn(null),Ui.length=0,Mi=0;_s.length;)_s.pop()();for(let e=0;e<Bi.length;e+=1){const t=Bi[e];ps.has(t)||(ps.add(t),t())}Bi.length=0}while(Ui.length);for(;Or.length;)Or.pop()();Rs=!1,ps.clear(),dn(i)}function Jc(i){if(i.fragment!==null){i.update(),On(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(Os)}}function Vc(i){const e=[],t=[];Bi.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Bi=e}const qc=new Set;function Io(i,e){i&&i.i&&(qc.delete(i),i.i(e))}function xr(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function $c(i,e){i.d(1),e.delete(i.key)}function Hc(i,e,t,n,s,r,o,a,c,u,l,h){let f=i.length,p=r.length,y=f;const v={};for(;y--;)v[i[y].key]=y;const w=[],S=new Map,E=new Map,J=[];for(y=p;y--;){const U=h(s,r,y),ee=t(U);let M=o.get(ee);M?n&&J.push(()=>M.p(U,e)):(M=u(ee,U),M.c()),S.set(ee,w[y]=M),ee in v&&E.set(ee,Math.abs(y-v[ee]))}const K=new Set,me=new Set;function de(U){Io(U,1),U.m(a,l),o.set(U.key,U),l=U.first,p--}for(;f&&p;){const U=w[p-1],ee=i[f-1],M=U.key,H=ee.key;U===ee?(l=U.first,f--,p--):S.has(H)?!o.has(M)||K.has(M)?de(U):me.has(H)?f--:E.get(M)>E.get(H)?(me.add(M),de(U)):(K.add(H),f--):(c(ee,o),f--)}for(;f--;){const U=i[f];S.has(U.key)||c(U,o)}for(;p;)de(w[p-1]);return On(J),w}function zc(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),Os(()=>{const r=i.$$.on_mount.map(Ro).filter(Oo);i.$$.on_destroy?i.$$.on_destroy.push(...r):On(r),i.$$.on_mount=[]}),s.forEach(Os)}function Gc(i,e){const t=i.$$;t.fragment!==null&&(Vc(t.after_update),On(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Wc(i,e){i.$$.dirty[0]===-1&&(Ui.push(i),Bc(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function Kc(i,e,t,n,s,r,o=null,a=[-1]){const c=Cn;dn(i);const u=i.$$={fragment:null,ctx:[],props:r,update:kn,not_equal:s,bound:_r(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:_r(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};o&&o(u.root);let l=!1;if(u.ctx=t?t(i,e.props||{},(h,f,...p)=>{const y=p.length?p[0]:f;return u.ctx&&s(u.ctx[h],u.ctx[h]=y)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](y),l&&Wc(i,h)),f}):[],u.update(),l=!0,On(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=Mc(e.target);u.fragment&&u.fragment.l(h),h.forEach(yi)}else u.fragment&&u.fragment.c();e.intro&&Io(i.$$.fragment),zc(i,e.target,e.anchor),hi()}dn(c)}let No;typeof HTMLElement=="function"&&(No=class extends HTMLElement{constructor(e,t,n){super();A(this,"$$ctor");A(this,"$$s");A(this,"$$c");A(this,"$$cn",!1);A(this,"$$d",{});A(this,"$$r",!1);A(this,"$$p_d",{});A(this,"$$l",{});A(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 o;return{c:function(){o=$e("slot"),r!=="default"&&q(o,"name",r)},m:function(u,l){Ti(u,o,l)},d:function(u){u&&yi(o)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},n=Lc(this);for(const r of this.$$s)r in n&&(t[r]=[e(r)]);for(const r of this.attributes){const o=this.$$g_p(r.name);o in this.$$d||(this.$$d[o]=jn(o,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);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 o=jn(r,this.$$d[r],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,o)}this.$$r=!1};this.$$c.$$.after_update.push(s),s();for(const r in this.$$l)for(const o of this.$$l[r]){const a=this.$$c.$on(r,o);this.$$l_u.set(o,a)}this.$$l={}}}attributeChangedCallback(e,t,n){var s;this.$$r||(e=this.$$g_p(e),this.$$d[e]=jn(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 jn(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 Yc(i,e,t,n,s,r){let o=class extends No{constructor(){super(i,t,s),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(c){var u;c=jn(a,c,e),this.$$d[a]=c,(u=this.$$c)==null||u.$set({[a]:c})}})}),n.forEach(a=>{Object.defineProperty(o.prototype,a,{get(){var c;return(c=this.$$c)==null?void 0:c[a]}})}),r&&(o=r(o)),i.element=o,o}class Xc{constructor(){A(this,"$$");A(this,"$$set")}$destroy(){Gc(this,1),this.$destroy=kn}$on(e,t){if(!Oo(t))return kn;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&&!Oc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Qc="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Qc);const{isArray:Zc}=Array,eu=Object.keys,Tn=i=>{if(!i)return i;if(Zc(i)){const e=[],t=i.length;for(let n=0;n<t;n++)e.push(Tn(i[n]));return e}else if(typeof i=="object"){const e=eu(i),t=e.length,n={};for(let s=0;s<t;s++){const r=e[s];n[r]=Tn(i[r])}return n}return i};class Ue{constructor(e){A(this,"path");A(this,"from");this.path=e}}const tu=/~1/g,iu=/~0/g,nu=/~/g,su=/\//g;function ru(i){return i.indexOf("~")===-1?i:i.replace(tu,"/").replace(iu,"~")}function ou(i){return i.indexOf("/")===-1&&i.indexOf("~")===-1?i:i.replace(nu,"~0").replace(su,"~1")}function au(i){return i?i.slice(1).split("/").map(ru):[]}function W(i){return cu(i)?"":"/"+i.map(e=>ou(String(e))).join("/")}const V=i=>typeof i=="string"?au(i):i,cu=i=>!i.length,uu=Object.prototype.hasOwnProperty;function lu(i,e){return uu.call(i,e)}const{isArray:Ao}=Array,ne=(i,e)=>{const t=e.length;if(!t)return{val:i};let n,s;for(let o=0;o<t;o++)if(n=i,s=e[o],Ao(n)){const a=n.length;if(s==="-")s=a;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=lu(n,s)?n[s]:void 0;else throw new Error("NOT_FOUND");return{val:i,obj:n,key:s}},xn=i=>Ao(i.obj)&&typeof i.key=="number",os=i=>typeof i.obj=="object"&&typeof i.key=="string";class ar extends Ue{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"add"}code(){return 0}apply(t){const{val:n,key:s,obj:r}=ne(t,this.path),o=Tn(this.value);if(!r)t=o;else if(typeof s=="string")r[s]=o;else{const a=r.length;if(s<a)r.splice(s,0,o);else{if(s>a)throw new Error("INVALID_INDEX");r.push(o)}}return{doc:t,old:n}}toJson(t){return{op:"add",path:W(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 Mo extends Ue{constructor(t,n){super(t);A(this,"oldValue");this.oldValue=n}op(){return"remove"}code(){return 1}apply(t){const n=ne(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");return os(n)?delete n.obj[n.key]:xn(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:W(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 du extends Ue{constructor(t,n,s){super(t);A(this,"value");A(this,"oldValue");this.value=n,this.oldValue=s}op(){return"replace"}code(){return 2}apply(t){const n=ne(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");return os(n)?n.obj[n.key]=this.value:xn(n)?n.obj[n.key]=this.value:t=this.value,{doc:t,old:n.val}}toJson(t){const n={op:"replace",path:W(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 hu extends Ue{constructor(t,n){super(t);A(this,"from");this.from=n}op(){return"move"}code(){return 4}apply(t){const n=new Mo(V(this.from),void 0).apply(t);return new ar(this.path,n.old).apply(n.doc)}toJson(t){return{op:"move",path:W(this.path),from:W(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 fu extends Ue{constructor(t,n){super(t);A(this,"from");this.from=n}op(){return"copy"}code(){return 3}apply(t){const{val:n}=ne(t,this.from);if(n===void 0)throw new Error("NOT_FOUND");return new ar(this.path,Tn(n)).apply(t)}toJson(t){return{op:"copy",path:W(this.path),from:W(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 Oe extends Ue{apply(e){if(!this.test(e))throw new Error("TEST");return{doc:e}}}const Xn=(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(!Xn(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(!Xn(i[r],e[r]))return!1}return!0}return!1};class pu extends Oe{constructor(t,n,s){super(t);A(this,"value");A(this,"not");this.value=n,this.not=s}op(){return"test"}code(){return 5}test(t){const{val:n}=ne(t,this.path);if(n===void 0)return!!this.not;const s=Xn(n,this.value);return this.not?!s:s}toJson(t){const n={op:"test",path:W(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 mu extends Ue{constructor(e){super(e)}op(){return"flip"}code(){return 8}apply(e){const t=ne(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:W(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 gu extends Ue{constructor(t,n){super(t);A(this,"inc");this.inc=n}op(){return"inc"}code(){return 9}apply(t){const n=ne(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:W(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 vu extends Ue{constructor(t,n,s){super(t);A(this,"pos");A(this,"str");this.pos=n,this.str=s}op(){return"str_ins"}code(){return 6}apply(t){const{val:n,key:s,obj:r}=ne(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 o=typeof n=="string"?n:"",a=Math.min(this.pos,o.length),c=o.slice(0,a),u=o.slice(a),l=c+this.str+u;return r?r[s]=l:t=l,{doc:t,old:n}}toJson(t){return{op:"str_ins",path:W(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 yu extends Ue{constructor(t,n,s,r){super(t);A(this,"pos");A(this,"str");A(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}=ne(t,this.path);if(typeof n!="string")throw new Error("NOT_A_STRING");const o=n.length,a=Math.min(this.pos,n.length),c=Math.min(a,o),u=this.str!==void 0?this.str.length:this.len,l=Math.min(a+u,o),h=n.slice(0,c),f=n.substr(l),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:W(this.path),pos:this.pos,str:this.str}:{op:"str_del",path:W(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:bu}=Array,xs=i=>!!i&&typeof i=="object"&&typeof i.text=="string",Is=i=>!!i&&typeof i=="object"&&bu(i.children),ku=(i,e)=>{const t=new RegExp(i,e?"i":void 0);return n=>t.test(n)};class Cu extends Ue{constructor(t,n,s){super(t);A(this,"pos");A(this,"props");this.pos=n,this.props=s}op(){return"split"}code(){return 10}apply(t){const n=ne(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");const s=this.split(n.val);return os(n)?n.obj[n.key]=s:xn(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),o=t.slice(n);return s?[{...s,text:r},{...s,text:o}]:[r,o]}else if(xs(t)){const{pos:n,props:s}=this,r=t.text.slice(0,n),o=t.text.slice(n);return[{...t,...s,text:r},{...t,...s,text:o}]}else if(Is(t)){const{pos:n,props:s}=this,r=t.children.slice(0,n),o=t.children.slice(n);return[{...t,...s,children:r},{...t,...s,children:o}]}else if(typeof t=="number"){const{pos:n}=this;return[n,t-n]}else return[t,t]}toJson(t){const n={op:"split",path:W(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 Tu extends Ue{constructor(t,n,s){super(t);A(this,"pos");A(this,"props");this.pos=n,this.props=s}op(){return"merge"}code(){return 11}apply(t){const n=ne(t,this.path);if(!xn(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],o=this.merge(s,r);return n.obj[n.key-1]=o,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:xs(t)&&xs(n)?{...t,...n,text:t.text+n.text}:Is(t)&&Is(n)?{...t,...n,children:[...t.children,...n.children]}:[t,n]}toJson(t){const n={op:"merge",path:W(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:Su}=Array;class wu extends Ue{constructor(t,n,s){super(t);A(this,"props");A(this,"deleteNull");this.props=n,this.deleteNull=s}op(){return"extend"}code(){return 12}apply(t){const n=ne(t,this.path);return xn(n)?n.val!==void 0&&(n.obj[n.key]=this.extend(n.val)):os(n)?n.obj[n.key]=this.extend(n.val):t=this.extend(t),{doc:t}}extend(t){if(Su(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:W(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 Eu extends Oe{constructor(e){super(e)}op(){return"defined"}code(){return 31}test(e){const{val:t}=ne(e,this.path);return t!==void 0}toJson(e){return{op:"defined",path:W(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 Pu extends Oe{constructor(e){super(e)}op(){return"undefined"}code(){return 38}test(e){try{const{val:t}=ne(e,this.path);return t===void 0}catch(t){if(t.message==="NOT_FOUND")return!0;throw t}}toJson(e){return{op:"undefined",path:W(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:_u}=Array;class Ru extends Oe{constructor(t,n){super(t);A(this,"type");this.type=n}op(){return"test_type"}code(){return 39}test(t){const{val:n}=ne(t,this.path);return n===null?this.type.indexOf("null")>-1:_u(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:W(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 Ou extends Oe{constructor(t,n,s,r){super(t);A(this,"pos");A(this,"str");A(this,"not");this.pos=n,this.str=s,this.not=r}op(){return"test_string"}code(){return 40}test(t){const{val:n}=ne(t,this.path);if(typeof n!="string")return!1;const s=n.length,r=Math.min(this.pos,s),o=Math.min(this.pos+this.str.length,s),a=n.substring(r,o)===this.str;return this.not?!a:a}toJson(t){const n={op:"test_string",path:W(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 xu extends Oe{constructor(t,n,s){super(t);A(this,"len");A(this,"not");this.len=n,this.not=s}op(){return"test_string_len"}code(){return 41}test(t){const{val:n}=ne(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:W(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 Iu extends Oe{constructor(t,n,s){super(t);A(this,"value");A(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"contains"}code(){return 30}test(t){const{val:n}=ne(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:W(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 Nu extends Oe{constructor(t,n,s){super(t);A(this,"value");A(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"ends"}code(){return 32}test(t){const{val:n}=ne(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:W(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 Au extends Oe{constructor(t,n,s){super(t);A(this,"value");A(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"starts"}code(){return 37}test(t){const{val:n}=ne(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:W(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 Mu extends Oe{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"in"}code(){return 33}test(t){const{val:n}=ne(t,this.path);for(const s of this.value)if(Xn(n,s))return!0;return!1}toJson(t){return{op:"in",path:W(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 Du extends Oe{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"less"}code(){return 34}test(t){const{val:n}=ne(t,this.path);return typeof n!="number"?!1:n<this.value}toJson(t){return{op:"less",path:W(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 Lu extends Oe{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"more"}code(){return 36}test(t){const{val:n}=ne(t,this.path);return typeof n!="number"?!1:n>this.value}toJson(t){return{op:"more",path:W(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 cr extends Oe{constructor(t,n){super(t);A(this,"ops");this.ops=n}}class Uu extends cr{constructor(t,n){super(t,n);A(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:W(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 o=0;o<r;o++)this.ops[o].encode(t,this)}}class Fu extends cr{constructor(t,n){super(t,n);A(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:W(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 ju extends cr{constructor(t,n){super(t,n);A(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:W(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 Bu extends Oe{constructor(t,n,s,r){super(t);A(this,"value");A(this,"ignore_case");A(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}=ne(t,this.path);return typeof n!="string"?!1:this.matcher(n)}toJson(t){const n={op:"matches",path:W(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:Ju}=Array;class Vu extends Oe{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"type"}code(){return 42}test(t){const{val:n}=ne(t,this.path);return n===null?this.value==="null":Ju(n)?this.value==="array":typeof n===this.value||typeof n=="number"&&n===Math.round(n)&&this.value==="integer"}toJson(t){return{op:"type",path:W(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 qu=(i,e)=>{switch(i.op){case"add":return new ar(V(i.path),i.value);case"remove":return new Mo(V(i.path),i.oldValue);case"replace":return new du(V(i.path),i.value,i.oldValue);case"move":return new hu(V(i.path),V(i.from));case"copy":return new fu(V(i.path),V(i.from));case"flip":return new mu(V(i.path));case"inc":return new gu(V(i.path),i.inc);case"str_ins":return new vu(V(i.path),i.pos,i.str);case"str_del":return new yu(V(i.path),i.pos,i.str,i.len);case"split":return new Cu(V(i.path),i.pos,i.props||null);case"merge":return new Tu(V(i.path),i.pos,i.props||null);case"extend":return new wu(V(i.path),i.props,!!i.deleteNull);default:return Bn(i,e)}},Bn=(i,e)=>{switch(i.op){case"test":return new pu(V(i.path),i.value,!!i.not);case"defined":return new Eu(V(i.path));case"undefined":return new Pu(V(i.path));case"type":return new Vu(V(i.path),i.value);case"test_type":return new Ru(V(i.path),i.type);case"test_string":return new Ou(V(i.path),i.pos,i.str,!!i.not);case"test_string_len":return new xu(V(i.path),i.len,!!i.not);case"contains":return new Iu(V(i.path),i.value,!!i.ignore_case);case"ends":return new Nu(V(i.path),i.value,!!i.ignore_case);case"starts":return new Au(V(i.path),i.value,!!i.ignore_case);case"matches":return new Bu(V(i.path),i.value,!!i.ignore_case,e.createMatcher||ku);case"in":return new Mu(V(i.path),i.value);case"less":return new Du(V(i.path),i.value);case"more":return new Lu(V(i.path),i.value);case"and":{const t=V(i.path);return new Uu(t,i.apply.map(n=>Bn({...n,path:[...t,...V(n.path)]},e)))}case"or":{const t=V(i.path);return new Fu(t,i.apply.map(n=>Bn({...n,path:[...t,...V(n.path)]},e)))}case"not":{const t=V(i.path);return new ju(t,i.apply.map(n=>Bn({...n,path:[...t,...V(n.path)]},e)))}default:throw new Error("OP_UNKNOWN")}};function $u(i,e,t){t.mutate||(i=Tn(i));const n=[],s=e.length;for(let r=0;r<s;r++){const a=qu(e[r],t).apply(i);i=a.doc,n.push(a)}return{doc:i,res:n}}var hn=i=>typeof i=="function"?i:function(){return i},Hu=typeof self<"u"?self:null,cn=typeof window<"u"?window:null,fn=Hu||cn||fn,zu="2.0.0",nt={connecting:0,open:1,closing:2,closed:3},Gu=1e4,Wu=1e3,Ae={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Rt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ns={longpoll:"longpoll",websocket:"websocket"},Ku={complete:4},Dn=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})}},Do=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))}},Yu=class{constructor(i,e,t){this.state=Ae.closed,this.topic=i,this.params=hn(e||{}),this.socket=t,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Dn(this,Rt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Do(()=>{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=Ae.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=Ae.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=Ae.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=Ae.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 Dn(this,Rt.leave,hn({}),this.timeout).send(),this.state=Ae.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Rt.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(Rt.close,i)}onError(i){return this.on(Rt.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 Dn(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=Ae.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Rt.close,"leave")},t=new Dn(this,Rt.leave,hn({}),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=Ae.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(o=>o.event===i);for(let o=0;o<r.length;o++)r[o].callback(s,t,n||this.joinRef())}replyEventName(i){return`chan_reply_${i}`}isClosed(){return this.state===Ae.closed}isErrored(){return this.state===Ae.errored}isJoined(){return this.state===Ae.joined}isJoining(){return this.state===Ae.joining}isLeaving(){return this.state===Ae.leaving}},Qn=class{static request(i,e,t,n,s,r,o){if(fn.XDomainRequest){let a=new fn.XDomainRequest;return this.xdomainRequest(a,i,e,n,s,r,o)}else{let a=new fn.XMLHttpRequest;return this.xhrRequest(a,i,e,t,n,s,r,o)}}static xdomainRequest(i,e,t,n,s,r,o){return i.timeout=s,i.open(e,t),i.onload=()=>{let a=this.parseJSON(i.responseText);o&&o(a)},r&&(i.ontimeout=r),i.onprogress=()=>{},i.send(n),i}static xhrRequest(i,e,t,n,s,r,o,a){return i.open(e,t,!0),i.timeout=r,i.setRequestHeader("Content-Type",n),i.onerror=()=>a&&a(null),i.onreadystatechange=()=>{if(i.readyState===Ku.complete&&a){let c=this.parseJSON(i.responseText);a(c)}},o&&(i.ontimeout=o),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)}`}},ms=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=nt.connecting,this.poll()}normalizeEndpoint(i){return i.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ns.websocket),"$1/"+Ns.longpoll)}endpointURL(){return Qn.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(i,e,t){this.close(i,e,t),this.readyState=nt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===nt.open||this.readyState===nt.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=nt.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=nt.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=Qn.request(i,this.endpointURL(),"application/json",e,this.timeout,r,o=>{this.reqs.delete(s),this.isActive()&&n(o)}),this.reqs.add(s)}},Ln={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,o]=JSON.parse(i);return e({join_ref:t,ref:n,topic:s,event:r,payload:o})}},binaryEncode(i){let{join_ref:e,ref:t,event:n,topic:s,payload:r}=i,o=this.META_LENGTH+e.length+t.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),c=new DataView(a),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 l=new Uint8Array(a.byteLength+r.byteLength);return l.set(new Uint8Array(a),0),l.set(new Uint8Array(r),a.byteLength),l.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),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=t.decode(i.slice(o,o+n));o=o+n;let c=t.decode(i.slice(o,o+s));o=o+s;let u=t.decode(i.slice(o,o+r));o=o+r;let l=i.slice(o,i.byteLength);return{join_ref:a,ref:null,topic:c,event:u,payload:l}},decodeReply(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=t.decode(i.slice(a,a+n));a=a+n;let u=t.decode(i.slice(a,a+s));a=a+s;let l=t.decode(i.slice(a,a+r));a=a+r;let h=t.decode(i.slice(a,a+o));a=a+o;let f=i.slice(a,i.byteLength),p={status:h,response:f};return{join_ref:c,ref:u,topic:l,event:Rt.reply,payload:p}},decodeBroadcast(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=this.HEADER_LENGTH+2,o=t.decode(i.slice(r,r+n));r=r+n;let a=t.decode(i.slice(r,r+s));r=r+s;let c=i.slice(r,i.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:c}}},Xu=class{constructor(i,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=e.timeout||Gu,this.transport=e.transport||fn.WebSocket||ms,this.establishedConnections=0,this.defaultEncoder=Ln.encode.bind(Ln),this.defaultDecoder=Ln.decode.bind(Ln),this.closeWasClean=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.transport!==ms?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let t=null;cn&&cn.addEventListener&&(cn.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),t=this.connectClock)}),cn.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=hn(e.params||{}),this.endPoint=`${i}/${Ns.websocket}`,this.vsn=e.vsn||zu,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Do(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return ms}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=Qn.appendParams(Qn.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=hn(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(),Wu,"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===nt.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(Rt.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case nt.connecting:return"connecting";case nt.open:return"open";case nt.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 Yu(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:o}=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 a=0;a<this.channels.length;a++){const c=this.channels[a];c.isMember(t,n,s,o)&&c.trigger(n,s,r,o)}for(let a=0;a<this.stateChangeCallbacks.message.length;a++){let[,c]=this.stateChangeCallbacks.message[a];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 Qu{constructor(e){this.connected=!1,this.config=e,this.socket=new Xu(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.channel.on("error",e=>this.emitServerError(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)}emitServerError(e){this.eventTarget.dispatchEvent(new CustomEvent("livestate-error",{detail:e}))}emitError(e,t){this.eventTarget.dispatchEvent(new CustomEvent("livestate-error",{detail:{type:e,message:this.extractMessage(t)}}))}extractMessage(e){if(e&&typeof(e=="object")){const t=[e.reason,e.name,e.message].find(n=>n);return console.log(t),t}else if(typeof e=="string")return e}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}=$u(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)}}const Lo=32;let le,He,Zn=i=>(le=0,He=i,i=ui(),He[le]?oi():i||""),oi=(i="Bad syntax",e=He[le],t=He.slice(0,le).split(`
|
|
1
|
+
"use strict";var Pc=Object.defineProperty;var _c=(i,e,t)=>e in i?Pc(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var A=(i,e,t)=>(_c(i,typeof e!="symbol"?e+"":e,t),t);const Pr=require("./constants-DfeL-H6H.cjs");function kn(){}function Ro(i){return i()}function _r(){return Object.create(null)}function On(i){i.forEach(Ro)}function Oo(i){return typeof i=="function"}function Rc(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Oc(i){return Object.keys(i).length===0}function Me(i,e){i.appendChild(e)}function xc(i,e,t){const n=Ic(i);if(!n.getElementById(e)){const s=$e("style");s.id=e,s.textContent=t,Nc(n,s)}}function Ic(i){if(!i)return document;const e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function Nc(i,e){return Me(i.head||i,e),e.sheet}function Ti(i,e,t){i.insertBefore(e,t||null)}function yi(i){i.parentNode&&i.parentNode.removeChild(i)}function $e(i){return document.createElement(i)}function Rr(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function or(i){return document.createTextNode(i)}function an(){return or(" ")}function Ac(){return or("")}function q(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Mc(i){return Array.from(i.childNodes)}function Dc(i,e){e=""+e,i.data!==e&&(i.data=e)}function it(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}function Lc(i){const e={};return i.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let Cn;function dn(i){Cn=i}function xo(){if(!Cn)throw new Error("Function called outside component initialization");return Cn}function Uc(i){xo().$$.on_mount.push(i)}function Fc(i){xo().$$.on_destroy.push(i)}const Ui=[],_s=[];let Bi=[];const Or=[],jc=Promise.resolve();let Rs=!1;function Bc(){Rs||(Rs=!0,jc.then(hi))}function Os(i){Bi.push(i)}const ps=new Set;let Mi=0;function hi(){if(Mi!==0)return;const i=Cn;do{try{for(;Mi<Ui.length;){const e=Ui[Mi];Mi++,dn(e),Jc(e.$$)}}catch(e){throw Ui.length=0,Mi=0,e}for(dn(null),Ui.length=0,Mi=0;_s.length;)_s.pop()();for(let e=0;e<Bi.length;e+=1){const t=Bi[e];ps.has(t)||(ps.add(t),t())}Bi.length=0}while(Ui.length);for(;Or.length;)Or.pop()();Rs=!1,ps.clear(),dn(i)}function Jc(i){if(i.fragment!==null){i.update(),On(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(Os)}}function Vc(i){const e=[],t=[];Bi.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Bi=e}const qc=new Set;function Io(i,e){i&&i.i&&(qc.delete(i),i.i(e))}function xr(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function $c(i,e){i.d(1),e.delete(i.key)}function Hc(i,e,t,n,s,r,o,a,c,u,l,h){let f=i.length,p=r.length,y=f;const v={};for(;y--;)v[i[y].key]=y;const w=[],S=new Map,E=new Map,J=[];for(y=p;y--;){const U=h(s,r,y),ee=t(U);let M=o.get(ee);M?n&&J.push(()=>M.p(U,e)):(M=u(ee,U),M.c()),S.set(ee,w[y]=M),ee in v&&E.set(ee,Math.abs(y-v[ee]))}const K=new Set,me=new Set;function de(U){Io(U,1),U.m(a,l),o.set(U.key,U),l=U.first,p--}for(;f&&p;){const U=w[p-1],ee=i[f-1],M=U.key,H=ee.key;U===ee?(l=U.first,f--,p--):S.has(H)?!o.has(M)||K.has(M)?de(U):me.has(H)?f--:E.get(M)>E.get(H)?(me.add(M),de(U)):(K.add(H),f--):(c(ee,o),f--)}for(;f--;){const U=i[f];S.has(U.key)||c(U,o)}for(;p;)de(w[p-1]);return On(J),w}function zc(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),Os(()=>{const r=i.$$.on_mount.map(Ro).filter(Oo);i.$$.on_destroy?i.$$.on_destroy.push(...r):On(r),i.$$.on_mount=[]}),s.forEach(Os)}function Gc(i,e){const t=i.$$;t.fragment!==null&&(Vc(t.after_update),On(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Wc(i,e){i.$$.dirty[0]===-1&&(Ui.push(i),Bc(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function Kc(i,e,t,n,s,r,o=null,a=[-1]){const c=Cn;dn(i);const u=i.$$={fragment:null,ctx:[],props:r,update:kn,not_equal:s,bound:_r(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:_r(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};o&&o(u.root);let l=!1;if(u.ctx=t?t(i,e.props||{},(h,f,...p)=>{const y=p.length?p[0]:f;return u.ctx&&s(u.ctx[h],u.ctx[h]=y)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](y),l&&Wc(i,h)),f}):[],u.update(),l=!0,On(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=Mc(e.target);u.fragment&&u.fragment.l(h),h.forEach(yi)}else u.fragment&&u.fragment.c();e.intro&&Io(i.$$.fragment),zc(i,e.target,e.anchor),hi()}dn(c)}let No;typeof HTMLElement=="function"&&(No=class extends HTMLElement{constructor(e,t,n){super();A(this,"$$ctor");A(this,"$$s");A(this,"$$c");A(this,"$$cn",!1);A(this,"$$d",{});A(this,"$$r",!1);A(this,"$$p_d",{});A(this,"$$l",{});A(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 o;return{c:function(){o=$e("slot"),r!=="default"&&q(o,"name",r)},m:function(u,l){Ti(u,o,l)},d:function(u){u&&yi(o)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},n=Lc(this);for(const r of this.$$s)r in n&&(t[r]=[e(r)]);for(const r of this.attributes){const o=this.$$g_p(r.name);o in this.$$d||(this.$$d[o]=jn(o,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);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 o=jn(r,this.$$d[r],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,o)}this.$$r=!1};this.$$c.$$.after_update.push(s),s();for(const r in this.$$l)for(const o of this.$$l[r]){const a=this.$$c.$on(r,o);this.$$l_u.set(o,a)}this.$$l={}}}attributeChangedCallback(e,t,n){var s;this.$$r||(e=this.$$g_p(e),this.$$d[e]=jn(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 jn(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 Yc(i,e,t,n,s,r){let o=class extends No{constructor(){super(i,t,s),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(c){var u;c=jn(a,c,e),this.$$d[a]=c,(u=this.$$c)==null||u.$set({[a]:c})}})}),n.forEach(a=>{Object.defineProperty(o.prototype,a,{get(){var c;return(c=this.$$c)==null?void 0:c[a]}})}),r&&(o=r(o)),i.element=o,o}class Xc{constructor(){A(this,"$$");A(this,"$$set")}$destroy(){Gc(this,1),this.$destroy=kn}$on(e,t){if(!Oo(t))return kn;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&&!Oc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Qc="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Qc);const{isArray:Zc}=Array,eu=Object.keys,Tn=i=>{if(!i)return i;if(Zc(i)){const e=[],t=i.length;for(let n=0;n<t;n++)e.push(Tn(i[n]));return e}else if(typeof i=="object"){const e=eu(i),t=e.length,n={};for(let s=0;s<t;s++){const r=e[s];n[r]=Tn(i[r])}return n}return i};class Ue{constructor(e){A(this,"path");A(this,"from");this.path=e}}const tu=/~1/g,iu=/~0/g,nu=/~/g,su=/\//g;function ru(i){return i.indexOf("~")===-1?i:i.replace(tu,"/").replace(iu,"~")}function ou(i){return i.indexOf("/")===-1&&i.indexOf("~")===-1?i:i.replace(nu,"~0").replace(su,"~1")}function au(i){return i?i.slice(1).split("/").map(ru):[]}function W(i){return cu(i)?"":"/"+i.map(e=>ou(String(e))).join("/")}const V=i=>typeof i=="string"?au(i):i,cu=i=>!i.length,uu=Object.prototype.hasOwnProperty;function lu(i,e){return uu.call(i,e)}const{isArray:Ao}=Array,ne=(i,e)=>{const t=e.length;if(!t)return{val:i};let n,s;for(let o=0;o<t;o++)if(n=i,s=e[o],Ao(n)){const a=n.length;if(s==="-")s=a;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=lu(n,s)?n[s]:void 0;else throw new Error("NOT_FOUND");return{val:i,obj:n,key:s}},xn=i=>Ao(i.obj)&&typeof i.key=="number",os=i=>typeof i.obj=="object"&&typeof i.key=="string";class ar extends Ue{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"add"}code(){return 0}apply(t){const{val:n,key:s,obj:r}=ne(t,this.path),o=Tn(this.value);if(!r)t=o;else if(typeof s=="string")r[s]=o;else{const a=r.length;if(s<a)r.splice(s,0,o);else{if(s>a)throw new Error("INVALID_INDEX");r.push(o)}}return{doc:t,old:n}}toJson(t){return{op:"add",path:W(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 Mo extends Ue{constructor(t,n){super(t);A(this,"oldValue");this.oldValue=n}op(){return"remove"}code(){return 1}apply(t){const n=ne(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");return os(n)?delete n.obj[n.key]:xn(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:W(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 du extends Ue{constructor(t,n,s){super(t);A(this,"value");A(this,"oldValue");this.value=n,this.oldValue=s}op(){return"replace"}code(){return 2}apply(t){const n=ne(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");return os(n)?n.obj[n.key]=this.value:xn(n)?n.obj[n.key]=this.value:t=this.value,{doc:t,old:n.val}}toJson(t){const n={op:"replace",path:W(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 hu extends Ue{constructor(t,n){super(t);A(this,"from");this.from=n}op(){return"move"}code(){return 4}apply(t){const n=new Mo(V(this.from),void 0).apply(t);return new ar(this.path,n.old).apply(n.doc)}toJson(t){return{op:"move",path:W(this.path),from:W(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 fu extends Ue{constructor(t,n){super(t);A(this,"from");this.from=n}op(){return"copy"}code(){return 3}apply(t){const{val:n}=ne(t,this.from);if(n===void 0)throw new Error("NOT_FOUND");return new ar(this.path,Tn(n)).apply(t)}toJson(t){return{op:"copy",path:W(this.path),from:W(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 Oe extends Ue{apply(e){if(!this.test(e))throw new Error("TEST");return{doc:e}}}const Xn=(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(!Xn(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(!Xn(i[r],e[r]))return!1}return!0}return!1};class pu extends Oe{constructor(t,n,s){super(t);A(this,"value");A(this,"not");this.value=n,this.not=s}op(){return"test"}code(){return 5}test(t){const{val:n}=ne(t,this.path);if(n===void 0)return!!this.not;const s=Xn(n,this.value);return this.not?!s:s}toJson(t){const n={op:"test",path:W(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 mu extends Ue{constructor(e){super(e)}op(){return"flip"}code(){return 8}apply(e){const t=ne(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:W(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 gu extends Ue{constructor(t,n){super(t);A(this,"inc");this.inc=n}op(){return"inc"}code(){return 9}apply(t){const n=ne(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:W(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 vu extends Ue{constructor(t,n,s){super(t);A(this,"pos");A(this,"str");this.pos=n,this.str=s}op(){return"str_ins"}code(){return 6}apply(t){const{val:n,key:s,obj:r}=ne(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 o=typeof n=="string"?n:"",a=Math.min(this.pos,o.length),c=o.slice(0,a),u=o.slice(a),l=c+this.str+u;return r?r[s]=l:t=l,{doc:t,old:n}}toJson(t){return{op:"str_ins",path:W(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 yu extends Ue{constructor(t,n,s,r){super(t);A(this,"pos");A(this,"str");A(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}=ne(t,this.path);if(typeof n!="string")throw new Error("NOT_A_STRING");const o=n.length,a=Math.min(this.pos,n.length),c=Math.min(a,o),u=this.str!==void 0?this.str.length:this.len,l=Math.min(a+u,o),h=n.slice(0,c),f=n.substr(l),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:W(this.path),pos:this.pos,str:this.str}:{op:"str_del",path:W(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:bu}=Array,xs=i=>!!i&&typeof i=="object"&&typeof i.text=="string",Is=i=>!!i&&typeof i=="object"&&bu(i.children),ku=(i,e)=>{const t=new RegExp(i,e?"i":void 0);return n=>t.test(n)};class Cu extends Ue{constructor(t,n,s){super(t);A(this,"pos");A(this,"props");this.pos=n,this.props=s}op(){return"split"}code(){return 10}apply(t){const n=ne(t,this.path);if(n.val===void 0)throw new Error("NOT_FOUND");const s=this.split(n.val);return os(n)?n.obj[n.key]=s:xn(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),o=t.slice(n);return s?[{...s,text:r},{...s,text:o}]:[r,o]}else if(xs(t)){const{pos:n,props:s}=this,r=t.text.slice(0,n),o=t.text.slice(n);return[{...t,...s,text:r},{...t,...s,text:o}]}else if(Is(t)){const{pos:n,props:s}=this,r=t.children.slice(0,n),o=t.children.slice(n);return[{...t,...s,children:r},{...t,...s,children:o}]}else if(typeof t=="number"){const{pos:n}=this;return[n,t-n]}else return[t,t]}toJson(t){const n={op:"split",path:W(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 Tu extends Ue{constructor(t,n,s){super(t);A(this,"pos");A(this,"props");this.pos=n,this.props=s}op(){return"merge"}code(){return 11}apply(t){const n=ne(t,this.path);if(!xn(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],o=this.merge(s,r);return n.obj[n.key-1]=o,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:xs(t)&&xs(n)?{...t,...n,text:t.text+n.text}:Is(t)&&Is(n)?{...t,...n,children:[...t.children,...n.children]}:[t,n]}toJson(t){const n={op:"merge",path:W(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:Su}=Array;class wu extends Ue{constructor(t,n,s){super(t);A(this,"props");A(this,"deleteNull");this.props=n,this.deleteNull=s}op(){return"extend"}code(){return 12}apply(t){const n=ne(t,this.path);return xn(n)?n.val!==void 0&&(n.obj[n.key]=this.extend(n.val)):os(n)?n.obj[n.key]=this.extend(n.val):t=this.extend(t),{doc:t}}extend(t){if(Su(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:W(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 Eu extends Oe{constructor(e){super(e)}op(){return"defined"}code(){return 31}test(e){const{val:t}=ne(e,this.path);return t!==void 0}toJson(e){return{op:"defined",path:W(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 Pu extends Oe{constructor(e){super(e)}op(){return"undefined"}code(){return 38}test(e){try{const{val:t}=ne(e,this.path);return t===void 0}catch(t){if(t.message==="NOT_FOUND")return!0;throw t}}toJson(e){return{op:"undefined",path:W(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:_u}=Array;class Ru extends Oe{constructor(t,n){super(t);A(this,"type");this.type=n}op(){return"test_type"}code(){return 39}test(t){const{val:n}=ne(t,this.path);return n===null?this.type.indexOf("null")>-1:_u(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:W(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 Ou extends Oe{constructor(t,n,s,r){super(t);A(this,"pos");A(this,"str");A(this,"not");this.pos=n,this.str=s,this.not=r}op(){return"test_string"}code(){return 40}test(t){const{val:n}=ne(t,this.path);if(typeof n!="string")return!1;const s=n.length,r=Math.min(this.pos,s),o=Math.min(this.pos+this.str.length,s),a=n.substring(r,o)===this.str;return this.not?!a:a}toJson(t){const n={op:"test_string",path:W(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 xu extends Oe{constructor(t,n,s){super(t);A(this,"len");A(this,"not");this.len=n,this.not=s}op(){return"test_string_len"}code(){return 41}test(t){const{val:n}=ne(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:W(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 Iu extends Oe{constructor(t,n,s){super(t);A(this,"value");A(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"contains"}code(){return 30}test(t){const{val:n}=ne(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:W(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 Nu extends Oe{constructor(t,n,s){super(t);A(this,"value");A(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"ends"}code(){return 32}test(t){const{val:n}=ne(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:W(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 Au extends Oe{constructor(t,n,s){super(t);A(this,"value");A(this,"ignore_case");this.value=n,this.ignore_case=s}op(){return"starts"}code(){return 37}test(t){const{val:n}=ne(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:W(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 Mu extends Oe{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"in"}code(){return 33}test(t){const{val:n}=ne(t,this.path);for(const s of this.value)if(Xn(n,s))return!0;return!1}toJson(t){return{op:"in",path:W(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 Du extends Oe{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"less"}code(){return 34}test(t){const{val:n}=ne(t,this.path);return typeof n!="number"?!1:n<this.value}toJson(t){return{op:"less",path:W(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 Lu extends Oe{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"more"}code(){return 36}test(t){const{val:n}=ne(t,this.path);return typeof n!="number"?!1:n>this.value}toJson(t){return{op:"more",path:W(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 cr extends Oe{constructor(t,n){super(t);A(this,"ops");this.ops=n}}class Uu extends cr{constructor(t,n){super(t,n);A(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:W(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 o=0;o<r;o++)this.ops[o].encode(t,this)}}class Fu extends cr{constructor(t,n){super(t,n);A(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:W(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 ju extends cr{constructor(t,n){super(t,n);A(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:W(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 Bu extends Oe{constructor(t,n,s,r){super(t);A(this,"value");A(this,"ignore_case");A(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}=ne(t,this.path);return typeof n!="string"?!1:this.matcher(n)}toJson(t){const n={op:"matches",path:W(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:Ju}=Array;class Vu extends Oe{constructor(t,n){super(t);A(this,"value");this.value=n}op(){return"type"}code(){return 42}test(t){const{val:n}=ne(t,this.path);return n===null?this.value==="null":Ju(n)?this.value==="array":typeof n===this.value||typeof n=="number"&&n===Math.round(n)&&this.value==="integer"}toJson(t){return{op:"type",path:W(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 qu=(i,e)=>{switch(i.op){case"add":return new ar(V(i.path),i.value);case"remove":return new Mo(V(i.path),i.oldValue);case"replace":return new du(V(i.path),i.value,i.oldValue);case"move":return new hu(V(i.path),V(i.from));case"copy":return new fu(V(i.path),V(i.from));case"flip":return new mu(V(i.path));case"inc":return new gu(V(i.path),i.inc);case"str_ins":return new vu(V(i.path),i.pos,i.str);case"str_del":return new yu(V(i.path),i.pos,i.str,i.len);case"split":return new Cu(V(i.path),i.pos,i.props||null);case"merge":return new Tu(V(i.path),i.pos,i.props||null);case"extend":return new wu(V(i.path),i.props,!!i.deleteNull);default:return Bn(i,e)}},Bn=(i,e)=>{switch(i.op){case"test":return new pu(V(i.path),i.value,!!i.not);case"defined":return new Eu(V(i.path));case"undefined":return new Pu(V(i.path));case"type":return new Vu(V(i.path),i.value);case"test_type":return new Ru(V(i.path),i.type);case"test_string":return new Ou(V(i.path),i.pos,i.str,!!i.not);case"test_string_len":return new xu(V(i.path),i.len,!!i.not);case"contains":return new Iu(V(i.path),i.value,!!i.ignore_case);case"ends":return new Nu(V(i.path),i.value,!!i.ignore_case);case"starts":return new Au(V(i.path),i.value,!!i.ignore_case);case"matches":return new Bu(V(i.path),i.value,!!i.ignore_case,e.createMatcher||ku);case"in":return new Mu(V(i.path),i.value);case"less":return new Du(V(i.path),i.value);case"more":return new Lu(V(i.path),i.value);case"and":{const t=V(i.path);return new Uu(t,i.apply.map(n=>Bn({...n,path:[...t,...V(n.path)]},e)))}case"or":{const t=V(i.path);return new Fu(t,i.apply.map(n=>Bn({...n,path:[...t,...V(n.path)]},e)))}case"not":{const t=V(i.path);return new ju(t,i.apply.map(n=>Bn({...n,path:[...t,...V(n.path)]},e)))}default:throw new Error("OP_UNKNOWN")}};function $u(i,e,t){t.mutate||(i=Tn(i));const n=[],s=e.length;for(let r=0;r<s;r++){const a=qu(e[r],t).apply(i);i=a.doc,n.push(a)}return{doc:i,res:n}}var hn=i=>typeof i=="function"?i:function(){return i},Hu=typeof self<"u"?self:null,cn=typeof window<"u"?window:null,fn=Hu||cn||fn,zu="2.0.0",nt={connecting:0,open:1,closing:2,closed:3},Gu=1e4,Wu=1e3,Ae={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Rt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ns={longpoll:"longpoll",websocket:"websocket"},Ku={complete:4},Dn=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})}},Do=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))}},Yu=class{constructor(i,e,t){this.state=Ae.closed,this.topic=i,this.params=hn(e||{}),this.socket=t,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Dn(this,Rt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Do(()=>{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=Ae.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=Ae.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=Ae.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=Ae.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 Dn(this,Rt.leave,hn({}),this.timeout).send(),this.state=Ae.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Rt.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(Rt.close,i)}onError(i){return this.on(Rt.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 Dn(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=Ae.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Rt.close,"leave")},t=new Dn(this,Rt.leave,hn({}),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=Ae.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(o=>o.event===i);for(let o=0;o<r.length;o++)r[o].callback(s,t,n||this.joinRef())}replyEventName(i){return`chan_reply_${i}`}isClosed(){return this.state===Ae.closed}isErrored(){return this.state===Ae.errored}isJoined(){return this.state===Ae.joined}isJoining(){return this.state===Ae.joining}isLeaving(){return this.state===Ae.leaving}},Qn=class{static request(i,e,t,n,s,r,o){if(fn.XDomainRequest){let a=new fn.XDomainRequest;return this.xdomainRequest(a,i,e,n,s,r,o)}else{let a=new fn.XMLHttpRequest;return this.xhrRequest(a,i,e,t,n,s,r,o)}}static xdomainRequest(i,e,t,n,s,r,o){return i.timeout=s,i.open(e,t),i.onload=()=>{let a=this.parseJSON(i.responseText);o&&o(a)},r&&(i.ontimeout=r),i.onprogress=()=>{},i.send(n),i}static xhrRequest(i,e,t,n,s,r,o,a){return i.open(e,t,!0),i.timeout=r,i.setRequestHeader("Content-Type",n),i.onerror=()=>a&&a(null),i.onreadystatechange=()=>{if(i.readyState===Ku.complete&&a){let c=this.parseJSON(i.responseText);a(c)}},o&&(i.ontimeout=o),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)}`}},ms=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=nt.connecting,this.poll()}normalizeEndpoint(i){return i.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ns.websocket),"$1/"+Ns.longpoll)}endpointURL(){return Qn.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(i,e,t){this.close(i,e,t),this.readyState=nt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===nt.open||this.readyState===nt.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=nt.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=nt.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=Qn.request(i,this.endpointURL(),"application/json",e,this.timeout,r,o=>{this.reqs.delete(s),this.isActive()&&n(o)}),this.reqs.add(s)}},Ln={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,o]=JSON.parse(i);return e({join_ref:t,ref:n,topic:s,event:r,payload:o})}},binaryEncode(i){let{join_ref:e,ref:t,event:n,topic:s,payload:r}=i,o=this.META_LENGTH+e.length+t.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),c=new DataView(a),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 l=new Uint8Array(a.byteLength+r.byteLength);return l.set(new Uint8Array(a),0),l.set(new Uint8Array(r),a.byteLength),l.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),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=t.decode(i.slice(o,o+n));o=o+n;let c=t.decode(i.slice(o,o+s));o=o+s;let u=t.decode(i.slice(o,o+r));o=o+r;let l=i.slice(o,i.byteLength);return{join_ref:a,ref:null,topic:c,event:u,payload:l}},decodeReply(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=t.decode(i.slice(a,a+n));a=a+n;let u=t.decode(i.slice(a,a+s));a=a+s;let l=t.decode(i.slice(a,a+r));a=a+r;let h=t.decode(i.slice(a,a+o));a=a+o;let f=i.slice(a,i.byteLength),p={status:h,response:f};return{join_ref:c,ref:u,topic:l,event:Rt.reply,payload:p}},decodeBroadcast(i,e,t){let n=e.getUint8(1),s=e.getUint8(2),r=this.HEADER_LENGTH+2,o=t.decode(i.slice(r,r+n));r=r+n;let a=t.decode(i.slice(r,r+s));r=r+s;let c=i.slice(r,i.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:c}}},Xu=class{constructor(i,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=e.timeout||Gu,this.transport=e.transport||fn.WebSocket||ms,this.establishedConnections=0,this.defaultEncoder=Ln.encode.bind(Ln),this.defaultDecoder=Ln.decode.bind(Ln),this.closeWasClean=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.transport!==ms?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let t=null;cn&&cn.addEventListener&&(cn.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),t=this.connectClock)}),cn.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=hn(e.params||{}),this.endPoint=`${i}/${Ns.websocket}`,this.vsn=e.vsn||zu,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Do(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return ms}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=Qn.appendParams(Qn.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=hn(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(),Wu,"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===nt.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(Rt.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case nt.connecting:return"connecting";case nt.open:return"open";case nt.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 Yu(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:o}=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 a=0;a<this.channels.length;a++){const c=this.channels[a];c.isMember(t,n,s,o)&&c.trigger(n,s,r,o)}for(let a=0;a<this.stateChangeCallbacks.message.length;a++){let[,c]=this.stateChangeCallbacks.message[a];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 Qu{constructor(e){this.connected=!1,this.config=e,this.socket=new Xu(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.channel.on("error",e=>this.emitServerError(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)}emitServerError(e){this.eventTarget.dispatchEvent(new CustomEvent("livestate-error",{detail:e}))}emitError(e,t){this.eventTarget.dispatchEvent(new CustomEvent("livestate-error",{detail:{type:e,message:this.extractMessage(t)}}))}extractMessage(e){if(e&&typeof(e=="object")){const t=[e.reason,e.name,e.message].find(n=>n);return console.log(t),t}else if(typeof e=="string")return e}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}=$u(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)}}const Lo=32;let le,He,Zn=i=>(le=0,He=i,i=ui(),He[le]?oi():i||""),oi=(i="Bad syntax",e=He[le],t=He.slice(0,le).split(`
|
|
2
2
|
`),n=t.pop())=>{let s=He.slice(le-108,le).split(`
|
|
3
3
|
`).pop(),r=He.slice(le+1,le+108).split(`
|
|
4
4
|
`).shift();throw EvalError(`${i} at ${t.length}:${n.length} \`${s+e+r}\``,"font-weight: bold")},pn=(i=1,e=le,t)=>{if(typeof i=="number")le+=i;else for(;t=i(He.charCodeAt(le));)le+=t;return He.slice(e,le)},ui=(i=0,e,t,n,s,r)=>{for(;(t=Zn.space())&&(s=((r=Hi[t])&&r(n,i))??(!n&&Zn.id()));)n=s;return e&&(t==e?le++:oi()),n},Uo=i=>i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||i==36||i==95||i>=192&&i!=215&&i!=247;Zn.space=i=>{for(;(i=He.charCodeAt(le))<=Lo;)le++;return i};Zn.id=i=>pn(Uo);let Hi=[],Ci=(i,e=Lo,t,n=i.charCodeAt(0),s=i.length,r=Hi[n],o=i.toUpperCase()!==i)=>Hi[n]=(a,c,u=le)=>c<e&&(s<2||He.substr(le,s)==i)&&(!o||!Uo(He.charCodeAt(le+s)))&&(le+=s,t(a,c))||(le=u,r==null?void 0:r(a,c)),Fo=(i,e,t=0)=>Ci(i,e,(n,s)=>n&&(s=ui(e-t/2))&&[i,n,s]),Zu=(i,e,t)=>Ci(i,e,n=>t?n&&[i,n]:!n&&(n=ui(e-.5))&&[i,n]),el=(i,e,t)=>{Ci(i,e,(n,s)=>(n||t)&&(s=ui(e),s||t)&&((!n||n[0]!==i)&&(n=[i,n]),(s||t)&&n.push(s),n))};const ue=i=>Array.isArray(i)?As[i[0]](...i.slice(1)):e=>e==null?void 0:e[i],As={},ni=(i,e,t=As[i])=>As[i]=(...n)=>e(...n)||t&&t(...n),jo=41,tl=93,Ir=34,Bo=46,Jo=48,il=57,nl=1,sl=4,rl=5,ol=6,al=7,cl=8,Vo=9,as=10,ur=11,qo=12,lr=13,In=15,Sn=18,se=(i,e,t)=>t.length?t.length>1?(Fo(i,Math.abs(e),e<0),ni(i,(n,s)=>s&&(n=ue(n),s=ue(s),!n.length&&!s.length?(n=t(n(),s()),()=>n):r=>t(n(r),s(r))))):(Zu(i,e),ni(i,(n,s)=>!s&&(n=ue(n),n.length?r=>t(n(r)):(n=t(n()),()=>n)))):(el(i,Math.abs(e),e<0),ni(i,(...n)=>(n=n.map(ue),s=>t(...n.map(r=>r(s)))))),$o=i=>i?oi():["",(i=+pn(e=>e===Bo||e>=Jo&&e<=il||(e===69||e===101?2:0)))!=i?oi():i],Ho=(i,e,t,n)=>(Ci(i,e,s=>s?[i==="++"?"-":"+",[i,s],["",1]]:[i,ui(e-1)]),ni(i,n=(s,r)=>s[0]==="("?n(s[1]):s[0]==="."?(r=s[2],s=ue(s[1]),o=>t(s(o),r)):s[0]==="["?([,s,r]=s,s=ue(s),r=ue(r),o=>t(s(o),r(o))):o=>t(o,s)));ni("",i=>()=>i);Hi[Ir]=i=>i?oi():["",(pn()+pn(e=>e-Ir?1:0)+(pn()||oi("Bad string"))).slice(1,-1)];Hi[Bo]=i=>!i&&$o();for(let i=0;i<=9;i++)Hi[Jo+i]=$o;se(",",nl,(...i)=>i[i.length-1]);se("||",sl,(...i)=>{let e=0,t;for(;!t&&e<i.length;)t=i[e++];return t});se("&&",rl,(...i)=>{let e=0,t=!0;for(;t&&e<i.length;)t=i[e++];return t});Fo("=",10,!0);ni("=",(i,e)=>{let t=ue(e),n,s,r=typeof i=="string"?(o,a)=>o[i]=a:i[0]==="."?(n=ue(i[1]),s=i[2],(o,a)=>n(o)[s]=a):i[0]==="["?(n=ue(i[1]),s=ue(i[2]),(o,a)=>n(o)[s(o)]=a):oi("Bad left value");return o=>r(o,t(o))});se("+",qo,(i,e)=>i+e);se("-",qo,(i,e)=>i-e);se("*",lr,(i,e)=>i*e);se("/",lr,(i,e)=>i/e);se("%",lr,(i,e)=>i%e);se("|",ol,(i,e)=>i|e);se("&",cl,(i,e)=>i&e);se("^",al,(i,e)=>i^e);se("==",Vo,(i,e)=>i==e);se("!=",Vo,(i,e)=>i!=e);se(">",as,(i,e)=>i>e);se(">=",as,(i,e)=>i>=e);se("<",as,(i,e)=>i<e);se("<=",as,(i,e)=>i<=e);se(">>",ur,(i,e)=>i>>e);se(">>>",ur,(i,e)=>i>>>e);se("<<",ur,(i,e)=>i<<e);se("+",In,i=>+i);se("-",In,i=>-i);se("!",In,i=>!i);Ho("++",In,(i,e)=>++i[e]);Ho("--",In,(i,e)=>--i[e]);Ci("[",Sn,i=>i&&["[",i,ui(0,tl)||oi()]);ni("[",(i,e)=>e&&(i=ue(i),e=ue(e),t=>i(t)[e(t)]));Ci(".",Sn,(i,e)=>i&&(e=ui(Sn))&&[".",i,e]);ni(".",(i,e)=>(i=ue(i),e=e[0]?e:e[1],t=>i(t)[e]));Ci("(",Sn,i=>!i&&["(",ui(0,jo)||oi()]);Ci("(",Sn,(i,e)=>i&&(e=ui(0,jo),e?["(",i,e]:["(",i,""]));ni("(",(i,e,t,n,s)=>e==null?ue(i):(s=e==""?()=>[]:e[0]===","?(e=e.slice(1).map(ue),r=>e.map(o=>o(r))):(e=ue(e),r=>[e(r)]),i[0]==="."?(t=i[2],i=ue(i[1]),r=>i(r)[t](...s(r))):i[0]==="["?(t=ue(i[2]),i=ue(i[1]),r=>i(r)[t(r)](...s(r))):(i=ue(i),r=>i(r)(...s(r)))));Promise.resolve();var Nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/*! *****************************************************************************
|
|
@@ -60,4 +60,4 @@ a=extmap-allow-mixed`)!==-1){const r=s.sdp.split(`
|
|
|
60
60
|
pointer-events: none !important;
|
|
61
61
|
user-select: none !important;
|
|
62
62
|
}
|
|
63
|
-
`,i}function Lh(i){xc(i,"svelte-10y2zdk",'#liveroom-client-element.svelte-10y2zdk.svelte-10y2zdk{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-10y2zdk.svelte-10y2zdk{z-index:999999;position:fixed;inset:0;overflow:hidden;pointer-events:none}.user.svelte-10y2zdk.svelte-10y2zdk{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[data-isfocusmode="true"].svelte-10y2zdk.svelte-10y2zdk{transform:translate(calc(50vw - 350px), calc(50svh - 200px)) scale(4)}.user.svelte-10y2zdk .cursor.svelte-10y2zdk{position:absolute;top:0;left:0;color:var(--color);transform-origin:top left;transform:rotate(6deg)}.user[data-isself="true"].svelte-10y2zdk .cursor.svelte-10y2zdk{display:none}.user[data-isfocusmode="true"].svelte-10y2zdk .cursor.svelte-10y2zdk{opacity:0}.user-label.svelte-10y2zdk.svelte-10y2zdk{font-weight:600;font-size:12px;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);display:flex;flex-direction:column;align-items:center}.user-label[data-cameraenabled="false"].svelte-10y2zdk.svelte-10y2zdk{position:absolute;top:18px;left:14px}.user-label[data-cameraenabled="true"].svelte-10y2zdk.svelte-10y2zdk{position:absolute;top:10px;left:6px}.user[data-isfocusmode="true"].svelte-10y2zdk .user-label.svelte-10y2zdk{position:absolute;top:0;left:0;background-color:transparent;overflow:visible;box-shadow:none}.user[data-isself="true"].svelte-10y2zdk .user-label.svelte-10y2zdk{display:none}.user-label.svelte-10y2zdk .user-name.svelte-10y2zdk{display:flex;justify-content:center;align-items:center;background-color:var(--color)}.user[data-isfocusmode="false"].svelte-10y2zdk .user-label[data-cameraenabled="false"] .user-name.svelte-10y2zdk{padding:4px 10px}.user[data-isfocusmode="false"].svelte-10y2zdk .user-label[data-cameraenabled="true"] .user-name.svelte-10y2zdk{position:absolute;inset-inline:0;bottom:0;padding:2px 0 4px 0}.user[data-isfocusmode="true"].svelte-10y2zdk .user-label .user-name.svelte-10y2zdk{transform:translate(0, -4px) scale(0.3);border-radius:9999px;padding:4px 16px;width:fit-content}.user-label.svelte-10y2zdk #video-container.svelte-10y2zdk{overflow:hidden;display:flex;justify-content:center;align-items:center}.user[data-isfocusmode="false"].svelte-10y2zdk .user-label #video-container.svelte-10y2zdk{height:100px;width:100px}.user[data-isfocusmode="true"].svelte-10y2zdk .user-label #video-container.svelte-10y2zdk{height:100px;width:auto;border-radius:4px;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user[data-isfocusmode="false"].svelte-10y2zdk .user-label[data-cameraenabled="false"] #video-container.svelte-10y2zdk{display:none}.user-label.svelte-10y2zdk #video-container video.svelte-10y2zdk{height:100%;aspect-ratio:16 / 9;transform:scaleX(-1);margin-bottom:30px}.user[data-isfocusmode="true"].svelte-10y2zdk .user-label #video-container video.svelte-10y2zdk{margin-bottom:0}.user.svelte-10y2zdk .halo.svelte-10y2zdk{transform:scale(0);z-index:-1;position:absolute;top:-60px;left:-60px;width:120px;height:120px;border-radius:9999px;border:1px solid var(--color75);background-color:var(--color25);transition:transform 200ms ease-in-out;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-10y2zdk .halo[data-show="true"].svelte-10y2zdk{transform:scale(1)}.user[data-isfocusmode="true"].svelte-10y2zdk .halo.svelte-10y2zdk{transform:scale(0) !important}#focus_mode_dialog.svelte-10y2zdk.svelte-10y2zdk{z-index:999998;position:fixed;inset:0;background-color:rgb(39, 39, 42, 0.25);backdrop-filter:blur(6px)}')}function wo(i,e,t){const n=i.slice();return n[31]=e[t],n[32]=e,n[33]=t,n}function Eo(i){let e,t=[],n=new Map,s=xr(Object.values(i[2]));const r=o=>o[31].id;for(let o=0;o<s.length;o+=1){let a=wo(i,s,o),c=r(a);n.set(c,t[o]=Po(c,a))}return{c(){e=$e("div");for(let o=0;o<t.length;o+=1)t[o].c();q(e,"id","users-container"),q(e,"class","svelte-10y2zdk")},m(o,a){Ti(o,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null)},p(o,a){a[0]&30&&(s=xr(Object.values(o[2])),t=Hc(t,a,r,1,o,s,n,e,$c,Po,null,wo))},d(o){o&&yi(e);for(let a=0;a<t.length;a+=1)t[a].d()}}}function Po(i,e){let t,n,s,r,o,a,c,u,l=e[31],h,f,p=e[31].name+"",y,v,w,S,E,J,K,me,de;const U=()=>e[15](c,l),ee=()=>e[15](null,l);return{key:i,first:null,c(){t=$e("div"),n=Rr("svg"),s=Rr("path"),r=an(),o=$e("div"),a=$e("div"),c=$e("video"),h=an(),f=$e("div"),y=or(p),w=an(),S=$e("div"),J=an(),q(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"),q(n,"width","23"),q(n,"viewBox","0 0 27 24"),q(n,"fill","currentColor"),q(n,"aria-hidden","true"),q(n,"xmlns","http://www.w3.org/2000/svg"),q(n,"class","cursor svelte-10y2zdk"),q(c,"id",u=`user-video-${e[31].id}`),q(c,"class","svelte-10y2zdk"),q(a,"id","video-container"),q(a,"class","svelte-10y2zdk"),q(f,"class","user-name svelte-10y2zdk"),q(o,"class","user-label svelte-10y2zdk"),q(o,"data-cameraenabled",v=e[31].camera_enabled),q(S,"class","halo svelte-10y2zdk"),q(S,"data-show",E=(e[31].id==e[1].id&&e[31].is_shift_key_down||e[31].id!=e[1].id&&(e[31].is_shift_key_down||e[31].is_mouse_down))&&e[4]>1),q(t,"id",K="user-"+e[31].id),q(t,"class","user svelte-10y2zdk"),q(t,"data-isself",me=e[31].id==e[1].id),q(t,"data-isfocusmode",de=e[31].is_f_key_down),it(t,"--color",e[31].color),it(t,"--color25",e[31].color+"25"),it(t,"--color75",e[31].color+"75"),it(t,"--x",parseFloat(e[31].x)+"vw"),it(t,"--y",parseFloat(e[31].y)+"vh"),this.first=t},m(M,H){Ti(M,t,H),Me(t,n),Me(n,s),Me(t,r),Me(t,o),Me(o,a),Me(a,c),U(),Me(o,h),Me(o,f),Me(f,y),Me(t,w),Me(t,S),Me(t,J)},p(M,H){e=M,H[0]&4&&u!==(u=`user-video-${e[31].id}`)&&q(c,"id",u),l!==e[31]&&(ee(),l=e[31],U()),H[0]&4&&p!==(p=e[31].name+"")&&Dc(y,p),H[0]&4&&v!==(v=e[31].camera_enabled)&&q(o,"data-cameraenabled",v),H[0]&22&&E!==(E=(e[31].id==e[1].id&&e[31].is_shift_key_down||e[31].id!=e[1].id&&(e[31].is_shift_key_down||e[31].is_mouse_down))&&e[4]>1)&&q(S,"data-show",E),H[0]&4&&K!==(K="user-"+e[31].id)&&q(t,"id",K),H[0]&6&&me!==(me=e[31].id==e[1].id)&&q(t,"data-isself",me),H[0]&4&&de!==(de=e[31].is_f_key_down)&&q(t,"data-isfocusmode",de),H[0]&4&&it(t,"--color",e[31].color),H[0]&4&&it(t,"--color25",e[31].color+"25"),H[0]&4&&it(t,"--color75",e[31].color+"75"),H[0]&4&&it(t,"--x",parseFloat(e[31].x)+"vw"),H[0]&4&&it(t,"--y",parseFloat(e[31].y)+"vh")},d(M){M&&yi(t),ee()}}}function _o(i){let e;return{c(){e=$e("div"),q(e,"id","focus_mode_dialog"),q(e,"role","dialog"),q(e,"class","svelte-10y2zdk")},m(t,n){Ti(t,e,n)},d(t){t&&yi(e)}}}function Uh(i){let e,t,n,s=i[1]&&i[2]&&Eo(i),r=i[0]&&_o();return{c(){e=$e("div"),s&&s.c(),t=an(),r&&r.c(),n=Ac(),q(e,"id","liveroom-client-element"),q(e,"class","svelte-10y2zdk")},m(o,a){Ti(o,e,a),s&&s.m(e,null),Ti(o,t,a),r&&r.m(o,a),Ti(o,n,a)},p(o,a){o[1]&&o[2]?s?s.p(o,a):(s=Eo(o),s.c(),s.m(e,null)):s&&(s.d(1),s=null),o[0]?r||(r=_o(),r.c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},i:kn,o:kn,d(o){o&&(yi(e),yi(t),yi(n)),s&&s.d(),r&&r.d(o)}}}function sr(i,e){if(i.tagName==="BODY")return window;if(rr(i))return i;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?sr(i.parentElement,e):window}function rr(i){return i.tagName==="ION-CONTENT"&&typeof i.scrollByPoint=="function"}function Fh(i,e,t){let{version:n}=e,{url:s}=e,{room_id:r}=e,{room_token:o}=e,{user_name:a=void 0}=e,{user_color:c=void 0}=e,u,l,h=!1,f=!1,p=Mh(),y=Dh(),v,w,S,E,J={},K;Uc(async()=>{console.log(`[Liveroom] Starting in room '${r}' (user name: '${a}')... (v${n})`),de()}),Fc(()=>{U(),Zi(),t(0,f=!1)});async function me(){if(console.log("[LiveKit] Beginning setup..."),t(11,l=new fc({dynacast:!0}).on(_.TrackSubscribed,async(O,ge,ve)=>{switch(console.log("[LiveKit] Track Subscribed",O,ge,ve),console.table({identity:ve.identity,source:ge.source}),ge.source){case C.Source.Camera:{const Z=J[ve.identity];Z&&(console.log(`[LiveKit] Attaching user camera (identity ${ve.identity})`),O.attach(Z));break}}})),console.log("[LiveKit] Created room",l.name),!S)throw new Error("LiveKit websocket URL not set");if(!E)throw new Error("LiveKit token not set");console.log(`[LiveKit] Connecting to '${S}'...`),await l.connect(S,E,{autoSubscribe:!0}),console.log("[LiveKit] Connected to room",l.name)}function de(){console.log(`[Liveroom] Starting session on room ${r}`),u=new Qu({url:s,topic:`liveroom-livestate:rooms:${r}`,params:{room_id:r,room_token:o,user_name:a,user_color:c,referrer:document.referrer,current_url:window.location.href,window_inner_width:window.innerWidth,window_inner_height:window.innerHeight,window_outer_width:window.outerWidth,window_outer_height:window.outerHeight,language:window.navigator.language,user_agent:window.navigator.userAgent},socketOptions:{logger:(O,ge,ve)=>{switch(O){case"error":console.error("Error in socket",ge,ve);break}}}}),u.addEventListener("wheel-from-another-user",({detail:{delta_x:O,delta_y:ge,x:ve,y:Z}})=>{const Ee=parseInt(O),Ii=parseInt(ge),oe=new WheelEvent("wheel",{view:window,bubbles:!0,cancelable:!0,clientX:window.innerWidth*parseFloat(ve)/100,clientY:window.innerHeight*parseFloat(Z)/100,deltaX:Ee,deltaY:Ii,deltaMode:0}),Mn=document.head.contains(y);Mn&&document.head.removeChild(y);const Ni=document.elementFromPoint(oe.clientX,oe.clientY);if(Mn&&document.head.appendChild(y),Ni instanceof HTMLElement||Ni instanceof SVGElement)if(Math.abs(Ii)>=Math.abs(Ee)){const Pt=sr(Ni,"vertical");rr(Pt)?Pt.scrollByPoint(0,Ii,0):Pt.scrollBy({top:Ii,left:0,behavior:"instant"})}else{const Pt=sr(Ni,"horizontal");rr(Pt)?Pt.scrollByPoint(Ee,0,0):Pt.scrollBy({top:0,left:Ee,behavior:"instant"})}}),u.addEventListener("click-from-another-user",({detail:{x:O,y:ge}})=>{const ve=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,clientX:window.innerWidth*parseFloat(O)/100,clientY:window.innerHeight*parseFloat(ge)/100}),Z=document.head.contains(y);Z&&document.head.removeChild(y);const Ee=document.elementFromPoint(ve.clientX,ve.clientY);Ee==null||Ee.dispatchEvent(ve),Z&&document.head.appendChild(y)}),u.addEventListener("livestate-change",({detail:{state:O}})=>{var ge,ve;(ge=O==null?void 0:O.me)!=null&&ge.name&&O.me.name!=(v==null?void 0:v.name)&&(sessionStorage==null||sessionStorage.setItem(Pr.SESSION_STORAGE_KEY_USER_NAME,O.me.name)),(ve=O==null?void 0:O.me)!=null&&ve.color&&O.me.color!=(v==null?void 0:v.color)&&(sessionStorage==null||sessionStorage.setItem(Pr.SESSION_STORAGE_KEY_USER_COLOR,O.me.color)),t(5,r=O.room_id),t(1,v=O.me),t(2,w=O.users),t(13,S=O.livekit_ws_url),t(14,E=O.livekit_token)}),u.connect(),window.addEventListener("mousemove",ee),window.addEventListener("mousedown",M),window.addEventListener("mouseup",H),window.addEventListener("keydown",tt),window.addEventListener("keyup",Qi),window.addEventListener("resize",xi)}function U(){window.removeEventListener("resize",xi),window.removeEventListener("keyup",Qi),window.removeEventListener("keydown",tt),window.removeEventListener("mouseup",H),window.removeEventListener("mousedown",M),window.removeEventListener("mousemove",ee),u==null||u.disconnect(),u=void 0,l==null||l.disconnect(),t(11,l=void 0)}function ee(O){u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("mouse_move",{detail:{user_id:v.id,x:Number(O.clientX/window.innerWidth*100).toFixed(2),y:Number(O.clientY/window.innerHeight*100).toFixed(2)}}))}function M(){u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("mouse_down",{detail:{user_id:v.id}}))}function H(){u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("mouse_up",{detail:{user_id:v.id}}))}const Et=["Shift"];function tt(O){!O.repeat&&Et.includes(O.key)&&u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("key_down",{detail:{key:O.key,user_id:v.id}}))}function Qi(O){Et.includes(O.key)&&u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("key_up",{detail:{key:O.key,user_id:v.id}}))}function xi(){setTimeout(()=>{u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("window_resize",{detail:{window_inner_width:window.innerWidth,window_inner_height:window.innerHeight,window_outer_width:window.outerWidth,window_outer_height:window.outerHeight,user_id:v.id}}))},100)}function Nn(){document.head.appendChild(p),document.head.appendChild(y),t(12,h=!0)}function Zi(){document.head.removeChild(p),document.head.removeChild(y),t(12,h=!1)}function An(O,ge){_s[O?"unshift":"push"](()=>{J[ge.id]=O,t(3,J)})}return i.$$set=O=>{"version"in O&&t(6,n=O.version),"url"in O&&t(7,s=O.url),"room_id"in O&&t(5,r=O.room_id),"room_token"in O&&t(8,o=O.room_token),"user_name"in O&&t(9,a=O.user_name),"user_color"in O&&t(10,c=O.user_color)},i.$$.update=()=>{i.$$.dirty[0]&26630&&!l&&v&&w&&S&&E&&me(),i.$$.dirty[0]&4&&t(4,K=Object.keys(w||{}).length),i.$$.dirty[0]&4100&&!h&&w&&Object.values(w).some(O=>O.type=="admin"&&O.is_b_key_down)&&Nn(),i.$$.dirty[0]&4100&&h&&w&&Object.values(w).filter(O=>O.type=="admin").every(O=>!O.is_b_key_down)&&Zi(),i.$$.dirty[0]&5&&!f&&w&&Object.values(w).some(O=>O.type=="admin"&&O.is_f_key_down)&&t(0,f=!0),i.$$.dirty[0]&5&&f&&w&&Object.values(w).filter(O=>O.type=="admin").every(O=>!O.is_f_key_down)&&t(0,f=!1)},[f,v,w,J,K,r,n,s,o,a,c,l,h,S,E,An]}class gc extends Xc{constructor(e){super(),Kc(this,e,Fh,Uh,Rc,{version:6,url:7,room_id:5,room_token:8,user_name:9,user_color:10},Lh,[-1,-1])}get version(){return this.$$.ctx[6]}set version(e){this.$$set({version:e}),hi()}get url(){return this.$$.ctx[7]}set url(e){this.$$set({url:e}),hi()}get room_id(){return this.$$.ctx[5]}set room_id(e){this.$$set({room_id:e}),hi()}get room_token(){return this.$$.ctx[8]}set room_token(e){this.$$set({room_token:e}),hi()}get user_name(){return this.$$.ctx[9]}set user_name(e){this.$$set({user_name:e}),hi()}get user_color(){return this.$$.ctx[10]}set user_color(e){this.$$set({user_color:e}),hi()}}customElements.define("liveroom-client-element",Yc(gc,{version:{},url:{},room_id:{},room_token:{},user_name:{},user_color:{}},[],[],!0));module.exports=gc;
|
|
63
|
+
`,i}function Lh(i){xc(i,"svelte-10y2zdk",'#liveroom-client-element.svelte-10y2zdk.svelte-10y2zdk{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-10y2zdk.svelte-10y2zdk{z-index:999999;position:fixed;inset:0;overflow:hidden;pointer-events:none}.user.svelte-10y2zdk.svelte-10y2zdk{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[data-isfocusmode="true"].svelte-10y2zdk.svelte-10y2zdk{transform:translate(calc(50vw - 350px), calc(50svh - 200px)) scale(4)}.user.svelte-10y2zdk .cursor.svelte-10y2zdk{position:absolute;top:0;left:0;color:var(--color);transform-origin:top left;transform:rotate(6deg)}.user[data-isself="true"].svelte-10y2zdk .cursor.svelte-10y2zdk{display:none}.user[data-isfocusmode="true"].svelte-10y2zdk .cursor.svelte-10y2zdk{opacity:0}.user-label.svelte-10y2zdk.svelte-10y2zdk{font-weight:600;font-size:12px;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);display:flex;flex-direction:column;align-items:center}.user-label[data-cameraenabled="false"].svelte-10y2zdk.svelte-10y2zdk{position:absolute;top:18px;left:14px}.user-label[data-cameraenabled="true"].svelte-10y2zdk.svelte-10y2zdk{position:absolute;top:10px;left:6px}.user[data-isfocusmode="true"].svelte-10y2zdk .user-label.svelte-10y2zdk{position:absolute;top:0;left:0;background-color:transparent;overflow:visible;box-shadow:none}.user[data-isself="true"].svelte-10y2zdk .user-label.svelte-10y2zdk{display:none}.user-label.svelte-10y2zdk .user-name.svelte-10y2zdk{display:flex;justify-content:center;align-items:center;background-color:var(--color)}.user[data-isfocusmode="false"].svelte-10y2zdk .user-label[data-cameraenabled="false"] .user-name.svelte-10y2zdk{padding:4px 10px}.user[data-isfocusmode="false"].svelte-10y2zdk .user-label[data-cameraenabled="true"] .user-name.svelte-10y2zdk{position:absolute;inset-inline:0;bottom:0;padding:2px 0 4px 0}.user[data-isfocusmode="true"].svelte-10y2zdk .user-label .user-name.svelte-10y2zdk{transform:translate(0, -4px) scale(0.3);border-radius:9999px;padding:4px 16px;width:fit-content}.user-label.svelte-10y2zdk #video-container.svelte-10y2zdk{overflow:hidden;display:flex;justify-content:center;align-items:center}.user[data-isfocusmode="false"].svelte-10y2zdk .user-label #video-container.svelte-10y2zdk{height:100px;width:100px}.user[data-isfocusmode="true"].svelte-10y2zdk .user-label #video-container.svelte-10y2zdk{height:100px;width:auto;border-radius:4px;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user[data-isfocusmode="false"].svelte-10y2zdk .user-label[data-cameraenabled="false"] #video-container.svelte-10y2zdk{display:none}.user-label.svelte-10y2zdk #video-container video.svelte-10y2zdk{height:100%;aspect-ratio:16 / 9;transform:scaleX(-1);margin-bottom:30px}.user[data-isfocusmode="true"].svelte-10y2zdk .user-label #video-container video.svelte-10y2zdk{margin-bottom:0}.user.svelte-10y2zdk .halo.svelte-10y2zdk{transform:scale(0);z-index:-1;position:absolute;top:-60px;left:-60px;width:120px;height:120px;border-radius:9999px;border:1px solid var(--color75);background-color:var(--color25);transition:transform 200ms ease-in-out;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05)}.user.svelte-10y2zdk .halo[data-show="true"].svelte-10y2zdk{transform:scale(1)}.user[data-isfocusmode="true"].svelte-10y2zdk .halo.svelte-10y2zdk{transform:scale(0) !important}#focus_mode_dialog.svelte-10y2zdk.svelte-10y2zdk{z-index:999998;position:fixed;inset:0;background-color:rgb(39, 39, 42, 0.25);backdrop-filter:blur(6px)}')}function wo(i,e,t){const n=i.slice();return n[31]=e[t],n[32]=e,n[33]=t,n}function Eo(i){let e,t=[],n=new Map,s=xr(Object.values(i[2]));const r=o=>o[31].id;for(let o=0;o<s.length;o+=1){let a=wo(i,s,o),c=r(a);n.set(c,t[o]=Po(c,a))}return{c(){e=$e("div");for(let o=0;o<t.length;o+=1)t[o].c();q(e,"id","users-container"),q(e,"class","svelte-10y2zdk")},m(o,a){Ti(o,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null)},p(o,a){a[0]&30&&(s=xr(Object.values(o[2])),t=Hc(t,a,r,1,o,s,n,e,$c,Po,null,wo))},d(o){o&&yi(e);for(let a=0;a<t.length;a+=1)t[a].d()}}}function Po(i,e){let t,n,s,r,o,a,c,u,l=e[31],h,f,p=e[31].name+"",y,v,w,S,E,J,K,me,de;const U=()=>e[15](c,l),ee=()=>e[15](null,l);return{key:i,first:null,c(){t=$e("div"),n=Rr("svg"),s=Rr("path"),r=an(),o=$e("div"),a=$e("div"),c=$e("video"),h=an(),f=$e("div"),y=or(p),w=an(),S=$e("div"),J=an(),q(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"),q(n,"width","23"),q(n,"viewBox","0 0 27 24"),q(n,"fill","currentColor"),q(n,"aria-hidden","true"),q(n,"xmlns","http://www.w3.org/2000/svg"),q(n,"class","cursor svelte-10y2zdk"),q(c,"id",u=`user-video-${e[31].id}`),q(c,"class","svelte-10y2zdk"),q(a,"id","video-container"),q(a,"class","svelte-10y2zdk"),q(f,"class","user-name svelte-10y2zdk"),q(o,"class","user-label svelte-10y2zdk"),q(o,"data-cameraenabled",v=e[31].camera_enabled),q(S,"class","halo svelte-10y2zdk"),q(S,"data-show",E=(e[31].id==e[1].id&&e[31].is_shift_key_down||e[31].id!=e[1].id&&(e[31].is_shift_key_down||e[31].is_mouse_down))&&e[4]>1),q(t,"id",K="user-"+e[31].id),q(t,"class","user svelte-10y2zdk"),q(t,"data-isself",me=e[31].id==e[1].id),q(t,"data-isfocusmode",de=e[31].is_f_key_down),it(t,"--color",e[31].color),it(t,"--color25",e[31].color+"25"),it(t,"--color75",e[31].color+"75"),it(t,"--x",parseFloat(e[31].x)+"vw"),it(t,"--y",parseFloat(e[31].y)+"vh"),this.first=t},m(M,H){Ti(M,t,H),Me(t,n),Me(n,s),Me(t,r),Me(t,o),Me(o,a),Me(a,c),U(),Me(o,h),Me(o,f),Me(f,y),Me(t,w),Me(t,S),Me(t,J)},p(M,H){e=M,H[0]&4&&u!==(u=`user-video-${e[31].id}`)&&q(c,"id",u),l!==e[31]&&(ee(),l=e[31],U()),H[0]&4&&p!==(p=e[31].name+"")&&Dc(y,p),H[0]&4&&v!==(v=e[31].camera_enabled)&&q(o,"data-cameraenabled",v),H[0]&22&&E!==(E=(e[31].id==e[1].id&&e[31].is_shift_key_down||e[31].id!=e[1].id&&(e[31].is_shift_key_down||e[31].is_mouse_down))&&e[4]>1)&&q(S,"data-show",E),H[0]&4&&K!==(K="user-"+e[31].id)&&q(t,"id",K),H[0]&6&&me!==(me=e[31].id==e[1].id)&&q(t,"data-isself",me),H[0]&4&&de!==(de=e[31].is_f_key_down)&&q(t,"data-isfocusmode",de),H[0]&4&&it(t,"--color",e[31].color),H[0]&4&&it(t,"--color25",e[31].color+"25"),H[0]&4&&it(t,"--color75",e[31].color+"75"),H[0]&4&&it(t,"--x",parseFloat(e[31].x)+"vw"),H[0]&4&&it(t,"--y",parseFloat(e[31].y)+"vh")},d(M){M&&yi(t),ee()}}}function _o(i){let e;return{c(){e=$e("div"),q(e,"id","focus_mode_dialog"),q(e,"role","dialog"),q(e,"class","svelte-10y2zdk")},m(t,n){Ti(t,e,n)},d(t){t&&yi(e)}}}function Uh(i){let e,t,n,s=i[1]&&i[2]&&Eo(i),r=i[0]&&_o();return{c(){e=$e("div"),s&&s.c(),t=an(),r&&r.c(),n=Ac(),q(e,"id","liveroom-client-element"),q(e,"class","svelte-10y2zdk")},m(o,a){Ti(o,e,a),s&&s.m(e,null),Ti(o,t,a),r&&r.m(o,a),Ti(o,n,a)},p(o,a){o[1]&&o[2]?s?s.p(o,a):(s=Eo(o),s.c(),s.m(e,null)):s&&(s.d(1),s=null),o[0]?r||(r=_o(),r.c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},i:kn,o:kn,d(o){o&&(yi(e),yi(t),yi(n)),s&&s.d(),r&&r.d(o)}}}function sr(i,e){if(i.tagName==="BODY")return window;if(rr(i))return i;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?sr(i.parentElement,e):window}function rr(i){return i.tagName==="ION-CONTENT"&&typeof i.scrollByPoint=="function"}function Fh(i,e,t){let{version:n}=e,{url:s}=e,{room_id:r}=e,{room_token:o}=e,{user_name:a=void 0}=e,{user_color:c=void 0}=e,u,l,h=!1,f=!1,p=Mh(),y=Dh(),v,w,S,E,J={},K;Uc(async()=>{console.log(`[Liveroom] Starting in room '${r}' (user name: '${a}')... (v${n})`),de()}),Fc(()=>{U(),Zi(),t(0,f=!1)});async function me(){if(console.log("[LiveKit] Beginning setup..."),t(11,l=new fc({dynacast:!0}).on(_.TrackSubscribed,async(O,ge,ve)=>{switch(console.log("[LiveKit] Track Subscribed",O,ge,ve),console.table({identity:ve.identity,source:ge.source}),ge.source){case C.Source.Camera:{const Z=J[ve.identity];Z&&(console.log(`[LiveKit] Attaching user camera (identity ${ve.identity})`),O.attach(Z));break}}})),console.log("[LiveKit] Created room",l.name),!S)throw new Error("LiveKit websocket URL not set");if(!E)throw new Error("LiveKit token not set");console.log(`[LiveKit] Connecting to '${S}'...`),await l.connect(S,E,{autoSubscribe:!0}),console.log("[LiveKit] Connected to room",l.name)}function de(){console.log(`[Liveroom] Starting session on room ${r}`),u=new Qu({url:s,topic:`liveroom-livestate:rooms:${r}`,params:{room_id:r,room_token:o,user_name:a,user_color:c,referrer:document.referrer,current_url:window.location.href,window_inner_width:window.innerWidth,window_inner_height:window.innerHeight,window_outer_width:window.outerWidth,window_outer_height:window.outerHeight,language:window.navigator.language,user_agent:window.navigator.userAgent},socketOptions:{logger:(O,ge,ve)=>{switch(O){case"error":console.error("Error in socket",ge,ve);break}}}}),u.addEventListener("wheel-from-another-user",({detail:{delta_x:O,delta_y:ge,x:ve,y:Z}})=>{const Ee=parseInt(O),Ii=parseInt(ge),oe=new WheelEvent("wheel",{view:window,bubbles:!0,cancelable:!0,clientX:window.innerWidth*parseFloat(ve)/100,clientY:window.innerHeight*parseFloat(Z)/100,deltaX:Ee,deltaY:Ii,deltaMode:0}),Mn=document.head.contains(y);Mn&&document.head.removeChild(y);const Ni=document.elementFromPoint(oe.clientX,oe.clientY);if(Mn&&document.head.appendChild(y),Ni instanceof HTMLElement||Ni instanceof SVGElement)if(Math.abs(Ii)>=Math.abs(Ee)){const Pt=sr(Ni,"vertical");rr(Pt)?Pt.scrollByPoint(0,Ii,0):Pt.scrollBy({top:Ii,left:0,behavior:"instant"})}else{const Pt=sr(Ni,"horizontal");rr(Pt)?Pt.scrollByPoint(Ee,0,0):Pt.scrollBy({top:0,left:Ee,behavior:"instant"})}}),u.addEventListener("click-from-another-user",({detail:{x:O,y:ge}})=>{const ve=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0,clientX:window.innerWidth*parseFloat(O)/100,clientY:window.innerHeight*parseFloat(ge)/100}),Z=document.head.contains(y);Z&&document.head.removeChild(y);const Ee=document.elementFromPoint(ve.clientX,ve.clientY);Ee==null||Ee.dispatchEvent(ve),Z&&document.head.appendChild(y)}),u.addEventListener("livestate-change",({detail:{state:O}})=>{var ge,ve;(ge=O==null?void 0:O.me)!=null&&ge.name&&O.me.name!=(v==null?void 0:v.name)&&(sessionStorage==null||sessionStorage.setItem(Pr.SESSION_STORAGE_KEY_USER_NAME,O.me.name)),(ve=O==null?void 0:O.me)!=null&&ve.color&&O.me.color!=(v==null?void 0:v.color)&&(sessionStorage==null||sessionStorage.setItem(Pr.SESSION_STORAGE_KEY_USER_COLOR,O.me.color)),t(5,r=O.room_id),t(1,v=O.me),t(2,w=O.users),t(13,S=O.livekit_ws_url),t(14,E=O.livekit_token)}),u.connect(),window.addEventListener("mousemove",ee),window.addEventListener("mousedown",M),window.addEventListener("mouseup",H),window.addEventListener("keydown",tt),window.addEventListener("keyup",Qi),window.addEventListener("resize",xi)}function U(){window.removeEventListener("resize",xi),window.removeEventListener("keyup",Qi),window.removeEventListener("keydown",tt),window.removeEventListener("mouseup",H),window.removeEventListener("mousedown",M),window.removeEventListener("mousemove",ee),u==null||u.disconnect(),u=void 0,l==null||l.disconnect(),t(11,l=void 0)}function ee(O){u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("mouse_move",{detail:{user_id:v.id,x:Number(O.clientX/window.innerWidth*100).toFixed(2),y:Number(O.clientY/window.innerHeight*100).toFixed(2)}}))}function M(){u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("mouse_down",{detail:{user_id:v.id}}))}function H(){u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("mouse_up",{detail:{user_id:v.id}}))}const Et=["Shift"];function tt(O){!O.repeat&&Et.includes(O.key)&&u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("key_down",{detail:{key:O.key,user_id:v.id}}))}function Qi(O){Et.includes(O.key)&&u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("key_up",{detail:{key:O.key,user_id:v.id}}))}function xi(){setTimeout(()=>{u&&(v!=null&&v.id)&&u.dispatchEvent(new CustomEvent("window_resize",{detail:{window_inner_width:window.innerWidth,window_inner_height:window.innerHeight,window_outer_width:window.outerWidth,window_outer_height:window.outerHeight,user_id:v.id}}))},100)}function Nn(){document.head.appendChild(p),document.head.appendChild(y),t(12,h=!0)}function Zi(){document.head.removeChild(p),document.head.removeChild(y),t(12,h=!1)}function An(O,ge){_s[O?"unshift":"push"](()=>{J[ge.id]=O,t(3,J)})}return i.$$set=O=>{"version"in O&&t(6,n=O.version),"url"in O&&t(7,s=O.url),"room_id"in O&&t(5,r=O.room_id),"room_token"in O&&t(8,o=O.room_token),"user_name"in O&&t(9,a=O.user_name),"user_color"in O&&t(10,c=O.user_color)},i.$$.update=()=>{i.$$.dirty[0]&26630&&!l&&v&&w&&S&&E&&me(),i.$$.dirty[0]&4&&t(4,K=Object.keys(w||{}).length),i.$$.dirty[0]&4100&&!h&&w&&Object.values(w).some(O=>O.type=="admin"&&O.is_b_key_down)&&Nn(),i.$$.dirty[0]&4100&&h&&w&&Object.values(w).filter(O=>O.type=="admin").every(O=>!O.is_b_key_down)&&Zi(),i.$$.dirty[0]&5&&!f&&w&&Object.values(w).some(O=>O.type=="admin"&&O.is_f_key_down)&&t(0,f=!0),i.$$.dirty[0]&5&&f&&w&&Object.values(w).filter(O=>O.type=="admin").every(O=>!O.is_f_key_down)&&t(0,f=!1)},[f,v,w,J,K,r,n,s,o,a,c,l,h,S,E,An]}class gc extends Xc{constructor(e){super(),Kc(this,e,Fh,Uh,Rc,{version:6,url:7,room_id:5,room_token:8,user_name:9,user_color:10},Lh,[-1,-1])}get version(){return this.$$.ctx[6]}set version(e){this.$$set({version:e}),hi()}get url(){return this.$$.ctx[7]}set url(e){this.$$set({url:e}),hi()}get room_id(){return this.$$.ctx[5]}set room_id(e){this.$$set({room_id:e}),hi()}get room_token(){return this.$$.ctx[8]}set room_token(e){this.$$set({room_token:e}),hi()}get user_name(){return this.$$.ctx[9]}set user_name(e){this.$$set({user_name:e}),hi()}get user_color(){return this.$$.ctx[10]}set user_color(e){this.$$set({user_color:e}),hi()}}customElements.define("liveroom-client-element",Yc(gc,{version:{},url:{},room_id:{},room_token:{},user_name:{},user_color:{}},[],[],!0));module.exports=gc;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var wc = Object.defineProperty;
|
|
2
2
|
var Ec = (i, e, t) => e in i ? wc(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var A = (i, e, t) => (Ec(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { b as Pc, d as _c } from "./constants-
|
|
4
|
+
import { b as Pc, d as _c } from "./constants-DJD2AXO4.js";
|
|
5
5
|
function kn() {
|
|
6
6
|
}
|
|
7
7
|
function _o(i) {
|
|
@@ -17832,7 +17832,8 @@ function Fh(i, e, t) {
|
|
|
17832
17832
|
{
|
|
17833
17833
|
view: window,
|
|
17834
17834
|
bubbles: !0,
|
|
17835
|
-
cancelable: !
|
|
17835
|
+
cancelable: !0,
|
|
17836
|
+
// useful else event bubbles up and whole page reloads on SPAs
|
|
17836
17837
|
clientX: window.innerWidth * parseFloat(O) / 100,
|
|
17837
17838
|
clientY: window.innerHeight * parseFloat(ge) / 100
|
|
17838
17839
|
}
|
package/dist/main.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("./constants-
|
|
1
|
+
"use strict";const n=require("./constants-DfeL-H6H.cjs"),E=e=>Object.freeze(Object.defineProperty({__proto__:null,default:e},Symbol.toStringTag,{value:"Module"}));let a,m,r;u();S();function S(){window.addEventListener("popstate",u)}async function u(){const e=document.querySelector("script[src*='/liveroom-client-element']");e==null||e.setAttribute("version",n.VERSION);const{roomId:t,roomToken:o}=A(e);if(t&&o&&(t!=a||o!=m)){a=t,m=o,sessionStorage==null||sessionStorage.setItem(n.SESSION_STORAGE_KEY_ROOM_ID,a),sessionStorage==null||sessionStorage.setItem(n.SESSION_STORAGE_KEY_ROOM_TOKEN,m),r&&(r.remove(),r=void 0);const s=e==null?void 0:e.getAttribute("data-url");await O(s||"wss://liveroom.app/room",a,m)}}async function O(e,t,o){if(!t||!o)return!1;await Promise.resolve().then(()=>E(require("./liveroom-client-element.cjs"))),console.log(`[Liveroom] Installed successfully (v${n.VERSION})`),r=document.createElement(n.ELEMENT_TAG),r.setAttribute("url",e),r.setAttribute("version",n.VERSION),t&&r.setAttribute("room_id",t),t&&r.setAttribute("room_token",o);const s=R();s&&r.setAttribute("user_name",s);const _=f();return _&&r.setAttribute("user_color",_),document.body.appendChild(r),console.log("[Liveroom] Injected successfully"),!0}function R(){const t=new URLSearchParams(window.location.search).get(n.QUERY_PARAM_KEY_USER_NAME),o=sessionStorage==null?void 0:sessionStorage.getItem(n.SESSION_STORAGE_KEY_USER_NAME);return t||o||null}function f(){const t=new URLSearchParams(window.location.search).get(n.QUERY_PARAM_KEY_USER_COLOR),o=sessionStorage==null?void 0:sessionStorage.getItem(n.SESSION_STORAGE_KEY_USER_COLOR);return t||o||null}function A(e){const t=new URLSearchParams(window.location.search),o=t.get(n.QUERY_PARAM_KEY_ROOM_ID),s=t.get(n.QUERY_PARAM_KEY_ROOM_TOKEN),_=sessionStorage==null?void 0:sessionStorage.getItem(n.SESSION_STORAGE_KEY_ROOM_ID),l=sessionStorage==null?void 0:sessionStorage.getItem(n.SESSION_STORAGE_KEY_ROOM_TOKEN),c=(e==null?void 0:e.getAttribute("data-roomid"))||null,i=(e==null?void 0:e.getAttribute("data-roomtoken"))||null;return{roomId:g(o||_||c),roomToken:s||l||i}}function g(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