import{o as e,r as t,t as n}from"./chunk-QXcFz7f5.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,t as u}from"./app-G6wC4CCm.js";import{t as d}from"./createLucideIcon-DKE3u1f2.js";import{i as f,r as p,t as m}from"./AppNav-TQ3fvEZa.js";import{t as h}from"./arrow-right-C0IvZSef.js";import{f as g,g as _,h as v,l as y,p as b,s as x,t as S,u as C,v as w,w as T,x as E,y as D}from"./ui-D0zPIw82.js";import{a as O}from"./GatewayPickerModal-D-FxceyY.js";import{t as k}from"./copy-BcjgTU3g.js";import{t as A}from"./ellipsis-B99XHEUD.js";import{t as j}from"./loader-circle-DtuHVunH.js";import{n as ee,t as M}from"./trophy-B73e8tNE.js";import{t as N}from"./sparkles-C1x2POjC.js";import{t as P}from"./monitor-iNdjuQ09.js";import{t as F}from"./package-u14HhJRp.js";import{t as I}from"./pencil-C7-Ep6cQ.js";import{t as te}from"./plus-xTFuPZ0N.js";import{t as ne}from"./quote-BGrE3ynE.js";import{t as re}from"./smartphone-Chj8vB8M.js";import{t as ie}from"./star-BXEtusbh.js";import{t as ae}from"./upload-D3GlBCf_.js";import{t as oe}from"./user-plus-BkXglq3-.js";import{t as se}from"./PremiumKitGateModal-DkNQ9nEj.js";import{a as ce,f as le,g as ue,h as de,p as fe,s as pe}from"./fonts-BFxTwZ_G.js";import{a as L,c as me,d as he,i as ge,l as _e,n as ve,o as ye,r as be,t as xe,u as R}from"./textFit-Cp_uWn6z.js";import{t as Se}from"./SeatOverLimitBanner-o4tLrRUb.js";import{n as Ce}from"./ProjectMembers-CE5Yq64V.js";var we=d(`medal`,[[`path`,{d:`M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15`,key:`143lza`}],[`path`,{d:`M11 12 5.12 2.2`,key:`qhuxz6`}],[`path`,{d:`m13 12 5.88-9.8`,key:`hbye0f`}],[`path`,{d:`M8 7h8`,key:`i86dvs`}],[`circle`,{cx:`12`,cy:`17`,r:`5`,key:`qbz8iq`}],[`path`,{d:`M12 18v-2h-.5`,key:`fawc4q`}]]),Te=d(`rectangle-horizontal`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`2`,key:`9lu3g6`}]]),Ee=d(`rectangle-vertical`,[[`rect`,{width:`12`,height:`20`,x:`6`,y:`2`,rx:`2`,key:`1oxtiu`}]]),De=d(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),z=e(i()),B=u(),Oe=Math.PI/180;function ke(){return typeof window<`u`&&({}.toString.call(window)===`[object Window]`||{}.toString.call(window)===`[object global]`)}var Ae=typeof global<`u`?global:typeof window<`u`?window:typeof WorkerGlobalScope<`u`?self:{},V={_global:Ae,version:`10.2.5`,isBrowser:ke(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return V.angleDeg?e*Oe:e},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,_renderBackend:`web`,legacyTextRendering:!1,pixelRatio:typeof window<`u`&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return V.DD.isDragging},isTransforming(){return V.Transformer?.isTransforming()??!1},isDragReady(){return!!V.DD.node},releaseCanvasOnDestroy:!0,document:Ae.document,_injectGlobal(e){Ae.Konva!==void 0&&console.error(`Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.`),Ae.Konva=e}},je=e=>{V[e.prototype.getClassName()]=e};V._injectGlobal(V);var Me=`Konva.js unsupported environment.

Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.

To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.

bash: npm install canvas
js: import "konva/canvas-backend";

or

bash: npm install skia-canvas
js: import "konva/skia-backend";
`,Ne=()=>{if(typeof document>`u`)throw Error(Me)},Pe=class e{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.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 e(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){let t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,i=this.m[1]*t+this.m[3]*n,a=this.m[0]*-n+this.m[2]*t,o=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=o,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){let n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,i=this.m[2]+this.m[0]*e,a=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this}multiply(e){let t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],i=this.m[1]*e.m[2]+this.m[3]*e.m[3],a=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],o=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=a,this.m[5]=o,this}invert(){let e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,i=this.m[0]*e,a=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),o=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=a,this.m[5]=o,this}getMatrix(){return this.m}decompose(){let e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],i=this.m[4],a=this.m[5],o=e*r-t*n,s={x:i,y:a,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||t!=0){let i=Math.sqrt(e*e+t*t);s.rotation=t>0?Math.acos(e/i):-Math.acos(e/i),s.scaleX=i,s.scaleY=o/i,s.skewX=(e*n+t*r)/o,s.skewY=0}else if(n!=0||r!=0){let i=Math.sqrt(n*n+r*r);s.rotation=Math.PI/2-(r>0?Math.acos(-n/i):-Math.acos(n/i)),s.scaleX=o/i,s.scaleY=i,s.skewX=0,s.skewY=(e*n+t*r)/o}return s.rotation=H._getRotation(s.rotation),s}},Fe=`[object Array]`,Ie=`[object Number]`,Le=`[object String]`,Re=`[object Boolean]`,ze=Math.PI/180,Be=180/Math.PI,Ve=`#`,He=``,Ue=`0`,We=`Konva warning: `,Ge=`Konva error: `,Ke=`rgb(`,qe={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]},Je=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Ye=[],Xe=null,Ze=typeof requestAnimationFrame<`u`&&requestAnimationFrame||function(e){setTimeout(e,16)},H={_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)===Fe},_isNumber(e){return Object.prototype.toString.call(e)===Ie&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===Le},_isBoolean(e){return Object.prototype.toString.call(e)===Re},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!=`string`)return!1;let t=e[0];return t===`#`||t===`.`||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){Ye.push(e),Ye.length===1&&Ze(function(){let e=Ye;Ye=[],e.forEach(function(e){e()})})},createCanvasElement(){Ne();let e=document.createElement(`canvas`);try{e.style=e.style||{}}catch{}return e},createImageElement(){return Ne(),document.createElement(`img`)},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){let n=H.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(Ve,He);let t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);for(;e.length<6;)e=Ue+e;return Ve+e},isCanvasFarblingActive(){if(Xe!==null)return Xe;if(typeof document>`u`)return Xe=!1,!1;let e=this.createCanvasElement();e.width=10,e.height=10;let t=e.getContext(`2d`,{willReadFrequently:!0});t.clearRect(0,0,10,10),t.fillStyle=`#282828`,t.fillRect(0,0,10,10);let n=t.getImageData(0,0,10,10).data,r=!1;for(let e=0;e<100;e++)if(n[e*4]!==40||n[e*4+1]!==40||n[e*4+2]!==40||n[e*4+3]!==255){r=!0;break}return Xe=r,this.releaseCanvas(e),Xe},getHitColor(){let e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,t,n){return this.isCanvasFarblingActive()&&(e=Math.round(e/5)*5,t=Math.round(t/5)*5,n=Math.round(n/5)*5),Ve+this._rgbToHex(e,t,n)},getSnappedHexColor(e){let t=this._hexToRgb(e);return Ve+this._rgbToHex(Math.round(t.r/5)*5,Math.round(t.g/5)*5,Math.round(t.b/5)*5)},getRGB(e){let t;return e in qe?(t=qe[e],{r:t[0],g:t[1],b:t[2]}):e[0]===Ve?this._hexToRgb(e.substring(1)):e.substr(0,4)===Ke?(t=Je.exec(e.replace(/ /g,``)),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e||=`black`,H._namedColorToRBA(e)||H._hex3ColorToRGBA(e)||H._hex4ColorToRGBA(e)||H._hex6ColorToRGBA(e)||H._hex8ColorToRGBA(e)||H._rgbColorToRGBA(e)||H._rgbaColorToRGBA(e)||H._hslColorToRGBA(e)},_namedColorToRBA(e){let t=qe[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf(`rgb(`)===0){e=e.match(/rgb\(([^)]+)\)/)[1];let t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf(`rgba(`)===0){e=e.match(/rgba\(([^)]+)\)/)[1];let t=e.split(/ *, */).map((e,t)=>e.slice(-1)===`%`?t===3?parseInt(e)/100:parseInt(e)/100*255:Number(e));return{r:t[0],g:t[1],b:t[2],a:t[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)){let[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,i=Number(n[1])/100,a=Number(n[2])/100,o,s,c;if(i===0)return c=a*255,{r:Math.round(c),g:Math.round(c),b:Math.round(c),a:1};o=a<.5?a*(1+i):a+i-a*i;let l=2*a-o,u=[0,0,0];for(let e=0;e<3;e++)s=r+1/3*-(e-1),s<0&&s++,s>1&&s--,c=6*s<1?l+(o-l)*6*s:2*s<1?o:3*s<2?l+(o-l)*(2/3-s)*6:l,u[e]=c*255;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){let t={};for(let n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*ze},radToDeg(e){return e*Be},_degToRad(e){return H.warn(`Util._degToRad is removed. Please use public Util.degToRad instead.`),H.degToRad(e)},_radToDeg(e){return H.warn(`Util._radToDeg is removed. Please use public Util.radToDeg instead.`),H.radToDeg(e)},_getRotation(e){return V.angleDeg?H.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw Error(Ge+e)},error(e){console.error(Ge+e)},warn(e){V.showWarnings&&console.warn(We+e)},each(e,t){for(let n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,i,a){let o,s,c,l=(e-n)*(e-n)+(t-r)*(t-r);if(l==0)o=e,s=t,c=(i-n)*(i-n)+(a-r)*(a-r);else{let u=((i-e)*(n-e)+(a-t)*(r-t))/l;u<0?(o=e,s=t,c=(e-i)*(e-i)+(t-a)*(t-a)):u>1?(o=n,s=r,c=(n-i)*(n-i)+(r-a)*(r-a)):(o=e+u*(n-e),s=t+u*(r-t),c=(o-i)*(o-i)+(s-a)*(s-a))}return[o,s,c]},_getProjectionToLine(e,t,n){let r=H.cloneObject(e),i=Number.MAX_VALUE;return t.forEach(function(a,o){if(!n&&o===t.length-1)return;let s=t[(o+1)%t.length],c=H._getProjectionToSegment(a.x,a.y,s.x,s.y,e.x,e.y),l=c[0],u=c[1],d=c[2];d<i&&(r.x=l,r.y=u,i=d)}),r},_prepareArrayForTween(e,t,n){let r=[],i=[];if(e.length>t.length){let n=t;t=e,e=n}for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});for(let e=0;e<t.length;e+=2)i.push({x:t[e],y:t[e+1]});let a=[];return i.forEach(function(e){let t=H._getProjectionToLine(e,r,n);a.push(t.x),a.push(t.y)}),a},_prepareToStringify(e){let t;e.visitedByCircularReferenceRemoval=!0;for(let n in e)if(e.hasOwnProperty(n)&&e[n]&&typeof e[n]==`object`){if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||H._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(H._prepareToStringify(e[n])===null)if(t.configurable)delete e[n];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(let n in t)e[n]=t[n];return e},_getFirstPointerId(e){return e.touches?e.changedTouches[0].identifier:e.pointerId||999},releaseCanvas(...e){V.releaseCanvasOnDestroy&&e.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(e,t,n,r){let i=t<0?t:0,a=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let o=0,s=0,c=0,l=0;typeof r==`number`?o=s=c=l=Math.min(r,t/2,n/2):(o=Math.min(r[0]||0,t/2,n/2),s=Math.min(r[1]||0,t/2,n/2),l=Math.min(r[2]||0,t/2,n/2),c=Math.min(r[3]||0,t/2,n/2)),e.moveTo(i+o,a),e.lineTo(i+t-s,a),e.arc(i+t-s,a+s,s,Math.PI*3/2,0,!1),e.lineTo(i+t,a+n-l),e.arc(i+t-l,a+n-l,l,0,Math.PI/2,!1),e.lineTo(i+c,a+n),e.arc(i+c,a+n-c,c,Math.PI/2,Math.PI,!1),e.lineTo(i,a+o),e.arc(i+o,a+o,o,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,i){r=Math.abs(r);for(let a=0;a<n;a++){let o=t[(a-1+n)%n],s=t[a],c=t[(a+1)%n],l={x:s.x-o.x,y:s.y-o.y},u={x:c.x-s.x,y:c.y-s.y},d=Math.hypot(l.x,l.y),f=Math.hypot(u.x,u.y),p;p=typeof i==`number`?i:a<i.length?i[a]:0,p=r*Math.cos(Math.PI/n)*Math.min(1,p/r*2);let m={x:l.x/d,y:l.y/d},h={x:u.x/f,y:u.y/f},g={x:s.x-m.x*p,y:s.y-m.y*p},_={x:s.x+h.x*p,y:s.y+h.y*p};a===0?e.moveTo(g.x,g.y):e.lineTo(g.x,g.y),e.arcTo(s.x,s.y,_.x,_.y,p)}}};function Qe(e){let t=[],n=e.length,r=H;for(let i=0;i<n;i++){let n=e[i];r._isNumber(n)?n=Math.round(n*1e3)/1e3:r._isString(n)||(n+=``),t.push(n)}return t}var $e=`,`,et=`(`,tt=`)`,nt=`([`,rt=`])`,it=`;`,at=`()`,ot=`=`,st=`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`.split(`.`),ct=[`fillStyle`,`strokeStyle`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`,`letterSpacing`,`lineCap`,`lineDashOffset`,`lineJoin`,`lineWidth`,`miterLimit`,`direction`,`font`,`textAlign`,`textBaseline`,`globalAlpha`,`globalCompositeOperation`,`imageSmoothingEnabled`,`filter`],lt=100,ut=null;function dt(){if(ut!==null)return ut;try{let e=H.createCanvasElement().getContext(`2d`);return e?!!e&&`filter`in e:(ut=!1,!1)}catch{return ut=!1,!1}}var ft=class{constructor(e){this.canvas=e,V.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n=this.traceArr,r=n.length,i=``,a,o,s,c;for(a=0;a<r;a++)o=n[a],s=o.method,s?(c=o.args,i+=s,e?i+=at:H._isArray(c[0])?i+=nt+c.join($e)+rt:(t&&(c=c.map(e=>typeof e==`number`?Math.floor(e):e)),i+=et+c.join($e)+tt)):(i+=o.property,e||(i+=ot+o.val)),i+=it;return i}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=lt&&t.shift()}reset(){let e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){let t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){let t=e.attrs.lineCap;t&&this.setAttr(`lineCap`,t)}_applyOpacity(e){let t=e.getAbsoluteOpacity();t!==1&&this.setAttr(`globalAlpha`,t)}_applyLineJoin(e){let t=e.attrs.lineJoin;t&&this.setAttr(`lineJoin`,t)}_applyMiterLimit(e){let t=e.attrs.miterLimit;t!=null&&this.setAttr(`miterLimit`,t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,i,a){this._context.arc(e,t,n,r,i,a)}arcTo(e,t,n,r,i){this._context.arcTo(e,t,n,r,i)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,i,a){this._context.bezierCurveTo(e,t,n,r,i,a)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){let n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,i,a){return this._context.createRadialGradient(e,t,n,r,i,a)}drawImage(e,t,n,r,i,a,o,s,c){let l=arguments,u=this._context;l.length===3?u.drawImage(e,t,n):l.length===5?u.drawImage(e,t,n,r,i):l.length===9&&u.drawImage(e,t,n,r,i,a,o,s,c)}ellipse(e,t,n,r,i,a,o,s){this._context.ellipse(e,t,n,r,i,a,o,s)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,i){this._context.roundRect(e,t,n,r,i)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):`mozDash`in this._context?this._context.mozDash=e:`webkitLineDash`in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,i,a){this._context.setTransform(e,t,n,r,i,a)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,i,a){this._context.transform(e,t,n,r,i,a)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=st.length,n=this.setAttr,r,i,a=function(t){let n=e[t],r;e[t]=function(){return i=Qe(Array.prototype.slice.call(arguments,0)),r=n.apply(e,arguments),e._trace({method:t,args:i}),r}};for(r=0;r<t;r++)a(st[r]);e.setAttr=function(){n.apply(e,arguments);let t=arguments[0],r=arguments[1];(t===`shadowOffsetX`||t===`shadowOffsetY`||t===`shadowBlur`)&&(r/=this.canvas.getPixelRatio()),e._trace({property:t,val:r})}}_applyGlobalCompositeOperation(e){let t=e.attrs.globalCompositeOperation;!t||t===`source-over`||this.setAttr(`globalCompositeOperation`,t)}};ct.forEach(function(e){Object.defineProperty(ft.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var pt=class extends ft{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext(`2d`,{willReadFrequently:t})}_fillColor(e){let t=e.fill();this.setAttr(`fillStyle`,t),e._fillFunc(this)}_fillPattern(e){this.setAttr(`fillStyle`,e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){let t=e._getLinearGradient();t&&(this.setAttr(`fillStyle`,t),e._fillFunc(this))}_fillRadialGradient(e){let t=e._getRadialGradient();t&&(this.setAttr(`fillStyle`,t),e._fillFunc(this))}_fill(e){let t=e.fill(),n=e.getFillPriority();if(t&&n===`color`){this._fillColor(e);return}let r=e.getFillPatternImage();if(r&&n===`pattern`){this._fillPattern(e);return}let i=e.getFillLinearGradientColorStops();if(i&&n===`linear-gradient`){this._fillLinearGradient(e);return}let a=e.getFillRadialGradientColorStops();if(a&&n===`radial-gradient`){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):i?this._fillLinearGradient(e):a&&this._fillRadialGradient(e)}_strokeLinearGradient(e){let t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),i=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let e=0;e<r.length;e+=2)i.addColorStop(r[e],r[e+1]);this.setAttr(`strokeStyle`,i)}}_stroke(e){let t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();let e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr(`lineDashOffset`,e.dashOffset())),this.setAttr(`lineWidth`,e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr(`shadowColor`,`rgba(0,0,0,0)`),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr(`strokeStyle`,e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){let t=e.getShadowRGBA()??`black`,n=e.getShadowBlur()??5,r=e.getShadowOffset()??{x:0,y:0},i=e.getAbsoluteScale(),a=this.canvas.getPixelRatio(),o=i.x*a,s=i.y*a;this.setAttr(`shadowColor`,t),this.setAttr(`shadowBlur`,n*Math.min(Math.abs(o),Math.abs(s))),this.setAttr(`shadowOffsetX`,r.x*o),this.setAttr(`shadowOffsetY`,r.y*s)}},mt=class extends ft{constructor(e){super(e),this._context=e._canvas.getContext(`2d`,{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr(`fillStyle`,e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){let t=e.getStrokeScaleEnabled();if(!t){this.save();let e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(e);let n=e.hitStrokeWidth(),r=n===`auto`?e.strokeWidth():n;this.setAttr(`lineWidth`,r),this.setAttr(`strokeStyle`,e.colorKey),e._strokeFuncHit(this),t||this.restore()}}},ht;function gt(){if(ht)return ht;let e=H.createCanvasElement(),t=e.getContext(`2d`);return ht=(function(){return(V._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),H.releaseCanvas(e),ht}var _t=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;let t=(e||{}).pixelRatio||V.pixelRatio||gt();this.pixelRatio=t,this._canvas=H.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(e){let t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+`px`;let t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+`px`;let t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch{try{return this._canvas.toDataURL()}catch(e){return H.error(`Unable to get data URL. `+e.message+` For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.`),``}}}},vt=class extends _t{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new pt(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},yt=class extends _t{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new mt(this),this.setSize(e.width,e.height)}},bt={get isDragging(){let e=!1;return bt._dragElements.forEach(t=>{t.dragStatus===`dragging`&&(e=!0)}),e},justDragged:!1,get node(){let e;return bt._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){let t=[];bt._dragElements.forEach((n,r)=>{let{node:i}=n,a=i.getStage();a.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=H._getFirstPointerId(e));let o=a._changedPointerPositions.find(e=>e.id===n.pointerId);if(o){if(n.dragStatus!==`dragging`){let t=i.dragDistance();if(Math.max(Math.abs(o.x-n.startPointerPos.x),Math.abs(o.y-n.startPointerPos.y))<t||(i.startDrag({evt:e}),!i.isDragging()))return}i._setDragPosition(e,n),t.push(i)}}),t.forEach(t=>{t.getStage()&&t.fire(`dragmove`,{type:`dragmove`,target:t,evt:e},!0)})},_endDragBefore(e){let t=[];bt._dragElements.forEach(n=>{let{node:r}=n,i=r.getStage();if(e&&i.setPointersPositions(e),!i._changedPointerPositions.find(e=>e.id===n.pointerId))return;(n.dragStatus===`dragging`||n.dragStatus===`stopped`)&&(bt.justDragged=!0,V._mouseListenClick=!1,V._touchListenClick=!1,V._pointerListenClick=!1,n.dragStatus=`stopped`);let a=n.node.getLayer()||n.node instanceof V.Stage&&n.node;a&&t.indexOf(a)===-1&&t.push(a)}),t.forEach(e=>{e.draw()})},_endDragAfter(e){bt._dragElements.forEach((t,n)=>{t.dragStatus===`stopped`&&t.node.fire(`dragend`,{type:`dragend`,target:t.node,evt:e},!0),t.dragStatus!==`dragging`&&bt._dragElements.delete(n)})}};V.isBrowser&&(window.addEventListener(`mouseup`,bt._endDragBefore,!0),window.addEventListener(`touchend`,bt._endDragBefore,!0),window.addEventListener(`touchcancel`,bt._endDragBefore,!0),window.addEventListener(`mousemove`,bt._drag),window.addEventListener(`touchmove`,bt._drag),window.addEventListener(`mouseup`,bt._endDragAfter,!1),window.addEventListener(`touchend`,bt._endDragAfter,!1),window.addEventListener(`touchcancel`,bt._endDragAfter,!1));function xt(e){return H._isString(e)?`"`+e+`"`:Object.prototype.toString.call(e)===`[object Number]`||H._isBoolean(e)?e:Object.prototype.toString.call(e)}function St(e){return e>255?255:e<0?0:Math.round(e)}function U(){if(V.isUnminified)return function(e,t){return H._isNumber(e)||H.warn(xt(e)+` is a not valid value for "`+t+`" attribute. The value should be a number.`),e}}function Ct(e){if(V.isUnminified)return function(t,n){let r=H._isNumber(t),i=H._isArray(t)&&t.length==e;return!r&&!i&&H.warn(xt(t)+` is a not valid value for "`+n+`" attribute. The value should be a number or Array<number>(`+e+`)`),t}}function wt(){if(V.isUnminified)return function(e,t){return H._isNumber(e)||e===`auto`||H.warn(xt(e)+` is a not valid value for "`+t+`" attribute. The value should be a number or "auto".`),e}}function Tt(){if(V.isUnminified)return function(e,t){return H._isString(e)||H.warn(xt(e)+` is a not valid value for "`+t+`" attribute. The value should be a string.`),e}}function Et(){if(V.isUnminified)return function(e,t){let n=H._isString(e),r=Object.prototype.toString.call(e)===`[object CanvasGradient]`||e&&e.addColorStop;return n||r||H.warn(xt(e)+` is a not valid value for "`+t+`" attribute. The value should be a string or a native gradient.`),e}}function Dt(){if(V.isUnminified)return function(e,t){let n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(H._isArray(e)?e.forEach(function(e){H._isNumber(e)||H.warn(`"`+t+`" attribute has non numeric element `+e+`. Make sure that all elements are numbers.`)}):H.warn(xt(e)+` is a not valid value for "`+t+`" attribute. The value should be a array of numbers.`)),e}}function Ot(){if(V.isUnminified)return function(e,t){return e===!0||e===!1||H.warn(xt(e)+` is a not valid value for "`+t+`" attribute. The value should be a boolean.`),e}}function kt(e){if(V.isUnminified)return function(t,n){return t==null||H.isObject(t)||H.warn(xt(t)+` is a not valid value for "`+n+`" attribute. The value should be an object with properties `+e),t}}var At=`get`,jt=`set`,W={addGetterSetter(e,t,n,r,i){W.addGetter(e,t,n),W.addSetter(e,t,r,i),W.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){let r=At+H._capitalize(t);e.prototype[r]=e.prototype[r]||function(){let e=this.attrs[t];return e===void 0?n:e}},addSetter(e,t,n,r){let i=jt+H._capitalize(t);e.prototype[i]||W.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){let i=jt+H._capitalize(t);e.prototype[i]=function(e){return n&&e!=null&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,i){let a=n.length,o=H._capitalize,s=At+o(t),c=jt+o(t);e.prototype[s]=function(){let e={};for(let r=0;r<a;r++){let i=n[r];e[i]=this.getAttr(t+o(i))}return e};let l=kt(n);e.prototype[c]=function(e){let a=this.attrs[t];r&&(e=r.call(this,e,t)),l&&l.call(this,e,t);for(let n in e)e.hasOwnProperty(n)&&this._setAttr(t+o(n),e[n]);return e||n.forEach(e=>{this._setAttr(t+o(e),void 0)}),this._fireChangeEvent(t,a,e),i&&i.call(this),this},W.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){let n=H._capitalize(t),r=jt+n,i=At+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(e,t,n,r){H.error(`Adding deprecated `+t);let i=At+H._capitalize(t),a=t+` property is deprecated and will be removed soon. Look at Konva change log for more information.`;e.prototype[i]=function(){H.error(a);let e=this.attrs[t];return e===void 0?n:e},W.addSetter(e,t,r,function(){H.error(a)}),W.addOverloadedGetterSetter(e,t)},backCompat(e,t){H.each(t,function(t,n){let r=e.prototype[n],i=At+H._capitalize(t),a=jt+H._capitalize(t);function o(){r.apply(this,arguments),H.error(`"`+t+`" method is deprecated and will be removed soon. Use ""`+n+`" instead.`)}e.prototype[t]=o,e.prototype[i]=o,e.prototype[a]=o})},afterSetFilter(){this._filterUpToDate=!1}};function Mt(e){let t=/(\w+)\(([^)]+)\)/g,n;for(;(n=t.exec(e))!==null;){let[,e,t]=n;switch(e){case`blur`:{let e=parseFloat(t.replace(`px`,``));return function(t){this.blurRadius(e*.5);let n=V.Filters;n&&n.Blur&&n.Blur.call(this,t)}}case`brightness`:{let e=t.includes(`%`)?parseFloat(t)/100:parseFloat(t);return function(t){this.brightness(e);let n=V.Filters;n&&n.Brightness&&n.Brightness.call(this,t)}}case`contrast`:{let e=parseFloat(t);return function(t){let n=100*(Math.sqrt(e)-1);this.contrast(n);let r=V.Filters;r&&r.Contrast&&r.Contrast.call(this,t)}}case`grayscale`:return function(e){let t=V.Filters;t&&t.Grayscale&&t.Grayscale.call(this,e)};case`sepia`:return function(e){let t=V.Filters;t&&t.Sepia&&t.Sepia.call(this,e)};case`invert`:return function(e){let t=V.Filters;t&&t.Invert&&t.Invert.call(this,e)};default:H.warn(`CSS filter "${e}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Nt=`absoluteOpacity`,Pt=`allEventListeners`,Ft=`absoluteTransform`,It=`absoluteScale`,Lt=`canvas`,Rt=`Change`,zt=`children`,Bt=`konva`,Vt=`listening`,Ht=`mouseenter`,Ut=`mouseleave`,Wt=`pointerenter`,Gt=`pointerleave`,Kt=`touchenter`,qt=`touchleave`,Jt=`set`,Yt=`Shape`,Xt=` `,Zt=`stage`,Qt=`transform`,$t=`Stage`,en=`visible`,tn=[`xChange.konva`,`yChange.konva`,`scaleXChange.konva`,`scaleYChange.konva`,`skewXChange.konva`,`skewYChange.konva`,`rotationChange.konva`,`offsetXChange.konva`,`offsetYChange.konva`,`transformsEnabledChange.konva`].join(Xt),nn=1,G=class e{constructor(e){this._id=nn++,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(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===Qt||e===Ft)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,t){let n=this._cache.get(e);return(n===void 0||(e===Qt||e===Ft)&&n.dirty===!0)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){let n=t.map(e=>e+`Change.konva`).join(Xt);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(Lt)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ft&&this.fire(`absoluteTransformChange`)}clearCache(){if(this._cache.has(Lt)){let{scene:e,filter:t,hit:n}=this._cache.get(Lt);H.releaseCanvas(e._canvas,t._canvas,n._canvas),this._cache.delete(Lt)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){let t=e||{},n={};(t.x===void 0||t.y===void 0||t.width===void 0||t.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let r=Math.ceil(t.width||n.width),i=Math.ceil(t.height||n.height),a=t.pixelRatio,o=t.x===void 0?Math.floor(n.x):t.x,s=t.y===void 0?Math.floor(n.y):t.y,c=t.offset||0,l=t.drawBorder||!1,u=t.hitCanvasPixelRatio||1;if(!r||!i){H.error(`Can not cache the node. Width or height of the node equals 0. Caching is skipped.`);return}let d=+(Math.abs(Math.round(n.x)-o)>.5),f=+(Math.abs(Math.round(n.y)-s)>.5);r+=c*2+d,i+=c*2+f,o-=c,s-=c;let p=new vt({pixelRatio:a,width:r,height:i}),m=new vt({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),h=new yt({pixelRatio:u,width:r,height:i}),g=p.getContext(),_=h.getContext(),v=new vt({width:p.width/p.pixelRatio+Math.abs(o),height:p.height/p.pixelRatio+Math.abs(s),pixelRatio:p.pixelRatio}),y=v.getContext();return h.isCache=!0,p.isCache=!0,this._cache.delete(Lt),this._filterUpToDate=!1,t.imageSmoothingEnabled===!1&&(p.getContext()._context.imageSmoothingEnabled=!1,m.getContext()._context.imageSmoothingEnabled=!1),g.save(),_.save(),y.save(),g.translate(-o,-s),_.translate(-o,-s),y.translate(-o,-s),v.x=o,v.y=s,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Nt),this._clearSelfAndDescendantCache(It),this.drawScene(p,this,v),this.drawHit(h,this),this._isUnderCache=!1,g.restore(),_.restore(),l&&(g.save(),g.beginPath(),g.rect(0,0,r,i),g.closePath(),g.setAttr(`strokeStyle`,`red`),g.setAttr(`lineWidth`,5),g.stroke(),g.restore()),H.releaseCanvas(v._canvas),this._cache.set(Lt,{scene:p,filter:m,hit:h,x:o,y:s}),this._requestDraw(),this}isCached(){return this._cache.has(Lt)}getClientRect(e){throw Error(`abstract "getClientRect" method call`)}_transformedRect(e,t){let n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],r=1/0,i=1/0,a=-1/0,o=-1/0,s=this.getAbsoluteTransform(t);return n.forEach(function(e){let t=s.point(e);r===void 0&&(r=a=t.x,i=o=t.y),r=Math.min(r,t.x),i=Math.min(i,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y)}),{x:r,y:i,width:a-r,height:o-i}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);let t=this._getCanvasCache();e.translate(t.x,t.y);let n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){let t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),t=this._getCanvasCache(),n=t.scene,r=t.filter,i=r.getContext(),a,o,s,c;if(!e||e.length===0)return n;if(this._filterUpToDate)return r;let l=!0;for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&dt(),typeof e[t]!=`string`||!dt()){l=!1;break}let u=n.pixelRatio;if(r.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio),l){let t=e.join(` `);return i.save(),i.setAttr(`filter`,t),i.drawImage(n._canvas,0,0,n.getWidth()/u,n.getHeight()/u),i.restore(),this._filterUpToDate=!0,r}try{for(a=e.length,i.clear(),i.drawImage(n._canvas,0,0,n.getWidth()/u,n.getHeight()/u),o=i.getImageData(0,0,r.getWidth(),r.getHeight()),s=0;s<a;s++)c=e[s],typeof c==`string`&&(c=Mt(c)),c.call(this,o),i.putImageData(o,0,0)}catch(e){H.error(`Unable to apply filter. `+e.message+` This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.`)}return this._filterUpToDate=!0,r}on(...e){let t=e[0],n=e[1];if(e[2],this._cache&&this._cache.delete(Pt),e.length===3)return this._delegate.apply(this,e);let r=t.split(Xt);for(let e=0;e<r.length;e++){let t=r[e].split(`.`),i=t[0],a=t[1]||``;this.eventListeners[i]||(this.eventListeners[i]=[]),this.eventListeners[i].push({name:a,handler:n})}return this}off(e,t){let n=(e||``).split(Xt),r=n.length,i,a,o,s,c,l;if(this._cache&&this._cache.delete(Pt),!e)for(a in this.eventListeners)this._off(a);for(i=0;i<r;i++)if(o=n[i],s=o.split(`.`),c=s[0],l=s[1],c)this.eventListeners[c]&&this._off(c,l,t);else for(a in this.eventListeners)this._off(a,l,t);return this}dispatchEvent(e){let t={target:this,type:e.type,evt:e};return this.fire(e.type,t),this}addEventListener(e,t){return this.on(e,function(e){t.call(this,e.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,t,n){let r=this;return this.on(e,function(e){let i=e.target.findAncestors(t,!0,r);for(let t=0;t<i.length;t++)e=H.cloneObject(e),e.currentTarget=i[t],n.call(i[t],e)}),this}remove(){return this.isDragging()&&this.stopDrag(),bt._dragElements.delete(this._id),bt._dragElements.forEach((e,t)=>{this.isAncestorOf(e.node)&&bt._dragElements.delete(t)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Ft),this._clearSelfAndDescendantCache(Nt),this._clearSelfAndDescendantCache(It),this._clearSelfAndDescendantCache(Zt),this._clearSelfAndDescendantCache(en),this._clearSelfAndDescendantCache(Vt)}_remove(){this._clearCaches();let e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){let t=`get`+H._capitalize(e);return H._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){let e=this.getParent(),t=[];for(;e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let t,n;if(!e)return this;for(t in e)t!==zt&&(n=Jt+H._capitalize(t),H._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))}),this}isListening(){return this._getCache(Vt,this._isListening)}_isListening(e){if(!this.listening())return!1;let t=this.getParent();return t&&t!==e&&this!==e?t._isListening(e):!0}isVisible(){return this._getCache(en,this._isVisible)}_isVisible(e){if(!this.visible())return!1;let t=this.getParent();return t&&t!==e&&this!==e?t._isVisible(e):!0}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);let n=this.getLayer(),r=!1;bt._dragElements.forEach(e=>{e.dragStatus===`dragging`&&(e.node.nodeType===`Stage`||e.node.getLayer()===n)&&(r=!0)});let i=!t&&!V.hitOnDragEnabled&&(r||V.isTransforming());return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),t=this,n=0,r,i,a,o;function s(c){for(r=[],i=c.length,a=0;a<i;a++)o=c[a],n++,o.nodeType!==Yt&&(r=r.concat(o.getChildren().slice())),o._id===t._id&&(a=i);r.length>0&&r[0].getDepth()<=e&&s(r)}let c=this.getStage();return t.nodeType!==$t&&c&&s(c.getChildren()),n}getDepth(){let e=0,t=this.parent;for(;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Qt),this._clearSelfAndDescendantCache(Ft)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){let e=this.getStage();if(!e)return null;let t=e.getPointerPosition();if(!t)return null;let n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);let r=this.getAbsoluteTransform(e).getMatrix(),i=new Pe,a=this.offset();return i.m=r.slice(),i.translate(a.x,a.y),i.getTranslation()}setAbsolutePosition(e){let{x:t,y:n,...r}=this._clearTransform();this.attrs.x=t,this.attrs.y=n,this._clearCache(Qt);let i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(e.x,e.y),e={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(r),this.setPosition({x:e.x,y:e.y}),this._clearCache(Qt),this._clearSelfAndDescendantCache(Ft),this}_setTransform(e){let t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){let e={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,e}move(e){let t=e.x,n=e.y,r=this.x(),i=this.y();return t!==void 0&&(r+=t),n!==void 0&&(i+=n),this.setPosition({x:r,y:i}),this}_eachAncestorReverse(e,t){let n=[],r=this.getParent(),i,a;if(!(t&&t._id===this._id)){for(n.unshift(this);r&&(!t||r._id!==t._id);)n.unshift(r),r=r.parent;for(i=n.length,a=0;a<i;a++)e(n[a])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return H.warn(`Node has no parent. moveToTop function is ignored.`),!1;let e=this.index;return e<this.parent.getChildren().length-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return H.warn(`Node has no parent. moveUp function is ignored.`),!1;let e=this.index;return e<this.parent.getChildren().length-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return H.warn(`Node has no parent. moveDown function is ignored.`),!1;let e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return H.warn(`Node has no parent. moveToBottom function is ignored.`),!1;let e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return H.warn(`Node has no parent. zIndex parameter is ignored.`),this;(e<0||e>=this.parent.children.length)&&H.warn(`Unexpected value `+e+` 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)+`.`);let t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Nt,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),t,n,r,i,a,o={attrs:{},className:this.getClassName()};for(t in e)n=e[t],a=H.isObject(n)&&!H._isPlainObject(n)&&!H._isArray(n),!a&&(r=typeof this[t]==`function`&&this[t],delete e[t],i=r?r.call(this):null,e[t]=n,i!==n&&(o.attrs[t]=n));return H._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){let r=[];t&&this._isMatch(e)&&r.push(this);let i=this.parent;for(;i;){if(i===n)return r;i._isMatch(e)&&r.push(i),i=i.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if(typeof e==`function`)return e(this);let t=e.replace(/ /g,``).split(`,`),n=t.length,r,i;for(r=0;r<n;r++)if(i=t[r],H.isValidSelector(i)||(H.warn(`Selector "`+i+`" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".`),H.warn(`If you have a custom shape with such className, please change it to start with upper letter like "Triangle".`),H.warn(`Konva is awesome, right?`)),i.charAt(0)===`#`){if(this.id()===i.slice(1))return!0}else if(i.charAt(0)===`.`){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){let e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(Zt,this._getStage)}_getStage(){let e=this.getParent();return e?e.getStage():null}fire(e,t={},n){return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Ft,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let t;if(e)return t=new Pe,this._eachAncestorReverse(function(e){let n=e.transformsEnabled();n===`all`?t.multiply(e.getTransform()):n===`position`&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())},e),t;{t=this._cache.get(Ft)||new Pe,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();let e=this.transformsEnabled();if(e===`all`)t.multiply(this.getTransform());else if(e===`position`){let e=this.attrs.x||0,n=this.attrs.y||0,r=this.attrs.offsetX||0,i=this.attrs.offsetY||0;t.translate(e-r,n-i)}return t.dirty=!1,t}}getAbsoluteScale(e){let t=this;for(;t;)t._isUnderCache&&(e=t),t=t.getParent();let n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Qt,this._getTransform)}_getTransform(){let e=this._cache.get(Qt)||new Pe;e.reset();let t=this.x(),n=this.y(),r=V.getAngle(this.rotation()),i=this.attrs.scaleX??1,a=this.attrs.scaleY??1,o=this.attrs.skewX||0,s=this.attrs.skewY||0,c=this.attrs.offsetX||0,l=this.attrs.offsetY||0;return(t!==0||n!==0)&&e.translate(t,n),r!==0&&e.rotate(r),(o!==0||s!==0)&&e.skew(o,s),(i!==1||a!==1)&&e.scale(i,a),(c!==0||l!==0)&&e.translate(-1*c,-1*l),e.dirty=!1,e}clone(e){let t=H.cloneObject(this.attrs),n,r,i,a,o;for(n in e)t[n]=e[n];let s=new this.constructor(t);for(n in this.eventListeners)for(r=this.eventListeners[n],i=r.length,a=0;a<i;a++)o=r[a],o.name.indexOf(Bt)<0&&(s.eventListeners[n]||(s.eventListeners[n]=[]),s.eventListeners[n].push(o));return s}_toKonvaCanvas(e){e||={};let t=this.getClientRect(),n=this.getStage(),r=e.x===void 0?Math.floor(t.x):e.x,i=e.y===void 0?Math.floor(t.y):e.y,a=e.pixelRatio||1,o=new vt({width:e.width||Math.ceil(t.width)||(n?n.width():0),height:e.height||Math.ceil(t.height)||(n?n.height():0),pixelRatio:a}),s=o.getContext(),c=new vt({width:o.width/o.pixelRatio+Math.abs(r),height:o.height/o.pixelRatio+Math.abs(i),pixelRatio:o.pixelRatio});return e.imageSmoothingEnabled===!1&&(s._context.imageSmoothingEnabled=!1),s.save(),(r||i)&&s.translate(-1*r,-1*i),this.drawScene(o,void 0,c),s.restore(),o}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e||={};let t=e.mimeType||null,n=e.quality||null,r=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(r),r}toImage(e){return new Promise((t,n)=>{try{let n=e?.callback;n&&delete e.callback,H._urlToImage(this.toDataURL(e),function(e){t(e),n?.(e)})}catch(e){n(e)}})}toBlob(e){return new Promise((t,n)=>{try{let n=e?.callback;n&&delete e.callback,this.toCanvas(e).toBlob(e=>{t(e),n?.(e)},e?.mimeType,e?.quality)}catch(e){n(e)}})}setSize(e){return this.width(e.width),this.height(e.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.parent?this.parent.getDragDistance():V.dragDistance:this.attrs.dragDistance}_off(e,t,n){let r=this.eventListeners[e],i,a,o;for(i=0;i<r.length;i++)if(a=r[i].name,o=r[i].handler,(a!==`konva`||t===`konva`)&&(!t||a===t)&&(!n||n===o)){if(r.splice(i,1),r.length===0){delete this.eventListeners[e];break}i--}}_fireChangeEvent(e,t,n){this._fire(e+Rt,{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){let t=this.name(),n=t?t+` `+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;let t=this.name();return t?(t||``).split(/\s/g).indexOf(e)!==-1:!1}removeName(e){let t=(this.name()||``).split(/\s/g),n=t.indexOf(e);return n!==-1&&(t.splice(n,1),this.name(t.join(` `))),this}setAttr(e,t){let n=this[Jt+H._capitalize(e)];return H._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){V.autoDrawEnabled&&(this.getLayer()||this.getStage())?.batchDraw()}_setAttr(e,t){let n=this.attrs[e];n===t&&!H.isObject(t)||(t==null?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){let r;n!==void 0&&(r=this.attrs[e],r||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,r,n))}_fireAndBubble(e,t,n){t&&this.nodeType===Yt&&(t.target=this);let r=[Ht,Ut,Wt,Gt,Kt,qt];if(!(r.indexOf(e)!==-1&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType===`Stage`&&!n))){this._fire(e,t);let i=r.indexOf(e)!==-1&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(t&&!t.cancelBubble||!t)&&this.parent&&this.parent.isListening()&&!i&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,t,n):this._fireAndBubble.call(this.parent,e,t))}}_getProtoListeners(t){let{nodeType:n}=this,r=e.protoListenerMap.get(n)||{},i=r?.[t];if(i===void 0){i=[];let a=Object.getPrototypeOf(this);for(;a;){let e=a.eventListeners?.[t]??[];i.push(...e),a=Object.getPrototypeOf(a)}r[t]=i,e.protoListenerMap.set(n,r)}return i}_fire(e,t){t||={},t.currentTarget=this,t.type=e;let n=this._getProtoListeners(e);if(n){let e=n.slice();for(let n=0;n<e.length;n++)e[n].handler.call(this,t)}let r=this.eventListeners[e];if(r){let n=r.slice(),i=n.length;for(let e=0;e<n.length;e++)n[e].handler.call(this,t);let a=this.eventListeners[e];if(a)for(let e=i;e<a.length;e++)a[e].handler.call(this,t)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){let t=e?e.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition();if(!n)return;let i=n._getPointerById(t)||n._changedPointerPositions[0]||r;bt._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-r.x,y:i.y-r.y},dragStatus:`ready`,pointerId:t,startEvent:e})}startDrag(e,t=!0){bt._dragElements.has(this._id)||this._createDragElement(e);let n=bt._dragElements.get(this._id);n.dragStatus=`dragging`,this.fire(`dragstart`,{type:`dragstart`,target:this,evt:n.startEvent&&n.startEvent.evt||e&&e.evt},t)}_setDragPosition(e,t){let n=this.getStage()._getPointerById(t.pointerId);if(!n)return;let r={x:n.x-t.offset.x,y:n.y-t.offset.y},i=this.dragBoundFunc();if(i!==void 0){let t=i.call(this,r,e);t?r=t:H.warn(`dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.`)}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}stopDrag(e){let t=bt._dragElements.get(this._id);t&&(t.dragStatus=`stopped`),bt._endDragBefore(e),bt._endDragAfter(e)}setDraggable(e){this._setAttr(`draggable`,e),this._dragChange()}isDragging(){let e=bt._dragElements.get(this._id);return e?e.dragStatus===`dragging`:!1}_listenDrag(){this._dragCleanup(),this.on(`mousedown.konva touchstart.konva`,function(e){if(!(e.evt.button===void 0||V.dragButtons.indexOf(e.evt.button)>=0)||this.isDragging())return;let t=!1;bt._dragElements.forEach(e=>{this.isAncestorOf(e.node)&&(t=!0)}),t||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;let e=bt._dragElements.get(this._id),t=e&&e.dragStatus===`dragging`,n=e&&e.dragStatus===`ready`;t?this.stopDrag():n&&bt._dragElements.delete(this._id)}}_dragCleanup(){this.off(`mousedown.konva`),this.off(`touchstart.konva`)}isClientRectOnScreen(e={x:0,y:0}){let t=this.getStage();if(!t)return!1;let n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return H.haveIntersection(n,this.getClientRect())}static create(e,t){return H._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(t,n){let r=e.prototype.getClassName.call(t),i=t.children,a,o,s;n&&(t.attrs.container=n),V[r]||(H.warn(`Can not find a node with class name "`+r+`". Fallback to "Shape".`),r=`Shape`);let c=V[r];if(a=new c(t.attrs),i)for(o=i.length,s=0;s<o;s++)a.add(e._createNode(i[s]));return a}};G.protoListenerMap=new Map,G.prototype.nodeType=`Node`,G.prototype._attrsAffectingSize=[],G.prototype.eventListeners={},G.prototype.on(tn,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Qt),this._clearSelfAndDescendantCache(Ft)}),G.prototype.on(`visibleChange.konva`,function(){this._clearSelfAndDescendantCache(en)}),G.prototype.on(`listeningChange.konva`,function(){this._clearSelfAndDescendantCache(Vt)}),G.prototype.on(`opacityChange.konva`,function(){this._clearSelfAndDescendantCache(Nt)});var rn=W.addGetterSetter;rn(G,`zIndex`),rn(G,`absolutePosition`),rn(G,`position`),rn(G,`x`,0,U()),rn(G,`y`,0,U()),rn(G,`globalCompositeOperation`,`source-over`,Tt()),rn(G,`opacity`,1,U()),rn(G,`name`,``,Tt()),rn(G,`id`,``,Tt()),rn(G,`rotation`,0,U()),W.addComponentsGetterSetter(G,`scale`,[`x`,`y`]),rn(G,`scaleX`,1,U()),rn(G,`scaleY`,1,U()),W.addComponentsGetterSetter(G,`skew`,[`x`,`y`]),rn(G,`skewX`,0,U()),rn(G,`skewY`,0,U()),W.addComponentsGetterSetter(G,`offset`,[`x`,`y`]),rn(G,`offsetX`,0,U()),rn(G,`offsetY`,0,U()),rn(G,`dragDistance`,void 0,U()),rn(G,`width`,0,U()),rn(G,`height`,0,U()),rn(G,`listening`,!0,Ot()),rn(G,`preventDefault`,!0,Ot()),rn(G,`filters`,void 0,function(e){return this._filterUpToDate=!1,e}),rn(G,`visible`,!0,Ot()),rn(G,`transformsEnabled`,`all`,Tt()),rn(G,`size`),rn(G,`dragBoundFunc`),rn(G,`draggable`,!1,Ot()),W.backCompat(G,{rotateDeg:`rotate`,setRotationDeg:`setRotation`,getRotationDeg:`getRotation`});var an=class extends G{constructor(){super(...arguments),this.children=[]}getChildren(e){let t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let t=0;t<e.length;t++)this.add(e[t]);return this}let t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire(`add`,{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){let t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){let n=[];return this._descendants(r=>{let i=r._isMatch(e);return i&&n.push(r),!!(i&&t)}),n}_descendants(e){let t=!1,n=this.getChildren();for(let r of n)if(t=e(r),t||r.hasChildren()&&(t=r._descendants(e),t))return!0;return!1}toObject(){let e=G.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){let t=G.prototype.clone.call(this,e);return this.getChildren().forEach(function(e){t.add(e.clone())}),t}getAllIntersections(e){let t=[];return this.find(`Shape`).forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)==null||t.forEach(function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)==null||e.forEach(function(e,t){e.index=t}),this._requestDraw()}drawScene(e,t,n){let r=this.getLayer(),i=e||r&&r.getCanvas(),a=i&&i.getContext(),o=this._getCanvasCache(),s=o&&o.scene,c=i&&i.isCache;if(!this.isVisible()&&!c)return this;if(s){a.save();let e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren(`drawScene`,i,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;let n=this.getLayer(),r=e||n&&n.hitCanvas,i=r&&r.getContext(),a=this._getCanvasCache();if(a&&a.hit){i.save();let e=this.getAbsoluteTransform(t).getMatrix();i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(i),i.restore()}else this._drawChildren(`drawHit`,r,t);return this}_drawChildren(e,t,n,r){var i;let a=t&&t.getContext(),o=this.clipWidth(),s=this.clipHeight(),c=this.clipFunc(),l=typeof o==`number`&&typeof s==`number`||c,u=n===this;if(l){a.save();let e=this.getAbsoluteTransform(n),t=e.getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),a.beginPath();let r;if(c)r=c.call(this,a,this);else{let e=this.clipX(),t=this.clipY();a.rect(e||0,t||0,o,s)}a.clip.apply(a,r),t=e.copy().invert().getMatrix(),a.transform(t[0],t[1],t[2],t[3],t[4],t[5])}let d=!u&&this.globalCompositeOperation()!==`source-over`&&e===`drawScene`;d&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)==null||i.forEach(function(i){i[e](t,n,r)}),d&&a.restore(),l&&a.restore()}getClientRect(e={}){var t;let n=e.skipTransform,r=e.relativeTo,i,a,o,s,c={x:1/0,y:1/0,width:0,height:0},l=this;(t=this.children)==null||t.forEach(function(t){if(!t.visible())return;let n=t.getClientRect({relativeTo:l,skipShadow:e.skipShadow,skipStroke:e.skipStroke});n.width===0&&n.height===0||(i===void 0?(i=n.x,a=n.y,o=n.x+n.width,s=n.y+n.height):(i=Math.min(i,n.x),a=Math.min(a,n.y),o=Math.max(o,n.x+n.width),s=Math.max(s,n.y+n.height)))});let u=this.find(`Shape`),d=!1;for(let e=0;e<u.length;e++)if(u[e]._isVisible(this)){d=!0;break}return c=d&&i!==void 0?{x:i,y:a,width:o-i,height:s-a}:{x:0,y:0,width:0,height:0},n?c:this._transformedRect(c,r)}};W.addComponentsGetterSetter(an,`clip`,[`x`,`y`,`width`,`height`]),W.addGetterSetter(an,`clipX`,void 0,U()),W.addGetterSetter(an,`clipY`,void 0,U()),W.addGetterSetter(an,`clipWidth`,void 0,U()),W.addGetterSetter(an,`clipHeight`,void 0,U()),W.addGetterSetter(an,`clipFunc`);var on=new Map,sn=V._global.PointerEvent!==void 0;function cn(e){return on.get(e)}function ln(e){return{evt:e,pointerId:e.pointerId}}function un(e,t){return on.get(e)===t}function dn(e,t){fn(e),t.getStage()&&(on.set(e,t),sn&&t._fire(`gotpointercapture`,ln(new PointerEvent(`gotpointercapture`))))}function fn(e,t){let n=on.get(e);if(!n)return;let r=n.getStage();r&&r.content,on.delete(e),sn&&n._fire(`lostpointercapture`,ln(new PointerEvent(`lostpointercapture`)))}var pn=`Stage`,mn=`string`,hn=`px`,gn=`mouseout`,_n=`mouseleave`,vn=`mouseover`,yn=`mouseenter`,bn=`mousemove`,xn=`mousedown`,Sn=`mouseup`,Cn=`pointermove`,wn=`pointerdown`,Tn=`pointerup`,En=`pointercancel`,Dn=`lostpointercapture`,On=`pointerout`,kn=`pointerleave`,An=`pointerover`,jn=`pointerenter`,Mn=`contextmenu`,Nn=`touchstart`,Pn=`touchend`,Fn=`touchmove`,In=`touchcancel`,Ln=`wheel`,Rn=5,zn=[[yn,`_pointerenter`],[xn,`_pointerdown`],[bn,`_pointermove`],[Sn,`_pointerup`],[_n,`_pointerleave`],[Nn,`_pointerdown`],[Fn,`_pointermove`],[Pn,`_pointerup`],[In,`_pointercancel`],[vn,`_pointerover`],[Ln,`_wheel`],[Mn,`_contextmenu`],[wn,`_pointerdown`],[Cn,`_pointermove`],[Tn,`_pointerup`],[En,`_pointercancel`],[kn,`_pointerleave`],[Dn,`_lostpointercapture`]],Bn={mouse:{[On]:gn,[kn]:_n,[An]:vn,[jn]:yn,[Cn]:bn,[wn]:xn,[Tn]:Sn,[En]:`mousecancel`,pointerclick:`click`,pointerdblclick:`dblclick`},touch:{[On]:`touchout`,[kn]:`touchleave`,[An]:`touchover`,[jn]:`touchenter`,[Cn]:Fn,[wn]:Nn,[Tn]:Pn,[En]:In,pointerclick:`tap`,pointerdblclick:`dbltap`},pointer:{[On]:On,[kn]:kn,[An]:An,[jn]:jn,[Cn]:Cn,[wn]:wn,[Tn]:Tn,[En]:En,pointerclick:`pointerclick`,pointerdblclick:`pointerdblclick`}},Vn=e=>e.indexOf(`pointer`)>=0?`pointer`:e.indexOf(`touch`)>=0?`touch`:`mouse`,Hn=e=>{let t=Vn(e);if(t===`pointer`)return V.pointerEventsEnabled&&Bn.pointer;if(t===`touch`)return Bn.touch;if(t===`mouse`)return Bn.mouse};function Un(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&H.warn(`Stage does not support clipping. Please use clip for Layers or Groups.`),e}var Wn=`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);`,Gn=[],Kn=class extends an{constructor(e){super(Un(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Gn.push(this),this.on(`widthChange.konva heightChange.konva`,this._resizeDOM),this.on(`visibleChange.konva`,this._checkVisibility),this.on(`clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva`,()=>{Un(this.attrs)}),this._checkVisibility()}_validateAdd(e){let t=e.getType()===`Layer`,n=e.getType()===`FastLayer`;t||n||H.throw(`You may only add layers to the stage.`)}_checkVisibility(){if(!this.content)return;let e=this.visible()?``:`none`;this.content.style.display=e}setContainer(e){if(typeof e===mn){let t;if(e.charAt(0)===`.`){let t=e.slice(1);e=document.getElementsByClassName(t)[0]}else t=e.charAt(0)===`#`?e.slice(1):e,e=document.getElementById(t);if(!e)throw`Can not find container in document with id `+t}return this._setAttr(`container`,e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].clear();return this}clone(e){return e||={},e.container=typeof document<`u`&&document.createElement(`div`),an.prototype.clone.call(this,e)}destroy(){super.destroy();let e=this.content;e&&H._isInDocument(e)&&this.container().removeChild(e);let t=Gn.indexOf(this);return t>-1&&Gn.splice(t,1),H.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){let e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(H.warn(Wn),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();let t=new vt({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach(function(t){if(!t.isVisible())return;let r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}),t}getIntersection(e){if(!e)return null;let t=this.children,n=t.length-1;for(let r=n;r>=0;r--){let n=t[r].getIntersection(e);if(n)return n}return null}_resizeDOM(){let e=this.width(),t=this.height();this.content&&(this.content.style.width=e+hn,this.content.style.height=t+hn),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}super.add(e);let n=this.children.length;return n>Rn&&H.warn(`The stage has `+n+` 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.`),e.setSize({width:this.width(),height:this.height()}),e.draw(),V.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return un(e,this)}setPointerCapture(e){dn(e,this)}releaseCapture(e){fn(e,this)}getLayers(){return this.children}_bindContentEvents(){V.isBrowser&&zn.forEach(([e,t])=>{this.content.addEventListener(e,e=>{this[t](e)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);let t=Hn(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);let t=Hn(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+`targetShape`];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){let t=Hn(e.type),n=Vn(e.type);if(!t)return;this.setPointersPositions(e);let r=this._getTargetShape(n),i=!(V.isDragging()||V.isTransforming())||V.hitOnDragEnabled;r&&i?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+`targetShape`]=null):i&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){let t=Hn(e.type),n=Vn(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(i=>{let a=this.getIntersection(i);if(bt.justDragged=!1,V[`_`+n+`ListenClick`]=!0,!a||!a.isListening()){this[n+`ClickStartShape`]=void 0;return}V.capturePointerEventsEnabled&&a.setPointerCapture(i.id),this[n+`ClickStartShape`]=a,a._fireAndBubble(t.pointerdown,{evt:e,pointerId:i.id}),r=!0;let o=e.type.indexOf(`touch`)>=0;a.preventDefault()&&e.cancelable&&o&&e.preventDefault()}),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){let t=Hn(e.type),n=Vn(e.type);if(!t)return;let r=e.type.indexOf(`touch`)>=0||e.pointerType===`touch`;if(V.isDragging()&&bt.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(V.isDragging()||V.isTransforming())||V.hitOnDragEnabled))return;let i={},a=!1,o=this._getTargetShape(n);this._changedPointerPositions.forEach(r=>{let s=cn(r.id)||this.getIntersection(r),c=r.id,l={evt:e,pointerId:c},u=o!==s;if(u&&o&&(o._fireAndBubble(t.pointerout,{...l},s),o._fireAndBubble(t.pointerleave,{...l},s)),s){if(i[s._id])return;i[s._id]=!0}s&&s.isListening()?(a=!0,u&&(s._fireAndBubble(t.pointerover,{...l},o),s._fireAndBubble(t.pointerenter,{...l},o),this[n+`targetShape`]=s),s._fireAndBubble(t.pointermove,{...l})):o&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:c}),this[n+`targetShape`]=null)}),a||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){let t=Hn(e.type),n=Vn(e.type);if(!t)return;this.setPointersPositions(e);let r=this[n+`ClickStartShape`],i=this[n+`ClickEndShape`],a={},o=!1;this._changedPointerPositions.forEach(s=>{let c=cn(s.id)||this.getIntersection(s);if(c){if(c.releaseCapture(s.id),a[c._id])return;a[c._id]=!0}let l=s.id,u={evt:e,pointerId:l},d=!1;V[`_`+n+`InDblClickWindow`]?(d=!0,clearTimeout(this[n+`DblTimeout`])):bt.justDragged||(V[`_`+n+`InDblClickWindow`]=!0,clearTimeout(this[n+`DblTimeout`])),this[n+`DblTimeout`]=setTimeout(function(){V[`_`+n+`InDblClickWindow`]=!1},V.dblClickWindow),c&&c.isListening()?(o=!0,this[n+`ClickEndShape`]=c,c._fireAndBubble(t.pointerup,{...u}),V[`_`+n+`ListenClick`]&&r&&r===c&&(c._fireAndBubble(t.pointerclick,{...u}),d&&i&&i===c&&c._fireAndBubble(t.pointerdblclick,{...u}))):(this[n+`ClickEndShape`]=null,o||=(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),!0),V[`_`+n+`ListenClick`]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:l}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:l}))}),o||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),V[`_`+n+`ListenClick`]=!1,e.cancelable&&n!==`touch`&&n!==`pointer`&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);let t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Mn,{evt:e}):this._fire(Mn,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);let t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Ln,{evt:e}):this._fire(Ln,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);let t=cn(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(Tn,ln(e)),fn(e.pointerId)}_lostpointercapture(e){fn(e.pointerId)}setPointersPositions(e){let t=this._getContentPosition(),n=null,r=null;e||=window.event,e.touches===void 0?(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:H._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:H._getFirstPointerId(e)}]):(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))}_setPointerPosition(e){H.warn(`Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.`),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};let e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new vt({width:this.width(),height:this.height()}),this.bufferHitCanvas=new yt({pixelRatio:1,width:this.width(),height:this.height()}),!V.isBrowser)return;let e=this.container();if(!e)throw`Stage has no container. A container is required.`;e.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`),e.appendChild(this.content),this._resizeDOM()}cache(){return H.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(e){e.batchDraw()}),this}};Kn.prototype.nodeType=pn,je(Kn),W.addGetterSetter(Kn,`container`),V.isBrowser&&document.addEventListener(`visibilitychange`,()=>{Gn.forEach(e=>{e.batchDraw()})});var qn=`hasShadow`,Jn=`shadowRGBA`,Yn=`patternImage`,Xn=`linearGradient`,Zn=`radialGradient`,Qn;function $n(){return Qn||(Qn=H.createCanvasElement().getContext(`2d`),Qn)}var er={};function tr(e){let t=this.attrs.fillRule;t?e.fill(t):e.fill()}function nr(e){e.stroke()}function rr(e){let t=this.attrs.fillRule;t?e.fill(t):e.fill()}function ir(e){e.stroke()}function ar(){this._clearCache(qn)}function or(){this._clearCache(Jn)}function sr(){this._clearCache(Yn)}function cr(){this._clearCache(Xn)}function lr(){this._clearCache(Zn)}var K=class extends G{constructor(e){super(e);let t,n=0;for(;t=H.getHitColor(),!(t&&!(t in er));)if(n++,n>=1e4){H.warn(`Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it.`),t=H.getRandomColor();break}this.colorKey=t,er[t]=this}getContext(){return H.warn(`shape.getContext() method is deprecated. Please do not use it.`),this.getLayer().getContext()}getCanvas(){return H.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(qn,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Yn,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){let e=$n().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||`repeat`);if(e&&e.setTransform){let t=new Pe;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(V.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let n=t.getMatrix(),r=typeof DOMMatrix>`u`?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Xn,this.__getLinearGradient)}__getLinearGradient(){let e=this.fillLinearGradientColorStops();if(e){let t=$n(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),i=t.createLinearGradient(n.x,n.y,r.x,r.y);for(let t=0;t<e.length;t+=2)i.addColorStop(e[t],e[t+1]);return i}}_getRadialGradient(){return this._getCache(Zn,this.__getRadialGradient)}__getRadialGradient(){let e=this.fillRadialGradientColorStops();if(e){let t=$n(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),i=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let t=0;t<e.length;t+=2)i.addColorStop(e[t],e[t+1]);return i}}getShadowRGBA(){return this._getCache(Jn,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;let e=H.colorToRGBA(this.shadowColor());if(e)return`rgba(`+e.r+`,`+e.g+`,`+e.b+`,`+e.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(){let e=this.hitStrokeWidth();return e===`auto`?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){let t=this.getStage();if(!t)return!1;let n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return G.prototype.destroy.call(this),delete er[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){if(!(this.attrs.perfectDrawEnabled??!0))return!1;let t=e||this.hasFill(),n=this.hasStroke(),r=this.getAbsoluteOpacity()!==1;if(t&&n&&r)return!0;let i=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(t&&n&&i&&a)}setStrokeHitEnabled(e){H.warn(`strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.`),e?this.hitStrokeWidth(`auto`):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){let e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}let r=e.skipTransform,i=e.relativeTo||t&&this.getStage()||void 0,a=this.getSelfRect(),o=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,s=a.width+o,c=a.height+o,l=!e.skipShadow&&this.hasShadow(),u=l?this.shadowOffsetX():0,d=l?this.shadowOffsetY():0,f=s+Math.abs(u),p=c+Math.abs(d),m=l&&this.shadowBlur()||0,h={width:f+m*2,height:p+m*2,x:-(o/2+m)+Math.min(u,0)+a.x,y:-(o/2+m)+Math.min(d,0)+a.y};return r?h:this._transformedRect(h,i)}drawScene(e,t,n){let r=this.getLayer(),i=(e||r.getCanvas()).getContext(),a=this._getCanvasCache(),o=this.getSceneFunc(),s=this.hasShadow(),c,l=t===this;if(!this.isVisible()&&!l)return this;if(a){i.save();let e=this.getAbsoluteTransform(t).getMatrix();return i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(i),i.restore(),this}if(!o)return this;if(i.save(),this._useBufferCanvas()){c=this.getStage();let e=n||c.bufferCanvas,r=e.getContext();n?(r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.width,e.height),r.restore()):r.clear(),r.save(),r._applyLineJoin(this),r._applyMiterLimit(this);let a=this.getAbsoluteTransform(t).getMatrix();r.transform(a[0],a[1],a[2],a[3],a[4],a[5]),o.call(this,r,this),r.restore();let u=e.pixelRatio;s&&i._applyShadow(this),l||(i._applyOpacity(this),i._applyGlobalCompositeOperation(this)),i.drawImage(e._canvas,e.x||0,e.y||0,e.width/u,e.height/u)}else{if(i._applyLineJoin(this),i._applyMiterLimit(this),!l){let e=this.getAbsoluteTransform(t).getMatrix();i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),i._applyOpacity(this),i._applyGlobalCompositeOperation(this)}s&&i._applyShadow(this),o.call(this,i,this)}return i.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;let r=this.getLayer(),i=e||r.hitCanvas,a=i&&i.getContext(),o=this.hitFunc()||this.sceneFunc(),s=this._getCanvasCache(),c=s&&s.hit;if(this.colorKey||H.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()`),c){a.save();let e=this.getAbsoluteTransform(t).getMatrix();return a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!o)return this;if(a.save(),a._applyLineJoin(this),a._applyMiterLimit(this),this!==t){let e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5])}return o.call(this,a,this),a.restore(),this}drawHitFromCache(e=0){let t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,i=r.getContext(),a=r.getWidth(),o=r.getHeight();i.clear(),i.drawImage(n._canvas,0,0,a,o);try{let t=i.getImageData(0,0,a,o),n=t.data,r=n.length,s=H._hexToRgb(this.colorKey);for(let t=0;t<r;t+=4)n[t+3]>e?(n[t]=s.r,n[t+1]=s.g,n[t+2]=s.b,n[t+3]=255):n[t+3]=0;i.putImageData(t,0,0)}catch(e){H.error(`Unable to draw hit graph from cached scene canvas. `+e.message)}return this}hasPointerCapture(e){return un(e,this)}setPointerCapture(e){dn(e,this)}releaseCapture(e){fn(e,this)}};K.prototype._fillFunc=tr,K.prototype._strokeFunc=nr,K.prototype._fillFuncHit=rr,K.prototype._strokeFuncHit=ir,K.prototype._centroid=!1,K.prototype.nodeType=`Shape`,je(K),K.prototype.eventListeners={},K.prototype.on(`shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva`,ar),K.prototype.on(`shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva`,or),K.prototype.on(`fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva`,sr),K.prototype.on(`fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva`,cr),K.prototype.on(`fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva`,lr),W.addGetterSetter(K,`stroke`,void 0,Et()),W.addGetterSetter(K,`strokeWidth`,2,U()),W.addGetterSetter(K,`fillAfterStrokeEnabled`,!1),W.addGetterSetter(K,`hitStrokeWidth`,`auto`,wt()),W.addGetterSetter(K,`strokeHitEnabled`,!0,Ot()),W.addGetterSetter(K,`perfectDrawEnabled`,!0,Ot()),W.addGetterSetter(K,`shadowForStrokeEnabled`,!0,Ot()),W.addGetterSetter(K,`lineJoin`),W.addGetterSetter(K,`lineCap`),W.addGetterSetter(K,`miterLimit`),W.addGetterSetter(K,`sceneFunc`),W.addGetterSetter(K,`hitFunc`),W.addGetterSetter(K,`dash`),W.addGetterSetter(K,`dashOffset`,0,U()),W.addGetterSetter(K,`shadowColor`,void 0,Tt()),W.addGetterSetter(K,`shadowBlur`,0,U()),W.addGetterSetter(K,`shadowOpacity`,1,U()),W.addComponentsGetterSetter(K,`shadowOffset`,[`x`,`y`]),W.addGetterSetter(K,`shadowOffsetX`,0,U()),W.addGetterSetter(K,`shadowOffsetY`,0,U()),W.addGetterSetter(K,`fillPatternImage`),W.addGetterSetter(K,`fill`,void 0,Et()),W.addGetterSetter(K,`fillPatternX`,0,U()),W.addGetterSetter(K,`fillPatternY`,0,U()),W.addGetterSetter(K,`fillLinearGradientColorStops`),W.addGetterSetter(K,`strokeLinearGradientColorStops`),W.addGetterSetter(K,`fillRadialGradientStartRadius`,0),W.addGetterSetter(K,`fillRadialGradientEndRadius`,0),W.addGetterSetter(K,`fillRadialGradientColorStops`),W.addGetterSetter(K,`fillPatternRepeat`,`repeat`),W.addGetterSetter(K,`fillEnabled`,!0),W.addGetterSetter(K,`strokeEnabled`,!0),W.addGetterSetter(K,`shadowEnabled`,!0),W.addGetterSetter(K,`dashEnabled`,!0),W.addGetterSetter(K,`strokeScaleEnabled`,!0),W.addGetterSetter(K,`fillPriority`,`color`),W.addComponentsGetterSetter(K,`fillPatternOffset`,[`x`,`y`]),W.addGetterSetter(K,`fillPatternOffsetX`,0,U()),W.addGetterSetter(K,`fillPatternOffsetY`,0,U()),W.addComponentsGetterSetter(K,`fillPatternScale`,[`x`,`y`]),W.addGetterSetter(K,`fillPatternScaleX`,1,U()),W.addGetterSetter(K,`fillPatternScaleY`,1,U()),W.addComponentsGetterSetter(K,`fillLinearGradientStartPoint`,[`x`,`y`]),W.addComponentsGetterSetter(K,`strokeLinearGradientStartPoint`,[`x`,`y`]),W.addGetterSetter(K,`fillLinearGradientStartPointX`,0),W.addGetterSetter(K,`strokeLinearGradientStartPointX`,0),W.addGetterSetter(K,`fillLinearGradientStartPointY`,0),W.addGetterSetter(K,`strokeLinearGradientStartPointY`,0),W.addComponentsGetterSetter(K,`fillLinearGradientEndPoint`,[`x`,`y`]),W.addComponentsGetterSetter(K,`strokeLinearGradientEndPoint`,[`x`,`y`]),W.addGetterSetter(K,`fillLinearGradientEndPointX`,0),W.addGetterSetter(K,`strokeLinearGradientEndPointX`,0),W.addGetterSetter(K,`fillLinearGradientEndPointY`,0),W.addGetterSetter(K,`strokeLinearGradientEndPointY`,0),W.addComponentsGetterSetter(K,`fillRadialGradientStartPoint`,[`x`,`y`]),W.addGetterSetter(K,`fillRadialGradientStartPointX`,0),W.addGetterSetter(K,`fillRadialGradientStartPointY`,0),W.addComponentsGetterSetter(K,`fillRadialGradientEndPoint`,[`x`,`y`]),W.addGetterSetter(K,`fillRadialGradientEndPointX`,0),W.addGetterSetter(K,`fillRadialGradientEndPointY`,0),W.addGetterSetter(K,`fillPatternRotation`,0),W.addGetterSetter(K,`fillRule`,void 0,Tt()),W.backCompat(K,{dashArray:`dash`,getDashArray:`getDash`,setDashArray:`getDash`,drawFunc:`sceneFunc`,getDrawFunc:`getSceneFunc`,setDrawFunc:`setSceneFunc`,drawHitFunc:`hitFunc`,getDrawHitFunc:`getHitFunc`,setDrawHitFunc:`setHitFunc`});var ur=`beforeDraw`,dr=`draw`,fr=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],pr=fr.length,mr=class extends an{constructor(e){super(e),this.canvas=new vt,this.hitCanvas=new yt({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(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);let t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){G.prototype.moveToTop.call(this);let e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!G.prototype.moveUp.call(this))return!1;let e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(G.prototype.moveDown.call(this)){let e=this.getStage();if(e){let t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(G.prototype.moveToBottom.call(this)){let e=this.getStage();if(e){let t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){let e=this.getNativeCanvasElement();return G.prototype.remove.call(this),e&&e.parentNode&&H._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){let t=e.getType();t!==`Group`&&t!==`Shape`&&H.throw(`You may only add groups and shapes to a layer.`)}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x===void 0?this.x():e.x,e.y=e.y===void 0?this.y():e.y,G.prototype._toKonvaCanvas.call(this,e)}_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(){H.warn(`Can not change width of layer. Use "stage.width(value)" function instead.`)}getHeight(){if(this.parent)return this.parent.height()}setHeight(){H.warn(`Can not change height of layer. Use "stage.height(value)" function instead.`)}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,H.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let r=0;r<pr;r++){let i=fr[r],a=this._getIntersection({x:e.x+i.x*t,y:e.y+i.y*t}),o=a.shape;if(o)return o;if(n=!!a.antialiased,!a.antialiased)break}if(n)t+=1;else return null}}_getIntersection(e){let t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(r===255){let e=er[H.getHitColorKey(n[0],n[1],n[2])];return e?{shape:e}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){let r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(ur,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),an.prototype.drawScene.call(this,i,t,n),this._fire(dr,{node:this}),this}drawHit(e,t){let n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),an.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){H.warn(`hitGraphEnabled method is deprecated. Please use layer.listening() instead.`),this.listening(e)}getHitGraphEnabled(e){return H.warn(`hitGraphEnabled method is deprecated. Please use layer.listening() instead.`),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;let e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return H.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};mr.prototype.nodeType=`Layer`,je(mr),W.addGetterSetter(mr,`imageSmoothingEnabled`,!0),W.addGetterSetter(mr,`clearBeforeDraw`,!0),W.addGetterSetter(mr,`hitGraphEnabled`,!0,Ot());var hr=class extends mr{constructor(e){super(e),this.listening(!1),H.warn(`Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.`)}};hr.prototype.nodeType=`FastLayer`,je(hr);var gr=class extends an{_validateAdd(e){let t=e.getType();t!==`Group`&&t!==`Shape`&&H.throw(`You may only add groups and shapes to groups.`)}};gr.prototype.nodeType=`Group`,je(gr);var _r=(function(){return Ae.performance&&Ae.performance.now?function(){return Ae.performance.now()}:function(){return new Date().getTime()}})(),vr=class e{constructor(t,n){this.id=e.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:_r(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(e){let t=[];return e&&(t=Array.isArray(e)?e:[e]),this.layers=t,this}getLayers(){return this.layers}addLayer(e){let t=this.layers,n=t.length;for(let r=0;r<n;r++)if(t[r]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){let t=e.animations,n=t.length;for(let e=0;e<n;e++)if(t[e].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=_r(),e._addAnimation(this),this}stop(){return e._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){let t=e.id,n=this.animations,r=n.length;for(let e=0;e<r;e++)if(n[e].id===t){this.animations.splice(e,1);break}}static _runFrames(){let e={},t=this.animations;for(let n=0;n<t.length;n++){let r=t[n],i=r.layers,a=r.func;r._updateFrameObject(_r());let o=i.length,s;if(s=a?a.call(r,r.frame)!==!1:!0,s)for(let t=0;t<o;t++){let n=i[t];n._id!==void 0&&(e[n._id]=n)}}for(let t in e)e.hasOwnProperty(t)&&e[t].batchDraw()}static _animationLoop(){let t=e;t.animations.length?(t._runFrames(),H.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,H.requestAnimFrame(this._animationLoop))}};vr.animations=[],vr.animIdCounter=0,vr.animRunning=!1;var yr={node:1,duration:1,easing:1,onFinish:1,yoyo:1},br=1,xr=2,Sr=3,Cr=[`fill`,`stroke`,`shadowColor`],wr=0,Tr=class{constructor(e,t,n,r,i,a,o){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=a,this._change=0,this.prevPos=0,this.yoyo=o,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=i-this.begin,this.pause()}fire(e){let t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=xr,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire(`onPlay`)}reverse(){this.state=Sr,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire(`onReverse`)}seek(e){this.pause(),this._time=e,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(){let e=this.getTimer()-this._startTime;this.state===xr?this.setTime(e):this.state===Sr&&this.setTime(this.duration-e)}pause(){this.state=br,this.fire(`onPause`)}getTimer(){return new Date().getTime()}},Er=class e{constructor(t){let n=this,r=t.node,i=r._id,a=t.easing||Dr.Linear,o=!!t.yoyo,s,c;s=t.duration===void 0?.3:t.duration===0?.001:t.duration,this.node=r,this._id=wr++;let l=r.getLayer()||(r instanceof V.Stage?r.getLayers():null);for(c in l||H.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new vr(function(){n.tween.onEnterFrame()},l),this.tween=new Tr(c,function(e){n._tweenFunc(e)},a,0,1,s*1e3,o),this._addListeners(),e.attrs[i]||(e.attrs[i]={}),e.attrs[i][this._id]||(e.attrs[i][this._id]={}),e.tweens[i]||(e.tweens[i]={}),t)yr[c]===void 0&&this._addAttr(c,t[c]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){let r=this.node,i=r._id,a,o,s,c,l,u=e.tweens[i][t];u&&delete e.attrs[i][u][t];let d=r.getAttr(t);if(H._isArray(n))if(a=[],o=Math.max(n.length,d.length),t===`points`&&n.length!==d.length&&(n.length>d.length?(c=d,d=H._prepareArrayForTween(d,n,r.closed())):(s=n,n=H._prepareArrayForTween(n,d,r.closed()))),t.indexOf(`fill`)===0)for(let e=0;e<o;e++)if(e%2==0)a.push(n[e]-d[e]);else{let t=H.colorToRGBA(d[e]);l=H.colorToRGBA(n[e]),d[e]=t,a.push({r:l.r-t.r,g:l.g-t.g,b:l.b-t.b,a:l.a-t.a})}else for(let e=0;e<o;e++)a.push(n[e]-d[e]);else Cr.indexOf(t)===-1?a=n-d:(d=H.colorToRGBA(d),l=H.colorToRGBA(n),a={r:l.r-d.r,g:l.g-d.g,b:l.b-d.b,a:l.a-d.a});e.attrs[i][this._id][t]={start:d,diff:a,end:n,trueEnd:s,trueStart:c},e.tweens[i][t]=this._id}_tweenFunc(t){let n=this.node,r=e.attrs[n._id][this._id],i,a,o,s,c,l,u,d;for(i in r){if(a=r[i],o=a.start,s=a.diff,d=a.end,H._isArray(o))if(c=[],u=Math.max(o.length,d.length),i.indexOf(`fill`)===0)for(l=0;l<u;l++)l%2==0?c.push((o[l]||0)+s[l]*t):c.push(`rgba(`+Math.round(o[l].r+s[l].r*t)+`,`+Math.round(o[l].g+s[l].g*t)+`,`+Math.round(o[l].b+s[l].b*t)+`,`+(o[l].a+s[l].a*t)+`)`);else for(l=0;l<u;l++)c.push((o[l]||0)+s[l]*t);else c=Cr.indexOf(i)===-1?o+s*t:`rgba(`+Math.round(o.r+s.r*t)+`,`+Math.round(o.g+s.g*t)+`,`+Math.round(o.b+s.b*t)+`,`+(o.a+s.a*t)+`)`;n.setAttr(i,c)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{let t=this.node,n=e.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr(`points`,n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{let t=this.node,n=e.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.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(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let t=this.node._id,n=this._id,r=e.tweens[t];this.pause(),this.anim&&this.anim.stop();for(let n in r)delete e.tweens[t][n];delete e.attrs[t][n],e.tweens[t]&&(Object.keys(e.tweens[t]).length===0&&delete e.tweens[t],Object.keys(e.attrs[t]).length===0&&delete e.attrs[t])}};Er.attrs={},Er.tweens={},G.prototype.to=function(e){let t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Er(e).play()};var Dr={BackEaseIn(e,t,n,r){let i=1.70158;return n*(e/=r)*e*((i+1)*e-i)+t},BackEaseOut(e,t,n,r){let i=1.70158;return n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},BackEaseInOut(e,t,n,r){let i=1.70158;return(e/=r/2)<1?n/2*(e*e*(((i*=1.525)+1)*e-i))+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},ElasticEaseIn(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),-(i*2**(10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a))+t)},ElasticEaseOut(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),i*2**(-10*e)*Math.sin((e*r-o)*(2*Math.PI)/a)+n+t)},ElasticEaseInOut(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r/2)==2?t+n:(a||=.3*1.5*r,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),e<1?-.5*(i*2**(10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a))+t:i*2**(-10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a)*.5+n+t)},BounceEaseOut(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,n,r){return n-Dr.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?Dr.BounceEaseIn(e*2,0,n,r)*.5+t:Dr.BounceEaseOut(e*2-r,0,n,r)*.5+n*.5+t},EaseIn(e,t,n,r){return n*(e/=r)*e+t},EaseOut(e,t,n,r){return-n*(e/=r)*(e-2)+t},EaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,n,r){return n*(e/=r)*e*e*e*e+t},StrongEaseOut(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,n,r){return n*e/r+t}},Or=H._assign(V,{Util:H,Transform:Pe,Node:G,Container:an,Stage:Kn,stages:Gn,Layer:mr,FastLayer:hr,Group:gr,DD:bt,Shape:K,shapes:er,Animation:vr,Tween:Er,Easings:Dr,Context:ft,Canvas:_t}),kr=class extends K{_sceneFunc(e){let t=V.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){let e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=V.getAngle(n?360-this.angle():this.angle()),i=Math.cos(Math.min(r,Math.PI)),a=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),o=Math.sin(Math.min(r,Math.PI/2)),s=i*(i>0?e:t),c=1*t,l=a*(a>0?e:t),u=o*(o>0?t:e);return{x:s,y:n?-1*u:l,width:c-s,height:u-l}}};kr.prototype._centroid=!0,kr.prototype.className=`Arc`,kr.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`,`angle`,`clockwise`],je(kr),W.addGetterSetter(kr,`innerRadius`,0,U()),W.addGetterSetter(kr,`outerRadius`,0,U()),W.addGetterSetter(kr,`angle`,0,U()),W.addGetterSetter(kr,`clockwise`,!1,Ot());function Ar(e,t,n,r,i,a,o){let s=Math.sqrt((n-e)**2+(r-t)**2),c=Math.sqrt((i-n)**2+(a-r)**2),l=o*s/(s+c),u=o*c/(s+c);return[n-l*(i-e),r-l*(a-t),n+u*(i-e),r+u*(a-t)]}function jr(e,t){let n=e.length,r=[];for(let i=2;i<n-2;i+=2){let n=Ar(e[i-2],e[i-1],e[i],e[i+1],e[i+2],e[i+3],t);isNaN(n[0])||(r.push(n[0]),r.push(n[1]),r.push(e[i]),r.push(e[i+1]),r.push(n[2]),r.push(n[3]))}return r}function Mr(e){let t=[[e[0],e[2],e[4],e[6]],[e[1],e[3],e[5],e[7]]],n=[];for(let e of t){let t=-3*e[0]+9*e[1]-9*e[2]+3*e[3];if(t!==0){let r=6*e[0]-12*e[1]+6*e[2],i=-3*e[0]+3*e[1],a=r*r-4*t*i;if(a>=0){let e=Math.sqrt(a);n.push((-r+e)/(2*t)),n.push((-r-e)/(2*t))}}}return n.filter(e=>e>0&&e<1).flatMap(e=>t.map(t=>{let n=1-e;return n*n*n*t[0]+3*n*n*e*t[1]+3*n*e*e*t[2]+e*e*e*t[3]}))}var Nr=class extends K{constructor(e){super(e),this.on(`pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva`,function(){this._clearCache(`tensionPoints`)})}_sceneFunc(e){let t=this.points(),n=t.length,r=this.tension(),i=this.closed(),a=this.bezier();if(!n)return;let o=0;if(e.beginPath(),e.moveTo(t[0],t[1]),r!==0&&n>4){let r=this.getTensionPoints(),a=r.length;for(o=i?0:4,i||e.quadraticCurveTo(r[0],r[1],r[2],r[3]);o<a-2;)e.bezierCurveTo(r[o++],r[o++],r[o++],r[o++],r[o++],r[o++]);i||e.quadraticCurveTo(r[a-2],r[a-1],t[n-2],t[n-1])}else if(a)for(o=2;o<n;)e.bezierCurveTo(t[o++],t[o++],t[o++],t[o++],t[o++],t[o++]);else for(o=2;o<n;o+=2)e.lineTo(t[o],t[o+1]);i?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache(`tensionPoints`,this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():jr(this.points(),this.tension())}_getTensionPointsClosed(){let e=this.points(),t=e.length,n=this.tension(),r=Ar(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),i=Ar(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),a=jr(e,n);return[r[2],r[3]].concat(a,[i[0],i[1],e[t-2],e[t-1],i[2],i[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};e=this.tension()===0?this.bezier()?[e[0],e[1],...Mr(this.points()),e[e.length-2],e[e.length-1]]:this.points():[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]];let t=e[0],n=e[0],r=e[1],i=e[1],a,o;for(let s=0;s<e.length/2;s++)a=e[s*2],o=e[s*2+1],t=Math.min(t,a),n=Math.max(n,a),r=Math.min(r,o),i=Math.max(i,o);return{x:t,y:r,width:n-t,height:i-r}}};Nr.prototype.className=`Line`,Nr.prototype._attrsAffectingSize=[`points`,`bezier`,`tension`],je(Nr),W.addGetterSetter(Nr,`closed`,!1),W.addGetterSetter(Nr,`bezier`,!1),W.addGetterSetter(Nr,`tension`,0,U()),W.addGetterSetter(Nr,`points`,[],Dt());var Pr=[[],[],[-.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]],Fr=[[],[],[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]],Ir=[[1],[1,1],[1,2,1],[1,3,3,1]],Lr=(e,t,n)=>{let r,i,a=n/2;r=0;for(let n=0;n<20;n++)i=a*Pr[20][n]+a,r+=Fr[20][n]*zr(e,t,i);return a*r},Rr=(e,t,n)=>{n===void 0&&(n=1);let r=e[0]-2*e[1]+e[2],i=t[0]-2*t[1]+t[2],a=2*e[1]-2*e[0],o=2*t[1]-2*t[0],s=4*(r*r+i*i),c=4*(r*a+i*o),l=a*a+o*o;if(s===0)return n*Math.sqrt((e[2]-e[0])**2+(t[2]-t[0])**2);let u=c/(2*s),d=l/s,f=n+u,p=d-u*u,m=f*f+p>0?Math.sqrt(f*f+p):0,h=u*u+p>0?Math.sqrt(u*u+p):0,g=u+Math.sqrt(u*u+p)===0?0:p*Math.log(Math.abs((f+m)/(u+h)));return Math.sqrt(s)/2*(f*m-u*h+g)};function zr(e,t,n){let r=Br(1,n,e),i=Br(1,n,t),a=r*r+i*i;return Math.sqrt(a)}var Br=(e,t,n)=>{let r=n.length-1,i,a;if(r===0)return 0;if(e===0){a=0;for(let e=0;e<=r;e++)a+=Ir[r][e]*(1-t)**(r-e)*t**+e*n[e];return a}else{i=Array(r);for(let e=0;e<r;e++)i[e]=r*(n[e+1]-n[e]);return Br(e-1,t,i)}},Vr=(e,t,n)=>{let r=1,i=e/t,a=(e-n(i))/t,o=0;for(;r>.001;){let s=n(i+a),c=Math.abs(e-s)/t;if(c<r)r=c,i+=a;else{let o=n(i-a),s=Math.abs(e-o)/t;s<r?(r=s,i-=a):a/=2}if(o++,o>500)break}return i},Hr=class e extends K{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on(`dataChange.konva`,function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=e.parsePathData(this.data()),this.pathLength=e.getPathLength(this.dataArray)}_sceneFunc(e){let t=this.dataArray;e.beginPath();let n=!1;for(let r=0;r<t.length;r++){let i=t[r].command,a=t[r].points;switch(i){case`L`:e.lineTo(a[0],a[1]);break;case`M`:e.moveTo(a[0],a[1]);break;case`C`:e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case`Q`:e.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case`A`:let t=a[0],r=a[1],i=a[2],o=a[3],s=a[4],c=a[5],l=a[6],u=a[7],d=i>o?i:o,f=i>o?1:i/o,p=i>o?o/i:1;e.translate(t,r),e.rotate(l),e.scale(f,p),e.arc(0,0,d,s,s+c,1-u),e.scale(1/f,1/p),e.rotate(-l),e.translate(-t,-r);break;case`z`:n=!0,e.closePath();break}}!n&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(n){if(n.command===`A`){let r=n.points[4],i=n.points[5],a=n.points[4]+i,o=Math.PI/180;if(Math.abs(r-a)<o&&(o=Math.abs(r-a)),i<0)for(let i=r-o;i>a;i-=o){let r=e.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],i,0);t.push(r.x,r.y)}else for(let i=r+o;i<a;i+=o){let r=e.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],i,0);t.push(r.x,r.y)}}else if(n.command===`C`)for(let r=0;r<=1;r+=.01){let i=e.getPointOnCubicBezier(r,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);t.push(i.x,i.y)}else t=t.concat(n.points)});let n=t[0],r=t[0],i=t[1],a=t[1],o,s;for(let e=0;e<t.length/2;e++)o=t[e*2],s=t[e*2+1],isNaN(o)||(n=Math.min(n,o),r=Math.max(r,o)),isNaN(s)||(i=Math.min(i,s),a=Math.max(a,s));return{x:n,y:i,width:r-n,height:a-i}}getLength(){return this.pathLength}getPointAtLength(t){return e.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPathLength(e){let t=0;for(let n=0;n<e.length;++n)t+=e[n].pathLength;return t}static getPointAtLengthOfDataArray(t,n){let r,i=0,a=n.length;if(!a)return null;for(;i<a&&t>n[i].pathLength;)t-=n[i].pathLength,++i;if(i===a)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return n[i].command===`M`?(r=n[i].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[i].start.x,y:n[i].start.y};let o=n[i],s=o.points;switch(o.command){case`L`:return e.getPointOnLine(t,o.start.x,o.start.y,s[0],s[1]);case`C`:return e.getPointOnCubicBezier(Vr(t,e.getPathLength(n),e=>Lr([o.start.x,s[0],s[2],s[4]],[o.start.y,s[1],s[3],s[5]],e)),o.start.x,o.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case`Q`:return e.getPointOnQuadraticBezier(Vr(t,e.getPathLength(n),e=>Rr([o.start.x,s[0],s[2]],[o.start.y,s[1],s[3]],e)),o.start.x,o.start.y,s[0],s[1],s[2],s[3]);case`A`:let r=s[0],i=s[1],a=s[2],c=s[3],l=s[5],u=s[6],d=s[4];return d+=l*t/o.pathLength,e.getPointOnEllipticalArc(r,i,a,c,d,u)}return null}static getPointOnLine(e,t,n,r,i,a,o){a??=t,o??=n;let s=this.getLineLength(t,n,r,i);if(s<1e-10)return{x:t,y:n};if(r===t)return{x:a,y:o+(i>n?e:-e)};let c=(i-n)/(r-t),l=Math.sqrt(e*e/(1+c*c))*(r<t?-1:1),u=c*l;if(Math.abs(o-n-c*(a-t))<1e-10)return{x:a+l,y:o+u};let d=((a-t)*(r-t)+(o-n)*(i-n))/(s*s),f=t+d*(r-t),p=n+d*(i-n),m=this.getLineLength(a,o,f,p),h=Math.sqrt(e*e-m*m),g=Math.sqrt(h*h/(1+c*c))*(r<t?-1:1),_=c*g;return{x:f+g,y:p+_}}static getPointOnCubicBezier(e,t,n,r,i,a,o,s,c){function l(e){return e*e*e}function u(e){return 3*e*e*(1-e)}function d(e){return 3*e*(1-e)*(1-e)}function f(e){return(1-e)*(1-e)*(1-e)}return{x:s*l(e)+a*u(e)+r*d(e)+t*f(e),y:c*l(e)+o*u(e)+i*d(e)+n*f(e)}}static getPointOnQuadraticBezier(e,t,n,r,i,a,o){function s(e){return e*e}function c(e){return 2*e*(1-e)}function l(e){return(1-e)*(1-e)}return{x:a*s(e)+r*c(e)+t*l(e),y:o*s(e)+i*c(e)+n*l(e)}}static getPointOnEllipticalArc(e,t,n,r,i,a){let o=Math.cos(a),s=Math.sin(a),c={x:n*Math.cos(i),y:r*Math.sin(i)};return{x:e+(c.x*o-c.y*s),y:t+(c.x*s+c.y*o)}}static parsePathData(e){if(!e)return[];let t=e,n=[`m`,`M`,`l`,`L`,`v`,`V`,`h`,`H`,`z`,`Z`,`c`,`C`,`q`,`Q`,`t`,`T`,`s`,`S`,`a`,`A`];t=t.replace(RegExp(` `,`g`),`,`);for(let e=0;e<n.length;e++)t=t.replace(new RegExp(n[e],`g`),`|`+n[e]);let r=t.split(`|`),i=[],a=[],o=0,s=0,c=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,l;for(let e=1;e<r.length;e++){let t=r[e],n=t.charAt(0);for(t=t.slice(1),a.length=0;l=c.exec(t);)a.push(l[0]);let u=[],d=n===`A`||n===`a`?0:-1;for(let e=0,t=a.length;e<t;e++){let t=a[e];if(t===`00`){u.push(0,0),d>=0&&(d+=2,d>=7&&(d-=7));continue}if(d>=0){if(d===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(t)){u.push(parseInt(t[0],10)),u.push(parseInt(t[1],10)),u.push(parseFloat(t.slice(2))),d+=3,d>=7&&(d-=7);continue}if(t===`11`||t===`10`||t===`01`){u.push(parseInt(t[0],10)),u.push(parseInt(t[1],10)),d+=2,d>=7&&(d-=7);continue}if(t===`0`||t===`1`){u.push(parseInt(t,10)),d+=1,d>=7&&(d-=7);continue}}else if(d===4){if(/^[01]\d+(?:\.\d+)?$/.test(t)){u.push(parseInt(t[0],10)),u.push(parseFloat(t.slice(1))),d+=2,d>=7&&(d-=7);continue}if(t===`0`||t===`1`){u.push(parseInt(t,10)),d+=1,d>=7&&(d-=7);continue}}let e=parseFloat(t);isNaN(e)?u.push(0):u.push(e),d+=1,d>=7&&(d-=7)}else{let e=parseFloat(t);isNaN(e)?u.push(0):u.push(e)}}for(;u.length>0&&!isNaN(u[0]);){let e=``,t=[],r=o,a=s,c,l,d,f,p,m,h,g,_,v;switch(n){case`l`:o+=u.shift(),s+=u.shift(),e=`L`,t.push(o,s);break;case`L`:o=u.shift(),s=u.shift(),t.push(o,s);break;case`m`:let r=u.shift(),a=u.shift();if(o+=r,s+=a,e=`M`,i.length>2&&i[i.length-1].command===`z`){for(let e=i.length-2;e>=0;e--)if(i[e].command===`M`){o=i[e].points[0]+r,s=i[e].points[1]+a;break}}t.push(o,s),n=`l`;break;case`M`:o=u.shift(),s=u.shift(),e=`M`,t.push(o,s),n=`L`;break;case`h`:o+=u.shift(),e=`L`,t.push(o,s);break;case`H`:o=u.shift(),e=`L`,t.push(o,s);break;case`v`:s+=u.shift(),e=`L`,t.push(o,s);break;case`V`:s=u.shift(),e=`L`,t.push(o,s);break;case`C`:t.push(u.shift(),u.shift(),u.shift(),u.shift()),o=u.shift(),s=u.shift(),t.push(o,s);break;case`c`:t.push(o+u.shift(),s+u.shift(),o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`C`,t.push(o,s);break;case`S`:l=o,d=s,c=i[i.length-1],c.command===`C`&&(l=o+(o-c.points[2]),d=s+(s-c.points[3])),t.push(l,d,u.shift(),u.shift()),o=u.shift(),s=u.shift(),e=`C`,t.push(o,s);break;case`s`:l=o,d=s,c=i[i.length-1],c.command===`C`&&(l=o+(o-c.points[2]),d=s+(s-c.points[3])),t.push(l,d,o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`C`,t.push(o,s);break;case`Q`:t.push(u.shift(),u.shift()),o=u.shift(),s=u.shift(),t.push(o,s);break;case`q`:t.push(o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`Q`,t.push(o,s);break;case`T`:l=o,d=s,c=i[i.length-1],c.command===`Q`&&(l=o+(o-c.points[0]),d=s+(s-c.points[1])),o=u.shift(),s=u.shift(),e=`Q`,t.push(l,d,o,s);break;case`t`:l=o,d=s,c=i[i.length-1],c.command===`Q`&&(l=o+(o-c.points[0]),d=s+(s-c.points[1])),o+=u.shift(),s+=u.shift(),e=`Q`,t.push(l,d,o,s);break;case`A`:f=u.shift(),p=u.shift(),m=u.shift(),h=u.shift(),g=u.shift(),_=o,v=s,o=u.shift(),s=u.shift(),e=`A`,t=this.convertEndpointToCenterParameterization(_,v,o,s,h,g,f,p,m);break;case`a`:f=u.shift(),p=u.shift(),m=u.shift(),h=u.shift(),g=u.shift(),_=o,v=s,o+=u.shift(),s+=u.shift(),e=`A`,t=this.convertEndpointToCenterParameterization(_,v,o,s,h,g,f,p,m);break}i.push({command:e||n,points:t,start:{x:r,y:a},pathLength:this.calcLength(r,a,e||n,t)})}(n===`z`||n===`Z`)&&i.push({command:`z`,points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,i){let a,o,s,c,l=e;switch(r){case`L`:return l.getLineLength(t,n,i[0],i[1]);case`C`:return Lr([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case`Q`:return Rr([t,i[0],i[2]],[n,i[1],i[3]],1);case`A`:a=0;let e=i[4],r=i[5],u=i[4]+r,d=Math.PI/180;if(Math.abs(e-u)<d&&(d=Math.abs(e-u)),o=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],e,0),r<0)for(c=e-d;c>u;c-=d)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;else for(c=e+d;c<u;c+=d)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;return s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),a}return 0}static convertEndpointToCenterParameterization(e,t,n,r,i,a,o,s,c){let l=Math.PI/180*c,u=Math.cos(l)*(e-n)/2+Math.sin(l)*(t-r)/2,d=-1*Math.sin(l)*(e-n)/2+Math.cos(l)*(t-r)/2,f=u*u/(o*o)+d*d/(s*s);f>1&&(o*=Math.sqrt(f),s*=Math.sqrt(f));let p=Math.sqrt((o*o*(s*s)-o*o*(d*d)-s*s*(u*u))/(o*o*(d*d)+s*s*(u*u)));i===a&&(p*=-1),isNaN(p)&&(p=0);let m=p*o*d/s,h=p*-s*u/o,g=(e+n)/2+Math.cos(l)*m-Math.sin(l)*h,_=(t+r)/2+Math.sin(l)*m+Math.cos(l)*h,v=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},y=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(v(e)*v(t))},b=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(y(e,t))},x=b([1,0],[(u-m)/o,(d-h)/s]),S=[(u-m)/o,(d-h)/s],C=[(-1*u-m)/o,(-1*d-h)/s],w=b(S,C);return y(S,C)<=-1&&(w=Math.PI),y(S,C)>=1&&(w=0),a===0&&w>0&&(w-=2*Math.PI),a===1&&w<0&&(w+=2*Math.PI),[g,_,o,s,x,w,l,a]}};Hr.prototype.className=`Path`,Hr.prototype._attrsAffectingSize=[`data`],je(Hr),W.addGetterSetter(Hr,`data`);var Ur=class extends Nr{_sceneFunc(e){super._sceneFunc(e);let t=Math.PI*2,n=this.points(),r=n,i=this.tension()!==0&&n.length>4;i&&(r=this.getTensionPoints());let a=this.pointerLength(),o=n.length,s,c;if(i){let e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[o-2],n[o-1]],t=Hr.calcLength(r[r.length-4],r[r.length-3],`C`,e),i=Hr.getPointOnQuadraticBezier(Math.min(1,1-a/t),e[0],e[1],e[2],e[3],e[4],e[5]);s=n[o-2]-i.x,c=n[o-1]-i.y}else s=n[o-2]-n[o-4],c=n[o-1]-n[o-3];let l=(Math.atan2(c,s)+t)%t,u=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[o-2],n[o-1]),e.rotate(l),e.moveTo(0,0),e.lineTo(-a,u/2),e.lineTo(-a,-u/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),i?(s=(r[0]+r[2])/2-n[0],c=(r[1]+r[3])/2-n[1]):(s=n[2]-n[0],c=n[3]-n[1]),e.rotate((Math.atan2(-c,-s)+t)%t),e.moveTo(0,0),e.lineTo(-a,u/2),e.lineTo(-a,-u/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){let t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){let e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};Ur.prototype.className=`Arrow`,je(Ur),W.addGetterSetter(Ur,`pointerLength`,10,U()),W.addGetterSetter(Ur,`pointerWidth`,10,U()),W.addGetterSetter(Ur,`pointerAtBeginning`,!1),W.addGetterSetter(Ur,`pointerAtEnding`,!0);var Wr=class extends K{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};Wr.prototype._centroid=!0,Wr.prototype.className=`Circle`,Wr.prototype._attrsAffectingSize=[`radius`],je(Wr),W.addGetterSetter(Wr,`radius`,0,U());var Gr=class extends K{_sceneFunc(e){let t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};Gr.prototype.className=`Ellipse`,Gr.prototype._centroid=!0,Gr.prototype._attrsAffectingSize=[`radiusX`,`radiusY`],je(Gr),W.addComponentsGetterSetter(Gr,`radius`,[`x`,`y`]),W.addGetterSetter(Gr,`radiusX`,0,U()),W.addGetterSetter(Gr,`radiusY`,0,U());var Kr=class e extends K{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on(`imageChange.konva`,e=>{this._removeImageLoad(e.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){let e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener(`load`,this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener(`load`,this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){let e=!!this.cornerRadius(),t=this.hasShadow();return e&&t?!0:super._useBufferCanvas(!0)}_sceneFunc(e){let t=this.getWidth(),n=this.getHeight(),r=this.cornerRadius(),i=this.attrs.image,a;if(i){let e=this.attrs.cropWidth,r=this.attrs.cropHeight;a=e&&r?[i,this.cropX(),this.cropY(),e,r,0,0,t,n]:[i,0,0,t,n]}(this.hasFill()||this.hasStroke()||r)&&(e.beginPath(),r?H.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),i&&(r&&e.clip(),e.drawImage.apply(e,a))}_hitFunc(e){let t=this.width(),n=this.height(),r=this.cornerRadius();e.beginPath(),r?H.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.attrs.width??this.image()?.width??0}getHeight(){return this.attrs.height??this.image()?.height??0}static fromURL(t,n,r=null){let i=H.createImageElement();i.onload=function(){n(new e({image:i}))},i.onerror=r,i.crossOrigin=`Anonymous`,i.src=t}};Kr.prototype.className=`Image`,Kr.prototype._attrsAffectingSize=[`image`],je(Kr),W.addGetterSetter(Kr,`cornerRadius`,0,Ct(4)),W.addGetterSetter(Kr,`image`),W.addComponentsGetterSetter(Kr,`crop`,[`x`,`y`,`width`,`height`]),W.addGetterSetter(Kr,`cropX`,0,U()),W.addGetterSetter(Kr,`cropY`,0,U()),W.addGetterSetter(Kr,`cropWidth`,0,U()),W.addGetterSetter(Kr,`cropHeight`,0,U());var qr=[`fontFamily`,`fontSize`,`fontStyle`,`padding`,`lineHeight`,`text`,`width`,`height`,`pointerDirection`,`pointerWidth`,`pointerHeight`],Jr=`Change.konva`,Yr=`none`,Xr=`up`,Zr=`right`,Qr=`down`,$r=`left`,ei=qr.length,ti=class extends gr{constructor(e){super(e),this.on(`add.konva`,function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find(`Text`)[0]}getTag(){return this.find(`Tag`)[0]}_addListeners(e){let t=this,n,r=function(){t._sync()};for(n=0;n<ei;n++)e.on(qr[n]+Jr,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,i,a,o,s,c;if(e&&t){switch(n=e.width(),r=e.height(),i=t.pointerDirection(),a=t.pointerWidth(),c=t.pointerHeight(),o=0,s=0,i){case Xr:o=n/2,s=-1*c;break;case Zr:o=n+a,s=r/2;break;case Qr:o=n/2,s=r+c;break;case $r:o=-1*a,s=r/2;break}t.setAttrs({x:-1*o,y:-1*s,width:n,height:r}),e.setAttrs({x:-1*o,y:-1*s})}}};ti.prototype.className=`Label`,je(ti);var ni=class extends K{_sceneFunc(e){let t=this.width(),n=this.height(),r=this.pointerDirection(),i=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius(),s=0,c=0,l=0,u=0;typeof o==`number`?s=c=l=u=Math.min(o,t/2,n/2):(s=Math.min(o[0]||0,t/2,n/2),c=Math.min(o[1]||0,t/2,n/2),u=Math.min(o[2]||0,t/2,n/2),l=Math.min(o[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(s,0),r===Xr&&(e.lineTo((t-i)/2,0),e.lineTo(t/2,-1*a),e.lineTo((t+i)/2,0)),e.lineTo(t-c,0),e.arc(t-c,c,c,Math.PI*3/2,0,!1),r===Zr&&(e.lineTo(t,(n-a)/2),e.lineTo(t+i,n/2),e.lineTo(t,(n+a)/2)),e.lineTo(t,n-u),e.arc(t-u,n-u,u,0,Math.PI/2,!1),r===Qr&&(e.lineTo((t+i)/2,n),e.lineTo(t/2,n+a),e.lineTo((t-i)/2,n)),e.lineTo(l,n),e.arc(l,n-l,l,Math.PI/2,Math.PI,!1),r===$r&&(e.lineTo(0,(n+a)/2),e.lineTo(-1*i,n/2),e.lineTo(0,(n-a)/2)),e.lineTo(0,s),e.arc(s,s,s,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),i=this.pointerDirection(),a=this.width(),o=this.height();return i===Xr?(t-=r,o+=r):i===Qr?o+=r:i===$r?(e-=n*1.5,a+=n):i===Zr&&(a+=n*1.5),{x:e,y:t,width:a,height:o}}};ni.prototype.className=`Tag`,je(ni),W.addGetterSetter(ni,`pointerDirection`,Yr),W.addGetterSetter(ni,`pointerWidth`,0,U()),W.addGetterSetter(ni,`pointerHeight`,0,U()),W.addGetterSetter(ni,`cornerRadius`,0,Ct(4));var ri=class extends K{_sceneFunc(e){let t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?H.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};ri.prototype.className=`Rect`,je(ri),W.addGetterSetter(ri,`cornerRadius`,0,Ct(4));var ii=class extends K{_sceneFunc(e){let t=this._getPoints(),n=this.radius(),r=this.sides(),i=this.cornerRadius();if(e.beginPath(),i)H.drawRoundedPolygonPath(e,t,r,n,i);else{e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){let e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){let e=this._getPoints(),t=e[0].x,n=e[0].x,r=e[0].y,i=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.y)}),{x:t,y:r,width:n-t,height:i-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};ii.prototype.className=`RegularPolygon`,ii.prototype._centroid=!0,ii.prototype._attrsAffectingSize=[`radius`],je(ii),W.addGetterSetter(ii,`radius`,0,U()),W.addGetterSetter(ii,`sides`,0,U()),W.addGetterSetter(ii,`cornerRadius`,0,Ct(4));var ai=Math.PI*2,oi=class extends K{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,ai,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),ai,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};oi.prototype.className=`Ring`,oi.prototype._centroid=!0,oi.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],je(oi),W.addGetterSetter(oi,`innerRadius`,0,U()),W.addGetterSetter(oi,`outerRadius`,0,U());var si=class extends K{constructor(e){super(e),this._updated=!0,this.anim=new vr(()=>{let e=this._updated;return this._updated=!1,e}),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(e){let t=this.animation(),n=this.frameIndex(),r=n*4,i=this.animations()[t],a=this.frameOffsets(),o=i[r+0],s=i[r+1],c=i[r+2],l=i[r+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,c,l),e.closePath(),e.fillStrokeShape(this)),u)if(a){let r=a[t],i=n*2;e.drawImage(u,o,s,c,l,r[i+0],r[i+1],c,l)}else e.drawImage(u,o,s,c,l,0,0,c,l)}_hitFunc(e){let t=this.animation(),n=this.frameIndex(),r=n*4,i=this.animations()[t],a=this.frameOffsets(),o=i[r+2],s=i[r+3];if(e.beginPath(),a){let r=a[t],i=n*2;e.rect(r[i+0],r[i+1],o,s)}else e.rect(0,0,o,s);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){let e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;let e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){let e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};si.prototype.className=`Sprite`,je(si),W.addGetterSetter(si,`animation`),W.addGetterSetter(si,`animations`),W.addGetterSetter(si,`frameOffsets`),W.addGetterSetter(si,`image`),W.addGetterSetter(si,`frameIndex`,0,U()),W.addGetterSetter(si,`frameRate`,17,U()),W.backCompat(si,{index:`frameIndex`,getIndex:`getFrameIndex`,setIndex:`setFrameIndex`});var ci=class extends K{_sceneFunc(e){let t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let i=1;i<r*2;i++){let a=i%2==0?n:t,o=a*Math.sin(i*Math.PI/r),s=-1*a*Math.cos(i*Math.PI/r);e.lineTo(o,s)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};ci.prototype.className=`Star`,ci.prototype._centroid=!0,ci.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],je(ci),W.addGetterSetter(ci,`numPoints`,5,U()),W.addGetterSetter(ci,`innerRadius`,0,U()),W.addGetterSetter(ci,`outerRadius`,0,U());function li(e){return[...e].reduce((e,t,n,r)=>{if(/\p{Emoji}/u.test(t)){let i=r[n+1];i&&/\p{Emoji_Modifier}|\u200D/u.test(i)?(e.push(t+i),r[n+1]=``):e.push(t)}else /\p{Regional_Indicator}{2}/u.test(t+(r[n+1]||``))?e.push(t+r[n+1]):n>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(t)?e[e.length-1]+=t:t&&e.push(t);return e},[])}var ui=`auto`,di=`center`,fi=`inherit`,pi=`justify`,mi=`Change.konva`,hi=`2d`,gi=`-`,_i=`left`,vi=`text`,yi=`Text`,bi=`top`,xi=`bottom`,Si=`middle`,Ci=`normal`,wi=`px `,Ti=` `,Ei=`right`,Di=`rtl`,Oi=`word`,ki=`char`,Ai=`none`,ji=`…`,Mi=[`direction`,`fontFamily`,`fontSize`,`fontStyle`,`fontVariant`,`padding`,`align`,`verticalAlign`,`lineHeight`,`text`,`width`,`height`,`wrap`,`ellipsis`,`letterSpacing`],Ni=Mi.length,Pi=null;function Fi(){if(Pi!==null)return Pi;Pi=!1;try{let e=document.createElement(`canvas`);e.width=10,e.height=10;let t=e.getContext(hi);if(t){t.globalAlpha=0,t.shadowColor=`black`,t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle=`black`,t.font=`10px Arial`,t.fillText(`X`,0,10);let e=t.getImageData(0,0,10,10).data;for(let t=3;t<e.length;t+=4)if(e[t]>0){Pi=!0;break}}}catch{}return Pi}function Ii(e){return e.split(`,`).map(e=>{e=e.trim();let t=e.indexOf(` `)>=0,n=e.indexOf(`"`)>=0||e.indexOf(`'`)>=0;return t&&!n&&(e=`"${e}"`),e}).join(`, `)}var Li;function Ri(){return Li||(Li=H.createCanvasElement().getContext(hi),Li)}function zi(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Bi(e){e.setAttr(`miterLimit`,2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Vi(e){return e||={},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||`black`),e}var Hi=class extends K{constructor(e){super(Vi(e)),this._partialTextX=0,this._partialTextY=0;for(let e=0;e<Ni;e++)this.on(Mi[e]+mi,this._setTextData);this._setTextData()}_sceneFunc(e){let t=this.textArr,n=t.length;if(!this.text())return;let r=this.padding(),i=this.fontSize(),a=this.lineHeight()*i,o=this.verticalAlign(),s=this.direction(),c=0,l=this.align(),u=this.getWidth(),d=this.letterSpacing(),f=this.charRenderFunc(),p=this.fill(),m=this.textDecoration(),h=this.underlineOffset(),g=m.indexOf(`underline`)!==-1,_=m.indexOf(`line-through`)!==-1,v;s=s===fi?e.direction:s;let y=a/2,b=Si;if(!V.legacyTextRendering){let e=this.measureSize(`M`);b=`alphabetic`,y=((e.fontBoundingBoxAscent??e.actualBoundingBoxAscent)-(e.fontBoundingBoxDescent??e.actualBoundingBoxDescent))/2+a/2}for(s===Di&&e.setAttr(`direction`,s),e.setAttr(`font`,this._getContextFont()),e.setAttr(`textBaseline`,b),e.setAttr(`textAlign`,_i),o===Si?c=(this.getHeight()-n*a-r*2)/2:o===xi&&(c=this.getHeight()-n*a-r*2),e.translate(r,c+r),v=0;v<n;v++){let o=0,c=t[v],m=c.text,b=c.width,x=c.lastInParagraph;if(e.save(),l===Ei?o+=u-b-r*2:l===di&&(o+=(u-b-r*2)/2),g){e.save(),e.beginPath();let t=h??(V.legacyTextRendering?Math.round(i/2):Math.round(i/4)),n=o,a=y+0+t;e.moveTo(n,a);let s=l===pi&&!x?u-r*2:b;e.lineTo(n+Math.round(s),a),e.lineWidth=i/15,e.strokeStyle=this._getLinearGradient()||p,e.stroke(),e.restore()}let S=o;if(s!==Di&&(d!==0||l===pi||f)){let n=m.split(` `).length-1,i=li(m);for(let a=0;a<i.length;a++){let s=i[a];if(s===` `&&!x&&l===pi&&(o+=(u-r*2-b)/n),this._partialTextX=o,this._partialTextY=y+0,this._partialText=s,f){e.save();let n=t.slice(0,v).reduce((e,t)=>e+li(t.text).length,0);f({char:s,index:a+n,x:o,y:y+0,lineIndex:v,column:a,isLastInLine:x,width:this.measureSize(s).width,context:e})}e.fillStrokeShape(this),f&&e.restore(),o+=this.measureSize(s).width+d}}else d!==0&&e.setAttr(`letterSpacing`,`${d}px`),this._partialTextX=o,this._partialTextY=y+0,this._partialText=m,e.fillStrokeShape(this);if(_){e.save(),e.beginPath();let t=V.legacyTextRendering?0:-Math.round(i/4),n=S;e.moveTo(n,y+0+t);let a=l===pi&&!x?u-r*2:b;e.lineTo(n+Math.round(a),y+0+t),e.lineWidth=i/15,e.strokeStyle=this._getLinearGradient()||p,e.stroke(),e.restore()}e.restore(),n>1&&(y+=a)}}_hitFunc(e){let t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){let t=H._isString(e)?e:e==null?``:e+``;return this._setAttr(vi,t),this}getWidth(){return this.attrs.width===ui||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===ui||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return H.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}measureSize(e){let t=Ri(),n=this.fontSize(),r;t.save(),t.font=this._getContextFont(),r=t.measureText(e),t.restore();let i=n/100;return{actualBoundingBoxAscent:r.actualBoundingBoxAscent??71.58203125*i,actualBoundingBoxDescent:r.actualBoundingBoxDescent??0,actualBoundingBoxLeft:r.actualBoundingBoxLeft??-7.421875*i,actualBoundingBoxRight:r.actualBoundingBoxRight??75.732421875*i,alphabeticBaseline:r.alphabeticBaseline??0,emHeightAscent:r.emHeightAscent??100*i,emHeightDescent:r.emHeightDescent??-20*i,fontBoundingBoxAscent:r.fontBoundingBoxAscent??91*i,fontBoundingBoxDescent:r.fontBoundingBoxDescent??21*i,hangingBaseline:r.hangingBaseline??72.80000305175781*i,ideographicBaseline:r.ideographicBaseline??-21*i,width:r.width,height:n}}_getContextFont(){return this.fontStyle()+Ti+this.fontVariant()+Ti+(this.fontSize()+wi)+Ii(this.fontFamily())}_addTextLine(e){this.align()===pi&&(e=e.trim());let t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){let t=this.letterSpacing(),n=e.length;return Ri().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
`),t=+this.fontSize(),n=0,r=this.lineHeight()*t,i=this.attrs.width,a=this.attrs.height,o=i!==ui&&i!==void 0,s=a!==ui&&a!==void 0,c=this.padding(),l=i-c*2,u=a-c*2,d=0,f=this.wrap(),p=f!==ki&&f!==Ai,m=this.ellipsis();this.textArr=[],Ri().font=this._getContextFont();let h=m?this._getTextWidth(ji):0;for(let t=0,i=e.length;t<i;++t){let a=e[t],c=this._getTextWidth(a);if(o&&c>l)for(;a.length>0;){let e=0,t=li(a).length,i=``,o=0;for(;e<t;){let n=e+t>>>1,c=li(a).slice(0,n+1).join(``),f=this._getTextWidth(c);(m&&s&&d+r>u?f+h:f)<=l?(e=n+1,i=c,o=f):t=n}if(i){if(p){let t=li(a),n=li(i),r=t[n.length],s=r===Ti||r===gi,c;if(s&&o<=l)c=n.length;else{let e=n.lastIndexOf(Ti),t=n.lastIndexOf(gi);c=Math.max(e,t)+1}c>0&&(e=c,i=t.slice(0,e).join(``),o=this._getTextWidth(i))}if(i=i.trimRight(),this._addTextLine(i),n=Math.max(n,o),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if(a=li(a).slice(e).join(``).trimLeft(),a.length>0&&(c=this._getTextWidth(a),c<=l)){this._addTextLine(a),d+=r,n=Math.max(n,c);break}}else break}else this._addTextLine(a),d+=r,n=Math.max(n,c),this._shouldHandleEllipsis(d)&&t<i-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),s&&d+r>u)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){let t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,i=r!==ui&&r!==void 0,a=r-this.padding()*2;return this.wrap()===Ai||i&&e+n>a}_tryToAddEllipsisToLastLine(){let e=this.attrs.width,t=e!==ui&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),i=this.textArr[this.textArr.length-1];!i||!r||(t&&(this._getTextWidth(i.text+ji)<n||(i.text=i.text.slice(0,i.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(i.text+ji))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){let e=this.textDecoration().indexOf(`underline`)!==-1||this.textDecoration().indexOf(`line-through`)!==-1,t=this.hasShadow();return e&&t||t&&this.getAbsoluteOpacity()!==1&&Fi()?!0:super._useBufferCanvas()}};Hi.prototype._fillFunc=zi,Hi.prototype._strokeFunc=Bi,Hi.prototype.className=yi,Hi.prototype._attrsAffectingSize=[`text`,`fontSize`,`padding`,`wrap`,`lineHeight`,`letterSpacing`],je(Hi),W.overWriteSetter(Hi,`width`,wt()),W.overWriteSetter(Hi,`height`,wt()),W.addGetterSetter(Hi,`direction`,fi),W.addGetterSetter(Hi,`fontFamily`,`Arial`),W.addGetterSetter(Hi,`fontSize`,12,U()),W.addGetterSetter(Hi,`fontStyle`,Ci),W.addGetterSetter(Hi,`fontVariant`,Ci),W.addGetterSetter(Hi,`padding`,0,U()),W.addGetterSetter(Hi,`align`,_i),W.addGetterSetter(Hi,`verticalAlign`,bi),W.addGetterSetter(Hi,`lineHeight`,1,U()),W.addGetterSetter(Hi,`wrap`,Oi),W.addGetterSetter(Hi,`ellipsis`,!1,Ot()),W.addGetterSetter(Hi,`letterSpacing`,0,U()),W.addGetterSetter(Hi,`text`,``,Tt()),W.addGetterSetter(Hi,`textDecoration`,``),W.addGetterSetter(Hi,`underlineOffset`,void 0,U()),W.addGetterSetter(Hi,`charRenderFunc`,void 0);var Ui=``,Wi=`normal`;function Gi(e){e.fillText(this.partialText,0,0)}function Ki(e){e.strokeText(this.partialText,0,0)}var qi=class extends K{constructor(e){super(e),this.dummyCanvas=H.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 Hr.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:Hr.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Hr.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr(`font`,this._getContextFont()),e.setAttr(`textBaseline`,this.textBaseline()),e.setAttr(`textAlign`,`left`),e.save();let t=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo,a=t.indexOf(`underline`)!==-1,o=t.indexOf(`line-through`)!==-1;a&&e.beginPath();for(let t=0;t<i.length;t++){e.save();let n=i[t].p0;e.translate(n.x,n.y),e.rotate(i[t].rotation),this.partialText=i[t].text,e.fillStrokeShape(this),a&&(t===0&&e.moveTo(0,r/2+1),e.lineTo(i[t].width,r/2+1)),e.restore()}if(a&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),o){e.beginPath();for(let t=0;t<i.length;t++){e.save();let n=i[t].p0;e.translate(n.x,n.y),e.rotate(i[t].rotation),t===0&&e.moveTo(0,0),e.lineTo(i[t].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=r/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();let t=this.glyphInfo;if(t.length>=1){let n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){let r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr(`lineWidth`,this.fontSize()),e.setAttr(`strokeStyle`,this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return H.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}setText(e){return Hi.prototype.setText.call(this,e)}_getContextFont(){return Hi.prototype._getContextFont.call(this)}_getTextSize(e){let t=this.dummyCanvas.getContext(`2d`);t.save(),t.font=this._getContextFont();let n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let e=li(this.text()),t=[],n=0;for(let r=0;r<e.length;r++)t.push({char:e[r],width:this._getTextSize(e[r]).width}),n+=t[r].width;let{width:r,height:i}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=i,this.glyphInfo=[],!this.attrs.data)return null;let a=this.letterSpacing(),o=this.align(),s=this.kerningFunc(),c=Math.max(0,n-r),l=Math.max(this.textWidth+((this.attrs.text||``).length-1)*a,0),u=0;o===`center`&&(u=Math.max(0,this.pathLength/2-l/2)),o===`right`&&(u=Math.max(0,this.pathLength-l));let d=u;for(let n=0;n<t.length;n++){let r=this._getPointAtLength(d);if(!r)return;let i=t[n].char,u=t[n].width+a;if(i===` `&&o===`justify`){let e=this.text().split(` `).length-1;u+=(this.pathLength-l)/e}let f=d+u,p=this._getPointAtLength(f>this.pathLength&&f-this.pathLength<=c?this.pathLength:f);if(!p)return;let m=Hr.getLineLength(r.x,r.y,p.x,p.y),h=0;if(s)try{h=s(t[n-1].char,i)*this.fontSize()}catch{h=0}r.x+=h,p.x+=h,this.textWidth+=h;let g=Hr.getPointOnLine(h+m/2,r.x,r.y,p.x,p.y),_=Math.atan2(p.y-r.y,p.x-r.x);this.glyphInfo.push({transposeX:g.x,transposeY:g.y,text:e[n],rotation:_,p0:r,p1:p,width:m}),d+=u}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let e=[];this.glyphInfo.forEach(function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,i=e[1]||0,a,o;for(let s=0;s<e.length/2;s++)a=e[s*2],o=e[s*2+1],t=Math.min(t,a),n=Math.max(n,a),r=Math.min(r,o),i=Math.max(i,o);let s=this.fontSize();return{x:t-s/2,y:r-s/2,width:n-t+s,height:i-r+s}}destroy(){return H.releaseCanvas(this.dummyCanvas),super.destroy()}};qi.prototype._fillFunc=Gi,qi.prototype._strokeFunc=Ki,qi.prototype._fillFuncHit=Gi,qi.prototype._strokeFuncHit=Ki,qi.prototype.className=`TextPath`,qi.prototype._attrsAffectingSize=[`text`,`fontSize`,`data`],je(qi),W.addGetterSetter(qi,`data`),W.addGetterSetter(qi,`fontFamily`,`Arial`),W.addGetterSetter(qi,`fontSize`,12,U()),W.addGetterSetter(qi,`fontStyle`,Wi),W.addGetterSetter(qi,`align`,`left`),W.addGetterSetter(qi,`letterSpacing`,0,U()),W.addGetterSetter(qi,`textBaseline`,`middle`),W.addGetterSetter(qi,`fontVariant`,Wi),W.addGetterSetter(qi,`text`,Ui),W.addGetterSetter(qi,`textDecoration`,``),W.addGetterSetter(qi,`kerningFunc`,void 0);var Ji=`tr-konva`,Yi=[`resizeEnabledChange`,`rotateAnchorOffsetChange`,`rotateAnchorAngleChange`,`rotateEnabledChange`,`enabledAnchorsChange`,`anchorSizeChange`,`borderEnabledChange`,`borderStrokeChange`,`borderStrokeWidthChange`,`borderDashChange`,`anchorStrokeChange`,`anchorStrokeWidthChange`,`anchorFillChange`,`anchorCornerRadiusChange`,`ignoreStrokeChange`,`anchorStyleFuncChange`].map(e=>e+`.${Ji}`).join(` `),Xi=`nodesRect`,Zi=[`widthChange`,`heightChange`,`scaleXChange`,`scaleYChange`,`skewXChange`,`skewYChange`,`rotationChange`,`offsetXChange`,`offsetYChange`,`transformsEnabledChange`,`strokeWidthChange`,`draggableChange`],Qi={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},$i=`ontouchstart`in V._global;function ea(e,t,n){if(e===`rotater`)return n;t+=H.degToRad(Qi[e]||0);let r=(H.radToDeg(t)%360+360)%360;return H._inRange(r,337.5,360)||H._inRange(r,0,22.5)?`ns-resize`:H._inRange(r,22.5,67.5)?`nesw-resize`:H._inRange(r,67.5,112.5)?`ew-resize`:H._inRange(r,112.5,157.5)?`nwse-resize`:H._inRange(r,157.5,202.5)?`ns-resize`:H._inRange(r,202.5,247.5)?`nesw-resize`:H._inRange(r,247.5,292.5)?`ew-resize`:H._inRange(r,292.5,337.5)?`nwse-resize`:(H.error(`Transformer has unknown angle for cursor detection: `+r),`pointer`)}var ta=[`top-left`,`top-center`,`top-right`,`middle-right`,`middle-left`,`bottom-left`,`bottom-center`,`bottom-right`],na=1e8;function ra(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function ia(e,t,n){let r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:i}}function aa(e,t){return ia(e,t,ra(e))}function oa(e,t,n){let r=t;for(let i=0;i<e.length;i++){let a=V.getAngle(e[i]),o=Math.abs(a-t)%(Math.PI*2);Math.min(o,Math.PI*2-o)<n&&(r=a)}return r}var sa=0,ca=class extends gr{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Yi,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return H.warn(`tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead.`),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Ji+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();let t=e.filter(e=>e.isAncestorOf(this)?(H.error(`Konva.Transformer cannot be an a child of the node you are trying to attach`),!1):!0);return this._nodes=e=t,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(e=>{let t=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(e._attrsAffectingSize.length){let n=e._attrsAffectingSize.map(e=>e+`Change.`+this._getEventNamespace()).join(` `);e.on(n,t)}e.on(Zi.map(e=>e+`.${this._getEventNamespace()}`).join(` `),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)}),this._resetTransformCache(),this.findOne(`.top-left`)&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(`.back`)&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;let r=e.getAbsolutePosition(),i=r.x-t.x,a=r.y-t.y;this.nodes().forEach(t=>{if(t===e||t.isDragging())return;let r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+i,y:r.y+a}),t.startDrag(n)}),t=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off(`.`+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Xi),this._clearCache(`transform`),this._clearSelfAndDescendantCache(`absoluteTransform`)}_getNodeRect(){return this._getCache(Xi,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){let r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),i=e.getAbsoluteScale(n),a=e.getAbsolutePosition(n),o=r.x*i.x-e.offsetX()*i.x,s=r.y*i.y-e.offsetY()*i.y,c=(V.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return ia({x:a.x+o*Math.cos(c)+s*Math.sin(-c),y:a.y+s*Math.cos(c)+o*Math.sin(c),width:r.width*i.x,height:r.height*i.y,rotation:c},-V.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-na,y:-na,width:0,height:0,rotation:0};let e=[];this.nodes().map(t=>{let n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],i=t.getAbsoluteTransform();r.forEach(function(t){let n=i.point(t);e.push(n)})});let t=new Pe;t.rotate(-V.getAngle(this.rotation()));let n=1/0,r=1/0,i=-1/0,a=-1/0;e.forEach(function(e){let o=t.point(e);n===void 0&&(n=i=o.x,r=a=o.y),n=Math.min(n,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),a=Math.max(a,o.y)}),t.invert();let o=t.point({x:n,y:r});return{x:o.x,y:o.y,width:i-n,height:a-r,rotation:V.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(),ta.forEach(e=>{this._createAnchor(e)}),this._createAnchor(`rotater`),this._elementsCreated=!0}_createAnchor(e){let t=new ri({stroke:`rgb(0, 161, 255)`,fill:`white`,strokeWidth:1,name:e+` _anchor`,dragDistance:0,draggable:!0,hitStrokeWidth:$i?10:`auto`}),n=this;t.on(`mousedown touchstart`,function(e){n._handleMouseDown(e)}),t.on(`dragstart`,e=>{t.stopDrag(),e.cancelBubble=!0}),t.on(`dragend`,e=>{e.cancelBubble=!0}),t.on(`mouseenter`,()=>{let n=ea(e,V.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=n),this._cursorChange=!0}),t.on(`mouseout`,()=>{t.getStage().content&&(t.getStage().content.style.cursor=``),this._cursorChange=!1}),this.add(t)}_createBack(){let e=new K({name:`back`,width:0,height:0,sceneFunc(e,t){let n=t.getParent(),r=n.padding(),i=t.width(),a=t.height();if(e.beginPath(),e.rect(-r,-r,i+r*2,a+r*2),n.rotateEnabled()&&n.rotateLineVisible()){let t=n.rotateAnchorAngle(),r=n.rotateAnchorOffset(),o=H.degToRad(t),s=Math.sin(o),c=-Math.cos(o),l=i/2,u=a/2,d=1/0;c<0?d=Math.min(d,-u/c):c>0&&(d=Math.min(d,(a-u)/c)),s<0?d=Math.min(d,-l/s):s>0&&(d=Math.min(d,(i-l)/s));let f=l+s*d,p=u+c*d,m=H._sign(a),h=f+s*r*m,g=p+c*r*m;e.moveTo(f,p),e.lineTo(h,g)}e.fillStrokeShape(t)},hitFunc:(e,t)=>{if(!this.shouldOverdrawWholeArea())return;let n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+n*2,t.height()+n*2),e.fillStrokeShape(t)}});this.add(e),this._proxyDrag(e),e.on(`dragstart`,e=>{e.cancelBubble=!0}),e.on(`dragmove`,e=>{e.cancelBubble=!0}),e.on(`dragend`,e=>{e.cancelBubble=!0}),this.on(`dragmove`,e=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(` `)[0];let t=this._getNodeRect(),n=t.width,r=t.height,i=Math.sqrt(n**2+r**2);this.sin=Math.abs(r/i),this.cos=Math.abs(n/i),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;let a=e.target.getAbsolutePosition(),o=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:o.x-a.x,y:o.y-a.y},sa++,this._fire(`transformstart`,{evt:e.evt,target:this.getNode()}),this._nodes.forEach(t=>{t._fire(`transformstart`,{evt:e.evt,target:t})})}_handleMouseMove(e){let t,n,r,i=this.findOne(`.`+this._movingAnchorName),a=i.getStage();a.setPointersPositions(e);let o=a.getPointerPosition(),s={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y},c=i.getAbsolutePosition();this.anchorDragBoundFunc()&&(s=this.anchorDragBoundFunc()(c,s,e)),i.setAbsolutePosition(s);let l=i.getAbsolutePosition();if(c.x===l.x&&c.y===l.y)return;if(this._movingAnchorName===`rotater`){let r=this._getNodeRect();t=i.x()-r.width/2,n=-i.y()+r.height/2;let a=V.getAngle(this.rotateAnchorAngle()),o=Math.atan2(-n,t)+Math.PI/2-a;r.height<0&&(o-=Math.PI);let s=V.getAngle(this.rotation())+o,c=V.getAngle(this.rotationSnapTolerance()),l=aa(r,oa(this.rotationSnaps(),s,c)-r.rotation);this._fitNodesInto(l,e);return}let u=this.shiftBehavior(),d;d=u===`inverted`?this.keepRatio()&&!e.shiftKey:u===`none`?this.keepRatio():this.keepRatio()||e.shiftKey;let f=this.centeredScaling()||e.altKey;if(this._movingAnchorName===`top-left`){if(d){let e=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.bottom-right`).x(),y:this.findOne(`.bottom-right`).y()};r=Math.sqrt((e.x-i.x())**2+(e.y-i.y())**2);let a=this.findOne(`.top-left`).x()>e.x?-1:1,o=this.findOne(`.top-left`).y()>e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.top-left`).x(e.x-t),this.findOne(`.top-left`).y(e.y-n)}}else if(this._movingAnchorName===`top-center`)this.findOne(`.top-left`).y(i.y());else if(this._movingAnchorName===`top-right`){if(d){let e=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.bottom-left`).x(),y:this.findOne(`.bottom-left`).y()};r=Math.sqrt((i.x()-e.x)**2+(e.y-i.y())**2);let a=this.findOne(`.top-right`).x()<e.x?-1:1,o=this.findOne(`.top-right`).y()>e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.top-right`).x(e.x+t),this.findOne(`.top-right`).y(e.y-n)}var p=i.position();this.findOne(`.top-left`).y(p.y),this.findOne(`.bottom-right`).x(p.x)}else if(this._movingAnchorName===`middle-left`)this.findOne(`.top-left`).x(i.x());else if(this._movingAnchorName===`middle-right`)this.findOne(`.bottom-right`).x(i.x());else if(this._movingAnchorName===`bottom-left`){if(d){let e=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.top-right`).x(),y:this.findOne(`.top-right`).y()};r=Math.sqrt((e.x-i.x())**2+(i.y()-e.y)**2);let a=e.x<i.x()?-1:1,o=i.y()<e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,i.x(e.x-t),i.y(e.y+n)}p=i.position(),this.findOne(`.top-left`).x(p.x),this.findOne(`.bottom-right`).y(p.y)}else if(this._movingAnchorName===`bottom-center`)this.findOne(`.bottom-right`).y(i.y());else if(this._movingAnchorName===`bottom-right`){if(d){let e=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.top-left`).x(),y:this.findOne(`.top-left`).y()};r=Math.sqrt((i.x()-e.x)**2+(i.y()-e.y)**2);let a=this.findOne(`.bottom-right`).x()<e.x?-1:1,o=this.findOne(`.bottom-right`).y()<e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.bottom-right`).x(e.x+t),this.findOne(`.bottom-right`).y(e.y+n)}}else console.error(Error(`Wrong position argument of selection resizer: `+this._movingAnchorName));if(f=this.centeredScaling()||e.altKey,f){let e=this.findOne(`.top-left`),t=this.findOne(`.bottom-right`),n=e.x(),r=e.y(),i=this.getWidth()-t.x(),a=this.getHeight()-t.y();t.move({x:-n,y:-r}),e.move({x:i,y:a})}let m=this.findOne(`.top-left`).getAbsolutePosition();t=m.x,n=m.y;let h=this.findOne(`.bottom-right`).x()-this.findOne(`.top-left`).x(),g=this.findOne(`.bottom-right`).y()-this.findOne(`.top-left`).y();this._fitNodesInto({x:t,y:n,width:h,height:g,rotation:V.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var t;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));let n=this.getNode();sa--,this._fire(`transformend`,{evt:e,target:n}),(t=this.getLayer())==null||t.batchDraw(),n&&this._nodes.forEach(t=>{var n;t._fire(`transformend`,{evt:e,target:t}),(n=t.getLayer())==null||n.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t){let n=this._getNodeRect();if(H._inRange(e.width,-this.padding()*2-1,1)){this.update();return}if(H._inRange(e.height,-this.padding()*2-1,1)){this.update();return}let r=new Pe;if(r.rotate(V.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`left`)>=0){let t=r.point({x:-this.padding()*2,y:0});e.x+=t.x,e.y+=t.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace(`left`,`right`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`right`)>=0){let t=r.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace(`right`,`left`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`top`)>=0){let t=r.point({x:0,y:-this.padding()*2});e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace(`top`,`bottom`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`bottom`)>=0){let t=r.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace(`bottom`,`top`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){let t=this.boundBoxFunc()(n,e);t?e=t:H.warn(`boundBoxFunc returned falsy. You should return new bound rect from it!`)}let i=1e7,a=new Pe;a.translate(n.x,n.y),a.rotate(n.rotation),a.scale(n.width/i,n.height/i);let o=new Pe,s=e.width/i,c=e.height/i;this.flipEnabled()===!1?(o.translate(e.x,e.y),o.rotate(e.rotation),o.translate(e.width<0?e.width:0,e.height<0?e.height:0),o.scale(Math.abs(s),Math.abs(c))):(o.translate(e.x,e.y),o.rotate(e.rotation),o.scale(s,c));let l=o.multiply(a.invert());this._nodes.forEach(e=>{var t;if(!e.getStage())return;let n=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());let i=new Pe;i.multiply(n.copy().invert()).multiply(l).multiply(n).multiply(r);let a=i.decompose();e.setAttrs(a),(t=e.getLayer())==null||t.batchDraw()}),this.rotation(H._getRotation(e.rotation)),this._nodes.forEach(e=>{this._fire(`transform`,{evt:t,target:e}),e._fire(`transform`,{evt:t,target:e})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;let t=this._getNodeRect();this.rotation(H._getRotation(t.rotation));let n=t.width,r=t.height,i=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),s=this.anchorSize(),c=this.find(`._anchor`);c.forEach(e=>{e.setAttrs({width:s,height:s,offsetX:s/2,offsetY:s/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(`.top-left`,{x:0,y:0,offsetX:s/2+o,offsetY:s/2+o,visible:a&&i.indexOf(`top-left`)>=0}),this._batchChangeChild(`.top-center`,{x:n/2,y:0,offsetY:s/2+o,visible:a&&i.indexOf(`top-center`)>=0}),this._batchChangeChild(`.top-right`,{x:n,y:0,offsetX:s/2-o,offsetY:s/2+o,visible:a&&i.indexOf(`top-right`)>=0}),this._batchChangeChild(`.middle-left`,{x:0,y:r/2,offsetX:s/2+o,visible:a&&i.indexOf(`middle-left`)>=0}),this._batchChangeChild(`.middle-right`,{x:n,y:r/2,offsetX:s/2-o,visible:a&&i.indexOf(`middle-right`)>=0}),this._batchChangeChild(`.bottom-left`,{x:0,y:r,offsetX:s/2+o,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-left`)>=0}),this._batchChangeChild(`.bottom-center`,{x:n/2,y:r,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-center`)>=0}),this._batchChangeChild(`.bottom-right`,{x:n,y:r,offsetX:s/2-o,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-right`)>=0});let l=this.rotateAnchorAngle(),u=this.rotateAnchorOffset(),d=H.degToRad(l),f=Math.sin(d),p=-Math.cos(d),m=n/2,h=r/2,g=1/0;p<0?g=Math.min(g,-h/p):p>0&&(g=Math.min(g,(r-h)/p)),f<0?g=Math.min(g,-m/f):f>0&&(g=Math.min(g,(n-m)/f));let _=m+f*g,v=h+p*g,y=H._sign(r);this._batchChangeChild(`.rotater`,{x:_+f*u*y,y:v+p*u*y-o*p,visible:this.rotateEnabled()}),this._batchChangeChild(`.back`,{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(e=>e.draggable()),x:0,y:0});let b=this.anchorStyleFunc();b&&c.forEach(e=>{b(e)}),(e=this.getLayer())==null||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();let e=this.findOne(`.`+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=``),gr.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(H.error(`You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead.`),this):super.add(...e)}toObject(){return G.prototype.toObject.call(this)}clone(e){return G.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};ca.isTransforming=()=>sa>0;function la(e){return e instanceof Array||H.warn(`enabledAnchors value should be an array`),e instanceof Array&&e.forEach(function(e){ta.indexOf(e)===-1&&H.warn(`Unknown anchor name: `+e+`. Available names are: `+ta.join(`, `))}),e||[]}ca.prototype.className=`Transformer`,je(ca),W.addGetterSetter(ca,`enabledAnchors`,ta,la),W.addGetterSetter(ca,`flipEnabled`,!0,Ot()),W.addGetterSetter(ca,`resizeEnabled`,!0),W.addGetterSetter(ca,`anchorSize`,10,U()),W.addGetterSetter(ca,`rotateEnabled`,!0),W.addGetterSetter(ca,`rotateLineVisible`,!0),W.addGetterSetter(ca,`rotationSnaps`,[]),W.addGetterSetter(ca,`rotateAnchorOffset`,50,U()),W.addGetterSetter(ca,`rotateAnchorAngle`,0,U()),W.addGetterSetter(ca,`rotateAnchorCursor`,`crosshair`),W.addGetterSetter(ca,`rotationSnapTolerance`,5,U()),W.addGetterSetter(ca,`borderEnabled`,!0),W.addGetterSetter(ca,`anchorStroke`,`rgb(0, 161, 255)`),W.addGetterSetter(ca,`anchorStrokeWidth`,1,U()),W.addGetterSetter(ca,`anchorFill`,`white`),W.addGetterSetter(ca,`anchorCornerRadius`,0,U()),W.addGetterSetter(ca,`borderStroke`,`rgb(0, 161, 255)`),W.addGetterSetter(ca,`borderStrokeWidth`,1,U()),W.addGetterSetter(ca,`borderDash`),W.addGetterSetter(ca,`keepRatio`,!0),W.addGetterSetter(ca,`shiftBehavior`,`default`),W.addGetterSetter(ca,`centeredScaling`,!1),W.addGetterSetter(ca,`ignoreStroke`,!1),W.addGetterSetter(ca,`padding`,0,U()),W.addGetterSetter(ca,`nodes`),W.addGetterSetter(ca,`node`),W.addGetterSetter(ca,`boundBoxFunc`),W.addGetterSetter(ca,`anchorDragBoundFunc`),W.addGetterSetter(ca,`anchorStyleFunc`),W.addGetterSetter(ca,`shouldOverdrawWholeArea`,!1),W.addGetterSetter(ca,`useSingleNodeRotation`,!0),W.backCompat(ca,{lineEnabled:`borderEnabled`,rotateHandlerOffset:`rotateAnchorOffset`,enabledHandlers:`enabledAnchors`});var ua=class extends K{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,V.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};ua.prototype.className=`Wedge`,ua.prototype._centroid=!0,ua.prototype._attrsAffectingSize=[`radius`],je(ua),W.addGetterSetter(ua,`radius`,0,U()),W.addGetterSetter(ua,`angle`,0,U()),W.addGetterSetter(ua,`clockwise`,!1),W.backCompat(ua,{angleDeg:`angle`,getAngleDeg:`getAngle`,setAngleDeg:`setAngle`});function da(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var fa=[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],pa=[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 ma(e,t){let n=e.data,r=e.width,i=e.height,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=t+t+1,E=r-1,D=i-1,O=t+1,k=O*(O+1)/2,A=new da,j=fa[t],ee=pa[t],M=null,N=A,P=null,F=null;for(let e=1;e<T;e++)N=N.next=new da,e===O&&(M=N);N.next=A,s=o=0;for(let e=0;e<i;e++){g=_=v=y=c=l=u=d=0,f=O*(b=n[o]),p=O*(x=n[o+1]),m=O*(S=n[o+2]),h=O*(C=n[o+3]),c+=k*b,l+=k*x,u+=k*S,d+=k*C,N=A;for(let e=0;e<O;e++)N.r=b,N.g=x,N.b=S,N.a=C,N=N.next;for(let e=1;e<O;e++)a=o+((E<e?E:e)<<2),c+=(N.r=b=n[a])*(w=O-e),l+=(N.g=x=n[a+1])*w,u+=(N.b=S=n[a+2])*w,d+=(N.a=C=n[a+3])*w,g+=b,_+=x,v+=S,y+=C,N=N.next;P=A,F=M;for(let e=0;e<r;e++)n[o+3]=C=d*j>>ee,C===0?n[o]=n[o+1]=n[o+2]=0:(C=255/C,n[o]=(c*j>>ee)*C,n[o+1]=(l*j>>ee)*C,n[o+2]=(u*j>>ee)*C),c-=f,l-=p,u-=m,d-=h,f-=P.r,p-=P.g,m-=P.b,h-=P.a,a=s+((a=e+t+1)<E?a:E)<<2,g+=P.r=n[a],_+=P.g=n[a+1],v+=P.b=n[a+2],y+=P.a=n[a+3],c+=g,l+=_,u+=v,d+=y,P=P.next,f+=b=F.r,p+=x=F.g,m+=S=F.b,h+=C=F.a,g-=b,_-=x,v-=S,y-=C,F=F.next,o+=4;s+=r}for(let e=0;e<r;e++){_=v=y=g=l=u=d=c=0,o=e<<2,f=O*(b=n[o]),p=O*(x=n[o+1]),m=O*(S=n[o+2]),h=O*(C=n[o+3]),c+=k*b,l+=k*x,u+=k*S,d+=k*C,N=A;for(let e=0;e<O;e++)N.r=b,N.g=x,N.b=S,N.a=C,N=N.next;let s=r;for(let i=1;i<=t;i++)o=s+e<<2,c+=(N.r=b=n[o])*(w=O-i),l+=(N.g=x=n[o+1])*w,u+=(N.b=S=n[o+2])*w,d+=(N.a=C=n[o+3])*w,g+=b,_+=x,v+=S,y+=C,N=N.next,i<D&&(s+=r);o=e,P=A,F=M;for(let t=0;t<i;t++)a=o<<2,n[a+3]=C=d*j>>ee,C>0?(C=255/C,n[a]=(c*j>>ee)*C,n[a+1]=(l*j>>ee)*C,n[a+2]=(u*j>>ee)*C):n[a]=n[a+1]=n[a+2]=0,c-=f,l-=p,u-=m,d-=h,f-=P.r,p-=P.g,m-=P.b,h-=P.a,a=e+((a=t+O)<D?a:D)*r<<2,c+=g+=P.r=n[a],l+=_+=P.g=n[a+1],u+=v+=P.b=n[a+2],d+=y+=P.a=n[a+3],P=P.next,f+=b=F.r,p+=x=F.g,m+=S=F.b,h+=C=F.a,g-=b,_-=x,v-=S,y-=C,F=F.next,o+=r}}var ha=function(e){let t=Math.round(this.blurRadius());t>0&&ma(e,t)};W.addGetterSetter(G,`blurRadius`,0,U(),W.afterSetFilter);var ga=function(e){let t=this.brightness()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]+=t,n[e+1]+=t,n[e+2]+=t};W.addGetterSetter(G,`brightness`,0,U(),W.afterSetFilter);var _a=function(e){let t=this.brightness(),n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]=Math.min(255,n[e]*t),n[e+1]=Math.min(255,n[e+1]*t),n[e+2]=Math.min(255,n[e+2]*t)},va=function(e){let t=((this.contrast()+100)/100)**2,n=e.data,r=n.length,i=150,a=150,o=150;for(let e=0;e<r;e+=4)i=n[e],a=n[e+1],o=n[e+2],i/=255,i-=.5,i*=t,i+=.5,i*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,o/=255,o-=.5,o*=t,o+=.5,o*=255,i=i<0?0:i>255?255:i,a=a<0?0:a>255?255:a,o=o<0?0:o>255?255:o,n[e]=i,n[e+1]=a,n[e+2]=o};W.addGetterSetter(G,`contrast`,0,U(),W.afterSetFilter);var ya=function(e){let t=e.data,n=e.width,r=e.height,i=Math.min(1,Math.max(0,this.embossStrength?.call(this)??.5)),a=Math.min(1,Math.max(0,this.embossWhiteLevel?.call(this)??.5)),o={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[this.embossDirection?.call(this)??`top-left`]??315,s=!!(this.embossBlend?.call(this)??!1),c=i*10,l=a*255,u=o*Math.PI/180,d=Math.cos(u),f=Math.sin(u),p=128/1020*c,m=new Uint8ClampedArray(t),h=new Float32Array(n*r);for(let e=0,n=0;n<t.length;n+=4,e++)h[e]=.2126*m[n]+.7152*m[n+1]+.0722*m[n+2];let g=[-1,0,1,-2,0,2,-1,0,1],_=[-1,-2,-1,0,0,0,1,2,1],v=[-n-1,-n,-n+1,-1,0,1,n-1,n,n+1],y=e=>e<0?0:e>255?255:e;for(let e=1;e<r-1;e++)for(let r=1;r<n-1;r++){let i=e*n+r,a=0,o=0;a+=h[i+v[0]]*g[0],o+=h[i+v[0]]*_[0],a+=h[i+v[1]]*g[1],o+=h[i+v[1]]*_[1],a+=h[i+v[2]]*g[2],o+=h[i+v[2]]*_[2],a+=h[i+v[3]]*g[3],o+=h[i+v[3]]*_[3],a+=h[i+v[5]]*g[5],o+=h[i+v[5]]*_[5],a+=h[i+v[6]]*g[6],o+=h[i+v[6]]*_[6],a+=h[i+v[7]]*g[7],o+=h[i+v[7]]*_[7],a+=h[i+v[8]]*g[8],o+=h[i+v[8]]*_[8];let c=y(l+(d*a+f*o)*p),u=i*4;if(s){let e=c-l;t[u]=y(m[u]+e),t[u+1]=y(m[u+1]+e),t[u+2]=y(m[u+2]+e),t[u+3]=m[u+3]}else t[u]=t[u+1]=t[u+2]=c,t[u+3]=m[u+3]}for(let e=0;e<n;e++){let i=e*4,a=((r-1)*n+e)*4;t[i]=m[i],t[i+1]=m[i+1],t[i+2]=m[i+2],t[i+3]=m[i+3],t[a]=m[a],t[a+1]=m[a+1],t[a+2]=m[a+2],t[a+3]=m[a+3]}for(let e=1;e<r-1;e++){let r=e*n*4,i=(e*n+(n-1))*4;t[r]=m[r],t[r+1]=m[r+1],t[r+2]=m[r+2],t[r+3]=m[r+3],t[i]=m[i],t[i+1]=m[i+1],t[i+2]=m[i+2],t[i+3]=m[i+3]}return e};W.addGetterSetter(G,`embossStrength`,.5,U(),W.afterSetFilter),W.addGetterSetter(G,`embossWhiteLevel`,.5,U(),W.afterSetFilter),W.addGetterSetter(G,`embossDirection`,`top-left`,void 0,W.afterSetFilter),W.addGetterSetter(G,`embossBlend`,!1,void 0,W.afterSetFilter);function ba(e,t,n,r,i){let a=n-t,o=i-r;if(a===0)return r+o/2;if(o===0)return r;let s=(e-t)/a;return s=o*s+r,s}var xa=function(e){let t=e.data,n=t.length,r=t[0],i=r,a,o=t[1],s=o,c,l=t[2],u=l,d,f=this.enhance();if(f===0)return;for(let e=0;e<n;e+=4)a=t[e+0],a<r?r=a:a>i&&(i=a),c=t[e+1],c<o?o=c:c>s&&(s=c),d=t[e+2],d<l?l=d:d>u&&(u=d);i===r&&(i=255,r=0),s===o&&(s=255,o=0),u===l&&(u=255,l=0);let p,m,h,g,_,v;if(f>0)p=i+f*(255-i),m=r-f*(r-0),h=s+f*(255-s),g=o-f*(o-0),_=u+f*(255-u),v=l-f*(l-0);else{let e=(i+r)*.5;p=i+f*(i-e),m=r+f*(r-e);let t=(s+o)*.5;h=s+f*(s-t),g=o+f*(o-t);let n=(u+l)*.5;_=u+f*(u-n),v=l+f*(l-n)}for(let e=0;e<n;e+=4)t[e+0]=ba(t[e+0],r,i,m,p),t[e+1]=ba(t[e+1],o,s,g,h),t[e+2]=ba(t[e+2],l,u,v,_)};W.addGetterSetter(G,`enhance`,0,U(),W.afterSetFilter);var Sa=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=.34*t[e]+.5*t[e+1]+.16*t[e+2];t[e]=n,t[e+1]=n,t[e+2]=n}};W.addGetterSetter(G,`hue`,0,U(),W.afterSetFilter),W.addGetterSetter(G,`saturation`,0,U(),W.afterSetFilter),W.addGetterSetter(G,`luminance`,0,U(),W.afterSetFilter);var Ca=function(e){let t=e.data,n=t.length,r=2**this.saturation(),i=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o=1*r*Math.cos(i*Math.PI/180),s=1*r*Math.sin(i*Math.PI/180),c=.299*1+.701*o+.167*s,l=.587*1-.587*o+.33*s,u=.114*1-.114*o-.497*s,d=.299*1-.299*o-.328*s,f=.587*1+.413*o+.035*s,p=.114*1-.114*o+.293*s,m=.299*1-.3*o+1.25*s,h=.587*1-.586*o-1.05*s,g=.114*1+.886*o-.2*s,_,v,y,b;for(let e=0;e<n;e+=4)_=t[e+0],v=t[e+1],y=t[e+2],b=t[e+3],t[e+0]=c*_+l*v+u*y+a,t[e+1]=d*_+f*v+p*y+a,t[e+2]=m*_+h*v+g*y+a,t[e+3]=b},wa=function(e){let t=e.data,n=t.length,r=2**this.value(),i=2**this.saturation(),a=Math.abs(this.hue()+360)%360,o=r*i*Math.cos(a*Math.PI/180),s=r*i*Math.sin(a*Math.PI/180),c=.299*r+.701*o+.167*s,l=.587*r-.587*o+.33*s,u=.114*r-.114*o-.497*s,d=.299*r-.299*o-.328*s,f=.587*r+.413*o+.035*s,p=.114*r-.114*o+.293*s,m=.299*r-.3*o+1.25*s,h=.587*r-.586*o-1.05*s,g=.114*r+.886*o-.2*s;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],i=t[e+2],a=t[e+3];t[e+0]=c*n+l*r+u*i,t[e+1]=d*n+f*r+p*i,t[e+2]=m*n+h*r+g*i,t[e+3]=a}};W.addGetterSetter(G,`hue`,0,U(),W.afterSetFilter),W.addGetterSetter(G,`saturation`,0,U(),W.afterSetFilter),W.addGetterSetter(G,`value`,0,U(),W.afterSetFilter);var q=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2]},Ta=function(e,t,n){let r=e.data,i=t.data,a=e.width,o=e.height,s=n.polarCenterX||a/2,c=n.polarCenterY||o/2,l=Math.sqrt(s*s+c*c),u=a-s,d=o-c,f=Math.sqrt(u*u+d*d);l=f>l?f:l;let p=o,m=a,h=360/m*Math.PI/180;for(let e=0;e<m;e+=1){let t=Math.sin(e*h),n=Math.cos(e*h);for(let o=0;o<p;o+=1){u=Math.floor(s+l*o/p*n),d=Math.floor(c+l*o/p*t);let f=(d*a+u)*4,m=r[f+0],h=r[f+1],g=r[f+2],_=r[f+3];f=(e+o*a)*4,i[f+0]=m,i[f+1]=h,i[f+2]=g,i[f+3]=_}}},Ea=function(e,t,n){let r=e.data,i=t.data,a=e.width,o=e.height,s=n.polarCenterX||a/2,c=n.polarCenterY||o/2,l=Math.sqrt(s*s+c*c),u=a-s,d=o-c,f=Math.sqrt(u*u+d*d);l=f>l?f:l;let p=o,m=a,h=n.polarRotation||0,g,_;for(u=0;u<a;u+=1)for(d=0;d<o;d+=1){let e=u-s,t=d-c,n=Math.sqrt(e*e+t*t)*p/l,o=(Math.atan2(t,e)*180/Math.PI+360+h)%360;o=o*m/360,g=Math.floor(o),_=Math.floor(n);let f=(_*a+g)*4,v=r[f+0],y=r[f+1],b=r[f+2],x=r[f+3];f=(d*a+u)*4,i[f+0]=v,i[f+1]=y,i[f+2]=b,i[f+3]=x}},Da=function(e){let t=e.width,n=e.height,r,i,a,o,s,c,l,u,d,f,p=Math.round(this.kaleidoscopePower()),m=Math.round(this.kaleidoscopeAngle()),h=Math.floor(m%360*t/360);if(p<1)return;let g=H.createCanvasElement();g.width=t,g.height=n;let _=g.getContext(`2d`).getImageData(0,0,t,n);H.releaseCanvas(g),Ta(e,_,{polarCenterX:t/2,polarCenterY:n/2});let v=t/2**p;for(;v<=8;)v*=2,--p;v=Math.ceil(v);let y=v,b=0,x=y,S=1;for(h+v>t&&(b=y,x=0,S=-1),i=0;i<n;i+=1)for(r=b;r!==x;r+=S)a=Math.round(r+h)%t,d=(t*i+a)*4,s=_.data[d+0],c=_.data[d+1],l=_.data[d+2],u=_.data[d+3],f=(t*i+r)*4,_.data[f+0]=s,_.data[f+1]=c,_.data[f+2]=l,_.data[f+3]=u;for(i=0;i<n;i+=1)for(y=Math.floor(v),o=0;o<p;o+=1){for(r=0;r<y+1;r+=1)d=(t*i+r)*4,s=_.data[d+0],c=_.data[d+1],l=_.data[d+2],u=_.data[d+3],f=(t*i+y*2-r-1)*4,_.data[f+0]=s,_.data[f+1]=c,_.data[f+2]=l,_.data[f+3]=u;y*=2}Ea(_,e,{polarRotation:0})};W.addGetterSetter(G,`kaleidoscopePower`,2,U(),W.afterSetFilter),W.addGetterSetter(G,`kaleidoscopeAngle`,0,U(),W.afterSetFilter);function Oa(e,t,n){let r=(n*e.width+t)*4,i=[];return i.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),i}function ka(e,t){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2)}function Aa(e){let t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function ja(e,t){let n=Oa(e,0,0),r=Oa(e,e.width-1,0),i=Oa(e,0,e.height-1),a=Oa(e,e.width-1,e.height-1),o=t||10;if(ka(n,r)<o&&ka(r,a)<o&&ka(a,i)<o&&ka(i,n)<o){let t=Aa([r,n,a,i]),s=[];for(let n=0;n<e.width*e.height;n++)s[n]=ka(t,[e.data[n*4],e.data[n*4+1],e.data[n*4+2]])<o?0:255;return s}}function Ma(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function Na(e,t,n){let r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u===2040?255:0}return o}function Pa(e,t,n){let r=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u>=1020?255:0}return o}function Fa(e,t,n){let r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u}return o}var Ia=function(e){let t=ja(e,this.threshold());return t&&(t=Na(t,e.width,e.height),t=Pa(t,e.width,e.height),t=Fa(t,e.width,e.height),Ma(e,t)),e};W.addGetterSetter(G,`threshold`,0,U(),W.afterSetFilter);var La=function(e){let t=this.noise()*255,n=e.data,r=n.length,i=t/2;for(let e=0;e<r;e+=4)n[e+0]+=i-2*i*Math.random(),n[e+1]+=i-2*i*Math.random(),n[e+2]+=i-2*i*Math.random()};W.addGetterSetter(G,`noise`,.2,U(),W.afterSetFilter);var Ra=function(e){let t=Math.ceil(this.pixelSize()),n=e.width,r=e.height,i=Math.ceil(n/t),a=Math.ceil(r/t),o=e.data;if(t<=0){H.error(`pixelSize value can not be <= 0`);return}for(let e=0;e<i;e+=1)for(let i=0;i<a;i+=1){let a=0,s=0,c=0,l=0,u=e*t,d=u+t,f=i*t,p=f+t,m=0;for(let e=u;e<d;e+=1)if(!(e>=n))for(let t=f;t<p;t+=1){if(t>=r)continue;let i=(n*t+e)*4;a+=o[i+0],s+=o[i+1],c+=o[i+2],l+=o[i+3],m+=1}a/=m,s/=m,c/=m,l/=m;for(let e=u;e<d;e+=1)if(!(e>=n))for(let t=f;t<p;t+=1){if(t>=r)continue;let i=(n*t+e)*4;o[i+0]=a,o[i+1]=s,o[i+2]=c,o[i+3]=l}}};W.addGetterSetter(G,`pixelSize`,8,U(),W.afterSetFilter);var za=function(e){let t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t;for(let e=0;e<r;e+=1)n[e]=Math.floor(n[e]/i)*i};W.addGetterSetter(G,`levels`,.5,U(),W.afterSetFilter);var Ba=function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue();for(let e=0;e<n;e+=4){let n=(.34*t[e]+.5*t[e+1]+.16*t[e+2])/255;t[e]=n*r,t[e+1]=n*i,t[e+2]=n*a,t[e+3]=t[e+3]}};W.addGetterSetter(G,`red`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),W.addGetterSetter(G,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),W.addGetterSetter(G,`blue`,0,St,W.afterSetFilter);var Va=function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue(),o=this.alpha();for(let e=0;e<n;e+=4){let n=1-o;t[e]=r*o+t[e]*n,t[e+1]=i*o+t[e+1]*n,t[e+2]=a*o+t[e+2]*n}};W.addGetterSetter(G,`red`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),W.addGetterSetter(G,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),W.addGetterSetter(G,`blue`,0,St,W.afterSetFilter),W.addGetterSetter(G,`alpha`,1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Ha=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],i=t[e+2];t[e+0]=Math.min(255,n*.393+r*.769+i*.189),t[e+1]=Math.min(255,n*.349+r*.686+i*.168),t[e+2]=Math.min(255,n*.272+r*.534+i*.131)}},Ua=function(e){let t=e.data;for(let e=0;e<t.length;e+=4){let n=t[e],r=t[e+1],i=t[e+2];.2126*n+.7152*r+.0722*i>=128&&(t[e]=255-n,t[e+1]=255-r,t[e+2]=255-i)}return e},Wa=function(e){let t=this.threshold()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=1)n[e]=n[e]<t?0:255};W.addGetterSetter(G,`threshold`,.5,U(),W.afterSetFilter);var J=Or.Util._assign(Or,{Arc:kr,Arrow:Ur,Circle:Wr,Ellipse:Gr,Image:Kr,Label:ti,Tag:ni,Line:Nr,Path:Hr,Rect:ri,RegularPolygon:ii,Ring:oi,Sprite:si,Star:ci,Text:Hi,TextPath:qi,Transformer:ca,Wedge:ua,Filters:{Blur:ha,Brightness:_a,Brighten:ga,Contrast:va,Emboss:ya,Enhance:xa,Grayscale:Sa,HSL:Ca,HSV:wa,Invert:q,Kaleidoscope:Da,Mask:Ia,Noise:La,Pixelate:Ra,Posterize:za,RGB:Ba,RGBA:Va,Sepia:Ha,Solarize:Ua,Threshold:Wa}}),Y=Or,Ga=n(((e,t)=>{t.exports=function(e){function t(e,t,n,r){return new la(e,t,n,r)}function n(){}function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function o(e){if(a(e)!==e)throw Error(r(188))}function s(e){var t=e.alternate;if(!t){if(t=a(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var s=n.return;if(s===null)break;var c=s.alternate;if(c===null){if(i=s.return,i!==null){n=i;continue}break}if(s.child===c.child){for(c=s.child;c;){if(c===n)return o(s),e;if(c===i)return o(s),t;c=c.sibling}throw Error(r(188))}if(n.return!==i.return)n=s,i=c;else{for(var l=!1,u=s.child;u;){if(u===n){l=!0,n=s,i=c;break}if(u===i){l=!0,i=s,n=c;break}u=u.sibling}if(!l){for(u=c.child;u;){if(u===n){l=!0,n=c,i=s;break}if(u===i){l=!0,i=c,n=s;break}u=u.sibling}if(!l)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function l(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=l(e),t!==null)return t;e=e.sibling}return null}function u(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(e.tag!==4&&(t=u(e),t!==null))return t;e=e.sibling}return null}function d(e){return typeof e!=`object`||!e?null:(e=Ua&&e[Ua]||e[`@@iterator`],typeof e==`function`?e:null)}function f(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===Wa?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ja:return`Fragment`;case Na:return`Profiler`;case Ma:return`StrictMode`;case La:return`Suspense`;case Ra:return`SuspenseList`;case Va:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case Aa:return`Portal`;case Fa:return e.displayName||`Context`;case Pa:return(e._context.displayName||`Context`)+`.Consumer`;case Ia:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case za:return t=e.displayName||null,t===null?f(e.type)||`Memo`:t;case Ba:t=e._payload,e=e._init;try{return f(e(t))}catch{}}return null}function p(e){return{current:e}}function m(e){0>uc||(e.current=lc[uc],lc[uc]=null,uc--)}function h(e,t){uc++,lc[uc]=e.current,e.current=t}function g(e){return e>>>=0,e===0?32:31-(pc(e)/mc|0)|0}function _(e){var t=e&42;if(t!==0)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function v(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=_(n))):i=_(o):i=_(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=_(n))):i=_(o)):i=_(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function y(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function b(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function x(){var e=_c;return _c<<=1,!(_c&62914560)&&(_c=4194304),e}function S(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function C(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function w(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-fc(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&T(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function T(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-fc(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function E(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-fc(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function D(e,t){var n=t&-t;return n=n&42?1:O(n),(n&(e.suspendedLanes|t))===0?n:0}function O(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function k(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function A(e){if(typeof Dc==`function`&&Oc(e),Ac&&typeof Ac.setStrictMode==`function`)try{Ac.setStrictMode(kc,e)}catch{}}function j(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function ee(e){if(Pc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pc=t&&t[1]||``,Fc=-1<e.stack.indexOf(`
    at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
`+Pc+e+Fc}function M(e,t){if(!e||Ic)return``;Ic=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
`),l=s.split(`
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ic=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ee(n):``}function N(e,t){switch(e.tag){case 26:case 27:case 5:return ee(e.type);case 16:return ee(`Lazy`);case 13:return e.child!==t&&t!==null?ee(`Suspense Fallback`):ee(`Suspense`);case 19:return ee(`SuspenseList`);case 0:case 15:return M(e.type,!1);case 11:return M(e.type.render,!1);case 1:return M(e.type,!0);case 31:return ee(`Activity`);default:return``}}function P(e){try{var t=``,n=null;do t+=N(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
Error generating stack: `+e.message+`
`+e.stack}}function F(e,t){if(typeof e==`object`&&e){var n=Lc.get(e);return n===void 0?(t={value:e,source:t,stack:P(t)},Lc.set(e,t),t):n}return{value:e,source:t,stack:P(t)}}function I(e,t){Rc[zc++]=Vc,Rc[zc++]=Bc,Bc=e,Vc=t}function te(e,t,n){Hc[Uc++]=Gc,Hc[Uc++]=Kc,Hc[Uc++]=Wc,Wc=e;var r=Gc;e=Kc;var i=32-fc(r)-1;r&=~(1<<i),n+=1;var a=32-fc(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Gc=1<<32-fc(t)+i|n<<i|r,Kc=a+e}else Gc=1<<a|n<<i|r,Kc=e}function ne(e){e.return!==null&&(I(e,1),te(e,1,0))}function re(e){for(;e===Bc;)Bc=Rc[--zc],Rc[zc]=null,Vc=Rc[--zc],Rc[zc]=null;for(;e===Wc;)Wc=Hc[--Uc],Hc[Uc]=null,Kc=Hc[--Uc],Hc[Uc]=null,Gc=Hc[--Uc],Hc[Uc]=null}function ie(e,t){Hc[Uc++]=Gc,Hc[Uc++]=Kc,Hc[Uc++]=Wc,Gc=t.id,Kc=t.overflow,Wc=e}function ae(e,t){h(Yc,t),h(Jc,e),h(qc,null),e=Ya(t),m(qc),h(qc,e)}function oe(){m(qc),m(Jc),m(Yc)}function se(e){e.memoizedState!==null&&h(Xc,e);var t=qc.current,n=Xa(t,e.type);t!==n&&(h(Jc,e),h(qc,n))}function ce(e){Jc.current===e&&(m(qc),m(Jc)),Xc.current===e&&(m(Xc),so?Do._currentValue=Eo:Do._currentValue2=Eo)}function le(e){throw me(F(Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),nl}function ue(e,t){if(!uo)throw Error(r(175));ws(e.stateNode,e.type,e.memoizedProps,t,e)||le(e,!0)}function de(e){for(Zc=e.return;Zc;)switch(Zc.tag){case 5:case 31:case 13:tl=!1;return;case 27:case 3:tl=!0;return;default:Zc=Zc.return}}function fe(e){if(!uo||e!==Zc)return!1;if(!$c)return de(e),$c=!0,!1;var t=e.tag;if(rc?t!==3&&t!==27&&(t!==5||Bs(e.type)&&!no(e.type,e.memoizedProps))&&Qc&&le(e):t!==3&&(t!==5||Bs(e.type)&&!no(e.type,e.memoizedProps))&&Qc&&le(e),de(e),t===13){if(!uo)throw Error(r(316));if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));Qc=ks(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));Qc=Os(e)}else Qc=rc&&t===27?ms(e.type,Qc):Zc?ps(e.stateNode):null;return!0}function pe(){uo&&(Qc=Zc=null,$c=!1)}function L(){var e=el;return e!==null&&(Lu===null?Lu=e:Lu.push.apply(Lu,e),el=null),e}function me(e){el===null?el=[e]:el.push(e)}function he(e,t,n){so?(h(rl,t._currentValue),t._currentValue=n):(h(rl,t._currentValue2),t._currentValue2=n)}function ge(e){var t=rl.current;so?e._currentValue=t:e._currentValue2=t,m(rl)}function _e(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ve(e,t,n,i){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),_e(o.return,n,e),i||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(r(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),_e(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ye(e,t,n,i){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(r(387));if(s=s.memoizedProps,s!==null){var c=a.type;jc(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Xc.current){if(s=a.alternate,s===null)throw Error(r(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Do]:e.push(Do))}a=a.return}e!==null&&ve(t,e,n,i),t.flags|=262144}function be(e){for(e=e.firstContext;e!==null;){var t=e.context;if(!jc(so?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}function xe(e){il=e,al=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function R(e){return Ce(il,e)}function Se(e,t){return il===null&&xe(e),Ce(e,t)}function Ce(e,t){var n=so?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:n,next:null},al===null){if(e===null)throw Error(r(308));al=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else al=al.next=t;return n}function we(){return{controller:new ol,data:new Map,refCount:0}}function Te(e){e.refCount--,e.refCount===0&&sl(cl,function(){e.controller.abort()})}function Ee(){}function De(e){e!==dl&&e.next===null&&(dl===null?ul=dl=e:dl=dl.next=e),pl=!0,fl||(fl=!0,je())}function z(e,t){if(!ml&&pl){ml=!0;do for(var n=!1,r=ul;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-fc(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,V(r,a))}else a=Cu,a=v(r,r===Su?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==oo),!(a&3)||y(r,a)||(n=!0,V(r,a));r=r.next}while(n);ml=!1}}function B(){Oe()}function Oe(){pl=fl=!1;var e=0;hl!==0&&_o()&&(e=hl);for(var t=Sc(),n=null,r=ul;r!==null;){var i=r.next,a=ke(r,t);a===0?(r.next=null,n===null?ul=i:n.next=i,i===null&&(dl=n)):(n=r,(e!==0||a&3)&&(pl=!0)),r=i}$!==0&&$!==5||z(e,!1),hl!==0&&(hl=0)}function ke(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-fc(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=b(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Su,n=Cu,n=v(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==oo),r=e.callbackNode,n===0||e===t&&(wu===2||wu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&yc(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||y(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&yc(r),k(n)){case 2:case 8:n=wc;break;case 32:n=Tc;break;case 268435456:n=Ec;break;default:n=Tc}return r=Ae.bind(null,e),n=vc(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&yc(r),e.callbackPriority=2,e.callbackNode=null,2}function Ae(e,t){if($!==0&&$!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if($i()&&e.callbackNode!==n)return null;var r=Cu;return r=v(e,e===Su?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==oo),r===0?null:(Di(e,r,t),ke(e,Sc()),e.callbackNode!=null&&e.callbackNode===n?Ae.bind(null,e):null)}function V(e,t){if($i())return null;Di(e,t,!0)}function je(){ko?Ao(function(){Z&6?vc(Cc,B):Oe()}):vc(Cc,B)}function Me(){if(hl===0){var e=vl;e===0&&(e=hc,hc<<=1,!(hc&261888)&&(hc=256)),hl=e}return hl}function Ne(e,t){if(gl===null){var n=gl=[];_l=0,vl=Me(),yl={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return _l++,t.then(Pe,Pe),t}function Pe(){if(--_l===0&&gl!==null){yl!==null&&(yl.status=`fulfilled`);var e=gl;gl=null,vl=0,yl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Fe(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}function Ie(){var e=xl.current;return e===null?Su.pooledCache:e}function Le(e,t){t===null?h(xl,xl.current):h(xl,t.pool)}function Re(){var e=Ie();return e===null?null:{parent:so?ll._currentValue:ll._currentValue2,pool:e}}function ze(e,t){if(jc(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Nc.call(t,i)||!jc(e[i],t[i]))return!1}return!0}function Be(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ve(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ee,Ee),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,We(e),e;default:if(typeof t.status==`string`)t.then(Ee,Ee);else{if(e=Su,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,We(e),e}throw El=t,Sl}}function He(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(El=e,Sl):e}}function Ue(){if(El===null)throw Error(r(459));var e=El;return El=null,e}function We(e){if(e===Sl||e===wl)throw Error(r(483))}function Ge(e){var t=Ol;return Ol+=1,Dl===null&&(Dl=[]),Ve(Dl,e,t)}function Ke(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function qe(e,t){throw t.$$typeof===Oa?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Je(e){function n(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function i(t,r){if(!e)return null;for(;r!==null;)n(t,r),r=r.sibling;return null}function a(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function o(e,t){return e=da(e,t),e.index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function c(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function l(e,t,n,r){return t===null||t.tag!==6?(t=ha(n,e.mode,r),t.return=e,t):(t=o(t,n),t.return=e,t)}function u(e,t,n,r){var i=n.type;return i===ja?p(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===Ba&&He(i)===t.type)?(t=o(t,n.props),Ke(t,n),t.return=e,t):(t=pa(n.type,n.key,n.props,null,e.mode,r),Ke(t,n),t.return=e,t)}function f(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=_a(n,e.mode,r),t.return=e,t):(t=o(t,n.children||[]),t.return=e,t)}function p(e,t,n,r,i){return t===null||t.tag!==7?(t=ma(n,e.mode,r,i),t.return=e,t):(t=o(t,n),t.return=e,t)}function m(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ha(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case ka:return n=pa(t.type,t.key,t.props,null,e.mode,n),Ke(n,t),n.return=e,n;case Aa:return t=_a(t,e.mode,n),t.return=e,t;case Ba:return t=He(t),m(e,t,n)}if(J(t)||d(t))return t=ma(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return m(e,Ge(t),n);if(t.$$typeof===Fa)return m(e,Se(e,t),n);qe(e,t)}return null}function h(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?l(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case ka:return n.key===i?u(e,t,n,r):null;case Aa:return n.key===i?f(e,t,n,r):null;case Ba:return n=He(n),h(e,t,n,r)}if(J(n)||d(n))return i===null?p(e,t,n,r,null):null;if(typeof n.then==`function`)return h(e,t,Ge(n),r);if(n.$$typeof===Fa)return h(e,t,Se(e,n),r);qe(e,n)}return null}function g(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,l(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case ka:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case Aa:return e=e.get(r.key===null?n:r.key)||null,f(t,e,r,i);case Ba:return r=He(r),g(e,t,n,r,i)}if(J(r)||d(r))return e=e.get(n)||null,p(t,e,r,i,null);if(typeof r.then==`function`)return g(e,t,n,Ge(r),i);if(r.$$typeof===Fa)return g(e,t,n,Se(t,r),i);qe(t,r)}return null}function _(t,r,o,c){for(var l=null,u=null,d=r,f=r=0,p=null;d!==null&&f<o.length;f++){d.index>f?(p=d,d=null):p=d.sibling;var _=h(t,d,o[f],c);if(_===null){d===null&&(d=p);break}e&&d&&_.alternate===null&&n(t,d),r=s(_,r,f),u===null?l=_:u.sibling=_,u=_,d=p}if(f===o.length)return i(t,d),$c&&I(t,f),l;if(d===null){for(;f<o.length;f++)d=m(t,o[f],c),d!==null&&(r=s(d,r,f),u===null?l=d:u.sibling=d,u=d);return $c&&I(t,f),l}for(d=a(d);f<o.length;f++)p=g(d,t,f,o[f],c),p!==null&&(e&&p.alternate!==null&&d.delete(p.key===null?f:p.key),r=s(p,r,f),u===null?l=p:u.sibling=p,u=p);return e&&d.forEach(function(e){return n(t,e)}),$c&&I(t,f),l}function v(t,o,c,l){if(c==null)throw Error(r(151));for(var u=null,d=null,f=o,p=o=0,_=null,v=c.next();f!==null&&!v.done;p++,v=c.next()){f.index>p?(_=f,f=null):_=f.sibling;var y=h(t,f,v.value,l);if(y===null){f===null&&(f=_);break}e&&f&&y.alternate===null&&n(t,f),o=s(y,o,p),d===null?u=y:d.sibling=y,d=y,f=_}if(v.done)return i(t,f),$c&&I(t,p),u;if(f===null){for(;!v.done;p++,v=c.next())v=m(t,v.value,l),v!==null&&(o=s(v,o,p),d===null?u=v:d.sibling=v,d=v);return $c&&I(t,p),u}for(f=a(f);!v.done;p++,v=c.next())v=g(f,t,p,v.value,l),v!==null&&(e&&v.alternate!==null&&f.delete(v.key===null?p:v.key),o=s(v,o,p),d===null?u=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return n(t,e)}),$c&&I(t,p),u}function y(e,t,a,s){if(typeof a==`object`&&a&&a.type===ja&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case ka:a:{for(var l=a.key;t!==null;){if(t.key===l){if(l=a.type,l===ja){if(t.tag===7){i(e,t.sibling),s=o(t,a.props.children),s.return=e,e=s;break a}}else if(t.elementType===l||typeof l==`object`&&l&&l.$$typeof===Ba&&He(l)===t.type){i(e,t.sibling),s=o(t,a.props),Ke(s,a),s.return=e,e=s;break a}i(e,t);break}else n(e,t);t=t.sibling}a.type===ja?(s=ma(a.props.children,e.mode,s,a.key),s.return=e,e=s):(s=pa(a.type,a.key,a.props,null,e.mode,s),Ke(s,a),s.return=e,e=s)}return c(e);case Aa:a:{for(l=a.key;t!==null;){if(t.key===l)if(t.tag===4&&t.stateNode.containerInfo===a.containerInfo&&t.stateNode.implementation===a.implementation){i(e,t.sibling),s=o(t,a.children||[]),s.return=e,e=s;break a}else{i(e,t);break}else n(e,t);t=t.sibling}s=_a(a,e.mode,s),s.return=e,e=s}return c(e);case Ba:return a=He(a),y(e,t,a,s)}if(J(a))return _(e,t,a,s);if(d(a)){if(l=d(a),typeof l!=`function`)throw Error(r(150));return a=l.call(a),v(e,t,a,s)}if(typeof a.then==`function`)return y(e,t,Ge(a),s);if(a.$$typeof===Fa)return y(e,t,Se(e,a),s);qe(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,t!==null&&t.tag===6?(i(e,t.sibling),s=o(t,a),s.return=e,e=s):(i(e,t),s=ha(a,e.mode,s),s.return=e,e=s),c(e)):i(e,t)}return function(e,n,r,i){try{Ol=0;var a=y(e,n,r,i);return Dl=null,a}catch(n){if(n===Sl||n===wl)throw n;var o=t(29,n,null,e.mode);return o.lanes=i,o.return=e,o}}}function Ye(){for(var e=Ml,t=Nl=Ml=0;t<e;){var n=jl[t];jl[t++]=null;var r=jl[t];jl[t++]=null;var i=jl[t];jl[t++]=null;var a=jl[t];if(jl[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Qe(n,i,a)}}function Xe(e,t,n,r){jl[Ml++]=e,jl[Ml++]=t,jl[Ml++]=n,jl[Ml++]=r,Nl|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ze(e,t,n,r){return Xe(e,t,n,r),$e(e)}function H(e,t){return Xe(e,null,null,t),$e(e)}function Qe(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-fc(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function $e(e){if(50<Xu)throw Xu=0,Zu=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}function et(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function tt(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function nt(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function rt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Z&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$e(e),Qe(e,null,n),t}return Xe(e,r,t,n),$e(e)}function it(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,E(e,n)}}function at(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ot(){if(Fl){var e=yl;if(e!==null)throw e}}function st(e,t,n,r){Fl=!1;var i=e.updateQueue;Pl=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Cu&f)===f:(r&f)===f){f!==0&&f===vl&&(Fl=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=Da({},d,f);break a;case 2:Pl=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ju|=o,e.lanes=o,e.memoizedState=d}}function ct(e,t){if(typeof e!=`function`)throw Error(r(191,e));e.call(t)}function lt(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)ct(n[e],t)}function ut(e,t){e=ku,h(Ll,e),h(Il,t),ku=e|t.baseLanes}function dt(){h(Ll,ku),h(Il,Il.current)}function ft(){ku=Ll.current,m(Il),m(Ll)}function pt(e){var t=e.alternate;h(Bl,Bl.current&1),h(Rl,e),zl===null&&(t===null||Il.current!==null||t.memoizedState!==null)&&(zl=e)}function mt(e){h(Bl,Bl.current),h(Rl,e),zl===null&&(zl=e)}function ht(e){e.tag===22?(h(Bl,Bl.current),h(Rl,e),zl===null&&(zl=e)):gt(e)}function gt(){h(Bl,Bl.current),h(Rl,Rl.current)}function _t(e){m(Rl),zl===e&&(zl=null),m(Bl)}function vt(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ss(n)||cs(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function yt(){throw Error(r(321))}function bt(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!jc(e[n],t[n]))return!1;return!0}function xt(e,t,n,r,i,a){return Vl=a,X=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Y.H=e===null||e.memoizedState===null?Ql:$l,Kl=!1,a=n(r,i),Kl=!1,Gl&&(a=U(t,n,r,i)),St(e),a}function St(e){Y.H=Zl;var t=Hl!==null&&Hl.next!==null;if(Vl=0,Ul=Hl=X=null,Wl=!1,Jl=0,Yl=null,t)throw Error(r(300));e===null||ru||(e=e.dependencies,e!==null&&be(e)&&(ru=!0))}function U(e,t,n,i){X=e;var a=0;do{if(Gl&&(Yl=null),Jl=0,Gl=!1,25<=a)throw Error(r(301));if(a+=1,Ul=Hl=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}Y.H=eu,o=t(n,i)}while(Gl);return o}function Ct(){var e=Y.H,t=e.useState()[0];return t=typeof t.then==`function`?At(t):t,e=e.useState()[0],(Hl===null?null:Hl.memoizedState)!==e&&(X.flags|=1024),t}function wt(){var e=ql!==0;return ql=0,e}function Tt(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Et(e){if(Wl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Wl=!1}Vl=0,Ul=Hl=X=null,Gl=!1,Jl=ql=0,Yl=null}function Dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ul===null?X.memoizedState=Ul=e:Ul=Ul.next=e,Ul}function Ot(){if(Hl===null){var e=X.alternate;e=e===null?null:e.memoizedState}else e=Hl.next;var t=Ul===null?X.memoizedState:Ul.next;if(t!==null)Ul=t,Hl=e;else{if(e===null)throw X.alternate===null?Error(r(467)):Error(r(310));Hl=e,e={memoizedState:Hl.memoizedState,baseState:Hl.baseState,baseQueue:Hl.baseQueue,queue:Hl.queue,next:null},Ul===null?X.memoizedState=Ul=e:Ul=Ul.next=e}return Ul}function kt(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function At(e){var t=Jl;return Jl+=1,Yl===null&&(Yl=[]),e=Ve(Yl,e,t),t=X,(Ul===null?t.memoizedState:Ul.next)===null&&(t=t.alternate,Y.H=t===null||t.memoizedState===null?Ql:$l),e}function jt(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return At(e);if(e.$$typeof===Fa)return R(e)}throw Error(r(438,String(e)))}function W(e){var t=null,n=X.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=X.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=kt(),X.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=Ha;return t.index++,n}function Mt(e,t){return typeof t==`function`?t(e):t}function Nt(e){return Pt(Ot(),Hl,e)}function Pt(e,t,n){var i=e.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=n;var a=e.baseQueue,o=i.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,i.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Vl&f)===f:(Cu&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===vl&&(d=!0);else if((Vl&p)===p){u=u.next,p===vl&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,X.lanes|=p,ju|=p;f=u.action,Kl&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,X.lanes|=f,ju|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!jc(o,e.memoizedState)&&(ru=!0,d&&(n=yl,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,i.lastRenderedState=o}return a===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Ft(e){var t=Ot(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);jc(o,t.memoizedState)||(ru=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function It(e,t,n){var i=X,a=Ot(),o=$c;if(o){if(n===void 0)throw Error(r(407));n=n()}else n=t();var s=!jc((Hl||a).memoizedState,n);if(s&&(a.memoizedState=n,ru=!0),a=a.queue,sn(zt.bind(null,i,a,e),[e]),a.getSnapshot!==t||s||Ul!==null&&Ul.memoizedState.tag&1){if(i.flags|=2048,nn(9,{destroy:void 0},Rt.bind(null,i,a,n,t),null),Su===null)throw Error(r(349));o||Vl&127||Lt(i,t,n)}return n}function Lt(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=X.updateQueue,t===null?(t=kt(),X.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Rt(e,t,n,r){t.value=n,t.getSnapshot=r,Bt(t)&&Vt(e)}function zt(e,t,n){return n(function(){Bt(t)&&Vt(e)})}function Bt(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jc(e,n)}catch{return!0}}function Vt(e){var t=H(e,2);t!==null&&Ei(t,e,2)}function Ht(e){var t=Dt();if(typeof e==`function`){var n=e;if(e=n(),Kl){A(!0);try{n()}finally{A(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mt,lastRenderedState:e},t}function Ut(e,t,n,r){return e.baseState=n,Pt(e,Hl,typeof r==`function`?r:Mt)}function Wt(e,t,n,i,a){if(kn(e))throw Error(r(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};Y.T===null?o.isTransition=!1:n(!0),i(o),n=t.pending,n===null?(o.next=t.pending=o,Gt(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Gt(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=Y.T,o={};Y.T=o;try{var s=n(i,r),c=Y.S;c!==null&&c(o,s),Kt(e,t,s)}catch(n){Jt(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),Y.T=a}}else try{a=n(i,r),Kt(e,t,a)}catch(n){Jt(e,t,n)}}function Kt(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qt(e,t,n)},function(n){return Jt(e,t,n)}):qt(e,t,n)}function qt(e,t,n){t.status=`fulfilled`,t.value=n,Yt(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Gt(e,n)))}function Jt(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yt(t),t=t.next;while(t!==r)}e.action=null}function Yt(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xt(e,t){return t}function Zt(e,t){if($c){var n=Su.formState;if(n!==null){a:{var r=X;if($c){if(Qc){var i=ds(Qc,tl);if(i){Qc=ps(i),r=fs(i);break a}}le(r)}r=!1}r&&(t=n[0])}}n=Dt(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xt,lastRenderedState:t},n.queue=r,n=En.bind(null,X,r),r.dispatch=n,r=Ht(!1);var a=On.bind(null,X,!1,r.queue);return r=Dt(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wt.bind(null,X,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qt(e){return $t(Ot(),Hl,e)}function $t(e,t,n){if(t=Pt(e,t,Xt)[0],e=Nt(Mt)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=At(t)}catch(e){throw e===Sl?wl:e}else r=t;t=Ot();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(X.flags|=2048,nn(9,{destroy:void 0},en.bind(null,i,n),null)),[r,a,e]}function en(e,t){e.action=t}function tn(e){var t=Ot(),n=Hl;if(n!==null)return $t(t,n,e);Ot(),t=t.memoizedState,n=Ot();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function nn(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=X.updateQueue,t===null&&(t=kt(),X.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function G(){return Ot().memoizedState}function rn(e,t,n,r){var i=Dt();X.flags|=e,i.memoizedState=nn(1|t,{destroy:void 0},n,r===void 0?null:r)}function an(e,t,n,r){var i=Ot();r=r===void 0?null:r;var a=i.memoizedState.inst;Hl!==null&&r!==null&&bt(r,Hl.memoizedState.deps)?i.memoizedState=nn(t,a,n,r):(X.flags|=e,i.memoizedState=nn(1|t,a,n,r))}function on(e,t){rn(8390656,8,e,t)}function sn(e,t){an(2048,8,e,t)}function cn(e){X.flags|=4;var t=X.updateQueue;if(t===null)t=kt(),X.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ln(e){var t=Ot().memoizedState;return cn({ref:t,nextImpl:e}),function(){if(Z&2)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function un(e,t){return an(4,2,e,t)}function dn(e,t){return an(4,4,e,t)}function fn(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function pn(e,t,n){n=n==null?null:n.concat([e]),an(4,4,fn.bind(null,t,e),n)}function mn(){}function hn(e,t){var n=Ot();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&bt(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function gn(e,t){var n=Ot();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&bt(t,r[1]))return r[0];if(r=e(),Kl){A(!0);try{e()}finally{A(!1)}}return n.memoizedState=[r,t],r}function _n(e,t,n){return n===void 0||Vl&1073741824&&!(Cu&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ti(),X.lanes|=e,ju|=e,n)}function vn(e,t,n,r){return jc(n,t)?n:Il.current===null?!(Vl&42)||Vl&1073741824&&!(Cu&261930)?(ru=!0,e.memoizedState=n):(e=Ti(),X.lanes|=e,ju|=e,t):(e=_n(e,n,r),jc(e,t)||(ru=!0),e)}function yn(e,t,n,r,i){var a=ho();mo(a!==0&&8>a?a:8);var o=Y.T,s={};Y.T=s,On(e,!1,t,n);try{var c=i(),l=Y.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Dn(e,t,Fe(c,r),wi(e)):Dn(e,t,r,wi(e))}catch(n){Dn(e,t,{then:function(){},status:`rejected`,reason:n},wi())}finally{mo(a),o!==null&&s.types!==null&&(o.types=s.types),Y.T=o}}function bn(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Eo,baseState:Eo,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mt,lastRenderedState:Eo},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mt,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xn(){return R(Do)}function Sn(){return Ot().memoizedState}function Cn(){return Ot().memoizedState}function wn(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=wi();e=nt(n);var r=rt(t,e,n);r!==null&&(Ei(r,t,n),it(r,t,n)),t={cache:we()},e.payload=t;return}t=t.return}}function Tn(e,t,n){var r=wi();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},kn(e)?An(t,n):(n=Ze(e,t,n,r),n!==null&&(Ei(n,e,r),jn(n,t,r)))}function En(e,t,n){Dn(e,t,n,wi())}function Dn(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(kn(e))An(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,jc(s,o))return Xe(e,t,i,0),Su===null&&Ye(),!1}catch{}if(n=Ze(e,t,i,r),n!==null)return Ei(n,e,r),jn(n,t,r),!0}return!1}function On(e,t,n,i){if(i={lane:2,revertLane:Me(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},kn(e)){if(t)throw Error(r(479))}else t=Ze(e,n,i,2),t!==null&&Ei(t,e,2)}function kn(e){var t=e.alternate;return e===X||t!==null&&t===X}function An(e,t){Gl=Wl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function jn(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,E(e,n)}}function Mn(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Da({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}function Nn(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!ze(n,r)||!ze(i,a):!0}function Pn(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&tu.enqueueReplaceState(t,t.state,null)}function Fn(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=Da({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function In(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ln(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Rn(e,t,n){return n=nt(n),n.tag=3,n.payload={element:null},n.callback=function(){In(e,t)},n}function zn(e){return e=nt(e),e.tag=3,e}function Bn(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ln(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ln(t,n,r),typeof i!=`function`&&(Uu===null?Uu=new Set([this]):Uu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Vn(e,t,n,i,a){if(n.flags|=32768,typeof i==`object`&&i&&typeof i.then==`function`){if(t=n.alternate,t!==null&&ye(t,n,a,!0),n=Rl.current,n!==null){switch(n.tag){case 31:case 13:return zl===null?Ri():n.alternate===null&&Au===0&&(Au=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===Tl?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),ra(e,i,a)),!1;case 22:return n.flags|=65536,i===Tl?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),ra(e,i,a)),!1}throw Error(r(435,n.tag))}return ra(e,i,a),Ri(),!1}if($c)return t=Rl.current,t===null?(i!==nl&&(t=Error(r(423),{cause:i}),me(F(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,i=F(i,n),a=Rn(e.stateNode,i,a),at(e,a),Au!==4&&(Au=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,i!==nl&&(e=Error(r(422),{cause:i}),me(F(e,n)))),!1;var o=Error(r(520),{cause:i});if(o=F(o,n),Iu===null?Iu=[o]:Iu.push(o),Au!==4&&(Au=2),t===null)return!0;i=F(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Rn(n.stateNode,i,e),at(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Uu===null||!Uu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=zn(a),Bn(a,e,n,i),at(n,a),!1}n=n.return}while(n!==null);return!1}function Hn(e,t,n,r){t.child=e===null?Al(t,null,n,r):kl(t,e.child,n,r)}function Un(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return xe(t),r=xt(e,t,n,o,a,i),s=wt(),e!==null&&!ru?(Tt(e,t,i),dr(e,t,i)):($c&&s&&ne(t),t.flags|=1,Hn(e,t,r,i),t.child)}function Wn(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ua(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Gn(e,t,a,r,i)):(e=pa(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!fr(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?ze:n,n(o,r)&&e.ref===t.ref)return dr(e,t,i)}return t.flags|=1,e=da(a,r),e.ref=t.ref,e.return=t,t.child=e}function Gn(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(ze(a,r)&&e.ref===t.ref)if(ru=!1,t.pendingProps=r=a,fr(e,i))e.flags&131072&&(ru=!0);else return t.lanes=e.lanes,dr(e,t,i)}return $n(e,t,n,r,i)}function Kn(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Jn(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Le(t,a===null?null:a.cachePool),a===null?dt():ut(t,a),ht(t);else return r=t.lanes=536870912,Jn(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Le(t,null),dt(),gt(t)):(Le(t,a.cachePool),ut(t,a),gt(t),t.memoizedState=null);return Hn(e,t,i,n),t.child}function qn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Jn(e,t,n,r,i){var a=Ie();return a=a===null?null:{parent:so?ll._currentValue:ll._currentValue2,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Le(t,null),dt(),ht(t),e!==null&&ye(e,t,r,!0),t.childLanes=i,null}function Yn(e,t){return t=sr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Xn(e,t,n){return kl(t,e.child,null,n),e=Yn(t,t.pendingProps),e.flags|=2,_t(t),t.memoizedState=null,e}function Zn(e,t,n){var i=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if($c){if(i.mode===`hidden`)return e=Yn(t,i),t.lanes=536870912,qn(null,e);if(mt(t),(e=Qc)?(e=Ss(e,tl),e!==null&&(t.memoizedState={dehydrated:e,treeContext:Wc===null?null:{id:Gc,overflow:Kc},retryLane:536870912,hydrationErrors:null},n=ga(e),n.return=t,t.child=n,Zc=t,Qc=null)):e=null,e===null)throw le(t);return t.lanes=536870912,null}return Yn(t,i)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(mt(t),a)if(t.flags&256)t.flags&=-257,t=Xn(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(ru||ye(e,t,n,!1),a=(n&e.childLanes)!==0,ru||a){if(i=Su,i!==null&&(s=D(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,H(e,s),Ei(i,e,s),nu;Ri(),t=Xn(e,t,n)}else e=o.treeContext,uo&&(Qc=_s(s),Zc=t,$c=!0,el=null,tl=!1,e!==null&&ie(t,e)),t=Yn(t,i),t.flags|=4096;return t}return e=da(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Qn(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function $n(e,t,n,r,i){return xe(t),n=xt(e,t,n,r,void 0,i),r=wt(),e!==null&&!ru?(Tt(e,t,i),dr(e,t,i)):($c&&r&&ne(t),t.flags|=1,Hn(e,t,n,i),t.child)}function er(e,t,n,r,i,a){return xe(t),t.updateQueue=null,n=U(t,r,n,i),St(e),r=wt(),e!==null&&!ru?(Tt(e,t,a),dr(e,t,a)):($c&&r&&ne(t),t.flags|=1,Hn(e,t,n,a),t.child)}function tr(e,t,n,r,i){if(xe(t),t.stateNode===null){var a=dc,o=n.contextType;typeof o==`object`&&o&&(a=R(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=tu,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},et(t),o=n.contextType,a.context=typeof o==`object`&&o?R(o):dc,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Mn(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&tu.enqueueReplaceState(a,a.state,null),st(t,r,a,i),ot(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Fn(n,s);a.props=c;var l=a.context,u=n.contextType;o=dc,typeof u==`object`&&u&&(o=R(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Pn(t,a,r,o),Pl=!1;var f=t.memoizedState;a.state=f,st(t,r,a,i),ot(),l=t.memoizedState,s||f!==l||Pl?(typeof d==`function`&&(Mn(t,n,d,r),l=t.memoizedState),(c=Pl||Nn(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,tt(e,t),o=t.memoizedProps,u=Fn(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=dc,typeof l==`object`&&l&&(c=R(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Pn(t,a,r,c),Pl=!1,f=t.memoizedState,a.state=f,st(t,r,a,i),ot();var p=t.memoizedState;o!==d||f!==p||Pl||e!==null&&e.dependencies!==null&&be(e.dependencies)?(typeof s==`function`&&(Mn(t,n,s,r),p=t.memoizedState),(u=Pl||Nn(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&be(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Qn(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=kl(t,e.child,null,i),t.child=kl(t,null,n,i)):Hn(e,t,n,i),t.memoizedState=a.state,e=t.child):e=dr(e,t,i),e}function nr(e,t,n,r){return pe(),t.flags|=256,Hn(e,t,n,r),t.child}function rr(e){return{baseLanes:e,cachePool:Re()}}function ir(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Pu),e}function ar(e,t,n){var i=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(Bl.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if($c){if(a?pt(t):gt(t),(e=Qc)?(e=Cs(e,tl),e!==null&&(t.memoizedState={dehydrated:e,treeContext:Wc===null?null:{id:Gc,overflow:Kc},retryLane:536870912,hydrationErrors:null},n=ga(e),n.return=t,t.child=n,Zc=t,Qc=null)):e=null,e===null)throw le(t);return cs(e)?t.lanes=32:t.lanes=536870912,null}var c=i.children;return i=i.fallback,a?(gt(t),a=t.mode,c=sr({mode:`hidden`,children:c},a),i=ma(i,a,n,null),c.return=t,i.return=t,c.sibling=i,t.child=c,i=t.child,i.memoizedState=rr(n),i.childLanes=ir(e,s,n),t.memoizedState=iu,qn(null,i)):(pt(t),or(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(pt(t),t.flags&=-257,t=cr(e,t,n)):t.memoizedState===null?(gt(t),c=i.fallback,a=t.mode,i=sr({mode:`visible`,children:i.children},a),c=ma(c,a,n,null),c.flags|=2,i.return=t,c.return=t,i.sibling=c,t.child=i,kl(t,e.child,null,n),i=t.child,i.memoizedState=rr(n),i.childLanes=ir(e,s,n),t.memoizedState=iu,t=qn(null,i)):(gt(t),t.child=e.child,t.flags|=128,t=null);else if(pt(t),cs(c))s=ls(c).digest,i=Error(r(419)),i.stack=``,i.digest=s,me({value:i,source:null,stack:null}),t=cr(e,t,n);else if(ru||ye(e,t,n,!1),s=(n&e.childLanes)!==0,ru||s){if(s=Su,s!==null&&(i=D(s,n),i!==0&&i!==l.retryLane))throw l.retryLane=i,H(e,i),Ei(s,e,i),nu;ss(c)||Ri(),t=cr(e,t,n)}else ss(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,uo&&(Qc=vs(c),Zc=t,$c=!0,el=null,tl=!1,e!==null&&ie(t,e)),t=or(t,i.children),t.flags|=4096);return t}return a?(gt(t),c=i.fallback,a=t.mode,l=e.child,o=l.sibling,i=da(l,{mode:`hidden`,children:i.children}),i.subtreeFlags=l.subtreeFlags&65011712,o===null?(c=ma(c,a,n,null),c.flags|=2):c=da(o,c),c.return=t,i.return=t,i.sibling=c,t.child=i,qn(null,i),i=t.child,c=e.child.memoizedState,c===null?c=rr(n):(a=c.cachePool,a===null?a=Re():(l=so?ll._currentValue:ll._currentValue2,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),i.memoizedState=c,i.childLanes=ir(e,s,n),t.memoizedState=iu,qn(e.child,i)):(pt(t),n=e.child,e=n.sibling,n=da(n,{mode:`visible`,children:i.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function or(e,t){return t=sr({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function sr(e,n){return e=t(22,e,null,n),e.lanes=0,e}function cr(e,t,n){return kl(t,e.child,null,n),e=or(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lr(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),_e(e.return,t,n)}function K(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function ur(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Bl.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,h(Bl,o),Hn(e,t,r,n),r=$c?Vc:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&lr(e,n,t);else if(e.tag===19)lr(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&vt(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),K(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&vt(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}K(t,!0,n,null,a,r);break;case`together`:K(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function dr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ju|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ye(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=da(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=da(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function fr(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&be(e))):!0}function pr(e,t,n){switch(t.tag){case 3:ae(t,t.stateNode.containerInfo),he(t,ll,e.memoizedState.cache),pe();break;case 27:case 5:se(t);break;case 4:ae(t,t.stateNode.containerInfo);break;case 10:he(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,mt(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(pt(t),e=dr(e,t,n),e===null?null:e.sibling):ar(e,t,n):(pt(t),t.flags|=128,null);pt(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(ye(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ur(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),h(Bl,Bl.current),r)break;return null;case 22:return t.lanes=0,Kn(e,t,n,t.pendingProps);case 24:he(t,ll,e.memoizedState.cache)}return dr(e,t,n)}function mr(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ru=!0;else{if(!fr(e,n)&&!(t.flags&128))return ru=!1,pr(e,t,n);ru=!!(e.flags&131072)}else ru=!1,$c&&t.flags&1048576&&te(t,Vc,t.index);switch(t.lanes=0,t.tag){case 16:a:{var i=t.pendingProps;if(e=He(t.elementType),t.type=e,typeof e==`function`)ua(e)?(i=Fn(e,i),t.tag=1,t=tr(null,t,e,i,n)):(t.tag=0,t=$n(null,t,e,i,n));else{if(e!=null){var a=e.$$typeof;if(a===Ia){t.tag=11,t=Un(null,t,e,i,n);break a}else if(a===za){t.tag=14,t=Wn(null,t,e,i,n);break a}}throw t=f(e)||e,Error(r(306,t,``))}}return t;case 0:return $n(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,a=Fn(i,t.pendingProps),tr(e,t,i,a,n);case 3:a:{if(ae(t,t.stateNode.containerInfo),e===null)throw Error(r(387));var o=t.pendingProps;a=t.memoizedState,i=a.element,tt(e,t),st(t,o,null,n);var s=t.memoizedState;if(o=s.cache,he(t,ll,o),o!==a.cache&&ve(t,[ll],n,!0),ot(),o=s.element,uo&&a.isDehydrated)if(a={element:o,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=nr(e,t,o,n);break a}else if(o!==i){i=F(Error(r(424)),t),me(i),t=nr(e,t,o,n);break a}else for(uo&&(Qc=gs(t.stateNode.containerInfo),Zc=t,$c=!0,el=null,tl=!0),n=Al(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(pe(),o===i){t=dr(e,t,n);break a}Hn(e,t,o,n)}t=t.child}return t;case 26:if(Us)return Qn(e,t),e===null?(n=Ks(t.type,null,t.pendingProps,null))?t.memoizedState=n:$c||(t.stateNode=Qs(t.type,t.pendingProps,Yc.current,t)):t.memoizedState=Ks(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(rc)return se(t),e===null&&rc&&$c&&(i=t.stateNode=ic(t.type,t.pendingProps,Yc.current,qc.current,!1),Zc=t,tl=!0,Qc=ys(t.type,i,Qc)),Hn(e,t,t.pendingProps.children,n),Qn(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&$c&&(Vs(t.type,t.pendingProps,qc.current),(a=i=Qc)&&(i=bs(i,t.type,t.pendingProps,tl),i===null?a=!1:(t.stateNode=i,Zc=t,Qc=hs(i),tl=!1,a=!0)),a||le(t)),se(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,i=o.children,no(a,o)?i=null:s!==null&&no(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=xt(e,t,Ct,null,null,n),so?Do._currentValue=a:Do._currentValue2=a),Qn(e,t),Hn(e,t,i,n),t.child;case 6:return e===null&&$c&&(Hs(t.pendingProps,qc.current),(e=n=Qc)&&(n=xs(n,t.pendingProps,tl),n===null?e=!1:(t.stateNode=n,Zc=t,Qc=null,e=!0)),e||le(t)),null;case 13:return ar(e,t,n);case 4:return ae(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=kl(t,null,i,n):Hn(e,t,i,n),t.child;case 11:return Un(e,t,t.type,t.pendingProps,n);case 7:return Hn(e,t,t.pendingProps,n),t.child;case 8:return Hn(e,t,t.pendingProps.children,n),t.child;case 12:return Hn(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,he(t,t.type,i.value),Hn(e,t,i.children,n),t.child;case 9:return a=t.type._context,i=t.pendingProps.children,xe(t),a=R(a),i=i(a),t.flags|=1,Hn(e,t,i,n),t.child;case 14:return Wn(e,t,t.type,t.pendingProps,n);case 15:return Gn(e,t,t.type,t.pendingProps,n);case 19:return ur(e,t,n);case 31:return Zn(e,t,n);case 22:return Kn(e,t,n,t.pendingProps);case 24:return xe(t),i=R(ll),e===null?(a=Ie(),a===null&&(a=Su,o=we(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:i,cache:a},et(t),he(t,ll,a)):((e.lanes&n)!==0&&(tt(e,t),st(t,null,null,n),ot()),a=e.memoizedState,o=t.memoizedState,a.parent===i?(i=o.cache,he(t,ll,i),i!==a.cache&&ve(t,[ll],n,!0)):(a={parent:i,cache:i},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),he(t,ll,i))),Hn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function hr(e){e.flags|=4}function gr(e){lo&&(e.flags|=8)}function _r(e,t){if(e!==null&&e.child===t.child)return!1;if(t.flags&16)return!0;for(e=t.child;e!==null;){if(e.flags&8218||e.subtreeFlags&8218)return!0;e=e.sibling}return!1}function vr(e,t,n,r){if(co)for(n=t.child;n!==null;){if(n.tag===5||n.tag===6)eo(e,n.stateNode);else if(!(n.tag===4||rc&&n.tag===27)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}else if(lo)for(var i=t.child;i!==null;){if(i.tag===5){var a=i.stateNode;n&&r&&(a=as(a,i.type,i.memoizedProps)),eo(e,a)}else if(i.tag===6)a=i.stateNode,n&&r&&(a=os(a,i.memoizedProps)),eo(e,a);else if(i.tag!==4){if(i.tag===22&&i.memoizedState!==null)a=i.child,a!==null&&(a.return=i),vr(e,i,!0,!0);else if(i.child!==null){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}}function yr(e,t,n,r){var i=!1;if(lo)for(var a=t.child;a!==null;){if(a.tag===5){var o=a.stateNode;n&&r&&(o=as(o,a.type,a.memoizedProps)),ns(e,o)}else if(a.tag===6)o=a.stateNode,n&&r&&(o=os(o,a.memoizedProps)),ns(e,o);else if(a.tag!==4){if(a.tag===22&&a.memoizedState!==null)i=a.child,i!==null&&(i.return=a),yr(e,a,!0,!0),i=!0;else if(a.child!==null){a.child.return=a,a=a.child;continue}}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return i;a=a.return}a.sibling.return=a.return,a=a.sibling}return i}function br(e,t){if(lo&&_r(e,t)){e=t.stateNode;var n=e.containerInfo,r=ts();yr(r,t,!1,!1),e.pendingChildren=r,hr(t),rs(n,r)}}function xr(e,t,n,r){if(co)e.memoizedProps!==r&&hr(t);else if(lo){var i=e.stateNode,a=e.memoizedProps;if((e=_r(e,t))||a!==r){var o=qc.current;a=es(i,n,a,r,!e,null),a===i?t.stateNode=i:(gr(t),to(a,n,r,o)&&hr(t),t.stateNode=a,e&&vr(a,t,!1,!1))}else t.stateNode=i}}function Sr(e,t,n,r,i){if(e.mode&32&&(n===null?yo(t,r):bo(t,n,r))){if(e.flags|=16777216,(i&335544128)===i||xo(t,r))if(So(e.stateNode,t,r))e.flags|=8192;else if(Fi())e.flags|=8192;else throw El=Tl,Cl}else e.flags&=-16777217}function Cr(e,t){if(ec(t)){if(e.flags|=16777216,!tc(t))if(Fi())e.flags|=8192;else throw El=Tl,Cl}else e.flags&=-16777217}function wr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:x(),e.lanes|=t,Fu|=t)}function Tr(e,t){if(!$c)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Er(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Dr(e,t,n){var i=t.pendingProps;switch(re(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Er(t),null;case 1:return Er(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),ge(ll),oe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(fe(t)?hr(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,L())),br(e,t),Er(t),null;case 26:if(Us){var a=t.type,o=t.memoizedState;return e===null?(hr(t),o===null?(Er(t),Sr(t,a,null,i,n)):(Er(t),Cr(t,o))):o?o===e.memoizedState?(Er(t),t.flags&=-16777217):(hr(t),Er(t),Cr(t,o)):(o=e.memoizedProps,co?o!==i&&hr(t):xr(e,t,a,i),Er(t),Sr(t,a,o,i,n)),null}case 27:if(rc){if(ce(t),n=Yc.current,a=t.type,e!==null&&t.stateNode!=null)co?e.memoizedProps!==i&&hr(t):xr(e,t,a,i);else{if(!i){if(t.stateNode===null)throw Error(r(166));return Er(t),null}e=qc.current,fe(t)?ue(t,e):(e=ic(a,i,n,e,!0),t.stateNode=e,hr(t))}return Er(t),null}case 5:if(ce(t),a=t.type,e!==null&&t.stateNode!=null)xr(e,t,a,i);else{if(!i){if(t.stateNode===null)throw Error(r(166));return Er(t),null}if(o=qc.current,fe(t))ue(t,o),Ps(t.stateNode,a,i,o)&&(t.flags|=64);else{var s=$a(a,i,Yc.current,o,t);gr(t),vr(s,t,!1,!1),t.stateNode=s,to(s,a,i,o)&&hr(t)}}return Er(t),Sr(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)n=e.memoizedProps,co?n!==i&&hr(t):lo&&(n===i?t.stateNode=e.stateNode:(e=Yc.current,n=qc.current,gr(t),t.stateNode=ro(i,e,n,t)));else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(e=Yc.current,n=qc.current,fe(t)){if(!uo)throw Error(r(176));if(e=t.stateNode,n=t.memoizedProps,i=null,a=Zc,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}Ts(e,n,t,i)||le(t,!0)}else gr(t),t.stateNode=ro(i,e,n,t)}return Er(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=fe(t),n!==null){if(e===null){if(!i)throw Error(r(318));if(!uo)throw Error(r(556));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(557));Es(e,t)}else pe(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Er(t),e=!1}else n=L(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(_t(t),t):(_t(t),null);if(t.flags&128)throw Error(r(558))}return Er(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=fe(t),i!==null&&i.dehydrated!==null){if(e===null){if(!a)throw Error(r(318));if(!uo)throw Error(r(344));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(r(317));Ds(a,t)}else pe(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Er(t),a=!1}else a=L(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(_t(t),t):(_t(t),null)}return _t(t),t.flags&128?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),wr(t,t.updateQueue),Er(t),null);case 4:return oe(),br(e,t),e===null&&po(t.stateNode.containerInfo),Er(t),null;case 10:return ge(t.type),Er(t),null;case 19:if(m(Bl),i=t.memoizedState,i===null)return Er(t),null;if(a=(t.flags&128)!=0,o=i.rendering,o===null)if(a)Tr(i,!1);else{if(Au!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=vt(e),o!==null){for(t.flags|=128,Tr(i,!1),e=o.updateQueue,t.updateQueue=e,wr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)fa(n,e),n=n.sibling;return h(Bl,Bl.current&1|2),$c&&I(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Sc()>Vu&&(t.flags|=128,a=!0,Tr(i,!1),t.lanes=4194304)}else{if(!a)if(e=vt(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,wr(t,e),Tr(i,!0),i.tail===null&&i.tailMode===`hidden`&&!o.alternate&&!$c)return Er(t),null}else 2*Sc()-i.renderingStartTime>Vu&&n!==536870912&&(t.flags|=128,a=!0,Tr(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(e=i.last,e===null?t.child=o:e.sibling=o,i.last=o)}return i.tail===null?(Er(t),null):(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Sc(),e.sibling=null,n=Bl.current,h(Bl,a?n&1|2:n&1),$c&&I(t,i.treeForkCount),e);case 22:case 23:return _t(t),ft(),i=t.memoizedState!==null,e===null?i&&(t.flags|=8192):e.memoizedState!==null!==i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(Er(t),t.subtreeFlags&6&&(t.flags|=8192)):Er(t),n=t.updateQueue,n!==null&&wr(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&m(xl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ge(ll),Er(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Or(e,t){switch(re(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ge(ll),oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ce(t),null;case 31:if(t.memoizedState!==null){if(_t(t),t.alternate===null)throw Error(r(340));pe()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(_t(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));pe()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return m(Bl),null;case 4:return oe(),null;case 10:return ge(t.type),null;case 22:case 23:return _t(t),ft(),e!==null&&m(xl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ge(ll),null;case 25:return null;default:return null}}function kr(e,t){switch(re(t),t.tag){case 3:ge(ll),oe();break;case 26:case 27:case 5:ce(t);break;case 4:oe();break;case 31:t.memoizedState!==null&&_t(t);break;case 13:_t(t);break;case 19:m(Bl);break;case 10:ge(t.type);break;case 22:case 23:_t(t),ft(),e!==null&&m(xl);break;case 24:ge(ll)}}function Ar(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){na(t,t.return,e)}}function jr(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){na(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){na(t,t.return,e)}}function Mr(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{lt(t,n)}catch(t){na(e,e.return,t)}}}function Nr(e,t,n){n.props=Fn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){na(e,t,n)}}function Pr(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=Ja(e.stateNode);break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){na(e,t,n)}}function Fr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){na(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){na(e,t,n)}else n.current=null}function Ir(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{Ho(r,t,n,e)}catch(t){na(e,e.return,t)}}function Lr(e,t,n){try{Uo(e.stateNode,e.type,n,t,e)}catch(t){na(e,e.return,t)}}function Rr(e){return e.tag===5||e.tag===3||(Us?e.tag===26:!1)||(rc?e.tag===27&&cc(e.type):!1)||e.tag===4}function zr(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Rr(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(rc&&e.tag===27&&cc(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Br(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Go(n,e,t):Bo(n,e);else if(r!==4&&(rc&&r===27&&cc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Br(e,t,n),e=e.sibling;e!==null;)Br(e,t,n),e=e.sibling}function Vr(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Wo(n,e,t):zo(n,e);else if(r!==4&&(rc&&r===27&&cc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Vr(e,t,n),e=e.sibling;e!==null;)Vr(e,t,n),e=e.sibling}function Hr(e,t,n){e=e.containerInfo;try{is(e,n)}catch(e){na(t,t.return,e)}}function Ur(e){var t=e.stateNode,n=e.memoizedProps;try{ac(e.type,n,t,e)}catch(t){na(e,e.return,t)}}function Wr(e,t){for(Za(e.containerInfo),lu=t;lu!==null;)if(e=lu,t=e.child,e.subtreeFlags&1028&&t!==null)t.return=e,lu=t;else for(;lu!==null;){e=lu;var n=e.alternate;switch(t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t===null?null:t.events,t!==null))for(var i=0;i<t.length;i++){var a=t[i];a.ref.impl=a.nextImpl}break;case 11:case 15:break;case 1:if(t&1024&&n!==null){t=void 0,i=e,a=n.memoizedProps,n=n.memoizedState;var o=i.stateNode;try{var s=Fn(i.type,a);t=o.getSnapshotBeforeUpdate(s,n),o.__reactInternalSnapshotBeforeUpdate=t}catch(e){na(i,i.return,e)}}break;case 3:t&1024&&co&&$o(e.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(r(163))}if(t=e.sibling,t!==null){t.return=e.return,lu=t;break}lu=e.return}}function Gr(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ri(e,n),r&4&&Ar(5,n);break;case 1:if(ri(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){na(n,n.return,e)}else{var i=Fn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){na(n,n.return,e)}}r&64&&Mr(n),r&512&&Pr(n,n.return);break;case 3:if(ri(e,n),r&64&&(r=n.updateQueue,r!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=Ja(n.child.stateNode);break;case 1:e=n.child.stateNode}try{lt(r,e)}catch(e){na(n,n.return,e)}}break;case 27:rc&&t===null&&r&4&&Ur(n);case 26:case 5:if(ri(e,n),t===null){if(r&4)Ir(n);else if(r&64){e=n.type,t=n.memoizedProps,i=n.stateNode;try{As(i,e,t,n)}catch(e){na(n,n.return,e)}}}r&512&&Pr(n,n.return);break;case 12:ri(e,n);break;case 31:ri(e,n),r&4&&Yr(e,n);break;case 13:ri(e,n),r&4&&Xr(e,n),r&64&&(r=n.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(n=oa.bind(null,n),us(r,n))));break;case 22:if(r=n.memoizedState!==null||au,!r){t=t!==null&&t.memoizedState!==null||ou,i=au;var a=ou;au=r,(ou=t)&&!a?ai(e,n,(n.subtreeFlags&8772)!=0):ri(e,n),au=i,ou=a}break;case 30:break;default:ri(e,n)}}function Kr(e){var t=e.alternate;t!==null&&(e.alternate=null,Kr(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vo(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qr(e,t,n){for(n=n.child;n!==null;)Jr(e,t,n),n=n.sibling}function Jr(e,t,n){if(Ac&&typeof Ac.onCommitFiberUnmount==`function`)try{Ac.onCommitFiberUnmount(kc,n)}catch{}switch(n.tag){case 26:if(Us){ou||Fr(n,t),qr(e,t,n),n.memoizedState?Js(n.memoizedState):n.stateNode&&Zs(n.stateNode);break}case 27:if(rc){ou||Fr(n,t);var r=uu,i=du;cc(n.type)&&(uu=n.stateNode,du=!1),qr(e,t,n),oc(n.stateNode),uu=r,du=i;break}case 5:ou||Fr(n,t);case 6:if(co){if(r=uu,i=du,uu=null,qr(e,t,n),uu=r,du=i,uu!==null)if(du)try{qo(uu,n.stateNode)}catch(e){na(n,t,e)}else try{Ko(uu,n.stateNode)}catch(e){na(n,t,e)}}else qr(e,t,n);break;case 18:co&&uu!==null&&(du?Ls(uu,n.stateNode):Is(uu,n.stateNode));break;case 4:co?(r=uu,i=du,uu=n.stateNode.containerInfo,du=!0,qr(e,t,n),uu=r,du=i):(lo&&Hr(n.stateNode,n,ts()),qr(e,t,n));break;case 0:case 11:case 14:case 15:jr(2,n,t),ou||jr(4,n,t),qr(e,t,n);break;case 1:ou||(Fr(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Nr(n,t,r)),qr(e,t,n);break;case 21:qr(e,t,n);break;case 22:ou=(r=ou)||n.memoizedState!==null,qr(e,t,n),ou=r;break;default:qr(e,t,n)}}function Yr(e,t){if(uo&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ms(e)}catch(e){na(t,t.return,e)}}}function Xr(e,t){if(uo&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ns(e)}catch(e){na(t,t.return,e)}}function Zr(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new cu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new cu),t;default:throw Error(r(435,e.tag))}}function Qr(e,t){var n=Zr(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=sa.bind(null,e,t);t.then(r,r)}})}function $r(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i],o=e,s=t;if(co){var c=s;a:for(;c!==null;){switch(c.tag){case 27:if(rc){if(cc(c.type)){uu=c.stateNode,du=!1;break a}break}case 5:uu=c.stateNode,du=!1;break a;case 3:case 4:uu=c.stateNode.containerInfo,du=!0;break a}c=c.return}if(uu===null)throw Error(r(160));Jr(o,s,a),uu=null,du=!1}else Jr(o,s,a);o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ei(t,e),t=t.sibling}function ei(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:$r(t,e),ti(e),i&4&&(jr(3,e,e.return),Ar(3,e),jr(5,e,e.return));break;case 1:$r(t,e),ti(e),i&512&&(ou||n===null||Fr(n,n.return)),i&64&&au&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:if(Us){var a=fu;if($r(t,e),ti(e),i&512&&(ou||n===null||Fr(n,n.return)),i&4){i=n===null?null:n.memoizedState;var o=e.memoizedState;n===null?o===null?e.stateNode===null?e.stateNode=Ys(a,e.type,e.memoizedProps,e):Xs(a,e.type,e.stateNode):e.stateNode=qs(a,o,e.memoizedProps):i===o?o===null&&e.stateNode!==null&&Lr(e,e.memoizedProps,n.memoizedProps):(i===null?n.stateNode!==null&&Zs(n.stateNode):Js(i),o===null?Xs(a,e.type,e.stateNode):qs(a,o,e.memoizedProps))}break}case 27:if(rc){$r(t,e),ti(e),i&512&&(ou||n===null||Fr(n,n.return)),n!==null&&i&4&&Lr(e,e.memoizedProps,n.memoizedProps);break}case 5:if($r(t,e),ti(e),i&512&&(ou||n===null||Fr(n,n.return)),co){if(e.flags&32){a=e.stateNode;try{Jo(a)}catch(t){na(e,e.return,t)}}i&4&&e.stateNode!=null&&(a=e.memoizedProps,Lr(e,a,n===null?a:n.memoizedProps)),i&1024&&(su=!0)}else lo&&e.alternate!==null&&(e.alternate.stateNode=e.stateNode);break;case 6:if($r(t,e),ti(e),i&4&&co){if(e.stateNode===null)throw Error(r(162));i=e.memoizedProps,n=n===null?i:n.memoizedProps,a=e.stateNode;try{Vo(a,n,i)}catch(t){na(e,e.return,t)}}break;case 3:if(Us?($s(),a=fu,fu=Gs(t.containerInfo),$r(t,e),fu=a):$r(t,e),ti(e),i&4){if(co&&uo&&n!==null&&n.memoizedState.isDehydrated)try{js(t.containerInfo)}catch(t){na(e,e.return,t)}if(lo){i=t.containerInfo,n=t.pendingChildren;try{is(i,n)}catch(t){na(e,e.return,t)}}}su&&(su=!1,ni(e));break;case 4:Us?(n=fu,fu=Gs(e.stateNode.containerInfo),$r(t,e),ti(e),fu=n):($r(t,e),ti(e)),i&4&&lo&&Hr(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:$r(t,e),ti(e);break;case 31:$r(t,e),ti(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Qr(e,i)));break;case 13:$r(t,e),ti(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(zu=Sc()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Qr(e,i)));break;case 22:a=e.memoizedState!==null;var s=n!==null&&n.memoizedState!==null,c=au,l=ou;if(au=c||a,ou=l||s,$r(t,e),ou=l,au=c,ti(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||s||au||ou||ii(e)),co)){a:if(n=null,co)for(t=e;;){if(t.tag===5||Us&&t.tag===26){if(n===null){s=n=t;try{o=s.stateNode,a?Yo(o):Zo(s.stateNode,s.memoizedProps)}catch(e){na(s,s.return,e)}}}else if(t.tag===6){if(n===null){s=t;try{var u=s.stateNode;a?Xo(u):Qo(u,s.memoizedProps)}catch(e){na(s,s.return,e)}}}else if(t.tag===18){if(n===null){s=t;try{var d=s.stateNode;a?Rs(d):zs(s.stateNode)}catch(e){na(s,s.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Qr(e,n))));break;case 19:$r(t,e),ti(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Qr(e,i)));break;case 30:break;case 21:break;default:$r(t,e),ti(e)}}function ti(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(Rr(i)){n=i;break}i=i.return}if(co){if(n==null)throw Error(r(160));switch(n.tag){case 27:if(rc){var a=n.stateNode;Vr(e,zr(e),a);break}case 5:var o=n.stateNode;n.flags&32&&(Jo(o),n.flags&=-33),Vr(e,zr(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Br(e,zr(e),s);break;default:throw Error(r(161))}}}catch(t){na(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ni(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ni(t),t.tag===5&&t.flags&1024&&Oo(t.stateNode),e=e.sibling}}function ri(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Gr(e,t.alternate,t),t=t.sibling}function ii(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:jr(4,t,t.return),ii(t);break;case 1:Fr(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Nr(t,t.return,n),ii(t);break;case 27:rc&&oc(t.stateNode);case 26:case 5:Fr(t,t.return),ii(t);break;case 22:t.memoizedState===null&&ii(t);break;case 30:ii(t);break;default:ii(t)}e=e.sibling}}function ai(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:ai(i,a,n),Ar(4,a);break;case 1:if(ai(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){na(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)ct(c[i],s)}catch(e){na(r,r.return,e)}}n&&o&64&&Mr(a),Pr(a,a.return);break;case 27:rc&&Ur(a);case 26:case 5:ai(i,a,n),n&&r===null&&o&4&&Ir(a),Pr(a,a.return);break;case 12:ai(i,a,n);break;case 31:ai(i,a,n),n&&o&4&&Yr(i,a);break;case 13:ai(i,a,n),n&&o&4&&Xr(i,a);break;case 22:a.memoizedState===null&&ai(i,a,n),Pr(a,a.return);break;case 30:break;default:ai(i,a,n)}t=t.sibling}}function oi(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Te(n))}function si(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Te(e))}function ci(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)li(e,t,n,r),t=t.sibling}function li(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:ci(e,t,n,r),i&2048&&Ar(9,t);break;case 1:ci(e,t,n,r);break;case 3:ci(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Te(e)));break;case 12:if(i&2048){ci(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){na(t,t.return,e)}}else ci(e,t,n,r);break;case 31:ci(e,t,n,r);break;case 13:ci(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?ci(e,t,n,r):(a._visibility|=2,ui(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?ci(e,t,n,r):di(e,t),i&2048&&oi(o,t);break;case 24:ci(e,t,n,r),i&2048&&si(t.alternate,t);break;default:ci(e,t,n,r)}}function ui(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:ui(a,o,s,c,i),Ar(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,ui(a,o,s,c,i)):u._visibility&2?ui(a,o,s,c,i):di(a,o),i&&l&2048&&oi(o.alternate,o);break;case 24:ui(a,o,s,c,i),i&&l&2048&&si(o.alternate,o);break;default:ui(a,o,s,c,i)}t=t.sibling}}function di(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:di(n,r),i&2048&&oi(r.alternate,r);break;case 24:di(n,r),i&2048&&si(r.alternate,r);break;default:di(n,r)}t=t.sibling}}function fi(e,t,n){if(e.subtreeFlags&pu)for(e=e.child;e!==null;)pi(e,t,n),e=e.sibling}function pi(e,t,n){switch(e.tag){case 26:if(fi(e,t,n),e.flags&pu)if(e.memoizedState!==null)nc(n,fu,e.memoizedState,e.memoizedProps);else{var r=e.stateNode,i=e.type;e=e.memoizedProps,((t&335544128)===t||xo(i,e))&&wo(n,r,i,e)}break;case 5:fi(e,t,n),e.flags&pu&&(r=e.stateNode,i=e.type,e=e.memoizedProps,((t&335544128)===t||xo(i,e))&&wo(n,r,i,e));break;case 3:case 4:Us?(r=fu,fu=Gs(e.stateNode.containerInfo),fi(e,t,n),fu=r):fi(e,t,n);break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=pu,pu=16777216,fi(e,t,n),pu=r):fi(e,t,n));break;default:fi(e,t,n)}}function mi(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function hi(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];lu=r,vi(r,e)}mi(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)gi(e),e=e.sibling}function gi(e){switch(e.tag){case 0:case 11:case 15:hi(e),e.flags&2048&&jr(9,e,e.return);break;case 3:hi(e);break;case 12:hi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,_i(e)):hi(e);break;default:hi(e)}}function _i(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];lu=r,vi(r,e)}mi(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:jr(8,t,t.return),_i(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,_i(t));break;default:_i(t)}e=e.sibling}}function vi(e,t){for(;lu!==null;){var n=lu;switch(n.tag){case 0:case 11:case 15:jr(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Te(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,lu=r;else a:for(n=e;lu!==null;){r=lu;var i=r.sibling,a=r.return;if(Kr(r),r===n){lu=null;break a}if(i!==null){i.return=a,lu=i;break a}lu=a}}}function yi(e){var t=fo(e);if(t!=null){if(typeof t.memoizedProps[`data-testname`]!=`string`)throw Error(r(364));return t}if(e=Mo(e),e===null)throw Error(r(362));return e.stateNode.current}function bi(e,t){var n=e.tag;switch(t.$$typeof){case hu:if(e.type===t.value)return!0;break;case gu:a:{for(t=t.value,e=[e,0],n=0;n<e.length;){var i=e[n++],a=i.tag,o=e[n++],s=t[o];if(a!==5&&a!==26&&a!==27||!Fo(i)){for(;s!=null&&bi(i,s);)o++,s=t[o];if(o===t.length){t=!0;break a}else for(i=i.child;i!==null;)e.push(i,o),i=i.sibling}}t=!1}return t;case _u:if((n===5||n===26||n===27)&&Io(e.stateNode,t.value))return!0;break;case yu:if((n===5||n===6||n===26||n===27)&&(e=Po(e),e!==null&&0<=e.indexOf(t.value)))return!0;break;case vu:if((n===5||n===26||n===27)&&(e=e.memoizedProps[`data-testname`],typeof e==`string`&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(r(365))}return!1}function xi(e){switch(e.$$typeof){case hu:return`<`+(f(e.value)||`Unknown`)+`>`;case gu:return`:has(`+(xi(e)||``)+`)`;case _u:return`[role="`+e.value+`"]`;case yu:return`"`+e.value+`"`;case vu:return`[data-testname="`+e.value+`"]`;default:throw Error(r(365))}}function Si(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],a=i.tag,o=e[r++],s=t[o];if(a!==5&&a!==26&&a!==27||!Fo(i)){for(;s!=null&&bi(i,s);)o++,s=t[o];if(o===t.length)n.push(i);else for(i=i.child;i!==null;)e.push(i,o),i=i.sibling}}return n}function Ci(e,t){if(!jo)throw Error(r(363));e=yi(e),e=Si(e,t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var i=e[n++],a=i.tag;if(a===5||a===26||a===27)Fo(i)||t.push(i.stateNode);else for(i=i.child;i!==null;)e.push(i),i=i.sibling}return t}function wi(){return Z&2&&Cu!==0?Cu&-Cu:Y.T===null?go():Me()}function Ti(){if(Pu===0)if(!(Cu&536870912)||$c){var e=gc;gc<<=1,!(gc&3932160)&&(gc=262144),Pu=e}else Pu=536870912;return e=Rl.current,e!==null&&(e.flags|=32),Pu}function Ei(e,t,n){(e===Su&&(wu===2||wu===9)||e.cancelPendingCommit!==null)&&(Ni(e,0),Ai(e,Cu,Pu,!1)),C(e,n),(!(Z&2)||e!==Su)&&(e===Su&&(!(Z&2)&&(Mu|=n),Au===4&&Ai(e,Cu,Pu,!1)),De(e))}function Di(e,t,n){if(Z&6)throw Error(r(327));var i=!n&&(t&127)==0&&(t&e.expiredLanes)===0||y(e,t),a=i?Vi(e,t):zi(e,t,!0),o=i;do{if(a===0){Du&&!i&&Ai(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!ki(n)){a=zi(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Iu;var l=uo&&c.current.memoizedState.isDehydrated;if(l&&(Ni(c,s).flags|=256),s=zi(c,s,!1),s!==2){if(Ou&&!l){c.errorRecoveryDisabledLanes|=o,Mu|=o,a=4;break a}o=Lu,Lu=a,o!==null&&(Lu===null?Lu=o:Lu.push.apply(Lu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Ni(e,0),Ai(e,t,0,!0);break}a:{switch(i=e,o=a,o){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Ai(i,t,Pu,!Eu);break a;case 2:Lu=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(a=zu+300-Sc(),10<a)){if(Ai(i,t,Pu,!Eu),v(i,0,!0)!==0)break a;Ku=t,i.timeoutHandle=io(Oi.bind(null,i,n,Lu,Hu,Ru,t,Pu,Mu,Fu,Eu,o,`Throttled`,-0,0),a);break a}Oi(i,n,Lu,Hu,Ru,t,Pu,Mu,Fu,Eu,o,null,-0,0)}}break}while(1);De(e)}function Oi(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=oo,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d=Co(),pi(t,a,d);var m=(a&62914560)===a?zu-Sc():(a&4194048)===a?Bu-Sc():0;if(m=To(d,m),m!==null){Ku=a,e.cancelPendingCommit=m(Ji.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Ai(e,a,o,!l);return}}Ji(e,t,a,n,r,i,o,s,c)}function ki(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!jc(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ai(e,t,n,r){t&=~Nu,t&=~Mu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-fc(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&T(e,n,t)}function ji(){return Z&6?!0:(z(0,!1),!1)}function Mi(){if(Q!==null){if(wu===0)var e=Q.return;else e=Q,al=il=null,Et(e),Dl=null,Ol=0,e=Q;for(;e!==null;)kr(e.alternate,e),e=e.return;Q=null}}function Ni(e,t){var n=e.timeoutHandle;n!==oo&&(e.timeoutHandle=oo,ao(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ku=0,Mi(),Su=e,Q=n=da(e.current,null),Cu=t,wu=0,Tu=null,Eu=!1,Du=y(e,t),Ou=!1,Fu=Pu=Nu=Mu=ju=Au=0,Lu=Iu=null,Ru=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-fc(r),a=1<<i;t|=e[i],r&=~a}return ku=t,Ye(),n}function Pi(e,t){X=null,Y.H=Zl,t===Sl||t===wl?(t=Ue(),wu=3):t===Cl?(t=Ue(),wu=4):wu=t===nu?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Tu=t,Q===null&&(Au=1,In(e,F(t,e.current)))}function Fi(){var e=Rl.current;return e===null?!0:(Cu&4194048)===Cu?zl===null:(Cu&62914560)===Cu||Cu&536870912?e===zl:!1}function Ii(){var e=Y.H;return Y.H=Zl,e===null?Zl:e}function Li(){var e=Y.A;return Y.A=mu,e}function Ri(){Au=4,Eu||(Cu&4194048)!==Cu&&Rl.current!==null||(Du=!0),!(ju&134217727)&&!(Mu&134217727)||Su===null||Ai(Su,Cu,Pu,!1)}function zi(e,t,n){var r=Z;Z|=2;var i=Ii(),a=Li();(Su!==e||Cu!==t)&&(Hu=null,Ni(e,t)),t=!1;var o=Au;a:do try{if(wu!==0&&Q!==null){var s=Q,c=Tu;switch(wu){case 8:Mi(),o=6;break a;case 3:case 2:case 9:case 6:Rl.current===null&&(t=!0);var l=wu;if(wu=0,Tu=null,Gi(e,s,c,l),n&&Du){o=0;break a}break;default:l=wu,wu=0,Tu=null,Gi(e,s,c,l)}}Bi(),o=Au;break}catch(t){Pi(e,t)}while(1);return t&&e.shellSuspendCounter++,al=il=null,Z=r,Y.H=i,Y.A=a,Q===null&&(Su=null,Cu=0,Ye()),o}function Bi(){for(;Q!==null;)Ui(Q)}function Vi(e,t){var n=Z;Z|=2;var i=Ii(),a=Li();Su!==e||Cu!==t?(Hu=null,Vu=Sc()+500,Ni(e,t)):Du=y(e,t);a:do try{if(wu!==0&&Q!==null){t=Q;var o=Tu;b:switch(wu){case 1:wu=0,Tu=null,Gi(e,t,o,1);break;case 2:case 9:if(Be(o)){wu=0,Tu=null,Wi(t);break}t=function(){wu!==2&&wu!==9||Su!==e||(wu=7),De(e)},o.then(t,t);break a;case 3:wu=7;break a;case 4:wu=5;break a;case 7:Be(o)?(wu=0,Tu=null,Wi(t)):(wu=0,Tu=null,Gi(e,t,o,7));break;case 5:var s=null;switch(Q.tag){case 26:s=Q.memoizedState;case 5:case 27:var c=Q,l=c.type,u=c.pendingProps;if(s?tc(s):So(c.stateNode,l,u)){wu=0,Tu=null;var d=c.sibling;if(d!==null)Q=d;else{var f=c.return;f===null?Q=null:(Q=f,Ki(f))}break b}}wu=0,Tu=null,Gi(e,t,o,5);break;case 6:wu=0,Tu=null,Gi(e,t,o,6);break;case 8:Mi(),Au=6;break a;default:throw Error(r(462))}}Hi();break}catch(t){Pi(e,t)}while(1);return al=il=null,Y.H=i,Y.A=a,Z=n,Q===null?(Su=null,Cu=0,Ye(),Au):0}function Hi(){for(;Q!==null&&!bc();)Ui(Q)}function Ui(e){var t=mr(e.alternate,e,ku);e.memoizedProps=e.pendingProps,t===null?Ki(e):Q=t}function Wi(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=er(n,t,t.pendingProps,t.type,void 0,Cu);break;case 11:t=er(n,t,t.pendingProps,t.type.render,t.ref,Cu);break;case 5:Et(t);default:kr(n,t),t=Q=fa(t,ku),t=mr(n,t,ku)}e.memoizedProps=e.pendingProps,t===null?Ki(e):Q=t}function Gi(e,t,n,r){al=il=null,Et(t),Dl=null,Ol=0;var i=t.return;try{if(Vn(e,i,t,n,Cu)){Au=1,In(e,F(n,e.current)),Q=null;return}}catch(t){if(i!==null)throw Q=i,t;Au=1,In(e,F(n,e.current)),Q=null;return}t.flags&32768?($c||r===1?e=!0:Du||Cu&536870912?e=!1:(Eu=e=!0,(r===2||r===9||r===3||r===6)&&(r=Rl.current,r!==null&&r.tag===13&&(r.flags|=16384))),qi(t,e)):Ki(t)}function Ki(e){var t=e;do{if(t.flags&32768){qi(t,Eu);return}e=t.return;var n=Dr(t.alternate,t,ku);if(n!==null){Q=n;return}if(t=t.sibling,t!==null){Q=t;return}Q=t=e}while(t!==null);Au===0&&(Au=5)}function qi(e,t){do{var n=Or(e.alternate,e);if(n!==null){n.flags&=32767,Q=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Q=e;return}Q=e=n}while(e!==null);Au=6,Q=null}function Ji(e,t,n,i,a,o,s,c,l){e.cancelPendingCommit=null;do $i();while($!==0);if(Z&6)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(o=t.lanes|t.childLanes,o|=Nl,w(e,n,o,s,c,l),e===Su&&(Q=Su=null,Cu=0),Gu=t,Wu=e,Ku=n,qu=o,Ju=a,Yu=i,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ca(Tc,function(){return ea(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!=0,t.subtreeFlags&13878||i){i=Y.T,Y.T=null,a=ho(),mo(2),s=Z,Z|=4;try{Wr(e,t,n)}finally{Z=s,mo(a),Y.T=i}}$=1,Yi(),Xi(),Zi()}}function Yi(){if($===1){$=0;var e=Wu,t=Gu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=Y.T,Y.T=null;var r=ho();mo(2);var i=Z;Z|=4;try{ei(t,e),Qa(e.containerInfo)}finally{Z=i,mo(r),Y.T=n}}e.current=t,$=2}}function Xi(){if($===2){$=0;var e=Wu,t=Gu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=Y.T,Y.T=null;var r=ho();mo(2);var i=Z;Z|=4;try{Gr(e,t.alternate,t)}finally{Z=i,mo(r),Y.T=n}}$=3}}function Zi(){if($===4||$===3){$=0,xc();var e=Wu,t=Gu,n=Ku,r=Yu;t.subtreeFlags&10256||t.flags&10256?$=5:($=0,Gu=Wu=null,Qi(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Uu=null),k(n),t=t.stateNode,Ac&&typeof Ac.onCommitFiberRoot==`function`)try{Ac.onCommitFiberRoot(kc,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=Y.T,i=ho(),mo(2),Y.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{Y.T=t,mo(i)}}Ku&3&&$i(),De(e),i=e.pendingLanes,n&261930&&i&42?e===Zu?Xu++:(Xu=0,Zu=e):Xu=0,uo&&Fs(),z(0,!1)}}function Qi(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Te(t)))}function $i(){return Yi(),Xi(),Zi(),ea()}function ea(){if($!==5)return!1;var e=Wu,t=qu;qu=0;var n=k(Ku),i=32>n?32:n;n=Y.T;var a=ho();try{mo(i),Y.T=null,i=Ju,Ju=null;var o=Wu,s=Ku;if($=0,Gu=Wu=null,Ku=0,Z&6)throw Error(r(331));var c=Z;if(Z|=4,gi(o.current),li(o,o.current,s,i),Z=c,z(0,!1),Ac&&typeof Ac.onPostCommitFiberRoot==`function`)try{Ac.onPostCommitFiberRoot(kc,o)}catch{}return!0}finally{mo(a),Y.T=n,Qi(e,t)}}function ta(e,t,n){t=F(n,t),t=Rn(e.stateNode,t,2),e=rt(e,t,2),e!==null&&(C(e,2),De(e))}function na(e,t,n){if(e.tag===3)ta(e,e,n);else for(;t!==null;){if(t.tag===3){ta(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Uu===null||!Uu.has(r))){e=F(n,e),n=zn(2),r=rt(t,n,2),r!==null&&(Bn(n,r,t,e),C(r,2),De(r));break}}t=t.return}}function ra(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new xu;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ou=!0,i.add(n),e=ia.bind(null,e,t,n),t.then(e,e))}function ia(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Su===e&&(Cu&n)===n&&(Au===4||Au===3&&(Cu&62914560)===Cu&&300>Sc()-zu?!(Z&2)&&Ni(e,0):Nu|=n,Fu===Cu&&(Fu=0)),De(e)}function aa(e,t){t===0&&(t=x()),e=H(e,t),e!==null&&(C(e,t),De(e))}function oa(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),aa(e,n)}function sa(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(r(314))}i!==null&&i.delete(t),aa(e,n)}function ca(e,t){return vc(e,t)}function la(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ua(e){return e=e.prototype,!(!e||!e.isReactComponent)}function da(e,n){var r=e.alternate;return r===null?(r=t(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function fa(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function pa(e,n,i,a,o,s){var c=0;if(a=e,typeof e==`function`)ua(e)&&(c=1);else if(typeof e==`string`)c=Us&&rc?Ws(e,i,qc.current)?26:sc(e)?27:5:Us?Ws(e,i,qc.current)?26:5:rc&&sc(e)?27:5;else a:switch(e){case Va:return e=t(31,i,n,o),e.elementType=Va,e.lanes=s,e;case ja:return ma(i.children,o,s,n);case Ma:c=8,o|=24;break;case Na:return e=t(12,i,n,o|2),e.elementType=Na,e.lanes=s,e;case La:return e=t(13,i,n,o),e.elementType=La,e.lanes=s,e;case Ra:return e=t(19,i,n,o),e.elementType=Ra,e.lanes=s,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case Fa:c=10;break a;case Pa:c=9;break a;case Ia:c=11;break a;case za:c=14;break a;case Ba:c=16,a=null;break a}c=29,i=Error(r(130,e===null?`null`:typeof e,``)),a=null}return n=t(c,i,n,o),n.elementType=e,n.type=a,n.lanes=s,n}function ma(e,n,r,i){return e=t(7,e,i,n),e.lanes=r,e}function ha(e,n,r){return e=t(6,e,null,n),e.lanes=r,e}function ga(e){var n=t(18,null,null,0);return n.stateNode=e,n}function _a(e,n,r){return n=t(4,e.children===null?[]:e.children,e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function va(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=oo,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=S(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=S(0),this.hiddenUpdates=S(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ya(e,n,r,i,a,o,s,c,l,u,d,f){return e=new va(e,n,r,s,l,u,d,f,c),n=1,!0===o&&(n|=24),o=t(3,null,null,n),e.current=o,o.stateNode=e,n=we(),n.refCount++,e.pooledCache=n,n.refCount++,o.memoizedState={element:i,isDehydrated:r,cache:n},et(o),e}function ba(e){return e?(e=dc,e):dc}function xa(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=s(t),e=e===null?null:l(e),e===null?null:Ja(e.stateNode)}function Sa(e,t,n,r,i,a){i=ba(i),r.context===null?r.context=i:r.pendingContext=i,r=nt(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=rt(e,r,t),n!==null&&(Ei(n,e,t),it(n,e,t))}function Ca(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function wa(e,t){Ca(e,t),(e=e.alternate)&&Ca(e,t)}var q={},Ta=i(),Ea=c(),Da=Object.assign,Oa=Symbol.for(`react.element`),ka=Symbol.for(`react.transitional.element`),Aa=Symbol.for(`react.portal`),ja=Symbol.for(`react.fragment`),Ma=Symbol.for(`react.strict_mode`),Na=Symbol.for(`react.profiler`),Pa=Symbol.for(`react.consumer`),Fa=Symbol.for(`react.context`),Ia=Symbol.for(`react.forward_ref`),La=Symbol.for(`react.suspense`),Ra=Symbol.for(`react.suspense_list`),za=Symbol.for(`react.memo`),Ba=Symbol.for(`react.lazy`),Va=Symbol.for(`react.activity`),Ha=Symbol.for(`react.memo_cache_sentinel`),Ua=Symbol.iterator,Wa=Symbol.for(`react.client.reference`),J=Array.isArray,Y=Ta.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ga=e.rendererVersion,Ka=e.rendererPackageName,qa=e.extraDevToolsConfig,Ja=e.getPublicInstance,Ya=e.getRootHostContext,Xa=e.getChildHostContext,Za=e.prepareForCommit,Qa=e.resetAfterCommit,$a=e.createInstance;e.cloneMutableInstance;var eo=e.appendInitialChild,to=e.finalizeInitialChildren,no=e.shouldSetTextContent,ro=e.createTextInstance;e.cloneMutableTextInstance;var io=e.scheduleTimeout,ao=e.cancelTimeout,oo=e.noTimeout,so=e.isPrimaryRenderer;e.warnsIfNotActing;var co=e.supportsMutation,lo=e.supportsPersistence,uo=e.supportsHydration,fo=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var po=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var mo=e.setCurrentUpdatePriority,ho=e.getCurrentUpdatePriority,go=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var _o=e.shouldAttemptEagerTransition,vo=e.detachDeletedInstance;e.requestPostPaintCallback;var yo=e.maySuspendCommit,bo=e.maySuspendCommitOnUpdate,xo=e.maySuspendCommitInSyncRender,So=e.preloadInstance,Co=e.startSuspendingCommit,wo=e.suspendInstance;e.suspendOnActiveViewTransition;var To=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Eo=e.NotPendingTransition,Do=e.HostTransitionContext,Oo=e.resetFormInstance;e.bindToConsole;var ko=e.supportsMicrotasks,Ao=e.scheduleMicrotask,jo=e.supportsTestSelectors,Mo=e.findFiberRoot,No=e.getBoundingRect,Po=e.getTextContent,Fo=e.isHiddenSubtree,Io=e.matchAccessibilityRole,Lo=e.setFocusIfFocusable,Ro=e.setupIntersectionObserver,zo=e.appendChild,Bo=e.appendChildToContainer,Vo=e.commitTextUpdate,Ho=e.commitMount,Uo=e.commitUpdate,Wo=e.insertBefore,Go=e.insertInContainerBefore,Ko=e.removeChild,qo=e.removeChildFromContainer,Jo=e.resetTextContent,Yo=e.hideInstance,Xo=e.hideTextInstance,Zo=e.unhideInstance,Qo=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var $o=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var es=e.cloneInstance,ts=e.createContainerChildSet,ns=e.appendChildToContainerChildSet,rs=e.finalizeContainerChildren,is=e.replaceContainerChildren,as=e.cloneHiddenInstance,os=e.cloneHiddenTextInstance,ss=e.isSuspenseInstancePending,cs=e.isSuspenseInstanceFallback,ls=e.getSuspenseInstanceFallbackErrorDetails,us=e.registerSuspenseInstanceRetry,ds=e.canHydrateFormStateMarker,fs=e.isFormStateMarkerMatching,ps=e.getNextHydratableSibling,ms=e.getNextHydratableSiblingAfterSingleton,hs=e.getFirstHydratableChild,gs=e.getFirstHydratableChildWithinContainer,_s=e.getFirstHydratableChildWithinActivityInstance,vs=e.getFirstHydratableChildWithinSuspenseInstance,ys=e.getFirstHydratableChildWithinSingleton,bs=e.canHydrateInstance,xs=e.canHydrateTextInstance,Ss=e.canHydrateActivityInstance,Cs=e.canHydrateSuspenseInstance,ws=e.hydrateInstance,Ts=e.hydrateTextInstance,Es=e.hydrateActivityInstance,Ds=e.hydrateSuspenseInstance,Os=e.getNextHydratableInstanceAfterActivityInstance,ks=e.getNextHydratableInstanceAfterSuspenseInstance,As=e.commitHydratedInstance,js=e.commitHydratedContainer,Ms=e.commitHydratedActivityInstance,Ns=e.commitHydratedSuspenseInstance,Ps=e.finalizeHydratedChildren,Fs=e.flushHydrationEvents;e.clearActivityBoundary;var Is=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Ls=e.clearSuspenseBoundaryFromContainer,Rs=e.hideDehydratedBoundary,zs=e.unhideDehydratedBoundary,Bs=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var Vs=e.validateHydratableInstance,Hs=e.validateHydratableTextInstance,Us=e.supportsResources,Ws=e.isHostHoistableType,Gs=e.getHoistableRoot,Ks=e.getResource,qs=e.acquireResource,Js=e.releaseResource,Ys=e.hydrateHoistable,Xs=e.mountHoistable,Zs=e.unmountHoistable,Qs=e.createHoistableInstance,$s=e.prepareToCommitHoistables,ec=e.mayResourceSuspendCommit,tc=e.preloadResource,nc=e.suspendResource,rc=e.supportsSingletons,ic=e.resolveSingletonInstance,ac=e.acquireSingletonInstance,oc=e.releaseSingletonInstance,sc=e.isHostSingletonType,cc=e.isSingletonScope,lc=[],uc=-1,dc={},fc=Math.clz32?Math.clz32:g,pc=Math.log,mc=Math.LN2,hc=256,gc=262144,_c=4194304,vc=Ea.unstable_scheduleCallback,yc=Ea.unstable_cancelCallback,bc=Ea.unstable_shouldYield,xc=Ea.unstable_requestPaint,Sc=Ea.unstable_now,Cc=Ea.unstable_ImmediatePriority,wc=Ea.unstable_UserBlockingPriority,Tc=Ea.unstable_NormalPriority,Ec=Ea.unstable_IdlePriority,Dc=Ea.log,Oc=Ea.unstable_setDisableYieldValue,kc=null,Ac=null,jc=typeof Object.is==`function`?Object.is:j,Mc=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Nc=Object.prototype.hasOwnProperty,Pc,Fc,Ic=!1,Lc=new WeakMap,Rc=[],zc=0,Bc=null,Vc=0,Hc=[],Uc=0,Wc=null,Gc=1,Kc=``,qc=p(null),Jc=p(null),Yc=p(null),Xc=p(null),Zc=null,Qc=null,$c=!1,el=null,tl=!1,nl=Error(r(519)),rl=p(null),il=null,al=null,ol=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},sl=Ea.unstable_scheduleCallback,cl=Ea.unstable_NormalPriority,ll={$$typeof:Fa,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},ul=null,dl=null,fl=!1,pl=!1,ml=!1,hl=0,gl=null,_l=0,vl=0,yl=null,bl=Y.S;Y.S=function(e,t){Bu=Sc(),typeof t==`object`&&t&&typeof t.then==`function`&&Ne(e,t),bl!==null&&bl(e,t)};var xl=p(null),Sl=Error(r(460)),Cl=Error(r(474)),wl=Error(r(542)),Tl={then:function(){}},El=null,Dl=null,Ol=0,kl=Je(!0),Al=Je(!1),jl=[],Ml=0,Nl=0,Pl=!1,Fl=!1,Il=p(null),Ll=p(0),Rl=p(null),zl=null,Bl=p(0),Vl=0,X=null,Hl=null,Ul=null,Wl=!1,Gl=!1,Kl=!1,ql=0,Jl=0,Yl=null,Xl=0,Zl={readContext:R,use:jt,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useLayoutEffect:yt,useInsertionEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useSyncExternalStore:yt,useId:yt,useHostTransitionStatus:yt,useFormState:yt,useActionState:yt,useOptimistic:yt,useMemoCache:yt,useCacheRefresh:yt};Zl.useEffectEvent=yt;var Ql={readContext:R,use:jt,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:R,useEffect:on,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rn(4194308,4,fn.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rn(4194308,4,e,t)},useInsertionEffect:function(e,t){rn(4,2,e,t)},useMemo:function(e,t){var n=Dt();t=t===void 0?null:t;var r=e();if(Kl){A(!0);try{e()}finally{A(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Dt();if(n!==void 0){var i=n(t);if(Kl){A(!0);try{n(t)}finally{A(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Tn.bind(null,X,e),[r.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ht(e);var t=e.queue,n=En.bind(null,X,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:mn,useDeferredValue:function(e,t){return _n(Dt(),e,t)},useTransition:function(){var e=Ht(!1);return e=yn.bind(null,X,e.queue,!0,!1),Dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=X,a=Dt();if($c){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Su===null)throw Error(r(349));Cu&127||Lt(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,on(zt.bind(null,i,o,e),[e]),i.flags|=2048,nn(9,{destroy:void 0},Rt.bind(null,i,o,n,t),null),n},useId:function(){var e=Dt(),t=Su.identifierPrefix;if($c){var n=Kc,r=Gc;n=(r&~(1<<32-fc(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ql++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Xl++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:xn,useFormState:Zt,useActionState:Zt,useOptimistic:function(e){var t=Dt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=On.bind(null,X,!0,n),n.dispatch=t,[e,t]},useMemoCache:W,useCacheRefresh:function(){return Dt().memoizedState=wn.bind(null,X)},useEffectEvent:function(e){var t=Dt(),n={impl:e};return t.memoizedState=n,function(){if(Z&2)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},$l={readContext:R,use:jt,useCallback:hn,useContext:R,useEffect:sn,useImperativeHandle:pn,useInsertionEffect:un,useLayoutEffect:dn,useMemo:gn,useReducer:Nt,useRef:G,useState:function(){return Nt(Mt)},useDebugValue:mn,useDeferredValue:function(e,t){return vn(Ot(),Hl.memoizedState,e,t)},useTransition:function(){var e=Nt(Mt)[0],t=Ot().memoizedState;return[typeof e==`boolean`?e:At(e),t]},useSyncExternalStore:It,useId:Sn,useHostTransitionStatus:xn,useFormState:Qt,useActionState:Qt,useOptimistic:function(e,t){return Ut(Ot(),Hl,e,t)},useMemoCache:W,useCacheRefresh:Cn};$l.useEffectEvent=ln;var eu={readContext:R,use:jt,useCallback:hn,useContext:R,useEffect:sn,useImperativeHandle:pn,useInsertionEffect:un,useLayoutEffect:dn,useMemo:gn,useReducer:Ft,useRef:G,useState:function(){return Ft(Mt)},useDebugValue:mn,useDeferredValue:function(e,t){var n=Ot();return Hl===null?_n(n,e,t):vn(n,Hl.memoizedState,e,t)},useTransition:function(){var e=Ft(Mt)[0],t=Ot().memoizedState;return[typeof e==`boolean`?e:At(e),t]},useSyncExternalStore:It,useId:Sn,useHostTransitionStatus:xn,useFormState:tn,useActionState:tn,useOptimistic:function(e,t){var n=Ot();return Hl===null?(n.baseState=e,[e,n.queue.dispatch]):Ut(n,Hl,e,t)},useMemoCache:W,useCacheRefresh:Cn};eu.useEffectEvent=ln;var tu={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=wi(),i=nt(r);i.payload=t,n!=null&&(i.callback=n),t=rt(e,i,r),t!==null&&(Ei(t,e,r),it(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=wi(),i=nt(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=rt(e,i,r),t!==null&&(Ei(t,e,r),it(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=wi(),r=nt(n);r.tag=2,t!=null&&(r.callback=t),t=rt(e,r,n),t!==null&&(Ei(t,e,n),it(t,e,n))}},nu=Error(r(461)),ru=!1,iu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},au=!1,ou=!1,su=!1,cu=typeof WeakSet==`function`?WeakSet:Set,lu=null,uu=null,du=!1,fu=null,pu=8192,mu={getCacheForType:function(e){var t=R(ll),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return R(ll).controller.signal}},hu=0,gu=1,_u=2,vu=3,yu=4;if(typeof Symbol==`function`&&Symbol.for){var bu=Symbol.for;hu=bu(`selector.component`),gu=bu(`selector.has_pseudo_class`),_u=bu(`selector.role`),vu=bu(`selector.test_id`),yu=bu(`selector.text`)}var xu=typeof WeakMap==`function`?WeakMap:Map,Z=0,Su=null,Q=null,Cu=0,wu=0,Tu=null,Eu=!1,Du=!1,Ou=!1,ku=0,Au=0,ju=0,Mu=0,Nu=0,Pu=0,Fu=0,Iu=null,Lu=null,Ru=!1,zu=0,Bu=0,Vu=1/0,Hu=null,Uu=null,$=0,Wu=null,Gu=null,Ku=0,qu=0,Ju=null,Yu=null,Xu=0,Zu=null;return q.attemptContinuousHydration=function(e){if(e.tag===13||e.tag===31){var t=H(e,67108864);t!==null&&Ei(t,e,67108864),wa(e,67108864)}},q.attemptHydrationAtCurrentPriority=function(e){if(e.tag===13||e.tag===31){var t=wi();t=O(t);var n=H(e,t);n!==null&&Ei(n,e,t),wa(e,t)}},q.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if(e=e.stateNode,e.current.memoizedState.isDehydrated){var t=_(e.pendingLanes);if(t!==0){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-fc(t);e.entanglements[1]|=n,t&=~n}De(e),!(Z&6)&&(Vu=Sc()+500,z(0,!1))}}break;case 31:case 13:t=H(e,2),t!==null&&Ei(t,e,2),ji(),wa(e,2)}},q.batchedUpdates=function(e,t){return e(t)},q.createComponentSelector=function(e){return{$$typeof:hu,value:e}},q.createContainer=function(e,t,n,r,i,a,o,s,c,l){return ya(e,t,!1,null,n,r,a,null,o,s,c,l)},q.createHasPseudoClassSelector=function(e){return{$$typeof:gu,value:e}},q.createHydrationContainer=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){return e=ya(n,r,!0,e,i,a,s,p,c,l,u,d),e.context=ba(null),n=e.current,r=wi(),r=O(r),i=nt(r),i.callback=t??null,rt(n,i,r),t=r,e.current.lanes=t,C(e,t),De(e),e},q.createPortal=function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Aa,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}},q.createRoleSelector=function(e){return{$$typeof:_u,value:e}},q.createTestNameSelector=function(e){return{$$typeof:vu,value:e}},q.createTextSelector=function(e){return{$$typeof:yu,value:e}},q.defaultOnCaughtError=function(e){console.error(e)},q.defaultOnRecoverableError=function(e){Mc(e)},q.defaultOnUncaughtError=function(e){Mc(e)},q.deferredUpdates=function(e){var t=Y.T,n=ho();try{return mo(32),Y.T=null,e()}finally{mo(n),Y.T=t}},q.discreteUpdates=function(e,t,n,r,i){var a=Y.T,o=ho();try{return mo(2),Y.T=null,e(t,n,r,i)}finally{mo(o),Y.T=a,Z===0&&(Vu=Sc()+500)}},q.findAllNodes=Ci,q.findBoundingRects=function(e,t){if(!jo)throw Error(r(363));t=Ci(e,t),e=[];for(var n=0;n<t.length;n++)e.push(No(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var i=n.x,a=i+n.width,o=n.y,s=o+n.height,c=t-1;0<=c;c--)if(t!==c){var l=e[c],u=l.x,d=u+l.width,f=l.y,p=f+l.height;if(i>=u&&o>=f&&a<=d&&s<=p){e.splice(t,1);break}else if(!(i!==u||n.width!==l.width||p<o||f>s)){f>o&&(l.height+=f-o,l.y=o),p<s&&(l.height=s-f),e.splice(t,1);break}else if(!(o!==f||n.height!==l.height||d<i||u>a)){u>i&&(l.width+=u-i,l.x=i),d<a&&(l.width=a-u),e.splice(t,1);break}}}return e},q.findHostInstance=xa,q.findHostInstanceWithNoPortals=function(e){return e=s(e),e=e===null?null:u(e),e===null?null:Ja(e.stateNode)},q.findHostInstanceWithWarning=function(e){return xa(e)},q.flushPassiveEffects=$i,q.flushSyncFromReconciler=function(e){var t=Z;Z|=1;var n=Y.T,r=ho();try{if(mo(2),Y.T=null,e)return e()}finally{mo(r),Y.T=n,Z=t,!(Z&6)&&z(0,!1)}},q.flushSyncWork=ji,q.focusWithin=function(e,t){if(!jo)throw Error(r(363));for(e=yi(e),t=Si(e,t),t=Array.from(t),e=0;e<t.length;){var n=t[e++],i=n.tag;if(!Fo(n)){if((i===5||i===26||i===27)&&Lo(n.stateNode))return!0;for(n=n.child;n!==null;)t.push(n),n=n.sibling}}return!1},q.getFindAllNodesFailureDescription=function(e,t){if(!jo)throw Error(r(363));var n=0,i=[];e=[yi(e),0];for(var a=0;a<e.length;){var o=e[a++],s=o.tag,c=e[a++],l=t[c];if((s!==5&&s!==26&&s!==27||!Fo(o))&&(bi(o,l)&&(i.push(xi(l)),c++,c>n&&(n=c)),c<t.length))for(o=o.child;o!==null;)e.push(o,c),o=o.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(xi(t[n]));return`findAllNodes was able to match part of the selector:
  `+(i.join(` > `)+`

No matching component was found for:
  `)+e.join(` > `)}return null},q.getPublicRootInstance=function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 27:case 5:return Ja(e.child.stateNode);default:return e.child.stateNode}},q.injectIntoDevTools=function(){var e={bundleType:0,version:Ga,rendererPackageName:Ka,currentDispatcherRef:Y,reconcilerVersion:`19.2.0`};if(qa!==null&&(e.rendererConfig=qa),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{kc=t.inject(e),Ac=t}catch{}e=!!t.checkDCE}}return e},q.isAlreadyRendering=function(){return(Z&6)!=0},q.observeVisibleRects=function(e,t,n,i){if(!jo)throw Error(r(363));e=Ci(e,t);var a=Ro(e,n,i).disconnect;return{disconnect:function(){a()}}},q.shouldError=function(){return null},q.shouldSuspend=function(){return!1},q.startHostTransition=function(e,t,i,a){if(e.tag!==5)throw Error(r(476));var o=bn(e).queue;yn(e,o,t,Eo,i===null?n:function(){var t=bn(e);return t.next===null&&(t=e.alternate.memoizedState),Dn(e,t.next.queue,{},wi()),i(a)})},q.updateContainer=function(e,t,n,r){var i=t.current,a=wi();return Sa(i,a,e,t,n,r),a},q.updateContainerSync=function(e,t,n,r){return Sa(t.current,2,e,t,n,r),2},q},t.exports.default=t.exports,Object.defineProperty(t.exports,`__esModule`,{value:!0})})),Ka=n(((e,t)=>{t.exports=Ga()})),qa=n((e=>{e.ConcurrentRoot=1,e.DefaultEventPriority=32,e.DiscreteEventPriority=2})),Ja=n(((e,t)=>{t.exports=qa()})),Ya=e(Ka()),Xa=Ja(),Za={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},Qa=!1,$a=!1,eo=`.react-konva-event`,to=!1,no=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
Position of a node will be changed during drag&drop, so you should update state of the react app as well.
Consider to add onDragMove or onDragEnd events.
For more info see: https://github.com/konvajs/react-konva/issues/256
`,ro=`ReactKonva: You are using "zIndex" attribute for a Konva node.
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
For more info see: https://github.com/konvajs/react-konva/issues/194
`,io={};function ao(e,t,n=io){if(!Qa&&`zIndex`in t&&(console.warn(ro),Qa=!0),!$a&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(no),$a=!0)}for(var a in n)if(!Za[a]){var o=a.slice(0,2)===`on`,s=n[a]!==t[a];if(o&&s){var c=a.substr(2).toLowerCase();c.substr(0,7)===`content`&&(c=`content`+c.substr(7,1).toUpperCase()+c.substr(8)),e.off(c,n[a])}t.hasOwnProperty(a)||e.setAttr(a,void 0)}var l=to||t._useStrictMode,u={},d=!1;let f={};for(var a in t)if(!Za[a]){var o=a.slice(0,2)===`on`,p=n[a]!==t[a];if(o&&p){var c=a.substr(2).toLowerCase();c.substr(0,7)===`content`&&(c=`content`+c.substr(7,1).toUpperCase()+c.substr(8)),t[a]&&(f[c]=t[a])}!o&&(t[a]!==n[a]||l&&t[a]!==e.getAttr(a))&&(d=!0,u[a]=t[a])}for(var c in d&&(e.setAttrs(u),oo(e)),f)e.off(c+eo),e.on(c+eo,f[c])}function oo(e){if(!V.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}var so=t({HostTransitionContext:()=>us,NotPendingTransition:()=>null,afterActiveInstanceBlur:()=>qo,appendChild:()=>Ao,appendChildToContainer:()=>jo,appendInitialChild:()=>po,beforeActiveInstanceBlur:()=>Ko,cancelTimeout:()=>Do,clearContainer:()=>Uo,commitMount:()=>Lo,commitTextUpdate:()=>Io,commitUpdate:()=>Ro,createInstance:()=>mo,createTextInstance:()=>ho,detachDeletedInstance:()=>Wo,finalizeInitialChildren:()=>go,getChildHostContext:()=>To,getCurrentEventPriority:()=>Jo,getCurrentUpdatePriority:()=>Qo,getInstanceFromNode:()=>Go,getInstanceFromScope:()=>Xo,getPublicInstance:()=>_o,getRootHostContext:()=>wo,hideInstance:()=>zo,hideTextInstance:()=>Bo,idlePriority:()=>co.unstable_IdlePriority,insertBefore:()=>Mo,insertInContainerBefore:()=>No,isPrimaryRenderer:()=>!1,maySuspendCommit:()=>as,noTimeout:()=>-1,now:()=>co.unstable_now,preloadInstance:()=>os,prepareForCommit:()=>vo,preparePortalMount:()=>yo,prepareScopeUpdate:()=>Yo,prepareUpdate:()=>bo,removeChild:()=>Po,removeChildFromContainer:()=>Fo,requestPostPaintCallback:()=>is,resetAfterCommit:()=>xo,resetFormInstance:()=>ds,resetTextContent:()=>So,resolveEventTimeStamp:()=>rs,resolveEventType:()=>ns,resolveUpdatePriority:()=>$o,run:()=>co.unstable_runWithPriority,scheduleMicrotask:()=>Oo,scheduleTimeout:()=>Eo,setCurrentUpdatePriority:()=>Zo,shouldAttemptEagerTransition:()=>es,shouldDeprioritizeSubtree:()=>Co,shouldSetTextContent:()=>ko,startSuspendingCommit:()=>ss,supportsHydration:()=>!1,supportsMicrotasks:()=>!0,supportsMutation:()=>!0,supportsPersistence:()=>!1,suspendInstance:()=>cs,trackSchedulerEvent:()=>ts,unhideInstance:()=>Vo,unhideTextInstance:()=>Ho,waitForCommitToBeReady:()=>ls,warnsIfNotActing:()=>!1}),co=c(),lo={},uo={};Y.Node.prototype._applyProps=ao;var fo=Xa.DefaultEventPriority;function po(e,t){if(typeof t==`string`){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),oo(e)}function mo(e,t,n){let r=Y[e];r||=(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}"  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`),Y.Group);let i={},a={};for(var o in t)o!==`ref`&&(o.slice(0,2)===`on`?a[o]=t[o]:i[o]=t[o]);let s=new r(i);return ao(s,a),s}function ho(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function go(e,t,n){return!1}function _o(e){return e}function vo(){return null}function yo(){return null}function bo(e,t,n,r){return uo}function xo(){}function So(e){}function Co(e,t){return!1}function wo(){return lo}function To(){return lo}var Eo=setTimeout,Do=clearTimeout,Oo=e=>{e()};function ko(e,t){return!1}function Ao(e,t){t.parent===e?t.moveToTop():e.add(t),oo(e)}function jo(e,t){t.parent===e?t.moveToTop():e.add(t),oo(e)}function Mo(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),oo(e)}function No(e,t,n){Mo(e,t,n)}function Po(e,t){t.destroy(),t.off(eo),oo(e)}function Fo(e,t){t.destroy(),t.off(eo),oo(e)}function Io(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function Lo(e,t,n){}function Ro(e,t,n,r){ao(e,r,n)}function zo(e){e.hide(),oo(e)}function Bo(e){}function Vo(e,t){(t.visible==null||t.visible)&&e.show()}function Ho(e,t){}function Uo(e){}function Wo(){}function Go(){return null}function Ko(){}function qo(){}function Jo(){return Xa.DefaultEventPriority}function Yo(){}function Xo(){return null}function Zo(e){fo=e}function Qo(){return fo}function $o(){return Xa.DiscreteEventPriority}function es(){return!1}function ts(){}function ns(){return null}function rs(){return-1.1}function is(){}function as(){return!1}function os(){return!0}function ss(){}function cs(){}function ls(){return null}var us=z.createContext(null);function ds(){}typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?z.useLayoutEffect:z.useEffect;function fs(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=fs(r,t,n);if(e)return e;r=t?null:r.sibling}}function ps(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var ms=ps(z.createContext(null)),hs=class extends z.Component{render(){return z.createElement(ms.Provider,{value:this._reactInternals},this.props.children)}};function gs(){let e=z.useContext(ms);if(e===null)throw Error(`its-fine: useFiber must be called within a <FiberProvider />!`);let t=z.useId();return z.useMemo(()=>{for(let n of[e,e?.alternate]){if(!n)continue;let e=fs(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}var _s=Symbol.for(`react.context`),vs=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===_s;function ys(){let e=gs(),[t]=z.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;vs(e)&&e!==ms&&!t.has(e)&&t.set(e,z.use(ps(e))),n=n.return}return t}function bs(){let e=ys();return z.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>z.createElement(t,null,z.createElement(n.Provider,{...r,value:e.get(n)})),e=>z.createElement(hs,{...e})),[e])}function xs(e){let t=z.useRef({});return z.useLayoutEffect(()=>{t.current=e}),z.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}var Ss=()=>{let e=z.useRef(0);return z.useMemo(()=>{e.current++},[]),e.current>1},Cs=e=>{let t=z.useRef(null),n=z.useRef(null),r=z.useRef(null),i=xs(e),a=bs(),o=z.useRef(null),s=t=>{let{forwardedRef:n}=e;n&&(typeof n==`function`?n(t):n.current=t)},c=Ss(),l=()=>{s(null),Ps.flushSyncFromReconciler(()=>{Ps.updateContainer(null,r.current,null)}),n.current?.destroy(),n.current=null};return z.useLayoutEffect(()=>(o.current&&=(clearTimeout(o.current),null),n.current?s(n.current):(n.current=new Y.Stage({width:e.width,height:e.height,container:t.current}),s(n.current),r.current=Ps.createContainer(n.current,Xa.ConcurrentRoot,null,!1,null,``,console.error,console.error,console.error,null),Ps.updateContainer(z.createElement(a,{},e.children),r.current,null,()=>{})),()=>{c?o.current=setTimeout(l,0):l()}),[]),z.useLayoutEffect(()=>{s(n.current),ao(n.current,e,i),Ps.flushSyncFromReconciler(()=>{Ps.updateContainer(z.createElement(a,{},e.children),r.current,null)})}),z.createElement(`div`,{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},ws=`Layer`,Ts=`Group`,Es=`Rect`,Ds=`Ellipse`,Os=`Line`,ks=`Image`,As=`Text`,js=`Arrow`,Ms=`Shape`,Ns=`Transformer`,Ps=(0,Ya.default)(so),Fs=z.forwardRef((e,t)=>z.createElement(hs,{},z.createElement(Cs,{...e,forwardedRef:t}))),Is=()=>typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`l_${Math.random().toString(36).slice(2,10)}`;function Ls(e={}){return{id:Is(),type:`text`,anchors:{left:{type:`percent`,value:50,align:`center`},top:{type:`percent`,value:10},width:{type:`percent`,value:80},height:{type:`percent`,value:12}},content:{default:`Your headline`},fontFamily:`Inter`,fontWeight:700,fontSize:96,minFontSize:32,maxFontSize:160,lineHeight:1.1,align:`center`,color:`#0F172A`,fitMode:`auto`,...e}}function Rs(e=`rect`,t={}){let n={id:Is(),type:`shape`,shape:e};return e===`line`||e===`arrow`?{...n,anchors:{left:{type:`percent`,value:50,align:`center`},top:{type:`percent`,value:50,align:`center`},width:{type:`px`,value:800},height:{type:`px`,value:48}},style:{fill:{type:`solid`,value:`#0F172A`},stroke:{color:`#0F172A`,width:6}},...e===`arrow`?{arrowHead:1}:{},...t}:e===`polygon`?{...n,anchors:{left:{type:`percent`,value:50,align:`center`},top:{type:`percent`,value:50,align:`center`},width:{type:`px`,value:400},height:{type:`px`,value:400}},style:{fill:{type:`solid`,value:`#F0E8DE`}},sides:6,...t}:e===`star`?{...n,anchors:{left:{type:`percent`,value:50,align:`center`},top:{type:`percent`,value:50,align:`center`},width:{type:`px`,value:400},height:{type:`px`,value:400}},style:{fill:{type:`solid`,value:`#F0E8DE`}},starPoints:5,innerRatio:.4,...t}:e===`path`?{...n,anchors:{left:{type:`percent`,value:50,align:`center`},top:{type:`percent`,value:50,align:`center`},width:{type:`px`,value:400},height:{type:`px`,value:400}},style:{stroke:{color:`#0F172A`,width:6}},nodes:[],closed:!1,...t}:{...n,anchors:{left:{type:`percent`,value:50,align:`center`},top:{type:`percent`,value:40},width:{type:`percent`,value:40},height:{type:`percent`,value:10}},style:{fill:{type:`solid`,value:`#F0E8DE`},radius:e===`rect`?24:0},...t}}function zs(e,t,n={}){let r=e.export_w/e.export_h,i=t.width/t.height,a=80*r/i;return{id:Is(),type:`frame`,devicePresetId:e.id,anchors:{left:{type:`percent`,value:50,align:`center`},top:{type:`percent`,value:50,align:`center`},width:{type:`percent`,value:+a.toFixed(3)},height:{type:`percent`,value:80}},...n}}function Bs(e={}){return{id:Is(),type:`background`,anchors:{left:{type:`percent`,value:0},top:{type:`percent`,value:0},width:{type:`percent`,value:100},height:{type:`percent`,value:100}},fill:{type:`solid`,value:`#F0E8DE`},...e}}function Vs(e,t,n={}){let r=Ws(e,t);return{id:Is(),type:`image`,name:e.fileName??`Image`,anchors:{left:{type:`percent`,value:r.leftPct},top:{type:`percent`,value:r.topPct},width:{type:`percent`,value:r.widthPct},height:{type:`percent`,value:r.heightPct}},storagePath:e.storagePath,fit:`cover`,...n}}function Hs(e,t,n={}){let r=e.displayRect.x/t.width*100,i=e.displayRect.y/t.height*100,a=e.displayRect.width/t.width*100,o=e.displayRect.height/t.height*100;return{id:Is(),type:`callout`,anchors:{left:{type:`percent`,value:+r.toFixed(3)},top:{type:`percent`,value:+i.toFixed(3)},width:{type:`percent`,value:+a.toFixed(3)},height:{type:`percent`,value:+o.toFixed(3)}},sourceLayerId:e.sourceLayerId,sourceRect:{x:+e.sourceRect.x.toFixed(3),y:+e.sourceRect.y.toFixed(3),width:+e.sourceRect.width.toFixed(3),height:+e.sourceRect.height.toFixed(3)},shape:`ellipse`,...n}}function Us(e,t={}){return{storagePath:e.storagePath,fit:`fill`,...t}}function Ws(e,t){let n=e.width&&e.height&&e.width>0&&e.height>0?e.width/e.height:t.width/t.height,r=t.width/t.height,i,a;return n>r?(i=70,a=i*r/n,a>70&&(a=70,i=a*n/r)):(a=70,i=a*n/r,i>70&&(i=70,a=i*r/n)),{leftPct:+((100-i)/2).toFixed(3),topPct:+((100-a)/2).toFixed(3),widthPct:+i.toFixed(3),heightPct:+a.toFixed(3)}}function Gs(e){if(e.name)return e.name;switch(e.type){case`text`:return e.content.default||`Text`;case`shape`:switch(e.shape){case`ellipse`:return`Ellipse`;case`line`:return`Line`;case`arrow`:return`Arrow`;case`polygon`:return`Polygon`;case`star`:return`Star`;case`path`:return`Path`;default:return`Rectangle`}case`background`:return`Background`;case`image`:return`Image`;case`frame`:return`Frame`;case`group`:return e.name||`Group`;case`callout`:return`Callout`}}function Ks(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qs(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Js(e){return typeof e==`string`?e:void 0}function Ys(e){return typeof e==`boolean`?e:void 0}function Xs(e){if(!Ks(e))return;let t={},n=qs(e.top),r=qs(e.right),i=qs(e.bottom),a=qs(e.left);return n!==void 0&&(t.top=n),r!==void 0&&(t.right=r),i!==void 0&&(t.bottom=i),a!==void 0&&(t.left=a),Object.keys(t).length?t:void 0}function Zs(e){if(!Ks(e))return;let t={},n=qs(e.brightness),r=qs(e.contrast),i=qs(e.saturation),a=qs(e.hue),o=qs(e.blur),s=Ys(e.grayscale),c=Ys(e.invert);if(n!==void 0&&(t.brightness=n),r!==void 0&&(t.contrast=r),i!==void 0&&(t.saturation=i),a!==void 0&&(t.hue=a),o!==void 0&&(t.blur=o),s!==void 0&&(t.grayscale=s),c!==void 0&&(t.invert=c),Ks(e.tint)){let n=Js(e.tint.color),r=qs(e.tint.amount);n&&r!==void 0&&(t.tint={color:n,amount:r})}return Object.keys(t).length?t:void 0}function Qs(e){if(!Ks(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return Object.keys(t).length?t:void 0}function $s(e){return e===`cover`||e===`contain`||e===`fill`?e:void 0}function ec(e){let t=Js(e.storagePath);if(!t)return;let n={storagePath:t},r=$s(e.fit);r&&(n.fit=r);let i=qs(e.offsetX),a=qs(e.offsetY),o=qs(e.zoom);i!==void 0&&(n.offsetX=i),a!==void 0&&(n.offsetY=a),o!==void 0&&(n.zoom=o);let s=Xs(e.crop);s&&(n.crop=s);let c=Zs(e.adjust);c&&(n.adjust=c);let l=Qs(e.localePaths);return l&&(n.localePaths=l),n}function tc(e){let t=$s(e.fit)??`cover`,n={...e};return n.type=`image`,n.fit=t,delete n.frameId,delete n.localePaths,n}function nc(e){let t=e.version;if(t===3)return e;if(t===void 0||t===1){let t=Array.isArray(e.layers)?e.layers:[],n=new Set;for(let e of t)Ks(e)&&e.type===`frame`&&typeof e.id==`string`&&n.add(e.id);let r=new Map,i=new Set;for(let e of t){if(!Ks(e)||e.type!==`screenshot`)continue;let t=Js(e.frameId);if(!t||!n.has(t)||r.has(t))continue;let a=ec(e);a&&(r.set(t,a),typeof e.id==`string`&&i.add(e.id))}let a=[];for(let e of t)if(Ks(e)){if(e.type===`frame`){let t=Js(e.id),n={...e};t&&r.has(t)&&(n.screen=r.get(t)),a.push(n);continue}if(e.type===`screenshot`){let t=Js(e.id);if(t&&i.has(t))continue;a.push(tc(e));continue}a.push(e)}return{version:3,canvas:e.canvas,layers:a,meta:e.meta}}return t===2?{...e,version:3}:e}var rc=Symbol.for(`immer-nothing`),ic=Symbol.for(`immer-draftable`),ac=Symbol.for(`immer-state`);function oc(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sc=Object.getPrototypeOf;function cc(e){return!!e&&!!e[ac]}function lc(e){return e?fc(e)||Array.isArray(e)||!!e[ic]||!!e.constructor?.[ic]||yc(e)||bc(e):!1}var uc=Object.prototype.constructor.toString(),dc=new WeakMap;function fc(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;if(n===Object)return!0;if(typeof n!=`function`)return!1;let r=dc.get(n);return r===void 0&&(r=Function.toString.call(n),dc.set(n,r)),r===uc}function pc(e,t,n=!0){mc(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function mc(e){let t=e[ac];return t?t.type_:Array.isArray(e)?1:yc(e)?2:bc(e)?3:0}function hc(e,t){return mc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function gc(e,t){return mc(e)===2?e.get(t):e[t]}function _c(e,t,n){let r=mc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function vc(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function yc(e){return e instanceof Map}function bc(e){return e instanceof Set}function xc(e){return e.copy_||e.base_}function Sc(e,t){if(yc(e))return new Map(e);if(bc(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=fc(e);if(t===!0||t===`class_only`&&!n){let t=Object.getOwnPropertyDescriptors(e);delete t[ac];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(sc(e),t)}else{let t=sc(e);return t!==null&&n?{...e}:Object.assign(Object.create(t),e)}}function Cc(e,t=!1){return Ec(e)||cc(e)||!lc(e)?e:(mc(e)>1&&Object.defineProperties(e,{set:Tc,add:Tc,clear:Tc,delete:Tc}),Object.freeze(e),t&&Object.values(e).forEach(e=>Cc(e,!0)),e)}function wc(){oc(2)}var Tc={value:wc};function Ec(e){return typeof e!=`object`||!e?!0:Object.isFrozen(e)}var Dc={};function Oc(e){let t=Dc[e];return t||oc(0,e),t}function kc(e,t){Dc[e]||(Dc[e]=t)}var Ac;function jc(){return Ac}function Mc(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Nc(e,t){t&&(Oc(`Patches`),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Pc(e){Fc(e),e.drafts_.forEach(Lc),e.drafts_=null}function Fc(e){e===Ac&&(Ac=e.parent_)}function Ic(e){return Ac=Mc(Ac,e)}function Lc(e){let t=e[ac];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Rc(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return e!==void 0&&e!==n?(n[ac].modified_&&(Pc(t),oc(4)),lc(e)&&(e=zc(t,e),t.parent_||Vc(t,e)),t.patches_&&Oc(`Patches`).generateReplacementPatches_(n[ac].base_,e,t.patches_,t.inversePatches_)):e=zc(t,n,[]),Pc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===rc?void 0:e}function zc(e,t,n){if(Ec(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[ac];if(!i)return pc(t,(r,a)=>Bc(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Vc(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;i.type_===3&&(a=new Set(t),t.clear(),o=!0),pc(a,(r,a)=>Bc(e,i,t,r,a,n,o),r),Vc(e,t,!1),n&&e.patches_&&Oc(`Patches`).generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Bc(e,t,n,r,i,a,o){if(i==null||typeof i!=`object`&&!o)return;let s=Ec(i);if(!(s&&!o)){if(cc(i)){let o=zc(e,i,a&&t&&t.type_!==3&&!hc(t.assigned_,r)?a.concat(r):void 0);if(_c(n,r,o),cc(o))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(lc(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;zc(e,i),(!t||!t.scope_.parent_)&&typeof r!=`symbol`&&(yc(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Vc(e,i)}}}function Vc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Cc(t,n)}function Hc(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:jc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=Uc;n&&(i=[r],a=Wc);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var Uc={get(e,t){if(t===ac)return e;let n=xc(e);if(!hc(n,t))return Kc(e,n,t);let r=n[t];return e.finalized_||!lc(r)?r:r===Gc(e.base_,t)?(Yc(e),e.copy_[t]=Zc(r,e)):r},has(e,t){return t in xc(e)},ownKeys(e){return Reflect.ownKeys(xc(e))},set(e,t,n){let r=qc(xc(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Gc(xc(e),t),i=r?.[ac];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(vc(n,r)&&(n!==void 0||hc(e.base_,t)))return!0;Yc(e),Jc(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty(e,t){return Gc(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Yc(e),Jc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=xc(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==`length`,enumerable:r.enumerable,value:n[t]}},defineProperty(){oc(11)},getPrototypeOf(e){return sc(e.base_)},setPrototypeOf(){oc(12)}},Wc={};pc(Uc,(e,t)=>{Wc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Wc.deleteProperty=function(e,t){return Wc.set.call(this,e,t,void 0)},Wc.set=function(e,t,n){return Uc.set.call(this,e[0],t,n,e[0])};function Gc(e,t){let n=e[ac];return(n?xc(n):e)[t]}function Kc(e,t,n){let r=qc(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}function qc(e,t){if(!(t in e))return;let n=sc(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=sc(n)}}function Jc(e){e.modified_||(e.modified_=!0,e.parent_&&Jc(e.parent_))}function Yc(e){e.copy_||=Sc(e.base_,e.scope_.immer_.useStrictShallowCopy_)}var Xc=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if(typeof e==`function`&&typeof t!=`function`){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}typeof t!=`function`&&oc(6),n!==void 0&&typeof n!=`function`&&oc(7);let r;if(lc(e)){let i=Ic(this),a=Zc(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Pc(i):Fc(i)}return Nc(i,n),Rc(r,i)}else if(!e||typeof e!=`object`){if(r=t(e),r===void 0&&(r=e),r===rc&&(r=void 0),this.autoFreeze_&&Cc(r,!0),n){let t=[],i=[];Oc(`Patches`).generateReplacementPatches_(e,r,t,i),n(t,i)}return r}else oc(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e==`function`)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},typeof e?.autoFreeze==`boolean`&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==`boolean`&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration==`boolean`&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){lc(e)||oc(8),cc(e)&&(e=Qc(e));let t=Ic(this),n=Zc(e,void 0);return n[ac].isManual_=!0,Fc(t),n}finishDraft(e,t){let n=e&&e[ac];(!n||!n.isManual_)&&oc(9);let{scope_:r}=n;return Nc(r,t),Rc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Oc(`Patches`).applyPatches_;return cc(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Zc(e,t){let n=yc(e)?Oc(`MapSet`).proxyMap_(e,t):bc(e)?Oc(`MapSet`).proxySet_(e,t):Hc(e,t);return(t?t.scope_:jc()).drafts_.push(n),n}function Qc(e){return cc(e)||oc(10,e),$c(e)}function $c(e){if(!lc(e)||Ec(e))return e;let t=e[ac],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Sc(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Sc(e,!0);return pc(n,(e,t)=>{_c(n,e,$c(t))},r),t&&(t.finalized_=!1),n}function el(){let e=`replace`,t=`remove`;function n(e,t,n,o){switch(e.type_){case 0:case 2:return i(e,t,n,o);case 1:return r(e,t,n,o);case 3:return a(e,t,n,o)}}function r(n,r,i,a){let{base_:o,assigned_:s}=n,c=n.copy_;c.length<o.length&&([o,c]=[c,o],[i,a]=[a,i]);for(let t=0;t<o.length;t++)if(s[t]&&c[t]!==o[t]){let n=r.concat([t]);i.push({op:e,path:n,value:l(c[t])}),a.push({op:e,path:n,value:l(o[t])})}for(let e=o.length;e<c.length;e++){let t=r.concat([e]);i.push({op:`add`,path:t,value:l(c[e])})}for(let e=c.length-1;o.length<=e;--e){let n=r.concat([e]);a.push({op:t,path:n})}}function i(n,r,i,a){let{base_:o,copy_:s}=n;pc(n.assigned_,(n,c)=>{let u=gc(o,n),d=gc(s,n),f=c?hc(o,n)?e:`add`:t;if(u===d&&f===e)return;let p=r.concat(n);i.push(f===t?{op:f,path:p}:{op:f,path:p,value:d}),a.push(f===`add`?{op:t,path:p}:f===t?{op:`add`,path:p,value:l(u)}:{op:e,path:p,value:l(u)})})}function a(e,n,r,i){let{base_:a,copy_:o}=e,s=0;a.forEach(e=>{if(!o.has(e)){let a=n.concat([s]);r.push({op:t,path:a,value:e}),i.unshift({op:`add`,path:a,value:e})}s++}),s=0,o.forEach(e=>{if(!a.has(e)){let a=n.concat([s]);r.push({op:`add`,path:a,value:e}),i.unshift({op:t,path:a,value:e})}s++})}function o(t,n,r,i){r.push({op:e,path:[],value:n===rc?void 0:n}),i.push({op:e,path:[],value:t})}function s(n,r){return r.forEach(r=>{let{path:i,op:a}=r,o=n;for(let e=0;e<i.length-1;e++){let t=mc(o),n=i[e];typeof n!=`string`&&typeof n!=`number`&&(n=``+n),(t===0||t===1)&&(n===`__proto__`||n===`constructor`)&&oc(19),typeof o==`function`&&n===`prototype`&&oc(19),o=gc(o,n),typeof o!=`object`&&oc(18,i.join(`/`))}let s=mc(o),l=c(r.value),u=i[i.length-1];switch(a){case e:switch(s){case 2:return o.set(u,l);case 3:oc(16);default:return o[u]=l}case`add`:switch(s){case 1:return u===`-`?o.push(l):o.splice(u,0,l);case 2:return o.set(u,l);case 3:return o.add(l);default:return o[u]=l}case t:switch(s){case 1:return o.splice(u,1);case 2:return o.delete(u);case 3:return o.delete(r.value);default:return delete o[u]}default:oc(17,a)}}),n}function c(e){if(!lc(e))return e;if(Array.isArray(e))return e.map(c);if(yc(e))return new Map(Array.from(e.entries()).map(([e,t])=>[e,c(t)]));if(bc(e))return new Set(Array.from(e).map(c));let t=Object.create(sc(e));for(let n in e)t[n]=c(e[n]);return hc(e,ic)&&(t[ic]=e[ic]),t}function l(e){return cc(e)?c(e):e}kc(`Patches`,{applyPatches_:s,generatePatches_:n,generateReplacementPatches_:o})}var tl=new Xc;tl.produce;var nl=tl.produceWithPatches.bind(tl),rl=tl.applyPatches.bind(tl),il=[{key:`ratings_badge`,label:`Star rating`,description:`A white card with a row of 5 gold stars, a big rating score and a caption (e.g. 4.8 / App Store rating)`,fields:[{name:`rating`,example:`4.8`},{name:`caption`,example:`App Store rating`}]},{key:`review_card`,label:`Review card`,description:`A testimonial card with a quote mark, 5 gold stars, the review text and an author attribution`,fields:[{name:`quote`,example:`This app completely changed how I work.`},{name:`author`,example:`— Sarah K., Product Designer`}]},{key:`laurel_stat`,label:`Laurel stat`,description:`A laurel wreath framing a big stat, with an eyebrow above and a label below (e.g. TRUSTED BY / 2M+ / USERS)`,fields:[{name:`eyebrow`,example:`TRUSTED BY`},{name:`value`,example:`2M+`},{name:`label`,example:`USERS`}]},{key:`laurel_rating`,label:`Laurel rating`,description:`A laurel wreath with 5 stars framing a rating/review count and a label below (e.g. ★★★★★ / 4.5k+ / REVIEWS)`,fields:[{name:`value`,example:`4.5k+`},{name:`label`,example:`REVIEWS`}]}],al=()=>typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`l_${Math.random().toString(36).slice(2,10)}`;function ol(e,t){return{id:e,type:`group`,name:t,anchors:{left:{type:`percent`,value:0},top:{type:`percent`,value:0},width:{type:`percent`,value:0},height:{type:`percent`,value:0}}}}function sl(e,t,n,r,i=!1){return{left:{type:`percent`,value:e,...i?{align:`center`}:{}},top:{type:`percent`,value:t},width:{type:`px`,value:n},height:{type:`px`,value:r}}}function cl(e,t,n,r,i){return Ls({parentId:e,name:t,anchors:n,content:{default:r},fontSize:i.size,fontWeight:i.weight??600,color:i.color??`#111111`,align:`center`,fitMode:`fixed`,...i.font===void 0?{}:{fontFamily:i.font},...i.spacing===void 0?{}:{letterSpacing:i.spacing},...i.transform===void 0?{}:{textTransform:i.transform}})}var ll=e=>Math.round(e*100)/100,ul=110,dl=(e,t)=>{let n=1-t;return[n*n*n*e[0][0]+3*n*n*t*e[1][0]+3*n*t*t*e[2][0]+t*t*t*e[3][0],n*n*n*e[0][1]+3*n*n*t*e[1][1]+3*n*t*t*e[2][1]+t*t*t*e[3][1]]},fl=(e,t)=>{let n=1-t;return[3*n*n*(e[1][0]-e[0][0])+6*n*t*(e[2][0]-e[1][0])+3*t*t*(e[3][0]-e[2][0]),3*n*n*(e[1][1]-e[0][1])+6*n*t*(e[2][1]-e[1][1])+3*t*t*(e[3][1]-e[2][1])]},pl=e=>{let t=Math.hypot(e[0],e[1])||1;return[e[0]/t,e[1]/t]};function ml(e,t,n,r,i,a){let o=[e+n*i,t+r*i],s=-r*a,c=n*a,l=[e+n*i*.42+s,t+r*i*.42+c],u=[e+n*i*.42-s,t+r*i*.42-c];return[{c:`M`,pts:[[e,t]]},{c:`Q`,pts:[l,o]},{c:`Q`,pts:[u,[e,t]]}]}function hl(){let e=[[ul-12,138],[ul-64,128],[ul-70,40],[ul-22,14]],t=[],n=2.4,r=[],i=[];for(let t=0;t<=16;t++){let a=t/16,o=dl(e,a),s=pl(fl(e,a));r.push([o[0]-s[1]*n*.5,o[1]+s[0]*n*.5]),i.push([o[0]+s[1]*n*.5,o[1]-s[0]*n*.5])}let a=[{c:`M`,pts:[r[0]]}];for(let e=1;e<=16;e++)a.push({c:`L`,pts:[r[e]]});for(let e=16;e>=0;e--)a.push({c:`L`,pts:[i[e]]});t.push(a);for(let n=0;n<7;n++){let r=.12+n/6*.74,i=dl(e,r),a=pl(fl(e,r)),o=[-a[1],a[0]];o[0]*1>0&&(o=[-o[0],-o[1]]);let s=pl([o[0]*.82+a[0]*.62,o[1]*.82+a[1]*.62]),c=34*(1-.32*r);t.push(ml(i[0],i[1],s[0],s[1],c,c*.36))}let o=dl(e,.97);return t.push(ml(o[0],o[1],1*.18,-.98,22,7)),t}function gl(e,t){let n=``;for(let r of e){let e=r.pts.map(t);r.c===`M`?n+=`M ${ll(e[0][0])} ${ll(e[0][1])} `:r.c===`L`?n+=`L ${ll(e[0][0])} ${ll(e[0][1])} `:n+=`Q ${ll(e[0][0])} ${ll(e[0][1])} ${ll(e[1][0])} ${ll(e[1][1])} `}return n+`Z`}function _l(){let e=hl(),t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)for(let e of a)for(let a of e.pts)a[0]<t&&(t=a[0]),a[0]>r&&(r=a[0]),a[1]<n&&(n=a[1]),a[1]>i&&(i=a[1]);let a=r-t+8,o=i-n+8,s=e=>[e[0]-t+4,e[1]-n+4],c=e=>[a-(e[0]-t+4),e[1]-n+4];return{left:e.map(e=>gl(e,s)),right:e.map(e=>gl(e,c)),viewBox:[ll(a),ll(o)]}}function vl(e,t,n,r,i){return{left:{type:`percent`,value:e,align:i===`left`?`end`:`start`},top:{type:`percent`,value:t},width:{type:`px`,value:n},height:{type:`px`,value:r}}}function yl(e,t,n,r=`Inter`){if(typeof document>`u`)return 0;let i=document.createElement(`canvas`).getContext(`2d`);return i?(i.font=`${n} ${t}px ${r}, sans-serif`,i.measureText(e).width):0}var bl=30;function xl(e,t,n,r,i=t/2){let a=e/2,o=(r===`left`?i-a-n:i+a+n)/t*100;return r===`left`?Math.max(5,o):Math.min(95,o)}var Sl=`#1A1A1A`;function Cl(e,t,n,r,i,a,o,s,c){return Rs(`rect`,{parentId:e,name:t===`left`?`Laurel left`:`Laurel right`,anchors:vl(xl(r,i,bl,t),3.4,a,o,t),vectorPaths:s,vectorViewBox:c,style:{fill:{type:`solid`,value:Sl}},spacingLink:{valueId:n,side:t,margin:bl,w:r}})}function wl(e,t,n){return Ls({id:t,parentId:e,name:`Value`,anchors:sl(50,8.5,720,120,!0),content:{default:n},fontSize:100,fontWeight:800,color:`#111111`,align:`center`,fitMode:`auto`})}function Tl(e,t,n){let r=e.canvas?.width;if(!r||r<=0||!e.layers.some(e=>e.type===`shape`&&e.spacingLink))return;let i=t===n?`default`:t,a=new Map(e.layers.map(e=>[e.id,e]));for(let t of e.layers){if(t.type!==`shape`||!t.spacingLink)continue;let n=a.get(t.spacingLink.valueId);if(!n||n.type!==`text`)continue;let o=yl(String(n.content?.[i]??n.content?.default??``),n.fontSize??100,Number(n.fontWeight)||700);if(Math.abs(o-t.spacingLink.w)<.5)continue;t.spacingLink.w=o;let s=he(n.anchors,e.canvas),c=s.x+s.width/2;t.anchors.left={type:`percent`,value:xl(o,r,t.spacingLink.margin,t.spacingLink.side,c),align:t.spacingLink.side===`left`?`end`:`start`}}}var El=`#F5A524`,Dl=`#1A1A1A`,Ol=`#8A8A8A`;function kl(e,t,n,r,i,a,o={}){return Rs(`rect`,{parentId:e,name:t,anchors:n,vectorPaths:r,vectorViewBox:i,...o.fillRule?{vectorFillRule:o.fillRule}:{},style:{fill:{type:`solid`,value:a},...o.shadow?{shadow:o.shadow}:{}}})}function Al(e,t,n=`#FFFFFF`,r=32){return Rs(`rect`,{parentId:e,name:`Card`,anchors:t,style:{fill:{type:`solid`,value:n},radius:r,shadow:{color:`#1A1A1A`,blur:44,offsetX:0,offsetY:16,opacity:.14}}})}var jl={gap:40,cy:19,outer:17,inner:7.4,h:38};function Ml(e,t,n,r,i=5,a=-90){let o=[];for(let s=0;s<i*2;s++){let c=s%2==0?n:r,l=a*Math.PI/180+s*Math.PI/i;o.push([e+c*Math.cos(l),t+c*Math.sin(l)])}return o}var Nl=e=>e.length===0?``:`${e.map((e,t)=>`${t===0?`M`:`L`} ${ll(e[0])} ${ll(e[1])} `).join(``)}Z`;function Pl(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=e[(r+1)%e.length],o=i[0]<=t,s=a[0]<=t;if(o&&n.push(i),o!==s){let e=(t-i[0])/(a[0]-i[0]);n.push([t,i[1]+e*(a[1]-i[1])])}}return n}var Fl=(e,t,n,r,i=5,a=-90)=>Nl(Ml(e,t,n,r,i,a));function Il(e=5){let{gap:t,cy:n,outer:r,inner:i,h:a}=jl,o=[];for(let a=0;a<e;a++)o.push(Fl(t/2+a*t,n,r,i));return{paths:o,viewBox:[t*e,a]}}function Ll(e,t=5){let{gap:n,cy:r,outer:i,inner:a}=jl,o=Math.max(0,Math.min(t,Math.round(e*2)/2)),s=Math.floor(o),c=[];for(let e=0;e<s;e++)c.push(Fl(n/2+e*n,r,i,a));if(o-s>=.5){let e=n/2+s*n;c.push(Nl(Pl(Ml(e,r,i,a),e)))}return c}var Rl=(e,t)=>Math.max(0,Math.min(t,Math.round(e*2)/2));function zl(e,t,n,r,i){return Rs(`rect`,{parentId:e,name:`Stars`,anchors:r,vectorPaths:Ll(n),vectorViewBox:i,style:{fill:{type:`solid`,value:El}},ratingLink:{scoreId:t,max:5,r:Rl(n,5)}})}function Bl(e,t,n,r){return Ls({id:t,parentId:e,name:`Score`,anchors:n,content:{default:r},fontSize:92,fontWeight:800,color:Dl,align:`center`,fitMode:`fixed`})}function Vl(e,t,n){if(!e.layers.some(e=>e.type===`shape`&&e.ratingLink))return;let r=t===n?`default`:t,i=new Map(e.layers.map(e=>[e.id,e]));for(let t of e.layers){if(t.type!==`shape`||!t.ratingLink)continue;let e=i.get(t.ratingLink.scoreId);if(!e||e.type!==`text`)continue;let n=parseFloat(String(e.content?.[r]??e.content?.default??``));if(!Number.isFinite(n))continue;let a=Rl(n,t.ratingLink.max);a!==t.ratingLink.r&&(t.ratingLink.r=a,t.vectorPaths=Ll(a,t.ratingLink.max))}}var X={ratings_badge:{icon:ie,build:e=>{let t=al(),n=al(),r=Il(5),i=sl(50,6.8,230,40,!0),a=e.rating??`4.8`,o=Number.isFinite(parseFloat(a))?parseFloat(a):4.8;return[ol(t,`Star rating`),Al(t,sl(50,6,560,250,!0)),kl(t,`Stars track`,i,r.paths,r.viewBox,`#E6E1D8`),zl(t,n,o,i,r.viewBox),Bl(t,n,sl(50,8.5,420,100,!0),a),cl(t,`Caption`,sl(50,12.8,500,30,!0),e.caption??`App Store rating`,{size:23,weight:700,color:`#5F5F5F`,spacing:2,transform:`uppercase`})]}},review_card:{icon:ne,build:e=>{let t=al(),n=Il(5);return[ol(t,`Review card`),Al(t,sl(50,4,760,360,!0)),cl(t,`Quote mark`,sl(50,3.5,220,120,!0),`“`,{size:150,weight:800,color:`#EBE4D8`}),kl(t,`Stars`,sl(50,8,200,34,!0),n.paths,n.viewBox,El),cl(t,`Quote`,sl(50,9.7,640,130,!0),e.quote??`This app completely changed how I work. I honestly can’t imagine my day without it.`,{size:36,weight:500,color:Dl}),cl(t,`Author`,sl(50,14.2,600,30,!0),e.author??`— Sarah K., Product Designer`,{size:22,weight:600,color:Ol})]}},laurel_stat:{icon:we,build:(e,t)=>{let n=al(),r=al(),i=e.value??`2M+`,a=t.canvasWidth??1320,o=yl(i,100,800),s=_l(),c=ll(409*s.viewBox[0]/s.viewBox[1]);return[ol(n,`Laurel stat`),Cl(n,`left`,r,o,a,c,409,s.left,s.viewBox),Cl(n,`right`,r,o,a,c,409,s.right,s.viewBox),cl(n,`Eyebrow`,sl(50,6.6,360,32,!0),e.eyebrow??`TRUSTED BY`,{size:22,weight:600,spacing:3,transform:`uppercase`}),wl(n,r,i),cl(n,`Label`,sl(50,13.2,360,30,!0),e.label??`USERS`,{size:24,weight:600,spacing:3,transform:`uppercase`})]}},laurel_rating:{icon:M,build:(e,t)=>{let n=al(),r=al(),i=e.value??`4.5k+`,a=t.canvasWidth??1320,o=yl(i,100,800),s=_l(),c=ll(409*s.viewBox[0]/s.viewBox[1]);return[ol(n,`Laurel rating`),Cl(n,`left`,r,o,a,c,409,s.left,s.viewBox),Cl(n,`right`,r,o,a,c,409,s.right,s.viewBox),cl(n,`Stars`,sl(50,6.4,340,36,!0),`★ ★ ★ ★ ★`,{size:30,weight:600,color:`#C9A227`,spacing:2}),wl(n,r,i),cl(n,`Label`,sl(50,13.2,360,30,!0),e.label??`REVIEWS`,{size:24,weight:600,spacing:3,transform:`uppercase`})]}}};function Hl(e,t={},n={}){return X[e]?.build(t??{},n)??[]}var Ul=il;function Wl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gl(e,t){let n={...e};for(let e of Object.keys(t)){let r=t[e],i=n[e];if(Wl(r)&&Wl(i)){n[e]=Gl(i,r);continue}n[e]=r}return n}function Kl(e,t){let n={},r=new Set([...Object.keys(e),...Object.keys(t)]);for(let i of r){let r=Object.prototype.hasOwnProperty.call(e,i),a=Object.prototype.hasOwnProperty.call(t,i),o=e[i],s=t[i];if(r&&!a){n[i]=o;continue}if(!r&&a){n[i]=null;continue}if(Wl(o)&&Wl(s)){let e=Kl(o,s);Object.keys(e).length>0&&(n[i]=e);continue}if(Array.isArray(o)&&Array.isArray(s)){JSON.stringify(o)!==JSON.stringify(s)&&(n[i]=o);continue}if(Array.isArray(o)!==Array.isArray(s)){n[i]=o;continue}if(typeof o==`number`||typeof s==`number`){(typeof o==`number`?Math.round(o*1e5)/1e5:o)!==(typeof s==`number`?Math.round(s*1e5)/1e5:s)&&(n[i]=o);continue}o!==s&&(n[i]=o)}return n}function ql(e,t){if(!t)return e;let n=e.layers??[];if(!n.length)return e;let r=!1,i=n.map(e=>{let n=e;if(n.type!==`frame`)return e;let i=n.screen;if(!Wl(i))return e;let a=i.localePaths;if(!Wl(a))return e;let o=a[t];return typeof o!=`string`||o===``?e:(r=!0,{...n,screen:{...i,storagePath:o}})});return r?{...e,layers:i}:e}function Jl(e,t,n){if(!t||t===n)return e;let r=e.layers??[];if(!r.length)return e;let i=!1,a=r.map(e=>{let n=e,r=n.localeOverrides;if(!Wl(r))return e;let a=r[t];return!Wl(a)||Object.keys(a).length===0?e:(i=!0,Gl(n,a))});return i?{...e,layers:a}:e}function Yl(e,t,n,r){if(!t||t===n)return r;let i={};for(let t of e.layers??[]){let e=t;typeof e.id==`string`&&(i[e.id]=e)}let a=JSON.parse(JSON.stringify(e));if(!Array.isArray(a.layers))return a;let o=a.layers,s={};o.forEach((e,t)=>{Wl(e)&&typeof e.id==`string`&&(s[e.id]=t)});for(let e of r?.layers??[]){if(!Wl(e)||typeof e.id!=`string`)continue;let n=e.id,r=i[n];if(!r)continue;let a=Wl(r.localeOverrides)?r.localeOverrides[t]:void 0,c=Kl(e,Wl(a)&&Object.keys(a).length>0?Gl(r,a):r);if(delete c.id,delete c.localeOverrides,Object.keys(c).length===0)continue;let l=s[n];if(l===void 0)continue;let u=o[l],d=Wl(u.localeOverrides)?u.localeOverrides:{},f=Gl(Wl(d[t])?d[t]:{},c);u.localeOverrides={...d,[t]:f},o[l]=u}return a.layers=o,a}var Xl=()=>typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`l_${Math.random().toString(36).slice(2,10)}`;function Zl(e,t){e.type===`shape`&&(e.spacingLink&&t.has(e.spacingLink.valueId)&&(e.spacingLink={...e.spacingLink,valueId:t.get(e.spacingLink.valueId)}),e.ratingLink&&t.has(e.ratingLink.scoreId)&&(e.ratingLink={...e.ratingLink,scoreId:t.get(e.ratingLink.scoreId)}))}function Ql(e,t){let n=[];for(let r of e){let e=t.layers.find(e=>e.id===r);if(e)if(e.type===`group`){let e=t.layers.filter(e=>e.parentId===r&&e.type!==`background`&&e.type!==`group`&&e.locked!==!0);if(e.length===0)continue;let i=e.map(e=>he(e.anchors,t.canvas)),a=Math.min(...i.map(e=>e.x)),o=Math.min(...i.map(e=>e.y)),s=Math.max(...i.map(e=>e.x+e.width)),c=Math.max(...i.map(e=>e.y+e.height));n.push({kind:`group`,id:r,rect:{x:a,y:o,width:s-a,height:c-o},childIds:e.map(e=>e.id)})}else e.type!==`background`&&e.locked!==!0&&n.push({kind:`leaf`,id:r,rect:he(e.anchors,t.canvas),anchors:e.anchors})}return n}function $l(e,t,n,r,i){if(!(n===0&&r===0)){if(t.kind===`leaf`){let a=e.layers.find(e=>e.id===t.id);if(!a)return;let o=he(a.anchors,i);a.anchors=R({...o,x:o.x+n,y:o.y+r},i,a.anchors);return}for(let a of t.childIds){let t=e.layers.find(e=>e.id===a);if(!t)continue;let o=he(t.anchors,i);t.anchors=R({...o,x:o.x+n,y:o.y+r},i,t.anchors)}}}el();var eu=100,tu={width:L.iphone_portrait.w,height:L.iphone_portrait.h};function nu(e,t,n){return!t||t===n?e:ql(Jl(e,t,n),t)}var ru=f()((e,t)=>{let n=n=>{let r=t().activeLocale,i=t().defaultLocale,a=t().baseLayout,o=Yl(a,r,i,n);e(e=>({baseLayout:o,editSeq:e.editSeq+1}))},r=r=>{let{activeLocale:i,defaultLocale:a}=t(),[o,s,c]=nl(t().layout,e=>{r(e),Tl(e,i,a),Vl(e,i,a)});s.length!==0&&(e(e=>({layout:o,past:[...e.past,{forward:s,inverse:c}].slice(-eu),future:[]})),n(o))};return{layout:ye({...tu}),baseLayout:ye({...tu}),editSeq:0,activeLocale:`en`,activeLocales:[`en`],defaultLocale:`en`,selection:[],past:[],future:[],devicePresets:[],activeScreenId:null,aspectLocks:{},cropModeLayerId:null,penMode:!1,penDraft:null,penClosed:!1,calloutMode:`idle`,calloutShape:`rounded-rect`,calloutEditingLayerId:null,pathEditLayerId:null,textEditLayerId:null,clipboardStyle:null,clipboardLayers:null,clipboardSourceScreenId:null,addLayer:(t,n)=>{r(e=>{e.layers.push(t)}),(t.type===`image`||t.type===`frame`||t.type===`callout`)&&e(e=>({aspectLocks:{...e.aspectLocks,[t.id]:1}})),n?.select!==!1&&e({selection:[t.id]})},addLayers:(t,n)=>{t.length!==0&&(r(e=>{e.layers.push(...t)}),n?.selectId&&e({selection:[n.selectId]}))},updateLayer:(e,t)=>{r(n=>{let r=n.layers.find(t=>t.id===e);r&&t(r)})},previewLayer:(n,r)=>{let[i,a]=nl(t().layout,e=>{let t=e.layers.find(e=>e.id===n);t&&r(t)});a.length!==0&&e({layout:i})},deleteLayer:n=>{let i=t().layout.layers,a=i.find(e=>e.id===n),o=new Set([n]);if(a?.type===`group`)for(let e of i)e.parentId===n&&o.add(e.id);r(e=>{e.layers=e.layers.filter(e=>!o.has(e.id));for(let t of e.layers)t.type===`image`&&t.clipShapeId&&o.has(t.clipShapeId)&&delete t.clipShapeId}),e(e=>({selection:e.selection.filter(e=>!o.has(e))}))},deleteSelected:()=>{let n=new Set(t().selection);if(n.size===0)return;let i=t().layout.layers;for(let e of i)e.parentId&&n.has(e.parentId)&&n.add(e.id);r(e=>{e.layers=e.layers.filter(e=>!n.has(e.id));for(let t of e.layers)t.type===`image`&&t.clipShapeId&&n.has(t.clipShapeId)&&delete t.clipShapeId}),e({selection:[]})},duplicateSelected:()=>{let{selection:n,layout:i}=t();if(n.length===0)return;let a=new Set(n),o=new Set(n);for(let e of i.layers)e.parentId&&a.has(e.parentId)&&o.add(e.id);let s=i.layers.filter(e=>o.has(e.id));if(s.length===0)return;let c={x:i.canvas.width*.02,y:i.canvas.height*.02},l=new Map;for(let e of s)l.set(e.id,Xl());let u=s.map(e=>{let t=structuredClone(e);if(t.id=l.get(e.id),t.parentId&&l.has(t.parentId)?t.parentId=l.get(t.parentId):t.parentId&&!a.has(t.parentId)&&delete t.parentId,t.type===`image`&&(t.clipShapeId&&l.has(t.clipShapeId)?t.clipShapeId=l.get(t.clipShapeId):t.clipShapeId&&delete t.clipShapeId),Zl(t,l),t.type!==`group`){let n=he(e.anchors,i.canvas);t.anchors=R({...n,x:n.x+c.x,y:n.y+c.y},i.canvas,e.anchors)}return t});r(e=>{e.layers.push(...u)}),e({selection:n.map(e=>l.get(e)).filter(e=>!!e)})},arrange:e=>{let n=new Set(t().selection);n.size!==0&&r(t=>{let r=t.layers,i=r.filter(e=>n.has(e.id)),a=r.filter(e=>!n.has(e.id));if(i.length!==0)if(e===`front`)t.layers=[...a,...i];else if(e===`back`)t.layers=[...i,...a];else if(e===`forward`){let e=r.map((e,t)=>n.has(e.id)?t:-1).filter(e=>e!==-1).sort((e,t)=>t-e),i=[...r],a=new Set(n);for(let t of e)t<i.length-1&&!a.has(i[t+1].id)&&([i[t],i[t+1]]=[i[t+1],i[t]]);t.layers=i}else{let e=r.map((e,t)=>n.has(e.id)?t:-1).filter(e=>e!==-1).sort((e,t)=>e-t),i=[...r],a=new Set(n);for(let t of e)t>0&&!a.has(i[t-1].id)&&([i[t],i[t-1]]=[i[t-1],i[t]]);t.layers=i}})},commitGroupTransform:e=>{e.length!==0&&r(t=>{for(let n of e){let e=t.layers.find(e=>e.id===n.id);if(!e||(e.anchors=n.anchors,n.rotation!==void 0&&(e.rotation=n.rotation),n.scale===void 0))continue;let r=n.scale;e.type===`text`?(e.fitMode===`auto`&&(e.fitMode=`fixed`),Math.abs(r-1)>1e-4&&(e.fontSize&&=Math.max(1,e.fontSize*r),e.letterSpacing&&(e.letterSpacing*=r))):e.type===`shape`&&Math.abs(r-1)>1e-4&&(e.style?.radius&&(e.style.radius=Math.max(0,e.style.radius*r)),e.style?.stroke?.width&&(e.style.stroke.width=Math.max(0,e.style.stroke.width*r)),e.style?.shadow&&(e.style.shadow.blur=Math.max(0,e.style.shadow.blur*r),e.style.shadow.offsetX*=r,e.style.shadow.offsetY*=r))}})},nudgeSelected:(e,n)=>{if(e===0&&n===0)return;let{selection:i,layout:a}=t();if(i.length===0)return;let o=new Set;for(let e of i){let t=a.layers.find(t=>t.id===e);if(t)if(t.type===`group`)for(let t of a.layers)t.parentId===e&&o.add(t.id);else o.add(e)}let s=Array.from(o).map(e=>a.layers.find(t=>t.id===e)).filter(e=>!!e&&e.type!==`background`&&e.type!==`group`&&e.locked!==!0);if(s.length===0)return;let c=s.map(e=>({id:e.id,anchors:e.anchors,rect:he(e.anchors,a.canvas)}));r(t=>{for(let{id:r,anchors:i,rect:o}of c){let s=t.layers.find(e=>e.id===r);s&&(s.anchors=R({...o,x:o.x+e,y:o.y+n},a.canvas,i))}})},alignSelected:e=>{let{selection:n,layout:i}=t();if(n.length<2)return;let a=Ql(n,i),o=n.some(e=>i.layers.find(t=>t.id===e)?.type===`background`);if(o){if(a.length<1)return}else if(a.length<2)return;let s=o?{left:0,right:i.canvas.width,top:0,bottom:i.canvas.height}:{left:Math.min(...a.map(e=>e.rect.x)),right:Math.max(...a.map(e=>e.rect.x+e.rect.width)),top:Math.min(...a.map(e=>e.rect.y)),bottom:Math.max(...a.map(e=>e.rect.y+e.rect.height))},c=(s.left+s.right)/2,l=(s.top+s.bottom)/2;r(t=>{for(let n of a){let r={x:n.rect.x,y:n.rect.y};switch(e){case`left`:r.x=s.left;break;case`right`:r.x=s.right-n.rect.width;break;case`centerH`:r.x=c-n.rect.width/2;break;case`top`:r.y=s.top;break;case`bottom`:r.y=s.bottom-n.rect.height;break;case`centerV`:r.y=l-n.rect.height/2;break}$l(t,n,r.x-n.rect.x,r.y-n.rect.y,i.canvas)}})},distributeSelected:e=>{let{selection:n,layout:i}=t();if(n.length<3)return;let a=Ql(n,i),o=n.some(e=>i.layers.find(t=>t.id===e)?.type===`background`);if(o){if(a.length<2)return}else if(a.length<3)return;let s=a.map(e=>({id:e.id,anchors:`anchors`in e?e.anchors:void 0,rect:e.rect,unit:e})),c=o?[{id:`__canvas_start__`,anchors:void 0,rect:{x:0,y:0,width:0,height:0},unit:null},...s,{id:`__canvas_end__`,anchors:void 0,rect:{x:i.canvas.width,y:i.canvas.height,width:0,height:0},unit:null}]:s;if(e===`horizontal`){c.sort((e,t)=>e.rect.x+e.rect.width/2-(t.rect.x+t.rect.width/2));let e=c[0],t=c[c.length-1],n=(t.rect.x+t.rect.width-e.rect.x-c.reduce((e,t)=>e+t.rect.width,0))/(c.length-1);r(t=>{let r=e.rect.x+e.rect.width+n;for(let e=1;e<c.length-1;e++){let{rect:a,unit:o}=c[e];o&&$l(t,o,r-a.x,0,i.canvas),r+=a.width+n}})}else{c.sort((e,t)=>e.rect.y+e.rect.height/2-(t.rect.y+t.rect.height/2));let e=c[0],t=c[c.length-1],n=(t.rect.y+t.rect.height-e.rect.y-c.reduce((e,t)=>e+t.rect.height,0))/(c.length-1);r(t=>{let r=e.rect.y+e.rect.height+n;for(let e=1;e<c.length-1;e++){let{rect:a,unit:o}=c[e];o&&$l(t,o,0,r-a.y,i.canvas),r+=a.height+n}})}},moveLayer:(e,t)=>{r(n=>{let r=n.layers.findIndex(t=>t.id===e);if(r===-1)return;let i=n.layers.length-1,a;switch(t){case`up`:a=Math.min(i,r+1);break;case`down`:a=Math.max(0,r-1);break;case`top`:a=i;break;case`bottom`:a=0;break}if(a===r)return;let[o]=n.layers.splice(r,1);n.layers.splice(a,0,o)})},reorderLayers:e=>{r(t=>{if(e.length!==t.layers.length)return;let n=new Map(t.layers.map(e=>[e.id,e])),r=[];for(let t of e){let e=n.get(t);if(!e)return;r.push(e)}r.every((e,n)=>e.id===t.layers[n].id)||(t.layers=r)})},setSelection:t=>e({selection:t}),selectWithParent:(n,r)=>{let i=r?.additive===!0,a=t().layout.layers;if(i){if(!a.some(e=>e.id===n))return;let{selection:r}=t(),i=new Set(r);i.has(n)?i.delete(n):i.add(n),e({selection:Array.from(i)});return}let o=a.find(e=>e.id===n),s=new Set;for(;o?.parentId&&!s.has(o.id);){s.add(o.id);let e=a.find(e=>e.id===o.parentId);if(!e)break;o=e}let c=o?.id??n,{selection:l}=t();l.length===1&&l[0]===c||e({selection:[c]})},clearSelection:()=>e({selection:[]}),groupSelected:()=>{let{selection:n,layout:i}=t();if(n.length<2)return;let a=new Set(n),o=n.filter(e=>{let t=i.layers.find(t=>t.id===e);return!(!t||t.type===`group`||t.parentId&&a.has(t.parentId))});if(o.length<2)return;let s=new Set(o),c=i.layers.reduce((e,t,n)=>s.has(t.id)&&n>e?n:e,-1);if(c<0)return;let l=c+1,u={id:Xl(),type:`group`,name:`Group`,anchors:{left:{type:`percent`,value:0},top:{type:`percent`,value:0},width:{type:`percent`,value:0},height:{type:`percent`,value:0}}};r(e=>{for(let t of e.layers)s.has(t.id)&&(t.parentId=u.id);e.layers.splice(l,0,u)}),e({selection:[u.id]})},ungroupSelected:()=>{let{selection:n,layout:i}=t();if(n.length===0)return;let a=new Set(n.filter(e=>i.layers.find(t=>t.id===e)?.type===`group`));if(a.size===0)return;let o=[];for(let e of i.layers)e.parentId&&a.has(e.parentId)&&o.push(e.id);r(e=>{for(let t of e.layers)t.parentId&&a.has(t.parentId)&&delete t.parentId;e.layers=e.layers.filter(e=>!a.has(e.id))}),e({selection:o})},undo:()=>{let{past:r,future:i,layout:a}=t();if(r.length===0)return;let o=r[r.length-1],s=rl(a,o.inverse);e({layout:s,past:r.slice(0,-1),future:[o,...i]}),n(s)},redo:()=>{let{past:r,future:i,layout:a}=t();if(i.length===0)return;let[o,...s]=i,c=rl(a,o.forward);e({layout:c,past:[...r,o],future:s}),n(c)},replaceLayout:n=>{let r=nc(n),i=t().activeLocale,a=t().defaultLocale,o={};for(let e of r.layers){if(e.type!==`frame`&&e.type!==`image`&&e.type!==`callout`)continue;let t=he(e.anchors,r.canvas);o[e.id]=t.height>0?t.width/t.height:1}let s=new Set(r.layers.map(e=>e.id)),c=t().selection.filter(e=>s.has(e));e({baseLayout:r,layout:nu(r,i,a),aspectLocks:o,past:[],future:[],selection:c,textEditLayerId:null,pathEditLayerId:null,cropModeLayerId:null})},setActiveLocale:n=>{if(t().activeLocale===n)return;let r=t().baseLayout,i=t().defaultLocale;e({activeLocale:n,layout:nu(r,n,i)})},setActiveLocales:(n,r)=>{let i=new Set,a=[];for(let e of[r,...n])!e||i.has(e)||(i.add(e),a.push(e));let o=t().activeLocales,s=o.length===a.length&&o.every((e,t)=>e===a[t]),c=t().defaultLocale===r;s&&c||e({activeLocales:a,defaultLocale:r})},setDevicePresets:t=>e({devicePresets:t}),setAspectLock:(t,n,r)=>e(e=>{let i={...e.aspectLocks};return n?i[t]=r??e.aspectLocks[t]??1:delete i[t],{aspectLocks:i}}),enterCropMode:t=>e({cropModeLayerId:t}),exitCropMode:()=>e({cropModeLayerId:null}),enterPenMode:()=>e({penMode:!0,penDraft:[],penClosed:!1,selection:[],cropModeLayerId:null,pathEditLayerId:null}),exitPenMode:()=>e({penMode:!1,penDraft:null,penClosed:!1}),addPenNode:t=>e(e=>({penDraft:e.penDraft?[...e.penDraft,t]:[t]})),updatePenNode:(t,n)=>e(e=>{if(!e.penDraft||t<0||t>=e.penDraft.length)return{};let r=e.penDraft.slice();return r[t]={...r[t],...n},{penDraft:r}}),setPenClosed:t=>e({penClosed:t}),commitPen:()=>{let{penDraft:r,penClosed:i}=t();if(!r||r.length<2){e({penMode:!1,penDraft:null,penClosed:!1});return}let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e of r){let t=[{x:e.x,y:e.y}];e.handleIn&&t.push({x:e.x+e.handleIn.x,y:e.y+e.handleIn.y}),e.handleOut&&t.push({x:e.x+e.handleOut.x,y:e.y+e.handleOut.y});for(let e of t)e.x<a&&(a=e.x),e.y<o&&(o=e.y),e.x>s&&(s=e.x),e.y>c&&(c=e.y)}let l=Math.max(1,s-a),u=Math.max(1,c-o),d=r.map(e=>{let t={x:(e.x-a)/l,y:(e.y-o)/u};return e.handleIn&&(t.handleIn={x:e.handleIn.x/l,y:e.handleIn.y/u}),e.handleOut&&(t.handleOut={x:e.handleOut.x/l,y:e.handleOut.y/u}),t}),f=Rs(`path`,{anchors:{left:{type:`px`,value:Math.round(a)},top:{type:`px`,value:Math.round(o)},width:{type:`px`,value:Math.max(1,Math.round(l))},height:{type:`px`,value:Math.max(1,Math.round(u))}},nodes:d,closed:i}),[p,m,h]=nl(t().layout,e=>{e.layers.push(f)});m.length>0&&(e(e=>({layout:p,past:[...e.past,{forward:m,inverse:h}].slice(-eu),future:[]})),n(p)),e({penMode:!1,penDraft:null,penClosed:!1,selection:[f.id]})},enterCalloutMode:t=>e({calloutMode:`armed`,calloutShape:t,calloutEditingLayerId:null,penMode:!1,penDraft:null,penClosed:!1,cropModeLayerId:null,pathEditLayerId:null,textEditLayerId:null}),exitCalloutMode:()=>e({calloutMode:`idle`,calloutEditingLayerId:null}),repickCalloutSource:n=>{let r=t().layout.layers.find(e=>e.id===n);e({calloutMode:`armed`,calloutShape:r?.type===`callout`?r.shape:t().calloutShape,calloutEditingLayerId:n,penMode:!1,penDraft:null,penClosed:!1,cropModeLayerId:null,pathEditLayerId:null,textEditLayerId:null})},enterPathEdit:t=>e({pathEditLayerId:t,penMode:!1,penDraft:null,penClosed:!1}),exitPathEdit:()=>e({pathEditLayerId:null}),enterTextEdit:n=>{let r=t().layout.layers.find(e=>e.id===n);!r||r.type!==`text`||e({textEditLayerId:n,selection:[n],pathEditLayerId:null,cropModeLayerId:null,penMode:!1})},exitTextEdit:()=>e({textEditLayerId:null}),copyStyle:()=>{let{selection:n,layout:r}=t();if(n.length===0)return;let i=r.layers.find(e=>e.id===n[0]);if(!i)return;let a={from:i.type};if(i.style&&(a.style=structuredClone(i.style)),i.type===`text`){let e=i,t={fontFamily:e.fontFamily,fontSize:e.fontSize,minFontSize:e.minFontSize,maxFontSize:e.maxFontSize,fitMode:e.fitMode,color:e.color};e.fontWeight!==void 0&&(t.fontWeight=e.fontWeight),e.fontStyle!==void 0&&(t.fontStyle=e.fontStyle),e.align!==void 0&&(t.align=e.align),e.lineHeight!==void 0&&(t.lineHeight=e.lineHeight),e.letterSpacing!==void 0&&(t.letterSpacing=e.letterSpacing),e.textTransform!==void 0&&(t.textTransform=e.textTransform),e.fill!==void 0&&(t.fill=structuredClone(e.fill)),a.textFields=t}else if(i.type===`shape`){let e=i,t={};e.sides!==void 0&&(t.sides=e.sides),e.starPoints!==void 0&&(t.starPoints=e.starPoints),e.innerRatio!==void 0&&(t.innerRatio=e.innerRatio),e.startAngle!==void 0&&(t.startAngle=e.startAngle),e.sweepAngle!==void 0&&(t.sweepAngle=e.sweepAngle),e.arrowHead!==void 0&&(t.arrowHead=e.arrowHead),e.arrowAt!==void 0&&(t.arrowAt=e.arrowAt),e.closed!==void 0&&(t.closed=e.closed),a.shapeFields=t}e({clipboardStyle:a})},pasteStyle:()=>{let{clipboardStyle:e,selection:n}=t();if(!e||n.length===0)return;let i=new Set(n);r(t=>{for(let n of t.layers)i.has(n.id)&&(e.style&&(n.style=structuredClone(e.style)),e.from===`text`&&n.type===`text`&&e.textFields&&Object.assign(n,structuredClone(e.textFields)),e.from===`shape`&&n.type===`shape`&&e.shapeFields&&Object.assign(n,structuredClone(e.shapeFields)))})},copyLayers:()=>{let{selection:n,layout:r,activeScreenId:i}=t();if(n.length===0)return;let a=new Set(n),o=new Set(n);for(let e of r.layers)e.parentId&&a.has(e.parentId)&&o.add(e.id);let s=r.layers.filter(e=>o.has(e.id)).map(e=>structuredClone(e));s.length!==0&&e({clipboardLayers:s,clipboardSourceScreenId:i})},pasteLayers:()=>{let{clipboardLayers:n,clipboardSourceScreenId:i,layout:a,activeScreenId:o}=t();if(!n||n.length===0)return;let s=new Set(n.map(e=>e.id)),c=new Map;for(let e of n)c.set(e.id,Xl());let l=i!==null&&i===o,u=l?{x:a.canvas.width*.02,y:a.canvas.height*.02}:{x:0,y:0},d=n.map(e=>{let t=structuredClone(e);if(t.id=c.get(e.id),t.parentId&&c.has(t.parentId)?t.parentId=c.get(t.parentId):t.parentId&&delete t.parentId,t.type===`image`&&(t.clipShapeId&&c.has(t.clipShapeId)?t.clipShapeId=c.get(t.clipShapeId):t.clipShapeId&&delete t.clipShapeId),Zl(t,c),t.type!==`group`&&l){let n=he(e.anchors,a.canvas);t.anchors=R({...n,x:n.x+u.x,y:n.y+u.y},a.canvas,e.anchors)}return t});r(e=>{e.layers.push(...d)}),e({selection:n.filter(e=>!e.parentId||!s.has(e.parentId)).map(e=>c.get(e.id)).filter(e=>!!e)})},bindImageToShape:(e,n)=>{let i=t().layout.layers,a=i.find(t=>t.id===e),o=i.find(e=>e.id===n);!a||a.type!==`image`||!o||o.type!==`shape`||o.shape===`line`||o.shape===`arrow`||o.shape===`path`&&!o.closed||r(t=>{let r=t.layers.find(t=>t.id===e);!r||r.type!==`image`||(r.clipShapeId=n)})},unbindImageClip:e=>{r(t=>{let n=t.layers.find(t=>t.id===e);!n||n.type!==`image`||delete n.clipShapeId})},setFrameScreen:(e,t)=>{r(n=>{let r=n.layers.find(t=>t.id===e);!r||r.type!==`frame`||(r.screen=t)})},updateFrameScreen:(e,t)=>{r(n=>{let r=n.layers.find(t=>t.id===e);!r||r.type!==`frame`||!r.screen||t(r.screen)})},clearFrameScreen:e=>{r(t=>{let n=t.layers.find(t=>t.id===e);!n||n.type!==`frame`||delete n.screen})},setActiveScreenId:t=>e({activeScreenId:t}),setFrameScreenLocalePath:async(e,n,r)=>{let i=t().activeScreenId;if(i==null)return;let a=document.querySelector(`meta[name="csrf-token"]`)?.getAttribute(`content`),s=document.cookie.match(/(?:^|;\s*)XSRF-TOKEN=([^;]+)/),c=s?decodeURIComponent(s[1]):null,l={Accept:`application/json`,"Content-Type":`application/json`,"X-Requested-With":`XMLHttpRequest`};a&&(l[`X-CSRF-TOKEN`]=a),c&&(l[`X-XSRF-TOKEN`]=c),(await fetch(`/screens/${i}/master/frame-screen-locale-path`,{method:`PATCH`,credentials:`same-origin`,headers:l,body:JSON.stringify({layerId:e,locale:n,storagePath:r})})).ok&&o.visit(window.location.href,{preserveScroll:!0})}}});typeof window<`u`&&(window.__APPSHOT_EDITOR__=ru);function iu(){let e=ru(e=>e.activeLocale),t=r().props.locales??[];return(0,z.useMemo)(()=>au(e,t),[e,t])}function au(e,t){if(!t)return`ltr`;for(let n of t)if(n.code===e)return n.direction;return`ltr`}function ou(e,t,n){return t===n?e.richRuns:e.richRunsByLocale?.[t]||(e.content[t]===void 0?e.richRuns:void 0)}function su(e,t){if(!e?.length)return[];let n=null;for(let t of e)t&&(t.color||t.bold||t.italic)&&(n={},t.color&&(n.color=t.color),t.bold&&(n.bold=!0),t.italic&&(n.italic=!0));if(!n||t.trim()===``)return[];let r=t.lastIndexOf(` `);return r===-1?[{text:t,...n}]:[{text:t.slice(0,r+1)},{text:t.slice(r+1),...n}]}function cu(e){let t=[],n=[];for(let r of e)for(let e of Array.from(r.text))t.push(e),n.push({color:r.color,bold:r.bold,italic:r.italic});return{graphemes:t,styles:n}}function lu(e,t,n){let r=[],i=0;for(let a of e)for(let e of Array.from(a.text)){let a=e.toLowerCase();for(;i<t.length&&t[i].toLowerCase()!==a;)i++;r.push(n[i]??{}),i++}return r}function uu(e,t,n){let{graphemes:r,styles:i}=cu(t),a=`\0`,o=i;return t=>{let s=e.textArr,c=s?s.map(e=>e.text).join(``):``;c!==a&&(a=c,o=s?lu(s,r,i):i);let l=o[t.index]??i[t.index]??{};if(e.attrs.fill=l.color??n,l.bold||l.italic){let n=l.italic?`italic `:``,r=l.bold?`700`:`normal`;t.context.setAttr(`font`,`${n}${r} ${e.fontSize()}px ${e.fontFamily()}`)}}}function du(e,t,n){let r=e.parentId,i=new Set;for(;r&&!i.has(r);){i.add(r);let e=t.find(e=>e.id===r);if(!e)return!1;if(n(e))return!0;r=e.parentId}return!1}function fu(e,t){return e.visible===!1?!1:!du(e,t,e=>e.visible===!1)}function pu(e,t){return e.locked===!0?!0:du(e,t,e=>e.locked===!0)}function mu(e){let t=e.data;for(let e=0;e<t.length;e+=4){let n=t[e+3]/255;t[e]*=n,t[e+1]*=n,t[e+2]*=n}}var hu=[mu,J.Filters.Blur];function gu(e){return typeof e==`string`?e:e&&typeof e==`object`&&e.type===`solid`?e.value??null:null}function _u(e,t,n,r){return i=>{let a=i._context;a.save(),a.filter=`blur(${r}px)`,a.beginPath(),a.ellipse(e/2,t/2,e/2,t/2,0,0,Math.PI*2),a.fillStyle=n,a.fill(),a.restore()}}function vu(e,t,n=1){let r=Math.max(1,n);switch(e){case`dots`:{let e=Math.round(24*r),n=document.createElement(`canvas`);n.width=e,n.height=e;let i=n.getContext(`2d`);return i.fillStyle=t,i.beginPath(),i.arc(e/2,e/2,Math.max(1,Math.round(2.5*r)),0,Math.PI*2),i.fill(),n}case`lines`:{let e=Math.round(20*r),n=document.createElement(`canvas`);n.width=e,n.height=e;let i=n.getContext(`2d`);return i.strokeStyle=t,i.lineWidth=Math.max(1,Math.round(1.5*r)),i.beginPath(),i.moveTo(0,e),i.lineTo(e,0),i.stroke(),i.beginPath(),i.moveTo(-e,e),i.lineTo(0,0),i.stroke(),i.beginPath(),i.moveTo(e,e*2),i.lineTo(e*2,e),i.stroke(),n}case`grid`:{let e=Math.round(24*r),n=document.createElement(`canvas`);n.width=e,n.height=e;let i=n.getContext(`2d`);return i.strokeStyle=t,i.lineWidth=Math.max(1,Math.round(1*r)),i.beginPath(),i.moveTo(0,0),i.lineTo(e,0),i.moveTo(0,0),i.lineTo(0,e),i.stroke(),n}case`crosshatch`:{let e=Math.round(20*r),n=document.createElement(`canvas`);n.width=e,n.height=e;let i=n.getContext(`2d`);return i.strokeStyle=t,i.lineWidth=Math.max(1,Math.round(1*r)),i.beginPath(),i.moveTo(0,e),i.lineTo(e,0),i.moveTo(-e,e),i.lineTo(0,0),i.moveTo(e,e*2),i.lineTo(e*2,e),i.stroke(),i.beginPath(),i.moveTo(0,0),i.lineTo(e,e),i.moveTo(-e,0),i.lineTo(0,e),i.moveTo(e,0),i.lineTo(e*2,e),i.stroke(),n}}}function yu(e,t,n){if(!e)return{};if(e.type===`solid`)return{fill:e.value};if(e.type===`pattern`)try{return{fillPatternImage:vu(e.patternId,e.color,e.scale??3),fillPatternRepeat:`repeat`}}catch{return{fill:e.color}}let r=Array.isArray(e.stops)?e.stops:[];if(r.length===0)return{fill:`transparent`};if(e.type===`linear`){let i=e.angle*Math.PI/180,a=t/2,o=n/2,s=Math.max(t,n)/2,c=Math.cos(i)*s,l=Math.sin(i)*s,u=[];for(let e of r)u.push(e.offset,e.color);return{fillLinearGradientStartPoint:{x:a-c,y:o-l},fillLinearGradientEndPoint:{x:a+c,y:o+l},fillLinearGradientColorStops:u}}let i=[];for(let e of r)i.push(e.offset,e.color);let a=e.cx*t,o=e.cy*n,s=e.radius*Math.max(t,n);return{fillRadialGradientStartPoint:{x:a,y:o},fillRadialGradientStartRadius:0,fillRadialGradientEndPoint:{x:a,y:o},fillRadialGradientEndRadius:s,fillRadialGradientColorStops:i}}function bu(e,t,n,r){if(!t)return`#111111`;if(t.type===`solid`)return t.value;if(t.type===`pattern`)try{let n=vu(t.patternId,t.color,t.scale??3);return e.createPattern(n,`repeat`)??t.color}catch{return t.color}let i=Array.isArray(t.stops)?t.stops:[];if(i.length===0)return`transparent`;let a=e=>Math.max(0,Math.min(1,e)),o=e=>{for(let t of i)try{e.addColorStop(a(t.offset),t.color)}catch{}return e};if(t.type===`linear`){let i=t.angle*Math.PI/180,a=n/2,s=r/2,c=Math.max(n,r)/2,l=Math.cos(i)*c,u=Math.sin(i)*c;return o(e.createLinearGradient(a-l,s-u,a+l,s+u))}let s=t.cx*n,c=t.cy*r,l=Math.max(1e-4,t.radius*Math.max(n,r));return o(e.createRadialGradient(s,c,0,s,c,l))}function xu(e){if(e!=null)return typeof e==`string`?{type:`solid`,value:e}:e}function Z(e,t,n){if(!e)return{};if(e.type===`solid`)return{stroke:e.value};if(e.type===`pattern`)return{};let r=Array.isArray(e.stops)?e.stops:[];if(r.length===0)return{};if(e.type===`linear`){let i=e.angle*Math.PI/180,a=t/2,o=n/2,s=Math.max(t,n)/2,c=Math.cos(i)*s,l=Math.sin(i)*s,u=[];for(let e of r)u.push(e.offset,e.color);return{strokeLinearGradientStartPoint:{x:a-c,y:o-l},strokeLinearGradientEndPoint:{x:a+c,y:o+l},strokeLinearGradientColorStops:u}}let i=[];for(let e of r)i.push(e.offset,e.color);let a=e.cx*t,o=e.cy*n,s=e.radius*Math.max(t,n);return{strokeRadialGradientStartPoint:{x:a,y:o},strokeRadialGradientStartRadius:0,strokeRadialGradientEndPoint:{x:a,y:o},strokeRadialGradientEndRadius:s,strokeRadialGradientColorStops:i}}function Su(e,t,n){let r=Math.min(e,t),i=n?.category===`tablet`,a=!!n&&n.key.startsWith(`android-`),o,s;if(a?(o=i?r*.04:r*.08,s=i?r*.01:r*.014):(o=r*(i?.06:.11),s=r*(i?.012:.018)),n&&/^iphone-1[56]/.test(n.key))return{chassisRadius:o,inset:s,island:{width:e*.28,height:Math.max(t*.018,8),y:s+t*.012}};if(a&&!i){let e=Math.max(r*.022,10);return{chassisRadius:o,inset:s,island:{width:e,height:e,y:s+t*.014}}}return{chassisRadius:o,inset:s}}var Q={};function Cu(e){e&&(Q={...Q,...e})}function wu(e,t){!e||!t||(Q[e]=t)}var Tu=[240,480,800,1200,1600];function Eu(e){if(e<=0)return Tu[0];for(let t of Tu)if(e<=t)return t;return Tu[Tu.length-1]}function Du(e,t){if(!e)return;if(/^(?:https?:|data:|blob:)/i.test(e))return e;let n=e.replace(/^\/+/,``);if(t?.width!==void 0){let e=Eu(t.width);return`/media/thumb?path=${encodeURIComponent(n)}&w=${e}`}return Q[n]||`/user-uploads/${n}`}function Ou(e){let t=document.cookie.match(RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,`\\$1`)}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function ku(e,t,n){return new Promise((r,i)=>{let a=new FormData;a.append(`file`,t);let o=Ou(`XSRF-TOKEN`),s=new XMLHttpRequest;if(s.open(`POST`,`/projects/${e}/media`),s.withCredentials=!0,s.responseType=`json`,s.setRequestHeader(`Accept`,`application/json`),o&&s.setRequestHeader(`X-XSRF-TOKEN`,o),n?.onProgress){let e=n.onProgress;s.upload.addEventListener(`progress`,t=>{t.lengthComputable&&e(t.total>0?t.loaded/t.total:0)})}s.addEventListener(`error`,()=>{i(Error(`Upload failed — network error`))}),s.addEventListener(`abort`,()=>{i(Error(`Upload cancelled`))}),s.addEventListener(`load`,()=>{let e=s.status;if(e<200||e>=300){let t=`Upload failed (${e})`,n=s.response;n&&typeof n==`object`&&typeof n.message==`string`&&(t=n.message),i(Error(t));return}let t=s.response;wu(t.storagePath,t.url),r(t)}),s.send(a)})}var Au=60,ju=2e3;function Mu(e,t){return Math.abs(e)<=15&&Math.abs(t)<=15}function Nu(e){return Math.min(ju,Math.max(Au,Math.ceil(e*1.5)))}function Pu(e,t,n,r,i,a,o){if(n<=0||r<=0)return;let s=Math.abs(i),c=Math.abs(a);if(s<.01&&c<.01){let i=o?.x??0,a=o?.y??0,s=o?.width??Lu(t),c=o?.height??Ru(t);e.drawImage(t,i,a,s,c,0,0,n,r);return}s>c?Iu(e,t,n,r,i,o):Fu(e,t,n,r,a,o)}function Fu(e,t,n,r,i,a){let o=i*Math.PI/180,s=Math.sin(o),c=Math.cos(o),l=Math.abs(s)*.5,u=r,d=r*(1-l),f=i<0?u:d,p=i<0?d:u,m=n*Math.max(.3,Math.abs(c)),h=(n-m)/2,g=a?.x??0,_=a?.y??0,v=a?.width??Lu(t),y=a?.height??Ru(t);e.imageSmoothingEnabled=!0,e.imageSmoothingQuality=`high`;let b=Nu(l*r);for(let n=0;n<b;n++){let i=n/b,a=(i+(n+1)/b)/2,o=g+i*v,s=v/b,c=h+i*m,l=m/b,u=f+(p-f)*a,d=(r-u)/2,x=n===b-1,S=+!x,C=x||l<=0?0:s/l;e.drawImage(t,o,_,s+C,y,c,d,l+S,u)}}function Iu(e,t,n,r,i,a){let o=i*Math.PI/180,s=Math.sin(o),c=Math.cos(o),l=Math.abs(s)*.5,u=n,d=n*(1-l),f=i<0?u:d,p=i<0?d:u,m=r*Math.max(.3,Math.abs(c)),h=(r-m)/2,g=a?.x??0,_=a?.y??0,v=a?.width??Lu(t),y=a?.height??Ru(t);e.imageSmoothingEnabled=!0,e.imageSmoothingQuality=`high`;let b=Nu(l*n);for(let r=0;r<b;r++){let i=r/b,a=(i+(r+1)/b)/2,o=_+i*y,s=y/b,c=h+i*m,l=m/b,u=f+(p-f)*a,d=(n-u)/2,x=r===b-1,S=+!x,C=x||l<=0?0:s/l;e.drawImage(t,g,o,v,s+C,d,c,u,l+S)}}function Lu(e){return`naturalWidth`in e&&e.naturalWidth?e.naturalWidth:`width`in e&&typeof e.width==`number`?e.width:0}function Ru(e){return`naturalHeight`in e&&e.naturalHeight?e.naturalHeight:`height`in e&&typeof e.height==`number`?e.height:0}function zu(e,t,n,r,i,a,o,s=0){if(r<=0||i<=0){e.beginPath(),e.closePath();return}let c=Math.abs(a),l=Math.abs(o);if(c<.01&&l<.01){let a=Math.max(0,Math.min(s,r/2,i/2));e.beginPath(),a<=0?e.rect(t,n,r,i):(e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+a,a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.arcTo(t,n+i,t,n+i-a,a),e.arcTo(t,n,t+a,n,a)),e.closePath();return}c>l?Vu(e,t,n,r,i,a,s):Bu(e,t,n,r,i,o,s)}function Bu(e,t,n,r,i,a,o){let s=a*Math.PI/180,c=Math.sin(s),l=Math.cos(s),u=Math.abs(c)*.5,d=i,f=i*(1-u),p=a<0?d:f,m=a<0?f:d,h=r*Math.max(.3,Math.abs(l)),g=(r-h)/2,_=i/2,v=t+g,y=t+g+h,b=n+_-p/2,x=n+_+p/2,S=n+_-m/2,C=n+_+m/2,w=Math.hypot(y-v,S-b),T=Math.max(0,Math.min(o,w/2,p/2,m/2));if(e.beginPath(),T<=0)e.moveTo(v,b),e.lineTo(y,S),e.lineTo(y,C),e.lineTo(v,x);else{let t=(v+y)/2,n=(b+S)/2;e.moveTo(t,n),e.arcTo(y,S,y,C,T),e.arcTo(y,C,v,x,T),e.arcTo(v,x,v,b,T),e.arcTo(v,b,y,S,T)}e.closePath()}function Vu(e,t,n,r,i,a,o){let s=a*Math.PI/180,c=Math.sin(s),l=Math.cos(s),u=Math.abs(c)*.5,d=r,f=r*(1-u),p=a<0?d:f,m=a<0?f:d,h=i*Math.max(.3,Math.abs(l)),g=(i-h)/2,_=r/2,v=n+g,y=n+g+h,b=t+_-p/2,x=t+_+p/2,S=t+_-m/2,C=t+_+m/2,w=Math.hypot(S-b,y-v),T=Math.max(0,Math.min(o,w/2,p/2,m/2));if(e.beginPath(),T<=0)e.moveTo(b,v),e.lineTo(x,v),e.lineTo(C,y),e.lineTo(S,y);else{let t=(b+x)/2;e.moveTo(t,v),e.arcTo(x,v,C,y,T),e.arcTo(C,y,S,y,T),e.arcTo(S,y,b,v,T),e.arcTo(b,v,x,v,T)}e.closePath()}function Hu(e){return e?e.shadows&&e.shadows.length>0?e.shadows:e.shadow?[e.shadow]:[]:[]}function Uu(e){return e?{shadowColor:e.color,shadowBlur:e.blur,shadowOffsetX:e.offsetX,shadowOffsetY:e.offsetY,shadowOpacity:e.opacity}:{}}function $(e,t){if(e.length<=1)return t(Uu(e[0]),!0,null);let n=e.slice(0,-1),r=e[e.length-1];return(0,B.jsxs)(B.Fragment,{children:[n.map((e,n)=>t(Uu(e),!1,`extra-${n}`)),t(Uu(r),!0,null)]})}function Wu(e,t,n){if(t.length<=1){e.add(n(Uu(t[0]),!0));return}let r=t.slice(0,-1),i=t[t.length-1];for(let t of r)e.add(n(Uu(t),!1));e.add(n(Uu(i),!0))}function Gu(e,t,n,r){let i=t.shape;if(i===`line`||i===`arrow`)return!1;if(i===`rect`){let i=t.style?.radius??0,a=t.style?.radii,o=Math.max(0,a?.topLeft??i),s=Math.max(0,a?.topRight??i),c=Math.max(0,a?.bottomRight??i),l=Math.max(0,a?.bottomLeft??i),u=Math.min(n,r)/2,d={tl:Math.min(o,u),tr:Math.min(s,u),br:Math.min(c,u),bl:Math.min(l,u)};return e.beginPath(),e.moveTo(d.tl,0),e.lineTo(n-d.tr,0),d.tr>0&&e.arcTo(n,0,n,d.tr,d.tr),e.lineTo(n,r-d.br),d.br>0&&e.arcTo(n,r,n-d.br,r,d.br),e.lineTo(d.bl,r),d.bl>0&&e.arcTo(0,r,0,r-d.bl,d.bl),e.lineTo(0,d.tl),d.tl>0&&e.arcTo(0,0,d.tl,0,d.tl),e.closePath(),!0}if(i===`ellipse`){let i=n/2,a=r/2,o=n/2,s=r/2,c=Math.max(0,Math.min(.95,t.innerRatio??0));return qu(e,i,a,o,s,t.startAngle??0,t.sweepAngle??360,c),!0}if(i===`polygon`)return Ju(e,n/2,r/2,n/2,r/2,t.sides??6),!0;if(i===`star`){let i=Math.max(.1,Math.min(.9,t.innerRatio??.4));return Yu(e,n/2,r/2,n/2,r/2,t.starPoints??5,i),!0}if(i===`path`){let i=t.nodes??[];return!(t.closed??!1)||i.length<2?!1:(Xu(e,i,n,r,!0),!0)}return!1}function Ku(e){let[t,n]=(0,z.useState)(),[r,i]=(0,z.useState)(`loading`);return(0,z.useEffect)(()=>{if(!e){n(void 0),i(`loading`);return}let t=new Image,r=!1,a=()=>{r||(n(t),i(`loaded`))},o=()=>{r||(n(void 0),i(`error`))};return t.addEventListener(`load`,a),t.addEventListener(`error`,o),i(`loading`),t.src=e,()=>{r=!0,t.removeEventListener(`load`,a),t.removeEventListener(`error`,o)}},[e]),{image:t,status:r}}function qu(e,t,n,r,i,a,o,s){let c=Math.max(.01,r),l=Math.max(.01,i),u=c*s,d=l*s,f=Math.abs(o)>=359.999999,p=s>1e-6,m=(a-90)*Math.PI/180,h=m+o*Math.PI/180;if(e.beginPath(),f&&!p){e.ellipse(t,n,c,l,0,0,Math.PI*2),e.closePath();return}if(f&&p){e.ellipse(t,n,c,l,0,0,Math.PI*2,!1),e.moveTo(t+u,n),e.ellipse(t,n,u,d,0,0,Math.PI*2,!0),e.closePath();return}if(!p){e.moveTo(t,n),e.ellipse(t,n,c,l,0,m,h,!1),e.closePath();return}e.ellipse(t,n,c,l,0,m,h,!1),e.ellipse(t,n,u,d,0,h,m,!0),e.closePath()}function Ju(e,t,n,r,i,a){let o=Math.max(3,Math.min(12,Math.round(a)));e.beginPath();for(let a=0;a<o;a++){let s=-Math.PI/2+a*Math.PI*2/o,c=t+r*Math.cos(s),l=n+i*Math.sin(s);a===0?e.moveTo(c,l):e.lineTo(c,l)}e.closePath()}function Yu(e,t,n,r,i,a,o){let s=Math.max(3,Math.min(12,Math.round(a))),c=Math.max(.1,Math.min(.9,o)),l=r*c,u=i*c;e.beginPath();for(let a=0;a<s*2;a++){let o=-Math.PI/2+a*Math.PI/s,c=+(a%2==0),d=c===0?l:r,f=c===0?u:i,p=t+d*Math.cos(o),m=n+f*Math.sin(o);a===0?e.moveTo(p,m):e.lineTo(p,m)}e.closePath()}function Xu(e,t,n,r,i){if(t.length===0){e.beginPath();return}let a=e=>e.x*n,o=e=>e.y*r;e.beginPath(),e.moveTo(a(t[0]),o(t[0]));for(let i=1;i<t.length;i++){let s=t[i-1],c=t[i],l=s.handleOut,u=c.handleIn;if(l||u){let t=(s.x+(l?.x??0))*n,i=(s.y+(l?.y??0))*r,d=(c.x+(u?.x??0))*n,f=(c.y+(u?.y??0))*r;e.bezierCurveTo(t,i,d,f,a(c),o(c))}else e.lineTo(a(c),o(c))}if(i&&t.length>=2){let i=t[t.length-1],s=t[0],c=i.handleOut,l=s.handleIn;if(c||l){let t=(i.x+(c?.x??0))*n,u=(i.y+(c?.y??0))*r,d=(s.x+(l?.x??0))*n,f=(s.y+(l?.y??0))*r;e.bezierCurveTo(t,u,d,f,a(s),o(s))}e.closePath()}}function Zu(e,t,n,r){if(!e||e===`solid`||t<=0)return{};let i=typeof n==`number`&&Number.isFinite(n)&&n!==0?{dashOffset:n}:{},a=typeof r==`number`&&Number.isFinite(r)?Math.max(.5,Math.min(10,r)):2;return e===`dashed`?{dash:[t*3,t*a],...i}:{dash:[.01,t*a],lineCap:`round`,...i}}var Qu=1200,$u=(e,t)=>{let n=t?Math.min(Math.ceil(t),Qu):void 0,r=n?{width:n}:void 0;if(e.type===`image`)return Du(e.storagePath,r);if(e.type===`background`)return Du(e.image?.storagePath,r);if(e.type===`frame`)return Du(e.screen?.storagePath,r)};function ed(e,t,n,r,i,a=1,o=0,s=0){let c=(i===`cover`?Math.max(n/e,r/t):Math.min(n/e,r/t))*a,l=e*c,u=t*c;return{x:(n-l)/2+o*n,y:(r-u)/2+s*r,width:l,height:u}}function td(e,t,n,r,i=1,a=0,o=0){return ed(e.width,e.height,t,n,r,i,a,o)}var nd=(0,z.forwardRef)(function({layer:e,canvas:t,draggable:n=!1,effectivelyLocked:r,hiddenForEdit:i,devicePreset:a,clipShapeBinding:o,onSelect:s,onDragMove:c,onDragEnd:l,onTransform:u,onTransformEnd:d,onRequestFrameScreenUpload:f,onHoverChange:p,siblings:m},h){let g=he(e.anchors,t),{image:_}=Ku($u(e,g.width)),v=ru(e=>e.activeLocale),y=ru(e=>e.defaultLocale),b=iu(),x=e.type===`image`&&o!=null,S=g,C=(0,z.useRef)(null),w=e.type===`background`?e.image?.blur??0:0,T=e.type===`background`?e.image?.fit??null:null,E=e.type===`background`?e.image?.zoom??1:1,D=e.type===`background`?e.image?.tint??null:null,O=D&&D.amount>0?D.color:null,k=D&&D.amount>0?D.amount:0;(0,z.useEffect)(()=>{let e=C.current;e&&(w>0||k>0?e.cache():e.clearCache())},[w,O,k,_,T,E,S.width,S.height]);let A=(0,z.useRef)(null),j=e.type===`shape`?Math.max(0,e.style?.blur??0):0,ee=e.type===`shape`&&j>0&&e.shape===`ellipse`&&(e.sweepAngle??360)>=360&&(e.innerRatio??0)<=0&&(e.style?.stroke?.width??0)<=0&&gu(e.style?.fill)!==null,M=(0,z.useCallback)(e=>{A.current=e,typeof h==`function`?h(e):h&&(h.current=e)},[h]),N=e.type===`shape`?JSON.stringify({b:j,s:e.style,sh:e.shape,w:Math.round(S.width),h:Math.round(S.height),sa:e.startAngle,sw:e.sweepAngle,ir:e.innerRatio,sd:e.sides,sp:e.starPoints,cl:e.closed,nd:e.nodes}):``,P=(0,z.useRef)(null),F=e.type===`text`?ou(e,v,y):void 0,I=e.type===`text`?e.color:`#000`,te=(0,z.useCallback)(e=>{P.current=e,typeof h==`function`?h(e):h&&(h.current=e)},[h]),ne=e.type===`text`&&le(me(e.content,v)),re=!!F&&F.length>0&&!ne,ie=re?`${JSON.stringify(F)}|${I}`:``,ae=(0,z.useRef)(!1);if((0,z.useEffect)(()=>{let t=P.current;t&&(re&&F?(t.charRenderFunc(uu(t,F,I)),ae.current=!0):(t.charRenderFunc(null),ae.current&&e.type===`text`&&!e.fill&&t.fill(I),ae.current=!1),t.getLayer()?.batchDraw())},[ie,re,F,I,e]),(0,z.useEffect)(()=>{let e=A.current;e&&(j>0&&!ee?(e.filters(hu),e.setAttr(`blurRadius`,j),e.cache({offset:Math.ceil(j*2)+2})):(e.clearCache(),e.filters([])),e.getLayer()?.batchDraw())},[j,N,ee]),e.visible===!1||i)return null;let oe=e.rotation??0,se=e.style?.opacity??1,ce=e.style?.blendMode,pe=r??e.locked===!0,L={id:e.id,name:`layer-${e.id}`,x:S.x,y:S.y,rotation:oe,opacity:se,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,globalCompositeOperation:ce&&ce!==`normal`?ce:void 0,draggable:n&&!pe&&e.type!==`background`&&ru.getState().calloutMode===`idle`&&ru.getState().cropModeLayerId!==e.id,listening:!pe&&ru.getState().cropModeLayerId!==e.id,onMouseDown:t=>{ru.getState().calloutMode===`idle`&&(t.cancelBubble=!0,s?.(e.id,t.evt.shiftKey))},onDragMove:t=>c?.(e.id,t.target),onDragEnd:t=>l?.(e.id,t.target),onTransform:t=>u?.(e.id,t.target),onTransformEnd:t=>d?.(e.id,t.target),onMouseEnter:()=>p?.(e.id),onMouseLeave:()=>p?.(null)};if(e.type===`background`){let t=yu(e.fill,S.width,S.height),n=e.image&&_?e.image.fit:null,r=e.image?.zoom??1,i=e.image?.offsetX??0,a=e.image?.offsetY??0,o=e.image?.opacity??1,s=_&&(n===`cover`||n===`contain`)?td(_,S.width,S.height,n,r,i,a):null,c=e.image?.overlay,l=[],u={};if(w>0&&(l.push(J.Filters.Blur),u.blurRadius=w),O&&k>0){let{r:e,g:t,b:n}=ud(O);l.push(J.Filters.RGBA),u.red=e,u.green=t,u.blue=n,u.alpha=Math.min(1,Math.max(0,k))}return(0,B.jsxs)(Ts,{ref:h,...L,width:S.width,height:S.height,clipX:0,clipY:0,clipWidth:S.width,clipHeight:S.height,children:[(0,B.jsx)(Es,{width:S.width,height:S.height,...t}),_&&n===`tile`&&(0,B.jsx)(`Rect`,{width:S.width,height:S.height,fillPatternImage:_,fillPatternRepeat:`repeat`,fillPatternScale:{x:r,y:r},fillPatternOffset:{x:-i*S.width,y:-a*S.height},opacity:o,listening:!1}),_&&s&&(0,B.jsx)(`Image`,{ref:C,image:_,x:s.x,y:s.y,width:s.width,height:s.height,filters:l.length?l:void 0,...u,opacity:o,listening:!1}),_&&c&&c.opacity>0&&(0,B.jsx)(`Rect`,{width:S.width,height:S.height,fill:c.color,opacity:c.opacity,listening:!1})]})}if(e.type===`shape`){let t=yu(e.style?.fill,S.width,S.height),n=e.style?.stroke,r=Hu(e.style),i=Zu(n?.dash,n?.width??0,n?.dashOffset,n?.dashGap);if(e.vectorPaths&&e.vectorPaths.length>0){let t=e.style?.fill,[n,i]=e.vectorViewBox??[24,24],a=e.vectorPaths,o=e.vectorFillRule??`nonzero`;return $(r,(e,r,s)=>(0,B.jsx)(Ms,{ref:r?M:void 0,...L,listening:r?L.listening:!1,x:S.x,y:S.y,width:S.width,height:S.height,...e,sceneFunc:e=>{yd(e,S.width,S.height,a,n,i,t,o)}},s??void 0))}if(e.iconPaths&&e.iconPaths.length>0){let t=gu(e.style?.fill)??`#3B82F6`,i=e.iconColor??`#ffffff`,a=e.style?.radius??Math.min(S.width,S.height)*.28,o=n?.width??2,s=e.iconPaths;return $(r,(e,n,r)=>(0,B.jsx)(Ms,{ref:n?M:void 0,...L,listening:n?L.listening:!1,x:S.x,y:S.y,width:S.width,height:S.height,...e,sceneFunc:e=>{bd(e,S.width,S.height,s,t,i,a,o)}},r??void 0))}if(e.shape===`ellipse`){let a=e.startAngle??0,o=Math.max(0,Math.min(360,e.sweepAngle??360)),s=Math.max(0,Math.min(.95,e.innerRatio??0)),c=n?.position??`center`,l=n?.width??0,u=o>=360&&s<=0,d=l>0&&n!=null&&c!==`center`;if(u&&!d){if(ee){let t=gu(e.style?.fill)??`#000`;return(0,B.jsx)(Ms,{ref:M,...L,x:S.x,y:S.y,width:S.width,height:S.height,sceneFunc:_u(S.width,S.height,t,j)})}return $(r,(e,r,a)=>(0,B.jsx)(Ds,{ref:r?M:void 0,...L,listening:r?L.listening:!1,x:S.x+S.width/2,y:S.y+S.height/2,radiusX:S.width/2,radiusY:S.height/2,...t,...Z(xu(n?.color),S.width,S.height),strokeWidth:n?.width,...i,...e},a??void 0))}let f=S.width/2,p=S.height/2,m=S.width/2,h=S.height/2;if(d){let e=c===`inside`?-1:1,u=Math.max(.01,f+e*l/2),d=Math.max(.01,p+e*l/2);return(0,B.jsxs)(Ts,{ref:M,...L,x:S.x+S.width/2,y:S.y+S.height/2,offsetX:S.width/2,offsetY:S.height/2,width:S.width,height:S.height,children:[$(r,(e,n,r)=>(0,B.jsx)(Ms,{width:S.width,height:S.height,sceneFunc:(e,t)=>{qu(e,m,h,f,p,a,o,s),e.fillStrokeShape(t)},...t,...e},r??void 0)),(0,B.jsx)(Ms,{width:S.width,height:S.height,sceneFunc:(e,t)=>{qu(e,m,h,u,d,a,o,s),e.fillStrokeShape(t)},fillEnabled:!1,...Z(xu(n.color),S.width,S.height),strokeWidth:l,...i,listening:!1})]})}return $(r,(e,r,c)=>(0,B.jsx)(Ms,{ref:r?M:void 0,...L,listening:r?L.listening:!1,x:S.x+S.width/2,y:S.y+S.height/2,offsetX:S.width/2,offsetY:S.height/2,width:S.width,height:S.height,sceneFunc:(e,t)=>{qu(e,m,h,f,p,a,o,s),e.fillStrokeShape(t)},...t,...Z(xu(n?.color),S.width,S.height),strokeWidth:n?.width,...i,...e},c??void 0))}if(e.shape===`line`){let e=n?.width??2,t=Zu(n?.dash,e,n?.dashOffset,n?.dashGap);return $(r,(r,i,a)=>(0,B.jsx)(Os,{ref:i?M:void 0,...L,listening:i?L.listening:!1,width:S.width,height:S.height,points:[0,S.height/2,S.width,S.height/2],...Z(xu(n?.color)??{type:`solid`,value:`#0F172A`},S.width,S.height),strokeWidth:e,lineCap:t.lineCap??n?.lineCap??`round`,dash:t.dash,hitStrokeWidth:Math.max(12,e+10),...r},a??void 0))}if(e.shape===`arrow`){let t=n?.width??2,i=typeof n?.color==`string`?n.color:n?.color?.type===`solid`?n.color.value:n?.color?.stops?.[0]?.color??`#0F172A`,a=Math.max(4,t*3*(e.arrowHead??1)),o=Zu(n?.dash,t,n?.dashOffset,n?.dashGap),s=e.arrowAt??`end`;return $(r,(e,r,c)=>(0,B.jsx)(js,{ref:r?M:void 0,...L,listening:r?L.listening:!1,width:S.width,height:S.height,points:[0,S.height/2,S.width,S.height/2],...Z(xu(n?.color)??{type:`solid`,value:`#0F172A`},S.width,S.height),strokeWidth:t,fill:i,pointerLength:a,pointerWidth:a,pointerAtBeginning:s===`start`||s===`both`,pointerAtEnding:s===`end`||s===`both`,lineCap:o.lineCap??`butt`,lineJoin:n?.lineJoin??`round`,hitStrokeWidth:Math.max(12,t+10),dash:o.dash,...e},c??void 0))}if(e.shape===`polygon`){let a=Math.max(3,Math.min(12,e.sides??6)),o=S.width/2,s=S.height/2,c=S.width/2,l=S.height/2,u=n?.position??`center`,d=n?.width??0;if(d>0&&n!=null&&u!==`center`){let e=u===`inside`?-1:1,f=Math.max(.01,o+e*d/2),p=Math.max(.01,s+e*d/2);return(0,B.jsxs)(Ts,{ref:M,...L,x:S.x+S.width/2,y:S.y+S.height/2,offsetX:S.width/2,offsetY:S.height/2,width:S.width,height:S.height,children:[$(r,(e,n,r)=>(0,B.jsx)(Ms,{width:S.width,height:S.height,sceneFunc:(e,t)=>{Ju(e,c,l,o,s,a),e.fillStrokeShape(t)},...t,...e},r??void 0)),(0,B.jsx)(Ms,{width:S.width,height:S.height,sceneFunc:(e,t)=>{Ju(e,c,l,f,p,a),e.fillStrokeShape(t)},fillEnabled:!1,...Z(xu(n.color),S.width,S.height),strokeWidth:d,lineJoin:n?.lineJoin,...i,listening:!1})]})}return $(r,(e,r,u)=>(0,B.jsx)(Ms,{ref:r?M:void 0,...L,listening:r?L.listening:!1,x:S.x+S.width/2,y:S.y+S.height/2,offsetX:S.width/2,offsetY:S.height/2,width:S.width,height:S.height,sceneFunc:(e,t)=>{Ju(e,c,l,o,s,a),e.fillStrokeShape(t)},...t,...Z(xu(n?.color),S.width,S.height),strokeWidth:n?.width,lineJoin:n?.lineJoin,...i,...e},u??void 0))}if(e.shape===`star`){let a=Math.max(3,Math.min(12,e.starPoints??5)),o=Math.max(.1,Math.min(.9,e.innerRatio??.4)),s=S.width/2,c=S.height/2,l=S.width/2,u=S.height/2,d=n?.position??`center`,f=n?.width??0;if(f>0&&n!=null&&d!==`center`){let e=d===`inside`?-1:1,p=Math.max(.01,s+e*f/2),m=Math.max(.01,c+e*f/2);return(0,B.jsxs)(Ts,{ref:M,...L,x:S.x+S.width/2,y:S.y+S.height/2,offsetX:S.width/2,offsetY:S.height/2,width:S.width,height:S.height,children:[$(r,(e,n,r)=>(0,B.jsx)(Ms,{width:S.width,height:S.height,sceneFunc:(e,t)=>{Yu(e,l,u,s,c,a,o),e.fillStrokeShape(t)},...t,...e},r??void 0)),(0,B.jsx)(Ms,{width:S.width,height:S.height,sceneFunc:(e,t)=>{Yu(e,l,u,p,m,a,o),e.fillStrokeShape(t)},fillEnabled:!1,...Z(xu(n.color),S.width,S.height),strokeWidth:f,lineJoin:n?.lineJoin,...i,listening:!1})]})}return $(r,(e,r,d)=>(0,B.jsx)(Ms,{ref:r?M:void 0,...L,listening:r?L.listening:!1,x:S.x+S.width/2,y:S.y+S.height/2,offsetX:S.width/2,offsetY:S.height/2,width:S.width,height:S.height,sceneFunc:(e,t)=>{Yu(e,l,u,s,c,a,o),e.fillStrokeShape(t)},...t,...Z(xu(n?.color),S.width,S.height),strokeWidth:n?.width,lineJoin:n?.lineJoin,...i,...e},d??void 0))}if(e.shape===`path`){let a=e.nodes??[],o=e.closed??!1,s=n?.width??0,c=xu(n?.color)??{type:`solid`,value:`#0F172A`},l=n?.position??`center`;if(o&&s>0&&n!=null&&l!==`center`){let e=l===`inside`?-1:1,u=S.width>0?(S.width+e*s)/S.width:1,d=S.height>0?(S.height+e*s)/S.height:1,f=a.map(e=>({x:.5+(e.x-.5)*u,y:.5+(e.y-.5)*d,handleIn:e.handleIn?{x:e.handleIn.x*u,y:e.handleIn.y*d}:void 0,handleOut:e.handleOut?{x:e.handleOut.x*u,y:e.handleOut.y*d}:void 0}));return(0,B.jsxs)(Ts,{ref:M,...L,width:S.width,height:S.height,children:[$(r,(e,n,r)=>(0,B.jsx)(Ms,{width:S.width,height:S.height,sceneFunc:(e,t)=>{Xu(e,a,S.width,S.height,o),e.fillStrokeShape(t)},...t,...e},r??void 0)),(0,B.jsx)(Ms,{width:S.width,height:S.height,sceneFunc:(e,t)=>{Xu(e,f,S.width,S.height,o),e.fillStrokeShape(t)},hitStrokeWidth:Math.max(12,s+10),fillEnabled:!1,...Z(c,S.width,S.height),strokeWidth:s,lineCap:n?.lineCap??`round`,lineJoin:n?.lineJoin??`round`,...i,listening:!1})]})}return $(r,(e,r,l)=>(0,B.jsx)(Ms,{ref:r?M:void 0,...L,listening:r?L.listening:!1,width:S.width,height:S.height,sceneFunc:(e,t)=>{Xu(e,a,S.width,S.height,o),e.fillStrokeShape(t)},hitStrokeWidth:Math.max(12,s+10),...o?t:{fillEnabled:!1},...Z(c,S.width,S.height),strokeWidth:s,lineCap:n?.lineCap??`round`,lineJoin:n?.lineJoin??`round`,...i,...e},l??void 0))}let a=e.shape===`rect`?e.style?.radius??0:0,o=e.shape===`rect`?e.style?.radii:void 0,s=o?[o.topLeft??a,o.topRight??a,o.bottomRight??a,o.bottomLeft??a]:a,c=n?.position??`center`,l=n?.width??0;if(e.shape===`rect`&&n&&l>0&&c!==`center`){let e=c===`inside`?l/2:-l/2,a=e=>Math.max(0,c===`inside`?e-l/2:e+l/2),o=Array.isArray(s)?s.map(a):a(s);return(0,B.jsxs)(Ts,{ref:M,...L,width:S.width,height:S.height,children:[$(r,(e,n,r)=>(0,B.jsx)(Es,{x:0,y:0,width:S.width,height:S.height,cornerRadius:s,...t,...e},r??void 0)),(0,B.jsx)(Es,{x:e,y:e,width:S.width-e*2,height:S.height-e*2,cornerRadius:o,fillEnabled:!1,...Z(xu(n.color),S.width-e*2,S.height-e*2),strokeWidth:l,lineJoin:n?.lineJoin,...i,listening:!1})]})}return $(r,(e,r,a)=>(0,B.jsx)(Es,{ref:r?M:void 0,...L,listening:r?L.listening:!1,width:S.width,height:S.height,cornerRadius:s,...t,...Z(xu(n?.color),S.width,S.height),strokeWidth:n?.width,lineJoin:n?.lineJoin,...i,...e},a??void 0))}if(e.type===`text`){let n=xe(me(e.content,v),e.textTransform),r=_e(e.align,b),i=ve(e.fontWeight,e.fontStyle),a=Hu(e.style),o=e.style?.stroke,s=e.fitMode===`auto`,c=s?ge(e,v,t.width):null,l=c?c.width:S.width,u=c?c.height:S.height,d=e.anchors.left&&e.anchors.left.type!==`auto`?e.anchors.left.align:void 0,f=e.anchors.top&&e.anchors.top.type!==`auto`?e.anchors.top.align:void 0,p=s?S.x+(d===`center`?(S.width-l)/2:d===`end`?S.width-l:0):S.x,m=s?S.y+(f===`center`?(S.height-u)/2:f===`end`?S.height-u:0):S.y,h=e.fill?yu(e.fill,l,u):{fill:e.color},g=be(e,l,u,v),_=c?.wrapped?`word`:s||e.fitMode===`clip`?`none`:`word`;return $(a,(t,a,s)=>(0,B.jsx)(As,{ref:a?te:void 0,...L,listening:a?L.listening:!1,x:p,y:m,width:l,height:u,text:n,fontFamily:fe(e.fontFamily,v),fontSize:g,fontStyle:i,lineHeight:ue(n,e.lineHeight),letterSpacing:de(n,e.letterSpacing),align:r,verticalAlign:`top`,...h,wrap:_,ellipsis:e.fitMode===`clip`,...Z(xu(o?.color),l,u),strokeWidth:o?.width,fillAfterStrokeEnabled:o?.width?!0:void 0,...t},s??void 0))}return e.type===`image`?(0,B.jsx)(fd,{layer:e,image:_,rect:S,commonShape:L,isBoundToClipShape:x,clipShapeBinding:o,forwardedRef:h}):e.type===`group`?null:e.type===`callout`?(0,B.jsx)(id,{layer:e,canvas:t,rect:S,siblings:m??[],commonShape:L,forwardedRef:h}):(0,B.jsx)(pd,{layer:e,rect:S,devicePreset:a,commonShape:L,screenImage:_,forwardedRef:h,onRequestFrameScreenUpload:f})}),rd=(0,z.memo)(nd);function id({layer:e,canvas:t,rect:n,siblings:r,commonShape:i,forwardedRef:a}){let o=r.find(t=>t.id===e.sourceLayerId),s=o&&o.type!==`callout`&&o.type!==`group`&&o.type!==`background`;if(!o||!s)return(0,B.jsxs)(Ts,{...i,ref:a,width:n.width,height:n.height,children:[(0,B.jsx)(Ms,{width:n.width,height:n.height,listening:!1,sceneFunc:(t,r)=>{ad(t,e,n.width,n.height),t.setAttr(`strokeStyle`,`rgba(0,0,0,0.3)`),t.setAttr(`lineWidth`,1),t.setAttr(`lineDash`,[4,4]),t.stroke(),t.fillStrokeShape(r)}}),(0,B.jsx)(Es,{x:0,y:0,width:n.width,height:n.height,fill:`rgba(0,0,0,0)`})]});let c=he(o.anchors,t),l=c.x+e.sourceRect.x/100*c.width,u=c.y+e.sourceRect.y/100*c.height,d=Math.max(1,e.sourceRect.width/100*c.width),f=n.width/d,p=e.leader,m=null;if(p?.enabled){let t=p.from&&p.to?{from:p.from,to:p.to}:cd(c,n,e.shape);m={from:{x:t.from.x-n.x,y:t.from.y-n.y},to:{x:t.to.x-n.x,y:t.to.y-n.y}}}let h=p?xu(p.stroke):void 0,g=h?.type===`solid`?h.value:h?.stops?.[0]?.color??`#0F172A`,_=p?.width??2,v=Math.max(4,_*3),y=Math.max(4,_*2.5),b=Hu(e.style),x=e=>{if(typeof a==`function`?a(e):a&&`current`in a&&(a.current=e),!e)return;let t=()=>(e.children??[]).find(e=>e.attrs?.name===`callout-bbox-target`),n=J.Container.prototype.getClientRect.bind(e);e.getClientRect=e=>{let r=t();return r?r.getClientRect(e):n(e)}};return(0,B.jsxs)(Ts,{...i,ref:x,width:n.width,height:n.height,children:[$(b,(t,r,i)=>(0,B.jsx)(Ms,{listening:!1,fill:`#000`,sceneFunc:(t,r)=>{ad(t,e,n.width,n.height),t.fillStrokeShape(r)},...t},i??`primary`)),p?.enabled&&m&&p.style===`line`&&(0,B.jsx)(`Line`,{points:[m.from.x,m.from.y,m.to.x,m.to.y],...Z(h,n.width,n.height),strokeWidth:_,listening:!1}),p?.enabled&&m&&p.style===`arrow`&&(0,B.jsx)(`Arrow`,{points:[m.from.x,m.from.y,m.to.x,m.to.y],...Z(h,n.width,n.height),strokeWidth:_,fill:g,pointerLength:v,pointerWidth:y,listening:!1}),p?.enabled&&m&&p.style===`curve`&&(0,B.jsx)(`Shape`,{...Z(h,n.width,n.height),strokeWidth:_,listening:!1,sceneFunc:(e,t)=>{let n=m.from,r=m.to,i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a)||1,s=o*.2,c=-a/o*s,l=i/o*s,u=(n.x+r.x)/2,d=(n.y+r.y)/2;e.beginPath(),e.moveTo(n.x,n.y),e.quadraticCurveTo(u+c,d+l,r.x,r.y),e.strokeShape(t)}}),(0,B.jsx)(Ts,{width:n.width,height:n.height,listening:!1,clipFunc:t=>{ad(t,e,n.width,n.height)},children:(0,B.jsx)(Ts,{x:-l*f,y:-u*f,scaleX:f,scaleY:f,listening:!1,children:(0,B.jsx)(rd,{layer:o,canvas:t,siblings:r,draggable:!1})})}),(()=>{let t=e.style?.stroke,r=xu(t?.color);return(t?.width??0)>0&&r?(0,B.jsx)(Ms,{listening:!1,sceneFunc:(t,r)=>{ad(t,e,n.width,n.height),t.fillStrokeShape(r)},...Z(r,n.width,n.height),strokeWidth:t.width,...Zu(t.dash,t.width??0,t.dashOffset,t.dashGap)}):null})(),(0,B.jsx)(Es,{name:`callout-bbox-target`,x:0,y:0,width:n.width,height:n.height,fill:`rgba(0,0,0,0)`})]})}function ad(e,t,n,r){if(t.shape===`ellipse`){let t=Math.min(n,r)/2;e.beginPath(),e.ellipse(n/2,r/2,t,t,0,0,Math.PI*2),e.closePath();return}xd(e,0,0,n,r,t.shape===`pill`?Math.min(n,r)/2:Math.max(0,t.cornerRadius??8))}function od(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i);if(a<1e-6)return{x:e.x,y:e.y};let o=r/a,s=i/a,c=n.width/2,l=n.height/2,u=Math.abs(o)>1e-6?c/Math.abs(o):1/0,d=Math.abs(s)>1e-6?l/Math.abs(s):1/0,f=Math.min(u,d);return{x:e.x+o*f,y:e.y+s*f}}function sd(e,t,n){let r=n.x+n.width/2,i=n.y+n.height/2,a=Math.min(n.width,n.height)/2,o=t.x-e.x,s=t.y-e.y,c=Math.hypot(o,s);return c<1e-6||a<1e-6?{x:r,y:i}:{x:r+a*o/c,y:i+a*s/c}}function cd(e,t,n){let r={x:e.x+e.width/2,y:e.y+e.height/2},i={x:t.x+t.width/2,y:t.y+t.height/2};return{from:od(r,i,e),to:n===`ellipse`?sd(i,r,t):od(i,r,t)}}function ld(e){let t=[],n={};if(!e)return{filters:t,attrs:n};e.brightness&&e.brightness!==0&&(t.push(J.Filters.Brighten),n.brightness=e.brightness),e.contrast&&e.contrast!==0&&(t.push(J.Filters.Contrast),n.contrast=e.contrast);let r=e.hue??0,i=e.saturation??0;if((r!==0||i!==0)&&(t.push(J.Filters.HSL),n.hue=r,n.saturation=i),e.blur&&e.blur>0&&(t.push(J.Filters.Blur),n.blurRadius=e.blur),e.grayscale&&t.push(J.Filters.Grayscale),e.invert&&t.push(J.Filters.Invert),e.tint&&e.tint.amount>0){let{r,g:i,b:a}=ud(e.tint.color);t.push(J.Filters.RGBA),n.red=r,n.green=i,n.blue=a,n.alpha=Math.min(1,Math.max(0,e.tint.amount))}return{filters:t,attrs:n}}function ud(e){let t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec((e??``).trim());if(!t)return{r:0,g:0,b:0};let n=t[1],r=n.length===3?n.split(``).map(e=>e+e).join(``):n,i=parseInt(r,16);return{r:i>>16&255,g:i>>8&255,b:i&255}}function dd(e){let t=Math.max(1,Math.ceil(e.rectWidth)),n=Math.max(1,Math.ceil(e.rectHeight));if(t<=1&&n<=1)return null;let r=document.createElement(`canvas`);r.width=t,r.height=n;let i=r.getContext(`2d`);return i?(i.save(),e.imgRadius>0&&(xd(i,0,0,e.rectWidth,e.rectHeight,e.imgRadius),i.clip()),i.translate(e.drawX+e.flipOffsetX,e.drawY+e.flipOffsetY),i.scale(e.flipScaleX,e.flipScaleY),e.cropAttr?i.drawImage(e.image,e.cropAttr.x,e.cropAttr.y,e.cropAttr.width,e.cropAttr.height,0,0,e.drawW,e.drawH):i.drawImage(e.image,0,0,e.drawW,e.drawH),i.restore(),r):null}function fd({layer:e,image:t,rect:n,commonShape:r,isBoundToClipShape:i,clipShapeBinding:a,forwardedRef:o}){let s=(0,z.useRef)(null),{filters:c,attrs:l}=ld(e.adjust),u=c.map(e=>typeof e==`function`?e.name:String(e)).join(`|`),d=ru(e=>e.cropModeLayerId)===e.id,f=(0,z.useMemo)(()=>{if(!t||!e.crop||d)return;let n=Math.max(0,Math.min(.99,e.crop.top??0)),r=Math.max(0,Math.min(.99,e.crop.right??0)),i=Math.max(0,Math.min(.99,e.crop.bottom??0)),a=Math.max(0,Math.min(.99,e.crop.left??0)),o=Math.max(.001,1-a-r),s=Math.max(.001,1-n-i);if(!(n===0&&r===0&&i===0&&a===0))return{x:a*t.width,y:n*t.height,width:o*t.width,height:s*t.height}},[t,e.crop,d]);if((0,z.useEffect)(()=>{let e=s.current;e&&(c.length>0&&t?e.cache():e.clearCache())},[t,n.width,n.height,u,c.length,f?.x,f?.y,f?.width,f?.height]),!t)return(0,B.jsx)(Es,{ref:o,...r,width:n.width,height:n.height,fill:`#E4E4E7`,stroke:`#A1A1AA`,strokeWidth:2,dash:[12,8]});let p=e.fit,m=Math.max(.01,e.zoom??1),h=e.offsetX??0,g=e.offsetY??0,_=e.flipX===!0,v=e.flipY===!0,y=Math.tan((e.skewX??0)*Math.PI/180),b=Math.tan((e.skewY??0)*Math.PI/180),x=e.tiltY??0,S=e.tiltX??0,C=Math.abs(x)>.01||Math.abs(S)>.01,w=f?.width??t.width,T=f?.height??t.height,E=0,D=0,O=n.width,k=n.height;if(p===`cover`||p===`contain`){let e=ed(w,T,n.width,n.height,p,m,h,g);E=e.x,D=e.y,O=e.width,k=e.height}let A=_?-1:1,j=v?-1:1,ee=_?O:0,M=v?k:0;if(i&&a){let i=(e.rotation??0)*Math.PI/180,o=a.rotation*Math.PI/180,u=a.rect;return(0,B.jsxs)(Ts,{...r,width:n.width,height:n.height,skewX:y,skewY:b,children:[(0,B.jsxs)(Ts,{width:n.width,height:n.height,listening:!1,clipFunc:e=>{let t=e;t.save(),i&&t.rotate(-i),t.translate(-n.x,-n.y),t.translate(u.x,u.y),o&&t.rotate(o),Gu(t,a.shape,u.width,u.height),t.restore()},children:[C?(0,B.jsx)(Ms,{x:E+ee,y:D+M,width:O,height:k,scaleX:A,scaleY:j,listening:!1,sceneFunc:(e,n)=>{Pu(e,t,n.width(),n.height(),S,x,f)}}):(0,B.jsx)(ks,{ref:s,image:t,x:E+ee,y:D+M,width:O,height:k,scaleX:A,scaleY:j,crop:f,filters:c.length>0?c:void 0,...l,listening:!1}),e.overlay&&e.overlay.opacity>0&&(0,B.jsx)(`Rect`,{x:0,y:0,width:n.width,height:n.height,fill:e.overlay.color,opacity:e.overlay.opacity,globalCompositeOperation:`source-atop`,listening:!1})]}),(0,B.jsx)(Es,{x:0,y:0,width:n.width,height:n.height,fill:`rgba(0,0,0,0)`})]})}let N=e.style?.stroke,P=Hu(e.style),F=Math.max(0,e.style?.radius??0),I=N?.width??0,te=Zu(N?.dash,I,N?.dashOffset,N?.dashGap),ne=N!=null&&I>0,re=P.length>0,ie=e.overlay!=null&&e.overlay.opacity>0;return F>0||m!==1||h!==0||g!==0||p===`contain`||_||v||C||ne||re||ie?(0,B.jsxs)(Ts,{ref:o,...r,width:n.width,height:n.height,skewX:y,skewY:b,children:[re&&C&&$(P,(e,t,r)=>(0,B.jsx)(`Shape`,{width:n.width,height:n.height,sceneFunc:(e,t)=>{zu(e,0,0,n.width,n.height,S,x,F),e.fillStrokeShape(t)},fill:`#000`,...e,listening:!1},r??void 0)),re&&!C&&$(P,(e,r,i)=>(0,B.jsx)(`Shape`,{width:n.width,height:n.height,...e,listening:!1,sceneFunc:e=>{let r=dd({image:t,rectWidth:n.width,rectHeight:n.height,drawX:E,drawY:D,drawW:O,drawH:k,flipScaleX:A,flipScaleY:j,flipOffsetX:ee,flipOffsetY:M,cropAttr:f,imgRadius:F});if(!r)return;let i=e;i.drawImage(r,0,0),i.shadowColor=`transparent`,i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0,i.globalCompositeOperation=`destination-out`,i.drawImage(r,0,0)}},i??void 0)),(0,B.jsxs)(Ts,{width:n.width,height:n.height,clipFunc:e=>{C?zu(e,0,0,n.width,n.height,S,x,F):xd(e,0,0,n.width,n.height,F)},children:[C?(0,B.jsx)(Ms,{x:E+ee,y:D+M,width:O,height:k,scaleX:A,scaleY:j,listening:!1,sceneFunc:(e,n)=>{Pu(e,t,n.width(),n.height(),S,x,f)}}):(0,B.jsx)(ks,{ref:s,image:t,x:E+ee,y:D+M,width:O,height:k,scaleX:A,scaleY:j,crop:f,filters:c.length>0?c:void 0,...l,listening:!1}),e.overlay&&e.overlay.opacity>0&&(0,B.jsx)(`Rect`,{x:0,y:0,width:n.width,height:n.height,fill:e.overlay.color,opacity:e.overlay.opacity,globalCompositeOperation:`source-atop`,listening:!1})]}),(0,B.jsx)(Es,{x:0,y:0,width:n.width,height:n.height,fill:`rgba(0,0,0,0)`}),ne&&C&&(0,B.jsx)(`Shape`,{width:n.width,height:n.height,sceneFunc:(e,t)=>{zu(e,0,0,n.width,n.height,S,x,F),e.fillStrokeShape(t)},fillEnabled:!1,...Z(xu(N.color),n.width,n.height),strokeWidth:I,...te,listening:!1}),ne&&!C&&(0,B.jsx)(`Rect`,{x:0,y:0,width:n.width,height:n.height,cornerRadius:F,fillEnabled:!1,...Z(xu(N.color),n.width,n.height),strokeWidth:I,...te,listening:!1})]}):(0,B.jsx)(ks,{ref:e=>{s.current=e,typeof o==`function`?o(e):o&&(o.current=e)},...r,image:t,width:n.width,height:n.height,skewX:y,skewY:b,crop:f,filters:c.length>0?c:void 0,...l})}function pd({layer:e,rect:t,devicePreset:n,commonShape:r,screenImage:i,forwardedRef:a,onRequestFrameScreenUpload:o}){let s=Su(t.width,t.height,n),c=Math.max(0,s.chassisRadius-s.inset),l=e.style,u=yu(l?.fill??{type:`solid`,value:`#0F172A`},t.width,t.height),d=l?.stroke?.width??0,f=d?{...Z(xu(l.stroke.color),t.width,t.height),strokeWidth:d}:null,p=e.screenFill??{type:`solid`,value:`#F4F4F5`},m=Math.max(0,t.width-s.inset*2),h=Math.max(0,t.height-s.inset*2),g=yu(p,m,h),_=Hu(l),v=Math.tan((e.skewX??0)*Math.PI/180),y=Math.tan((e.skewY??0)*Math.PI/180),b=e.flipX===!0,x=e.flipY===!0,S=e.tiltX??0,C=e.tiltY??0,w=Math.abs(S)>.01||Math.abs(C)>.01,T=e.screen,E=T?.fit??`cover`,D=Math.max(.01,T?.zoom??1),O=T?.offsetX??0,k=T?.offsetY??0,A=(0,z.useMemo)(()=>{if(!i||!T?.crop)return;let e=Math.max(0,Math.min(.99,T.crop.top??0)),t=Math.max(0,Math.min(.99,T.crop.right??0)),n=Math.max(0,Math.min(.99,T.crop.bottom??0)),r=Math.max(0,Math.min(.99,T.crop.left??0));if(e===0&&t===0&&n===0&&r===0)return;let a=Math.max(.001,1-r-t),o=Math.max(.001,1-e-n);return{x:r*i.width,y:e*i.height,width:a*i.width,height:o*i.height}},[i,T?.crop]),j=A?.width??i?.width??0,ee=A?.height??i?.height??0,M=0,N=0,P=m,F=h;if(i&&(E===`cover`||E===`contain`)){let e=ed(j,ee,m,h,E,D,O,k);M=e.x,N=e.y,P=e.width,F=e.height}let I=ld(T?.adjust),te=(0,z.useRef)(null),ne=I.filters.map(e=>typeof e==`function`?e.name:String(e)).join(`|`);(0,z.useEffect)(()=>{let e=te.current;e&&(I.filters.length>0&&i?e.cache():e.clearCache())},[i,P,F,ne,I.filters.length,A?.x,A?.y,A?.width,A?.height]);let re=b?-1:1,ie=x?-1:1,ae=b?t.width:0,oe=x?t.height:0,se=n?.key.endsWith(`-landscape`)||(n?.form_factor?.includes(`landscape`)??!1)?`landscape`:`portrait`,ce=n?.key.replace(/-landscape$/,``)??``,le=n?.real_frame_color_options??null,ue=le&&le.length>0?le.find(t=>t.slug===e.realFrameColor)?.slug??le[0].slug:void 0,de=n?.real_frame_screen_rect?.[se]??null,fe=e.realFrameEnabled===!0&&n?.has_real_frame===!0&&(!w||Mu(S,C))&&de!=null&&ue!=null&&ce!==``,{image:pe,status:L}=Ku(fe?`/device-frames/${ce}/${ue}/${se}.png`:void 0),me=fe&&L!==`error`,he=pe?.naturalWidth||de?.frame_w||n?.export_w||1,ge=pe?.naturalHeight||de?.frame_h||n?.export_h||1,_e=me?t.width/he:1,ve=me?t.height/ge:1,ye=de?de.x*_e:0,be=de?de.y*ve:0,xe=de?de.width*_e:0,R=de?de.height*ve:0,Se=de?de.radius*Math.min(_e,ve):0,Ce=0,we=0,Te=xe,Ee=R;if(me&&i&&(E===`cover`||E===`contain`)){let e=ed(j,ee,xe,R,E,D,O,k);Ce=e.x,we=e.y,Te=e.width,Ee=e.height}let De=(0,z.useRef)(null);if((0,z.useEffect)(()=>{if(!me)return;let e=De.current;e&&(I.filters.length>0&&i?e.cache():e.clearCache())},[me,i,Te,Ee,ne,I.filters.length,A?.x,A?.y,A?.width,A?.height]),me&&w){let e=gd({layerWidth:t.width,layerHeight:t.height,frameImage:pe,screenImage:i,screenFillColor:p,screenRect:{x:ye,y:be,width:xe,height:R,radius:Se},screenDraw:{x:Ce,y:we,width:Te,height:Ee},screenCrop:A,statusBarOverlay:T?.statusBarOverlay});return(0,B.jsxs)(Ts,{ref:a,...r,width:t.width,height:t.height,skewX:v,skewY:y,children:[pe&&_.length>0&&(()=>{let e=_d(pe,t.width,t.height,S,C);return e&&$(_,(n,r,i)=>(0,B.jsx)(`Image`,{image:e,x:ae,y:oe,scaleX:re,scaleY:ie,width:t.width,height:t.height,...n,listening:!1},i??`tilt-frame-shadow`))})(),e&&(0,B.jsx)(`Shape`,{x:ae,y:oe,width:t.width,height:t.height,scaleX:re,scaleY:ie,listening:!1,sceneFunc:(t,n)=>{Pu(t,e,n.width(),n.height(),S,C)}}),(0,B.jsx)(Es,{x:0,y:0,width:t.width,height:t.height,fill:`rgba(0,0,0,0)`})]})}if(me)return(0,B.jsxs)(Ts,{ref:a,...r,width:t.width,height:t.height,skewX:v,skewY:y,children:[pe&&_.length>0&&$(_,(e,n,r)=>(0,B.jsx)(`Image`,{image:pe,x:ae,y:oe,scaleX:re,scaleY:ie,width:t.width,height:t.height,...e,listening:!1},r??`frame-shadow`)),(0,B.jsxs)(Ts,{x:ae,y:oe,scaleX:re,scaleY:ie,width:t.width,height:t.height,listening:!1,children:[(0,B.jsx)(Es,{x:ye,y:be,width:xe,height:R,...yu(p,xe,R),cornerRadius:Se,listening:!1}),i&&(0,B.jsx)(`Group`,{x:ye,y:be,width:xe,height:R,listening:!1,clipFunc:e=>{xd(e,0,0,xe,R,Se)},children:(0,B.jsx)(`Image`,{ref:De,image:i,x:Ce,y:we,width:Te,height:Ee,crop:A,filters:I.filters.length>0?I.filters:void 0,...I.attrs,listening:!1})}),T?.statusBarOverlay?.enabled&&(0,B.jsx)(`Group`,{x:ye,y:be,width:xe,height:R,listening:!1,clipFunc:e=>{xd(e,0,0,xe,R,Se)},children:(0,B.jsx)(`Rect`,{x:0,y:0,width:xe,height:R*Math.max(0,Math.min(.3,(T.statusBarOverlay.heightPct??6)/100)),fill:T.statusBarOverlay.color??`#000000`,listening:!1})}),pe&&(0,B.jsx)(`Image`,{image:pe,x:0,y:0,width:t.width,height:t.height,listening:!1})]}),(0,B.jsx)(Es,{x:0,y:0,width:t.width,height:t.height,fill:`rgba(0,0,0,0)`}),!i&&o&&(0,B.jsx)(md,{layerId:e.id,x:ye,y:be,width:xe,height:R,radius:Se,recommendedW:n?.export_w,recommendedH:n?.export_h,devicePresetLabel:n?.label,onClick:o})]});let Oe=e=>(0,B.jsxs)(Ts,{x:ae,y:oe,scaleX:re,scaleY:ie,width:t.width,height:t.height,listening:!1,children:[(0,B.jsx)(Es,{width:t.width,height:t.height,...u,...f??{},cornerRadius:s.chassisRadius,listening:!1}),(0,B.jsx)(Es,{x:s.inset,y:s.inset,width:m,height:h,...g,cornerRadius:c,listening:!1}),i&&(0,B.jsx)(`Group`,{x:s.inset,y:s.inset,width:m,height:h,listening:!1,clipFunc:e=>{xd(e,0,0,m,h,c)},children:(0,B.jsx)(`Image`,{ref:te,image:i,x:M,y:N,width:P,height:F,crop:A,filters:I.filters.length>0?I.filters:void 0,...I.attrs,listening:!1})}),T?.statusBarOverlay?.enabled&&(0,B.jsx)(`Group`,{x:s.inset,y:s.inset,width:m,height:h,listening:!1,clipFunc:e=>{xd(e,0,0,m,h,c)},children:(0,B.jsx)(`Rect`,{x:0,y:0,width:m,height:h*Math.max(0,Math.min(.3,(T.statusBarOverlay.heightPct??6)/100)),fill:T.statusBarOverlay.color??`#000000`,listening:!1})}),s.island&&(0,B.jsx)(`Rect`,{x:(t.width-s.island.width)/2,y:s.island.y,width:s.island.width,height:s.island.height,fill:`#0F172A`,cornerRadius:s.island.height/2,listening:!1})]},e),ke=(0,B.jsx)(Es,{x:0,y:0,width:t.width,height:t.height,fill:`rgba(0,0,0,0)`});if(!w)return(0,B.jsxs)(Ts,{ref:a,...r,width:t.width,height:t.height,skewX:v,skewY:y,children:[$(_,(e,n,r)=>n?null:(0,B.jsx)(Es,{x:ae,y:oe,scaleX:re,scaleY:ie,width:t.width,height:t.height,cornerRadius:s.chassisRadius,fill:`#000`,...e,listening:!1},r??void 0)),_.length>0&&(0,B.jsx)(`Rect`,{x:ae,y:oe,scaleX:re,scaleY:ie,width:t.width,height:t.height,cornerRadius:s.chassisRadius,fill:`#000`,...Uu(_[_.length-1]),listening:!1}),Oe(`frame-flat`),ke,!i&&o&&(0,B.jsx)(md,{layerId:e.id,x:s.inset,y:s.inset,width:m,height:h,radius:c,recommendedW:n?.export_w,recommendedH:n?.export_h,devicePresetLabel:n?.label,onClick:o})]});let Ae=typeof u.fill==`string`?u.fill:`#0F172A`,V=hd({width:t.width,height:t.height,bezel:s,innerW:m,innerH:h,innerRadius:c,screenFillColor:p,screenImage:i,screenDraw:{x:M,y:N,width:P,height:F},screenCrop:A});return(0,B.jsxs)(Ts,{ref:a,...r,width:t.width,height:t.height,skewX:v,skewY:y,children:[_.length>0&&(0,B.jsx)(`Shape`,{width:t.width,height:t.height,sceneFunc:(e,n)=>{zu(e,0,0,t.width,t.height,S,C,s.chassisRadius),e.fillStrokeShape(n)},fill:`#000`,...Uu(_[_.length-1]),listening:!1}),(0,B.jsx)(Ms,{x:ae,y:oe,width:t.width,height:t.height,scaleX:re,scaleY:ie,listening:!1,sceneFunc:e=>{let n=e;if(zu(n,0,0,t.width,t.height,S,C,s.chassisRadius),n.fillStyle=Ae,n.fill(),f){let e=f.strokeWidth??0;e>0&&(n.strokeStyle=typeof f.stroke==`string`?f.stroke:`#000000`,n.lineWidth=e,n.stroke())}}}),(0,B.jsx)(Ts,{width:t.width,height:t.height,listening:!1,clipFunc:e=>{zu(e,s.inset,s.inset,m,h,S,C,c)},children:(0,B.jsx)(Ms,{x:b?t.width-s.inset:s.inset,y:x?t.height-s.inset:s.inset,width:m,height:h,scaleX:re,scaleY:ie,listening:!1,sceneFunc:(e,t)=>{V&&Pu(e,V,t.width(),t.height(),S,C)}})}),(0,B.jsx)(Ms,{width:t.width,height:t.height,listening:!1,sceneFunc:e=>{let n=e;n.save(),zu(n,0,0,t.width,t.height,S,C,s.chassisRadius),n.clip(),zu(n,0,0,t.width,t.height,S,C,s.chassisRadius),n.strokeStyle=Ae,n.lineWidth=s.inset*2,n.lineJoin=`round`,n.lineCap=`round`,n.stroke(),n.restore()}}),ke]})}function md({layerId:e,x:t,y:n,width:r,height:i,radius:a,recommendedW:o,recommendedH:s,devicePresetLabel:c,onClick:l}){if(r<=0||i<=0)return null;let u=Math.max(28,Math.round(Math.min(r,i)*.07)),d=Math.max(48,Math.round(u*1.6)),f=Math.max(22,Math.round(u*.75)),p=Math.round(u*.7),m=Math.round(u*.5),h=o!=null&&s!=null&&o>0&&s>0,g=h&&typeof c==`string`&&c.length>0,_=u+(h?p+d:0)+(g?m+f:0),v=i/2-_/2,y=v+u+p,b=y+d+m,x=Math.max(8,Math.round(Math.min(r,i)*.03)),S=Math.max(2,Math.round(Math.min(r,i)*.004)),C=Math.max(8,Math.round(Math.min(r,i)*.018));return(0,B.jsxs)(Ts,{x:t,y:n,width:r,height:i,listening:!0,onMouseEnter:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`pointer`)},onMouseLeave:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=``)},onClick:t=>{t.cancelBubble=!0,l(e)},onTap:t=>{t.cancelBubble=!0,l(e)},children:[(0,B.jsx)(Es,{width:r,height:i,fill:`rgba(0,0,0,0)`,cornerRadius:a,listening:!0}),(0,B.jsx)(Es,{x,y:x,width:r-x*2,height:i-x*2,fillEnabled:!1,stroke:`#A8A29D`,strokeWidth:S,dash:[C,C],cornerRadius:Math.max(0,a-x),listening:!1}),(0,B.jsx)(As,{x:0,y:v,width:r,align:`center`,text:`+ Add screenshot`,fontFamily:pe(`sans`),fontSize:u,fontStyle:`500`,fill:`#6B6358`,listening:!1}),h&&(0,B.jsx)(`Text`,{x:0,y,width:r,align:`center`,text:`${o} × ${s}`,fontFamily:pe(`sans`),fontSize:d,fontStyle:`600`,fill:`#3F3A35`,listening:!1}),g&&(0,B.jsx)(`Text`,{x:0,y:b,width:r,align:`center`,text:c,fontFamily:pe(`sans`),fontSize:f,fill:`#A8A29D`,listening:!1})]})}function hd(e){let{bezel:t,innerW:n,innerH:r,innerRadius:i}=e;if(n<=0||r<=0)return null;let a=Math.max(1,Math.ceil(n)),o=Math.max(1,Math.ceil(r)),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)return null;c.imageSmoothingEnabled=!0,c.imageSmoothingQuality=`high`;let l=e.screenFillColor.type===`solid`?e.screenFillColor.value:e.screenFillColor.stops?.[0]?.color??`#F4F4F5`;if(c.save(),xd(c,0,0,a,o,i),c.clip(),c.fillStyle=l,c.fillRect(0,0,a,o),e.screenImage){let t=e.screenCrop?.x??0,n=e.screenCrop?.y??0,r=e.screenCrop?.width??e.screenImage.width,i=e.screenCrop?.height??e.screenImage.height;c.drawImage(e.screenImage,t,n,r,i,e.screenDraw.x,e.screenDraw.y,e.screenDraw.width,e.screenDraw.height)}if(c.restore(),t.island){let n=(e.width-t.island.width)/2-t.inset,r=t.island.y-t.inset,i=t.island.height/2;xd(c,n,r,t.island.width,t.island.height,i),c.fillStyle=`#0F172A`,c.fill()}return s}function gd(e){let t=Math.max(1,Math.ceil(e.layerWidth)),n=Math.max(1,Math.ceil(e.layerHeight));if(t<=1&&n<=1)return null;let r=document.createElement(`canvas`);r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)return null;i.imageSmoothingEnabled=!0,i.imageSmoothingQuality=`high`;let{screenRect:a,screenDraw:o,screenCrop:s}=e,c=e.screenFillColor.type===`solid`?e.screenFillColor.value:e.screenFillColor.stops?.[0]?.color??`#F4F4F5`;if(a.width>0&&a.height>0){if(i.save(),i.translate(a.x,a.y),xd(i,0,0,a.width,a.height,a.radius),i.clip(),i.fillStyle=c,i.fillRect(0,0,a.width,a.height),e.screenImage){let t=s?.x??0,n=s?.y??0,r=s?.width??e.screenImage.width,a=s?.height??e.screenImage.height;i.drawImage(e.screenImage,t,n,r,a,o.x,o.y,o.width,o.height)}let t=e.statusBarOverlay;if(t?.enabled){let e=Math.max(0,Math.min(.3,(t.heightPct??6)/100));i.fillStyle=t.color??`#000000`,i.fillRect(0,0,a.width,a.height*e)}i.restore()}return e.frameImage&&i.drawImage(e.frameImage,0,0,t,n),r}function _d(e,t,n,r,i){let a=Math.max(1,Math.ceil(t)),o=Math.max(1,Math.ceil(n)),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);return c?(Pu(c,e,a,o,r,i),s):null}function vd(e,t,n,r,i,a=2,o=.3){if(t<=0||n<=0||r.length===0)return;let s=Math.min(t,n)*(1-2*o)/24;if(s<=0)return;let c=(t-24*s)/2,l=(n-24*s)/2;e.save(),e.translate(c,l),e.scale(s,s),e.strokeStyle=i,e.lineWidth=a,e.lineCap=`round`,e.lineJoin=`round`;for(let t of r)try{e.stroke(new Path2D(t))}catch{}e.restore()}function yd(e,t,n,r,i,a,o,s=`nonzero`){if(t<=0||n<=0||i<=0||a<=0||r.length===0)return;let c=Math.min(t/i,n/a),l=(t-i*c)/2,u=(n-a*c)/2;e.save(),e.translate(l,u),e.scale(c,c),e.fillStyle=bu(e,o,i,a);for(let t of r)try{e.fill(new Path2D(t),s)}catch{}e.restore()}function bd(e,t,n,r,i,a,o,s=2){xd(e,0,0,t,n,o),e.fillStyle=i,e.fill(),e.shadowColor=`transparent`,e.shadowBlur=0,vd(e,t,n,r,a,s)}function xd(e,t,n,r,i,a){let o=Math.max(0,Math.min(a,r/2,i/2));e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.arcTo(t+r,n,t+r,n+o,o),e.lineTo(t+r,n+i-o),e.arcTo(t+r,n+i,t+r-o,n+i,o),e.lineTo(t+o,n+i),e.arcTo(t,n+i,t,n+i-o,o),e.lineTo(t,n+o),e.arcTo(t,n,t+o,n,o),e.closePath()}function Sd(e){if(e.type===`image`)return Du(e.storagePath);if(e.type===`background`)return Du(e.image?.storagePath)}function Cd(e){return`frame-screen:${e}`}function wd(e){return`frame-real:${e}`}function Td(e){return e.endsWith(`-landscape`)?e.slice(0,-10):e}function Ed(e){return e.key.endsWith(`-landscape`)||e.form_factor&&e.form_factor.includes(`landscape`)?`landscape`:`portrait`}function Dd(e,t){let n=t.real_frame_color_options??[];if(n.length===0)return null;if(e.realFrameColor){let t=n.find(t=>t.slug===e.realFrameColor);if(t)return t.slug}return n[0].slug}function Od(e,t){if(!t||t.has_real_frame!==!0||!t.real_frame_screen_rect)return;let n=Dd(e,t);if(n)return`/device-frames/${Td(t.key)}/${n}/${Ed(t)}.png`}function kd(e,t,n,r,i,a=1,o=0,s=0){let c=(i===`cover`?Math.max(n/e,r/t):Math.min(n/e,r/t))*a,l=e*c,u=t*c;return{x:(n-l)/2+o*n,y:(r-u)/2+s*r,width:l,height:u}}function Ad(e,t,n,r,i=1,a=0,o=0){return kd(e.width,e.height,t,n,r,i,a,o)}function jd(e){let t=[],n={};if(!e)return{filters:t,attrs:n};e.brightness&&e.brightness!==0&&(t.push(J.Filters.Brighten),n.brightness=e.brightness),e.contrast&&e.contrast!==0&&(t.push(J.Filters.Contrast),n.contrast=e.contrast);let r=e.hue??0,i=e.saturation??0;if((r!==0||i!==0)&&(t.push(J.Filters.HSL),n.hue=r,n.saturation=i),e.blur&&e.blur>0&&(t.push(J.Filters.Blur),n.blurRadius=e.blur),e.grayscale&&t.push(J.Filters.Grayscale),e.invert&&t.push(J.Filters.Invert),e.tint&&e.tint.amount>0){let{r,g:i,b:a}=Md(e.tint.color);t.push(J.Filters.RGBA),n.red=r,n.green=i,n.blue=a,n.alpha=Math.min(1,Math.max(0,e.tint.amount))}return{filters:t,attrs:n}}function Md(e){let t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec((e??``).trim());if(!t)return{r:0,g:0,b:0};let n=t[1],r=n.length===3?n.split(``).map(e=>e+e).join(``):n,i=parseInt(r,16);return{r:i>>16&255,g:i>>8&255,b:i&255}}function Nd(e){return new Promise((t,n)=>{let r=new Image;try{new URL(e,window.location.href).origin!==window.location.origin&&(r.crossOrigin=`anonymous`)}catch{}r.onload=()=>t(r),r.onerror=()=>n(Error(`Failed to load image: ${e}`)),r.src=e})}async function Pd(e,t){let n=new Map,r=[];for(let i of e)if(fu(i,e)){if(i.type===`image`||i.type===`background`&&i.image){let e=Sd(i);if(!e)continue;r.push(Nd(e).then(e=>{n.set(i.id,e)}).catch(()=>{}));continue}if(i.type===`frame`){if(i.screen?.storagePath){let e=Du(i.screen.storagePath);e&&r.push(Nd(e).then(e=>{n.set(Cd(i.id),e)}).catch(()=>{}))}if(i.realFrameEnabled===!0){let e=t?.find(e=>e.id===i.devicePresetId),a=Od(i,e);a&&r.push(Nd(a).then(e=>{n.set(wd(i.id),e)}).catch(()=>{}))}}}return await Promise.all(r),n}function Fd(e,t,n){let r=e.style?.blendMode;return{id:e.id,name:`layer-${e.id}`,x:t,y:n,rotation:e.rotation??0,opacity:e.style?.opacity??1,globalCompositeOperation:r&&r!==`normal`?r:void 0}}function Id(e,t,n,r){if(!e||e===`solid`||t<=0)return{};let i=typeof n==`number`&&Number.isFinite(n)&&n!==0?{dashOffset:n}:{},a=typeof r==`number`&&Number.isFinite(r)?Math.max(.5,Math.min(10,r)):2;return e===`dashed`?{dash:[t*3,t*a],...i}:{dash:[.01,t*a],lineCap:`round`,...i}}function Ld(e,t){if(!e)return;let n=t.find(t=>t.id===e);if(!(!n||n.type!==`shape`)&&!(n.shape===`line`||n.shape===`arrow`)&&!(n.shape===`path`&&n.closed===!1))return n}function Rd(e,t,n,r,i,a,o,s=`ltr`){if(t.type===`group`)return;let c=he(t.anchors,n),l=Fd(t,c.x,c.y),u,d,f=0;if(t.type===`image`&&(u=Ld(t.clipShapeId,a),u&&(d=he(u.anchors,n),f=u.rotation??0)),t.type===`background`){let n=yu(t.fill,c.width,c.height),i=new J.Group({...l,clipX:0,clipY:0,clipWidth:c.width,clipHeight:c.height});i.add(new J.Rect({width:c.width,height:c.height,...n}));let a=t.image?r.get(t.id):void 0,o=t.image?.blur??0,s=t.image?.overlay,u=t.image?.zoom??1,d=t.image?.offsetX??0,f=t.image?.offsetY??0,p=t.image?.opacity??1;if(a&&t.image.fit===`tile`)i.add(new J.Rect({width:c.width,height:c.height,fillPatternImage:a,fillPatternRepeat:`repeat`,fillPatternScale:{x:u,y:u},fillPatternOffset:{x:-d*c.width,y:-f*c.height},opacity:p}));else if(a&&(t.image.fit===`cover`||t.image.fit===`contain`)){let e=Ad(a,c.width,c.height,t.image.fit,u,d,f),n=t.image?.tint,r=[],s={};if(o>0&&(r.push(J.Filters.Blur),s.blurRadius=o),n&&n.amount>0){let{r:e,g:t,b:i}=Md(n.color);r.push(J.Filters.RGBA),s.red=e,s.green=t,s.blue=i,s.alpha=Math.min(1,Math.max(0,n.amount))}let l=new J.Image({image:a,x:e.x,y:e.y,width:e.width,height:e.height,filters:r.length?r:void 0,...s,opacity:p});r.length&&l.cache(),i.add(l)}a&&s&&s.opacity>0&&i.add(new J.Rect({width:c.width,height:c.height,fill:s.color,opacity:s.opacity})),e.add(i);return}if(t.type===`shape`){let n=yu(t.style?.fill,c.width,c.height),r=t.style?.stroke,i=Hu(t.style);if(t.vectorPaths&&t.vectorPaths.length>0){let n=t.style?.fill,[r,a]=t.vectorViewBox??[24,24],o=t.vectorPaths,s=t.vectorFillRule??`nonzero`;Wu(e,i,e=>new J.Shape({...l,x:c.x,y:c.y,width:c.width,height:c.height,...e,sceneFunc:e=>{yd(e,c.width,c.height,o,r,a,n,s)}}));return}if(t.iconPaths&&t.iconPaths.length>0){let n=gu(t.style?.fill)??`#3B82F6`,a=t.iconColor??`#ffffff`,o=t.style?.radius??Math.min(c.width,c.height)*.28,s=r?.width??2,u=t.iconPaths;Wu(e,i,e=>new J.Shape({...l,x:c.x,y:c.y,width:c.width,height:c.height,...e,sceneFunc:e=>{bd(e,c.width,c.height,u,n,a,o,s)}}));return}let a=Id(r?.dash,r?.width??0,r?.dashOffset,r?.dashGap),o=Math.max(0,t.style?.blur??0),s=o>0&&t.shape===`ellipse`&&(t.sweepAngle??360)>=360&&(t.innerRatio??0)<=0&&(r?.width??0)<=0&&gu(t.style?.fill)!==null,u=o>0&&!s?new J.Group:e;if((()=>{if(t.shape===`ellipse`){let d=t.startAngle??0,f=Math.max(0,Math.min(360,t.sweepAngle??360)),p=Math.max(0,Math.min(.95,t.innerRatio??0)),m=r?.position??`center`,h=r?.width??0,g=f>=360&&p<=0,_=h>0&&r!=null&&m!==`center`;if(g&&!_){if(s){let n=gu(t.style?.fill)??`#000`;e.add(new J.Shape({...l,x:c.x,y:c.y,width:c.width,height:c.height,sceneFunc:_u(c.width,c.height,n,o)}));return}Wu(u,i,e=>new J.Ellipse({...l,x:c.x+c.width/2,y:c.y+c.height/2,radiusX:c.width/2,radiusY:c.height/2,...n,...Z(xu(r?.color),c.width,c.height),strokeWidth:r?.width,...a,...e}));return}let v=c.width/2,y=c.height/2,b=c.width/2,x=c.height/2;if(_){let e=m===`inside`?-1:1,t=Math.max(.01,v+e*h/2),o=Math.max(.01,y+e*h/2),s=new J.Group({...l,x:c.x+c.width/2,y:c.y+c.height/2,offsetX:c.width/2,offsetY:c.height/2,width:c.width,height:c.height});Wu(s,i,e=>new J.Shape({width:c.width,height:c.height,sceneFunc:(e,t)=>{qu(e,b,x,v,y,d,f,p),e.fillStrokeShape(t)},...n,...e})),s.add(new J.Shape({width:c.width,height:c.height,sceneFunc:(e,n)=>{qu(e,b,x,t,o,d,f,p),e.fillStrokeShape(n)},fillEnabled:!1,...Z(xu(r.color),c.width,c.height),strokeWidth:h,...a,listening:!1})),u.add(s);return}Wu(u,i,e=>new J.Shape({...l,x:c.x+c.width/2,y:c.y+c.height/2,offsetX:c.width/2,offsetY:c.height/2,width:c.width,height:c.height,sceneFunc:(e,t)=>{qu(e,b,x,v,y,d,f,p),e.fillStrokeShape(t)},...n,...Z(xu(r?.color),c.width,c.height),strokeWidth:r?.width,...a,...e}));return}if(t.shape===`line`){let e=r?.width??2,t=Id(r?.dash,e,r?.dashOffset,r?.dashGap);Wu(u,i,n=>new J.Line({...l,width:c.width,height:c.height,points:[0,c.height/2,c.width,c.height/2],...Z(xu(r?.color)??{type:`solid`,value:`#0F172A`},c.width,c.height),strokeWidth:e,lineCap:t.lineCap??r?.lineCap??`round`,dash:t.dash,...n}));return}if(t.shape===`arrow`){let e=r?.width??2,n=typeof r?.color==`string`?r.color:r?.color?.type===`solid`?r.color.value:r?.color?.stops?.[0]?.color??`#0F172A`,a=Math.max(4,e*3*(t.arrowHead??1)),o=Id(r?.dash,e,r?.dashOffset,r?.dashGap),s=t.arrowAt??`end`;Wu(u,i,t=>new J.Arrow({...l,width:c.width,height:c.height,points:[0,c.height/2,c.width,c.height/2],...Z(xu(r?.color)??{type:`solid`,value:`#0F172A`},c.width,c.height),strokeWidth:e,fill:n,pointerLength:a,pointerWidth:a,pointerAtBeginning:s===`start`||s===`both`,pointerAtEnding:s===`end`||s===`both`,lineCap:o.lineCap??`butt`,lineJoin:r?.lineJoin??`round`,dash:o.dash,...t}));return}if(t.shape===`polygon`){let e=Math.max(3,Math.min(12,t.sides??6)),o=c.width/2,s=c.height/2,d=c.width/2,f=c.height/2,p=r?.position??`center`,m=r?.width??0;if(m>0&&r!=null&&p!==`center`){let t=p===`inside`?-1:1,h=Math.max(.01,o+t*m/2),g=Math.max(.01,s+t*m/2),_=new J.Group({...l,x:c.x+c.width/2,y:c.y+c.height/2,offsetX:c.width/2,offsetY:c.height/2,width:c.width,height:c.height});Wu(_,i,t=>new J.Shape({width:c.width,height:c.height,sceneFunc:(t,n)=>{Ju(t,d,f,o,s,e),t.fillStrokeShape(n)},...n,...t})),_.add(new J.Shape({width:c.width,height:c.height,sceneFunc:(t,n)=>{Ju(t,d,f,h,g,e),t.fillStrokeShape(n)},fillEnabled:!1,...Z(xu(r.color),c.width,c.height),strokeWidth:m,lineJoin:r?.lineJoin,...a,listening:!1})),u.add(_);return}Wu(u,i,t=>new J.Shape({...l,x:c.x+c.width/2,y:c.y+c.height/2,width:c.width,height:c.height,sceneFunc:(t,n)=>{Ju(t,0,0,o,s,e),t.fillStrokeShape(n)},...n,...Z(xu(r?.color),c.width,c.height),strokeWidth:r?.width,lineJoin:r?.lineJoin,...a,...t}));return}if(t.shape===`star`){let e=Math.max(3,Math.min(12,t.starPoints??5)),o=Math.max(.1,Math.min(.9,t.innerRatio??.4)),s=c.width/2,d=c.height/2,f=c.width/2,p=c.height/2,m=r?.position??`center`,h=r?.width??0;if(h>0&&r!=null&&m!==`center`){let t=m===`inside`?-1:1,g=Math.max(.01,s+t*h/2),_=Math.max(.01,d+t*h/2),v=new J.Group({...l,x:c.x+c.width/2,y:c.y+c.height/2,offsetX:c.width/2,offsetY:c.height/2,width:c.width,height:c.height});Wu(v,i,t=>new J.Shape({width:c.width,height:c.height,sceneFunc:(t,n)=>{Yu(t,f,p,s,d,e,o),t.fillStrokeShape(n)},...n,...t})),v.add(new J.Shape({width:c.width,height:c.height,sceneFunc:(t,n)=>{Yu(t,f,p,g,_,e,o),t.fillStrokeShape(n)},fillEnabled:!1,...Z(xu(r.color),c.width,c.height),strokeWidth:h,lineJoin:r?.lineJoin,...a,listening:!1})),u.add(v);return}Wu(u,i,t=>new J.Shape({...l,x:c.x+c.width/2,y:c.y+c.height/2,width:c.width,height:c.height,sceneFunc:(t,n)=>{Yu(t,0,0,s,d,e,o),t.fillStrokeShape(n)},...n,...Z(xu(r?.color),c.width,c.height),strokeWidth:r?.width,lineJoin:r?.lineJoin,...a,...t}));return}if(t.shape===`path`){let e=t.nodes??[],o=t.closed??!1,s=r?.width??0,d=xu(r?.color)??{type:`solid`,value:`#0F172A`},f=r?.position??`center`;if(o&&s>0&&r!=null&&f!==`center`){let t=f===`inside`?-1:1,p=c.width>0?(c.width+t*s)/c.width:1,m=c.height>0?(c.height+t*s)/c.height:1,h=e.map(e=>({x:.5+(e.x-.5)*p,y:.5+(e.y-.5)*m,handleIn:e.handleIn?{x:e.handleIn.x*p,y:e.handleIn.y*m}:void 0,handleOut:e.handleOut?{x:e.handleOut.x*p,y:e.handleOut.y*m}:void 0})),g=new J.Group({...l,width:c.width,height:c.height});Wu(g,i,t=>new J.Shape({width:c.width,height:c.height,sceneFunc:(t,n)=>{Xu(t,e,c.width,c.height,o),t.fillStrokeShape(n)},...n,...t})),g.add(new J.Shape({width:c.width,height:c.height,sceneFunc:(e,t)=>{Xu(e,h,c.width,c.height,o),e.fillStrokeShape(t)},fillEnabled:!1,...Z(d,c.width,c.height),strokeWidth:s,lineCap:r?.lineCap??`round`,lineJoin:r?.lineJoin??`round`,...a,listening:!1})),u.add(g);return}Wu(u,i,t=>new J.Shape({...l,width:c.width,height:c.height,sceneFunc:(t,n)=>{Xu(t,e,c.width,c.height,o),t.fillStrokeShape(n)},...o?n:{fillEnabled:!1},...Z(d,c.width,c.height),strokeWidth:s,lineCap:r?.lineCap??`round`,lineJoin:r?.lineJoin??`round`,...a,...t}));return}let d=t.shape===`rect`?t.style?.radius??0:0,f=t.shape===`rect`?t.style?.radii:void 0,p=f?[f.topLeft??d,f.topRight??d,f.bottomRight??d,f.bottomLeft??d]:d,m=r?.position??`center`,h=r?.width??0;if(t.shape===`rect`&&r&&h>0&&m!==`center`){let e=m===`inside`?h/2:-h/2,t=e=>Math.max(0,m===`inside`?e-h/2:e+h/2),o=Array.isArray(p)?p.map(t):t(p),s=new J.Group({...l,width:c.width,height:c.height});Wu(s,i,e=>new J.Rect({x:0,y:0,width:c.width,height:c.height,cornerRadius:p,...n,...e})),s.add(new J.Rect({x:e,y:e,width:c.width-e*2,height:c.height-e*2,cornerRadius:o,fillEnabled:!1,...Z(xu(r.color),c.width-e*2,c.height-e*2),strokeWidth:h,lineJoin:r?.lineJoin,...a})),u.add(s);return}Wu(u,i,e=>new J.Rect({...l,width:c.width,height:c.height,cornerRadius:p,...n,...Z(xu(r?.color),c.width,c.height),strokeWidth:r?.width,lineJoin:r?.lineJoin,...a,...e}))})(),o>0&&u!==e){let t=u;t.filters(hu),t.blurRadius(o);let n=Math.ceil(o*2)+2,r=t.getClientRect({skipTransform:!0,relativeTo:t});r.width>0&&r.height>0&&t.cache({x:r.x-n,y:r.y-n,width:r.width+n*2,height:r.height+n*2}),e.add(t)}return}if(t.type===`text`){let r=me(t.content,o),i=xe(r,t.textTransform),a=_e(t.align,s),u=ve(t.fontWeight,t.fontStyle),d=Hu(t.style),f=t.style?.stroke,p=t.fitMode===`auto`,m=p?ge(t,o,n.width):null,h=m?m.width:c.width,g=m?m.height:c.height,_=t.anchors.left&&t.anchors.left.type!==`auto`?t.anchors.left.align:void 0,v=t.anchors.top&&t.anchors.top.type!==`auto`?t.anchors.top.align:void 0,y=p?c.x+(_===`center`?(c.width-h)/2:_===`end`?c.width-h:0):c.x,b=p?c.y+(v===`center`?(c.height-g)/2:v===`end`?c.height-g:0):c.y,x=t.fill?yu(t.fill,h,g):{fill:t.color},S=be(t,h,g,o),C=m?.wrapped?`word`:p||t.fitMode===`clip`?`none`:`word`,w={...l,x:y,y:b,width:h,height:g,text:i,fontFamily:fe(t.fontFamily,o),fontSize:S,fontStyle:u,lineHeight:ue(i,t.lineHeight),letterSpacing:de(i,t.letterSpacing),align:a,verticalAlign:`top`,...x,wrap:C,ellipsis:t.fitMode===`clip`,...Z(xu(f?.color),h,g),strokeWidth:f?.width,fillAfterStrokeEnabled:f?.width?!0:void 0},T=r===(t.content.default??``)?t.richRuns:o?t.richRunsByLocale?.[o]:void 0;if(T&&T.length>0&&!le(i)){let n=new J.Text(w);n.charRenderFunc(uu(n,T,t.color)),e.add(n);return}Wu(e,d,e=>new J.Text({...w,...e}));return}if(t.type===`image`){let n=r.get(t.id);if(!n){e.add(new J.Rect({...l,width:c.width,height:c.height,fill:`#E4E4E7`,stroke:`#A1A1AA`,strokeWidth:2,dash:[12,8]}));return}let i=t.fit,a=Math.max(.01,t.zoom??1),o=t.offsetX??0,s=t.offsetY??0,p=t.flipX===!0,m=t.flipY===!0,h=Math.tan((t.skewX??0)*Math.PI/180),g=Math.tan((t.skewY??0)*Math.PI/180),_=t.tiltY??0,v=t.tiltX??0,y=Math.abs(_)>.01||Math.abs(v)>.01,b=(()=>{if(!t.crop)return;let e=Math.max(0,Math.min(.99,t.crop.top??0)),r=Math.max(0,Math.min(.99,t.crop.right??0)),i=Math.max(0,Math.min(.99,t.crop.bottom??0)),a=Math.max(0,Math.min(.99,t.crop.left??0));if(e===0&&r===0&&i===0&&a===0)return;let o=Math.max(.001,1-a-r),s=Math.max(.001,1-e-i);return{x:a*n.width,y:e*n.height,width:o*n.width,height:s*n.height}})(),x=b?.width??n.width,S=b?.height??n.height,C=0,w=0,T=c.width,E=c.height;if(i===`cover`||i===`contain`){let e=kd(x,S,c.width,c.height,i,a,o,s);C=e.x,w=e.y,T=e.width,E=e.height}let D=p?-1:1,O=m?-1:1,k=p?T:0,A=m?E:0,{filters:j,attrs:ee}=jd(t.adjust),M=t.style?.stroke,N=Hu(t.style),P=Math.max(0,t.style?.radius??0),F=M?.width??0,I=Id(M?.dash,F,M?.dashOffset,M?.dashGap),te=M!=null&&F>0,ne=N.length>0,re=t.overlay!=null&&t.overlay.opacity>0,ie=a!==1||o!==0||s!==0,ae=u!=null,oe=P>0||ie||i===`contain`||p||m||y||ae||te||ne||re||j.length>0||y,se=()=>{if(y)return new J.Shape({x:C+k,y:w+A,width:T,height:E,scaleX:D,scaleY:O,listening:!1,sceneFunc:(e,t)=>{Pu(e,n,t.width(),t.height(),v,_,b)}});let e=new J.Image({image:n,x:C+k,y:w+A,width:T,height:E,scaleX:D,scaleY:O,crop:b,listening:!1,...ee});return j.length>0&&(e.filters(j),e.cache()),e};if(!oe){let t=new J.Image({...l,image:n,width:c.width,height:c.height,skewX:h,skewY:g,crop:b,...ee});j.length>0&&(t.filters(j),t.cache()),e.add(t);return}let ce=new J.Group({...l,skewX:h,skewY:g});if(ne&&y)Wu(ce,N,e=>new J.Shape({width:c.width,height:c.height,sceneFunc:(e,t)=>{zu(e,0,0,c.width,c.height,v,_,P),e.fillStrokeShape(t)},fill:`#000`,...e,listening:!1}));else if(ne&&n){let e=Math.max(1,Math.ceil(c.width)),t=Math.max(1,Math.ceil(c.height)),r=document.createElement(`canvas`);r.width=e,r.height=t;let i=r.getContext(`2d`);i&&(i.save(),P>0&&(xd(i,0,0,c.width,c.height,P),i.clip()),i.translate(C+k,w+A),i.scale(D,O),b?i.drawImage(n,b.x,b.y,b.width,b.height,0,0,T,E):i.drawImage(n,0,0,T,E),i.restore(),Wu(ce,N,e=>new J.Shape({width:c.width,height:c.height,...e,listening:!1,sceneFunc:e=>{let t=e;t.drawImage(r,0,0),t.shadowColor=`transparent`,t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.globalCompositeOperation=`destination-out`,t.drawImage(r,0,0)}})))}let le=(l.rotation??0)*Math.PI/180,ue=f*Math.PI/180,de=new J.Group({width:c.width,height:c.height,clipFunc:e=>{if(ae&&u&&d){let t=e;t.save(),le&&t.rotate(-le),t.translate(-c.x,-c.y),t.translate(d.x,d.y),ue&&t.rotate(ue);let n=Gu(t,u,d.width,d.height);if(t.restore(),n)return;xd(e,0,0,c.width,c.height,0);return}y?zu(e,0,0,c.width,c.height,v,_,P):xd(e,0,0,c.width,c.height,P)},listening:!1});de.add(se()),t.overlay&&t.overlay.opacity>0&&de.add(new J.Rect({x:0,y:0,width:c.width,height:c.height,fill:t.overlay.color,opacity:t.overlay.opacity,globalCompositeOperation:`source-atop`,listening:!1})),ce.add(de),te&&y?ce.add(new J.Shape({width:c.width,height:c.height,sceneFunc:(e,t)=>{zu(e,0,0,c.width,c.height,v,_,P),e.fillStrokeShape(t)},fillEnabled:!1,...Z(xu(M.color),c.width,c.height),strokeWidth:F,...I,listening:!1})):te&&ce.add(new J.Rect({x:0,y:0,width:c.width,height:c.height,cornerRadius:P,fillEnabled:!1,...Z(xu(M.color),c.width,c.height),strokeWidth:F,...I,listening:!1})),e.add(ce);return}if(t.type===`callout`){let u=a.find(e=>e.id===t.sourceLayerId),d=u&&u.type!==`callout`&&u.type!==`group`&&u.type!==`background`;if(!u||!d){let n=new J.Group({...l});n.add(new J.Shape({width:c.width,height:c.height,listening:!1,stroke:`rgba(0,0,0,0.3)`,strokeWidth:1,dash:[4,4],sceneFunc:(e,n)=>{ad(e,t,c.width,c.height),e.fillStrokeShape(n)}})),e.add(n);return}let f=he(u.anchors,n),p=f.x+t.sourceRect.x/100*f.width,m=f.y+t.sourceRect.y/100*f.height,h=Math.max(1,t.sourceRect.width/100*f.width),g=c.width/h,_=new J.Group({...l}),v=Hu(t.style);v.length>0&&Wu(_,v,e=>new J.Shape({listening:!1,fill:`#000`,sceneFunc:(e,n)=>{ad(e,t,c.width,c.height),e.fillStrokeShape(n)},...e}));let y=t.leader;if(y?.enabled){let e=y.from&&y.to?{from:y.from,to:y.to}:cd(f,c,t.shape),n={x:e.from.x-c.x,y:e.from.y-c.y},r={x:e.to.x-c.x,y:e.to.y-c.y},i=xu(y.stroke),a=i?.type===`solid`?i.value:i?.stops?.[0]?.color??`#0F172A`,o=y.width,s=Z(i,c.width,c.height);y.style===`line`?_.add(new J.Line({points:[n.x,n.y,r.x,r.y],...s,strokeWidth:o,listening:!1})):y.style===`arrow`?_.add(new J.Arrow({points:[n.x,n.y,r.x,r.y],...s,strokeWidth:o,fill:a,pointerLength:Math.max(4,o*3),pointerWidth:Math.max(4,o*2.5),listening:!1})):_.add(new J.Shape({...s,strokeWidth:o,listening:!1,sceneFunc:(e,t)=>{let i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a)||1,s=o*.2,c=-a/o*s,l=i/o*s,u=(n.x+r.x)/2,d=(n.y+r.y)/2;e.beginPath(),e.moveTo(n.x,n.y),e.quadraticCurveTo(u+c,d+l,r.x,r.y),e.strokeShape(t)}}))}let b=new J.Group({width:c.width,height:c.height,listening:!1,clipFunc:e=>{ad(e,t,c.width,c.height)}}),x=new J.Group({x:-p*g,y:-m*g,scaleX:g,scaleY:g,listening:!1});Rd(x,u,n,r,i,a,o,s),b.add(x),_.add(b);let S=t.style?.stroke,C=xu(S?.color);(S?.width??0)>0&&C&&_.add(new J.Shape({listening:!1,...Z(C,c.width,c.height),strokeWidth:S.width,...Id(S.dash,S.width??0,S.dashOffset,S.dashGap),sceneFunc:(e,n)=>{ad(e,t,c.width,c.height),e.fillStrokeShape(n)}})),e.add(_);return}if(t.type!==`frame`)return;let p=i?.find(e=>e.id===t.devicePresetId),m=t.tiltX??0,h=t.tiltY??0,g=Math.abs(m)>.01||Math.abs(h)>.01,_=t.realFrameEnabled===!0&&p?.has_real_frame===!0&&(!g||Mu(m,h))&&p?.real_frame_screen_rect!=null,v=_?r.get(wd(t.id)):void 0;if(_&&v&&p){let n=Ed(p),i=p.real_frame_screen_rect[n],a=v.naturalWidth||p.export_w,o=v.naturalHeight||p.export_h,s=c.width/Math.max(1,a),u=c.height/Math.max(1,o),d={x:i.x*s,y:i.y*u,width:i.width*s,height:i.height*u,radius:i.radius*Math.min(s,u)},f=Math.tan((t.skewX??0)*Math.PI/180),_=Math.tan((t.skewY??0)*Math.PI/180),y=t.flipX===!0,b=t.flipY===!0,x=y?-1:1,S=b?-1:1,C=y?c.width:0,w=b?c.height:0,T=t.screen,E=T?r.get(Cd(t.id)):void 0,D=T?.fit??`cover`,O=Math.max(.01,T?.zoom??1),k=T?.offsetX??0,A=T?.offsetY??0,j;if(E&&T?.crop){let e=Math.max(0,Math.min(.99,T.crop.top??0)),t=Math.max(0,Math.min(.99,T.crop.right??0)),n=Math.max(0,Math.min(.99,T.crop.bottom??0)),r=Math.max(0,Math.min(.99,T.crop.left??0));if(e!==0||t!==0||n!==0||r!==0){let i=Math.max(.001,1-r-t),a=Math.max(.001,1-e-n);j={x:r*E.width,y:e*E.height,width:i*E.width,height:a*E.height}}}let ee=j?.width??E?.width??0,M=j?.height??E?.height??0,N=0,P=0,F=d.width,I=d.height;if(E&&(D===`cover`||D===`contain`)){let e=kd(ee,M,d.width,d.height,D,O,k,A);N=e.x,P=e.y,F=e.width,I=e.height}let te=jd(T?.adjust),ne=t.screenFill??{type:`solid`,value:`#F4F4F5`},re=yu(ne,d.width,d.height),ie=new J.Group({...l,skewX:f,skewY:_});if(g){let n=Hu(t.style),r=n.length>0?_d(v,c.width,c.height,m,h):null;r&&Wu(ie,n,e=>new J.Image({image:r,x:C,y:w,scaleX:x,scaleY:S,width:c.width,height:c.height,...e,listening:!1}));let i=gd({layerWidth:c.width,layerHeight:c.height,frameImage:v,screenImage:E,screenFillColor:ne,screenRect:d,screenDraw:{x:N,y:P,width:F,height:I},screenCrop:j,statusBarOverlay:t.screen?.statusBarOverlay});i&&ie.add(new J.Shape({x:C,y:w,width:c.width,height:c.height,scaleX:x,scaleY:S,listening:!1,sceneFunc:(e,t)=>{Pu(e,i,t.width(),t.height(),m,h)}})),e.add(ie);return}let ae=Hu(t.style);ae.length>0&&Wu(ie,ae,e=>new J.Image({image:v,x:C,y:w,scaleX:x,scaleY:S,width:c.width,height:c.height,...e,listening:!1}));let oe=new J.Group({x:C,y:w,scaleX:x,scaleY:S,width:c.width,height:c.height,listening:!1}),se=new J.Group({x:d.x,y:d.y,width:d.width,height:d.height,listening:!1,clipFunc:e=>{xd(e,0,0,d.width,d.height,d.radius)}});if(se.add(new J.Rect({width:d.width,height:d.height,...re,listening:!1})),E){let e=new J.Image({image:E,x:N,y:P,width:F,height:I,crop:j,listening:!1,...te.attrs});te.filters.length>0&&(e.filters(te.filters),e.cache()),se.add(e)}oe.add(se);let ce=t.screen?.statusBarOverlay;if(ce?.enabled){let e=Math.max(0,Math.min(.3,(ce.heightPct??6)/100)),t=new J.Group({x:d.x,y:d.y,width:d.width,height:d.height,listening:!1,clipFunc:e=>{xd(e,0,0,d.width,d.height,d.radius)}});t.add(new J.Rect({x:0,y:0,width:d.width,height:d.height*e,fill:ce.color??`#000000`,listening:!1})),oe.add(t)}oe.add(new J.Image({image:v,x:0,y:0,width:c.width,height:c.height,listening:!1})),ie.add(oe),e.add(ie);return}let y=Su(c.width,c.height,p),b=Math.max(0,y.chassisRadius-y.inset),x=Math.max(0,c.width-y.inset*2),S=Math.max(0,c.height-y.inset*2),C=t.style,w=yu(C?.fill??{type:`solid`,value:`#0F172A`},c.width,c.height),T=C?.stroke?.width??0,E=T?{...Z(xu(C.stroke.color),c.width,c.height),strokeWidth:T}:{},D=t.screenFill??{type:`solid`,value:`#F4F4F5`},O=yu(D,x,S),k=Math.tan((t.skewX??0)*Math.PI/180),A=Math.tan((t.skewY??0)*Math.PI/180),j=t.flipX===!0,ee=t.flipY===!0,M=t.tiltX??0,N=t.tiltY??0,P=Math.abs(M)>.01||Math.abs(N)>.01,F=j?-1:1,I=ee?-1:1,te=j?c.width:0,ne=ee?c.height:0,re=t.screen,ie=re?r.get(Cd(t.id)):void 0,ae=re?.fit??`cover`,oe=Math.max(.01,re?.zoom??1),se=re?.offsetX??0,ce=re?.offsetY??0,pe;if(ie&&re?.crop){let e=Math.max(0,Math.min(.99,re.crop.top??0)),t=Math.max(0,Math.min(.99,re.crop.right??0)),n=Math.max(0,Math.min(.99,re.crop.bottom??0)),r=Math.max(0,Math.min(.99,re.crop.left??0));if(e!==0||t!==0||n!==0||r!==0){let i=Math.max(.001,1-r-t),a=Math.max(.001,1-e-n);pe={x:r*ie.width,y:e*ie.height,width:i*ie.width,height:a*ie.height}}}let L=pe?.width??ie?.width??0,ye=pe?.height??ie?.height??0,R=0,Se=0,Ce=x,we=S;if(ie&&(ae===`cover`||ae===`contain`)){let e=kd(L,ye,x,S,ae,oe,se,ce);R=e.x,Se=e.y,Ce=e.width,we=e.height}let Te=jd(re?.adjust),Ee=new J.Group({...l,skewX:k,skewY:A});if(P){let t=Hu(C);if(t.length>0){let e=t[t.length-1];Ee.add(new J.Shape({width:c.width,height:c.height,sceneFunc:(e,t)=>{zu(e,0,0,c.width,c.height,M,N,y.chassisRadius),e.fillStrokeShape(t)},fill:`#000`,shadowColor:e.color,shadowBlur:e.blur,shadowOffsetX:e.offsetX,shadowOffsetY:e.offsetY,shadowOpacity:e.opacity,listening:!1}))}let n=typeof w.fill==`string`?w.fill:`#0F172A`;Ee.add(new J.Shape({x:te,y:ne,width:c.width,height:c.height,scaleX:F,scaleY:I,listening:!1,sceneFunc:e=>{let t=e;zu(t,0,0,c.width,c.height,M,N,y.chassisRadius),t.fillStyle=n,t.fill();let r=E,i=r.strokeWidth??0;i>0&&(t.strokeStyle=typeof r.stroke==`string`?r.stroke:`#000000`,t.lineWidth=i,t.stroke())}}));let r=zd({width:c.width,height:c.height,bezel:y,innerW:x,innerH:S,innerRadius:b,screenFillColor:D,screenImage:ie,screenDraw:{x:R,y:Se,width:Ce,height:we},screenCrop:pe});if(r){let e=new J.Group({width:c.width,height:c.height,listening:!1,clipFunc:e=>{zu(e,y.inset,y.inset,x,S,M,N,b)}});e.add(new J.Shape({x:j?c.width-y.inset:y.inset,y:ee?c.height-y.inset:y.inset,width:x,height:S,scaleX:F,scaleY:I,listening:!1,sceneFunc:(e,t)=>{Pu(e,r,t.width(),t.height(),M,N)}})),Ee.add(e)}Ee.add(new J.Shape({width:c.width,height:c.height,listening:!1,sceneFunc:e=>{let t=e;t.save(),zu(t,0,0,c.width,c.height,M,N,y.chassisRadius),t.clip(),zu(t,0,0,c.width,c.height,M,N,y.chassisRadius),t.strokeStyle=n,t.lineWidth=y.inset*2,t.lineJoin=`round`,t.lineCap=`round`,t.stroke(),t.restore()}})),e.add(Ee);return}let De=new J.Group({x:te,y:ne,scaleX:F,scaleY:I,width:c.width,height:c.height,listening:!1});if(Wu(De,Hu(C),(e,t)=>new J.Rect({width:c.width,height:c.height,...w,...E,cornerRadius:y.chassisRadius,...e,listening:t})),De.add(new J.Rect({x:y.inset,y:y.inset,width:x,height:S,...O,cornerRadius:b,listening:!1})),ie){let e=new J.Group({x:y.inset,y:y.inset,width:x,height:S,listening:!1,clipFunc:e=>{xd(e,0,0,x,S,b)}}),t=new J.Image({image:ie,x:R,y:Se,width:Ce,height:we,crop:pe,listening:!1,...Te.attrs});Te.filters.length>0&&(t.filters(Te.filters),t.cache()),e.add(t),De.add(e)}let z=t.screen?.statusBarOverlay;if(z?.enabled){let e=Math.max(0,Math.min(.3,(z.heightPct??6)/100));De.add(new J.Rect({x:y.inset,y:y.inset,width:x,height:S*e,fill:z.color??`#000000`,listening:!1}))}y.island&&De.add(new J.Rect({x:(c.width-y.island.width)/2,y:y.island.y,width:y.island.width,height:y.island.height,fill:`#0F172A`,cornerRadius:y.island.height/2,listening:!1})),Ee.add(De),e.add(Ee)}function zd(e){let{bezel:t,innerW:n,innerH:r,innerRadius:i}=e;if(n<=0||r<=0)return null;let a=Math.max(1,Math.ceil(n)),o=Math.max(1,Math.ceil(r)),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)return null;c.imageSmoothingEnabled=!0,c.imageSmoothingQuality=`high`;let l=e.screenFillColor.type===`solid`?e.screenFillColor.value:e.screenFillColor.stops?.[0]?.color??`#F4F4F5`;if(c.save(),xd(c,0,0,a,o,i),c.clip(),c.fillStyle=l,c.fillRect(0,0,a,o),e.screenImage){let t=e.screenCrop?.x??0,n=e.screenCrop?.y??0,r=e.screenCrop?.width??e.screenImage.width,i=e.screenCrop?.height??e.screenImage.height;c.drawImage(e.screenImage,t,n,r,i,e.screenDraw.x,e.screenDraw.y,e.screenDraw.width,e.screenDraw.height)}if(c.restore(),t.island){let n=(e.width-t.island.width)/2-t.inset,r=t.island.y-t.inset,i=t.island.height/2;xd(c,n,r,t.island.width,t.island.height,i),c.fillStyle=`#0F172A`,c.fill()}return s}async function Bd(e,t){let n=t.format??`png`,r=n===`jpeg`?`image/jpeg`:`image/png`,i=URL.createObjectURL(e);try{let a=await new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>t(Error(`Failed to decode source image for downscale`)),n.src=i}),o=a.naturalWidth>t.maxWidth,s=e.type!==r;if(!o&&!s)return e;let c=o?t.maxWidth/a.naturalWidth:1,l=Math.max(1,Math.round(a.naturalWidth*c)),u=Math.max(1,Math.round(a.naturalHeight*c)),d=document.createElement(`canvas`);d.width=l,d.height=u;let f=d.getContext(`2d`);return f?(n===`jpeg`&&(f.fillStyle=`#FFFFFF`,f.fillRect(0,0,l,u)),f.imageSmoothingEnabled=!0,f.imageSmoothingQuality=`high`,f.drawImage(a,0,0,l,u),await new Promise(e=>{d.toBlob(t=>e(t),r,t.quality)})??e):e}catch{return e}finally{URL.revokeObjectURL(i)}}async function Vd(e,t){let n=t?.devicePresets,r=t?.targetWidth&&t?.targetHeight?{...e.canvas,width:t.targetWidth,height:t.targetHeight}:e.canvas,i=e.layers.filter(t=>fu(t,e.layers)),a=await Pd(i,n),o=document.createElement(`div`);o.style.position=`fixed`,o.style.left=`-99999px`,o.style.top=`-99999px`,o.style.pointerEvents=`none`,document.body.appendChild(o);let s=new J.Stage({container:o,width:r.width,height:r.height}),c=new J.Layer;s.add(c),c.add(new J.Rect({x:0,y:0,width:r.width,height:r.height,fill:`#ffffff`,listening:!1}));try{for(let o of i)Rd(c,o,r,a,n,e.layers,t?.locale??null,t?.direction??`ltr`);c.draw();let o=s.toCanvas({pixelRatio:1});return await new Promise((e,t)=>{o.toBlob(n=>n?e(n):t(Error(`canvas.toBlob returned null`)),`image/png`)})}finally{s.destroy(),o.remove()}}function Hd(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)}function Ud(e){let t=document.cookie.match(RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function Wd({project:e,onClose:t}){let[n,r]=(0,z.useState)(()=>Hd(e.name)||`my-kit`),[i,a]=(0,z.useState)(e.name),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!0),[m,h]=(0,z.useState)(!1),[v,x]=(0,z.useState)(``),[S,C]=(0,z.useState)(null),w=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let e=window.setTimeout(()=>{w.current?.focus(),w.current?.select()},0);return()=>window.clearTimeout(e)},[]),(0,B.jsxs)(y,{open:!0,onClose:t,onSubmit:async r=>{r.preventDefault();let a=n.trim(),s=i.trim();if(!(!a||!s)){h(!0),C(null),x(`Loading screens…`);try{let n=Ud(`XSRF-TOKEN`),r=await fetch(`/projects/${e.id}/template-preflight`,{method:`GET`,credentials:`same-origin`,headers:{Accept:`application/json`,"X-Requested-With":`XMLHttpRequest`}});if(!r.ok){C(`Could not load screens (HTTP ${r.status}).`);return}let i=await r.json();Cu(i.mediaUrlMap);let l=new Map;for(let e=0;e<i.screens.length;e+=1){let t=i.screens[e];if(!t.layout)continue;x(`Rendering ${t.name} (${e+1}/${i.screens.length})…`);let n=Hd(t.name);if(n)try{await ce(t.layout);let e=await Bd(await Vd(t.layout,{devicePresets:i.devicePresets}),{maxWidth:480,format:`jpeg`,quality:.85});l.set(n,e)}catch(e){console.error(`[ExportTemplate] Failed to render preview for "${t.name}" (slug=${n}):`,e)}}x(`Uploading…`);let d=new FormData;d.append(`key`,a),d.append(`name`,s),o.trim()&&d.append(`description`,o.trim()),c.trim()&&d.append(`category`,c.trim()),u.trim()&&d.append(`tagline`,u.trim()),f&&d.append(`compress`,`1`);for(let[e,t]of l)d.append(`marketing_pngs[${e}]`,t,`${e}.jpg`);let p=await fetch(`/projects/${e.id}/export-template`,{method:`POST`,credentials:`same-origin`,headers:{Accept:`application/json, application/zip`,"X-Requested-With":`XMLHttpRequest`,...n?{"X-XSRF-TOKEN":n}:{}},body:d});if(!p.ok){if((p.headers.get(`content-type`)??``).includes(`application/json`)){let e=await p.json();C(e.errors?.key?.[0]??e.errors?.name?.[0]??e.errors?.description?.[0]??e.errors?.category?.[0]??e.errors?.tagline?.[0]??e.message??`HTTP ${p.status}`)}else C(`HTTP ${p.status}`);return}let m=await p.blob(),h=URL.createObjectURL(m),g=document.createElement(`a`);g.href=h,g.download=`${a}.zip`,document.body.appendChild(g),g.click(),g.remove(),URL.revokeObjectURL(h),t()}catch(e){C(e instanceof Error?e.message:String(e))}finally{h(!1),x(``)}}},closeOnBackdrop:!1,closeOnEsc:!m,size:`md`,"data-testid":`export-template-modal`,children:[(0,B.jsx)(y.Header,{title:e.name,subtitle:(0,B.jsxs)(B.Fragment,{children:[`Downloads a ZIP containing the kit JSON and any referenced media under `,(0,B.jsx)(`code`,{children:`assets/`}),`.`]})}),(0,B.jsxs)(y.Body,{children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(g,{htmlFor:`export-template-key`,children:`Kit key`}),(0,B.jsx)(b,{id:`export-template-key`,ref:w,value:n,onChange:e=>r(e.target.value),placeholder:`my-kit`,invalid:!!S,"data-testid":`export-template-key-input`}),(0,B.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Lowercase letters, digits, and hyphens. Becomes the JSON filename and picker identifier.`})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(g,{htmlFor:`export-template-name`,children:`Kit name`}),(0,B.jsx)(b,{id:`export-template-name`,value:i,onChange:e=>a(e.target.value),invalid:!!S,"data-testid":`export-template-name-input`})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(g,{htmlFor:`export-template-description`,children:[`Description`,(0,B.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:`(optional)`})]}),(0,B.jsx)(b,{id:`export-template-description`,value:o,onChange:e=>s(e.target.value),placeholder:`One-line description shown on the picker card.`,"data-testid":`export-template-description-input`})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(g,{htmlFor:`export-template-category`,children:[`Category`,(0,B.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:`(optional, for /templates page)`})]}),(0,B.jsx)(b,{id:`export-template-category`,value:c,onChange:e=>l(e.target.value),placeholder:`Productivity, Health, Finance, …`,"data-testid":`export-template-category-input`})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(g,{htmlFor:`export-template-tagline`,children:[`Tagline`,(0,B.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:`(optional, for /templates page)`})]}),(0,B.jsx)(b,{id:`export-template-tagline`,value:u,onChange:e=>d(e.target.value),placeholder:`One-line marketing hook.`,"data-testid":`export-template-tagline-input`})]}),(0,B.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-md border border-border px-3 py-2 text-[11px] transition-colors hover:bg-muted/40`,"data-testid":`export-template-compress`,children:[(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 h-3.5 w-3.5 shrink-0 accent-accent`,checked:f,onChange:e=>p(e.target.checked),"aria-checked":f}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:`Compress images`}),(0,B.jsx)(`span`,{className:`text-[10px] font-normal leading-snug text-muted-foreground/80`,children:`Opaque screenshots convert to JPG (q=85); brand assets and anything with transparency stay PNG. Typically shrinks kits 50-80% with no visible loss on canvas content. Slower export — ~30-60s for a multi-factor kit.`})]})]})]}),(0,B.jsxs)(y.Footer,{className:`flex-col items-stretch gap-3`,children:[v&&m&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`export-template-stage`,children:v}),S&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,"data-testid":`export-template-error`,children:S}),(0,B.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,B.jsx)(_,{type:`button`,variant:`ghost`,onClick:t,disabled:m,"data-testid":`export-template-cancel`,children:`Cancel`}),(0,B.jsx)(_,{type:`submit`,disabled:m||!n.trim()||!i.trim(),"data-testid":`export-template-submit`,children:m?v||`Packaging…`:`Download ZIP`})]})]})]})}var Gd={iphone_portrait:{label:`iPhone 6.9"`,family:`iPhone`,sizeTag:`6.9"`,device:`iPhone 17 Pro Max`},ipad_portrait:{label:`iPad 13"`,family:`iPad`,sizeTag:`13"`,device:`iPad Pro 13" (M5)`},android_phone_portrait:{label:`Android Phone`,family:`Android Phone`,sizeTag:``,device:`Samsung Galaxy S26`},android_10_tablet_portrait:{label:`Android Tablet`,family:`Android Tablet`,sizeTag:``,device:`Samsung Galaxy Tab S8 Ultra`},playstore_feature_graphic:{label:`Play Store Feature Graphic`,family:`Marketing`,sizeTag:``,device:`Google Play Store`}};function Kd(e){return Gd[e]}var qd={iphone_portrait:Gd.iphone_portrait,ipad_portrait:Gd.ipad_portrait,android_phone_portrait:Gd.android_phone_portrait,android_10_tablet_portrait:Gd.android_10_tablet_portrait,iphone_landscape:Kd(`iphone_portrait`),ipad_landscape:Kd(`ipad_portrait`),android_phone_landscape:Kd(`android_phone_portrait`),android_10_tablet_landscape:Kd(`android_10_tablet_portrait`),playstore_feature_graphic:Gd.playstore_feature_graphic};function Jd(e){return qd[e].label}function Yd(e){let t=L[e],n=qd[e];return`${t.w} × ${t.h} · ${n.device}`}var Xd=[{slug:`bold-minimal`,name:`Bold Minimal`,description:`Clean, confident, lots of whitespace, one accent — modern SaaS / productivity`,match:[`bold minimal`,`minimalist`,`minimal`,`clean`,`simple`]},{slug:`vibrant-gradient`,name:`Vibrant Gradient`,description:`Rich gradient backgrounds, bold white type, glassy depth — modern consumer apps`,match:[`vibrant gradient`,`vibrant`,`gradient look`,`colorful`,`colourful`,`bold gradient`]},{slug:`editorial-serif`,name:`Editorial Serif`,description:`Premium cream + ink, serif display with an italic gold accent — lifestyle / premium`,match:[`editorial serif`,`editorial`,`serif`,`premium`,`magazine`,`elegant`,`luxury`]},{slug:`playful-pastel`,name:`Playful Pastel`,description:`Soft pastel gradients, rounded shapes, friendly — social / casual apps`,match:[`playful pastel`,`pastel`,`playful`,`cute`,`friendly`,`soft`]}],Zd=[`Studying your screenshots…`,`Art directing the layout…`,`Writing the copy…`,`Placing your assets…`,`Finishing up…`],Qd=10,$d=[{label:`iPhone`,factors:[`iphone_portrait`,`iphone_landscape`]},{label:`iPad`,factors:[`ipad_portrait`,`ipad_landscape`]},{label:`Android Phone`,factors:[`android_phone_portrait`,`android_phone_landscape`]},{label:`Android Tablet`,factors:[`android_10_tablet_portrait`,`android_10_tablet_landscape`]},{label:`Marketing`,factors:[`playstore_feature_graphic`]}];function ef(e){let t=Jd(e);return e.endsWith(`_landscape`)?t+` (Landscape)`:e===`playstore_feature_graphic`?`Feature Graphic`:t}function tf(e){return e===`playstore_feature_graphic`?`Feature Graphic`:e.endsWith(`_landscape`)?`Landscape`:e.endsWith(`_portrait`)?`Portrait`:ef(e)}function nf(e){return e===`iPhone`?re:e===`Marketing`?P:De}function rf(){return document.querySelector(`meta[name="csrf-token"]`)?.getAttribute(`content`)??``}async function af(e,t,n,r){let i=new FormData;i.append(`name`,e),t.forEach(e=>i.append(`active_form_factors[]`,e)),n.forEach(e=>i.append(`active_locales[]`,e)),i.append(`default_locale`,r);let a=await fetch(`/projects`,{method:`POST`,headers:{"X-CSRF-TOKEN":rf(),Accept:`application/json`,"X-Return-Json":`1`},credentials:`same-origin`,body:i});if(!a.ok){let e=await a.json().catch(()=>({})),t=a.status===402?`You've reached your plan's project limit. Upgrade to create more.`:a.status===401||a.status===419?`Your session expired. Refresh the page and try again.`:`Couldn't create the project. Please try again.`;throw Error(e.message??t)}return a.json()}async function of(e,t){let n=new FormData;n.append(`project_id`,String(e)),n.append(`file`,t);let r=await fetch(`/ai/stage-asset`,{method:`POST`,headers:{"X-CSRF-TOKEN":rf(),Accept:`application/json`,"X-Requested-With":`XMLHttpRequest`},credentials:`same-origin`,body:n}),i=await r.json().catch(()=>({}));if(!r.ok||!i.ok||!i.path){let e=r.status===402?i.message??`You've reached your plan's storage limit.`:r.status===401||r.status===419?`Your session expired. Refresh the page and try again.`:i.message??`Couldn't upload a screenshot. Please try again.`;throw Error(e)}return i.path}async function sf(e,t=4){let n=Array(e.length),r=0;async function i(){for(;r<e.length;){let t=r++;n[t]=await e[t]()}}return await Promise.all(Array.from({length:Math.min(t,e.length)},i)),n}function cf({locales:e,selected:t,defaultCode:n,onToggle:r}){let[i,a]=(0,z.useState)(``),o=e.filter(e=>e.name.toLowerCase().includes(i.toLowerCase())||e.native_name.toLowerCase().includes(i.toLowerCase())||e.code.toLowerCase().includes(i.toLowerCase()));return(0,B.jsx)(`div`,{className:`space-y-2`,children:(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[t.map(i=>{let a=e.find(e=>e.code===i),o=i===n,s=t.length>1;return(0,B.jsxs)(`span`,{className:w(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2 text-[11px] font-medium`,o?`border-accent/40 bg-accent/10 text-foreground`:`border-border bg-background text-foreground`),children:[(0,B.jsx)(`span`,{children:a?.native_name??i}),o&&(0,B.jsx)(`span`,{className:`rounded-sm bg-accent/15 px-1 text-[9px] uppercase tracking-wider text-accent`,children:`default`}),!o&&s&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(i),className:`ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Remove ${a?.name??i}`,children:(0,B.jsx)(D,{className:`h-3 w-3`,strokeWidth:2.5})})]},i)}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(b,{placeholder:`Add locale…`,value:i,onChange:e=>a(e.target.value),className:`h-7 w-28 rounded-full px-3 text-[11px]`}),i.length>0&&o.length>0&&(0,B.jsx)(`div`,{className:`absolute left-0 top-8 z-50 max-h-40 w-48 overflow-y-auto rounded-lg border border-border bg-card py-1 shadow-lg`,children:o.slice(0,20).map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{r(e.code),a(``)},className:w(`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors hover:bg-muted`,t.includes(e.code)&&`text-muted-foreground line-through`),children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.native_name}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.code})]},e.code))})]})]})})}function lf({shots:e,max:t,onAdd:n,onRemove:r,onReorder:i}){let a=(0,z.useRef)(null),o=(0,z.useRef)(null),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),d=e.length>=t;return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[e.length>0&&(0,B.jsx)(`div`,{className:`grid grid-cols-5 gap-2`,children:e.map((e,t)=>(0,B.jsxs)(`div`,{draggable:!0,onDragStart:e=>{o.current=t,e.dataTransfer.effectAllowed=`move`},onDragOver:e=>{o.current!==null&&(e.preventDefault(),u(t))},onDragLeave:()=>u(e=>e===t?null:e),onDrop:e=>{o.current!==null&&(e.preventDefault(),e.stopPropagation(),o.current!==t&&i(o.current,t),o.current=null,u(null))},onDragEnd:()=>{o.current=null,u(null)},className:w(`group relative aspect-[9/19] cursor-move overflow-hidden rounded-lg border bg-muted/20 transition-shadow`,l===t?`border-accent ring-2 ring-accent/40`:`border-border`),children:[(0,B.jsx)(`img`,{src:e.url,alt:``,className:`pointer-events-none h-full w-full object-cover`}),(0,B.jsx)(`span`,{className:`absolute left-1 top-1 rounded bg-black/55 px-1 text-[9px] font-medium text-white`,children:t+1}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(t),className:`absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full bg-black/60 text-white hover:bg-black/80`,children:(0,B.jsx)(D,{className:`h-3 w-3`})})]},e.url))}),!d&&(0,B.jsxs)(`div`,{role:`button`,tabIndex:0,className:w(`flex flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-5 text-center transition-colors cursor-pointer`,s?`border-accent bg-accent/5`:`border-border bg-muted/10 hover:border-accent/40 hover:bg-muted/20`),onDragEnter:()=>c(!0),onDragLeave:()=>c(!1),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),c(!1),e.dataTransfer.files.length&&n(Array.from(e.dataTransfer.files))},onClick:()=>a.current?.click(),onKeyDown:e=>e.key===`Enter`&&a.current?.click(),children:[(0,B.jsx)(ae,{className:`h-5 w-5 text-muted-foreground`,strokeWidth:1.5}),(0,B.jsxs)(`p`,{className:`text-sm text-foreground`,children:[e.length>0?`Add more`:`Drop screenshots or`,` `,(0,B.jsx)(`span`,{className:`text-accent`,children:`browse`})]}),(0,B.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Select multiple · PNG or JPG · `,t-e.length,` slot`,t-e.length===1?``:`s`,` left`]})]}),(0,B.jsx)(`input`,{ref:a,type:`file`,accept:`image/png,image/jpeg`,multiple:!0,className:`sr-only`,onChange:e=>{let t=e.target.files?Array.from(e.target.files):[];e.target.value=``,t.length&&n(t)}})]})}function uf({active:e,onClick:t,title:n,desc:r}){return(0,B.jsxs)(`button`,{type:`button`,onClick:t,"aria-pressed":e,className:w(`rounded-lg border px-3 py-2 text-left transition-colors`,e?`border-accent bg-accent/10`:`border-border bg-card hover:bg-muted/40`),children:[(0,B.jsx)(`div`,{className:`text-[12px] font-medium text-foreground`,children:n}),(0,B.jsx)(`div`,{className:`text-[11px] leading-tight text-muted-foreground`,children:r})]})}function df({project:e,onClose:t,forcedKit:n=null}){let{locales:i=[]}=r().props,a=p(e=>e.openModal),s=e===null,c=s||e.is_blank===!0,l=s?[`basics`,`devices`,`assets`]:[`basics`,`assets`],[u,d]=(0,z.useState)(0),f=l[u],m=u===l.length-1,[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(``),[x,C]=(0,z.useState)(`match`),[T,O]=(0,z.useState)([`iphone_portrait`]),[k,A]=(0,z.useState)([`en`]),ee=k[0]??`en`;function M(e){O(t=>t.includes(e)?t.length>1?t.filter(t=>t!==e):t:[...t,e])}function P(e){A(t=>t.includes(e)?t.length>1?t.filter(t=>t!==e):t:[...t,e])}let[F,I]=(0,z.useState)(null),[ne,re]=(0,z.useState)(null),[ie,oe]=(0,z.useState)(!1),se=(0,z.useRef)(null),[ce,le]=(0,z.useState)(!0),[ue,de]=(0,z.useState)({}),[fe,pe]=(0,z.useState)(!1),[L,me]=(0,z.useState)(0),[he,ge]=(0,z.useState)(null),_e=(0,z.useRef)(null),ve=(0,z.useRef)(null);(0,z.useEffect)(()=>{he&&_e.current?.scrollIntoView({behavior:`smooth`,block:`nearest`})},[he]),(0,z.useEffect)(()=>(fe?(me(0),ve.current=setInterval(()=>me(e=>(e+1)%Zd.length),2500)):ve.current&&clearInterval(ve.current),()=>{ve.current&&clearInterval(ve.current)}),[fe]),(0,z.useEffect)(()=>()=>{ne&&URL.revokeObjectURL(ne),Object.values(ue).forEach(e=>e.forEach(e=>URL.revokeObjectURL(e.url)))},[]);let ye=(0,z.useCallback)(e=>{if(![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)||e.size>2*1024*1024)return;I(e);let t=URL.createObjectURL(e);re(e=>(e&&URL.revokeObjectURL(e),t))},[]),be=()=>{ne&&URL.revokeObjectURL(ne),I(null),re(null)},xe=(0,z.useCallback)((e,t)=>{de(n=>{let r=n[e]??[],i=Qd-r.length,a=t.filter(e=>[`image/png`,`image/jpeg`].includes(e.type)).slice(0,Math.max(0,i)).map(e=>({file:e,url:URL.createObjectURL(e)}));return a.length?{...n,[e]:[...r,...a]}:n})},[]),R=(0,z.useCallback)((e,t)=>{de(n=>{let r=n[e]??[];return r[t]&&URL.revokeObjectURL(r[t].url),{...n,[e]:r.filter((e,n)=>n!==t)}})},[]),Se=(0,z.useCallback)((e,t,n)=>{de(r=>{let i=[...r[e]??[]];if(t<0||t>=i.length||n<0||n>=i.length||t===n)return r;let[a]=i.splice(t,1);return i.splice(n,0,a),{...r,[e]:i}})},[]),Ce=s?T:e?.active_form_factors??[`iphone_portrait`],we=s?k:e?.active_locales??[`en`],Te=Ce.filter(e=>e!==`playstore_feature_graphic`),Ee=_.trim().length>0&&(!s||h.trim().length>0),De=T.length>0,Oe=Object.values(ue).some(e=>e.length>0),ke=Te.length===0||Oe;function Ae(e){return e===`basics`?Ee:e===`devices`?De:ke}let V=async()=>{if(!s&&e&&e.is_blank!==!0&&e.screens_count>0&&!window.confirm(`This replaces the ${e.screens_count} screen${e.screens_count===1?``:`s`} in “${e.name}” with a new AI-generated set. This can’t be undone. Continue?`))return;ge(null),pe(!0);let t;if(s)try{t=(await af(h.trim(),T,k,ee)).project_id}catch(e){ge({message:e instanceof Error?e.message:`Could not create project.`}),pe(!1);return}else t=e.id;let r=new FormData;r.append(`project_id`,String(t));let i=(s?h.trim():e?.name??``).trim();r.append(`app_name`,i||`My App`),r.append(`app_description`,_.trim()),c&&(n||x===`kit`?(r.append(`template_source`,`kit`),r.append(`kit_key`,n?n.key:`auto`)):x===`match`?r.append(`template_source`,`generate`):(r.append(`template_source`,`generate`),r.append(`named_style`,x)));try{if(F&&r.append(`staged_logo`,await of(t,F)),ce||Te.length<=1)for(let e of we)(await sf((ue[`shared:${e}`]??[]).map(e=>()=>of(t,e.file)))).forEach((t,n)=>r.append(`staged_screenshots[${e}][${n}]`,t));else for(let e of Te)for(let n of we)(await sf((ue[`${e}:${n}`]??[]).map(e=>()=>of(t,e.file)))).forEach((t,i)=>r.append(`staged_device_screenshots[${e}][${n}][${i}]`,t))}catch(e){ge({message:e instanceof Error?e.message:`Could not upload your screenshots. Please try again.`}),pe(!1);return}try{let e=await fetch(`/ai/generate`,{method:`POST`,headers:{"X-CSRF-TOKEN":rf(),Accept:`application/json`,"X-Requested-With":`XMLHttpRequest`},credentials:`same-origin`,body:r}),t=await e.json().catch(()=>({}));if(e.ok&&t.ok&&t.project_id){o.visit(`/editor/${t.project_id}`);return}let n=t.errors?Object.values(t.errors)[0]?.[0]:void 0,i;i=e.ok?`Generation finished, but we couldn't open the result automatically. Check your Projects — it may already be there.`:e.status===401||e.status===419?`Your session expired. Refresh the page, sign in again, and retry.`:e.status===402?`You've reached a plan or monthly AI limit. Upgrade your plan or wait for your quota to reset.`:e.status===403?`AI generation isn't available on this account.`:e.status===409?`A generation is already running for this project. Wait a moment, then try again.`:e.status===429?`You've made too many requests in a short time. Take a short break and try again.`:e.status>=500?`The AI service had a temporary problem. Please try again in a moment.`:`Something went wrong while generating. Please try again.`,ge({message:n??t.message??i,reason:t.reason,status:e.status})}catch{ge({message:`Network error — check your connection and try again.`})}finally{pe(!1)}},je=()=>{m?V():d(e=>e+1)},Me={basics:n?`Tell us about your app`:`Brief the AI`,devices:`Devices & locales`,assets:`Attach your assets`},Ne={basics:n?`AI writes the headlines and copy to fit the ${n.name} template — the more you share, the sharper they read.`:``,devices:`Pick which devices and languages to generate for.`,assets:n?`Add your logo and app screenshots — they fill the template’s brand slots and device frames.`:`Add your logo and app screenshots — they fill the chosen template’s brand slots and device frames.`};return(0,B.jsxs)(y,{open:!0,onClose:()=>{fe||t()},closeOnEsc:!fe,size:`lg`,"aria-labelledby":`ai-gen-title`,children:[(0,B.jsx)(y.Header,{titleId:`ai-gen-title`,eyebrow:fe?`Generating`:`Step ${u+1} of ${l.length}`,title:fe?`Creating your screenshots`:Me[f],subtitle:fe?`Hang tight — this usually takes 20–60 seconds.`:Ne[f],actions:(0,B.jsx)(`button`,{type:`button`,onClick:t,disabled:fe,"aria-label":`Close`,className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40`,children:(0,B.jsx)(D,{className:`h-4 w-4`})})}),(0,B.jsxs)(y.Body,{children:[(0,B.jsxs)(`div`,{className:fe?`hidden`:`contents`,children:[f===`basics`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[s&&(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`label`,{htmlFor:`ai-project-name`,className:`text-[11px] font-medium text-muted-foreground`,children:[`Project name `,(0,B.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,B.jsx)(b,{id:`ai-project-name`,placeholder:`e.g. FocusFlow iOS screenshots`,maxLength:120,value:h,onChange:e=>g(e.target.value),autoFocus:!0})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsxs)(`label`,{htmlFor:`ai-description`,className:`text-[11px] font-medium text-muted-foreground`,children:[`About your app `,(0,B.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,B.jsx)(S,{multiline:!0,side:`bottom-start`,label:(0,B.jsxs)(`div`,{className:`w-[240px] space-y-1 text-left font-normal leading-relaxed`,children:[(0,B.jsx)(`p`,{className:`font-medium`,children:`What to write here`}),(0,B.jsxs)(`ul`,{className:`list-disc space-y-0.5 pl-4 marker:text-background/50`,children:[(0,B.jsx)(`li`,{children:`What the app does, in one plain sentence.`}),(0,B.jsx)(`li`,{children:`Who it's for (e.g. busy professionals, students).`}),(0,B.jsxs)(`li`,{children:[`The features or benefits to highlight — `,(0,B.jsx)(`strong`,{children:`one per screen`}),`, since each becomes a headline.`]}),(0,B.jsxs)(`li`,{children:[`The tone of the copy — e.g. `,(0,B.jsx)(`em`,{children:`calm & reassuring`}),`, `,(0,B.jsx)(`em`,{children:`bold & confident`}),`, `,(0,B.jsx)(`em`,{children:`playful`}),`.`]}),(0,B.jsx)(`li`,{children:`Any exact words or phrases the headlines must use.`})]}),(0,B.jsx)(`p`,{className:`pt-0.5 text-background/70`,children:`Write a brief, not a slogan — describe the product and let the AI craft the headlines.`})]}),children:(0,B.jsx)(`button`,{type:`button`,"aria-label":`Tips for the best result`,className:`inline-flex text-muted-foreground/50 transition-colors hover:text-muted-foreground focus:text-muted-foreground focus:outline-none`,children:(0,B.jsx)(E,{className:`h-3.5 w-3.5`})})})]}),(0,B.jsxs)(`span`,{className:w(`text-[11px] tabular-nums`,_.length>1400?`text-destructive`:`text-muted-foreground/60`),children:[_.length,`/1500`]})]}),(0,B.jsx)(`textarea`,{id:`ai-description`,placeholder:`e.g. FocusFlow is a habit tracker for busy professionals. Highlight the AI habit coach, streak tracking, and daily focus timer. Tone: encouraging and calm.`,maxLength:1500,rows:5,value:_,autoFocus:!s,onChange:e=>v(e.target.value),className:`block w-full rounded-lg border border-border bg-card px-3 py-2 text-sm text-foreground shadow-sm transition-colors placeholder:text-muted-foreground/60 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/30 resize-none`})]}),c&&!n&&(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`Design style `,(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`(optional)`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,B.jsx)(uf,{active:x===`match`,onClick:()=>C(`match`),title:`Match my app ✦`,desc:`Colours, decoration & layout from your screenshots`}),(0,B.jsx)(uf,{active:x===`kit`,onClick:()=>C(`kit`),title:`Use a kit`,desc:`Fill an AI-picked premium template`}),Xd.map(e=>(0,B.jsx)(uf,{active:x===e.slug,onClick:()=>C(e.slug),title:e.name,desc:e.description},e.slug))]}),(0,B.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:x===`match`?`The AI reads your screenshots and designs an on-brand deck around their real colours.`:x===`kit`?`AI picks the best-fit kit and writes the copy to match your app.`:`Designs from scratch in this style — colours still taken from your screenshots.`})]})]}),f===`devices`&&(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Devices`}),(0,B.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:$d.map(e=>(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/60`,children:[(0,B.jsx)(nf(e.label),{className:`h-3 w-3`}),(0,B.jsx)(`span`,{children:e.label})]}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.factors.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>M(e),className:w(`inline-flex h-7 items-center rounded-full border px-3 text-[11px] font-medium transition-all`,T.includes(e)?`border-accent/40 bg-accent/10 text-accent`:`border-border bg-background text-muted-foreground hover:border-accent/30 hover:text-foreground`),children:tf(e)},e))})]},e.label))})]}),i.length>0&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Languages`}),(0,B.jsx)(cf,{locales:i,selected:k,defaultCode:ee,onToggle:P}),(0,B.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60`,children:`AI writes copy in the default language. Add more to set up locale slots.`})]})]}),f===`assets`&&(0,B.jsxs)(`div`,{className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-10 -mx-6 flex items-start justify-between gap-3 bg-card px-6 py-1`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`App screenshots`,` `,Te.length===0?(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`(optional)`}):(0,B.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,B.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground/60`,children:[`Select multiple — one per screen, in order.`,` `,Te.length>1&&(ce||Te.length<=1)?`AI resizes them to every device.`:`AI fits them to the device.`]})]}),Te.length>1&&(0,B.jsxs)(`label`,{className:`flex shrink-0 cursor-pointer items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:e=>le(e.target.checked),className:`h-3.5 w-3.5 rounded border-border accent-accent`}),`Same for all devices`]})]}),ce||Te.length<=1?(0,B.jsx)(`div`,{className:`space-y-3`,children:we.map(e=>(0,B.jsxs)(`div`,{children:[we.length>1&&(0,B.jsx)(`p`,{className:`mb-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/60`,children:i.find(t=>t.code===e)?.native_name??e}),(0,B.jsx)(lf,{shots:ue[`shared:${e}`]??[],max:Qd,onAdd:t=>xe(`shared:${e}`,t),onRemove:t=>R(`shared:${e}`,t),onReorder:(t,n)=>Se(`shared:${e}`,t,n)})]},e))}):(0,B.jsx)(`div`,{className:`space-y-4`,children:Te.map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/60`,children:ef(e)}),(0,B.jsx)(`div`,{className:`space-y-3`,children:we.map(t=>(0,B.jsxs)(`div`,{children:[we.length>1&&(0,B.jsx)(`p`,{className:`mb-1.5 text-[10px] text-muted-foreground/50`,children:i.find(e=>e.code===t)?.native_name??t}),(0,B.jsx)(lf,{shots:ue[`${e}:${t}`]??[],max:Qd,onAdd:n=>xe(`${e}:${t}`,n),onRemove:n=>R(`${e}:${t}`,n),onReorder:(n,r)=>Se(`${e}:${t}`,n,r)})]},t))})]},e))})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`p`,{className:`sticky top-0 z-10 -mx-6 bg-card px-6 py-1 text-[11px] font-medium text-muted-foreground`,children:[`App logo `,(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`(optional)`})]}),ne?(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`img`,{src:ne,alt:`Logo preview`,className:`h-10 w-10 rounded-lg border border-border object-contain bg-muted/30`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-[13px] text-foreground`,children:F?.name}),(0,B.jsx)(`button`,{type:`button`,onClick:be,className:`mt-0.5 text-[11px] text-destructive hover:underline`,children:`Remove`})]})]}):(0,B.jsxs)(`div`,{role:`button`,tabIndex:0,className:w(`flex items-center gap-2 rounded-lg border-2 border-dashed px-3 py-2.5 transition-colors cursor-pointer`,ie?`border-accent bg-accent/5`:`border-border bg-muted/20 hover:border-accent/50 hover:bg-muted/40`),onDragEnter:()=>oe(!0),onDragLeave:()=>oe(!1),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),oe(!1);let t=e.dataTransfer.files[0];t&&ye(t)},onClick:()=>se.current?.click(),onKeyDown:e=>e.key===`Enter`&&se.current?.click(),children:[(0,B.jsx)(ae,{className:`h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}),(0,B.jsxs)(`span`,{className:`text-[13px] text-foreground`,children:[`Drop your logo or`,` `,(0,B.jsx)(`span`,{className:`text-accent`,children:`browse`})]}),(0,B.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground`,children:`PNG/JPG/WebP · 2 MB`})]}),(0,B.jsx)(`input`,{ref:se,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,onChange:e=>{let t=e.target.files?.[0];t&&ye(t),e.target.value=``}})]})]}),he&&(0,B.jsx)(`div`,{ref:_e,className:`rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:he.status===402&&he.reason===`plan`?(0,B.jsxs)(B.Fragment,{children:[`AI generation requires a Pro plan.`,` `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>{t(),a(`ai`)},className:`font-medium underline underline-offset-2 hover:no-underline`,children:`Upgrade →`})]}):he.status===402&&he.reason===`member_quota`?`You've used your AI generation allowance for this workspace. Ask the workspace owner to raise it.`:he.status===402&&he.reason===`pool_quota`?`This workspace has used its monthly AI generation quota. It resets at the start of next month — or the workspace owner can raise the limit.`:he.status===402&&he.reason===`storage`?(0,B.jsxs)(B.Fragment,{children:[`You've reached your plan's storage limit.`,` `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>{t(),a(`general`)},className:`font-medium underline underline-offset-2 hover:no-underline`,children:`Upgrade →`}),` `,`or remove some uploads.`]}):he.message})]}),fe&&(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-10 text-center`,children:[(0,B.jsx)(j,{className:`h-8 w-8 animate-spin text-accent`}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`p`,{className:`animate-fade-in text-base font-medium text-foreground`,children:Zd[L]},L),(0,B.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This usually takes 20–60 seconds. Please keep this window open.`})]}),(0,B.jsx)(`ol`,{className:`flex items-center gap-1.5`,"aria-hidden":!0,children:Zd.map((e,t)=>(0,B.jsx)(`li`,{className:w(`h-1.5 rounded-full transition-all`,t===L?`w-6 bg-accent`:t<L?`w-1.5 bg-accent/40`:`w-1.5 bg-border`)},t))})]})]}),(0,B.jsxs)(y.Footer,{children:[u>0&&!fe&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(e=>e-1),className:`inline-flex h-9 items-center rounded-lg px-4 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:`Back`}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`button`,{type:`button`,onClick:t,disabled:fe,className:`inline-flex h-9 items-center rounded-lg border border-border px-4 text-sm text-foreground transition-colors hover:bg-muted disabled:pointer-events-none disabled:opacity-50`,children:`Cancel`}),(0,B.jsxs)(`button`,{type:`button`,onClick:je,disabled:fe||!Ae(f),className:`inline-flex h-9 items-center gap-1.5 rounded-lg bg-accent px-4 text-sm font-medium text-white transition-colors hover:bg-accent/90 disabled:pointer-events-none disabled:opacity-50`,children:[fe?(0,B.jsx)(j,{className:`h-3.5 w-3.5 animate-spin`}):m?(0,B.jsx)(N,{className:`h-3.5 w-3.5`}):(0,B.jsx)(te,{className:`h-3.5 w-3.5`}),fe?`Generating…`:m?`Generate`:`Next`]})]})]})}var ff=t({LocalePicker:()=>If,default:()=>wf}),pf=`en`,mf=`iphone_portrait`,hf=[{key:`coral-cream`,name:`Coral cream`,bg:`#F0E8DE`,accent:`#D85A30`},{key:`ink-mint`,name:`Ink mint`,bg:`#04342C`,accent:`#5DCAA5`},{key:`peach-forest`,name:`Peach forest`,bg:`#FAEEDA`,accent:`#3B6D11`},{key:`lavender-plum`,name:`Lavender plum`,bg:`#EEEDFE`,accent:`#534AB7`},{key:`sky-indigo`,name:`Sky indigo`,bg:`#E6F1FB`,accent:`#185FA5`},{key:`charcoal-lemon`,name:`Charcoal lemon`,bg:`#1A1A1A`,accent:`#F5D547`}],gf=hf[0];function _f(e,t){return e?e.bg.toLowerCase()===t.bg.toLowerCase()&&e.accent.toLowerCase()===t.accent.toLowerCase():!1}var vf=[`iphone_portrait`,`ipad_portrait`,`android_phone_portrait`,`android_10_tablet_portrait`],yf=[`iphone_landscape`,`ipad_landscape`,`android_phone_landscape`,`android_10_tablet_landscape`],bf=[`playstore_feature_graphic`],xf={iphone_portrait:Jd(`iphone_portrait`),ipad_portrait:Jd(`ipad_portrait`),android_phone_portrait:Jd(`android_phone_portrait`),android_10_tablet_portrait:Jd(`android_10_tablet_portrait`),iphone_landscape:Jd(`iphone_landscape`),ipad_landscape:Jd(`ipad_landscape`),android_phone_landscape:Jd(`android_phone_landscape`),android_10_tablet_landscape:Jd(`android_10_tablet_landscape`),playstore_feature_graphic:Jd(`playstore_feature_graphic`)},Sf=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function Cf(e){if(!e)return`—`;let t=new Date(e).getTime()-Date.now(),n=Math.abs(t)/6e4;return n<1?`just now`:n<60?Sf.format(Math.round(t/6e4),`minute`):n<1440?Sf.format(Math.round(t/36e5),`hour`):n<1440*30?Sf.format(Math.round(t/864e5),`day`):n<1440*365?Sf.format(Math.round(t/(864e5*30)),`month`):Sf.format(Math.round(t/(864e5*365)),`year`)}function wf({projects:e,templates:t,aiEnabled:n=!1}){let i=r().props,{flash:o,canAuthorKits:c,auth:l}=i,u=i.locales??[],d=p(e=>e.openModal),f=i.workspaces?.active.role??l.user?.role??`editor`,h=f!==`viewer`,x=i.workspaces!=null&&(f===`owner`||f===`admin`),{data:S,setData:w,post:T,processing:E,errors:D,reset:O,clearErrors:k}=a({name:``,template:void 0,form_factor:mf,active_form_factors:[...vf],default_locale:pf,active_locales:[pf],design_tokens:{bg:gf.bg,accent:gf.accent}}),[A,j]=(0,z.useState)(null),[ee,M]=(0,z.useState)(null),[P,F]=(0,z.useState)(null),[I,te]=(0,z.useState)(null),[ne,re]=(0,z.useState)(null),[ie,ae]=(0,z.useState)(null),[oe,ce]=(0,z.useState)(null),[le,ue]=(0,z.useState)(null),[de,fe]=(0,z.useState)(!1),[pe,L]=(0,z.useState)(!1),[me,he]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(null),ve=(0,z.useRef)(null),ye=t??[],be=e=>{te(e)},xe=()=>{w({name:``,template:void 0,form_factor:mf,active_form_factors:[...vf],default_locale:pf,active_locales:[pf],design_tokens:{bg:gf.bg,accent:gf.accent}}),k(),j({kind:`blank`})},R=e=>{let t=e.active_form_factors.length>0?e.active_form_factors:[e.form_factor],n=t.filter(e=>vf.includes(e)),r=n.length>0?n:t,i=r.includes(e.form_factor)?e.form_factor:r[0];w({name:``,template:e.key,form_factor:i,active_form_factors:r,default_locale:pf,active_locales:[pf],design_tokens:null}),k(),j({kind:`template`,template:e})},we=e=>{if(S.active_form_factors.includes(e)){let t=S.active_form_factors.filter(t=>t!==e);if(t.length===0)return;w(e=>({...e,active_form_factors:t,form_factor:t[0]}))}else{let t=[...S.active_form_factors,e];w(e=>({...e,active_form_factors:t,form_factor:t[0]}))}},Te=e=>{if(S.active_locales.includes(e)){let t=S.active_locales.filter(t=>t!==e);if(t.length===0)return;w(n=>({...n,active_locales:t,default_locale:e===n.default_locale?t[0]:n.default_locale}))}else w(`active_locales`,[...S.active_locales,e])},Ee=e=>{S.active_locales.includes(e)&&w(`default_locale`,e)},De=()=>{j(null),O(),k()};(0,z.useEffect)(()=>{if(!A)return;let e=window.setTimeout(()=>ve.current?.focus(),0);return()=>window.clearTimeout(e)},[A]),(0,z.useEffect)(()=>{if(typeof window>`u`)return;let e=new URLSearchParams(window.location.search),t=e.get(`kit`);if(!t)return;let n=ye.find(e=>e.key===t);n&&(n.isPremium&&l.user!==null&&!l.user.can_use_premium_kits?_e(n):R(n)),e.delete(`kit`);let r=window.location.pathname+(e.toString()?`?${e.toString()}`:``)+window.location.hash;window.history.replaceState(window.history.state,``,r)},[ye]);let Oe=e=>{e.preventDefault(),S.name.trim()&&S.active_form_factors.length!==0&&T(`/projects`,{onSuccess:()=>{O(),k(),j(null)}})},ke=A?.kind===`template`?A.template.name:`New project`,Ae=A?.kind===`template`?A.template.description??`Scaffold a kit of screens to start from.`:`We'll create one empty screen. Brand colors are optional — add them now to pre-fill the canvas, or leave them and skip ahead.`;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(s,{title:`Projects`}),(0,B.jsxs)(`div`,{className:`flex min-h-screen flex-col bg-background text-foreground`,children:[(0,B.jsx)(m,{}),(0,B.jsxs)(`main`,{className:`mx-auto w-full max-w-5xl flex-1 px-6 py-12`,children:[(0,B.jsx)(C,{size:`lg`,children:`Projects`}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`One design, every device, every locale.`}),(0,B.jsx)(Se,{}),o.success&&(0,B.jsx)(`div`,{className:`mt-6 rounded-lg border border-success/30 bg-success/5 px-4 py-2 text-sm text-success`,children:o.success}),o.error&&(0,B.jsxs)(`div`,{className:`mt-6 flex items-center justify-between gap-4 rounded-lg border border-warning/30 bg-warning/10 px-4 py-2 text-sm text-foreground`,"data-testid":`projects-plan-gate`,children:[(0,B.jsx)(`span`,{children:o.error}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(`projects`),className:`shrink-0 text-sm font-medium underline-offset-4 hover:underline`,"data-testid":`projects-plan-gate-upgrade`,children:`Upgrade plan`})]}),h&&(0,B.jsxs)(`section`,{className:`mt-10`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between gap-4`,children:(0,B.jsx)(`h2`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Start a project`})}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-3 ${n?`sm:grid-cols-3`:`sm:grid-cols-2`}`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>xe(),"data-testid":`template-card-blank`,className:`text-left`,children:(0,B.jsxs)(v,{variant:`interactive`,padding:`lg`,className:`h-full border-dashed bg-muted/20`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsx)(`h4`,{className:`text-lg tracking-[-0.01em] text-foreground`,children:`Blank project`}),(0,B.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground`,children:`1 screen`})]}),(0,B.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:`Start from an empty canvas. Pick which form factors to author.`})]})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>L(!0),"data-testid":`template-browse-all`,className:`text-left`,children:(0,B.jsxs)(v,{variant:`interactive`,padding:`lg`,className:`h-full border-dashed bg-muted/10`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsx)(`h4`,{className:`text-lg tracking-[-0.01em] text-foreground`,children:`Start with template`}),(0,B.jsx)(`span`,{className:`text-[11px] font-medium text-accent`,children:`→`})]}),(0,B.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:ye.length===0?`No templates installed yet.`:`${ye.length} ${ye.length===1?`template`:`templates`} ready to scaffold a project.`})]})}),n&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(!0),"data-testid":`template-card-ai`,className:`text-left`,children:(0,B.jsxs)(v,{variant:`interactive`,padding:`lg`,className:`h-full border-dashed bg-accent/5`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsx)(`h4`,{className:`text-lg tracking-[-0.01em] text-foreground`,children:`Generate with AI`}),(0,B.jsx)(N,{className:`h-4 w-4 shrink-0 text-accent`,strokeWidth:1.5})]}),(0,B.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:`Describe your app and let AI write the copy and choose a design.`})]})})]})]}),(0,B.jsxs)(`section`,{className:`mt-10`,children:[(0,B.jsx)(`h2`,{className:`text-[11px] font-medium text-muted-foreground`,children:e.length===0?`No projects yet`:`${e.length} project${e.length===1?``:`s`}`}),e.length===0?(0,B.jsx)(v,{variant:`dashed`,padding:`lg`,className:`mt-4 py-16 text-center text-sm text-muted-foreground`,"data-testid":`projects-empty`,children:h?`Create your first project to open the editor.`:`No projects have been shared with you yet.`}):(0,B.jsx)(`ul`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:e.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsx)(Gf,{project:e,canAuthorKits:c,canEdit:h,canShare:x,locales:u,aiEnabled:n,onRename:()=>M(e),onDuplicate:()=>be(e),onExportTemplate:()=>re(e),onShare:()=>ae(e),onDelete:()=>F(e),onDetails:()=>ce(e),onGenerate:()=>ue(e)})},e.id))})]})]})]}),ee&&(0,B.jsx)(qf,{project:ee,onClose:()=>M(null)}),I&&(0,B.jsx)(Jf,{project:I,locales:u,onClose:()=>te(null)}),P&&(0,B.jsx)(Yf,{project:P,onClose:()=>F(null)}),ne&&(0,B.jsx)(Wd,{project:ne,onClose:()=>re(null)}),ie&&(0,B.jsx)(Ce,{project:{id:ie.id,name:ie.name},onClose:()=>ae(null)}),oe&&(0,B.jsx)(Wf,{project:{id:oe.id,name:oe.name},onClose:()=>ce(null)}),le&&(0,B.jsx)(df,{project:le,onClose:()=>ue(null)}),de&&(0,B.jsx)(df,{project:null,onClose:()=>fe(!1)}),me&&(0,B.jsx)(df,{project:null,forcedKit:{key:me.key,name:me.name,activeFormFactors:me.active_form_factors},onClose:()=>he(null)}),pe&&(0,B.jsx)(Xf,{templates:ye,aiEnabled:n,onClose:()=>L(!1),onPick:e=>{L(!1),R(e)},onAiFill:e=>{L(!1),he(e)}}),(0,B.jsx)(se,{open:ge!==null,onClose:()=>_e(null),kitName:ge?.name??``,onUpgrade:()=>d(`premium_kits`)}),(0,B.jsx)(y,{open:!!A,onClose:De,onSubmit:Oe,size:`md`,children:A&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(y.Header,{eyebrow:A.kind===`template`?`Template`:void 0,title:ke,subtitle:Ae}),(0,B.jsxs)(y.Body,{children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(g,{htmlFor:`template-name`,children:`Name your project`}),(0,B.jsx)(b,{id:`template-name`,name:`name`,placeholder:`My awesome app`,required:!0,maxLength:120,ref:ve,value:S.name,onChange:e=>w(`name`,e.target.value),invalid:!!D.name,"aria-describedby":D.name?`template-name-error`:void 0,"data-testid":`template-name-input`}),D.name&&(0,B.jsx)(`p`,{id:`template-name-error`,className:`text-xs text-destructive`,children:D.name})]}),(0,B.jsx)(Mf,{selected:S.active_form_factors,onToggle:we,error:D.active_form_factors??D.form_factor,available:A.kind===`template`?A.template.active_form_factors:void 0,helper:A.kind===`template`?`Authored by the kit — pick which to scaffold`:void 0}),(0,B.jsx)(If,{locales:u,activeCodes:S.active_locales,defaultCode:S.default_locale,onToggle:Te,onSetDefault:Ee,error:D.active_locales}),A.kind===`blank`&&(0,B.jsx)(zf,{value:S.design_tokens??null,onChange:e=>w(`design_tokens`,e),bgError:D[`design_tokens.bg`],accentError:D[`design_tokens.accent`]})]}),(0,B.jsxs)(y.Footer,{children:[(0,B.jsx)(_,{type:`button`,variant:`ghost`,onClick:De,"data-testid":`template-cancel`,children:`Cancel`}),(0,B.jsx)(_,{type:`submit`,disabled:E||!S.name.trim()||S.active_form_factors.length===0,"data-testid":`template-create-submit`,children:E?`Creating…`:`Create`})]})]})})]})}function Tf({value:e,onPick:t,error:n,lockedReason:r}){let i=yf.includes(e),a=i?Te:Ee;return r?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsx)(g,{children:`Form factor`}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:r})]}),(0,B.jsxs)(`div`,{className:`inline-flex h-9 w-full items-center gap-2 rounded-md border border-border bg-muted/30 px-3 text-left text-[12px] font-medium text-muted-foreground`,"data-testid":`form-factor-locked`,"aria-readonly":`true`,children:[(0,B.jsx)(a,{className:`h-3.5 w-3.5`,strokeWidth:2,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`text-foreground`,children:xf[e]}),(0,B.jsx)(`span`,{className:`text-[10px]`,children:i?`Landscape`:`Portrait`})]})]}):(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsx)(g,{children:`Form factor`}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:`One per project — pick at create time`})]}),(0,B.jsx)(x,{align:`start`,trigger:({open:t,toggle:n})=>(0,B.jsxs)(`button`,{type:`button`,onClick:n,"data-testid":`form-factor-trigger`,"aria-expanded":t,className:`inline-flex h-9 w-full items-center justify-between gap-2 rounded-md border px-3 text-left text-[12px] font-medium transition-colors ${t?`border-accent bg-accent/5 text-foreground`:`border-border bg-background text-foreground hover:bg-muted/40`}`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-3.5 w-3.5 text-muted-foreground`,strokeWidth:2,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:xf[e]}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:i?`Landscape`:`Portrait`})]}),(0,B.jsx)(T,{className:`h-3.5 w-3.5 text-muted-foreground`,strokeWidth:2})]}),children:(0,B.jsxs)(`div`,{className:`flex w-[260px] flex-col py-1`,children:[(0,B.jsx)(Ff,{heading:`Portrait`,factors:vf,current:e,onPick:t}),(0,B.jsx)(Ff,{heading:`Landscape`,factors:yf,current:e,onPick:t})]})}),n&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,children:n})]})}var Ef={iphone:`iPhone 6.9"`,ipad:`iPad 13"`,android_phone:`Android Phone`,android_tablet:`Android Tablet`,playstore_marketing:`Play Store Feature`},Df={iphone_portrait:`iphone`,iphone_landscape:`iphone`,ipad_portrait:`ipad`,ipad_landscape:`ipad`,android_phone_portrait:`android_phone`,android_phone_landscape:`android_phone`,android_10_tablet_portrait:`android_tablet`,android_10_tablet_landscape:`android_tablet`,playstore_feature_graphic:`playstore_marketing`};function Of(e){let t=new Map;for(let n of e){let e=Df[n];if(!e)continue;let r=bf.includes(n),i=yf.includes(n),a=t.get(e);a?i?a.landscape=!0:r||(a.portrait=!0):t.set(e,{key:e,label:Ef[e]??e,portrait:!i&&!r,landscape:i,marketing:r,representative:n})}return Array.from(t.values())}function kf({factors:e,trailing:t}){return e.length===0?null:(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[Of(e).map(e=>(0,B.jsxs)(`span`,{className:`inline-flex h-5 items-center gap-1 rounded-full border border-border bg-muted/30 px-1.5 text-[10px] font-medium text-muted-foreground`,title:Yd(e.representative),"data-testid":`template-card-device-${e.key}`,children:[e.marketing?(0,B.jsx)(ee,{className:`h-3 w-3`,strokeWidth:2,"aria-hidden":!0}):(0,B.jsxs)(B.Fragment,{children:[e.portrait&&(0,B.jsx)(Ee,{className:`h-3 w-3`,strokeWidth:2,"aria-hidden":!0}),e.landscape&&(0,B.jsx)(Te,{className:`h-3 w-3`,strokeWidth:2,"aria-hidden":!0})]}),e.label]},e.key)),t]})}var Af={iphone_portrait:`portrait`,ipad_portrait:`portrait`,android_phone_portrait:`portrait`,android_10_tablet_portrait:`portrait`,iphone_landscape:`landscape`,ipad_landscape:`landscape`,android_phone_landscape:`landscape`,android_10_tablet_landscape:`landscape`,playstore_feature_graphic:`marketing`};function jf(e){let t=Af[e];return t===`marketing`?ee:t===`landscape`?Te:Ee}function Mf({selected:e,onToggle:t,error:n,available:r,label:i=`Devices`,helper:a}){let o=e.length===0;return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsx)(g,{children:i}),a&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:a})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.map(n=>{let r=jf(n),i=e.length>1;return(0,B.jsxs)(`span`,{"data-testid":`devices-picker-chip-${n}`,"data-checked":`true`,className:`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-background px-2 text-[11px] font-medium text-foreground`,title:Yd(n),children:[(0,B.jsx)(r,{className:`h-3 w-3 text-muted-foreground`,strokeWidth:2,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:xf[n]}),i&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>t(n),"data-testid":`devices-picker-remove-${n}`,"aria-label":`Remove ${xf[n]}`,className:`ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,B.jsx)(D,{className:`h-3 w-3`,strokeWidth:2.5})})]},n)}),(0,B.jsx)(Nf,{selected:e,onPick:t,available:r})]}),o&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,"data-testid":`devices-picker-empty-error`,children:`Pick at least one device.`}),n&&!o&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,children:n})]})}function Nf({selected:e,onPick:t,available:n}){let r=new Set(e),i=n?new Set(n):null,a=e=>e.filter(e=>!r.has(e)&&(!i||i.has(e))),o=a(vf),s=a(yf),c=a(bf);return o.length+s.length+c.length===0?null:(0,B.jsx)(x,{align:`start`,trigger:({open:e,toggle:t})=>(0,B.jsxs)(`button`,{type:`button`,onClick:t,"data-testid":`devices-picker-add-trigger`,"aria-expanded":e,className:`inline-flex h-7 items-center gap-1 rounded-full border border-dashed px-2 text-[11px] font-medium transition-colors ${e?`border-accent bg-accent/10 text-accent`:`border-border text-muted-foreground hover:border-border/80 hover:text-foreground`}`,children:[(0,B.jsx)(te,{className:`h-3 w-3`,strokeWidth:2.5}),`Add device`]}),children:(0,B.jsx)(`div`,{className:`flex w-[260px] flex-col`,children:(0,B.jsxs)(`div`,{className:`max-h-[320px] overflow-y-auto py-1 sleek-scroll`,children:[o.length>0&&(0,B.jsx)(Pf,{heading:`Portrait`,factors:o,onPick:t}),s.length>0&&(0,B.jsx)(Pf,{heading:`Landscape`,factors:s,onPick:t}),c.length>0&&(0,B.jsx)(Pf,{heading:`Marketing`,factors:c,onPick:t})]})})})}function Pf({heading:e,factors:t,onPick:n}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`px-2 pt-1 text-[9px] font-medium uppercase tracking-wider text-muted-foreground/70`,children:e}),(0,B.jsx)(`ul`,{className:`flex flex-col`,children:t.map(e=>{let t=jf(e);return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>n(e),"data-testid":`devices-picker-add-${e}`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left text-[11px] font-medium text-foreground transition-colors hover:bg-muted`,children:[(0,B.jsx)(t,{className:`h-3 w-3 shrink-0 text-muted-foreground`,strokeWidth:2,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate`,children:xf[e]}),(0,B.jsx)(`span`,{className:`truncate text-[10px] font-normal text-muted-foreground/80`,"data-testid":`devices-picker-caption-${e}`,children:Yd(e)})]})]})},e)})})]})}function Ff({heading:e,factors:t,current:n,onPick:r}){let i=e===`Landscape`?Te:Ee;return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`px-2 pt-1 text-[9px] font-medium uppercase tracking-wider text-muted-foreground/70`,children:e}),t.map(e=>{let t=e===n;return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(e),"data-testid":`form-factor-option-${e}`,"data-active":t?`true`:void 0,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left text-[12px] transition-colors ${t?`bg-accent/10 text-accent`:`text-foreground hover:bg-muted`}`,children:[(0,B.jsx)(i,{className:`h-3 w-3 shrink-0 text-muted-foreground`,strokeWidth:2,"aria-hidden":!0}),xf[e]]},e)})]})}function If({locales:e,activeCodes:t,defaultCode:n,onToggle:r,onSetDefault:i,error:a}){let o=new Map(e.map(e=>[e.code,e])),s=t.map(e=>o.get(e)).filter(e=>!!e),c=[...s.filter(e=>e.code===n),...s.filter(e=>e.code!==n)];return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsx)(g,{children:`Locales`}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:`Untranslated text falls back to the default`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[c.map(e=>{let a=e.code===n,o=t.length>1;return(0,B.jsxs)(`span`,{"data-testid":`locale-chip-${e.code}`,className:`inline-flex h-7 items-center gap-1.5 rounded-full border px-2 text-[11px] ${a?`border-accent/40 bg-accent/10 text-foreground`:`border-border bg-background text-foreground`}`,children:[(0,B.jsxs)(`span`,{dir:e.direction,className:`inline-flex items-baseline gap-1`,children:[(0,B.jsx)(`span`,{children:e.native_name}),(0,B.jsxs)(`span`,{dir:`ltr`,className:`font-mono text-[10px] tabular-nums text-muted-foreground`,children:[`· `,e.code]})]}),a?(0,B.jsx)(`span`,{"data-testid":`locale-chip-default-${e.code}`,className:`rounded-sm bg-accent/15 px-1 text-[9px] font-medium uppercase tracking-wider text-accent`,children:`default`}):(0,B.jsx)(`button`,{type:`button`,onClick:()=>i(e.code),"data-testid":`locale-chip-make-default-${e.code}`,"aria-label":`Make ${e.name} the default`,title:`Set as default`,className:`rounded-sm border border-border bg-card px-1 text-[9px] font-medium uppercase tracking-wider text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:`Set default`}),o&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(e.code),"data-testid":`locale-chip-remove-${e.code}`,"aria-label":`Remove ${e.name}`,className:`ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,B.jsx)(D,{className:`h-3 w-3`,strokeWidth:2.5})})]},e.code)}),(0,B.jsx)(Lf,{locales:e,activeCodes:t,onPick:r})]}),a&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,children:a})]})}function Lf({locales:e,activeCodes:t,onPick:n}){let[r,i]=(0,z.useState)(``),a=new Set(t),o=e.filter(e=>!a.has(e.code)).slice().sort((e,t)=>e.name.localeCompare(t.name)),s=r.trim().toLowerCase(),c=s?o.filter(e=>e.code.toLowerCase().includes(s)||e.name.toLowerCase().includes(s)||e.native_name.toLowerCase().includes(s)):o,l=c.filter(e=>e.direction===`ltr`),u=c.filter(e=>e.direction===`rtl`);return(0,B.jsx)(x,{align:`start`,trigger:({open:e,toggle:t})=>(0,B.jsxs)(`button`,{type:`button`,onClick:t,"data-testid":`locale-add-trigger`,"aria-expanded":e,className:`inline-flex h-7 items-center gap-1 rounded-full border border-dashed px-2 text-[11px] font-medium transition-colors ${e?`border-accent bg-accent/10 text-accent`:`border-border text-muted-foreground hover:border-border/80 hover:text-foreground`}`,children:[(0,B.jsx)(te,{className:`h-3 w-3`,strokeWidth:2.5}),`Add locale`]}),children:(0,B.jsxs)(`div`,{className:`flex w-[280px] flex-col`,children:[(0,B.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),placeholder:`Search locales…`,autoFocus:!0,"data-testid":`locale-add-search`,className:`block w-full border-b border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none`}),(0,B.jsxs)(`div`,{className:`max-h-[260px] overflow-y-auto py-1 sleek-scroll`,children:[o.length===0&&(0,B.jsx)(`p`,{className:`px-2 py-2 text-[11px] text-muted-foreground`,children:`All locales added.`}),c.length===0&&o.length>0&&(0,B.jsxs)(`p`,{className:`px-2 py-2 text-[11px] text-muted-foreground`,children:[`No locales match "`,r,`".`]}),l.length>0&&(0,B.jsx)(Rf,{heading:`LTR`,locales:l,onPick:n}),u.length>0&&(0,B.jsx)(Rf,{heading:`RTL`,locales:u,onPick:n})]})]})})}function Rf({heading:e,locales:t,onPick:n}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`px-2 pt-1 text-[9px] font-medium uppercase tracking-wider text-muted-foreground/70`,children:e}),t.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>n(e.code),"data-testid":`locale-add-option-${e.code}`,className:`flex w-full items-center justify-between gap-2 px-2 py-1.5 text-left text-[12px] text-foreground transition-colors hover:bg-muted`,children:(0,B.jsxs)(`span`,{className:`inline-flex min-w-0 items-baseline gap-1`,children:[(0,B.jsx)(`span`,{className:`truncate`,children:e.native_name}),(0,B.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/80`,children:[`· `,e.code]})]})},e.code))]})}function zf({value:e,onChange:t,bgError:n,accentError:r}){let[i,a]=(0,z.useState)(e!==null),o=e??gf,s=e!==null,c=e=>{t({bg:e.bg,accent:e.accent})},l=(e,n)=>{t({...o,[e]:n})},u=e=>{a(e),t(e?{bg:gf.bg,accent:gf.accent}:null)};return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>u(!i),"aria-expanded":i,"data-testid":`brand-tokens-toggle`,className:`flex w-full items-center justify-between gap-2 text-left`,children:[(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Brand colors`}),(0,B.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground/60`,children:`Optional`})]}),(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-medium transition-colors ${i?`text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[i?`Edit`:`Customize`,(0,B.jsx)(T,{className:`h-3 w-3 transition-transform ${i?`rotate-180`:`rotate-0`}`,strokeWidth:2})]})]}),i&&(0,B.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-muted/10 p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70`,children:`Presets`}),(0,B.jsx)(`p`,{className:`mt-1 text-[10px] leading-snug text-muted-foreground/70`,children:`Background sets the canvas color; accent cascades onto headline emphasis (the bold word in every preview).`}),(0,B.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:hf.map(t=>{let n=_f(e,t);return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>c(t),"data-testid":`brand-preset-${t.key}`,"aria-pressed":n,className:`flex items-center gap-2 rounded-md border px-2 py-1.5 text-left text-[11px] transition-colors ${n?`border-accent/50 bg-accent/5 text-foreground`:`border-border bg-background text-muted-foreground hover:border-border/80 hover:text-foreground`}`,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border/60 font-semibold`,style:{backgroundColor:t.bg,color:t.accent},children:`Aa`}),(0,B.jsx)(`span`,{className:`truncate`,children:t.name})]},t.key)})})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,B.jsx)(Bf,{label:`Background`,testId:`brand-bg-hex`,value:o.bg,onCommit:e=>l(`bg`,e),error:n}),(0,B.jsx)(Bf,{label:`Accent`,testId:`brand-accent-hex`,value:o.accent,onCommit:e=>l(`accent`,e),error:r})]}),s&&(0,B.jsx)(`p`,{className:`text-[11px] text-muted-foreground/80`,children:`Applied to the scaffolded background, primary text, and the default shape fill. Refine per-layer in the editor.`})]})]})}function Bf({label:e,testId:t,value:n,onCommit:r,error:i}){let[a,o]=(0,z.useState)(n);(0,z.useEffect)(()=>o(n),[n]);let s=e=>{let t=Vf(e);t?r(t):o(n)};return(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(g,{className:`text-[11px] text-muted-foreground`,children:e}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-background pl-1.5 pr-2 focus-within:border-accent/60`,children:[(0,B.jsx)(`input`,{type:`color`,"aria-label":`${e} color picker`,value:n,onChange:e=>r(e.target.value.toLowerCase()),"data-testid":`${t}-color`,className:`h-6 w-6 shrink-0 cursor-pointer rounded border-0 bg-transparent p-0 [&::-webkit-color-swatch-wrapper]:p-0 [&::-webkit-color-swatch]:rounded [&::-webkit-color-swatch]:border-0`}),(0,B.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onBlur:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value))},"data-testid":`${t}-text`,spellCheck:!1,className:`w-full bg-transparent py-1 text-[12px] tabular-nums text-foreground outline-none placeholder:text-muted-foreground`,placeholder:`#000000`})]}),i&&(0,B.jsx)(`p`,{className:`text-[11px] text-destructive`,children:i})]})}function Vf(e){let t=e.trim().toLowerCase(),n=t.startsWith(`#`)?t:`#${t}`;return/^#[0-9a-f]{6}$/.test(n)?n:/^#[0-9a-f]{3}$/.test(n)?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:null}function Hf(e){if(!e)return`—`;let t=new Date(e),n=Math.floor((Date.now()-t.getTime())/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Uf({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2.5`,children:[(0,B.jsx)(`dt`,{className:`shrink-0 text-muted-foreground`,children:e}),(0,B.jsx)(`dd`,{className:`text-right font-medium text-foreground`,children:t})]})}function Wf({project:e,onClose:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null);return(0,z.useEffect)(()=>{let t=!0;return fetch(`/projects/${e.id}/details`,{credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>e.ok?e.json():Promise.reject(e.status)).then(e=>t&&r(e)).catch(()=>t&&a(`Could not load project details.`)),()=>{t=!1}},[e.id]),(0,B.jsxs)(y,{open:!0,onClose:t,size:`md`,children:[(0,B.jsx)(y.Header,{eyebrow:`Project details`,title:e.name}),(0,B.jsx)(y.Body,{children:i?(0,B.jsx)(`p`,{className:`text-sm text-destructive`,children:i}):n?(0,B.jsxs)(`dl`,{className:`flex flex-col divide-y divide-border/60 text-[13px]`,"data-testid":`project-details-body`,children:[(0,B.jsx)(Uf,{label:`Creator`,value:n.creator?.name??`Unknown`}),(0,B.jsx)(Uf,{label:`Last edited`,value:n.last_editor?`${n.last_editor.name} · ${Hf(n.last_edited_at)}`:`Not edited yet`}),(0,B.jsx)(Uf,{label:`Created`,value:Hf(n.created_at)}),(0,B.jsx)(Uf,{label:`Form factors`,value:n.form_factors.map(e=>Jd(e)).join(`, `)}),(0,B.jsx)(Uf,{label:`Screens`,value:String(n.screens_count)}),(0,B.jsx)(Uf,{label:`Shared with`,value:n.shared_with.length===0?`No one`:n.shared_with.map(e=>e.name).join(`, `)})]}):(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})}),(0,B.jsx)(y.Footer,{children:(0,B.jsx)(_,{type:`button`,variant:`ghost`,onClick:t,children:`Close`})})]})}function Gf({project:e,canAuthorKits:t,canEdit:n,canShare:r,locales:i,aiEnabled:a,onRename:o,onDuplicate:s,onExportTemplate:c,onShare:u,onDelete:d,onDetails:f,onGenerate:p}){let m=e=>{e.preventDefault(),e.stopPropagation()},h=i.find(t=>t.code===e.default_locale),g=Math.max(0,e.active_locales.length-1);return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(l,{href:`/editor/${e.id}`,"data-testid":`project-card-${e.id}`,className:`block`,children:(0,B.jsxs)(v,{variant:`interactive`,padding:`lg`,children:[(0,B.jsx)(`div`,{className:`pr-8`,children:(0,B.jsx)(`h3`,{className:`text-lg tracking-[-0.01em] text-foreground`,children:e.name})}),(0,B.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground/70`,children:[e.screens_count,` `,e.screens_count===1?`screen`:`screens`,` · `,`Updated `,Cf(e.updated_at)]}),(0,B.jsx)(`div`,{"data-testid":`project-card-meta-${e.id}`,children:(0,B.jsx)(kf,{factors:e.active_form_factors,trailing:h?(0,B.jsxs)(`span`,{className:`inline-flex h-5 items-center gap-1 rounded-full border border-border bg-muted/30 px-1.5 text-[10px] font-medium text-muted-foreground`,children:[(0,B.jsx)(`span`,{dir:h.direction,children:h.native_name}),(0,B.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground/70`,children:[`· `,h.code]}),g>0&&(0,B.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[`+`,g]})]}):null})})]})}),n&&(0,B.jsx)(`div`,{className:`absolute right-3 top-3`,onClick:m,onMouseDown:m,children:(0,B.jsx)(x,{align:`end`,trigger:({open:t,toggle:n})=>(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Project actions`,"aria-expanded":t,"data-testid":`project-menu-${e.id}`,className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground ${t?`bg-muted text-foreground`:``}`,children:(0,B.jsx)(A,{className:`h-4 w-4`,strokeWidth:2})}),children:(0,B.jsxs)(`div`,{className:`flex min-w-[140px] flex-col`,children:[(0,B.jsx)(Kf,{label:`Rename`,icon:I,testId:`project-rename-${e.id}`,onClick:o}),(0,B.jsx)(Kf,{label:`Duplicate`,icon:k,testId:`project-duplicate-${e.id}`,onClick:s}),a&&n&&(0,B.jsx)(Kf,{label:`Generate with AI`,icon:N,testId:`project-generate-${e.id}`,onClick:p}),r&&(0,B.jsx)(Kf,{label:`Share`,icon:oe,testId:`project-share-${e.id}`,onClick:u}),t&&(0,B.jsx)(Kf,{label:`Export as template`,icon:F,testId:`project-export-template-${e.id}`,onClick:c}),(0,B.jsx)(Kf,{label:`Delete`,icon:O,testId:`project-delete-${e.id}`,onClick:d,tone:`danger`}),(0,B.jsx)(Kf,{label:`Details`,icon:E,testId:`project-details-${e.id}`,onClick:f})]})})})]})}function Kf({label:e,icon:t,testId:n,onClick:r,tone:i=`default`}){return(0,B.jsxs)(`button`,{type:`button`,onClick:r,"data-testid":n,className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors ${i===`danger`?`text-destructive hover:bg-destructive/10`:`text-foreground hover:bg-muted`}`,children:[(0,B.jsx)(t,{className:`h-3 w-3 shrink-0 ${i===`danger`?``:`text-muted-foreground`}`,strokeWidth:2}),e]})}function qf({project:e,onClose:t}){let[n,r]=(0,z.useState)(e.name),[i,a]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),l=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let e=window.setTimeout(()=>{l.current?.focus(),l.current?.select()},0);return()=>window.clearTimeout(e)},[]),(0,B.jsxs)(y,{open:!0,onClose:t,onSubmit:r=>{r.preventDefault();let i=n.trim();if(!i||i===e.name){t();return}a(!0),c(null),o.patch(`/projects/${e.id}`,{name:i},{preserveScroll:!0,onSuccess:()=>t(),onError:e=>{c(e.name??`Rename failed.`)},onFinish:()=>a(!1)})},size:`md`,"data-testid":`rename-modal`,children:[(0,B.jsx)(y.Header,{eyebrow:`Rename`,title:e.name}),(0,B.jsx)(y.Body,{children:(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(g,{htmlFor:`rename-input`,children:`Project name`}),(0,B.jsx)(b,{id:`rename-input`,ref:l,value:n,onChange:e=>r(e.target.value),invalid:!!s,maxLength:120,"data-testid":`rename-input`}),s&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,children:s})]})}),(0,B.jsxs)(y.Footer,{children:[(0,B.jsx)(_,{type:`button`,variant:`ghost`,onClick:t,"data-testid":`rename-cancel`,children:`Cancel`}),(0,B.jsx)(_,{type:`submit`,disabled:i||!n.trim(),"data-testid":`rename-submit`,children:i?`Saving…`:`Save`})]})]})}function Jf({project:e,locales:t,onClose:n}){let[r,i]=(0,z.useState)(`${e.name} (copy)`),[a,s]=(0,z.useState)(e.form_factor),[c,l]=(0,z.useState)(e.active_locales),[u,d]=(0,z.useState)(e.default_locale),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(null),v=(0,z.useRef)(null);(0,z.useEffect)(()=>{let e=window.setTimeout(()=>{v.current?.focus(),v.current?.select()},0);return()=>window.clearTimeout(e)},[]);let x=e=>{if(c.includes(e)){let t=c.filter(t=>t!==e);if(t.length===0)return;l(t),e===u&&d(t[0])}else l([...c,e])},S=e=>{c.includes(e)&&d(e)},C=t=>{t.preventDefault();let i=r.trim();if(!i){h(`Name is required.`);return}p(!0),h(null),o.post(`/projects/${e.id}/duplicate`,{name:i,form_factor:a,default_locale:u,active_locales:c},{preserveScroll:!0,onSuccess:()=>n(),onError:e=>{h(e.name??e.form_factor??e.default_locale??e.active_locales??`Duplicate failed.`)},onFinish:()=>p(!1)})},w=a!==e.form_factor;return(0,B.jsxs)(y,{open:!0,onClose:n,onSubmit:C,size:`md`,"data-testid":`duplicate-modal`,children:[(0,B.jsx)(y.Header,{eyebrow:`Duplicate`,title:e.name,subtitle:`Pre-filled from the source; tweak anything before duplicating. If you switch form factor, background layers auto-fill the new canvas — the rest stay at source positions for manual cleanup.`}),(0,B.jsxs)(y.Body,{children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(g,{htmlFor:`duplicate-name`,children:`Project name`}),(0,B.jsx)(b,{id:`duplicate-name`,ref:v,value:r,onChange:e=>i(e.target.value),invalid:!!m,maxLength:120,"data-testid":`duplicate-name-input`})]}),(0,B.jsx)(Tf,{value:a,onPick:s,error:void 0}),w&&(0,B.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-[11px] text-foreground`,"data-testid":`duplicate-factor-warning`,children:`Switching form factor resizes each screen's canvas. Background layers fill the new size automatically; text, frames, images, and shapes keep their source positions — you'll likely re-position them after the duplicate lands.`}),(0,B.jsx)(If,{locales:t,activeCodes:c,defaultCode:u,onToggle:x,onSetDefault:S}),e.design_tokens&&(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(g,{children:`Brand colors (carried over)`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:`h-5 w-5 rounded border border-border/60`,style:{backgroundColor:e.design_tokens.bg}}),(0,B.jsx)(`span`,{className:`font-mono`,children:e.design_tokens.bg})]}),(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:`h-5 w-5 rounded border border-border/60`,style:{backgroundColor:e.design_tokens.accent}}),(0,B.jsx)(`span`,{className:`font-mono`,children:e.design_tokens.accent})]})]})]}),m&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,"data-testid":`duplicate-error`,children:m})]}),(0,B.jsxs)(y.Footer,{children:[(0,B.jsx)(_,{type:`button`,variant:`ghost`,onClick:n,children:`Cancel`}),(0,B.jsx)(_,{type:`submit`,disabled:f||!r.trim(),"data-testid":`duplicate-submit`,children:f?`Duplicating…`:`Duplicate project`})]})]})}function Yf({project:e,onClose:t}){let[n,r]=(0,z.useState)(!1);return(0,B.jsxs)(y,{open:!0,onClose:n?()=>{}:t,closeOnBackdrop:!1,closeOnEsc:!n,size:`md`,"data-testid":`delete-modal`,children:[(0,B.jsx)(y.Header,{eyebrow:`Delete project`,eyebrowClassName:`text-destructive`,title:e.name}),(0,B.jsx)(y.Body,{children:(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This permanently removes the project, all its screens, uploaded media, and past exports. This can't be undone.`})}),(0,B.jsxs)(y.Footer,{children:[(0,B.jsx)(_,{type:`button`,variant:`ghost`,onClick:t,disabled:n,"data-testid":`delete-cancel`,children:`Cancel`}),(0,B.jsx)(_,{type:`button`,variant:`danger`,onClick:()=>{r(!0),o.delete(`/projects/${e.id}`,{preserveScroll:!0,onFinish:()=>{r(!1),t()}})},disabled:n,"data-testid":`delete-confirm`,children:n?`Deleting…`:`Delete`})]})]})}function Xf({templates:e,aiEnabled:t,onClose:n,onPick:r,onAiFill:i}){let a=[...e].sort((e,t)=>e.isFeatured===t.isFeatured?0:e.isFeatured?-1:1);return(0,B.jsxs)(y,{open:!0,onClose:n,size:`2xl`,"data-testid":`browse-templates-modal`,children:[(0,B.jsx)(y.Header,{title:`All templates`,subtitle:`Pick a kit to scaffold a project across every device size.`,actions:(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,B.jsx)(D,{className:`h-4 w-4`})})}),(0,B.jsx)(y.Body,{children:a.length===0?(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No templates installed yet.`}):(0,B.jsx)(`div`,{className:`space-y-4`,children:a.map(e=>(0,B.jsx)(Zf,{template:e,aiEnabled:t,onPick:()=>r(e),onAiFill:()=>i(e)},e.key))})})]})}function Zf({template:e,aiEnabled:t,onPick:n,onAiFill:i}){let a=r().props.auth,o=p(e=>e.openModal),s=e.isPremium&&a.user!==null&&!a.user.can_use_premium_kits,[c,l]=(0,z.useState)(!1),u=(e=t?`ai`:`manual`)=>{if(s){l(!0);return}e===`ai`?i():n()},d=e.screens.slice(0,6),f=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())},m=(0,B.jsx)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:s?(0,B.jsxs)(_,{size:`sm`,type:`button`,onClick:e=>{e.stopPropagation(),u()},"data-testid":`browse-template-use-${e.key}`,children:[`Upgrade to use`,(0,B.jsx)(h,{className:`h-3.5 w-3.5`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{size:`sm`,type:`button`,variant:t?`ghost`:`primary`,onClick:e=>{e.stopPropagation(),u(`manual`)},"data-testid":`browse-template-use-${e.key}`,children:`Start with sample copy`}),t&&(0,B.jsxs)(_,{size:`sm`,type:`button`,onClick:e=>{e.stopPropagation(),u(`ai`)},"data-testid":`browse-template-aifill-${e.key}`,children:[(0,B.jsx)(N,{className:`h-3.5 w-3.5`}),`Fill with AI`]})]})});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{role:`button`,tabIndex:0,onClick:()=>u(),onKeyDown:f,"data-testid":`browse-template-${e.key}`,"data-locked":s?`true`:void 0,className:`group relative block w-full text-left rounded-xl focus:outline-none focus-visible:ring-2 focus-visible:ring-accent/60`,children:(0,B.jsx)(v,{variant:`interactive`,padding:`lg`,className:`h-full`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-6 lg:flex-row lg:items-start`,children:[(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.isPremium&&(0,B.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-accent/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-accent`,children:`Pro`}),e.isFeatured&&(0,B.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-border bg-muted/30 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Featured`}),(0,B.jsxs)(`span`,{className:`text-[11px] font-medium text-muted-foreground`,children:[e.screenCount,` `,e.screenCount===1?`screen`:`screens`]})]}),(0,B.jsx)(`h4`,{className:`mt-3 text-xl font-semibold tracking-[-0.01em] text-foreground`,children:e.name}),e.description&&(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:e.description}),(0,B.jsx)(kf,{factors:e.active_form_factors}),s&&(0,B.jsx)(`p`,{className:`mt-3 text-[11px] font-medium text-muted-foreground`,"data-testid":`browse-template-locked-${e.key}`,children:`Available on Pro & Scale plans.`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 lg:max-w-md`,children:[m,d.length>0&&(0,B.jsx)(`div`,{className:`-mx-1 overflow-x-auto pb-1 lg:mx-0`,children:(0,B.jsx)(`div`,{className:`flex gap-3 px-1`,children:d.map((t,n)=>(0,B.jsx)(`img`,{src:t.preview_path,alt:`${e.name} — ${t.name}`,loading:`lazy`,className:`h-40 w-[74px] shrink-0 rounded-lg border border-border bg-muted object-cover`},n))})})]})]})})}),(0,B.jsx)(se,{open:c,onClose:()=>l(!1),kitName:e.name,onUpgrade:()=>o(`premium_kits`)})]})}export{Ls as A,Ns as B,Hl as C,Us as D,zs as E,Os as F,Ee as H,Es as I,Ms as L,Ds as M,Ts as N,Vs as O,ws as P,Fs as R,Ul as S,Hs as T,Te as U,J as V,su as _,Wd as a,ru as b,Xu as c,Du as d,Cu as f,fu as g,pu as h,Jd as i,Gs as j,Rs as k,Ku as l,xu as m,If as n,Vd as o,ku as p,Yd as r,rd as s,ff as t,Hu as u,ou as v,Bs as w,X as x,iu as y,As as z};