(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();var i1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var om={exports:{}},Yu={},sm={exports:{}},Le={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Dl=Symbol.for("react.element"),R4=Symbol.for("react.portal"),F4=Symbol.for("react.fragment"),M4=Symbol.for("react.strict_mode"),L4=Symbol.for("react.profiler"),I4=Symbol.for("react.provider"),z4=Symbol.for("react.context"),D4=Symbol.for("react.forward_ref"),A4=Symbol.for("react.suspense"),O4=Symbol.for("react.memo"),H4=Symbol.for("react.lazy"),o1=Symbol.iterator;function U4(t){return t===null||typeof t!="object"?null:(t=o1&&t[o1]||t["@@iterator"],typeof t=="function"?t:null)}var lm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},am=Object.assign,um={};function cs(t,e,n){this.props=t,this.context=e,this.refs=um,this.updater=n||lm}cs.prototype.isReactComponent={};cs.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};cs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function cm(){}cm.prototype=cs.prototype;function o0(t,e,n){this.props=t,this.context=e,this.refs=um,this.updater=n||lm}var s0=o0.prototype=new cm;s0.constructor=o0;am(s0,cs.prototype);s0.isPureReactComponent=!0;var s1=Array.isArray,dm=Object.prototype.hasOwnProperty,l0={current:null},hm={key:!0,ref:!0,__self:!0,__source:!0};function fm(t,e,n){var r,s={},l=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(l=""+e.key),e)dm.call(e,r)&&!hm.hasOwnProperty(r)&&(s[r]=e[r]);var c=arguments.length-2;if(c===1)s.children=n;else if(1>>1,de=H[ne];if(0>>1;nes(mt,Y))Ves(D,mt)?(H[ne]=D,H[Ve]=Y,ne=Ve):(H[ne]=mt,H[pt]=Y,ne=pt);else if(Ves(D,Y))H[ne]=D,H[Ve]=Y,ne=Ve;else break e}}return j}function s(H,j){var Y=H.sortIndex-j.sortIndex;return Y!==0?Y:H.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var d=[],g=[],y=1,w=null,x=3,_=!1,v=!1,E=!1,P=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(H){for(var j=n(g);j!==null;){if(j.callback===null)r(g);else if(j.startTime<=H)r(g),j.sortIndex=j.expirationTime,e(d,j);else break;j=n(g)}}function S(H){if(E=!1,p(H),!v)if(n(d)!==null)v=!0,we(R);else{var j=n(g);j!==null&&Te(S,j.startTime-H)}}function R(H,j){v=!1,E&&(E=!1,k(N),N=-1),_=!0;var Y=x;try{for(p(j),w=n(d);w!==null&&(!(w.expirationTime>j)||H&&!U());){var ne=w.callback;if(typeof ne=="function"){w.callback=null,x=w.priorityLevel;var de=ne(w.expirationTime<=j);j=t.unstable_now(),typeof de=="function"?w.callback=de:w===n(d)&&r(d),p(j)}else r(d);w=n(d)}if(w!==null)var ze=!0;else{var pt=n(g);pt!==null&&Te(S,pt.startTime-j),ze=!1}return ze}finally{w=null,x=Y,_=!1}}var F=!1,L=null,N=-1,I=5,M=-1;function U(){return!(t.unstable_now()-MH||125ne?(H.sortIndex=Y,e(g,H),n(d)===null&&H===n(g)&&(E?(k(N),N=-1):E=!0,Te(S,Y-ne))):(H.sortIndex=de,e(d,H),v||_||(v=!0,we(R))),H},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(H){var j=x;return function(){var Y=x;x=j;try{return H.apply(this,arguments)}finally{x=Y}}}})(vm);ym.exports=vm;var il=ym.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var $4=Q,Sn=il;function ee(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ef=Object.prototype.hasOwnProperty,q4=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,a1={},u1={};function Z4(t){return ef.call(u1,t)?!0:ef.call(a1,t)?!1:q4.test(t)?u1[t]=!0:(a1[t]=!0,!1)}function J4(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function ev(t,e,n,r){if(e===null||typeof e>"u"||J4(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function nn(t,e,n,r,s,l,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=l,this.removeEmptyString=a}var Gt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Gt[t]=new nn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Gt[e]=new nn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Gt[t]=new nn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Gt[t]=new nn(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Gt[t]=new nn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Gt[t]=new nn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Gt[t]=new nn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Gt[t]=new nn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Gt[t]=new nn(t,5,!1,t.toLowerCase(),null,!1,!1)});var u0=/[\-:]([a-z])/g;function c0(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(u0,c0);Gt[e]=new nn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(u0,c0);Gt[e]=new nn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(u0,c0);Gt[e]=new nn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Gt[t]=new nn(t,1,!1,t.toLowerCase(),null,!1,!1)});Gt.xlinkHref=new nn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Gt[t]=new nn(t,1,!1,t.toLowerCase(),null,!0,!0)});function d0(t,e,n,r){var s=Gt.hasOwnProperty(e)?Gt[e]:null;(s!==null?s.type!==0:r||!(2c||s[a]!==l[c]){var d=` `+s[a].replace(" at new "," at ");return t.displayName&&d.includes("")&&(d=d.replace("",t.displayName)),d}while(1<=a&&0<=c);break}}}finally{vh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Zs(t):""}function tv(t){switch(t.tag){case 5:return Zs(t.type);case 16:return Zs("Lazy");case 13:return Zs("Suspense");case 19:return Zs("SuspenseList");case 0:case 2:case 15:return t=xh(t.type,!1),t;case 11:return t=xh(t.type.render,!1),t;case 1:return t=xh(t.type,!0),t;default:return""}}function of(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Oo:return"Fragment";case Ao:return"Portal";case tf:return"Profiler";case h0:return"StrictMode";case nf:return"Suspense";case rf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case _m:return(t.displayName||"Context")+".Consumer";case Sm:return(t._context.displayName||"Context")+".Provider";case f0:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case g0:return e=t.displayName||null,e!==null?e:of(t.type)||"Memo";case ii:e=t._payload,t=t._init;try{return of(t(e))}catch{}}return null}function nv(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return of(e);case 8:return e===h0?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function vi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Cm(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function rv(t){var e=Cm(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,l=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,l.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ua(t){t._valueTracker||(t._valueTracker=rv(t))}function km(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Cm(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function xu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function sf(t,e){var n=e.checked;return ut({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function d1(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=vi(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Em(t,e){e=e.checked,e!=null&&d0(t,"checked",e,!1)}function lf(t,e){Em(t,e);var n=vi(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?af(t,e.type,n):e.hasOwnProperty("defaultValue")&&af(t,e.type,vi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function h1(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function af(t,e,n){(e!=="number"||xu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Js=Array.isArray;function Yo(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s"+e.valueOf().toString()+"",e=Ga.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function pl(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var ol={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},iv=["Webkit","ms","Moz","O"];Object.keys(ol).forEach(function(t){iv.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ol[e]=ol[t]})});function Rm(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||ol.hasOwnProperty(t)&&ol[t]?(""+e).trim():e+"px"}function Fm(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Rm(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var ov=ut({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function df(t,e){if(e){if(ov[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ee(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ee(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ee(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ee(62))}}function hf(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ff=null;function p0(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var gf=null,Qo=null,$o=null;function p1(t){if(t=Hl(t)){if(typeof gf!="function")throw Error(ee(280));var e=t.stateNode;e&&(e=Ju(e),gf(t.stateNode,t.type,e))}}function Mm(t){Qo?$o?$o.push(t):$o=[t]:Qo=t}function Lm(){if(Qo){var t=Qo,e=$o;if($o=Qo=null,p1(t),e)for(t=0;t>>=0,t===0?32:31-(mv(t)/yv|0)|0}var Ba=64,ja=4194304;function el(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Cu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,l=t.pingedLanes,a=n&268435455;if(a!==0){var c=a&~s;c!==0?r=el(c):(l&=a,l!==0&&(r=el(l)))}else a=n&~s,a!==0?r=el(a):l!==0&&(r=el(l));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,l=e&-e,s>=l||s===16&&(l&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Al(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Qn(e),t[e]=n}function _v(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=ll),k1=" ",E1=!1;function Zm(t,e){switch(t){case"keyup":return Qv.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ho=!1;function qv(t,e){switch(t){case"compositionend":return Jm(e);case"keypress":return e.which!==32?null:(E1=!0,k1);case"textInput":return t=e.data,t===k1&&E1?null:t;default:return null}}function Zv(t,e){if(Ho)return t==="compositionend"||!C0&&Zm(t,e)?(t=$m(),au=S0=ai=null,Ho=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=R1(n)}}function ry(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?ry(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function iy(){for(var t=window,e=xu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=xu(t.document)}return e}function k0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function l6(t){var e=iy(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&ry(n.ownerDocument.documentElement,n)){if(r!==null&&k0(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,l=Math.min(r.start,s);r=r.end===void 0?l:Math.min(r.end,s),!t.extend&&l>r&&(s=r,r=l,l=s),s=F1(n,l);var a=F1(n,r);s&&a&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),l>r?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Uo=null,Sf=null,ul=null,_f=!1;function M1(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_f||Uo==null||Uo!==xu(r)||(r=Uo,"selectionStart"in r&&k0(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ul&&_l(ul,r)||(ul=r,r=Pu(Sf,"onSelect"),0jo||(t.current=Tf[jo],Tf[jo]=null,jo--)}function $e(t,e){jo++,Tf[jo]=t.current,t.current=e}var xi={},Qt=wi(xi),hn=wi(!1),Ji=xi;function ts(t,e){var n=t.type.contextTypes;if(!n)return xi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=e[l];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function fn(t){return t=t.childContextTypes,t!=null}function Nu(){et(hn),et(Qt)}function H1(t,e,n){if(Qt.current!==xi)throw Error(ee(168));$e(Qt,e),$e(hn,n)}function fy(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(ee(108,nv(t)||"Unknown",s));return ut({},n,r)}function Ru(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||xi,Ji=Qt.current,$e(Qt,t),$e(hn,hn.current),!0}function U1(t,e,n){var r=t.stateNode;if(!r)throw Error(ee(169));n?(t=fy(t,e,Ji),r.__reactInternalMemoizedMergedChildContext=t,et(hn),et(Qt),$e(Qt,t)):et(hn),$e(hn,n)}var Fr=null,ec=!1,Ih=!1;function gy(t){Fr===null?Fr=[t]:Fr.push(t)}function x6(t){ec=!0,gy(t)}function Ci(){if(!Ih&&Fr!==null){Ih=!0;var t=0,e=We;try{var n=Fr;for(We=1;t>=a,s-=a,Mr=1<<32-Qn(e)+s|n<N?(I=L,L=null):I=L.sibling;var M=x(k,L,p[N],S);if(M===null){L===null&&(L=I);break}t&&L&&M.alternate===null&&e(k,L),C=l(M,C,N),F===null?R=M:F.sibling=M,F=M,L=I}if(N===p.length)return n(k,L),rt&&bi(k,N),R;if(L===null){for(;NN?(I=L,L=null):I=L.sibling;var U=x(k,L,M.value,S);if(U===null){L===null&&(L=I);break}t&&L&&U.alternate===null&&e(k,L),C=l(U,C,N),F===null?R=U:F.sibling=U,F=U,L=I}if(M.done)return n(k,L),rt&&bi(k,N),R;if(L===null){for(;!M.done;N++,M=p.next())M=w(k,M.value,S),M!==null&&(C=l(M,C,N),F===null?R=M:F.sibling=M,F=M);return rt&&bi(k,N),R}for(L=r(k,L);!M.done;N++,M=p.next())M=_(L,k,N,M.value,S),M!==null&&(t&&M.alternate!==null&&L.delete(M.key===null?N:M.key),C=l(M,C,N),F===null?R=M:F.sibling=M,F=M);return t&&L.forEach(function(W){return e(k,W)}),rt&&bi(k,N),R}function P(k,C,p,S){if(typeof p=="object"&&p!==null&&p.type===Oo&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case Ha:e:{for(var R=p.key,F=C;F!==null;){if(F.key===R){if(R=p.type,R===Oo){if(F.tag===7){n(k,F.sibling),C=s(F,p.props.children),C.return=k,k=C;break e}}else if(F.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===ii&&j1(R)===F.type){n(k,F.sibling),C=s(F,p.props),C.ref=Ks(k,F,p),C.return=k,k=C;break e}n(k,F);break}else e(k,F);F=F.sibling}p.type===Oo?(C=Zi(p.props.children,k.mode,S,p.key),C.return=k,k=C):(S=mu(p.type,p.key,p.props,null,k.mode,S),S.ref=Ks(k,C,p),S.return=k,k=S)}return a(k);case Ao:e:{for(F=p.key;C!==null;){if(C.key===F)if(C.tag===4&&C.stateNode.containerInfo===p.containerInfo&&C.stateNode.implementation===p.implementation){n(k,C.sibling),C=s(C,p.children||[]),C.return=k,k=C;break e}else{n(k,C);break}else e(k,C);C=C.sibling}C=Bh(p,k.mode,S),C.return=k,k=C}return a(k);case ii:return F=p._init,P(k,C,F(p._payload),S)}if(Js(p))return v(k,C,p,S);if(Bs(p))return E(k,C,p,S);Qa(k,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,C!==null&&C.tag===6?(n(k,C.sibling),C=s(C,p),C.return=k,k=C):(n(k,C),C=Gh(p,k.mode,S),C.return=k,k=C),a(k)):n(k,C)}return P}var rs=vy(!0),xy=vy(!1),Lu=wi(null),Iu=null,Wo=null,N0=null;function R0(){N0=Wo=Iu=null}function F0(t){var e=Lu.current;et(Lu),t._currentValue=e}function Ff(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Zo(t,e){Iu=t,N0=Wo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(dn=!0),t.firstContext=null)}function An(t){var e=t._currentValue;if(N0!==t)if(t={context:t,memoizedValue:e,next:null},Wo===null){if(Iu===null)throw Error(ee(308));Wo=t,Iu.dependencies={lanes:0,firstContext:t}}else Wo=Wo.next=t;return e}var Qi=null;function M0(t){Qi===null?Qi=[t]:Qi.push(t)}function Sy(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,M0(e)):(n.next=s.next,s.next=n),e.interleaved=n,Hr(t,r)}function Hr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var oi=!1;function L0(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _y(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function zr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function gi(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Oe&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Hr(t,n)}return s=r.interleaved,s===null?(e.next=e,M0(r)):(e.next=s.next,s.next=e),r.interleaved=e,Hr(t,n)}function cu(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,y0(t,n)}}function V1(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?s=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?s=l=e:l=l.next=e}else s=l=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:l,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function zu(t,e,n,r){var s=t.updateQueue;oi=!1;var l=s.firstBaseUpdate,a=s.lastBaseUpdate,c=s.shared.pending;if(c!==null){s.shared.pending=null;var d=c,g=d.next;d.next=null,a===null?l=g:a.next=g,a=d;var y=t.alternate;y!==null&&(y=y.updateQueue,c=y.lastBaseUpdate,c!==a&&(c===null?y.firstBaseUpdate=g:c.next=g,y.lastBaseUpdate=d))}if(l!==null){var w=s.baseState;a=0,y=g=d=null,c=l;do{var x=c.lane,_=c.eventTime;if((r&x)===x){y!==null&&(y=y.next={eventTime:_,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var v=t,E=c;switch(x=e,_=n,E.tag){case 1:if(v=E.payload,typeof v=="function"){w=v.call(_,w,x);break e}w=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=E.payload,x=typeof v=="function"?v.call(_,w,x):v,x==null)break e;w=ut({},w,x);break e;case 2:oi=!0}}c.callback!==null&&c.lane!==0&&(t.flags|=64,x=s.effects,x===null?s.effects=[c]:x.push(c))}else _={eventTime:_,lane:x,tag:c.tag,payload:c.payload,callback:c.callback,next:null},y===null?(g=y=_,d=w):y=y.next=_,a|=x;if(c=c.next,c===null){if(c=s.shared.pending,c===null)break;x=c,c=x.next,x.next=null,s.lastBaseUpdate=x,s.shared.pending=null}}while(!0);if(y===null&&(d=w),s.baseState=d,s.firstBaseUpdate=g,s.lastBaseUpdate=y,e=s.shared.interleaved,e!==null){s=e;do a|=s.lane,s=s.next;while(s!==e)}else l===null&&(s.shared.lanes=0);no|=a,t.lanes=a,t.memoizedState=w}}function b1(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Dh.transition;Dh.transition={};try{t(!1),e()}finally{We=n,Dh.transition=r}}function Hy(){return On().memoizedState}function C6(t,e,n){var r=mi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Uy(t))Gy(e,n);else if(n=Sy(t,e,n,r),n!==null){var s=en();$n(n,t,r,s),By(n,e,r)}}function k6(t,e,n){var r=mi(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Uy(t))Gy(e,s);else{var l=t.alternate;if(t.lanes===0&&(l===null||l.lanes===0)&&(l=e.lastRenderedReducer,l!==null))try{var a=e.lastRenderedState,c=l(a,n);if(s.hasEagerState=!0,s.eagerState=c,Zn(c,a)){var d=e.interleaved;d===null?(s.next=s,M0(e)):(s.next=d.next,d.next=s),e.interleaved=s;return}}catch{}finally{}n=Sy(t,e,s,r),n!==null&&(s=en(),$n(n,t,r,s),By(n,e,r))}}function Uy(t){var e=t.alternate;return t===at||e!==null&&e===at}function Gy(t,e){cl=Au=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function By(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,y0(t,n)}}var Ou={readContext:An,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},E6={readContext:An,useCallback:function(t,e){return cr().memoizedState=[t,e===void 0?null:e],t},useContext:An,useEffect:K1,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,hu(4194308,4,Iy.bind(null,e,t),n)},useLayoutEffect:function(t,e){return hu(4194308,4,t,e)},useInsertionEffect:function(t,e){return hu(4,2,t,e)},useMemo:function(t,e){var n=cr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=cr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=C6.bind(null,at,t),[r.memoizedState,t]},useRef:function(t){var e=cr();return t={current:t},e.memoizedState=t},useState:W1,useDebugValue:G0,useDeferredValue:function(t){return cr().memoizedState=t},useTransition:function(){var t=W1(!1),e=t[0];return t=w6.bind(null,t[1]),cr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=at,s=cr();if(rt){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=e(),Dt===null)throw Error(ee(349));to&30||Ey(r,e,n)}s.memoizedState=n;var l={value:n,getSnapshot:e};return s.queue=l,K1(Ty.bind(null,r,l,t),[t]),r.flags|=2048,Rl(9,Py.bind(null,r,l,n,e),void 0,null),n},useId:function(){var t=cr(),e=Dt.identifierPrefix;if(rt){var n=Lr,r=Mr;n=(r&~(1<<32-Qn(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Tl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=a.createElement(n,{is:r.is}):(t=a.createElement(n),n==="select"&&(a=t,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):t=a.createElementNS(t,n),t[dr]=e,t[kl]=r,qy(t,e,!1,!1),e.stateNode=t;e:{switch(a=hf(n,r),n){case"dialog":Je("cancel",t),Je("close",t),s=r;break;case"iframe":case"object":case"embed":Je("load",t),s=r;break;case"video":case"audio":for(s=0;sss&&(e.flags|=128,r=!0,Xs(l,!1),e.lanes=4194304)}else{if(!r)if(t=Du(a),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Xs(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!rt)return Xt(e),null}else 2*vt()-l.renderingStartTime>ss&&n!==1073741824&&(e.flags|=128,r=!0,Xs(l,!1),e.lanes=4194304);l.isBackwards?(a.sibling=e.child,e.child=a):(n=l.last,n!==null?n.sibling=a:e.child=a,l.last=a)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=vt(),e.sibling=null,n=lt.current,$e(lt,r?n&1|2:n&1),e):(Xt(e),null);case 22:case 23:return K0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?yn&1073741824&&(Xt(e),e.subtreeFlags&6&&(e.flags|=8192)):Xt(e),null;case 24:return null;case 25:return null}throw Error(ee(156,e.tag))}function I6(t,e){switch(P0(e),e.tag){case 1:return fn(e.type)&&Nu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return is(),et(hn),et(Qt),D0(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return z0(e),null;case 13:if(et(lt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ee(340));ns()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return et(lt),null;case 4:return is(),null;case 10:return F0(e.type._context),null;case 22:case 23:return K0(),null;case 24:return null;default:return null}}var qa=!1,Yt=!1,z6=typeof WeakSet=="function"?WeakSet:Set,ce=null;function Ko(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ht(t,e,r)}else n.current=null}function Uf(t,e,n){try{n()}catch(r){ht(t,e,r)}}var r2=!1;function D6(t,e){if(wf=ku,t=iy(),k0(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var a=0,c=-1,d=-1,g=0,y=0,w=t,x=null;t:for(;;){for(var _;w!==n||s!==0&&w.nodeType!==3||(c=a+s),w!==l||r!==0&&w.nodeType!==3||(d=a+r),w.nodeType===3&&(a+=w.nodeValue.length),(_=w.firstChild)!==null;)x=w,w=_;for(;;){if(w===t)break t;if(x===n&&++g===s&&(c=a),x===l&&++y===r&&(d=a),(_=w.nextSibling)!==null)break;w=x,x=w.parentNode}w=_}n=c===-1||d===-1?null:{start:c,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(Cf={focusedElem:t,selectionRange:n},ku=!1,ce=e;ce!==null;)if(e=ce,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ce=t;else for(;ce!==null;){e=ce;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var E=v.memoizedProps,P=v.memoizedState,k=e.stateNode,C=k.getSnapshotBeforeUpdate(e.elementType===e.type?E:Kn(e.type,E),P);k.__reactInternalSnapshotBeforeUpdate=C}break;case 3:var p=e.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(S){ht(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,ce=t;break}ce=e.return}return v=r2,r2=!1,v}function dl(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var l=s.destroy;s.destroy=void 0,l!==void 0&&Uf(e,n,l)}s=s.next}while(s!==r)}}function rc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Gf(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function e5(t){var e=t.alternate;e!==null&&(t.alternate=null,e5(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[dr],delete e[kl],delete e[Pf],delete e[y6],delete e[v6])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function t5(t){return t.tag===5||t.tag===3||t.tag===4}function i2(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||t5(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Bf(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Tu));else if(r!==4&&(t=t.child,t!==null))for(Bf(t,e,n),t=t.sibling;t!==null;)Bf(t,e,n),t=t.sibling}function jf(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(jf(t,e,n),t=t.sibling;t!==null;)jf(t,e,n),t=t.sibling}var Ht=null,Xn=!1;function ti(t,e,n){for(n=n.child;n!==null;)n5(t,e,n),n=n.sibling}function n5(t,e,n){if(fr&&typeof fr.onCommitFiberUnmount=="function")try{fr.onCommitFiberUnmount(Qu,n)}catch{}switch(n.tag){case 5:Yt||Ko(n,e);case 6:var r=Ht,s=Xn;Ht=null,ti(t,e,n),Ht=r,Xn=s,Ht!==null&&(Xn?(t=Ht,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ht.removeChild(n.stateNode));break;case 18:Ht!==null&&(Xn?(t=Ht,n=n.stateNode,t.nodeType===8?Lh(t.parentNode,n):t.nodeType===1&&Lh(t,n),xl(t)):Lh(Ht,n.stateNode));break;case 4:r=Ht,s=Xn,Ht=n.stateNode.containerInfo,Xn=!0,ti(t,e,n),Ht=r,Xn=s;break;case 0:case 11:case 14:case 15:if(!Yt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var l=s,a=l.destroy;l=l.tag,a!==void 0&&(l&2||l&4)&&Uf(n,e,a),s=s.next}while(s!==r)}ti(t,e,n);break;case 1:if(!Yt&&(Ko(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){ht(n,e,c)}ti(t,e,n);break;case 21:ti(t,e,n);break;case 22:n.mode&1?(Yt=(r=Yt)||n.memoizedState!==null,ti(t,e,n),Yt=r):ti(t,e,n);break;default:ti(t,e,n)}}function o2(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new z6),e.forEach(function(r){var s=b6.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function bn(t,e){var n=e.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~l}if(r=s,r=vt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*O6(r/1960))-r,10t?16:t,ui===null)var r=!1;else{if(t=ui,ui=null,Gu=0,Oe&6)throw Error(ee(331));var s=Oe;for(Oe|=4,ce=t.current;ce!==null;){var l=ce,a=l.child;if(ce.flags&16){var c=l.deletions;if(c!==null){for(var d=0;dvt()-b0?qi(t,0):V0|=n),gn(t,e)}function c5(t,e){e===0&&(t.mode&1?(e=ja,ja<<=1,!(ja&130023424)&&(ja=4194304)):e=1);var n=en();t=Hr(t,e),t!==null&&(Al(t,e,n),gn(t,n))}function V6(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),c5(t,n)}function b6(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ee(314))}r!==null&&r.delete(e),c5(t,n)}var d5;d5=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||hn.current)dn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return dn=!1,M6(t,e,n);dn=!!(t.flags&131072)}else dn=!1,rt&&e.flags&1048576&&py(e,Mu,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;fu(t,e),t=e.pendingProps;var s=ts(e,Qt.current);Zo(e,n),s=O0(null,e,r,t,s,n);var l=H0();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,fn(r)?(l=!0,Ru(e)):l=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,L0(e),s.updater=nc,e.stateNode=s,s._reactInternals=e,Lf(e,r,t,n),e=Df(null,e,r,!0,l,n)):(e.tag=0,rt&&l&&E0(e),Zt(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(fu(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=K6(r),t=Kn(r,t),s){case 0:e=zf(null,e,r,t,n);break e;case 1:e=e2(null,e,r,t,n);break e;case 11:e=Z1(null,e,r,t,n);break e;case 14:e=J1(null,e,r,Kn(r.type,t),n);break e}throw Error(ee(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Kn(r,s),zf(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Kn(r,s),e2(t,e,r,s,n);case 3:e:{if(Yy(e),t===null)throw Error(ee(387));r=e.pendingProps,l=e.memoizedState,s=l.element,_y(t,e),zu(e,r,null,n);var a=e.memoizedState;if(r=a.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=l,e.memoizedState=l,e.flags&256){s=os(Error(ee(423)),e),e=t2(t,e,r,n,s);break e}else if(r!==s){s=os(Error(ee(424)),e),e=t2(t,e,r,n,s);break e}else for(vn=fi(e.stateNode.containerInfo.firstChild),xn=e,rt=!0,Yn=null,n=xy(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ns(),r===s){e=Ur(t,e,n);break e}Zt(t,e,r,n)}e=e.child}return e;case 5:return wy(e),t===null&&Rf(e),r=e.type,s=e.pendingProps,l=t!==null?t.memoizedProps:null,a=s.children,kf(r,s)?a=null:l!==null&&kf(r,l)&&(e.flags|=32),Xy(t,e),Zt(t,e,a,n),e.child;case 6:return t===null&&Rf(e),null;case 13:return Qy(t,e,n);case 4:return I0(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=rs(e,null,r,n):Zt(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Kn(r,s),Z1(t,e,r,s,n);case 7:return Zt(t,e,e.pendingProps,n),e.child;case 8:return Zt(t,e,e.pendingProps.children,n),e.child;case 12:return Zt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,l=e.memoizedProps,a=s.value,$e(Lu,r._currentValue),r._currentValue=a,l!==null)if(Zn(l.value,a)){if(l.children===s.children&&!hn.current){e=Ur(t,e,n);break e}}else for(l=e.child,l!==null&&(l.return=e);l!==null;){var c=l.dependencies;if(c!==null){a=l.child;for(var d=c.firstContext;d!==null;){if(d.context===r){if(l.tag===1){d=zr(-1,n&-n),d.tag=2;var g=l.updateQueue;if(g!==null){g=g.shared;var y=g.pending;y===null?d.next=d:(d.next=y.next,y.next=d),g.pending=d}}l.lanes|=n,d=l.alternate,d!==null&&(d.lanes|=n),Ff(l.return,n,e),c.lanes|=n;break}d=d.next}}else if(l.tag===10)a=l.type===e.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(ee(341));a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Ff(a,n,e),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===e){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}Zt(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Zo(e,n),s=An(s),r=r(s),e.flags|=1,Zt(t,e,r,n),e.child;case 14:return r=e.type,s=Kn(r,e.pendingProps),s=Kn(r.type,s),J1(t,e,r,s,n);case 15:return Wy(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Kn(r,s),fu(t,e),e.tag=1,fn(r)?(t=!0,Ru(e)):t=!1,Zo(e,n),jy(e,r,s),Lf(e,r,s,n),Df(null,e,r,!0,t,n);case 19:return $y(t,e,n);case 22:return Ky(t,e,n)}throw Error(ee(156,e.tag))};function h5(t,e){return Um(t,e)}function W6(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 zn(t,e,n,r){return new W6(t,e,n,r)}function Y0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function K6(t){if(typeof t=="function")return Y0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===f0)return 11;if(t===g0)return 14}return 2}function yi(t,e){var n=t.alternate;return n===null?(n=zn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function mu(t,e,n,r,s,l){var a=2;if(r=t,typeof t=="function")Y0(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Oo:return Zi(n.children,s,l,e);case h0:a=8,s|=8;break;case tf:return t=zn(12,n,e,s|2),t.elementType=tf,t.lanes=l,t;case nf:return t=zn(13,n,e,s),t.elementType=nf,t.lanes=l,t;case rf:return t=zn(19,n,e,s),t.elementType=rf,t.lanes=l,t;case wm:return oc(n,s,l,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Sm:a=10;break e;case _m:a=9;break e;case f0:a=11;break e;case g0:a=14;break e;case ii:a=16,r=null;break e}throw Error(ee(130,t==null?t:typeof t,""))}return e=zn(a,n,e,s),e.elementType=t,e.type=r,e.lanes=l,e}function Zi(t,e,n,r){return t=zn(7,t,r,e),t.lanes=n,t}function oc(t,e,n,r){return t=zn(22,t,r,e),t.elementType=wm,t.lanes=n,t.stateNode={isHidden:!1},t}function Gh(t,e,n){return t=zn(6,t,null,e),t.lanes=n,t}function Bh(t,e,n){return e=zn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function X6(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_h(0),this.expirationTimes=_h(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_h(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Q0(t,e,n,r,s,l,a,c,d){return t=new X6(t,e,n,c,d),e===1?(e=1,l===!0&&(e|=8)):e=0,l=zn(3,null,null,e),t.current=l,l.stateNode=t,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},L0(l),t}function Y6(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(m5)}catch(t){console.error(t)}}m5(),mm.exports=_n;var J6=mm.exports,y5,f2=J6;y5=f2.createRoot,f2.hydrateRoot;function e8({selected:t=!1}){return z.jsx("div",{style:{position:"relative",width:"32px",height:"32px"},children:z.jsx("div",{style:{position:"absolute",inset:"12.5% 4.17%",width:"calc(100% - 8.34%)",height:"calc(100% - 25%)"},children:z.jsx("img",{alt:"Layout",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:t?"/src/assets/icons/layout-selected.svg":"/src/assets/icons/layout-default.svg"})})})}function t8(){return z.jsx("div",{style:{width:"32px",height:"32px",position:"relative"},children:z.jsxs("div",{style:{height:"23.256px",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"32px"},children:[z.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,top:"46.19%"},children:z.jsx("img",{alt:"",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:"/src/assets/icons/huggy-hands.svg"})}),z.jsxs("div",{style:{position:"absolute",bottom:"3.6%",display:"contents",left:"16.68%",right:"3.92%",top:0},children:[z.jsx("div",{style:{position:"absolute",inset:"30.62% 32.64% 54.33% 35.75%"},children:z.jsx("img",{alt:"",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:"/src/assets/icons/huggy-eyes.svg"})}),z.jsx("div",{style:{position:"absolute",inset:"49.16% 36.4% 27.17% 38.44%"},children:z.jsx("img",{alt:"",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:"/src/assets/icons/huggy-mouth.svg"})}),z.jsx("div",{style:{position:"absolute",bottom:"3.6%",left:"16.68%",right:"3.92%",top:0},children:z.jsx("img",{alt:"",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:"/src/assets/icons/huggy-body.svg"})})]})]})})}function n8({selected:t=!1}){return z.jsx("div",{style:{position:"relative",width:"32px",height:"32px"},children:z.jsx("div",{style:{position:"absolute",inset:"8.33%",width:"calc(100% - 16.66%)",height:"calc(100% - 16.66%)"},children:z.jsx("img",{alt:"Image",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:t?"/src/assets/icons/image-selected.svg":"/src/assets/icons/image-default.svg"})})})}function r8({selected:t=!1}){return z.jsx("div",{style:{position:"relative",width:"32px",height:"32px"},children:z.jsx("div",{style:{position:"absolute",inset:"8.33%",width:"calc(100% - 16.66%)",height:"calc(100% - 16.66%)"},children:z.jsx("img",{alt:"Text",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:t?"/src/assets/icons/text-selected.svg":"/src/assets/icons/text-default.svg"})})})}const v5={seriousCollab:{id:"seriousCollab",name:"Serious Collab",thumbnail:"/assets/layouts/sCollab_thumbnail.png",objects:[{id:"hf-logo",type:"image",x:661.18,y:235.81,width:220.16,height:204.39,rotation:0,zIndex:1,src:"/assets/layouts/HF logo.png",name:"HF Logo"},{id:"logo-placeholder",type:"image",x:241.94,y:210.44,width:262.31,height:255.13,rotation:0,zIndex:2,src:"/assets/layouts/logo_placehoder.png",name:"Logo Placeholder"},{id:"x-icon",type:"image",x:579.79,y:329.62,width:16.76,height:16.76,rotation:0,zIndex:3,src:"/assets/layouts/collabX.svg",name:"X Icon"}]},funCollab:{id:"funCollab",name:"Fun Collab",thumbnail:"/assets/layouts/fCollab_thumbnail.png",objects:[{id:"title-text",type:"text",x:550,y:81.58,width:852,height:140,rotation:0,zIndex:1,text:"Pretty Short Title",fontSize:111.43,fontFamily:"Inter",fill:"#8a97ba",bold:!0,italic:!1,align:"center",isFixedSize:!0,offsetX:426},{id:"logo-placeholder",type:"image",x:235.6,y:241.76,width:389.66,height:382.51,rotation:351.366,zIndex:3,src:"/assets/layouts/logo_placehoder.png",name:"Logo Placeholder"},{id:"huggy-hand",type:"image",x:408.94,y:192.07,width:263,height:263,rotation:0,zIndex:2,src:"/assets/layouts/fCollab_huggy_hand_asset.png",name:"Huggy Hand"},{id:"huggy-group",type:"image",x:510.87,y:60,width:566,height:554,rotation:0,zIndex:4,src:"/assets/layouts/fCollab_huggy_asset.png",name:"Huggy Group"}]},sandwich:{id:"sandwich",name:"Sandwich",thumbnail:"/assets/layouts/sandwitch_thumbnail.png",objects:[{id:"title-text",type:"text",x:112.57,y:51.67,width:1050,height:190,rotation:0,zIndex:1,text:"Pretty short title",fontSize:161.62,fontFamily:"Bison",fill:"#8a97ba",bold:!0,italic:!1,align:"left",isFixedSize:!0},{id:"description-text",type:"text",x:600,y:503.48,width:1015,height:107,rotation:0,zIndex:2,text:"supportive description",fontSize:89.05,fontFamily:"Inter",fill:"#8a97ba",bold:!1,italic:!1,align:"center",isFixedSize:!0,offsetX:507.5},{id:"singing-huggy",type:"image",x:336.34,y:130,width:565,height:389,rotation:0,zIndex:3,src:"/assets/layouts/snadwithc_huggy_asset.png",name:"Singing Huggy"}]},docs:{id:"docs",name:"Docs",thumbnail:"/assets/layouts/docs_thumbnail.png",objects:[{id:"docs-huggy-logo",type:"image",x:466,y:145.67,width:268,height:268,rotation:0,zIndex:1,src:"/assets/layouts/docsHFLogo.png",name:"Docs HF Logo"},{id:"title-text",type:"text",x:570,y:320.67,width:643,height:111,rotation:0,zIndex:2,text:"Transformers",fontSize:105.93,fontFamily:"Inter",fill:"#121212",bold:!0,italic:!1,align:"center",isFixedSize:!0,offsetX:321.5},{id:"subtitle-text",type:"text",x:600,y:436.67,width:421,height:56,rotation:0,zIndex:3,text:"Documentation",fontSize:53.93,fontFamily:"IBM Plex Mono",fill:"#747474",bold:!1,italic:!1,align:"center",isFixedSize:!0,offsetX:210.5}]}};function g2(t){return v5[t]}function i8(){return Object.values(v5)}function o8({onSelectLayout:t}){const e=i8();return z.jsx("div",{className:"layout-selector absolute left-[calc(100%+4px)] top-[5px] bg-[#f8f9fa] border border-[#3faee6] rounded-[10px] p-[5px] shadow-lg inline-block",children:z.jsxs("div",{className:"flex flex-col gap-0",children:[z.jsx("div",{className:"flex gap-0",children:e.slice(0,2).map(n=>z.jsxs("button",{onClick:()=>t(n.id),className:"flex flex-col items-center gap-[5px] p-[10px] rounded-[5px] hover:bg-[#e9ecef] transition-colors flex-1",children:[z.jsx("div",{className:"w-[96.5px] h-[47.291px] rounded-[5px] flex items-center justify-center overflow-hidden",children:z.jsx("img",{src:n.thumbnail,alt:n.name,className:"w-full h-full object-cover"})}),z.jsx("p",{className:"text-[14px] font-normal text-[#545865] text-center",children:n.name})]},n.id))}),z.jsx("div",{className:"flex gap-0",children:e.slice(2,4).map(n=>z.jsxs("button",{onClick:()=>t(n.id),className:"flex flex-col items-center gap-[5px] p-[10px] rounded-[5px] hover:bg-[#e9ecef] transition-colors flex-1",children:[z.jsx("div",{className:"w-[96.5px] h-[47.291px] rounded-[5px] flex items-center justify-center overflow-hidden",children:z.jsx("img",{src:n.thumbnail,alt:n.name,className:"w-full h-full object-cover"})}),z.jsx("p",{className:"text-[14px] font-normal text-[#545865] text-center",children:n.name})]},n.id))})]})})}const ke="https://huggingface.co/datasets/Chunte/Huggy/resolve/main",s8=[{id:"acedemic-huggy",name:"Acedemic Huggy",thumbnail:`${ke}/modern%20Huggies/Acedemic%20Huggy.png`,category:"modern",tags:["acedemic","academic","education","modern"]},{id:"back-of-huggy",name:"Back of a Huggy",thumbnail:`${ke}/modern%20Huggies/Back%20of%20a%20Huggy.png`,category:"modern",tags:["back","modern"]},{id:"d-huggy",name:"D Huggy",thumbnail:`${ke}/modern%20Huggies/D%20Huggy.png`,category:"modern",tags:["d","letter","modern"]},{id:"dragon-huggy",name:"Dragon Huggy",thumbnail:`${ke}/modern%20Huggies/Dragon%20Huggy.png`,category:"modern",tags:["dragon","fantasy","modern"]},{id:"game-jam-huggy",name:"Game Jam Huggy",thumbnail:`${ke}/modern%20Huggies/Game%20Jam%20Huggy.png`,category:"modern",tags:["game","jam","gaming","modern"]},{id:"huggy-chef",name:"Huggy Chef",thumbnail:`${ke}/modern%20Huggies/Huggy%20Chef.png`,category:"modern",tags:["chef","cooking","food","modern"]},{id:"huggy-hi",name:"Huggy Hi",thumbnail:`${ke}/modern%20Huggies/Huggy%20Hi.png`,category:"modern",tags:["hi","hello","greeting","wave","modern"]},{id:"huggy-lab",name:"Huggy Lab",thumbnail:`${ke}/modern%20Huggies/Huggy%20Lab.png`,category:"modern",tags:["lab","laboratory","science","modern"]},{id:"huggy-medic",name:"Huggy Medic",thumbnail:`${ke}/modern%20Huggies/Huggy%20Medic.png`,category:"modern",tags:["medic","medical","doctor","health","modern"]},{id:"huggy-okay",name:"Huggy Okay",thumbnail:`${ke}/modern%20Huggies/Huggy%20Okay.png`,category:"modern",tags:["okay","ok","thumbs up","modern"]},{id:"huggy-sunny-hello",name:"Huggy Sunny hello",thumbnail:`${ke}/modern%20Huggies/Huggy%20Sunny%20hello.png`,category:"modern",tags:["sunny","hello","greeting","summer","modern"]},{id:"huggy-sunny",name:"Huggy Sunny",thumbnail:`${ke}/modern%20Huggies/Huggy%20Sunny.png`,category:"modern",tags:["sunny","summer","sun","modern"]},{id:"huggy-yolk",name:"Huggy Yolk",thumbnail:`${ke}/modern%20Huggies/Huggy%20Yolk.png`,category:"modern",tags:["yolk","egg","food","modern"]},{id:"huggy-blink-okay",name:"Huggy blink Okay",thumbnail:`${ke}/modern%20Huggies/Huggy%20blink%20Okay.png`,category:"modern",tags:["blink","okay","wink","modern"]},{id:"huggy-the-pooh-meme",name:"Huggy the Pooh meme",thumbnail:`${ke}/modern%20Huggies/Huggy%20the%20Pooh%20meme.png`,category:"modern",tags:["pooh","meme","funny","modern"]},{id:"idefics-huggy",name:"IDEFICS Huggy",thumbnail:`${ke}/modern%20Huggies/IDEFICS%20Huggy.png`,category:"modern",tags:["idefics","vision","multimodal","ai","modern"]},{id:"karaoke-huggy",name:"Karaoke Huggy",thumbnail:`${ke}/modern%20Huggies/Karaoke%20Huggy.png`,category:"modern",tags:["karaoke","singing","music","modern"]},{id:"lora-huggy",name:"Lora Huggy",thumbnail:`${ke}/modern%20Huggies/Lora%20Huggy.png`,category:"modern",tags:["lora","ai","model","modern"]},{id:"optimum-huggy",name:"Optimum Huggy",thumbnail:`${ke}/modern%20Huggies/Optimum%20Huggy.png`,category:"modern",tags:["optimum","optimization","ai","modern"]},{id:"robot-huggy",name:"Robot Huggy",thumbnail:`${ke}/modern%20Huggies/Robot%20Huggy.png`,category:"modern",tags:["robot","automation","ai","modern"]},{id:"snake-huggy",name:"Snake Huggy",thumbnail:`${ke}/modern%20Huggies/Snake%20Huggy.png`,category:"modern",tags:["snake","python","code","modern"]},{id:"super-huggy",name:"Super Huggy",thumbnail:`${ke}/modern%20Huggies/Super%20Huggy.png`,category:"modern",tags:["super","hero","superhero","modern"]},{id:"text-generation-wizard-huggy",name:"Text Generation Wizard Huggy",thumbnail:`${ke}/modern%20Huggies/Text%20Generation%20Wizard%20Huggy.png`,category:"modern",tags:["text","generation","wizard","nlp","ai","modern"]},{id:"transformer-agent-huggy",name:"Transformer Agent Huggy",thumbnail:`${ke}/modern%20Huggies/Transformer%20Agent%20Huggy.png`,category:"modern",tags:["transformer","agent","ai","nlp","modern"]},{id:"wine-huggy",name:"Wine Huggy",thumbnail:`${ke}/modern%20Huggies/Wine%20Huggy.png`,category:"modern",tags:["wine","drink","celebration","modern"]},{id:"computer-vision-huggy",name:"computer vision Huggy",thumbnail:`${ke}/modern%20Huggies/computer%20vision%20Huggy.png`,category:"modern",tags:["computer","vision","cv","ai","model","modern"]}],l8=[{id:"catching-huggy",name:"Catching Huggy",thumbnail:`${ke}/Outlined%20Huggies/Catching%20Huggy.png`,category:"outlined",tags:["catching","catch","outlined"]},{id:"comic-huggy",name:"Comic Huggy",thumbnail:`${ke}/Outlined%20Huggies/Comic%20Huggy.png`,category:"outlined",tags:["comic","cartoon","outlined"]},{id:"curious-huggy",name:"Curious Huggy",thumbnail:`${ke}/Outlined%20Huggies/Curious%20Huggy.png`,category:"outlined",tags:["curious","wondering","thinking","outlined"]},{id:"diffusor-guide-huggy",name:"Diffusor guide Huggy",thumbnail:`${ke}/Outlined%20Huggies/Diffusor%20guide%20Huggy.png`,category:"outlined",tags:["diffusor","diffusion","guide","ai","outlined"]},{id:"fishing-huggy",name:"Fishing Huggy",thumbnail:`${ke}/Outlined%20Huggies/Fishing%20Huggy.png`,category:"outlined",tags:["fishing","fish","outdoor","outlined"]},{id:"gpu-huggy",name:"GPU Huggy",thumbnail:`${ke}/Outlined%20Huggies/GPU%20Huggy.png`,category:"outlined",tags:["gpu","graphics","computing","hardware","outlined"]},{id:"global-huggy",name:"Global Huggy",thumbnail:`${ke}/Outlined%20Huggies/Global%20Huggy.png`,category:"outlined",tags:["global","world","international","outlined"]},{id:"greeting-huggy-left",name:"Greeting Huggy left",thumbnail:`${ke}/Outlined%20Huggies/Greeting%20Huggy%20left.png`,category:"outlined",tags:["greeting","hello","wave","left","outlined"]},{id:"greeting-huggy-right",name:"Greeting Huggy right",thumbnail:`${ke}/Outlined%20Huggies/Greeting%20Huggy%20right.png`,category:"outlined",tags:["greeting","hello","wave","right","outlined"]},{id:"growing-model-huggy",name:"Growing model Huggy",thumbnail:`${ke}/Outlined%20Huggies/Growing%20model%20Huggy.png`,category:"outlined",tags:["growing","model","ai","growth","outlined"]},{id:"guide-huggy",name:"Guide Huggy",thumbnail:`${ke}/Outlined%20Huggies/Guide%20Huggy.png`,category:"outlined",tags:["guide","help","tutorial","outlined"]},{id:"loving-modelndataset-huggy",name:"Loving modelndataset Huggy",thumbnail:`${ke}/Outlined%20Huggies/Loving%20modelndataset%20Huggy.png`,category:"outlined",tags:["loving","model","dataset","heart","outlined"]},{id:"manager-huggy",name:"Manager Huggy",thumbnail:`${ke}/Outlined%20Huggies/Manager%20Huggy.png`,category:"outlined",tags:["manager","management","business","outlined"]},{id:"paper-huggy",name:"Paper Huggy",thumbnail:`${ke}/Outlined%20Huggies/Paper%20Huggy.png`,category:"outlined",tags:["paper","research","document","outlined"]},{id:"rocket-huggy",name:"Rocket Huggy",thumbnail:`${ke}/Outlined%20Huggies/Rocket%20Huggy.png`,category:"outlined",tags:["rocket","space","launch","fast","outlined"]},{id:"scan-huggy",name:"Scan Huggy",thumbnail:`${ke}/Outlined%20Huggies/Scan%20Huggy.png`,category:"outlined",tags:["scan","search","find","outlined"]},{id:"violinist-huggy",name:"Violinist Huggy",thumbnail:`${ke}/Outlined%20Huggies/Violinist%20Huggy.png`,category:"outlined",tags:["violinist","violin","music","classical","outlined"]},{id:"xray-huggy",name:"X-ray Huggy",thumbnail:`${ke}/Outlined%20Huggies/X-ray%20Huggy.png`,category:"outlined",tags:["xray","x-ray","medical","scan","outlined"]}],p2=[...s8,...l8];function a8(t){if(!t.trim())return p2;const e=t.toLowerCase().trim();return p2.filter(n=>!!(n.name.toLowerCase().replace("huggy","").trim().includes(e)||n.name.toLowerCase().includes(e)||n.category.toLowerCase().includes(e)||n.tags&&n.tags.some(s=>s.toLowerCase().includes(e))))}const m2=12,y2=6;function u8({onSelectHuggy:t,onClose:e}){const[n,r]=Q.useState(""),[s,l]=Q.useState(m2),[a,c]=Q.useState(new Set),d=Q.useRef(null),g=Q.useMemo(()=>a8(n),[n]),y=g.slice(0,s),w=s{const P=d.current;if(!P||!w)return;const C=setTimeout(()=>{const{scrollHeight:p,clientHeight:S}=P;p<=S&&w&&l(R=>Math.min(R+y2,g.length))},100);return()=>clearTimeout(C)},[s,w,g.length]),Q.useEffect(()=>{const P=d.current;if(!P)return;const k=()=>{const{scrollTop:C,scrollHeight:p,clientHeight:S}=P;(C+S)/p>.8&&w&&l(F=>Math.min(F+y2,g.length))};return P.addEventListener("scroll",k),()=>P.removeEventListener("scroll",k)},[w,g.length]);const x=P=>{t(P),e()},_=P=>{c(k=>{const C=new Set(k);return C.delete(P),C})},v=P=>{c(k=>new Set(k).add(P))},E=P=>{r(P.target.value),l(m2)};return z.jsxs(z.Fragment,{children:[z.jsx("div",{className:"fixed inset-0 z-10",onClick:e}),z.jsxs("div",{className:"huggy-menu fixed left-[107px] top-[20px] z-20 w-[340px] bg-[#f8f9fa] border border-[#3faee6] rounded-[10px] flex flex-col overflow-hidden shadow-lg",children:[z.jsx("div",{className:"border-b border-[#ebebeb] p-[5px]",children:z.jsx("input",{type:"text",placeholder:"Search Huggy",value:n,onChange:E,className:"w-full bg-transparent border-none outline-none text-[14px] text-[#999999] font-['Inter'] placeholder-[#999999]",autoFocus:!0})}),z.jsx("div",{ref:d,className:"overflow-y-auto p-[5px]",style:{maxHeight:"430px"},children:g.length===0?z.jsx("div",{className:"text-center text-[#999999] text-[14px] py-8",children:"No Huggys found"}):z.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-[5px] p-[5px]",children:y.map(P=>z.jsxs("button",{onClick:()=>x(P),className:"relative w-full aspect-square rounded-[5px] overflow-hidden hover:bg-[#e9ecef] transition-colors cursor-pointer border-none p-0",title:P.name,children:[a.has(P.id)&&z.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#f0f0f0]",children:z.jsx("div",{className:"w-6 h-6 border-2 border-[#3faee6] border-t-transparent rounded-full animate-spin"})}),z.jsx("img",{src:P.thumbnail,alt:P.name,className:"w-full h-full object-cover",loading:"lazy",onLoadStart:()=>v(P.id),onLoad:()=>_(P.id),onError:()=>_(P.id)})]},P.id))})}),z.jsx("div",{className:"border-t border-[#ebebeb] p-[5px] text-center",children:z.jsxs("p",{className:"text-[#999999] text-[12px]",children:["Showing ",y.length," of ",g.length," Huggys"]})})]})]})}function c8({onLayoutClick:t,onHuggyClick:e,onImageClick:n,onTextClick:r,onSelectLayout:s,onSelectHuggy:l,activeButton:a}){return z.jsx("div",{className:"fixed left-5 top-1/2 -translate-y-1/2 z-50",children:z.jsxs("div",{className:"sidebar-container bg-[#f8f9fa] border border-[#D7DCE2] rounded-[12px] p-[5px] flex flex-col gap-[15px] w-[87px] relative",children:[z.jsxs("button",{onClick:t,className:`flex flex-col items-center gap-[3px] px-[13px] py-[5px] rounded-[7px] transition-colors ${a==="layout"?"bg-[#3faee6]":"hover:bg-[#e9ecef]"}`,children:[z.jsx("div",{className:"w-[32px] h-[32px] flex items-center justify-center",children:z.jsx(e8,{selected:a==="layout"})}),z.jsx("p",{className:`text-[16px] font-normal ${a==="layout"?"text-white":"text-[#545865]"}`,children:"Layout"})]}),z.jsxs("button",{onClick:e,className:`flex flex-col items-center gap-[3px] px-[13px] py-[5px] rounded-[7px] transition-colors ${a==="huggy"?"bg-[#3faee6]":"hover:bg-[#e9ecef]"}`,children:[z.jsx("div",{className:"w-[32px] h-[32px] flex items-center justify-center",children:z.jsx(t8,{})}),z.jsx("p",{className:`text-[16px] font-normal ${a==="huggy"?"text-white":"text-[#545865]"}`,children:"Huggy"})]}),z.jsxs("button",{onClick:n,className:`flex flex-col items-center gap-[3px] px-[13px] py-[5px] rounded-[7px] transition-colors ${a==="image"?"bg-[#3faee6]":"hover:bg-[#e9ecef]"}`,children:[z.jsx("div",{className:"w-[32px] h-[32px] flex items-center justify-center",children:z.jsx(n8,{selected:a==="image"})}),z.jsx("p",{className:`text-[16px] font-normal ${a==="image"?"text-white":"text-[#545865]"}`,children:"Image"})]}),z.jsxs("button",{onClick:r,className:`flex flex-col items-center gap-[3px] px-[13px] py-[5px] rounded-[7px] transition-colors ${a==="text"?"bg-[#3faee6]":"hover:bg-[#e9ecef]"}`,children:[z.jsx("div",{className:"w-[32px] h-[32px] flex items-center justify-center",children:z.jsx(r8,{selected:a==="text"})}),z.jsx("p",{className:`text-[16px] font-normal ${a==="text"?"text-white":"text-[#545865]"}`,children:"Text"})]}),a==="layout"&&z.jsx(o8,{onSelectLayout:s}),a==="huggy"&&z.jsx(u8,{onSelectHuggy:l,onClose:()=>e()}),a==="text"&&z.jsx("div",{className:"text-hint absolute left-[calc(100%+4px)] bottom-[5px] bg-[#3faee6] rounded-[10px] p-[10px] w-[233px]",children:z.jsx("p",{className:"text-white text-[16px] font-normal leading-normal",children:"Click anywhere on the canvas to add texts"})})]})})}/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var d8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),so=(t,e)=>{const n=Q.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:a,className:c="",children:d,...g},y)=>Q.createElement("svg",{ref:y,...d8,width:s,height:s,stroke:r,strokeWidth:a?Number(l)*24/Number(s):l,className:["lucide",`lucide-${h8(t)}`,c].join(" "),...g},[...e.map(([w,x])=>Q.createElement(w,x)),...Array.isArray(d)?d:[d]]));return n.displayName=`${t}`,n};/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f8=so("Bold",[["path",{d:"M14 12a4 4 0 0 0 0-8H6v8",key:"v2sylx"}],["path",{d:"M15 20a4 4 0 0 0 0-8H6v8Z",key:"1ef5ya"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g8=so("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p8=so("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m8=so("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y8=so("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v8=so("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x8=so("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function S8({onExport:t,isExporting:e=!1,currentLayout:n,canvasSize:r}){const s=P=>{switch(P){case"1200x675":return"Twitter";case"linkedin":return"LinkedIn";case"hf":return"HF";default:return"Twitter"}},l=()=>{const P=s(r);return n?`${n}_${P}`:`thumbnail_${P}`},[a,c]=Q.useState(l()),[d,g]=Q.useState(!1),[y,w]=Q.useState(0),[x,_]=Q.useState(!1),v=Q.useRef(null);Q.useEffect(()=>{c(l())},[n,r]),Q.useEffect(()=>{v.current&&w(v.current.offsetWidth)},[a]);const E=()=>{e||t(a)};return z.jsxs("div",{style:{position:"fixed",top:"10px",right:"22px",zIndex:50,backgroundColor:"#262933",borderRadius:"10px",padding:"5px",display:"inline-flex",alignItems:"stretch",gap:"5px",boxShadow:"0px 0px 0px 0px rgba(0,0,0,0), 0px 0px 0px 0px rgba(0,0,0,0.03), 0px 0px 6.417px 0px rgba(0,0,0,0.09), 0px 0px 4.583px 0px rgba(0,0,0,0.15), 0px 0px 2.75px 0px rgba(0,0,0,0.17), 0px 16.847px 21.059px -4.212px rgba(14,13,13,0.1), 0px 8.423px 8.423px -4.212px rgba(0,0,0,0.04)",opacity:e?.5:1,transition:"all 0.2s ease-in-out",width:"fit-content"},children:[z.jsx("button",{onClick:E,disabled:e,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:x?"#0d6ecc":"#1888ff",borderRadius:"5px",width:"32px",aspectRatio:"1",flexShrink:0,border:"none",cursor:e?"not-allowed":"pointer",padding:0},children:e?z.jsx(y8,{size:16,color:"white",style:{animation:"spin 1s linear infinite"}}):z.jsx(p8,{size:16,color:"white"})}),z.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",paddingRight:"5px",minHeight:"32px"},children:[z.jsx("span",{ref:v,style:{position:"absolute",visibility:"hidden",whiteSpace:"pre",fontSize:"16px",fontFamily:"Inter, sans-serif",fontWeight:"normal",padding:"5px"},children:a||"thumbnail_name"}),z.jsx("input",{type:"text",value:a,onChange:P=>c(P.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),disabled:e,placeholder:"thumbnail_name",style:{backgroundColor:"rgba(255, 255, 255, 0.05)",color:"white",fontSize:"16px",fontFamily:"Inter, sans-serif",fontWeight:"normal",outline:"none",border:"none",padding:"5px",borderRadius:"4px",width:`${y}px`,cursor:e?"not-allowed":"text",opacity:d?1:.5,transition:"opacity 0.2s"},onClick:P=>P.stopPropagation()}),z.jsx("span",{style:{color:"white",fontSize:"16px",fontFamily:"Inter, sans-serif",fontWeight:"normal"},children:".png"})]})]})}function _8({children:t,scale:e=1}){return z.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:z.jsx("div",{className:"canvas-container",style:{display:"flex",flexDirection:"column",gap:"10px"},children:t})})}var J0={exports:{}},cc={},Vu={},Re={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const e=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}t.glob=typeof i1<"u"?i1:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},t.Konva={_global:t.glob,version:"9.3.22",isBrowser:n(),isUnminified:/param/.test((function(s){}).toString()),dblClickWindow:400,getAngle(s){return t.Konva.angleDeg?s*e:s},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return t.Konva.DD.isDragging},isTransforming(){var s;return(s=t.Konva.Transformer)===null||s===void 0?void 0:s.isTransforming()},isDragReady(){return!!t.Konva.DD.node},releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(s){t.glob.Konva=s}};const r=s=>{t.Konva[s.prototype.getClassName()]=s};t._registerNode=r,t.Konva._injectGlobal(t.Konva)})(Re);var ct={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=Re;class n{constructor(S=[1,0,0,1,0,0]){this.dirty=!1,this.m=S&&S.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(S){S.m[0]=this.m[0],S.m[1]=this.m[1],S.m[2]=this.m[2],S.m[3]=this.m[3],S.m[4]=this.m[4],S.m[5]=this.m[5]}point(S){const R=this.m;return{x:R[0]*S.x+R[2]*S.y+R[4],y:R[1]*S.x+R[3]*S.y+R[5]}}translate(S,R){return this.m[4]+=this.m[0]*S+this.m[2]*R,this.m[5]+=this.m[1]*S+this.m[3]*R,this}scale(S,R){return this.m[0]*=S,this.m[1]*=S,this.m[2]*=R,this.m[3]*=R,this}rotate(S){const R=Math.cos(S),F=Math.sin(S),L=this.m[0]*R+this.m[2]*F,N=this.m[1]*R+this.m[3]*F,I=this.m[0]*-F+this.m[2]*R,M=this.m[1]*-F+this.m[3]*R;return this.m[0]=L,this.m[1]=N,this.m[2]=I,this.m[3]=M,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(S,R){const F=this.m[0]+this.m[2]*R,L=this.m[1]+this.m[3]*R,N=this.m[2]+this.m[0]*S,I=this.m[3]+this.m[1]*S;return this.m[0]=F,this.m[1]=L,this.m[2]=N,this.m[3]=I,this}multiply(S){const R=this.m[0]*S.m[0]+this.m[2]*S.m[1],F=this.m[1]*S.m[0]+this.m[3]*S.m[1],L=this.m[0]*S.m[2]+this.m[2]*S.m[3],N=this.m[1]*S.m[2]+this.m[3]*S.m[3],I=this.m[0]*S.m[4]+this.m[2]*S.m[5]+this.m[4],M=this.m[1]*S.m[4]+this.m[3]*S.m[5]+this.m[5];return this.m[0]=R,this.m[1]=F,this.m[2]=L,this.m[3]=N,this.m[4]=I,this.m[5]=M,this}invert(){const S=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),R=this.m[3]*S,F=-this.m[1]*S,L=-this.m[2]*S,N=this.m[0]*S,I=S*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),M=S*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=R,this.m[1]=F,this.m[2]=L,this.m[3]=N,this.m[4]=I,this.m[5]=M,this}getMatrix(){return this.m}decompose(){const S=this.m[0],R=this.m[1],F=this.m[2],L=this.m[3],N=this.m[4],I=this.m[5],M=S*L-R*F,U={x:N,y:I,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(S!=0||R!=0){const W=Math.sqrt(S*S+R*R);U.rotation=R>0?Math.acos(S/W):-Math.acos(S/W),U.scaleX=W,U.scaleY=M/W,U.skewX=(S*F+R*L)/M,U.skewY=0}else if(F!=0||L!=0){const W=Math.sqrt(F*F+L*L);U.rotation=Math.PI/2-(L>0?Math.acos(-F/W):-Math.acos(F/W)),U.scaleX=M/W,U.scaleY=W,U.skewX=0,U.skewY=(S*F+R*L)/M}return U.rotation=t.Util._getRotation(U.rotation),U}}t.Transform=n;const r="[object Array]",s="[object Number]",l="[object String]",a="[object Boolean]",c=Math.PI/180,d=180/Math.PI,g="#",y="",w="0",x="Konva warning: ",_="Konva error: ",v="rgb(",E={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]},P=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let k=[];const C=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(p){setTimeout(p,60)};t.Util={_isElement(p){return!!(p&&p.nodeType==1)},_isFunction(p){return!!(p&&p.constructor&&p.call&&p.apply)},_isPlainObject(p){return!!p&&p.constructor===Object},_isArray(p){return Object.prototype.toString.call(p)===r},_isNumber(p){return Object.prototype.toString.call(p)===s&&!isNaN(p)&&isFinite(p)},_isString(p){return Object.prototype.toString.call(p)===l},_isBoolean(p){return Object.prototype.toString.call(p)===a},isObject(p){return p instanceof Object},isValidSelector(p){if(typeof p!="string")return!1;const S=p[0];return S==="#"||S==="."||S===S.toUpperCase()},_sign(p){return p===0||p>0?1:-1},requestAnimFrame(p){k.push(p),k.length===1&&C(function(){const S=k;k=[],S.forEach(function(R){R()})})},createCanvasElement(){const p=document.createElement("canvas");try{p.style=p.style||{}}catch{}return p},createImageElement(){return document.createElement("img")},_isInDocument(p){for(;p=p.parentNode;)if(p==document)return!0;return!1},_urlToImage(p,S){const R=t.Util.createImageElement();R.onload=function(){S(R)},R.src=p},_rgbToHex(p,S,R){return((1<<24)+(p<<16)+(S<<8)+R).toString(16).slice(1)},_hexToRgb(p){p=p.replace(g,y);const S=parseInt(p,16);return{r:S>>16&255,g:S>>8&255,b:S&255}},getRandomColor(){let p=(Math.random()*16777215<<0).toString(16);for(;p.length<6;)p=w+p;return g+p},getRGB(p){let S;return p in E?(S=E[p],{r:S[0],g:S[1],b:S[2]}):p[0]===g?this._hexToRgb(p.substring(1)):p.substr(0,4)===v?(S=P.exec(p.replace(/ /g,"")),{r:parseInt(S[1],10),g:parseInt(S[2],10),b:parseInt(S[3],10)}):{r:0,g:0,b:0}},colorToRGBA(p){return p=p||"black",t.Util._namedColorToRBA(p)||t.Util._hex3ColorToRGBA(p)||t.Util._hex4ColorToRGBA(p)||t.Util._hex6ColorToRGBA(p)||t.Util._hex8ColorToRGBA(p)||t.Util._rgbColorToRGBA(p)||t.Util._rgbaColorToRGBA(p)||t.Util._hslColorToRGBA(p)},_namedColorToRBA(p){const S=E[p.toLowerCase()];return S?{r:S[0],g:S[1],b:S[2],a:1}:null},_rgbColorToRGBA(p){if(p.indexOf("rgb(")===0){p=p.match(/rgb\(([^)]+)\)/)[1];const S=p.split(/ *, */).map(Number);return{r:S[0],g:S[1],b:S[2],a:1}}},_rgbaColorToRGBA(p){if(p.indexOf("rgba(")===0){p=p.match(/rgba\(([^)]+)\)/)[1];const S=p.split(/ *, */).map((R,F)=>R.slice(-1)==="%"?F===3?parseInt(R)/100:parseInt(R)/100*255:Number(R));return{r:S[0],g:S[1],b:S[2],a:S[3]}}},_hex8ColorToRGBA(p){if(p[0]==="#"&&p.length===9)return{r:parseInt(p.slice(1,3),16),g:parseInt(p.slice(3,5),16),b:parseInt(p.slice(5,7),16),a:parseInt(p.slice(7,9),16)/255}},_hex6ColorToRGBA(p){if(p[0]==="#"&&p.length===7)return{r:parseInt(p.slice(1,3),16),g:parseInt(p.slice(3,5),16),b:parseInt(p.slice(5,7),16),a:1}},_hex4ColorToRGBA(p){if(p[0]==="#"&&p.length===5)return{r:parseInt(p[1]+p[1],16),g:parseInt(p[2]+p[2],16),b:parseInt(p[3]+p[3],16),a:parseInt(p[4]+p[4],16)/255}},_hex3ColorToRGBA(p){if(p[0]==="#"&&p.length===4)return{r:parseInt(p[1]+p[1],16),g:parseInt(p[2]+p[2],16),b:parseInt(p[3]+p[3],16),a:1}},_hslColorToRGBA(p){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(p)){const[S,...R]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(p),F=Number(R[0])/360,L=Number(R[1])/100,N=Number(R[2])/100;let I,M,U;if(L===0)return U=N*255,{r:Math.round(U),g:Math.round(U),b:Math.round(U),a:1};N<.5?I=N*(1+L):I=N+L-N*L;const W=2*N-I,$=[0,0,0];for(let ie=0;ie<3;ie++)M=F+1/3*-(ie-1),M<0&&M++,M>1&&M--,6*M<1?U=W+(I-W)*6*M:2*M<1?U=I:3*M<2?U=W+(I-W)*(2/3-M)*6:U=W,$[ie]=U*255;return{r:Math.round($[0]),g:Math.round($[1]),b:Math.round($[2]),a:1}}},haveIntersection(p,S){return!(S.x>p.x+p.width||S.x+S.widthp.y+p.height||S.y+S.height1?(I=R,M=F,U=(R-L)*(R-L)+(F-N)*(F-N)):(I=p+$*(R-p),M=S+$*(F-S),U=(I-L)*(I-L)+(M-N)*(M-N))}return[I,M,U]},_getProjectionToLine(p,S,R){const F=t.Util.cloneObject(p);let L=Number.MAX_VALUE;return S.forEach(function(N,I){if(!R&&I===S.length-1)return;const M=S[(I+1)%S.length],U=t.Util._getProjectionToSegment(N.x,N.y,M.x,M.y,p.x,p.y),W=U[0],$=U[1],ie=U[2];ieS.length){const I=S;S=p,p=I}for(let I=0;I{S.width=0,S.height=0})},drawRoundedRectPath(p,S,R,F){let L=0,N=0,I=0,M=0;typeof F=="number"?L=N=I=M=Math.min(F,S/2,R/2):(L=Math.min(F[0]||0,S/2,R/2),N=Math.min(F[1]||0,S/2,R/2),M=Math.min(F[2]||0,S/2,R/2),I=Math.min(F[3]||0,S/2,R/2)),p.moveTo(L,0),p.lineTo(S-N,0),p.arc(S-N,N,N,Math.PI*3/2,0,!1),p.lineTo(S,R-M),p.arc(S-M,R-M,M,0,Math.PI/2,!1),p.lineTo(I,R),p.arc(I,R-I,I,Math.PI/2,Math.PI,!1),p.lineTo(0,L),p.arc(L,L,L,Math.PI,Math.PI*3/2,!1)}}})(ct);var it={},qn={},Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.HitContext=Dr.SceneContext=Dr.Context=void 0;const x5=ct,w8=Re;function C8(t){const e=[],n=t.length,r=x5.Util;for(let s=0;stypeof y=="number"?Math.floor(y):y)),l+=k8+g.join(v2)+E8)):(l+=c.property,e||(l+=F8+c.val)),l+=N8;return l}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,r;n.push(e),r=n.length,r>=L8&&n.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){const n=e.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(e){const n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){const n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,s,l,a){this._context.arc(e,n,r,s,l,a)}arcTo(e,n,r,s,l){this._context.arcTo(e,n,r,s,l)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,s,l,a){this._context.bezierCurveTo(e,n,r,s,l,a)}clearRect(e,n,r,s){this._context.clearRect(e,n,r,s)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){const r=arguments;if(r.length===2)return this._context.createImageData(e,n);if(r.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,r,s){return this._context.createLinearGradient(e,n,r,s)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,s,l,a){return this._context.createRadialGradient(e,n,r,s,l,a)}drawImage(e,n,r,s,l,a,c,d,g){const y=arguments,w=this._context;y.length===3?w.drawImage(e,n,r):y.length===5?w.drawImage(e,n,r,s,l):y.length===9&&w.drawImage(e,n,r,s,l,a,c,d,g)}ellipse(e,n,r,s,l,a,c,d){this._context.ellipse(e,n,r,s,l,a,c,d)}isPointInPath(e,n,r,s){return r?this._context.isPointInPath(r,e,n,s):this._context.isPointInPath(e,n,s)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,r,s){this._context.fillRect(e,n,r,s)}strokeRect(e,n,r,s){this._context.strokeRect(e,n,r,s)}fillText(e,n,r,s){s?this._context.fillText(e,n,r,s):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,s){return this._context.getImageData(e,n,r,s)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,s){this._context.rect(e,n,r,s)}roundRect(e,n,r,s,l){this._context.roundRect(e,n,r,s,l)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,s){this._context.quadraticCurveTo(e,n,r,s)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}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,n,r,s,l,a){this._context.setTransform(e,n,r,s,l,a)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,r,s){this._context.strokeText(e,n,r,s)}transform(e,n,r,s,l,a){this._context.transform(e,n,r,s,l,a)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=x2.length,r=this.setAttr,s,l;const a=function(c){let d=e[c],g;e[c]=function(){return l=C8(Array.prototype.slice.call(arguments,0)),g=d.apply(e,arguments),e._trace({method:c,args:l}),g}};for(s=0;s{s.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){let r;return t.DD._dragElements.forEach(s=>{r=s.node}),r},_dragElements:new Map,_drag(r){const s=[];t.DD._dragElements.forEach((l,a)=>{const{node:c}=l,d=c.getStage();d.setPointersPositions(r),l.pointerId===void 0&&(l.pointerId=n.Util._getFirstPointerId(r));const g=d._changedPointerPositions.find(y=>y.id===l.pointerId);if(g){if(l.dragStatus!=="dragging"){const y=c.dragDistance();if(Math.max(Math.abs(g.x-l.startPointerPos.x),Math.abs(g.y-l.startPointerPos.y)){l.fire("dragmove",{type:"dragmove",target:l,evt:r},!0)})},_endDragBefore(r){const s=[];t.DD._dragElements.forEach(l=>{const{node:a}=l,c=a.getStage();if(r&&c.setPointersPositions(r),!c._changedPointerPositions.find(y=>y.id===l.pointerId))return;(l.dragStatus==="dragging"||l.dragStatus==="stopped")&&(t.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,l.dragStatus="stopped");const g=l.node.getLayer()||l.node instanceof e.Konva.Stage&&l.node;g&&s.indexOf(g)===-1&&s.push(g)}),s.forEach(l=>{l.draw()})},_endDragAfter(r){t.DD._dragElements.forEach((s,l)=>{s.dragStatus==="stopped"&&s.node.fire("dragend",{type:"dragend",target:s.node,evt:r},!0),s.dragStatus!=="dragging"&&t.DD._dragElements.delete(l)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",t.DD._endDragBefore,!0),window.addEventListener("mousemove",t.DD._drag),window.addEventListener("touchmove",t.DD._drag),window.addEventListener("mouseup",t.DD._endDragAfter,!1),window.addEventListener("touchend",t.DD._endDragAfter,!1),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))})(hc);var Me={},Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.RGBComponent=H8;Se.alphaComponent=U8;Se.getNumberValidator=G8;Se.getNumberOrArrayOfNumbersValidator=B8;Se.getNumberOrAutoValidator=j8;Se.getStringValidator=V8;Se.getStringOrGradientValidator=b8;Se.getFunctionValidator=W8;Se.getNumberArrayValidator=K8;Se.getBooleanValidator=X8;Se.getComponentValidator=Y8;const Br=Re,ft=ct;function jr(t){return ft.Util._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||ft.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}function H8(t){return t>255?255:t<0?0:Math.round(t)}function U8(t){return t>1?1:t<1e-4?1e-4:t}function G8(){if(Br.Konva.isUnminified)return function(t,e){return ft.Util._isNumber(t)||ft.Util.warn(jr(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function B8(t){if(Br.Konva.isUnminified)return function(e,n){let r=ft.Util._isNumber(e),s=ft.Util._isArray(e)&&e.length==t;return!r&&!s&&ft.Util.warn(jr(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function j8(){if(Br.Konva.isUnminified)return function(t,e){return ft.Util._isNumber(t)||t==="auto"||ft.Util.warn(jr(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function V8(){if(Br.Konva.isUnminified)return function(t,e){return ft.Util._isString(t)||ft.Util.warn(jr(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function b8(){if(Br.Konva.isUnminified)return function(t,e){const n=ft.Util._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||ft.Util.warn(jr(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function W8(){if(Br.Konva.isUnminified)return function(t,e){return ft.Util._isFunction(t)||ft.Util.warn(jr(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}}function K8(){if(Br.Konva.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(ft.Util._isArray(t)?t.forEach(function(r){ft.Util._isNumber(r)||ft.Util.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):ft.Util.warn(jr(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function X8(){if(Br.Konva.isUnminified)return function(t,e){return t===!0||t===!1||ft.Util.warn(jr(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function Y8(t){if(Br.Konva.isUnminified)return function(e,n){return e==null||ft.Util.isObject(e)||ft.Util.warn(jr(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const e=ct,n=Se,r="get",s="set";t.Factory={addGetterSetter(l,a,c,d,g){t.Factory.addGetter(l,a,c),t.Factory.addSetter(l,a,d,g),t.Factory.addOverloadedGetterSetter(l,a)},addGetter(l,a,c){const d=r+e.Util._capitalize(a);l.prototype[d]=l.prototype[d]||function(){const g=this.attrs[a];return g===void 0?c:g}},addSetter(l,a,c,d){const g=s+e.Util._capitalize(a);l.prototype[g]||t.Factory.overWriteSetter(l,a,c,d)},overWriteSetter(l,a,c,d){const g=s+e.Util._capitalize(a);l.prototype[g]=function(y){return c&&y!==void 0&&y!==null&&(y=c.call(this,y,a)),this._setAttr(a,y),d&&d.call(this),this}},addComponentsGetterSetter(l,a,c,d,g){const y=c.length,w=e.Util._capitalize,x=r+w(a),_=s+w(a);l.prototype[x]=function(){const E={};for(let P=0;P{this._setAttr(a+w(k),void 0)}),this._fireChangeEvent(a,P,E),g&&g.call(this),this},t.Factory.addOverloadedGetterSetter(l,a)},addOverloadedGetterSetter(l,a){const c=e.Util._capitalize(a),d=s+c,g=r+c;l.prototype[a]=function(){return arguments.length?(this[d](arguments[0]),this):this[g]()}},addDeprecatedGetterSetter(l,a,c,d){e.Util.error("Adding deprecated "+a);const g=r+e.Util._capitalize(a),y=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";l.prototype[g]=function(){e.Util.error(y);const w=this.attrs[a];return w===void 0?c:w},t.Factory.addSetter(l,a,d,function(){e.Util.error(y)}),t.Factory.addOverloadedGetterSetter(l,a)},backCompat(l,a){e.Util.each(a,function(c,d){const g=l.prototype[d],y=r+e.Util._capitalize(c),w=s+e.Util._capitalize(c);function x(){g.apply(this,arguments),e.Util.error('"'+c+'" method is deprecated and will be removed soon. Use ""'+d+'" instead.')}l.prototype[c]=x,l.prototype[y]=x,l.prototype[w]=x})},afterSetFilter(){this._filterUpToDate=!1}}})(Me);Object.defineProperty(it,"__esModule",{value:!0});it.Node=void 0;const Lo=qn,Mn=hc,Gl=Me,ni=Re,Ie=ct,xt=Se,yu="absoluteOpacity",tu="allEventListeners",Nr="absoluteTransform",S2="absoluteScale",ji="canvas",Q8="Change",$8="children",q8="konva",Xf="listening",Z8="mouseenter",J8="mouseleave",e9="pointerenter",t9="pointerleave",n9="touchenter",r9="touchleave",_2="set",w2="Shape",vu=" ",C2="stage",ri="transform",i9="Stage",Yf="visible",o9=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(vu);let s9=1;class _e{constructor(e){this._id=s9++,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===ri||e===Nr)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){let r=this._cache.get(e);return(r===void 0||(e===ri||e===Nr)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const s=n.map(l=>l+"Change.konva").join(vu);this.on(s,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(ji)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Nr&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ji)){const{scene:e,filter:n,hit:r,buffer:s}=this._cache.get(ji);Ie.Util.releaseCanvas(e,n,r,s),this._cache.delete(ji)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const n=e||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let s=Math.ceil(n.width||r.width),l=Math.ceil(n.height||r.height),a=n.pixelRatio,c=n.x===void 0?Math.floor(r.x):n.x,d=n.y===void 0?Math.floor(r.y):n.y,g=n.offset||0,y=n.drawBorder||!1,w=n.hitCanvasPixelRatio||1;if(!s||!l){Ie.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const x=Math.abs(Math.round(r.x)-c)>.5?1:0,_=Math.abs(Math.round(r.y)-d)>.5?1:0;s+=g*2+x,l+=g*2+_,c-=g,d-=g;const v=new Lo.SceneCanvas({pixelRatio:a,width:s,height:l}),E=new Lo.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),P=new Lo.HitCanvas({pixelRatio:w,width:s,height:l}),k=v.getContext(),C=P.getContext(),p=new Lo.SceneCanvas({width:v.width/v.pixelRatio+Math.abs(c),height:v.height/v.pixelRatio+Math.abs(d),pixelRatio:v.pixelRatio}),S=p.getContext();return P.isCache=!0,v.isCache=!0,this._cache.delete(ji),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(v.getContext()._context.imageSmoothingEnabled=!1,E.getContext()._context.imageSmoothingEnabled=!1),k.save(),C.save(),S.save(),k.translate(-c,-d),C.translate(-c,-d),S.translate(-c,-d),p.x=c,p.y=d,this._isUnderCache=!0,this._clearSelfAndDescendantCache(yu),this._clearSelfAndDescendantCache(S2),this.drawScene(v,this,p),this.drawHit(P,this),this._isUnderCache=!1,k.restore(),C.restore(),y&&(k.save(),k.beginPath(),k.rect(0,0,s,l),k.closePath(),k.setAttr("strokeStyle","red"),k.setAttr("lineWidth",5),k.stroke(),k.restore()),this._cache.set(ji,{scene:v,filter:E,hit:P,buffer:p,x:c,y:d}),this._requestDraw(),this}isCached(){return this._cache.has(ji)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){const r=[{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}];let s=1/0,l=1/0,a=-1/0,c=-1/0;const d=this.getAbsoluteTransform(n);return r.forEach(function(g){const y=d.point(g);s===void 0&&(s=a=y.x,l=c=y.y),s=Math.min(s,y.x),l=Math.min(l,y.y),a=Math.max(a,y.x),c=Math.max(c,y.y)}),{x:s,y:l,width:a-s,height:c-l}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),s=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/s,r.height/s),e.restore()}_drawCachedHitCanvas(e){const n=this._getCanvasCache(),r=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),n=this._getCanvasCache(),r=n.scene,s=n.filter,l=s.getContext(),a,c,d,g;if(e){if(!this._filterUpToDate){const y=r.pixelRatio;s.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=e.length,l.clear(),l.drawImage(r._canvas,0,0,r.getWidth()/y,r.getHeight()/y),c=l.getImageData(0,0,s.getWidth(),s.getHeight()),d=0;d{let n,r;if(!e)return this;for(n in e)n!==$8&&(r=_2+Ie.Util._capitalize(n),Ie.Util._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(Xf,this._isListening)}_isListening(e){if(!this.listening())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isListening(e):!0}isVisible(){return this._getCache(Yf,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);const r=this.getLayer();let s=!1;Mn.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(s=!0)});const l=!n&&!ni.Konva.hitOnDragEnabled&&(s||ni.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!l}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),n=this,r=0,s,l,a,c;function d(y){for(s=[],l=y.length,a=0;a0&&s[0].getDepth()<=e&&d(s)}const g=this.getStage();return n.nodeType!==i9&&g&&d(g.getChildren()),r}getDepth(){let e=0,n=this.parent;for(;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(ri),this._clearSelfAndDescendantCache(Nr)),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(){const e=this.getStage();if(!e)return null;const n=e.getPointerPosition();if(!n)return null;const r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);const s=this.getAbsoluteTransform(e).getMatrix(),l=new Ie.Transform,a=this.offset();return l.m=s.slice(),l.translate(a.x,a.y),l.getTranslation()}setAbsolutePosition(e){const{x:n,y:r,...s}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(ri);const l=this._getAbsoluteTransform().copy();return l.invert(),l.translate(e.x,e.y),e={x:this.attrs.x+l.getTranslation().x,y:this.attrs.y+l.getTranslation().y},this._setTransform(s),this.setPosition({x:e.x,y:e.y}),this._clearCache(ri),this._clearSelfAndDescendantCache(Nr),this}_setTransform(e){let n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){const 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 n=e.x,r=e.y,s=this.x(),l=this.y();return n!==void 0&&(s+=n),r!==void 0&&(l+=r),this.setPosition({x:s,y:l}),this}_eachAncestorReverse(e,n){let r=[],s=this.getParent(),l,a;if(!(n&&n._id===this._id)){for(r.unshift(this);s&&(!n||s._id!==n._id);)r.unshift(s),s=s.parent;for(l=r.length,a=0;a0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Ie.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const 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 Ie.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Ie.Util.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)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(yu,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),n,r,s,l,a;const c={attrs:{},className:this.getClassName()};for(n in e)r=e[n],a=Ie.Util.isObject(r)&&!Ie.Util._isPlainObject(r)&&!Ie.Util._isArray(r),!a&&(s=typeof this[n]=="function"&&this[n],delete e[n],l=s?s.call(this):null,e[n]=r,l!==r&&(c.attrs[n]=r));return Ie.Util._prepareToStringify(c)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){const s=[];n&&this._isMatch(e)&&s.push(this);let l=this.parent;for(;l;){if(l===r)return s;l._isMatch(e)&&s.push(l),l=l.parent}return s}isAncestorOf(e){return!1}findAncestor(e,n,r){return this.findAncestors(e,n,r)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);let n=e.replace(/ /g,"").split(","),r=n.length,s,l;for(s=0;s{try{const s=e==null?void 0:e.callback;s&&delete e.callback,Ie.Util._urlToImage(this.toDataURL(e),function(l){n(l),s==null||s(l)})}catch(s){r(s)}})}toBlob(e){return new Promise((n,r)=>{try{const s=e==null?void 0:e.callback;s&&delete e.callback,this.toCanvas(e).toBlob(l=>{n(l),s==null||s(l)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(s){r(s)}})}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.attrs.dragDistance:this.parent?this.parent.getDragDistance():ni.Konva.dragDistance}_off(e,n,r){let s=this.eventListeners[e],l,a,c;for(l=0;l=0)||this.isDragging())return;let s=!1;Mn.DD._dragElements.forEach(l=>{this.isAncestorOf(l.node)&&(s=!0)}),s||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const n=Mn.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",s=n&&n.dragStatus==="ready";r?this.stopDrag():s&&Mn.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return Ie.Util.haveIntersection(r,this.getClientRect())}static create(e,n){return Ie.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){let r=_e.prototype.getClassName.call(e),s=e.children,l,a,c;n&&(e.attrs.container=n),ni.Konva[r]||(Ie.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const d=ni.Konva[r];if(l=new d(e.attrs),s)for(a=s.length,c=0;c0}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 r=0;r0?n[0]:void 0}_generalFind(e,n){const r=[];return this._descendants(s=>{const l=s._isMatch(e);return l&&r.push(s),!!(l&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const s of r){if(n=e(s),n)return!0;if(s.hasChildren()&&(n=s._descendants(e),n))return!0}return!1}toObject(){const e=jh.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){let n=e.getParent();for(;n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){const n=jh.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){const n=[];return this.find("Shape").forEach(r=>{r.isVisible()&&r.intersects(e)&&n.push(r)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(e,n,r){const s=this.getLayer(),l=e||s&&s.getCanvas(),a=l&&l.getContext(),c=this._getCanvasCache(),d=c&&c.scene,g=l&&l.isCache;if(!this.isVisible()&&!g)return this;if(d){a.save();const y=this.getAbsoluteTransform(n).getMatrix();a.transform(y[0],y[1],y[2],y[3],y[4],y[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",l,n,r);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;const r=this.getLayer(),s=e||r&&r.hitCanvas,l=s&&s.getContext(),a=this._getCanvasCache();if(a&&a.hit){l.save();const d=this.getAbsoluteTransform(n).getMatrix();l.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedHitCanvas(l),l.restore()}else this._drawChildren("drawHit",s,n);return this}_drawChildren(e,n,r,s){var l;const a=n&&n.getContext(),c=this.clipWidth(),d=this.clipHeight(),g=this.clipFunc(),y=typeof c=="number"&&typeof d=="number"||g,w=r===this;if(y){a.save();const _=this.getAbsoluteTransform(r);let v=_.getMatrix();a.transform(v[0],v[1],v[2],v[3],v[4],v[5]),a.beginPath();let E;if(g)E=g.call(this,a,this);else{const P=this.clipX(),k=this.clipY();a.rect(P||0,k||0,c,d)}a.clip.apply(a,E),v=_.copy().invert().getMatrix(),a.transform(v[0],v[1],v[2],v[3],v[4],v[5])}const x=!w&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";x&&(a.save(),a._applyGlobalCompositeOperation(this)),(l=this.children)===null||l===void 0||l.forEach(function(_){_[e](n,r,s)}),x&&a.restore(),y&&a.restore()}getClientRect(e={}){var n;const r=e.skipTransform,s=e.relativeTo;let l,a,c,d,g={x:1/0,y:1/0,width:0,height:0};const y=this;(n=this.children)===null||n===void 0||n.forEach(function(_){if(!_.visible())return;const v=_.getClientRect({relativeTo:y,skipShadow:e.skipShadow,skipStroke:e.skipStroke});v.width===0&&v.height===0||(l===void 0?(l=v.x,a=v.y,c=v.x+v.width,d=v.y+v.height):(l=Math.min(l,v.x),a=Math.min(a,v.y),c=Math.max(c,v.x+v.width),d=Math.max(d,v.y+v.height)))});const w=this.find("Shape");let x=!1;for(let _=0;_Ve.indexOf("pointer")>=0?"pointer":Ve.indexOf("touch")>=0?"touch":"mouse",de=Ve=>{const D=ne(Ve);if(D==="pointer")return s.Konva.pointerEventsEnabled&&Y.pointer;if(D==="touch")return Y.touch;if(D==="mouse")return Y.mouse};function ze(Ve={}){return(Ve.clipFunc||Ve.clipWidth||Ve.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Ve}const pt="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";t.stages=[];class mt extends r.Container{constructor(D){super(ze(D)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),t.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{ze(this.attrs)}),this._checkVisibility()}_validateAdd(D){const q=D.getType()==="Layer",pe=D.getType()==="FastLayer";q||pe||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const D=this.visible()?"":"none";this.content.style.display=D}setContainer(D){if(typeof D===y){let q;if(D.charAt(0)==="."){const pe=D.slice(1);D=document.getElementsByClassName(pe)[0]}else D.charAt(0)!=="#"?q=D:q=D.slice(1),D=document.getElementById(q);if(!D)throw"Can not find container in document with id "+q}return this._setAttr("container",D),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),D.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const D=this.children,q=D.length;for(let pe=0;pe-1&&t.stages.splice(q,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const D=this._pointerPositions[0]||this._changedPointerPositions[0];return D?{x:D.x,y:D.y}:(e.Util.warn(pt),null)}_getPointerById(D){return this._pointerPositions.find(q=>q.id===D)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(D){D=D||{},D.x=D.x||0,D.y=D.y||0,D.width=D.width||this.width(),D.height=D.height||this.height();const q=new l.SceneCanvas({width:D.width,height:D.height,pixelRatio:D.pixelRatio||1}),pe=q.getContext()._context,Ae=this.children;return(D.x||D.y)&&pe.translate(-1*D.x,-1*D.y),Ae.forEach(function(Ce){if(!Ce.isVisible())return;const Be=Ce._toKonvaCanvas(D);pe.drawImage(Be._canvas,D.x,D.y,Be.getWidth()/Be.getPixelRatio(),Be.getHeight()/Be.getPixelRatio())}),q}getIntersection(D){if(!D)return null;const q=this.children,pe=q.length,Ae=pe-1;for(let Ce=Ae;Ce>=0;Ce--){const Be=q[Ce].getIntersection(D);if(Be)return Be}return null}_resizeDOM(){const D=this.width(),q=this.height();this.content&&(this.content.style.width=D+w,this.content.style.height=q+w),this.bufferCanvas.setSize(D,q),this.bufferHitCanvas.setSize(D,q),this.children.forEach(pe=>{pe.setSize({width:D,height:q}),pe.draw()})}add(D,...q){if(arguments.length>1){for(let Ae=0;AeH&&e.Util.warn("The stage has "+pe+" 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."),D.setSize({width:this.width(),height:this.height()}),D.draw(),s.Konva.isBrowser&&this.content.appendChild(D.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(D){return d.hasPointerCapture(D,this)}setPointerCapture(D){d.setPointerCapture(D,this)}releaseCapture(D){d.releaseCapture(D,this)}getLayers(){return this.children}_bindContentEvents(){s.Konva.isBrowser&&j.forEach(([D,q])=>{this.content.addEventListener(D,pe=>{this[q](pe)},{passive:!1})})}_pointerenter(D){this.setPointersPositions(D);const q=de(D.type);q&&this._fire(q.pointerenter,{evt:D,target:this,currentTarget:this})}_pointerover(D){this.setPointersPositions(D);const q=de(D.type);q&&this._fire(q.pointerover,{evt:D,target:this,currentTarget:this})}_getTargetShape(D){let q=this[D+"targetShape"];return q&&!q.getStage()&&(q=null),q}_pointerleave(D){const q=de(D.type),pe=ne(D.type);if(!q)return;this.setPointersPositions(D);const Ae=this._getTargetShape(pe),Ce=!(s.Konva.isDragging()||s.Konva.isTransforming())||s.Konva.hitOnDragEnabled;Ae&&Ce?(Ae._fireAndBubble(q.pointerout,{evt:D}),Ae._fireAndBubble(q.pointerleave,{evt:D}),this._fire(q.pointerleave,{evt:D,target:this,currentTarget:this}),this[pe+"targetShape"]=null):Ce&&(this._fire(q.pointerleave,{evt:D,target:this,currentTarget:this}),this._fire(q.pointerout,{evt:D,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(D){const q=de(D.type),pe=ne(D.type);if(!q)return;this.setPointersPositions(D);let Ae=!1;this._changedPointerPositions.forEach(Ce=>{const Be=this.getIntersection(Ce);if(a.DD.justDragged=!1,s.Konva["_"+pe+"ListenClick"]=!0,!Be||!Be.isListening()){this[pe+"ClickStartShape"]=void 0;return}s.Konva.capturePointerEventsEnabled&&Be.setPointerCapture(Ce.id),this[pe+"ClickStartShape"]=Be,Be._fireAndBubble(q.pointerdown,{evt:D,pointerId:Ce.id}),Ae=!0;const be=D.type.indexOf("touch")>=0;Be.preventDefault()&&D.cancelable&&be&&D.preventDefault()}),Ae||this._fire(q.pointerdown,{evt:D,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(D){const q=de(D.type),pe=ne(D.type);if(!q||(s.Konva.isDragging()&&a.DD.node.preventDefault()&&D.cancelable&&D.preventDefault(),this.setPointersPositions(D),!(!(s.Konva.isDragging()||s.Konva.isTransforming())||s.Konva.hitOnDragEnabled)))return;const Ce={};let Be=!1;const be=this._getTargetShape(pe);this._changedPointerPositions.forEach(fe=>{const J=d.getCapturedShape(fe.id)||this.getIntersection(fe),ge=fe.id,V={evt:D,pointerId:ge},K=be!==J;if(K&&be&&(be._fireAndBubble(q.pointerout,{...V},J),be._fireAndBubble(q.pointerleave,{...V},J)),J){if(Ce[J._id])return;Ce[J._id]=!0}J&&J.isListening()?(Be=!0,K&&(J._fireAndBubble(q.pointerover,{...V},be),J._fireAndBubble(q.pointerenter,{...V},be),this[pe+"targetShape"]=J),J._fireAndBubble(q.pointermove,{...V})):be&&(this._fire(q.pointerover,{evt:D,target:this,currentTarget:this,pointerId:ge}),this[pe+"targetShape"]=null)}),Be||this._fire(q.pointermove,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(D){const q=de(D.type),pe=ne(D.type);if(!q)return;this.setPointersPositions(D);const Ae=this[pe+"ClickStartShape"],Ce=this[pe+"ClickEndShape"],Be={};let be=!1;this._changedPointerPositions.forEach(fe=>{const J=d.getCapturedShape(fe.id)||this.getIntersection(fe);if(J){if(J.releaseCapture(fe.id),Be[J._id])return;Be[J._id]=!0}const ge=fe.id,V={evt:D,pointerId:ge};let K=!1;s.Konva["_"+pe+"InDblClickWindow"]?(K=!0,clearTimeout(this[pe+"DblTimeout"])):a.DD.justDragged||(s.Konva["_"+pe+"InDblClickWindow"]=!0,clearTimeout(this[pe+"DblTimeout"])),this[pe+"DblTimeout"]=setTimeout(function(){s.Konva["_"+pe+"InDblClickWindow"]=!1},s.Konva.dblClickWindow),J&&J.isListening()?(be=!0,this[pe+"ClickEndShape"]=J,J._fireAndBubble(q.pointerup,{...V}),s.Konva["_"+pe+"ListenClick"]&&Ae&&Ae===J&&(J._fireAndBubble(q.pointerclick,{...V}),K&&Ce&&Ce===J&&J._fireAndBubble(q.pointerdblclick,{...V}))):(this[pe+"ClickEndShape"]=null,s.Konva["_"+pe+"ListenClick"]&&this._fire(q.pointerclick,{evt:D,target:this,currentTarget:this,pointerId:ge}),K&&this._fire(q.pointerdblclick,{evt:D,target:this,currentTarget:this,pointerId:ge}))}),be||this._fire(q.pointerup,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s.Konva["_"+pe+"ListenClick"]=!1,D.cancelable&&pe!=="touch"&&pe!=="pointer"&&D.preventDefault()}_contextmenu(D){this.setPointersPositions(D);const q=this.getIntersection(this.getPointerPosition());q&&q.isListening()?q._fireAndBubble(W,{evt:D}):this._fire(W,{evt:D,target:this,currentTarget:this})}_wheel(D){this.setPointersPositions(D);const q=this.getIntersection(this.getPointerPosition());q&&q.isListening()?q._fireAndBubble(Te,{evt:D}):this._fire(Te,{evt:D,target:this,currentTarget:this})}_pointercancel(D){this.setPointersPositions(D);const q=d.getCapturedShape(D.pointerId)||this.getIntersection(this.getPointerPosition());q&&q._fireAndBubble(R,d.createEvent(D)),d.releaseCapture(D.pointerId)}_lostpointercapture(D){d.releaseCapture(D.pointerId)}setPointersPositions(D){const q=this._getContentPosition();let pe=null,Ae=null;D=D||window.event,D.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(D.touches,Ce=>{this._pointerPositions.push({id:Ce.identifier,x:(Ce.clientX-q.left)/q.scaleX,y:(Ce.clientY-q.top)/q.scaleY})}),Array.prototype.forEach.call(D.changedTouches||D.touches,Ce=>{this._changedPointerPositions.push({id:Ce.identifier,x:(Ce.clientX-q.left)/q.scaleX,y:(Ce.clientY-q.top)/q.scaleY})})):(pe=(D.clientX-q.left)/q.scaleX,Ae=(D.clientY-q.top)/q.scaleY,this.pointerPos={x:pe,y:Ae},this._pointerPositions=[{x:pe,y:Ae,id:e.Util._getFirstPointerId(D)}],this._changedPointerPositions=[{x:pe,y:Ae,id:e.Util._getFirstPointerId(D)}])}_setPointerPosition(D){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(D)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const D=this.content.getBoundingClientRect();return{top:D.top,left:D.left,scaleX:D.width/this.content.clientWidth||1,scaleY:D.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new l.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new l.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!s.Konva.isBrowser)return;const D=this.container();if(!D)throw"Stage has no container. A container is required.";D.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"),D.appendChild(this.content),this._resizeDOM()}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(D){D.batchDraw()}),this}}t.Stage=mt,mt.prototype.nodeType=g,(0,c._registerNode)(mt),n.Factory.addGetterSetter(mt,"container"),s.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach(Ve=>{Ve.batchDraw()})})})(w5);var Bl={},Tt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=Re,n=ct,r=Me,s=it,l=Se,a=Re,c=ki,d="hasShadow",g="shadowRGBA",y="patternImage",w="linearGradient",x="radialGradient";let _;function v(){return _||(_=n.Util.createCanvasElement().getContext("2d"),_)}t.shapes={};function E(I){const M=this.attrs.fillRule;M?I.fill(M):I.fill()}function P(I){I.stroke()}function k(I){const M=this.attrs.fillRule;M?I.fill(M):I.fill()}function C(I){I.stroke()}function p(){this._clearCache(d)}function S(){this._clearCache(g)}function R(){this._clearCache(y)}function F(){this._clearCache(w)}function L(){this._clearCache(x)}class N extends s.Node{constructor(M){super(M);let U;for(;U=n.Util.getRandomColor(),!(U&&!(U in t.shapes)););this.colorKey=U,t.shapes[U]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(d,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(y,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const U=v().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(U&&U.setTransform){const W=new n.Transform;W.translate(this.fillPatternX(),this.fillPatternY()),W.rotate(e.Konva.getAngle(this.fillPatternRotation())),W.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),W.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const $=W.getMatrix(),ie=typeof DOMMatrix>"u"?{a:$[0],b:$[1],c:$[2],d:$[3],e:$[4],f:$[5]}:new DOMMatrix($);U.setTransform(ie)}return U}}_getLinearGradient(){return this._getCache(w,this.__getLinearGradient)}__getLinearGradient(){const M=this.fillLinearGradientColorStops();if(M){const U=v(),W=this.fillLinearGradientStartPoint(),$=this.fillLinearGradientEndPoint(),ie=U.createLinearGradient(W.x,W.y,$.x,$.y);for(let re=0;rethis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const M=this.hitStrokeWidth();return M==="auto"?this.hasStroke():this.strokeEnabled()&&!!M}intersects(M){const U=this.getStage();if(!U)return!1;const W=U.bufferHitCanvas;return W.getContext().clear(),this.drawHit(W,void 0,!0),W.context.getImageData(Math.round(M.x),Math.round(M.y),1,1).data[3]>0}destroy(){return s.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(M){var U;if(!((U=this.attrs.perfectDrawEnabled)!==null&&U!==void 0?U:!0))return!1;const $=M||this.hasFill(),ie=this.hasStroke(),re=this.getAbsoluteOpacity()!==1;if($&&ie&&re)return!0;const we=this.hasShadow(),Te=this.shadowForStrokeEnabled();return!!($&&ie&&we&&Te)}setStrokeHitEnabled(M){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),M?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const M=this.size();return{x:this._centroid?-M.width/2:0,y:this._centroid?-M.height/2:0,width:M.width,height:M.height}}getClientRect(M={}){let U=!1,W=this.getParent();for(;W;){if(W.isCached()){U=!0;break}W=W.getParent()}const $=M.skipTransform,ie=M.relativeTo||U&&this.getStage()||void 0,re=this.getSelfRect(),Te=!M.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,H=re.width+Te,j=re.height+Te,Y=!M.skipShadow&&this.hasShadow(),ne=Y?this.shadowOffsetX():0,de=Y?this.shadowOffsetY():0,ze=H+Math.abs(ne),pt=j+Math.abs(de),mt=Y&&this.shadowBlur()||0,Ve=ze+mt*2,D=pt+mt*2,q={width:Ve,height:D,x:-(Te/2+mt)+Math.min(ne,0)+re.x,y:-(Te/2+mt)+Math.min(de,0)+re.y};return $?q:this._transformedRect(q,ie)}drawScene(M,U,W){const $=this.getLayer(),ie=M||$.getCanvas(),re=ie.getContext(),we=this._getCanvasCache(),Te=this.getSceneFunc(),H=this.hasShadow();let j;const Y=U===this;if(!this.isVisible()&&!Y)return this;if(we){re.save();const ne=this.getAbsoluteTransform(U).getMatrix();return re.transform(ne[0],ne[1],ne[2],ne[3],ne[4],ne[5]),this._drawCachedSceneCanvas(re),re.restore(),this}if(!Te)return this;if(re.save(),this._useBufferCanvas()){j=this.getStage();const ne=W||j.bufferCanvas,de=ne.getContext();de.clear(),de.save(),de._applyLineJoin(this);const ze=this.getAbsoluteTransform(U).getMatrix();de.transform(ze[0],ze[1],ze[2],ze[3],ze[4],ze[5]),Te.call(this,de,this),de.restore();const pt=ne.pixelRatio;H&&re._applyShadow(this),re._applyOpacity(this),re._applyGlobalCompositeOperation(this),re.drawImage(ne._canvas,ne.x||0,ne.y||0,ne.width/pt,ne.height/pt)}else{if(re._applyLineJoin(this),!Y){const ne=this.getAbsoluteTransform(U).getMatrix();re.transform(ne[0],ne[1],ne[2],ne[3],ne[4],ne[5]),re._applyOpacity(this),re._applyGlobalCompositeOperation(this)}H&&re._applyShadow(this),Te.call(this,re,this)}return re.restore(),this}drawHit(M,U,W=!1){if(!this.shouldDrawHit(U,W))return this;const $=this.getLayer(),ie=M||$.hitCanvas,re=ie&&ie.getContext(),we=this.hitFunc()||this.sceneFunc(),Te=this._getCanvasCache(),H=Te&&Te.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),H){re.save();const Y=this.getAbsoluteTransform(U).getMatrix();return re.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),this._drawCachedHitCanvas(re),re.restore(),this}if(!we)return this;if(re.save(),re._applyLineJoin(this),!(this===U)){const Y=this.getAbsoluteTransform(U).getMatrix();re.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5])}return we.call(this,re,this),re.restore(),this}drawHitFromCache(M=0){const U=this._getCanvasCache(),W=this._getCachedSceneCanvas(),$=U.hit,ie=$.getContext(),re=$.getWidth(),we=$.getHeight();ie.clear(),ie.drawImage(W._canvas,0,0,re,we);try{const Te=ie.getImageData(0,0,re,we),H=Te.data,j=H.length,Y=n.Util._hexToRgb(this.colorKey);for(let ne=0;neM?(H[ne]=Y.r,H[ne+1]=Y.g,H[ne+2]=Y.b,H[ne+3]=255):H[ne+3]=0;ie.putImageData(Te,0,0)}catch(Te){n.Util.error("Unable to draw hit graph from cached scene canvas. "+Te.message)}return this}hasPointerCapture(M){return c.hasPointerCapture(M,this)}setPointerCapture(M){c.setPointerCapture(M,this)}releaseCapture(M){c.releaseCapture(M,this)}}t.Shape=N,N.prototype._fillFunc=E,N.prototype._strokeFunc=P,N.prototype._fillFuncHit=k,N.prototype._strokeFuncHit=C,N.prototype._centroid=!1,N.prototype.nodeType="Shape",(0,a._registerNode)(N),N.prototype.eventListeners={},N.prototype.on.call(N.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",p),N.prototype.on.call(N.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",S),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",R),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",F),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",L),r.Factory.addGetterSetter(N,"stroke",void 0,(0,l.getStringOrGradientValidator)()),r.Factory.addGetterSetter(N,"strokeWidth",2,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(N,"hitStrokeWidth","auto",(0,l.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(N,"strokeHitEnabled",!0,(0,l.getBooleanValidator)()),r.Factory.addGetterSetter(N,"perfectDrawEnabled",!0,(0,l.getBooleanValidator)()),r.Factory.addGetterSetter(N,"shadowForStrokeEnabled",!0,(0,l.getBooleanValidator)()),r.Factory.addGetterSetter(N,"lineJoin"),r.Factory.addGetterSetter(N,"lineCap"),r.Factory.addGetterSetter(N,"sceneFunc"),r.Factory.addGetterSetter(N,"hitFunc"),r.Factory.addGetterSetter(N,"dash"),r.Factory.addGetterSetter(N,"dashOffset",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"shadowColor",void 0,(0,l.getStringValidator)()),r.Factory.addGetterSetter(N,"shadowBlur",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"shadowOpacity",1,(0,l.getNumberValidator)()),r.Factory.addComponentsGetterSetter(N,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(N,"shadowOffsetX",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"shadowOffsetY",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillPatternImage"),r.Factory.addGetterSetter(N,"fill",void 0,(0,l.getStringOrGradientValidator)()),r.Factory.addGetterSetter(N,"fillPatternX",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillPatternY",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(N,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(N,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(N,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(N,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(N,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(N,"fillEnabled",!0),r.Factory.addGetterSetter(N,"strokeEnabled",!0),r.Factory.addGetterSetter(N,"shadowEnabled",!0),r.Factory.addGetterSetter(N,"dashEnabled",!0),r.Factory.addGetterSetter(N,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(N,"fillPriority","color"),r.Factory.addComponentsGetterSetter(N,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(N,"fillPatternOffsetX",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillPatternOffsetY",0,(0,l.getNumberValidator)()),r.Factory.addComponentsGetterSetter(N,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(N,"fillPatternScaleX",1,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillPatternScaleY",1,(0,l.getNumberValidator)()),r.Factory.addComponentsGetterSetter(N,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(N,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(N,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(N,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(N,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(N,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(N,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(N,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(N,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(N,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(N,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(N,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(N,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(N,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(N,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(N,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(N,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(N,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(N,"fillPatternRotation",0),r.Factory.addGetterSetter(N,"fillRule",void 0,(0,l.getStringValidator)()),r.Factory.backCompat(N,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Tt);Object.defineProperty(Bl,"__esModule",{value:!0});Bl.Layer=void 0;const Tr=ct,Vh=lo,Io=it,ng=Me,k2=qn,d9=Se,h9=Tt,f9=Re,g9="#",p9="beforeDraw",m9="draw",E5=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],y9=E5.length;let gs=class extends Vh.Container{constructor(e){super(e),this.canvas=new k2.SceneCanvas,this.hitCanvas=new k2.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let n=1,r=!1;for(;;){for(let s=0;s0)return{antialiased:!0};return{}}drawScene(e,n,r){const s=this.getLayer(),l=e||s&&s.getCanvas();return this._fire(p9,{node:this}),this.clearBeforeDraw()&&l.getContext().clear(),Vh.Container.prototype.drawScene.call(this,l,n,r),this._fire(m9,{node:this}),this}drawHit(e,n){const r=this.getLayer(),s=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Vh.Container.prototype.drawHit.call(this,s,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Tr.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Tr.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Tr.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Bl.Layer=gs;gs.prototype.nodeType="Layer";(0,f9._registerNode)(gs);ng.Factory.addGetterSetter(gs,"imageSmoothingEnabled",!0);ng.Factory.addGetterSetter(gs,"clearBeforeDraw",!0);ng.Factory.addGetterSetter(gs,"hitGraphEnabled",!0,(0,d9.getBooleanValidator)());var gc={};Object.defineProperty(gc,"__esModule",{value:!0});gc.FastLayer=void 0;const v9=ct,x9=Bl,S9=Re;class rg extends x9.Layer{constructor(e){super(e),this.listening(!1),v9.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}gc.FastLayer=rg;rg.prototype.nodeType="FastLayer";(0,S9._registerNode)(rg);var ps={};Object.defineProperty(ps,"__esModule",{value:!0});ps.Group=void 0;const _9=ct,w9=lo,C9=Re;class ig extends w9.Container{_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&_9.Util.throw("You may only add groups and shapes to groups.")}}ps.Group=ig;ig.prototype.nodeType="Group";(0,C9._registerNode)(ig);var ms={};Object.defineProperty(ms,"__esModule",{value:!0});ms.Animation=void 0;const bh=Re,E2=ct,Wh=function(){return bh.glob.performance&&bh.glob.performance.now?function(){return bh.glob.performance.now()}:function(){return new Date().getTime()}}();class hr{constructor(e,n){this.id=hr.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Wh(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];return e&&(n=Array.isArray(e)?e:[e]),this.layers=n,this}getLayers(){return this.layers}addLayer(e){const n=this.layers,r=n.length;for(let s=0;sthis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():v<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=v,this.update())}getTime(){return this._time}setPosition(v){this.prevPos=this._pos,this.propFunc(v),this._pos=v}getPosition(v){return v===void 0&&(v=this._time),this.func(v,this.begin,this._change,this.duration)}play(){this.state=c,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=d,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(v){this.pause(),this._time=v,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const v=this.getTimer()-this._startTime;this.state===c?this.setTime(v):this.state===d&&this.setTime(this.duration-v)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class x{constructor(v){const E=this,P=v.node,k=P._id,C=v.easing||t.Easings.Linear,p=!!v.yoyo;let S,R;typeof v.duration>"u"?S=.3:v.duration===0?S=.001:S=v.duration,this.node=P,this._id=y++;const F=P.getLayer()||(P instanceof s.Konva.Stage?P.getLayers():null);F||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){E.tween.onEnterFrame()},F),this.tween=new w(R,function(L){E._tweenFunc(L)},C,0,1,S*1e3,p),this._addListeners(),x.attrs[k]||(x.attrs[k]={}),x.attrs[k][this._id]||(x.attrs[k][this._id]={}),x.tweens[k]||(x.tweens[k]={});for(R in v)l[R]===void 0&&this._addAttr(R,v[R]);this.reset(),this.onFinish=v.onFinish,this.onReset=v.onReset,this.onUpdate=v.onUpdate}_addAttr(v,E){const P=this.node,k=P._id;let C,p,S,R,F;const L=x.tweens[k][v];L&&delete x.attrs[k][L][v];let N=P.getAttr(v);if(e.Util._isArray(E))if(C=[],p=Math.max(E.length,N.length),v==="points"&&E.length!==N.length&&(E.length>N.length?(R=N,N=e.Util._prepareArrayForTween(N,E,P.closed())):(S=E,E=e.Util._prepareArrayForTween(E,N,P.closed()))),v.indexOf("fill")===0)for(let I=0;I{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const v=this.node,E=x.attrs[v._id][this._id];E.points&&E.points.trueEnd&&v.setAttr("points",E.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const v=this.node,E=x.attrs[v._id][this._id];E.points&&E.points.trueStart&&v.points(E.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(v){return this.tween.seek(v*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const v=this.node._id,E=this._id,P=x.tweens[v];this.pause(),this.anim&&this.anim.stop();for(const k in P)delete x.tweens[v][k];delete x.attrs[v][E],x.tweens[v]&&(Object.keys(x.tweens[v]).length===0&&delete x.tweens[v],Object.keys(x.attrs[v]).length===0&&delete x.attrs[v])}}t.Tween=x,x.attrs={},x.tweens={},r.Node.prototype.to=function(_){const v=_.onFinish;_.node=this,_.onFinish=function(){this.destroy(),v&&v()},new x(_).play()},t.Easings={BackEaseIn(_,v,E,P){return E*(_/=P)*_*((1.70158+1)*_-1.70158)+v},BackEaseOut(_,v,E,P){return E*((_=_/P-1)*_*((1.70158+1)*_+1.70158)+1)+v},BackEaseInOut(_,v,E,P){let k=1.70158;return(_/=P/2)<1?E/2*(_*_*(((k*=1.525)+1)*_-k))+v:E/2*((_-=2)*_*(((k*=1.525)+1)*_+k)+2)+v},ElasticEaseIn(_,v,E,P,k,C){let p=0;return _===0?v:(_/=P)===1?v+E:(C||(C=P*.3),!k||k0?e:n),y=a*n,w=c*(c>0?e:n),x=d*(d>0?n:e);return{x:g,y:r?-1*x:w,width:y-g,height:x-w}}}pc.Arc=Vr;Vr.prototype._centroid=!0;Vr.prototype.className="Arc";Vr.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];(0,E9._registerNode)(Vr);mc.Factory.addGetterSetter(Vr,"innerRadius",0,(0,yc.getNumberValidator)());mc.Factory.addGetterSetter(Vr,"outerRadius",0,(0,yc.getNumberValidator)());mc.Factory.addGetterSetter(Vr,"angle",0,(0,yc.getNumberValidator)());mc.Factory.addGetterSetter(Vr,"clockwise",!1,(0,yc.getBooleanValidator)());var vc={},jl={};Object.defineProperty(jl,"__esModule",{value:!0});jl.Line=void 0;const xc=Me,P9=Re,T9=Tt,T5=Se;function Qf(t,e,n,r,s,l,a){const c=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),d=Math.sqrt(Math.pow(s-n,2)+Math.pow(l-r,2)),g=a*c/(c+d),y=a*d/(c+d),w=n-g*(s-t),x=r-g*(l-e),_=n+y*(s-t),v=r+y*(l-e);return[w,x,_,v]}function T2(t,e){const n=t.length,r=[];for(let s=2;s4){const d=this.getTensionPoints(),g=d.length;for(c=l?0:4,l||e.quadraticCurveTo(d[0],d[1],d[2],d[3]);c{let g,y;const x=d/2;g=0;for(let _=0;_<20;_++)y=x*t.tValues[20][_]+x,g+=t.cValues[20][_]*r(a,c,y);return x*g};t.getCubicArcLength=e;const n=(a,c,d)=>{d===void 0&&(d=1);const g=a[0]-2*a[1]+a[2],y=c[0]-2*c[1]+c[2],w=2*a[1]-2*a[0],x=2*c[1]-2*c[0],_=4*(g*g+y*y),v=4*(g*w+y*x),E=w*w+x*x;if(_===0)return d*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(c[2]-c[0],2));const P=v/(2*_),k=E/_,C=d+P,p=k-P*P,S=C*C+p>0?Math.sqrt(C*C+p):0,R=P*P+p>0?Math.sqrt(P*P+p):0,F=P+Math.sqrt(P*P+p)!==0?p*Math.log(Math.abs((C+S)/(P+R))):0;return Math.sqrt(_)/2*(C*S-P*R+F)};t.getQuadraticArcLength=n;function r(a,c,d){const g=s(1,d,a),y=s(1,d,c),w=g*g+y*y;return Math.sqrt(w)}const s=(a,c,d)=>{const g=d.length-1;let y,w;if(g===0)return 0;if(a===0){w=0;for(let x=0;x<=g;x++)w+=t.binomialCoefficients[g][x]*Math.pow(1-c,g-x)*Math.pow(c,x)*d[x];return w}else{y=new Array(g);for(let x=0;x{let g=1,y=a/c,w=(a-d(y))/c,x=0;for(;g>.001;){const _=d(y+w),v=Math.abs(a-_)/c;if(v500)break}return y};t.t2length=l})(N5);Object.defineProperty(ys,"__esModule",{value:!0});ys.Path=void 0;const N9=Me,R9=Re,F9=Tt,zo=N5;class kt extends F9.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=kt.parsePathData(this.data()),this.pathLength=kt.getPathLength(this.dataArray)}_sceneFunc(e){const n=this.dataArray;e.beginPath();let r=!1;for(let s=0;sy?g:y,P=g>y?1:g/y,k=g>y?y/g:1;e.translate(c,d),e.rotate(_),e.scale(P,k),e.arc(0,0,E,w,w+x,1-v),e.scale(1/P,1/k),e.rotate(-_),e.translate(-c,-d);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(d){if(d.command==="A"){const g=d.points[4],y=d.points[5],w=d.points[4]+y;let x=Math.PI/180;if(Math.abs(g-w)w;_-=x){const v=kt.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],_,0);e.push(v.x,v.y)}else for(let _=g+x;_n[s].pathLength;)e-=n[s].pathLength,++s;if(s===l)return r=n[s-1].points.slice(-2),{x:r[0],y:r[1]};if(e<.01)return n[s].command==="M"?(r=n[s].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[s].start.x,y:n[s].start.y};const a=n[s],c=a.points;switch(a.command){case"L":return kt.getPointOnLine(e,a.start.x,a.start.y,c[0],c[1]);case"C":return kt.getPointOnCubicBezier((0,zo.t2length)(e,kt.getPathLength(n),E=>(0,zo.getCubicArcLength)([a.start.x,c[0],c[2],c[4]],[a.start.y,c[1],c[3],c[5]],E)),a.start.x,a.start.y,c[0],c[1],c[2],c[3],c[4],c[5]);case"Q":return kt.getPointOnQuadraticBezier((0,zo.t2length)(e,kt.getPathLength(n),E=>(0,zo.getQuadraticArcLength)([a.start.x,c[0],c[2]],[a.start.y,c[1],c[3]],E)),a.start.x,a.start.y,c[0],c[1],c[2],c[3]);case"A":const d=c[0],g=c[1],y=c[2],w=c[3],x=c[5],_=c[6];let v=c[4];return v+=x*e/a.pathLength,kt.getPointOnEllipticalArc(d,g,y,w,v,_)}return null}static getPointOnLine(e,n,r,s,l,a,c){a=a??n,c=c??r;const d=this.getLineLength(n,r,s,l);if(d<1e-10)return{x:n,y:r};if(s===n)return{x:a,y:c+(l>r?e:-e)};const g=(l-r)/(s-n),y=Math.sqrt(e*e/(1+g*g))*(s0&&!isNaN(v[0]);){let E="",P=[];const k=c,C=d;let p,S,R,F,L,N,I,M,U,W;switch(_){case"l":c+=v.shift(),d+=v.shift(),E="L",P.push(c,d);break;case"L":c=v.shift(),d=v.shift(),P.push(c,d);break;case"m":const $=v.shift(),ie=v.shift();if(c+=$,d+=ie,E="M",l.length>2&&l[l.length-1].command==="z"){for(let re=l.length-2;re>=0;re--)if(l[re].command==="M"){c=l[re].points[0]+$,d=l[re].points[1]+ie;break}}P.push(c,d),_="l";break;case"M":c=v.shift(),d=v.shift(),E="M",P.push(c,d),_="L";break;case"h":c+=v.shift(),E="L",P.push(c,d);break;case"H":c=v.shift(),E="L",P.push(c,d);break;case"v":d+=v.shift(),E="L",P.push(c,d);break;case"V":d=v.shift(),E="L",P.push(c,d);break;case"C":P.push(v.shift(),v.shift(),v.shift(),v.shift()),c=v.shift(),d=v.shift(),P.push(c,d);break;case"c":P.push(c+v.shift(),d+v.shift(),c+v.shift(),d+v.shift()),c+=v.shift(),d+=v.shift(),E="C",P.push(c,d);break;case"S":S=c,R=d,p=l[l.length-1],p.command==="C"&&(S=c+(c-p.points[2]),R=d+(d-p.points[3])),P.push(S,R,v.shift(),v.shift()),c=v.shift(),d=v.shift(),E="C",P.push(c,d);break;case"s":S=c,R=d,p=l[l.length-1],p.command==="C"&&(S=c+(c-p.points[2]),R=d+(d-p.points[3])),P.push(S,R,c+v.shift(),d+v.shift()),c+=v.shift(),d+=v.shift(),E="C",P.push(c,d);break;case"Q":P.push(v.shift(),v.shift()),c=v.shift(),d=v.shift(),P.push(c,d);break;case"q":P.push(c+v.shift(),d+v.shift()),c+=v.shift(),d+=v.shift(),E="Q",P.push(c,d);break;case"T":S=c,R=d,p=l[l.length-1],p.command==="Q"&&(S=c+(c-p.points[0]),R=d+(d-p.points[1])),c=v.shift(),d=v.shift(),E="Q",P.push(S,R,c,d);break;case"t":S=c,R=d,p=l[l.length-1],p.command==="Q"&&(S=c+(c-p.points[0]),R=d+(d-p.points[1])),c+=v.shift(),d+=v.shift(),E="Q",P.push(S,R,c,d);break;case"A":F=v.shift(),L=v.shift(),N=v.shift(),I=v.shift(),M=v.shift(),U=c,W=d,c=v.shift(),d=v.shift(),E="A",P=this.convertEndpointToCenterParameterization(U,W,c,d,I,M,F,L,N);break;case"a":F=v.shift(),L=v.shift(),N=v.shift(),I=v.shift(),M=v.shift(),U=c,W=d,c+=v.shift(),d+=v.shift(),E="A",P=this.convertEndpointToCenterParameterization(U,W,c,d,I,M,F,L,N);break}l.push({command:E||_,points:P,start:{x:k,y:C},pathLength:this.calcLength(k,C,E||_,P)})}(_==="z"||_==="Z")&&l.push({command:"z",points:[],start:void 0,pathLength:0})}return l}static calcLength(e,n,r,s){let l,a,c,d;const g=kt;switch(r){case"L":return g.getLineLength(e,n,s[0],s[1]);case"C":return(0,zo.getCubicArcLength)([e,s[0],s[2],s[4]],[n,s[1],s[3],s[5]],1);case"Q":return(0,zo.getQuadraticArcLength)([e,s[0],s[2]],[n,s[1],s[3]],1);case"A":l=0;const y=s[4],w=s[5],x=s[4]+w;let _=Math.PI/180;if(Math.abs(y-x)<_&&(_=Math.abs(y-x)),a=g.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],y,0),w<0)for(d=y-_;d>x;d-=_)c=g.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],d,0),l+=g.getLineLength(a.x,a.y,c.x,c.y),a=c;else for(d=y+_;d1&&(c*=Math.sqrt(_),d*=Math.sqrt(_));let v=Math.sqrt((c*c*(d*d)-c*c*(x*x)-d*d*(w*w))/(c*c*(x*x)+d*d*(w*w)));l===a&&(v*=-1),isNaN(v)&&(v=0);const E=v*c*x/d,P=v*-d*w/c,k=(e+r)/2+Math.cos(y)*E-Math.sin(y)*P,C=(n+s)/2+Math.sin(y)*E+Math.cos(y)*P,p=function(M){return Math.sqrt(M[0]*M[0]+M[1]*M[1])},S=function(M,U){return(M[0]*U[0]+M[1]*U[1])/(p(M)*p(U))},R=function(M,U){return(M[0]*U[1]=1&&(I=0),a===0&&I>0&&(I=I-2*Math.PI),a===1&&I<0&&(I=I+2*Math.PI),[k,C,c,d,F,I,y,a]}}ys.Path=kt;kt.prototype.className="Path";kt.prototype._attrsAffectingSize=["data"];(0,R9._registerNode)(kt);N9.Factory.addGetterSetter(kt,"data");Object.defineProperty(vc,"__esModule",{value:!0});vc.Arrow=void 0;const Sc=Me,M9=jl,R5=Se,L9=Re,N2=ys;class uo extends M9.Line{_sceneFunc(e){super._sceneFunc(e);const n=Math.PI*2,r=this.points();let s=r;const l=this.tension()!==0&&r.length>4;l&&(s=this.getTensionPoints());const a=this.pointerLength(),c=r.length;let d,g;if(l){const x=[s[s.length-4],s[s.length-3],s[s.length-2],s[s.length-1],r[c-2],r[c-1]],_=N2.Path.calcLength(s[s.length-4],s[s.length-3],"C",x),v=N2.Path.getPointOnQuadraticBezier(Math.min(1,1-a/_),x[0],x[1],x[2],x[3],x[4],x[5]);d=r[c-2]-v.x,g=r[c-1]-v.y}else d=r[c-2]-r[c-4],g=r[c-1]-r[c-3];const y=(Math.atan2(g,d)+n)%n,w=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[c-2],r[c-1]),e.rotate(y),e.moveTo(0,0),e.lineTo(-a,w/2),e.lineTo(-a,-w/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),l?(d=(s[0]+s[2])/2-r[0],g=(s[1]+s[3])/2-r[1]):(d=r[2]-r[0],g=r[3]-r[1]),e.rotate((Math.atan2(-g,-d)+n)%n),e.moveTo(0,0),e.lineTo(-a,w/2),e.lineTo(-a,-w/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x,y:e.y-n,width:e.width,height:e.height+n*2}}}vc.Arrow=uo;uo.prototype.className="Arrow";(0,L9._registerNode)(uo);Sc.Factory.addGetterSetter(uo,"pointerLength",10,(0,R5.getNumberValidator)());Sc.Factory.addGetterSetter(uo,"pointerWidth",10,(0,R5.getNumberValidator)());Sc.Factory.addGetterSetter(uo,"pointerAtBeginning",!1);Sc.Factory.addGetterSetter(uo,"pointerAtEnding",!0);var _c={};Object.defineProperty(_c,"__esModule",{value:!0});_c.Circle=void 0;const I9=Me,z9=Tt,D9=Se,A9=Re;class vs extends z9.Shape{_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)}}_c.Circle=vs;vs.prototype._centroid=!0;vs.prototype.className="Circle";vs.prototype._attrsAffectingSize=["radius"];(0,A9._registerNode)(vs);I9.Factory.addGetterSetter(vs,"radius",0,(0,D9.getNumberValidator)());var wc={};Object.defineProperty(wc,"__esModule",{value:!0});wc.Ellipse=void 0;const og=Me,O9=Tt,F5=Se,H9=Re;class Pi extends O9.Shape{_sceneFunc(e){const n=this.radiusX(),r=this.radiusY();e.beginPath(),e.save(),n!==r&&e.scale(1,r/n),e.arc(0,0,n,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)}}wc.Ellipse=Pi;Pi.prototype.className="Ellipse";Pi.prototype._centroid=!0;Pi.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,H9._registerNode)(Pi);og.Factory.addComponentsGetterSetter(Pi,"radius",["x","y"]);og.Factory.addGetterSetter(Pi,"radiusX",0,(0,F5.getNumberValidator)());og.Factory.addGetterSetter(Pi,"radiusY",0,(0,F5.getNumberValidator)());var Cc={};Object.defineProperty(Cc,"__esModule",{value:!0});Cc.Image=void 0;const Kh=ct,co=Me,U9=Tt,G9=Re,Vl=Se;let pr=class M5 extends U9.Shape{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const 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(){const e=!!this.cornerRadius(),n=this.hasShadow();return e&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),s=this.cornerRadius(),l=this.attrs.image;let a;if(l){const c=this.attrs.cropWidth,d=this.attrs.cropHeight;c&&d?a=[l,this.cropX(),this.cropY(),c,d,0,0,n,r]:a=[l,0,0,n,r]}(this.hasFill()||this.hasStroke()||s)&&(e.beginPath(),s?Kh.Util.drawRoundedRectPath(e,n,r,s):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),l&&(s&&e.clip(),e.drawImage.apply(e,a))}_hitFunc(e){const n=this.width(),r=this.height(),s=this.cornerRadius();e.beginPath(),s?Kh.Util.drawRoundedRectPath(e,n,r,s):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,r=null){const s=Kh.Util.createImageElement();s.onload=function(){const l=new M5({image:s});n(l)},s.onerror=r,s.crossOrigin="Anonymous",s.src=e}};Cc.Image=pr;pr.prototype.className="Image";(0,G9._registerNode)(pr);co.Factory.addGetterSetter(pr,"cornerRadius",0,(0,Vl.getNumberOrArrayOfNumbersValidator)(4));co.Factory.addGetterSetter(pr,"image");co.Factory.addComponentsGetterSetter(pr,"crop",["x","y","width","height"]);co.Factory.addGetterSetter(pr,"cropX",0,(0,Vl.getNumberValidator)());co.Factory.addGetterSetter(pr,"cropY",0,(0,Vl.getNumberValidator)());co.Factory.addGetterSetter(pr,"cropWidth",0,(0,Vl.getNumberValidator)());co.Factory.addGetterSetter(pr,"cropHeight",0,(0,Vl.getNumberValidator)());var ls={};Object.defineProperty(ls,"__esModule",{value:!0});ls.Tag=ls.Label=void 0;const kc=Me,B9=Tt,j9=ps,sg=Se,L5=Re,I5=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],V9="Change.konva",b9="none",$f="up",qf="right",Zf="down",Jf="left",W9=I5.length;class lg extends j9.Group{constructor(e){super(e),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let n=this,r;const s=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),s=Math.min(s,a.y),l=Math.max(l,a.y)}),{x:n,y:s,width:r-n,height:l-s}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Pc.RegularPolygon=fo;fo.prototype.className="RegularPolygon";fo.prototype._centroid=!0;fo.prototype._attrsAffectingSize=["radius"];(0,Z9._registerNode)(fo);z5.Factory.addGetterSetter(fo,"radius",0,(0,D5.getNumberValidator)());z5.Factory.addGetterSetter(fo,"sides",0,(0,D5.getNumberValidator)());var Tc={};Object.defineProperty(Tc,"__esModule",{value:!0});Tc.Ring=void 0;const A5=Me,J9=Tt,O5=Se,e7=Re,R2=Math.PI*2;class go extends J9.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,R2,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),R2,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)}}Tc.Ring=go;go.prototype.className="Ring";go.prototype._centroid=!0;go.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,e7._registerNode)(go);A5.Factory.addGetterSetter(go,"innerRadius",0,(0,O5.getNumberValidator)());A5.Factory.addGetterSetter(go,"outerRadius",0,(0,O5.getNumberValidator)());var Nc={};Object.defineProperty(Nc,"__esModule",{value:!0});Nc.Sprite=void 0;const po=Me,t7=Tt,n7=ms,H5=Se,r7=Re;class mr extends t7.Shape{constructor(e){super(e),this._updated=!0,this.anim=new n7.Animation(()=>{const n=this._updated;return this._updated=!1,n}),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){const n=this.animation(),r=this.frameIndex(),s=r*4,l=this.animations()[n],a=this.frameOffsets(),c=l[s+0],d=l[s+1],g=l[s+2],y=l[s+3],w=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,g,y),e.closePath(),e.fillStrokeShape(this)),w)if(a){const x=a[n],_=r*2;e.drawImage(w,c,d,g,y,x[_+0],x[_+1],g,y)}else e.drawImage(w,c,d,g,y,0,0,g,y)}_hitFunc(e){const n=this.animation(),r=this.frameIndex(),s=r*4,l=this.animations()[n],a=this.frameOffsets(),c=l[s+2],d=l[s+3];if(e.beginPath(),a){const g=a[n],y=r*2;e.rect(g[y+0],g[y+1],c,d)}else e.rect(0,0,c,d);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const 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(){const e=this.frameIndex(),n=this.animation(),r=this.animations(),s=r[n],l=s.length/4;e{if(new RegExp("\\p{Emoji}","u").test(n)){const l=s[r+1];l&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(l)?(e.push(n+l),s[r+1]=""):e.push(n)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(n+(s[r+1]||""))?e.push(n+s[r+1]):r>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(n)?e[e.length-1]+=n:n&&e.push(n);return e},[])}const Do="auto",a7="center",U5="inherit",Qs="justify",u7="Change.konva",c7="2d",F2="-",G5="left",d7="text",h7="Text",f7="top",g7="bottom",M2="middle",B5="normal",p7="px ",nu=" ",m7="right",L2="rtl",y7="word",v7="char",I2="none",Yh="…",j5=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],x7=j5.length;function S7(t){return t.split(",").map(e=>{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}let ru;function Qh(){return ru||(ru=e0.Util.createCanvasElement().getContext(c7),ru)}function _7(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function w7(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function C7(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let gt=class extends s7.Shape{constructor(e){super(C7(e)),this._partialTextX=0,this._partialTextY=0;for(let n=0;n1&&(C+=a)}}_hitFunc(e){const n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){const n=e0.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(d7,n),this}getWidth(){return this.attrs.width===Do||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Do||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return e0.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n,r,s,l,a,c,d,g,y,w,x;let _=Qh(),v=this.fontSize(),E;_.save(),_.font=this._getContextFont(),E=_.measureText(e),_.restore();const P=v/100;return{actualBoundingBoxAscent:(n=E.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*P,actualBoundingBoxDescent:(r=E.actualBoundingBoxDescent)!==null&&r!==void 0?r:0,actualBoundingBoxLeft:(s=E.actualBoundingBoxLeft)!==null&&s!==void 0?s:-7.421875*P,actualBoundingBoxRight:(l=E.actualBoundingBoxRight)!==null&&l!==void 0?l:75.732421875*P,alphabeticBaseline:(a=E.alphabeticBaseline)!==null&&a!==void 0?a:0,emHeightAscent:(c=E.emHeightAscent)!==null&&c!==void 0?c:100*P,emHeightDescent:(d=E.emHeightDescent)!==null&&d!==void 0?d:-20*P,fontBoundingBoxAscent:(g=E.fontBoundingBoxAscent)!==null&&g!==void 0?g:91*P,fontBoundingBoxDescent:(y=E.fontBoundingBoxDescent)!==null&&y!==void 0?y:21*P,hangingBaseline:(w=E.hangingBaseline)!==null&&w!==void 0?w:72.80000305175781*P,ideographicBaseline:(x=E.ideographicBaseline)!==null&&x!==void 0?x:-21*P,width:E.width,height:v}}_getContextFont(){return this.fontStyle()+nu+this.fontVariant()+nu+(this.fontSize()+p7)+S7(this.fontFamily())}_addTextLine(e){this.align()===Qs&&(e=e.trim());const r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){const n=this.letterSpacing(),r=e.length;return Qh().measureText(e).width+n*r}_setTextData(){let e=this.text().split(` `),n=+this.fontSize(),r=0,s=this.lineHeight()*n,l=this.attrs.width,a=this.attrs.height,c=l!==Do&&l!==void 0,d=a!==Do&&a!==void 0,g=this.padding(),y=l-g*2,w=a-g*2,x=0,_=this.wrap(),v=_!==I2,E=_!==v7&&v,P=this.ellipsis();this.textArr=[],Qh().font=this._getContextFont();const k=P?this._getTextWidth(Yh):0;for(let C=0,p=e.length;Cy)for(;S.length>0;){let F=0,L=Ki(S).length,N="",I=0;for(;F>>1,U=Ki(S),W=U.slice(0,M+1).join(""),$=this._getTextWidth(W);(P&&d&&x+s>w?$+k:$)<=y?(F=M+1,N=W,I=$):L=M}if(N){if(E){const W=Ki(S),$=Ki(N),ie=W[$.length],re=ie===nu||ie===F2;let we;if(re&&I<=y)we=$.length;else{const Te=$.lastIndexOf(nu),H=$.lastIndexOf(F2);we=Math.max(Te,H)+1}we>0&&(F=we,N=W.slice(0,F).join(""),I=this._getTextWidth(N))}if(N=N.trimRight(),this._addTextLine(N),r=Math.max(r,I),x+=s,this._shouldHandleEllipsis(x)){this._tryToAddEllipsisToLastLine();break}if(S=Ki(S).slice(F).join("").trimLeft(),S.length>0&&(R=this._getTextWidth(S),R<=y)){this._addTextLine(S),x+=s,r=Math.max(r,R);break}}else break}else this._addTextLine(S),x+=s,r=Math.max(r,R),this._shouldHandleEllipsis(x)&&Cw)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){const n=+this.fontSize(),r=this.lineHeight()*n,s=this.attrs.height,l=s!==Do&&s!==void 0,a=this.padding(),c=s-a*2;return!(this.wrap()!==I2)||l&&e+r>c}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,n=e!==Do&&e!==void 0,r=this.padding(),s=e-r*2,l=this.ellipsis(),a=this.textArr[this.textArr.length-1];!a||!l||(n&&(this._getTextWidth(a.text+Yh)n?null:$s.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=$s.Path.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();const n=this.textDecoration(),r=this.fill(),s=this.fontSize(),l=this.glyphInfo;n==="underline"&&e.beginPath();for(let a=0;a=1){const r=n[0].p0;e.moveTo(r.x,r.y)}for(let r=0;rt+`.${X5}`).join(" "),A2="nodesRect",M7=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],L7={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},I7="ontouchstart"in Wn.Konva._global;function z7(t,e,n){if(t==="rotater")return n;e+=Ke.Util.degToRad(L7[t]||0);const r=(Ke.Util.radToDeg(e)%360+360)%360;return Ke.Util._inRange(r,315+22.5,360)||Ke.Util._inRange(r,0,22.5)?"ns-resize":Ke.Util._inRange(r,45-22.5,45+22.5)?"nesw-resize":Ke.Util._inRange(r,90-22.5,90+22.5)?"ew-resize":Ke.Util._inRange(r,135-22.5,135+22.5)?"nwse-resize":Ke.Util._inRange(r,180-22.5,180+22.5)?"ns-resize":Ke.Util._inRange(r,225-22.5,225+22.5)?"nesw-resize":Ke.Util._inRange(r,270-22.5,270+22.5)?"ew-resize":Ke.Util._inRange(r,315-22.5,315+22.5)?"nwse-resize":(Ke.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}const Wu=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function D7(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function Y5(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),s=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:r,y:s}}function A7(t,e){const n=D7(t);return Y5(t,e,n)}function O7(t,e,n){let r=e;for(let s=0;ss.isAncestorOf(this)?(Ke.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=n,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(s=>{const l=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(s._attrsAffectingSize.length){const a=s._attrsAffectingSize.map(c=>c+"Change."+this._getEventNamespace()).join(" ");s.on(a,l)}s.on(M7.map(a=>a+`.${this._getEventNamespace()}`).join(" "),l),s.on(`absoluteTransformChange.${this._getEventNamespace()}`,l),this._proxyDrag(s)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const s=e.getAbsolutePosition(),l=s.x-n.x,a=s.y-n.y;this.nodes().forEach(c=>{if(c===e||c.isDragging())return;const d=c.getAbsolutePosition();c.setAbsolutePosition({x:d.x+l,y:d.y+a}),c.startDrag(r)}),n=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(A2),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(A2,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){const s=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),l=e.getAbsoluteScale(r),a=e.getAbsolutePosition(r),c=s.x*l.x-e.offsetX()*l.x,d=s.y*l.y-e.offsetY()*l.y,g=(Wn.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),y={x:a.x+c*Math.cos(g)+d*Math.sin(-g),y:a.y+d*Math.cos(g)+c*Math.sin(g),width:s.width*l.x,height:s.height*l.y,rotation:g};return Y5(y,-Wn.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const n=[];this.nodes().map(g=>{const y=g.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),w=[{x:y.x,y:y.y},{x:y.x+y.width,y:y.y},{x:y.x+y.width,y:y.y+y.height},{x:y.x,y:y.y+y.height}],x=g.getAbsoluteTransform();w.forEach(function(_){const v=x.point(_);n.push(v)})});const r=new Ke.Transform;r.rotate(-Wn.Konva.getAngle(this.rotation()));let s=1/0,l=1/0,a=-1/0,c=-1/0;n.forEach(function(g){const y=r.point(g);s===void 0&&(s=a=y.x,l=c=y.y),s=Math.min(s,y.x),l=Math.min(l,y.y),a=Math.max(a,y.x),c=Math.max(c,y.y)}),r.invert();const d=r.point({x:s,y:l});return{x:d.x,y:d.y,width:a-s,height:c-l,rotation:Wn.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Wu.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const n=new N7.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:I7?10:"auto"}),r=this;n.on("mousedown touchstart",function(s){r._handleMouseDown(s)}),n.on("dragstart",s=>{n.stopDrag(),s.cancelBubble=!0}),n.on("dragend",s=>{s.cancelBubble=!0}),n.on("mouseenter",()=>{const s=Wn.Konva.getAngle(this.rotation()),l=this.rotateAnchorCursor(),a=z7(e,s,l);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){const e=new T7.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n,r){const s=r.getParent(),l=s.padding();n.beginPath(),n.rect(-l,-l,r.width()+l*2,r.height()+l*2),n.moveTo(r.width()/2,-l),s.rotateEnabled()&&s.rotateLineVisible()&&n.lineTo(r.width()/2,-s.rotateAnchorOffset()*Ke.Util._sign(r.height())-l),n.fillStrokeShape(r)},hitFunc:(n,r)=>{if(!this.shouldOverdrawWholeArea())return;const s=this.padding();n.beginPath(),n.rect(-s,-s,r.width()+s*2,r.height()+s*2),n.fillStrokeShape(r)}});this.add(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const n=this._getNodeRect(),r=n.width,s=n.height,l=Math.sqrt(Math.pow(r,2)+Math.pow(s,2));this.sin=Math.abs(s/l),this.cos=Math.abs(r/l),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const a=e.target.getAbsolutePosition(),c=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:c.x-a.x,y:c.y-a.y},t0++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(d=>{d._fire("transformstart",{evt:e.evt,target:d})})}_handleMouseMove(e){let n,r,s;const l=this.findOne("."+this._movingAnchorName),a=l.getStage();a.setPointersPositions(e);const c=a.getPointerPosition();let d={x:c.x-this._anchorDragOffset.x,y:c.y-this._anchorDragOffset.y};const g=l.getAbsolutePosition();this.anchorDragBoundFunc()&&(d=this.anchorDragBoundFunc()(g,d,e)),l.setAbsolutePosition(d);const y=l.getAbsolutePosition();if(g.x===y.x&&g.y===y.y)return;if(this._movingAnchorName==="rotater"){const C=this._getNodeRect();n=l.x()-C.width/2,r=-l.y()+C.height/2;let p=Math.atan2(-r,n)+Math.PI/2;C.height<0&&(p-=Math.PI);const R=Wn.Konva.getAngle(this.rotation())+p,F=Wn.Konva.getAngle(this.rotationSnapTolerance()),N=O7(this.rotationSnaps(),R,F)-C.rotation,I=A7(C,N);this._fitNodesInto(I,e);return}const w=this.shiftBehavior();let x;w==="inverted"?x=this.keepRatio()&&!e.shiftKey:w==="none"?x=this.keepRatio():x=this.keepRatio()||e.shiftKey;let _=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(x){const C=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};s=Math.sqrt(Math.pow(C.x-l.x(),2)+Math.pow(C.y-l.y(),2));const p=this.findOne(".top-left").x()>C.x?-1:1,S=this.findOne(".top-left").y()>C.y?-1:1;n=s*this.cos*p,r=s*this.sin*S,this.findOne(".top-left").x(C.x-n),this.findOne(".top-left").y(C.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(l.y());else if(this._movingAnchorName==="top-right"){if(x){const C=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};s=Math.sqrt(Math.pow(l.x()-C.x,2)+Math.pow(C.y-l.y(),2));const p=this.findOne(".top-right").x()C.y?-1:1;n=s*this.cos*p,r=s*this.sin*S,this.findOne(".top-right").x(C.x+n),this.findOne(".top-right").y(C.y-r)}var v=l.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(l.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(l.x());else if(this._movingAnchorName==="bottom-left"){if(x){const C=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};s=Math.sqrt(Math.pow(C.x-l.x(),2)+Math.pow(l.y()-C.y,2));const p=C.x{var l;s._fire("transformend",{evt:e,target:s}),(l=s.getLayer())===null||l===void 0||l.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,n){const r=this._getNodeRect(),s=1;if(Ke.Util._inRange(e.width,-this.padding()*2-s,s)){this.update();return}if(Ke.Util._inRange(e.height,-this.padding()*2-s,s)){this.update();return}const l=new Ke.Transform;if(l.rotate(Wn.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const x=l.point({x:-this.padding()*2,y:0});e.x+=x.x,e.y+=x.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const x=l.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const x=l.point({x:0,y:-this.padding()*2});e.x+=x.x,e.y+=x.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const x=l.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const x=this.boundBoxFunc()(r,e);x?e=x:Ke.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,c=new Ke.Transform;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/a,r.height/a);const d=new Ke.Transform,g=e.width/a,y=e.height/a;this.flipEnabled()===!1?(d.translate(e.x,e.y),d.rotate(e.rotation),d.translate(e.width<0?e.width:0,e.height<0?e.height:0),d.scale(Math.abs(g),Math.abs(y))):(d.translate(e.x,e.y),d.rotate(e.rotation),d.scale(g,y));const w=d.multiply(c.invert());this._nodes.forEach(x=>{var _;const v=x.getParent().getAbsoluteTransform(),E=x.getTransform().copy();E.translate(x.offsetX(),x.offsetY());const P=new Ke.Transform;P.multiply(v.copy().invert()).multiply(w).multiply(v).multiply(E);const k=P.decompose();x.setAttrs(k),(_=x.getLayer())===null||_===void 0||_.batchDraw()}),this.rotation(Ke.Util._getRotation(e.rotation)),this._nodes.forEach(x=>{this._fire("transform",{evt:n,target:x}),x._fire("transform",{evt:n,target:x})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e;const n=this._getNodeRect();this.rotation(Ke.Util._getRotation(n.rotation));const r=n.width,s=n.height,l=this.enabledAnchors(),a=this.resizeEnabled(),c=this.padding(),d=this.anchorSize(),g=this.find("._anchor");g.forEach(w=>{w.setAttrs({width:d,height:d,offsetX:d/2,offsetY:d/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:d/2+c,offsetY:d/2+c,visible:a&&l.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:d/2+c,visible:a&&l.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:d/2-c,offsetY:d/2+c,visible:a&&l.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:s/2,offsetX:d/2+c,visible:a&&l.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:s/2,offsetX:d/2-c,visible:a&&l.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:s,offsetX:d/2+c,offsetY:d/2-c,visible:a&&l.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:s,offsetY:d/2-c,visible:a&&l.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:s,offsetX:d/2-c,offsetY:d/2-c,visible:a&&l.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Ke.Util._sign(s)-c,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:s,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const y=this.anchorStyleFunc();y&&g.forEach(w=>{y(w)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),D2.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return z2.Node.prototype.toObject.call(this)}clone(e){return z2.Node.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Mc.Transformer=De;De.isTransforming=()=>t0>0;function H7(t){return t instanceof Array||Ke.Util.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){Wu.indexOf(e)===-1&&Ke.Util.warn("Unknown anchor name: "+e+". Available names are: "+Wu.join(", "))}),t||[]}De.prototype.className="Transformer";(0,R7._registerNode)(De);je.Factory.addGetterSetter(De,"enabledAnchors",Wu,H7);je.Factory.addGetterSetter(De,"flipEnabled",!0,(0,Ri.getBooleanValidator)());je.Factory.addGetterSetter(De,"resizeEnabled",!0);je.Factory.addGetterSetter(De,"anchorSize",10,(0,Ri.getNumberValidator)());je.Factory.addGetterSetter(De,"rotateEnabled",!0);je.Factory.addGetterSetter(De,"rotateLineVisible",!0);je.Factory.addGetterSetter(De,"rotationSnaps",[]);je.Factory.addGetterSetter(De,"rotateAnchorOffset",50,(0,Ri.getNumberValidator)());je.Factory.addGetterSetter(De,"rotateAnchorCursor","crosshair");je.Factory.addGetterSetter(De,"rotationSnapTolerance",5,(0,Ri.getNumberValidator)());je.Factory.addGetterSetter(De,"borderEnabled",!0);je.Factory.addGetterSetter(De,"anchorStroke","rgb(0, 161, 255)");je.Factory.addGetterSetter(De,"anchorStrokeWidth",1,(0,Ri.getNumberValidator)());je.Factory.addGetterSetter(De,"anchorFill","white");je.Factory.addGetterSetter(De,"anchorCornerRadius",0,(0,Ri.getNumberValidator)());je.Factory.addGetterSetter(De,"borderStroke","rgb(0, 161, 255)");je.Factory.addGetterSetter(De,"borderStrokeWidth",1,(0,Ri.getNumberValidator)());je.Factory.addGetterSetter(De,"borderDash");je.Factory.addGetterSetter(De,"keepRatio",!0);je.Factory.addGetterSetter(De,"shiftBehavior","default");je.Factory.addGetterSetter(De,"centeredScaling",!1);je.Factory.addGetterSetter(De,"ignoreStroke",!1);je.Factory.addGetterSetter(De,"padding",0,(0,Ri.getNumberValidator)());je.Factory.addGetterSetter(De,"nodes");je.Factory.addGetterSetter(De,"node");je.Factory.addGetterSetter(De,"boundBoxFunc");je.Factory.addGetterSetter(De,"anchorDragBoundFunc");je.Factory.addGetterSetter(De,"anchorStyleFunc");je.Factory.addGetterSetter(De,"shouldOverdrawWholeArea",!1);je.Factory.addGetterSetter(De,"useSingleNodeRotation",!0);je.Factory.backCompat(De,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Lc={};Object.defineProperty(Lc,"__esModule",{value:!0});Lc.Wedge=void 0;const Ic=Me,U7=Tt,G7=Re,Q5=Se,B7=Re;class br extends U7.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,G7.Konva.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)}}Lc.Wedge=br;br.prototype.className="Wedge";br.prototype._centroid=!0;br.prototype._attrsAffectingSize=["radius"];(0,B7._registerNode)(br);Ic.Factory.addGetterSetter(br,"radius",0,(0,Q5.getNumberValidator)());Ic.Factory.addGetterSetter(br,"angle",0,(0,Q5.getNumberValidator)());Ic.Factory.addGetterSetter(br,"clockwise",!1);Ic.Factory.backCompat(br,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var zc={};Object.defineProperty(zc,"__esModule",{value:!0});zc.Blur=void 0;const O2=Me,j7=it,V7=Se;function H2(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const b7=[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],W7=[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 K7(t,e){const n=t.data,r=t.width,s=t.height;let l,a,c,d,g,y,w,x,_,v,E,P,k,C,p,S,R,F,L,N;const I=e+e+1,M=r-1,U=s-1,W=e+1,$=W*(W+1)/2,ie=new H2,re=b7[e],we=W7[e];let Te=null,H=ie,j=null,Y=null;for(let ne=1;ne>we,L!==0?(L=255/L,n[a]=(d*re>>we)*L,n[a+1]=(g*re>>we)*L,n[a+2]=(y*re>>we)*L):n[a]=n[a+1]=n[a+2]=0,d-=x,g-=_,y-=v,w-=E,x-=j.r,_-=j.g,v-=j.b,E-=j.a,l=c+((l=de+e+1)>we,L>0?(L=255/L,n[l]=(d*re>>we)*L,n[l+1]=(g*re>>we)*L,n[l+2]=(y*re>>we)*L):n[l]=n[l+1]=n[l+2]=0,d-=x,g-=_,y-=v,w-=E,x-=j.r,_-=j.g,v-=j.b,E-=j.a,l=ne+((l=ze+W)0&&K7(e,n)};zc.Blur=X7;O2.Factory.addGetterSetter(j7.Node,"blurRadius",0,(0,V7.getNumberValidator)(),O2.Factory.afterSetFilter);var Dc={};Object.defineProperty(Dc,"__esModule",{value:!0});Dc.Brighten=void 0;const U2=Me,Y7=it,Q7=Se,$7=function(t){const e=this.brightness()*255,n=t.data,r=n.length;for(let s=0;s255?255:s,l=l<0?0:l>255?255:l,a=a<0?0:a>255?255:a,n[c]=s,n[c+1]=l,n[c+2]=a};Ac.Contrast=J7;G2.Factory.addGetterSetter(q7.Node,"contrast",0,(0,Z7.getNumberValidator)(),G2.Factory.afterSetFilter);var Oc={};Object.defineProperty(Oc,"__esModule",{value:!0});Oc.Emboss=void 0;const Si=Me,Hc=it,ex=ct,$5=Se,tx=function(t){const e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),s=this.embossBlend(),l=t.data,a=t.width,c=t.height,d=a*4;let g=0,y=0,w=c;switch(r){case"top-left":g=-1,y=-1;break;case"top":g=-1,y=0;break;case"top-right":g=-1,y=1;break;case"right":g=0,y=1;break;case"bottom-right":g=1,y=1;break;case"bottom":g=1,y=0;break;case"bottom-left":g=1,y=-1;break;case"left":g=0,y=-1;break;default:ex.Util.error("Unknown emboss direction: "+r)}do{const x=(w-1)*d;let _=g;w+_<1&&(_=0),w+_>c&&(_=0);const v=(w-1+_)*a*4;let E=a;do{const P=x+(E-1)*4;let k=y;E+k<1&&(k=0),E+k>a&&(k=0);const C=v+(E-1+k)*4,p=l[P]-l[C],S=l[P+1]-l[C+1],R=l[P+2]-l[C+2];let F=p;const L=F>0?F:-F,N=S>0?S:-S,I=R>0?R:-R;if(N>L&&(F=S),I>L&&(F=R),F*=e,s){const M=l[P]+F,U=l[P+1]+F,W=l[P+2]+F;l[P]=M>255?255:M<0?0:M,l[P+1]=U>255?255:U<0?0:U,l[P+2]=W>255?255:W<0?0:W}else{let M=n-F;M<0?M=0:M>255&&(M=255),l[P]=l[P+1]=l[P+2]=M}}while(--E)}while(--w)};Oc.Emboss=tx;Si.Factory.addGetterSetter(Hc.Node,"embossStrength",.5,(0,$5.getNumberValidator)(),Si.Factory.afterSetFilter);Si.Factory.addGetterSetter(Hc.Node,"embossWhiteLevel",.5,(0,$5.getNumberValidator)(),Si.Factory.afterSetFilter);Si.Factory.addGetterSetter(Hc.Node,"embossDirection","top-left",void 0,Si.Factory.afterSetFilter);Si.Factory.addGetterSetter(Hc.Node,"embossBlend",!1,void 0,Si.Factory.afterSetFilter);var Uc={};Object.defineProperty(Uc,"__esModule",{value:!0});Uc.Enhance=void 0;const B2=Me,nx=it,rx=Se;function Zh(t,e,n,r,s){const l=n-e,a=s-r;if(l===0)return r+a/2;if(a===0)return r;let c=(t-e)/l;return c=a*c+r,c}const ix=function(t){const e=t.data,n=e.length;let r=e[0],s=r,l,a=e[1],c=a,d,g=e[2],y=g,w;const x=this.enhance();if(x===0)return;for(let p=0;ps&&(s=l),d=e[p+1],dc&&(c=d),w=e[p+2],wy&&(y=w);s===r&&(s=255,r=0),c===a&&(c=255,a=0),y===g&&(y=255,g=0);let _,v,E,P,k,C;if(x>0)_=s+x*(255-s),v=r-x*(r-0),E=c+x*(255-c),P=a-x*(a-0),k=y+x*(255-y),C=g-x*(g-0);else{const p=(s+r)*.5;_=s+x*(s-p),v=r+x*(r-p);const S=(c+a)*.5;E=c+x*(c-S),P=a+x*(a-S);const R=(y+g)*.5;k=y+x*(y-R),C=g+x*(g-R)}for(let p=0;pg?x:g;const _=a,v=l,E=360/v*Math.PI/180;for(let P=0;Pg?x:g;const _=a,v=l,E=0;let P,k;for(y=0;ye&&(S=p,R=0,F=-1),s=0;s=0&&_=0&&v=0&&_=0&&v=255*4?255:0}return a}function xx(t,e,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],s=Math.round(Math.sqrt(r.length)),l=Math.floor(s/2),a=[];for(let c=0;c=0&&_=0&&v=n))for(let p=E;p=r)continue;const S=(n*p+C)*4;g+=a[S+0],y+=a[S+1],w+=a[S+2],x+=a[S+3],k+=1}g=g/k,y=y/k,w=w/k,x=x/k;for(let C=_;C=n))for(let p=E;p=r)continue;const S=(n*p+C)*4;a[S+0]=g,a[S+1]=y,a[S+2]=w,a[S+3]=x}}};Xc.Pixelate=Tx;W2.Factory.addGetterSetter(Ex.Node,"pixelSize",8,(0,Px.getNumberValidator)(),W2.Factory.afterSetFilter);var Yc={};Object.defineProperty(Yc,"__esModule",{value:!0});Yc.Posterize=void 0;const K2=Me,Nx=it,Rx=Se,Fx=function(t){const e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,s=255/e;for(let l=0;l255?255:t<0?0:Math.round(t)});Xu.Factory.addGetterSetter(gg.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});Xu.Factory.addGetterSetter(gg.Node,"blue",0,Mx.RGBComponent,Xu.Factory.afterSetFilter);var $c={};Object.defineProperty($c,"__esModule",{value:!0});$c.RGBA=void 0;const Ll=Me,qc=it,Ix=Se,zx=function(t){const e=t.data,n=e.length,r=this.red(),s=this.green(),l=this.blue(),a=this.alpha();for(let c=0;c255?255:t<0?0:Math.round(t)});Ll.Factory.addGetterSetter(qc.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});Ll.Factory.addGetterSetter(qc.Node,"blue",0,Ix.RGBComponent,Ll.Factory.afterSetFilter);Ll.Factory.addGetterSetter(qc.Node,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});var Zc={};Object.defineProperty(Zc,"__esModule",{value:!0});Zc.Sepia=void 0;const Dx=function(t){const e=t.data,n=e.length;for(let r=0;r127&&(g=255-g),y>127&&(y=255-y),w>127&&(w=255-w),e[d]=g,e[d+1]=y,e[d+2]=w}while(--c)}while(--l)};Jc.Solarize=Ax;var ed={};Object.defineProperty(ed,"__esModule",{value:!0});ed.Threshold=void 0;const X2=Me,Ox=it,Hx=Se,Ux=function(t){const e=this.threshold()*255,n=t.data,r=n.length;for(let s=0;sA||f[T]!==m[A]){var B=` `+f[T].replace(" at new "," at ");return i.displayName&&B.includes("")&&(B=B.replace("",i.displayName)),B}while(1<=T&&0<=A);break}}}finally{od=!1,Error.prepareStackTrace=u}return(i=i?i.displayName||i.name:"")?ws(i):""}var O3=Object.prototype.hasOwnProperty,ld=[],yo=-1;function Wr(i){return{current:i}}function qe(i){0>yo||(i.current=ld[yo],ld[yo]=null,yo--)}function Qe(i,o){yo++,ld[yo]=i.current,i.current=o}var Kr={},Bt=Wr(Kr),rn=Wr(!1),Li=Kr;function vo(i,o){var u=i.type.contextTypes;if(!u)return Kr;var h=i.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===o)return h.__reactInternalMemoizedMaskedChildContext;var f={},m;for(m in u)f[m]=o[m];return h&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=o,i.__reactInternalMemoizedMaskedChildContext=f),f}function on(i){return i=i.childContextTypes,i!=null}function Kl(){qe(rn),qe(Bt)}function Cg(i,o,u){if(Bt.current!==Kr)throw Error(a(168));Qe(Bt,o),Qe(rn,u)}function kg(i,o,u){var h=i.stateNode;if(o=o.childContextTypes,typeof h.getChildContext!="function")return u;h=h.getChildContext();for(var f in h)if(!(f in o))throw Error(a(108,N(i)||"Unknown",f));return l({},u,h)}function Xl(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Kr,Li=Bt.current,Qe(Bt,i),Qe(rn,rn.current),!0}function Eg(i,o,u){var h=i.stateNode;if(!h)throw Error(a(169));u?(i=kg(i,o,Li),h.__reactInternalMemoizedMergedChildContext=i,qe(rn),qe(Bt),Qe(Bt,i)):qe(rn),Qe(rn,u)}var Hn=Math.clz32?Math.clz32:G3,H3=Math.log,U3=Math.LN2;function G3(i){return i>>>=0,i===0?32:31-(H3(i)/U3|0)|0}var Yl=64,Ql=4194304;function Cs(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function $l(i,o){var u=i.pendingLanes;if(u===0)return 0;var h=0,f=i.suspendedLanes,m=i.pingedLanes,T=u&268435455;if(T!==0){var A=T&~f;A!==0?h=Cs(A):(m&=T,m!==0&&(h=Cs(m)))}else T=u&~f,T!==0?h=Cs(T):m!==0&&(h=Cs(m));if(h===0)return 0;if(o!==0&&o!==h&&!(o&f)&&(f=h&-h,m=o&-o,f>=m||f===16&&(m&4194240)!==0))return o;if(h&4&&(h|=u&16),o=i.entangledLanes,o!==0)for(i=i.entanglements,o&=h;0u;u++)o.push(i);return o}function ks(i,o,u){i.pendingLanes|=o,o!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,o=31-Hn(o),i[o]=u}function V3(i,o){var u=i.pendingLanes&~o;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=o,i.mutableReadLanes&=o,i.entangledLanes&=o,o=i.entanglements;var h=i.eventTimes;for(i=i.expirationTimes;0>=T,f-=T,_r=1<<32-Hn(o)+f|u<Ue?(It=Pe,Pe=null):It=Pe.sibling;var Ge=oe(G,Pe,b[Ue],se);if(Ge===null){Pe===null&&(Pe=It);break}i&&Pe&&Ge.alternate===null&&o(G,Pe),O=m(Ge,O,Ue),Ne===null?ve=Ge:Ne.sibling=Ge,Ne=Ge,Pe=It}if(Ue===b.length)return u(G,Pe),tt&&zi(G,Ue),ve;if(Pe===null){for(;UeUe?(It=Pe,Pe=null):It=Pe.sibling;var ei=oe(G,Pe,Ge.value,se);if(ei===null){Pe===null&&(Pe=It);break}i&&Pe&&ei.alternate===null&&o(G,Pe),O=m(ei,O,Ue),Ne===null?ve=ei:Ne.sibling=ei,Ne=ei,Pe=It}if(Ge.done)return u(G,Pe),tt&&zi(G,Ue),ve;if(Pe===null){for(;!Ge.done;Ue++,Ge=b.next())Ge=Ee(G,Ge.value,se),Ge!==null&&(O=m(Ge,O,Ue),Ne===null?ve=Ge:Ne.sibling=Ge,Ne=Ge);return tt&&zi(G,Ue),ve}for(Pe=h(G,Pe);!Ge.done;Ue++,Ge=b.next())Ge=Ze(Pe,G,Ue,Ge.value,se),Ge!==null&&(i&&Ge.alternate!==null&&Pe.delete(Ge.key===null?Ue:Ge.key),O=m(Ge,O,Ue),Ne===null?ve=Ge:Ne.sibling=Ge,Ne=Ge);return i&&Pe.forEach(function(N4){return o(G,N4)}),tt&&zi(G,Ue),ve}function Pr(G,O,b,se){if(typeof b=="object"&&b!==null&&b.type===y&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case d:e:{for(var ve=b.key,Ne=O;Ne!==null;){if(Ne.key===ve){if(ve=b.type,ve===y){if(Ne.tag===7){u(G,Ne.sibling),O=f(Ne,b.props.children),O.return=G,G=O;break e}}else if(Ne.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===p&&Dg(ve)===Ne.type){u(G,Ne.sibling),O=f(Ne,b.props),O.ref=Ps(G,Ne,b),O.return=G,G=O;break e}u(G,Ne);break}else o(G,Ne);Ne=Ne.sibling}b.type===y?(O=Bi(b.props.children,G.mode,se,b.key),O.return=G,G=O):(se=za(b.type,b.key,b.props,null,G.mode,se),se.ref=Ps(G,O,b),se.return=G,G=se)}return T(G);case g:e:{for(Ne=b.key;O!==null;){if(O.key===Ne)if(O.tag===4&&O.stateNode.containerInfo===b.containerInfo&&O.stateNode.implementation===b.implementation){u(G,O.sibling),O=f(O,b.children||[]),O.return=G,G=O;break e}else{u(G,O);break}else o(G,O);O=O.sibling}O=ph(b,G.mode,se),O.return=G,G=O}return T(G);case p:return Ne=b._init,Pr(G,O,Ne(b._payload),se)}if(re(b))return Xe(G,O,b,se);if(F(b))return un(G,O,b,se);ra(G,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,O!==null&&O.tag===6?(u(G,O.sibling),O=f(O,b),O.return=G,G=O):(u(G,O),O=gh(b,G.mode,se),O.return=G,G=O),T(G)):u(G,O)}return Pr}var wo=Ag(!0),Og=Ag(!1),ia=Wr(null),oa=null,Co=null,Sd=null;function _d(){Sd=Co=oa=null}function Hg(i,o,u){Ae?(Qe(ia,o._currentValue),o._currentValue=u):(Qe(ia,o._currentValue2),o._currentValue2=u)}function wd(i){var o=ia.current;qe(ia),Ae?i._currentValue=o:i._currentValue2=o}function Cd(i,o,u){for(;i!==null;){var h=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,h!==null&&(h.childLanes|=o)):h!==null&&(h.childLanes&o)!==o&&(h.childLanes|=o),i===u)break;i=i.return}}function ko(i,o){oa=i,Sd=Co=null,i=i.dependencies,i!==null&&i.firstContext!==null&&(i.lanes&o&&(sn=!0),i.firstContext=null)}function Pn(i){var o=Ae?i._currentValue:i._currentValue2;if(Sd!==i)if(i={context:i,memoizedValue:o,next:null},Co===null){if(oa===null)throw Error(a(308));Co=i,oa.dependencies={lanes:0,firstContext:i}}else Co=Co.next=i;return o}var Di=null;function kd(i){Di===null?Di=[i]:Di.push(i)}function Ug(i,o,u,h){var f=o.interleaved;return f===null?(u.next=u,kd(o)):(u.next=f.next,f.next=u),o.interleaved=u,rr(i,h)}function rr(i,o){i.lanes|=o;var u=i.alternate;for(u!==null&&(u.lanes|=o),u=i,i=i.return;i!==null;)i.childLanes|=o,u=i.alternate,u!==null&&(u.childLanes|=o),u=i,i=i.return;return u.tag===3?u.stateNode:null}var Xr=!1;function Ed(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gg(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Cr(i,o){return{eventTime:i,lane:o,tag:0,payload:null,callback:null,next:null}}function Yr(i,o,u){var h=i.updateQueue;if(h===null)return null;if(h=h.shared,Fe&2){var f=h.pending;return f===null?o.next=o:(o.next=f.next,f.next=o),h.pending=o,rr(i,u)}return f=h.interleaved,f===null?(o.next=o,kd(h)):(o.next=f.next,f.next=o),h.interleaved=o,rr(i,u)}function sa(i,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var h=o.lanes;h&=i.pendingLanes,u|=h,o.lanes=u,cd(i,u)}}function Bg(i,o){var u=i.updateQueue,h=i.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var f=null,m=null;if(u=u.firstBaseUpdate,u!==null){do{var T={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};m===null?f=m=T:m=m.next=T,u=u.next}while(u!==null);m===null?f=m=o:m=m.next=o}else f=m=o;u={baseState:h.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:h.shared,effects:h.effects},i.updateQueue=u;return}i=u.lastBaseUpdate,i===null?u.firstBaseUpdate=o:i.next=o,u.lastBaseUpdate=o}function la(i,o,u,h){var f=i.updateQueue;Xr=!1;var m=f.firstBaseUpdate,T=f.lastBaseUpdate,A=f.shared.pending;if(A!==null){f.shared.pending=null;var B=A,te=B.next;B.next=null,T===null?m=te:T.next=te,T=B;var he=i.alternate;he!==null&&(he=he.updateQueue,A=he.lastBaseUpdate,A!==T&&(A===null?he.firstBaseUpdate=te:A.next=te,he.lastBaseUpdate=B))}if(m!==null){var Ee=f.baseState;T=0,he=te=B=null,A=m;do{var oe=A.lane,Ze=A.eventTime;if((h&oe)===oe){he!==null&&(he=he.next={eventTime:Ze,lane:0,tag:A.tag,payload:A.payload,callback:A.callback,next:null});e:{var Xe=i,un=A;switch(oe=o,Ze=u,un.tag){case 1:if(Xe=un.payload,typeof Xe=="function"){Ee=Xe.call(Ze,Ee,oe);break e}Ee=Xe;break e;case 3:Xe.flags=Xe.flags&-65537|128;case 0:if(Xe=un.payload,oe=typeof Xe=="function"?Xe.call(Ze,Ee,oe):Xe,oe==null)break e;Ee=l({},Ee,oe);break e;case 2:Xr=!0}}A.callback!==null&&A.lane!==0&&(i.flags|=64,oe=f.effects,oe===null?f.effects=[A]:oe.push(A))}else Ze={eventTime:Ze,lane:oe,tag:A.tag,payload:A.payload,callback:A.callback,next:null},he===null?(te=he=Ze,B=Ee):he=he.next=Ze,T|=oe;if(A=A.next,A===null){if(A=f.shared.pending,A===null)break;oe=A,A=oe.next,oe.next=null,f.lastBaseUpdate=oe,f.shared.pending=null}}while(!0);if(he===null&&(B=Ee),f.baseState=B,f.firstBaseUpdate=te,f.lastBaseUpdate=he,o=f.shared.interleaved,o!==null){f=o;do T|=f.lane,f=f.next;while(f!==o)}else m===null&&(f.shared.lanes=0);Oi|=T,i.lanes=T,i.memoizedState=Ee}}function jg(i,o,u){if(i=o.effects,o.effects=null,i!==null)for(o=0;ou?u:4,i(!0);var h=Fd.transition;Fd.transition={};try{i(!1),o()}finally{He=u,Fd.transition=h}}function lp(){return Nn().memoizedState}function t4(i,o,u){var h=qr(i);if(u={lane:h,action:u,hasEagerState:!1,eagerState:null,next:null},ap(i))up(o,u);else if(u=Ug(i,o,u,h),u!==null){var f=Wt();Rn(u,i,h,f),cp(u,o,h)}}function n4(i,o,u){var h=qr(i),f={lane:h,action:u,hasEagerState:!1,eagerState:null,next:null};if(ap(i))up(o,f);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=o.lastRenderedReducer,m!==null))try{var T=o.lastRenderedState,A=m(T,u);if(f.hasEagerState=!0,f.eagerState=A,Un(A,T)){var B=o.interleaved;B===null?(f.next=f,kd(o)):(f.next=B.next,B.next=f),o.interleaved=f;return}}catch{}finally{}u=Ug(i,o,f,h),u!==null&&(f=Wt(),Rn(u,i,h,f),cp(u,o,h))}}function ap(i){var o=i.alternate;return i===st||o!==null&&o===st}function up(i,o){Rs=ca=!0;var u=i.pending;u===null?o.next=o:(o.next=u.next,u.next=o),i.pending=o}function cp(i,o,u){if(u&4194240){var h=o.lanes;h&=i.pendingLanes,u|=h,o.lanes=u,cd(i,u)}}var fa={readContext:Pn,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useInsertionEffect:jt,useLayoutEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useMutableSource:jt,useSyncExternalStore:jt,useId:jt,unstable_isNewReconciler:!1},r4={readContext:Pn,useCallback:function(i,o){return or().memoizedState=[i,o===void 0?null:o],i},useContext:Pn,useEffect:Jg,useImperativeHandle:function(i,o,u){return u=u!=null?u.concat([i]):null,da(4194308,4,np.bind(null,o,i),u)},useLayoutEffect:function(i,o){return da(4194308,4,i,o)},useInsertionEffect:function(i,o){return da(4,2,i,o)},useMemo:function(i,o){var u=or();return o=o===void 0?null:o,i=i(),u.memoizedState=[i,o],i},useReducer:function(i,o,u){var h=or();return o=u!==void 0?u(o):o,h.memoizedState=h.baseState=o,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:o},h.queue=i,i=i.dispatch=t4.bind(null,st,i),[h.memoizedState,i]},useRef:function(i){var o=or();return i={current:i},o.memoizedState=i},useState:qg,useDebugValue:Od,useDeferredValue:function(i){return or().memoizedState=i},useTransition:function(){var i=qg(!1),o=i[0];return i=e4.bind(null,i[1]),or().memoizedState=i,[o,i]},useMutableSource:function(){},useSyncExternalStore:function(i,o,u){var h=st,f=or();if(tt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=o(),Lt===null)throw Error(a(349));Ai&30||Kg(h,o,u)}f.memoizedState=u;var m={value:u,getSnapshot:o};return f.queue=m,Jg(Yg.bind(null,h,m,i),[i]),h.flags|=2048,Ls(9,Xg.bind(null,h,m,u,o),void 0,null),u},useId:function(){var i=or(),o=Lt.identifierPrefix;if(tt){var u=wr,h=_r;u=(h&~(1<<32-Hn(h)-1)).toString(32)+u,o=":"+o+"R"+u,u=Fs++,0sh&&(o.flags|=128,h=!0,Ds(f,!1),o.lanes=4194304)}else{if(!h)if(i=aa(m),i!==null){if(o.flags|=128,h=!0,i=i.updateQueue,i!==null&&(o.updateQueue=i,o.flags|=4),Ds(f,!0),f.tail===null&&f.tailMode==="hidden"&&!m.alternate&&!tt)return Vt(o),null}else 2*Ft()-f.renderingStartTime>sh&&u!==1073741824&&(o.flags|=128,h=!0,Ds(f,!1),o.lanes=4194304);f.isBackwards?(m.sibling=o.child,o.child=m):(i=f.last,i!==null?i.sibling=m:o.child=m,f.last=m)}return f.tail!==null?(o=f.tail,f.rendering=o,f.tail=o.sibling,f.renderingStartTime=Ft(),o.sibling=null,i=ot.current,Qe(ot,h?i&1|2:i&1),o):(Vt(o),null);case 22:case 23:return dh(),u=o.memoizedState!==null,i!==null&&i.memoizedState!==null!==u&&(o.flags|=8192),u&&o.mode&1?mn&1073741824&&(Vt(o),Ce&&o.subtreeFlags&6&&(o.flags|=8192)):Vt(o),null;case 24:return null;case 25:return null}throw Error(a(156,o.tag))}function d4(i,o){switch(md(o),o.tag){case 1:return on(o.type)&&Kl(),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return Po(),qe(rn),qe(Bt),Rd(),i=o.flags,i&65536&&!(i&128)?(o.flags=i&-65537|128,o):null;case 5:return Td(o),null;case 13:if(qe(ot),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(a(340));_o()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return qe(ot),null;case 4:return Po(),null;case 10:return wd(o.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var xa=!1,bt=!1,h4=typeof WeakSet=="function"?WeakSet:Set,ue=null;function No(i,o){var u=i.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(h){nt(i,o,h)}else u.current=null}function Yd(i,o,u){try{u()}catch(h){nt(i,o,h)}}var Lp=!1;function f4(i,o){for(j(i.containerInfo),ue=o;ue!==null;)if(i=ue,o=i.child,(i.subtreeFlags&1028)!==0&&o!==null)o.return=i,ue=o;else for(;ue!==null;){i=ue;try{var u=i.alternate;if(i.flags&1024)switch(i.tag){case 0:case 11:case 15:break;case 1:if(u!==null){var h=u.memoizedProps,f=u.memoizedState,m=i.stateNode,T=m.getSnapshotBeforeUpdate(i.elementType===i.type?h:Bn(i.type,h),f);m.__reactInternalSnapshotBeforeUpdate=T}break;case 3:Ce&&p3(i.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(A){nt(i,i.return,A)}if(o=i.sibling,o!==null){o.return=i.return,ue=o;break}ue=i.return}return u=Lp,Lp=!1,u}function As(i,o,u){var h=o.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var f=h=h.next;do{if((f.tag&i)===i){var m=f.destroy;f.destroy=void 0,m!==void 0&&Yd(o,u,m)}f=f.next}while(f!==h)}}function Sa(i,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&i)===i){var h=u.create;u.destroy=h()}u=u.next}while(u!==o)}}function Qd(i){var o=i.ref;if(o!==null){var u=i.stateNode;switch(i.tag){case 5:i=we(u);break;default:i=u}typeof o=="function"?o(i):o.current=i}}function Ip(i){var o=i.alternate;o!==null&&(i.alternate=null,Ip(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&V(o)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function zp(i){return i.tag===5||i.tag===3||i.tag===4}function Dp(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||zp(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function $d(i,o,u){var h=i.tag;if(h===5||h===6)i=i.stateNode,o?_s(u,i,o):yr(u,i);else if(h!==4&&(i=i.child,i!==null))for($d(i,o,u),i=i.sibling;i!==null;)$d(i,o,u),i=i.sibling}function qd(i,o,u){var h=i.tag;if(h===5||h===6)i=i.stateNode,o?Ss(u,i,o):er(u,i);else if(h!==4&&(i=i.child,i!==null))for(qd(i,o,u),i=i.sibling;i!==null;)qd(i,o,u),i=i.sibling}var At=null,jn=!1;function lr(i,o,u){for(u=u.child;u!==null;)Zd(i,o,u),u=u.sibling}function Zd(i,o,u){if(tr&&typeof tr.onCommitFiberUnmount=="function")try{tr.onCommitFiberUnmount(ql,u)}catch{}switch(u.tag){case 5:bt||No(u,o);case 6:if(Ce){var h=At,f=jn;At=null,lr(i,o,u),At=h,jn=f,At!==null&&(jn?c3(At,u.stateNode):u3(At,u.stateNode))}else lr(i,o,u);break;case 18:Ce&&At!==null&&(jn?I3(At,u.stateNode):L3(At,u.stateNode));break;case 4:Ce?(h=At,f=jn,At=u.stateNode.containerInfo,jn=!0,lr(i,o,u),At=h,jn=f):(Be&&(h=u.stateNode.containerInfo,f=vg(h),nd(h,f)),lr(i,o,u));break;case 0:case 11:case 14:case 15:if(!bt&&(h=u.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){f=h=h.next;do{var m=f,T=m.destroy;m=m.tag,T!==void 0&&(m&2||m&4)&&Yd(u,o,T),f=f.next}while(f!==h)}lr(i,o,u);break;case 1:if(!bt&&(No(u,o),h=u.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=u.memoizedProps,h.state=u.memoizedState,h.componentWillUnmount()}catch(A){nt(u,o,A)}lr(i,o,u);break;case 21:lr(i,o,u);break;case 22:u.mode&1?(bt=(h=bt)||u.memoizedState!==null,lr(i,o,u),bt=h):lr(i,o,u);break;default:lr(i,o,u)}}function Ap(i){var o=i.updateQueue;if(o!==null){i.updateQueue=null;var u=i.stateNode;u===null&&(u=i.stateNode=new h4),o.forEach(function(h){var f=w4.bind(null,i,h);u.has(h)||(u.add(h),h.then(f,f))})}}function Vn(i,o){var u=o.deletions;if(u!==null)for(var h=0;h";case wa:return":has("+(th(i)||"")+")";case Ca:return'[role="'+i.value+'"]';case Ea:return'"'+i.value+'"';case ka:return'[data-testname="'+i.value+'"]';default:throw Error(a(365))}}function jp(i,o){var u=[];i=[i,0];for(var h=0;hf&&(f=T),h&=~m}if(h=f,h=Ft()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*p4(h/1960))-h,10i?16:i,$r===null)var h=!1;else{if(i=$r,$r=null,Fa=0,Fe&6)throw Error(a(331));var f=Fe;for(Fe|=4,ue=i.current;ue!==null;){var m=ue,T=m.child;if(ue.flags&16){var A=m.deletions;if(A!==null){for(var B=0;BFt()-oh?Hi(i,0):ih|=u),an(i,o)}function qp(i,o){o===0&&(i.mode&1?(o=Ql,Ql<<=1,!(Ql&130023424)&&(Ql=4194304)):o=1);var u=Wt();i=rr(i,o),i!==null&&(ks(i,o,u),an(i,u))}function _4(i){var o=i.memoizedState,u=0;o!==null&&(u=o.retryLane),qp(i,u)}function w4(i,o){var u=0;switch(i.tag){case 13:var h=i.stateNode,f=i.memoizedState;f!==null&&(u=f.retryLane);break;case 19:h=i.stateNode;break;default:throw Error(a(314))}h!==null&&h.delete(o),qp(i,u)}var Zp;Zp=function(i,o,u){if(i!==null)if(i.memoizedProps!==o.pendingProps||rn.current)sn=!0;else{if(!(i.lanes&u)&&!(o.flags&128))return sn=!1,u4(i,o,u);sn=!!(i.flags&131072)}else sn=!1,tt&&o.flags&1048576&&Fg(o,ea,o.index);switch(o.lanes=0,o.tag){case 2:var h=o.type;ma(i,o),i=o.pendingProps;var f=vo(o,Bt.current);ko(o,u),f=Ld(null,o,h,i,f,u);var m=Id();return o.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,on(h)?(m=!0,Xl(o)):m=!1,o.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Ed(o),f.updater=ga,o.stateNode=f,f._reactInternals=o,Ud(o,h,i,u),o=Vd(null,o,h,!0,m,u)):(o.tag=0,tt&&m&&pd(o),qt(null,o,f,u),o=o.child),o;case 16:h=o.elementType;e:{switch(ma(i,o),i=o.pendingProps,f=h._init,h=f(h._payload),o.type=h,f=o.tag=k4(h),i=Bn(h,i),f){case 0:o=jd(null,o,h,i,u);break e;case 1:o=kp(null,o,h,i,u);break e;case 11:o=xp(null,o,h,i,u);break e;case 14:o=Sp(null,o,h,Bn(h.type,i),u);break e}throw Error(a(306,h,""))}return o;case 0:return h=o.type,f=o.pendingProps,f=o.elementType===h?f:Bn(h,f),jd(i,o,h,f,u);case 1:return h=o.type,f=o.pendingProps,f=o.elementType===h?f:Bn(h,f),kp(i,o,h,f,u);case 3:e:{if(Ep(o),i===null)throw Error(a(387));h=o.pendingProps,m=o.memoizedState,f=m.element,Gg(i,o),la(o,h,null,u);var T=o.memoizedState;if(h=T.element,be&&m.isDehydrated)if(m={element:h,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=m,o.memoizedState=m,o.flags&256){f=To(Error(a(423)),o),o=Pp(i,o,h,u,f);break e}else if(h!==f){f=To(Error(a(424)),o),o=Pp(i,o,h,u,f);break e}else for(be&&(En=k3(o.stateNode.containerInfo),pn=o,tt=!0,Gn=null,Es=!1),u=Og(o,null,h,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(_o(),h===f){o=kr(i,o,u);break e}qt(i,o,h,u)}o=o.child}return o;case 5:return Vg(o),i===null&&vd(o),h=o.type,f=o.pendingProps,m=i!==null?i.memoizedProps:null,T=f.children,mt(h,f)?T=null:m!==null&&mt(h,m)&&(o.flags|=32),Cp(i,o),qt(i,o,T,u),o.child;case 6:return i===null&&vd(o),null;case 13:return Tp(i,o,u);case 4:return Pd(o,o.stateNode.containerInfo),h=o.pendingProps,i===null?o.child=wo(o,null,h,u):qt(i,o,h,u),o.child;case 11:return h=o.type,f=o.pendingProps,f=o.elementType===h?f:Bn(h,f),xp(i,o,h,f,u);case 7:return qt(i,o,o.pendingProps,u),o.child;case 8:return qt(i,o,o.pendingProps.children,u),o.child;case 12:return qt(i,o,o.pendingProps.children,u),o.child;case 10:e:{if(h=o.type._context,f=o.pendingProps,m=o.memoizedProps,T=f.value,Hg(o,h,T),m!==null)if(Un(m.value,T)){if(m.children===f.children&&!rn.current){o=kr(i,o,u);break e}}else for(m=o.child,m!==null&&(m.return=o);m!==null;){var A=m.dependencies;if(A!==null){T=m.child;for(var B=A.firstContext;B!==null;){if(B.context===h){if(m.tag===1){B=Cr(-1,u&-u),B.tag=2;var te=m.updateQueue;if(te!==null){te=te.shared;var he=te.pending;he===null?B.next=B:(B.next=he.next,he.next=B),te.pending=B}}m.lanes|=u,B=m.alternate,B!==null&&(B.lanes|=u),Cd(m.return,u,o),A.lanes|=u;break}B=B.next}}else if(m.tag===10)T=m.type===o.type?null:m.child;else if(m.tag===18){if(T=m.return,T===null)throw Error(a(341));T.lanes|=u,A=T.alternate,A!==null&&(A.lanes|=u),Cd(T,u,o),T=m.sibling}else T=m.child;if(T!==null)T.return=m;else for(T=m;T!==null;){if(T===o){T=null;break}if(m=T.sibling,m!==null){m.return=T.return,T=m;break}T=T.return}m=T}qt(i,o,f.children,u),o=o.child}return o;case 9:return f=o.type,h=o.pendingProps.children,ko(o,u),f=Pn(f),h=h(f),o.flags|=1,qt(i,o,h,u),o.child;case 14:return h=o.type,f=Bn(h,o.pendingProps),f=Bn(h.type,f),Sp(i,o,h,f,u);case 15:return _p(i,o,o.type,o.pendingProps,u);case 17:return h=o.type,f=o.pendingProps,f=o.elementType===h?f:Bn(h,f),ma(i,o),o.tag=1,on(h)?(i=!0,Xl(o)):i=!1,ko(o,u),hp(o,h,f),Ud(o,h,f,u),Vd(null,o,h,!0,i,u);case 19:return Rp(i,o,u);case 22:return wp(i,o,u)}throw Error(a(156,o.tag))};function Jp(i,o){return dd(i,o)}function C4(i,o,u,h){this.tag=i,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fn(i,o,u,h){return new C4(i,o,u,h)}function fh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function k4(i){if(typeof i=="function")return fh(i)?1:0;if(i!=null){if(i=i.$$typeof,i===E)return 11;if(i===C)return 14}return 2}function Jr(i,o){var u=i.alternate;return u===null?(u=Fn(i.tag,o,i.key,i.mode),u.elementType=i.elementType,u.type=i.type,u.stateNode=i.stateNode,u.alternate=i,i.alternate=u):(u.pendingProps=o,u.type=i.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=i.flags&14680064,u.childLanes=i.childLanes,u.lanes=i.lanes,u.child=i.child,u.memoizedProps=i.memoizedProps,u.memoizedState=i.memoizedState,u.updateQueue=i.updateQueue,o=i.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=i.sibling,u.index=i.index,u.ref=i.ref,u}function za(i,o,u,h,f,m){var T=2;if(h=i,typeof i=="function")fh(i)&&(T=1);else if(typeof i=="string")T=5;else e:switch(i){case y:return Bi(u.children,f,m,o);case w:T=8,f|=8;break;case x:return i=Fn(12,u,o,f|2),i.elementType=x,i.lanes=m,i;case P:return i=Fn(13,u,o,f),i.elementType=P,i.lanes=m,i;case k:return i=Fn(19,u,o,f),i.elementType=k,i.lanes=m,i;case S:return Da(u,f,m,o);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case _:T=10;break e;case v:T=9;break e;case E:T=11;break e;case C:T=14;break e;case p:T=16,h=null;break e}throw Error(a(130,i==null?i:typeof i,""))}return o=Fn(T,u,o,f),o.elementType=i,o.type=h,o.lanes=m,o}function Bi(i,o,u,h){return i=Fn(7,i,h,o),i.lanes=u,i}function Da(i,o,u,h){return i=Fn(22,i,h,o),i.elementType=S,i.lanes=u,i.stateNode={isHidden:!1},i}function gh(i,o,u){return i=Fn(6,i,null,o),i.lanes=u,i}function ph(i,o,u){return o=Fn(4,i.children!==null?i.children:[],i.key,o),o.lanes=u,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}function E4(i,o,u,h,f){this.tag=o,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=pe,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ud(0),this.expirationTimes=ud(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ud(0),this.identifierPrefix=h,this.onRecoverableError=f,be&&(this.mutableSourceEagerHydrationData=null)}function e1(i,o,u,h,f,m,T,A,B){return i=new E4(i,o,u,A,B),o===1?(o=1,m===!0&&(o|=8)):o=0,m=Fn(3,null,null,o),i.current=m,m.stateNode=i,m.memoizedState={element:h,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ed(m),i}function t1(i){if(!i)return Kr;i=i._reactInternals;e:{if(I(i)!==i||i.tag!==1)throw Error(a(170));var o=i;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(on(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(a(171))}if(i.tag===1){var u=i.type;if(on(u))return kg(i,u,o)}return o}function n1(i){var o=i._reactInternals;if(o===void 0)throw typeof i.render=="function"?Error(a(188)):(i=Object.keys(i).join(","),Error(a(268,i)));return i=W(o),i===null?null:i.stateNode}function r1(i,o){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var u=i.retryLane;i.retryLane=u!==0&&u=te&&m>=Ee&&f<=he&&T<=oe){i.splice(o,1);break}else if(h!==te||u.width!==B.width||oeT){if(!(m!==Ee||u.height!==B.height||hef)){te>h&&(B.width+=te-h,B.x=h),hem&&(B.height+=Ee-m,B.y=m),oeu&&(u=T)),T ")+` No matching component was found for: `)+i.join(" > ")}return null},n.getPublicRootInstance=function(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return we(i.child.stateNode);default:return i.child.stateNode}},n.injectIntoDevTools=function(i){if(i={bundleType:i.bundleType,version:i.version,rendererPackageName:i.rendererPackageName,rendererConfig:i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:P4,findFiberByHostInstance:i.findFiberByHostInstance||T4,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")i=!1;else{var o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(o.isDisabled||!o.supportsFiber)i=!0;else{try{ql=o.inject(i),tr=o}catch{}i=!!o.checkDCE}}return i},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(i,o,u,h){if(!Z)throw Error(a(363));i=nh(i,o);var f=Rt(i,u,h).disconnect;return{disconnect:function(){f()}}},n.registerMutableSourceForHydration=function(i,o){var u=o._getVersion;u=u(o._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[o,u]:i.mutableSourceEagerHydrationData.push(o,u)},n.runWithPriority=function(i,o){var u=He;try{return He=i,o()}finally{He=u}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(i,o,u,h){var f=o.current,m=Wt(),T=qr(f);return u=t1(u),o.context===null?o.context=u:o.pendingContext=u,o=Cr(m,T),o.payload={element:i},h=h===void 0?null:h,h!==null&&(o.callback=h),i=Yr(f,o,T),i!==null&&(Rn(i,f,T,m),sa(i,f,T)),T},n};J5.exports=ES;var PS=J5.exports;const TS=zl(PS);var e3={exports:{}},mo={};/** * @license React * react-reconciler-constants.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */mo.ConcurrentRoot=1;mo.ContinuousEventPriority=4;mo.DefaultEventPriority=16;mo.DiscreteEventPriority=1;mo.IdleEventPriority=536870912;mo.LegacyRoot=0;e3.exports=mo;var t3=e3.exports;const $2={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let q2=!1,Z2=!1;const pg=".react-konva-event",NS=`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 `,RS=`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 `,FS={};function td(t,e,n=FS){if(!q2&&"zIndex"in e&&(console.warn(RS),q2=!0),!Z2&&e.draggable){var r=e.x!==void 0||e.y!==void 0,s=e.onDragEnd||e.onDragMove;r&&!s&&(console.warn(NS),Z2=!0)}for(var l in n)if(!$2[l]){var a=l.slice(0,2)==="on",c=n[l]!==e[l];if(a&&c){var d=l.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t.off(d,n[l])}var g=!e.hasOwnProperty(l);g&&t.setAttr(l,void 0)}var y=e._useStrictMode,w={},x=!1;const _={};for(var l in e)if(!$2[l]){var a=l.slice(0,2)==="on",v=n[l]!==e[l];if(a&&v){var d=l.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e[l]&&(_[d]=e[l])}!a&&(e[l]!==n[l]||y&&e[l]!==t.getAttr(l))&&(x=!0,w[l]=e[l])}x&&(t.setAttrs(w),Fi(t));for(var d in _)t.on(d+pg,_[d])}function Fi(t){if(!Re.Konva.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}const n3={},MS={};Il.Node.prototype._applyProps=td;function LS(t,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}t.add(e),Fi(t)}function IS(t,e,n){let r=Il[t];r||(console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=Il.Group);const s={},l={};for(var a in e){var c=a.slice(0,2)==="on";c?l[a]=e[a]:s[a]=e[a]}const d=new r(s);return td(d,l),d}function zS(t,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function DS(t,e,n){return!1}function AS(t){return t}function OS(){return null}function HS(){return null}function US(t,e,n,r){return MS}function GS(){}function BS(t){}function jS(t,e){return!1}function VS(){return n3}function bS(){return n3}const WS=setTimeout,KS=clearTimeout,XS=-1;function YS(t,e){return!1}const QS=!1,$S=!0,qS=!0;function ZS(t,e){e.parent===t?e.moveToTop():t.add(e),Fi(t)}function JS(t,e){e.parent===t?e.moveToTop():t.add(e),Fi(t)}function r3(t,e,n){e._remove(),t.add(e),e.setZIndex(n.getZIndex()),Fi(t)}function e_(t,e,n){r3(t,e,n)}function t_(t,e){e.destroy(),e.off(pg),Fi(t)}function n_(t,e){e.destroy(),e.off(pg),Fi(t)}function r_(t,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function i_(t,e,n){}function o_(t,e,n,r,s){td(t,s,r)}function s_(t){t.hide(),Fi(t)}function l_(t){}function a_(t,e){(e.visible==null||e.visible)&&t.show()}function u_(t,e){}function c_(t){}function d_(){}const h_=()=>t3.DefaultEventPriority,f_=Object.freeze(Object.defineProperty({__proto__:null,appendChild:ZS,appendChildToContainer:JS,appendInitialChild:LS,cancelTimeout:KS,clearContainer:c_,commitMount:i_,commitTextUpdate:r_,commitUpdate:o_,createInstance:IS,createTextInstance:zS,detachDeletedInstance:d_,finalizeInitialChildren:DS,getChildHostContext:bS,getCurrentEventPriority:h_,getPublicInstance:AS,getRootHostContext:VS,hideInstance:s_,hideTextInstance:l_,idlePriority:il.unstable_IdlePriority,insertBefore:r3,insertInContainerBefore:e_,isPrimaryRenderer:QS,noTimeout:XS,now:il.unstable_now,prepareForCommit:OS,preparePortalMount:HS,prepareUpdate:US,removeChild:t_,removeChildFromContainer:n_,resetAfterCommit:GS,resetTextContent:BS,run:il.unstable_runWithPriority,scheduleTimeout:WS,shouldDeprioritizeSubtree:jS,shouldSetTextContent:YS,supportsMutation:qS,unhideInstance:a_,unhideTextInstance:u_,warnsIfNotActing:$S},Symbol.toStringTag,{value:"Module"}));var g_=Object.defineProperty,p_=Object.defineProperties,m_=Object.getOwnPropertyDescriptors,J2=Object.getOwnPropertySymbols,y_=Object.prototype.hasOwnProperty,v_=Object.prototype.propertyIsEnumerable,em=(t,e,n)=>e in t?g_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,tm=(t,e)=>{for(var n in e||(e={}))y_.call(e,n)&&em(t,n,e[n]);if(J2)for(var n of J2(e))v_.call(e,n)&&em(t,n,e[n]);return t},x_=(t,e)=>p_(t,m_(e)),nm,rm;typeof window<"u"&&((nm=window.document)!=null&&nm.createElement||((rm=window.navigator)==null?void 0:rm.product)==="ReactNative")?Q.useLayoutEffect:Q.useEffect;function i3(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const s=i3(r,e,n);if(s)return s;r=r.sibling}}function o3(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const im=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=im;return}return im.apply(this,arguments)};const mg=o3(Q.createContext(null));class s3 extends Q.Component{render(){return Q.createElement(mg.Provider,{value:this._reactInternals},this.props.children)}}function S_(){const t=Q.useContext(mg);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=Q.useId();return Q.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const s=i3(r,!1,l=>{let a=l.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(s)return s}},[t,e])}function __(){const t=S_(),[e]=Q.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const s=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;s&&s!==mg&&!e.has(s)&&e.set(s,Q.useContext(o3(s)))}n=n.return}return e}function w_(){const t=__();return Q.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>Q.createElement(e,null,Q.createElement(n.Provider,x_(tm({},r),{value:t.get(n)}))),e=>Q.createElement(s3,tm({},e))),[t])}function C_(t){const e=Jt.useRef({});return Jt.useLayoutEffect(()=>{e.current=t}),Jt.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const k_=t=>{const e=Jt.useRef(null),n=Jt.useRef(null),r=Jt.useRef(null),s=C_(t),l=w_(),a=c=>{const{forwardedRef:d}=t;d&&(typeof d=="function"?d(c):d.current=c)};return Jt.useLayoutEffect(()=>(n.current=new Il.Stage({width:t.width,height:t.height,container:e.current}),a(n.current),r.current=nl.createContainer(n.current,t3.LegacyRoot,!1,null),nl.updateContainer(Jt.createElement(l,{},t.children),r.current),()=>{Il.isBrowser&&(a(null),nl.updateContainer(null,r.current,null),n.current.destroy())}),[]),Jt.useLayoutEffect(()=>{a(n.current),td(n.current,t,s),nl.updateContainer(Jt.createElement(l,{},t.children),r.current,null)}),Jt.createElement("div",{ref:e,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},E_="Layer",Xi="Rect",l3="Image",P_="Text",T_="Transformer",nl=TS(f_);nl.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:Jt.version,rendererPackageName:"react-konva"});const N_=Jt.forwardRef((t,e)=>Jt.createElement(s3,{},Jt.createElement(k_,{...t,forwardedRef:e}))),R_={"1200x675":{width:1200,height:675,label:"1200×675"},linkedin:{width:1200,height:627,label:"LinkedIn"},hf:{width:1280,height:720,label:"HF Custom"}};function rl(t){return R_[t]}function a3(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function r0(t){return[...t].sort((e,n)=>e.zIndex-n.zIndex)}function i0(t){return t.length===0?1:Math.max(...t.map(e=>e.zIndex))+1}function F_({object:t,isSelected:e,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onEditingChange:c,onMouseEnter:d,onMouseLeave:g,shapeRef:y}){const w=Q.useRef(null);Q.useEffect(()=>{if(t.text===""&&e&&!t.isFixedSize&&!t.isEditing){const E=setTimeout(()=>{c(t.id,!0)},100);return()=>clearTimeout(E)}},[t.text,e,t.isFixedSize,t.isEditing,t.id,c]);const x=E=>{if(!t.isEditing){const P=E.target.getStage(),k=P==null?void 0:P.getPointerPosition();if(k){const C=k.x-t.x,p=k.y-t.y;c(t.id,!0,C,p)}else c(t.id,!0)}},_=()=>{if(!t.isFixedSize||!t.text)return t.fontSize;try{const E=new Ir.Text({text:t.text||"M",fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:`${t.bold?"bold":"normal"} ${t.italic?"italic":""}`,width:t.width,height:t.height});let P=t.fontSize;const k=t.width,C=t.height;for(;P>10;){E.fontSize(P);const p=E.measureSize(t.text||"M");if(p.width<=k&&p.height<=C)break;P-=1}return E.destroy(),P}catch(E){return console.error("Error calculating fit font size:",E),t.fontSize}},v=t.isFixedSize?_():t.fontSize;return z.jsx(P_,{id:t.id,ref:E=>{typeof y=="function"?y(E):y&&(y.current=E),w.current=E},x:t.x,y:t.y,width:t.width,height:t.height,offsetX:t.offsetX||0,offsetY:t.offsetY||0,text:t.text,fontSize:v,fontFamily:t.fontFamily,fill:t.fill,fontStyle:`${t.bold?"bold":"normal"} ${t.italic?"italic":""}`,align:t.align||"left",verticalAlign:"top",rotation:t.rotation,padding:0,lineHeight:1,draggable:!0,onClick:E=>n(E),onTap:E=>n(E),onDblClick:x,onDblTap:x,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onMouseEnter:d,onMouseLeave:g,opacity:t.isEditing?0:1,listening:!t.isEditing})}function M_({object:t,isSelected:e,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onEditingChange:c,onMouseEnter:d,onMouseLeave:g,shapeRef:y}){switch(t.type){case"rect":return z.jsx(Xi,{id:t.id,ref:w=>{typeof y=="function"?y(w):y&&(y.current=w)},x:t.x,y:t.y,width:t.width,height:t.height,fill:t.fill,stroke:t.stroke,strokeWidth:t.strokeWidth,rotation:t.rotation,draggable:!0,onClick:w=>n(w),onTap:w=>n(w),onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onMouseEnter:d,onMouseLeave:g});case"image":case"huggy":return z.jsx(L_,{object:t,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onMouseEnter:d,onMouseLeave:g,shapeRef:y});case"text":return z.jsx(F_,{object:t,isSelected:e,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onEditingChange:c||(()=>{}),onMouseEnter:d,onMouseLeave:g,shapeRef:y});case"logoPlaceholder":return z.jsx(I_,{object:t,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onMouseEnter:d,onMouseLeave:g,shapeRef:y});default:return null}}function L_({object:t,onSelect:e,onDragStart:n,onDragMove:r,onDragEnd:s,onTransformEnd:l,onMouseEnter:a,onMouseLeave:c,shapeRef:d}){const[g,y]=Q.useState(null),w=Q.useRef(null),x=Q.useRef(null);return Q.useEffect(()=>{const _=new window.Image;return _.src=t.type==="image"||t.type==="huggy"?t.src:"",_.crossOrigin="anonymous",_.onload=()=>{y(_),w.current=_,setTimeout(()=>{if(x.current){const v=x.current.getLayer();v&&v.batchDraw()}},10)},()=>{w.current=null}},[t]),g?z.jsx(l3,{id:t.id,ref:_=>{x.current=_,console.log("ImageRenderer ref callback:",t.id,"Node:",_),typeof d=="function"?d(_):d&&(d.current=_)},x:t.x,y:t.y,width:t.width,height:t.height,image:g,rotation:t.rotation,draggable:!0,onClick:_=>e(_),onTap:_=>e(_),onDragStart:n,onDragMove:r,onDragEnd:s,onTransformEnd:l,onMouseEnter:a,onMouseLeave:c}):null}function I_({object:t,onSelect:e,onDragStart:n,onDragMove:r,onDragEnd:s,onTransformEnd:l,onMouseEnter:a,onMouseLeave:c,shapeRef:d}){const g=Q.useRef(null);return Q.useEffect(()=>{g.current&&t.type==="logoPlaceholder"&&(g.current.cache(),g.current.filters([Ir.Filters.Blur]),g.current.blurRadius(t.blurRadius))},[t]),t.type!=="logoPlaceholder"?null:z.jsx(Xi,{id:t.id,ref:y=>{g.current=y,typeof d=="function"?d(y):d&&(d.current=y)},x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgba(255, 255, 255, 0.3)",stroke:"rgba(200, 200, 200, 0.5)",strokeWidth:2,rotation:t.rotation,draggable:!0,onClick:y=>e(y),onTap:y=>e(y),onDragStart:n,onDragMove:r,onDragEnd:s,onTransformEnd:l,onMouseEnter:a,onMouseLeave:c})}var Vi=Q,z_=function(e,n,r){const s=Vi.useRef("loading"),l=Vi.useRef(),[a,c]=Vi.useState(0),d=Vi.useRef(),g=Vi.useRef(),y=Vi.useRef();return(d.current!==e||g.current!==n||y.current!==r)&&(s.current="loading",l.current=void 0,d.current=e,g.current=n,y.current=r),Vi.useLayoutEffect(function(){if(!e)return;var w=document.createElement("img");function x(){w.decode().catch(()=>{}).finally(()=>{s.current="loaded",l.current=w,c(Math.random())})}function _(){s.current="failed",l.current=void 0,c(Math.random())}return w.addEventListener("load",x),w.addEventListener("error",_),n&&(w.crossOrigin=n),r&&(w.referrerPolicy=r),w.src=e,function(){w.removeEventListener("load",x),w.removeEventListener("error",_)}},[e,n,r]),[l.current,s.current]};const D_=zl(z_);function A_(t,e,n,r,s,l){if(!t||e<=0)return 0;try{const a=new Ir.Text({text:t,fontSize:n,fontFamily:r,fontStyle:`${s?"bold":"normal"} ${l?"italic":""}`});let c=0,d=1/0;for(let g=0;g<=t.length;g++){const y=t.substring(0,g);a.text(y);const w=a.width(),x=Math.abs(w-e);x{(async()=>{if(document.fonts)try{if(await Promise.all([document.fonts.load("bold 100px Bison"),document.fonts.load("bold 100px Inter"),document.fonts.load('400 50px "IBM Plex Mono"')]),await document.fonts.ready,await new Promise(K=>setTimeout(K,50)),p(!0),x.current){const K=x.current.getLayers()[0];K&&K.batchDraw()}}catch(K){console.error("Font loading error:",K),p(!0)}else p(!0)})()},[]),Q.useEffect(()=>{if(C&&x.current){const V=x.current.getLayers()[0];V&&V.batchDraw()}},[n,C]);const j=n.find(V=>V.type==="text"&&V.isEditing),Y=r0(n);Q.useEffect(()=>{if(!v.current)return;const V=(K=0)=>{if(r.length>0){const X=r.map(Z=>E.current.get(Z)).filter(Z=>Z!==void 0);if(console.log(`Attempt ${K}: Attaching transformer to:`,r,"Found nodes:",X.length),X.length>0){console.log("SUCCESS: Attaching transformer to",X.length,"nodes"),v.current.nodes(X),v.current.show(),v.current.forceUpdate();const Z=v.current.getLayer();Z&&Z.batchDraw(),console.log("Transformer attached and layer redrawn")}else if(K<10){const Z=Math.min(50*(K+1),100);setTimeout(()=>V(K+1),Z)}else console.error("Failed to attach transformer after 10 attempts. Selected IDs:",r)}else v.current.nodes([])};V(0)},[r,n]);const ne=(V,K=!1)=>{K?r.includes(V)?s(r.filter(X=>X!==V)):s([...r,V]):s([V])},de=Q.useRef(null),ze=V=>{const K=V.target;de.current={x:K.x(),y:K.y()}},pt=V=>{const K=V.target,X=V.evt.shiftKey;if(X&&de.current){const Z=de.current,me=K.x(),ae=K.y(),le=Math.abs(me-Z.x),ye=Math.abs(ae-Z.y);le>ye?K.y(Z.y):K.x(Z.x)}if(!X){const me=ie.width/2,ae=ie.height/2,le=K.width(),ye=K.height(),xe=K.x(),dt=K.y(),Rt=K.attrs.offsetX||0,er=K.attrs.offsetY||0,yr=xe+le/2-Rt,vr=dt+ye/2-er;let Mi=xe,xr=dt,Ss=!1,_s=!1;Math.abs(yr-me)<10&&(Mi=me-le/2+Rt,Ss=!0),Math.abs(vr-ae)<10&&(xr=ae-ye/2+er,_s=!0),Ss||_s?(K.x(Mi),K.y(xr),$({vertical:Ss,horizontal:_s})):$({vertical:!1,horizontal:!1})}},mt=V=>K=>{const X=K.target;de.current=null,$({vertical:!1,horizontal:!1});const Z=n.map(me=>me.id===V?{...me,x:X.x(),y:X.y()}:me);l(Z)},Ve=V=>K=>{const X=K.target,Z=X.scaleX(),me=X.scaleY();if(r.length>1)L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{const le=n.map(ye=>{if(r.includes(ye.id)){const xe=E.current.get(ye.id);if(xe){const dt=xe.scaleX(),Rt=xe.scaleY();xe.scaleX(1),xe.scaleY(1);const er={...ye,x:xe.x(),y:xe.y(),width:Math.max(5,xe.width()*dt),height:Math.max(5,xe.height()*Rt),rotation:xe.rotation()};if(ye.type==="text"){const yr=Math.min(dt,Rt),vr=Math.max(10,ye.fontSize*yr);return{...er,fontSize:vr,isFixedSize:!0}}return er}}return ye});l(le),L.current=null},10);else{X.scaleX(1),X.scaleY(1);const le=n.map(ye=>{if(ye.id===V){const xe={...ye,x:X.x(),y:X.y(),width:Math.max(5,X.width()*Z),height:Math.max(5,X.height()*me),rotation:X.rotation()};if(ye.type==="text"){const dt=Math.min(Z,me),Rt=Math.max(10,ye.fontSize*dt);return{...xe,fontSize:Rt,isFixedSize:!0}}return xe}return ye});l(le)}},D=(V,K,X,Z)=>{const me=n.map(ae=>ae.id===V&&ae.type==="text"?{...ae,text:K,width:X,height:Z}:ae);l(me)},q=(V,K,X,Z)=>{if(!K){const ae=n.find(le=>le.id===V&&le.type==="text");if(ae&&ae.text.trim()===""){const le=n.filter(ye=>ye.id!==V);l(le);return}}const me=n.map(ae=>ae.id===V&&ae.type==="text"?{...ae,isEditing:K,isFixedSize:K?ae.isFixedSize:!0}:ae);if(l(me),K&&X!==void 0&&Z!==void 0){const ae=n.find(le=>le.id===V&&le.type==="text");if(ae){const le=A_(ae.text,X,ae.fontSize,ae.fontFamily,ae.bold,ae.italic);k.current=le}}else K&&(k.current=null)};Q.useEffect(()=>{if(j&&P.current)if(P.current.focus(),k.current!==null){const V=k.current;P.current.setSelectionRange(V,V),k.current=null}else{const V=P.current.value.length;P.current.setSelectionRange(V,V)}},[j==null?void 0:j.id]);const pe=V=>{if(!j)return;const K=V.target.value;try{const X=new Ir.Text({text:K||"M",fontSize:j.fontSize,fontFamily:j.fontFamily,fontStyle:`${j.bold?"bold":"normal"} ${j.italic?"italic":""}`}),Z=Math.max(100,X.width()+20),me=Math.max(40,X.height()+10);X.destroy(),D(j.id,K,Z,me)}catch(X){console.error("Error in textarea change:",X),D(j.id,K,j.width,j.height)}},Ae=()=>{j&&q(j.id,!1)},Be=j?(()=>{if(!j||!x.current)return{top:0,left:0};const X=x.current.container().getBoundingClientRect(),Z=j.offsetX||0,me=j.offsetY||0;return{top:X.top+j.y-me,left:X.left+j.x-Z}})():{top:0,left:0},be=V=>{if(!V.isFixedSize||!V.text)return V.fontSize;try{const K=new Ir.Text({text:V.text,fontSize:V.fontSize,fontFamily:V.fontFamily,fontStyle:`${V.bold?"bold":"normal"} ${V.italic?"italic":""}`,width:V.width,height:V.height});let X=V.fontSize;const Z=V.width,me=V.height;for(;X>10;){K.fontSize(X);const ae=K.measureSize(V.text);if(ae.width<=Z&&ae.height<=me)break;X-=1}return K.destroy(),X}catch{return V.fontSize}},fe=V=>{if(V.target!==V.target.getStage()||a)return;const K=V.target.getStage(),X=K==null?void 0:K.getPointerPosition();X&&(F.current=X,R({x:X.x,y:X.y,width:0,height:0}))},J=V=>{if(!F.current)return;const K=V.target.getStage(),X=K==null?void 0:K.getPointerPosition();if(X){const Z=F.current;R({x:Math.min(Z.x,X.x),y:Math.min(Z.y,X.y),width:Math.abs(X.x-Z.x),height:Math.abs(X.y-Z.y)})}},ge=V=>{if(!F.current)return;if(S&&(S.width>5||S.height>5)){const X=[];n.forEach(Z=>{const me={x:Z.x,y:Z.y,width:Z.width,height:Z.height};!(S.x>me.x+me.width||S.x+S.widthme.y+me.height||S.y+S.height0?s(X):s([])}else V.target===V.target.getStage()&&s([]);F.current=null,R(null)};return z.jsxs("div",{onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),style:{width:ie.width,height:ie.height,backgroundImage:H?`url(${Te})`:"none",backgroundColor:H?"transparent":"#ffffff",backgroundSize:"cover",backgroundPosition:"center",border:"1px solid #EBEBEB",borderRadius:M?"0px":"10px",boxShadow:"0 4px 6px -2px rgba(5, 32, 81, 0.04), 0 12px 16px -4px rgba(5, 32, 81, 0.09)",overflow:"hidden",transition:"width 0.15s ease-in-out, height 0.15s ease-in-out, border-radius 0.15s ease-in-out"},children:[z.jsx(N_,{ref:x,width:ie.width,height:ie.height,onMouseDown:fe,onMouseMove:J,onMouseUp:ge,onClick:V=>{if(V.target===V.target.getStage()&&a&&c){const K=V.target.getStage(),X=K==null?void 0:K.getPointerPosition();X&&c(X.x,X.y)}},style:{cursor:a?"text":"default"},children:z.jsxs(E_,{children:[H?z.jsx(l3,{x:0,y:0,width:ie.width,height:ie.height,image:H,listening:!1}):z.jsx(Xi,{x:0,y:0,width:ie.width,height:ie.height,fill:"#ffffff",listening:!1}),Y.map(V=>z.jsx(M_,{object:V,isSelected:r.includes(V.id),onSelect:K=>{var Z;const X=((Z=K==null?void 0:K.evt)==null?void 0:Z.shiftKey)||!1;ne(V.id,X)},onDragStart:ze,onDragMove:pt,onDragEnd:mt(V.id),onTransformEnd:Ve(V.id),onEditingChange:q,onMouseEnter:()=>I(V.id),onMouseLeave:()=>I(null),shapeRef:K=>{K?E.current.set(V.id,K):E.current.delete(V.id)}},V.id)),S&&z.jsx(Xi,{x:S.x,y:S.y,width:S.width,height:S.height,fill:"rgba(63, 174, 230, 0.1)",stroke:"#3faee6",strokeWidth:1,dash:[5,5],listening:!1}),W.vertical&&z.jsx(Xi,{x:ie.width/2,y:0,width:1,height:ie.height,fill:"#FF6B6B",listening:!1,opacity:.8}),W.horizontal&&z.jsx(Xi,{x:0,y:ie.height/2,width:ie.width,height:1,fill:"#FF6B6B",listening:!1,opacity:.8}),N&&!r.includes(N)&&(()=>{const V=E.current.get(N);if(V){const K=V.getClientRect();return z.jsx(Xi,{x:K.x,y:K.y,width:K.width,height:K.height,stroke:"#3faee6",strokeWidth:1,dash:[4,4],listening:!1,opacity:.5})}return null})(),z.jsx(T_,{ref:v,keepRatio:!0,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],rotateEnabled:!0,anchorSize:8,anchorCornerRadius:2,borderStroke:"#3faee6",borderStrokeWidth:2,anchorStroke:"#3faee6",anchorFill:"#ffffff",anchorStrokeWidth:2,boundBoxFunc:(V,K)=>K.width<5||K.height<5?V:K})]})}),j&&z.jsx("textarea",{ref:P,value:j.text,onChange:pe,onBlur:Ae,onKeyDown:V=>{V.key==="Escape"&&Ae()},style:{position:"fixed",top:`${Be.top}px`,left:`${Be.left}px`,width:`${j.width}px`,height:`${j.height}px`,fontSize:`${j.isFixedSize?be(j):j.fontSize}px`,fontFamily:j.fontFamily,fontWeight:j.bold?"bold":"normal",fontStyle:j.italic?"italic":"normal",color:j.fill,background:"transparent",border:"none",borderRadius:"0",padding:"0",margin:"0",resize:"none",outline:"none",overflow:"hidden",lineHeight:"1",verticalAlign:"top",zIndex:999,pointerEvents:"auto",boxSizing:"border-box"}})]})}function H_(){return z.jsx("div",{style:{width:"18px",height:"18px",borderRadius:"999px",border:"1px solid #e5e9ed",background:"linear-gradient(180deg, #ffffff 27.928%, #e7e9f5 100%)",overflow:"hidden"}})}function U_(){return z.jsx("div",{style:{width:"18px",height:"18px",borderRadius:"999px",border:"1px solid #e5e9ed",background:"linear-gradient(135deg, rgba(232, 199, 255, 0.8) 0%, rgba(173, 216, 255, 0.8) 100%)",overflow:"hidden"}})}function G_(){return z.jsx("div",{style:{width:"18px",height:"18px",borderRadius:"999px",border:"1px solid #e5e9ed",background:"linear-gradient(130.786deg, rgba(147, 28, 186, 1) 15.907%, rgba(26, 26, 48, 1) 52.739%, rgba(4, 107, 226, 1) 90.547%)",overflow:"hidden"}})}function B_({bgColor:t,onChange:e}){const[n,r]=Q.useState(null);return z.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[z.jsx("span",{style:{color:"#999999",fontSize:"16px",fontWeight:"normal",fontFamily:"Inter, sans-serif"},children:"Background color:"}),z.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",height:"40px",padding:"4px",background:"#EDF0F2",border:"1px solid #F8F9FA",borderRadius:"99px"},children:[z.jsx("button",{onClick:()=>e("seriousLight"),onMouseEnter:()=>r("seriousLight"),onMouseLeave:()=>r(null),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"38px",height:"32px",padding:"10px",background:t==="seriousLight"?"#DEE2E7":n==="seriousLight"?"#f0f2f4":"transparent",border:"none",borderRadius:"99px",cursor:"pointer",transition:"background 0.15s ease-in-out"},title:"Serious Light background",children:z.jsx(H_,{})}),z.jsx("button",{onClick:()=>e("light"),onMouseEnter:()=>r("light"),onMouseLeave:()=>r(null),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"38px",height:"32px",padding:"10px",background:t==="light"?"#DEE2E7":n==="light"?"#f0f2f4":"transparent",border:"none",borderRadius:"99px",cursor:"pointer",transition:"background 0.15s ease-in-out"},title:"Light background with gradients",children:z.jsx(U_,{})}),z.jsx("button",{onClick:()=>e("dark"),onMouseEnter:()=>r("dark"),onMouseLeave:()=>r(null),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"38px",height:"32px",padding:"10px",background:t==="dark"?"#DEE2E7":n==="dark"?"#f0f2f4":"transparent",border:"none",borderRadius:"99px",cursor:"pointer",transition:"background 0.15s ease-in-out"},title:"Dark background",children:z.jsx(G_,{})})]})]})}function j_({selected:t=!1}){return z.jsx("div",{style:{position:"relative",width:"16px",height:"16px"},children:z.jsx("div",{style:{position:"absolute",inset:"4.17%",width:"calc(100% - 8.34%)",height:"calc(100% - 8.34%)"},children:z.jsx("img",{alt:"X",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:t?"/assets/sizes/Property 1=selected.svg":"/assets/sizes/Property 1=Default.svg"})})})}function V_({selected:t=!1}){const e=t?"/assets/sizes/Property 1=selected-1.svg":"/assets/sizes/Property 1=Default-1.svg";return z.jsx("div",{style:{position:"relative",width:"16px",height:"16px"},children:z.jsx("img",{alt:"LinkedIn",style:{display:"block",width:"100%",height:"100%"},src:e})})}function b_({selected:t=!1}){const e=t?"/assets/sizes/Property 1=selected-2.svg":"/assets/sizes/Property 1=Default-2.svg";return z.jsx("div",{style:{position:"relative",width:"16px",height:"16px"},children:z.jsx("img",{alt:"HF",style:{display:"block",width:"100%",height:"100%"},src:e})})}const W_={"1200x675":"1200x675",linkedin:"1200x627",hf:"1160x580"};function K_({canvasSize:t,onChange:e}){const[n,r]=Q.useState(null),s=(l,a,c)=>{const d=t===l,g=n===l;return z.jsxs("button",{onClick:()=>e(l),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null),style:{display:"flex",alignItems:"center",justifyContent:d?"flex-start":"center",gap:"5px",height:"32px",minWidth:"38px",paddingLeft:d?"10px":"9px",paddingRight:d?"10px":"9px",background:d?"#DEE2E7":g?"#f0f2f4":"transparent",border:"none",borderRadius:"99px",cursor:"pointer",transition:"background 0.15s ease-in-out, padding 0.15s ease-in-out, min-width 0.15s ease-in-out",overflow:"hidden"},title:c,children:[z.jsx(a,{selected:d}),z.jsx("span",{style:{color:"#32343d",fontSize:"16px",fontWeight:"normal",fontFamily:"Inter, sans-serif",whiteSpace:"nowrap",opacity:d?.6:0,transform:d?"translateX(0)":"translateX(-10px)",transition:"opacity 0.15s ease-in-out, transform 0.15s ease-in-out",width:d?"auto":"0",overflow:"hidden"},children:W_[l]})]})};return z.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[z.jsx("span",{style:{color:"#999999",fontSize:"16px",fontWeight:"normal",fontFamily:"Inter, sans-serif"},children:"Size:"}),z.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",height:"40px",padding:"4px",background:"#EDF0F2",border:"1px solid #F8F9FA",borderRadius:"99px"},children:[s("1200x675",j_,"1200×675 (Default)"),s("linkedin",V_,"LinkedIn size (1200x627)"),s("hf",b_,"HF custom size (1160x580)")]})]})}function X_({canvasSize:t,bgColor:e,onCanvasSizeChange:n,onBgColorChange:r}){return z.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px",transition:"all 0.15s ease-in-out"},children:[z.jsx(B_,{bgColor:e,onChange:r}),z.jsx(K_,{canvasSize:t,onChange:n})]})}function Y_({onKeep:t,onReplace:e,onCancel:n}){return z.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm",onClick:n,children:z.jsxs("div",{className:"bg-[#2b2d31] rounded-[12px] shadow-2xl max-w-[480px] w-full mx-4 overflow-hidden",onClick:r=>r.stopPropagation(),children:[z.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#3e4044]",children:[z.jsx("h2",{className:"text-white text-[18px] font-semibold",children:"Switch Layout"}),z.jsx("button",{onClick:n,className:"text-gray-400 hover:text-white transition-colors p-1 hover:bg-[#3e4044] rounded",children:z.jsx(x8,{size:20})})]}),z.jsxs("div",{className:"px-6 py-5",children:[z.jsx("p",{className:"text-gray-300 text-[15px] leading-relaxed mb-4",children:"You have custom objects on the canvas. What would you like to do?"}),z.jsxs("div",{className:"space-y-3",children:[z.jsx("div",{className:"bg-[#1e1f22] rounded-[8px] p-4 border border-[#3e4044]",children:z.jsxs("div",{className:"flex items-start gap-3",children:[z.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-[#5865f2] flex-shrink-0 mt-0.5"}),z.jsxs("div",{children:[z.jsx("p",{className:"text-white font-medium text-[14px] mb-1",children:"Keep my objects"}),z.jsx("p",{className:"text-gray-400 text-[13px]",children:"Add the new layout objects alongside your existing work"})]})]})}),z.jsx("div",{className:"bg-[#1e1f22] rounded-[8px] p-4 border border-[#3e4044]",children:z.jsxs("div",{className:"flex items-start gap-3",children:[z.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-[#ed4245] flex-shrink-0 mt-0.5"}),z.jsxs("div",{children:[z.jsx("p",{className:"text-white font-medium text-[14px] mb-1",children:"Replace everything"}),z.jsx("p",{className:"text-gray-400 text-[13px]",children:"Remove all objects and load a fresh layout"})]})]})})]})]}),z.jsxs("div",{className:"px-6 py-4 bg-[#1e1f22] flex items-center justify-end gap-3",children:[z.jsx("button",{onClick:n,className:"px-4 py-2 rounded-[6px] text-white text-[14px] font-medium hover:bg-[#3e4044] transition-colors",children:"Cancel"}),z.jsx("button",{onClick:e,className:"px-4 py-2 rounded-[6px] bg-[#ed4245] text-white text-[14px] font-medium hover:bg-[#d13438] transition-colors",children:"Replace"}),z.jsx("button",{onClick:t,className:"px-4 py-2 rounded-[6px] bg-[#5865f2] text-white text-[14px] font-medium hover:bg-[#4752c4] transition-colors",children:"Keep"})]})]})})}function Jh(t){const e=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,r=parseInt(t.slice(5,7),16)/255,s=Math.max(e,n,r),l=Math.min(e,n,r),a=s-l;let c=0;a!==0&&(s===e?c=((n-r)/a+(n{const _=Math.round(x*255).toString(16);return _.length===1?"0"+_:_};return`#${w(d)}${w(g)}${w(y)}`}function $_({color:t,onChange:e,onClose:n}){const r=Jh(t),[s,l]=Q.useState(r.h),[a,c]=Q.useState(r.s),[d,g]=Q.useState(r.v),[y,w]=Q.useState(t.toUpperCase()),x=Q.useRef(null),_=Q.useRef(null),v=Q.useRef(null),[E,P]=Q.useState(!1),[k,C]=Q.useState(!1),[p,S]=Q.useState(!1),[R,F]=Q.useState(!1);Q.useEffect(()=>{if(!R){const H=Q_(s,a,d);w(H.toUpperCase()),e(H)}},[s,a,d,e,R]);const L=H=>{P(!0),N(H)},N=H=>{if(!x.current)return;const j=x.current.getBoundingClientRect(),Y=Math.max(0,Math.min(H.clientX-j.left,j.width)),ne=Math.max(0,Math.min(H.clientY-j.top,j.height));c(Y/j.width*100),g(100-ne/j.height*100)},I=H=>{C(!0),M(H)},M=H=>{if(!_.current)return;const j=_.current.getBoundingClientRect(),Y=Math.max(0,Math.min(H.clientX-j.left,j.width));l(Y/j.width*360)},U=H=>{S(!0),W(H)},W=H=>{if(!v.current)return;const j=v.current.getBoundingClientRect(),Y=Math.max(0,Math.min(H.clientX-j.left,j.width));c(Y/j.width*100)};Q.useEffect(()=>{const H=Y=>{E&&N(Y),k&&M(Y),p&&W(Y)},j=()=>{P(!1),C(!1),S(!1)};if(E||k||p)return document.addEventListener("mousemove",H),document.addEventListener("mouseup",j),()=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",j)}},[E,k,p]);const $=H=>{F(!0);let j=H.target.value.toUpperCase();if(j.startsWith("#")||(j="#"+j),w(j),/^#[0-9A-F]{6}$/i.test(j)){const Y=Jh(j);l(Y.h),c(Y.s),g(Y.v),e(j),F(!1)}},ie=async()=>{if(!window.EyeDropper){alert("EyeDropper API is not supported in your browser. Please use Chrome or Edge.");return}try{const Y=(await new window.EyeDropper().open()).sRGBHex,ne=Jh(Y);l(ne.h),c(ne.s),g(ne.v),w(Y.toUpperCase()),e(Y)}catch{console.log("Eyedropper cancelled")}},re=a/100*100,we=(1-d/100)*100,Te=s/360*100;return z.jsxs("div",{onMouseDown:H=>H.stopPropagation(),onClick:H=>H.stopPropagation(),style:{position:"absolute",bottom:"calc(100% + 8px)",right:0,width:"280px",backgroundColor:"#252525",border:"1px solid #1b1b1b",borderRadius:"8px",padding:"16px",boxShadow:"0 4px 6px -2px rgba(0, 0, 0, 0.1), 0 12px 16px -4px rgba(0, 0, 0, 0.17)",zIndex:1e3},children:[z.jsx("div",{ref:x,onMouseDown:L,style:{position:"relative",width:"100%",height:"112px",borderRadius:"8px",marginBottom:"16px",cursor:"crosshair",background:` linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, transparent), hsl(${s}, 100%, 50%) `},children:z.jsx("div",{style:{position:"absolute",left:`${re}%`,top:`${we}%`,width:"12px",height:"12px",border:"2px solid white",borderRadius:"50%",transform:"translate(-50%, -50%)",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.3)",pointerEvents:"none"}})}),z.jsxs("div",{style:{display:"flex",gap:"10px",marginBottom:"16px"},children:[z.jsx("button",{onClick:ie,title:"Pick color from screen",style:{width:"24px",height:"24px",borderRadius:"4px",backgroundColor:"rgba(255, 255, 255, 0.05)",border:"1px solid rgba(255, 255, 255, 0.1)",flexShrink:0,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0},children:z.jsx(v8,{size:14,color:"white"})}),z.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[z.jsx("div",{ref:_,onMouseDown:I,style:{position:"relative",width:"100%",height:"12px",borderRadius:"100px",background:"linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",cursor:"pointer"},children:z.jsx("div",{style:{position:"absolute",left:`${Te}%`,top:"50%",width:"12px",height:"12px",border:"2px solid white",borderRadius:"50%",transform:"translate(-50%, -50%)",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.3)",pointerEvents:"none"}})}),z.jsx("div",{ref:v,onMouseDown:U,style:{position:"relative",width:"100%",height:"12px",borderRadius:"100px",background:`linear-gradient(to right, white, hsl(${s}, 100%, 50%))`,cursor:"pointer"},children:z.jsx("div",{style:{position:"absolute",left:`${a}%`,top:"50%",width:"12px",height:"12px",border:"2px solid white",borderRadius:"50%",transform:"translate(-50%, -50%)",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.3)",pointerEvents:"none"}})})]})]}),z.jsxs("div",{style:{display:"flex",gap:"4px"},children:[z.jsx("div",{style:{padding:"8px",borderRadius:"8px",color:"#eeeeee",fontSize:"14px",fontFamily:"Inter, sans-serif",opacity:.8,width:"72px",textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center"},children:"Hex"}),z.jsx("input",{type:"text",value:y,onChange:$,onBlur:()=>F(!1),onKeyDown:H=>H.stopPropagation(),onKeyUp:H=>H.stopPropagation(),onKeyPress:H=>H.stopPropagation(),maxLength:7,style:{flex:1,padding:"8px 4px",backgroundColor:"#1b1b1b",border:"none",borderRadius:"6px",color:"#eeeeee",fontSize:"12px",fontFamily:"Inter, sans-serif",fontWeight:500,textAlign:"center",outline:"none"},onClick:H=>H.stopPropagation(),onMouseDown:H=>H.stopPropagation()})]})]})}function q_({fontFamily:t,fill:e,bold:n,italic:r,canvasWidth:s,canvasHeight:l,scale:a=1,stageRef:c,onFontFamilyChange:d,onFillChange:g,onBoldToggle:y,onItalicToggle:w}){const[x,_]=Q.useState(!1),[v,E]=Q.useState(!1),P=["Inter","IBM Plex Mono","Bison"],k={Inter:{bold:!0,italic:!0},"IBM Plex Mono":{bold:!0,italic:!0},Bison:{bold:!1,italic:!1}},C=k[t].bold,p=k[t].italic,S=s*a,R=l*a,F=80*a,L=`calc((100vw - ${S}px) / 2)`,N=`calc((100vh - ${R}px - ${F}px) / 2 - 10px - 44px)`;return z.jsx("div",{className:"text-toolbar",onMouseDown:I=>{I.stopPropagation()},onClick:I=>{I.stopPropagation()},style:{position:"fixed",right:L,bottom:N,zIndex:100,backgroundColor:"#27272A",borderRadius:"8px",padding:"4px",boxShadow:"0 4px 6px -2px rgba(0, 0, 0, 0.1), 0 12px 16px -4px rgba(0, 0, 0, 0.17)",transition:"right 0.15s ease-in-out, bottom 0.15s ease-in-out"},children:z.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[z.jsxs("div",{style:{position:"relative"},children:[z.jsxs("button",{onClick:()=>_(!x),style:{display:"flex",alignItems:"center",gap:"20px",padding:"8px",backgroundColor:"rgba(255, 255, 255, 0.05)",border:"none",borderRadius:"4px",color:"white",fontSize:"16px",fontFamily:"Source Sans Pro, sans-serif",cursor:"pointer",whiteSpace:"nowrap"},children:[t,z.jsx(g8,{size:14})]}),x&&z.jsx("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,backgroundColor:"#27272A",border:"1px solid #09090B",borderRadius:"8px",padding:"4px",minWidth:"160px",zIndex:1e3},children:P.map(I=>z.jsx("button",{onClick:()=>{d(I),_(!1)},style:{display:"block",width:"100%",padding:"8px 12px",backgroundColor:t===I?"rgba(255, 255, 255, 0.1)":"transparent",border:"none",borderRadius:"4px",color:"white",fontSize:"14px",fontFamily:I,textAlign:"left",cursor:"pointer"},onMouseEnter:M=>{t!==I&&(M.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.05)")},onMouseLeave:M=>{t!==I&&(M.currentTarget.style.backgroundColor="transparent")},children:I},I))})]}),z.jsx("div",{style:{width:"1px",height:"18px",backgroundColor:"rgba(255, 255, 255, 0.2)"}}),z.jsxs("div",{style:{position:"relative"},children:[z.jsx("button",{onClick:()=>E(!v),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"10px",backgroundColor:"transparent",border:"none",borderRadius:"99px",cursor:"pointer"},children:z.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"999px",backgroundColor:e,border:"1px solid #e5e9ed"}})}),v&&z.jsx($_,{color:e,onChange:g,onClose:()=>E(!1)})]}),z.jsx("button",{onClick:C?y:void 0,disabled:!C,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px",backgroundColor:n?"rgba(255, 255, 255, 0.1)":"transparent",border:"none",borderRadius:"4px",cursor:C?"pointer":"not-allowed",color:"white",opacity:C?1:.3},children:z.jsx(f8,{size:20})}),z.jsx("button",{onClick:p?w:void 0,disabled:!p,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px",backgroundColor:r?"rgba(255, 255, 255, 0.1)":"transparent",border:"none",borderRadius:"4px",cursor:p?"pointer":"not-allowed",color:"white",opacity:p?1:.3},children:z.jsx(m8,{size:20})})]})})}const Z_=50;function J_(){const[t,e]=Q.useState([]),[n,r]=Q.useState([]),[s,l]=Q.useState("1200x675"),[a,c]=Q.useState("seriousLight"),d=Q.useRef([[]]),g=Q.useRef(0),y=Q.useRef(!1),w=Q.useRef(!1),x=Q.useCallback(L=>{e(L),!y.current&&setTimeout(()=>{if(w.current)return;g.currentW.map($=>{if($.type==="text"){const{isEditing:ie,isFixedSize:re,...we}=$;return we}return $}),I=N(L),M=d.current[g.current]?N(d.current[g.current]):[];if(JSON.stringify(M)!==JSON.stringify(I)){const W=JSON.parse(JSON.stringify(I));console.log("Recording history:",{textObjects:W.filter($=>$.type==="text").map($=>({text:$.text,width:$.width,height:$.height,fontSize:$.fontSize}))}),d.current.push(W),g.current++,d.current.length>Z_&&(d.current.shift(),g.current--)}},0)},[]),_=Q.useCallback(()=>{if(g.current>0){y.current=!0,g.current--;const N=JSON.parse(JSON.stringify(d.current[g.current])).map(I=>{if(I.type==="text"&&I.text)try{const M=require("konva").default,U=new M.Text({text:I.text,fontSize:I.fontSize,fontFamily:I.fontFamily,fontStyle:`${I.bold?"bold":"normal"} ${I.italic?"italic":""}`}),W=Math.max(100,U.width()+20),$=Math.max(40,U.height()+10);return console.log("UNDO - Recalculating text:",{text:I.text,oldWidth:I.width,oldHeight:I.height,newWidth:W,newHeight:$,fontSize:I.fontSize,fontFamily:I.fontFamily}),U.destroy(),{...I,width:W,height:$,isEditing:!1}}catch(M){return console.error("Error recalculating text dimensions:",M),I}return I});e(N),r([]),setTimeout(()=>{y.current=!1},0)}},[]),v=Q.useCallback(()=>{if(g.current{if(I.type==="text"&&I.text)try{const M=require("konva").default,U=new M.Text({text:I.text,fontSize:I.fontSize,fontFamily:I.fontFamily,fontStyle:`${I.bold?"bold":"normal"} ${I.italic?"italic":""}`}),W=Math.max(100,U.width()+20),$=Math.max(40,U.height()+10);return U.destroy(),{...I,width:W,height:$,isEditing:!1}}catch(M){return console.error("Error recalculating text dimensions:",M),I}return I});e(N),r([]),setTimeout(()=>{y.current=!1},0)}},[]),E=L=>{const N={...L,id:a3(),zIndex:i0(t)};x([...t,N]),r([N.id])},P=()=>{n.length>0&&(x(t.filter(L=>!n.includes(L.id))),r([]))},k=L=>{n.length>0&&x(t.map(N=>n.includes(N.id)?{...N,...L}:N))},C=L=>{const N=i0(t);x(t.map(I=>I.id===L?{...I,zIndex:N}:I))},p=L=>{const N=Math.min(...t.map(I=>I.zIndex));x(t.map(I=>I.id===L?{...I,zIndex:N-1}:I))},S=L=>{const N=t.find(U=>U.id===L);if(!N)return;const I=t.filter(U=>U.zIndex>N.zIndex);if(I.length===0)return;const M=Math.min(...I.map(U=>U.zIndex));x(t.map(U=>U.id===L?{...U,zIndex:M+.5}:U))},R=L=>{const N=t.find(U=>U.id===L);if(!N)return;const I=t.filter(U=>U.zIndexU.zIndex));x(t.map(U=>U.id===L?{...U,zIndex:M-.5}:U))},F=Q.useCallback(L=>{w.current=L},[]);return{objects:t,selectedIds:n,canvasSize:s,bgColor:a,setObjects:x,setSelectedIds:r,setCanvasSize:l,setBgColor:c,addObject:E,deleteSelected:P,updateSelected:k,bringToFront:C,sendToBack:p,moveForward:S,moveBackward:R,undo:_,redo:v,setSkipHistoryRecording:F}}function ew(t,e){const[n,r]=Q.useState(1),[s,l]=Q.useState(!0);return Q.useEffect(()=>{const a=()=>{const c=window.innerWidth,d=window.innerHeight,g=187,y=200,w=c-g,x=d-y,_=w/t,v=x/e,E=Math.min(_,v,1),P=E>=1;r(E),l(P)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[t,e]),{scale:n,canFit:s}}function tw(){const{objects:t,selectedIds:e,canvasSize:n,bgColor:r,setObjects:s,setSelectedIds:l,setCanvasSize:a,setBgColor:c,addObject:d,deleteSelected:g,undo:y,redo:w,setSkipHistoryRecording:x}=J_(),[_,v]=Q.useState(!1),[E,P]=Q.useState(null),[k,C]=Q.useState(!1),[p,S]=Q.useState(!1),[R,F]=Q.useState(!1),[L,N]=Q.useState(null),[I,M]=Q.useState(null),U=Q.useRef(null),W=Q.useRef(null),$=Q.useRef(null),ie=fe=>{const J=fe.some(ge=>ge.type==="text"&&ge.isEditing);x(J),s(fe)},re=rl(n),{scale:we}=ew(re.width,re.height),Te=()=>{console.log("Layout clicked"),P(E==="layout"?null:"layout"),v(!1)},H=()=>{console.log("Huggy clicked"),P(E==="huggy"?null:"huggy"),v(!1)},j=()=>{var fe;console.log("Image clicked"),(fe=U.current)==null||fe.click()},Y=()=>{E==="text"?(v(!1),P(null)):(v(!0),P("text"))},ne=fe=>{if(!g2(fe))return;t.some(V=>!V.isFromLayout)?(N(fe),F(!0)):de(fe,!1)},de=(fe,J)=>{const ge=g2(fe);if(!ge)return;const V=t.length>0?Math.max(...t.map(X=>X.zIndex)):0,K=ge.objects.map(X=>{const Z={...X,id:`${X.id}-${Date.now()}`,isFromLayout:!0,zIndex:J?X.zIndex-V-100:X.zIndex};if(X.type==="text"&&X.text)try{const me=new Ir.Text({text:X.text,fontSize:X.fontSize,fontFamily:X.fontFamily,fontStyle:`${X.bold?"bold":"normal"} ${X.italic?"italic":""}`}),ae=Math.max(100,me.width()+20),le=Math.max(40,me.height()+10);return me.destroy(),{...Z,width:Math.max(X.width,ae),height:Math.max(X.height,le)}}catch(me){return console.error("Error recalculating layout text dimensions:",me),Z}return Z});s(J?[...K,...t]:K),M(fe),l([]),P(null)},ze=()=>{L&&de(L,!0),F(!1),N(null)},pt=()=>{L&&de(L,!1),F(!1),N(null)},mt=()=>{F(!1),N(null)},Ve=fe=>{const J=rl(n),ge=200,V=Math.floor(Math.random()*200)-100,K=Math.floor(Math.random()*200)-100,X=J.width/2-ge/2,Z=J.height/2-ge/2;d({type:"image",x:X+V,y:Z+K,width:ge,height:ge,src:fe.thumbnail,rotation:0,isFromLayout:!1}),P(null)},D=(fe,J)=>{d({type:"text",x:fe,y:J,width:100,height:80,rotation:0,text:"",fontSize:68,fontFamily:"Inter",fill:"#000000",bold:!1,italic:!1,isFixedSize:!1,isEditing:!1}),v(!1),P(null)},q=(fe,J,ge)=>{if(!["image/png","image/jpeg","image/jpg","image/webp"].includes(fe.type)){alert("Please upload a valid image file (PNG, JPG, or WebP)");return}const K=10*1024*1024;if(fe.size>K){alert("File size must be less than 10MB");return}const X=new FileReader;X.onload=Z=>{var le;const me=(le=Z.target)==null?void 0:le.result,ae=new Image;ae.onload=()=>{const ye=rl(n);let xe=ae.width,dt=ae.height;const Rt=Math.max(ye.width,ye.height),er=Math.max(xe,dt);if(er>Rt){const xr=Rt*.5/er;xe=xe*xr,dt=dt*xr}let yr,vr;if(J!==void 0&&ge!==void 0)yr=J-xe/2,vr=ge-dt/2;else{const Mi=Math.floor(Math.random()*200)-100,xr=Math.floor(Math.random()*200)-100;yr=ye.width/2-xe/2+Mi,vr=ye.height/2-dt/2+xr}d({type:"image",x:yr,y:vr,width:xe,height:dt,src:me,rotation:0,isFromLayout:!1})},ae.src=me},X.readAsDataURL(fe)},pe=fe=>{var ge;const J=(ge=fe.target.files)==null?void 0:ge[0];J&&q(J),fe.target.value=""},Ae=fe=>{fe.preventDefault(),C(!0)},Ce=fe=>{fe.preventDefault(),C(!1)},Be=fe=>{var ge;fe.preventDefault(),C(!1);const J=(ge=fe.dataTransfer.files)==null?void 0:ge[0];if(J){const V=document.querySelector(".canvas-container");if(V){const K=V.querySelector(".konvajs-content");if(K){const X=K.getBoundingClientRect(),Z=fe.clientX-X.left,me=fe.clientY-X.top;if(Z>=0&&Z<=X.width&&me>=0&&me<=X.height){q(J,Z,me);return}}}q(J)}},be=async fe=>{if(!W.current){console.error("Stage ref not available");return}S(!0);try{const J=e;l([]),await new Promise(Z=>setTimeout(Z,50));const ge=W.current,V=window.devicePixelRatio||1,K=ge.toDataURL({mimeType:"image/png",quality:1,pixelRatio:V}),X=document.createElement("a");X.download=`${fe}.png`,X.href=K,document.body.appendChild(X),X.click(),document.body.removeChild(X),l(J)}catch(J){console.error("Error exporting canvas:",J),alert("Failed to export canvas. Please try again.")}finally{S(!1)}};return Q.useEffect(()=>{const fe=J=>{const ge=document.querySelector(".canvas-container"),V=document.querySelector(".text-toolbar"),K=ge&&ge.contains(J.target),X=V&&V.contains(J.target);!K&&!X&&e.length>0&&l([])};return document.addEventListener("mousedown",fe),()=>document.removeEventListener("mousedown",fe)},[e,l]),Q.useEffect(()=>{const fe=J=>{if(!E)return;const ge=document.querySelector(".sidebar-container"),V=document.querySelector(".layout-selector"),K=document.querySelector(".huggy-menu"),X=document.querySelector(".text-hint"),Z=document.querySelector(".canvas-container");if(Z&&Z.contains(J.target)&&_)return;const ae=ge&&!ge.contains(J.target),le=!V||!V.contains(J.target),ye=!K||!K.contains(J.target),xe=!X||!X.contains(J.target);ae&&le&&ye&&xe&&(P(null),v(!1))};return document.addEventListener("mousedown",fe),()=>document.removeEventListener("mousedown",fe)},[E,_]),Q.useEffect(()=>{const fe=J=>{const ge=t.some(V=>V.type==="text"&&V.isEditing);if((J.ctrlKey||J.metaKey)&&J.key.toLowerCase()==="z"&&!J.shiftKey&&!ge){J.preventDefault(),y();return}if((J.ctrlKey||J.metaKey)&&(J.key.toLowerCase()==="z"&&J.shiftKey||J.key.toLowerCase()==="y")&&!ge){J.preventDefault(),w();return}if(!ge&&e.length>0&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(J.key)){J.preventDefault();const V=J.shiftKey?10:1,K=t.map(X=>{if(e.includes(X.id)){let Z=X.x,me=X.y;switch(J.key){case"ArrowUp":me-=V;break;case"ArrowDown":me+=V;break;case"ArrowLeft":Z-=V;break;case"ArrowRight":Z+=V;break}return{...X,x:Z,y:me}}return X});s(K);return}if((J.key==="Delete"||J.key==="Backspace")&&e.length>0&&!ge&&(J.preventDefault(),g()),(J.ctrlKey||J.metaKey)&&J.key.toLowerCase()==="d"&&e.length>0&&!ge){J.preventDefault();const V=t.filter(Z=>e.includes(Z.id)),K=20,X=V.map(Z=>({...Z,id:a3(),x:Z.x+K,y:Z.y+K,zIndex:i0(t),isFromLayout:!1}));s([...t,...X]),l(X.map(Z=>Z.id))}if(e.length>0&&!ge){if(J.key==="]"){J.preventDefault();const V=r0(t),K=V.map((Z,me)=>e.includes(Z.id)?me:-1).filter(Z=>Z!==-1);if(Math.max(...K)=0;ae--){const le=K[ae];le({...ae,zIndex:le}));s(me)}return}if(J.key==="["){J.preventDefault();const V=r0(t),K=V.map((Z,me)=>e.includes(Z.id)?me:-1).filter(Z=>Z!==-1);if(Math.min(...K)>0){const Z=[...V];for(let ae=0;ae0&&([Z[le],Z[le-1]]=[Z[le-1],Z[le]])}const me=Z.map((ae,le)=>({...ae,zIndex:le}));s(me)}return}}if(J.key==="t"||J.key==="T"){const V=J.target;V.tagName!=="INPUT"&&V.tagName!=="TEXTAREA"&&Y()}};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[e,g,t,s,y,w]),z.jsxs("div",{className:"w-full h-full bg-[#F8F9FB] relative overflow-hidden dotted-background",onDragOver:Ae,onDragLeave:Ce,onDrop:Be,children:[z.jsx("input",{ref:U,type:"file",accept:"image/png,image/jpeg,image/jpg,image/webp",onChange:pe,style:{display:"none"}}),k&&z.jsx("div",{className:"absolute inset-0 z-50 bg-blue-500 bg-opacity-10 border-4 border-dashed border-blue-500 flex items-center justify-center pointer-events-none",children:z.jsx("div",{className:"bg-white rounded-lg shadow-lg px-8 py-6",children:z.jsx("p",{className:"text-xl font-semibold text-gray-800",children:"Drop your image anywhere to upload"})})}),z.jsx(c8,{onLayoutClick:Te,onHuggyClick:H,onImageClick:j,onTextClick:Y,onSelectLayout:ne,onSelectHuggy:Ve,activeButton:E}),z.jsx(S8,{onExport:be,isExporting:p,currentLayout:I,canvasSize:n}),z.jsxs(_8,{scale:we,children:[z.jsx(X_,{canvasSize:n,bgColor:r,onCanvasSizeChange:a,onBgColorChange:c}),z.jsx(O_,{canvasSize:n,bgColor:r,objects:t,selectedIds:e,onSelect:l,onObjectsChange:ie,textCreationMode:_,onTextCreate:D,stageRef:W,transformerRef:$,scale:we})]}),R&&z.jsx(Y_,{onKeep:ze,onReplace:pt,onCancel:mt}),(()=>{const fe=t.filter(ae=>ae.type==="text"&&(e.includes(ae.id)||ae.isEditing));if(!(_||fe.length>0))return null;const ge=fe[0],V=(ge==null?void 0:ge.fontFamily)||"Inter",K=(ge==null?void 0:ge.fill)||"#000000",X=(ge==null?void 0:ge.bold)??!1,Z=(ge==null?void 0:ge.italic)??!1,me=rl(n);return z.jsx(q_,{fontFamily:V,fontSize:(ge==null?void 0:ge.fontSize)||68,fill:K,bold:X,italic:Z,canvasWidth:me.width,canvasHeight:me.height,scale:we,stageRef:W,onFontFamilyChange:ae=>{const le=t.map(ye=>{if(ye.type==="text"&&fe.some(xe=>xe.id===ye.id))try{const xe=new Ir.Text({text:ye.text||"M",fontSize:ye.fontSize,fontFamily:ae,fontStyle:`${ye.bold?"bold":"normal"} ${ye.italic?"italic":""}`}),dt=Math.max(100,xe.width()+20),Rt=Math.max(40,xe.height()+10);return xe.destroy(),{...ye,fontFamily:ae,width:dt,height:Rt}}catch(xe){return console.error("Error recalculating text size:",xe),{...ye,fontFamily:ae}}return ye});s(le)},onFillChange:ae=>{const le=t.map(ye=>ye.type==="text"&&fe.some(xe=>xe.id===ye.id)?{...ye,fill:ae}:ye);s(le)},onBoldToggle:()=>{const ae=t.map(le=>{if(le.type==="text"&&fe.some(ye=>ye.id===le.id)){const ye=!le.bold;try{const xe=new Ir.Text({text:le.text||"M",fontSize:le.fontSize,fontFamily:le.fontFamily,fontStyle:`${ye?"bold":"normal"} ${le.italic?"italic":""}`}),dt=Math.max(100,xe.width()+20),Rt=Math.max(40,xe.height()+10);return xe.destroy(),{...le,bold:ye,width:dt,height:Rt}}catch(xe){return console.error("Error recalculating text size:",xe),{...le,bold:ye}}}return le});s(ae)},onItalicToggle:()=>{const ae=t.map(le=>{if(le.type==="text"&&fe.some(ye=>ye.id===le.id)){const ye=!le.italic;try{const xe=new Ir.Text({text:le.text||"M",fontSize:le.fontSize,fontFamily:le.fontFamily,fontStyle:`${le.bold?"bold":"normal"} ${ye?"italic":""}`}),dt=Math.max(100,xe.width()+20),Rt=Math.max(40,xe.height()+10);return xe.destroy(),{...le,italic:ye,width:dt,height:Rt}}catch(xe){return console.error("Error recalculating text size:",xe),{...le,italic:ye}}}return le});s(ae)}})})()]})}y5(document.getElementById("root")).render(z.jsx(Q.StrictMode,{children:z.jsx(tw,{})}));