f1ow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +210 -0
- package/dist/assets/elbowWorker-CUBh1uET.js +1 -0
- package/dist/assets/exportWorker-hU9uNZXJ.js +8 -0
- package/dist/assets/syncWorker.worker-CnlpNZ3k.js +6 -0
- package/dist/components/Canvas/CanvasElement.d.ts +42 -0
- package/dist/components/Canvas/ConnectionPoints.d.ts +13 -0
- package/dist/components/Canvas/GridLayer.d.ts +13 -0
- package/dist/components/Canvas/LinearElementHandles.d.ts +17 -0
- package/dist/components/Canvas/SelectionBox.d.ts +12 -0
- package/dist/components/Canvas/SelectionTransformer.d.ts +7 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +23 -0
- package/dist/components/StylePanel/StylePanel.d.ts +7 -0
- package/dist/components/Toolbar/Toolbar.d.ts +9 -0
- package/dist/components/shapes/ArrowShape.d.ts +18 -0
- package/dist/components/shapes/DiamondShape.d.ts +24 -0
- package/dist/components/shapes/EllipseShape.d.ts +24 -0
- package/dist/components/shapes/FreeDrawShape.d.ts +24 -0
- package/dist/components/shapes/ImageShape.d.ts +24 -0
- package/dist/components/shapes/LineShape.d.ts +18 -0
- package/dist/components/shapes/RectangleShape.d.ts +24 -0
- package/dist/components/shapes/TextShape.d.ts +23 -0
- package/dist/constants/index.d.ts +44 -0
- package/dist/f1ow-canvas.js +37725 -0
- package/dist/f1ow-canvas.umd.cjs +371 -0
- package/dist/hooks/useEfficientZoom.d.ts +14 -0
- package/dist/hooks/useElbowShapeFingerprint.d.ts +21 -0
- package/dist/hooks/useElbowWorker.d.ts +23 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +7 -0
- package/dist/hooks/useProgressiveRender.d.ts +52 -0
- package/dist/hooks/useSpatialIndex.d.ts +9 -0
- package/dist/hooks/useViewportCulling.d.ts +13 -0
- package/dist/lib/FlowCanvas.d.ts +4 -0
- package/dist/lib/FlowCanvasProps.d.ts +154 -0
- package/dist/lib/index.d.ts +57 -0
- package/dist/store/useCanvasStore.d.ts +127 -0
- package/dist/store/useLinearEditStore.d.ts +25 -0
- package/dist/types/index.d.ts +257 -0
- package/dist/utils/alignment.d.ts +34 -0
- package/dist/utils/arrowheads.d.ts +20 -0
- package/dist/utils/camera.d.ts +63 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clone.d.ts +29 -0
- package/dist/utils/connection.d.ts +122 -0
- package/dist/utils/crdtPrep.d.ts +97 -0
- package/dist/utils/curve.d.ts +51 -0
- package/dist/utils/elbow.d.ts +110 -0
- package/dist/utils/elbowWorkerManager.d.ts +53 -0
- package/dist/utils/export.d.ts +17 -0
- package/dist/utils/exportWorkerManager.d.ts +25 -0
- package/dist/utils/fractionalIndex.d.ts +51 -0
- package/dist/utils/geometry.d.ts +49 -0
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/image.d.ts +52 -0
- package/dist/utils/performance.d.ts +65 -0
- package/dist/utils/roughness.d.ts +104 -0
- package/dist/utils/spatialIndex.d.ts +109 -0
- package/dist/utils/spatialSoA.d.ts +82 -0
- package/dist/workers/elbowWorker.d.ts +18 -0
- package/dist/workers/exportWorker.d.ts +18 -0
- package/package.json +80 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
(function(me,Z){typeof exports=="object"&&typeof module<"u"?Z(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],Z):(me=typeof globalThis<"u"?globalThis:me||self,Z(me.FlowCanvas={},me.jsxRuntime,me.React))})(this,(function(me,Z,te){"use strict";var ZN=Object.defineProperty;var $N=(me,Z,te)=>Z in me?ZN(me,Z,{enumerable:!0,configurable:!0,writable:!0,value:te}):me[Z]=te;var et=(me,Z,te)=>$N(me,typeof Z!="symbol"?Z+"":Z,te);var to=typeof document<"u"?document.currentScript:null;function j6(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const Ii=j6(te);var DS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function im(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Vp={exports:{}},$d={},sm={},am={},AS;function Vt(){return AS||(AS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const e=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}t.glob=typeof DS<"u"?DS:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},t.Konva={_global:t.glob,version:"9.3.22",isBrowser:n(),isUnminified:/param/.test((function(a){}).toString()),dblClickWindow:400,getAngle(a){return t.Konva.angleDeg?a*e:a},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return t.Konva.DD.isDragging},isTransforming(){var a;return(a=t.Konva.Transformer)===null||a===void 0?void 0:a.isTransforming()},isDragReady(){return!!t.Konva.DD.node},releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(a){t.glob.Konva=a}};const s=a=>{t.Konva[a.prototype.getClassName()]=a};t._registerNode=s,t.Konva._injectGlobal(t.Konva)})(am)),am}var om={},RS;function Hn(){return RS||(RS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=Vt();class n{constructor(L=[1,0,0,1,0,0]){this.dirty=!1,this.m=L&&L.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(L){L.m[0]=this.m[0],L.m[1]=this.m[1],L.m[2]=this.m[2],L.m[3]=this.m[3],L.m[4]=this.m[4],L.m[5]=this.m[5]}point(L){const R=this.m;return{x:R[0]*L.x+R[2]*L.y+R[4],y:R[1]*L.x+R[3]*L.y+R[5]}}translate(L,R){return this.m[4]+=this.m[0]*L+this.m[2]*R,this.m[5]+=this.m[1]*L+this.m[3]*R,this}scale(L,R){return this.m[0]*=L,this.m[1]*=L,this.m[2]*=R,this.m[3]*=R,this}rotate(L){const R=Math.cos(L),z=Math.sin(L),ee=this.m[0]*R+this.m[2]*z,O=this.m[1]*R+this.m[3]*z,I=this.m[0]*-z+this.m[2]*R,F=this.m[1]*-z+this.m[3]*R;return this.m[0]=ee,this.m[1]=O,this.m[2]=I,this.m[3]=F,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(L,R){const z=this.m[0]+this.m[2]*R,ee=this.m[1]+this.m[3]*R,O=this.m[2]+this.m[0]*L,I=this.m[3]+this.m[1]*L;return this.m[0]=z,this.m[1]=ee,this.m[2]=O,this.m[3]=I,this}multiply(L){const R=this.m[0]*L.m[0]+this.m[2]*L.m[1],z=this.m[1]*L.m[0]+this.m[3]*L.m[1],ee=this.m[0]*L.m[2]+this.m[2]*L.m[3],O=this.m[1]*L.m[2]+this.m[3]*L.m[3],I=this.m[0]*L.m[4]+this.m[2]*L.m[5]+this.m[4],F=this.m[1]*L.m[4]+this.m[3]*L.m[5]+this.m[5];return this.m[0]=R,this.m[1]=z,this.m[2]=ee,this.m[3]=O,this.m[4]=I,this.m[5]=F,this}invert(){const L=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),R=this.m[3]*L,z=-this.m[1]*L,ee=-this.m[2]*L,O=this.m[0]*L,I=L*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),F=L*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=R,this.m[1]=z,this.m[2]=ee,this.m[3]=O,this.m[4]=I,this.m[5]=F,this}getMatrix(){return this.m}decompose(){const L=this.m[0],R=this.m[1],z=this.m[2],ee=this.m[3],O=this.m[4],I=this.m[5],F=L*ee-R*z,V={x:O,y:I,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(L!=0||R!=0){const W=Math.sqrt(L*L+R*R);V.rotation=R>0?Math.acos(L/W):-Math.acos(L/W),V.scaleX=W,V.scaleY=F/W,V.skewX=(L*z+R*ee)/F,V.skewY=0}else if(z!=0||ee!=0){const W=Math.sqrt(z*z+ee*ee);V.rotation=Math.PI/2-(ee>0?Math.acos(-z/W):-Math.acos(z/W)),V.scaleX=F/W,V.scaleY=W,V.skewX=0,V.skewY=(L*z+R*ee)/F}return V.rotation=t.Util._getRotation(V.rotation),V}}t.Transform=n;const s="[object Array]",a="[object Number]",l="[object String]",u="[object Boolean]",d=Math.PI/180,p=180/Math.PI,h="#",y="",_="0",S="Konva warning: ",x="Konva error: ",w="rgb(",C={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},D=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let U=[];const M=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(E){setTimeout(E,60)};t.Util={_isElement(E){return!!(E&&E.nodeType==1)},_isFunction(E){return!!(E&&E.constructor&&E.call&&E.apply)},_isPlainObject(E){return!!E&&E.constructor===Object},_isArray(E){return Object.prototype.toString.call(E)===s},_isNumber(E){return Object.prototype.toString.call(E)===a&&!isNaN(E)&&isFinite(E)},_isString(E){return Object.prototype.toString.call(E)===l},_isBoolean(E){return Object.prototype.toString.call(E)===u},isObject(E){return E instanceof Object},isValidSelector(E){if(typeof E!="string")return!1;const L=E[0];return L==="#"||L==="."||L===L.toUpperCase()},_sign(E){return E===0||E>0?1:-1},requestAnimFrame(E){U.push(E),U.length===1&&M(function(){const L=U;U=[],L.forEach(function(R){R()})})},createCanvasElement(){const E=document.createElement("canvas");try{E.style=E.style||{}}catch{}return E},createImageElement(){return document.createElement("img")},_isInDocument(E){for(;E=E.parentNode;)if(E==document)return!0;return!1},_urlToImage(E,L){const R=t.Util.createImageElement();R.onload=function(){L(R)},R.src=E},_rgbToHex(E,L,R){return((1<<24)+(E<<16)+(L<<8)+R).toString(16).slice(1)},_hexToRgb(E){E=E.replace(h,y);const L=parseInt(E,16);return{r:L>>16&255,g:L>>8&255,b:L&255}},getRandomColor(){let E=(Math.random()*16777215<<0).toString(16);for(;E.length<6;)E=_+E;return h+E},getRGB(E){let L;return E in C?(L=C[E],{r:L[0],g:L[1],b:L[2]}):E[0]===h?this._hexToRgb(E.substring(1)):E.substr(0,4)===w?(L=D.exec(E.replace(/ /g,"")),{r:parseInt(L[1],10),g:parseInt(L[2],10),b:parseInt(L[3],10)}):{r:0,g:0,b:0}},colorToRGBA(E){return E=E||"black",t.Util._namedColorToRBA(E)||t.Util._hex3ColorToRGBA(E)||t.Util._hex4ColorToRGBA(E)||t.Util._hex6ColorToRGBA(E)||t.Util._hex8ColorToRGBA(E)||t.Util._rgbColorToRGBA(E)||t.Util._rgbaColorToRGBA(E)||t.Util._hslColorToRGBA(E)},_namedColorToRBA(E){const L=C[E.toLowerCase()];return L?{r:L[0],g:L[1],b:L[2],a:1}:null},_rgbColorToRGBA(E){if(E.indexOf("rgb(")===0){E=E.match(/rgb\(([^)]+)\)/)[1];const L=E.split(/ *, */).map(Number);return{r:L[0],g:L[1],b:L[2],a:1}}},_rgbaColorToRGBA(E){if(E.indexOf("rgba(")===0){E=E.match(/rgba\(([^)]+)\)/)[1];const L=E.split(/ *, */).map((R,z)=>R.slice(-1)==="%"?z===3?parseInt(R)/100:parseInt(R)/100*255:Number(R));return{r:L[0],g:L[1],b:L[2],a:L[3]}}},_hex8ColorToRGBA(E){if(E[0]==="#"&&E.length===9)return{r:parseInt(E.slice(1,3),16),g:parseInt(E.slice(3,5),16),b:parseInt(E.slice(5,7),16),a:parseInt(E.slice(7,9),16)/255}},_hex6ColorToRGBA(E){if(E[0]==="#"&&E.length===7)return{r:parseInt(E.slice(1,3),16),g:parseInt(E.slice(3,5),16),b:parseInt(E.slice(5,7),16),a:1}},_hex4ColorToRGBA(E){if(E[0]==="#"&&E.length===5)return{r:parseInt(E[1]+E[1],16),g:parseInt(E[2]+E[2],16),b:parseInt(E[3]+E[3],16),a:parseInt(E[4]+E[4],16)/255}},_hex3ColorToRGBA(E){if(E[0]==="#"&&E.length===4)return{r:parseInt(E[1]+E[1],16),g:parseInt(E[2]+E[2],16),b:parseInt(E[3]+E[3],16),a:1}},_hslColorToRGBA(E){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(E)){const[L,...R]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(E),z=Number(R[0])/360,ee=Number(R[1])/100,O=Number(R[2])/100;let I,F,V;if(ee===0)return V=O*255,{r:Math.round(V),g:Math.round(V),b:Math.round(V),a:1};O<.5?I=O*(1+ee):I=O+ee-O*ee;const W=2*O-I,j=[0,0,0];for(let Y=0;Y<3;Y++)F=z+1/3*-(Y-1),F<0&&F++,F>1&&F--,6*F<1?V=W+(I-W)*6*F:2*F<1?V=I:3*F<2?V=W+(I-W)*(2/3-F)*6:V=W,j[Y]=V*255;return{r:Math.round(j[0]),g:Math.round(j[1]),b:Math.round(j[2]),a:1}}},haveIntersection(E,L){return!(L.x>E.x+E.width||L.x+L.width<E.x||L.y>E.y+E.height||L.y+L.height<E.y)},cloneObject(E){const L={};for(const R in E)this._isPlainObject(E[R])?L[R]=this.cloneObject(E[R]):this._isArray(E[R])?L[R]=this.cloneArray(E[R]):L[R]=E[R];return L},cloneArray(E){return E.slice(0)},degToRad(E){return E*d},radToDeg(E){return E*p},_degToRad(E){return t.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),t.Util.degToRad(E)},_radToDeg(E){return t.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),t.Util.radToDeg(E)},_getRotation(E){return e.Konva.angleDeg?t.Util.radToDeg(E):E},_capitalize(E){return E.charAt(0).toUpperCase()+E.slice(1)},throw(E){throw new Error(x+E)},error(E){console.error(x+E)},warn(E){e.Konva.showWarnings&&console.warn(S+E)},each(E,L){for(const R in E)L(R,E[R])},_inRange(E,L,R){return L<=E&&E<R},_getProjectionToSegment(E,L,R,z,ee,O){let I,F,V;const W=(E-R)*(E-R)+(L-z)*(L-z);if(W==0)I=E,F=L,V=(ee-R)*(ee-R)+(O-z)*(O-z);else{const j=((ee-E)*(R-E)+(O-L)*(z-L))/W;j<0?(I=E,F=L,V=(E-ee)*(E-ee)+(L-O)*(L-O)):j>1?(I=R,F=z,V=(R-ee)*(R-ee)+(z-O)*(z-O)):(I=E+j*(R-E),F=L+j*(z-L),V=(I-ee)*(I-ee)+(F-O)*(F-O))}return[I,F,V]},_getProjectionToLine(E,L,R){const z=t.Util.cloneObject(E);let ee=Number.MAX_VALUE;return L.forEach(function(O,I){if(!R&&I===L.length-1)return;const F=L[(I+1)%L.length],V=t.Util._getProjectionToSegment(O.x,O.y,F.x,F.y,E.x,E.y),W=V[0],j=V[1],Y=V[2];Y<ee&&(z.x=W,z.y=j,ee=Y)}),z},_prepareArrayForTween(E,L,R){const z=[],ee=[];if(E.length>L.length){const I=L;L=E,E=I}for(let I=0;I<E.length;I+=2)z.push({x:E[I],y:E[I+1]});for(let I=0;I<L.length;I+=2)ee.push({x:L[I],y:L[I+1]});const O=[];return ee.forEach(function(I){const F=t.Util._getProjectionToLine(I,z,R);O.push(F.x),O.push(F.y)}),O},_prepareToStringify(E){let L;E.visitedByCircularReferenceRemoval=!0;for(const R in E)if(E.hasOwnProperty(R)&&E[R]&&typeof E[R]=="object"){if(L=Object.getOwnPropertyDescriptor(E,R),E[R].visitedByCircularReferenceRemoval||t.Util._isElement(E[R]))if(L.configurable)delete E[R];else return null;else if(t.Util._prepareToStringify(E[R])===null)if(L.configurable)delete E[R];else return null}return delete E.visitedByCircularReferenceRemoval,E},_assign(E,L){for(const R in L)E[R]=L[R];return E},_getFirstPointerId(E){return E.touches?E.changedTouches[0].identifier:E.pointerId||999},releaseCanvas(...E){e.Konva.releaseCanvasOnDestroy&&E.forEach(L=>{L.width=0,L.height=0})},drawRoundedRectPath(E,L,R,z){let ee=0,O=0,I=0,F=0;typeof z=="number"?ee=O=I=F=Math.min(z,L/2,R/2):(ee=Math.min(z[0]||0,L/2,R/2),O=Math.min(z[1]||0,L/2,R/2),F=Math.min(z[2]||0,L/2,R/2),I=Math.min(z[3]||0,L/2,R/2)),E.moveTo(ee,0),E.lineTo(L-O,0),E.arc(L-O,O,O,Math.PI*3/2,0,!1),E.lineTo(L,R-F),E.arc(L-F,R-F,F,0,Math.PI/2,!1),E.lineTo(I,R),E.arc(I,R-I,I,Math.PI/2,Math.PI,!1),E.lineTo(0,ee),E.arc(ee,ee,ee,Math.PI,Math.PI*3/2,!1)}}})(om)),om}var ef={},no={},ro={},LS;function NS(){if(LS)return ro;LS=1,Object.defineProperty(ro,"__esModule",{value:!0}),ro.HitContext=ro.SceneContext=ro.Context=void 0;const t=Hn(),e=Vt();function n(U){const M=[],E=U.length,L=t.Util;for(let R=0;R<E;R++){let z=U[R];L._isNumber(z)?z=Math.round(z*1e3)/1e3:L._isString(z)||(z=z+""),M.push(z)}return M}const s=",",a="(",l=")",u="([",d="])",p=";",h="()",y="=",_=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],S=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"],x=100;let w=class{constructor(M){this.canvas=M,e.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(M){M.fillEnabled()&&this._fill(M)}_fill(M){}strokeShape(M){M.hasStroke()&&this._stroke(M)}_stroke(M){}fillStrokeShape(M){M.attrs.fillAfterStrokeEnabled?(this.strokeShape(M),this.fillShape(M)):(this.fillShape(M),this.strokeShape(M))}getTrace(M,E){let L=this.traceArr,R=L.length,z="",ee,O,I,F;for(ee=0;ee<R;ee++)O=L[ee],I=O.method,I?(F=O.args,z+=I,M?z+=h:t.Util._isArray(F[0])?z+=u+F.join(s)+d:(E&&(F=F.map(V=>typeof V=="number"?Math.floor(V):V)),z+=a+F.join(s)+l)):(z+=O.property,M||(z+=y+O.val)),z+=p;return z}clearTrace(){this.traceArr=[]}_trace(M){let E=this.traceArr,L;E.push(M),L=E.length,L>=x&&E.shift()}reset(){const M=this.getCanvas().getPixelRatio();this.setTransform(1*M,0,0,1*M,0,0)}getCanvas(){return this.canvas}clear(M){const E=this.getCanvas();M?this.clearRect(M.x||0,M.y||0,M.width||0,M.height||0):this.clearRect(0,0,E.getWidth()/E.pixelRatio,E.getHeight()/E.pixelRatio)}_applyLineCap(M){const E=M.attrs.lineCap;E&&this.setAttr("lineCap",E)}_applyOpacity(M){const E=M.getAbsoluteOpacity();E!==1&&this.setAttr("globalAlpha",E)}_applyLineJoin(M){const E=M.attrs.lineJoin;E&&this.setAttr("lineJoin",E)}setAttr(M,E){this._context[M]=E}arc(M,E,L,R,z,ee){this._context.arc(M,E,L,R,z,ee)}arcTo(M,E,L,R,z){this._context.arcTo(M,E,L,R,z)}beginPath(){this._context.beginPath()}bezierCurveTo(M,E,L,R,z,ee){this._context.bezierCurveTo(M,E,L,R,z,ee)}clearRect(M,E,L,R){this._context.clearRect(M,E,L,R)}clip(...M){this._context.clip.apply(this._context,M)}closePath(){this._context.closePath()}createImageData(M,E){const L=arguments;if(L.length===2)return this._context.createImageData(M,E);if(L.length===1)return this._context.createImageData(M)}createLinearGradient(M,E,L,R){return this._context.createLinearGradient(M,E,L,R)}createPattern(M,E){return this._context.createPattern(M,E)}createRadialGradient(M,E,L,R,z,ee){return this._context.createRadialGradient(M,E,L,R,z,ee)}drawImage(M,E,L,R,z,ee,O,I,F){const V=arguments,W=this._context;V.length===3?W.drawImage(M,E,L):V.length===5?W.drawImage(M,E,L,R,z):V.length===9&&W.drawImage(M,E,L,R,z,ee,O,I,F)}ellipse(M,E,L,R,z,ee,O,I){this._context.ellipse(M,E,L,R,z,ee,O,I)}isPointInPath(M,E,L,R){return L?this._context.isPointInPath(L,M,E,R):this._context.isPointInPath(M,E,R)}fill(...M){this._context.fill.apply(this._context,M)}fillRect(M,E,L,R){this._context.fillRect(M,E,L,R)}strokeRect(M,E,L,R){this._context.strokeRect(M,E,L,R)}fillText(M,E,L,R){R?this._context.fillText(M,E,L,R):this._context.fillText(M,E,L)}measureText(M){return this._context.measureText(M)}getImageData(M,E,L,R){return this._context.getImageData(M,E,L,R)}lineTo(M,E){this._context.lineTo(M,E)}moveTo(M,E){this._context.moveTo(M,E)}rect(M,E,L,R){this._context.rect(M,E,L,R)}roundRect(M,E,L,R,z){this._context.roundRect(M,E,L,R,z)}putImageData(M,E,L){this._context.putImageData(M,E,L)}quadraticCurveTo(M,E,L,R){this._context.quadraticCurveTo(M,E,L,R)}restore(){this._context.restore()}rotate(M){this._context.rotate(M)}save(){this._context.save()}scale(M,E){this._context.scale(M,E)}setLineDash(M){this._context.setLineDash?this._context.setLineDash(M):"mozDash"in this._context?this._context.mozDash=M:"webkitLineDash"in this._context&&(this._context.webkitLineDash=M)}getLineDash(){return this._context.getLineDash()}setTransform(M,E,L,R,z,ee){this._context.setTransform(M,E,L,R,z,ee)}stroke(M){M?this._context.stroke(M):this._context.stroke()}strokeText(M,E,L,R){this._context.strokeText(M,E,L,R)}transform(M,E,L,R,z,ee){this._context.transform(M,E,L,R,z,ee)}translate(M,E){this._context.translate(M,E)}_enableTrace(){let M=this,E=_.length,L=this.setAttr,R,z;const ee=function(O){let I=M[O],F;M[O]=function(){return z=n(Array.prototype.slice.call(arguments,0)),F=I.apply(M,arguments),M._trace({method:O,args:z}),F}};for(R=0;R<E;R++)ee(_[R]);M.setAttr=function(){L.apply(M,arguments);const O=arguments[0];let I=arguments[1];(O==="shadowOffsetX"||O==="shadowOffsetY"||O==="shadowBlur")&&(I=I/this.canvas.getPixelRatio()),M._trace({property:O,val:I})}}_applyGlobalCompositeOperation(M){const E=M.attrs.globalCompositeOperation;!E||E==="source-over"||this.setAttr("globalCompositeOperation",E)}};ro.Context=w,S.forEach(function(U){Object.defineProperty(w.prototype,U,{get(){return this._context[U]},set(M){this._context[U]=M}})});class C extends w{constructor(M,{willReadFrequently:E=!1}={}){super(M),this._context=M._canvas.getContext("2d",{willReadFrequently:E})}_fillColor(M){const E=M.fill();this.setAttr("fillStyle",E),M._fillFunc(this)}_fillPattern(M){this.setAttr("fillStyle",M._getFillPattern()),M._fillFunc(this)}_fillLinearGradient(M){const E=M._getLinearGradient();E&&(this.setAttr("fillStyle",E),M._fillFunc(this))}_fillRadialGradient(M){const E=M._getRadialGradient();E&&(this.setAttr("fillStyle",E),M._fillFunc(this))}_fill(M){const E=M.fill(),L=M.getFillPriority();if(E&&L==="color"){this._fillColor(M);return}const R=M.getFillPatternImage();if(R&&L==="pattern"){this._fillPattern(M);return}const z=M.getFillLinearGradientColorStops();if(z&&L==="linear-gradient"){this._fillLinearGradient(M);return}const ee=M.getFillRadialGradientColorStops();if(ee&&L==="radial-gradient"){this._fillRadialGradient(M);return}E?this._fillColor(M):R?this._fillPattern(M):z?this._fillLinearGradient(M):ee&&this._fillRadialGradient(M)}_strokeLinearGradient(M){const E=M.getStrokeLinearGradientStartPoint(),L=M.getStrokeLinearGradientEndPoint(),R=M.getStrokeLinearGradientColorStops(),z=this.createLinearGradient(E.x,E.y,L.x,L.y);if(R){for(let ee=0;ee<R.length;ee+=2)z.addColorStop(R[ee],R[ee+1]);this.setAttr("strokeStyle",z)}}_stroke(M){const E=M.dash(),L=M.getStrokeScaleEnabled();if(M.hasStroke()){if(!L){this.save();const z=this.getCanvas().getPixelRatio();this.setTransform(z,0,0,z,0,0)}this._applyLineCap(M),E&&M.dashEnabled()&&(this.setLineDash(E),this.setAttr("lineDashOffset",M.dashOffset())),this.setAttr("lineWidth",M.strokeWidth()),M.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),M.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(M):this.setAttr("strokeStyle",M.stroke()),M._strokeFunc(this),L||this.restore()}}_applyShadow(M){var E,L,R;const z=(E=M.getShadowRGBA())!==null&&E!==void 0?E:"black",ee=(L=M.getShadowBlur())!==null&&L!==void 0?L:5,O=(R=M.getShadowOffset())!==null&&R!==void 0?R:{x:0,y:0},I=M.getAbsoluteScale(),F=this.canvas.getPixelRatio(),V=I.x*F,W=I.y*F;this.setAttr("shadowColor",z),this.setAttr("shadowBlur",ee*Math.min(Math.abs(V),Math.abs(W))),this.setAttr("shadowOffsetX",O.x*V),this.setAttr("shadowOffsetY",O.y*W)}}ro.SceneContext=C;class D extends w{constructor(M){super(M),this._context=M._canvas.getContext("2d",{willReadFrequently:!0})}_fill(M){this.save(),this.setAttr("fillStyle",M.colorKey),M._fillFuncHit(this),this.restore()}strokeShape(M){M.hasHitStroke()&&this._stroke(M)}_stroke(M){if(M.hasHitStroke()){const E=M.getStrokeScaleEnabled();if(!E){this.save();const z=this.getCanvas().getPixelRatio();this.setTransform(z,0,0,z,0,0)}this._applyLineCap(M);const L=M.hitStrokeWidth(),R=L==="auto"?M.strokeWidth():L;this.setAttr("lineWidth",R),this.setAttr("strokeStyle",M.colorKey),M._strokeFuncHit(this),E||this.restore()}}}return ro.HitContext=D,ro}var PS;function Yp(){if(PS)return no;PS=1,Object.defineProperty(no,"__esModule",{value:!0}),no.HitCanvas=no.SceneCanvas=no.Canvas=void 0;const t=Hn(),e=NS(),n=Vt();let s;function a(){if(s)return s;const p=t.Util.createCanvasElement(),h=p.getContext("2d");return s=(function(){const y=n.Konva._global.devicePixelRatio||1,_=h.webkitBackingStorePixelRatio||h.mozBackingStorePixelRatio||h.msBackingStorePixelRatio||h.oBackingStorePixelRatio||h.backingStorePixelRatio||1;return y/_})(),t.Util.releaseCanvas(p),s}let l=class{constructor(h){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const _=(h||{}).pixelRatio||n.Konva.pixelRatio||a();this.pixelRatio=_,this._canvas=t.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(h){const y=this.pixelRatio;this.pixelRatio=h,this.setSize(this.getWidth()/y,this.getHeight()/y)}setWidth(h){this.width=this._canvas.width=h*this.pixelRatio,this._canvas.style.width=h+"px";const y=this.pixelRatio;this.getContext()._context.scale(y,y)}setHeight(h){this.height=this._canvas.height=h*this.pixelRatio,this._canvas.style.height=h+"px";const y=this.pixelRatio;this.getContext()._context.scale(y,y)}getWidth(){return this.width}getHeight(){return this.height}setSize(h,y){this.setWidth(h||0),this.setHeight(y||0)}toDataURL(h,y){try{return this._canvas.toDataURL(h,y)}catch{try{return this._canvas.toDataURL()}catch(S){return t.Util.error("Unable to get data URL. "+S.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}};no.Canvas=l;class u extends l{constructor(h={width:0,height:0,willReadFrequently:!1}){super(h),this.context=new e.SceneContext(this,{willReadFrequently:h.willReadFrequently}),this.setSize(h.width,h.height)}}no.SceneCanvas=u;class d extends l{constructor(h={width:0,height:0}){super(h),this.hitCanvas=!0,this.context=new e.HitContext(this),this.setSize(h.width,h.height)}}return no.HitCanvas=d,no}var lm={},OS;function cm(){return OS||(OS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DD=void 0;const e=Vt(),n=Hn();t.DD={get isDragging(){let s=!1;return t.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(s=!0)}),s},justDragged:!1,get node(){let s;return t.DD._dragElements.forEach(a=>{s=a.node}),s},_dragElements:new Map,_drag(s){const a=[];t.DD._dragElements.forEach((l,u)=>{const{node:d}=l,p=d.getStage();p.setPointersPositions(s),l.pointerId===void 0&&(l.pointerId=n.Util._getFirstPointerId(s));const h=p._changedPointerPositions.find(y=>y.id===l.pointerId);if(h){if(l.dragStatus!=="dragging"){const y=d.dragDistance();if(Math.max(Math.abs(h.x-l.startPointerPos.x),Math.abs(h.y-l.startPointerPos.y))<y||(d.startDrag({evt:s}),!d.isDragging()))return}d._setDragPosition(s,l),a.push(d)}}),a.forEach(l=>{l.fire("dragmove",{type:"dragmove",target:l,evt:s},!0)})},_endDragBefore(s){const a=[];t.DD._dragElements.forEach(l=>{const{node:u}=l,d=u.getStage();if(s&&d.setPointersPositions(s),!d._changedPointerPositions.find(y=>y.id===l.pointerId))return;(l.dragStatus==="dragging"||l.dragStatus==="stopped")&&(t.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,l.dragStatus="stopped");const h=l.node.getLayer()||l.node instanceof e.Konva.Stage&&l.node;h&&a.indexOf(h)===-1&&a.push(h)}),a.forEach(l=>{l.draw()})},_endDragAfter(s){t.DD._dragElements.forEach((a,l)=>{a.dragStatus==="stopped"&&a.node.fire("dragend",{type:"dragend",target:a.node,evt:s},!0),a.dragStatus!=="dragging"&&t.DD._dragElements.delete(l)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",t.DD._endDragBefore,!0),window.addEventListener("mousemove",t.DD._drag),window.addEventListener("touchmove",t.DD._drag),window.addEventListener("mouseup",t.DD._endDragAfter,!1),window.addEventListener("touchend",t.DD._endDragAfter,!1),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))})(lm)),lm}var um={},Fi={},IS;function Zt(){if(IS)return Fi;IS=1,Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.RGBComponent=s,Fi.alphaComponent=a,Fi.getNumberValidator=l,Fi.getNumberOrArrayOfNumbersValidator=u,Fi.getNumberOrAutoValidator=d,Fi.getStringValidator=p,Fi.getStringOrGradientValidator=h,Fi.getFunctionValidator=y,Fi.getNumberArrayValidator=_,Fi.getBooleanValidator=S,Fi.getComponentValidator=x;const t=Vt(),e=Hn();function n(w){return e.Util._isString(w)?'"'+w+'"':Object.prototype.toString.call(w)==="[object Number]"||e.Util._isBoolean(w)?w:Object.prototype.toString.call(w)}function s(w){return w>255?255:w<0?0:Math.round(w)}function a(w){return w>1?1:w<1e-4?1e-4:w}function l(){if(t.Konva.isUnminified)return function(w,C){return e.Util._isNumber(w)||e.Util.warn(n(w)+' is a not valid value for "'+C+'" attribute. The value should be a number.'),w}}function u(w){if(t.Konva.isUnminified)return function(C,D){let U=e.Util._isNumber(C),M=e.Util._isArray(C)&&C.length==w;return!U&&!M&&e.Util.warn(n(C)+' is a not valid value for "'+D+'" attribute. The value should be a number or Array<number>('+w+")"),C}}function d(){if(t.Konva.isUnminified)return function(w,C){return e.Util._isNumber(w)||w==="auto"||e.Util.warn(n(w)+' is a not valid value for "'+C+'" attribute. The value should be a number or "auto".'),w}}function p(){if(t.Konva.isUnminified)return function(w,C){return e.Util._isString(w)||e.Util.warn(n(w)+' is a not valid value for "'+C+'" attribute. The value should be a string.'),w}}function h(){if(t.Konva.isUnminified)return function(w,C){const D=e.Util._isString(w),U=Object.prototype.toString.call(w)==="[object CanvasGradient]"||w&&w.addColorStop;return D||U||e.Util.warn(n(w)+' is a not valid value for "'+C+'" attribute. The value should be a string or a native gradient.'),w}}function y(){if(t.Konva.isUnminified)return function(w,C){return e.Util._isFunction(w)||e.Util.warn(n(w)+' is a not valid value for "'+C+'" attribute. The value should be a function.'),w}}function _(){if(t.Konva.isUnminified)return function(w,C){const D=Int8Array?Object.getPrototypeOf(Int8Array):null;return D&&w instanceof D||(e.Util._isArray(w)?w.forEach(function(U){e.Util._isNumber(U)||e.Util.warn('"'+C+'" attribute has non numeric element '+U+". Make sure that all elements are numbers.")}):e.Util.warn(n(w)+' is a not valid value for "'+C+'" attribute. The value should be a array of numbers.')),w}}function S(){if(t.Konva.isUnminified)return function(w,C){return w===!0||w===!1||e.Util.warn(n(w)+' is a not valid value for "'+C+'" attribute. The value should be a boolean.'),w}}function x(w){if(t.Konva.isUnminified)return function(C,D){return C==null||e.Util.isObject(C)||e.Util.warn(n(C)+' is a not valid value for "'+D+'" attribute. The value should be an object with properties '+w),C}}return Fi}var FS;function Qt(){return FS||(FS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const e=Hn(),n=Zt(),s="get",a="set";t.Factory={addGetterSetter(l,u,d,p,h){t.Factory.addGetter(l,u,d),t.Factory.addSetter(l,u,p,h),t.Factory.addOverloadedGetterSetter(l,u)},addGetter(l,u,d){const p=s+e.Util._capitalize(u);l.prototype[p]=l.prototype[p]||function(){const h=this.attrs[u];return h===void 0?d:h}},addSetter(l,u,d,p){const h=a+e.Util._capitalize(u);l.prototype[h]||t.Factory.overWriteSetter(l,u,d,p)},overWriteSetter(l,u,d,p){const h=a+e.Util._capitalize(u);l.prototype[h]=function(y){return d&&y!==void 0&&y!==null&&(y=d.call(this,y,u)),this._setAttr(u,y),p&&p.call(this),this}},addComponentsGetterSetter(l,u,d,p,h){const y=d.length,_=e.Util._capitalize,S=s+_(u),x=a+_(u);l.prototype[S]=function(){const C={};for(let D=0;D<y;D++){const U=d[D];C[U]=this.getAttr(u+_(U))}return C};const w=(0,n.getComponentValidator)(d);l.prototype[x]=function(C){const D=this.attrs[u];p&&(C=p.call(this,C,u)),w&&w.call(this,C,u);for(const U in C)C.hasOwnProperty(U)&&this._setAttr(u+_(U),C[U]);return C||d.forEach(U=>{this._setAttr(u+_(U),void 0)}),this._fireChangeEvent(u,D,C),h&&h.call(this),this},t.Factory.addOverloadedGetterSetter(l,u)},addOverloadedGetterSetter(l,u){const d=e.Util._capitalize(u),p=a+d,h=s+d;l.prototype[u]=function(){return arguments.length?(this[p](arguments[0]),this):this[h]()}},addDeprecatedGetterSetter(l,u,d,p){e.Util.error("Adding deprecated "+u);const h=s+e.Util._capitalize(u),y=u+" property is deprecated and will be removed soon. Look at Konva change log for more information.";l.prototype[h]=function(){e.Util.error(y);const _=this.attrs[u];return _===void 0?d:_},t.Factory.addSetter(l,u,p,function(){e.Util.error(y)}),t.Factory.addOverloadedGetterSetter(l,u)},backCompat(l,u){e.Util.each(u,function(d,p){const h=l.prototype[p],y=s+e.Util._capitalize(d),_=a+e.Util._capitalize(d);function S(){h.apply(this,arguments),e.Util.error('"'+d+'" method is deprecated and will be removed soon. Use ""'+p+'" instead.')}l.prototype[d]=S,l.prototype[y]=S,l.prototype[_]=S})},afterSetFilter(){this._filterUpToDate=!1}}})(um)),um}var US;function Qn(){if(US)return ef;US=1,Object.defineProperty(ef,"__esModule",{value:!0}),ef.Node=void 0;const t=Yp(),e=cm(),n=Qt(),s=Vt(),a=Hn(),l=Zt(),u="absoluteOpacity",d="allEventListeners",p="absoluteTransform",h="absoluteScale",y="canvas",_="Change",S="children",x="konva",w="listening",C="mouseenter",D="mouseleave",U="pointerenter",M="pointerleave",E="touchenter",L="touchleave",R="set",z="Shape",ee=" ",O="stage",I="transform",F="Stage",V="visible",W=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(ee);let j=1,Y=class MS{constructor(A){this._id=j++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(A),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(A){(A===I||A===p)&&this._cache.get(A)?this._cache.get(A).dirty=!0:A?this._cache.delete(A):this._cache.clear()}_getCache(A,B){let Q=this._cache.get(A);return(Q===void 0||(A===I||A===p)&&Q.dirty===!0)&&(Q=B.call(this),this._cache.set(A,Q)),Q}_calculate(A,B,Q){if(!this._attachedDepsListeners.get(A)){const H=B.map(K=>K+"Change.konva").join(ee);this.on(H,()=>{this._clearCache(A)}),this._attachedDepsListeners.set(A,!0)}return this._getCache(A,Q)}_getCanvasCache(){return this._cache.get(y)}_clearSelfAndDescendantCache(A){this._clearCache(A),A===p&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(y)){const{scene:A,filter:B,hit:Q,buffer:H}=this._cache.get(y);a.Util.releaseCanvas(A,B,Q,H),this._cache.delete(y)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(A){const B=A||{};let Q={};(B.x===void 0||B.y===void 0||B.width===void 0||B.height===void 0)&&(Q=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let H=Math.ceil(B.width||Q.width),K=Math.ceil(B.height||Q.height),ae=B.pixelRatio,ie=B.x===void 0?Math.floor(Q.x):B.x,de=B.y===void 0?Math.floor(Q.y):B.y,fe=B.offset||0,se=B.drawBorder||!1,q=B.hitCanvasPixelRatio||1;if(!H||!K){a.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const oe=Math.abs(Math.round(Q.x)-ie)>.5?1:0,ye=Math.abs(Math.round(Q.y)-de)>.5?1:0;H+=fe*2+oe,K+=fe*2+ye,ie-=fe,de-=fe;const ke=new t.SceneCanvas({pixelRatio:ae,width:H,height:K}),Ae=new t.SceneCanvas({pixelRatio:ae,width:0,height:0,willReadFrequently:!0}),Me=new t.HitCanvas({pixelRatio:q,width:H,height:K}),be=ke.getContext(),He=Me.getContext(),$e=new t.SceneCanvas({width:ke.width/ke.pixelRatio+Math.abs(ie),height:ke.height/ke.pixelRatio+Math.abs(de),pixelRatio:ke.pixelRatio}),Ct=$e.getContext();return Me.isCache=!0,ke.isCache=!0,this._cache.delete(y),this._filterUpToDate=!1,B.imageSmoothingEnabled===!1&&(ke.getContext()._context.imageSmoothingEnabled=!1,Ae.getContext()._context.imageSmoothingEnabled=!1),be.save(),He.save(),Ct.save(),be.translate(-ie,-de),He.translate(-ie,-de),Ct.translate(-ie,-de),$e.x=ie,$e.y=de,this._isUnderCache=!0,this._clearSelfAndDescendantCache(u),this._clearSelfAndDescendantCache(h),this.drawScene(ke,this,$e),this.drawHit(Me,this),this._isUnderCache=!1,be.restore(),He.restore(),se&&(be.save(),be.beginPath(),be.rect(0,0,H,K),be.closePath(),be.setAttr("strokeStyle","red"),be.setAttr("lineWidth",5),be.stroke(),be.restore()),this._cache.set(y,{scene:ke,filter:Ae,hit:Me,buffer:$e,x:ie,y:de}),this._requestDraw(),this}isCached(){return this._cache.has(y)}getClientRect(A){throw new Error('abstract "getClientRect" method call')}_transformedRect(A,B){const Q=[{x:A.x,y:A.y},{x:A.x+A.width,y:A.y},{x:A.x+A.width,y:A.y+A.height},{x:A.x,y:A.y+A.height}];let H=1/0,K=1/0,ae=-1/0,ie=-1/0;const de=this.getAbsoluteTransform(B);return Q.forEach(function(fe){const se=de.point(fe);H===void 0&&(H=ae=se.x,K=ie=se.y),H=Math.min(H,se.x),K=Math.min(K,se.y),ae=Math.max(ae,se.x),ie=Math.max(ie,se.y)}),{x:H,y:K,width:ae-H,height:ie-K}}_drawCachedSceneCanvas(A){A.save(),A._applyOpacity(this),A._applyGlobalCompositeOperation(this);const B=this._getCanvasCache();A.translate(B.x,B.y);const Q=this._getCachedSceneCanvas(),H=Q.pixelRatio;A.drawImage(Q._canvas,0,0,Q.width/H,Q.height/H),A.restore()}_drawCachedHitCanvas(A){const B=this._getCanvasCache(),Q=B.hit;A.save(),A.translate(B.x,B.y),A.drawImage(Q._canvas,0,0,Q.width/Q.pixelRatio,Q.height/Q.pixelRatio),A.restore()}_getCachedSceneCanvas(){let A=this.filters(),B=this._getCanvasCache(),Q=B.scene,H=B.filter,K=H.getContext(),ae,ie,de,fe;if(A){if(!this._filterUpToDate){const se=Q.pixelRatio;H.setSize(Q.width/Q.pixelRatio,Q.height/Q.pixelRatio);try{for(ae=A.length,K.clear(),K.drawImage(Q._canvas,0,0,Q.getWidth()/se,Q.getHeight()/se),ie=K.getImageData(0,0,H.getWidth(),H.getHeight()),de=0;de<ae;de++){if(fe=A[de],typeof fe!="function"){a.Util.error("Filter should be type of function, but got "+typeof fe+" instead. Please check correct filters");continue}fe.call(this,ie),K.putImageData(ie,0,0)}}catch(q){a.Util.error("Unable to apply filter. "+q.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return H}return Q}on(A,B){if(this._cache&&this._cache.delete(d),arguments.length===3)return this._delegate.apply(this,arguments);const Q=A.split(ee);for(let H=0;H<Q.length;H++){const ae=Q[H].split("."),ie=ae[0],de=ae[1]||"";this.eventListeners[ie]||(this.eventListeners[ie]=[]),this.eventListeners[ie].push({name:de,handler:B})}return this}off(A,B){let Q=(A||"").split(ee),H=Q.length,K,ae,ie,de,fe,se;if(this._cache&&this._cache.delete(d),!A)for(ae in this.eventListeners)this._off(ae);for(K=0;K<H;K++)if(ie=Q[K],de=ie.split("."),fe=de[0],se=de[1],fe)this.eventListeners[fe]&&this._off(fe,se,B);else for(ae in this.eventListeners)this._off(ae,se,B);return this}dispatchEvent(A){const B={target:this,type:A.type,evt:A};return this.fire(A.type,B),this}addEventListener(A,B){return this.on(A,function(Q){B.call(this,Q.evt)}),this}removeEventListener(A){return this.off(A),this}_delegate(A,B,Q){const H=this;this.on(A,function(K){const ae=K.target.findAncestors(B,!0,H);for(let ie=0;ie<ae.length;ie++)K=a.Util.cloneObject(K),K.currentTarget=ae[ie],Q.call(ae[ie],K)})}remove(){return this.isDragging()&&this.stopDrag(),e.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(p),this._clearSelfAndDescendantCache(u),this._clearSelfAndDescendantCache(h),this._clearSelfAndDescendantCache(O),this._clearSelfAndDescendantCache(V),this._clearSelfAndDescendantCache(w)}_remove(){this._clearCaches();const A=this.getParent();A&&A.children&&(A.children.splice(this.index,1),A._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(A){const B="get"+a.Util._capitalize(A);return a.Util._isFunction(this[B])?this[B]():this.attrs[A]}getAncestors(){let A=this.getParent(),B=[];for(;A;)B.push(A),A=A.getParent();return B}getAttrs(){return this.attrs||{}}setAttrs(A){return this._batchTransformChanges(()=>{let B,Q;if(!A)return this;for(B in A)B!==S&&(Q=R+a.Util._capitalize(B),a.Util._isFunction(this[Q])?this[Q](A[B]):this._setAttr(B,A[B]))}),this}isListening(){return this._getCache(w,this._isListening)}_isListening(A){if(!this.listening())return!1;const Q=this.getParent();return Q&&Q!==A&&this!==A?Q._isListening(A):!0}isVisible(){return this._getCache(V,this._isVisible)}_isVisible(A){if(!this.visible())return!1;const Q=this.getParent();return Q&&Q!==A&&this!==A?Q._isVisible(A):!0}shouldDrawHit(A,B=!1){if(A)return this._isVisible(A)&&this._isListening(A);const Q=this.getLayer();let H=!1;e.DD._dragElements.forEach(ae=>{ae.dragStatus==="dragging"&&(ae.node.nodeType==="Stage"||ae.node.getLayer()===Q)&&(H=!0)});const K=!B&&!s.Konva.hitOnDragEnabled&&(H||s.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!K}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let A=this.getDepth(),B=this,Q=0,H,K,ae,ie;function de(se){for(H=[],K=se.length,ae=0;ae<K;ae++)ie=se[ae],Q++,ie.nodeType!==z&&(H=H.concat(ie.getChildren().slice())),ie._id===B._id&&(ae=K);H.length>0&&H[0].getDepth()<=A&&de(H)}const fe=this.getStage();return B.nodeType!==F&&fe&&de(fe.getChildren()),Q}getDepth(){let A=0,B=this.parent;for(;B;)A++,B=B.parent;return A}_batchTransformChanges(A){this._batchingTransformChange=!0,A(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(I),this._clearSelfAndDescendantCache(p)),this._needClearTransformCache=!1}setPosition(A){return this._batchTransformChanges(()=>{this.x(A.x),this.y(A.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const A=this.getStage();if(!A)return null;const B=A.getPointerPosition();if(!B)return null;const Q=this.getAbsoluteTransform().copy();return Q.invert(),Q.point(B)}getAbsolutePosition(A){let B=!1,Q=this.parent;for(;Q;){if(Q.isCached()){B=!0;break}Q=Q.parent}B&&!A&&(A=!0);const H=this.getAbsoluteTransform(A).getMatrix(),K=new a.Transform,ae=this.offset();return K.m=H.slice(),K.translate(ae.x,ae.y),K.getTranslation()}setAbsolutePosition(A){const{x:B,y:Q,...H}=this._clearTransform();this.attrs.x=B,this.attrs.y=Q,this._clearCache(I);const K=this._getAbsoluteTransform().copy();return K.invert(),K.translate(A.x,A.y),A={x:this.attrs.x+K.getTranslation().x,y:this.attrs.y+K.getTranslation().y},this._setTransform(H),this.setPosition({x:A.x,y:A.y}),this._clearCache(I),this._clearSelfAndDescendantCache(p),this}_setTransform(A){let B;for(B in A)this.attrs[B]=A[B]}_clearTransform(){const A={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,A}move(A){let B=A.x,Q=A.y,H=this.x(),K=this.y();return B!==void 0&&(H+=B),Q!==void 0&&(K+=Q),this.setPosition({x:H,y:K}),this}_eachAncestorReverse(A,B){let Q=[],H=this.getParent(),K,ae;if(!(B&&B._id===this._id)){for(Q.unshift(this);H&&(!B||H._id!==B._id);)Q.unshift(H),H=H.parent;for(K=Q.length,ae=0;ae<K;ae++)A(Q[ae])}}rotate(A){return this.rotation(this.rotation()+A),this}moveToTop(){if(!this.parent)return a.Util.warn("Node has no parent. moveToTop function is ignored."),!1;const A=this.index,B=this.parent.getChildren().length;return A<B-1?(this.parent.children.splice(A,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return a.Util.warn("Node has no parent. moveUp function is ignored."),!1;const A=this.index,B=this.parent.getChildren().length;return A<B-1?(this.parent.children.splice(A,1),this.parent.children.splice(A+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return a.Util.warn("Node has no parent. moveDown function is ignored."),!1;const A=this.index;return A>0?(this.parent.children.splice(A,1),this.parent.children.splice(A-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return a.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const A=this.index;return A>0?(this.parent.children.splice(A,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(A){if(!this.parent)return a.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(A<0||A>=this.parent.children.length)&&a.Util.warn("Unexpected value "+A+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const B=this.index;return this.parent.children.splice(B,1),this.parent.children.splice(A,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(u,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let A=this.opacity();const B=this.getParent();return B&&!B._isUnderCache&&(A*=B.getAbsoluteOpacity()),A}moveTo(A){return this.getParent()!==A&&(this._remove(),A.add(this)),this}toObject(){let A=this.getAttrs(),B,Q,H,K,ae;const ie={attrs:{},className:this.getClassName()};for(B in A)Q=A[B],ae=a.Util.isObject(Q)&&!a.Util._isPlainObject(Q)&&!a.Util._isArray(Q),!ae&&(H=typeof this[B]=="function"&&this[B],delete A[B],K=H?H.call(this):null,A[B]=Q,K!==Q&&(ie.attrs[B]=Q));return a.Util._prepareToStringify(ie)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(A,B,Q){const H=[];B&&this._isMatch(A)&&H.push(this);let K=this.parent;for(;K;){if(K===Q)return H;K._isMatch(A)&&H.push(K),K=K.parent}return H}isAncestorOf(A){return!1}findAncestor(A,B,Q){return this.findAncestors(A,B,Q)[0]}_isMatch(A){if(!A)return!1;if(typeof A=="function")return A(this);let B=A.replace(/ /g,"").split(","),Q=B.length,H,K;for(H=0;H<Q;H++)if(K=B[H],a.Util.isValidSelector(K)||(a.Util.warn('Selector "'+K+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),a.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),a.Util.warn("Konva is awesome, right?")),K.charAt(0)==="#"){if(this.id()===K.slice(1))return!0}else if(K.charAt(0)==="."){if(this.hasName(K.slice(1)))return!0}else if(this.className===K||this.nodeType===K)return!0;return!1}getLayer(){const A=this.getParent();return A?A.getLayer():null}getStage(){return this._getCache(O,this._getStage)}_getStage(){const A=this.getParent();return A?A.getStage():null}fire(A,B={},Q){return B.target=B.target||this,Q?this._fireAndBubble(A,B):this._fire(A,B),this}getAbsoluteTransform(A){return A?this._getAbsoluteTransform(A):this._getCache(p,this._getAbsoluteTransform)}_getAbsoluteTransform(A){let B;if(A)return B=new a.Transform,this._eachAncestorReverse(function(Q){const H=Q.transformsEnabled();H==="all"?B.multiply(Q.getTransform()):H==="position"&&B.translate(Q.x()-Q.offsetX(),Q.y()-Q.offsetY())},A),B;{B=this._cache.get(p)||new a.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(B):B.reset();const Q=this.transformsEnabled();if(Q==="all")B.multiply(this.getTransform());else if(Q==="position"){const H=this.attrs.x||0,K=this.attrs.y||0,ae=this.attrs.offsetX||0,ie=this.attrs.offsetY||0;B.translate(H-ae,K-ie)}return B.dirty=!1,B}}getAbsoluteScale(A){let B=this;for(;B;)B._isUnderCache&&(A=B),B=B.getParent();const H=this.getAbsoluteTransform(A).decompose();return{x:H.scaleX,y:H.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(I,this._getTransform)}_getTransform(){var A,B;const Q=this._cache.get(I)||new a.Transform;Q.reset();const H=this.x(),K=this.y(),ae=s.Konva.getAngle(this.rotation()),ie=(A=this.attrs.scaleX)!==null&&A!==void 0?A:1,de=(B=this.attrs.scaleY)!==null&&B!==void 0?B:1,fe=this.attrs.skewX||0,se=this.attrs.skewY||0,q=this.attrs.offsetX||0,oe=this.attrs.offsetY||0;return(H!==0||K!==0)&&Q.translate(H,K),ae!==0&&Q.rotate(ae),(fe!==0||se!==0)&&Q.skew(fe,se),(ie!==1||de!==1)&&Q.scale(ie,de),(q!==0||oe!==0)&&Q.translate(-1*q,-1*oe),Q.dirty=!1,Q}clone(A){let B=a.Util.cloneObject(this.attrs),Q,H,K,ae,ie;for(Q in A)B[Q]=A[Q];const de=new this.constructor(B);for(Q in this.eventListeners)for(H=this.eventListeners[Q],K=H.length,ae=0;ae<K;ae++)ie=H[ae],ie.name.indexOf(x)<0&&(de.eventListeners[Q]||(de.eventListeners[Q]=[]),de.eventListeners[Q].push(ie));return de}_toKonvaCanvas(A){A=A||{};const B=this.getClientRect(),Q=this.getStage(),H=A.x!==void 0?A.x:Math.floor(B.x),K=A.y!==void 0?A.y:Math.floor(B.y),ae=A.pixelRatio||1,ie=new t.SceneCanvas({width:A.width||Math.ceil(B.width)||(Q?Q.width():0),height:A.height||Math.ceil(B.height)||(Q?Q.height():0),pixelRatio:ae}),de=ie.getContext(),fe=new t.SceneCanvas({width:ie.width/ie.pixelRatio+Math.abs(H),height:ie.height/ie.pixelRatio+Math.abs(K),pixelRatio:ie.pixelRatio});return A.imageSmoothingEnabled===!1&&(de._context.imageSmoothingEnabled=!1),de.save(),(H||K)&&de.translate(-1*H,-1*K),this.drawScene(ie,void 0,fe),de.restore(),ie}toCanvas(A){return this._toKonvaCanvas(A)._canvas}toDataURL(A){A=A||{};const B=A.mimeType||null,Q=A.quality||null,H=this._toKonvaCanvas(A).toDataURL(B,Q);return A.callback&&A.callback(H),H}toImage(A){return new Promise((B,Q)=>{try{const H=A==null?void 0:A.callback;H&&delete A.callback,a.Util._urlToImage(this.toDataURL(A),function(K){B(K),H==null||H(K)})}catch(H){Q(H)}})}toBlob(A){return new Promise((B,Q)=>{try{const H=A==null?void 0:A.callback;H&&delete A.callback,this.toCanvas(A).toBlob(K=>{B(K),H==null||H(K)},A==null?void 0:A.mimeType,A==null?void 0:A.quality)}catch(H){Q(H)}})}setSize(A){return this.width(A.width),this.height(A.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():s.Konva.dragDistance}_off(A,B,Q){let H=this.eventListeners[A],K,ae,ie;for(K=0;K<H.length;K++)if(ae=H[K].name,ie=H[K].handler,(ae!=="konva"||B==="konva")&&(!B||ae===B)&&(!Q||Q===ie)){if(H.splice(K,1),H.length===0){delete this.eventListeners[A];break}K--}}_fireChangeEvent(A,B,Q){this._fire(A+_,{oldVal:B,newVal:Q})}addName(A){if(!this.hasName(A)){const B=this.name(),Q=B?B+" "+A:A;this.name(Q)}return this}hasName(A){if(!A)return!1;const B=this.name();return B?(B||"").split(/\s/g).indexOf(A)!==-1:!1}removeName(A){const B=(this.name()||"").split(/\s/g),Q=B.indexOf(A);return Q!==-1&&(B.splice(Q,1),this.name(B.join(" "))),this}setAttr(A,B){const Q=this[R+a.Util._capitalize(A)];return a.Util._isFunction(Q)?Q.call(this,B):this._setAttr(A,B),this}_requestDraw(){if(s.Konva.autoDrawEnabled){const A=this.getLayer()||this.getStage();A==null||A.batchDraw()}}_setAttr(A,B){const Q=this.attrs[A];Q===B&&!a.Util.isObject(B)||(B==null?delete this.attrs[A]:this.attrs[A]=B,this._shouldFireChangeEvents&&this._fireChangeEvent(A,Q,B),this._requestDraw())}_setComponentAttr(A,B,Q){let H;Q!==void 0&&(H=this.attrs[A],H||(this.attrs[A]=this.getAttr(A)),this.attrs[A][B]=Q,this._fireChangeEvent(A,H,Q))}_fireAndBubble(A,B,Q){B&&this.nodeType===z&&(B.target=this);const H=[C,D,U,M,E,L];if(!(H.indexOf(A)!==-1&&(Q&&(this===Q||this.isAncestorOf&&this.isAncestorOf(Q))||this.nodeType==="Stage"&&!Q))){this._fire(A,B);const ae=H.indexOf(A)!==-1&&Q&&Q.isAncestorOf&&Q.isAncestorOf(this)&&!Q.isAncestorOf(this.parent);(B&&!B.cancelBubble||!B)&&this.parent&&this.parent.isListening()&&!ae&&(Q&&Q.parent?this._fireAndBubble.call(this.parent,A,B,Q):this._fireAndBubble.call(this.parent,A,B))}}_getProtoListeners(A){var B,Q,H;const K=(B=this._cache.get(d))!==null&&B!==void 0?B:{};let ae=K==null?void 0:K[A];if(ae===void 0){ae=[];let ie=Object.getPrototypeOf(this);for(;ie;){const de=(H=(Q=ie.eventListeners)===null||Q===void 0?void 0:Q[A])!==null&&H!==void 0?H:[];ae.push(...de),ie=Object.getPrototypeOf(ie)}K[A]=ae,this._cache.set(d,K)}return ae}_fire(A,B){B=B||{},B.currentTarget=this,B.type=A;const Q=this._getProtoListeners(A);if(Q)for(let K=0;K<Q.length;K++)Q[K].handler.call(this,B);const H=this.eventListeners[A];if(H)for(let K=0;K<H.length;K++)H[K].handler.call(this,B)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(A){const B=A?A.pointerId:void 0,Q=this.getStage(),H=this.getAbsolutePosition();if(!Q)return;const K=Q._getPointerById(B)||Q._changedPointerPositions[0]||H;e.DD._dragElements.set(this._id,{node:this,startPointerPos:K,offset:{x:K.x-H.x,y:K.y-H.y},dragStatus:"ready",pointerId:B})}startDrag(A,B=!0){e.DD._dragElements.has(this._id)||this._createDragElement(A);const Q=e.DD._dragElements.get(this._id);Q.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:A&&A.evt},B)}_setDragPosition(A,B){const Q=this.getStage()._getPointerById(B.pointerId);if(!Q)return;let H={x:Q.x-B.offset.x,y:Q.y-B.offset.y};const K=this.dragBoundFunc();if(K!==void 0){const ae=K.call(this,H,A);ae?H=ae:a.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==H.x||this._lastPos.y!==H.y)&&(this.setAbsolutePosition(H),this._requestDraw()),this._lastPos=H}stopDrag(A){const B=e.DD._dragElements.get(this._id);B&&(B.dragStatus="stopped"),e.DD._endDragBefore(A),e.DD._endDragAfter(A)}setDraggable(A){this._setAttr("draggable",A),this._dragChange()}isDragging(){const A=e.DD._dragElements.get(this._id);return A?A.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(A){if(!(!(A.evt.button!==void 0)||s.Konva.dragButtons.indexOf(A.evt.button)>=0)||this.isDragging())return;let H=!1;e.DD._dragElements.forEach(K=>{this.isAncestorOf(K.node)&&(H=!0)}),H||this._createDragElement(A)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const B=e.DD._dragElements.get(this._id),Q=B&&B.dragStatus==="dragging",H=B&&B.dragStatus==="ready";Q?this.stopDrag():H&&e.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(A={x:0,y:0}){const B=this.getStage();if(!B)return!1;const Q={x:-A.x,y:-A.y,width:B.width()+2*A.x,height:B.height()+2*A.y};return a.Util.haveIntersection(Q,this.getClientRect())}static create(A,B){return a.Util._isString(A)&&(A=JSON.parse(A)),this._createNode(A,B)}static _createNode(A,B){let Q=MS.prototype.getClassName.call(A),H=A.children,K,ae,ie;B&&(A.attrs.container=B),s.Konva[Q]||(a.Util.warn('Can not find a node with class name "'+Q+'". Fallback to "Shape".'),Q="Shape");const de=s.Konva[Q];if(K=new de(A.attrs),H)for(ae=H.length,ie=0;ie<ae;ie++)K.add(MS._createNode(H[ie]));return K}};ef.Node=Y,Y.prototype.nodeType="Node",Y.prototype._attrsAffectingSize=[],Y.prototype.eventListeners={},Y.prototype.on.call(Y.prototype,W,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(I),this._clearSelfAndDescendantCache(p)}),Y.prototype.on.call(Y.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(V)}),Y.prototype.on.call(Y.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(w)}),Y.prototype.on.call(Y.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(u)});const X=n.Factory.addGetterSetter;return X(Y,"zIndex"),X(Y,"absolutePosition"),X(Y,"position"),X(Y,"x",0,(0,l.getNumberValidator)()),X(Y,"y",0,(0,l.getNumberValidator)()),X(Y,"globalCompositeOperation","source-over",(0,l.getStringValidator)()),X(Y,"opacity",1,(0,l.getNumberValidator)()),X(Y,"name","",(0,l.getStringValidator)()),X(Y,"id","",(0,l.getStringValidator)()),X(Y,"rotation",0,(0,l.getNumberValidator)()),n.Factory.addComponentsGetterSetter(Y,"scale",["x","y"]),X(Y,"scaleX",1,(0,l.getNumberValidator)()),X(Y,"scaleY",1,(0,l.getNumberValidator)()),n.Factory.addComponentsGetterSetter(Y,"skew",["x","y"]),X(Y,"skewX",0,(0,l.getNumberValidator)()),X(Y,"skewY",0,(0,l.getNumberValidator)()),n.Factory.addComponentsGetterSetter(Y,"offset",["x","y"]),X(Y,"offsetX",0,(0,l.getNumberValidator)()),X(Y,"offsetY",0,(0,l.getNumberValidator)()),X(Y,"dragDistance",void 0,(0,l.getNumberValidator)()),X(Y,"width",0,(0,l.getNumberValidator)()),X(Y,"height",0,(0,l.getNumberValidator)()),X(Y,"listening",!0,(0,l.getBooleanValidator)()),X(Y,"preventDefault",!0,(0,l.getBooleanValidator)()),X(Y,"filters",void 0,function(ne){return this._filterUpToDate=!1,ne}),X(Y,"visible",!0,(0,l.getBooleanValidator)()),X(Y,"transformsEnabled","all",(0,l.getStringValidator)()),X(Y,"size"),X(Y,"dragBoundFunc"),X(Y,"draggable",!1,(0,l.getBooleanValidator)()),n.Factory.backCompat(Y,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"}),ef}var tf={},BS;function jp(){if(BS)return tf;BS=1,Object.defineProperty(tf,"__esModule",{value:!0}),tf.Container=void 0;const t=Qt(),e=Qn(),n=Zt();let s=class extends e.Node{constructor(){super(...arguments),this.children=[]}getChildren(l){const u=this.children||[];return l?u.filter(l):u}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(l=>{l.parent=null,l.index=0,l.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(l=>{l.parent=null,l.index=0,l.destroy()}),this.children=[],this._requestDraw(),this}add(...l){if(l.length===0)return this;if(l.length>1){for(let d=0;d<l.length;d++)this.add(l[d]);return this}const u=l[0];return u.getParent()?(u.moveTo(this),this):(this._validateAdd(u),u.index=this.getChildren().length,u.parent=this,u._clearCaches(),this.getChildren().push(u),this._fire("add",{child:u}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(l){return this._generalFind(l,!1)}findOne(l){const u=this._generalFind(l,!0);return u.length>0?u[0]:void 0}_generalFind(l,u){const d=[];return this._descendants(p=>{const h=p._isMatch(l);return h&&d.push(p),!!(h&&u)}),d}_descendants(l){let u=!1;const d=this.getChildren();for(const p of d){if(u=l(p),u)return!0;if(p.hasChildren()&&(u=p._descendants(l),u))return!0}return!1}toObject(){const l=e.Node.prototype.toObject.call(this);return l.children=[],this.getChildren().forEach(u=>{l.children.push(u.toObject())}),l}isAncestorOf(l){let u=l.getParent();for(;u;){if(u._id===this._id)return!0;u=u.getParent()}return!1}clone(l){const u=e.Node.prototype.clone.call(this,l);return this.getChildren().forEach(function(d){u.add(d.clone())}),u}getAllIntersections(l){const u=[];return this.find("Shape").forEach(d=>{d.isVisible()&&d.intersects(l)&&u.push(d)}),u}_clearSelfAndDescendantCache(l){var u;super._clearSelfAndDescendantCache(l),!this.isCached()&&((u=this.children)===null||u===void 0||u.forEach(function(d){d._clearSelfAndDescendantCache(l)}))}_setChildrenIndices(){var l;(l=this.children)===null||l===void 0||l.forEach(function(u,d){u.index=d}),this._requestDraw()}drawScene(l,u,d){const p=this.getLayer(),h=l||p&&p.getCanvas(),y=h&&h.getContext(),_=this._getCanvasCache(),S=_&&_.scene,x=h&&h.isCache;if(!this.isVisible()&&!x)return this;if(S){y.save();const w=this.getAbsoluteTransform(u).getMatrix();y.transform(w[0],w[1],w[2],w[3],w[4],w[5]),this._drawCachedSceneCanvas(y),y.restore()}else this._drawChildren("drawScene",h,u,d);return this}drawHit(l,u){if(!this.shouldDrawHit(u))return this;const d=this.getLayer(),p=l||d&&d.hitCanvas,h=p&&p.getContext(),y=this._getCanvasCache();if(y&&y.hit){h.save();const S=this.getAbsoluteTransform(u).getMatrix();h.transform(S[0],S[1],S[2],S[3],S[4],S[5]),this._drawCachedHitCanvas(h),h.restore()}else this._drawChildren("drawHit",p,u);return this}_drawChildren(l,u,d,p){var h;const y=u&&u.getContext(),_=this.clipWidth(),S=this.clipHeight(),x=this.clipFunc(),w=typeof _=="number"&&typeof S=="number"||x,C=d===this;if(w){y.save();const U=this.getAbsoluteTransform(d);let M=U.getMatrix();y.transform(M[0],M[1],M[2],M[3],M[4],M[5]),y.beginPath();let E;if(x)E=x.call(this,y,this);else{const L=this.clipX(),R=this.clipY();y.rect(L||0,R||0,_,S)}y.clip.apply(y,E),M=U.copy().invert().getMatrix(),y.transform(M[0],M[1],M[2],M[3],M[4],M[5])}const D=!C&&this.globalCompositeOperation()!=="source-over"&&l==="drawScene";D&&(y.save(),y._applyGlobalCompositeOperation(this)),(h=this.children)===null||h===void 0||h.forEach(function(U){U[l](u,d,p)}),D&&y.restore(),w&&y.restore()}getClientRect(l={}){var u;const d=l.skipTransform,p=l.relativeTo;let h,y,_,S,x={x:1/0,y:1/0,width:0,height:0};const w=this;(u=this.children)===null||u===void 0||u.forEach(function(U){if(!U.visible())return;const M=U.getClientRect({relativeTo:w,skipShadow:l.skipShadow,skipStroke:l.skipStroke});M.width===0&&M.height===0||(h===void 0?(h=M.x,y=M.y,_=M.x+M.width,S=M.y+M.height):(h=Math.min(h,M.x),y=Math.min(y,M.y),_=Math.max(_,M.x+M.width),S=Math.max(S,M.y+M.height)))});const C=this.find("Shape");let D=!1;for(let U=0;U<C.length;U++)if(C[U]._isVisible(this)){D=!0;break}return D&&h!==void 0?x={x:h,y,width:_-h,height:S-y}:x={x:0,y:0,width:0,height:0},d?x:this._transformedRect(x,p)}};return tf.Container=s,t.Factory.addComponentsGetterSetter(s,"clip",["x","y","width","height"]),t.Factory.addGetterSetter(s,"clipX",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"clipY",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"clipWidth",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"clipHeight",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"clipFunc"),tf}var dm={},Qo={},zS;function HS(){if(zS)return Qo;zS=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.getCapturedShape=s,Qo.createEvent=a,Qo.hasPointerCapture=l,Qo.setPointerCapture=u,Qo.releaseCapture=d;const t=Vt(),e=new Map,n=t.Konva._global.PointerEvent!==void 0;function s(p){return e.get(p)}function a(p){return{evt:p,pointerId:p.pointerId}}function l(p,h){return e.get(p)===h}function u(p,h){d(p),h.getStage()&&(e.set(p,h),n&&h._fire("gotpointercapture",a(new PointerEvent("gotpointercapture"))))}function d(p,h){const y=e.get(p);if(!y)return;const _=y.getStage();_&&_.content,e.delete(p),n&&y._fire("lostpointercapture",a(new PointerEvent("lostpointercapture")))}return Qo}var GS;function W6(){return GS||(GS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Stage=t.stages=void 0;const e=Hn(),n=Qt(),s=jp(),a=Vt(),l=Yp(),u=cm(),d=Vt(),p=HS(),h="Stage",y="string",_="px",S="mouseout",x="mouseleave",w="mouseover",C="mouseenter",D="mousemove",U="mousedown",M="mouseup",E="pointermove",L="pointerdown",R="pointerup",z="pointercancel",ee="lostpointercapture",O="pointerout",I="pointerleave",F="pointerover",V="pointerenter",W="contextmenu",j="touchstart",Y="touchend",X="touchmove",ne="touchcancel",A="wheel",B=5,Q=[[C,"_pointerenter"],[U,"_pointerdown"],[D,"_pointermove"],[M,"_pointerup"],[x,"_pointerleave"],[j,"_pointerdown"],[X,"_pointermove"],[Y,"_pointerup"],[ne,"_pointercancel"],[w,"_pointerover"],[A,"_wheel"],[W,"_contextmenu"],[L,"_pointerdown"],[E,"_pointermove"],[R,"_pointerup"],[z,"_pointercancel"],[I,"_pointerleave"],[ee,"_lostpointercapture"]],H={mouse:{[O]:S,[I]:x,[F]:w,[V]:C,[E]:D,[L]:U,[R]:M,[z]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[O]:"touchout",[I]:"touchleave",[F]:"touchover",[V]:"touchenter",[E]:X,[L]:j,[R]:Y,[z]:ne,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[O]:O,[I]:I,[F]:F,[V]:V,[E]:E,[L]:L,[R]:R,[z]:z,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},K=se=>se.indexOf("pointer")>=0?"pointer":se.indexOf("touch")>=0?"touch":"mouse",ae=se=>{const q=K(se);if(q==="pointer")return a.Konva.pointerEventsEnabled&&H.pointer;if(q==="touch")return H.touch;if(q==="mouse")return H.mouse};function ie(se={}){return(se.clipFunc||se.clipWidth||se.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),se}const de="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";t.stages=[];class fe extends s.Container{constructor(q){super(ie(q)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),t.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{ie(this.attrs)}),this._checkVisibility()}_validateAdd(q){const oe=q.getType()==="Layer",ye=q.getType()==="FastLayer";oe||ye||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const q=this.visible()?"":"none";this.content.style.display=q}setContainer(q){if(typeof q===y){let oe;if(q.charAt(0)==="."){const ye=q.slice(1);q=document.getElementsByClassName(ye)[0]}else q.charAt(0)!=="#"?oe=q:oe=q.slice(1),q=document.getElementById(oe);if(!q)throw"Can not find container in document with id "+oe}return this._setAttr("container",q),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),q.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const q=this.children,oe=q.length;for(let ye=0;ye<oe;ye++)q[ye].clear();return this}clone(q){return q||(q={}),q.container=typeof document<"u"&&document.createElement("div"),s.Container.prototype.clone.call(this,q)}destroy(){super.destroy();const q=this.content;q&&e.Util._isInDocument(q)&&this.container().removeChild(q);const oe=t.stages.indexOf(this);return oe>-1&&t.stages.splice(oe,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const q=this._pointerPositions[0]||this._changedPointerPositions[0];return q?{x:q.x,y:q.y}:(e.Util.warn(de),null)}_getPointerById(q){return this._pointerPositions.find(oe=>oe.id===q)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(q){q=q||{},q.x=q.x||0,q.y=q.y||0,q.width=q.width||this.width(),q.height=q.height||this.height();const oe=new l.SceneCanvas({width:q.width,height:q.height,pixelRatio:q.pixelRatio||1}),ye=oe.getContext()._context,ke=this.children;return(q.x||q.y)&&ye.translate(-1*q.x,-1*q.y),ke.forEach(function(Ae){if(!Ae.isVisible())return;const Me=Ae._toKonvaCanvas(q);ye.drawImage(Me._canvas,q.x,q.y,Me.getWidth()/Me.getPixelRatio(),Me.getHeight()/Me.getPixelRatio())}),oe}getIntersection(q){if(!q)return null;const oe=this.children,ye=oe.length,ke=ye-1;for(let Ae=ke;Ae>=0;Ae--){const Me=oe[Ae].getIntersection(q);if(Me)return Me}return null}_resizeDOM(){const q=this.width(),oe=this.height();this.content&&(this.content.style.width=q+_,this.content.style.height=oe+_),this.bufferCanvas.setSize(q,oe),this.bufferHitCanvas.setSize(q,oe),this.children.forEach(ye=>{ye.setSize({width:q,height:oe}),ye.draw()})}add(q,...oe){if(arguments.length>1){for(let ke=0;ke<arguments.length;ke++)this.add(arguments[ke]);return this}super.add(q);const ye=this.children.length;return ye>B&&e.Util.warn("The stage has "+ye+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),q.setSize({width:this.width(),height:this.height()}),q.draw(),a.Konva.isBrowser&&this.content.appendChild(q.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(q){return p.hasPointerCapture(q,this)}setPointerCapture(q){p.setPointerCapture(q,this)}releaseCapture(q){p.releaseCapture(q,this)}getLayers(){return this.children}_bindContentEvents(){a.Konva.isBrowser&&Q.forEach(([q,oe])=>{this.content.addEventListener(q,ye=>{this[oe](ye)},{passive:!1})})}_pointerenter(q){this.setPointersPositions(q);const oe=ae(q.type);oe&&this._fire(oe.pointerenter,{evt:q,target:this,currentTarget:this})}_pointerover(q){this.setPointersPositions(q);const oe=ae(q.type);oe&&this._fire(oe.pointerover,{evt:q,target:this,currentTarget:this})}_getTargetShape(q){let oe=this[q+"targetShape"];return oe&&!oe.getStage()&&(oe=null),oe}_pointerleave(q){const oe=ae(q.type),ye=K(q.type);if(!oe)return;this.setPointersPositions(q);const ke=this._getTargetShape(ye),Ae=!(a.Konva.isDragging()||a.Konva.isTransforming())||a.Konva.hitOnDragEnabled;ke&&Ae?(ke._fireAndBubble(oe.pointerout,{evt:q}),ke._fireAndBubble(oe.pointerleave,{evt:q}),this._fire(oe.pointerleave,{evt:q,target:this,currentTarget:this}),this[ye+"targetShape"]=null):Ae&&(this._fire(oe.pointerleave,{evt:q,target:this,currentTarget:this}),this._fire(oe.pointerout,{evt:q,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(q){const oe=ae(q.type),ye=K(q.type);if(!oe)return;this.setPointersPositions(q);let ke=!1;this._changedPointerPositions.forEach(Ae=>{const Me=this.getIntersection(Ae);if(u.DD.justDragged=!1,a.Konva["_"+ye+"ListenClick"]=!0,!Me||!Me.isListening()){this[ye+"ClickStartShape"]=void 0;return}a.Konva.capturePointerEventsEnabled&&Me.setPointerCapture(Ae.id),this[ye+"ClickStartShape"]=Me,Me._fireAndBubble(oe.pointerdown,{evt:q,pointerId:Ae.id}),ke=!0;const be=q.type.indexOf("touch")>=0;Me.preventDefault()&&q.cancelable&&be&&q.preventDefault()}),ke||this._fire(oe.pointerdown,{evt:q,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(q){const oe=ae(q.type),ye=K(q.type);if(!oe||(a.Konva.isDragging()&&u.DD.node.preventDefault()&&q.cancelable&&q.preventDefault(),this.setPointersPositions(q),!(!(a.Konva.isDragging()||a.Konva.isTransforming())||a.Konva.hitOnDragEnabled)))return;const Ae={};let Me=!1;const be=this._getTargetShape(ye);this._changedPointerPositions.forEach(He=>{const $e=p.getCapturedShape(He.id)||this.getIntersection(He),Ct=He.id,le={evt:q,pointerId:Ct},Ee=be!==$e;if(Ee&&be&&(be._fireAndBubble(oe.pointerout,{...le},$e),be._fireAndBubble(oe.pointerleave,{...le},$e)),$e){if(Ae[$e._id])return;Ae[$e._id]=!0}$e&&$e.isListening()?(Me=!0,Ee&&($e._fireAndBubble(oe.pointerover,{...le},be),$e._fireAndBubble(oe.pointerenter,{...le},be),this[ye+"targetShape"]=$e),$e._fireAndBubble(oe.pointermove,{...le})):be&&(this._fire(oe.pointerover,{evt:q,target:this,currentTarget:this,pointerId:Ct}),this[ye+"targetShape"]=null)}),Me||this._fire(oe.pointermove,{evt:q,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(q){const oe=ae(q.type),ye=K(q.type);if(!oe)return;this.setPointersPositions(q);const ke=this[ye+"ClickStartShape"],Ae=this[ye+"ClickEndShape"],Me={};let be=!1;this._changedPointerPositions.forEach(He=>{const $e=p.getCapturedShape(He.id)||this.getIntersection(He);if($e){if($e.releaseCapture(He.id),Me[$e._id])return;Me[$e._id]=!0}const Ct=He.id,le={evt:q,pointerId:Ct};let Ee=!1;a.Konva["_"+ye+"InDblClickWindow"]?(Ee=!0,clearTimeout(this[ye+"DblTimeout"])):u.DD.justDragged||(a.Konva["_"+ye+"InDblClickWindow"]=!0,clearTimeout(this[ye+"DblTimeout"])),this[ye+"DblTimeout"]=setTimeout(function(){a.Konva["_"+ye+"InDblClickWindow"]=!1},a.Konva.dblClickWindow),$e&&$e.isListening()?(be=!0,this[ye+"ClickEndShape"]=$e,$e._fireAndBubble(oe.pointerup,{...le}),a.Konva["_"+ye+"ListenClick"]&&ke&&ke===$e&&($e._fireAndBubble(oe.pointerclick,{...le}),Ee&&Ae&&Ae===$e&&$e._fireAndBubble(oe.pointerdblclick,{...le}))):(this[ye+"ClickEndShape"]=null,a.Konva["_"+ye+"ListenClick"]&&this._fire(oe.pointerclick,{evt:q,target:this,currentTarget:this,pointerId:Ct}),Ee&&this._fire(oe.pointerdblclick,{evt:q,target:this,currentTarget:this,pointerId:Ct}))}),be||this._fire(oe.pointerup,{evt:q,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),a.Konva["_"+ye+"ListenClick"]=!1,q.cancelable&&ye!=="touch"&&ye!=="pointer"&&q.preventDefault()}_contextmenu(q){this.setPointersPositions(q);const oe=this.getIntersection(this.getPointerPosition());oe&&oe.isListening()?oe._fireAndBubble(W,{evt:q}):this._fire(W,{evt:q,target:this,currentTarget:this})}_wheel(q){this.setPointersPositions(q);const oe=this.getIntersection(this.getPointerPosition());oe&&oe.isListening()?oe._fireAndBubble(A,{evt:q}):this._fire(A,{evt:q,target:this,currentTarget:this})}_pointercancel(q){this.setPointersPositions(q);const oe=p.getCapturedShape(q.pointerId)||this.getIntersection(this.getPointerPosition());oe&&oe._fireAndBubble(R,p.createEvent(q)),p.releaseCapture(q.pointerId)}_lostpointercapture(q){p.releaseCapture(q.pointerId)}setPointersPositions(q){const oe=this._getContentPosition();let ye=null,ke=null;q=q||window.event,q.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(q.touches,Ae=>{this._pointerPositions.push({id:Ae.identifier,x:(Ae.clientX-oe.left)/oe.scaleX,y:(Ae.clientY-oe.top)/oe.scaleY})}),Array.prototype.forEach.call(q.changedTouches||q.touches,Ae=>{this._changedPointerPositions.push({id:Ae.identifier,x:(Ae.clientX-oe.left)/oe.scaleX,y:(Ae.clientY-oe.top)/oe.scaleY})})):(ye=(q.clientX-oe.left)/oe.scaleX,ke=(q.clientY-oe.top)/oe.scaleY,this.pointerPos={x:ye,y:ke},this._pointerPositions=[{x:ye,y:ke,id:e.Util._getFirstPointerId(q)}],this._changedPointerPositions=[{x:ye,y:ke,id:e.Util._getFirstPointerId(q)}])}_setPointerPosition(q){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(q)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const q=this.content.getBoundingClientRect();return{top:q.top,left:q.left,scaleX:q.width/this.content.clientWidth||1,scaleY:q.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new l.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new l.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!a.Konva.isBrowser)return;const q=this.container();if(!q)throw"Stage has no container. A container is required.";q.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),q.appendChild(this.content),this._resizeDOM()}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(q){q.batchDraw()}),this}}t.Stage=fe,fe.prototype.nodeType=h,(0,d._registerNode)(fe),n.Factory.addGetterSetter(fe,"container"),a.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach(se=>{se.batchDraw()})})})(dm)),dm}var nf={},fm={},VS;function Lr(){return VS||(VS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=Vt(),n=Hn(),s=Qt(),a=Qn(),l=Zt(),u=Vt(),d=HS(),p="hasShadow",h="shadowRGBA",y="patternImage",_="linearGradient",S="radialGradient";let x;function w(){return x||(x=n.Util.createCanvasElement().getContext("2d"),x)}t.shapes={};function C(I){const F=this.attrs.fillRule;F?I.fill(F):I.fill()}function D(I){I.stroke()}function U(I){const F=this.attrs.fillRule;F?I.fill(F):I.fill()}function M(I){I.stroke()}function E(){this._clearCache(p)}function L(){this._clearCache(h)}function R(){this._clearCache(y)}function z(){this._clearCache(_)}function ee(){this._clearCache(S)}class O extends a.Node{constructor(F){super(F);let V;for(;V=n.Util.getRandomColor(),!(V&&!(V in t.shapes)););this.colorKey=V,t.shapes[V]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(p,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(y,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const V=w().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(V&&V.setTransform){const W=new n.Transform;W.translate(this.fillPatternX(),this.fillPatternY()),W.rotate(e.Konva.getAngle(this.fillPatternRotation())),W.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),W.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const j=W.getMatrix(),Y=typeof DOMMatrix>"u"?{a:j[0],b:j[1],c:j[2],d:j[3],e:j[4],f:j[5]}:new DOMMatrix(j);V.setTransform(Y)}return V}}_getLinearGradient(){return this._getCache(_,this.__getLinearGradient)}__getLinearGradient(){const F=this.fillLinearGradientColorStops();if(F){const V=w(),W=this.fillLinearGradientStartPoint(),j=this.fillLinearGradientEndPoint(),Y=V.createLinearGradient(W.x,W.y,j.x,j.y);for(let X=0;X<F.length;X+=2)Y.addColorStop(F[X],F[X+1]);return Y}}_getRadialGradient(){return this._getCache(S,this.__getRadialGradient)}__getRadialGradient(){const F=this.fillRadialGradientColorStops();if(F){const V=w(),W=this.fillRadialGradientStartPoint(),j=this.fillRadialGradientEndPoint(),Y=V.createRadialGradient(W.x,W.y,this.fillRadialGradientStartRadius(),j.x,j.y,this.fillRadialGradientEndRadius());for(let X=0;X<F.length;X+=2)Y.addColorStop(F[X],F[X+1]);return Y}}getShadowRGBA(){return this._getCache(h,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const F=n.Util.colorToRGBA(this.shadowColor());if(F)return"rgba("+F.r+","+F.g+","+F.b+","+F.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const F=this.hitStrokeWidth();return F==="auto"?this.hasStroke():this.strokeEnabled()&&!!F}intersects(F){const V=this.getStage();if(!V)return!1;const W=V.bufferHitCanvas;return W.getContext().clear(),this.drawHit(W,void 0,!0),W.context.getImageData(Math.round(F.x),Math.round(F.y),1,1).data[3]>0}destroy(){return a.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(F){var V;if(!((V=this.attrs.perfectDrawEnabled)!==null&&V!==void 0?V:!0))return!1;const j=F||this.hasFill(),Y=this.hasStroke(),X=this.getAbsoluteOpacity()!==1;if(j&&Y&&X)return!0;const ne=this.hasShadow(),A=this.shadowForStrokeEnabled();return!!(j&&Y&&ne&&A)}setStrokeHitEnabled(F){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),F?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const F=this.size();return{x:this._centroid?-F.width/2:0,y:this._centroid?-F.height/2:0,width:F.width,height:F.height}}getClientRect(F={}){let V=!1,W=this.getParent();for(;W;){if(W.isCached()){V=!0;break}W=W.getParent()}const j=F.skipTransform,Y=F.relativeTo||V&&this.getStage()||void 0,X=this.getSelfRect(),A=!F.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,B=X.width+A,Q=X.height+A,H=!F.skipShadow&&this.hasShadow(),K=H?this.shadowOffsetX():0,ae=H?this.shadowOffsetY():0,ie=B+Math.abs(K),de=Q+Math.abs(ae),fe=H&&this.shadowBlur()||0,se=ie+fe*2,q=de+fe*2,oe={width:se,height:q,x:-(A/2+fe)+Math.min(K,0)+X.x,y:-(A/2+fe)+Math.min(ae,0)+X.y};return j?oe:this._transformedRect(oe,Y)}drawScene(F,V,W){const j=this.getLayer(),Y=F||j.getCanvas(),X=Y.getContext(),ne=this._getCanvasCache(),A=this.getSceneFunc(),B=this.hasShadow();let Q;const H=V===this;if(!this.isVisible()&&!H)return this;if(ne){X.save();const K=this.getAbsoluteTransform(V).getMatrix();return X.transform(K[0],K[1],K[2],K[3],K[4],K[5]),this._drawCachedSceneCanvas(X),X.restore(),this}if(!A)return this;if(X.save(),this._useBufferCanvas()){Q=this.getStage();const K=W||Q.bufferCanvas,ae=K.getContext();ae.clear(),ae.save(),ae._applyLineJoin(this);const ie=this.getAbsoluteTransform(V).getMatrix();ae.transform(ie[0],ie[1],ie[2],ie[3],ie[4],ie[5]),A.call(this,ae,this),ae.restore();const de=K.pixelRatio;B&&X._applyShadow(this),X._applyOpacity(this),X._applyGlobalCompositeOperation(this),X.drawImage(K._canvas,K.x||0,K.y||0,K.width/de,K.height/de)}else{if(X._applyLineJoin(this),!H){const K=this.getAbsoluteTransform(V).getMatrix();X.transform(K[0],K[1],K[2],K[3],K[4],K[5]),X._applyOpacity(this),X._applyGlobalCompositeOperation(this)}B&&X._applyShadow(this),A.call(this,X,this)}return X.restore(),this}drawHit(F,V,W=!1){if(!this.shouldDrawHit(V,W))return this;const j=this.getLayer(),Y=F||j.hitCanvas,X=Y&&Y.getContext(),ne=this.hitFunc()||this.sceneFunc(),A=this._getCanvasCache(),B=A&&A.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),B){X.save();const H=this.getAbsoluteTransform(V).getMatrix();return X.transform(H[0],H[1],H[2],H[3],H[4],H[5]),this._drawCachedHitCanvas(X),X.restore(),this}if(!ne)return this;if(X.save(),X._applyLineJoin(this),!(this===V)){const H=this.getAbsoluteTransform(V).getMatrix();X.transform(H[0],H[1],H[2],H[3],H[4],H[5])}return ne.call(this,X,this),X.restore(),this}drawHitFromCache(F=0){const V=this._getCanvasCache(),W=this._getCachedSceneCanvas(),j=V.hit,Y=j.getContext(),X=j.getWidth(),ne=j.getHeight();Y.clear(),Y.drawImage(W._canvas,0,0,X,ne);try{const A=Y.getImageData(0,0,X,ne),B=A.data,Q=B.length,H=n.Util._hexToRgb(this.colorKey);for(let K=0;K<Q;K+=4)B[K+3]>F?(B[K]=H.r,B[K+1]=H.g,B[K+2]=H.b,B[K+3]=255):B[K+3]=0;Y.putImageData(A,0,0)}catch(A){n.Util.error("Unable to draw hit graph from cached scene canvas. "+A.message)}return this}hasPointerCapture(F){return d.hasPointerCapture(F,this)}setPointerCapture(F){d.setPointerCapture(F,this)}releaseCapture(F){d.releaseCapture(F,this)}}t.Shape=O,O.prototype._fillFunc=C,O.prototype._strokeFunc=D,O.prototype._fillFuncHit=U,O.prototype._strokeFuncHit=M,O.prototype._centroid=!1,O.prototype.nodeType="Shape",(0,u._registerNode)(O),O.prototype.eventListeners={},O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",E),O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",L),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",R),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",z),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",ee),s.Factory.addGetterSetter(O,"stroke",void 0,(0,l.getStringOrGradientValidator)()),s.Factory.addGetterSetter(O,"strokeWidth",2,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"fillAfterStrokeEnabled",!1),s.Factory.addGetterSetter(O,"hitStrokeWidth","auto",(0,l.getNumberOrAutoValidator)()),s.Factory.addGetterSetter(O,"strokeHitEnabled",!0,(0,l.getBooleanValidator)()),s.Factory.addGetterSetter(O,"perfectDrawEnabled",!0,(0,l.getBooleanValidator)()),s.Factory.addGetterSetter(O,"shadowForStrokeEnabled",!0,(0,l.getBooleanValidator)()),s.Factory.addGetterSetter(O,"lineJoin"),s.Factory.addGetterSetter(O,"lineCap"),s.Factory.addGetterSetter(O,"sceneFunc"),s.Factory.addGetterSetter(O,"hitFunc"),s.Factory.addGetterSetter(O,"dash"),s.Factory.addGetterSetter(O,"dashOffset",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"shadowColor",void 0,(0,l.getStringValidator)()),s.Factory.addGetterSetter(O,"shadowBlur",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"shadowOpacity",1,(0,l.getNumberValidator)()),s.Factory.addComponentsGetterSetter(O,"shadowOffset",["x","y"]),s.Factory.addGetterSetter(O,"shadowOffsetX",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"shadowOffsetY",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"fillPatternImage"),s.Factory.addGetterSetter(O,"fill",void 0,(0,l.getStringOrGradientValidator)()),s.Factory.addGetterSetter(O,"fillPatternX",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"fillPatternY",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"fillLinearGradientColorStops"),s.Factory.addGetterSetter(O,"strokeLinearGradientColorStops"),s.Factory.addGetterSetter(O,"fillRadialGradientStartRadius",0),s.Factory.addGetterSetter(O,"fillRadialGradientEndRadius",0),s.Factory.addGetterSetter(O,"fillRadialGradientColorStops"),s.Factory.addGetterSetter(O,"fillPatternRepeat","repeat"),s.Factory.addGetterSetter(O,"fillEnabled",!0),s.Factory.addGetterSetter(O,"strokeEnabled",!0),s.Factory.addGetterSetter(O,"shadowEnabled",!0),s.Factory.addGetterSetter(O,"dashEnabled",!0),s.Factory.addGetterSetter(O,"strokeScaleEnabled",!0),s.Factory.addGetterSetter(O,"fillPriority","color"),s.Factory.addComponentsGetterSetter(O,"fillPatternOffset",["x","y"]),s.Factory.addGetterSetter(O,"fillPatternOffsetX",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"fillPatternOffsetY",0,(0,l.getNumberValidator)()),s.Factory.addComponentsGetterSetter(O,"fillPatternScale",["x","y"]),s.Factory.addGetterSetter(O,"fillPatternScaleX",1,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(O,"fillPatternScaleY",1,(0,l.getNumberValidator)()),s.Factory.addComponentsGetterSetter(O,"fillLinearGradientStartPoint",["x","y"]),s.Factory.addComponentsGetterSetter(O,"strokeLinearGradientStartPoint",["x","y"]),s.Factory.addGetterSetter(O,"fillLinearGradientStartPointX",0),s.Factory.addGetterSetter(O,"strokeLinearGradientStartPointX",0),s.Factory.addGetterSetter(O,"fillLinearGradientStartPointY",0),s.Factory.addGetterSetter(O,"strokeLinearGradientStartPointY",0),s.Factory.addComponentsGetterSetter(O,"fillLinearGradientEndPoint",["x","y"]),s.Factory.addComponentsGetterSetter(O,"strokeLinearGradientEndPoint",["x","y"]),s.Factory.addGetterSetter(O,"fillLinearGradientEndPointX",0),s.Factory.addGetterSetter(O,"strokeLinearGradientEndPointX",0),s.Factory.addGetterSetter(O,"fillLinearGradientEndPointY",0),s.Factory.addGetterSetter(O,"strokeLinearGradientEndPointY",0),s.Factory.addComponentsGetterSetter(O,"fillRadialGradientStartPoint",["x","y"]),s.Factory.addGetterSetter(O,"fillRadialGradientStartPointX",0),s.Factory.addGetterSetter(O,"fillRadialGradientStartPointY",0),s.Factory.addComponentsGetterSetter(O,"fillRadialGradientEndPoint",["x","y"]),s.Factory.addGetterSetter(O,"fillRadialGradientEndPointX",0),s.Factory.addGetterSetter(O,"fillRadialGradientEndPointY",0),s.Factory.addGetterSetter(O,"fillPatternRotation",0),s.Factory.addGetterSetter(O,"fillRule",void 0,(0,l.getStringValidator)()),s.Factory.backCompat(O,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(fm)),fm}var YS;function jS(){if(YS)return nf;YS=1,Object.defineProperty(nf,"__esModule",{value:!0}),nf.Layer=void 0;const t=Hn(),e=jp(),n=Qn(),s=Qt(),a=Yp(),l=Zt(),u=Lr(),d=Vt(),p="#",h="beforeDraw",y="draw",_=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],S=_.length;class x extends e.Container{constructor(C){super(C),this.canvas=new a.SceneCanvas,this.hitCanvas=new a.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(C){return this.getContext().clear(C),this.getHitCanvas().getContext().clear(C),this}setZIndex(C){super.setZIndex(C);const D=this.getStage();return D&&D.content&&(D.content.removeChild(this.getNativeCanvasElement()),C<D.children.length-1?D.content.insertBefore(this.getNativeCanvasElement(),D.children[C+1].getCanvas()._canvas):D.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){n.Node.prototype.moveToTop.call(this);const C=this.getStage();return C&&C.content&&(C.content.removeChild(this.getNativeCanvasElement()),C.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!n.Node.prototype.moveUp.call(this))return!1;const D=this.getStage();return!D||!D.content?!1:(D.content.removeChild(this.getNativeCanvasElement()),this.index<D.children.length-1?D.content.insertBefore(this.getNativeCanvasElement(),D.children[this.index+1].getCanvas()._canvas):D.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(n.Node.prototype.moveDown.call(this)){const C=this.getStage();if(C){const D=C.children;C.content&&(C.content.removeChild(this.getNativeCanvasElement()),C.content.insertBefore(this.getNativeCanvasElement(),D[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(n.Node.prototype.moveToBottom.call(this)){const C=this.getStage();if(C){const D=C.children;C.content&&(C.content.removeChild(this.getNativeCanvasElement()),C.content.insertBefore(this.getNativeCanvasElement(),D[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const C=this.getNativeCanvasElement();return n.Node.prototype.remove.call(this),C&&C.parentNode&&t.Util._isInDocument(C)&&C.parentNode.removeChild(C),this}getStage(){return this.parent}setSize({width:C,height:D}){return this.canvas.setSize(C,D),this.hitCanvas.setSize(C,D),this._setSmoothEnabled(),this}_validateAdd(C){const D=C.getType();D!=="Group"&&D!=="Shape"&&t.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(C){return C=C||{},C.width=C.width||this.getWidth(),C.height=C.height||this.getHeight(),C.x=C.x!==void 0?C.x:this.x(),C.y=C.y!==void 0?C.y:this.y(),n.Node.prototype._toKonvaCanvas.call(this,C)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){t.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){t.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,t.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(C){if(!this.isListening()||!this.isVisible())return null;let D=1,U=!1;for(;;){for(let M=0;M<S;M++){const E=_[M],L=this._getIntersection({x:C.x+E.x*D,y:C.y+E.y*D}),R=L.shape;if(R)return R;if(U=!!L.antialiased,!L.antialiased)break}if(U)D+=1;else return null}}_getIntersection(C){const D=this.hitCanvas.pixelRatio,U=this.hitCanvas.context.getImageData(Math.round(C.x*D),Math.round(C.y*D),1,1).data,M=U[3];if(M===255){const E=t.Util._rgbToHex(U[0],U[1],U[2]),L=u.shapes[p+E];return L?{shape:L}:{antialiased:!0}}else if(M>0)return{antialiased:!0};return{}}drawScene(C,D,U){const M=this.getLayer(),E=C||M&&M.getCanvas();return this._fire(h,{node:this}),this.clearBeforeDraw()&&E.getContext().clear(),e.Container.prototype.drawScene.call(this,E,D,U),this._fire(y,{node:this}),this}drawHit(C,D){const U=this.getLayer(),M=C||U&&U.hitCanvas;return U&&U.clearBeforeDraw()&&U.getHitCanvas().getContext().clear(),e.Container.prototype.drawHit.call(this,M,D),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(C){t.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(C)}getHitGraphEnabled(C){return t.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const C=this.parent;!!this.hitCanvas._canvas.parentNode?C.content.removeChild(this.hitCanvas._canvas):C.content.appendChild(this.hitCanvas._canvas)}destroy(){return t.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}return nf.Layer=x,x.prototype.nodeType="Layer",(0,d._registerNode)(x),s.Factory.addGetterSetter(x,"imageSmoothingEnabled",!0),s.Factory.addGetterSetter(x,"clearBeforeDraw",!0),s.Factory.addGetterSetter(x,"hitGraphEnabled",!0,(0,l.getBooleanValidator)()),nf}var rf={},WS;function X6(){if(WS)return rf;WS=1,Object.defineProperty(rf,"__esModule",{value:!0}),rf.FastLayer=void 0;const t=Hn(),e=jS(),n=Vt();let s=class extends e.Layer{constructor(l){super(l),this.listening(!1),t.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};return rf.FastLayer=s,s.prototype.nodeType="FastLayer",(0,n._registerNode)(s),rf}var sf={},XS;function hm(){if(XS)return sf;XS=1,Object.defineProperty(sf,"__esModule",{value:!0}),sf.Group=void 0;const t=Hn(),e=jp(),n=Vt();class s extends e.Container{_validateAdd(l){const u=l.getType();u!=="Group"&&u!=="Shape"&&t.Util.throw("You may only add groups and shapes to groups.")}}return sf.Group=s,s.prototype.nodeType="Group",(0,n._registerNode)(s),sf}var af={},qS;function pm(){if(qS)return af;qS=1,Object.defineProperty(af,"__esModule",{value:!0}),af.Animation=void 0;const t=Vt(),e=Hn(),n=(function(){return t.glob.performance&&t.glob.performance.now?function(){return t.glob.performance.now()}:function(){return new Date().getTime()}})();let s=class Zd{constructor(l,u){this.id=Zd.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:n(),frameRate:0},this.func=l,this.setLayers(u)}setLayers(l){let u=[];return l&&(u=Array.isArray(l)?l:[l]),this.layers=u,this}getLayers(){return this.layers}addLayer(l){const u=this.layers,d=u.length;for(let p=0;p<d;p++)if(u[p]._id===l._id)return!1;return this.layers.push(l),!0}isRunning(){const u=Zd.animations,d=u.length;for(let p=0;p<d;p++)if(u[p].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=n(),Zd._addAnimation(this),this}stop(){return Zd._removeAnimation(this),this}_updateFrameObject(l){this.frame.timeDiff=l-this.frame.lastTime,this.frame.lastTime=l,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(l){this.animations.push(l),this._handleAnimation()}static _removeAnimation(l){const u=l.id,d=this.animations,p=d.length;for(let h=0;h<p;h++)if(d[h].id===u){this.animations.splice(h,1);break}}static _runFrames(){const l={},u=this.animations;for(let d=0;d<u.length;d++){const p=u[d],h=p.layers,y=p.func;p._updateFrameObject(n());const _=h.length;let S;if(y?S=y.call(p,p.frame)!==!1:S=!0,!!S)for(let x=0;x<_;x++){const w=h[x];w._id!==void 0&&(l[w._id]=w)}}for(const d in l)l.hasOwnProperty(d)&&l[d].batchDraw()}static _animationLoop(){const l=Zd;l.animations.length?(l._runFrames(),e.Util.requestAnimFrame(l._animationLoop)):l.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,e.Util.requestAnimFrame(this._animationLoop))}};return af.Animation=s,s.animations=[],s.animIdCounter=0,s.animRunning=!1,af}var gm={},KS;function q6(){return KS||(KS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Easings=t.Tween=void 0;const e=Hn(),n=pm(),s=Qn(),a=Vt(),l={node:1,duration:1,easing:1,onFinish:1,yoyo:1},u=1,d=2,p=3,h=["fill","stroke","shadowColor"];let y=0;class _{constructor(w,C,D,U,M,E,L){this.prop=w,this.propFunc=C,this.begin=U,this._pos=U,this.duration=E,this._change=0,this.prevPos=0,this.yoyo=L,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=D,this._change=M-this.begin,this.pause()}fire(w){const C=this[w];C&&C()}setTime(w){w>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():w<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=w,this.update())}getTime(){return this._time}setPosition(w){this.prevPos=this._pos,this.propFunc(w),this._pos=w}getPosition(w){return w===void 0&&(w=this._time),this.func(w,this.begin,this._change,this.duration)}play(){this.state=d,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=p,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(w){this.pause(),this._time=w,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const w=this.getTimer()-this._startTime;this.state===d?this.setTime(w):this.state===p&&this.setTime(this.duration-w)}pause(){this.state=u,this.fire("onPause")}getTimer(){return new Date().getTime()}}class S{constructor(w){const C=this,D=w.node,U=D._id,M=w.easing||t.Easings.Linear,E=!!w.yoyo;let L,R;typeof w.duration>"u"?L=.3:w.duration===0?L=.001:L=w.duration,this.node=D,this._id=y++;const z=D.getLayer()||(D instanceof a.Konva.Stage?D.getLayers():null);z||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){C.tween.onEnterFrame()},z),this.tween=new _(R,function(ee){C._tweenFunc(ee)},M,0,1,L*1e3,E),this._addListeners(),S.attrs[U]||(S.attrs[U]={}),S.attrs[U][this._id]||(S.attrs[U][this._id]={}),S.tweens[U]||(S.tweens[U]={});for(R in w)l[R]===void 0&&this._addAttr(R,w[R]);this.reset(),this.onFinish=w.onFinish,this.onReset=w.onReset,this.onUpdate=w.onUpdate}_addAttr(w,C){const D=this.node,U=D._id;let M,E,L,R,z;const ee=S.tweens[U][w];ee&&delete S.attrs[U][ee][w];let O=D.getAttr(w);if(e.Util._isArray(C))if(M=[],E=Math.max(C.length,O.length),w==="points"&&C.length!==O.length&&(C.length>O.length?(R=O,O=e.Util._prepareArrayForTween(O,C,D.closed())):(L=C,C=e.Util._prepareArrayForTween(C,O,D.closed()))),w.indexOf("fill")===0)for(let I=0;I<E;I++)if(I%2===0)M.push(C[I]-O[I]);else{const F=e.Util.colorToRGBA(O[I]);z=e.Util.colorToRGBA(C[I]),O[I]=F,M.push({r:z.r-F.r,g:z.g-F.g,b:z.b-F.b,a:z.a-F.a})}else for(let I=0;I<E;I++)M.push(C[I]-O[I]);else h.indexOf(w)!==-1?(O=e.Util.colorToRGBA(O),z=e.Util.colorToRGBA(C),M={r:z.r-O.r,g:z.g-O.g,b:z.b-O.b,a:z.a-O.a}):M=C-O;S.attrs[U][this._id][w]={start:O,diff:M,end:C,trueEnd:L,trueStart:R},S.tweens[U][w]=this._id}_tweenFunc(w){const C=this.node,D=S.attrs[C._id][this._id];let U,M,E,L,R,z,ee,O;for(U in D){if(M=D[U],E=M.start,L=M.diff,O=M.end,e.Util._isArray(E))if(R=[],ee=Math.max(E.length,O.length),U.indexOf("fill")===0)for(z=0;z<ee;z++)z%2===0?R.push((E[z]||0)+L[z]*w):R.push("rgba("+Math.round(E[z].r+L[z].r*w)+","+Math.round(E[z].g+L[z].g*w)+","+Math.round(E[z].b+L[z].b*w)+","+(E[z].a+L[z].a*w)+")");else for(z=0;z<ee;z++)R.push((E[z]||0)+L[z]*w);else h.indexOf(U)!==-1?R="rgba("+Math.round(E.r+L.r*w)+","+Math.round(E.g+L.g*w)+","+Math.round(E.b+L.b*w)+","+(E.a+L.a*w)+")":R=E+L*w;C.setAttr(U,R)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const w=this.node,C=S.attrs[w._id][this._id];C.points&&C.points.trueEnd&&w.setAttr("points",C.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const w=this.node,C=S.attrs[w._id][this._id];C.points&&C.points.trueStart&&w.points(C.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(w){return this.tween.seek(w*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const w=this.node._id,C=this._id,D=S.tweens[w];this.pause(),this.anim&&this.anim.stop();for(const U in D)delete S.tweens[w][U];delete S.attrs[w][C],S.tweens[w]&&(Object.keys(S.tweens[w]).length===0&&delete S.tweens[w],Object.keys(S.attrs[w]).length===0&&delete S.attrs[w])}}t.Tween=S,S.attrs={},S.tweens={},s.Node.prototype.to=function(x){const w=x.onFinish;x.node=this,x.onFinish=function(){this.destroy(),w&&w()},new S(x).play()},t.Easings={BackEaseIn(x,w,C,D){return C*(x/=D)*x*((1.70158+1)*x-1.70158)+w},BackEaseOut(x,w,C,D){return C*((x=x/D-1)*x*((1.70158+1)*x+1.70158)+1)+w},BackEaseInOut(x,w,C,D){let U=1.70158;return(x/=D/2)<1?C/2*(x*x*(((U*=1.525)+1)*x-U))+w:C/2*((x-=2)*x*(((U*=1.525)+1)*x+U)+2)+w},ElasticEaseIn(x,w,C,D,U,M){let E=0;return x===0?w:(x/=D)===1?w+C:(M||(M=D*.3),!U||U<Math.abs(C)?(U=C,E=M/4):E=M/(2*Math.PI)*Math.asin(C/U),-(U*Math.pow(2,10*(x-=1))*Math.sin((x*D-E)*(2*Math.PI)/M))+w)},ElasticEaseOut(x,w,C,D,U,M){let E=0;return x===0?w:(x/=D)===1?w+C:(M||(M=D*.3),!U||U<Math.abs(C)?(U=C,E=M/4):E=M/(2*Math.PI)*Math.asin(C/U),U*Math.pow(2,-10*x)*Math.sin((x*D-E)*(2*Math.PI)/M)+C+w)},ElasticEaseInOut(x,w,C,D,U,M){let E=0;return x===0?w:(x/=D/2)===2?w+C:(M||(M=D*(.3*1.5)),!U||U<Math.abs(C)?(U=C,E=M/4):E=M/(2*Math.PI)*Math.asin(C/U),x<1?-.5*(U*Math.pow(2,10*(x-=1))*Math.sin((x*D-E)*(2*Math.PI)/M))+w:U*Math.pow(2,-10*(x-=1))*Math.sin((x*D-E)*(2*Math.PI)/M)*.5+C+w)},BounceEaseOut(x,w,C,D){return(x/=D)<1/2.75?C*(7.5625*x*x)+w:x<2/2.75?C*(7.5625*(x-=1.5/2.75)*x+.75)+w:x<2.5/2.75?C*(7.5625*(x-=2.25/2.75)*x+.9375)+w:C*(7.5625*(x-=2.625/2.75)*x+.984375)+w},BounceEaseIn(x,w,C,D){return C-t.Easings.BounceEaseOut(D-x,0,C,D)+w},BounceEaseInOut(x,w,C,D){return x<D/2?t.Easings.BounceEaseIn(x*2,0,C,D)*.5+w:t.Easings.BounceEaseOut(x*2-D,0,C,D)*.5+C*.5+w},EaseIn(x,w,C,D){return C*(x/=D)*x+w},EaseOut(x,w,C,D){return-C*(x/=D)*(x-2)+w},EaseInOut(x,w,C,D){return(x/=D/2)<1?C/2*x*x+w:-C/2*(--x*(x-2)-1)+w},StrongEaseIn(x,w,C,D){return C*(x/=D)*x*x*x*x+w},StrongEaseOut(x,w,C,D){return C*((x=x/D-1)*x*x*x*x+1)+w},StrongEaseInOut(x,w,C,D){return(x/=D/2)<1?C/2*x*x*x*x*x+w:C/2*((x-=2)*x*x*x*x+2)+w},Linear(x,w,C,D){return C*x/D+w}}})(gm)),gm}var QS;function ym(){return QS||(QS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;const e=Vt(),n=Hn(),s=Qn(),a=jp(),l=W6(),u=jS(),d=X6(),p=hm(),h=cm(),y=Lr(),_=pm(),S=q6(),x=NS(),w=Yp();t.Konva=n.Util._assign(e.Konva,{Util:n.Util,Transform:n.Transform,Node:s.Node,Container:a.Container,Stage:l.Stage,stages:l.stages,Layer:u.Layer,FastLayer:d.FastLayer,Group:p.Group,DD:h.DD,Shape:y.Shape,shapes:y.shapes,Animation:_.Animation,Tween:S.Tween,Easings:S.Easings,Context:x.Context,Canvas:w.Canvas}),t.default=t.Konva})(sm)),sm}var of={},JS;function K6(){if(JS)return of;JS=1,Object.defineProperty(of,"__esModule",{value:!0}),of.Arc=void 0;const t=Qt(),e=Lr(),n=Vt(),s=Zt(),a=Vt();let l=class extends e.Shape{_sceneFunc(d){const p=n.Konva.getAngle(this.angle()),h=this.clockwise();d.beginPath(),d.arc(0,0,this.outerRadius(),0,p,h),d.arc(0,0,this.innerRadius(),p,0,!h),d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(d){this.outerRadius(d/2)}setHeight(d){this.outerRadius(d/2)}getSelfRect(){const d=this.innerRadius(),p=this.outerRadius(),h=this.clockwise(),y=n.Konva.getAngle(h?360-this.angle():this.angle()),_=Math.cos(Math.min(y,Math.PI)),S=1,x=Math.sin(Math.min(Math.max(Math.PI,y),3*Math.PI/2)),w=Math.sin(Math.min(y,Math.PI/2)),C=_*(_>0?d:p),D=S*p,U=x*(x>0?d:p),M=w*(w>0?p:d);return{x:C,y:h?-1*M:U,width:D-C,height:M-U}}};return of.Arc=l,l.prototype._centroid=!0,l.prototype.className="Arc",l.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],(0,a._registerNode)(l),t.Factory.addGetterSetter(l,"innerRadius",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(l,"outerRadius",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(l,"angle",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(l,"clockwise",!1,(0,s.getBooleanValidator)()),of}var lf={},cf={},ZS;function $S(){if(ZS)return cf;ZS=1,Object.defineProperty(cf,"__esModule",{value:!0}),cf.Line=void 0;const t=Qt(),e=Vt(),n=Lr(),s=Zt();function a(d,p,h,y,_,S,x){const w=Math.sqrt(Math.pow(h-d,2)+Math.pow(y-p,2)),C=Math.sqrt(Math.pow(_-h,2)+Math.pow(S-y,2)),D=x*w/(w+C),U=x*C/(w+C),M=h-D*(_-d),E=y-D*(S-p),L=h+U*(_-d),R=y+U*(S-p);return[M,E,L,R]}function l(d,p){const h=d.length,y=[];for(let _=2;_<h-2;_+=2){const S=a(d[_-2],d[_-1],d[_],d[_+1],d[_+2],d[_+3],p);isNaN(S[0])||(y.push(S[0]),y.push(S[1]),y.push(d[_]),y.push(d[_+1]),y.push(S[2]),y.push(S[3]))}return y}class u extends n.Shape{constructor(p){super(p),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(p){const h=this.points(),y=h.length,_=this.tension(),S=this.closed(),x=this.bezier();if(!y)return;let w=0;if(p.beginPath(),p.moveTo(h[0],h[1]),_!==0&&y>4){const C=this.getTensionPoints(),D=C.length;for(w=S?0:4,S||p.quadraticCurveTo(C[0],C[1],C[2],C[3]);w<D-2;)p.bezierCurveTo(C[w++],C[w++],C[w++],C[w++],C[w++],C[w++]);S||p.quadraticCurveTo(C[D-2],C[D-1],h[y-2],h[y-1])}else if(x)for(w=2;w<y;)p.bezierCurveTo(h[w++],h[w++],h[w++],h[w++],h[w++],h[w++]);else for(w=2;w<y;w+=2)p.lineTo(h[w],h[w+1]);S?(p.closePath(),p.fillStrokeShape(this)):p.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():l(this.points(),this.tension())}_getTensionPointsClosed(){const p=this.points(),h=p.length,y=this.tension(),_=a(p[h-2],p[h-1],p[0],p[1],p[2],p[3],y),S=a(p[h-4],p[h-3],p[h-2],p[h-1],p[0],p[1],y),x=l(p,y);return[_[2],_[3]].concat(x).concat([S[0],S[1],p[h-2],p[h-1],S[2],S[3],_[0],_[1],p[0],p[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let p=this.points();if(p.length<4)return{x:p[0]||0,y:p[1]||0,width:0,height:0};this.tension()!==0?p=[p[0],p[1],...this._getTensionPoints(),p[p.length-2],p[p.length-1]]:p=this.points();let h=p[0],y=p[0],_=p[1],S=p[1],x,w;for(let C=0;C<p.length/2;C++)x=p[C*2],w=p[C*2+1],h=Math.min(h,x),y=Math.max(y,x),_=Math.min(_,w),S=Math.max(S,w);return{x:h,y:_,width:y-h,height:S-_}}}return cf.Line=u,u.prototype.className="Line",u.prototype._attrsAffectingSize=["points","bezier","tension"],(0,e._registerNode)(u),t.Factory.addGetterSetter(u,"closed",!1),t.Factory.addGetterSetter(u,"bezier",!1),t.Factory.addGetterSetter(u,"tension",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(u,"points",[],(0,s.getNumberArrayValidator)()),cf}var uf={},mm={},e_;function Q6(){return e_||(e_=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.t2length=t.getQuadraticArcLength=t.getCubicArcLength=t.binomialCoefficients=t.cValues=t.tValues=void 0,t.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],t.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],t.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const e=(u,d,p)=>{let h,y;const S=p/2;h=0;for(let x=0;x<20;x++)y=S*t.tValues[20][x]+S,h+=t.cValues[20][x]*s(u,d,y);return S*h};t.getCubicArcLength=e;const n=(u,d,p)=>{p===void 0&&(p=1);const h=u[0]-2*u[1]+u[2],y=d[0]-2*d[1]+d[2],_=2*u[1]-2*u[0],S=2*d[1]-2*d[0],x=4*(h*h+y*y),w=4*(h*_+y*S),C=_*_+S*S;if(x===0)return p*Math.sqrt(Math.pow(u[2]-u[0],2)+Math.pow(d[2]-d[0],2));const D=w/(2*x),U=C/x,M=p+D,E=U-D*D,L=M*M+E>0?Math.sqrt(M*M+E):0,R=D*D+E>0?Math.sqrt(D*D+E):0,z=D+Math.sqrt(D*D+E)!==0?E*Math.log(Math.abs((M+L)/(D+R))):0;return Math.sqrt(x)/2*(M*L-D*R+z)};t.getQuadraticArcLength=n;function s(u,d,p){const h=a(1,p,u),y=a(1,p,d),_=h*h+y*y;return Math.sqrt(_)}const a=(u,d,p)=>{const h=p.length-1;let y,_;if(h===0)return 0;if(u===0){_=0;for(let S=0;S<=h;S++)_+=t.binomialCoefficients[h][S]*Math.pow(1-d,h-S)*Math.pow(d,S)*p[S];return _}else{y=new Array(h);for(let S=0;S<h;S++)y[S]=h*(p[S+1]-p[S]);return a(u-1,d,y)}},l=(u,d,p)=>{let h=1,y=u/d,_=(u-p(y))/d,S=0;for(;h>.001;){const x=p(y+_),w=Math.abs(u-x)/d;if(w<h)h=w,y+=_;else{const C=p(y-_),D=Math.abs(u-C)/d;D<h?(h=D,y-=_):_/=2}if(S++,S>500)break}return y};t.t2length=l})(mm)),mm}var t_;function vm(){if(t_)return uf;t_=1,Object.defineProperty(uf,"__esModule",{value:!0}),uf.Path=void 0;const t=Qt(),e=Vt(),n=Lr(),s=Q6();class a extends n.Shape{constructor(u){super(u),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=a.parsePathData(this.data()),this.pathLength=a.getPathLength(this.dataArray)}_sceneFunc(u){const d=this.dataArray;u.beginPath();let p=!1;for(let h=0;h<d.length;h++){const y=d[h].command,_=d[h].points;switch(y){case"L":u.lineTo(_[0],_[1]);break;case"M":u.moveTo(_[0],_[1]);break;case"C":u.bezierCurveTo(_[0],_[1],_[2],_[3],_[4],_[5]);break;case"Q":u.quadraticCurveTo(_[0],_[1],_[2],_[3]);break;case"A":const S=_[0],x=_[1],w=_[2],C=_[3],D=_[4],U=_[5],M=_[6],E=_[7],L=w>C?w:C,R=w>C?1:w/C,z=w>C?C/w:1;u.translate(S,x),u.rotate(M),u.scale(R,z),u.arc(0,0,L,D,D+U,1-E),u.scale(1/R,1/z),u.rotate(-M),u.translate(-S,-x);break;case"z":p=!0,u.closePath();break}}!p&&!this.hasFill()?u.strokeShape(this):u.fillStrokeShape(this)}getSelfRect(){let u=[];this.dataArray.forEach(function(x){if(x.command==="A"){const w=x.points[4],C=x.points[5],D=x.points[4]+C;let U=Math.PI/180;if(Math.abs(w-D)<U&&(U=Math.abs(w-D)),C<0)for(let M=w-U;M>D;M-=U){const E=a.getPointOnEllipticalArc(x.points[0],x.points[1],x.points[2],x.points[3],M,0);u.push(E.x,E.y)}else for(let M=w+U;M<D;M+=U){const E=a.getPointOnEllipticalArc(x.points[0],x.points[1],x.points[2],x.points[3],M,0);u.push(E.x,E.y)}}else if(x.command==="C")for(let w=0;w<=1;w+=.01){const C=a.getPointOnCubicBezier(w,x.start.x,x.start.y,x.points[0],x.points[1],x.points[2],x.points[3],x.points[4],x.points[5]);u.push(C.x,C.y)}else u=u.concat(x.points)});let d=u[0],p=u[0],h=u[1],y=u[1],_,S;for(let x=0;x<u.length/2;x++)_=u[x*2],S=u[x*2+1],isNaN(_)||(d=Math.min(d,_),p=Math.max(p,_)),isNaN(S)||(h=Math.min(h,S),y=Math.max(y,S));return{x:d,y:h,width:p-d,height:y-h}}getLength(){return this.pathLength}getPointAtLength(u){return a.getPointAtLengthOfDataArray(u,this.dataArray)}static getLineLength(u,d,p,h){return Math.sqrt((p-u)*(p-u)+(h-d)*(h-d))}static getPathLength(u){let d=0;for(let p=0;p<u.length;++p)d+=u[p].pathLength;return d}static getPointAtLengthOfDataArray(u,d){let p,h=0,y=d.length;if(!y)return null;for(;h<y&&u>d[h].pathLength;)u-=d[h].pathLength,++h;if(h===y)return p=d[h-1].points.slice(-2),{x:p[0],y:p[1]};if(u<.01)return d[h].command==="M"?(p=d[h].points.slice(0,2),{x:p[0],y:p[1]}):{x:d[h].start.x,y:d[h].start.y};const _=d[h],S=_.points;switch(_.command){case"L":return a.getPointOnLine(u,_.start.x,_.start.y,S[0],S[1]);case"C":return a.getPointOnCubicBezier((0,s.t2length)(u,a.getPathLength(d),L=>(0,s.getCubicArcLength)([_.start.x,S[0],S[2],S[4]],[_.start.y,S[1],S[3],S[5]],L)),_.start.x,_.start.y,S[0],S[1],S[2],S[3],S[4],S[5]);case"Q":return a.getPointOnQuadraticBezier((0,s.t2length)(u,a.getPathLength(d),L=>(0,s.getQuadraticArcLength)([_.start.x,S[0],S[2]],[_.start.y,S[1],S[3]],L)),_.start.x,_.start.y,S[0],S[1],S[2],S[3]);case"A":const x=S[0],w=S[1],C=S[2],D=S[3],U=S[5],M=S[6];let E=S[4];return E+=U*u/_.pathLength,a.getPointOnEllipticalArc(x,w,C,D,E,M)}return null}static getPointOnLine(u,d,p,h,y,_,S){_=_??d,S=S??p;const x=this.getLineLength(d,p,h,y);if(x<1e-10)return{x:d,y:p};if(h===d)return{x:_,y:S+(y>p?u:-u)};const w=(y-p)/(h-d),C=Math.sqrt(u*u/(1+w*w))*(h<d?-1:1),D=w*C;if(Math.abs(S-p-w*(_-d))<1e-10)return{x:_+C,y:S+D};const U=((_-d)*(h-d)+(S-p)*(y-p))/(x*x),M=d+U*(h-d),E=p+U*(y-p),L=this.getLineLength(_,S,M,E),R=Math.sqrt(u*u-L*L),z=Math.sqrt(R*R/(1+w*w))*(h<d?-1:1),ee=w*z;return{x:M+z,y:E+ee}}static getPointOnCubicBezier(u,d,p,h,y,_,S,x,w){function C(R){return R*R*R}function D(R){return 3*R*R*(1-R)}function U(R){return 3*R*(1-R)*(1-R)}function M(R){return(1-R)*(1-R)*(1-R)}const E=x*C(u)+_*D(u)+h*U(u)+d*M(u),L=w*C(u)+S*D(u)+y*U(u)+p*M(u);return{x:E,y:L}}static getPointOnQuadraticBezier(u,d,p,h,y,_,S){function x(M){return M*M}function w(M){return 2*M*(1-M)}function C(M){return(1-M)*(1-M)}const D=_*x(u)+h*w(u)+d*C(u),U=S*x(u)+y*w(u)+p*C(u);return{x:D,y:U}}static getPointOnEllipticalArc(u,d,p,h,y,_){const S=Math.cos(_),x=Math.sin(_),w={x:p*Math.cos(y),y:h*Math.sin(y)};return{x:u+(w.x*S-w.y*x),y:d+(w.x*x+w.y*S)}}static parsePathData(u){if(!u)return[];let d=u;const p=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];d=d.replace(new RegExp(" ","g"),",");for(let D=0;D<p.length;D++)d=d.replace(new RegExp(p[D],"g"),"|"+p[D]);const h=d.split("|"),y=[],_=[];let S=0,x=0;const w=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let C;for(let D=1;D<h.length;D++){let U=h[D],M=U.charAt(0);for(U=U.slice(1),_.length=0;C=w.exec(U);)_.push(C[0]);const E=[];for(let L=0,R=_.length;L<R;L++){if(_[L]==="00"){E.push(0,0);continue}const z=parseFloat(_[L]);isNaN(z)?E.push(0):E.push(z)}for(;E.length>0&&!isNaN(E[0]);){let L="",R=[];const z=S,ee=x;let O,I,F,V,W,j,Y,X,ne,A;switch(M){case"l":S+=E.shift(),x+=E.shift(),L="L",R.push(S,x);break;case"L":S=E.shift(),x=E.shift(),R.push(S,x);break;case"m":const B=E.shift(),Q=E.shift();if(S+=B,x+=Q,L="M",y.length>2&&y[y.length-1].command==="z"){for(let H=y.length-2;H>=0;H--)if(y[H].command==="M"){S=y[H].points[0]+B,x=y[H].points[1]+Q;break}}R.push(S,x),M="l";break;case"M":S=E.shift(),x=E.shift(),L="M",R.push(S,x),M="L";break;case"h":S+=E.shift(),L="L",R.push(S,x);break;case"H":S=E.shift(),L="L",R.push(S,x);break;case"v":x+=E.shift(),L="L",R.push(S,x);break;case"V":x=E.shift(),L="L",R.push(S,x);break;case"C":R.push(E.shift(),E.shift(),E.shift(),E.shift()),S=E.shift(),x=E.shift(),R.push(S,x);break;case"c":R.push(S+E.shift(),x+E.shift(),S+E.shift(),x+E.shift()),S+=E.shift(),x+=E.shift(),L="C",R.push(S,x);break;case"S":I=S,F=x,O=y[y.length-1],O.command==="C"&&(I=S+(S-O.points[2]),F=x+(x-O.points[3])),R.push(I,F,E.shift(),E.shift()),S=E.shift(),x=E.shift(),L="C",R.push(S,x);break;case"s":I=S,F=x,O=y[y.length-1],O.command==="C"&&(I=S+(S-O.points[2]),F=x+(x-O.points[3])),R.push(I,F,S+E.shift(),x+E.shift()),S+=E.shift(),x+=E.shift(),L="C",R.push(S,x);break;case"Q":R.push(E.shift(),E.shift()),S=E.shift(),x=E.shift(),R.push(S,x);break;case"q":R.push(S+E.shift(),x+E.shift()),S+=E.shift(),x+=E.shift(),L="Q",R.push(S,x);break;case"T":I=S,F=x,O=y[y.length-1],O.command==="Q"&&(I=S+(S-O.points[0]),F=x+(x-O.points[1])),S=E.shift(),x=E.shift(),L="Q",R.push(I,F,S,x);break;case"t":I=S,F=x,O=y[y.length-1],O.command==="Q"&&(I=S+(S-O.points[0]),F=x+(x-O.points[1])),S+=E.shift(),x+=E.shift(),L="Q",R.push(I,F,S,x);break;case"A":V=E.shift(),W=E.shift(),j=E.shift(),Y=E.shift(),X=E.shift(),ne=S,A=x,S=E.shift(),x=E.shift(),L="A",R=this.convertEndpointToCenterParameterization(ne,A,S,x,Y,X,V,W,j);break;case"a":V=E.shift(),W=E.shift(),j=E.shift(),Y=E.shift(),X=E.shift(),ne=S,A=x,S+=E.shift(),x+=E.shift(),L="A",R=this.convertEndpointToCenterParameterization(ne,A,S,x,Y,X,V,W,j);break}y.push({command:L||M,points:R,start:{x:z,y:ee},pathLength:this.calcLength(z,ee,L||M,R)})}(M==="z"||M==="Z")&&y.push({command:"z",points:[],start:void 0,pathLength:0})}return y}static calcLength(u,d,p,h){let y,_,S,x;const w=a;switch(p){case"L":return w.getLineLength(u,d,h[0],h[1]);case"C":return(0,s.getCubicArcLength)([u,h[0],h[2],h[4]],[d,h[1],h[3],h[5]],1);case"Q":return(0,s.getQuadraticArcLength)([u,h[0],h[2]],[d,h[1],h[3]],1);case"A":y=0;const C=h[4],D=h[5],U=h[4]+D;let M=Math.PI/180;if(Math.abs(C-U)<M&&(M=Math.abs(C-U)),_=w.getPointOnEllipticalArc(h[0],h[1],h[2],h[3],C,0),D<0)for(x=C-M;x>U;x-=M)S=w.getPointOnEllipticalArc(h[0],h[1],h[2],h[3],x,0),y+=w.getLineLength(_.x,_.y,S.x,S.y),_=S;else for(x=C+M;x<U;x+=M)S=w.getPointOnEllipticalArc(h[0],h[1],h[2],h[3],x,0),y+=w.getLineLength(_.x,_.y,S.x,S.y),_=S;return S=w.getPointOnEllipticalArc(h[0],h[1],h[2],h[3],U,0),y+=w.getLineLength(_.x,_.y,S.x,S.y),y}return 0}static convertEndpointToCenterParameterization(u,d,p,h,y,_,S,x,w){const C=w*(Math.PI/180),D=Math.cos(C)*(u-p)/2+Math.sin(C)*(d-h)/2,U=-1*Math.sin(C)*(u-p)/2+Math.cos(C)*(d-h)/2,M=D*D/(S*S)+U*U/(x*x);M>1&&(S*=Math.sqrt(M),x*=Math.sqrt(M));let E=Math.sqrt((S*S*(x*x)-S*S*(U*U)-x*x*(D*D))/(S*S*(U*U)+x*x*(D*D)));y===_&&(E*=-1),isNaN(E)&&(E=0);const L=E*S*U/x,R=E*-x*D/S,z=(u+p)/2+Math.cos(C)*L-Math.sin(C)*R,ee=(d+h)/2+Math.sin(C)*L+Math.cos(C)*R,O=function(X){return Math.sqrt(X[0]*X[0]+X[1]*X[1])},I=function(X,ne){return(X[0]*ne[0]+X[1]*ne[1])/(O(X)*O(ne))},F=function(X,ne){return(X[0]*ne[1]<X[1]*ne[0]?-1:1)*Math.acos(I(X,ne))},V=F([1,0],[(D-L)/S,(U-R)/x]),W=[(D-L)/S,(U-R)/x],j=[(-1*D-L)/S,(-1*U-R)/x];let Y=F(W,j);return I(W,j)<=-1&&(Y=Math.PI),I(W,j)>=1&&(Y=0),_===0&&Y>0&&(Y=Y-2*Math.PI),_===1&&Y<0&&(Y=Y+2*Math.PI),[z,ee,S,x,V,Y,C,_]}}return uf.Path=a,a.prototype.className="Path",a.prototype._attrsAffectingSize=["data"],(0,e._registerNode)(a),t.Factory.addGetterSetter(a,"data"),uf}var n_;function J6(){if(n_)return lf;n_=1,Object.defineProperty(lf,"__esModule",{value:!0}),lf.Arrow=void 0;const t=Qt(),e=$S(),n=Zt(),s=Vt(),a=vm();let l=class extends e.Line{_sceneFunc(d){super._sceneFunc(d);const p=Math.PI*2,h=this.points();let y=h;const _=this.tension()!==0&&h.length>4;_&&(y=this.getTensionPoints());const S=this.pointerLength(),x=h.length;let w,C;if(_){const M=[y[y.length-4],y[y.length-3],y[y.length-2],y[y.length-1],h[x-2],h[x-1]],E=a.Path.calcLength(y[y.length-4],y[y.length-3],"C",M),L=a.Path.getPointOnQuadraticBezier(Math.min(1,1-S/E),M[0],M[1],M[2],M[3],M[4],M[5]);w=h[x-2]-L.x,C=h[x-1]-L.y}else w=h[x-2]-h[x-4],C=h[x-1]-h[x-3];const D=(Math.atan2(C,w)+p)%p,U=this.pointerWidth();this.pointerAtEnding()&&(d.save(),d.beginPath(),d.translate(h[x-2],h[x-1]),d.rotate(D),d.moveTo(0,0),d.lineTo(-S,U/2),d.lineTo(-S,-U/2),d.closePath(),d.restore(),this.__fillStroke(d)),this.pointerAtBeginning()&&(d.save(),d.beginPath(),d.translate(h[0],h[1]),_?(w=(y[0]+y[2])/2-h[0],C=(y[1]+y[3])/2-h[1]):(w=h[2]-h[0],C=h[3]-h[1]),d.rotate((Math.atan2(-C,-w)+p)%p),d.moveTo(0,0),d.lineTo(-S,U/2),d.lineTo(-S,-U/2),d.closePath(),d.restore(),this.__fillStroke(d))}__fillStroke(d){const p=this.dashEnabled();p&&(this.attrs.dashEnabled=!1,d.setLineDash([])),d.fillStrokeShape(this),p&&(this.attrs.dashEnabled=!0)}getSelfRect(){const d=super.getSelfRect(),p=this.pointerWidth()/2;return{x:d.x,y:d.y-p,width:d.width,height:d.height+p*2}}};return lf.Arrow=l,l.prototype.className="Arrow",(0,s._registerNode)(l),t.Factory.addGetterSetter(l,"pointerLength",10,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(l,"pointerWidth",10,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(l,"pointerAtBeginning",!1),t.Factory.addGetterSetter(l,"pointerAtEnding",!0),lf}var df={},r_;function Z6(){if(r_)return df;r_=1,Object.defineProperty(df,"__esModule",{value:!0}),df.Circle=void 0;const t=Qt(),e=Lr(),n=Zt(),s=Vt();class a extends e.Shape{_sceneFunc(u){u.beginPath(),u.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),u.closePath(),u.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(u){this.radius()!==u/2&&this.radius(u/2)}setHeight(u){this.radius()!==u/2&&this.radius(u/2)}}return df.Circle=a,a.prototype._centroid=!0,a.prototype.className="Circle",a.prototype._attrsAffectingSize=["radius"],(0,s._registerNode)(a),t.Factory.addGetterSetter(a,"radius",0,(0,n.getNumberValidator)()),df}var ff={},i_;function $6(){if(i_)return ff;i_=1,Object.defineProperty(ff,"__esModule",{value:!0}),ff.Ellipse=void 0;const t=Qt(),e=Lr(),n=Zt(),s=Vt();class a extends e.Shape{_sceneFunc(u){const d=this.radiusX(),p=this.radiusY();u.beginPath(),u.save(),d!==p&&u.scale(1,p/d),u.arc(0,0,d,0,Math.PI*2,!1),u.restore(),u.closePath(),u.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(u){this.radiusX(u/2)}setHeight(u){this.radiusY(u/2)}}return ff.Ellipse=a,a.prototype.className="Ellipse",a.prototype._centroid=!0,a.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,s._registerNode)(a),t.Factory.addComponentsGetterSetter(a,"radius",["x","y"]),t.Factory.addGetterSetter(a,"radiusX",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(a,"radiusY",0,(0,n.getNumberValidator)()),ff}var hf={},s_;function e8(){if(s_)return hf;s_=1,Object.defineProperty(hf,"__esModule",{value:!0}),hf.Image=void 0;const t=Hn(),e=Qt(),n=Lr(),s=Vt(),a=Zt();class l extends n.Shape{constructor(d){super(d),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",p=>{this._removeImageLoad(p.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const d=this.image();d&&d.complete||d&&d.readyState===4||d&&d.addEventListener&&d.addEventListener("load",this._loadListener)}_removeImageLoad(d){d&&d.removeEventListener&&d.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const d=!!this.cornerRadius(),p=this.hasShadow();return d&&p?!0:super._useBufferCanvas(!0)}_sceneFunc(d){const p=this.getWidth(),h=this.getHeight(),y=this.cornerRadius(),_=this.attrs.image;let S;if(_){const x=this.attrs.cropWidth,w=this.attrs.cropHeight;x&&w?S=[_,this.cropX(),this.cropY(),x,w,0,0,p,h]:S=[_,0,0,p,h]}(this.hasFill()||this.hasStroke()||y)&&(d.beginPath(),y?t.Util.drawRoundedRectPath(d,p,h,y):d.rect(0,0,p,h),d.closePath(),d.fillStrokeShape(this)),_&&(y&&d.clip(),d.drawImage.apply(d,S))}_hitFunc(d){const p=this.width(),h=this.height(),y=this.cornerRadius();d.beginPath(),y?t.Util.drawRoundedRectPath(d,p,h,y):d.rect(0,0,p,h),d.closePath(),d.fillStrokeShape(this)}getWidth(){var d,p;return(d=this.attrs.width)!==null&&d!==void 0?d:(p=this.image())===null||p===void 0?void 0:p.width}getHeight(){var d,p;return(d=this.attrs.height)!==null&&d!==void 0?d:(p=this.image())===null||p===void 0?void 0:p.height}static fromURL(d,p,h=null){const y=t.Util.createImageElement();y.onload=function(){const _=new l({image:y});p(_)},y.onerror=h,y.crossOrigin="Anonymous",y.src=d}}return hf.Image=l,l.prototype.className="Image",(0,s._registerNode)(l),e.Factory.addGetterSetter(l,"cornerRadius",0,(0,a.getNumberOrArrayOfNumbersValidator)(4)),e.Factory.addGetterSetter(l,"image"),e.Factory.addComponentsGetterSetter(l,"crop",["x","y","width","height"]),e.Factory.addGetterSetter(l,"cropX",0,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(l,"cropY",0,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(l,"cropWidth",0,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(l,"cropHeight",0,(0,a.getNumberValidator)()),hf}var ql={},a_;function t8(){if(a_)return ql;a_=1,Object.defineProperty(ql,"__esModule",{value:!0}),ql.Tag=ql.Label=void 0;const t=Qt(),e=Lr(),n=hm(),s=Zt(),a=Vt(),l=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],u="Change.konva",d="none",p="up",h="right",y="down",_="left",S=l.length;let x=class extends n.Group{constructor(D){super(D),this.on("add.konva",function(U){this._addListeners(U.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(D){let U=this,M;const E=function(){U._sync()};for(M=0;M<S;M++)D.on(l[M]+u,E)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let D=this.getText(),U=this.getTag(),M,E,L,R,z,ee,O;if(D&&U){switch(M=D.width(),E=D.height(),L=U.pointerDirection(),R=U.pointerWidth(),O=U.pointerHeight(),z=0,ee=0,L){case p:z=M/2,ee=-1*O;break;case h:z=M+R,ee=E/2;break;case y:z=M/2,ee=E+O;break;case _:z=-1*R,ee=E/2;break}U.setAttrs({x:-1*z,y:-1*ee,width:M,height:E}),D.setAttrs({x:-1*z,y:-1*ee})}}};ql.Label=x,x.prototype.className="Label",(0,a._registerNode)(x);class w extends e.Shape{_sceneFunc(D){const U=this.width(),M=this.height(),E=this.pointerDirection(),L=this.pointerWidth(),R=this.pointerHeight(),z=this.cornerRadius();let ee=0,O=0,I=0,F=0;typeof z=="number"?ee=O=I=F=Math.min(z,U/2,M/2):(ee=Math.min(z[0]||0,U/2,M/2),O=Math.min(z[1]||0,U/2,M/2),F=Math.min(z[2]||0,U/2,M/2),I=Math.min(z[3]||0,U/2,M/2)),D.beginPath(),D.moveTo(ee,0),E===p&&(D.lineTo((U-L)/2,0),D.lineTo(U/2,-1*R),D.lineTo((U+L)/2,0)),D.lineTo(U-O,0),D.arc(U-O,O,O,Math.PI*3/2,0,!1),E===h&&(D.lineTo(U,(M-R)/2),D.lineTo(U+L,M/2),D.lineTo(U,(M+R)/2)),D.lineTo(U,M-F),D.arc(U-F,M-F,F,0,Math.PI/2,!1),E===y&&(D.lineTo((U+L)/2,M),D.lineTo(U/2,M+R),D.lineTo((U-L)/2,M)),D.lineTo(I,M),D.arc(I,M-I,I,Math.PI/2,Math.PI,!1),E===_&&(D.lineTo(0,(M+R)/2),D.lineTo(-1*L,M/2),D.lineTo(0,(M-R)/2)),D.lineTo(0,ee),D.arc(ee,ee,ee,Math.PI,Math.PI*3/2,!1),D.closePath(),D.fillStrokeShape(this)}getSelfRect(){let D=0,U=0,M=this.pointerWidth(),E=this.pointerHeight(),L=this.pointerDirection(),R=this.width(),z=this.height();return L===p?(U-=E,z+=E):L===y?z+=E:L===_?(D-=M*1.5,R+=M):L===h&&(R+=M*1.5),{x:D,y:U,width:R,height:z}}}return ql.Tag=w,w.prototype.className="Tag",(0,a._registerNode)(w),t.Factory.addGetterSetter(w,"pointerDirection",d),t.Factory.addGetterSetter(w,"pointerWidth",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(w,"pointerHeight",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(w,"cornerRadius",0,(0,s.getNumberOrArrayOfNumbersValidator)(4)),ql}var pf={},o_;function l_(){if(o_)return pf;o_=1,Object.defineProperty(pf,"__esModule",{value:!0}),pf.Rect=void 0;const t=Qt(),e=Lr(),n=Vt(),s=Hn(),a=Zt();class l extends e.Shape{_sceneFunc(d){const p=this.cornerRadius(),h=this.width(),y=this.height();d.beginPath(),p?s.Util.drawRoundedRectPath(d,h,y,p):d.rect(0,0,h,y),d.closePath(),d.fillStrokeShape(this)}}return pf.Rect=l,l.prototype.className="Rect",(0,n._registerNode)(l),t.Factory.addGetterSetter(l,"cornerRadius",0,(0,a.getNumberOrArrayOfNumbersValidator)(4)),pf}var gf={},c_;function n8(){if(c_)return gf;c_=1,Object.defineProperty(gf,"__esModule",{value:!0}),gf.RegularPolygon=void 0;const t=Qt(),e=Lr(),n=Zt(),s=Vt();let a=class extends e.Shape{_sceneFunc(u){const d=this._getPoints();u.beginPath(),u.moveTo(d[0].x,d[0].y);for(let p=1;p<d.length;p++)u.lineTo(d[p].x,d[p].y);u.closePath(),u.fillStrokeShape(this)}_getPoints(){const u=this.attrs.sides,d=this.attrs.radius||0,p=[];for(let h=0;h<u;h++)p.push({x:d*Math.sin(h*2*Math.PI/u),y:-1*d*Math.cos(h*2*Math.PI/u)});return p}getSelfRect(){const u=this._getPoints();let d=u[0].x,p=u[0].y,h=u[0].x,y=u[0].y;return u.forEach(_=>{d=Math.min(d,_.x),p=Math.max(p,_.x),h=Math.min(h,_.y),y=Math.max(y,_.y)}),{x:d,y:h,width:p-d,height:y-h}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(u){this.radius(u/2)}setHeight(u){this.radius(u/2)}};return gf.RegularPolygon=a,a.prototype.className="RegularPolygon",a.prototype._centroid=!0,a.prototype._attrsAffectingSize=["radius"],(0,s._registerNode)(a),t.Factory.addGetterSetter(a,"radius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(a,"sides",0,(0,n.getNumberValidator)()),gf}var yf={},u_;function r8(){if(u_)return yf;u_=1,Object.defineProperty(yf,"__esModule",{value:!0}),yf.Ring=void 0;const t=Qt(),e=Lr(),n=Zt(),s=Vt(),a=Math.PI*2;let l=class extends e.Shape{_sceneFunc(d){d.beginPath(),d.arc(0,0,this.innerRadius(),0,a,!1),d.moveTo(this.outerRadius(),0),d.arc(0,0,this.outerRadius(),a,0,!0),d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(d){this.outerRadius(d/2)}setHeight(d){this.outerRadius(d/2)}};return yf.Ring=l,l.prototype.className="Ring",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,s._registerNode)(l),t.Factory.addGetterSetter(l,"innerRadius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(l,"outerRadius",0,(0,n.getNumberValidator)()),yf}var mf={},d_;function i8(){if(d_)return mf;d_=1,Object.defineProperty(mf,"__esModule",{value:!0}),mf.Sprite=void 0;const t=Qt(),e=Lr(),n=pm(),s=Zt(),a=Vt();let l=class extends e.Shape{constructor(d){super(d),this._updated=!0,this.anim=new n.Animation(()=>{const p=this._updated;return this._updated=!1,p}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(d){const p=this.animation(),h=this.frameIndex(),y=h*4,_=this.animations()[p],S=this.frameOffsets(),x=_[y+0],w=_[y+1],C=_[y+2],D=_[y+3],U=this.image();if((this.hasFill()||this.hasStroke())&&(d.beginPath(),d.rect(0,0,C,D),d.closePath(),d.fillStrokeShape(this)),U)if(S){const M=S[p],E=h*2;d.drawImage(U,x,w,C,D,M[E+0],M[E+1],C,D)}else d.drawImage(U,x,w,C,D,0,0,C,D)}_hitFunc(d){const p=this.animation(),h=this.frameIndex(),y=h*4,_=this.animations()[p],S=this.frameOffsets(),x=_[y+2],w=_[y+3];if(d.beginPath(),S){const C=S[p],D=h*2;d.rect(C[D+0],C[D+1],x,w)}else d.rect(0,0,x,w);d.closePath(),d.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const d=this;this.interval=setInterval(function(){d._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const d=this.getLayer();this.anim.setLayers(d),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const d=this.frameIndex(),p=this.animation(),h=this.animations(),y=h[p],_=y.length/4;d<_-1?this.frameIndex(d+1):this.frameIndex(0)}};return mf.Sprite=l,l.prototype.className="Sprite",(0,a._registerNode)(l),t.Factory.addGetterSetter(l,"animation"),t.Factory.addGetterSetter(l,"animations"),t.Factory.addGetterSetter(l,"frameOffsets"),t.Factory.addGetterSetter(l,"image"),t.Factory.addGetterSetter(l,"frameIndex",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(l,"frameRate",17,(0,s.getNumberValidator)()),t.Factory.backCompat(l,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"}),mf}var vf={},f_;function s8(){if(f_)return vf;f_=1,Object.defineProperty(vf,"__esModule",{value:!0}),vf.Star=void 0;const t=Qt(),e=Lr(),n=Zt(),s=Vt();let a=class extends e.Shape{_sceneFunc(u){const d=this.innerRadius(),p=this.outerRadius(),h=this.numPoints();u.beginPath(),u.moveTo(0,0-p);for(let y=1;y<h*2;y++){const _=y%2===0?p:d,S=_*Math.sin(y*Math.PI/h),x=-1*_*Math.cos(y*Math.PI/h);u.lineTo(S,x)}u.closePath(),u.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(u){this.outerRadius(u/2)}setHeight(u){this.outerRadius(u/2)}};return vf.Star=a,a.prototype.className="Star",a.prototype._centroid=!0,a.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,s._registerNode)(a),t.Factory.addGetterSetter(a,"numPoints",5,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(a,"innerRadius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(a,"outerRadius",0,(0,n.getNumberValidator)()),vf}var eu={},h_;function p_(){if(h_)return eu;h_=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.Text=void 0,eu.stringToArray=u;const t=Hn(),e=Qt(),n=Lr(),s=Vt(),a=Zt(),l=Vt();function u(ae){return[...ae].reduce((ie,de,fe,se)=>{if(new RegExp("\\p{Emoji}","u").test(de)){const q=se[fe+1];q&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(q)?(ie.push(de+q),se[fe+1]=""):ie.push(de)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(de+(se[fe+1]||""))?ie.push(de+se[fe+1]):fe>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(de)?ie[ie.length-1]+=de:de&&ie.push(de);return ie},[])}const d="auto",p="center",h="inherit",y="justify",_="Change.konva",S="2d",x="-",w="left",C="text",D="Text",U="top",M="bottom",E="middle",L="normal",R="px ",z=" ",ee="right",O="rtl",I="word",F="char",V="none",W="…",j=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Y=j.length;function X(ae){return ae.split(",").map(ie=>{ie=ie.trim();const de=ie.indexOf(" ")>=0,fe=ie.indexOf('"')>=0||ie.indexOf("'")>=0;return de&&!fe&&(ie=`"${ie}"`),ie}).join(", ")}let ne;function A(){return ne||(ne=t.Util.createCanvasElement().getContext(S),ne)}function B(ae){ae.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Q(ae){ae.setAttr("miterLimit",2),ae.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function H(ae){return ae=ae||{},!ae.fillLinearGradientColorStops&&!ae.fillRadialGradientColorStops&&!ae.fillPatternImage&&(ae.fill=ae.fill||"black"),ae}class K extends n.Shape{constructor(ie){super(H(ie)),this._partialTextX=0,this._partialTextY=0;for(let de=0;de<Y;de++)this.on(j[de]+_,this._setTextData);this._setTextData()}_sceneFunc(ie){const de=this.textArr,fe=de.length;if(!this.text())return;let se=this.padding(),q=this.fontSize(),oe=this.lineHeight()*q,ye=this.verticalAlign(),ke=this.direction(),Ae=0,Me=this.align(),be=this.getWidth(),He=this.letterSpacing(),$e=this.fill(),Ct=this.textDecoration(),le=Ct.indexOf("underline")!==-1,Ee=Ct.indexOf("line-through")!==-1,yt;ke=ke===h?ie.direction:ke;let xt=oe/2,Et=E;if(s.Konva._fixTextRendering){const Pt=this.measureSize("M");Et="alphabetic",xt=(Pt.fontBoundingBoxAscent-Pt.fontBoundingBoxDescent)/2+oe/2}for(ke===O&&ie.setAttr("direction",ke),ie.setAttr("font",this._getContextFont()),ie.setAttr("textBaseline",Et),ie.setAttr("textAlign",w),ye===E?Ae=(this.getHeight()-fe*oe-se*2)/2:ye===M&&(Ae=this.getHeight()-fe*oe-se*2),ie.translate(se,Ae+se),yt=0;yt<fe;yt++){let Pt=0,On=0;const kn=de[yt],sr=kn.text,Ft=kn.width,Sn=kn.lastInParagraph;if(ie.save(),Me===ee?Pt+=be-Ft-se*2:Me===p&&(Pt+=(be-Ft-se*2)/2),le){ie.save(),ie.beginPath();const dn=s.Konva._fixTextRendering?Math.round(q/4):Math.round(q/2),mr=Pt,Ve=xt+On+dn;ie.moveTo(mr,Ve);const tt=Me===y&&!Sn?be-se*2:Ft;ie.lineTo(mr+Math.round(tt),Ve),ie.lineWidth=q/15;const St=this._getLinearGradient();ie.strokeStyle=St||$e,ie.stroke(),ie.restore()}if(Ee){ie.save(),ie.beginPath();const dn=s.Konva._fixTextRendering?-Math.round(q/4):0;ie.moveTo(Pt,xt+On+dn);const mr=Me===y&&!Sn?be-se*2:Ft;ie.lineTo(Pt+Math.round(mr),xt+On+dn),ie.lineWidth=q/15;const Ve=this._getLinearGradient();ie.strokeStyle=Ve||$e,ie.stroke(),ie.restore()}if(ke!==O&&(He!==0||Me===y)){const dn=sr.split(" ").length-1,mr=u(sr);for(let Ve=0;Ve<mr.length;Ve++){const tt=mr[Ve];tt===" "&&!Sn&&Me===y&&(Pt+=(be-se*2-Ft)/dn),this._partialTextX=Pt,this._partialTextY=xt+On,this._partialText=tt,ie.fillStrokeShape(this),Pt+=this.measureSize(tt).width+He}}else He!==0&&ie.setAttr("letterSpacing",`${He}px`),this._partialTextX=Pt,this._partialTextY=xt+On,this._partialText=sr,ie.fillStrokeShape(this);ie.restore(),fe>1&&(xt+=oe)}}_hitFunc(ie){const de=this.getWidth(),fe=this.getHeight();ie.beginPath(),ie.rect(0,0,de,fe),ie.closePath(),ie.fillStrokeShape(this)}setText(ie){const de=t.Util._isString(ie)?ie:ie==null?"":ie+"";return this._setAttr(C,de),this}getWidth(){return this.attrs.width===d||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===d||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return t.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(ie){var de,fe,se,q,oe,ye,ke,Ae,Me,be,He;let $e=A(),Ct=this.fontSize(),le;$e.save(),$e.font=this._getContextFont(),le=$e.measureText(ie),$e.restore();const Ee=Ct/100;return{actualBoundingBoxAscent:(de=le.actualBoundingBoxAscent)!==null&&de!==void 0?de:71.58203125*Ee,actualBoundingBoxDescent:(fe=le.actualBoundingBoxDescent)!==null&&fe!==void 0?fe:0,actualBoundingBoxLeft:(se=le.actualBoundingBoxLeft)!==null&&se!==void 0?se:-7.421875*Ee,actualBoundingBoxRight:(q=le.actualBoundingBoxRight)!==null&&q!==void 0?q:75.732421875*Ee,alphabeticBaseline:(oe=le.alphabeticBaseline)!==null&&oe!==void 0?oe:0,emHeightAscent:(ye=le.emHeightAscent)!==null&&ye!==void 0?ye:100*Ee,emHeightDescent:(ke=le.emHeightDescent)!==null&&ke!==void 0?ke:-20*Ee,fontBoundingBoxAscent:(Ae=le.fontBoundingBoxAscent)!==null&&Ae!==void 0?Ae:91*Ee,fontBoundingBoxDescent:(Me=le.fontBoundingBoxDescent)!==null&&Me!==void 0?Me:21*Ee,hangingBaseline:(be=le.hangingBaseline)!==null&&be!==void 0?be:72.80000305175781*Ee,ideographicBaseline:(He=le.ideographicBaseline)!==null&&He!==void 0?He:-21*Ee,width:le.width,height:Ct}}_getContextFont(){return this.fontStyle()+z+this.fontVariant()+z+(this.fontSize()+R)+X(this.fontFamily())}_addTextLine(ie){this.align()===y&&(ie=ie.trim());const fe=this._getTextWidth(ie);return this.textArr.push({text:ie,width:fe,lastInParagraph:!1})}_getTextWidth(ie){const de=this.letterSpacing(),fe=ie.length;return A().measureText(ie).width+de*fe}_setTextData(){let ie=this.text().split(`
|
|
2
|
+
`),de=+this.fontSize(),fe=0,se=this.lineHeight()*de,q=this.attrs.width,oe=this.attrs.height,ye=q!==d&&q!==void 0,ke=oe!==d&&oe!==void 0,Ae=this.padding(),Me=q-Ae*2,be=oe-Ae*2,He=0,$e=this.wrap(),Ct=$e!==V,le=$e!==F&&Ct,Ee=this.ellipsis();this.textArr=[],A().font=this._getContextFont();const yt=Ee?this._getTextWidth(W):0;for(let xt=0,Et=ie.length;xt<Et;++xt){let Pt=ie[xt],On=this._getTextWidth(Pt);if(ye&&On>Me)for(;Pt.length>0;){let kn=0,sr=u(Pt).length,Ft="",Sn=0;for(;kn<sr;){const dn=kn+sr>>>1,mr=u(Pt),Ve=mr.slice(0,dn+1).join(""),tt=this._getTextWidth(Ve);(Ee&&ke&&He+se>be?tt+yt:tt)<=Me?(kn=dn+1,Ft=Ve,Sn=tt):sr=dn}if(Ft){if(le){const Ve=u(Pt),tt=u(Ft),St=Ve[tt.length],dt=St===z||St===x;let gn;if(dt&&Sn<=Me)gn=tt.length;else{const Gn=tt.lastIndexOf(z),ct=tt.lastIndexOf(x);gn=Math.max(Gn,ct)+1}gn>0&&(kn=gn,Ft=Ve.slice(0,kn).join(""),Sn=this._getTextWidth(Ft))}if(Ft=Ft.trimRight(),this._addTextLine(Ft),fe=Math.max(fe,Sn),He+=se,this._shouldHandleEllipsis(He)){this._tryToAddEllipsisToLastLine();break}if(Pt=u(Pt).slice(kn).join("").trimLeft(),Pt.length>0&&(On=this._getTextWidth(Pt),On<=Me)){this._addTextLine(Pt),He+=se,fe=Math.max(fe,On);break}}else break}else this._addTextLine(Pt),He+=se,fe=Math.max(fe,On),this._shouldHandleEllipsis(He)&&xt<Et-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),ke&&He+se>be)break}this.textHeight=de,this.textWidth=fe}_shouldHandleEllipsis(ie){const de=+this.fontSize(),fe=this.lineHeight()*de,se=this.attrs.height,q=se!==d&&se!==void 0,oe=this.padding(),ye=se-oe*2;return!(this.wrap()!==V)||q&&ie+fe>ye}_tryToAddEllipsisToLastLine(){const ie=this.attrs.width,de=ie!==d&&ie!==void 0,fe=this.padding(),se=ie-fe*2,q=this.ellipsis(),oe=this.textArr[this.textArr.length-1];!oe||!q||(de&&(this._getTextWidth(oe.text+W)<se||(oe.text=oe.text.slice(0,oe.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(oe.text+W))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const ie=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,de=this.hasShadow();return ie&&de?!0:super._useBufferCanvas()}}return eu.Text=K,K.prototype._fillFunc=B,K.prototype._strokeFunc=Q,K.prototype.className=D,K.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,l._registerNode)(K),e.Factory.overWriteSetter(K,"width",(0,a.getNumberOrAutoValidator)()),e.Factory.overWriteSetter(K,"height",(0,a.getNumberOrAutoValidator)()),e.Factory.addGetterSetter(K,"direction",h),e.Factory.addGetterSetter(K,"fontFamily","Arial"),e.Factory.addGetterSetter(K,"fontSize",12,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(K,"fontStyle",L),e.Factory.addGetterSetter(K,"fontVariant",L),e.Factory.addGetterSetter(K,"padding",0,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(K,"align",w),e.Factory.addGetterSetter(K,"verticalAlign",U),e.Factory.addGetterSetter(K,"lineHeight",1,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(K,"wrap",I),e.Factory.addGetterSetter(K,"ellipsis",!1,(0,a.getBooleanValidator)()),e.Factory.addGetterSetter(K,"letterSpacing",0,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(K,"text","",(0,a.getStringValidator)()),e.Factory.addGetterSetter(K,"textDecoration",""),eu}var Sf={},g_;function a8(){if(g_)return Sf;g_=1,Object.defineProperty(Sf,"__esModule",{value:!0}),Sf.TextPath=void 0;const t=Hn(),e=Qt(),n=Lr(),s=vm(),a=p_(),l=Zt(),u=Vt(),d="",p="normal";function h(S){S.fillText(this.partialText,0,0)}function y(S){S.strokeText(this.partialText,0,0)}let _=class extends n.Shape{constructor(x){super(x),this.dummyCanvas=t.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return s.Path.getPathLength(this.dataArray)}_getPointAtLength(x){if(!this.attrs.data)return null;const w=this.pathLength;return x-1>w?null:s.Path.getPointAtLengthOfDataArray(x,this.dataArray)}_readDataAttribute(){this.dataArray=s.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(x){x.setAttr("font",this._getContextFont()),x.setAttr("textBaseline",this.textBaseline()),x.setAttr("textAlign","left"),x.save();const w=this.textDecoration(),C=this.fill(),D=this.fontSize(),U=this.glyphInfo;w==="underline"&&x.beginPath();for(let M=0;M<U.length;M++){x.save();const E=U[M].p0;x.translate(E.x,E.y),x.rotate(U[M].rotation),this.partialText=U[M].text,x.fillStrokeShape(this),w==="underline"&&(M===0&&x.moveTo(0,D/2+1),x.lineTo(D,D/2+1)),x.restore()}w==="underline"&&(x.strokeStyle=C,x.lineWidth=D/20,x.stroke()),x.restore()}_hitFunc(x){x.beginPath();const w=this.glyphInfo;if(w.length>=1){const C=w[0].p0;x.moveTo(C.x,C.y)}for(let C=0;C<w.length;C++){const D=w[C].p1;x.lineTo(D.x,D.y)}x.setAttr("lineWidth",this.fontSize()),x.setAttr("strokeStyle",this.colorKey),x.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return t.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(x){return a.Text.prototype.setText.call(this,x)}_getContextFont(){return a.Text.prototype._getContextFont.call(this)}_getTextSize(x){const C=this.dummyCanvas.getContext("2d");C.save(),C.font=this._getContextFont();const D=C.measureText(x);return C.restore(),{width:D.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:x,height:w}=this._getTextSize(this.attrs.text);if(this.textWidth=x,this.textHeight=w,this.glyphInfo=[],!this.attrs.data)return null;const C=this.letterSpacing(),D=this.align(),U=this.kerningFunc(),M=Math.max(this.textWidth+((this.attrs.text||"").length-1)*C,0);let E=0;D==="center"&&(E=Math.max(0,this.pathLength/2-M/2)),D==="right"&&(E=Math.max(0,this.pathLength-M));const L=(0,a.stringToArray)(this.text());let R=E;for(let z=0;z<L.length;z++){const ee=this._getPointAtLength(R);if(!ee)return;let O=this._getTextSize(L[z]).width+C;if(L[z]===" "&&D==="justify"){const Y=this.text().split(" ").length-1;O+=(this.pathLength-M)/Y}const I=this._getPointAtLength(R+O);if(!I)return;const F=s.Path.getLineLength(ee.x,ee.y,I.x,I.y);let V=0;if(U)try{V=U(L[z-1],L[z])*this.fontSize()}catch{V=0}ee.x+=V,I.x+=V,this.textWidth+=V;const W=s.Path.getPointOnLine(V+F/2,ee.x,ee.y,I.x,I.y),j=Math.atan2(I.y-ee.y,I.x-ee.x);this.glyphInfo.push({transposeX:W.x,transposeY:W.y,text:L[z],rotation:j,p0:ee,p1:I}),R+=O}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const x=[];this.glyphInfo.forEach(function(R){x.push(R.p0.x),x.push(R.p0.y),x.push(R.p1.x),x.push(R.p1.y)});let w=x[0]||0,C=x[0]||0,D=x[1]||0,U=x[1]||0,M,E;for(let R=0;R<x.length/2;R++)M=x[R*2],E=x[R*2+1],w=Math.min(w,M),C=Math.max(C,M),D=Math.min(D,E),U=Math.max(U,E);const L=this.fontSize();return{x:w-L/2,y:D-L/2,width:C-w+L,height:U-D+L}}destroy(){return t.Util.releaseCanvas(this.dummyCanvas),super.destroy()}};return Sf.TextPath=_,_.prototype._fillFunc=h,_.prototype._strokeFunc=y,_.prototype._fillFuncHit=h,_.prototype._strokeFuncHit=y,_.prototype.className="TextPath",_.prototype._attrsAffectingSize=["text","fontSize","data"],(0,u._registerNode)(_),e.Factory.addGetterSetter(_,"data"),e.Factory.addGetterSetter(_,"fontFamily","Arial"),e.Factory.addGetterSetter(_,"fontSize",12,(0,l.getNumberValidator)()),e.Factory.addGetterSetter(_,"fontStyle",p),e.Factory.addGetterSetter(_,"align","left"),e.Factory.addGetterSetter(_,"letterSpacing",0,(0,l.getNumberValidator)()),e.Factory.addGetterSetter(_,"textBaseline","middle"),e.Factory.addGetterSetter(_,"fontVariant",p),e.Factory.addGetterSetter(_,"text",d),e.Factory.addGetterSetter(_,"textDecoration",""),e.Factory.addGetterSetter(_,"kerningFunc",void 0),Sf}var _f={},y_;function o8(){if(y_)return _f;y_=1,Object.defineProperty(_f,"__esModule",{value:!0}),_f.Transformer=void 0;const t=Hn(),e=Qt(),n=Qn(),s=Lr(),a=l_(),l=hm(),u=Vt(),d=Zt(),p=Vt(),h="tr-konva",y=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(O=>O+`.${h}`).join(" "),_="nodesRect",S=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],x={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},w="ontouchstart"in u.Konva._global;function C(O,I,F){if(O==="rotater")return F;I+=t.Util.degToRad(x[O]||0);const V=(t.Util.radToDeg(I)%360+360)%360;return t.Util._inRange(V,315+22.5,360)||t.Util._inRange(V,0,22.5)?"ns-resize":t.Util._inRange(V,45-22.5,45+22.5)?"nesw-resize":t.Util._inRange(V,90-22.5,90+22.5)?"ew-resize":t.Util._inRange(V,135-22.5,135+22.5)?"nwse-resize":t.Util._inRange(V,180-22.5,180+22.5)?"ns-resize":t.Util._inRange(V,225-22.5,225+22.5)?"nesw-resize":t.Util._inRange(V,270-22.5,270+22.5)?"ew-resize":t.Util._inRange(V,315-22.5,315+22.5)?"nwse-resize":(t.Util.error("Transformer has unknown angle for cursor detection: "+V),"pointer")}const D=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function U(O){return{x:O.x+O.width/2*Math.cos(O.rotation)+O.height/2*Math.sin(-O.rotation),y:O.y+O.height/2*Math.cos(O.rotation)+O.width/2*Math.sin(O.rotation)}}function M(O,I,F){const V=F.x+(O.x-F.x)*Math.cos(I)-(O.y-F.y)*Math.sin(I),W=F.y+(O.x-F.x)*Math.sin(I)+(O.y-F.y)*Math.cos(I);return{...O,rotation:O.rotation+I,x:V,y:W}}function E(O,I){const F=U(O);return M(O,I,F)}function L(O,I,F){let V=I;for(let W=0;W<O.length;W++){const j=u.Konva.getAngle(O[W]),Y=Math.abs(j-I)%(Math.PI*2);Math.min(Y,Math.PI*2-Y)<F&&(V=j)}return V}let R=0;class z extends l.Group{constructor(I){super(I),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(y,this.update),this.getNode()&&this.update()}attachTo(I){return this.setNode(I),this}setNode(I){return t.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([I])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return h+this._id}setNodes(I=[]){this._nodes&&this._nodes.length&&this.detach();const F=I.filter(W=>W.isAncestorOf(this)?(t.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=I=F,I.length===1&&this.useSingleNodeRotation()?this.rotation(I[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(W=>{const j=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(W._attrsAffectingSize.length){const Y=W._attrsAffectingSize.map(X=>X+"Change."+this._getEventNamespace()).join(" ");W.on(Y,j)}W.on(S.map(Y=>Y+`.${this._getEventNamespace()}`).join(" "),j),W.on(`absoluteTransformChange.${this._getEventNamespace()}`,j),this._proxyDrag(W)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(I){let F;I.on(`dragstart.${this._getEventNamespace()}`,V=>{F=I.getAbsolutePosition(),!this.isDragging()&&I!==this.findOne(".back")&&this.startDrag(V,!1)}),I.on(`dragmove.${this._getEventNamespace()}`,V=>{if(!F)return;const W=I.getAbsolutePosition(),j=W.x-F.x,Y=W.y-F.y;this.nodes().forEach(X=>{if(X===I||X.isDragging())return;const ne=X.getAbsolutePosition();X.setAbsolutePosition({x:ne.x+j,y:ne.y+Y}),X.startDrag(V)}),F=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(I=>{I.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(_),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(_,this.__getNodeRect)}__getNodeShape(I,F=this.rotation(),V){const W=I.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),j=I.getAbsoluteScale(V),Y=I.getAbsolutePosition(V),X=W.x*j.x-I.offsetX()*j.x,ne=W.y*j.y-I.offsetY()*j.y,A=(u.Konva.getAngle(I.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),B={x:Y.x+X*Math.cos(A)+ne*Math.sin(-A),y:Y.y+ne*Math.cos(A)+X*Math.sin(A),width:W.width*j.x,height:W.height*j.y,rotation:A};return M(B,-u.Konva.getAngle(F),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const F=[];this.nodes().map(A=>{const B=A.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),Q=[{x:B.x,y:B.y},{x:B.x+B.width,y:B.y},{x:B.x+B.width,y:B.y+B.height},{x:B.x,y:B.y+B.height}],H=A.getAbsoluteTransform();Q.forEach(function(K){const ae=H.point(K);F.push(ae)})});const V=new t.Transform;V.rotate(-u.Konva.getAngle(this.rotation()));let W=1/0,j=1/0,Y=-1/0,X=-1/0;F.forEach(function(A){const B=V.point(A);W===void 0&&(W=Y=B.x,j=X=B.y),W=Math.min(W,B.x),j=Math.min(j,B.y),Y=Math.max(Y,B.x),X=Math.max(X,B.y)}),V.invert();const ne=V.point({x:W,y:j});return{x:ne.x,y:ne.y,width:Y-W,height:X-j,rotation:u.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),D.forEach(I=>{this._createAnchor(I)}),this._createAnchor("rotater")}_createAnchor(I){const F=new a.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:I+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:w?10:"auto"}),V=this;F.on("mousedown touchstart",function(W){V._handleMouseDown(W)}),F.on("dragstart",W=>{F.stopDrag(),W.cancelBubble=!0}),F.on("dragend",W=>{W.cancelBubble=!0}),F.on("mouseenter",()=>{const W=u.Konva.getAngle(this.rotation()),j=this.rotateAnchorCursor(),Y=C(I,W,j);F.getStage().content&&(F.getStage().content.style.cursor=Y),this._cursorChange=!0}),F.on("mouseout",()=>{F.getStage().content&&(F.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(F)}_createBack(){const I=new s.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(F,V){const W=V.getParent(),j=W.padding();F.beginPath(),F.rect(-j,-j,V.width()+j*2,V.height()+j*2),F.moveTo(V.width()/2,-j),W.rotateEnabled()&&W.rotateLineVisible()&&F.lineTo(V.width()/2,-W.rotateAnchorOffset()*t.Util._sign(V.height())-j),F.fillStrokeShape(V)},hitFunc:(F,V)=>{if(!this.shouldOverdrawWholeArea())return;const W=this.padding();F.beginPath(),F.rect(-W,-W,V.width()+W*2,V.height()+W*2),F.fillStrokeShape(V)}});this.add(I),this._proxyDrag(I),I.on("dragstart",F=>{F.cancelBubble=!0}),I.on("dragmove",F=>{F.cancelBubble=!0}),I.on("dragend",F=>{F.cancelBubble=!0}),this.on("dragmove",F=>{this.update()})}_handleMouseDown(I){if(this._transforming)return;this._movingAnchorName=I.target.name().split(" ")[0];const F=this._getNodeRect(),V=F.width,W=F.height,j=Math.sqrt(Math.pow(V,2)+Math.pow(W,2));this.sin=Math.abs(W/j),this.cos=Math.abs(V/j),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const Y=I.target.getAbsolutePosition(),X=I.target.getStage().getPointerPosition();this._anchorDragOffset={x:X.x-Y.x,y:X.y-Y.y},R++,this._fire("transformstart",{evt:I.evt,target:this.getNode()}),this._nodes.forEach(ne=>{ne._fire("transformstart",{evt:I.evt,target:ne})})}_handleMouseMove(I){let F,V,W;const j=this.findOne("."+this._movingAnchorName),Y=j.getStage();Y.setPointersPositions(I);const X=Y.getPointerPosition();let ne={x:X.x-this._anchorDragOffset.x,y:X.y-this._anchorDragOffset.y};const A=j.getAbsolutePosition();this.anchorDragBoundFunc()&&(ne=this.anchorDragBoundFunc()(A,ne,I)),j.setAbsolutePosition(ne);const B=j.getAbsolutePosition();if(A.x===B.x&&A.y===B.y)return;if(this._movingAnchorName==="rotater"){const se=this._getNodeRect();F=j.x()-se.width/2,V=-j.y()+se.height/2;let q=Math.atan2(-V,F)+Math.PI/2;se.height<0&&(q-=Math.PI);const ye=u.Konva.getAngle(this.rotation())+q,ke=u.Konva.getAngle(this.rotationSnapTolerance()),Me=L(this.rotationSnaps(),ye,ke)-se.rotation,be=E(se,Me);this._fitNodesInto(be,I);return}const Q=this.shiftBehavior();let H;Q==="inverted"?H=this.keepRatio()&&!I.shiftKey:Q==="none"?H=this.keepRatio():H=this.keepRatio()||I.shiftKey;let K=this.centeredScaling()||I.altKey;if(this._movingAnchorName==="top-left"){if(H){const se=K?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};W=Math.sqrt(Math.pow(se.x-j.x(),2)+Math.pow(se.y-j.y(),2));const q=this.findOne(".top-left").x()>se.x?-1:1,oe=this.findOne(".top-left").y()>se.y?-1:1;F=W*this.cos*q,V=W*this.sin*oe,this.findOne(".top-left").x(se.x-F),this.findOne(".top-left").y(se.y-V)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(j.y());else if(this._movingAnchorName==="top-right"){if(H){const se=K?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};W=Math.sqrt(Math.pow(j.x()-se.x,2)+Math.pow(se.y-j.y(),2));const q=this.findOne(".top-right").x()<se.x?-1:1,oe=this.findOne(".top-right").y()>se.y?-1:1;F=W*this.cos*q,V=W*this.sin*oe,this.findOne(".top-right").x(se.x+F),this.findOne(".top-right").y(se.y-V)}var ae=j.position();this.findOne(".top-left").y(ae.y),this.findOne(".bottom-right").x(ae.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(j.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(j.x());else if(this._movingAnchorName==="bottom-left"){if(H){const se=K?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};W=Math.sqrt(Math.pow(se.x-j.x(),2)+Math.pow(j.y()-se.y,2));const q=se.x<j.x()?-1:1,oe=j.y()<se.y?-1:1;F=W*this.cos*q,V=W*this.sin*oe,j.x(se.x-F),j.y(se.y+V)}ae=j.position(),this.findOne(".top-left").x(ae.x),this.findOne(".bottom-right").y(ae.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(j.y());else if(this._movingAnchorName==="bottom-right"){if(H){const se=K?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};W=Math.sqrt(Math.pow(j.x()-se.x,2)+Math.pow(j.y()-se.y,2));const q=this.findOne(".bottom-right").x()<se.x?-1:1,oe=this.findOne(".bottom-right").y()<se.y?-1:1;F=W*this.cos*q,V=W*this.sin*oe,this.findOne(".bottom-right").x(se.x+F),this.findOne(".bottom-right").y(se.y+V)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(K=this.centeredScaling()||I.altKey,K){const se=this.findOne(".top-left"),q=this.findOne(".bottom-right"),oe=se.x(),ye=se.y(),ke=this.getWidth()-q.x(),Ae=this.getHeight()-q.y();q.move({x:-oe,y:-ye}),se.move({x:ke,y:Ae})}const ie=this.findOne(".top-left").getAbsolutePosition();F=ie.x,V=ie.y;const de=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),fe=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:F,y:V,width:de,height:fe,rotation:u.Konva.getAngle(this.rotation())},I)}_handleMouseUp(I){this._removeEvents(I)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(I){var F;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const V=this.getNode();R--,this._fire("transformend",{evt:I,target:V}),(F=this.getLayer())===null||F===void 0||F.batchDraw(),V&&this._nodes.forEach(W=>{var j;W._fire("transformend",{evt:I,target:W}),(j=W.getLayer())===null||j===void 0||j.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(I,F){const V=this._getNodeRect(),W=1;if(t.Util._inRange(I.width,-this.padding()*2-W,W)){this.update();return}if(t.Util._inRange(I.height,-this.padding()*2-W,W)){this.update();return}const j=new t.Transform;if(j.rotate(u.Konva.getAngle(this.rotation())),this._movingAnchorName&&I.width<0&&this._movingAnchorName.indexOf("left")>=0){const H=j.point({x:-this.padding()*2,y:0});I.x+=H.x,I.y+=H.y,I.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=H.x,this._anchorDragOffset.y-=H.y}else if(this._movingAnchorName&&I.width<0&&this._movingAnchorName.indexOf("right")>=0){const H=j.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=H.x,this._anchorDragOffset.y-=H.y,I.width+=this.padding()*2}if(this._movingAnchorName&&I.height<0&&this._movingAnchorName.indexOf("top")>=0){const H=j.point({x:0,y:-this.padding()*2});I.x+=H.x,I.y+=H.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=H.x,this._anchorDragOffset.y-=H.y,I.height+=this.padding()*2}else if(this._movingAnchorName&&I.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const H=j.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=H.x,this._anchorDragOffset.y-=H.y,I.height+=this.padding()*2}if(this.boundBoxFunc()){const H=this.boundBoxFunc()(V,I);H?I=H:t.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const Y=1e7,X=new t.Transform;X.translate(V.x,V.y),X.rotate(V.rotation),X.scale(V.width/Y,V.height/Y);const ne=new t.Transform,A=I.width/Y,B=I.height/Y;this.flipEnabled()===!1?(ne.translate(I.x,I.y),ne.rotate(I.rotation),ne.translate(I.width<0?I.width:0,I.height<0?I.height:0),ne.scale(Math.abs(A),Math.abs(B))):(ne.translate(I.x,I.y),ne.rotate(I.rotation),ne.scale(A,B));const Q=ne.multiply(X.invert());this._nodes.forEach(H=>{var K;const ae=H.getParent().getAbsoluteTransform(),ie=H.getTransform().copy();ie.translate(H.offsetX(),H.offsetY());const de=new t.Transform;de.multiply(ae.copy().invert()).multiply(Q).multiply(ae).multiply(ie);const fe=de.decompose();H.setAttrs(fe),(K=H.getLayer())===null||K===void 0||K.batchDraw()}),this.rotation(t.Util._getRotation(I.rotation)),this._nodes.forEach(H=>{this._fire("transform",{evt:F,target:H}),H._fire("transform",{evt:F,target:H})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(I,F){this.findOne(I).setAttrs(F)}update(){var I;const F=this._getNodeRect();this.rotation(t.Util._getRotation(F.rotation));const V=F.width,W=F.height,j=this.enabledAnchors(),Y=this.resizeEnabled(),X=this.padding(),ne=this.anchorSize(),A=this.find("._anchor");A.forEach(Q=>{Q.setAttrs({width:ne,height:ne,offsetX:ne/2,offsetY:ne/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:ne/2+X,offsetY:ne/2+X,visible:Y&&j.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:V/2,y:0,offsetY:ne/2+X,visible:Y&&j.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:V,y:0,offsetX:ne/2-X,offsetY:ne/2+X,visible:Y&&j.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:W/2,offsetX:ne/2+X,visible:Y&&j.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:V,y:W/2,offsetX:ne/2-X,visible:Y&&j.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:W,offsetX:ne/2+X,offsetY:ne/2-X,visible:Y&&j.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:V/2,y:W,offsetY:ne/2-X,visible:Y&&j.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:V,y:W,offsetX:ne/2-X,offsetY:ne/2-X,visible:Y&&j.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:V/2,y:-this.rotateAnchorOffset()*t.Util._sign(W)-X,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:V,height:W,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const B=this.anchorStyleFunc();B&&A.forEach(Q=>{B(Q)}),(I=this.getLayer())===null||I===void 0||I.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const I=this.findOne("."+this._movingAnchorName);I&&I.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),l.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return n.Node.prototype.toObject.call(this)}clone(I){return n.Node.prototype.clone.call(this,I)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}_f.Transformer=z,z.isTransforming=()=>R>0;function ee(O){return O instanceof Array||t.Util.warn("enabledAnchors value should be an array"),O instanceof Array&&O.forEach(function(I){D.indexOf(I)===-1&&t.Util.warn("Unknown anchor name: "+I+". Available names are: "+D.join(", "))}),O||[]}return z.prototype.className="Transformer",(0,p._registerNode)(z),e.Factory.addGetterSetter(z,"enabledAnchors",D,ee),e.Factory.addGetterSetter(z,"flipEnabled",!0,(0,d.getBooleanValidator)()),e.Factory.addGetterSetter(z,"resizeEnabled",!0),e.Factory.addGetterSetter(z,"anchorSize",10,(0,d.getNumberValidator)()),e.Factory.addGetterSetter(z,"rotateEnabled",!0),e.Factory.addGetterSetter(z,"rotateLineVisible",!0),e.Factory.addGetterSetter(z,"rotationSnaps",[]),e.Factory.addGetterSetter(z,"rotateAnchorOffset",50,(0,d.getNumberValidator)()),e.Factory.addGetterSetter(z,"rotateAnchorCursor","crosshair"),e.Factory.addGetterSetter(z,"rotationSnapTolerance",5,(0,d.getNumberValidator)()),e.Factory.addGetterSetter(z,"borderEnabled",!0),e.Factory.addGetterSetter(z,"anchorStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(z,"anchorStrokeWidth",1,(0,d.getNumberValidator)()),e.Factory.addGetterSetter(z,"anchorFill","white"),e.Factory.addGetterSetter(z,"anchorCornerRadius",0,(0,d.getNumberValidator)()),e.Factory.addGetterSetter(z,"borderStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(z,"borderStrokeWidth",1,(0,d.getNumberValidator)()),e.Factory.addGetterSetter(z,"borderDash"),e.Factory.addGetterSetter(z,"keepRatio",!0),e.Factory.addGetterSetter(z,"shiftBehavior","default"),e.Factory.addGetterSetter(z,"centeredScaling",!1),e.Factory.addGetterSetter(z,"ignoreStroke",!1),e.Factory.addGetterSetter(z,"padding",0,(0,d.getNumberValidator)()),e.Factory.addGetterSetter(z,"nodes"),e.Factory.addGetterSetter(z,"node"),e.Factory.addGetterSetter(z,"boundBoxFunc"),e.Factory.addGetterSetter(z,"anchorDragBoundFunc"),e.Factory.addGetterSetter(z,"anchorStyleFunc"),e.Factory.addGetterSetter(z,"shouldOverdrawWholeArea",!1),e.Factory.addGetterSetter(z,"useSingleNodeRotation",!0),e.Factory.backCompat(z,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"}),_f}var xf={},m_;function l8(){if(m_)return xf;m_=1,Object.defineProperty(xf,"__esModule",{value:!0}),xf.Wedge=void 0;const t=Qt(),e=Lr(),n=Vt(),s=Zt(),a=Vt();let l=class extends e.Shape{_sceneFunc(d){d.beginPath(),d.arc(0,0,this.radius(),0,n.Konva.getAngle(this.angle()),this.clockwise()),d.lineTo(0,0),d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(d){this.radius(d/2)}setHeight(d){this.radius(d/2)}};return xf.Wedge=l,l.prototype.className="Wedge",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["radius"],(0,a._registerNode)(l),t.Factory.addGetterSetter(l,"radius",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(l,"angle",0,(0,s.getNumberValidator)()),t.Factory.addGetterSetter(l,"clockwise",!1),t.Factory.backCompat(l,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"}),xf}var wf={},v_;function c8(){if(v_)return wf;v_=1,Object.defineProperty(wf,"__esModule",{value:!0}),wf.Blur=void 0;const t=Qt(),e=Qn(),n=Zt();function s(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const a=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],l=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function u(p,h){const y=p.data,_=p.width,S=p.height;let x,w,C,D,U,M,E,L,R,z,ee,O,I,F,V,W,j,Y,X,ne;const A=h+h+1,B=_-1,Q=S-1,H=h+1,K=H*(H+1)/2,ae=new s,ie=a[h],de=l[h];let fe=null,se=ae,q=null,oe=null;for(let ye=1;ye<A;ye++)se=se.next=new s,ye===H&&(fe=se);se.next=ae,C=w=0;for(let ye=0;ye<S;ye++){O=I=F=V=D=U=M=E=0,L=H*(W=y[w]),R=H*(j=y[w+1]),z=H*(Y=y[w+2]),ee=H*(X=y[w+3]),D+=K*W,U+=K*j,M+=K*Y,E+=K*X,se=ae;for(let ke=0;ke<H;ke++)se.r=W,se.g=j,se.b=Y,se.a=X,se=se.next;for(let ke=1;ke<H;ke++)x=w+((B<ke?B:ke)<<2),D+=(se.r=W=y[x])*(ne=H-ke),U+=(se.g=j=y[x+1])*ne,M+=(se.b=Y=y[x+2])*ne,E+=(se.a=X=y[x+3])*ne,O+=W,I+=j,F+=Y,V+=X,se=se.next;q=ae,oe=fe;for(let ke=0;ke<_;ke++)y[w+3]=X=E*ie>>de,X!==0?(X=255/X,y[w]=(D*ie>>de)*X,y[w+1]=(U*ie>>de)*X,y[w+2]=(M*ie>>de)*X):y[w]=y[w+1]=y[w+2]=0,D-=L,U-=R,M-=z,E-=ee,L-=q.r,R-=q.g,z-=q.b,ee-=q.a,x=C+((x=ke+h+1)<B?x:B)<<2,O+=q.r=y[x],I+=q.g=y[x+1],F+=q.b=y[x+2],V+=q.a=y[x+3],D+=O,U+=I,M+=F,E+=V,q=q.next,L+=W=oe.r,R+=j=oe.g,z+=Y=oe.b,ee+=X=oe.a,O-=W,I-=j,F-=Y,V-=X,oe=oe.next,w+=4;C+=_}for(let ye=0;ye<_;ye++){I=F=V=O=U=M=E=D=0,w=ye<<2,L=H*(W=y[w]),R=H*(j=y[w+1]),z=H*(Y=y[w+2]),ee=H*(X=y[w+3]),D+=K*W,U+=K*j,M+=K*Y,E+=K*X,se=ae;for(let Ae=0;Ae<H;Ae++)se.r=W,se.g=j,se.b=Y,se.a=X,se=se.next;let ke=_;for(let Ae=1;Ae<=h;Ae++)w=ke+ye<<2,D+=(se.r=W=y[w])*(ne=H-Ae),U+=(se.g=j=y[w+1])*ne,M+=(se.b=Y=y[w+2])*ne,E+=(se.a=X=y[w+3])*ne,O+=W,I+=j,F+=Y,V+=X,se=se.next,Ae<Q&&(ke+=_);w=ye,q=ae,oe=fe;for(let Ae=0;Ae<S;Ae++)x=w<<2,y[x+3]=X=E*ie>>de,X>0?(X=255/X,y[x]=(D*ie>>de)*X,y[x+1]=(U*ie>>de)*X,y[x+2]=(M*ie>>de)*X):y[x]=y[x+1]=y[x+2]=0,D-=L,U-=R,M-=z,E-=ee,L-=q.r,R-=q.g,z-=q.b,ee-=q.a,x=ye+((x=Ae+H)<Q?x:Q)*_<<2,D+=O+=q.r=y[x],U+=I+=q.g=y[x+1],M+=F+=q.b=y[x+2],E+=V+=q.a=y[x+3],q=q.next,L+=W=oe.r,R+=j=oe.g,z+=Y=oe.b,ee+=X=oe.a,O-=W,I-=j,F-=Y,V-=X,oe=oe.next,w+=_}}const d=function(h){const y=Math.round(this.blurRadius());y>0&&u(h,y)};return wf.Blur=d,t.Factory.addGetterSetter(e.Node,"blurRadius",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),wf}var bf={},S_;function u8(){if(S_)return bf;S_=1,Object.defineProperty(bf,"__esModule",{value:!0}),bf.Brighten=void 0;const t=Qt(),e=Qn(),n=Zt(),s=function(a){const l=this.brightness()*255,u=a.data,d=u.length;for(let p=0;p<d;p+=4)u[p]+=l,u[p+1]+=l,u[p+2]+=l};return bf.Brighten=s,t.Factory.addGetterSetter(e.Node,"brightness",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),bf}var Ef={},__;function d8(){if(__)return Ef;__=1,Object.defineProperty(Ef,"__esModule",{value:!0}),Ef.Contrast=void 0;const t=Qt(),e=Qn(),n=Zt(),s=function(a){const l=Math.pow((this.contrast()+100)/100,2),u=a.data,d=u.length;let p=150,h=150,y=150;for(let _=0;_<d;_+=4)p=u[_],h=u[_+1],y=u[_+2],p/=255,p-=.5,p*=l,p+=.5,p*=255,h/=255,h-=.5,h*=l,h+=.5,h*=255,y/=255,y-=.5,y*=l,y+=.5,y*=255,p=p<0?0:p>255?255:p,h=h<0?0:h>255?255:h,y=y<0?0:y>255?255:y,u[_]=p,u[_+1]=h,u[_+2]=y};return Ef.Contrast=s,t.Factory.addGetterSetter(e.Node,"contrast",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ef}var Cf={},x_;function f8(){if(x_)return Cf;x_=1,Object.defineProperty(Cf,"__esModule",{value:!0}),Cf.Emboss=void 0;const t=Qt(),e=Qn(),n=Hn(),s=Zt(),a=function(l){const u=this.embossStrength()*10,d=this.embossWhiteLevel()*255,p=this.embossDirection(),h=this.embossBlend(),y=l.data,_=l.width,S=l.height,x=_*4;let w=0,C=0,D=S;switch(p){case"top-left":w=-1,C=-1;break;case"top":w=-1,C=0;break;case"top-right":w=-1,C=1;break;case"right":w=0,C=1;break;case"bottom-right":w=1,C=1;break;case"bottom":w=1,C=0;break;case"bottom-left":w=1,C=-1;break;case"left":w=0,C=-1;break;default:n.Util.error("Unknown emboss direction: "+p)}do{const U=(D-1)*x;let M=w;D+M<1&&(M=0),D+M>S&&(M=0);const E=(D-1+M)*_*4;let L=_;do{const R=U+(L-1)*4;let z=C;L+z<1&&(z=0),L+z>_&&(z=0);const ee=E+(L-1+z)*4,O=y[R]-y[ee],I=y[R+1]-y[ee+1],F=y[R+2]-y[ee+2];let V=O;const W=V>0?V:-V,j=I>0?I:-I,Y=F>0?F:-F;if(j>W&&(V=I),Y>W&&(V=F),V*=u,h){const X=y[R]+V,ne=y[R+1]+V,A=y[R+2]+V;y[R]=X>255?255:X<0?0:X,y[R+1]=ne>255?255:ne<0?0:ne,y[R+2]=A>255?255:A<0?0:A}else{let X=d-V;X<0?X=0:X>255&&(X=255),y[R]=y[R+1]=y[R+2]=X}}while(--L)}while(--D)};return Cf.Emboss=a,t.Factory.addGetterSetter(e.Node,"embossStrength",.5,(0,s.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossWhiteLevel",.5,(0,s.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossDirection","top-left",void 0,t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossBlend",!1,void 0,t.Factory.afterSetFilter),Cf}var Tf={},w_;function h8(){if(w_)return Tf;w_=1,Object.defineProperty(Tf,"__esModule",{value:!0}),Tf.Enhance=void 0;const t=Qt(),e=Qn(),n=Zt();function s(l,u,d,p,h){const y=d-u,_=h-p;if(y===0)return p+_/2;if(_===0)return p;let S=(l-u)/y;return S=_*S+p,S}const a=function(l){const u=l.data,d=u.length;let p=u[0],h=p,y,_=u[1],S=_,x,w=u[2],C=w,D;const U=this.enhance();if(U===0)return;for(let O=0;O<d;O+=4)y=u[O+0],y<p?p=y:y>h&&(h=y),x=u[O+1],x<_?_=x:x>S&&(S=x),D=u[O+2],D<w?w=D:D>C&&(C=D);h===p&&(h=255,p=0),S===_&&(S=255,_=0),C===w&&(C=255,w=0);let M,E,L,R,z,ee;if(U>0)M=h+U*(255-h),E=p-U*(p-0),L=S+U*(255-S),R=_-U*(_-0),z=C+U*(255-C),ee=w-U*(w-0);else{const O=(h+p)*.5;M=h+U*(h-O),E=p+U*(p-O);const I=(S+_)*.5;L=S+U*(S-I),R=_+U*(_-I);const F=(C+w)*.5;z=C+U*(C-F),ee=w+U*(w-F)}for(let O=0;O<d;O+=4)u[O+0]=s(u[O+0],p,h,E,M),u[O+1]=s(u[O+1],_,S,R,L),u[O+2]=s(u[O+2],w,C,ee,z)};return Tf.Enhance=a,t.Factory.addGetterSetter(e.Node,"enhance",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Tf}var kf={},b_;function p8(){if(b_)return kf;b_=1,Object.defineProperty(kf,"__esModule",{value:!0}),kf.Grayscale=void 0;const t=function(e){const n=e.data,s=n.length;for(let a=0;a<s;a+=4){const l=.34*n[a]+.5*n[a+1]+.16*n[a+2];n[a]=l,n[a+1]=l,n[a+2]=l}};return kf.Grayscale=t,kf}var Mf={},E_;function g8(){if(E_)return Mf;E_=1,Object.defineProperty(Mf,"__esModule",{value:!0}),Mf.HSL=void 0;const t=Qt(),e=Qn(),n=Zt();t.Factory.addGetterSetter(e.Node,"hue",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"saturation",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"luminance",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter);const s=function(a){const l=a.data,u=l.length,d=1,p=Math.pow(2,this.saturation()),h=Math.abs(this.hue()+360)%360,y=this.luminance()*127,_=d*p*Math.cos(h*Math.PI/180),S=d*p*Math.sin(h*Math.PI/180),x=.299*d+.701*_+.167*S,w=.587*d-.587*_+.33*S,C=.114*d-.114*_-.497*S,D=.299*d-.299*_-.328*S,U=.587*d+.413*_+.035*S,M=.114*d-.114*_+.293*S,E=.299*d-.3*_+1.25*S,L=.587*d-.586*_-1.05*S,R=.114*d+.886*_-.2*S;let z,ee,O,I;for(let F=0;F<u;F+=4)z=l[F+0],ee=l[F+1],O=l[F+2],I=l[F+3],l[F+0]=x*z+w*ee+C*O+y,l[F+1]=D*z+U*ee+M*O+y,l[F+2]=E*z+L*ee+R*O+y,l[F+3]=I};return Mf.HSL=s,Mf}var Df={},C_;function y8(){if(C_)return Df;C_=1,Object.defineProperty(Df,"__esModule",{value:!0}),Df.HSV=void 0;const t=Qt(),e=Qn(),n=Zt(),s=function(a){const l=a.data,u=l.length,d=Math.pow(2,this.value()),p=Math.pow(2,this.saturation()),h=Math.abs(this.hue()+360)%360,y=d*p*Math.cos(h*Math.PI/180),_=d*p*Math.sin(h*Math.PI/180),S=.299*d+.701*y+.167*_,x=.587*d-.587*y+.33*_,w=.114*d-.114*y-.497*_,C=.299*d-.299*y-.328*_,D=.587*d+.413*y+.035*_,U=.114*d-.114*y+.293*_,M=.299*d-.3*y+1.25*_,E=.587*d-.586*y-1.05*_,L=.114*d+.886*y-.2*_;for(let R=0;R<u;R+=4){const z=l[R+0],ee=l[R+1],O=l[R+2],I=l[R+3];l[R+0]=S*z+x*ee+w*O,l[R+1]=C*z+D*ee+U*O,l[R+2]=M*z+E*ee+L*O,l[R+3]=I}};return Df.HSV=s,t.Factory.addGetterSetter(e.Node,"hue",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"saturation",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"value",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Df}var Af={},T_;function m8(){if(T_)return Af;T_=1,Object.defineProperty(Af,"__esModule",{value:!0}),Af.Invert=void 0;const t=function(e){const n=e.data,s=n.length;for(let a=0;a<s;a+=4)n[a]=255-n[a],n[a+1]=255-n[a+1],n[a+2]=255-n[a+2]};return Af.Invert=t,Af}var Rf={},k_;function v8(){if(k_)return Rf;k_=1,Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.Kaleidoscope=void 0;const t=Qt(),e=Qn(),n=Hn(),s=Zt(),a=function(d,p,h){const y=d.data,_=p.data,S=d.width,x=d.height,w=h.polarCenterX||S/2,C=h.polarCenterY||x/2;let D=Math.sqrt(w*w+C*C),U=S-w,M=x-C;const E=Math.sqrt(U*U+M*M);D=E>D?E:D;const L=x,R=S,z=360/R*Math.PI/180;for(let ee=0;ee<R;ee+=1){const O=Math.sin(ee*z),I=Math.cos(ee*z);for(let F=0;F<L;F+=1){U=Math.floor(w+D*F/L*I),M=Math.floor(C+D*F/L*O);let V=(M*S+U)*4;const W=y[V+0],j=y[V+1],Y=y[V+2],X=y[V+3];V=(ee+F*S)*4,_[V+0]=W,_[V+1]=j,_[V+2]=Y,_[V+3]=X}}},l=function(d,p,h){const y=d.data,_=p.data,S=d.width,x=d.height,w=h.polarCenterX||S/2,C=h.polarCenterY||x/2;let D=Math.sqrt(w*w+C*C),U=S-w,M=x-C;const E=Math.sqrt(U*U+M*M);D=E>D?E:D;const L=x,R=S,z=0;let ee,O;for(U=0;U<S;U+=1)for(M=0;M<x;M+=1){const I=U-w,F=M-C,V=Math.sqrt(I*I+F*F)*L/D;let W=(Math.atan2(F,I)*180/Math.PI+360+z)%360;W=W*R/360,ee=Math.floor(W),O=Math.floor(V);let j=(O*S+ee)*4;const Y=y[j+0],X=y[j+1],ne=y[j+2],A=y[j+3];j=(M*S+U)*4,_[j+0]=Y,_[j+1]=X,_[j+2]=ne,_[j+3]=A}},u=function(d){const p=d.width,h=d.height;let y,_,S,x,w,C,D,U,M,E,L=Math.round(this.kaleidoscopePower());const R=Math.round(this.kaleidoscopeAngle()),z=Math.floor(p*(R%360)/360);if(L<1)return;const ee=n.Util.createCanvasElement();ee.width=p,ee.height=h;const O=ee.getContext("2d").getImageData(0,0,p,h);n.Util.releaseCanvas(ee),a(d,O,{polarCenterX:p/2,polarCenterY:h/2});let I=p/Math.pow(2,L);for(;I<=8;)I=I*2,L-=1;I=Math.ceil(I);let F=I,V=0,W=F,j=1;for(z+I>p&&(V=F,W=0,j=-1),_=0;_<h;_+=1)for(y=V;y!==W;y+=j)S=Math.round(y+z)%p,M=(p*_+S)*4,w=O.data[M+0],C=O.data[M+1],D=O.data[M+2],U=O.data[M+3],E=(p*_+y)*4,O.data[E+0]=w,O.data[E+1]=C,O.data[E+2]=D,O.data[E+3]=U;for(_=0;_<h;_+=1)for(F=Math.floor(I),x=0;x<L;x+=1){for(y=0;y<F+1;y+=1)M=(p*_+y)*4,w=O.data[M+0],C=O.data[M+1],D=O.data[M+2],U=O.data[M+3],E=(p*_+F*2-y-1)*4,O.data[E+0]=w,O.data[E+1]=C,O.data[E+2]=D,O.data[E+3]=U;F*=2}l(O,d,{})};return Rf.Kaleidoscope=u,t.Factory.addGetterSetter(e.Node,"kaleidoscopePower",2,(0,s.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"kaleidoscopeAngle",0,(0,s.getNumberValidator)(),t.Factory.afterSetFilter),Rf}var Lf={},M_;function S8(){if(M_)return Lf;M_=1,Object.defineProperty(Lf,"__esModule",{value:!0}),Lf.Mask=void 0;const t=Qt(),e=Qn(),n=Zt();function s(S,x,w){let C=(w*S.width+x)*4;const D=[];return D.push(S.data[C++],S.data[C++],S.data[C++],S.data[C++]),D}function a(S,x){return Math.sqrt(Math.pow(S[0]-x[0],2)+Math.pow(S[1]-x[1],2)+Math.pow(S[2]-x[2],2))}function l(S){const x=[0,0,0];for(let w=0;w<S.length;w++)x[0]+=S[w][0],x[1]+=S[w][1],x[2]+=S[w][2];return x[0]/=S.length,x[1]/=S.length,x[2]/=S.length,x}function u(S,x){const w=s(S,0,0),C=s(S,S.width-1,0),D=s(S,0,S.height-1),U=s(S,S.width-1,S.height-1),M=x||10;if(a(w,C)<M&&a(C,U)<M&&a(U,D)<M&&a(D,w)<M){const E=l([C,w,U,D]),L=[];for(let R=0;R<S.width*S.height;R++){const z=a(E,[S.data[R*4],S.data[R*4+1],S.data[R*4+2]]);L[R]=z<M?0:255}return L}}function d(S,x){for(let w=0;w<S.width*S.height;w++)S.data[4*w+3]=x[w]}function p(S,x,w){const C=[1,1,1,1,0,1,1,1,1],D=Math.round(Math.sqrt(C.length)),U=Math.floor(D/2),M=[];for(let E=0;E<w;E++)for(let L=0;L<x;L++){const R=E*x+L;let z=0;for(let ee=0;ee<D;ee++)for(let O=0;O<D;O++){const I=E+ee-U,F=L+O-U;if(I>=0&&I<w&&F>=0&&F<x){const V=I*x+F,W=C[ee*D+O];z+=S[V]*W}}M[R]=z===2040?255:0}return M}function h(S,x,w){const C=[1,1,1,1,1,1,1,1,1],D=Math.round(Math.sqrt(C.length)),U=Math.floor(D/2),M=[];for(let E=0;E<w;E++)for(let L=0;L<x;L++){const R=E*x+L;let z=0;for(let ee=0;ee<D;ee++)for(let O=0;O<D;O++){const I=E+ee-U,F=L+O-U;if(I>=0&&I<w&&F>=0&&F<x){const V=I*x+F,W=C[ee*D+O];z+=S[V]*W}}M[R]=z>=1020?255:0}return M}function y(S,x,w){const C=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],D=Math.round(Math.sqrt(C.length)),U=Math.floor(D/2),M=[];for(let E=0;E<w;E++)for(let L=0;L<x;L++){const R=E*x+L;let z=0;for(let ee=0;ee<D;ee++)for(let O=0;O<D;O++){const I=E+ee-U,F=L+O-U;if(I>=0&&I<w&&F>=0&&F<x){const V=I*x+F,W=C[ee*D+O];z+=S[V]*W}}M[R]=z}return M}const _=function(S){const x=this.threshold();let w=u(S,x);return w&&(w=p(w,S.width,S.height),w=h(w,S.width,S.height),w=y(w,S.width,S.height),d(S,w)),S};return Lf.Mask=_,t.Factory.addGetterSetter(e.Node,"threshold",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Lf}var Nf={},D_;function _8(){if(D_)return Nf;D_=1,Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.Noise=void 0;const t=Qt(),e=Qn(),n=Zt(),s=function(a){const l=this.noise()*255,u=a.data,d=u.length,p=l/2;for(let h=0;h<d;h+=4)u[h+0]+=p-2*p*Math.random(),u[h+1]+=p-2*p*Math.random(),u[h+2]+=p-2*p*Math.random()};return Nf.Noise=s,t.Factory.addGetterSetter(e.Node,"noise",.2,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Nf}var Pf={},A_;function x8(){if(A_)return Pf;A_=1,Object.defineProperty(Pf,"__esModule",{value:!0}),Pf.Pixelate=void 0;const t=Qt(),e=Hn(),n=Qn(),s=Zt(),a=function(l){let u=Math.ceil(this.pixelSize()),d=l.width,p=l.height,h=Math.ceil(d/u),y=Math.ceil(p/u),_=l.data;if(u<=0){e.Util.error("pixelSize value can not be <= 0");return}for(let S=0;S<h;S+=1)for(let x=0;x<y;x+=1){let w=0,C=0,D=0,U=0;const M=S*u,E=M+u,L=x*u,R=L+u;let z=0;for(let ee=M;ee<E;ee+=1)if(!(ee>=d))for(let O=L;O<R;O+=1){if(O>=p)continue;const I=(d*O+ee)*4;w+=_[I+0],C+=_[I+1],D+=_[I+2],U+=_[I+3],z+=1}w=w/z,C=C/z,D=D/z,U=U/z;for(let ee=M;ee<E;ee+=1)if(!(ee>=d))for(let O=L;O<R;O+=1){if(O>=p)continue;const I=(d*O+ee)*4;_[I+0]=w,_[I+1]=C,_[I+2]=D,_[I+3]=U}}};return Pf.Pixelate=a,t.Factory.addGetterSetter(n.Node,"pixelSize",8,(0,s.getNumberValidator)(),t.Factory.afterSetFilter),Pf}var Of={},R_;function w8(){if(R_)return Of;R_=1,Object.defineProperty(Of,"__esModule",{value:!0}),Of.Posterize=void 0;const t=Qt(),e=Qn(),n=Zt(),s=function(a){const l=Math.round(this.levels()*254)+1,u=a.data,d=u.length,p=255/l;for(let h=0;h<d;h+=1)u[h]=Math.floor(u[h]/p)*p};return Of.Posterize=s,t.Factory.addGetterSetter(e.Node,"levels",.5,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Of}var If={},L_;function b8(){if(L_)return If;L_=1,Object.defineProperty(If,"__esModule",{value:!0}),If.RGB=void 0;const t=Qt(),e=Qn(),n=Zt(),s=function(a){const l=a.data,u=l.length,d=this.red(),p=this.green(),h=this.blue();for(let y=0;y<u;y+=4){const _=(.34*l[y]+.5*l[y+1]+.16*l[y+2])/255;l[y]=_*d,l[y+1]=_*p,l[y+2]=_*h,l[y+3]=l[y+3]}};return If.RGB=s,t.Factory.addGetterSetter(e.Node,"red",0,function(a){return this._filterUpToDate=!1,a>255?255:a<0?0:Math.round(a)}),t.Factory.addGetterSetter(e.Node,"green",0,function(a){return this._filterUpToDate=!1,a>255?255:a<0?0:Math.round(a)}),t.Factory.addGetterSetter(e.Node,"blue",0,n.RGBComponent,t.Factory.afterSetFilter),If}var Ff={},N_;function E8(){if(N_)return Ff;N_=1,Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.RGBA=void 0;const t=Qt(),e=Qn(),n=Zt(),s=function(a){const l=a.data,u=l.length,d=this.red(),p=this.green(),h=this.blue(),y=this.alpha();for(let _=0;_<u;_+=4){const S=1-y;l[_]=d*y+l[_]*S,l[_+1]=p*y+l[_+1]*S,l[_+2]=h*y+l[_+2]*S}};return Ff.RGBA=s,t.Factory.addGetterSetter(e.Node,"red",0,function(a){return this._filterUpToDate=!1,a>255?255:a<0?0:Math.round(a)}),t.Factory.addGetterSetter(e.Node,"green",0,function(a){return this._filterUpToDate=!1,a>255?255:a<0?0:Math.round(a)}),t.Factory.addGetterSetter(e.Node,"blue",0,n.RGBComponent,t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"alpha",1,function(a){return this._filterUpToDate=!1,a>1?1:a<0?0:a}),Ff}var Uf={},P_;function C8(){if(P_)return Uf;P_=1,Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.Sepia=void 0;const t=function(e){const n=e.data,s=n.length;for(let a=0;a<s;a+=4){const l=n[a+0],u=n[a+1],d=n[a+2];n[a+0]=Math.min(255,l*.393+u*.769+d*.189),n[a+1]=Math.min(255,l*.349+u*.686+d*.168),n[a+2]=Math.min(255,l*.272+u*.534+d*.131)}};return Uf.Sepia=t,Uf}var Bf={},O_;function T8(){if(O_)return Bf;O_=1,Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.Solarize=void 0;const t=function(e){const n=e.data,s=e.width,a=e.height,l=s*4;let u=a;do{const d=(u-1)*l;let p=s;do{const h=d+(p-1)*4;let y=n[h],_=n[h+1],S=n[h+2];y>127&&(y=255-y),_>127&&(_=255-_),S>127&&(S=255-S),n[h]=y,n[h+1]=_,n[h+2]=S}while(--p)}while(--u)};return Bf.Solarize=t,Bf}var zf={},I_;function k8(){if(I_)return zf;I_=1,Object.defineProperty(zf,"__esModule",{value:!0}),zf.Threshold=void 0;const t=Qt(),e=Qn(),n=Zt(),s=function(a){const l=this.threshold()*255,u=a.data,d=u.length;for(let p=0;p<d;p+=1)u[p]=u[p]<l?0:255};return zf.Threshold=s,t.Factory.addGetterSetter(e.Node,"threshold",.5,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),zf}var F_;function M8(){if(F_)return $d;F_=1,Object.defineProperty($d,"__esModule",{value:!0}),$d.Konva=void 0;const t=ym(),e=K6(),n=J6(),s=Z6(),a=$6(),l=e8(),u=t8(),d=$S(),p=vm(),h=l_(),y=n8(),_=r8(),S=i8(),x=s8(),w=p_(),C=a8(),D=o8(),U=l8(),M=c8(),E=u8(),L=d8(),R=f8(),z=h8(),ee=p8(),O=g8(),I=y8(),F=m8(),V=v8(),W=S8(),j=_8(),Y=x8(),X=w8(),ne=b8(),A=E8(),B=C8(),Q=T8(),H=k8();return $d.Konva=t.Konva.Util._assign(t.Konva,{Arc:e.Arc,Arrow:n.Arrow,Circle:s.Circle,Ellipse:a.Ellipse,Image:l.Image,Label:u.Label,Tag:u.Tag,Line:d.Line,Path:p.Path,Rect:h.Rect,RegularPolygon:y.RegularPolygon,Ring:_.Ring,Sprite:S.Sprite,Star:x.Star,Text:w.Text,TextPath:C.TextPath,Transformer:D.Transformer,Wedge:U.Wedge,Filters:{Blur:M.Blur,Brighten:E.Brighten,Contrast:L.Contrast,Emboss:R.Emboss,Enhance:z.Enhance,Grayscale:ee.Grayscale,HSL:O.HSL,HSV:I.HSV,Invert:F.Invert,Kaleidoscope:V.Kaleidoscope,Mask:W.Mask,Noise:j.Noise,Pixelate:Y.Pixelate,Posterize:X.Posterize,RGB:ne.RGB,RGBA:A.RGBA,Sepia:B.Sepia,Solarize:Q.Solarize,Threshold:H.Threshold}}),$d}var D8=Vp.exports,U_;function A8(){if(U_)return Vp.exports;U_=1,Object.defineProperty(D8,"__esModule",{value:!0});const t=M8();return Vp.exports=t.Konva,Vp.exports}var R8=A8();const Wp=im(R8);var Xp={exports:{}},B_;function L8(){return B_||(B_=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Konva=void 0;var n=ym();Object.defineProperty(e,"Konva",{enumerable:!0,get:function(){return n.Konva}});const s=ym();t.exports=s.Konva})(Xp,Xp.exports)),Xp.exports}var N8=L8();const Hf=im(N8);var qp={exports:{}},Kp={exports:{}},Sm={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* scheduler.production.min.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var z_;function P8(){return z_||(z_=1,(function(t){function e(B,Q){var H=B.length;B.push(Q);e:for(;0<H;){var K=H-1>>>1,ae=B[K];if(0<a(ae,Q))B[K]=Q,B[H]=ae,H=K;else break e}}function n(B){return B.length===0?null:B[0]}function s(B){if(B.length===0)return null;var Q=B[0],H=B.pop();if(H!==Q){B[0]=H;e:for(var K=0,ae=B.length,ie=ae>>>1;K<ie;){var de=2*(K+1)-1,fe=B[de],se=de+1,q=B[se];if(0>a(fe,H))se<ae&&0>a(q,fe)?(B[K]=q,B[se]=H,K=se):(B[K]=fe,B[de]=H,K=de);else if(se<ae&&0>a(q,H))B[K]=q,B[se]=H,K=se;else break e}}return Q}function a(B,Q){var H=B.sortIndex-Q.sortIndex;return H!==0?H:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var p=[],h=[],y=1,_=null,S=3,x=!1,w=!1,C=!1,D=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(B){for(var Q=n(h);Q!==null;){if(Q.callback===null)s(h);else if(Q.startTime<=B)s(h),Q.sortIndex=Q.expirationTime,e(p,Q);else break;Q=n(h)}}function L(B){if(C=!1,E(B),!w)if(n(p)!==null)w=!0,ne(R);else{var Q=n(h);Q!==null&&A(L,Q.startTime-B)}}function R(B,Q){w=!1,C&&(C=!1,U(O),O=-1),x=!0;var H=S;try{for(E(Q),_=n(p);_!==null&&(!(_.expirationTime>Q)||B&&!V());){var K=_.callback;if(typeof K=="function"){_.callback=null,S=_.priorityLevel;var ae=K(_.expirationTime<=Q);Q=t.unstable_now(),typeof ae=="function"?_.callback=ae:_===n(p)&&s(p),E(Q)}else s(p);_=n(p)}if(_!==null)var ie=!0;else{var de=n(h);de!==null&&A(L,de.startTime-Q),ie=!1}return ie}finally{_=null,S=H,x=!1}}var z=!1,ee=null,O=-1,I=5,F=-1;function V(){return!(t.unstable_now()-F<I)}function W(){if(ee!==null){var B=t.unstable_now();F=B;var Q=!0;try{Q=ee(!0,B)}finally{Q?j():(z=!1,ee=null)}}else z=!1}var j;if(typeof M=="function")j=function(){M(W)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,X=Y.port2;Y.port1.onmessage=W,j=function(){X.postMessage(null)}}else j=function(){D(W,0)};function ne(B){ee=B,z||(z=!0,j())}function A(B,Q){O=D(function(){B(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){w||x||(w=!0,ne(R))},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return S},t.unstable_getFirstCallbackNode=function(){return n(p)},t.unstable_next=function(B){switch(S){case 1:case 2:case 3:var Q=3;break;default:Q=S}var H=S;S=Q;try{return B()}finally{S=H}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(B,Q){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var H=S;S=B;try{return Q()}finally{S=H}},t.unstable_scheduleCallback=function(B,Q,H){var K=t.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?K+H:K):H=K,B){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=H+ae,B={id:y++,callback:Q,priorityLevel:B,startTime:H,expirationTime:ae,sortIndex:-1},H>K?(B.sortIndex=H,e(h,B),n(p)===null&&B===n(h)&&(C?(U(O),O=-1):C=!0,A(L,H-K))):(B.sortIndex=ae,e(p,B),w||x||(w=!0,ne(R))),B},t.unstable_shouldYield=V,t.unstable_wrapCallback=function(B){var Q=S;return function(){var H=S;S=Q;try{return B.apply(this,arguments)}finally{S=H}}}})(Sm)),Sm}var _m={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* scheduler.development.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var H_;function O8(){return H_||(H_=1,(function(t){process.env.NODE_ENV!=="production"&&(function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=!1,n=5;function s(Ve,tt){var St=Ve.length;Ve.push(tt),u(Ve,tt,St)}function a(Ve){return Ve.length===0?null:Ve[0]}function l(Ve){if(Ve.length===0)return null;var tt=Ve[0],St=Ve.pop();return St!==tt&&(Ve[0]=St,d(Ve,St,0)),tt}function u(Ve,tt,St){for(var dt=St;dt>0;){var gn=dt-1>>>1,Gn=Ve[gn];if(p(Gn,tt)>0)Ve[gn]=tt,Ve[dt]=Gn,dt=gn;else return}}function d(Ve,tt,St){for(var dt=St,gn=Ve.length,Gn=gn>>>1;dt<Gn;){var ct=(dt+1)*2-1,at=Ve[ct],cn=ct+1,un=Ve[cn];if(p(at,tt)<0)cn<gn&&p(un,at)<0?(Ve[dt]=un,Ve[cn]=tt,dt=cn):(Ve[dt]=at,Ve[ct]=tt,dt=ct);else if(cn<gn&&p(un,tt)<0)Ve[dt]=un,Ve[cn]=tt,dt=cn;else return}}function p(Ve,tt){var St=Ve.sortIndex-tt.sortIndex;return St!==0?St:Ve.id-tt.id}var h=1,y=2,_=3,S=4,x=5;function w(Ve,tt){}var C=typeof performance=="object"&&typeof performance.now=="function";if(C){var D=performance;t.unstable_now=function(){return D.now()}}else{var U=Date,M=U.now();t.unstable_now=function(){return U.now()-M}}var E=1073741823,L=-1,R=250,z=5e3,ee=1e4,O=E,I=[],F=[],V=1,W=null,j=_,Y=!1,X=!1,ne=!1,A=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function H(Ve){for(var tt=a(F);tt!==null;){if(tt.callback===null)l(F);else if(tt.startTime<=Ve)l(F),tt.sortIndex=tt.expirationTime,s(I,tt);else return;tt=a(F)}}function K(Ve){if(ne=!1,H(Ve),!X)if(a(I)!==null)X=!0,sr(ae);else{var tt=a(F);tt!==null&&Ft(K,tt.startTime-Ve)}}function ae(Ve,tt){X=!1,ne&&(ne=!1,Sn()),Y=!0;var St=j;try{var dt;if(!e)return ie(Ve,tt)}finally{W=null,j=St,Y=!1}}function ie(Ve,tt){var St=tt;for(H(St),W=a(I);W!==null&&!(W.expirationTime>St&&(!Ve||Ee()));){var dt=W.callback;if(typeof dt=="function"){W.callback=null,j=W.priorityLevel;var gn=W.expirationTime<=St,Gn=dt(gn);St=t.unstable_now(),typeof Gn=="function"?W.callback=Gn:W===a(I)&&l(I),H(St)}else l(I);W=a(I)}if(W!==null)return!0;var ct=a(F);return ct!==null&&Ft(K,ct.startTime-St),!1}function de(Ve,tt){switch(Ve){case h:case y:case _:case S:case x:break;default:Ve=_}var St=j;j=Ve;try{return tt()}finally{j=St}}function fe(Ve){var tt;switch(j){case h:case y:case _:tt=_;break;default:tt=j;break}var St=j;j=tt;try{return Ve()}finally{j=St}}function se(Ve){var tt=j;return function(){var St=j;j=tt;try{return Ve.apply(this,arguments)}finally{j=St}}}function q(Ve,tt,St){var dt=t.unstable_now(),gn;if(typeof St=="object"&&St!==null){var Gn=St.delay;typeof Gn=="number"&&Gn>0?gn=dt+Gn:gn=dt}else gn=dt;var ct;switch(Ve){case h:ct=L;break;case y:ct=R;break;case x:ct=O;break;case S:ct=ee;break;case _:default:ct=z;break}var at=gn+ct,cn={id:V++,callback:tt,priorityLevel:Ve,startTime:gn,expirationTime:at,sortIndex:-1};return gn>dt?(cn.sortIndex=gn,s(F,cn),a(I)===null&&cn===a(F)&&(ne?Sn():ne=!0,Ft(K,gn-dt))):(cn.sortIndex=at,s(I,cn),!X&&!Y&&(X=!0,sr(ae))),cn}function oe(){}function ye(){!X&&!Y&&(X=!0,sr(ae))}function ke(){return a(I)}function Ae(Ve){Ve.callback=null}function Me(){return j}var be=!1,He=null,$e=-1,Ct=n,le=-1;function Ee(){var Ve=t.unstable_now()-le;return!(Ve<Ct)}function yt(){}function xt(Ve){if(Ve<0||Ve>125){console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");return}Ve>0?Ct=Math.floor(1e3/Ve):Ct=n}var Et=function(){if(He!==null){var Ve=t.unstable_now();le=Ve;var tt=!0,St=!0;try{St=He(tt,Ve)}finally{St?Pt():(be=!1,He=null)}}else be=!1},Pt;if(typeof Q=="function")Pt=function(){Q(Et)};else if(typeof MessageChannel<"u"){var On=new MessageChannel,kn=On.port2;On.port1.onmessage=Et,Pt=function(){kn.postMessage(null)}}else Pt=function(){A(Et,0)};function sr(Ve){He=Ve,be||(be=!0,Pt())}function Ft(Ve,tt){$e=A(function(){Ve(t.unstable_now())},tt)}function Sn(){B($e),$e=-1}var dn=yt,mr=null;t.unstable_IdlePriority=x,t.unstable_ImmediatePriority=h,t.unstable_LowPriority=S,t.unstable_NormalPriority=_,t.unstable_Profiling=mr,t.unstable_UserBlockingPriority=y,t.unstable_cancelCallback=Ae,t.unstable_continueExecution=ye,t.unstable_forceFrameRate=xt,t.unstable_getCurrentPriorityLevel=Me,t.unstable_getFirstCallbackNode=ke,t.unstable_next=fe,t.unstable_pauseExecution=oe,t.unstable_requestPaint=dn,t.unstable_runWithPriority=de,t.unstable_scheduleCallback=q,t.unstable_shouldYield=Ee,t.unstable_wrapCallback=se,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})()})(_m)),_m}var G_;function xm(){return G_||(G_=1,process.env.NODE_ENV==="production"?Kp.exports=P8():Kp.exports=O8()),Kp.exports}/**
|
|
19
|
+
* @license React
|
|
20
|
+
* react-reconciler.production.min.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var wm,V_;function I8(){return V_||(V_=1,wm=function(e){var n={},s=te,a=xm(),l=Object.assign;function u(o){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+o,m=1;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var d=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,p=Symbol.for("react.element"),h=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),w=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),L=Symbol.for("react.offscreen"),R=Symbol.iterator;function z(o){return o===null||typeof o!="object"?null:(o=R&&o[R]||o["@@iterator"],typeof o=="function"?o:null)}function ee(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case y:return"Fragment";case h:return"Portal";case S:return"Profiler";case _:return"StrictMode";case D:return"Suspense";case U:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case w:return(o.displayName||"Context")+".Consumer";case x:return(o._context.displayName||"Context")+".Provider";case C:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case M:return c=o.displayName||null,c!==null?c:ee(o.type)||"Memo";case E:c=o._payload,o=o._init;try{return ee(o(c))}catch{}}return null}function O(o){var c=o.type;switch(o.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=c.render,o=o.displayName||o.name||"",c.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ee(c);case 8:return c===_?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function I(o){var c=o,m=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(m=c.return),o=c.return;while(o)}return c.tag===3?m:null}function F(o){if(I(o)!==o)throw Error(u(188))}function V(o){var c=o.alternate;if(!c){if(c=I(o),c===null)throw Error(u(188));return c!==o?null:o}for(var m=o,b=c;;){var k=m.return;if(k===null)break;var N=k.alternate;if(N===null){if(b=k.return,b!==null){m=b;continue}break}if(k.child===N.child){for(N=k.child;N;){if(N===m)return F(k),o;if(N===b)return F(k),c;N=N.sibling}throw Error(u(188))}if(m.return!==b.return)m=k,b=N;else{for(var $=!1,pe=k.child;pe;){if(pe===m){$=!0,m=k,b=N;break}if(pe===b){$=!0,b=k,m=N;break}pe=pe.sibling}if(!$){for(pe=N.child;pe;){if(pe===m){$=!0,m=N,b=k;break}if(pe===b){$=!0,b=N,m=k;break}pe=pe.sibling}if(!$)throw Error(u(189))}}if(m.alternate!==b)throw Error(u(190))}if(m.tag!==3)throw Error(u(188));return m.stateNode.current===m?o:c}function W(o){return o=V(o),o!==null?j(o):null}function j(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var c=j(o);if(c!==null)return c;o=o.sibling}return null}function Y(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){if(o.tag!==4){var c=Y(o);if(c!==null)return c}o=o.sibling}return null}var X=Array.isArray,ne=e.getPublicInstance,A=e.getRootHostContext,B=e.getChildHostContext,Q=e.prepareForCommit,H=e.resetAfterCommit,K=e.createInstance,ae=e.appendInitialChild,ie=e.finalizeInitialChildren,de=e.prepareUpdate,fe=e.shouldSetTextContent,se=e.createTextInstance,q=e.scheduleTimeout,oe=e.cancelTimeout,ye=e.noTimeout,ke=e.isPrimaryRenderer,Ae=e.supportsMutation,Me=e.supportsPersistence,be=e.supportsHydration,He=e.getInstanceFromNode,$e=e.preparePortalMount,Ct=e.getCurrentEventPriority,le=e.detachDeletedInstance,Ee=e.supportsMicrotasks,yt=e.scheduleMicrotask,xt=e.supportsTestSelectors,Et=e.findFiberRoot,Pt=e.getBoundingRect,On=e.getTextContent,kn=e.isHiddenSubtree,sr=e.matchAccessibilityRole,Ft=e.setFocusIfFocusable,Sn=e.setupIntersectionObserver,dn=e.appendChild,mr=e.appendChildToContainer,Ve=e.commitTextUpdate,tt=e.commitMount,St=e.commitUpdate,dt=e.insertBefore,gn=e.insertInContainerBefore,Gn=e.removeChild,ct=e.removeChildFromContainer,at=e.resetTextContent,cn=e.hideInstance,un=e.hideTextInstance,Ot=e.unhideInstance,Hi=e.unhideTextInstance,Ca=e.clearContainer,yc=e.cloneInstance,Lt=e.createContainerChildSet,mi=e.appendChildToContainerChildSet,Gi=e.finalizeContainerChildren,ns=e.replaceContainerChildren,vi=e.cloneHiddenInstance,ni=e.cloneHiddenTextInstance,Xs=e.canHydrateInstance,mc=e.canHydrateTextInstance,Mh=e.canHydrateSuspenseInstance,Ta=e.isSuspenseInstancePending,Zn=e.isSuspenseInstanceFallback,vc=e.getSuspenseInstanceFallbackErrorDetails,yo=e.registerSuspenseInstanceRetry,qs=e.getNextHydratableSibling,Ts=e.getFirstHydratableChild,mo=e.getFirstHydratableChildWithinContainer,rs=e.getFirstHydratableChildWithinSuspenseInstance,hl=e.hydrateInstance,pl=e.hydrateTextInstance,vo=e.hydrateSuspenseInstance,So=e.getNextHydratableInstanceAfterSuspenseInstance,Ks=e.commitHydratedContainer,ri=e.commitHydratedSuspenseInstance,Sc=e.clearSuspenseBoundary,ka=e.clearSuspenseBoundaryFromContainer,ks=e.shouldDeleteUnhydratedTailInstances,Nu=e.didNotMatchHydratedContainerTextInstance,_o=e.didNotMatchHydratedTextInstance,xo;function Ms(o){if(xo===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);xo=c&&c[1]||""}return`
|
|
27
|
+
`+xo+o}var Qs=!1;function wo(o,c){if(!o||Qs)return"";Qs=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(Ye){var b=Ye}Reflect.construct(o,[],c)}else{try{c.call()}catch(Ye){b=Ye}o.call(c.prototype)}else{try{throw Error()}catch(Ye){b=Ye}o()}}catch(Ye){if(Ye&&b&&typeof Ye.stack=="string"){for(var k=Ye.stack.split(`
|
|
28
|
+
`),N=b.stack.split(`
|
|
29
|
+
`),$=k.length-1,pe=N.length-1;1<=$&&0<=pe&&k[$]!==N[pe];)pe--;for(;1<=$&&0<=pe;$--,pe--)if(k[$]!==N[pe]){if($!==1||pe!==1)do if($--,pe--,0>pe||k[$]!==N[pe]){var xe=`
|
|
30
|
+
`+k[$].replace(" at new "," at ");return o.displayName&&xe.includes("<anonymous>")&&(xe=xe.replace("<anonymous>",o.displayName)),xe}while(1<=$&&0<=pe);break}}}finally{Qs=!1,Error.prepareStackTrace=m}return(o=o?o.displayName||o.name:"")?Ms(o):""}var _c=Object.prototype.hasOwnProperty,gl=[],Vn=-1;function Si(o){return{current:o}}function yn(o){0>Vn||(o.current=gl[Vn],gl[Vn]=null,Vn--)}function fn(o,c){Vn++,gl[Vn]=o.current,o.current=c}var Ds={},$n=Si(Ds),vr=Si(!1),is=Ds;function Js(o,c){var m=o.type.contextTypes;if(!m)return Ds;var b=o.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===c)return b.__reactInternalMemoizedMaskedChildContext;var k={},N;for(N in m)k[N]=c[N];return b&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=c,o.__reactInternalMemoizedMaskedChildContext=k),k}function Sr(o){return o=o.childContextTypes,o!=null}function Ma(){yn(vr),yn($n)}function xc(o,c,m){if($n.current!==Ds)throw Error(u(168));fn($n,c),fn(vr,m)}function yl(o,c,m){var b=o.stateNode;if(c=c.childContextTypes,typeof b.getChildContext!="function")return m;b=b.getChildContext();for(var k in b)if(!(k in c))throw Error(u(108,O(o)||"Unknown",k));return l({},m,b)}function ue(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Ds,is=$n.current,fn($n,o),fn(vr,vr.current),!0}function Ce(o,c,m){var b=o.stateNode;if(!b)throw Error(u(169));m?(o=yl(o,c,is),b.__reactInternalMemoizedMergedChildContext=o,yn(vr),yn($n),fn($n,o)):yn(vr),fn(vr,m)}var Oe=Math.clz32?Math.clz32:Xe,Ue=Math.log,Ge=Math.LN2;function Xe(o){return o>>>=0,o===0?32:31-(Ue(o)/Ge|0)|0}var Pe=64,ze=4194304;function je(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function rt(o,c){var m=o.pendingLanes;if(m===0)return 0;var b=0,k=o.suspendedLanes,N=o.pingedLanes,$=m&268435455;if($!==0){var pe=$&~k;pe!==0?b=je(pe):(N&=$,N!==0&&(b=je(N)))}else $=m&~k,$!==0?b=je($):N!==0&&(b=je(N));if(b===0)return 0;if(c!==0&&c!==b&&(c&k)===0&&(k=b&-b,N=c&-c,k>=N||k===16&&(N&4194240)!==0))return c;if((b&4)!==0&&(b|=m&16),c=o.entangledLanes,c!==0)for(o=o.entanglements,c&=b;0<c;)m=31-Oe(c),k=1<<m,b|=o[m],c&=~k;return b}function ot(o,c){switch(o){case 1:case 2:case 4:return c+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ft(o,c){for(var m=o.suspendedLanes,b=o.pingedLanes,k=o.expirationTimes,N=o.pendingLanes;0<N;){var $=31-Oe(N),pe=1<<$,xe=k[$];xe===-1?((pe&m)===0||(pe&b)!==0)&&(k[$]=ot(pe,c)):xe<=c&&(o.expiredLanes|=pe),N&=~pe}}function pt(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Ht(){var o=Pe;return Pe<<=1,(Pe&4194240)===0&&(Pe=64),o}function Wt(o){for(var c=[],m=0;31>m;m++)c.push(o);return c}function _n(o,c,m){o.pendingLanes|=c,c!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,c=31-Oe(c),o[c]=m}function Yn(o,c){var m=o.pendingLanes&~c;o.pendingLanes=c,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=c,o.mutableReadLanes&=c,o.entangledLanes&=c,c=o.entanglements;var b=o.eventTimes;for(o=o.expirationTimes;0<m;){var k=31-Oe(m),N=1<<k;c[k]=0,b[k]=-1,o[k]=-1,m&=~N}}function Yt(o,c){var m=o.entangledLanes|=c;for(o=o.entanglements;m;){var b=31-Oe(m),k=1<<b;k&c|o[b]&c&&(o[b]|=c),m&=~k}}var At=0;function _r(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var As=a.unstable_scheduleCallback,Da=a.unstable_cancelCallback,ml=a.unstable_shouldYield,wc=a.unstable_requestPaint,Ln=a.unstable_now,bo=a.unstable_ImmediatePriority,vl=a.unstable_UserBlockingPriority,Dh=a.unstable_NormalPriority,d1=a.unstable_IdlePriority,Pu=null,ss=null;function f1(o){if(ss&&typeof ss.onCommitFiberRoot=="function")try{ss.onCommitFiberRoot(Pu,o,void 0,(o.current.flags&128)===128)}catch{}}function h1(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var as=typeof Object.is=="function"?Object.is:h1,Zs=null,Ou=!1,Ah=!1;function Rh(o){Zs===null?Zs=[o]:Zs.push(o)}function u0(o){Ou=!0,Rh(o)}function Rs(){if(!Ah&&Zs!==null){Ah=!0;var o=0,c=At;try{var m=Zs;for(At=1;o<m.length;o++){var b=m[o];do b=b(!0);while(b!==null)}Zs=null,Ou=!1}catch(k){throw Zs!==null&&(Zs=Zs.slice(o+1)),As(bo,Rs),k}finally{At=c,Ah=!1}}return null}var Aa=[],Eo=0,bc=null,Iu=0,Vi=[],Yi=0,Ra=null,os=1,$s="";function Co(o,c){Aa[Eo++]=Iu,Aa[Eo++]=bc,bc=o,Iu=c}function Ec(o,c,m){Vi[Yi++]=os,Vi[Yi++]=$s,Vi[Yi++]=Ra,Ra=o;var b=os;o=$s;var k=32-Oe(b)-1;b&=~(1<<k),m+=1;var N=32-Oe(c)+k;if(30<N){var $=k-k%5;N=(b&(1<<$)-1).toString(32),b>>=$,k-=$,os=1<<32-Oe(c)+k|m<<k|b,$s=N+o}else os=1<<N|m<<k|b,$s=o}function Lh(o){o.return!==null&&(Co(o,1),Ec(o,1,0))}function Nh(o){for(;o===bc;)bc=Aa[--Eo],Aa[Eo]=null,Iu=Aa[--Eo],Aa[Eo]=null;for(;o===Ra;)Ra=Vi[--Yi],Vi[Yi]=null,$s=Vi[--Yi],Vi[Yi]=null,os=Vi[--Yi],Vi[Yi]=null}var _i=null,ji=null,Mn=!1,Cc=!1,ls=null;function d0(o,c){var m=Ai(5,null,null,0);m.elementType="DELETED",m.stateNode=c,m.return=o,c=o.deletions,c===null?(o.deletions=[m],o.flags|=16):c.push(m)}function f0(o,c){switch(o.tag){case 5:return c=Xs(c,o.type,o.pendingProps),c!==null?(o.stateNode=c,_i=o,ji=Ts(c),!0):!1;case 6:return c=mc(c,o.pendingProps),c!==null?(o.stateNode=c,_i=o,ji=null,!0):!1;case 13:if(c=Mh(c),c!==null){var m=Ra!==null?{id:os,overflow:$s}:null;return o.memoizedState={dehydrated:c,treeContext:m,retryLane:1073741824},m=Ai(18,null,null,0),m.stateNode=c,m.return=o,o.child=m,_i=o,ji=null,!0}return!1;default:return!1}}function Ph(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Oh(o){if(Mn){var c=ji;if(c){var m=c;if(!f0(o,c)){if(Ph(o))throw Error(u(418));c=qs(m);var b=_i;c&&f0(o,c)?d0(b,m):(o.flags=o.flags&-4097|2,Mn=!1,_i=o)}}else{if(Ph(o))throw Error(u(418));o.flags=o.flags&-4097|2,Mn=!1,_i=o}}}function h0(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;_i=o}function Fu(o){if(!be||o!==_i)return!1;if(!Mn)return h0(o),Mn=!0,!1;if(o.tag!==3&&(o.tag!==5||ks(o.type)&&!fe(o.type,o.memoizedProps))){var c=ji;if(c){if(Ph(o))throw p0(),Error(u(418));for(;c;)d0(o,c),c=qs(c)}}if(h0(o),o.tag===13){if(!be)throw Error(u(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(u(317));ji=So(o)}else ji=_i?qs(o.stateNode):null;return!0}function p0(){for(var o=ji;o;)o=qs(o)}function Sl(){be&&(ji=_i=null,Cc=Mn=!1)}function Ih(o){ls===null?ls=[o]:ls.push(o)}var p1=d.ReactCurrentBatchConfig;function Uu(o,c){if(as(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var m=Object.keys(o),b=Object.keys(c);if(m.length!==b.length)return!1;for(b=0;b<m.length;b++){var k=m[b];if(!_c.call(c,k)||!as(o[k],c[k]))return!1}return!0}function g1(o){switch(o.tag){case 5:return Ms(o.type);case 16:return Ms("Lazy");case 13:return Ms("Suspense");case 19:return Ms("SuspenseList");case 0:case 2:case 15:return o=wo(o.type,!1),o;case 11:return o=wo(o.type.render,!1),o;case 1:return o=wo(o.type,!0),o;default:return""}}function Tc(o,c,m){if(o=m.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(m._owner){if(m=m._owner,m){if(m.tag!==1)throw Error(u(309));var b=m.stateNode}if(!b)throw Error(u(147,o));var k=b,N=""+o;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===N?c.ref:(c=function($){var pe=k.refs;$===null?delete pe[N]:pe[N]=$},c._stringRef=N,c)}if(typeof o!="string")throw Error(u(284));if(!m._owner)throw Error(u(290,o))}return o}function Bu(o,c){throw o=Object.prototype.toString.call(c),Error(u(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o))}function g0(o){var c=o._init;return c(o._payload)}function y0(o){function c(ve,he){if(o){var Te=ve.deletions;Te===null?(ve.deletions=[he],ve.flags|=16):Te.push(he)}}function m(ve,he){if(!o)return null;for(;he!==null;)c(ve,he),he=he.sibling;return null}function b(ve,he){for(ve=new Map;he!==null;)he.key!==null?ve.set(he.key,he):ve.set(he.index,he),he=he.sibling;return ve}function k(ve,he){return ve=sa(ve,he),ve.index=0,ve.sibling=null,ve}function N(ve,he,Te){return ve.index=Te,o?(Te=ve.alternate,Te!==null?(Te=Te.index,Te<he?(ve.flags|=2,he):Te):(ve.flags|=2,he)):(ve.flags|=1048576,he)}function $(ve){return o&&ve.alternate===null&&(ve.flags|=2),ve}function pe(ve,he,Te,Qe){return he===null||he.tag!==6?(he=Vc(Te,ve.mode,Qe),he.return=ve,he):(he=k(he,Te),he.return=ve,he)}function xe(ve,he,Te,Qe){var gt=Te.type;return gt===y?Ke(ve,he,Te.props.children,Qe,Te.key):he!==null&&(he.elementType===gt||typeof gt=="object"&>!==null&>.$$typeof===E&&g0(gt)===he.type)?(Qe=k(he,Te.props),Qe.ref=Tc(ve,he,Te),Qe.return=ve,Qe):(Qe=Gc(Te.type,Te.key,Te.props,null,ve.mode,Qe),Qe.ref=Tc(ve,he,Te),Qe.return=ve,Qe)}function Ye(ve,he,Te,Qe){return he===null||he.tag!==4||he.stateNode.containerInfo!==Te.containerInfo||he.stateNode.implementation!==Te.implementation?(he=ap(Te,ve.mode,Qe),he.return=ve,he):(he=k(he,Te.children||[]),he.return=ve,he)}function Ke(ve,he,Te,Qe,gt){return he===null||he.tag!==7?(he=aa(Te,ve.mode,Qe,gt),he.return=ve,he):(he=k(he,Te),he.return=ve,he)}function kt(ve,he,Te){if(typeof he=="string"&&he!==""||typeof he=="number")return he=Vc(""+he,ve.mode,Te),he.return=ve,he;if(typeof he=="object"&&he!==null){switch(he.$$typeof){case p:return Te=Gc(he.type,he.key,he.props,null,ve.mode,Te),Te.ref=Tc(ve,null,he),Te.return=ve,Te;case h:return he=ap(he,ve.mode,Te),he.return=ve,he;case E:var Qe=he._init;return kt(ve,Qe(he._payload),Te)}if(X(he)||z(he))return he=aa(he,ve.mode,Te,null),he.return=ve,he;Bu(ve,he)}return null}function nt(ve,he,Te,Qe){var gt=he!==null?he.key:null;if(typeof Te=="string"&&Te!==""||typeof Te=="number")return gt!==null?null:pe(ve,he,""+Te,Qe);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case p:return Te.key===gt?xe(ve,he,Te,Qe):null;case h:return Te.key===gt?Ye(ve,he,Te,Qe):null;case E:return gt=Te._init,nt(ve,he,gt(Te._payload),Qe)}if(X(Te)||z(Te))return gt!==null?null:Ke(ve,he,Te,Qe,null);Bu(ve,Te)}return null}function En(ve,he,Te,Qe,gt){if(typeof Qe=="string"&&Qe!==""||typeof Qe=="number")return ve=ve.get(Te)||null,pe(he,ve,""+Qe,gt);if(typeof Qe=="object"&&Qe!==null){switch(Qe.$$typeof){case p:return ve=ve.get(Qe.key===null?Te:Qe.key)||null,xe(he,ve,Qe,gt);case h:return ve=ve.get(Qe.key===null?Te:Qe.key)||null,Ye(he,ve,Qe,gt);case E:var Nt=Qe._init;return En(ve,he,Te,Nt(Qe._payload),gt)}if(X(Qe)||z(Qe))return ve=ve.get(Te)||null,Ke(he,ve,Qe,gt,null);Bu(he,Qe)}return null}function Bt(ve,he,Te,Qe){for(var gt=null,Nt=null,Mt=he,qt=he=0,Nn=null;Mt!==null&&qt<Te.length;qt++){Mt.index>qt?(Nn=Mt,Mt=null):Nn=Mt.sibling;var Kt=nt(ve,Mt,Te[qt],Qe);if(Kt===null){Mt===null&&(Mt=Nn);break}o&&Mt&&Kt.alternate===null&&c(ve,Mt),he=N(Kt,he,qt),Nt===null?gt=Kt:Nt.sibling=Kt,Nt=Kt,Mt=Nn}if(qt===Te.length)return m(ve,Mt),Mn&&Co(ve,qt),gt;if(Mt===null){for(;qt<Te.length;qt++)Mt=kt(ve,Te[qt],Qe),Mt!==null&&(he=N(Mt,he,qt),Nt===null?gt=Mt:Nt.sibling=Mt,Nt=Mt);return Mn&&Co(ve,qt),gt}for(Mt=b(ve,Mt);qt<Te.length;qt++)Nn=En(Mt,ve,qt,Te[qt],Qe),Nn!==null&&(o&&Nn.alternate!==null&&Mt.delete(Nn.key===null?qt:Nn.key),he=N(Nn,he,qt),Nt===null?gt=Nn:Nt.sibling=Nn,Nt=Nn);return o&&Mt.forEach(function(di){return c(ve,di)}),Mn&&Co(ve,qt),gt}function en(ve,he,Te,Qe){var gt=z(Te);if(typeof gt!="function")throw Error(u(150));if(Te=gt.call(Te),Te==null)throw Error(u(151));for(var Nt=gt=null,Mt=he,qt=he=0,Nn=null,Kt=Te.next();Mt!==null&&!Kt.done;qt++,Kt=Te.next()){Mt.index>qt?(Nn=Mt,Mt=null):Nn=Mt.sibling;var di=nt(ve,Mt,Kt.value,Qe);if(di===null){Mt===null&&(Mt=Nn);break}o&&Mt&&di.alternate===null&&c(ve,Mt),he=N(di,he,qt),Nt===null?gt=di:Nt.sibling=di,Nt=di,Mt=Nn}if(Kt.done)return m(ve,Mt),Mn&&Co(ve,qt),gt;if(Mt===null){for(;!Kt.done;qt++,Kt=Te.next())Kt=kt(ve,Kt.value,Qe),Kt!==null&&(he=N(Kt,he,qt),Nt===null?gt=Kt:Nt.sibling=Kt,Nt=Kt);return Mn&&Co(ve,qt),gt}for(Mt=b(ve,Mt);!Kt.done;qt++,Kt=Te.next())Kt=En(Mt,ve,qt,Kt.value,Qe),Kt!==null&&(o&&Kt.alternate!==null&&Mt.delete(Kt.key===null?qt:Kt.key),he=N(Kt,he,qt),Nt===null?gt=Kt:Nt.sibling=Kt,Nt=Kt);return o&&Mt.forEach(function(Ld){return c(ve,Ld)}),Mn&&Co(ve,qt),gt}function oa(ve,he,Te,Qe){if(typeof Te=="object"&&Te!==null&&Te.type===y&&Te.key===null&&(Te=Te.props.children),typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case p:e:{for(var gt=Te.key,Nt=he;Nt!==null;){if(Nt.key===gt){if(gt=Te.type,gt===y){if(Nt.tag===7){m(ve,Nt.sibling),he=k(Nt,Te.props.children),he.return=ve,ve=he;break e}}else if(Nt.elementType===gt||typeof gt=="object"&>!==null&>.$$typeof===E&&g0(gt)===Nt.type){m(ve,Nt.sibling),he=k(Nt,Te.props),he.ref=Tc(ve,Nt,Te),he.return=ve,ve=he;break e}m(ve,Nt);break}else c(ve,Nt);Nt=Nt.sibling}Te.type===y?(he=aa(Te.props.children,ve.mode,Qe,Te.key),he.return=ve,ve=he):(Qe=Gc(Te.type,Te.key,Te.props,null,ve.mode,Qe),Qe.ref=Tc(ve,he,Te),Qe.return=ve,ve=Qe)}return $(ve);case h:e:{for(Nt=Te.key;he!==null;){if(he.key===Nt)if(he.tag===4&&he.stateNode.containerInfo===Te.containerInfo&&he.stateNode.implementation===Te.implementation){m(ve,he.sibling),he=k(he,Te.children||[]),he.return=ve,ve=he;break e}else{m(ve,he);break}else c(ve,he);he=he.sibling}he=ap(Te,ve.mode,Qe),he.return=ve,ve=he}return $(ve);case E:return Nt=Te._init,oa(ve,he,Nt(Te._payload),Qe)}if(X(Te))return Bt(ve,he,Te,Qe);if(z(Te))return en(ve,he,Te,Qe);Bu(ve,Te)}return typeof Te=="string"&&Te!==""||typeof Te=="number"?(Te=""+Te,he!==null&&he.tag===6?(m(ve,he.sibling),he=k(he,Te),he.return=ve,ve=he):(m(ve,he),he=Vc(Te,ve.mode,Qe),he.return=ve,ve=he),$(ve)):m(ve,he)}return oa}var _l=y0(!0),m0=y0(!1),zu=Si(null),Hu=null,Ls=null,Gu=null;function Vu(){Gu=Ls=Hu=null}function Fh(o,c,m){ke?(fn(zu,c._currentValue),c._currentValue=m):(fn(zu,c._currentValue2),c._currentValue2=m)}function Yu(o){var c=zu.current;yn(zu),ke?o._currentValue=c:o._currentValue2=c}function ju(o,c,m){for(;o!==null;){var b=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,b!==null&&(b.childLanes|=c)):b!==null&&(b.childLanes&c)!==c&&(b.childLanes|=c),o===m)break;o=o.return}}function To(o,c){Hu=o,Gu=Ls=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&c)!==0&&(or=!0),o.firstContext=null)}function xi(o){var c=ke?o._currentValue:o._currentValue2;if(Gu!==o)if(o={context:o,memoizedValue:c,next:null},Ls===null){if(Hu===null)throw Error(u(308));Ls=o,Hu.dependencies={lanes:0,firstContext:o}}else Ls=Ls.next=o;return c}var La=null;function Uh(o){La===null?La=[o]:La.push(o)}function v0(o,c,m,b){var k=c.interleaved;return k===null?(m.next=m,Uh(c)):(m.next=k.next,k.next=m),c.interleaved=m,Wi(o,b)}function Wi(o,c){o.lanes|=c;var m=o.alternate;for(m!==null&&(m.lanes|=c),m=o,o=o.return;o!==null;)o.childLanes|=c,m=o.alternate,m!==null&&(m.childLanes|=c),m=o,o=o.return;return m.tag===3?m.stateNode:null}var Ns=!1;function Ps(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Wu(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Xi(o,c){return{eventTime:o,lane:c,tag:0,payload:null,callback:null,next:null}}function Na(o,c,m){var b=o.updateQueue;if(b===null)return null;if(b=b.shared,(Gt&2)!==0){var k=b.pending;return k===null?c.next=c:(c.next=k.next,k.next=c),b.pending=c,Wi(o,m)}return k=b.interleaved,k===null?(c.next=c,Uh(b)):(c.next=k.next,k.next=c),b.interleaved=c,Wi(o,m)}function xl(o,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194240)!==0)){var b=c.lanes;b&=o.pendingLanes,m|=b,c.lanes=m,Yt(o,m)}}function S0(o,c){var m=o.updateQueue,b=o.alternate;if(b!==null&&(b=b.updateQueue,m===b)){var k=null,N=null;if(m=m.firstBaseUpdate,m!==null){do{var $={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};N===null?k=N=$:N=N.next=$,m=m.next}while(m!==null);N===null?k=N=c:N=N.next=c}else k=N=c;m={baseState:b.baseState,firstBaseUpdate:k,lastBaseUpdate:N,shared:b.shared,effects:b.effects},o.updateQueue=m;return}o=m.lastBaseUpdate,o===null?m.firstBaseUpdate=c:o.next=c,m.lastBaseUpdate=c}function wl(o,c,m,b){var k=o.updateQueue;Ns=!1;var N=k.firstBaseUpdate,$=k.lastBaseUpdate,pe=k.shared.pending;if(pe!==null){k.shared.pending=null;var xe=pe,Ye=xe.next;xe.next=null,$===null?N=Ye:$.next=Ye,$=xe;var Ke=o.alternate;Ke!==null&&(Ke=Ke.updateQueue,pe=Ke.lastBaseUpdate,pe!==$&&(pe===null?Ke.firstBaseUpdate=Ye:pe.next=Ye,Ke.lastBaseUpdate=xe))}if(N!==null){var kt=k.baseState;$=0,Ke=Ye=xe=null,pe=N;do{var nt=pe.lane,En=pe.eventTime;if((b&nt)===nt){Ke!==null&&(Ke=Ke.next={eventTime:En,lane:0,tag:pe.tag,payload:pe.payload,callback:pe.callback,next:null});e:{var Bt=o,en=pe;switch(nt=c,En=m,en.tag){case 1:if(Bt=en.payload,typeof Bt=="function"){kt=Bt.call(En,kt,nt);break e}kt=Bt;break e;case 3:Bt.flags=Bt.flags&-65537|128;case 0:if(Bt=en.payload,nt=typeof Bt=="function"?Bt.call(En,kt,nt):Bt,nt==null)break e;kt=l({},kt,nt);break e;case 2:Ns=!0}}pe.callback!==null&&pe.lane!==0&&(o.flags|=64,nt=k.effects,nt===null?k.effects=[pe]:nt.push(pe))}else En={eventTime:En,lane:nt,tag:pe.tag,payload:pe.payload,callback:pe.callback,next:null},Ke===null?(Ye=Ke=En,xe=kt):Ke=Ke.next=En,$|=nt;if(pe=pe.next,pe===null){if(pe=k.shared.pending,pe===null)break;nt=pe,pe=nt.next,nt.next=null,k.lastBaseUpdate=nt,k.shared.pending=null}}while(!0);if(Ke===null&&(xe=kt),k.baseState=xe,k.firstBaseUpdate=Ye,k.lastBaseUpdate=Ke,c=k.shared.interleaved,c!==null){k=c;do $|=k.lane,k=k.next;while(k!==c)}else N===null&&(k.shared.lanes=0);zo|=$,o.lanes=$,o.memoizedState=kt}}function _0(o,c,m){if(o=c.effects,c.effects=null,o!==null)for(c=0;c<o.length;c++){var b=o[c],k=b.callback;if(k!==null){if(b.callback=null,b=m,typeof k!="function")throw Error(u(191,k));k.call(b)}}}var ko={},wi=Si(ko),bl=Si(ko),Mo=Si(ko);function bi(o){if(o===ko)throw Error(u(174));return o}function Ei(o,c){fn(Mo,c),fn(bl,o),fn(wi,ko),o=A(c),yn(wi),fn(wi,o)}function Pa(){yn(wi),yn(bl),yn(Mo)}function kc(o){var c=bi(Mo.current),m=bi(wi.current);c=B(m,o.type,c),m!==c&&(fn(bl,o),fn(wi,c))}function cs(o){bl.current===o&&(yn(wi),yn(bl))}var on=Si(0);function er(o){for(var c=o;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||Ta(m)||Zn(m)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var tr=[];function Mc(){for(var o=0;o<tr.length;o++){var c=tr[o];ke?c._workInProgressVersionPrimary=null:c._workInProgressVersionSecondary=null}tr.length=0}var Fr=d.ReactCurrentDispatcher,us=d.ReactCurrentBatchConfig,Ur=0,wn=null,Dn=null,nr=null,ea=!1,Oa=!1,ii=0,Xu=0;function ar(){throw Error(u(321))}function qu(o,c){if(c===null)return!1;for(var m=0;m<c.length&&m<o.length;m++)if(!as(o[m],c[m]))return!1;return!0}function Ku(o,c,m,b,k,N){if(Ur=N,wn=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Fr.current=o===null||o.memoizedState===null?Vh:Yh,o=m(b,k),Oa){N=0;do{if(Oa=!1,ii=0,25<=N)throw Error(u(301));N+=1,nr=Dn=null,c.updateQueue=null,Fr.current=jh,o=m(b,k)}while(Oa)}if(Fr.current=Tl,c=Dn!==null&&Dn.next!==null,Ur=0,nr=Dn=wn=null,ea=!1,c)throw Error(u(300));return o}function El(){var o=ii!==0;return ii=0,o}function ds(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nr===null?wn.memoizedState=nr=o:nr=nr.next=o,nr}function qi(){if(Dn===null){var o=wn.alternate;o=o!==null?o.memoizedState:null}else o=Dn.next;var c=nr===null?wn.memoizedState:nr.next;if(c!==null)nr=c,Dn=o;else{if(o===null)throw Error(u(310));Dn=o,o={memoizedState:Dn.memoizedState,baseState:Dn.baseState,baseQueue:Dn.baseQueue,queue:Dn.queue,next:null},nr===null?wn.memoizedState=nr=o:nr=nr.next=o}return nr}function Os(o,c){return typeof c=="function"?c(o):c}function Qu(o){var c=qi(),m=c.queue;if(m===null)throw Error(u(311));m.lastRenderedReducer=o;var b=Dn,k=b.baseQueue,N=m.pending;if(N!==null){if(k!==null){var $=k.next;k.next=N.next,N.next=$}b.baseQueue=k=N,m.pending=null}if(k!==null){N=k.next,b=b.baseState;var pe=$=null,xe=null,Ye=N;do{var Ke=Ye.lane;if((Ur&Ke)===Ke)xe!==null&&(xe=xe.next={lane:0,action:Ye.action,hasEagerState:Ye.hasEagerState,eagerState:Ye.eagerState,next:null}),b=Ye.hasEagerState?Ye.eagerState:o(b,Ye.action);else{var kt={lane:Ke,action:Ye.action,hasEagerState:Ye.hasEagerState,eagerState:Ye.eagerState,next:null};xe===null?(pe=xe=kt,$=b):xe=xe.next=kt,wn.lanes|=Ke,zo|=Ke}Ye=Ye.next}while(Ye!==null&&Ye!==N);xe===null?$=b:xe.next=pe,as(b,c.memoizedState)||(or=!0),c.memoizedState=b,c.baseState=$,c.baseQueue=xe,m.lastRenderedState=b}if(o=m.interleaved,o!==null){k=o;do N=k.lane,wn.lanes|=N,zo|=N,k=k.next;while(k!==o)}else k===null&&(m.lanes=0);return[c.memoizedState,m.dispatch]}function mt(o){var c=qi(),m=c.queue;if(m===null)throw Error(u(311));m.lastRenderedReducer=o;var b=m.dispatch,k=m.pending,N=c.memoizedState;if(k!==null){m.pending=null;var $=k=k.next;do N=o(N,$.action),$=$.next;while($!==k);as(N,c.memoizedState)||(or=!0),c.memoizedState=N,c.baseQueue===null&&(c.baseState=N),m.lastRenderedState=N}return[N,b]}function Xt(){}function an(o,c){var m=wn,b=qi(),k=c(),N=!as(b.memoizedState,k);if(N&&(b.memoizedState=k,or=!0),b=b.queue,hs(Bh.bind(null,m,b,o),[o]),b.getSnapshot!==c||N||nr!==null&&nr.memoizedState.tag&1){if(m.flags|=2048,Do(9,fs.bind(null,m,b,k,c),void 0,null),cr===null)throw Error(u(349));(Ur&30)!==0||An(m,c,k)}return k}function An(o,c,m){o.flags|=16384,o={getSnapshot:c,value:m},c=wn.updateQueue,c===null?(c={lastEffect:null,stores:null},wn.updateQueue=c,c.stores=[o]):(m=c.stores,m===null?c.stores=[o]:m.push(o))}function fs(o,c,m,b){c.value=m,c.getSnapshot=b,x0(c)&&w0(o)}function Bh(o,c,m){return m(function(){x0(c)&&w0(o)})}function x0(o){var c=o.getSnapshot;o=o.value;try{var m=c();return!as(o,m)}catch{return!0}}function w0(o){var c=Wi(o,1);c!==null&&Cr(c,o,1,-1)}function b0(o){var c=ds();return typeof o=="function"&&(o=o()),c.memoizedState=c.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Os,lastRenderedState:o},c.queue=o,o=o.dispatch=Gh.bind(null,wn,o),[c.memoizedState,o]}function Do(o,c,m,b){return o={tag:o,create:c,destroy:m,deps:b,next:null},c=wn.updateQueue,c===null?(c={lastEffect:null,stores:null},wn.updateQueue=c,c.lastEffect=o.next=o):(m=c.lastEffect,m===null?c.lastEffect=o.next=o:(b=m.next,m.next=o,o.next=b,c.lastEffect=o)),o}function Fe(){return qi().memoizedState}function In(o,c,m,b){var k=ds();wn.flags|=o,k.memoizedState=Do(1|c,m,void 0,b===void 0?null:b)}function wt(o,c,m,b){var k=qi();b=b===void 0?null:b;var N=void 0;if(Dn!==null){var $=Dn.memoizedState;if(N=$.destroy,b!==null&&qu(b,$.deps)){k.memoizedState=Do(c,m,N,b);return}}wn.flags|=o,k.memoizedState=Do(1|c,m,N,b)}function Ao(o,c){return In(8390656,8,o,c)}function hs(o,c){return wt(2048,8,o,c)}function Ia(o,c){return wt(4,2,o,c)}function ps(o,c){return wt(4,4,o,c)}function Cl(o,c){if(typeof c=="function")return o=o(),c(o),function(){c(null)};if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function Ro(o,c,m){return m=m!=null?m.concat([o]):null,wt(4,4,Cl.bind(null,c,o),m)}function Lo(){}function Ju(o,c){var m=qi();c=c===void 0?null:c;var b=m.memoizedState;return b!==null&&c!==null&&qu(c,b[1])?b[0]:(m.memoizedState=[o,c],o)}function Zu(o,c){var m=qi();c=c===void 0?null:c;var b=m.memoizedState;return b!==null&&c!==null&&qu(c,b[1])?b[0]:(o=o(),m.memoizedState=[o,c],o)}function $u(o,c,m){return(Ur&21)===0?(o.baseState&&(o.baseState=!1,or=!0),o.memoizedState=m):(as(m,c)||(m=Ht(),wn.lanes|=m,zo|=m,o.baseState=!0),c)}function zh(o,c){var m=At;At=m!==0&&4>m?m:4,o(!0);var b=us.transition;us.transition={};try{o(!1),c()}finally{At=m,us.transition=b}}function ed(){return qi().memoizedState}function Hh(o,c,m){var b=ra(o);if(m={lane:b,action:m,hasEagerState:!1,eagerState:null,next:null},td(o))nd(c,m);else if(m=v0(o,c,m,b),m!==null){var k=bn();Cr(m,o,b,k),rd(m,c,b)}}function Gh(o,c,m){var b=ra(o),k={lane:b,action:m,hasEagerState:!1,eagerState:null,next:null};if(td(o))nd(c,k);else{var N=o.alternate;if(o.lanes===0&&(N===null||N.lanes===0)&&(N=c.lastRenderedReducer,N!==null))try{var $=c.lastRenderedState,pe=N($,m);if(k.hasEagerState=!0,k.eagerState=pe,as(pe,$)){var xe=c.interleaved;xe===null?(k.next=k,Uh(c)):(k.next=xe.next,xe.next=k),c.interleaved=k;return}}catch{}finally{}m=v0(o,c,k,b),m!==null&&(k=bn(),Cr(m,o,b,k),rd(m,c,b))}}function td(o){var c=o.alternate;return o===wn||c!==null&&c===wn}function nd(o,c){Oa=ea=!0;var m=o.pending;m===null?c.next=c:(c.next=m.next,m.next=c),o.pending=c}function rd(o,c,m){if((m&4194240)!==0){var b=c.lanes;b&=o.pendingLanes,m|=b,c.lanes=m,Yt(o,m)}}var Tl={readContext:xi,useCallback:ar,useContext:ar,useEffect:ar,useImperativeHandle:ar,useInsertionEffect:ar,useLayoutEffect:ar,useMemo:ar,useReducer:ar,useRef:ar,useState:ar,useDebugValue:ar,useDeferredValue:ar,useTransition:ar,useMutableSource:ar,useSyncExternalStore:ar,useId:ar,unstable_isNewReconciler:!1},Vh={readContext:xi,useCallback:function(o,c){return ds().memoizedState=[o,c===void 0?null:c],o},useContext:xi,useEffect:Ao,useImperativeHandle:function(o,c,m){return m=m!=null?m.concat([o]):null,In(4194308,4,Cl.bind(null,c,o),m)},useLayoutEffect:function(o,c){return In(4194308,4,o,c)},useInsertionEffect:function(o,c){return In(4,2,o,c)},useMemo:function(o,c){var m=ds();return c=c===void 0?null:c,o=o(),m.memoizedState=[o,c],o},useReducer:function(o,c,m){var b=ds();return c=m!==void 0?m(c):c,b.memoizedState=b.baseState=c,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:c},b.queue=o,o=o.dispatch=Hh.bind(null,wn,o),[b.memoizedState,o]},useRef:function(o){var c=ds();return o={current:o},c.memoizedState=o},useState:b0,useDebugValue:Lo,useDeferredValue:function(o){return ds().memoizedState=o},useTransition:function(){var o=b0(!1),c=o[0];return o=zh.bind(null,o[1]),ds().memoizedState=o,[c,o]},useMutableSource:function(){},useSyncExternalStore:function(o,c,m){var b=wn,k=ds();if(Mn){if(m===void 0)throw Error(u(407));m=m()}else{if(m=c(),cr===null)throw Error(u(349));(Ur&30)!==0||An(b,c,m)}k.memoizedState=m;var N={value:m,getSnapshot:c};return k.queue=N,Ao(Bh.bind(null,b,N,o),[o]),b.flags|=2048,Do(9,fs.bind(null,b,N,m,c),void 0,null),m},useId:function(){var o=ds(),c=cr.identifierPrefix;if(Mn){var m=$s,b=os;m=(b&~(1<<32-Oe(b)-1)).toString(32)+m,c=":"+c+"R"+m,m=ii++,0<m&&(c+="H"+m.toString(32)),c+=":"}else m=Xu++,c=":"+c+"r"+m.toString(32)+":";return o.memoizedState=c},unstable_isNewReconciler:!1},Yh={readContext:xi,useCallback:Ju,useContext:xi,useEffect:hs,useImperativeHandle:Ro,useInsertionEffect:Ia,useLayoutEffect:ps,useMemo:Zu,useReducer:Qu,useRef:Fe,useState:function(){return Qu(Os)},useDebugValue:Lo,useDeferredValue:function(o){var c=qi();return $u(c,Dn.memoizedState,o)},useTransition:function(){var o=Qu(Os)[0],c=qi().memoizedState;return[o,c]},useMutableSource:Xt,useSyncExternalStore:an,useId:ed,unstable_isNewReconciler:!1},jh={readContext:xi,useCallback:Ju,useContext:xi,useEffect:hs,useImperativeHandle:Ro,useInsertionEffect:Ia,useLayoutEffect:ps,useMemo:Zu,useReducer:mt,useRef:Fe,useState:function(){return mt(Os)},useDebugValue:Lo,useDeferredValue:function(o){var c=qi();return Dn===null?c.memoizedState=o:$u(c,Dn.memoizedState,o)},useTransition:function(){var o=mt(Os)[0],c=qi().memoizedState;return[o,c]},useMutableSource:Xt,useSyncExternalStore:an,useId:ed,unstable_isNewReconciler:!1};function Ci(o,c){if(o&&o.defaultProps){c=l({},c),o=o.defaultProps;for(var m in o)c[m]===void 0&&(c[m]=o[m]);return c}return c}function kl(o,c,m,b){c=o.memoizedState,m=m(b,c),m=m==null?c:l({},c,m),o.memoizedState=m,o.lanes===0&&(o.updateQueue.baseState=m)}var ta={isMounted:function(o){return(o=o._reactInternals)?I(o)===o:!1},enqueueSetState:function(o,c,m){o=o._reactInternals;var b=bn(),k=ra(o),N=Xi(b,k);N.payload=c,m!=null&&(N.callback=m),c=Na(o,N,k),c!==null&&(Cr(c,o,k,b),xl(c,o,k))},enqueueReplaceState:function(o,c,m){o=o._reactInternals;var b=bn(),k=ra(o),N=Xi(b,k);N.tag=1,N.payload=c,m!=null&&(N.callback=m),c=Na(o,N,k),c!==null&&(Cr(c,o,k,b),xl(c,o,k))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var m=bn(),b=ra(o),k=Xi(m,b);k.tag=2,c!=null&&(k.callback=c),c=Na(o,k,b),c!==null&&(Cr(c,o,b,m),xl(c,o,b))}};function id(o,c,m,b,k,N,$){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(b,N,$):c.prototype&&c.prototype.isPureReactComponent?!Uu(m,b)||!Uu(k,N):!0}function sd(o,c,m){var b=!1,k=Ds,N=c.contextType;return typeof N=="object"&&N!==null?N=xi(N):(k=Sr(c)?is:$n.current,b=c.contextTypes,N=(b=b!=null)?Js(o,k):Ds),c=new c(m,N),o.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=ta,o.stateNode=c,c._reactInternals=o,b&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=k,o.__reactInternalMemoizedMaskedChildContext=N),c}function ad(o,c,m,b){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,b),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,b),c.state!==o&&ta.enqueueReplaceState(c,c.state,null)}function Dc(o,c,m,b){var k=o.stateNode;k.props=m,k.state=o.memoizedState,k.refs={},Ps(o);var N=c.contextType;typeof N=="object"&&N!==null?k.context=xi(N):(N=Sr(c)?is:$n.current,k.context=Js(o,N)),k.state=o.memoizedState,N=c.getDerivedStateFromProps,typeof N=="function"&&(kl(o,c,N,m),k.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(c=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),c!==k.state&&ta.enqueueReplaceState(k,k.state,null),wl(o,m,k,b),k.state=o.memoizedState),typeof k.componentDidMount=="function"&&(o.flags|=4194308)}function No(o,c){try{var m="",b=c;do m+=g1(b),b=b.return;while(b);var k=m}catch(N){k=`
|
|
31
|
+
Error generating stack: `+N.message+`
|
|
32
|
+
`+N.stack}return{value:o,source:c,stack:k,digest:null}}function Po(o,c,m){return{value:o,source:null,stack:m??null,digest:c??null}}function od(o,c){try{console.error(c.value)}catch(m){setTimeout(function(){throw m})}}var Ac=typeof WeakMap=="function"?WeakMap:Map;function Fa(o,c,m){m=Xi(-1,m),m.tag=3,m.payload={element:null};var b=c.value;return m.callback=function(){Ed||(Ed=!0,Bc=b),od(o,c)},m}function si(o,c,m){m=Xi(-1,m),m.tag=3;var b=o.type.getDerivedStateFromError;if(typeof b=="function"){var k=c.value;m.payload=function(){return b(k)},m.callback=function(){od(o,c)}}var N=o.stateNode;return N!==null&&typeof N.componentDidCatch=="function"&&(m.callback=function(){od(o,c),typeof b!="function"&&(Ha===null?Ha=new Set([this]):Ha.add(this));var $=c.stack;this.componentDidCatch(c.value,{componentStack:$!==null?$:""})}),m}function E0(o,c,m){var b=o.pingCache;if(b===null){b=o.pingCache=new Ac;var k=new Set;b.set(c,k)}else k=b.get(c),k===void 0&&(k=new Set,b.set(c,k));k.has(m)||(k.add(m),o=Va.bind(null,o,c,m),c.then(o,o))}function mn(o){do{var c;if((c=o.tag===13)&&(c=o.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return o;o=o.return}while(o!==null);return null}function Rc(o,c,m,b,k){return(o.mode&1)===0?(o===c?o.flags|=65536:(o.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(c=Xi(-1,1),c.tag=2,Na(m,c,1))),m.lanes|=1),o):(o.flags|=65536,o.lanes=k,o)}var ld=d.ReactCurrentOwner,or=!1;function lr(o,c,m,b){c.child=o===null?m0(c,null,m,b):_l(c,o.child,m,b)}function C0(o,c,m,b,k){m=m.render;var N=c.ref;return To(c,k),b=Ku(o,c,m,b,N,k),m=El(),o!==null&&!or?(c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~k,ai(o,c,k)):(Mn&&m&&Lh(c),c.flags|=1,lr(o,c,b,k),c.child)}function T0(o,c,m,b,k){if(o===null){var N=m.type;return typeof N=="function"&&!Ad(N)&&N.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(c.tag=15,c.type=N,k0(o,c,N,b,k)):(o=Gc(m.type,null,b,c,c.mode,k),o.ref=c.ref,o.return=c,c.child=o)}if(N=o.child,(o.lanes&k)===0){var $=N.memoizedProps;if(m=m.compare,m=m!==null?m:Uu,m($,b)&&o.ref===c.ref)return ai(o,c,k)}return c.flags|=1,o=sa(N,b),o.ref=c.ref,o.return=c,c.child=o}function k0(o,c,m,b,k){if(o!==null){var N=o.memoizedProps;if(Uu(N,b)&&o.ref===c.ref)if(or=!1,c.pendingProps=b=N,(o.lanes&k)!==0)(o.flags&131072)!==0&&(or=!0);else return c.lanes=o.lanes,ai(o,c,k)}return Wh(o,c,m,b,k)}function M0(o,c,m){var b=c.pendingProps,k=b.children,N=o!==null?o.memoizedState:null;if(b.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},fn(Bo,Mi),Mi|=m;else{if((m&1073741824)===0)return o=N!==null?N.baseLanes|m:m,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:o,cachePool:null,transitions:null},c.updateQueue=null,fn(Bo,Mi),Mi|=o,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=N!==null?N.baseLanes:m,fn(Bo,Mi),Mi|=b}else N!==null?(b=N.baseLanes|m,c.memoizedState=null):b=m,fn(Bo,Mi),Mi|=b;return lr(o,c,k,m),c.child}function cd(o,c){var m=c.ref;(o===null&&m!==null||o!==null&&o.ref!==m)&&(c.flags|=512,c.flags|=2097152)}function Wh(o,c,m,b,k){var N=Sr(m)?is:$n.current;return N=Js(c,N),To(c,k),m=Ku(o,c,m,b,N,k),b=El(),o!==null&&!or?(c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~k,ai(o,c,k)):(Mn&&b&&Lh(c),c.flags|=1,lr(o,c,m,k),c.child)}function ud(o,c,m,b,k){if(Sr(m)){var N=!0;ue(c)}else N=!1;if(To(c,k),c.stateNode===null)Br(o,c),sd(c,m,b),Dc(c,m,b,k),b=!0;else if(o===null){var $=c.stateNode,pe=c.memoizedProps;$.props=pe;var xe=$.context,Ye=m.contextType;typeof Ye=="object"&&Ye!==null?Ye=xi(Ye):(Ye=Sr(m)?is:$n.current,Ye=Js(c,Ye));var Ke=m.getDerivedStateFromProps,kt=typeof Ke=="function"||typeof $.getSnapshotBeforeUpdate=="function";kt||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(pe!==b||xe!==Ye)&&ad(c,$,b,Ye),Ns=!1;var nt=c.memoizedState;$.state=nt,wl(c,b,$,k),xe=c.memoizedState,pe!==b||nt!==xe||vr.current||Ns?(typeof Ke=="function"&&(kl(c,m,Ke,b),xe=c.memoizedState),(pe=Ns||id(c,m,pe,b,nt,xe,Ye))?(kt||typeof $.UNSAFE_componentWillMount!="function"&&typeof $.componentWillMount!="function"||(typeof $.componentWillMount=="function"&&$.componentWillMount(),typeof $.UNSAFE_componentWillMount=="function"&&$.UNSAFE_componentWillMount()),typeof $.componentDidMount=="function"&&(c.flags|=4194308)):(typeof $.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=xe),$.props=b,$.state=xe,$.context=Ye,b=pe):(typeof $.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{$=c.stateNode,Wu(o,c),pe=c.memoizedProps,Ye=c.type===c.elementType?pe:Ci(c.type,pe),$.props=Ye,kt=c.pendingProps,nt=$.context,xe=m.contextType,typeof xe=="object"&&xe!==null?xe=xi(xe):(xe=Sr(m)?is:$n.current,xe=Js(c,xe));var En=m.getDerivedStateFromProps;(Ke=typeof En=="function"||typeof $.getSnapshotBeforeUpdate=="function")||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(pe!==kt||nt!==xe)&&ad(c,$,b,xe),Ns=!1,nt=c.memoizedState,$.state=nt,wl(c,b,$,k);var Bt=c.memoizedState;pe!==kt||nt!==Bt||vr.current||Ns?(typeof En=="function"&&(kl(c,m,En,b),Bt=c.memoizedState),(Ye=Ns||id(c,m,Ye,b,nt,Bt,xe)||!1)?(Ke||typeof $.UNSAFE_componentWillUpdate!="function"&&typeof $.componentWillUpdate!="function"||(typeof $.componentWillUpdate=="function"&&$.componentWillUpdate(b,Bt,xe),typeof $.UNSAFE_componentWillUpdate=="function"&&$.UNSAFE_componentWillUpdate(b,Bt,xe)),typeof $.componentDidUpdate=="function"&&(c.flags|=4),typeof $.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof $.componentDidUpdate!="function"||pe===o.memoizedProps&&nt===o.memoizedState||(c.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||pe===o.memoizedProps&&nt===o.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=Bt),$.props=b,$.state=Bt,$.context=xe,b=Ye):(typeof $.componentDidUpdate!="function"||pe===o.memoizedProps&&nt===o.memoizedState||(c.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||pe===o.memoizedProps&&nt===o.memoizedState||(c.flags|=1024),b=!1)}return dd(o,c,m,b,N,k)}function dd(o,c,m,b,k,N){cd(o,c);var $=(c.flags&128)!==0;if(!b&&!$)return k&&Ce(c,m,!1),ai(o,c,N);b=c.stateNode,ld.current=c;var pe=$&&typeof m.getDerivedStateFromError!="function"?null:b.render();return c.flags|=1,o!==null&&$?(c.child=_l(c,o.child,null,N),c.child=_l(c,null,pe,N)):lr(o,c,pe,N),c.memoizedState=b.state,k&&Ce(c,m,!0),c.child}function D0(o){var c=o.stateNode;c.pendingContext?xc(o,c.pendingContext,c.pendingContext!==c.context):c.context&&xc(o,c.context,!1),Ei(o,c.containerInfo)}function A0(o,c,m,b,k){return Sl(),Ih(k),c.flags|=256,lr(o,c,m,b),c.child}var Ml={dehydrated:null,treeContext:null,retryLane:0};function Xh(o){return{baseLanes:o,cachePool:null,transitions:null}}function qh(o,c,m){var b=c.pendingProps,k=on.current,N=!1,$=(c.flags&128)!==0,pe;if((pe=$)||(pe=o!==null&&o.memoizedState===null?!1:(k&2)!==0),pe?(N=!0,c.flags&=-129):(o===null||o.memoizedState!==null)&&(k|=1),fn(on,k&1),o===null)return Oh(c),o=c.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((c.mode&1)===0?c.lanes=1:Zn(o)?c.lanes=8:c.lanes=1073741824,null):($=b.children,o=b.fallback,N?(b=c.mode,N=c.child,$={mode:"hidden",children:$},(b&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=$):N=Il($,b,0,null),o=aa(o,b,m,null),N.return=c,o.return=c,N.sibling=o,c.child=N,c.child.memoizedState=Xh(m),c.memoizedState=Ml,o):fd(c,$));if(k=o.memoizedState,k!==null&&(pe=k.dehydrated,pe!==null))return Oo(o,c,$,b,pe,k,m);if(N){N=b.fallback,$=c.mode,k=o.child,pe=k.sibling;var xe={mode:"hidden",children:b.children};return($&1)===0&&c.child!==k?(b=c.child,b.childLanes=0,b.pendingProps=xe,c.deletions=null):(b=sa(k,xe),b.subtreeFlags=k.subtreeFlags&14680064),pe!==null?N=sa(pe,N):(N=aa(N,$,m,null),N.flags|=2),N.return=c,b.return=c,b.sibling=N,c.child=b,b=N,N=c.child,$=o.child.memoizedState,$=$===null?Xh(m):{baseLanes:$.baseLanes|m,cachePool:null,transitions:$.transitions},N.memoizedState=$,N.childLanes=o.childLanes&~m,c.memoizedState=Ml,b}return N=o.child,o=N.sibling,b=sa(N,{mode:"visible",children:b.children}),(c.mode&1)===0&&(b.lanes=m),b.return=c,b.sibling=null,o!==null&&(m=c.deletions,m===null?(c.deletions=[o],c.flags|=16):m.push(o)),c.child=b,c.memoizedState=null,b}function fd(o,c){return c=Il({mode:"visible",children:c},o.mode,0,null),c.return=o,o.child=c}function hd(o,c,m,b){return b!==null&&Ih(b),_l(c,o.child,null,m),o=fd(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function Oo(o,c,m,b,k,N,$){if(m)return c.flags&256?(c.flags&=-257,b=Po(Error(u(422))),hd(o,c,$,b)):c.memoizedState!==null?(c.child=o.child,c.flags|=128,null):(N=b.fallback,k=c.mode,b=Il({mode:"visible",children:b.children},k,0,null),N=aa(N,k,$,null),N.flags|=2,b.return=c,N.return=c,b.sibling=N,c.child=b,(c.mode&1)!==0&&_l(c,o.child,null,$),c.child.memoizedState=Xh($),c.memoizedState=Ml,N);if((c.mode&1)===0)return hd(o,c,$,null);if(Zn(k))return b=vc(k).digest,N=Error(u(419)),b=Po(N,b,void 0),hd(o,c,$,b);if(m=($&o.childLanes)!==0,or||m){if(b=cr,b!==null){switch($&-$){case 4:k=2;break;case 16:k=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:k=32;break;case 536870912:k=268435456;break;default:k=0}k=(k&(b.suspendedLanes|$))!==0?0:k,k!==0&&k!==N.retryLane&&(N.retryLane=k,Wi(o,k),Cr(b,o,k,-1))}return kd(),b=Po(Error(u(421))),hd(o,c,$,b)}return Ta(k)?(c.flags|=128,c.child=o.child,c=S1.bind(null,o),yo(k,c),null):(o=N.treeContext,be&&(ji=rs(k),_i=c,Mn=!0,ls=null,Cc=!1,o!==null&&(Vi[Yi++]=os,Vi[Yi++]=$s,Vi[Yi++]=Ra,os=o.id,$s=o.overflow,Ra=c)),c=fd(c,b.children),c.flags|=4096,c)}function Dl(o,c,m){o.lanes|=c;var b=o.alternate;b!==null&&(b.lanes|=c),ju(o.return,c,m)}function na(o,c,m,b,k){var N=o.memoizedState;N===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:m,tailMode:k}:(N.isBackwards=c,N.rendering=null,N.renderingStartTime=0,N.last=b,N.tail=m,N.tailMode=k)}function pd(o,c,m){var b=c.pendingProps,k=b.revealOrder,N=b.tail;if(lr(o,c,b.children,m),b=on.current,(b&2)!==0)b=b&1|2,c.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Dl(o,m,c);else if(o.tag===19)Dl(o,m,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}b&=1}if(fn(on,b),(c.mode&1)===0)c.memoizedState=null;else switch(k){case"forwards":for(m=c.child,k=null;m!==null;)o=m.alternate,o!==null&&er(o)===null&&(k=m),m=m.sibling;m=k,m===null?(k=c.child,c.child=null):(k=m.sibling,m.sibling=null),na(c,!1,k,m,N);break;case"backwards":for(m=null,k=c.child,c.child=null;k!==null;){if(o=k.alternate,o!==null&&er(o)===null){c.child=k;break}o=k.sibling,k.sibling=m,m=k,k=o}na(c,!0,m,null,N);break;case"together":na(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Br(o,c){(c.mode&1)===0&&o!==null&&(o.alternate=null,c.alternate=null,c.flags|=2)}function ai(o,c,m){if(o!==null&&(c.dependencies=o.dependencies),zo|=c.lanes,(m&c.childLanes)===0)return null;if(o!==null&&c.child!==o.child)throw Error(u(153));if(c.child!==null){for(o=c.child,m=sa(o,o.pendingProps),c.child=m,m.return=c;o.sibling!==null;)o=o.sibling,m=m.sibling=sa(o,o.pendingProps),m.return=c;m.sibling=null}return c.child}function Ut(o,c,m){switch(c.tag){case 3:D0(c),Sl();break;case 5:kc(c);break;case 1:Sr(c.type)&&ue(c);break;case 4:Ei(c,c.stateNode.containerInfo);break;case 10:Fh(c,c.type._context,c.memoizedProps.value);break;case 13:var b=c.memoizedState;if(b!==null)return b.dehydrated!==null?(fn(on,on.current&1),c.flags|=128,null):(m&c.child.childLanes)!==0?qh(o,c,m):(fn(on,on.current&1),o=ai(o,c,m),o!==null?o.sibling:null);fn(on,on.current&1);break;case 19:if(b=(m&c.childLanes)!==0,(o.flags&128)!==0){if(b)return pd(o,c,m);c.flags|=128}var k=c.memoizedState;if(k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),fn(on,on.current),b)break;return null;case 22:case 23:return c.lanes=0,M0(o,c,m)}return ai(o,c,m)}function Ti(o){o.flags|=4}function Kh(o,c){if(o!==null&&o.child===c.child)return!0;if((c.flags&16)!==0)return!1;for(o=c.child;o!==null;){if((o.flags&12854)!==0||(o.subtreeFlags&12854)!==0)return!1;o=o.sibling}return!0}var gd,Lc,Al,Ua;if(Ae)gd=function(o,c){for(var m=c.child;m!==null;){if(m.tag===5||m.tag===6)ae(o,m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===c)break;for(;m.sibling===null;){if(m.return===null||m.return===c)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},Lc=function(){},Al=function(o,c,m,b,k){if(o=o.memoizedProps,o!==b){var N=c.stateNode,$=bi(wi.current);m=de(N,m,o,b,k,$),(c.updateQueue=m)&&Ti(c)}},Ua=function(o,c,m,b){m!==b&&Ti(c)};else if(Me){gd=function(o,c,m,b){for(var k=c.child;k!==null;){if(k.tag===5){var N=k.stateNode;m&&b&&(N=vi(N,k.type,k.memoizedProps,k)),ae(o,N)}else if(k.tag===6)N=k.stateNode,m&&b&&(N=ni(N,k.memoizedProps,k)),ae(o,N);else if(k.tag!==4){if(k.tag===22&&k.memoizedState!==null)N=k.child,N!==null&&(N.return=k),gd(o,k,!0,!0);else if(k.child!==null){k.child.return=k,k=k.child;continue}}if(k===c)break;for(;k.sibling===null;){if(k.return===null||k.return===c)return;k=k.return}k.sibling.return=k.return,k=k.sibling}};var R0=function(o,c,m,b){for(var k=c.child;k!==null;){if(k.tag===5){var N=k.stateNode;m&&b&&(N=vi(N,k.type,k.memoizedProps,k)),mi(o,N)}else if(k.tag===6)N=k.stateNode,m&&b&&(N=ni(N,k.memoizedProps,k)),mi(o,N);else if(k.tag!==4){if(k.tag===22&&k.memoizedState!==null)N=k.child,N!==null&&(N.return=k),R0(o,k,!0,!0);else if(k.child!==null){k.child.return=k,k=k.child;continue}}if(k===c)break;for(;k.sibling===null;){if(k.return===null||k.return===c)return;k=k.return}k.sibling.return=k.return,k=k.sibling}};Lc=function(o,c){var m=c.stateNode;if(!Kh(o,c)){o=m.containerInfo;var b=Lt(o);R0(b,c,!1,!1),m.pendingChildren=b,Ti(c),Gi(o,b)}},Al=function(o,c,m,b,k){var N=o.stateNode,$=o.memoizedProps;if((o=Kh(o,c))&&$===b)c.stateNode=N;else{var pe=c.stateNode,xe=bi(wi.current),Ye=null;$!==b&&(Ye=de(pe,m,$,b,k,xe)),o&&Ye===null?c.stateNode=N:(N=yc(N,Ye,m,$,b,c,o,pe),ie(N,m,b,k,xe)&&Ti(c),c.stateNode=N,o?Ti(c):gd(N,c,!1,!1))}},Ua=function(o,c,m,b){m!==b?(o=bi(Mo.current),m=bi(wi.current),c.stateNode=se(b,o,m,c),Ti(c)):c.stateNode=o.stateNode}}else Lc=function(){},Al=function(){},Ua=function(){};function Rl(o,c){if(!Mn)switch(o.tailMode){case"hidden":c=o.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o.tail=null:m.sibling=null;break;case"collapsed":m=o.tail;for(var b=null;m!==null;)m.alternate!==null&&(b=m),m=m.sibling;b===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:b.sibling=null}}function zr(o){var c=o.alternate!==null&&o.alternate.child===o.child,m=0,b=0;if(c)for(var k=o.child;k!==null;)m|=k.lanes|k.childLanes,b|=k.subtreeFlags&14680064,b|=k.flags&14680064,k.return=o,k=k.sibling;else for(k=o.child;k!==null;)m|=k.lanes|k.childLanes,b|=k.subtreeFlags,b|=k.flags,k.return=o,k=k.sibling;return o.subtreeFlags|=b,o.childLanes=m,c}function Qh(o,c,m){var b=c.pendingProps;switch(Nh(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zr(c),null;case 1:return Sr(c.type)&&Ma(),zr(c),null;case 3:return m=c.stateNode,Pa(),yn(vr),yn($n),Mc(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(o===null||o.child===null)&&(Fu(c)?Ti(c):o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,ls!==null&&(ci(ls),ls=null))),Lc(o,c),zr(c),null;case 5:cs(c),m=bi(Mo.current);var k=c.type;if(o!==null&&c.stateNode!=null)Al(o,c,k,b,m),o.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!b){if(c.stateNode===null)throw Error(u(166));return zr(c),null}if(o=bi(wi.current),Fu(c)){if(!be)throw Error(u(175));o=hl(c.stateNode,c.type,c.memoizedProps,m,o,c,!Cc),c.updateQueue=o,o!==null&&Ti(c)}else{var N=K(k,b,m,o,c);gd(N,c,!1,!1),c.stateNode=N,ie(N,k,b,m,o)&&Ti(c)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return zr(c),null;case 6:if(o&&c.stateNode!=null)Ua(o,c,o.memoizedProps,b);else{if(typeof b!="string"&&c.stateNode===null)throw Error(u(166));if(o=bi(Mo.current),m=bi(wi.current),Fu(c)){if(!be)throw Error(u(176));if(o=c.stateNode,m=c.memoizedProps,(b=pl(o,m,c,!Cc))&&(k=_i,k!==null))switch(k.tag){case 3:Nu(k.stateNode.containerInfo,o,m,(k.mode&1)!==0);break;case 5:_o(k.type,k.memoizedProps,k.stateNode,o,m,(k.mode&1)!==0)}b&&Ti(c)}else c.stateNode=se(b,o,m,c)}return zr(c),null;case 13:if(yn(on),b=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Mn&&ji!==null&&(c.mode&1)!==0&&(c.flags&128)===0)p0(),Sl(),c.flags|=98560,k=!1;else if(k=Fu(c),b!==null&&b.dehydrated!==null){if(o===null){if(!k)throw Error(u(318));if(!be)throw Error(u(344));if(k=c.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(u(317));vo(k,c)}else Sl(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;zr(c),k=!1}else ls!==null&&(ci(ls),ls=null),k=!0;if(!k)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=m,c):(m=b!==null,m!==(o!==null&&o.memoizedState!==null)&&m&&(c.child.flags|=8192,(c.mode&1)!==0&&(o===null||(on.current&1)!==0?qn===0&&(qn=3):kd())),c.updateQueue!==null&&(c.flags|=4),zr(c),null);case 4:return Pa(),Lc(o,c),o===null&&$e(c.stateNode.containerInfo),zr(c),null;case 10:return Yu(c.type._context),zr(c),null;case 17:return Sr(c.type)&&Ma(),zr(c),null;case 19:if(yn(on),k=c.memoizedState,k===null)return zr(c),null;if(b=(c.flags&128)!==0,N=k.rendering,N===null)if(b)Rl(k,!1);else{if(qn!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(N=er(o),N!==null){for(c.flags|=128,Rl(k,!1),o=N.updateQueue,o!==null&&(c.updateQueue=o,c.flags|=4),c.subtreeFlags=0,o=m,m=c.child;m!==null;)b=m,k=o,b.flags&=14680066,N=b.alternate,N===null?(b.childLanes=0,b.lanes=k,b.child=null,b.subtreeFlags=0,b.memoizedProps=null,b.memoizedState=null,b.updateQueue=null,b.dependencies=null,b.stateNode=null):(b.childLanes=N.childLanes,b.lanes=N.lanes,b.child=N.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=N.memoizedProps,b.memoizedState=N.memoizedState,b.updateQueue=N.updateQueue,b.type=N.type,k=N.dependencies,b.dependencies=k===null?null:{lanes:k.lanes,firstContext:k.firstContext}),m=m.sibling;return fn(on,on.current&1|2),c.child}o=o.sibling}k.tail!==null&&Ln()>rp&&(c.flags|=128,b=!0,Rl(k,!1),c.lanes=4194304)}else{if(!b)if(o=er(N),o!==null){if(c.flags|=128,b=!0,o=o.updateQueue,o!==null&&(c.updateQueue=o,c.flags|=4),Rl(k,!0),k.tail===null&&k.tailMode==="hidden"&&!N.alternate&&!Mn)return zr(c),null}else 2*Ln()-k.renderingStartTime>rp&&m!==1073741824&&(c.flags|=128,b=!0,Rl(k,!1),c.lanes=4194304);k.isBackwards?(N.sibling=c.child,c.child=N):(o=k.last,o!==null?o.sibling=N:c.child=N,k.last=N)}return k.tail!==null?(c=k.tail,k.rendering=c,k.tail=c.sibling,k.renderingStartTime=Ln(),c.sibling=null,o=on.current,fn(on,b?o&1|2:o&1),c):(zr(c),null);case 22:case 23:return ip(),m=c.memoizedState!==null,o!==null&&o.memoizedState!==null!==m&&(c.flags|=8192),m&&(c.mode&1)!==0?(Mi&1073741824)!==0&&(zr(c),Ae&&c.subtreeFlags&6&&(c.flags|=8192)):zr(c),null;case 24:return null;case 25:return null}throw Error(u(156,c.tag))}function y1(o,c){switch(Nh(c),c.tag){case 1:return Sr(c.type)&&Ma(),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Pa(),yn(vr),yn($n),Mc(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 5:return cs(c),null;case 13:if(yn(on),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(u(340));Sl()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return yn(on),null;case 4:return Pa(),null;case 10:return Yu(c.type._context),null;case 22:case 23:return ip(),null;case 24:return null;default:return null}}var Nc=!1,xr=!1,L0=typeof WeakSet=="function"?WeakSet:Set,Je=null;function Is(o,c){var m=o.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(b){$t(o,c,b)}else m.current=null}function Io(o,c,m){try{m()}catch(b){$t(o,c,b)}}var yd=!1;function Pc(o,c){for(Q(o.containerInfo),Je=c;Je!==null;)if(o=Je,c=o.child,(o.subtreeFlags&1028)!==0&&c!==null)c.return=o,Je=c;else for(;Je!==null;){o=Je;try{var m=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var b=m.memoizedProps,k=m.memoizedState,N=o.stateNode,$=N.getSnapshotBeforeUpdate(o.elementType===o.type?b:Ci(o.type,b),k);N.__reactInternalSnapshotBeforeUpdate=$}break;case 3:Ae&&Ca(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(pe){$t(o,o.return,pe)}if(c=o.sibling,c!==null){c.return=o.return,Je=c;break}Je=o.return}return m=yd,yd=!1,m}function Yr(o,c,m){var b=c.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var k=b=b.next;do{if((k.tag&o)===o){var N=k.destroy;k.destroy=void 0,N!==void 0&&Io(c,m,N)}k=k.next}while(k!==b)}}function Fn(o,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&o)===o){var b=m.create;m.destroy=b()}m=m.next}while(m!==c)}}function Jh(o){var c=o.ref;if(c!==null){var m=o.stateNode;switch(o.tag){case 5:o=ne(m);break;default:o=m}typeof c=="function"?c(o):c.current=o}}function N0(o){var c=o.alternate;c!==null&&(o.alternate=null,N0(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&le(c)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function P0(o){return o.tag===5||o.tag===3||o.tag===4}function Zh(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||P0(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function md(o,c,m){var b=o.tag;if(b===5||b===6)o=o.stateNode,c?gn(m,o,c):mr(m,o);else if(b!==4&&(o=o.child,o!==null))for(md(o,c,m),o=o.sibling;o!==null;)md(o,c,m),o=o.sibling}function vd(o,c,m){var b=o.tag;if(b===5||b===6)o=o.stateNode,c?dt(m,o,c):dn(m,o);else if(b!==4&&(o=o.child,o!==null))for(vd(o,c,m),o=o.sibling;o!==null;)vd(o,c,m),o=o.sibling}var wr=null,gs=!1;function Fs(o,c,m){for(m=m.child;m!==null;)jn(o,c,m),m=m.sibling}function jn(o,c,m){if(ss&&typeof ss.onCommitFiberUnmount=="function")try{ss.onCommitFiberUnmount(Pu,m)}catch{}switch(m.tag){case 5:xr||Is(m,c);case 6:if(Ae){var b=wr,k=gs;wr=null,Fs(o,c,m),wr=b,gs=k,wr!==null&&(gs?ct(wr,m.stateNode):Gn(wr,m.stateNode))}else Fs(o,c,m);break;case 18:Ae&&wr!==null&&(gs?ka(wr,m.stateNode):Sc(wr,m.stateNode));break;case 4:Ae?(b=wr,k=gs,wr=m.stateNode.containerInfo,gs=!0,Fs(o,c,m),wr=b,gs=k):(Me&&(b=m.stateNode.containerInfo,k=Lt(b),ns(b,k)),Fs(o,c,m));break;case 0:case 11:case 14:case 15:if(!xr&&(b=m.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){k=b=b.next;do{var N=k,$=N.destroy;N=N.tag,$!==void 0&&((N&2)!==0||(N&4)!==0)&&Io(m,c,$),k=k.next}while(k!==b)}Fs(o,c,m);break;case 1:if(!xr&&(Is(m,c),b=m.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=m.memoizedProps,b.state=m.memoizedState,b.componentWillUnmount()}catch(pe){$t(m,c,pe)}Fs(o,c,m);break;case 21:Fs(o,c,m);break;case 22:m.mode&1?(xr=(b=xr)||m.memoizedState!==null,Fs(o,c,m),xr=b):Fs(o,c,m);break;default:Fs(o,c,m)}}function Oc(o){var c=o.updateQueue;if(c!==null){o.updateQueue=null;var m=o.stateNode;m===null&&(m=o.stateNode=new L0),c.forEach(function(b){var k=z0.bind(null,o,b);m.has(b)||(m.add(b),b.then(k,k))})}}function Ki(o,c){var m=c.deletions;if(m!==null)for(var b=0;b<m.length;b++){var k=m[b];try{var N=o,$=c;if(Ae){var pe=$;e:for(;pe!==null;){switch(pe.tag){case 5:wr=pe.stateNode,gs=!1;break e;case 3:wr=pe.stateNode.containerInfo,gs=!0;break e;case 4:wr=pe.stateNode.containerInfo,gs=!0;break e}pe=pe.return}if(wr===null)throw Error(u(160));jn(N,$,k),wr=null,gs=!1}else jn(N,$,k);var xe=k.alternate;xe!==null&&(xe.return=null),k.return=null}catch(Ye){$t(k,c,Ye)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)Fo(c,o),c=c.sibling}function Fo(o,c){var m=o.alternate,b=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Ki(c,o),ys(o),b&4){try{Yr(3,o,o.return),Fn(3,o)}catch(nt){$t(o,o.return,nt)}try{Yr(5,o,o.return)}catch(nt){$t(o,o.return,nt)}}break;case 1:Ki(c,o),ys(o),b&512&&m!==null&&Is(m,m.return);break;case 5:if(Ki(c,o),ys(o),b&512&&m!==null&&Is(m,m.return),Ae){if(o.flags&32){var k=o.stateNode;try{at(k)}catch(nt){$t(o,o.return,nt)}}if(b&4&&(k=o.stateNode,k!=null)){var N=o.memoizedProps;if(m=m!==null?m.memoizedProps:N,b=o.type,c=o.updateQueue,o.updateQueue=null,c!==null)try{St(k,c,b,m,N,o)}catch(nt){$t(o,o.return,nt)}}}break;case 6:if(Ki(c,o),ys(o),b&4&&Ae){if(o.stateNode===null)throw Error(u(162));k=o.stateNode,N=o.memoizedProps,m=m!==null?m.memoizedProps:N;try{Ve(k,m,N)}catch(nt){$t(o,o.return,nt)}}break;case 3:if(Ki(c,o),ys(o),b&4){if(Ae&&be&&m!==null&&m.memoizedState.isDehydrated)try{Ks(c.containerInfo)}catch(nt){$t(o,o.return,nt)}if(Me){k=c.containerInfo,N=c.pendingChildren;try{ns(k,N)}catch(nt){$t(o,o.return,nt)}}}break;case 4:if(Ki(c,o),ys(o),b&4&&Me){N=o.stateNode,k=N.containerInfo,N=N.pendingChildren;try{ns(k,N)}catch(nt){$t(o,o.return,nt)}}break;case 13:Ki(c,o),ys(o),k=o.child,k.flags&8192&&(N=k.memoizedState!==null,k.stateNode.isHidden=N,!N||k.alternate!==null&&k.alternate.memoizedState!==null||(bd=Ln())),b&4&&Oc(o);break;case 22:var $=m!==null&&m.memoizedState!==null;if(o.mode&1?(xr=(m=xr)||$,Ki(c,o),xr=m):Ki(c,o),ys(o),b&8192){if(m=o.memoizedState!==null,(o.stateNode.isHidden=m)&&!$&&(o.mode&1)!==0)for(Je=o,b=o.child;b!==null;){for(c=Je=b;Je!==null;){$=Je;var pe=$.child;switch($.tag){case 0:case 11:case 14:case 15:Yr(4,$,$.return);break;case 1:Is($,$.return);var xe=$.stateNode;if(typeof xe.componentWillUnmount=="function"){var Ye=$,Ke=$.return;try{var kt=Ye;xe.props=kt.memoizedProps,xe.state=kt.memoizedState,xe.componentWillUnmount()}catch(nt){$t(Ye,Ke,nt)}}break;case 5:Is($,$.return);break;case 22:if($.memoizedState!==null){br(c);continue}}pe!==null?(pe.return=$,Je=pe):br(c)}b=b.sibling}if(Ae){e:if(b=null,Ae)for(c=o;;){if(c.tag===5){if(b===null){b=c;try{k=c.stateNode,m?cn(k):Ot(c.stateNode,c.memoizedProps)}catch(nt){$t(o,o.return,nt)}}}else if(c.tag===6){if(b===null)try{N=c.stateNode,m?un(N):Hi(N,c.memoizedProps)}catch(nt){$t(o,o.return,nt)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===o)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break e;for(;c.sibling===null;){if(c.return===null||c.return===o)break e;b===c&&(b=null),c=c.return}b===c&&(b=null),c.sibling.return=c.return,c=c.sibling}}}break;case 19:Ki(c,o),ys(o),b&4&&Oc(o);break;case 21:break;default:Ki(c,o),ys(o)}}function ys(o){var c=o.flags;if(c&2){try{if(Ae){e:{for(var m=o.return;m!==null;){if(P0(m)){var b=m;break e}m=m.return}throw Error(u(160))}switch(b.tag){case 5:var k=b.stateNode;b.flags&32&&(at(k),b.flags&=-33);var N=Zh(o);vd(o,N,k);break;case 3:case 4:var $=b.stateNode.containerInfo,pe=Zh(o);md(o,pe,$);break;default:throw Error(u(161))}}}catch(xe){$t(o,o.return,xe)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function m1(o,c,m){Je=o,O0(o)}function O0(o,c,m){for(var b=(o.mode&1)!==0;Je!==null;){var k=Je,N=k.child;if(k.tag===22&&b){var $=k.memoizedState!==null||Nc;if(!$){var pe=k.alternate,xe=pe!==null&&pe.memoizedState!==null||xr;pe=Nc;var Ye=xr;if(Nc=$,(xr=xe)&&!Ye)for(Je=k;Je!==null;)$=Je,xe=$.child,$.tag===22&&$.memoizedState!==null?Ze(k):xe!==null?(xe.return=$,Je=xe):Ze(k);for(;N!==null;)Je=N,O0(N),N=N.sibling;Je=k,Nc=pe,xr=Ye}Uo(o)}else(k.subtreeFlags&8772)!==0&&N!==null?(N.return=k,Je=N):Uo(o)}}function Uo(o){for(;Je!==null;){var c=Je;if((c.flags&8772)!==0){var m=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:xr||Fn(5,c);break;case 1:var b=c.stateNode;if(c.flags&4&&!xr)if(m===null)b.componentDidMount();else{var k=c.elementType===c.type?m.memoizedProps:Ci(c.type,m.memoizedProps);b.componentDidUpdate(k,m.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var N=c.updateQueue;N!==null&&_0(c,N,b);break;case 3:var $=c.updateQueue;if($!==null){if(m=null,c.child!==null)switch(c.child.tag){case 5:m=ne(c.child.stateNode);break;case 1:m=c.child.stateNode}_0(c,$,m)}break;case 5:var pe=c.stateNode;m===null&&c.flags&4&&tt(pe,c.type,c.memoizedProps,c);break;case 6:break;case 4:break;case 12:break;case 13:if(be&&c.memoizedState===null){var xe=c.alternate;if(xe!==null){var Ye=xe.memoizedState;if(Ye!==null){var Ke=Ye.dehydrated;Ke!==null&&ri(Ke)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(u(163))}xr||c.flags&512&&Jh(c)}catch(kt){$t(c,c.return,kt)}}if(c===o){Je=null;break}if(m=c.sibling,m!==null){m.return=c.return,Je=m;break}Je=c.return}}function br(o){for(;Je!==null;){var c=Je;if(c===o){Je=null;break}var m=c.sibling;if(m!==null){m.return=c.return,Je=m;break}Je=c.return}}function Ze(o){for(;Je!==null;){var c=Je;try{switch(c.tag){case 0:case 11:case 15:var m=c.return;try{Fn(4,c)}catch(xe){$t(c,m,xe)}break;case 1:var b=c.stateNode;if(typeof b.componentDidMount=="function"){var k=c.return;try{b.componentDidMount()}catch(xe){$t(c,k,xe)}}var N=c.return;try{Jh(c)}catch(xe){$t(c,N,xe)}break;case 5:var $=c.return;try{Jh(c)}catch(xe){$t(c,$,xe)}}}catch(xe){$t(c,c.return,xe)}if(c===o){Je=null;break}var pe=c.sibling;if(pe!==null){pe.return=c.return,Je=pe;break}Je=c.return}}var ki=0,oi=1,Sd=2,_d=3,xd=4;if(typeof Symbol=="function"&&Symbol.for){var Ic=Symbol.for;ki=Ic("selector.component"),oi=Ic("selector.has_pseudo_class"),Sd=Ic("selector.role"),_d=Ic("selector.test_id"),xd=Ic("selector.text")}function $h(o){var c=He(o);if(c!=null){if(typeof c.memoizedProps["data-testname"]!="string")throw Error(u(364));return c}if(o=Et(o),o===null)throw Error(u(362));return o.stateNode.current}function Wn(o,c){switch(c.$$typeof){case ki:if(o.type===c.value)return!0;break;case oi:e:{c=c.value,o=[o,0];for(var m=0;m<o.length;){var b=o[m++],k=o[m++],N=c[k];if(b.tag!==5||!kn(b)){for(;N!=null&&Wn(b,N);)k++,N=c[k];if(k===c.length){c=!0;break e}else for(b=b.child;b!==null;)o.push(b,k),b=b.sibling}}c=!1}return c;case Sd:if(o.tag===5&&sr(o.stateNode,c.value))return!0;break;case xd:if((o.tag===5||o.tag===6)&&(o=On(o),o!==null&&0<=o.indexOf(c.value)))return!0;break;case _d:if(o.tag===5&&(o=o.memoizedProps["data-testname"],typeof o=="string"&&o.toLowerCase()===c.value.toLowerCase()))return!0;break;default:throw Error(u(365))}return!1}function ep(o){switch(o.$$typeof){case ki:return"<"+(ee(o.value)||"Unknown")+">";case oi:return":has("+(ep(o)||"")+")";case Sd:return'[role="'+o.value+'"]';case xd:return'"'+o.value+'"';case _d:return'[data-testname="'+o.value+'"]';default:throw Error(u(365))}}function I0(o,c){var m=[];o=[o,0];for(var b=0;b<o.length;){var k=o[b++],N=o[b++],$=c[N];if(k.tag!==5||!kn(k)){for(;$!=null&&Wn(k,$);)N++,$=c[N];if(N===c.length)m.push(k);else for(k=k.child;k!==null;)o.push(k,N),k=k.sibling}}return m}function tp(o,c){if(!xt)throw Error(u(363));o=$h(o),o=I0(o,c),c=[],o=Array.from(o);for(var m=0;m<o.length;){var b=o[m++];if(b.tag===5)kn(b)||c.push(b.stateNode);else for(b=b.child;b!==null;)o.push(b),b=b.sibling}return c}var F0=Math.ceil,Ba=d.ReactCurrentDispatcher,za=d.ReactCurrentOwner,Un=d.ReactCurrentBatchConfig,Gt=0,cr=null,Xn=null,Er=0,Mi=0,Bo=Si(0),qn=0,Fc=null,zo=0,wd=0,np=0,Uc=null,li=null,bd=0,rp=1/0,Us=null;function Ll(){rp=Ln()+500}var Ed=!1,Bc=null,Ha=null,Hr=!1,Gr=null,Nl=0,Ho=0,Cd=null,Td=-1,zc=0;function bn(){return(Gt&6)!==0?Ln():Td!==-1?Td:Td=Ln()}function ra(o){return(o.mode&1)===0?1:(Gt&2)!==0&&Er!==0?Er&-Er:p1.transition!==null?(zc===0&&(zc=Ht()),zc):(o=At,o!==0?o:Ct())}function Cr(o,c,m,b){if(50<Ho)throw Ho=0,Cd=null,Error(u(185));_n(o,m,b),((Gt&2)===0||o!==cr)&&(o===cr&&((Gt&2)===0&&(wd|=m),qn===4&&ui(o,Er)),rr(o,b),m===1&&Gt===0&&(c.mode&1)===0&&(Ll(),Ou&&Rs()))}function rr(o,c){var m=o.callbackNode;ft(o,c);var b=rt(o,o===cr?Er:0);if(b===0)m!==null&&Da(m),o.callbackNode=null,o.callbackPriority=0;else if(c=b&-b,o.callbackPriority!==c){if(m!=null&&Da(m),c===1)o.tag===0?u0(Bs.bind(null,o)):Rh(Bs.bind(null,o)),Ee?yt(function(){(Gt&6)===0&&Rs()}):As(bo,Rs),m=null;else{switch(_r(b)){case 1:m=bo;break;case 4:m=vl;break;case 16:m=Dh;break;case 536870912:m=d1;break;default:m=Dh}m=G0(m,Hc.bind(null,o))}o.callbackPriority=c,o.callbackNode=m}}function Hc(o,c){if(Td=-1,zc=0,(Gt&6)!==0)throw Error(u(327));var m=o.callbackNode;if(Rn()&&o.callbackNode!==m)return null;var b=rt(o,o===cr?Er:0);if(b===0)return null;if((b&30)!==0||(b&o.expiredLanes)!==0||c)c=Ol(o,b);else{c=b;var k=Gt;Gt|=2;var N=Ga();(cr!==o||Er!==c)&&(Us=null,Ll(),Go(o,c));do try{v1();break}catch(pe){U0(o,pe)}while(!0);Vu(),Ba.current=N,Gt=k,Xn!==null?c=0:(cr=null,Er=0,c=qn)}if(c!==0){if(c===2&&(k=pt(o),k!==0&&(b=k,c=Pl(o,k))),c===1)throw m=Fc,Go(o,0),ui(o,b),rr(o,Ln()),m;if(c===6)ui(o,b);else{if(k=o.current.alternate,(b&30)===0&&!Qi(k)&&(c=Ol(o,b),c===2&&(N=pt(o),N!==0&&(b=N,c=Pl(o,N))),c===1))throw m=Fc,Go(o,0),ui(o,b),rr(o,Ln()),m;switch(o.finishedWork=k,o.finishedLanes=b,c){case 0:case 1:throw Error(u(345));case 2:Vo(o,li,Us);break;case 3:if(ui(o,b),(b&130023424)===b&&(c=bd+500-Ln(),10<c)){if(rt(o,0)!==0)break;if(k=o.suspendedLanes,(k&b)!==b){bn(),o.pingedLanes|=o.suspendedLanes&k;break}o.timeoutHandle=q(Vo.bind(null,o,li,Us),c);break}Vo(o,li,Us);break;case 4:if(ui(o,b),(b&4194240)===b)break;for(c=o.eventTimes,k=-1;0<b;){var $=31-Oe(b);N=1<<$,$=c[$],$>k&&(k=$),b&=~N}if(b=k,b=Ln()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*F0(b/1960))-b,10<b){o.timeoutHandle=q(Vo.bind(null,o,li,Us),b);break}Vo(o,li,Us);break;case 5:Vo(o,li,Us);break;default:throw Error(u(329))}}}return rr(o,Ln()),o.callbackNode===m?Hc.bind(null,o):null}function Pl(o,c){var m=Uc;return o.current.memoizedState.isDehydrated&&(Go(o,c).flags|=256),o=Ol(o,c),o!==2&&(c=li,li=m,c!==null&&ci(c)),o}function ci(o){li===null?li=o:li.push.apply(li,o)}function Qi(o){for(var c=o;;){if(c.flags&16384){var m=c.updateQueue;if(m!==null&&(m=m.stores,m!==null))for(var b=0;b<m.length;b++){var k=m[b],N=k.getSnapshot;k=k.value;try{if(!as(N(),k))return!1}catch{return!1}}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function ui(o,c){for(c&=~np,c&=~wd,o.suspendedLanes|=c,o.pingedLanes&=~c,o=o.expirationTimes;0<c;){var m=31-Oe(c),b=1<<m;o[m]=-1,c&=~b}}function Bs(o){if((Gt&6)!==0)throw Error(u(327));Rn();var c=rt(o,0);if((c&1)===0)return rr(o,Ln()),null;var m=Ol(o,c);if(o.tag!==0&&m===2){var b=pt(o);b!==0&&(c=b,m=Pl(o,b))}if(m===1)throw m=Fc,Go(o,0),ui(o,c),rr(o,Ln()),m;if(m===6)throw Error(u(345));return o.finishedWork=o.current.alternate,o.finishedLanes=c,Vo(o,li,Us),rr(o,Ln()),null}function zs(o){Gr!==null&&Gr.tag===0&&(Gt&6)===0&&Rn();var c=Gt;Gt|=1;var m=Un.transition,b=At;try{if(Un.transition=null,At=1,o)return o()}finally{At=b,Un.transition=m,Gt=c,(Gt&6)===0&&Rs()}}function ip(){Mi=Bo.current,yn(Bo)}function Go(o,c){o.finishedWork=null,o.finishedLanes=0;var m=o.timeoutHandle;if(m!==ye&&(o.timeoutHandle=ye,oe(m)),Xn!==null)for(m=Xn.return;m!==null;){var b=m;switch(Nh(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&Ma();break;case 3:Pa(),yn(vr),yn($n),Mc();break;case 5:cs(b);break;case 4:Pa();break;case 13:yn(on);break;case 19:yn(on);break;case 10:Yu(b.type._context);break;case 22:case 23:ip()}m=m.return}if(cr=o,Xn=o=sa(o.current,null),Er=Mi=c,qn=0,Fc=null,np=wd=zo=0,li=Uc=null,La!==null){for(c=0;c<La.length;c++)if(m=La[c],b=m.interleaved,b!==null){m.interleaved=null;var k=b.next,N=m.pending;if(N!==null){var $=N.next;N.next=k,b.next=$}m.pending=b}La=null}return o}function U0(o,c){do{var m=Xn;try{if(Vu(),Fr.current=Tl,ea){for(var b=wn.memoizedState;b!==null;){var k=b.queue;k!==null&&(k.pending=null),b=b.next}ea=!1}if(Ur=0,nr=Dn=wn=null,Oa=!1,ii=0,za.current=null,m===null||m.return===null){qn=1,Fc=c,Xn=null;break}e:{var N=o,$=m.return,pe=m,xe=c;if(c=Er,pe.flags|=32768,xe!==null&&typeof xe=="object"&&typeof xe.then=="function"){var Ye=xe,Ke=pe,kt=Ke.tag;if((Ke.mode&1)===0&&(kt===0||kt===11||kt===15)){var nt=Ke.alternate;nt?(Ke.updateQueue=nt.updateQueue,Ke.memoizedState=nt.memoizedState,Ke.lanes=nt.lanes):(Ke.updateQueue=null,Ke.memoizedState=null)}var En=mn($);if(En!==null){En.flags&=-257,Rc(En,$,pe,N,c),En.mode&1&&E0(N,Ye,c),c=En,xe=Ye;var Bt=c.updateQueue;if(Bt===null){var en=new Set;en.add(xe),c.updateQueue=en}else Bt.add(xe);break e}else{if((c&1)===0){E0(N,Ye,c),kd();break e}xe=Error(u(426))}}else if(Mn&&pe.mode&1){var oa=mn($);if(oa!==null){(oa.flags&65536)===0&&(oa.flags|=256),Rc(oa,$,pe,N,c),Ih(No(xe,pe));break e}}N=xe=No(xe,pe),qn!==4&&(qn=2),Uc===null?Uc=[N]:Uc.push(N),N=$;do{switch(N.tag){case 3:N.flags|=65536,c&=-c,N.lanes|=c;var ve=Fa(N,xe,c);S0(N,ve);break e;case 1:pe=xe;var he=N.type,Te=N.stateNode;if((N.flags&128)===0&&(typeof he.getDerivedStateFromError=="function"||Te!==null&&typeof Te.componentDidCatch=="function"&&(Ha===null||!Ha.has(Te)))){N.flags|=65536,c&=-c,N.lanes|=c;var Qe=si(N,pe,c);S0(N,Qe);break e}}N=N.return}while(N!==null)}B0(m)}catch(gt){c=gt,Xn===m&&m!==null&&(Xn=m=m.return);continue}break}while(!0)}function Ga(){var o=Ba.current;return Ba.current=Tl,o===null?Tl:o}function kd(){(qn===0||qn===3||qn===2)&&(qn=4),cr===null||(zo&268435455)===0&&(wd&268435455)===0||ui(cr,Er)}function Ol(o,c){var m=Gt;Gt|=2;var b=Ga();(cr!==o||Er!==c)&&(Us=null,Go(o,c));do try{Md();break}catch(k){U0(o,k)}while(!0);if(Vu(),Gt=m,Ba.current=b,Xn!==null)throw Error(u(261));return cr=null,Er=0,qn}function Md(){for(;Xn!==null;)Dd(Xn)}function v1(){for(;Xn!==null&&!ml();)Dd(Xn)}function Dd(o){var c=H0(o.alternate,o,Mi);o.memoizedProps=o.pendingProps,c===null?B0(o):Xn=c,za.current=null}function B0(o){var c=o;do{var m=c.alternate;if(o=c.return,(c.flags&32768)===0){if(m=Qh(m,c,Mi),m!==null){Xn=m;return}}else{if(m=y1(m,c),m!==null){m.flags&=32767,Xn=m;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{qn=6,Xn=null;return}}if(c=c.sibling,c!==null){Xn=c;return}Xn=c=o}while(c!==null);qn===0&&(qn=5)}function Vo(o,c,m){var b=At,k=Un.transition;try{Un.transition=null,At=1,Yo(o,c,m,b)}finally{Un.transition=k,At=b}return null}function Yo(o,c,m,b){do Rn();while(Gr!==null);if((Gt&6)!==0)throw Error(u(327));m=o.finishedWork;var k=o.finishedLanes;if(m===null)return null;if(o.finishedWork=null,o.finishedLanes=0,m===o.current)throw Error(u(177));o.callbackNode=null,o.callbackPriority=0;var N=m.lanes|m.childLanes;if(Yn(o,N),o===cr&&(Xn=cr=null,Er=0),(m.subtreeFlags&2064)===0&&(m.flags&2064)===0||Hr||(Hr=!0,G0(Dh,function(){return Rn(),null})),N=(m.flags&15990)!==0,(m.subtreeFlags&15990)!==0||N){N=Un.transition,Un.transition=null;var $=At;At=1;var pe=Gt;Gt|=4,za.current=null,Pc(o,m),Fo(m,o),H(o.containerInfo),o.current=m,m1(m),wc(),Gt=pe,At=$,Un.transition=N}else o.current=m;if(Hr&&(Hr=!1,Gr=o,Nl=k),N=o.pendingLanes,N===0&&(Ha=null),f1(m.stateNode),rr(o,Ln()),c!==null)for(b=o.onRecoverableError,m=0;m<c.length;m++)k=c[m],b(k.value,{componentStack:k.stack,digest:k.digest});if(Ed)throw Ed=!1,o=Bc,Bc=null,o;return(Nl&1)!==0&&o.tag!==0&&Rn(),N=o.pendingLanes,(N&1)!==0?o===Cd?Ho++:(Ho=0,Cd=o):Ho=0,Rs(),null}function Rn(){if(Gr!==null){var o=_r(Nl),c=Un.transition,m=At;try{if(Un.transition=null,At=16>o?16:o,Gr===null)var b=!1;else{if(o=Gr,Gr=null,Nl=0,(Gt&6)!==0)throw Error(u(331));var k=Gt;for(Gt|=4,Je=o.current;Je!==null;){var N=Je,$=N.child;if((Je.flags&16)!==0){var pe=N.deletions;if(pe!==null){for(var xe=0;xe<pe.length;xe++){var Ye=pe[xe];for(Je=Ye;Je!==null;){var Ke=Je;switch(Ke.tag){case 0:case 11:case 15:Yr(8,Ke,N)}var kt=Ke.child;if(kt!==null)kt.return=Ke,Je=kt;else for(;Je!==null;){Ke=Je;var nt=Ke.sibling,En=Ke.return;if(N0(Ke),Ke===Ye){Je=null;break}if(nt!==null){nt.return=En,Je=nt;break}Je=En}}}var Bt=N.alternate;if(Bt!==null){var en=Bt.child;if(en!==null){Bt.child=null;do{var oa=en.sibling;en.sibling=null,en=oa}while(en!==null)}}Je=N}}if((N.subtreeFlags&2064)!==0&&$!==null)$.return=N,Je=$;else e:for(;Je!==null;){if(N=Je,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:Yr(9,N,N.return)}var ve=N.sibling;if(ve!==null){ve.return=N.return,Je=ve;break e}Je=N.return}}var he=o.current;for(Je=he;Je!==null;){$=Je;var Te=$.child;if(($.subtreeFlags&2064)!==0&&Te!==null)Te.return=$,Je=Te;else e:for($=he;Je!==null;){if(pe=Je,(pe.flags&2048)!==0)try{switch(pe.tag){case 0:case 11:case 15:Fn(9,pe)}}catch(gt){$t(pe,pe.return,gt)}if(pe===$){Je=null;break e}var Qe=pe.sibling;if(Qe!==null){Qe.return=pe.return,Je=Qe;break e}Je=pe.return}}if(Gt=k,Rs(),ss&&typeof ss.onPostCommitFiberRoot=="function")try{ss.onPostCommitFiberRoot(Pu,o)}catch{}b=!0}return b}finally{At=m,Un.transition=c}}return!1}function Di(o,c,m){c=No(m,c),c=Fa(o,c,1),o=Na(o,c,1),c=bn(),o!==null&&(_n(o,1,c),rr(o,c))}function $t(o,c,m){if(o.tag===3)Di(o,o,m);else for(;c!==null;){if(c.tag===3){Di(c,o,m);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Ha===null||!Ha.has(b))){o=No(m,o),o=si(c,o,1),c=Na(c,o,1),o=bn(),c!==null&&(_n(c,1,o),rr(c,o));break}}c=c.return}}function Va(o,c,m){var b=o.pingCache;b!==null&&b.delete(c),c=bn(),o.pingedLanes|=o.suspendedLanes&m,cr===o&&(Er&m)===m&&(qn===4||qn===3&&(Er&130023424)===Er&&500>Ln()-bd?Go(o,0):np|=m),rr(o,c)}function ia(o,c){c===0&&((o.mode&1)===0?c=1:(c=ze,ze<<=1,(ze&130023424)===0&&(ze=4194304)));var m=bn();o=Wi(o,c),o!==null&&(_n(o,c,m),rr(o,m))}function S1(o){var c=o.memoizedState,m=0;c!==null&&(m=c.retryLane),ia(o,m)}function z0(o,c){var m=0;switch(o.tag){case 13:var b=o.stateNode,k=o.memoizedState;k!==null&&(m=k.retryLane);break;case 19:b=o.stateNode;break;default:throw Error(u(314))}b!==null&&b.delete(c),ia(o,m)}var H0;H0=function(o,c,m){if(o!==null)if(o.memoizedProps!==c.pendingProps||vr.current)or=!0;else{if((o.lanes&m)===0&&(c.flags&128)===0)return or=!1,Ut(o,c,m);or=(o.flags&131072)!==0}else or=!1,Mn&&(c.flags&1048576)!==0&&Ec(c,Iu,c.index);switch(c.lanes=0,c.tag){case 2:var b=c.type;Br(o,c),o=c.pendingProps;var k=Js(c,$n.current);To(c,m),k=Ku(null,c,b,o,k,m);var N=El();return c.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Sr(b)?(N=!0,ue(c)):N=!1,c.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,Ps(c),k.updater=ta,c.stateNode=k,k._reactInternals=c,Dc(c,b,o,m),c=dd(null,c,b,!0,N,m)):(c.tag=0,Mn&&N&&Lh(c),lr(null,c,k,m),c=c.child),c;case 16:b=c.elementType;e:{switch(Br(o,c),o=c.pendingProps,k=b._init,b=k(b._payload),c.type=b,k=c.tag=sp(b),o=Ci(b,o),k){case 0:c=Wh(null,c,b,o,m);break e;case 1:c=ud(null,c,b,o,m);break e;case 11:c=C0(null,c,b,o,m);break e;case 14:c=T0(null,c,b,Ci(b.type,o),m);break e}throw Error(u(306,b,""))}return c;case 0:return b=c.type,k=c.pendingProps,k=c.elementType===b?k:Ci(b,k),Wh(o,c,b,k,m);case 1:return b=c.type,k=c.pendingProps,k=c.elementType===b?k:Ci(b,k),ud(o,c,b,k,m);case 3:e:{if(D0(c),o===null)throw Error(u(387));b=c.pendingProps,N=c.memoizedState,k=N.element,Wu(o,c),wl(c,b,null,m);var $=c.memoizedState;if(b=$.element,be&&N.isDehydrated)if(N={element:b,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},c.updateQueue.baseState=N,c.memoizedState=N,c.flags&256){k=No(Error(u(423)),c),c=A0(o,c,b,m,k);break e}else if(b!==k){k=No(Error(u(424)),c),c=A0(o,c,b,m,k);break e}else for(be&&(ji=mo(c.stateNode.containerInfo),_i=c,Mn=!0,ls=null,Cc=!1),m=m0(c,null,b,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Sl(),b===k){c=ai(o,c,m);break e}lr(o,c,b,m)}c=c.child}return c;case 5:return kc(c),o===null&&Oh(c),b=c.type,k=c.pendingProps,N=o!==null?o.memoizedProps:null,$=k.children,fe(b,k)?$=null:N!==null&&fe(b,N)&&(c.flags|=32),cd(o,c),lr(o,c,$,m),c.child;case 6:return o===null&&Oh(c),null;case 13:return qh(o,c,m);case 4:return Ei(c,c.stateNode.containerInfo),b=c.pendingProps,o===null?c.child=_l(c,null,b,m):lr(o,c,b,m),c.child;case 11:return b=c.type,k=c.pendingProps,k=c.elementType===b?k:Ci(b,k),C0(o,c,b,k,m);case 7:return lr(o,c,c.pendingProps,m),c.child;case 8:return lr(o,c,c.pendingProps.children,m),c.child;case 12:return lr(o,c,c.pendingProps.children,m),c.child;case 10:e:{if(b=c.type._context,k=c.pendingProps,N=c.memoizedProps,$=k.value,Fh(c,b,$),N!==null)if(as(N.value,$)){if(N.children===k.children&&!vr.current){c=ai(o,c,m);break e}}else for(N=c.child,N!==null&&(N.return=c);N!==null;){var pe=N.dependencies;if(pe!==null){$=N.child;for(var xe=pe.firstContext;xe!==null;){if(xe.context===b){if(N.tag===1){xe=Xi(-1,m&-m),xe.tag=2;var Ye=N.updateQueue;if(Ye!==null){Ye=Ye.shared;var Ke=Ye.pending;Ke===null?xe.next=xe:(xe.next=Ke.next,Ke.next=xe),Ye.pending=xe}}N.lanes|=m,xe=N.alternate,xe!==null&&(xe.lanes|=m),ju(N.return,m,c),pe.lanes|=m;break}xe=xe.next}}else if(N.tag===10)$=N.type===c.type?null:N.child;else if(N.tag===18){if($=N.return,$===null)throw Error(u(341));$.lanes|=m,pe=$.alternate,pe!==null&&(pe.lanes|=m),ju($,m,c),$=N.sibling}else $=N.child;if($!==null)$.return=N;else for($=N;$!==null;){if($===c){$=null;break}if(N=$.sibling,N!==null){N.return=$.return,$=N;break}$=$.return}N=$}lr(o,c,k.children,m),c=c.child}return c;case 9:return k=c.type,b=c.pendingProps.children,To(c,m),k=xi(k),b=b(k),c.flags|=1,lr(o,c,b,m),c.child;case 14:return b=c.type,k=Ci(b,c.pendingProps),k=Ci(b.type,k),T0(o,c,b,k,m);case 15:return k0(o,c,c.type,c.pendingProps,m);case 17:return b=c.type,k=c.pendingProps,k=c.elementType===b?k:Ci(b,k),Br(o,c),c.tag=1,Sr(b)?(o=!0,ue(c)):o=!1,To(c,m),sd(c,b,k),Dc(c,b,k,m),dd(null,c,b,!0,o,m);case 19:return pd(o,c,m);case 22:return M0(o,c,m)}throw Error(u(156,c.tag))};function G0(o,c){return As(o,c)}function _1(o,c,m,b){this.tag=o,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ai(o,c,m,b){return new _1(o,c,m,b)}function Ad(o){return o=o.prototype,!(!o||!o.isReactComponent)}function sp(o){if(typeof o=="function")return Ad(o)?1:0;if(o!=null){if(o=o.$$typeof,o===C)return 11;if(o===M)return 14}return 2}function sa(o,c){var m=o.alternate;return m===null?(m=Ai(o.tag,c,o.key,o.mode),m.elementType=o.elementType,m.type=o.type,m.stateNode=o.stateNode,m.alternate=o,o.alternate=m):(m.pendingProps=c,m.type=o.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=o.flags&14680064,m.childLanes=o.childLanes,m.lanes=o.lanes,m.child=o.child,m.memoizedProps=o.memoizedProps,m.memoizedState=o.memoizedState,m.updateQueue=o.updateQueue,c=o.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=o.sibling,m.index=o.index,m.ref=o.ref,m}function Gc(o,c,m,b,k,N){var $=2;if(b=o,typeof o=="function")Ad(o)&&($=1);else if(typeof o=="string")$=5;else e:switch(o){case y:return aa(m.children,k,N,c);case _:$=8,k|=8;break;case S:return o=Ai(12,m,c,k|2),o.elementType=S,o.lanes=N,o;case D:return o=Ai(13,m,c,k),o.elementType=D,o.lanes=N,o;case U:return o=Ai(19,m,c,k),o.elementType=U,o.lanes=N,o;case L:return Il(m,k,N,c);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case x:$=10;break e;case w:$=9;break e;case C:$=11;break e;case M:$=14;break e;case E:$=16,b=null;break e}throw Error(u(130,o==null?o:typeof o,""))}return c=Ai($,m,c,k),c.elementType=o,c.type=b,c.lanes=N,c}function aa(o,c,m,b){return o=Ai(7,o,b,c),o.lanes=m,o}function Il(o,c,m,b){return o=Ai(22,o,b,c),o.elementType=L,o.lanes=m,o.stateNode={isHidden:!1},o}function Vc(o,c,m){return o=Ai(6,o,null,c),o.lanes=m,o}function ap(o,c,m){return c=Ai(4,o.children!==null?o.children:[],o.key,c),c.lanes=m,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}function x1(o,c,m,b,k){this.tag=c,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ye,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wt(0),this.expirationTimes=Wt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wt(0),this.identifierPrefix=b,this.onRecoverableError=k,be&&(this.mutableSourceEagerHydrationData=null)}function V0(o,c,m,b,k,N,$,pe,xe){return o=new x1(o,c,m,pe,xe),c===1?(c=1,N===!0&&(c|=8)):c=0,N=Ai(3,null,null,c),o.current=N,N.stateNode=o,N.memoizedState={element:b,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ps(N),o}function Y0(o){if(!o)return Ds;o=o._reactInternals;e:{if(I(o)!==o||o.tag!==1)throw Error(u(170));var c=o;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(Sr(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(u(171))}if(o.tag===1){var m=o.type;if(Sr(m))return yl(o,m,c)}return c}function op(o){var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(u(188)):(o=Object.keys(o).join(","),Error(u(268,o)));return o=W(c),o===null?null:o.stateNode}function Yc(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var m=o.retryLane;o.retryLane=m!==0&&m<c?m:c}}function Rd(o,c){Yc(o,c),(o=o.alternate)&&Yc(o,c)}function j0(o){return o=W(o),o===null?null:o.stateNode}function Fl(){return null}return n.attemptContinuousHydration=function(o){if(o.tag===13){var c=Wi(o,134217728);if(c!==null){var m=bn();Cr(c,o,134217728,m)}Rd(o,134217728)}},n.attemptDiscreteHydration=function(o){if(o.tag===13){var c=Wi(o,1);if(c!==null){var m=bn();Cr(c,o,1,m)}Rd(o,1)}},n.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13){var c=ra(o),m=Wi(o,c);if(m!==null){var b=bn();Cr(m,o,c,b)}Rd(o,c)}},n.attemptSynchronousHydration=function(o){switch(o.tag){case 3:var c=o.stateNode;if(c.current.memoizedState.isDehydrated){var m=je(c.pendingLanes);m!==0&&(Yt(c,m|1),rr(c,Ln()),(Gt&6)===0&&(Ll(),Rs()))}break;case 13:zs(function(){var b=Wi(o,1);if(b!==null){var k=bn();Cr(b,o,1,k)}}),Rd(o,1)}},n.batchedUpdates=function(o,c){var m=Gt;Gt|=1;try{return o(c)}finally{Gt=m,Gt===0&&(Ll(),Ou&&Rs())}},n.createComponentSelector=function(o){return{$$typeof:ki,value:o}},n.createContainer=function(o,c,m,b,k,N,$){return V0(o,c,!1,null,m,b,k,N,$)},n.createHasPseudoClassSelector=function(o){return{$$typeof:oi,value:o}},n.createHydrationContainer=function(o,c,m,b,k,N,$,pe,xe){return o=V0(m,b,!0,o,k,N,$,pe,xe),o.context=Y0(null),m=o.current,b=bn(),k=ra(m),N=Xi(b,k),N.callback=c??null,Na(m,N,k),o.current.lanes=k,_n(o,k,b),rr(o,b),o},n.createPortal=function(o,c,m){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:b==null?null:""+b,children:o,containerInfo:c,implementation:m}},n.createRoleSelector=function(o){return{$$typeof:Sd,value:o}},n.createTestNameSelector=function(o){return{$$typeof:_d,value:o}},n.createTextSelector=function(o){return{$$typeof:xd,value:o}},n.deferredUpdates=function(o){var c=At,m=Un.transition;try{return Un.transition=null,At=16,o()}finally{At=c,Un.transition=m}},n.discreteUpdates=function(o,c,m,b,k){var N=At,$=Un.transition;try{return Un.transition=null,At=1,o(c,m,b,k)}finally{At=N,Un.transition=$,Gt===0&&Ll()}},n.findAllNodes=tp,n.findBoundingRects=function(o,c){if(!xt)throw Error(u(363));c=tp(o,c),o=[];for(var m=0;m<c.length;m++)o.push(Pt(c[m]));for(c=o.length-1;0<c;c--){m=o[c];for(var b=m.x,k=b+m.width,N=m.y,$=N+m.height,pe=c-1;0<=pe;pe--)if(c!==pe){var xe=o[pe],Ye=xe.x,Ke=Ye+xe.width,kt=xe.y,nt=kt+xe.height;if(b>=Ye&&N>=kt&&k<=Ke&&$<=nt){o.splice(c,1);break}else if(b!==Ye||m.width!==xe.width||nt<N||kt>$){if(!(N!==kt||m.height!==xe.height||Ke<b||Ye>k)){Ye>b&&(xe.width+=Ye-b,xe.x=b),Ke<k&&(xe.width=k-Ye),o.splice(c,1);break}}else{kt>N&&(xe.height+=kt-N,xe.y=N),nt<$&&(xe.height=$-kt),o.splice(c,1);break}}}return o},n.findHostInstance=op,n.findHostInstanceWithNoPortals=function(o){return o=V(o),o=o!==null?Y(o):null,o===null?null:o.stateNode},n.findHostInstanceWithWarning=function(o){return op(o)},n.flushControlled=function(o){var c=Gt;Gt|=1;var m=Un.transition,b=At;try{Un.transition=null,At=1,o()}finally{At=b,Un.transition=m,Gt=c,Gt===0&&(Ll(),Rs())}},n.flushPassiveEffects=Rn,n.flushSync=zs,n.focusWithin=function(o,c){if(!xt)throw Error(u(363));for(o=$h(o),c=I0(o,c),c=Array.from(c),o=0;o<c.length;){var m=c[o++];if(!kn(m)){if(m.tag===5&&Ft(m.stateNode))return!0;for(m=m.child;m!==null;)c.push(m),m=m.sibling}}return!1},n.getCurrentUpdatePriority=function(){return At},n.getFindAllNodesFailureDescription=function(o,c){if(!xt)throw Error(u(363));var m=0,b=[];o=[$h(o),0];for(var k=0;k<o.length;){var N=o[k++],$=o[k++],pe=c[$];if((N.tag!==5||!kn(N))&&(Wn(N,pe)&&(b.push(ep(pe)),$++,$>m&&(m=$)),$<c.length))for(N=N.child;N!==null;)o.push(N,$),N=N.sibling}if(m<c.length){for(o=[];m<c.length;m++)o.push(ep(c[m]));return`findAllNodes was able to match part of the selector:
|
|
33
|
+
`+(b.join(" > ")+`
|
|
34
|
+
|
|
35
|
+
No matching component was found for:
|
|
36
|
+
`)+o.join(" > ")}return null},n.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return ne(o.child.stateNode);default:return o.child.stateNode}},n.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:d.ReactCurrentDispatcher,findHostInstanceByFiber:j0,findFiberByHostInstance:o.findFiberByHostInstance||Fl,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled||!c.supportsFiber)o=!0;else{try{Pu=c.inject(o),ss=c}catch{}o=!!c.checkDCE}}return o},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(o,c,m,b){if(!xt)throw Error(u(363));o=tp(o,c);var k=Sn(o,m,b).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(o,c){var m=c._getVersion;m=m(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,m]:o.mutableSourceEagerHydrationData.push(c,m)},n.runWithPriority=function(o,c){var m=At;try{return At=o,c()}finally{At=m}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(o,c,m,b){var k=c.current,N=bn(),$=ra(k);return m=Y0(m),c.context===null?c.context=m:c.pendingContext=m,c=Xi(N,$),c.payload={element:o},b=b===void 0?null:b,b!==null&&(c.callback=b),o=Na(k,c,$),o!==null&&(Cr(o,k,$,N),xl(o,k,$)),$},n}),wm}var bm={exports:{}};/**
|
|
37
|
+
* @license React
|
|
38
|
+
* react-reconciler.development.js
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/var Y_;function F8(){return Y_||(Y_=1,process.env.NODE_ENV!=="production"&&(bm.exports=function(e){var n={},s=te,a=xm(),l=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=!1;function d(r){u=r}function p(r){if(!u){for(var i=arguments.length,f=new Array(i>1?i-1:0),g=1;g<i;g++)f[g-1]=arguments[g];y("warn",r,f)}}function h(r){if(!u){for(var i=arguments.length,f=new Array(i>1?i-1:0),g=1;g<i;g++)f[g-1]=arguments[g];y("error",r,f)}}function y(r,i,f){{var g=l.ReactDebugCurrentFrame,v=g.getStackAddendum();v!==""&&(i+="%s",f=f.concat([v]));var T=f.map(function(P){return String(P)});T.unshift("Warning: "+i),Function.prototype.apply.call(console[r],console,T)}}var _=Object.assign;function S(r){return r._reactInternals}function x(r,i){r._reactInternals=i}var w=!1,C=!1,D=!1,U=!0,M=!0,E=!0,L=!0,R=0,z=1,ee=2,O=3,I=4,F=5,V=6,W=7,j=8,Y=9,X=10,ne=11,A=12,B=13,Q=14,H=15,K=16,ae=17,ie=18,de=19,fe=21,se=22,q=23,oe=24,ye=25,ke=Symbol.for("react.element"),Ae=Symbol.for("react.portal"),Me=Symbol.for("react.fragment"),be=Symbol.for("react.strict_mode"),He=Symbol.for("react.profiler"),$e=Symbol.for("react.provider"),Ct=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),Ee=Symbol.for("react.suspense"),yt=Symbol.for("react.suspense_list"),xt=Symbol.for("react.memo"),Et=Symbol.for("react.lazy"),Pt=Symbol.for("react.scope"),On=Symbol.for("react.debug_trace_mode"),kn=Symbol.for("react.offscreen"),sr=Symbol.for("react.legacy_hidden"),Ft=Symbol.for("react.cache"),Sn=Symbol.for("react.tracing_marker"),dn=Symbol.iterator,mr="@@iterator";function Ve(r){if(r===null||typeof r!="object")return null;var i=dn&&r[dn]||r[mr];return typeof i=="function"?i:null}function tt(r,i,f){var g=r.displayName;if(g)return g;var v=i.displayName||i.name||"";return v!==""?f+"("+v+")":f}function St(r){return r.displayName||"Context"}function dt(r){if(r==null)return null;if(typeof r.tag=="number"&&h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case Me:return"Fragment";case Ae:return"Portal";case He:return"Profiler";case be:return"StrictMode";case Ee:return"Suspense";case yt:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case Ct:var i=r;return St(i)+".Consumer";case $e:var f=r;return St(f._context)+".Provider";case le:return tt(r,r.render,"ForwardRef");case xt:var g=r.displayName||null;return g!==null?g:dt(r.type)||"Memo";case Et:{var v=r,T=v._payload,P=v._init;try{return dt(P(T))}catch{return null}}}return null}function gn(r,i,f){var g=i.displayName||i.name||"";return r.displayName||(g!==""?f+"("+g+")":f)}function Gn(r){return r.displayName||"Context"}function ct(r){var i=r.tag,f=r.type;switch(i){case oe:return"Cache";case Y:var g=f;return Gn(g)+".Consumer";case X:var v=f;return Gn(v._context)+".Provider";case ie:return"DehydratedFragment";case ne:return gn(f,f.render,"ForwardRef");case W:return"Fragment";case F:return f;case I:return"Portal";case O:return"Root";case V:return"Text";case K:return dt(f);case j:return f===be?"StrictMode":"Mode";case se:return"Offscreen";case A:return"Profiler";case fe:return"Scope";case B:return"Suspense";case de:return"SuspenseList";case ye:return"TracingMarker";case z:case R:case ae:case ee:case Q:case H:if(typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;break}return null}var at=0,cn=1,un=2,Ot=4,Hi=16,Ca=32,yc=64,Lt=128,mi=256,Gi=512,ns=1024,vi=2048,ni=4096,Xs=8192,mc=16384,Mh=32767,Ta=32768,Zn=65536,vc=131072,yo=1048576,qs=2097152,Ts=4194304,mo=8388608,rs=16777216,hl=33554432,pl=Ot|ns|0,vo=un|Ot|Hi|Ca|Gi|ni|Xs,So=Ot|yc|Gi|Xs,Ks=vi|Hi,ri=Ts|mo|qs,Sc=l.ReactCurrentOwner;function ka(r){var i=r,f=r;if(r.alternate)for(;i.return;)i=i.return;else{var g=i;do i=g,(i.flags&(un|ni))!==at&&(f=i.return),g=i.return;while(g)}return i.tag===O?f:null}function ks(r){return ka(r)===r}function Nu(r){{var i=Sc.current;if(i!==null&&i.tag===z){var f=i,g=f.stateNode;g._warnedAboutRefsInRender||h("%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",ct(f)||"A component"),g._warnedAboutRefsInRender=!0}}var v=S(r);return v?ka(v)===v:!1}function _o(r){if(ka(r)!==r)throw new Error("Unable to find node on an unmounted component.")}function xo(r){var i=r.alternate;if(!i){var f=ka(r);if(f===null)throw new Error("Unable to find node on an unmounted component.");return f!==r?null:r}for(var g=r,v=i;;){var T=g.return;if(T===null)break;var P=T.alternate;if(P===null){var G=T.return;if(G!==null){g=v=G;continue}break}if(T.child===P.child){for(var J=T.child;J;){if(J===g)return _o(T),r;if(J===v)return _o(T),i;J=J.sibling}throw new Error("Unable to find node on an unmounted component.")}if(g.return!==v.return)g=T,v=P;else{for(var re=!1,ce=T.child;ce;){if(ce===g){re=!0,g=T,v=P;break}if(ce===v){re=!0,v=T,g=P;break}ce=ce.sibling}if(!re){for(ce=P.child;ce;){if(ce===g){re=!0,g=P,v=T;break}if(ce===v){re=!0,v=P,g=T;break}ce=ce.sibling}if(!re)throw new Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(g.alternate!==v)throw new Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(g.tag!==O)throw new Error("Unable to find node on an unmounted component.");return g.stateNode.current===g?r:i}function Ms(r){var i=xo(r);return i!==null?Qs(i):null}function Qs(r){if(r.tag===F||r.tag===V)return r;for(var i=r.child;i!==null;){var f=Qs(i);if(f!==null)return f;i=i.sibling}return null}function wo(r){var i=xo(r);return i!==null?_c(i):null}function _c(r){if(r.tag===F||r.tag===V)return r;for(var i=r.child;i!==null;){if(i.tag!==I){var f=_c(i);if(f!==null)return f}i=i.sibling}return null}var gl=Array.isArray;function Vn(r){return gl(r)}var Si=e.getPublicInstance,yn=e.getRootHostContext,fn=e.getChildHostContext,Ds=e.prepareForCommit,$n=e.resetAfterCommit,vr=e.createInstance,is=e.appendInitialChild,Js=e.finalizeInitialChildren,Sr=e.prepareUpdate,Ma=e.shouldSetTextContent,xc=e.createTextInstance,yl=e.scheduleTimeout,ue=e.cancelTimeout,Ce=e.noTimeout,Oe=e.isPrimaryRenderer,Ue=e.warnsIfNotActing,Ge=e.supportsMutation,Xe=e.supportsPersistence,Pe=e.supportsHydration,ze=e.getInstanceFromNode;e.beforeActiveInstanceBlur,e.afterActiveInstanceBlur;var je=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var rt=e.getCurrentEventPriority,ot=e.detachDeletedInstance,ft=e.supportsMicrotasks,pt=e.scheduleMicrotask,Ht=e.supportsTestSelectors,Wt=e.findFiberRoot,_n=e.getBoundingRect,Yn=e.getTextContent,Yt=e.isHiddenSubtree,At=e.matchAccessibilityRole,_r=e.setFocusIfFocusable,As=e.setupIntersectionObserver,Da=e.appendChild,ml=e.appendChildToContainer,wc=e.commitTextUpdate,Ln=e.commitMount,bo=e.commitUpdate,vl=e.insertBefore,Dh=e.insertInContainerBefore,d1=e.removeChild,Pu=e.removeChildFromContainer,ss=e.resetTextContent,f1=e.hideInstance,h1=e.hideTextInstance,as=e.unhideInstance,Zs=e.unhideTextInstance,Ou=e.clearContainer,Ah=e.cloneInstance,Rh=e.createContainerChildSet,u0=e.appendChildToContainerChildSet,Rs=e.finalizeContainerChildren,Aa=e.replaceContainerChildren,Eo=e.cloneHiddenInstance,bc=e.cloneHiddenTextInstance,Iu=e.canHydrateInstance,Vi=e.canHydrateTextInstance,Yi=e.canHydrateSuspenseInstance,Ra=e.isSuspenseInstancePending,os=e.isSuspenseInstanceFallback,$s=e.getSuspenseInstanceFallbackErrorDetails,Co=e.registerSuspenseInstanceRetry,Ec=e.getNextHydratableSibling,Lh=e.getFirstHydratableChild,Nh=e.getFirstHydratableChildWithinContainer,_i=e.getFirstHydratableChildWithinSuspenseInstance,ji=e.hydrateInstance,Mn=e.hydrateTextInstance,Cc=e.hydrateSuspenseInstance,ls=e.getNextHydratableInstanceAfterSuspenseInstance,d0=e.commitHydratedContainer,f0=e.commitHydratedSuspenseInstance,Ph=e.clearSuspenseBoundary,Oh=e.clearSuspenseBoundaryFromContainer,h0=e.shouldDeleteUnhydratedTailInstances,Fu=e.didNotMatchHydratedContainerTextInstance,p0=e.didNotMatchHydratedTextInstance,Sl=e.didNotHydrateInstanceWithinContainer,Ih=e.didNotHydrateInstanceWithinSuspenseInstance,p1=e.didNotHydrateInstance,Uu=e.didNotFindHydratableInstanceWithinContainer,g1=e.didNotFindHydratableTextInstanceWithinContainer,Tc=e.didNotFindHydratableSuspenseInstanceWithinContainer,Bu=e.didNotFindHydratableInstanceWithinSuspenseInstance,g0=e.didNotFindHydratableTextInstanceWithinSuspenseInstance,y0=e.didNotFindHydratableSuspenseInstanceWithinSuspenseInstance,_l=e.didNotFindHydratableInstance,m0=e.didNotFindHydratableTextInstance,zu=e.didNotFindHydratableSuspenseInstance,Hu=e.errorHydratingContainer,Ls=0,Gu,Vu,Fh,Yu,ju,To,xi;function La(){}La.__reactDisabledLog=!0;function Uh(){{if(Ls===0){Gu=console.log,Vu=console.info,Fh=console.warn,Yu=console.error,ju=console.group,To=console.groupCollapsed,xi=console.groupEnd;var r={configurable:!0,enumerable:!0,value:La,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}Ls++}}function v0(){{if(Ls--,Ls===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:_({},r,{value:Gu}),info:_({},r,{value:Vu}),warn:_({},r,{value:Fh}),error:_({},r,{value:Yu}),group:_({},r,{value:ju}),groupCollapsed:_({},r,{value:To}),groupEnd:_({},r,{value:xi})})}Ls<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Wi=l.ReactCurrentDispatcher,Ns;function Ps(r,i,f){{if(Ns===void 0)try{throw Error()}catch(v){var g=v.stack.trim().match(/\n( *(at )?)/);Ns=g&&g[1]||""}return`
|
|
45
|
+
`+Ns+r}}var Wu=!1,Xi;{var Na=typeof WeakMap=="function"?WeakMap:Map;Xi=new Na}function xl(r,i){if(!r||Wu)return"";{var f=Xi.get(r);if(f!==void 0)return f}var g;Wu=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var T;T=Wi.current,Wi.current=null,Uh();try{if(i){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(Be){g=Be}Reflect.construct(r,[],P)}else{try{P.call()}catch(Be){g=Be}r.call(P.prototype)}}else{try{throw Error()}catch(Be){g=Be}r()}}catch(Be){if(Be&&g&&typeof Be.stack=="string"){for(var G=Be.stack.split(`
|
|
46
|
+
`),J=g.stack.split(`
|
|
47
|
+
`),re=G.length-1,ce=J.length-1;re>=1&&ce>=0&&G[re]!==J[ce];)ce--;for(;re>=1&&ce>=0;re--,ce--)if(G[re]!==J[ce]){if(re!==1||ce!==1)do if(re--,ce--,ce<0||G[re]!==J[ce]){var ge=`
|
|
48
|
+
`+G[re].replace(" at new "," at ");return r.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",r.displayName)),typeof r=="function"&&Xi.set(r,ge),ge}while(re>=1&&ce>=0);break}}}finally{Wu=!1,Wi.current=T,v0(),Error.prepareStackTrace=v}var we=r?r.displayName||r.name:"",Ne=we?Ps(we):"";return typeof r=="function"&&Xi.set(r,Ne),Ne}function S0(r,i,f){return xl(r,!0)}function wl(r,i,f){return xl(r,!1)}function _0(r){var i=r.prototype;return!!(i&&i.isReactComponent)}function ko(r,i,f){if(r==null)return"";if(typeof r=="function")return xl(r,_0(r));if(typeof r=="string")return Ps(r);switch(r){case Ee:return Ps("Suspense");case yt:return Ps("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case le:return wl(r.render);case xt:return ko(r.type,i,f);case Et:{var g=r,v=g._payload,T=g._init;try{return ko(T(v),i,f)}catch{}}}return""}var wi=Object.prototype.hasOwnProperty,bl={},Mo=l.ReactDebugCurrentFrame;function bi(r){if(r){var i=r._owner,f=ko(r.type,r._source,i?i.type:null);Mo.setExtraStackFrame(f)}else Mo.setExtraStackFrame(null)}function Ei(r,i,f,g,v){{var T=Function.call.bind(wi);for(var P in r)if(T(r,P)){var G=void 0;try{if(typeof r[P]!="function"){var J=Error((g||"React class")+": "+f+" type `"+P+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[P]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}G=r[P](i,P,g,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(re){G=re}G&&!(G instanceof Error)&&(bi(v),h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",g||"React class",f,P,typeof G),bi(null)),G instanceof Error&&!(G.message in bl)&&(bl[G.message]=!0,bi(v),h("Failed %s type: %s",f,G.message),bi(null))}}}var Pa=[],kc;kc=[];var cs=-1;function on(r){return{current:r}}function er(r,i){if(cs<0){h("Unexpected pop.");return}i!==kc[cs]&&h("Unexpected Fiber popped."),r.current=Pa[cs],Pa[cs]=null,kc[cs]=null,cs--}function tr(r,i,f){cs++,Pa[cs]=r.current,kc[cs]=f,r.current=i}var Mc;Mc={};var Fr={};Object.freeze(Fr);var us=on(Fr),Ur=on(!1),wn=Fr;function Dn(r,i,f){return f&&ii(i)?wn:us.current}function nr(r,i,f){{var g=r.stateNode;g.__reactInternalMemoizedUnmaskedChildContext=i,g.__reactInternalMemoizedMaskedChildContext=f}}function ea(r,i){{var f=r.type,g=f.contextTypes;if(!g)return Fr;var v=r.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===i)return v.__reactInternalMemoizedMaskedChildContext;var T={};for(var P in g)T[P]=i[P];{var G=ct(r)||"Unknown";Ei(g,T,"context",G)}return v&&nr(r,i,T),T}}function Oa(){return Ur.current}function ii(r){{var i=r.childContextTypes;return i!=null}}function Xu(r){er(Ur,r),er(us,r)}function ar(r){er(Ur,r),er(us,r)}function qu(r,i,f){{if(us.current!==Fr)throw new Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");tr(us,i,r),tr(Ur,f,r)}}function Ku(r,i,f){{var g=r.stateNode,v=i.childContextTypes;if(typeof g.getChildContext!="function"){{var T=ct(r)||"Unknown";Mc[T]||(Mc[T]=!0,h("%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.",T,T))}return f}var P=g.getChildContext();for(var G in P)if(!(G in v))throw new Error((ct(r)||"Unknown")+'.getChildContext(): key "'+G+'" is not defined in childContextTypes.');{var J=ct(r)||"Unknown";Ei(v,P,"child context",J)}return _({},f,P)}}function El(r){{var i=r.stateNode,f=i&&i.__reactInternalMemoizedMergedChildContext||Fr;return wn=us.current,tr(us,f,r),tr(Ur,Ur.current,r),!0}}function ds(r,i,f){{var g=r.stateNode;if(!g)throw new Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");if(f){var v=Ku(r,i,wn);g.__reactInternalMemoizedMergedChildContext=v,er(Ur,r),er(us,r),tr(us,v,r),tr(Ur,f,r)}else er(Ur,r),tr(Ur,f,r)}}function qi(r){{if(!ks(r)||r.tag!==z)throw new Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");var i=r;do{switch(i.tag){case O:return i.stateNode.context;case z:{var f=i.type;if(ii(f))return i.stateNode.__reactInternalMemoizedMergedChildContext;break}}i=i.return}while(i!==null);throw new Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.")}}var Os=0,Qu=1,mt=0,Xt=1,an=2,An=8,fs=16,Bh=Math.clz32?Math.clz32:b0,x0=Math.log,w0=Math.LN2;function b0(r){var i=r>>>0;return i===0?32:31-(x0(i)/w0|0)|0}var Do=31,Fe=0,In=0,wt=1,Ao=2,hs=4,Ia=8,ps=16,Cl=32,Ro=4194240,Lo=64,Ju=128,Zu=256,$u=512,zh=1024,ed=2048,Hh=4096,Gh=8192,td=16384,nd=32768,rd=65536,Tl=131072,Vh=262144,Yh=524288,jh=1048576,Ci=2097152,kl=130023424,ta=4194304,id=8388608,sd=16777216,ad=33554432,Dc=67108864,No=ta,Po=134217728,od=268435455,Ac=268435456,Fa=536870912,si=1073741824;function E0(r){{if(r&wt)return"Sync";if(r&Ao)return"InputContinuousHydration";if(r&hs)return"InputContinuous";if(r&Ia)return"DefaultHydration";if(r&ps)return"Default";if(r&Cl)return"TransitionHydration";if(r&Ro)return"Transition";if(r&kl)return"Retry";if(r&Po)return"SelectiveHydration";if(r&Ac)return"IdleHydration";if(r&Fa)return"Idle";if(r&si)return"Offscreen"}}var mn=-1,Rc=Lo,ld=ta;function or(r){switch(Oo(r)){case wt:return wt;case Ao:return Ao;case hs:return hs;case Ia:return Ia;case ps:return ps;case Cl:return Cl;case Lo:case Ju:case Zu:case $u:case zh:case ed:case Hh:case Gh:case td:case nd:case rd:case Tl:case Vh:case Yh:case jh:case Ci:return r&Ro;case ta:case id:case sd:case ad:case Dc:return r&kl;case Po:return Po;case Ac:return Ac;case Fa:return Fa;case si:return si;default:return h("Should have found matching lanes. This is a bug in React."),r}}function lr(r,i){var f=r.pendingLanes;if(f===Fe)return Fe;var g=Fe,v=r.suspendedLanes,T=r.pingedLanes,P=f&od;if(P!==Fe){var G=P&~v;if(G!==Fe)g=or(G);else{var J=P&T;J!==Fe&&(g=or(J))}}else{var re=f&~v;re!==Fe?g=or(re):T!==Fe&&(g=or(T))}if(g===Fe)return Fe;if(i!==Fe&&i!==g&&(i&v)===Fe){var ce=Oo(g),ge=Oo(i);if(ce>=ge||ce===ps&&(ge&Ro)!==Fe)return i}(g&hs)!==Fe&&(g|=f&ps);var we=r.entangledLanes;if(we!==Fe)for(var Ne=r.entanglements,Be=g&we;Be>0;){var Ie=na(Be),ut=1<<Ie;g|=Ne[Ie],Be&=~ut}return g}function C0(r,i){for(var f=r.eventTimes,g=mn;i>0;){var v=na(i),T=1<<v,P=f[v];P>g&&(g=P),i&=~T}return g}function T0(r,i){switch(r){case wt:case Ao:case hs:return i+250;case Ia:case ps:case Cl:case Lo:case Ju:case Zu:case $u:case zh:case ed:case Hh:case Gh:case td:case nd:case rd:case Tl:case Vh:case Yh:case jh:case Ci:return i+5e3;case ta:case id:case sd:case ad:case Dc:return mn;case Po:case Ac:case Fa:case si:return mn;default:return h("Should have found matching lanes. This is a bug in React."),mn}}function k0(r,i){for(var f=r.pendingLanes,g=r.suspendedLanes,v=r.pingedLanes,T=r.expirationTimes,P=f;P>0;){var G=na(P),J=1<<G,re=T[G];re===mn?((J&g)===Fe||(J&v)!==Fe)&&(T[G]=T0(J,i)):re<=i&&(r.expiredLanes|=J),P&=~J}}function M0(r){return or(r.pendingLanes)}function cd(r){var i=r.pendingLanes&~si;return i!==Fe?i:i&si?si:Fe}function Wh(r){return(r&wt)!==Fe}function ud(r){return(r&od)!==Fe}function dd(r){return(r&kl)===r}function D0(r){var i=wt|hs|ps;return(r&i)===Fe}function A0(r){return(r&Ro)===r}function Ml(r,i){var f=Ao|hs|Ia|ps;return(i&f)!==Fe}function Xh(r,i){return(i&r.expiredLanes)!==Fe}function qh(r){return(r&Ro)!==Fe}function fd(){var r=Rc;return Rc<<=1,(Rc&Ro)===Fe&&(Rc=Lo),r}function hd(){var r=ld;return ld<<=1,(ld&kl)===Fe&&(ld=ta),r}function Oo(r){return r&-r}function Dl(r){return Oo(r)}function na(r){return 31-Bh(r)}function pd(r){return na(r)}function Br(r,i){return(r&i)!==Fe}function ai(r,i){return(r&i)===i}function Ut(r,i){return r|i}function Ti(r,i){return r&~i}function Kh(r,i){return r&i}function gd(r){return r}function Lc(r,i){return r!==In&&r<i?r:i}function Al(r){for(var i=[],f=0;f<Do;f++)i.push(r);return i}function Ua(r,i,f){r.pendingLanes|=i,i!==Fa&&(r.suspendedLanes=Fe,r.pingedLanes=Fe);var g=r.eventTimes,v=pd(i);g[v]=f}function R0(r,i){r.suspendedLanes|=i,r.pingedLanes&=~i;for(var f=r.expirationTimes,g=i;g>0;){var v=na(g),T=1<<v;f[v]=mn,g&=~T}}function Rl(r,i,f){r.pingedLanes|=r.suspendedLanes&i}function zr(r,i){var f=r.pendingLanes&~i;r.pendingLanes=i,r.suspendedLanes=Fe,r.pingedLanes=Fe,r.expiredLanes&=i,r.mutableReadLanes&=i,r.entangledLanes&=i;for(var g=r.entanglements,v=r.eventTimes,T=r.expirationTimes,P=f;P>0;){var G=na(P),J=1<<G;g[G]=Fe,v[G]=mn,T[G]=mn,P&=~J}}function Qh(r,i){for(var f=r.entangledLanes|=i,g=r.entanglements,v=f;v;){var T=na(v),P=1<<T;P&i|g[T]&i&&(g[T]|=i),v&=~P}}function y1(r,i){var f=Oo(i),g;switch(f){case hs:g=Ao;break;case ps:g=Ia;break;case Lo:case Ju:case Zu:case $u:case zh:case ed:case Hh:case Gh:case td:case nd:case rd:case Tl:case Vh:case Yh:case jh:case Ci:case ta:case id:case sd:case ad:case Dc:g=Cl;break;case Fa:g=Ac;break;default:g=In;break}return(g&(r.suspendedLanes|i))!==In?In:g}function Nc(r,i,f){if(oi)for(var g=r.pendingUpdatersLaneMap;f>0;){var v=pd(f),T=1<<v,P=g[v];P.add(i),f&=~T}}function xr(r,i){if(oi)for(var f=r.pendingUpdatersLaneMap,g=r.memoizedUpdaters;i>0;){var v=pd(i),T=1<<v,P=f[v];P.size>0&&(P.forEach(function(G){var J=G.alternate;(J===null||!g.has(J))&&g.add(G)}),P.clear()),i&=~T}}function L0(r,i){return null}var Je=wt,Is=hs,Io=ps,yd=Fa,Pc=In;function Yr(){return Pc}function Fn(r){Pc=r}function Jh(r,i){var f=Pc;try{return Pc=r,i()}finally{Pc=f}}function N0(r,i){return r!==0&&r<i?r:i}function P0(r,i){return r>i?r:i}function Zh(r,i){return r!==0&&r<i}function md(r){var i=Oo(r);return Zh(Je,i)?Zh(Is,i)?ud(i)?Io:yd:Is:Je}var vd=a.unstable_scheduleCallback,wr=a.unstable_cancelCallback,gs=a.unstable_shouldYield,Fs=a.unstable_requestPaint,jn=a.unstable_now,Oc=a.unstable_ImmediatePriority,Ki=a.unstable_UserBlockingPriority,Fo=a.unstable_NormalPriority,ys=a.unstable_IdlePriority,m1=a.unstable_yieldValue,O0=a.unstable_setDisableYieldValue,Uo=null,br=null,Ze=null,ki=!1,oi=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u";function Sd(r){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")return!1;var i=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(i.isDisabled)return!0;if(!i.supportsFiber)return h("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://reactjs.org/link/react-devtools"),!0;try{M&&(r=_({},r,{getLaneLabelMap:I0,injectProfilingHooks:ep})),Uo=i.inject(r),br=i}catch(f){h("React instrumentation encountered an error: %s.",f)}return!!i.checkDCE}function _d(r,i){if(br&&typeof br.onScheduleFiberRoot=="function")try{br.onScheduleFiberRoot(Uo,r,i)}catch(f){ki||(ki=!0,h("React instrumentation encountered an error: %s",f))}}function xd(r,i){if(br&&typeof br.onCommitFiberRoot=="function")try{var f=(r.current.flags&Lt)===Lt;if(E){var g;switch(i){case Je:g=Oc;break;case Is:g=Ki;break;case Io:g=Fo;break;case yd:g=ys;break;default:g=Fo;break}br.onCommitFiberRoot(Uo,r,g,f)}}catch(v){ki||(ki=!0,h("React instrumentation encountered an error: %s",v))}}function Ic(r){if(br&&typeof br.onPostCommitFiberRoot=="function")try{br.onPostCommitFiberRoot(Uo,r)}catch(i){ki||(ki=!0,h("React instrumentation encountered an error: %s",i))}}function $h(r){if(br&&typeof br.onCommitFiberUnmount=="function")try{br.onCommitFiberUnmount(Uo,r)}catch(i){ki||(ki=!0,h("React instrumentation encountered an error: %s",i))}}function Wn(r){if(typeof m1=="function"&&(O0(r),d(r)),br&&typeof br.setStrictMode=="function")try{br.setStrictMode(Uo,r)}catch(i){ki||(ki=!0,h("React instrumentation encountered an error: %s",i))}}function ep(r){Ze=r}function I0(){{for(var r=new Map,i=1,f=0;f<Do;f++){var g=E0(i);r.set(i,g),i*=2}return r}}function tp(r){Ze!==null&&typeof Ze.markCommitStarted=="function"&&Ze.markCommitStarted(r)}function F0(){Ze!==null&&typeof Ze.markCommitStopped=="function"&&Ze.markCommitStopped()}function Ba(r){Ze!==null&&typeof Ze.markComponentRenderStarted=="function"&&Ze.markComponentRenderStarted(r)}function za(){Ze!==null&&typeof Ze.markComponentRenderStopped=="function"&&Ze.markComponentRenderStopped()}function Un(r){Ze!==null&&typeof Ze.markComponentPassiveEffectMountStarted=="function"&&Ze.markComponentPassiveEffectMountStarted(r)}function Gt(){Ze!==null&&typeof Ze.markComponentPassiveEffectMountStopped=="function"&&Ze.markComponentPassiveEffectMountStopped()}function cr(r){Ze!==null&&typeof Ze.markComponentPassiveEffectUnmountStarted=="function"&&Ze.markComponentPassiveEffectUnmountStarted(r)}function Xn(){Ze!==null&&typeof Ze.markComponentPassiveEffectUnmountStopped=="function"&&Ze.markComponentPassiveEffectUnmountStopped()}function Er(r){Ze!==null&&typeof Ze.markComponentLayoutEffectMountStarted=="function"&&Ze.markComponentLayoutEffectMountStarted(r)}function Mi(){Ze!==null&&typeof Ze.markComponentLayoutEffectMountStopped=="function"&&Ze.markComponentLayoutEffectMountStopped()}function Bo(r){Ze!==null&&typeof Ze.markComponentLayoutEffectUnmountStarted=="function"&&Ze.markComponentLayoutEffectUnmountStarted(r)}function qn(){Ze!==null&&typeof Ze.markComponentLayoutEffectUnmountStopped=="function"&&Ze.markComponentLayoutEffectUnmountStopped()}function Fc(r,i,f){Ze!==null&&typeof Ze.markComponentErrored=="function"&&Ze.markComponentErrored(r,i,f)}function zo(r,i,f){Ze!==null&&typeof Ze.markComponentSuspended=="function"&&Ze.markComponentSuspended(r,i,f)}function wd(r){Ze!==null&&typeof Ze.markLayoutEffectsStarted=="function"&&Ze.markLayoutEffectsStarted(r)}function np(){Ze!==null&&typeof Ze.markLayoutEffectsStopped=="function"&&Ze.markLayoutEffectsStopped()}function Uc(r){Ze!==null&&typeof Ze.markPassiveEffectsStarted=="function"&&Ze.markPassiveEffectsStarted(r)}function li(){Ze!==null&&typeof Ze.markPassiveEffectsStopped=="function"&&Ze.markPassiveEffectsStopped()}function bd(r){Ze!==null&&typeof Ze.markRenderStarted=="function"&&Ze.markRenderStarted(r)}function rp(){Ze!==null&&typeof Ze.markRenderYielded=="function"&&Ze.markRenderYielded()}function Us(){Ze!==null&&typeof Ze.markRenderStopped=="function"&&Ze.markRenderStopped()}function Ll(r){Ze!==null&&typeof Ze.markRenderScheduled=="function"&&Ze.markRenderScheduled(r)}function Ed(r,i){Ze!==null&&typeof Ze.markForceUpdateScheduled=="function"&&Ze.markForceUpdateScheduled(r,i)}function Bc(r,i){Ze!==null&&typeof Ze.markStateUpdateScheduled=="function"&&Ze.markStateUpdateScheduled(r,i)}function Ha(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Hr=typeof Object.is=="function"?Object.is:Ha,Gr=null,Nl=!1,Ho=!1;function Cd(r){Gr===null?Gr=[r]:Gr.push(r)}function Td(r){Nl=!0,Cd(r)}function zc(){Nl&&bn()}function bn(){if(!Ho&&Gr!==null){Ho=!0;var r=0,i=Yr();try{var f=!0,g=Gr;for(Fn(Je);r<g.length;r++){var v=g[r];do v=v(f);while(v!==null)}Gr=null,Nl=!1}catch(T){throw Gr!==null&&(Gr=Gr.slice(r+1)),vd(Oc,bn),T}finally{Fn(i),Ho=!1}}return null}function ra(r){var i=r.current.memoizedState;return i.isDehydrated}var Cr=[],rr=0,Hc=null,Pl=0,ci=[],Qi=0,ui=null,Bs=1,zs="";function ip(r){return Yo(),(r.flags&yo)!==at}function Go(r){return Yo(),Pl}function U0(){var r=zs,i=Bs,f=i&~v1(i);return f.toString(32)+r}function Ga(r,i){Yo(),Cr[rr++]=Pl,Cr[rr++]=Hc,Hc=r,Pl=i}function kd(r,i,f){Yo(),ci[Qi++]=Bs,ci[Qi++]=zs,ci[Qi++]=ui,ui=r;var g=Bs,v=zs,T=Md(g)-1,P=g&~(1<<T),G=f+1,J=Md(i)+T;if(J>30){var re=T-T%5,ce=(1<<re)-1,ge=(P&ce).toString(32),we=P>>re,Ne=T-re,Be=Md(i)+Ne,Ie=G<<Ne,ut=Ie|we,Tt=ge+v;Bs=1<<Be|ut,zs=Tt}else{var vt=G<<T,pn=vt|P,tn=v;Bs=1<<J|pn,zs=tn}}function Ol(r){Yo();var i=r.return;if(i!==null){var f=1,g=0;Ga(r,f),kd(r,f,g)}}function Md(r){return 32-Bh(r)}function v1(r){return 1<<Md(r)-1}function Dd(r){for(;r===Hc;)Hc=Cr[--rr],Cr[rr]=null,Pl=Cr[--rr],Cr[rr]=null;for(;r===ui;)ui=ci[--Qi],ci[Qi]=null,zs=ci[--Qi],ci[Qi]=null,Bs=ci[--Qi],ci[Qi]=null}function B0(){return Yo(),ui!==null?{id:Bs,overflow:zs}:null}function Vo(r,i){Yo(),ci[Qi++]=Bs,ci[Qi++]=zs,ci[Qi++]=ui,Bs=i.id,zs=i.overflow,ui=r}function Yo(){c()||h("Expected to be hydrating. This is a bug in React. Please file an issue.")}var Rn=null,Di=null,$t=!1,Va=!1,ia=null;function S1(){$t&&h("We should not be hydrating here. This is a bug in React. Please file a bug.")}function z0(){Va=!0}function H0(){return Va}function G0(r){if(!Pe)return!1;var i=r.stateNode.containerInfo;return Di=Nh(i),Rn=r,$t=!0,ia=null,Va=!1,!0}function _1(r,i,f){return Pe?(Di=_i(i),Rn=r,$t=!0,ia=null,Va=!1,f!==null&&Vo(r,f),!0):!1}function Ai(r,i){switch(r.tag){case O:{Sl(r.stateNode.containerInfo,i);break}case F:{var f=(r.mode&Xt)!==mt;p1(r.type,r.memoizedProps,r.stateNode,i,f);break}case B:{var g=r.memoizedState;g.dehydrated!==null&&Ih(g.dehydrated,i);break}}}function Ad(r,i){Ai(r,i);var f=RN();f.stateNode=i,f.return=r;var g=r.deletions;g===null?(r.deletions=[f],r.flags|=Hi):g.push(f)}function sp(r,i){{if(Va)return;switch(r.tag){case O:{var f=r.stateNode.containerInfo;switch(i.tag){case F:var g=i.type,v=i.pendingProps;Uu(f,g,v);break;case V:var T=i.pendingProps;g1(f,T);break;case B:Tc(f);break}break}case F:{var P=r.type,G=r.memoizedProps,J=r.stateNode;switch(i.tag){case F:{var re=i.type,ce=i.pendingProps,ge=(r.mode&Xt)!==mt;_l(P,G,J,re,ce,ge);break}case V:{var we=i.pendingProps,Ne=(r.mode&Xt)!==mt;m0(P,G,J,we,Ne);break}case B:{zu(P,G,J);break}}break}case B:{var Be=r.memoizedState,Ie=Be.dehydrated;if(Ie!==null)switch(i.tag){case F:var ut=i.type,Tt=i.pendingProps;Bu(Ie,ut,Tt);break;case V:var vt=i.pendingProps;g0(Ie,vt);break;case B:y0(Ie);break}break}default:return}}}function sa(r,i){i.flags=i.flags&~ni|un,sp(r,i)}function Gc(r,i){switch(r.tag){case F:{var f=r.type,g=r.pendingProps,v=Iu(i,f,g);return v!==null?(r.stateNode=v,Rn=r,Di=Lh(v),!0):!1}case V:{var T=r.pendingProps,P=Vi(i,T);return P!==null?(r.stateNode=P,Rn=r,Di=null,!0):!1}case B:{var G=Yi(i);if(G!==null){var J={dehydrated:G,treeContext:B0(),retryLane:si};r.memoizedState=J;var re=LN(G);return re.return=r,r.child=re,Rn=r,Di=null,!0}return!1}default:return!1}}function aa(r){return(r.mode&Xt)!==mt&&(r.flags&Lt)===at}function Il(r){throw new Error("Hydration failed because the initial UI does not match what was rendered on the server.")}function Vc(r){if($t){var i=Di;if(!i){aa(r)&&(sp(Rn,r),Il()),sa(Rn,r),$t=!1,Rn=r;return}var f=i;if(!Gc(r,i)){aa(r)&&(sp(Rn,r),Il()),i=Ec(f);var g=Rn;if(!i||!Gc(r,i)){sa(Rn,r),$t=!1,Rn=r;return}Ad(g,f)}}}function ap(r,i,f){if(!Pe)throw new Error("Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");var g=r.stateNode,v=!Va,T=ji(g,r.type,r.memoizedProps,i,f,r,v);return r.updateQueue=T,T!==null}function x1(r){if(!Pe)throw new Error("Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");var i=r.stateNode,f=r.memoizedProps,g=!Va,v=Mn(i,f,r,g);if(v){var T=Rn;if(T!==null)switch(T.tag){case O:{var P=T.stateNode.containerInfo,G=(T.mode&Xt)!==mt;Fu(P,i,f,G);break}case F:{var J=T.type,re=T.memoizedProps,ce=T.stateNode,ge=(T.mode&Xt)!==mt;p0(J,re,ce,i,f,ge);break}}}return v}function V0(r){if(!Pe)throw new Error("Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");var i=r.memoizedState,f=i!==null?i.dehydrated:null;if(!f)throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");Cc(f,r)}function Y0(r){if(!Pe)throw new Error("Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.");var i=r.memoizedState,f=i!==null?i.dehydrated:null;if(!f)throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");return ls(f)}function op(r){for(var i=r.return;i!==null&&i.tag!==F&&i.tag!==O&&i.tag!==B;)i=i.return;Rn=i}function Yc(r){if(!Pe||r!==Rn)return!1;if(!$t)return op(r),$t=!0,!1;if(r.tag!==O&&(r.tag!==F||h0(r.type)&&!Ma(r.type,r.memoizedProps))){var i=Di;if(i)if(aa(r))j0(r),Il();else for(;i;)Ad(r,i),i=Ec(i)}return op(r),r.tag===B?Di=Y0(r):Di=Rn?Ec(r.stateNode):null,!0}function Rd(){return $t&&Di!==null}function j0(r){for(var i=Di;i;)Ai(r,i),i=Ec(i)}function Fl(){Pe&&(Rn=null,Di=null,$t=!1,Va=!1)}function o(){ia!==null&&(n6(ia),ia=null)}function c(){return $t}function m(r){ia===null?ia=[r]:ia.push(r)}var b=l.ReactCurrentBatchConfig,k=null;function N(){return b.transition}function $(r,i){if(Hr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var f=Object.keys(r),g=Object.keys(i);if(f.length!==g.length)return!1;for(var v=0;v<f.length;v++){var T=f[v];if(!wi.call(i,T)||!Hr(r[T],i[T]))return!1}return!0}function pe(r){switch(r._debugOwner&&r._debugOwner.type,r._debugSource,r.tag){case F:return Ps(r.type);case K:return Ps("Lazy");case B:return Ps("Suspense");case de:return Ps("SuspenseList");case R:case ee:case H:return wl(r.type);case ne:return wl(r.type.render);case z:return S0(r.type);default:return""}}function xe(r){try{var i="",f=r;do i+=pe(f),f=f.return;while(f);return i}catch(g){return`
|
|
49
|
+
Error generating stack: `+g.message+`
|
|
50
|
+
`+g.stack}}var Ye=l.ReactDebugCurrentFrame,Ke=null,kt=!1;function nt(){{if(Ke===null)return null;var r=Ke._debugOwner;if(r!==null&&typeof r<"u")return ct(r)}return null}function En(){return Ke===null?"":xe(Ke)}function Bt(){Ye.getCurrentStack=null,Ke=null,kt=!1}function en(r){Ye.getCurrentStack=r===null?null:En,Ke=r,kt=!1}function oa(){return Ke}function ve(r){kt=r}var he={recordUnsafeLifecycleWarnings:function(r,i){},flushPendingUnsafeLifecycleWarnings:function(){},recordLegacyContextWarning:function(r,i){},flushLegacyContextWarning:function(){},discardPendingWarnings:function(){}};{var Te=function(r){for(var i=null,f=r;f!==null;)f.mode&An&&(i=f),f=f.return;return i},Qe=function(r){var i=[];return r.forEach(function(f){i.push(f)}),i.sort().join(", ")},gt=[],Nt=[],Mt=[],qt=[],Nn=[],Kt=[],di=new Set;he.recordUnsafeLifecycleWarnings=function(r,i){di.has(r.type)||(typeof i.componentWillMount=="function"&&i.componentWillMount.__suppressDeprecationWarning!==!0&>.push(r),r.mode&An&&typeof i.UNSAFE_componentWillMount=="function"&&Nt.push(r),typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps.__suppressDeprecationWarning!==!0&&Mt.push(r),r.mode&An&&typeof i.UNSAFE_componentWillReceiveProps=="function"&&qt.push(r),typeof i.componentWillUpdate=="function"&&i.componentWillUpdate.__suppressDeprecationWarning!==!0&&Nn.push(r),r.mode&An&&typeof i.UNSAFE_componentWillUpdate=="function"&&Kt.push(r))},he.flushPendingUnsafeLifecycleWarnings=function(){var r=new Set;gt.length>0&&(gt.forEach(function(we){r.add(ct(we)||"Component"),di.add(we.type)}),gt=[]);var i=new Set;Nt.length>0&&(Nt.forEach(function(we){i.add(ct(we)||"Component"),di.add(we.type)}),Nt=[]);var f=new Set;Mt.length>0&&(Mt.forEach(function(we){f.add(ct(we)||"Component"),di.add(we.type)}),Mt=[]);var g=new Set;qt.length>0&&(qt.forEach(function(we){g.add(ct(we)||"Component"),di.add(we.type)}),qt=[]);var v=new Set;Nn.length>0&&(Nn.forEach(function(we){v.add(ct(we)||"Component"),di.add(we.type)}),Nn=[]);var T=new Set;if(Kt.length>0&&(Kt.forEach(function(we){T.add(ct(we)||"Component"),di.add(we.type)}),Kt=[]),i.size>0){var P=Qe(i);h(`Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.
|
|
51
|
+
|
|
52
|
+
* Move code with side effects to componentDidMount, and set initial state in the constructor.
|
|
53
|
+
|
|
54
|
+
Please update the following components: %s`,P)}if(g.size>0){var G=Qe(g);h(`Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.
|
|
55
|
+
|
|
56
|
+
* Move data fetching code or side effects to componentDidUpdate.
|
|
57
|
+
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state
|
|
58
|
+
|
|
59
|
+
Please update the following components: %s`,G)}if(T.size>0){var J=Qe(T);h(`Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.
|
|
60
|
+
|
|
61
|
+
* Move data fetching code or side effects to componentDidUpdate.
|
|
62
|
+
|
|
63
|
+
Please update the following components: %s`,J)}if(r.size>0){var re=Qe(r);p(`componentWillMount has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.
|
|
64
|
+
|
|
65
|
+
* Move code with side effects to componentDidMount, and set initial state in the constructor.
|
|
66
|
+
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
|
|
67
|
+
|
|
68
|
+
Please update the following components: %s`,re)}if(f.size>0){var ce=Qe(f);p(`componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.
|
|
69
|
+
|
|
70
|
+
* Move data fetching code or side effects to componentDidUpdate.
|
|
71
|
+
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state
|
|
72
|
+
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
|
|
73
|
+
|
|
74
|
+
Please update the following components: %s`,ce)}if(v.size>0){var ge=Qe(v);p(`componentWillUpdate has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.
|
|
75
|
+
|
|
76
|
+
* Move data fetching code or side effects to componentDidUpdate.
|
|
77
|
+
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
|
|
78
|
+
|
|
79
|
+
Please update the following components: %s`,ge)}};var Ld=new Map,ow=new Set;he.recordLegacyContextWarning=function(r,i){var f=Te(r);if(f===null){h("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue.");return}if(!ow.has(r.type)){var g=Ld.get(f);(r.type.contextTypes!=null||r.type.childContextTypes!=null||i!==null&&typeof i.getChildContext=="function")&&(g===void 0&&(g=[],Ld.set(f,g)),g.push(r))}},he.flushLegacyContextWarning=function(){Ld.forEach(function(r,i){if(r.length!==0){var f=r[0],g=new Set;r.forEach(function(T){g.add(ct(T)||"Component"),ow.add(T.type)});var v=Qe(g);try{en(f),h(`Legacy context API has been detected within a strict-mode tree.
|
|
80
|
+
|
|
81
|
+
The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.
|
|
82
|
+
|
|
83
|
+
Please update the following components: %s
|
|
84
|
+
|
|
85
|
+
Learn more about this warning here: https://reactjs.org/link/legacy-context`,v)}finally{Bt()}}})},he.discardPendingWarnings=function(){gt=[],Nt=[],Mt=[],qt=[],Nn=[],Kt=[],Ld=new Map}}function lw(r){{var i=typeof Symbol=="function"&&Symbol.toStringTag,f=i&&r[Symbol.toStringTag]||r.constructor.name||"Object";return f}}function cw(r){try{return w1(r),!1}catch{return!0}}function w1(r){return""+r}function vA(r){if(cw(r))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",lw(r)),w1(r)}function SA(r,i){if(cw(r))return h("The provided `%s` prop is an unsupported type %s. This value must be coerced to a string before before using it here.",i,lw(r)),w1(r)}var b1,E1,C1,T1,k1,uw=function(r,i){};b1=!1,E1=!1,C1={},T1={},k1={},uw=function(r,i){if(!(r===null||typeof r!="object")&&!(!r._store||r._store.validated||r.key!=null)){if(typeof r._store!="object")throw new Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");r._store.validated=!0;var f=ct(i)||"Component";T1[f]||(T1[f]=!0,h('Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.'))}};function _A(r){return r.prototype&&r.prototype.isReactComponent}function lp(r,i,f){var g=f.ref;if(g!==null&&typeof g!="function"&&typeof g!="object"){if((r.mode&An||U)&&!(f._owner&&f._self&&f._owner.stateNode!==f._self)&&!(f._owner&&f._owner.tag!==z)&&!(typeof f.type=="function"&&!_A(f.type))&&f._owner){var v=ct(r)||"Component";C1[v]||(h('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. We recommend using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',v,g),C1[v]=!0)}if(f._owner){var T=f._owner,P;if(T){var G=T;if(G.tag!==z)throw new Error("Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref");P=G.stateNode}if(!P)throw new Error("Missing owner for string ref "+g+". This error is likely caused by a bug in React. Please file an issue.");var J=P;SA(g,"ref");var re=""+g;if(i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===re)return i.ref;var ce=function(ge){var we=J.refs;ge===null?delete we[re]:we[re]=ge};return ce._stringRef=re,ce}else{if(typeof g!="string")throw new Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");if(!f._owner)throw new Error("Element ref was specified as a string ("+g+`) but no owner was set. This could happen for one of the following reasons:
|
|
86
|
+
1. You may be adding a ref to a function component
|
|
87
|
+
2. You may be adding a ref to a component that was not created inside a component's render method
|
|
88
|
+
3. You have multiple copies of React loaded
|
|
89
|
+
See https://reactjs.org/link/refs-must-have-owner for more information.`)}}return g}function W0(r,i){var f=Object.prototype.toString.call(i);throw new Error("Objects are not valid as a React child (found: "+(f==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":f)+"). If you meant to render a collection of children, use an array instead.")}function X0(r){{var i=ct(r)||"Component";if(k1[i])return;k1[i]=!0,h("Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.")}}function dw(r){var i=r._payload,f=r._init;return f(i)}function fw(r){function i(_e,Re){if(r){var Se=_e.deletions;Se===null?(_e.deletions=[Re],_e.flags|=Hi):Se.push(Re)}}function f(_e,Re){if(!r)return null;for(var Se=Re;Se!==null;)i(_e,Se),Se=Se.sibling;return null}function g(_e,Re){for(var Se=new Map,We=Re;We!==null;)We.key!==null?Se.set(We.key,We):Se.set(We.index,We),We=We.sibling;return Se}function v(_e,Re){var Se=$c(_e,Re);return Se.index=0,Se.sibling=null,Se}function T(_e,Re,Se){if(_e.index=Se,!r)return _e.flags|=yo,Re;var We=_e.alternate;if(We!==null){var ht=We.index;return ht<Re?(_e.flags|=un,Re):ht}else return _e.flags|=un,Re}function P(_e){return r&&_e.alternate===null&&(_e.flags|=un),_e}function G(_e,Re,Se,We){if(Re===null||Re.tag!==V){var ht=bS(Se,_e.mode,We);return ht.return=_e,ht}else{var st=v(Re,Se);return st.return=_e,st}}function J(_e,Re,Se,We){var ht=Se.type;if(ht===Me)return ce(_e,Re,Se.props.children,We,Se.key);if(Re!==null&&(Re.elementType===ht||m6(Re,Se)||typeof ht=="object"&&ht!==null&&ht.$$typeof===Et&&dw(ht)===Re.type)){var st=v(Re,Se.props);return st.ref=lp(_e,Re,Se),st.return=_e,st._debugSource=Se._source,st._debugOwner=Se._owner,st}var Jt=wS(Se,_e.mode,We);return Jt.ref=lp(_e,Re,Se),Jt.return=_e,Jt}function re(_e,Re,Se,We){if(Re===null||Re.tag!==I||Re.stateNode.containerInfo!==Se.containerInfo||Re.stateNode.implementation!==Se.implementation){var ht=ES(Se,_e.mode,We);return ht.return=_e,ht}else{var st=v(Re,Se.children||[]);return st.return=_e,st}}function ce(_e,Re,Se,We,ht){if(Re===null||Re.tag!==W){var st=Xl(Se,_e.mode,We,ht);return st.return=_e,st}else{var Jt=v(Re,Se);return Jt.return=_e,Jt}}function ge(_e,Re,Se){if(typeof Re=="string"&&Re!==""||typeof Re=="number"){var We=bS(""+Re,_e.mode,Se);return We.return=_e,We}if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case ke:{var ht=wS(Re,_e.mode,Se);return ht.ref=lp(_e,null,Re),ht.return=_e,ht}case Ae:{var st=ES(Re,_e.mode,Se);return st.return=_e,st}case Et:{var Jt=Re._payload,Dt=Re._init;return ge(_e,Dt(Jt),Se)}}if(Vn(Re)||Ve(Re)){var sn=Xl(Re,_e.mode,Se,null);return sn.return=_e,sn}W0(_e,Re)}return typeof Re=="function"&&X0(_e),null}function we(_e,Re,Se,We){var ht=Re!==null?Re.key:null;if(typeof Se=="string"&&Se!==""||typeof Se=="number")return ht!==null?null:G(_e,Re,""+Se,We);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case ke:return Se.key===ht?J(_e,Re,Se,We):null;case Ae:return Se.key===ht?re(_e,Re,Se,We):null;case Et:{var st=Se._payload,Jt=Se._init;return we(_e,Re,Jt(st),We)}}if(Vn(Se)||Ve(Se))return ht!==null?null:ce(_e,Re,Se,We,null);W0(_e,Se)}return typeof Se=="function"&&X0(_e),null}function Ne(_e,Re,Se,We,ht){if(typeof We=="string"&&We!==""||typeof We=="number"){var st=_e.get(Se)||null;return G(Re,st,""+We,ht)}if(typeof We=="object"&&We!==null){switch(We.$$typeof){case ke:{var Jt=_e.get(We.key===null?Se:We.key)||null;return J(Re,Jt,We,ht)}case Ae:{var Dt=_e.get(We.key===null?Se:We.key)||null;return re(Re,Dt,We,ht)}case Et:var sn=We._payload,jt=We._init;return Ne(_e,Re,Se,jt(sn),ht)}if(Vn(We)||Ve(We)){var Cn=_e.get(Se)||null;return ce(Re,Cn,We,ht,null)}W0(Re,We)}return typeof We=="function"&&X0(Re),null}function Be(_e,Re,Se){{if(typeof _e!="object"||_e===null)return Re;switch(_e.$$typeof){case ke:case Ae:uw(_e,Se);var We=_e.key;if(typeof We!="string")break;if(Re===null){Re=new Set,Re.add(We);break}if(!Re.has(We)){Re.add(We);break}h("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.",We);break;case Et:var ht=_e._payload,st=_e._init;Be(st(ht),Re,Se);break}}return Re}function Ie(_e,Re,Se,We){for(var ht=null,st=0;st<Se.length;st++){var Jt=Se[st];ht=Be(Jt,ht,_e)}for(var Dt=null,sn=null,jt=Re,Cn=0,bt=0,Kn=null;jt!==null&&bt<Se.length;bt++){jt.index>bt?(Kn=jt,jt=null):Kn=jt.sibling;var pi=we(_e,jt,Se[bt],We);if(pi===null){jt===null&&(jt=Kn);break}r&&jt&&pi.alternate===null&&i(_e,jt),Cn=T(pi,Cn,bt),sn===null?Dt=pi:sn.sibling=pi,sn=pi,jt=Kn}if(bt===Se.length){if(f(_e,jt),c()){var Qr=bt;Ga(_e,Qr)}return Dt}if(jt===null){for(;bt<Se.length;bt++){var vs=ge(_e,Se[bt],We);vs!==null&&(Cn=T(vs,Cn,bt),sn===null?Dt=vs:sn.sibling=vs,sn=vs)}if(c()){var Pi=bt;Ga(_e,Pi)}return Dt}for(var Oi=g(_e,jt);bt<Se.length;bt++){var gi=Ne(Oi,_e,bt,Se[bt],We);gi!==null&&(r&&gi.alternate!==null&&Oi.delete(gi.key===null?bt:gi.key),Cn=T(gi,Cn,bt),sn===null?Dt=gi:sn.sibling=gi,sn=gi)}if(r&&Oi.forEach(function(Jd){return i(_e,Jd)}),c()){var Ko=bt;Ga(_e,Ko)}return Dt}function ut(_e,Re,Se,We){var ht=Ve(Se);if(typeof ht!="function")throw new Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");{typeof Symbol=="function"&&Se[Symbol.toStringTag]==="Generator"&&(E1||h("Using Generators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. Keep in mind you might need to polyfill these features for older browsers."),E1=!0),Se.entries===ht&&(b1||h("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),b1=!0);var st=ht.call(Se);if(st)for(var Jt=null,Dt=st.next();!Dt.done;Dt=st.next()){var sn=Dt.value;Jt=Be(sn,Jt,_e)}}var jt=ht.call(Se);if(jt==null)throw new Error("An iterable object provided no iterator.");for(var Cn=null,bt=null,Kn=Re,pi=0,Qr=0,vs=null,Pi=jt.next();Kn!==null&&!Pi.done;Qr++,Pi=jt.next()){Kn.index>Qr?(vs=Kn,Kn=null):vs=Kn.sibling;var Oi=we(_e,Kn,Pi.value,We);if(Oi===null){Kn===null&&(Kn=vs);break}r&&Kn&&Oi.alternate===null&&i(_e,Kn),pi=T(Oi,pi,Qr),bt===null?Cn=Oi:bt.sibling=Oi,bt=Oi,Kn=vs}if(Pi.done){if(f(_e,Kn),c()){var gi=Qr;Ga(_e,gi)}return Cn}if(Kn===null){for(;!Pi.done;Qr++,Pi=jt.next()){var Ko=ge(_e,Pi.value,We);Ko!==null&&(pi=T(Ko,pi,Qr),bt===null?Cn=Ko:bt.sibling=Ko,bt=Ko)}if(c()){var Jd=Qr;Ga(_e,Jd)}return Cn}for(var Gp=g(_e,Kn);!Pi.done;Qr++,Pi=jt.next()){var eo=Ne(Gp,_e,Qr,Pi.value,We);eo!==null&&(r&&eo.alternate!==null&&Gp.delete(eo.key===null?Qr:eo.key),pi=T(eo,pi,Qr),bt===null?Cn=eo:bt.sibling=eo,bt=eo)}if(r&&Gp.forEach(function(JN){return i(_e,JN)}),c()){var QN=Qr;Ga(_e,QN)}return Cn}function Tt(_e,Re,Se,We){if(Re!==null&&Re.tag===V){f(_e,Re.sibling);var ht=v(Re,Se);return ht.return=_e,ht}f(_e,Re);var st=bS(Se,_e.mode,We);return st.return=_e,st}function vt(_e,Re,Se,We){for(var ht=Se.key,st=Re;st!==null;){if(st.key===ht){var Jt=Se.type;if(Jt===Me){if(st.tag===W){f(_e,st.sibling);var Dt=v(st,Se.props.children);return Dt.return=_e,Dt._debugSource=Se._source,Dt._debugOwner=Se._owner,Dt}}else if(st.elementType===Jt||m6(st,Se)||typeof Jt=="object"&&Jt!==null&&Jt.$$typeof===Et&&dw(Jt)===st.type){f(_e,st.sibling);var sn=v(st,Se.props);return sn.ref=lp(_e,st,Se),sn.return=_e,sn._debugSource=Se._source,sn._debugOwner=Se._owner,sn}f(_e,st);break}else i(_e,st);st=st.sibling}if(Se.type===Me){var jt=Xl(Se.props.children,_e.mode,We,Se.key);return jt.return=_e,jt}else{var Cn=wS(Se,_e.mode,We);return Cn.ref=lp(_e,Re,Se),Cn.return=_e,Cn}}function pn(_e,Re,Se,We){for(var ht=Se.key,st=Re;st!==null;){if(st.key===ht)if(st.tag===I&&st.stateNode.containerInfo===Se.containerInfo&&st.stateNode.implementation===Se.implementation){f(_e,st.sibling);var Jt=v(st,Se.children||[]);return Jt.return=_e,Jt}else{f(_e,st);break}else i(_e,st);st=st.sibling}var Dt=ES(Se,_e.mode,We);return Dt.return=_e,Dt}function tn(_e,Re,Se,We){var ht=typeof Se=="object"&&Se!==null&&Se.type===Me&&Se.key===null;if(ht&&(Se=Se.props.children),typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case ke:return P(vt(_e,Re,Se,We));case Ae:return P(pn(_e,Re,Se,We));case Et:var st=Se._payload,Jt=Se._init;return tn(_e,Re,Jt(st),We)}if(Vn(Se))return Ie(_e,Re,Se,We);if(Ve(Se))return ut(_e,Re,Se,We);W0(_e,Se)}return typeof Se=="string"&&Se!==""||typeof Se=="number"?P(Tt(_e,Re,""+Se,We)):(typeof Se=="function"&&X0(_e),f(_e,Re))}return tn}var Nd=fw(!0),hw=fw(!1);function xA(r,i){if(r!==null&&i.child!==r.child)throw new Error("Resuming work not yet implemented.");if(i.child!==null){var f=i.child,g=$c(f,f.pendingProps);for(i.child=g,g.return=i;f.sibling!==null;)f=f.sibling,g=g.sibling=$c(f,f.pendingProps),g.return=i;g.sibling=null}}function wA(r,i){for(var f=r.child;f!==null;)TN(f,i),f=f.sibling}var q0=on(null),cp;cp={};var K0=null,Pd=null,M1=null,Q0=!1;function J0(){K0=null,Pd=null,M1=null,Q0=!1}function pw(){Q0=!0}function gw(){Q0=!1}function yw(r,i,f){Oe?(tr(q0,i._currentValue,r),i._currentValue=f,i._currentRenderer!==void 0&&i._currentRenderer!==null&&i._currentRenderer!==cp&&h("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),i._currentRenderer=cp):(tr(q0,i._currentValue2,r),i._currentValue2=f,i._currentRenderer2!==void 0&&i._currentRenderer2!==null&&i._currentRenderer2!==cp&&h("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),i._currentRenderer2=cp)}function D1(r,i){var f=q0.current;er(q0,i),Oe?r._currentValue=f:r._currentValue2=f}function A1(r,i,f){for(var g=r;g!==null;){var v=g.alternate;if(ai(g.childLanes,i)?v!==null&&!ai(v.childLanes,i)&&(v.childLanes=Ut(v.childLanes,i)):(g.childLanes=Ut(g.childLanes,i),v!==null&&(v.childLanes=Ut(v.childLanes,i))),g===f)break;g=g.return}g!==f&&h("Expected to find the propagation root when scheduling context work. This error is likely caused by a bug in React. Please file an issue.")}function bA(r,i,f){EA(r,i,f)}function EA(r,i,f){var g=r.child;for(g!==null&&(g.return=r);g!==null;){var v=void 0,T=g.dependencies;if(T!==null){v=g.child;for(var P=T.firstContext;P!==null;){if(P.context===i){if(g.tag===z){var G=Dl(f),J=jo(mn,G);J.tag=$0;var re=g.updateQueue;if(re!==null){var ce=re.shared,ge=ce.pending;ge===null?J.next=J:(J.next=ge.next,ge.next=J),ce.pending=J}}g.lanes=Ut(g.lanes,f);var we=g.alternate;we!==null&&(we.lanes=Ut(we.lanes,f)),A1(g.return,f,r),T.lanes=Ut(T.lanes,f);break}P=P.next}}else if(g.tag===X)v=g.type===r.type?null:g.child;else if(g.tag===ie){var Ne=g.return;if(Ne===null)throw new Error("We just came from a parent so we must have had a parent. This is a bug in React.");Ne.lanes=Ut(Ne.lanes,f);var Be=Ne.alternate;Be!==null&&(Be.lanes=Ut(Be.lanes,f)),A1(Ne,f,r),v=g.sibling}else v=g.child;if(v!==null)v.return=g;else for(v=g;v!==null;){if(v===r){v=null;break}var Ie=v.sibling;if(Ie!==null){Ie.return=v.return,v=Ie;break}v=v.return}g=v}}function Od(r,i){K0=r,Pd=null,M1=null;var f=r.dependencies;if(f!==null){var g=f.firstContext;g!==null&&(Br(f.lanes,i)&&Cp(),f.firstContext=null)}}function ur(r){Q0&&h("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");var i=Oe?r._currentValue:r._currentValue2;if(M1!==r){var f={context:r,memoizedValue:i,next:null};if(Pd===null){if(K0===null)throw new Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");Pd=f,K0.dependencies={lanes:Fe,firstContext:f}}else Pd=Pd.next=f}return i}var jc=null;function R1(r){jc===null?jc=[r]:jc.push(r)}function CA(){if(jc!==null){for(var r=0;r<jc.length;r++){var i=jc[r],f=i.interleaved;if(f!==null){i.interleaved=null;var g=f.next,v=i.pending;if(v!==null){var T=v.next;v.next=g,f.next=T}i.pending=f}}jc=null}}function mw(r,i,f,g){var v=i.interleaved;return v===null?(f.next=f,R1(i)):(f.next=v.next,v.next=f),i.interleaved=f,Z0(r,g)}function TA(r,i,f,g){var v=i.interleaved;v===null?(f.next=f,R1(i)):(f.next=v.next,v.next=f),i.interleaved=f}function kA(r,i,f,g){var v=i.interleaved;return v===null?(f.next=f,R1(i)):(f.next=v.next,v.next=f),i.interleaved=f,Z0(r,g)}function Ri(r,i){return Z0(r,i)}var MA=Z0;function Z0(r,i){r.lanes=Ut(r.lanes,i);var f=r.alternate;f!==null&&(f.lanes=Ut(f.lanes,i)),f===null&&(r.flags&(un|ni))!==at&&h6(r);for(var g=r,v=r.return;v!==null;)v.childLanes=Ut(v.childLanes,i),f=v.alternate,f!==null?f.childLanes=Ut(f.childLanes,i):(v.flags&(un|ni))!==at&&h6(r),g=v,v=v.return;if(g.tag===O){var T=g.stateNode;return T}else return null}var vw=0,Sw=1,$0=2,L1=3,ey=!1,N1,ty;N1=!1,ty=null;function P1(r){var i={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:Fe},effects:null};r.updateQueue=i}function _w(r,i){var f=i.updateQueue,g=r.updateQueue;if(f===g){var v={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,effects:g.effects};i.updateQueue=v}}function jo(r,i){var f={eventTime:r,lane:i,tag:vw,payload:null,callback:null,next:null};return f}function Ul(r,i,f){var g=r.updateQueue;if(g===null)return null;var v=g.shared;if(ty===v&&!N1&&(h("An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback."),N1=!0),BL()){var T=v.pending;return T===null?i.next=i:(i.next=T.next,T.next=i),v.pending=i,MA(r,f)}else return kA(r,v,i,f)}function ny(r,i,f){var g=i.updateQueue;if(g!==null){var v=g.shared;if(qh(f)){var T=v.lanes;T=Kh(T,r.pendingLanes);var P=Ut(T,f);v.lanes=P,Qh(r,P)}}}function O1(r,i){var f=r.updateQueue,g=r.alternate;if(g!==null){var v=g.updateQueue;if(f===v){var T=null,P=null,G=f.firstBaseUpdate;if(G!==null){var J=G;do{var re={eventTime:J.eventTime,lane:J.lane,tag:J.tag,payload:J.payload,callback:J.callback,next:null};P===null?T=P=re:(P.next=re,P=re),J=J.next}while(J!==null);P===null?T=P=i:(P.next=i,P=i)}else T=P=i;f={baseState:v.baseState,firstBaseUpdate:T,lastBaseUpdate:P,shared:v.shared,effects:v.effects},r.updateQueue=f;return}}var ce=f.lastBaseUpdate;ce===null?f.firstBaseUpdate=i:ce.next=i,f.lastBaseUpdate=i}function DA(r,i,f,g,v,T){switch(f.tag){case Sw:{var P=f.payload;if(typeof P=="function"){pw();var G=P.call(T,g,v);{if(r.mode&An){Wn(!0);try{P.call(T,g,v)}finally{Wn(!1)}}gw()}return G}return P}case L1:r.flags=r.flags&~Zn|Lt;case vw:{var J=f.payload,re;if(typeof J=="function"){pw(),re=J.call(T,g,v);{if(r.mode&An){Wn(!0);try{J.call(T,g,v)}finally{Wn(!1)}}gw()}}else re=J;return re==null?g:_({},g,re)}case $0:return ey=!0,g}return g}function ry(r,i,f,g){var v=r.updateQueue;ey=!1,ty=v.shared;var T=v.firstBaseUpdate,P=v.lastBaseUpdate,G=v.shared.pending;if(G!==null){v.shared.pending=null;var J=G,re=J.next;J.next=null,P===null?T=re:P.next=re,P=J;var ce=r.alternate;if(ce!==null){var ge=ce.updateQueue,we=ge.lastBaseUpdate;we!==P&&(we===null?ge.firstBaseUpdate=re:we.next=re,ge.lastBaseUpdate=J)}}if(T!==null){var Ne=v.baseState,Be=Fe,Ie=null,ut=null,Tt=null,vt=T;do{var pn=vt.lane,tn=vt.eventTime;if(ai(g,pn)){if(Tt!==null){var Re={eventTime:tn,lane:In,tag:vt.tag,payload:vt.payload,callback:vt.callback,next:null};Tt=Tt.next=Re}Ne=DA(r,v,vt,Ne,i,f);var Se=vt.callback;if(Se!==null&&vt.lane!==In){r.flags|=yc;var We=v.effects;We===null?v.effects=[vt]:We.push(vt)}}else{var _e={eventTime:tn,lane:pn,tag:vt.tag,payload:vt.payload,callback:vt.callback,next:null};Tt===null?(ut=Tt=_e,Ie=Ne):Tt=Tt.next=_e,Be=Ut(Be,pn)}if(vt=vt.next,vt===null){if(G=v.shared.pending,G===null)break;var ht=G,st=ht.next;ht.next=null,vt=st,v.lastBaseUpdate=ht,v.shared.pending=null}}while(!0);Tt===null&&(Ie=Ne),v.baseState=Ie,v.firstBaseUpdate=ut,v.lastBaseUpdate=Tt;var Jt=v.shared.interleaved;if(Jt!==null){var Dt=Jt;do Be=Ut(Be,Dt.lane),Dt=Dt.next;while(Dt!==Jt)}else T===null&&(v.shared.lanes=Fe);Bp(Be),r.lanes=Be,r.memoizedState=Ne}ty=null}function AA(r,i){if(typeof r!="function")throw new Error("Invalid argument passed as callback. Expected a function. Instead "+("received: "+r));r.call(i)}function xw(){ey=!1}function iy(){return ey}function ww(r,i,f){var g=i.effects;if(i.effects=null,g!==null)for(var v=0;v<g.length;v++){var T=g[v],P=T.callback;P!==null&&(T.callback=null,AA(P,f))}}var up={},Bl=on(up),dp=on(up),sy=on(up);function ay(r){if(r===up)throw new Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");return r}function I1(){var r=ay(sy.current);return r}function F1(r,i){tr(sy,i,r),tr(dp,r,r),tr(Bl,up,r);var f=yn(i);er(Bl,r),tr(Bl,f,r)}function Id(r){er(Bl,r),er(dp,r),er(sy,r)}function fp(){var r=ay(Bl.current);return r}function bw(r){var i=ay(sy.current),f=ay(Bl.current),g=fn(f,r.type,i);f!==g&&(tr(dp,r,r),tr(Bl,g,r))}function U1(r){dp.current===r&&(er(Bl,r),er(dp,r))}var RA=0,Ew=1,Cw=1,hp=2,la=on(RA);function B1(r,i){return(r&i)!==0}function Fd(r){return r&Ew}function z1(r,i){return r&Ew|i}function LA(r,i){return r|i}function zl(r,i){tr(la,i,r)}function Ud(r){er(la,r)}function NA(r,i){var f=r.memoizedState;return f!==null?f.dehydrated!==null:(r.memoizedProps,!0)}function oy(r){for(var i=r;i!==null;){if(i.tag===B){var f=i.memoizedState;if(f!==null){var g=f.dehydrated;if(g===null||Ra(g)||os(g))return i}}else if(i.tag===de&&i.memoizedProps.revealOrder!==void 0){var v=(i.flags&Lt)!==at;if(v)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)return null;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Ji=0,Tr=1,Ya=2,kr=4,jr=8,H1=[];function G1(){for(var r=0;r<H1.length;r++){var i=H1[r];Oe?i._workInProgressVersionPrimary=null:i._workInProgressVersionSecondary=null}H1.length=0}function PA(r,i){var f=i._getVersion,g=f(i._source);r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[i,g]:r.mutableSourceEagerHydrationData.push(i,g)}var it=l.ReactCurrentDispatcher,pp=l.ReactCurrentBatchConfig,V1,Bd;V1=new Set;var Wc=Fe,hn=null,Mr=null,Dr=null,ly=!1,gp=!1,yp=0,OA=0,IA=25,Le=null,Hs=null,Hl=-1,Y1=!1;function ln(){{var r=Le;Hs===null?Hs=[r]:Hs.push(r)}}function qe(){{var r=Le;Hs!==null&&(Hl++,Hs[Hl]!==r&&FA(r))}}function zd(r){r!=null&&!Vn(r)&&h("%s received a final argument that is not an array (instead, received `%s`). When specified, the final argument must be an array.",Le,typeof r)}function FA(r){{var i=ct(hn);if(!V1.has(i)&&(V1.add(i),Hs!==null)){for(var f="",g=30,v=0;v<=Hl;v++){for(var T=Hs[v],P=v===Hl?r:T,G=v+1+". "+T;G.length<g;)G+=" ";G+=P+`
|
|
90
|
+
`,f+=G}h(`React has detected a change in the order of Hooks called by %s. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks
|
|
91
|
+
|
|
92
|
+
Previous render Next render
|
|
93
|
+
------------------------------------------------------
|
|
94
|
+
%s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
95
|
+
`,i,f)}}}function fi(){throw new Error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
96
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
97
|
+
2. You might be breaking the Rules of Hooks
|
|
98
|
+
3. You might have more than one copy of React in the same app
|
|
99
|
+
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`)}function j1(r,i){if(Y1)return!1;if(i===null)return h("%s received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.",Le),!1;r.length!==i.length&&h(`The final argument passed to %s changed size between renders. The order and size of this array must remain constant.
|
|
100
|
+
|
|
101
|
+
Previous: %s
|
|
102
|
+
Incoming: %s`,Le,"["+i.join(", ")+"]","["+r.join(", ")+"]");for(var f=0;f<i.length&&f<r.length;f++)if(!Hr(r[f],i[f]))return!1;return!0}function Hd(r,i,f,g,v,T){Wc=T,hn=i,Hs=r!==null?r._debugHookTypes:null,Hl=-1,Y1=r!==null&&r.type!==i.type,i.memoizedState=null,i.updateQueue=null,i.lanes=Fe,r!==null&&r.memoizedState!==null?it.current=Xw:Hs!==null?it.current=Ww:it.current=jw;var P=f(g,v);if(gp){var G=0;do{if(gp=!1,yp=0,G>=IA)throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");G+=1,Y1=!1,Mr=null,Dr=null,i.updateQueue=null,Hl=-1,it.current=qw,P=f(g,v)}while(gp)}it.current=xy,i._debugHookTypes=Hs;var J=Mr!==null&&Mr.next!==null;if(Wc=Fe,hn=null,Mr=null,Dr=null,Le=null,Hs=null,Hl=-1,r!==null&&(r.flags&ri)!==(i.flags&ri)&&(r.mode&Xt)!==mt&&h("Internal React error: Expected static flag was missing. Please notify the React team."),ly=!1,J)throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");return P}function Gd(){var r=yp!==0;return yp=0,r}function Tw(r,i,f){i.updateQueue=r.updateQueue,(i.mode&fs)!==mt?i.flags&=-50333701:i.flags&=-2053,r.lanes=Ti(r.lanes,f)}function kw(){if(it.current=xy,ly){for(var r=hn.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ly=!1}Wc=Fe,hn=null,Mr=null,Dr=null,Hs=null,Hl=-1,Le=null,zw=!1,gp=!1,yp=0}function ja(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dr===null?hn.memoizedState=Dr=r:Dr=Dr.next=r,Dr}function Gs(){var r;if(Mr===null){var i=hn.alternate;i!==null?r=i.memoizedState:r=null}else r=Mr.next;var f;if(Dr===null?f=hn.memoizedState:f=Dr.next,f!==null)Dr=f,f=Dr.next,Mr=r;else{if(r===null)throw new Error("Rendered more hooks than during the previous render.");Mr=r;var g={memoizedState:Mr.memoizedState,baseState:Mr.baseState,baseQueue:Mr.baseQueue,queue:Mr.queue,next:null};Dr===null?hn.memoizedState=Dr=g:Dr=Dr.next=g}return Dr}function Mw(){return{lastEffect:null,stores:null}}function W1(r,i){return typeof i=="function"?i(r):i}function X1(r,i,f){var g=ja(),v;f!==void 0?v=f(i):v=i,g.memoizedState=g.baseState=v;var T={pending:null,interleaved:null,lanes:Fe,dispatch:null,lastRenderedReducer:r,lastRenderedState:v};g.queue=T;var P=T.dispatch=HA.bind(null,hn,T);return[g.memoizedState,P]}function q1(r,i,f){var g=Gs(),v=g.queue;if(v===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");v.lastRenderedReducer=r;var T=Mr,P=T.baseQueue,G=v.pending;if(G!==null){if(P!==null){var J=P.next,re=G.next;P.next=re,G.next=J}T.baseQueue!==P&&h("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React."),T.baseQueue=P=G,v.pending=null}if(P!==null){var ce=P.next,ge=T.baseState,we=null,Ne=null,Be=null,Ie=ce;do{var ut=Ie.lane;if(ai(Wc,ut)){if(Be!==null){var vt={lane:In,action:Ie.action,hasEagerState:Ie.hasEagerState,eagerState:Ie.eagerState,next:null};Be=Be.next=vt}if(Ie.hasEagerState)ge=Ie.eagerState;else{var pn=Ie.action;ge=r(ge,pn)}}else{var Tt={lane:ut,action:Ie.action,hasEagerState:Ie.hasEagerState,eagerState:Ie.eagerState,next:null};Be===null?(Ne=Be=Tt,we=ge):Be=Be.next=Tt,hn.lanes=Ut(hn.lanes,ut),Bp(ut)}Ie=Ie.next}while(Ie!==null&&Ie!==ce);Be===null?we=ge:Be.next=Ne,Hr(ge,g.memoizedState)||Cp(),g.memoizedState=ge,g.baseState=we,g.baseQueue=Be,v.lastRenderedState=ge}var tn=v.interleaved;if(tn!==null){var _e=tn;do{var Re=_e.lane;hn.lanes=Ut(hn.lanes,Re),Bp(Re),_e=_e.next}while(_e!==tn)}else P===null&&(v.lanes=Fe);var Se=v.dispatch;return[g.memoizedState,Se]}function K1(r,i,f){var g=Gs(),v=g.queue;if(v===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");v.lastRenderedReducer=r;var T=v.dispatch,P=v.pending,G=g.memoizedState;if(P!==null){v.pending=null;var J=P.next,re=J;do{var ce=re.action;G=r(G,ce),re=re.next}while(re!==J);Hr(G,g.memoizedState)||Cp(),g.memoizedState=G,g.baseQueue===null&&(g.baseState=G),v.lastRenderedState=G}return[G,T]}function dP(r,i,f){}function fP(r,i,f){}function Q1(r,i,f){var g=hn,v=ja(),T,P=c();if(P){if(f===void 0)throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");T=f(),Bd||T!==f()&&(h("The result of getServerSnapshot should be cached to avoid an infinite loop"),Bd=!0)}else{if(T=i(),!Bd){var G=i();Hr(T,G)||(h("The result of getSnapshot should be cached to avoid an infinite loop"),Bd=!0)}var J=Qy();if(J===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");Ml(J,Wc)||Dw(g,i,T)}v.memoizedState=T;var re={value:T,getSnapshot:i};return v.queue=re,hy(Rw.bind(null,g,re,r),[r]),g.flags|=vi,mp(Tr|jr,Aw.bind(null,g,re,T,i),void 0,null),T}function cy(r,i,f){var g=hn,v=Gs(),T=i();if(!Bd){var P=i();Hr(T,P)||(h("The result of getSnapshot should be cached to avoid an infinite loop"),Bd=!0)}var G=v.memoizedState,J=!Hr(G,T);J&&(v.memoizedState=T,Cp());var re=v.queue;if(Sp(Rw.bind(null,g,re,r),[r]),re.getSnapshot!==i||J||Dr!==null&&Dr.memoizedState.tag&Tr){g.flags|=vi,mp(Tr|jr,Aw.bind(null,g,re,T,i),void 0,null);var ce=Qy();if(ce===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");Ml(ce,Wc)||Dw(g,i,T)}return T}function Dw(r,i,f){r.flags|=mc;var g={getSnapshot:i,value:f},v=hn.updateQueue;if(v===null)v=Mw(),hn.updateQueue=v,v.stores=[g];else{var T=v.stores;T===null?v.stores=[g]:T.push(g)}}function Aw(r,i,f,g){i.value=f,i.getSnapshot=g,Lw(i)&&Nw(r)}function Rw(r,i,f){var g=function(){Lw(i)&&Nw(r)};return f(g)}function Lw(r){var i=r.getSnapshot,f=r.value;try{var g=i();return!Hr(f,g)}catch{return!0}}function Nw(r){var i=Ri(r,wt);i!==null&&fr(i,r,wt,mn)}function uy(r){var i=ja();typeof r=="function"&&(r=r()),i.memoizedState=i.baseState=r;var f={pending:null,interleaved:null,lanes:Fe,dispatch:null,lastRenderedReducer:W1,lastRenderedState:r};i.queue=f;var g=f.dispatch=GA.bind(null,hn,f);return[i.memoizedState,g]}function J1(r){return q1(W1)}function Z1(r){return K1(W1)}function mp(r,i,f,g){var v={tag:r,create:i,destroy:f,deps:g,next:null},T=hn.updateQueue;if(T===null)T=Mw(),hn.updateQueue=T,T.lastEffect=v.next=v;else{var P=T.lastEffect;if(P===null)T.lastEffect=v.next=v;else{var G=P.next;P.next=v,v.next=G,T.lastEffect=v}}return v}function $1(r){var i=ja();{var f={current:r};return i.memoizedState=f,f}}function dy(r){var i=Gs();return i.memoizedState}function vp(r,i,f,g){var v=ja(),T=g===void 0?null:g;hn.flags|=r,v.memoizedState=mp(Tr|i,f,void 0,T)}function fy(r,i,f,g){var v=Gs(),T=g===void 0?null:g,P=void 0;if(Mr!==null){var G=Mr.memoizedState;if(P=G.destroy,T!==null){var J=G.deps;if(j1(T,J)){v.memoizedState=mp(i,f,P,T);return}}}hn.flags|=r,v.memoizedState=mp(Tr|i,f,P,T)}function hy(r,i){return(hn.mode&fs)!==mt?vp(hl|vi|mo,jr,r,i):vp(vi|mo,jr,r,i)}function Sp(r,i){return fy(vi,jr,r,i)}function e2(r,i){return vp(Ot,Ya,r,i)}function py(r,i){return fy(Ot,Ya,r,i)}function t2(r,i){var f=Ot;return f|=Ts,(hn.mode&fs)!==mt&&(f|=rs),vp(f,kr,r,i)}function gy(r,i){return fy(Ot,kr,r,i)}function Pw(r,i){if(typeof i=="function"){var f=i,g=r();return f(g),function(){f(null)}}else if(i!=null){var v=i;v.hasOwnProperty("current")||h("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.","an object with keys {"+Object.keys(v).join(", ")+"}");var T=r();return v.current=T,function(){v.current=null}}}function n2(r,i,f){typeof i!="function"&&h("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",i!==null?typeof i:"null");var g=f!=null?f.concat([r]):null,v=Ot;return v|=Ts,(hn.mode&fs)!==mt&&(v|=rs),vp(v,kr,Pw.bind(null,i,r),g)}function yy(r,i,f){typeof i!="function"&&h("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",i!==null?typeof i:"null");var g=f!=null?f.concat([r]):null;return fy(Ot,kr,Pw.bind(null,i,r),g)}function UA(r,i){}var my=UA;function r2(r,i){var f=ja(),g=i===void 0?null:i;return f.memoizedState=[r,g],r}function vy(r,i){var f=Gs(),g=i===void 0?null:i,v=f.memoizedState;if(v!==null&&g!==null){var T=v[1];if(j1(g,T))return v[0]}return f.memoizedState=[r,g],r}function i2(r,i){var f=ja(),g=i===void 0?null:i,v=r();return f.memoizedState=[v,g],v}function Sy(r,i){var f=Gs(),g=i===void 0?null:i,v=f.memoizedState;if(v!==null&&g!==null){var T=v[1];if(j1(g,T))return v[0]}var P=r();return f.memoizedState=[P,g],P}function s2(r){var i=ja();return i.memoizedState=r,r}function Ow(r){var i=Gs(),f=Mr,g=f.memoizedState;return Fw(i,g,r)}function Iw(r){var i=Gs();if(Mr===null)return i.memoizedState=r,r;var f=Mr.memoizedState;return Fw(i,f,r)}function Fw(r,i,f){var g=!D0(Wc);if(g){if(!Hr(f,i)){var v=fd();hn.lanes=Ut(hn.lanes,v),Bp(v),r.baseState=!0}return i}else return r.baseState&&(r.baseState=!1,Cp()),r.memoizedState=f,f}function BA(r,i,f){var g=Yr();Fn(N0(g,Is)),r(!0);var v=pp.transition;pp.transition={};var T=pp.transition;pp.transition._updatedFibers=new Set;try{r(!1),i()}finally{if(Fn(g),pp.transition=v,v===null&&T._updatedFibers){var P=T._updatedFibers.size;P>10&&p("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),T._updatedFibers.clear()}}}function a2(){var r=uy(!1),i=r[0],f=r[1],g=BA.bind(null,f),v=ja();return v.memoizedState=g,[i,g]}function Uw(){var r=J1(),i=r[0],f=Gs(),g=f.memoizedState;return[i,g]}function Bw(){var r=Z1(),i=r[0],f=Gs(),g=f.memoizedState;return[i,g]}var zw=!1;function zA(){return zw}function o2(){var r=ja(),i=Qy(),f=i.identifierPrefix,g;if(c()){var v=U0();g=":"+f+"R"+v;var T=yp++;T>0&&(g+="H"+T.toString(32)),g+=":"}else{var P=OA++;g=":"+f+"r"+P.toString(32)+":"}return r.memoizedState=g,g}function _y(){var r=Gs(),i=r.memoizedState;return i}function HA(r,i,f){typeof arguments[3]=="function"&&h("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var g=jl(r),v={lane:g,action:f,hasEagerState:!1,eagerState:null,next:null};if(Hw(r))Gw(i,v);else{var T=mw(r,i,v,g);if(T!==null){var P=hi();fr(T,r,g,P),Vw(T,i,g)}}Yw(r,g)}function GA(r,i,f){typeof arguments[3]=="function"&&h("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var g=jl(r),v={lane:g,action:f,hasEagerState:!1,eagerState:null,next:null};if(Hw(r))Gw(i,v);else{var T=r.alternate;if(r.lanes===Fe&&(T===null||T.lanes===Fe)){var P=i.lastRenderedReducer;if(P!==null){var G;G=it.current,it.current=ca;try{var J=i.lastRenderedState,re=P(J,f);if(v.hasEagerState=!0,v.eagerState=re,Hr(re,J)){TA(r,i,v,g);return}}catch{}finally{it.current=G}}}var ce=mw(r,i,v,g);if(ce!==null){var ge=hi();fr(ce,r,g,ge),Vw(ce,i,g)}}Yw(r,g)}function Hw(r){var i=r.alternate;return r===hn||i!==null&&i===hn}function Gw(r,i){gp=ly=!0;var f=r.pending;f===null?i.next=i:(i.next=f.next,f.next=i),r.pending=i}function Vw(r,i,f){if(qh(f)){var g=i.lanes;g=Kh(g,r.pendingLanes);var v=Ut(g,f);i.lanes=v,Qh(r,v)}}function Yw(r,i,f){Bc(r,i)}var xy={readContext:ur,useCallback:fi,useContext:fi,useEffect:fi,useImperativeHandle:fi,useInsertionEffect:fi,useLayoutEffect:fi,useMemo:fi,useReducer:fi,useRef:fi,useState:fi,useDebugValue:fi,useDeferredValue:fi,useTransition:fi,useMutableSource:fi,useSyncExternalStore:fi,useId:fi,unstable_isNewReconciler:w},jw=null,Ww=null,Xw=null,qw=null,Wa=null,ca=null,wy=null;{var l2=function(){h("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")},Rt=function(){h("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks")};jw={readContext:function(r){return ur(r)},useCallback:function(r,i){return Le="useCallback",ln(),zd(i),r2(r,i)},useContext:function(r){return Le="useContext",ln(),ur(r)},useEffect:function(r,i){return Le="useEffect",ln(),zd(i),hy(r,i)},useImperativeHandle:function(r,i,f){return Le="useImperativeHandle",ln(),zd(f),n2(r,i,f)},useInsertionEffect:function(r,i){return Le="useInsertionEffect",ln(),zd(i),e2(r,i)},useLayoutEffect:function(r,i){return Le="useLayoutEffect",ln(),zd(i),t2(r,i)},useMemo:function(r,i){Le="useMemo",ln(),zd(i);var f=it.current;it.current=Wa;try{return i2(r,i)}finally{it.current=f}},useReducer:function(r,i,f){Le="useReducer",ln();var g=it.current;it.current=Wa;try{return X1(r,i,f)}finally{it.current=g}},useRef:function(r){return Le="useRef",ln(),$1(r)},useState:function(r){Le="useState",ln();var i=it.current;it.current=Wa;try{return uy(r)}finally{it.current=i}},useDebugValue:function(r,i){return Le="useDebugValue",ln(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",ln(),s2(r)},useTransition:function(){return Le="useTransition",ln(),a2()},useMutableSource:function(r,i,f){return Le="useMutableSource",ln(),void 0},useSyncExternalStore:function(r,i,f){return Le="useSyncExternalStore",ln(),Q1(r,i,f)},useId:function(){return Le="useId",ln(),o2()},unstable_isNewReconciler:w},Ww={readContext:function(r){return ur(r)},useCallback:function(r,i){return Le="useCallback",qe(),r2(r,i)},useContext:function(r){return Le="useContext",qe(),ur(r)},useEffect:function(r,i){return Le="useEffect",qe(),hy(r,i)},useImperativeHandle:function(r,i,f){return Le="useImperativeHandle",qe(),n2(r,i,f)},useInsertionEffect:function(r,i){return Le="useInsertionEffect",qe(),e2(r,i)},useLayoutEffect:function(r,i){return Le="useLayoutEffect",qe(),t2(r,i)},useMemo:function(r,i){Le="useMemo",qe();var f=it.current;it.current=Wa;try{return i2(r,i)}finally{it.current=f}},useReducer:function(r,i,f){Le="useReducer",qe();var g=it.current;it.current=Wa;try{return X1(r,i,f)}finally{it.current=g}},useRef:function(r){return Le="useRef",qe(),$1(r)},useState:function(r){Le="useState",qe();var i=it.current;it.current=Wa;try{return uy(r)}finally{it.current=i}},useDebugValue:function(r,i){return Le="useDebugValue",qe(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",qe(),s2(r)},useTransition:function(){return Le="useTransition",qe(),a2()},useMutableSource:function(r,i,f){return Le="useMutableSource",qe(),void 0},useSyncExternalStore:function(r,i,f){return Le="useSyncExternalStore",qe(),Q1(r,i,f)},useId:function(){return Le="useId",qe(),o2()},unstable_isNewReconciler:w},Xw={readContext:function(r){return ur(r)},useCallback:function(r,i){return Le="useCallback",qe(),vy(r,i)},useContext:function(r){return Le="useContext",qe(),ur(r)},useEffect:function(r,i){return Le="useEffect",qe(),Sp(r,i)},useImperativeHandle:function(r,i,f){return Le="useImperativeHandle",qe(),yy(r,i,f)},useInsertionEffect:function(r,i){return Le="useInsertionEffect",qe(),py(r,i)},useLayoutEffect:function(r,i){return Le="useLayoutEffect",qe(),gy(r,i)},useMemo:function(r,i){Le="useMemo",qe();var f=it.current;it.current=ca;try{return Sy(r,i)}finally{it.current=f}},useReducer:function(r,i,f){Le="useReducer",qe();var g=it.current;it.current=ca;try{return q1(r,i,f)}finally{it.current=g}},useRef:function(r){return Le="useRef",qe(),dy()},useState:function(r){Le="useState",qe();var i=it.current;it.current=ca;try{return J1(r)}finally{it.current=i}},useDebugValue:function(r,i){return Le="useDebugValue",qe(),my()},useDeferredValue:function(r){return Le="useDeferredValue",qe(),Ow(r)},useTransition:function(){return Le="useTransition",qe(),Uw()},useMutableSource:function(r,i,f){return Le="useMutableSource",qe(),void 0},useSyncExternalStore:function(r,i,f){return Le="useSyncExternalStore",qe(),cy(r,i)},useId:function(){return Le="useId",qe(),_y()},unstable_isNewReconciler:w},qw={readContext:function(r){return ur(r)},useCallback:function(r,i){return Le="useCallback",qe(),vy(r,i)},useContext:function(r){return Le="useContext",qe(),ur(r)},useEffect:function(r,i){return Le="useEffect",qe(),Sp(r,i)},useImperativeHandle:function(r,i,f){return Le="useImperativeHandle",qe(),yy(r,i,f)},useInsertionEffect:function(r,i){return Le="useInsertionEffect",qe(),py(r,i)},useLayoutEffect:function(r,i){return Le="useLayoutEffect",qe(),gy(r,i)},useMemo:function(r,i){Le="useMemo",qe();var f=it.current;it.current=wy;try{return Sy(r,i)}finally{it.current=f}},useReducer:function(r,i,f){Le="useReducer",qe();var g=it.current;it.current=wy;try{return K1(r,i,f)}finally{it.current=g}},useRef:function(r){return Le="useRef",qe(),dy()},useState:function(r){Le="useState",qe();var i=it.current;it.current=wy;try{return Z1(r)}finally{it.current=i}},useDebugValue:function(r,i){return Le="useDebugValue",qe(),my()},useDeferredValue:function(r){return Le="useDeferredValue",qe(),Iw(r)},useTransition:function(){return Le="useTransition",qe(),Bw()},useMutableSource:function(r,i,f){return Le="useMutableSource",qe(),void 0},useSyncExternalStore:function(r,i,f){return Le="useSyncExternalStore",qe(),cy(r,i)},useId:function(){return Le="useId",qe(),_y()},unstable_isNewReconciler:w},Wa={readContext:function(r){return l2(),ur(r)},useCallback:function(r,i){return Le="useCallback",Rt(),ln(),r2(r,i)},useContext:function(r){return Le="useContext",Rt(),ln(),ur(r)},useEffect:function(r,i){return Le="useEffect",Rt(),ln(),hy(r,i)},useImperativeHandle:function(r,i,f){return Le="useImperativeHandle",Rt(),ln(),n2(r,i,f)},useInsertionEffect:function(r,i){return Le="useInsertionEffect",Rt(),ln(),e2(r,i)},useLayoutEffect:function(r,i){return Le="useLayoutEffect",Rt(),ln(),t2(r,i)},useMemo:function(r,i){Le="useMemo",Rt(),ln();var f=it.current;it.current=Wa;try{return i2(r,i)}finally{it.current=f}},useReducer:function(r,i,f){Le="useReducer",Rt(),ln();var g=it.current;it.current=Wa;try{return X1(r,i,f)}finally{it.current=g}},useRef:function(r){return Le="useRef",Rt(),ln(),$1(r)},useState:function(r){Le="useState",Rt(),ln();var i=it.current;it.current=Wa;try{return uy(r)}finally{it.current=i}},useDebugValue:function(r,i){return Le="useDebugValue",Rt(),ln(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",Rt(),ln(),s2(r)},useTransition:function(){return Le="useTransition",Rt(),ln(),a2()},useMutableSource:function(r,i,f){return Le="useMutableSource",Rt(),ln(),void 0},useSyncExternalStore:function(r,i,f){return Le="useSyncExternalStore",Rt(),ln(),Q1(r,i,f)},useId:function(){return Le="useId",Rt(),ln(),o2()},unstable_isNewReconciler:w},ca={readContext:function(r){return l2(),ur(r)},useCallback:function(r,i){return Le="useCallback",Rt(),qe(),vy(r,i)},useContext:function(r){return Le="useContext",Rt(),qe(),ur(r)},useEffect:function(r,i){return Le="useEffect",Rt(),qe(),Sp(r,i)},useImperativeHandle:function(r,i,f){return Le="useImperativeHandle",Rt(),qe(),yy(r,i,f)},useInsertionEffect:function(r,i){return Le="useInsertionEffect",Rt(),qe(),py(r,i)},useLayoutEffect:function(r,i){return Le="useLayoutEffect",Rt(),qe(),gy(r,i)},useMemo:function(r,i){Le="useMemo",Rt(),qe();var f=it.current;it.current=ca;try{return Sy(r,i)}finally{it.current=f}},useReducer:function(r,i,f){Le="useReducer",Rt(),qe();var g=it.current;it.current=ca;try{return q1(r,i,f)}finally{it.current=g}},useRef:function(r){return Le="useRef",Rt(),qe(),dy()},useState:function(r){Le="useState",Rt(),qe();var i=it.current;it.current=ca;try{return J1(r)}finally{it.current=i}},useDebugValue:function(r,i){return Le="useDebugValue",Rt(),qe(),my()},useDeferredValue:function(r){return Le="useDeferredValue",Rt(),qe(),Ow(r)},useTransition:function(){return Le="useTransition",Rt(),qe(),Uw()},useMutableSource:function(r,i,f){return Le="useMutableSource",Rt(),qe(),void 0},useSyncExternalStore:function(r,i,f){return Le="useSyncExternalStore",Rt(),qe(),cy(r,i)},useId:function(){return Le="useId",Rt(),qe(),_y()},unstable_isNewReconciler:w},wy={readContext:function(r){return l2(),ur(r)},useCallback:function(r,i){return Le="useCallback",Rt(),qe(),vy(r,i)},useContext:function(r){return Le="useContext",Rt(),qe(),ur(r)},useEffect:function(r,i){return Le="useEffect",Rt(),qe(),Sp(r,i)},useImperativeHandle:function(r,i,f){return Le="useImperativeHandle",Rt(),qe(),yy(r,i,f)},useInsertionEffect:function(r,i){return Le="useInsertionEffect",Rt(),qe(),py(r,i)},useLayoutEffect:function(r,i){return Le="useLayoutEffect",Rt(),qe(),gy(r,i)},useMemo:function(r,i){Le="useMemo",Rt(),qe();var f=it.current;it.current=ca;try{return Sy(r,i)}finally{it.current=f}},useReducer:function(r,i,f){Le="useReducer",Rt(),qe();var g=it.current;it.current=ca;try{return K1(r,i,f)}finally{it.current=g}},useRef:function(r){return Le="useRef",Rt(),qe(),dy()},useState:function(r){Le="useState",Rt(),qe();var i=it.current;it.current=ca;try{return Z1(r)}finally{it.current=i}},useDebugValue:function(r,i){return Le="useDebugValue",Rt(),qe(),my()},useDeferredValue:function(r){return Le="useDeferredValue",Rt(),qe(),Iw(r)},useTransition:function(){return Le="useTransition",Rt(),qe(),Bw()},useMutableSource:function(r,i,f){return Le="useMutableSource",Rt(),qe(),void 0},useSyncExternalStore:function(r,i,f){return Le="useSyncExternalStore",Rt(),qe(),cy(r,i)},useId:function(){return Le="useId",Rt(),qe(),_y()},unstable_isNewReconciler:w}}var Gl=a.unstable_now,Kw=0,by=-1,_p=-1,Ey=-1,c2=!1,Cy=!1;function Qw(){return c2}function VA(){Cy=!0}function YA(){c2=!1,Cy=!1}function jA(){c2=Cy,Cy=!1}function Jw(){return Kw}function Zw(){Kw=Gl()}function u2(r){_p=Gl(),r.actualStartTime<0&&(r.actualStartTime=Gl())}function $w(r){_p=-1}function Ty(r,i){if(_p>=0){var f=Gl()-_p;r.actualDuration+=f,i&&(r.selfBaseDuration=f),_p=-1}}function Xa(r){if(by>=0){var i=Gl()-by;by=-1;for(var f=r.return;f!==null;){switch(f.tag){case O:var g=f.stateNode;g.effectDuration+=i;return;case A:var v=f.stateNode;v.effectDuration+=i;return}f=f.return}}}function d2(r){if(Ey>=0){var i=Gl()-Ey;Ey=-1;for(var f=r.return;f!==null;){switch(f.tag){case O:var g=f.stateNode;g!==null&&(g.passiveEffectDuration+=i);return;case A:var v=f.stateNode;v!==null&&(v.passiveEffectDuration+=i);return}f=f.return}}}function qa(){by=Gl()}function f2(){Ey=Gl()}function h2(r){for(var i=r.child;i;)r.actualDuration+=i.actualDuration,i=i.sibling}function ua(r,i){if(r&&r.defaultProps){var f=_({},i),g=r.defaultProps;for(var v in g)f[v]===void 0&&(f[v]=g[v]);return f}return i}var p2={},g2,y2,m2,v2,S2,eb,ky,_2,x2,w2,xp;{g2=new Set,y2=new Set,m2=new Set,v2=new Set,_2=new Set,S2=new Set,x2=new Set,w2=new Set,xp=new Set;var tb=new Set;ky=function(r,i){if(!(r===null||typeof r=="function")){var f=i+"_"+r;tb.has(f)||(tb.add(f),h("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",i,r))}},eb=function(r,i){if(i===void 0){var f=dt(r)||"Component";S2.has(f)||(S2.add(f),h("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.",f))}},Object.defineProperty(p2,"_processChildContext",{enumerable:!1,value:function(){throw new Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).")}}),Object.freeze(p2)}function b2(r,i,f,g){var v=r.memoizedState,T=f(g,v);{if(r.mode&An){Wn(!0);try{T=f(g,v)}finally{Wn(!1)}}eb(i,T)}var P=T==null?v:_({},v,T);if(r.memoizedState=P,r.lanes===Fe){var G=r.updateQueue;G.baseState=P}}var E2={isMounted:Nu,enqueueSetState:function(r,i,f){var g=S(r),v=hi(),T=jl(g),P=jo(v,T);P.payload=i,f!=null&&(ky(f,"setState"),P.callback=f);var G=Ul(g,P,T);G!==null&&(fr(G,g,T,v),ny(G,g,T)),Bc(g,T)},enqueueReplaceState:function(r,i,f){var g=S(r),v=hi(),T=jl(g),P=jo(v,T);P.tag=Sw,P.payload=i,f!=null&&(ky(f,"replaceState"),P.callback=f);var G=Ul(g,P,T);G!==null&&(fr(G,g,T,v),ny(G,g,T)),Bc(g,T)},enqueueForceUpdate:function(r,i){var f=S(r),g=hi(),v=jl(f),T=jo(g,v);T.tag=$0,i!=null&&(ky(i,"forceUpdate"),T.callback=i);var P=Ul(f,T,v);P!==null&&(fr(P,f,v,g),ny(P,f,v)),Ed(f,v)}};function nb(r,i,f,g,v,T,P){var G=r.stateNode;if(typeof G.shouldComponentUpdate=="function"){var J=G.shouldComponentUpdate(g,T,P);{if(r.mode&An){Wn(!0);try{J=G.shouldComponentUpdate(g,T,P)}finally{Wn(!1)}}J===void 0&&h("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.",dt(i)||"Component")}return J}return i.prototype&&i.prototype.isPureReactComponent?!$(f,g)||!$(v,T):!0}function WA(r,i,f){var g=r.stateNode;{var v=dt(i)||"Component",T=g.render;T||(i.prototype&&typeof i.prototype.render=="function"?h("%s(...): No `render` method found on the returned component instance: did you accidentally return an object from the constructor?",v):h("%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.",v)),g.getInitialState&&!g.getInitialState.isReactClassApproved&&!g.state&&h("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?",v),g.getDefaultProps&&!g.getDefaultProps.isReactClassApproved&&h("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.",v),g.propTypes&&h("propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.",v),g.contextType&&h("contextType was defined as an instance property on %s. Use a static property to define contextType instead.",v),i.childContextTypes&&!xp.has(i)&&(r.mode&An)===mt&&(xp.add(i),h(`%s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() instead
|
|
103
|
+
|
|
104
|
+
.Learn more about this warning here: https://reactjs.org/link/legacy-context`,v)),i.contextTypes&&!xp.has(i)&&(r.mode&An)===mt&&(xp.add(i),h(`%s uses the legacy contextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() with static contextType instead.
|
|
105
|
+
|
|
106
|
+
Learn more about this warning here: https://reactjs.org/link/legacy-context`,v)),g.contextTypes&&h("contextTypes was defined as an instance property on %s. Use a static property to define contextTypes instead.",v),i.contextType&&i.contextTypes&&!x2.has(i)&&(x2.add(i),h("%s declares both contextTypes and contextType static properties. The legacy contextTypes property will be ignored.",v)),typeof g.componentShouldUpdate=="function"&&h("%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",v),i.prototype&&i.prototype.isPureReactComponent&&typeof g.shouldComponentUpdate<"u"&&h("%s has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.",dt(i)||"A pure component"),typeof g.componentDidUnmount=="function"&&h("%s has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?",v),typeof g.componentDidReceiveProps=="function"&&h("%s has a method called componentDidReceiveProps(). But there is no such lifecycle method. If you meant to update the state in response to changing props, use componentWillReceiveProps(). If you meant to fetch data or run side-effects or mutations after React has updated the UI, use componentDidUpdate().",v),typeof g.componentWillRecieveProps=="function"&&h("%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?",v),typeof g.UNSAFE_componentWillRecieveProps=="function"&&h("%s has a method called UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?",v);var P=g.props!==f;g.props!==void 0&&P&&h("%s(...): When calling super() in `%s`, make sure to pass up the same props that your component's constructor was passed.",v,v),g.defaultProps&&h("Setting defaultProps as an instance property on %s is not supported and will be ignored. Instead, define defaultProps as a static property on %s.",v,v),typeof g.getSnapshotBeforeUpdate=="function"&&typeof g.componentDidUpdate!="function"&&!m2.has(i)&&(m2.add(i),h("%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). This component defines getSnapshotBeforeUpdate() only.",dt(i))),typeof g.getDerivedStateFromProps=="function"&&h("%s: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.",v),typeof g.getDerivedStateFromError=="function"&&h("%s: getDerivedStateFromError() is defined as an instance method and will be ignored. Instead, declare it as a static method.",v),typeof i.getSnapshotBeforeUpdate=="function"&&h("%s: getSnapshotBeforeUpdate() is defined as a static method and will be ignored. Instead, declare it as an instance method.",v);var G=g.state;G&&(typeof G!="object"||Vn(G))&&h("%s.state: must be set to an object or null",v),typeof g.getChildContext=="function"&&typeof i.childContextTypes!="object"&&h("%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().",v)}}function rb(r,i){i.updater=E2,r.stateNode=i,x(i,r),i._reactInternalInstance=p2}function ib(r,i,f){var g=!1,v=Fr,T=Fr,P=i.contextType;if("contextType"in i){var G=P===null||P!==void 0&&P.$$typeof===Ct&&P._context===void 0;if(!G&&!w2.has(i)){w2.add(i);var J="";P===void 0?J=" However, it is set to undefined. This can be caused by a typo or by mixing up named and default imports. This can also happen due to a circular dependency, so try moving the createContext() call to a separate file.":typeof P!="object"?J=" However, it is set to a "+typeof P+".":P.$$typeof===$e?J=" Did you accidentally pass the Context.Provider instead?":P._context!==void 0?J=" Did you accidentally pass the Context.Consumer instead?":J=" However, it is set to an object with keys {"+Object.keys(P).join(", ")+"}.",h("%s defines an invalid contextType. contextType should point to the Context object returned by React.createContext().%s",dt(i)||"Component",J)}}if(typeof P=="object"&&P!==null)T=ur(P);else{v=Dn(r,i,!0);var re=i.contextTypes;g=re!=null,T=g?ea(r,v):Fr}var ce=new i(f,T);if(r.mode&An){Wn(!0);try{ce=new i(f,T)}finally{Wn(!1)}}var ge=r.memoizedState=ce.state!==null&&ce.state!==void 0?ce.state:null;rb(r,ce);{if(typeof i.getDerivedStateFromProps=="function"&&ge===null){var we=dt(i)||"Component";y2.has(we)||(y2.add(we),h("`%s` uses `getDerivedStateFromProps` but its initial state is %s. This is not recommended. Instead, define the initial state by assigning an object to `this.state` in the constructor of `%s`. This ensures that `getDerivedStateFromProps` arguments have a consistent shape.",we,ce.state===null?"null":"undefined",we))}if(typeof i.getDerivedStateFromProps=="function"||typeof ce.getSnapshotBeforeUpdate=="function"){var Ne=null,Be=null,Ie=null;if(typeof ce.componentWillMount=="function"&&ce.componentWillMount.__suppressDeprecationWarning!==!0?Ne="componentWillMount":typeof ce.UNSAFE_componentWillMount=="function"&&(Ne="UNSAFE_componentWillMount"),typeof ce.componentWillReceiveProps=="function"&&ce.componentWillReceiveProps.__suppressDeprecationWarning!==!0?Be="componentWillReceiveProps":typeof ce.UNSAFE_componentWillReceiveProps=="function"&&(Be="UNSAFE_componentWillReceiveProps"),typeof ce.componentWillUpdate=="function"&&ce.componentWillUpdate.__suppressDeprecationWarning!==!0?Ie="componentWillUpdate":typeof ce.UNSAFE_componentWillUpdate=="function"&&(Ie="UNSAFE_componentWillUpdate"),Ne!==null||Be!==null||Ie!==null){var ut=dt(i)||"Component",Tt=typeof i.getDerivedStateFromProps=="function"?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";v2.has(ut)||(v2.add(ut),h(`Unsafe legacy lifecycles will not be called for components using new component APIs.
|
|
107
|
+
|
|
108
|
+
%s uses %s but also contains the following legacy lifecycles:%s%s%s
|
|
109
|
+
|
|
110
|
+
The above lifecycles should be removed. Learn more about this warning here:
|
|
111
|
+
https://reactjs.org/link/unsafe-component-lifecycles`,ut,Tt,Ne!==null?`
|
|
112
|
+
`+Ne:"",Be!==null?`
|
|
113
|
+
`+Be:"",Ie!==null?`
|
|
114
|
+
`+Ie:""))}}}return g&&nr(r,v,T),ce}function XA(r,i){var f=i.state;typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),f!==i.state&&(h("%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.",ct(r)||"Component"),E2.enqueueReplaceState(i,i.state,null))}function sb(r,i,f,g){var v=i.state;if(typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(f,g),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(f,g),i.state!==v){{var T=ct(r)||"Component";g2.has(T)||(g2.add(T),h("%s.componentWillReceiveProps(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.",T))}E2.enqueueReplaceState(i,i.state,null)}}function C2(r,i,f,g){WA(r,i,f);var v=r.stateNode;v.props=f,v.state=r.memoizedState,v.refs={},P1(r);var T=i.contextType;if(typeof T=="object"&&T!==null)v.context=ur(T);else{var P=Dn(r,i,!0);v.context=ea(r,P)}{if(v.state===f){var G=dt(i)||"Component";_2.has(G)||(_2.add(G),h("%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.",G))}r.mode&An&&he.recordLegacyContextWarning(r,v),he.recordUnsafeLifecycleWarnings(r,v)}v.state=r.memoizedState;var J=i.getDerivedStateFromProps;if(typeof J=="function"&&(b2(r,i,J,f),v.state=r.memoizedState),typeof i.getDerivedStateFromProps!="function"&&typeof v.getSnapshotBeforeUpdate!="function"&&(typeof v.UNSAFE_componentWillMount=="function"||typeof v.componentWillMount=="function")&&(XA(r,v),ry(r,f,v,g),v.state=r.memoizedState),typeof v.componentDidMount=="function"){var re=Ot;re|=Ts,(r.mode&fs)!==mt&&(re|=rs),r.flags|=re}}function qA(r,i,f,g){var v=r.stateNode,T=r.memoizedProps;v.props=T;var P=v.context,G=i.contextType,J=Fr;if(typeof G=="object"&&G!==null)J=ur(G);else{var re=Dn(r,i,!0);J=ea(r,re)}var ce=i.getDerivedStateFromProps,ge=typeof ce=="function"||typeof v.getSnapshotBeforeUpdate=="function";!ge&&(typeof v.UNSAFE_componentWillReceiveProps=="function"||typeof v.componentWillReceiveProps=="function")&&(T!==f||P!==J)&&sb(r,v,f,J),xw();var we=r.memoizedState,Ne=v.state=we;if(ry(r,f,v,g),Ne=r.memoizedState,T===f&&we===Ne&&!Oa()&&!iy()){if(typeof v.componentDidMount=="function"){var Be=Ot;Be|=Ts,(r.mode&fs)!==mt&&(Be|=rs),r.flags|=Be}return!1}typeof ce=="function"&&(b2(r,i,ce,f),Ne=r.memoizedState);var Ie=iy()||nb(r,i,T,f,we,Ne,J);if(Ie){if(!ge&&(typeof v.UNSAFE_componentWillMount=="function"||typeof v.componentWillMount=="function")&&(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"){var ut=Ot;ut|=Ts,(r.mode&fs)!==mt&&(ut|=rs),r.flags|=ut}}else{if(typeof v.componentDidMount=="function"){var Tt=Ot;Tt|=Ts,(r.mode&fs)!==mt&&(Tt|=rs),r.flags|=Tt}r.memoizedProps=f,r.memoizedState=Ne}return v.props=f,v.state=Ne,v.context=J,Ie}function KA(r,i,f,g,v){var T=i.stateNode;_w(r,i);var P=i.memoizedProps,G=i.type===i.elementType?P:ua(i.type,P);T.props=G;var J=i.pendingProps,re=T.context,ce=f.contextType,ge=Fr;if(typeof ce=="object"&&ce!==null)ge=ur(ce);else{var we=Dn(i,f,!0);ge=ea(i,we)}var Ne=f.getDerivedStateFromProps,Be=typeof Ne=="function"||typeof T.getSnapshotBeforeUpdate=="function";!Be&&(typeof T.UNSAFE_componentWillReceiveProps=="function"||typeof T.componentWillReceiveProps=="function")&&(P!==J||re!==ge)&&sb(i,T,g,ge),xw();var Ie=i.memoizedState,ut=T.state=Ie;if(ry(i,g,T,v),ut=i.memoizedState,P===J&&Ie===ut&&!Oa()&&!iy()&&!C)return typeof T.componentDidUpdate=="function"&&(P!==r.memoizedProps||Ie!==r.memoizedState)&&(i.flags|=Ot),typeof T.getSnapshotBeforeUpdate=="function"&&(P!==r.memoizedProps||Ie!==r.memoizedState)&&(i.flags|=ns),!1;typeof Ne=="function"&&(b2(i,f,Ne,g),ut=i.memoizedState);var Tt=iy()||nb(i,f,G,g,Ie,ut,ge)||C;return Tt?(!Be&&(typeof T.UNSAFE_componentWillUpdate=="function"||typeof T.componentWillUpdate=="function")&&(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(g,ut,ge),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(g,ut,ge)),typeof T.componentDidUpdate=="function"&&(i.flags|=Ot),typeof T.getSnapshotBeforeUpdate=="function"&&(i.flags|=ns)):(typeof T.componentDidUpdate=="function"&&(P!==r.memoizedProps||Ie!==r.memoizedState)&&(i.flags|=Ot),typeof T.getSnapshotBeforeUpdate=="function"&&(P!==r.memoizedProps||Ie!==r.memoizedState)&&(i.flags|=ns),i.memoizedProps=g,i.memoizedState=ut),T.props=g,T.state=ut,T.context=ge,Tt}function Xc(r,i){return{value:r,source:i,stack:xe(i),digest:null}}function T2(r,i,f){return{value:r,source:null,stack:f??null,digest:i??null}}function QA(r,i){return!0}function k2(r,i){try{var f=QA(r,i);if(f===!1)return;var g=i.value,v=i.source,T=i.stack,P=T!==null?T:"";if(g!=null&&g._suppressLogging){if(r.tag===z)return;console.error(g)}var G=v?ct(v):null,J=G?"The above error occurred in the <"+G+"> component:":"The above error occurred in one of your React components:",re;if(r.tag===O)re=`Consider adding an error boundary to your tree to customize error handling behavior.
|
|
115
|
+
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.`;else{var ce=ct(r)||"Anonymous";re="React will try to recreate this component tree from scratch "+("using the error boundary you provided, "+ce+".")}var ge=J+`
|
|
116
|
+
`+P+`
|
|
117
|
+
|
|
118
|
+
`+(""+re);console.error(ge)}catch(we){setTimeout(function(){throw we})}}var JA=typeof WeakMap=="function"?WeakMap:Map;function ab(r,i,f){var g=jo(mn,f);g.tag=L1,g.payload={element:null};var v=i.value;return g.callback=function(){aN(v),k2(r,i)},g}function M2(r,i,f){var g=jo(mn,f);g.tag=L1;var v=r.type.getDerivedStateFromError;if(typeof v=="function"){var T=i.value;g.payload=function(){return v(T)},g.callback=function(){v6(r),k2(r,i)}}var P=r.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(g.callback=function(){v6(r),k2(r,i),typeof v!="function"&&iN(this);var J=i.value,re=i.stack;this.componentDidCatch(J,{componentStack:re!==null?re:""}),typeof v!="function"&&(Br(r.lanes,wt)||h("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.",ct(r)||"Unknown"))}),g}function ob(r,i,f){var g=r.pingCache,v;if(g===null?(g=r.pingCache=new JA,v=new Set,g.set(i,v)):(v=g.get(i),v===void 0&&(v=new Set,g.set(i,v))),!v.has(f)){v.add(f);var T=oN.bind(null,r,i,f);oi&&zp(r,f),i.then(T,T)}}function ZA(r,i,f,g){var v=r.updateQueue;if(v===null){var T=new Set;T.add(f),r.updateQueue=T}else v.add(f)}function $A(r,i){var f=r.tag;if((r.mode&Xt)===mt&&(f===R||f===ne||f===H)){var g=r.alternate;g?(r.updateQueue=g.updateQueue,r.memoizedState=g.memoizedState,r.lanes=g.lanes):(r.updateQueue=null,r.memoizedState=null)}}function lb(r){var i=r;do{if(i.tag===B&&NA(i))return i;i=i.return}while(i!==null);return null}function cb(r,i,f,g,v){if((r.mode&Xt)===mt){if(r===i)r.flags|=Zn;else{if(r.flags|=Lt,f.flags|=vc,f.flags&=-52805,f.tag===z){var T=f.alternate;if(T===null)f.tag=ae;else{var P=jo(mn,wt);P.tag=$0,Ul(f,P,wt)}}f.lanes=Ut(f.lanes,wt)}return r}return r.flags|=Zn,r.lanes=v,r}function eR(r,i,f,g,v){if(f.flags|=Ta,oi&&zp(r,v),g!==null&&typeof g=="object"&&typeof g.then=="function"){var T=g;$A(f),c()&&f.mode&Xt&&z0();var P=lb(i);if(P!==null){P.flags&=~mi,cb(P,i,f,r,v),P.mode&Xt&&ob(r,T,v),ZA(P,r,T);return}else{if(!Wh(v)){ob(r,T,v),dS();return}var G=new Error("A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.");g=G}}else if(c()&&f.mode&Xt){z0();var J=lb(i);if(J!==null){(J.flags&Zn)===at&&(J.flags|=mi),cb(J,i,f,r,v),m(Xc(g,f));return}}g=Xc(g,f),QL(g);var re=i;do{switch(re.tag){case O:{var ce=g;re.flags|=Zn;var ge=Dl(v);re.lanes=Ut(re.lanes,ge);var we=ab(re,ce,ge);O1(re,we);return}case z:var Ne=g,Be=re.type,Ie=re.stateNode;if((re.flags&Lt)===at&&(typeof Be.getDerivedStateFromError=="function"||Ie!==null&&typeof Ie.componentDidCatch=="function"&&!c6(Ie))){re.flags|=Zn;var ut=Dl(v);re.lanes=Ut(re.lanes,ut);var Tt=M2(re,Ne,ut);O1(re,Tt);return}break}re=re.return}while(re!==null)}function tR(){return null}var wp=l.ReactCurrentOwner,da=!1,D2,bp,A2,R2,L2,qc,N2,My,Ep;D2={},bp={},A2={},R2={},L2={},qc=!1,N2={},My={},Ep={};function Li(r,i,f,g){r===null?i.child=hw(i,null,f,g):i.child=Nd(i,r.child,f,g)}function nR(r,i,f,g){i.child=Nd(i,r.child,null,g),i.child=Nd(i,null,f,g)}function ub(r,i,f,g,v){if(i.type!==i.elementType){var T=f.propTypes;T&&Ei(T,g,"prop",dt(f))}var P=f.render,G=i.ref,J,re;Od(i,v),Ba(i);{if(wp.current=i,ve(!0),J=Hd(r,i,P,g,G,v),re=Gd(),i.mode&An){Wn(!0);try{J=Hd(r,i,P,g,G,v),re=Gd()}finally{Wn(!1)}}ve(!1)}return za(),r!==null&&!da?(Tw(r,i,v),Wo(r,i,v)):(c()&&re&&Ol(i),i.flags|=cn,Li(r,i,J,v),i.child)}function db(r,i,f,g,v){if(r===null){var T=f.type;if(EN(T)&&f.compare===null&&f.defaultProps===void 0){var P=T;return P=Qd(T),i.tag=H,i.type=P,I2(i,T),fb(r,i,P,g,v)}{var G=T.propTypes;if(G&&Ei(G,g,"prop",dt(T)),f.defaultProps!==void 0){var J=dt(T)||"Unknown";Ep[J]||(h("%s: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.",J),Ep[J]=!0)}}var re=xS(f.type,null,g,i,i.mode,v);return re.ref=i.ref,re.return=i,i.child=re,re}{var ce=f.type,ge=ce.propTypes;ge&&Ei(ge,g,"prop",dt(ce))}var we=r.child,Ne=G2(r,v);if(!Ne){var Be=we.memoizedProps,Ie=f.compare;if(Ie=Ie!==null?Ie:$,Ie(Be,g)&&r.ref===i.ref)return Wo(r,i,v)}i.flags|=cn;var ut=$c(we,g);return ut.ref=i.ref,ut.return=i,i.child=ut,ut}function fb(r,i,f,g,v){if(i.type!==i.elementType){var T=i.elementType;if(T.$$typeof===Et){var P=T,G=P._payload,J=P._init;try{T=J(G)}catch{T=null}var re=T&&T.propTypes;re&&Ei(re,g,"prop",dt(T))}}if(r!==null){var ce=r.memoizedProps;if($(ce,g)&&r.ref===i.ref&&i.type===r.type)if(da=!1,i.pendingProps=g=ce,G2(r,v))(r.flags&vc)!==at&&(da=!0);else return i.lanes=r.lanes,Wo(r,i,v)}return P2(r,i,f,g,v)}function hb(r,i,f){var g=i.pendingProps,v=g.children,T=r!==null?r.memoizedState:null;if(g.mode==="hidden"||D)if((i.mode&Xt)===mt){var P={baseLanes:Fe,cachePool:null,transitions:null};i.memoizedState=P,Zy(i,f)}else if(Br(f,si)){var ge={baseLanes:Fe,cachePool:null,transitions:null};i.memoizedState=ge;var we=T!==null?T.baseLanes:f;Zy(i,we)}else{var G=null,J;if(T!==null){var re=T.baseLanes;J=Ut(re,f)}else J=f;i.lanes=i.childLanes=si;var ce={baseLanes:J,cachePool:G,transitions:null};return i.memoizedState=ce,i.updateQueue=null,Zy(i,J),null}else{var Ne;T!==null?(Ne=Ut(T.baseLanes,f),i.memoizedState=null):Ne=f,Zy(i,Ne)}return Li(r,i,v,f),i.child}function rR(r,i,f){var g=i.pendingProps;return Li(r,i,g,f),i.child}function iR(r,i,f){var g=i.pendingProps.children;return Li(r,i,g,f),i.child}function sR(r,i,f){{i.flags|=Ot;{var g=i.stateNode;g.effectDuration=0,g.passiveEffectDuration=0}}var v=i.pendingProps,T=v.children;return Li(r,i,T,f),i.child}function pb(r,i){var f=i.ref;(r===null&&f!==null||r!==null&&r.ref!==f)&&(i.flags|=Gi,i.flags|=qs)}function P2(r,i,f,g,v){if(i.type!==i.elementType){var T=f.propTypes;T&&Ei(T,g,"prop",dt(f))}var P;{var G=Dn(i,f,!0);P=ea(i,G)}var J,re;Od(i,v),Ba(i);{if(wp.current=i,ve(!0),J=Hd(r,i,f,g,P,v),re=Gd(),i.mode&An){Wn(!0);try{J=Hd(r,i,f,g,P,v),re=Gd()}finally{Wn(!1)}}ve(!1)}return za(),r!==null&&!da?(Tw(r,i,v),Wo(r,i,v)):(c()&&re&&Ol(i),i.flags|=cn,Li(r,i,J,v),i.child)}function gb(r,i,f,g,v){{switch(k6(i)){case!1:{var T=i.stateNode,P=i.type,G=new P(i.memoizedProps,T.context),J=G.state;T.updater.enqueueSetState(T,J,null);break}case!0:{i.flags|=Lt,i.flags|=Zn;var re=new Error("Simulated error coming from DevTools"),ce=Dl(v);i.lanes=Ut(i.lanes,ce);var ge=M2(i,Xc(re,i),ce);O1(i,ge);break}}if(i.type!==i.elementType){var we=f.propTypes;we&&Ei(we,g,"prop",dt(f))}}var Ne;ii(f)?(Ne=!0,El(i)):Ne=!1,Od(i,v);var Be=i.stateNode,Ie;Be===null?(Ay(r,i),ib(i,f,g),C2(i,f,g,v),Ie=!0):r===null?Ie=qA(i,f,g,v):Ie=KA(r,i,f,g,v);var ut=O2(r,i,f,Ie,Ne,v);{var Tt=i.stateNode;Ie&&Tt.props!==g&&(qc||h("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.",ct(i)||"a component"),qc=!0)}return ut}function O2(r,i,f,g,v,T){pb(r,i);var P=(i.flags&Lt)!==at;if(!g&&!P)return v&&ds(i,f,!1),Wo(r,i,T);var G=i.stateNode;wp.current=i;var J;if(P&&typeof f.getDerivedStateFromError!="function")J=null,$w();else{Ba(i);{if(ve(!0),J=G.render(),i.mode&An){Wn(!0);try{G.render()}finally{Wn(!1)}}ve(!1)}za()}return i.flags|=cn,r!==null&&P?nR(r,i,J,T):Li(r,i,J,T),i.memoizedState=G.state,v&&ds(i,f,!0),i.child}function yb(r){var i=r.stateNode;i.pendingContext?qu(r,i.pendingContext,i.pendingContext!==i.context):i.context&&qu(r,i.context,!1),F1(r,i.containerInfo)}function aR(r,i,f){if(yb(i),r===null)throw new Error("Should have a current fiber. This is a bug in React.");var g=i.pendingProps,v=i.memoizedState,T=v.element;_w(r,i),ry(i,g,null,f);var P=i.memoizedState;i.stateNode;var G=P.element;if(Pe&&v.isDehydrated){var J={element:G,isDehydrated:!1,cache:P.cache,pendingSuspenseBoundaries:P.pendingSuspenseBoundaries,transitions:P.transitions},re=i.updateQueue;if(re.baseState=J,i.memoizedState=J,i.flags&mi){var ce=Xc(new Error("There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering."),i);return mb(r,i,G,f,ce)}else if(G!==T){var ge=Xc(new Error("This root received an early update, before anything was able hydrate. Switched the entire root to client rendering."),i);return mb(r,i,G,f,ge)}else{G0(i);var we=hw(i,null,G,f);i.child=we;for(var Ne=we;Ne;)Ne.flags=Ne.flags&~un|ni,Ne=Ne.sibling}}else{if(Fl(),G===T)return Wo(r,i,f);Li(r,i,G,f)}return i.child}function mb(r,i,f,g,v){return Fl(),m(v),i.flags|=mi,Li(r,i,f,g),i.child}function oR(r,i,f){bw(i),r===null&&Vc(i);var g=i.type,v=i.pendingProps,T=r!==null?r.memoizedProps:null,P=v.children,G=Ma(g,v);return G?P=null:T!==null&&Ma(g,T)&&(i.flags|=Ca),pb(r,i),Li(r,i,P,f),i.child}function lR(r,i){return r===null&&Vc(i),null}function cR(r,i,f,g){Ay(r,i);var v=i.pendingProps,T=f,P=T._payload,G=T._init,J=G(P);i.type=J;var re=i.tag=CN(J),ce=ua(J,v),ge;switch(re){case R:return I2(i,J),i.type=J=Qd(J),ge=P2(null,i,J,ce,g),ge;case z:return i.type=J=gS(J),ge=gb(null,i,J,ce,g),ge;case ne:return i.type=J=yS(J),ge=ub(null,i,J,ce,g),ge;case Q:{if(i.type!==i.elementType){var we=J.propTypes;we&&Ei(we,ce,"prop",dt(J))}return ge=db(null,i,J,ua(J.type,ce),g),ge}}var Ne="";throw J!==null&&typeof J=="object"&&J.$$typeof===Et&&(Ne=" Did you wrap a component in React.lazy() more than once?"),new Error("Element type is invalid. Received a promise that resolves to: "+J+". "+("Lazy element type must resolve to a class or function."+Ne))}function uR(r,i,f,g,v){Ay(r,i),i.tag=z;var T;return ii(f)?(T=!0,El(i)):T=!1,Od(i,v),ib(i,f,g),C2(i,f,g,v),O2(null,i,f,!0,T,v)}function dR(r,i,f,g){Ay(r,i);var v=i.pendingProps,T;{var P=Dn(i,f,!1);T=ea(i,P)}Od(i,g);var G,J;Ba(i);{if(f.prototype&&typeof f.prototype.render=="function"){var re=dt(f)||"Unknown";D2[re]||(h("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.",re,re),D2[re]=!0)}i.mode&An&&he.recordLegacyContextWarning(i,null),ve(!0),wp.current=i,G=Hd(null,i,f,v,T,g),J=Gd(),ve(!1)}if(za(),i.flags|=cn,typeof G=="object"&&G!==null&&typeof G.render=="function"&&G.$$typeof===void 0){var ce=dt(f)||"Unknown";bp[ce]||(h("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",ce,ce,ce),bp[ce]=!0)}if(typeof G=="object"&&G!==null&&typeof G.render=="function"&&G.$$typeof===void 0){{var ge=dt(f)||"Unknown";bp[ge]||(h("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",ge,ge,ge),bp[ge]=!0)}i.tag=z,i.memoizedState=null,i.updateQueue=null;var we=!1;return ii(f)?(we=!0,El(i)):we=!1,i.memoizedState=G.state!==null&&G.state!==void 0?G.state:null,P1(i),rb(i,G),C2(i,f,v,g),O2(null,i,f,!0,we,g)}else{if(i.tag=R,i.mode&An){Wn(!0);try{G=Hd(null,i,f,v,T,g),J=Gd()}finally{Wn(!1)}}return c()&&J&&Ol(i),Li(null,i,G,g),I2(i,f),i.child}}function I2(r,i){{if(i&&i.childContextTypes&&h("%s(...): childContextTypes cannot be defined on a function component.",i.displayName||i.name||"Component"),r.ref!==null){var f="",g=nt();g&&(f+=`
|
|
119
|
+
|
|
120
|
+
Check the render method of \``+g+"`.");var v=g||"",T=r._debugSource;T&&(v=T.fileName+":"+T.lineNumber),L2[v]||(L2[v]=!0,h("Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s",f))}if(i.defaultProps!==void 0){var P=dt(i)||"Unknown";Ep[P]||(h("%s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.",P),Ep[P]=!0)}if(typeof i.getDerivedStateFromProps=="function"){var G=dt(i)||"Unknown";R2[G]||(h("%s: Function components do not support getDerivedStateFromProps.",G),R2[G]=!0)}if(typeof i.contextType=="object"&&i.contextType!==null){var J=dt(i)||"Unknown";A2[J]||(h("%s: Function components do not support contextType.",J),A2[J]=!0)}}}var F2={dehydrated:null,treeContext:null,retryLane:In};function U2(r){return{baseLanes:r,cachePool:tR(),transitions:null}}function fR(r,i){var f=null;return{baseLanes:Ut(r.baseLanes,i),cachePool:f,transitions:r.transitions}}function hR(r,i,f,g){if(i!==null){var v=i.memoizedState;if(v===null)return!1}return B1(r,hp)}function pR(r,i){return Ti(r.childLanes,i)}function vb(r,i,f){var g=i.pendingProps;D6(i)&&(i.flags|=Lt);var v=la.current,T=!1,P=(i.flags&Lt)!==at;if(P||hR(v,r)?(T=!0,i.flags&=~Lt):(r===null||r.memoizedState!==null)&&(v=LA(v,Cw)),v=Fd(v),zl(i,v),r===null){Vc(i);var G=i.memoizedState;if(G!==null){var J=G.dehydrated;if(J!==null)return SR(i,J)}var re=g.children,ce=g.fallback;if(T){var ge=gR(i,re,ce,f),we=i.child;return we.memoizedState=U2(f),i.memoizedState=F2,ge}else return B2(i,re)}else{var Ne=r.memoizedState;if(Ne!==null){var Be=Ne.dehydrated;if(Be!==null)return _R(r,i,P,g,Be,Ne,f)}if(T){var Ie=g.fallback,ut=g.children,Tt=mR(r,i,ut,Ie,f),vt=i.child,pn=r.child.memoizedState;return vt.memoizedState=pn===null?U2(f):fR(pn,f),vt.childLanes=pR(r,f),i.memoizedState=F2,Tt}else{var tn=g.children,_e=yR(r,i,tn,f);return i.memoizedState=null,_e}}}function B2(r,i,f){var g=r.mode,v={mode:"visible",children:i},T=z2(v,g);return T.return=r,r.child=T,T}function gR(r,i,f,g){var v=r.mode,T=r.child,P={mode:"hidden",children:i},G,J;return(v&Xt)===mt&&T!==null?(G=T,G.childLanes=Fe,G.pendingProps=P,r.mode&an&&(G.actualDuration=0,G.actualStartTime=-1,G.selfBaseDuration=0,G.treeBaseDuration=0),J=Xl(f,v,g,null)):(G=z2(P,v),J=Xl(f,v,g,null)),G.return=r,J.return=r,G.sibling=J,r.child=G,J}function z2(r,i,f){return _6(r,i,Fe,null)}function Sb(r,i){return $c(r,i)}function yR(r,i,f,g){var v=r.child,T=v.sibling,P=Sb(v,{mode:"visible",children:f});if((i.mode&Xt)===mt&&(P.lanes=g),P.return=i,P.sibling=null,T!==null){var G=i.deletions;G===null?(i.deletions=[T],i.flags|=Hi):G.push(T)}return i.child=P,P}function mR(r,i,f,g,v){var T=i.mode,P=r.child,G=P.sibling,J={mode:"hidden",children:f},re;if((T&Xt)===mt&&i.child!==P){var ce=i.child;re=ce,re.childLanes=Fe,re.pendingProps=J,i.mode&an&&(re.actualDuration=0,re.actualStartTime=-1,re.selfBaseDuration=P.selfBaseDuration,re.treeBaseDuration=P.treeBaseDuration),i.deletions=null}else re=Sb(P,J),re.subtreeFlags=P.subtreeFlags&ri;var ge;return G!==null?ge=$c(G,g):(ge=Xl(g,T,v,null),ge.flags|=un),ge.return=i,re.return=i,re.sibling=ge,i.child=re,ge}function Dy(r,i,f,g){g!==null&&m(g),Nd(i,r.child,null,f);var v=i.pendingProps,T=v.children,P=B2(i,T);return P.flags|=un,i.memoizedState=null,P}function vR(r,i,f,g,v){var T=i.mode,P={mode:"visible",children:f},G=z2(P,T),J=Xl(g,T,v,null);return J.flags|=un,G.return=i,J.return=i,G.sibling=J,i.child=G,(i.mode&Xt)!==mt&&Nd(i,r.child,null,v),J}function SR(r,i,f){return(r.mode&Xt)===mt?(h("Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOMClient.hydrateRoot(container, <App />).render(element) or remove the Suspense components from the server rendered components."),r.lanes=wt):os(i)?r.lanes=Ia:r.lanes=si,null}function _R(r,i,f,g,v,T,P){if(f)if(i.flags&mi){i.flags&=~mi;var _e=T2(new Error("There was an error while hydrating this Suspense boundary. Switched to client rendering."));return Dy(r,i,P,_e)}else{if(i.memoizedState!==null)return i.child=r.child,i.flags|=Lt,null;var Re=g.children,Se=g.fallback,We=vR(r,i,Re,Se,P),ht=i.child;return ht.memoizedState=U2(P),i.memoizedState=F2,We}else{if(S1(),(i.mode&Xt)===mt)return Dy(r,i,P,null);if(os(v)){var G,J,re;{var ce=$s(v);G=ce.digest,J=ce.message,re=ce.stack}var ge;J?ge=new Error(J):ge=new Error("The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.");var we=T2(ge,G,re);return Dy(r,i,P,we)}var Ne=Br(P,r.childLanes);if(da||Ne){var Be=Qy();if(Be!==null){var Ie=y1(Be,P);if(Ie!==In&&Ie!==T.retryLane){T.retryLane=Ie;var ut=mn;Ri(r,Ie),fr(Be,r,Ie,ut)}}dS();var Tt=T2(new Error("This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition."));return Dy(r,i,P,Tt)}else if(Ra(v)){i.flags|=Lt,i.child=r.child;var vt=lN.bind(null,r);return Co(v,vt),null}else{_1(i,v,T.treeContext);var pn=g.children,tn=B2(i,pn);return tn.flags|=ni,tn}}}function _b(r,i,f){r.lanes=Ut(r.lanes,i);var g=r.alternate;g!==null&&(g.lanes=Ut(g.lanes,i)),A1(r.return,i,f)}function xR(r,i,f){for(var g=i;g!==null;){if(g.tag===B){var v=g.memoizedState;v!==null&&_b(g,f,r)}else if(g.tag===de)_b(g,f,r);else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===r)return;for(;g.sibling===null;){if(g.return===null||g.return===r)return;g=g.return}g.sibling.return=g.return,g=g.sibling}}function wR(r){for(var i=r,f=null;i!==null;){var g=i.alternate;g!==null&&oy(g)===null&&(f=i),i=i.sibling}return f}function bR(r){if(r!==void 0&&r!=="forwards"&&r!=="backwards"&&r!=="together"&&!N2[r])if(N2[r]=!0,typeof r=="string")switch(r.toLowerCase()){case"together":case"forwards":case"backwards":{h('"%s" is not a valid value for revealOrder on <SuspenseList />. Use lowercase "%s" instead.',r,r.toLowerCase());break}case"forward":case"backward":{h('"%s" is not a valid value for revealOrder on <SuspenseList />. React uses the -s suffix in the spelling. Use "%ss" instead.',r,r.toLowerCase());break}default:h('"%s" is not a supported revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?',r);break}else h('%s is not a supported value for revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?',r)}function ER(r,i){r!==void 0&&!My[r]&&(r!=="collapsed"&&r!=="hidden"?(My[r]=!0,h('"%s" is not a supported value for tail on <SuspenseList />. Did you mean "collapsed" or "hidden"?',r)):i!=="forwards"&&i!=="backwards"&&(My[r]=!0,h('<SuspenseList tail="%s" /> is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?',r)))}function xb(r,i){{var f=Vn(r),g=!f&&typeof Ve(r)=="function";if(f||g){var v=f?"array":"iterable";return h("A nested %s was passed to row #%s in <SuspenseList />. Wrap it in an additional SuspenseList to configure its revealOrder: <SuspenseList revealOrder=...> ... <SuspenseList revealOrder=...>{%s}</SuspenseList> ... </SuspenseList>",v,i,v),!1}}return!0}function CR(r,i){if((i==="forwards"||i==="backwards")&&r!==void 0&&r!==null&&r!==!1)if(Vn(r)){for(var f=0;f<r.length;f++)if(!xb(r[f],f))return}else{var g=Ve(r);if(typeof g=="function"){var v=g.call(r);if(v)for(var T=v.next(),P=0;!T.done;T=v.next()){if(!xb(T.value,P))return;P++}}else h('A single row was passed to a <SuspenseList revealOrder="%s" />. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?',i)}}function H2(r,i,f,g,v){var T=r.memoizedState;T===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:g,tail:f,tailMode:v}:(T.isBackwards=i,T.rendering=null,T.renderingStartTime=0,T.last=g,T.tail=f,T.tailMode=v)}function wb(r,i,f){var g=i.pendingProps,v=g.revealOrder,T=g.tail,P=g.children;bR(v),ER(T,v),CR(P,v),Li(r,i,P,f);var G=la.current,J=B1(G,hp);if(J)G=z1(G,hp),i.flags|=Lt;else{var re=r!==null&&(r.flags&Lt)!==at;re&&xR(i,i.child,f),G=Fd(G)}if(zl(i,G),(i.mode&Xt)===mt)i.memoizedState=null;else switch(v){case"forwards":{var ce=wR(i.child),ge;ce===null?(ge=i.child,i.child=null):(ge=ce.sibling,ce.sibling=null),H2(i,!1,ge,ce,T);break}case"backwards":{var we=null,Ne=i.child;for(i.child=null;Ne!==null;){var Be=Ne.alternate;if(Be!==null&&oy(Be)===null){i.child=Ne;break}var Ie=Ne.sibling;Ne.sibling=we,we=Ne,Ne=Ie}H2(i,!0,we,null,T);break}case"together":{H2(i,!1,null,null,void 0);break}default:i.memoizedState=null}return i.child}function TR(r,i,f){F1(i,i.stateNode.containerInfo);var g=i.pendingProps;return r===null?i.child=Nd(i,null,g,f):Li(r,i,g,f),i.child}var bb=!1;function kR(r,i,f){var g=i.type,v=g._context,T=i.pendingProps,P=i.memoizedProps,G=T.value;{"value"in T||bb||(bb=!0,h("The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?"));var J=i.type.propTypes;J&&Ei(J,T,"prop","Context.Provider")}if(yw(i,v,G),P!==null){var re=P.value;if(Hr(re,G)){if(P.children===T.children&&!Oa())return Wo(r,i,f)}else bA(i,v,f)}var ce=T.children;return Li(r,i,ce,f),i.child}var Eb=!1;function MR(r,i,f){var g=i.type;g._context===void 0?g!==g.Consumer&&(Eb||(Eb=!0,h("Rendering <Context> directly is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?"))):g=g._context;var v=i.pendingProps,T=v.children;typeof T!="function"&&h("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it."),Od(i,f);var P=ur(g);Ba(i);var G;return wp.current=i,ve(!0),G=T(P),ve(!1),za(),i.flags|=cn,Li(r,i,G,f),i.child}function Cp(){da=!0}function Ay(r,i){(i.mode&Xt)===mt&&r!==null&&(r.alternate=null,i.alternate=null,i.flags|=un)}function Wo(r,i,f){return r!==null&&(i.dependencies=r.dependencies),$w(),Bp(i.lanes),Br(f,i.childLanes)?(xA(r,i),i.child):null}function DR(r,i,f){{var g=i.return;if(g===null)throw new Error("Cannot swap the root fiber.");if(r.alternate=null,i.alternate=null,f.index=i.index,f.sibling=i.sibling,f.return=i.return,f.ref=i.ref,i===g.child)g.child=f;else{var v=g.child;if(v===null)throw new Error("Expected parent to have a child.");for(;v.sibling!==i;)if(v=v.sibling,v===null)throw new Error("Expected to find the previous sibling.");v.sibling=f}var T=g.deletions;return T===null?(g.deletions=[r],g.flags|=Hi):T.push(r),f.flags|=un,f}}function G2(r,i){var f=r.lanes;return!!Br(f,i)}function AR(r,i,f){switch(i.tag){case O:yb(i),i.stateNode,Fl();break;case F:bw(i);break;case z:{var g=i.type;ii(g)&&El(i);break}case I:F1(i,i.stateNode.containerInfo);break;case X:{var v=i.memoizedProps.value,T=i.type._context;yw(i,T,v);break}case A:{var P=Br(f,i.childLanes);P&&(i.flags|=Ot);{var G=i.stateNode;G.effectDuration=0,G.passiveEffectDuration=0}}break;case B:{var J=i.memoizedState;if(J!==null){if(J.dehydrated!==null)return zl(i,Fd(la.current)),i.flags|=Lt,null;var re=i.child,ce=re.childLanes;if(Br(f,ce))return vb(r,i,f);zl(i,Fd(la.current));var ge=Wo(r,i,f);return ge!==null?ge.sibling:null}else zl(i,Fd(la.current));break}case de:{var we=(r.flags&Lt)!==at,Ne=Br(f,i.childLanes);if(we){if(Ne)return wb(r,i,f);i.flags|=Lt}var Be=i.memoizedState;if(Be!==null&&(Be.rendering=null,Be.tail=null,Be.lastEffect=null),zl(i,la.current),Ne)break;return null}case se:case q:return i.lanes=Fe,hb(r,i,f)}return Wo(r,i,f)}function Cb(r,i,f){if(i._debugNeedsRemount&&r!==null)return DR(r,i,xS(i.type,i.key,i.pendingProps,i._debugOwner||null,i.mode,i.lanes));if(r!==null){var g=r.memoizedProps,v=i.pendingProps;if(g!==v||Oa()||i.type!==r.type)da=!0;else{var T=G2(r,f);if(!T&&(i.flags&Lt)===at)return da=!1,AR(r,i,f);(r.flags&vc)!==at?da=!0:da=!1}}else if(da=!1,c()&&ip(i)){var P=i.index,G=Go();kd(i,G,P)}switch(i.lanes=Fe,i.tag){case ee:return dR(r,i,i.type,f);case K:{var J=i.elementType;return cR(r,i,J,f)}case R:{var re=i.type,ce=i.pendingProps,ge=i.elementType===re?ce:ua(re,ce);return P2(r,i,re,ge,f)}case z:{var we=i.type,Ne=i.pendingProps,Be=i.elementType===we?Ne:ua(we,Ne);return gb(r,i,we,Be,f)}case O:return aR(r,i,f);case F:return oR(r,i,f);case V:return lR(r,i);case B:return vb(r,i,f);case I:return TR(r,i,f);case ne:{var Ie=i.type,ut=i.pendingProps,Tt=i.elementType===Ie?ut:ua(Ie,ut);return ub(r,i,Ie,Tt,f)}case W:return rR(r,i,f);case j:return iR(r,i,f);case A:return sR(r,i,f);case X:return kR(r,i,f);case Y:return MR(r,i,f);case Q:{var vt=i.type,pn=i.pendingProps,tn=ua(vt,pn);if(i.type!==i.elementType){var _e=vt.propTypes;_e&&Ei(_e,tn,"prop",dt(vt))}return tn=ua(vt.type,tn),db(r,i,vt,tn,f)}case H:return fb(r,i,i.type,i.pendingProps,f);case ae:{var Re=i.type,Se=i.pendingProps,We=i.elementType===Re?Se:ua(Re,Se);return uR(r,i,Re,We,f)}case de:return wb(r,i,f);case fe:break;case se:return hb(r,i,f)}throw new Error("Unknown unit of work tag ("+i.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function Ka(r){r.flags|=Ot}function Tb(r){r.flags|=Gi,r.flags|=qs}function kb(r,i){var f=r!==null&&r.child===i.child;if(f)return!0;if((i.flags&Hi)!==at)return!1;for(var g=i.child;g!==null;){if((g.flags&vo)!==at||(g.subtreeFlags&vo)!==at)return!1;g=g.sibling}return!0}var Tp,kp,Ry,Ly;if(Ge)Tp=function(r,i,f,g){for(var v=i.child;v!==null;){if(v.tag===F||v.tag===V)is(r,v.stateNode);else if(v.tag!==I){if(v.child!==null){v.child.return=v,v=v.child;continue}}if(v===i)return;for(;v.sibling===null;){if(v.return===null||v.return===i)return;v=v.return}v.sibling.return=v.return,v=v.sibling}},kp=function(r,i){},Ry=function(r,i,f,g,v){var T=r.memoizedProps;if(T!==g){var P=i.stateNode,G=fp(),J=Sr(P,f,T,g,v,G);i.updateQueue=J,J&&Ka(i)}},Ly=function(r,i,f,g){f!==g&&Ka(i)};else if(Xe){Tp=function(r,i,f,g){for(var v=i.child;v!==null;){if(v.tag===F){var T=v.stateNode;if(f&&g){var P=v.memoizedProps,G=v.type;T=Eo(T,G,P,v)}is(r,T)}else if(v.tag===V){var J=v.stateNode;if(f&&g){var re=v.memoizedProps;J=bc(J,re,v)}is(r,J)}else if(v.tag!==I){if(v.tag===se&&v.memoizedState!==null){var ce=v.child;ce!==null&&(ce.return=v),Tp(r,v,!0,!0)}else if(v.child!==null){v.child.return=v,v=v.child;continue}}if(v=v,v===i)return;for(;v.sibling===null;){if(v.return===null||v.return===i)return;v=v.return}v.sibling.return=v.return,v=v.sibling}};var Mb=function(r,i,f,g){for(var v=i.child;v!==null;){if(v.tag===F){var T=v.stateNode;if(f&&g){var P=v.memoizedProps,G=v.type;T=Eo(T,G,P,v)}u0(r,T)}else if(v.tag===V){var J=v.stateNode;if(f&&g){var re=v.memoizedProps;J=bc(J,re,v)}u0(r,J)}else if(v.tag!==I){if(v.tag===se&&v.memoizedState!==null){var ce=v.child;ce!==null&&(ce.return=v),Mb(r,v,!0,!0)}else if(v.child!==null){v.child.return=v,v=v.child;continue}}if(v=v,v===i)return;for(;v.sibling===null;){if(v.return===null||v.return===i)return;v=v.return}v.sibling.return=v.return,v=v.sibling}};kp=function(r,i){var f=i.stateNode,g=kb(r,i);if(!g){var v=f.containerInfo,T=Rh(v);Mb(T,i,!1,!1),f.pendingChildren=T,Ka(i),Rs(v,T)}},Ry=function(r,i,f,g,v){var T=r.stateNode,P=r.memoizedProps,G=kb(r,i);if(G&&P===g){i.stateNode=T;return}var J=i.stateNode,re=fp(),ce=null;if(P!==g&&(ce=Sr(J,f,P,g,v,re)),G&&ce===null){i.stateNode=T;return}var ge=Ah(T,ce,f,P,g,i,G,J);Js(ge,f,g,v,re)&&Ka(i),i.stateNode=ge,G?Ka(i):Tp(ge,i,!1,!1)},Ly=function(r,i,f,g){if(f!==g){var v=I1(),T=fp();i.stateNode=xc(g,v,T,i),Ka(i)}else i.stateNode=r.stateNode}}else kp=function(r,i){},Ry=function(r,i,f,g,v){},Ly=function(r,i,f,g){};function Mp(r,i){if(!c())switch(r.tailMode){case"hidden":{for(var f=r.tail,g=null;f!==null;)f.alternate!==null&&(g=f),f=f.sibling;g===null?r.tail=null:g.sibling=null;break}case"collapsed":{for(var v=r.tail,T=null;v!==null;)v.alternate!==null&&(T=v),v=v.sibling;T===null?!i&&r.tail!==null?r.tail.sibling=null:r.tail=null:T.sibling=null;break}}}function Wr(r){var i=r.alternate!==null&&r.alternate.child===r.child,f=Fe,g=at;if(i){if((r.mode&an)!==mt){for(var J=r.selfBaseDuration,re=r.child;re!==null;)f=Ut(f,Ut(re.lanes,re.childLanes)),g|=re.subtreeFlags&ri,g|=re.flags&ri,J+=re.treeBaseDuration,re=re.sibling;r.treeBaseDuration=J}else for(var ce=r.child;ce!==null;)f=Ut(f,Ut(ce.lanes,ce.childLanes)),g|=ce.subtreeFlags&ri,g|=ce.flags&ri,ce.return=r,ce=ce.sibling;r.subtreeFlags|=g}else{if((r.mode&an)!==mt){for(var v=r.actualDuration,T=r.selfBaseDuration,P=r.child;P!==null;)f=Ut(f,Ut(P.lanes,P.childLanes)),g|=P.subtreeFlags,g|=P.flags,v+=P.actualDuration,T+=P.treeBaseDuration,P=P.sibling;r.actualDuration=v,r.treeBaseDuration=T}else for(var G=r.child;G!==null;)f=Ut(f,Ut(G.lanes,G.childLanes)),g|=G.subtreeFlags,g|=G.flags,G.return=r,G=G.sibling;r.subtreeFlags|=g}return r.childLanes=f,i}function RR(r,i,f){if(Rd()&&(i.mode&Xt)!==mt&&(i.flags&Lt)===at)return j0(i),Fl(),i.flags|=mi|Ta|Zn,!1;var g=Yc(i);if(f!==null&&f.dehydrated!==null)if(r===null){if(!g)throw new Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");if(V0(i),Wr(i),(i.mode&an)!==mt){var v=f!==null;if(v){var T=i.child;T!==null&&(i.treeBaseDuration-=T.treeBaseDuration)}}return!1}else{if(Fl(),(i.flags&Lt)===at&&(i.memoizedState=null),i.flags|=Ot,Wr(i),(i.mode&an)!==mt){var P=f!==null;if(P){var G=i.child;G!==null&&(i.treeBaseDuration-=G.treeBaseDuration)}}return!1}else return o(),!0}function Db(r,i,f){var g=i.pendingProps;switch(Dd(i),i.tag){case ee:case K:case H:case R:case ne:case W:case j:case A:case Y:case Q:return Wr(i),null;case z:{var v=i.type;return ii(v)&&Xu(i),Wr(i),null}case O:{var T=i.stateNode;if(Id(i),ar(i),G1(),T.pendingContext&&(T.context=T.pendingContext,T.pendingContext=null),r===null||r.child===null){var P=Yc(i);if(P)Ka(i);else if(r!==null){var G=r.memoizedState;(!G.isDehydrated||(i.flags&mi)!==at)&&(i.flags|=ns,o())}}return kp(r,i),Wr(i),null}case F:{U1(i);var J=I1(),re=i.type;if(r!==null&&i.stateNode!=null)Ry(r,i,re,g,J),r.ref!==i.ref&&Tb(i);else{if(!g){if(i.stateNode===null)throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");return Wr(i),null}var ce=fp(),ge=Yc(i);if(ge)ap(i,J,ce)&&Ka(i);else{var we=vr(re,g,J,ce,i);Tp(we,i,!1,!1),i.stateNode=we,Js(we,re,g,J,ce)&&Ka(i)}i.ref!==null&&Tb(i)}return Wr(i),null}case V:{var Ne=g;if(r&&i.stateNode!=null){var Be=r.memoizedProps;Ly(r,i,Be,Ne)}else{if(typeof Ne!="string"&&i.stateNode===null)throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");var Ie=I1(),ut=fp(),Tt=Yc(i);Tt?x1(i)&&Ka(i):i.stateNode=xc(Ne,Ie,ut,i)}return Wr(i),null}case B:{Ud(i);var vt=i.memoizedState;if(r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){var pn=RR(r,i,vt);if(!pn)return i.flags&Zn?i:null}if((i.flags&Lt)!==at)return i.lanes=f,(i.mode&an)!==mt&&h2(i),i;var tn=vt!==null,_e=r!==null&&r.memoizedState!==null;if(tn!==_e&&tn){var Re=i.child;if(Re.flags|=Xs,(i.mode&Xt)!==mt){var Se=r===null&&(i.memoizedProps.unstable_avoidThisFallback!==!0||!0);Se||B1(la.current,Cw)?KL():dS()}}var We=i.updateQueue;if(We!==null&&(i.flags|=Ot),Wr(i),(i.mode&an)!==mt&&tn){var ht=i.child;ht!==null&&(i.treeBaseDuration-=ht.treeBaseDuration)}return null}case I:return Id(i),kp(r,i),r===null&&je(i.stateNode.containerInfo),Wr(i),null;case X:var st=i.type._context;return D1(st,i),Wr(i),null;case ae:{var Jt=i.type;return ii(Jt)&&Xu(i),Wr(i),null}case de:{Ud(i);var Dt=i.memoizedState;if(Dt===null)return Wr(i),null;var sn=(i.flags&Lt)!==at,jt=Dt.rendering;if(jt===null)if(sn)Mp(Dt,!1);else{var Cn=JL()&&(r===null||(r.flags&Lt)===at);if(!Cn)for(var bt=i.child;bt!==null;){var Kn=oy(bt);if(Kn!==null){sn=!0,i.flags|=Lt,Mp(Dt,!1);var pi=Kn.updateQueue;return pi!==null&&(i.updateQueue=pi,i.flags|=Ot),i.subtreeFlags=at,wA(i,f),zl(i,z1(la.current,hp)),i.child}bt=bt.sibling}Dt.tail!==null&&jn()>$b()&&(i.flags|=Lt,sn=!0,Mp(Dt,!1),i.lanes=No)}else{if(!sn){var Qr=oy(jt);if(Qr!==null){i.flags|=Lt,sn=!0;var vs=Qr.updateQueue;if(vs!==null&&(i.updateQueue=vs,i.flags|=Ot),Mp(Dt,!0),Dt.tail===null&&Dt.tailMode==="hidden"&&!jt.alternate&&!c())return Wr(i),null}else jn()*2-Dt.renderingStartTime>$b()&&f!==si&&(i.flags|=Lt,sn=!0,Mp(Dt,!1),i.lanes=No)}if(Dt.isBackwards)jt.sibling=i.child,i.child=jt;else{var Pi=Dt.last;Pi!==null?Pi.sibling=jt:i.child=jt,Dt.last=jt}}if(Dt.tail!==null){var Oi=Dt.tail;Dt.rendering=Oi,Dt.tail=Oi.sibling,Dt.renderingStartTime=jn(),Oi.sibling=null;var gi=la.current;return sn?gi=z1(gi,hp):gi=Fd(gi),zl(i,gi),Oi}return Wr(i),null}case fe:break;case se:case q:{uS(i);var Ko=i.memoizedState,Jd=Ko!==null;if(r!==null){var Gp=r.memoizedState,eo=Gp!==null;eo!==Jd&&!D&&(i.flags|=Xs)}return!Jd||(i.mode&Xt)===mt?Wr(i):Br(Za,si)&&(Wr(i),Ge&&i.subtreeFlags&(un|Ot)&&(i.flags|=Xs)),null}case oe:return null;case ye:return null}throw new Error("Unknown unit of work tag ("+i.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function LR(r,i,f){switch(Dd(i),i.tag){case z:{var g=i.type;ii(g)&&Xu(i);var v=i.flags;return v&Zn?(i.flags=v&~Zn|Lt,(i.mode&an)!==mt&&h2(i),i):null}case O:{i.stateNode,Id(i),ar(i),G1();var T=i.flags;return(T&Zn)!==at&&(T&Lt)===at?(i.flags=T&~Zn|Lt,i):null}case F:return U1(i),null;case B:{Ud(i);var P=i.memoizedState;if(P!==null&&P.dehydrated!==null){if(i.alternate===null)throw new Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");Fl()}var G=i.flags;return G&Zn?(i.flags=G&~Zn|Lt,(i.mode&an)!==mt&&h2(i),i):null}case de:return Ud(i),null;case I:return Id(i),null;case X:var J=i.type._context;return D1(J,i),null;case se:case q:return uS(i),null;case oe:return null;default:return null}}function Ab(r,i,f){switch(Dd(i),i.tag){case z:{var g=i.type.childContextTypes;g!=null&&Xu(i);break}case O:{i.stateNode,Id(i),ar(i),G1();break}case F:{U1(i);break}case I:Id(i);break;case B:Ud(i);break;case de:Ud(i);break;case X:var v=i.type._context;D1(v,i);break;case se:case q:uS(i);break}}function Rb(r,i,f,g,v,T,P,G,J){var re=Array.prototype.slice.call(arguments,3);try{i.apply(f,re)}catch(ce){this.onError(ce)}}var Lb=Rb;if(typeof window<"u"&&typeof window.dispatchEvent=="function"&&typeof document<"u"&&typeof document.createEvent=="function"){var V2=document.createElement("react");Lb=function(i,f,g,v,T,P,G,J,re){if(typeof document>"u"||document===null)throw new Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");var ce=document.createEvent("Event"),ge=!1,we=!0,Ne=window.event,Be=Object.getOwnPropertyDescriptor(window,"event");function Ie(){V2.removeEventListener(Re,Tt,!1),typeof window.event<"u"&&window.hasOwnProperty("event")&&(window.event=Ne)}var ut=Array.prototype.slice.call(arguments,3);function Tt(){ge=!0,Ie(),f.apply(g,ut),we=!1}var vt,pn=!1,tn=!1;function _e(Se){if(vt=Se.error,pn=!0,vt===null&&Se.colno===0&&Se.lineno===0&&(tn=!0),Se.defaultPrevented&&vt!=null&&typeof vt=="object")try{vt._suppressLogging=!0}catch{}}var Re="react-"+(i||"invokeguardedcallback");if(window.addEventListener("error",_e),V2.addEventListener(Re,Tt,!1),ce.initEvent(Re,!1,!1),V2.dispatchEvent(ce),Be&&Object.defineProperty(window,"event",Be),ge&&we&&(pn?tn&&(vt=new Error("A cross-origin error was thrown. React doesn't have access to the actual error object in development. See https://reactjs.org/link/crossorigin-error for more information.")):vt=new Error(`An error was thrown inside one of your components, but React doesn't know what it was. This is likely due to browser flakiness. React does its best to preserve the "Pause on exceptions" behavior of the DevTools, which requires some DEV-mode only tricks. It's possible that these don't work in your browser. Try triggering the error in production mode, or switching to a modern browser. If you suspect that this is actually an issue with React, please file an issue.`),this.onError(vt)),window.removeEventListener("error",_e),!ge)return Ie(),Rb.apply(this,arguments)}}var NR=Lb,Dp=!1,Ny=null,PR={onError:function(r){Dp=!0,Ny=r}};function Nb(r,i,f,g,v,T,P,G,J){Dp=!1,Ny=null,NR.apply(PR,arguments)}function OR(){return Dp}function Pb(){if(Dp){var r=Ny;return Dp=!1,Ny=null,r}else throw new Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.")}var Ob=null;Ob=new Set;var Py=!1,Xr=!1,IR=typeof WeakSet=="function"?WeakSet:Set,lt=null,Vd=null,Yd=null;function FR(r){Nb(null,function(){throw r}),Pb()}var UR=function(r,i){if(i.props=r.memoizedProps,i.state=r.memoizedState,r.mode&an)try{qa(),i.componentWillUnmount()}finally{Xa(r)}else i.componentWillUnmount()};function Ib(r,i){try{Vl(kr,r)}catch(f){vn(r,i,f)}}function Y2(r,i,f){try{UR(r,f)}catch(g){vn(r,i,g)}}function BR(r,i,f){try{f.componentDidMount()}catch(g){vn(r,i,g)}}function Fb(r,i){try{Bb(r)}catch(f){vn(r,i,f)}}function jd(r,i){var f=r.ref;if(f!==null)if(typeof f=="function"){var g;try{if(E&&L&&r.mode&an)try{qa(),g=f(null)}finally{Xa(r)}else g=f(null)}catch(v){vn(r,i,v)}typeof g=="function"&&h("Unexpected return value from a callback ref in %s. A callback ref should not return a function.",ct(r))}else f.current=null}function Oy(r,i,f){try{f()}catch(g){vn(r,i,g)}}var Ub=!1;function zR(r,i){Ds(r.containerInfo),lt=i,HR();var f=Ub;return Ub=!1,f}function HR(){for(;lt!==null;){var r=lt,i=r.child;(r.subtreeFlags&pl)!==at&&i!==null?(i.return=r,lt=i):GR()}}function GR(){for(;lt!==null;){var r=lt;en(r);try{VR(r)}catch(f){vn(r,r.return,f)}Bt();var i=r.sibling;if(i!==null){i.return=r.return,lt=i;return}lt=r.return}}function VR(r){var i=r.alternate,f=r.flags;if((f&ns)!==at){switch(en(r),r.tag){case R:case ne:case H:break;case z:{if(i!==null){var g=i.memoizedProps,v=i.memoizedState,T=r.stateNode;r.type===r.elementType&&!qc&&(T.props!==r.memoizedProps&&h("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",ct(r)||"instance"),T.state!==r.memoizedState&&h("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",ct(r)||"instance"));var P=T.getSnapshotBeforeUpdate(r.elementType===r.type?g:ua(r.type,g),v);{var G=Ob;P===void 0&&!G.has(r.type)&&(G.add(r.type),h("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.",ct(r)))}T.__reactInternalSnapshotBeforeUpdate=P}break}case O:{if(Ge){var J=r.stateNode;Ou(J.containerInfo)}break}case F:case V:case I:case ae:break;default:throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}Bt()}}function fa(r,i,f){var g=i.updateQueue,v=g!==null?g.lastEffect:null;if(v!==null){var T=v.next,P=T;do{if((P.tag&r)===r){var G=P.destroy;P.destroy=void 0,G!==void 0&&((r&jr)!==Ji?cr(i):(r&kr)!==Ji&&Bo(i),(r&Ya)!==Ji&&Hp(!0),Oy(i,f,G),(r&Ya)!==Ji&&Hp(!1),(r&jr)!==Ji?Xn():(r&kr)!==Ji&&qn())}P=P.next}while(P!==T)}}function Vl(r,i){var f=i.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var v=g.next,T=v;do{if((T.tag&r)===r){(r&jr)!==Ji?Un(i):(r&kr)!==Ji&&Er(i);var P=T.create;(r&Ya)!==Ji&&Hp(!0),T.destroy=P(),(r&Ya)!==Ji&&Hp(!1),(r&jr)!==Ji?Gt():(r&kr)!==Ji&&Mi();{var G=T.destroy;if(G!==void 0&&typeof G!="function"){var J=void 0;(T.tag&kr)!==at?J="useLayoutEffect":(T.tag&Ya)!==at?J="useInsertionEffect":J="useEffect";var re=void 0;G===null?re=" You returned null. If your effect does not require clean up, return undefined (or nothing).":typeof G.then=="function"?re=`
|
|
121
|
+
|
|
122
|
+
It looks like you wrote `+J+`(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:
|
|
123
|
+
|
|
124
|
+
`+J+`(() => {
|
|
125
|
+
async function fetchData() {
|
|
126
|
+
// You can await here
|
|
127
|
+
const response = await MyAPI.getData(someId);
|
|
128
|
+
// ...
|
|
129
|
+
}
|
|
130
|
+
fetchData();
|
|
131
|
+
}, [someId]); // Or [] if effect doesn't need props or state
|
|
132
|
+
|
|
133
|
+
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`:re=" You returned: "+G,h("%s must not return anything besides a function, which is used for clean-up.%s",J,re)}}}T=T.next}while(T!==v)}}function YR(r,i){if((i.flags&Ot)!==at)switch(i.tag){case A:{var f=i.stateNode.passiveEffectDuration,g=i.memoizedProps,v=g.id,T=g.onPostCommit,P=Jw(),G=i.alternate===null?"mount":"update";Qw()&&(G="nested-update"),typeof T=="function"&&T(v,G,f,P);var J=i.return;e:for(;J!==null;){switch(J.tag){case O:var re=J.stateNode;re.passiveEffectDuration+=f;break e;case A:var ce=J.stateNode;ce.passiveEffectDuration+=f;break e}J=J.return}break}}}function jR(r,i,f,g){if((f.flags&So)!==at)switch(f.tag){case R:case ne:case H:{if(!Xr)if(f.mode&an)try{qa(),Vl(kr|Tr,f)}finally{Xa(f)}else Vl(kr|Tr,f);break}case z:{var v=f.stateNode;if(f.flags&Ot&&!Xr)if(i===null)if(f.type===f.elementType&&!qc&&(v.props!==f.memoizedProps&&h("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",ct(f)||"instance"),v.state!==f.memoizedState&&h("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",ct(f)||"instance")),f.mode&an)try{qa(),v.componentDidMount()}finally{Xa(f)}else v.componentDidMount();else{var T=f.elementType===f.type?i.memoizedProps:ua(f.type,i.memoizedProps),P=i.memoizedState;if(f.type===f.elementType&&!qc&&(v.props!==f.memoizedProps&&h("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",ct(f)||"instance"),v.state!==f.memoizedState&&h("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",ct(f)||"instance")),f.mode&an)try{qa(),v.componentDidUpdate(T,P,v.__reactInternalSnapshotBeforeUpdate)}finally{Xa(f)}else v.componentDidUpdate(T,P,v.__reactInternalSnapshotBeforeUpdate)}var G=f.updateQueue;G!==null&&(f.type===f.elementType&&!qc&&(v.props!==f.memoizedProps&&h("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",ct(f)||"instance"),v.state!==f.memoizedState&&h("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",ct(f)||"instance")),ww(f,G,v));break}case O:{var J=f.updateQueue;if(J!==null){var re=null;if(f.child!==null)switch(f.child.tag){case F:re=Si(f.child.stateNode);break;case z:re=f.child.stateNode;break}ww(f,J,re)}break}case F:{var ce=f.stateNode;if(i===null&&f.flags&Ot){var ge=f.type,we=f.memoizedProps;Ln(ce,ge,we,f)}break}case V:break;case I:break;case A:{{var Ne=f.memoizedProps,Be=Ne.onCommit,Ie=Ne.onRender,ut=f.stateNode.effectDuration,Tt=Jw(),vt=i===null?"mount":"update";Qw()&&(vt="nested-update"),typeof Ie=="function"&&Ie(f.memoizedProps.id,vt,f.actualDuration,f.treeBaseDuration,f.actualStartTime,Tt);{typeof Be=="function"&&Be(f.memoizedProps.id,vt,ut,Tt),nN(f);var pn=f.return;e:for(;pn!==null;){switch(pn.tag){case O:var tn=pn.stateNode;tn.effectDuration+=ut;break e;case A:var _e=pn.stateNode;_e.effectDuration+=ut;break e}pn=pn.return}}}break}case B:{eL(r,f);break}case de:case ae:case fe:case se:case q:case ye:break;default:throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}Xr||f.flags&Gi&&Bb(f)}function WR(r){switch(r.tag){case R:case ne:case H:{if(r.mode&an)try{qa(),Ib(r,r.return)}finally{Xa(r)}else Ib(r,r.return);break}case z:{var i=r.stateNode;typeof i.componentDidMount=="function"&&BR(r,r.return,i),Fb(r,r.return);break}case F:{Fb(r,r.return);break}}}function XR(r,i){var f=null;if(Ge)for(var g=r;;){if(g.tag===F){if(f===null){f=g;try{var v=g.stateNode;i?f1(v):as(g.stateNode,g.memoizedProps)}catch(P){vn(r,r.return,P)}}}else if(g.tag===V){if(f===null)try{var T=g.stateNode;i?h1(T):Zs(T,g.memoizedProps)}catch(P){vn(r,r.return,P)}}else if(!((g.tag===se||g.tag===q)&&g.memoizedState!==null&&g!==r)){if(g.child!==null){g.child.return=g,g=g.child;continue}}if(g===r)return;for(;g.sibling===null;){if(g.return===null||g.return===r)return;f===g&&(f=null),g=g.return}f===g&&(f=null),g.sibling.return=g.return,g=g.sibling}}function Bb(r){var i=r.ref;if(i!==null){var f=r.stateNode,g;switch(r.tag){case F:g=Si(f);break;default:g=f}if(typeof i=="function"){var v;if(r.mode&an)try{qa(),v=i(g)}finally{Xa(r)}else v=i(g);typeof v=="function"&&h("Unexpected return value from a callback ref in %s. A callback ref should not return a function.",ct(r))}else i.hasOwnProperty("current")||h("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().",ct(r)),i.current=g}}function qR(r){var i=r.alternate;i!==null&&(i.return=null),r.return=null}function zb(r){var i=r.alternate;i!==null&&(r.alternate=null,zb(i));{if(r.child=null,r.deletions=null,r.sibling=null,r.tag===F){var f=r.stateNode;f!==null&&ot(f)}r.stateNode=null,r._debugOwner=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}}function KR(r){if(Xe){var i=r.stateNode,f=i.containerInfo,g=Rh(f);Aa(f,g)}}function QR(r){for(var i=r.return;i!==null;){if(Hb(i))return i;i=i.return}throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.")}function Hb(r){return r.tag===F||r.tag===O||r.tag===I}function Gb(r){var i=r;e:for(;;){for(;i.sibling===null;){if(i.return===null||Hb(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==F&&i.tag!==V&&i.tag!==ie;){if(i.flags&un||i.child===null||i.tag===I)continue e;i.child.return=i,i=i.child}if(!(i.flags&un))return i.stateNode}}function JR(r){if(Ge){var i=QR(r);switch(i.tag){case F:{var f=i.stateNode;i.flags&Ca&&(ss(f),i.flags&=~Ca);var g=Gb(r);W2(r,g,f);break}case O:case I:{var v=i.stateNode.containerInfo,T=Gb(r);j2(r,T,v);break}default:throw new Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.")}}}function j2(r,i,f){var g=r.tag,v=g===F||g===V;if(v){var T=r.stateNode;i?Dh(f,T,i):ml(f,T)}else if(g!==I){var P=r.child;if(P!==null){j2(P,i,f);for(var G=P.sibling;G!==null;)j2(G,i,f),G=G.sibling}}}function W2(r,i,f){var g=r.tag,v=g===F||g===V;if(v){var T=r.stateNode;i?vl(f,T,i):Da(f,T)}else if(g!==I){var P=r.child;if(P!==null){W2(P,i,f);for(var G=P.sibling;G!==null;)W2(G,i,f),G=G.sibling}}}var qr=null,ha=!1;function ZR(r,i,f){if(Ge){var g=i;e:for(;g!==null;){switch(g.tag){case F:{qr=g.stateNode,ha=!1;break e}case O:{qr=g.stateNode.containerInfo,ha=!0;break e}case I:{qr=g.stateNode.containerInfo,ha=!0;break e}}g=g.return}if(qr===null)throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");X2(r,i,f),qr=null,ha=!1}else X2(r,i,f);qR(f)}function Qa(r,i,f){for(var g=f.child;g!==null;)X2(r,i,g),g=g.sibling}function X2(r,i,f){switch($h(f),f.tag){case F:Xr||jd(f,i);case V:{if(Ge){var g=qr,v=ha;qr=null,Qa(r,i,f),qr=g,ha=v,qr!==null&&(ha?Pu(qr,f.stateNode):d1(qr,f.stateNode))}else Qa(r,i,f);return}case ie:{Ge&&qr!==null&&(ha?Oh(qr,f.stateNode):Ph(qr,f.stateNode));return}case I:{if(Ge){var T=qr,P=ha;qr=f.stateNode.containerInfo,ha=!0,Qa(r,i,f),qr=T,ha=P}else KR(f),Qa(r,i,f);return}case R:case ne:case Q:case H:{if(!Xr){var G=f.updateQueue;if(G!==null){var J=G.lastEffect;if(J!==null){var re=J.next,ce=re;do{var ge=ce,we=ge.destroy,Ne=ge.tag;we!==void 0&&((Ne&Ya)!==Ji?Oy(f,i,we):(Ne&kr)!==Ji&&(Bo(f),f.mode&an?(qa(),Oy(f,i,we),Xa(f)):Oy(f,i,we),qn())),ce=ce.next}while(ce!==re)}}}Qa(r,i,f);return}case z:{if(!Xr){jd(f,i);var Be=f.stateNode;typeof Be.componentWillUnmount=="function"&&Y2(f,i,Be)}Qa(r,i,f);return}case fe:{Qa(r,i,f);return}case se:{if(f.mode&Xt){var Ie=Xr;Xr=Ie||f.memoizedState!==null,Qa(r,i,f),Xr=Ie}else Qa(r,i,f);break}default:{Qa(r,i,f);return}}}function $R(r){r.memoizedState}function eL(r,i){if(Pe){var f=i.memoizedState;if(f===null){var g=i.alternate;if(g!==null){var v=g.memoizedState;if(v!==null){var T=v.dehydrated;T!==null&&f0(T)}}}}}function Vb(r){var i=r.updateQueue;if(i!==null){r.updateQueue=null;var f=r.stateNode;f===null&&(f=r.stateNode=new IR),i.forEach(function(g){var v=cN.bind(null,r,g);if(!f.has(g)){if(f.add(g),oi)if(Vd!==null&&Yd!==null)zp(Yd,Vd);else throw Error("Expected finished root and lanes to be set. This is a bug in React.");g.then(v,v)}})}}function tL(r,i,f){Vd=f,Yd=r,en(i),Yb(i,r),en(i),Vd=null,Yd=null}function pa(r,i,f){var g=i.deletions;if(g!==null)for(var v=0;v<g.length;v++){var T=g[v];try{ZR(r,i,T)}catch(J){vn(T,i,J)}}var P=oa();if(i.subtreeFlags&vo)for(var G=i.child;G!==null;)en(G),Yb(G,r),G=G.sibling;en(P)}function Yb(r,i,f){var g=r.alternate,v=r.flags;switch(r.tag){case R:case ne:case Q:case H:{if(pa(i,r),Ja(r),v&Ot){try{fa(Ya|Tr,r,r.return),Vl(Ya|Tr,r)}catch(bt){vn(r,r.return,bt)}if(r.mode&an){try{qa(),fa(kr|Tr,r,r.return)}catch(bt){vn(r,r.return,bt)}Xa(r)}else try{fa(kr|Tr,r,r.return)}catch(bt){vn(r,r.return,bt)}}return}case z:{pa(i,r),Ja(r),v&Gi&&g!==null&&jd(g,g.return);return}case F:{if(pa(i,r),Ja(r),v&Gi&&g!==null&&jd(g,g.return),Ge){if(r.flags&Ca){var T=r.stateNode;try{ss(T)}catch(bt){vn(r,r.return,bt)}}if(v&Ot){var P=r.stateNode;if(P!=null){var G=r.memoizedProps,J=g!==null?g.memoizedProps:G,re=r.type,ce=r.updateQueue;if(r.updateQueue=null,ce!==null)try{bo(P,ce,re,J,G,r)}catch(bt){vn(r,r.return,bt)}}}}return}case V:{if(pa(i,r),Ja(r),v&Ot&&Ge){if(r.stateNode===null)throw new Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");var ge=r.stateNode,we=r.memoizedProps,Ne=g!==null?g.memoizedProps:we;try{wc(ge,Ne,we)}catch(bt){vn(r,r.return,bt)}}return}case O:{if(pa(i,r),Ja(r),v&Ot){if(Ge&&Pe&&g!==null){var Be=g.memoizedState;if(Be.isDehydrated)try{d0(i.containerInfo)}catch(bt){vn(r,r.return,bt)}}if(Xe){var Ie=i.containerInfo,ut=i.pendingChildren;try{Aa(Ie,ut)}catch(bt){vn(r,r.return,bt)}}}return}case I:{if(pa(i,r),Ja(r),v&Ot&&Xe){var Tt=r.stateNode,vt=Tt.containerInfo,pn=Tt.pendingChildren;try{Aa(vt,pn)}catch(bt){vn(r,r.return,bt)}}return}case B:{pa(i,r),Ja(r);var tn=r.child;if(tn.flags&Xs){var _e=tn.stateNode,Re=tn.memoizedState,Se=Re!==null;if(_e.isHidden=Se,Se){var We=tn.alternate!==null&&tn.alternate.memoizedState!==null;We||qL()}}if(v&Ot){try{$R(r)}catch(bt){vn(r,r.return,bt)}Vb(r)}return}case se:{var ht=g!==null&&g.memoizedState!==null;if(r.mode&Xt){var st=Xr;Xr=st||ht,pa(i,r),Xr=st}else pa(i,r);if(Ja(r),v&Xs){var Jt=r.stateNode,Dt=r.memoizedState,sn=Dt!==null,jt=r;if(Jt.isHidden=sn,sn&&!ht&&(jt.mode&Xt)!==mt){lt=jt;for(var Cn=jt.child;Cn!==null;)lt=Cn,rL(Cn),Cn=Cn.sibling}Ge&&XR(jt,sn)}return}case de:{pa(i,r),Ja(r),v&Ot&&Vb(r);return}case fe:return;default:{pa(i,r),Ja(r);return}}}function Ja(r){var i=r.flags;if(i&un){try{JR(r)}catch(f){vn(r,r.return,f)}r.flags&=~un}i&ni&&(r.flags&=~ni)}function nL(r,i,f){Vd=f,Yd=i,lt=r,jb(r,i,f),Vd=null,Yd=null}function jb(r,i,f){for(var g=(r.mode&Xt)!==mt;lt!==null;){var v=lt,T=v.child;if(v.tag===se&&g){var P=v.memoizedState!==null,G=P||Py;if(G){q2(r,i,f);continue}else{var J=v.alternate,re=J!==null&&J.memoizedState!==null,ce=re||Xr,ge=Py,we=Xr;Py=G,Xr=ce,Xr&&!we&&(lt=v,iL(v));for(var Ne=T;Ne!==null;)lt=Ne,jb(Ne,i,f),Ne=Ne.sibling;lt=v,Py=ge,Xr=we,q2(r,i,f);continue}}(v.subtreeFlags&So)!==at&&T!==null?(T.return=v,lt=T):q2(r,i,f)}}function q2(r,i,f){for(;lt!==null;){var g=lt;if((g.flags&So)!==at){var v=g.alternate;en(g);try{jR(i,v,g,f)}catch(P){vn(g,g.return,P)}Bt()}if(g===r){lt=null;return}var T=g.sibling;if(T!==null){T.return=g.return,lt=T;return}lt=g.return}}function rL(r){for(;lt!==null;){var i=lt,f=i.child;switch(i.tag){case R:case ne:case Q:case H:{if(i.mode&an)try{qa(),fa(kr,i,i.return)}finally{Xa(i)}else fa(kr,i,i.return);break}case z:{jd(i,i.return);var g=i.stateNode;typeof g.componentWillUnmount=="function"&&Y2(i,i.return,g);break}case F:{jd(i,i.return);break}case se:{var v=i.memoizedState!==null;if(v){Wb(r);continue}break}}f!==null?(f.return=i,lt=f):Wb(r)}}function Wb(r){for(;lt!==null;){var i=lt;if(i===r){lt=null;return}var f=i.sibling;if(f!==null){f.return=i.return,lt=f;return}lt=i.return}}function iL(r){for(;lt!==null;){var i=lt,f=i.child;if(i.tag===se){var g=i.memoizedState!==null;if(g){Xb(r);continue}}f!==null?(f.return=i,lt=f):Xb(r)}}function Xb(r){for(;lt!==null;){var i=lt;en(i);try{WR(i)}catch(g){vn(i,i.return,g)}if(Bt(),i===r){lt=null;return}var f=i.sibling;if(f!==null){f.return=i.return,lt=f;return}lt=i.return}}function sL(r,i,f,g){lt=i,aL(i,r,f,g)}function aL(r,i,f,g){for(;lt!==null;){var v=lt,T=v.child;(v.subtreeFlags&Ks)!==at&&T!==null?(T.return=v,lt=T):oL(r,i,f,g)}}function oL(r,i,f,g){for(;lt!==null;){var v=lt;if((v.flags&vi)!==at){en(v);try{lL(i,v,f,g)}catch(P){vn(v,v.return,P)}Bt()}if(v===r){lt=null;return}var T=v.sibling;if(T!==null){T.return=v.return,lt=T;return}lt=v.return}}function lL(r,i,f,g){switch(i.tag){case R:case ne:case H:{if(i.mode&an){f2();try{Vl(jr|Tr,i)}finally{d2(i)}}else Vl(jr|Tr,i);break}}}function cL(r){lt=r,uL()}function uL(){for(;lt!==null;){var r=lt,i=r.child;if((lt.flags&Hi)!==at){var f=r.deletions;if(f!==null){for(var g=0;g<f.length;g++){var v=f[g];lt=v,hL(v,r)}{var T=r.alternate;if(T!==null){var P=T.child;if(P!==null){T.child=null;do{var G=P.sibling;P.sibling=null,P=G}while(P!==null)}}}lt=r}}(r.subtreeFlags&Ks)!==at&&i!==null?(i.return=r,lt=i):dL()}}function dL(){for(;lt!==null;){var r=lt;(r.flags&vi)!==at&&(en(r),fL(r),Bt());var i=r.sibling;if(i!==null){i.return=r.return,lt=i;return}lt=r.return}}function fL(r){switch(r.tag){case R:case ne:case H:{r.mode&an?(f2(),fa(jr|Tr,r,r.return),d2(r)):fa(jr|Tr,r,r.return);break}}}function hL(r,i){for(;lt!==null;){var f=lt;en(f),gL(f,i),Bt();var g=f.child;g!==null?(g.return=f,lt=g):pL(r)}}function pL(r){for(;lt!==null;){var i=lt,f=i.sibling,g=i.return;if(zb(i),i===r){lt=null;return}if(f!==null){f.return=g,lt=f;return}lt=g}}function gL(r,i){switch(r.tag){case R:case ne:case H:{r.mode&an?(f2(),fa(jr,r,i),d2(r)):fa(jr,r,i);break}}}function yL(r){switch(r.tag){case R:case ne:case H:{try{Vl(kr|Tr,r)}catch(f){vn(r,r.return,f)}break}case z:{var i=r.stateNode;try{i.componentDidMount()}catch(f){vn(r,r.return,f)}break}}}function mL(r){switch(r.tag){case R:case ne:case H:{try{Vl(jr|Tr,r)}catch(i){vn(r,r.return,i)}break}}}function vL(r){switch(r.tag){case R:case ne:case H:{try{fa(kr|Tr,r,r.return)}catch(f){vn(r,r.return,f)}break}case z:{var i=r.stateNode;typeof i.componentWillUnmount=="function"&&Y2(r,r.return,i);break}}}function SL(r){switch(r.tag){case R:case ne:case H:try{fa(jr|Tr,r,r.return)}catch(i){vn(r,r.return,i)}}}var Iy=0,Fy=1,Uy=2,By=3,zy=4;if(typeof Symbol=="function"&&Symbol.for){var Ap=Symbol.for;Iy=Ap("selector.component"),Fy=Ap("selector.has_pseudo_class"),Uy=Ap("selector.role"),By=Ap("selector.test_id"),zy=Ap("selector.text")}function _L(r){return{$$typeof:Iy,value:r}}function xL(r){return{$$typeof:Fy,value:r}}function wL(r){return{$$typeof:Uy,value:r}}function bL(r){return{$$typeof:zy,value:r}}function EL(r){return{$$typeof:By,value:r}}function K2(r){var i=ze(r);if(i!=null){if(typeof i.memoizedProps["data-testname"]!="string")throw new Error("Invalid host root specified. Should be either a React container or a node with a testname attribute.");return i}else{var f=Wt(r);if(f===null)throw new Error("Could not find React container within specified host subtree.");return f.stateNode.current}}function Q2(r,i){switch(i.$$typeof){case Iy:if(r.type===i.value)return!0;break;case Fy:return CL(r,i.value);case Uy:if(r.tag===F){var f=r.stateNode;if(At(f,i.value))return!0}break;case zy:if(r.tag===F||r.tag===V){var g=Yn(r);if(g!==null&&g.indexOf(i.value)>=0)return!0}break;case By:if(r.tag===F){var v=r.memoizedProps["data-testname"];if(typeof v=="string"&&v.toLowerCase()===i.value.toLowerCase())return!0}break;default:throw new Error("Invalid selector type specified.")}return!1}function J2(r){switch(r.$$typeof){case Iy:var i=dt(r.value)||"Unknown";return"<"+i+">";case Fy:return":has("+(J2(r)||"")+")";case Uy:return'[role="'+r.value+'"]';case zy:return'"'+r.value+'"';case By:return'[data-testname="'+r.value+'"]';default:throw new Error("Invalid selector type specified.")}}function qb(r,i){for(var f=[],g=[r,0],v=0;v<g.length;){var T=g[v++],P=g[v++],G=i[P];if(!(T.tag===F&&Yt(T))){for(;G!=null&&Q2(T,G);)P++,G=i[P];if(P===i.length)f.push(T);else for(var J=T.child;J!==null;)g.push(J,P),J=J.sibling}}return f}function CL(r,i){for(var f=[r,0],g=0;g<f.length;){var v=f[g++],T=f[g++],P=i[T];if(!(v.tag===F&&Yt(v))){for(;P!=null&&Q2(v,P);)T++,P=i[T];if(T===i.length)return!0;for(var G=v.child;G!==null;)f.push(G,T),G=G.sibling}}return!1}function Hy(r,i){if(!Ht)throw new Error("Test selector API is not supported by this renderer.");for(var f=K2(r),g=qb(f,i),v=[],T=Array.from(g),P=0;P<T.length;){var G=T[P++];if(G.tag===F){if(Yt(G))continue;v.push(G.stateNode)}else for(var J=G.child;J!==null;)T.push(J),J=J.sibling}return v}function TL(r,i){if(!Ht)throw new Error("Test selector API is not supported by this renderer.");for(var f=K2(r),g=0,v=[],T=[f,0],P=0;P<T.length;){var G=T[P++],J=T[P++],re=i[J];if(!(G.tag===F&&Yt(G))&&(Q2(G,re)&&(v.push(J2(re)),J++,J>g&&(g=J)),J<i.length))for(var ce=G.child;ce!==null;)T.push(ce,J),ce=ce.sibling}if(g<i.length){for(var ge=[],we=g;we<i.length;we++)ge.push(J2(i[we]));return`findAllNodes was able to match part of the selector:
|
|
134
|
+
`+(" "+v.join(" > ")+`
|
|
135
|
+
|
|
136
|
+
`)+`No matching component was found for:
|
|
137
|
+
`+(" "+ge.join(" > "))}return null}function kL(r,i){if(!Ht)throw new Error("Test selector API is not supported by this renderer.");for(var f=Hy(r,i),g=[],v=0;v<f.length;v++)g.push(_n(f[v]));for(var T=g.length-1;T>0;T--)for(var P=g[T],G=P.x,J=G+P.width,re=P.y,ce=re+P.height,ge=T-1;ge>=0;ge--)if(T!==ge){var we=g[ge],Ne=we.x,Be=Ne+we.width,Ie=we.y,ut=Ie+we.height;if(G>=Ne&&re>=Ie&&J<=Be&&ce<=ut){g.splice(T,1);break}else if(G===Ne&&P.width===we.width&&!(ut<re)&&!(Ie>ce)){Ie>re&&(we.height+=Ie-re,we.y=re),ut<ce&&(we.height=ce-Ie),g.splice(T,1);break}else if(re===Ie&&P.height===we.height&&!(Be<G)&&!(Ne>J)){Ne>G&&(we.width+=Ne-G,we.x=G),Be<J&&(we.width=J-Ne),g.splice(T,1);break}}return g}function ML(r,i){if(!Ht)throw new Error("Test selector API is not supported by this renderer.");for(var f=K2(r),g=qb(f,i),v=Array.from(g),T=0;T<v.length;){var P=v[T++];if(!Yt(P)){if(P.tag===F){var G=P.stateNode;if(_r(G))return!0}for(var J=P.child;J!==null;)v.push(J),J=J.sibling}}return!1}var Gy=[];function DL(){Ht&&Gy.forEach(function(r){return r()})}function AL(r,i,f,g){if(!Ht)throw new Error("Test selector API is not supported by this renderer.");var v=Hy(r,i),T=As(v,f,g),P=T.disconnect,G=T.observe,J=T.unobserve,re=function(){var ce=Hy(r,i);v.forEach(function(ge){ce.indexOf(ge)<0&&J(ge)}),ce.forEach(function(ge){v.indexOf(ge)<0&&G(ge)})};return Gy.push(re),{disconnect:function(){var ce=Gy.indexOf(re);ce>=0&&Gy.splice(ce,1),P()}}}var RL=l.ReactCurrentActQueue;function LL(r){{var i=typeof IS_REACT_ACT_ENVIRONMENT<"u"?IS_REACT_ACT_ENVIRONMENT:void 0,f=typeof jest<"u";return Ue&&f&&i!==!1}}function Kb(){{var r=typeof IS_REACT_ACT_ENVIRONMENT<"u"?IS_REACT_ACT_ENVIRONMENT:void 0;return!r&&RL.current!==null&&h("The current testing environment is not configured to support act(...)"),r}}var NL=Math.ceil,Z2=l.ReactCurrentDispatcher,$2=l.ReactCurrentOwner,Bn=l.ReactCurrentBatchConfig,ga=l.ReactCurrentActQueue,dr=0,eS=1,Kr=2,Vs=4,Xo=0,Rp=1,Kc=2,Vy=3,Lp=4,Qb=5,tS=6,zt=dr,Ni=null,zn=null,Ar=Fe,Za=Fe,nS=on(Fe),Rr=Xo,Np=null,Yy=Fe,Pp=Fe,jy=Fe,Op=null,Zi=null,rS=0,Jb=500,Zb=1/0,PL=500,qo=null;function Wd(){Zb=jn()+PL}function $b(){return Zb}var Wy=!1,iS=null,Xd=null,Qc=!1,Yl=null,Ip=Fe,sS=[],aS=null,OL=50,Fp=0,oS=null,lS=!1,Xy=!1,IL=50,qd=0,qy=null,Up=mn,Ky=Fe,e6=!1;function Qy(){return Ni}function hi(){return(zt&(Kr|Vs))!==dr?jn():(Up!==mn||(Up=jn()),Up)}function jl(r){var i=r.mode;if((i&Xt)===mt)return wt;if((zt&Kr)!==dr&&Ar!==Fe)return Dl(Ar);var f=N()!==k;if(f){if(Bn.transition!==null){var g=Bn.transition;g._updatedFibers||(g._updatedFibers=new Set),g._updatedFibers.add(r)}return Ky===In&&(Ky=fd()),Ky}var v=Yr();if(v!==In)return v;var T=rt();return T}function FL(r){var i=r.mode;return(i&Xt)===mt?wt:hd()}function fr(r,i,f,g){dN(),e6&&h("useInsertionEffect must not schedule updates."),lS&&(Xy=!0),Ua(r,f,g),(zt&Kr)!==Fe&&r===Ni?pN(i):(oi&&Nc(r,i,f),gN(i),r===Ni&&((zt&Kr)===dr&&(Pp=Ut(Pp,f)),Rr===Lp&&Wl(r,Ar)),$i(r,g),f===wt&&zt===dr&&(i.mode&Xt)===mt&&!ga.isBatchingLegacy&&(Wd(),zc()))}function UL(r,i,f){var g=r.current;g.lanes=i,Ua(r,i,f),$i(r,f)}function BL(r){return(zt&Kr)!==dr}function $i(r,i){var f=r.callbackNode;k0(r,i);var g=lr(r,r===Ni?Ar:Fe);if(g===Fe){f!==null&&g6(f),r.callbackNode=null,r.callbackPriority=In;return}var v=Oo(g),T=r.callbackPriority;if(T===v&&!(ga.current!==null&&f!==pS)){f==null&&T!==wt&&h("Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.");return}f!=null&&g6(f);var P;if(v===wt)r.tag===Os?(ga.isBatchingLegacy!==null&&(ga.didScheduleLegacyUpdate=!0),Td(r6.bind(null,r))):Cd(r6.bind(null,r)),ft?ga.current!==null?ga.current.push(bn):pt(function(){(zt&(Kr|Vs))===dr&&bn()}):nm(Oc,bn),P=null;else{var G;switch(md(g)){case Je:G=Oc;break;case Is:G=Ki;break;case Io:G=Fo;break;case yd:G=ys;break;default:G=Fo;break}P=nm(G,t6.bind(null,r))}r.callbackPriority=v,r.callbackNode=P}function t6(r,i){if(YA(),Up=mn,Ky=Fe,(zt&(Kr|Vs))!==dr)throw new Error("Should not already be working.");var f=r.callbackNode,g=$a();if(g&&r.callbackNode!==f)return null;var v=lr(r,r===Ni?Ar:Fe);if(v===Fe)return null;var T=!Ml(r,v)&&!Xh(r,v)&&!i,P=T?$L(r,v):$y(r,v);if(P!==Xo){if(P===Kc){var G=cd(r);G!==Fe&&(v=G,P=cS(r,G))}if(P===Rp){var J=Np;throw Jc(r,Fe),Wl(r,v),$i(r,jn()),J}if(P===tS)Wl(r,v);else{var re=!Ml(r,v),ce=r.current.alternate;if(re&&!HL(ce)){if(P=$y(r,v),P===Kc){var ge=cd(r);ge!==Fe&&(v=ge,P=cS(r,ge))}if(P===Rp){var we=Np;throw Jc(r,Fe),Wl(r,v),$i(r,jn()),we}}r.finishedWork=ce,r.finishedLanes=v,zL(r,P,v)}}return $i(r,jn()),r.callbackNode===f?t6.bind(null,r):null}function cS(r,i){var f=Op;if(ra(r)){var g=Jc(r,i);g.flags|=mi,Hu(r.containerInfo)}var v=$y(r,i);if(v!==Kc){var T=Zi;Zi=f,T!==null&&n6(T)}return v}function n6(r){Zi===null?Zi=r:Zi.push.apply(Zi,r)}function zL(r,i,f){switch(i){case Xo:case Rp:throw new Error("Root did not complete. This is a bug in React.");case Kc:{Zc(r,Zi,qo);break}case Vy:{if(Wl(r,f),dd(f)&&!y6()){var g=rS+Jb-jn();if(g>10){var v=lr(r,Fe);if(v!==Fe)break;var T=r.suspendedLanes;if(!ai(T,f)){hi(),Rl(r,T);break}r.timeoutHandle=yl(Zc.bind(null,r,Zi,qo),g);break}}Zc(r,Zi,qo);break}case Lp:{if(Wl(r,f),A0(f))break;if(!y6()){var P=C0(r,f),G=P,J=jn()-G,re=uN(J)-J;if(re>10){r.timeoutHandle=yl(Zc.bind(null,r,Zi,qo),re);break}}Zc(r,Zi,qo);break}case Qb:{Zc(r,Zi,qo);break}default:throw new Error("Unknown root exit status.")}}function HL(r){for(var i=r;;){if(i.flags&mc){var f=i.updateQueue;if(f!==null){var g=f.stores;if(g!==null)for(var v=0;v<g.length;v++){var T=g[v],P=T.getSnapshot,G=T.value;try{if(!Hr(P(),G))return!1}catch{return!1}}}}var J=i.child;if(i.subtreeFlags&mc&&J!==null){J.return=i,i=J;continue}if(i===r)return!0;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}return!0}function Wl(r,i){i=Ti(i,jy),i=Ti(i,Pp),R0(r,i)}function r6(r){if(jA(),(zt&(Kr|Vs))!==dr)throw new Error("Should not already be working.");$a();var i=lr(r,Fe);if(!Br(i,wt))return $i(r,jn()),null;var f=$y(r,i);if(r.tag!==Os&&f===Kc){var g=cd(r);g!==Fe&&(i=g,f=cS(r,g))}if(f===Rp){var v=Np;throw Jc(r,Fe),Wl(r,i),$i(r,jn()),v}if(f===tS)throw new Error("Root did not complete. This is a bug in React.");var T=r.current.alternate;return r.finishedWork=T,r.finishedLanes=i,Zc(r,Zi,qo),$i(r,jn()),null}function GL(r,i){i!==Fe&&(Qh(r,Ut(i,wt)),$i(r,jn()),(zt&(Kr|Vs))===dr&&(Wd(),bn()))}function VL(r){var i=Yr(),f=Bn.transition;try{return Bn.transition=null,Fn(Io),r()}finally{Fn(i),Bn.transition=f}}function YL(r,i){var f=zt;zt|=eS;try{return r(i)}finally{zt=f,zt===dr&&!ga.isBatchingLegacy&&(Wd(),zc())}}function jL(r,i,f,g,v){var T=Yr(),P=Bn.transition;try{return Bn.transition=null,Fn(Je),r(i,f,g,v)}finally{Fn(T),Bn.transition=P,zt===dr&&Wd()}}function Jy(r){Yl!==null&&Yl.tag===Os&&(zt&(Kr|Vs))===dr&&$a();var i=zt;zt|=eS;var f=Bn.transition,g=Yr();try{return Bn.transition=null,Fn(Je),r?r():void 0}finally{Fn(g),Bn.transition=f,zt=i,(zt&(Kr|Vs))===dr&&bn()}}function WL(){return(zt&(Kr|Vs))!==dr}function XL(r){var i=zt;zt|=eS;var f=Bn.transition,g=Yr();try{Bn.transition=null,Fn(Je),r()}finally{Fn(g),Bn.transition=f,zt=i,zt===dr&&(Wd(),bn())}}function Zy(r,i){tr(nS,Za,r),Za=Ut(Za,i)}function uS(r){Za=nS.current,er(nS,r)}function Jc(r,i){r.finishedWork=null,r.finishedLanes=Fe;var f=r.timeoutHandle;if(f!==Ce&&(r.timeoutHandle=Ce,ue(f)),zn!==null)for(var g=zn.return;g!==null;){var v=g.alternate;Ab(v,g),g=g.return}Ni=r;var T=$c(r.current,null);return zn=T,Ar=Za=i,Rr=Xo,Np=null,Yy=Fe,Pp=Fe,jy=Fe,Op=null,Zi=null,CA(),he.discardPendingWarnings(),T}function i6(r,i){do{var f=zn;try{if(J0(),kw(),Bt(),$2.current=null,f===null||f.return===null){Rr=Rp,Np=i,zn=null;return}if(E&&f.mode&an&&Ty(f,!0),M)if(za(),i!==null&&typeof i=="object"&&typeof i.then=="function"){var g=i;zo(f,g,Ar)}else Fc(f,i,Ar);eR(r,f.return,f,i,Ar),l6(f)}catch(v){i=v,zn===f&&f!==null?(f=f.return,zn=f):f=zn;continue}return}while(!0)}function s6(){var r=Z2.current;return Z2.current=xy,r===null?xy:r}function a6(r){Z2.current=r}function qL(){rS=jn()}function Bp(r){Yy=Ut(r,Yy)}function KL(){Rr===Xo&&(Rr=Vy)}function dS(){(Rr===Xo||Rr===Vy||Rr===Kc)&&(Rr=Lp),Ni!==null&&(ud(Yy)||ud(Pp))&&Wl(Ni,Ar)}function QL(r){Rr!==Lp&&(Rr=Kc),Op===null?Op=[r]:Op.push(r)}function JL(){return Rr===Xo}function $y(r,i){var f=zt;zt|=Kr;var g=s6();if(Ni!==r||Ar!==i){if(oi){var v=r.memoizedUpdaters;v.size>0&&(zp(r,Ar),v.clear()),xr(r,i)}qo=L0(),Jc(r,i)}bd(i);do try{ZL();break}catch(T){i6(r,T)}while(!0);if(J0(),zt=f,a6(g),zn!==null)throw new Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");return Us(),Ni=null,Ar=Fe,Rr}function ZL(){for(;zn!==null;)o6(zn)}function $L(r,i){var f=zt;zt|=Kr;var g=s6();if(Ni!==r||Ar!==i){if(oi){var v=r.memoizedUpdaters;v.size>0&&(zp(r,Ar),v.clear()),xr(r,i)}qo=L0(),Wd(),Jc(r,i)}bd(i);do try{eN();break}catch(T){i6(r,T)}while(!0);return J0(),a6(g),zt=f,zn!==null?(rp(),Xo):(Us(),Ni=null,Ar=Fe,Rr)}function eN(){for(;zn!==null&&!gs();)o6(zn)}function o6(r){var i=r.alternate;en(r);var f;(r.mode&an)!==mt?(u2(r),f=fS(i,r,Za),Ty(r,!0)):f=fS(i,r,Za),Bt(),r.memoizedProps=r.pendingProps,f===null?l6(r):zn=f,$2.current=null}function l6(r){var i=r;do{var f=i.alternate,g=i.return;if((i.flags&Ta)===at){en(i);var v=void 0;if((i.mode&an)===mt?v=Db(f,i,Za):(u2(i),v=Db(f,i,Za),Ty(i,!1)),Bt(),v!==null){zn=v;return}}else{var T=LR(f,i);if(T!==null){T.flags&=Mh,zn=T;return}if((i.mode&an)!==mt){Ty(i,!1);for(var P=i.actualDuration,G=i.child;G!==null;)P+=G.actualDuration,G=G.sibling;i.actualDuration=P}if(g!==null)g.flags|=Ta,g.subtreeFlags=at,g.deletions=null;else{Rr=tS,zn=null;return}}var J=i.sibling;if(J!==null){zn=J;return}i=g,zn=i}while(i!==null);Rr===Xo&&(Rr=Qb)}function Zc(r,i,f){var g=Yr(),v=Bn.transition;try{Bn.transition=null,Fn(Je),tN(r,i,f,g)}finally{Bn.transition=v,Fn(g)}return null}function tN(r,i,f,g){do $a();while(Yl!==null);if(fN(),(zt&(Kr|Vs))!==dr)throw new Error("Should not already be working.");var v=r.finishedWork,T=r.finishedLanes;if(tp(T),v===null)return F0(),null;if(T===Fe&&h("root.finishedLanes should not be empty during a commit. This is a bug in React."),r.finishedWork=null,r.finishedLanes=Fe,v===r.current)throw new Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");r.callbackNode=null,r.callbackPriority=In;var P=Ut(v.lanes,v.childLanes);zr(r,P),r===Ni&&(Ni=null,zn=null,Ar=Fe),((v.subtreeFlags&Ks)!==at||(v.flags&Ks)!==at)&&(Qc||(Qc=!0,aS=f,nm(Fo,function(){return $a(),null})));var G=(v.subtreeFlags&(pl|vo|So|Ks))!==at,J=(v.flags&(pl|vo|So|Ks))!==at;if(G||J){var re=Bn.transition;Bn.transition=null;var ce=Yr();Fn(Je);var ge=zt;zt|=Vs,$2.current=null,zR(r,v),Zw(),tL(r,v,T),$n(r.containerInfo),r.current=v,wd(T),nL(v,r,T),np(),Fs(),zt=ge,Fn(ce),Bn.transition=re}else r.current=v,Zw();var we=Qc;if(Qc?(Qc=!1,Yl=r,Ip=T):(qd=0,qy=null),P=r.pendingLanes,P===Fe&&(Xd=null),we||f6(r.current,!1),xd(v.stateNode,g),oi&&r.memoizedUpdaters.clear(),DL(),$i(r,jn()),i!==null)for(var Ne=r.onRecoverableError,Be=0;Be<i.length;Be++){var Ie=i[Be],ut=Ie.stack,Tt=Ie.digest;Ne(Ie.value,{componentStack:ut,digest:Tt})}if(Wy){Wy=!1;var vt=iS;throw iS=null,vt}return Br(Ip,wt)&&r.tag!==Os&&$a(),P=r.pendingLanes,Br(P,wt)?(VA(),r===oS?Fp++:(Fp=0,oS=r)):Fp=0,bn(),F0(),null}function $a(){if(Yl!==null){var r=md(Ip),i=P0(Io,r),f=Bn.transition,g=Yr();try{return Bn.transition=null,Fn(i),rN()}finally{Fn(g),Bn.transition=f}}return!1}function nN(r){sS.push(r),Qc||(Qc=!0,nm(Fo,function(){return $a(),null}))}function rN(){if(Yl===null)return!1;var r=aS;aS=null;var i=Yl,f=Ip;if(Yl=null,Ip=Fe,(zt&(Kr|Vs))!==dr)throw new Error("Cannot flush passive effects while already rendering.");lS=!0,Xy=!1,Uc(f);var g=zt;zt|=Vs,cL(i.current),sL(i,i.current,f,r);{var v=sS;sS=[];for(var T=0;T<v.length;T++){var P=v[T];YR(i,P)}}li(),f6(i.current,!0),zt=g,bn(),Xy?i===qy?qd++:(qd=0,qy=i):qd=0,lS=!1,Xy=!1,Ic(i);{var G=i.current.stateNode;G.effectDuration=0,G.passiveEffectDuration=0}return!0}function c6(r){return Xd!==null&&Xd.has(r)}function iN(r){Xd===null?Xd=new Set([r]):Xd.add(r)}function sN(r){Wy||(Wy=!0,iS=r)}var aN=sN;function u6(r,i,f){var g=Xc(f,i),v=ab(r,g,wt),T=Ul(r,v,wt),P=hi();T!==null&&(Ua(T,wt,P),$i(T,P))}function vn(r,i,f){if(FR(f),Hp(!1),r.tag===O){u6(r,r,f);return}var g=null;for(g=i;g!==null;){if(g.tag===O){u6(g,r,f);return}else if(g.tag===z){var v=g.type,T=g.stateNode;if(typeof v.getDerivedStateFromError=="function"||typeof T.componentDidCatch=="function"&&!c6(T)){var P=Xc(f,r),G=M2(g,P,wt),J=Ul(g,G,wt),re=hi();J!==null&&(Ua(J,wt,re),$i(J,re));return}}g=g.return}h(`Internal React error: Attempted to capture a commit phase error inside a detached tree. This indicates a bug in React. Likely causes include deleting the same fiber more than once, committing an already-finished tree, or an inconsistent return pointer.
|
|
138
|
+
|
|
139
|
+
Error message:
|
|
140
|
+
|
|
141
|
+
%s`,f)}function oN(r,i,f){var g=r.pingCache;g!==null&&g.delete(i);var v=hi();Rl(r,f),yN(r),Ni===r&&ai(Ar,f)&&(Rr===Lp||Rr===Vy&&dd(Ar)&&jn()-rS<Jb?Jc(r,Fe):jy=Ut(jy,f)),$i(r,v)}function d6(r,i){i===In&&(i=FL(r));var f=hi(),g=Ri(r,i);g!==null&&(Ua(g,i,f),$i(g,f))}function lN(r){var i=r.memoizedState,f=In;i!==null&&(f=i.retryLane),d6(r,f)}function cN(r,i){var f=In,g;switch(r.tag){case B:g=r.stateNode;var v=r.memoizedState;v!==null&&(f=v.retryLane);break;case de:g=r.stateNode;break;default:throw new Error("Pinged unknown suspense boundary type. This is probably a bug in React.")}g!==null&&g.delete(i),d6(r,f)}function uN(r){return r<120?120:r<480?480:r<1080?1080:r<1920?1920:r<3e3?3e3:r<4320?4320:NL(r/1960)*1960}function dN(){if(Fp>OL)throw Fp=0,oS=null,new Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");qd>IL&&(qd=0,qy=null,h("Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render."))}function fN(){he.flushLegacyContextWarning(),he.flushPendingUnsafeLifecycleWarnings()}function f6(r,i){en(r),em(r,rs,vL),i&&em(r,hl,SL),em(r,rs,yL),i&&em(r,hl,mL),Bt()}function em(r,i,f){for(var g=r,v=null;g!==null;){var T=g.subtreeFlags&i;g!==v&&g.child!==null&&T!==at?g=g.child:((g.flags&i)!==at&&f(g),g.sibling!==null?g=g.sibling:g=v=g.return)}}var tm=null;function h6(r){{if((zt&Kr)!==dr||!(r.mode&Xt))return;var i=r.tag;if(i!==ee&&i!==O&&i!==z&&i!==R&&i!==ne&&i!==Q&&i!==H)return;var f=ct(r)||"ReactComponent";if(tm!==null){if(tm.has(f))return;tm.add(f)}else tm=new Set([f]);var g=Ke;try{en(r),h("Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead.")}finally{g?en(r):Bt()}}}var fS;{var hN=null;fS=function(r,i,f){var g=x6(hN,i);try{return Cb(r,i,f)}catch(T){if(H0()||T!==null&&typeof T=="object"&&typeof T.then=="function")throw T;if(J0(),kw(),Ab(r,i),x6(i,g),i.mode&an&&u2(i),Nb(null,Cb,null,r,i,f),OR()){var v=Pb();typeof v=="object"&&v!==null&&v._suppressLogging&&typeof T=="object"&&T!==null&&!T._suppressLogging&&(T._suppressLogging=!0)}throw T}}}var p6=!1,hS;hS=new Set;function pN(r){if(kt&&!zA())switch(r.tag){case R:case ne:case H:{var i=zn&&ct(zn)||"Unknown",f=i;if(!hS.has(f)){hS.add(f);var g=ct(r)||"Unknown";h("Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render",g,i,i)}break}case z:{p6||(h("Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state."),p6=!0);break}}}function zp(r,i){if(oi){var f=r.memoizedUpdaters;f.forEach(function(g){Nc(r,g,i)})}}var pS={};function nm(r,i){{var f=ga.current;return f!==null?(f.push(i),pS):vd(r,i)}}function g6(r){if(r!==pS)return wr(r)}function y6(){return ga.current!==null}function gN(r){{if(r.mode&Xt){if(!Kb())return}else if(!LL()||zt!==dr||r.tag!==R&&r.tag!==ne&&r.tag!==H)return;if(ga.current===null){var i=Ke;try{en(r),h(`An update to %s inside a test was not wrapped in act(...).
|
|
142
|
+
|
|
143
|
+
When testing, code that causes React state updates should be wrapped into act(...):
|
|
144
|
+
|
|
145
|
+
act(() => {
|
|
146
|
+
/* fire events that update state */
|
|
147
|
+
});
|
|
148
|
+
/* assert on the output */
|
|
149
|
+
|
|
150
|
+
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act`,ct(r))}finally{i?en(r):Bt()}}}}function yN(r){r.tag!==Os&&Kb()&&ga.current===null&&h(`A suspended resource finished loading inside a test, but the event was not wrapped in act(...).
|
|
151
|
+
|
|
152
|
+
When testing, code that resolves suspended data should be wrapped into act(...):
|
|
153
|
+
|
|
154
|
+
act(() => {
|
|
155
|
+
/* finish loading suspended data */
|
|
156
|
+
});
|
|
157
|
+
/* assert on the output */
|
|
158
|
+
|
|
159
|
+
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act`)}function Hp(r){e6=r}var Ys=null,Kd=null,mN=function(r){Ys=r};function Qd(r){{if(Ys===null)return r;var i=Ys(r);return i===void 0?r:i.current}}function gS(r){return Qd(r)}function yS(r){{if(Ys===null)return r;var i=Ys(r);if(i===void 0){if(r!=null&&typeof r.render=="function"){var f=Qd(r.render);if(r.render!==f){var g={$$typeof:le,render:f};return r.displayName!==void 0&&(g.displayName=r.displayName),g}}return r}return i.current}}function m6(r,i){{if(Ys===null)return!1;var f=r.elementType,g=i.type,v=!1,T=typeof g=="object"&&g!==null?g.$$typeof:null;switch(r.tag){case z:{typeof g=="function"&&(v=!0);break}case R:{(typeof g=="function"||T===Et)&&(v=!0);break}case ne:{(T===le||T===Et)&&(v=!0);break}case Q:case H:{(T===xt||T===Et)&&(v=!0);break}default:return!1}if(v){var P=Ys(f);if(P!==void 0&&P===Ys(g))return!0}return!1}}function v6(r){{if(Ys===null||typeof WeakSet!="function")return;Kd===null&&(Kd=new WeakSet),Kd.add(r)}}var vN=function(r,i){{if(Ys===null)return;var f=i.staleFamilies,g=i.updatedFamilies;$a(),Jy(function(){mS(r.current,g,f)})}},SN=function(r,i){{if(r.context!==Fr)return;$a(),Jy(function(){E6(i,r,null,null)})}};function mS(r,i,f){{var g=r.alternate,v=r.child,T=r.sibling,P=r.tag,G=r.type,J=null;switch(P){case R:case H:case z:J=G;break;case ne:J=G.render;break}if(Ys===null)throw new Error("Expected resolveFamily to be set during hot reload.");var re=!1,ce=!1;if(J!==null){var ge=Ys(J);ge!==void 0&&(f.has(ge)?ce=!0:i.has(ge)&&(P===z?ce=!0:re=!0))}if(Kd!==null&&(Kd.has(r)||g!==null&&Kd.has(g))&&(ce=!0),ce&&(r._debugNeedsRemount=!0),ce||re){var we=Ri(r,wt);we!==null&&fr(we,r,wt,mn)}v!==null&&!ce&&mS(v,i,f),T!==null&&mS(T,i,f)}}var _N=function(r,i){{var f=new Set,g=new Set(i.map(function(v){return v.current}));return vS(r.current,g,f),f}};function vS(r,i,f){{var g=r.child,v=r.sibling,T=r.tag,P=r.type,G=null;switch(T){case R:case H:case z:G=P;break;case ne:G=P.render;break}var J=!1;G!==null&&i.has(G)&&(J=!0),J?xN(r,f):g!==null&&vS(g,i,f),v!==null&&vS(v,i,f)}}function xN(r,i){{var f=wN(r,i);if(f)return;for(var g=r;;){switch(g.tag){case F:i.add(g.stateNode);return;case I:i.add(g.stateNode.containerInfo);return;case O:i.add(g.stateNode.containerInfo);return}if(g.return===null)throw new Error("Expected to reach root first.");g=g.return}}}function wN(r,i){for(var f=r,g=!1;;){if(f.tag===F)g=!0,i.add(f.stateNode);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===r)return g;for(;f.sibling===null;){if(f.return===null||f.return===r)return g;f=f.return}f.sibling.return=f.return,f=f.sibling}return!1}var SS;{SS=!1;try{var S6=Object.preventExtensions({})}catch{SS=!0}}function bN(r,i,f,g){this.tag=r,this.key=f,this.elementType=null,this.type=null,this.stateNode=null,this.return=null,this.child=null,this.sibling=null,this.index=0,this.ref=null,this.pendingProps=i,this.memoizedProps=null,this.updateQueue=null,this.memoizedState=null,this.dependencies=null,this.mode=g,this.flags=at,this.subtreeFlags=at,this.deletions=null,this.lanes=Fe,this.childLanes=Fe,this.alternate=null,this.actualDuration=Number.NaN,this.actualStartTime=Number.NaN,this.selfBaseDuration=Number.NaN,this.treeBaseDuration=Number.NaN,this.actualDuration=0,this.actualStartTime=-1,this.selfBaseDuration=0,this.treeBaseDuration=0,this._debugSource=null,this._debugOwner=null,this._debugNeedsRemount=!1,this._debugHookTypes=null,!SS&&typeof Object.preventExtensions=="function"&&Object.preventExtensions(this)}var ms=function(r,i,f,g){return new bN(r,i,f,g)};function _S(r){var i=r.prototype;return!!(i&&i.isReactComponent)}function EN(r){return typeof r=="function"&&!_S(r)&&r.defaultProps===void 0}function CN(r){if(typeof r=="function")return _S(r)?z:R;if(r!=null){var i=r.$$typeof;if(i===le)return ne;if(i===xt)return Q}return ee}function $c(r,i){var f=r.alternate;f===null?(f=ms(r.tag,i,r.key,r.mode),f.elementType=r.elementType,f.type=r.type,f.stateNode=r.stateNode,f._debugSource=r._debugSource,f._debugOwner=r._debugOwner,f._debugHookTypes=r._debugHookTypes,f.alternate=r,r.alternate=f):(f.pendingProps=i,f.type=r.type,f.flags=at,f.subtreeFlags=at,f.deletions=null,f.actualDuration=0,f.actualStartTime=-1),f.flags=r.flags&ri,f.childLanes=r.childLanes,f.lanes=r.lanes,f.child=r.child,f.memoizedProps=r.memoizedProps,f.memoizedState=r.memoizedState,f.updateQueue=r.updateQueue;var g=r.dependencies;switch(f.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},f.sibling=r.sibling,f.index=r.index,f.ref=r.ref,f.selfBaseDuration=r.selfBaseDuration,f.treeBaseDuration=r.treeBaseDuration,f._debugNeedsRemount=r._debugNeedsRemount,f.tag){case ee:case R:case H:f.type=Qd(r.type);break;case z:f.type=gS(r.type);break;case ne:f.type=yS(r.type);break}return f}function TN(r,i){r.flags&=ri|un;var f=r.alternate;if(f===null)r.childLanes=Fe,r.lanes=i,r.child=null,r.subtreeFlags=at,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null,r.selfBaseDuration=0,r.treeBaseDuration=0;else{r.childLanes=f.childLanes,r.lanes=f.lanes,r.child=f.child,r.subtreeFlags=at,r.deletions=null,r.memoizedProps=f.memoizedProps,r.memoizedState=f.memoizedState,r.updateQueue=f.updateQueue,r.type=f.type;var g=f.dependencies;r.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},r.selfBaseDuration=f.selfBaseDuration,r.treeBaseDuration=f.treeBaseDuration}return r}function kN(r,i,f){var g;return r===Qu?(g=Xt,i===!0&&(g|=An,g|=fs)):g=mt,oi&&(g|=an),ms(O,null,null,g)}function xS(r,i,f,g,v,T){var P=ee,G=r;if(typeof r=="function")_S(r)?(P=z,G=gS(G)):G=Qd(G);else if(typeof r=="string")P=F;else e:switch(r){case Me:return Xl(f.children,v,T,i);case be:P=j,v|=An,(v&Xt)!==mt&&(v|=fs);break;case He:return MN(f,v,T,i);case Ee:return DN(f,v,T,i);case yt:return AN(f,v,T,i);case kn:return _6(f,v,T,i);case sr:case Pt:case Ft:case Sn:case On:default:{if(typeof r=="object"&&r!==null)switch(r.$$typeof){case $e:P=X;break e;case Ct:P=Y;break e;case le:P=ne,G=yS(G);break e;case xt:P=Q;break e;case Et:P=K,G=null;break e}var J="";{(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(J+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var re=g?ct(g):null;re&&(J+=`
|
|
160
|
+
|
|
161
|
+
Check the render method of \``+re+"`.")}throw new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) "+("but got: "+(r==null?r:typeof r)+"."+J))}}var ce=ms(P,f,i,v);return ce.elementType=r,ce.type=G,ce.lanes=T,ce._debugOwner=g,ce}function wS(r,i,f){var g=null;g=r._owner;var v=r.type,T=r.key,P=r.props,G=xS(v,T,P,g,i,f);return G._debugSource=r._source,G._debugOwner=r._owner,G}function Xl(r,i,f,g){var v=ms(W,r,g,i);return v.lanes=f,v}function MN(r,i,f,g){typeof r.id!="string"&&h('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.',typeof r.id);var v=ms(A,r,g,i|an);return v.elementType=He,v.lanes=f,v.stateNode={effectDuration:0,passiveEffectDuration:0},v}function DN(r,i,f,g){var v=ms(B,r,g,i);return v.elementType=Ee,v.lanes=f,v}function AN(r,i,f,g){var v=ms(de,r,g,i);return v.elementType=yt,v.lanes=f,v}function _6(r,i,f,g){var v=ms(se,r,g,i);v.elementType=kn,v.lanes=f;var T={isHidden:!1};return v.stateNode=T,v}function bS(r,i,f){var g=ms(V,r,null,i);return g.lanes=f,g}function RN(){var r=ms(F,null,null,mt);return r.elementType="DELETED",r}function LN(r){var i=ms(ie,null,null,mt);return i.stateNode=r,i}function ES(r,i,f){var g=r.children!==null?r.children:[],v=ms(I,g,r.key,i);return v.lanes=f,v.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},v}function x6(r,i){return r===null&&(r=ms(ee,null,null,mt)),r.tag=i.tag,r.key=i.key,r.elementType=i.elementType,r.type=i.type,r.stateNode=i.stateNode,r.return=i.return,r.child=i.child,r.sibling=i.sibling,r.index=i.index,r.ref=i.ref,r.pendingProps=i.pendingProps,r.memoizedProps=i.memoizedProps,r.updateQueue=i.updateQueue,r.memoizedState=i.memoizedState,r.dependencies=i.dependencies,r.mode=i.mode,r.flags=i.flags,r.subtreeFlags=i.subtreeFlags,r.deletions=i.deletions,r.lanes=i.lanes,r.childLanes=i.childLanes,r.alternate=i.alternate,r.actualDuration=i.actualDuration,r.actualStartTime=i.actualStartTime,r.selfBaseDuration=i.selfBaseDuration,r.treeBaseDuration=i.treeBaseDuration,r._debugSource=i._debugSource,r._debugOwner=i._debugOwner,r._debugNeedsRemount=i._debugNeedsRemount,r._debugHookTypes=i._debugHookTypes,r}function NN(r,i,f,g,v){this.tag=i,this.containerInfo=r,this.pendingChildren=null,this.current=null,this.pingCache=null,this.finishedWork=null,this.timeoutHandle=Ce,this.context=null,this.pendingContext=null,this.callbackNode=null,this.callbackPriority=In,this.eventTimes=Al(Fe),this.expirationTimes=Al(mn),this.pendingLanes=Fe,this.suspendedLanes=Fe,this.pingedLanes=Fe,this.expiredLanes=Fe,this.mutableReadLanes=Fe,this.finishedLanes=Fe,this.entangledLanes=Fe,this.entanglements=Al(Fe),this.identifierPrefix=g,this.onRecoverableError=v,Pe&&(this.mutableSourceEagerHydrationData=null),this.effectDuration=0,this.passiveEffectDuration=0;{this.memoizedUpdaters=new Set;for(var T=this.pendingUpdatersLaneMap=[],P=0;P<Do;P++)T.push(new Set)}switch(i){case Qu:this._debugRootType=f?"hydrateRoot()":"createRoot()";break;case Os:this._debugRootType=f?"hydrate()":"render()";break}}function w6(r,i,f,g,v,T,P,G,J,re){var ce=new NN(r,i,f,G,J),ge=kN(i,T);ce.current=ge,ge.stateNode=ce;{var we={element:g,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null};ge.memoizedState=we}return P1(ge),ce}var PN="18.3.1";function ON(r,i,f){var g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return vA(g),{$$typeof:Ae,key:g==null?null:""+g,children:r,containerInfo:i,implementation:f}}var CS,TS;CS=!1,TS={};function b6(r){if(!r)return Fr;var i=S(r),f=qi(i);if(i.tag===z){var g=i.type;if(ii(g))return Ku(i,g,f)}return f}function IN(r){var i=S(r);if(i===void 0){if(typeof r.render=="function")throw new Error("Unable to find node on an unmounted component.");var f=Object.keys(r).join(",");throw new Error("Argument appears to not be a ReactComponent. Keys: "+f)}var g=Ms(i);return g===null?null:g.stateNode}function FN(r,i){{var f=S(r);if(f===void 0){if(typeof r.render=="function")throw new Error("Unable to find node on an unmounted component.");var g=Object.keys(r).join(",");throw new Error("Argument appears to not be a ReactComponent. Keys: "+g)}var v=Ms(f);if(v===null)return null;if(v.mode&An){var T=ct(f)||"Component";if(!TS[T]){TS[T]=!0;var P=Ke;try{en(v),f.mode&An?h("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node",i,i,T):h("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node",i,i,T)}finally{P?en(P):Bt()}}}return v.stateNode}}function UN(r,i,f,g,v,T,P,G){var J=!1,re=null;return w6(r,i,J,re,f,g,v,T,P)}function BN(r,i,f,g,v,T,P,G,J,re){var ce=!0,ge=w6(f,g,ce,r,v,T,P,G,J);ge.context=b6(null);var we=ge.current,Ne=hi(),Be=jl(we),Ie=jo(Ne,Be);return Ie.callback=i??null,Ul(we,Ie,Be),UL(ge,Be,Ne),ge}function E6(r,i,f,g){_d(i,r);var v=i.current,T=hi(),P=jl(v);Ll(P);var G=b6(f);i.context===null?i.context=G:i.pendingContext=G,kt&&Ke!==null&&!CS&&(CS=!0,h(`Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.
|
|
162
|
+
|
|
163
|
+
Check the render method of %s.`,ct(Ke)||"Unknown"));var J=jo(T,P);J.payload={element:r},g=g===void 0?null:g,g!==null&&(typeof g!="function"&&h("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",g),J.callback=g);var re=Ul(v,J,P);return re!==null&&(fr(re,v,P,T),ny(re,v,P)),P}function zN(r){var i=r.current;if(!i.child)return null;switch(i.child.tag){case F:return Si(i.child.stateNode);default:return i.child.stateNode}}function HN(r){switch(r.tag){case O:{var i=r.stateNode;if(ra(i)){var f=M0(i);GL(i,f)}break}case B:{Jy(function(){var v=Ri(r,wt);if(v!==null){var T=hi();fr(v,r,wt,T)}});var g=wt;rm(r,g);break}}}function C6(r,i){var f=r.memoizedState;f!==null&&f.dehydrated!==null&&(f.retryLane=Lc(f.retryLane,i))}function rm(r,i){C6(r,i);var f=r.alternate;f&&C6(f,i)}function GN(r){if(r.tag===B){var i=wt,f=Ri(r,i);if(f!==null){var g=hi();fr(f,r,i,g)}rm(r,i)}}function VN(r){if(r.tag===B){var i=Po,f=Ri(r,i);if(f!==null){var g=hi();fr(f,r,i,g)}rm(r,i)}}function YN(r){if(r.tag===B){var i=jl(r),f=Ri(r,i);if(f!==null){var g=hi();fr(f,r,i,g)}rm(r,i)}}function jN(r){var i=wo(r);return i===null?null:i.stateNode}var T6=function(r){return null};function k6(r){return T6(r)}var M6=function(r){return!1};function D6(r){return M6(r)}var A6=null,R6=null,L6=null,N6=null,P6=null,O6=null,I6=null,F6=null,U6=null;{var B6=function(r,i,f){var g=i[f],v=Vn(r)?r.slice():_({},r);return f+1===i.length?(Vn(v)?v.splice(g,1):delete v[g],v):(v[g]=B6(r[g],i,f+1),v)},z6=function(r,i){return B6(r,i,0)},H6=function(r,i,f,g){var v=i[g],T=Vn(r)?r.slice():_({},r);if(g+1===i.length){var P=f[g];T[P]=T[v],Vn(T)?T.splice(v,1):delete T[v]}else T[v]=H6(r[v],i,f,g+1);return T},G6=function(r,i,f){if(i.length!==f.length){p("copyWithRename() expects paths of the same length");return}else for(var g=0;g<f.length-1;g++)if(i[g]!==f[g]){p("copyWithRename() expects paths to be the same except for the deepest key");return}return H6(r,i,f,0)},V6=function(r,i,f,g){if(f>=i.length)return g;var v=i[f],T=Vn(r)?r.slice():_({},r);return T[v]=V6(r[v],i,f+1,g),T},Y6=function(r,i,f){return V6(r,i,0,f)},kS=function(r,i){for(var f=r.memoizedState;f!==null&&i>0;)f=f.next,i--;return f};A6=function(r,i,f,g){var v=kS(r,i);if(v!==null){var T=Y6(v.memoizedState,f,g);v.memoizedState=T,v.baseState=T,r.memoizedProps=_({},r.memoizedProps);var P=Ri(r,wt);P!==null&&fr(P,r,wt,mn)}},R6=function(r,i,f){var g=kS(r,i);if(g!==null){var v=z6(g.memoizedState,f);g.memoizedState=v,g.baseState=v,r.memoizedProps=_({},r.memoizedProps);var T=Ri(r,wt);T!==null&&fr(T,r,wt,mn)}},L6=function(r,i,f,g){var v=kS(r,i);if(v!==null){var T=G6(v.memoizedState,f,g);v.memoizedState=T,v.baseState=T,r.memoizedProps=_({},r.memoizedProps);var P=Ri(r,wt);P!==null&&fr(P,r,wt,mn)}},N6=function(r,i,f){r.pendingProps=Y6(r.memoizedProps,i,f),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var g=Ri(r,wt);g!==null&&fr(g,r,wt,mn)},P6=function(r,i){r.pendingProps=z6(r.memoizedProps,i),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var f=Ri(r,wt);f!==null&&fr(f,r,wt,mn)},O6=function(r,i,f){r.pendingProps=G6(r.memoizedProps,i,f),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var g=Ri(r,wt);g!==null&&fr(g,r,wt,mn)},I6=function(r){var i=Ri(r,wt);i!==null&&fr(i,r,wt,mn)},F6=function(r){T6=r},U6=function(r){M6=r}}function WN(r){var i=Ms(r);return i===null?null:i.stateNode}function XN(r){return null}function qN(){return Ke}function KN(r){var i=r.findFiberByHostInstance,f=l.ReactCurrentDispatcher;return Sd({bundleType:r.bundleType,version:r.version,rendererPackageName:r.rendererPackageName,rendererConfig:r.rendererConfig,overrideHookState:A6,overrideHookStateDeletePath:R6,overrideHookStateRenamePath:L6,overrideProps:N6,overridePropsDeletePath:P6,overridePropsRenamePath:O6,setErrorHandler:F6,setSuspenseHandler:U6,scheduleUpdate:I6,currentDispatcherRef:f,findHostInstanceByFiber:WN,findFiberByHostInstance:i||XN,findHostInstancesForRefresh:_N,scheduleRefresh:vN,scheduleRoot:SN,setRefreshHandler:mN,getCurrentFiber:qN,reconcilerVersion:PN})}return n.attemptContinuousHydration=VN,n.attemptDiscreteHydration=GN,n.attemptHydrationAtCurrentPriority=YN,n.attemptSynchronousHydration=HN,n.batchedUpdates=YL,n.createComponentSelector=_L,n.createContainer=UN,n.createHasPseudoClassSelector=xL,n.createHydrationContainer=BN,n.createPortal=ON,n.createRoleSelector=wL,n.createTestNameSelector=EL,n.createTextSelector=bL,n.deferredUpdates=VL,n.discreteUpdates=jL,n.findAllNodes=Hy,n.findBoundingRects=kL,n.findHostInstance=IN,n.findHostInstanceWithNoPortals=jN,n.findHostInstanceWithWarning=FN,n.flushControlled=XL,n.flushPassiveEffects=$a,n.flushSync=Jy,n.focusWithin=ML,n.getCurrentUpdatePriority=Yr,n.getFindAllNodesFailureDescription=TL,n.getPublicRootInstance=zN,n.injectIntoDevTools=KN,n.isAlreadyRendering=WL,n.observeVisibleRects=AL,n.registerMutableSourceForHydration=PA,n.runWithPriority=Jh,n.shouldError=k6,n.shouldSuspend=D6,n.updateContainer=E6,n})),bm.exports}var j_;function U8(){return j_||(j_=1,process.env.NODE_ENV==="production"?qp.exports=I8():qp.exports=F8()),qp.exports}var B8=U8();const z8=im(B8);var Qp={exports:{}},Jo={};/**
|
|
164
|
+
* @license React
|
|
165
|
+
* react-reconciler-constants.production.min.js
|
|
166
|
+
*
|
|
167
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the MIT license found in the
|
|
170
|
+
* LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/var W_;function H8(){return W_||(W_=1,Jo.ConcurrentRoot=1,Jo.ContinuousEventPriority=4,Jo.DefaultEventPriority=16,Jo.DiscreteEventPriority=1,Jo.IdleEventPriority=536870912,Jo.LegacyRoot=0),Jo}var Zo={};/**
|
|
172
|
+
* @license React
|
|
173
|
+
* react-reconciler-constants.development.js
|
|
174
|
+
*
|
|
175
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
176
|
+
*
|
|
177
|
+
* This source code is licensed under the MIT license found in the
|
|
178
|
+
* LICENSE file in the root directory of this source tree.
|
|
179
|
+
*/var X_;function G8(){return X_||(X_=1,process.env.NODE_ENV!=="production"&&(function(){var t=1,e=4,n=16,s=536870912,a=t,l=e,u=n,d=s,p=0,h=1;Zo.ConcurrentRoot=h,Zo.ContinuousEventPriority=l,Zo.DefaultEventPriority=u,Zo.DiscreteEventPriority=a,Zo.IdleEventPriority=d,Zo.LegacyRoot=p})()),Zo}var q_;function V8(){return q_||(q_=1,process.env.NODE_ENV==="production"?Qp.exports=H8():Qp.exports=G8()),Qp.exports}var K_=V8(),Y8=Vt();const Q_={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let J_=!1,Z_=!1;const Em=".react-konva-event",j8=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
|
|
180
|
+
Position of a node will be changed during drag&drop, so you should update state of the react app as well.
|
|
181
|
+
Consider to add onDragMove or onDragEnd events.
|
|
182
|
+
For more info see: https://github.com/konvajs/react-konva/issues/256
|
|
183
|
+
`,W8=`ReactKonva: You are using "zIndex" attribute for a Konva node.
|
|
184
|
+
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
|
|
185
|
+
For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
186
|
+
`,X8={};function Jp(t,e,n=X8){if(!J_&&"zIndex"in e&&(console.warn(W8),J_=!0),!Z_&&e.draggable){var s=e.x!==void 0||e.y!==void 0,a=e.onDragEnd||e.onDragMove;s&&!a&&(console.warn(j8),Z_=!0)}for(var l in n)if(!Q_[l]){var u=l.slice(0,2)==="on",d=n[l]!==e[l];if(u&&d){var p=l.substr(2).toLowerCase();p.substr(0,7)==="content"&&(p="content"+p.substr(7,1).toUpperCase()+p.substr(8)),t.off(p,n[l])}var h=!e.hasOwnProperty(l);h&&t.setAttr(l,void 0)}var y=e._useStrictMode,_={},S=!1;const x={};for(var l in e)if(!Q_[l]){var u=l.slice(0,2)==="on",w=n[l]!==e[l];if(u&&w){var p=l.substr(2).toLowerCase();p.substr(0,7)==="content"&&(p="content"+p.substr(7,1).toUpperCase()+p.substr(8)),e[l]&&(x[p]=e[l])}!u&&(e[l]!==n[l]||y&&e[l]!==t.getAttr(l))&&(S=!0,_[l]=e[l])}S&&(t.setAttrs(_),$o(t));for(var p in x)t.on(p+Em,x[p])}function $o(t){if(!Y8.Konva.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}var Cm=xm();const $_={},q8={};Hf.Node.prototype._applyProps=Jp;function K8(t,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}t.add(e),$o(t)}function Q8(t,e,n){let s=Hf[t];s||(console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),s=Hf.Group);const a={},l={};for(var u in e){var d=u.slice(0,2)==="on";d?l[u]=e[u]:a[u]=e[u]}const p=new s(a);return Jp(p,l),p}function J8(t,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function Z8(t,e,n){return!1}function $8(t){return t}function eE(){return null}function tE(){return null}function nE(t,e,n,s){return q8}function rE(){}function iE(t){}function sE(t,e){return!1}function aE(){return $_}function oE(){return $_}const lE=setTimeout,cE=clearTimeout,uE=-1;function dE(t,e){return!1}const fE=!1,hE=!0,pE=!0;function gE(t,e){e.parent===t?e.moveToTop():t.add(e),$o(t)}function yE(t,e){e.parent===t?e.moveToTop():t.add(e),$o(t)}function e5(t,e,n){e._remove(),t.add(e),e.setZIndex(n.getZIndex()),$o(t)}function mE(t,e,n){e5(t,e,n)}function vE(t,e){e.destroy(),e.off(Em),$o(t)}function SE(t,e){e.destroy(),e.off(Em),$o(t)}function _E(t,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function xE(t,e,n){}function wE(t,e,n,s,a){Jp(t,a,s)}function bE(t){t.hide(),$o(t)}function EE(t){}function CE(t,e){(e.visible==null||e.visible)&&t.show()}function TE(t,e){}function kE(t){}function ME(){}const DE=Object.freeze(Object.defineProperty({__proto__:null,appendChild:gE,appendChildToContainer:yE,appendInitialChild:K8,cancelTimeout:cE,clearContainer:kE,commitMount:xE,commitTextUpdate:_E,commitUpdate:wE,createInstance:Q8,createTextInstance:J8,detachDeletedInstance:ME,finalizeInitialChildren:Z8,getChildHostContext:oE,getCurrentEventPriority:()=>K_.DefaultEventPriority,getPublicInstance:$8,getRootHostContext:aE,hideInstance:bE,hideTextInstance:EE,idlePriority:Cm.unstable_IdlePriority,insertBefore:e5,insertInContainerBefore:mE,isPrimaryRenderer:fE,noTimeout:uE,now:Cm.unstable_now,prepareForCommit:eE,preparePortalMount:tE,prepareUpdate:nE,removeChild:vE,removeChildFromContainer:SE,resetAfterCommit:rE,resetTextContent:iE,run:Cm.unstable_runWithPriority,scheduleTimeout:lE,shouldDeprioritizeSubtree:sE,shouldSetTextContent:dE,supportsMutation:pE,unhideInstance:CE,unhideTextInstance:TE,warnsIfNotActing:hE},Symbol.toStringTag,{value:"Module"}));var AE=Object.defineProperty,RE=Object.defineProperties,LE=Object.getOwnPropertyDescriptors,t5=Object.getOwnPropertySymbols,NE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,n5=(t,e,n)=>e in t?AE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,r5=(t,e)=>{for(var n in e||(e={}))NE.call(e,n)&&n5(t,n,e[n]);if(t5)for(var n of t5(e))PE.call(e,n)&&n5(t,n,e[n]);return t},OE=(t,e)=>RE(t,LE(e)),i5,s5;typeof window<"u"&&((i5=window.document)!=null&&i5.createElement||((s5=window.navigator)==null?void 0:s5.product)==="ReactNative")?Ii.useLayoutEffect:Ii.useEffect;function a5(t,e,n){if(!t)return;if(n(t)===!0)return t;let s=t.child;for(;s;){const a=a5(s,e,n);if(a)return a;s=s.sibling}}function o5(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const l5=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=l5;return}return l5.apply(this,arguments)};const Tm=o5(Ii.createContext(null));class c5 extends Ii.Component{render(){return Ii.createElement(Tm.Provider,{value:this._reactInternals},this.props.children)}}function IE(){const t=Ii.useContext(Tm);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Ii.useId();return Ii.useMemo(()=>{for(const s of[t,t==null?void 0:t.alternate]){if(!s)continue;const a=a5(s,!1,l=>{let u=l.memoizedState;for(;u;){if(u.memoizedState===e)return!0;u=u.next}});if(a)return a}},[t,e])}function FE(){const t=IE(),[e]=Ii.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const a=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;a&&a!==Tm&&!e.has(a)&&e.set(a,Ii.useContext(o5(a)))}n=n.return}return e}function UE(){const t=FE();return Ii.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>s=>Ii.createElement(e,null,Ii.createElement(n.Provider,OE(r5({},s),{value:t.get(n)}))),e=>Ii.createElement(c5,r5({},e))),[t])}function BE(t){const e=te.useRef({});return te.useLayoutEffect(()=>{e.current=t}),te.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const zE=t=>{const e=te.useRef(null),n=te.useRef(null),s=te.useRef(null),a=BE(t),l=UE(),u=d=>{const{forwardedRef:p}=t;p&&(typeof p=="function"?p(d):p.current=d)};return te.useLayoutEffect(()=>(n.current=new Hf.Stage({width:t.width,height:t.height,container:e.current}),u(n.current),s.current=Vf.createContainer(n.current,K_.LegacyRoot,!1,null),Vf.updateContainer(te.createElement(l,{},t.children),s.current),()=>{Hf.isBrowser&&(u(null),Vf.updateContainer(null,s.current,null),n.current.destroy())}),[]),te.useLayoutEffect(()=>{u(n.current),Jp(n.current,t,a),Vf.updateContainer(te.createElement(l,{},t.children),s.current,null)}),te.createElement("div",{ref:e,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},Zp="Layer",io="Group",ya="Rect",Gf="Circle",u5="Ellipse",Ui="Line",HE="Image",d5="Text",GE="Path",Ss="Shape",VE="Transformer",Vf=z8(DE);Vf.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:process.env.NODE_ENV!=="production"?1:0,version:te.version,rendererPackageName:"react-konva"});const YE=te.forwardRef((t,e)=>te.createElement(c5,{},te.createElement(zE,{...t,forwardedRef:e}))),f5=t=>{let e;const n=new Set,s=(h,y)=>{const _=typeof h=="function"?h(e):h;if(!Object.is(_,e)){const S=e;e=y??(typeof _!="object"||_===null)?_:Object.assign({},e,_),n.forEach(x=>x(e,S))}},a=()=>e,d={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h))},p=e=t(s,a,d);return d},jE=(t=>t?f5(t):f5),WE=t=>t;function XE(t,e=WE){const n=te.useSyncExternalStore(t.subscribe,te.useCallback(()=>e(t.getState()),[t,e]),te.useCallback(()=>e(t.getInitialState()),[t,e]));return te.useDebugValue(n),n}const h5=t=>{const e=jE(t),n=s=>XE(e,s);return Object.assign(n,e),n},p5=(t=>t?h5(t):h5),$p={strokeColor:"#1e1e1e",fillColor:"transparent",strokeWidth:2,opacity:1,strokeStyle:"solid",roughness:0,fontSize:20,fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif"},g5=["#1e1e1e","#e03131","#2f9e44","#1971c2","#f08c00","#6741d9","#c2255c","#0c8599","#868e96"],y5=["transparent","#ffc9c9","#b2f2bb","#a5d8ff","#ffec99","#d0bfff","#fcc2d7","#99e9f2","#e9ecef"],qE=[1,2,3,4,6],km=[{type:"hand",label:"Hand (Pan)",shortcut:"H",icon:"Hand"},{type:"select",label:"Select",shortcut:"V",icon:"MousePointer2"},{type:"rectangle",label:"Rectangle",shortcut:"R",icon:"Square"},{type:"ellipse",label:"Ellipse",shortcut:"O",icon:"Circle"},{type:"diamond",label:"Diamond",shortcut:"D",icon:"Diamond"},{type:"line",label:"Line",shortcut:"L",icon:"Minus"},{type:"arrow",label:"Arrow",shortcut:"A",icon:"ArrowUpRight"},{type:"freedraw",label:"Pencil",shortcut:"P",icon:"Pencil"},{type:"text",label:"Text",shortcut:"T",icon:"Type"},{type:"image",label:"Image",shortcut:"I",icon:"ImageIcon"},{type:"eraser",label:"Eraser",shortcut:"E",icon:"Eraser"}],tu=.1,nu=5,KE=[12,16,20,24,28,36,48,64],QE=[{label:"Sans-serif",value:"system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif"},{label:"Serif",value:"Georgia, Cambria, Times New Roman, Times, serif"},{label:"Monospace",value:"SF Mono, Menlo, Consolas, Liberation Mono, monospace"},{label:"Hand-drawn",value:"Segoe Print, Comic Sans MS, cursive"}],Nr={color:"#4f8df7",blur:6,opacity:.5},ru=20,Mm=[{type:null,label:"None",preview:"—"},{type:"arrow",label:"Arrow",preview:"▷"},{type:"triangle",label:"Triangle",preview:"▶"},{type:"triangle_outline",label:"Triangle Outline",preview:"△"},{type:"circle",label:"Circle",preview:"●"},{type:"circle_outline",label:"Circle Outline",preview:"○"},{type:"diamond",label:"Diamond",preview:"◆"},{type:"diamond_outline",label:"Diamond Outline",preview:"◇"},{type:"bar",label:"Bar",preview:"|"},{type:"crowfoot_one",label:"One",preview:"||"},{type:"crowfoot_many",label:"Many",preview:">|"},{type:"crowfoot_one_or_many",label:"One or Many",preview:">||"}],m5=[{type:"sharp",label:"Sharp",preview:"╱"},{type:"curved",label:"Curved",preview:"∿"},{type:"elbow",label:"Elbow",preview:"⌐"}],v5=[{value:0,label:"Architect"},{value:1,label:"Artist"},{value:2,label:"Cartoonist"}],S5=20,_5=25,JE=36,iu=40,x5=1e4;function eg(t){switch(t){case"up":return{x:0,y:-1};case"down":return{x:0,y:1};case"left":return{x:-1,y:0};case"right":return{x:1,y:0}}}function tg(t){return t==="up"||t==="down"}function ng(t,e){const n=t.x+t.width/2,s=t.y+t.height/2,a=e.x-n,l=e.y-s,u=(t.width||1)/2,d=(t.height||1)/2,p=Math.abs(a)/u,h=Math.abs(l)/d;return p>h*3?a>=0?"right":"left":(h>p*3,l>=0?"down":"up")}function Dm(t){const[e,n]=t,s=n,a=1-n,l=e,u=1-e,d=Math.min(s,a,l,u);return d===s?"up":d===a?"down":d===l?"left":"right"}function Yf(t,e){const n=e.x-t.x,s=e.y-t.y;return Math.abs(n)>=Math.abs(s)?n>=0?"right":"left":s>=0?"down":"up"}function Am(t,e){const n=t.x+t.width/2,s=t.y+t.height/2,a=e.x-n,l=e.y-s,u=t.width/2||1,d=t.height/2||1,p=a/u,h=l/d;return Math.abs(p)>=Math.abs(h)?a>=0?"right":"left":l>=0?"down":"up"}function ZE(t,e){const n=Math.abs(e.y-t.y),s=Math.abs(e.y-(t.y+t.height)),a=Math.abs(e.x-t.x),l=Math.abs(e.x-(t.x+t.width)),u=Math.min(n,s,a,l);return u===n?"up":u===s?"down":u===a?"left":"right"}function so(t){return t.left+t.width}function ao(t){return t.top+t.height}function $E(t,e){return e.x>t.left&&e.x<so(t)&&e.y>t.top&&e.y<ao(t)}function su(t,e,n){return{left:t.left-e,top:t.top-n,width:t.width+e*2,height:t.height+n*2}}function w5(t,e,n){const s=Math.min(e,_5),a=n==="left"?s:e,l=n==="right"?s:e,u=n==="up"?s:e,d=n==="down"?s:e;return{left:t.left-a,top:t.top-u,width:t.width+a+l,height:t.height+u+d}}function b5(t,e,n){const s=new Set(n),a=Math.min(e,_5),l=s.has("left")?a:e,u=s.has("right")?a:e,d=s.has("up")?a:e,p=s.has("down")?a:e;return{left:t.left-l,top:t.top-d,width:t.width+l+u,height:t.height+d+p}}function eC(t,e){const n=Math.min(t.left,e.left),s=Math.min(t.top,e.top),a=Math.max(so(t),so(e)),l=Math.max(ao(t),ao(e));return{left:n,top:s,width:a-n,height:l-s}}function Rm(t){return{left:t.x,top:t.y,width:t.width,height:t.height}}function Lm(t){const e=t.rotation||0;if(e===0)return{x:t.x,y:t.y,width:t.width,height:t.height};const n=t.x+t.width/2,s=t.y+t.height/2,a=t.width/2,l=t.height/2,u=e*Math.PI/180,d=Math.cos(u),p=Math.sin(u),h=[{x:-a,y:-l},{x:a,y:-l},{x:a,y:l},{x:-a,y:l}].map(w=>({x:n+w.x*d-w.y*p,y:s+w.x*p+w.y*d}));let y=1/0,_=1/0,S=-1/0,x=-1/0;for(const w of h)w.x<y&&(y=w.x),w.y<_&&(_=w.y),w.x>S&&(S=w.x),w.y>x&&(x=w.y);return{x:y,y:_,width:S-y,height:x-_}}function tC(t){switch(t){case"left":return"right";case"right":return"left";case"up":return"down";case"down":return"up"}}function nC(t,e){return e.x<t.x?"left":e.x>t.x?"right":e.y<t.y?"up":e.y>t.y?"down":null}function rC(t,e){return t===null||e===null?!1:(t==="left"||t==="right"?"h":"v")!==(e==="left"||e==="right"?"h":"v")}class iC{constructor(e){et(this,"adjacent",new Map);this.pt=e}}class sC{constructor(){et(this,"idx",{})}add(e){const n=String(e.x),s=String(e.y);n in this.idx||(this.idx[n]={}),s in this.idx[n]||(this.idx[n][s]=new iC(e))}get(e){var a;const n=String(e.x),s=String(e.y);return((a=this.idx[n])==null?void 0:a[s])??null}has(e){return this.get(e)!==null}connect(e,n){const s=this.get(e),a=this.get(n);if(!s||!a)return;const l=Math.abs(n.x-e.x)+Math.abs(n.y-e.y);s.adjacent.set(a,l),a.adjacent.set(s,l)}}class aC{constructor(){et(this,"data",[])}get size(){return this.data.length}push(e,n){this.data.push({item:e,priority:n}),this.bubbleUp(this.data.length-1)}pop(){if(this.data.length===0)return;const e=this.data[0],n=this.data.pop();return this.data.length>0&&(this.data[0]=n,this.sinkDown(0)),e.item}bubbleUp(e){for(;e>0;){const n=e-1>>1;if(this.data[n].priority<=this.data[e].priority)break;[this.data[n],this.data[e]]=[this.data[e],this.data[n]],e=n}}sinkDown(e){const n=this.data.length;for(;;){let s=e;const a=2*e+1,l=2*e+2;if(a<n&&this.data[a].priority<this.data[s].priority&&(s=a),l<n&&this.data[l].priority<this.data[s].priority&&(s=l),s===e)break;[this.data[s],this.data[e]]=[this.data[e],this.data[s]],e=s}}}function oC(t,e,n){const s=t.get(e),a=t.get(n);if(!s||!a)return null;const l=S=>Math.abs(S.x-n.x)+Math.abs(S.y-n.y),u=(S,x)=>`${S.pt.x},${S.pt.y},${x??"n"}`,d=new Map,p=new Map,h=new aC,y={node:s,dir:null,g:0},_=u(s,null);for(d.set(_,0),p.set(_,null),h.push(y,l(s.pt));h.size>0;){const S=h.pop(),x=u(S.node,S.dir);if(!(S.g>(d.get(x)??1/0))){if(S.node===a){const w=[];let C=S;for(;C;){w.push(C.node.pt);const D=u(C.node,C.dir);if(C=p.get(D),C==null)break}return w[w.length-1]!==s.pt&&w.push(s.pt),w.reverse(),w}for(const[w,C]of S.node.adjacent){const D=nC(S.node.pt,w.pt);if(D===null)continue;const U=S.dir!==null&&D===tC(S.dir),M=rC(S.dir,D),E=U?x5*3:M?x5:0,L=S.g+C+E,R=u(w,D);L<(d.get(R)??1/0)&&(d.set(R,L),p.set(R,S),h.push({node:w,dir:D,g:L},L+l(w.pt)))}}}return null}function lC(t){const e=new Map,n=[];for(const s of t){let a=e.get(s.x);a||(a=new Set,e.set(s.x,a)),a.has(s.y)||(a.add(s.y),n.push(s))}return n}function cC(t,e,n,s){const a=n.left,l=so(n),u=n.top,d=ao(n),p=[...new Set([a,...t.filter(S=>S>=a&&S<=l),l])].sort((S,x)=>S-x),h=[...new Set([u,...e.filter(S=>S>=u&&S<=d),d])].sort((S,x)=>S-x),y=S=>s.some(x=>$E(x,S)),_=[];for(const S of h)for(const x of p){const w={x,y:S};y(w)||_.push(w)}return _}function E5(t,e,n){if(t.y===e.y){const s=t.y,a=Math.min(t.x,e.x),l=Math.max(t.x,e.x);for(const u of n)if(u.top<s&&s<ao(u)&&u.left<l&&so(u)>a)return!0}else if(t.x===e.x){const s=t.x,a=Math.min(t.y,e.y),l=Math.max(t.y,e.y);for(const u of n)if(u.left<s&&s<so(u)&&u.top<l&&ao(u)>a)return!0}return!1}function uC(t,e){const n=new sC,s=new Set,a=new Set;for(const d of t)n.add(d),s.add(d.x),a.add(d.y);const l=[...s].sort((d,p)=>d-p),u=[...a].sort((d,p)=>d-p);for(let d=0;d<u.length;d++)for(let p=0;p<l.length;p++){const h={x:l[p],y:u[d]};if(n.has(h)){for(let y=p-1;y>=0;y--){const _={x:l[y],y:u[d]};if(n.has(_)){E5(_,h,e)||n.connect(_,h);break}}for(let y=d-1;y>=0;y--){const _={x:l[p],y:u[y]};if(n.has(_)){E5(_,h,e)||n.connect(_,h);break}}}}return n}function C5(t){if(t.length<=2)return t;const e=[t[0]];for(let n=1;n<t.length-1;n++){const s=t[n-1],a=t[n],l=t[n+1],u=s.x===a.x&&a.x===l.x,d=s.y===a.y&&a.y===l.y;u||d||s.x===a.x&&s.y===a.y||e.push(a)}return e.push(t[t.length-1]),e}function T5(t){if(t.length<=2)return 0;let e=0;for(let n=1;n<t.length-1;n++){const s=t[n-1],a=t[n],l=t[n+1],u=s.x===a.x&&a.x===l.x,d=s.y===a.y&&a.y===l.y;!u&&!d&&e++}return e}function k5(t){let e=0;for(let n=1;n<t.length;n++)e+=Math.abs(t[n].x-t[n-1].x)+Math.abs(t[n].y-t[n-1].y);return e}function dC(t){let e=t[0],n=T5(e),s=k5(e);for(let a=1;a<t.length;a++){const l=T5(t[a]),u=k5(t[a]);(l<n||l===n&&u<s)&&(e=t[a],n=l,s=u)}return e}function Nm(t,e,n,s,a,l){let u={left:Math.min(t.x,e.x),top:Math.min(t.y,e.y),width:Math.abs(e.x-t.x)||1,height:Math.abs(e.y-t.y)||1};for(const U of a)u=eC(u,U);u=su(u,iu,iu);const d=[],p=[];for(const U of a)d.push(U.left,so(U)),p.push(U.top,ao(U)),d.push(U.left+U.width/2),p.push(U.top+U.height/2);d.push(t.x,e.x),p.push(t.y,e.y);const h=eg(n),y=eg(s);let _={x:t.x+h.x*l,y:t.y+h.y*l},S={x:e.x+y.x*l,y:e.y+y.y*l};_=D5(_,n,a),S=D5(S,s,a),d.push(_.x,S.x),p.push(_.y,S.y),d.push((t.x+e.x)/2),p.push((t.y+e.y)/2);const x=cC(d,p,u,a),w=lC([_,S,...x]),C=uC(w,a),D=oC(C,_,S);if(D){const U=[t,...D,e];return C5(U)}return null}function M5(t,e,n,s,a,l,u,d){if(t.x===e.x&&t.y===e.y)return[t,e];const p=a?Rm(a):{left:t.x,top:t.y,width:0,height:0},h=l?Rm(l):{left:e.x,top:e.y,width:0,height:0},y=S5,_=Math.max(JE,u??0),S=(d??[]).map(z=>su(Rm(z),y,y)),x=a?w5(p,y,n):su(p,y,y),w=l?w5(h,y,s):su(h,y,y),C=[n],D=[s];let U=!1;if(a){const z=Am(a,e);z!==n&&(C.push(z),U=!0)}if(l){const z=Am(l,t);z!==s&&(D.push(z),U=!0)}const M=a?b5(p,y,C):su(p,y,y),E=l?b5(h,y,D):su(h,y,y),L=[],R=Nm(t,e,n,s,[x,w,...S],_);if(R&&L.push(R),U){const z=Nm(t,e,n,s,[M,E,...S],_);z&&L.push(z)}if(L.length>0)return dC(L);if(S.length>0){const z=Nm(t,e,n,s,[x,w],_);if(z)return z}return C5(fC(t,e,n,s,_))}function D5(t,e,n){let{x:s,y:a}=t;for(let l=0;l<n.length;l++){let u=!0;for(const d of n)if(!(s<=d.left||s>=so(d)||a<=d.top||a>=ao(d)))switch(u=!1,e){case"left":s=d.left-1;break;case"right":s=so(d)+1;break;case"up":a=d.top-1;break;case"down":a=ao(d)+1;break}if(u)break}return{x:s,y:a}}function fC(t,e,n,s,a){const l=Math.max(a,S5),u=eg(n),d=eg(s),p={x:t.x+u.x*l,y:t.y+u.y*l},h={x:e.x+d.x*l,y:e.y+d.y*l};if(tg(n)===tg(s))if(tg(n)){const y=(p.y+h.y)/2;return[t,p,{x:p.x,y},{x:h.x,y},h,e]}else{const y=(p.x+h.x)/2;return[t,p,{x:y,y:p.y},{x:y,y:h.y},h,e]}else return tg(n)?[t,p,{x:p.x,y:h.y},h,e]:[t,p,{x:h.x,y:p.y},h,e]}const hC=new Set(["rectangle","ellipse","diamond","text","image"]),pC=256,au=new Map;function gC(t,e,n,s,a,l,u,d){const p=h=>Math.round(h*2)/2;return[p(t.x),p(t.y),p(e.x),p(e.y),n,s,a?`${p(a.x)},${p(a.y)},${p(a.width)},${p(a.height)}`:"n",l?`${p(l.x)},${p(l.y)},${p(l.width)},${p(l.height)}`:"n",u,d??0].join("|")}function yC(){au.clear()}function jf(t,e,n,s,a,l){const u=new Map(a.map(O=>[O.id,O])),d=O=>!O.isPrecise||O.fixedPoint[0]===.5&&O.fixedPoint[1]===.5;let p;if(n)if(d(n)){const O=u.get(n.elementId);p=O?ng(O,e):Yf(t,e)}else p=Dm(n.fixedPoint);else p=Yf(t,e);let h;if(s)if(d(s)){const O=u.get(s.elementId);h=O?ng(O,t):Yf(e,t)}else h=Dm(s.fixedPoint);else h=Yf(e,t);const y=n?u.get(n.elementId)??null:null,_=s?u.get(s.elementId)??null:null,S=y?Lm(y):null,x=_?Lm(_):null,w=n==null?void 0:n.elementId,C=s==null?void 0:s.elementId,D=[],U=[],M=O=>Math.round(O*2)/2;for(const O of a){if(!hC.has(O.type)||O.id===w||O.id===C||!O.isVisible)continue;const I=Lm(O),F=Math.min(t.x,e.x)-iu*3,V=Math.max(t.x,e.x)+iu*3,W=Math.min(t.y,e.y)-iu*3,j=Math.max(t.y,e.y)+iu*3;I.x+I.width<F||I.x>V||I.y+I.height<W||I.y>j||(D.push(I),U.push(`${O.id}:${M(I.x)},${M(I.y)},${M(I.width)},${M(I.height)}`))}U.sort();const E=U.join(";"),L=gC(t,e,p,h,S,x,E,l),R=au.get(L);if(R)return R;const z=M5(t,e,p,h,S,x,l,D),ee=[];for(const O of z)ee.push(O.x-t.x,O.y-t.y);if(au.size>=pC){const O=au.keys().next().value;O!==void 0&&au.delete(O)}return au.set(L,ee),ee}function Wf(t){if(t.length<=4)return t;const e=[t[0],t[1]];for(let n=2;n<t.length-2;n+=2){const s=e[e.length-2],a=e[e.length-1],l=t[n],u=t[n+1],d=t[n+2],p=t[n+3];a===u&&u===p||s===l&&l===d||s===l&&a===u||e.push(l,u)}return e.push(t[t.length-2],t[t.length-1]),e}const mC=new Set(["rectangle","ellipse","diamond","text","image"]);function Pm(t){return mC.has(t.type)}function A5(t){return t*Math.PI/180}function R5(t,e,n){if(n===0)return{x:t,y:e};const s=Math.cos(n),a=Math.sin(n);return{x:t*s-e*a,y:t*a+e*s}}function Xf(t,e){const n=t.x+t.width/2,s=t.y+t.height/2,a=e.x-n,l=e.y-s,u=A5(t.rotation||0);return u===0?{x:a,y:l}:R5(a,l,-u)}function rg(t,e){const n=t.x+t.width/2,s=t.y+t.height/2,a=A5(t.rotation||0),l=R5(e.x,e.y,a);return{x:n+l.x,y:s+l.y}}function L5(t){const{x:e,y:n,width:s,height:a}=t,l=e+s/2,u=n+a/2;return{top:{x:l,y:n},bottom:{x:l,y:n+a},left:{x:e,y:u},right:{x:e+s,y:u},center:{x:l,y:u}}}function vC(t,e){return L5(t)[e]}const N5=4;function el(t){return N5+t/2}function P5(t,e){const n=t.width||1,s=t.height||1,a=Xf(t,e),l=Math.max(0,Math.min(1,(a.x+n/2)/n)),u=Math.max(0,Math.min(1,(a.y+s/2)/s));return[l,u]}function tl(t,e,n=0){const s=(e[0]-.5)*t.width,a=(e[1]-.5)*t.height;if(s===0&&a===0)return rg(t,{x:0,y:0});const l=rg(t,{x:s,y:a});return nl(t,l,n)}function nl(t,e,n=0){const s=Xf(t,e),a=s.x,l=s.y;if(a===0&&l===0)return rg(t,{x:0,y:-(t.height/2+n)});let u;switch(t.type){case"ellipse":{const d=t.width/2,p=t.height/2,h=Math.atan2(l,a);u={x:(d+n)*Math.cos(h),y:(p+n)*Math.sin(h)};break}case"diamond":{const d=t.width/2,p=t.height/2,h=Math.atan2(l,a),y=Math.cos(h),_=Math.sin(h),S=Math.abs(y),x=Math.abs(_),w=1/(S/d+x/p),C=w*y,D=w*_;if(n===0)u={x:C,y:D};else{const U=(y>=0?1:-1)/d,M=(_>=0?1:-1)/p,E=Math.sqrt(U*U+M*M);u={x:C+U/E*n,y:D+M/E*n}}break}default:{const d=t.width/2,p=t.height/2,h=Math.atan2(l,a),y=Math.abs(Math.tan(h));let _,S;y<=p/d?(_=a>0?d:-d,S=_*Math.tan(h)):(S=l>0?p:-p,_=S/Math.tan(h)),n===0?u={x:_,y:S}:y<=p/d?u={x:_+(a>0?n:-n),y:S}:u={x:_,y:S+(l>0?n:-n)};break}}return rg(t,u)}const SC=24,_C=20,O5=6;function xC(t,e){const n=Xf(t,e),s=t.width/2||1,a=t.height/2||1;switch(t.type){case"ellipse":{const l=n.x/s,u=n.y/a;if(Math.sqrt(l*l+u*u)>=1)return 0;const p=Math.atan2(n.y,n.x),h=s*Math.cos(p),y=a*Math.sin(p);return Math.hypot(h-n.x,y-n.y)}case"diamond":{if(Math.abs(n.x)/s+Math.abs(n.y)/a>=1)return 0;const u=Math.atan2(n.y,n.x),d=Math.abs(Math.cos(u)),p=Math.abs(Math.sin(u)),h=1/(d/s+p/a),y=h*Math.cos(u),_=h*Math.sin(u);return Math.hypot(y-n.x,_-n.y)}default:{const l=s+n.x,u=s-n.x,d=a+n.y,p=a-n.y,h=Math.min(l,u,d,p);return h>0?h:0}}}function wC(t,e){const n=Xf(e,t),s=e.width/2,a=e.height/2;switch(e.type){case"ellipse":{const l=n.x/s,u=n.y/a;if(Math.sqrt(l*l+u*u)<=1)return 0;const p=Math.atan2(n.y,n.x),h=s*Math.cos(p),y=a*Math.sin(p);return Math.hypot(n.x-h,n.y-y)}case"diamond":{if(Math.abs(n.x)/s+Math.abs(n.y)/a<=1)return 0;const u=Math.atan2(n.y,n.x),d=Math.abs(Math.cos(u)),p=Math.abs(Math.sin(u)),h=1/(d/s+p/a),y=h*Math.cos(u),_=h*Math.sin(u);return Math.hypot(n.x-y,n.y-_)}default:{const l=Math.max(-s-n.x,0,n.x-s),u=Math.max(-a-n.y,0,n.y-a);return Math.hypot(l,u)}}}function Kl(t,e,n=SC,s=new Set,a,l,u=N5,d){let p=null,h=1/0;for(const y of e){if(!Pm(y)||s.has(y.id))continue;const _=wC(t,y);if(_>n)continue;const S=_===0,x=y.x+y.width/2,w=y.y+y.height/2,C=Math.hypot(x-t.x,w-t.y),D=S?-1e6+C:_*1e3+C;if(D<h){h=D;let U;if(l!==void 0)U=l;else if(_===0){const R=Math.min(y.width,y.height)/2,z=Math.min(_C,R*.6),ee=xC(y,t);d===!0?U=ee<=z+O5:d===!1?U=ee<=Math.max(0,z-O5):U=ee<=z}else U=!0;let M,E;if(U)M=P5(y,t),E=tl(y,M,u);else{M=[.5,.5];const L=Xf(y,t);Math.abs(L.x)+Math.abs(L.y)<2?E=a?nl(y,a,u):nl(y,{x:x+y.width,y:w},u):E=nl(y,t,u)}p={elementId:y.id,fixedPoint:M,position:E,isPrecise:U}}}return p}function Ql(t,e){const{startBinding:n,endBinding:s}=t;if(!n&&!s)return null;const a=new Map(e.map(M=>[M.id,M])),l=t.points,u=l.length/2;let d={x:t.x+l[0],y:t.y+l[1]},p={x:t.x+l[l.length-2],y:t.y+l[l.length-1]};const h=n?a.get(n.elementId):void 0,y=s?a.get(s.elementId):void 0,_=(M,E)=>M.isPrecise?tl(E,M.fixedPoint,0):{x:E.x+E.width/2,y:E.y+E.height/2},S=t.lineType==="elbow",x=(M,E,L)=>{const R=ng(M,E),z=M.x+M.width/2,ee=M.y+M.height/2,O=Math.max(M.width,M.height)*10;let I;switch(R){case"up":I={x:z,y:ee-O};break;case"down":I={x:z,y:ee+O};break;case"left":I={x:z-O,y:ee};break;case"right":I={x:z+O,y:ee};break}return nl(M,I,L)},w=S?(M,E,L)=>x(M,E,L):nl;if(n&&h&&s&&y){if(n.isPrecise)d=tl(h,n.fixedPoint,n.gap);else{const M=_(s,y);d=w(h,M,n.gap)}if(s.isPrecise)p=tl(y,s.fixedPoint,s.gap);else{const M=_(n,h);p=w(y,M,s.gap)}n.isPrecise||(d=w(h,p,n.gap)),s.isPrecise||(p=w(y,d,s.gap))}else n&&h&&(n.isPrecise?d=tl(h,n.fixedPoint,n.gap):d=w(h,p,n.gap)),s&&y&&(s.isPrecise?p=tl(y,s.fixedPoint,s.gap):p=w(y,d,s.gap));const C=[0,0];for(let M=1;M<u-1;M++){const E=t.x+l[M*2],L=t.y+l[M*2+1];C.push(E-d.x,L-d.y)}C.push(p.x-d.x,p.y-d.y);const D=p.x-d.x,U=p.y-d.y;return{x:d.x,y:d.y,points:C,width:Math.abs(D),height:Math.abs(U)}}function qf(t,e){return e.filter(n=>{var a,l;if(n.type!=="line"&&n.type!=="arrow")return!1;const s=n;return((a=s.startBinding)==null?void 0:a.elementId)===t||((l=s.endBinding)==null?void 0:l.elementId)===t})}function bC(t,e){return e.map(n=>{let s=!1;if(n.boundElements&&n.boundElements.length>0){const d=n.boundElements.filter(p=>!t.has(p.id));d.length!==n.boundElements.length&&(n={...n,boundElements:d.length>0?d:null},s=!0)}if(n.type!=="line"&&n.type!=="arrow")return n;const a=n;let l=a.startBinding,u=a.endBinding;return l&&t.has(l.elementId)&&(l=null,s=!0),u&&t.has(u.elementId)&&(u=null,s=!0),s?{...n,startBinding:l,endBinding:u}:n})}function I5(t,e){const n=t.boundElements??[];return n.some(s=>s.id===e.id)?t:{...t,boundElements:[...n,e]}}function F5(t,e){const n=t.boundElements;if(!n||n.length===0)return t;const s=n.filter(a=>a.id!==e);return{...t,boundElements:s.length>0?s:null}}function Jl(t,e,n,s,a,l){if(n&&n.elementId!==(s==null?void 0:s.elementId)){const u=a.find(d=>d.id===n.elementId);if(u){const d=F5(u,t);d!==u&&l(u.id,{boundElements:d.boundElements})}}if(s&&s.elementId!==(n==null?void 0:n.elementId)){const u=a.find(d=>d.id===s.elementId);if(u){const d=I5(u,{id:t,type:e});d!==u&&l(u.id,{boundElements:d.boundElements})}}}const EC="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let CC=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=EC[n[t]&63];return e};function _s(){return CC(12)}function TC(t){const e={...t};return e.style&&(e.style={...e.style}),e.boundElements&&(e.boundElements=e.boundElements.map(n=>({...n}))),e.startBinding&&(e.startBinding={...e.startBinding}),e.endBinding&&(e.endBinding={...e.endBinding}),e.groupIds&&(e.groupIds=[...e.groupIds]),Array.isArray(e.points)&&(e.points=e.points.map(n=>({...n}))),e.crop&&(e.crop={...e.crop}),e}function ig(t,e,n=20){const s=new Set(t.map(y=>y.id)),a=new Set;for(const y of t)if(y.boundElements)for(const _ of y.boundElements)_.type==="text"&&!s.has(_.id)&&a.add(_.id);const l=[...t,...e.filter(y=>a.has(y.id))],u=new Map;for(const y of l)u.set(y.id,_s());const d=new Map;for(const y of l)if(y.groupIds)for(const _ of y.groupIds)d.has(_)||d.set(_,_s());const p=l.map(y=>{const _=u.get(y.id),S=TC(y);return S.id=_,S.x=y.x+n,S.y=y.y+n,S.containerId&&u.has(S.containerId)?S.containerId=u.get(S.containerId):S.containerId&&(S.containerId=null),S.boundElements&&(S.boundElements=S.boundElements.map(x=>u.has(x.id)?{...x,id:u.get(x.id)}:null).filter(Boolean),S.boundElements.length===0&&(S.boundElements=null)),S.startBinding&&u.has(S.startBinding.elementId)?S.startBinding={...S.startBinding,elementId:u.get(S.startBinding.elementId)}:S.startBinding&&(S.startBinding=null),S.endBinding&&u.has(S.endBinding.elementId)?S.endBinding={...S.endBinding,elementId:u.get(S.endBinding.elementId)}:S.endBinding&&(S.endBinding=null),S.groupIds&&S.groupIds.length>0&&(S.groupIds=S.groupIds.map(x=>d.get(x)??x)),S}),h=p.filter(y=>{var S;const _=(S=[...u.entries()].find(([,x])=>x===y.id))==null?void 0:S[0];return _?s.has(_):!1}).map(y=>y.id);return{clones:p,idMap:u,selectedCloneIds:h}}function U5(t,e){const n=new Set(t),s=new Set;for(const a of e)if(n.has(a.id)&&a.groupIds)for(const l of a.groupIds)s.add(l);if(s.size>0){for(const a of e)if(!n.has(a.id)&&a.groupIds){for(const l of a.groupIds)if(s.has(l)){n.add(a.id);break}}}for(const a of e)if(n.has(a.id)&&a.boundElements)for(const l of a.boundElements)l.type==="text"&&!n.has(l.id)&&n.add(l.id);return e.filter(a=>n.has(a.id))}function B5(t,e,n,s=200){const{x:a,y:l,scale:u}=t,d=-a/u-s,p=-l/u-s,h=(-a+e)/u+s,y=(-l+n)/u+s;return{minX:d,minY:p,maxX:h,maxY:y}}function Kf(t){if((t.type==="line"||t.type==="arrow")&&"points"in t){const e=t.points;let n=0,s=0,a=0,l=0;for(let u=0;u<e.length;u+=2){const d=e[u],p=e[u+1];d<n&&(n=d),d>s&&(s=d),p<a&&(a=p),p>l&&(l=p)}return{minX:t.x+n,minY:t.y+a,maxX:t.x+s,maxY:t.y+l}}return t.type==="freedraw"&&"points"in t?{minX:t.x,minY:t.y,maxX:t.x+t.width,maxY:t.y+t.height}:{minX:t.x,minY:t.y,maxX:t.x+t.width,maxY:t.y+t.height}}function z5(t,e){return t.minX<=e.maxX&&t.maxX>=e.minX&&t.minY<=e.maxY&&t.maxY>=e.minY}function H5(t,e,n,s,a,l){if(t.length<=100)return t;const u=B5(e,n,s,l);return t.filter(d=>{if(a.has(d.id))return!0;const p=Kf(d);return z5(u,p)})}function kC(t){const e=new Map;for(const n of t)e.set(n.id,n);return e}function MC(t){if(typeof structuredClone=="function"){const e=new Map,n=new Array(t.length);for(let s=0;s<t.length;s++){const a=t[s];if(a.type==="image"&&"src"in a){const l=a;e.has(l.id)||e.set(l.id,l.src);const{src:u,...d}=l,p=structuredClone(d);p.src=e.get(l.id),n[s]=p}else n[s]=structuredClone(a)}return n}return JSON.parse(JSON.stringify(t))}function G5(t){let e=null,n=null;const s=(...a)=>{n=a,e===null&&(e=requestAnimationFrame(()=>{e=null,n&&(t(...n),n=null)}))};return s.cancel=()=>{e!==null&&(cancelAnimationFrame(e),e=null),n=null},s}function DC(t,e){if(e.length===0)return t;const n=new Map;for(const s of e){const a=n.get(s.id);n.set(s.id,a?{...a,...s.changes}:s.changes)}return t.map(s=>{const a=n.get(s.id);return a?{...s,...a}:s})}function V5(t){return new Set(t)}const Qf=[.1,.25,.5,.75,1,1.5,2,3,4,5],Y5=280;function sg({viewport:t,point:e,targetScale:n}){const s=Math.min(nu,Math.max(tu,n)),a=(e.x-t.x)/t.scale,l=(e.y-t.y)/t.scale;return{scale:s,x:e.x-a*s,y:e.y-l*s}}function j5(t){for(const e of Qf)if(e>t+.01)return e;return nu}function W5(t){for(let e=Qf.length-1;e>=0;e--)if(Qf[e]<t-.01)return Qf[e];return tu}function Om(t){if(t.length===0)return null;let e=1/0,n=1/0,s=-1/0,a=-1/0;for(const l of t){const u=Kf(l);u.minX<e&&(e=u.minX),u.minY<n&&(n=u.minY),u.maxX>s&&(s=u.maxX),u.maxY>a&&(a=u.maxY)}return{minX:e,minY:n,maxX:s,maxY:a}}function Im(t,e,n,s={}){const a=s.padding??50,l=s.maxZoom??2,u=t.maxX-t.minX,d=t.maxY-t.minY;if(u===0&&d===0)return{scale:1,x:e/2-t.minX,y:n/2-t.minY};const p=(e-a*2)/(u||1),h=(n-a*2)/(d||1),y=Math.min(Math.min(p,h),l),_=Math.min(nu,Math.max(tu,y)),S=(t.minX+t.maxX)/2,x=(t.minY+t.maxY)/2;return{scale:_,x:e/2-S*_,y:n/2-x*_}}function AC(t){return 1-Math.pow(1-t,3)}let xs=null;function Zl(t,e,n,s=Y5){xs!==null&&(cancelAnimationFrame(xs),xs=null);const a=performance.now(),l=u=>{const d=u-a,p=Math.min(d/s,1),h=AC(p),y={x:t.x+(e.x-t.x)*h,y:t.y+(e.y-t.y)*h,scale:t.scale+(e.scale-t.scale)*h};n(y),p<1?xs=requestAnimationFrame(l):(xs=null,n(e))};return xs=requestAnimationFrame(l),()=>{xs!==null&&(cancelAnimationFrame(xs),xs=null)}}function $l(){xs!==null&&(cancelAnimationFrame(xs),xs=null)}const RC=100;function rl(t){if(t.type==="image"&&"src"in t){const{src:e,...n}=t,s=structuredClone(n);return s.src=e,s}return structuredClone(t)}const De=p5((t,e)=>({elements:[],selectedIds:[],activeTool:"select",currentStyle:{...$p},currentLineType:"sharp",currentStartArrowhead:null,currentEndArrowhead:"arrow",viewport:{x:0,y:0,scale:1},isDrawing:!1,drawStart:null,history:[],historyIndex:-1,_historyBaseline:new Map,_historyPaused:!1,showGrid:!1,addElement:n=>{t(s=>({elements:[...s.elements,n]})),e().pushHistory()},updateElement:(n,s)=>{t(a=>{const l=a.elements,u=l.findIndex(h=>h.id===n);if(u===-1)return a;const d={...l[u],...s};if(d===l[u])return a;const p=l.slice();return p[u]=d,{elements:p}})},batchUpdateElements:n=>{if(n.length!==0){if(n.length===1){e().updateElement(n[0].id,n[0].updates);return}t(s=>{const a=s.elements,l=new Map;for(let d=0;d<a.length;d++)l.set(a[d].id,d);let u=null;for(const{id:d,updates:p}of n){const h=l.get(d);if(h===void 0)continue;const y=u?u[h]:a[h],_={...y,...p};_!==y&&(u||(u=a.slice()),u[h]=_)}return u?{elements:u}:s})}},deleteElements:n=>{const s=new Set(n),{elements:a}=e();for(const l of a)if(s.has(l.id)&&l.boundElements)for(const u of l.boundElements)u.type==="text"&&s.add(u.id);for(const l of a)l.type==="text"&&"containerId"in l&&l.containerId&&s.has(l.containerId)&&s.add(l.id);t(l=>{const u=l.elements.filter(p=>!s.has(p.id));return{elements:bC(s,u),selectedIds:l.selectedIds.filter(p=>!s.has(p))}}),e().pushHistory()},setElements:n=>{const s=new Map;for(const a of n)s.set(a.id,a);t({elements:n,_historyBaseline:s})},duplicateElements:n=>{const{elements:s}=e(),a=s.filter(d=>n.includes(d.id)),{clones:l,selectedCloneIds:u}=ig(a,s);t(d=>({elements:[...d.elements,...l],selectedIds:u.length>0?u:l.map(p=>p.id)})),e().pushHistory()},convertElementType:(n,s)=>{const a=new Set(["rectangle","ellipse","diamond"]);a.has(s)&&(t(l=>({elements:l.elements.map(u=>{if(!n.includes(u.id)||!a.has(u.type)||u.type===s)return u;const d={...u,type:s};return s==="rectangle"?{...d,cornerRadius:0}:d})})),e().pushHistory())},bringToFront:n=>{t(s=>{const a=s.elements.filter(u=>!n.includes(u.id)),l=s.elements.filter(u=>n.includes(u.id));return{elements:[...a,...l]}}),e().pushHistory()},sendToBack:n=>{t(s=>{const a=s.elements.filter(u=>!n.includes(u.id));return{elements:[...s.elements.filter(u=>n.includes(u.id)),...a]}}),e().pushHistory()},bringForward:n=>{t(s=>{const a=[...s.elements],l=new Set(n);for(let u=a.length-2;u>=0;u--)l.has(a[u].id)&&!l.has(a[u+1].id)&&([a[u],a[u+1]]=[a[u+1],a[u]]);return{elements:a}}),e().pushHistory()},sendBackward:n=>{t(s=>{const a=[...s.elements],l=new Set(n);for(let u=1;u<a.length;u++)l.has(a[u].id)&&!l.has(a[u-1].id)&&([a[u],a[u-1]]=[a[u-1],a[u]]);return{elements:a}}),e().pushHistory()},toggleLockElements:n=>{t(s=>({elements:s.elements.map(a=>n.includes(a.id)?{...a,isLocked:!a.isLocked}:a)})),e().pushHistory()},groupElements:n=>{if(n.length<2)return;const s=_s(),a=new Set(n),{elements:l}=e();for(const u of l)if(a.has(u.id)&&u.boundElements)for(const d of u.boundElements)d.type==="text"&&a.add(d.id);t(u=>({elements:u.elements.map(d=>a.has(d.id)?{...d,groupIds:[...d.groupIds??[],s]}:d)})),e().pushHistory()},ungroupElements:n=>{var u;const{elements:s}=e(),a=s.filter(d=>n.includes(d.id)),l=new Set;for(const d of a)(u=d.groupIds)!=null&&u.length&&l.add(d.groupIds[d.groupIds.length-1]);l.size!==0&&(t(d=>({elements:d.elements.map(p=>{var y;if(!((y=p.groupIds)!=null&&y.length))return p;const h=p.groupIds.filter(_=>!l.has(_));return{...p,groupIds:h.length>0?h:void 0}})})),e().pushHistory())},setSelectedIds:n=>t({selectedIds:n}),clearSelection:()=>t({selectedIds:[]}),setActiveTool:n=>t(s=>({activeTool:n,selectedIds:n==="select"?s.selectedIds:[]})),setCurrentStyle:n=>t(s=>({currentStyle:{...s.currentStyle,...n}})),setCurrentLineType:n=>t({currentLineType:n}),setCurrentStartArrowhead:n=>t({currentStartArrowhead:n}),setCurrentEndArrowhead:n=>t({currentEndArrowhead:n}),setViewport:n=>{$l(),t(s=>({viewport:{...s.viewport,...n}}))},zoomIn:(n,s)=>{const{viewport:a}=e(),l=j5(a.scale),d=sg({viewport:a,point:n??{x:400,y:300},targetScale:l});s!=null&&s.animate?Zl(a,d,p=>t(h=>({viewport:{...h.viewport,...p}}))):($l(),t({viewport:d}))},zoomOut:(n,s)=>{const{viewport:a}=e(),l=W5(a.scale),d=sg({viewport:a,point:n??{x:400,y:300},targetScale:l});s!=null&&s.animate?Zl(a,d,p=>t(h=>({viewport:{...h.viewport,...p}}))):($l(),t({viewport:d}))},resetZoom:n=>{const{viewport:s}=e(),a={x:0,y:0,scale:1};n!=null&&n.animate?Zl(s,a,l=>t(u=>({viewport:{...u.viewport,...l}}))):($l(),t({viewport:a}))},zoomToFit:(n,s,a,l)=>{const{elements:u,viewport:d}=e(),p=a?u.filter(_=>a.includes(_.id)):u,h=Om(p);if(!h)return;const y=Im(h,n,s,{padding:l==null?void 0:l.padding,maxZoom:l==null?void 0:l.maxZoom});l!=null&&l.animate?Zl(d,y,_=>t(S=>({viewport:{...S.viewport,..._}}))):($l(),t({viewport:y}))},zoomToSelection:(n,s,a)=>{const{elements:l,selectedIds:u,viewport:d}=e();if(u.length===0)return;const p=l.filter(_=>u.includes(_.id)),h=Om(p);if(!h)return;const y=Im(h,n,s,{padding:(a==null?void 0:a.padding)??80,maxZoom:(a==null?void 0:a.maxZoom)??2});a!=null&&a.animate?Zl(d,y,_=>t(S=>({viewport:{...S.viewport,..._}}))):($l(),t({viewport:y}))},setIsDrawing:n=>t({isDrawing:n}),setDrawStart:n=>t({drawStart:n}),pushHistory:n=>{const{elements:s,_historyBaseline:a,_historyPaused:l}=e();if(l)return;const u=[],d=new Map;for(const p of s)d.set(p.id,p);for(const p of s){const h=a.get(p.id);h?h!==p&&u.push({type:"modify",elementId:p.id,before:rl(h),after:rl(p)}):u.push({type:"add",elementId:p.id,after:rl(p)})}for(const[p,h]of a)d.has(p)||u.push({type:"delete",elementId:p,before:rl(h)});u.length!==0&&t(p=>{const h=p.history.slice(0,p.historyIndex+1);return h.push({diffs:u,mark:n,timestamp:Date.now()}),h.length>RC&&h.shift(),{history:h,historyIndex:h.length-1,_historyBaseline:new Map(d)}})},undo:()=>{const{historyIndex:n,history:s}=e();if(n<0)return;const a=s[n];t(l=>{let u=[...l.elements];for(let p=a.diffs.length-1;p>=0;p--){const h=a.diffs[p];switch(h.type){case"add":u=u.filter(y=>y.id!==h.elementId);break;case"modify":u=u.map(y=>y.id===h.elementId?rl(h.before):y);break;case"delete":u.push(rl(h.before));break}}const d=new Map;for(const p of u)d.set(p.id,p);return{historyIndex:n-1,elements:u,selectedIds:[],_historyBaseline:d}})},redo:()=>{const{historyIndex:n,history:s}=e();if(n>=s.length-1)return;const a=n+1,l=s[a];t(u=>{let d=[...u.elements];for(const h of l.diffs)switch(h.type){case"add":d.push(rl(h.after));break;case"modify":d=d.map(y=>y.id===h.elementId?rl(h.after):y);break;case"delete":d=d.filter(y=>y.id!==h.elementId);break}const p=new Map;for(const h of d)p.set(h.id,h);return{historyIndex:a,elements:d,selectedIds:[],_historyBaseline:p}})},squashHistory:(n=2)=>{t(s=>{if(s.history.length<n)return s;const a=Math.max(0,s.history.length-n),l=s.history.slice(a),u=new Map;for(const h of l)for(const y of h.diffs){const _=u.get(y.elementId);_?y.type==="delete"?_.type==="add"?u.delete(y.elementId):u.set(y.elementId,{type:"delete",elementId:y.elementId,before:_.before}):y.type==="modify"&&u.set(y.elementId,{type:_.type==="add"?"add":"modify",elementId:y.elementId,before:_.before,after:y.after}):u.set(y.elementId,{...y})}const d={diffs:Array.from(u.values()),mark:l[l.length-1].mark,timestamp:Date.now()},p=[...s.history.slice(0,a),d];return{history:p,historyIndex:p.length-1}})},pauseHistory:()=>t({_historyPaused:!0}),resumeHistory:()=>t({_historyPaused:!1}),canUndo:()=>e().historyIndex>=0,canRedo:()=>{const{historyIndex:n,history:s}=e();return n<s.length-1},toggleGrid:()=>t(n=>({showGrid:!n.showGrid}))})),Fm={elementId:null,isEditing:!1,selectedPointIndices:[],hoveredPointIndex:-1,hoveredMidpointIndex:null,isDraggingPoint:!1},Jf=p5(t=>({...Fm,enterEditMode:e=>t({elementId:e,isEditing:!0,selectedPointIndices:[],hoveredPointIndex:-1,hoveredMidpointIndex:null,isDraggingPoint:!1}),exitEditMode:()=>t({...Fm}),setSelectedPoints:e=>t({selectedPointIndices:e}),togglePointSelection:e=>t(n=>({selectedPointIndices:n.selectedPointIndices.includes(e)?n.selectedPointIndices.filter(a=>a!==e):[...n.selectedPointIndices,e]})),setHoveredPoint:e=>t({hoveredPointIndex:e}),setHoveredMidpoint:e=>t({hoveredMidpointIndex:e}),setIsDraggingPoint:e=>t({isDraggingPoint:e}),reset:()=>t({...Fm})}));function rn(t,e){return Math.round(t/e)*e}function LC(t,e){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Um(t,e){return{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}}function X5(t,e,n){const s=Math.cos(n),a=Math.sin(n),l=t.x-e.x,u=t.y-e.y;return{x:e.x+l*s-u*a,y:e.y+l*a+u*s}}function NC(t,e){return t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height}function Zf(t,e){return[t/2,0,t,e/2,t/2,e,0,e/2]}function PC(t,e){const n=e.x-t.x,s=e.y-t.y,a=Math.max(Math.abs(n),Math.abs(s)),l=n>=0?1:-1,u=s>=0?1:-1,d=l>=0?t.x:t.x-a,p=u>=0?t.y:t.y-a;return{x:d,y:p,width:a,height:a}}const q5=[0,45,90,135,180,225,270,315,360],OC=Math.PI/180;function IC(t,e){const n=e.x-t.x,s=e.y-t.y,a=Math.sqrt(n*n+s*s);if(a===0)return{...e};let l=Math.atan2(s,n)*180/Math.PI;l<0&&(l+=360);let u=q5[0],d=999;for(const h of q5){const y=Math.abs(l-h);y<d&&(d=y,u=h)}u===360&&(u=0);const p=u*OC;return{x:t.x+a*Math.cos(p),y:t.y+a*Math.sin(p)}}function ag(t){let e=0,n=0,s=0,a=0;for(let l=0;l<t.length;l+=2)e=Math.min(e,t[l]),n=Math.max(n,t[l]),s=Math.min(s,t[l+1]),a=Math.max(a,t[l+1]);return{width:n-e,height:a-s}}function Jr(t,e){switch(t){case"dashed":return[e*4,e*4];case"dotted":return[e,e*2];case"solid":default:return[]}}const ma=.2;function va(t,e,n=ma){const s=(t.x+e.x)/2,a=(t.y+e.y)/2,l=e.x-t.x,u=e.y-t.y,d=Math.sqrt(l*l+u*u);if(d===0)return{x:s,y:a};const p=-u/d,h=l/d,y=d*n;return{x:s+p*y,y:a+h*y}}function ou(t,e,n,s){const a=1-s;return{x:a*a*t.x+2*a*s*e.x+s*s*n.x,y:a*a*t.y+2*a*s*e.y+s*s*n.y}}function Bm(t,e,n,s){const a=1-s;return{x:2*a*(e.x-t.x)+2*s*(n.x-e.x),y:2*a*(e.y-t.y)+2*s*(n.y-e.y)}}function zm(t,e,n,s){if(s){const a=Bm(t,e,n,1),l=Math.sqrt(a.x*a.x+a.y*a.y)||1;return{x:n.x-a.x/l*20,y:n.y-a.y/l*20}}else{const a=Bm(t,e,n,0),l=Math.sqrt(a.x*a.x+a.y*a.y)||1;return{x:t.x+a.x/l*20,y:t.y+a.y/l*20}}}function K5(t,e,n){const s=e.x-t.x,a=e.y-t.y,l=Math.sqrt(s*s+a*a);if(l===0)return ma;const u=-a/l,d=s/l,p=(t.x+e.x)/2,h=(t.y+e.y)/2,y=n.x-p,_=n.y-h;return 2*(y*u+_*d)/l}const FC={name:"select",onMouseDown(t,e,n){t.target===t.target.getStage()&&(n.linearEdit.isEditing&&n.linearEdit.exitEditMode(),n.clearSelection(),n.setIsDrawing(!0),n.setDrawStart(e),n.setSelectionBox({x:e.x,y:e.y,width:0,height:0}))},onMouseMove(t,e,n){!n.isDrawing||!n.drawStart||n.setSelectionBox(Um(n.drawStart,e))},onMouseUp(t){if(!t.isDrawing)return;const e=t.selectionBox;if(e&&(e.width>2||e.height>2)){const n=t.elements.filter(l=>{let u=l.x,d=l.y,p=l.width,h=l.height;if((l.type==="arrow"||l.type==="line")&&"points"in l){const w=l.points,C=[],D=[];for(let U=0;U<w.length;U+=2)C.push(l.x+w[U]),D.push(l.y+w[U+1]);u=Math.min(...C),d=Math.min(...D),p=Math.max(...C)-u,h=Math.max(...D)-d}const y=u+p,_=d+h,S=e.x+e.width,x=e.y+e.height;return u<S&&y>e.x&&d<x&&_>e.y}).map(l=>l.id),s=new Set(n),a=new Set;for(const l of n){const u=t.elements.find(d=>d.id===l);if(u!=null&&u.groupIds)for(const d of u.groupIds)a.add(d)}if(a.size>0){for(const l of t.elements)if(!s.has(l.id)&&l.groupIds){for(const u of l.groupIds)if(a.has(u)){s.add(l.id);break}}}t.setSelectedIds([...s])}t.setSelectionBox(null),t.setIsDrawing(!1),t.setDrawStart(null)}};let Hm=!1;const UC={name:"eraser",onMouseDown(t,e,n){var a;Hm=!0;const s=t.target.id();s&&(n.deleteElements([s]),(a=n.onElementDelete)==null||a.call(n,[s]))},onMouseMove(t,e,n){var l,u;if(!Hm)return;const s=t.target,a=(l=s.id)==null?void 0:l.call(s);a&&s!==s.getStage()&&(n.deleteElements([a]),(u=n.onElementDelete)==null||u.call(n,[a]))},onMouseUp(t){Hm=!1},getCursor(){return"not-allowed"}},Gm={name:"rectangle",onMouseDown(t,e,n){var d;n.setIsDrawing(!0);const s=n.snapPos(e);n.setDrawStart(s),n.clearSelection();const a=_s();n.currentElementIdRef.current=a;const l={id:a,type:n.activeTool,x:s.x,y:s.y,width:0,height:0,rotation:0,style:{...n.currentStyle},isLocked:!1,isVisible:!0,boundElements:null},u=n.activeTool==="rectangle"?{...l,type:"rectangle",cornerRadius:0}:l;n.addElement(u),(d=n.onElementCreate)==null||d.call(n,u)},onMouseMove(t,e,n){if(!n.isDrawing||!n.drawStart||!n.currentElementIdRef.current)return;const s=n.snapPos(e),a=n.shiftKeyRef.current?PC(n.drawStart,s):Um(n.drawStart,s);n.updateElement(n.currentElementIdRef.current,a)},onMouseUp(t){t.currentElementIdRef.current&&(t.setSelectedIds([t.currentElementIdRef.current]),t.pushHistory()),t.setIsDrawing(!1),t.setDrawStart(null),t.currentElementIdRef.current=null,t.setActiveTool("select")},getCursor(){return"crosshair"}},BC={name:"freedraw",onMouseDown(t,e,n){var l;n.setIsDrawing(!0),n.setDrawStart(e),n.clearSelection();const s=_s();n.currentElementIdRef.current=s;const a={id:s,type:"freedraw",x:0,y:0,width:0,height:0,rotation:0,style:{...n.currentStyle},isLocked:!1,isVisible:!0,boundElements:null,points:[e.x,e.y]};n.addElement(a),(l=n.onElementCreate)==null||l.call(n,a)},onMouseMove(t,e,n){if(!n.isDrawing||!n.currentElementIdRef.current)return;const s=n.elements.find(a=>a.id===n.currentElementIdRef.current);s&&n.updateElement(s.id,{points:[...s.points,e.x,e.y]})},onMouseUp(t){if(t.currentElementIdRef.current){const e=t.elements.find(n=>n.id===t.currentElementIdRef.current);if(e&&e.points.length>=4){let n=1/0,s=1/0,a=-1/0,l=-1/0;for(let u=0;u<e.points.length;u+=2)n=Math.min(n,e.points[u]),s=Math.min(s,e.points[u+1]),a=Math.max(a,e.points[u]),l=Math.max(l,e.points[u+1]);t.updateElement(e.id,{x:n,y:s,width:a-n,height:l-s,points:e.points.map((u,d)=>d%2===0?u-n:u-s)})}t.setSelectedIds([t.currentElementIdRef.current]),t.pushHistory()}t.setIsDrawing(!1),t.setDrawStart(null),t.currentElementIdRef.current=null},getCursor(){return"crosshair"}},zC={name:"text",onMouseDown(t,e,n){var u;n.setIsDrawing(!0);const s=n.snapPos(e);n.setDrawStart(s),n.clearSelection();const a=_s(),l={id:a,type:"text",x:s.x,y:s.y,width:10,height:30,rotation:0,style:{...n.currentStyle},isLocked:!1,isVisible:!0,boundElements:null,text:"",containerId:null,textAlign:"left",verticalAlign:"top"};n.addElement(l),(u=n.onElementCreate)==null||u.call(n,l),n.setSelectedIds([a]),n.setActiveTool("select"),n.setIsDrawing(!1),n.setAutoEditTextId(a)},onMouseMove(){},onMouseUp(){},getCursor(){return"text"}},HC=800,GC=600;function og(t){return new Promise((e,n)=>{const s=new FileReader;s.onload=()=>e(s.result),s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(t)})}function $f(t){return new Promise((e,n)=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>e(s),s.onerror=()=>n(new Error("Failed to load image")),s.src=t})}function Q5(t,e,n=HC,s=GC){if(t<=n&&e<=s)return{width:t,height:e};const a=t/e,l=n/s;return a>l?{width:n,height:n/a}:{width:s*a,height:s}}function lg(t,e,n,s,a,l={...$p}){const u=Q5(e,n);return{id:_s(),type:"image",x:s-u.width/2,y:a-u.height/2,width:u.width,height:u.height,rotation:0,style:{...l,fillColor:"transparent"},isLocked:!1,isVisible:!0,boundElements:null,src:t,naturalWidth:e,naturalHeight:n,scaleMode:"stretch",crop:null,cornerRadius:0,alt:""}}function Vm(t){const e=[];if(t.files)for(let n=0;n<t.files.length;n++){const s=t.files[n];s.type.startsWith("image/")&&e.push(s)}return e}function Ym(t){const e=t.clipboardData;if(!e)return{file:null,imgUrl:null};const n=Vm(e);if(n.length>0)return{file:n[0],imgUrl:null};const s=e.getData("text/html");if(s){const a=s.match(/<img[^>]+src=["']([^"']+)["']/i);if(a!=null&&a[1])return{file:null,imgUrl:a[1]}}return{file:null,imgUrl:null}}function VC(t){const{file:e,imgUrl:n}=Ym(t);return e!==null||n!==null}async function J5(t){if(t.file)return og(t.file);if(t.imgUrl)try{const e=await $f(t.imgUrl),n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;const s=n.getContext("2d");if(s)return s.drawImage(e,0,0),n.toDataURL("image/png")}catch{return t.imgUrl}return null}function Z5(){return new Promise(t=>{const e=document.createElement("input");e.type="file",e.accept="image/*",e.multiple=!0,e.style.display="none",e.onchange=()=>{const n=[];if(e.files)for(let s=0;s<e.files.length;s++)n.push(e.files[s]);t(n),document.body.removeChild(e)},e.oncancel=()=>{t([]),document.body.removeChild(e)},document.body.appendChild(e),e.click()})}const YC={name:"image",onMouseDown(t,e,n){n.setIsDrawing(!1);const s=n.snapPos(e);n.clearSelection(),Z5().then(async a=>{var l;for(const u of a)try{const d=await og(u),p=await $f(d),h=lg(d,p.naturalWidth,p.naturalHeight,s.x,s.y,{...n.currentStyle});n.addElement(h),(l=n.onElementCreate)==null||l.call(n,h),n.setSelectedIds([h.id]),n.pushHistory()}catch{}n.setActiveTool("select")})},onMouseMove(){},onMouseUp(){},getCursor(){return"copy"}};let cg=null,lu;const $5={name:"line",onMouseDown(t,e,n){var w;n.setIsDrawing(!0);const s=n.snapPos(e);n.setDrawStart(s),n.clearSelection();const a=_s();n.currentElementIdRef.current=a;const l=el(n.currentStyle.strokeWidth??2),u=Kl(e,n.elements,24,void 0,void 0,void 0,l);let d=e,p=null;lu=void 0,u?(d=u.position,p={elementId:u.elementId,fixedPoint:u.fixedPoint,gap:l,isPrecise:u.isPrecise}):d=s,n.startBindingRef.current=p;const h={id:a,x:d.x,y:d.y,width:0,height:0,rotation:0,style:{...n.currentStyle},isLocked:!1,isVisible:!0,boundElements:null,points:[0,0,0,0],startBinding:p,endBinding:null},{currentLineType:y,currentStartArrowhead:_,currentEndArrowhead:S}=De.getState(),x=n.activeTool==="arrow"?{...h,type:"arrow",startArrowhead:_,endArrowhead:S,lineType:y}:{...h,type:"line",lineType:y};n.addElement(x),(w=n.onElementCreate)==null||w.call(n,x)},onMouseMove(t,e,n){if(!n.isDrawing){const _=el(n.currentStyle.strokeWidth??2),S=Kl(e,n.elements,24,void 0,void 0,void 0,_);n.setSnapTarget(S);return}if(!n.currentElementIdRef.current)return;const s=n.elements.find(_=>_.id===n.currentElementIdRef.current);if(!s)return;cg=e;const a=new Set([s.id]);s.startBinding&&a.add(s.startBinding.elementId);const l=el(s.style.strokeWidth??2),u=Kl(e,n.elements,24,a,{x:s.x,y:s.y},void 0,l,lu);n.setSnapTarget(u),lu=u==null?void 0:u.isPrecise;let d=u?u.position:n.snapPos(e);!u&&n.shiftKeyRef.current&&(d=IC({x:s.x,y:s.y},d));const p=u?{elementId:u.elementId,fixedPoint:u.fixedPoint,gap:l,isPrecise:u.isPrecise}:null,h=d.x-s.x,y=d.y-s.y;if(s.startBinding){const _=n.elements.find(S=>S.id===s.startBinding.elementId);if(_){let S;s.startBinding.isPrecise?S=tl(_,s.startBinding.fixedPoint,s.startBinding.gap):S=nl(_,d,s.startBinding.gap);const x=d.x-S.x,w=d.y-S.y;n.updateElement(s.id,{x:S.x,y:S.y,points:[0,0,x,w],width:Math.abs(x),height:Math.abs(w),endBinding:p});return}}n.updateElement(s.id,{points:[0,0,h,y],width:Math.abs(h),height:Math.abs(y),endBinding:p})},onMouseUp(t){if(!t.currentElementIdRef.current)return;const e=t.elements.find(n=>n.id===t.currentElementIdRef.current);if(e){const n=e.points;if(Math.sqrt((n[n.length-2]-n[0])**2+(n[n.length-1]-n[1])**2)<2)t.deleteElements([t.currentElementIdRef.current]),t.currentElementIdRef.current=null,t.startBindingRef.current=null,t.setSnapTarget(null),cg=null,lu=void 0;else{const a=cg??{x:e.x+n[n.length-2],y:e.y+n[n.length-1]},l=new Set([e.id]);e.startBinding&&l.add(e.startBinding.elementId);const u=el(e.style.strokeWidth??2),d=Kl(a,t.elements,24,l,void 0,void 0,u,lu),p=el(e.style.strokeWidth??2),h=d?{elementId:d.elementId,fixedPoint:d.fixedPoint,gap:p,isPrecise:d.isPrecise}:null,y=e.startBinding??t.startBindingRef.current,_=h&&y&&h.elementId===y.elementId?null:h,S=[...n];d&&(S[S.length-2]=d.position.x-e.x,S[S.length-1]=d.position.y-e.y);const x={points:S,width:Math.abs(S[S.length-2]-S[0]),height:Math.abs(S[S.length-1]-S[1]),startBinding:y,endBinding:_},w={...e,...x},C=Ql(w,t.elements);C&&Object.assign(x,C),t.updateElement(e.id,x);const D=e.type,U=De.getState().elements;Jl(e.id,D,null,y,U,t.updateElement);const M=De.getState().elements;Jl(e.id,D,null,_,M,t.updateElement),t.startBindingRef.current=null,t.setSnapTarget(null),t.setSelectedIds([t.currentElementIdRef.current]),t.pushHistory()}}cg=null,lu=void 0,t.setIsDrawing(!1),t.setDrawStart(null),t.currentElementIdRef.current=null,t.setActiveTool("select")},getCursor(){return"crosshair"}},jC={select:FC,rectangle:Gm,ellipse:Gm,diamond:Gm,line:$5,arrow:$5,freedraw:BC,text:zC,image:YC,eraser:UC};function eh(t){return jC[t]}function ec(t){const e=typeof t=="number"?String(t):t;let n=0,s=0,a=0,l=0;function u(){const d=n^n<<11;return n=s,s=a,a=l,l^=(l>>>19^d^d>>>8)>>>0,l/4294967296*2}for(let d=0;d<e.length+64;d++)n^=e.charCodeAt(d)|0,u();return u}function th(t,e){if(t===0)return 0;const n=t===1?.8:1.5,s=e*(t===1?.4:.8);return Math.max(n,s)}function ex(t,e){return t===0?0:Math.max(e*(t===1?1.2:2),t===1?1.5:3)}function WC(t,e,n,s){const a=n-t,l=s-e;return Math.sqrt(a*a+l*l)}function XC(t,e,n,s){const a=t*n+e*s,l=Math.sqrt(t*t+e*e),u=Math.sqrt(n*n+s*s);return l<1e-6||u<1e-6?0:Math.acos(Math.max(-1,Math.min(1,a/(l*u))))}function qC(t,e,n,s,a,l,u,d=!0){const p=s-e,h=a-n,y=Math.sqrt(p*p+h*h);if(y<.5){d&&t.moveTo(e,n),t.lineTo(s,a);return}const _=-h/y,S=p/y,x=Math.min(l,y*.25),w=x*.15,C=e+u()*w,D=n+u()*w,U=s+u()*w,M=a+u()*w,E=C+p*.33+_*u()*x,L=D+h*.33+S*u()*x,R=C+p*.67+_*u()*x,z=D+h*.67+S*u()*x;d&&t.moveTo(C,D),t.bezierCurveTo(E,L,R,z,U,M)}function tx(t,e,n,s,a){const l=e.length;if(l<3)return;const u=[];for(let d=0;d<l;d++){const[p,h]=e[d],[y,_]=e[(d+1)%l];u.push(WC(p,h,y,_))}for(let d=0;d<l;d++){const p=e[(d-1+l)%l],h=e[d],y=e[(d+1)%l],_=u[(d-1+l)%l],S=u[d],x=h[0]-p[0],w=h[1]-p[1],C=y[0]-h[0],D=y[1]-h[1],M=1-XC(-x,-w,C,D)/Math.PI;let E=s*M;const L=Math.min(_,S);E=Math.min(E,L*.4),E=Math.max(E,0);const R=_>1e-6?E/_:0,z=S>1e-6?E/S:0,ee=h[0]-x*R,O=h[1]-w*R,I=h[0]+C*z,F=h[1]+D*z,V=ee+a()*n,W=O+a()*n,j=I+a()*n,Y=F+a()*n,X=h[0]+a()*n,ne=h[1]+a()*n;d===0?t.moveTo(V,W):t.lineTo(V,W),E>.5?t.quadraticCurveTo(X,ne,j,Y):t.lineTo(j,Y)}t.closePath()}function nh(t){return t>=2?2:1}function KC(t,e,n,s,a,l,u,d=1,p=2){const h=th(l,p),y=ex(l,p),_=[[e,n],[e+s,n],[e+s,n+a],[e,n+a]];for(let S=0;S<d;S++)t.beginPath(),tx(t,_,h,y,u)}function QC(t,e,n,s,a,l,u,d=1,p=2){const h=th(l,p),y=Math.PI*2*Math.sqrt((s*s+a*a)/2),_=Math.max(16,Math.min(64,Math.floor(y*.08))),S=Math.PI*2/_,x=4/3*Math.tan(S/4);for(let w=0;w<d;w++){const C=[];for(let D=0;D<=_;D++){const U=D*S,M=u()*h*1.8;C.push({x:e+(s+M)*Math.cos(U),y:n+(a+M)*Math.sin(U),angle:U})}t.moveTo(C[0].x,C[0].y);for(let D=0;D<_;D++){const U=C[D],M=C[D+1],E=Math.cos(U.angle),L=Math.sin(U.angle),R=Math.cos(M.angle),z=Math.sin(M.angle),ee=-L,O=E,I=-z,F=R;s+u()*h,a+u()*h;const V=U.x+ee*s*x+u()*h*.8,W=U.y+O*a*x+u()*h*.8,j=M.x-I*s*x+u()*h*.8,Y=M.y-F*a*x+u()*h*.8;t.bezierCurveTo(V,W,j,Y,M.x,M.y)}}}function JC(t,e,n,s,a,l=1,u=2){const d=th(s,u),p=ex(s,u),h=[[e/2,0],[e,n/2],[e/2,n],[0,n/2]];for(let y=0;y<l;y++)t.beginPath(),tx(t,h,d,p,a)}function nx(t,e,n,s,a=1,l=2){if(e.length<4)return;const u=th(n,l);for(let d=0;d<a;d++)for(let p=0;p<e.length-2;p+=2)qC(t,e[p],e[p+1],e[p+2],e[p+3],u,s,!0)}function rx(t,e,n,s,a,l,u=1,d=2){const p=th(a,d),h=p*2;for(let y=0;y<u;y++){const _=e.x+l()*p*.6,S=e.y+l()*p*.6,x=s.x+l()*p*.6,w=s.y+l()*p*.6,C=n.x+l()*h,D=n.y+l()*h;t.moveTo(_,S),t.quadraticCurveTo(C,D,x,w)}}function ZC(t,e,n,s,a,l){const u=Math.min(l,s/2,a/2);t.beginPath(),t.moveTo(e+u,n),t.lineTo(e+s-u,n),t.arcTo(e+s,n,e+s,n+u,u),t.lineTo(e+s,n+a-u),t.arcTo(e+s,n+a,e+s-u,n+a,u),t.lineTo(e+u,n+a),t.arcTo(e,n+a,e,n+a-u,u),t.lineTo(e,n+u),t.arcTo(e,n,e+u,n,u),t.closePath()}const $C=({element:t,isSelected:e,isGrouped:n,onSelect:s,onChange:a,onDragMove:l,onDoubleClick:u,gridSnap:d,onDragSnap:p})=>{const{id:h,x:y,y:_,width:S,height:x,rotation:w,cornerRadius:C,style:D,isLocked:U}=t,M=!U&&!n,E=D.roughness,L=te.useCallback(()=>s(h),[s,h]),R=te.useCallback(()=>u==null?void 0:u(h),[u,h]),z=te.useCallback(j=>{let Y=j.target.x(),X=j.target.y();if(d&&(Y=rn(Y,d),X=rn(X,d),j.target.x(Y),j.target.y(X)),!d&&p){const ne=p(h,{x:Y,y:X,width:S,height:x});ne&&(Y=ne.x,X=ne.y,j.target.x(Y),j.target.y(X))}l==null||l(h,{x:Y,y:X})},[h,d,S,x,l,p]),ee=te.useCallback(j=>{let Y=j.target.x(),X=j.target.y();d&&(Y=rn(Y,d),X=rn(X,d)),a(h,{x:Y,y:X})},[h,d,a]),O=te.useCallback(j=>{const Y=j.target,X=Y.scaleX(),ne=Y.scaleY(),A=Math.max(5,Y.width()*X),B=Math.max(5,Y.height()*ne);Y.setAttrs({scaleX:1,scaleY:1,width:A,height:B}),l==null||l(h,{x:Y.x(),y:Y.y(),width:A,height:B})},[h,l]),I=te.useCallback(j=>{const Y=j.target,X=Math.max(5,Y.width()*Y.scaleX()),ne=Math.max(5,Y.height()*Y.scaleY());Y.setAttrs({scaleX:1,scaleY:1,width:X,height:ne}),a(h,{x:Y.x(),y:Y.y(),width:X,height:ne,rotation:Y.rotation()})},[h,a]),F=e?Nr.color:void 0,V=e?Nr.blur:0,W=e?Nr.opacity:0;if(E>0){const j=nh(E),Y=Jr(D.strokeStyle,D.strokeWidth);return Z.jsx(Ss,{id:h,x:y,y:_,width:S,height:x,rotation:w,transformsEnabled:w?"all":"position",sceneFunc:(X,ne)=>{C>0?ZC(X,0,0,S,x,C):(X.beginPath(),X.rect(0,0,S,x)),X.fillShape(ne);for(let A=0;A<j;A++){const B=ec(h+":"+A);X.beginPath(),KC(X,0,0,S,x,E,B,1,D.strokeWidth),X.strokeShape(ne)}},fill:D.fillColor,stroke:D.strokeColor,strokeWidth:D.strokeWidth,opacity:D.opacity,dash:Y,lineCap:"round",lineJoin:"round",draggable:M,onClick:L,onTap:L,onDblClick:R,onDblTap:R,shadowColor:F,shadowBlur:V,shadowOpacity:W,onDragMove:z,onDragEnd:ee,onTransform:O,onTransformEnd:I,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})}return Z.jsx(ya,{id:h,x:y,y:_,width:S,height:x,rotation:w,transformsEnabled:w?"all":"position",cornerRadius:C,fill:D.fillColor,stroke:D.strokeColor,strokeWidth:D.strokeWidth,opacity:D.opacity,dash:Jr(D.strokeStyle,D.strokeWidth),draggable:M,onClick:L,onTap:L,onDblClick:R,onDblTap:R,shadowColor:F,shadowBlur:V,shadowOpacity:W,onDragMove:z,onDragEnd:ee,onTransform:O,onTransformEnd:I,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})},e9=te.memo($C),t9=({element:t,isSelected:e,isGrouped:n,onSelect:s,onChange:a,onDragMove:l,onDoubleClick:u,gridSnap:d,onDragSnap:p})=>{const{id:h,x:y,y:_,width:S,height:x,rotation:w,style:C,isLocked:D}=t,U=!D&&!n,M=C.roughness,E=te.useCallback(()=>s(h),[s,h]),L=te.useCallback(()=>u==null?void 0:u(h),[u,h]),R=te.useCallback(W=>{let j=W.target.x(),Y=W.target.y();if(d){const X=rn(j-S/2,d),ne=rn(Y-x/2,d);j=X+S/2,Y=ne+x/2,W.target.x(j),W.target.y(Y)}if(!d&&p){const X=p(h,{x:j-S/2,y:Y-x/2,width:S,height:x});X&&(j=X.x+S/2,Y=X.y+x/2,W.target.x(j),W.target.y(Y))}l==null||l(h,{x:j-S/2,y:Y-x/2})},[h,d,S,x,l,p]),z=te.useCallback(W=>{let j=W.target.x(),Y=W.target.y();if(d){const X=rn(j-S/2,d),ne=rn(Y-x/2,d);j=X+S/2,Y=ne+x/2}a(h,{x:j-S/2,y:Y-x/2})},[h,d,S,x,a]),ee=te.useCallback(W=>{const j=W.target,Y=j.scaleX(),X=j.scaleY(),ne=Math.max(5,S*Y/2),A=Math.max(5,x*X/2);j.setAttrs({scaleX:1,scaleY:1,radiusX:ne,radiusY:A});const B=ne*2,Q=A*2;l==null||l(h,{x:j.x()-ne,y:j.y()-A,width:B,height:Q})},[h,S,x,l]),O=te.useCallback(W=>{const j=W.target,Y=j.getAttr("radiusX"),X=j.getAttr("radiusY");j.setAttrs({scaleX:1,scaleY:1});const ne=Math.max(5,Y*2),A=Math.max(5,X*2);a(h,{x:j.x()-Y,y:j.y()-X,width:ne,height:A,rotation:j.rotation()})},[h,a]),I=e?Nr.color:void 0,F=e?Nr.blur:0,V=e?Nr.opacity:0;if(M>0){const W=nh(M),j=S/2,Y=x/2;return Z.jsx(Ss,{id:h,x:y+j,y:_+Y,rotation:w,transformsEnabled:w?"all":"position",sceneFunc:(X,ne)=>{X.beginPath(),X.ellipse(0,0,j,Y,0,0,Math.PI*2),X.fillShape(ne);for(let A=0;A<W;A++){const B=ec(h+":"+A);X.beginPath(),QC(X,0,0,j,Y,M,B,1,C.strokeWidth),X.strokeShape(ne)}},fill:C.fillColor,stroke:C.strokeColor,strokeWidth:C.strokeWidth,opacity:C.opacity,dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"round",lineJoin:"round",draggable:U,onClick:E,onTap:E,onDblClick:L,onDblTap:L,shadowColor:I,shadowBlur:F,shadowOpacity:V,onDragMove:R,onDragEnd:z,onTransform:ee,onTransformEnd:O,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})}return Z.jsx(u5,{id:h,x:y+S/2,y:_+x/2,radiusX:S/2,radiusY:x/2,rotation:w,transformsEnabled:w?"all":"position",fill:C.fillColor,stroke:C.strokeColor,strokeWidth:C.strokeWidth,opacity:C.opacity,dash:Jr(C.strokeStyle,C.strokeWidth),draggable:U,onClick:E,onTap:E,onDblClick:L,onDblTap:L,shadowColor:I,shadowBlur:F,shadowOpacity:V,onDragMove:R,onDragEnd:z,onTransform:ee,onTransformEnd:O,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})},n9=te.memo(t9),r9=({element:t,isSelected:e,isGrouped:n,onSelect:s,onChange:a,onDragMove:l,onDoubleClick:u,gridSnap:d,onDragSnap:p})=>{const{id:h,x:y,y:_,width:S,height:x,rotation:w,style:C,isLocked:D}=t,U=!D&&!n,M=C.roughness,E=te.useCallback(()=>s(h),[s,h]),L=te.useCallback(()=>u==null?void 0:u(h),[u,h]),R=te.useCallback(W=>{let j=W.target.x(),Y=W.target.y();if(d&&(j=rn(j,d),Y=rn(Y,d),W.target.x(j),W.target.y(Y)),!d&&p){const X=p(h,{x:j,y:Y,width:S,height:x});X&&(j=X.x,Y=X.y,W.target.x(j),W.target.y(Y))}l==null||l(h,{x:j,y:Y})},[h,d,S,x,l,p]),z=te.useCallback(W=>{let j=W.target.x(),Y=W.target.y();d&&(j=rn(j,d),Y=rn(Y,d)),a(h,{x:j,y:Y})},[h,d,a]),ee=te.useCallback(W=>{const j=W.target,Y=j.scaleX(),X=j.scaleY(),ne=Math.max(5,S*Y),A=Math.max(5,x*X);j.setAttrs({scaleX:1,scaleY:1,points:Zf(ne,A)}),l==null||l(h,{x:j.x(),y:j.y(),width:ne,height:A})},[h,S,x,l]),O=te.useCallback(W=>{const j=W.target;j.setAttrs({scaleX:1,scaleY:1});const Y=j.getAttr("points"),X=Y?Y[2]:S,ne=Y?Y[5]:x;a(h,{x:j.x(),y:j.y(),width:Math.max(5,X),height:Math.max(5,ne),rotation:j.rotation()})},[h,S,x,a]),I=e?Nr.color:void 0,F=e?Nr.blur:0,V=e?Nr.opacity:0;if(M>0){const W=nh(M),j=Jr(C.strokeStyle,C.strokeWidth);return Z.jsx(Ss,{id:h,x:y,y:_,rotation:w,transformsEnabled:w?"all":"position",sceneFunc:(Y,X)=>{const ne=Zf(S,x);Y.beginPath(),Y.moveTo(ne[0],ne[1]);for(let A=2;A<ne.length;A+=2)Y.lineTo(ne[A],ne[A+1]);Y.closePath(),Y.fillShape(X);for(let A=0;A<W;A++){const B=ec(h+":"+A);Y.beginPath(),JC(Y,S,x,M,B,1,C.strokeWidth),Y.strokeShape(X)}},fill:C.fillColor,stroke:C.strokeColor,strokeWidth:C.strokeWidth,opacity:C.opacity,dash:j,lineCap:"round",lineJoin:"round",draggable:U,onClick:E,onTap:E,onDblClick:L,onDblTap:L,shadowColor:I,shadowBlur:F,shadowOpacity:V,onDragMove:R,onDragEnd:z,onTransform:ee,onTransformEnd:O,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})}return Z.jsx(Ui,{id:h,x:y,y:_,points:Zf(S,x),closed:!0,rotation:w,transformsEnabled:w?"all":"position",fill:C.fillColor,stroke:C.strokeColor,strokeWidth:C.strokeWidth,opacity:C.opacity,dash:Jr(C.strokeStyle,C.strokeWidth),draggable:U,onClick:E,onTap:E,onDblClick:L,onDblTap:L,shadowColor:I,shadowBlur:F,shadowOpacity:V,onDragMove:R,onDragEnd:z,onTransform:ee,onTransformEnd:O,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})},i9=te.memo(r9),s9=new Set(["rectangle","ellipse","diamond","text","image"]);function ix(t){const e=te.useRef(t??[]);return e.current=t??[],{fingerprint:te.useMemo(()=>{if(!t||t.length===0)return"";const s=l=>Math.round(l*2)/2,a=[];for(const l of t)s9.has(l.type)&&l.isVisible&&a.push(`${l.id}:${s(l.x)},${s(l.y)},${s(l.width)},${s(l.height)},${s(l.rotation||0)}`);return a.join(";")},[t]),elementsRef:e}}function a9(t){const e=new Array(t.length);for(let n=0;n<t.length;n++){const s=t[n];e[n]={id:s.id,type:s.type,x:s.x,y:s.y,width:s.width,height:s.height,rotation:s.rotation,isVisible:s.isVisible}}return e}const sx=50;class o9{constructor(){et(this,"worker",null);et(this,"requestIdCounter",0);et(this,"pending",new Map);et(this,"cachedElements",[]);et(this,"workerSupported",!0);et(this,"handleMessage",e=>{const{type:n,requestId:s,points:a}=e.data;if(n==="routeResult"){const l=this.pending.get(s);l&&(this.pending.delete(s),l.timerId!==void 0&&clearTimeout(l.timerId),l.resolve(a))}})}_getWorker(){if(!this.workerSupported)return null;if(this.worker)return this.worker;try{return this.worker=new Worker(new URL("/assets/elbowWorker-CUBh1uET.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:to&&to.tagName.toUpperCase()==="SCRIPT"&&to.src||new URL("f1ow-canvas.umd.cjs",document.baseURI).href),{type:"module"}),this.worker.onmessage=this.handleMessage,this.worker.onerror=()=>{this.workerSupported=!1,this.worker=null;for(const[,e]of this.pending)e.timerId!==void 0&&clearTimeout(e.timerId),e.reject(new Error("Worker failed"));this.pending.clear()},this.worker}catch{return this.workerSupported=!1,null}}updateElements(e){this.cachedElements=e;const n=this._getWorker();n&&e.length>=sx&&n.postMessage({type:"updateElements",elements:a9(e)})}async computeRoute(e){const n=this._getWorker();if(!n||this.cachedElements.length<sx)return this.computeSync(e);const s=++this.requestIdCounter;return new Promise((a,l)=>{const u=setTimeout(()=>{this.pending.has(s)&&(this.pending.delete(s),a(this.computeSync(e)))},100);this.pending.set(s,{resolve:a,reject:l,timerId:u}),n.postMessage({type:"computeRoute",requestId:s,params:e})})}computeSync(e){const n=jf(e.startWorld,e.endWorld,e.startBinding,e.endBinding,this.cachedElements,e.minStubLength);return Wf(n)}dispose(){this.worker&&(this.worker.terminate(),this.worker=null);for(const[,e]of this.pending)e.timerId!==void 0&&clearTimeout(e.timerId),e.reject(new Error("Worker disposed"));this.pending.clear()}get isWorkerActive(){return this.workerSupported}}let cu=null;function jm(){return cu||(cu=new o9),cu}function ax(){cu&&(cu.dispose(),cu=null)}function ox(t,e,n,s){const[a,l]=te.useState(null),u=te.useRef(n);return u.current=n,te.useEffect(()=>{jm().updateElements(n)},[s]),te.useEffect(()=>()=>{},[]),te.useEffect(()=>{if(!t){l(null);return}const d=jm();let p=!1;const h={startWorld:e.startWorld,endWorld:e.endWorld,startBinding:e.startBinding,endBinding:e.endBinding,minStubLength:e.minStubLength};if(d.isWorkerActive)d.computeRoute(h).then(y=>{p||l(y)});else{const y=jf(e.startWorld,e.endWorld,e.startBinding,e.endBinding,u.current,e.minStubLength),_=Wf(y);l(_)}return()=>{p=!0}},[t,e.startWorld.x,e.startWorld.y,e.endWorld.x,e.endWorld.y,e.startBinding,e.endBinding,e.minStubLength,s]),a}const l9=({element:t,isSelected:e,isEditing:n,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:p,allElements:h})=>{const{id:y,x:_,y:S,points:x,rotation:w,style:C,startBinding:D,endBinding:U,lineType:M,isLocked:E}=t,L=!E&&!s,R=te.useRef(null),z=C.roughness,ee=M==="curved",O=M==="elbow",{fingerprint:I,elementsRef:F}=ix(h),V=te.useMemo(()=>({x:_+x[0],y:S+x[1]}),[_,S,x[0],x[1]]),W=te.useMemo(()=>({x:_+x[x.length-2],y:S+x[x.length-1]}),[_,S,x]),j=ox(O,{startWorld:V,endWorld:W,startBinding:D,endBinding:U},h??[],I),Y=te.useMemo(()=>{if(!O)return x;const q=jf(V,W,D,U,F.current);return Wf(q)},[O,_,S,x,D,U,I]),X=O?j??Y:x,ne=te.useMemo(()=>{if(!O)return x;const q=[...X],oe=x[0],ye=x[1];if(oe!==0||ye!==0)for(let ke=0;ke<q.length;ke+=2)q[ke]+=oe,q[ke+1]+=ye;return q},[O,X,x]),A=te.useMemo(()=>{if(!ee)return null;const q={x:x[0],y:x[1]},oe={x:x[x.length-2],y:x[x.length-1]},ye=va(q,oe,t.curvature??ma);return{start:q,end:oe,cp:ye}},[ee,x,t.curvature]),B=te.useCallback(()=>a(y),[a,y]),Q=te.useCallback(()=>d==null?void 0:d(y),[d,y]),H=te.useCallback(q=>{let oe=q.target.x(),ye=q.target.y();p&&(oe=rn(oe,p),ye=rn(ye,p),q.target.x(oe),q.target.y(ye)),u==null||u(y,{x:oe,y:ye})},[y,p,u]),K=te.useCallback(q=>{let oe=q.target.x(),ye=q.target.y();p&&(oe=rn(oe,p),ye=rn(ye,p)),l(y,{x:oe,y:ye})},[y,p,l]),ae=te.useCallback(q=>{const oe=q.target,ye=oe.scaleX(),ke=oe.scaleY();oe.setAttrs({scaleX:1,scaleY:1});const Ae=x.map((be,He)=>He%2===0?be*ye:be*ke),Me=ag(Ae);l(y,{x:oe.x(),y:oe.y(),points:Ae,rotation:oe.rotation(),width:Me.width,height:Me.height})},[y,x,l]),ie=nh(z),de=e?Nr.color:void 0,fe=e?Nr.blur:0,se=e?Nr.opacity:0;return Z.jsx(io,{id:y,ref:R,x:_,y:S,rotation:w,transformsEnabled:w?"all":"position",draggable:L,onClick:B,onTap:B,onDblClick:Q,onDblTap:Q,onDragMove:H,onDragEnd:K,onTransformEnd:ae,children:O?Z.jsxs(Z.Fragment,{children:[Z.jsx(Ui,{points:ne,stroke:"transparent",strokeWidth:Math.max(20,C.strokeWidth+16),listening:!0,perfectDrawEnabled:!1}),Z.jsx(Ui,{points:ne,stroke:C.strokeColor,strokeWidth:C.strokeWidth,opacity:C.opacity,dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"square",lineJoin:"miter",shadowColor:de,shadowBlur:fe,shadowOpacity:se,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})]}):ee?Z.jsx(Ss,{sceneFunc:(q,oe)=>{if(A){if(q.beginPath(),z>0){const ye=ec(y);rx(q,A.start,A.cp,A.end,z,ye,ie,C.strokeWidth)}else q.moveTo(A.start.x,A.start.y),q.quadraticCurveTo(A.cp.x,A.cp.y,A.end.x,A.end.y);q.fillStrokeShape(oe)}},stroke:C.strokeColor,strokeWidth:C.strokeWidth,hitStrokeWidth:Math.max(20,C.strokeWidth+16),dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"round",lineJoin:"round",listening:!0,opacity:C.opacity,shadowColor:de,shadowBlur:fe,shadowOpacity:se,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}):z>0?Z.jsx(Ss,{sceneFunc:(q,oe)=>{const ye=ec(y);q.beginPath(),nx(q,x,z,ye,ie,C.strokeWidth),q.fillStrokeShape(oe)},stroke:C.strokeColor,strokeWidth:C.strokeWidth,hitStrokeWidth:Math.max(20,C.strokeWidth+16),dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"round",lineJoin:"round",listening:!0,opacity:C.opacity,shadowColor:de,shadowBlur:fe,shadowOpacity:se,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}):Z.jsxs(Z.Fragment,{children:[Z.jsx(Ui,{points:x,stroke:"transparent",strokeWidth:Math.max(20,C.strokeWidth+16),listening:!0,perfectDrawEnabled:!1}),Z.jsx(Ui,{points:x,stroke:C.strokeColor,strokeWidth:C.strokeWidth,opacity:C.opacity,dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"round",lineJoin:"round",shadowColor:de,shadowBlur:fe,shadowOpacity:se,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})]})})},c9=te.memo(l9);function u9(t,e){const n=t.x-e.x,s=t.y-e.y,a=Math.sqrt(n*n+s*s)||1;return{x:n/a,y:s/a}}function d9(t){return{x:-t.y,y:t.x}}function Wm(t){return Math.max(10,t*4)}function oo(t,e,n,s,a,l,u){const d=u9(n,s),p=d9(d),h=a*.45,y=t._context;switch(y.save(),y.strokeStyle=l,y.fillStyle=l,y.lineWidth=u,y.lineJoin="round",y.lineCap="round",e){case"arrow":{const _={x:n.x-d.x*a+p.x*h,y:n.y-d.y*a+p.y*h},S={x:n.x-d.x*a-p.x*h,y:n.y-d.y*a-p.y*h};y.beginPath(),y.moveTo(_.x,_.y),y.lineTo(n.x,n.y),y.lineTo(S.x,S.y),y.stroke();break}case"triangle":{const _={x:n.x-d.x*a+p.x*h,y:n.y-d.y*a+p.y*h},S={x:n.x-d.x*a-p.x*h,y:n.y-d.y*a-p.y*h};y.beginPath(),y.moveTo(n.x,n.y),y.lineTo(_.x,_.y),y.lineTo(S.x,S.y),y.closePath(),y.fill(),y.stroke();break}case"triangle_outline":{const _={x:n.x-d.x*a+p.x*h,y:n.y-d.y*a+p.y*h},S={x:n.x-d.x*a-p.x*h,y:n.y-d.y*a-p.y*h};y.fillStyle="#ffffff",y.beginPath(),y.moveTo(n.x,n.y),y.lineTo(_.x,_.y),y.lineTo(S.x,S.y),y.closePath(),y.fill(),y.stroke();break}case"circle":{const _=a*.35,S=n.x-d.x*_,x=n.y-d.y*_;y.beginPath(),y.arc(S,x,_,0,Math.PI*2),y.fill(),y.stroke();break}case"circle_outline":{const _=a*.35,S=n.x-d.x*_,x=n.y-d.y*_;y.fillStyle="#ffffff",y.beginPath(),y.arc(S,x,_,0,Math.PI*2),y.fill(),y.stroke();break}case"diamond":{const _=h*.7,S=a*.55,x={x:n.x-d.x*S,y:n.y-d.y*S};y.beginPath(),y.moveTo(n.x,n.y),y.lineTo(x.x+p.x*_,x.y+p.y*_),y.lineTo(x.x-d.x*S,x.y-d.y*S),y.lineTo(x.x-p.x*_,x.y-p.y*_),y.closePath(),y.fill(),y.stroke();break}case"diamond_outline":{const _=h*.7,S=a*.55,x={x:n.x-d.x*S,y:n.y-d.y*S};y.fillStyle="#ffffff",y.beginPath(),y.moveTo(n.x,n.y),y.lineTo(x.x+p.x*_,x.y+p.y*_),y.lineTo(x.x-d.x*S,x.y-d.y*S),y.lineTo(x.x-p.x*_,x.y-p.y*_),y.closePath(),y.fill(),y.stroke();break}case"bar":{const _=h*1.2;y.beginPath(),y.moveTo(n.x+p.x*_,n.y+p.y*_),y.lineTo(n.x-p.x*_,n.y-p.y*_),y.stroke();break}case"crowfoot_one":{const _=h*1,S=a*.25;y.beginPath(),y.moveTo(n.x+p.x*_,n.y+p.y*_),y.lineTo(n.x-p.x*_,n.y-p.y*_),y.stroke();const x={x:n.x-d.x*S,y:n.y-d.y*S};y.beginPath(),y.moveTo(x.x+p.x*_,x.y+p.y*_),y.lineTo(x.x-p.x*_,x.y-p.y*_),y.stroke();break}case"crowfoot_many":{const _=h*1,S=a*.6;y.beginPath(),y.moveTo(n.x+p.x*_,n.y+p.y*_),y.lineTo(n.x-p.x*_,n.y-p.y*_),y.stroke();const x={x:n.x-d.x*S,y:n.y-d.y*S};y.beginPath(),y.moveTo(n.x+p.x*_,n.y+p.y*_),y.lineTo(x.x,x.y),y.lineTo(n.x-p.x*_,n.y-p.y*_),y.stroke();break}case"crowfoot_one_or_many":{const _=h*1,S=a*.6,x=a*.25;y.beginPath(),y.moveTo(n.x+p.x*_,n.y+p.y*_),y.lineTo(n.x-p.x*_,n.y-p.y*_),y.stroke();const w={x:n.x-d.x*x,y:n.y-d.y*x};y.beginPath(),y.moveTo(w.x+p.x*_,w.y+p.y*_),y.lineTo(w.x-p.x*_,w.y-p.y*_),y.stroke();const C={x:n.x-d.x*S,y:n.y-d.y*S};y.beginPath(),y.moveTo(n.x+p.x*_,n.y+p.y*_),y.lineTo(C.x,C.y),y.lineTo(n.x-p.x*_,n.y-p.y*_),y.stroke();break}}y.restore()}function ug(t){const e=[];for(let n=0;n<t.length;n+=2)e.push({x:t[n],y:t[n+1]});return e}function f9(t){let e=t.startArrowhead??null,n=t.endArrowhead??null;return e===null&&t.startArrow&&(e="arrow"),n===null&&t.endArrow&&(n="arrow"),{start:e,end:n}}const h9=({element:t,isSelected:e,isEditing:n,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:p,allElements:h})=>{const{id:y,x:_,y:S,points:x,rotation:w,style:C,startBinding:D,endBinding:U,lineType:M,isLocked:E}=t,L=!E&&!s,R=te.useRef(null),z=C.roughness,{start:ee,end:O}=f9(t),I=ee!=null||O!=null,F=M==="curved",V=M==="elbow",W=Wm(C.strokeWidth),j=nh(z),{fingerprint:Y,elementsRef:X}=ix(h),ne=te.useMemo(()=>({x:_+x[0],y:S+x[1]}),[_,S,x[0],x[1]]),A=te.useMemo(()=>({x:_+x[x.length-2],y:S+x[x.length-1]}),[_,S,x]),B=I?Math.ceil(W*1.5):void 0,Q=ox(V,{startWorld:ne,endWorld:A,startBinding:D,endBinding:U,minStubLength:B},h??[],Y),H=te.useMemo(()=>{if(!V)return x;const Me=jf(ne,A,D,U,X.current,B);return Wf(Me)},[V,_,S,x,D,U,Y]),K=V?Q??H:x,ae=te.useMemo(()=>{if(!V)return x;const Me=[...K],be=x[0],He=x[1];if(be!==0||He!==0)for(let $e=0;$e<Me.length;$e+=2)Me[$e]+=be,Me[$e+1]+=He;return Me},[V,K,x]),ie=te.useMemo(()=>{if(!F)return null;const Me={x:x[0],y:x[1]},be={x:x[x.length-2],y:x[x.length-1]},He=va(Me,be,t.curvature??ma);return{start:Me,end:be,cp:He}},[F,x,t.curvature]),de=te.useCallback(()=>a(y),[a,y]),fe=te.useCallback(()=>d==null?void 0:d(y),[d,y]),se=te.useCallback(Me=>{let be=Me.target.x(),He=Me.target.y();p&&(be=rn(be,p),He=rn(He,p),Me.target.x(be),Me.target.y(He)),u==null||u(y,{x:be,y:He})},[y,p,u]),q=te.useCallback(Me=>{let be=Me.target.x(),He=Me.target.y();p&&(be=rn(be,p),He=rn(He,p)),l(y,{x:be,y:He})},[y,p,l]),oe=te.useCallback(Me=>{const be=Me.target,He=be.scaleX(),$e=be.scaleY();be.setAttrs({scaleX:1,scaleY:1});const Ct=x.map((Ee,yt)=>yt%2===0?Ee*He:Ee*$e),le=ag(Ct);l(y,{x:be.x(),y:be.y(),points:Ct,rotation:be.rotation(),width:le.width,height:le.height})},[y,x,l]),ye=e?Nr.color:void 0,ke=e?Nr.blur:0,Ae=e?Nr.opacity:0;return Z.jsx(io,{id:y,ref:R,x:_,y:S,rotation:w,transformsEnabled:w?"all":"position",draggable:L,onClick:de,onTap:de,onDblClick:fe,onDblTap:fe,onDragMove:se,onDragEnd:q,onTransformEnd:oe,children:V?Z.jsxs(Z.Fragment,{children:[Z.jsx(Ui,{points:ae,stroke:"transparent",strokeWidth:Math.max(20,C.strokeWidth+16),listening:!0,perfectDrawEnabled:!1}),Z.jsx(Ui,{points:ae,stroke:C.strokeColor,strokeWidth:C.strokeWidth,opacity:C.opacity,dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"square",lineJoin:"miter",shadowColor:ye,shadowBlur:ke,shadowOpacity:Ae,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),I&&Z.jsx(Ss,{sceneFunc:(Me,be)=>{const He=ug(ae);if(!(He.length<2)){if(ee&&oo(Me,ee,He[0],He[1],W,C.strokeColor,C.strokeWidth),O){const $e=He[He.length-1],Ct=He[He.length-2];oo(Me,O,$e,Ct,W,C.strokeColor,C.strokeWidth)}Me.fillStrokeShape(be)}},listening:!1,opacity:C.opacity})]}):F?Z.jsxs(Z.Fragment,{children:[Z.jsx(Ss,{sceneFunc:(Me,be)=>{if(ie){if(Me.beginPath(),z>0){const He=ec(y);rx(Me,ie.start,ie.cp,ie.end,z,He,j,C.strokeWidth)}else Me.moveTo(ie.start.x,ie.start.y),Me.quadraticCurveTo(ie.cp.x,ie.cp.y,ie.end.x,ie.end.y);Me.fillStrokeShape(be)}},stroke:C.strokeColor,strokeWidth:C.strokeWidth,hitStrokeWidth:Math.max(20,C.strokeWidth+16),dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"round",lineJoin:"round",listening:!0,opacity:C.opacity,shadowColor:ye,shadowBlur:ke,shadowOpacity:Ae,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),I&&ie&&Z.jsx(Ss,{sceneFunc:Me=>{if(ee){const be=zm(ie.start,ie.cp,ie.end,!1);oo(Me,ee,ie.start,be,W,C.strokeColor,C.strokeWidth)}if(O){const be=zm(ie.start,ie.cp,ie.end,!0);oo(Me,O,ie.end,be,W,C.strokeColor,C.strokeWidth)}},listening:!1,opacity:C.opacity})]}):z>0?Z.jsxs(Z.Fragment,{children:[Z.jsx(Ss,{sceneFunc:(Me,be)=>{const He=ec(y);Me.beginPath(),nx(Me,x,z,He,j,C.strokeWidth),Me.fillStrokeShape(be)},stroke:C.strokeColor,strokeWidth:C.strokeWidth,hitStrokeWidth:Math.max(20,C.strokeWidth+16),dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"round",lineJoin:"round",listening:!0,opacity:C.opacity,shadowColor:ye,shadowBlur:ke,shadowOpacity:Ae,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),I&&Z.jsx(Ss,{sceneFunc:(Me,be)=>{const He=ug(x);if(!(He.length<2)){if(ee&&oo(Me,ee,He[0],He[1],W,C.strokeColor,C.strokeWidth),O){const $e=He[He.length-1],Ct=He[He.length-2];oo(Me,O,$e,Ct,W,C.strokeColor,C.strokeWidth)}Me.fillStrokeShape(be)}},listening:!1,opacity:C.opacity})]}):Z.jsxs(Z.Fragment,{children:[Z.jsx(Ui,{points:x,stroke:"transparent",strokeWidth:Math.max(20,C.strokeWidth+16),listening:!0,perfectDrawEnabled:!1}),Z.jsx(Ui,{points:x,stroke:C.strokeColor,strokeWidth:C.strokeWidth,opacity:C.opacity,dash:Jr(C.strokeStyle,C.strokeWidth),lineCap:"round",lineJoin:"round",shadowColor:ye,shadowBlur:ke,shadowOpacity:Ae,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),I&&Z.jsx(Ss,{sceneFunc:(Me,be)=>{const He=ug(x);if(!(He.length<2)){if(ee&&oo(Me,ee,He[0],He[1],W,C.strokeColor,C.strokeWidth),O){const $e=He[He.length-1],Ct=He[He.length-2];oo(Me,O,$e,Ct,W,C.strokeColor,C.strokeWidth)}Me.fillStrokeShape(be)}},listening:!1,opacity:C.opacity})]})})},p9=te.memo(h9),g9=({element:t,isSelected:e,isGrouped:n,onSelect:s,onChange:a,onDragMove:l,onDoubleClick:u,gridSnap:d,onDragSnap:p})=>{const{id:h,x:y,y:_,points:S,rotation:x,style:w,isLocked:C}=t,D=!C&&!n,U=te.useCallback(()=>s(h),[s,h]),M=te.useCallback(()=>u==null?void 0:u(h),[u,h]),E=te.useCallback(I=>{let F=I.target.x(),V=I.target.y();if(d&&(F=rn(F,d),V=rn(V,d),I.target.x(F),I.target.y(V)),!d&&p){let W=0,j=0,Y=0,X=0;for(let A=0;A<S.length;A+=2)W=Math.min(W,S[A]),Y=Math.max(Y,S[A]),j=Math.min(j,S[A+1]),X=Math.max(X,S[A+1]);const ne=p(h,{x:F+W,y:V+j,width:Y-W,height:X-j});ne&&(F=ne.x-W,V=ne.y-j,I.target.x(F),I.target.y(V))}l==null||l(h,{x:F,y:V})},[h,d,S,l,p]),L=te.useCallback(I=>{let F=I.target.x(),V=I.target.y();d&&(F=rn(F,d),V=rn(V,d)),a(h,{x:F,y:V})},[h,d,a]),R=te.useCallback(I=>{const F=I.target,V=F.scaleX(),W=F.scaleY();F.setAttrs({scaleX:1,scaleY:1});const j=S.map((Y,X)=>X%2===0?Y*V:Y*W);a(h,{x:F.x(),y:F.y(),points:j,rotation:F.rotation()})},[h,S,a]),z=e?Nr.color:void 0,ee=e?Nr.blur:0,O=e?Nr.opacity:0;return Z.jsx(Ui,{id:h,x:y,y:_,points:S,rotation:x,transformsEnabled:x?"all":"position",stroke:w.strokeColor,strokeWidth:w.strokeWidth,opacity:w.opacity,lineCap:"round",lineJoin:"round",tension:.5,globalCompositeOperation:"source-over",draggable:D,onClick:U,onTap:U,onDblClick:M,onDblTap:M,shadowColor:z,shadowBlur:ee,shadowOpacity:O,hitStrokeWidth:20,onDragMove:E,onDragEnd:L,onTransformEnd:R,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})},y9=te.memo(g9),dg=1.18,m9=({element:t,isSelected:e,isGrouped:n,onSelect:s,onChange:a,onDragMove:l,autoEdit:u,onEditStart:d,onEditEnd:p,allElements:h,gridSnap:y})=>{const{id:_,x:S,y:x,width:w,height:C,rotation:D,style:U,text:M,containerId:E,textAlign:L,verticalAlign:R,isLocked:z}=t,ee=te.useRef(null),O=te.useRef(!1),I=te.useRef(!1),F=!!E,V=!F&&!z&&!n,W=te.useMemo(()=>!E||!h?null:h.find(H=>H.id===E)??null,[E,h]),j=te.useMemo(()=>{var se,q;if(!W)return{x:S,y:x};if(W.type==="arrow"||W.type==="line"){const oe=W,ye=oe.points,ke={x:ye[0],y:ye[1]},Ae={x:ye[ye.length-2],y:ye[ye.length-1]};let Me,be;if(oe.lineType==="curved"){const Ct=va(ke,Ae,oe.curvature??ma),le=ou(ke,Ct,Ae,.5);Me=oe.x+le.x,be=oe.y+le.y}else Me=oe.x+(ke.x+Ae.x)/2,be=oe.y+(ke.y+Ae.y)/2;const He=Math.max(80,w||80),$e=((se=ee.current)==null?void 0:se.height())??C;return{x:Me-He/2,y:be-$e/2,width:He}}const H=4,K=W.width-H*2,ae=Math.max(20,K),ie=W.x+H,de=((q=ee.current)==null?void 0:q.height())??C;let fe;return R==="top"?fe=W.y+H:R==="bottom"?fe=W.y+W.height-de-H:fe=W.y+(W.height-de)/2,{x:ie,y:fe,width:ae}},[W,S,x,C,R]),Y=te.useCallback(()=>{const H=ee.current;if(!H||O.current)return;const K=H.height(),ae={};let ie=!1;if(Math.abs(K-C)>1&&(ae.height=K,ie=!0),!F){const de=Math.ceil(H.getTextWidth());Math.abs(de-w)>1&&(ae.width=de,ie=!0)}ie&&a(_,ae)},[_,C,w,F,a]);te.useEffect(()=>{requestAnimationFrame(Y)},[M,U.fontSize,U.fontFamily,Y]);const X=te.useCallback(()=>{const H=ee.current;if(!H||O.current)return;const K=H.getStage();if(!K)return;O.current=!0,d==null||d(_);const ae=K.container(),de=H.getAbsoluteTransform().copy().point({x:0,y:0}),fe=K.scaleX(),se=U.fontSize*fe,q=se*(dg-1.07)/2;let oe=0,ye=0,ke=0,Ae=0;const be=4*fe;if(F&&W){const Sn=K.getAbsoluteTransform().copy().point({x:W.x,y:W.y});oe=Sn.x,ye=Sn.y,ke=W.width*fe,Ae=W.height*fe}const He=H.width(),$e=F?ke-be*2:Math.max(He,100)*fe,Ct=F?oe+be:de.x,le=M,Ee=document.createElement("textarea");if(ae.appendChild(Ee),Ee.value=M,Ee.style.position="absolute",F&&W){const Ft=R||"middle",Sn=H.height()*fe;let dn;Ft==="top"?dn=ye+be-q:Ft==="bottom"?dn=ye+Ae-Sn-be-q:dn=ye+(Ae-Sn)/2-q,Ee.style.top=`${dn}px`}else Ee.style.top=`${de.y-q}px`;Ee.style.left=`${Ct}px`,Ee.style.width=`${$e}px`,Ee.style.fontSize=`${se}px`,Ee.style.fontFamily=U.fontFamily,Ee.style.color=U.strokeColor,Ee.style.lineHeight=`${dg}`,Ee.style.border="none",Ee.style.borderRadius="0",Ee.style.padding="0",Ee.style.margin="0",Ee.style.outline="none",Ee.style.resize="none",Ee.style.overflow="hidden",Ee.style.background="transparent",Ee.style.zIndex="1000",Ee.rows=1,Ee.style.minHeight=`${Math.max(20,se*dg)}px`,Ee.style.boxSizing="border-box",Ee.style.transformOrigin="left top",Ee.style.letterSpacing="normal",Ee.style.caretColor=U.strokeColor;const yt=F?L||"center":"left";Ee.style.textAlign=yt,F?(Ee.style.whiteSpace="pre-wrap",Ee.style.wordBreak="break-word"):(Ee.style.whiteSpace="pre",Ee.style.wordBreak="normal");const xt=F?(W==null?void 0:W.rotation)??D:D;xt&&(Ee.style.transform=`rotateZ(${xt}deg)`);const Et=()=>{Ee.style.height="auto";const Ft=Ee.scrollHeight;if(Ee.style.height=`${Ft}px`,F&&W){const Sn=R||"middle";let dn;Sn==="top"?dn=ye+be-q:Sn==="bottom"?dn=ye+Ae-Ft-be-q:dn=ye+(Ae-Ft)/2-q,Ee.style.top=`${dn}px`}F||(Ee.style.width="auto",Ee.style.width=`${Math.max(Ee.scrollWidth,100*fe)}px`)};Ee.addEventListener("input",Et),requestAnimationFrame(Et),H.hide(),K.batchDraw(),Ee.focus(),Ee.select();let Pt=!1;const On=()=>{if(!O.current)return;O.current=!1;const Ft=Pt?le:Ee.value,Sn=Ft.trim()==="";Ee.removeEventListener("input",Et),Ee.removeEventListener("blur",kn),Ee.removeEventListener("keydown",sr),Ee.parentNode&&Ee.parentNode.removeChild(Ee),H.show(),K.batchDraw(),Pt||a(_,{text:Ft}),p==null||p(_,Sn)},kn=()=>{On()},sr=Ft=>{Ft.stopPropagation(),Ft.key==="Escape"&&(Pt=!0,Ee.blur()),Ft.key==="Enter"&&!Ft.shiftKey&&(Ft.preventDefault(),Ee.blur()),Ft.key==="Tab"&&(Ft.preventDefault(),Ee.blur())};Ee.addEventListener("blur",kn),Ee.addEventListener("keydown",sr)},[_,M,D,U,F,W,L,R,a,d,p]);te.useEffect(()=>{u||(I.current=!1)},[u]),te.useEffect(()=>{u&&!I.current&&ee.current&&(I.current=!0,X())},[u,X]);const ne=F?j.x:S,A=F?j.y:x,B=F&&j.width?j.width:void 0,Q=F?L||"center":void 0;return Z.jsx(d5,{ref:ee,id:_,x:ne,y:A,text:M||(F?"":"Double-click to edit"),fontSize:U.fontSize,fontFamily:U.fontFamily,fill:U.strokeColor,lineHeight:dg,width:B,align:Q,wrap:F?"word":"none",rotation:F?(W==null?void 0:W.rotation)??D:D,transformsEnabled:(F?(W==null?void 0:W.rotation)??D:D)?"all":"position",visible:!(u&&!O.current&&!M),opacity:M?U.opacity:F?0:.4,draggable:V,listening:!F,onClick:F?void 0:()=>s(_),onTap:F?void 0:()=>s(_),onDblClick:X,onDblTap:X,shadowColor:!F&&e?"#4f8df7":void 0,shadowBlur:!F&&e?6:0,shadowOpacity:!F&&e?.5:0,hitStrokeWidth:F?0:10,perfectDrawEnabled:!1,onDragMove:F?void 0:H=>{let K=H.target.x(),ae=H.target.y();y&&(K=rn(K,y),ae=rn(ae,y),H.target.x(K),H.target.y(ae)),l==null||l(_,{x:K,y:ae})},onDragEnd:F?void 0:H=>{let K=H.target.x(),ae=H.target.y();y&&(K=rn(K,y),ae=rn(ae,y)),a(_,{x:K,y:ae})},onTransformEnd:F?void 0:H=>{const K=H.target,ae=K.scaleX(),ie=K.scaleY(),de=Math.max(Math.abs(ae),Math.abs(ie)),fe=Math.max(8,Math.round(U.fontSize*de));K.scaleX(1),K.scaleY(1),a(_,{x:K.x(),y:K.y(),rotation:K.rotation(),style:{...U,fontSize:fe}})}})},v9=te.memo(m9),S9=({element:t,isSelected:e,isGrouped:n,onSelect:s,onChange:a,onDragMove:l,onDoubleClick:u,gridSnap:d,onDragSnap:p})=>{const{id:h,x:y,y:_,width:S,height:x,rotation:w,src:C,style:D,crop:U,cornerRadius:M,scaleMode:E,isLocked:L}=t,[R,z]=te.useState(null),[ee,O]=te.useState(!1),[I,F]=te.useState({w:S,h:x});te.useEffect(()=>{F({w:S,h:x})},[S,x]);const V=I.w,W=I.h;te.useEffect(()=>{if(!C){z(null),O(!0);return}const de=new window.Image;return de.crossOrigin="anonymous",de.onload=()=>{z(de),O(!1)},de.onerror=()=>{z(null),O(!0)},de.src=C,()=>{de.onload=null,de.onerror=null}},[C]);const j=te.useCallback(de=>{let fe=de.target.x(),se=de.target.y();if(d&&(fe=rn(fe,d),se=rn(se,d),de.target.x(fe),de.target.y(se)),!d&&p){const q=p(h,{x:fe,y:se,width:S,height:x});q&&(fe=q.x,se=q.y,de.target.x(fe),de.target.y(se))}l==null||l(h,{x:fe,y:se})},[h,S,x,d,p,l]),Y=te.useCallback(de=>{let fe=de.target.x(),se=de.target.y();d&&(fe=rn(fe,d),se=rn(se,d)),a(h,{x:fe,y:se})},[h,d,a]),X=te.useCallback(de=>{const fe=de.target,se=fe.scaleX(),q=fe.scaleY(),oe=Math.max(10,fe.width()*se),ye=Math.max(10,fe.height()*q);fe.setAttrs({scaleX:1,scaleY:1,width:oe,height:ye}),F({w:oe,h:ye}),l==null||l(h,{x:fe.x(),y:fe.y(),width:oe,height:ye})},[h,l]),ne=te.useCallback(de=>{const fe=de.target;a(h,{x:fe.x(),y:fe.y(),width:Math.max(10,fe.width()),height:Math.max(10,fe.height()),rotation:fe.rotation()})},[h,a]);let A=0,B=0,Q=V,H=W,K;if(U&&(K={x:U.x,y:U.y,width:U.width,height:U.height}),R){const de=U?U.width:R.naturalWidth,fe=U?U.height:R.naturalHeight;if(E==="fit"){const se=de/fe,q=V/W;se>q?(Q=V,H=V/se,B=(W-H)/2):(H=W,Q=W*se,A=(V-Q)/2)}else if(E==="fill"&&!U){const se=R.naturalWidth,q=R.naturalHeight,oe=se/q,ye=V/W;if(oe>ye){const ke=q*ye;K={x:(se-ke)/2,y:0,width:ke,height:q}}else{const ke=se/ye;K={x:0,y:(q-ke)/2,width:se,height:ke}}Q=V,H=W}}const ae=M>0?de=>{const fe=Math.min(M,V/2,W/2);de.beginPath(),de.moveTo(fe,0),de.lineTo(V-fe,0),de.arcTo(V,0,V,fe,fe),de.lineTo(V,W-fe),de.arcTo(V,W,V-fe,W,fe),de.lineTo(fe,W),de.arcTo(0,W,0,W-fe,fe),de.lineTo(0,fe),de.arcTo(0,0,fe,0,fe),de.closePath()}:void 0,ie={id:h,x:y,y:_,width:V,height:W,rotation:w,transformsEnabled:w?"all":"position",draggable:!L&&!n,clipFunc:ae,onClick:()=>s(h),onTap:()=>s(h),onDblClick:()=>u==null?void 0:u(h),onDblTap:()=>u==null?void 0:u(h),onDragMove:j,onDragEnd:Y,onTransform:X,onTransformEnd:ne};return!R||ee?Z.jsx(io,{...ie,children:Z.jsx(ya,{width:V,height:W,fill:"#f0f0f0",stroke:D.strokeColor,strokeWidth:D.strokeWidth,cornerRadius:M,opacity:D.opacity,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})}):Z.jsxs(io,{...ie,shadowColor:e?"#4f8df7":void 0,shadowBlur:e?6:0,shadowOpacity:e?.5:0,children:[E==="fit"&&Z.jsx(ya,{width:V,height:W,fill:D.fillColor==="transparent"?void 0:D.fillColor,cornerRadius:M}),Z.jsx(HE,{image:R,x:A,y:B,width:Q,height:H,crop:K,opacity:D.opacity,listening:!1,perfectDrawEnabled:!1}),D.strokeWidth>0&&D.strokeColor!=="transparent"&&Z.jsx(ya,{width:V,height:W,stroke:D.strokeColor,strokeWidth:D.strokeWidth,cornerRadius:M,listening:!1})]})},_9=te.memo(S9),x9=2,w9=24,b9=({element:t,isSelected:e,isEditing:n,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,autoEditText:p,onTextEditStart:h,onTextEditEnd:y,allElements:_,gridSnap:S,onDragSnap:x,viewportScale:w})=>{var D,U,M;const C=te.useCallback(()=>a(t.id),[a,t.id]);if(!t.isVisible)return null;if(w!==void 0&&!e&&!n){const E=Math.max(t.width,t.height)*w;if(E<x9)return null;if(E<w9)return Z.jsx(ya,{x:t.x,y:t.y,width:t.width,height:t.height,fill:((D=t.style)==null?void 0:D.fillColor)||"#e0e0e0",stroke:((U=t.style)==null?void 0:U.strokeColor)||"#999",strokeWidth:1/w,opacity:((M=t.style)==null?void 0:M.opacity)??1,onClick:C,onTap:C,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,transformsEnabled:"position"})}switch(t.type){case"rectangle":return Z.jsx(e9,{element:t,isSelected:e,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:S,onDragSnap:x});case"ellipse":return Z.jsx(n9,{element:t,isSelected:e,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:S,onDragSnap:x});case"diamond":return Z.jsx(i9,{element:t,isSelected:e,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:S,onDragSnap:x});case"line":return Z.jsx(c9,{element:t,isSelected:e,isEditing:n,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:S,allElements:_});case"arrow":return Z.jsx(p9,{element:t,isSelected:e,isEditing:n,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:S,allElements:_});case"freedraw":return Z.jsx(y9,{element:t,isSelected:e,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:S,onDragSnap:x});case"text":return Z.jsx(v9,{element:t,isSelected:e,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,autoEdit:p,onEditStart:h,onEditEnd:y,allElements:_,gridSnap:S});case"image":return Z.jsx(_9,{element:t,isSelected:e,isGrouped:s,onSelect:a,onChange:l,onDragMove:u,onDoubleClick:d,gridSnap:S,onDragSnap:x});default:return null}};function E9(t,e){return!(t.element!==e.element||t.isSelected!==e.isSelected||t.isEditing!==e.isEditing||t.isGrouped!==e.isGrouped||t.autoEditText!==e.autoEditText||t.viewportScale!==e.viewportScale||t.gridSnap!==e.gridSnap)}const Xm=te.memo(b9,E9);function C9(t,e){if(t.length===0)return"";const n=new Set(t),s=new Map;for(const l of e)if(n.has(l.id)&&(s.set(l.id,l),s.size===n.size))break;const a=[];for(const l of t){const u=s.get(l);u&&a.push(`${l}:${u.isLocked?1:0}:${u.type}`)}return a.join(",")}const T9=({selectedIds:t,selectionColor:e="#4f8df7"})=>{const n=te.useRef(null),s=De(h=>C9(t,h.elements)),{hasLocked:a,allLocked:l,allText:u}=te.useMemo(()=>{if(!s||t.length===0)return{hasLocked:!1,allLocked:!1,allText:!1};const h=s.split(",");let y=0,_=0;for(const S of h){const x=S.split(":");x[1]==="1"&&y++,x[2]==="text"&&_++}return{hasLocked:y>0,allLocked:y===h.length,allText:_===h.length}},[s,t.length]),d=u?["top-left","top-right","bottom-left","bottom-right"]:["top-left","top-right","bottom-left","bottom-right","middle-left","middle-right","top-center","bottom-center"];if(te.useEffect(()=>{var S;const h=n.current;if(!h)return;const y=h.getStage();if(!y)return;const _=t.map(x=>y.findOne(`#${x}`)).filter(Boolean);h.nodes(_),(S=h.getLayer())==null||S.batchDraw()},[t]),t.length===0)return null;const p=a?"#ff9500":e;return Z.jsx(VE,{ref:n,flipEnabled:!1,keepRatio:u,resizeEnabled:!l,rotateEnabled:!l,boundBoxFunc:(h,y)=>l||Math.abs(y.width)<5||Math.abs(y.height)<5?h:y,anchorFill:l?"#ff9500":"#ffffff",anchorStroke:p,anchorSize:l?0:8,anchorCornerRadius:2,borderStroke:p,borderStrokeWidth:1,borderDash:l?[6,3]:[4,4],rotateAnchorOffset:25,enabledAnchors:l?[]:d})},k9=te.memo(T9),M9=({width:t,height:e,viewport:n,gridColor:s="#e5e5e5"})=>{const{x:a,y:l,scale:u}=n,d=ru,p=te.useMemo(()=>{const h=Math.floor((-a/u-d)/d)*d,y=Math.ceil((-a/u+t/u+d)/d)*d,_=Math.floor((-l/u-d)/d)*d,S=Math.ceil((-l/u+e/u+d)/d)*d;return{startX:h,endX:y,startY:_,endY:S}},[a,l,u,t,e,d]);return Z.jsx(Ss,{sceneFunc:h=>{const{startX:y,endX:_,startY:S,endY:x}=p,w=1/u,C=h._context;C.beginPath(),C.strokeStyle=s,C.lineWidth=w;for(let D=y;D<=_;D+=d)C.moveTo(D,S),C.lineTo(D,x);for(let D=S;D<=x;D+=d)C.moveTo(y,D),C.lineTo(_,D);C.stroke()},listening:!1,perfectDrawEnabled:!1})},D9=te.memo(M9),A9=({box:t,selectionColor:e="#4f8df7"})=>t?Z.jsx(ya,{x:t.x,y:t.y,width:t.width,height:t.height,fill:`${e}14`,stroke:e,strokeWidth:1,dash:[4,4],listening:!1}):null,R9=te.memo(A9),il=6,L9=({el:t,color:e})=>{const n=t.x+t.width/2,s=t.y+t.height/2,a=t.rotation||0;switch(t.type){case"ellipse":return Z.jsx(u5,{x:n,y:s,radiusX:t.width/2+il,radiusY:t.height/2+il,rotation:a,stroke:e,strokeWidth:2,dash:[8,4],fill:e,opacity:.1,listening:!1,perfectDrawEnabled:!1});case"diamond":{const l=t.width+il*2,u=t.height+il*2,d=[l/2,0,l,u/2,l/2,u,0,u/2];return Z.jsx(Ui,{x:n-l/2,y:s-u/2,points:d,closed:!0,rotation:a,offsetX:0,offsetY:0,stroke:e,strokeWidth:2,dash:[8,4],fill:e,opacity:.1,listening:!1,perfectDrawEnabled:!1})}default:return Z.jsx(ya,{x:n,y:s,offsetX:t.width/2+il,offsetY:t.height/2+il,width:t.width+il*2,height:t.height+il*2,rotation:a,stroke:e,strokeWidth:2,dash:[8,4],cornerRadius:6,fill:e,opacity:.1,listening:!1,perfectDrawEnabled:!1})}},N9=({elements:t,snapTarget:e,visible:n,color:s="#4f8df7"})=>{if(!n||!e)return null;const a=t.find(l=>l.id===e.elementId&&Pm(l));return a?Z.jsxs(Z.Fragment,{children:[Z.jsx(L9,{el:a,color:s}),Z.jsx(Gf,{x:e.position.x,y:e.position.y,radius:6,fill:s,stroke:"white",strokeWidth:2,listening:!1,perfectDrawEnabled:!1}),!e.isPrecise&&(()=>{const l=a.rotation||0,u={x:a.x+a.width/2,y:a.y+a.height/2},d=l!==0?X5(u,{x:a.x,y:a.y},l*Math.PI/180):u;return Z.jsx(Gf,{x:d.x,y:d.y,radius:4,fill:"white",stroke:s,strokeWidth:2,listening:!1,perfectDrawEnabled:!1})})()]}):null},P9=te.memo(N9),lx=4,O9=3,I9="#ffffff",F9="#4f8df7",U9="#2563eb",B9="#4f8df7",z9=5,H9="#ff6b35",G9="#ffffff";function V9(t){const e=[];for(let n=0;n<t.length;n+=2)e.push({x:t[n],y:t[n+1]});return e}function cx(t,e){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}const Y9=({element:t,allElements:e,onPointsChange:n,onPointDragMove:s,onSnapTargetChange:a,color:l="#4f8df7"})=>{const{selectedPointIndices:u,hoveredPointIndex:d,hoveredMidpointIndex:p,setSelectedPoints:h,togglePointSelection:y,setHoveredPoint:_,setHoveredMidpoint:S,setIsDraggingPoint:x}=Jf(),{id:w,x:C,y:D,points:U}=t,M=V9(U),E=te.useRef(null),L=te.useRef(null),R=te.useRef(void 0),z="lineType"in t&&t.lineType==="curved",ee="lineType"in t&&t.lineType==="elbow",O=z||ee,I=te.useCallback(X=>X===0||X===M.length-1,[M.length]),F=te.useCallback(X=>{x(!0),E.current={points:[...U],x:C,y:D},R.current=void 0,u.includes(X)||h([X])},[U,C,D,u,h,x]),V=te.useCallback((X,ne)=>{const A=ne.target,B=A.x(),Q=A.y(),H=[...U];H[X*2]=B-C,H[X*2+1]=Q-D;const K={};if(I(X)){const ae=A.getStage(),ie=ae==null?void 0:ae.getRelativePointerPosition(),de=(ie==null?void 0:ie.x)??B,fe=(ie==null?void 0:ie.y)??Q;L.current={x:de,y:fe};const se={x:de,y:fe},q=new Set([w]),oe=X===0?t.endBinding:t.startBinding;oe&&q.add(oe.elementId);const ye=el(t.style.strokeWidth??2),ke=Kl(se,e,24,q,void 0,void 0,ye,R.current);if(a==null||a(ke),R.current=ke==null?void 0:ke.isPrecise,ke){const Ae=ke.position;H[X*2]=Ae.x-C,H[X*2+1]=Ae.y-D,A.x(Ae.x),A.y(Ae.y);const Me={elementId:ke.elementId,fixedPoint:ke.fixedPoint,gap:ye,isPrecise:ke.isPrecise};X===0?K.startBinding=Me:K.endBinding=Me}else X===0?K.startBinding=null:K.endBinding=null}s==null||s(w,{points:H,x:C,y:D,...K})},[U,C,D,w,t,e,I,s,a]),W=te.useCallback((X,ne)=>{x(!1);const A=ne.target;let B,Q;I(X)&&L.current?(B=L.current.x,Q=L.current.y):(B=A.x(),Q=A.y()),L.current=null;const H=[...U];H[X*2]=B-C,H[X*2+1]=Q-D;const K={points:H};if(I(X)){const q={x:B,y:Q},oe=new Set([w]),ye=X===0?t.endBinding:t.startBinding;ye&&oe.add(ye.elementId);const ke=el(t.style.strokeWidth??2),Ae=Kl(q,e,24,oe,void 0,void 0,ke,R.current);if(a==null||a(null),R.current=void 0,Ae){const Me=el(t.style.strokeWidth??2),be={elementId:Ae.elementId,fixedPoint:Ae.fixedPoint,gap:Me,isPrecise:Ae.isPrecise};X===0?K.startBinding=be:K.endBinding=be,H[X*2]=Ae.position.x-C,H[X*2+1]=Ae.position.y-D,K.points=H}else X===0?K.startBinding=null:K.endBinding=null}const ae=K.points??H,ie=ae[0],de=ae[1];if(ie!==0||de!==0){const q=[];for(let oe=0;oe<ae.length;oe+=2)q.push(ae[oe]-ie,ae[oe+1]-de);K.x=C+ie,K.y=D+de,K.points=q}const fe=K.points??ae,se=ag(fe);K.width=se.width,K.height=se.height,n(w,K),E.current=null},[U,C,D,w,M,t,e,I,x,n,a]),j=te.useCallback((X,ne)=>{ne.cancelBubble=!0,ne.evt.shiftKey?y(X):h([X])},[h,y]),Y=te.useCallback((X,ne)=>{ne.cancelBubble=!0;const A=M[X],B=M[X+1],Q=cx(A,B),H=X+1,K=[];for(let ie=0;ie<M.length;ie++)K.push(M[ie].x,M[ie].y),ie===X&&K.push(Q.x,Q.y);const ae=ag(K);h([H]),S(null),n(w,{points:K,width:ae.width,height:ae.height})},[w,M,h,S,n]);return Z.jsxs(io,{children:[!O&&M.length>=2&&M.slice(0,-1).map((X,ne)=>{const A=M[ne+1],B=cx(X,A),Q=p===ne;return Z.jsx(Gf,{x:C+B.x,y:D+B.y,radius:O9,fill:Q?U9:F9,opacity:Q?.9:.5,stroke:"white",strokeWidth:1.5,onMouseEnter:()=>S(ne),onMouseLeave:()=>S(null),onClick:H=>Y(ne,H),onTap:H=>Y(ne,H),hitStrokeWidth:10,perfectDrawEnabled:!1},`mid-${ne}`)}),M.map((X,ne)=>{const A=I(ne);if(O&&!A)return null;const B=u.includes(ne),Q=d===ne,H=A?lx+1:lx;return Z.jsx(Gf,{x:C+X.x,y:D+X.y,radius:H,fill:B?B9:I9,stroke:Q||B?"#2563eb":l,strokeWidth:B?2.5:2,draggable:!0,onMouseEnter:()=>_(ne),onMouseLeave:()=>_(-1),onClick:K=>j(ne,K),onTap:K=>j(ne,K),onDragStart:()=>F(ne),onDragMove:K=>V(ne,K),onDragEnd:K=>W(ne,K),hitStrokeWidth:10,perfectDrawEnabled:!1},`pt-${ne}`)}),z&&M.length>=2&&(()=>{const X=M[0],ne=M[M.length-1],A=t.curvature??ma,B=va(X,ne,A),Q=ou(X,B,ne,.5);return Z.jsx(Gf,{x:C+Q.x,y:D+Q.y,radius:z9,fill:H9,stroke:G9,strokeWidth:2,draggable:!0,onDragStart:()=>x(!0),onDragMove:H=>{const K=H.target,ae={x:C+X.x,y:D+X.y},ie={x:C+ne.x,y:D+ne.y},de={x:K.x(),y:K.y()},fe=K5(ae,ie,de),se=va(X,ne,fe),q=ou(X,se,ne,.5);K.x(C+q.x),K.y(D+q.y),s==null||s(w,{curvature:fe})},onDragEnd:H=>{x(!1);const K=H.target,ae={x:C+X.x,y:D+X.y},ie={x:C+ne.x,y:D+ne.y},de={x:K.x(),y:K.y()},fe=K5(ae,ie,de),se=va(X,ne,fe),q=ou(X,se,ne,.5);K.x(C+q.x),K.y(D+q.y),n(w,{curvature:fe})},hitStrokeWidth:12,perfectDrawEnabled:!1},"curve-handle")})()]})},j9=te.memo(Y9);/**
|
|
187
|
+
* @license lucide-react v0.468.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const W9=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ux=(...t)=>t.filter((e,n,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===n).join(" ").trim();/**
|
|
192
|
+
* @license lucide-react v0.468.0 - ISC
|
|
193
|
+
*
|
|
194
|
+
* This source code is licensed under the ISC license.
|
|
195
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
+
*/var X9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
197
|
+
* @license lucide-react v0.468.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/const q9=te.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:l,iconNode:u,...d},p)=>te.createElement("svg",{ref:p,...X9,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:ux("lucide",a),...d},[...u.map(([h,y])=>te.createElement(h,y)),...Array.isArray(l)?l:[l]]));/**
|
|
202
|
+
* @license lucide-react v0.468.0 - ISC
|
|
203
|
+
*
|
|
204
|
+
* This source code is licensed under the ISC license.
|
|
205
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
+
*/const hr=(t,e)=>{const n=te.forwardRef(({className:s,...a},l)=>te.createElement(q9,{ref:l,iconNode:e,className:ux(`lucide-${W9(t)}`,s),...a}));return n.displayName=`${t}`,n};/**
|
|
207
|
+
* @license lucide-react v0.468.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const K9=hr("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
|
|
212
|
+
* @license lucide-react v0.468.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const Q9=hr("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
217
|
+
* @license lucide-react v0.468.0 - ISC
|
|
218
|
+
*
|
|
219
|
+
* This source code is licensed under the ISC license.
|
|
220
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
+
*/const J9=hr("Diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]);/**
|
|
222
|
+
* @license lucide-react v0.468.0 - ISC
|
|
223
|
+
*
|
|
224
|
+
* This source code is licensed under the ISC license.
|
|
225
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
+
*/const Z9=hr("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
227
|
+
* @license lucide-react v0.468.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/const $9=hr("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
|
|
232
|
+
* @license lucide-react v0.468.0 - ISC
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the ISC license.
|
|
235
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
+
*/const e7=hr("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
237
|
+
* @license lucide-react v0.468.0 - ISC
|
|
238
|
+
*
|
|
239
|
+
* This source code is licensed under the ISC license.
|
|
240
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
+
*/const t7=hr("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/**
|
|
242
|
+
* @license lucide-react v0.468.0 - ISC
|
|
243
|
+
*
|
|
244
|
+
* This source code is licensed under the ISC license.
|
|
245
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
+
*/const n7=hr("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
247
|
+
* @license lucide-react v0.468.0 - ISC
|
|
248
|
+
*
|
|
249
|
+
* This source code is licensed under the ISC license.
|
|
250
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
+
*/const r7=hr("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
|
|
252
|
+
* @license lucide-react v0.468.0 - ISC
|
|
253
|
+
*
|
|
254
|
+
* This source code is licensed under the ISC license.
|
|
255
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
+
*/const i7=hr("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
257
|
+
* @license lucide-react v0.468.0 - ISC
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the ISC license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/const s7=hr("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/**
|
|
262
|
+
* @license lucide-react v0.468.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/const a7=hr("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
267
|
+
* @license lucide-react v0.468.0 - ISC
|
|
268
|
+
*
|
|
269
|
+
* This source code is licensed under the ISC license.
|
|
270
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
+
*/const o7=hr("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/**
|
|
272
|
+
* @license lucide-react v0.468.0 - ISC
|
|
273
|
+
*
|
|
274
|
+
* This source code is licensed under the ISC license.
|
|
275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
+
*/const l7=hr("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
277
|
+
* @license lucide-react v0.468.0 - ISC
|
|
278
|
+
*
|
|
279
|
+
* This source code is licensed under the ISC license.
|
|
280
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
+
*/const c7=hr("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
282
|
+
* @license lucide-react v0.468.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/const u7=hr("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
|
|
287
|
+
* @license lucide-react v0.468.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/const d7=hr("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
|
|
292
|
+
* @license lucide-react v0.468.0 - ISC
|
|
293
|
+
*
|
|
294
|
+
* This source code is licensed under the ISC license.
|
|
295
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
+
*/const f7=hr("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
|
|
297
|
+
* @license lucide-react v0.468.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/const h7=hr("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),p7={Hand:Z.jsx(t7,{size:18}),MousePointer2:Z.jsx(s7,{size:18}),Square:Z.jsx(l7,{size:18}),Circle:Z.jsx(Q9,{size:18}),Diamond:Z.jsx(J9,{size:18}),Minus:Z.jsx(i7,{size:18}),ArrowUpRight:Z.jsx(K9,{size:18}),Pencil:Z.jsx(a7,{size:18}),Type:Z.jsx(u7,{size:18}),ImageIcon:Z.jsx(n7,{size:18}),Eraser:Z.jsx($9,{size:18})},yi={bar:t=>({position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",zIndex:50,display:"flex",alignItems:"center",gap:2,background:t.toolbarBg,backdropFilter:"blur(8px)",boxShadow:"0 2px 8px rgba(0,0,0,0.08)",borderRadius:12,padding:"5px 8px",border:`1px solid ${t.toolbarBorder}`}),btn:(t,e)=>({display:"flex",alignItems:"center",justifyContent:"center",width:34,height:34,borderRadius:8,border:"none",cursor:"pointer",transition:"background 150ms, color 150ms",background:t?`${e.activeToolColor}18`:"transparent",color:t?e.activeToolColor:e.mutedTextColor,outline:t?`1px solid ${e.activeToolColor}40`:"none"}),sep:t=>({width:1,height:24,background:t.toolbarBorder,margin:"0 4px"}),zoomText:t=>({fontSize:11,color:t.mutedTextColor,minWidth:40,textAlign:"center",userSelect:"none"})},g7=({visibleTools:t,theme:e})=>{const n=De(D=>D.activeTool),s=De(D=>D.setActiveTool),a=De(D=>D.undo),l=De(D=>D.redo),u=De(D=>D.selectedIds),d=De(D=>D.deleteElements),p=De(D=>D.showGrid),h=De(D=>D.toggleGrid),y=De(D=>D.zoomIn),_=De(D=>D.zoomOut),S=De(D=>D.resetZoom),x=De(D=>D.viewport.scale),w=De(D=>D.elements),C=()=>{const D=JSON.stringify(w,null,2),U=new Blob([D],{type:"application/json"}),M=URL.createObjectURL(U),E=document.createElement("a");E.download="canvas.json",E.href=M,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(M)};return Z.jsxs("div",{style:yi.bar(e),children:[t.map(D=>Z.jsx("button",{style:yi.btn(n===D.type,e),onClick:()=>s(D.type),title:`${D.label} (${D.shortcut})`,children:p7[D.icon]},D.type)),Z.jsx("div",{style:yi.sep(e)}),Z.jsx("button",{style:yi.btn(!1,e),onClick:a,title:"Undo (⌘Z)",children:Z.jsx(d7,{size:18})}),Z.jsx("button",{style:yi.btn(!1,e),onClick:l,title:"Redo (⌘⇧Z)",children:Z.jsx(o7,{size:18})}),Z.jsx("div",{style:yi.sep(e)}),Z.jsx("button",{style:{...yi.btn(!1,e),opacity:u.length===0?.3:1},onClick:()=>d(u),disabled:u.length===0,title:"Delete (Del)",children:Z.jsx(c7,{size:18})}),Z.jsx("button",{style:yi.btn(p,e),onClick:h,title:"Toggle Grid (G)",children:Z.jsx(e7,{size:18})}),Z.jsx("div",{style:yi.sep(e)}),Z.jsx("button",{style:yi.btn(!1,e),onClick:()=>_(),title:"Zoom Out",children:Z.jsx(h7,{size:18})}),Z.jsxs("span",{style:yi.zoomText(e),children:[Math.round(x*100),"%"]}),Z.jsx("button",{style:yi.btn(!1,e),onClick:()=>y(),title:"Zoom In",children:Z.jsx(f7,{size:18})}),Z.jsx("button",{style:yi.btn(!1,e),onClick:()=>S(),title:"Reset Zoom",children:Z.jsx(r7,{size:18})}),Z.jsx("div",{style:yi.sep(e)}),Z.jsx("button",{style:yi.btn(!1,e),onClick:C,title:"Export JSON",children:Z.jsx(Z9,{size:18})})]})},qm=20,y7=3,m7=7,v7=[{value:1,label:"Thin",thickness:1},{value:2,label:"Normal",thickness:2},{value:4,label:"Bold",thickness:3.5},{value:6,label:"Extra Bold",thickness:5.5}],S7=[{value:"solid",label:"Solid"},{value:"dashed",label:"Dashed"},{value:"dotted",label:"Dotted"}],_7=({thickness:t,color:e})=>Z.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",children:Z.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:e,strokeWidth:t,strokeLinecap:"round"})}),x7=({style:t,color:e})=>Z.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",children:Z.jsx("line",{x1:"1",y1:"7",x2:"13",y2:"7",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:t==="dashed"?"3.5 2.5":t==="dotted"?"1 2.5":void 0})}),w7=({level:t,color:e})=>Z.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",children:t===0?Z.jsx("path",{d:"M2,9 Q5,5 7,7 Q9,9 12,5",fill:"none",stroke:e,strokeWidth:"1.4",strokeLinecap:"round"}):t===1?Z.jsx("path",{d:"M2,9 Q3.5,3 6,8 Q8,13 10,6 Q11,3 12,5",fill:"none",stroke:e,strokeWidth:"1.4",strokeLinecap:"round"}):Z.jsx("path",{d:"M1,8 Q3,3 4.5,9 Q6,13 7,6 Q8.5,1 10,9 Q11.5,13 13,6",fill:"none",stroke:e,strokeWidth:"1.4",strokeLinecap:"round"})}),b7=({type:t,color:e})=>Z.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",children:t==="sharp"?Z.jsx("polyline",{points:"2,11 7,3 12,11",fill:"none",stroke:e,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}):t==="elbow"?Z.jsx("polyline",{points:"2,11 2,3 12,3 12,11",fill:"none",stroke:e,strokeWidth:"1.3",strokeLinecap:"square",strokeLinejoin:"miter"}):Z.jsx("path",{d:"M2,11 Q7,0 12,11",fill:"none",stroke:e,strokeWidth:"1.3",strokeLinecap:"round"})}),dx=({arrowhead:t,end:e,color:n})=>{var a;const s=t?((a=Mm.find(l=>l.type===t))==null?void 0:a.preview)??"—":"×";return Z.jsxs("svg",{width:"32",height:"14",viewBox:"0 0 32 14",children:[Z.jsx("line",{x1:"4",y1:"7",x2:"28",y2:"7",stroke:n,strokeWidth:"1.3",strokeLinecap:"round"}),e==="start"?Z.jsx("text",{x:"1",y:"11",fontSize:"10",fill:n,fontFamily:"system-ui",children:s}):Z.jsx("text",{x:"21",y:"11",fontSize:"10",fill:n,fontFamily:"system-ui",textAnchor:"start",children:s})]})},sl=({children:t,color:e,size:n=14})=>Z.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t}),fg={sendToBack:t=>Z.jsxs(sl,{color:t,children:[Z.jsx("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),Z.jsx("path",{d:"M17 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2z",opacity:"0.3"}),Z.jsx("polyline",{points:"12 12 12 18"}),Z.jsx("polyline",{points:"9 15 12 18 15 15"})]}),sendBackward:t=>Z.jsxs(sl,{color:t,children:[Z.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),Z.jsx("polyline",{points:"19 12 12 19 5 12"})]}),bringForward:t=>Z.jsxs(sl,{color:t,children:[Z.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),Z.jsx("polyline",{points:"5 12 12 5 19 12"})]}),bringToFront:t=>Z.jsxs(sl,{color:t,children:[Z.jsx("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),Z.jsx("path",{d:"M17 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2z",opacity:"0.3"}),Z.jsx("polyline",{points:"12 18 12 12"}),Z.jsx("polyline",{points:"9 15 12 12 15 15"})]})},hg={duplicate:t=>Z.jsxs(sl,{color:t,children:[Z.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"}),Z.jsx("path",{d:"M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"})]}),delete:t=>Z.jsxs(sl,{color:t,children:[Z.jsx("polyline",{points:"3 6 5 6 21 6"}),Z.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),Z.jsx("path",{d:"M10 11v6"}),Z.jsx("path",{d:"M14 11v6"}),Z.jsx("path",{d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"})]}),link:t=>Z.jsxs(sl,{color:t,children:[Z.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),Z.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),ungroup:t=>Z.jsxs(sl,{color:t,children:[Z.jsx("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1",strokeDasharray:"3 2"}),Z.jsx("rect",{x:"14",y:"14",width:"8",height:"8",rx:"1",strokeDasharray:"3 2"}),Z.jsx("path",{d:"M14 2h4a2 2 0 0 1 2 2v4"}),Z.jsx("path",{d:"M2 14v4a2 2 0 0 0 2 2h4"})]})},E7=({theme:t})=>{const e=De(le=>le.currentStyle),n=De(le=>le.setCurrentStyle),s=De(le=>le.selectedIds),a=De(le=>le.elements),l=De(le=>le.updateElement),u=De(le=>le.pushHistory),d=De(le=>le.toggleLockElements),p=De(le=>le.deleteElements),h=De(le=>le.duplicateElements),y=De(le=>le.bringToFront),_=De(le=>le.sendToBack),S=De(le=>le.bringForward),x=De(le=>le.sendBackward),w=De(le=>le.activeTool),C=De(le=>le.currentLineType),D=De(le=>le.setCurrentLineType),U=De(le=>le.currentStartArrowhead),M=De(le=>le.setCurrentStartArrowhead),E=De(le=>le.currentEndArrowhead),L=De(le=>le.setCurrentEndArrowhead),[R,z]=te.useState(null),ee=te.useRef(null),[O,I]=te.useState(null);te.useEffect(()=>{if(!R)return;const le=Ee=>{ee.current&&!ee.current.contains(Ee.target)&&z(null)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[R]);const F=te.useMemo(()=>s.some(le=>{var Ee;return((Ee=a.find(yt=>yt.id===le))==null?void 0:Ee.type)==="text"}),[s,a]),V=te.useMemo(()=>{const le=s.length===1?a.find(Ee=>Ee.id===s[0]):null;return le&&(le.type==="arrow"||le.type==="line")?le:null},[s,a]),W=te.useMemo(()=>{const le=s.length===1?a.find(Ee=>Ee.id===s[0]):null;return!le||le.type!=="image"?null:le},[s,a]),j=te.useMemo(()=>{if(s.length===0)return null;const le=a.filter(xt=>s.includes(xt.id)),Ee=le.every(xt=>xt.isLocked),yt=le.some(xt=>xt.isLocked);return{allLocked:Ee,anyLocked:yt}},[s,a]),Y=(V==null?void 0:V.type)==="arrow",X=V!=null,ne=s.length>0,A=w==="arrow"||w==="line",B=w==="arrow",Q=X||A,H=Y||B,K=te.useMemo(()=>{if(s.length===0)return e;if(s.length===1){const Ee=a.find(yt=>yt.id===s[0]);if(Ee)return Ee.style}const le=a.find(Ee=>s.includes(Ee.id));return le?le.style:e},[s,a,e]),ae=le=>{n(le),s.length>0&&(s.forEach(Ee=>{const yt=a.find(xt=>xt.id===Ee);yt&&l(Ee,{style:{...yt.style,...le}})}),u())},ie=Math.round(K.opacity*100),de={position:"absolute",left:12,top:64,zIndex:50,width:188,background:t.panelBg,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",boxShadow:"0 1px 4px rgba(0,0,0,0.05), 0 3px 12px rgba(0,0,0,0.07)",borderRadius:10,padding:"10px 10px 8px",border:`1px solid ${t.toolbarBorder}`,maxHeight:"calc(100vh - 90px)",overflowY:"auto",fontFamily:"system-ui, -apple-system, sans-serif"},fe={marginBottom:10},se={display:"block",fontSize:10,fontWeight:600,color:t.mutedTextColor,marginBottom:4,letterSpacing:.2},q=(le,Ee)=>({width:qm,height:qm,borderRadius:4,border:Ee?`2px solid ${t.activeToolColor}`:"1.5px solid #d5d8dc",cursor:"pointer",background:le==="transparent"?"repeating-conic-gradient(#d1d5db 0% 25%, transparent 0% 50%) 50%/6px 6px":le,boxShadow:Ee?`0 0 0 1.5px ${t.activeToolColor}30`:"none",outline:"none",flexShrink:0,transition:"border-color 0.1s, box-shadow 0.1s",padding:0}),oe=(le,Ee)=>({width:38,height:38,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,border:le?`1.5px solid ${t.activeToolColor}`:"1px solid #e0e3e7",background:le?`${t.activeToolColor}10`:Ee&&O===Ee?"#f3f4f6":"transparent",cursor:"pointer",color:le?t.activeToolColor:t.textColor,transition:"background 0.1s, border-color 0.1s",outline:"none",padding:0}),ye=le=>({width:38,height:38,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,border:"1px solid #e0e3e7",background:O===le?"#f3f4f6":"transparent",cursor:"pointer",color:t.textColor,transition:"background 0.1s",outline:"none",padding:0}),ke={height:1,background:t.toolbarBorder,margin:"8px 0",border:"none"},Ae={display:"grid",gridTemplateColumns:`repeat(${m7}, ${qm}px)`,gap:y7},Me={display:"flex",gap:3,justifyContent:"flex-start"},be=(le,Ee)=>({flex:1,display:"flex",alignItems:"center",justifyContent:"center",height:38,borderRadius:6,border:le?`1.5px solid ${t.activeToolColor}`:"1px solid #e0e3e7",background:le?`${t.activeToolColor}10`:O===Ee?"#f3f4f6":"transparent",cursor:"pointer",color:le?t.activeToolColor:t.textColor,transition:"background 0.1s",outline:"none",padding:0}),He={position:"absolute",left:0,right:0,top:"100%",marginTop:3,background:t.panelBg,border:`1px solid ${t.toolbarBorder}`,borderRadius:6,padding:4,boxShadow:"0 3px 12px rgba(0,0,0,0.1)",zIndex:100,display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:1},$e=(le,Ee)=>({display:"flex",alignItems:"center",justifyContent:"center",height:24,borderRadius:4,border:le?`1.5px solid ${t.activeToolColor}`:"1px solid transparent",background:le?`${t.activeToolColor}10`:O===Ee?"#f3f4f6":"transparent",cursor:"pointer",fontSize:11,color:le?t.activeToolColor:t.textColor,outline:"none",padding:0}),Ct=le=>({flex:1,padding:"3px 0",borderRadius:4,border:le?`1.5px solid ${t.activeToolColor}`:"1px solid #e0e3e7",background:le?`${t.activeToolColor}10`:"transparent",cursor:"pointer",fontSize:10,fontWeight:500,color:le?t.activeToolColor:t.textColor,textAlign:"center",outline:"none"});return Z.jsxs("div",{style:de,children:[Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Stroke"}),Z.jsx("div",{style:Ae,children:g5.map(le=>Z.jsx("button",{style:q(le,K.strokeColor===le),onClick:()=>ae({strokeColor:le}),title:le},le))})]}),!X&&!A&&Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Background"}),Z.jsx("div",{style:Ae,children:y5.map(le=>Z.jsx("button",{style:q(le,K.fillColor===le),onClick:()=>ae({fillColor:le}),title:le==="transparent"?"None":le},le))})]}),Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Stroke width"}),Z.jsx("div",{style:Me,children:v7.map(le=>{const Ee=K.strokeWidth===le.value,yt=`sw-${le.value}`;return Z.jsx("button",{style:oe(Ee,yt),onClick:()=>ae({strokeWidth:le.value}),title:le.label,onMouseEnter:()=>I(yt),onMouseLeave:()=>I(null),children:Z.jsx(_7,{thickness:le.thickness,color:Ee?t.activeToolColor:t.textColor})},le.value)})})]}),Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Stroke style"}),Z.jsx("div",{style:Me,children:S7.map(le=>{const Ee=K.strokeStyle===le.value,yt=`ss-${le.value}`;return Z.jsx("button",{style:oe(Ee,yt),onClick:()=>ae({strokeStyle:le.value}),title:le.label,onMouseEnter:()=>I(yt),onMouseLeave:()=>I(null),children:Z.jsx(x7,{style:le.value,color:Ee?t.activeToolColor:t.textColor})},le.value)})})]}),Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Sloppiness"}),Z.jsx("div",{style:Me,children:v5.map(le=>{const Ee=K.roughness===le.value,yt=`sl-${le.value}`;return Z.jsx("button",{style:oe(Ee,yt),onClick:()=>ae({roughness:le.value}),title:le.label,onMouseEnter:()=>I(yt),onMouseLeave:()=>I(null),children:Z.jsx(w7,{level:le.value,color:Ee?t.activeToolColor:t.textColor})},le.value)})})]}),Q&&Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:Y||B?"Arrow type":"Line type"}),Z.jsx("div",{style:Me,children:m5.map(le=>{const Ee=V?V.lineType===le.type:C===le.type,yt=`lt-${le.type}`;return Z.jsx("button",{style:oe(Ee,yt),title:le.label,onMouseEnter:()=>I(yt),onMouseLeave:()=>I(null),onClick:()=>{if(V){const xt={lineType:le.type};if(le.type==="curved"||le.type==="elbow"){const Et=V;Et.points.length>4&&(xt.points=[Et.points[0],Et.points[1],Et.points[Et.points.length-2],Et.points[Et.points.length-1]])}l(V.id,xt),u()}D(le.type)},children:Z.jsx(b7,{type:le.type,color:Ee?t.activeToolColor:t.textColor})},le.type)})})]}),H&&Z.jsxs("div",{style:{...fe,position:"relative"},ref:ee,children:[Z.jsx("span",{style:se,children:"Arrowheads"}),Z.jsxs("div",{style:Me,children:[Z.jsx("button",{style:be(R==="start","ah-start"),title:`Start: ${V?V.startArrowhead??"None":U??"None"}`,onClick:()=>z(R==="start"?null:"start"),onMouseEnter:()=>I("ah-start"),onMouseLeave:()=>I(null),children:Z.jsx(dx,{arrowhead:V?V.startArrowhead:U,end:"start",color:R==="start"?t.activeToolColor:t.textColor})}),Z.jsx("button",{style:be(R==="end","ah-end"),title:`End: ${V?V.endArrowhead??"None":E??"None"}`,onClick:()=>z(R==="end"?null:"end"),onMouseEnter:()=>I("ah-end"),onMouseLeave:()=>I(null),children:Z.jsx(dx,{arrowhead:V?V.endArrowhead:E,end:"end",color:R==="end"?t.activeToolColor:t.textColor})})]}),R&&Z.jsx("div",{style:He,children:Mm.map(le=>{const yt=(V?R==="start"?V.startArrowhead:V.endArrowhead:R==="start"?U:E)===le.type,xt=`ahg-${le.type??"none"}`;return Z.jsx("button",{style:$e(yt,xt),title:le.label,onMouseEnter:()=>I(xt),onMouseLeave:()=>I(null),onClick:()=>{if(V){const Et=R==="start"?"startArrowhead":"endArrowhead";l(V.id,{[Et]:le.type}),u()}R==="start"?M(le.type):L(le.type),z(null)},children:le.preview},le.type??"none")})})]}),Z.jsxs("div",{style:fe,children:[Z.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:3},children:[Z.jsx("span",{style:se,children:"Opacity"}),Z.jsxs("span",{style:{fontSize:10,fontWeight:500,color:t.textColor},children:[ie,"%"]})]}),Z.jsx("input",{type:"range",min:"0",max:"100",step:"1",value:ie,onChange:le=>ae({opacity:parseInt(le.target.value)/100}),style:{width:"100%",accentColor:t.activeToolColor,height:4}})]}),F&&Z.jsxs(Z.Fragment,{children:[Z.jsx("hr",{style:ke}),Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Font size"}),Z.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:2},children:KE.map(le=>Z.jsx("button",{style:{...Ct(K.fontSize===le),flex:"none",width:28,padding:"2px 0"},onClick:()=>ae({fontSize:le}),children:le},le))})]}),Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Font family"}),Z.jsx("select",{value:K.fontFamily,onChange:le=>ae({fontFamily:le.target.value}),style:{width:"100%",padding:"4px 6px",borderRadius:4,border:`1px solid ${t.toolbarBorder}`,background:t.panelBg,color:t.textColor,fontSize:10,cursor:"pointer",outline:"none"},children:QE.map(le=>Z.jsx("option",{value:le.value,children:le.label},le.value))})]})]}),W&&Z.jsxs(Z.Fragment,{children:[Z.jsx("hr",{style:ke}),Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Scale mode"}),Z.jsx("div",{style:Me,children:["stretch","fit","fill"].map(le=>{const Ee=W.scaleMode===le;return Z.jsx("button",{style:Ct(Ee),title:le==="stretch"?"Stretch to fill":le==="fit"?"Fit (contain)":"Fill (cover)",onClick:()=>{l(W.id,{scaleMode:le}),u()},children:le.charAt(0).toUpperCase()+le.slice(1)},le)})})]}),Z.jsxs("div",{style:fe,children:[Z.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:3},children:[Z.jsx("span",{style:se,children:"Corner radius"}),Z.jsxs("span",{style:{fontSize:10,fontWeight:500,color:t.textColor},children:[W.cornerRadius,"px"]})]}),Z.jsx("input",{type:"range",min:"0",max:"50",step:"1",value:W.cornerRadius,onChange:le=>{l(W.id,{cornerRadius:parseInt(le.target.value)}),u()},style:{width:"100%",accentColor:t.activeToolColor,height:4}})]}),Z.jsx("div",{style:fe,children:Z.jsx("button",{style:{width:"100%",padding:"5px 0",borderRadius:4,border:`1px solid ${t.toolbarBorder}`,background:"transparent",cursor:"pointer",fontSize:10,fontWeight:500,color:t.textColor,outline:"none"},onClick:()=>{const le=document.createElement("input");le.type="file",le.accept="image/*",le.onchange=async()=>{var xt;const Ee=(xt=le.files)==null?void 0:xt[0];if(!Ee)return;const yt=new FileReader;yt.onload=()=>{const Et=yt.result,Pt=new window.Image;Pt.onload=()=>{l(W.id,{src:Et,naturalWidth:Pt.naturalWidth,naturalHeight:Pt.naturalHeight}),u()},Pt.src=Et},yt.readAsDataURL(Ee)},le.click()},children:"Replace Image…"})})]}),ne&&Z.jsxs(Z.Fragment,{children:[Z.jsx("hr",{style:ke}),Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Layers"}),Z.jsx("div",{style:Me,children:[{fn:_,icon:fg.sendToBack,tip:"Send to back",key:"ly-stb"},{fn:x,icon:fg.sendBackward,tip:"Send backward",key:"ly-sb"},{fn:S,icon:fg.bringForward,tip:"Bring forward",key:"ly-bf"},{fn:y,icon:fg.bringToFront,tip:"Bring to front",key:"ly-btf"}].map(({fn:le,icon:Ee,tip:yt,key:xt})=>Z.jsx("button",{style:ye(xt),title:yt,onMouseEnter:()=>I(xt),onMouseLeave:()=>I(null),onClick:()=>{le(s),u()},children:Ee(O===xt?t.activeToolColor:t.textColor)},xt))})]}),Z.jsxs("div",{style:fe,children:[Z.jsx("span",{style:se,children:"Actions"}),Z.jsxs("div",{style:Me,children:[Z.jsx("button",{style:ye("act-dup"),title:"Duplicate (⌘D)",onMouseEnter:()=>I("act-dup"),onMouseLeave:()=>I(null),onClick:()=>h(s),children:hg.duplicate(O==="act-dup"?t.activeToolColor:t.textColor)}),Z.jsx("button",{style:ye("act-del"),title:"Delete (⌫)",onMouseEnter:()=>I("act-del"),onMouseLeave:()=>I(null),onClick:()=>{p(s),u()},children:hg.delete(O==="act-del"?"#e03131":t.textColor)}),Z.jsx("button",{style:{...ye("act-link"),opacity:.35,cursor:"not-allowed"},title:"Add link (coming soon)",disabled:!0,children:hg.link(t.mutedTextColor)}),Z.jsx("button",{style:ye("act-ung"),title:"Ungroup",onMouseEnter:()=>I("act-ung"),onMouseLeave:()=>I(null),onClick:()=>{De.getState().ungroupElements(s),u()},children:hg.ungroup(O==="act-ung"?t.activeToolColor:t.textColor)})]})]})]}),j&&ne&&Z.jsxs(Z.Fragment,{children:[Z.jsx("hr",{style:ke}),Z.jsx("button",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,width:"100%",padding:"5px 0",borderRadius:6,border:j.allLocked?"1.5px solid #ff9500":`1px solid ${t.toolbarBorder}`,background:j.allLocked?"#ff950010":"transparent",cursor:"pointer",fontSize:10,fontWeight:600,color:j.allLocked?"#ff9500":t.textColor,letterSpacing:.2,transition:"all 0.1s ease",outline:"none",marginBottom:2},title:j.allLocked?"Unlock position (⌘⇧L)":"Lock position (⌘⇧L)",onClick:()=>d(s),children:j.allLocked?Z.jsxs(Z.Fragment,{children:[Z.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Z.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),Z.jsx("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]}),"Unlock"]}):Z.jsxs(Z.Fragment,{children:[Z.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Z.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),Z.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Lock Position"]})})]})]})},C7=({x:t,y:e,items:n,onClose:s,theme:a})=>{const l=te.useRef(null),[u,d]=te.useState({x:t,y:e}),[p,h]=te.useState(!1),y=te.useRef(s);y.current=s,te.useEffect(()=>{const S=l.current;if(!S)return;const x=S.getBoundingClientRect(),w=S.parentElement;if(!w)return;const C=w.getBoundingClientRect();let D=t,U=e;t+x.width>C.width&&(D=Math.max(0,t-x.width)),e+x.height>C.height&&(U=Math.max(0,e-x.height)),d({x:D,y:U}),requestAnimationFrame(()=>h(!0))},[t,e]);const _=te.useCallback(()=>{y.current()},[]);return te.useEffect(()=>{const S=D=>{l.current&&!l.current.contains(D.target)&&_()},x=D=>{D.key==="Escape"&&_()},w=()=>_(),C=requestAnimationFrame(()=>{document.addEventListener("pointerdown",S,!0),document.addEventListener("keydown",x,!0),window.addEventListener("scroll",w,!0)});return()=>{cancelAnimationFrame(C),document.removeEventListener("pointerdown",S,!0),document.removeEventListener("keydown",x,!0),window.removeEventListener("scroll",w,!0)}},[_]),Z.jsx("div",{ref:l,style:{position:"absolute",left:u.x,top:u.y,zIndex:1e3,background:a.panelBg,border:`1px solid ${a.toolbarBorder}`,borderRadius:8,boxShadow:"0 4px 16px rgba(0,0,0,0.12)",padding:"4px 0",minWidth:180,backdropFilter:"blur(8px)",userSelect:"none",opacity:p?1:0,transform:p?"scale(1)":"scale(0.95)",transformOrigin:"top left",transition:"opacity 0.12s ease-out, transform 0.12s ease-out"},onContextMenu:S=>S.preventDefault(),children:n.map((S,x)=>Z.jsxs(te.Fragment,{children:[S.divider&&Z.jsx("div",{style:{height:1,background:a.toolbarBorder,margin:"4px 0"}}),Z.jsxs("button",{onClick:()=>{S.disabled||(S.action(),s())},disabled:S.disabled,style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 12px",border:"none",background:"transparent",color:S.disabled?a.mutedTextColor:a.textColor,fontSize:13,cursor:S.disabled?"default":"pointer",textAlign:"left",fontFamily:"inherit",lineHeight:"20px"},onMouseEnter:w=>{S.disabled||(w.currentTarget.style.background=a.activeToolColor+"18")},onMouseLeave:w=>{w.currentTarget.style.background="transparent"},children:[Z.jsx("span",{children:S.label}),S.shortcut&&Z.jsx("span",{style:{color:a.mutedTextColor,fontSize:11,marginLeft:24,opacity:.8},children:S.shortcut})]})]},x))})},T7=te.memo(C7);let Km=[];function rh(t){Km=structuredClone(t)}function Qm(){return structuredClone(Km)}function k7(){return Km.length>0}function fx(t){return t.toDataURL({pixelRatio:2})}function M7(t,e="canvas.png"){const n=fx(t),s=document.createElement("a");s.download=e,s.href=n,document.body.appendChild(s),s.click(),document.body.removeChild(s)}function hx(t){return JSON.stringify(t,null,2)}function D7(t,e="canvas.json"){const n=hx(t),s=new Blob([n],{type:"application/json"}),a=URL.createObjectURL(s),l=document.createElement("a");l.download=e,l.href=a,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}const pg=20;function xn(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ih(t,e){const n=Jr(t,e);return n.length>0?n.join(","):"none"}function Jm(t){const{strokeColor:e,fillColor:n,strokeWidth:s,opacity:a,strokeStyle:l}=t.style,u=ih(l,s),d=[`fill="${xn(n==="transparent"?"none":n)}"`,`stroke="${xn(e)}"`,`stroke-width="${s}"`,`opacity="${a}"`];return u!=="none"&&d.push(`stroke-dasharray="${u}"`),d.join(" ")}function gg(t,e,n,s){return e.rotation?`<g transform="rotate(${e.rotation} ${n} ${s})">${t}</g>`:t}function A7(t){const{x:e,y:n,width:s,height:a,cornerRadius:l}=t,u=l?` rx="${l}" ry="${l}"`:"",d=`<rect x="${e}" y="${n}" width="${s}" height="${a}"${u} ${Jm(t)} />`;return gg(d,t,e+s/2,n+a/2)}function R7(t){const e=t.x+t.width/2,n=t.y+t.height/2,s=`<ellipse cx="${e}" cy="${n}" rx="${t.width/2}" ry="${t.height/2}" ${Jm(t)} />`;return gg(s,t,e,n)}function L7(t){const e=Zf(t.width,t.height),n=[];for(let a=0;a<e.length;a+=2)n.push(`${t.x+e[a]},${t.y+e[a+1]}`);const s=`<polygon points="${n.join(" ")}" ${Jm(t)} />`;return gg(s,t,t.x+t.width/2,t.y+t.height/2)}function N7(t){const n=t.points.map((a,l)=>`${l%2===0?t.x+a:t.y+a}`),s=[];for(let a=0;a<n.length;a+=2)s.push(`${n[a]},${n[a+1]}`);return`<polyline points="${s.join(" ")}" fill="none" stroke="${xn(t.style.strokeColor)}" stroke-width="${t.style.strokeWidth}" opacity="${t.style.opacity}" stroke-linecap="round" stroke-linejoin="round"${ih(t.style.strokeStyle,t.style.strokeWidth)!=="none"?` stroke-dasharray="${ih(t.style.strokeStyle,t.style.strokeWidth)}"`:""} />`}function P7(t){const e=t.points,n={x:e[0],y:e[1]},s={x:e[e.length-2],y:e[e.length-1]},a=va(n,s,t.curvature??ma),l=t.x+n.x,u=t.y+n.y,d=t.x+a.x,p=t.y+a.y,h=t.x+s.x,y=t.y+s.y;return`<path d="M ${l} ${u} Q ${d} ${p} ${h} ${y}" fill="none" stroke="${xn(t.style.strokeColor)}" stroke-width="${t.style.strokeWidth}" opacity="${t.style.opacity}" stroke-linecap="round"${ih(t.style.strokeStyle,t.style.strokeWidth)!=="none"?` stroke-dasharray="${ih(t.style.strokeStyle,t.style.strokeWidth)}"`:""} />`}function O7(t,e){const n=t.x-e.x,s=t.y-e.y,a=Math.sqrt(n*n+s*s)||1;return{x:n/a,y:s/a}}function I7(t){return{x:-t.y,y:t.x}}function yg(t,e,n,s,a,l){const u=O7(e,n),d=I7(u),p=s*.45;switch(t){case"arrow":{const h={x:e.x-u.x*s+d.x*p,y:e.y-u.y*s+d.y*p},y={x:e.x-u.x*s-d.x*p,y:e.y-u.y*s-d.y*p};return`<polyline points="${h.x},${h.y} ${e.x},${e.y} ${y.x},${y.y}" fill="none" stroke="${xn(a)}" stroke-width="${l}" stroke-linecap="round" stroke-linejoin="round" />`}case"triangle":{const h={x:e.x-u.x*s+d.x*p,y:e.y-u.y*s+d.y*p},y={x:e.x-u.x*s-d.x*p,y:e.y-u.y*s-d.y*p};return`<polygon points="${e.x},${e.y} ${h.x},${h.y} ${y.x},${y.y}" fill="${xn(a)}" stroke="${xn(a)}" stroke-width="${l}" />`}case"triangle_outline":{const h={x:e.x-u.x*s+d.x*p,y:e.y-u.y*s+d.y*p},y={x:e.x-u.x*s-d.x*p,y:e.y-u.y*s-d.y*p};return`<polygon points="${e.x},${e.y} ${h.x},${h.y} ${y.x},${y.y}" fill="#ffffff" stroke="${xn(a)}" stroke-width="${l}" />`}case"circle":{const h=s*.35,y=e.x-u.x*h,_=e.y-u.y*h;return`<circle cx="${y}" cy="${_}" r="${h}" fill="${xn(a)}" stroke="${xn(a)}" stroke-width="${l}" />`}case"circle_outline":{const h=s*.35,y=e.x-u.x*h,_=e.y-u.y*h;return`<circle cx="${y}" cy="${_}" r="${h}" fill="#ffffff" stroke="${xn(a)}" stroke-width="${l}" />`}case"bar":{const h=p*1.2;return`<line x1="${e.x+d.x*h}" y1="${e.y+d.y*h}" x2="${e.x-d.x*h}" y2="${e.y-d.y*h}" stroke="${xn(a)}" stroke-width="${l}" />`}case"diamond":case"diamond_outline":{const h=p*.7,y=s*.55,_={x:e.x-u.x*y,y:e.y-u.y*y},S=t==="diamond"?xn(a):"#ffffff";return`<polygon points="${e.x},${e.y} ${_.x+d.x*h},${_.y+d.y*h} ${_.x-u.x*y},${_.y-u.y*y} ${_.x-d.x*h},${_.y-d.y*h}" fill="${S}" stroke="${xn(a)}" stroke-width="${l}" />`}case"crowfoot_one":{const h=p*1,y=s*.25,_={x:e.x-u.x*y,y:e.y-u.y*y};return[`<line x1="${e.x+d.x*h}" y1="${e.y+d.y*h}" x2="${e.x-d.x*h}" y2="${e.y-d.y*h}" stroke="${xn(a)}" stroke-width="${l}" />`,`<line x1="${_.x+d.x*h}" y1="${_.y+d.y*h}" x2="${_.x-d.x*h}" y2="${_.y-d.y*h}" stroke="${xn(a)}" stroke-width="${l}" />`].join(`
|
|
302
|
+
`)}case"crowfoot_many":{const h=p*1,y=s*.6,_={x:e.x-u.x*y,y:e.y-u.y*y};return[`<line x1="${e.x+d.x*h}" y1="${e.y+d.y*h}" x2="${e.x-d.x*h}" y2="${e.y-d.y*h}" stroke="${xn(a)}" stroke-width="${l}" />`,`<polyline points="${e.x+d.x*h},${e.y+d.y*h} ${_.x},${_.y} ${e.x-d.x*h},${e.y-d.y*h}" fill="none" stroke="${xn(a)}" stroke-width="${l}" />`].join(`
|
|
303
|
+
`)}case"crowfoot_one_or_many":{const h=p*1,y=s*.6,_=s*.25,S={x:e.x-u.x*_,y:e.y-u.y*_},x={x:e.x-u.x*y,y:e.y-u.y*y};return[`<line x1="${e.x+d.x*h}" y1="${e.y+d.y*h}" x2="${e.x-d.x*h}" y2="${e.y-d.y*h}" stroke="${xn(a)}" stroke-width="${l}" />`,`<line x1="${S.x+d.x*h}" y1="${S.y+d.y*h}" x2="${S.x-d.x*h}" y2="${S.y-d.y*h}" stroke="${xn(a)}" stroke-width="${l}" />`,`<polyline points="${e.x+d.x*h},${e.y+d.y*h} ${x.x},${x.y} ${e.x-d.x*h},${e.y-d.y*h}" fill="none" stroke="${xn(a)}" stroke-width="${l}" />`].join(`
|
|
304
|
+
`)}default:return""}}function F7(t){const e=[],n=t.lineType==="curved";if(e.push(n?P7(t):N7(t)),t.type==="arrow"){const s=t,a=s.startArrowhead??(s.startArrow?"arrow":null),l=s.endArrowhead??(s.endArrow?"arrow":null),u=Wm(t.style.strokeWidth),d=t.points;if(n){const p={x:d[0],y:d[1]},h={x:d[d.length-2],y:d[d.length-1]},y=va(p,h,s.curvature??ma),_={x:t.x+p.x,y:t.y+p.y},S={x:t.x+h.x,y:t.y+h.y},x={x:t.x+y.x*.1+p.x*.9,y:t.y+y.y*.1+p.y*.9},w={x:t.x+y.x*.1+h.x*.9,y:t.y+y.y*.1+h.y*.9};a&&e.push(yg(a,_,x,u,t.style.strokeColor,t.style.strokeWidth)),l&&e.push(yg(l,S,w,u,t.style.strokeColor,t.style.strokeWidth))}else{if(a&&d.length>=4){const p={x:t.x+d[0],y:t.y+d[1]},h={x:t.x+d[2],y:t.y+d[3]};e.push(yg(a,p,h,u,t.style.strokeColor,t.style.strokeWidth))}if(l&&d.length>=4){const p={x:t.x+d[d.length-2],y:t.y+d[d.length-1]},h={x:t.x+d[d.length-4],y:t.y+d[d.length-3]};e.push(yg(l,p,h,u,t.style.strokeColor,t.style.strokeWidth))}}}return e.join(`
|
|
305
|
+
`)}function U7(t){if(t.points.length<4)return"";const e=[];for(let n=0;n<t.points.length;n+=2)e.push(`${t.x+t.points[n]},${t.y+t.points[n+1]}`);return`<polyline points="${e.join(" ")}" fill="none" stroke="${xn(t.style.strokeColor)}" stroke-width="${t.style.strokeWidth}" opacity="${t.style.opacity}" stroke-linecap="round" stroke-linejoin="round" />`}function B7(t){if(!t.text)return"";const{style:e,x:n,y:s,text:a,textAlign:l}=t,u=a.split(`
|
|
306
|
+
`),d=e.fontSize*1.18;let p="start",h=0;l==="center"?(p="middle",h=t.width/2):l==="right"&&(p="end",h=t.width);const y=u.map((S,x)=>`<tspan x="${n+h}" dy="${x===0?0:d}">${xn(S)}</tspan>`).join(""),_=[`font-family="${xn(e.fontFamily)}"`,`font-size="${e.fontSize}"`,`fill="${xn(e.strokeColor)}"`,`opacity="${e.opacity}"`,`text-anchor="${p}"`];return`<text x="${n+h}" y="${s+e.fontSize}" ${_.join(" ")}>${y}</text>`}function z7(t){const{x:e,y:n,width:s,height:a,src:l,cornerRadius:u,style:d}=t,p=[],h=u>0?`clip-${t.id}`:"";h&&p.push(`<defs><clipPath id="${h}"><rect x="${e}" y="${n}" width="${s}" height="${a}" rx="${u}" ry="${u}" /></clipPath></defs>`);const y=`<image href="${xn(l)}" x="${e}" y="${n}" width="${s}" height="${a}" opacity="${d.opacity}" preserveAspectRatio="none"${h?` clip-path="url(#${h})"`:""} />`;let _="";if(d.strokeWidth>0&&d.strokeColor!=="transparent"){const x=u?` rx="${u}" ry="${u}"`:"";_=`<rect x="${e}" y="${n}" width="${s}" height="${a}"${x} fill="none" stroke="${xn(d.strokeColor)}" stroke-width="${d.strokeWidth}" opacity="${d.opacity}" />`}const S=p.join("")+y+_;return gg(S,t,e+s/2,n+a/2)}function H7(t){switch(t.type){case"rectangle":return A7(t);case"ellipse":return R7(t);case"diamond":return L7(t);case"line":case"arrow":return F7(t);case"freedraw":return U7(t);case"text":return B7(t);case"image":return z7(t);default:return""}}function uu(t){if(t.length===0)return'<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"></svg>';let e=1/0,n=1/0,s=-1/0,a=-1/0;for(const y of t)if(y.isVisible)if(y.type==="line"||y.type==="arrow"||y.type==="freedraw"){const _=y.points;for(let S=0;S<_.length;S+=2){const x=y.x+_[S],w=y.y+_[S+1];e=Math.min(e,x),n=Math.min(n,w),s=Math.max(s,x),a=Math.max(a,w)}}else e=Math.min(e,y.x),n=Math.min(n,y.y),s=Math.max(s,y.x+y.width),a=Math.max(a,y.y+y.height);const l=s-e+pg*2,u=a-n+pg*2,d=-e+pg,p=-n+pg,h=t.filter(y=>y.isVisible).map(y=>H7(y)).filter(Boolean).join(`
|
|
307
|
+
`);return[`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${u}" viewBox="0 0 ${l} ${u}">`,` <g transform="translate(${d} ${p})">`,` ${h}`," </g>","</svg>"].join(`
|
|
308
|
+
`)}function G7(t,e="canvas.svg"){const n=uu(t),s=new Blob([n],{type:"image/svg+xml"}),a=URL.createObjectURL(s),l=document.createElement("a");l.download=e,l.href=a,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}const V7=5;function Y7(t){if((t.type==="line"||t.type==="arrow"||t.type==="freedraw")&&"points"in t){const e=t.points;let n=1/0,s=-1/0,a=1/0,l=-1/0;for(let u=0;u<e.length;u+=2){const d=t.x+e[u],p=t.y+e[u+1];n=Math.min(n,d),s=Math.max(s,d),a=Math.min(a,p),l=Math.max(l,p)}return{left:n,right:s,top:a,bottom:l,cx:(n+s)/2,cy:(a+l)/2}}return{left:t.x,right:t.x+t.width,top:t.y,bottom:t.y+t.height,cx:t.x+t.width/2,cy:t.y+t.height/2}}function j7(t,e,n,s=V7){const a={left:t.x,right:t.x+t.width,top:t.y,bottom:t.y+t.height,cx:t.x+t.width/2,cy:t.y+t.height/2},l=[],u=[];for(const p of e){if(n.has(p.id)||!p.isVisible||p.type==="text"&&p.containerId)continue;const h=Y7(p),y=[[a.left,"left",h.left],[a.left,"left",h.right],[a.right,"right",h.left],[a.right,"right",h.right],[a.cx,"cx",h.cx],[a.left,"left",h.cx],[a.right,"right",h.cx],[a.cx,"cx",h.left],[a.cx,"cx",h.right]];for(const[S,x,w]of y)Math.abs(S-w)<s&&l.push({value:w,edge:x,other:h});const _=[[a.top,"top",h.top],[a.top,"top",h.bottom],[a.bottom,"bottom",h.top],[a.bottom,"bottom",h.bottom],[a.cy,"cy",h.cy],[a.top,"top",h.cy],[a.bottom,"bottom",h.cy],[a.cy,"cy",h.top],[a.cy,"cy",h.bottom]];for(const[S,x,w]of _)Math.abs(S-w)<s&&u.push({value:w,edge:x,other:h})}const d={guides:[]};if(l.length>0){l.sort((w,C)=>Math.abs(w.value-a[w.edge])-Math.abs(C.value-a[C.edge]));const p=l[0],h=p.value-a[p.edge];d.x=t.x+h;const y=p.value,_=l.filter(w=>Math.abs(w.value-y)<1);let S=a.top+(d.y!==void 0?d.y-t.y:0),x=a.bottom+(d.y!==void 0?d.y-t.y:0);for(const w of _)S=Math.min(S,w.other.top),x=Math.max(x,w.other.bottom);d.guides.push({orientation:"v",position:y,start:S-10,end:x+10})}if(u.length>0){u.sort((w,C)=>Math.abs(w.value-a[w.edge])-Math.abs(C.value-a[C.edge]));const p=u[0],h=p.value-a[p.edge];d.y=t.y+h;const y=p.value,_=u.filter(w=>Math.abs(w.value-y)<1);let S=a.left+(d.x!==void 0?d.x-t.x:0),x=a.right+(d.x!==void 0?d.x-t.x:0);for(const w of _)S=Math.min(S,w.other.left),x=Math.max(x,w.other.right);d.guides.push({orientation:"h",position:y,start:S-10,end:x+10})}return d}function W7(t=!0,e){const n=De(j=>j.setActiveTool),s=De(j=>j.undo),a=De(j=>j.redo),l=De(j=>j.selectedIds),u=De(j=>j.elements),d=De(j=>j.deleteElements),p=De(j=>j.duplicateElements),h=De(j=>j.bringToFront),y=De(j=>j.sendToBack),_=De(j=>j.bringForward),S=De(j=>j.sendBackward),x=De(j=>j.toggleGrid),w=De(j=>j.showGrid),C=De(j=>j.zoomIn),D=De(j=>j.zoomOut),U=De(j=>j.resetZoom),M=De(j=>j.zoomToFit),E=De(j=>j.zoomToSelection),L=De(j=>j.clearSelection),R=De(j=>j.updateElement),z=De(j=>j.addElement),ee=De(j=>j.setSelectedIds),O=De(j=>j.pushHistory),I=Jf(),F=te.useCallback(()=>{l.length!==0&&rh(U5(l,u))},[l,u]),V=te.useCallback(()=>{const j=Qm();if(j.length===0)return;const Y=20,{clones:X,selectedCloneIds:ne}=ig(j,j,Y);X.forEach(A=>z(A)),ee(ne.length>0?ne:X.map(A=>A.id)),O(),rh(j.map(A=>({...A,x:A.x+Y,y:A.y+Y})))},[z,ee,O]),W=te.useCallback((j,Y)=>{l.length!==0&&(l.forEach(X=>{const ne=u.find(A=>A.id===X);ne&&!ne.isLocked&&R(X,{x:ne.x+j,y:ne.y+Y})}),O())},[l,u,R,O]);te.useEffect(()=>{if(!t)return;const j=Y=>{const X=Y.target.tagName;if(X==="INPUT"||X==="TEXTAREA"||X==="SELECT")return;const ne=Y.metaKey||Y.ctrlKey;if(!ne&&!Y.shiftKey){const B={v:"select",h:"hand",r:"rectangle",o:"ellipse",d:"diamond",l:"line",a:"arrow",p:"freedraw",t:"text",i:"image",e:"eraser"}[Y.key.toLowerCase()];if(B){Y.preventDefault(),n(B);return}}if(ne&&Y.key==="z"&&!Y.shiftKey){Y.preventDefault(),s();return}if(ne&&Y.key==="z"&&Y.shiftKey){Y.preventDefault(),a();return}if(ne&&Y.key==="y"){Y.preventDefault(),a();return}if((Y.key==="Delete"||Y.key==="Backspace")&&!ne){if(I.isEditing&&I.selectedPointIndices.length>0){Y.preventDefault();const{elements:A,updateElement:B,pushHistory:Q}=De.getState(),H=A.find(K=>K.id===I.elementId);if(H){const K=H.points.length/2,ae=new Set(I.selectedPointIndices);if(K-ae.size>=2){const de=[];for(let be=0;be<K;be++)ae.has(be)||de.push(H.points[be*2],H.points[be*2+1]);const fe=de[0],se=de[1],q=[];for(let be=0;be<de.length;be+=2)q.push(de[be]-fe,de[be+1]-se);let oe=0,ye=0,ke=0,Ae=0;for(let be=0;be<q.length;be+=2)oe=Math.min(oe,q[be]),ye=Math.max(ye,q[be]),ke=Math.min(ke,q[be+1]),Ae=Math.max(Ae,q[be+1]);const Me={x:H.x+fe,y:H.y+se,points:q,width:ye-oe,height:Ae-ke};ae.has(0)&&(Me.startBinding=null),ae.has(K-1)&&(Me.endBinding=null),B(H.id,Me),Q(),I.setSelectedPoints([])}}return}if(l.length>0){Y.preventDefault();const A=l.filter(B=>{const Q=u.find(H=>H.id===B);return Q&&!Q.isLocked});A.length>0&&d(A)}return}if(ne&&Y.key==="d"){Y.preventDefault(),l.length>0&&p(l);return}if(Y.key==="]"&&ne&&Y.shiftKey){Y.preventDefault(),h(l);return}if(Y.key==="["&&ne&&Y.shiftKey){Y.preventDefault(),y(l);return}if(Y.key==="]"&&ne&&!Y.shiftKey){Y.preventDefault(),_(l);return}if(Y.key==="["&&ne&&!Y.shiftKey){Y.preventDefault(),S(l);return}if(Y.key==="g"&&!ne){Y.preventDefault(),x();return}if(ne&&(Y.key==="="||Y.key==="+")){Y.preventDefault(),C();return}if(ne&&Y.key==="-"){Y.preventDefault(),D();return}if(ne&&Y.key==="0"){Y.preventDefault(),U();return}if(ne&&Y.shiftKey&&Y.key==="1"){if(Y.preventDefault(),e!=null&&e.current){const A=e.current.getBoundingClientRect();M(A.width,A.height,void 0,{animate:!0})}return}if(ne&&Y.shiftKey&&Y.key==="2"){if(Y.preventDefault(),e!=null&&e.current){const A=e.current.getBoundingClientRect();E(A.width,A.height,{animate:!0})}return}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(Y.key)&&!ne&&l.length>0&&!I.isEditing){Y.preventDefault();const A=w?ru:1,B=Y.shiftKey?A*10:A,Q=Y.key==="ArrowLeft"?-B:Y.key==="ArrowRight"?B:0,H=Y.key==="ArrowUp"?-B:Y.key==="ArrowDown"?B:0;W(Q,H);return}if(ne&&Y.key==="c"){l.length>0&&(Y.preventDefault(),F());return}if(!(ne&&Y.key==="v")){if(ne&&Y.key==="x"){l.length>0&&(Y.preventDefault(),F(),d(l));return}if(ne&&Y.key==="g"&&!Y.shiftKey){if(Y.preventDefault(),l.length>=2){const{groupElements:A}=De.getState();A(l)}return}if(ne&&Y.key==="g"&&Y.shiftKey){if(Y.preventDefault(),l.length>0){const{ungroupElements:A}=De.getState();A(l)}return}if(ne&&Y.shiftKey&&Y.key==="l"){if(Y.preventDefault(),l.length>0){const{toggleLockElements:A}=De.getState();A(l)}return}if(Y.key==="Escape"){if(Y.preventDefault(),I.isEditing){I.exitEditMode();return}L(),n("select");return}if(ne&&Y.key==="a"){Y.preventDefault();const{elements:A,setSelectedIds:B}=De.getState();B(A.map(Q=>Q.id));return}}};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[t,n,s,a,l,u,d,p,h,y,_,S,x,w,C,D,U,M,E,e,L,I,W,F,V])}function px(t,e,n=0,s=t.length-1,a=X7){for(;s>n;){if(s-n>600){const p=s-n+1,h=e-n+1,y=Math.log(p),_=.5*Math.exp(2*y/3),S=.5*Math.sqrt(y*_*(p-_)/p)*(h-p/2<0?-1:1),x=Math.max(n,Math.floor(e-h*_/p+S)),w=Math.min(s,Math.floor(e+(p-h)*_/p+S));px(t,e,x,w,a)}const l=t[e];let u=n,d=s;for(sh(t,n,e),a(t[s],l)>0&&sh(t,n,s);u<d;){for(sh(t,u,d),u++,d--;a(t[u],l)<0;)u++;for(;a(t[d],l)>0;)d--}a(t[n],l)===0?sh(t,n,d):(d++,sh(t,d,s)),d<=e&&(n=d+1),e<=d&&(s=d-1)}}function sh(t,e,n){const s=t[e];t[e]=t[n],t[n]=s}function X7(t,e){return t<e?-1:t>e?1:0}class q7{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let n=this.data;const s=[];if(!vg(e,n))return s;const a=this.toBBox,l=[];for(;n;){for(let u=0;u<n.children.length;u++){const d=n.children[u],p=n.leaf?a(d):d;vg(e,p)&&(n.leaf?s.push(d):$m(e,p)?this._all(d,s):l.push(d))}n=l.pop()}return s}collides(e){let n=this.data;if(!vg(e,n))return!1;const s=[];for(;n;){for(let a=0;a<n.children.length;a++){const l=n.children[a],u=n.leaf?this.toBBox(l):l;if(vg(e,u)){if(n.leaf||$m(e,u))return!0;s.push(l)}}n=s.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let s=0;s<e.length;s++)this.insert(e[s]);return this}let n=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const s=this.data;this.data=n,n=s}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=fu([]),this}remove(e,n){if(!e)return this;let s=this.data;const a=this.toBBox(e),l=[],u=[];let d,p,h;for(;s||l.length;){if(s||(s=l.pop(),p=l[l.length-1],d=u.pop(),h=!0),s.leaf){const y=K7(e,s.children,n);if(y!==-1)return s.children.splice(y,1),l.push(s),this._condense(l),this}!h&&!s.leaf&&$m(s,a)?(l.push(s),u.push(d),d=0,p=s,s=s.children[0]):p?(d++,s=p.children[d],h=!1):s=null}return this}toBBox(e){return e}compareMinX(e,n){return e.minX-n.minX}compareMinY(e,n){return e.minY-n.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,n){const s=[];for(;e;)e.leaf?n.push(...e.children):s.push(...e.children),e=s.pop();return n}_build(e,n,s,a){const l=s-n+1;let u=this._maxEntries,d;if(l<=u)return d=fu(e.slice(n,s+1)),du(d,this.toBBox),d;a||(a=Math.ceil(Math.log(l)/Math.log(u)),u=Math.ceil(l/Math.pow(u,a-1))),d=fu([]),d.leaf=!1,d.height=a;const p=Math.ceil(l/u),h=p*Math.ceil(Math.sqrt(u));gx(e,n,s,h,this.compareMinX);for(let y=n;y<=s;y+=h){const _=Math.min(y+h-1,s);gx(e,y,_,p,this.compareMinY);for(let S=y;S<=_;S+=p){const x=Math.min(S+p-1,_);d.children.push(this._build(e,S,x,a-1))}}return du(d,this.toBBox),d}_chooseSubtree(e,n,s,a){for(;a.push(n),!(n.leaf||a.length-1===s);){let l=1/0,u=1/0,d;for(let p=0;p<n.children.length;p++){const h=n.children[p],y=Zm(h),_=Z7(e,h)-y;_<u?(u=_,l=y<l?y:l,d=h):_===u&&y<l&&(l=y,d=h)}n=d||n.children[0]}return n}_insert(e,n,s){const a=s?e:this.toBBox(e),l=[],u=this._chooseSubtree(a,this.data,n,l);for(u.children.push(e),oh(u,a);n>=0&&l[n].children.length>this._maxEntries;)this._split(l,n),n--;this._adjustParentBBoxes(a,l,n)}_split(e,n){const s=e[n],a=s.children.length,l=this._minEntries;this._chooseSplitAxis(s,l,a);const u=this._chooseSplitIndex(s,l,a),d=fu(s.children.splice(u,s.children.length-u));d.height=s.height,d.leaf=s.leaf,du(s,this.toBBox),du(d,this.toBBox),n?e[n-1].children.push(d):this._splitRoot(s,d)}_splitRoot(e,n){this.data=fu([e,n]),this.data.height=e.height+1,this.data.leaf=!1,du(this.data,this.toBBox)}_chooseSplitIndex(e,n,s){let a,l=1/0,u=1/0;for(let d=n;d<=s-n;d++){const p=ah(e,0,d,this.toBBox),h=ah(e,d,s,this.toBBox),y=$7(p,h),_=Zm(p)+Zm(h);y<l?(l=y,a=d,u=_<u?_:u):y===l&&_<u&&(u=_,a=d)}return a||s-n}_chooseSplitAxis(e,n,s){const a=e.leaf?this.compareMinX:Q7,l=e.leaf?this.compareMinY:J7,u=this._allDistMargin(e,n,s,a),d=this._allDistMargin(e,n,s,l);u<d&&e.children.sort(a)}_allDistMargin(e,n,s,a){e.children.sort(a);const l=this.toBBox,u=ah(e,0,n,l),d=ah(e,s-n,s,l);let p=mg(u)+mg(d);for(let h=n;h<s-n;h++){const y=e.children[h];oh(u,e.leaf?l(y):y),p+=mg(u)}for(let h=s-n-1;h>=n;h--){const y=e.children[h];oh(d,e.leaf?l(y):y),p+=mg(d)}return p}_adjustParentBBoxes(e,n,s){for(let a=s;a>=0;a--)oh(n[a],e)}_condense(e){for(let n=e.length-1,s;n>=0;n--)e[n].children.length===0?n>0?(s=e[n-1].children,s.splice(s.indexOf(e[n]),1)):this.clear():du(e[n],this.toBBox)}}function K7(t,e,n){if(!n)return e.indexOf(t);for(let s=0;s<e.length;s++)if(n(t,e[s]))return s;return-1}function du(t,e){ah(t,0,t.children.length,e,t)}function ah(t,e,n,s,a){a||(a=fu(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(let l=e;l<n;l++){const u=t.children[l];oh(a,t.leaf?s(u):u)}return a}function oh(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Q7(t,e){return t.minX-e.minX}function J7(t,e){return t.minY-e.minY}function Zm(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function mg(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Z7(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function $7(t,e){const n=Math.max(t.minX,e.minX),s=Math.max(t.minY,e.minY),a=Math.min(t.maxX,e.maxX),l=Math.min(t.maxY,e.maxY);return Math.max(0,a-n)*Math.max(0,l-s)}function $m(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function vg(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function fu(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function gx(t,e,n,s,a){const l=[e,n];for(;l.length;){if(n=l.pop(),e=l.pop(),n-e<=s)continue;const u=e+Math.ceil((n-e)/s/2)*s;px(t,u,e,n,a),l.push(e,u,u,n)}}function ev(t){if((t.type==="line"||t.type==="arrow")&&"points"in t){const e=t.points;let n=0,s=0,a=0,l=0;for(let u=0;u<e.length;u+=2){const d=e[u],p=e[u+1];d<n&&(n=d),d>s&&(s=d),p<a&&(a=p),p>l&&(l=p)}return{minX:t.x+n,minY:t.y+a,maxX:t.x+s,maxY:t.y+l,id:t.id}}return t.type==="freedraw"?{minX:t.x,minY:t.y,maxX:t.x+t.width,maxY:t.y+t.height,id:t.id}:{minX:t.x,minY:t.y,maxX:t.x+t.width,maxY:t.y+t.height,id:t.id}}class tv{constructor(e=9){et(this,"tree");et(this,"_elementMap",new Map);et(this,"_fattenedMap",new Map);et(this,"_margin",50);this.tree=new q7(e)}get margin(){return this._margin}set margin(e){this._margin=Math.max(0,e)}rebuild(e){this._elementMap.clear(),this._fattenedMap.clear();const n=this._margin,s=new Array(e.length);for(let a=0;a<e.length;a++){const l=e[a];this._elementMap.set(l.id,l);const u=ev(l),d={minX:u.minX-n,minY:u.minY-n,maxX:u.maxX+n,maxY:u.maxY+n,id:l.id};this._fattenedMap.set(l.id,{trueMinX:u.minX,trueMinY:u.minY,trueMaxX:u.maxX,trueMaxY:u.maxY,item:d}),s[a]=d}this.tree.clear(),this.tree.load(s)}update(e){this._elementMap.set(e.id,e);const n=ev(e),s=this._fattenedMap.get(e.id);if(s){const{item:u}=s;if(n.minX>=u.minX&&n.minY>=u.minY&&n.maxX<=u.maxX&&n.maxY<=u.maxY)return s.trueMinX=n.minX,s.trueMinY=n.minY,s.trueMaxX=n.maxX,s.trueMaxY=n.maxY,!1;this.tree.remove(u,(d,p)=>d.id===p.id)}const a=this._margin,l={minX:n.minX-a,minY:n.minY-a,maxX:n.maxX+a,maxY:n.maxY+a,id:e.id};return this._fattenedMap.set(e.id,{trueMinX:n.minX,trueMinY:n.minY,trueMaxX:n.maxX,trueMaxY:n.maxY,item:l}),this.tree.insert(l),!0}remove(e){const n=this._fattenedMap.get(e);n&&this.tree.remove(n.item,(s,a)=>s.id===a.id),this._elementMap.delete(e),this._fattenedMap.delete(e)}queryViewport(e,n,s,a=200){const{x:l,y:u,scale:d}=e,p=-l/d-a,h=-u/d-a,y=(-l+n)/d+a,_=(-u+s)/d+a,S=this.tree.search({minX:p,minY:h,maxX:y,maxY:_}),x=new Array(S.length);for(let w=0;w<S.length;w++)x[w]=S[w].id;return x}queryRect(e,n,s,a){return this.tree.search({minX:e,minY:n,maxX:s,maxY:a})}queryPoint(e,n){return this.tree.search({minX:e,minY:n,maxX:e,maxY:n}).map(s=>s.id)}getElementById(e){return this._elementMap.get(e)}get elementMap(){return this._elementMap}get size(){return this._elementMap.size}getTrueAABB(e){const n=this._fattenedMap.get(e);if(n)return{minX:n.trueMinX,minY:n.trueMinY,maxX:n.trueMaxX,maxY:n.trueMaxY}}clear(){this.tree.clear(),this._elementMap.clear(),this._fattenedMap.clear()}}let nv=null;function eT(){return nv||(nv=new tv),nv}const yx=200;function tT(t,e,n,s,a,l){const u=te.useRef(new tv),d=te.useMemo(()=>V5(a),[a]),p=te.useRef([]),h=te.useRef([]),y=te.useRef(0);if(t!==h.current){const _=h.current;if(h.current=t,t.length>yx)if(t.length!==y.current)u.current.rebuild(t);else{const x=u.current;for(let w=0;w<t.length;w++)t[w]!==_[w]&&x.update(t[w])}y.current=t.length}return te.useMemo(()=>{if(t.length<=yx)return H5(t,e,n,s,d,l);const S=u.current.queryViewport(e,n,s,l),x=new Set(S);for(const D of a)x.add(D);const w=[];for(const D of t)x.has(D.id)&&w.push(D);const C=p.current;if(w.length===C.length){let D=!0;for(let U=0;U<w.length;U++)if(w[U]!==C[U]){D=!1;break}if(D)return C}return p.current=w,w},[t,e.x,e.y,e.scale,n,s,d,a,l])}const nT=[.0625,.125,.25,.5,1,2,4,8];function mx(t){const e=nT;if(t<=e[0])return e[0];if(t>=e[e.length-1])return e[e.length-1];for(let n=0;n<e.length-1;n++){const s=(e[n]+e[n+1])/2;if(t<=s)return e[n]}return e[e.length-1]}function vx(t){return te.useMemo(()=>mx(t),[t])}const rT=500,iT=500;function Sx(t,e={}){const{batchSize:n=iT,threshold:s=rT,enabled:a=!0}=e,l=te.useRef(0),[u,d]=te.useState(0),p=te.useRef([]),h=te.useRef(!1),y=te.useRef(0);t!==p.current&&(p.current=t);const S=a&&t.length>s;te.useEffect(()=>{if(!S){d(t.length),h.current=!0,y.current=t.length;return}const D=y.current;if(h.current&&Math.abs(t.length-D)<n){d(t.length),y.current=t.length;return}const U=++l.current;h.current=!1,y.current=t.length,d(Math.min(n,t.length));let M=n;function E(){l.current===U&&(M=Math.min(M+n,t.length),d(M),M<t.length?requestAnimationFrame(E):h.current=!0)}return n<t.length?requestAnimationFrame(E):h.current=!0,()=>{l.current++}},[t,S,n]);const x=te.useMemo(()=>!S||u>=t.length?t:t.slice(0,u),[t,u,S]),w=S&&u<t.length,C=t.length>0?Math.min(u/t.length,1):1;return{visibleElements:x,isLoading:w,progress:C}}function _x(t,e){const n=(e==null?void 0:e.timeout)??1e3;"requestIdleCallback"in window?window.requestIdleCallback(s=>{s.timeRemaining()>5?t():_x(t,e)},{timeout:n}):setTimeout(t,100)}function sT(){return new Promise(t=>setTimeout(t,0))}const aT=200,oT=1e4;class xx{constructor(){et(this,"_worker",null);et(this,"_pending",new Map);et(this,"_workerSupported",!0);et(this,"_onMessage",e=>{const n=e.data;if(!n||!n.requestId)return;const s=this._pending.get(n.requestId);s&&(this._pending.delete(n.requestId),n.type==="svgResult"?s.resolve(n.svg):n.type==="error"&&s.reject(new Error(n.message)))})}_getWorker(){if(!this._workerSupported)return null;if(this._worker)return this._worker;try{return this._worker=new Worker(new URL("/assets/exportWorker-hU9uNZXJ.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:to&&to.tagName.toUpperCase()==="SCRIPT"&&to.src||new URL("f1ow-canvas.umd.cjs",document.baseURI).href),{type:"module"}),this._worker.onmessage=this._onMessage,this._worker.onerror=e=>{var n;console.warn("[ExportWorkerManager] Worker error, falling back to sync:",e.message),this._workerSupported=!1,this._rejectAll(new Error("Export Worker failed")),(n=this._worker)==null||n.terminate(),this._worker=null},this._worker}catch{return this._workerSupported=!1,null}}_rejectAll(e){for(const[,n]of this._pending)n.reject(e);this._pending.clear()}async exportSVG(e){if(e.length<=aT)return uu(e);const n=this._getWorker();if(!n)return uu(e);const s=_s();return new Promise((a,l)=>{this._pending.set(s,{resolve:a,reject:l});const u=setTimeout(()=>{if(this._pending.has(s)){this._pending.delete(s),console.warn("[ExportWorkerManager] Timeout, falling back to sync export");try{a(uu(e))}catch(y){l(y)}}},oT),d=a,p=l,h=this._pending.get(s);h&&(h.resolve=y=>{clearTimeout(u),d(y)},h.reject=y=>{clearTimeout(u),p(y)}),n.postMessage({type:"exportSVG",requestId:s,elements:e})})}async downloadSVG(e,n="canvas.svg"){const s=await this.exportSVG(e),a=new Blob([s],{type:"image/svg+xml"}),l=URL.createObjectURL(a),u=document.createElement("a");u.download=n,u.href=l,document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(l)}dispose(){var e;this._rejectAll(new Error("ExportWorkerManager disposed")),(e=this._worker)==null||e.terminate(),this._worker=null}}let tc=null;function lT(){return tc||(tc=new xx),tc}function wx(){tc==null||tc.dispose(),tc=null}const bx={canvasBackground:"#f8f9fa",gridColor:"#e5e5e5",selectionColor:"#4f8df7",toolbarBg:"rgba(255, 255, 255, 0.95)",toolbarBorder:"#e5e7eb",panelBg:"rgba(255, 255, 255, 0.95)",activeToolColor:"#4f46e5",textColor:"#374151",mutedTextColor:"#9ca3af"},Bi=()=>new Map,rv=t=>{const e=Bi();return t.forEach((n,s)=>{e.set(s,n)}),e},Sa=(t,e,n)=>{let s=t.get(e);return s===void 0&&t.set(e,s=n()),s},cT=(t,e)=>{const n=[];for(const[s,a]of t)n.push(e(a,s));return n},uT=(t,e)=>{for(const[n,s]of t)if(e(s,n))return!0;return!1},al=()=>new Set,iv=t=>t[t.length-1],dT=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},lo=Array.from,sv=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Ex=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},fT=(t,e)=>{const n=new Array(t);for(let s=0;s<t;s++)n[s]=e(s,n);return n},Sg=Array.isArray;class Cx{constructor(){this._observers=Bi()}on(e,n){return Sa(this._observers,e,al).add(n),n}once(e,n){const s=(...a)=>{this.off(e,s),n(...a)};this.on(e,s)}off(e,n){const s=this._observers.get(e);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(e))}emit(e,n){return lo((this._observers.get(e)||Bi()).values()).forEach(s=>s(...n))}destroy(){this._observers=Bi()}}class hT{constructor(){this._observers=Bi()}on(e,n){Sa(this._observers,e,al).add(n)}once(e,n){const s=(...a)=>{this.off(e,s),n(...a)};this.on(e,s)}off(e,n){const s=this._observers.get(e);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(e))}emit(e,n){return lo((this._observers.get(e)||Bi()).values()).forEach(s=>s(...n))}destroy(){this._observers=Bi()}}const js=Math.floor,_g=Math.abs,av=(t,e)=>t<e?t:e,nc=(t,e)=>t>e?t:e,pT=Math.pow,Tx=t=>t!==0?t<0:1/t<0,kx=1,Mx=2,ov=4,lv=8,lh=32,co=64,es=128,xg=31,cv=63,rc=127,gT=2147483647,wg=Number.MAX_SAFE_INTEGER,Dx=Number.MIN_SAFE_INTEGER,yT=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&js(t)===t),Ax=String.fromCharCode,mT=t=>t.toLowerCase(),vT=/^\s*/g,ST=t=>t.replace(vT,""),_T=/([A-Z])/g,Rx=(t,e)=>ST(t.replace(_T,n=>`${e}${mT(n)}`)),xT=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let a=0;a<n;a++)s[a]=e.codePointAt(a);return s},ch=typeof TextEncoder<"u"?new TextEncoder:null,wT=ch?t=>ch.encode(t):xT;let uh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});uh&&uh.decode(new Uint8Array).length===1&&(uh=null);const bT=(t,e)=>fT(e,()=>t).join("");class dh{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Zr=()=>new dh,uv=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Pn=t=>{const e=new Uint8Array(uv(t));let n=0;for(let s=0;s<t.bufs.length;s++){const a=t.bufs[s];e.set(a,n),n+=a.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},ET=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(nc(n,e)*2),t.cpos=0)},Pr=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},dv=Pr,_t=(t,e)=>{for(;e>rc;)Pr(t,es|rc&e),e=js(e/128);Pr(t,rc&e)},fv=(t,e)=>{const n=Tx(e);for(n&&(e=-e),Pr(t,(e>cv?es:0)|(n?co:0)|cv&e),e=js(e/64);e>0;)Pr(t,(e>rc?es:0)|rc&e),e=js(e/128)},hv=new Uint8Array(3e4),CT=hv.length/3,TT=(t,e)=>{if(e.length<CT){const n=ch.encodeInto(e,hv).written||0;_t(t,n);for(let s=0;s<n;s++)Pr(t,hv[s])}else Jn(t,wT(e))},kT=(t,e)=>{const n=unescape(encodeURIComponent(e)),s=n.length;_t(t,s);for(let a=0;a<s;a++)Pr(t,n.codePointAt(a))},ic=ch&&ch.encodeInto?TT:kT,bg=(t,e)=>{const n=t.cbuf.length,s=t.cpos,a=av(n-s,e.length),l=e.length-a;t.cbuf.set(e.subarray(0,a),s),t.cpos+=a,l>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(nc(n*2,l)),t.cbuf.set(e.subarray(a)),t.cpos=l)},Jn=(t,e)=>{_t(t,e.byteLength),bg(t,e)},pv=(t,e)=>{ET(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},MT=(t,e)=>pv(t,4).setFloat32(0,e,!1),DT=(t,e)=>pv(t,8).setFloat64(0,e,!1),AT=(t,e)=>pv(t,8).setBigInt64(0,e,!1),Lx=new DataView(new ArrayBuffer(4)),RT=t=>(Lx.setFloat32(0,t),Lx.getFloat32(0)===t),fh=(t,e)=>{switch(typeof e){case"string":Pr(t,119),ic(t,e);break;case"number":yT(e)&&_g(e)<=gT?(Pr(t,125),fv(t,e)):RT(e)?(Pr(t,124),MT(t,e)):(Pr(t,123),DT(t,e));break;case"bigint":Pr(t,122),AT(t,e);break;case"object":if(e===null)Pr(t,126);else if(Sg(e)){Pr(t,117),_t(t,e.length);for(let n=0;n<e.length;n++)fh(t,e[n])}else if(e instanceof Uint8Array)Pr(t,116),Jn(t,e);else{Pr(t,118);const n=Object.keys(e);_t(t,n.length);for(let s=0;s<n.length;s++){const a=n[s];ic(t,a),fh(t,e[a])}}break;case"boolean":Pr(t,e?120:121);break;default:Pr(t,127)}};class Nx extends dh{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&_t(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Px=t=>{t.count>0&&(fv(t.encoder,t.count===1?t.s:-t.s),t.count>1&&_t(t.encoder,t.count-2))};class Eg{constructor(){this.encoder=new dh,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Px(this),this.count=1,this.s=e)}toUint8Array(){return Px(this),Pn(this.encoder)}}const Ox=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);fv(t.encoder,e),t.count>1&&_t(t.encoder,t.count-2)}};class gv{constructor(){this.encoder=new dh,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Ox(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Ox(this),Pn(this.encoder)}}class LT{constructor(){this.sarr=[],this.s="",this.lensE=new Eg}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new dh;return this.sarr.push(this.s),this.s="",ic(e,this.sarr.join("")),bg(e,this.lensE.toUint8Array()),Pn(e)}}const _a=t=>new Error(t),Ws=()=>{throw _a("Method unimplemented")},ws=()=>{throw _a("Unexpected case")},Ix=_a("Unexpected end of array"),Fx=_a("Integer out of Range");class Cg{constructor(e){this.arr=e,this.pos=0}}const ol=t=>new Cg(t),NT=t=>t.pos!==t.arr.length,PT=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},$r=t=>PT(t,It(t)),hu=t=>t.arr[t.pos++],It=t=>{let e=0,n=1;const s=t.arr.length;for(;t.pos<s;){const a=t.arr[t.pos++];if(e=e+(a&rc)*n,n*=128,a<es)return e;if(e>wg)throw Fx}throw Ix},yv=t=>{let e=t.arr[t.pos++],n=e&cv,s=64;const a=(e&co)>0?-1:1;if((e&es)===0)return a*n;const l=t.arr.length;for(;t.pos<l;){if(e=t.arr[t.pos++],n=n+(e&rc)*s,s*=128,e<es)return a*n;if(n>wg)throw Fx}throw Ix},ll=uh?t=>uh.decode($r(t)):t=>{let e=It(t);if(e===0)return"";{let n=String.fromCodePoint(hu(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(hu(t));else for(;e>0;){const s=e<1e4?e:1e4,a=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,a),e-=s}return decodeURIComponent(escape(n))}},mv=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},OT=[t=>{},t=>null,yv,t=>mv(t,4).getFloat32(0,!1),t=>mv(t,8).getFloat64(0,!1),t=>mv(t,8).getBigInt64(0,!1),t=>!1,t=>!0,ll,t=>{const e=It(t),n={};for(let s=0;s<e;s++){const a=ll(t);n[a]=hh(t)}return n},t=>{const e=It(t),n=[];for(let s=0;s<e;s++)n.push(hh(t));return n},$r],hh=t=>OT[127-hu(t)](t);class Ux extends Cg{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),NT(this)?this.count=It(this)+1:this.count=-1),this.count--,this.s}}class Tg extends Cg{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=yv(this);const e=Tx(this.s);this.count=1,e&&(this.s=-this.s,this.count=It(this)+2)}return this.count--,this.s}}class vv extends Cg{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=yv(this),n=e&1;this.diff=js(e/2),this.count=1,n&&(this.count=It(this)+2)}return this.s+=this.diff,this.count--,this.s}}class IT{constructor(e){this.decoder=new Tg(e),this.str=ll(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const FT=crypto.getRandomValues.bind(crypto),Bx=()=>FT(new Uint32Array(1))[0],UT="10000000-1000-4000-8000"+-1e11,BT=()=>UT.replace(/[018]/g,t=>(t^Bx()&15>>t/4).toString(16)),sc=Date.now,zx=t=>new Promise(t);Promise.all.bind(Promise);const Hx=t=>t===void 0?null:t;class zT{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let Gx=new zT,Sv=!0;try{typeof localStorage<"u"&&localStorage&&(Gx=localStorage,Sv=!1)}catch{}const Vx=Gx,HT=t=>Sv||addEventListener("storage",t),GT=t=>Sv||removeEventListener("storage",t),ph=Symbol("Equality"),Yx=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[ph])!=null&&n.call(t,e))||!1},VT=t=>typeof t=="object",YT=Object.assign,jT=Object.keys,WT=(t,e)=>{for(const n in t)e(t[n],n)},XT=(t,e)=>{const n=[];for(const s in t)n.push(e(t[s],s));return n},kg=t=>jT(t).length,qT=t=>{for(const e in t)return!1;return!0},gh=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},_v=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),KT=(t,e)=>t===e||kg(t)===kg(e)&&gh(t,(n,s)=>(n!==void 0||_v(e,s))&&Yx(e[s],n)),QT=Object.freeze,jx=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&jx(t[e])}return QT(t)},xv=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&xv(t,e,n+1)}},JT=t=>t,pu=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[ph]!=null)return t[ph](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!pu(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(kg(t)!==kg(e))return!1;for(const n in t)if(!_v(t,n)||!pu(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!pu(t[n],e[n]))return!1;break;default:return!1}return!0},ZT=(t,e)=>e.includes(t),cl=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",Wx=typeof window<"u"&&typeof document<"u"&&!cl;let xa;const $T=()=>{if(xa===void 0)if(cl){xa=Bi();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const s=t[n];s[0]==="-"?(e!==null&&xa.set(e,""),e=s):e!==null&&(xa.set(e,s),e=null)}e!==null&&xa.set(e,"")}else typeof location=="object"?(xa=Bi(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");xa.set(`--${Rx(e,"-")}`,n),xa.set(`-${Rx(e,"-")}`,n)}})):xa=Bi();return xa},wv=t=>$T().has(t),Mg=t=>Hx(cl?process.env[t.toUpperCase().replaceAll("-","_")]:Vx.getItem(t)),Xx=t=>wv("--"+t)||Mg(t)!==null,ek=Xx("production"),tk=cl&&ZT(process.env.FORCE_COLOR,["true","1","2"])||!wv("--no-colors")&&!Xx("no-color")&&(!cl||process.stdout.isTTY)&&(!cl||wv("--color")||Mg("COLORTERM")!==null||(Mg("TERM")||"").includes("color")),qx=t=>new Uint8Array(t),nk=(t,e,n)=>new Uint8Array(t,e,n),rk=t=>new Uint8Array(t),ik=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=Ax(t[n]);return btoa(e)},sk=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),ak=t=>{const e=atob(t),n=qx(e.length);for(let s=0;s<e.length;s++)n[s]=e.charCodeAt(s);return n},ok=t=>{const e=Buffer.from(t,"base64");return nk(e.buffer,e.byteOffset,e.byteLength)},lk=Wx?ik:sk,ck=Wx?ak:ok,uk=t=>{const e=qx(t.byteLength);return e.set(t),e};class dk{constructor(e,n){this.left=e,this.right=n}}const uo=(t,e)=>new dk(t,e),Kx=t=>t.next()>=.5,bv=(t,e,n)=>js(t.next()*(n+1-e)+e),Qx=(t,e,n)=>js(t.next()*(n+1-e)+e),Ev=(t,e,n)=>Qx(t,e,n),fk=t=>Ax(Ev(t,97,122)),hk=(t,e=0,n=20)=>{const s=Ev(t,e,n);let a="";for(let l=0;l<s;l++)a+=fk(t);return a},Cv=(t,e)=>e[Ev(t,0,e.length-1)],pk=Symbol("0schema");class gk{constructor(){this._rerrs=[]}extend(e,n,s,a=null){this._rerrs.push({path:e,expected:n,has:s,message:a})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const s=this._rerrs[n];e.push(bT(" ",(this._rerrs.length-n)*2)+`${s.path!=null?`[${s.path}] `:""}${s.has} doesn't match ${s.expected}. ${s.message}`)}return e.join(`
|
|
309
|
+
`)}}const Tv=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[ph]?Yx(t,e):Sg(t)?sv(t,n=>Ex(e,s=>Tv(n,s))):VT(t)?gh(t,(n,s)=>Tv(n,e[s])):!1;class ei{extends(e){let[n,s]=[this.shape,e.shape];return this.constructor._dilutes&&([s,n]=[n,s]),Tv(n,s)}equals(e){return this.constructor===e.constructor&&pu(this.shape,e.shape)}[pk](){return!0}[ph](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Ws()}get nullable(){return gu(this,Ig)}get optional(){return new $x(this)}cast(e){return d4(e,this),e}expect(e){return d4(e,this),e}}et(ei,"_dilutes",!1);class kv extends ei{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const s=(e==null?void 0:e.constructor)===this.shape&&(this._c==null||this._c(e));return!s&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name,(e==null?void 0:e.constructor)!==this.shape?"Constructor match failed":"Check failed")),s}}const ir=(t,e=null)=>new kv(t,e);ir(kv);class Mv extends ei{constructor(e){super(),this.shape=e}check(e,n){const s=this.shape(e);return!s&&(n==null||n.extend(null,"custom prop",e==null?void 0:e.constructor.name,"failed to check custom prop")),s}}const Or=t=>new Mv(t);ir(Mv);class Dg extends ei{constructor(e){super(),this.shape=e}check(e,n){const s=this.shape.some(a=>a===e);return!s&&(n==null||n.extend(null,this.shape.join(" | "),e.toString())),s}}const Ag=(...t)=>new Dg(t),Jx=ir(Dg),yk=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),Zx=t=>{if(mu.check(t))return[yk(t)];if(Jx.check(t))return t.shape.map(e=>e+"");if(l4.check(t))return["[+-]?\\d+.?\\d*"];if(c4.check(t))return[".*"];if(Ng.check(t))return t.shape.map(Zx).flat(1);ws()};class mk extends ei{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(Zx).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const s=this._r.exec(e)!=null;return!s&&(n==null||n.extend(null,this._r.toString(),e.toString(),"String doesn't match string template.")),s}}ir(mk);const vk=Symbol("optional");class $x extends ei{constructor(e){super(),this.shape=e}check(e,n){const s=e===void 0||this.shape.check(e);return!s&&(n==null||n.extend(null,"undefined (optional)","()")),s}get[vk](){return!0}}const Sk=ir($x);class _k extends ei{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}ir(_k);const c0=class c0 extends ei{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new c0(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):gh(this.shape,(s,a)=>{const l=this._isPartial&&!_v(e,a)||s.check(e[a],n);return!l&&(n==null||n.extend(a.toString(),s.toString(),typeof e[a],"Object property does not match")),l})}};et(c0,"_dilutes",!0);let Rg=c0;const xk=t=>new Rg(t),wk=ir(Rg),bk=Or(t=>t!=null&&(t.constructor===Object||t.constructor==null));class e4 extends ei{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&gh(e,(s,a)=>{const l=this.shape.keys.check(a,n);return!l&&(n==null||n.extend(a+"","Record",typeof e,l?"Key doesn't match schema":"Value doesn't match value")),l&&this.shape.values.check(s,n)})}}const t4=(t,e)=>new e4(t,e),Ek=ir(e4);class n4 extends ei{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&gh(this.shape,(s,a)=>{const l=s.check(e[a],n);return!l&&(n==null||n.extend(a.toString(),"Tuple",typeof s)),l})}}const Ck=(...t)=>new n4(t);ir(n4);class r4 extends ei{constructor(e){super(),this.shape=e.length===1?e[0]:new Lg(e)}check(e,n){const s=Sg(e)&&sv(e,a=>this.shape.check(a));return!s&&(n==null||n.extend(null,"Array","")),s}}const i4=(...t)=>new r4(t),Tk=ir(r4),kk=Or(t=>Sg(t));class s4 extends ei{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const s=e instanceof this.shape&&(this._c==null||this._c(e));return!s&&(n==null||n.extend(null,this.shape.name,e==null?void 0:e.constructor.name)),s}}const Mk=(t,e=null)=>new s4(t,e);ir(s4);const Dk=Mk(ei);class Ak extends ei{constructor(e){super(),this.len=e.length-1,this.args=Ck(...e.slice(-1)),this.res=e[this.len]}check(e,n){const s=e.constructor===Function&&e.length<=this.len;return!s&&(n==null||n.extend(null,"function",typeof e)),s}}const Rk=ir(Ak),Lk=Or(t=>typeof t=="function");class Nk extends ei{constructor(e){super(),this.shape=e}check(e,n){const s=sv(this.shape,a=>a.check(e,n));return!s&&(n==null||n.extend(null,"Intersectinon",typeof e)),s}}ir(Nk,t=>t.shape.length>0);class Lg extends ei{constructor(e){super(),this.shape=e}check(e,n){const s=Ex(this.shape,a=>a.check(e,n));return n==null||n.extend(null,"Union",typeof e),s}}et(Lg,"_dilutes",!0);const gu=(...t)=>t.findIndex(e=>Ng.check(e))>=0?gu(...t.map(e=>yh(e)).map(e=>Ng.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new Lg(t),Ng=ir(Lg),a4=()=>!0,Pg=Or(a4),Pk=ir(Mv,t=>t.shape===a4),Dv=Or(t=>typeof t=="bigint"),Ok=Or(t=>t===Dv),o4=Or(t=>typeof t=="symbol");Or(t=>t===o4);const yu=Or(t=>typeof t=="number"),l4=Or(t=>t===yu),mu=Or(t=>typeof t=="string"),c4=Or(t=>t===mu),Og=Or(t=>typeof t=="boolean"),Ik=Or(t=>t===Og),u4=Ag(void 0);ir(Dg,t=>t.shape.length===1&&t.shape[0]===void 0),Ag(void 0);const Ig=Ag(null),Fk=ir(Dg,t=>t.shape.length===1&&t.shape[0]===null);ir(Uint8Array),ir(kv,t=>t.shape===Uint8Array);const Uk=gu(yu,mu,Ig,u4,Dv,Og,o4);(()=>{const t=i4(Pg),e=t4(mu,Pg),n=gu(yu,mu,Ig,Og,t,e);return t.shape=n,e.shape.values=n,n})();const yh=t=>{if(Dk.check(t))return t;if(bk.check(t)){const e={};for(const n in t)e[n]=yh(t[n]);return xk(e)}else{if(kk.check(t))return gu(...t.map(yh));if(Uk.check(t))return Ag(t);if(Lk.check(t))return ir(t)}ws()},d4=ek?()=>{}:(t,e)=>{const n=new gk;if(!e.check(t,n))throw _a(`Expected value to be of type ${e.constructor.name}.
|
|
310
|
+
${n.toString()}`)};class Bk{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:yh(e),h:n}),this}else(e){return this.if(Pg,e)}done(){return(e,n)=>{for(let s=0;s<this.patterns.length;s++){const a=this.patterns[s];if(a.if.check(e))return a.h(e,n)}throw _a("Unhandled pattern")}}}const f4=(t=>new Bk(t))(Pg).if(l4,(t,e)=>bv(e,Dx,wg)).if(c4,(t,e)=>hk(e)).if(Ik,(t,e)=>Kx(e)).if(Ok,(t,e)=>BigInt(bv(e,Dx,wg))).if(Ng,(t,e)=>vu(e,Cv(e,t.shape))).if(wk,(t,e)=>{const n={};for(const s in t.shape){let a=t.shape[s];if(Sk.check(a)){if(Kx(e))continue;a=a.shape}n[s]=f4(a,e)}return n}).if(Tk,(t,e)=>{const n=[],s=Qx(e,0,42);for(let a=0;a<s;a++)n.push(vu(e,t.shape));return n}).if(Jx,(t,e)=>Cv(e,t.shape)).if(Fk,(t,e)=>null).if(Rk,(t,e)=>{const n=vu(e,t.res);return()=>n}).if(Pk,(t,e)=>vu(e,Cv(e,[yu,mu,Ig,u4,Dv,Og,i4(yu),t4(gu("a","b","c"),yu)]))).if(Ek,(t,e)=>{const n={},s=bv(e,0,3);for(let a=0;a<s;a++){const l=vu(e,t.shape.keys),u=vu(e,t.shape.values);n[l]=u}return n}).done(),vu=(t,e)=>f4(yh(e),t),Fg=typeof document<"u"?document:{};Or(t=>t.nodeType===Yk),typeof DOMParser<"u"&&new DOMParser,Or(t=>t.nodeType===Hk),Or(t=>t.nodeType===Gk);const zk=t=>cT(t,(e,n)=>`${n}:${e};`).join(""),Hk=Fg.ELEMENT_NODE,Gk=Fg.TEXT_NODE,Vk=Fg.DOCUMENT_NODE,Yk=Fg.DOCUMENT_FRAGMENT_NODE;Or(t=>t.nodeType===Vk);const fo=Symbol,h4=fo(),p4=fo(),jk=fo(),Wk=fo(),Xk=fo(),g4=fo(),qk=fo(),Av=fo(),Kk=fo(),Qk=t=>{var a;t.length===1&&((a=t[0])==null?void 0:a.constructor)===Function&&(t=t[0]());const e=[],n=[];let s=0;for(;s<t.length;s++){const l=t[s];if(l===void 0)break;if(l.constructor===String||l.constructor===Number)e.push(l);else if(l.constructor===Object)break}for(s>0&&n.push(e.join(""));s<t.length;s++){const l=t[s];l instanceof Symbol||n.push(l)}return n},Jk={[h4]:uo("font-weight","bold"),[p4]:uo("font-weight","normal"),[jk]:uo("color","blue"),[Xk]:uo("color","green"),[Wk]:uo("color","grey"),[g4]:uo("color","red"),[qk]:uo("color","purple"),[Av]:uo("color","orange"),[Kk]:uo("color","black")},y4=tk?t=>{var u;t.length===1&&((u=t[0])==null?void 0:u.constructor)===Function&&(t=t[0]());const e=[],n=[],s=Bi();let a=[],l=0;for(;l<t.length;l++){const d=t[l],p=Jk[d];if(p!==void 0)s.set(p.left,p.right);else{if(d===void 0)break;if(d.constructor===String||d.constructor===Number){const h=zk(s);l>0||h.length>0?(e.push("%c"+d),n.push(h)):e.push(d)}else break}}for(l>0&&(a=n,a.unshift(e.join("")));l<t.length;l++){const d=t[l];d instanceof Symbol||a.push(d)}return a}:Qk,Zk=(...t)=>{console.log(...y4(t)),m4.forEach(e=>e.print(t))},$k=(...t)=>{console.warn(...y4(t)),t.unshift(Av),m4.forEach(e=>e.print(t))},m4=al(),v4=t=>({[Symbol.iterator](){return this},next:t}),eM=(t,e)=>v4(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Rv=(t,e)=>v4(()=>{const{done:n,value:s}=t.next();return{done:n,value:n?void 0:e(s)}});class Lv{constructor(e,n){this.clock=e,this.len=n}}class mh{constructor(){this.clients=new Map}}const S4=(t,e,n)=>e.clients.forEach((s,a)=>{const l=t.doc.store.clients.get(a);if(l!=null){const u=l[l.length-1],d=u.id.clock+u.length;for(let p=0,h=s[p];p<s.length&&h.clock<d;h=s[++p])F4(t,l,h.clock,h.len,n)}}),tM=(t,e)=>{let n=0,s=t.length-1;for(;n<=s;){const a=js((n+s)/2),l=t[a],u=l.clock;if(u<=e){if(e<u+l.len)return a;n=a+1}else s=a-1}return null},_4=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&tM(n,e.clock)!==null},Nv=t=>{t.clients.forEach(e=>{e.sort((a,l)=>a.clock-l.clock);let n,s;for(n=1,s=1;n<e.length;n++){const a=e[s-1],l=e[n];a.clock+a.len>=l.clock?a.len=nc(a.len,l.clock+l.len-a.clock):(s<n&&(e[s]=l),s++)}e.length=s})},nM=t=>{const e=new mh;for(let n=0;n<t.length;n++)t[n].clients.forEach((s,a)=>{if(!e.clients.has(a)){const l=s.slice();for(let u=n+1;u<t.length;u++)dT(l,t[u].clients.get(a)||[]);e.clients.set(a,l)}});return Nv(e),e},Ug=(t,e,n,s)=>{Sa(t.clients,e,()=>[]).push(new Lv(n,s))},rM=()=>new mh,iM=t=>{const e=rM();return t.clients.forEach((n,s)=>{const a=[];for(let l=0;l<n.length;l++){const u=n[l];if(u.deleted){const d=u.id.clock;let p=u.length;if(l+1<n.length)for(let h=n[l+1];l+1<n.length&&h.deleted;h=n[++l+1])p+=h.length;a.push(new Lv(d,p))}}a.length>0&&e.clients.set(s,a)}),e},Su=(t,e)=>{_t(t.restEncoder,e.clients.size),lo(e.clients.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{t.resetDsCurVal(),_t(t.restEncoder,n);const a=s.length;_t(t.restEncoder,a);for(let l=0;l<a;l++){const u=s[l];t.writeDsClock(u.clock),t.writeDsLen(u.len)}})},Pv=t=>{const e=new mh,n=It(t.restDecoder);for(let s=0;s<n;s++){t.resetDsCurVal();const a=It(t.restDecoder),l=It(t.restDecoder);if(l>0){const u=Sa(e.clients,a,()=>[]);for(let d=0;d<l;d++)u.push(new Lv(t.readDsClock(),t.readDsLen()))}}return e},x4=(t,e,n)=>{const s=new mh,a=It(t.restDecoder);for(let l=0;l<a;l++){t.resetDsCurVal();const u=It(t.restDecoder),d=It(t.restDecoder),p=n.clients.get(u)||[],h=Ir(n,u);for(let y=0;y<d;y++){const _=t.readDsClock(),S=_+t.readDsLen();if(_<h){h<S&&Ug(s,u,h,S-h);let x=wa(p,_),w=p[x];for(!w.deleted&&w.id.clock<_&&(p.splice(x+1,0,$g(e,w,_-w.id.clock)),x++);x<p.length&&(w=p[x++],w.id.clock<S);)w.deleted||(S<w.id.clock+w.length&&p.splice(x,0,$g(e,w,S-w.id.clock)),w.delete(e))}else Ug(s,u,_,S-_)}}if(s.clients.size>0){const l=new oc;return _t(l.restEncoder,0),Su(l,s),l.toUint8Array()}return null},w4=Bx;class ac extends Cx{constructor({guid:e=BT(),collectionid:n=null,gc:s=!0,gcFilter:a=()=>!0,meta:l=null,autoLoad:u=!1,shouldLoad:d=!0}={}){super(),this.gc=s,this.gcFilter=a,this.clientID=w4(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new P4,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=d,this.autoLoad=u,this.meta=l,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=zx(h=>{this.on("load",()=>{this.isLoaded=!0,h(this)})});const p=()=>zx(h=>{const y=_=>{(_===void 0||_===!0)&&(this.off("sync",y),h())};this.on("sync",y)});this.on("sync",h=>{h===!1&&this.isSynced&&(this.whenSynced=p()),this.isSynced=h===void 0||h===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=p()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Tn(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(lo(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Tn(this,e,n)}get(e,n=Vr){const s=Sa(this.share,e,()=>{const l=new n;return l._integrate(this,null),l}),a=s.constructor;if(n!==Vr&&a!==n)if(a===Vr){const l=new n;l._map=s._map,s._map.forEach(u=>{for(;u!==null;u=u.left)u.parent=l}),l._start=s._start;for(let u=l._start;u!==null;u=u.right)u.parent=l;return l._length=s._length,this.share.set(e,l),l._integrate(this,null),l}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return s}getArray(e=""){return this.get(e,bu)}getText(e=""){return this.get(e,Cu)}getMap(e=""){return this.get(e,zi)}getXmlElement(e=""){return this.get(e,Tu)}getXmlFragment(e=""){return this.get(e,lc)}toJSON(){const e={};return this.share.forEach((n,s)=>{e[s]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,lo(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new ac({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Tn(e.parent.doc,s=>{const a=n.doc;e.deleted||s.subdocsAdded.add(a),s.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class b4{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return It(this.restDecoder)}readDsLen(){return It(this.restDecoder)}}class E4 extends b4{readLeftID(){return nn(It(this.restDecoder),It(this.restDecoder))}readRightID(){return nn(It(this.restDecoder),It(this.restDecoder))}readClient(){return It(this.restDecoder)}readInfo(){return hu(this.restDecoder)}readString(){return ll(this.restDecoder)}readParentInfo(){return It(this.restDecoder)===1}readTypeRef(){return It(this.restDecoder)}readLen(){return It(this.restDecoder)}readAny(){return hh(this.restDecoder)}readBuf(){return uk($r(this.restDecoder))}readJSON(){return JSON.parse(ll(this.restDecoder))}readKey(){return ll(this.restDecoder)}}class sM{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=It(this.restDecoder),this.dsCurrVal}readDsLen(){const e=It(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class _u extends sM{constructor(e){super(e),this.keys=[],It(e),this.keyClockDecoder=new vv($r(e)),this.clientDecoder=new Tg($r(e)),this.leftClockDecoder=new vv($r(e)),this.rightClockDecoder=new vv($r(e)),this.infoDecoder=new Ux($r(e),hu),this.stringDecoder=new IT($r(e)),this.parentInfoDecoder=new Ux($r(e),hu),this.typeRefDecoder=new Tg($r(e)),this.lenDecoder=new Tg($r(e))}readLeftID(){return new xu(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new xu(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return hh(this.restDecoder)}readBuf(){return $r(this.restDecoder)}readJSON(){return hh(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class C4{constructor(){this.restEncoder=Zr()}toUint8Array(){return Pn(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){_t(this.restEncoder,e)}writeDsLen(e){_t(this.restEncoder,e)}}class vh extends C4{writeLeftID(e){_t(this.restEncoder,e.client),_t(this.restEncoder,e.clock)}writeRightID(e){_t(this.restEncoder,e.client),_t(this.restEncoder,e.clock)}writeClient(e){_t(this.restEncoder,e)}writeInfo(e){dv(this.restEncoder,e)}writeString(e){ic(this.restEncoder,e)}writeParentInfo(e){_t(this.restEncoder,e?1:0)}writeTypeRef(e){_t(this.restEncoder,e)}writeLen(e){_t(this.restEncoder,e)}writeAny(e){fh(this.restEncoder,e)}writeBuf(e){Jn(this.restEncoder,e)}writeJSON(e){ic(this.restEncoder,JSON.stringify(e))}writeKey(e){ic(this.restEncoder,e)}}class T4{constructor(){this.restEncoder=Zr(),this.dsCurrVal=0}toUint8Array(){return Pn(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,_t(this.restEncoder,n)}writeDsLen(e){e===0&&ws(),_t(this.restEncoder,e-1),this.dsCurrVal+=e}}class oc extends T4{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new gv,this.clientEncoder=new Eg,this.leftClockEncoder=new gv,this.rightClockEncoder=new gv,this.infoEncoder=new Nx(dv),this.stringEncoder=new LT,this.parentInfoEncoder=new Nx(dv),this.typeRefEncoder=new Eg,this.lenEncoder=new Eg}toUint8Array(){const e=Zr();return _t(e,0),Jn(e,this.keyClockEncoder.toUint8Array()),Jn(e,this.clientEncoder.toUint8Array()),Jn(e,this.leftClockEncoder.toUint8Array()),Jn(e,this.rightClockEncoder.toUint8Array()),Jn(e,Pn(this.infoEncoder)),Jn(e,this.stringEncoder.toUint8Array()),Jn(e,Pn(this.parentInfoEncoder)),Jn(e,this.typeRefEncoder.toUint8Array()),Jn(e,this.lenEncoder.toUint8Array()),bg(e,Pn(this.restEncoder)),Pn(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){fh(this.restEncoder,e)}writeBuf(e){Jn(this.restEncoder,e)}writeJSON(e){fh(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const aM=(t,e,n,s)=>{s=nc(s,e[0].id.clock);const a=wa(e,s);_t(t.restEncoder,e.length-a),t.writeClient(n),_t(t.restEncoder,s);const l=e[a];l.write(t,s-l.id.clock);for(let u=a+1;u<e.length;u++)e[u].write(t,0)},Ov=(t,e,n)=>{const s=new Map;n.forEach((a,l)=>{Ir(e,l)>a&&s.set(l,a)}),zg(e).forEach((a,l)=>{n.has(l)||s.set(l,0)}),_t(t.restEncoder,s.size),lo(s.entries()).sort((a,l)=>l[0]-a[0]).forEach(([a,l])=>{aM(t,e.clients.get(a),a,l)})},oM=(t,e)=>{const n=Bi(),s=It(t.restDecoder);for(let a=0;a<s;a++){const l=It(t.restDecoder),u=new Array(l),d=t.readClient();let p=It(t.restDecoder);n.set(d,{i:0,refs:u});for(let h=0;h<l;h++){const y=t.readInfo();switch(xg&y){case 0:{const _=t.readLen();u[h]=new bs(nn(d,p),_),p+=_;break}case 10:{const _=It(t.restDecoder);u[h]=new Es(nn(d,p),_),p+=_;break}default:{const _=(y&(co|es))===0,S=new gr(nn(d,p),null,(y&es)===es?t.readLeftID():null,null,(y&co)===co?t.readRightID():null,_?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,_&&(y&lh)===lh?t.readString():null,l3(t,y));u[h]=S,p+=S.length}}}}return n},lM=(t,e,n)=>{const s=[];let a=lo(n.keys()).sort((x,w)=>x-w);if(a.length===0)return null;const l=()=>{if(a.length===0)return null;let x=n.get(a[a.length-1]);for(;x.refs.length===x.i;)if(a.pop(),a.length>0)x=n.get(a[a.length-1]);else return null;return x};let u=l();if(u===null)return null;const d=new P4,p=new Map,h=(x,w)=>{const C=p.get(x);(C==null||C>w)&&p.set(x,w)};let y=u.refs[u.i++];const _=new Map,S=()=>{for(const x of s){const w=x.id.client,C=n.get(w);C?(C.i--,d.clients.set(w,C.refs.slice(C.i)),n.delete(w),C.i=0,C.refs=[]):d.clients.set(w,[x]),a=a.filter(D=>D!==w)}s.length=0};for(;;){if(y.constructor!==Es){const w=Sa(_,y.id.client,()=>Ir(e,y.id.client))-y.id.clock;if(w<0)s.push(y),h(y.id.client,y.id.clock-1),S();else{const C=y.getMissing(t,e);if(C!==null){s.push(y);const D=n.get(C)||{refs:[],i:0};if(D.refs.length===D.i)h(C,Ir(e,C)),S();else{y=D.refs[D.i++];continue}}else(w===0||w<y.length)&&(y.integrate(t,w),_.set(y.id.client,y.id.clock+y.length))}}if(s.length>0)y=s.pop();else if(u!==null&&u.i<u.refs.length)y=u.refs[u.i++];else{if(u=l(),u===null)break;y=u.refs[u.i++]}}if(d.clients.size>0){const x=new oc;return Ov(x,d,new Map),_t(x.restEncoder,0),{missing:p,update:x.toUint8Array()}}return null},cM=(t,e)=>Ov(t,e.doc.store,e.beforeState),uM=(t,e,n,s=new _u(t))=>Tn(e,a=>{a.local=!1;let l=!1;const u=a.doc,d=u.store,p=oM(s,u),h=lM(a,d,p),y=d.pendingStructs;if(y){for(const[S,x]of y.missing)if(x<Ir(d,S)){l=!0;break}if(h){for(const[S,x]of h.missing){const w=y.missing.get(S);(w==null||w>x)&&y.missing.set(S,x)}y.update=Gg([y.update,h.update])}}else d.pendingStructs=h;const _=x4(s,a,d);if(d.pendingDs){const S=new _u(ol(d.pendingDs));It(S.restDecoder);const x=x4(S,a,d);_&&x?d.pendingDs=Gg([_,x]):d.pendingDs=_||x}else d.pendingDs=_;if(l){const S=d.pendingStructs.update;d.pendingStructs=null,k4(a.doc,S)}},n,!1),k4=(t,e,n,s=_u)=>{const a=ol(e);uM(a,t,n,new s(a))},dM=(t,e,n)=>k4(t,e,n,E4),fM=(t,e,n=new Map)=>{Ov(t,e.store,n),Su(t,iM(e.store))},hM=(t,e=new Uint8Array([0]),n=new oc)=>{const s=M4(e);fM(n,t,s);const a=[n.toUint8Array()];if(t.store.pendingDs&&a.push(t.store.pendingDs),t.store.pendingStructs&&a.push(MM(t.store.pendingStructs.update,e)),a.length>1){if(n.constructor===vh)return TM(a.map((l,u)=>u===0?l:AM(l)));if(n.constructor===oc)return Gg(a)}return a[0]},pM=(t,e)=>hM(t,e,new vh),gM=t=>{const e=new Map,n=It(t.restDecoder);for(let s=0;s<n;s++){const a=It(t.restDecoder),l=It(t.restDecoder);e.set(a,l)}return e},M4=t=>gM(new b4(ol(t))),D4=(t,e)=>(_t(t.restEncoder,e.size),lo(e.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{_t(t.restEncoder,n),_t(t.restEncoder,s)}),t),yM=(t,e)=>D4(t,zg(e.store)),mM=(t,e=new T4)=>(t instanceof Map?D4(e,t):yM(e,t),e.toUint8Array()),vM=t=>mM(t,new C4);class SM{constructor(){this.l=[]}}const A4=()=>new SM,R4=(t,e)=>t.l.push(e),L4=(t,e)=>{const n=t.l,s=n.length;t.l=n.filter(a=>e!==a),s===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},N4=(t,e,n)=>xv(t.l,[e,n]);class xu{constructor(e,n){this.client=e,this.clock=n}}const Bg=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,nn=(t,e)=>new xu(t,e),_M=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw ws()},wu=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!_4(e.ds,t.id),Iv=(t,e)=>{const n=Sa(t.meta,Iv,al),s=t.doc.store;n.has(e)||(e.sv.forEach((a,l)=>{a<Ir(s,l)&&ul(t,nn(l,a))}),S4(t,e.ds,a=>{}),n.add(e))};class P4{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const zg=t=>{const e=new Map;return t.clients.forEach((n,s)=>{const a=n[n.length-1];e.set(s,a.id.clock+a.length)}),e},Ir=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const s=n[n.length-1];return s.id.clock+s.length},O4=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const s=n[n.length-1];if(s.id.clock+s.length!==e.id.clock)throw ws()}n.push(e)},wa=(t,e)=>{let n=0,s=t.length-1,a=t[s],l=a.id.clock;if(l===e)return s;let u=js(e/(l+a.length-1)*s);for(;n<=s;){if(a=t[u],l=a.id.clock,l<=e){if(e<l+a.length)return u;n=u+1}else s=u-1;u=js((n+s)/2)}throw ws()},Fv=(t,e)=>{const n=t.clients.get(e.client);return n[wa(n,e.clock)]},Uv=(t,e,n)=>{const s=wa(e,n),a=e[s];return a.id.clock<n&&a instanceof gr?(e.splice(s+1,0,$g(t,a,n-a.id.clock)),s+1):s},ul=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Uv(t,n,e.clock)]},I4=(t,e,n)=>{const s=e.clients.get(n.client),a=wa(s,n.clock),l=s[a];return n.clock!==l.id.clock+l.length-1&&l.constructor!==bs&&s.splice(a+1,0,$g(t,l,n.clock-l.id.clock+1)),l},xM=(t,e,n)=>{const s=t.clients.get(e.id.client);s[wa(s,e.id.clock)]=n},F4=(t,e,n,s,a)=>{if(s===0)return;const l=n+s;let u=Uv(t,e,n),d;do d=e[u++],l<d.id.clock+d.length&&Uv(t,e,l),a(d);while(u<e.length&&e[u].id.clock<l)};class wM{constructor(e,n,s){this.doc=e,this.deleteSet=new mh,this.beforeState=zg(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=s,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const U4=(t,e)=>e.deleteSet.clients.size===0&&!uT(e.afterState,(n,s)=>e.beforeState.get(s)!==n)?!1:(Nv(e.deleteSet),cM(t,e),Su(t,e.deleteSet),!0),B4=(t,e,n)=>{const s=e._item;(s===null||s.id.clock<(t.beforeState.get(s.id.client)||0)&&!s.deleted)&&Sa(t.changed,e,al).add(n)},Hg=(t,e)=>{let n=t[e],s=t[e-1],a=e;for(;a>0;n=s,s=t[--a-1]){if(s.deleted===n.deleted&&s.constructor===n.constructor&&s.mergeWith(n)){n instanceof gr&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,s);continue}break}const l=e-a;return l&&t.splice(e+1-l,l),l},bM=(t,e,n)=>{for(const[s,a]of t.clients.entries()){const l=e.clients.get(s);for(let u=a.length-1;u>=0;u--){const d=a[u],p=d.clock+d.len;for(let h=wa(l,d.clock),y=l[h];h<l.length&&y.id.clock<p;y=l[++h]){const _=l[h];if(d.clock+d.len<=_.id.clock)break;_ instanceof gr&&_.deleted&&!_.keep&&n(_)&&_.gc(e,!1)}}}},EM=(t,e)=>{t.clients.forEach((n,s)=>{const a=e.clients.get(s);for(let l=n.length-1;l>=0;l--){const u=n[l],d=av(a.length-1,1+wa(a,u.clock+u.len-1));for(let p=d,h=a[p];p>0&&h.id.clock>=u.clock;h=a[p])p-=1+Hg(a,p)}})},z4=(t,e)=>{if(e<t.length){const n=t[e],s=n.doc,a=s.store,l=n.deleteSet,u=n._mergeStructs;try{Nv(l),n.afterState=zg(n.doc.store),s.emit("beforeObserverCalls",[n,s]);const d=[];n.changed.forEach((p,h)=>d.push(()=>{(h._item===null||!h._item.deleted)&&h._callObserver(n,p)})),d.push(()=>{n.changedParentTypes.forEach((p,h)=>{h._dEH.l.length>0&&(h._item===null||!h._item.deleted)&&(p=p.filter(y=>y.target._item===null||!y.target._item.deleted),p.forEach(y=>{y.currentTarget=h,y._path=null}),p.sort((y,_)=>y.path.length-_.path.length),d.push(()=>{N4(h._dEH,p,n)}))}),d.push(()=>s.emit("afterTransaction",[n,s])),d.push(()=>{n._needFormattingCleanup&&YM(n)})}),xv(d,[])}finally{s.gc&&bM(l,a,s.gcFilter),EM(l,a),n.afterState.forEach((y,_)=>{const S=n.beforeState.get(_)||0;if(S!==y){const x=a.clients.get(_),w=nc(wa(x,S),1);for(let C=x.length-1;C>=w;)C-=1+Hg(x,C)}});for(let y=u.length-1;y>=0;y--){const{client:_,clock:S}=u[y].id,x=a.clients.get(_),w=wa(x,S);w+1<x.length&&Hg(x,w+1)>1||w>0&&Hg(x,w)}if(!n.local&&n.afterState.get(s.clientID)!==n.beforeState.get(s.clientID)&&(Zk(Av,h4,"[yjs] ",p4,g4,"Changed the client-id because another client seems to be using it."),s.clientID=w4()),s.emit("afterTransactionCleanup",[n,s]),s._observers.has("update")){const y=new vh;U4(y,n)&&s.emit("update",[y.toUint8Array(),n.origin,s,n])}if(s._observers.has("updateV2")){const y=new oc;U4(y,n)&&s.emit("updateV2",[y.toUint8Array(),n.origin,s,n])}const{subdocsAdded:d,subdocsLoaded:p,subdocsRemoved:h}=n;(d.size>0||h.size>0||p.size>0)&&(d.forEach(y=>{y.clientID=s.clientID,y.collectionid==null&&(y.collectionid=s.collectionid),s.subdocs.add(y)}),h.forEach(y=>s.subdocs.delete(y)),s.emit("subdocs",[{loaded:p,added:d,removed:h},s,n]),h.forEach(y=>y.destroy())),t.length<=e+1?(s._transactionCleanups=[],s.emit("afterAllTransactions",[s,t])):z4(t,e+1)}}},Tn=(t,e,n=null,s=!0)=>{const a=t._transactionCleanups;let l=!1,u=null;t._transaction===null&&(l=!0,t._transaction=new wM(t,n,s),a.push(t._transaction),a.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{u=e(t._transaction)}finally{if(l){const d=t._transaction===a[0];t._transaction=null,d&&z4(a,0)}}return u};function*CM(t){const e=It(t.restDecoder);for(let n=0;n<e;n++){const s=It(t.restDecoder),a=t.readClient();let l=It(t.restDecoder);for(let u=0;u<s;u++){const d=t.readInfo();if(d===10){const p=It(t.restDecoder);yield new Es(nn(a,l),p),l+=p}else if((xg&d)!==0){const p=(d&(co|es))===0,h=new gr(nn(a,l),null,(d&es)===es?t.readLeftID():null,null,(d&co)===co?t.readRightID():null,p?t.readParentInfo()?t.readString():t.readLeftID():null,p&&(d&lh)===lh?t.readString():null,l3(t,d));yield h,l+=h.length}else{const p=t.readLen();yield new bs(nn(a,l),p),l+=p}}}}class Bv{constructor(e,n){this.gen=CM(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Es);return this.curr}}class zv{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const TM=t=>Gg(t,E4,vh),kM=(t,e)=>{if(t.constructor===bs){const{client:n,clock:s}=t.id;return new bs(nn(n,s+e),t.length-e)}else if(t.constructor===Es){const{client:n,clock:s}=t.id;return new Es(nn(n,s+e),t.length-e)}else{const n=t,{client:s,clock:a}=n.id;return new gr(nn(s,a+e),null,nn(s,a+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Gg=(t,e=_u,n=oc)=>{if(t.length===1)return t[0];const s=t.map(y=>new e(ol(y)));let a=s.map(y=>new Bv(y,!0)),l=null;const u=new n,d=new zv(u);for(;a=a.filter(S=>S.curr!==null),a.sort((S,x)=>{if(S.curr.id.client===x.curr.id.client){const w=S.curr.id.clock-x.curr.id.clock;return w===0?S.curr.constructor===x.curr.constructor?0:S.curr.constructor===Es?1:-1:w}else return x.curr.id.client-S.curr.id.client}),a.length!==0;){const y=a[0],_=y.curr.id.client;if(l!==null){let S=y.curr,x=!1;for(;S!==null&&S.id.clock+S.length<=l.struct.id.clock+l.struct.length&&S.id.client>=l.struct.id.client;)S=y.next(),x=!0;if(S===null||S.id.client!==_||x&&S.id.clock>l.struct.id.clock+l.struct.length)continue;if(_!==l.struct.id.client)dl(d,l.struct,l.offset),l={struct:S,offset:0},y.next();else if(l.struct.id.clock+l.struct.length<S.id.clock)if(l.struct.constructor===Es)l.struct.length=S.id.clock+S.length-l.struct.id.clock;else{dl(d,l.struct,l.offset);const w=S.id.clock-l.struct.id.clock-l.struct.length;l={struct:new Es(nn(_,l.struct.id.clock+l.struct.length),w),offset:0}}else{const w=l.struct.id.clock+l.struct.length-S.id.clock;w>0&&(l.struct.constructor===Es?l.struct.length-=w:S=kM(S,w)),l.struct.mergeWith(S)||(dl(d,l.struct,l.offset),l={struct:S,offset:0},y.next())}}else l={struct:y.curr,offset:0},y.next();for(let S=y.curr;S!==null&&S.id.client===_&&S.id.clock===l.struct.id.clock+l.struct.length&&S.constructor!==Es;S=y.next())dl(d,l.struct,l.offset),l={struct:S,offset:0}}l!==null&&(dl(d,l.struct,l.offset),l=null),Hv(d);const p=s.map(y=>Pv(y)),h=nM(p);return Su(u,h),u.toUint8Array()},MM=(t,e,n=_u,s=oc)=>{const a=M4(e),l=new s,u=new zv(l),d=new n(ol(t)),p=new Bv(d,!1);for(;p.curr;){const y=p.curr,_=y.id.client,S=a.get(_)||0;if(p.curr.constructor===Es){p.next();continue}if(y.id.clock+y.length>S)for(dl(u,y,nc(S-y.id.clock,0)),p.next();p.curr&&p.curr.id.client===_;)dl(u,p.curr,0),p.next();else for(;p.curr&&p.curr.id.client===_&&p.curr.id.clock+p.curr.length<=S;)p.next()}Hv(u);const h=Pv(d);return Su(l,h),l.toUint8Array()},H4=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Pn(t.encoder.restEncoder)}),t.encoder.restEncoder=Zr(),t.written=0)},dl=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&H4(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),_t(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},Hv=t=>{H4(t);const e=t.encoder.restEncoder;_t(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const s=t.clientStructs[n];_t(e,s.written),bg(e,s.restEncoder)}},DM=(t,e,n,s)=>{const a=new n(ol(t)),l=new Bv(a,!1),u=new s,d=new zv(u);for(let h=l.curr;h!==null;h=l.next())dl(d,e(h),0);Hv(d);const p=Pv(a);return Su(u,p),u.toUint8Array()},AM=t=>DM(t,JT,_u,vh),G4="You must not compute changes after the event-handler fired.";class Vg{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=RM(this.currentTarget,this.target))}deletes(e){return _4(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw _a(G4);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(a=>{if(a!==null){const l=n._map.get(a);let u,d;if(this.adds(l)){let p=l.left;for(;p!==null&&this.adds(p);)p=p.left;if(this.deletes(l))if(p!==null&&this.deletes(p))u="delete",d=iv(p.content.getContent());else return;else p!==null&&this.deletes(p)?(u="update",d=iv(p.content.getContent())):(u="add",d=void 0)}else if(this.deletes(l))u="delete",d=iv(l.content.getContent());else return;e.set(a,{action:u,oldValue:d})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw _a(G4);const n=this.target,s=al(),a=al(),l=[];if(e={added:s,deleted:a,delta:l,keys:this.keys},this.transaction.changed.get(n).has(null)){let d=null;const p=()=>{d&&l.push(d)};for(let h=n._start;h!==null;h=h.right)h.deleted?this.deletes(h)&&!this.adds(h)&&((d===null||d.delete===void 0)&&(p(),d={delete:0}),d.delete+=h.length,a.add(h)):this.adds(h)?((d===null||d.insert===void 0)&&(p(),d={insert:[]}),d.insert=d.insert.concat(h.content.getContent()),s.add(h)):((d===null||d.retain===void 0)&&(p(),d={retain:0}),d.retain+=h.length);d!==null&&d.retain===void 0&&p()}this._changes=e}return e}}const RM=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let s=0,a=e._item.parent._start;for(;a!==e._item&&a!==null;)!a.deleted&&a.countable&&(s+=a.length),a=a.right;n.unshift(s)}e=e._item.parent}return n},ti=()=>{$k("Invalid access: Add Yjs type to a document before reading data.")},V4=80;let Gv=0;class LM{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Gv++}}const NM=t=>{t.timestamp=Gv++},Y4=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Gv++},PM=(t,e,n)=>{if(t.length>=V4){const s=t.reduce((a,l)=>a.timestamp<l.timestamp?a:l);return Y4(s,e,n),s}else{const s=new LM(e,n);return t.push(s),s}},Yg=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((l,u)=>_g(e-l.index)<_g(e-u.index)?l:u);let s=t._start,a=0;for(n!==null&&(s=n.p,a=n.index,NM(n));s.right!==null&&a<e;){if(!s.deleted&&s.countable){if(e<a+s.length)break;a+=s.length}s=s.right}for(;s.left!==null&&a>e;)s=s.left,!s.deleted&&s.countable&&(a-=s.length);for(;s.left!==null&&s.left.id.client===s.id.client&&s.left.id.clock+s.left.length===s.id.clock;)s=s.left,!s.deleted&&s.countable&&(a-=s.length);return n!==null&&_g(n.index-a)<s.parent.length/V4?(Y4(n,s,a),n):PM(t._searchMarker,s,a)},Sh=(t,e,n)=>{for(let s=t.length-1;s>=0;s--){const a=t[s];if(n>0){let l=a.p;for(l.marker=!1;l&&(l.deleted||!l.countable);)l=l.left,l&&!l.deleted&&l.countable&&(a.index-=l.length);if(l===null||l.marker===!0){t.splice(s,1);continue}a.p=l,l.marker=!0}(e<a.index||n>0&&e===a.index)&&(a.index=nc(e,a.index+n))}},jg=(t,e,n)=>{const s=t,a=e.changedParentTypes;for(;Sa(a,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;N4(s._eH,n,e)};class Vr{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=A4(),this._dEH=A4(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Ws()}clone(){throw Ws()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){R4(this._eH,e)}observeDeep(e){R4(this._dEH,e)}unobserve(e){L4(this._eH,e)}unobserveDeep(e){L4(this._dEH,e)}toJSON(){}}const j4=(t,e,n)=>{t.doc??ti(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let s=n-e;const a=[];let l=t._start;for(;l!==null&&s>0;){if(l.countable&&!l.deleted){const u=l.content.getContent();if(u.length<=e)e-=u.length;else{for(let d=e;d<u.length&&s>0;d++)a.push(u[d]),s--;e=0}}l=l.right}return a},W4=t=>{t.doc??ti();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const s=n.content.getContent();for(let a=0;a<s.length;a++)e.push(s[a])}n=n.right}return e},_h=(t,e)=>{let n=0,s=t._start;for(t.doc??ti();s!==null;){if(s.countable&&!s.deleted){const a=s.content.getContent();for(let l=0;l<a.length;l++)e(a[l],n++,t)}s=s.right}},X4=(t,e)=>{const n=[];return _h(t,(s,a)=>{n.push(e(s,a,t))}),n},OM=t=>{let e=t._start,n=null,s=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),s=0,e=e.right}const a=n[s++];return n.length<=s&&(n=null),{done:!1,value:a}}}},q4=(t,e)=>{t.doc??ti();const n=Yg(t,e);let s=t._start;for(n!==null&&(s=n.p,e-=n.index);s!==null;s=s.right)if(!s.deleted&&s.countable){if(e<s.length)return s.content.getContent()[e];e-=s.length}},Wg=(t,e,n,s)=>{let a=n;const l=t.doc,u=l.clientID,d=l.store,p=n===null?e._start:n.right;let h=[];const y=()=>{h.length>0&&(a=new gr(nn(u,Ir(d,u)),a,a&&a.lastId,p,p&&p.id,e,null,new uc(h)),a.integrate(t,0),h=[])};s.forEach(_=>{if(_===null)h.push(_);else switch(_.constructor){case Number:case Object:case Boolean:case Array:case String:h.push(_);break;default:switch(y(),_.constructor){case Uint8Array:case ArrayBuffer:a=new gr(nn(u,Ir(d,u)),a,a&&a.lastId,p,p&&p.id,e,null,new xh(new Uint8Array(_))),a.integrate(t,0);break;case ac:a=new gr(nn(u,Ir(d,u)),a,a&&a.lastId,p,p&&p.id,e,null,new bh(_)),a.integrate(t,0);break;default:if(_ instanceof Vr)a=new gr(nn(u,Ir(d,u)),a,a&&a.lastId,p,p&&p.id,e,null,new ho(_)),a.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),y()},K4=()=>_a("Length exceeded!"),Q4=(t,e,n,s)=>{if(n>e._length)throw K4();if(n===0)return e._searchMarker&&Sh(e._searchMarker,n,s.length),Wg(t,e,null,s);const a=n,l=Yg(e,n);let u=e._start;for(l!==null&&(u=l.p,n-=l.index,n===0&&(u=u.prev,n+=u&&u.countable&&!u.deleted?u.length:0));u!==null;u=u.right)if(!u.deleted&&u.countable){if(n<=u.length){n<u.length&&ul(t,nn(u.id.client,u.id.clock+n));break}n-=u.length}return e._searchMarker&&Sh(e._searchMarker,a,s.length),Wg(t,e,u,s)},IM=(t,e,n)=>{let a=(e._searchMarker||[]).reduce((l,u)=>u.index>l.index?u:l,{index:0,p:e._start}).p;if(a)for(;a.right;)a=a.right;return Wg(t,e,a,n)},J4=(t,e,n,s)=>{if(s===0)return;const a=n,l=s,u=Yg(e,n);let d=e._start;for(u!==null&&(d=u.p,n-=u.index);d!==null&&n>0;d=d.right)!d.deleted&&d.countable&&(n<d.length&&ul(t,nn(d.id.client,d.id.clock+n)),n-=d.length);for(;s>0&&d!==null;)d.deleted||(s<d.length&&ul(t,nn(d.id.client,d.id.clock+s)),d.delete(t),s-=d.length),d=d.right;if(s>0)throw K4();e._searchMarker&&Sh(e._searchMarker,a,-l+s)},Xg=(t,e,n)=>{const s=e._map.get(n);s!==void 0&&s.delete(t)},Vv=(t,e,n,s)=>{const a=e._map.get(n)||null,l=t.doc,u=l.clientID;let d;if(s==null)d=new uc([s]);else switch(s.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:d=new uc([s]);break;case Uint8Array:d=new xh(s);break;case ac:d=new bh(s);break;default:if(s instanceof Vr)d=new ho(s);else throw new Error("Unexpected content type")}new gr(nn(u,Ir(l.store,u)),a,a&&a.lastId,null,null,e,n,d).integrate(t,0)},Yv=(t,e)=>{t.doc??ti();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Z4=t=>{const e={};return t.doc??ti(),t._map.forEach((n,s)=>{n.deleted||(e[s]=n.content.getContent()[n.length-1])}),e},$4=(t,e)=>{t.doc??ti();const n=t._map.get(e);return n!==void 0&&!n.deleted},FM=(t,e)=>{const n={};return t._map.forEach((s,a)=>{let l=s;for(;l!==null&&(!e.sv.has(l.id.client)||l.id.clock>=(e.sv.get(l.id.client)||0));)l=l.left;l!==null&&wu(l,e)&&(n[a]=l.content.getContent()[l.length-1])}),n},qg=t=>(t.doc??ti(),eM(t._map.entries(),e=>!e[1].deleted));class UM extends Vg{}class bu extends Vr{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new bu;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new bu}clone(){const e=new bu;return e.insert(0,this.toArray().map(n=>n instanceof Vr?n.clone():n)),e}get length(){return this.doc??ti(),this._length}_callObserver(e,n){super._callObserver(e,n),jg(this,e,new UM(this,e))}insert(e,n){this.doc!==null?Tn(this.doc,s=>{Q4(s,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Tn(this.doc,n=>{IM(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Tn(this.doc,s=>{J4(s,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return q4(this,e)}toArray(){return W4(this)}slice(e=0,n=this.length){return j4(this,e,n)}toJSON(){return this.map(e=>e instanceof Vr?e.toJSON():e)}map(e){return X4(this,e)}forEach(e){_h(this,e)}[Symbol.iterator](){return OM(this)}_write(e){e.writeTypeRef(cD)}}const BM=t=>new bu;class zM extends Vg{constructor(e,n,s){super(e,n),this.keysChanged=s}}class zi extends Vr{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((s,a)=>{this.set(a,s)}),this._prelimContent=null}_copy(){return new zi}clone(){const e=new zi;return this.forEach((n,s)=>{e.set(s,n instanceof Vr?n.clone():n)}),e}_callObserver(e,n){jg(this,e,new zM(this,e,n))}toJSON(){this.doc??ti();const e={};return this._map.forEach((n,s)=>{if(!n.deleted){const a=n.content.getContent()[n.length-1];e[s]=a instanceof Vr?a.toJSON():a}}),e}get size(){return[...qg(this)].length}keys(){return Rv(qg(this),e=>e[0])}values(){return Rv(qg(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Rv(qg(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??ti(),this._map.forEach((n,s)=>{n.deleted||e(n.content.getContent()[n.length-1],s,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Tn(this.doc,n=>{Xg(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Tn(this.doc,s=>{Vv(s,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Yv(this,e)}has(e){return $4(this,e)}clear(){this.doc!==null?Tn(this.doc,e=>{this.forEach(function(n,s,a){Xg(e,a,s)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(uD)}}const HM=t=>new zi,fl=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&KT(t,e);class jv{constructor(e,n,s,a){this.left=e,this.right=n,this.index=s,this.currentAttributes=a}forward(){switch(this.right===null&&ws(),this.right.content.constructor){case pr:this.right.deleted||Eu(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const e3=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case pr:e.right.deleted||Eu(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&ul(t,nn(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},Kg=(t,e,n,s)=>{const a=new Map,l=s?Yg(e,n):null;if(l){const u=new jv(l.p.left,l.p,l.index,a);return e3(t,u,n-l.index)}else{const u=new jv(null,e._start,0,a);return e3(t,u,n)}},t3=(t,e,n,s)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===pr&&fl(s.get(n.right.content.key),n.right.content.value));)n.right.deleted||s.delete(n.right.content.key),n.forward();const a=t.doc,l=a.clientID;s.forEach((u,d)=>{const p=n.left,h=n.right,y=new gr(nn(l,Ir(a.store,l)),p,p&&p.lastId,h,h&&h.id,e,null,new pr(d,u));y.integrate(t,0),n.right=y,n.forward()})},Eu=(t,e)=>{const{key:n,value:s}=e;s===null?t.delete(n):t.set(n,s)},n3=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===pr&&fl(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},r3=(t,e,n,s)=>{const a=t.doc,l=a.clientID,u=new Map;for(const d in s){const p=s[d],h=n.currentAttributes.get(d)??null;if(!fl(h,p)){u.set(d,h);const{left:y,right:_}=n;n.right=new gr(nn(l,Ir(a.store,l)),y,y&&y.lastId,_,_&&_.id,e,null,new pr(d,p)),n.right.integrate(t,0),n.forward()}}return u},Wv=(t,e,n,s,a)=>{n.currentAttributes.forEach((S,x)=>{a[x]===void 0&&(a[x]=null)});const l=t.doc,u=l.clientID;n3(n,a);const d=r3(t,e,n,a),p=s.constructor===String?new ba(s):s instanceof Vr?new ho(s):new cc(s);let{left:h,right:y,index:_}=n;e._searchMarker&&Sh(e._searchMarker,n.index,p.getLength()),y=new gr(nn(u,Ir(l.store,u)),h,h&&h.lastId,y,y&&y.id,e,null,p),y.integrate(t,0),n.right=y,n.index=_,n.forward(),t3(t,e,n,d)},i3=(t,e,n,s,a)=>{const l=t.doc,u=l.clientID;n3(n,a);const d=r3(t,e,n,a);e:for(;n.right!==null&&(s>0||d.size>0&&(n.right.deleted||n.right.content.constructor===pr));){if(!n.right.deleted)switch(n.right.content.constructor){case pr:{const{key:p,value:h}=n.right.content,y=a[p];if(y!==void 0){if(fl(y,h))d.delete(p);else{if(s===0)break e;d.set(p,h)}n.right.delete(t)}else n.currentAttributes.set(p,h);break}default:s<n.right.length&&ul(t,nn(n.right.id.client,n.right.id.clock+s)),s-=n.right.length;break}n.forward()}if(s>0){let p="";for(;s>0;s--)p+=`
|
|
311
|
+
`;n.right=new gr(nn(u,Ir(l.store,u)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new ba(p)),n.right.integrate(t,0),n.forward()}t3(t,e,n,d)},s3=(t,e,n,s,a)=>{let l=e;const u=Bi();for(;l&&(!l.countable||l.deleted);){if(!l.deleted&&l.content.constructor===pr){const h=l.content;u.set(h.key,h)}l=l.right}let d=0,p=!1;for(;e!==l;){if(n===e&&(p=!0),!e.deleted){const h=e.content;switch(h.constructor){case pr:{const{key:y,value:_}=h,S=s.get(y)??null;(u.get(y)!==h||S===_)&&(e.delete(t),d++,!p&&(a.get(y)??null)===_&&S!==_&&(S===null?a.delete(y):a.set(y,S))),!p&&!e.deleted&&Eu(a,h);break}}}e=e.right}return d},GM=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===pr){const s=e.content.key;n.has(s)?e.delete(t):n.add(s)}e=e.left}},VM=t=>{let e=0;return Tn(t.doc,n=>{let s=t._start,a=t._start,l=Bi();const u=rv(l);for(;a;){if(a.deleted===!1)switch(a.content.constructor){case pr:Eu(u,a.content);break;default:e+=s3(n,s,a,l,u),l=rv(u),s=a;break}a=a.right}}),e},YM=t=>{const e=new Set,n=t.doc;for(const[s,a]of t.afterState.entries()){const l=t.beforeState.get(s)||0;a!==l&&F4(t,n.store.clients.get(s),l,a,u=>{!u.deleted&&u.content.constructor===pr&&u.constructor!==bs&&e.add(u.parent)})}Tn(n,s=>{S4(t,t.deleteSet,a=>{if(a instanceof bs||!a.parent._hasFormatting||e.has(a.parent))return;const l=a.parent;a.content.constructor===pr?e.add(l):GM(s,a)});for(const a of e)VM(a)})},a3=(t,e,n)=>{const s=n,a=rv(e.currentAttributes),l=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case ho:case cc:case ba:n<e.right.length&&ul(t,nn(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}l&&s3(t,l,e.right,a,e.currentAttributes);const u=(e.left||e.right).parent;return u._searchMarker&&Sh(u._searchMarker,e.index,-s+n),e};class jM extends Vg{constructor(e,n,s){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,s.forEach(a=>{a===null?this.childListChanged=!0:this.keysChanged.add(a)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];Tn(e,s=>{const a=new Map,l=new Map;let u=this.target._start,d=null;const p={};let h="",y=0,_=0;const S=()=>{if(d!==null){let x=null;switch(d){case"delete":_>0&&(x={delete:_}),_=0;break;case"insert":(typeof h=="object"||h.length>0)&&(x={insert:h},a.size>0&&(x.attributes={},a.forEach((w,C)=>{w!==null&&(x.attributes[C]=w)}))),h="";break;case"retain":y>0&&(x={retain:y},qT(p)||(x.attributes=YT({},p))),y=0;break}x&&n.push(x),d=null}};for(;u!==null;){switch(u.content.constructor){case ho:case cc:this.adds(u)?this.deletes(u)||(S(),d="insert",h=u.content.getContent()[0],S()):this.deletes(u)?(d!=="delete"&&(S(),d="delete"),_+=1):u.deleted||(d!=="retain"&&(S(),d="retain"),y+=1);break;case ba:this.adds(u)?this.deletes(u)||(d!=="insert"&&(S(),d="insert"),h+=u.content.str):this.deletes(u)?(d!=="delete"&&(S(),d="delete"),_+=u.length):u.deleted||(d!=="retain"&&(S(),d="retain"),y+=u.length);break;case pr:{const{key:x,value:w}=u.content;if(this.adds(u)){if(!this.deletes(u)){const C=a.get(x)??null;fl(C,w)?w!==null&&u.delete(s):(d==="retain"&&S(),fl(w,l.get(x)??null)?delete p[x]:p[x]=w)}}else if(this.deletes(u)){l.set(x,w);const C=a.get(x)??null;fl(C,w)||(d==="retain"&&S(),p[x]=C)}else if(!u.deleted){l.set(x,w);const C=p[x];C!==void 0&&(fl(C,w)?C!==null&&u.delete(s):(d==="retain"&&S(),w===null?delete p[x]:p[x]=w))}u.deleted||(d==="insert"&&S(),Eu(a,u.content));break}}u=u.right}for(S();n.length>0;){const x=n[n.length-1];if(x.retain!==void 0&&x.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Cu extends Vr{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??ti(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(s=>s())}catch(s){console.error(s)}this._pending=null}_copy(){return new Cu}clone(){const e=new Cu;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const s=new jM(this,e,n);jg(this,e,s),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??ti();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ba&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Tn(this.doc,s=>{const a=new jv(null,this._start,0,new Map);for(let l=0;l<e.length;l++){const u=e[l];if(u.insert!==void 0){const d=!n&&typeof u.insert=="string"&&l===e.length-1&&a.right===null&&u.insert.slice(-1)===`
|
|
312
|
+
`?u.insert.slice(0,-1):u.insert;(typeof d!="string"||d.length>0)&&Wv(s,this,a,d,u.attributes||{})}else u.retain!==void 0?i3(s,this,a,u.retain,u.attributes||{}):u.delete!==void 0&&a3(s,a,u.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,s){this.doc??ti();const a=[],l=new Map,u=this.doc;let d="",p=this._start;function h(){if(d.length>0){const _={};let S=!1;l.forEach((w,C)=>{S=!0,_[C]=w});const x={insert:d};S&&(x.attributes=_),a.push(x),d=""}}const y=()=>{for(;p!==null;){if(wu(p,e)||n!==void 0&&wu(p,n))switch(p.content.constructor){case ba:{const _=l.get("ychange");e!==void 0&&!wu(p,e)?(_===void 0||_.user!==p.id.client||_.type!=="removed")&&(h(),l.set("ychange",s?s("removed",p.id):{type:"removed"})):n!==void 0&&!wu(p,n)?(_===void 0||_.user!==p.id.client||_.type!=="added")&&(h(),l.set("ychange",s?s("added",p.id):{type:"added"})):_!==void 0&&(h(),l.delete("ychange")),d+=p.content.str;break}case ho:case cc:{h();const _={insert:p.content.getContent()[0]};if(l.size>0){const S={};_.attributes=S,l.forEach((x,w)=>{S[w]=x})}a.push(_);break}case pr:wu(p,e)&&(h(),Eu(l,p.content));break}p=p.right}h()};return e||n?Tn(u,_=>{e&&Iv(_,e),n&&Iv(_,n),y()},"cleanup"):y(),a}insert(e,n,s){if(n.length<=0)return;const a=this.doc;a!==null?Tn(a,l=>{const u=Kg(l,this,e,!s);s||(s={},u.currentAttributes.forEach((d,p)=>{s[p]=d})),Wv(l,this,u,n,s)}):this._pending.push(()=>this.insert(e,n,s))}insertEmbed(e,n,s){const a=this.doc;a!==null?Tn(a,l=>{const u=Kg(l,this,e,!s);Wv(l,this,u,n,s||{})}):this._pending.push(()=>this.insertEmbed(e,n,s||{}))}delete(e,n){if(n===0)return;const s=this.doc;s!==null?Tn(s,a=>{a3(a,Kg(a,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,s){if(n===0)return;const a=this.doc;a!==null?Tn(a,l=>{const u=Kg(l,this,e,!1);u.right!==null&&i3(l,this,u,n,s)}):this._pending.push(()=>this.format(e,n,s))}removeAttribute(e){this.doc!==null?Tn(this.doc,n=>{Xg(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Tn(this.doc,s=>{Vv(s,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Yv(this,e)}getAttributes(){return Z4(this)}_write(e){e.writeTypeRef(dD)}}const WM=t=>new Cu;class Xv{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??ti()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===Tu||n.constructor===lc)&&n._start!==null)e=n._start;else for(;e!==null;){const s=e.next;if(s!==null){e=s;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class lc extends Vr{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new lc}clone(){const e=new lc;return e.insert(0,this.toArray().map(n=>n instanceof Vr?n.clone():n)),e}get length(){return this.doc??ti(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Xv(this,e)}querySelector(e){e=e.toUpperCase();const s=new Xv(this,a=>a.nodeName&&a.nodeName.toUpperCase()===e).next();return s.done?null:s.value}querySelectorAll(e){return e=e.toUpperCase(),lo(new Xv(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){jg(this,e,new KM(this,n,e))}toString(){return X4(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},s){const a=e.createDocumentFragment();return s!==void 0&&s._createAssociation(a,this),_h(this,l=>{a.insertBefore(l.toDOM(e,n,s),null)}),a}insert(e,n){this.doc!==null?Tn(this.doc,s=>{Q4(s,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Tn(this.doc,s=>{const a=e&&e instanceof Vr?e._item:e;Wg(s,this,a,n)});else{const s=this._prelimContent,a=e===null?0:s.findIndex(l=>l===e)+1;if(a===0&&e!==null)throw _a("Reference item not found");s.splice(a,0,...n)}}delete(e,n=1){this.doc!==null?Tn(this.doc,s=>{J4(s,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return W4(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return q4(this,e)}slice(e=0,n=this.length){return j4(this,e,n)}forEach(e){_h(this,e)}_write(e){e.writeTypeRef(hD)}}const XM=t=>new lc;class Tu extends lc{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((s,a)=>{this.setAttribute(a,s)}),this._prelimAttrs=null}_copy(){return new Tu(this.nodeName)}clone(){const e=new Tu(this.nodeName),n=this.getAttributes();return WT(n,(s,a)=>{e.setAttribute(a,s)}),e.insert(0,this.toArray().map(s=>s instanceof Vr?s.clone():s)),e}toString(){const e=this.getAttributes(),n=[],s=[];for(const d in e)s.push(d);s.sort();const a=s.length;for(let d=0;d<a;d++){const p=s[d];n.push(p+'="'+e[p]+'"')}const l=this.nodeName.toLocaleLowerCase(),u=n.length>0?" "+n.join(" "):"";return`<${l}${u}>${super.toString()}</${l}>`}removeAttribute(e){this.doc!==null?Tn(this.doc,n=>{Xg(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Tn(this.doc,s=>{Vv(s,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Yv(this,e)}hasAttribute(e){return $4(this,e)}getAttributes(e){return e?FM(this,e):Z4(this)}toDOM(e=document,n={},s){const a=e.createElement(this.nodeName),l=this.getAttributes();for(const u in l){const d=l[u];typeof d=="string"&&a.setAttribute(u,d)}return _h(this,u=>{a.appendChild(u.toDOM(e,n,s))}),s!==void 0&&s._createAssociation(a,this),a}_write(e){e.writeTypeRef(fD),e.writeKey(this.nodeName)}}const qM=t=>new Tu(t.readKey());class KM extends Vg{constructor(e,n,s){super(e,s),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(a=>{a===null?this.childListChanged=!0:this.attributesChanged.add(a)})}}class Qg extends zi{constructor(e){super(),this.hookName=e}_copy(){return new Qg(this.hookName)}clone(){const e=new Qg(this.hookName);return this.forEach((n,s)=>{e.set(s,n)}),e}toDOM(e=document,n={},s){const a=n[this.hookName];let l;return a!==void 0?l=a.createDom(this):l=document.createElement(this.hookName),l.setAttribute("data-yjs-hook",this.hookName),s!==void 0&&s._createAssociation(l,this),l}_write(e){e.writeTypeRef(pD),e.writeKey(this.hookName)}}const QM=t=>new Qg(t.readKey());class Jg extends Cu{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Jg}clone(){const e=new Jg;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,s){const a=e.createTextNode(this.toString());return s!==void 0&&s._createAssociation(a,this),a}toString(){return this.toDelta().map(e=>{const n=[];for(const a in e.attributes){const l=[];for(const u in e.attributes[a])l.push({key:u,value:e.attributes[a][u]});l.sort((u,d)=>u.key<d.key?-1:1),n.push({nodeName:a,attrs:l})}n.sort((a,l)=>a.nodeName<l.nodeName?-1:1);let s="";for(let a=0;a<n.length;a++){const l=n[a];s+=`<${l.nodeName}`;for(let u=0;u<l.attrs.length;u++){const d=l.attrs[u];s+=` ${d.key}="${d.value}"`}s+=">"}s+=e.insert;for(let a=n.length-1;a>=0;a--)s+=`</${n[a].nodeName}>`;return s}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(gD)}}const JM=t=>new Jg;class qv{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Ws()}mergeWith(e){return!1}write(e,n,s){throw Ws()}integrate(e,n){throw Ws()}}const ZM=0;class bs extends qv{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),O4(e.doc.store,this)}write(e,n){e.writeInfo(ZM),e.writeLen(this.length-n)}getMissing(e,n){return null}}class xh{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new xh(this.content)}splice(e){throw Ws()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const $M=t=>new xh(t.readBuf());class wh{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new wh(this.len)}splice(e){const n=new wh(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Ug(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const eD=t=>new wh(t.readLen()),o3=(t,e)=>new ac({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class bh{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new bh(o3(this.doc.guid,this.opts))}splice(e){throw Ws()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const tD=t=>new bh(o3(t.readString(),t.readAny()));class cc{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new cc(this.embed)}splice(e){throw Ws()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const nD=t=>new cc(t.readJSON());class pr{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new pr(this.key,this.value)}splice(e){throw Ws()}mergeWith(e){return!1}integrate(e,n){const s=n.parent;s._searchMarker=null,s._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const rD=t=>new pr(t.readKey(),t.readJSON());class Zg{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Zg(this.arr)}splice(e){const n=new Zg(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const s=this.arr.length;e.writeLen(s-n);for(let a=n;a<s;a++){const l=this.arr[a];e.writeString(l===void 0?"undefined":JSON.stringify(l))}}getRef(){return 2}}const iD=t=>{const e=t.readLen(),n=[];for(let s=0;s<e;s++){const a=t.readString();a==="undefined"?n.push(void 0):n.push(JSON.parse(a))}return new Zg(n)},sD=Mg("node_env")==="development";class uc{constructor(e){this.arr=e,sD&&jx(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new uc(this.arr)}splice(e){const n=new uc(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const s=this.arr.length;e.writeLen(s-n);for(let a=n;a<s;a++){const l=this.arr[a];e.writeAny(l)}}getRef(){return 8}}const aD=t=>{const e=t.readLen(),n=[];for(let s=0;s<e;s++)n.push(t.readAny());return new uc(n)};class ba{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ba(this.str)}splice(e){const n=new ba(this.str.slice(e));this.str=this.str.slice(0,e);const s=this.str.charCodeAt(e-1);return s>=55296&&s<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const oD=t=>new ba(t.readString()),lD=[BM,HM,WM,qM,XM,QM,JM],cD=0,uD=1,dD=2,fD=3,hD=4,pD=5,gD=6;class ho{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new ho(this.type._copy())}splice(e){throw Ws()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(s=>{s.deleted?s.id.clock<(e.beforeState.get(s.id.client)||0)&&e._mergeStructs.push(s):s.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(s=>{for(;s!==null;)s.gc(e,!0),s=s.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const yD=t=>new ho(lD[t.readTypeRef()](t)),$g=(t,e,n)=>{const{client:s,clock:a}=e.id,l=new gr(nn(s,a+n),e,nn(s,a+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&l.markDeleted(),e.keep&&(l.keep=!0),e.redone!==null&&(l.redone=nn(e.redone.client,e.redone.clock+n)),e.right=l,l.right!==null&&(l.right.left=l),t._mergeStructs.push(l),l.parentSub!==null&&l.right===null&&l.parent._map.set(l.parentSub,l),e.length=n,l};class gr extends qv{constructor(e,n,s,a,l,u,d,p){super(e,p.getLength()),this.origin=s,this.left=n,this.right=a,this.rightOrigin=l,this.parent=u,this.parentSub=d,this.redone=null,this.content=p,this.info=this.content.isCountable()?Mx:0}set marker(e){(this.info&lv)>0!==e&&(this.info^=lv)}get marker(){return(this.info&lv)>0}get keep(){return(this.info&kx)>0}set keep(e){this.keep!==e&&(this.info^=kx)}get countable(){return(this.info&Mx)>0}get deleted(){return(this.info&ov)>0}set deleted(e){this.deleted!==e&&(this.info^=ov)}markDeleted(){this.info|=ov}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ir(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ir(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===xu&&this.id.client!==this.parent.client&&this.parent.clock>=Ir(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=I4(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=ul(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===bs||this.right&&this.right.constructor===bs)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===gr?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===gr&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===xu){const s=Fv(n,this.parent);s.constructor===bs?this.parent=null:this.parent=s.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=I4(e,e.doc.store,nn(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let s=this.left,a;if(s!==null)a=s.right;else if(this.parentSub!==null)for(a=this.parent._map.get(this.parentSub)||null;a!==null&&a.left!==null;)a=a.left;else a=this.parent._start;const l=new Set,u=new Set;for(;a!==null&&a!==this.right;){if(u.add(a),l.add(a),Bg(this.origin,a.origin)){if(a.id.client<this.id.client)s=a,l.clear();else if(Bg(this.rightOrigin,a.rightOrigin))break}else if(a.origin!==null&&u.has(Fv(e.doc.store,a.origin)))l.has(Fv(e.doc.store,a.origin))||(s=a,l.clear());else break;a=a.right}this.left=s}if(this.left!==null){const s=this.left.right;this.right=s,this.left.right=this}else{let s;if(this.parentSub!==null)for(s=this.parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start,this.parent._start=this;this.right=s}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),O4(e.doc.store,this),this.content.integrate(e,this),B4(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new bs(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:nn(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Bg(e.origin,this.lastId)&&this.right===e&&Bg(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(s=>{s.p===e&&(s.p=this,!this.deleted&&this.countable&&(s.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Ug(e.deleteSet,this.id.client,this.id.clock,this.length),B4(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw ws();this.content.gc(e),n?xM(e,this,new bs(this.id,this.length)):this.content=new wh(this.length)}write(e,n){const s=n>0?nn(this.id.client,this.id.clock+n-1):this.origin,a=this.rightOrigin,l=this.parentSub,u=this.content.getRef()&xg|(s===null?0:es)|(a===null?0:co)|(l===null?0:lh);if(e.writeInfo(u),s!==null&&e.writeLeftID(s),a!==null&&e.writeRightID(a),s===null&&a===null){const d=this.parent;if(d._item!==void 0){const p=d._item;if(p===null){const h=_M(d);e.writeParentInfo(!0),e.writeString(h)}else e.writeParentInfo(!1),e.writeLeftID(p.id)}else d.constructor===String?(e.writeParentInfo(!0),e.writeString(d)):d.constructor===xu?(e.writeParentInfo(!1),e.writeLeftID(d)):ws();l!==null&&e.writeString(l)}this.content.write(e,n)}}const l3=(t,e)=>mD[e&xg](t),mD=[()=>{ws()},eD,iD,$M,oD,nD,rD,yD,aD,tD,()=>{ws()}],vD=10;class Es extends qv{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){ws()}write(e,n){e.writeInfo(vD),_t(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const c3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},u3="__ $YJS$ __";c3[u3]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),c3[u3]=!0;const d3=new Map;class SD{constructor(e){this.room=e,this.onmessage=null,this._onChange=n=>n.key===e&&this.onmessage!==null&&this.onmessage({data:ck(n.newValue||"")}),HT(this._onChange)}postMessage(e){Vx.setItem(this.room,lk(rk(e)))}close(){GT(this._onChange)}}const _D=typeof BroadcastChannel>"u"?SD:BroadcastChannel,Kv=t=>Sa(d3,t,()=>{const e=al(),n=new _D(t);return n.onmessage=s=>e.forEach(a=>a(s.data,"broadcastchannel")),{bc:n,subs:e}}),xD=(t,e)=>(Kv(t).subs.add(e),e),wD=(t,e)=>{const n=Kv(t),s=n.subs.delete(e);return s&&n.subs.size===0&&(n.bc.close(),d3.delete(t)),s},ku=(t,e,n=null)=>{const s=Kv(t);s.bc.postMessage(e),s.subs.forEach(a=>a(e,n))},f3=0,Qv=1,h3=2,Jv=(t,e)=>{_t(t,f3);const n=vM(e);Jn(t,n)},p3=(t,e,n)=>{_t(t,Qv),Jn(t,pM(e,n))},bD=(t,e,n)=>p3(e,n,$r(t)),g3=(t,e,n,s)=>{try{dM(e,$r(t),n)}catch(a){s!=null&&s(a),console.error("Caught error while handling a Yjs update",a)}},ED=(t,e)=>{_t(t,h3),Jn(t,e)},CD=g3,TD=(t,e,n,s,a)=>{const l=It(t);switch(l){case f3:bD(t,e,n);break;case Qv:g3(t,n,s,a);break;case h3:CD(t,n,s,a);break;default:throw new Error("Unknown message type")}return l},kD=0,MD=(t,e,n)=>{switch(It(t)){case kD:n(e,ll(t))}},Zv=3e4;class DD extends hT{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=sc();this.getLocalState()!==null&&Zv/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const s=[];this.meta.forEach((a,l)=>{l!==this.clientID&&Zv<=n-a.lastUpdated&&this.states.has(l)&&s.push(l)}),s.length>0&&$v(this,s,"timeout")},js(Zv/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,s=this.meta.get(n),a=s===void 0?0:s.clock+1,l=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:a,lastUpdated:sc()});const u=[],d=[],p=[],h=[];e===null?h.push(n):l==null?e!=null&&u.push(n):(d.push(n),pu(l,e)||p.push(n)),(u.length>0||p.length>0||h.length>0)&&this.emit("change",[{added:u,updated:p,removed:h},"local"]),this.emit("update",[{added:u,updated:d,removed:h},"local"])}setLocalStateField(e,n){const s=this.getLocalState();s!==null&&this.setLocalState({...s,[e]:n})}getStates(){return this.states}}const $v=(t,e,n)=>{const s=[];for(let a=0;a<e.length;a++){const l=e[a];if(t.states.has(l)){if(t.states.delete(l),l===t.clientID){const u=t.meta.get(l);t.meta.set(l,{clock:u.clock+1,lastUpdated:sc()})}s.push(l)}}s.length>0&&(t.emit("change",[{added:[],updated:[],removed:s},n]),t.emit("update",[{added:[],updated:[],removed:s},n]))},Eh=(t,e,n=t.states)=>{const s=e.length,a=Zr();_t(a,s);for(let l=0;l<s;l++){const u=e[l],d=n.get(u)||null,p=t.meta.get(u).clock;_t(a,u),_t(a,p),ic(a,JSON.stringify(d))}return Pn(a)},AD=(t,e,n)=>{const s=ol(e),a=sc(),l=[],u=[],d=[],p=[],h=It(s);for(let y=0;y<h;y++){const _=It(s);let S=It(s);const x=JSON.parse(ll(s)),w=t.meta.get(_),C=t.states.get(_),D=w===void 0?0:w.clock;(D<S||D===S&&x===null&&t.states.has(_))&&(x===null?_===t.clientID&&t.getLocalState()!=null?S++:t.states.delete(_):t.states.set(_,x),t.meta.set(_,{clock:S,lastUpdated:a}),w===void 0&&x!==null?l.push(_):w!==void 0&&x===null?p.push(_):x!==null&&(pu(x,C)||d.push(_),u.push(_)))}(l.length>0||d.length>0||p.length>0)&&t.emit("change",[{added:l,updated:d,removed:p},n]),(l.length>0||u.length>0||p.length>0)&&t.emit("update",[{added:l,updated:u,removed:p},n])},RD=t=>XT(t,(e,n)=>`${encodeURIComponent(n)}=${encodeURIComponent(e)}`).join("&"),dc=0,y3=3,Mu=1,LD=2,Ch=[];Ch[dc]=(t,e,n,s,a)=>{_t(t,dc);const l=TD(e,t,n.doc,n);s&&l===Qv&&!n.synced&&(n.synced=!0)},Ch[y3]=(t,e,n,s,a)=>{_t(t,Mu),Jn(t,Eh(n.awareness,Array.from(n.awareness.getStates().keys())))},Ch[Mu]=(t,e,n,s,a)=>{AD(n.awareness,$r(e),n)},Ch[LD]=(t,e,n,s,a)=>{MD(e,n.doc,(l,u)=>ND(n,u))};const m3=3e4,ND=(t,e)=>console.warn(`Permission denied to access ${t.url}.
|
|
313
|
+
${e}`),v3=(t,e,n)=>{const s=ol(e),a=Zr(),l=It(s),u=t.messageHandlers[l];return u?u(a,s,t,n,l):console.error("Unable to compute message"),a},e1=(t,e,n)=>{e===t.ws&&(t.emit("connection-close",[n,t]),t.ws=null,e.close(),t.wsconnecting=!1,t.wsconnected?(t.wsconnected=!1,t.synced=!1,$v(t.awareness,Array.from(t.awareness.getStates().keys()).filter(s=>s!==t.doc.clientID),t),t.emit("status",[{status:"disconnected"}])):t.wsUnsuccessfulReconnects++,setTimeout(S3,av(pT(2,t.wsUnsuccessfulReconnects)*100,t.maxBackoffTime),t))},S3=t=>{if(t.shouldConnect&&t.ws===null){const e=new t._WS(t.url,t.protocols);e.binaryType="arraybuffer",t.ws=e,t.wsconnecting=!0,t.wsconnected=!1,t.synced=!1,e.onmessage=n=>{t.wsLastMessageReceived=sc();const s=v3(t,new Uint8Array(n.data),!0);uv(s)>1&&e.send(Pn(s))},e.onerror=n=>{t.emit("connection-error",[n,t])},e.onclose=n=>{e1(t,e,n)},e.onopen=()=>{t.wsLastMessageReceived=sc(),t.wsconnecting=!1,t.wsconnected=!0,t.wsUnsuccessfulReconnects=0,t.emit("status",[{status:"connected"}]);const n=Zr();if(_t(n,dc),Jv(n,t.doc),e.send(Pn(n)),t.awareness.getLocalState()!==null){const s=Zr();_t(s,Mu),Jn(s,Eh(t.awareness,[t.doc.clientID])),e.send(Pn(s))}},t.emit("status",[{status:"connecting"}])}},t1=(t,e)=>{const n=t.ws;t.wsconnected&&n&&n.readyState===n.OPEN&&n.send(e),t.bcconnected&&ku(t.bcChannel,e,t)};class _3 extends Cx{constructor(e,n,s,{connect:a=!0,awareness:l=new DD(s),params:u={},protocols:d=[],WebSocketPolyfill:p=WebSocket,resyncInterval:h=-1,maxBackoffTime:y=2500,disableBc:_=!1}={}){for(super();e[e.length-1]==="/";)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+n,this.maxBackoffTime=y,this.params=u,this.protocols=d,this.roomname=n,this.doc=s,this._WS=p,this.awareness=l,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=_,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Ch.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=a,this._resyncInterval=0,h>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const S=Zr();_t(S,dc),Jv(S,s),this.ws.send(Pn(S))}},h)),this._bcSubscriber=(S,x)=>{if(x!==this){const w=v3(this,new Uint8Array(S),!1);uv(w)>1&&ku(this.bcChannel,Pn(w),this)}},this._updateHandler=(S,x)=>{if(x!==this){const w=Zr();_t(w,dc),ED(w,S),t1(this,Pn(w))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:S,updated:x,removed:w},C)=>{const D=S.concat(x).concat(w),U=Zr();_t(U,Mu),Jn(U,Eh(l,D)),t1(this,Pn(U))},this._exitHandler=()=>{$v(this.awareness,[s.clientID],"app closed")},cl&&typeof process<"u"&&process.on("exit",this._exitHandler),l.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&m3<sc()-this.wsLastMessageReceived&&e1(this,this.ws,null)},m3/10),a&&this.connect()}get url(){const e=RD(this.params);return this.serverUrl+"/"+this.roomname+(e.length===0?"":"?"+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),cl&&typeof process<"u"&&process.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(xD(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=Zr();_t(e,dc),Jv(e,this.doc),ku(this.bcChannel,Pn(e),this);const n=Zr();_t(n,dc),p3(n,this.doc),ku(this.bcChannel,Pn(n),this);const s=Zr();_t(s,y3),ku(this.bcChannel,Pn(s),this);const a=Zr();_t(a,Mu),Jn(a,Eh(this.awareness,[this.doc.clientID])),ku(this.bcChannel,Pn(a),this)}disconnectBc(){const e=Zr();_t(e,Mu),Jn(e,Eh(this.awareness,[this.doc.clientID],new Map)),t1(this,Pn(e)),this.bcconnected&&(wD(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&e1(this,this.ws,null)}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(S3(this),this.connectBc())}}let Ea=null,yr=null,n1=new Set;function x3(t){return yr&&e0(),Ea=new ac,yr=new _3(t.serverUrl,t.roomName,Ea,{connect:!0,params:t.authToken?{token:t.authToken}:void 0}),yr.awareness.setLocalState({user:t.user,cursor:null,selectedIds:[]}),yr.on("status",e=>{const n=e.status;for(const s of n1)s(n)}),{doc:Ea,provider:yr}}function e0(){yr&&(yr.awareness.setLocalState(null),yr.disconnect(),yr.destroy(),yr=null),Ea&&(Ea.destroy(),Ea=null)}function w3(){return Ea}function r1(){return yr}function b3(){return Ea==null?void 0:Ea.getMap("elements")}function PD(){return yr!==null&&yr.wsconnected}function E3(t){return n1.add(t),()=>{n1.delete(t)}}function t0(t){if(!yr)return;const e=yr.awareness.getLocalState();yr.awareness.setLocalState({...e,...t})}function C3(){if(!yr)return new Map;const t=yr.awareness.getStates(),e=yr.awareness.clientID,n=new Map;for(const[s,a]of t)s!==e&&a&&a.user&&n.set(s,a);return n}const i1=["id","type","x","y","width","height","rotation","isLocked","isVisible","sortOrder"],n0=["strokeColor","fillColor","strokeWidth","opacity","strokeStyle","roughness","fontSize","fontFamily"];function Th(t,e){const n=t;for(const s of i1){const a=n[s];a!==void 0&&e.set(s,a)}if(t.style)for(const s of n0)e.set(`style.${s}`,t.style[s]);switch(t.boundElements?e.set("boundElements",JSON.stringify(t.boundElements)):e.set("boundElements",null),t.groupIds&&e.set("groupIds",JSON.stringify(t.groupIds)),t.type){case"rectangle":e.set("cornerRadius",t.cornerRadius);break;case"line":case"arrow":e.set("points",JSON.stringify(t.points)),e.set("lineType",t.lineType),t.curvature!==void 0&&e.set("curvature",t.curvature),e.set("startBinding",t.startBinding?JSON.stringify(t.startBinding):null),e.set("endBinding",t.endBinding?JSON.stringify(t.endBinding):null),t.type==="arrow"&&(e.set("startArrowhead",t.startArrowhead),e.set("endArrowhead",t.endArrowhead));break;case"freedraw":e.set("points",JSON.stringify(t.points));break;case"text":e.set("text",t.text),e.set("containerId",t.containerId),e.set("textAlign",t.textAlign),e.set("verticalAlign",t.verticalAlign);break;case"image":e.set("src",t.src),e.set("naturalWidth",t.naturalWidth),e.set("naturalHeight",t.naturalHeight),e.set("scaleMode",t.scaleMode),e.set("crop",t.crop?JSON.stringify(t.crop):null),e.set("cornerRadius",t.cornerRadius),e.set("alt",t.alt);break}}function fc(t){const e=t.get("type"),n=t.get("id");if(!e||!n)return null;const s={};for(const l of n0){const u=t.get(`style.${l}`);u!==void 0&&(s[l]=u)}const a={id:n,type:e,x:t.get("x")??0,y:t.get("y")??0,width:t.get("width")??100,height:t.get("height")??100,rotation:t.get("rotation")??0,isLocked:t.get("isLocked")??!1,isVisible:t.get("isVisible")??!0,style:s,boundElements:hc(t.get("boundElements"))??null,groupIds:hc(t.get("groupIds"))??void 0,sortOrder:t.get("sortOrder")??void 0};switch(e){case"rectangle":a.cornerRadius=t.get("cornerRadius")??0;break;case"line":case"arrow":a.points=hc(t.get("points"))??[0,0,100,0],a.lineType=t.get("lineType")??"sharp",a.curvature=t.get("curvature")??void 0,a.startBinding=hc(t.get("startBinding")),a.endBinding=hc(t.get("endBinding")),e==="arrow"&&(a.startArrowhead=t.get("startArrowhead")??null,a.endArrowhead=t.get("endArrowhead")??"arrow");break;case"freedraw":a.points=hc(t.get("points"))??[];break;case"text":a.text=t.get("text")??"",a.containerId=t.get("containerId")??null,a.textAlign=t.get("textAlign")??"center",a.verticalAlign=t.get("verticalAlign")??"middle";break;case"image":a.src=t.get("src")??"",a.naturalWidth=t.get("naturalWidth")??0,a.naturalHeight=t.get("naturalHeight")??0,a.scaleMode=t.get("scaleMode")??"fit",a.crop=hc(t.get("crop"))??null,a.cornerRadius=t.get("cornerRadius")??0,a.alt=t.get("alt")??"";break}return a}function hc(t){if(t==null)return null;try{return JSON.parse(t)}catch{return null}}let pc=!1,gc=!1,r0=null,i0=null,Du=null,po=[];function T3(t=50){const e=w3(),n=b3();if(!e||!n){console.warn("[SyncBridge] Cannot start sync — no Yjs doc");return}if(s0(),n.size>0){pc=!0;const d=FD(n);De.getState().setElements(d),po=d,pc=!1}else{const d=De.getState().elements;d.length>0&&(gc=!0,e.transact(()=>{for(const p of d){const h=new zi;Th(p,h),n.set(p.id,h)}},"local-init"),gc=!1),po=d}const s=(d,p)=>{if(p.origin==="local-sync"||p.origin==="local-init"||gc)return;pc=!0;const h=De.getState();let y=[...po],_=!1;for(const[S,x]of d.keys)if(x.action==="add"||x.action==="update"){const w=n.get(S);if(w){const C=fc(w);if(C){const D=y.findIndex(U=>U.id===S);D>=0?y[D]=C:y.push(C),_=!0}}}else x.action==="delete"&&(y=y.filter(w=>w.id!==S),_=!0);_&&(y.sort((S,x)=>S.sortOrder&&x.sortOrder?S.sortOrder<x.sortOrder?-1:S.sortOrder>x.sortOrder?1:0:0),h.setElements(y),po=y),pc=!1};let a=null;const l=new Set,u=d=>{if(!gc){for(const p of d){let h=p.target;for(;h&&!(h instanceof zi&&h.parent===n);)h=h.parent;if(h instanceof zi){const y=h.get("id");y&&l.add(y)}}a&&clearTimeout(a),a=setTimeout(()=>{if(l.size===0||gc)return;pc=!0;let p=[...po],h=!1;for(const y of l){const _=n.get(y);if(!_)continue;const S=fc(_);if(!S)continue;const x=p.findIndex(w=>w.id===y);x>=0&&(p[x]=S,h=!0)}l.clear(),h&&(De.getState().setElements(p),po=p),pc=!1},16)}};n.observe(s),n.observeDeep(u),i0=()=>{n.unobserve(s),n.unobserveDeep(u),a&&clearTimeout(a),l.clear()},r0=De.subscribe(d=>{pc||d.elements!==po&&(Du&&clearTimeout(Du),Du=setTimeout(()=>{OD(d.elements,n,e)},t))})}function s0(){r0&&(r0(),r0=null),i0&&(i0(),i0=null),Du&&(clearTimeout(Du),Du=null),po=[]}function OD(t,e,n){gc=!0,po=t;const s=new Map;for(const a of t)s.set(a.id,a);n.transact(()=>{for(const[a]of e.entries())s.has(a)||e.delete(a);for(const a of t){let l=e.get(a.id);l?ID(a,l):(l=new zi,Th(a,l),e.set(a.id,l))}},"local-sync"),gc=!1}function ID(t,e){const n=t;for(const a of i1){const l=n[a];l!==e.get(a)&&e.set(a,l)}if(t.style)for(const a of n0){const l=t.style[a];l!==e.get(`style.${a}`)&&e.set(`style.${a}`,l)}const s=t.boundElements?JSON.stringify(t.boundElements):null;switch(s!==e.get("boundElements")&&e.set("boundElements",s),t.type){case"rectangle":t.cornerRadius!==e.get("cornerRadius")&&e.set("cornerRadius",t.cornerRadius);break;case"line":case"arrow":{const l=JSON.stringify(t.points);l!==e.get("points")&&e.set("points",l),t.lineType!==e.get("lineType")&&e.set("lineType",t.lineType),t.curvature!==e.get("curvature")&&e.set("curvature",t.curvature);const u=t.startBinding?JSON.stringify(t.startBinding):null;u!==e.get("startBinding")&&e.set("startBinding",u);const d=t.endBinding?JSON.stringify(t.endBinding):null;d!==e.get("endBinding")&&e.set("endBinding",d),t.type==="arrow"&&(t.startArrowhead!==e.get("startArrowhead")&&e.set("startArrowhead",t.startArrowhead),t.endArrowhead!==e.get("endArrowhead")&&e.set("endArrowhead",t.endArrowhead));break}case"freedraw":{const l=JSON.stringify(t.points);l!==e.get("points")&&e.set("points",l);break}case"text":t.text!==e.get("text")&&e.set("text",t.text),t.containerId!==e.get("containerId")&&e.set("containerId",t.containerId),t.textAlign!==e.get("textAlign")&&e.set("textAlign",t.textAlign),t.verticalAlign!==e.get("verticalAlign")&&e.set("verticalAlign",t.verticalAlign);break;case"image":t.src!==e.get("src")&&e.set("src",t.src),t.naturalWidth!==e.get("naturalWidth")&&e.set("naturalWidth",t.naturalWidth),t.naturalHeight!==e.get("naturalHeight")&&e.set("naturalHeight",t.naturalHeight),t.scaleMode!==e.get("scaleMode")&&e.set("scaleMode",t.scaleMode);const a=t.crop?JSON.stringify(t.crop):null;a!==e.get("crop")&&e.set("crop",a),t.cornerRadius!==e.get("cornerRadius")&&e.set("cornerRadius",t.cornerRadius),t.alt!==e.get("alt")&&e.set("alt",t.alt);break}}function FD(t){const e=[];for(const[,n]of t.entries()){const s=fc(n);s&&e.push(s)}return e.sort((n,s)=>n.sortOrder&&s.sortOrder?n.sortOrder<s.sortOrder?-1:n.sortOrder>s.sortOrder?1:0:0),e}function k3(t){const[e,n]=te.useState("disconnected"),[s,a]=te.useState([]),l=te.useRef(t);l.current=t;const u=te.useRef((t==null?void 0:t.awarenessThrottleMs)??100),d=te.useRef(0);te.useEffect(()=>{if(!t){e0(),s0(),n("disconnected"),a([]);return}const{provider:_}=x3(t);T3(t.syncDebounceMs??50);const S=E3(n),x=()=>{const C=C3();a(Array.from(C.values()))};_.awareness.on("change",x);const w=De.subscribe((C,D)=>{C.selectedIds!==D.selectedIds&&t0({selectedIds:C.selectedIds}),C.activeTool!==D.activeTool&&t0({activeTool:C.activeTool})});return()=>{S(),w(),_.awareness.off("change",x),s0(),e0(),n("disconnected"),a([])}},[t==null?void 0:t.serverUrl,t==null?void 0:t.roomName,t==null?void 0:t.user.id,t==null?void 0:t.syncDebounceMs]);const p=te.useCallback(_=>{const S=Date.now();S-d.current<u.current||(d.current=S,t0({cursor:_}))},[]),h=te.useCallback(()=>{const _=r1();_&&_.disconnect()},[]),y=te.useCallback(()=>{const _=r1();_&&_.connect()},[]);return{isConnected:e==="connected",connectionStatus:e,peers:s,disconnect:h,reconnect:y,updateCursor:p}}const UD=[0,0,0,18,4.5,14.5,9,20,12,18,7.5,12.5,14,12.5,0,0],s1=12,M3="system-ui, -apple-system, sans-serif",D3=6,A3=4,R3=14,L3=18,go={ctx:null,cache:new Map};function BD(t){const e=go.cache.get(t);if(e!==void 0)return e;if(!go.ctx)try{const s=document.createElement("canvas");go.ctx=s.getContext("2d")}catch{}let n;return go.ctx?(go.ctx.font=`${s1}px ${M3}`,n=go.ctx.measureText(t).width):n=t.length*7,go.cache.size>200&&go.cache.clear(),go.cache.set(t,n),n}function N3(t,e,n,s,a,l){const u=(t-n.x)*n.scale,d=(e-n.y)*n.scale;return u>=-l&&u<=s+l&&d>=-l&&d<=a+l}function zD(t,e,n,s,a){const l=t.x+t.width/2,u=t.y+t.height/2,d=Math.sqrt(t.width*t.width+t.height*t.height)/2;return N3(l,u,e,n,s,a+d*e.scale)}const HD=({peers:t,viewport:e,stageWidth:n,stageHeight:s,elements:a})=>{const l=te.useMemo(()=>{const p=new Map;for(const h of a)p.set(h.id,h);return p},[a]),u=1/e.scale,d=150;return Z.jsx(Z.Fragment,{children:t.map(p=>{if(!p.cursor&&p.selectedIds.length===0)return null;const{user:h}=p;return Z.jsxs(io,{children:[p.selectedIds.map(y=>{const _=l.get(y);if(!_||!zD(_,e,n,s,d))return null;const S=3*u;return Z.jsx(ya,{x:_.x+_.width/2,y:_.y+_.height/2,offsetX:_.width/2+S,offsetY:_.height/2+S,width:_.width+S*2,height:_.height+S*2,rotation:_.rotation??0,stroke:h.color,strokeWidth:2*u,dash:[6*u,4*u],cornerRadius:3*u,listening:!1,perfectDrawEnabled:!1},y)}),p.cursor&&N3(p.cursor.x,p.cursor.y,e,n,s,d)&&Z.jsxs(io,{x:p.cursor.x,y:p.cursor.y,scaleX:u,scaleY:u,listening:!1,children:[Z.jsx(Ui,{points:UD,fill:h.color,stroke:"#ffffff",strokeWidth:1,closed:!0,perfectDrawEnabled:!1}),Z.jsx(ya,{x:R3,y:L3,width:BD(h.name)+D3*2,height:s1+A3*2,fill:h.color,cornerRadius:4,listening:!1,perfectDrawEnabled:!1}),Z.jsx(d5,{x:R3+D3,y:L3+A3,text:h.name,fontSize:s1,fontFamily:M3,fill:"#ffffff",listening:!1,perfectDrawEnabled:!1})]})]},h.id)})})},P3=te.memo(HD);function O3(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}const I3=10,GD=({elements:t,listening:e,onSelect:n,onChange:s,onDragMove:a,onDoubleClick:l,autoEditTextId:u,onTextEditStart:d,onTextEditEnd:p,allElements:h,gridSnap:y,onDragSnap:_,viewportScale:S,onGroupDragEnd:x})=>{const w=te.useRef(null);te.useEffect(()=>{const M=w.current;if(!M||t.length===0)return;const E=window.devicePixelRatio||1,L=Math.max(.5,Math.min(S*E,E)),R=requestAnimationFrame(()=>{if(!w.current)return;const z=M.getClientRect({skipTransform:!0}),ee=z.width*L,O=z.height*L,I=8192;if(ee>I||O>I||z.width===0||z.height===0){M.clearCache();return}M.cache({pixelRatio:L}),M.batchDraw()});return()=>{cancelAnimationFrame(R),M.clearCache()}},[t,S,u]);const{ungrouped:C,groups:D}=te.useMemo(()=>{var L;const M=[],E=new Map;for(const R of t)if((L=R.groupIds)!=null&&L.length){const z=R.groupIds[R.groupIds.length-1];E.has(z)||E.set(z,[]),E.get(z).push(R)}else M.push(R);return{ungrouped:M,groups:E}},[t]),U=te.useCallback(M=>{var E;(E=w.current)==null||E.clearCache()},[]);return Z.jsxs(Zp,{ref:w,listening:e,children:[C.map(M=>Z.jsx(Xm,{element:M,isSelected:!1,onSelect:n,onChange:s,onDragMove:a,onDoubleClick:l,autoEditText:u===M.id,onTextEditStart:d,onTextEditEnd:p,allElements:h,gridSnap:y,onDragSnap:_,viewportScale:S},M.id)),Array.from(D.entries()).map(([M,E])=>{const L=E.some(R=>R.isLocked);return Z.jsx(io,{draggable:!L,onDragStart:U,onDragEnd:R=>{const z=R.target.x(),ee=R.target.y();R.target.x(0),R.target.y(0),x==null||x(M,z,ee)},children:E.map(R=>Z.jsx(Xm,{element:R,isSelected:!1,isGrouped:!0,onSelect:n,onChange:s,onDragMove:a,onDoubleClick:l,autoEditText:u===R.id,onTextEditStart:d,onTextEditEnd:p,allElements:h,gridSnap:y,onDragSnap:_,viewportScale:S},R.id))},M)})]})},VD=te.memo(GD,(t,e)=>!(t.elements!==e.elements||t.listening!==e.listening||t.autoEditTextId!==e.autoEditTextId||t.gridSnap!==e.gridSnap||t.viewportScale!==e.viewportScale)),YD=({element:t,scale:e})=>{const n=20/e,s=n/24;return Z.jsxs(io,{x:t.x-n/2,y:t.y-n/2,listening:!1,children:[Z.jsx(ya,{width:n,height:n,fill:"#ff9500",cornerRadius:n/4,opacity:.9}),Z.jsx(GE,{x:n*.12,y:n*.08,data:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z",fill:"white",scaleX:s*.78,scaleY:s*.78,listening:!1})]})},F3=te.forwardRef((t,e)=>{const{initialElements:n,elements:s,onChange:a,onSelectionChange:l,onElementCreate:u,onElementDelete:d,onElementDoubleClick:p,width:h="100%",height:y="100%",tools:_,defaultStyle:S,showToolbar:x=!0,showStylePanel:w=!0,showStatusBar:C=!0,showGrid:D=!1,enableShortcuts:U=!0,theme:M,readOnly:E=!1,className:L,contextMenuItems:R,renderContextMenu:z,collaboration:ee}=t,O={...bx,...M},I=De(),{elements:F,selectedIds:V,activeTool:W,currentStyle:j,viewport:Y,showGrid:X,isDrawing:ne,setIsDrawing:A,setDrawStart:B,drawStart:Q,addElement:H,updateElement:K,setSelectedIds:ae,clearSelection:ie,setActiveTool:de,setViewport:fe,deleteElements:se,pushHistory:q,setElements:oe,setCurrentStyle:ye,undo:ke,redo:Ae,toggleGrid:Me}=I,be=te.useMemo(()=>V5(V),[V]),{peers:He,updateCursor:$e}=k3(ee??null),Ct=te.useRef(null),le=te.useRef(null),Ee=te.useRef(null),yt=Jf(),xt=yt.isEditing,[Et,Pt]=te.useState({width:800,height:600}),[On,kn]=te.useState(null),[sr,Ft]=te.useState(null),Sn=te.useRef(null),[dn,mr]=te.useState(null),[Ve,tt]=te.useState(null),[St,dt]=te.useState(null),[gn,Gn]=te.useState([]),ct=te.useRef(!1),at=te.useRef(!1),[cn,un]=te.useState(!1),Ot=te.useRef(!1),{isDraggingPoint:Hi,elementId:Ca}=yt,yc=te.useRef([]),Lt=te.useMemo(()=>{let ue=null;for(let Ue=0;Ue<F.length;Ue++){const Ge=F[Ue];if(Ge.type!=="line"&&Ge.type!=="arrow"){ue&&(ue[Ue]=Ge);continue}const Xe=Ge;if(!Xe.startBinding&&!Xe.endBinding){ue&&(ue[Ue]=Ge);continue}if(Hi&&Ca===Ge.id){ue&&(ue[Ue]=Ge);continue}const Pe=Ql(Xe,F);Pe?(ue||(ue=F.slice(0,Ue)),ue[Ue]={...Xe,...Pe}):ue&&(ue[Ue]=Ge)}const Ce=ue??F,Oe=yc.current;if(Ce.length===Oe.length){let Ue=!0;for(let Ge=0;Ge<Ce.length;Ge++)if(Ce[Ge]!==Oe[Ge]){Ue=!1;break}if(Ue)return Oe}return yc.current=Ce,Ce},[F,Hi,Ca]),mi=te.useMemo(()=>{const ue=new Map;for(const Ce of Lt)ue.set(Ce.id,Ce);return ue},[Lt]),Gi=tT(Lt,Y,Et.width,Et.height,V),ns=vx(Y.scale),vi=te.useRef([]),ni=te.useRef([]),{staticElements:Xs,interactiveElements:mc}=te.useMemo(()=>{var Xe,Pe;let ue=be;if(be.size>0){const ze=new Set(be);for(const je of Gi)if(ze.has(je.id)&&((Xe=je.groupIds)!=null&&Xe.length)){const rt=je.groupIds[je.groupIds.length-1];for(const ot of Gi)(Pe=ot.groupIds)!=null&&Pe.includes(rt)&&ze.add(ot.id)}ze.size!==be.size&&(ue=ze)}const Ce=[],Oe=[];for(const ze of Gi)ue.has(ze.id)?Oe.push(ze):Ce.push(ze);const Ue=O3(Ce,vi.current)?vi.current:Ce,Ge=O3(Oe,ni.current)?ni.current:Oe;return vi.current=Ue,ni.current=Ge,{staticElements:Ue,interactiveElements:Ge}},[Gi,be]),{visibleElements:Mh}=Sx(Xs,{batchSize:500,threshold:500,enabled:!0});W7(U&&!E,le),te.useEffect(()=>{S&&ye({...$p,...S})},[]),te.useEffect(()=>{n&&n.length>0&&(oe(n),q())},[]),te.useEffect(()=>{D!==X&&Me()},[]),te.useEffect(()=>{s&&oe(s)},[s,oe]);const Ta=te.useRef(F);te.useEffect(()=>{a&&F!==Ta.current&&a(F),Ta.current=F},[F,a]),te.useEffect(()=>{l&&l(V)},[V,l]),te.useEffect(()=>{const ue=Jf.getState();if(!ue.isEditing)return;if(W!=="select"){ue.exitEditMode();return}if(V.length!==1||V[0]!==ue.elementId){ue.exitEditMode();return}const Ce=F.find(Oe=>Oe.id===V[0]);Ce&&(Ce.type==="line"||Ce.type==="arrow")&&(!ue.isEditing||ue.elementId!==Ce.id)&&ue.enterEditMode(Ce.id)},[V,W,F]),te.useEffect(()=>{const ue=Oe=>{Oe.key==="Shift"&&(ct.current=!0)},Ce=Oe=>{Oe.key==="Shift"&&(ct.current=!1)};return window.addEventListener("keydown",ue),window.addEventListener("keyup",Ce),()=>{window.removeEventListener("keydown",ue),window.removeEventListener("keyup",Ce)}},[]),te.useEffect(()=>{const ue=Ue=>{const Ge=Ue.target.tagName;Ge==="INPUT"||Ge==="TEXTAREA"||Ge==="SELECT"||Ue.code==="Space"&&!Ot.current&&(Ue.preventDefault(),Ot.current=!0,un(!0))},Ce=Ue=>{Ue.code==="Space"&&(Ot.current=!1,un(!1))},Oe=()=>{Ot.current&&(Ot.current=!1,un(!1))};return window.addEventListener("keydown",ue),window.addEventListener("keyup",Ce),window.addEventListener("blur",Oe),()=>{window.removeEventListener("keydown",ue),window.removeEventListener("keyup",Ce),window.removeEventListener("blur",Oe)}},[]),te.useEffect(()=>{const ue=le.current;if(!ue||E)return;const Ce=Ue=>{Ue.preventDefault(),Ue.stopPropagation(),Ue.dataTransfer&&(Ue.dataTransfer.dropEffect="copy")},Oe=async Ue=>{if(Ue.preventDefault(),Ue.stopPropagation(),!Ue.dataTransfer)return;const Ge=Vm(Ue.dataTransfer);if(Ge.length===0)return;const Xe=ue.getBoundingClientRect();Ct.current;const Pe=De.getState().viewport,ze=(Ue.clientX-Xe.left-Pe.x)/Pe.scale,je=(Ue.clientY-Xe.top-Pe.y)/Pe.scale,rt=De.getState().currentStyle;for(const ot of Ge)try{const ft=await og(ot),pt=await $f(ft),Ht=lg(ft,pt.naturalWidth,pt.naturalHeight,ze,je,{...rt});H(Ht),u==null||u(Ht),ae([Ht.id]),q()}catch{}de("select")};return ue.addEventListener("dragover",Ce),ue.addEventListener("drop",Oe),()=>{ue.removeEventListener("dragover",Ce),ue.removeEventListener("drop",Oe)}},[E,H,ae,q,de,u]),te.useEffect(()=>{if(E)return;const ue=Ce=>{const Oe=Ce.target.tagName;if(Oe==="INPUT"||Oe==="TEXTAREA"||Oe==="SELECT")return;const Ue=Ym(Ce);if(Ue.file||Ue.imgUrl)Ce.preventDefault(),Ce.stopPropagation(),(async()=>{try{const Ge=await J5(Ue);if(!Ge)return;const Xe=await $f(Ge),Pe=De.getState().viewport,ze=le.current,je=ze==null?void 0:ze.getBoundingClientRect(),rt=je?(je.width/2-Pe.x)/Pe.scale:400,ot=je?(je.height/2-Pe.y)/Pe.scale:300,ft=De.getState().currentStyle,pt=lg(Ge,Xe.naturalWidth,Xe.naturalHeight,rt,ot,{...ft});H(pt),u==null||u(pt),ae([pt.id]),q(),de("select")}catch{}})();else{Ce.preventDefault(),Ce.stopPropagation();const Ge=Qm();if(Ge.length===0)return;const Xe=20,{clones:Pe,selectedCloneIds:ze}=ig(Ge,Ge,Xe);Pe.forEach(je=>H(je)),ae(ze.length>0?ze:Pe.map(je=>je.id)),q(),rh(Ge.map(je=>({...je,x:je.x+Xe,y:je.y+Xe})))}};return window.addEventListener("paste",ue,!0),()=>window.removeEventListener("paste",ue,!0)},[E,H,ae,q,de,u]),te.useEffect(()=>{const ue=le.current;if(!ue)return;const Ce=new ResizeObserver(Oe=>{for(const Ue of Oe){const{width:Ge,height:Xe}=Ue.contentRect;Pt({width:Math.floor(Ge),height:Math.floor(Xe)})}});return Ce.observe(ue),()=>Ce.disconnect()},[]);const Zn=te.useCallback(()=>{const ue=Ct.current;if(!ue)return null;const Ce=ue.getPointerPosition();return Ce?{x:(Ce.x-Y.x)/Y.scale,y:(Ce.y-Y.y)/Y.scale}:null},[Y]),vc=te.useCallback(ue=>X?{x:rn(ue.x,ru),y:rn(ue.y,ru)}:ue,[X]),yo=te.useRef(null);yo.current={elements:F,selectedIds:V,activeTool:W,currentStyle:j,isDrawing:ne,drawStart:Q,showGrid:X,addElement:H,updateElement:K,deleteElements:se,setSelectedIds:ae,clearSelection:ie,setActiveTool:de,setIsDrawing:A,setDrawStart:B,pushHistory:q,getPointerPos:Zn,snapPos:vc,currentElementIdRef:Ee,shiftKeyRef:ct,startBindingRef:Sn,setSnapTarget:Ft,selectionBox:On,setSelectionBox:kn,setAutoEditTextId:tt,linearEdit:{isEditing:yt.isEditing,elementId:yt.elementId,exitEditMode:yt.exitEditMode,enterEditMode:yt.enterEditMode},onElementCreate:u,onElementDelete:d};const qs=te.useCallback(ue=>{if(E||Ot.current)return;if(ue.evt.button===2){at.current=!0,St&&dt(null);return}at.current=!1;const Oe=yo.current,Ue=Oe.getPointerPos();if(!Ue||(St&&dt(null),Oe.activeTool==="hand"||cn))return;const Ge=eh(Oe.activeTool);Ge==null||Ge.onMouseDown(ue,Ue,Oe)},[E,St,cn]),Ts=te.useCallback(ue=>{if(Ot.current||E)return;const Ce=yo.current,Oe=Ce.getPointerPos();if(!Oe)return;$e(Oe);const Ue=eh(Ce.activeTool);Ue==null||Ue.onMouseMove(ue,Oe,Ce)},[E,$e]),mo=te.useRef(null),rs=te.useRef(Ts);rs.current=Ts;const hl=te.useMemo(()=>{var Ce,Oe;(Oe=(Ce=mo.current)==null?void 0:Ce.cancel)==null||Oe.call(Ce);const ue=G5(Ue=>{rs.current(Ue)});return mo.current=ue,ue},[]);te.useEffect(()=>()=>{var ue,Ce;(Ce=(ue=mo.current)==null?void 0:ue.cancel)==null||Ce.call(ue),ax(),wx()},[]);const pl=te.useCallback(()=>{const ue=yo.current,Ce=eh(ue.activeTool);Ce==null||Ce.onMouseUp(ue)},[]),vo=te.useCallback(ue=>{ue.evt.preventDefault();const Ce=Ct.current;if(!Ce)return;const Oe=Ce.getPointerPosition();if(!Oe)return;const Ue=1.05,Ge=ue.evt.deltaY>0?-1:1,Xe=Math.min(nu,Math.max(tu,Ge>0?Y.scale*Ue:Y.scale/Ue));fe(sg({viewport:Y,point:Oe,targetScale:Xe}))},[Y,fe]),So=te.useCallback(ue=>{W!=="hand"&&!Ot.current&&!cn||fe({x:ue.target.x(),y:ue.target.y()})},[W,fe,cn]),Ks=te.useCallback(ue=>{var je;const{activeTool:Ce,elements:Oe,selectedIds:Ue,setSelectedIds:Ge}=De.getState();if(Ce!=="select"||E)return;if(at.current){at.current=!1;return}const Xe=Oe.find(rt=>rt.id===ue),Pe=Xe&&(Xe.type==="line"||Xe.type==="arrow"),ze=Jf.getState();if(Pe?(!ze.isEditing||ze.elementId!==ue)&&ze.enterEditMode(ue):ze.isEditing&&ze.exitEditMode(),(je=Xe==null?void 0:Xe.groupIds)!=null&&je.length){const rt=Xe.groupIds[Xe.groupIds.length-1],ot=Oe.filter(ft=>{var pt;return(pt=ft.groupIds)==null?void 0:pt.includes(rt)}).map(ft=>ft.id);Ge(ot)}else Ge([ue])},[E]),ri=te.useRef(null),Sc=te.useRef(!1),ka=te.useRef(!1),ks=te.useRef(null),Nu=te.useCallback(()=>{Sc.current=!1;const ue=ri.current;if(!ue||ue.size===0)return;const Ce=Array.from(ue,([Oe,Ue])=>({id:Oe,updates:Ue}));ue.clear(),De.getState().batchUpdateElements(Ce)},[]),_o=te.useRef(new Set),xo=te.useCallback((ue,Ce)=>{if(E)return;ks.current===null&&(ks.current=Wp.pixelRatio,Wp.pixelRatio=1);const{elements:Oe,selectedIds:Ue}=De.getState();if(Ue.length>I3){ka.current=!0;return}ka.current=!1;const Ge=Oe.find(Xe=>Xe.id===ue);if(Ge&&(Ge.type==="line"||Ge.type==="arrow")&&!_o.current.has(ue)){const Xe=Ge;if(Xe.startBinding||Xe.endBinding){_o.current.add(ue);const Pe={},ze=Xe.type;if(Xe.startBinding){const je=De.getState().elements;Jl(ue,ze,Xe.startBinding,null,je,De.getState().updateElement),Pe.startBinding=null}if(Xe.endBinding){const je=De.getState().elements;Jl(ue,ze,Xe.endBinding,null,je,De.getState().updateElement),Pe.endBinding=null}De.getState().updateElement(ue,{...Ce,...Pe});return}}ri.current||(ri.current=new Map),ri.current.set(ue,Ce),Sc.current||(Sc.current=!0,queueMicrotask(Nu))},[E,Nu]),Ms=te.useCallback((ue,Ce)=>{const{elements:Oe,selectedIds:Ue}=De.getState();if(Ue.length>1)return null;const Ge=new Set(Ue),Xe=j7(Ce,Oe,Ge);return Gn(Xe.guides),Xe.x!==void 0||Xe.y!==void 0?{x:Xe.x??Ce.x,y:Xe.y??Ce.y}:null},[]),Qs=te.useRef(null),wo=te.useRef(!1),_c=te.useCallback(()=>{wo.current=!1;const ue=Qs.current;if(!ue||ue.size===0)return;const Ce=Array.from(ue);ue.clear(),ka.current=!1,De.getState().batchUpdateElements(Ce.map(([ze,je])=>({id:ze,updates:je}))),Gn([]);const Ue=De.getState().elements,Ge=new Map;for(const ze of Ue)Ge.set(ze.id,ze);const Xe=[],Pe=new Set;for(const[ze]of Ce){_o.current.delete(ze);const je=qf(ze,Ue);for(const ot of je){if(Pe.has(ot.id))continue;Pe.add(ot.id);const ft=Ge.get(ot.id);if(!ft)continue;const pt=Ql(ft,Ue);pt&&Xe.push({id:ft.id,updates:pt})}const rt=Ge.get(ze);if(rt!=null&&rt.boundElements&&["rectangle","ellipse","diamond","image"].includes(rt.type))for(const ft of rt.boundElements){if(ft.type!=="text")continue;const pt=Ge.get(ft.id);if(!pt)continue;const Ht=Math.max(20,rt.width-8);let Wt;pt.verticalAlign==="top"?Wt=rt.y+4:pt.verticalAlign==="bottom"?Wt=rt.y+rt.height-pt.height-4:Wt=rt.y+(rt.height-pt.height)/2,Xe.push({id:ft.id,updates:{x:rt.x+4,y:Wt,width:Ht}})}}Xe.length>0&&De.getState().batchUpdateElements(Xe),De.getState().pushHistory(),ks.current!==null&&(Wp.pixelRatio=ks.current,ks.current=null)},[]),gl=te.useCallback((ue,Ce)=>{if(E)return;const{selectedIds:Oe}=De.getState();if(Oe.length>I3){Qs.current||(Qs.current=new Map),Qs.current.set(ue,Ce),wo.current||(wo.current=!0,queueMicrotask(_c));return}K(ue,Ce),Gn([]),_o.current.delete(ue);const Ue=De.getState().elements,Ge=new Map;for(const ze of Ue)Ge.set(ze.id,ze);const Xe=qf(ue,Ue);for(const ze of Xe){const je=Ge.get(ze.id);if(!je)continue;const rt=Ql(je,Ue);rt&&K(je.id,rt)}const Pe=Ge.get(ue);if(Pe!=null&&Pe.boundElements&&["rectangle","ellipse","diamond","image"].includes(Pe.type))for(const je of Pe.boundElements){if(je.type!=="text")continue;const rt=Ge.get(je.id);if(!rt)continue;const ot=Math.max(20,Pe.width-8);let ft;rt.verticalAlign==="top"?ft=Pe.y+4:rt.verticalAlign==="bottom"?ft=Pe.y+Pe.height-rt.height-4:ft=Pe.y+(Pe.height-rt.height)/2,K(je.id,{x:Pe.x+4,y:ft,width:ot})}if((Pe==null?void 0:Pe.type)==="text"){const ze=Pe;if(ze.containerId){const je=Ge.get(ze.containerId);if(je&&["rectangle","ellipse","diamond","image"].includes(je.type)){const ot=ze.height+8;if(je.height<ot){K(je.id,{height:ot});const ft=De.getState().elements;for(const pt of qf(je.id,ft)){const Ht=ft.find(_n=>_n.id===pt.id);if(!Ht)continue;const Wt=Ql(Ht,ft);Wt&&K(Ht.id,Wt)}}}}}q(),ks.current!==null&&(Wp.pixelRatio=ks.current,ks.current=null)},[K,q,E,_c]),Vn=te.useCallback((ue,Ce,Oe)=>{if(E||Ce===0&&Oe===0)return;const Ue=De.getState(),Xe=Ue.elements.filter(pt=>{var Ht;return(Ht=pt.groupIds)==null?void 0:Ht.includes(ue)});if(Xe.length===0)return;const Pe=Xe.map(pt=>({id:pt.id,updates:{x:pt.x+Ce,y:pt.y+Oe}}));Ue.batchUpdateElements(Pe);const ze=De.getState().elements,je=new Map;for(const pt of ze)je.set(pt.id,pt);const rt=new Set(Xe.map(pt=>pt.id)),ot=[],ft=new Set;for(const pt of Xe){const Ht=qf(pt.id,ze);for(const _n of Ht){if(ft.has(_n.id)||(ft.add(_n.id),rt.has(_n.id)))continue;const Yn=je.get(_n.id);if(!Yn)continue;const Yt=Ql(Yn,ze);Yt&&ot.push({id:Yn.id,updates:Yt})}const Wt=je.get(pt.id);if(Wt!=null&&Wt.boundElements&&["rectangle","ellipse","diamond","image"].includes(Wt.type))for(const Yn of Wt.boundElements){if(Yn.type!=="text"||rt.has(Yn.id))continue;const Yt=je.get(Yn.id);if(!Yt)continue;const At=Math.max(20,Wt.width-8);let _r;Yt.verticalAlign==="top"?_r=Wt.y+4:Yt.verticalAlign==="bottom"?_r=Wt.y+Wt.height-Yt.height-4:_r=Wt.y+(Wt.height-Yt.height)/2,ot.push({id:Yn.id,updates:{x:Wt.x+4,y:_r,width:At}})}}ot.length>0&&De.getState().batchUpdateElements(ot),Ue.pushHistory()},[E]),Si=te.useCallback(ue=>{var je,rt;if(E)return;const{activeTool:Ce,elements:Oe,currentStyle:Ue,addElement:Ge,updateElement:Xe,setSelectedIds:Pe}=De.getState();if(Ce!=="select")return;const ze=Oe.find(ot=>ot.id===ue);if(ze&&(p==null?void 0:p(ue,ze))!==!0){if(ze.type==="line"||ze.type==="arrow"){const ot=(je=ze.boundElements)==null?void 0:je.find(As=>As.type==="text");if(ot){Pe([ot.id]),tt(ot.id);return}const ft=_s(),pt=ze,Ht=pt.points,Wt={x:Ht[0],y:Ht[1]},_n={x:Ht[Ht.length-2],y:Ht[Ht.length-1]};let Yn,Yt;if(pt.lineType==="curved"){const As=va(Wt,_n,pt.curvature??ma),Da=ou(Wt,As,_n,.5);Yn=pt.x+Da.x,Yt=pt.y+Da.y}else Yn=pt.x+(Wt.x+_n.x)/2,Yt=pt.y+(Wt.y+_n.y)/2;const At={id:ft,type:"text",x:Yn,y:Yt,width:100,height:30,rotation:0,style:{...Ue,fillColor:"transparent"},isLocked:!1,isVisible:!0,boundElements:null,text:"",containerId:ue,textAlign:"center",verticalAlign:"middle"};Ge(At),u==null||u(At);const _r=ze.boundElements??[];Xe(ue,{boundElements:[..._r,{id:ft,type:"text"}]}),Pe([ft]),tt(ft);return}if(ze.type==="rectangle"||ze.type==="ellipse"||ze.type==="diamond"||ze.type==="image"){const ot=(rt=ze.boundElements)==null?void 0:rt.find(Wt=>Wt.type==="text");if(ot){Pe([ot.id]),tt(ot.id);return}const ft=_s(),pt={id:ft,type:"text",x:ze.x,y:ze.y,width:ze.width,height:30,rotation:0,style:{...Ue,fillColor:"transparent"},isLocked:!1,isVisible:!0,boundElements:null,text:"",containerId:ue,textAlign:"center",verticalAlign:"middle"};Ge(pt),u==null||u(pt);const Ht=ze.boundElements??[];Xe(ue,{boundElements:[...Ht,{id:ft,type:"text"}]}),Pe([ft]),tt(ft);return}}},[E,p,u]),yn=te.useCallback((ue,Ce)=>{if(E)return;const{elements:Oe,updateElement:Ue,pushHistory:Ge}=De.getState(),Xe=Oe.find(Pe=>Pe.id===ue);if(Ue(ue,Ce),Xe&&(Ce.startBinding!==void 0||Ce.endBinding!==void 0)){const Pe=Xe.type;if(Ce.startBinding!==void 0){const ze=De.getState().elements;Jl(ue,Pe,Xe.startBinding,Ce.startBinding??null,ze,De.getState().updateElement)}if(Ce.endBinding!==void 0){const ze=De.getState().elements;Jl(ue,Pe,Xe.endBinding,Ce.endBinding??null,ze,De.getState().updateElement)}}Ge()},[E]),fn=te.useCallback((ue,Ce)=>{E||De.getState().updateElement(ue,Ce)},[E]),Ds=te.useCallback(ue=>{Ft(ue)},[]),$n=te.useCallback(ue=>{mr(ue)},[]),vr=te.useCallback((ue,Ce)=>{if(mr(null),tt(null),Ce){const{elements:Oe,updateElement:Ue,deleteElements:Ge,pushHistory:Xe}=De.getState(),Pe=Oe.find(ze=>ze.id===ue);if((Pe==null?void 0:Pe.type)==="text"&&Pe.containerId){const ze=Pe.containerId,je=Oe.find(rt=>rt.id===ze);je!=null&&je.boundElements&&Ue(ze,{boundElements:je.boundElements.filter(rt=>rt.id!==ue)})}Ge([ue]),d==null||d([ue])}else De.getState().pushHistory()},[d]),is=te.useCallback(ue=>{var Ge,Xe;if(E)return;ue.preventDefault();const Ce=le.current;if(!Ce)return;const Oe=Ce.getBoundingClientRect(),Ue=Ct.current;if(Ue){const Pe=Ue.getPointerPosition(),ze=(Pe==null?void 0:Pe.x)??ue.clientX-Oe.left,je=(Pe==null?void 0:Pe.y)??ue.clientY-Oe.top,rt=De.getState().viewport,ot=(ze-rt.x)/rt.scale,ft=(je-rt.y)/rt.scale,{elements:pt,selectedIds:Ht,setSelectedIds:Wt}=De.getState();let _n=null;for(let Yn=pt.length-1;Yn>=0;Yn--){const Yt=pt[Yn];if(Yt.type==="text"&&Yt.containerId)continue;let At=Yt.x,_r=Yt.y,As=Yt.width,Da=Yt.height;if((Yt.type==="arrow"||Yt.type==="line")&&"points"in Yt){const wc=Yt.points,Ln=[],bo=[];for(let vl=0;vl<wc.length;vl+=2)Ln.push(Yt.x+wc[vl]),bo.push(Yt.y+wc[vl+1]);At=Math.min(...Ln),_r=Math.min(...bo),As=Math.max(...Ln)-At,Da=Math.max(...bo)-_r}const ml=Math.max(4,((Ge=Yt.style)==null?void 0:Ge.strokeWidth)??2);if(ot>=At-ml&&ot<=At+As+ml&&ft>=_r-ml&&ft<=_r+Da+ml){_n=Yt;break}}if(_n&&!Ht.includes(_n.id))if((Xe=_n.groupIds)!=null&&Xe.length){const Yn=_n.groupIds[_n.groupIds.length-1],Yt=pt.filter(At=>{var _r;return(_r=At.groupIds)==null?void 0:_r.includes(Yn)}).map(At=>At.id);Wt(Yt)}else Wt([_n.id])}dt({x:ue.clientX-Oe.left,y:ue.clientY-Oe.top})},[E]),Js=te.useMemo(()=>{var Xe;const ue=V.length>0,Oe=navigator.platform.includes("Mac")?"⌘":"Ctrl+",Ue=[];Ue.push({label:"Copy",shortcut:`${Oe}C`,disabled:!ue,action:()=>{ue&&rh(U5(V,F))}}),Ue.push({label:"Paste",shortcut:`${Oe}V`,disabled:!k7(),action:()=>{const Pe=Qm();if(Pe.length===0)return;const ze=20,{clones:je,selectedCloneIds:rt}=ig(Pe,Pe,ze);je.forEach(ot=>H(ot)),ae(rt.length>0?rt:je.map(ot=>ot.id)),q(),rh(Pe.map(ot=>({...ot,x:ot.x+ze,y:ot.y+ze})))}}),Ue.push({label:"Duplicate",shortcut:`${Oe}D`,disabled:!ue,action:()=>{ue&&I.duplicateElements(V)}}),Ue.push({label:"Delete",shortcut:"Del",disabled:!ue,divider:!0,action:()=>{ue&&(se(V),d==null||d(V))}}),Ue.push({label:"Bring to Front",shortcut:`${Oe}⇧]`,disabled:!ue,divider:!0,action:()=>{ue&&I.bringToFront(V)}}),Ue.push({label:"Send to Back",shortcut:`${Oe}⇧[`,disabled:!ue,action:()=>{ue&&I.sendToBack(V)}});let Ge=!1;if(V.length>=2){const Pe=F.filter(ot=>V.includes(ot.id)),ze=new Set(Pe.filter(ot=>{var ft;return(ft=ot.groupIds)==null?void 0:ft.length}).map(ot=>ot.groupIds[ot.groupIds.length-1]));Pe.every(ot=>{var ft;return(ft=ot.groupIds)==null?void 0:ft.length})&&ze.size===1||(Ue.push({label:"Group",shortcut:`${Oe}G`,divider:!0,action:()=>I.groupElements(V)}),Ge=!0)}if(ue){const Pe=F.filter(je=>V.includes(je.id));if(Pe.some(je=>{var rt;return(rt=je.groupIds)==null?void 0:rt.length})){const je=new Set;for(const ot of Pe)(Xe=ot.groupIds)!=null&&Xe.length&&je.add(ot.groupIds[ot.groupIds.length-1]);const rt=F.filter(ot=>{var ft;return(ft=ot.groupIds)==null?void 0:ft.some(pt=>je.has(pt))}).map(ot=>ot.id);Ue.push({label:"Ungroup",shortcut:`${Oe}⇧G`,divider:!Ge,action:()=>I.ungroupElements(rt)})}}if(Ue.push({label:"Select All",shortcut:`${Oe}A`,divider:!0,action:()=>ae(F.map(Pe=>Pe.id))}),ue){const Pe=F.filter(rt=>V.includes(rt.id)),ze=Pe.every(rt=>rt.isLocked),je=Pe.some(rt=>rt.isLocked);Ue.push({label:ze?"Unlock":je?"Unlock All":"Lock",shortcut:`${Oe}⇧L`,divider:!0,action:()=>I.toggleLockElements(V)})}if(ue){const Pe=new Set(["rectangle","ellipse","diamond"]),ze=F.filter(je=>V.includes(je.id)&&Pe.has(je.type));if(ze.length>0){const je=new Set(ze.map(ft=>ft.type)),ot=[{label:"Rectangle",type:"rectangle"},{label:"Ellipse",type:"ellipse"},{label:"Diamond",type:"diamond"}].filter(ft=>!je.has(ft.type)||je.size>1);ot.length>0&&ot.forEach((ft,pt)=>{Ue.push({label:`Convert to ${ft.label}`,divider:pt===0,action:()=>I.convertElementType(ze.map(Ht=>Ht.id),ft.type)})})}}if(R){const Pe=typeof R=="function"?R({selectedIds:V,elements:F,position:St??{x:0,y:0},close:()=>dt(null)}):R;if(Pe.length>0){Ue.push({...Pe[0],divider:!0});for(let ze=1;ze<Pe.length;ze++)Ue.push(Pe[ze])}}return Ue},[V,F,I,H,se,ae,q,d,R,St]);te.useImperativeHandle(e,()=>({getElements:()=>De.getState().elements,setElements:ue=>{oe(ue),q()},addElement:ue=>{H(ue)},deleteElements:ue=>{se(ue)},getSelectedIds:()=>De.getState().selectedIds,setSelectedIds:ue=>{ae(ue)},clearSelection:()=>{ie()},setActiveTool:ue=>{de(ue)},getActiveTool:()=>De.getState().activeTool,undo:()=>{ke()},redo:()=>{Ae()},zoomTo:ue=>{fe({scale:Math.min(nu,Math.max(tu,ue))})},resetView:()=>{fe({x:0,y:0,scale:1})},scrollToElement:(ue,Ce)=>{const Oe=De.getState().elements.find(Wt=>Wt.id===ue);if(!Oe)return;const Ue=le.current;if(!Ue)return;const Ge=Ue.getBoundingClientRect(),Xe=Ge.width,Pe=Ge.height,ze=(Ce==null?void 0:Ce.zoom)??Math.max(De.getState().viewport.scale,1),je=Math.min(nu,Math.max(tu,ze)),rt=Oe.x+(Oe.width??0)/2,ot=Oe.y+(Oe.height??0)/2,ft=Xe/2-rt*je,pt=Pe/2-ot*je,Ht={x:ft,y:pt,scale:je};Ce!=null&&Ce.animate?Zl(De.getState().viewport,Ht,fe):fe(Ht)},zoomToFit:(ue,Ce)=>{const Oe=le.current;if(!Oe)return;const Ue=Oe.getBoundingClientRect(),Ge=Ue.width,Xe=Ue.height;De.getState().zoomToFit(Ge,Xe,ue,{padding:Ce==null?void 0:Ce.padding,maxZoom:Ce==null?void 0:Ce.maxZoom,animate:Ce==null?void 0:Ce.animate})},exportPNG:()=>{var ue;return((ue=Ct.current)==null?void 0:ue.toDataURL({pixelRatio:2}))??null},exportJSON:()=>JSON.stringify(De.getState().elements,null,2),exportSVG:()=>uu(De.getState().elements),importJSON:ue=>{try{const Ce=JSON.parse(ue);Array.isArray(Ce)&&(oe(Ce),q())}catch{}},getStage:()=>Ct.current}));const Sr=()=>{var Ce;if(E)return"default";if(cn||W==="hand")return"grab";const ue=eh(W);return((Ce=ue==null?void 0:ue.getCursor)==null?void 0:Ce.call(ue))??"default"},Ma=_?km.filter(ue=>_.includes(ue.type)):km,xc=w&&!E&&(!["hand","select","eraser"].includes(W)||W==="select"&&V.length>0),yl=!cn&&["select","hand","eraser","image"].includes(W);return Z.jsxs("div",{ref:le,className:L,onContextMenu:is,onMouseLeave:()=>$e(null),style:{position:"relative",width:h,height:y,overflow:"hidden",background:O.canvasBackground},children:[x&&!E&&Z.jsx(g7,{visibleTools:Ma,theme:O}),xc&&Z.jsx(E7,{theme:O}),Z.jsx("div",{style:{cursor:Sr(),width:"100%",height:"100%"},children:Z.jsxs(YE,{ref:Ct,width:Et.width,height:Et.height,x:Y.x,y:Y.y,scaleX:Y.scale,scaleY:Y.scale,draggable:(W==="hand"||cn)&&!E,onMouseDown:qs,onMouseMove:hl,onMouseUp:pl,onWheel:vo,onDragEnd:So,onTouchStart:qs,onTouchMove:hl,onTouchEnd:pl,children:[X&&Z.jsx(Zp,{listening:!1,hitGraphEnabled:!1,children:Z.jsx(D9,{width:Et.width,height:Et.height,viewport:Y,gridColor:O.gridColor})}),Z.jsx(VD,{elements:Mh,listening:yl,onSelect:Ks,onChange:gl,onDragMove:xo,onDoubleClick:Si,autoEditTextId:Ve,onTextEditStart:$n,onTextEditEnd:vr,allElements:Lt,gridSnap:X?ru:void 0,onDragSnap:X?void 0:Ms,viewportScale:ns,onGroupDragEnd:Vn}),Z.jsxs(Zp,{listening:yl,children:[mc.map(ue=>Z.jsx(Xm,{element:ue,isSelected:!0,isEditing:xt&&yt.elementId===ue.id,onSelect:Ks,onChange:gl,onDragMove:xo,onDoubleClick:Si,autoEditText:Ve===ue.id,onTextEditStart:$n,onTextEditEnd:vr,allElements:Lt,gridSnap:X?ru:void 0,onDragSnap:X?void 0:Ms,viewportScale:ns},ue.id)),W==="select"&&!E&&(()=>{const ue=V.filter(Ce=>{const Oe=mi.get(Ce);return!(!Oe||Oe.type==="line"||Oe.type==="arrow"||Oe.type==="text"&&Oe.containerId||Ce===dn)});return ue.length===0?null:Z.jsx(k9,{selectedIds:ue,selectionColor:O.selectionColor})})(),xt&&(()=>{const ue=mi.get(yt.elementId??"");return ue?Z.jsx(j9,{element:ue,allElements:Lt,onPointsChange:yn,onPointDragMove:fn,onSnapTargetChange:Ds,color:O.selectionColor}):null})()]}),Z.jsxs(Zp,{listening:!1,hitGraphEnabled:!1,children:[Z.jsx(R9,{box:On,selectionColor:O.selectionColor}),Z.jsx(P9,{elements:Lt,snapTarget:sr,visible:(W==="line"||W==="arrow"||Hi)&&!E,color:O.selectionColor}),gn.map((ue,Ce)=>ue.orientation==="v"?Z.jsx(Ui,{points:[ue.position,ue.start,ue.position,ue.end],stroke:O.selectionColor,strokeWidth:1,dash:[4,4],listening:!1,perfectDrawEnabled:!1},`ag-${Ce}`):Z.jsx(Ui,{points:[ue.start,ue.position,ue.end,ue.position],stroke:O.selectionColor,strokeWidth:1,dash:[4,4],listening:!1,perfectDrawEnabled:!1},`ag-${Ce}`)),Lt.filter(ue=>ue.isLocked&&be.has(ue.id)).map(ue=>Z.jsx(YD,{element:ue,scale:Y.scale},`lock-${ue.id}`)),He.length>0&&Z.jsx(P3,{peers:He,viewport:Y,stageWidth:Et.width,stageHeight:Et.height,elements:Lt})]})]})}),St&&(z?z({selectedIds:V,elements:F,position:St,close:()=>dt(null)}):Z.jsx(T7,{x:St.x,y:St.y,items:Js,onClose:()=>dt(null),theme:O})),C&&Z.jsx(jD,{theme:O})]})});F3.displayName="FlowCanvas";const jD=te.memo(({theme:t})=>{const e=De(h=>h.elements.length),n=De(h=>h.activeTool),s=De(h=>h.viewport.scale),a=De(h=>h.selectedIds.length),l=De(h=>h.zoomIn),u=De(h=>h.zoomOut),d=De(h=>h.resetZoom),p={background:"none",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:4,color:t.textColor,fontSize:14,lineHeight:1,fontWeight:600};return Z.jsxs("div",{style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",zIndex:50,display:"flex",alignItems:"center",gap:16,background:t.toolbarBg,backdropFilter:"blur(8px)",boxShadow:"0 1px 3px rgba(0,0,0,0.08)",borderRadius:8,padding:"4px 16px",border:`1px solid ${t.toolbarBorder}`,fontSize:12,color:t.mutedTextColor,userSelect:"none"},children:[Z.jsxs("span",{children:["Tool: ",Z.jsx("strong",{style:{color:t.textColor,textTransform:"capitalize"},children:n})]}),Z.jsx("span",{children:"|"}),Z.jsxs("span",{children:["Elements: ",Z.jsx("strong",{style:{color:t.textColor},children:e})]}),a>0&&Z.jsxs(Z.Fragment,{children:[Z.jsx("span",{children:"|"}),Z.jsxs("span",{children:["Selected: ",Z.jsx("strong",{style:{color:t.textColor},children:a})]})]}),Z.jsx("span",{children:"|"}),Z.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2},children:[Z.jsx("button",{onClick:()=>u(),style:p,title:"Zoom out (Cmd+-)",children:"−"}),Z.jsxs("strong",{style:{color:t.textColor,cursor:"pointer",minWidth:40,textAlign:"center"},onClick:()=>d({animate:!0}),title:"Reset zoom (Cmd+0)",children:[Math.round(s*100),"%"]}),Z.jsx("button",{onClick:()=>l(),style:p,title:"Zoom in (Cmd+=)",children:"+"})]})]})}),U3={rectangle:0,ellipse:1,diamond:2,line:3,arrow:4,freedraw:5,text:6,image:7};class B3{constructor(e=1024){et(this,"_data");et(this,"_capacity",0);et(this,"_indexMap",new Map);this._data=this._allocate(e),this._capacity=e}get length(){return this._data.length}get data(){return this._data}_allocate(e){return{ids:new Array(e),x:new Float64Array(e),y:new Float64Array(e),w:new Float64Array(e),h:new Float64Array(e),types:new Uint8Array(e),length:0}}_ensureCapacity(e){if(e<=this._capacity)return;const n=Math.max(e,this._capacity*2),s=this._data,a=this._allocate(n);a.x.set(s.x.subarray(0,s.length)),a.y.set(s.y.subarray(0,s.length)),a.w.set(s.w.subarray(0,s.length)),a.h.set(s.h.subarray(0,s.length)),a.types.set(s.types.subarray(0,s.length));for(let l=0;l<s.length;l++)a.ids[l]=s.ids[l];a.length=s.length,this._data=a,this._capacity=n}rebuild(e){const n=e.length;this._ensureCapacity(n),this._indexMap.clear();const{ids:s,x:a,y:l,w:u,h:d,types:p}=this._data;for(let h=0;h<n;h++){const y=e[h];s[h]=y.id,a[h]=y.x,l[h]=y.y,u[h]=y.width,d[h]=y.height,p[h]=U3[y.type]??0,this._indexMap.set(y.id,h)}this._data.length=n}updateElement(e){const n=this._indexMap.get(e.id);return n===void 0?!1:(this._data.x[n]=e.x,this._data.y[n]=e.y,this._data.w[n]=e.width,this._data.h[n]=e.height,!0)}cullViewport(e,n,s,a=200){const{x:l,y:u,scale:d}=e,p=-l/d-a,h=-u/d-a,y=(-l+n)/d+a,_=(-u+s)/d+a,{ids:S,x,y:w,w:C,h:D,length:U}=this._data,M=[];for(let E=0;E<U;E++){const L=x[E],R=w[E],z=C[E],ee=D[E];L+z>=p&&L<=y&&R+ee>=h&&R<=_&&M.push(S[E])}return M}queryRect(e,n,s,a){const{ids:l,x:u,y:d,w:p,h,length:y}=this._data,_=[];for(let S=0;S<y;S++){const x=u[S],w=d[S],C=p[S],D=h[S];x+C>=e&&x<=s&&w+D>=n&&w<=a&&_.push(l[S])}return _}queryPoint(e,n){const{ids:s,x:a,y:l,w:u,h:d,length:p}=this._data,h=[];for(let y=0;y<p;y++)e>=a[y]&&e<=a[y]+u[y]&&n>=l[y]&&n<=l[y]+d[y]&&h.push(s[y]);return h}clear(){this._data.length=0,this._indexMap.clear()}}let a1=null;function WD(){return a1||(a1=new B3),a1}const ts="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",o1=ts.length,Au=ts[0],XD=ts[o1-1];function qD(t,e){const n=ts.indexOf(t),s=ts.indexOf(e);if(s-n<=1)return null;const a=Math.floor((n+s)/2);return ts[a]}function l1(t,e){return t===null&&e===null?"a0":e===null?z3(t):t===null?KD(e):QD(t,e)}function c1(t,e,n){if(n===0)return[];if(n===1)return[l1(t,e)];const s=Math.floor(n/2),a=l1(t,e),l=c1(t,a,s),u=c1(a,e,n-s-1);return[...l,a,...u]}function z3(t){const e=t.split("");for(let n=e.length-1;n>=0;n--){const s=ts.indexOf(e[n]);if(s<o1-1)return e[n]=ts[s+1],e.join("");e[n]=Au}return t+ts[1]}function KD(t){const e=t.split("");for(let n=e.length-1;n>=0;n--){const s=ts.indexOf(e[n]);if(s>0){e[n]=ts[s-1];let a=e.join("");for(;a.length>1&&a.endsWith(Au);)a=a.slice(0,-1);return a}e[n]=XD}return Au+t}function QD(t,e){const n=Math.max(t.length,e.length),s=t.padEnd(n,Au),a=e.padEnd(n,Au);let l="";for(let u=0;u<n;u++){if(s[u]===a[u]){l+=s[u];continue}const d=qD(s[u],a[u]);return d!==null?l+d:l+s[u]+z3(s.slice(u+1).replace(/0+$/,"")||Au)}return t+ts[Math.floor(o1/2)]}function JD(t){if(!t||t.length===0)return!1;for(const e of t)if(ts.indexOf(e)===-1)return!1;return!0}function ZD(t,e){return t===e?0:t<e?-1:1}class $D{constructor(e=1e4){et(this,"_entries",[]);et(this,"_maxEntries");this._maxEntries=e}push(e){this._entries.push(e),this._entries.length>this._maxEntries&&(this._entries=this._entries.slice(this._entries.length-this._maxEntries))}get entries(){return this._entries}entriesSince(e){return this._entries.filter(n=>n.timestamp>=e)}entriesByClient(e){return this._entries.filter(n=>n.clientId===e)}clear(){this._entries=[]}get length(){return this._entries.length}}function H3(t){return{type:"add",element:t}}function G3(t){return{type:"delete",elementId:t}}function V3(t,e,n){return{type:"move",elementId:t,dx:e,dy:n}}function Y3(t,e,n,s,a){return{type:"resize",elementId:t,width:e,height:n,x:s,y:a}}function j3(t,e){return{type:"style",elementId:t,changes:e}}function W3(t,e){return{type:"rotate",elementId:t,rotation:e}}function X3(t,e){return{type:"reorder",elementId:t,sortOrder:e}}function q3(t,e){return{type:"updatePoints",elementId:t,points:e}}function K3(t,e){return{type:"setText",elementId:t,text:e}}function eA(...t){return{type:"batch",operations:t}}function Q3(t,e){switch(e.type){case"add":return[...t,e.element];case"delete":return t.filter(n=>n.id!==e.elementId);case"move":return t.map(n=>n.id===e.elementId?{...n,x:n.x+e.dx,y:n.y+e.dy}:n);case"resize":return t.map(n=>n.id===e.elementId?{...n,width:e.width,height:e.height,...e.x!==void 0?{x:e.x}:{},...e.y!==void 0?{y:e.y}:{}}:n);case"style":return t.map(n=>n.id===e.elementId?{...n,style:{...n.style,...e.changes}}:n);case"rotate":return t.map(n=>n.id===e.elementId?{...n,rotation:e.rotation}:n);case"reorder":return t.map(n=>n.id===e.elementId?{...n,sortOrder:e.sortOrder}:n);case"updatePoints":return t.map(n=>n.id!==e.elementId?n:"points"in n?{...n,points:e.points}:n);case"setText":return t.map(n=>n.id!==e.elementId?n:n.type==="text"?{...n,text:e.text}:n);case"batch":{let n=t;for(const s of e.operations)n=Q3(n,s);return n}default:return t}}function tA(t,e){const n=[],s=new Map,a=new Map;for(const l of t)s.set(l.id,l);for(const l of e)a.set(l.id,l);for(const l of e)s.has(l.id)||n.push(H3(l));for(const l of t)a.has(l.id)||n.push(G3(l.id));for(const l of e){const u=s.get(l.id);if(!u||u===l)continue;(u.x!==l.x||u.y!==l.y)&&n.push(V3(l.id,l.x-u.x,l.y-u.y)),(u.width!==l.width||u.height!==l.height)&&n.push(Y3(l.id,l.width,l.height)),u.rotation!==l.rotation&&n.push(W3(l.id,l.rotation));const d={};let p=!1;for(const h of Object.keys(l.style))u.style[h]!==l.style[h]&&(d[h]=l.style[h],p=!0);if(p&&n.push(j3(l.id,d)),l.type==="text"&&u.type==="text"&&l.text!==u.text&&n.push(K3(l.id,l.text)),(l.type==="line"||l.type==="arrow"||l.type==="freedraw")&&(u.type==="line"||u.type==="arrow"||u.type==="freedraw")){const h=l.points,y=u.points;(h.length!==y.length||h.some((_,S)=>_!==y[S]))&&n.push(q3(l.id,h))}u.sortOrder!==l.sortOrder&&l.sortOrder!==void 0&&n.push(X3(l.id,l.sortOrder))}return n}class nA{constructor(){et(this,"_doc",null);et(this,"_provider",null);et(this,"_config",null);et(this,"_isApplyingRemote",!1);et(this,"_isApplyingLocal",!1);et(this,"_lastElements",[]);et(this,"_syncTimer",null);et(this,"_deepTimer",null);et(this,"_dirtyIds",new Set);et(this,"_storeUnsub",null);et(this,"_yObserverCleanup",null);et(this,"_statusListeners",new Set)}get doc(){return this._doc}get provider(){return this._provider}get config(){return this._config}get isActive(){return this._provider!==null&&this._provider.wsconnected}connect(e){return this.dispose(),this._config=e,this._doc=new ac,this._provider=new _3(e.serverUrl,e.roomName,this._doc,{connect:!0,params:e.authToken?{token:e.authToken}:void 0}),this._provider.awareness.setLocalState({user:e.user,cursor:null,selectedIds:[]}),this._provider.on("status",n=>{const s=n.status;for(const a of this._statusListeners)a(s)}),{doc:this._doc,provider:this._provider}}getYElements(){var e;return(e=this._doc)==null?void 0:e.getMap("elements")}updateAwareness(e){if(!this._provider)return;const n=this._provider.awareness.getLocalState();this._provider.awareness.setLocalState({...n,...e})}getRemoteAwareness(){if(!this._provider)return new Map;const e=this._provider.awareness.getStates(),n=this._provider.awareness.clientID,s=new Map;for(const[a,l]of e)a!==n&&l&&l.user&&s.set(a,l);return s}onStatusChange(e){return this._statusListeners.add(e),()=>{this._statusListeners.delete(e)}}startSync(e,n=50){const s=this._doc,a=this.getYElements();if(!s||!a){console.warn("[CollaborationManager] Cannot start sync — not connected");return}if(this.stopSync(),a.size>0){this._isApplyingRemote=!0;const d=this._yMapCollectionToElements(a);e.setElements(d),this._lastElements=d,this._isApplyingRemote=!1}else{const d=e.getState().elements;d.length>0&&(this._isApplyingLocal=!0,s.transact(()=>{for(const p of d){const h=new zi;Th(p,h),a.set(p.id,h)}},"local-init"),this._isApplyingLocal=!1),this._lastElements=d}const l=(d,p)=>{if(p.origin==="local-sync"||p.origin==="local-init"||this._isApplyingLocal)return;this._isApplyingRemote=!0;let h=[...this._lastElements],y=!1;for(const[_,S]of d.keys)if(S.action==="add"||S.action==="update"){const x=a.get(_);if(x){const w=fc(x);if(w){const C=h.findIndex(D=>D.id===_);C>=0?h[C]=w:h.push(w),y=!0}}}else S.action==="delete"&&(h=h.filter(x=>x.id!==_),y=!0);y&&(h.sort((_,S)=>_.sortOrder&&S.sortOrder?_.sortOrder<S.sortOrder?-1:_.sortOrder>S.sortOrder?1:0:0),e.setElements(h),this._lastElements=h),this._isApplyingRemote=!1},u=d=>{if(!this._isApplyingLocal){for(const p of d){let h=p.target;for(;h&&!(h instanceof zi&&h.parent===a);)h=h.parent;if(h instanceof zi){const y=h.get("id");y&&this._dirtyIds.add(y)}}this._deepTimer&&clearTimeout(this._deepTimer),this._deepTimer=setTimeout(()=>{if(this._dirtyIds.size===0||this._isApplyingLocal)return;this._isApplyingRemote=!0;let p=[...this._lastElements],h=!1;for(const y of this._dirtyIds){const _=a.get(y);if(!_)continue;const S=fc(_);if(!S)continue;const x=p.findIndex(w=>w.id===y);x>=0&&(p[x]=S,h=!0)}this._dirtyIds.clear(),h&&(e.setElements(p),this._lastElements=p),this._isApplyingRemote=!1},16)}};a.observe(l),a.observeDeep(u),this._yObserverCleanup=()=>{a.unobserve(l),a.unobserveDeep(u),this._deepTimer&&clearTimeout(this._deepTimer),this._dirtyIds.clear()},this._storeUnsub=e.subscribe(d=>{this._isApplyingRemote||d.elements!==this._lastElements&&(this._syncTimer&&clearTimeout(this._syncTimer),this._syncTimer=setTimeout(()=>{this._syncLocalToYjs(d.elements,a,s)},n))})}stopSync(){var e,n;(e=this._storeUnsub)==null||e.call(this),this._storeUnsub=null,(n=this._yObserverCleanup)==null||n.call(this),this._yObserverCleanup=null,this._syncTimer&&(clearTimeout(this._syncTimer),this._syncTimer=null),this._lastElements=[]}dispose(){this.stopSync(),this._provider&&(this._provider.awareness.setLocalState(null),this._provider.disconnect(),this._provider.destroy(),this._provider=null),this._doc&&(this._doc.destroy(),this._doc=null),this._config=null,this._statusListeners.clear()}_syncLocalToYjs(e,n,s){this._isApplyingLocal=!0,this._lastElements=e;const a=new Map;for(const l of e)a.set(l.id,l);s.transact(()=>{for(const[l]of n.entries())a.has(l)||n.delete(l);for(const l of e){let u=n.get(l.id);u?this._updateYMapFromElement(l,u):(u=new zi,Th(l,u),n.set(l.id,u))}},"local-sync"),this._isApplyingLocal=!1}_updateYMapFromElement(e,n){const s=["id","type","x","y","width","height","rotation","isLocked","isVisible","sortOrder"],a=["strokeColor","fillColor","strokeWidth","opacity","strokeStyle","roughness","fontSize","fontFamily"],l=e;for(const d of s){const p=l[d];p!==n.get(d)&&n.set(d,p)}if(e.style)for(const d of a){const p=e.style[d];p!==n.get(`style.${d}`)&&n.set(`style.${d}`,p)}const u=e.boundElements?JSON.stringify(e.boundElements):null;switch(u!==n.get("boundElements")&&n.set("boundElements",u),e.type){case"rectangle":e.cornerRadius!==n.get("cornerRadius")&&n.set("cornerRadius",e.cornerRadius);break;case"line":case"arrow":{const p=JSON.stringify(e.points);p!==n.get("points")&&n.set("points",p),e.lineType!==n.get("lineType")&&n.set("lineType",e.lineType),e.curvature!==n.get("curvature")&&n.set("curvature",e.curvature);const h=e.startBinding?JSON.stringify(e.startBinding):null;h!==n.get("startBinding")&&n.set("startBinding",h);const y=e.endBinding?JSON.stringify(e.endBinding):null;y!==n.get("endBinding")&&n.set("endBinding",y),e.type==="arrow"&&(e.startArrowhead!==n.get("startArrowhead")&&n.set("startArrowhead",e.startArrowhead),e.endArrowhead!==n.get("endArrowhead")&&n.set("endArrowhead",e.endArrowhead));break}case"freedraw":{const p=JSON.stringify(e.points);p!==n.get("points")&&n.set("points",p);break}case"text":e.text!==n.get("text")&&n.set("text",e.text),e.containerId!==n.get("containerId")&&n.set("containerId",e.containerId),e.textAlign!==n.get("textAlign")&&n.set("textAlign",e.textAlign),e.verticalAlign!==n.get("verticalAlign")&&n.set("verticalAlign",e.verticalAlign);break;case"image":e.src!==n.get("src")&&n.set("src",e.src),e.naturalWidth!==n.get("naturalWidth")&&n.set("naturalWidth",e.naturalWidth),e.naturalHeight!==n.get("naturalHeight")&&n.set("naturalHeight",e.naturalHeight),e.scaleMode!==n.get("scaleMode")&&n.set("scaleMode",e.scaleMode);const d=e.crop?JSON.stringify(e.crop):null;d!==n.get("crop")&&n.set("crop",d),e.cornerRadius!==n.get("cornerRadius")&&n.set("cornerRadius",e.cornerRadius),e.alt!==n.get("alt")&&n.set("alt",e.alt);break}}_yMapCollectionToElements(e){const n=[];for(const[,s]of e.entries()){const a=fc(s);a&&n.push(a)}return n.sort((s,a)=>s.sortOrder&&a.sortOrder?s.sortOrder<a.sortOrder?-1:s.sortOrder>a.sortOrder?1:0:0),n}}class rA{constructor(e){et(this,"_worker",null);et(this,"_callbacks");this._callbacks=e}connect(e,n){this.dispose(),this._worker=new Worker(new URL("/assets/syncWorker.worker-CnlpNZ3k.js",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:to&&to.tagName.toUpperCase()==="SCRIPT"&&to.src||new URL("f1ow-canvas.umd.cjs",document.baseURI).href),{type:"module"}),this._worker.onmessage=s=>{const a=s.data;switch(a.type){case"status":this._callbacks.onStatus(a.status);break;case"remote-update":this._callbacks.onRemoteUpdate(a.elements);break;case"peers":this._callbacks.onPeers(a.peers);break;case"error":this._callbacks.onError(a.message);break}},this._worker.onerror=s=>{this._callbacks.onError(`Worker error: ${s.message}`)},this._post({type:"connect",config:e,syncDebounceMs:n})}disconnect(){this._post({type:"disconnect"})}sendLocalUpdate(e){this._post({type:"local-update",elements:e})}sendAwareness(e){this._post({type:"awareness",cursor:e.cursor??null,selectedIds:e.selectedIds,activeTool:e.activeTool})}dispose(){this._worker&&(this._worker.terminate(),this._worker=null)}_post(e){var n;(n=this._worker)==null||n.postMessage(e)}}function Ru(t){return`${t.zoom}:${t.col}:${t.row}`}class J3{constructor(e=200){et(this,"_cache",new Map);et(this,"_accessCounter",0);et(this,"_maxTiles");this._maxTiles=e}get(e){const n=this._cache.get(Ru(e));return n?(n.accessOrder=++this._accessCounter,n.bitmap):null}set(e,n,s=0){const a=Ru(e),l=this._cache.get(a);l&&l.bitmap.close(),this._cache.set(a,{key:a,bitmap:n,accessOrder:++this._accessCounter,generation:s}),this._evict()}isFresh(e,n){const s=this._cache.get(Ru(e));return s!=null&&s.generation>=n}invalidate(e){const n=Ru(e),s=this._cache.get(n);s&&(s.bitmap.close(),this._cache.delete(n))}clear(){for(const e of this._cache.values())e.bitmap.close();this._cache.clear()}get size(){return this._cache.size}dispose(){this.clear()}_evict(){if(this._cache.size<=this._maxTiles)return;const e=Array.from(this._cache.values()).sort((s,a)=>s.accessOrder-a.accessOrder),n=e.length-this._maxTiles;for(let s=0;s<n;s++)e[s].bitmap.close(),this._cache.delete(e[s].key)}}const kh=256,a0=[.1,.15,.2,.25,.33,.5,.67,.75,1,1.25,1.5,2,2.5,3,4,5];function Z3(t){let e=a0[0],n=Math.abs(t-e);for(let s=1;s<a0.length;s++){const a=Math.abs(t-a0[s]);a<n&&(e=a0[s],n=a)}return e}function Lu(t){return kh/t}function $3(t,e,n,s=1){const a=Z3(t.scale),l=Lu(a),u=-t.x/t.scale,d=-t.y/t.scale,p=u+e/t.scale,h=d+n/t.scale,y=Math.floor(u/l)-s,_=Math.ceil(p/l)+s,S=Math.floor(d/l)-s,x=Math.ceil(h/l)+s,w=[];for(let C=y;C<=_;C++)for(let D=S;D<=x;D++)w.push({col:C,row:D,zoom:a});return{tiles:w,zoom:a}}function ew(t){const e=Lu(t.zoom);return{minX:t.col*e,minY:t.row*e,maxX:(t.col+1)*e,maxY:(t.row+1)*e}}function iA(t,e){return t.minX<=e.maxX&&t.maxX>=e.minX&&t.minY<=e.maxY&&t.maxY>=e.minY}function sA(t,e){const n=Kf(t),s=Lu(e),a=[],l=Math.floor(n.minX/s),u=Math.floor(n.maxX/s),d=Math.floor(n.minY/s),p=Math.floor(n.maxY/s);for(let h=l;h<=u;h++)for(let y=d;y<=p;y++)a.push({col:h,row:y,zoom:e});return a}class tw{constructor(e={}){et(this,"_cache");et(this,"_drawFn");et(this,"_elementTiles",new Map);et(this,"_generation",0);this._cache=new J3(e.maxCachedTiles??200),this._drawFn=e.drawFn??aA}getTiles(e,n,s,a){const{tiles:l,zoom:u}=$3(e,n,s),d=[];for(const p of l){let h=this._cache.get(p);h||(h=this._rasterise(p,a),this._cache.set(p,h,this._generation));const y=Lu(u);d.push({coord:p,bitmap:h,worldX:p.col*y,worldY:p.row*y,worldSize:y})}return d}invalidateElements(e){const n=new Set;for(const s of e){const a=this._elementTiles.get(s);if(a){for(const l of a)n.add(l);this._elementTiles.delete(s)}}for(const s of n){const[a,l,u]=s.split(":").map(Number);this._cache.invalidate({zoom:a,col:l,row:u})}}invalidateAll(){this._generation++,this._cache.clear(),this._elementTiles.clear()}dispose(){this._cache.dispose(),this._elementTiles.clear()}get cacheSize(){return this._cache.size}_rasterise(e,n){const s=ew(e),a=Lu(e.zoom),l=[];for(const h of n){const y=Kf(h);if(iA(y,s)){l.push(h);const _=Ru(e),S=this._elementTiles.get(h.id);S?S.includes(_)||S.push(_):this._elementTiles.set(h.id,[_])}}const u=new OffscreenCanvas(kh,kh),d=u.getContext("2d"),p=kh/a;return d.scale(p,p),d.translate(-s.minX,-s.minY),this._drawFn(d,l,s),u.transferToImageBitmap()}}function aA(t,e,n){var s,a,l,u,d,p,h;for(const y of e){if(t.save(),y.rotation){const w=y.x+y.width/2,C=y.y+y.height/2;t.translate(w,C),t.rotate(y.rotation*Math.PI/180),t.translate(-w,-C)}t.globalAlpha=((s=y.style)==null?void 0:s.opacity)??1;const _=((a=y.style)==null?void 0:a.strokeColor)??"#000000",S=((l=y.style)==null?void 0:l.fillColor)??"transparent",x=((u=y.style)==null?void 0:u.strokeWidth)??2;switch(t.strokeStyle=_,t.fillStyle=S,t.lineWidth=x,y.type){case"rectangle":t.beginPath(),t.rect(y.x,y.y,y.width,y.height),S!=="transparent"&&t.fill(),t.stroke();break;case"ellipse":t.beginPath(),t.ellipse(y.x+y.width/2,y.y+y.height/2,y.width/2,y.height/2,0,0,Math.PI*2),S!=="transparent"&&t.fill(),t.stroke();break;case"diamond":{const w=y.x+y.width/2,C=y.y+y.height/2;t.beginPath(),t.moveTo(w,y.y),t.lineTo(y.x+y.width,C),t.lineTo(w,y.y+y.height),t.lineTo(y.x,C),t.closePath(),S!=="transparent"&&t.fill(),t.stroke();break}case"line":case"arrow":{const w=y.points;if(w.length>=4){t.beginPath(),t.moveTo(y.x+w[0],y.y+w[1]);for(let C=2;C<w.length;C+=2)t.lineTo(y.x+w[C],y.y+w[C+1]);t.stroke()}break}case"freedraw":{const w=y.points;if(w.length>=4){t.beginPath(),t.moveTo(y.x+w[0],y.y+w[1]);for(let C=2;C<w.length;C+=2)t.lineTo(y.x+w[C],y.y+w[C+1]);t.stroke()}break}case"text":{const w=y;t.font=`${((d=w.style)==null?void 0:d.fontSize)??16}px ${((p=w.style)==null?void 0:p.fontFamily)??"sans-serif"}`,t.fillStyle=_,t.fillText(w.text,y.x,y.y+(((h=w.style)==null?void 0:h.fontSize)??16));break}case"image":t.strokeStyle="#ccc",t.setLineDash([4,4]),t.strokeRect(y.x,y.y,y.width,y.height);break}t.restore()}}function oA(t,e,n,s,a={}){var w;const{enabled:l=!1,maxCachedTiles:u=200,drawFn:d,elementThreshold:p=500}=a,h=te.useRef(null);te.useEffect(()=>(h.current=new tw({maxCachedTiles:u,drawFn:d}),()=>{var C;(C=h.current)==null||C.dispose(),h.current=null}),[u,d]);const y=l&&t.length>=p,_=te.useMemo(()=>!y||!h.current||n===0||s===0?[]:h.current.getTiles(e,n,s,t).map(D=>({key:`${D.coord.zoom}:${D.coord.col}:${D.coord.row}`,bitmap:D.bitmap,worldX:D.worldX,worldY:D.worldY,worldSize:D.worldSize})),[y,e.x,e.y,e.scale,n,s,t]),S=te.useCallback(C=>{var D;(D=h.current)==null||D.invalidateElements(C)},[]),x=te.useCallback(()=>{var C;(C=h.current)==null||C.invalidateAll()},[]);return{isActive:y,tiles:_,invalidateElements:S,invalidateAll:x,cacheSize:((w=h.current)==null?void 0:w.cacheSize)??0}}const Cs=4096,o0=1024,l0=16,nw=2;class lA{constructor(e=Cs,n=Cs){et(this,"_shelves",[]);et(this,"_atlasWidth");et(this,"_atlasHeight");this._atlasWidth=e,this._atlasHeight=n}pack(e,n){const s=e+nw,a=n+nw;for(const d of this._shelves)if(d.height>=a&&d.x+s<=this._atlasWidth){const p={x:d.x,y:d.y};return d.x+=s,p}const l=this._shelves.length>0?this._shelves[this._shelves.length-1].y+this._shelves[this._shelves.length-1].height:0;if(l+a>this._atlasHeight)return null;const u={y:l,height:a,x:s};return this._shelves.push(u),{x:0,y:l}}reset(){this._shelves=[]}}class rw{constructor(e){et(this,"_entries",new Map);et(this,"_packer");et(this,"_canvas");et(this,"_ctx");et(this,"_drawFn");et(this,"_dirty",!1);et(this,"_generation",0);this._packer=new lA(Cs,Cs),this._canvas=new OffscreenCanvas(Cs,Cs),this._ctx=this._canvas.getContext("2d"),this._drawFn=e??uA}addOrUpdate(e,n){const s=this._entries.get(e.id);if(s&&s.generation>=n)return s.region;const{pw:a,ph:l}=cA(e),u=this._packer.pack(a,l);if(!u)return null;this._ctx.save(),this._ctx.clearRect(u.x,u.y,a,l),this._ctx.translate(u.x,u.y);const d=a/Math.max(e.width,1),p=l/Math.max(e.height,1);this._ctx.scale(d,p),this._drawFn(this._ctx,e,e.width,e.height),this._ctx.restore();const h={atlasIndex:0,u:u.x/Cs,v:u.y/Cs,uWidth:a/Cs,vHeight:l/Cs,pixelWidth:a,pixelHeight:l};return this._entries.set(e.id,{elementId:e.id,region:h,generation:n}),this._dirty=!0,h}getRegion(e){var n;return((n=this._entries.get(e))==null?void 0:n.region)??null}remove(e){this._entries.delete(e)}rebuild(e){this._generation++,this._packer.reset(),this._entries.clear(),this._ctx.clearRect(0,0,Cs,Cs);for(const n of e)this.addOrUpdate(n,this._generation);this._dirty=!0}get isDirty(){return this._dirty}getCanvas(){return this._dirty=!1,this._canvas}get generation(){return this._generation}get size(){return this._entries.size}dispose(){this._entries.clear()}}function cA(t){const e=Math.max(t.width,1)/Math.max(t.height,1);let n,s;return t.width>=t.height?(n=Math.min(Math.max(Math.ceil(t.width),l0),o0),s=Math.min(Math.max(Math.ceil(n/e),l0),o0)):(s=Math.min(Math.max(Math.ceil(t.height),l0),o0),n=Math.min(Math.max(Math.ceil(s*e),l0),o0)),{pw:n,ph:s}}function uA(t,e,n,s){var d,p,h,y,_,S,x;const a=((d=e.style)==null?void 0:d.strokeColor)??"#000000",l=((p=e.style)==null?void 0:p.fillColor)??"transparent",u=((h=e.style)==null?void 0:h.strokeWidth)??2;switch(t.strokeStyle=a,t.fillStyle=l,t.lineWidth=u,t.globalAlpha=((y=e.style)==null?void 0:y.opacity)??1,e.type){case"rectangle":t.beginPath(),t.rect(0,0,n,s),l!=="transparent"&&t.fill(),t.stroke();break;case"ellipse":t.beginPath(),t.ellipse(n/2,s/2,n/2,s/2,0,0,Math.PI*2),l!=="transparent"&&t.fill(),t.stroke();break;case"diamond":{t.beginPath(),t.moveTo(n/2,0),t.lineTo(n,s/2),t.lineTo(n/2,s),t.lineTo(0,s/2),t.closePath(),l!=="transparent"&&t.fill(),t.stroke();break}case"text":{const w=e;t.font=`${((_=w.style)==null?void 0:_.fontSize)??16}px ${((S=w.style)==null?void 0:S.fontFamily)??"sans-serif"}`,t.fillStyle=a,t.fillText(w.text,0,((x=w.style)==null?void 0:x.fontSize)??16);break}default:t.strokeStyle="#aaa",t.strokeRect(0,0,n,s);break}}const dA=`#version 300 es
|
|
314
|
+
precision highp float;
|
|
315
|
+
|
|
316
|
+
// Shared unit-quad corners (0=bottom-left, 1=top-right)
|
|
317
|
+
in vec2 a_position;
|
|
318
|
+
|
|
319
|
+
// Per-instance attributes
|
|
320
|
+
in vec4 a_worldRect; // x, y, width, height
|
|
321
|
+
in vec4 a_texRect; // u, v, uWidth, vHeight
|
|
322
|
+
in float a_opacity;
|
|
323
|
+
in float a_rotation;
|
|
324
|
+
|
|
325
|
+
// Uniforms
|
|
326
|
+
uniform mat3 u_viewMatrix; // world → NDC
|
|
327
|
+
|
|
328
|
+
out vec2 v_texCoord;
|
|
329
|
+
out float v_opacity;
|
|
330
|
+
|
|
331
|
+
void main() {
|
|
332
|
+
// Expand unit quad to world-space rectangle
|
|
333
|
+
float cx = a_worldRect.x + a_worldRect.z * 0.5;
|
|
334
|
+
float cy = a_worldRect.y + a_worldRect.w * 0.5;
|
|
335
|
+
|
|
336
|
+
// Local offset from center
|
|
337
|
+
float lx = (a_position.x - 0.5) * a_worldRect.z;
|
|
338
|
+
float ly = (a_position.y - 0.5) * a_worldRect.w;
|
|
339
|
+
|
|
340
|
+
// Apply rotation
|
|
341
|
+
float cosR = cos(a_rotation);
|
|
342
|
+
float sinR = sin(a_rotation);
|
|
343
|
+
float rx = lx * cosR - ly * sinR;
|
|
344
|
+
float ry = lx * sinR + ly * cosR;
|
|
345
|
+
|
|
346
|
+
// World position
|
|
347
|
+
vec2 worldPos = vec2(cx + rx, cy + ry);
|
|
348
|
+
|
|
349
|
+
// Transform to clip space
|
|
350
|
+
vec3 clipPos = u_viewMatrix * vec3(worldPos, 1.0);
|
|
351
|
+
gl_Position = vec4(clipPos.xy, 0.0, 1.0);
|
|
352
|
+
|
|
353
|
+
// UV mapping
|
|
354
|
+
v_texCoord = a_texRect.xy + a_position * a_texRect.zw;
|
|
355
|
+
v_opacity = a_opacity;
|
|
356
|
+
}
|
|
357
|
+
`,fA=`#version 300 es
|
|
358
|
+
precision mediump float;
|
|
359
|
+
|
|
360
|
+
in vec2 v_texCoord;
|
|
361
|
+
in float v_opacity;
|
|
362
|
+
|
|
363
|
+
uniform sampler2D u_atlas;
|
|
364
|
+
|
|
365
|
+
out vec4 fragColor;
|
|
366
|
+
|
|
367
|
+
void main() {
|
|
368
|
+
vec4 texColor = texture(u_atlas, v_texCoord);
|
|
369
|
+
fragColor = texColor * v_opacity;
|
|
370
|
+
}
|
|
371
|
+
`;function iw(t,e,n){const s=t.createShader(e);if(!s)throw new Error("Failed to create shader");if(t.shaderSource(s,n),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS)){const a=t.getShaderInfoLog(s)??"Unknown error";throw t.deleteShader(s),new Error(`Shader compile error: ${a}`)}return s}function hA(t,e,n){const s=t.createProgram();if(!s)throw new Error("Failed to create program");if(t.attachShader(s,e),t.attachShader(s,n),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS)){const a=t.getProgramInfoLog(s)??"Unknown error";throw t.deleteProgram(s),new Error(`Program link error: ${a}`)}return s}function pA(t,e,n){const s=iw(t,t.VERTEX_SHADER,e),a=iw(t,t.FRAGMENT_SHADER,n),l=hA(t,s,a);return t.deleteShader(s),t.deleteShader(a),l}function gA(t,e,n=t.STATIC_DRAW){const s=t.createBuffer();if(!s)throw new Error("Failed to create buffer");return t.bindBuffer(t.ARRAY_BUFFER,s),t.bufferData(t.ARRAY_BUFFER,e,n),s}function yA(t,e,n){const s=n??t.createTexture();if(!s)throw new Error("Failed to create texture");return t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),s}function sw(t,e,n,s,a){const l=2*n/s,u=-2*n/a,d=2*t/s-1,p=-2*e/a+1;return new Float32Array([l,0,0,0,u,0,d,p,1])}const u1=10;class aw{constructor(e={}){et(this,"_canvas",null);et(this,"_gl",null);et(this,"_program",null);et(this,"_vao",null);et(this,"_quadVBO",null);et(this,"_instanceVBO",null);et(this,"_atlasTexture",null);et(this,"_atlas");et(this,"_viewMatrixLoc",null);et(this,"_atlasLoc",null);et(this,"_instanceData",new Float32Array(0));et(this,"_instanceCount",0);et(this,"_elementThreshold");et(this,"_generation",0);et(this,"_staticIds",new Set);et(this,"_isInitialised",!1);et(this,"_width",0);et(this,"_height",0);this._atlas=new rw(e.rasterFn),this._elementThreshold=e.elementThreshold??1e3}init(e){if(this._isInitialised)return!0;const n=e.getContext("webgl2",{alpha:!0,premultipliedAlpha:!0,antialias:!0,desynchronized:!0});if(!n)return console.warn("[WebGLHybrid] WebGL2 not available"),!1;this._canvas=e,this._gl=n;try{this._program=pA(n,dA,fA)}catch(y){return console.warn("[WebGLHybrid] Shader compilation failed:",y),!1}this._viewMatrixLoc=n.getUniformLocation(this._program,"u_viewMatrix"),this._atlasLoc=n.getUniformLocation(this._program,"u_atlas"),this._vao=n.createVertexArray(),n.bindVertexArray(this._vao);const s=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this._quadVBO=gA(n,s,n.STATIC_DRAW);const a=n.getAttribLocation(this._program,"a_position");n.bindBuffer(n.ARRAY_BUFFER,this._quadVBO),n.enableVertexAttribArray(a),n.vertexAttribPointer(a,2,n.FLOAT,!1,0,0),this._instanceVBO=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this._instanceVBO),n.bufferData(n.ARRAY_BUFFER,0,n.DYNAMIC_DRAW);const l=u1*4,u=n.getAttribLocation(this._program,"a_worldRect"),d=n.getAttribLocation(this._program,"a_texRect"),p=n.getAttribLocation(this._program,"a_opacity"),h=n.getAttribLocation(this._program,"a_rotation");return u>=0&&(n.enableVertexAttribArray(u),n.vertexAttribPointer(u,4,n.FLOAT,!1,l,0),n.vertexAttribDivisor(u,1)),d>=0&&(n.enableVertexAttribArray(d),n.vertexAttribPointer(d,4,n.FLOAT,!1,l,16),n.vertexAttribDivisor(d,1)),p>=0&&(n.enableVertexAttribArray(p),n.vertexAttribPointer(p,1,n.FLOAT,!1,l,32),n.vertexAttribDivisor(p,1)),h>=0&&(n.enableVertexAttribArray(h),n.vertexAttribPointer(h,1,n.FLOAT,!1,l,36),n.vertexAttribDivisor(h,1)),n.bindVertexArray(null),n.enable(n.BLEND),n.blendFunc(n.ONE,n.ONE_MINUS_SRC_ALPHA),this._isInitialised=!0,!0}render(e,n,s){if(!this._isInitialised||!this._gl||!this._canvas||e.length<this._elementThreshold)return;const a=this._gl;(this._canvas.width!==this._width||this._canvas.height!==this._height)&&(this._canvas.width=this._width,this._canvas.height=this._height),a.viewport(0,0,this._width,this._height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT);const l=[];for(const d of e)n.has(d.id)||l.push(d);if(l.length===0)return;this._generation++;for(const d of l)this._atlas.addOrUpdate(d,this._generation);this._atlas.isDirty&&(this._atlasTexture=yA(a,this._atlas.getCanvas(),this._atlasTexture)),this._buildInstanceData(l),a.bindBuffer(a.ARRAY_BUFFER,this._instanceVBO),a.bufferData(a.ARRAY_BUFFER,this._instanceData,a.DYNAMIC_DRAW),a.useProgram(this._program);const u=sw(s.x,s.y,s.scale,this._width,this._height);a.uniformMatrix3fv(this._viewMatrixLoc,!1,u),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._atlasTexture),a.uniform1i(this._atlasLoc,0),a.bindVertexArray(this._vao),a.drawArraysInstanced(a.TRIANGLES,0,6,this._instanceCount),a.bindVertexArray(null)}setSize(e,n){this._width=e,this._height=n}get isActive(){return this._isInitialised}get instanceCount(){return this._instanceCount}get elementThreshold(){return this._elementThreshold}invalidateElements(e){for(const n of e)this._atlas.remove(n)}invalidateAll(){this._atlas.rebuild([])}dispose(){const e=this._gl;e&&(this._program&&e.deleteProgram(this._program),this._vao&&e.deleteVertexArray(this._vao),this._quadVBO&&e.deleteBuffer(this._quadVBO),this._instanceVBO&&e.deleteBuffer(this._instanceVBO),this._atlasTexture&&e.deleteTexture(this._atlasTexture)),this._atlas.dispose(),this._isInitialised=!1,this._gl=null,this._canvas=null}_buildInstanceData(e){var u;const s=e.length*u1;this._instanceData.length<s&&(this._instanceData=new Float32Array(s));let a=0,l=0;for(const d of e){const p=this._atlas.getRegion(d.id);p&&(this._instanceData[a+0]=d.x,this._instanceData[a+1]=d.y,this._instanceData[a+2]=d.width,this._instanceData[a+3]=d.height,this._instanceData[a+4]=p.u,this._instanceData[a+5]=p.v,this._instanceData[a+6]=p.uWidth,this._instanceData[a+7]=p.vHeight,this._instanceData[a+8]=((u=d.style)==null?void 0:u.opacity)??1,this._instanceData[a+9]=(d.rotation??0)*Math.PI/180,a+=u1,l++)}this._instanceCount=l}}function mA(t,e,n,s,a={}){const{enabled:l=!1,rasterFn:u,elementThreshold:d}=a,p=te.useRef(null),h=te.useRef(null),y=te.useRef(!1);te.useEffect(()=>{var w;if(!l){(w=p.current)==null||w.dispose(),p.current=null,y.current=!1;return}return p.current=new aw({rasterFn:u,elementThreshold:d}),()=>{var C;(C=p.current)==null||C.dispose(),p.current=null,y.current=!1}},[l,u,d]);const _=te.useCallback(w=>{h.current=w,w&&p.current&&(y.current=p.current.init(w))},[]);te.useEffect(()=>{var w;(w=p.current)==null||w.setSize(s.width,s.height)},[s.width,s.height]),te.useEffect(()=>{!p.current||!y.current||p.current.render(t,e,n)});const S=te.useCallback(w=>{var C;(C=p.current)==null||C.invalidateElements(w)},[]),x=te.useCallback(()=>{var w;(w=p.current)==null||w.invalidateAll()},[]);return te.useMemo(()=>{var w;return{webglCanvasRef:_,isActive:y.current,invalidateElements:S,invalidateAll:x,instanceCount:((w=p.current)==null?void 0:w.instanceCount)??0}},[_,S,x])}me.ARROWHEAD_TYPES=Mm,me.CURVE_RATIO=ma,me.CollaborationManager=nA,me.CursorOverlay=P3,me.DEFAULT_ANIMATION_DURATION=Y5,me.DEFAULT_STYLE=$p,me.DEFAULT_THEME=bx,me.ELEMENT_TYPE_MAP=U3,me.ExportWorkerManager=xx,me.FILL_COLORS=y5,me.FlowCanvas=F3,me.LINE_TYPES=m5,me.OperationLog=$D,me.ROUGHNESS_CONFIGS=v5,me.STROKE_COLORS=g5,me.STROKE_WIDTHS=qE,me.STYLE_FIELDS=n0,me.SYNC_FIELDS=i1,me.SpatialIndex=tv,me.SpatialSoA=B3,me.SyncWorkerAdapter=rA,me.TILE_SIZE=kh,me.TOOLS=km,me.TextureAtlas=rw,me.TileCache=J3,me.TileRenderer=tw,me.WebGLHybridRenderer=aw,me.ZOOM_STEPS=Qf,me.aabbOverlaps=z5,me.addBoundElement=I5,me.animateViewport=Zl,me.applyOperation=Q3,me.arrowheadSize=Wm,me.batchElementUpdates=DC,me.buildElementMap=kC,me.buildViewMatrix=sw,me.cancelViewportAnimation=$l,me.clearElbowRouteCache=yC,me.clipboardHasImage=VC,me.cloneElementsForHistory=MC,me.compareFractionalKeys=ZD,me.computeCurveControlPoint=va,me.computeEfficientZoom=mx,me.computeElbowPoints=jf,me.computeElbowRoute=M5,me.computeFixedPoint=P5,me.computeImageElementDimensions=Q5,me.computeZoomToFit=Im,me.createCollaborationProvider=x3,me.createImageElement=lg,me.cullToViewport=H5,me.curveArrowPrev=zm,me.destroyCollaborationProvider=e0,me.detectOperations=tA,me.directionFromEdgePoint=ZE,me.directionFromFixedPoint=Dm,me.directionFromPoints=Yf,me.directionFromShapeToPoint=Am,me.discreteZoom=Z3,me.disposeElbowWorkerManager=ax,me.disposeExportWorkerManager=wx,me.distance=LC,me.downloadJSON=D7,me.downloadPNG=M7,me.downloadSVG=G7,me.drawArrowhead=oo,me.elementToSpatialItem=ev,me.elementToYMap=Th,me.exportToDataURL=fx,me.exportToJSON=hx,me.exportToSVG=uu,me.extractImageDataFromClipboard=Ym,me.fileToDataURL=og,me.findConnectorsForElement=qf,me.findNearestSnapTarget=Kl,me.flatToPoints=ug,me.generateId=_s,me.generateKeyBetween=l1,me.generateNKeysBetween=c1,me.getAnchorPosition=vC,me.getConnectionPoints=L5,me.getDiamondPoints=Zf,me.getEdgePoint=nl,me.getEdgePointFromFixedPoint=tl,me.getElbowPreferredDirection=ng,me.getElbowWorkerManager=jm,me.getElementAABB=Kf,me.getElementTiles=sA,me.getElementsBounds=Om,me.getExportWorkerManager=lT,me.getImageFilesFromDataTransfer=Vm,me.getNextZoomStep=j5,me.getPrevZoomStep=W5,me.getRemoteAwareness=C3,me.getSharedSpatialIndex=eT,me.getSharedSpatialSoA=WD,me.getStrokeDash=Jr,me.getToolHandler=eh,me.getVisibleBounds=B5,me.getVisibleTiles=$3,me.getYDoc=w3,me.getYElements=b3,me.getYProvider=r1,me.isCollaborationActive=PD,me.isConnectable=Pm,me.isPointInRect=NC,me.isValidFractionalIndex=JD,me.loadImage=$f,me.normalizeRect=Um,me.onStatusChange=E3,me.opAdd=H3,me.opBatch=eA,me.opDelete=G3,me.opMove=V3,me.opReorder=X3,me.opResize=Y3,me.opRotate=W3,me.opSetText=K3,me.opStyle=j3,me.opUpdatePoints=q3,me.openImageFilePicker=Z5,me.quadBezierAt=ou,me.quadBezierTangent=Bm,me.rafThrottle=G5,me.recomputeBoundPoints=Ql,me.removeBoundElement=F5,me.resolveImageSource=J5,me.rotatePoint=X5,me.scheduleIdleWork=_x,me.simplifyElbowPath=Wf,me.startSync=T3,me.stopSync=s0,me.syncBoundElements=Jl,me.tileBounds=ew,me.tileKey=Ru,me.updateAwareness=t0,me.useCanvasStore=De,me.useCollaboration=k3,me.useEfficientZoom=vx,me.useProgressiveRender=Sx,me.useTileRenderer=oA,me.useWebGLHybrid=mA,me.worldTileSize=Lu,me.yMapToElement=fc,me.yieldToMain=sT,me.zoomAtPoint=sg,Object.defineProperty(me,Symbol.toStringTag,{value:"Module"})}));
|