Spaces:
Runtime error
Runtime error
import{H as Tn,I as gr,S as kt,i as It,s as St,J as An,K as Pn,m as j,h as $,n as C,b as ue,F as X,A as He,G as qt,k as Q,l as Z,o as ai,z as wr,L as br,q as _t,a as Pe,v as an,r as mt,c as Le,w as ln,x as cn,M as Ln,f as ve,t as Oe,y as un,N as xr,O as Er,e as $e,g as li,P as Or,d as ci,Q as kr}from"../../chunks/index-753a1ad2.js";import{w as fn}from"../../chunks/index-9f7684d6.js";const Ir=fn(!1);let Gt;typeof crypto.randomUUID>"u"?Gt=(1e7+"").replace(/\d/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)):Gt=crypto.randomUUID();const ui=fn(JSON.parse(localStorage.user||JSON.stringify(Gt)));ui.subscribe(e=>localStorage.user=JSON.stringify(e));const Sr="PROD";var Tr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},se={},S={};Object.defineProperty(S,"__esModule",{value:!0});var Ar=Object.defineProperty,Pr=Object.defineProperties,Lr=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,fi=Object.prototype.hasOwnProperty,hi=Object.prototype.propertyIsEnumerable,Rn=(e,t,n)=>t in e?Ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nt=(e,t)=>{for(var n in t||(t={}))fi.call(t,n)&&Rn(e,n,t[n]);if(yt)for(var n of yt(t))hi.call(t,n)&&Rn(e,n,t[n]);return e},Tt=(e,t)=>Pr(e,Lr(t)),Rr=(e,t)=>{var n={};for(var i in e)fi.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&yt)for(var i of yt(e))t.indexOf(i)<0&&hi.call(e,i)&&(n[i]=e[i]);return n},Nr=(e,t,n)=>new Promise((i,r)=>{var o=l=>{try{a(n.next(l))}catch(c){r(c)}},s=l=>{try{a(n.throw(l))}catch(c){r(c)}},a=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(e,t)).next())});function Mr(e,t=e){}function Cr(e,t,n=t){}function Ur(e){}function Dr(e,t){}function xe(e,t){throw new Error(t)}function N(e,t="Expected value to be non-nullable"){return e}var di=(e=>(e[e.UPDATE_PRESENCE=100]="UPDATE_PRESENCE",e[e.BROADCAST_EVENT=103]="BROADCAST_EVENT",e[e.FETCH_STORAGE=200]="FETCH_STORAGE",e[e.UPDATE_STORAGE=201]="UPDATE_STORAGE",e))(di||{}),pi=(e=>(e[e.INIT=0]="INIT",e[e.SET_PARENT_KEY=1]="SET_PARENT_KEY",e[e.CREATE_LIST=2]="CREATE_LIST",e[e.UPDATE_OBJECT=3]="UPDATE_OBJECT",e[e.CREATE_OBJECT=4]="CREATE_OBJECT",e[e.DELETE_CRDT=5]="DELETE_CRDT",e[e.DELETE_OBJECT_KEY=6]="DELETE_OBJECT_KEY",e[e.CREATE_MAP=7]="CREATE_MAP",e[e.CREATE_REGISTER=8]="CREATE_REGISTER",e))(pi||{}),_i=(e=>(e[e.OBJECT=0]="OBJECT",e[e.LIST=1]="LIST",e[e.MAP=2]="MAP",e[e.REGISTER=3]="REGISTER",e))(_i||{});function zr(e){return e.type===0&&!mi(e)}function mi(e){return e.parentId!==void 0&&e.parentKey!==void 0}var yi=(e=>(e[e.UPDATE_PRESENCE=100]="UPDATE_PRESENCE",e[e.USER_JOINED=101]="USER_JOINED",e[e.USER_LEFT=102]="USER_LEFT",e[e.BROADCASTED_EVENT=103]="BROADCASTED_EVENT",e[e.ROOM_STATE=104]="ROOM_STATE",e[e.INITIAL_STORAGE_STATE=200]="INITIAL_STORAGE_STATE",e[e.UPDATE_STORAGE=201]="UPDATE_STORAGE",e))(yi||{});function $r(e){return e==="my-presence"||e==="others"||e==="event"||e==="error"||e==="connection"||e==="history"}var vi=(e=>(e[e.CLOSE_ABNORMAL=1006]="CLOSE_ABNORMAL",e[e.INVALID_MESSAGE_FORMAT=4e3]="INVALID_MESSAGE_FORMAT",e[e.NOT_ALLOWED=4001]="NOT_ALLOWED",e[e.MAX_NUMBER_OF_MESSAGES_PER_SECONDS=4002]="MAX_NUMBER_OF_MESSAGES_PER_SECONDS",e[e.MAX_NUMBER_OF_CONCURRENT_CONNECTIONS=4003]="MAX_NUMBER_OF_CONCURRENT_CONNECTIONS",e[e.MAX_NUMBER_OF_MESSAGES_PER_DAY_PER_APP=4004]="MAX_NUMBER_OF_MESSAGES_PER_DAY_PER_APP",e[e.MAX_NUMBER_OF_CONCURRENT_CONNECTIONS_PER_ROOM=4005]="MAX_NUMBER_OF_CONCURRENT_CONNECTIONS_PER_ROOM",e[e.CLOSE_WITHOUT_RETRY=4999]="CLOSE_WITHOUT_RETRY",e))(vi||{}),Ce=32,hn=126;function ce(e,t){return e!==void 0&&t!==void 0?vt(gi(Ve(e),Ve(t))):e!==void 0?Kr(e):t!==void 0?Hr(t):vt([Ce+1])}function Hr(e){const t=[],n=Ve(e);for(let i=0;i<n.length;i++){const r=n[i];if(r<=Ce+1){if(t.push(Ce),n.length-1===i){t.push(hn);break}}else{t.push(r-1);break}}return vt(t)}function Kr(e){const t=[],n=Ve(e);for(let i=0;i<n.length;i++){const r=n[i];if(r===hn){if(t.push(r),n.length-1===i){t.push(Ce+1);break}}else{t.push(r+1);break}}return vt(t)}function gi(e,t){let n=0;const i=[];for(;;){const r=e[n]||Ce,o=t[n]||hn;if(r>o)throw new Error(`Impossible to generate position between ${e} and ${t}`);if(r===o){i.push(r),n++;continue}if(o-r===1){i.push(r),i.push(...gi(e.slice(n+1),[]));break}const s=o+r>>1;i.push(s);break}return i}function Ve(e){const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}function vt(e){return String.fromCharCode(...e)}function wi(e,t){const n=Ve(e),i=Ve(t),r=Math.max(n.length,i.length);for(let o=0;o<r;o++){const s=n[o]===void 0?Ce:n[o],a=i[o]===void 0?Ce:i[o];if(s!==a)return s-a}throw new Error(`Impossible to compare similar position "${e}" and "${t}"`)}function Nn(e,t){return Object.freeze({type:"HasParent",node:e,key:t})}var Mn=Object.freeze({type:"NoParent"});function Cn(e){return Object.freeze({type:"Orphaned",oldKey:e})}var At=class{constructor(){this._parent=Mn}_getParentKeyOrThrow(){switch(this.parent.type){case"HasParent":return this.parent.key;case"NoParent":throw new Error("Parent key is missing");case"Orphaned":return this.parent.oldKey;default:return xe(this.parent,"Unknown state")}}get _pool(){return this.__pool}get roomId(){return this.__pool?this.__pool.roomId:null}get _id(){return this.__id}get parent(){return this._parent}get _parentNode(){switch(this.parent.type){case"HasParent":return this.parent.node;case"NoParent":return null;case"Orphaned":return null;default:return xe(this.parent,"Unknown state")}}get _parentKey(){switch(this.parent.type){case"HasParent":return this.parent.key;case"NoParent":return null;case"Orphaned":return this.parent.oldKey;default:return xe(this.parent,"Unknown state")}}_apply(e,t){switch(e.type){case 5:return this.parent.type==="HasParent"?this.parent.node._detachChild(this):{modified:!1}}return{modified:!1}}_setParentLink(e,t){switch(this.parent.type){case"HasParent":if(this.parent.node!==e)throw new Error("Cannot set parent: node already has a parent");this._parent=Nn(e,t);return;case"Orphaned":case"NoParent":{this._parent=Nn(e,t);return}default:return xe(this.parent,"Unknown state")}}_attach(e,t){if(this.__id||this.__pool)throw new Error("Cannot attach node: already attached");t.addNode(e,this),this.__id=e,this.__pool=t}_detach(){switch(this.__pool&&this.__id&&this.__pool.deleteNode(this.__id),this.parent.type){case"HasParent":{this._parent=Cn(this.parent.key);break}case"NoParent":{this._parent=Mn;break}case"Orphaned":{this._parent=Cn(this.parent.oldKey);break}default:xe(this.parent,"Unknown state")}this.__pool=void 0}invalidate(){this._cachedImmutable!==void 0&&(this._cachedImmutable=void 0,this.parent.type==="HasParent"&&this.parent.node.invalidate())}toImmutable(){return this._cachedImmutable===void 0&&(this._cachedImmutable=this._toImmutable()),this._cachedImmutable}},we=class extends At{constructor(e){super(),this._data=e}get data(){return this._data}static _deserialize([e,t],n,i){const r=new we(t.data);return r._attach(e,i),r}_toOps(e,t,n){if(this._id===void 0)throw new Error("Cannot serialize register if parentId or parentKey is undefined");return[{type:8,opId:n==null?void 0:n.generateOpId(),id:this._id,parentId:e,parentKey:t,data:this.data}]}_serialize(){if(this.parent.type!=="HasParent")throw new Error("Cannot serialize LiveRegister if parent is missing");return{type:3,parentId:N(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key,data:this.data}}_attachChild(e){throw new Error("Method not implemented.")}_detachChild(e){throw new Error("Method not implemented.")}_apply(e,t){return super._apply(e,t)}_toImmutable(){return this._data}},ke=class extends At{constructor(e){if(super(),this.unacknowledgedSet=new Map,e){const t=[];for(const n of e){const i=Ke(n[1]);i._setParentLink(this,n[0]),t.push([n[0],i])}this._map=new Map(t)}else this._map=new Map}_toOps(e,t,n){if(this._id===void 0)throw new Error("Cannot serialize item is not attached");const i=[],r={id:this._id,opId:n==null?void 0:n.generateOpId(),type:7,parentId:e,parentKey:t};i.push(r);for(const[o,s]of this._map)i.push(...s._toOps(this._id,o,n));return i}static _deserialize([e,t],n,i){const r=new ke;r._attach(e,i);const o=n.get(e);if(o===void 0)return r;for(const[s,a]of o){const l=Ei([s,a],n,i);l._setParentLink(r,a.parentKey),r._map.set(a.parentKey,l),r.invalidate()}return r}_attach(e,t){super._attach(e,t);for(const[n,i]of this._map)q(i)&&i._attach(t.generateId(),t)}_attachChild(e,t){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const{id:n,parentKey:i,opId:r}=e,o=i,s=Ge(e);if(this._pool.getNode(n)!==void 0)return{modified:!1};if(t===2){const c=this.unacknowledgedSet.get(o);if(c===r)return this.unacknowledgedSet.delete(o),{modified:!1};if(c!==void 0)return{modified:!1}}else t===1&&this.unacknowledgedSet.delete(o);const a=this._map.get(o);let l;if(a){const c=N(this._id);l=a._toOps(c,o),a._detach()}else l=[{type:5,id:n}];return s._setParentLink(this,o),s._attach(n,this._pool),this._map.set(o,s),this.invalidate(),{modified:{node:this,type:"LiveMap",updates:{[o]:{type:"update"}}},reverse:l}}_detach(){super._detach();for(const e of this._map.values())e._detach()}_detachChild(e){const t=N(this._id),n=N(e._parentKey),i=e._toOps(t,n,this._pool);for(const[o,s]of this._map)s===e&&(this._map.delete(o),this.invalidate());return e._detach(),{modified:{node:this,type:"LiveMap",updates:{[n]:{type:"delete"}}},reverse:i}}_serialize(){if(this.parent.type!=="HasParent")throw new Error("Cannot serialize LiveMap if parent is missing");return{type:2,parentId:N(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key}}get(e){const t=this._map.get(e);if(t!==void 0)return Ne(t)}set(e,t){const n=this._map.get(e);n&&n._detach();const i=Ke(t);if(i._setParentLink(this,e),this._map.set(e,i),this.invalidate(),this._pool&&this._id){const r=this._pool.generateId();i._attach(r,this._pool);const o=new Map;o.set(this._id,{node:this,type:"LiveMap",updates:{[e]:{type:"update"}}});const s=i._toOps(this._id,e,this._pool);this.unacknowledgedSet.set(e,N(s[0].opId)),this._pool.dispatch(i._toOps(this._id,e,this._pool),n?n._toOps(this._id,e):[{type:5,id:r}],o)}}get size(){return this._map.size}has(e){return this._map.has(e)}delete(e){const t=this._map.get(e);if(t===void 0)return!1;if(t._detach(),this._map.delete(e),this.invalidate(),this._pool&&t._id){const n=N(this._id),i=new Map;i.set(n,{node:this,type:"LiveMap",updates:{[e]:{type:"delete"}}}),this._pool.dispatch([{type:5,id:t._id,opId:this._pool.generateOpId()}],t._toOps(n,e),i)}return!0}entries(){const e=this._map.entries();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return{done:!0,value:void 0};const i=t.value[0],r=Ne(t.value[1]);return{value:[i,r]}}}}[Symbol.iterator](){return this.entries()}keys(){return this._map.keys()}values(){const e=this._map.values();return{[Symbol.iterator](){return this},next(){const t=e.next();return t.done?{done:!0,value:void 0}:{value:Ne(t.value)}}}}forEach(e){for(const t of this)e(t[1],t[0],this)}toImmutable(){return super.toImmutable()}_toImmutable(){const e=new Map;for(const[t,n]of this._map)e.set(t,n.toImmutable());return dn(e)}},Ie=class extends At{constructor(e={}){super(),this._propToLastUpdate=new Map;for(const t in e){const n=e[t];n!==void 0&&q(n)&&n._setParentLink(this,t)}this._map=new Map(Object.entries(e))}_toOps(e,t,n){if(this._id===void 0)throw new Error("Cannot serialize item is not attached");const i=n==null?void 0:n.generateOpId(),r=[],o=e!==void 0&&t!==void 0?{type:4,id:this._id,opId:i,parentId:e,parentKey:t,data:{}}:{type:4,id:this._id,opId:i,data:{}};r.push(o);for(const[s,a]of this._map)q(a)?r.push(...a._toOps(this._id,s,n)):o.data[s]=a;return r}static _deserialize([e,t],n,i){const r=new Ie(t.data);return r._attach(e,i),this._deserializeChildren(r,n,i)}static _deserializeChildren(e,t,n){const i=t.get(N(e._id));if(i===void 0)return e;for(const[r,o]of i){const s=Br([r,o],t,n);ut(s)&&s._setParentLink(e,o.parentKey),e._map.set(o.parentKey,s),e.invalidate()}return e}_attach(e,t){super._attach(e,t);for(const[n,i]of this._map)q(i)&&i._attach(t.generateId(),t)}_attachChild(e,t){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const{id:n,opId:i,parentKey:r}=e,o=bi(e);if(this._pool.getNode(n)!==void 0)return this._propToLastUpdate.get(r)===i&&this._propToLastUpdate.delete(r),{modified:!1};if(t===0)this._propToLastUpdate.set(r,N(i));else if(this._propToLastUpdate.get(r)!==void 0)return this._propToLastUpdate.get(r)===i?(this._propToLastUpdate.delete(r),{modified:!1}):{modified:!1};const s=N(this._id),a=this._map.get(r);let l;return q(a)?(l=a._toOps(s,r),a._detach()):a===void 0?l=[{type:6,id:s,key:r}]:l=[{type:3,id:s,data:{[r]:a}}],this._map.set(r,o),this.invalidate(),ut(o)&&(o._setParentLink(this,r),o._attach(n,this._pool)),{reverse:l,modified:{node:this,type:"LiveObject",updates:{[r]:{type:"update"}}}}}_detachChild(e){if(e){const t=N(this._id),n=N(e._parentKey),i=e._toOps(t,n,this._pool);for(const[o,s]of this._map)s===e&&(this._map.delete(o),this.invalidate());return e._detach(),{modified:{node:this,type:"LiveObject",updates:{[n]:{type:"delete"}}},reverse:i}}return{modified:!1}}_detach(){super._detach();for(const e of this._map.values())q(e)&&e._detach()}_apply(e,t){return e.type===3?this._applyUpdate(e,t):e.type===6?this._applyDeleteObjectKey(e):super._apply(e,t)}_serialize(){const e={};for(const[t,n]of this._map)q(n)||(e[t]=n);return this.parent.type==="HasParent"&&this.parent.node._id?{type:0,parentId:this.parent.node._id,parentKey:this.parent.key,data:e}:{type:0,data:e}}_applyUpdate(e,t){let n=!1;const i=N(this._id),r=[],o={type:3,id:i,data:{}};r.push(o);for(const a in e.data){const l=this._map.get(a);q(l)?(r.push(...l._toOps(i,a)),l._detach()):l!==void 0?o.data[a]=l:l===void 0&&r.push({type:6,id:i,key:a})}const s={};for(const a in e.data){const l=e.data[a];if(l===void 0)continue;if(t)this._propToLastUpdate.set(a,N(e.opId));else if(this._propToLastUpdate.get(a)===void 0)n=!0;else if(this._propToLastUpdate.get(a)===e.opId){this._propToLastUpdate.delete(a);continue}else continue;const c=this._map.get(a);q(c)&&c._detach(),n=!0,s[a]={type:"update"},this._map.set(a,l),this.invalidate()}return Object.keys(o.data).length!==0&&r.unshift(o),n?{modified:{node:this,type:"LiveObject",updates:s},reverse:r}:{modified:!1}}_applyDeleteObjectKey(e){const t=e.key;if(this._map.has(t)===!1)return{modified:!1};if(this._propToLastUpdate.get(t)!==void 0)return{modified:!1};const n=this._map.get(t),i=N(this._id);let r=[];return q(n)?(r=n._toOps(i,e.key),n._detach()):n!==void 0&&(r=[{type:3,id:i,data:{[t]:n}}]),this._map.delete(t),this.invalidate(),{modified:{node:this,type:"LiveObject",updates:{[e.key]:{type:"delete"}}},reverse:r}}toObject(){return Qr(this._map)}set(e,t){this.update({[e]:t})}get(e){return this._map.get(e)}delete(e){const t=e,n=this._map.get(t);if(n===void 0)return;if(this._pool===void 0||this._id===void 0){q(n)&&n._detach(),this._map.delete(t),this.invalidate();return}let i;q(n)?(n._detach(),i=n._toOps(this._id,t)):i=[{type:3,data:{[t]:n},id:this._id}],this._map.delete(t),this.invalidate();const r=new Map;r.set(this._id,{node:this,type:"LiveObject",updates:{[e]:{type:"delete"}}}),this._pool.dispatch([{type:6,key:t,id:this._id,opId:this._pool.generateOpId()}],i,r)}update(e){if(this._pool===void 0||this._id===void 0){for(const l in e){const c=e[l];if(c===void 0)continue;const f=this._map.get(l);q(f)&&f._detach(),q(c)&&c._setParentLink(this,l),this._map.set(l,c),this.invalidate()}return}const t=[],n=[],i=this._pool.generateOpId(),r={},o={id:this._id,type:3,data:{}},s={};for(const l in e){const c=e[l];if(c===void 0)continue;const f=this._map.get(l);if(q(f)?(n.push(...f._toOps(this._id,l)),f._detach()):f===void 0?n.push({type:6,id:this._id,key:l}):o.data[l]=f,q(c)){c._setParentLink(this,l),c._attach(this._pool.generateId(),this._pool);const p=c._toOps(this._id,l,this._pool),_=p.find(v=>v.parentId===this._id);_&&this._propToLastUpdate.set(l,N(_.opId)),t.push(...p)}else r[l]=c,this._propToLastUpdate.set(l,i);this._map.set(l,c),this.invalidate(),s[l]={type:"update"}}Object.keys(o.data).length!==0&&n.unshift(o),Object.keys(r).length!==0&&t.unshift({opId:i,id:this._id,type:3,data:r});const a=new Map;a.set(this._id,{node:this,type:"LiveObject",updates:s}),this._pool.dispatch(t,n,a)}toImmutable(){return super.toImmutable()}_toImmutable(){const e={};for(const[t,n]of this._map)e[t]=ut(n)?n.toImmutable():n;return e}},dn=e=>e;function Fr(e){return e.filter(t=>t!=null)}function Vr(e){const t=nt({},e);return Object.keys(e).forEach(n=>{const i=n;t[i]===void 0&&delete t[i]}),t}function Ge(e){return Ke(bi(e))}function bi(e){switch(e.type){case 8:return e.data;case 4:return new Ie(e.data);case 7:return new ke;case 2:return new Se;default:return xe(e,"Unknown creation Op")}}function xi(e,t){return e===t?!0:e.parent.type==="HasParent"?xi(e.parent.node,t):!1}function Ei([e,t],n,i){switch(t.type){case 0:return Ie._deserialize([e,t],n,i);case 1:return Se._deserialize([e,t],n,i);case 2:return ke._deserialize([e,t],n,i);case 3:return we._deserialize([e,t],n,i);default:throw new Error("Unexpected CRDT type")}}function Br([e,t],n,i){switch(t.type){case 0:return Ie._deserialize([e,t],n,i);case 1:return Se._deserialize([e,t],n,i);case 2:return ke._deserialize([e,t],n,i);case 3:return t.data;default:throw new Error("Unexpected CRDT type")}}function ut(e){return Oi(e)||Jr(e)||ki(e)}function q(e){return ut(e)||Xr(e)}function Oi(e){return e instanceof Se}function Jr(e){return e instanceof ke}function ki(e){return e instanceof Ie}function Xr(e){return e instanceof we}function Ne(e){return e instanceof we?e.data:e instanceof Se||e instanceof ke||e instanceof Ie?e:xe(e,"Unknown AbstractCrdt")}function Ke(e){return e instanceof Ie||e instanceof ke||e instanceof Se?e:new we(e)}function Yr(e,t){const n=[];return e.forEach((i,r)=>{t.get(r)||n.push({type:5,id:r})}),t.forEach((i,r)=>{const o=e.get(r);if(o)i.type===0&&(o.type!==0||JSON.stringify(i.data)!==JSON.stringify(o.data))&&n.push({type:3,id:r,data:i.data}),i.parentKey!==o.parentKey&&n.push({type:1,id:r,parentKey:N(i.parentKey,"Parent key must not be missing")});else switch(i.type){case 3:n.push({type:8,id:r,parentId:i.parentId,parentKey:i.parentKey,data:i.data});break;case 1:n.push({type:2,id:r,parentId:i.parentId,parentKey:i.parentKey});break;case 0:n.push(i.parentId?{type:4,id:r,parentId:i.parentId,parentKey:i.parentKey,data:i.data}:{type:4,id:r,data:i.data});break;case 2:n.push({type:7,id:r,parentId:i.parentId,parentKey:i.parentKey});break}}),n}function qr(e,t){const n=e.updates;for(const[i,r]of Si(t.updates))n[i]=r;return Tt(nt({},t),{updates:n})}function Gr(e,t){const n=e.updates;for(const[i,r]of Si(t.updates))n[i]=r;return Tt(nt({},t),{updates:n})}function jr(e,t){const n=e.updates;return Tt(nt({},t),{updates:n.concat(t.updates)})}function Wr(e,t){return e?e.type==="LiveObject"&&t.type==="LiveObject"?qr(e,t):e.type==="LiveMap"&&t.type==="LiveMap"?Gr(e,t):e.type==="LiveList"&&t.type==="LiveList"?jr(e,t):t:t}function Un(e){const t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||pn(e)}function pn(e){return e!==null&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"}function Ii(e,t=""){if(!Un)return{path:t||"root",value:e};if(typeof e!="object"||e===null)return!1;for(const[n,i]of Object.entries(e)){const r=t?t+"."+n:n;if(!Un(i))return{path:r,value:i};if(typeof i=="object"){const o=Ii(i,r);if(o)return o}}return!1}function Qr(e){const t={};for(const[n,i]of e)t[n]=i;return t}function Si(e){return Object.entries(e)}function Ti(e){try{return JSON.parse(e)}catch{return}}function Ai(e){try{const t=e.replace(/-/g,"+").replace(/_/g,"/");return decodeURIComponent(atob(t).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""))}catch{return atob(e)}}function Zr(e,t){return wi(e._getParentKeyOrThrow(),t._getParentKeyOrThrow())}var Se=class extends At{constructor(e=[]){super(),this._items=[],this._implicitlyDeletedItems=new WeakSet,this._unacknowledgedSets=new Map;let t;for(let n=0;n<e.length;n++){const i=ce(t),r=Ke(e[n]);r._setParentLink(this,i),this._items.push(r),t=i}}static _deserialize([e],t,n){const i=new Se;i._attach(e,n);const r=t.get(e);if(r===void 0)return i;for(const[o,s]of r){const a=Ei([o,s],t,n);a._setParentLink(i,s.parentKey),i._insertAndSort(a)}return i}_toOps(e,t,n){if(this._id===void 0)throw new Error("Cannot serialize item is not attached");const i=[],r={id:this._id,opId:n==null?void 0:n.generateOpId(),type:2,parentId:e,parentKey:t};i.push(r);for(const o of this._items)i.push(...o._toOps(this._id,o._getParentKeyOrThrow(),n));return i}_insertAndSort(e){this._items.push(e),this._sortItems()}_sortItems(){this._items.sort(Zr),this.invalidate()}_indexOfPosition(e){return this._items.findIndex(t=>t._getParentKeyOrThrow()===e)}_attach(e,t){super._attach(e,t);for(const n of this._items)n._attach(t.generateId(),t)}_detach(){super._detach();for(const e of this._items)e._detach()}_applySetRemote(e){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const{id:t,parentKey:n}=e,i=Ge(e);i._attach(t,this._pool),i._setParentLink(this,n);const r=e.deletedId,o=this._indexOfPosition(n);if(o!==-1){const s=this._items[o];if(s._id===r)return s._detach(),this._items[o]=i,{modified:D(this,[ze(o,i)]),reverse:[]};{this._implicitlyDeletedItems.add(s),this._items[o]=i;const a=[ze(o,i)],l=this._detachItemAssociatedToSetOperation(e.deletedId);return l&&a.push(l),{modified:D(this,a),reverse:[]}}}else{const s=[],a=this._detachItemAssociatedToSetOperation(e.deletedId);return a&&s.push(a),this._insertAndSort(i),s.push(le(this._indexOfPosition(n),i)),{reverse:[],modified:D(this,s)}}}_applySetAck(e){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const t=[],n=this._detachItemAssociatedToSetOperation(e.deletedId);n&&t.push(n);const i=this._unacknowledgedSets.get(e.parentKey);if(i!==void 0){if(i!==e.opId)return t.length===0?{modified:!1}:{modified:D(this,t),reverse:[]};this._unacknowledgedSets.delete(e.parentKey)}const r=this._indexOfPosition(e.parentKey),o=this._items.find(s=>s._id===e.id);if(o!==void 0){if(o._parentKey===e.parentKey)return{modified:t.length>0?D(this,t):!1,reverse:[]};r!==-1&&(this._implicitlyDeletedItems.add(this._items[r]),this._items.splice(r,1),t.push(ot(r)));const s=this._items.indexOf(o);o._setParentLink(this,e.parentKey),this._sortItems();const a=this._items.indexOf(o);return a!==s&&t.push(Te(s,a,o)),{modified:t.length>0?D(this,t):!1,reverse:[]}}else{const s=this._pool.getNode(e.id);if(s&&this._implicitlyDeletedItems.has(s)){s._setParentLink(this,e.parentKey),this._implicitlyDeletedItems.delete(s),this._insertAndSort(s);const a=this._items.indexOf(s);return{modified:D(this,[r===-1?le(a,s):ze(a,s),...t]),reverse:[]}}else{r!==-1&&this._items.splice(r,1);const{newItem:a,newIndex:l}=this._createAttachItemAndSort(e,e.parentKey);return{modified:D(this,[r===-1?le(l,a):ze(l,a),...t]),reverse:[]}}}}_detachItemAssociatedToSetOperation(e){if(e===void 0||this._pool===void 0)return null;const t=this._pool.getNode(e);if(t===void 0)return null;const n=this._detachChild(t);return n.modified===!1?null:n.modified.updates[0]}_applyRemoteInsert(e){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const t=e.parentKey,n=this._indexOfPosition(t);n!==-1&&this._shiftItemPosition(n,t);const{newItem:i,newIndex:r}=this._createAttachItemAndSort(e,t);return{modified:D(this,[le(r,i)]),reverse:[]}}_applyInsertAck(e){const t=this._items.find(r=>r._id===e.id),n=e.parentKey,i=this._indexOfPosition(n);if(t){if(t._parentKey===n)return{modified:!1};{const r=this._items.indexOf(t);i!==-1&&this._shiftItemPosition(i,n),t._setParentLink(this,n),this._sortItems();const o=this._indexOfPosition(n);return o===r?{modified:!1}:{modified:D(this,[Te(r,o,t)]),reverse:[]}}}else{const r=N(this._pool).getNode(e.id);if(r&&this._implicitlyDeletedItems.has(r)){r._setParentLink(this,n),this._implicitlyDeletedItems.delete(r),this._insertAndSort(r);const o=this._indexOfPosition(n);return{modified:D(this,[le(o,r)]),reverse:[]}}else{i!==-1&&this._shiftItemPosition(i,n);const{newItem:o,newIndex:s}=this._createAttachItemAndSort(e,n);return{modified:D(this,[le(s,o)]),reverse:[]}}}}_applyInsertUndoRedo(e){var t;const{id:n,parentKey:i}=e,r=Ge(e);if(((t=this._pool)==null?void 0:t.getNode(n))!==void 0)return{modified:!1};r._attach(n,N(this._pool)),r._setParentLink(this,i);const o=this._indexOfPosition(i);let s=i;if(o!==-1){const l=this._items[o]?this._items[o]._getParentKeyOrThrow():void 0,c=this._items[o+1]?this._items[o+1]._getParentKeyOrThrow():void 0;s=ce(l,c),r._setParentLink(this,s)}this._insertAndSort(r);const a=this._indexOfPosition(s);return{modified:D(this,[le(a,r)]),reverse:[{type:5,id:n}]}}_applySetUndoRedo(e){var t;const{id:n,parentKey:i}=e,r=Ge(e);if(((t=this._pool)==null?void 0:t.getNode(n))!==void 0)return{modified:!1};this._unacknowledgedSets.set(i,N(e.opId));const o=this._indexOfPosition(i);r._attach(n,N(this._pool)),r._setParentLink(this,i);const s=i;if(o!==-1){const a=this._items[o];a._detach(),this._items[o]=r;const l=a._toOps(N(this._id),i,this._pool);Ht(l,e.id);const c=[ze(o,r)],f=this._detachItemAssociatedToSetOperation(e.deletedId);return f&&c.push(f),{modified:D(this,c),reverse:l}}else{this._insertAndSort(r),this._detachItemAssociatedToSetOperation(e.deletedId);const a=this._indexOfPosition(s);return{reverse:[{type:5,id:n}],modified:D(this,[le(a,r)])}}}_attachChild(e,t){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");let n;return e.intent==="set"?t===1?n=this._applySetRemote(e):t===2?n=this._applySetAck(e):n=this._applySetUndoRedo(e):t===1?n=this._applyRemoteInsert(e):t===2?n=this._applyInsertAck(e):n=this._applyInsertUndoRedo(e),n.modified!==!1&&this.invalidate(),n}_detachChild(e){if(e){const t=N(e._parentKey),n=e._toOps(N(this._id),t,this._pool),i=this._items.indexOf(e);return i===-1?{modified:!1}:(this._items.splice(i,1),this.invalidate(),e._detach(),{modified:D(this,[ot(i)]),reverse:n})}return{modified:!1}}_applySetChildKeyRemote(e,t){var n;if(this._implicitlyDeletedItems.has(t)){this._implicitlyDeletedItems.delete(t),t._setParentLink(this,e),this._insertAndSort(t);const o=this._items.indexOf(t);return{modified:D(this,[le(o,t)]),reverse:[]}}const i=t._parentKey;if(e===i)return{modified:!1};const r=this._indexOfPosition(e);if(r===-1){const o=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return s===o?{modified:!1}:{modified:D(this,[Te(o,s,t)]),reverse:[]}}else{this._items[r]._setParentLink(this,ce(e,(n=this._items[r+1])==null?void 0:n._getParentKeyOrThrow()));const o=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return s===o?{modified:!1}:{modified:D(this,[Te(o,s,t)]),reverse:[]}}}_applySetChildKeyAck(e,t){var n,i;const r=N(t._parentKey);if(this._implicitlyDeletedItems.has(t)){const o=this._indexOfPosition(e);return this._implicitlyDeletedItems.delete(t),o!==-1&&this._items[o]._setParentLink(this,ce(e,(n=this._items[o+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._insertAndSort(t),{modified:!1}}else{if(e===r)return{modified:!1};const o=this._items.indexOf(t),s=this._indexOfPosition(e);s!==-1&&this._items[s]._setParentLink(this,ce(e,(i=this._items[s+1])==null?void 0:i._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const a=this._items.indexOf(t);return o===a?{modified:!1}:{modified:D(this,[Te(o,a,t)]),reverse:[]}}}_applySetChildKeyUndoRedo(e,t){var n;const i=N(t._parentKey),r=this._items.indexOf(t),o=this._indexOfPosition(e);o!==-1&&this._items[o]._setParentLink(this,ce(e,(n=this._items[o+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return r===s?{modified:!1}:{modified:D(this,[Te(r,s,t)]),reverse:[{type:1,id:N(t._id),parentKey:i}]}}_setChildKey(e,t,n){return n===1?this._applySetChildKeyRemote(e,t):n===2?this._applySetChildKeyAck(e,t):this._applySetChildKeyUndoRedo(e,t)}_apply(e,t){return super._apply(e,t)}_serialize(){if(this.parent.type!=="HasParent")throw new Error("Cannot serialize LiveList if parent is missing");return{type:1,parentId:N(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key}}get length(){return this._items.length}push(e){return this.insert(e,this.length)}insert(e,t){if(t<0||t>this._items.length)throw new Error(`Cannot insert list item at index "${t}". index should be between 0 and ${this._items.length}`);const n=this._items[t-1]?this._items[t-1]._getParentKeyOrThrow():void 0,i=this._items[t]?this._items[t]._getParentKeyOrThrow():void 0,r=ce(n,i),o=Ke(e);if(o._setParentLink(this,r),this._insertAndSort(o),this._pool&&this._id){const s=this._pool.generateId();o._attach(s,this._pool),this._pool.dispatch(o._toOps(this._id,r,this._pool),[{type:5,id:s}],new Map([[this._id,D(this,[le(t,o)])]]))}}move(e,t){if(t<0)throw new Error("targetIndex cannot be less than 0");if(t>=this._items.length)throw new Error("targetIndex cannot be greater or equal than the list length");if(e<0)throw new Error("index cannot be less than 0");if(e>=this._items.length)throw new Error("index cannot be greater or equal than the list length");let n=null,i=null;e<t?(i=t===this._items.length-1?void 0:this._items[t+1]._getParentKeyOrThrow(),n=this._items[t]._getParentKeyOrThrow()):(i=this._items[t]._getParentKeyOrThrow(),n=t===0?void 0:this._items[t-1]._getParentKeyOrThrow());const r=ce(n,i),o=this._items[e],s=o._getParentKeyOrThrow();if(o._setParentLink(this,r),this._sortItems(),this._pool&&this._id){const a=new Map([[this._id,D(this,[Te(e,t,o)])]]);this._pool.dispatch([{type:1,id:N(o._id),opId:this._pool.generateOpId(),parentKey:r}],[{type:1,id:N(o._id),parentKey:s}],a)}}delete(e){if(e<0||e>=this._items.length)throw new Error(`Cannot delete list item at index "${e}". index should be between 0 and ${this._items.length-1}`);const t=this._items[e];if(t._detach(),this._items.splice(e,1),this.invalidate(),this._pool){const n=t._id;if(n){const i=new Map;i.set(N(this._id),D(this,[ot(e)])),this._pool.dispatch([{id:n,opId:this._pool.generateOpId(),type:5}],t._toOps(N(this._id),t._getParentKeyOrThrow()),i)}}}clear(){if(this._pool){const e=[],t=[],n=[];for(const r of this._items){r._detach();const o=r._id;o&&(e.push({type:5,id:o,opId:this._pool.generateOpId()}),t.push(...r._toOps(N(this._id),r._getParentKeyOrThrow())),n.push(ot(0)))}this._items=[],this.invalidate();const i=new Map;i.set(N(this._id),D(this,n)),this._pool.dispatch(e,t,i)}else{for(const e of this._items)e._detach();this._items=[],this.invalidate()}}set(e,t){if(e<0||e>=this._items.length)throw new Error(`Cannot set list item at index "${e}". index should be between 0 and ${this._items.length-1}`);const n=this._items[e],i=n._getParentKeyOrThrow(),r=n._id;n._detach();const o=Ke(t);if(o._setParentLink(this,i),this._items[e]=o,this.invalidate(),this._pool&&this._id){const s=this._pool.generateId();o._attach(s,this._pool);const a=new Map;a.set(this._id,D(this,[ze(e,o)]));const l=o._toOps(this._id,i,this._pool);Ht(l,r),this._unacknowledgedSets.set(i,N(l[0].opId));const c=n._toOps(this._id,i,void 0);Ht(c,s),this._pool.dispatch(l,c,a)}}toArray(){return this._items.map(e=>Ne(e))}every(e){return this.toArray().every(e)}filter(e){return this.toArray().filter(e)}find(e){return this.toArray().find(e)}findIndex(e){return this.toArray().findIndex(e)}forEach(e){return this.toArray().forEach(e)}get(e){if(!(e<0||e>=this._items.length))return Ne(this._items[e])}indexOf(e,t){return this.toArray().indexOf(e,t)}lastIndexOf(e,t){return this.toArray().lastIndexOf(e,t)}map(e){return this._items.map((t,n)=>e(Ne(t),n))}some(e){return this.toArray().some(e)}[Symbol.iterator](){return new eo(this._items)}_createAttachItemAndSort(e,t){const n=Ge(e);n._attach(e.id,N(this._pool)),n._setParentLink(this,t),this._insertAndSort(n);const i=this._indexOfPosition(t);return{newItem:n,newIndex:i}}_shiftItemPosition(e,t){var n;const i=ce(t,this._items.length>e+1?(n=this._items[e+1])==null?void 0:n._getParentKeyOrThrow():void 0);this._items[e]._setParentLink(this,i)}toImmutable(){return super.toImmutable()}_toImmutable(){return this._items.map(t=>t.toImmutable())}},eo=class{constructor(e){this._innerIterator=e[Symbol.iterator]()}[Symbol.iterator](){return this}next(){const e=this._innerIterator.next();return e.done?{done:!0,value:void 0}:{value:Ne(e.value)}}};function D(e,t){return{node:e,type:"LiveList",updates:t}}function ze(e,t){return{index:e,type:"set",item:t instanceof we?t.data:t}}function ot(e){return{index:e,type:"delete"}}function le(e,t){return{index:e,type:"insert",item:t instanceof we?t.data:t}}function Te(e,t,n){return{index:t,type:"move",previousIndex:e,item:n instanceof we?n.data:n}}function Ht(e,t){if(e.length===0)throw new Error("Internal error. Serialized LiveStructure should have at least 1 operation");const n=e[0];n.intent="set",n.deletedId=t}var to=["websocket:presence","websocket:storage","room:read","room:write","rooms:read","rooms:write"];function no(e){if(!pn(e))return!1;const{iat:t,exp:n}=e;return typeof t=="number"&&typeof n=="number"}function io(e){const t=Date.now()/1e3;return t>e.exp-300||t<e.iat+300}function ro(e){return to.includes(e)}function Pi(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Li(e){return typeof e.appId=="string"&&e.roomId===void 0&&Pi(e.scopes)}function _n(e){return typeof e.appId=="string"&&typeof e.roomId=="string"&&typeof e.actor=="number"&&(e.id===void 0||typeof e.id=="string")&&Pi(e.scopes)&&(e.maxConnectionsPerRoom===void 0||typeof e.maxConnectionsPerRoom=="number")}function oo(e){return Li(e)||_n(e)}function so(e){const t=e.split(".");if(t.length!==3)throw new Error("Authentication error: invalid JWT token");const n=Ti(Ai(t[1]));if(n&&no(n))return n;throw new Error("Authentication error: missing JWT metadata")}function ao(e){const t=so(e);if(t&&_n(t))return Rr(t,["maxConnections"]);throw new Error("Authentication error: we expected a room token but did not get one. Hint: if you are using a callback, ensure the room is passed when creating the token. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientCallback")}function lo(e){return Object.defineProperty(e,"count",{value:e.length,enumerable:!1}),Object.defineProperty(e,"toArray",{value:()=>e,enumerable:!1}),dn(e)}function Ri(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Ni(e){return Array.isArray(e)}function co(e){return!Ri(e)&&!Ni(e)}S.__spreadValues=nt;S.__spreadProps=Tt;S.__async=Nr;S.deprecate=Mr;S.deprecateIf=Cr;S.throwUsageError=Ur;S.errorIf=Dr;S.assertNever=xe;S.nn=N;S.ClientMsgCode=di;S.OpCode=pi;S.CrdtType=_i;S.isRootCrdt=zr;S.isChildCrdt=mi;S.ServerMsgCode=yi;S.isRoomEventName=$r;S.WebsocketCloseCodes=vi;S.LiveRegister=we;S.makePosition=ce;S.comparePosition=wi;S.LiveList=Se;S.LiveMap=ke;S.LiveObject=Ie;S.freeze=dn;S.compact=Fr;S.compactObject=Vr;S.isSameNodeOrChildOf=xi;S.isLiveNode=q;S.isLiveList=Oi;S.isLiveObject=ki;S.getTreesDiffOperations=Yr;S.mergeStorageUpdates=Wr;S.isPlainObject=pn;S.findNonSerializableValue=Ii;S.tryParseJson=Ti;S.b64decode=Ai;S.isTokenExpired=io;S.isScope=ro;S.isAppOnlyAuthToken=Li;S.isRoomAuthToken=_n;S.isAuthToken=oo;S.parseRoomAuthToken=ao;S.asArrayWithLegacyMethods=lo;S.isJsonScalar=Ri;S.isJsonArray=Ni;S.isJsonObject=co;Object.defineProperty(se,"__esModule",{value:!0});var k=S;function me(){const e=new Set,t=new Set;function n(s){return t.add(s),()=>t.delete(s)}function i(s){return e.add(s),()=>e.delete(s)}function r(s){e.forEach(a=>a(s)),e.clear(),t.forEach(a=>a(s))}function o(){e.clear(),t.clear()}return{notify:r,subscribe:n,subscribeOnce:i,clear:o,observable:{subscribe:n,subscribeOnce:i}}}function Mi(e,t){let n=!1;const i=k.__spreadValues.call(void 0,{},e);return Object.keys(t).forEach(r=>{const o=r,s=t[o];i[o]!==s&&(s===void 0?delete i[o]:i[o]=s,n=!0)}),n?i:e}var Pt=class{constructor(){this._ev=me()}get didInvalidate(){return this._ev.observable}invalidate(){this._cache!==void 0&&(this._cache=void 0,this._ev.notify())}get current(){var e;return(e=this._cache)!=null?e:this._cache=this._toImmutable()}},uo=class extends Pt{constructor(e){super(),this._me=k.freeze.call(void 0,k.compactObject.call(void 0,e))}_toImmutable(){return this._me}patch(e){const t=this._me,n=Mi(t,e);t!==n&&(this._me=k.freeze.call(void 0,n),this.invalidate())}};function fo(e,t){return k.freeze.call(void 0,k.compactObject.call(void 0,k.__spreadProps.call(void 0,k.__spreadValues.call(void 0,{},e),{presence:t})))}var ho=class extends Pt{constructor(){super(),this._connections={},this._presences={},this._users={}}_toImmutable(){const e=k.compact.call(void 0,Object.keys(this._presences).map(t=>this.getUser(Number(t))));return k.asArrayWithLegacyMethods.call(void 0,e)}clearOthers(){this._connections={},this._presences={},this._users={},this.invalidate()}_getUser(e){const t=this._connections[e],n=this._presences[e];if(t!==void 0&&n!==void 0)return fo(t,n)}getUser(e){const t=this._users[e];if(t)return t;const n=this._getUser(e);if(n)return this._users[e]=n,n}_invalidateUser(e){this._users[e]!==void 0&&delete this._users[e],this.invalidate()}setConnection(e,t,n){this._connections[e]=k.freeze.call(void 0,{connectionId:e,id:t,info:n}),this._presences[e]!==void 0&&this._invalidateUser(e)}removeConnection(e){delete this._connections[e],delete this._presences[e],this._invalidateUser(e)}setOther(e,t){this._presences[e]=k.freeze.call(void 0,k.compactObject.call(void 0,t)),this._connections[e]!==void 0&&this._invalidateUser(e)}patchOther(e,t){const n=this._presences[e];if(n===void 0)return;const i=Mi(n,t);n!==i&&(this._presences[e]=k.freeze.call(void 0,i),this._invalidateUser(e))}},po=class extends Pt{constructor(e){super(),this._value=k.freeze.call(void 0,k.compactObject.call(void 0,e))}_toImmutable(){return this._value}set(e){this._value=k.freeze.call(void 0,e),this.invalidate()}},_o=class extends Pt{constructor(e,t){super(),this._refs=e,this._refs.forEach(n=>{n.didInvalidate.subscribe(()=>this.invalidate())}),this._transform=t}_toImmutable(){return this._transform(this._refs[0].current,this._refs[1].current)}},Kt=[250,500,1e3,2e3,4e3,8e3,1e4],Ft=[2e3,3e4,6e4,3e5],mo=3e4,yo=2e3;function vo(e){let t=0;return()=>`${e}:${t++}`}function Vt(e){return e.state==="open"||e.state==="connecting"}function go(e,t,n){const i={roomId:t.roomId,getNode:u=>e.nodes.get(u),addNode:(u,d)=>void e.nodes.set(u,d),deleteNode:u=>void e.nodes.delete(u),generateId:()=>`${I()}:${e.clock++}`,generateOpId:()=>`${I()}:${e.opClock++}`,dispatch(u,d,g){const w=e.activeBatch;w?(w.ops.push(...u),g.forEach((O,F)=>{w.updates.storageUpdates.set(F,k.mergeStorageUpdates.call(void 0,w.updates.storageUpdates.get(F),O))}),w.reverseOps.push(...d)):(_(d),e.redoStack=[],On(u),v({storageUpdates:g}))}},r={customEvent:me(),me:me(),others:me(),error:me(),connection:me(),storage:me(),history:me(),storageDidLoad:me()},o=n||{authenticate(u,d){const g=e.token,w=g!==null&&k.parseRoomAuthToken.call(void 0,g);if(w&&!k.isTokenExpired.call(void 0,w)){const O=d(g);Y(w,O)}else return u(t.roomId).then(({token:O})=>{if(e.connection.current.state!=="authenticating")return;const F=k.parseRoomAuthToken.call(void 0,O),H=d(O);Y(F,H),e.token=O}).catch(O=>de())},send(u){if(e.socket===null)throw new Error("Can't send message if socket is null");e.socket.send(JSON.stringify(u))},delayFlush(u){return setTimeout(B,u)},startHeartbeatInterval(){return setInterval(V,mo)},schedulePongTimeout(){return setTimeout(te,yo)},scheduleReconnect(u){return setTimeout(J,u)}},s=new _o([e.connection,e.me],(u,d)=>Vt(u)?{connectionId:u.id,id:u.userId,info:u.userInfo,presence:d}:null);function a(u){if(u.items.length===0)throw new Error("Internal error: cannot load storage without items");e.root?c(u.items):e.root=f(u.items);for(const d in e.initialStorage)e.root.get(d)===void 0&&e.root.set(d,e.initialStorage[d])}function l(u){const d=new Map;let g=null;for(const[w,O]of u)if(k.isRootCrdt.call(void 0,O))g=[w,O];else{const F=[w,O],H=d.get(O.parentId);H!==void 0?H.push(F):d.set(O.parentId,[F])}if(g===null)throw new Error("Root can't be null");return[g,d]}function c(u){if(!e.root)return;const d=new Map;e.nodes.forEach((O,F)=>{d.set(F,O._serialize())});const g=k.getTreesDiffOperations.call(void 0,d,new Map(u)),w=T(g,!1);v(w.updates)}function f(u){const[d,g]=l(u);return k.LiveObject._deserialize(d,g,i)}function p(u){e.undoStack.length>=50&&e.undoStack.shift(),e.undoStack.push(u),h()}function _(u){e.pausedHistory!==null?e.pausedHistory.unshift(...u):p(u)}function v({storageUpdates:u=new Map,presence:d=!1,others:g=[]}){if(g.length>0){const w=e.others.current;for(const O of g)r.others.notify({others:w,event:O})}if(d&&r.me.notify(e.me.current),u.size>0){const w=Array.from(u.values());r.storage.notify(w)}}function I(){const u=e.connection.current;if(Vt(u))return u.id;if(e.lastConnectionId!==null)return e.lastConnectionId;throw new Error("Internal. Tried to get connection id but connection was never open")}function T(u,d){const g={reverse:[],updates:{storageUpdates:new Map,presence:!1}},w=new Set;for(const O of u)if(O.type==="presence"){const F={type:"presence",data:{}};for(const H in O.data)F.data[H]=e.me.current[H];if(e.me.patch(O.data),e.buffer.me===null)e.buffer.me={type:"partial",data:O.data};else for(const H in O.data)e.buffer.me.data[H]=O.data[H];g.reverse.unshift(F),g.updates.presence=!0}else{let F;O.opId||(O.opId=i.generateOpId()),d?F=0:F=e.offlineOperations.delete(k.nn.call(void 0,O.opId))?2:1;const H=x(O,F);if(H.modified){const $t=H.modified.node.parent.type==="HasParent"?k.nn.call(void 0,H.modified.node.parent.node._id,"Expected parent node to have an ID"):void 0;(!$t||!w.has($t))&&(g.updates.storageUpdates.set(k.nn.call(void 0,H.modified.node._id),k.mergeStorageUpdates.call(void 0,g.updates.storageUpdates.get(k.nn.call(void 0,H.modified.node._id)),H.modified)),g.reverse.unshift(...H.reverse)),(O.type===2||O.type===7||O.type===4)&&w.add(k.nn.call(void 0,H.modified.node._id))}}return g}function x(u,d){switch(u.type){case 6:case 3:case 5:{const g=e.nodes.get(u.id);return g===void 0?{modified:!1}:g._apply(u,d===0)}case 1:{const g=e.nodes.get(u.id);return g===void 0?{modified:!1}:g.parent.type==="HasParent"&&k.isLiveList.call(void 0,g.parent.node)?g.parent.node._setChildKey(u.parentKey,g,d):{modified:!1}}case 4:case 2:case 7:case 8:{if(u.parentId===void 0)return{modified:!1};const g=e.nodes.get(u.parentId);return g===void 0?{modified:!1}:g._attachChild(u,d)}}}function y(u,d){return r.storage.subscribe(g=>{const w=g.filter(O=>k.isSameNodeOrChildOf.call(void 0,O.node,u));w.length>0&&d(w)})}function M(u,d){return r.storage.subscribe(g=>{for(const w of g)w.node._id===u._id&&d(w.node)})}function R(u,d,g){if(typeof u=="string"&&k.isRoomEventName.call(void 0,u)){if(typeof d!="function")throw new Error("Second argument must be a callback function");const w=d;switch(u){case"event":return r.customEvent.subscribe(w);case"my-presence":return r.me.subscribe(w);case"others":{const O=w;return r.others.subscribe(({others:F,event:H})=>O(F,H))}case"error":return r.error.subscribe(w);case"connection":return r.connection.subscribe(w);case"storage":return r.storage.subscribe(w);case"history":return r.history.subscribe(w);default:return k.assertNever.call(void 0,u,"Unknown event")}}if(d===void 0||typeof u=="function")if(typeof u=="function"){const w=u;return r.storage.subscribe(w)}else throw new Error("Please specify a listener callback");if(k.isLiveNode.call(void 0,u)){const w=u;return g!=null&&g.isDeep?y(w,d):M(w,d)}throw new Error(`"${u}" is not a valid event name`)}function K(){return e.connection.current.state}function J(){var u,d,g,w;if(e.connection.current.state!=="closed"&&e.connection.current.state!=="unavailable")return null;const O=Oo(t.authentication,(d=(u=t.polyfills)==null?void 0:u.fetch)!=null?d:t.fetchPolyfill),F=Eo(t.liveblocksServer,(w=(g=t.polyfills)==null?void 0:g.WebSocket)!=null?w:t.WebSocketPolyfill);A({state:"authenticating"}),o.authenticate(O,F)}function G(u,d){const g={};e.buffer.me===null&&(e.buffer.me={type:"partial",data:{}});for(const w in u){const O=u[w];O!==void 0&&(e.buffer.me.data[w]=O,g[w]=e.me.current[w])}e.me.patch(u),e.activeBatch?(d!=null&&d.addToHistory&&e.activeBatch.reverseOps.push({type:"presence",data:g}),e.activeBatch.updates.presence=!0):(B(),d!=null&&d.addToHistory&&_([{type:"presence",data:g}]),v({presence:!0}))}function Y(u,d){d.addEventListener("message",P),d.addEventListener("open",W),d.addEventListener("close",L),d.addEventListener("error",z),A({state:"connecting",id:u.actor,userInfo:u.info,userId:u.id}),e.idFactory=vo(u.actor),e.socket=d}function de(u){e.token=null,A({state:"unavailable"}),e.numberOfRetry++,e.timeoutHandles.reconnect=o.scheduleReconnect(U())}function pe(u){u==="visible"&&e.connection.current.state==="open"&&V()}function De(u){if(u.targetActor!==void 0){const g=e.others.getUser(u.actor);e.others.setOther(u.actor,u.data);const w=e.others.getUser(u.actor);if(g===void 0&&w!==void 0)return{type:"enter",user:w}}else e.others.patchOther(u.actor,u.data);const d=e.others.getUser(u.actor);if(d)return{type:"update",updates:u.data,user:d}}function Mt(u){const d=e.others.getUser(u.actor);return d?(e.others.removeConnection(u.actor),{type:"leave",user:d}):null}function Ct(u){for(const d in u.users){const g=u.users[d],w=Number(d);e.others.setConnection(w,g.id,g.info)}return{type:"reset"}}function Ut(){e.connection.current.state==="unavailable"&&re()}function h(){r.history.notify({canUndo:In(),canRedo:Sn()})}function b(u){e.others.setConnection(u.actor,u.id,u.info),e.buffer.messages.push({type:100,data:e.me.current,targetActor:u.actor}),B();const d=e.others.getUser(u.actor);return d?{type:"enter",user:d}:void 0}function m(u){return k.isJsonObject.call(void 0,u)?u:null}function E(u){const d=k.tryParseJson.call(void 0,u);return d===void 0?null:k.isJsonArray.call(void 0,d)?k.compact.call(void 0,d.map(g=>m(g))):k.compact.call(void 0,[m(d)])}function P(u){if(u.data==="pong"){clearTimeout(e.timeoutHandles.pongTimeout);return}const d=E(u.data);if(d===null||d.length===0)return;const g={storageUpdates:new Map,others:[]};for(const w of d)switch(w.type){case 101:{const O=b(w);O&&g.others.push(O);break}case 100:{const O=De(w);O&&g.others.push(O);break}case 103:{r.customEvent.notify({connectionId:w.actor,event:w.event});break}case 102:{const O=Mt(w);O&&g.others.push(O);break}case 104:{g.others.push(Ct(w));break}case 200:{const O=new Map(e.offlineOperations);a(w),ne(O),zt==null||zt(),r.storageDidLoad.notify();break}case 201:{T(w.ops,!1).updates.storageUpdates.forEach((F,H)=>{g.storageUpdates.set(H,k.mergeStorageUpdates.call(void 0,g.storageUpdates.get(H),F))});break}}v(g)}function L(u){if(e.socket=null,clearTimeout(e.timeoutHandles.pongTimeout),clearInterval(e.intervalHandles.heartbeat),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),e.others.clearOthers(),v({others:[{type:"reset"}]}),u.code>=4e3&&u.code<=4100){A({state:"failed"});const d=new xo(u.reason,u.code);r.error.notify(d);const g=U(!0);e.numberOfRetry++,A({state:"unavailable"}),e.timeoutHandles.reconnect=o.scheduleReconnect(g)}else if(u.code===4999)A({state:"closed"});else{const d=U();e.numberOfRetry++,A({state:"unavailable"}),e.timeoutHandles.reconnect=o.scheduleReconnect(d)}}function A(u){e.connection.set(u),r.connection.notify(u.state)}function U(u=!1){return u?Ft[e.numberOfRetry<Ft.length?e.numberOfRetry:Ft.length-1]:Kt[e.numberOfRetry<Kt.length?e.numberOfRetry:Kt.length-1]}function z(){}function W(){clearInterval(e.intervalHandles.heartbeat),e.intervalHandles.heartbeat=o.startHeartbeatInterval(),e.connection.current.state==="connecting"&&(A(k.__spreadProps.call(void 0,k.__spreadValues.call(void 0,{},e.connection.current),{state:"open"})),e.numberOfRetry=0,e.lastConnectionId!==void 0&&(e.buffer.me={type:"full",data:k.__spreadValues.call(void 0,{},e.me.current)},B()),e.lastConnectionId=e.connection.current.id,e.root&&e.buffer.messages.push({type:200}),B())}function V(){e.socket!==null&&(clearTimeout(e.timeoutHandles.pongTimeout),e.timeoutHandles.pongTimeout=o.schedulePongTimeout(),e.socket.readyState===e.socket.OPEN&&e.socket.send("ping"))}function te(){re()}function re(){e.socket&&(e.socket.removeEventListener("open",W),e.socket.removeEventListener("message",P),e.socket.removeEventListener("close",L),e.socket.removeEventListener("error",z),e.socket.close(),e.socket=null),A({state:"unavailable"}),clearTimeout(e.timeoutHandles.pongTimeout),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),clearInterval(e.intervalHandles.heartbeat),J()}function ne(u){if(u.size===0)return;const d=[],g=Array.from(u.values()),w=T(g,!0);d.push({type:201,ops:g}),v(w.updates),o.send(d)}function B(){const u=e.buffer.storageOperations;if(u.length>0&&u.forEach(w=>{e.offlineOperations.set(k.nn.call(void 0,w.opId),w)}),e.socket===null||e.socket.readyState!==e.socket.OPEN){e.buffer.storageOperations=[];return}const d=Date.now();if(d-e.lastFlushTime>t.throttleDelay){const w=Xe(e);if(w.length===0)return;o.send(w),e.buffer={messages:[],storageOperations:[],me:null},e.lastFlushTime=d}else e.timeoutHandles.flush!==null&&clearTimeout(e.timeoutHandles.flush),e.timeoutHandles.flush=o.delayFlush(t.throttleDelay-(d-e.lastFlushTime))}function Xe(u){const d=[];u.buffer.me&&d.push(u.buffer.me.type==="full"?{type:100,targetActor:-1,data:u.buffer.me.data}:{type:100,data:u.buffer.me.data});for(const g of u.buffer.messages)d.push(g);return u.buffer.storageOperations.length>0&&d.push({type:201,ops:u.buffer.storageOperations}),d}function sr(){e.socket&&(e.socket.removeEventListener("open",W),e.socket.removeEventListener("message",P),e.socket.removeEventListener("close",L),e.socket.removeEventListener("error",z),e.socket.close(),e.socket=null),A({state:"closed"}),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),clearTimeout(e.timeoutHandles.pongTimeout),clearInterval(e.intervalHandles.heartbeat),e.others.clearOthers(),v({others:[{type:"reset"}]}),Object.values(r).forEach(u=>u.clear())}function ar(){return e.me.current}function lr(){return e.others.current}function cr(u,d={shouldQueueEventIfNotReady:!1}){e.socket===null&&!d.shouldQueueEventIfNotReady||(e.buffer.messages.push({type:103,event:u}),B())}function On(u){e.buffer.storageOperations.push(...u),B()}let Dt=null,zt=null;function kn(){return Dt===null&&(e.buffer.messages.push({type:200}),B(),Dt=new Promise(u=>zt=u)),Dt}function ur(){const u=e.root;return u!==void 0?u:(kn(),null)}function fr(){return k.__async.call(void 0,this,null,function*(){return e.root?Promise.resolve({root:e.root}):(yield kn(),{root:k.nn.call(void 0,e.root)})})}function hr(){if(e.activeBatch)throw new Error("undo is not allowed during a batch");const u=e.undoStack.pop();if(u===void 0)return;e.pausedHistory=null;const d=T(u,!0);v(d.updates),e.redoStack.push(d.reverse),h();for(const g of u)g.type!=="presence"&&e.buffer.storageOperations.push(g);B()}function In(){return e.undoStack.length>0}function dr(){if(e.activeBatch)throw new Error("redo is not allowed during a batch");const u=e.redoStack.pop();if(u===void 0)return;e.pausedHistory=null;const d=T(u,!0);v(d.updates),e.undoStack.push(d.reverse),h();for(const g of u)g.type!=="presence"&&e.buffer.storageOperations.push(g);B()}function Sn(){return e.redoStack.length>0}function pr(u){if(e.activeBatch)return u();e.activeBatch={ops:[],updates:{storageUpdates:new Map,presence:!1,others:[]},reverseOps:[]};try{return u()}finally{const d=e.activeBatch;e.activeBatch=null,d.reverseOps.length>0&&_(d.reverseOps),d.ops.length>0&&(e.redoStack=[]),d.ops.length>0&&On(d.ops),v(d.updates),B()}}function _r(){e.pausedHistory=[]}function mr(){const u=e.pausedHistory;e.pausedHistory=null,u!==null&&u.length>0&&p(u)}function yr(){e.socket&&(e.socket=null)}function vr(u){L(u)}return{onClose:L,onMessage:P,authenticationSuccess:Y,heartbeat:V,onNavigatorOnline:Ut,simulateSocketClose:yr,simulateSendCloseEvent:vr,onVisibilityChange:pe,getUndoStack:()=>e.undoStack,getItemsCount:()=>e.nodes.size,connect:J,disconnect:sr,subscribe:R,updatePresence:G,broadcastEvent:cr,batch:pr,undo:hr,redo:dr,canUndo:In,canRedo:Sn,pauseHistory:_r,resumeHistory:mr,getStorage:fr,getStorageSnapshot:ur,events:{customEvent:r.customEvent.observable,others:r.others.observable,me:r.me.observable,error:r.error.observable,connection:r.connection.observable,storage:r.storage.observable,history:r.history.observable,storageDidLoad:r.storageDidLoad.observable},getConnectionState:K,isSelfAware:()=>Vt(e.connection.current),getSelf:()=>s.current,getPresence:ar,getOthers:lr}}function wo(e,t){const n=new ho,i=new po({state:"closed"});return{token:null,lastConnectionId:null,socket:null,numberOfRetry:0,lastFlushTime:0,timeoutHandles:{flush:null,reconnect:0,pongTimeout:0},buffer:{me:{type:"full",data:e},messages:[],storageOperations:[]},intervalHandles:{heartbeat:0},connection:i,me:new uo(e),others:n,initialStorage:t,idFactory:null,clock:0,opClock:0,nodes:new Map,root:void 0,undoStack:[],redoStack:[],pausedHistory:null,activeBatch:null,offlineOperations:new Map}}function bo(e,t){const{initialPresence:n,initialStorage:i}=e,r=wo(typeof n=="function"?n(t.roomId):n,typeof i=="function"?i(t.roomId):i),o=go(r,t),s={id:t.roomId,getConnectionState:o.getConnectionState,isSelfAware:o.isSelfAware,getSelf:o.getSelf,subscribe:o.subscribe,getPresence:o.getPresence,updatePresence:o.updatePresence,getOthers:o.getOthers,broadcastEvent:o.broadcastEvent,getStorage:o.getStorage,getStorageSnapshot:o.getStorageSnapshot,events:o.events,batch:o.batch,history:{undo:o.undo,redo:o.redo,canUndo:o.canUndo,canRedo:o.canRedo,pause:o.pauseHistory,resume:o.resumeHistory},__INTERNAL_DO_NOT_USE:{simulateCloseWebsocket:o.simulateSocketClose,simulateSendCloseEvent:o.simulateSendCloseEvent}};return{connect:o.connect,disconnect:o.disconnect,onNavigatorOnline:o.onNavigatorOnline,onVisibilityChange:o.onVisibilityChange,room:s}}var xo=class extends Error{constructor(e,t){super(e),this.code=t}};function Eo(e,t){if(typeof window>"u"&&t===void 0)throw new Error("To use Liveblocks client in a non-dom environment, you need to provide a WebSocket polyfill.");const n=t||WebSocket;return i=>new n(`${e}/?token=${i}&version=0.18.2`)}function Oo(e,t){if(e.type==="public"){if(typeof window>"u"&&t===void 0)throw new Error("To use Liveblocks client in a non-dom environment with a publicApiKey, you need to provide a fetch polyfill.");return n=>Dn(t||fetch,e.url,{room:n,publicApiKey:e.publicApiKey})}if(e.type==="private"){if(typeof window>"u"&&t===void 0)throw new Error("To use Liveblocks client in a non-dom environment with a url as auth endpoint, you need to provide a fetch polyfill.");return n=>Dn(t||fetch,e.url,{room:n})}if(e.type==="custom")return n=>k.__async.call(void 0,this,null,function*(){const i=yield e.callback(n);if(!i||!i.token)throw new Error('Authentication error. We expect the authentication callback to return a token, but it does not. Hint: the return value should look like: { token: "..." }');return i});throw new Error("Internal error. Unexpected authentication type")}function Dn(e,t,n){return k.__async.call(void 0,this,null,function*(){const i=yield e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new Bt(`Expected a status 200 but got ${i.status} when doing a POST request on "${t}"`);let r;try{r=yield i.json()}catch(s){throw new Bt(`Expected a JSON response when doing a POST request on "${t}". ${s}`)}if(!k.isPlainObject.call(void 0,r)||typeof r.token!="string")throw new Bt(`Expected a JSON response of the form \`{ token: "..." }\` when doing a POST request on "${t}", but got ${JSON.stringify(r)}`);const{token:o}=r;return{token:o}})}var Bt=class extends Error{constructor(e){super(e)}};function ko(e){const t=e,n=Io(e),i=new Map;function r(a){const l=i.get(a);return l?l.room:null}function o(a,l){var c,f;let p=i.get(a);if(p)return p.room;if(k.deprecateIf.call(void 0,l.initialPresence===null||l.initialPresence===void 0,"Please provide an initial presence value for the current user when entering the room."),p=bo({initialPresence:(c=l.initialPresence)!=null?c:{},initialStorage:l.initialStorage},{roomId:a,throttleDelay:n,polyfills:t.polyfills,WebSocketPolyfill:t.WebSocketPolyfill,fetchPolyfill:t.fetchPolyfill,liveblocksServer:(t==null?void 0:t.liveblocksServer)||"wss://api.liveblocks.io/v6",authentication:So(t,a)}),i.set(a,p),!l.DO_NOT_USE_withoutConnecting){if(typeof atob>"u"){if(((f=t.polyfills)==null?void 0:f.atob)===void 0)throw new Error("You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill");Tr.atob=t.polyfills.atob}p.connect()}return p.room}function s(a){const l=i.get(a);l&&(l.disconnect(),i.delete(a))}return typeof window<"u"&&typeof window.addEventListener<"u"&&window.addEventListener("online",()=>{for(const[,a]of i)a.onNavigatorOnline()}),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{for(const[,a]of i)a.onVisibilityChange(document.visibilityState)}),{getRoom:r,enter:o,leave:s}}function Io(e){if(e.throttle===void 0)return 100;if(typeof e.throttle!="number"||e.throttle<80||e.throttle>1e3)throw new Error("throttle should be a number between 80 and 1000.");return e.throttle}function So(e,t){const{publicApiKey:n,authEndpoint:i}=e;if(i!==void 0&&n!==void 0)throw new Error("You cannot use both publicApiKey and authEndpoint. Please use either publicApiKey or authEndpoint, but not both. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClient");if(typeof n=="string"){if(n.startsWith("sk_"))throw new Error("Invalid publicApiKey. You are using the secret key which is not supported. Please use the public key instead. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientPublicKey");if(!n.startsWith("pk_"))throw new Error("Invalid key. Please use the public key format: pk_<public key>. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientPublicKey");return{type:"public",publicApiKey:n,url:To(e,t)}}if(typeof i=="string")return{type:"private",url:i};if(typeof i=="function")return{type:"custom",callback:i};throw i!==void 0?new Error("authEndpoint must be a string or a function. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientAuthEndpoint"):new Error("Invalid Liveblocks client options. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClient")}function To(e,t){return e.publicAuthorizeEndpoint?e.publicAuthorizeEndpoint.replace("{roomId}",t):`https://api.liveblocks.io/v2/rooms/${encodeURIComponent(t)}/public/authorize`}function Ao(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Po(e,t){if(typeof e!="object"||e===null||typeof t!="object"||t===null||Object.prototype.toString.call(e)!=="[object Object]"||Object.prototype.toString.call(t)!=="[object Object]")return!1;const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&Object.is(e[i],t[i]))}function Lo(e,t){if(Object.is(e,t))return!0;const n=Array.isArray(e),i=Array.isArray(t);return n||i?!n||!i?!1:Ao(e,t):Po(e,t)}se.LiveList=k.LiveList;se.LiveMap=k.LiveMap;se.LiveObject=k.LiveObject;se.createClient=ko;se.shallow=Lo;se.LiveList;se.LiveMap;se.LiveObject;const Ro=se.createClient;se.shallow;function zn(e){return Object.prototype.toString.call(e)==="[object Date]"}function jt(e,t,n,i){if(typeof n=="number"||zn(n)){const r=i-n,o=(n-t)/(e.dt||1/60),s=e.opts.stiffness*r,a=e.opts.damping*o,l=(s-a)*e.inv_mass,c=(o+l)*e.dt;return Math.abs(c)<e.opts.precision&&Math.abs(r)<e.opts.precision?i:(e.settled=!1,zn(n)?new Date(n.getTime()+c):n+c)}else{if(Array.isArray(n))return n.map((r,o)=>jt(e,t[o],n[o],i[o]));if(typeof n=="object"){const r={};for(const o in n)r[o]=jt(e,t[o],n[o],i[o]);return r}else throw new Error(`Cannot spring ${typeof n} values`)}}function No(e,t={}){const n=fn(e),{stiffness:i=.15,damping:r=.8,precision:o=.01}=t;let s,a,l,c=e,f=e,p=1,_=0,v=!1;function I(x,y={}){f=x;const M=l={};if(e==null||y.hard||T.stiffness>=1&&T.damping>=1)return v=!0,s=Tn(),c=x,n.set(e=f),Promise.resolve();if(y.soft){const R=y.soft===!0?.5:+y.soft;_=1/(R*60),p=0}return a||(s=Tn(),v=!1,a=gr(R=>{if(v)return v=!1,a=null,!1;p=Math.min(p+_,1);const K={inv_mass:p,opts:T,settled:!0,dt:(R-s)*60/1e3},J=jt(K,c,e,f);return s=R,c=e,n.set(e=J),K.settled&&(a=null),!K.settled})),new Promise(R=>{a.promise.then(()=>{M===l&&R()})})}const T={set:I,update:(x,y)=>I(x(f,e),y),subscribe:n.subscribe,stiffness:i,damping:r,precision:o};return T}function Mo(e){let t,n,i;return{c(){t=An("svg"),n=An("path"),this.h()},l(r){t=Pn(r,"svg",{class:!0,fill:!0,height:!0,style:!0,viewBox:!0,width:!0,xmlns:!0});var o=j(t);n=Pn(o,"path",{d:!0,fill:!0}),j(n).forEach($),o.forEach($),this.h()},h(){C(n,"d","M5.65376 12.3673H5.46026L5.31717 12.4976L0.500002 16.8829L0.500002 1.19841L11.7841 12.3673H5.65376Z"),C(n,"fill",e[0]),C(t,"class","cursor svelte-141kyoc"),C(t,"fill","none"),C(t,"height","36"),C(t,"style",i=`transform: translateX(${e[1].x}px) translateY(${e[1].y}px)`),C(t,"viewBox","0 0 24 36"),C(t,"width","24"),C(t,"xmlns","http://www.w3.org/2000/svg")},m(r,o){ue(r,t,o),X(t,n)},p(r,[o]){o&1&&C(n,"fill",r[0]),o&2&&i!==(i=`transform: translateX(${r[1].x}px) translateY(${r[1].y}px)`)&&C(t,"style",i)},i:He,o:He,d(r){r&&$(t)}}}function Co(e,t,n){let i,{color:r=""}=t,{x:o=0}=t,{y:s=0}=t;const a=No({x:o,y:s},{stiffness:.07,damping:.35});return qt(e,a,l=>n(1,i=l)),e.$$set=l=>{"color"in l&&n(0,r=l.color),"x"in l&&n(3,o=l.x),"y"in l&&n(4,s=l.y)},e.$$.update=()=>{e.$$.dirty&24&&a.set({x:o,y:s})},[r,i,a,o,s]}class Uo extends kt{constructor(t){super(),It(this,t,Co,Mo,St,{color:0,x:3,y:4})}}var Do={value:()=>{}};function mn(){for(var e=0,t=arguments.length,n={},i;e<t;++e){if(!(i=arguments[e]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new ft(n)}function ft(e){this._=e}function zo(e,t){return e.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}ft.prototype=mn.prototype={constructor:ft,on:function(e,t){var n=this._,i=zo(e+"",n),r,o=-1,s=i.length;if(arguments.length<2){for(;++o<s;)if((r=(e=i[o]).type)&&(r=$o(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(r=(e=i[o]).type)n[r]=$n(n[r],e.name,t);else if(t==null)for(r in n)n[r]=$n(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ft(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,o;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],i=0,r=o.length;i<r;++i)o[i].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)}};function $o(e,t){for(var n=0,i=e.length,r;n<i;++n)if((r=e[n]).name===t)return r.value}function $n(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=Do,e=e.slice(0,i).concat(e.slice(i+1));break}return n!=null&&e.push({name:t,value:n}),e}var Wt="http://www.w3.org/1999/xhtml";const Hn={svg:"http://www.w3.org/2000/svg",xhtml:Wt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Lt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Hn.hasOwnProperty(t)?{space:Hn[t],local:e}:e}function Ho(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Wt&&t.documentElement.namespaceURI===Wt?t.createElement(e):t.createElementNS(n,e)}}function Ko(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ci(e){var t=Lt(e);return(t.local?Ko:Ho)(t)}function Fo(){}function yn(e){return e==null?Fo:function(){return this.querySelector(e)}}function Vo(e){typeof e!="function"&&(e=yn(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var o=t[r],s=o.length,a=i[r]=new Array(s),l,c,f=0;f<s;++f)(l=o[f])&&(c=e.call(l,l.__data__,f,o))&&("__data__"in l&&(c.__data__=l.__data__),a[f]=c);return new ie(i,this._parents)}function Bo(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Jo(){return[]}function Ui(e){return e==null?Jo:function(){return this.querySelectorAll(e)}}function Xo(e){return function(){return Bo(e.apply(this,arguments))}}function Yo(e){typeof e=="function"?e=Xo(e):e=Ui(e);for(var t=this._groups,n=t.length,i=[],r=[],o=0;o<n;++o)for(var s=t[o],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(i.push(e.call(l,l.__data__,c,s)),r.push(l));return new ie(i,r)}function Di(e){return function(){return this.matches(e)}}function zi(e){return function(t){return t.matches(e)}}var qo=Array.prototype.find;function Go(e){return function(){return qo.call(this.children,e)}}function jo(){return this.firstElementChild}function Wo(e){return this.select(e==null?jo:Go(typeof e=="function"?e:zi(e)))}var Qo=Array.prototype.filter;function Zo(){return Array.from(this.children)}function es(e){return function(){return Qo.call(this.children,e)}}function ts(e){return this.selectAll(e==null?Zo:es(typeof e=="function"?e:zi(e)))}function ns(e){typeof e!="function"&&(e=Di(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var o=t[r],s=o.length,a=i[r]=[],l,c=0;c<s;++c)(l=o[c])&&e.call(l,l.__data__,c,o)&&a.push(l);return new ie(i,this._parents)}function $i(e){return new Array(e.length)}function is(){return new ie(this._enter||this._groups.map($i),this._parents)}function gt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}gt.prototype={constructor:gt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function rs(e){return function(){return e}}function os(e,t,n,i,r,o){for(var s=0,a,l=t.length,c=o.length;s<c;++s)(a=t[s])?(a.__data__=o[s],i[s]=a):n[s]=new gt(e,o[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function ss(e,t,n,i,r,o,s){var a,l,c=new Map,f=t.length,p=o.length,_=new Array(f),v;for(a=0;a<f;++a)(l=t[a])&&(_[a]=v=s.call(l,l.__data__,a,t)+"",c.has(v)?r[a]=l:c.set(v,l));for(a=0;a<p;++a)v=s.call(e,o[a],a,o)+"",(l=c.get(v))?(i[a]=l,l.__data__=o[a],c.delete(v)):n[a]=new gt(e,o[a]);for(a=0;a<f;++a)(l=t[a])&&c.get(_[a])===l&&(r[a]=l)}function as(e){return e.__data__}function ls(e,t){if(!arguments.length)return Array.from(this,as);var n=t?ss:os,i=this._parents,r=this._groups;typeof e!="function"&&(e=rs(e));for(var o=r.length,s=new Array(o),a=new Array(o),l=new Array(o),c=0;c<o;++c){var f=i[c],p=r[c],_=p.length,v=cs(e.call(f,f&&f.__data__,c,i)),I=v.length,T=a[c]=new Array(I),x=s[c]=new Array(I),y=l[c]=new Array(_);n(f,p,T,x,y,v,t);for(var M=0,R=0,K,J;M<I;++M)if(K=T[M]){for(M>=R&&(R=M+1);!(J=x[R])&&++R<I;);K._next=J||null}}return s=new ie(s,i),s._enter=a,s._exit=l,s}function cs(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function us(){return new ie(this._exit||this._groups.map($i),this._parents)}function fs(e,t,n){var i=this.enter(),r=this,o=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?o.remove():n(o),i&&r?i.merge(r).order():r}function hs(e){for(var t=e.selection?e.selection():e,n=this._groups,i=t._groups,r=n.length,o=i.length,s=Math.min(r,o),a=new Array(r),l=0;l<s;++l)for(var c=n[l],f=i[l],p=c.length,_=a[l]=new Array(p),v,I=0;I<p;++I)(v=c[I]||f[I])&&(_[I]=v);for(;l<r;++l)a[l]=n[l];return new ie(a,this._parents)}function ds(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var i=e[t],r=i.length-1,o=i[r],s;--r>=0;)(s=i[r])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function ps(e){e||(e=_s);function t(p,_){return p&&_?e(p.__data__,_.__data__):!p-!_}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var s=n[o],a=s.length,l=r[o]=new Array(a),c,f=0;f<a;++f)(c=s[f])&&(l[f]=c);l.sort(t)}return new ie(r,this._parents).order()}function _s(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ms(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ys(){return Array.from(this)}function vs(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,o=i.length;r<o;++r){var s=i[r];if(s)return s}return null}function gs(){let e=0;for(const t of this)++e;return e}function ws(){return!this.node()}function bs(e){for(var t=this._groups,n=0,i=t.length;n<i;++n)for(var r=t[n],o=0,s=r.length,a;o<s;++o)(a=r[o])&&e.call(a,a.__data__,o,r);return this}function xs(e){return function(){this.removeAttribute(e)}}function Es(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Os(e,t){return function(){this.setAttribute(e,t)}}function ks(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Is(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ss(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Ts(e,t){var n=Lt(e);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((t==null?n.local?Es:xs:typeof t=="function"?n.local?Ss:Is:n.local?ks:Os)(n,t))}function Hi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function As(e){return function(){this.style.removeProperty(e)}}function Ps(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ls(e,t,n){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,n)}}function Rs(e,t,n){return arguments.length>1?this.each((t==null?As:typeof t=="function"?Ls:Ps)(e,t,n==null?"":n)):Be(this.node(),e)}function Be(e,t){return e.style.getPropertyValue(t)||Hi(e).getComputedStyle(e,null).getPropertyValue(t)}function Ns(e){return function(){delete this[e]}}function Ms(e,t){return function(){this[e]=t}}function Cs(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Us(e,t){return arguments.length>1?this.each((t==null?Ns:typeof t=="function"?Cs:Ms)(e,t)):this.node()[e]}function Ki(e){return e.trim().split(/^|\s+/)}function vn(e){return e.classList||new Fi(e)}function Fi(e){this._node=e,this._names=Ki(e.getAttribute("class")||"")}Fi.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Vi(e,t){for(var n=vn(e),i=-1,r=t.length;++i<r;)n.add(t[i])}function Bi(e,t){for(var n=vn(e),i=-1,r=t.length;++i<r;)n.remove(t[i])}function Ds(e){return function(){Vi(this,e)}}function zs(e){return function(){Bi(this,e)}}function $s(e,t){return function(){(t.apply(this,arguments)?Vi:Bi)(this,e)}}function Hs(e,t){var n=Ki(e+"");if(arguments.length<2){for(var i=vn(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?$s:t?Ds:zs)(n,t))}function Ks(){this.textContent=""}function Fs(e){return function(){this.textContent=e}}function Vs(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Bs(e){return arguments.length?this.each(e==null?Ks:(typeof e=="function"?Vs:Fs)(e)):this.node().textContent}function Js(){this.innerHTML=""}function Xs(e){return function(){this.innerHTML=e}}function Ys(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function qs(e){return arguments.length?this.each(e==null?Js:(typeof e=="function"?Ys:Xs)(e)):this.node().innerHTML}function Gs(){this.nextSibling&&this.parentNode.appendChild(this)}function js(){return this.each(Gs)}function Ws(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Qs(){return this.each(Ws)}function Zs(e){var t=typeof e=="function"?e:Ci(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ea(){return null}function ta(e,t){var n=typeof e=="function"?e:Ci(e),i=t==null?ea:typeof t=="function"?t:yn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function na(){var e=this.parentNode;e&&e.removeChild(this)}function ia(){return this.each(na)}function ra(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function oa(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sa(e){return this.select(e?oa:ra)}function aa(e){return arguments.length?this.property("__data__",e):this.node().__data__}function la(e){return function(t){e.call(this,t,this.__data__)}}function ca(e){return e.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");return i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function ua(e){return function(){var t=this.__on;if(!!t){for(var n=0,i=-1,r=t.length,o;n<r;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++i]=o;++i?t.length=i:delete this.__on}}}function fa(e,t,n){return function(){var i=this.__on,r,o=la(t);if(i){for(var s=0,a=i.length;s<a;++s)if((r=i[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=t;return}}this.addEventListener(e.type,o,n),r={type:e.type,name:e.name,value:t,listener:o,options:n},i?i.push(r):this.__on=[r]}}function ha(e,t,n){var i=ca(e+""),r,o=i.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,f;l<c;++l)for(r=0,f=a[l];r<o;++r)if((s=i[r]).type===f.type&&s.name===f.name)return f.value}return}for(a=t?fa:ua,r=0;r<o;++r)this.each(a(i[r],t,n));return this}function Ji(e,t,n){var i=Hi(e),r=i.CustomEvent;typeof r=="function"?r=new r(t,n):(r=i.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function da(e,t){return function(){return Ji(this,e,t)}}function pa(e,t){return function(){return Ji(this,e,t.apply(this,arguments))}}function _a(e,t){return this.each((typeof t=="function"?pa:da)(e,t))}function*ma(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,o=i.length,s;r<o;++r)(s=i[r])&&(yield s)}var Xi=[null];function ie(e,t){this._groups=e,this._parents=t}function it(){return new ie([[document.documentElement]],Xi)}function ya(){return this}ie.prototype=it.prototype={constructor:ie,select:Vo,selectAll:Yo,selectChild:Wo,selectChildren:ts,filter:ns,data:ls,enter:is,exit:us,join:fs,merge:hs,selection:ya,order:ds,sort:ps,call:ms,nodes:ys,node:vs,size:gs,empty:ws,each:bs,attr:Ts,style:Rs,property:Us,classed:Hs,text:Bs,html:qs,raise:js,lower:Qs,append:Zs,insert:ta,remove:ia,clone:sa,datum:aa,on:ha,dispatch:_a,[Symbol.iterator]:ma};function Ee(e){return typeof e=="string"?new ie([[document.querySelector(e)]],[document.documentElement]):new ie([[e]],Xi)}function va(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ae(e,t){if(e=va(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Qt={capture:!0,passive:!1};function Zt(e){e.preventDefault(),e.stopImmediatePropagation()}function ga(e){var t=e.document.documentElement,n=Ee(e).on("dragstart.drag",Zt,Qt);"onselectstart"in t?n.on("selectstart.drag",Zt,Qt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function wa(e,t){var n=e.document.documentElement,i=Ee(e).on("dragstart.drag",null);t&&(i.on("click.drag",Zt,Qt),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function gn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Yi(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function rt(){}var Qe=.7,wt=1/Qe,Fe="\\s*([+-]?\\d+)\\s*",Ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ba=/^#([0-9a-f]{3,8})$/,xa=new RegExp(`^rgb\\(${Fe},${Fe},${Fe}\\)$`),Ea=new RegExp(`^rgb\\(${fe},${fe},${fe}\\)$`),Oa=new RegExp(`^rgba\\(${Fe},${Fe},${Fe},${Ze}\\)$`),ka=new RegExp(`^rgba\\(${fe},${fe},${fe},${Ze}\\)$`),Ia=new RegExp(`^hsl\\(${Ze},${fe},${fe}\\)$`),Sa=new RegExp(`^hsla\\(${Ze},${fe},${fe},${Ze}\\)$`),Kn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};gn(rt,et,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Fn,formatHex:Fn,formatHex8:Ta,formatHsl:Aa,formatRgb:Vn,toString:Vn});function Fn(){return this.rgb().formatHex()}function Ta(){return this.rgb().formatHex8()}function Aa(){return qi(this).formatHsl()}function Vn(){return this.rgb().formatRgb()}function et(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ba.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Bn(t):n===3?new ee(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?st(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?st(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=xa.exec(e))?new ee(t[1],t[2],t[3],1):(t=Ea.exec(e))?new ee(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Oa.exec(e))?st(t[1],t[2],t[3],t[4]):(t=ka.exec(e))?st(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ia.exec(e))?Yn(t[1],t[2]/100,t[3]/100,1):(t=Sa.exec(e))?Yn(t[1],t[2]/100,t[3]/100,t[4]):Kn.hasOwnProperty(e)?Bn(Kn[e]):e==="transparent"?new ee(NaN,NaN,NaN,0):null}function Bn(e){return new ee(e>>16&255,e>>8&255,e&255,1)}function st(e,t,n,i){return i<=0&&(e=t=n=NaN),new ee(e,t,n,i)}function Pa(e){return e instanceof rt||(e=et(e)),e?(e=e.rgb(),new ee(e.r,e.g,e.b,e.opacity)):new ee}function en(e,t,n,i){return arguments.length===1?Pa(e):new ee(e,t,n,i==null?1:i)}function ee(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}gn(ee,en,Yi(rt,{brighter(e){return e=e==null?wt:Math.pow(wt,e),new ee(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qe:Math.pow(Qe,e),new ee(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ee(Me(this.r),Me(this.g),Me(this.b),bt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Jn,formatHex:Jn,formatHex8:La,formatRgb:Xn,toString:Xn}));function Jn(){return`#${Re(this.r)}${Re(this.g)}${Re(this.b)}`}function La(){return`#${Re(this.r)}${Re(this.g)}${Re(this.b)}${Re((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xn(){const e=bt(this.opacity);return`${e===1?"rgb(":"rgba("}${Me(this.r)}, ${Me(this.g)}, ${Me(this.b)}${e===1?")":`, ${e})`}`}function bt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Me(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Re(e){return e=Me(e),(e<16?"0":"")+e.toString(16)}function Yn(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new oe(e,t,n,i)}function qi(e){if(e instanceof oe)return new oe(e.h,e.s,e.l,e.opacity);if(e instanceof rt||(e=et(e)),!e)return new oe;if(e instanceof oe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),o=Math.max(t,n,i),s=NaN,a=o-r,l=(o+r)/2;return a?(t===o?s=(n-i)/a+(n<i)*6:n===o?s=(i-t)/a+2:s=(t-n)/a+4,a/=l<.5?o+r:2-o-r,s*=60):a=l>0&&l<1?0:s,new oe(s,a,l,e.opacity)}function Ra(e,t,n,i){return arguments.length===1?qi(e):new oe(e,t,n,i==null?1:i)}function oe(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}gn(oe,Ra,Yi(rt,{brighter(e){return e=e==null?wt:Math.pow(wt,e),new oe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qe:Math.pow(Qe,e),new oe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new ee(Jt(e>=240?e-240:e+120,r,i),Jt(e,r,i),Jt(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new oe(qn(this.h),at(this.s),at(this.l),bt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=bt(this.opacity);return`${e===1?"hsl(":"hsla("}${qn(this.h)}, ${at(this.s)*100}%, ${at(this.l)*100}%${e===1?")":`, ${e})`}`}}));function qn(e){return e=(e||0)%360,e<0?e+360:e}function at(e){return Math.max(0,Math.min(1,e||0))}function Jt(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Gi=e=>()=>e;function Na(e,t){return function(n){return e+n*t}}function Ma(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function Ca(e){return(e=+e)==1?ji:function(t,n){return n-t?Ma(t,n,e):Gi(isNaN(t)?n:t)}}function ji(e,t){var n=t-e;return n?Na(e,n):Gi(isNaN(e)?t:e)}const Gn=function e(t){var n=Ca(t);function i(r,o){var s=n((r=en(r)).r,(o=en(o)).r),a=n(r.g,o.g),l=n(r.b,o.b),c=ji(r.opacity,o.opacity);return function(f){return r.r=s(f),r.g=a(f),r.b=l(f),r.opacity=c(f),r+""}}return i.gamma=e,i}(1);function be(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var tn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xt=new RegExp(tn.source,"g");function Ua(e){return function(){return e}}function Da(e){return function(t){return e(t)+""}}function za(e,t){var n=tn.lastIndex=Xt.lastIndex=0,i,r,o,s=-1,a=[],l=[];for(e=e+"",t=t+"";(i=tn.exec(e))&&(r=Xt.exec(t));)(o=r.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(i=i[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:be(i,r)})),n=Xt.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?l[0]?Da(l[0].x):Ua(t):(t=l.length,function(c){for(var f=0,p;f<t;++f)a[(p=l[f]).i]=p.x(c);return a.join("")})}var jn=180/Math.PI,nn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Wi(e,t,n,i,r,o){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*i)&&(n-=e*l,i-=t*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),e*i<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:o,rotate:Math.atan2(t,e)*jn,skewX:Math.atan(l)*jn,scaleX:s,scaleY:a}}var lt;function $a(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?nn:Wi(t.a,t.b,t.c,t.d,t.e,t.f)}function Ha(e){return e==null||(lt||(lt=document.createElementNS("http://www.w3.org/2000/svg","g")),lt.setAttribute("transform",e),!(e=lt.transform.baseVal.consolidate()))?nn:(e=e.matrix,Wi(e.a,e.b,e.c,e.d,e.e,e.f))}function Qi(e,t,n,i){function r(c){return c.length?c.pop()+" ":""}function o(c,f,p,_,v,I){if(c!==p||f!==_){var T=v.push("translate(",null,t,null,n);I.push({i:T-4,x:be(c,p)},{i:T-2,x:be(f,_)})}else(p||_)&&v.push("translate("+p+t+_+n)}function s(c,f,p,_){c!==f?(c-f>180?f+=360:f-c>180&&(c+=360),_.push({i:p.push(r(p)+"rotate(",null,i)-2,x:be(c,f)})):f&&p.push(r(p)+"rotate("+f+i)}function a(c,f,p,_){c!==f?_.push({i:p.push(r(p)+"skewX(",null,i)-2,x:be(c,f)}):f&&p.push(r(p)+"skewX("+f+i)}function l(c,f,p,_,v,I){if(c!==p||f!==_){var T=v.push(r(v)+"scale(",null,",",null,")");I.push({i:T-4,x:be(c,p)},{i:T-2,x:be(f,_)})}else(p!==1||_!==1)&&v.push(r(v)+"scale("+p+","+_+")")}return function(c,f){var p=[],_=[];return c=e(c),f=e(f),o(c.translateX,c.translateY,f.translateX,f.translateY,p,_),s(c.rotate,f.rotate,p,_),a(c.skewX,f.skewX,p,_),l(c.scaleX,c.scaleY,f.scaleX,f.scaleY,p,_),c=f=null,function(v){for(var I=-1,T=_.length,x;++I<T;)p[(x=_[I]).i]=x.x(v);return p.join("")}}}var Ka=Qi($a,"px, ","px)","deg)"),Fa=Qi(Ha,", ",")",")"),Va=1e-12;function Wn(e){return((e=Math.exp(e))+1/e)/2}function Ba(e){return((e=Math.exp(e))-1/e)/2}function Ja(e){return((e=Math.exp(2*e))-1)/(e+1)}const Xa=function e(t,n,i){function r(o,s){var a=o[0],l=o[1],c=o[2],f=s[0],p=s[1],_=s[2],v=f-a,I=p-l,T=v*v+I*I,x,y;if(T<Va)y=Math.log(_/c)/t,x=function(Y){return[a+Y*v,l+Y*I,c*Math.exp(t*Y*y)]};else{var M=Math.sqrt(T),R=(_*_-c*c+i*T)/(2*c*n*M),K=(_*_-c*c-i*T)/(2*_*n*M),J=Math.log(Math.sqrt(R*R+1)-R),G=Math.log(Math.sqrt(K*K+1)-K);y=(G-J)/t,x=function(Y){var de=Y*y,pe=Wn(J),De=c/(n*M)*(pe*Ja(t*de+J)-Ba(J));return[a+De*v,l+De*I,c*pe/Wn(t*de+J)]}}return x.duration=y*1e3*t/Math.SQRT2,x}return r.rho=function(o){var s=Math.max(.001,+o),a=s*s,l=a*a;return e(s,a,l)},r}(Math.SQRT2,2,4);var Je=0,je=0,Ye=0,Zi=1e3,xt,We,Et=0,Ue=0,Rt=0,tt=typeof performance=="object"&&performance.now?performance:Date,er=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wn(){return Ue||(er(Ya),Ue=tt.now()+Rt)}function Ya(){Ue=0}function Ot(){this._call=this._time=this._next=null}Ot.prototype=tr.prototype={constructor:Ot,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?wn():+n)+(t==null?0:+t),!this._next&&We!==this&&(We?We._next=this:xt=this,We=this),this._call=e,this._time=n,rn()},stop:function(){this._call&&(this._call=null,this._time=1/0,rn())}};function tr(e,t,n){var i=new Ot;return i.restart(e,t,n),i}function qa(){wn(),++Je;for(var e=xt,t;e;)(t=Ue-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Je}function Qn(){Ue=(Et=tt.now())+Rt,Je=je=0;try{qa()}finally{Je=0,ja(),Ue=0}}function Ga(){var e=tt.now(),t=e-Et;t>Zi&&(Rt-=t,Et=e)}function ja(){for(var e,t=xt,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:xt=n);We=e,rn(i)}function rn(e){if(!Je){je&&(je=clearTimeout(je));var t=e-Ue;t>24?(e<1/0&&(je=setTimeout(Qn,e-tt.now()-Rt)),Ye&&(Ye=clearInterval(Ye))):(Ye||(Et=tt.now(),Ye=setInterval(Ga,Zi)),Je=1,er(Qn))}}function Zn(e,t,n){var i=new Ot;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var Wa=mn("start","end","cancel","interrupt"),Qa=[],nr=0,ei=1,on=2,ht=3,ti=4,sn=5,dt=6;function Nt(e,t,n,i,r,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Za(e,n,{name:t,index:i,group:r,on:Wa,tween:Qa,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:nr})}function bn(e,t){var n=ae(e,t);if(n.state>nr)throw new Error("too late; already scheduled");return n}function he(e,t){var n=ae(e,t);if(n.state>ht)throw new Error("too late; already running");return n}function ae(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Za(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=tr(o,0,n.time);function o(c){n.state=ei,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var f,p,_,v;if(n.state!==ei)return l();for(f in i)if(v=i[f],v.name===n.name){if(v.state===ht)return Zn(s);v.state===ti?(v.state=dt,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete i[f]):+f<t&&(v.state=dt,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete i[f])}if(Zn(function(){n.state===ht&&(n.state=ti,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=on,n.on.call("start",e,e.__data__,n.index,n.group),n.state===on){for(n.state=ht,r=new Array(_=n.tween.length),f=0,p=-1;f<_;++f)(v=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(r[++p]=v);r.length=p+1}}function a(c){for(var f=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=sn,1),p=-1,_=r.length;++p<_;)r[p].call(e,f);n.state===sn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=dt,n.timer.stop(),delete i[t];for(var c in i)return;delete e.__transition}}function pt(e,t){var n=e.__transition,i,r,o=!0,s;if(!!n){t=t==null?null:t+"";for(s in n){if((i=n[s]).name!==t){o=!1;continue}r=i.state>on&&i.state<sn,i.state=dt,i.timer.stop(),i.on.call(r?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete n[s]}o&&delete e.__transition}}function el(e){return this.each(function(){pt(this,e)})}function tl(e,t){var n,i;return function(){var r=he(this,e),o=r.tween;if(o!==n){i=n=o;for(var s=0,a=i.length;s<a;++s)if(i[s].name===t){i=i.slice(),i.splice(s,1);break}}r.tween=i}}function nl(e,t,n){var i,r;if(typeof n!="function")throw new Error;return function(){var o=he(this,e),s=o.tween;if(s!==i){r=(i=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}o.tween=r}}function il(e,t){var n=this._id;if(e+="",arguments.length<2){for(var i=ae(this.node(),n).tween,r=0,o=i.length,s;r<o;++r)if((s=i[r]).name===e)return s.value;return null}return this.each((t==null?tl:nl)(n,e,t))}function xn(e,t,n){var i=e._id;return e.each(function(){var r=he(this,i);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ae(r,i).value[t]}}function ir(e,t){var n;return(typeof t=="number"?be:t instanceof et?Gn:(n=et(t))?(t=n,Gn):za)(e,t)}function rl(e){return function(){this.removeAttribute(e)}}function ol(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sl(e,t,n){var i,r=n+"",o;return function(){var s=this.getAttribute(e);return s===r?null:s===i?o:o=t(i=s,n)}}function al(e,t,n){var i,r=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===i?o:o=t(i=s,n)}}function ll(e,t,n){var i,r,o;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a)))}}function cl(e,t,n){var i,r,o;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a)))}}function ul(e,t){var n=Lt(e),i=n==="transform"?Fa:ir;return this.attrTween(e,typeof t=="function"?(n.local?cl:ll)(n,i,xn(this,"attr."+e,t)):t==null?(n.local?ol:rl)(n):(n.local?al:sl)(n,i,t))}function fl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function hl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function dl(e,t){var n,i;function r(){var o=t.apply(this,arguments);return o!==i&&(n=(i=o)&&hl(e,o)),n}return r._value=t,r}function pl(e,t){var n,i;function r(){var o=t.apply(this,arguments);return o!==i&&(n=(i=o)&&fl(e,o)),n}return r._value=t,r}function _l(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var i=Lt(e);return this.tween(n,(i.local?dl:pl)(i,t))}function ml(e,t){return function(){bn(this,e).delay=+t.apply(this,arguments)}}function yl(e,t){return t=+t,function(){bn(this,e).delay=t}}function vl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ml:yl)(t,e)):ae(this.node(),t).delay}function gl(e,t){return function(){he(this,e).duration=+t.apply(this,arguments)}}function wl(e,t){return t=+t,function(){he(this,e).duration=t}}function bl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gl:wl)(t,e)):ae(this.node(),t).duration}function xl(e,t){if(typeof t!="function")throw new Error;return function(){he(this,e).ease=t}}function El(e){var t=this._id;return arguments.length?this.each(xl(t,e)):ae(this.node(),t).ease}function Ol(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;he(this,e).ease=n}}function kl(e){if(typeof e!="function")throw new Error;return this.each(Ol(this._id,e))}function Il(e){typeof e!="function"&&(e=Di(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var o=t[r],s=o.length,a=i[r]=[],l,c=0;c<s;++c)(l=o[c])&&e.call(l,l.__data__,c,o)&&a.push(l);return new ge(i,this._parents,this._name,this._id)}function Sl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,i=t.length,r=n.length,o=Math.min(i,r),s=new Array(i),a=0;a<o;++a)for(var l=t[a],c=n[a],f=l.length,p=s[a]=new Array(f),_,v=0;v<f;++v)(_=l[v]||c[v])&&(p[v]=_);for(;a<i;++a)s[a]=t[a];return new ge(s,this._parents,this._name,this._id)}function Tl(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Al(e,t,n){var i,r,o=Tl(t)?bn:he;return function(){var s=o(this,e),a=s.on;a!==i&&(r=(i=a).copy()).on(t,n),s.on=r}}function Pl(e,t){var n=this._id;return arguments.length<2?ae(this.node(),n).on.on(e):this.each(Al(n,e,t))}function Ll(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Rl(){return this.on("end.remove",Ll(this._id))}function Nl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yn(e));for(var i=this._groups,r=i.length,o=new Array(r),s=0;s<r;++s)for(var a=i[s],l=a.length,c=o[s]=new Array(l),f,p,_=0;_<l;++_)(f=a[_])&&(p=e.call(f,f.__data__,_,a))&&("__data__"in f&&(p.__data__=f.__data__),c[_]=p,Nt(c[_],t,n,_,c,ae(f,n)));return new ge(o,this._parents,t,n)}function Ml(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ui(e));for(var i=this._groups,r=i.length,o=[],s=[],a=0;a<r;++a)for(var l=i[a],c=l.length,f,p=0;p<c;++p)if(f=l[p]){for(var _=e.call(f,f.__data__,p,l),v,I=ae(f,n),T=0,x=_.length;T<x;++T)(v=_[T])&&Nt(v,t,n,T,_,I);o.push(_),s.push(f)}return new ge(o,s,t,n)}var Cl=it.prototype.constructor;function Ul(){return new Cl(this._groups,this._parents)}function Dl(e,t){var n,i,r;return function(){var o=Be(this,e),s=(this.style.removeProperty(e),Be(this,e));return o===s?null:o===n&&s===i?r:r=t(n=o,i=s)}}function rr(e){return function(){this.style.removeProperty(e)}}function zl(e,t,n){var i,r=n+"",o;return function(){var s=Be(this,e);return s===r?null:s===i?o:o=t(i=s,n)}}function $l(e,t,n){var i,r,o;return function(){var s=Be(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Be(this,e))),s===l?null:s===i&&l===r?o:(r=l,o=t(i=s,a))}}function Hl(e,t){var n,i,r,o="style."+t,s="end."+o,a;return function(){var l=he(this,e),c=l.on,f=l.value[o]==null?a||(a=rr(t)):void 0;(c!==n||r!==f)&&(i=(n=c).copy()).on(s,r=f),l.on=i}}function Kl(e,t,n){var i=(e+="")=="transform"?Ka:ir;return t==null?this.styleTween(e,Dl(e,i)).on("end.style."+e,rr(e)):typeof t=="function"?this.styleTween(e,$l(e,i,xn(this,"style."+e,t))).each(Hl(this._id,e)):this.styleTween(e,zl(e,i,t),n).on("end.style."+e,null)}function Fl(e,t,n){return function(i){this.style.setProperty(e,t.call(this,i),n)}}function Vl(e,t,n){var i,r;function o(){var s=t.apply(this,arguments);return s!==r&&(i=(r=s)&&Fl(e,s,n)),i}return o._value=t,o}function Bl(e,t,n){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,Vl(e,t,n==null?"":n))}function Jl(e){return function(){this.textContent=e}}function Xl(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Yl(e){return this.tween("text",typeof e=="function"?Xl(xn(this,"text",e)):Jl(e==null?"":e+""))}function ql(e){return function(t){this.textContent=e.call(this,t)}}function Gl(e){var t,n;function i(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ql(r)),t}return i._value=e,i}function jl(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Gl(e))}function Wl(){for(var e=this._name,t=this._id,n=or(),i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var f=ae(l,t);Nt(l,e,n,c,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new ge(i,this._parents,e,n)}function Ql(){var e,t,n=this,i=n._id,r=n.size();return new Promise(function(o,s){var a={value:s},l={value:function(){--r===0&&o()}};n.each(function(){var c=he(this,i),f=c.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&o()})}var Zl=0;function ge(e,t,n,i){this._groups=e,this._parents=t,this._name=n,this._id=i}function or(){return++Zl}var _e=it.prototype;ge.prototype={constructor:ge,select:Nl,selectAll:Ml,selectChild:_e.selectChild,selectChildren:_e.selectChildren,filter:Il,merge:Sl,selection:Ul,transition:Wl,call:_e.call,nodes:_e.nodes,node:_e.node,size:_e.size,empty:_e.empty,each:_e.each,on:Pl,attr:ul,attrTween:_l,style:Kl,styleTween:Bl,text:Yl,textTween:jl,remove:Rl,tween:il,delay:vl,duration:bl,ease:El,easeVarying:kl,end:Ql,[Symbol.iterator]:_e[Symbol.iterator]};function ec(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var tc={time:null,delay:0,duration:250,ease:ec};function nc(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function ic(e){var t,n;e instanceof ge?(t=e._id,e=e._name):(t=or(),(n=tc).time=wn(),e=e==null?null:e+"");for(var i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Nt(l,e,t,c,s,n||nc(l,t));return new ge(i,this._parents,e,t)}it.prototype.interrupt=el;it.prototype.transition=ic;const ct=e=>()=>e;function rc(e,{sourceEvent:t,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function ye(e,t,n){this.k=e,this.x=t,this.y=n}ye.prototype={constructor:ye,scale:function(e){return e===1?this:new ye(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ye(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var En=new ye(1,0,0);ye.prototype;function Yt(e){e.stopImmediatePropagation()}function qe(e){e.preventDefault(),e.stopImmediatePropagation()}function oc(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function sc(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ni(){return this.__zoom||En}function ac(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lc(){return navigator.maxTouchPoints||"ontouchstart"in this}function cc(e,t,n){var i=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function uc(){var e=oc,t=sc,n=cc,i=ac,r=lc,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Xa,c=mn("start","zoom","end"),f,p,_,v=500,I=150,T=0,x=10;function y(h){h.property("__zoom",ni).on("wheel.zoom",de,{passive:!1}).on("mousedown.zoom",pe).on("dblclick.zoom",De).filter(r).on("touchstart.zoom",Mt).on("touchmove.zoom",Ct).on("touchend.zoom touchcancel.zoom",Ut).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(h,b,m,E){var P=h.selection?h.selection():h;P.property("__zoom",ni),h!==P?J(h,b,m,E):P.interrupt().each(function(){G(this,arguments).event(E).start().zoom(null,typeof b=="function"?b.apply(this,arguments):b).end()})},y.scaleBy=function(h,b,m,E){y.scaleTo(h,function(){var P=this.__zoom.k,L=typeof b=="function"?b.apply(this,arguments):b;return P*L},m,E)},y.scaleTo=function(h,b,m,E){y.transform(h,function(){var P=t.apply(this,arguments),L=this.__zoom,A=m==null?K(P):typeof m=="function"?m.apply(this,arguments):m,U=L.invert(A),z=typeof b=="function"?b.apply(this,arguments):b;return n(R(M(L,z),A,U),P,s)},m,E)},y.translateBy=function(h,b,m,E){y.transform(h,function(){return n(this.__zoom.translate(typeof b=="function"?b.apply(this,arguments):b,typeof m=="function"?m.apply(this,arguments):m),t.apply(this,arguments),s)},null,E)},y.translateTo=function(h,b,m,E,P){y.transform(h,function(){var L=t.apply(this,arguments),A=this.__zoom,U=E==null?K(L):typeof E=="function"?E.apply(this,arguments):E;return n(En.translate(U[0],U[1]).scale(A.k).translate(typeof b=="function"?-b.apply(this,arguments):-b,typeof m=="function"?-m.apply(this,arguments):-m),L,s)},E,P)};function M(h,b){return b=Math.max(o[0],Math.min(o[1],b)),b===h.k?h:new ye(b,h.x,h.y)}function R(h,b,m){var E=b[0]-m[0]*h.k,P=b[1]-m[1]*h.k;return E===h.x&&P===h.y?h:new ye(h.k,E,P)}function K(h){return[(+h[0][0]+ +h[1][0])/2,(+h[0][1]+ +h[1][1])/2]}function J(h,b,m,E){h.on("start.zoom",function(){G(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){G(this,arguments).event(E).end()}).tween("zoom",function(){var P=this,L=arguments,A=G(P,L).event(E),U=t.apply(P,L),z=m==null?K(U):typeof m=="function"?m.apply(P,L):m,W=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),V=P.__zoom,te=typeof b=="function"?b.apply(P,L):b,re=l(V.invert(z).concat(W/V.k),te.invert(z).concat(W/te.k));return function(ne){if(ne===1)ne=te;else{var B=re(ne),Xe=W/B[2];ne=new ye(Xe,z[0]-B[0]*Xe,z[1]-B[1]*Xe)}A.zoom(null,ne)}})}function G(h,b,m){return!m&&h.__zooming||new Y(h,b)}function Y(h,b){this.that=h,this.args=b,this.active=0,this.sourceEvent=null,this.extent=t.apply(h,b),this.taps=0}Y.prototype={event:function(h){return h&&(this.sourceEvent=h),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(h,b){return this.mouse&&h!=="mouse"&&(this.mouse[1]=b.invert(this.mouse[0])),this.touch0&&h!=="touch"&&(this.touch0[1]=b.invert(this.touch0[0])),this.touch1&&h!=="touch"&&(this.touch1[1]=b.invert(this.touch1[0])),this.that.__zoom=b,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(h){var b=Ee(this.that).datum();c.call(h,this.that,new rc(h,{sourceEvent:this.sourceEvent,target:y,type:h,transform:this.that.__zoom,dispatch:c}),b)}};function de(h,...b){if(!e.apply(this,arguments))return;var m=G(this,b).event(h),E=this.__zoom,P=Math.max(o[0],Math.min(o[1],E.k*Math.pow(2,i.apply(this,arguments)))),L=Ae(h);if(m.wheel)(m.mouse[0][0]!==L[0]||m.mouse[0][1]!==L[1])&&(m.mouse[1]=E.invert(m.mouse[0]=L)),clearTimeout(m.wheel);else{if(E.k===P)return;m.mouse=[L,E.invert(L)],pt(this),m.start()}qe(h),m.wheel=setTimeout(A,I),m.zoom("mouse",n(R(M(E,P),m.mouse[0],m.mouse[1]),m.extent,s));function A(){m.wheel=null,m.end()}}function pe(h,...b){if(_||!e.apply(this,arguments))return;var m=h.currentTarget,E=G(this,b,!0).event(h),P=Ee(h.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",W,!0),L=Ae(h,m),A=h.clientX,U=h.clientY;ga(h.view),Yt(h),E.mouse=[L,this.__zoom.invert(L)],pt(this),E.start();function z(V){if(qe(V),!E.moved){var te=V.clientX-A,re=V.clientY-U;E.moved=te*te+re*re>T}E.event(V).zoom("mouse",n(R(E.that.__zoom,E.mouse[0]=Ae(V,m),E.mouse[1]),E.extent,s))}function W(V){P.on("mousemove.zoom mouseup.zoom",null),wa(V.view,E.moved),qe(V),E.event(V).end()}}function De(h,...b){if(!!e.apply(this,arguments)){var m=this.__zoom,E=Ae(h.changedTouches?h.changedTouches[0]:h,this),P=m.invert(E),L=m.k*(h.shiftKey?.5:2),A=n(R(M(m,L),E,P),t.apply(this,b),s);qe(h),a>0?Ee(this).transition().duration(a).call(J,A,E,h):Ee(this).call(y.transform,A,E,h)}}function Mt(h,...b){if(!!e.apply(this,arguments)){var m=h.touches,E=m.length,P=G(this,b,h.changedTouches.length===E).event(h),L,A,U,z;for(Yt(h),A=0;A<E;++A)U=m[A],z=Ae(U,this),z=[z,this.__zoom.invert(z),U.identifier],P.touch0?!P.touch1&&P.touch0[2]!==z[2]&&(P.touch1=z,P.taps=0):(P.touch0=z,L=!0,P.taps=1+!!f);f&&(f=clearTimeout(f)),L&&(P.taps<2&&(p=z[0],f=setTimeout(function(){f=null},v)),pt(this),P.start())}}function Ct(h,...b){if(!!this.__zooming){var m=G(this,b).event(h),E=h.changedTouches,P=E.length,L,A,U,z;for(qe(h),L=0;L<P;++L)A=E[L],U=Ae(A,this),m.touch0&&m.touch0[2]===A.identifier?m.touch0[0]=U:m.touch1&&m.touch1[2]===A.identifier&&(m.touch1[0]=U);if(A=m.that.__zoom,m.touch1){var W=m.touch0[0],V=m.touch0[1],te=m.touch1[0],re=m.touch1[1],ne=(ne=te[0]-W[0])*ne+(ne=te[1]-W[1])*ne,B=(B=re[0]-V[0])*B+(B=re[1]-V[1])*B;A=M(A,Math.sqrt(ne/B)),U=[(W[0]+te[0])/2,(W[1]+te[1])/2],z=[(V[0]+re[0])/2,(V[1]+re[1])/2]}else if(m.touch0)U=m.touch0[0],z=m.touch0[1];else return;m.zoom("touch",n(R(A,U,z),m.extent,s))}}function Ut(h,...b){if(!!this.__zooming){var m=G(this,b).event(h),E=h.changedTouches,P=E.length,L,A;for(Yt(h),_&&clearTimeout(_),_=setTimeout(function(){_=null},v),L=0;L<P;++L)A=E[L],m.touch0&&m.touch0[2]===A.identifier?delete m.touch0:m.touch1&&m.touch1[2]===A.identifier&&delete m.touch1;if(m.touch1&&!m.touch0&&(m.touch0=m.touch1,delete m.touch1),m.touch0)m.touch0[1]=this.__zoom.invert(m.touch0[0]);else if(m.end(),m.taps===2&&(A=Ae(A,this),Math.hypot(p[0]-A[0],p[1]-A[1])<x)){var U=Ee(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return y.wheelDelta=function(h){return arguments.length?(i=typeof h=="function"?h:ct(+h),y):i},y.filter=function(h){return arguments.length?(e=typeof h=="function"?h:ct(!!h),y):e},y.touchable=function(h){return arguments.length?(r=typeof h=="function"?h:ct(!!h),y):r},y.extent=function(h){return arguments.length?(t=typeof h=="function"?h:ct([[+h[0][0],+h[0][1]],[+h[1][0],+h[1][1]]]),y):t},y.scaleExtent=function(h){return arguments.length?(o[0]=+h[0],o[1]=+h[1],y):[o[0],o[1]]},y.translateExtent=function(h){return arguments.length?(s[0][0]=+h[0][0],s[1][0]=+h[1][0],s[0][1]=+h[0][1],s[1][1]=+h[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(h){return arguments.length?(n=h,y):n},y.duration=function(h){return arguments.length?(a=+h,y):a},y.interpolate=function(h){return arguments.length?(l=h,y):l},y.on=function(){var h=c.on.apply(c,arguments);return h===c?y:h},y.clickDistance=function(h){return arguments.length?(T=(h=+h)*h,y):Math.sqrt(T)},y.tapDistance=function(h){return arguments.length?(x=+h,y):x},y}function fc(e){let t,n;return{c(){t=Q("div"),n=Q("canvas"),this.h()},l(i){t=Z(i,"DIV",{class:!0});var r=j(t);n=Z(r,"CANVAS",{width:!0,height:!0,class:!0}),j(n).forEach($),r.forEach($),this.h()},h(){C(n,"width",e[1]),C(n,"height",e[2]),C(n,"class","svelte-6dcxg7"),C(t,"class","fixed w-screen h-screen max-h-[1024px] top-0 left-0 overflow-hidden border-4 border-black")},m(i,r){ue(i,t,r),X(t,n),e[3](n)},p:He,i:He,o:He,d(i){i&&$(t),e[3](null)}}}function hc(e,t,n){let o,s;const a={top:50,right:50,bottom:50,left:50},l=[[a.left,a.top],[1024-a.right,1024-a.top]],c=uc().scaleExtent([.5,2]).extent(l).on("zoom",f);ai(()=>{Ee(o.parentElement).call(c).call(c.transform,En),s=o.getContext("2d"),s.fillStyle="red",s.rect(100,100,500,500),s.fill()});function f(_){const v=_.transform;console.log(o.style.transform,v),wr().then(()=>{n(0,o.style.transform=`translate(${v.x}px, ${v.y}px) scale(${v.k})`,o)})}function p(_){br[_?"unshift":"push"](()=>{o=_,n(0,o)})}return[o,1024,1024,p]}class dc extends kt{constructor(t){super(),It(this,t,hc,fc,St,{})}}function ii(e,t,n){const i=e.slice();return i[6]=t[n].connectionId,i[7]=t[n].presence,i}function pc(e){let t=[],n=new Map,i,r,o=[...e[1]];const s=a=>a[6];for(let a=0;a<o.length;a+=1){let l=ii(e,o,a),c=s(l);n.set(c,t[a]=ri(c,l))}return{c(){for(let a=0;a<t.length;a+=1)t[a].c();i=$e()},l(a){for(let l=0;l<t.length;l+=1)t[l].l(a);i=$e()},m(a,l){for(let c=0;c<t.length;c+=1)t[c].m(a,l);ue(a,i,l),r=!0},p(a,l){l&18&&(o=[...a[1]],li(),t=Or(t,l,s,1,a,o,n,i.parentNode,kr,ri,i,ii),ci())},i(a){if(!r){for(let l=0;l<o.length;l+=1)ve(t[l]);r=!0}},o(a){for(let l=0;l<t.length;l+=1)Oe(t[l]);r=!1},d(a){for(let l=0;l<t.length;l+=1)t[l].d(a);a&&$(i)}}}function _c(e){let t,n;return t=new Uo({props:{color:e[4][e[6]%e[4].length],x:e[7].cursor.x,y:e[7].cursor.y}}),{c(){an(t.$$.fragment)},l(i){ln(t.$$.fragment,i)},m(i,r){cn(t,i,r),n=!0},p:He,i(i){n||(ve(t.$$.fragment,i),n=!0)},o(i){Oe(t.$$.fragment,i),n=!1},d(i){un(t,i)}}}function ri(e,t){var s;let n,i,r,o=((s=t[7])==null?void 0:s.cursor)&&_c(t);return{key:e,first:null,c(){n=$e(),o&&o.c(),i=$e(),this.h()},l(a){n=$e(),o&&o.l(a),i=$e(),this.h()},h(){this.first=n},m(a,l){ue(a,n,l),o&&o.m(a,l),ue(a,i,l),r=!0},p(a,l){var c;t=a,(c=t[7])!=null&&c.cursor&&o.p(t,l)},i(a){r||(ve(o),r=!0)},o(a){Oe(o),r=!1},d(a){a&&$(n),o&&o.d(a),a&&$(i)}}}function mc(e){var T;let t,n,i=(T=e[0])!=null&&T.cursor?`${e[0].cursor.x} \xD7 ${e[0].cursor.y}`:"Move your cursor to broadcast its position to other people in the room.",r,o,s,a,l,c,f,p,_,v,I=e[1]&&pc(e);return a=new dc({}),{c(){t=Q("main"),n=Q("div"),r=_t(i),o=Pe(),I&&I.c(),s=Pe(),an(a.$$.fragment),l=Pe(),c=Q("h3"),f=_t("TESTS"),this.h()},l(x){t=Z(x,"MAIN",{class:!0});var y=j(t);n=Z(y,"DIV",{class:!0});var M=j(n);r=mt(M,i),M.forEach($),o=Le(y),I&&I.l(y),y.forEach($),s=Le(x),ln(a.$$.fragment,x),l=Le(x),c=Z(x,"H3",{class:!0});var R=j(c);f=mt(R,"TESTS"),R.forEach($),this.h()},h(){C(n,"class","text svelte-1du5rzc"),C(t,"class","svelte-1du5rzc"),C(c,"class","text-xl")},m(x,y){ue(x,t,y),X(t,n),X(n,r),X(t,o),I&&I.m(t,null),ue(x,s,y),cn(a,x,y),ue(x,l,y),ue(x,c,y),X(c,f),p=!0,_||(v=[Ln(t,"pointerleave",e[3]),Ln(t,"pointermove",e[2])],_=!0)},p(x,[y]){x[1]&&I.p(x,y)},i(x){p||(ve(I),ve(a.$$.fragment,x),p=!0)},o(x){Oe(I),Oe(a.$$.fragment,x),p=!1},d(x){x&&$(t),I&&I.d(),x&&$(s),un(a,x),x&&$(l),x&&$(c),_=!1,xr(v)}}}function yc(e,t,n){let{room:i}=t,r=i.getPresence(),o=i.getOthers();Er(()=>{unsubscribeMyPresence(),unsubscribeOthers()});function s(c){c.preventDefault(),i.updatePresence({cursor:{x:Math.round(c.clientX),y:Math.round(c.clientY)}})}function a(){i.updatePresence({cursor:null})}const l=["#E57373","#9575CD","#4FC3F7","#81C784","#FFF176","#FF8A65","#F06292","#7986CB"];return e.$$set=c=>{"room"in c&&n(5,i=c.room)},[r,o,s,a,l,i]}class vc extends kt{constructor(t){super(),It(this,t,yc,mc,St,{room:5})}}function oi(e){let t,n;return t=new vc({props:{room:e[0]}}),{c(){an(t.$$.fragment)},l(i){ln(t.$$.fragment,i)},m(i,r){cn(t,i,r),n=!0},p(i,r){const o={};r&1&&(o.room=i[0]),t.$set(o)},i(i){n||(ve(t.$$.fragment,i),n=!0)},o(i){Oe(t.$$.fragment,i),n=!1},d(i){un(t,i)}}}function gc(e){let t,n,i,r,o,s,a,l,c,f,p,_,v,I,T,x,y=e[0]&&oi(e);return{c(){t=Q("div"),n=Q("div"),i=Q("h1"),r=_t("Stable Diffussion Outpainting Multiplayer"),o=Pe(),s=Q("p"),a=Pe(),l=Q("div"),c=Q("form"),f=Q("input"),p=Pe(),_=Q("button"),v=_t("Create Palette"),I=Pe(),T=Q("div"),y&&y.c(),this.h()},l(M){t=Z(M,"DIV",{class:!0});var R=j(t);n=Z(R,"DIV",{class:!0});var K=j(n);i=Z(K,"H1",{class:!0});var J=j(i);r=mt(J,"Stable Diffussion Outpainting Multiplayer"),J.forEach($),o=Le(K),s=Z(K,"P",{class:!0}),j(s).forEach($),a=Le(K),l=Z(K,"DIV",{class:!0});var G=j(l);c=Z(G,"FORM",{class:!0});var Y=j(c);f=Z(Y,"INPUT",{class:!0,placeholder:!0,title:!0,type:!0,name:!0}),p=Le(Y),_=Z(Y,"BUTTON",{class:!0,title:!0});var de=j(_);v=mt(de,"Create Palette"),de.forEach($),Y.forEach($),G.forEach($),K.forEach($),I=Le(R),T=Z(R,"DIV",{class:!0});var pe=j(T);y&&y.l(pe),pe.forEach($),R.forEach($),this.h()},h(){C(i,"class","text-3xl font-bold leading-normal"),C(s,"class","text-sm"),C(f,"class","input svelte-zbscw1"),C(f,"placeholder","A photo of a beautiful sunset in San Francisco"),C(f,"title","Input prompt to generate image and obtain palette"),C(f,"type","text"),C(f,"name","prompt"),f.disabled=e[1],C(_,"class","button svelte-zbscw1"),_.disabled=e[1],C(_,"title","Generate Palette"),C(c,"class","grid grid-cols-6"),C(l,"class","relative bg-white dark:bg-black py-3"),C(n,"class","relative z-10"),C(T,"class","relative z-0"),C(t,"class","max-w-screen-md mx-auto px-3 py-8 relative")},m(M,R){ue(M,t,R),X(t,n),X(n,i),X(i,r),X(n,o),X(n,s),X(n,a),X(n,l),X(l,c),X(c,f),X(c,p),X(c,_),X(_,v),X(t,I),X(t,T),y&&y.m(T,null),x=!0},p(M,[R]){(!x||R&2)&&(f.disabled=M[1]),(!x||R&2)&&(_.disabled=M[1]),M[0]?y?(y.p(M,R),R&1&&ve(y,1)):(y=oi(M),y.c(),ve(y,1),y.m(T,null)):y&&(li(),Oe(y,1,1,()=>{y=null}),ci())},i(M){x||(ve(y),x=!0)},o(M){Oe(y),x=!1},d(M){M&&$(t),y&&y.d()}}}let si="sveltekit-live-cursors";function wc(e,t,n){let i,r;qt(e,ui,l=>n(2,i=l)),qt(e,Ir,l=>n(1,r=l)),console.log("PUBLIC_DEV_MODE",Sr),console.log("/embed/huggingface-projects/color-palette-generator-sd");let s,a;return ai(()=>(s=Ro({publicApiKey:"pk_live_6o9jIg1m7lFJp5kc7HgYgE3S"}),n(0,a=s.enter(si,{initialPresence:{cursor:null},initialStorage:{}})),console.log("room",a),()=>{s&&a&&s.leave(si)})),e.$$.update=()=>{e.$$.dirty&4&&console.log("whoami",i)},[a,r,i]}class Ec extends kt{constructor(t){super(),It(this,t,wc,gc,St,{})}}export{Ec as default}; | |