var B2=t=>{throw TypeError(t)};var h0=(t,e,n)=>e.has(t)||B2("Cannot "+n);var A=(t,e,n)=>(h0(t,e,"read from private field"),n?n.call(t):e.get(t)),ce=(t,e,n)=>e.has(t)?B2("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),te=(t,e,n,r)=>(h0(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Se=(t,e,n)=>(h0(t,e,"access private method"),n);var dc=(t,e,n,r)=>({set _(i){te(t,e,i,n)},get _(){return A(t,e,r)}});function _7(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var G2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Md(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var I4={exports:{}},Ld={},j4={exports:{}},Ee={};/** * @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 nu=Symbol.for("react.element"),x7=Symbol.for("react.portal"),w7=Symbol.for("react.fragment"),C7=Symbol.for("react.strict_mode"),k7=Symbol.for("react.profiler"),E7=Symbol.for("react.provider"),P7=Symbol.for("react.context"),N7=Symbol.for("react.forward_ref"),R7=Symbol.for("react.suspense"),T7=Symbol.for("react.memo"),O7=Symbol.for("react.lazy"),H2=Symbol.iterator;function F7(t){return t===null||typeof t!="object"?null:(t=H2&&t[H2]||t["@@iterator"],typeof t=="function"?t:null)}var U4={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z4=Object.assign,B4={};function va(t,e,n){this.props=t,this.context=e,this.refs=B4,this.updater=n||U4}va.prototype.isReactComponent={};va.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")};va.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function G4(){}G4.prototype=va.prototype;function R1(t,e,n){this.props=t,this.context=e,this.refs=B4,this.updater=n||U4}var T1=R1.prototype=new G4;T1.constructor=R1;z4(T1,va.prototype);T1.isPureReactComponent=!0;var V2=Array.isArray,H4=Object.prototype.hasOwnProperty,O1={current:null},V4={key:!0,ref:!0,__self:!0,__source:!0};function W4(t,e,n){var r,i={},o=null,l=null;if(e!=null)for(r in e.ref!==void 0&&(l=e.ref),e.key!==void 0&&(o=""+e.key),e)H4.call(e,r)&&!V4.hasOwnProperty(r)&&(i[r]=e[r]);var u=arguments.length-2;if(u===1)i.children=n;else if(1>>1,le=V[J];if(0>>1;Ji(mt,$))Wei(D,mt)?(V[J]=D,V[We]=$,J=We):(V[J]=mt,V[at]=$,J=at);else if(Wei(D,$))V[J]=D,V[We]=$,J=We;else break e}}return ee}function i(V,ee){var $=V.sortIndex-ee.sortIndex;return $!==0?$:V.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var l=Date,u=l.now();t.unstable_now=function(){return l.now()-u}}var d=[],f=[],g=1,v=null,S=3,w=!1,y=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(V){for(var ee=n(f);ee!==null;){if(ee.callback===null)r(f);else if(ee.startTime<=V)r(f),ee.sortIndex=ee.expirationTime,e(d,ee);else break;ee=n(f)}}function x(V){if(E=!1,m(V),!y)if(n(d)!==null)y=!0,he(T);else{var ee=n(f);ee!==null&&ke(x,ee.startTime-V)}}function T(V,ee){y=!1,E&&(E=!1,P(O),O=-1),w=!0;var $=S;try{for(m(ee),v=n(d);v!==null&&(!(v.expirationTime>ee)||V&&!G());){var J=v.callback;if(typeof J=="function"){v.callback=null,S=v.priorityLevel;var le=J(v.expirationTime<=ee);ee=t.unstable_now(),typeof le=="function"?v.callback=le:v===n(d)&&r(d),m(ee)}else r(d);v=n(d)}if(v!==null)var Ne=!0;else{var at=n(f);at!==null&&ke(x,at.startTime-ee),Ne=!1}return Ne}finally{v=null,S=$,w=!1}}var F=!1,L=null,O=-1,j=5,M=-1;function G(){return!(t.unstable_now()-MV||125J?(V.sortIndex=$,e(f,V),n(d)===null&&V===n(f)&&(E?(P(O),O=-1):E=!0,ke(x,$-J))):(V.sortIndex=le,e(d,V),y||w||(y=!0,he(T))),V},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(V){var ee=S;return function(){var $=S;S=ee;try{return V.apply(this,arguments)}finally{S=$}}}})(X4);Y4.exports=X4;var yl=Y4.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 H7=W,Tn=yl;function q(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"),ip=Object.prototype.hasOwnProperty,V7=/^[: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]*$/,K2={},Q2={};function W7(t){return ip.call(Q2,t)?!0:ip.call(K2,t)?!1:V7.test(t)?Q2[t]=!0:(K2[t]=!0,!1)}function K7(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 Q7(t,e,n,r){if(e===null||typeof e>"u"||K7(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 an(t,e,n,r,i,o,l){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=l}var Bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Bt[t]=new an(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Bt[e]=new an(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Bt[t]=new an(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Bt[t]=new an(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){Bt[t]=new an(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Bt[t]=new an(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Bt[t]=new an(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Bt[t]=new an(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Bt[t]=new an(t,5,!1,t.toLowerCase(),null,!1,!1)});var A1=/[\-:]([a-z])/g;function M1(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(A1,M1);Bt[e]=new an(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(A1,M1);Bt[e]=new an(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(A1,M1);Bt[e]=new an(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Bt[t]=new an(t,1,!1,t.toLowerCase(),null,!1,!1)});Bt.xlinkHref=new an("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Bt[t]=new an(t,1,!1,t.toLowerCase(),null,!0,!0)});function L1(t,e,n,r){var i=Bt.hasOwnProperty(e)?Bt[e]:null;(i!==null?i.type!==0:r||!(2u||i[l]!==o[u]){var d=` `+i[l].replace(" at new "," at ");return t.displayName&&d.includes("")&&(d=d.replace("",t.displayName)),d}while(1<=l&&0<=u);break}}}finally{g0=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?cl(t):""}function q7(t){switch(t.tag){case 5:return cl(t.type);case 16:return cl("Lazy");case 13:return cl("Suspense");case 19:return cl("SuspenseList");case 0:case 2:case 15:return t=m0(t.type,!1),t;case 11:return t=m0(t.type.render,!1),t;case 1:return t=m0(t.type,!0),t;default:return""}}function lp(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 Fo:return"Fragment";case Oo:return"Portal";case sp:return"Profiler";case b1:return"StrictMode";case op:return"Suspense";case ap:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Z4:return(t.displayName||"Context")+".Consumer";case J4:return(t._context.displayName||"Context")+".Provider";case D1:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case I1:return e=t.displayName||null,e!==null?e:lp(t.type)||"Memo";case Ri:e=t._payload,t=t._init;try{return lp(t(e))}catch{}}return null}function Y7(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 lp(e);case 8:return e===b1?"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 Zi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function t3(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function X7(t){var e=t3(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 i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(l){r=""+l,o.call(this,l)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function pc(t){t._valueTracker||(t._valueTracker=X7(t))}function n3(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=t3(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function ed(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 up(t,e){var n=e.checked;return st({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Y2(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Zi(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 r3(t,e){e=e.checked,e!=null&&L1(t,"checked",e,!1)}function cp(t,e){r3(t,e);var n=Zi(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")?dp(t,e.type,n):e.hasOwnProperty("defaultValue")&&dp(t,e.type,Zi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function X2(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 dp(t,e,n){(e!=="number"||ed(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var dl=Array.isArray;function Go(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=gc.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Rl(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var vl={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},$7=["Webkit","ms","Moz","O"];Object.keys(vl).forEach(function(t){$7.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),vl[e]=vl[t]})});function a3(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||vl.hasOwnProperty(t)&&vl[t]?(""+e).trim():e+"px"}function l3(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=a3(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var J7=st({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 pp(t,e){if(e){if(J7[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function gp(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 mp=null;function j1(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var yp=null,Ho=null,Vo=null;function Z2(t){if(t=su(t)){if(typeof yp!="function")throw Error(q(280));var e=t.stateNode;e&&(e=Ud(e),yp(t.stateNode,t.type,e))}}function u3(t){Ho?Vo?Vo.push(t):Vo=[t]:Ho=t}function c3(){if(Ho){var t=Ho,e=Vo;if(Vo=Ho=null,Z2(t),e)for(t=0;t>>=0,t===0?32:31-(uS(t)/cS|0)|0}var mc=64,yc=4194304;function hl(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 id(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,l=n&268435455;if(l!==0){var u=l&~i;u!==0?r=hl(u):(o&=l,o!==0&&(r=hl(o)))}else l=n&~i,l!==0?r=hl(l):o!==0&&(r=hl(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&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 ru(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-dr(e),t[e]=n}function pS(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=_l),ly=" ",uy=!1;function O3(t,e){switch(t){case"keyup":return GS.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function F3(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ao=!1;function VS(t,e){switch(t){case"compositionend":return F3(e);case"keypress":return e.which!==32?null:(uy=!0,ly);case"textInput":return t=e.data,t===ly&&uy?null:t;default:return null}}function WS(t,e){if(Ao)return t==="compositionend"||!K1&&O3(t,e)?(t=R3(),Uc=H1=Bi=null,Ao=!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=fy(n)}}function b3(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?b3(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function D3(){for(var t=window,e=ed();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ed(t.document)}return e}function Q1(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 e_(t){var e=D3(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&b3(n.ownerDocument.documentElement,n)){if(r!==null&&Q1(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 i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=py(n,o);var l=py(n,r);i&&l&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==l.node||t.focusOffset!==l.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(l.node,l.offset)):(e.setEnd(l.node,l.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,Mo=null,Cp=null,wl=null,kp=!1;function gy(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kp||Mo==null||Mo!==ed(r)||(r=Mo,"selectionStart"in r&&Q1(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}),wl&&Ll(wl,r)||(wl=r,r=ad(Cp,"onSelect"),0Do||(t.current=Op[Do],Op[Do]=null,Do--)}function Ve(t,e){Do++,Op[Do]=t.current,t.current=e}var es={},Jt=rs(es),vn=rs(!1),Vs=es;function aa(t,e){var n=t.type.contextTypes;if(!n)return es;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Sn(t){return t=t.childContextTypes,t!=null}function ud(){Xe(vn),Xe(Jt)}function wy(t,e,n){if(Jt.current!==es)throw Error(q(168));Ve(Jt,e),Ve(vn,n)}function W3(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(q(108,Y7(t)||"Unknown",i));return st({},n,r)}function cd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||es,Vs=Jt.current,Ve(Jt,t),Ve(vn,vn.current),!0}function Cy(t,e,n){var r=t.stateNode;if(!r)throw Error(q(169));n?(t=W3(t,e,Vs),r.__reactInternalMemoizedMergedChildContext=t,Xe(vn),Xe(Jt),Ve(Jt,t)):Xe(vn),Ve(vn,n)}var Qr=null,zd=!1,O0=!1;function K3(t){Qr===null?Qr=[t]:Qr.push(t)}function h_(t){zd=!0,K3(t)}function is(){if(!O0&&Qr!==null){O0=!0;var t=0,e=Ie;try{var n=Qr;for(Ie=1;t>=l,i-=l,Jr=1<<32-dr(e)+i|n<O?(j=L,L=null):j=L.sibling;var M=S(P,L,m[O],x);if(M===null){L===null&&(L=j);break}t&&L&&M.alternate===null&&e(P,L),k=o(M,k,O),F===null?T=M:F.sibling=M,F=M,L=j}if(O===m.length)return n(P,L),Ze&&Cs(P,O),T;if(L===null){for(;OO?(j=L,L=null):j=L.sibling;var G=S(P,L,M.value,x);if(G===null){L===null&&(L=j);break}t&&L&&G.alternate===null&&e(P,L),k=o(G,k,O),F===null?T=G:F.sibling=G,F=G,L=j}if(M.done)return n(P,L),Ze&&Cs(P,O),T;if(L===null){for(;!M.done;O++,M=m.next())M=v(P,M.value,x),M!==null&&(k=o(M,k,O),F===null?T=M:F.sibling=M,F=M);return Ze&&Cs(P,O),T}for(L=r(P,L);!M.done;O++,M=m.next())M=w(L,P,O,M.value,x),M!==null&&(t&&M.alternate!==null&&L.delete(M.key===null?O:M.key),k=o(M,k,O),F===null?T=M:F.sibling=M,F=M);return t&&L.forEach(function(K){return e(P,K)}),Ze&&Cs(P,O),T}function C(P,k,m,x){if(typeof m=="object"&&m!==null&&m.type===Fo&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case fc:e:{for(var T=m.key,F=k;F!==null;){if(F.key===T){if(T=m.type,T===Fo){if(F.tag===7){n(P,F.sibling),k=i(F,m.props.children),k.return=P,P=k;break e}}else if(F.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ri&&Py(T)===F.type){n(P,F.sibling),k=i(F,m.props),k.ref=rl(P,F,m),k.return=P,P=k;break e}n(P,F);break}else e(P,F);F=F.sibling}m.type===Fo?(k=Bs(m.props.children,P.mode,x,m.key),k.return=P,P=k):(x=Qc(m.type,m.key,m.props,null,P.mode,x),x.ref=rl(P,k,m),x.return=P,P=x)}return l(P);case Oo:e:{for(F=m.key;k!==null;){if(k.key===F)if(k.tag===4&&k.stateNode.containerInfo===m.containerInfo&&k.stateNode.implementation===m.implementation){n(P,k.sibling),k=i(k,m.children||[]),k.return=P,P=k;break e}else{n(P,k);break}else e(P,k);k=k.sibling}k=j0(m,P.mode,x),k.return=P,P=k}return l(P);case Ri:return F=m._init,C(P,k,F(m._payload),x)}if(dl(m))return y(P,k,m,x);if(Ja(m))return E(P,k,m,x);kc(P,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,k!==null&&k.tag===6?(n(P,k.sibling),k=i(k,m),k.return=P,P=k):(n(P,k),k=I0(m,P.mode,x),k.return=P,P=k),l(P)):n(P,k)}return C}var ua=X3(!0),$3=X3(!1),fd=rs(null),pd=null,Uo=null,$1=null;function J1(){$1=Uo=pd=null}function Z1(t){var e=fd.current;Xe(fd),t._currentValue=e}function Mp(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 Ko(t,e){pd=t,$1=Uo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(yn=!0),t.firstContext=null)}function Yn(t){var e=t._currentValue;if($1!==t)if(t={context:t,memoizedValue:e,next:null},Uo===null){if(pd===null)throw Error(q(308));Uo=t,pd.dependencies={lanes:0,firstContext:t}}else Uo=Uo.next=t;return e}var Ns=null;function eg(t){Ns===null?Ns=[t]:Ns.push(t)}function J3(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,eg(e)):(n.next=i.next,i.next=n),e.interleaved=n,si(t,r)}function si(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 Ti=!1;function tg(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Z3(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 ei(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function qi(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Oe&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,si(t,n)}return i=r.interleaved,i===null?(e.next=e,eg(r)):(e.next=i.next,i.next=e),r.interleaved=e,si(t,n)}function Bc(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,z1(t,n)}}function Ny(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=l:o=o.next=l,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,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 gd(t,e,n,r){var i=t.updateQueue;Ti=!1;var o=i.firstBaseUpdate,l=i.lastBaseUpdate,u=i.shared.pending;if(u!==null){i.shared.pending=null;var d=u,f=d.next;d.next=null,l===null?o=f:l.next=f,l=d;var g=t.alternate;g!==null&&(g=g.updateQueue,u=g.lastBaseUpdate,u!==l&&(u===null?g.firstBaseUpdate=f:u.next=f,g.lastBaseUpdate=d))}if(o!==null){var v=i.baseState;l=0,g=f=d=null,u=o;do{var S=u.lane,w=u.eventTime;if((r&S)===S){g!==null&&(g=g.next={eventTime:w,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var y=t,E=u;switch(S=e,w=n,E.tag){case 1:if(y=E.payload,typeof y=="function"){v=y.call(w,v,S);break e}v=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=E.payload,S=typeof y=="function"?y.call(w,v,S):y,S==null)break e;v=st({},v,S);break e;case 2:Ti=!0}}u.callback!==null&&u.lane!==0&&(t.flags|=64,S=i.effects,S===null?i.effects=[u]:S.push(u))}else w={eventTime:w,lane:S,tag:u.tag,payload:u.payload,callback:u.callback,next:null},g===null?(f=g=w,d=v):g=g.next=w,l|=S;if(u=u.next,u===null){if(u=i.shared.pending,u===null)break;S=u,u=S.next,S.next=null,i.lastBaseUpdate=S,i.shared.pending=null}}while(!0);if(g===null&&(d=v),i.baseState=d,i.firstBaseUpdate=f,i.lastBaseUpdate=g,e=i.shared.interleaved,e!==null){i=e;do l|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Qs|=l,t.lanes=l,t.memoizedState=v}}function Ry(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=A0.transition;A0.transition={};try{t(!1),e()}finally{Ie=n,A0.transition=r}}function m5(){return Xn().memoizedState}function m_(t,e,n){var r=Xi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},y5(t))v5(e,n);else if(n=J3(t,e,n,r),n!==null){var i=sn();hr(n,t,r,i),S5(n,e,r)}}function y_(t,e,n){var r=Xi(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(y5(t))v5(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var l=e.lastRenderedState,u=o(l,n);if(i.hasEagerState=!0,i.eagerState=u,pr(u,l)){var d=e.interleaved;d===null?(i.next=i,eg(e)):(i.next=d.next,d.next=i),e.interleaved=i;return}}catch{}finally{}n=J3(t,e,i,r),n!==null&&(i=sn(),hr(n,t,r,i),S5(n,e,r))}}function y5(t){var e=t.alternate;return t===it||e!==null&&e===it}function v5(t,e){Cl=yd=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function S5(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,z1(t,n)}}var vd={readContext:Yn,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useInsertionEffect:Qt,useLayoutEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useMutableSource:Qt,useSyncExternalStore:Qt,useId:Qt,unstable_isNewReconciler:!1},v_={readContext:Yn,useCallback:function(t,e){return Nr().memoizedState=[t,e===void 0?null:e],t},useContext:Yn,useEffect:Oy,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Hc(4194308,4,d5.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Hc(4194308,4,t,e)},useInsertionEffect:function(t,e){return Hc(4,2,t,e)},useMemo:function(t,e){var n=Nr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Nr();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=m_.bind(null,it,t),[r.memoizedState,t]},useRef:function(t){var e=Nr();return t={current:t},e.memoizedState=t},useState:Ty,useDebugValue:ug,useDeferredValue:function(t){return Nr().memoizedState=t},useTransition:function(){var t=Ty(!1),e=t[0];return t=g_.bind(null,t[1]),Nr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=it,i=Nr();if(Ze){if(n===void 0)throw Error(q(407));n=n()}else{if(n=e(),bt===null)throw Error(q(349));Ks&30||r5(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,Oy(s5.bind(null,r,o,t),[t]),r.flags|=2048,Gl(9,i5.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=Nr(),e=bt.identifierPrefix;if(Ze){var n=Zr,r=Jr;n=(r&~(1<<32-dr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=zl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=l.createElement(n,{is:r.is}):(t=l.createElement(n),n==="select"&&(l=t,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):t=l.createElementNS(t,n),t[Fr]=e,t[Il]=r,T5(t,e,!1,!1),e.stateNode=t;e:{switch(l=gp(n,r),n){case"dialog":Ye("cancel",t),Ye("close",t),i=r;break;case"iframe":case"object":case"embed":Ye("load",t),i=r;break;case"video":case"audio":for(i=0;iha&&(e.flags|=128,r=!0,il(o,!1),e.lanes=4194304)}else{if(!r)if(t=md(l),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),il(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!Ze)return qt(e),null}else 2*ft()-o.renderingStartTime>ha&&n!==1073741824&&(e.flags|=128,r=!0,il(o,!1),e.lanes=4194304);o.isBackwards?(l.sibling=e.child,e.child=l):(n=o.last,n!==null?n.sibling=l:e.child=l,o.last=l)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=ft(),e.sibling=null,n=rt.current,Ve(rt,r?n&1|2:n&1),e):(qt(e),null);case 22:case 23:return gg(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?En&1073741824&&(qt(e),e.subtreeFlags&6&&(e.flags|=8192)):qt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function P_(t,e){switch(Y1(e),e.tag){case 1:return Sn(e.type)&&ud(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ca(),Xe(vn),Xe(Jt),ig(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return rg(e),null;case 13:if(Xe(rt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));la()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Xe(rt),null;case 4:return ca(),null;case 10:return Z1(e.type._context),null;case 22:case 23:return gg(),null;case 24:return null;default:return null}}var Pc=!1,Xt=!1,N_=typeof WeakSet=="function"?WeakSet:Set,oe=null;function zo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ut(t,e,r)}else n.current=null}function Gp(t,e,n){try{n()}catch(r){ut(t,e,r)}}var By=!1;function R_(t,e){if(Ep=sd,t=D3(),Q1(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 i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,u=-1,d=-1,f=0,g=0,v=t,S=null;t:for(;;){for(var w;v!==n||i!==0&&v.nodeType!==3||(u=l+i),v!==o||r!==0&&v.nodeType!==3||(d=l+r),v.nodeType===3&&(l+=v.nodeValue.length),(w=v.firstChild)!==null;)S=v,v=w;for(;;){if(v===t)break t;if(S===n&&++f===i&&(u=l),S===o&&++g===r&&(d=l),(w=v.nextSibling)!==null)break;v=S,S=v.parentNode}v=w}n=u===-1||d===-1?null:{start:u,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(Pp={focusedElem:t,selectionRange:n},sd=!1,oe=e;oe!==null;)if(e=oe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,oe=t;else for(;oe!==null;){e=oe;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var E=y.memoizedProps,C=y.memoizedState,P=e.stateNode,k=P.getSnapshotBeforeUpdate(e.elementType===e.type?E:ar(e.type,E),C);P.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var m=e.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(x){ut(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,oe=t;break}oe=e.return}return y=By,By=!1,y}function kl(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Gp(e,n,o)}i=i.next}while(i!==r)}}function Hd(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 Hp(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 A5(t){var e=t.alternate;e!==null&&(t.alternate=null,A5(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Fr],delete e[Il],delete e[Tp],delete e[c_],delete e[d_])),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 M5(t){return t.tag===5||t.tag===3||t.tag===4}function Gy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||M5(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 Vp(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=ld));else if(r!==4&&(t=t.child,t!==null))for(Vp(t,e,n),t=t.sibling;t!==null;)Vp(t,e,n),t=t.sibling}function Wp(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(Wp(t,e,n),t=t.sibling;t!==null;)Wp(t,e,n),t=t.sibling}var Ut=null,ur=!1;function ki(t,e,n){for(n=n.child;n!==null;)L5(t,e,n),n=n.sibling}function L5(t,e,n){if(Mr&&typeof Mr.onCommitFiberUnmount=="function")try{Mr.onCommitFiberUnmount(bd,n)}catch{}switch(n.tag){case 5:Xt||zo(n,e);case 6:var r=Ut,i=ur;Ut=null,ki(t,e,n),Ut=r,ur=i,Ut!==null&&(ur?(t=Ut,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ut.removeChild(n.stateNode));break;case 18:Ut!==null&&(ur?(t=Ut,n=n.stateNode,t.nodeType===8?T0(t.parentNode,n):t.nodeType===1&&T0(t,n),Al(t)):T0(Ut,n.stateNode));break;case 4:r=Ut,i=ur,Ut=n.stateNode.containerInfo,ur=!0,ki(t,e,n),Ut=r,ur=i;break;case 0:case 11:case 14:case 15:if(!Xt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&Gp(n,e,l),i=i.next}while(i!==r)}ki(t,e,n);break;case 1:if(!Xt&&(zo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){ut(n,e,u)}ki(t,e,n);break;case 21:ki(t,e,n);break;case 22:n.mode&1?(Xt=(r=Xt)||n.memoizedState!==null,ki(t,e,n),Xt=r):ki(t,e,n);break;default:ki(t,e,n)}}function Hy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new N_),e.forEach(function(r){var i=I_.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function sr(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=l),r&=~o}if(r=i,r=ft()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*O_(r/1960))-r,10t?16:t,Gi===null)var r=!1;else{if(t=Gi,Gi=null,xd=0,Oe&6)throw Error(q(331));var i=Oe;for(Oe|=4,oe=t.current;oe!==null;){var o=oe,l=o.child;if(oe.flags&16){var u=o.deletions;if(u!==null){for(var d=0;dft()-fg?zs(t,0):hg|=n),_n(t,e)}function G5(t,e){e===0&&(t.mode&1?(e=yc,yc<<=1,!(yc&130023424)&&(yc=4194304)):e=1);var n=sn();t=si(t,e),t!==null&&(ru(t,e,n),_n(t,n))}function D_(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),G5(t,n)}function I_(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(q(314))}r!==null&&r.delete(e),G5(t,n)}var H5;H5=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||vn.current)yn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return yn=!1,k_(t,e,n);yn=!!(t.flags&131072)}else yn=!1,Ze&&e.flags&1048576&&Q3(e,hd,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Vc(t,e),t=e.pendingProps;var i=aa(e,Jt.current);Ko(e,n),i=og(null,e,r,t,i,n);var o=ag();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Sn(r)?(o=!0,cd(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tg(e),i.updater=Gd,e.stateNode=i,i._reactInternals=e,bp(e,r,t,n),e=jp(null,e,r,!0,o,n)):(e.tag=0,Ze&&o&&q1(e),nn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Vc(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=U_(r),t=ar(r,t),i){case 0:e=Ip(null,e,r,t,n);break e;case 1:e=jy(null,e,r,t,n);break e;case 11:e=Dy(null,e,r,t,n);break e;case 14:e=Iy(null,e,r,ar(r.type,t),n);break e}throw Error(q(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ar(r,i),Ip(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ar(r,i),jy(t,e,r,i,n);case 3:e:{if(P5(e),t===null)throw Error(q(387));r=e.pendingProps,o=e.memoizedState,i=o.element,Z3(t,e),gd(e,r,null,n);var l=e.memoizedState;if(r=l.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=da(Error(q(423)),e),e=Uy(t,e,r,n,i);break e}else if(r!==i){i=da(Error(q(424)),e),e=Uy(t,e,r,n,i);break e}else for(Nn=Qi(e.stateNode.containerInfo.firstChild),Rn=e,Ze=!0,cr=null,n=$3(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(la(),r===i){e=oi(t,e,n);break e}nn(t,e,r,n)}e=e.child}return e;case 5:return e5(e),t===null&&Ap(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,l=i.children,Np(r,i)?l=null:o!==null&&Np(r,o)&&(e.flags|=32),E5(t,e),nn(t,e,l,n),e.child;case 6:return t===null&&Ap(e),null;case 13:return N5(t,e,n);case 4:return ng(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ua(e,null,r,n):nn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ar(r,i),Dy(t,e,r,i,n);case 7:return nn(t,e,e.pendingProps,n),e.child;case 8:return nn(t,e,e.pendingProps.children,n),e.child;case 12:return nn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,l=i.value,Ve(fd,r._currentValue),r._currentValue=l,o!==null)if(pr(o.value,l)){if(o.children===i.children&&!vn.current){e=oi(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){l=o.child;for(var d=u.firstContext;d!==null;){if(d.context===r){if(o.tag===1){d=ei(-1,n&-n),d.tag=2;var f=o.updateQueue;if(f!==null){f=f.shared;var g=f.pending;g===null?d.next=d:(d.next=g.next,g.next=d),f.pending=d}}o.lanes|=n,d=o.alternate,d!==null&&(d.lanes|=n),Mp(o.return,n,e),u.lanes|=n;break}d=d.next}}else if(o.tag===10)l=o.type===e.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(q(341));l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),Mp(l,n,e),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===e){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}nn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Ko(e,n),i=Yn(i),r=r(i),e.flags|=1,nn(t,e,r,n),e.child;case 14:return r=e.type,i=ar(r,e.pendingProps),i=ar(r.type,i),Iy(t,e,r,i,n);case 15:return C5(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ar(r,i),Vc(t,e),e.tag=1,Sn(r)?(t=!0,cd(e)):t=!1,Ko(e,n),_5(e,r,i),bp(e,r,i,n),jp(null,e,r,!0,t,n);case 19:return R5(t,e,n);case 22:return k5(t,e,n)}throw Error(q(156,e.tag))};function V5(t,e){return y3(t,e)}function j_(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 Qn(t,e,n,r){return new j_(t,e,n,r)}function yg(t){return t=t.prototype,!(!t||!t.isReactComponent)}function U_(t){if(typeof t=="function")return yg(t)?1:0;if(t!=null){if(t=t.$$typeof,t===D1)return 11;if(t===I1)return 14}return 2}function $i(t,e){var n=t.alternate;return n===null?(n=Qn(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 Qc(t,e,n,r,i,o){var l=2;if(r=t,typeof t=="function")yg(t)&&(l=1);else if(typeof t=="string")l=5;else e:switch(t){case Fo:return Bs(n.children,i,o,e);case b1:l=8,i|=8;break;case sp:return t=Qn(12,n,e,i|2),t.elementType=sp,t.lanes=o,t;case op:return t=Qn(13,n,e,i),t.elementType=op,t.lanes=o,t;case ap:return t=Qn(19,n,e,i),t.elementType=ap,t.lanes=o,t;case e3:return Wd(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case J4:l=10;break e;case Z4:l=9;break e;case D1:l=11;break e;case I1:l=14;break e;case Ri:l=16,r=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Qn(l,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Bs(t,e,n,r){return t=Qn(7,t,r,e),t.lanes=n,t}function Wd(t,e,n,r){return t=Qn(22,t,r,e),t.elementType=e3,t.lanes=n,t.stateNode={isHidden:!1},t}function I0(t,e,n){return t=Qn(6,t,null,e),t.lanes=n,t}function j0(t,e,n){return e=Qn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function z_(t,e,n,r,i){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=v0(0),this.expirationTimes=v0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=v0(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function vg(t,e,n,r,i,o,l,u,d){return t=new z_(t,e,n,u,d),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Qn(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tg(o),t}function B_(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(q5)}catch(t){console.error(t)}}q5(),q4.exports=On;var K_=q4.exports,$y=K_;rp.createRoot=$y.createRoot,rp.hydrateRoot=$y.hydrateRoot;/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Vl(){return Vl=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wg(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function q_(){return Math.random().toString(36).substr(2,8)}function Zy(t,e){return{usr:t.state,key:t.key,idx:e}}function Xp(t,e,n,r){return n===void 0&&(n=null),Vl({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?xa(e):e,{state:n,key:e&&e.key||r||q_()})}function Y5(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function xa(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function Y_(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,l=i.history,u=Hi.Pop,d=null,f=g();f==null&&(f=0,l.replaceState(Vl({},l.state,{idx:f}),""));function g(){return(l.state||{idx:null}).idx}function v(){u=Hi.Pop;let C=g(),P=C==null?null:C-f;f=C,d&&d({action:u,location:E.location,delta:P})}function S(C,P){u=Hi.Push;let k=Xp(E.location,C,P);f=g()+1;let m=Zy(k,f),x=E.createHref(k);try{l.pushState(m,"",x)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(x)}o&&d&&d({action:u,location:E.location,delta:1})}function w(C,P){u=Hi.Replace;let k=Xp(E.location,C,P);f=g();let m=Zy(k,f),x=E.createHref(k);l.replaceState(m,"",x),o&&d&&d({action:u,location:E.location,delta:0})}function y(C){let P=i.location.origin!=="null"?i.location.origin:i.location.href,k=typeof C=="string"?C:Y5(C);return k=k.replace(/ $/,"%20"),St(P,"No window.location.(origin|href) available to create URL for href: "+k),new URL(k,P)}let E={get action(){return u},get location(){return t(i,l)},listen(C){if(d)throw new Error("A history only accepts one active listener");return i.addEventListener(Jy,v),d=C,()=>{i.removeEventListener(Jy,v),d=null}},createHref(C){return e(i,C)},createURL:y,encodeLocation(C){let P=y(C);return{pathname:P.pathname,search:P.search,hash:P.hash}},push:S,replace:w,go(C){return l.go(C)}};return E}var ev;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(ev||(ev={}));function X_(t,e,n){return n===void 0&&(n="/"),$_(t,e,n)}function $_(t,e,n,r){let i=typeof e=="string"?xa(e):e,o=J5(i.pathname||"/",n);if(o==null)return null;let l=X5(t);J_(l);let u=null;for(let d=0;u==null&&d{let d={relativePath:u===void 0?o.path||"":u,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};d.relativePath.startsWith("/")&&(St(d.relativePath.startsWith(r),'Absolute route path "'+d.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),d.relativePath=d.relativePath.slice(r.length));let f=Gs([r,d.relativePath]),g=n.concat(d);o.children&&o.children.length>0&&(St(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),X5(o.children,e,g,f)),!(o.path==null&&!o.index)&&e.push({path:f,score:sx(f,o.index),routesMeta:g})};return t.forEach((o,l)=>{var u;if(o.path===""||!((u=o.path)!=null&&u.includes("?")))i(o,l);else for(let d of $5(o.path))i(o,l,d)}),e}function $5(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let l=$5(r.join("/")),u=[];return u.push(...l.map(d=>d===""?o:[o,d].join("/"))),i&&u.push(...l),u.map(d=>t.startsWith("/")&&d===""?"/":d)}function J_(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:ox(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Z_=/^:[\w-]+$/,ex=3,tx=2,nx=1,rx=10,ix=-2,tv=t=>t==="*";function sx(t,e){let n=t.split("/"),r=n.length;return n.some(tv)&&(r+=ix),e&&(r+=tx),n.filter(i=>!tv(i)).reduce((i,o)=>i+(Z_.test(o)?ex:o===""?nx:rx),r)}function ox(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function ax(t,e,n){let{routesMeta:r}=t,i={},o="/",l=[];for(let u=0;u{let{paramName:S,isOptional:w}=g;if(S==="*"){let E=u[v]||"";l=o.slice(0,o.length-E.length).replace(/(.)\/+$/,"$1")}const y=u[v];return w&&!y?f[S]=void 0:f[S]=(y||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:l,pattern:t}}function ux(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),wg(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,d)=>(r.push({paramName:u,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function cx(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return wg(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function J5(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const dx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hx=t=>dx.test(t);function fx(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?xa(t):t,o;if(n)if(hx(n))o=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),wg(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?o=nv(n.substring(1),"/"):o=nv(n,e)}else o=e;return{pathname:o,search:mx(r),hash:yx(i)}}function nv(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function U0(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function px(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Z5(t,e){let n=px(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function e6(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=xa(t):(i=Vl({},t),St(!i.pathname||!i.pathname.includes("?"),U0("?","pathname","search",i)),St(!i.pathname||!i.pathname.includes("#"),U0("#","pathname","hash",i)),St(!i.search||!i.search.includes("#"),U0("#","search","hash",i)));let o=t===""||i.pathname==="",l=o?"/":i.pathname,u;if(l==null)u=n;else{let v=e.length-1;if(!r&&l.startsWith("..")){let S=l.split("/");for(;S[0]==="..";)S.shift(),v-=1;i.pathname=S.join("/")}u=v>=0?e[v]:"/"}let d=fx(i,u),f=l&&l!=="/"&&l.endsWith("/"),g=(o||l===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(f||g)&&(d.pathname+="/"),d}const Gs=t=>t.join("/").replace(/\/\/+/g,"/"),gx=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),mx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,yx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function vx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const t6=["post","put","patch","delete"];new Set(t6);const Sx=["get",...t6];new Set(Sx);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Wl(){return Wl=Object.assign?Object.assign.bind():function(t){for(var e=1;e{u.current=!0}),W.useCallback(function(f,g){if(g===void 0&&(g={}),!u.current)return;if(typeof f=="number"){r.go(f);return}let v=e6(f,JSON.parse(l),o,g.relative==="path");t==null&&e!=="/"&&(v.pathname=v.pathname==="/"?e:Gs([e,v.pathname])),(g.replace?r.replace:r.push)(v,g.state,g)},[e,r,l,o,t])}function Cx(t,e){return kx(t,e)}function kx(t,e,n,r){lu()||St(!1);let{navigator:i}=W.useContext(au),{matches:o}=W.useContext(eo),l=o[o.length-1],u=l?l.params:{};l&&l.pathname;let d=l?l.pathnameBase:"/";l&&l.route;let f=kg(),g;if(e){var v;let C=typeof e=="string"?xa(e):e;d==="/"||(v=C.pathname)!=null&&v.startsWith(d)||St(!1),g=C}else g=f;let S=g.pathname||"/",w=S;if(d!=="/"){let C=d.replace(/^\//,"").split("/");w="/"+S.replace(/^\//,"").split("/").slice(C.length).join("/")}let y=X_(t,{pathname:w}),E=Tx(y&&y.map(C=>Object.assign({},C,{params:Object.assign({},u,C.params),pathname:Gs([d,i.encodeLocation?i.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?d:Gs([d,i.encodeLocation?i.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),o,n,r);return e&&E?W.createElement(Xd.Provider,{value:{location:Wl({pathname:"/",search:"",hash:"",state:null,key:"default"},g),navigationType:Hi.Pop}},E):E}function Ex(){let t=Mx(),e=vx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return W.createElement(W.Fragment,null,W.createElement("h2",null,"Unexpected Application Error!"),W.createElement("h3",{style:{fontStyle:"italic"}},e),n?W.createElement("pre",{style:i},n):null,null)}const Px=W.createElement(Ex,null);class Nx extends W.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?W.createElement(eo.Provider,{value:this.props.routeContext},W.createElement(n6.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Rx(t){let{routeContext:e,match:n,children:r}=t,i=W.useContext(Cg);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),W.createElement(eo.Provider,{value:e},r)}function Tx(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var o;if(!n)return null;if(n.errors)t=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let l=t,u=(i=n)==null?void 0:i.errors;if(u!=null){let g=l.findIndex(v=>v.route.id&&(u==null?void 0:u[v.route.id])!==void 0);g>=0||St(!1),l=l.slice(0,Math.min(l.length,g+1))}let d=!1,f=-1;if(n&&r&&r.v7_partialHydration)for(let g=0;g=0?l=l.slice(0,f+1):l=[l[0]];break}}}return l.reduceRight((g,v,S)=>{let w,y=!1,E=null,C=null;n&&(w=u&&v.route.id?u[v.route.id]:void 0,E=v.route.errorElement||Px,d&&(f<0&&S===0?(bx("route-fallback"),y=!0,C=null):f===S&&(y=!0,C=v.route.hydrateFallbackElement||null)));let P=e.concat(l.slice(0,S+1)),k=()=>{let m;return w?m=E:y?m=C:v.route.Component?m=W.createElement(v.route.Component,null):v.route.element?m=v.route.element:m=g,W.createElement(Rx,{match:v,routeContext:{outlet:g,matches:P,isDataRoute:n!=null},children:m})};return n&&(v.route.ErrorBoundary||v.route.errorElement||S===0)?W.createElement(Nx,{location:n.location,revalidation:n.revalidation,component:E,error:w,children:k(),routeContext:{outlet:null,matches:P,isDataRoute:!0}}):k()},null)}var i6=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(i6||{}),s6=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(s6||{});function Ox(t){let e=W.useContext(Cg);return e||St(!1),e}function Fx(t){let e=W.useContext(_x);return e||St(!1),e}function Ax(t){let e=W.useContext(eo);return e||St(!1),e}function o6(t){let e=Ax(),n=e.matches[e.matches.length-1];return n.route.id||St(!1),n.route.id}function Mx(){var t;let e=W.useContext(n6),n=Fx(),r=o6();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function Lx(){let{router:t}=Ox(i6.UseNavigateStable),e=o6(s6.UseNavigateStable),n=W.useRef(!1);return r6(()=>{n.current=!0}),W.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Wl({fromRouteId:e},o)))},[t,e])}const rv={};function bx(t,e,n){rv[t]||(rv[t]=!0)}function Dx(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Ix(t){let{to:e,replace:n,state:r,relative:i}=t;lu()||St(!1);let{future:o,static:l}=W.useContext(au),{matches:u}=W.useContext(eo),{pathname:d}=kg(),f=xx(),g=e6(e,Z5(u,o.v7_relativeSplatPath),d,i==="path"),v=JSON.stringify(g);return W.useEffect(()=>f(JSON.parse(v),{replace:n,state:r,relative:i}),[f,v,i,n,r]),null}function pl(t){St(!1)}function jx(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Hi.Pop,navigator:o,static:l=!1,future:u}=t;lu()&&St(!1);let d=e.replace(/^\/*/,"/"),f=W.useMemo(()=>({basename:d,navigator:o,static:l,future:Wl({v7_relativeSplatPath:!1},u)}),[d,u,o,l]);typeof r=="string"&&(r=xa(r));let{pathname:g="/",search:v="",hash:S="",state:w=null,key:y="default"}=r,E=W.useMemo(()=>{let C=J5(g,d);return C==null?null:{location:{pathname:C,search:v,hash:S,state:w,key:y},navigationType:i}},[d,g,v,S,w,y,i]);return E==null?null:W.createElement(au.Provider,{value:f},W.createElement(Xd.Provider,{children:n,value:E}))}function Ux(t){let{children:e,location:n}=t;return Cx($p(e),n)}new Promise(()=>{});function $p(t,e){e===void 0&&(e=[]);let n=[];return W.Children.forEach(t,(r,i)=>{if(!W.isValidElement(r))return;let o=[...e,i];if(r.type===W.Fragment){n.push.apply(n,$p(r.props.children,o));return}r.type!==pl&&St(!1),!r.props.index||!r.props.children||St(!1);let l={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=$p(r.props.children,o)),n.push(l)}),n}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */const zx="6";try{window.__reactRouterVersion=zx}catch{}const Bx="startTransition",iv=D7[Bx];function Gx(t){let{basename:e,children:n,future:r,window:i}=t,o=W.useRef();o.current==null&&(o.current=Q_({window:i,v5Compat:!0}));let l=o.current,[u,d]=W.useState({action:l.action,location:l.location}),{v7_startTransition:f}=r||{},g=W.useCallback(v=>{f&&iv?iv(()=>d(v)):d(v)},[d,f]);return W.useLayoutEffect(()=>l.listen(g),[l,g]),W.useEffect(()=>Dx(r),[r]),W.createElement(jx,{basename:e,children:n,location:u.location,navigationType:u.action,navigator:l,future:r})}var sv;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(sv||(sv={}));var ov;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ov||(ov={}));var wa=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Fs,Ai,qo,P4,Hx=(P4=class extends wa{constructor(){super();ce(this,Fs);ce(this,Ai);ce(this,qo);te(this,qo,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){A(this,Ai)||this.setEventListener(A(this,qo))}onUnsubscribe(){var e;this.hasListeners()||((e=A(this,Ai))==null||e.call(this),te(this,Ai,void 0))}setEventListener(e){var n;te(this,qo,e),(n=A(this,Ai))==null||n.call(this),te(this,Ai,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){A(this,Fs)!==e&&(te(this,Fs,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof A(this,Fs)=="boolean"?A(this,Fs):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Fs=new WeakMap,Ai=new WeakMap,qo=new WeakMap,P4),Eg=new Hx,Vx={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Mi,N1,N4,Wx=(N4=class{constructor(){ce(this,Mi,Vx);ce(this,N1,!1)}setTimeoutProvider(t){te(this,Mi,t)}setTimeout(t,e){return A(this,Mi).setTimeout(t,e)}clearTimeout(t){A(this,Mi).clearTimeout(t)}setInterval(t,e){return A(this,Mi).setInterval(t,e)}clearInterval(t){A(this,Mi).clearInterval(t)}},Mi=new WeakMap,N1=new WeakMap,N4),Ts=new Wx;function Kx(t){setTimeout(t,0)}var Qx=typeof window>"u"||"Deno"in globalThis;function rn(){}function qx(t,e){return typeof t=="function"?t(e):t}function Jp(t){return typeof t=="number"&&t>=0&&t!==1/0}function a6(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Ji(t,e){return typeof t=="function"?t(e):t}function Hn(t,e){return typeof t=="function"?t(e):t}function av(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:l,stale:u}=t;if(l){if(r){if(e.queryHash!==Pg(l,e.options))return!1}else if(!Kl(e.queryKey,l))return!1}if(n!=="all"){const d=e.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||o&&!o(e))}function lv(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(Ys(e.options.mutationKey)!==Ys(o))return!1}else if(!Kl(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Pg(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ys)(t)}function Ys(t){return JSON.stringify(t,(e,n)=>Zp(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Kl(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Kl(t[n],e[n])):!1}var Yx=Object.prototype.hasOwnProperty;function l6(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=uv(t)&&uv(e);if(!r&&!(Zp(t)&&Zp(e)))return e;const o=(r?t:Object.keys(t)).length,l=r?e:Object.keys(e),u=l.length,d=r?new Array(u):{};let f=0;for(let g=0;g{Ts.setTimeout(e,t)})}function e1(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?l6(t,e):e}function $x(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function Jx(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Ng=Symbol();function u6(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Ng?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Rg(t,e){return typeof t=="function"?t(...e):!!t}function Zx(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var Ql=(()=>{let t=()=>Qx;return{isServer(){return t()},setIsServer(e){t=e}}})();function t1(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var ew=Kx;function tw(){let t=[],e=0,n=u=>{u()},r=u=>{u()},i=ew;const o=u=>{e?t.push(u):i(()=>{n(u)})},l=()=>{const u=t;t=[],u.length&&i(()=>{r(()=>{u.forEach(d=>{n(d)})})})};return{batch:u=>{let d;e++;try{d=u()}finally{e--,e||l()}return d},batchCalls:u=>(...d)=>{o(()=>{u(...d)})},schedule:o,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{i=u}}}var kt=tw(),Yo,Li,Xo,R4,nw=(R4=class extends wa{constructor(){super();ce(this,Yo,!0);ce(this,Li);ce(this,Xo);te(this,Xo,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){A(this,Li)||this.setEventListener(A(this,Xo))}onUnsubscribe(){var e;this.hasListeners()||((e=A(this,Li))==null||e.call(this),te(this,Li,void 0))}setEventListener(e){var n;te(this,Xo,e),(n=A(this,Li))==null||n.call(this),te(this,Li,e(this.setOnline.bind(this)))}setOnline(e){A(this,Yo)!==e&&(te(this,Yo,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return A(this,Yo)}},Yo=new WeakMap,Li=new WeakMap,Xo=new WeakMap,R4),Ed=new nw;function rw(t){return Math.min(1e3*2**t,3e4)}function c6(t){return(t??"online")==="online"?Ed.isOnline():!0}var n1=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function d6(t){let e=!1,n=0,r;const i=t1(),o=()=>i.status!=="pending",l=E=>{var C;if(!o()){const P=new n1(E);S(P),(C=t.onCancel)==null||C.call(t,P)}},u=()=>{e=!0},d=()=>{e=!1},f=()=>Eg.isFocused()&&(t.networkMode==="always"||Ed.isOnline())&&t.canRun(),g=()=>c6(t.networkMode)&&t.canRun(),v=E=>{o()||(r==null||r(),i.resolve(E))},S=E=>{o()||(r==null||r(),i.reject(E))},w=()=>new Promise(E=>{var C;r=P=>{(o()||f())&&E(P)},(C=t.onPause)==null||C.call(t)}).then(()=>{var E;r=void 0,o()||(E=t.onContinue)==null||E.call(t)}),y=()=>{if(o())return;let E;const C=n===0?t.initialPromise:void 0;try{E=C??t.fn()}catch(P){E=Promise.reject(P)}Promise.resolve(E).then(v).catch(P=>{var F;if(o())return;const k=t.retry??(Ql.isServer()?0:3),m=t.retryDelay??rw,x=typeof m=="function"?m(n,P):m,T=k===!0||typeof k=="number"&&nf()?void 0:w()).then(()=>{e?S(P):y()})})};return{promise:i,status:()=>i.status,cancel:l,continue:()=>(r==null||r(),i),cancelRetry:u,continueRetry:d,canStart:g,start:()=>(g()?y():w().then(y),i)}}var As,T4,h6=(T4=class{constructor(){ce(this,As)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jp(this.gcTime)&&te(this,As,Ts.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ql.isServer()?1/0:5*60*1e3))}clearGcTimeout(){A(this,As)&&(Ts.clearTimeout(A(this,As)),te(this,As,void 0))}},As=new WeakMap,T4),Ms,$o,Gn,Ls,At,$l,bs,Pn,f6,Vr,O4,iw=(O4=class extends h6{constructor(e){super();ce(this,Pn);ce(this,Ms);ce(this,$o);ce(this,Gn);ce(this,Ls);ce(this,At);ce(this,$l);ce(this,bs);te(this,bs,!1),te(this,$l,e.defaultOptions),this.setOptions(e.options),this.observers=[],te(this,Ls,e.client),te(this,Gn,A(this,Ls).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,te(this,Ms,hv(this.options)),this.state=e.state??A(this,Ms),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=A(this,At))==null?void 0:e.promise}setOptions(e){if(this.options={...A(this,$l),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=hv(this.options);n.data!==void 0&&(this.setState(dv(n.data,n.dataUpdatedAt)),te(this,Ms,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&A(this,Gn).remove(this)}setData(e,n){const r=e1(this.state.data,e,this.options);return Se(this,Pn,Vr).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Se(this,Pn,Vr).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=A(this,At))==null?void 0:r.promise;return(i=A(this,At))==null||i.cancel(e),n?n.then(rn).catch(rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return A(this,Ms)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Hn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ng||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ji(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!a6(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=A(this,At))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=A(this,At))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),A(this,Gn).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(A(this,At)&&(A(this,bs)||Se(this,Pn,f6).call(this)?A(this,At).cancel({revert:!0}):A(this,At).cancelRetry()),this.scheduleGc()),A(this,Gn).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Se(this,Pn,Vr).call(this,{type:"invalidate"})}async fetch(e,n){var d,f,g,v,S,w,y,E,C,P,k,m;if(this.state.fetchStatus!=="idle"&&((d=A(this,At))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(A(this,At))return A(this,At).continueRetry(),A(this,At).promise}if(e&&this.setOptions(e),!this.options.queryFn){const x=this.observers.find(T=>T.options.queryFn);x&&this.setOptions(x.options)}const r=new AbortController,i=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(te(this,bs,!0),r.signal)})},o=()=>{const x=u6(this.options,n),F=(()=>{const L={client:A(this,Ls),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return te(this,bs,!1),this.options.persister?this.options.persister(x,F,this):x(F)},u=(()=>{const x={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:A(this,Ls),state:this.state,fetchFn:o};return i(x),x})();(f=this.options.behavior)==null||f.onFetch(u,this),te(this,$o,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=u.fetchOptions)==null?void 0:g.meta))&&Se(this,Pn,Vr).call(this,{type:"fetch",meta:(v=u.fetchOptions)==null?void 0:v.meta}),te(this,At,d6({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:x=>{x instanceof n1&&x.revert&&this.setState({...A(this,$o),fetchStatus:"idle"}),r.abort()},onFail:(x,T)=>{Se(this,Pn,Vr).call(this,{type:"failed",failureCount:x,error:T})},onPause:()=>{Se(this,Pn,Vr).call(this,{type:"pause"})},onContinue:()=>{Se(this,Pn,Vr).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const x=await A(this,At).start();if(x===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(x),(w=(S=A(this,Gn).config).onSuccess)==null||w.call(S,x,this),(E=(y=A(this,Gn).config).onSettled)==null||E.call(y,x,this.state.error,this),x}catch(x){if(x instanceof n1){if(x.silent)return A(this,At).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw Se(this,Pn,Vr).call(this,{type:"error",error:x}),(P=(C=A(this,Gn).config).onError)==null||P.call(C,x,this),(m=(k=A(this,Gn).config).onSettled)==null||m.call(k,this.state.data,x,this),x}finally{this.scheduleGc()}}},Ms=new WeakMap,$o=new WeakMap,Gn=new WeakMap,Ls=new WeakMap,At=new WeakMap,$l=new WeakMap,bs=new WeakMap,Pn=new WeakSet,f6=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Vr=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...p6(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...dv(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return te(this,$o,e.manual?i:void 0),i;case"error":const o=e.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),kt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),A(this,Gn).notify({query:this,type:"updated",action:e})})},O4);function p6(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:c6(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function dv(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function hv(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var pn,Re,Jl,tn,Ds,Jo,qr,bi,Zl,Zo,ea,Is,js,Di,ta,be,gl,r1,i1,s1,o1,a1,l1,u1,g6,F4,sw=(F4=class extends wa{constructor(e,n){super();ce(this,be);ce(this,pn);ce(this,Re);ce(this,Jl);ce(this,tn);ce(this,Ds);ce(this,Jo);ce(this,qr);ce(this,bi);ce(this,Zl);ce(this,Zo);ce(this,ea);ce(this,Is);ce(this,js);ce(this,Di);ce(this,ta,new Set);this.options=n,te(this,pn,e),te(this,bi,null),te(this,qr,t1()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(A(this,Re).addObserver(this),fv(A(this,Re),this.options)?Se(this,be,gl).call(this):this.updateResult(),Se(this,be,o1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return c1(A(this,Re),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return c1(A(this,Re),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Se(this,be,a1).call(this),Se(this,be,l1).call(this),A(this,Re).removeObserver(this)}setOptions(e){const n=this.options,r=A(this,Re);if(this.options=A(this,pn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Hn(this.options.enabled,A(this,Re))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Se(this,be,u1).call(this),A(this,Re).setOptions(this.options),n._defaulted&&!kd(this.options,n)&&A(this,pn).getQueryCache().notify({type:"observerOptionsUpdated",query:A(this,Re),observer:this});const i=this.hasListeners();i&&pv(A(this,Re),r,this.options,n)&&Se(this,be,gl).call(this),this.updateResult(),i&&(A(this,Re)!==r||Hn(this.options.enabled,A(this,Re))!==Hn(n.enabled,A(this,Re))||Ji(this.options.staleTime,A(this,Re))!==Ji(n.staleTime,A(this,Re)))&&Se(this,be,r1).call(this);const o=Se(this,be,i1).call(this);i&&(A(this,Re)!==r||Hn(this.options.enabled,A(this,Re))!==Hn(n.enabled,A(this,Re))||o!==A(this,Di))&&Se(this,be,s1).call(this,o)}getOptimisticResult(e){const n=A(this,pn).getQueryCache().build(A(this,pn),e),r=this.createResult(n,e);return aw(this,r)&&(te(this,tn,r),te(this,Jo,this.options),te(this,Ds,A(this,Re).state)),r}getCurrentResult(){return A(this,tn)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&A(this,qr).status==="pending"&&A(this,qr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){A(this,ta).add(e)}getCurrentQuery(){return A(this,Re)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=A(this,pn).defaultQueryOptions(e),r=A(this,pn).getQueryCache().build(A(this,pn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Se(this,be,gl).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),A(this,tn)))}createResult(e,n){var j;const r=A(this,Re),i=this.options,o=A(this,tn),l=A(this,Ds),u=A(this,Jo),f=e!==r?e.state:A(this,Jl),{state:g}=e;let v={...g},S=!1,w;if(n._optimisticResults){const M=this.hasListeners(),G=!M&&fv(e,n),K=M&&pv(e,r,n,i);(G||K)&&(v={...v,...p6(g.data,e.options)}),n._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:y,errorUpdatedAt:E,status:C}=v;w=v.data;let P=!1;if(n.placeholderData!==void 0&&w===void 0&&C==="pending"){let M;o!=null&&o.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?(M=o.data,P=!0):M=typeof n.placeholderData=="function"?n.placeholderData((j=A(this,ea))==null?void 0:j.state.data,A(this,ea)):n.placeholderData,M!==void 0&&(C="success",w=e1(o==null?void 0:o.data,M,n),S=!0)}if(n.select&&w!==void 0&&!P)if(o&&w===(l==null?void 0:l.data)&&n.select===A(this,Zl))w=A(this,Zo);else try{te(this,Zl,n.select),w=n.select(w),w=e1(o==null?void 0:o.data,w,n),te(this,Zo,w),te(this,bi,null)}catch(M){te(this,bi,M)}A(this,bi)&&(y=A(this,bi),w=A(this,Zo),E=Date.now(),C="error");const k=v.fetchStatus==="fetching",m=C==="pending",x=C==="error",T=m&&k,F=w!==void 0,O={status:C,fetchStatus:v.fetchStatus,isPending:m,isSuccess:C==="success",isError:x,isInitialLoading:T,isLoading:T,data:w,dataUpdatedAt:v.dataUpdatedAt,error:y,errorUpdatedAt:E,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:v.dataUpdateCount>f.dataUpdateCount||v.errorUpdateCount>f.errorUpdateCount,isFetching:k,isRefetching:k&&!m,isLoadingError:x&&!F,isPaused:v.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:x&&F,isStale:Tg(e,n),refetch:this.refetch,promise:A(this,qr),isEnabled:Hn(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const M=O.data!==void 0,G=O.status==="error"&&!M,K=Z=>{G?Z.reject(O.error):M&&Z.resolve(O.data)},X=()=>{const Z=te(this,qr,O.promise=t1());K(Z)},ie=A(this,qr);switch(ie.status){case"pending":e.queryHash===r.queryHash&&K(ie);break;case"fulfilled":(G||O.data!==ie.value)&&X();break;case"rejected":(!G||O.error!==ie.reason)&&X();break}}return O}updateResult(){const e=A(this,tn),n=this.createResult(A(this,Re),this.options);if(te(this,Ds,A(this,Re).state),te(this,Jo,this.options),A(this,Ds).data!==void 0&&te(this,ea,A(this,Re)),kd(n,e))return;te(this,tn,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!A(this,ta).size)return!0;const l=new Set(o??A(this,ta));return this.options.throwOnError&&l.add("error"),Object.keys(A(this,tn)).some(u=>{const d=u;return A(this,tn)[d]!==e[d]&&l.has(d)})};Se(this,be,g6).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Se(this,be,o1).call(this)}},pn=new WeakMap,Re=new WeakMap,Jl=new WeakMap,tn=new WeakMap,Ds=new WeakMap,Jo=new WeakMap,qr=new WeakMap,bi=new WeakMap,Zl=new WeakMap,Zo=new WeakMap,ea=new WeakMap,Is=new WeakMap,js=new WeakMap,Di=new WeakMap,ta=new WeakMap,be=new WeakSet,gl=function(e){Se(this,be,u1).call(this);let n=A(this,Re).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(rn)),n},r1=function(){Se(this,be,a1).call(this);const e=Ji(this.options.staleTime,A(this,Re));if(Ql.isServer()||A(this,tn).isStale||!Jp(e))return;const r=a6(A(this,tn).dataUpdatedAt,e)+1;te(this,Is,Ts.setTimeout(()=>{A(this,tn).isStale||this.updateResult()},r))},i1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(A(this,Re)):this.options.refetchInterval)??!1},s1=function(e){Se(this,be,l1).call(this),te(this,Di,e),!(Ql.isServer()||Hn(this.options.enabled,A(this,Re))===!1||!Jp(A(this,Di))||A(this,Di)===0)&&te(this,js,Ts.setInterval(()=>{(this.options.refetchIntervalInBackground||Eg.isFocused())&&Se(this,be,gl).call(this)},A(this,Di)))},o1=function(){Se(this,be,r1).call(this),Se(this,be,s1).call(this,Se(this,be,i1).call(this))},a1=function(){A(this,Is)&&(Ts.clearTimeout(A(this,Is)),te(this,Is,void 0))},l1=function(){A(this,js)&&(Ts.clearInterval(A(this,js)),te(this,js,void 0))},u1=function(){const e=A(this,pn).getQueryCache().build(A(this,pn),this.options);if(e===A(this,Re))return;const n=A(this,Re);te(this,Re,e),te(this,Jl,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},g6=function(e){kt.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(A(this,tn))}),A(this,pn).getQueryCache().notify({query:A(this,Re),type:"observerResultsUpdated"})})},F4);function ow(t,e){return Hn(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function fv(t,e){return ow(t,e)||t.state.data!==void 0&&c1(t,e,e.refetchOnMount)}function c1(t,e,n){if(Hn(e.enabled,t)!==!1&&Ji(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Tg(t,e)}return!1}function pv(t,e,n,r){return(t!==e||Hn(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Tg(t,n)}function Tg(t,e){return Hn(e.enabled,t)!==!1&&t.isStaleByTime(Ji(e.staleTime,t))}function aw(t,e){return!kd(t.getCurrentResult(),e)}function gv(t){return{onFetch:(e,n)=>{var g,v,S,w,y;const r=e.options,i=(S=(v=(g=e.fetchOptions)==null?void 0:g.meta)==null?void 0:v.fetchMore)==null?void 0:S.direction,o=((w=e.state.data)==null?void 0:w.pages)||[],l=((y=e.state.data)==null?void 0:y.pageParams)||[];let u={pages:[],pageParams:[]},d=0;const f=async()=>{let E=!1;const C=m=>{Zx(m,()=>e.signal,()=>E=!0)},P=u6(e.options,e.fetchOptions),k=async(m,x,T)=>{if(E)return Promise.reject();if(x==null&&m.pages.length)return Promise.resolve(m);const L=(()=>{const G={client:e.client,queryKey:e.queryKey,pageParam:x,direction:T?"backward":"forward",meta:e.options.meta};return C(G),G})(),O=await P(L),{maxPages:j}=e.options,M=T?Jx:$x;return{pages:M(m.pages,O,j),pageParams:M(m.pageParams,x,j)}};if(i&&o.length){const m=i==="backward",x=m?lw:mv,T={pages:o,pageParams:l},F=x(r,T);u=await k(T,F,m)}else{const m=t??o.length;do{const x=d===0?l[0]??r.initialPageParam:mv(r,u);if(d>0&&x==null)break;u=await k(u,x),d++}while(d{var E,C;return(C=(E=e.options).persister)==null?void 0:C.call(E,f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=f}}}function mv(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function lw(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var eu,Rr,Yt,Us,Tr,Pi,A4,uw=(A4=class extends h6{constructor(e){super();ce(this,Tr);ce(this,eu);ce(this,Rr);ce(this,Yt);ce(this,Us);te(this,eu,e.client),this.mutationId=e.mutationId,te(this,Yt,e.mutationCache),te(this,Rr,[]),this.state=e.state||m6(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){A(this,Rr).includes(e)||(A(this,Rr).push(e),this.clearGcTimeout(),A(this,Yt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){te(this,Rr,A(this,Rr).filter(n=>n!==e)),this.scheduleGc(),A(this,Yt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){A(this,Rr).length||(this.state.status==="pending"?this.scheduleGc():A(this,Yt).remove(this))}continue(){var e;return((e=A(this,Us))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var l,u,d,f,g,v,S,w,y,E,C,P,k,m,x,T,F,L;const n=()=>{Se(this,Tr,Pi).call(this,{type:"continue"})},r={client:A(this,eu),meta:this.options.meta,mutationKey:this.options.mutationKey};te(this,Us,d6({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(O,j)=>{Se(this,Tr,Pi).call(this,{type:"failed",failureCount:O,error:j})},onPause:()=>{Se(this,Tr,Pi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>A(this,Yt).canRun(this)}));const i=this.state.status==="pending",o=!A(this,Us).canStart();try{if(i)n();else{Se(this,Tr,Pi).call(this,{type:"pending",variables:e,isPaused:o}),A(this,Yt).config.onMutate&&await A(this,Yt).config.onMutate(e,this,r);const j=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,e,r));j!==this.state.context&&Se(this,Tr,Pi).call(this,{type:"pending",context:j,variables:e,isPaused:o})}const O=await A(this,Us).start();return await((f=(d=A(this,Yt).config).onSuccess)==null?void 0:f.call(d,O,e,this.state.context,this,r)),await((v=(g=this.options).onSuccess)==null?void 0:v.call(g,O,e,this.state.context,r)),await((w=(S=A(this,Yt).config).onSettled)==null?void 0:w.call(S,O,null,this.state.variables,this.state.context,this,r)),await((E=(y=this.options).onSettled)==null?void 0:E.call(y,O,null,e,this.state.context,r)),Se(this,Tr,Pi).call(this,{type:"success",data:O}),O}catch(O){try{await((P=(C=A(this,Yt).config).onError)==null?void 0:P.call(C,O,e,this.state.context,this,r))}catch(j){Promise.reject(j)}try{await((m=(k=this.options).onError)==null?void 0:m.call(k,O,e,this.state.context,r))}catch(j){Promise.reject(j)}try{await((T=(x=A(this,Yt).config).onSettled)==null?void 0:T.call(x,void 0,O,this.state.variables,this.state.context,this,r))}catch(j){Promise.reject(j)}try{await((L=(F=this.options).onSettled)==null?void 0:L.call(F,void 0,O,e,this.state.context,r))}catch(j){Promise.reject(j)}throw Se(this,Tr,Pi).call(this,{type:"error",error:O}),O}finally{A(this,Yt).runNext(this)}}},eu=new WeakMap,Rr=new WeakMap,Yt=new WeakMap,Us=new WeakMap,Tr=new WeakSet,Pi=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),kt.batch(()=>{A(this,Rr).forEach(r=>{r.onMutationUpdate(e)}),A(this,Yt).notify({mutation:this,type:"updated",action:e})})},A4);function m6(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yr,lr,tu,M4,cw=(M4=class extends wa{constructor(e={}){super();ce(this,Yr);ce(this,lr);ce(this,tu);this.config=e,te(this,Yr,new Set),te(this,lr,new Map),te(this,tu,0)}build(e,n,r){const i=new uw({client:e,mutationCache:this,mutationId:++dc(this,tu)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){A(this,Yr).add(e);const n=Tc(e);if(typeof n=="string"){const r=A(this,lr).get(n);r?r.push(e):A(this,lr).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(A(this,Yr).delete(e)){const n=Tc(e);if(typeof n=="string"){const r=A(this,lr).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&A(this,lr).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Tc(e);if(typeof n=="string"){const r=A(this,lr).get(n),i=r==null?void 0:r.find(o=>o.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=Tc(e);if(typeof n=="string"){const i=(r=A(this,lr).get(n))==null?void 0:r.find(o=>o!==e&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){kt.batch(()=>{A(this,Yr).forEach(e=>{this.notify({type:"removed",mutation:e})}),A(this,Yr).clear(),A(this,lr).clear()})}getAll(){return Array.from(A(this,Yr))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>lv(n,r))}findAll(e={}){return this.getAll().filter(n=>lv(e,n))}notify(e){kt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return kt.batch(()=>Promise.all(e.map(n=>n.continue().catch(rn))))}},Yr=new WeakMap,lr=new WeakMap,tu=new WeakMap,M4);function Tc(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Xr,Ii,gn,$r,ni,qc,d1,L4,dw=(L4=class extends wa{constructor(n,r){super();ce(this,ni);ce(this,Xr);ce(this,Ii);ce(this,gn);ce(this,$r);te(this,Xr,n),this.setOptions(r),this.bindMethods(),Se(this,ni,qc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=A(this,Xr).defaultMutationOptions(n),kd(this.options,r)||A(this,Xr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:A(this,gn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ys(r.mutationKey)!==Ys(this.options.mutationKey)?this.reset():((i=A(this,gn))==null?void 0:i.state.status)==="pending"&&A(this,gn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=A(this,gn))==null||n.removeObserver(this)}onMutationUpdate(n){Se(this,ni,qc).call(this),Se(this,ni,d1).call(this,n)}getCurrentResult(){return A(this,Ii)}reset(){var n;(n=A(this,gn))==null||n.removeObserver(this),te(this,gn,void 0),Se(this,ni,qc).call(this),Se(this,ni,d1).call(this)}mutate(n,r){var i;return te(this,$r,r),(i=A(this,gn))==null||i.removeObserver(this),te(this,gn,A(this,Xr).getMutationCache().build(A(this,Xr),this.options)),A(this,gn).addObserver(this),A(this,gn).execute(n)}},Xr=new WeakMap,Ii=new WeakMap,gn=new WeakMap,$r=new WeakMap,ni=new WeakSet,qc=function(){var r;const n=((r=A(this,gn))==null?void 0:r.state)??m6();te(this,Ii,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},d1=function(n){kt.batch(()=>{var r,i,o,l,u,d,f,g;if(A(this,$r)&&this.hasListeners()){const v=A(this,Ii).variables,S=A(this,Ii).context,w={client:A(this,Xr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(r=A(this,$r)).onSuccess)==null||i.call(r,n.data,v,S,w)}catch(y){Promise.reject(y)}try{(l=(o=A(this,$r)).onSettled)==null||l.call(o,n.data,null,v,S,w)}catch(y){Promise.reject(y)}}else if((n==null?void 0:n.type)==="error"){try{(d=(u=A(this,$r)).onError)==null||d.call(u,n.error,v,S,w)}catch(y){Promise.reject(y)}try{(g=(f=A(this,$r)).onSettled)==null||g.call(f,void 0,n.error,v,S,w)}catch(y){Promise.reject(y)}}}this.listeners.forEach(v=>{v(A(this,Ii))})})},L4),Or,b4,hw=(b4=class extends wa{constructor(e={}){super();ce(this,Or);this.config=e,te(this,Or,new Map)}build(e,n,r){const i=n.queryKey,o=n.queryHash??Pg(i,n);let l=this.get(o);return l||(l=new iw({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(l)),l}add(e){A(this,Or).has(e.queryHash)||(A(this,Or).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=A(this,Or).get(e.queryHash);n&&(e.destroy(),n===e&&A(this,Or).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){kt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return A(this,Or).get(e)}getAll(){return[...A(this,Or).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>av(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>av(e,r)):n}notify(e){kt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Or=new WeakMap,b4),lt,ji,Ui,na,ra,zi,ia,sa,D4,fw=(D4=class{constructor(t={}){ce(this,lt);ce(this,ji);ce(this,Ui);ce(this,na);ce(this,ra);ce(this,zi);ce(this,ia);ce(this,sa);te(this,lt,t.queryCache||new hw),te(this,ji,t.mutationCache||new cw),te(this,Ui,t.defaultOptions||{}),te(this,na,new Map),te(this,ra,new Map),te(this,zi,0)}mount(){dc(this,zi)._++,A(this,zi)===1&&(te(this,ia,Eg.subscribe(async t=>{t&&(await this.resumePausedMutations(),A(this,lt).onFocus())})),te(this,sa,Ed.subscribe(async t=>{t&&(await this.resumePausedMutations(),A(this,lt).onOnline())})))}unmount(){var t,e;dc(this,zi)._--,A(this,zi)===0&&((t=A(this,ia))==null||t.call(this),te(this,ia,void 0),(e=A(this,sa))==null||e.call(this),te(this,sa,void 0))}isFetching(t){return A(this,lt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return A(this,ji).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=A(this,lt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=A(this,lt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Ji(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return A(this,lt).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=A(this,lt).get(r.queryHash),o=i==null?void 0:i.state.data,l=qx(e,o);if(l!==void 0)return A(this,lt).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(t,e,n){return kt.batch(()=>A(this,lt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=A(this,lt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=A(this,lt);kt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=A(this,lt);return kt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=kt.batch(()=>A(this,lt).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(rn).catch(rn)}invalidateQueries(t,e={}){return kt.batch(()=>(A(this,lt).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=kt.batch(()=>A(this,lt).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(rn)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(rn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=A(this,lt).build(this,e);return n.isStaleByTime(Ji(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(rn).catch(rn)}fetchInfiniteQuery(t){return t.behavior=gv(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(rn).catch(rn)}ensureInfiniteQueryData(t){return t.behavior=gv(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Ed.isOnline()?A(this,ji).resumePausedMutations():Promise.resolve()}getQueryCache(){return A(this,lt)}getMutationCache(){return A(this,ji)}getDefaultOptions(){return A(this,Ui)}setDefaultOptions(t){te(this,Ui,t)}setQueryDefaults(t,e){A(this,na).set(Ys(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...A(this,na).values()],n={};return e.forEach(r=>{Kl(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){A(this,ra).set(Ys(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...A(this,ra).values()],n={};return e.forEach(r=>{Kl(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...A(this,Ui).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Pg(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Ng&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...A(this,Ui).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){A(this,lt).clear(),A(this,ji).clear()}},lt=new WeakMap,ji=new WeakMap,Ui=new WeakMap,na=new WeakMap,ra=new WeakMap,zi=new WeakMap,ia=new WeakMap,sa=new WeakMap,D4),y6=W.createContext(void 0),Og=t=>{const e=W.useContext(y6);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},pw=({client:t,children:e})=>(W.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),N.jsx(y6.Provider,{value:t,children:e})),v6=W.createContext(!1),gw=()=>W.useContext(v6);v6.Provider;function mw(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var yw=W.createContext(mw()),vw=()=>W.useContext(yw),Sw=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?Rg(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},_w=t=>{W.useEffect(()=>{t.clearReset()},[t])},xw=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Rg(n,[t.error,r])),ww=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Cw=(t,e)=>t.isLoading&&t.isFetching&&!e,kw=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,yv=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function Ew(t,e,n){var S,w,y,E;const r=gw(),i=vw(),o=Og(),l=o.defaultQueryOptions(t);(w=(S=o.getDefaultOptions().queries)==null?void 0:S._experimental_beforeQuery)==null||w.call(S,l);const u=o.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",ww(l),Sw(l,i,u),_w(i);const d=!o.getQueryCache().get(l.queryHash),[f]=W.useState(()=>new e(o,l)),g=f.getOptimisticResult(l),v=!r&&t.subscribed!==!1;if(W.useSyncExternalStore(W.useCallback(C=>{const P=v?f.subscribe(kt.batchCalls(C)):rn;return f.updateResult(),P},[f,v]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),W.useEffect(()=>{f.setOptions(l)},[l,f]),kw(l,g))throw yv(l,f,i);if(xw({result:g,errorResetBoundary:i,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw g.error;if((E=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||E.call(y,l,g),l.experimental_prefetchInRender&&!Ql.isServer()&&Cw(g,r)){const C=d?yv(l,f,i):u==null?void 0:u.promise;C==null||C.catch(rn).finally(()=>{f.updateResult()})}return l.notifyOnChangeProps?g:f.trackResult(g)}function S6(t,e){return Ew(t,sw)}function Pw(t,e){const n=Og(),[r]=W.useState(()=>new dw(n,t));W.useEffect(()=>{r.setOptions(t)},[r,t]);const i=W.useSyncExternalStore(W.useCallback(l=>r.subscribe(kt.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=W.useCallback((l,u)=>{r.mutate(l,u).catch(rn)},[r]);if(i.error&&Rg(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Nw={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.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rw=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Dt=(t,e)=>{const n=W.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:u="",children:d,...f},g)=>W.createElement("svg",{ref:g,...Nw,width:i,height:i,stroke:r,strokeWidth:l?Number(o)*24/Number(i):o,className:["lucide",`lucide-${Rw(t)}`,u].join(" "),...f},[...e.map(([v,S])=>W.createElement(v,S)),...Array.isArray(d)?d:[d]]));return n.displayName=`${t}`,n};/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pd=Dt("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tw=Dt("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ow=Dt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fw=Dt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aw=Dt("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _6=Dt("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.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mw=Dt("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lw=Dt("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fg=Dt("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bw=Dt("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dw=Dt("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iw=Dt("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jw=Dt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x6=Dt("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uw=Dt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h1=Dt("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w6=Dt("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.303.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xs=Dt("Wand2",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72Z",key:"1bcowg"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);function zw({covers:t,onSelect:e,onDelete:n}){return t.length===0?N.jsxs("div",{className:"card text-center py-12",children:[N.jsx(Fg,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),N.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"No covers yet"}),N.jsx("p",{className:"text-gray-500 mt-2",children:"Upload a cover image or generate one with AI to get started"})]}):N.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:t.map(r=>N.jsxs("div",{className:"card p-0 overflow-hidden group hover:shadow-lg transition-shadow",children:[N.jsxs("div",{className:"aspect-[2/3] relative bg-gray-100",children:[N.jsx("img",{src:r.url,alt:r.filename,className:"w-full h-full object-cover"}),N.jsxs("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[N.jsx("button",{onClick:()=>e(r.url),className:"p-2 bg-white rounded-lg hover:bg-gray-100 transition-colors",title:"Edit",children:N.jsx(Mw,{className:"w-5 h-5 text-gray-700"})}),N.jsx("button",{onClick:()=>{const i=document.createElement("a");i.href=r.url,i.download=r.filename,i.click()},className:"p-2 bg-white rounded-lg hover:bg-gray-100 transition-colors",title:"Download",children:N.jsx(_6,{className:"w-5 h-5 text-gray-700"})}),N.jsx("button",{onClick:()=>n(r.id),className:"p-2 bg-red-500 rounded-lg hover:bg-red-600 transition-colors",title:"Delete",children:N.jsx(Uw,{className:"w-5 h-5 text-white"})})]})]}),N.jsxs("div",{className:"p-3",children:[N.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:r.filename}),N.jsx("p",{className:"text-xs text-gray-500 mt-1",children:new Date(r.createdAt).toLocaleDateString()})]})]},r.id))})}var C6={exports:{}},$d={},Nd={},xe={};(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 G2<"u"?G2:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},t.Konva={_global:t.glob,version:"9.3.22",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return t.Konva.angleDeg?i*e:i},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 i;return(i=t.Konva.Transformer)===null||i===void 0?void 0:i.isTransforming()},isDragReady(){return!!t.Konva.DD.node},releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(i){t.glob.Konva=i}};const r=i=>{t.Konva[i.prototype.getClassName()]=i};t._registerNode=r,t.Konva._injectGlobal(t.Konva)})(xe);var ot={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=xe;class n{constructor(x=[1,0,0,1,0,0]){this.dirty=!1,this.m=x&&x.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(x){x.m[0]=this.m[0],x.m[1]=this.m[1],x.m[2]=this.m[2],x.m[3]=this.m[3],x.m[4]=this.m[4],x.m[5]=this.m[5]}point(x){const T=this.m;return{x:T[0]*x.x+T[2]*x.y+T[4],y:T[1]*x.x+T[3]*x.y+T[5]}}translate(x,T){return this.m[4]+=this.m[0]*x+this.m[2]*T,this.m[5]+=this.m[1]*x+this.m[3]*T,this}scale(x,T){return this.m[0]*=x,this.m[1]*=x,this.m[2]*=T,this.m[3]*=T,this}rotate(x){const T=Math.cos(x),F=Math.sin(x),L=this.m[0]*T+this.m[2]*F,O=this.m[1]*T+this.m[3]*F,j=this.m[0]*-F+this.m[2]*T,M=this.m[1]*-F+this.m[3]*T;return this.m[0]=L,this.m[1]=O,this.m[2]=j,this.m[3]=M,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(x,T){const F=this.m[0]+this.m[2]*T,L=this.m[1]+this.m[3]*T,O=this.m[2]+this.m[0]*x,j=this.m[3]+this.m[1]*x;return this.m[0]=F,this.m[1]=L,this.m[2]=O,this.m[3]=j,this}multiply(x){const T=this.m[0]*x.m[0]+this.m[2]*x.m[1],F=this.m[1]*x.m[0]+this.m[3]*x.m[1],L=this.m[0]*x.m[2]+this.m[2]*x.m[3],O=this.m[1]*x.m[2]+this.m[3]*x.m[3],j=this.m[0]*x.m[4]+this.m[2]*x.m[5]+this.m[4],M=this.m[1]*x.m[4]+this.m[3]*x.m[5]+this.m[5];return this.m[0]=T,this.m[1]=F,this.m[2]=L,this.m[3]=O,this.m[4]=j,this.m[5]=M,this}invert(){const x=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),T=this.m[3]*x,F=-this.m[1]*x,L=-this.m[2]*x,O=this.m[0]*x,j=x*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),M=x*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=T,this.m[1]=F,this.m[2]=L,this.m[3]=O,this.m[4]=j,this.m[5]=M,this}getMatrix(){return this.m}decompose(){const x=this.m[0],T=this.m[1],F=this.m[2],L=this.m[3],O=this.m[4],j=this.m[5],M=x*L-T*F,G={x:O,y:j,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(x!=0||T!=0){const K=Math.sqrt(x*x+T*T);G.rotation=T>0?Math.acos(x/K):-Math.acos(x/K),G.scaleX=K,G.scaleY=M/K,G.skewX=(x*F+T*L)/M,G.skewY=0}else if(F!=0||L!=0){const K=Math.sqrt(F*F+L*L);G.rotation=Math.PI/2-(L>0?Math.acos(-F/K):-Math.acos(F/K)),G.scaleX=M/K,G.scaleY=K,G.skewX=0,G.skewY=(x*F+T*L)/M}return G.rotation=t.Util._getRotation(G.rotation),G}}t.Transform=n;const r="[object Array]",i="[object Number]",o="[object String]",l="[object Boolean]",u=Math.PI/180,d=180/Math.PI,f="#",g="",v="0",S="Konva warning: ",w="Konva error: ",y="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]},C=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let P=[];const k=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(m){setTimeout(m,60)};t.Util={_isElement(m){return!!(m&&m.nodeType==1)},_isFunction(m){return!!(m&&m.constructor&&m.call&&m.apply)},_isPlainObject(m){return!!m&&m.constructor===Object},_isArray(m){return Object.prototype.toString.call(m)===r},_isNumber(m){return Object.prototype.toString.call(m)===i&&!isNaN(m)&&isFinite(m)},_isString(m){return Object.prototype.toString.call(m)===o},_isBoolean(m){return Object.prototype.toString.call(m)===l},isObject(m){return m instanceof Object},isValidSelector(m){if(typeof m!="string")return!1;const x=m[0];return x==="#"||x==="."||x===x.toUpperCase()},_sign(m){return m===0||m>0?1:-1},requestAnimFrame(m){P.push(m),P.length===1&&k(function(){const x=P;P=[],x.forEach(function(T){T()})})},createCanvasElement(){const m=document.createElement("canvas");try{m.style=m.style||{}}catch{}return m},createImageElement(){return document.createElement("img")},_isInDocument(m){for(;m=m.parentNode;)if(m==document)return!0;return!1},_urlToImage(m,x){const T=t.Util.createImageElement();T.onload=function(){x(T)},T.src=m},_rgbToHex(m,x,T){return((1<<24)+(m<<16)+(x<<8)+T).toString(16).slice(1)},_hexToRgb(m){m=m.replace(f,g);const x=parseInt(m,16);return{r:x>>16&255,g:x>>8&255,b:x&255}},getRandomColor(){let m=(Math.random()*16777215<<0).toString(16);for(;m.length<6;)m=v+m;return f+m},getRGB(m){let x;return m in E?(x=E[m],{r:x[0],g:x[1],b:x[2]}):m[0]===f?this._hexToRgb(m.substring(1)):m.substr(0,4)===y?(x=C.exec(m.replace(/ /g,"")),{r:parseInt(x[1],10),g:parseInt(x[2],10),b:parseInt(x[3],10)}):{r:0,g:0,b:0}},colorToRGBA(m){return m=m||"black",t.Util._namedColorToRBA(m)||t.Util._hex3ColorToRGBA(m)||t.Util._hex4ColorToRGBA(m)||t.Util._hex6ColorToRGBA(m)||t.Util._hex8ColorToRGBA(m)||t.Util._rgbColorToRGBA(m)||t.Util._rgbaColorToRGBA(m)||t.Util._hslColorToRGBA(m)},_namedColorToRBA(m){const x=E[m.toLowerCase()];return x?{r:x[0],g:x[1],b:x[2],a:1}:null},_rgbColorToRGBA(m){if(m.indexOf("rgb(")===0){m=m.match(/rgb\(([^)]+)\)/)[1];const x=m.split(/ *, */).map(Number);return{r:x[0],g:x[1],b:x[2],a:1}}},_rgbaColorToRGBA(m){if(m.indexOf("rgba(")===0){m=m.match(/rgba\(([^)]+)\)/)[1];const x=m.split(/ *, */).map((T,F)=>T.slice(-1)==="%"?F===3?parseInt(T)/100:parseInt(T)/100*255:Number(T));return{r:x[0],g:x[1],b:x[2],a:x[3]}}},_hex8ColorToRGBA(m){if(m[0]==="#"&&m.length===9)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:parseInt(m.slice(7,9),16)/255}},_hex6ColorToRGBA(m){if(m[0]==="#"&&m.length===7)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:1}},_hex4ColorToRGBA(m){if(m[0]==="#"&&m.length===5)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:parseInt(m[4]+m[4],16)/255}},_hex3ColorToRGBA(m){if(m[0]==="#"&&m.length===4)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:1}},_hslColorToRGBA(m){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(m)){const[x,...T]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(m),F=Number(T[0])/360,L=Number(T[1])/100,O=Number(T[2])/100;let j,M,G;if(L===0)return G=O*255,{r:Math.round(G),g:Math.round(G),b:Math.round(G),a:1};O<.5?j=O*(1+L):j=O+L-O*L;const K=2*O-j,X=[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?G=K+(j-K)*6*M:2*M<1?G=j:3*M<2?G=K+(j-K)*(2/3-M)*6:G=K,X[ie]=G*255;return{r:Math.round(X[0]),g:Math.round(X[1]),b:Math.round(X[2]),a:1}}},haveIntersection(m,x){return!(x.x>m.x+m.width||x.x+x.widthm.y+m.height||x.y+x.height1?(j=T,M=F,G=(T-L)*(T-L)+(F-O)*(F-O)):(j=m+X*(T-m),M=x+X*(F-x),G=(j-L)*(j-L)+(M-O)*(M-O))}return[j,M,G]},_getProjectionToLine(m,x,T){const F=t.Util.cloneObject(m);let L=Number.MAX_VALUE;return x.forEach(function(O,j){if(!T&&j===x.length-1)return;const M=x[(j+1)%x.length],G=t.Util._getProjectionToSegment(O.x,O.y,M.x,M.y,m.x,m.y),K=G[0],X=G[1],ie=G[2];iex.length){const j=x;x=m,m=j}for(let j=0;j{x.width=0,x.height=0})},drawRoundedRectPath(m,x,T,F){let L=0,O=0,j=0,M=0;typeof F=="number"?L=O=j=M=Math.min(F,x/2,T/2):(L=Math.min(F[0]||0,x/2,T/2),O=Math.min(F[1]||0,x/2,T/2),M=Math.min(F[2]||0,x/2,T/2),j=Math.min(F[3]||0,x/2,T/2)),m.moveTo(L,0),m.lineTo(x-O,0),m.arc(x-O,O,O,Math.PI*3/2,0,!1),m.lineTo(x,T-M),m.arc(x-M,T-M,M,0,Math.PI/2,!1),m.lineTo(j,T),m.arc(j,T-j,j,Math.PI/2,Math.PI,!1),m.lineTo(0,L),m.arc(L,L,L,Math.PI,Math.PI*3/2,!1)}}})(ot);var et={},fr={},ti={};Object.defineProperty(ti,"__esModule",{value:!0});ti.HitContext=ti.SceneContext=ti.Context=void 0;const k6=ot,Bw=xe;function Gw(t){const e=[],n=t.length,r=k6.Util;for(let i=0;itypeof g=="number"?Math.floor(g):g)),o+=Hw+f.join(vv)+Vw)):(o+=u.property,e||(o+=Yw+u.val)),o+=Qw;return o}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,r;n.push(e),r=n.length,r>=$w&&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,i,o,l){this._context.arc(e,n,r,i,o,l)}arcTo(e,n,r,i,o){this._context.arcTo(e,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,o,l){this._context.bezierCurveTo(e,n,r,i,o,l)}clearRect(e,n,r,i){this._context.clearRect(e,n,r,i)}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,i){return this._context.createLinearGradient(e,n,r,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,i,o,l){return this._context.createRadialGradient(e,n,r,i,o,l)}drawImage(e,n,r,i,o,l,u,d,f){const g=arguments,v=this._context;g.length===3?v.drawImage(e,n,r):g.length===5?v.drawImage(e,n,r,i,o):g.length===9&&v.drawImage(e,n,r,i,o,l,u,d,f)}ellipse(e,n,r,i,o,l,u,d){this._context.ellipse(e,n,r,i,o,l,u,d)}isPointInPath(e,n,r,i){return r?this._context.isPointInPath(r,e,n,i):this._context.isPointInPath(e,n,i)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,r,i){this._context.fillRect(e,n,r,i)}strokeRect(e,n,r,i){this._context.strokeRect(e,n,r,i)}fillText(e,n,r,i){i?this._context.fillText(e,n,r,i):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,i){return this._context.getImageData(e,n,r,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,i){this._context.rect(e,n,r,i)}roundRect(e,n,r,i,o){this._context.roundRect(e,n,r,i,o)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,i){this._context.quadraticCurveTo(e,n,r,i)}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,i,o,l){this._context.setTransform(e,n,r,i,o,l)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,r,i){this._context.strokeText(e,n,r,i)}transform(e,n,r,i,o,l){this._context.transform(e,n,r,i,o,l)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=Sv.length,r=this.setAttr,i,o;const l=function(u){let d=e[u],f;e[u]=function(){return o=Gw(Array.prototype.slice.call(arguments,0)),f=d.apply(e,arguments),e._trace({method:u,args:o}),f}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){let r;return t.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];t.DD._dragElements.forEach((o,l)=>{const{node:u}=o,d=u.getStage();d.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const f=d._changedPointerPositions.find(g=>g.id===o.pointerId);if(f){if(o.dragStatus!=="dragging"){const g=u.dragDistance();if(Math.max(Math.abs(f.x-o.startPointerPos.x),Math.abs(f.y-o.startPointerPos.y)){o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];t.DD._dragElements.forEach(o=>{const{node:l}=o,u=l.getStage();if(r&&u.setPointersPositions(r),!u._changedPointerPositions.find(g=>g.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(t.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,o.dragStatus="stopped");const f=o.node.getLayer()||o.node instanceof e.Konva.Stage&&o.node;f&&i.indexOf(f)===-1&&i.push(f)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){t.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&t.DD._dragElements.delete(o)})}},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))})(Zd);var Ce={},pe={};Object.defineProperty(pe,"__esModule",{value:!0});pe.RGBComponent=rC;pe.alphaComponent=iC;pe.getNumberValidator=sC;pe.getNumberOrArrayOfNumbersValidator=oC;pe.getNumberOrAutoValidator=aC;pe.getStringValidator=lC;pe.getStringOrGradientValidator=uC;pe.getFunctionValidator=cC;pe.getNumberArrayValidator=dC;pe.getBooleanValidator=hC;pe.getComponentValidator=fC;const li=xe,ct=ot;function ui(t){return ct.Util._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||ct.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}function rC(t){return t>255?255:t<0?0:Math.round(t)}function iC(t){return t>1?1:t<1e-4?1e-4:t}function sC(){if(li.Konva.isUnminified)return function(t,e){return ct.Util._isNumber(t)||ct.Util.warn(ui(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function oC(t){if(li.Konva.isUnminified)return function(e,n){let r=ct.Util._isNumber(e),i=ct.Util._isArray(e)&&e.length==t;return!r&&!i&&ct.Util.warn(ui(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function aC(){if(li.Konva.isUnminified)return function(t,e){return ct.Util._isNumber(t)||t==="auto"||ct.Util.warn(ui(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function lC(){if(li.Konva.isUnminified)return function(t,e){return ct.Util._isString(t)||ct.Util.warn(ui(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function uC(){if(li.Konva.isUnminified)return function(t,e){const n=ct.Util._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||ct.Util.warn(ui(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function cC(){if(li.Konva.isUnminified)return function(t,e){return ct.Util._isFunction(t)||ct.Util.warn(ui(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}}function dC(){if(li.Konva.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(ct.Util._isArray(t)?t.forEach(function(r){ct.Util._isNumber(r)||ct.Util.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):ct.Util.warn(ui(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function hC(){if(li.Konva.isUnminified)return function(t,e){return t===!0||t===!1||ct.Util.warn(ui(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function fC(t){if(li.Konva.isUnminified)return function(e,n){return e==null||ct.Util.isObject(e)||ct.Util.warn(ui(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=ot,n=pe,r="get",i="set";t.Factory={addGetterSetter(o,l,u,d,f){t.Factory.addGetter(o,l,u),t.Factory.addSetter(o,l,d,f),t.Factory.addOverloadedGetterSetter(o,l)},addGetter(o,l,u){const d=r+e.Util._capitalize(l);o.prototype[d]=o.prototype[d]||function(){const f=this.attrs[l];return f===void 0?u:f}},addSetter(o,l,u,d){const f=i+e.Util._capitalize(l);o.prototype[f]||t.Factory.overWriteSetter(o,l,u,d)},overWriteSetter(o,l,u,d){const f=i+e.Util._capitalize(l);o.prototype[f]=function(g){return u&&g!==void 0&&g!==null&&(g=u.call(this,g,l)),this._setAttr(l,g),d&&d.call(this),this}},addComponentsGetterSetter(o,l,u,d,f){const g=u.length,v=e.Util._capitalize,S=r+v(l),w=i+v(l);o.prototype[S]=function(){const E={};for(let C=0;C{this._setAttr(l+v(P),void 0)}),this._fireChangeEvent(l,C,E),f&&f.call(this),this},t.Factory.addOverloadedGetterSetter(o,l)},addOverloadedGetterSetter(o,l){const u=e.Util._capitalize(l),d=i+u,f=r+u;o.prototype[l]=function(){return arguments.length?(this[d](arguments[0]),this):this[f]()}},addDeprecatedGetterSetter(o,l,u,d){e.Util.error("Adding deprecated "+l);const f=r+e.Util._capitalize(l),g=l+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[f]=function(){e.Util.error(g);const v=this.attrs[l];return v===void 0?u:v},t.Factory.addSetter(o,l,d,function(){e.Util.error(g)}),t.Factory.addOverloadedGetterSetter(o,l)},backCompat(o,l){e.Util.each(l,function(u,d){const f=o.prototype[d],g=r+e.Util._capitalize(u),v=i+e.Util._capitalize(u);function S(){f.apply(this,arguments),e.Util.error('"'+u+'" method is deprecated and will be removed soon. Use ""'+d+'" instead.')}o.prototype[u]=S,o.prototype[g]=S,o.prototype[v]=S})},afterSetFilter(){this._filterUpToDate=!1}}})(Ce);Object.defineProperty(et,"__esModule",{value:!0});et.Node=void 0;const Po=fr,zn=Zd,uu=Ce,Ei=xe,Pe=ot,gt=pe,Yc="absoluteOpacity",Fc="allEventListeners",Wr="absoluteTransform",_v="absoluteScale",ws="canvas",pC="Change",gC="children",mC="konva",f1="listening",yC="mouseenter",vC="mouseleave",SC="pointerenter",_C="pointerleave",xC="touchenter",wC="touchleave",xv="set",wv="Shape",Xc=" ",Cv="stage",Ni="transform",CC="Stage",p1="visible",kC=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Xc);let EC=1;class ge{constructor(e){this._id=EC++,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===Ni||e===Wr)&&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===Ni||e===Wr)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const i=n.map(o=>o+"Change.konva").join(Xc);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(ws)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Wr&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ws)){const{scene:e,filter:n,hit:r,buffer:i}=this._cache.get(ws);Pe.Util.releaseCanvas(e,n,r,i),this._cache.delete(ws)}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 i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),l=n.pixelRatio,u=n.x===void 0?Math.floor(r.x):n.x,d=n.y===void 0?Math.floor(r.y):n.y,f=n.offset||0,g=n.drawBorder||!1,v=n.hitCanvasPixelRatio||1;if(!i||!o){Pe.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const S=Math.abs(Math.round(r.x)-u)>.5?1:0,w=Math.abs(Math.round(r.y)-d)>.5?1:0;i+=f*2+S,o+=f*2+w,u-=f,d-=f;const y=new Po.SceneCanvas({pixelRatio:l,width:i,height:o}),E=new Po.SceneCanvas({pixelRatio:l,width:0,height:0,willReadFrequently:!0}),C=new Po.HitCanvas({pixelRatio:v,width:i,height:o}),P=y.getContext(),k=C.getContext(),m=new Po.SceneCanvas({width:y.width/y.pixelRatio+Math.abs(u),height:y.height/y.pixelRatio+Math.abs(d),pixelRatio:y.pixelRatio}),x=m.getContext();return C.isCache=!0,y.isCache=!0,this._cache.delete(ws),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(y.getContext()._context.imageSmoothingEnabled=!1,E.getContext()._context.imageSmoothingEnabled=!1),P.save(),k.save(),x.save(),P.translate(-u,-d),k.translate(-u,-d),x.translate(-u,-d),m.x=u,m.y=d,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Yc),this._clearSelfAndDescendantCache(_v),this.drawScene(y,this,m),this.drawHit(C,this),this._isUnderCache=!1,P.restore(),k.restore(),g&&(P.save(),P.beginPath(),P.rect(0,0,i,o),P.closePath(),P.setAttr("strokeStyle","red"),P.setAttr("lineWidth",5),P.stroke(),P.restore()),this._cache.set(ws,{scene:y,filter:E,hit:C,buffer:m,x:u,y:d}),this._requestDraw(),this}isCached(){return this._cache.has(ws)}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 i=1/0,o=1/0,l=-1/0,u=-1/0;const d=this.getAbsoluteTransform(n);return r.forEach(function(f){const g=d.point(f);i===void 0&&(i=l=g.x,o=u=g.y),i=Math.min(i,g.x),o=Math.min(o,g.y),l=Math.max(l,g.x),u=Math.max(u,g.y)}),{x:i,y:o,width:l-i,height:u-o}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),i=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/i,r.height/i),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,i=n.filter,o=i.getContext(),l,u,d,f;if(e){if(!this._filterUpToDate){const g=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(l=e.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/g,r.getHeight()/g),u=o.getImageData(0,0,i.getWidth(),i.getHeight()),d=0;d{let n,r;if(!e)return this;for(n in e)n!==gC&&(r=xv+Pe.Util._capitalize(n),Pe.Util._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(f1,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(p1,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 i=!1;zn.DD._dragElements.forEach(l=>{l.dragStatus==="dragging"&&(l.node.nodeType==="Stage"||l.node.getLayer()===r)&&(i=!0)});const o=!n&&!Ei.Konva.hitOnDragEnabled&&(i||Ei.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!o}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,i,o,l,u;function d(g){for(i=[],o=g.length,l=0;l0&&i[0].getDepth()<=e&&d(i)}const f=this.getStage();return n.nodeType!==CC&&f&&d(f.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(Ni),this._clearSelfAndDescendantCache(Wr)),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 i=this.getAbsoluteTransform(e).getMatrix(),o=new Pe.Transform,l=this.offset();return o.m=i.slice(),o.translate(l.x,l.y),o.getTranslation()}setAbsolutePosition(e){const{x:n,y:r,...i}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(Ni);const o=this._getAbsoluteTransform().copy();return o.invert(),o.translate(e.x,e.y),e={x:this.attrs.x+o.getTranslation().x,y:this.attrs.y+o.getTranslation().y},this._setTransform(i),this.setPosition({x:e.x,y:e.y}),this._clearCache(Ni),this._clearSelfAndDescendantCache(Wr),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,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(e,n){let r=[],i=this.getParent(),o,l;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,l=0;l0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Pe.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 Pe.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Pe.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(Yc,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,i,o,l;const u={attrs:{},className:this.getClassName()};for(n in e)r=e[n],l=Pe.Util.isObject(r)&&!Pe.Util._isPlainObject(r)&&!Pe.Util._isArray(r),!l&&(i=typeof this[n]=="function"&&this[n],delete e[n],o=i?i.call(this):null,e[n]=r,o!==r&&(u.attrs[n]=r));return Pe.Util._prepareToStringify(u)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){const i=[];n&&this._isMatch(e)&&i.push(this);let o=this.parent;for(;o;){if(o===r)return i;o._isMatch(e)&&i.push(o),o=o.parent}return i}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,i,o;for(i=0;i{try{const i=e==null?void 0:e.callback;i&&delete e.callback,Pe.Util._urlToImage(this.toDataURL(e),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(e){return new Promise((n,r)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(o=>{n(o),i==null||i(o)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(i){r(i)}})}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():Ei.Konva.dragDistance}_off(e,n,r){let i=this.eventListeners[e],o,l,u;for(o=0;o=0)||this.isDragging())return;let i=!1;zn.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const n=zn.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&zn.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 Pe.Util.haveIntersection(r,this.getClientRect())}static create(e,n){return Pe.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){let r=ge.prototype.getClassName.call(e),i=e.children,o,l,u;n&&(e.attrs.container=n),Ei.Konva[r]||(Pe.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const d=Ei.Konva[r];if(o=new d(e.attrs),i)for(l=i.length,u=0;u0}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(i=>{const o=i._isMatch(e);return o&&r.push(i),!!(o&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const i of r){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){const e=z0.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=z0.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 i=this.getLayer(),o=e||i&&i.getCanvas(),l=o&&o.getContext(),u=this._getCanvasCache(),d=u&&u.scene,f=o&&o.isCache;if(!this.isVisible()&&!f)return this;if(d){l.save();const g=this.getAbsoluteTransform(n).getMatrix();l.transform(g[0],g[1],g[2],g[3],g[4],g[5]),this._drawCachedSceneCanvas(l),l.restore()}else this._drawChildren("drawScene",o,n,r);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;const r=this.getLayer(),i=e||r&&r.hitCanvas,o=i&&i.getContext(),l=this._getCanvasCache();if(l&&l.hit){o.save();const d=this.getAbsoluteTransform(n).getMatrix();o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r,i){var o;const l=n&&n.getContext(),u=this.clipWidth(),d=this.clipHeight(),f=this.clipFunc(),g=typeof u=="number"&&typeof d=="number"||f,v=r===this;if(g){l.save();const w=this.getAbsoluteTransform(r);let y=w.getMatrix();l.transform(y[0],y[1],y[2],y[3],y[4],y[5]),l.beginPath();let E;if(f)E=f.call(this,l,this);else{const C=this.clipX(),P=this.clipY();l.rect(C||0,P||0,u,d)}l.clip.apply(l,E),y=w.copy().invert().getMatrix(),l.transform(y[0],y[1],y[2],y[3],y[4],y[5])}const S=!v&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";S&&(l.save(),l._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(w){w[e](n,r,i)}),S&&l.restore(),g&&l.restore()}getClientRect(e={}){var n;const r=e.skipTransform,i=e.relativeTo;let o,l,u,d,f={x:1/0,y:1/0,width:0,height:0};const g=this;(n=this.children)===null||n===void 0||n.forEach(function(w){if(!w.visible())return;const y=w.getClientRect({relativeTo:g,skipShadow:e.skipShadow,skipStroke:e.skipStroke});y.width===0&&y.height===0||(o===void 0?(o=y.x,l=y.y,u=y.x+y.width,d=y.y+y.height):(o=Math.min(o,y.x),l=Math.min(l,y.y),u=Math.max(u,y.x+y.width),d=Math.max(d,y.y+y.height)))});const v=this.find("Shape");let S=!1;for(let w=0;wWe.indexOf("pointer")>=0?"pointer":We.indexOf("touch")>=0?"touch":"mouse",le=We=>{const D=J(We);if(D==="pointer")return i.Konva.pointerEventsEnabled&&$.pointer;if(D==="touch")return $.touch;if(D==="mouse")return $.mouse};function Ne(We={}){return(We.clipFunc||We.clipWidth||We.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),We}const at="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(Ne(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",()=>{Ne(this.attrs)}),this._checkVisibility()}_validateAdd(D){const Q=D.getType()==="Layer",ue=D.getType()==="FastLayer";Q||ue||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===g){let Q;if(D.charAt(0)==="."){const ue=D.slice(1);D=document.getElementsByClassName(ue)[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 ue=0;ue-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(at),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 o.SceneCanvas({width:D.width,height:D.height,pixelRatio:D.pixelRatio||1}),ue=Q.getContext()._context,De=this.children;return(D.x||D.y)&&ue.translate(-1*D.x,-1*D.y),De.forEach(function(ve){if(!ve.isVisible())return;const Ge=ve._toKonvaCanvas(D);ue.drawImage(Ge._canvas,D.x,D.y,Ge.getWidth()/Ge.getPixelRatio(),Ge.getHeight()/Ge.getPixelRatio())}),Q}getIntersection(D){if(!D)return null;const Q=this.children,ue=Q.length,De=ue-1;for(let ve=De;ve>=0;ve--){const Ge=Q[ve].getIntersection(D);if(Ge)return Ge}return null}_resizeDOM(){const D=this.width(),Q=this.height();this.content&&(this.content.style.width=D+v,this.content.style.height=Q+v),this.bufferCanvas.setSize(D,Q),this.bufferHitCanvas.setSize(D,Q),this.children.forEach(ue=>{ue.setSize({width:D,height:Q}),ue.draw()})}add(D,...Q){if(arguments.length>1){for(let De=0;DeV&&e.Util.warn("The stage has "+ue+" 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(),i.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(){i.Konva.isBrowser&&ee.forEach(([D,Q])=>{this.content.addEventListener(D,ue=>{this[Q](ue)},{passive:!1})})}_pointerenter(D){this.setPointersPositions(D);const Q=le(D.type);Q&&this._fire(Q.pointerenter,{evt:D,target:this,currentTarget:this})}_pointerover(D){this.setPointersPositions(D);const Q=le(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=le(D.type),ue=J(D.type);if(!Q)return;this.setPointersPositions(D);const De=this._getTargetShape(ue),ve=!(i.Konva.isDragging()||i.Konva.isTransforming())||i.Konva.hitOnDragEnabled;De&&ve?(De._fireAndBubble(Q.pointerout,{evt:D}),De._fireAndBubble(Q.pointerleave,{evt:D}),this._fire(Q.pointerleave,{evt:D,target:this,currentTarget:this}),this[ue+"targetShape"]=null):ve&&(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=le(D.type),ue=J(D.type);if(!Q)return;this.setPointersPositions(D);let De=!1;this._changedPointerPositions.forEach(ve=>{const Ge=this.getIntersection(ve);if(l.DD.justDragged=!1,i.Konva["_"+ue+"ListenClick"]=!0,!Ge||!Ge.isListening()){this[ue+"ClickStartShape"]=void 0;return}i.Konva.capturePointerEventsEnabled&&Ge.setPointerCapture(ve.id),this[ue+"ClickStartShape"]=Ge,Ge._fireAndBubble(Q.pointerdown,{evt:D,pointerId:ve.id}),De=!0;const Ke=D.type.indexOf("touch")>=0;Ge.preventDefault()&&D.cancelable&&Ke&&D.preventDefault()}),De||this._fire(Q.pointerdown,{evt:D,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(D){const Q=le(D.type),ue=J(D.type);if(!Q||(i.Konva.isDragging()&&l.DD.node.preventDefault()&&D.cancelable&&D.preventDefault(),this.setPointersPositions(D),!(!(i.Konva.isDragging()||i.Konva.isTransforming())||i.Konva.hitOnDragEnabled)))return;const ve={};let Ge=!1;const Ke=this._getTargetShape(ue);this._changedPointerPositions.forEach(yr=>{const Ue=d.getCapturedShape(yr.id)||this.getIntersection(yr),hi=yr.id,Jn={evt:D,pointerId:hi},fi=Ke!==Ue;if(fi&&Ke&&(Ke._fireAndBubble(Q.pointerout,{...Jn},Ue),Ke._fireAndBubble(Q.pointerleave,{...Jn},Ue)),Ue){if(ve[Ue._id])return;ve[Ue._id]=!0}Ue&&Ue.isListening()?(Ge=!0,fi&&(Ue._fireAndBubble(Q.pointerover,{...Jn},Ke),Ue._fireAndBubble(Q.pointerenter,{...Jn},Ke),this[ue+"targetShape"]=Ue),Ue._fireAndBubble(Q.pointermove,{...Jn})):Ke&&(this._fire(Q.pointerover,{evt:D,target:this,currentTarget:this,pointerId:hi}),this[ue+"targetShape"]=null)}),Ge||this._fire(Q.pointermove,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(D){const Q=le(D.type),ue=J(D.type);if(!Q)return;this.setPointersPositions(D);const De=this[ue+"ClickStartShape"],ve=this[ue+"ClickEndShape"],Ge={};let Ke=!1;this._changedPointerPositions.forEach(yr=>{const Ue=d.getCapturedShape(yr.id)||this.getIntersection(yr);if(Ue){if(Ue.releaseCapture(yr.id),Ge[Ue._id])return;Ge[Ue._id]=!0}const hi=yr.id,Jn={evt:D,pointerId:hi};let fi=!1;i.Konva["_"+ue+"InDblClickWindow"]?(fi=!0,clearTimeout(this[ue+"DblTimeout"])):l.DD.justDragged||(i.Konva["_"+ue+"InDblClickWindow"]=!0,clearTimeout(this[ue+"DblTimeout"])),this[ue+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ue+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),Ue&&Ue.isListening()?(Ke=!0,this[ue+"ClickEndShape"]=Ue,Ue._fireAndBubble(Q.pointerup,{...Jn}),i.Konva["_"+ue+"ListenClick"]&&De&&De===Ue&&(Ue._fireAndBubble(Q.pointerclick,{...Jn}),fi&&ve&&ve===Ue&&Ue._fireAndBubble(Q.pointerdblclick,{...Jn}))):(this[ue+"ClickEndShape"]=null,i.Konva["_"+ue+"ListenClick"]&&this._fire(Q.pointerclick,{evt:D,target:this,currentTarget:this,pointerId:hi}),fi&&this._fire(Q.pointerdblclick,{evt:D,target:this,currentTarget:this,pointerId:hi}))}),Ke||this._fire(Q.pointerup,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ue+"ListenClick"]=!1,D.cancelable&&ue!=="touch"&&ue!=="pointer"&&D.preventDefault()}_contextmenu(D){this.setPointersPositions(D);const Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(K,{evt:D}):this._fire(K,{evt:D,target:this,currentTarget:this})}_wheel(D){this.setPointersPositions(D);const Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(ke,{evt:D}):this._fire(ke,{evt:D,target:this,currentTarget:this})}_pointercancel(D){this.setPointersPositions(D);const Q=d.getCapturedShape(D.pointerId)||this.getIntersection(this.getPointerPosition());Q&&Q._fireAndBubble(T,d.createEvent(D)),d.releaseCapture(D.pointerId)}_lostpointercapture(D){d.releaseCapture(D.pointerId)}setPointersPositions(D){const Q=this._getContentPosition();let ue=null,De=null;D=D||window.event,D.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(D.touches,ve=>{this._pointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})}),Array.prototype.forEach.call(D.changedTouches||D.touches,ve=>{this._changedPointerPositions.push({id:ve.identifier,x:(ve.clientX-Q.left)/Q.scaleX,y:(ve.clientY-Q.top)/Q.scaleY})})):(ue=(D.clientX-Q.left)/Q.scaleX,De=(D.clientY-Q.top)/Q.scaleY,this.pointerPos={x:ue,y:De},this._pointerPositions=[{x:ue,y:De,id:e.Util._getFirstPointerId(D)}],this._changedPointerPositions=[{x:ue,y:De,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 o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!i.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=f,(0,u._registerNode)(mt),n.Factory.addGetterSetter(mt,"container"),i.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach(We=>{We.batchDraw()})})})(N6);var cu={},Pt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=xe,n=ot,r=Ce,i=et,o=pe,l=xe,u=ss,d="hasShadow",f="shadowRGBA",g="patternImage",v="linearGradient",S="radialGradient";let w;function y(){return w||(w=n.Util.createCanvasElement().getContext("2d"),w)}t.shapes={};function E(j){const M=this.attrs.fillRule;M?j.fill(M):j.fill()}function C(j){j.stroke()}function P(j){const M=this.attrs.fillRule;M?j.fill(M):j.fill()}function k(j){j.stroke()}function m(){this._clearCache(d)}function x(){this._clearCache(f)}function T(){this._clearCache(g)}function F(){this._clearCache(v)}function L(){this._clearCache(S)}class O extends i.Node{constructor(M){super(M);let G;for(;G=n.Util.getRandomColor(),!(G&&!(G in t.shapes)););this.colorKey=G,t.shapes[G]=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(g,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const G=y().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(G&&G.setTransform){const K=new n.Transform;K.translate(this.fillPatternX(),this.fillPatternY()),K.rotate(e.Konva.getAngle(this.fillPatternRotation())),K.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),K.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const X=K.getMatrix(),ie=typeof DOMMatrix>"u"?{a:X[0],b:X[1],c:X[2],d:X[3],e:X[4],f:X[5]}:new DOMMatrix(X);G.setTransform(ie)}return G}}_getLinearGradient(){return this._getCache(v,this.__getLinearGradient)}__getLinearGradient(){const M=this.fillLinearGradientColorStops();if(M){const G=y(),K=this.fillLinearGradientStartPoint(),X=this.fillLinearGradientEndPoint(),ie=G.createLinearGradient(K.x,K.y,X.x,X.y);for(let Z=0;Zthis.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 G=this.getStage();if(!G)return!1;const K=G.bufferHitCanvas;return K.getContext().clear(),this.drawHit(K,void 0,!0),K.context.getImageData(Math.round(M.x),Math.round(M.y),1,1).data[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(M){var G;if(!((G=this.attrs.perfectDrawEnabled)!==null&&G!==void 0?G:!0))return!1;const X=M||this.hasFill(),ie=this.hasStroke(),Z=this.getAbsoluteOpacity()!==1;if(X&&ie&&Z)return!0;const he=this.hasShadow(),ke=this.shadowForStrokeEnabled();return!!(X&&ie&&he&&ke)}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 G=!1,K=this.getParent();for(;K;){if(K.isCached()){G=!0;break}K=K.getParent()}const X=M.skipTransform,ie=M.relativeTo||G&&this.getStage()||void 0,Z=this.getSelfRect(),ke=!M.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,V=Z.width+ke,ee=Z.height+ke,$=!M.skipShadow&&this.hasShadow(),J=$?this.shadowOffsetX():0,le=$?this.shadowOffsetY():0,Ne=V+Math.abs(J),at=ee+Math.abs(le),mt=$&&this.shadowBlur()||0,We=Ne+mt*2,D=at+mt*2,Q={width:We,height:D,x:-(ke/2+mt)+Math.min(J,0)+Z.x,y:-(ke/2+mt)+Math.min(le,0)+Z.y};return X?Q:this._transformedRect(Q,ie)}drawScene(M,G,K){const X=this.getLayer(),ie=M||X.getCanvas(),Z=ie.getContext(),he=this._getCanvasCache(),ke=this.getSceneFunc(),V=this.hasShadow();let ee;const $=G===this;if(!this.isVisible()&&!$)return this;if(he){Z.save();const J=this.getAbsoluteTransform(G).getMatrix();return Z.transform(J[0],J[1],J[2],J[3],J[4],J[5]),this._drawCachedSceneCanvas(Z),Z.restore(),this}if(!ke)return this;if(Z.save(),this._useBufferCanvas()){ee=this.getStage();const J=K||ee.bufferCanvas,le=J.getContext();le.clear(),le.save(),le._applyLineJoin(this);const Ne=this.getAbsoluteTransform(G).getMatrix();le.transform(Ne[0],Ne[1],Ne[2],Ne[3],Ne[4],Ne[5]),ke.call(this,le,this),le.restore();const at=J.pixelRatio;V&&Z._applyShadow(this),Z._applyOpacity(this),Z._applyGlobalCompositeOperation(this),Z.drawImage(J._canvas,J.x||0,J.y||0,J.width/at,J.height/at)}else{if(Z._applyLineJoin(this),!$){const J=this.getAbsoluteTransform(G).getMatrix();Z.transform(J[0],J[1],J[2],J[3],J[4],J[5]),Z._applyOpacity(this),Z._applyGlobalCompositeOperation(this)}V&&Z._applyShadow(this),ke.call(this,Z,this)}return Z.restore(),this}drawHit(M,G,K=!1){if(!this.shouldDrawHit(G,K))return this;const X=this.getLayer(),ie=M||X.hitCanvas,Z=ie&&ie.getContext(),he=this.hitFunc()||this.sceneFunc(),ke=this._getCanvasCache(),V=ke&&ke.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()"),V){Z.save();const $=this.getAbsoluteTransform(G).getMatrix();return Z.transform($[0],$[1],$[2],$[3],$[4],$[5]),this._drawCachedHitCanvas(Z),Z.restore(),this}if(!he)return this;if(Z.save(),Z._applyLineJoin(this),!(this===G)){const $=this.getAbsoluteTransform(G).getMatrix();Z.transform($[0],$[1],$[2],$[3],$[4],$[5])}return he.call(this,Z,this),Z.restore(),this}drawHitFromCache(M=0){const G=this._getCanvasCache(),K=this._getCachedSceneCanvas(),X=G.hit,ie=X.getContext(),Z=X.getWidth(),he=X.getHeight();ie.clear(),ie.drawImage(K._canvas,0,0,Z,he);try{const ke=ie.getImageData(0,0,Z,he),V=ke.data,ee=V.length,$=n.Util._hexToRgb(this.colorKey);for(let J=0;JM?(V[J]=$.r,V[J+1]=$.g,V[J+2]=$.b,V[J+3]=255):V[J+3]=0;ie.putImageData(ke,0,0)}catch(ke){n.Util.error("Unable to draw hit graph from cached scene canvas. "+ke.message)}return this}hasPointerCapture(M){return u.hasPointerCapture(M,this)}setPointerCapture(M){u.setPointerCapture(M,this)}releaseCapture(M){u.releaseCapture(M,this)}}t.Shape=O,O.prototype._fillFunc=E,O.prototype._strokeFunc=C,O.prototype._fillFuncHit=P,O.prototype._strokeFuncHit=k,O.prototype._centroid=!1,O.prototype.nodeType="Shape",(0,l._registerNode)(O),O.prototype.eventListeners={},O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",m),O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",x),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",T),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",F),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",L),r.Factory.addGetterSetter(O,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(O,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(O,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(O,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(O,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(O,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(O,"lineJoin"),r.Factory.addGetterSetter(O,"lineCap"),r.Factory.addGetterSetter(O,"sceneFunc"),r.Factory.addGetterSetter(O,"hitFunc"),r.Factory.addGetterSetter(O,"dash"),r.Factory.addGetterSetter(O,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(O,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(O,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(O,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillPatternImage"),r.Factory.addGetterSetter(O,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(O,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(O,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(O,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(O,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(O,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(O,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(O,"fillEnabled",!0),r.Factory.addGetterSetter(O,"strokeEnabled",!0),r.Factory.addGetterSetter(O,"shadowEnabled",!0),r.Factory.addGetterSetter(O,"dashEnabled",!0),r.Factory.addGetterSetter(O,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(O,"fillPriority","color"),r.Factory.addComponentsGetterSetter(O,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(O,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(O,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(O,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(O,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(O,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(O,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(O,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(O,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(O,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(O,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(O,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(O,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(O,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(O,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(O,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(O,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(O,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(O,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(O,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(O,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(O,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(O,"fillPatternRotation",0),r.Factory.addGetterSetter(O,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(O,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Pt);Object.defineProperty(cu,"__esModule",{value:!0});cu.Layer=void 0;const Hr=ot,B0=to,No=et,Lg=Ce,kv=fr,OC=pe,FC=Pt,AC=xe,MC="#",LC="beforeDraw",bC="draw",O6=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],DC=O6.length;let ka=class extends B0.Container{constructor(e){super(e),this.canvas=new kv.SceneCanvas,this.hitCanvas=new kv.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 i=0;i0)return{antialiased:!0};return{}}drawScene(e,n,r){const i=this.getLayer(),o=e||i&&i.getCanvas();return this._fire(LC,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),B0.Container.prototype.drawScene.call(this,o,n,r),this._fire(bC,{node:this}),this}drawHit(e,n){const r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),B0.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Hr.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Hr.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 Hr.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};cu.Layer=ka;ka.prototype.nodeType="Layer";(0,AC._registerNode)(ka);Lg.Factory.addGetterSetter(ka,"imageSmoothingEnabled",!0);Lg.Factory.addGetterSetter(ka,"clearBeforeDraw",!0);Lg.Factory.addGetterSetter(ka,"hitGraphEnabled",!0,(0,OC.getBooleanValidator)());var th={};Object.defineProperty(th,"__esModule",{value:!0});th.FastLayer=void 0;const IC=ot,jC=cu,UC=xe;class bg extends jC.Layer{constructor(e){super(e),this.listening(!1),IC.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}th.FastLayer=bg;bg.prototype.nodeType="FastLayer";(0,UC._registerNode)(bg);var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.Group=void 0;const zC=ot,BC=to,GC=xe;class Dg extends BC.Container{_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&zC.Util.throw("You may only add groups and shapes to groups.")}}Ea.Group=Dg;Dg.prototype.nodeType="Group";(0,GC._registerNode)(Dg);var Pa={};Object.defineProperty(Pa,"__esModule",{value:!0});Pa.Animation=void 0;const G0=xe,Ev=ot,H0=function(){return G0.glob.performance&&G0.glob.performance.now?function(){return G0.glob.performance.now()}:function(){return new Date().getTime()}}();class Ar{constructor(e,n){this.id=Ar.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:H0(),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 i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():y<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=y,this.update())}getTime(){return this._time}setPosition(y){this.prevPos=this._pos,this.propFunc(y),this._pos=y}getPosition(y){return y===void 0&&(y=this._time),this.func(y,this.begin,this._change,this.duration)}play(){this.state=u,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(y){this.pause(),this._time=y,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 y=this.getTimer()-this._startTime;this.state===u?this.setTime(y):this.state===d&&this.setTime(this.duration-y)}pause(){this.state=l,this.fire("onPause")}getTimer(){return new Date().getTime()}}class S{constructor(y){const E=this,C=y.node,P=C._id,k=y.easing||t.Easings.Linear,m=!!y.yoyo;let x,T;typeof y.duration>"u"?x=.3:y.duration===0?x=.001:x=y.duration,this.node=C,this._id=g++;const F=C.getLayer()||(C instanceof i.Konva.Stage?C.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 v(T,function(L){E._tweenFunc(L)},k,0,1,x*1e3,m),this._addListeners(),S.attrs[P]||(S.attrs[P]={}),S.attrs[P][this._id]||(S.attrs[P][this._id]={}),S.tweens[P]||(S.tweens[P]={});for(T in y)o[T]===void 0&&this._addAttr(T,y[T]);this.reset(),this.onFinish=y.onFinish,this.onReset=y.onReset,this.onUpdate=y.onUpdate}_addAttr(y,E){const C=this.node,P=C._id;let k,m,x,T,F;const L=S.tweens[P][y];L&&delete S.attrs[P][L][y];let O=C.getAttr(y);if(e.Util._isArray(E))if(k=[],m=Math.max(E.length,O.length),y==="points"&&E.length!==O.length&&(E.length>O.length?(T=O,O=e.Util._prepareArrayForTween(O,E,C.closed())):(x=E,E=e.Util._prepareArrayForTween(E,O,C.closed()))),y.indexOf("fill")===0)for(let j=0;j{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const y=this.node,E=S.attrs[y._id][this._id];E.points&&E.points.trueEnd&&y.setAttr("points",E.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const y=this.node,E=S.attrs[y._id][this._id];E.points&&E.points.trueStart&&y.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(y){return this.tween.seek(y*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const y=this.node._id,E=this._id,C=S.tweens[y];this.pause(),this.anim&&this.anim.stop();for(const P in C)delete S.tweens[y][P];delete S.attrs[y][E],S.tweens[y]&&(Object.keys(S.tweens[y]).length===0&&delete S.tweens[y],Object.keys(S.attrs[y]).length===0&&delete S.attrs[y])}}t.Tween=S,S.attrs={},S.tweens={},r.Node.prototype.to=function(w){const y=w.onFinish;w.node=this,w.onFinish=function(){this.destroy(),y&&y()},new S(w).play()},t.Easings={BackEaseIn(w,y,E,C){return E*(w/=C)*w*((1.70158+1)*w-1.70158)+y},BackEaseOut(w,y,E,C){return E*((w=w/C-1)*w*((1.70158+1)*w+1.70158)+1)+y},BackEaseInOut(w,y,E,C){let P=1.70158;return(w/=C/2)<1?E/2*(w*w*(((P*=1.525)+1)*w-P))+y:E/2*((w-=2)*w*(((P*=1.525)+1)*w+P)+2)+y},ElasticEaseIn(w,y,E,C,P,k){let m=0;return w===0?y:(w/=C)===1?y+E:(k||(k=C*.3),!P||P0?e:n),g=l*n,v=u*(u>0?e:n),S=d*(d>0?n:e);return{x:f,y:r?-1*S:v,width:g-f,height:S-v}}}nh.Arc=ci;ci.prototype._centroid=!0;ci.prototype.className="Arc";ci.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];(0,VC._registerNode)(ci);rh.Factory.addGetterSetter(ci,"innerRadius",0,(0,ih.getNumberValidator)());rh.Factory.addGetterSetter(ci,"outerRadius",0,(0,ih.getNumberValidator)());rh.Factory.addGetterSetter(ci,"angle",0,(0,ih.getNumberValidator)());rh.Factory.addGetterSetter(ci,"clockwise",!1,(0,ih.getBooleanValidator)());var sh={},du={};Object.defineProperty(du,"__esModule",{value:!0});du.Line=void 0;const oh=Ce,WC=xe,KC=Pt,A6=pe;function g1(t,e,n,r,i,o,l){const u=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),d=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),f=l*u/(u+d),g=l*d/(u+d),v=n-f*(i-t),S=r-f*(o-e),w=n+g*(i-t),y=r+g*(o-e);return[v,S,w,y]}function Nv(t,e){const n=t.length,r=[];for(let i=2;i4){const d=this.getTensionPoints(),f=d.length;for(u=o?0:4,o||e.quadraticCurveTo(d[0],d[1],d[2],d[3]);u{let f,g;const S=d/2;f=0;for(let w=0;w<20;w++)g=S*t.tValues[20][w]+S,f+=t.cValues[20][w]*r(l,u,g);return S*f};t.getCubicArcLength=e;const n=(l,u,d)=>{d===void 0&&(d=1);const f=l[0]-2*l[1]+l[2],g=u[0]-2*u[1]+u[2],v=2*l[1]-2*l[0],S=2*u[1]-2*u[0],w=4*(f*f+g*g),y=4*(f*v+g*S),E=v*v+S*S;if(w===0)return d*Math.sqrt(Math.pow(l[2]-l[0],2)+Math.pow(u[2]-u[0],2));const C=y/(2*w),P=E/w,k=d+C,m=P-C*C,x=k*k+m>0?Math.sqrt(k*k+m):0,T=C*C+m>0?Math.sqrt(C*C+m):0,F=C+Math.sqrt(C*C+m)!==0?m*Math.log(Math.abs((k+x)/(C+T))):0;return Math.sqrt(w)/2*(k*x-C*T+F)};t.getQuadraticArcLength=n;function r(l,u,d){const f=i(1,d,l),g=i(1,d,u),v=f*f+g*g;return Math.sqrt(v)}const i=(l,u,d)=>{const f=d.length-1;let g,v;if(f===0)return 0;if(l===0){v=0;for(let S=0;S<=f;S++)v+=t.binomialCoefficients[f][S]*Math.pow(1-u,f-S)*Math.pow(u,S)*d[S];return v}else{g=new Array(f);for(let S=0;S{let f=1,g=l/u,v=(l-d(g))/u,S=0;for(;f>.001;){const w=d(g+v),y=Math.abs(l-w)/u;if(y500)break}return g};t.t2length=o})(M6);Object.defineProperty(Na,"__esModule",{value:!0});Na.Path=void 0;const QC=Ce,qC=xe,YC=Pt,Ro=M6;class wt extends YC.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=wt.parsePathData(this.data()),this.pathLength=wt.getPathLength(this.dataArray)}_sceneFunc(e){const n=this.dataArray;e.beginPath();let r=!1;for(let i=0;ig?f:g,C=f>g?1:f/g,P=f>g?g/f:1;e.translate(u,d),e.rotate(w),e.scale(C,P),e.arc(0,0,E,v,v+S,1-y),e.scale(1/C,1/P),e.rotate(-w),e.translate(-u,-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 f=d.points[4],g=d.points[5],v=d.points[4]+g;let S=Math.PI/180;if(Math.abs(f-v)v;w-=S){const y=wt.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],w,0);e.push(y.x,y.y)}else for(let w=f+S;wn[i].pathLength;)e-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(e<.01)return n[i].command==="M"?(r=n[i].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[i].start.x,y:n[i].start.y};const l=n[i],u=l.points;switch(l.command){case"L":return wt.getPointOnLine(e,l.start.x,l.start.y,u[0],u[1]);case"C":return wt.getPointOnCubicBezier((0,Ro.t2length)(e,wt.getPathLength(n),E=>(0,Ro.getCubicArcLength)([l.start.x,u[0],u[2],u[4]],[l.start.y,u[1],u[3],u[5]],E)),l.start.x,l.start.y,u[0],u[1],u[2],u[3],u[4],u[5]);case"Q":return wt.getPointOnQuadraticBezier((0,Ro.t2length)(e,wt.getPathLength(n),E=>(0,Ro.getQuadraticArcLength)([l.start.x,u[0],u[2]],[l.start.y,u[1],u[3]],E)),l.start.x,l.start.y,u[0],u[1],u[2],u[3]);case"A":const d=u[0],f=u[1],g=u[2],v=u[3],S=u[5],w=u[6];let y=u[4];return y+=S*e/l.pathLength,wt.getPointOnEllipticalArc(d,f,g,v,y,w)}return null}static getPointOnLine(e,n,r,i,o,l,u){l=l??n,u=u??r;const d=this.getLineLength(n,r,i,o);if(d<1e-10)return{x:n,y:r};if(i===n)return{x:l,y:u+(o>r?e:-e)};const f=(o-r)/(i-n),g=Math.sqrt(e*e/(1+f*f))*(i0&&!isNaN(y[0]);){let E="",C=[];const P=u,k=d;let m,x,T,F,L,O,j,M,G,K;switch(w){case"l":u+=y.shift(),d+=y.shift(),E="L",C.push(u,d);break;case"L":u=y.shift(),d=y.shift(),C.push(u,d);break;case"m":const X=y.shift(),ie=y.shift();if(u+=X,d+=ie,E="M",o.length>2&&o[o.length-1].command==="z"){for(let Z=o.length-2;Z>=0;Z--)if(o[Z].command==="M"){u=o[Z].points[0]+X,d=o[Z].points[1]+ie;break}}C.push(u,d),w="l";break;case"M":u=y.shift(),d=y.shift(),E="M",C.push(u,d),w="L";break;case"h":u+=y.shift(),E="L",C.push(u,d);break;case"H":u=y.shift(),E="L",C.push(u,d);break;case"v":d+=y.shift(),E="L",C.push(u,d);break;case"V":d=y.shift(),E="L",C.push(u,d);break;case"C":C.push(y.shift(),y.shift(),y.shift(),y.shift()),u=y.shift(),d=y.shift(),C.push(u,d);break;case"c":C.push(u+y.shift(),d+y.shift(),u+y.shift(),d+y.shift()),u+=y.shift(),d+=y.shift(),E="C",C.push(u,d);break;case"S":x=u,T=d,m=o[o.length-1],m.command==="C"&&(x=u+(u-m.points[2]),T=d+(d-m.points[3])),C.push(x,T,y.shift(),y.shift()),u=y.shift(),d=y.shift(),E="C",C.push(u,d);break;case"s":x=u,T=d,m=o[o.length-1],m.command==="C"&&(x=u+(u-m.points[2]),T=d+(d-m.points[3])),C.push(x,T,u+y.shift(),d+y.shift()),u+=y.shift(),d+=y.shift(),E="C",C.push(u,d);break;case"Q":C.push(y.shift(),y.shift()),u=y.shift(),d=y.shift(),C.push(u,d);break;case"q":C.push(u+y.shift(),d+y.shift()),u+=y.shift(),d+=y.shift(),E="Q",C.push(u,d);break;case"T":x=u,T=d,m=o[o.length-1],m.command==="Q"&&(x=u+(u-m.points[0]),T=d+(d-m.points[1])),u=y.shift(),d=y.shift(),E="Q",C.push(x,T,u,d);break;case"t":x=u,T=d,m=o[o.length-1],m.command==="Q"&&(x=u+(u-m.points[0]),T=d+(d-m.points[1])),u+=y.shift(),d+=y.shift(),E="Q",C.push(x,T,u,d);break;case"A":F=y.shift(),L=y.shift(),O=y.shift(),j=y.shift(),M=y.shift(),G=u,K=d,u=y.shift(),d=y.shift(),E="A",C=this.convertEndpointToCenterParameterization(G,K,u,d,j,M,F,L,O);break;case"a":F=y.shift(),L=y.shift(),O=y.shift(),j=y.shift(),M=y.shift(),G=u,K=d,u+=y.shift(),d+=y.shift(),E="A",C=this.convertEndpointToCenterParameterization(G,K,u,d,j,M,F,L,O);break}o.push({command:E||w,points:C,start:{x:P,y:k},pathLength:this.calcLength(P,k,E||w,C)})}(w==="z"||w==="Z")&&o.push({command:"z",points:[],start:void 0,pathLength:0})}return o}static calcLength(e,n,r,i){let o,l,u,d;const f=wt;switch(r){case"L":return f.getLineLength(e,n,i[0],i[1]);case"C":return(0,Ro.getCubicArcLength)([e,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,Ro.getQuadraticArcLength)([e,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;const g=i[4],v=i[5],S=i[4]+v;let w=Math.PI/180;if(Math.abs(g-S)S;d-=w)u=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],d,0),o+=f.getLineLength(l.x,l.y,u.x,u.y),l=u;else for(d=g+w;d1&&(u*=Math.sqrt(w),d*=Math.sqrt(w));let y=Math.sqrt((u*u*(d*d)-u*u*(S*S)-d*d*(v*v))/(u*u*(S*S)+d*d*(v*v)));o===l&&(y*=-1),isNaN(y)&&(y=0);const E=y*u*S/d,C=y*-d*v/u,P=(e+r)/2+Math.cos(g)*E-Math.sin(g)*C,k=(n+i)/2+Math.sin(g)*E+Math.cos(g)*C,m=function(M){return Math.sqrt(M[0]*M[0]+M[1]*M[1])},x=function(M,G){return(M[0]*G[0]+M[1]*G[1])/(m(M)*m(G))},T=function(M,G){return(M[0]*G[1]=1&&(j=0),l===0&&j>0&&(j=j-2*Math.PI),l===1&&j<0&&(j=j+2*Math.PI),[P,k,u,d,F,j,g,l]}}Na.Path=wt;wt.prototype.className="Path";wt.prototype._attrsAffectingSize=["data"];(0,qC._registerNode)(wt);QC.Factory.addGetterSetter(wt,"data");Object.defineProperty(sh,"__esModule",{value:!0});sh.Arrow=void 0;const ah=Ce,XC=du,L6=pe,$C=xe,Rv=Na;class ro extends XC.Line{_sceneFunc(e){super._sceneFunc(e);const n=Math.PI*2,r=this.points();let i=r;const o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());const l=this.pointerLength(),u=r.length;let d,f;if(o){const S=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[u-2],r[u-1]],w=Rv.Path.calcLength(i[i.length-4],i[i.length-3],"C",S),y=Rv.Path.getPointOnQuadraticBezier(Math.min(1,1-l/w),S[0],S[1],S[2],S[3],S[4],S[5]);d=r[u-2]-y.x,f=r[u-1]-y.y}else d=r[u-2]-r[u-4],f=r[u-1]-r[u-3];const g=(Math.atan2(f,d)+n)%n,v=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(g),e.moveTo(0,0),e.lineTo(-l,v/2),e.lineTo(-l,-v/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),o?(d=(i[0]+i[2])/2-r[0],f=(i[1]+i[3])/2-r[1]):(d=r[2]-r[0],f=r[3]-r[1]),e.rotate((Math.atan2(-f,-d)+n)%n),e.moveTo(0,0),e.lineTo(-l,v/2),e.lineTo(-l,-v/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}}}sh.Arrow=ro;ro.prototype.className="Arrow";(0,$C._registerNode)(ro);ah.Factory.addGetterSetter(ro,"pointerLength",10,(0,L6.getNumberValidator)());ah.Factory.addGetterSetter(ro,"pointerWidth",10,(0,L6.getNumberValidator)());ah.Factory.addGetterSetter(ro,"pointerAtBeginning",!1);ah.Factory.addGetterSetter(ro,"pointerAtEnding",!0);var lh={};Object.defineProperty(lh,"__esModule",{value:!0});lh.Circle=void 0;const JC=Ce,ZC=Pt,ek=pe,tk=xe;class Ra extends ZC.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)}}lh.Circle=Ra;Ra.prototype._centroid=!0;Ra.prototype.className="Circle";Ra.prototype._attrsAffectingSize=["radius"];(0,tk._registerNode)(Ra);JC.Factory.addGetterSetter(Ra,"radius",0,(0,ek.getNumberValidator)());var uh={};Object.defineProperty(uh,"__esModule",{value:!0});uh.Ellipse=void 0;const Ig=Ce,nk=Pt,b6=pe,rk=xe;class as extends nk.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)}}uh.Ellipse=as;as.prototype.className="Ellipse";as.prototype._centroid=!0;as.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,rk._registerNode)(as);Ig.Factory.addComponentsGetterSetter(as,"radius",["x","y"]);Ig.Factory.addGetterSetter(as,"radiusX",0,(0,b6.getNumberValidator)());Ig.Factory.addGetterSetter(as,"radiusY",0,(0,b6.getNumberValidator)());var ch={};Object.defineProperty(ch,"__esModule",{value:!0});ch.Image=void 0;const V0=ot,io=Ce,ik=Pt,sk=xe,hu=pe;class $n extends ik.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(),i=this.cornerRadius(),o=this.attrs.image;let l;if(o){const u=this.attrs.cropWidth,d=this.attrs.cropHeight;u&&d?l=[o,this.cropX(),this.cropY(),u,d,0,0,n,r]:l=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?V0.Util.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),o&&(i&&e.clip(),e.drawImage.apply(e,l))}_hitFunc(e){const n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?V0.Util.drawRoundedRectPath(e,n,r,i):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 i=V0.Util.createImageElement();i.onload=function(){const o=new $n({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}}ch.Image=$n;$n.prototype.className="Image";(0,sk._registerNode)($n);io.Factory.addGetterSetter($n,"cornerRadius",0,(0,hu.getNumberOrArrayOfNumbersValidator)(4));io.Factory.addGetterSetter($n,"image");io.Factory.addComponentsGetterSetter($n,"crop",["x","y","width","height"]);io.Factory.addGetterSetter($n,"cropX",0,(0,hu.getNumberValidator)());io.Factory.addGetterSetter($n,"cropY",0,(0,hu.getNumberValidator)());io.Factory.addGetterSetter($n,"cropWidth",0,(0,hu.getNumberValidator)());io.Factory.addGetterSetter($n,"cropHeight",0,(0,hu.getNumberValidator)());var fa={};Object.defineProperty(fa,"__esModule",{value:!0});fa.Tag=fa.Label=void 0;const dh=Ce,ok=Pt,ak=Ea,jg=pe,D6=xe,I6=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],lk="Change.konva",uk="none",m1="up",y1="right",v1="down",S1="left",ck=I6.length;class Ug extends ak.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 i=function(){n._sync()};for(r=0;r{n=Math.min(n,l.x),r=Math.max(r,l.x),i=Math.min(i,l.y),o=Math.max(o,l.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}fh.RegularPolygon=oo;oo.prototype.className="RegularPolygon";oo.prototype._centroid=!0;oo.prototype._attrsAffectingSize=["radius"];(0,yk._registerNode)(oo);j6.Factory.addGetterSetter(oo,"radius",0,(0,U6.getNumberValidator)());j6.Factory.addGetterSetter(oo,"sides",0,(0,U6.getNumberValidator)());var ph={};Object.defineProperty(ph,"__esModule",{value:!0});ph.Ring=void 0;const z6=Ce,vk=Pt,B6=pe,Sk=xe,Tv=Math.PI*2;class ao extends vk.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Tv,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Tv,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)}}ph.Ring=ao;ao.prototype.className="Ring";ao.prototype._centroid=!0;ao.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Sk._registerNode)(ao);z6.Factory.addGetterSetter(ao,"innerRadius",0,(0,B6.getNumberValidator)());z6.Factory.addGetterSetter(ao,"outerRadius",0,(0,B6.getNumberValidator)());var gh={};Object.defineProperty(gh,"__esModule",{value:!0});gh.Sprite=void 0;const lo=Ce,_k=Pt,xk=Pa,G6=pe,wk=xe;class br extends _k.Shape{constructor(e){super(e),this._updated=!0,this.anim=new xk.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(),i=r*4,o=this.animations()[n],l=this.frameOffsets(),u=o[i+0],d=o[i+1],f=o[i+2],g=o[i+3],v=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,f,g),e.closePath(),e.fillStrokeShape(this)),v)if(l){const S=l[n],w=r*2;e.drawImage(v,u,d,f,g,S[w+0],S[w+1],f,g)}else e.drawImage(v,u,d,f,g,0,0,f,g)}_hitFunc(e){const n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],l=this.frameOffsets(),u=o[i+2],d=o[i+3];if(e.beginPath(),l){const f=l[n],g=r*2;e.rect(f[g+0],f[g+1],u,d)}else e.rect(0,0,u,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(),i=r[n],o=i.length/4;e{if(new RegExp("\\p{Emoji}","u").test(n)){const o=i[r+1];o&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(o)?(e.push(n+o),i[r+1]=""):e.push(n)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(n+(i[r+1]||""))?e.push(n+i[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 To="auto",Nk="center",H6="inherit",ol="justify",Rk="Change.konva",Tk="2d",Ov="-",V6="left",Ok="text",Fk="Text",Ak="top",Mk="bottom",Fv="middle",W6="normal",Lk="px ",Ac=" ",bk="right",Av="rtl",Dk="word",Ik="char",Mv="none",K0="…",K6=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],jk=K6.length;function Uk(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 Mc;function Q0(){return Mc||(Mc=_1.Util.createCanvasElement().getContext(Tk),Mc)}function zk(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Bk(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Gk(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let dt=class extends Ek.Shape{constructor(e){super(Gk(e)),this._partialTextX=0,this._partialTextY=0;for(let n=0;n1&&(k+=l)}}_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=_1.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(Ok,n),this}getWidth(){return this.attrs.width===To||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===To||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return _1.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,i,o,l,u,d,f,g,v,S;let w=Q0(),y=this.fontSize(),E;w.save(),w.font=this._getContextFont(),E=w.measureText(e),w.restore();const C=y/100;return{actualBoundingBoxAscent:(n=E.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*C,actualBoundingBoxDescent:(r=E.actualBoundingBoxDescent)!==null&&r!==void 0?r:0,actualBoundingBoxLeft:(i=E.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*C,actualBoundingBoxRight:(o=E.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*C,alphabeticBaseline:(l=E.alphabeticBaseline)!==null&&l!==void 0?l:0,emHeightAscent:(u=E.emHeightAscent)!==null&&u!==void 0?u:100*C,emHeightDescent:(d=E.emHeightDescent)!==null&&d!==void 0?d:-20*C,fontBoundingBoxAscent:(f=E.fontBoundingBoxAscent)!==null&&f!==void 0?f:91*C,fontBoundingBoxDescent:(g=E.fontBoundingBoxDescent)!==null&&g!==void 0?g:21*C,hangingBaseline:(v=E.hangingBaseline)!==null&&v!==void 0?v:72.80000305175781*C,ideographicBaseline:(S=E.ideographicBaseline)!==null&&S!==void 0?S:-21*C,width:E.width,height:y}}_getContextFont(){return this.fontStyle()+Ac+this.fontVariant()+Ac+(this.fontSize()+Lk)+Uk(this.fontFamily())}_addTextLine(e){this.align()===ol&&(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 Q0().measureText(e).width+n*r}_setTextData(){let e=this.text().split(` `),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,l=this.attrs.height,u=o!==To&&o!==void 0,d=l!==To&&l!==void 0,f=this.padding(),g=o-f*2,v=l-f*2,S=0,w=this.wrap(),y=w!==Mv,E=w!==Ik&&y,C=this.ellipsis();this.textArr=[],Q0().font=this._getContextFont();const P=C?this._getTextWidth(K0):0;for(let k=0,m=e.length;kg)for(;x.length>0;){let F=0,L=Es(x).length,O="",j=0;for(;F>>1,G=Es(x),K=G.slice(0,M+1).join(""),X=this._getTextWidth(K);(C&&d&&S+i>v?X+P:X)<=g?(F=M+1,O=K,j=X):L=M}if(O){if(E){const K=Es(x),X=Es(O),ie=K[X.length],Z=ie===Ac||ie===Ov;let he;if(Z&&j<=g)he=X.length;else{const ke=X.lastIndexOf(Ac),V=X.lastIndexOf(Ov);he=Math.max(ke,V)+1}he>0&&(F=he,O=K.slice(0,F).join(""),j=this._getTextWidth(O))}if(O=O.trimRight(),this._addTextLine(O),r=Math.max(r,j),S+=i,this._shouldHandleEllipsis(S)){this._tryToAddEllipsisToLastLine();break}if(x=Es(x).slice(F).join("").trimLeft(),x.length>0&&(T=this._getTextWidth(x),T<=g)){this._addTextLine(x),S+=i,r=Math.max(r,T);break}}else break}else this._addTextLine(x),S+=i,r=Math.max(r,T),this._shouldHandleEllipsis(S)&&kv)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){const n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==To&&i!==void 0,l=this.padding(),u=i-l*2;return!(this.wrap()!==Mv)||o&&e+r>u}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,n=e!==To&&e!==void 0,r=this.padding(),i=e-r*2,o=this.ellipsis(),l=this.textArr[this.textArr.length-1];!l||!o||(n&&(this._getTextWidth(l.text+K0)n?null:al.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=al.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(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&e.beginPath();for(let l=0;l=1){const r=n[0].p0;e.moveTo(r.x,r.y)}for(let r=0;rt+`.${$6}`).join(" "),Dv="nodesRect",Xk=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],$k={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},Jk="ontouchstart"in or.Konva._global;function Zk(t,e,n){if(t==="rotater")return n;e+=je.Util.degToRad($k[t]||0);const r=(je.Util.radToDeg(e)%360+360)%360;return je.Util._inRange(r,315+22.5,360)||je.Util._inRange(r,0,22.5)?"ns-resize":je.Util._inRange(r,45-22.5,45+22.5)?"nesw-resize":je.Util._inRange(r,90-22.5,90+22.5)?"ew-resize":je.Util._inRange(r,135-22.5,135+22.5)?"nwse-resize":je.Util._inRange(r,180-22.5,180+22.5)?"ns-resize":je.Util._inRange(r,225-22.5,225+22.5)?"nesw-resize":je.Util._inRange(r,270-22.5,270+22.5)?"ew-resize":je.Util._inRange(r,315-22.5,315+22.5)?"nwse-resize":(je.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}const Td=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function eE(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 J6(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=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:i}}function tE(t,e){const n=eE(t);return J6(t,e,n)}function nE(t,e,n){let r=e;for(let i=0;ii.isAncestorOf(this)?(je.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(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(i._attrsAffectingSize.length){const l=i._attrsAffectingSize.map(u=>u+"Change."+this._getEventNamespace()).join(" ");i.on(l,o)}i.on(Xk.map(l=>l+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),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 i=e.getAbsolutePosition(),o=i.x-n.x,l=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const d=u.getAbsolutePosition();u.setAbsolutePosition({x:d.x+o,y:d.y+l}),u.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(Dv),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Dv,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(r),l=e.getAbsolutePosition(r),u=i.x*o.x-e.offsetX()*o.x,d=i.y*o.y-e.offsetY()*o.y,f=(or.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),g={x:l.x+u*Math.cos(f)+d*Math.sin(-f),y:l.y+d*Math.cos(f)+u*Math.sin(f),width:i.width*o.x,height:i.height*o.y,rotation:f};return J6(g,-or.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(f=>{const g=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),v=[{x:g.x,y:g.y},{x:g.x+g.width,y:g.y},{x:g.x+g.width,y:g.y+g.height},{x:g.x,y:g.y+g.height}],S=f.getAbsoluteTransform();v.forEach(function(w){const y=S.point(w);n.push(y)})});const r=new je.Transform;r.rotate(-or.Konva.getAngle(this.rotation()));let i=1/0,o=1/0,l=-1/0,u=-1/0;n.forEach(function(f){const g=r.point(f);i===void 0&&(i=l=g.x,o=u=g.y),i=Math.min(i,g.x),o=Math.min(o,g.y),l=Math.max(l,g.x),u=Math.max(u,g.y)}),r.invert();const d=r.point({x:i,y:o});return{x:d.x,y:d.y,width:l-i,height:u-o,rotation:or.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(),Td.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const n=new Qk.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Jk?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{const i=or.Konva.getAngle(this.rotation()),o=this.rotateAnchorCursor(),l=Zk(e,i,o);n.getStage().content&&(n.getStage().content.style.cursor=l),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){const e=new Kk.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n,r){const i=r.getParent(),o=i.padding();n.beginPath(),n.rect(-o,-o,r.width()+o*2,r.height()+o*2),n.moveTo(r.width()/2,-o),i.rotateEnabled()&&i.rotateLineVisible()&&n.lineTo(r.width()/2,-i.rotateAnchorOffset()*je.Util._sign(r.height())-o),n.fillStrokeShape(r)},hitFunc:(n,r)=>{if(!this.shouldOverdrawWholeArea())return;const i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*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,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),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 l=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-l.x,y:u.y-l.y},x1++,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,i;const o=this.findOne("."+this._movingAnchorName),l=o.getStage();l.setPointersPositions(e);const u=l.getPointerPosition();let d={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const f=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(d=this.anchorDragBoundFunc()(f,d,e)),o.setAbsolutePosition(d);const g=o.getAbsolutePosition();if(f.x===g.x&&f.y===g.y)return;if(this._movingAnchorName==="rotater"){const k=this._getNodeRect();n=o.x()-k.width/2,r=-o.y()+k.height/2;let m=Math.atan2(-r,n)+Math.PI/2;k.height<0&&(m-=Math.PI);const T=or.Konva.getAngle(this.rotation())+m,F=or.Konva.getAngle(this.rotationSnapTolerance()),O=nE(this.rotationSnaps(),T,F)-k.rotation,j=tE(k,O);this._fitNodesInto(j,e);return}const v=this.shiftBehavior();let S;v==="inverted"?S=this.keepRatio()&&!e.shiftKey:v==="none"?S=this.keepRatio():S=this.keepRatio()||e.shiftKey;let w=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(S){const k=w?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(k.x-o.x(),2)+Math.pow(k.y-o.y(),2));const m=this.findOne(".top-left").x()>k.x?-1:1,x=this.findOne(".top-left").y()>k.y?-1:1;n=i*this.cos*m,r=i*this.sin*x,this.findOne(".top-left").x(k.x-n),this.findOne(".top-left").y(k.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(S){const k=w?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-k.x,2)+Math.pow(k.y-o.y(),2));const m=this.findOne(".top-right").x()k.y?-1:1;n=i*this.cos*m,r=i*this.sin*x,this.findOne(".top-right").x(k.x+n),this.findOne(".top-right").y(k.y-r)}var y=o.position();this.findOne(".top-left").y(y.y),this.findOne(".bottom-right").x(y.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(S){const k=w?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(k.x-o.x(),2)+Math.pow(o.y()-k.y,2));const m=k.x{var o;i._fire("transformend",{evt:e,target:i}),(o=i.getLayer())===null||o===void 0||o.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,n){const r=this._getNodeRect(),i=1;if(je.Util._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(je.Util._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const o=new je.Transform;if(o.rotate(or.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const S=o.point({x:-this.padding()*2,y:0});e.x+=S.x,e.y+=S.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=S.x,this._anchorDragOffset.y-=S.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const S=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=S.x,this._anchorDragOffset.y-=S.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const S=o.point({x:0,y:-this.padding()*2});e.x+=S.x,e.y+=S.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=S.x,this._anchorDragOffset.y-=S.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const S=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=S.x,this._anchorDragOffset.y-=S.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const S=this.boundBoxFunc()(r,e);S?e=S:je.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const l=1e7,u=new je.Transform;u.translate(r.x,r.y),u.rotate(r.rotation),u.scale(r.width/l,r.height/l);const d=new je.Transform,f=e.width/l,g=e.height/l;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(f),Math.abs(g))):(d.translate(e.x,e.y),d.rotate(e.rotation),d.scale(f,g));const v=d.multiply(u.invert());this._nodes.forEach(S=>{var w;const y=S.getParent().getAbsoluteTransform(),E=S.getTransform().copy();E.translate(S.offsetX(),S.offsetY());const C=new je.Transform;C.multiply(y.copy().invert()).multiply(v).multiply(y).multiply(E);const P=C.decompose();S.setAttrs(P),(w=S.getLayer())===null||w===void 0||w.batchDraw()}),this.rotation(je.Util._getRotation(e.rotation)),this._nodes.forEach(S=>{this._fire("transform",{evt:n,target:S}),S._fire("transform",{evt:n,target:S})}),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(je.Util._getRotation(n.rotation));const r=n.width,i=n.height,o=this.enabledAnchors(),l=this.resizeEnabled(),u=this.padding(),d=this.anchorSize(),f=this.find("._anchor");f.forEach(v=>{v.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+u,offsetY:d/2+u,visible:l&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:d/2+u,visible:l&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:d/2-u,offsetY:d/2+u,visible:l&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:d/2+u,visible:l&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:d/2-u,visible:l&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:d/2+u,offsetY:d/2-u,visible:l&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:d/2-u,visible:l&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:d/2-u,offsetY:d/2-u,visible:l&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*je.Util._sign(i)-u,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const g=this.anchorStyleFunc();g&&f.forEach(v=>{g(v)}),(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=""),bv.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Lv.Node.prototype.toObject.call(this)}clone(e){return Lv.Node.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};vh.Transformer=Te;Te.isTransforming=()=>x1>0;function rE(t){return t instanceof Array||je.Util.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){Td.indexOf(e)===-1&&je.Util.warn("Unknown anchor name: "+e+". Available names are: "+Td.join(", "))}),t||[]}Te.prototype.className="Transformer";(0,qk._registerNode)(Te);Le.Factory.addGetterSetter(Te,"enabledAnchors",Td,rE);Le.Factory.addGetterSetter(Te,"flipEnabled",!0,(0,cs.getBooleanValidator)());Le.Factory.addGetterSetter(Te,"resizeEnabled",!0);Le.Factory.addGetterSetter(Te,"anchorSize",10,(0,cs.getNumberValidator)());Le.Factory.addGetterSetter(Te,"rotateEnabled",!0);Le.Factory.addGetterSetter(Te,"rotateLineVisible",!0);Le.Factory.addGetterSetter(Te,"rotationSnaps",[]);Le.Factory.addGetterSetter(Te,"rotateAnchorOffset",50,(0,cs.getNumberValidator)());Le.Factory.addGetterSetter(Te,"rotateAnchorCursor","crosshair");Le.Factory.addGetterSetter(Te,"rotationSnapTolerance",5,(0,cs.getNumberValidator)());Le.Factory.addGetterSetter(Te,"borderEnabled",!0);Le.Factory.addGetterSetter(Te,"anchorStroke","rgb(0, 161, 255)");Le.Factory.addGetterSetter(Te,"anchorStrokeWidth",1,(0,cs.getNumberValidator)());Le.Factory.addGetterSetter(Te,"anchorFill","white");Le.Factory.addGetterSetter(Te,"anchorCornerRadius",0,(0,cs.getNumberValidator)());Le.Factory.addGetterSetter(Te,"borderStroke","rgb(0, 161, 255)");Le.Factory.addGetterSetter(Te,"borderStrokeWidth",1,(0,cs.getNumberValidator)());Le.Factory.addGetterSetter(Te,"borderDash");Le.Factory.addGetterSetter(Te,"keepRatio",!0);Le.Factory.addGetterSetter(Te,"shiftBehavior","default");Le.Factory.addGetterSetter(Te,"centeredScaling",!1);Le.Factory.addGetterSetter(Te,"ignoreStroke",!1);Le.Factory.addGetterSetter(Te,"padding",0,(0,cs.getNumberValidator)());Le.Factory.addGetterSetter(Te,"nodes");Le.Factory.addGetterSetter(Te,"node");Le.Factory.addGetterSetter(Te,"boundBoxFunc");Le.Factory.addGetterSetter(Te,"anchorDragBoundFunc");Le.Factory.addGetterSetter(Te,"anchorStyleFunc");Le.Factory.addGetterSetter(Te,"shouldOverdrawWholeArea",!1);Le.Factory.addGetterSetter(Te,"useSingleNodeRotation",!0);Le.Factory.backCompat(Te,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Sh={};Object.defineProperty(Sh,"__esModule",{value:!0});Sh.Wedge=void 0;const _h=Ce,iE=Pt,sE=xe,Z6=pe,oE=xe;class di extends iE.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,sE.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)}}Sh.Wedge=di;di.prototype.className="Wedge";di.prototype._centroid=!0;di.prototype._attrsAffectingSize=["radius"];(0,oE._registerNode)(di);_h.Factory.addGetterSetter(di,"radius",0,(0,Z6.getNumberValidator)());_h.Factory.addGetterSetter(di,"angle",0,(0,Z6.getNumberValidator)());_h.Factory.addGetterSetter(di,"clockwise",!1);_h.Factory.backCompat(di,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var xh={};Object.defineProperty(xh,"__esModule",{value:!0});xh.Blur=void 0;const Iv=Ce,aE=et,lE=pe;function jv(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const uE=[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],cE=[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 dE(t,e){const n=t.data,r=t.width,i=t.height;let o,l,u,d,f,g,v,S,w,y,E,C,P,k,m,x,T,F,L,O;const j=e+e+1,M=r-1,G=i-1,K=e+1,X=K*(K+1)/2,ie=new jv,Z=uE[e],he=cE[e];let ke=null,V=ie,ee=null,$=null;for(let J=1;J>he,L!==0?(L=255/L,n[l]=(d*Z>>he)*L,n[l+1]=(f*Z>>he)*L,n[l+2]=(g*Z>>he)*L):n[l]=n[l+1]=n[l+2]=0,d-=S,f-=w,g-=y,v-=E,S-=ee.r,w-=ee.g,y-=ee.b,E-=ee.a,o=u+((o=le+e+1)>he,L>0?(L=255/L,n[o]=(d*Z>>he)*L,n[o+1]=(f*Z>>he)*L,n[o+2]=(g*Z>>he)*L):n[o]=n[o+1]=n[o+2]=0,d-=S,f-=w,g-=y,v-=E,S-=ee.r,w-=ee.g,y-=ee.b,E-=ee.a,o=J+((o=Ne+K)0&&dE(e,n)};xh.Blur=hE;Iv.Factory.addGetterSetter(aE.Node,"blurRadius",0,(0,lE.getNumberValidator)(),Iv.Factory.afterSetFilter);var wh={};Object.defineProperty(wh,"__esModule",{value:!0});wh.Brighten=void 0;const Uv=Ce,fE=et,pE=pe,gE=function(t){const e=this.brightness()*255,n=t.data,r=n.length;for(let i=0;i255?255:i,o=o<0?0:o>255?255:o,l=l<0?0:l>255?255:l,n[u]=i,n[u+1]=o,n[u+2]=l};Ch.Contrast=vE;zv.Factory.addGetterSetter(mE.Node,"contrast",0,(0,yE.getNumberValidator)(),zv.Factory.afterSetFilter);var kh={};Object.defineProperty(kh,"__esModule",{value:!0});kh.Emboss=void 0;const ts=Ce,Eh=et,SE=ot,e8=pe,_E=function(t){const e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=t.data,l=t.width,u=t.height,d=l*4;let f=0,g=0,v=u;switch(r){case"top-left":f=-1,g=-1;break;case"top":f=-1,g=0;break;case"top-right":f=-1,g=1;break;case"right":f=0,g=1;break;case"bottom-right":f=1,g=1;break;case"bottom":f=1,g=0;break;case"bottom-left":f=1,g=-1;break;case"left":f=0,g=-1;break;default:SE.Util.error("Unknown emboss direction: "+r)}do{const S=(v-1)*d;let w=f;v+w<1&&(w=0),v+w>u&&(w=0);const y=(v-1+w)*l*4;let E=l;do{const C=S+(E-1)*4;let P=g;E+P<1&&(P=0),E+P>l&&(P=0);const k=y+(E-1+P)*4,m=o[C]-o[k],x=o[C+1]-o[k+1],T=o[C+2]-o[k+2];let F=m;const L=F>0?F:-F,O=x>0?x:-x,j=T>0?T:-T;if(O>L&&(F=x),j>L&&(F=T),F*=e,i){const M=o[C]+F,G=o[C+1]+F,K=o[C+2]+F;o[C]=M>255?255:M<0?0:M,o[C+1]=G>255?255:G<0?0:G,o[C+2]=K>255?255:K<0?0:K}else{let M=n-F;M<0?M=0:M>255&&(M=255),o[C]=o[C+1]=o[C+2]=M}}while(--E)}while(--v)};kh.Emboss=_E;ts.Factory.addGetterSetter(Eh.Node,"embossStrength",.5,(0,e8.getNumberValidator)(),ts.Factory.afterSetFilter);ts.Factory.addGetterSetter(Eh.Node,"embossWhiteLevel",.5,(0,e8.getNumberValidator)(),ts.Factory.afterSetFilter);ts.Factory.addGetterSetter(Eh.Node,"embossDirection","top-left",void 0,ts.Factory.afterSetFilter);ts.Factory.addGetterSetter(Eh.Node,"embossBlend",!1,void 0,ts.Factory.afterSetFilter);var Ph={};Object.defineProperty(Ph,"__esModule",{value:!0});Ph.Enhance=void 0;const Bv=Ce,xE=et,wE=pe;function X0(t,e,n,r,i){const o=n-e,l=i-r;if(o===0)return r+l/2;if(l===0)return r;let u=(t-e)/o;return u=l*u+r,u}const CE=function(t){const e=t.data,n=e.length;let r=e[0],i=r,o,l=e[1],u=l,d,f=e[2],g=f,v;const S=this.enhance();if(S===0)return;for(let m=0;mi&&(i=o),d=e[m+1],du&&(u=d),v=e[m+2],vg&&(g=v);i===r&&(i=255,r=0),u===l&&(u=255,l=0),g===f&&(g=255,f=0);let w,y,E,C,P,k;if(S>0)w=i+S*(255-i),y=r-S*(r-0),E=u+S*(255-u),C=l-S*(l-0),P=g+S*(255-g),k=f-S*(f-0);else{const m=(i+r)*.5;w=i+S*(i-m),y=r+S*(r-m);const x=(u+l)*.5;E=u+S*(u-x),C=l+S*(l-x);const T=(g+f)*.5;P=g+S*(g-T),k=f+S*(f-T)}for(let m=0;mf?S:f;const w=l,y=o,E=360/y*Math.PI/180;for(let C=0;Cf?S:f;const w=l,y=o,E=0;let C,P;for(g=0;ge&&(x=m,T=0,F=-1),i=0;i=0&&w=0&&y=0&&w=0&&y=255*4?255:0}return l}function jE(t,e,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),l=[];for(let u=0;u=0&&w=0&&y=n))for(let m=E;m=r)continue;const x=(n*m+k)*4;f+=l[x+0],g+=l[x+1],v+=l[x+2],S+=l[x+3],P+=1}f=f/P,g=g/P,v=v/P,S=S/P;for(let k=w;k=n))for(let m=E;m=r)continue;const x=(n*m+k)*4;l[x+0]=f,l[x+1]=g,l[x+2]=v,l[x+3]=S}}};Lh.Pixelate=KE;Wv.Factory.addGetterSetter(VE.Node,"pixelSize",8,(0,WE.getNumberValidator)(),Wv.Factory.afterSetFilter);var bh={};Object.defineProperty(bh,"__esModule",{value:!0});bh.Posterize=void 0;const Kv=Ce,QE=et,qE=pe,YE=function(t){const e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e;for(let o=0;o255?255:t<0?0:Math.round(t)});Fd.Factory.addGetterSetter(Kg.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});Fd.Factory.addGetterSetter(Kg.Node,"blue",0,XE.RGBComponent,Fd.Factory.afterSetFilter);var Ih={};Object.defineProperty(Ih,"__esModule",{value:!0});Ih.RGBA=void 0;const Yl=Ce,jh=et,JE=pe,ZE=function(t){const e=t.data,n=e.length,r=this.red(),i=this.green(),o=this.blue(),l=this.alpha();for(let u=0;u255?255:t<0?0:Math.round(t)});Yl.Factory.addGetterSetter(jh.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});Yl.Factory.addGetterSetter(jh.Node,"blue",0,JE.RGBComponent,Yl.Factory.afterSetFilter);Yl.Factory.addGetterSetter(jh.Node,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});var Uh={};Object.defineProperty(Uh,"__esModule",{value:!0});Uh.Sepia=void 0;const eP=function(t){const e=t.data,n=e.length;for(let r=0;r127&&(f=255-f),g>127&&(g=255-g),v>127&&(v=255-v),e[d]=f,e[d+1]=g,e[d+2]=v}while(--u)}while(--o)};zh.Solarize=tP;var Bh={};Object.defineProperty(Bh,"__esModule",{value:!0});Bh.Threshold=void 0;const Qv=Ce,nP=et,rP=pe,iP=function(t){const e=this.threshold()*255,n=t.data,r=n.length;for(let i=0;ib||p[R]!==_[b]){var B=` `+p[R].replace(" at new "," at ");return s.displayName&&B.includes("")&&(B=B.replace("",s.displayName)),B}while(1<=R&&0<=b);break}}}finally{ef=!1,Error.prepareStackTrace=c}return(s=s?s.displayName||s.name:"")?Ma(s):""}var R9=Object.prototype.hasOwnProperty,nf=[],co=-1;function pi(s){return{current:s}}function Qe(s){0>co||(s.current=nf[co],nf[co]=null,co--)}function He(s,a){co++,nf[co]=s.current,s.current=a}var gi={},Gt=pi(gi),ln=pi(!1),hs=gi;function ho(s,a){var c=s.type.contextTypes;if(!c)return gi;var h=s.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===a)return h.__reactInternalMemoizedMaskedChildContext;var p={},_;for(_ in c)p[_]=a[_];return h&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=a,s.__reactInternalMemoizedMaskedChildContext=p),p}function un(s){return s=s.childContextTypes,s!=null}function _u(){Qe(ln),Qe(Gt)}function om(s,a,c){if(Gt.current!==gi)throw Error(l(168));He(Gt,a),He(ln,c)}function am(s,a,c){var h=s.stateNode;if(a=a.childContextTypes,typeof h.getChildContext!="function")return c;h=h.getChildContext();for(var p in h)if(!(p in a))throw Error(l(108,O(s)||"Unknown",p));return o({},c,h)}function xu(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||gi,hs=Gt.current,He(Gt,s),He(ln,ln.current),!0}function lm(s,a,c){var h=s.stateNode;if(!h)throw Error(l(169));c?(s=am(s,a,hs),h.__reactInternalMemoizedMergedChildContext=s,Qe(ln),Qe(Gt),He(Gt,s)):Qe(ln),He(ln,c)}var Zn=Math.clz32?Math.clz32:F9,T9=Math.log,O9=Math.LN2;function F9(s){return s>>>=0,s===0?32:31-(T9(s)/O9|0)|0}var wu=64,Cu=4194304;function La(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function ku(s,a){var c=s.pendingLanes;if(c===0)return 0;var h=0,p=s.suspendedLanes,_=s.pingedLanes,R=c&268435455;if(R!==0){var b=R&~p;b!==0?h=La(b):(_&=R,_!==0&&(h=La(_)))}else R=c&~p,R!==0?h=La(R):_!==0&&(h=La(_));if(h===0)return 0;if(a!==0&&a!==h&&!(a&p)&&(p=h&-h,_=a&-a,p>=_||p===16&&(_&4194240)!==0))return a;if(h&4&&(h|=c&16),a=s.entangledLanes,a!==0)for(s=s.entanglements,a&=h;0c;c++)a.push(s);return a}function ba(s,a,c){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-Zn(a),s[a]=c}function L9(s,a){var c=s.pendingLanes&~a;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=a,s.mutableReadLanes&=a,s.entangledLanes&=a,a=s.entanglements;var h=s.eventTimes;for(s=s.expirationTimes;0>=R,p-=R,Ir=1<<32-Zn(a)+p|c<Ae?(Ft=ye,ye=null):Ft=ye.sibling;var Me=ne(U,ye,H[Ae],re);if(Me===null){ye===null&&(ye=Ft);break}s&&ye&&Me.alternate===null&&a(U,ye),I=_(Me,I,Ae),_e===null?de=Me:_e.sibling=Me,_e=Me,ye=Ft}if(Ae===H.length)return c(U,ye),$e&&ps(U,Ae),de;if(ye===null){for(;AeAe?(Ft=ye,ye=null):Ft=ye.sibling;var Ci=ne(U,ye,Me.value,re);if(Ci===null){ye===null&&(ye=Ft);break}s&&ye&&Ci.alternate===null&&a(U,ye),I=_(Ci,I,Ae),_e===null?de=Ci:_e.sibling=Ci,_e=Ci,ye=Ft}if(Me.done)return c(U,ye),$e&&ps(U,Ae),de;if(ye===null){for(;!Me.done;Ae++,Me=H.next())Me=me(U,Me.value,re),Me!==null&&(I=_(Me,I,Ae),_e===null?de=Me:_e.sibling=Me,_e=Me);return $e&&ps(U,Ae),de}for(ye=h(U,ye);!Me.done;Ae++,Me=H.next())Me=qe(ye,U,Ae,Me.value,re),Me!==null&&(s&&Me.alternate!==null&&ye.delete(Me.key===null?Ae:Me.key),I=_(Me,I,Ae),_e===null?de=Me:_e.sibling=Me,_e=Me);return s&&ye.forEach(function(S7){return a(U,S7)}),$e&&ps(U,Ae),de}function Gr(U,I,H,re){if(typeof H=="object"&&H!==null&&H.type===g&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case d:e:{for(var de=H.key,_e=I;_e!==null;){if(_e.key===de){if(de=H.type,de===g){if(_e.tag===7){c(U,_e.sibling),I=p(_e,H.props.children),I.return=U,U=I;break e}}else if(_e.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===m&&vm(de)===_e.type){c(U,_e.sibling),I=p(_e,H.props),I.ref=Ia(U,_e,H),I.return=U,U=I;break e}c(U,_e);break}else a(U,_e);_e=_e.sibling}H.type===g?(I=xs(H.props.children,U.mode,re,H.key),I.return=U,U=I):(re=lc(H.type,H.key,H.props,null,U.mode,re),re.ref=Ia(U,I,H),re.return=U,U=re)}return R(U);case f:e:{for(_e=H.key;I!==null;){if(I.key===_e)if(I.tag===4&&I.stateNode.containerInfo===H.containerInfo&&I.stateNode.implementation===H.implementation){c(U,I.sibling),I=p(I,H.children||[]),I.return=U,U=I;break e}else{c(U,I);break}else a(U,I);I=I.sibling}I=d0(H,U.mode,re),I.return=U,U=I}return R(U);case m:return _e=H._init,Gr(U,I,_e(H._payload),re)}if(Z(H))return ze(U,I,H,re);if(F(H))return fn(U,I,H,re);Fu(U,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,I!==null&&I.tag===6?(c(U,I.sibling),I=p(I,H),I.return=U,U=I):(c(U,I),I=c0(H,U.mode,re),I.return=U,U=I),R(U)):c(U,I)}return Gr}var mo=Sm(!0),_m=Sm(!1),Au=pi(null),Mu=null,yo=null,mf=null;function yf(){mf=yo=Mu=null}function xm(s,a,c){De?(He(Au,a._currentValue),a._currentValue=c):(He(Au,a._currentValue2),a._currentValue2=c)}function vf(s){var a=Au.current;Qe(Au),De?s._currentValue=a:s._currentValue2=a}function Sf(s,a,c){for(;s!==null;){var h=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),s===c)break;s=s.return}}function vo(s,a){Mu=s,mf=yo=null,s=s.dependencies,s!==null&&s.firstContext!==null&&(s.lanes&a&&(cn=!0),s.firstContext=null)}function bn(s){var a=De?s._currentValue:s._currentValue2;if(mf!==s)if(s={context:s,memoizedValue:a,next:null},yo===null){if(Mu===null)throw Error(l(308));yo=s,Mu.dependencies={lanes:0,firstContext:s}}else yo=yo.next=s;return a}var gs=null;function _f(s){gs===null?gs=[s]:gs.push(s)}function wm(s,a,c,h){var p=a.interleaved;return p===null?(c.next=c,_f(a)):(c.next=p.next,p.next=c),a.interleaved=c,_r(s,h)}function _r(s,a){s.lanes|=a;var c=s.alternate;for(c!==null&&(c.lanes|=a),c=s,s=s.return;s!==null;)s.childLanes|=a,c=s.alternate,c!==null&&(c.childLanes|=a),c=s,s=s.return;return c.tag===3?c.stateNode:null}var mi=!1;function xf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cm(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Ur(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function yi(s,a,c){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,we&2){var p=h.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),h.pending=a,_r(s,c)}return p=h.interleaved,p===null?(a.next=a,_f(h)):(a.next=p.next,p.next=a),h.interleaved=a,_r(s,c)}function Lu(s,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194240)!==0)){var h=a.lanes;h&=s.pendingLanes,c|=h,a.lanes=c,of(s,c)}}function km(s,a){var c=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var p=null,_=null;if(c=c.firstBaseUpdate,c!==null){do{var R={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};_===null?p=_=R:_=_.next=R,c=c.next}while(c!==null);_===null?p=_=a:_=_.next=a}else p=_=a;c={baseState:h.baseState,firstBaseUpdate:p,lastBaseUpdate:_,shared:h.shared,effects:h.effects},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=a:s.next=a,c.lastBaseUpdate=a}function bu(s,a,c,h){var p=s.updateQueue;mi=!1;var _=p.firstBaseUpdate,R=p.lastBaseUpdate,b=p.shared.pending;if(b!==null){p.shared.pending=null;var B=b,Y=B.next;B.next=null,R===null?_=Y:R.next=Y,R=B;var ae=s.alternate;ae!==null&&(ae=ae.updateQueue,b=ae.lastBaseUpdate,b!==R&&(b===null?ae.firstBaseUpdate=Y:b.next=Y,ae.lastBaseUpdate=B))}if(_!==null){var me=p.baseState;R=0,ae=Y=B=null,b=_;do{var ne=b.lane,qe=b.eventTime;if((h&ne)===ne){ae!==null&&(ae=ae.next={eventTime:qe,lane:0,tag:b.tag,payload:b.payload,callback:b.callback,next:null});e:{var ze=s,fn=b;switch(ne=a,qe=c,fn.tag){case 1:if(ze=fn.payload,typeof ze=="function"){me=ze.call(qe,me,ne);break e}me=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=fn.payload,ne=typeof ze=="function"?ze.call(qe,me,ne):ze,ne==null)break e;me=o({},me,ne);break e;case 2:mi=!0}}b.callback!==null&&b.lane!==0&&(s.flags|=64,ne=p.effects,ne===null?p.effects=[b]:ne.push(b))}else qe={eventTime:qe,lane:ne,tag:b.tag,payload:b.payload,callback:b.callback,next:null},ae===null?(Y=ae=qe,B=me):ae=ae.next=qe,R|=ne;if(b=b.next,b===null){if(b=p.shared.pending,b===null)break;ne=b,b=ne.next,ne.next=null,p.lastBaseUpdate=ne,p.shared.pending=null}}while(!0);if(ae===null&&(B=me),p.baseState=B,p.firstBaseUpdate=Y,p.lastBaseUpdate=ae,a=p.shared.interleaved,a!==null){p=a;do R|=p.lane,p=p.next;while(p!==a)}else _===null&&(p.shared.lanes=0);ys|=R,s.lanes=R,s.memoizedState=me}}function Em(s,a,c){if(s=a.effects,a.effects=null,s!==null)for(a=0;ac?c:4,s(!0);var h=Pf.transition;Pf.transition={};try{s(!1),a()}finally{Fe=c,Pf.transition=h}}function Vm(){return In().memoizedState}function K9(s,a,c){var h=_i(s);if(c={lane:h,action:c,hasEagerState:!1,eagerState:null,next:null},Wm(s))Km(a,c);else if(c=wm(s,a,c,h),c!==null){var p=Kt();jn(c,s,h,p),Qm(c,a,h)}}function Q9(s,a,c){var h=_i(s),p={lane:h,action:c,hasEagerState:!1,eagerState:null,next:null};if(Wm(s))Km(a,p);else{var _=s.alternate;if(s.lanes===0&&(_===null||_.lanes===0)&&(_=a.lastRenderedReducer,_!==null))try{var R=a.lastRenderedState,b=_(R,c);if(p.hasEagerState=!0,p.eagerState=b,er(b,R)){var B=a.interleaved;B===null?(p.next=p,_f(a)):(p.next=B.next,B.next=p),a.interleaved=p;return}}catch{}finally{}c=wm(s,a,p,h),c!==null&&(p=Kt(),jn(c,s,h,p),Qm(c,a,h))}}function Wm(s){var a=s.alternate;return s===nt||a!==null&&a===nt}function Km(s,a){za=ju=!0;var c=s.pending;c===null?a.next=a:(a.next=c.next,c.next=a),s.pending=a}function Qm(s,a,c){if(c&4194240){var h=a.lanes;h&=s.pendingLanes,c|=h,a.lanes=c,of(s,c)}}var Bu={readContext:bn,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},q9={readContext:bn,useCallback:function(s,a){return wr().memoizedState=[s,a===void 0?null:a],s},useContext:bn,useEffect:Dm,useImperativeHandle:function(s,a,c){return c=c!=null?c.concat([s]):null,Uu(4194308,4,Um.bind(null,a,s),c)},useLayoutEffect:function(s,a){return Uu(4194308,4,s,a)},useInsertionEffect:function(s,a){return Uu(4,2,s,a)},useMemo:function(s,a){var c=wr();return a=a===void 0?null:a,s=s(),c.memoizedState=[s,a],s},useReducer:function(s,a,c){var h=wr();return a=c!==void 0?c(a):a,h.memoizedState=h.baseState=a,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:a},h.queue=s,s=s.dispatch=K9.bind(null,nt,s),[h.memoizedState,s]},useRef:function(s){var a=wr();return s={current:s},a.memoizedState=s},useState:Lm,useDebugValue:Mf,useDeferredValue:function(s){return wr().memoizedState=s},useTransition:function(){var s=Lm(!1),a=s[0];return s=W9.bind(null,s[1]),wr().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,c){var h=nt,p=wr();if($e){if(c===void 0)throw Error(l(407));c=c()}else{if(c=a(),Ot===null)throw Error(l(349));ms&30||Tm(h,a,c)}p.memoizedState=c;var _={value:c,getSnapshot:a};return p.queue=_,Dm(Fm.bind(null,h,_,s),[s]),h.flags|=2048,Ha(9,Om.bind(null,h,_,c,a),void 0,null),c},useId:function(){var s=wr(),a=Ot.identifierPrefix;if($e){var c=jr,h=Ir;c=(h&~(1<<32-Zn(h)-1)).toString(32)+c,a=":"+a+"R"+c,c=Ba++,0n0&&(a.flags|=128,h=!0,Ka(p,!1),a.lanes=4194304)}else{if(!h)if(s=Du(_),s!==null){if(a.flags|=128,h=!0,s=s.updateQueue,s!==null&&(a.updateQueue=s,a.flags|=4),Ka(p,!0),p.tail===null&&p.tailMode==="hidden"&&!_.alternate&&!$e)return Vt(a),null}else 2*Rt()-p.renderingStartTime>n0&&c!==1073741824&&(a.flags|=128,h=!0,Ka(p,!1),a.lanes=4194304);p.isBackwards?(_.sibling=a.child,a.child=_):(s=p.last,s!==null?s.sibling=_:a.child=_,p.last=_)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=Rt(),a.sibling=null,s=tt.current,He(tt,h?s&1|2:s&1),a):(Vt(a),null);case 22:case 23:return a0(),c=a.memoizedState!==null,s!==null&&s.memoizedState!==null!==c&&(a.flags|=8192),c&&a.mode&1?kn&1073741824&&(Vt(a),ve&&a.subtreeFlags&6&&(a.flags|=8192)):Vt(a),null;case 24:return null;case 25:return null}throw Error(l(156,a.tag))}function n7(s,a){switch(hf(a),a.tag){case 1:return un(a.type)&&_u(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return _o(),Qe(ln),Qe(Gt),Ef(),s=a.flags,s&65536&&!(s&128)?(a.flags=s&-65537|128,a):null;case 5:return Cf(a),null;case 13:if(Qe(tt),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(l(340));go()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return Qe(tt),null;case 4:return _o(),null;case 10:return vf(a.type._context),null;case 22:case 23:return a0(),null;case 24:return null;default:return null}}var Qu=!1,Wt=!1,r7=typeof WeakSet=="function"?WeakSet:Set,se=null;function wo(s,a){var c=s.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(h){Je(s,a,h)}else c.current=null}function Vf(s,a,c){try{c()}catch(h){Je(s,a,h)}}var g2=!1;function i7(s,a){for(ee(s.containerInfo),se=a;se!==null;)if(s=se,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,se=a;else for(;se!==null;){s=se;try{var c=s.alternate;if(s.flags&1024)switch(s.tag){case 0:case 11:case 15:break;case 1:if(c!==null){var h=c.memoizedProps,p=c.memoizedState,_=s.stateNode,R=_.getSnapshotBeforeUpdate(s.elementType===s.type?h:nr(s.type,h),p);_.__reactInternalSnapshotBeforeUpdate=R}break;case 3:ve&&o9(s.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(b){Je(s,s.return,b)}if(a=s.sibling,a!==null){a.return=s.return,se=a;break}se=s.return}return c=g2,g2=!1,c}function Qa(s,a,c){var h=a.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var p=h=h.next;do{if((p.tag&s)===s){var _=p.destroy;p.destroy=void 0,_!==void 0&&Vf(a,c,_)}p=p.next}while(p!==h)}}function qu(s,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var c=a=a.next;do{if((c.tag&s)===s){var h=c.create;c.destroy=h()}c=c.next}while(c!==a)}}function Wf(s){var a=s.ref;if(a!==null){var c=s.stateNode;switch(s.tag){case 5:s=he(c);break;default:s=c}typeof a=="function"?a(s):a.current=s}}function m2(s){var a=s.alternate;a!==null&&(s.alternate=null,m2(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&Jn(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function y2(s){return s.tag===5||s.tag===3||s.tag===4}function v2(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||y2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Kf(s,a,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?Z8(c,s,a):q8(c,s);else if(h!==4&&(s=s.child,s!==null))for(Kf(s,a,c),s=s.sibling;s!==null;)Kf(s,a,c),s=s.sibling}function Qf(s,a,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?J8(c,s,a):Q8(c,s);else if(h!==4&&(s=s.child,s!==null))for(Qf(s,a,c),s=s.sibling;s!==null;)Qf(s,a,c),s=s.sibling}var It=null,rr=!1;function kr(s,a,c){for(c=c.child;c!==null;)qf(s,a,c),c=c.sibling}function qf(s,a,c){if(vr&&typeof vr.onCommitFiberUnmount=="function")try{vr.onCommitFiberUnmount(Eu,c)}catch{}switch(c.tag){case 5:Wt||wo(c,a);case 6:if(ve){var h=It,p=rr;It=null,kr(s,a,c),It=h,rr=p,It!==null&&(rr?t9(It,c.stateNode):e9(It,c.stateNode))}else kr(s,a,c);break;case 18:ve&&It!==null&&(rr?k9(It,c.stateNode):C9(It,c.stateNode));break;case 4:ve?(h=It,p=rr,It=c.stateNode.containerInfo,rr=!0,kr(s,a,c),It=h,rr=p):(Ge&&(h=c.stateNode.containerInfo,p=tm(h),$h(h,p)),kr(s,a,c));break;case 0:case 11:case 14:case 15:if(!Wt&&(h=c.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){p=h=h.next;do{var _=p,R=_.destroy;_=_.tag,R!==void 0&&(_&2||_&4)&&Vf(c,a,R),p=p.next}while(p!==h)}kr(s,a,c);break;case 1:if(!Wt&&(wo(c,a),h=c.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=c.memoizedProps,h.state=c.memoizedState,h.componentWillUnmount()}catch(b){Je(c,a,b)}kr(s,a,c);break;case 21:kr(s,a,c);break;case 22:c.mode&1?(Wt=(h=Wt)||c.memoizedState!==null,kr(s,a,c),Wt=h):kr(s,a,c);break;default:kr(s,a,c)}}function S2(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var c=s.stateNode;c===null&&(c=s.stateNode=new r7),a.forEach(function(h){var p=f7.bind(null,s,h);c.has(h)||(c.add(h),h.then(p,p))})}}function ir(s,a){var c=a.deletions;if(c!==null)for(var h=0;h";case Xu:return":has("+($f(s)||"")+")";case $u:return'[role="'+s.value+'"]';case Zu:return'"'+s.value+'"';case Ju:return'[data-testname="'+s.value+'"]';default:throw Error(l(365))}}function E2(s,a){var c=[];s=[s,0];for(var h=0;hp&&(p=R),h&=~_}if(h=p,h=Rt()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*o7(h/1960))-h,10s?16:s,Si===null)var h=!1;else{if(s=Si,Si=null,ic=0,we&6)throw Error(l(331));var p=we;for(we|=4,se=s.current;se!==null;){var _=se,R=_.child;if(se.flags&16){var b=_.deletions;if(b!==null){for(var B=0;BRt()-t0?vs(s,0):e0|=c),hn(s,a)}function L2(s,a){a===0&&(s.mode&1?(a=Cu,Cu<<=1,!(Cu&130023424)&&(Cu=4194304)):a=1);var c=Kt();s=_r(s,a),s!==null&&(ba(s,a,c),hn(s,c))}function h7(s){var a=s.memoizedState,c=0;a!==null&&(c=a.retryLane),L2(s,c)}function f7(s,a){var c=0;switch(s.tag){case 13:var h=s.stateNode,p=s.memoizedState;p!==null&&(c=p.retryLane);break;case 19:h=s.stateNode;break;default:throw Error(l(314))}h!==null&&h.delete(a),L2(s,c)}var b2;b2=function(s,a,c){if(s!==null)if(s.memoizedProps!==a.pendingProps||ln.current)cn=!0;else{if(!(s.lanes&c)&&!(a.flags&128))return cn=!1,e7(s,a,c);cn=!!(s.flags&131072)}else cn=!1,$e&&a.flags&1048576&&fm(a,Ru,a.index);switch(a.lanes=0,a.tag){case 2:var h=a.type;Vu(s,a),s=a.pendingProps;var p=ho(a,Gt.current);vo(a,c),p=Rf(null,a,h,s,p,c);var _=Tf();return a.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,un(h)?(_=!0,xu(a)):_=!1,a.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,xf(a),p.updater=Gu,a.stateNode=p,p._reactInternals=a,bf(a,h,s,c),a=Uf(null,a,h,!0,_,c)):(a.tag=0,$e&&_&&df(a),en(null,a,p,c),a=a.child),a;case 16:h=a.elementType;e:{switch(Vu(s,a),s=a.pendingProps,p=h._init,h=p(h._payload),a.type=h,p=a.tag=g7(h),s=nr(h,s),p){case 0:a=jf(null,a,h,s,c);break e;case 1:a=a2(null,a,h,s,c);break e;case 11:a=n2(null,a,h,s,c);break e;case 14:a=r2(null,a,h,nr(h.type,s),c);break e}throw Error(l(306,h,""))}return a;case 0:return h=a.type,p=a.pendingProps,p=a.elementType===h?p:nr(h,p),jf(s,a,h,p,c);case 1:return h=a.type,p=a.pendingProps,p=a.elementType===h?p:nr(h,p),a2(s,a,h,p,c);case 3:e:{if(l2(a),s===null)throw Error(l(387));h=a.pendingProps,_=a.memoizedState,p=_.element,Cm(s,a),bu(a,h,null,c);var R=a.memoizedState;if(h=R.element,Ke&&_.isDehydrated)if(_={element:h,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},a.updateQueue.baseState=_,a.memoizedState=_,a.flags&256){p=xo(Error(l(423)),a),a=u2(s,a,h,c,p);break e}else if(h!==p){p=xo(Error(l(424)),a),a=u2(s,a,h,c,p);break e}else for(Ke&&(Ln=g9(a.stateNode.containerInfo),Cn=a,$e=!0,tr=null,Da=!1),c=_m(a,null,h,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(go(),h===p){a=zr(s,a,c);break e}en(s,a,h,c)}a=a.child}return a;case 5:return Pm(a),s===null&&pf(a),h=a.type,p=a.pendingProps,_=s!==null?s.memoizedProps:null,R=p.children,mt(h,p)?R=null:_!==null&&mt(h,_)&&(a.flags|=32),o2(s,a),en(s,a,R,c),a.child;case 6:return s===null&&pf(a),null;case 13:return c2(s,a,c);case 4:return wf(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=mo(a,null,h,c):en(s,a,h,c),a.child;case 11:return h=a.type,p=a.pendingProps,p=a.elementType===h?p:nr(h,p),n2(s,a,h,p,c);case 7:return en(s,a,a.pendingProps,c),a.child;case 8:return en(s,a,a.pendingProps.children,c),a.child;case 12:return en(s,a,a.pendingProps.children,c),a.child;case 10:e:{if(h=a.type._context,p=a.pendingProps,_=a.memoizedProps,R=p.value,xm(a,h,R),_!==null)if(er(_.value,R)){if(_.children===p.children&&!ln.current){a=zr(s,a,c);break e}}else for(_=a.child,_!==null&&(_.return=a);_!==null;){var b=_.dependencies;if(b!==null){R=_.child;for(var B=b.firstContext;B!==null;){if(B.context===h){if(_.tag===1){B=Ur(-1,c&-c),B.tag=2;var Y=_.updateQueue;if(Y!==null){Y=Y.shared;var ae=Y.pending;ae===null?B.next=B:(B.next=ae.next,ae.next=B),Y.pending=B}}_.lanes|=c,B=_.alternate,B!==null&&(B.lanes|=c),Sf(_.return,c,a),b.lanes|=c;break}B=B.next}}else if(_.tag===10)R=_.type===a.type?null:_.child;else if(_.tag===18){if(R=_.return,R===null)throw Error(l(341));R.lanes|=c,b=R.alternate,b!==null&&(b.lanes|=c),Sf(R,c,a),R=_.sibling}else R=_.child;if(R!==null)R.return=_;else for(R=_;R!==null;){if(R===a){R=null;break}if(_=R.sibling,_!==null){_.return=R.return,R=_;break}R=R.return}_=R}en(s,a,p.children,c),a=a.child}return a;case 9:return p=a.type,h=a.pendingProps.children,vo(a,c),p=bn(p),h=h(p),a.flags|=1,en(s,a,h,c),a.child;case 14:return h=a.type,p=nr(h,a.pendingProps),p=nr(h.type,p),r2(s,a,h,p,c);case 15:return i2(s,a,a.type,a.pendingProps,c);case 17:return h=a.type,p=a.pendingProps,p=a.elementType===h?p:nr(h,p),Vu(s,a),a.tag=1,un(h)?(s=!0,xu(a)):s=!1,vo(a,c),Ym(a,h,p),bf(a,h,p,c),Uf(null,a,h,!0,s,c);case 19:return h2(s,a,c);case 22:return s2(s,a,c)}throw Error(l(156,a.tag))};function D2(s,a){return af(s,a)}function p7(s,a,c,h){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,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 Un(s,a,c,h){return new p7(s,a,c,h)}function u0(s){return s=s.prototype,!(!s||!s.isReactComponent)}function g7(s){if(typeof s=="function")return u0(s)?1:0;if(s!=null){if(s=s.$$typeof,s===E)return 11;if(s===k)return 14}return 2}function wi(s,a){var c=s.alternate;return c===null?(c=Un(s.tag,a,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=a,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&14680064,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,a=s.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c}function lc(s,a,c,h,p,_){var R=2;if(h=s,typeof s=="function")u0(s)&&(R=1);else if(typeof s=="string")R=5;else e:switch(s){case g:return xs(c.children,p,_,a);case v:R=8,p|=8;break;case S:return s=Un(12,c,a,p|2),s.elementType=S,s.lanes=_,s;case C:return s=Un(13,c,a,p),s.elementType=C,s.lanes=_,s;case P:return s=Un(19,c,a,p),s.elementType=P,s.lanes=_,s;case x:return uc(c,p,_,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case w:R=10;break e;case y:R=9;break e;case E:R=11;break e;case k:R=14;break e;case m:R=16,h=null;break e}throw Error(l(130,s==null?s:typeof s,""))}return a=Un(R,c,a,p),a.elementType=s,a.type=h,a.lanes=_,a}function xs(s,a,c,h){return s=Un(7,s,h,a),s.lanes=c,s}function uc(s,a,c,h){return s=Un(22,s,h,a),s.elementType=x,s.lanes=c,s.stateNode={isHidden:!1},s}function c0(s,a,c){return s=Un(6,s,null,a),s.lanes=c,s}function d0(s,a,c){return a=Un(4,s.children!==null?s.children:[],s.key,a),a.lanes=c,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function m7(s,a,c,h,p){this.tag=a,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ue,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sf(0),this.expirationTimes=sf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sf(0),this.identifierPrefix=h,this.onRecoverableError=p,Ke&&(this.mutableSourceEagerHydrationData=null)}function I2(s,a,c,h,p,_,R,b,B){return s=new m7(s,a,c,b,B),a===1?(a=1,_===!0&&(a|=8)):a=0,_=Un(3,null,null,a),s.current=_,_.stateNode=s,_.memoizedState={element:h,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},xf(_),s}function j2(s){if(!s)return gi;s=s._reactInternals;e:{if(j(s)!==s||s.tag!==1)throw Error(l(170));var a=s;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(un(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(l(171))}if(s.tag===1){var c=s.type;if(un(c))return am(s,c,a)}return a}function U2(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(l(188)):(s=Object.keys(s).join(","),Error(l(268,s)));return s=K(a),s===null?null:s.stateNode}function z2(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c=Y&&_>=me&&p<=ae&&R<=ne){s.splice(a,1);break}else if(h!==Y||c.width!==B.width||ne<_||me>R){if(!(_!==me||c.height!==B.height||aep)){Y>h&&(B.width+=Y-h,B.x=h),ae_&&(B.height+=me-_,B.y=_),nec&&(c=R)),R ")+` No matching component was found for: `)+s.join(" > ")}return null},n.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return he(s.child.stateNode);default:return s.child.stateNode}},n.injectIntoDevTools=function(s){if(s={bundleType:s.bundleType,version:s.version,rendererPackageName:s.rendererPackageName,rendererConfig:s.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:y7,findFiberByHostInstance:s.findFiberByHostInstance||v7,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{Eu=a.inject(s),vr=a}catch{}s=!!a.checkDCE}}return s},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(s,a,c,h){if(!Fa)throw Error(l(363));s=Jf(s,a);var p=K8(s,c,h).disconnect;return{disconnect:function(){p()}}},n.registerMutableSourceForHydration=function(s,a){var c=a._getVersion;c=c(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,c]:s.mutableSourceEagerHydrationData.push(a,c)},n.runWithPriority=function(s,a){var c=Fe;try{return Fe=s,a()}finally{Fe=c}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(s,a,c,h){var p=a.current,_=Kt(),R=_i(p);return c=j2(c),a.context===null?a.context=c:a.pendingContext=c,a=Ur(_,R),a.payload={element:s},h=h===void 0?null:h,h!==null&&(a.callback=h),s=yi(p,a,R),s!==null&&(jn(s,p,R,_),Lu(s,p,R)),R},n};r8.exports=HP;var VP=r8.exports;const WP=Md(VP);var i8={exports:{}},uo={};/** * @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. */uo.ConcurrentRoot=1;uo.ContinuousEventPriority=4;uo.DefaultEventPriority=16;uo.DiscreteEventPriority=1;uo.IdleEventPriority=536870912;uo.LegacyRoot=0;i8.exports=uo;var s8=i8.exports;const Xv={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let $v=!1,Jv=!1;const Qg=".react-konva-event",KP=`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 `,QP=`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 `,qP={};function Gh(t,e,n=qP){if(!$v&&"zIndex"in e&&(console.warn(QP),$v=!0),!Jv&&e.draggable){var r=e.x!==void 0||e.y!==void 0,i=e.onDragEnd||e.onDragMove;r&&!i&&(console.warn(KP),Jv=!0)}for(var o in n)if(!Xv[o]){var l=o.slice(0,2)==="on",u=n[o]!==e[o];if(l&&u){var d=o.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t.off(d,n[o])}var f=!e.hasOwnProperty(o);f&&t.setAttr(o,void 0)}var g=e._useStrictMode,v={},S=!1;const w={};for(var o in e)if(!Xv[o]){var l=o.slice(0,2)==="on",y=n[o]!==e[o];if(l&&y){var d=o.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e[o]&&(w[d]=e[o])}!l&&(e[o]!==n[o]||g&&e[o]!==t.getAttr(o))&&(S=!0,v[o]=e[o])}S&&(t.setAttrs(v),ds(t));for(var d in w)t.on(d+Qg,w[d])}function ds(t){if(!xe.Konva.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}const o8={},YP={};Xl.Node.prototype._applyProps=Gh;function XP(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),ds(t)}function $P(t,e,n){let r=Xl[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=Xl.Group);const i={},o={};for(var l in e){var u=l.slice(0,2)==="on";u?o[l]=e[l]:i[l]=e[l]}const d=new r(i);return Gh(d,o),d}function JP(t,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function ZP(t,e,n){return!1}function eN(t){return t}function tN(){return null}function nN(){return null}function rN(t,e,n,r){return YP}function iN(){}function sN(t){}function oN(t,e){return!1}function aN(){return o8}function lN(){return o8}const uN=setTimeout,cN=clearTimeout,dN=-1;function hN(t,e){return!1}const fN=!1,pN=!0,gN=!0;function mN(t,e){e.parent===t?e.moveToTop():t.add(e),ds(t)}function yN(t,e){e.parent===t?e.moveToTop():t.add(e),ds(t)}function a8(t,e,n){e._remove(),t.add(e),e.setZIndex(n.getZIndex()),ds(t)}function vN(t,e,n){a8(t,e,n)}function SN(t,e){e.destroy(),e.off(Qg),ds(t)}function _N(t,e){e.destroy(),e.off(Qg),ds(t)}function xN(t,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function wN(t,e,n){}function CN(t,e,n,r,i){Gh(t,i,r)}function kN(t){t.hide(),ds(t)}function EN(t){}function PN(t,e){(e.visible==null||e.visible)&&t.show()}function NN(t,e){}function RN(t){}function TN(){}const ON=()=>s8.DefaultEventPriority,FN=Object.freeze(Object.defineProperty({__proto__:null,appendChild:mN,appendChildToContainer:yN,appendInitialChild:XP,cancelTimeout:cN,clearContainer:RN,commitMount:wN,commitTextUpdate:xN,commitUpdate:CN,createInstance:$P,createTextInstance:JP,detachDeletedInstance:TN,finalizeInitialChildren:ZP,getChildHostContext:lN,getCurrentEventPriority:ON,getPublicInstance:eN,getRootHostContext:aN,hideInstance:kN,hideTextInstance:EN,idlePriority:yl.unstable_IdlePriority,insertBefore:a8,insertInContainerBefore:vN,isPrimaryRenderer:fN,noTimeout:dN,now:yl.unstable_now,prepareForCommit:tN,preparePortalMount:nN,prepareUpdate:rN,removeChild:SN,removeChildFromContainer:_N,resetAfterCommit:iN,resetTextContent:sN,run:yl.unstable_runWithPriority,scheduleTimeout:uN,shouldDeprioritizeSubtree:oN,shouldSetTextContent:hN,supportsMutation:gN,unhideInstance:PN,unhideTextInstance:NN,warnsIfNotActing:pN},Symbol.toStringTag,{value:"Module"}));var AN=Object.defineProperty,MN=Object.defineProperties,LN=Object.getOwnPropertyDescriptors,Zv=Object.getOwnPropertySymbols,bN=Object.prototype.hasOwnProperty,DN=Object.prototype.propertyIsEnumerable,e4=(t,e,n)=>e in t?AN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,t4=(t,e)=>{for(var n in e||(e={}))bN.call(e,n)&&e4(t,n,e[n]);if(Zv)for(var n of Zv(e))DN.call(e,n)&&e4(t,n,e[n]);return t},IN=(t,e)=>MN(t,LN(e)),n4,r4;typeof window<"u"&&((n4=window.document)!=null&&n4.createElement||((r4=window.navigator)==null?void 0:r4.product)==="ReactNative")?W.useLayoutEffect:W.useEffect;function l8(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=l8(r,e,n);if(i)return i;r=r.sibling}}function u8(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const i4=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=i4;return}return i4.apply(this,arguments)};const qg=u8(W.createContext(null));class c8 extends W.Component{render(){return W.createElement(qg.Provider,{value:this._reactInternals},this.props.children)}}function jN(){const t=W.useContext(qg);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=W.useId();return W.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=l8(r,!1,o=>{let l=o.memoizedState;for(;l;){if(l.memoizedState===e)return!0;l=l.next}});if(i)return i}},[t,e])}function UN(){const t=jN(),[e]=W.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==qg&&!e.has(i)&&e.set(i,W.useContext(u8(i)))}n=n.return}return e}function zN(){const t=UN();return W.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>W.createElement(e,null,W.createElement(n.Provider,IN(t4({},r),{value:t.get(n)}))),e=>W.createElement(c8,t4({},e))),[t])}function BN(t){const e=Mt.useRef({});return Mt.useLayoutEffect(()=>{e.current=t}),Mt.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const GN=t=>{const e=Mt.useRef(null),n=Mt.useRef(null),r=Mt.useRef(null),i=BN(t),o=zN(),l=u=>{const{forwardedRef:d}=t;d&&(typeof d=="function"?d(u):d.current=u)};return Mt.useLayoutEffect(()=>(n.current=new Xl.Stage({width:t.width,height:t.height,container:e.current}),l(n.current),r.current=ml.createContainer(n.current,s8.LegacyRoot,!1,null),ml.updateContainer(Mt.createElement(o,{},t.children),r.current),()=>{Xl.isBrowser&&(l(null),ml.updateContainer(null,r.current,null),n.current.destroy())}),[]),Mt.useLayoutEffect(()=>{l(n.current),Gh(n.current,t,i),ml.updateContainer(Mt.createElement(o,{},t.children),r.current,null)}),Mt.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})},HN="Layer",s4="Rect",VN="Text",WN="Transformer",ml=WP(FN);ml.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:Mt.version,rendererPackageName:"react-konva"});const KN=Mt.forwardRef((t,e)=>Mt.createElement(c8,{},Mt.createElement(GN,{...t,forwardedRef:e}))),QN={},o4=t=>{let e;const n=new Set,r=(g,v)=>{const S=typeof g=="function"?g(e):g;if(!Object.is(S,e)){const w=e;e=v??(typeof S!="object"||S===null)?S:Object.assign({},e,S),n.forEach(y=>y(e,w))}},i=()=>e,d={setState:r,getState:i,getInitialState:()=>f,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(QN?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=e=t(r,i,d);return d},qN=t=>t?o4(t):o4;var d8={exports:{}},h8={},f8={exports:{}},p8={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ma=W;function YN(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var XN=typeof Object.is=="function"?Object.is:YN,$N=ma.useState,JN=ma.useEffect,ZN=ma.useLayoutEffect,eR=ma.useDebugValue;function tR(t,e){var n=e(),r=$N({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return ZN(function(){i.value=n,i.getSnapshot=e,$0(i)&&o({inst:i})},[t,n,e]),JN(function(){return $0(i)&&o({inst:i}),t(function(){$0(i)&&o({inst:i})})},[t]),eR(n),n}function $0(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!XN(t,n)}catch{return!0}}function nR(t,e){return e()}var rR=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?nR:tR;p8.useSyncExternalStore=ma.useSyncExternalStore!==void 0?ma.useSyncExternalStore:rR;f8.exports=p8;var iR=f8.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Hh=W,sR=iR;function oR(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var aR=typeof Object.is=="function"?Object.is:oR,lR=sR.useSyncExternalStore,uR=Hh.useRef,cR=Hh.useEffect,dR=Hh.useMemo,hR=Hh.useDebugValue;h8.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=uR(null);if(o.current===null){var l={hasValue:!1,value:null};o.current=l}else l=o.current;o=dR(function(){function d(w){if(!f){if(f=!0,g=w,w=r(w),i!==void 0&&l.hasValue){var y=l.value;if(i(y,w))return v=y}return v=w}if(y=v,aR(g,w))return y;var E=r(w);return i!==void 0&&i(y,E)?(g=w,y):(g=w,v=E)}var f=!1,g,v,S=n===void 0?null:n;return[function(){return d(e())},S===null?void 0:function(){return d(S())}]},[e,n,r,i]);var u=lR(t,o[0],o[1]);return cR(function(){l.hasValue=!0,l.value=u},[u]),hR(u),u};d8.exports=h8;var fR=d8.exports;const pR=Md(fR),g8={},{useDebugValue:gR}=Mt,{useSyncExternalStoreWithSelector:mR}=pR;let a4=!1;const yR=t=>t;function vR(t,e=yR,n){(g8?"production":void 0)!=="production"&&n&&!a4&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),a4=!0);const r=mR(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return gR(r),r}const l4=t=>{(g8?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?qN(t):t,n=(r,i)=>vR(e,r,i);return Object.assign(n,e),n},m8=t=>t?l4(t):l4,y8=m8(t=>({covers:[],activeCover:null,selectedLayer:null,addCover:e=>t(n=>({covers:[e,...n.covers],activeCover:e})),updateCover:(e,n)=>t(r=>{var i;return{covers:r.covers.map(o=>o.id===e?{...o,...n,updatedAt:new Date}:o),activeCover:((i=r.activeCover)==null?void 0:i.id)===e?{...r.activeCover,...n,updatedAt:new Date}:r.activeCover}}),deleteCover:e=>t(n=>{var r;return{covers:n.covers.filter(i=>i.id!==e),activeCover:((r=n.activeCover)==null?void 0:r.id)===e?null:n.activeCover}}),setActiveCover:e=>t({activeCover:e,selectedLayer:null}),setSelectedLayer:e=>t({selectedLayer:e}),addLayer:e=>t(n=>{if(!n.activeCover)return n;const r={...n.activeCover,layers:[...n.activeCover.layers,e],updatedAt:new Date};return{activeCover:r,covers:n.covers.map(i=>i.id===n.activeCover.id?r:i)}}),updateLayer:(e,n)=>t(r=>{if(!r.activeCover)return r;const i={...r.activeCover,layers:r.activeCover.layers.map(o=>o.id===e?{...o,...n}:o),updatedAt:new Date};return{activeCover:i,covers:r.covers.map(o=>o.id===r.activeCover.id?i:o)}}),deleteLayer:e=>t(n=>{if(!n.activeCover)return n;const r={...n.activeCover,layers:n.activeCover.layers.filter(i=>i.id!==e),updatedAt:new Date};return{activeCover:r,covers:n.covers.map(i=>i.id===n.activeCover.id?r:i),selectedLayer:n.selectedLayer===e?null:n.selectedLayer}})}));function SR(){const{activeCover:t,addLayer:e,deleteLayer:n,selectedLayer:r,setSelectedLayer:i}=y8(),o=W.useRef(null),[l,u]=W.useState(.5),[d,f]=W.useState("title"),[g,v]=W.useState("");if(!t)return N.jsx("div",{className:"card text-center py-12",children:N.jsx("p",{className:"text-gray-500",children:"Select a cover from the gallery to edit"})});const S=()=>{if(!g.trim())return;const C={id:`text-${Date.now()}`,type:"text",x:t.width/2,y:t.height/2,content:g,fontSize:d==="title"?72:36,fontFamily:d==="title"?"Georgia":"Arial",fill:d==="title"?"#ffffff":"#f0f0f0",rotation:0,opacity:1};e(C),v("")},w=()=>{const C=o.current;if(C){const P=C.toDataURL({pixelRatio:2}),k=document.createElement("a");k.download=`${t.title.replace(/\s+/g,"-")}-cover.png`,k.href=P,k.click()}},y=800,E=t.height/t.width*y;return N.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[N.jsxs("div",{className:"lg:col-span-3 card p-4 bg-gray-100",children:[N.jsxs("div",{className:"flex items-center justify-between mb-4",children:[N.jsxs("h3",{className:"font-semibold text-gray-900",children:["Editing: ",t.title]}),N.jsx("div",{className:"flex items-center gap-2",children:N.jsxs("button",{onClick:w,className:"btn-primary flex items-center gap-2",children:[N.jsx(_6,{className:"w-4 h-4"}),"Export"]})})]}),N.jsx("div",{className:"bg-white rounded-lg shadow-sm overflow-hidden flex items-center justify-center p-4",children:N.jsx(KN,{ref:o,width:y,height:E,scaleX:l,scaleY:l,children:N.jsxs(HN,{children:[N.jsx(s4,{x:0,y:0,width:t.width,height:t.height,fill:t.backgroundColor}),t.backgroundImage&&N.jsx(s4,{x:0,y:0,width:t.width,height:t.height,opacity:.3}),t.layers.map(C=>N.jsx(VN,{id:C.id,x:C.x,y:C.y,text:C.content,fontSize:C.fontSize,fontFamily:C.fontFamily,fill:C.fill,rotation:C.rotation,opacity:C.opacity,draggable:!0,onClick:()=>i(C.id),onTap:()=>i(C.id)},C.id)),r&&N.jsx(WN,{nodes:t.layers.filter(C=>C.id===r).map(C=>document.getElementById(C.id))})]})})}),N.jsxs("div",{className:"mt-4 flex items-center justify-center gap-4",children:[N.jsx("button",{onClick:()=>u(Math.max(.2,l-.1)),className:"btn-secondary px-3",children:"-"}),N.jsxs("span",{className:"text-sm text-gray-600",children:[Math.round(l*100),"%"]}),N.jsx("button",{onClick:()=>u(Math.min(1,l+.1)),className:"btn-secondary px-3",children:"+"})]})]}),N.jsxs("div",{className:"space-y-4",children:[N.jsxs("div",{className:"card",children:[N.jsxs("h4",{className:"font-medium text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(h1,{className:"w-4 h-4"}),"Add Text"]}),N.jsxs("div",{className:"space-y-3",children:[N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Text Type"}),N.jsxs("div",{className:"flex gap-2",children:[N.jsx("button",{onClick:()=>f("title"),className:`flex-1 py-2 rounded-lg text-sm font-medium transition-colors ${d==="title"?"bg-primary-100 text-primary-700":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Title"}),N.jsx("button",{onClick:()=>f("author"),className:`flex-1 py-2 rounded-lg text-sm font-medium transition-colors ${d==="author"?"bg-primary-100 text-primary-700":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Author"})]})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Text Content"}),N.jsx("input",{type:"text",value:g,onChange:C=>v(C.target.value),placeholder:d==="title"?"Book Title":"Author Name",className:"input",onKeyPress:C=>C.key==="Enter"&&S()})]}),N.jsx("button",{onClick:S,disabled:!g.trim(),className:"btn-primary w-full",children:"Add Text Layer"})]})]}),N.jsxs("div",{className:"card",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-4",children:"Layers"}),t.layers.length===0?N.jsx("p",{className:"text-sm text-gray-500",children:"No layers yet"}):N.jsx("div",{className:"space-y-2",children:t.layers.map((C,P)=>{var k;return N.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg border cursor-pointer transition-colors ${r===C.id?"border-primary-500 bg-primary-50":"border-gray-200 hover:bg-gray-50"}`,onClick:()=>i(C.id),children:[N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx(h1,{className:"w-4 h-4 text-gray-400"}),N.jsx("span",{className:"text-sm truncate max-w-[150px]",children:((k=C.content)==null?void 0:k.substring(0,20))||`Layer ${P+1}`})]}),N.jsx("button",{onClick:m=>{m.stopPropagation(),n(C.id)},className:"p-1 hover:bg-red-100 rounded",children:N.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},C.id)})})]}),N.jsxs("div",{className:"card",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-4",children:"Cover Info"}),N.jsxs("div",{className:"space-y-2 text-sm",children:[N.jsxs("div",{className:"flex justify-between",children:[N.jsx("span",{className:"text-gray-500",children:"Dimensions"}),N.jsxs("span",{className:"text-gray-900",children:[t.width," x ",t.height]})]}),N.jsxs("div",{className:"flex justify-between",children:[N.jsx("span",{className:"text-gray-500",children:"Layers"}),N.jsx("span",{className:"text-gray-900",children:t.layers.length})]})]})]})]})]})}function v8(t,e){return function(){return t.apply(e,arguments)}}const{toString:_R}=Object.prototype,{getPrototypeOf:Yg}=Object,{iterator:Vh,toStringTag:S8}=Symbol,Wh=(t=>e=>{const n=_R.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),mr=t=>(t=t.toLowerCase(),e=>Wh(e)===t),Kh=t=>e=>typeof e===t,{isArray:Oa}=Array,ya=Kh("undefined");function pu(t){return t!==null&&!ya(t)&&t.constructor!==null&&!ya(t.constructor)&&xn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const _8=mr("ArrayBuffer");function xR(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&_8(t.buffer),e}const wR=Kh("string"),xn=Kh("function"),x8=Kh("number"),gu=t=>t!==null&&typeof t=="object",CR=t=>t===!0||t===!1,$c=t=>{if(Wh(t)!=="object")return!1;const e=Yg(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(S8 in t)&&!(Vh in t)},kR=t=>{if(!gu(t)||pu(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},ER=mr("Date"),PR=mr("File"),NR=t=>!!(t&&typeof t.uri<"u"),RR=t=>t&&typeof t.getParts<"u",TR=mr("Blob"),OR=mr("FileList"),FR=t=>gu(t)&&xn(t.pipe);function AR(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const u4=AR(),c4=typeof u4.FormData<"u"?u4.FormData:void 0,MR=t=>{let e;return t&&(c4&&t instanceof c4||xn(t.append)&&((e=Wh(t))==="formdata"||e==="object"&&xn(t.toString)&&t.toString()==="[object FormData]"))},LR=mr("URLSearchParams"),[bR,DR,IR,jR]=["ReadableStream","Request","Response","Headers"].map(mr),UR=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function mu(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Oa(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const Os=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,C8=t=>!ya(t)&&t!==Os;function C1(){const{caseless:t,skipUndefined:e}=C8(this)&&this||{},n={},r=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const l=t&&w8(n,o)||o;$c(n[l])&&$c(i)?n[l]=C1(n[l],i):$c(i)?n[l]=C1({},i):Oa(i)?n[l]=i.slice():(!e||!ya(i))&&(n[l]=i)};for(let i=0,o=arguments.length;i(mu(e,(i,o)=>{n&&xn(i)?Object.defineProperty(t,o,{value:v8(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),BR=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),GR=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},HR=(t,e,n,r)=>{let i,o,l;const u={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)l=i[o],(!r||r(l,t,e))&&!u[l]&&(e[l]=t[l],u[l]=!0);t=n!==!1&&Yg(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},VR=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},WR=t=>{if(!t)return null;if(Oa(t))return t;let e=t.length;if(!x8(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},KR=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Yg(Uint8Array)),QR=(t,e)=>{const r=(t&&t[Vh]).call(t);let i;for(;(i=r.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},qR=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},YR=mr("HTMLFormElement"),XR=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),d4=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),$R=mr("RegExp"),k8=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};mu(n,(i,o)=>{let l;(l=e(i,o,t))!==!1&&(r[o]=l||i)}),Object.defineProperties(t,r)},JR=t=>{k8(t,(e,n)=>{if(xn(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(xn(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},ZR=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return Oa(t)?r(t):r(String(t).split(e)),n},eT=()=>{},tT=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function nT(t){return!!(t&&xn(t.append)&&t[S8]==="FormData"&&t[Vh])}const rT=t=>{const e=new Array(10),n=(r,i)=>{if(gu(r)){if(e.indexOf(r)>=0)return;if(pu(r))return r;if(!("toJSON"in r)){e[i]=r;const o=Oa(r)?[]:{};return mu(r,(l,u)=>{const d=n(l,i+1);!ya(d)&&(o[u]=d)}),e[i]=void 0,o}}return r};return n(t,0)},iT=mr("AsyncFunction"),sT=t=>t&&(gu(t)||xn(t))&&xn(t.then)&&xn(t.catch),E8=((t,e)=>t?setImmediate:e?((n,r)=>(Os.addEventListener("message",({source:i,data:o})=>{i===Os&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Os.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",xn(Os.postMessage)),oT=typeof queueMicrotask<"u"?queueMicrotask.bind(Os):typeof process<"u"&&process.nextTick||E8,aT=t=>t!=null&&xn(t[Vh]),z={isArray:Oa,isArrayBuffer:_8,isBuffer:pu,isFormData:MR,isArrayBufferView:xR,isString:wR,isNumber:x8,isBoolean:CR,isObject:gu,isPlainObject:$c,isEmptyObject:kR,isReadableStream:bR,isRequest:DR,isResponse:IR,isHeaders:jR,isUndefined:ya,isDate:ER,isFile:PR,isReactNativeBlob:NR,isReactNative:RR,isBlob:TR,isRegExp:$R,isFunction:xn,isStream:FR,isURLSearchParams:LR,isTypedArray:KR,isFileList:OR,forEach:mu,merge:C1,extend:zR,trim:UR,stripBOM:BR,inherits:GR,toFlatObject:HR,kindOf:Wh,kindOfTest:mr,endsWith:VR,toArray:WR,forEachEntry:QR,matchAll:qR,isHTMLForm:YR,hasOwnProperty:d4,hasOwnProp:d4,reduceDescriptors:k8,freezeMethods:JR,toObjectSet:ZR,toCamelCase:XR,noop:eT,toFiniteNumber:tT,findKey:w8,global:Os,isContextDefined:C8,isSpecCompliantForm:nT,toJSONObject:rT,isAsyncFn:iT,isThenable:sT,setImmediate:E8,asap:oT,isIterable:aT};let fe=class P8 extends Error{static from(e,n,r,i,o,l){const u=new P8(e.message,n||e.code,r,i,o);return u.cause=e,u.name=e.name,e.status!=null&&u.status==null&&(u.status=e.status),l&&Object.assign(u,l),u}constructor(e,n,r,i,o){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),i&&(this.request=i),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:z.toJSONObject(this.config),code:this.code,status:this.status}}};fe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";fe.ERR_BAD_OPTION="ERR_BAD_OPTION";fe.ECONNABORTED="ECONNABORTED";fe.ETIMEDOUT="ETIMEDOUT";fe.ERR_NETWORK="ERR_NETWORK";fe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";fe.ERR_DEPRECATED="ERR_DEPRECATED";fe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";fe.ERR_BAD_REQUEST="ERR_BAD_REQUEST";fe.ERR_CANCELED="ERR_CANCELED";fe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";fe.ERR_INVALID_URL="ERR_INVALID_URL";const lT=null;function k1(t){return z.isPlainObject(t)||z.isArray(t)}function N8(t){return z.endsWith(t,"[]")?t.slice(0,-2):t}function J0(t,e,n){return t?t.concat(e).map(function(i,o){return i=N8(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function uT(t){return z.isArray(t)&&!t.some(k1)}const cT=z.toFlatObject(z,{},null,function(e){return/^is[A-Z]/.test(e)});function Qh(t,e,n){if(!z.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,C){return!z.isUndefined(C[E])});const r=n.metaTokens,i=n.visitor||g,o=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&z.isSpecCompliantForm(e);if(!z.isFunction(i))throw new TypeError("visitor must be a function");function f(y){if(y===null)return"";if(z.isDate(y))return y.toISOString();if(z.isBoolean(y))return y.toString();if(!d&&z.isBlob(y))throw new fe("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(y)||z.isTypedArray(y)?d&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function g(y,E,C){let P=y;if(z.isReactNative(e)&&z.isReactNativeBlob(y))return e.append(J0(C,E,o),f(y)),!1;if(y&&!C&&typeof y=="object"){if(z.endsWith(E,"{}"))E=r?E:E.slice(0,-2),y=JSON.stringify(y);else if(z.isArray(y)&&uT(y)||(z.isFileList(y)||z.endsWith(E,"[]"))&&(P=z.toArray(y)))return E=N8(E),P.forEach(function(m,x){!(z.isUndefined(m)||m===null)&&e.append(l===!0?J0([E],x,o):l===null?E:E+"[]",f(m))}),!1}return k1(y)?!0:(e.append(J0(C,E,o),f(y)),!1)}const v=[],S=Object.assign(cT,{defaultVisitor:g,convertValue:f,isVisitable:k1});function w(y,E){if(!z.isUndefined(y)){if(v.indexOf(y)!==-1)throw Error("Circular reference detected in "+E.join("."));v.push(y),z.forEach(y,function(P,k){(!(z.isUndefined(P)||P===null)&&i.call(e,P,z.isString(k)?k.trim():k,E,S))===!0&&w(P,E?E.concat(k):[k])}),v.pop()}}if(!z.isObject(t))throw new TypeError("data must be an object");return w(t),e}function h4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Xg(t,e){this._pairs=[],t&&Qh(t,this,e)}const R8=Xg.prototype;R8.append=function(e,n){this._pairs.push([e,n])};R8.toString=function(e){const n=e?function(r){return e.call(this,r,h4)}:h4;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function dT(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function T8(t,e,n){if(!e)return t;const r=n&&n.encode||dT,i=z.isFunction(n)?{serialize:n}:n,o=i&&i.serialize;let l;if(o?l=o(e,i):l=z.isURLSearchParams(e)?e.toString():new Xg(e,i).toString(r),l){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+l}return t}class f4{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){z.forEach(this.handlers,function(r){r!==null&&e(r)})}}const $g={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},hT=typeof URLSearchParams<"u"?URLSearchParams:Xg,fT=typeof FormData<"u"?FormData:null,pT=typeof Blob<"u"?Blob:null,gT={isBrowser:!0,classes:{URLSearchParams:hT,FormData:fT,Blob:pT},protocols:["http","https","file","blob","url","data"]},Jg=typeof window<"u"&&typeof document<"u",E1=typeof navigator=="object"&&navigator||void 0,mT=Jg&&(!E1||["ReactNative","NativeScript","NS"].indexOf(E1.product)<0),yT=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vT=Jg&&window.location.href||"http://localhost",ST=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Jg,hasStandardBrowserEnv:mT,hasStandardBrowserWebWorkerEnv:yT,navigator:E1,origin:vT},Symbol.toStringTag,{value:"Module"})),$t={...ST,...gT};function _T(t,e){return Qh(t,new $t.classes.URLSearchParams,{visitor:function(n,r,i,o){return $t.isNode&&z.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function xT(t){return z.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function wT(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r=n.length;return l=!l&&z.isArray(i)?i.length:l,d?(z.hasOwnProp(i,l)?i[l]=[i[l],r]:i[l]=r,!u):((!i[l]||!z.isObject(i[l]))&&(i[l]=[]),e(n,r,i[l],o)&&z.isArray(i[l])&&(i[l]=wT(i[l])),!u)}if(z.isFormData(t)&&z.isFunction(t.entries)){const n={};return z.forEachEntry(t,(r,i)=>{e(xT(r),i,n,0)}),n}return null}function CT(t,e,n){if(z.isString(t))try{return(e||JSON.parse)(t),z.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const yu={transitional:$g,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=z.isObject(e);if(o&&z.isHTMLForm(e)&&(e=new FormData(e)),z.isFormData(e))return i?JSON.stringify(O8(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return _T(e,this.formSerializer).toString();if((u=z.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return Qh(u?{"files[]":e}:e,d&&new d,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),CT(e)):e}],transformResponse:[function(e){const n=this.transitional||yu.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(r&&!this.responseType||i)){const l=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(u){if(l)throw u.name==="SyntaxError"?fe.from(u,fe.ERR_BAD_RESPONSE,this,null,this.response):u}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$t.classes.FormData,Blob:$t.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],t=>{yu.headers[t]={}});const kT=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ET=t=>{const e={};let n,r,i;return t&&t.split(` `).forEach(function(l){i=l.indexOf(":"),n=l.substring(0,i).trim().toLowerCase(),r=l.substring(i+1).trim(),!(!n||e[n]&&kT[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},p4=Symbol("internals");function ul(t){return t&&String(t).trim().toLowerCase()}function Jc(t){return t===!1||t==null?t:z.isArray(t)?t.map(Jc):String(t).replace(/[\r\n]+$/,"")}function PT(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const NT=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Z0(t,e,n,r,i){if(z.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!z.isString(e)){if(z.isString(r))return e.indexOf(r)!==-1;if(z.isRegExp(r))return r.test(e)}}function RT(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function TT(t,e){const n=z.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,l){return this[r].call(this,e,i,o,l)},configurable:!0})})}let wn=class{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function o(u,d,f){const g=ul(d);if(!g)throw new Error("header name must be a non-empty string");const v=z.findKey(i,g);(!v||i[v]===void 0||f===!0||f===void 0&&i[v]!==!1)&&(i[v||d]=Jc(u))}const l=(u,d)=>z.forEach(u,(f,g)=>o(f,g,d));if(z.isPlainObject(e)||e instanceof this.constructor)l(e,n);else if(z.isString(e)&&(e=e.trim())&&!NT(e))l(ET(e),n);else if(z.isObject(e)&&z.isIterable(e)){let u={},d,f;for(const g of e){if(!z.isArray(g))throw TypeError("Object iterator must return a key-value pair");u[f=g[0]]=(d=u[f])?z.isArray(d)?[...d,g[1]]:[d,g[1]]:g[1]}l(u,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=ul(e),e){const r=z.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return PT(i);if(z.isFunction(n))return n.call(this,i,r);if(z.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ul(e),e){const r=z.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Z0(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function o(l){if(l=ul(l),l){const u=z.findKey(r,l);u&&(!n||Z0(r,r[u],u,n))&&(delete r[u],i=!0)}}return z.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!e||Z0(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,r={};return z.forEach(this,(i,o)=>{const l=z.findKey(r,o);if(l){n[l]=Jc(i),delete n[o];return}const u=e?RT(o):String(o).trim();u!==o&&delete n[o],n[u]=Jc(i),r[u]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return z.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&z.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[p4]=this[p4]={accessors:{}}).accessors,i=this.prototype;function o(l){const u=ul(l);r[u]||(TT(i,l),r[u]=!0)}return z.isArray(e)?e.forEach(o):o(e),this}};wn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);z.reduceDescriptors(wn.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});z.freezeMethods(wn);function ep(t,e){const n=this||yu,r=e||n,i=wn.from(r.headers);let o=r.data;return z.forEach(t,function(u){o=u.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function F8(t){return!!(t&&t.__CANCEL__)}let vu=class extends fe{constructor(e,n,r){super(e??"canceled",fe.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function A8(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new fe("Request failed with status code "+n.status,[fe.ERR_BAD_REQUEST,fe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function OT(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function FT(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,l;return e=e!==void 0?e:1e3,function(d){const f=Date.now(),g=r[o];l||(l=f),n[i]=d,r[i]=f;let v=o,S=0;for(;v!==i;)S+=n[v++],v=v%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),f-l{n=g,i=null,o&&(clearTimeout(o),o=null),t(...f)};return[(...f)=>{const g=Date.now(),v=g-n;v>=r?l(f,g):(i=f,o||(o=setTimeout(()=>{o=null,l(i)},r-v)))},()=>i&&l(i)]}const Ad=(t,e,n=3)=>{let r=0;const i=FT(50,250);return AT(o=>{const l=o.loaded,u=o.lengthComputable?o.total:void 0,d=l-r,f=i(d),g=l<=u;r=l;const v={loaded:l,total:u,progress:u?l/u:void 0,bytes:d,rate:f||void 0,estimated:f&&u&&g?(u-l)/f:void 0,event:o,lengthComputable:u!=null,[e?"download":"upload"]:!0};t(v)},n)},g4=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},m4=t=>(...e)=>z.asap(()=>t(...e)),MT=$t.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,$t.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL($t.origin),$t.navigator&&/(msie|trident)/i.test($t.navigator.userAgent)):()=>!0,LT=$t.hasStandardBrowserEnv?{write(t,e,n,r,i,o,l){if(typeof document>"u")return;const u=[`${t}=${encodeURIComponent(e)}`];z.isNumber(n)&&u.push(`expires=${new Date(n).toUTCString()}`),z.isString(r)&&u.push(`path=${r}`),z.isString(i)&&u.push(`domain=${i}`),o===!0&&u.push("secure"),z.isString(l)&&u.push(`SameSite=${l}`),document.cookie=u.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function bT(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function DT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function M8(t,e,n){let r=!bT(e);return t&&(r||n==!1)?DT(t,e):e}const y4=t=>t instanceof wn?{...t}:t;function $s(t,e){e=e||{};const n={};function r(f,g,v,S){return z.isPlainObject(f)&&z.isPlainObject(g)?z.merge.call({caseless:S},f,g):z.isPlainObject(g)?z.merge({},g):z.isArray(g)?g.slice():g}function i(f,g,v,S){if(z.isUndefined(g)){if(!z.isUndefined(f))return r(void 0,f,v,S)}else return r(f,g,v,S)}function o(f,g){if(!z.isUndefined(g))return r(void 0,g)}function l(f,g){if(z.isUndefined(g)){if(!z.isUndefined(f))return r(void 0,f)}else return r(void 0,g)}function u(f,g,v){if(v in e)return r(f,g);if(v in t)return r(void 0,f)}const d={url:o,method:o,data:o,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:u,headers:(f,g,v)=>i(y4(f),y4(g),v,!0)};return z.forEach(Object.keys({...t,...e}),function(g){if(g==="__proto__"||g==="constructor"||g==="prototype")return;const v=z.hasOwnProp(d,g)?d[g]:i,S=v(t[g],e[g],g);z.isUndefined(S)&&v!==u||(n[g]=S)}),n}const L8=t=>{const e=$s({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:l,auth:u}=e;if(e.headers=l=wn.from(l),e.url=T8(M8(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),u&&l.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),z.isFormData(n)){if($t.hasStandardBrowserEnv||$t.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(z.isFunction(n.getHeaders)){const d=n.getHeaders(),f=["content-type","content-length"];Object.entries(d).forEach(([g,v])=>{f.includes(g.toLowerCase())&&l.set(g,v)})}}if($t.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(e)),r||r!==!1&&MT(e.url))){const d=i&&o&<.read(o);d&&l.set(i,d)}return e},IT=typeof XMLHttpRequest<"u",jT=IT&&function(t){return new Promise(function(n,r){const i=L8(t);let o=i.data;const l=wn.from(i.headers).normalize();let{responseType:u,onUploadProgress:d,onDownloadProgress:f}=i,g,v,S,w,y;function E(){w&&w(),y&&y(),i.cancelToken&&i.cancelToken.unsubscribe(g),i.signal&&i.signal.removeEventListener("abort",g)}let C=new XMLHttpRequest;C.open(i.method.toUpperCase(),i.url,!0),C.timeout=i.timeout;function P(){if(!C)return;const m=wn.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),T={data:!u||u==="text"||u==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:m,config:t,request:C};A8(function(L){n(L),E()},function(L){r(L),E()},T),C=null}"onloadend"in C?C.onloadend=P:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(P)},C.onabort=function(){C&&(r(new fe("Request aborted",fe.ECONNABORTED,t,C)),C=null)},C.onerror=function(x){const T=x&&x.message?x.message:"Network Error",F=new fe(T,fe.ERR_NETWORK,t,C);F.event=x||null,r(F),C=null},C.ontimeout=function(){let x=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const T=i.transitional||$g;i.timeoutErrorMessage&&(x=i.timeoutErrorMessage),r(new fe(x,T.clarifyTimeoutError?fe.ETIMEDOUT:fe.ECONNABORTED,t,C)),C=null},o===void 0&&l.setContentType(null),"setRequestHeader"in C&&z.forEach(l.toJSON(),function(x,T){C.setRequestHeader(T,x)}),z.isUndefined(i.withCredentials)||(C.withCredentials=!!i.withCredentials),u&&u!=="json"&&(C.responseType=i.responseType),f&&([S,y]=Ad(f,!0),C.addEventListener("progress",S)),d&&C.upload&&([v,w]=Ad(d),C.upload.addEventListener("progress",v),C.upload.addEventListener("loadend",w)),(i.cancelToken||i.signal)&&(g=m=>{C&&(r(!m||m.type?new vu(null,t,C):m),C.abort(),C=null)},i.cancelToken&&i.cancelToken.subscribe(g),i.signal&&(i.signal.aborted?g():i.signal.addEventListener("abort",g)));const k=OT(i.url);if(k&&$t.protocols.indexOf(k)===-1){r(new fe("Unsupported protocol "+k+":",fe.ERR_BAD_REQUEST,t));return}C.send(o||null)})},UT=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const o=function(f){if(!i){i=!0,u();const g=f instanceof Error?f:this.reason;r.abort(g instanceof fe?g:new vu(g instanceof Error?g.message:g))}};let l=e&&setTimeout(()=>{l=null,o(new fe(`timeout of ${e}ms exceeded`,fe.ETIMEDOUT))},e);const u=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),t=null)};t.forEach(f=>f.addEventListener("abort",o));const{signal:d}=r;return d.unsubscribe=()=>z.asap(u),d}},zT=function*(t,e){let n=t.byteLength;if(n{const i=BT(t,e);let o=0,l,u=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:f,value:g}=await i.next();if(f){u(),d.close();return}let v=g.byteLength;if(n){let S=o+=v;n(S)}d.enqueue(new Uint8Array(g))}catch(f){throw u(f),f}},cancel(d){return u(d),i.return()}},{highWaterMark:2})},S4=64*1024,{isFunction:bc}=z,HT=(({Request:t,Response:e})=>({Request:t,Response:e}))(z.global),{ReadableStream:_4,TextEncoder:x4}=z.global,w4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},VT=t=>{t=z.merge.call({skipUndefined:!0},HT,t);const{fetch:e,Request:n,Response:r}=t,i=e?bc(e):typeof fetch=="function",o=bc(n),l=bc(r);if(!i)return!1;const u=i&&bc(_4),d=i&&(typeof x4=="function"?(y=>E=>y.encode(E))(new x4):async y=>new Uint8Array(await new n(y).arrayBuffer())),f=o&&u&&w4(()=>{let y=!1;const E=new _4,C=new n($t.origin,{body:E,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return E.cancel(),y&&!C}),g=l&&u&&w4(()=>z.isReadableStream(new r("").body)),v={stream:g&&(y=>y.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!v[y]&&(v[y]=(E,C)=>{let P=E&&E[y];if(P)return P.call(E);throw new fe(`Response type '${y}' is not supported`,fe.ERR_NOT_SUPPORT,C)})});const S=async y=>{if(y==null)return 0;if(z.isBlob(y))return y.size;if(z.isSpecCompliantForm(y))return(await new n($t.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(z.isArrayBufferView(y)||z.isArrayBuffer(y))return y.byteLength;if(z.isURLSearchParams(y)&&(y=y+""),z.isString(y))return(await d(y)).byteLength},w=async(y,E)=>{const C=z.toFiniteNumber(y.getContentLength());return C??S(E)};return async y=>{let{url:E,method:C,data:P,signal:k,cancelToken:m,timeout:x,onDownloadProgress:T,onUploadProgress:F,responseType:L,headers:O,withCredentials:j="same-origin",fetchOptions:M}=L8(y),G=e||fetch;L=L?(L+"").toLowerCase():"text";let K=UT([k,m&&m.toAbortSignal()],x),X=null;const ie=K&&K.unsubscribe&&(()=>{K.unsubscribe()});let Z;try{if(F&&f&&C!=="get"&&C!=="head"&&(Z=await w(O,P))!==0){let J=new n(E,{method:"POST",body:P,duplex:"half"}),le;if(z.isFormData(P)&&(le=J.headers.get("content-type"))&&O.setContentType(le),J.body){const[Ne,at]=g4(Z,Ad(m4(F)));P=v4(J.body,S4,Ne,at)}}z.isString(j)||(j=j?"include":"omit");const he=o&&"credentials"in n.prototype,ke={...M,signal:K,method:C.toUpperCase(),headers:O.normalize().toJSON(),body:P,duplex:"half",credentials:he?j:void 0};X=o&&new n(E,ke);let V=await(o?G(X,M):G(E,ke));const ee=g&&(L==="stream"||L==="response");if(g&&(T||ee&&ie)){const J={};["status","statusText","headers"].forEach(mt=>{J[mt]=V[mt]});const le=z.toFiniteNumber(V.headers.get("content-length")),[Ne,at]=T&&g4(le,Ad(m4(T),!0))||[];V=new r(v4(V.body,S4,Ne,()=>{at&&at(),ie&&ie()}),J)}L=L||"text";let $=await v[z.findKey(v,L)||"text"](V,y);return!ee&&ie&&ie(),await new Promise((J,le)=>{A8(J,le,{data:$,headers:wn.from(V.headers),status:V.status,statusText:V.statusText,config:y,request:X})})}catch(he){throw ie&&ie(),he&&he.name==="TypeError"&&/Load failed|fetch/i.test(he.message)?Object.assign(new fe("Network Error",fe.ERR_NETWORK,y,X,he&&he.response),{cause:he.cause||he}):fe.from(he,he&&he.code,y,X,he&&he.response)}}},WT=new Map,b8=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:i}=e,o=[r,i,n];let l=o.length,u=l,d,f,g=WT;for(;u--;)d=o[u],f=g.get(d),f===void 0&&g.set(d,f=u?new Map:VT(e)),g=f;return f};b8();const Zg={http:lT,xhr:jT,fetch:{get:b8}};z.forEach(Zg,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const C4=t=>`- ${t}`,KT=t=>z.isFunction(t)||t===null||t===!1;function QT(t,e){t=z.isArray(t)?t:[t];const{length:n}=t;let r,i;const o={};for(let l=0;l`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build"));let u=n?l.length>1?`since : `+l.map(C4).join(` `):" "+C4(l[0]):"as no adapter specified";throw new fe("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return i}const D8={getAdapter:QT,adapters:Zg};function tp(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new vu(null,t)}function k4(t){return tp(t),t.headers=wn.from(t.headers),t.data=ep.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),D8.getAdapter(t.adapter||yu.adapter,t)(t).then(function(r){return tp(t),r.data=ep.call(t,t.transformResponse,r),r.headers=wn.from(r.headers),r},function(r){return F8(r)||(tp(t),r&&r.response&&(r.response.data=ep.call(t,t.transformResponse,r.response),r.response.headers=wn.from(r.response.headers))),Promise.reject(r)})}const I8="1.14.0",qh={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{qh[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const E4={};qh.transitional=function(e,n,r){function i(o,l){return"[Axios v"+I8+"] Transitional option '"+o+"'"+l+(r?". "+r:"")}return(o,l,u)=>{if(e===!1)throw new fe(i(l," has been removed"+(n?" in "+n:"")),fe.ERR_DEPRECATED);return n&&!E4[l]&&(E4[l]=!0,console.warn(i(l," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,l,u):!0}};qh.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function qT(t,e,n){if(typeof t!="object")throw new fe("options must be an object",fe.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],l=e[o];if(l){const u=t[o],d=u===void 0||l(u,o,t);if(d!==!0)throw new fe("option "+o+" must be "+d,fe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new fe("Unknown option "+o,fe.ERR_BAD_OPTION)}}const Zc={assertOptions:qT,validators:qh},Bn=Zc.validators;let Hs=class{constructor(e){this.defaults=e||{},this.interceptors={request:new f4,response:new f4}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=$s(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Zc.assertOptions(r,{silentJSONParsing:Bn.transitional(Bn.boolean),forcedJSONParsing:Bn.transitional(Bn.boolean),clarifyTimeoutError:Bn.transitional(Bn.boolean),legacyInterceptorReqResOrdering:Bn.transitional(Bn.boolean)},!1),i!=null&&(z.isFunction(i)?n.paramsSerializer={serialize:i}:Zc.assertOptions(i,{encode:Bn.function,serialize:Bn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Zc.assertOptions(n,{baseUrl:Bn.spelling("baseURL"),withXsrfToken:Bn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=o&&z.merge(o.common,o[n.method]);o&&z.forEach(["delete","get","head","post","put","patch","common"],y=>{delete o[y]}),n.headers=wn.concat(l,o);const u=[];let d=!0;this.interceptors.request.forEach(function(E){if(typeof E.runWhen=="function"&&E.runWhen(n)===!1)return;d=d&&E.synchronous;const C=n.transitional||$g;C&&C.legacyInterceptorReqResOrdering?u.unshift(E.fulfilled,E.rejected):u.push(E.fulfilled,E.rejected)});const f=[];this.interceptors.response.forEach(function(E){f.push(E.fulfilled,E.rejected)});let g,v=0,S;if(!d){const y=[k4.bind(this),void 0];for(y.unshift(...u),y.push(...f),S=y.length,g=Promise.resolve(n);v{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const l=new Promise(u=>{r.subscribe(u),o=u}).then(i);return l.cancel=function(){r.unsubscribe(o)},l},e(function(o,l,u){r.reason||(r.reason=new vu(o,l,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new j8(function(i){e=i}),cancel:e}}};function XT(t){return function(n){return t.apply(null,n)}}function $T(t){return z.isObject(t)&&t.isAxiosError===!0}const P1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(P1).forEach(([t,e])=>{P1[e]=t});function U8(t){const e=new Hs(t),n=v8(Hs.prototype.request,e);return z.extend(n,Hs.prototype,e,{allOwnKeys:!0}),z.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return U8($s(t,i))},n}const pt=U8(yu);pt.Axios=Hs;pt.CanceledError=vu;pt.CancelToken=YT;pt.isCancel=F8;pt.VERSION=I8;pt.toFormData=Qh;pt.AxiosError=fe;pt.Cancel=pt.CanceledError;pt.all=function(e){return Promise.all(e)};pt.spread=XT;pt.isAxiosError=$T;pt.mergeConfig=$s;pt.AxiosHeaders=wn;pt.formToJSON=t=>O8(z.isHTMLForm(t)?new FormData(t):t);pt.getAdapter=D8.getAdapter;pt.HttpStatusCode=P1;pt.default=pt;const{Axios:yO,AxiosError:vO,CanceledError:SO,isCancel:_O,CancelToken:xO,VERSION:wO,all:CO,Cancel:kO,isAxiosError:EO,spread:PO,toFormData:NO,AxiosHeaders:RO,HttpStatusCode:TO,formToJSON:OO,getAdapter:FO,mergeConfig:AO}=pt,Vn=pt.create({baseURL:"/api",headers:{"Content-Type":"application/json"}}),np={getAll:()=>Vn.get("/covers"),upload:t=>{const e=new FormData;return e.append("image",t),Vn.post("/covers/upload",e,{headers:{"Content-Type":"multipart/form-data"}})},delete:t=>Vn.delete(`/covers/${t}`),process:(t,e)=>{const n=new FormData;return n.append("image",t),e&&Object.entries(e).forEach(([r,i])=>{n.append(r,i)}),Vn.post("/covers/process",n,{headers:{"Content-Type":"multipart/form-data"}})},generate:(t,e)=>Vn.post("/covers/generate",{prompt:t,genre:e})},Yh={getGenres:()=>Vn.get("/books/genres"),getGenre:t=>Vn.get(`/books/genres/${t}`),generateOutline:(t,e,n)=>Vn.post("/books/outline",{genre:t,idea:e,title:n}),generateChapter:(t,e,n,r)=>Vn.post("/books/chapter",{genre:t,chapterTitle:e,chapterSummary:n,previousContent:r}),expand:(t,e)=>Vn.post("/books/expand",{text:t,instruction:e}),generateCharacters:(t,e)=>Vn.post("/books/characters",{genre:t,storyIdea:e}),generatePlot:(t,e,n)=>Vn.post("/books/plot",{genre:t,currentPlot:e,issue:n})};function JT(){const[t,e]=W.useState("gallery"),{activeCover:n,setActiveCover:r}=y8(),i=Og(),{data:o}=S6({queryKey:["covers"],queryFn:async()=>(await np.getAll()).data.covers}),l=Pw({mutationFn:async f=>(await np.generate(f)).data,onSuccess:()=>{i.invalidateQueries({queryKey:["covers"]}),e("gallery")}}),u=f=>{l.mutate(f)},d=f=>{const g={id:`cover-${Date.now()}`,title:"New Book",author:"Author Name",backgroundImage:f,backgroundColor:"#ffffff",width:1600,height:2400,layers:[],createdAt:new Date,updatedAt:new Date};r(g),e("editor")};return N.jsxs("div",{className:"space-y-6",children:[N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsxs("div",{children:[N.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Cover Designer"}),N.jsx("p",{className:"text-gray-500 mt-1",children:"Design stunning book covers with AI or manual editing"})]}),N.jsxs("div",{className:"flex bg-white rounded-lg p-1 border border-gray-200",children:[N.jsxs("button",{onClick:()=>e("gallery"),className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="gallery"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(Fg,{className:"w-4 h-4"}),"Gallery"]}),N.jsxs("button",{onClick:()=>e("editor"),className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="editor"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(h1,{className:"w-4 h-4"}),"Editor"]}),N.jsxs("button",{onClick:()=>e("ai"),className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="ai"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(Xs,{className:"w-4 h-4"}),"AI Generate"]})]})]}),t==="gallery"&&N.jsx(zw,{covers:o||[],onSelect:d,onDelete:f=>{np.delete(f).then(()=>{i.invalidateQueries({queryKey:["covers"]})})}}),t==="editor"&&n&&N.jsx(SR,{}),t==="ai"&&N.jsx(ZT,{onGenerate:u,isGenerating:l.isPending})]})}function ZT({onGenerate:t,isGenerating:e}){const[n,r]=W.useState(""),[i,o]=W.useState("modern"),l=[{id:"modern",name:"Modern",icon:"✨"},{id:"minimal",name:"Minimalist",icon:"🎯"},{id:"vintage",name:"Vintage",icon:"📜"},{id:"bold",name:"Bold",icon:"🔥"},{id:"elegant",name:"Elegant",icon:"💎"},{id:"playful",name:"Playful",icon:"🎨"}],u=[{genre:"Mystery",prompt:"A mysterious book cover with dark shadows, silhouette of a detective, foggy street scene, noir atmosphere"},{genre:"Romance",prompt:"A romantic book cover with soft pastel colors, couple silhouette at sunset, dreamy and emotional"},{genre:"Fantasy",prompt:"An epic fantasy book cover with magical elements, dragon, castle in the background, mystical glowing effects"},{genre:"Sci-Fi",prompt:"A futuristic sci-fi book cover with spaceships, neon lights, cyberpunk city, high-tech atmosphere"},{genre:"Self-Help",prompt:"A clean self-help book cover with inspiring imagery, mountain peak or sunrise, professional and motivating"}],d=g=>{r(g)},f=()=>{if(n.trim()){const g=`${n}, ${i} style, professional book cover design, high quality, detailed`;t(g)}};return N.jsx("div",{className:"card space-y-6",children:N.jsxs("div",{children:[N.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"AI Cover Generator"}),N.jsxs("div",{className:"mb-6",children:[N.jsx("label",{className:"label",children:"Select Style"}),N.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 mt-2",children:l.map(g=>N.jsxs("button",{onClick:()=>o(g.id),className:`p-3 rounded-lg border text-center transition-colors ${i===g.id?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-200 hover:border-gray-300"}`,children:[N.jsx("span",{className:"text-xl",children:g.icon}),N.jsx("p",{className:"text-xs mt-1",children:g.name})]},g.id))})]}),N.jsxs("div",{className:"mb-6",children:[N.jsx("label",{className:"label",children:"Describe Your Cover"}),N.jsx("textarea",{value:n,onChange:g=>r(g.target.value),placeholder:"Describe the book cover you want to generate... e.g., 'A mysterious forest with glowing eyes in the darkness'",className:"input min-h-[120px] resize-y"})]}),N.jsxs("div",{className:"mb-6",children:[N.jsx("label",{className:"label",children:"Quick Presets by Genre"}),N.jsx("div",{className:"grid gap-2 mt-2",children:u.map(g=>N.jsxs("button",{onClick:()=>d(g.prompt),className:"text-left px-4 py-2 rounded-lg border border-gray-200 hover:border-primary-300 hover:bg-primary-50 transition-colors",children:[N.jsx("span",{className:"font-medium",children:g.genre}),N.jsx("p",{className:"text-sm text-gray-500 truncate",children:g.prompt})]},g.genre))})]}),N.jsxs("button",{onClick:f,disabled:!n.trim()||e,className:"btn-primary w-full py-3 flex items-center justify-center gap-2",children:[N.jsx(Xs,{className:"w-5 h-5"}),e?"Generating...":"Generate Cover"]})]})})}function eO({genres:t,onSelect:e}){const[n,r]=W.useState(""),[i,o]=W.useState(""),[l,u]=W.useState(""),d=f=>{f.preventDefault(),n&&l.trim()&&e(n,l.trim(),i.trim())};return N.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[N.jsx("div",{className:"lg:col-span-2",children:N.jsxs("div",{className:"card",children:[N.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(Pd,{className:"w-5 h-5"}),"Select Your Genre"]}),N.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(f=>N.jsxs("button",{onClick:()=>r(f.id),className:`p-4 rounded-xl border-2 text-left transition-all ${n===f.id?"border-primary-500 bg-primary-50 shadow-md":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"}`,children:[N.jsx("span",{className:"text-2xl mb-2 block",children:f.icon}),N.jsx("h4",{className:"font-medium text-gray-900",children:f.name}),N.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-2",children:f.description})]},f.id))})]})}),N.jsx("div",{children:N.jsxs("div",{className:"card sticky top-6",children:[N.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(x6,{className:"w-5 h-5"}),"Book Details"]}),N.jsxs("form",{onSubmit:d,className:"space-y-4",children:[N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Book Title (optional)"}),N.jsx("input",{type:"text",value:i,onChange:f=>o(f.target.value),placeholder:"My Amazing Book",className:"input"})]}),N.jsxs("div",{children:[N.jsxs("label",{className:"label",children:["Core Idea ",N.jsx("span",{className:"text-red-500",children:"*"})]}),N.jsx("textarea",{value:l,onChange:f=>u(f.target.value),placeholder:"Describe your book idea... What's the story about? Who are the main characters? What conflict drives the narrative?",className:"input min-h-[150px] resize-y",required:!0})]}),N.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:N.jsxs("p",{className:"text-xs text-amber-700",children:[N.jsx("strong",{children:"Tip:"})," The more details you provide, the better the AI can generate your outline and content."]})}),N.jsx("button",{type:"submit",disabled:!n||!l.trim(),className:"btn-primary w-full py-3",children:"Generate Outline"})]})]})})]})}const Xh=m8(t=>({books:[],activeBook:null,isGenerating:!1,generationProgress:0,addBook:e=>t(n=>({books:[e,...n.books],activeBook:e})),updateBook:(e,n)=>t(r=>{var i;return{books:r.books.map(o=>o.id===e?{...o,...n,updatedAt:new Date}:o),activeBook:((i=r.activeBook)==null?void 0:i.id)===e?{...r.activeBook,...n,updatedAt:new Date}:r.activeBook}}),deleteBook:e=>t(n=>{var r;return{books:n.books.filter(i=>i.id!==e),activeBook:((r=n.activeBook)==null?void 0:r.id)===e?null:n.activeBook}}),setActiveBook:e=>t({activeBook:e}),setOutline:e=>t(n=>{if(!n.activeBook)return n;const r={...n.activeBook,outline:e,updatedAt:new Date};return{activeBook:r,books:n.books.map(i=>i.id===n.activeBook.id?r:i)}}),addCharacter:e=>t(n=>{if(!n.activeBook)return n;const r={...n.activeBook,characters:[...n.activeBook.characters,e],updatedAt:new Date};return{activeBook:r,books:n.books.map(i=>i.id===n.activeBook.id?r:i)}}),updateChapterContent:(e,n)=>t(r=>{if(!r.activeBook||!r.activeBook.outline)return r;const i={...r.activeBook.outline,chapters:r.activeBook.outline.chapters.map(l=>l.number===e?{...l,content:n,isGenerated:!0}:l)},o={...r.activeBook,outline:i,updatedAt:new Date};return{activeBook:o,books:r.books.map(l=>l.id===r.activeBook.id?o:l)}}),setCurrentChapter:e=>t(n=>n.activeBook?{activeBook:{...n.activeBook,currentChapter:e}}:n),setCoverForBook:e=>t(n=>{if(!n.activeBook)return n;const r={...n.activeBook,coverId:e,updatedAt:new Date};return{activeBook:r,books:n.books.map(i=>i.id===n.activeBook.id?r:i)}}),setIsGenerating:e=>t({isGenerating:e}),setGenerationProgress:e=>t({generationProgress:e})}));function tO({book:t,onComplete:e}){var f;const{activeBook:n}=Xh(),[r,i]=W.useState(!1),[o,l]=W.useState(""),u=n==null?void 0:n.outline,d=async()=>{var g,v;i(!0),l("");try{const w=(await Yh.generateOutline(t.genre,t.idea,t.title)).data.outline;e(w)}catch(S){l(((v=(g=S.response)==null?void 0:g.data)==null?void 0:v.error)||"Failed to generate outline")}finally{i(!1)}};return N.jsxs("div",{className:"space-y-6",children:[N.jsx("div",{className:"card bg-gradient-to-r from-primary-50 to-accent-50",children:N.jsxs("div",{className:"flex items-start justify-between",children:[N.jsxs("div",{children:[N.jsx("h3",{className:"font-semibold text-gray-900",children:t.title||"Untitled Book"}),N.jsxs("p",{className:"text-sm text-gray-600 mt-1 capitalize",children:["Genre: ",t.genre]}),N.jsx("p",{className:"text-sm text-gray-500 mt-2 line-clamp-2",children:t.idea})]}),!u&&N.jsx("button",{onClick:d,disabled:r,className:"btn-primary flex items-center gap-2",children:r?N.jsxs(N.Fragment,{children:[N.jsx(bw,{className:"w-4 h-4 animate-spin"}),"Generating..."]}):N.jsxs(N.Fragment,{children:[N.jsx(Xs,{className:"w-4 h-4"}),"Generate Outline"]})})]})}),o&&N.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:N.jsx("p",{className:"text-red-700",children:o})}),u&&N.jsxs("div",{className:"card",children:[N.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[N.jsx(Tw,{className:"w-5 h-5 text-green-500"}),N.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:["Generated Outline: ",u.title||t.title]})]}),u.logline&&N.jsxs("div",{className:"mb-6 pb-6 border-b border-gray-200",children:[N.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-2",children:"Logline"}),N.jsx("p",{className:"text-gray-900 italic",children:u.logline})]}),N.jsxs("div",{children:[N.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-4",children:"Chapter Outline"}),N.jsx("div",{className:"space-y-3",children:(f=u.chapters)==null?void 0:f.map((g,v)=>N.jsx("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-primary-300 transition-colors",children:N.jsxs("div",{className:"flex items-start gap-3",children:[N.jsx("span",{className:"flex-shrink-0 w-8 h-8 bg-primary-100 text-primary-700 rounded-full flex items-center justify-center text-sm font-medium",children:g.number||v+1}),N.jsxs("div",{className:"flex-1",children:[N.jsx("h5",{className:"font-medium text-gray-900",children:g.title||`Chapter ${g.number||v+1}`}),N.jsx("p",{className:"text-sm text-gray-600 mt-1",children:g.summary||"No summary available"})]})]})},v))})]}),N.jsx("div",{className:"mt-6 flex items-center justify-end gap-3",children:N.jsx("p",{className:"text-sm text-gray-500",children:"Ready to start writing! Navigate to the Write tab to begin."})})]}),!u&&!r&&N.jsxs("div",{className:"card text-center py-12",children:[N.jsx(Xs,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),N.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Ready to Generate"}),N.jsx("p",{className:"text-gray-500 mt-2 max-w-md mx-auto",children:'Click "Generate Outline" to create a detailed chapter outline based on your genre and book idea. The AI will create a structure following genre-specific patterns.'})]})]})}function nO(){const{activeBook:t,updateChapterContent:e,setCurrentChapter:n}=Xh(),[r,i]=W.useState(!1),[o,l]=W.useState(!1);if(!t||!t.outline)return N.jsx("div",{className:"card text-center py-12",children:N.jsx("p",{className:"text-gray-500",children:"Generate an outline first to start writing your book."})});const u=t.outline.chapters.find(S=>S.number===t.currentChapter),d=()=>{t.currentChapter>1&&n(t.currentChapter-1)},f=()=>{const S=t.outline.chapters.length;t.currentChapter{var S;if(!(!u||!t)){i(!0);try{const w=(S=t.outline)==null?void 0:S.chapters.find(E=>E.number===t.currentChapter-1),y=await Yh.generateChapter(t.genre,u.title,u.summary,w==null?void 0:w.content);e(t.currentChapter,y.data.content)}catch(w){console.error("Failed to generate chapter:",w)}finally{i(!1)}}},v=async()=>{alert("Expand feature coming soon!")};return N.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[N.jsxs("div",{className:"space-y-4",children:[N.jsxs("div",{className:"card",children:[N.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Chapters"}),N.jsx("div",{className:"space-y-2",children:t.outline.chapters.map(S=>N.jsx("button",{onClick:()=>n(S.number),className:`w-full text-left p-3 rounded-lg transition-colors ${S.number===t.currentChapter?"bg-primary-100 text-primary-700":"hover:bg-gray-50"}`,children:N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx("span",{className:"flex-shrink-0 w-6 h-6 bg-white rounded-full flex items-center justify-center text-xs font-medium border",children:S.number}),N.jsxs("div",{className:"flex-1 min-w-0",children:[N.jsx("p",{className:"text-sm font-medium truncate",children:S.title}),S.content&&N.jsx("span",{className:"text-xs text-green-600",children:"✓ Written"})]})]})},S.number))})]}),N.jsxs("div",{className:"card",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Chapter Summary"}),N.jsx("p",{className:"text-sm text-gray-600",children:u==null?void 0:u.summary})]})]}),N.jsx("div",{className:"lg:col-span-3",children:N.jsxs("div",{className:"card",children:[N.jsxs("div",{className:"flex items-center justify-between mb-6 pb-4 border-b border-gray-200",children:[N.jsxs("div",{className:"flex items-center gap-4",children:[N.jsx("button",{onClick:d,disabled:t.currentChapter<=1,className:"p-2 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:N.jsx(Ow,{className:"w-5 h-5"})}),N.jsxs("div",{children:[N.jsx("h2",{className:"text-xl font-bold text-gray-900",children:u==null?void 0:u.title}),N.jsxs("p",{className:"text-sm text-gray-500",children:["Chapter ",t.currentChapter," of ",t.outline.chapters.length]})]}),N.jsx("button",{onClick:f,disabled:t.currentChapter>=t.outline.chapters.length,className:"p-2 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:N.jsx(Fw,{className:"w-5 h-5"})})]}),N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsxs("button",{onClick:()=>l(!o),className:"btn-secondary flex items-center gap-2",children:[N.jsx(x6,{className:"w-4 h-4"}),"AI Assist"]}),N.jsxs("button",{onClick:g,disabled:r||!u,className:"btn-primary flex items-center gap-2",children:[N.jsx(Xs,{className:"w-4 h-4"}),r?"Generating...":"Generate Chapter"]})]})]}),o&&N.jsxs("div",{className:"mb-6 bg-gradient-to-r from-accent-50 to-primary-50 rounded-lg p-4 border border-accent-200",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:"AI Writing Assistant"}),N.jsxs("div",{className:"flex flex-wrap gap-2",children:[N.jsx("button",{onClick:v,className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:"✨ Expand this section"}),N.jsx("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:"📝 Improve prose"}),N.jsx("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:"💡 Add description"}),N.jsx("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:"🔄 Rewrite paragraph"})]})]}),N.jsx("div",{className:"min-h-[500px]",children:u!=null&&u.content?N.jsx("textarea",{value:u.content,onChange:S=>e(t.currentChapter,S.target.value),className:"w-full h-[600px] p-6 font-serif text-lg leading-relaxed border-0 focus:ring-0 resize-y outline-none",placeholder:"Start writing or use AI to generate this chapter..."}):N.jsx("div",{className:"h-[500px] flex items-center justify-center text-gray-400",children:N.jsxs("div",{className:"text-center",children:[N.jsx(Xs,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),N.jsx("p",{children:'Click "Generate Chapter" to create content with AI'}),N.jsx("p",{className:"text-sm mt-1",children:"Or start writing manually"})]})})}),N.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-200 flex items-center justify-between text-sm text-gray-500",children:[N.jsxs("span",{children:[u!=null&&u.content?u.content.split(/\s+/).length:0," ","words"]}),N.jsxs("span",{children:["Last updated:"," ",new Date(t.updatedAt).toLocaleDateString()]})]})]})})]})}function rO(){const[t,e]=W.useState("genre"),{activeBook:n,setActiveBook:r,setOutline:i}=Xh(),{data:o}=S6({queryKey:["genres"],queryFn:async()=>(await Yh.getGenres()).data.genres}),l=(d,f,g)=>{const v={id:`book-${Date.now()}`,title:g,genre:d,idea:f,outline:null,characters:[],currentChapter:1,createdAt:new Date,updatedAt:new Date};r(v),e("outline")},u=d=>{n&&d&&(i(d),e("editor"))};return N.jsxs("div",{className:"space-y-6",children:[N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsxs("div",{children:[N.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Book Generator"}),N.jsx("p",{className:"text-gray-500 mt-1",children:"Generate book ideas and write with AI assistance"})]}),N.jsxs("div",{className:"flex bg-white rounded-lg p-1 border border-gray-200",children:[N.jsxs("button",{onClick:()=>e("genre"),className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="genre"||!n?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,disabled:!n&&t!=="genre",children:[N.jsx(Pd,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:"Genre"})]}),N.jsxs("button",{onClick:()=>e("outline"),disabled:!n,className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="outline"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100 disabled:opacity-50"}`,children:[N.jsx(Lw,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:"Outline"})]}),N.jsxs("button",{onClick:()=>e("editor"),disabled:!n,className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="editor"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(Dw,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:"Write"})]}),N.jsxs("button",{onClick:()=>e("characters"),disabled:!n,className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="characters"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(w6,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:"Characters"})]})]})]}),t==="genre"&&N.jsx(eO,{genres:o||[],onSelect:l}),t==="outline"&&n&&N.jsx(tO,{book:n,onComplete:u}),t==="editor"&&n&&N.jsx(nO,{}),t==="characters"&&n&&N.jsx(iO,{})]})}function iO(){const{activeBook:t,addCharacter:e}=Xh(),[n,r]=W.useState(!1),i=async()=>{if(t){r(!0);try{const l=(await Yh.generateCharacters(t.genre,t.idea)).data.characters;Array.isArray(l)&&l.forEach(u=>{e({name:u.name||"Unknown",role:u.role||"Supporting",traits:u.traits||[],motivation:u.motivation||"",backstory:u.backstory||""})})}catch(o){console.error("Failed to generate characters:",o)}finally{r(!1)}}};return t?N.jsxs("div",{className:"card",children:[N.jsxs("div",{className:"flex items-center justify-between mb-6",children:[N.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Character Development"}),N.jsxs("button",{onClick:i,disabled:n,className:"btn-primary flex items-center gap-2",children:[N.jsx(Xs,{className:"w-4 h-4"}),n?"Generating...":"Generate Characters"]})]}),t.characters.length===0?N.jsxs("div",{className:"text-center py-8",children:[N.jsx(w6,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),N.jsx("p",{className:"text-gray-500",children:'No characters yet. Click "Generate Characters" to create AI-suggested characters.'})]}):N.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:t.characters.map((o,l)=>{var u;return N.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-primary-300 transition-colors",children:[N.jsxs("div",{className:"flex items-start justify-between mb-2",children:[N.jsx("h4",{className:"font-semibold text-gray-900",children:o.name}),N.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${o.role==="protagonist"?"bg-green-100 text-green-700":o.role==="antagonist"?"bg-red-100 text-red-700":"bg-gray-100 text-gray-600"}`,children:o.role})]}),N.jsxs("div",{className:"space-y-2 text-sm",children:[N.jsxs("div",{children:[N.jsx("span",{className:"text-gray-500",children:"Traits:"}),N.jsx("p",{className:"text-gray-700",children:((u=o.traits)==null?void 0:u.join(", "))||"N/A"})]}),N.jsxs("div",{children:[N.jsx("span",{className:"text-gray-500",children:"Motivation:"}),N.jsx("p",{className:"text-gray-700",children:o.motivation||"N/A"})]})]})]},l)})})]}):null}function sO(){const[t]=W.useState("gpt-4o-mini"),[e]=W.useState("stable-diffusion-v1-6"),n=()=>{alert("Cloud AI models are configured automatically!")};return N.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[N.jsxs("div",{children:[N.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Settings"}),N.jsx("p",{className:"text-gray-500 mt-1",children:"Cloud AI configuration and application preferences"})]}),N.jsxs("div",{className:"card",children:[N.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(Aw,{className:"w-5 h-5"}),"Cloud AI Settings"]}),N.jsxs("div",{className:"space-y-4",children:[N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Text Generation Model"}),N.jsx("select",{value:t,disabled:!0,className:"input bg-gray-100",children:N.jsx("option",{value:"gpt-4o-mini",children:"OpenAI GPT-4o Mini (via OpenRouter)"})}),N.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Used for book outlines, chapters, and text generation (free tier)"})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Image Generation Model"}),N.jsx("select",{value:e,disabled:!0,className:"input bg-gray-100",children:N.jsx("option",{value:"stable-diffusion-v1-6",children:"Stability AI Stable Diffusion v1.6"})}),N.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Used for AI book cover generation (free credits available)"})]})]})]}),N.jsxs("div",{className:"card bg-blue-50 border-blue-200",children:[N.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"API Key Setup"}),N.jsx("p",{className:"text-sm text-blue-700 mb-3",children:"Configure your API key in the server/.env file:"}),N.jsx("code",{className:"block bg-white rounded p-3 text-sm font-mono text-blue-800",children:"OPENROUTER_API_KEY=your_openrouter_api_key_here"}),N.jsxs("p",{className:"text-sm text-blue-700 mt-2",children:["Get a free API key from: ",N.jsx("a",{href:"https://openrouter.ai/keys",className:"underline",target:"_blank",rel:"noopener noreferrer",children:"OpenRouter"})]})]}),N.jsx("div",{className:"flex justify-end",children:N.jsxs("button",{onClick:n,className:"btn-primary flex items-center gap-2",children:[N.jsx(Iw,{className:"w-4 h-4"}),"Save Settings"]})})]})}function oO(){return N.jsxs("div",{className:"min-h-screen bg-gray-50",children:[N.jsx("header",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:N.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:N.jsxs("div",{className:"flex items-center justify-between h-16",children:[N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-primary-500 to-accent-500 rounded-lg flex items-center justify-center",children:N.jsx(Pd,{className:"w-5 h-5 text-white"})}),N.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"CreaBook"})]}),N.jsxs("nav",{className:"flex items-center gap-1",children:[N.jsxs("a",{href:"/covers",className:"flex items-center gap-2 px-4 py-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-colors",children:[N.jsx(Fg,{className:"w-5 h-5"}),N.jsx("span",{className:"hidden sm:inline",children:"Cover Designer"})]}),N.jsxs("a",{href:"/books",className:"flex items-center gap-2 px-4 py-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-colors",children:[N.jsx(Pd,{className:"w-5 h-5"}),N.jsx("span",{className:"hidden sm:inline",children:"Book Generator"})]}),N.jsxs("a",{href:"/settings",className:"flex items-center gap-2 px-4 py-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-colors",children:[N.jsx(jw,{className:"w-5 h-5"}),N.jsx("span",{className:"hidden sm:inline",children:"Settings"})]})]})]})})}),N.jsx("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:N.jsxs(Ux,{children:[N.jsx(pl,{path:"/",element:N.jsx(Ix,{to:"/covers",replace:!0})}),N.jsx(pl,{path:"/covers",element:N.jsx(JT,{})}),N.jsx(pl,{path:"/books",element:N.jsx(rO,{})}),N.jsx(pl,{path:"/settings",element:N.jsx(sO,{})})]})})]})}const aO=new fw({defaultOptions:{queries:{staleTime:5*60*1e3,retry:1}}});rp.createRoot(document.getElementById("root")).render(N.jsx(Mt.StrictMode,{children:N.jsx(pw,{client:aO,children:N.jsx(Gx,{children:N.jsx(oO,{})})})}));