diff --git "a/static/_app/immutable/chunks/About-16010975.js" "b/static/_app/immutable/chunks/About-16010975.js" deleted file mode 100644--- "a/static/_app/immutable/chunks/About-16010975.js" +++ /dev/null @@ -1,21 +0,0 @@ -import{S as Ee,i as ke,s as xe,C as Gn,D as Qn,E as er,F as tr,f as J,t as q,J as di,K as pi,L as Vt,M as ee,N as te,m as I,h as w,n as c,b as re,G as g,B as me,k as z,w as ge,l as V,x as ve,y as ye,z as we,a as ie,q as G,c as se,r as Q,g as Ne,d as Me,u as tt,O as De,H as Oe,P as nr,o as Bt,Q as mi,R as pt,I as Ce,T as Ts,U as Hn,V as rr,W as Ns,e as vt,X as Ms,Y as Rs}from"./index-fecbaf1e.js";import{w as Ve}from"./singletons-76be03d4.js";import{p as $s}from"./stores-f223f564.js";var Ds=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Us(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var Be={},K={};Object.defineProperty(K,"__esModule",{value:!0});var Hs=Object.defineProperty,zs=Object.defineProperties,Vs=Object.getOwnPropertyDescriptors,ln=Object.getOwnPropertySymbols,_i=Object.prototype.hasOwnProperty,gi=Object.prototype.propertyIsEnumerable,kr=(e,t,n)=>t in e?Hs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nt=(e,t)=>{for(var n in t||(t={}))_i.call(t,n)&&kr(e,n,t[n]);if(ln)for(var n of ln(t))gi.call(t,n)&&kr(e,n,t[n]);return e},It=(e,t)=>zs(e,Vs(t)),Bs=(e,t)=>{var n={};for(var r in e)_i.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ln)for(var r of ln(e))t.indexOf(r)<0&&gi.call(e,r)&&(n[r]=e[r]);return n},ir=(e,t,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(u){i(u)}},o=l=>{try{a(n.throw(l))}catch(u){i(u)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(e,t)).next())});function Qe(e,t){throw new Error(t)}function ne(e,t="Expected value to be non-nullable"){return e}var vi=(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))(vi||{}),yi=(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))(yi||{}),wi=(e=>(e[e.OBJECT=0]="OBJECT",e[e.LIST=1]="LIST",e[e.MAP=2]="MAP",e[e.REGISTER=3]="REGISTER",e))(wi||{});function bi(e){return e.type===0&&!Ei(e)}function Ei(e){return e.parentId!==void 0&&e.parentKey!==void 0}var ki=(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))(ki||{});function Ks(e){return e==="my-presence"||e==="others"||e==="event"||e==="error"||e==="connection"||e==="history"}var xi=(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))(xi||{});function xr(e,t){return Object.freeze({type:"HasParent",node:e,key:t})}var Ir=Object.freeze({type:"NoParent"});function Or(e){return Object.freeze({type:"Orphaned",oldKey:e})}var gn=class{constructor(){this._parent=Ir}_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 Qe(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 Qe(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 Qe(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=xr(e,t);return;case"Orphaned":case"NoParent":{this._parent=xr(e,t);return}default:return Qe(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=Or(this.parent.key);break}case"NoParent":{this._parent=Ir;break}case"Orphaned":{this._parent=Or(this.parent.oldKey);break}default:Qe(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}},st=class extends gn{constructor(e){super(),this._data=e}get data(){return this._data}static _deserialize([e,t],n,r){const i=new st(t.data);return i._attach(e,r),i}_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:ne(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}},mt=32,sr=126;function Xe(e,t){return e!==void 0&&t!==void 0?un(Ii(Et(e),Et(t))):e!==void 0?js(e):t!==void 0?Fs(t):un([mt+1])}function Fs(e){const t=[],n=Et(e);for(let r=0;rs)throw new Error(`Impossible to generate position between ${e} and ${t}`);if(i===s){r.push(i),n++;continue}if(s-i===1){r.push(i),r.push(...Ii(e.slice(n+1),[]));break}const o=s+i>>1;r.push(o);break}return r}function Et(e){const 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,r=Lt(e);r._attach(t,this._pool),r._setParentLink(this,n);const i=e.deletedId,s=this._indexOfPosition(n);if(s!==-1){const o=this._items[s];if(o._id===i)return o._detach(),this._items[s]=r,{modified:ce(this,[gt(s,r)]),reverse:[]};{this._implicitlyDeletedItems.add(o),this._items[s]=r;const a=[gt(s,r)],l=this._detachItemAssociatedToSetOperation(e.deletedId);return l&&a.push(l),{modified:ce(this,a),reverse:[]}}}else{const o=[],a=this._detachItemAssociatedToSetOperation(e.deletedId);return a&&o.push(a),this._insertAndSort(r),o.push(je(this._indexOfPosition(n),r)),{reverse:[],modified:ce(this,o)}}}_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 r=this._unacknowledgedSets.get(e.parentKey);if(r!==void 0){if(r!==e.opId)return t.length===0?{modified:!1}:{modified:ce(this,t),reverse:[]};this._unacknowledgedSets.delete(e.parentKey)}const i=this._indexOfPosition(e.parentKey),s=this._items.find(o=>o._id===e.id);if(s!==void 0){if(s._parentKey===e.parentKey)return{modified:t.length>0?ce(this,t):!1,reverse:[]};i!==-1&&(this._implicitlyDeletedItems.add(this._items[i]),this._items.splice(i,1),t.push(Xt(i)));const o=this._items.indexOf(s);s._setParentLink(this,e.parentKey),this._sortItems();const a=this._items.indexOf(s);return a!==o&&t.push(ut(o,a,s)),{modified:t.length>0?ce(this,t):!1,reverse:[]}}else{const o=this._pool.getNode(e.id);if(o&&this._implicitlyDeletedItems.has(o)){o._setParentLink(this,e.parentKey),this._implicitlyDeletedItems.delete(o),this._insertAndSort(o);const a=this._items.indexOf(o);return{modified:ce(this,[i===-1?je(a,o):gt(a,o),...t]),reverse:[]}}else{i!==-1&&this._items.splice(i,1);const{newItem:a,newIndex:l}=this._createAttachItemAndSort(e,e.parentKey);return{modified:ce(this,[i===-1?je(l,a):gt(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:r,newIndex:i}=this._createAttachItemAndSort(e,t);return{modified:ce(this,[je(i,r)]),reverse:[]}}_applyInsertAck(e){const t=this._items.find(i=>i._id===e.id),n=e.parentKey,r=this._indexOfPosition(n);if(t){if(t._parentKey===n)return{modified:!1};{const i=this._items.indexOf(t);r!==-1&&this._shiftItemPosition(r,n),t._setParentLink(this,n),this._sortItems();const s=this._indexOfPosition(n);return s===i?{modified:!1}:{modified:ce(this,[ut(i,s,t)]),reverse:[]}}}else{const i=ne(this._pool).getNode(e.id);if(i&&this._implicitlyDeletedItems.has(i)){i._setParentLink(this,n),this._implicitlyDeletedItems.delete(i),this._insertAndSort(i);const s=this._indexOfPosition(n);return{modified:ce(this,[je(s,i)]),reverse:[]}}else{r!==-1&&this._shiftItemPosition(r,n);const{newItem:s,newIndex:o}=this._createAttachItemAndSort(e,n);return{modified:ce(this,[je(o,s)]),reverse:[]}}}}_applyInsertUndoRedo(e){var t,n,r;const{id:i,parentKey:s}=e,o=Lt(e);if(((t=this._pool)==null?void 0:t.getNode(i))!==void 0)return{modified:!1};o._attach(i,ne(this._pool)),o._setParentLink(this,s);const a=this._indexOfPosition(s);let l=s;if(a!==-1){const f=(n=this._items[a])==null?void 0:n._getParentKeyOrThrow(),h=(r=this._items[a+1])==null?void 0:r._getParentKeyOrThrow();l=Xe(f,h),o._setParentLink(this,l)}this._insertAndSort(o);const u=this._indexOfPosition(l);return{modified:ce(this,[je(u,o)]),reverse:[{type:5,id:i}]}}_applySetUndoRedo(e){var t;const{id:n,parentKey:r}=e,i=Lt(e);if(((t=this._pool)==null?void 0:t.getNode(n))!==void 0)return{modified:!1};this._unacknowledgedSets.set(r,ne(e.opId));const s=this._indexOfPosition(r);i._attach(n,ne(this._pool)),i._setParentLink(this,r);const o=r;if(s!==-1){const a=this._items[s];a._detach(),this._items[s]=i;const l=a._toOps(ne(this._id),r,this._pool);Pn(l,e.id);const u=[gt(s,i)],f=this._detachItemAssociatedToSetOperation(e.deletedId);return f&&u.push(f),{modified:ce(this,u),reverse:l}}else{this._insertAndSort(i),this._detachItemAssociatedToSetOperation(e.deletedId);const a=this._indexOfPosition(o);return{reverse:[{type:5,id:n}],modified:ce(this,[je(a,i)])}}}_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=ne(e._parentKey),n=e._toOps(ne(this._id),t,this._pool),r=this._items.indexOf(e);return r===-1?{modified:!1}:(this._items.splice(r,1),this.invalidate(),e._detach(),{modified:ce(this,[Xt(r)]),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 s=this._items.indexOf(t);return{modified:ce(this,[je(s,t)]),reverse:[]}}const r=t._parentKey;if(e===r)return{modified:!1};const i=this._indexOfPosition(e);if(i===-1){const s=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const o=this._items.indexOf(t);return o===s?{modified:!1}:{modified:ce(this,[ut(s,o,t)]),reverse:[]}}else{this._items[i]._setParentLink(this,Xe(e,(n=this._items[i+1])==null?void 0:n._getParentKeyOrThrow()));const s=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const o=this._items.indexOf(t);return o===s?{modified:!1}:{modified:ce(this,[ut(s,o,t)]),reverse:[]}}}_applySetChildKeyAck(e,t){var n,r;const i=ne(t._parentKey);if(this._implicitlyDeletedItems.has(t)){const s=this._indexOfPosition(e);return this._implicitlyDeletedItems.delete(t),s!==-1&&this._items[s]._setParentLink(this,Xe(e,(n=this._items[s+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._insertAndSort(t),{modified:!1}}else{if(e===i)return{modified:!1};const s=this._items.indexOf(t),o=this._indexOfPosition(e);o!==-1&&this._items[o]._setParentLink(this,Xe(e,(r=this._items[o+1])==null?void 0:r._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const a=this._items.indexOf(t);return s===a?{modified:!1}:{modified:ce(this,[ut(s,a,t)]),reverse:[]}}}_applySetChildKeyUndoRedo(e,t){var n;const r=ne(t._parentKey),i=this._items.indexOf(t),s=this._indexOfPosition(e);s!==-1&&this._items[s]._setParentLink(this,Xe(e,(n=this._items[s+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const o=this._items.indexOf(t);return i===o?{modified:!1}:{modified:ce(this,[ut(i,o,t)]),reverse:[{type:1,id:ne(t._id),parentKey:r}]}}_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:ne(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key}}get length(){return this._items.length}push(e){var t;return(t=this._pool)==null||t.assertStorageIsWritable(),this.insert(e,this.length)}insert(e,t){var n;if((n=this._pool)==null||n.assertStorageIsWritable(),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 r=this._items[t-1]?this._items[t-1]._getParentKeyOrThrow():void 0,i=this._items[t]?this._items[t]._getParentKeyOrThrow():void 0,s=Xe(r,i),o=yt(e);if(o._setParentLink(this,s),this._insertAndSort(o),this._pool&&this._id){const a=this._pool.generateId();o._attach(a,this._pool),this._pool.dispatch(o._toOps(this._id,s,this._pool),[{type:5,id:a}],new Map([[this._id,ce(this,[je(t,o)])]]))}}move(e,t){var n;if((n=this._pool)==null||n.assertStorageIsWritable(),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 r=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 n=this._items[e];if(n._detach(),this._items.splice(e,1),this.invalidate(),this._pool){const r=n._id;if(r){const i=new Map;i.set(ne(this._id),ce(this,[Xt(e)])),this._pool.dispatch([{id:r,opId:this._pool.generateOpId(),type:5}],n._toOps(ne(this._id),n._getParentKeyOrThrow()),i)}}}clear(){var e;if((e=this._pool)==null||e.assertStorageIsWritable(),this._pool){const t=[],n=[],r=[];for(const s of this._items){s._detach();const o=s._id;o&&(t.push({type:5,id:o,opId:this._pool.generateOpId()}),n.push(...s._toOps(ne(this._id),s._getParentKeyOrThrow())),r.push(Xt(0)))}this._items=[],this.invalidate();const i=new Map;i.set(ne(this._id),ce(this,r)),this._pool.dispatch(t,n,i)}else{for(const t of this._items)t._detach();this._items=[],this.invalidate()}}set(e,t){var n;if((n=this._pool)==null||n.assertStorageIsWritable(),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 r=this._items[e],i=r._getParentKeyOrThrow(),s=r._id;r._detach();const o=yt(t);if(o._setParentLink(this,i),this._items[e]=o,this.invalidate(),this._pool&&this._id){const a=this._pool.generateId();o._attach(a,this._pool);const l=new Map;l.set(this._id,ce(this,[gt(e,o)]));const u=o._toOps(this._id,i,this._pool);Pn(u,s),this._unacknowledgedSets.set(i,ne(u[0].opId));const f=r._toOps(this._id,i,void 0);Pn(f,a),this._pool.dispatch(u,f,l)}}toArray(){return this._items.map(e=>ft(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 ft(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(ft(t),n))}some(e){return this.toArray().some(e)}[Symbol.iterator](){return new Ys(this._items)}_createAttachItemAndSort(e,t){const n=Lt(e);n._attach(e.id,ne(this._pool)),n._setParentLink(this,t),this._insertAndSort(n);const r=this._indexOfPosition(t);return{newItem:n,newIndex:r}}_shiftItemPosition(e,t){var n;const r=Xe(t,this._items.length>e+1?(n=this._items[e+1])==null?void 0:n._getParentKeyOrThrow():void 0);this._items[e]._setParentLink(this,r)}toImmutable(){return super.toImmutable()}_toImmutable(){return this._items.map(t=>t.toImmutable())}},Ys=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:ft(e.value)}}};function ce(e,t){return{node:e,type:"LiveList",updates:t}}function gt(e,t){return{index:e,type:"set",item:t instanceof st?t.data:t}}function Xt(e){return{index:e,type:"delete"}}function je(e,t){return{index:e,type:"insert",item:t instanceof st?t.data:t}}function ut(e,t,n){return{index:t,type:"move",previousIndex:e,item:n instanceof st?n.data:n}}function Pn(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 ot=class extends gn{constructor(e){if(super(),this.unacknowledgedSet=new Map,e){const t=[];for(const n of e){const r=yt(n[1]);r._setParentLink(this,n[0]),t.push([n[0],r])}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 r=[],i={id:this._id,opId:n==null?void 0:n.generateOpId(),type:7,parentId:e,parentKey:t};r.push(i);for(const[s,o]of this._map)r.push(...o._toOps(this._id,s,n));return r}static _deserialize([e,t],n,r){const i=new ot;i._attach(e,r);const s=n.get(e);if(s===void 0)return i;for(const[o,a]of s){const l=Si([o,a],n,r);l._setParentLink(i,a.parentKey),i._map.set(a.parentKey,l),i.invalidate()}return i}_attach(e,t){super._attach(e,t);for(const[n,r]of this._map)Ie(r)&&r._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:r,opId:i}=e,s=r,o=Lt(e);if(this._pool.getNode(n)!==void 0)return{modified:!1};if(t===2){const u=this.unacknowledgedSet.get(s);if(u===i)return this.unacknowledgedSet.delete(s),{modified:!1};if(u!==void 0)return{modified:!1}}else t===1&&this.unacknowledgedSet.delete(s);const a=this._map.get(s);let l;if(a){const u=ne(this._id);l=a._toOps(u,s),a._detach()}else l=[{type:5,id:n}];return o._setParentLink(this,s),o._attach(n,this._pool),this._map.set(s,o),this.invalidate(),{modified:{node:this,type:"LiveMap",updates:{[s]:{type:"update"}}},reverse:l}}_detach(){super._detach();for(const e of this._map.values())e._detach()}_detachChild(e){const t=ne(this._id),n=ne(e._parentKey),r=e._toOps(t,n,this._pool);for(const[s,o]of this._map)o===e&&(this._map.delete(s),this.invalidate());return e._detach(),{modified:{node:this,type:"LiveMap",updates:{[n]:{type:"delete"}}},reverse:r}}_serialize(){if(this.parent.type!=="HasParent")throw new Error("Cannot serialize LiveMap if parent is missing");return{type:2,parentId:ne(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 ft(t)}set(e,t){var n;(n=this._pool)==null||n.assertStorageIsWritable();const r=this._map.get(e);r&&r._detach();const i=yt(t);if(i._setParentLink(this,e),this._map.set(e,i),this.invalidate(),this._pool&&this._id){const s=this._pool.generateId();i._attach(s,this._pool);const o=new Map;o.set(this._id,{node:this,type:"LiveMap",updates:{[e]:{type:"update"}}});const a=i._toOps(this._id,e,this._pool);this.unacknowledgedSet.set(e,ne(a[0].opId)),this._pool.dispatch(i._toOps(this._id,e,this._pool),r?r._toOps(this._id,e):[{type:5,id:s}],o)}}get size(){return this._map.size}has(e){return this._map.has(e)}delete(e){var t;(t=this._pool)==null||t.assertStorageIsWritable();const n=this._map.get(e);if(n===void 0)return!1;if(n._detach(),this._map.delete(e),this.invalidate(),this._pool&&n._id){const r=ne(this._id),i=new Map;i.set(r,{node:this,type:"LiveMap",updates:{[e]:{type:"delete"}}}),this._pool.dispatch([{type:5,id:n._id,opId:this._pool.generateOpId()}],n._toOps(r,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 r=t.value[0],i=ft(t.value[1]);return{value:[r,i]}}}}[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:ft(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 ze(e)}},Ke=class extends gn{constructor(e={}){super(),this._propToLastUpdate=new Map;for(const t in e){const n=e[t];n!==void 0&&Ie(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 r=n==null?void 0:n.generateOpId(),i=[],s=e!==void 0&&t!==void 0?{type:4,id:this._id,opId:r,parentId:e,parentKey:t,data:{}}:{type:4,id:this._id,opId:r,data:{}};i.push(s);for(const[o,a]of this._map)Ie(a)?i.push(...a._toOps(this._id,o,n)):s.data[o]=a;return i}static _deserialize([e,t],n,r){const i=new Ke(t.data);return i._attach(e,r),this._deserializeChildren(i,n,r)}static _deserializeChildren(e,t,n){const r=t.get(ne(e._id));if(r===void 0)return e;for(const[i,s]of r){const o=Js([i,s],t,n);tn(o)&&o._setParentLink(e,s.parentKey),e._map.set(s.parentKey,o),e.invalidate()}return e}_attach(e,t){super._attach(e,t);for(const[n,r]of this._map)Ie(r)&&r._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:r,parentKey:i}=e,s=Ai(e);if(this._pool.getNode(n)!==void 0)return this._propToLastUpdate.get(i)===r&&this._propToLastUpdate.delete(i),{modified:!1};if(t===0)this._propToLastUpdate.set(i,ne(r));else if(this._propToLastUpdate.get(i)!==void 0)return this._propToLastUpdate.get(i)===r?(this._propToLastUpdate.delete(i),{modified:!1}):{modified:!1};const o=ne(this._id),a=this._map.get(i);let l;return Ie(a)?(l=a._toOps(o,i),a._detach()):a===void 0?l=[{type:6,id:o,key:i}]:l=[{type:3,id:o,data:{[i]:a}}],this._map.set(i,s),this.invalidate(),tn(s)&&(s._setParentLink(this,i),s._attach(n,this._pool)),{reverse:l,modified:{node:this,type:"LiveObject",updates:{[i]:{type:"update"}}}}}_detachChild(e){if(e){const t=ne(this._id),n=ne(e._parentKey),r=e._toOps(t,n,this._pool);for(const[s,o]of this._map)o===e&&(this._map.delete(s),this.invalidate());return e._detach(),{modified:{node:this,type:"LiveObject",updates:{[n]:{type:"delete"}}},reverse:r}}return{modified:!1}}_detach(){super._detach();for(const e of this._map.values())Ie(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)Ie(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 r=ne(this._id),i=[],s={type:3,id:r,data:{}};i.push(s);for(const a in e.data){const l=this._map.get(a);Ie(l)?(i.push(...l._toOps(r,a)),l._detach()):l!==void 0?s.data[a]=l:l===void 0&&i.push({type:6,id:r,key:a})}const o={};for(const a in e.data){const l=e.data[a];if(l===void 0)continue;if(t)this._propToLastUpdate.set(a,ne(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 u=this._map.get(a);Ie(u)&&u._detach(),n=!0,o[a]={type:"update"},this._map.set(a,l),this.invalidate()}return Object.keys(s.data).length!==0&&i.unshift(s),n?{modified:{node:this,type:"LiveObject",updates:o},reverse:i}:{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),r=ne(this._id);let i=[];return Ie(n)?(i=n._toOps(r,e.key),n._detach()):n!==void 0&&(i=[{type:3,id:r,data:{[t]:n}}]),this._map.delete(t),this.invalidate(),{modified:{node:this,type:"LiveObject",updates:{[e.key]:{type:"delete"}}},reverse:i}}toObject(){return to(this._map)}set(e,t){var n;(n=this._pool)==null||n.assertStorageIsWritable(),this.update({[e]:t})}get(e){return this._map.get(e)}delete(e){var t;(t=this._pool)==null||t.assertStorageIsWritable();const n=e,r=this._map.get(n);if(r===void 0)return;if(this._pool===void 0||this._id===void 0){Ie(r)&&r._detach(),this._map.delete(n),this.invalidate();return}let i;Ie(r)?(r._detach(),i=r._toOps(this._id,n)):i=[{type:3,data:{[n]:r},id:this._id}],this._map.delete(n),this.invalidate();const s=new Map;s.set(this._id,{node:this,type:"LiveObject",updates:{[e]:{type:"delete"}}}),this._pool.dispatch([{type:6,key:n,id:this._id,opId:this._pool.generateOpId()}],i,s)}update(e){var t;if((t=this._pool)==null||t.assertStorageIsWritable(),this._pool===void 0||this._id===void 0){for(const u in e){const f=e[u];if(f===void 0)continue;const h=this._map.get(u);Ie(h)&&h._detach(),Ie(f)&&f._setParentLink(this,u),this._map.set(u,f),this.invalidate()}return}const n=[],r=[],i=this._pool.generateOpId(),s={},o={id:this._id,type:3,data:{}},a={};for(const u in e){const f=e[u];if(f===void 0)continue;const h=this._map.get(u);if(Ie(h)?(r.push(...h._toOps(this._id,u)),h._detach()):h===void 0?r.push({type:6,id:this._id,key:u}):o.data[u]=h,Ie(f)){f._setParentLink(this,u),f._attach(this._pool.generateId(),this._pool);const d=f._toOps(this._id,u,this._pool),p=d.find(O=>O.parentId===this._id);p&&this._propToLastUpdate.set(u,ne(p.opId)),n.push(...d)}else s[u]=f,this._propToLastUpdate.set(u,i);this._map.set(u,f),this.invalidate(),a[u]={type:"update"}}Object.keys(o.data).length!==0&&r.unshift(o),Object.keys(s).length!==0&&n.unshift({opId:i,id:this._id,type:3,data:s});const l=new Map;l.set(this._id,{node:this,type:"LiveObject",updates:a}),this._pool.dispatch(n,r,l)}toImmutable(){return super.toImmutable()}_toImmutable(){const e={};for(const[t,n]of this._map)e[t]=tn(n)?n.toImmutable():n;return e}},ze=e=>e;function zn(e){return e.filter(t=>t!=null)}function vn(e){const t=nt({},e);return Object.keys(e).forEach(n=>{const r=n;t[r]===void 0&&delete t[r]}),t}function Lt(e){return yt(Ai(e))}function Ai(e){switch(e.type){case 8:return e.data;case 4:return new Ke(e.data);case 7:return new ot;case 2:return new Je;default:return Qe(e,"Unknown creation Op")}}function Ci(e,t){return e===t?!0:e.parent.type==="HasParent"?Ci(e.parent.node,t):!1}function Si([e,t],n,r){switch(t.type){case 0:return Ke._deserialize([e,t],n,r);case 1:return Je._deserialize([e,t],n,r);case 2:return ot._deserialize([e,t],n,r);case 3:return st._deserialize([e,t],n,r);default:throw new Error("Unexpected CRDT type")}}function Js([e,t],n,r){switch(t.type){case 0:return Ke._deserialize([e,t],n,r);case 1:return Je._deserialize([e,t],n,r);case 2:return ot._deserialize([e,t],n,r);case 3:return t.data;default:throw new Error("Unexpected CRDT type")}}function tn(e){return yn(e)||Zs(e)||or(e)}function Ie(e){return tn(e)||Ws(e)}function yn(e){return e instanceof Je}function Zs(e){return e instanceof ot}function or(e){return e instanceof Ke}function Ws(e){return e instanceof st}function ft(e){return e instanceof st?e.data:e instanceof Je||e instanceof ot||e instanceof Ke?e:Qe(e,"Unknown AbstractCrdt")}function yt(e){return e instanceof Ke||e instanceof ot||e instanceof Je?e:new st(e)}function qs(e,t){const n=[];return e.forEach((r,i)=>{t.get(i)||n.push({type:5,id:i})}),t.forEach((r,i)=>{const s=e.get(i);if(s)r.type===0&&(s.type!==0||JSON.stringify(r.data)!==JSON.stringify(s.data))&&n.push({type:3,id:i,data:r.data}),r.parentKey!==s.parentKey&&n.push({type:1,id:i,parentKey:ne(r.parentKey,"Parent key must not be missing")});else switch(r.type){case 3:n.push({type:8,id:i,parentId:r.parentId,parentKey:r.parentKey,data:r.data});break;case 1:n.push({type:2,id:i,parentId:r.parentId,parentKey:r.parentKey});break;case 0:n.push(r.parentId?{type:4,id:i,parentId:r.parentId,parentKey:r.parentKey,data:r.data}:{type:4,id:i,data:r.data});break;case 2:n.push({type:7,id:i,parentId:r.parentId,parentKey:r.parentKey});break}}),n}function Gs(e,t){const n=e.updates;for(const[r,i]of Pi(t.updates))n[r]=i;return It(nt({},t),{updates:n})}function Qs(e,t){const n=e.updates;for(const[r,i]of Pi(t.updates))n[r]=i;return It(nt({},t),{updates:n})}function eo(e,t){const n=e.updates;return It(nt({},t),{updates:n.concat(t.updates)})}function Ln(e,t){return e?e.type==="LiveObject"&&t.type==="LiveObject"?Gs(e,t):e.type==="LiveMap"&&t.type==="LiveMap"?Qs(e,t):e.type==="LiveList"&&t.type==="LiveList"?eo(e,t):t:t}function rt(e){return e!==null&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"}function to(e){const t={};for(const[n,r]of e)t[n]=r;return t}function Pi(e){return Object.entries(e)}function ar(e){try{return JSON.parse(e)}catch{return}}function Li(e){try{const t=e.replace(/-/g,"+").replace(/_/g,"/");return decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""))}catch{return atob(e)}}function no(e){if(!rt(e))return!1;const{iat:t,exp:n}=e;return typeof t=="number"&&typeof n=="number"}function ro(e){const t=Date.now()/1e3;return t>e.exp-300||ttypeof t=="string")}function Ni(e){return typeof e.appId=="string"&&e.roomId===void 0&&Ti(e.scopes)}function lr(e){return typeof e.appId=="string"&&typeof e.roomId=="string"&&typeof e.actor=="number"&&(e.id===void 0||typeof e.id=="string")&&Ti(e.scopes)&&(e.maxConnectionsPerRoom===void 0||typeof e.maxConnectionsPerRoom=="number")}function io(e){return Ni(e)||lr(e)}function so(e){const t=e.split(".");if(t.length!==3)throw new Error("Authentication error: invalid JWT token");const n=ar(Li(t[1]));if(n&&no(n))return n;throw new Error("Authentication error: missing JWT metadata")}function Ar(e){const t=so(e);if(t&&lr(t))return Bs(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 oo(e,t=e){}function ao(e,t,n=t){}function lo(e){}function uo(e,t){}function qe(){const e=new Set,t=new Set;function n(o){return t.add(o),()=>t.delete(o)}function r(o){return e.add(o),()=>e.delete(o)}function i(o){e.forEach(a=>a(o)),e.clear(),t.forEach(a=>a(o))}function s(){e.clear(),t.clear()}return{notify:i,subscribe:n,subscribeOnce:r,clear:s,observable:{subscribe:n,subscribeOnce:r}}}function Mi(e,t){let n=!1;const r=nt({},e);return Object.keys(t).forEach(i=>{const s=i,o=t[s];r[s]!==o&&(o===void 0?delete r[s]:r[s]=o,n=!0)}),n?r:e}var wn=class{constructor(){this._ev=qe()}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()}},co=class extends wn{constructor(e){super(),this._me=ze(vn(e))}_toImmutable(){return this._me}patch(e){const t=this._me,n=Mi(t,e);t!==n&&(this._me=ze(n),this.invalidate())}};function Ri(e){return Object.defineProperty(e,"count",{value:e.length,enumerable:!1}),Object.defineProperty(e,"toArray",{value:()=>e,enumerable:!1}),ze(e)}function fo(e,t){return ze(vn(It(nt({},e),{presence:t})))}var ho=class extends wn{constructor(){super(),this._connections={},this._presences={},this._users={}}_toImmutable(){const e=zn(Object.keys(this._presences).map(t=>this.getUser(Number(t))));return Ri(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,r){this._connections[e]=ze({connectionId:e,id:t,info:n,isReadOnly:r}),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]=ze(vn(t)),this._connections[e]!==void 0&&this._invalidateUser(e)}patchOther(e,t){const n=this._presences[e];if(n===void 0)return;const r=Mi(n,t);n!==r&&(this._presences[e]=ze(r),this._invalidateUser(e))}};function $i(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function ur(e){return Array.isArray(e)}function Di(e){return!$i(e)&&!ur(e)}var po=class extends wn{constructor(e){super(),this._value=ze(vn(e))}_toImmutable(){return this._value}set(e){this._value=ze(e),this.invalidate()}},mo=class extends wn{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)}},Tn=[250,500,1e3,2e3,4e3,8e3,1e4],Nn=[2e3,3e4,6e4,3e5],_o=3e4,go=2e3;function vo(e){let t=0;return()=>`${e}:${t++}`}function Yt(e){return e.state==="open"||e.state==="connecting"}function yo(e,t,n){var r;const i=_=>_(),s=(r=t.unstable_batchedUpdates)!=null?r:i,o={roomId:t.roomId,getNode:_=>e.nodes.get(_),addNode:(_,P)=>void e.nodes.set(_,P),deleteNode:_=>void e.nodes.delete(_),generateId:()=>`${m()}:${e.clock++}`,generateOpId:()=>`${m()}:${e.opClock++}`,dispatch(_,P,M){const B=e.activeBatch;B?(B.ops.push(..._),M.forEach((Y,fe)=>{B.updates.storageUpdates.set(fe,Ln(B.updates.storageUpdates.get(fe),Y))}),B.reverseOps.push(...P)):s(()=>{E(P,i),e.redoStack=[],yr(_),k({storageUpdates:M},i)})},assertStorageIsWritable:()=>{if(Yt(e.connection.current)&&e.connection.current.isReadOnly)throw new Error("Cannot write to storage with a read only user, please ensure the user has write permissions")}},a={customEvent:qe(),me:qe(),others:qe(),error:qe(),connection:qe(),storage:qe(),history:qe(),storageDidLoad:qe()},l=n||{authenticate(_,P){const M=e.token,B=M!==null&&Ar(M);if(B&&!ro(B)){const Y=P(M);X(B,Y);return}else return _(t.roomId).then(({token:Y})=>{if(e.connection.current.state!=="authenticating")return;const fe=Ar(Y),ue=P(Y);X(fe,ue),e.token=Y}).catch(Y=>Z())},send(_){if(e.socket===null)throw new Error("Can't send message if socket is null");e.socket.send(JSON.stringify(_))},delayFlush(_){return setTimeout(Se,_)},startHeartbeatInterval(){return setInterval(_e,_o)},schedulePongTimeout(){return setTimeout(at,go)},scheduleReconnect(_){return setTimeout(H,_)}},u=new mo([e.connection,e.me],(_,P)=>Yt(_)?{connectionId:_.id,id:_.userId,info:_.userInfo,presence:P,isReadOnly:_.isReadOnly}:null);function f(_,P){if(_.items.length===0)throw new Error("Internal error: cannot load storage without items");e.root?d(_.items,P):e.root=p(_.items);for(const M in e.initialStorage)e.root.get(M)===void 0&&e.root.set(M,e.initialStorage[M])}function h(_){const P=new Map;let M=null;for(const[B,Y]of _)if(bi(Y))M=[B,Y];else{const fe=[B,Y],ue=P.get(Y.parentId);ue!==void 0?ue.push(fe):P.set(Y.parentId,[fe])}if(M===null)throw new Error("Root can't be null");return[M,P]}function d(_,P){if(!e.root)return;const M=new Map;e.nodes.forEach((fe,ue)=>{M.set(ue,fe._serialize())});const B=qs(M,new Map(_)),Y=b(B,!1);k(Y.updates,P)}function p(_){const[P,M]=h(_);return Ke._deserialize(P,M,o)}function O(_,P){e.undoStack.length>=50&&e.undoStack.shift(),e.undoStack.push(_),T(P)}function E(_,P){e.pausedHistory!==null?e.pausedHistory.unshift(..._):O(_,P)}function k({storageUpdates:_=new Map,presence:P=!1,others:M=[]},B){B(()=>{if(M.length>0){const Y=e.others.current;for(const fe of M)a.others.notify({others:Y,event:fe})}if(P&&a.me.notify(e.me.current),_.size>0){const Y=Array.from(_.values());a.storage.notify(Y)}})}function m(){const _=e.connection.current;if(Yt(_))return _.id;if(e.lastConnectionId!==null)return e.lastConnectionId;throw new Error("Internal. Tried to get connection id but connection was never open")}function b(_,P){const M={reverse:[],updates:{storageUpdates:new Map,presence:!1}},B=new Set;for(const Y of _)if(Y.type==="presence"){const fe={type:"presence",data:{}};for(const ue in Y.data)fe.data[ue]=e.me.current[ue];if(e.me.patch(Y.data),e.buffer.me===null)e.buffer.me={type:"partial",data:Y.data};else for(const ue in Y.data)e.buffer.me.data[ue]=Y.data[ue];M.reverse.unshift(fe),M.updates.presence=!0}else{let fe;Y.opId||(Y.opId=o.generateOpId()),P?fe=0:fe=e.offlineOperations.delete(ne(Y.opId))?2:1;const ue=L(Y,fe);if(ue.modified){const Sn=ue.modified.node.parent.type==="HasParent"?ne(ue.modified.node.parent.node._id,"Expected parent node to have an ID"):void 0;(!Sn||!B.has(Sn))&&(M.updates.storageUpdates.set(ne(ue.modified.node._id),Ln(M.updates.storageUpdates.get(ne(ue.modified.node._id)),ue.modified)),M.reverse.unshift(...ue.reverse)),(Y.type===2||Y.type===7||Y.type===4)&&B.add(ne(ue.modified.node._id))}}return M}function L(_,P){switch(_.type){case 6:case 3:case 5:{const M=e.nodes.get(_.id);return M===void 0?{modified:!1}:M._apply(_,P===0)}case 1:{const M=e.nodes.get(_.id);return M===void 0?{modified:!1}:M.parent.type==="HasParent"&&yn(M.parent.node)?M.parent.node._setChildKey(_.parentKey,M,P):{modified:!1}}case 4:case 2:case 7:case 8:{if(_.parentId===void 0)return{modified:!1};const M=e.nodes.get(_.parentId);return M===void 0?{modified:!1}:M._attachChild(_,P)}}}function v(_,P){return a.storage.subscribe(M=>{const B=M.filter(Y=>Ci(Y.node,_));B.length>0&&P(B)})}function $(_,P){return a.storage.subscribe(M=>{for(const B of M)B.node._id===_._id&&P(B.node)})}function A(_,P,M){if(typeof _=="string"&&Ks(_)){if(typeof P!="function")throw new Error("Second argument must be a callback function");const B=P;switch(_){case"event":return a.customEvent.subscribe(B);case"my-presence":return a.me.subscribe(B);case"others":{const Y=B;return a.others.subscribe(({others:fe,event:ue})=>Y(fe,ue))}case"error":return a.error.subscribe(B);case"connection":return a.connection.subscribe(B);case"storage":return a.storage.subscribe(B);case"history":return a.history.subscribe(B);default:return Qe(_,"Unknown event")}}if(P===void 0||typeof _=="function")if(typeof _=="function"){const B=_;return a.storage.subscribe(B)}else throw new Error("Please specify a listener callback");if(Ie(_)){const B=_;return M!=null&&M.isDeep?v(B,P):$(B,P)}throw new Error(`"${_}" is not a valid event name`)}function R(){return e.connection.current.state}function H(){var _,P,M,B;if(e.connection.current.state!=="closed"&&e.connection.current.state!=="unavailable")return;const Y=xo(t.authentication,(P=(_=t.polyfills)==null?void 0:_.fetch)!=null?P:t.fetchPolyfill),fe=ko(t.liveblocksServer,(B=(M=t.polyfills)==null?void 0:M.WebSocket)!=null?B:t.WebSocketPolyfill);ae({state:"authenticating"},s),l.authenticate(Y,fe)}function N(_,P){const M={};e.buffer.me===null&&(e.buffer.me={type:"partial",data:{}});for(const B in _){const Y=_[B];Y!==void 0&&(e.buffer.me.data[B]=Y,M[B]=e.me.current[B])}e.me.patch(_),e.activeBatch?(P!=null&&P.addToHistory&&e.activeBatch.reverseOps.push({type:"presence",data:M}),e.activeBatch.updates.presence=!0):(Se(),s(()=>{P!=null&&P.addToHistory&&E([{type:"presence",data:M}],i),k({presence:!0},i)}))}function U(_){return _.includes("room:read")&&_.includes("room:presence:write")&&!_.includes("room:write")}function X(_,P){P.addEventListener("message",oe),P.addEventListener("open",be),P.addEventListener("close",le),P.addEventListener("error",Ae),ae({state:"connecting",id:_.actor,userInfo:_.info,userId:_.id,isReadOnly:U(_.scopes)},s),e.idFactory=vo(_.actor),e.socket=P}function Z(_){e.token=null,ae({state:"unavailable"},s),e.numberOfRetry++,e.timeoutHandles.reconnect=l.scheduleReconnect(pe())}function F(_){_==="visible"&&e.connection.current.state==="open"&&_e()}function y(_){if(_.targetActor!==void 0){const M=e.others.getUser(_.actor);e.others.setOther(_.actor,_.data);const B=e.others.getUser(_.actor);if(M===void 0&&B!==void 0)return{type:"enter",user:B}}else e.others.patchOther(_.actor,_.data);const P=e.others.getUser(_.actor);if(P)return{type:"update",updates:_.data,user:P}}function x(_){const P=e.others.getUser(_.actor);return P?(e.others.removeConnection(_.actor),{type:"leave",user:P}):null}function C(_){for(const P in _.users){const M=_.users[P],B=Number(P);e.others.setConnection(B,M.id,M.info,U(M.scopes))}return{type:"reset"}}function S(){e.connection.current.state==="unavailable"&&Ot()}function T(_){_(()=>{a.history.notify({canUndo:br(),canRedo:Er()})})}function j(_){e.others.setConnection(_.actor,_.id,_.info,U(_.scopes)),e.buffer.messages.push({type:100,data:e.me.current,targetActor:_.actor}),Se();const P=e.others.getUser(_.actor);return P?{type:"enter",user:P}:void 0}function D(_){return Di(_)?_:null}function W(_){const P=ar(_);return P===void 0?null:ur(P)?zn(P.map(M=>D(M))):zn([D(P)])}function oe(_){if(_.data==="pong"){clearTimeout(e.timeoutHandles.pongTimeout);return}const P=W(_.data);if(P===null||P.length===0)return;const M={storageUpdates:new Map,others:[]};s(()=>{for(const B of P)switch(B.type){case 101:{const Y=j(B);Y&&M.others.push(Y);break}case 100:{const Y=y(B);Y&&M.others.push(Y);break}case 103:{a.customEvent.notify({connectionId:B.actor,event:B.event});break}case 102:{const Y=x(B);Y&&M.others.push(Y);break}case 104:{M.others.push(C(B));break}case 200:{const Y=new Map(e.offlineOperations);f(B,i),At(Y,i),Cn==null||Cn(),a.storageDidLoad.notify();break}case 201:{b(B.ops,!1).updates.storageUpdates.forEach((fe,ue)=>{M.storageUpdates.set(ue,Ln(M.storageUpdates.get(ue),fe))});break}}k(M,i)})}function le(_){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(),s(()=>{if(k({others:[{type:"reset"}]},i),_.code>=4e3&&_.code<=4100){ae({state:"failed"},i);const P=new Eo(_.reason,_.code);a.error.notify(P);const M=pe(!0);e.numberOfRetry++,ae({state:"unavailable"},i),e.timeoutHandles.reconnect=l.scheduleReconnect(M)}else if(_.code===4999)ae({state:"closed"},i);else{const P=pe();e.numberOfRetry++,ae({state:"unavailable"},i),e.timeoutHandles.reconnect=l.scheduleReconnect(P)}})}function ae(_,P){e.connection.set(_),P(()=>{a.connection.notify(_.state)})}function pe(_=!1){return _?Nn[e.numberOfRetry0&&_.forEach(B=>{e.offlineOperations.set(ne(B.opId),B)}),e.socket===null||e.socket.readyState!==e.socket.OPEN){e.buffer.storageOperations=[];return}const P=Date.now();if(P-e.lastFlushTime>t.throttleDelay){const B=Ct(e);if(B.length===0)return;l.send(B),e.buffer={messages:[],storageOperations:[],me:null},e.lastFlushTime=P}else e.timeoutHandles.flush!==null&&clearTimeout(e.timeoutHandles.flush),e.timeoutHandles.flush=l.delayFlush(t.throttleDelay-(P-e.lastFlushTime))}function Ct(_){const P=[];_.buffer.me&&P.push(_.buffer.me.type==="full"?{type:100,targetActor:-1,data:_.buffer.me.data}:{type:100,data:_.buffer.me.data});for(const M of _.buffer.messages)P.push(M);return _.buffer.storageOperations.length>0&&P.push({type:201,ops:_.buffer.storageOperations}),P}function ys(){e.socket&&(e.socket.removeEventListener("open",be),e.socket.removeEventListener("message",oe),e.socket.removeEventListener("close",le),e.socket.removeEventListener("error",Ae),e.socket.close(),e.socket=null),s(()=>{ae({state:"closed"},i),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),clearTimeout(e.timeoutHandles.pongTimeout),clearInterval(e.intervalHandles.heartbeat),e.others.clearOthers(),k({others:[{type:"reset"}]},i),Object.values(a).forEach(_=>_.clear())})}function ws(){return e.me.current}function bs(){return e.others.current}function Es(_,P={shouldQueueEventIfNotReady:!1}){e.socket===null&&!P.shouldQueueEventIfNotReady||(e.buffer.messages.push({type:103,event:_}),Se())}function yr(_){e.buffer.storageOperations.push(..._),Se()}let An=null,Cn=null;function wr(){return An===null&&(e.buffer.messages.push({type:200}),Se(),An=new Promise(_=>Cn=_)),An}function ks(){const _=e.root;return _!==void 0?_:(wr(),null)}function xs(){return ir(this,null,function*(){return e.root?Promise.resolve({root:e.root}):(yield wr(),{root:ne(e.root)})})}function Is(){if(e.activeBatch)throw new Error("undo is not allowed during a batch");const _=e.undoStack.pop();if(_===void 0)return;e.pausedHistory=null;const P=b(_,!0);s(()=>{k(P.updates,i),e.redoStack.push(P.reverse),T(i)});for(const M of _)M.type!=="presence"&&e.buffer.storageOperations.push(M);Se()}function br(){return e.undoStack.length>0}function Os(){if(e.activeBatch)throw new Error("redo is not allowed during a batch");const _=e.redoStack.pop();if(_===void 0)return;e.pausedHistory=null;const P=b(_,!0);s(()=>{k(P.updates,i),e.undoStack.push(P.reverse),T(i)});for(const M of _)M.type!=="presence"&&e.buffer.storageOperations.push(M);Se()}function Er(){return e.redoStack.length>0}function As(_){if(e.activeBatch)return _();let P;return s(()=>{e.activeBatch={ops:[],updates:{storageUpdates:new Map,presence:!1,others:[]},reverseOps:[]};try{P=_()}finally{const M=e.activeBatch;e.activeBatch=null,M.reverseOps.length>0&&E(M.reverseOps,i),M.ops.length>0&&(e.redoStack=[]),M.ops.length>0&&yr(M.ops),k(M.updates,i),Se()}}),P}function Cs(){e.pausedHistory=[]}function Ss(){const _=e.pausedHistory;e.pausedHistory=null,_!==null&&_.length>0&&O(_,s)}function Ps(){e.socket&&(e.socket=null)}function Ls(_){le(_)}return{onClose:le,onMessage:oe,authenticationSuccess:X,heartbeat:_e,onNavigatorOnline:S,simulateSocketClose:Ps,simulateSendCloseEvent:Ls,onVisibilityChange:F,getUndoStack:()=>e.undoStack,getItemsCount:()=>e.nodes.size,connect:H,disconnect:ys,subscribe:A,updatePresence:N,broadcastEvent:Es,batch:As,undo:Is,redo:Os,canUndo:br,canRedo:Er,pauseHistory:Cs,resumeHistory:Ss,getStorage:xs,getStorageSnapshot:ks,events:{customEvent:a.customEvent.observable,others:a.others.observable,me:a.me.observable,error:a.error.observable,connection:a.connection.observable,storage:a.storage.observable,history:a.history.observable,storageDidLoad:a.storageDidLoad.observable},getConnectionState:R,isSelfAware:()=>Yt(e.connection.current),getSelf:()=>u.current,getPresence:ws,getOthers:bs}}function wo(e,t){const n=new ho,r=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:r,me:new co(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:r}=e,i=wo(typeof n=="function"?n(t.roomId):n,typeof r=="function"?r(t.roomId):r),s=yo(i,t),o={id:t.roomId,getConnectionState:s.getConnectionState,isSelfAware:s.isSelfAware,getSelf:s.getSelf,subscribe:s.subscribe,getPresence:s.getPresence,updatePresence:s.updatePresence,getOthers:s.getOthers,broadcastEvent:s.broadcastEvent,getStorage:s.getStorage,getStorageSnapshot:s.getStorageSnapshot,events:s.events,batch:s.batch,history:{undo:s.undo,redo:s.redo,canUndo:s.canUndo,canRedo:s.canRedo,pause:s.pauseHistory,resume:s.resumeHistory},__INTERNAL_DO_NOT_USE:{simulateCloseWebsocket:s.simulateSocketClose,simulateSendCloseEvent:s.simulateSendCloseEvent}};return{connect:s.connect,disconnect:s.disconnect,onNavigatorOnline:s.onNavigatorOnline,onVisibilityChange:s.onVisibilityChange,room:o}}var Eo=class extends Error{constructor(e,t){super(e),this.code=t}};function ko(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 r=>new n(`${e}/?token=${r}&version=0.18.5`)}function xo(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=>Cr(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=>Cr(t||fetch,e.url,{room:n})}if(e.type==="custom")return n=>ir(this,null,function*(){const r=yield e.callback(n);if(!r||!r.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 r});throw new Error("Internal error. Unexpected authentication type")}function Cr(e,t,n){return ir(this,null,function*(){const r=yield e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Mn(`Expected a status 200 but got ${r.status} when doing a POST request on "${t}"`);let i;try{i=yield r.json()}catch(o){throw new Mn(`Expected a JSON response when doing a POST request on "${t}". ${o}`)}if(!rt(i)||typeof i.token!="string")throw new Mn(`Expected a JSON response of the form \`{ token: "..." }\` when doing a POST request on "${t}", but got ${JSON.stringify(i)}`);const{token:s}=i;return{token:s}})}var Mn=class extends Error{constructor(e){super(e)}};function Io(e){const t=e,n=Oo(e),r=new Map;function i(a){const l=r.get(a);return l?l.room:null}function s(a,l){var u,f;const h=l.shouldInitiallyConnect===void 0?!0:l.shouldInitiallyConnect;let d=r.get(a);if(d)return d.room;if(l.initialPresence===null||l.initialPresence,d=bo({initialPresence:(u=l.initialPresence)!=null?u:{},initialStorage:l.initialStorage},{roomId:a,throttleDelay:n,polyfills:t.polyfills,WebSocketPolyfill:t.WebSocketPolyfill,fetchPolyfill:t.fetchPolyfill,unstable_batchedUpdates:l==null?void 0:l.unstable_batchedUpdates,liveblocksServer:(t==null?void 0:t.liveblocksServer)||"wss://api.liveblocks.io/v6",authentication:Ao(t,a)}),r.set(a,d),h){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");Ds.atob=t.polyfills.atob}d.connect()}return d.room}function o(a){const l=r.get(a);l&&(l.disconnect(),r.delete(a))}return typeof window<"u"&&typeof window.addEventListener<"u"&&window.addEventListener("online",()=>{for(const[,a]of r)a.onNavigatorOnline()}),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{for(const[,a]of r)a.onVisibilityChange(document.visibilityState)}),{getRoom:i,enter:s,leave:o}}function Oo(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 Ao(e,t){const{publicApiKey:n,authEndpoint:r}=e;if(r!==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:Co(e,t)}}if(typeof r=="string")return{type:"private",url:r};if(typeof r=="function")return{type:"custom",callback:r};throw r!==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 Co(e,t){return e.publicAuthorizeEndpoint?e.publicAuthorizeEndpoint.replace("{roomId}",t):`https://api.liveblocks.io/v2/rooms/${encodeURIComponent(t)}/public/authorize`}function Ui(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=Ue(r))}return t}function So(e){return Ui(e.toObject())}function Po(e){const t={};for(const[n,r]of e.entries())t[n]=Ue(r);return t}function Hi(e){return e.map(Ue)}function Lo(e){return Hi(e.toArray())}function Ue(e){return e instanceof Ke?So(e):e instanceof Je?Lo(e):e instanceof ot?Po(e):e instanceof st?e.data:Array.isArray(e)?Hi(e):rt(e)?Ui(e):e}function ht(e){if(Array.isArray(e))return new Je(e.map(ht));if(rt(e)){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=ht(r))}return new Ke(t)}else return e}function To(e,t,n){let r=0,i=t.length-1,s=n.length-1,o=t[0],a=n[0];e:{for(;o===a;){if(++r,r>i||r>s)break e;o=t[r],a=n[r]}for(o=t[i],a=n[s];o===a;){if(i--,s--,r>i||r>s)break e;o=t[i],a=n[s]}}if(r>i){if(r<=s)for(;r<=s;)e.insert(ht(n[r]),r),r++}else if(r>s){let l=r;for(;l<=i;)e.delete(r),l++}else{for(;r<=i&&r<=s;){o=t[r],a=n[r];const u=e.get(r);or(u)&&rt(o)&&rt(a)?Vi(u,o,a):e.set(r,ht(a)),r++}for(;r<=s;)e.insert(ht(n[r]),r),r++;let l=r;for(;l<=i;)e.delete(r),l++}}function zi(e,t,n,r){const i=e.get(t);if(r===void 0)e.delete(t);else if(i===void 0)e.set(t,ht(r));else{if(n===r)return;yn(i)&&Array.isArray(n)&&Array.isArray(r)?To(i,n,r):or(i)&&rt(n)&&rt(r)?Vi(i,n,r):e.set(t,ht(r))}}function Vi(e,t,n){const r={};for(const i in n)zi(e,i,t[i],n[i]);for(const i in t)n[i]===void 0&&e.delete(i);Object.keys(r).length>0&&e.update(r)}function No(e){const t=[];for(;e.parent.type==="HasParent";)yn(e.parent.node)?t.push(e.parent.node._indexOfPosition(e.parent.key)):t.push(e.parent.key),e=e.parent.node;return t}function Mo(e,t){return t.reduce((n,r)=>Ro(n,r),e)}function Ro(e,t){const n=No(t.node);return Vn(e,n,t)}function Vn(e,t,n){var r,i,s,o;const a=t.pop();if(a===void 0)switch(n.type){case"LiveObject":{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error("Internal: received update on LiveObject but state was not an object");const l=Object.assign({},e);for(const u in n.updates)if(((r=n.updates[u])==null?void 0:r.type)==="update"){const f=n.node.get(u);f!==void 0&&(l[u]=Ue(f))}else((i=n.updates[u])==null?void 0:i.type)==="delete"&&delete l[u];return l}case"LiveList":{if(!Array.isArray(e))throw new Error("Internal: received update on LiveList but state was not an array");let l=e.map(u=>u);for(const u of n.updates)u.type==="set"?l=l.map((f,h)=>h===u.index?Ue(u.item):f):u.type==="insert"?u.index===l.length?l.push(Ue(u.item)):l=[...l.slice(0,u.index),Ue(u.item),...l.slice(u.index)]:u.type==="delete"?l.splice(u.index,1):u.type==="move"&&(u.previousIndex>u.index?l=[...l.slice(0,u.index),Ue(u.item),...l.slice(u.index,u.previousIndex),...l.slice(u.previousIndex+1)]:l=[...l.slice(0,u.previousIndex),...l.slice(u.previousIndex+1,u.index+1),Ue(u.item),...l.slice(u.index+1)]);return l}case"LiveMap":{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error("Internal: received update on LiveMap but state was not an object");const l=Object.assign({},e);for(const u in n.updates)if(((s=n.updates[u])==null?void 0:s.type)==="update"){const f=n.node.get(u);f!==void 0&&(l[u]=Ue(f))}else((o=n.updates[u])==null?void 0:o.type)==="delete"&&delete l[u];return l}}if(Array.isArray(e)){const l=[...e];return l[a]=Vn(e[a],t,n),l}else if(e!==null&&typeof e=="object"){const l=e[a];return l===void 0?e:It(nt({},e),{[a]:Vn(l,t,n)})}else return e}function $o(e,t){if(e.length!==t.length)return!1;for(let n=0;nObject.prototype.hasOwnProperty.call(t,r)&&Object.is(e[r],t[r]))}function Uo(e,t){if(Object.is(e,t))return!0;const n=Array.isArray(e),r=Array.isArray(t);return n||r?!n||!r?!1:$o(e,t):Do(e,t)}K.ClientMsgCode=vi;K.CrdtType=wi;K.LiveList=Je;K.LiveMap=ot;K.LiveObject=Ke;K.OpCode=yi;K.ServerMsgCode=ki;K.WebsocketCloseCodes=xi;K.asArrayWithLegacyMethods=Ri;K.assertNever=Qe;K.b64decode=Li;K.comparePosition=Oi;K.createClient=Io;K.deprecate=oo;K.deprecateIf=ao;K.errorIf=uo;K.freeze=ze;K.isAppOnlyAuthToken=Ni;K.isAuthToken=io;K.isChildCrdt=Ei;K.isJsonArray=ur;K.isJsonObject=Di;K.isJsonScalar=$i;K.isPlainObject=rt;K.isRoomAuthToken=lr;K.isRootCrdt=bi;K.legacy_patchImmutableObject=Mo;K.lsonToJson=Ue;K.makePosition=Xe;K.nn=ne;K.patchLiveObjectKey=zi;K.shallow=Uo;K.throwUsageError=lo;K.tryParseJson=ar;const Ho=K.ClientMsgCode,zo=K.CrdtType,Vo=K.LiveList,Bo=K.LiveMap,Ko=K.LiveObject,Fo=K.OpCode,jo=K.ServerMsgCode,Xo=K.WebsocketCloseCodes,Yo=K.asArrayWithLegacyMethods,Jo=K.assertNever,Zo=K.b64decode,Wo=K.comparePosition,qo=K.createClient,Go=K.deprecate,Qo=K.deprecateIf,ea=K.errorIf,ta=K.freeze,na=K.isAppOnlyAuthToken,ra=K.isAuthToken,ia=K.isChildCrdt,sa=K.isJsonArray,oa=K.isJsonObject,aa=K.isJsonScalar,la=K.isPlainObject,ua=K.isRoomAuthToken,ca=K.isRootCrdt,fa=K.legacy_patchImmutableObject,ha=K.lsonToJson,da=K.makePosition,pa=K.nn,ma=K.patchLiveObjectKey,_a=K.shallow,ga=K.throwUsageError,va=K.tryParseJson,ya=Object.freeze(Object.defineProperty({__proto__:null,default:K,ClientMsgCode:Ho,CrdtType:zo,LiveList:Vo,LiveMap:Bo,LiveObject:Ko,OpCode:Fo,ServerMsgCode:jo,WebsocketCloseCodes:Xo,asArrayWithLegacyMethods:Yo,assertNever:Jo,b64decode:Zo,comparePosition:Wo,createClient:qo,deprecate:Go,deprecateIf:Qo,errorIf:ea,freeze:ta,isAppOnlyAuthToken:na,isAuthToken:ra,isChildCrdt:ia,isJsonArray:sa,isJsonObject:oa,isJsonScalar:aa,isPlainObject:la,isRoomAuthToken:ua,isRootCrdt:ca,legacy_patchImmutableObject:fa,lsonToJson:ha,makePosition:da,nn:pa,patchLiveObjectKey:ma,shallow:_a,throwUsageError:ga,tryParseJson:va},Symbol.toStringTag,{value:"Module"})),wa=Us(ya);Object.defineProperty(Be,"__esModule",{value:!0});var Kt=wa;Be.LiveList=Kt.LiveList;Be.LiveMap=Kt.LiveMap;Be.LiveObject=Kt.LiveObject;Be.createClient=Kt.createClient;Be.shallow=Kt.shallow;Be.LiveList;Be.LiveMap;const ba=Be.LiveObject,mh=Be.createClient;Be.shallow;const Bi=Symbol(),Ki=Symbol();function Ea(e){let t;const n=e[2].default,r=Gn(n,e,e[1],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),t=!0},p(i,[s]){r&&r.p&&(!t||s&2)&&Qn(r,n,i,i[1],t?tr(n,i[1],s,null):er(i[1]),null)},i(i){t||(J(r,i),t=!0)},o(i){q(r,i),t=!1},d(i){r&&r.d(i)}}}function ka(e,t,n){let{$$slots:r={},$$scope:i}=t,{client:s}=t;if(!s)throw new Error("LiveblocksProvider requires a client");return di(Bi,s),e.$$set=o=>{"client"in o&&n(0,s=o.client),"$$scope"in o&&n(1,i=o.$$scope)},[s,i,r]}class _h extends Ee{constructor(t){super(),ke(this,t,ka,Ea,xe,{client:0})}}function xa(e){let t;const n=e[3].default,r=Gn(n,e,e[2],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),t=!0},p(i,[s]){r&&r.p&&(!t||s&4)&&Qn(r,n,i,i[2],t?tr(n,i[2],s,null):er(i[2]),null)},i(i){t||(J(r,i),t=!0)},o(i){q(r,i),t=!1},d(i){r&&r.d(i)}}}function Ia(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:s}=t,{initialPresence:o={}}=t;if(!s)throw new Error("RoomProvider requires an id");const a=pi(Bi);if(a){const l=a.enter(s,{initialPresence:o});di(Ki,l),Vt(()=>{a.leave(s)})}return e.$$set=l=>{"id"in l&&n(0,s=l.id),"initialPresence"in l&&n(1,o=l.initialPresence),"$$scope"in l&&n(2,i=l.$$scope)},[s,o,i,r]}class gh extends Ee{constructor(t){super(),ke(this,t,Ia,xa,xe,{id:0,initialPresence:1})}}function Oa(e){let t,n,r;return{c(){t=ee("svg"),n=ee("path"),r=ee("path"),this.h()},l(i){t=te(i,"svg",{class:!0,width:!0,height:!0,viewBox:!0,xmlns:!0});var s=I(t);n=te(s,"path",{d:!0,fill:!0}),I(n).forEach(w),r=te(s,"path",{"fill-rule":!0,"clip-rule":!0,d:!0,fill:!0,"fill-opacity":!0}),I(r).forEach(w),s.forEach(w),this.h()},h(){c(n,"d","M3.09022 1.77278C2.25499 1.40456 1.40358 2.25597 1.7718 3.0912L4.57875 9.45818C4.95365 10.3086 6.18455 10.2323 6.4516 9.34213L6.9637 7.63515C7.06029 7.31317 7.31219 7.06126 7.63417 6.96467L9.34117 6.45258C10.2313 6.18552 10.3076 4.95463 9.45722 4.57972L3.09022 1.77278Z"),c(n,"fill",e[1]),c(r,"fill-rule","evenodd"),c(r,"clip-rule","evenodd"),c(r,"d","M3.66305 9.86091L0.856101 3.49392C0.119663 1.82347 1.82248 0.120639 3.49294 0.857077L9.85994 3.66402C11.5607 4.41383 11.4082 6.87562 9.62784 7.40973L7.92085 7.92182L7.40875 9.62881C6.87465 11.4092 4.41286 11.5617 3.66305 9.86091ZM1.77113 3.09053C1.40291 2.2553 2.25432 1.40388 3.08955 1.7721L9.45654 4.57905C10.3069 4.95395 10.2307 6.18485 9.34049 6.4519L7.6335 6.964C7.31152 7.06059 7.05961 7.3125 6.96302 7.63448L6.45093 9.34146C6.18387 10.2316 4.95298 10.3079 4.57807 9.45751L1.77113 3.09053Z"),c(r,"fill",e[1]),c(r,"fill-opacity","0.2"),c(t,"class",e[0]),c(t,"width","1em"),c(t,"height","1em"),c(t,"viewBox","0 0 12 12"),c(t,"xmlns","http://www.w3.org/2000/svg")},m(i,s){re(i,t,s),g(t,n),g(t,r)},p(i,[s]){s&2&&c(n,"fill",i[1]),s&2&&c(r,"fill",i[1]),s&1&&c(t,"class",i[0])},i:me,o:me,d(i){i&&w(t)}}}function Aa(e,t,n){let{classList:r=""}=t,{fill:i=""}=t;return e.$$set=s=>{"classList"in s&&n(0,r=s.classList),"fill"in s&&n(1,i=s.fill)},[r,i]}class Ca extends Ee{constructor(t){super(),ke(this,t,Aa,Oa,xe,{classList:0,fill:1})}}function Sa(e){let t,n,r,i;return n=new Ca({props:{classList:"block z-0 col-span-2 row-span-2 text-8xl",fill:e[1]}}),{c(){t=z("div"),ge(n.$$.fragment),this.h()},l(s){t=V(s,"DIV",{class:!0,style:!0});var o=I(t);ve(n.$$.fragment,o),o.forEach(w),this.h()},h(){c(t,"class","cursor text-4xl svelte-14ka0w3"),c(t,"style",r=`transform: translateX(${e[2].x}px) translateY(${e[2].y}px) scale(${e[0].k});`)},m(s,o){re(s,t,o),ye(n,t,null),i=!0},p(s,[o]){const a={};o&2&&(a.fill=s[1]),n.$set(a),(!i||o&5&&r!==(r=`transform: translateX(${s[2].x}px) translateY(${s[2].y}px) scale(${s[0].k});`))&&c(t,"style",r)},i(s){i||(J(n.$$.fragment,s),i=!0)},o(s){q(n.$$.fragment,s),i=!1},d(s){s&&w(t),we(n)}}}function Pa(e,t,n){let r,{transform:i}=t,{color:s=""}=t,{position:o={x:0,y:0}}=t;return e.$$set=a=>{"transform"in a&&n(0,i=a.transform),"color"in a&&n(1,s=a.color),"position"in a&&n(3,o=a.position)},e.$$.update=()=>{e.$$.dirty&9&&n(2,r={x:i.applyX(o.x),y:i.applyY(o.y)})},[i,s,r,o]}class La extends Ee{constructor(t){super(),ke(this,t,Pa,Sa,xe,{transform:0,color:1,position:3})}}function Ta(e){let t,n,r;return{c(){t=ee("svg"),n=ee("circle"),r=ee("path"),this.h()},l(i){t=te(i,"svg",{class:!0,xmlns:!0,"xmlns:xlink":!0,"aria-hidden":!0,fill:!0,focusable:!0,role:!0,width:!0,height:!0,preserveAspectRatio:!0,viewBox:!0});var s=I(t);n=te(s,"circle",{class:!0,cx:!0,cy:!0,r:!0,stroke:!0,"stroke-width":!0}),I(n).forEach(w),r=te(s,"path",{fill:!0,d:!0}),I(r).forEach(w),s.forEach(w),this.h()},h(){c(n,"class","opacity-50"),c(n,"cx","12"),c(n,"cy","12"),c(n,"r","10"),c(n,"stroke","currentColor"),c(n,"stroke-width","4"),c(r,"fill","currentColor"),c(r,"d","M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"),c(t,"class",e[0]),c(t,"xmlns","http://www.w3.org/2000/svg"),c(t,"xmlns:xlink","http://www.w3.org/1999/xlink"),c(t,"aria-hidden","true"),c(t,"fill","none"),c(t,"focusable","false"),c(t,"role","img"),c(t,"width","1em"),c(t,"height","1em"),c(t,"preserveAspectRatio","xMidYMid meet"),c(t,"viewBox","0 0 24 24")},m(i,s){re(i,t,s),g(t,n),g(t,r)},p(i,[s]){s&1&&c(t,"class",i[0])},i:me,o:me,d(i){i&&w(t)}}}function Na(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class cr extends Ee{constructor(t){super(),ke(this,t,Na,Ta,xe,{classList:0})}}const Jt=["#505669","#414AA6","#1C5B92","#216B44","#893301","#912728","#98184D","#743095","#5F4199","#8f3f94"],cn=20,Mt={width:512*6,height:512*6},Te=32,de=512;function Ma(e){let t,n;return{c(){t=z("p"),n=G("Someone is typing:"),this.h()},l(r){t=V(r,"P",{class:!0});var i=I(t);n=Q(i,"Someone is typing:"),i.forEach(w),this.h()},h(){c(t,"class","text-4xl")},m(r,i){re(r,t,i),g(t,n)},i:me,o:me,d(r){r&&w(t)}}}function Ra(e){let t,n,r,i,s;return t=new cr({props:{classList:"animate-spin text-4xl inline mr-2 mx-auto text-white mb-4"}}),{c(){ge(t.$$.fragment),n=ie(),r=z("p"),i=G("Someone is painting:"),this.h()},l(o){ve(t.$$.fragment,o),n=se(o),r=V(o,"P",{class:!0});var a=I(r);i=Q(a,"Someone is painting:"),a.forEach(w),this.h()},h(){c(r,"class","text-4xl")},m(o,a){ye(t,o,a),re(o,n,a),re(o,r,a),g(r,i),s=!0},i(o){s||(J(t.$$.fragment,o),s=!0)},o(o){q(t.$$.fragment,o),s=!1},d(o){we(t,o),o&&w(n),o&&w(r)}}}function $a(e){let t,n,r,i,s,o,a,l,u,f,h,d;const p=[Ra,Ma],O=[];function E(k,m){return k[2]?0:1}return i=E(e),s=O[i]=p[i](e),{c(){t=z("div"),n=z("div"),r=z("div"),s.c(),o=ie(),a=z("span"),l=G('"'),u=G(e[1]),f=G('"'),this.h()},l(k){t=V(k,"DIV",{class:!0,style:!0});var m=I(t);n=V(m,"DIV",{class:!0});var b=I(n);r=V(b,"DIV",{class:!0});var L=I(r);s.l(L),o=se(L),a=V(L,"SPAN",{class:!0});var v=I(a);l=Q(v,'"'),u=Q(v,e[1]),f=Q(v,'"'),v.forEach(w),L.forEach(w),b.forEach(w),m.forEach(w),this.h()},h(){c(a,"class","italic font-normal"),c(r,"class","font-bold !text-4xl text-white rounded-2xl text-center p-10 line-clamp-4 flex"),c(n,"class","pointer-events-none touch-none"),c(t,"class","absolute top-0 left-0 border-8 border-dashed border-black flex items-center justify-center bg-black/60"),c(t,"style",h=`width: ${de}px; - height: ${de}px; - transform: translateX(${e[3].x}px) translateY(${e[3].y}px) scale(${e[0].k}); transform-origin: 0 0;`)},m(k,m){re(k,t,m),g(t,n),g(n,r),O[i].m(r,null),g(r,o),g(r,a),g(a,l),g(a,u),g(a,f),d=!0},p(k,[m]){let b=i;i=E(k),i!==b&&(Ne(),q(O[b],1,1,()=>{O[b]=null}),Me(),s=O[i],s||(s=O[i]=p[i](k),s.c()),J(s,1),s.m(r,o)),(!d||m&2)&&tt(u,k[1]),(!d||m&9&&h!==(h=`width: ${de}px; - height: ${de}px; - transform: translateX(${k[3].x}px) translateY(${k[3].y}px) scale(${k[0].k}); transform-origin: 0 0;`))&&c(t,"style",h)},i(k){d||(J(s),d=!0)},o(k){q(s),d=!1},d(k){k&&w(t),O[i].d()}}}function Da(e,t,n){let r,{transform:i}=t,{position:s={x:0,y:0}}=t,{prompt:o=""}=t,{isLoading:a=!1}=t;return e.$$set=l=>{"transform"in l&&n(0,i=l.transform),"position"in l&&n(4,s=l.position),"prompt"in l&&n(1,o=l.prompt),"isLoading"in l&&n(2,a=l.isLoading)},e.$$.update=()=>{e.$$.dirty&17&&n(3,r={x:i.applyX(s.x),y:i.applyY(s.y)})},[i,o,a,r,s]}class Ua extends Ee{constructor(t){super(),ke(this,t,Da,$a,xe,{transform:0,position:4,prompt:1,isLoading:2})}}var Ha={value:()=>{}};function bn(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}nn.prototype=bn.prototype={constructor:nn,on:function(e,t){var n=this._,r=za(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s0)for(var n=new Array(i),r=0,i,s;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Pr.hasOwnProperty(t)?{space:Pr[t],local:e}:e}function Ba(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Bn&&t.documentElement.namespaceURI===Bn?t.createElement(e):t.createElementNS(n,e)}}function Ka(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fi(e){var t=En(e);return(t.local?Ka:Ba)(t)}function Fa(){}function fr(e){return e==null?Fa:function(){return this.querySelector(e)}}function ja(e){typeof e!="function"&&(e=fr(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=L&&(L=b+1);!($=k[L])&&++L=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function _l(e){e||(e=gl);function t(h,d){return h&&d?e(h.__data__,d.__data__):!h-!d}for(var n=this._groups,r=n.length,i=new Array(r),s=0;st?1:e>=t?0:NaN}function vl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function yl(){return Array.from(this)}function wl(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Ll:typeof t=="function"?Nl:Tl)(e,t,n==null?"":n)):kt(this.node(),e)}function kt(e,t){return e.style.getPropertyValue(t)||Zi(e).getComputedStyle(e,null).getPropertyValue(t)}function Rl(e){return function(){delete this[e]}}function $l(e,t){return function(){this[e]=t}}function Dl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ul(e,t){return arguments.length>1?this.each((t==null?Rl:typeof t=="function"?Dl:$l)(e,t)):this.node()[e]}function Wi(e){return e.trim().split(/^|\s+/)}function hr(e){return e.classList||new qi(e)}function qi(e){this._node=e,this._names=Wi(e.getAttribute("class")||"")}qi.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 Gi(e,t){for(var n=hr(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function hu(e){return function(){var t=this.__on;if(!!t){for(var n=0,r=-1,i=t.length,s;n()=>e;function Kn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:o,y:a,dx:l,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}Kn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Eu(e){return!e.ctrlKey&&!e.button}function ku(){return this.parentNode}function xu(e,t){return t==null?{x:e.x,y:e.y}:t}function Iu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lr(){var e=Eu,t=ku,n=xu,r=Iu,i={},s=bn("start","drag","end"),o=0,a,l,u,f,h=0;function d(v){v.on("mousedown.drag",p).filter(r).on("touchstart.drag",k).on("touchmove.drag",m,bu).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(v,$){if(!(f||!e.call(this,v,$))){var A=L(this,t.call(this,v,$),v,$,"mouse");!A||($e(v.view).on("mousemove.drag",O,Rt).on("mouseup.drag",E,Rt),ns(v.view),Rn(v),u=!1,a=v.clientX,l=v.clientY,A("start",v))}}function O(v){if(wt(v),!u){var $=v.clientX-a,A=v.clientY-l;u=$*$+A*A>h}i.mouse("drag",v)}function E(v){$e(v.view).on("mousemove.drag mouseup.drag",null),rs(v.view,u),wt(v),i.mouse("end",v)}function k(v,$){if(!!e.call(this,v,$)){var A=v.changedTouches,R=t.call(this,v,$),H=A.length,N,U;for(N=0;N{const n=new Image;n.onload=async()=>{const r=n.width,i=n.height,s=document.createElement("canvas");s.width=r,s.height=i,s.getContext("2d").drawImage(n,0,0,r,i);const a=await new Promise(l=>s.toBlob(l,"image/jpeg",.95));t(a)},n.src=e})}async function Su(e,t,n){const r=Lu(t),s=`color-palette-${crypto.randomUUID().split("-")[0]}-${r}-${n}.jpeg`,o=new File([e],s,{type:"image/jpeg"}),a=new FormData;return a.append("file",o),await(await fetch(is+"/uploadfile",{method:"POST",body:a})).json()}const Pu=Mt.width-de;function Wt(e){const t=e%Te{n(s)});return Vt(()=>{i()}),{subscribe:t,update:r}}function Tu(){const e=kn(),t=Ve(),n=e.subscribe("others",r=>{t.set(r)});return Vt(n),t}function Nu(){const e=kn(),t=Ve();async function n(){const{root:r}=await e.getStorage();t.set(r)}return n(),t}function ss(e,t){const n=kn(),r=Nu(),i=Ve();let s=()=>{};const o=r.subscribe(a=>{!a||(a.get(e)||a.set(e,new ba(t)),i.set(a.get(e)),s(),s=n.subscribe(a.get(e),l=>{i.set(l)}))});return Vt(o),i}const Mu=3e3;function Ru(){const e=Ve([]),t=setInterval(()=>{$u().then(n=>e.set(n))},Mu);return Vt(()=>{clearInterval(t)}),e}async function $u(){return fetch(is+"/rooms").then(e=>e.json())}function dr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function os(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function jt(){}var $t=.7,hn=1/$t,bt="\\s*([+-]?\\d+)\\s*",Dt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Du=/^#([0-9a-f]{3,8})$/,Uu=new RegExp(`^rgb\\(${bt},${bt},${bt}\\)$`),Hu=new RegExp(`^rgb\\(${Ye},${Ye},${Ye}\\)$`),zu=new RegExp(`^rgba\\(${bt},${bt},${bt},${Dt}\\)$`),Vu=new RegExp(`^rgba\\(${Ye},${Ye},${Ye},${Dt}\\)$`),Bu=new RegExp(`^hsl\\(${Dt},${Ye},${Ye}\\)$`),Ku=new RegExp(`^hsla\\(${Dt},${Ye},${Ye},${Dt}\\)$`),Tr={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};dr(jt,Ut,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Nr,formatHex:Nr,formatHex8:Fu,formatHsl:ju,formatRgb:Mr,toString:Mr});function Nr(){return this.rgb().formatHex()}function Fu(){return this.rgb().formatHex8()}function ju(){return as(this).formatHsl()}function Mr(){return this.rgb().formatRgb()}function Ut(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Du.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Rr(t):n===3?new Le(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?qt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?qt(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=Uu.exec(e))?new Le(t[1],t[2],t[3],1):(t=Hu.exec(e))?new Le(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=zu.exec(e))?qt(t[1],t[2],t[3],t[4]):(t=Vu.exec(e))?qt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Bu.exec(e))?Ur(t[1],t[2]/100,t[3]/100,1):(t=Ku.exec(e))?Ur(t[1],t[2]/100,t[3]/100,t[4]):Tr.hasOwnProperty(e)?Rr(Tr[e]):e==="transparent"?new Le(NaN,NaN,NaN,0):null}function Rr(e){return new Le(e>>16&255,e>>8&255,e&255,1)}function qt(e,t,n,r){return r<=0&&(e=t=n=NaN),new Le(e,t,n,r)}function Xu(e){return e instanceof jt||(e=Ut(e)),e?(e=e.rgb(),new Le(e.r,e.g,e.b,e.opacity)):new Le}function Fn(e,t,n,r){return arguments.length===1?Xu(e):new Le(e,t,n,r==null?1:r)}function Le(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}dr(Le,Fn,os(jt,{brighter(e){return e=e==null?hn:Math.pow(hn,e),new Le(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?$t:Math.pow($t,e),new Le(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Le(dt(this.r),dt(this.g),dt(this.b),dn(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:$r,formatHex:$r,formatHex8:Yu,formatRgb:Dr,toString:Dr}));function $r(){return`#${ct(this.r)}${ct(this.g)}${ct(this.b)}`}function Yu(){return`#${ct(this.r)}${ct(this.g)}${ct(this.b)}${ct((isNaN(this.opacity)?1:this.opacity)*255)}`}function Dr(){const e=dn(this.opacity);return`${e===1?"rgb(":"rgba("}${dt(this.r)}, ${dt(this.g)}, ${dt(this.b)}${e===1?")":`, ${e})`}`}function dn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function dt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ct(e){return e=dt(e),(e<16?"0":"")+e.toString(16)}function Ur(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new He(e,t,n,r)}function as(e){if(e instanceof He)return new He(e.h,e.s,e.l,e.opacity);if(e instanceof jt||(e=Ut(e)),!e)return new He;if(e instanceof He)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(t===s?o=(n-r)/a+(n0&&l<1?0:o,new He(o,a,l,e.opacity)}function Ju(e,t,n,r){return arguments.length===1?as(e):new He(e,t,n,r==null?1:r)}function He(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}dr(He,Ju,os(jt,{brighter(e){return e=e==null?hn:Math.pow(hn,e),new He(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?$t:Math.pow($t,e),new He(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,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Le($n(e>=240?e-240:e+120,i,r),$n(e,i,r),$n(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new He(Hr(this.h),Gt(this.s),Gt(this.l),dn(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=dn(this.opacity);return`${e===1?"hsl(":"hsla("}${Hr(this.h)}, ${Gt(this.s)*100}%, ${Gt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hr(e){return e=(e||0)%360,e<0?e+360:e}function Gt(e){return Math.max(0,Math.min(1,e||0))}function $n(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 ls=e=>()=>e;function Zu(e,t){return function(n){return e+n*t}}function Wu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function qu(e){return(e=+e)==1?us:function(t,n){return n-t?Wu(t,n,e):ls(isNaN(t)?n:t)}}function us(e,t){var n=t-e;return n?Zu(e,n):ls(isNaN(e)?t:e)}const zr=function e(t){var n=qu(t);function r(i,s){var o=n((i=Fn(i)).r,(s=Fn(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),u=us(i.opacity,s.opacity);return function(f){return i.r=o(f),i.g=a(f),i.b=l(f),i.opacity=u(f),i+""}}return r.gamma=e,r}(1);function lt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var jn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Dn=new RegExp(jn.source,"g");function Gu(e){return function(){return e}}function Qu(e){return function(t){return e(t)+""}}function ec(e,t){var n=jn.lastIndex=Dn.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(e=e+"",t=t+"";(r=jn.exec(e))&&(i=Dn.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:lt(r,i)})),n=Dn.lastIndex;return n180?f+=360:f-u>180&&(u+=360),d.push({i:h.push(i(h)+"rotate(",null,r)-2,x:lt(u,f)})):f&&h.push(i(h)+"rotate("+f+r)}function a(u,f,h,d){u!==f?d.push({i:h.push(i(h)+"skewX(",null,r)-2,x:lt(u,f)}):f&&h.push(i(h)+"skewX("+f+r)}function l(u,f,h,d,p,O){if(u!==h||f!==d){var E=p.push(i(p)+"scale(",null,",",null,")");O.push({i:E-4,x:lt(u,h)},{i:E-2,x:lt(f,d)})}else(h!==1||d!==1)&&p.push(i(p)+"scale("+h+","+d+")")}return function(u,f){var h=[],d=[];return u=e(u),f=e(f),s(u.translateX,u.translateY,f.translateX,f.translateY,h,d),o(u.rotate,f.rotate,h,d),a(u.skewX,f.skewX,h,d),l(u.scaleX,u.scaleY,f.scaleX,f.scaleY,h,d),u=f=null,function(p){for(var O=-1,E=d.length,k;++O=0&&e._call.call(void 0,t),e=e._next;--xt}function Kr(){_t=(mn=Ht.now())+In,xt=Tt=0;try{cc()}finally{xt=0,hc(),_t=0}}function fc(){var e=Ht.now(),t=e-mn;t>hs&&(In-=t,mn=e)}function hc(){for(var e,t=pn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:pn=n);Nt=e,Yn(r)}function Yn(e){if(!xt){Tt&&(Tt=clearTimeout(Tt));var t=e-_t;t>24?(e<1/0&&(Tt=setTimeout(Kr,e-Ht.now()-In)),St&&(St=clearInterval(St))):(St||(mn=Ht.now(),St=setInterval(fc,hs)),xt=1,ds(Kr))}}function Fr(e,t,n){var r=new _n;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var dc=bn("start","end","cancel","interrupt"),pc=[],ms=0,jr=1,Jn=2,rn=3,Xr=4,Zn=5,sn=6;function On(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;mc(e,n,{name:t,index:r,group:i,on:dc,tween:pc,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:ms})}function mr(e,t){var n=Fe(e,t);if(n.state>ms)throw new Error("too late; already scheduled");return n}function Ze(e,t){var n=Fe(e,t);if(n.state>rn)throw new Error("too late; already running");return n}function Fe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function mc(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ps(s,0,n.time);function s(u){n.state=jr,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var f,h,d,p;if(n.state!==jr)return l();for(f in r)if(p=r[f],p.name===n.name){if(p.state===rn)return Fr(o);p.state===Xr?(p.state=sn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[f]):+fJn&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function jc(e,t,n){var r,i,s=Fc(t)?mr:Ze;return function(){var o=s(this,e),a=o.on;a!==r&&(i=(r=a).copy()).on(t,n),o.on=i}}function Xc(e,t){var n=this._id;return arguments.length<2?Fe(this.node(),n).on.on(e):this.each(jc(n,e,t))}function Yc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Jc(){return this.on("end.remove",Yc(this._id))}function Zc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=fr(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o()=>e;function bf(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:r,enumerable:!0,configurable:!0},_:{value:i}})}function et(e,t,n){this.k=e,this.x=t,this.y=n}et.prototype={constructor:et,scale:function(e){return e===1?this:new et(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new et(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 zt=new et(1,0,0);et.prototype;function Un(e){e.stopImmediatePropagation()}function Pt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ef(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function kf(){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 Yr(){return this.__zoom||zt}function xf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function If(){return navigator.maxTouchPoints||"ontouchstart"in this}function Of(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function Af(){var e=Ef,t=kf,n=Of,r=xf,i=If,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=lc,u=bn("start","zoom","end"),f,h,d,p=500,O=150,E=0,k=10;function m(y){y.property("__zoom",Yr).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",U).filter(i).on("touchstart.zoom",X).on("touchmove.zoom",Z).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,x,C,S){var T=y.selection?y.selection():y;T.property("__zoom",Yr),y!==T?$(y,x,C,S):T.interrupt().each(function(){A(this,arguments).event(S).start().zoom(null,typeof x=="function"?x.apply(this,arguments):x).end()})},m.scaleBy=function(y,x,C,S){m.scaleTo(y,function(){var T=this.__zoom.k,j=typeof x=="function"?x.apply(this,arguments):x;return T*j},C,S)},m.scaleTo=function(y,x,C,S){m.transform(y,function(){var T=t.apply(this,arguments),j=this.__zoom,D=C==null?v(T):typeof C=="function"?C.apply(this,arguments):C,W=j.invert(D),oe=typeof x=="function"?x.apply(this,arguments):x;return n(L(b(j,oe),D,W),T,o)},C,S)},m.translateBy=function(y,x,C,S){m.transform(y,function(){return n(this.__zoom.translate(typeof x=="function"?x.apply(this,arguments):x,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),o)},null,S)},m.translateTo=function(y,x,C,S,T){m.transform(y,function(){var j=t.apply(this,arguments),D=this.__zoom,W=S==null?v(j):typeof S=="function"?S.apply(this,arguments):S;return n(zt.translate(W[0],W[1]).scale(D.k).translate(typeof x=="function"?-x.apply(this,arguments):-x,typeof C=="function"?-C.apply(this,arguments):-C),j,o)},S,T)};function b(y,x){return x=Math.max(s[0],Math.min(s[1],x)),x===y.k?y:new et(x,y.x,y.y)}function L(y,x,C){var S=x[0]-C[0]*y.k,T=x[1]-C[1]*y.k;return S===y.x&&T===y.y?y:new et(y.k,S,T)}function v(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function $(y,x,C,S){y.on("start.zoom",function(){A(this,arguments).event(S).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(S).end()}).tween("zoom",function(){var T=this,j=arguments,D=A(T,j).event(S),W=t.apply(T,j),oe=C==null?v(W):typeof C=="function"?C.apply(T,j):C,le=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),ae=T.__zoom,pe=typeof x=="function"?x.apply(T,j):x,Ae=l(ae.invert(oe).concat(le/ae.k),pe.invert(oe).concat(le/pe.k));return function(be){if(be===1)be=pe;else{var _e=Ae(be),at=le/_e[2];be=new et(at,oe[0]-_e[0]*at,oe[1]-_e[1]*at)}D.zoom(null,be)}})}function A(y,x,C){return!C&&y.__zooming||new R(y,x)}function R(y,x){this.that=y,this.args=x,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,x),this.taps=0}R.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,x){return this.mouse&&y!=="mouse"&&(this.mouse[1]=x.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=x.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=x.invert(this.touch1[0])),this.that.__zoom=x,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var x=$e(this.that).datum();u.call(y,this.that,new bf(y,{sourceEvent:this.sourceEvent,target:m,type:y,transform:this.that.__zoom,dispatch:u}),x)}};function H(y,...x){if(!e.apply(this,arguments))return;var C=A(this,x).event(y),S=this.__zoom,T=Math.max(s[0],Math.min(s[1],S.k*Math.pow(2,r.apply(this,arguments)))),j=Ge(y);if(C.wheel)(C.mouse[0][0]!==j[0]||C.mouse[0][1]!==j[1])&&(C.mouse[1]=S.invert(C.mouse[0]=j)),clearTimeout(C.wheel);else{if(S.k===T)return;C.mouse=[j,S.invert(j)],on(this),C.start()}Pt(y),C.wheel=setTimeout(D,O),C.zoom("mouse",n(L(b(S,T),C.mouse[0],C.mouse[1]),C.extent,o));function D(){C.wheel=null,C.end()}}function N(y,...x){if(d||!e.apply(this,arguments))return;var C=y.currentTarget,S=A(this,x,!0).event(y),T=$e(y.view).on("mousemove.zoom",oe,!0).on("mouseup.zoom",le,!0),j=Ge(y,C),D=y.clientX,W=y.clientY;ns(y.view),Un(y),S.mouse=[j,this.__zoom.invert(j)],on(this),S.start();function oe(ae){if(Pt(ae),!S.moved){var pe=ae.clientX-D,Ae=ae.clientY-W;S.moved=pe*pe+Ae*Ae>E}S.event(ae).zoom("mouse",n(L(S.that.__zoom,S.mouse[0]=Ge(ae,C),S.mouse[1]),S.extent,o))}function le(ae){T.on("mousemove.zoom mouseup.zoom",null),rs(ae.view,S.moved),Pt(ae),S.event(ae).end()}}function U(y,...x){if(!!e.apply(this,arguments)){var C=this.__zoom,S=Ge(y.changedTouches?y.changedTouches[0]:y,this),T=C.invert(S),j=C.k*(y.shiftKey?.5:2),D=n(L(b(C,j),S,T),t.apply(this,x),o);Pt(y),a>0?$e(this).transition().duration(a).call($,D,S,y):$e(this).call(m.transform,D,S,y)}}function X(y,...x){if(!!e.apply(this,arguments)){var C=y.touches,S=C.length,T=A(this,x,y.changedTouches.length===S).event(y),j,D,W,oe;for(Un(y),D=0;D(e.ready="ready",e.loading="loading",e.prompting="prompting",e.processing="processing",e.dragging="dragging",e.masking="masking",e))(he||{});function Wr(e){let t,n;return t=new cr({props:{classList:"absolute inset-0 m-auto animate-spin text-6xl text-black"}}),{c(){ge(t.$$.fragment)},l(r){ve(t.$$.fragment,r)},m(r,i){ye(t,r,i),n=!0},i(r){n||(J(t.$$.fragment,r),n=!0)},o(r){q(t.$$.fragment,r),n=!1},d(r){we(t,r)}}}function qr(e){let t,n;return{c(){t=z("div"),this.h()},l(r){t=V(r,"DIV",{class:!0}),I(t).forEach(w),this.h()},h(){c(t,"class",n="absolute inset-0 bg-gradient-to-t "+(e[4]?"from-blue-700/40":"from-blue-700/90")+" to-blue-500/10")},m(r,i){re(r,t,i)},p(r,i){i&16&&n!==(n="absolute inset-0 bg-gradient-to-t "+(r[4]?"from-blue-700/40":"from-blue-700/90")+" to-blue-500/10")&&c(t,"class",n)},d(r){r&&w(t)}}}function Gr(e){let t,n,r;return{c(){t=z("div"),n=z("div"),r=G(e[7]),this.h()},l(i){t=V(i,"DIV",{class:!0});var s=I(t);n=V(s,"DIV",{class:!0});var o=I(n);r=Q(o,e[7]),o.forEach(w),s.forEach(w),this.h()},h(){c(n,"class","font-bold text-4xl text-[#387CFF] text-center px-2 line-clamp-4"),c(t,"class","pointer-events-none touch-none")},m(i,s){re(i,t,s),g(t,n),g(n,r)},p(i,s){s&128&&tt(r,i[7])},d(i){i&&w(t)}}}function Cf(e){let t,n=e[1]?"\u{1F91A} Drag me":"\u{1F91A} Enable Drag",r;return{c(){t=z("span"),r=G(n),this.h()},l(i){t=V(i,"SPAN",{class:!0});var s=I(t);r=Q(s,n),s.forEach(w),this.h()},h(){c(t,"class","select-none")},m(i,s){re(i,t,s),g(t,r)},p(i,s){s&2&&n!==(n=i[1]?"\u{1F91A} Drag me":"\u{1F91A} Enable Drag")&&tt(r,n)},d(i){i&&w(t)}}}function Sf(e){let t,n,r,i,s,o=e[9]==="NFSW"&&Qr();return{c(){t=z("div"),o&&o.c(),n=ie(),r=z("p"),i=G(e[9]),s=G("..."),this.h()},l(a){t=V(a,"DIV",{class:!0});var l=I(t);o&&o.l(l),n=se(l),r=V(l,"P",{});var u=I(r);i=Q(u,e[9]),s=Q(u,"..."),u.forEach(w),l.forEach(w),this.h()},h(){c(t,"class","")},m(a,l){re(a,t,l),o&&o.m(t,null),g(t,n),g(t,r),g(r,i),g(r,s)},p(a,l){a[9]==="NFSW"?o||(o=Qr(),o.c(),o.m(t,n)):o&&(o.d(1),o=null),l&512&&tt(i,a[9])},d(a){a&&w(t),o&&o.d()}}}function Qr(e){let t,n,r,i,s;return{c(){t=z("h2"),n=G("NSFW Alert"),r=ie(),i=z("h3"),s=G("Possible NSFW result detected, please try again"),this.h()},l(o){t=V(o,"H2",{class:!0});var a=I(t);n=Q(a,"NSFW Alert"),a.forEach(w),r=se(o),i=V(o,"H3",{class:!0});var l=I(i);s=Q(l,"Possible NSFW result detected, please try again"),l.forEach(w),this.h()},h(){c(t,"class","text-red-500 text-2xl font-bold"),c(i,"class","text-red-500 text-lg")},m(o,a){re(o,t,a),g(t,n),re(o,r,a),re(o,i,a),g(i,s)},d(o){o&&w(t),o&&w(r),o&&w(i)}}}function ei(e){let t,n,r,i,s,o,a,l,u;return{c(){t=z("div"),n=z("button"),r=G("\u{1F58D}"),i=ie(),s=z("button"),o=ee("svg"),a=ee("path"),this.h()},l(f){t=V(f,"DIV",{class:!0});var h=I(t);n=V(h,"BUTTON",{class:!0});var d=I(n);r=Q(d,"\u{1F58D}"),d.forEach(w),i=se(h),s=V(h,"BUTTON",{class:!0});var p=I(s);o=te(p,"svg",{class:!0,width:!0,height:!0,viewBox:!0});var O=I(o);a=te(O,"path",{fill:!0,d:!0,color:!0}),I(a).forEach(w),O.forEach(w),p.forEach(w),h.forEach(w),this.h()},h(){c(n,"class","w-10 h-10 bg-blue-600 hover:saturate-150 shadow-2xl shadow-blue-500 rounded-lg flex items-center justify-center text-3xl"),c(a,"fill","currentColor"),c(a,"d","m65.453 10.826l-.053 5c3.073.034 6.144.549 9.059 1.52l1.58-4.744a34.758 34.758 0 0 0-10.586-1.776zm-5.365.352a35.131 35.131 0 0 0-10.26 3.119l2.17 4.506a30.166 30.166 0 0 1 8.799-2.674l-.71-4.951zm20.908 3.51l-2.283 4.447a30.131 30.131 0 0 1 7.447 5.394l3.522-3.549a35.101 35.101 0 0 0-8.686-6.293zM35 19.125c-19.3 0-35 15.7-35 35s15.7 35 35 35c8.934 0 17.087-3.374 23.275-8.904c.005 0 .01 0 .014.002c.065-.059.127-.121.191-.18l.125-.115a34.677 34.677 0 0 0 2.461-2.496c.083-.092.167-.183.248-.276c.399-.455.79-.919 1.165-1.394c-.482-.04-.961-.092-1.436-.155c-.318-.041-.632-.094-.947-.146c-.158-.026-.316-.046-.473-.074a29.93 29.93 0 0 1-1.383-.283a29.851 29.851 0 0 1-1.183-.301c-.065-.018-.13-.033-.194-.051C44.234 71.216 35 59.651 35 45.875a29.876 29.876 0 0 1 9.557-21.955c.162-.151.324-.302.49-.45c.249-.22.504-.436.76-.65c.158-.131.313-.266.474-.394c.415-.332.837-.656 1.27-.965a35.075 35.075 0 0 0-2.867-.965l-.03-.008c-.287-.082-.577-.155-.867-.23c-.215-.056-.43-.118-.646-.17c-.349-.084-.701-.155-1.053-.229c-.126-.026-.25-.057-.377-.082l-.002.002A34.83 34.83 0 0 0 35 19.125zm58.2 5.928l-4.028 2.967a30.012 30.012 0 0 1 4.252 8.15l4.736-1.606a34.98 34.98 0 0 0-4.96-9.511zm6.294 14.717l-4.924.87c.536 3.029.603 6.145.194 9.19l4.955.666c.48-3.562.4-7.19-.225-10.726zM93.8 54.338a30.198 30.198 0 0 1-3.936 8.314l4.143 2.801a35.162 35.162 0 0 0 4.586-9.695l-4.793-1.42zm-6.803 11.928a29.79 29.79 0 0 1-7.213 5.687l2.451 4.358a34.776 34.776 0 0 0 8.428-6.647l-3.666-3.398zm-11.394 7.638a30.155 30.155 0 0 1-9.002 1.887l.265 4.992a35.12 35.12 0 0 0 10.498-2.199l-1.761-4.68z"),c(a,"color","currentColor"),c(o,"class","text-white"),c(o,"width","1em"),c(o,"height","1em"),c(o,"viewBox","0 0 100 100"),c(s,"class","w-10 h-10 bg-blue-600 hover:saturate-150 shadow-2xl shadow-blue-500 rounded-lg flex items-center justify-center text-3xl"),c(t,"class","mx-4 flex flex-col gap-2")},m(f,h){re(f,t,h),g(t,n),g(n,r),g(t,i),g(t,s),g(s,o),g(o,a),l||(u=[De(n,"click",e[17]),De(s,"click",e[13])],l=!0)},p:me,d(f){f&&w(t),l=!1,mi(u)}}}function Pf(e){var C;let t,n,r,i,s,o,a,l,u,f,h,d,p,O,E,k,m,b,L,v,$,A,R,H,N=e[5]&&Wr(),U=((C=e[2])==null?void 0:C.status)!=="masking"&&qr(e),X=e[7]&&Gr(e);function Z(S,T){return S[9]!==""?Sf:Cf}let F=Z(e),y=F(e),x=!e[5]&&ei(e);return{c(){t=z("div"),n=z("div"),r=z("div"),N&&N.c(),i=ie(),U&&U.c(),s=ie(),o=z("canvas"),l=ie(),u=z("div"),X&&X.c(),f=ie(),h=z("div"),d=z("div"),y.c(),O=ie(),E=z("div"),x&&x.c(),b=ie(),L=z("div"),this.h()},l(S){t=V(S,"DIV",{});var T=I(t);n=V(T,"DIV",{class:!0,style:!0});var j=I(n);r=V(j,"DIV",{class:!0,style:!0});var D=I(r);N&&N.l(D),i=se(D),U&&U.l(D),s=se(D),o=V(D,"CANVAS",{class:!0,width:!0,height:!0}),I(o).forEach(w),l=se(D),u=V(D,"DIV",{class:!0});var W=I(u);X&&X.l(W),W.forEach(w),f=se(D),h=V(D,"DIV",{class:!0,style:!0});var oe=I(h);d=V(oe,"DIV",{class:!0});var le=I(d);y.l(le),le.forEach(w),oe.forEach(w),O=se(D),E=V(D,"DIV",{class:!0,style:!0});var ae=I(E);x&&x.l(ae),ae.forEach(w),D.forEach(w),j.forEach(w),b=se(T),L=V(T,"DIV",{class:!0,style:!0}),I(L).forEach(w),T.forEach(w),this.h()},h(){c(o,"class",a=e[1]?"":"bg-white"),c(o,"width",de),c(o,"height",de),c(u,"class","pointer-events-none touch-none"),c(d,"class","pl-3 pr-5 py-1 bg-blue-700/90 text-white text-lg xl:text-2xl rounded-tr-xl font-medium tracking-wide cursor-pointer"),c(h,"class","absolute bottom-0 origin-bottom-left"),c(h,"style",p=`transform: scale(${Math.max(2.5-e[0].k,1)});`),c(E,"class","absolute left-full"),c(E,"style",k=`transform: scale(${Math.max(2.5-e[0].k,1)}); transform-origin: 0 0;`),c(r,"class","frame relative svelte-1wvt719"),c(r,"style",`width: ${de}px;height: ${de}px;`),c(n,"class","absolute top-0 left-0 pen"),c(n,"style",m=`transform: translateX(${e[6].x}px) translateY(${e[6].y}px) scale(${e[0].k}); transform-origin: 0 0;`),c(L,"class",v="absolute top-0 left-0 ring-8 hand "+(e[1]?"block cursor-move":"hidden cursor-pointer")),c(L,"style",$=`width: ${de}px;height: ${de}px;transform: translateX(${e[6].x}px) translateY(${e[6].y}px) scale(${e[0].k}); transform-origin: 0 0;`)},m(S,T){re(S,t,T),g(t,n),g(n,r),N&&N.m(r,null),g(r,i),U&&U.m(r,null),g(r,s),g(r,o),e[15](o),g(r,l),g(r,u),X&&X.m(u,null),g(r,f),g(r,h),g(h,d),y.m(d,null),g(r,O),g(r,E),x&&x.m(E,null),g(t,b),g(t,L),e[18](L),A=!0,R||(H=De(d,"click",e[16]),R=!0)},p(S,[T]){var j;S[5]?N?T&32&&J(N,1):(N=Wr(),N.c(),J(N,1),N.m(r,i)):N&&(Ne(),q(N,1,1,()=>{N=null}),Me()),((j=S[2])==null?void 0:j.status)!=="masking"?U?U.p(S,T):(U=qr(S),U.c(),U.m(r,s)):U&&(U.d(1),U=null),(!A||T&2&&a!==(a=S[1]?"":"bg-white"))&&c(o,"class",a),S[7]?X?X.p(S,T):(X=Gr(S),X.c(),X.m(u,null)):X&&(X.d(1),X=null),F===(F=Z(S))&&y?y.p(S,T):(y.d(1),y=F(S),y&&(y.c(),y.m(d,null))),(!A||T&1&&p!==(p=`transform: scale(${Math.max(2.5-S[0].k,1)});`))&&c(h,"style",p),S[5]?x&&(x.d(1),x=null):x?x.p(S,T):(x=ei(S),x.c(),x.m(E,null)),(!A||T&1&&k!==(k=`transform: scale(${Math.max(2.5-S[0].k,1)}); transform-origin: 0 0;`))&&c(E,"style",k),(!A||T&65&&m!==(m=`transform: translateX(${S[6].x}px) translateY(${S[6].y}px) scale(${S[0].k}); transform-origin: 0 0;`))&&c(n,"style",m),(!A||T&2&&v!==(v="absolute top-0 left-0 ring-8 hand "+(S[1]?"block cursor-move":"hidden cursor-pointer")))&&c(L,"class",v),(!A||T&65&&$!==($=`width: ${de}px;height: ${de}px;transform: translateX(${S[6].x}px) translateY(${S[6].y}px) scale(${S[0].k}); transform-origin: 0 0;`))&&c(L,"style",$)},i(S){A||(J(N),A=!0)},o(S){q(N),A=!1},d(S){S&&w(t),N&&N.d(),U&&U.d(),e[15](null),X&&X.d(),y.d(),x&&x.d(),e[18](null),R=!1,H()}}}function Lf(e,t,n){let r,i,s,o,a,l,u;Oe(e,an,x=>n(22,o=x)),Oe(e,qn,x=>n(8,a=x)),Oe(e,Pe,x=>n(9,u=x));const f=xn();Oe(e,f,x=>n(2,l=x));const h=nr();let{transform:d}=t,p,O={x:Mt.width/2-de/2,y:Mt.height/2-de/2},E,k=!0,m=!1,b=0,L=0;function v(x){p.save(),p.clearRect(0,0,de,de),p.globalCompositeOperation="source-over",p.drawImage(o,x.x,x.y,de,de,0,0,de,de),p.restore()}function $(x){p.save(),p.globalCompositeOperation="destination-out",p.beginPath(),p.moveTo(x.lastx,x.lasty),p.lineTo(x.x,x.y),p.lineWidth=50,p.lineCap="round",p.strokeStyle="black",p.stroke(),p.restore()}Bt(()=>{p=a.getContext("2d"),$e(E).on("wheel",x=>{o.dispatchEvent(new WheelEvent("wheel",x))}).call(H()).call(A),$e(a).on("wheel",x=>{o.dispatchEvent(new WheelEvent("wheel",x))}).call(R()).call(A)});function A(x){function C(T){f.update({cursor:{x:d.invertX(T.clientX),y:d.invertY(T.clientY)}})}function S(){f.update({cursor:null})}return x.on("pointermove",C).on("pointerleave",S)}function R(){let x,C;function S(j){if(i)return;const D=j.x/d.k,W=j.y/d.k;x=D,C=W}function T(j){if(i)return;const D=j.x/d.k,W=j.y/d.k;$({x:D,y:W,lastx:x,lasty:C}),x=D,C=W}return Lr().on("start",S).on("drag",T)}function H(){function x(T){if(i)return;const j=T.sourceEvent.target.getBoundingClientRect();typeof TouchEvent<"u"&&T.sourceEvent instanceof TouchEvent?(b=T.sourceEvent.targetTouches[0].pageX-j.left,L=T.sourceEvent.targetTouches[0].pageY-j.top):T.sourceEvent instanceof MouseEvent&&(b=T.sourceEvent.pageX-j.left,L=T.sourceEvent.pageY-j.top),n(4,m=!0)}function C(T){if(i)return;const j=Wt(d.invertX(T.x-b)),D=Wt(d.invertY(T.y-L));n(14,O={x:j,y:D}),f.update({cursor:{x:d.invertX(T.x),y:d.invertY(T.y)}}),v({x:j,y:D})}function S(T){if(i)return;n(4,m=!1);const j=Wt(d.invertX(T.x-b)),D=Wt(d.invertY(T.y-L));v({x:j,y:D}),f.update({frame:{x:j,y:D}})}return Lr().on("start",x).on("drag",C).on("end",S)}function N(){n(1,k=!0),f.update({status:he.dragging})}function U(){n(1,k=!1),v(O),f.update({status:he.masking})}function X(x){pt[x?"unshift":"push"](()=>{a=x,qn.set(a)})}const Z=()=>N(),F=()=>h("prompt");function y(x){pt[x?"unshift":"push"](()=>{E=x,n(3,E)})}return e.$$set=x=>{"transform"in x&&n(0,d=x.transform)},e.$$.update=()=>{e.$$.dirty&4&&n(7,r=l==null?void 0:l.currentPrompt),e.$$.dirty&4&&n(5,i=(l==null?void 0:l.status)===he.loading||(l==null?void 0:l.status)===he.prompting||!1),e.$$.dirty&6&&!k&&l.status===he.loading&&n(1,k=!0),e.$$.dirty&16385&&n(6,s={x:d.applyX(O.x),y:d.applyY(O.y)})},[d,k,l,E,m,i,s,r,a,u,f,h,N,U,O,X,Z,F,y]}class Tf extends Ee{constructor(t){super(),ke(this,t,Lf,Pf,xe,{transform:0})}}function Nf(e){let t,n,r,i;const s=e[8].default,o=Gn(s,e,e[7],null);return{c(){t=z("div"),n=z("canvas"),r=ie(),o&&o.c(),this.h()},l(a){t=V(a,"DIV",{class:!0});var l=I(t);n=V(l,"CANVAS",{width:!0,height:!0,class:!0}),I(n).forEach(w),r=se(l),o&&o.l(l),l.forEach(w),this.h()},h(){c(n,"width",e[4]),c(n,"height",e[3]),c(n,"class","absolute top-0 left-0 bg-white shadow-2xl svelte-6dcxg7"),c(t,"class","absolute top-0 left-0 right-0 bottom-0 overflow-hidden z-0 bg-gray-200")},m(a,l){re(a,t,l),g(t,n),e[9](n),g(t,r),o&&o.m(t,null),e[10](t),i=!0},p(a,[l]){o&&o.p&&(!i||l&128)&&Qn(o,s,a,a[7],i?tr(s,a[7],l,null):er(a[7]),null)},i(a){i||(J(o,a),i=!0)},o(a){q(o,a),i=!1},d(a){a&&w(t),e[9](null),o&&o.d(a),e[10](null)}}}function Mf(e,t,n){let r,i,s;Oe(e,Wn,R=>n(12,r=R)),Oe(e,an,R=>n(1,i=R));let{$$slots:o={},$$scope:a}=t;const l=xn(),u=ss("promptImgStorage");Oe(e,u,R=>n(6,s=R));const f=Mt.height,h=Mt.width;let d,p;const O=new Set;function E(R){if(R){const H=new Map;for(const Z of Array.from(Array(h/Te).keys()))for(const F of Array.from(Array(f/Te).keys()))H.set(`${Z*Te}_${F*Te}`,null);const N=Object.values(R).sort((Z,F)=>F.date-Z.date);for(const Z of N){const F=Z.position.x,y=Z.position.y;for(const x of[...Array(de/Te).keys()])for(const C of[...Array(de/Te).keys()]){const S=`${F+x*Te}_${y+C*Te}`;H.get(S)||H.set(S,Z.id)}}const U=new Set([...H.values()]);return N.filter(Z=>U.has(Z.id)).reverse().filter(Z=>!O.has(Z.id))}return[]}let k=[];Bt(()=>{const H=(h+400)/(d.clientHeight>d.clientWidth?d.clientWidth:d.clientHeight),N=Af().scaleExtent([1/H/2,3]).translateExtent([[-200,-200],[h+200,f+200]]).tapDistance(10).on("zoom",b),U=$e(i.parentElement).call(N).call(N.transform,zt).call(N.scaleTo,1/H).on("pointermove",L).on("pointerleave",v);p=i.getContext("2d");function X(){const Z=(h+400)/(d.clientHeight>d.clientWidth?d.clientWidth:d.clientHeight);U.call(N.transform,zt),U.call(N.scaleTo,1/Z)}return window.addEventListener("resize",X),()=>{window.removeEventListener("resize",X)}});function m(R){Promise.all(R.map(({imgURL:H,position:N,id:U})=>new Promise(X=>{const Z=new Image;Z.crossOrigin="anonymous",Z.onload=()=>{const F={img:Z,position:N,id:U};p.drawImage(Z,N.x,N.y,Z.width,Z.height),X(F)},Z.src=`${Au}/${H}`}))).then(H=>{H.forEach(({img:N,position:U,id:X})=>{O.add(X),p.drawImage(N,U.x,U.y,N.width,N.height)})})}function b(R){const H=Ce(Wn,r=R.transform,r);Ce(an,i.style.transform=`translate(${H.x}px, ${H.y}px) scale(${H.k})`,i)}function L(R){R.preventDefault();const H=r.invertX(R.clientX),N=r.invertY(R.clientY);l.update({cursor:{x:H,y:N}})}function v(){l.update({cursor:null})}function $(R){pt[R?"unshift":"push"](()=>{i=R,an.set(i)})}function A(R){pt[R?"unshift":"push"](()=>{d=R,n(0,d)})}return e.$$set=R=>{"$$scope"in R&&n(7,a=R.$$scope)},e.$$.update=()=>{e.$$.dirty&64&&n(5,k=E(s==null?void 0:s.toObject())),e.$$.dirty&32&&k&&m(k)},[d,i,u,f,h,k,s,a,o,$,A]}class Rf extends Ee{constructor(t){super(),ke(this,t,Mf,Nf,xe,{})}}function $f(e){let t,n,r;return{c(){t=ee("svg"),n=ee("rect"),r=ee("rect"),this.h()},l(i){t=te(i,"svg",{class:!0,height:!0,viewBox:!0,fill:!0,xmlns:!0});var s=I(t);n=te(s,"rect",{x:!0,y:!0,width:!0,height:!0,rx:!0,stroke:!0}),I(n).forEach(w),r=te(s,"rect",{x:!0,y:!0,width:!0,height:!0,rx:!0,fill:!0,stroke:!0}),I(r).forEach(w),s.forEach(w),this.h()},h(){c(n,"x","1"),c(n,"y","1"),c(n,"width","7"),c(n,"height","7"),c(n,"rx","1"),c(n,"stroke","#2F6DCB"),c(r,"x","3.05566"),c(r,"y","3.05566"),c(r,"width","2.88889"),c(r,"height","2.88889"),c(r,"rx","0.5"),c(r,"fill","#2F6DCB"),c(r,"stroke","#2F6DCB"),c(t,"class",e[0]),c(t,"height","1em"),c(t,"viewBox","0 0 9 9"),c(t,"fill","none"),c(t,"xmlns","http://www.w3.org/2000/svg")},m(i,s){re(i,t,s),g(t,n),g(t,r)},p(i,[s]){s&1&&c(t,"class",i[0])},i:me,o:me,d(i){i&&w(t)}}}function Df(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class gr extends Ee{constructor(t){super(),ke(this,t,Df,$f,xe,{classList:0})}}function Uf(e){let t,n;return{c(){t=ee("svg"),n=ee("path"),this.h()},l(r){t=te(r,"svg",{class:!0,height:!0,viewBox:!0,fill:!0,xmlns:!0});var i=I(t);n=te(i,"path",{d:!0,fill:!0}),I(n).forEach(w),i.forEach(w),this.h()},h(){c(n,"d","M3.5 4.58599C3.74063 4.58599 3.94669 4.4961 4.11819 4.31633C4.2894 4.13687 4.375 3.92102 4.375 3.66879C4.375 3.41656 4.2894 3.20056 4.11819 3.02079C3.94669 2.84132 3.74063 2.75159 3.5 2.75159C3.25937 2.75159 3.05346 2.84132 2.88225 3.02079C2.71075 3.20056 2.625 3.41656 2.625 3.66879C2.625 3.92102 2.71075 4.13687 2.88225 4.31633C3.05346 4.4961 3.25937 4.58599 3.5 4.58599ZM3.5 7.95669C4.38958 7.10064 5.04948 6.32285 5.47969 5.62334C5.9099 4.92413 6.125 4.30318 6.125 3.76051C6.125 2.92739 5.87154 2.24515 5.36462 1.71378C4.858 1.18273 4.23646 0.917197 3.5 0.917197C2.76354 0.917197 2.14185 1.18273 1.63494 1.71378C1.12831 2.24515 0.875 2.92739 0.875 3.76051C0.875 4.30318 1.0901 4.92413 1.52031 5.62334C1.95052 6.32285 2.61042 7.10064 3.5 7.95669ZM3.5 9C3.44167 9 3.38333 8.98853 3.325 8.9656C3.26667 8.94267 3.21562 8.9121 3.17188 8.87389C2.10729 7.8879 1.3125 6.97269 0.7875 6.12825C0.2625 5.28352 0 4.49427 0 3.76051C0 2.61401 0.351896 1.70064 1.05569 1.02038C1.75919 0.340127 2.57396 0 3.5 0C4.42604 0 5.24081 0.340127 5.94431 1.02038C6.6481 1.70064 7 2.61401 7 3.76051C7 4.49427 6.7375 5.28352 6.2125 6.12825C5.6875 6.97269 4.89271 7.8879 3.82812 8.87389C3.78438 8.9121 3.73333 8.94267 3.675 8.9656C3.61667 8.98853 3.55833 9 3.5 9Z"),c(n,"fill","#338D4C"),c(t,"class",e[0]),c(t,"height","1em"),c(t,"viewBox","0 0 7 9"),c(t,"fill","none"),c(t,"xmlns","http://www.w3.org/2000/svg")},m(r,i){re(r,t,i),g(t,n)},p(r,[i]){i&1&&c(t,"class",r[0])},i:me,o:me,d(r){r&&w(t)}}}function Hf(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class zf extends Ee{constructor(t){super(),ke(this,t,Hf,Uf,xe,{classList:0})}}function Vf(e){let t,n,r,i;return{c(){t=ee("svg"),n=ee("path"),r=ee("path"),i=ee("path"),this.h()},l(s){t=te(s,"svg",{class:!0,height:!0,width:!0,viewBox:!0,fill:!0,xmlns:!0});var o=I(t);n=te(o,"path",{"fill-rule":!0,"clip-rule":!0,d:!0,fill:!0}),I(n).forEach(w),r=te(o,"path",{d:!0,fill:!0}),I(r).forEach(w),i=te(o,"path",{"fill-rule":!0,"clip-rule":!0,d:!0,fill:!0}),I(i).forEach(w),o.forEach(w),this.h()},h(){c(n,"fill-rule","evenodd"),c(n,"clip-rule","evenodd"),c(n,"d","M6.41113 3.73486C6.97158 4.11531 7.3643 4.63076 7.3643 5.31801V6.54526H8.59155C8.81654 6.54526 9.00063 6.36118 9.00063 6.13618V5.31801C9.00063 4.42621 7.5402 3.8985 6.41113 3.73486Z"),c(n,"fill","currentColor"),c(r,"d","M3.27305 3.27266C4.17677 3.27266 4.90938 2.54005 4.90938 1.63633C4.90938 0.732611 4.17677 0 3.27305 0C2.36933 0 1.63672 0.732611 1.63672 1.63633C1.63672 2.54005 2.36933 3.27266 3.27305 3.27266Z"),c(r,"fill","currentColor"),c(i,"fill-rule","evenodd"),c(i,"clip-rule","evenodd"),c(i,"d","M5.72716 3.27266C6.63124 3.27266 7.36349 2.54041 7.36349 1.63633C7.36349 0.732258 6.63124 0 5.72716 0C5.53489 0 5.3549 0.0409082 5.18308 0.0981798C5.53511 0.533533 5.72715 1.07646 5.72715 1.63633C5.72715 2.1962 5.53511 2.73913 5.18308 3.17448C5.3549 3.23176 5.53489 3.27266 5.72716 3.27266ZM3.27266 3.68175C2.18041 3.68175 0 4.22992 0 5.31808V6.13624C0 6.36124 0.184087 6.54533 0.409083 6.54533H6.13625C6.36124 6.54533 6.54533 6.36124 6.54533 6.13624V5.31808C6.54533 4.22992 4.36492 3.68175 3.27266 3.68175Z"),c(i,"fill","currentColor"),c(t,"class",e[0]),c(t,"height","1em"),c(t,"width","1em"),c(t,"viewBox","0 0 9 7"),c(t,"fill","none"),c(t,"xmlns","http://www.w3.org/2000/svg")},m(s,o){re(s,t,o),g(t,n),g(t,r),g(t,i)},p(s,[o]){o&1&&c(t,"class",s[0])},i:me,o:me,d(s){s&&w(t)}}}function Bf(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class vr extends Ee{constructor(t){super(),ke(this,t,Bf,Vf,xe,{classList:0})}}function ti(e,t,n){const r=e.slice();return r[14]=t[n],r}function ni(e){let t,n,r,i,s,o,a,l,u,f,h=!e[4]&&ri(e);const d=[Ff,Kf],p=[];function O(E,k){return E[6]?0:1}return i=O(e),s=p[i]=d[i](e),{c(){t=z("div"),h&&h.c(),n=ie(),r=z("div"),s.c(),this.h()},l(E){t=V(E,"DIV",{class:!0,title:!0});var k=I(t);h&&h.l(k),n=se(k),r=V(k,"DIV",{class:!0});var m=I(r);s.l(m),m.forEach(w),k.forEach(w),this.h()},h(){c(r,"class",o=e[0]?"cursor-wait":"cursor-pointer"),c(t,"class",a="text-xs rounded md:text-smtext-gray-700 py-1 font-medium tracking-tight relative z-0 "+(e[0]?"opacity-50":"")),c(t,"title","Choose a different room")},m(E,k){re(E,t,k),h&&h.m(t,null),g(t,n),g(t,r),p[i].m(r,null),e[11](t),l=!0,u||(f=De(r,"click",e[10]),u=!0)},p(E,k){E[4]?h&&(Ne(),q(h,1,1,()=>{h=null}),Me()):h?(h.p(E,k),k&16&&J(h,1)):(h=ri(E),h.c(),J(h,1),h.m(t,n));let m=i;i=O(E),i===m?p[i].p(E,k):(Ne(),q(p[m],1,1,()=>{p[m]=null}),Me(),s=p[i],s?s.p(E,k):(s=p[i]=d[i](E),s.c()),J(s,1),s.m(r,null)),(!l||k&1&&o!==(o=E[0]?"cursor-wait":"cursor-pointer"))&&c(r,"class",o),(!l||k&1&&a!==(a="text-xs rounded md:text-smtext-gray-700 py-1 font-medium tracking-tight relative z-0 "+(E[0]?"opacity-50":"")))&&c(t,"class",a)},i(E){l||(J(h),J(s),l=!0)},o(E){q(h),q(s),l=!1},d(E){E&&w(t),h&&h.d(),p[i].d(),e[11](null),u=!1,f()}}}function ri(e){let t,n,r,i,s,o,a,l,u,f,h,d,p,O,E,k;i=new gr({}),u=new vr({});let m=e[2],b=[];for(let v=0;vq(b[v],1,1,()=>{b[v]=null});return{c(){t=z("div"),n=z("ul"),r=z("li"),ge(i.$$.fragment),s=ie(),o=z("span"),a=G("room"),l=ie(),ge(u.$$.fragment),f=ie(),h=z("span"),d=G("players"),p=ie();for(let v=0;v{A=null}),Me()),(!L||N&4)&&a!==(a=e[14].id+"")&&tt(l,a),(!L||N&4)&&p!==(p=e[14].users_count+"")&&tt(O,p),(!L||N&6&&m!==(m="grid-row gap-2 hover:bg-gray-300 "+(e[14].room_id===e[1]?"text-black":"")+" svelte-15fj2lr"))&&c(n,"class",m)},i(H){L||(J(A),L=!0)},o(H){q(A),L=!1},d(H){H&&w(t),A&&A.d(),v=!1,$()}}}function Kf(e){let t,n,r,i,s,o,a,l,u,f;return n=new gr({}),o=new vr({}),{c(){t=z("div"),ge(n.$$.fragment),r=ie(),i=z("span"),s=G(`Loading... - `),ge(o.$$.fragment),a=ie(),l=z("span"),u=G("... / ..."),this.h()},l(h){t=V(h,"DIV",{class:!0});var d=I(t);ve(n.$$.fragment,d),r=se(d),i=V(d,"SPAN",{});var p=I(i);s=Q(p,`Loading... - `),ve(o.$$.fragment,p),a=se(p),l=V(p,"SPAN",{});var O=I(l);u=Q(O,"... / ..."),O.forEach(w),p.forEach(w),d.forEach(w),this.h()},h(){c(t,"class","grid-row gap-2 svelte-15fj2lr")},m(h,d){re(h,t,d),ye(n,t,null),g(t,r),g(t,i),g(i,s),ye(o,i,null),g(i,a),g(i,l),g(l,u),f=!0},p:me,i(h){f||(J(n.$$.fragment,h),J(o.$$.fragment,h),f=!0)},o(h){q(n.$$.fragment,h),q(o.$$.fragment,h),f=!1},d(h){h&&w(t),we(n),we(o)}}}function Ff(e){var m,b;let t,n,r,i,s,o=((m=e[6])==null?void 0:m.id)+"",a,l,u,f,h,d=((b=e[6])==null?void 0:b.users_count)+"",p,O,E,k;return n=new gr({}),u=new vr({}),{c(){t=z("div"),ge(n.$$.fragment),r=ie(),i=z("span"),s=G("room "),a=G(o),l=ie(),ge(u.$$.fragment),f=ie(),h=z("span"),p=G(d),O=G(" / "),E=G(cn),this.h()},l(L){t=V(L,"DIV",{class:!0});var v=I(t);ve(n.$$.fragment,v),r=se(v),i=V(v,"SPAN",{});var $=I(i);s=Q($,"room "),a=Q($,o),$.forEach(w),l=se(v),ve(u.$$.fragment,v),f=se(v),h=V(v,"SPAN",{});var A=I(h);p=Q(A,d),O=Q(A," / "),E=Q(A,cn),A.forEach(w),v.forEach(w),this.h()},h(){c(t,"class","grid-row gap-2 svelte-15fj2lr")},m(L,v){re(L,t,v),ye(n,t,null),g(t,r),g(t,i),g(i,s),g(i,a),g(t,l),ye(u,t,null),g(t,f),g(t,h),g(h,p),g(h,O),g(h,E),k=!0},p(L,v){var $,A;(!k||v&64)&&o!==(o=(($=L[6])==null?void 0:$.id)+"")&&tt(a,o),(!k||v&64)&&d!==(d=((A=L[6])==null?void 0:A.users_count)+"")&&tt(p,d)},i(L){k||(J(n.$$.fragment,L),J(u.$$.fragment,L),k=!0)},o(L){q(n.$$.fragment,L),q(u.$$.fragment,L),k=!1},d(L){L&&w(t),we(n),we(u)}}}function jf(e){let t,n,r=e[5]&&ni(e);return{c(){t=z("div"),r&&r.c(),this.h()},l(i){t=V(i,"DIV",{class:!0});var s=I(t);r&&r.l(s),s.forEach(w),this.h()},h(){c(t,"class","min-w-[25ch]")},m(i,s){re(i,t,s),r&&r.m(t,null),n=!0},p(i,[s]){i[5]?r?(r.p(i,s),s&32&&J(r,1)):(r=ni(i),r.c(),J(r,1),r.m(t,null)):r&&(Ne(),q(r,1,1,()=>{r=null}),Me())},i(i){n||(J(r),n=!0)},o(i){q(r),n=!1},d(i){i&&w(t),r&&r.d()}}}function Xf(e,t,n){let r,i,s,o,a;Oe(e,$s,m=>n(12,s=m)),Oe(e,Jr,m=>n(1,o=m));let{isLoading:l=!1}=t,u;const f=Ru();Oe(e,f,m=>n(2,a=m));let h=!0;function d(m){u.contains(m.target)||n(4,h=!0)}Bt(()=>(window.addEventListener("pointerdown",d,!0),()=>{window.removeEventListener("pointerdown",d,!0)}));function p(m){Ce(Jr,o=m.room_id,o),n(4,h=!0),s.url.searchParams.set("roomid",m.room_id),window.location.search=`?${s.url.searchParams.toString()}`}const O=m=>p(m),E=()=>l?null:n(4,h=!h);function k(m){pt[m?"unshift":"push"](()=>{u=m,n(3,u)})}return e.$$set=m=>{"isLoading"in m&&n(0,l=m.isLoading)},e.$$.update=()=>{e.$$.dirty&6&&n(6,r=a.find(m=>m.room_id===o)),e.$$.dirty&4&&n(5,i=a.length>0)},[l,o,a,u,h,i,r,f,p,O,E,k]}class Yf extends Ee{constructor(t){super(),ke(this,t,Xf,jf,xe,{isLoading:0})}}function Jf(e){let t,n,r,i,s;return{c(){t=z("button"),n=z("span"),r=G("About"),this.h()},l(o){t=V(o,"BUTTON",{title:!0,class:!0});var a=I(t);n=V(a,"SPAN",{});var l=I(n);r=Q(l,"About"),l.forEach(w),a.forEach(w),this.h()},h(){c(t,"title","Prompt and Paint"),c(t,"class","underline w-[210px] text-sm")},m(o,a){re(o,t,a),g(t,n),g(n,r),i||(s=De(t,"click",e[0]),i=!0)},p:me,i:me,o:me,d(o){o&&w(t),i=!1,s()}}}function Zf(e){function t(n){rr.call(this,e,n)}return[t]}class Wf extends Ee{constructor(t){super(),ke(this,t,Zf,Jf,xe,{})}}function qf(e){let t,n,r,i,s,o,a,l,u;return n=new Wf({}),n.$on("click",e[3]),o=new Yf({props:{isLoading:e[0]}}),{c(){t=z("div"),ge(n.$$.fragment),r=ie(),i=z("button"),s=G("\u{1F58D} Paint"),ge(o.$$.fragment),this.h()},l(f){t=V(f,"DIV",{class:!0});var h=I(t);ve(n.$$.fragment,h),r=se(h),i=V(h,"BUTTON",{class:!0});var d=I(i);s=Q(d,"\u{1F58D} Paint"),d.forEach(w),ve(o.$$.fragment,h),h.forEach(w),this.h()},h(){c(i,"class","text-3xl bg-blue-600 text-white px-6 py-2 rounded-2xl ring ring-blue-500 font-semibold shadow-2xl self-center"),c(t,"class","flex items-center justify-between px-12")},m(f,h){re(f,t,h),ye(n,t,null),g(t,r),g(t,i),g(i,s),ye(o,t,null),a=!0,l||(u=De(i,"click",e[4]),l=!0)},p(f,[h]){const d={};h&1&&(d.isLoading=f[0]),o.$set(d)},i(f){a||(J(n.$$.fragment,f),J(o.$$.fragment,f),a=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&w(t),we(n),we(o),l=!1,u()}}}function Gf(e,t,n){let r;Oe(e,Zr,u=>n(1,r=u));const i=nr();let{isLoading:s=!1}=t;const o=u=>{u.key==="Enter"&&i("prompt")};Bt(()=>(window.addEventListener("keyup",o),()=>{window.removeEventListener("keyup",o)}));const a=()=>{Ce(Zr,r=!r,r)},l=()=>i("prompt");return e.$$set=u=>{"isLoading"in u&&n(0,s=u.isLoading)},[s,r,i,a,l]}class Qf extends Ee{constructor(t){super(),ke(this,t,Gf,qf,xe,{isLoading:0})}}function eh(e){let t,n,r,i,s,o,a,l,u,f;return{c(){t=z("form"),n=z("div"),r=z("input"),i=ie(),s=z("button"),o=z("span"),a=G("\u{1F58C}"),l=G(" Paint"),this.h()},l(h){t=V(h,"FORM",{class:!0});var d=I(t);n=V(d,"DIV",{class:!0});var p=I(n);r=V(p,"INPUT",{class:!0,placeholder:!0,title:!0,type:!0,name:!0}),i=se(p),s=V(p,"BUTTON",{class:!0,type:!0});var O=I(s);o=V(O,"SPAN",{class:!0});var E=I(o);a=Q(E,"\u{1F58C}"),E.forEach(w),l=Q(O," Paint"),O.forEach(w),p.forEach(w),d.forEach(w),this.h()},h(){r.value=e[0],c(r,"class","flex-1 outline-none ring-0 border-none text-xl 2xl:text-2xl"),c(r,"placeholder","Describe your prompt"),c(r,"title","Input prompt to generate image and obtain palette"),c(r,"type","text"),c(r,"name","prompt"),c(o,"class","mr-2"),c(s,"class","font-bold bg-blue-700 text-white border-l-2 px-5 text-xl 2xl:text-2xl spacing tracking-wide"),c(s,"type","submit"),c(n,"class","flex bg-white itemx-center overflow-hidden rounded-lg w-full max-w-lg 2xl:max-w-xl"),c(t,"class","fixed w-screen top-0 left-0 bottom-0 right-0 max-h-screen z-50 flex items-center justify-center bg-black bg-opacity-80")},m(h,d){re(h,t,d),g(t,n),g(n,r),e[7](r),g(n,i),g(n,s),g(s,o),g(o,a),g(s,l),e[8](n),u||(f=[De(r,"click",Ns(e[6])),De(r,"input",e[4]),De(s,"click",Hn(e[3])),De(t,"submit",Hn(e[3]))],u=!0)},p(h,[d]){d&1&&r.value!==h[0]&&(r.value=h[0])},i:me,o:me,d(h){h&&w(t),e[7](null),e[8](null),u=!1,mi(f)}}}function th(e,t,n){const r=nr();let{initPrompt:i=""}=t,s,o,a;const l=xn(),u=b=>{b.key==="Escape"&&(l.update({status:he.ready}),r("close"))};Bt(()=>(o.focus(),n(0,s=i),window.addEventListener("keyup",u),window.addEventListener("pointerdown",O,!0),()=>{window.removeEventListener("keyup",u),window.removeEventListener("pointerdown",O,!0)}));let f;function h(b){clearTimeout(f),f=setTimeout(()=>{n(0,s=b),l.update({currentPrompt:s,status:he.prompting})},100)}function d(){s.trim()!==""&&(r("paint"),r("close"))}function p(b){const L=b.target;h(L.value)}function O(b){a.contains(b.target)||(l.update({status:he.ready}),r("close"))}function E(b){rr.call(this,e,b)}function k(b){pt[b?"unshift":"push"](()=>{o=b,n(1,o)})}function m(b){pt[b?"unshift":"push"](()=>{a=b,n(2,a)})}return e.$$set=b=>{"initPrompt"in b&&n(5,i=b.initPrompt)},[s,o,a,d,p,i,E,k,m]}class nh extends Ee{constructor(t){super(),ke(this,t,th,eh,xe,{initPrompt:5})}}let rh=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");function oi(e,t,n){const r=e.slice();return r[15]=t[n].connectionId,r[16]=t[n].presence,r}function ai(e){var r;let t,n;return t=new nh({props:{initPrompt:(r=e[0])==null?void 0:r.currentPrompt}}),t.$on("paint",e[11]),t.$on("close",e[10]),{c(){ge(t.$$.fragment)},l(i){ve(t.$$.fragment,i)},m(i,s){ye(t,i,s),n=!0},p(i,s){var a;const o={};s&1&&(o.initPrompt=(a=i[0])==null?void 0:a.currentPrompt),t.$set(o)},i(i){n||(J(t.$$.fragment,i),n=!0)},o(i){q(t.$$.fragment,i),n=!1},d(i){we(t,i)}}}function li(e){let t=[],n=new Map,r,i,s=[...e[5]];const o=a=>a[15];for(let a=0;a{o=null}),Me()),(L=t[16])!=null&&L.cursor?a?(a.p(t,O),O&32&&J(a,1)):(a=ci(t),a.c(),J(a,1),a.m(i.parentNode,i)):a&&(Ne(),q(a,1,1,()=>{a=null}),Me())},i(p){s||(J(o),J(a),s=!0)},o(p){q(o),q(a),s=!1},d(p){p&&w(n),o&&o.d(p),p&&w(r),a&&a.d(p),p&&w(i)}}}function ih(e){let t,n,r,i,s,o,a,l,u,f,h,d,p,O,E=e[1]&&ai(e);o=new Rf({}),u=new Tf({props:{transform:e[4]}}),u.$on("prompt",e[9]);let k=e[5]&&li(e);return p=new Qf({props:{isLoading:e[2]}}),p.$on("prompt",e[9]),{c(){t=z("div"),n=G(e[3]),r=ie(),E&&E.c(),i=ie(),s=z("div"),ge(o.$$.fragment),a=ie(),l=z("main"),ge(u.$$.fragment),f=ie(),k&&k.c(),h=ie(),d=z("div"),ge(p.$$.fragment),this.h()},l(m){t=V(m,"DIV",{class:!0});var b=I(t);n=Q(b,e[3]),b.forEach(w),r=se(m),E&&E.l(m),i=se(m),s=V(m,"DIV",{class:!0});var L=I(s);ve(o.$$.fragment,L),a=se(L),l=V(L,"MAIN",{class:!0});var v=I(l);ve(u.$$.fragment,v),f=se(v),k&&k.l(v),v.forEach(w),L.forEach(w),h=se(m),d=V(m,"DIV",{class:!0});var $=I(d);ve(p.$$.fragment,$),$.forEach(w),this.h()},h(){c(t,"class","text touch-none pointer-events-none"),c(l,"class","z-10 relative"),c(s,"class","fixed top-0 left-0 z-0 w-screen h-screen"),c(d,"class","fixed bottom-32 left-0 right-0 z-10 my-2")},m(m,b){re(m,t,b),g(t,n),re(m,r,b),E&&E.m(m,b),re(m,i,b),re(m,s,b),ye(o,s,null),g(s,a),g(s,l),ye(u,l,null),g(l,f),k&&k.m(l,null),re(m,h,b),re(m,d,b),ye(p,d,null),O=!0},p(m,[b]){(!O||b&8)&&tt(n,m[3]),m[1]?E?(E.p(m,b),b&2&&J(E,1)):(E=ai(m),E.c(),J(E,1),E.m(i.parentNode,i)):E&&(Ne(),q(E,1,1,()=>{E=null}),Me());const L={};b&16&&(L.transform=m[4]),u.$set(L),m[5]?k?(k.p(m,b),b&32&&J(k,1)):(k=li(m),k.c(),J(k,1),k.m(l,null)):k&&(Ne(),q(k,1,1,()=>{k=null}),Me());const v={};b&4&&(v.isLoading=m[2]),p.$set(v)},i(m){O||(J(E),J(o.$$.fragment,m),J(u.$$.fragment,m),J(k),J(p.$$.fragment,m),O=!0)},o(m){q(E),q(o.$$.fragment,m),q(u.$$.fragment,m),q(k),q(p.$$.fragment,m),O=!1},d(m){m&&w(t),m&&w(r),E&&E.d(m),m&&w(i),m&&w(s),we(o),we(u),k&&k.d(),m&&w(h),m&&w(d),we(p)}}}function sh(e){return`${e.x}_${e.y}`}function oh(e,t,n){let r,i,s,o,a,l,u;Oe(e,Pe,b=>n(3,i=b)),Oe(e,qn,b=>n(13,o=b)),Oe(e,Wn,b=>n(4,l=b));const f=xn();Oe(e,f,b=>n(0,a=b));const h=Tu();Oe(e,h,b=>n(5,u=b));const d=ss("promptImgStorage");Oe(e,d,b=>n(12,s=b));let p=!1;function O(){!r&&!p&&(n(1,p=!0),f.update({status:he.prompting}))}function E(){n(1,p=!1)}function k(){m(),n(1,p=!1)}async function m(){if(r)return;Ce(Pe,i="Pending",i);const b=a.currentPrompt,L=a.frame;console.log("Generating...",b,L),f.update({status:he.loading});const v=crypto.randomUUID(),$=o.toDataURL("image/png"),A={fn_index:0,session_hash:v},R={data:[$,b,.75,7.5,40,"patchmatch"]},H=new WebSocket(Ou);H.onclose=N=>{N.wasClean||(Ce(Pe,i="Error",i),f.update({status:he.ready}))},H.onmessage=async function(N){try{const U=JSON.parse(N.data);switch(Ce(Pe,i="",i),U.msg){case"send_hash":H.send(JSON.stringify(A));break;case"send_data":Ce(Pe,i="Sending Data",i),H.send(JSON.stringify({...A,...R}));break;case"queue_full":Ce(Pe,i="Queue full",i),H.close(),f.update({status:he.ready});return;case"estimation":const{rank:X,queue_size:Z}=U;Ce(Pe,i=`On queue ${X}/${Z}`,i);break;case"process_generating":Ce(Pe,i=U.success?"Generating":"Error",i);break;case"process_completed":try{const F=U.output.data[0];if(U.output.data[1])throw new Error("NFSW");const x=sh(L),C=await Cu(F),S=await Su(C,b,x),T={prompt:b,imgURL:S.filename,position:L,date:new Date().getTime(),id:rh()};s.set(x,T),console.log(S),Ce(Pe,i=U.success?"Complete":"Error",i),setTimeout(()=>{Ce(Pe,i="",i)},2e3),f.update({status:he.ready,currentPrompt:""})}catch(F){const y=F;Ce(Pe,i=y==null?void 0:y.message,i),f.update({status:he.ready})}H.close();return;case"process_starts":Ce(Pe,i="Processing",i);break}}catch(U){console.error(U),Ce(Pe,i="Error",i)}}}return e.$$.update=()=>{e.$$.dirty&1&&n(2,r=(a==null?void 0:a.status)===he.loading||!1)},[a,p,r,i,l,u,f,h,d,O,E,k]}class vh extends Ee{constructor(t){super(),ke(this,t,oh,ih,xe,{})}}function ah(e){let t,n,r,i,s,o,a,l,u,f,h,d,p,O,E,k,m,b,L,v,$,A,R,H,N,U,X;return{c(){t=ee("svg"),n=ee("rect"),r=ee("path"),i=ee("path"),s=ee("path"),o=ee("path"),a=ee("path"),l=ee("path"),u=ee("path"),f=ee("path"),h=ee("path"),d=ee("path"),p=ee("path"),O=ee("path"),E=ee("path"),k=ee("path"),m=ee("path"),b=ee("path"),L=ee("path"),v=ee("path"),$=ee("path"),A=ee("path"),R=ee("path"),H=ee("defs"),N=ee("radialGradient"),U=ee("stop"),X=ee("stop"),this.h()},l(Z){t=te(Z,"svg",{class:!0,width:!0,height:!0,viewBox:!0,fill:!0,xmlns:!0});var F=I(t);n=te(F,"rect",{opacity:!0,x:!0,y:!0,width:!0,height:!0,rx:!0,fill:!0,stroke:!0,"stroke-width":!0}),I(n).forEach(w),r=te(F,"path",{d:!0,fill:!0}),I(r).forEach(w),i=te(F,"path",{d:!0,fill:!0}),I(i).forEach(w),s=te(F,"path",{d:!0,fill:!0}),I(s).forEach(w),o=te(F,"path",{d:!0,fill:!0}),I(o).forEach(w),a=te(F,"path",{d:!0,fill:!0}),I(a).forEach(w),l=te(F,"path",{d:!0,fill:!0}),I(l).forEach(w),u=te(F,"path",{d:!0,fill:!0}),I(u).forEach(w),f=te(F,"path",{d:!0,fill:!0}),I(f).forEach(w),h=te(F,"path",{d:!0,fill:!0}),I(h).forEach(w),d=te(F,"path",{d:!0,fill:!0}),I(d).forEach(w),p=te(F,"path",{d:!0,fill:!0}),I(p).forEach(w),O=te(F,"path",{d:!0,fill:!0}),I(O).forEach(w),E=te(F,"path",{d:!0,fill:!0}),I(E).forEach(w),k=te(F,"path",{d:!0,fill:!0}),I(k).forEach(w),m=te(F,"path",{d:!0,fill:!0}),I(m).forEach(w),b=te(F,"path",{d:!0,fill:!0}),I(b).forEach(w),L=te(F,"path",{d:!0,fill:!0}),I(L).forEach(w),v=te(F,"path",{d:!0,fill:!0}),I(v).forEach(w),$=te(F,"path",{d:!0,fill:!0}),I($).forEach(w),A=te(F,"path",{d:!0,fill:!0}),I(A).forEach(w),R=te(F,"path",{"fill-rule":!0,"clip-rule":!0,d:!0,fill:!0}),I(R).forEach(w),H=te(F,"defs",{});var y=I(H);N=te(y,"radialGradient",{id:!0,cx:!0,cy:!0,r:!0,gradientUnits:!0,gradientTransform:!0});var x=I(N);U=te(x,"stop",{"stop-color":!0}),I(U).forEach(w),X=te(x,"stop",{offset:!0,"stop-color":!0}),I(X).forEach(w),x.forEach(w),y.forEach(w),F.forEach(w),this.h()},h(){c(n,"opacity","0.5"),c(n,"x","0.25"),c(n,"y","0.25"),c(n,"width","122.5"),c(n,"height","43.5"),c(n,"rx","6.75"),c(n,"fill","#1F2937"),c(n,"stroke","#3A4C64"),c(n,"stroke-width","0.5"),c(r,"d","M44.9102 16.8569H45.8514V14.778H47.1691C48.364 14.778 49.1497 14.0577 49.1497 12.9528C49.1497 11.8397 48.364 11.1277 47.1691 11.1277H44.9102V16.8569ZM47.0954 11.9461C47.7666 11.9461 48.1921 12.3308 48.1921 12.9528C48.1921 13.5667 47.7584 13.9595 47.0872 13.9595H45.8514V11.9461H47.0954Z"),c(r,"fill","#A3BAD9"),c(i,"d","M51.5649 16.9059C52.8417 16.9059 53.701 16.0465 53.701 14.7615C53.701 13.4847 52.8417 12.6172 51.5649 12.6172C50.2881 12.6172 49.4287 13.4847 49.4287 14.7615C49.4287 16.0465 50.2881 16.9059 51.5649 16.9059ZM51.5649 16.1529C50.8201 16.1529 50.3372 15.5718 50.3372 14.7615C50.3372 13.9513 50.8201 13.3702 51.5649 13.3702C52.3097 13.3702 52.8007 13.9513 52.8007 14.7615C52.8007 15.5718 52.3097 16.1529 51.5649 16.1529Z"),c(i,"fill","#A3BAD9"),c(s,"d","M55.233 16.857H56.1906L57.1073 14.0088L57.9912 16.857H58.9406L60.332 12.6665H59.4317L58.4414 15.8748L57.5247 12.6665H56.7144L55.7568 15.8748L54.7992 12.6665H53.8662L55.233 16.857Z"),c(s,"fill","#A3BAD9"),c(o,"d","M62.6424 16.9059C63.6818 16.9059 64.3857 16.2757 64.533 15.449H63.6491C63.5263 15.9156 63.1335 16.1856 62.5933 16.1856C61.8976 16.1856 61.4475 15.7191 61.4229 15.0071V14.9498H64.5821C64.5985 14.8352 64.6067 14.7206 64.6067 14.6142C64.5821 13.3865 63.7719 12.6172 62.5605 12.6172C61.3247 12.6172 60.498 13.4766 60.498 14.7697C60.498 16.0547 61.3247 16.9059 62.6424 16.9059ZM61.4556 14.3032C61.5211 13.7057 62.004 13.3292 62.5687 13.3292C63.1826 13.3292 63.6164 13.6812 63.69 14.3032H61.4556Z"),c(o,"fill","#A3BAD9"),c(a,"d","M67.4411 12.6665C66.7536 12.6665 66.418 12.9448 66.2052 13.2967L66.107 12.6665H65.3213V16.857H66.2052V14.7536C66.2052 14.107 66.4589 13.4931 67.2447 13.4931H67.6375V12.6665H67.4411Z"),c(a,"fill","#A3BAD9"),c(l,"d","M69.9725 16.9059C71.0119 16.9059 71.7158 16.2757 71.8631 15.449H70.9792C70.8564 15.9156 70.4635 16.1856 69.9234 16.1856C69.2277 16.1856 68.7775 15.7191 68.753 15.0071V14.9498H71.9122C71.9286 14.8352 71.9368 14.7206 71.9368 14.6142C71.9122 13.3865 71.1019 12.6172 69.8906 12.6172C68.6548 12.6172 67.8281 13.4766 67.8281 14.7697C67.8281 16.0547 68.6548 16.9059 69.9725 16.9059ZM68.7857 14.3032C68.8512 13.7057 69.3341 13.3292 69.8988 13.3292C70.5127 13.3292 70.9464 13.6812 71.0201 14.3032H68.7857Z"),c(l,"fill","#A3BAD9"),c(u,"d","M75.8352 13.2475C75.5651 12.8792 75.1149 12.6173 74.4765 12.6173C73.3391 12.6173 72.4961 13.4685 72.4961 14.7616C72.4961 16.1039 73.3391 16.906 74.4765 16.906C75.1395 16.906 75.5733 16.5949 75.8433 16.2266L75.9497 16.8569H76.7191V11.1277H75.8352V13.2475ZM74.6238 16.1612C73.8875 16.1612 73.4046 15.5883 73.4046 14.7616C73.4046 13.9432 73.8875 13.3702 74.6238 13.3702C75.3605 13.3702 75.8433 13.9432 75.8433 14.778C75.8433 15.5883 75.3605 16.1612 74.6238 16.1612Z"),c(u,"fill","#A3BAD9"),c(f,"d","M81.9193 12.6173C81.2727 12.6173 80.839 12.9119 80.5607 13.2884V11.1277H79.6768V16.8569H80.4461L80.5525 16.2512C80.8144 16.6277 81.2646 16.906 81.9193 16.906C83.0652 16.906 83.9 16.0466 83.9 14.7616C83.9 13.4112 83.0652 12.6173 81.9193 12.6173ZM81.772 16.1612C81.0354 16.1612 80.5525 15.5801 80.5525 14.7534C80.5525 13.9432 81.0354 13.3702 81.772 13.3702C82.5086 13.3702 82.9997 13.9432 82.9997 14.7616C82.9997 15.5883 82.5086 16.1612 81.772 16.1612Z"),c(f,"fill","#A3BAD9"),c(h,"d","M85.6277 16.8815L85.4641 17.2908C85.3331 17.6345 85.2513 17.7164 84.9075 17.7164H84.2855V18.4939H85.2349C85.8487 18.4939 86.0288 18.1911 86.2907 17.5117L88.1895 12.6665H87.2483L86.1106 15.8503L84.9402 12.6665H83.999L85.6277 16.8815Z"),c(h,"fill","#A3BAD9"),c(d,"d","M45.1162 32.4821H47.2144V22.0654H45.1162V32.4821Z"),c(d,"fill","#A3BAD9"),c(p,"d","M49.7329 24.0148C50.4175 24.0148 50.9532 23.5088 50.9532 22.8392C50.9532 22.1546 50.4175 21.6487 49.7329 21.6487C49.0484 21.6487 48.5127 22.1546 48.5127 22.8392C48.5127 23.5088 49.0484 24.0148 49.7329 24.0148ZM48.6764 32.482H50.7895V24.8332H48.6764V32.482Z"),c(p,"fill","#A3BAD9"),c(O,"d","M54.2461 32.4823H56.8503L59.6033 24.8335H57.4009L55.5854 30.3394L53.7402 24.8335H51.4932L54.2461 32.4823Z"),c(O,"fill","#A3BAD9"),c(E,"d","M63.718 32.5713C65.7567 32.5713 67.0811 31.3808 67.3192 29.8927H65.2507C65.0722 30.607 64.4769 30.979 63.6287 30.979C62.5722 30.979 61.8728 30.3243 61.8281 29.2379V29.1338H67.3787C67.4234 28.8957 67.4382 28.6427 67.4382 28.4195C67.4085 26.1725 65.8609 24.7439 63.5692 24.7439C61.2031 24.7439 59.6406 26.2915 59.6406 28.6725C59.6406 31.0385 61.1734 32.5713 63.718 32.5713ZM61.8728 27.7647C61.9918 26.857 62.6763 26.3064 63.5841 26.3064C64.5365 26.3064 65.1763 26.8272 65.3251 27.7647H61.8728Z"),c(E,"fill","#A3BAD9"),c(k,"d","M72.9898 24.744C71.9332 24.744 71.1891 25.1904 70.6832 25.8005V22.0654H68.585V32.4821H70.4153L70.6237 31.4404C71.1148 32.0952 71.8737 32.5714 72.9749 32.5714C75.0434 32.5714 76.5315 31.0089 76.5315 28.6428C76.5315 26.2172 75.0434 24.744 72.9898 24.744ZM72.5136 30.8601C71.3678 30.8601 70.6534 29.9523 70.6534 28.6428C70.6534 27.3482 71.3678 26.4553 72.5136 26.4553C73.6594 26.4553 74.4035 27.3482 74.4035 28.6577C74.4035 29.9672 73.6594 30.8601 72.5136 30.8601Z"),c(k,"fill","#A3BAD9"),c(m,"d","M77.6973 32.4821H79.7955V22.0654H77.6973V32.4821Z"),c(m,"fill","#A3BAD9"),c(b,"d","M84.9927 32.5713C87.4332 32.5713 89.0254 31.0237 89.0254 28.6576C89.0254 26.3064 87.4332 24.7439 84.9927 24.7439C82.5522 24.7439 80.96 26.3064 80.96 28.6576C80.96 31.0088 82.5522 32.5713 84.9927 32.5713ZM84.9927 30.86C83.8171 30.86 83.1028 29.9522 83.1028 28.6576C83.1028 27.3629 83.8171 26.4552 84.9927 26.4552C86.1683 26.4552 86.8975 27.3629 86.8975 28.6576C86.8975 29.9522 86.1683 30.86 84.9927 30.86Z"),c(b,"fill","#A3BAD9"),c(L,"d","M93.7816 32.5713C95.865 32.5713 97.2489 31.4254 97.5465 29.5951H95.3441C95.1953 30.3689 94.6447 30.86 93.8263 30.86C92.7251 30.86 92.0257 29.9671 92.0257 28.6576C92.0257 27.3629 92.7251 26.4552 93.8263 26.4552C94.6447 26.4552 95.1655 26.9314 95.3441 27.6903H97.5316C97.234 25.8748 95.9394 24.7439 93.856 24.7439C91.4304 24.7439 89.8828 26.2915 89.8828 28.6576C89.8828 31.0683 91.356 32.5713 93.7816 32.5713Z"),c(L,"fill","#A3BAD9"),c(v,"d","M98.6514 32.4821H100.75V30.622L101.895 29.3869L103.83 32.4821H106.256L103.354 27.8392L106.107 24.8333H103.741L100.75 28.0773V22.0654H98.6514V32.4821Z"),c(v,"fill","#A3BAD9"),c($,"d","M106.188 29.9375C106.277 31.5744 107.72 32.5714 109.848 32.5714C111.902 32.5714 113.33 31.6042 113.33 30.0863C113.33 28.3601 111.872 27.9583 110.116 27.7798C109.015 27.6458 108.36 27.5863 108.36 27.006C108.36 26.5149 108.896 26.2173 109.714 26.2173C110.562 26.2173 111.143 26.5893 111.202 27.1994H113.211C113.107 25.6369 111.693 24.7292 109.64 24.7292C107.676 24.7143 106.351 25.7113 106.351 27.2292C106.351 28.8065 107.735 29.2083 109.521 29.4167C110.756 29.5804 111.277 29.625 111.277 30.25C111.277 30.7857 110.741 31.0685 109.863 31.0685C108.836 31.0685 108.256 30.6071 108.182 29.9375H106.188Z"),c($,"fill","#A3BAD9"),c(A,"d","M32.4824 8.67236H11.649C10.0053 8.67236 8.67285 10.0048 8.67285 11.6486V32.4819C8.67285 34.1256 10.0053 35.4581 11.649 35.4581H32.4824C34.1261 35.4581 35.4586 34.1256 35.4586 32.4819V11.6486C35.4586 10.0048 34.1261 8.67236 32.4824 8.67236Z"),c(A,"fill","url(#paint0_radial_253_107)"),c(R,"fill-rule","evenodd"),c(R,"clip-rule","evenodd"),c(R,"d","M24.8953 17.78H15.0332L17.8712 20.7599V24.875L24.8953 17.78ZM19.2193 26.294H29.0814L26.2434 23.3141V19.199L19.2193 26.294Z"),c(R,"fill","white"),c(U,"stop-color","#FF0099"),c(X,"offset","1"),c(X,"stop-color","#FF7A00"),c(N,"id","paint0_radial_253_107"),c(N,"cx","0"),c(N,"cy","0"),c(N,"r","1"),c(N,"gradientUnits","userSpaceOnUse"),c(N,"gradientTransform","translate(4.7524 1.97593) rotate(45.3703) scale(40.7748 35.4976)"),c(t,"class",e[0]),c(t,"width","123"),c(t,"height","44"),c(t,"viewBox","0 0 123 44"),c(t,"fill","none"),c(t,"xmlns","http://www.w3.org/2000/svg")},m(Z,F){re(Z,t,F),g(t,n),g(t,r),g(t,i),g(t,s),g(t,o),g(t,a),g(t,l),g(t,u),g(t,f),g(t,h),g(t,d),g(t,p),g(t,O),g(t,E),g(t,k),g(t,m),g(t,b),g(t,L),g(t,v),g(t,$),g(t,A),g(t,R),g(t,H),g(H,N),g(N,U),g(N,X)},p(Z,[F]){F&1&&c(t,"class",Z[0])},i:me,o:me,d(Z){Z&&w(t)}}}function lh(e,t,n){let{classList:r=""}=t;return e.$$set=i=>{"classList"in i&&n(0,r=i.classList)},[r]}class uh extends Ee{constructor(t){super(),ke(this,t,lh,ah,xe,{classList:0})}}function hi(e){let t,n,r,i,s,o;return n=new cr({props:{classList:"inline-block animate-spin p-1 mr-2"}}),{c(){t=z("div"),ge(n.$$.fragment),r=ie(),i=z("h1"),s=G("Loading..."),this.h()},l(a){t=V(a,"DIV",{class:!0});var l=I(t);ve(n.$$.fragment,l),r=se(l),i=V(l,"H1",{class:!0});var u=I(i);s=Q(u,"Loading..."),u.forEach(w),l.forEach(w),this.h()},h(){c(i,"class","font-bold inline-block"),c(t,"class","text-4xl text-white flex items-center mb-4")},m(a,l){re(a,t,l),ye(n,t,null),g(t,r),g(t,i),g(i,s),o=!0},i(a){o||(J(n.$$.fragment,a),o=!0)},o(a){q(n.$$.fragment,a),o=!1},d(a){a&&w(t),we(n)}}}function ch(e){let t,n,r,i,s,o,a,l,u,f,h,d,p,O,E,k,m,b,L,v,$,A,R,H,N,U,X,Z,F,y,x,C,S,T,j,D=e[1]&&hi();return x=new uh({props:{classList:"ml-2"}}),{c(){t=z("div"),n=z("div"),D&&D.c(),r=ie(),i=z("h2"),s=G("Stable Difussion Multiplayer"),o=ie(),a=z("p"),l=G("Powered by Hugging Face face GPU Spaces "),u=z("a"),f=G("https://huggingface.co/docs/hub/spaces-gpus"),h=G(` - Diffusers - `),d=z("a"),p=G("https://huggingface.co/docs/diffusers/index"),O=ie(),E=z("p"),k=G("Thanks to "),m=z("a"),b=G("Lnyan"),L=G(` - for the original outpaiting technique implemented on - `),v=z("a"),$=G(`Stable Diffusion Infinity - `),A=G("."),R=ie(),H=z("p"),N=G(`Runwayml Inpaiting Stable Diffusion - `),U=z("a"),X=G("https://github.com/runwayml/stable-diffusion"),Z=ie(),F=z("p"),y=G(`Multiplayer API by - `),ge(x.$$.fragment),this.h()},l(W){t=V(W,"DIV",{class:!0});var oe=I(t);n=V(oe,"DIV",{class:!0});var le=I(n);D&&D.l(le),r=se(le),i=V(le,"H2",{class:!0});var ae=I(i);s=Q(ae,"Stable Difussion Multiplayer"),ae.forEach(w),o=se(le),a=V(le,"P",{});var pe=I(a);l=Q(pe,"Powered by Hugging Face face GPU Spaces "),u=V(pe,"A",{href:!0,class:!0});var Ae=I(u);f=Q(Ae,"https://huggingface.co/docs/hub/spaces-gpus"),Ae.forEach(w),h=Q(pe,` - Diffusers - `),d=V(pe,"A",{href:!0,class:!0});var be=I(d);p=Q(be,"https://huggingface.co/docs/diffusers/index"),be.forEach(w),pe.forEach(w),O=se(le),E=V(le,"P",{});var _e=I(E);k=Q(_e,"Thanks to "),m=V(_e,"A",{href:!0,target:!0,rel:!0,class:!0});var at=I(m);b=Q(at,"Lnyan"),at.forEach(w),L=Q(_e,` - for the original outpaiting technique implemented on - `),v=V(_e,"A",{href:!0,target:!0,rel:!0,class:!0});var Ot=I(v);$=Q(Ot,`Stable Diffusion Infinity - `),Ot.forEach(w),A=Q(_e,"."),_e.forEach(w),R=se(le),H=V(le,"P",{class:!0});var At=I(H);N=Q(At,`Runwayml Inpaiting Stable Diffusion - `),U=V(At,"A",{href:!0,target:!0,rel:!0});var Se=I(U);X=Q(Se,"https://github.com/runwayml/stable-diffusion"),Se.forEach(w),At.forEach(w),Z=se(le),F=V(le,"P",{class:!0});var Ct=I(F);y=Q(Ct,`Multiplayer API by - `),ve(x.$$.fragment,Ct),Ct.forEach(w),le.forEach(w),oe.forEach(w),this.h()},h(){c(i,"class","font-bold text-xl font-mono mb-8"),c(u,"href","https://huggingface.co/docs/hub/spaces-gpus"),c(u,"class","text-blue-400 hover:text-blue-600 underline"),c(d,"href","https://huggingface.co/docs/diffusers/index"),c(d,"class","text-blue-400 hover:text-blue-600 underline"),c(m,"href","https://twitter.com/lkwq007"),c(m,"target","_blank"),c(m,"rel","noopener noreferrer"),c(m,"class","text-blue-400 hover:text-blue-600 underline"),c(v,"href","https://github.com/lkwq007/stablediffusion-infinity"),c(v,"target","_blank"),c(v,"rel","noopener noreferrer"),c(v,"class","text-blue-400 hover:text-blue-600 underline"),c(U,"href","https://github.com/runwayml/stable-diffusion"),c(U,"target","_blank"),c(U,"rel","noopener noreferrer"),c(H,"class","mb-6"),c(F,"class","text-base flex items-center"),c(n,"class","max-w-md"),c(t,"class",C="fixed "+e[0]+" w-screen top-0 left-0 bottom-0 right-0 max-h-screen z-50 items-center justify-center bg-black text-white bg-opacity-90 px-3 overflow-y-scroll")},m(W,oe){re(W,t,oe),g(t,n),D&&D.m(n,null),g(n,r),g(n,i),g(i,s),g(n,o),g(n,a),g(a,l),g(a,u),g(u,f),g(a,h),g(a,d),g(d,p),g(n,O),g(n,E),g(E,k),g(E,m),g(m,b),g(E,L),g(E,v),g(v,$),g(E,A),g(n,R),g(n,H),g(H,N),g(H,U),g(U,X),g(n,Z),g(n,F),g(F,y),ye(x,F,null),S=!0,T||(j=De(t,"click",e[2]),T=!0)},p(W,[oe]){W[1]?D?oe&2&&J(D,1):(D=hi(),D.c(),J(D,1),D.m(n,r)):D&&(Ne(),q(D,1,1,()=>{D=null}),Me()),(!S||oe&1&&C!==(C="fixed "+W[0]+" w-screen top-0 left-0 bottom-0 right-0 max-h-screen z-50 items-center justify-center bg-black text-white bg-opacity-90 px-3 overflow-y-scroll"))&&c(t,"class",C)},i(W){S||(J(D),J(x.$$.fragment,W),S=!0)},o(W){q(D),q(x.$$.fragment,W),S=!1},d(W){W&&w(t),D&&D.d(),we(x),T=!1,j()}}}function fh(e,t,n){let{classList:r=""}=t,{loading:i=!1}=t;function s(o){rr.call(this,e,o)}return e.$$set=o=>{"classList"in o&&n(0,r=o.classList),"loading"in o&&n(1,i=o.loading)},[r,i,s]}class yh extends Ee{constructor(t){super(),ke(this,t,fh,ch,xe,{classList:0,loading:1})}}export{yh as A,Mt as C,de as F,_h as L,cn as M,is as P,gh as R,he as S,vh as a,mh as c,Jr as s,Zr as t};