diff --git "a/static/_app/immutable/components/pages/_page.svelte-b786bb77.js" "b/static/_app/immutable/components/pages/_page.svelte-b786bb77.js" new file mode 100644--- /dev/null +++ "b/static/_app/immutable/components/pages/_page.svelte-b786bb77.js" @@ -0,0 +1,9 @@ +import{S as Ye,i as Ge,s as je,k as j,H as Yt,a as ce,q as xe,l as J,m as G,I as Gt,h as C,c as ue,r as Ee,n as A,b as oe,F as z,u as An,A as ge,v as Ie,w as Se,x as Ae,f as q,t as Q,y as Pe,G as he,o as ln,J as ie,K as It,L as ut,M as ei,N as dr,O as yo,P as wo,Q as bo,R as ko,T as xo,g as Xe,d as qe,U as Eo,e as Re,V as Oo,W as Io,X as So}from"../../chunks/index-78e14b76.js";import{w as Ue}from"../../chunks/index-307410f3.js";var Ao={value:()=>{}};function Yn(){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}})}Kt.prototype=Yn.prototype={constructor:Kt,on:function(e,t){var n=this._,r=Po(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),mr.hasOwnProperty(t)?{space:mr[t],local:e}:e}function Mo(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Pn&&t.documentElement.namespaceURI===Pn?t.createElement(e):t.createElementNS(n,e)}}function No(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ti(e){var t=cn(e);return(t.local?No:Mo)(t)}function Lo(){}function Gn(e){return e==null?Lo:function(){return this.querySelector(e)}}function Ro(e){typeof e!="function"&&(e=Gn(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=O&&(O=B+1);!($=R[O])&&++O=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function os(e){e||(e=ss);function t(h,m){return h&&m?e(h.__data__,m.__data__):!h-!m}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function as(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ls(){return Array.from(this)}function cs(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ws:typeof t=="function"?ks:bs)(e,t,n==null?"":n)):pt(this.node(),e)}function pt(e,t){return e.style.getPropertyValue(t)||si(e).getComputedStyle(e,null).getPropertyValue(t)}function Es(e){return function(){delete this[e]}}function Os(e,t){return function(){this[e]=t}}function Is(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ss(e,t){return arguments.length>1?this.each((t==null?Es:typeof t=="function"?Is:Os)(e,t)):this.node()[e]}function ai(e){return e.trim().split(/^|\s+/)}function jn(e){return e.classList||new li(e)}function li(e){this._node=e,this._names=ai(e.getAttribute("class")||"")}li.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 ci(e,t){for(var n=jn(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ta(e){return function(){var t=this.__on;if(!!t){for(var n=0,r=-1,i=t.length,o;n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Rt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Rt(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=da.exec(e))?new pe(t[1],t[2],t[3],1):(t=pa.exec(e))?new pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ma.exec(e))?Rt(t[1],t[2],t[3],t[4]):(t=_a.exec(e))?Rt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ga.exec(e))?kr(t[1],t[2]/100,t[3]/100,1):(t=va.exec(e))?kr(t[1],t[2]/100,t[3]/100,t[4]):_r.hasOwnProperty(e)?yr(_r[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function yr(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function Rt(e,t,n,r){return r<=0&&(e=t=n=NaN),new pe(e,t,n,r)}function ba(e){return e instanceof Nt||(e=ot(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function Nn(e,t,n,r){return arguments.length===1?ba(e):new pe(e,t,n,r==null?1:r)}function pe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Jn(pe,Nn,di(Nt,{brighter(e){return e=e==null?Jt:Math.pow(Jt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?St:Math.pow(St,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(nt(this.r),nt(this.g),nt(this.b),Wt(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:wr,formatHex:wr,formatHex8:ka,formatRgb:br,toString:br}));function wr(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}`}function ka(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function br(){const e=Wt(this.opacity);return`${e===1?"rgb(":"rgba("}${nt(this.r)}, ${nt(this.g)}, ${nt(this.b)}${e===1?")":`, ${e})`}`}function Wt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tt(e){return e=nt(e),(e<16?"0":"")+e.toString(16)}function kr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Oe(e,t,n,r)}function pi(e){if(e instanceof Oe)return new Oe(e.h,e.s,e.l,e.opacity);if(e instanceof Nt||(e=ot(e)),!e)return new Oe;if(e instanceof Oe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new Oe(s,a,l,e.opacity)}function xa(e,t,n,r){return arguments.length===1?pi(e):new Oe(e,t,n,r==null?1:r)}function Oe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Jn(Oe,xa,di(Nt,{brighter(e){return e=e==null?Jt:Math.pow(Jt,e),new Oe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?St:Math.pow(St,e),new Oe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new pe(yn(e>=240?e-240:e+120,i,r),yn(e,i,r),yn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Oe(xr(this.h),Ct(this.s),Ct(this.l),Wt(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=Wt(this.opacity);return`${e===1?"hsl(":"hsla("}${xr(this.h)}, ${Ct(this.s)*100}%, ${Ct(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xr(e){return e=(e||0)%360,e<0?e+360:e}function Ct(e){return Math.max(0,Math.min(1,e||0))}function yn(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 Wn=e=>()=>e;function Ea(e,t){return function(n){return e+n*t}}function Oa(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 Ia(e){return(e=+e)==1?mi:function(t,n){return n-t?Oa(t,n,e):Wn(isNaN(t)?n:t)}}function mi(e,t){var n=t-e;return n?Ea(e,n):Wn(isNaN(e)?t:e)}const Zt=function e(t){var n=Ia(t);function r(i,o){var s=n((i=Nn(i)).r,(o=Nn(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),c=mi(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=e,r}(1);function Sa(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:ke(r,i)})),n=wn.lastIndex;return n180?u+=360:u-c>180&&(c+=360),m.push({i:h.push(i(h)+"rotate(",null,r)-2,x:ke(c,u)})):u&&h.push(i(h)+"rotate("+u+r)}function a(c,u,h,m){c!==u?m.push({i:h.push(i(h)+"skewX(",null,r)-2,x:ke(c,u)}):u&&h.push(i(h)+"skewX("+u+r)}function l(c,u,h,m,g,P){if(c!==h||u!==m){var U=g.push(i(g)+"scale(",null,",",null,")");P.push({i:U-4,x:ke(c,h)},{i:U-2,x:ke(u,m)})}else(h!==1||m!==1)&&g.push(i(g)+"scale("+h+","+m+")")}return function(c,u){var h=[],m=[];return c=e(c),u=e(u),o(c.translateX,c.translateY,u.translateX,u.translateY,h,m),s(c.rotate,u.rotate,h,m),a(c.skewX,u.skewX,h,m),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,m),c=u=null,function(g){for(var P=-1,U=m.length,R;++P=0&&e._call.call(void 0,t),e=e._next;--mt}function Ir(){st=(en=Pt.now())+un,mt=bt=0;try{Ba()}finally{mt=0,qa(),st=0}}function Xa(){var e=Pt.now(),t=e-en;t>yi&&(un-=t,en=e)}function qa(){for(var e,t=Qt,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:Qt=n);kt=e,Cn(r)}function Cn(e){if(!mt){bt&&(bt=clearTimeout(bt));var t=e-st;t>24?(e<1/0&&(bt=setTimeout(Ir,e-Pt.now()-un)),yt&&(yt=clearInterval(yt))):(yt||(en=Pt.now(),yt=setInterval(Xa,yi)),mt=1,wi(Ir))}}function Sr(e,t,n){var r=new tn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Ya=Yn("start","end","cancel","interrupt"),Ga=[],ki=0,Ar=1,Un=2,Ht=3,Pr=4,Dn=5,Vt=6;function fn(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ja(e,n,{name:t,index:r,group:i,on:Ya,tween:Ga,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:ki})}function er(e,t){var n=Te(e,t);if(n.state>ki)throw new Error("too late; already scheduled");return n}function De(e,t){var n=Te(e,t);if(n.state>Ht)throw new Error("too late; already running");return n}function Te(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ja(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=bi(o,0,n.time);function o(c){n.state=Ar,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,h,m,g;if(n.state!==Ar)return l();for(u in r)if(g=r[u],g.name===n.name){if(g.state===Ht)return Sr(s);g.state===Pr?(g.state=Vt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[u]):+uUn&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Ol(e,t,n){var r,i,o=El(t)?er:De;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Il(e,t){var n=this._id;return arguments.length<2?Te(this.node(),n).on.on(e):this.each(Ol(n,e,t))}function Sl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Al(){return this.on("end.remove",Sl(this._id))}function Pl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gn(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s()=>e;function ec(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 Fe(e,t,n){this.k=e,this.x=t,this.y=n}Fe.prototype={constructor:Fe,scale:function(e){return e===1?this:new Fe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fe(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 nr=new Fe(1,0,0);Fe.prototype;function bn(e){e.stopImmediatePropagation()}function wt(e){e.preventDefault(),e.stopImmediatePropagation()}function tc(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function nc(){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 Tr(){return this.__zoom||nr}function rc(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ic(){return navigator.maxTouchPoints||"ontouchstart"in this}function oc(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function sc(){var e=tc,t=nc,n=oc,r=rc,i=ic,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ha,c=Yn("start","zoom","end"),u,h,m,g=500,P=150,U=0,R=10;function x(d){d.property("__zoom",Tr).on("wheel.zoom",y,{passive:!1}).on("mousedown.zoom",te).on("dblclick.zoom",W).filter(i).on("touchstart.zoom",b).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(d,E,p,v){var I=d.selection?d.selection():d;I.property("__zoom",Tr),d!==I?$(d,E,p,v):I.interrupt().each(function(){X(this,arguments).event(v).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},x.scaleBy=function(d,E,p,v){x.scaleTo(d,function(){var I=this.__zoom.k,S=typeof E=="function"?E.apply(this,arguments):E;return I*S},p,v)},x.scaleTo=function(d,E,p,v){x.transform(d,function(){var I=t.apply(this,arguments),S=this.__zoom,T=p==null?H(I):typeof p=="function"?p.apply(this,arguments):p,K=S.invert(T),Z=typeof E=="function"?E.apply(this,arguments):E;return n(O(B(S,Z),T,K),I,s)},p,v)},x.translateBy=function(d,E,p,v){x.transform(d,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof p=="function"?p.apply(this,arguments):p),t.apply(this,arguments),s)},null,v)},x.translateTo=function(d,E,p,v,I){x.transform(d,function(){var S=t.apply(this,arguments),T=this.__zoom,K=v==null?H(S):typeof v=="function"?v.apply(this,arguments):v;return n(nr.translate(K[0],K[1]).scale(T.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof p=="function"?-p.apply(this,arguments):-p),S,s)},v,I)};function B(d,E){return E=Math.max(o[0],Math.min(o[1],E)),E===d.k?d:new Fe(E,d.x,d.y)}function O(d,E,p){var v=E[0]-p[0]*d.k,I=E[1]-p[1]*d.k;return v===d.x&&I===d.y?d:new Fe(d.k,v,I)}function H(d){return[(+d[0][0]+ +d[1][0])/2,(+d[0][1]+ +d[1][1])/2]}function $(d,E,p,v){d.on("start.zoom",function(){X(this,arguments).event(v).start()}).on("interrupt.zoom end.zoom",function(){X(this,arguments).event(v).end()}).tween("zoom",function(){var I=this,S=arguments,T=X(I,S).event(v),K=t.apply(I,S),Z=p==null?H(K):typeof p=="function"?p.apply(I,S):p,de=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),ae=I.__zoom,me=typeof E=="function"?E.apply(I,S):E,ye=l(ae.invert(Z).concat(de/ae.k),me.invert(Z).concat(de/me.k));return function(_e){if(_e===1)_e=me;else{var le=ye(_e),vt=de/le[2];_e=new Fe(vt,Z[0]-le[0]*vt,Z[1]-le[1]*vt)}T.zoom(null,_e)}})}function X(d,E,p){return!p&&d.__zooming||new Y(d,E)}function Y(d,E){this.that=d,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(d,E),this.taps=0}Y.prototype={event:function(d){return d&&(this.sourceEvent=d),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(d,E){return this.mouse&&d!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&d!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&d!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(d){var E=Ve(this.that).datum();c.call(d,this.that,new ec(d,{sourceEvent:this.sourceEvent,target:x,type:d,transform:this.that.__zoom,dispatch:c}),E)}};function y(d,...E){if(!e.apply(this,arguments))return;var p=X(this,E).event(d),v=this.__zoom,I=Math.max(o[0],Math.min(o[1],v.k*Math.pow(2,r.apply(this,arguments)))),S=Qe(d);if(p.wheel)(p.mouse[0][0]!==S[0]||p.mouse[0][1]!==S[1])&&(p.mouse[1]=v.invert(p.mouse[0]=S)),clearTimeout(p.wheel);else{if(v.k===I)return;p.mouse=[S,v.invert(S)],Bt(this),p.start()}wt(d),p.wheel=setTimeout(T,P),p.zoom("mouse",n(O(B(v,I),p.mouse[0],p.mouse[1]),p.extent,s));function T(){p.wheel=null,p.end()}}function te(d,...E){if(m||!e.apply(this,arguments))return;var p=d.currentTarget,v=X(this,E,!0).event(d),I=Ve(d.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",de,!0),S=Qe(d,p),T=d.clientX,K=d.clientY;ua(d.view),bn(d),v.mouse=[S,this.__zoom.invert(S)],Bt(this),v.start();function Z(ae){if(wt(ae),!v.moved){var me=ae.clientX-T,ye=ae.clientY-K;v.moved=me*me+ye*ye>U}v.event(ae).zoom("mouse",n(O(v.that.__zoom,v.mouse[0]=Qe(ae,p),v.mouse[1]),v.extent,s))}function de(ae){I.on("mousemove.zoom mouseup.zoom",null),fa(ae.view,v.moved),wt(ae),v.event(ae).end()}}function W(d,...E){if(!!e.apply(this,arguments)){var p=this.__zoom,v=Qe(d.changedTouches?d.changedTouches[0]:d,this),I=p.invert(v),S=p.k*(d.shiftKey?.5:2),T=n(O(B(p,S),v,I),t.apply(this,E),s);wt(d),a>0?Ve(this).transition().duration(a).call($,T,v,d):Ve(this).call(x.transform,T,v,d)}}function b(d,...E){if(!!e.apply(this,arguments)){var p=d.touches,v=p.length,I=X(this,E,d.changedTouches.length===v).event(d),S,T,K,Z;for(bn(d),T=0;T{rt.update(i=>r)}),n=e.subscribe("others",r=>{Tt.update(i=>r)});return rt.set=r=>(e.updatePresence(r),r),()=>{t(),n()}}async function lc(e){try{const{root:t}=await e.getStorage(),n=t.get("imagesList");nn.set(n),e.subscribe(n,()=>{nn.update(r=>n)})}catch(t){console.log(t)}}const cc="PROD",uc="wss://spaces.huggingface.tech/huggingface-projects/sd-color-palette-generator/queue/join";var fc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Me={},D={};Object.defineProperty(D,"__esModule",{value:!0});var hc=Object.defineProperty,dc=Object.defineProperties,pc=Object.getOwnPropertyDescriptors,rn=Object.getOwnPropertySymbols,Ii=Object.prototype.hasOwnProperty,Si=Object.prototype.propertyIsEnumerable,Mr=(e,t,n)=>t in e?hc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lt=(e,t)=>{for(var n in t||(t={}))Ii.call(t,n)&&Mr(e,n,t[n]);if(rn)for(var n of rn(t))Si.call(t,n)&&Mr(e,n,t[n]);return e},hn=(e,t)=>dc(e,pc(t)),mc=(e,t)=>{var n={};for(var r in e)Ii.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&rn)for(var r of rn(e))t.indexOf(r)<0&&Si.call(e,r)&&(n[r]=e[r]);return n},_c=(e,t,n)=>new Promise((r,i)=>{var o=l=>{try{a(n.next(l))}catch(c){i(c)}},s=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(e,t)).next())});function gc(e,t=e){}function vc(e,t,n=t){}function yc(e){}function wc(e,t){}function Be(e,t){throw new Error(t)}function V(e,t="Expected value to be non-nullable"){return e}var Ai=(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))(Ai||{}),Pi=(e=>(e[e.INIT=0]="INIT",e[e.SET_PARENT_KEY=1]="SET_PARENT_KEY",e[e.CREATE_LIST=2]="CREATE_LIST",e[e.UPDATE_OBJECT=3]="UPDATE_OBJECT",e[e.CREATE_OBJECT=4]="CREATE_OBJECT",e[e.DELETE_CRDT=5]="DELETE_CRDT",e[e.DELETE_OBJECT_KEY=6]="DELETE_OBJECT_KEY",e[e.CREATE_MAP=7]="CREATE_MAP",e[e.CREATE_REGISTER=8]="CREATE_REGISTER",e))(Pi||{}),Ti=(e=>(e[e.OBJECT=0]="OBJECT",e[e.LIST=1]="LIST",e[e.MAP=2]="MAP",e[e.REGISTER=3]="REGISTER",e))(Ti||{});function bc(e){return e.type===0&&!Mi(e)}function Mi(e){return e.parentId!==void 0&&e.parentKey!==void 0}var Ni=(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))(Ni||{});function kc(e){return e==="my-presence"||e==="others"||e==="event"||e==="error"||e==="connection"||e==="history"}var Li=(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))(Li||{}),at=32,rr=126;function Le(e,t){return e!==void 0&&t!==void 0?on(Ri(_t(e),_t(t))):e!==void 0?Ec(e):t!==void 0?xc(t):on([at+1])}function xc(e){const t=[],n=_t(e);for(let r=0;ro)throw new Error(`Impossible to generate position between ${e} and ${t}`);if(i===o){r.push(i),n++;continue}if(o-i===1){r.push(i),r.push(...Ri(e.slice(n+1),[]));break}const s=o+i>>1;r.push(s);break}return r}function _t(e){const t=[];for(let n=0;ng.parentId===this._id);m&&this._propToLastUpdate.set(l,V(m.opId)),t.push(...h)}else i[l]=c,this._propToLastUpdate.set(l,r);this._map.set(l,c),this.invalidate(),s[l]={type:"update"}}Object.keys(o.data).length!==0&&n.unshift(o),Object.keys(i).length!==0&&t.unshift({opId:r,id:this._id,type:3,data:i});const a=new Map;a.set(this._id,{node:this,type:"LiveObject",updates:s}),this._pool.dispatch(t,n,a)}toImmutable(){return super.toImmutable()}_toImmutable(){const e={};for(const[t,n]of this._map)e[t]=Xt(n)?n.toImmutable():n;return e}},ir=e=>e;function Oc(e){return e.filter(t=>t!=null)}function Ic(e){const t=Lt({},e);return Object.keys(e).forEach(n=>{const r=n;t[r]===void 0&&delete t[r]}),t}function xt(e){return dt(Ui(e))}function Ui(e){switch(e.type){case 8:return e.data;case 4:return new We(e.data);case 7:return new Je;case 2:return new Ze;default:return Be(e,"Unknown creation Op")}}function Di(e,t){return e===t?!0:e.parent.type==="HasParent"?Di(e.parent.node,t):!1}function $i([e,t],n,r){switch(t.type){case 0:return We._deserialize([e,t],n,r);case 1:return Ze._deserialize([e,t],n,r);case 2:return Je._deserialize([e,t],n,r);case 3:return He._deserialize([e,t],n,r);default:throw new Error("Unexpected CRDT type")}}function Sc([e,t],n,r){switch(t.type){case 0:return We._deserialize([e,t],n,r);case 1:return Ze._deserialize([e,t],n,r);case 2:return Je._deserialize([e,t],n,r);case 3:return t.data;default:throw new Error("Unexpected CRDT type")}}function Xt(e){return zi(e)||Ac(e)||Fi(e)}function fe(e){return Xt(e)||Pc(e)}function zi(e){return e instanceof Ze}function Ac(e){return e instanceof Je}function Fi(e){return e instanceof We}function Pc(e){return e instanceof He}function it(e){return e instanceof He?e.data:e instanceof Ze||e instanceof Je||e instanceof We?e:Be(e,"Unknown AbstractCrdt")}function dt(e){return e instanceof We||e instanceof Je||e instanceof Ze?e:new He(e)}function Tc(e,t){const n=[];return e.forEach((r,i)=>{t.get(i)||n.push({type:5,id:i})}),t.forEach((r,i)=>{const o=e.get(i);if(o)r.type===0&&(o.type!==0||JSON.stringify(r.data)!==JSON.stringify(o.data))&&n.push({type:3,id:i,data:r.data}),r.parentKey!==o.parentKey&&n.push({type:1,id:i,parentKey:V(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 Mc(e,t){const n=e.updates;for(const[r,i]of Hi(t.updates))n[r]=i;return hn(Lt({},t),{updates:n})}function Nc(e,t){const n=e.updates;for(const[r,i]of Hi(t.updates))n[r]=i;return hn(Lt({},t),{updates:n})}function Lc(e,t){const n=e.updates;return hn(Lt({},t),{updates:n.concat(t.updates)})}function Rc(e,t){return e?e.type==="LiveObject"&&t.type==="LiveObject"?Mc(e,t):e.type==="LiveMap"&&t.type==="LiveMap"?Nc(e,t):e.type==="LiveList"&&t.type==="LiveList"?Lc(e,t):t:t}function Cr(e){const t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||or(e)}function or(e){return e!==null&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"}function Ki(e,t=""){if(!Cr)return{path:t||"root",value:e};if(typeof e!="object"||e===null)return!1;for(const[n,r]of Object.entries(e)){const i=t?t+"."+n:n;if(!Cr(r))return{path:i,value:r};if(typeof r=="object"){const o=Ki(r,i);if(o)return o}}return!1}function Cc(e){const t={};for(const[n,r]of e)t[n]=r;return t}function Hi(e){return Object.entries(e)}function Vi(e){try{return JSON.parse(e)}catch{return}}function Bi(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 Uc(e,t){return Ci(e._getParentKeyOrThrow(),t._getParentKeyOrThrow())}var Ze=class extends dn{constructor(e=[]){super(),this._items=[],this._implicitlyDeletedItems=new WeakSet,this._unacknowledgedSets=new Map;let t;for(let n=0;nt._getParentKeyOrThrow()===e)}_attach(e,t){super._attach(e,t);for(const n of this._items)n._attach(t.generateId(),t)}_detach(){super._detach();for(const e of this._items)e._detach()}_applySetRemote(e){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const{id:t,parentKey:n}=e,r=xt(e);r._attach(t,this._pool),r._setParentLink(this,n);const i=e.deletedId,o=this._indexOfPosition(n);if(o!==-1){const s=this._items[o];if(s._id===i)return s._detach(),this._items[o]=r,{modified:ee(this,[ct(o,r)]),reverse:[]};{this._implicitlyDeletedItems.add(s),this._items[o]=r;const a=[ct(o,r)],l=this._detachItemAssociatedToSetOperation(e.deletedId);return l&&a.push(l),{modified:ee(this,a),reverse:[]}}}else{const s=[],a=this._detachItemAssociatedToSetOperation(e.deletedId);return a&&s.push(a),this._insertAndSort(r),s.push(Ne(this._indexOfPosition(n),r)),{reverse:[],modified:ee(this,s)}}}_applySetAck(e){if(this._pool===void 0)throw new Error("Can't attach child if managed pool is not present");const t=[],n=this._detachItemAssociatedToSetOperation(e.deletedId);n&&t.push(n);const r=this._unacknowledgedSets.get(e.parentKey);if(r!==void 0){if(r!==e.opId)return t.length===0?{modified:!1}:{modified:ee(this,t),reverse:[]};this._unacknowledgedSets.delete(e.parentKey)}const i=this._indexOfPosition(e.parentKey),o=this._items.find(s=>s._id===e.id);if(o!==void 0){if(o._parentKey===e.parentKey)return{modified:t.length>0?ee(this,t):!1,reverse:[]};i!==-1&&(this._implicitlyDeletedItems.add(this._items[i]),this._items.splice(i,1),t.push($t(i)));const s=this._items.indexOf(o);o._setParentLink(this,e.parentKey),this._sortItems();const a=this._items.indexOf(o);return a!==s&&t.push(et(s,a,o)),{modified:t.length>0?ee(this,t):!1,reverse:[]}}else{const s=this._pool.getNode(e.id);if(s&&this._implicitlyDeletedItems.has(s)){s._setParentLink(this,e.parentKey),this._implicitlyDeletedItems.delete(s),this._insertAndSort(s);const a=this._items.indexOf(s);return{modified:ee(this,[i===-1?Ne(a,s):ct(a,s),...t]),reverse:[]}}else{i!==-1&&this._items.splice(i,1);const{newItem:a,newIndex:l}=this._createAttachItemAndSort(e,e.parentKey);return{modified:ee(this,[i===-1?Ne(l,a):ct(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:ee(this,[Ne(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 o=this._indexOfPosition(n);return o===i?{modified:!1}:{modified:ee(this,[et(i,o,t)]),reverse:[]}}}else{const i=V(this._pool).getNode(e.id);if(i&&this._implicitlyDeletedItems.has(i)){i._setParentLink(this,n),this._implicitlyDeletedItems.delete(i),this._insertAndSort(i);const o=this._indexOfPosition(n);return{modified:ee(this,[Ne(o,i)]),reverse:[]}}else{r!==-1&&this._shiftItemPosition(r,n);const{newItem:o,newIndex:s}=this._createAttachItemAndSort(e,n);return{modified:ee(this,[Ne(s,o)]),reverse:[]}}}}_applyInsertUndoRedo(e){var t;const{id:n,parentKey:r}=e,i=xt(e);if(((t=this._pool)==null?void 0:t.getNode(n))!==void 0)return{modified:!1};i._attach(n,V(this._pool)),i._setParentLink(this,r);const o=this._indexOfPosition(r);let s=r;if(o!==-1){const l=this._items[o]?this._items[o]._getParentKeyOrThrow():void 0,c=this._items[o+1]?this._items[o+1]._getParentKeyOrThrow():void 0;s=Le(l,c),i._setParentLink(this,s)}this._insertAndSort(i);const a=this._indexOfPosition(s);return{modified:ee(this,[Ne(a,i)]),reverse:[{type:5,id:n}]}}_applySetUndoRedo(e){var t;const{id:n,parentKey:r}=e,i=xt(e);if(((t=this._pool)==null?void 0:t.getNode(n))!==void 0)return{modified:!1};this._unacknowledgedSets.set(r,V(e.opId));const o=this._indexOfPosition(r);i._attach(n,V(this._pool)),i._setParentLink(this,r);const s=r;if(o!==-1){const a=this._items[o];a._detach(),this._items[o]=i;const l=a._toOps(V(this._id),r,this._pool);kn(l,e.id);const c=[ct(o,i)],u=this._detachItemAssociatedToSetOperation(e.deletedId);return u&&c.push(u),{modified:ee(this,c),reverse:l}}else{this._insertAndSort(i),this._detachItemAssociatedToSetOperation(e.deletedId);const a=this._indexOfPosition(s);return{reverse:[{type:5,id:n}],modified:ee(this,[Ne(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=V(e._parentKey),n=e._toOps(V(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:ee(this,[$t(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 o=this._items.indexOf(t);return{modified:ee(this,[Ne(o,t)]),reverse:[]}}const r=t._parentKey;if(e===r)return{modified:!1};const i=this._indexOfPosition(e);if(i===-1){const o=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return s===o?{modified:!1}:{modified:ee(this,[et(o,s,t)]),reverse:[]}}else{this._items[i]._setParentLink(this,Le(e,(n=this._items[i+1])==null?void 0:n._getParentKeyOrThrow()));const o=this._items.indexOf(t);t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return s===o?{modified:!1}:{modified:ee(this,[et(o,s,t)]),reverse:[]}}}_applySetChildKeyAck(e,t){var n,r;const i=V(t._parentKey);if(this._implicitlyDeletedItems.has(t)){const o=this._indexOfPosition(e);return this._implicitlyDeletedItems.delete(t),o!==-1&&this._items[o]._setParentLink(this,Le(e,(n=this._items[o+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._insertAndSort(t),{modified:!1}}else{if(e===i)return{modified:!1};const o=this._items.indexOf(t),s=this._indexOfPosition(e);s!==-1&&this._items[s]._setParentLink(this,Le(e,(r=this._items[s+1])==null?void 0:r._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const a=this._items.indexOf(t);return o===a?{modified:!1}:{modified:ee(this,[et(o,a,t)]),reverse:[]}}}_applySetChildKeyUndoRedo(e,t){var n;const r=V(t._parentKey),i=this._items.indexOf(t),o=this._indexOfPosition(e);o!==-1&&this._items[o]._setParentLink(this,Le(e,(n=this._items[o+1])==null?void 0:n._getParentKeyOrThrow())),t._setParentLink(this,e),this._sortItems();const s=this._items.indexOf(t);return i===s?{modified:!1}:{modified:ee(this,[et(i,s,t)]),reverse:[{type:1,id:V(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:V(this.parent.node._id,"Parent node expected to have ID"),parentKey:this.parent.key}}get length(){return this._items.length}push(e){return this.insert(e,this.length)}insert(e,t){if(t<0||t>this._items.length)throw new Error(`Cannot insert list item at index "${t}". index should be between 0 and ${this._items.length}`);const n=this._items[t-1]?this._items[t-1]._getParentKeyOrThrow():void 0,r=this._items[t]?this._items[t]._getParentKeyOrThrow():void 0,i=Le(n,r),o=dt(e);if(o._setParentLink(this,i),this._insertAndSort(o),this._pool&&this._id){const s=this._pool.generateId();o._attach(s,this._pool),this._pool.dispatch(o._toOps(this._id,i,this._pool),[{type:5,id:s}],new Map([[this._id,ee(this,[Ne(t,o)])]]))}}move(e,t){if(t<0)throw new Error("targetIndex cannot be less than 0");if(t>=this._items.length)throw new Error("targetIndex cannot be greater or equal than the list length");if(e<0)throw new Error("index cannot be less than 0");if(e>=this._items.length)throw new Error("index cannot be greater or equal than the list length");let n=null,r=null;e=this._items.length)throw new Error(`Cannot delete list item at index "${e}". index should be between 0 and ${this._items.length-1}`);const t=this._items[e];if(t._detach(),this._items.splice(e,1),this.invalidate(),this._pool){const n=t._id;if(n){const r=new Map;r.set(V(this._id),ee(this,[$t(e)])),this._pool.dispatch([{id:n,opId:this._pool.generateOpId(),type:5}],t._toOps(V(this._id),t._getParentKeyOrThrow()),r)}}}clear(){if(this._pool){const e=[],t=[],n=[];for(const i of this._items){i._detach();const o=i._id;o&&(e.push({type:5,id:o,opId:this._pool.generateOpId()}),t.push(...i._toOps(V(this._id),i._getParentKeyOrThrow())),n.push($t(0)))}this._items=[],this.invalidate();const r=new Map;r.set(V(this._id),ee(this,n)),this._pool.dispatch(e,t,r)}else{for(const e of this._items)e._detach();this._items=[],this.invalidate()}}set(e,t){if(e<0||e>=this._items.length)throw new Error(`Cannot set list item at index "${e}". index should be between 0 and ${this._items.length-1}`);const n=this._items[e],r=n._getParentKeyOrThrow(),i=n._id;n._detach();const o=dt(t);if(o._setParentLink(this,r),this._items[e]=o,this.invalidate(),this._pool&&this._id){const s=this._pool.generateId();o._attach(s,this._pool);const a=new Map;a.set(this._id,ee(this,[ct(e,o)]));const l=o._toOps(this._id,r,this._pool);kn(l,i),this._unacknowledgedSets.set(r,V(l[0].opId));const c=n._toOps(this._id,r,void 0);kn(c,s),this._pool.dispatch(l,c,a)}}toArray(){return this._items.map(e=>it(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 it(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(it(t),n))}some(e){return this.toArray().some(e)}[Symbol.iterator](){return new Dc(this._items)}_createAttachItemAndSort(e,t){const n=xt(e);n._attach(e.id,V(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=Le(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())}},Dc=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:it(e.value)}}};function ee(e,t){return{node:e,type:"LiveList",updates:t}}function ct(e,t){return{index:e,type:"set",item:t instanceof He?t.data:t}}function $t(e){return{index:e,type:"delete"}}function Ne(e,t){return{index:e,type:"insert",item:t instanceof He?t.data:t}}function et(e,t,n){return{index:t,type:"move",previousIndex:e,item:n instanceof He?n.data:n}}function kn(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 $c=["websocket:presence","websocket:storage","room:read","room:write","rooms:read","rooms:write"];function zc(e){if(!or(e))return!1;const{iat:t,exp:n}=e;return typeof t=="number"&&typeof n=="number"}function Fc(e){const t=Date.now()/1e3;return t>e.exp-300||ttypeof t=="string")}function qi(e){return typeof e.appId=="string"&&e.roomId===void 0&&Xi(e.scopes)}function sr(e){return typeof e.appId=="string"&&typeof e.roomId=="string"&&typeof e.actor=="number"&&(e.id===void 0||typeof e.id=="string")&&Xi(e.scopes)&&(e.maxConnectionsPerRoom===void 0||typeof e.maxConnectionsPerRoom=="number")}function Hc(e){return qi(e)||sr(e)}function Vc(e){const t=e.split(".");if(t.length!==3)throw new Error("Authentication error: invalid JWT token");const n=Vi(Bi(t[1]));if(n&&zc(n))return n;throw new Error("Authentication error: missing JWT metadata")}function Bc(e){const t=Vc(e);if(t&&sr(t))return mc(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 Xc(e){return Object.defineProperty(e,"count",{value:e.length,enumerable:!1}),Object.defineProperty(e,"toArray",{value:()=>e,enumerable:!1}),ir(e)}function Yi(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Gi(e){return Array.isArray(e)}function qc(e){return!Yi(e)&&!Gi(e)}D.__spreadValues=Lt;D.__spreadProps=hn;D.__async=_c;D.deprecate=gc;D.deprecateIf=vc;D.throwUsageError=yc;D.errorIf=wc;D.assertNever=Be;D.nn=V;D.ClientMsgCode=Ai;D.OpCode=Pi;D.CrdtType=Ti;D.isRootCrdt=bc;D.isChildCrdt=Mi;D.ServerMsgCode=Ni;D.isRoomEventName=kc;D.WebsocketCloseCodes=Li;D.LiveRegister=He;D.makePosition=Le;D.comparePosition=Ci;D.LiveList=Ze;D.LiveMap=Je;D.LiveObject=We;D.freeze=ir;D.compact=Oc;D.compactObject=Ic;D.isSameNodeOrChildOf=Di;D.isLiveNode=fe;D.isLiveList=zi;D.isLiveObject=Fi;D.getTreesDiffOperations=Tc;D.mergeStorageUpdates=Rc;D.isPlainObject=or;D.findNonSerializableValue=Ki;D.tryParseJson=Vi;D.b64decode=Bi;D.isTokenExpired=Fc;D.isScope=Kc;D.isAppOnlyAuthToken=qi;D.isRoomAuthToken=sr;D.isAuthToken=Hc;D.parseRoomAuthToken=Bc;D.asArrayWithLegacyMethods=Xc;D.isJsonScalar=Yi;D.isJsonArray=Gi;D.isJsonObject=qc;Object.defineProperty(Me,"__esModule",{value:!0});var L=D;function ze(){const e=new Set,t=new Set;function n(s){return t.add(s),()=>t.delete(s)}function r(s){return e.add(s),()=>e.delete(s)}function i(s){e.forEach(a=>a(s)),e.clear(),t.forEach(a=>a(s))}function o(){e.clear(),t.clear()}return{notify:i,subscribe:n,subscribeOnce:r,clear:o,observable:{subscribe:n,subscribeOnce:r}}}function ji(e,t){let n=!1;const r=L.__spreadValues.call(void 0,{},e);return Object.keys(t).forEach(i=>{const o=i,s=t[o];r[o]!==s&&(s===void 0?delete r[o]:r[o]=s,n=!0)}),n?r:e}var pn=class{constructor(){this._ev=ze()}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()}},Yc=class extends pn{constructor(e){super(),this._me=L.freeze.call(void 0,L.compactObject.call(void 0,e))}_toImmutable(){return this._me}patch(e){const t=this._me,n=ji(t,e);t!==n&&(this._me=L.freeze.call(void 0,n),this.invalidate())}};function Gc(e,t){return L.freeze.call(void 0,L.compactObject.call(void 0,L.__spreadProps.call(void 0,L.__spreadValues.call(void 0,{},e),{presence:t})))}var jc=class extends pn{constructor(){super(),this._connections={},this._presences={},this._users={}}_toImmutable(){const e=L.compact.call(void 0,Object.keys(this._presences).map(t=>this.getUser(Number(t))));return L.asArrayWithLegacyMethods.call(void 0,e)}clearOthers(){this._connections={},this._presences={},this._users={},this.invalidate()}_getUser(e){const t=this._connections[e],n=this._presences[e];if(t!==void 0&&n!==void 0)return Gc(t,n)}getUser(e){const t=this._users[e];if(t)return t;const n=this._getUser(e);if(n)return this._users[e]=n,n}_invalidateUser(e){this._users[e]!==void 0&&delete this._users[e],this.invalidate()}setConnection(e,t,n){this._connections[e]=L.freeze.call(void 0,{connectionId:e,id:t,info:n}),this._presences[e]!==void 0&&this._invalidateUser(e)}removeConnection(e){delete this._connections[e],delete this._presences[e],this._invalidateUser(e)}setOther(e,t){this._presences[e]=L.freeze.call(void 0,L.compactObject.call(void 0,t)),this._connections[e]!==void 0&&this._invalidateUser(e)}patchOther(e,t){const n=this._presences[e];if(n===void 0)return;const r=ji(n,t);n!==r&&(this._presences[e]=L.freeze.call(void 0,r),this._invalidateUser(e))}},Jc=class extends pn{constructor(e){super(),this._value=L.freeze.call(void 0,L.compactObject.call(void 0,e))}_toImmutable(){return this._value}set(e){this._value=L.freeze.call(void 0,e),this.invalidate()}},Wc=class extends pn{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)}},xn=[250,500,1e3,2e3,4e3,8e3,1e4],En=[2e3,3e4,6e4,3e5],Zc=3e4,Qc=2e3;function eu(e){let t=0;return()=>`${e}:${t++}`}function On(e){return e.state==="open"||e.state==="connecting"}function tu(e,t,n){const r={roomId:t.roomId,getNode:f=>e.nodes.get(f),addNode:(f,_)=>void e.nodes.set(f,_),deleteNode:f=>void e.nodes.delete(f),generateId:()=>`${P()}:${e.clock++}`,generateOpId:()=>`${P()}:${e.opClock++}`,dispatch(f,_,w){const k=e.activeBatch;k?(k.ops.push(...f),w.forEach((N,se)=>{k.updates.storageUpdates.set(se,L.mergeStorageUpdates.call(void 0,k.updates.storageUpdates.get(se),N))}),k.reverseOps.push(..._)):(m(_),e.redoStack=[],cr(f),g({storageUpdates:w}))}},i={customEvent:ze(),me:ze(),others:ze(),error:ze(),connection:ze(),storage:ze(),history:ze(),storageDidLoad:ze()},o=n||{authenticate(f,_){const w=e.token,k=w!==null&&L.parseRoomAuthToken.call(void 0,w);if(k&&!L.isTokenExpired.call(void 0,k)){const N=_(w);Y(k,N)}else return f(t.roomId).then(({token:N})=>{if(e.connection.current.state!=="authenticating")return;const se=L.parseRoomAuthToken.call(void 0,N),re=_(N);Y(se,re),e.token=N}).catch(N=>y())},send(f){if(e.socket===null)throw new Error("Can't send message if socket is null");e.socket.send(JSON.stringify(f))},delayFlush(f){return setTimeout(le,f)},startHeartbeatInterval(){return setInterval(ae,Zc)},schedulePongTimeout(){return setTimeout(me,Qc)},scheduleReconnect(f){return setTimeout($,f)}},s=new Wc([e.connection,e.me],(f,_)=>On(f)?{connectionId:f.id,id:f.userId,info:f.userInfo,presence:_}:null);function a(f){if(f.items.length===0)throw new Error("Internal error: cannot load storage without items");e.root?c(f.items):e.root=u(f.items);for(const _ in e.initialStorage)e.root.get(_)===void 0&&e.root.set(_,e.initialStorage[_])}function l(f){const _=new Map;let w=null;for(const[k,N]of f)if(L.isRootCrdt.call(void 0,N))w=[k,N];else{const se=[k,N],re=_.get(N.parentId);re!==void 0?re.push(se):_.set(N.parentId,[se])}if(w===null)throw new Error("Root can't be null");return[w,_]}function c(f){if(!e.root)return;const _=new Map;e.nodes.forEach((N,se)=>{_.set(se,N._serialize())});const w=L.getTreesDiffOperations.call(void 0,_,new Map(f)),k=U(w,!1);g(k.updates)}function u(f){const[_,w]=l(f);return L.LiveObject._deserialize(_,w,r)}function h(f){e.undoStack.length>=50&&e.undoStack.shift(),e.undoStack.push(f),d()}function m(f){e.pausedHistory!==null?e.pausedHistory.unshift(...f):h(f)}function g({storageUpdates:f=new Map,presence:_=!1,others:w=[]}){if(w.length>0){const k=e.others.current;for(const N of w)i.others.notify({others:k,event:N})}if(_&&i.me.notify(e.me.current),f.size>0){const k=Array.from(f.values());i.storage.notify(k)}}function P(){const f=e.connection.current;if(On(f))return f.id;if(e.lastConnectionId!==null)return e.lastConnectionId;throw new Error("Internal. Tried to get connection id but connection was never open")}function U(f,_){const w={reverse:[],updates:{storageUpdates:new Map,presence:!1}},k=new Set;for(const N of f)if(N.type==="presence"){const se={type:"presence",data:{}};for(const re in N.data)se.data[re]=e.me.current[re];if(e.me.patch(N.data),e.buffer.me===null)e.buffer.me={type:"partial",data:N.data};else for(const re in N.data)e.buffer.me.data[re]=N.data[re];w.reverse.unshift(se),w.updates.presence=!0}else{let se;N.opId||(N.opId=r.generateOpId()),_?se=0:se=e.offlineOperations.delete(L.nn.call(void 0,N.opId))?2:1;const re=R(N,se);if(re.modified){const vn=re.modified.node.parent.type==="HasParent"?L.nn.call(void 0,re.modified.node.parent.node._id,"Expected parent node to have an ID"):void 0;(!vn||!k.has(vn))&&(w.updates.storageUpdates.set(L.nn.call(void 0,re.modified.node._id),L.mergeStorageUpdates.call(void 0,w.updates.storageUpdates.get(L.nn.call(void 0,re.modified.node._id)),re.modified)),w.reverse.unshift(...re.reverse)),(N.type===2||N.type===7||N.type===4)&&k.add(L.nn.call(void 0,re.modified.node._id))}}return w}function R(f,_){switch(f.type){case 6:case 3:case 5:{const w=e.nodes.get(f.id);return w===void 0?{modified:!1}:w._apply(f,_===0)}case 1:{const w=e.nodes.get(f.id);return w===void 0?{modified:!1}:w.parent.type==="HasParent"&&L.isLiveList.call(void 0,w.parent.node)?w.parent.node._setChildKey(f.parentKey,w,_):{modified:!1}}case 4:case 2:case 7:case 8:{if(f.parentId===void 0)return{modified:!1};const w=e.nodes.get(f.parentId);return w===void 0?{modified:!1}:w._attachChild(f,_)}}}function x(f,_){return i.storage.subscribe(w=>{const k=w.filter(N=>L.isSameNodeOrChildOf.call(void 0,N.node,f));k.length>0&&_(k)})}function B(f,_){return i.storage.subscribe(w=>{for(const k of w)k.node._id===f._id&&_(k.node)})}function O(f,_,w){if(typeof f=="string"&&L.isRoomEventName.call(void 0,f)){if(typeof _!="function")throw new Error("Second argument must be a callback function");const k=_;switch(f){case"event":return i.customEvent.subscribe(k);case"my-presence":return i.me.subscribe(k);case"others":{const N=k;return i.others.subscribe(({others:se,event:re})=>N(se,re))}case"error":return i.error.subscribe(k);case"connection":return i.connection.subscribe(k);case"storage":return i.storage.subscribe(k);case"history":return i.history.subscribe(k);default:return L.assertNever.call(void 0,f,"Unknown event")}}if(_===void 0||typeof f=="function")if(typeof f=="function"){const k=f;return i.storage.subscribe(k)}else throw new Error("Please specify a listener callback");if(L.isLiveNode.call(void 0,f)){const k=f;return w!=null&&w.isDeep?x(k,_):B(k,_)}throw new Error(`"${f}" is not a valid event name`)}function H(){return e.connection.current.state}function $(){var f,_,w,k;if(e.connection.current.state!=="closed"&&e.connection.current.state!=="unavailable")return null;const N=su(t.authentication,(_=(f=t.polyfills)==null?void 0:f.fetch)!=null?_:t.fetchPolyfill),se=ou(t.liveblocksServer,(k=(w=t.polyfills)==null?void 0:w.WebSocket)!=null?k:t.WebSocketPolyfill);T({state:"authenticating"}),o.authenticate(N,se)}function X(f,_){const w={};e.buffer.me===null&&(e.buffer.me={type:"partial",data:{}});for(const k in f){const N=f[k];N!==void 0&&(e.buffer.me.data[k]=N,w[k]=e.me.current[k])}e.me.patch(f),e.activeBatch?(_!=null&&_.addToHistory&&e.activeBatch.reverseOps.push({type:"presence",data:w}),e.activeBatch.updates.presence=!0):(le(),_!=null&&_.addToHistory&&m([{type:"presence",data:w}]),g({presence:!0}))}function Y(f,_){_.addEventListener("message",I),_.addEventListener("open",de),_.addEventListener("close",S),_.addEventListener("error",Z),T({state:"connecting",id:f.actor,userInfo:f.info,userId:f.id}),e.idFactory=eu(f.actor),e.socket=_}function y(f){e.token=null,T({state:"unavailable"}),e.numberOfRetry++,e.timeoutHandles.reconnect=o.scheduleReconnect(K())}function te(f){f==="visible"&&e.connection.current.state==="open"&&ae()}function W(f){if(f.targetActor!==void 0){const w=e.others.getUser(f.actor);e.others.setOther(f.actor,f.data);const k=e.others.getUser(f.actor);if(w===void 0&&k!==void 0)return{type:"enter",user:k}}else e.others.patchOther(f.actor,f.data);const _=e.others.getUser(f.actor);if(_)return{type:"update",updates:f.data,user:_}}function b(f){const _=e.others.getUser(f.actor);return _?(e.others.removeConnection(f.actor),{type:"leave",user:_}):null}function F(f){for(const _ in f.users){const w=f.users[_],k=Number(_);e.others.setConnection(k,w.id,w.info)}return{type:"reset"}}function M(){e.connection.current.state==="unavailable"&&ye()}function d(){i.history.notify({canUndo:fr(),canRedo:hr()})}function E(f){e.others.setConnection(f.actor,f.id,f.info),e.buffer.messages.push({type:100,data:e.me.current,targetActor:f.actor}),le();const _=e.others.getUser(f.actor);return _?{type:"enter",user:_}:void 0}function p(f){return L.isJsonObject.call(void 0,f)?f:null}function v(f){const _=L.tryParseJson.call(void 0,f);return _===void 0?null:L.isJsonArray.call(void 0,_)?L.compact.call(void 0,_.map(w=>p(w))):L.compact.call(void 0,[p(_)])}function I(f){if(f.data==="pong"){clearTimeout(e.timeoutHandles.pongTimeout);return}const _=v(f.data);if(_===null||_.length===0)return;const w={storageUpdates:new Map,others:[]};for(const k of _)switch(k.type){case 101:{const N=E(k);N&&w.others.push(N);break}case 100:{const N=W(k);N&&w.others.push(N);break}case 103:{i.customEvent.notify({connectionId:k.actor,event:k.event});break}case 102:{const N=b(k);N&&w.others.push(N);break}case 104:{w.others.push(F(k));break}case 200:{const N=new Map(e.offlineOperations);a(k),_e(N),gn==null||gn(),i.storageDidLoad.notify();break}case 201:{U(k.ops,!1).updates.storageUpdates.forEach((se,re)=>{w.storageUpdates.set(re,L.mergeStorageUpdates.call(void 0,w.storageUpdates.get(re),se))});break}}g(w)}function S(f){if(e.socket=null,clearTimeout(e.timeoutHandles.pongTimeout),clearInterval(e.intervalHandles.heartbeat),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),e.others.clearOthers(),g({others:[{type:"reset"}]}),f.code>=4e3&&f.code<=4100){T({state:"failed"});const _=new iu(f.reason,f.code);i.error.notify(_);const w=K(!0);e.numberOfRetry++,T({state:"unavailable"}),e.timeoutHandles.reconnect=o.scheduleReconnect(w)}else if(f.code===4999)T({state:"closed"});else{const _=K();e.numberOfRetry++,T({state:"unavailable"}),e.timeoutHandles.reconnect=o.scheduleReconnect(_)}}function T(f){e.connection.set(f),i.connection.notify(f.state)}function K(f=!1){return f?En[e.numberOfRetry0&&f.forEach(k=>{e.offlineOperations.set(L.nn.call(void 0,k.opId),k)}),e.socket===null||e.socket.readyState!==e.socket.OPEN){e.buffer.storageOperations=[];return}const _=Date.now();if(_-e.lastFlushTime>t.throttleDelay){const k=vt(e);if(k.length===0)return;o.send(k),e.buffer={messages:[],storageOperations:[],me:null},e.lastFlushTime=_}else e.timeoutHandles.flush!==null&&clearTimeout(e.timeoutHandles.flush),e.timeoutHandles.flush=o.delayFlush(t.throttleDelay-(_-e.lastFlushTime))}function vt(f){const _=[];f.buffer.me&&_.push(f.buffer.me.type==="full"?{type:100,targetActor:-1,data:f.buffer.me.data}:{type:100,data:f.buffer.me.data});for(const w of f.buffer.messages)_.push(w);return f.buffer.storageOperations.length>0&&_.push({type:201,ops:f.buffer.storageOperations}),_}function oo(){e.socket&&(e.socket.removeEventListener("open",de),e.socket.removeEventListener("message",I),e.socket.removeEventListener("close",S),e.socket.removeEventListener("error",Z),e.socket.close(),e.socket=null),T({state:"closed"}),e.timeoutHandles.flush&&clearTimeout(e.timeoutHandles.flush),clearTimeout(e.timeoutHandles.reconnect),clearTimeout(e.timeoutHandles.pongTimeout),clearInterval(e.intervalHandles.heartbeat),e.others.clearOthers(),g({others:[{type:"reset"}]}),Object.values(i).forEach(f=>f.clear())}function so(){return e.me.current}function ao(){return e.others.current}function lo(f,_={shouldQueueEventIfNotReady:!1}){e.socket===null&&!_.shouldQueueEventIfNotReady||(e.buffer.messages.push({type:103,event:f}),le())}function cr(f){e.buffer.storageOperations.push(...f),le()}let _n=null,gn=null;function ur(){return _n===null&&(e.buffer.messages.push({type:200}),le(),_n=new Promise(f=>gn=f)),_n}function co(){const f=e.root;return f!==void 0?f:(ur(),null)}function uo(){return L.__async.call(void 0,this,null,function*(){return e.root?Promise.resolve({root:e.root}):(yield ur(),{root:L.nn.call(void 0,e.root)})})}function fo(){if(e.activeBatch)throw new Error("undo is not allowed during a batch");const f=e.undoStack.pop();if(f===void 0)return;e.pausedHistory=null;const _=U(f,!0);g(_.updates),e.redoStack.push(_.reverse),d();for(const w of f)w.type!=="presence"&&e.buffer.storageOperations.push(w);le()}function fr(){return e.undoStack.length>0}function ho(){if(e.activeBatch)throw new Error("redo is not allowed during a batch");const f=e.redoStack.pop();if(f===void 0)return;e.pausedHistory=null;const _=U(f,!0);g(_.updates),e.undoStack.push(_.reverse),d();for(const w of f)w.type!=="presence"&&e.buffer.storageOperations.push(w);le()}function hr(){return e.redoStack.length>0}function po(f){if(e.activeBatch)return f();e.activeBatch={ops:[],updates:{storageUpdates:new Map,presence:!1,others:[]},reverseOps:[]};try{return f()}finally{const _=e.activeBatch;e.activeBatch=null,_.reverseOps.length>0&&m(_.reverseOps),_.ops.length>0&&(e.redoStack=[]),_.ops.length>0&&cr(_.ops),g(_.updates),le()}}function mo(){e.pausedHistory=[]}function _o(){const f=e.pausedHistory;e.pausedHistory=null,f!==null&&f.length>0&&h(f)}function go(){e.socket&&(e.socket=null)}function vo(f){S(f)}return{onClose:S,onMessage:I,authenticationSuccess:Y,heartbeat:ae,onNavigatorOnline:M,simulateSocketClose:go,simulateSendCloseEvent:vo,onVisibilityChange:te,getUndoStack:()=>e.undoStack,getItemsCount:()=>e.nodes.size,connect:$,disconnect:oo,subscribe:O,updatePresence:X,broadcastEvent:lo,batch:po,undo:fo,redo:ho,canUndo:fr,canRedo:hr,pauseHistory:mo,resumeHistory:_o,getStorage:uo,getStorageSnapshot:co,events:{customEvent:i.customEvent.observable,others:i.others.observable,me:i.me.observable,error:i.error.observable,connection:i.connection.observable,storage:i.storage.observable,history:i.history.observable,storageDidLoad:i.storageDidLoad.observable},getConnectionState:H,isSelfAware:()=>On(e.connection.current),getSelf:()=>s.current,getPresence:so,getOthers:ao}}function nu(e,t){const n=new jc,r=new Jc({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 Yc(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 ru(e,t){const{initialPresence:n,initialStorage:r}=e,i=nu(typeof n=="function"?n(t.roomId):n,typeof r=="function"?r(t.roomId):r),o=tu(i,t),s={id:t.roomId,getConnectionState:o.getConnectionState,isSelfAware:o.isSelfAware,getSelf:o.getSelf,subscribe:o.subscribe,getPresence:o.getPresence,updatePresence:o.updatePresence,getOthers:o.getOthers,broadcastEvent:o.broadcastEvent,getStorage:o.getStorage,getStorageSnapshot:o.getStorageSnapshot,events:o.events,batch:o.batch,history:{undo:o.undo,redo:o.redo,canUndo:o.canUndo,canRedo:o.canRedo,pause:o.pauseHistory,resume:o.resumeHistory},__INTERNAL_DO_NOT_USE:{simulateCloseWebsocket:o.simulateSocketClose,simulateSendCloseEvent:o.simulateSendCloseEvent}};return{connect:o.connect,disconnect:o.disconnect,onNavigatorOnline:o.onNavigatorOnline,onVisibilityChange:o.onVisibilityChange,room:s}}var iu=class extends Error{constructor(e,t){super(e),this.code=t}};function ou(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.2`)}function su(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=>Ur(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=>Ur(t||fetch,e.url,{room:n})}if(e.type==="custom")return n=>L.__async.call(void 0,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 Ur(e,t,n){return L.__async.call(void 0,this,null,function*(){const r=yield e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new In(`Expected a status 200 but got ${r.status} when doing a POST request on "${t}"`);let i;try{i=yield r.json()}catch(s){throw new In(`Expected a JSON response when doing a POST request on "${t}". ${s}`)}if(!L.isPlainObject.call(void 0,i)||typeof i.token!="string")throw new In(`Expected a JSON response of the form \`{ token: "..." }\` when doing a POST request on "${t}", but got ${JSON.stringify(i)}`);const{token:o}=i;return{token:o}})}var In=class extends Error{constructor(e){super(e)}};function au(e){const t=e,n=lu(e),r=new Map;function i(a){const l=r.get(a);return l?l.room:null}function o(a,l){var c,u;let h=r.get(a);if(h)return h.room;if(L.deprecateIf.call(void 0,l.initialPresence===null||l.initialPresence===void 0,"Please provide an initial presence value for the current user when entering the room."),h=ru({initialPresence:(c=l.initialPresence)!=null?c:{},initialStorage:l.initialStorage},{roomId:a,throttleDelay:n,polyfills:t.polyfills,WebSocketPolyfill:t.WebSocketPolyfill,fetchPolyfill:t.fetchPolyfill,liveblocksServer:(t==null?void 0:t.liveblocksServer)||"wss://api.liveblocks.io/v6",authentication:cu(t,a)}),r.set(a,h),!l.DO_NOT_USE_withoutConnecting){if(typeof atob>"u"){if(((u=t.polyfills)==null?void 0:u.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");fc.atob=t.polyfills.atob}h.connect()}return h.room}function s(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:o,leave:s}}function lu(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 cu(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:uu(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 uu(e,t){return e.publicAuthorizeEndpoint?e.publicAuthorizeEndpoint.replace("{roomId}",t):`https://api.liveblocks.io/v2/rooms/${encodeURIComponent(t)}/public/authorize`}function fu(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 du(e,t){if(Object.is(e,t))return!0;const n=Array.isArray(e),r=Array.isArray(t);return n||r?!n||!r?!1:fu(e,t):hu(e,t)}Me.LiveList=L.LiveList;Me.LiveMap=L.LiveMap;Me.LiveObject=L.LiveObject;Me.createClient=au;Me.shallow=du;const pu=Me.LiveList;Me.LiveMap;Me.LiveObject;const mu=Me.createClient;Me.shallow;function _u(e){let t,n,r,i,o,s,a,l;return{c(){t=j("div"),n=Yt("svg"),r=Yt("path"),i=ce(),o=j("div"),s=xe(e[2]),this.h()},l(c){t=J(c,"DIV",{class:!0,style:!0});var u=G(t);n=Gt(u,"svg",{class:!0,width:!0,viewBox:!0,fill:!0,xmlns:!0});var h=G(n);r=Gt(h,"path",{d:!0,fill:!0}),G(r).forEach(C),h.forEach(C),i=ue(u),o=J(u,"DIV",{class:!0,style:!0});var m=G(o);s=Ee(m,e[2]),m.forEach(C),u.forEach(C),this.h()},h(){A(r,"d","M0.91603 0.916054L7.09131 14.9234L8.89871 8.89873L14.9234 7.09133L0.91603 0.916054Z"),A(r,"fill","#FFB800"),A(n,"class","block z-0 col-span-2 row-span-2"),A(n,"width","40"),A(n,"viewBox","0 0 15 15"),A(n,"fill","currentColor"),A(n,"xmlns","http://www.w3.org/2000/svg"),A(o,"class","absolute right-0 text-4xl col-start-2 row-start-2"),A(o,"style",a=`text-shadow: 0px 5px 5px ${e[1]}`),A(t,"class","cursor svelte-14ka0w3"),A(t,"style",l=`transform: translateX(${e[3].x}px) translateY(${e[3].y}px) scale(${e[0].k});`)},m(c,u){oe(c,t,u),z(t,n),z(n,r),z(t,i),z(t,o),z(o,s)},p(c,[u]){u&4&&An(s,c[2]),u&2&&a!==(a=`text-shadow: 0px 5px 5px ${c[1]}`)&&A(o,"style",a),u&9&&l!==(l=`transform: translateX(${c[3].x}px) translateY(${c[3].y}px) scale(${c[0].k});`)&&A(t,"style",l)},i:ge,o:ge,d(c){c&&C(t)}}}function gu(e,t,n){let r,{transform:i}=t,{color:o=""}=t,{emoji:s=""}=t,{position:a={x:0,y:0}}=t;return e.$$set=l=>{"transform"in l&&n(0,i=l.transform),"color"in l&&n(1,o=l.color),"emoji"in l&&n(2,s=l.emoji),"position"in l&&n(4,a=l.position)},e.$$.update=()=>{e.$$.dirty&17&&n(3,r={x:i.applyX(a.x),y:i.applyY(a.y)})},[i,o,s,r,a]}class Ji extends Ye{constructor(t){super(),Ge(this,t,gu,_u,je,{transform:0,color:1,emoji:2,position:4})}}function vu(e){let t,n;return{c(){t=Yt("svg"),n=Yt("path"),this.h()},l(r){t=Gt(r,"svg",{xmlns:!0,fill:!0,width:!0,viewBox:!0,class:!0});var i=G(t);n=Gt(i,"path",{fill:!0,d:!0}),G(n).forEach(C),i.forEach(C),this.h()},h(){A(n,"fill","currentColor"),A(n,"d","M20 12a8 8 0 0 1-8 8v4a12 12 0 0 0 12-12h-4Zm-2-5.3a8 8 0 0 1 2 5.3h4c0-3-1.1-5.8-3-8l-3 2.7Z"),A(t,"xmlns","http://www.w3.org/2000/svg"),A(t,"fill","none"),A(t,"width","50"),A(t,"viewBox","0 0 24 24"),A(t,"class","animate-spin max-w-[1rem] inline-block")},m(r,i){oe(r,t,i),z(t,n)},p:ge,i:ge,o:ge,d(r){r&&C(t)}}}class yu extends Ye{constructor(t){super(),Ge(this,t,null,vu,je,{})}}function wu(e){let t,n,r,i,o,s,a,l,c,u;return n=new yu({}),{c(){t=j("div"),Ie(n.$$.fragment),r=ce(),i=j("h2"),o=xe("Click to paint"),s=ce(),a=j("div"),l=xe("A cat on grass"),this.h()},l(h){t=J(h,"DIV",{class:!0,style:!0});var m=G(t);Se(n.$$.fragment,m),r=ue(m),i=J(m,"H2",{class:!0});var g=G(i);o=Ee(g,"Click to paint"),g.forEach(C),s=ue(m),a=J(m,"DIV",{class:!0});var P=G(a);l=Ee(P,"A cat on grass"),P.forEach(C),m.forEach(C),this.h()},h(){A(i,"class","text-lg"),A(a,"class","absolute bottom-0 font-bold"),A(t,"class","frame z-0 flex relative svelte-er2v6n"),A(t,"style",c=`transform: translateX(${e[2].x}px) translateY(${e[2].y}px) scale(${e[0].k}); + background-image: linear-gradient(${e[1]}, rgba(255,255,255,0)); + color: ${e[1]}; + `)},m(h,m){oe(h,t,m),Ae(n,t,null),z(t,r),z(t,i),z(i,o),z(t,s),z(t,a),z(a,l),u=!0},p(h,[m]){(!u||m&7&&c!==(c=`transform: translateX(${h[2].x}px) translateY(${h[2].y}px) scale(${h[0].k}); + background-image: linear-gradient(${h[1]}, rgba(255,255,255,0)); + color: ${h[1]}; + `))&&A(t,"style",c)},i(h){u||(q(n.$$.fragment,h),u=!0)},o(h){Q(n.$$.fragment,h),u=!1},d(h){h&&C(t),Pe(n)}}}function bu(e,t,n){let r,{transform:i}=t,{color:o=""}=t,{position:s={x:0,y:0}}=t;return e.$$set=a=>{"transform"in a&&n(0,i=a.transform),"color"in a&&n(1,o=a.color),"position"in a&&n(3,s=a.position)},e.$$.update=()=>{e.$$.dirty&9&&n(2,r={x:i.applyX(s.x),y:i.applyY(s.y)})},[i,o,r,s]}class mn extends Ye{constructor(t){super(),Ge(this,t,bu,wu,je,{transform:0,color:1,position:3})}}function qt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function ku(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Wi(e){let t,n,r;e.length!==2?(t=qt,n=(a,l)=>qt(e(a),l),r=(a,l)=>e(a)-l):(t=e===qt||e===ku?e:xu,n=e,r=e);function i(a,l,c=0,u=a.length){if(c>>1;n(a[h],l)<0?c=h+1:u=h}while(c>>1;n(a[h],l)<=0?c=h+1:u=h}while(cc&&r(a[h-1],l)>-r(a[h],l)?h-1:h}return{left:i,center:s,right:o}}function xu(){return 0}function Eu(e){return e===null?NaN:+e}const Ou=Wi(qt),Iu=Ou.right;Wi(Eu).center;const Su=Iu;var Hn=Math.sqrt(50),Vn=Math.sqrt(10),Bn=Math.sqrt(2);function Au(e,t,n){var r,i=-1,o,s,a;if(t=+t,e=+e,n=+n,e===t&&n>0)return[e];if((r=t0){let l=Math.round(e/a),c=Math.round(t/a);for(l*at&&--c,s=new Array(o=c-l+1);++it&&--c,s=new Array(o=c-l+1);++i=0?(o>=Hn?10:o>=Vn?5:o>=Bn?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Hn?10:o>=Vn?5:o>=Bn?2:1)}function Pu(e,t,n){var r=Math.abs(t-e)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Hn?i*=10:o>=Vn?i*=5:o>=Bn&&(i*=2),tt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Ru(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i2?Cu:Ru,l=c=null,h}function h(m){return m==null||isNaN(m=+m)?o:(l||(l=a(e.map(r),t,n)))(r(s(m)))}return h.invert=function(m){return s(i((c||(c=a(t,e.map(r),ke)))(m)))},h.domain=function(m){return arguments.length?(e=Array.from(m,Nu),u()):e.slice()},h.range=function(m){return arguments.length?(t=Array.from(m),u()):t.slice()},h.rangeRound=function(m){return t=Array.from(m),n=Ra,u()},h.clamp=function(m){return arguments.length?(s=m?!0:ft,u()):s!==ft},h.interpolate=function(m){return arguments.length?(n=m,u()):n},h.unknown=function(m){return arguments.length?(o=m,h):o},function(m,g){return r=m,i=g,u()}}function $u(){return Du()(ft,ft)}function zu(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function sn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function gt(e){return e=sn(Math.abs(e)),e?e[1]:NaN}function Fu(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),o.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function Ku(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Hu=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function an(e){if(!(t=Hu.exec(e)))throw new Error("invalid format: "+e);var t;return new ar({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}an.prototype=ar.prototype;function ar(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}ar.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Vu(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Qi;function Bu(e,t){var n=sn(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Qi=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+sn(e,Math.max(0,t+o-1))[0]}function $r(e,t){var n=sn(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const zr={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:zu,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>$r(e*100,t),r:$r,s:Bu,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Fr(e){return e}var Kr=Array.prototype.map,Hr=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function Xu(e){var t=e.grouping===void 0||e.thousands===void 0?Fr:Fu(Kr.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?Fr:Ku(Kr.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"\u2212":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function c(h){h=an(h);var m=h.fill,g=h.align,P=h.sign,U=h.symbol,R=h.zero,x=h.width,B=h.comma,O=h.precision,H=h.trim,$=h.type;$==="n"?(B=!0,$="g"):zr[$]||(O===void 0&&(O=12),H=!0,$="g"),(R||m==="0"&&g==="=")&&(R=!0,m="0",g="=");var X=U==="$"?n:U==="#"&&/[boxX]/.test($)?"0"+$.toLowerCase():"",Y=U==="$"?r:/[%p]/.test($)?s:"",y=zr[$],te=/[defgprs%]/.test($);O=O===void 0?6:/[gprs]/.test($)?Math.max(1,Math.min(21,O)):Math.max(0,Math.min(20,O));function W(b){var F=X,M=Y,d,E,p;if($==="c")M=y(b)+M,b="";else{b=+b;var v=b<0||1/b<0;if(b=isNaN(b)?l:y(Math.abs(b),O),H&&(b=Vu(b)),v&&+b==0&&P!=="+"&&(v=!1),F=(v?P==="("?P:a:P==="-"||P==="("?"":P)+F,M=($==="s"?Hr[8+Qi/3]:"")+M+(v&&P==="("?")":""),te){for(d=-1,E=b.length;++dp||p>57){M=(p===46?i+b.slice(d+1):b.slice(d))+M,b=b.slice(0,d);break}}}B&&!R&&(b=t(b,1/0));var I=F.length+b.length+M.length,S=I>1)+F+b+M+S.slice(I);break;default:b=S+F+b+M;break}return o(b)}return W.toString=function(){return h+""},W}function u(h,m){var g=c((h=an(h),h.type="f",h)),P=Math.max(-8,Math.min(8,Math.floor(gt(m)/3)))*3,U=Math.pow(10,-P),R=Hr[8+P/3];return function(x){return g(U*x)+R}}return{format:c,formatPrefix:u}}var zt,eo,to;qu({thousands:",",grouping:[3],currency:["$",""]});function qu(e){return zt=Xu(e),eo=zt.format,to=zt.formatPrefix,zt}function Yu(e){return Math.max(0,-gt(Math.abs(e)))}function Gu(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(gt(t)/3)))*3-gt(Math.abs(e)))}function ju(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,gt(t)-gt(e))+1}function Ju(e,t,n,r){var i=Pu(e,t,n),o;switch(r=an(r==null?",f":r),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=Gu(i,s))&&(r.precision=o),to(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=ju(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=Yu(i))&&(r.precision=o-(r.type==="%")*2);break}}return eo(r)}function Wu(e){var t=e.domain;return e.ticks=function(n){var r=t();return Au(r[0],r[r.length-1],n==null?10:n)},e.tickFormat=function(n,r){var i=t();return Ju(i[0],i[i.length-1],n==null?10:n,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],l,c,u=10;for(a0;){if(c=Zi(s,a,n),c===l)return r[i]=s,r[o]=a,t(r);if(c>0)s=Math.floor(s/c)*c,a=Math.ceil(a/c)*c;else if(c<0)s=Math.ceil(s*c)/c,a=Math.floor(a*c)/c;else break;l=c}return e},e}function qn(){var e=$u();return e.copy=function(){return Uu(e,qn())},Tu.apply(e,arguments),Wu(e)}function Zu(e){let t,n;return{c(){t=j("div"),n=j("canvas"),this.h()},l(r){t=J(r,"DIV",{class:!0});var i=G(t);n=J(i,"CANVAS",{width:!0,height:!0,class:!0}),G(n).forEach(C),i.forEach(C),this.h()},h(){A(n,"width",e[3]),A(n,"height",e[2]),A(n,"class","absolute top-0 left-0 svelte-6dcxg7"),A(t,"class","absolute top-0 left-0 right-0 bottom-0 overflow-hidden z-0")},m(r,i){oe(r,t,i),z(t,n),e[5](n),e[6](t)},p:ge,i:ge,o:ge,d(r){r&&C(t),e[5](null),e[6](null)}}}const Ft=10;function Qu(e,t,n){let r,i,o,s,a;he(e,rt,O=>n(10,r=O)),he(e,Kn,O=>n(11,i=O)),he(e,$n,O=>n(12,o=O)),he(e,Ot,O=>n(13,s=O)),he(e,nn,O=>n(4,a=O));const l=512*5,c=512*5;let{value:u}=t,h,m;ln(()=>{qn().domain([0,c]).range([0,c]),qn().domain([0,l]).range([0,l]);const O=c/h.clientWidth,H=sc().scaleExtent([1/O/1.5,1]).translateExtent([[-c*.1,-l*.1],[c*1.1,l*1.1]]).tapDistance(10).on("zoom",P);Ve(u.parentElement).call(H).on("dblclick.zoom",()=>(ie(Ot,s=!0,s),ie($n,o=r.cursor,o),console.log("clicked",o),null)).on("pointermove",U).on("pointerleave",R),m=u.getContext("2d"),m.strokeStyle="blue",m.lineWidth=10,m.strokeRect(0,0,c,l)});function g(O){O.forEach(({imgURL:H,position:$})=>{const X=new Image;X.onload=()=>{m.drawImage(X,$.x,$.y,X.width,X.height)},H.split("/"),X.src=H})}function P(O){const H=ie(Kn,i=O.transform,i);n(0,u.style.transform=`translate(${H.x}px, ${H.y}px) scale(${H.k})`,u)}function U(O){O.preventDefault();const H=Math.round(i.invertX(O.layerX)/Ft)*Ft,$=Math.round(i.invertY(O.layerY)/Ft)*Ft;ie(rt,r={cursor:{x:H,y:$}},r)}function R(){ie(rt,r={cursor:null},r)}function x(O){It[O?"unshift":"push"](()=>{u=O,n(0,u)})}function B(O){It[O?"unshift":"push"](()=>{h=O,n(1,h)})}return e.$$set=O=>{"value"in O&&n(0,u=O.value)},e.$$.update=()=>{e.$$.dirty&16&&a&&g(a)},[u,h,l,c,a,x,B]}class ef extends Ye{constructor(t){super(),Ge(this,t,Qu,Zu,je,{value:0})}}function tf(e){let t,n,r,i,o,s,a,l,c,u,h,m,g,P,U,R,x,B,O,H,$,X;return{c(){t=j("div"),n=j("div"),r=j("input"),i=ce(),o=j("label"),s=xe("Show Frames"),a=ce(),l=j("div"),c=j("input"),u=ce(),h=j("label"),m=xe("Text2Image"),g=ce(),P=j("button"),U=xe("Add Prompt"),R=ce(),x=j("button"),B=j("span"),O=xe("+"),H=xe(` + Paint`),this.h()},l(Y){t=J(Y,"DIV",{class:!0});var y=G(t);n=J(y,"DIV",{class:!0});var te=G(n);r=J(te,"INPUT",{id:!0,type:!0,class:!0}),i=ue(te),o=J(te,"LABEL",{for:!0,class:!0});var W=G(o);s=Ee(W,"Show Frames"),W.forEach(C),te.forEach(C),a=ue(y),l=J(y,"DIV",{class:!0});var b=G(l);c=J(b,"INPUT",{id:!0,type:!0,class:!0}),u=ue(b),h=J(b,"LABEL",{for:!0,class:!0});var F=G(h);m=Ee(F,"Text2Image"),F.forEach(C),b.forEach(C),g=ue(y),P=J(y,"BUTTON",{class:!0,title:!0});var M=G(P);U=Ee(M,"Add Prompt"),M.forEach(C),R=ue(y),x=J(y,"BUTTON",{class:!0,title:!0});var d=G(x);B=J(d,"SPAN",{class:!0});var E=G(B);O=Ee(E,"+"),E.forEach(C),H=Ee(d,` + Paint`),d.forEach(C),y.forEach(C),this.h()},h(){A(r,"id","showframes"),A(r,"type","checkbox"),A(r,"class","w-4 h-4 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 cursor-pointer"),A(o,"for","showframes"),A(o,"class","text-black dark:text-white cursor-pointer ml-2"),A(n,"class","flex items-center"),A(c,"id","txt2img"),A(c,"type","checkbox"),A(c,"class","w-4 h-4 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 cursor-pointer"),A(h,"for","txt2img"),A(h,"class","text-black dark:text-white cursor-pointer ml-2"),A(l,"class","flex items-center"),A(P,"class","button svelte-3z1a8v"),A(P,"title","Add Prompt"),A(B,"class","rounded-sm h-5 w-5 m-1 flex justify-center items-center border-2 border-dashed border-violet-700 mr-2"),A(x,"class","button-paint bg-violet-100 text-violet-900 svelte-3z1a8v"),A(x,"title","New Paint Frame"),A(t,"class","grid grid-cols-4 gap-3 text-sm w-max mx-auto")},m(Y,y){oe(Y,t,y),z(t,n),z(n,r),r.checked=e[0],z(n,i),z(n,o),z(o,s),z(t,a),z(t,l),z(l,c),c.checked=e[1],z(l,u),z(l,h),z(h,m),z(t,g),z(t,P),z(P,U),z(t,R),z(t,x),z(x,B),z(B,O),z(x,H),$||(X=[ut(r,"change",e[2]),ut(c,"change",e[3])],$=!0)},p(Y,[y]){y&1&&(r.checked=Y[0]),y&2&&(c.checked=Y[1])},i:ge,o:ge,d(Y){Y&&C(t),$=!1,ei(X)}}}function nf(e,t,n){let r,i;he(e,zn,a=>n(0,r=a)),he(e,Fn,a=>n(1,i=a));function o(){r=this.checked,zn.set(r)}function s(){i=this.checked,Fn.set(i)}return[r,i,o,s]}class rf extends Ye{constructor(t){super(),Ge(this,t,nf,tf,je,{})}}function of(e){let t,n,r,i;return{c(){t=j("form"),n=j("input"),this.h()},l(o){t=J(o,"FORM",{class:!0});var s=G(t);n=J(s,"INPUT",{class:!0,placeholder:!0,title:!0,type:!0,name:!0}),s.forEach(C),this.h()},h(){A(n,"class","input svelte-4r5yqh"),A(n,"placeholder","Type a prompt..."),A(n,"title","Input prompt to generate image and obtain palette"),A(n,"type","text"),A(n,"name","prompt"),A(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 px-3")},m(o,s){oe(o,t,s),z(t,n),dr(n,e[0]),r||(i=[ut(n,"click",yo(e[2])),ut(n,"input",e[3]),ut(t,"submit",wo(e[4])),ut(t,"click",e[5])],r=!0)},p(o,[s]){s&1&&n.value!==o[0]&&dr(n,o[0])},i:ge,o:ge,d(o){o&&C(t),r=!1,ei(i)}}}function sf(e,t,n){const r=bo();let i;const o=u=>{u.key==="Escape"&&r("close")};ln(()=>(window.addEventListener("keyup",o),()=>{window.removeEventListener("keyup",o)}));function s(u){ko.call(this,e,u)}function a(){i=this.value,n(0,i)}return[i,r,s,a,()=>r("prompt",{prompt:i}),()=>r("close")]}class af extends Ye{constructor(t){super(),Ge(this,t,sf,of,je,{})}}var no={},ro={},lr={exports:{}},ne=String,io=function(){return{isColorSupported:!1,reset:ne,bold:ne,dim:ne,italic:ne,underline:ne,inverse:ne,hidden:ne,strikethrough:ne,black:ne,red:ne,green:ne,yellow:ne,blue:ne,magenta:ne,cyan:ne,white:ne,gray:ne,bgBlack:ne,bgRed:ne,bgGreen:ne,bgYellow:ne,bgBlue:ne,bgMagenta:ne,bgCyan:ne,bgWhite:ne}};lr.exports=io();lr.exports.createColors=io;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(l,c){for(var u in c)Object.defineProperty(l,u,{enumerable:!0,get:c[u]})}t(e,{dim:()=>s,default:()=>a});const n=r(lr.exports);function r(l){return l&&l.__esModule?l:{default:l}}let i=new Set;function o(l,c,u){typeof process<"u"&&process.env.JEST_WORKER_ID||u&&i.has(u)||(u&&i.add(u),console.warn(""),c.forEach(h=>console.warn(l,"-",h)))}function s(l){return n.default.dim(l)}const a={info(l,c){o(n.default.bold(n.default.cyan("info")),...Array.isArray(l)?[l]:[c,l])},warn(l,c){o(n.default.bold(n.default.yellow("warn")),...Array.isArray(l)?[l]:[c,l])},risk(l,c){o(n.default.bold(n.default.magenta("risk")),...Array.isArray(l)?[l]:[c,l])}}})(ro);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:()=>i});const t=n(ro);function n(o){return o&&o.__esModule?o:{default:o}}function r({version:o,from:s,to:a}){t.default.warn(`${s}-color-renamed`,[`As of Tailwind CSS ${o}, \`${s}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(no);let Sn=no;var lf=(Sn.__esModule?Sn:{default:Sn}).default;const be=Object.values(lf).filter(e=>typeof e=="object").map(e=>e[200]).slice(0,18),Et=["\u{1F436}","\u{1F431}","\u{1F42D}","\u{1F439}","\u{1F430}","\u{1F98A}","\u{1F43B}","\u{1F43C}","\u{1F428}","\u{1F42F}","\u{1F981}","\u{1F42E}","\u{1F432}","\u{1F31A}","\u{1F31D}","\u{1F31E}","\u{1F31B}","\u{1F31C}"];function cf(e){return new Promise(t=>{const n=new Image;n.onload=async()=>{const r=n.width,i=n.height,o=document.createElement("canvas");o.width=r,o.height=i,o.getContext("2d").drawImage(n,0,0,r,i);const a=await new Promise(l=>o.toBlob(l,"image/jpeg",.95));t(a)},n.src=e})}async function uf(e,t){const n=ff(t),r="https://huggingface.co/uploads",o=`color-palette-${crypto.randomUUID().split("-")[0]}-${n}.jpeg`,s=new File([e],o,{type:"image/jpeg"});console.log("uploading image",s);const l=await(await fetch(r,{method:"POST",headers:{"Content-Type":s.type,"X-Requested-With":"XMLHttpRequest"},body:s})).text();return console.log("uploaded images",l),l}function ff(e){return e?e.toString().toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,""):""}function Vr(e,t,n){const r=e.slice();return r[21]=t[n].connectionId,r[22]=t[n].presence,r}function Br(e,t,n){const r=e.slice();return r[25]=t[n],r[27]=n,r}function Xr(e){let t,n;return t=new af({}),t.$on("prompt",e[13]),t.$on("close",e[12]),{c(){Ie(t.$$.fragment)},l(r){Se(t.$$.fragment,r)},m(r,i){Ae(t,r,i),n=!0},p:ge,i(r){n||(q(t.$$.fragment,r),n=!0)},o(r){Q(t.$$.fragment,r),n=!1},d(r){Pe(t,r)}}}function qr(e){let t,n,r=e[6],i=[];for(let s=0;sQ(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;sa[21];for(let a=0;a{o=null}),qe())},i(a){i||(q(o),i=!0)},o(a){Q(o),i=!1},d(a){a&&C(n),o&&o.d(a),a&&C(r)}}}function df(e){var E;let t,n,r,i,o,s,a,l,c,u,h,m,g,P,U,R,x,B,O,H,$,X,Y,y=e[7]&&Xr(e);function te(p){e[17](p)}let W={};e[2]!==void 0&&(W.value=e[2]),g=new ef({props:W}),It.push(()=>xo(g,"value",te));let b=e[6]&&e[8]&&qr(e),F=e[5]&&Gr(e),M=((E=e[10])==null?void 0:E.cursor)&&jr(e),d=Tt&&hf(e);return X=new rf({}),{c(){t=j("div"),n=xe(e[3]),r=ce(),i=xe(e[4]),o=ce(),y&&y.c(),s=ce(),a=j("div"),l=j("canvas"),c=ce(),u=j("canvas"),h=ce(),m=j("div"),Ie(g.$$.fragment),U=ce(),R=j("main"),b&&b.c(),x=ce(),F&&F.c(),B=ce(),M&&M.c(),O=ce(),d&&d.c(),H=ce(),$=j("div"),Ie(X.$$.fragment),this.h()},l(p){t=J(p,"DIV",{class:!0});var v=G(t);n=Ee(v,e[3]),r=ue(v),i=Ee(v,e[4]),v.forEach(C),o=ue(p),y&&y.l(p),s=ue(p),a=J(p,"DIV",{class:!0});var I=G(a);l=J(I,"CANVAS",{width:!0,height:!0}),G(l).forEach(C),c=ue(I),u=J(I,"CANVAS",{width:!0,height:!0}),G(u).forEach(C),I.forEach(C),h=ue(p),m=J(p,"DIV",{class:!0});var S=G(m);Se(g.$$.fragment,S),U=ue(S),R=J(S,"MAIN",{class:!0});var T=G(R);b&&b.l(T),x=ue(T),F&&F.l(T),B=ue(T),M&&M.l(T),O=ue(T),d&&d.l(T),T.forEach(C),S.forEach(C),H=ue(p),$=J(p,"DIV",{class:!0});var K=G($);Se(X.$$.fragment,K),K.forEach(C),this.h()},h(){A(t,"class","text touch-none pointer-events-none"),A(l,"width","512"),A(l,"height","512"),A(u,"width","512"),A(u,"height","512"),A(a,"class","flex"),A(R,"class","z-10 relative"),A(m,"class","fixed top-0 left-0 z-0 w-screen h-screen"),A($,"class","fixed bottom-0 left-0 right-0 z-10 my-2")},m(p,v){oe(p,t,v),z(t,n),z(t,r),z(t,i),oe(p,o,v),y&&y.m(p,v),oe(p,s,v),oe(p,a,v),z(a,l),e[15](l),z(a,c),z(a,u),e[16](u),oe(p,h,v),oe(p,m,v),Ae(g,m,null),z(m,U),z(m,R),b&&b.m(R,null),z(R,x),F&&F.m(R,null),z(R,B),M&&M.m(R,null),z(R,O),d&&d.m(R,null),oe(p,H,v),oe(p,$,v),Ae(X,$,null),Y=!0},p(p,[v]){var S;(!Y||v&8)&&An(n,p[3]),(!Y||v&16)&&An(i,p[4]),p[7]?y?(y.p(p,v),v&128&&q(y,1)):(y=Xr(p),y.c(),q(y,1),y.m(s.parentNode,s)):y&&(Xe(),Q(y,1,1,()=>{y=null}),qe());const I={};!P&&v&4&&(P=!0,I.value=p[2],Eo(()=>P=!1)),g.$set(I),p[6]&&p[8]?b?(b.p(p,v),v&320&&q(b,1)):(b=qr(p),b.c(),q(b,1),b.m(R,x)):b&&(Xe(),Q(b,1,1,()=>{b=null}),qe()),p[5]?F?(F.p(p,v),v&32&&q(F,1)):(F=Gr(p),F.c(),q(F,1),F.m(R,B)):F&&(Xe(),Q(F,1,1,()=>{F=null}),qe()),(S=p[10])!=null&&S.cursor?M?(M.p(p,v),v&1024&&q(M,1)):(M=jr(p),M.c(),q(M,1),M.m(R,O)):M&&(Xe(),Q(M,1,1,()=>{M=null}),qe()),Tt&&d.p(p,v)},i(p){Y||(q(y),q(g.$$.fragment,p),q(b),q(F),q(M),q(d),q(X.$$.fragment,p),Y=!0)},o(p){Q(y),Q(g.$$.fragment,p),Q(b),Q(F),Q(M),Q(d),Q(X.$$.fragment,p),Y=!1},d(p){p&&C(t),p&&C(o),y&&y.d(p),p&&C(s),p&&C(a),e[15](null),e[16](null),p&&C(h),p&&C(m),Pe(g),b&&b.d(),F&&F.d(),M&&M.d(),d&&d.d(),p&&C(H),p&&C($),Pe(X)}}}function pf(e,t,n){let r,i,o,s,a,l,c,u,h,m;he(e,we,y=>n(3,r=y)),he(e,lt,y=>n(4,i=y)),he(e,$n,y=>n(5,o=y)),he(e,nn,y=>n(6,s=y)),he(e,Fn,y=>n(18,a=y)),he(e,Ot,y=>n(7,l=y)),he(e,zn,y=>n(8,c=y)),he(e,Kn,y=>n(9,u=y)),he(e,rt,y=>n(10,h=y)),he(e,Tt,y=>n(11,m=y));let{room:g}=t,P,U,R;ln(()=>{});async function x(y){ie(Ot,l=!1,l)}async function B(y){const te=y.detail.prompt,W=await H(te);ie(Ot,l=!1,l),console.log("prompt",te,W)}function O(y){const te=document.createElement("canvas"),W=document.createElement("canvas"),b=document.createElement("canvas");te.width=512,te.height=512,W.width=512,W.height=512,b.width=512,b.height=512;const F=te.getContext("2d"),M=W.getContext("2d"),d=b.getContext("2d");M.save(),M.clearRect(0,0,512,512);const p=M.getImageData(0,0,512,512).data;for(let K=0,Z=p.length;K{F.wasClean||(ie(we,r="Error",r),ie(lt,i=!1,i))},b.onmessage=async function(F){try{const M=JSON.parse(F.data);switch(ie(we,r="",r),M.msg){case"send_data":ie(we,r="Sending Data",r),b.send(JSON.stringify(W));break;case"queue_full":ie(we,r="Queue full",r),b.close(),ie(lt,i=!1,i);return;case"estimation":const{msg:d,rank:E,queue_size:p}=M;ie(we,r=`On queue ${E}/${p}`,r);break;case"process_generating":ie(we,r=M.success?"Generating":"Error",r);break;case"process_completed":try{const v=M.output.data[0],I=M.output.data[1],S=await cf(v),T=await uf(S,y);s.push({prompt:y,imgURL:T,position:o}),console.log(T),ie(we,r=M.success?"Complete":"Error",r)}catch(v){ie(we,r=v.message,r)}b.close(),ie(lt,i=!1,i);return;case"process_starts":ie(we,r="Processing",r);break}}catch(M){console.error(M),ie(lt,i=!1,i),ie(we,r="Error",r)}}}function $(y){It[y?"unshift":"push"](()=>{P=y,n(0,P)})}function X(y){It[y?"unshift":"push"](()=>{U=y,n(1,U)})}function Y(y){R=y,n(2,R)}return e.$$set=y=>{"room"in y&&n(14,g=y.room)},[P,U,R,r,i,o,s,l,c,u,h,m,x,B,g,$,X,Y]}class mf extends Ye{constructor(t){super(),Ge(this,t,pf,df,je,{room:14})}}function Zr(e){let t,n;return t=new mf({props:{room:e[0]}}),{c(){Ie(t.$$.fragment)},l(r){Se(t.$$.fragment,r)},m(r,i){Ae(t,r,i),n=!0},p(r,i){const o={};i&1&&(o.room=r[0]),t.$set(o)},i(r){n||(q(t.$$.fragment,r),n=!0)},o(r){Q(t.$$.fragment,r),n=!1},d(r){Pe(t,r)}}}function _f(e){let t,n,r,i,o,s,a=e[0]&&Zr(e);return{c(){t=j("div"),n=j("h1"),r=xe("Stable Diffussion Outpainting Multiplayer"),i=ce(),a&&a.c(),o=Re(),this.h()},l(l){t=J(l,"DIV",{class:!0});var c=G(t);n=J(c,"H1",{class:!0});var u=G(n);r=Ee(u,"Stable Diffussion Outpainting Multiplayer"),u.forEach(C),c.forEach(C),i=ue(l),a&&a.l(l),o=Re(),this.h()},h(){A(n,"class","text-lg md:text-3xl font-bold leading-normal"),A(t,"class","max-w-screen-md mx-auto p-5 relative pointer-events-none touch-none z-10")},m(l,c){oe(l,t,c),z(t,n),z(n,r),oe(l,i,c),a&&a.m(l,c),oe(l,o,c),s=!0},p(l,[c]){l[0]?a?(a.p(l,c),c&1&&q(a,1)):(a=Zr(l),a.c(),q(a,1),a.m(o.parentNode,o)):a&&(Xe(),Q(a,1,1,()=>{a=null}),qe())},i(l){s||(q(a),s=!0)},o(l){Q(a),s=!1},d(l){l&&C(t),l&&C(i),a&&a.d(l),l&&C(o)}}}let Qr="multiplayer-SD";function gf(e,t,n){console.log("PUBLIC_DEV_MODE",cc),console.log("/embed/huggingface-projects/color-palette-generator-sd");let i,o;return ln(()=>{i=mu({publicApiKey:"pk_test_JlUZGH3kQmhmZQiqU2l8eIi5"}),n(0,o=i.enter(Qr,{initialPresence:{cursor:null},initialStorage:{imagesList:new pu}})),o.subscribe("error",a=>{console.error("error",a)});const s=ac(o);return lc(o),()=>{i&&o&&(i.leave(Qr),s())}}),[o]}class wf extends Ye{constructor(t){super(),Ge(this,t,gf,_f,je,{})}}export{wf as default};