diff --git a/assets/index-2832f9bd.js b/assets/index-e21423e1.js similarity index 99% rename from assets/index-2832f9bd.js rename to assets/index-e21423e1.js index 5d9580a5..bfce41ab 100644 --- a/assets/index-2832f9bd.js +++ b/assets/index-e21423e1.js @@ -1843,4 +1843,4 @@ void main(void)\r font-style: ${t.style}; }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(e){this._stylesheet!==e&&(this._stylesheet=e,this.styleID++)}normalizeColor(e){return Array.isArray(e)&&(e=b4e(e)),typeof e=="number"?y4e(e):e}dropShadowToCSS(){let e=this.normalizeColor(this.dropShadowColor);const t=this.dropShadowAlpha,n=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);e.startsWith("#")&&t<1&&(e+=(t*255|0).toString(16).padStart(2,"0"));const i=`${n}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${i} ${this.dropShadowBlur}px ${e}`:`text-shadow: ${i} ${e}`}reset(){Object.assign(this,Ng.defaultOptions)}onBeforeDraw(){const{fontsDirty:e}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&e?new Promise(t=>setTimeout(t,100)):Promise.resolve()}get isSafari(){const{userAgent:e}=nt.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}set fillGradientStops(e){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(e){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(e){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(e){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(e){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(e){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(e){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};let Qx=Ng;Qx.availableFonts={};Qx.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};const Bg=class extends ug{constructor(e="",t={}){super(pt.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this._loading=!1,this.localStyleID=-1,this.dirty=!1,this.ownsStyle=!1;const n=new Image,r=pt.from(n,{scaleMode:nt.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new Jt,r.trim=new Jt,this.texture=r;const i="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",s=document.createElementNS(i,"svg"),a=document.createElementNS(i,"foreignObject"),u=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");a.setAttribute("width","10000"),a.setAttribute("height","10000"),a.style.overflow="hidden",s.appendChild(a),this.maxWidth=Bg.defaultMaxWidth,this.maxHeight=Bg.defaultMaxHeight,this._domElement=u,this._styleElement=c,this._svgRoot=s,this._foreignObject=a,this._foreignObject.appendChild(c),this._foreignObject.appendChild(u),this._image=n,this._loadImage=new Image,this._autoResolution=Bg.defaultAutoResolution,this._resolution=Bg.defaultResolution??nt.RESOLUTION,this.text=e,this.style=t}measureText(e){var a,u;const{text:t,style:n,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},e);Object.assign(this._domElement,{innerHTML:t,style:n.toCSS(r)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);const i=this._domElement.getBoundingClientRect();this._svgRoot.remove();const o=Math.min(this.maxWidth,Math.ceil(i.width)),s=Math.min(this.maxHeight,Math.ceil(i.height));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",s.toString()),t!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:(a=this._style)==null?void 0:a.toCSS(r)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.toGlobalCSS()),{width:o+n.padding*2,height:s+n.padding*2}}async updateText(e=!0){const{style:t,_image:n,_loadImage:r}=this;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;const{width:i,height:o}=this.measureText();n.width=r.width=Math.ceil(Math.max(1,i)),n.height=r.height=Math.ceil(Math.max(1,o)),this._loading||(this._loading=!0,await new Promise(s=>{r.onload=async()=>{await t.onBeforeDraw(),this._loading=!1,n.src=r.src,r.onload=null,r.src="",this.updateTexture(),s()};const a=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(a)}`}))}get source(){return this._image}updateTexture(){const{style:e,texture:t,_image:n,resolution:r}=this,{padding:i}=e,{baseTexture:o}=t;t.trim.width=t._frame.width=n.width/r,t.trim.height=t._frame.height=n.height/r,t.trim.x=-i,t.trim.y=-i,t.orig.width=t._frame.width-i*2,t.orig.height=t._frame.height-i*2,this._onTextureUpdate(),o.setRealSize(n.width,n.height,r),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}_renderCanvas(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(e)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds(e)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){var n,r,i,o,s;typeof e=="boolean"&&(e={children:e}),e=Object.assign({},Bg.defaultDestroyOptions,e),super.destroy(e);const t=null;this.ownsStyle&&((n=this._style)==null||n.cleanFonts()),this._style=t,(r=this._svgRoot)==null||r.remove(),this._svgRoot=t,(i=this._domElement)==null||i.remove(),this._domElement=t,(o=this._foreignObject)==null||o.remove(),this._foreignObject=t,(s=this._styleElement)==null||s.remove(),this._styleElement=t,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=t,this._image.src="",this._image=t}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(e){this.updateText(!0);const t=Lf(this.scale.x)||1;this.scale.x=t*e/this._image.width/this.resolution,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(e){this.updateText(!0);const t=Lf(this.scale.y)||1;this.scale.y=t*e/this._image.height/this.resolution,this._height=e}get style(){return this._style}set style(e){this._style!==e&&(e=e||{},e instanceof Qx?(this.ownsStyle=!1,this._style=e):e instanceof Vc?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Qx.from(e)):(this.ownsStyle=!0,this._style=new Qx(e)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(e){e=String(e===""||e===null||e===void 0?" ":e),e=this.sanitiseText(e),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}sanitiseText(e){return e.replace(/
/gi,"
").replace(/
/gi,"
").replace(/ /gi," ")}};let BI=Bg;BI.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0};BI.defaultMaxWidth=2024;BI.defaultMaxHeight=2024;BI.defaultAutoResolution=!0;function qje(e,t){return{constructor:e,meta:t}}function Yje(e,t,n,r,i){Hre(e,t,n||0,r||e.length-1,i||Kje)}function Hre(e,t,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=t-n+1,a=Math.log(o),u=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*u*(o-u)/o)*(s-o/2<0?-1:1),d=Math.max(n,Math.floor(t-s*u/o+c)),h=Math.min(r,Math.floor(t+(o-s)*u/o+c));Hre(e,t,d,h,i)}var p=e[t],m=n,v=r;for(Xb(e,n,t),i(e[r],p)>0&&Xb(e,n,r);m0;)v--}i(e[n],p)===0?Xb(e,n,v):(v++,Xb(e,v,r)),v<=t&&(n=v+1),t<=v&&(r=v-1)}}function Xb(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Kje(e,t){return et?1:0}class Qje{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!OS(t,n))return r;const i=this.toBBox,o=[];for(;n;){for(let s=0;s=0&&o[n].children.length>this._maxEntries;)this._split(o,n),n--;this._adjustParentBBoxes(i,o,n)}_split(t,n){const r=t[n],i=r.children.length,o=this._minEntries;this._chooseSplitAxis(r,o,i);const s=this._chooseSplitIndex(r,o,i),a=$g(r.children.splice(s,r.children.length-s));a.height=r.height,a.leaf=r.leaf,Sg(r,this.toBBox),Sg(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=$g([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Sg(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let i,o=1/0,s=1/0;for(let a=n;a<=r-n;a++){const u=vx(t,0,a,this.toBBox),c=vx(t,a,r,this.toBBox),d=n8e(u,c),h=f$(u)+f$(c);d=n;c--){const d=t.children[c];yx(a,t.leaf?o(d):d),u+=PS(a)}return u}_adjustParentBBoxes(t,n,r){for(let i=r;i>=0;i--)yx(n[i],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():Sg(t[n],this.toBBox)}}function Jje(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r=e.minX&&t.maxY>=e.minY}function $g(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function IV(e,t,n,r,i){const o=[t,n];for(;o.length;){if(n=o.pop(),t=o.pop(),n-t<=r)continue;const s=t+Math.ceil((n-t)/r/2)*r;Yje(e,s,t,n,i),o.push(t,s,s,n)}}class r8e extends Qje{toBBox(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}compareMinX(t,n){return t.left-n.left}compareMinY(t,n){return t.top-n.top}}const RV={screenSize:{width:256,height:256},workerCount:4,workerIndex:0,tileResolution:{width:64,height:64},tileSubdivision:0,refreshInterval:1e3/60,animationDuration:150,debounceInterval:75,backgroundColor:"#ffffff",accentColor:"#333333",dynamicResolution:{intervalMs:5e3,increment:.25,maxScale:1.5,minScale:1,dtMax:1.5,dtMin:1.1}};var Wre={},uT=qt&&qt.__assign||function(){return uT=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0?1:-1}),h$}var g8e=h8e()?Math.sign:p8e(),m8e=g8e,v8e=Math.abs,y8e=Math.floor,b8e=function(e){return isNaN(e)?0:(e=Number(e),e===0||!isFinite(e)?e:m8e(e)*y8e(v8e(e)))},x8e=b8e,w8e=Math.max,_8e=function(e){return w8e(0,x8e(e))},Gre=function(e){if(typeof e!="function")throw new TypeError(e+" is not a function");return e},S8e=Lv,Vre=function(e){if(!S8e(e))throw new TypeError("Cannot use null or undefined");return e},E8e={exports:{}},C8e=function(){var e=Object.assign,t;return typeof e!="function"?!1:(t={foo:"raz"},e(t,{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")},p$,OV;function T8e(){return OV||(OV=1,p$=function(){try{return Object.keys("primitive"),!0}catch{return!1}}),p$}var g$,MV;function A8e(){if(MV)return g$;MV=1;var e=Lv,t=Object.keys;return g$=function(n){return t(e(n)?Object(n):n)},g$}var m$,kV;function I8e(){return kV||(kV=1,m$=T8e()()?Object.keys:A8e()),m$}var v$,LV;function R8e(){if(LV)return v$;LV=1;var e=I8e(),t=Vre,n=Math.max;return v$=function(r,i){var o,s,a=n(arguments.length,2),u;for(r=Object(t(r)),u=function(c){try{r[c]=i[c]}catch(d){o||(o=d)}},s=1;s-1},b$}var X8e=G8e()?String.prototype.contains:V8e(),PE=Kre,NV=W8e,Qre=Xre,Jre=d8e,Jx=X8e,q8e=Yre.exports=function(e,t){var n,r,i,o,s;return arguments.length<2||typeof e!="string"?(o=t,t=e,e=null):o=arguments[2],PE(e)?(n=Jx.call(e,"c"),r=Jx.call(e,"e"),i=Jx.call(e,"w")):(n=i=!0,r=!1),s={value:t,configurable:n,enumerable:r,writable:i},o?Qre(Jre(o),s):s};q8e.gs=function(e,t,n){var r,i,o,s;return typeof e!="string"?(o=n,n=t,t=e,e=null):o=arguments[3],PE(t)?NV(t)?PE(n)?NV(n)||(o=n,n=void 0):n=void 0:(o=t,t=n=void 0):t=void 0,PE(e)?(r=Jx.call(e,"c"),i=Jx.call(e,"e")):(r=!0,i=!1),s={get:t,set:n,configurable:r,enumerable:i},o?Qre(Jre(o),s):s};var Yw=Yre.exports,N5={exports:{}};(function(e,t){var n=Yw,r=Gre,i=Function.prototype.apply,o=Function.prototype.call,s=Object.create,a=Object.defineProperty,u=Object.defineProperties,c=Object.prototype.hasOwnProperty,d={configurable:!0,enumerable:!1,writable:!0},h,p,m,v,y,S,w;h=function(b,x){var E;return r(x),c.call(this,"__ee__")?E=this.__ee__:(E=d.value=s(null),a(this,"__ee__",d),d.value=null),E[b]?typeof E[b]=="object"?E[b].push(x):E[b]=[E[b],x]:E[b]=x,this},p=function(b,x){var E,A;return r(x),A=this,h.call(this,b,E=function(){m.call(A,b,E),i.call(x,this,arguments)}),E.__eeOnceListener__=x,this},m=function(b,x){var E,A,R,I;if(r(x),!c.call(this,"__ee__"))return this;if(E=this.__ee__,!E[b])return this;if(A=E[b],typeof A=="object")for(I=0;R=A[I];++I)(R===x||R.__eeOnceListener__===x)&&(A.length===2?E[b]=A[I?0:1]:A.splice(I,1));else(A===x||A.__eeOnceListener__===x)&&delete E[b];return this},v=function(b){var x,E,A,R,I;if(c.call(this,"__ee__")&&(R=this.__ee__[b],!!R))if(typeof R=="object"){for(E=arguments.length,I=new Array(E-1),x=1;x=55296&&E<=56319&&(M+=p[++S])),M=m?c.call(m,v,M,w):M,y?(d.value=M,h(b,w,d)):b[w]=M,++w;x=w}}if(x===void 0)for(x=r(p.length),y&&(b=new y(x)),S=0;S=6&&(n-=6),At(n<1?255*((t-e)*n+e):n<3?255*t:n<4?255*((t-e)*(4-n)+e):255*e)},qi=function(e,t,n){t/=100;var r=(n/=100)<=.5?n*(t+1):n+t-n*t,i=2*n-r;return{r:B$(i,r,(e/=60)+2),g:B$(i,r,e),b:B$(i,r,e-2)}},CU=function(e,t,n,r){return{r:At(255*(1-e)*(r=1-r)),g:At(255*(1-t)*r),b:At(255*(1-n)*r)}},iie=function(e,t,n){e/=255,t/=255,n/=255;var r=1-Math.max(e,t,n),i=1-r,o=i&&(i-t)/i,s=i&&(i-n)/i;return{c:At(100*(i&&(i-e)/i)),m:At(100*o),y:At(100*s),k:At(100*r)}},cv=function(e,t,n,r){r===void 0&&(r=1),e/=255,t/=255,n/=255,r=Math.min(r,1);var i=Math.max(e,t,n),o=Math.min(e,t,n),s=i-o,a=0,u=0,c=(i+o)/2;if(s!==0){switch(i){case e:a=(t-n)/s%6;break;case t:a=(n-e)/s+2;break;case n:a=(e-t)/s+4}(a=At(60*a))<0&&(a+=360),u=s/(1-Math.abs(2*c-1))}return{h:a,s:At(100*u),l:At(100*c),a:r}},eX=function(e,t){if(e<0&&(e+=360),e>360&&(e-=360),e===360||e===0)return e;var n=[[0,120],[120,180],[180,240],[240,360]],r=[[0,60],[60,120],[120,240],[240,360]],i=t?r:n,o=0,s=0,a=0,u=0;return(t?n:r).find(function(c,d){return e>=c[0]&&e360||e<0)&&(e-=360*Math.floor(e/360)),e},Bo=function(e){return typeof e=="string"&&(e=Dv.test(e)?FI(e)/100:+e),isNaN(+e)||e>1?1:At(e)},Nv=function(e,t,n){return t.reduce(function(r,i){return B5(B5([],r,!0),[un(un({},e),{h:n===qo.ADDITIVE?nw(e.h+i):nw(eX(eX(e.h,!1)+i,!0))})],!1)},[un({},e)])},bHe=function(e,t){return Nv(e,[30,-30],t)},xHe=function(e,t){return Nv(e,[180],t)},wHe=function(e,t){return Nv(e,[150,-150],t)},_He=function(e,t){return Nv(e,[120,-120],t)},SHe=function(e,t){return Nv(e,[60,-120,180],t)},EHe=function(e,t){return Nv(e,[90,-90,180],t)},ca=function(e){return typeof e=="string"?function(t){var n;if(Object.keys(Xt).some(function(r){if(bx[r].test(t))return n=r,!0}),!n&&~nie.indexOf(t)&&(n=Xt.HEX),!n)throw new Error(vHe);return n}(e):function(t){var n,r=!1,i=rie(Object.keys(t));if($5[i]&&(n=$5[i]),n&&n===Xt.RGB){var o=Object.entries(t).some(function(a){return!F5.test("".concat(a[1]))}),s=Object.entries(t).some(function(a){return!(Dv.test("".concat(a[1]))||!F5.test("".concat(a[1]))&&!isNaN(+a[1])&&+a[1]<=255)});o&&s&&(r=!0),o||(n=Xt.HEX)}if(!n||r)throw new Error(yHe);return n}(e)},CHe=((Kb={})[Xt.HEX]=function(e){var t=(~nie.indexOf(e)?cT[e]:e).match(bx.HEX),n={r:MS(t[1]||t[5]),g:MS(t[2]||t[6]),b:MS(t[3]||t[7])},r=t[4]||t[8];return r!==void 0&&(n.a=MS(r)/255),n},Kb[Xt.RGB]=function(e){var t=e.match(bx.RGB),n=yp(t[1]||t[5]),r=yp(t[2]||t[6]),i=yp(t[3]||t[7]),o=t[4]||t[8],s={r:Math.min(n,255),g:Math.min(r,255),b:Math.min(i,255)};return o!==void 0&&(s.a=Bo(o)),s},Kb[Xt.HSL]=function(e){var t=e.match(bx.HSL),n=nw(t[1]||t[5]),r=fT(t[2]||t[6]),i=fT(t[3]||t[7]),o=t[4]||t[8],s=qi(n,r,i);return o!==void 0&&(s.a=Bo(o)),s},Kb[Xt.CMYK]=function(e){var t=e.match(bx.CMYK),n=Nf(t[1]||t[6]),r=Nf(t[2]||t[7]),i=Nf(t[3]||t[8]),o=Nf(t[4]||t[9]),s=t[5]||t[10],a=CU(n,r,i,o);return s!==void 0&&(a.a=Bo(s)),a},Kb),THe=((Qb={})[Xt.HEX]=function(e){var t={r:yp("".concat(e.r)),g:yp("".concat(e.g)),b:yp("".concat(e.b))};return po(e,"a")&&(t.a=Math.min(yp("".concat(e.a),!0),1)),t},Qb[Xt.RGB]=function(e){return this.HEX(e)},Qb[Xt.HSL]=function(e){var t=fT("".concat(e.s)),n=fT("".concat(e.l)),r=qi(nw(e.h),t,n);return po(e,"a")&&(r.a=Bo(e.a)),r},Qb[Xt.CMYK]=function(e){var t=Nf("".concat(e.c)),n=Nf("".concat(e.m)),r=Nf("".concat(e.y)),i=Nf("".concat(e.k)),o=CU(t,n,r,i);return po(e,"a")&&(o.a=Bo(e.a)),o},Qb),Kp=function(e,t){return t===void 0&&(t=ca(e)),typeof e=="string"?CHe[t](e):THe[t](e)},an=((mc={})[Xt.HEX]=function(e){return{r:kS(e.r),g:kS(e.g),b:kS(e.b)}},mc.HEXA=function(e){var t=an.HEX(e);return t.a=po(e,"a")?kS(255*e.a):"0xFF",t},mc[Xt.RGB]=function(e,t){return po(e,"a")&&delete e.a,Pp(e,t)},mc.RGBA=function(e,t){return e.a=po(e,"a")?At(e.a):1,Pp(e,t)},mc[Xt.HSL]=function(e,t){var n=cv(e.r,e.g,e.b);return delete n.a,um(n,t)},mc.HSLA=function(e,t){var n=an.HSL(e,t);return n.a=po(e,"a")?At(e.a,t):1,n},mc[Xt.CMYK]=function(e,t){return AHe(iie(e.r,e.g,e.b),t)},mc.CMYKA=function(e,t){var n=an.CMYK(e,t);return n.a=po(e,"a")?At(e.a,t):1,n},mc),tX=function(e,t,n,r){var i=ca(e),o=typeof e=="string",s=Kp(e,i),a=typeof e=="string"&&po(s,"a")||typeof e!="string"&&po(e,"a"),u=cv(s.r,s.g,s.b,s.a);a||delete u.a;var c=n?u.l/(t+1):(100-u.l)/(t+1),d=Array(t).fill(null).map(function(h,p){return un(un({},u),{l:u.l+c*(p+1)*(1-2*+n)})});switch(i){case Xt.HEX:default:return d.map(function(h){var p=qi(h.h,h.s,h.l);return a&&(p.a=h.a),o?a?on.HEX(Pp(un(un({},p),{a:At(255*p.a)}),r)):on.HEX(Pp(p,r)):a?an.HEXA(p):an.HEX(p)});case Xt.RGB:return d.map(function(h){var p=qi(h.h,h.s,h.l);return a&&(p.a=h.a),o?on.RGB(Pp(p,r)):a?an.RGBA(p,r):an.RGB(p,r)});case Xt.HSL:return d.map(function(h){return o?on.HSL(um(h,r)):a?an.HSLA(un(un({},qi(h.h,h.s,h.l)),{a:h.a}),r):an.HSL(qi(h.h,h.s,h.l),r)})}},Eg=((Vh={buildHarmony:function(e,t,n,r){var i=ca(e),o=Kp(e,i),s=cv(o.r,o.g,o.b,o.a),a=typeof e=="string"&&po(o,"a")||typeof e!="string"&&po(e,"a"),u=typeof e=="string";switch(i){case Xt.HEX:default:return a?this.HEXA(um(s,0),t,n,u):this.HEX(um(s,0),t,n,u);case Xt.HSL:return a?this.HSLA(s,t,n,u,r):this.HSL(s,t,n,u,r);case Xt.RGB:return a?this.RGBA(s,t,n,u,r):this.RGB(s,t,n,u,r)}}})[Xt.HEX]=function(e,t,n,r){return t(e,n).map(function(i){return r?on.HEX(qi(i.h,i.s,i.l)):an.HEX(qi(i.h,i.s,i.l))})},Vh.HEXA=function(e,t,n,r){return t(e,n).map(function(i){return r?on.HEX(un(un({},qi(i.h,i.s,i.l)),{a:255*Bo(i.a)})):an.HEXA(un(un({},qi(i.h,i.s,i.l)),{a:Bo(i.a)}))})},Vh[Xt.RGB]=function(e,t,n,r,i){return t(e,n).map(function(o){return r?on.RGB(Pp(qi(o.h,o.s,o.l),i)):an.RGB(qi(o.h,o.s,o.l),i)})},Vh.RGBA=function(e,t,n,r,i){return t(e,n).map(function(o){return r?on.RGB(Pp(un(un({},qi(o.h,o.s,o.l)),{a:Bo(o.a)}),i)):an.RGBA(un(un({},qi(o.h,o.s,o.l)),{a:Bo(o.a)}),i)})},Vh[Xt.HSL]=function(e,t,n,r,i){return t(e,n).map(function(o){return r?on.HSL(um({h:o.h,s:o.s,l:o.l},i)):an.HSL(qi(o.h,o.s,o.l),i)})},Vh.HSLA=function(e,t,n,r,i){return t(e,n).map(function(o){return r?on.HSL(um(un(un({},o),{a:Bo(o.a)}),i)):an.HSLA(un(un({},qi(o.h,o.s,o.l)),{a:Bo(o.a)}),i)})},Vh),Cg=((Xh={mix:function(e,t){var n,r,i,o,s,a,u,c,d,h,p,m,v,y,S,w=e.map(function(A){var R=ca(A);return Kp(A,R)}),b=t===qo.SUBTRACTIVE?w.map(function(A){var R,I,M,D,N,H,G,z,L,F,U,V,W,K,q=(R=A.r,I=A.g,M=A.b,D=Math.min(R,I,M),N=Math.min(255-R,255-I,255-M),H=R-D,G=I-D,z=M-D,L=Math.min(H,G),F=H-L,U=(G+L)/2,V=(z+G-L)/2,W=Math.max(F,U,V)/Math.max(H,G,z),K=isNaN(W)||W===1/0||W<=0?1:W,{r:F/K+N,y:U/K+N,b:V/K+N});return po(A,"a")&&(q.a=A.a),q}):null;function x(A){var R=t===qo.ADDITIVE?{r:0,g:0,b:0,a:0}:{r:0,y:0,b:0,a:0};return A.reduce(function(I,M){var D=po(M,"a")?M.a:1,N={r:Math.min(I.r+M.r*D,255),b:Math.min(I.b+M.b*D,255),a:1-(1-D)*(1-I.a)},H="g"in I?I.g:I.y,G="g"in M?M.g:M.y;return un(un({},N),t===qo.ADDITIVE?{g:Math.min(H+G*D,255)}:{y:Math.min(H+G*D,255)})},R)}if(t===qo.ADDITIVE)n=x(w);else{var E=x(b);r=E.r,i=E.y,o=E.b,s=Math.min(r,i,o),a=Math.min(255-r,255-i,255-o),u=r-s,c=i-s,d=o-s,h=Math.min(c,d),p=u+c-h,m=c+h,v=2*(d-h),y=Math.max(p,m,v)/Math.max(u,c,d),S=isNaN(y)||y===1/0||y<=0?1:y,(n={r:p/S+a,g:m/S+a,b:v/S+a}).a=E.a}return{r:At(n.r),g:At(n.g),b:At(n.b),a:il(n.a,0,1)}}})[Xt.HEX]=function(e,t,n){var r=this.mix(e,t);return delete r.a,n?on.HEX(r):an.HEX(r)},Xh.HEXA=function(e,t,n){var r=this.mix(e,t);return r.a=n?255*Bo(r.a):Bo(r.a),n?on.HEX(r):an.HEXA(r)},Xh[Xt.RGB]=function(e,t,n,r){var i=this.mix(e,t);return delete i.a,n?on.RGB(i):an.RGB(i,r)},Xh.RGBA=function(e,t,n,r){var i=this.mix(e,t);return n?on.RGB(i):an.RGBA(i,r)},Xh[Xt.HSL]=function(e,t,n,r){var i=this.mix(e,t),o=cv(i.r,i.g,i.b);return delete i.a,delete o.a,n?on.HSL(o):an.HSL(i,r)},Xh.HSLA=function(e,t,n,r){var i=this.mix(e,t),o=cv(i.r,i.g,i.b,i.a);return n?on.HSL(o):an.HSLA(i,r)},Xh),Pp=function(e,t){return un({r:At(e.r,t),g:At(e.g,t),b:At(e.b,t)},po(e,"a")?{a:At(e.a,t)}:{})},um=function(e,t){return un({h:At(e.h,t),s:At(e.s,t),l:At(e.l,t)},po(e,"a")?{a:At(e.a,t)}:{})},AHe=function(e,t){return{c:At(e.c,t),m:At(e.m,t),y:At(e.y,t),k:At(e.k,t)}},cf=function(e,t,n,r,i,o){var s=i(Kp(e,t),r);return n?o(s):s},Tg=function(e,t,n,r,i,o,s){n<1&&(n=5);var a=function(u,c,d){var h=d-1,p=(c.r-u.r)/h,m=(c.g-u.g)/h,v=(c.b-u.b)/h,y=Bo(u.a),S=(Bo(c.a)-y)/h;return Array(d).fill(null).map(function(w,b){return b===0?u:b===h?c:{r:At(u.r+p*b),g:At(u.g+m*b),b:At(u.b+v*b),a:At(y+S*b)}})}(Kp(e),Kp(t),n);return a.map(function(u){var c=o(u,i);return r?s(c):c})},IHe=function(){function e(t,n){n===void 0&&(n=6),this.rgb=Kp(t),this._decimals=n,this.updateHSL(),this.updateCMYK()}return e.prototype.updateRGB=function(){this.rgb=un(un({},qi(this.hsl.h,this.hsl.s,this.hsl.l)),{a:this.hsl.a})},e.prototype.updateRGBFromCMYK=function(){this.rgb=un(un({},CU(this.cmyk.c,this.cmyk.m,this.cmyk.y,this.cmyk.k)),{a:this.rgb.a})},e.prototype.updateHSL=function(){this.hsl=cv(this.rgb.r,this.rgb.g,this.rgb.b,this.rgb.a)},e.prototype.updateCMYK=function(){this.cmyk=iie(this.rgb.r,this.rgb.g,this.rgb.b)},e.prototype.updateRGBAndCMYK=function(){return this.updateRGB(),this.updateCMYK(),this},e.prototype.updateHSLAndCMYK=function(){return this.updateHSL(),this.updateCMYK(),this},e.prototype.updateRGBAndHSL=function(){return this.updateRGBFromCMYK(),this.updateHSL(),this},e.prototype.setDecimals=function(t){return this._decimals=t,this},e.prototype.setH=function(t){return this.hsl.h=nw(t),this.updateRGBAndCMYK()},e.prototype.setS=function(t){return this.hsl.s=il(t,0,100),this.updateRGBAndCMYK()},e.prototype.setL=function(t){return this.hsl.l=il(t,0,100),this.updateRGBAndCMYK()},e.prototype.setR=function(t){return this.rgb.r=il(t,0,255),this.updateHSLAndCMYK()},e.prototype.setG=function(t){return this.rgb.g=il(t,0,255),this.updateHSLAndCMYK()},e.prototype.setB=function(t){return this.rgb.b=il(t,0,255),this.updateHSLAndCMYK()},e.prototype.setA=function(t){return this.hsl.a=this.rgb.a=il(t,0,1),this},e.prototype.setC=function(t){return this.cmyk.c=il(t,0,100),this.updateRGBAndHSL()},e.prototype.setM=function(t){return this.cmyk.m=il(t,0,100),this.updateRGBAndHSL()},e.prototype.setY=function(t){return this.cmyk.y=il(t,0,100),this.updateRGBAndHSL()},e.prototype.setK=function(t){return this.cmyk.k=il(t,0,100),this.updateRGBAndHSL()},Object.defineProperty(e.prototype,"decimals",{get:function(){return this._decimals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"H",{get:function(){return At(this.hsl.h,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"S",{get:function(){return At(this.hsl.s,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"L",{get:function(){return At(this.hsl.l,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"R",{get:function(){return At(this.rgb.r,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"G",{get:function(){return At(this.rgb.g,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"B",{get:function(){return At(this.rgb.b,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"A",{get:function(){return At(this.hsl.a,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"C",{get:function(){return At(this.cmyk.c,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"M",{get:function(){return At(this.cmyk.m,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Y",{get:function(){return At(this.cmyk.y,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"K",{get:function(){return At(this.cmyk.k,this.decimals)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXObject",{get:function(){return an.HEX(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXAObject",{get:function(){return an.HEXA(this.rgb)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBObject",{get:function(){return{r:this.R,g:this.G,b:this.B}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBAObject",{get:function(){return un(un({},this.RGBObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLObject",{get:function(){return{h:this.H,s:this.S,l:this.L}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLAObject",{get:function(){return un(un({},this.HSLObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKObject",{get:function(){return{c:this.C,m:this.M,y:this.Y,k:this.K}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKAObject",{get:function(){return un(un({},this.CMYKObject),{a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEX",{get:function(){return on.HEX({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HEXA",{get:function(){return on.HEX({r:this.R,g:this.G,b:this.B,a:255*this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGB",{get:function(){return on.RGB({r:this.R,g:this.G,b:this.B})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"RGBA",{get:function(){return on.RGB({r:this.R,g:this.G,b:this.B,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSL",{get:function(){return on.HSL({h:this.H,s:this.S,l:this.L})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HSLA",{get:function(){return on.HSL({h:this.H,s:this.S,l:this.L,a:this.A})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYK",{get:function(){return on.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CMYKA",{get:function(){return on.CMYK({c:this.C,m:this.M,y:this.Y,k:this.K,a:this.A})},enumerable:!1,configurable:!0}),e.toHEX=function(t,n){n===void 0&&(n=!0);var r=ca(t);return cf(t,r,n,0,an.HEX,on.HEX)},e.toHEXA=function(t,n){n===void 0&&(n=!0);var r=ca(t);return cf(t,r,n,0,an.HEXA,on.HEX)},e.toRGB=function(t,n,r){n===void 0&&(n=!0),r===void 0&&(r=6);var i=ca(t);return cf(t,i,n,r,an.RGB,on.RGB)},e.toRGBA=function(t,n,r){n===void 0&&(n=!0),r===void 0&&(r=6);var i=ca(t);return cf(t,i,n,r,an.RGBA,on.RGB)},e.toHSL=function(t,n,r){n===void 0&&(n=!0),r===void 0&&(r=6);var i=ca(t);return cf(t,i,n,r,an.HSL,on.HSL)},e.toHSLA=function(t,n,r){n===void 0&&(n=!0),r===void 0&&(r=6);var i=ca(t);return cf(t,i,n,r,an.HSLA,on.HSL)},e.toCMYK=function(t,n,r){n===void 0&&(n=!0),r===void 0&&(r=6);var i=ca(t);return cf(t,i,n,r,an.CMYK,on.CMYK)},e.toCMYKA=function(t,n,r){n===void 0&&(n=!0),r===void 0&&(r=6);var i=ca(t);return cf(t,i,n,r,an.CMYKA,on.CMYK)},e.getBlendHEX=function(t,n,r,i,o){return r===void 0&&(r=5),i===void 0&&(i=!0),o===void 0&&(o=6),Tg(t,n,r,i,o,an.HEX,on.HEX)},e.getBlendHEXA=function(t,n,r,i,o){return r===void 0&&(r=5),i===void 0&&(i=!0),o===void 0&&(o=6),Tg(t,n,r,i,o,an.HEXA,on.HEX)},e.getBlendRGB=function(t,n,r,i,o){return r===void 0&&(r=5),i===void 0&&(i=!0),o===void 0&&(o=6),Tg(t,n,r,i,o,an.RGB,on.RGB)},e.getBlendRGBA=function(t,n,r,i,o){return r===void 0&&(r=5),i===void 0&&(i=!0),o===void 0&&(o=6),Tg(t,n,r,i,o,an.RGBA,on.RGB)},e.getBlendHSL=function(t,n,r,i,o){return r===void 0&&(r=5),i===void 0&&(i=!0),o===void 0&&(o=6),Tg(t,n,r,i,o,an.HSL,on.HSL)},e.getBlendHSLA=function(t,n,r,i,o){return r===void 0&&(r=5),i===void 0&&(i=!0),o===void 0&&(o=6),Tg(t,n,r,i,o,an.HSLA,on.HSL)},e.getMixHEX=function(t,n,r){return n===void 0&&(n=qo.ADDITIVE),r===void 0&&(r=!0),Cg.HEX(t,n,r)},e.getMixHEXA=function(t,n,r){return n===void 0&&(n=qo.ADDITIVE),r===void 0&&(r=!0),Cg.HEXA(t,n,r)},e.getMixRGB=function(t,n,r,i){return n===void 0&&(n=qo.ADDITIVE),r===void 0&&(r=!0),i===void 0&&(i=6),Cg.RGB(t,n,r,i)},e.getMixRGBA=function(t,n,r,i){return n===void 0&&(n=qo.ADDITIVE),r===void 0&&(r=!0),i===void 0&&(i=6),Cg.RGBA(t,n,r,i)},e.getMixHSL=function(t,n,r,i){return n===void 0&&(n=qo.ADDITIVE),r===void 0&&(r=!0),i===void 0&&(i=6),Cg.HSL(t,n,r,i)},e.getMixHSLA=function(t,n,r,i){return n===void 0&&(n=qo.ADDITIVE),r===void 0&&(r=!0),i===void 0&&(i=6),Cg.HSLA(t,n,r,i)},e.getShades=function(t,n,r){return r===void 0&&(r=6),tX(t,n,!0,r)},e.getTints=function(t,n,r){return r===void 0&&(r=6),tX(t,n,!1,r)},e.getHarmony=function(t,n,r,i){return n===void 0&&(n=bc.COMPLEMENTARY),r===void 0&&(r=qo.ADDITIVE),i===void 0&&(i=6),function(o,s,a,u){var c;return(c={},c[bc.ANALOGOUS]=Eg.buildHarmony(s,bHe,u,a),c[bc.COMPLEMENTARY]=Eg.buildHarmony(s,xHe,u,a),c[bc.SPLIT_COMPLEMENTARY]=Eg.buildHarmony(s,wHe,u,a),c[bc.TRIADIC]=Eg.buildHarmony(s,_He,u,a),c[bc.TETRADIC]=Eg.buildHarmony(s,SHe,u,a),c[bc.SQUARE]=Eg.buildHarmony(s,EHe,u,a),c)[o]}(n,t,i,r)},e}();const RHe={current:void 0,parent:void 0,events:void 0,color:{source:2533018,destination:15753874,expanding:16733986,updating:16733986,generating:16771899,closing:11583173,end:15483002},scale:10,fill:"#000000",alpha:1},{ceil:Ji,PI:PHe}=Math,Kw=(e,t)=>new IHe(e).setA(t??RHe.alpha).RGBA,OHe=(e,t)=>Kw(e,t);function cd(e,t){return{width:e.width*t.scale.x,height:e.height*t.scale.y,x:e.x*t.scale.x+t.x,y:e.y*t.scale.y+t.y}}const MHe={draw(e,t,n){if(e.text){const r=cd(e,{x:e.textX,y:e.textY,scale:{x:1,y:1}}),i=cd(r,n);t.font=`${e.fontSize*n.scale.x}px Arial`,t.fillStyle=Kw(e.fontColor,e.alpha),t.fillText(e.text,i.x,i.y)}},test(e){return{left:e.x,right:e.x,top:e.y,bottom:e.y}}},kHe={draw(e,t,n){const{x:r,y:i,width:o,height:s}=cd(e,n);t.fillStyle=Kw(e.fill,e.alpha),t.fillRect(Ji(r),Ji(i),Ji(o)||1,Ji(s)||1)},test(e){return{left:e.x,right:e.x+e.width,top:e.y,bottom:e.y+e.height}}},LHe={draw(e,t,n){t.fillStyle=Kw(e.fill,e.alpha),t.beginPath();const r=cd({...e,width:e.radius,height:e.radius},n);t.ellipse(Ji(r.x),Ji(r.y),Ji(r.width),Ji(r.height),0,0,2*PHe),t.fill()},test(e){return{left:e.x-e.radius,right:e.x+e.radius,top:e.y-e.radius,bottom:e.y+e.radius}}},DHe={draw(e,t,n){const[r,...i]=e.points;t.beginPath(),t.fillStyle=Kw(e.fill,e.alpha);const{x:o,y:s}=cd({...r,width:0,height:0},n);t.moveTo(Ji(o),Ji(s));for(const a of i){const{x:u,y:c}=cd({...a,width:0,height:0},n);t.lineTo(Ji(u),Ji(c))}t.closePath(),t.fill()},test(e){var t,n,r,i;return{left:((t=Zt.minBy(e.points,"x"))==null?void 0:t.x)??0,right:((n=Zt.maxBy(e.points,"x"))==null?void 0:n.x)??0,top:((r=Zt.minBy(e.points,"y"))==null?void 0:r.y)??0,bottom:((i=Zt.maxBy(e.points,"y"))==null?void 0:i.y)??0}}},NHe={draw(e,t,n){const[r,...i]=e.points;t.beginPath(),t.lineCap="round",t.lineJoin="round",t.strokeStyle=OHe(e.fill,e.alpha);const{x:o,y:s,width:a}=cd({...r,width:e.lineWidth,height:0},n);t.lineWidth=Ji(a),t.moveTo(Ji(o),Ji(s));for(const u of i){const{x:c,y:d}=cd({...u,width:0,height:0},n);t.lineTo(Ji(c),Ji(d))}t.stroke()},test(e){var t,n,r,i;return{left:((t=Zt.minBy(e.points,"x"))==null?void 0:t.x)??0,right:((n=Zt.maxBy(e.points,"x"))==null?void 0:n.x)??0,top:((r=Zt.minBy(e.points,"y"))==null?void 0:r.y)??0,bottom:((i=Zt.maxBy(e.points,"y"))==null?void 0:i.y)??0}}},BHe={text:MHe,path:NHe,rect:kHe,polygon:DHe,circle:LHe},{log2:$He,max:FHe}=Math,nX=e=>Zt.floor($He(e+1));function rX({right:e,left:t,bottom:n,top:r},i){const o=FHe(nX(e-t),nX(n-r))-i,s=2**o,a={left:Zt.floor(t/s),right:Zt.ceil((e+1)/s),top:Zt.floor(r/s),bottom:Zt.ceil((n+1)/s)};return{zoom:o,order:s,tiles:Zt.shuffle(o8e({x:Zt.range(a.left,a.right+1),y:Zt.range(a.top,a.bottom+1)}).map(u=>{const c=u.x*s,d=u.y*s;return{tile:u,bounds:{left:c-s/2,right:c+s/2,top:d-s/2,bottom:d+s/2}}}))}}const zHe=""+new URL("D2Renderer.worker-b5bf55d1.js",import.meta.url).href;class UHe extends Worker{constructor(){super(zHe,{type:"module"})}call(t,n,r=[]){return this.postMessage({action:t,payload:n},r)}on(t,n){const r=i=>{const{action:o,payload:s}=i.data;o===t&&n(s)};return this.addEventListener("message",r),()=>this.removeEventListener("message",r)}}function jHe(e,t){return!(t.left>=e.right||t.right<=e.left||t.top>=e.bottom||t.bottom<=e.top)}const{max:iX,min:oX}=Math,oie=class sie extends ug{constructor(t,n){super(t),this.bounds=n,this.age=sie.age++}};oie.age=0;let HHe=oie;var ua,Xr,Cf,Sc,Vi,jl,Tf,Af,vT,yT,aie,bT,lie,Rm,lw,xT,wT,uie,_T,cie,ST,fie,ET,die,uw,z5,cw,U5,CT,hie,fw,j5,TT,pie,AT,gie;class WHe extends hHe{constructor(){super(...arguments);yr(this,yT);yr(this,bT);yr(this,wT);yr(this,_T);yr(this,ST);yr(this,ET);yr(this,uw);yr(this,cw);yr(this,CT);yr(this,fw);yr(this,TT);yr(this,AT);yr(this,ua,void 0);yr(this,Xr,void 0);yr(this,Cf,void 0);yr(this,Sc,void 0);yr(this,Vi,RV);yr(this,jl,[]);yr(this,Tf,new r8e(16));yr(this,Af,void 0);yr(this,vT,0);yr(this,Rm,Zt.once(()=>Zt.debounce(()=>oo(this,uw,z5).call(this),it(this,Vi).debounceInterval)));yr(this,lw,Zt.once(()=>Zt.throttle(()=>oo(this,cw,U5).call(this),it(this,Vi).refreshInterval)));yr(this,xT,Zt.once(()=>Zt.throttle(n=>oo(this,CT,hie).call(this,n),it(this,Vi).refreshInterval)))}getInstance(){return{app:it(this,ua),viewport:it(this,Xr)}}fitCamera(){var r,i,o,s;const n=Zt.values(it(this,Tf).all()).flat();if(n.length){const a=Zt.reduce(n,(u,c)=>({top:oX(u.top,c.top),left:oX(u.top,c.left),bottom:iX(u.bottom,c.bottom),right:iX(u.right,c.right)}),{bottom:-1/0,top:1/0,left:1/0,right:-1/0});(s=(r=it(this,Xr))==null?void 0:r.animate)==null||s.call(r,{position:new Lt((a.left+a.right)/2,(a.top+a.bottom)/2),scale:((o=(i=it(this,Xr))==null?void 0:i.findFit)==null?void 0:o.call(i,a.right-a.left,a.bottom-a.top))*.8,ease:"easeOutExpo",time:it(this,Vi).animationDuration*1.5,callbackOnComplete:()=>it(this,Rm).call(this)()})}}initialCamera(){var n,r;(r=(n=it(this,Xr))==null?void 0:n.animate)==null||r.call(n,{scale:1,ease:"easeOutExpo",time:it(this,Vi).animationDuration*1.5,callbackOnComplete:()=>it(this,Rm).call(this)()})}getView(){var n;return(n=it(this,ua))==null?void 0:n.view}setup(n){const r={...RV,...n};oo(this,bT,lie).call(this,r),this.setOptions(r),oo(this,_T,cie).call(this,r)}destroy(){Zt.map(it(this,jl),n=>n.terminate()),it(this,ua).destroy()}add(n){const r=TFe(),i=Zt.map(n,({component:o,meta:s})=>({...BHe[o.$].test(o),component:o,meta:s,index:oo(this,yT,aie).call(this)}));return it(this,Tf).load(i),Zt.map(it(this,jl),o=>o.call("add",[Zt.map(n,"component"),r])),()=>{for(const o of i)it(this,Tf).remove(o);Zt.map(it(this,jl),o=>o.call("remove",[r]))}}setOptions(n){const r={...it(this,Vi),...n};oo(this,ST,fie).call(this,r),fc(this,Vi,r),oo(this,uw,z5).call(this),oo(this,cw,U5).call(this)}}ua=new WeakMap,Xr=new WeakMap,Cf=new WeakMap,Sc=new WeakMap,Vi=new WeakMap,jl=new WeakMap,Tf=new WeakMap,Af=new WeakMap,vT=new WeakMap,yT=new WeakSet,aie=function(){return VU(this,vT)._++},bT=new WeakSet,lie=function(n){fc(this,ua,new xU({backgroundAlpha:0,width:n.screenSize.width,height:n.screenSize.height,autoDensity:!0,resolution:2})),fc(this,Xr,new b6e({stopPropagation:!0,screenWidth:n.screenSize.width,screenHeight:n.screenSize.height,events:it(this,ua).renderer.events,passiveWheel:!1})),it(this,Xr).on("clicked",r=>{const{x:i,y:o}=r.world,s=it(this,Tf).search({minX:i,minY:o,maxX:i+Number.MIN_VALUE,maxY:o+Number.MIN_VALUE});this.emit("click",r.event,{world:r.world,components:s})}),it(this,ua).stage.addChild(it(this,Xr)),it(this,Xr).drag().pinch().wheel().decelerate({friction:.98}).clampZoom({maxScale:300,minScale:1e-4}),it(this,Xr).on("moved",()=>{it(this,Rm).call(this)(),it(this,lw).call(this)()}),it(this,Xr).on("mousemove",r=>it(this,xT).call(this)(r)),fc(this,Cf,new us),it(this,Xr).addChild(it(this,Cf)),fc(this,Sc,new uv),it(this,Xr).addChild(it(this,Sc)),fc(this,Af,new uv),it(this,Xr).addChild(it(this,Af)),oo(this,wT,uie).call(this)},Rm=new WeakMap,lw=new WeakMap,xT=new WeakMap,wT=new WeakSet,uie=function(){const{dynamicResolution:n}=it(this,Vi),{dtMax:r,dtMin:i,increment:o,intervalMs:s,maxScale:a,minScale:u}=n,c=Zt.floor(Si.targetFPMS*s);let d=0,h=0,p=1;it(this,ua).ticker.add(m=>{const{tileResolution:v}=it(this,Vi);if(!(d%c)){const y=h/c;p=Zt.clamp(y>=r?p+o:y<=i?p-o:p,u,a),Zt.map(it(this,jl),S=>{S.call("setTileResolution",[{width:Zt.ceil(v.width/p),height:Zt.ceil(v.height/p)}])}),h=0}h+=m,d++})},_T=new WeakSet,cie=function(n){Zt.map(it(this,jl),r=>r.terminate()),fc(this,jl,Zt.times(n.workerCount,r=>{const i=new UHe;return i.on("update",o=>oo(this,ET,die).call(this,o)),i.onerror=o=>{throw o},i.call("setup",[{...n,workerIndex:r}]),i}))},ST=new WeakSet,fie=function(n){var o,s,a,u;const{width:r,height:i}=n.screenSize;(a=(s=(o=it(this,ua))==null?void 0:o.renderer)==null?void 0:s.resize)==null||a.call(s,r,i),(u=it(this,Xr))==null||u.resize(r,i)},ET=new WeakSet,die=function({bounds:n,bitmap:r}){const i=pt.from(r);oo(this,TT,pie).call(this,i,n)},uw=new WeakSet,z5=function(){const{top:n,bottom:r,left:i,right:o}=it(this,Xr);Zt.map(it(this,jl),s=>s.call("setFrustum",[{top:n,bottom:r,left:i,right:o}]))},cw=new WeakSet,U5=function(){var s,a,u,c,d;const{tileSubdivision:n,accentColor:r}=it(this,Vi),{tiles:i}=rX(it(this,Xr),n),o=oo(this,fw,j5).call(this);(s=it(this,Sc))==null||s.clear(),(a=it(this,Sc))==null||a.lineStyle(1*o,r,.5),(u=it(this,Sc))==null||u.beginFill(r,.05);for(const{bounds:h,tile:p}of i)Zt.find((c=it(this,Cf))==null?void 0:c.children,m=>Zt.isEqual(m.bounds,h))||(d=it(this,Sc))==null||d.drawRect(h.left,h.top,h.right-h.left,h.bottom-h.top)},CT=new WeakSet,hie=function(n){var u;const{accentColor:r}=it(this,Vi),i=oo(this,fw,j5).call(this),{x:o,y:s}=it(this,Xr).toWorld(n.globalX,n.globalY),a=it(this,Tf).search({minX:o,minY:s,maxX:o+Number.MIN_VALUE,maxY:s+Number.MIN_VALUE});it(this,Af).clear(),it(this,Af).lineStyle(2*i,r,1);for(const c of a)(u=it(this,Af))==null||u.drawRect(c.left,c.top,c.right-c.left,c.bottom-c.top)},fw=new WeakSet,j5=function(){const{right:n,left:r}=it(this,Xr),{width:i}=it(this,Vi).screenSize;return(n-r)/i},TT=new WeakSet,pie=async function(n,r){var s;const{tileSubdivision:i}=it(this,Vi),{tiles:o}=rX(it(this,Xr),i);if(Zt.find(o,a=>Zt.isEqual(a.bounds,r))){const a={x:(r.right-r.left)/n.width,y:(r.bottom-r.top)/n.height},u=new HHe(n,r);(s=it(this,Cf))==null||s.addChild(u).setTransform(r.left,r.top,a.x,a.y),it(this,lw).call(this)(),await oo(this,AT,gie).call(this,u);for(const c of it(this,Cf).children)jHe(c.bounds,r)&&c.age{const o=s=>{n.alpha+=s/Si.targetFPMS/it(this,Vi).animationDuration,n.alpha>1&&(r.remove(o),i())};n.alpha=0,r.add(o)})};const GHe=qje(WHe,{components:["rect","circle","path","polygon"],id:"d2-renderer",name:"Pixi",description:"Provides 2D Visualisation Support",version:"1.0.0"}),VHe={"d2-renderer":GHe};var XHe=function(t,n){if(n=n.split(":")[0],t=+t,!t)return!1;switch(n){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0},TU={},qHe=Object.prototype.hasOwnProperty,YHe;function sX(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function aX(e){try{return encodeURIComponent(e)}catch{return null}}function KHe(e){for(var t=/([^=?#&]+)=?([^&]*)/g,n={},r;r=t.exec(e);){var i=sX(r[1]),o=sX(r[2]);i===null||o===null||i in n||(n[i]=o)}return n}function QHe(e,t){t=t||"";var n=[],r,i;typeof t!="string"&&(t="?");for(i in e)if(qHe.call(e,i)){if(r=e[i],!r&&(r===null||r===YHe||isNaN(r))&&(r=""),i=aX(i),r=aX(r),i===null||r===null)continue;n.push(i+"="+r)}return n.length?t+n.join("&"):""}TU.stringify=QHe;TU.parse=KHe;var mie=XHe,zI=TU,JHe=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,vie=/[\n\r\t]/g,ZHe=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,yie=/:\d+$/,eWe=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,tWe=/^[a-zA-Z]:/;function AU(e){return(e||"").toString().replace(JHe,"")}var H5=[["#","hash"],["?","query"],function(t,n){return lu(n.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],lX={hash:1,query:1};function bie(e){var t;typeof window<"u"?t=window:typeof qt<"u"?t=qt:typeof self<"u"?t=self:t={};var n=t.location||{};e=e||n;var r={},i=typeof e,o;if(e.protocol==="blob:")r=new hu(unescape(e.pathname),{});else if(i==="string"){r=new hu(e,{});for(o in lX)delete r[o]}else if(i==="object"){for(o in e)o in lX||(r[o]=e[o]);r.slashes===void 0&&(r.slashes=ZHe.test(e.href))}return r}function lu(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function xie(e,t){e=AU(e),e=e.replace(vie,""),t=t||{};var n=eWe.exec(e),r=n[1]?n[1].toLowerCase():"",i=!!n[2],o=!!n[3],s=0,a;return i?o?(a=n[2]+n[3]+n[4],s=n[2].length+n[3].length):(a=n[2]+n[4],s=n[2].length):o?(a=n[3]+n[4],s=n[3].length):a=n[4],r==="file:"?s>=2&&(a=a.slice(2)):lu(r)?a=n[4]:r?i&&(a=a.slice(2)):s>=2&&lu(t.protocol)&&(a=n[4]),{protocol:r,slashes:i||lu(r),slashesCount:s,rest:a}}function nWe(e,t){if(e==="")return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],o=!1,s=0;r--;)n[r]==="."?n.splice(r,1):n[r]===".."?(n.splice(r,1),s++):s&&(r===0&&(o=!0),n.splice(r,1),s--);return o&&n.unshift(""),(i==="."||i==="..")&&n.push(""),n.join("/")}function hu(e,t,n){if(e=AU(e),e=e.replace(vie,""),!(this instanceof hu))return new hu(e,t,n);var r,i,o,s,a,u,c=H5.slice(),d=typeof t,h=this,p=0;for(d!=="object"&&d!=="string"&&(n=t,t=null),n&&typeof n!="function"&&(n=zI.parse),t=bie(t),i=xie(e||"",t),r=!i.protocol&&!i.slashes,h.slashes=i.slashes||r&&t.slashes,h.protocol=i.protocol||t.protocol||"",e=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||tWe.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!lu(h.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p{const n=[];for(const{transport:r,url:i,key:o,disabled:s}of e??[])if(!s){const a=new _ie[r].constructor({url:i});n.push({key:o,url:i,renderer:await a.get()})}t(n)},[e,t]),C.jsx(C.Fragment,{})}const lWe={connected:"success.light",connecting:"warning.light",error:"error.light",disabled:"text.disabled"};function uWe({value:e,onValueChange:t}){const[n]=_I(),r=ie.find(n,{key:e.key});function i(s){t==null||t(Fz(e,s))}const o=e!=null&&e.disabled?"disabled":r?"connected":"error";return C.jsx(C.Fragment,{children:C.jsxs(En,{alignItems:"center",py:.5,children:[C.jsx(fne,{sx:{color:lWe[o]}}),C.jsx(ai,{}),C.jsxs(gt,{flex:1,children:[C.jsx(Wt,{children:r?`${r.renderer.meta.name} ${r.renderer.meta.version}`:ie.startCase(o)}),C.jsx(Wt,{variant:"body2",color:"text.secondary",children:r?C.jsxs(C.Fragment,{children:[C.jsx("span",{children:r.renderer.meta.description}),C.jsx("br",{}),C.jsxs("span",{children:["Contributes: ",ie.join(r.renderer.meta.components,", ")]})]}):(e==null?void 0:e.url)||"No URL"})]}),C.jsx(yd,{title:`${e.disabled?"Enable":"Disable"} Renderer`,children:C.jsx(gt,{children:C.jsx(Xm,{checked:!e.disabled,onChange:(s,a)=>i({disabled:!a})})})}),C.jsx(A6,{trigger:s=>C.jsx(sm,{icon:C.jsx(zA,{}),label:"Edit Renderer",onClick:s}),appBar:{children:C.jsx(T6,{children:"Edit Renderer"})},children:C.jsxs(gt,{p:2.5,children:[C.jsx(_w,{value:e.url,onChange:s=>i({url:s.target.value}),fullWidth:!0,variant:"filled",label:"URL",sx:{mb:2}}),C.jsx($x,{placeholder:"Renderer Type",items:ie.entries(_ie).map(([s,{name:a}])=>({value:s,label:a})),fullWidth:!0,value:e.transport,onChange:s=>i({transport:s})})]})})]})})}var IU={},UI={},Qw={};(function(e){var t=qt&&qt.__extends||function(){var m=function(v,y){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,w){S.__proto__=w}||function(S,w){for(var b in w)Object.prototype.hasOwnProperty.call(w,b)&&(S[b]=w[b])},m(v,y)};return function(v,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");m(v,y);function S(){this.constructor=v}v.prototype=y===null?Object.create(y):(S.prototype=y.prototype,new S)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.createJSONRPCNotification=e.createJSONRPCRequest=e.createJSONRPCSuccessResponse=e.createJSONRPCErrorResponse=e.JSONRPCErrorCode=e.JSONRPCErrorException=e.isJSONRPCResponses=e.isJSONRPCResponse=e.isJSONRPCRequests=e.isJSONRPCRequest=e.isJSONRPCID=e.JSONRPC=void 0,e.JSONRPC="2.0";var n=function(m){return typeof m=="string"||typeof m=="number"||m===null};e.isJSONRPCID=n;var r=function(m){return m.jsonrpc===e.JSONRPC&&m.method!==void 0&&m.result===void 0&&m.error===void 0};e.isJSONRPCRequest=r;var i=function(m){return Array.isArray(m)&&m.every(e.isJSONRPCRequest)};e.isJSONRPCRequests=i;var o=function(m){return m.jsonrpc===e.JSONRPC&&m.id!==void 0&&(m.result!==void 0||m.error!==void 0)};e.isJSONRPCResponse=o;var s=function(m){return Array.isArray(m)&&m.every(e.isJSONRPCResponse)};e.isJSONRPCResponses=s;var a=function(m,v,y){var S={code:m,message:v};return y!=null&&(S.data=y),S},u=function(m){t(v,m);function v(y,S,w){var b=m.call(this,y)||this;return Object.setPrototypeOf(b,v.prototype),b.code=S,b.data=w,b}return v.prototype.toObject=function(){return a(this.code,this.message,this.data)},v}(Error);e.JSONRPCErrorException=u,function(m){m[m.ParseError=-32700]="ParseError",m[m.InvalidRequest=-32600]="InvalidRequest",m[m.MethodNotFound=-32601]="MethodNotFound",m[m.InvalidParams=-32602]="InvalidParams",m[m.InternalError=-32603]="InternalError"}(e.JSONRPCErrorCode||(e.JSONRPCErrorCode={}));var c=function(m,v,y,S){return{jsonrpc:e.JSONRPC,id:m,error:a(v,y,S)}};e.createJSONRPCErrorResponse=c;var d=function(m,v){return{jsonrpc:e.JSONRPC,id:m,result:v??null}};e.createJSONRPCSuccessResponse=d;var h=function(m,v,y){return{jsonrpc:e.JSONRPC,id:m,method:v,params:y}};e.createJSONRPCRequest=h;var p=function(m,v){return{jsonrpc:e.JSONRPC,method:m,params:v}};e.createJSONRPCNotification=p})(Qw);var Jw={};Object.defineProperty(Jw,"__esModule",{value:!0});Jw.DefaultErrorCode=void 0;Jw.DefaultErrorCode=0;var uX=qt&&qt.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(h){s(h)}}function u(d){try{c(r.throw(d))}catch(h){s(h)}}function c(d){d.done?o(d.value):i(d.value).then(a,u)}c((r=r.apply(e,t||[])).next())})},cX=qt&&qt.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(d){return u([c,d])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]{const r=({data:i})=>{i.id===n.id&&(this.rpc.receive(i),this.worker.removeEventListener("message",r))};this.worker.postMessage(n),this.worker.addEventListener("message",r)})}connect(){return this.worker.postMessage(this.options.url),new Promise(t=>{const n=()=>{t(),this.worker.removeEventListener("message",n)};this.worker.addEventListener("message",n)})}async disconnect(){this.worker.terminate()}async call(t,n){return await this.rpc.request(t,n)}}const IWe={trace:async(e,t)=>{switch(e){case"about":return{name:"Search Trace",description:"Provides JSON Search Trace Support",version:"1.0.2"};case"features/formats":return[{id:"grid",name:"Grid"},{id:"xy",name:"Network"},{id:"mesh",name:"Mesh"}];case"features/algorithms":return[{id:"identity",name:"Unknown",hidden:!0}];case"solve/pathfinding":{const{parameters:n}=t;try{return JSON.parse((n==null?void 0:n.content)??"")}catch{return{}}}}}};class RWe{constructor(t){hg(this,"handler");this.options=t;const{hostname:n}=wie(t.url);this.handler=IWe[n]}async connect(){}async disconnect(){}async call(t,n){return await this.handler(t,n)}}const pu=Object.create(null);pu.open="0";pu.close="1";pu.ping="2";pu.pong="3";pu.message="4";pu.upgrade="5";pu.noop="6";const OE=Object.create(null);Object.keys(pu).forEach(e=>{OE[pu[e]]=e});const W5={type:"error",data:"parser error"},Eie=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Cie=typeof ArrayBuffer=="function",Tie=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,RU=({type:e,data:t},n,r)=>Eie&&t instanceof Blob?n?r(t):pX(t,r):Cie&&(t instanceof ArrayBuffer||Tie(t))?n?r(t):pX(new Blob([t]),r):r(pu[e]+(t||"")),pX=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function gX(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let z$;function PWe(e,t){if(Eie&&e.data instanceof Blob)return e.data.arrayBuffer().then(gX).then(t);if(Cie&&(e.data instanceof ArrayBuffer||Tie(e.data)))return t(gX(e.data));RU(e,!1,n=>{z$||(z$=new TextEncoder),t(z$.encode(n))})}const mX="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xx=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,s,a,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),d=new Uint8Array(c);for(r=0;r>4,d[i++]=(s&15)<<4|a>>2,d[i++]=(a&3)<<6|u&63;return c},MWe=typeof ArrayBuffer=="function",PU=(e,t)=>{if(typeof e!="string")return{type:"message",data:Aie(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:kWe(e.substring(1),t)}:OE[n]?e.length>1?{type:OE[n],data:e.substring(1)}:{type:OE[n]}:W5},kWe=(e,t)=>{if(MWe){const n=OWe(e);return Aie(n,t)}else return{base64:!0,data:e}},Aie=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Iie=String.fromCharCode(30),LWe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{RU(o,!1,a=>{r[s]=a,++i===n&&t(r.join(Iie))})})},DWe=(e,t)=>{const n=e.split(Iie),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let U$;function BS(e){return e.reduce((t,n)=>t+n.length,0)}function $S(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){a.enqueue(W5);break}i=d*Math.pow(2,32)+c.getUint32(4),r=3}else{if(BS(n)e){a.enqueue(W5);break}}}})}const Rie=4;function li(e){if(e)return $We(e)}function $We(e){for(var t in li.prototype)e[t]=li.prototype[t];return e}li.prototype.on=li.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};li.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};li.prototype.off=li.prototype.removeListener=li.prototype.removeAllListeners=li.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Pie(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const FWe=ga.setTimeout,zWe=ga.clearTimeout;function WI(e,t){t.useNativeTimers?(e.setTimeoutFn=FWe.bind(ga),e.clearTimeoutFn=zWe.bind(ga)):(e.setTimeoutFn=ga.setTimeout.bind(ga),e.clearTimeoutFn=ga.clearTimeout.bind(ga))}const UWe=1.33;function jWe(e){return typeof e=="string"?HWe(e):Math.ceil((e.byteLength||e.size)*UWe)}function HWe(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function WWe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function GWe(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function Mie(){const e=bX(+new Date);return e!==yX?(vX=0,yX=e):e+"."+bX(vX++)}for(;FS{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};DWe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,LWe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Mie()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new uu(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class uu extends li{constructor(t,n){super(),WI(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=Pie(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new Lie(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=uu.requestsCount++,uu.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=YWe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete uu.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}uu.requestsCount=0;uu.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",xX);else if(typeof addEventListener=="function"){const e="onpagehide"in ga?"pagehide":"unload";addEventListener(e,xX,!1)}}function xX(){for(let e in uu.requests)uu.requests.hasOwnProperty(e)&&uu.requests[e].abort()}const MU=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),zS=ga.WebSocket||ga.MozWebSocket,wX=!0,JWe="arraybuffer",_X=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ZWe extends OU{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=_X?{}:Pie(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=wX&&!_X?n?new zS(t,n):new zS(t):new zS(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const s={};try{wX&&this.ws.send(o)}catch{}i&&MU(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Mie()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!zS}}class eGe extends OU{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=BWe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=NWe();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:a,value:u})=>{a||(this.onPacket(u),o())}).catch(a=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this.writer.write(s).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&MU(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const tGe={websocket:ZWe,webtransport:eGe,polling:QWe},nGe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,rGe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function V5(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=nGe.exec(e||""),o={},s=14;for(;s--;)o[rGe[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=iGe(o,o.path),o.queryKey=oGe(o,o.query),o}function iGe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function oGe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let Die=class Fg extends li{constructor(t,n={}){super(),this.binaryType=JWe,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=V5(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=V5(n.host).host),WI(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=GWe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Rie,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new tGe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Fg.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Fg.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Fg.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function o(){r||(r=!0,d(),n.close(),n=null)}const s=h=>{const p=new Error("probe error: "+h);p.transport=n.name,o(),this.emitReserved("upgradeError",p)};function a(){s("transport closed")}function u(){s("socket closed")}function c(h){n&&h.name!==n.name&&o()}const d=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",a),this.off("close",u),this.off("upgrading",c)};n.once("open",i),n.once("error",s),n.once("close",a),this.once("close",u),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Fg.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Fg.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Nie=Object.prototype.toString,uGe=typeof Blob=="function"||typeof Blob<"u"&&Nie.call(Blob)==="[object BlobConstructor]",cGe=typeof File=="function"||typeof File<"u"&&Nie.call(File)==="[object FileConstructor]";function kU(e){return aGe&&(e instanceof ArrayBuffer||lGe(e))||uGe&&e instanceof Blob||cGe&&e instanceof File}function ME(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let s=0;s{this.io.clearTimeoutFn(o),n.apply(this,[null,...s])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((s,a)=>r?s?o(s):i(a):i(s)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:mn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case mn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case mn.EVENT:case mn.BINARY_EVENT:this.onevent(t);break;case mn.ACK:case mn.BINARY_ACK:this.onack(t);break;case mn.DISCONNECT:this.ondisconnect();break;case mn.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:mn.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:mn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Bv.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Bv.prototype.reset=function(){this.attempts=0};Bv.prototype.setMin=function(e){this.ms=e};Bv.prototype.setMax=function(e){this.max=e};Bv.prototype.setJitter=function(e){this.jitter=e};class Y5 extends li{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,WI(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Bv({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||vGe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Die(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=ul(n,"open",function(){r.onopen(),t&&t()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},s=ul(n,"error",o);if(this._timeout!==!1){const a=this._timeout,u=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},a);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(ul(t,"ping",this.onping.bind(this)),ul(t,"data",this.ondata.bind(this)),ul(t,"error",this.onerror.bind(this)),ul(t,"close",this.onclose.bind(this)),ul(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){MU(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new Bie(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Jb={};function kE(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=sGe(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=Jb[i]&&o in Jb[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let u;return a?u=new Y5(r,t):(Jb[i]||(Jb[i]=new Y5(r,t)),u=Jb[i]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(kE,{Manager:Y5,Socket:Bie,io:kE,connect:kE});class bGe{constructor(t){hg(this,"rpc");hg(this,"socket");this.options=t,this.socket=kE(t.url),this.rpc=new IU.JSONRPCClient(async n=>{const r=i=>{i.id===n.id&&(this.socket.off("response",r),this.rpc.receive(i))};this.socket.emit("request",n),this.socket.on("response",r)})}async connect(){this.socket.connect()}async disconnect(){this.socket.disconnect()}async call(t,n){return await this.rpc.request(t,n)}}const DU={socketio:{name:"socket.io",constructor:bGe},ipc:{name:"Web Worker",constructor:AWe},native:{name:"Internal",constructor:RWe}};function xGe(e){return DU[e].constructor}const $ie=ie.first(ie.keys(DU));function wGe(){const[{renderer:e},t]=Zc();return C.jsx(C.Fragment,{children:C.jsx(sI,{editor:n=>C.jsx(uWe,{value:n}),icon:null,value:e,onChange:ie.debounce(n=>t({renderer:n}),300),addItemLabel:"Add Renderer",create:()=>({transport:$ie,url:"",disabled:!0}),extras:C.jsx(id,{icon:C.jsx(DQ,{}),sx:{ml:2},onClick:()=>t({renderer:PJ}),children:"Reset to Defaults"})})})}function _Ge(e){const[{connections:t}]=aI(),n=rU(),[{remote:r}]=Zc(),i=ie.find(r,{url:e});return i&&!(i!=null&&i.disabled)?n({url:e})?"connected":t?"connecting":e?"error":"not-connected":"not-connected"}const SGe={connected:"success.light",connecting:"warning.light",error:"error.light","not-connected":"text.disabled"};function EGe({value:e,onValueChange:t}){const n=q$e(e.url),r=_Ge(e.url);function i(o){t==null||t(Fz(e,o))}return C.jsx(C.Fragment,{children:C.jsxs(En,{alignItems:"center",py:.5,children:[C.jsx(fne,{sx:{color:SGe[r]}}),C.jsx(ai,{}),C.jsxs(gt,{flex:1,children:[C.jsx(Wt,{children:n?`${n.name} ${n.version}`:ie.startCase(r)}),C.jsx(Wt,{variant:"body2",color:"text.secondary",children:(n==null?void 0:n.description)??((e==null?void 0:e.url)||"No URL")})]}),C.jsx(yd,{title:`${e.disabled?"Enable":"Disable"} Connection`,children:C.jsx(gt,{children:C.jsx(Xm,{checked:!e.disabled,onChange:(o,s)=>i({disabled:!s})})})}),C.jsx(A6,{trigger:o=>C.jsx(sm,{icon:C.jsx(zA,{}),label:"Edit Connection",onClick:o}),appBar:{children:C.jsx(T6,{children:"Edit Connection"})},children:C.jsxs(gt,{p:2.5,children:[C.jsx(_w,{value:e.url,onChange:o=>i({url:o.target.value}),fullWidth:!0,variant:"filled",label:"URL",sx:{mb:2}}),C.jsx($x,{placeholder:"Connection Type",items:ie.entries(DU).map(([o,{name:s}])=>({value:o,label:s})),fullWidth:!0,value:e.transport,onChange:o=>i({transport:o})})]})})]})})}function CGe(){const[{remote:e},t]=Zc();return C.jsx(C.Fragment,{children:C.jsx(sI,{editor:n=>C.jsx(EGe,{value:n}),icon:null,value:e,onChange:ie.debounce(n=>t({remote:n}),300),addItemLabel:"Add Solver",create:()=>({transport:$ie,url:"",disabled:!0}),extras:C.jsx(id,{icon:C.jsx(DQ,{}),sx:{ml:2},onClick:()=>t({remote:RJ}),children:"Reset to Defaults"})})})}const EX=e=>`${e}x`;function TGe(){const{controls:e,onChange:t,state:n}=xd(),[{playbackRate:r=1,acrylic:i,theme:o="light",accentColor:s="teal"},a]=Zc(),[u,c]=O.useState("general");function d(p){return C.jsx(Wt,{variant:"overline",color:"text.secondary",children:p})}function h(p){return C.jsx(Wt,{variant:"body1",children:p})}return C.jsx(kJ,{value:u,children:C.jsxs(zn,{onChange:t,stack:n,children:[C.jsx(zn.Options,{children:C.jsxs(BJ,{onChange:(p,m)=>c(m),children:[C.jsx(Zg,{label:"General",value:"general"}),C.jsx(Zg,{label:"Connections",value:"connections"}),C.jsx(Zg,{label:"Renderers",value:"renderers"}),C.jsx(Zg,{label:"Map Parsers",value:"map-parsers"})]})}),C.jsx(zn.Content,{children:C.jsx(En,{vertical:!0,children:C.jsx(XA,{y:!0,children:C.jsxs(En,{vertical:!0,pt:6,children:[C.jsx(rm,{value:"general",children:C.jsxs(gt,{children:[d("Playback"),C.jsxs(En,{alignItems:"center",children:[h("Playback Rate"),C.jsx(ai,{flex:1}),C.jsx(Dbe,{sx:{maxWidth:320,mr:2},marks:[.25,1,5].map(p=>({value:p*Og,label:EX(p)})),step:.25*Og,min:.25*Og,max:5*Og,valueLabelFormat:p=>EX(p/Og),valueLabelDisplay:"auto",defaultValue:r,onChangeCommitted:(p,m)=>a({playbackRate:m})})]}),d("UI"),C.jsxs(En,{alignItems:"center",children:[h("Acrylic"),C.jsx(ai,{flex:1}),C.jsx(Xm,{defaultChecked:!!i,onChange:(p,m)=>a({acrylic:m})})]}),C.jsxs(En,{alignItems:"center",children:[h("Dark Mode"),C.jsx(ai,{flex:1}),C.jsx(Xm,{defaultChecked:o==="dark",onChange:(p,m)=>a({theme:m?"dark":"light"})})]}),C.jsxs(En,{alignItems:"center",children:[h("Accent"),C.jsx(ai,{flex:1}),C.jsx(Ws,{value:s,items:ie.map(ie.keys(cSe),p=>({id:p,name:ie.startCase(p)})),showArrow:!0,onChange:p=>a({accentColor:p})})]})]})}),C.jsx(rm,{value:"connections",children:C.jsxs(gt,{children:[d("Solvers"),C.jsx(CGe,{})]})}),C.jsx(rm,{value:"renderers",children:C.jsxs(gt,{children:[d("Renderers"),C.jsx(wGe,{})]})}),C.jsx(rm,{value:"map-parsers",children:C.jsxs(gt,{children:[d("Map Parsers"),C.jsx(AGe,{})]})})]})})})}),C.jsx(zn.Extras,{children:e})]})})}function AGe(){return C.jsx(Vm,{children:ie.keys(nU).map(e=>C.jsx(Nx,{children:C.jsx(ru,{primary:e,secondary:"Internal"})},e))})}function IGe(){return O.useCallback(e=>({result:"",error:void 0,offset:0}),[])}function RGe(e){var d,h;const t=mu(),[{playback:n,step:r=0},i]=Vp(),{events:o}=lne((h=(d=e==null?void 0:e.source)==null?void 0:d.trace)==null?void 0:h.content),s=!!o,a=n==="playing",[u,c]=[0,((o==null?void 0:o.length)??1)-1];return O.useMemo(()=>{const p={start:u,end:c,step:r,canPlay:s&&!a&&r0},m=y=>ie.clamp(r+y,u,c);return{playing:n==="playing",...p,...{play:()=>{t("Playback started"),i({playback:"playing",step:m(1)})},pause:(y=0)=>{t("Playback paused"),i({playback:"paused",step:m(y)})},stop:()=>i({step:u,playback:"paused"}),stepForward:()=>i({step:m(1)}),stepBackward:()=>i({step:m(-1)}),tick:(y=1)=>i({playback:"playing",step:m(y)})}}},[c,n,a,s,i,u,r])}function PGe(e,t){let n=!1;return requestAnimationFrame(async()=>{const r=await e();n||t(r)}),()=>{n=!0}}function OGe({layer:e}){const{step:t,tick:n,end:r,playing:i,canPause:o,canPlay:s,canStepBackward:a,canStepForward:u,canStop:c,pause:d,play:h,stepBackward:p,stepForward:m,stop:v}=RGe(e);nwe();const y=mu(),[{playbackRate:S=1}]=Zc(),w=IGe(),b=O.useCallback((x,E)=>C.jsx(Nz,{primary:x,secondary:`Step ${t+E}`}),[t]);return O.useEffect(()=>{if(i)return t{for(const x of ie.range(S)){const E=w(t+x);if(E.result||E.error)return{...E,offset:x}}return{result:"",offset:0,error:void 0}},({result:x,offset:E,error:A})=>{A?(y(`${ie.trimEnd(A,".")}.`,`${E}`),d()):x?(y(`Breakpoint hit: ${x}.`,`${E}`),d(E)):n(S)}):d()},[b,i,r,t,d,n,y,w,S]),C.jsxs(C.Fragment,{children:[C.jsx(sm,{label:"step-backward",icon:C.jsx(R1e,{}),onClick:p,disabled:!a}),C.jsx(sm,{...i?{label:"pause",icon:C.jsx(S1e,{}),onClick:()=>d(),disabled:!o}:{label:"play",icon:C.jsx(C1e,{}),onClick:()=>h(),disabled:!s,color:"primary"}}),C.jsx(sm,{label:"step-forward",icon:C.jsx(I1e,{}),onClick:m,disabled:!u}),C.jsx(sm,{label:"stop",icon:C.jsx(P1e,{}),onClick:v,disabled:!c})]})}const GI=0,Ed=1,$v=2,Fie=4;function zie(e,t){return n=>e(t(n))}function MGe(e,t){return t(e)}function Uie(e,t){return n=>e(t,n)}function CX(e,t){return()=>e(t)}function VI(e,t){return t(e),e}function Ar(...e){return e}function kGe(e){e()}function TX(e){return()=>e}function LGe(...e){return()=>{e.map(kGe)}}function NU(e){return e!==void 0}function Fv(){}function Xn(e,t){return e(Ed,t)}function rn(e,t){e(GI,t)}function BU(e){e($v)}function Us(e){return e(Fie)}function Et(e,t){return Xn(e,Uie(t,GI))}function Xc(e,t){const n=e(Ed,r=>{n(),t(r)});return n}function Sn(){const e=[];return(t,n)=>{switch(t){case $v:e.splice(0,e.length);return;case Ed:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case GI:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function tt(e){let t=e;const n=Sn();return(r,i)=>{switch(r){case Ed:i(t);break;case GI:t=i;break;case Fie:return t}return n(r,i)}}function DGe(e){let t,n;const r=()=>t&&t();return function(i,o){switch(i){case Ed:return o?n===o?void 0:(r(),n=o,t=Xn(e,o),t):(r(),Fv);case $v:r(),n=null;return;default:throw new Error(`unrecognized action ${i}`)}}}function Ys(e){return VI(Sn(),t=>Et(e,t))}function Fo(e,t){return VI(tt(t),n=>Et(e,n))}function NGe(...e){return t=>e.reduceRight(MGe,t)}function Me(e,...t){const n=NGe(...t);return(r,i)=>{switch(r){case Ed:return Xn(e,n(i));case $v:BU(e);return}}}function jie(e,t){return e===t}function Sr(e=jie){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Ht(e){return t=>n=>{e(n)&&t(n)}}function ct(e){return t=>zie(t,e)}function _c(e){return t=>()=>t(e)}function Ql(e,t){return n=>r=>n(t=e(t,r))}function fv(e){return t=>n=>{e>0?e--:t(n)}}function Bf(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function AX(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function cn(...e){const t=new Array(e.length);let n=0,r=null;const i=Math.pow(2,e.length)-1;return e.forEach((o,s)=>{const a=Math.pow(2,s);Xn(o,u=>{const c=n;n=n|a,t[s]=u,c!==i&&n===i&&r&&(r(),r=null)})}),o=>s=>{const a=()=>o([s].concat(t));n===i?a():r=a}}function IX(...e){return function(t,n){switch(t){case Ed:return LGe(...e.map(r=>Xn(r,n)));case $v:return;default:throw new Error(`unrecognized action ${t}`)}}}function jt(e,t=jie){return Me(e,Sr(t))}function Ri(...e){const t=Sn(),n=new Array(e.length);let r=0;const i=Math.pow(2,e.length)-1;return e.forEach((o,s)=>{const a=Math.pow(2,s);Xn(o,u=>{n[s]=u,r=r|a,r===i&&rn(t,n)})}),function(o,s){switch(o){case Ed:return r===i&&s(n),Xn(t,s);case $v:return BU(t);default:throw new Error(`unrecognized action ${o}`)}}}function Wn(e,t=[],{singleton:n}={singleton:!0}){return{id:BGe(),constructor:e,dependencies:t,singleton:n}}const BGe=()=>Symbol();function $Ge(e){const t=new Map,n=({id:r,constructor:i,dependencies:o,singleton:s})=>{if(s&&t.has(r))return t.get(r);const a=i(o.map(u=>n(u)));return s&&t.set(r,a),a};return n(e)}function FGe(e,t){const n={},r={};let i=0;const o=e.length;for(;i(S[w]=b=>{const x=y[t.methods[w]];rn(x,b)},S),{})}function d(y){return s.reduce((S,w)=>(S[w]=DGe(y[t.events[w]]),S),{})}return{Component:fe.forwardRef((y,S)=>{const{children:w,...b}=y,[x]=fe.useState(()=>VI($Ge(e),A=>u(A,b))),[E]=fe.useState(CX(d,x));return US(()=>{for(const A of s)A in b&&Xn(E[A],b[A]);return()=>{Object.values(E).map(BU)}},[b,E,x]),US(()=>{u(x,b)}),fe.useImperativeHandle(S,TX(c(x))),fe.createElement(a.Provider,{value:x},n?fe.createElement(n,FGe([...r,...i,...s],b),w):w)}),usePublisher:y=>fe.useCallback(Uie(rn,fe.useContext(a)[y]),[y]),useEmitterValue:y=>{const w=fe.useContext(a)[y],[b,x]=fe.useState(CX(Us,w));return US(()=>Xn(w,E=>{E!==b&&x(TX(E))}),[w,b]),b},useEmitter:(y,S)=>{const b=fe.useContext(a)[y];US(()=>Xn(b,S),[S,b])}}}const zGe=typeof document<"u"?fe.useLayoutEffect:fe.useEffect,UGe=zGe;var Ks=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ks||{});const jGe={0:"debug",1:"log",2:"warn",3:"error"},HGe=()=>typeof globalThis>"u"?window:globalThis,Cd=Wn(()=>{const e=tt(3);return{log:tt((n,r,i=1)=>{var o;const s=(o=HGe().VIRTUOSO_LOG_LEVEL)!=null?o:Us(e);i>=s&&console[jGe[i]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function $U(e,t=!0){const n=fe.useRef(null);let r=i=>{};if(typeof ResizeObserver<"u"){const i=fe.useMemo(()=>new ResizeObserver(o=>{const s=o[0].target;s.offsetParent!==null&&e(s)}),[e]);r=o=>{o&&t?(i.observe(o),n.current=o):(n.current&&i.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function fg(e,t=!0){return $U(e,t).callbackRef}function WGe(e,t,n,r,i,o,s){const a=fe.useCallback(u=>{const c=GGe(u.children,t,"offsetHeight",i);let d=u.parentElement;for(;!d.dataset.virtuosoScroller;)d=d.parentElement;const h=d.lastElementChild.dataset.viewportType==="window",p=s?s.scrollTop:h?window.pageYOffset||document.documentElement.scrollTop:d.scrollTop,m=s?s.scrollHeight:h?document.documentElement.scrollHeight:d.scrollHeight,v=s?s.offsetHeight:h?window.innerHeight:d.offsetHeight;r({scrollTop:Math.max(p,0),scrollHeight:m,viewportHeight:v}),o==null||o(VGe("row-gap",getComputedStyle(u).rowGap,i)),c!==null&&e(c)},[e,t,i,o,s,r]);return $U(a,n)}function GGe(e,t,n,r){const i=e.length;if(i===0)return null;const o=[];for(let s=0;s{const p=h.target,m=p===window||p===document,v=m?window.pageYOffset||document.documentElement.scrollTop:p.scrollTop,y=m?document.documentElement.scrollHeight:p.scrollHeight,S=m?window.innerHeight:p.offsetHeight,w=()=>{e({scrollTop:Math.max(v,0),scrollHeight:y,viewportHeight:S})};h.suppressFlushSync?w():Jg.flushSync(w),s.current!==null&&(v===s.current||v<=0||v===y-S)&&(s.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t]);fe.useEffect(()=>{const h=i||o.current;return r(i||o.current),u({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[o,u,n,r,i]);function c(h){const p=o.current;if(!p||"offsetHeight"in p&&p.offsetHeight===0)return;const m=h.behavior==="smooth";let v,y,S;p===window?(y=Math.max(fd(document.documentElement,"height"),document.documentElement.scrollHeight),v=window.innerHeight,S=document.documentElement.scrollTop):(y=p.scrollHeight,v=fd(p,"height"),S=p.scrollTop);const w=y-v;if(h.top=Math.ceil(Math.max(Math.min(w,h.top),0)),Wie(v,y)||h.top===S){e({scrollTop:S,scrollHeight:y,viewportHeight:v}),m&&t(!0);return}m?(s.current=h.top,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,s.current=null,t(!0)},1e3)):s.current=null,p.scrollTo(h)}function d(h){o.current.scrollBy(h)}return{scrollerRef:o,scrollByCallback:d,scrollToCallback:c}}const Wo=Wn(()=>{const e=Sn(),t=Sn(),n=tt(0),r=Sn(),i=tt(0),o=Sn(),s=Sn(),a=tt(0),u=tt(0),c=tt(0),d=tt(0),h=Sn(),p=Sn(),m=tt(!1);return Et(Me(e,ct(({scrollTop:v})=>v)),t),Et(Me(e,ct(({scrollHeight:v})=>v)),s),Et(t,i),{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:a,fixedHeaderHeight:u,fixedFooterHeight:c,footerHeight:d,scrollHeight:s,smoothScrollTargetReached:r,scrollTo:h,scrollBy:p,statefulScrollTop:i,deviation:n,scrollingInProgress:m}},[],{singleton:!0}),rw={lvl:0};function Vie(e,t,n,r=rw,i=rw){return{k:e,v:t,lvl:n,l:r,r:i}}function rr(e){return e===rw}function Im(){return rw}function K5(e,t){if(rr(e))return rw;const{k:n,l:r,r:i}=e;if(t===n){if(rr(r))return i;if(rr(i))return r;{const[o,s]=Xie(r);return LE(wi(e,{k:o,v:s,l:qie(r)}))}}else return tt&&(a=a.concat(Q5(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(Q5(s,t,n))),a}function bp(e){return rr(e)?[]:[...bp(e.l),{k:e.k,v:e.v},...bp(e.r)]}function Xie(e){return rr(e.r)?[e.k,e.v]:Xie(e.r)}function qie(e){return rr(e.r)?e.l:LE(wi(e,{r:qie(e.r)}))}function wi(e,t){return Vie(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function j$(e){return rr(e)||e.lvl>e.r.lvl}function RX(e){return J5(Kie(e))}function LE(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(j$(t))return Kie(wi(e,{lvl:r-1}));if(!rr(t)&&!rr(t.r))return wi(t.r,{l:wi(t,{r:t.r.l}),r:wi(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(j$(e))return J5(wi(e,{lvl:r-1}));if(!rr(n)&&!rr(n.l)){const i=n.l,o=j$(i)?n.lvl-1:n.lvl;return wi(i,{l:wi(e,{r:i.l,lvl:r-1}),r:J5(wi(n,{l:i.r,lvl:o})),lvl:i.lvl+1})}else throw new Error("Unexpected empty nodes")}}function XI(e,t,n){if(rr(e))return[];const r=Pl(e,t)[0];return XGe(Q5(e,r,n))}function Yie(e,t){const n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]);const o=[];for(let s=1;s({index:t,value:n}))}function J5(e){const{r:t,lvl:n}=e;return!rr(t)&&!rr(t.r)&&t.lvl===n&&t.r.lvl===n?wi(t,{l:wi(e,{r:t.l}),lvl:n+1}):e}function Kie(e){const{l:t}=e;return!rr(t)&&t.lvl===e.lvl?wi(t,{r:wi(e,{l:t.r})}):e}function hT(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const o=Math.floor((r+i)/2),s=e[o],a=n(s,t);if(a===0)return o;if(a===-1){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Qie(e,t,n){return e[hT(e,t,n)]}function qGe(e,t,n,r){const i=hT(e,t,r),o=hT(e,n,r,i);return e.slice(i,o+1)}const FU=Wn(()=>({recalcInProgress:tt(!1)}),[],{singleton:!0});function YGe(e){const{size:t,startIndex:n,endIndex:r}=e;return i=>i.start===n&&(i.end===r||i.end===1/0)&&i.value===t}function PX(e,t){let n=0,r=0;for(;n=d||i===p)&&(e=K5(e,d)):(c=p!==i,u=!0),h>s&&s>=d&&p!==i&&(e=$s(e,s+1,p));c&&(e=$s(e,o,i))}return[e,n]}function QGe(){return{offsetTree:[],sizeTree:Im(),groupOffsetTree:Im(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function zU({index:e},t){return t===e?0:t0&&(t=Math.max(t,Qie(e,r,zU).offset)),Yie(qGe(e,t,n,JGe),ZGe)}function Z5(e,t,n,r){let i=e,o=0,s=0,a=0,u=0;if(t!==0){u=hT(i,t-1,zU),a=i[u].offset;const d=Pl(n,t-1);o=d[0],s=d[1],i.length&&i[u].size===Pl(n,t)[1]&&(u-=1),i=i.slice(0,u+1)}else i=[];for(const{start:c,value:d}of XI(n,t,1/0)){const h=c-o,p=h*s+a+h*r;i.push({offset:p,size:d,index:c}),o=c,a=p,s=d}return{offsetTree:i,lastIndex:o,lastOffset:a,lastSize:s}}function t9e(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,Ks.DEBUG);const o=e.sizeTree;let s=o,a=0;if(n.length>0&&rr(o)&&t.length===2){const p=t[0].size,m=t[1].size;s=n.reduce((v,y)=>$s($s(v,y,p),y+1,m),s)}else[s,a]=KGe(s,t);if(s===o)return e;const{offsetTree:u,lastIndex:c,lastSize:d,lastOffset:h}=Z5(e.offsetTree,a,s,i);return{sizeTree:s,offsetTree:u,lastIndex:c,lastOffset:h,lastSize:d,groupOffsetTree:n.reduce((p,m)=>$s(p,m,ow(m,u,i)),Im()),groupIndices:n}}function ow(e,t,n){if(t.length===0)return 0;const{offset:r,index:i,size:o}=Qie(t,e,zU),s=e-i,a=o*s+(s-1)*n+r;return a>0?a+n:a}function n9e(e){return typeof e.groupIndex<"u"}function Jie(e,t,n){if(n9e(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let i=Zie(r,t);return i=Math.max(0,i,Math.min(n,i)),i}}function Zie(e,t){if(!qI(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function qI(e){return!rr(e.groupOffsetTree)}function r9e(e){return bp(e).map(({k:t,v:n},r,i)=>{const o=i[r+1],s=o?o.k-1:1/0;return{startIndex:t,endIndex:s,size:n}})}const i9e={offsetHeight:"height",offsetWidth:"width"},xu=Wn(([{log:e},{recalcInProgress:t}])=>{const n=Sn(),r=Sn(),i=Fo(r,0),o=Sn(),s=Sn(),a=tt(0),u=tt([]),c=tt(void 0),d=tt(void 0),h=tt((A,R)=>fd(A,i9e[R])),p=tt(void 0),m=tt(0),v=QGe(),y=Fo(Me(n,cn(u,e,m),Ql(t9e,v),Sr()),v),S=Fo(Me(u,Sr(),Ql((A,R)=>({prev:A.current,current:R}),{prev:[],current:[]}),ct(({prev:A})=>A)),[]);Et(Me(u,Ht(A=>A.length>0),cn(y,m),ct(([A,R,I])=>{const M=A.reduce((D,N,H)=>$s(D,N,ow(N,R.offsetTree,I)||H),Im());return{...R,groupIndices:A,groupOffsetTree:M}})),y),Et(Me(r,cn(y),Ht(([A,{lastIndex:R}])=>A[{startIndex:A,endIndex:R,size:I}])),n),Et(c,d);const w=Fo(Me(c,ct(A=>A===void 0)),!0);Et(Me(d,Ht(A=>A!==void 0&&rr(Us(y).sizeTree)),ct(A=>[{startIndex:0,endIndex:0,size:A}])),n);const b=Ys(Me(n,cn(y),Ql(({sizes:A},[R,I])=>({changed:I!==A,sizes:I}),{changed:!1,sizes:v}),ct(A=>A.changed)));Xn(Me(a,Ql((A,R)=>({diff:A.prev-R,prev:R}),{diff:0,prev:0}),ct(A=>A.diff)),A=>{const{groupIndices:R}=Us(y);if(A>0)rn(t,!0),rn(o,A+PX(A,R));else if(A<0){const I=Us(S);I.length>0&&(A-=PX(-A,I)),rn(s,A)}}),Xn(Me(a,cn(e)),([A,R])=>{A<0&&R("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Ks.ERROR)});const x=Ys(o);Et(Me(o,cn(y),ct(([A,R])=>{const I=R.groupIndices.length>0,M=[],D=R.lastSize;if(I){const N=iw(R.sizeTree,0);let H=0,G=0;for(;H{let W=F.ranges;return F.prevSize!==0&&(W=[...F.ranges,{startIndex:F.prevIndex,endIndex:U+A-1,size:F.prevSize}]),{ranges:W,prevIndex:U+A,prevSize:V}},{ranges:M,prevIndex:A,prevSize:0}).ranges}return bp(R.sizeTree).reduce((N,{k:H,v:G})=>({ranges:[...N.ranges,{startIndex:N.prevIndex,endIndex:H+A-1,size:N.prevSize}],prevIndex:H+A,prevSize:G}),{ranges:[],prevIndex:0,prevSize:D}).ranges})),n);const E=Ys(Me(s,cn(y,m),ct(([A,{offsetTree:R},I])=>{const M=-A;return ow(M,R,I)})));return Et(Me(s,cn(y,m),ct(([A,R,I])=>{if(R.groupIndices.length>0){if(rr(R.sizeTree))return R;let D=Im();const N=Us(S);let H=0,G=0,z=0;for(;H<-A;){z=N[G];const F=N[G+1]-z-1;G++,H+=F+1}if(D=bp(R.sizeTree).reduce((F,{k:U,v:V})=>$s(F,Math.max(0,U+A),V),D),H!==-A){const F=iw(R.sizeTree,z);D=$s(D,0,F);const U=Pl(R.sizeTree,-A+1)[1];D=$s(D,1,U)}return{...R,sizeTree:D,...Z5(R.offsetTree,0,D,I)}}else{const D=bp(R.sizeTree).reduce((N,{k:H,v:G})=>$s(N,Math.max(0,H+A),G),Im());return{...R,sizeTree:D,...Z5(R.offsetTree,0,D,I)}}})),y),{data:p,totalCount:r,sizeRanges:n,groupIndices:u,defaultItemSize:d,fixedItemSize:c,unshiftWith:o,shiftWith:s,shiftWithOffset:E,beforeUnshiftWith:x,firstItemIndex:a,gap:m,sizes:y,listRefresh:b,statefulTotalCount:i,trackItemSizes:w,itemSize:h}},Ar(Cd,FU),{singleton:!0}),o9e=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function eoe(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!o9e)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Zw=Wn(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:i,viewportHeight:o,scrollTo:s,smoothScrollTargetReached:a,headerHeight:u,footerHeight:c,fixedHeaderHeight:d,fixedFooterHeight:h},{log:p}])=>{const m=Sn(),v=tt(0);let y=null,S=null,w=null;function b(){y&&(y(),y=null),w&&(w(),w=null),S&&(clearTimeout(S),S=null),rn(i,!1)}return Et(Me(m,cn(e,o,t,v,u,c,p),cn(r,d,h),ct(([[x,E,A,R,I,M,D,N],H,G,z])=>{const L=eoe(x),{align:F,behavior:U,offset:V}=L,W=R-1,K=Jie(L,E,W);let q=ow(K,E.offsetTree,H)+M;F==="end"?(q+=G+Pl(E.sizeTree,K)[1]-A+z,K===W&&(q+=D)):F==="center"?q+=(G+Pl(E.sizeTree,K)[1]-A+z)/2:q-=I,V&&(q+=V);const Q=re=>{b(),re?(N("retrying to scroll to",{location:x},Ks.DEBUG),rn(m,x)):N("list did not change, scroll successful",{},Ks.DEBUG)};if(b(),U==="smooth"){let re=!1;w=Xn(n,ue=>{re=re||ue}),y=Xc(a,()=>{Q(re)})}else y=Xc(Me(n,s9e(150)),Q);return S=setTimeout(()=>{b()},1200),rn(i,!0),N("scrolling from index to",{index:K,top:q,behavior:U},Ks.DEBUG),{top:q,behavior:U}})),s),{scrollToIndex:m,topListHeight:v}},Ar(xu,Wo,Cd),{singleton:!0});function s9e(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const sw="up",Zx="down",a9e="none",l9e={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},u9e=0,e_=Wn(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:i,scrollBy:o}])=>{const s=tt(!1),a=tt(!0),u=Sn(),c=Sn(),d=tt(4),h=tt(u9e),p=Fo(Me(IX(Me(jt(t),fv(1),_c(!0)),Me(jt(t),fv(1),_c(!1),AX(100))),Sr()),!1),m=Fo(Me(IX(Me(o,_c(!0)),Me(o,_c(!1),AX(200))),Sr()),!1);Et(Me(Ri(jt(t),jt(h)),ct(([b,x])=>b<=x),Sr()),a),Et(Me(a,Bf(50)),c);const v=Ys(Me(Ri(e,jt(n),jt(r),jt(i),jt(d)),Ql((b,[{scrollTop:x,scrollHeight:E},A,R,I,M])=>{const D=x+A-E>-M,N={viewportHeight:A,scrollTop:x,scrollHeight:E};if(D){let G,z;return x>b.state.scrollTop?(G="SCROLLED_DOWN",z=b.state.scrollTop-x):(G="SIZE_DECREASED",z=b.state.scrollTop-x||b.scrollTopDelta),{atBottom:!0,state:N,atBottomBecause:G,scrollTopDelta:z}}let H;return N.scrollHeight>b.state.scrollHeight?H="SIZE_INCREASED":Ab&&b.atBottom===x.atBottom))),y=Fo(Me(e,Ql((b,{scrollTop:x,scrollHeight:E,viewportHeight:A})=>{if(Wie(b.scrollHeight,E))return{scrollTop:x,scrollHeight:E,jump:0,changed:!1};{const R=E-(x+A)<1;return b.scrollTop!==x&&R?{scrollHeight:E,scrollTop:x,jump:b.scrollTop-x,changed:!0}:{scrollHeight:E,scrollTop:x,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Ht(b=>b.changed),ct(b=>b.jump)),0);Et(Me(v,ct(b=>b.atBottom)),s),Et(Me(s,Bf(50)),u);const S=tt(Zx);Et(Me(e,ct(({scrollTop:b})=>b),Sr(),Ql((b,x)=>Us(m)?{direction:b.direction,prevScrollTop:x}:{direction:xb.direction)),S),Et(Me(e,Bf(50),_c(a9e)),S);const w=tt(0);return Et(Me(p,Ht(b=>!b),_c(0)),w),Et(Me(t,Bf(100),cn(p),Ht(([b,x])=>!!x),Ql(([b,x],[E])=>[x,E],[0,0]),ct(([b,x])=>x-b)),w),{isScrolling:p,isAtTop:a,isAtBottom:s,atBottomState:v,atTopStateChange:c,atBottomStateChange:u,scrollDirection:S,atBottomThreshold:d,atTopThreshold:h,scrollVelocity:w,lastJumpDueToItemResize:y}},Ar(Wo)),Td=Wn(([{log:e}])=>{const t=tt(!1),n=Ys(Me(t,Ht(r=>r),Sr()));return Xn(t,r=>{r&&Us(e)("props updated",{},Ks.DEBUG)}),{propsReady:t,didMount:n}},Ar(Cd),{singleton:!0});function UU(e,t){e==0?t():requestAnimationFrame(()=>UU(e-1,t))}function jU(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const t_=Wn(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:i},{didMount:o}])=>{const s=tt(!0),a=tt(0),u=tt(!1);return Et(Me(o,cn(a),Ht(([c,d])=>!!d),_c(!1)),s),Xn(Me(Ri(t,o),cn(s,e,n,u),Ht(([[,c],d,{sizeTree:h},p,m])=>c&&(!rr(h)||NU(p))&&!d&&!m),cn(a)),([,c])=>{rn(u,!0),UU(3,()=>{Xc(r,()=>rn(s,!0)),rn(i,c)})}),{scrolledToInitialItem:s,initialTopMostItemIndex:a}},Ar(xu,Wo,Zw,Td),{singleton:!0});function OX(e){return e?e==="smooth"?"smooth":"auto":!1}const c9e=(e,t)=>typeof e=="function"?OX(e(t)):t&&OX(e),f9e=Wn(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:i},{scrolledToInitialItem:o},{propsReady:s,didMount:a},{log:u},{scrollingInProgress:c}])=>{const d=tt(!1),h=Sn();let p=null;function m(y){rn(i,{index:"LAST",align:"end",behavior:y})}Xn(Me(Ri(Me(jt(e),fv(1)),a),cn(jt(d),n,o,c),ct(([[y,S],w,b,x,E])=>{let A=S&&x,R="auto";return A&&(R=c9e(w,b||E),A=A&&!!R),{totalCount:y,shouldFollow:A,followOutputBehavior:R}}),Ht(({shouldFollow:y})=>y)),({totalCount:y,followOutputBehavior:S})=>{p&&(p(),p=null),p=Xc(t,()=>{Us(u)("following output to ",{totalCount:y},Ks.DEBUG),m(S),p=null})});function v(y){const S=Xc(r,w=>{y&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(Us(u)("scrolling to bottom due to increased size",{},Ks.DEBUG),m("auto"))});setTimeout(S,100)}return Xn(Me(Ri(jt(d),e,s),Ht(([y,,S])=>y&&S),Ql(({value:y},[,S])=>({refreshed:y===S,value:S}),{refreshed:!1,value:0}),Ht(({refreshed:y})=>y),cn(d,e)),([,y])=>{v(y!==!1)}),Xn(h,()=>{v(Us(d)!==!1)}),Xn(Ri(jt(d),r),([y,S])=>{y&&!S.atBottom&&S.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&m("auto")}),{followOutput:d,autoscrollToBottom:h}},Ar(xu,e_,Zw,t_,Td,Cd,Wo));function d9e(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const toe=Wn(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:i}])=>{const o=Sn(),s=Sn(),a=Ys(Me(o,ct(d9e)));return Et(Me(a,ct(u=>u.totalCount)),e),Et(Me(a,ct(u=>u.groupIndices)),t),Et(Me(Ri(r,n,i),Ht(([u,c])=>qI(c)),ct(([u,c,d])=>Pl(c.groupOffsetTree,Math.max(u-d,0),"v")[0]),Sr(),ct(u=>[u])),s),{groupCounts:o,topItemsIndexes:s}},Ar(xu,Wo));function aw(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function noe(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const pT="top",gT="bottom",MX="none";function kX(e,t,n){return typeof e=="number"?n===sw&&t===pT||n===Zx&&t===gT?e:0:n===sw?t===pT?e.main:e.reverse:t===gT?e.main:e.reverse}function LX(e,t){return typeof e=="number"?e:e[t]||0}const HU=Wn(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:i}])=>{const o=Sn(),s=tt(0),a=tt(0),u=tt(0),c=Fo(Me(Ri(jt(e),jt(t),jt(r),jt(o,aw),jt(u),jt(s),jt(i),jt(n),jt(a)),ct(([d,h,p,[m,v],y,S,w,b,x])=>{const E=d-b,A=S+w,R=Math.max(p-E,0);let I=MX;const M=LX(x,pT),D=LX(x,gT);return m-=b,m+=p+w,v+=p+w,v-=b,m>d+A-M&&(I=sw),vd!=null),Sr(aw)),[0,0]);return{listBoundary:o,overscan:u,topListHeight:s,increaseViewportBy:a,visibleRange:c}},Ar(Wo),{singleton:!0});function h9e(e,t,n){if(qI(t)){const r=Zie(e,t);return[{index:Pl(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const H$={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function DX(e,t,n){if(e.length===0)return[];if(!qI(t))return e.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const r=e[0].index,i=e[e.length-1].index,o=[],s=XI(t.groupOffsetTree,r,i);let a,u=0;for(const c of e){(!a||a.end0){c=e[0].offset;const y=e[e.length-1];d=y.offset+y.size}const h=n-u,p=a+h*s+(h-1)*r,m=c,v=p-d;return{items:DX(e,i,o),topItems:DX(t,i,o),topListHeight:t.reduce((y,S)=>S.size+y,0),offsetTop:c,offsetBottom:v,top:m,bottom:d,totalCount:n,firstItemIndex:o}}function roe(e,t,n,r,i,o){let s=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-s>=e)break;s++}const a=e+s,u=jU(t,a),c=Array.from({length:a}).map((d,h)=>({index:h+u,size:0,offset:0,data:o[h+u]}));return DE(c,[],a,i,n,r)}const dg=Wn(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:i},o,{visibleRange:s,listBoundary:a,topListHeight:u},{scrolledToInitialItem:c,initialTopMostItemIndex:d},{topListHeight:h},p,{didMount:m},{recalcInProgress:v}])=>{const y=tt([]),S=tt(0),w=Sn();Et(o.topItemsIndexes,y);const b=Fo(Me(Ri(m,v,jt(s,aw),jt(t),jt(e),jt(d),c,jt(y),jt(r),jt(i),n),Ht(([R,I,,M,,,,,,,D])=>{const N=D&&D.length!==M;return R&&!I&&!N}),ct(([,,[R,I],M,D,N,H,G,z,L,F])=>{const U=D,{sizeTree:V,offsetTree:W}=U,K=Us(S);if(M===0)return{...H$,totalCount:M};if(R===0&&I===0)return K===0?{...H$,totalCount:M}:roe(K,N,D,z,L,F||[]);if(rr(V))return K>0?null:DE(h9e(jU(N,M),U,F),[],M,L,U,z);const q=[];if(G.length>0){const se=G[0],J=G[G.length-1];let ae=0;for(const le of XI(V,se,J)){const he=le.value,pe=Math.max(le.start,se),ve=Math.min(le.end,J);for(let ye=pe;ye<=ve;ye++)q.push({index:ye,size:he,offset:ae,data:F&&F[ye]}),ae+=he}}if(!H)return DE([],q,M,L,U,z);const Q=G.length>0?G[G.length-1]+1:0,re=e9e(W,R,I,Q);if(re.length===0)return null;const ue=M-1,ce=VI([],se=>{for(const J of re){const ae=J.value;let le=ae.offset,he=J.start;const pe=ae.size;if(ae.offset=I);ye++)se.push({index:ye,size:pe,offset:le,data:F&&F[ye]}),le+=pe+L}});return DE(ce,q,M,L,U,z)}),Ht(R=>R!==null),Sr()),H$);Et(Me(n,Ht(NU),ct(R=>R==null?void 0:R.length)),t),Et(Me(b,ct(R=>R.topListHeight)),h),Et(h,u),Et(Me(b,ct(R=>[R.top,R.bottom])),a),Et(Me(b,ct(R=>R.items)),w);const x=Ys(Me(b,Ht(({items:R})=>R.length>0),cn(t,n),Ht(([{items:R},I])=>R[R.length-1].originalIndex===I-1),ct(([,R,I])=>[R-1,I]),Sr(aw),ct(([R])=>R))),E=Ys(Me(b,Bf(200),Ht(({items:R,topItems:I})=>R.length>0&&R[0].originalIndex===I.length),ct(({items:R})=>R[0].index),Sr())),A=Ys(Me(b,Ht(({items:R})=>R.length>0),ct(({items:R})=>{let I=0,M=R.length-1;for(;R[I].type==="group"&&II;)M--;return{startIndex:R[I].index,endIndex:R[M].index}}),Sr(noe)));return{listState:b,topItemsIndexes:y,endReached:x,startReached:E,rangeChanged:A,itemsRendered:w,initialItemCount:S,...p}},Ar(xu,toe,HU,t_,Zw,e_,Td,FU),{singleton:!0}),p9e=Wn(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:s},{didMount:a}])=>(Et(Me(a,cn(o),Ht(([,u])=>u!==0),cn(i,e,t,r,n),ct(([[,u],c,d,h,p,m=[]])=>roe(u,c,d,h,p,m))),s),{}),Ar(xu,t_,dg,Td),{singleton:!0}),ioe=Wn(([{scrollVelocity:e}])=>{const t=tt(!1),n=Sn(),r=tt(!1);return Et(Me(e,cn(r,t,n),Ht(([i,o])=>!!o),ct(([i,o,s,a])=>{const{exit:u,enter:c}=o;if(s){if(u(i,a))return!1}else if(c(i,a))return!0;return s}),Sr()),t),Xn(Me(Ri(t,e,n),cn(r)),([[i,o,s],a])=>i&&a&&a.change&&a.change(o,s)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Ar(e_),{singleton:!0}),g9e=Wn(([{topItemsIndexes:e}])=>{const t=tt(0);return Et(Me(t,Ht(n=>n>0),ct(n=>Array.from({length:n}).map((r,i)=>i))),e),{topItemCount:t}},Ar(dg)),ooe=Wn(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:i}])=>{const o=Sn(),s=Fo(Me(Ri(e,r,t,n,i),ct(([a,u,c,d,h])=>a+u+c+d+h.offsetBottom+h.bottom)),0);return Et(jt(s),o),{totalListHeight:s,totalListHeightChanged:o}},Ar(Wo,dg),{singleton:!0});function soe(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const m9e=soe(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),v9e=Wn(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:i,isAtBottom:o,scrollDirection:s,lastJumpDueToItemResize:a},{listState:u},{beforeUnshiftWith:c,shiftWithOffset:d,sizes:h,gap:p},{log:m},{recalcInProgress:v}])=>{const y=Ys(Me(u,cn(a),Ql(([,w,b,x],[{items:E,totalCount:A,bottom:R,offsetBottom:I},M])=>{const D=R+I;let N=0;return b===A&&w.length>0&&E.length>0&&(E[0].originalIndex===0&&w[0].originalIndex===0||(N=D-x,N!==0&&(N+=M))),[N,E,A,D]},[0,[],0,0]),Ht(([w])=>w!==0),cn(t,s,r,o,m,v),Ht(([,w,b,x,,,E])=>!E&&!x&&w!==0&&b===sw),ct(([[w],,,,,b])=>(b("Upward scrolling compensation",{amount:w},Ks.DEBUG),w))));function S(w){w>0?(rn(e,{top:-w,behavior:"auto"}),rn(n,0)):(rn(n,0),rn(e,{top:-w,behavior:"auto"}))}return Xn(Me(y,cn(n,i)),([w,b,x])=>{x&&m9e()?rn(n,b-w):S(-w)}),Xn(Me(Ri(Fo(i,!1),n,v),Ht(([w,b,x])=>!w&&!x&&b!==0),ct(([w,b])=>b),Bf(1)),S),Et(Me(d,ct(w=>({top:-w}))),e),Xn(Me(c,cn(h,p),ct(([w,{lastSize:b,groupIndices:x,sizeTree:E},A])=>{function R(I){return I*(b+A)}if(x.length===0)return R(w);{let I=0;const M=iw(E,0);let D=0,N=0;for(;Dw&&(I-=M,H=w-D+1),D+=H,I+=R(H),N++}return I}})),w=>{rn(n,w),requestAnimationFrame(()=>{rn(e,{top:w}),requestAnimationFrame(()=>{rn(n,0),rn(v,!1)})})}),{deviation:n}},Ar(Wo,e_,dg,xu,Cd,FU)),y9e=Wn(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=tt(0);return Xn(Me(e,cn(r),Ht(([,i])=>i!==0),ct(([,i])=>({top:i}))),i=>{Xc(Me(n,fv(1),Ht(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{rn(t,i)})})}),{initialScrollTop:r}},Ar(Td,Wo,dg),{singleton:!0}),b9e=Wn(([{viewportHeight:e},{totalListHeight:t}])=>{const n=tt(!1),r=Fo(Me(Ri(n,e,t),Ht(([i])=>i),ct(([,i,o])=>Math.max(0,i-o)),Bf(0),Sr()),0);return{alignToBottom:n,paddingTopAddition:r}},Ar(Wo,ooe),{singleton:!0}),WU=Wn(([{scrollTo:e,scrollContainerState:t}])=>{const n=Sn(),r=Sn(),i=Sn(),o=tt(!1),s=tt(void 0);return Et(Me(Ri(n,r),ct(([{viewportHeight:a,scrollTop:u,scrollHeight:c},{offsetTop:d}])=>({scrollTop:Math.max(0,u-d),scrollHeight:c,viewportHeight:a}))),t),Et(Me(e,cn(r),ct(([a,{offsetTop:u}])=>({...a,top:a.top+u}))),i),{useWindowScroll:o,customScrollParent:s,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:i}},Ar(Wo)),x9e=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:i,align:o,...s}})=>er?{...s,behavior:i,align:o??"end"}:null,w9e=Wn(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:i,headerHeight:o,fixedHeaderHeight:s,fixedFooterHeight:a,scrollingInProgress:u},{scrollToIndex:c}])=>{const d=Sn();return Et(Me(d,cn(e,i,t,o,s,a,r),cn(n),ct(([[h,p,m,v,y,S,w,b],x])=>{const{done:E,behavior:A,align:R,calculateViewLocation:I=x9e,...M}=h,D=Jie(h,p,v-1),N=ow(D,p.offsetTree,x)+y+S,H=N+Pl(p.sizeTree,D)[1],G=b+S,z=b+m-w,L=I({itemTop:N,itemBottom:H,viewportTop:G,viewportBottom:z,locationParams:{behavior:A,align:R,...M}});return L?E&&Xc(Me(u,Ht(F=>F===!1),fv(Us(u)?1:2)),E):E&&E(),L}),Ht(h=>h!==null)),c),{scrollIntoView:d}},Ar(xu,Wo,Zw,dg,Cd),{singleton:!0}),_9e=Wn(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:i},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:a}])=>{const u=Sn(),c=tt(void 0),d=tt(null),h=tt(null);return Et(s,d),Et(a,h),Xn(Me(u,cn(e,n,o,d,h)),([p,m,v,y,S,w])=>{const b=r9e(m.sizeTree);y&&S!==null&&w!==null&&(v=S.scrollTop-w.offsetTop),p({ranges:b,scrollTop:v})}),Et(Me(c,Ht(NU),ct(S9e)),r),Et(Me(i,cn(c),Ht(([,p])=>p!==void 0),Sr(),ct(([,p])=>p.ranges)),t),{getState:u,restoreStateFrom:c}},Ar(xu,Wo,t_,Td,WU));function S9e(e){return{offset:e.scrollTop,index:0,align:"start"}}const E9e=Wn(([e,t,n,r,i,o,s,a,u,c])=>({...e,...t,...n,...r,...i,...o,...s,...a,...u,...c}),Ar(HU,p9e,Td,ioe,ooe,y9e,b9e,WU,w9e,Cd)),C9e=Wn(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:i,itemSize:o,data:s,firstItemIndex:a,groupIndices:u,statefulTotalCount:c,gap:d,sizes:h},{initialTopMostItemIndex:p,scrolledToInitialItem:m},v,y,S,{listState:w,topItemsIndexes:b,...x},{scrollToIndex:E},A,{topItemCount:R},{groupCounts:I},M])=>(Et(x.rangeChanged,M.scrollSeekRangeChanged),Et(Me(M.windowViewportRect,ct(D=>D.visibleHeight)),v.viewportHeight),{totalCount:e,data:s,firstItemIndex:a,sizeRanges:t,initialTopMostItemIndex:p,scrolledToInitialItem:m,topItemsIndexes:b,topItemCount:R,groupCounts:I,fixedItemHeight:n,defaultItemHeight:r,gap:d,...S,statefulTotalCount:c,listState:w,scrollToIndex:E,trackItemSizes:i,itemSize:o,groupIndices:u,...x,...M,...v,sizes:h,...y}),Ar(xu,t_,Wo,_9e,f9e,dg,Zw,v9e,g9e,toe,E9e)),W$="-webkit-sticky",NX="sticky",aoe=soe(()=>{if(typeof document>"u")return NX;const e=document.createElement("div");return e.style.position=W$,e.style.position===W$?W$:NX});function loe(e,t){const n=fe.useRef(null),r=fe.useCallback(a=>{if(a===null||!a.offsetParent)return;const u=a.getBoundingClientRect(),c=u.width;let d,h;if(t){const p=t.getBoundingClientRect(),m=u.top-p.top;d=p.height-Math.max(0,m),h=m+t.scrollTop}else d=window.innerHeight-Math.max(0,u.top),h=u.top+window.pageYOffset;n.current={offsetTop:h,visibleHeight:d,visibleWidth:c},e(n.current)},[e,t]),{callbackRef:i,ref:o}=$U(r),s=fe.useCallback(()=>{r(o.current)},[r,o]);return fe.useEffect(()=>{if(t){t.addEventListener("scroll",s);const a=new ResizeObserver(s);return a.observe(t),()=>{t.removeEventListener("scroll",s),a.unobserve(t)}}else return window.addEventListener("scroll",s),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}},[s,t]),i}const uoe=fe.createContext(void 0),coe=fe.createContext(void 0);function foe(e){return e}const T9e=Wn(()=>{const e=tt(u=>`Item ${u}`),t=tt(null),n=tt(u=>`Group ${u}`),r=tt({}),i=tt(foe),o=tt("div"),s=tt(Fv),a=(u,c=null)=>Fo(Me(r,ct(d=>d[u]),Sr()),c);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:i,headerFooterTag:o,scrollerRef:s,FooterComponent:a("Footer"),HeaderComponent:a("Header"),TopItemListComponent:a("TopItemList"),ListComponent:a("List","div"),ItemComponent:a("Item","div"),GroupComponent:a("Group","div"),ScrollerComponent:a("Scroller","div"),EmptyPlaceholder:a("EmptyPlaceholder"),ScrollSeekPlaceholder:a("ScrollSeekPlaceholder")}}),A9e=Wn(([e,t])=>({...e,...t}),Ar(C9e,T9e)),I9e=({height:e})=>fe.createElement("div",{style:{height:e}}),R9e={position:aoe(),zIndex:1,overflowAnchor:"none"},P9e={overflowAnchor:"none"},BX=fe.memo(function({showTopList:t=!1}){const n=bn("listState"),r=_a("sizeRanges"),i=bn("useWindowScroll"),o=bn("customScrollParent"),s=_a("windowScrollContainerState"),a=_a("scrollContainerState"),u=o||i?s:a,c=bn("itemContent"),d=bn("context"),h=bn("groupContent"),p=bn("trackItemSizes"),m=bn("itemSize"),v=bn("log"),y=_a("gap"),{callbackRef:S}=WGe(r,m,p,t?Fv:u,v,y,o),[w,b]=fe.useState(0);GU("deviation",L=>{w!==L&&b(L)});const x=bn("EmptyPlaceholder"),E=bn("ScrollSeekPlaceholder")||I9e,A=bn("ListComponent"),R=bn("ItemComponent"),I=bn("GroupComponent"),M=bn("computeItemKey"),D=bn("isSeeking"),N=bn("groupIndices").length>0,H=bn("paddingTopAddition"),G=bn("scrolledToInitialItem"),z=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+H,paddingBottom:n.offsetBottom,marginTop:w,...G?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&x?fe.createElement(x,Jo(x,d)):fe.createElement(A,{...Jo(A,d),ref:S,style:z,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(L=>{const F=L.originalIndex,U=M(F+n.firstItemIndex,L.data,d);return D?fe.createElement(E,{...Jo(E,d),key:U,index:L.index,height:L.size,type:L.type||"item",...L.type==="group"?{}:{groupIndex:L.groupIndex}}):L.type==="group"?fe.createElement(I,{...Jo(I,d),key:U,"data-index":F,"data-known-size":L.size,"data-item-index":L.index,style:R9e},h(L.index,d)):fe.createElement(R,{...Jo(R,d),key:U,"data-index":F,"data-known-size":L.size,"data-item-index":L.index,"data-item-group-index":L.groupIndex,item:L.data,style:P9e},N?c(L.index,L.groupIndex,L.data,d):c(L.index,L.data,d))}))}),O9e={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},YI={width:"100%",height:"100%",position:"absolute",top:0},M9e={width:"100%",position:aoe(),top:0,zIndex:1};function Jo(e,t){if(typeof e!="string")return{context:t}}const k9e=fe.memo(function(){const t=bn("HeaderComponent"),n=_a("headerHeight"),r=bn("headerFooterTag"),i=fg(s=>n(fd(s,"height"))),o=bn("context");return t?fe.createElement(r,{ref:i},fe.createElement(t,Jo(t,o))):null}),L9e=fe.memo(function(){const t=bn("FooterComponent"),n=_a("footerHeight"),r=bn("headerFooterTag"),i=fg(s=>n(fd(s,"height"))),o=bn("context");return t?fe.createElement(r,{ref:i},fe.createElement(t,Jo(t,o))):null});function doe({usePublisher:e,useEmitter:t,useEmitterValue:n}){return fe.memo(function({style:o,children:s,...a}){const u=e("scrollContainerState"),c=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),h=n("scrollerRef"),p=n("context"),{scrollerRef:m,scrollByCallback:v,scrollToCallback:y}=Gie(u,d,c,h);return t("scrollTo",y),t("scrollBy",v),fe.createElement(c,{ref:m,style:{...O9e,...o},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...a,...Jo(c,p)},s)})}function hoe({usePublisher:e,useEmitter:t,useEmitterValue:n}){return fe.memo(function({style:o,children:s,...a}){const u=e("windowScrollContainerState"),c=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),h=n("totalListHeight"),p=n("deviation"),m=n("customScrollParent"),v=n("context"),{scrollerRef:y,scrollByCallback:S,scrollToCallback:w}=Gie(u,d,c,Fv,m);return UGe(()=>(y.current=m||window,()=>{y.current=null}),[y,m]),t("windowScrollTo",w),t("scrollBy",S),fe.createElement(c,{style:{position:"relative",...o,...h!==0?{height:h+p}:{}},"data-virtuoso-scroller":!0,...a,...Jo(c,v)},s)})}const D9e=({children:e})=>{const t=fe.useContext(uoe),n=_a("viewportHeight"),r=_a("fixedItemHeight"),i=fg(zie(n,o=>fd(o,"height")));return fe.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),fe.createElement("div",{style:YI,ref:i,"data-viewport-type":"element"},e)},N9e=({children:e})=>{const t=fe.useContext(uoe),n=_a("windowViewportRect"),r=_a("fixedItemHeight"),i=bn("customScrollParent"),o=loe(n,i);return fe.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),fe.createElement("div",{ref:o,style:YI,"data-viewport-type":"window"},e)},B9e=({children:e})=>{const t=bn("TopItemListComponent"),n=bn("headerHeight"),r={...M9e,marginTop:`${n}px`},i=bn("context");return fe.createElement(t||"div",{style:r,context:i},e)},$9e=fe.memo(function(t){const n=bn("useWindowScroll"),r=bn("topItemsIndexes").length>0,i=bn("customScrollParent"),o=i||n?U9e:z9e,s=i||n?N9e:D9e;return fe.createElement(o,{...t},r&&fe.createElement(B9e,null,fe.createElement(BX,{showTopList:!0})),fe.createElement(s,null,fe.createElement(k9e,null),fe.createElement(BX,null),fe.createElement(L9e,null)))}),{Component:F9e,usePublisher:_a,useEmitterValue:bn,useEmitter:GU}=Hie(A9e,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},$9e),z9e=doe({usePublisher:_a,useEmitterValue:bn,useEmitter:GU}),U9e=hoe({usePublisher:_a,useEmitterValue:bn,useEmitter:GU}),j9e=F9e,$X={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},H9e={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:FX,ceil:zX,floor:mT,min:G$,max:e1}=Math;function W9e(e){return{...H9e,items:e}}function UX(e,t,n){return Array.from({length:t-e+1}).map((r,i)=>{const o=n===null?null:n[i+e];return{index:i+e,data:o}})}function G9e(e,t){return e&&e.column===t.column&&e.row===t.row}function jS(e,t){return e&&e.width===t.width&&e.height===t.height}const V9e=Wn(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:i,scrollBy:o,scrollTo:s,smoothScrollTargetReached:a,scrollContainerState:u,footerHeight:c,headerHeight:d},h,p,{propsReady:m,didMount:v},{windowViewportRect:y,useWindowScroll:S,customScrollParent:w,windowScrollContainerState:b,windowScrollTo:x},E])=>{const A=tt(0),R=tt(0),I=tt($X),M=tt({height:0,width:0}),D=tt({height:0,width:0}),N=Sn(),H=Sn(),G=tt(0),z=tt(null),L=tt({row:0,column:0}),F=Sn(),U=Sn(),V=tt(!1),W=tt(0),K=tt(!0),q=tt(!1);Xn(Me(v,cn(W),Ht(([J,ae])=>!!ae)),()=>{rn(K,!1),rn(R,0)}),Xn(Me(Ri(v,K,D,M,W,q),Ht(([J,ae,le,he,,pe])=>J&&!ae&&le.height!==0&&he.height!==0&&!pe)),([,,,,J])=>{rn(q,!0),UU(1,()=>{rn(N,J)}),Xc(Me(r),()=>{rn(n,[0,0]),rn(K,!0)})}),Et(Me(U,Ht(J=>J!=null&&J.scrollTop>0),_c(0)),R),Xn(Me(v,cn(U),Ht(([,J])=>J!=null)),([,J])=>{J&&(rn(M,J.viewport),rn(D,J==null?void 0:J.item),rn(L,J.gap),J.scrollTop>0&&(rn(V,!0),Xc(Me(r,fv(1)),ae=>{rn(V,!1)}),rn(s,{top:J.scrollTop})))}),Et(Me(M,ct(({height:J})=>J)),i),Et(Me(Ri(jt(M,jS),jt(D,jS),jt(L,(J,ae)=>J&&J.column===ae.column&&J.row===ae.row),jt(r)),ct(([J,ae,le,he])=>({viewport:J,item:ae,gap:le,scrollTop:he}))),F),Et(Me(Ri(jt(A),t,jt(L,G9e),jt(D,jS),jt(M,jS),jt(z),jt(R),jt(V),jt(K),jt(W)),Ht(([,,,,,,,J])=>!J),ct(([J,[ae,le],he,pe,ve,ye,xe,,ge,be])=>{const{row:Ze,column:qe}=he,{height:ut,width:Bt}=pe,{width:Oe}=ve;if(xe===0&&(J===0||Oe===0))return $X;if(Bt===0){const Ot=jU(be,J),ft=Ot===0?Math.max(xe-1,0):Ot;return W9e(UX(Ot,ft,ye))}const ze=poe(Oe,Bt,qe);let st,mt;ge?ae===0&&le===0&&xe>0?(st=0,mt=xe-1):(st=ze*mT((ae+Ze)/(ut+Ze)),mt=ze*zX((le+Ze)/(ut+Ze))-1,mt=G$(J-1,e1(mt,ze-1)),st=G$(mt,e1(0,st))):(st=0,mt=-1);const vt=UX(st,mt,ye),{top:_e,bottom:Ue}=jX(ve,he,pe,vt),Ke=zX(J/ze),Be=Ke*ut+(Ke-1)*Ze-Ue;return{items:vt,offsetTop:_e,offsetBottom:Be,top:_e,bottom:Ue,itemHeight:ut,itemWidth:Bt}})),I),Et(Me(z,Ht(J=>J!==null),ct(J=>J.length)),A),Et(Me(Ri(M,D,I,L),Ht(([J,ae,{items:le}])=>le.length>0&&ae.height!==0&&J.height!==0),ct(([J,ae,{items:le},he])=>{const{top:pe,bottom:ve}=jX(J,he,ae,le);return[pe,ve]}),Sr(aw)),n);const Q=tt(!1);Et(Me(r,cn(Q),ct(([J,ae])=>ae||J!==0)),Q);const re=Ys(Me(jt(I),Ht(({items:J})=>J.length>0),cn(A,Q),Ht(([{items:J},ae,le])=>le&&J[J.length-1].index===ae-1),ct(([,J])=>J-1),Sr())),ue=Ys(Me(jt(I),Ht(({items:J})=>J.length>0&&J[0].index===0),_c(0),Sr())),ce=Ys(Me(jt(I),cn(V),Ht(([{items:J},ae])=>J.length>0&&!ae),ct(([{items:J}])=>({startIndex:J[0].index,endIndex:J[J.length-1].index})),Sr(noe),Bf(0)));Et(ce,p.scrollSeekRangeChanged),Et(Me(N,cn(M,D,A,L),ct(([J,ae,le,he,pe])=>{const ve=eoe(J),{align:ye,behavior:xe,offset:ge}=ve;let be=ve.index;be==="LAST"&&(be=he-1),be=e1(0,be,G$(he-1,be));let Ze=e4(ae,pe,le,be);return ye==="end"?Ze=FX(Ze-ae.height+le.height):ye==="center"&&(Ze=FX(Ze-ae.height/2+le.height/2)),ge&&(Ze+=ge),{top:Ze,behavior:xe}})),s);const se=Fo(Me(I,ct(J=>J.offsetBottom+J.bottom)),0);return Et(Me(y,ct(J=>({width:J.visibleWidth,height:J.visibleHeight}))),M),{data:z,totalCount:A,viewportDimensions:M,itemDimensions:D,scrollTop:r,scrollHeight:H,overscan:e,scrollBy:o,scrollTo:s,scrollToIndex:N,smoothScrollTargetReached:a,windowViewportRect:y,windowScrollTo:x,useWindowScroll:S,customScrollParent:w,windowScrollContainerState:b,deviation:G,scrollContainerState:u,footerHeight:c,headerHeight:d,initialItemCount:R,gap:L,restoreStateFrom:U,...p,initialTopMostItemIndex:W,gridState:I,totalListHeight:se,...h,startReached:ue,endReached:re,rangeChanged:ce,stateChanged:F,propsReady:m,stateRestoreInProgress:V,...E}},Ar(HU,Wo,e_,ioe,Td,WU,Cd));function jX(e,t,n,r){const{height:i}=n;if(i===void 0||r.length===0)return{top:0,bottom:0};const o=e4(e,t,n,r[0].index),s=e4(e,t,n,r[r.length-1].index)+i;return{top:o,bottom:s}}function e4(e,t,n,r){const i=poe(e.width,n.width,t.column),o=mT(r/i),s=o*n.height+e1(0,o-1)*t.row;return s>0?s+t.row:s}function poe(e,t,n){return e1(1,mT((e+n)/(mT(t)+n)))}const X9e=Wn(()=>{const e=tt(c=>`Item ${c}`),t=tt({}),n=tt(null),r=tt("virtuoso-grid-item"),i=tt("virtuoso-grid-list"),o=tt(foe),s=tt("div"),a=tt(Fv),u=(c,d=null)=>Fo(Me(t,ct(h=>h[c]),Sr()),d);return{context:n,itemContent:e,components:t,computeItemKey:o,itemClassName:r,listClassName:i,headerFooterTag:s,scrollerRef:a,FooterComponent:u("Footer"),HeaderComponent:u("Header"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),ScrollerComponent:u("Scroller","div"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),q9e=Wn(([e,t])=>({...e,...t}),Ar(V9e,X9e)),Y9e=fe.memo(function(){const t=Lr("gridState"),n=Lr("listClassName"),r=Lr("itemClassName"),i=Lr("itemContent"),o=Lr("computeItemKey"),s=Lr("isSeeking"),a=Tl("scrollHeight"),u=Lr("ItemComponent"),c=Lr("ListComponent"),d=Lr("ScrollSeekPlaceholder"),h=Lr("context"),p=Tl("itemDimensions"),m=Tl("gap"),v=Lr("log"),y=Lr("stateRestoreInProgress"),S=fg(w=>{const b=w.parentElement.parentElement.scrollHeight;a(b);const x=w.firstChild;if(x){const{width:E,height:A}=x.getBoundingClientRect();p({width:E,height:A})}m({row:HX("row-gap",getComputedStyle(w).rowGap,v),column:HX("column-gap",getComputedStyle(w).columnGap,v)})});return y?null:fe.createElement(c,{ref:S,className:n,...Jo(c,h),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(w=>{const b=o(w.index,w.data,h);return s?fe.createElement(d,{key:b,...Jo(d,h),index:w.index,height:t.itemHeight,width:t.itemWidth}):fe.createElement(u,{...Jo(u,h),className:r,"data-index":w.index,key:b},i(w.index,w.data,h))}))}),K9e=fe.memo(function(){const t=Lr("HeaderComponent"),n=Tl("headerHeight"),r=Lr("headerFooterTag"),i=fg(s=>n(fd(s,"height"))),o=Lr("context");return t?fe.createElement(r,{ref:i},fe.createElement(t,Jo(t,o))):null}),Q9e=fe.memo(function(){const t=Lr("FooterComponent"),n=Tl("footerHeight"),r=Lr("headerFooterTag"),i=fg(s=>n(fd(s,"height"))),o=Lr("context");return t?fe.createElement(r,{ref:i},fe.createElement(t,Jo(t,o))):null}),J9e=({children:e})=>{const t=fe.useContext(coe),n=Tl("itemDimensions"),r=Tl("viewportDimensions"),i=fg(o=>{r(o.getBoundingClientRect())});return fe.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),fe.createElement("div",{style:YI,ref:i},e)},Z9e=({children:e})=>{const t=fe.useContext(coe),n=Tl("windowViewportRect"),r=Tl("itemDimensions"),i=Lr("customScrollParent"),o=loe(n,i);return fe.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),fe.createElement("div",{ref:o,style:YI},e)},e7e=fe.memo(function({...t}){const n=Lr("useWindowScroll"),r=Lr("customScrollParent"),i=r||n?n7e:t7e,o=r||n?Z9e:J9e;return fe.createElement(i,{...t},fe.createElement(o,null,fe.createElement(K9e,null),fe.createElement(Y9e,null),fe.createElement(Q9e,null)))}),{Component:lVe,usePublisher:Tl,useEmitterValue:Lr,useEmitter:goe}=Hie(q9e,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},e7e),t7e=doe({usePublisher:Tl,useEmitterValue:Lr,useEmitter:goe}),n7e=hoe({usePublisher:Tl,useEmitterValue:Lr,useEmitter:goe});function HX(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ks.WARN),t==="normal"?0:parseInt(t??"0",10)}const r7e=O.forwardRef(({style:e,children:t,...n},r)=>{const i=O.useRef(null),{palette:o,spacing:s}=Ln(),a=E1({".os-scrollbar":{visibility:"visible",opacity:1},".os-scrollbar-vertical > .os-scrollbar-track > .os-scrollbar-handle":{"min-height":s(12)},"div.os-scrollbar-vertical > div.os-scrollbar-track":{height:`calc(100% - ${s(6)})`,marginTop:s(6)}}),[u]=yJ({options:{overflow:{x:"hidden",y:"scroll"},scrollbars:{autoHide:"move",theme:o.mode==="dark"?"os-theme-light":"os-theme-dark"}}});O.useEffect(()=>{typeof r!="function"&&(r!=null&&r.current)&&(i!=null&&i.current)&&u({target:i.current,elements:{viewport:r.current}})},[u]);const c=O.useCallback(d=>{d&&r&&(typeof r=="function"?r(d):r.current=d)},[r]);return C.jsx("div",{ref:i,style:e,className:a,children:C.jsx("div",{ref:c,...n,children:t})})});function i7e({items:e=[],renderItem:t,listOptions:n,placeholder:r,...i}){return C.jsx(gt,{...i,children:C.jsx(j9e,{components:{Scroller:r7e},totalCount:e.length,itemContent:o=>t==null?void 0:t(e[o],o),...n})})}function o7e({event:e,hidden:t}){return C.jsxs(CFe,{children:[ie.startCase(`${(e==null?void 0:e.type)??"unsupported"} #${(e==null?void 0:e.id)??"-"}`)," ",t&&C.jsx(y1e,{sx:{opacity:.56,fontSize:12,ml:1,transform:"translateY(1.75px)"}})]})}function s7e({event:e,index:t,selected:n,...r}){const{spacing:i}=Ln(),[,o]=Vp();return C.jsxs(ZF,{selected:n,...r,sx:{borderLeft:`${i(.5)} solid ${j1(e==null?void 0:e.type)}`,...r.sx},onClick:()=>o({step:t}),children:[C.jsx(Vf,{children:C.jsx(Wt,{variant:"body2",children:t})}),C.jsx(yd,{title:C.jsx(q3,{event:e,flexDirection:"column"}),children:C.jsx(ru,{sx:{overflow:"hidden"},primary:C.jsx(o7e,{event:e,hidden:!1}),secondary:C.jsx(q3,{event:ie.pick(e,"f","g","pId")})})})]})}const a7e=C.jsx(Qc,{orientation:"vertical",flexItem:!0,sx:{m:1}}),l7e=e=>Number(e.replace(/px$/,""));function u7e(){const{spacing:e}=Ln(),{controls:t,onChange:n,state:r}=xd(),[{step:i=0,playback:o},s]=Vp(),[{layers:a}]=ta(),u=O.useRef(null),[c,d]=O.useState(),h=ie.find(a,{key:c});O.useEffect(()=>{var m;c||d((m=ie.head(a))==null?void 0:m.key)},[c,d,a]);const p=O.useMemo(()=>{var m;if(h)return O.createElement(Hw[((m=h==null?void 0:h.source)==null?void 0:m.type)??""].steps,{layer:h})},[h]);return O.useEffect(()=>{o==="paused"&&ie.delay(()=>{var m,v;return(v=(m=u==null?void 0:u.current)==null?void 0:m.scrollToIndex)==null?void 0:v.call(m,{index:i,align:"start",behavior:"smooth",offset:-l7e(e(6+2))})},150)},[i,o,e]),C.jsxs(zn,{onChange:n,stack:r,children:[C.jsx(zn.Content,{children:C.jsx(En,{vertical:!0,alignItems:"center",children:p?o!=="playing"?O.cloneElement(p,{children:m=>h?m.length?C.jsx(i7e,{sx:{width:"100%",height:"100%"},items:m,listOptions:{ref:u,defaultItemHeight:80,overscan:0},renderItem:(v,y)=>C.jsxs(gt,{sx:{height:e(y?10:16),pt:y?0:e(6)},children:[C.jsx(s7e,{event:v,index:y,selected:y===i,sx:{height:"100%"}}),C.jsx(Qc,{variant:"inset"})]})}):C.jsx(pp,{icon:C.jsx(sE,{}),label:`${Ia(h)} has no steps to display`}):C.jsx(pp,{icon:C.jsx(sE,{}),label:"Steps"})}):C.jsx(pp,{icon:C.jsx($A,{}),label:C.jsxs(C.Fragment,{children:[C.jsx(Wt,{children:"Running"}),C.jsx(Mz,{onClick:()=>s({playback:"paused"}),children:"Pause"})]})}):C.jsx(pp,{icon:C.jsx(sE,{}),label:"Steps"})})}),C.jsxs(zn.Options,{children:[C.jsx(Ws,{icon:C.jsx(Sw,{}),label:"Layer",value:c,items:ie.map(a,m=>({id:m.key,name:Ia(m)})),onChange:d,showArrow:!0}),a7e,C.jsx(OGe,{layer:h})]}),C.jsx(zn.Extras,{children:t})]})}const c7e=e=>e?48:36,f7e=8;function d7e({trigger:e,items:t,value:n,onChange:r,placeholder:i="Select Options",defaultChecked:o}){const s=t6(),a=ie.max([ie.findIndex(t,({value:u})=>!!(n!=null&&n[u])),0])??0;return C.jsx(tg,{variant:"popover",children:u=>C.jsxs(C.Fragment,{children:[C.jsx(yd,{title:i,children:C.jsx("span",{children:e==null?void 0:e(KA(u))})}),C.jsx(eg,{...Dw(u),anchorOrigin:{horizontal:"center",vertical:-c7e(s)*a-f7e},transformOrigin:{vertical:"top",horizontal:"center"},children:ie.map(t,({value:c,label:d,disabled:h})=>C.jsxs(Pc,{disabled:h,onClick:()=>{r==null||r({...n,[c]:!((n==null?void 0:n[c])??o)})},children:[C.jsx(Vf,{children:C.jsx(Rme,{sx:{p:0},checked:!!((n==null?void 0:n[c])??o)})}),d]},c))})]})})}function h7e({label:e,value:t,onChange:n,items:r,icon:i,showArrow:o,defaultChecked:s}){var c;const a=ie.filter(r,({id:d})=>!!((t==null?void 0:t[d])??s)),u=a.length?a.length===1?(c=ie.head(a))==null?void 0:c.name:`${a.length} Selected`:e;return C.jsx(d7e,{defaultChecked:!0,placeholder:ie.startCase(e),trigger:d=>C.jsx(id,{...d,disabled:!(r!=null&&r.length),icon:i,showArrow:o,children:u}),items:ie.map(r,({id:d,name:h,description:p,hidden:m})=>({value:d,label:C.jsxs(C.Fragment,{children:[C.jsx(Wt,{children:h}),C.jsx(ai,{}),C.jsx(Wt,{variant:"body2",color:"text.secondary",children:p})]}),disabled:m})),value:t,onChange:n})}const WX=C.jsx(Qc,{orientation:"vertical",flexItem:!0,sx:{m:1}});function p7e(){var p,m,v,y;const{controls:e,onChange:t,state:n}=xd(),[r]=_I(),[{layers:i}]=ta(),[o,s]=O.useState({}),a=O.useMemo(()=>ie.filter(i,S=>(o==null?void 0:o[S.key])??!0),[o,i]),[u,c]=O.useState(),d=O.useMemo(()=>ie.head(r),[r]),h=n!=null&&n.renderer&&n.renderer!=="internal:auto"?n.renderer:(m=(p=d==null?void 0:d.renderer)==null?void 0:p.meta)==null?void 0:m.id;return C.jsxs(zn,{onChange:t,stack:n,children:[C.jsx(zn.Content,{children:C.jsx(En,{children:C.jsx(JA,{children:S=>C.jsx(gt,{children:C.jsx(b$e,{...S,layers:a,renderer:h,rendererRef:c})})})})}),C.jsx(zn.Options,{children:C.jsxs(Gm,{direction:"row",children:[C.jsx(Ws,{label:"Renderer",icon:C.jsx(a1e,{}),value:(n==null?void 0:n.renderer)??"internal:auto",onChange:S=>t==null?void 0:t({renderer:S}),items:[{id:"internal:auto",name:`Auto (${((y=(v=d==null?void 0:d.renderer)==null?void 0:v.meta)==null?void 0:y.name)??"None"})`},...ie.map(r,({renderer:S})=>({id:S.meta.id,name:S.meta.name,description:S.meta.id}))],showArrow:!0}),WX,C.jsx(h7e,{defaultChecked:!0,label:"Layers",icon:C.jsx(Sw,{}),value:o,onChange:s,items:ie.map(i,S=>({id:S.key,name:Ia(S)})),showArrow:!0}),WX,C.jsx(id,{disabled:!u,onClick:()=>{u==null||u.fitCamera()},icon:C.jsx(c1e,{}),children:"Fit"}),C.jsx(id,{disabled:!u,onClick:()=>{u==null||u.initialCamera()},icon:C.jsx(p1e,{}),children:"1:1"})]})}),C.jsx(zn.Extras,{children:e})]})}const t4={viewport:{id:"viewport",name:"Viewport",icon:C.jsx(NQ,{}),content:p7e},tree:{id:"tree",name:"Tree",icon:C.jsx(OQ,{}),content:c$e},steps:{id:"steps",name:"Steps",icon:C.jsx(sE,{}),content:u7e},info:{id:"info",name:"Logs",icon:C.jsx(LQ,{}),content:cPe},layers:{id:"layers",name:"Layers",icon:C.jsx(Sw,{}),content:EFe},debug:{id:"debug",name:"Debugger",icon:C.jsx(u1e,{}),content:uPe},settings:{id:"settings",name:"Settings",icon:C.jsx(A1e,{}),content:TGe},about:{id:"about",name:"About",icon:C.jsx(b1e,{}),content:ySe}},[g7e,m7e]=gu({view:{type:"branch",key:da(),orientation:"horizontal",children:[{size:75,type:"branch",key:da(),orientation:"horizontal",children:[{type:"leaf",size:25,key:da(),content:{type:"layers"}},{size:75,type:"branch",key:da(),orientation:"vertical",children:[{type:"leaf",size:75,key:da(),content:{type:"viewport"}},{type:"leaf",size:25,key:da(),content:{type:"info"}}]}]},{size:25,type:"leaf",key:da(),content:{type:"steps"}}]}});function v7e(e){const t=_Pe(),[{view:n},r]=g7e();return C.jsxs(C.Fragment,{children:[C.jsx(En,{...e,children:C.jsx(IJ,{root:n,onChange:i=>r({view:i}),renderLeaf:({content:i})=>{var o;return C.jsx(Up,{in:!0,children:C.jsx(gt,{sx:{width:"100%",height:"100%"},children:O.createElement((o=t4[(i==null?void 0:i.type)??""])==null?void 0:o.content)})})}})}),C.jsx(Up,{in:t,children:C.jsx(b0e,{variant:"indeterminate",sx:{position:"absolute",bottom:0,width:"100%",zIndex:1}})})]})}const y7e=e=>J$(e,"#ffffff")>J$(e,"#000000")?"#ffffff":"#000000";function b7e(e){O.useEffect(()=>{document.querySelector('meta[name="theme-color"]').setAttribute("content",e),document.title=CC,"electron"in window&&window.electron.invoke("title-bar","#00000000",y7e(e))},[e])}function x7e(e){return new Promise(t=>ie.delay(t,e))}async function w7e(e,t=2500){const n=ie.now();return{result:await Promise.any([e(),x7e(t)]),delta:ie.now()-n}}function _7e(){const e=mu(),[{remote:t}]=Zc(),[,n]=Zm(),r=ng("connections");return O.useEffect(()=>{let i=!1,o=[];return r(async()=>{if(t!=null&&t.length){for(const{transport:s,url:a,disabled:u}of t){if(u!==!0){e(`Connecting to ${a}...`);const c=new(xGe(s))({url:a});await c.connect();const{result:d,delta:h}=await w7e(()=>c.call("about"));d?(e(`Connected to ${d.name}.`),o=[...o,{...d,url:a,ping:h,call:c.call.bind(c),disconnect:c.disconnect.bind(c)}]):await c.disconnect()}i||n(o)}i||e(`Connected to ${o.length} of ${t.length} solvers.`)}}),()=>{i=!0,o.map(s=>s.disconnect())}},[t,n,e,r]),C.jsx(C.Fragment,{})}const S7e=e=>t=>({...t,source:e});function E7e(){const[e]=Zm(),[,t]=DC(),n=ng("features");return Bte(r=>n(async()=>{const i={algorithms:[],formats:ie.keys(nU).map(o=>({id:o,source:"internal"})),maps:[]};for(const{call:o,url:s}of e)for(const a of["algorithms","formats","maps"])i[a]=ie.uniqBy([...i[a],...ie.map(await o(`features/${a}`),S7e(s))],"id");r.aborted||t(i)}),[e,t]),C.jsx(C.Fragment,{})}function C7e(){const[{layers:e},t]=ta();return O.useMemo(()=>ie.map(e,n=>{const r=cne(n).service;if(r)return O.createElement(r,{key:n.key,value:n,onChange:i=>t({layers:ie.map(e,o=>o.key===n.key?i:o)})})}),[e,t])}function T7e(){const e=C7e();return C.jsx(C.Fragment,{children:e})}function moe({slices:e,children:t,services:n}){return C.jsx(C.Fragment,{children:ie.reduce(ie.map(e,r=>O.createElement(r)),(r,i)=>O.cloneElement(i,{},r),C.jsxs(C.Fragment,{children:[t,ie.map(n,(r,i)=>O.createElement(r,{key:i}))]}))})}var voe={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(qt,function(){return function n(r,i,o){var s=window,a="application/octet-stream",u=o||a,c=r,d=!i&&!o&&c,h=document.createElement("a"),p=function(I){return String(I)},m=s.Blob||s.MozBlob||s.WebKitBlob||p,v=i||"download",y,S;if(m=m.call?m.bind(s):Blob,String(this)==="true"&&(c=[c,u],u=c[0],c=c[1]),d&&d.length<2048&&(v=d.split("/").pop().split("?")[0],h.href=d,h.href.indexOf(d)!==-1)){var w=new XMLHttpRequest;return w.open("GET",d,!0),w.responseType="blob",w.onload=function(I){n(I.target.response,v,a)},setTimeout(function(){w.send()},0),w}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(c))if(c.length>1024*1024*1.999&&m!==p)c=A(c),u=c.type||a;else return navigator.msSaveBlob?navigator.msSaveBlob(A(c),v):R(c);else if(/([\x80-\xff])/.test(c)){var b=0,x=new Uint8Array(c.length),E=x.length;for(b;b`.workspace.${t}`),strict:!0});if(e&&GX.includes(P7e(e.name))){const t=await e.text();return F6.parse(t)}}const k7e=()=>{const[e,t]=ta(),[n,r]=O.useState(!1);return O.useEffect(()=>{if("windowControlsOverlay"in navigator){const i=()=>{r(!!navigator.windowControlsOverlay.visible)};return navigator.windowControlsOverlay.addEventListener("geometrychange",i),i(),()=>navigator.windowControlsOverlay.removeEventListener("geometrychange",i)}},[r]),C.jsx(gt,{sx:{mt:-.5,minHeight:36,height:n?"env(titlebar-area-height, 50px)":0,width:"env(titlebar-area-width, 100%)",WebkitAppRegion:"drag"},children:C.jsx(gt,{sx:{height:"100%"},children:C.jsxs(Gm,{direction:"row",spacing:1,sx:{height:"100%"},alignItems:"center",children:[C.jsx(gt,{sx:{p:1,pr:0,height:"100%"},children:C.jsx("img",{src:OJ,style:{height:"100%"}})}),C.jsx(Wt,{sx:{fontSize:14,fontWeight:300,pr:1.5},children:CC}),[{key:"file",items:[{name:"Load workspace",key:"workspace-load",action:async()=>{const i=await M7e();i&&t(i)}},{name:"Save workspace",key:"workspace-save",action:()=>{O7e(`${R7e()}.workspace`,e)}}]},{key:"help",items:[{name:"Open repository in GitHub",key:"github",action:()=>open(mSe,"_blank")}]}].map(({key:i,items:o})=>C.jsx(tg,{variant:"popover",children:s=>C.jsxs(C.Fragment,{children:[C.jsx(eg,{...Dw(s),children:C.jsx(FA,{dense:!0,sx:{p:0},children:o.map(({name:a,key:u,action:c})=>C.jsx(Pc,{onClick:()=>{c==null||c(),s.close()},children:a},u))})}),C.jsx(id,{...KA(s),sx:{WebkitAppRegion:"no-drag",minWidth:0,p:.5,px:1},children:ie.startCase(i)})]})},i)),C.jsx(gt,{sx:{p:.75,height:"100%"},children:C.jsx(L7e,{})})]})})})};function L7e(){const e=mu();return C.jsxs(Kc,{onClick:()=>e("Commands are not yet implemented."),sx:{WebkitAppRegion:"no-drag",fontSize:14,borderRadius:t=>t.shape.borderRadius,"&:hover":{bgcolor:"background.paper"},height:"100%",m:0,display:"flex",alignItems:"center",px:1,pr:2,gap:t=>t.spacing(1),color:"text.secondary",cursor:"text"},children:[C.jsx(T1e,{fontSize:"small",color:"disabled"})," ",C.jsx(Wt,{sx:{mt:0},children:"Commands"})]})}const D7e=[_7e,E7e,aWe,T7e];function N7e(){const t=Ln().palette.background.default;return b7e(t),C.jsxs(En,{vertical:!0,sx:{bgcolor:t,p:.5,color:"text.primary"},children:[C.jsx(k7e,{}),C.jsx(v7e,{flex:1})]})}function B7e(){const[{theme:e="light",accentColor:t="teal"}]=Zc(),n=O.useMemo(()=>dSe(e,t),[e,t]);return C.jsx(Vue,{theme:n,children:C.jsx(swe,{children:C.jsx(moe,{services:D7e,children:C.jsx(N7e,{})})})})}const[uVe,$7e]=gu({});const F7e=PQ(document.getElementById("root")),z7e=[uSe,bPe,xPe,zEe,$7e,wPe,p$e,zDe,owe,m7e];F7e.render(C.jsx(jme,{children:C.jsx(moe,{slices:z7e,children:C.jsx(B7e,{})})})); +Use Save As... to download, then click back to return to this page.`)&&(location.href=I),!0;var D=document.createElement("iframe");document.body.appendChild(D),!M&&/^data:/.test(I)&&(I="data:"+I.replace(/^data:([\w\/\-\+]+)/,a)),D.src=I,setTimeout(function(){document.body.removeChild(D)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(y,v);if(s.URL)R(s.URL.createObjectURL(y),!0);else{if(typeof y=="string"||y.constructor===p)try{return R("data:"+u+";base64,"+s.btoa(y))}catch{return R("data:"+u+","+encodeURIComponent(y))}S=new FileReader,S.onload=function(I){R(this.result)},S.readAsDataURL(y)}return!0}})})(voe);var A7e=voe.exports;const I7e=cs(A7e),R7e=G_e("qwertyuiopasdfghjklzxcvbnm1234567890",6);function P7e(e){return e.split(".").pop()}function O7e(e,t){I7e(JSON.stringify(t),`${e}.json`,"application/json")}const GX=["json","yaml"];async function M7e(){const e=await I6({accept:GX.map(t=>`.workspace.${t}`),strict:!0});if(e&&GX.includes(P7e(e.name))){const t=await e.text();return F6.parse(t)}}const k7e=()=>{const[e,t]=ta(),[n,r]=O.useState(!1);return O.useEffect(()=>{if("windowControlsOverlay"in navigator){const i=()=>{r(!!navigator.windowControlsOverlay.visible)};return navigator.windowControlsOverlay.addEventListener("geometrychange",i),i(),()=>navigator.windowControlsOverlay.removeEventListener("geometrychange",i)}},[r]),C.jsx(gt,{sx:{mt:-.5,minHeight:36,height:n?"env(titlebar-area-height, 50px)":0,width:"env(titlebar-area-width, 100%)",WebkitAppRegion:"drag"},children:C.jsx(gt,{sx:{height:"100%"},children:C.jsxs(Gm,{direction:"row",spacing:1,sx:{height:"100%"},alignItems:"center",children:[C.jsx(gt,{sx:{p:1,pr:0,height:"100%"},children:C.jsx("img",{src:OJ,style:{height:"100%"}})}),C.jsx(Wt,{sx:{fontSize:14,fontWeight:300,pr:1.5},children:CC}),[{key:"workspace",items:[{name:"Load workspace",key:"workspace-load",action:async()=>{const i=await M7e();i&&t(i)}},{name:"Save workspace",key:"workspace-save",action:()=>{O7e(`${R7e()}.workspace`,e)}}]},{key:"help",items:[{name:"Open repository in GitHub",key:"github",action:()=>open(mSe,"_blank")}]}].map(({key:i,items:o})=>C.jsx(tg,{variant:"popover",children:s=>C.jsxs(C.Fragment,{children:[C.jsx(eg,{...Dw(s),children:C.jsx(FA,{dense:!0,sx:{p:0},children:o.map(({name:a,key:u,action:c})=>C.jsx(Pc,{onClick:()=>{c==null||c(),s.close()},children:a},u))})}),C.jsx(id,{...KA(s),sx:{WebkitAppRegion:"no-drag",minWidth:0,p:.5,px:1},children:ie.startCase(i)})]})},i)),C.jsx(gt,{sx:{p:.75,height:"100%"},children:C.jsx(L7e,{})})]})})})};function L7e(){const e=mu();return C.jsxs(Kc,{onClick:()=>e("Commands are not yet implemented."),sx:{WebkitAppRegion:"no-drag",fontSize:14,borderRadius:t=>t.shape.borderRadius,"&:hover":{bgcolor:"background.paper"},height:"100%",m:0,display:"flex",alignItems:"center",px:1,pr:2,gap:t=>t.spacing(1),color:"text.secondary",cursor:"text"},children:[C.jsx(T1e,{fontSize:"small",color:"disabled"})," ",C.jsx(Wt,{sx:{mt:0},children:"Commands"})]})}const D7e=[_7e,E7e,aWe,T7e];function N7e(){const t=Ln().palette.background.default;return b7e(t),C.jsxs(En,{vertical:!0,sx:{bgcolor:t,p:.5,color:"text.primary"},children:[C.jsx(k7e,{}),C.jsx(v7e,{flex:1})]})}function B7e(){const[{theme:e="light",accentColor:t="teal"}]=Zc(),n=O.useMemo(()=>dSe(e,t),[e,t]);return C.jsx(Vue,{theme:n,children:C.jsx(swe,{children:C.jsx(moe,{services:D7e,children:C.jsx(N7e,{})})})})}const[uVe,$7e]=gu({});const F7e=PQ(document.getElementById("root")),z7e=[uSe,bPe,xPe,zEe,$7e,wPe,p$e,zDe,owe,m7e];F7e.render(C.jsx(jme,{children:C.jsx(moe,{slices:z7e,children:C.jsx(B7e,{})})})); diff --git a/index.html b/index.html index 06d7994e..2230ea02 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ - +