diff --git "a/static/_app/immutable/components/pages/_page.svelte-673bcd1c.js" "b/static/_app/immutable/components/pages/_page.svelte-673bcd1c.js" deleted file mode 100644--- "a/static/_app/immutable/components/pages/_page.svelte-673bcd1c.js" +++ /dev/null @@ -1 +0,0 @@ -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;io)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;nv.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;nt._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=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||ttypeof 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.numberOfRetry0&&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_. 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;nObject.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)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=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(;++o0)for(var n=new Array(r),i=0,r,o;i=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=R&&(R=M+1);!(J=x[R])&&++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;ot?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;t1?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=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>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+(n0&&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 n180?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=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]):+fon&&i.state=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()=>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{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{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};