function h2(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 a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var yn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function AL(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var jt={},IL={get exports(){return jt},set exports(t){jt=t}},hh={},be={},LL={get exports(){return be},set exports(t){be=t}},De={};/** * @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 qu=Symbol.for("react.element"),ML=Symbol.for("react.portal"),DL=Symbol.for("react.fragment"),NL=Symbol.for("react.strict_mode"),BL=Symbol.for("react.profiler"),FL=Symbol.for("react.provider"),$L=Symbol.for("react.context"),zL=Symbol.for("react.forward_ref"),GL=Symbol.for("react.suspense"),UL=Symbol.for("react.memo"),jL=Symbol.for("react.lazy"),qS=Symbol.iterator;function WL(t){return t===null||typeof t!="object"?null:(t=qS&&t[qS]||t["@@iterator"],typeof t=="function"?t:null)}var p2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g2=Object.assign,m2={};function Us(t,e,n){this.props=t,this.context=e,this.refs=m2,this.updater=n||p2}Us.prototype.isReactComponent={};Us.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")};Us.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function v2(){}v2.prototype=Us.prototype;function my(t,e,n){this.props=t,this.context=e,this.refs=m2,this.updater=n||p2}var vy=my.prototype=new v2;vy.constructor=my;g2(vy,Us.prototype);vy.isPureReactComponent=!0;var KS=Array.isArray,y2=Object.prototype.hasOwnProperty,yy={current:null},S2={key:!0,ref:!0,__self:!0,__source:!0};function _2(t,e,n){var r,i={},a=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(a=""+e.key),e)y2.call(e,r)&&!S2.hasOwnProperty(r)&&(i[r]=e[r]);var u=arguments.length-2;if(u===1)i.children=n;else if(1>>1,ve=W[oe];if(0>>1;oei(At,Q))mei(qt,At)?(W[oe]=qt,W[me]=Q,oe=me):(W[oe]=At,W[Ue]=Q,oe=Ue);else if(mei(qt,Q))W[oe]=qt,W[me]=Q,oe=me;else break e}}return Y}function i(W,Y){var Q=W.sortIndex-Y.sortIndex;return Q!==0?Q:W.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var s=Date,u=s.now();t.unstable_now=function(){return s.now()-u}}var c=[],f=[],h=1,p=null,g=3,y=!1,v=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(W){for(var Y=n(f);Y!==null;){if(Y.callback===null)r(f);else if(Y.startTime<=W)r(f),Y.sortIndex=Y.expirationTime,e(c,Y);else break;Y=n(f)}}function O(W){if(w=!1,C(W),!v)if(n(c)!==null)v=!0,V(I);else{var Y=n(f);Y!==null&&ie(O,Y.startTime-W)}}function I(W,Y){v=!1,w&&(w=!1,_(U),U=-1),y=!0;var Q=g;try{for(C(Y),p=n(c);p!==null&&(!(p.expirationTime>Y)||W&&!te());){var oe=p.callback;if(typeof oe=="function"){p.callback=null,g=p.priorityLevel;var ve=oe(p.expirationTime<=Y);Y=t.unstable_now(),typeof ve=="function"?p.callback=ve:p===n(c)&&r(c),C(Y)}else r(c);p=n(c)}if(p!==null)var we=!0;else{var Ue=n(f);Ue!==null&&ie(O,Ue.startTime-Y),we=!1}return we}finally{p=null,g=Q,y=!1}}var L=!1,D=null,U=-1,X=5,K=-1;function te(){return!(t.unstable_now()-KW||125oe?(W.sortIndex=Q,e(f,W),n(c)===null&&W===n(f)&&(w?(_(U),U=-1):w=!0,ie(O,Q-oe))):(W.sortIndex=ve,e(c,W),v||y||(v=!0,V(I))),W},t.unstable_shouldYield=te,t.unstable_wrapCallback=function(W){var Y=g;return function(){var Q=g;g=Y;try{return W.apply(this,arguments)}finally{g=Q}}}})(b2);(function(t){t.exports=b2})(nM);/** * @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 C2=be,Yn=$m;function ae(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"),zm=Object.prototype.hasOwnProperty,rM=/^[: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]*$/,QS={},JS={};function iM(t){return zm.call(JS,t)?!0:zm.call(QS,t)?!1:rM.test(t)?JS[t]=!0:(QS[t]=!0,!1)}function aM(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 oM(t,e,n,r){if(e===null||typeof e>"u"||aM(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 wn(t,e,n,r,i,a,s){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=a,this.removeEmptyString=s}var nn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){nn[t]=new wn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];nn[e]=new wn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){nn[t]=new wn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){nn[t]=new wn(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){nn[t]=new wn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){nn[t]=new wn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){nn[t]=new wn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){nn[t]=new wn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){nn[t]=new wn(t,5,!1,t.toLowerCase(),null,!1,!1)});var _y=/[\-:]([a-z])/g;function wy(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(_y,wy);nn[e]=new wn(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(_y,wy);nn[e]=new wn(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(_y,wy);nn[e]=new wn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){nn[t]=new wn(t,1,!1,t.toLowerCase(),null,!1,!1)});nn.xlinkHref=new wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){nn[t]=new wn(t,1,!1,t.toLowerCase(),null,!0,!0)});function by(t,e,n,r){var i=nn.hasOwnProperty(e)?nn[e]:null;(i!==null?i.type!==0:r||!(2u||i[s]!==a[u]){var c=` `+i[s].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=s&&0<=u);break}}}finally{Wg=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Kl(t):""}function sM(t){switch(t.tag){case 5:return Kl(t.type);case 16:return Kl("Lazy");case 13:return Kl("Suspense");case 19:return Kl("SuspenseList");case 0:case 2:case 15:return t=Hg(t.type,!1),t;case 11:return t=Hg(t.type.render,!1),t;case 1:return t=Hg(t.type,!0),t;default:return""}}function Wm(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 ls:return"Fragment";case ss:return"Portal";case Gm:return"Profiler";case Cy:return"StrictMode";case Um:return"Suspense";case jm:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case P2:return(t.displayName||"Context")+".Consumer";case k2:return(t._context.displayName||"Context")+".Provider";case xy:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ky:return e=t.displayName||null,e!==null?e:Wm(t.type)||"Memo";case ca:e=t._payload,t=t._init;try{return Wm(t(e))}catch{}}return null}function lM(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 Wm(e);case 8:return e===Cy?"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 Oa(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function O2(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function uM(t){var e=O2(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,a=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,a.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function df(t){t._valueTracker||(t._valueTracker=uM(t))}function T2(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=O2(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function kd(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 Hm(t,e){var n=e.checked;return mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function e_(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Oa(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 R2(t,e){e=e.checked,e!=null&&by(t,"checked",e,!1)}function Vm(t,e){R2(t,e);var n=Oa(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")?qm(t,e.type,n):e.hasOwnProperty("defaultValue")&&qm(t,e.type,Oa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function t_(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 qm(t,e,n){(e!=="number"||kd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Yl=Array.isArray;function _s(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=hf.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function wu(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var ou={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},cM=["Webkit","ms","Moz","O"];Object.keys(ou).forEach(function(t){cM.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ou[e]=ou[t]})});function M2(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||ou.hasOwnProperty(t)&&ou[t]?(""+e).trim():e+"px"}function D2(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=M2(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var fM=mt({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 Xm(t,e){if(e){if(fM[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ae(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ae(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ae(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ae(62))}}function Qm(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 Jm=null;function Py(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zm=null,ws=null,bs=null;function i_(t){if(t=Xu(t)){if(typeof Zm!="function")throw Error(ae(280));var e=t.stateNode;e&&(e=yh(e),Zm(t.stateNode,t.type,e))}}function N2(t){ws?bs?bs.push(t):bs=[t]:ws=t}function B2(){if(ws){var t=ws,e=bs;if(bs=ws=null,i_(t),e)for(t=0;t>>=0,t===0?32:31-(bM(t)/CM|0)|0}var pf=64,gf=4194304;function Xl(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 Td(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,a=t.pingedLanes,s=n&268435455;if(s!==0){var u=s&~i;u!==0?r=Xl(u):(a&=s,a!==0&&(r=Xl(a)))}else s=n&~i,s!==0?r=Xl(s):a!==0&&(r=Xl(a));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,a=e&-e,i>=a||i===16&&(a&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 Ku(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Fr(e),t[e]=n}function EM(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=lu),h_=String.fromCharCode(32),p_=!1;function rC(t,e){switch(t){case"keyup":return tD.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var us=!1;function rD(t,e){switch(t){case"compositionend":return iC(e);case"keypress":return e.which!==32?null:(p_=!0,h_);case"textInput":return t=e.data,t===h_&&p_?null:t;default:return null}}function iD(t,e){if(us)return t==="compositionend"||!My&&rC(t,e)?(t=tC(),Jf=Ay=ga=null,us=!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=y_(n)}}function lC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?lC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function uC(){for(var t=window,e=kd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=kd(t.document)}return e}function Dy(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 hD(t){var e=uC(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&lC(n.ownerDocument.documentElement,n)){if(r!==null&&Dy(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,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!t.extend&&a>r&&(i=r,r=a,a=i),i=S_(n,a);var s=S_(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),a>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.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,cs=null,av=null,cu=null,ov=!1;function __(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ov||cs==null||cs!==kd(r)||(r=cs,"selectionStart"in r&&Dy(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}),cu&&Eu(cu,r)||(cu=r,r=Id(av,"onSelect"),0hs||(t.current=dv[hs],dv[hs]=null,hs--)}function at(t,e){hs++,dv[hs]=t.current,t.current=e}var Ta={},fn=La(Ta),Rn=La(!1),so=Ta;function Ls(t,e){var n=t.type.contextTypes;if(!n)return Ta;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=e[a];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function An(t){return t=t.childContextTypes,t!=null}function Md(){lt(Rn),lt(fn)}function E_(t,e,n){if(fn.current!==Ta)throw Error(ae(168));at(fn,e),at(Rn,n)}function yC(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(ae(108,lM(t)||"Unknown",i));return mt({},n,r)}function Dd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ta,so=fn.current,at(fn,t),at(Rn,Rn.current),!0}function O_(t,e,n){var r=t.stateNode;if(!r)throw Error(ae(169));n?(t=yC(t,e,so),r.__reactInternalMemoizedMergedChildContext=t,lt(Rn),lt(fn),at(fn,t)):lt(Rn),at(Rn,n)}var Mi=null,Sh=!1,am=!1;function SC(t){Mi===null?Mi=[t]:Mi.push(t)}function kD(t){Sh=!0,SC(t)}function Ma(){if(!am&&Mi!==null){am=!0;var t=0,e=Qe;try{var n=Mi;for(Qe=1;t>=s,i-=s,Di=1<<32-Fr(e)+i|n<U?(X=D,D=null):X=D.sibling;var K=g(_,D,C[U],O);if(K===null){D===null&&(D=X);break}t&&D&&K.alternate===null&&e(_,D),S=a(K,S,U),L===null?I=K:L.sibling=K,L=K,D=X}if(U===C.length)return n(_,D),ft&&Qa(_,U),I;if(D===null){for(;UU?(X=D,D=null):X=D.sibling;var te=g(_,D,K.value,O);if(te===null){D===null&&(D=X);break}t&&D&&te.alternate===null&&e(_,D),S=a(te,S,U),L===null?I=te:L.sibling=te,L=te,D=X}if(K.done)return n(_,D),ft&&Qa(_,U),I;if(D===null){for(;!K.done;U++,K=C.next())K=p(_,K.value,O),K!==null&&(S=a(K,S,U),L===null?I=K:L.sibling=K,L=K);return ft&&Qa(_,U),I}for(D=r(_,D);!K.done;U++,K=C.next())K=y(D,_,U,K.value,O),K!==null&&(t&&K.alternate!==null&&D.delete(K.key===null?U:K.key),S=a(K,S,U),L===null?I=K:L.sibling=K,L=K);return t&&D.forEach(function(ce){return e(_,ce)}),ft&&Qa(_,U),I}function x(_,S,C,O){if(typeof C=="object"&&C!==null&&C.type===ls&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case ff:e:{for(var I=C.key,L=S;L!==null;){if(L.key===I){if(I=C.type,I===ls){if(L.tag===7){n(_,L.sibling),S=i(L,C.props.children),S.return=_,_=S;break e}}else if(L.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===ca&&D_(I)===L.type){n(_,L.sibling),S=i(L,C.props),S.ref=Ll(_,L,C),S.return=_,_=S;break e}n(_,L);break}else e(_,L);L=L.sibling}C.type===ls?(S=oo(C.props.children,_.mode,O,C.key),S.return=_,_=S):(O=od(C.type,C.key,C.props,null,_.mode,O),O.ref=Ll(_,S,C),O.return=_,_=O)}return s(_);case ss:e:{for(L=C.key;S!==null;){if(S.key===L)if(S.tag===4&&S.stateNode.containerInfo===C.containerInfo&&S.stateNode.implementation===C.implementation){n(_,S.sibling),S=i(S,C.children||[]),S.return=_,_=S;break e}else{n(_,S);break}else e(_,S);S=S.sibling}S=hm(C,_.mode,O),S.return=_,_=S}return s(_);case ca:return L=C._init,x(_,S,L(C._payload),O)}if(Yl(C))return v(_,S,C,O);if(Ol(C))return w(_,S,C,O);bf(_,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,S!==null&&S.tag===6?(n(_,S.sibling),S=i(S,C),S.return=_,_=S):(n(_,S),S=dm(C,_.mode,O),S.return=_,_=S),s(_)):n(_,S)}return x}var Ds=EC(!0),OC=EC(!1),Qu={},si=La(Qu),Au=La(Qu),Iu=La(Qu);function ro(t){if(t===Qu)throw Error(ae(174));return t}function Wy(t,e){switch(at(Iu,e),at(Au,t),at(si,Qu),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ym(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ym(e,t)}lt(si),at(si,e)}function Ns(){lt(si),lt(Au),lt(Iu)}function TC(t){ro(Iu.current);var e=ro(si.current),n=Ym(e,t.type);e!==n&&(at(Au,t),at(si,n))}function Hy(t){Au.current===t&&(lt(si),lt(Au))}var pt=La(0);function Gd(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var om=[];function Vy(){for(var t=0;tn?n:4,t(!0);var r=sm.transition;sm.transition={};try{t(!1),e()}finally{Qe=n,sm.transition=r}}function HC(){return vr().memoizedState}function TD(t,e,n){var r=xa(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},VC(t))qC(e,n);else if(n=CC(t,e,n,r),n!==null){var i=Sn();$r(n,t,r,i),KC(n,e,r)}}function RD(t,e,n){var r=xa(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(VC(t))qC(e,i);else{var a=t.alternate;if(t.lanes===0&&(a===null||a.lanes===0)&&(a=e.lastRenderedReducer,a!==null))try{var s=e.lastRenderedState,u=a(s,n);if(i.hasEagerState=!0,i.eagerState=u,Gr(u,s)){var c=e.interleaved;c===null?(i.next=i,Uy(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}n=CC(t,e,i,r),n!==null&&(i=Sn(),$r(n,t,r,i),KC(n,e,r))}}function VC(t){var e=t.alternate;return t===gt||e!==null&&e===gt}function qC(t,e){fu=Ud=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function KC(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Oy(t,n)}}var jd={readContext:mr,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useInsertionEffect:on,useLayoutEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useMutableSource:on,useSyncExternalStore:on,useId:on,unstable_isNewReconciler:!1},AD={readContext:mr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:mr,useEffect:B_,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,nd(4194308,4,zC.bind(null,e,t),n)},useLayoutEffect:function(t,e){return nd(4194308,4,t,e)},useInsertionEffect:function(t,e){return nd(4,2,t,e)},useMemo:function(t,e){var n=Zr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Zr();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=TD.bind(null,gt,t),[r.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:N_,useDebugValue:Qy,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=N_(!1),e=t[0];return t=OD.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=gt,i=Zr();if(ft){if(n===void 0)throw Error(ae(407));n=n()}else{if(n=e(),Ht===null)throw Error(ae(349));uo&30||IC(r,e,n)}i.memoizedState=n;var a={value:n,getSnapshot:e};return i.queue=a,B_(MC.bind(null,r,a,t),[t]),r.flags|=2048,Du(9,LC.bind(null,r,a,n,e),void 0,null),n},useId:function(){var t=Zr(),e=Ht.identifierPrefix;if(ft){var n=Ni,r=Di;n=(r&~(1<<32-Fr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Lu++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[ri]=e,t[Ru]=r,rx(t,e,!1,!1),e.stateNode=t;e:{switch(s=Qm(n,r),n){case"dialog":ot("cancel",t),ot("close",t),i=r;break;case"iframe":case"object":case"embed":ot("load",t),i=r;break;case"video":case"audio":for(i=0;iFs&&(e.flags|=128,r=!0,Ml(a,!1),e.lanes=4194304)}else{if(!r)if(t=Gd(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ml(a,!0),a.tail===null&&a.tailMode==="hidden"&&!s.alternate&&!ft)return sn(e),null}else 2*Pt()-a.renderingStartTime>Fs&&n!==1073741824&&(e.flags|=128,r=!0,Ml(a,!1),e.lanes=4194304);a.isBackwards?(s.sibling=e.child,e.child=s):(n=a.last,n!==null?n.sibling=s:e.child=s,a.last=s)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=Pt(),e.sibling=null,n=pt.current,at(pt,r?n&1|2:n&1),e):(sn(e),null);case 22:case 23:return r0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?jn&1073741824&&(sn(e),e.subtreeFlags&6&&(e.flags|=8192)):sn(e),null;case 24:return null;case 25:return null}throw Error(ae(156,e.tag))}function $D(t,e){switch(By(e),e.tag){case 1:return An(e.type)&&Md(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ns(),lt(Rn),lt(fn),Vy(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Hy(e),null;case 13:if(lt(pt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ae(340));Ms()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return lt(pt),null;case 4:return Ns(),null;case 10:return Gy(e.type._context),null;case 22:case 23:return r0(),null;case 24:return null;default:return null}}var xf=!1,cn=!1,zD=typeof WeakSet=="function"?WeakSet:Set,he=null;function vs(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){wt(t,e,r)}else n.current=null}function xv(t,e,n){try{n()}catch(r){wt(t,e,r)}}var V_=!1;function GD(t,e){if(sv=Rd,t=uC(),Dy(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,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var s=0,u=-1,c=-1,f=0,h=0,p=t,g=null;t:for(;;){for(var y;p!==n||i!==0&&p.nodeType!==3||(u=s+i),p!==a||r!==0&&p.nodeType!==3||(c=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(y=p.firstChild)!==null;)g=p,p=y;for(;;){if(p===t)break t;if(g===n&&++f===i&&(u=s),g===a&&++h===r&&(c=s),(y=p.nextSibling)!==null)break;p=g,g=p.parentNode}p=y}n=u===-1||c===-1?null:{start:u,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(lv={focusedElem:t,selectionRange:n},Rd=!1,he=e;he!==null;)if(e=he,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,he=t;else for(;he!==null;){e=he;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,x=v.memoizedState,_=e.stateNode,S=_.getSnapshotBeforeUpdate(e.elementType===e.type?w:Lr(e.type,w),x);_.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var C=e.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ae(163))}}catch(O){wt(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,he=t;break}he=e.return}return v=V_,V_=!1,v}function du(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 a=i.destroy;i.destroy=void 0,a!==void 0&&xv(e,n,a)}i=i.next}while(i!==r)}}function bh(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 kv(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 ox(t){var e=t.alternate;e!==null&&(t.alternate=null,ox(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ri],delete e[Ru],delete e[fv],delete e[CD],delete e[xD])),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 sx(t){return t.tag===5||t.tag===3||t.tag===4}function q_(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||sx(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 Pv(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(Pv(t,e,n),t=t.sibling;t!==null;)Pv(t,e,n),t=t.sibling}function Ev(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(Ev(t,e,n),t=t.sibling;t!==null;)Ev(t,e,n),t=t.sibling}var Zt=null,Mr=!1;function sa(t,e,n){for(n=n.child;n!==null;)lx(t,e,n),n=n.sibling}function lx(t,e,n){if(oi&&typeof oi.onCommitFiberUnmount=="function")try{oi.onCommitFiberUnmount(ph,n)}catch{}switch(n.tag){case 5:cn||vs(n,e);case 6:var r=Zt,i=Mr;Zt=null,sa(t,e,n),Zt=r,Mr=i,Zt!==null&&(Mr?(t=Zt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Zt.removeChild(n.stateNode));break;case 18:Zt!==null&&(Mr?(t=Zt,n=n.stateNode,t.nodeType===8?im(t.parentNode,n):t.nodeType===1&&im(t,n),ku(t)):im(Zt,n.stateNode));break;case 4:r=Zt,i=Mr,Zt=n.stateNode.containerInfo,Mr=!0,sa(t,e,n),Zt=r,Mr=i;break;case 0:case 11:case 14:case 15:if(!cn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,s=a.destroy;a=a.tag,s!==void 0&&(a&2||a&4)&&xv(n,e,s),i=i.next}while(i!==r)}sa(t,e,n);break;case 1:if(!cn&&(vs(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){wt(n,e,u)}sa(t,e,n);break;case 21:sa(t,e,n);break;case 22:n.mode&1?(cn=(r=cn)||n.memoizedState!==null,sa(t,e,n),cn=r):sa(t,e,n);break;default:sa(t,e,n)}}function K_(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new zD),e.forEach(function(r){var i=XD.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Rr(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~a}if(r=i,r=Pt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*jD(r/1960))-r,10t?16:t,ma===null)var r=!1;else{if(t=ma,ma=null,Vd=0,$e&6)throw Error(ae(331));var i=$e;for($e|=4,he=t.current;he!==null;){var a=he,s=a.child;if(he.flags&16){var u=a.deletions;if(u!==null){for(var c=0;cPt()-t0?ao(t,0):e0|=n),In(t,e)}function mx(t,e){e===0&&(t.mode&1?(e=gf,gf<<=1,!(gf&130023424)&&(gf=4194304)):e=1);var n=Sn();t=Gi(t,e),t!==null&&(Ku(t,e,n),In(t,n))}function YD(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),mx(t,n)}function XD(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(ae(314))}r!==null&&r.delete(e),mx(t,n)}var vx;vx=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Rn.current)Tn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Tn=!1,BD(t,e,n);Tn=!!(t.flags&131072)}else Tn=!1,ft&&e.flags&1048576&&_C(e,Bd,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;rd(t,e),t=e.pendingProps;var i=Ls(e,fn.current);xs(e,n),i=Ky(null,e,r,t,i,n);var a=Yy();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,An(r)?(a=!0,Dd(e)):a=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,jy(e),i.updater=_h,e.stateNode=i,i._reactInternals=e,vv(e,r,t,n),e=_v(null,e,r,!0,a,n)):(e.tag=0,ft&&a&&Ny(e),vn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(rd(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=JD(r),t=Lr(r,t),i){case 0:e=Sv(null,e,r,t,n);break e;case 1:e=j_(null,e,r,t,n);break e;case 11:e=G_(null,e,r,t,n);break e;case 14:e=U_(null,e,r,Lr(r.type,t),n);break e}throw Error(ae(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),Sv(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),j_(t,e,r,i,n);case 3:e:{if(ex(e),t===null)throw Error(ae(387));r=e.pendingProps,a=e.memoizedState,i=a.element,xC(t,e),zd(e,r,null,n);var s=e.memoizedState;if(r=s.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=a,e.memoizedState=a,e.flags&256){i=Bs(Error(ae(423)),e),e=W_(t,e,r,n,i);break e}else if(r!==i){i=Bs(Error(ae(424)),e),e=W_(t,e,r,n,i);break e}else for(Hn=wa(e.stateNode.containerInfo.firstChild),Vn=e,ft=!0,Nr=null,n=OC(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ms(),r===i){e=Ui(t,e,n);break e}vn(t,e,r,n)}e=e.child}return e;case 5:return TC(e),t===null&&pv(e),r=e.type,i=e.pendingProps,a=t!==null?t.memoizedProps:null,s=i.children,uv(r,i)?s=null:a!==null&&uv(r,a)&&(e.flags|=32),ZC(t,e),vn(t,e,s,n),e.child;case 6:return t===null&&pv(e),null;case 13:return tx(t,e,n);case 4:return Wy(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ds(e,null,r,n):vn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),G_(t,e,r,i,n);case 7:return vn(t,e,e.pendingProps,n),e.child;case 8:return vn(t,e,e.pendingProps.children,n),e.child;case 12:return vn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,a=e.memoizedProps,s=i.value,at(Fd,r._currentValue),r._currentValue=s,a!==null)if(Gr(a.value,s)){if(a.children===i.children&&!Rn.current){e=Ui(t,e,n);break e}}else for(a=e.child,a!==null&&(a.return=e);a!==null;){var u=a.dependencies;if(u!==null){s=a.child;for(var c=u.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=Bi(-1,n&-n),c.tag=2;var f=a.updateQueue;if(f!==null){f=f.shared;var h=f.pending;h===null?c.next=c:(c.next=h.next,h.next=c),f.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),gv(a.return,n,e),u.lanes|=n;break}c=c.next}}else if(a.tag===10)s=a.type===e.type?null:a.child;else if(a.tag===18){if(s=a.return,s===null)throw Error(ae(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),gv(s,n,e),s=a.sibling}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}vn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,xs(e,n),i=mr(i),r=r(i),e.flags|=1,vn(t,e,r,n),e.child;case 14:return r=e.type,i=Lr(r,e.pendingProps),i=Lr(r.type,i),U_(t,e,r,i,n);case 15:return QC(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),rd(t,e),e.tag=1,An(r)?(t=!0,Dd(e)):t=!1,xs(e,n),PC(e,r,i),vv(e,r,i,n),_v(null,e,r,!0,t,n);case 19:return nx(t,e,n);case 22:return JC(t,e,n)}throw Error(ae(156,e.tag))};function yx(t,e){return W2(t,e)}function QD(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 hr(t,e,n,r){return new QD(t,e,n,r)}function a0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function JD(t){if(typeof t=="function")return a0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===xy)return 11;if(t===ky)return 14}return 2}function ka(t,e){var n=t.alternate;return n===null?(n=hr(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 od(t,e,n,r,i,a){var s=2;if(r=t,typeof t=="function")a0(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ls:return oo(n.children,i,a,e);case Cy:s=8,i|=8;break;case Gm:return t=hr(12,n,e,i|2),t.elementType=Gm,t.lanes=a,t;case Um:return t=hr(13,n,e,i),t.elementType=Um,t.lanes=a,t;case jm:return t=hr(19,n,e,i),t.elementType=jm,t.lanes=a,t;case E2:return xh(n,i,a,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case k2:s=10;break e;case P2:s=9;break e;case xy:s=11;break e;case ky:s=14;break e;case ca:s=16,r=null;break e}throw Error(ae(130,t==null?t:typeof t,""))}return e=hr(s,n,e,i),e.elementType=t,e.type=r,e.lanes=a,e}function oo(t,e,n,r){return t=hr(7,t,r,e),t.lanes=n,t}function xh(t,e,n,r){return t=hr(22,t,r,e),t.elementType=E2,t.lanes=n,t.stateNode={isHidden:!1},t}function dm(t,e,n){return t=hr(6,t,null,e),t.lanes=n,t}function hm(t,e,n){return e=hr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function ZD(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=qg(0),this.expirationTimes=qg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function o0(t,e,n,r,i,a,s,u,c){return t=new ZD(t,e,n,u,c),e===1?(e=1,a===!0&&(e|=8)):e=0,a=hr(3,null,null,e),t.current=a,a.stateNode=t,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},jy(a),t}function e3(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}e(),t.exports=Qn})(tM);var nw=xd;Fm.createRoot=nw.createRoot,Fm.hydrateRoot=nw.hydrateRoot;const a3="modulepreload",o3=function(t,e){return new URL(t,e).href},rw={},bx=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(a=>{if(a=o3(a,r),a in rw)return;rw[a]=!0;const s=a.endsWith(".css"),u=s?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const p=i[h];if(p.href===a&&(!s||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${u}`))return;const f=document.createElement("link");if(f.rel=s?"stylesheet":a3,s||(f.as="script",f.crossOrigin=""),f.href=a,document.head.appendChild(f),s)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e())};var Iv={},s3={get exports(){return Iv},set exports(t){Iv=t}},Cx={};/** * @license React * use-sync-external-store-shim.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 $s=be;function l3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var u3=typeof Object.is=="function"?Object.is:l3,c3=$s.useState,f3=$s.useEffect,d3=$s.useLayoutEffect,h3=$s.useDebugValue;function p3(t,e){var n=e(),r=c3({inst:{value:n,getSnapshot:e}}),i=r[0].inst,a=r[1];return d3(function(){i.value=n,i.getSnapshot=e,pm(i)&&a({inst:i})},[t,n,e]),f3(function(){return pm(i)&&a({inst:i}),t(function(){pm(i)&&a({inst:i})})},[t]),h3(n),n}function pm(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!u3(t,n)}catch{return!0}}function g3(t,e){return e()}var m3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g3:p3;Cx.useSyncExternalStore=$s.useSyncExternalStore!==void 0?$s.useSyncExternalStore:m3;(function(t){t.exports=Cx})(s3);var Lv={},v3={get exports(){return Lv},set exports(t){Lv=t}},xx={};/** * @license React * use-sync-external-store-shim/with-selector.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 Th=be,y3=Iv;function S3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _3=typeof Object.is=="function"?Object.is:S3,w3=y3.useSyncExternalStore,b3=Th.useRef,C3=Th.useEffect,x3=Th.useMemo,k3=Th.useDebugValue;xx.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var a=b3(null);if(a.current===null){var s={hasValue:!1,value:null};a.current=s}else s=a.current;a=x3(function(){function c(y){if(!f){if(f=!0,h=y,y=r(y),i!==void 0&&s.hasValue){var v=s.value;if(i(v,y))return p=v}return p=y}if(v=p,_3(h,y))return v;var w=r(y);return i!==void 0&&i(v,w)?v:(h=y,p=w)}var f=!1,h,p,g=n===void 0?null:n;return[function(){return c(e())},g===null?void 0:function(){return c(g())}]},[e,n,r,i]);var u=w3(t,a[0],a[1]);return C3(function(){s.hasValue=!0,s.value=u},[u]),k3(u),u};(function(t){t.exports=xx})(v3);function P3(t){t()}let kx=P3;const E3=t=>kx=t,O3=()=>kx,Yd=be.createContext(null);function T3(){return be.useContext(Yd)}const R3=()=>{throw new Error("uSES not initialized!")};let Px=R3;const A3=t=>{Px=t},I3=(t,e)=>t===e;function L3(t=Yd){const e=t===Yd?T3:()=>be.useContext(t);return function(r,i=I3){const{store:a,subscription:s,getServerState:u}=e(),c=Px(s.addNestedSub,a.getState,u||a.getState,r,i);return be.useDebugValue(c),c}}const I8=L3();function Xd(){return Xd=Object.assign?Object.assign.bind():function(t){for(var e=1;e{let r=e;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=e;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,a=n={callback:r,next:null,prev:n};return a.prev?a.prev.next=a:e=a,function(){!i||e===null||(i=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}const aw={notify(){},get:()=>[]};function V3(t,e){let n,r=aw;function i(p){return c(),r.subscribe(p)}function a(){r.notify()}function s(){h.onStateChange&&h.onStateChange()}function u(){return Boolean(n)}function c(){n||(n=e?e.addNestedSub(s):t.subscribe(s),r=H3())}function f(){n&&(n(),n=void 0,r.clear(),r=aw)}const h={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:s,isSubscribed:u,trySubscribe:c,tryUnsubscribe:f,getListeners:()=>r};return h}const q3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",K3=q3?be.useLayoutEffect:be.useEffect;function Y3({store:t,context:e,children:n,serverState:r}){const i=be.useMemo(()=>{const u=V3(t);return{store:t,subscription:u,getServerState:r?()=>r:void 0}},[t,r]),a=be.useMemo(()=>t.getState(),[t]);K3(()=>{const{subscription:u}=i;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==t.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[i,a]);const s=e||Yd;return As.createElement(s.Provider,{value:i},n)}A3(Lv.useSyncExternalStoreWithSelector);E3(xd.unstable_batchedUpdates);function sd(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?sd=function(n){return typeof n}:sd=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},sd(t)}function X3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ow(t,e){for(var n=0;n1?e-1:0),r=1;r3?e.i-4:e.i:Array.isArray(t)?1:g0(t)?2:m0(t)?3:0}function Ps(t,e){return Hs(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function eN(t,e){return Hs(t)===2?t.get(e):t[e]}function Ix(t,e,n){var r=Hs(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function Lx(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function g0(t){return oN&&t instanceof Map}function m0(t){return sN&&t instanceof Set}function Za(t){return t.o||t.t}function v0(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=Dx(t);delete e[ct];for(var n=Es(e),r=0;r1&&(t.set=t.add=t.clear=t.delete=tN),Object.freeze(t),e&&ho(t,function(n,r){return y0(r,!0)},!0)),t}function tN(){Br(2)}function S0(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function li(t){var e=zv[t];return e||Br(18,t),e}function nN(t,e){zv[t]||(zv[t]=e)}function Bv(){return Bu}function gm(t,e){e&&(li("Patches"),t.u=[],t.s=[],t.v=e)}function Qd(t){Fv(t),t.p.forEach(rN),t.p=null}function Fv(t){t===Bu&&(Bu=t.l)}function sw(t){return Bu={p:[],l:Bu,h:t,m:!0,_:0}}function rN(t){var e=t[ct];e.i===0||e.i===1?e.j():e.O=!0}function mm(t,e){e._=e.p.length;var n=e.p[0],r=t!==void 0&&t!==n;return e.h.g||li("ES5").S(e,t,r),r?(n[ct].P&&(Qd(e),Br(4)),ji(t)&&(t=Jd(e,t),e.l||Zd(e,t)),e.u&&li("Patches").M(n[ct].t,t,e.u,e.s)):t=Jd(e,n,[]),Qd(e),e.u&&e.v(e.u,e.s),t!==Mx?t:void 0}function Jd(t,e,n){if(S0(e))return e;var r=e[ct];if(!r)return ho(e,function(u,c){return lw(t,r,e,u,c,n)},!0),e;if(r.A!==t)return e;if(!r.P)return Zd(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=v0(r.k):r.o,a=i,s=!1;r.i===3&&(a=new Set(i),i.clear(),s=!0),ho(a,function(u,c){return lw(t,r,i,u,c,n,s)}),Zd(t,i,!1),n&&t.u&&li("Patches").N(r,n,t.u,t.s)}return r.o}function lw(t,e,n,r,i,a,s){if(Ra(i)){var u=Jd(t,i,a&&e&&e.i!==3&&!Ps(e.R,r)?a.concat(r):void 0);if(Ix(n,r,u),!Ra(u))return;t.m=!1}else s&&n.add(i);if(ji(i)&&!S0(i)){if(!t.h.D&&t._<1)return;Jd(t,i),e&&e.A.l||Zd(t,i)}}function Zd(t,e,n){n===void 0&&(n=!1),!t.l&&t.h.D&&t.m&&y0(e,n)}function vm(t,e){var n=t[ct];return(n?Za(n):t)[e]}function uw(t,e){if(e in t)for(var n=Object.getPrototypeOf(t);n;){var r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function pa(t){t.P||(t.P=!0,t.l&&pa(t.l))}function ym(t){t.o||(t.o=v0(t.t))}function $v(t,e,n){var r=g0(e)?li("MapSet").F(e,n):m0(e)?li("MapSet").T(e,n):t.g?function(i,a){var s=Array.isArray(i),u={i:s?1:0,A:a?a.A:Bv(),P:!1,I:!1,R:{},l:a,t:i,k:null,o:null,j:null,C:!1},c=u,f=Fu;s&&(c=[u],f=Jl);var h=Proxy.revocable(c,f),p=h.revoke,g=h.proxy;return u.k=g,u.j=p,g}(e,n):li("ES5").J(e,n);return(n?n.A:Bv()).p.push(r),r}function iN(t){return Ra(t)||Br(22,t),function e(n){if(!ji(n))return n;var r,i=n[ct],a=Hs(n);if(i){if(!i.P&&(i.i<4||!li("ES5").K(i)))return i.t;i.I=!0,r=cw(n,a),i.I=!1}else r=cw(n,a);return ho(r,function(s,u){i&&eN(i.t,s)===u||Ix(r,s,e(u))}),a===3?new Set(r):r}(t)}function cw(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return v0(t)}function aN(){function t(a,s){var u=i[a];return u?u.enumerable=s:i[a]=u={configurable:!0,enumerable:s,get:function(){var c=this[ct];return Fu.get(c,a)},set:function(c){var f=this[ct];Fu.set(f,a,c)}},u}function e(a){for(var s=a.length-1;s>=0;s--){var u=a[s][ct];if(!u.P)switch(u.i){case 5:r(u)&&pa(u);break;case 4:n(u)&&pa(u)}}}function n(a){for(var s=a.t,u=a.k,c=Es(u),f=c.length-1;f>=0;f--){var h=c[f];if(h!==ct){var p=s[h];if(p===void 0&&!Ps(s,h))return!0;var g=u[h],y=g&&g[ct];if(y?y.t!==p:!Lx(g,p))return!0}}var v=!!s[ct];return c.length!==Es(s).length+(v?0:1)}function r(a){var s=a.k;if(s.length!==a.t.length)return!0;var u=Object.getOwnPropertyDescriptor(s,s.length-1);if(u&&!u.get)return!0;for(var c=0;c1?_-1:0),C=1;C<_;C++)S[C-1]=arguments[C];return c.produce(w,function(O){var I;return(I=a).call.apply(I,[x,O].concat(S))})}}var f;if(typeof a!="function"&&Br(6),s!==void 0&&typeof s!="function"&&Br(7),ji(i)){var h=sw(r),p=$v(r,i,void 0),g=!0;try{f=a(p),g=!1}finally{g?Qd(h):Fv(h)}return typeof Promise<"u"&&f instanceof Promise?f.then(function(w){return gm(h,s),mm(w,h)},function(w){throw Qd(h),w}):(gm(h,s),mm(f,h))}if(!i||typeof i!="object"){if((f=a(i))===void 0&&(f=i),f===Mx&&(f=void 0),r.D&&y0(f,!0),s){var y=[],v=[];li("Patches").M(i,f,y,v),s(y,v)}return f}Br(21,i)},this.produceWithPatches=function(i,a){if(typeof i=="function")return function(f){for(var h=arguments.length,p=Array(h>1?h-1:0),g=1;g=0;i--){var a=r[i];if(a.path.length===0&&a.op==="replace"){n=a.value;break}}i>-1&&(r=r.slice(i+1));var s=li("Patches").$;return Ra(n)?s(n,r):this.produce(n,function(u){return s(u,r)})},t}(),Xn=new uN,Nx=Xn.produce;Xn.produceWithPatches.bind(Xn);Xn.setAutoFreeze.bind(Xn);Xn.setUseProxies.bind(Xn);Xn.applyPatches.bind(Xn);Xn.createDraft.bind(Xn);Xn.finishDraft.bind(Xn);function gr(t){return gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gr(t)}function cN(t,e){if(gr(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(gr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bx(t){var e=cN(t,"string");return gr(e)==="symbol"?e:String(e)}function Ur(t,e,n){return e=Bx(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gw(t){for(var e=1;e"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(un(1));return n(w0)(t,e)}if(typeof t!="function")throw new Error(un(2));var i=t,a=e,s=[],u=s,c=!1;function f(){u===s&&(u=s.slice())}function h(){if(c)throw new Error(un(3));return a}function p(w){if(typeof w!="function")throw new Error(un(4));if(c)throw new Error(un(5));var x=!0;return f(),u.push(w),function(){if(x){if(c)throw new Error(un(6));x=!1,f();var S=u.indexOf(w);u.splice(S,1),s=null}}}function g(w){if(!fN(w))throw new Error(un(7));if(typeof w.type>"u")throw new Error(un(8));if(c)throw new Error(un(9));try{c=!0,a=i(a,w)}finally{c=!1}for(var x=s=u,_=0;_"u")throw new Error(un(12));if(typeof n(void 0,{type:eh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(un(13))})}function Fx(t){for(var e=Object.keys(t),n={},r=0;r"u")throw f&&f.type,new Error(un(14));p[y]=x,h=h||x!==w}return h=h||a.length!==Object.keys(c).length,h?p:c}}function th(){for(var t=arguments.length,e=new Array(t),n=0;n0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]{Object.keys(L).forEach(function(D){C(D)&&h[D]!==L[D]&&g.indexOf(D)===-1&&g.push(D)}),Object.keys(h).forEach(function(D){L[D]===void 0&&C(D)&&g.indexOf(D)===-1&&h[D]!==void 0&&g.push(D)}),y===null&&(y=setInterval(_,i)),h=L},a)}function _(){if(g.length===0){y&&clearInterval(y),y=null;return}var L=g.shift(),D=r.reduce(function(U,X){return X.in(U,L,h)},h[L]);if(D!==void 0)try{p[L]=c(D)}catch(U){console.error("redux-persist/createPersistoid: error serializing state",U)}else delete p[L];g.length===0&&S()}function S(){Object.keys(p).forEach(function(L){h[L]===void 0&&delete p[L]}),v=u.setItem(s,c(p)).catch(O)}function C(L){return!(n&&n.indexOf(L)===-1&&L!=="_persist"||e&&e.indexOf(L)!==-1)}function O(L){f&&f(L)}var I=function(){for(;g.length!==0;)_();return v||Promise.resolve()};return{update:x,flush:I}}function WN(t){return JSON.stringify(t)}function HN(t){var e=t.transforms||[],n="".concat(t.keyPrefix!==void 0?t.keyPrefix:C0).concat(t.key),r=t.storage;t.debug;var i;return t.deserialize===!1?i=function(s){return s}:typeof t.deserialize=="function"?i=t.deserialize:i=VN,r.getItem(n).then(function(a){if(a)try{var s={},u=i(a);return Object.keys(u).forEach(function(c){s[c]=e.reduceRight(function(f,h){return h.out(f,c,u)},i(u[c]))}),s}catch(c){throw c}else return})}function VN(t){return JSON.parse(t)}function qN(t){var e=t.storage,n="".concat(t.keyPrefix!==void 0?t.keyPrefix:C0).concat(t.key);return e.removeItem(n,KN)}function KN(t){}function Cw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ti(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function QN(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a=0)&&(n[i]=t[i]);return n}var JN=5e3;function ZN(t,e){var n=t.version!==void 0?t.version:$N;t.debug;var r=t.stateReconciler===void 0?UN:t.stateReconciler,i=t.getStoredState||HN,a=t.timeout!==void 0?t.timeout:JN,s=null,u=!1,c=!0,f=function(p){return p._persist.rehydrated&&s&&!c&&s.update(p),p};return function(h,p){var g=h||{},y=g._persist,v=XN(g,["_persist"]),w=v;if(p.type===Wx){var x=!1,_=function(U,X){x||(p.rehydrate(t.key,U,X),x=!0)};if(a&&setTimeout(function(){!x&&_(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(t.key,'"')))},a),c=!1,s||(s=jN(t)),y)return Ti({},e(w,p),{_persist:y});if(typeof p.rehydrate!="function"||typeof p.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return p.register(t.key),i(t).then(function(D){var U=t.migrate||function(X,K){return Promise.resolve(X)};U(D,n).then(function(X){_(X)},function(X){_(void 0,X)})},function(D){_(void 0,D)}),Ti({},e(w,p),{_persist:{version:n,rehydrated:!1}})}else{if(p.type===Hx)return u=!0,p.result(qN(t)),Ti({},e(w,p),{_persist:y});if(p.type===Ux)return p.result(s&&s.flush()),Ti({},e(w,p),{_persist:y});if(p.type===jx)c=!0;else if(p.type===x0){if(u)return Ti({},w,{_persist:Ti({},y,{rehydrated:!0})});if(p.key===t.key){var S=e(w,p),C=p.payload,O=r!==!1&&C!==void 0?r(C,h,S,t):S,I=Ti({},O,{_persist:Ti({},y,{rehydrated:!0})});return f(I)}}}if(!y)return e(h,p);var L=e(w,p);return L===w?h:f(Ti({},L,{_persist:y}))}}function xw(t){return n5(t)||t5(t)||e5()}function e5(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function t5(t){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]")return Array.from(t)}function n5(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&arguments[0]!==void 0?arguments[0]:qx,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case Vx:return Uv({},e,{registry:[].concat(xw(e.registry),[n.key])});case x0:var r=e.registry.indexOf(n.key),i=xw(e.registry);return i.splice(r,1),Uv({},e,{registry:i,bootstrapped:i.length===0});default:return e}};function a5(t,e,n){var r=n||!1,i=w0(i5,qx,e&&e.enhancer?e.enhancer:void 0),a=function(f){i.dispatch({type:Vx,key:f})},s=function(f,h,p){var g={type:x0,payload:h,err:p,key:f};t.dispatch(g),i.dispatch(g),r&&u.getState().bootstrapped&&(r(),r=!1)},u=Uv({},i,{purge:function(){var f=[];return t.dispatch({type:Hx,result:function(p){f.push(p)}}),Promise.all(f)},flush:function(){var f=[];return t.dispatch({type:Ux,result:function(p){f.push(p)}}),Promise.all(f)},pause:function(){t.dispatch({type:jx})},persist:function(){t.dispatch({type:Wx,register:a,rehydrate:s})}});return e&&e.manualPersist||u.persist(),u}var k0={},P0={};P0.__esModule=!0;P0.default=l5;function fd(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fd=function(n){return typeof n}:fd=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},fd(t)}function bm(){}var o5={getItem:bm,setItem:bm,removeItem:bm};function s5(t){if((typeof self>"u"?"undefined":fd(self))!=="object"||!(t in self))return!1;try{var e=self[t],n="redux-persist ".concat(t," test");e.setItem(n,"test"),e.getItem(n),e.removeItem(n)}catch{return!1}return!0}function l5(t){var e="".concat(t,"Storage");return s5(e)?self[e]:o5}k0.__esModule=!0;k0.default=f5;var u5=c5(P0);function c5(t){return t&&t.__esModule?t:{default:t}}function f5(t){var e=(0,u5.default)(t);return{getItem:function(r){return new Promise(function(i,a){i(e.getItem(r))})},setItem:function(r,i){return new Promise(function(a,s){a(e.setItem(r,i))})},removeItem:function(r){return new Promise(function(i,a){i(e.removeItem(r))})}}}var Kx=void 0,d5=h5(k0);function h5(t){return t&&t.__esModule?t:{default:t}}var p5=(0,d5.default)("local");Kx=p5;var Yx={},Xx={},po={};Object.defineProperty(po,"__esModule",{value:!0});po.PLACEHOLDER_UNDEFINED=po.PACKAGE_NAME=void 0;po.PACKAGE_NAME="redux-deep-persist";po.PLACEHOLDER_UNDEFINED="@@placeholder/undefined";var E0={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigType=void 0,function(e){e[e.WHITELIST=0]="WHITELIST",e[e.BLACKLIST=1]="BLACKLIST"}(t.ConfigType||(t.ConfigType={}))})(E0);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRootKeysGroup=t.throwError=t.configValidator=t.transformsValidator=t.singleTransformValidator=t.findDuplicatesAndSubsets=t.unique=t.preserveUndefined=t.mergeDeep=t.dissocPath=t.assocPath=t.path=t.difference=t.cloneDeep=t._cloneDeep=t.getCircularPath=t.isEmpty=t.isDate=t.isString=t.isIntegerString=t.isPlainObject=t.isArray=t.isLength=t.isObjectLike=void 0;const e=po,n=E0,r=function(j){return typeof j=="object"&&j!==null};t.isObjectLike=r;const i=function(j){return typeof j=="number"&&j>-1&&j%1==0&&j<=Number.MAX_SAFE_INTEGER};t.isLength=i,t.isArray=Array.isArray||function(j){return(0,t.isLength)(j&&j.length)&&Object.prototype.toString.call(j)==="[object Array]"};const a=function(j){return!!j&&typeof j=="object"&&!(0,t.isArray)(j)};t.isPlainObject=a;const s=function(j){return String(~~j)===j&&Number(j)>=0};t.isIntegerString=s;const u=function(j){return Object.prototype.toString.call(j)==="[object String]"};t.isString=u;const c=function(j){return Object.prototype.toString.call(j)==="[object Date]"};t.isDate=c;const f=function(j){return Object.keys(j).length===0};t.isEmpty=f;const h=Object.prototype.hasOwnProperty,p=function(j,T,$){$||($=new Set([j])),T||(T="");for(const V in j){const ie=T?`${T}.${V}`:V,W=j[V];if((0,t.isObjectLike)(W))return $.has(W)?`${T}.${V}:`:($.add(W),(0,t.getCircularPath)(W,ie,$))}return null};t.getCircularPath=p;const g=function(j){if(!(0,t.isObjectLike)(j))return j;if((0,t.isDate)(j))return new Date(+j);const T=(0,t.isArray)(j)?[]:{};for(const $ in j){const V=j[$];T[$]=(0,t._cloneDeep)(V)}return T};t._cloneDeep=g;const y=function(j){const T=(0,t.getCircularPath)(j);if(T)throw new Error(`${e.PACKAGE_NAME}: circular dependency detected under the path '${T}' of object you're trying to persist: ${j}`);return(0,t._cloneDeep)(j)};t.cloneDeep=y;const v=function(j,T){if(j===T)return{};if(!(0,t.isObjectLike)(j)||!(0,t.isObjectLike)(T))return T;const $=(0,t.cloneDeep)(j),V=(0,t.cloneDeep)(T),ie=Object.keys($).reduce((Y,Q)=>(h.call(V,Q)||(Y[Q]=void 0),Y),{});if((0,t.isDate)($)||(0,t.isDate)(V))return $.valueOf()===V.valueOf()?{}:V;const W=Object.keys(V).reduce((Y,Q)=>{if(!h.call($,Q))return Y[Q]=V[Q],Y;const oe=(0,t.difference)($[Q],V[Q]);return(0,t.isObjectLike)(oe)&&(0,t.isEmpty)(oe)&&!(0,t.isDate)(oe)?(0,t.isArray)($)&&!(0,t.isArray)(V)||!(0,t.isArray)($)&&(0,t.isArray)(V)?V:Y:(Y[Q]=oe,Y)},ie);return delete W._persist,W};t.difference=v;const w=function(j,T){return T.reduce(($,V)=>{if($){const ie=parseInt(V,10),W=(0,t.isIntegerString)(V)&&ie<0?$.length+ie:V;return(0,t.isString)($)?$.charAt(W):$[W]}},j)};t.path=w;const x=function(j,T){return[...j].reverse().reduce((ie,W,Y)=>{const Q=(0,t.isIntegerString)(W)?[]:{};return Q[W]=Y===0?T:ie,Q},{})};t.assocPath=x;const _=function(j,T){const $=(0,t.cloneDeep)(j);return T.reduce((V,ie,W)=>(W===T.length-1&&V&&(0,t.isObjectLike)(V)&&delete V[ie],V&&V[ie]),$),$};t.dissocPath=_;const S=function(j,T,...$){if(!$||!$.length)return T;const V=$.shift(),{preservePlaceholder:ie,preserveUndefined:W}=j;if((0,t.isObjectLike)(T)&&(0,t.isObjectLike)(V))for(const Y in V)if((0,t.isObjectLike)(V[Y])&&(0,t.isObjectLike)(T[Y]))T[Y]||(T[Y]={}),S(j,T[Y],V[Y]);else if((0,t.isArray)(T)){let Q=V[Y];const oe=ie?e.PLACEHOLDER_UNDEFINED:void 0;W||(Q=typeof Q<"u"?Q:T[parseInt(Y,10)]),Q=Q!==e.PLACEHOLDER_UNDEFINED?Q:oe,T[parseInt(Y,10)]=Q}else{const Q=V[Y]!==e.PLACEHOLDER_UNDEFINED?V[Y]:void 0;T[Y]=Q}return S(j,T,...$)},C=function(j,T,$){return S({preservePlaceholder:$==null?void 0:$.preservePlaceholder,preserveUndefined:$==null?void 0:$.preserveUndefined},(0,t.cloneDeep)(j),(0,t.cloneDeep)(T))};t.mergeDeep=C;const O=function(j,T=[],$,V,ie){if(!(0,t.isObjectLike)(j))return j;for(const W in j){const Y=j[W],Q=(0,t.isArray)(j),oe=V?V+"."+W:W;Y===null&&($===n.ConfigType.WHITELIST&&T.indexOf(oe)===-1||$===n.ConfigType.BLACKLIST&&T.indexOf(oe)!==-1)&&Q&&(j[parseInt(W,10)]=void 0),Y===void 0&&ie&&$===n.ConfigType.BLACKLIST&&T.indexOf(oe)===-1&&Q&&(j[parseInt(W,10)]=e.PLACEHOLDER_UNDEFINED),O(Y,T,$,oe,ie)}},I=function(j,T,$,V){const ie=(0,t.cloneDeep)(j);return O(ie,T,$,"",V),ie};t.preserveUndefined=I;const L=function(j,T,$){return $.indexOf(j)===T};t.unique=L;const D=function(j){return j.reduce((T,$)=>{const V=j.filter(ve=>ve===$),ie=j.filter(ve=>($+".").indexOf(ve+".")===0),{duplicates:W,subsets:Y}=T,Q=V.length>1&&W.indexOf($)===-1,oe=ie.length>1;return{duplicates:[...W,...Q?V:[]],subsets:[...Y,...oe?ie:[]].filter(t.unique).sort()}},{duplicates:[],subsets:[]})};t.findDuplicatesAndSubsets=D;const U=function(j,T,$){const V=$===n.ConfigType.WHITELIST?"whitelist":"blacklist",ie=`${e.PACKAGE_NAME}: incorrect ${V} configuration.`,W=`Check your create${$===n.ConfigType.WHITELIST?"White":"Black"}list arguments. `;if(!(0,t.isString)(T)||T.length<1)throw new Error(`${ie} Name (key) of reducer is required. ${W}`);if(!j||!j.length)return;const{duplicates:Y,subsets:Q}=(0,t.findDuplicatesAndSubsets)(j);if(Y.length>1)throw new Error(`${ie} Duplicated paths. ${JSON.stringify(Y)} ${W}`);if(Q.length>1)throw new Error(`${ie} You are trying to persist an entire property and also some of its subset. ${JSON.stringify(Q)} ${W}`)};t.singleTransformValidator=U;const X=function(j){if(!(0,t.isArray)(j))return;const T=(j==null?void 0:j.map($=>$.deepPersistKey).filter($=>$))||[];if(T.length){const $=T.filter((V,ie)=>T.indexOf(V)!==ie);if($.length)throw new Error(`${e.PACKAGE_NAME}: found duplicated keys in transforms creators. You can createWhitelist or createBlacklist for a specific root reducer key only once. Duplicated keys among createWhitelist and createBlacklist transforms are not allowed. Duplicates: ${JSON.stringify($)}`)}};t.transformsValidator=X;const K=function({whitelist:j,blacklist:T}){if(j&&j.length&&T&&T.length)throw new Error(`${e.PACKAGE_NAME}: you should not define a whitelist and blacklist in parallel. It is allowed to use only one of these lists per config.`);if(j){const{duplicates:$,subsets:V}=(0,t.findDuplicatesAndSubsets)(j);(0,t.throwError)({duplicates:$,subsets:V},"whitelist")}if(T){const{duplicates:$,subsets:V}=(0,t.findDuplicatesAndSubsets)(T);(0,t.throwError)({duplicates:$,subsets:V},"blacklist")}};t.configValidator=K;const te=function({duplicates:j,subsets:T},$){if(j.length)throw new Error(`${e.PACKAGE_NAME}: duplicates of paths found in your ${$}. ${JSON.stringify(j)}`);if(T.length)throw new Error(`${e.PACKAGE_NAME}: subsets of some parent keys found in your ${$}. You must decide if you want to persist an entire path or its specific subset. ${JSON.stringify(T)}`)};t.throwError=te;const ce=function(j){return(0,t.isArray)(j)?j.filter(t.unique).reduce((T,$)=>{const V=$.split("."),ie=V[0],W=V.slice(1).join(".")||void 0,Y=T.filter(oe=>Object.keys(oe)[0]===ie)[0],Q=Y?Object.values(Y)[0]:void 0;return Y||T.push({[ie]:W?[W]:void 0}),Y&&!Q&&W&&(Y[ie]=[W]),Y&&Q&&W&&Q.push(W),T},[]):[]};t.getRootKeysGroup=ce})(Xx);(function(t){var e=yn&&yn.__rest||function(p,g){var y={};for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&g.indexOf(v)<0&&(y[v]=p[v]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function")for(var w=0,v=Object.getOwnPropertySymbols(p);w!x(S)&&p?p(_,S,C):_,out:(_,S,C)=>!x(S)&&g?g(_,S,C):_,deepPersistKey:v&&v[0]}},s=(p,g,y,{debug:v,whitelist:w,blacklist:x,transforms:_})=>{if(w||x)throw new Error("State reconciler autoMergeDeep uses custom transforms instead of old whitelist or blacklist config properties. Please use createWhitelist or createBlacklist transforms.");(0,n.transformsValidator)(_);const S=(0,n.cloneDeep)(y);let C=p;if(C&&(0,n.isObjectLike)(C)){const O=(0,n.difference)(g,y);(0,n.isEmpty)(O)||(C=(0,n.mergeDeep)(p,O,{preserveUndefined:!0}),v&&console.log(`${r.PACKAGE_NAME}/autoMergeDeep: sub state of your state was modified by reducer during rehydration. Values from reducer will be kept: ${JSON.stringify(O)}`)),Object.keys(C).forEach(I=>{if(I!=="_persist"){if((0,n.isObjectLike)(S[I])){S[I]=(0,n.mergeDeep)(S[I],C[I]);return}S[I]=C[I]}})}return v&&C&&(0,n.isObjectLike)(C)&&console.log(`${r.PACKAGE_NAME}/autoMergeDeep: rehydrated keys ${JSON.stringify(C)}`),S};t.autoMergeDeep=s;const u=(p,g)=>((0,n.singleTransformValidator)(g,p,i.ConfigType.WHITELIST),a(y=>{if(!g||!g.length)return y;let v=null,w;return g.forEach(x=>{const _=x.split(".");w=(0,n.path)(y,_),typeof w>"u"&&(0,n.isIntegerString)(_[_.length-1])&&(w=r.PLACEHOLDER_UNDEFINED);const S=(0,n.assocPath)(_,w),C=(0,n.isArray)(S)?[]:{};v=(0,n.mergeDeep)(v||C,S,{preservePlaceholder:!0})}),v||y},y=>(0,n.preserveUndefined)(y,g,i.ConfigType.WHITELIST),{whitelist:[p]}));t.createWhitelist=u;const c=(p,g)=>((0,n.singleTransformValidator)(g,p,i.ConfigType.BLACKLIST),a(y=>{if(!g||!g.length)return;const v=(0,n.preserveUndefined)(y,g,i.ConfigType.BLACKLIST,!0);return g.map(x=>x.split(".")).reduce((x,_)=>(0,n.dissocPath)(x,_),v)},y=>(0,n.preserveUndefined)(y,g,i.ConfigType.BLACKLIST),{whitelist:[p]}));t.createBlacklist=c;const f=function(p,g){return g.map(y=>{const v=Object.keys(y)[0],w=y[v];return p===i.ConfigType.WHITELIST?(0,t.createWhitelist)(v,w):(0,t.createBlacklist)(v,w)})};t.getTransforms=f;const h=p=>{var{key:g,whitelist:y,blacklist:v,storage:w,transforms:x,rootReducer:_}=p,S=e(p,["key","whitelist","blacklist","storage","transforms","rootReducer"]);(0,n.configValidator)({whitelist:y,blacklist:v});const C=(0,n.getRootKeysGroup)(y),O=(0,n.getRootKeysGroup)(v),I=Object.keys(_(void 0,{type:""})),L=C.map(ce=>Object.keys(ce)[0]),D=O.map(ce=>Object.keys(ce)[0]),U=I.filter(ce=>L.indexOf(ce)===-1&&D.indexOf(ce)===-1),X=(0,t.getTransforms)(i.ConfigType.WHITELIST,C),K=(0,t.getTransforms)(i.ConfigType.BLACKLIST,O),te=(0,n.isArray)(y)?U.map(ce=>(0,t.createBlacklist)(ce)):[];return Object.assign(Object.assign({},S),{key:g,storage:w,transforms:[...X,...K,...te,...x||[]],stateReconciler:t.autoMergeDeep})};t.getPersistConfig=h})(Yx);const Ef=(t,e)=>Math.floor(t/e)*e,va=(t,e)=>Math.round(t/e)*e;var _t={},g5={get exports(){return _t},set exports(t){_t=t}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */(function(t,e){(function(){var n,r="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",u="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",f=500,h="__lodash_placeholder__",p=1,g=2,y=4,v=1,w=2,x=1,_=2,S=4,C=8,O=16,I=32,L=64,D=128,U=256,X=512,K=30,te="...",ce=800,j=16,T=1,$=2,V=3,ie=1/0,W=9007199254740991,Y=17976931348623157e292,Q=0/0,oe=4294967295,ve=oe-1,we=oe>>>1,Ue=[["ary",D],["bind",x],["bindKey",_],["curry",C],["curryRight",O],["flip",X],["partial",I],["partialRight",L],["rearg",U]],At="[object Arguments]",me="[object Array]",qt="[object AsyncFunction]",Bt="[object Boolean]",bn="[object Date]",wr="[object DOMException]",Ft="[object Error]",xe="[object Function]",Wr="[object GeneratorFunction]",Et="[object Map]",gi="[object Number]",Xs="[object Null]",Mn="[object Object]",Fa="[object Promise]",Qs="[object Proxy]",er="[object RegExp]",Kt="[object Set]",Dn="[object String]",bt="[object Symbol]",$a="[object Undefined]",Hr="[object WeakMap]",Co="[object WeakSet]",Vr="[object ArrayBuffer]",br="[object DataView]",xo="[object Float32Array]",ko="[object Float64Array]",Po="[object Int8Array]",Eo="[object Int16Array]",Oo="[object Int32Array]",Js="[object Uint8Array]",Zs="[object Uint8ClampedArray]",Cr="[object Uint16Array]",Ki="[object Uint32Array]",sp=/\b__p \+= '';/g,tc=/\b(__p \+=) '' \+/g,lp=/(__e\(.*?\)|\b__t\)) \+\n'';/g,el=/&(?:amp|lt|gt|quot|#39);/g,Yi=/[&<>"']/g,up=RegExp(el.source),mi=RegExp(Yi.source),cp=/<%-([\s\S]+?)%>/g,fp=/<%([\s\S]+?)%>/g,nc=/<%=([\s\S]+?)%>/g,dp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hp=/^\w*$/,xr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tl=/[\\^$.*+?()[\]{}|]/g,pp=RegExp(tl.source),nl=/^\s+/,gp=/\s/,mp=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Xi=/\{\n\/\* \[wrapped with (.+)\] \*/,vp=/,? & /,yp=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Sp=/[()=,{}\[\]\/\s]/,_p=/\\(\\)?/g,wp=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vi=/\w*$/,bp=/^[-+]0x[0-9a-f]+$/i,Cp=/^0b[01]+$/i,xp=/^\[object .+?Constructor\]$/,kp=/^0o[0-7]+$/i,Pp=/^(?:0|[1-9]\d*)$/,Ep=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qi=/($^)/,Op=/['\n\r\u2028\u2029\\]/g,yi="\\ud800-\\udfff",rl="\\u0300-\\u036f",Tp="\\ufe20-\\ufe2f",To="\\u20d0-\\u20ff",il=rl+Tp+To,rc="\\u2700-\\u27bf",ic="a-z\\xdf-\\xf6\\xf8-\\xff",Rp="\\xac\\xb1\\xd7\\xf7",ac="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ap="\\u2000-\\u206f",Ip=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",oc="A-Z\\xc0-\\xd6\\xd8-\\xde",sc="\\ufe0e\\ufe0f",lc=Rp+ac+Ap+Ip,al="['’]",Lp="["+yi+"]",uc="["+lc+"]",Ro="["+il+"]",cc="\\d+",Ao="["+rc+"]",Io="["+ic+"]",fc="[^"+yi+lc+cc+rc+ic+oc+"]",ol="\\ud83c[\\udffb-\\udfff]",dc="(?:"+Ro+"|"+ol+")",hc="[^"+yi+"]",sl="(?:\\ud83c[\\udde6-\\uddff]){2}",ll="[\\ud800-\\udbff][\\udc00-\\udfff]",Si="["+oc+"]",pc="\\u200d",gc="(?:"+Io+"|"+fc+")",Mp="(?:"+Si+"|"+fc+")",Lo="(?:"+al+"(?:d|ll|m|re|s|t|ve))?",mc="(?:"+al+"(?:D|LL|M|RE|S|T|VE))?",vc=dc+"?",yc="["+sc+"]?",Mo="(?:"+pc+"(?:"+[hc,sl,ll].join("|")+")"+yc+vc+")*",ul="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",cl="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Do=yc+vc+Mo,Dp="(?:"+[Ao,sl,ll].join("|")+")"+Do,Sc="(?:"+[hc+Ro+"?",Ro,sl,ll,Lp].join("|")+")",fl=RegExp(al,"g"),_c=RegExp(Ro,"g"),kr=RegExp(ol+"(?="+ol+")|"+Sc+Do,"g"),za=RegExp([Si+"?"+Io+"+"+Lo+"(?="+[uc,Si,"$"].join("|")+")",Mp+"+"+mc+"(?="+[uc,Si+gc,"$"].join("|")+")",Si+"?"+gc+"+"+Lo,Si+"+"+mc,cl,ul,cc,Dp].join("|"),"g"),Np=RegExp("["+pc+yi+il+sc+"]"),wc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Bp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],bc=-1,nt={};nt[xo]=nt[ko]=nt[Po]=nt[Eo]=nt[Oo]=nt[Js]=nt[Zs]=nt[Cr]=nt[Ki]=!0,nt[At]=nt[me]=nt[Vr]=nt[Bt]=nt[br]=nt[bn]=nt[Ft]=nt[xe]=nt[Et]=nt[gi]=nt[Mn]=nt[er]=nt[Kt]=nt[Dn]=nt[Hr]=!1;var et={};et[At]=et[me]=et[Vr]=et[br]=et[Bt]=et[bn]=et[xo]=et[ko]=et[Po]=et[Eo]=et[Oo]=et[Et]=et[gi]=et[Mn]=et[er]=et[Kt]=et[Dn]=et[bt]=et[Js]=et[Zs]=et[Cr]=et[Ki]=!0,et[Ft]=et[xe]=et[Hr]=!1;var Cc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Fp={"&":"&","<":"<",">":">",'"':""","'":"'"},E={"&":"&","<":"<",">":">",""":'"',"'":"'"},N={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},H=parseFloat,fe=parseInt,Ie=typeof yn=="object"&&yn&&yn.Object===Object&&yn,Ye=typeof self=="object"&&self&&self.Object===Object&&self,Pe=Ie||Ye||Function("return this")(),Te=e&&!e.nodeType&&e,ze=Te&&!0&&t&&!t.nodeType&&t,dn=ze&&ze.exports===Te,Yt=dn&&Ie.process,$t=function(){try{var F=ze&&ze.require&&ze.require("util").types;return F||Yt&&Yt.binding&&Yt.binding("util")}catch{}}(),No=$t&&$t.isArrayBuffer,Bo=$t&&$t.isDate,dl=$t&&$t.isMap,H0=$t&&$t.isRegExp,V0=$t&&$t.isSet,q0=$t&&$t.isTypedArray;function Nn(F,J,q){switch(q.length){case 0:return F.call(J);case 1:return F.call(J,q[0]);case 2:return F.call(J,q[0],q[1]);case 3:return F.call(J,q[0],q[1],q[2])}return F.apply(J,q)}function eE(F,J,q,de){for(var Ce=-1,je=F==null?0:F.length;++Ce-1}function $p(F,J,q){for(var de=-1,Ce=F==null?0:F.length;++de-1;);return q}function t1(F,J){for(var q=F.length;q--&&Fo(J,F[q],0)>-1;);return q}function uE(F,J){for(var q=F.length,de=0;q--;)F[q]===J&&++de;return de}var cE=jp(Cc),fE=jp(Fp);function dE(F){return"\\"+N[F]}function hE(F,J){return F==null?n:F[J]}function $o(F){return Np.test(F)}function pE(F){return wc.test(F)}function gE(F){for(var J,q=[];!(J=F.next()).done;)q.push(J.value);return q}function qp(F){var J=-1,q=Array(F.size);return F.forEach(function(de,Ce){q[++J]=[Ce,de]}),q}function n1(F,J){return function(q){return F(J(q))}}function ea(F,J){for(var q=-1,de=F.length,Ce=0,je=[];++q-1}function nO(o,l){var d=this.__data__,m=Gc(d,o);return m<0?(++this.size,d.push([o,l])):d[m][1]=l,this}_i.prototype.clear=JE,_i.prototype.delete=ZE,_i.prototype.get=eO,_i.prototype.has=tO,_i.prototype.set=nO;function wi(o){var l=-1,d=o==null?0:o.length;for(this.clear();++l=l?o:l)),o}function ir(o,l,d,m,b,P){var R,M=l&p,z=l&g,Z=l&y;if(d&&(R=b?d(o,m,b,P):d(o)),R!==n)return R;if(!ht(o))return o;var ee=ke(o);if(ee){if(R=oT(o),!M)return Cn(o,R)}else{var ne=an(o),ue=ne==xe||ne==Wr;if(oa(o))return F1(o,M);if(ne==Mn||ne==At||ue&&!b){if(R=z||ue?{}:rS(o),!M)return z?YO(o,yO(R,o)):KO(o,p1(R,o))}else{if(!et[ne])return b?o:{};R=sT(o,ne,M)}}P||(P=new Er);var ge=P.get(o);if(ge)return ge;P.set(o,R),IS(o)?o.forEach(function(_e){R.add(ir(_e,l,d,_e,o,P))}):RS(o)&&o.forEach(function(_e,Le){R.set(Le,ir(_e,l,d,Le,o,P))});var Se=Z?z?Sg:yg:z?kn:zt,Oe=ee?n:Se(o);return tr(Oe||o,function(_e,Le){Oe&&(Le=_e,_e=o[Le]),Sl(R,Le,ir(_e,l,d,Le,o,P))}),R}function SO(o){var l=zt(o);return function(d){return g1(d,o,l)}}function g1(o,l,d){var m=d.length;if(o==null)return!m;for(o=rt(o);m--;){var b=d[m],P=l[b],R=o[b];if(R===n&&!(b in o)||!P(R))return!1}return!0}function m1(o,l,d){if(typeof o!="function")throw new nr(s);return Pl(function(){o.apply(n,d)},l)}function _l(o,l,d,m){var b=-1,P=xc,R=!0,M=o.length,z=[],Z=l.length;if(!M)return z;d&&(l=ut(l,Bn(d))),m?(P=$p,R=!1):l.length>=i&&(P=hl,R=!1,l=new ja(l));e:for(;++bb?0:b+d),m=m===n||m>b?b:Ee(m),m<0&&(m+=b),m=d>m?0:MS(m);d0&&d(M)?l>1?Xt(M,l-1,d,m,b):Zi(b,M):m||(b[b.length]=M)}return b}var eg=W1(),S1=W1(!0);function qr(o,l){return o&&eg(o,l,zt)}function tg(o,l){return o&&S1(o,l,zt)}function jc(o,l){return Ji(l,function(d){return Pi(o[d])})}function Ha(o,l){l=ia(l,o);for(var d=0,m=l.length;o!=null&&dl}function bO(o,l){return o!=null&&Xe.call(o,l)}function CO(o,l){return o!=null&&l in rt(o)}function xO(o,l,d){return o>=rn(l,d)&&o=120&&ee.length>=120)?new ja(R&&ee):n}ee=o[0];var ne=-1,ue=M[0];e:for(;++ne-1;)M!==o&&Mc.call(M,z,1),Mc.call(o,z,1);return o}function R1(o,l){for(var d=o?l.length:0,m=d-1;d--;){var b=l[d];if(d==m||b!==P){var P=b;ki(b)?Mc.call(o,b,1):fg(o,b)}}return o}function lg(o,l){return o+Bc(c1()*(l-o+1))}function BO(o,l,d,m){for(var b=-1,P=Lt(Nc((l-o)/(d||1)),0),R=q(P);P--;)R[m?P:++b]=o,o+=d;return R}function ug(o,l){var d="";if(!o||l<1||l>W)return d;do l%2&&(d+=o),l=Bc(l/2),l&&(o+=o);while(l);return d}function Re(o,l){return Pg(oS(o,l,Pn),o+"")}function FO(o){return h1(Xo(o))}function $O(o,l){var d=Xo(o);return ef(d,Wa(l,0,d.length))}function Cl(o,l,d,m){if(!ht(o))return o;l=ia(l,o);for(var b=-1,P=l.length,R=P-1,M=o;M!=null&&++bb?0:b+l),d=d>b?b:d,d<0&&(d+=b),b=l>d?0:d-l>>>0,l>>>=0;for(var P=q(b);++m>>1,R=o[P];R!==null&&!$n(R)&&(d?R<=l:R=i){var Z=l?null:ZO(o);if(Z)return Pc(Z);R=!1,b=hl,z=new ja}else z=l?[]:M;e:for(;++m=m?o:ar(o,l,d)}var B1=RE||function(o){return Pe.clearTimeout(o)};function F1(o,l){if(l)return o.slice();var d=o.length,m=a1?a1(d):new o.constructor(d);return o.copy(m),m}function gg(o){var l=new o.constructor(o.byteLength);return new Ic(l).set(new Ic(o)),l}function WO(o,l){var d=l?gg(o.buffer):o.buffer;return new o.constructor(d,o.byteOffset,o.byteLength)}function HO(o){var l=new o.constructor(o.source,vi.exec(o));return l.lastIndex=o.lastIndex,l}function VO(o){return yl?rt(yl.call(o)):{}}function $1(o,l){var d=l?gg(o.buffer):o.buffer;return new o.constructor(d,o.byteOffset,o.length)}function z1(o,l){if(o!==l){var d=o!==n,m=o===null,b=o===o,P=$n(o),R=l!==n,M=l===null,z=l===l,Z=$n(l);if(!M&&!Z&&!P&&o>l||P&&R&&z&&!M&&!Z||m&&R&&z||!d&&z||!b)return 1;if(!m&&!P&&!Z&&o=M)return z;var Z=d[m];return z*(Z=="desc"?-1:1)}}return o.index-l.index}function G1(o,l,d,m){for(var b=-1,P=o.length,R=d.length,M=-1,z=l.length,Z=Lt(P-R,0),ee=q(z+Z),ne=!m;++M1?d[b-1]:n,R=b>2?d[2]:n;for(P=o.length>3&&typeof P=="function"?(b--,P):n,R&&pn(d[0],d[1],R)&&(P=b<3?n:P,b=1),l=rt(l);++m-1?b[P?l[R]:R]:n}}function q1(o){return xi(function(l){var d=l.length,m=d,b=rr.prototype.thru;for(o&&l.reverse();m--;){var P=l[m];if(typeof P!="function")throw new nr(s);if(b&&!R&&Jc(P)=="wrapper")var R=new rr([],!0)}for(m=R?m:d;++m1&&Ne.reverse(),ee&&zM))return!1;var Z=P.get(o),ee=P.get(l);if(Z&&ee)return Z==l&&ee==o;var ne=-1,ue=!0,ge=d&w?new ja:n;for(P.set(o,l),P.set(l,o);++ne1?"& ":"")+l[m],l=l.join(d>2?", ":" "),o.replace(mp,`{ /* [wrapped with `+l+`] */ `)}function uT(o){return ke(o)||Ka(o)||!!(l1&&o&&o[l1])}function ki(o,l){var d=typeof o;return l=l??W,!!l&&(d=="number"||d!="symbol"&&Pp.test(o))&&o>-1&&o%1==0&&o0){if(++l>=ce)return arguments[0]}else l=0;return o.apply(n,arguments)}}function ef(o,l){var d=-1,m=o.length,b=m-1;for(l=l===n?m:l;++d1?o[l-1]:n;return d=typeof d=="function"?(o.pop(),d):n,yS(o,d)});function SS(o){var l=k(o);return l.__chain__=!0,l}function _R(o,l){return l(o),o}function tf(o,l){return l(o)}var wR=xi(function(o){var l=o.length,d=l?o[0]:0,m=this.__wrapped__,b=function(P){return Zp(P,o)};return l>1||this.__actions__.length||!(m instanceof Me)||!ki(d)?this.thru(b):(m=m.slice(d,+d+(l?1:0)),m.__actions__.push({func:tf,args:[b],thisArg:n}),new rr(m,this.__chain__).thru(function(P){return l&&!P.length&&P.push(n),P}))});function bR(){return SS(this)}function CR(){return new rr(this.value(),this.__chain__)}function xR(){this.__values__===n&&(this.__values__=LS(this.value()));var o=this.__index__>=this.__values__.length,l=o?n:this.__values__[this.__index__++];return{done:o,value:l}}function kR(){return this}function PR(o){for(var l,d=this;d instanceof zc;){var m=dS(d);m.__index__=0,m.__values__=n,l?b.__wrapped__=m:l=m;var b=m;d=d.__wrapped__}return b.__wrapped__=o,l}function ER(){var o=this.__wrapped__;if(o instanceof Me){var l=o;return this.__actions__.length&&(l=new Me(this)),l=l.reverse(),l.__actions__.push({func:tf,args:[Eg],thisArg:n}),new rr(l,this.__chain__)}return this.thru(Eg)}function OR(){return D1(this.__wrapped__,this.__actions__)}var TR=qc(function(o,l,d){Xe.call(o,d)?++o[d]:bi(o,d,1)});function RR(o,l,d){var m=ke(o)?K0:_O;return d&&pn(o,l,d)&&(l=n),m(o,ye(l,3))}function AR(o,l){var d=ke(o)?Ji:y1;return d(o,ye(l,3))}var IR=V1(hS),LR=V1(pS);function MR(o,l){return Xt(nf(o,l),1)}function DR(o,l){return Xt(nf(o,l),ie)}function NR(o,l,d){return d=d===n?1:Ee(d),Xt(nf(o,l),d)}function _S(o,l){var d=ke(o)?tr:na;return d(o,ye(l,3))}function wS(o,l){var d=ke(o)?tE:v1;return d(o,ye(l,3))}var BR=qc(function(o,l,d){Xe.call(o,d)?o[d].push(l):bi(o,d,[l])});function FR(o,l,d,m){o=xn(o)?o:Xo(o),d=d&&!m?Ee(d):0;var b=o.length;return d<0&&(d=Lt(b+d,0)),lf(o)?d<=b&&o.indexOf(l,d)>-1:!!b&&Fo(o,l,d)>-1}var $R=Re(function(o,l,d){var m=-1,b=typeof l=="function",P=xn(o)?q(o.length):[];return na(o,function(R){P[++m]=b?Nn(l,R,d):wl(R,l,d)}),P}),zR=qc(function(o,l,d){bi(o,d,l)});function nf(o,l){var d=ke(o)?ut:x1;return d(o,ye(l,3))}function GR(o,l,d,m){return o==null?[]:(ke(l)||(l=l==null?[]:[l]),d=m?n:d,ke(d)||(d=d==null?[]:[d]),O1(o,l,d))}var UR=qc(function(o,l,d){o[d?0:1].push(l)},function(){return[[],[]]});function jR(o,l,d){var m=ke(o)?zp:J0,b=arguments.length<3;return m(o,ye(l,4),d,b,na)}function WR(o,l,d){var m=ke(o)?nE:J0,b=arguments.length<3;return m(o,ye(l,4),d,b,v1)}function HR(o,l){var d=ke(o)?Ji:y1;return d(o,of(ye(l,3)))}function VR(o){var l=ke(o)?h1:FO;return l(o)}function qR(o,l,d){(d?pn(o,l,d):l===n)?l=1:l=Ee(l);var m=ke(o)?gO:$O;return m(o,l)}function KR(o){var l=ke(o)?mO:GO;return l(o)}function YR(o){if(o==null)return 0;if(xn(o))return lf(o)?zo(o):o.length;var l=an(o);return l==Et||l==Kt?o.size:ag(o).length}function XR(o,l,d){var m=ke(o)?Gp:UO;return d&&pn(o,l,d)&&(l=n),m(o,ye(l,3))}var QR=Re(function(o,l){if(o==null)return[];var d=l.length;return d>1&&pn(o,l[0],l[1])?l=[]:d>2&&pn(l[0],l[1],l[2])&&(l=[l[0]]),O1(o,Xt(l,1),[])}),rf=AE||function(){return Pe.Date.now()};function JR(o,l){if(typeof l!="function")throw new nr(s);return o=Ee(o),function(){if(--o<1)return l.apply(this,arguments)}}function bS(o,l,d){return l=d?n:l,l=o&&l==null?o.length:l,Ci(o,D,n,n,n,n,l)}function CS(o,l){var d;if(typeof l!="function")throw new nr(s);return o=Ee(o),function(){return--o>0&&(d=l.apply(this,arguments)),o<=1&&(l=n),d}}var Tg=Re(function(o,l,d){var m=x;if(d.length){var b=ea(d,Ko(Tg));m|=I}return Ci(o,m,l,d,b)}),xS=Re(function(o,l,d){var m=x|_;if(d.length){var b=ea(d,Ko(xS));m|=I}return Ci(l,m,o,d,b)});function kS(o,l,d){l=d?n:l;var m=Ci(o,C,n,n,n,n,n,l);return m.placeholder=kS.placeholder,m}function PS(o,l,d){l=d?n:l;var m=Ci(o,O,n,n,n,n,n,l);return m.placeholder=PS.placeholder,m}function ES(o,l,d){var m,b,P,R,M,z,Z=0,ee=!1,ne=!1,ue=!0;if(typeof o!="function")throw new nr(s);l=sr(l)||0,ht(d)&&(ee=!!d.leading,ne="maxWait"in d,P=ne?Lt(sr(d.maxWait)||0,l):P,ue="trailing"in d?!!d.trailing:ue);function ge(xt){var Tr=m,Oi=b;return m=b=n,Z=xt,R=o.apply(Oi,Tr),R}function Se(xt){return Z=xt,M=Pl(Le,l),ee?ge(xt):R}function Oe(xt){var Tr=xt-z,Oi=xt-Z,VS=l-Tr;return ne?rn(VS,P-Oi):VS}function _e(xt){var Tr=xt-z,Oi=xt-Z;return z===n||Tr>=l||Tr<0||ne&&Oi>=P}function Le(){var xt=rf();if(_e(xt))return Ne(xt);M=Pl(Le,Oe(xt))}function Ne(xt){return M=n,ue&&m?ge(xt):(m=b=n,R)}function zn(){M!==n&&B1(M),Z=0,m=z=b=M=n}function gn(){return M===n?R:Ne(rf())}function Gn(){var xt=rf(),Tr=_e(xt);if(m=arguments,b=this,z=xt,Tr){if(M===n)return Se(z);if(ne)return B1(M),M=Pl(Le,l),ge(z)}return M===n&&(M=Pl(Le,l)),R}return Gn.cancel=zn,Gn.flush=gn,Gn}var ZR=Re(function(o,l){return m1(o,1,l)}),eA=Re(function(o,l,d){return m1(o,sr(l)||0,d)});function tA(o){return Ci(o,X)}function af(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new nr(s);var d=function(){var m=arguments,b=l?l.apply(this,m):m[0],P=d.cache;if(P.has(b))return P.get(b);var R=o.apply(this,m);return d.cache=P.set(b,R)||P,R};return d.cache=new(af.Cache||wi),d}af.Cache=wi;function of(o){if(typeof o!="function")throw new nr(s);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function nA(o){return CS(2,o)}var rA=jO(function(o,l){l=l.length==1&&ke(l[0])?ut(l[0],Bn(ye())):ut(Xt(l,1),Bn(ye()));var d=l.length;return Re(function(m){for(var b=-1,P=rn(m.length,d);++b=l}),Ka=w1(function(){return arguments}())?w1:function(o){return St(o)&&Xe.call(o,"callee")&&!s1.call(o,"callee")},ke=q.isArray,yA=No?Bn(No):PO;function xn(o){return o!=null&&sf(o.length)&&!Pi(o)}function Ct(o){return St(o)&&xn(o)}function SA(o){return o===!0||o===!1||St(o)&&hn(o)==Bt}var oa=LE||Gg,_A=Bo?Bn(Bo):EO;function wA(o){return St(o)&&o.nodeType===1&&!El(o)}function bA(o){if(o==null)return!0;if(xn(o)&&(ke(o)||typeof o=="string"||typeof o.splice=="function"||oa(o)||Yo(o)||Ka(o)))return!o.length;var l=an(o);if(l==Et||l==Kt)return!o.size;if(kl(o))return!ag(o).length;for(var d in o)if(Xe.call(o,d))return!1;return!0}function CA(o,l){return bl(o,l)}function xA(o,l,d){d=typeof d=="function"?d:n;var m=d?d(o,l):n;return m===n?bl(o,l,n,d):!!m}function Ag(o){if(!St(o))return!1;var l=hn(o);return l==Ft||l==wr||typeof o.message=="string"&&typeof o.name=="string"&&!El(o)}function kA(o){return typeof o=="number"&&u1(o)}function Pi(o){if(!ht(o))return!1;var l=hn(o);return l==xe||l==Wr||l==qt||l==Qs}function TS(o){return typeof o=="number"&&o==Ee(o)}function sf(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=W}function ht(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function St(o){return o!=null&&typeof o=="object"}var RS=dl?Bn(dl):TO;function PA(o,l){return o===l||ig(o,l,wg(l))}function EA(o,l,d){return d=typeof d=="function"?d:n,ig(o,l,wg(l),d)}function OA(o){return AS(o)&&o!=+o}function TA(o){if(dT(o))throw new Ce(a);return b1(o)}function RA(o){return o===null}function AA(o){return o==null}function AS(o){return typeof o=="number"||St(o)&&hn(o)==gi}function El(o){if(!St(o)||hn(o)!=Mn)return!1;var l=Lc(o);if(l===null)return!0;var d=Xe.call(l,"constructor")&&l.constructor;return typeof d=="function"&&d instanceof d&&Tc.call(d)==EE}var Ig=H0?Bn(H0):RO;function IA(o){return TS(o)&&o>=-W&&o<=W}var IS=V0?Bn(V0):AO;function lf(o){return typeof o=="string"||!ke(o)&&St(o)&&hn(o)==Dn}function $n(o){return typeof o=="symbol"||St(o)&&hn(o)==bt}var Yo=q0?Bn(q0):IO;function LA(o){return o===n}function MA(o){return St(o)&&an(o)==Hr}function DA(o){return St(o)&&hn(o)==Co}var NA=Qc(og),BA=Qc(function(o,l){return o<=l});function LS(o){if(!o)return[];if(xn(o))return lf(o)?Pr(o):Cn(o);if(pl&&o[pl])return gE(o[pl]());var l=an(o),d=l==Et?qp:l==Kt?Pc:Xo;return d(o)}function Ei(o){if(!o)return o===0?o:0;if(o=sr(o),o===ie||o===-ie){var l=o<0?-1:1;return l*Y}return o===o?o:0}function Ee(o){var l=Ei(o),d=l%1;return l===l?d?l-d:l:0}function MS(o){return o?Wa(Ee(o),0,oe):0}function sr(o){if(typeof o=="number")return o;if($n(o))return Q;if(ht(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=ht(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=Z0(o);var d=Cp.test(o);return d||kp.test(o)?fe(o.slice(2),d?2:8):bp.test(o)?Q:+o}function DS(o){return Kr(o,kn(o))}function FA(o){return o?Wa(Ee(o),-W,W):o===0?o:0}function Ve(o){return o==null?"":Fn(o)}var $A=Vo(function(o,l){if(kl(l)||xn(l)){Kr(l,zt(l),o);return}for(var d in l)Xe.call(l,d)&&Sl(o,d,l[d])}),NS=Vo(function(o,l){Kr(l,kn(l),o)}),uf=Vo(function(o,l,d,m){Kr(l,kn(l),o,m)}),zA=Vo(function(o,l,d,m){Kr(l,zt(l),o,m)}),GA=xi(Zp);function UA(o,l){var d=Ho(o);return l==null?d:p1(d,l)}var jA=Re(function(o,l){o=rt(o);var d=-1,m=l.length,b=m>2?l[2]:n;for(b&&pn(l[0],l[1],b)&&(m=1);++d1),P}),Kr(o,Sg(o),d),m&&(d=ir(d,p|g|y,eT));for(var b=l.length;b--;)fg(d,l[b]);return d});function sI(o,l){return FS(o,of(ye(l)))}var lI=xi(function(o,l){return o==null?{}:DO(o,l)});function FS(o,l){if(o==null)return{};var d=ut(Sg(o),function(m){return[m]});return l=ye(l),T1(o,d,function(m,b){return l(m,b[0])})}function uI(o,l,d){l=ia(l,o);var m=-1,b=l.length;for(b||(b=1,o=n);++ml){var m=o;o=l,l=m}if(d||o%1||l%1){var b=c1();return rn(o+b*(l-o+H("1e-"+((b+"").length-1))),l)}return lg(o,l)}var _I=qo(function(o,l,d){return l=l.toLowerCase(),o+(d?GS(l):l)});function GS(o){return Dg(Ve(o).toLowerCase())}function US(o){return o=Ve(o),o&&o.replace(Ep,cE).replace(_c,"")}function wI(o,l,d){o=Ve(o),l=Fn(l);var m=o.length;d=d===n?m:Wa(Ee(d),0,m);var b=d;return d-=l.length,d>=0&&o.slice(d,b)==l}function bI(o){return o=Ve(o),o&&mi.test(o)?o.replace(Yi,fE):o}function CI(o){return o=Ve(o),o&&pp.test(o)?o.replace(tl,"\\$&"):o}var xI=qo(function(o,l,d){return o+(d?"-":"")+l.toLowerCase()}),kI=qo(function(o,l,d){return o+(d?" ":"")+l.toLowerCase()}),PI=H1("toLowerCase");function EI(o,l,d){o=Ve(o),l=Ee(l);var m=l?zo(o):0;if(!l||m>=l)return o;var b=(l-m)/2;return Xc(Bc(b),d)+o+Xc(Nc(b),d)}function OI(o,l,d){o=Ve(o),l=Ee(l);var m=l?zo(o):0;return l&&m>>0,d?(o=Ve(o),o&&(typeof l=="string"||l!=null&&!Ig(l))&&(l=Fn(l),!l&&$o(o))?aa(Pr(o),0,d):o.split(l,d)):[]}var DI=qo(function(o,l,d){return o+(d?" ":"")+Dg(l)});function NI(o,l,d){return o=Ve(o),d=d==null?0:Wa(Ee(d),0,o.length),l=Fn(l),o.slice(d,d+l.length)==l}function BI(o,l,d){var m=k.templateSettings;d&&pn(o,l,d)&&(l=n),o=Ve(o),l=uf({},l,m,J1);var b=uf({},l.imports,m.imports,J1),P=zt(b),R=Vp(b,P),M,z,Z=0,ee=l.interpolate||Qi,ne="__p += '",ue=Kp((l.escape||Qi).source+"|"+ee.source+"|"+(ee===nc?wp:Qi).source+"|"+(l.evaluate||Qi).source+"|$","g"),ge="//# sourceURL="+(Xe.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++bc+"]")+` `;o.replace(ue,function(_e,Le,Ne,zn,gn,Gn){return Ne||(Ne=zn),ne+=o.slice(Z,Gn).replace(Op,dE),Le&&(M=!0,ne+=`' + __e(`+Le+`) + '`),gn&&(z=!0,ne+=`'; `+gn+`; __p += '`),Ne&&(ne+=`' + ((__t = (`+Ne+`)) == null ? '' : __t) + '`),Z=Gn+_e.length,_e}),ne+=`'; `;var Se=Xe.call(l,"variable")&&l.variable;if(!Se)ne=`with (obj) { `+ne+` } `;else if(Sp.test(Se))throw new Ce(u);ne=(z?ne.replace(sp,""):ne).replace(tc,"$1").replace(lp,"$1;"),ne="function("+(Se||"obj")+`) { `+(Se?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(z?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+ne+`return __p }`;var Oe=WS(function(){return je(P,ge+"return "+ne).apply(n,R)});if(Oe.source=ne,Ag(Oe))throw Oe;return Oe}function FI(o){return Ve(o).toLowerCase()}function $I(o){return Ve(o).toUpperCase()}function zI(o,l,d){if(o=Ve(o),o&&(d||l===n))return Z0(o);if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=Pr(l),P=e1(m,b),R=t1(m,b)+1;return aa(m,P,R).join("")}function GI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.slice(0,r1(o)+1);if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=t1(m,Pr(l))+1;return aa(m,0,b).join("")}function UI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.replace(nl,"");if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=e1(m,Pr(l));return aa(m,b).join("")}function jI(o,l){var d=K,m=te;if(ht(l)){var b="separator"in l?l.separator:b;d="length"in l?Ee(l.length):d,m="omission"in l?Fn(l.omission):m}o=Ve(o);var P=o.length;if($o(o)){var R=Pr(o);P=R.length}if(d>=P)return o;var M=d-zo(m);if(M<1)return m;var z=R?aa(R,0,M).join(""):o.slice(0,M);if(b===n)return z+m;if(R&&(M+=z.length-M),Ig(b)){if(o.slice(M).search(b)){var Z,ee=z;for(b.global||(b=Kp(b.source,Ve(vi.exec(b))+"g")),b.lastIndex=0;Z=b.exec(ee);)var ne=Z.index;z=z.slice(0,ne===n?M:ne)}}else if(o.indexOf(Fn(b),M)!=M){var ue=z.lastIndexOf(b);ue>-1&&(z=z.slice(0,ue))}return z+m}function WI(o){return o=Ve(o),o&&up.test(o)?o.replace(el,SE):o}var HI=qo(function(o,l,d){return o+(d?" ":"")+l.toUpperCase()}),Dg=H1("toUpperCase");function jS(o,l,d){return o=Ve(o),l=d?n:l,l===n?pE(o)?bE(o):aE(o):o.match(l)||[]}var WS=Re(function(o,l){try{return Nn(o,n,l)}catch(d){return Ag(d)?d:new Ce(d)}}),VI=xi(function(o,l){return tr(l,function(d){d=Yr(d),bi(o,d,Tg(o[d],o))}),o});function qI(o){var l=o==null?0:o.length,d=ye();return o=l?ut(o,function(m){if(typeof m[1]!="function")throw new nr(s);return[d(m[0]),m[1]]}):[],Re(function(m){for(var b=-1;++bW)return[];var d=oe,m=rn(o,oe);l=ye(l),o-=oe;for(var b=Hp(m,l);++d0||l<0)?new Me(d):(o<0?d=d.takeRight(-o):o&&(d=d.drop(o)),l!==n&&(l=Ee(l),d=l<0?d.dropRight(-l):d.take(l-o)),d)},Me.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Me.prototype.toArray=function(){return this.take(oe)},qr(Me.prototype,function(o,l){var d=/^(?:filter|find|map|reject)|While$/.test(l),m=/^(?:head|last)$/.test(l),b=k[m?"take"+(l=="last"?"Right":""):l],P=m||/^find/.test(l);b&&(k.prototype[l]=function(){var R=this.__wrapped__,M=m?[1]:arguments,z=R instanceof Me,Z=M[0],ee=z||ke(R),ne=function(Le){var Ne=b.apply(k,Zi([Le],M));return m&&ue?Ne[0]:Ne};ee&&d&&typeof Z=="function"&&Z.length!=1&&(z=ee=!1);var ue=this.__chain__,ge=!!this.__actions__.length,Se=P&&!ue,Oe=z&&!ge;if(!P&&ee){R=Oe?R:new Me(this);var _e=o.apply(R,M);return _e.__actions__.push({func:tf,args:[ne],thisArg:n}),new rr(_e,ue)}return Se&&Oe?o.apply(this,M):(_e=this.thru(ne),Se?m?_e.value()[0]:_e.value():_e)})}),tr(["pop","push","shift","sort","splice","unshift"],function(o){var l=Ec[o],d=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",m=/^(?:pop|shift)$/.test(o);k.prototype[o]=function(){var b=arguments;if(m&&!this.__chain__){var P=this.value();return l.apply(ke(P)?P:[],b)}return this[d](function(R){return l.apply(ke(R)?R:[],b)})}}),qr(Me.prototype,function(o,l){var d=k[l];if(d){var m=d.name+"";Xe.call(Wo,m)||(Wo[m]=[]),Wo[m].push({name:l,func:d})}}),Wo[Kc(n,_).name]=[{name:"wrapper",func:n}],Me.prototype.clone=WE,Me.prototype.reverse=HE,Me.prototype.value=VE,k.prototype.at=wR,k.prototype.chain=bR,k.prototype.commit=CR,k.prototype.next=xR,k.prototype.plant=PR,k.prototype.reverse=ER,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=OR,k.prototype.first=k.prototype.head,pl&&(k.prototype[pl]=kR),k},Go=CE();ze?((ze.exports=Go)._=Go,Te._=Go):Pe._=Go}).call(yn)})(g5,_t);const Jo=(t,e,n,r,i,a,s)=>{const u=t/2-(n+i/2)*s,c=e/2-(r+a/2)*s;return{x:u,y:c}},Zo=(t,e,n,r,i=.95)=>{const a=t*i/n,s=e*i/r;return Math.min(1,Math.min(a,s))},L8=.999,M8=.1,D8=20,Nl=.95,N8=30,B8=10,Pw=t=>({x:Math.floor(t.x),y:Math.floor(t.y)}),Ya=t=>{const{width:e,height:n}=t,r={width:e,height:n},i=512*512,a=e/n;let s=e*n,u=448;for(;s1?(r.width=u,r.height=va(u/a,64)):a<1&&(r.height=u,r.width=va(u*a,64)),s=r.width*r.height;return r},m5=t=>({width:va(t.width,64),height:va(t.height,64)}),F8=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],$8=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],Qx=t=>t.kind==="line"&&t.layer==="mask",z8=t=>t.kind==="line"&&t.layer==="base",Ew=t=>t.kind==="image"&&t.layer==="base",G8=t=>t.kind==="fillRect"&&t.layer==="base",U8=t=>t.kind==="eraseRect"&&t.layer==="base",v5=t=>t.kind==="line",Zl={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},y5={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Zl,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush"},Jx=vo({name:"canvas",initialState:y5,reducers:{setTool:(t,e)=>{const n=e.payload;t.tool=e.payload,n!=="move"&&(t.isTransformingBoundingBox=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1)},setLayer:(t,e)=>{t.layer=e.payload},toggleTool:t=>{const e=t.tool;e!=="move"&&(t.tool=e==="brush"?"eraser":"brush")},setMaskColor:(t,e)=>{t.maskColor=e.payload},setBrushColor:(t,e)=>{t.brushColor=e.payload},setBrushSize:(t,e)=>{t.brushSize=e.payload},clearMask:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState.objects=t.layerState.objects.filter(e=>!Qx(e)),t.futureLayerStates=[],t.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:t=>{t.shouldPreserveMaskedArea=!t.shouldPreserveMaskedArea},toggleShouldShowMask:t=>{t.isMaskEnabled=!t.isMaskEnabled},setShouldPreserveMaskedArea:(t,e)=>{t.shouldPreserveMaskedArea=e.payload},setIsMaskEnabled:(t,e)=>{t.isMaskEnabled=e.payload,t.layer=e.payload?"mask":"base"},setShouldShowCheckboardTransparency:(t,e)=>{t.shouldShowCheckboardTransparency=e.payload},setShouldShowBrushPreview:(t,e)=>{t.shouldShowBrushPreview=e.payload},setShouldShowBrush:(t,e)=>{t.shouldShowBrush=e.payload},setCursorPosition:(t,e)=>{t.cursorPosition=e.payload},setInitialCanvasImage:(t,e)=>{const n=e.payload,{stageDimensions:r}=t,i={width:Ef(_t.clamp(n.width,64,512),64),height:Ef(_t.clamp(n.height,64,512),64)},a={x:va(n.width/2-i.width/2,64),y:va(n.height/2-i.height/2,64)};if(t.boundingBoxScaleMethod==="auto"){const c=Ya(i);t.scaledBoundingBoxDimensions=c}t.boundingBoxDimensions=i,t.boundingBoxCoordinates=a,t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState={...Zl,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},t.futureLayerStates=[],t.isCanvasInitialized=!1;const s=Zo(r.width,r.height,n.width,n.height,Nl),u=Jo(r.width,r.height,0,0,n.width,n.height,s);t.stageScale=s,t.stageCoordinates=u,t.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(t,e)=>{const n=m5(e.payload);if(t.boundingBoxDimensions=n,t.boundingBoxScaleMethod==="auto"){const r=Ya(n);t.scaledBoundingBoxDimensions=r}},setBoundingBoxCoordinates:(t,e)=>{t.boundingBoxCoordinates=Pw(e.payload)},setStageCoordinates:(t,e)=>{t.stageCoordinates=e.payload},setBoundingBoxPreviewFill:(t,e)=>{t.boundingBoxPreviewFill=e.payload},setDoesCanvasNeedScaling:(t,e)=>{t.doesCanvasNeedScaling=e.payload},setStageScale:(t,e)=>{t.stageScale=e.payload},setShouldDarkenOutsideBoundingBox:(t,e)=>{t.shouldDarkenOutsideBoundingBox=e.payload},setIsDrawing:(t,e)=>{t.isDrawing=e.payload},clearCanvasHistory:t=>{t.pastLayerStates=[],t.futureLayerStates=[]},setShouldLockBoundingBox:(t,e)=>{t.shouldLockBoundingBox=e.payload},toggleShouldLockBoundingBox:t=>{t.shouldLockBoundingBox=!t.shouldLockBoundingBox},setShouldShowBoundingBox:(t,e)=>{t.shouldShowBoundingBox=e.payload},setIsTransformingBoundingBox:(t,e)=>{t.isTransformingBoundingBox=e.payload},setIsMovingBoundingBox:(t,e)=>{t.isMovingBoundingBox=e.payload},setIsMouseOverBoundingBox:(t,e)=>{t.isMouseOverBoundingBox=e.payload},setIsMoveBoundingBoxKeyHeld:(t,e)=>{t.isMoveBoundingBoxKeyHeld=e.payload},setIsMoveStageKeyHeld:(t,e)=>{t.isMoveStageKeyHeld=e.payload},addImageToStagingArea:(t,e)=>{const{boundingBox:n,image:r}=e.payload;!n||!r||(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),t.layerState.stagingArea.selectedImageIndex=t.layerState.stagingArea.images.length-1,t.futureLayerStates=[])},discardStagedImages:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingOutline=!0},addFillRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n,brushColor:r}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"fillRect",layer:"base",...e,...n,color:r}),t.futureLayerStates=[]},addEraseRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"eraseRect",layer:"base",...e,...n}),t.futureLayerStates=[]},addLine:(t,e)=>{const{tool:n,layer:r,brushColor:i,brushSize:a,shouldRestrictStrokesToBox:s}=t;if(n==="move"||n==="colorPicker")return;const u=a/2,c=r==="base"&&n==="brush"?{color:i}:{};t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift();const f={kind:"line",layer:r,tool:n,strokeWidth:u,points:e.payload,...c};s&&(f.clip={...t.boundingBoxCoordinates,...t.boundingBoxDimensions}),t.layerState.objects.push(f),t.futureLayerStates=[]},addPointToCurrentLine:(t,e)=>{const n=t.layerState.objects.findLast(v5);n&&n.points.push(...e.payload)},undo:t=>{const e=t.pastLayerStates.pop();e&&(t.futureLayerStates.unshift(_t.cloneDeep(t.layerState)),t.futureLayerStates.length>t.maxHistory&&t.futureLayerStates.pop(),t.layerState=e)},redo:t=>{const e=t.futureLayerStates.shift();e&&(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState=e)},setShouldShowGrid:(t,e)=>{t.shouldShowGrid=e.payload},setIsMovingStage:(t,e)=>{t.isMovingStage=e.payload},setShouldSnapToGrid:(t,e)=>{t.shouldSnapToGrid=e.payload},setShouldAutoSave:(t,e)=>{t.shouldAutoSave=e.payload},setShouldShowIntermediates:(t,e)=>{t.shouldShowIntermediates=e.payload},resetCanvas:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState=Zl,t.futureLayerStates=[]},setCanvasContainerDimensions:(t,e)=>{t.canvasContainerDimensions=e.payload},resizeAndScaleCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r=t.layerState.objects.find(Ew),i={width:Math.floor(e),height:Math.floor(n)};if(!r){const h=Zo(i.width,i.height,512,512,Nl),p=Jo(i.width,i.height,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.stageDimensions=i,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}return}const{width:a,height:s}=r,c=Zo(e,n,a,s,.95),f=Jo(i.width,i.height,0,0,a,s,c);t.minimumStageScale=c,t.stageScale=c,t.stageCoordinates=Pw(f),t.stageDimensions=i,t.isCanvasInitialized=!0},resizeCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r={width:Math.floor(e),height:Math.floor(n)};if(t.stageDimensions=r,!t.layerState.objects.find(Ew)){const i=Zo(r.width,r.height,512,512,Nl),a=Jo(r.width,r.height,0,0,512,512,i),s={width:512,height:512};if(t.stageScale=i,t.stageCoordinates=a,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=s,t.boundingBoxScaleMethod==="auto"){const u=Ya(s);t.scaledBoundingBoxDimensions=u}}},resetCanvasView:(t,e)=>{const{contentRect:n,shouldScaleTo1:r}=e.payload,{stageDimensions:{width:i,height:a}}=t,{x:s,y:u,width:c,height:f}=n;if(c!==0&&f!==0){const h=r?1:Zo(i,a,c,f,Nl),p=Jo(i,a,s,u,c,f,h);t.stageScale=h,t.stageCoordinates=p}else{const h=Zo(i,a,512,512,Nl),p=Jo(i,a,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}}},nextStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex,n=t.layerState.stagingArea.images.length;t.layerState.stagingArea.selectedImageIndex=Math.min(e+1,n-1)},prevStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex;t.layerState.stagingArea.selectedImageIndex=Math.max(e-1,0)},commitStagingAreaImage:t=>{const{images:e,selectedImageIndex:n}=t.layerState.stagingArea;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({...e[n]}),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingImage=!0},fitBoundingBoxToStage:t=>{const{boundingBoxDimensions:e,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=t,a=r.width/i,s=r.height/i;if(n.x<0||n.x+e.width>a||n.y<0||n.y+e.height>s){const u={width:Ef(_t.clamp(a,64,512),64),height:Ef(_t.clamp(s,64,512),64)},c={x:va(a/2-u.width/2,64),y:va(s/2-u.height/2,64)};if(t.boundingBoxDimensions=u,t.boundingBoxCoordinates=c,t.boundingBoxScaleMethod==="auto"){const f=Ya(u);t.scaledBoundingBoxDimensions=f}}},setBoundingBoxScaleMethod:(t,e)=>{if(t.boundingBoxScaleMethod=e.payload,e.payload==="auto"){const n=Ya(t.boundingBoxDimensions);t.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(t,e)=>{t.scaledBoundingBoxDimensions=e.payload},setShouldShowStagingImage:(t,e)=>{t.shouldShowStagingImage=e.payload},setShouldShowStagingOutline:(t,e)=>{t.shouldShowStagingOutline=e.payload},setShouldShowCanvasDebugInfo:(t,e)=>{t.shouldShowCanvasDebugInfo=e.payload},setShouldRestrictStrokesToBox:(t,e)=>{t.shouldRestrictStrokesToBox=e.payload},setShouldCropToBoundingBoxOnSave:(t,e)=>{t.shouldCropToBoundingBoxOnSave=e.payload},setColorPickerColor:(t,e)=>{t.colorPickerColor=e.payload},commitColorPickerColor:t=>{t.brushColor={...t.colorPickerColor,a:t.brushColor.a},t.tool="brush"},setMergedCanvas:(t,e)=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.futureLayerStates=[],t.layerState.objects=[e.payload]},resetCanvasInteractionState:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMoveBoundingBoxKeyHeld=!1,t.isMoveStageKeyHeld=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1,t.isTransformingBoundingBox=!1},mouseLeftCanvas:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isTransformingBoundingBox=!1}}}),{addEraseRect:j8,addFillRect:W8,addImageToStagingArea:S5,addLine:H8,addPointToCurrentLine:V8,clearCanvasHistory:q8,clearMask:K8,commitColorPickerColor:Y8,commitStagingAreaImage:X8,discardStagedImages:Q8,fitBoundingBoxToStage:J8,mouseLeftCanvas:Z8,nextStagingAreaImage:eU,prevStagingAreaImage:tU,redo:nU,resetCanvas:rU,resetCanvasInteractionState:iU,resetCanvasView:aU,resizeAndScaleCanvas:oU,resizeCanvas:sU,setBoundingBoxCoordinates:lU,setBoundingBoxDimensions:uU,setBoundingBoxPreviewFill:cU,setBoundingBoxScaleMethod:fU,setBrushColor:dU,setBrushSize:hU,setCanvasContainerDimensions:pU,setColorPickerColor:gU,setCursorPosition:mU,setDoesCanvasNeedScaling:vU,setInitialCanvasImage:yU,setIsDrawing:SU,setIsMaskEnabled:_U,setIsMouseOverBoundingBox:wU,setIsMoveBoundingBoxKeyHeld:bU,setIsMoveStageKeyHeld:CU,setIsMovingBoundingBox:xU,setIsMovingStage:kU,setIsTransformingBoundingBox:PU,setLayer:EU,setMaskColor:OU,setMergedCanvas:TU,setShouldAutoSave:RU,setShouldCropToBoundingBoxOnSave:AU,setShouldDarkenOutsideBoundingBox:IU,setShouldLockBoundingBox:LU,setShouldPreserveMaskedArea:MU,setShouldShowBoundingBox:DU,setShouldShowBrush:NU,setShouldShowBrushPreview:BU,setShouldShowCanvasDebugInfo:FU,setShouldShowCheckboardTransparency:$U,setShouldShowGrid:zU,setShouldShowIntermediates:GU,setShouldShowStagingImage:UU,setShouldShowStagingOutline:jU,setShouldSnapToGrid:WU,setStageCoordinates:HU,setStageScale:VU,setTool:qU,toggleShouldLockBoundingBox:KU,toggleTool:YU,undo:XU,setScaledBoundingBoxDimensions:QU,setShouldRestrictStrokesToBox:JU}=Jx.actions,_5=Jx.reducer,w5={currentImageUuid:"",galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},Zx=vo({name:"gallery",initialState:w5,reducers:{setCurrentImage:(t,e)=>{t.currentImage=e.payload,t.currentImageUuid=e.payload.uuid},removeImage:(t,e)=>{const{uuid:n,category:r}=e.payload,i=t.categories[r].images,a=i.filter(s=>s.uuid!==n);if(n===t.currentImageUuid){const s=i.findIndex(c=>c.uuid===n),u=_t.clamp(s,0,a.length-1);t.currentImage=a.length?a[u]:void 0,t.currentImageUuid=a.length?a[u].uuid:""}t.categories[r].images=a},addImage:(t,e)=>{const{image:n,category:r}=e.payload,{uuid:i,url:a,mtime:s}=n,u=t.categories[r];u.images.find(c=>c.url===a&&c.mtime===s)||(u.images.unshift(n),t.shouldAutoSwitchToNewImages&&(t.currentImageUuid=i,t.currentImage=n,t.currentCategory=r),t.intermediateImage=void 0,u.latest_mtime=s)},setIntermediateImage:(t,e)=>{t.intermediateImage=e.payload},clearIntermediateImage:t=>{t.intermediateImage=void 0},selectNextImage:t=>{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r>0){const i=n[r-1];t.currentImage=i,t.currentImageUuid=i.uuid}}},addGalleryImages:(t,e)=>{const{images:n,areMoreImagesAvailable:r,category:i}=e.payload,a=t.categories[i].images;if(n.length>0){const s=n.filter(u=>!a.find(c=>c.url===u.url&&c.mtime===u.mtime));if(t.categories[i].images=a.concat(s).sort((u,c)=>c.mtime-u.mtime),!t.currentImage){const u=n[0];t.currentImage=u,t.currentImageUuid=u.uuid}t.categories[i].latest_mtime=n[0].mtime,t.categories[i].earliest_mtime=n[n.length-1].mtime}r!==void 0&&(t.categories[i].areMoreImagesAvailable=r)},setGalleryImageMinimumWidth:(t,e)=>{t.galleryImageMinimumWidth=e.payload},setGalleryImageObjectFit:(t,e)=>{t.galleryImageObjectFit=e.payload},setShouldAutoSwitchToNewImages:(t,e)=>{t.shouldAutoSwitchToNewImages=e.payload},setCurrentCategory:(t,e)=>{t.currentCategory=e.payload},setGalleryWidth:(t,e)=>{t.galleryWidth=e.payload},setShouldUseSingleGalleryColumn:(t,e)=>{t.shouldUseSingleGalleryColumn=e.payload}}}),{addImage:Of,clearIntermediateImage:Cm,removeImage:ek,setCurrentImage:ZU,addGalleryImages:b5,setIntermediateImage:C5,selectNextImage:ej,selectPrevImage:tj,setGalleryImageMinimumWidth:nj,setGalleryImageObjectFit:rj,setShouldAutoSwitchToNewImages:ij,setCurrentCategory:aj,setGalleryWidth:oj,setShouldUseSingleGalleryColumn:sj}=Zx.actions,x5=Zx.reducer,k5={isLightboxOpen:!1},P5=k5,tk=vo({name:"lightbox",initialState:P5,reducers:{setIsLightboxOpen:(t,e)=>{t.isLightboxOpen=e.payload}}}),{setIsLightboxOpen:lj}=tk.actions,E5=tk.reducer,dd=t=>typeof t=="string"?t:t.length===1?t[0].prompt:t.map(e=>`${e.prompt}:${e.weight}`).join(" ");function O5(t){let e=typeof t=="string"?t:dd(t),n="";const r=new RegExp(/\[([^\][]*)]/,"gi"),i=[...e.matchAll(r)].map(a=>a[1]);return i.length&&(n=i.join(" "),i.forEach(a=>{e=e.replace(`[${a}]`,"").replaceAll("[]","").trim()})),[e,n]}const T5=t=>{const r=t.split(",").map(i=>i.split(":")).map(i=>({seed:Number(i[0]),weight:Number(i[1])}));return R5(r)?r:!1},R5=t=>Boolean(typeof t=="string"?T5(t):t.length&&!t.some(e=>{const{seed:n,weight:r}=e,i=!isNaN(parseInt(n.toString(),10)),a=!isNaN(parseInt(r.toString(),10))&&r>=0&&r<=1;return!(i&&a)})),Ow=t=>t.reduce((e,n,r,i)=>{const{seed:a,weight:s}=n;return e+=`${a}:${s}`,r!==i.length-1&&(e+=","),e},""),A5=t=>t.split(",").map(r=>r.split(":")).map(r=>[parseInt(r[0],10),parseFloat(r[1])]),nk={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,maskPath:"",perlin:0,prompt:"",negativePrompt:"",sampler:"k_lms",seamBlur:16,seamless:!1,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0},I5=nk,rk=vo({name:"generation",initialState:I5,reducers:{setPrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.prompt=n:t.prompt=dd(n)},setNegativePrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.negativePrompt=n:t.negativePrompt=dd(n)},setIterations:(t,e)=>{t.iterations=e.payload},setSteps:(t,e)=>{t.steps=e.payload},clampSymmetrySteps:t=>{t.horizontalSymmetrySteps=_t.clamp(t.horizontalSymmetrySteps,0,t.steps),t.verticalSymmetrySteps=_t.clamp(t.verticalSymmetrySteps,0,t.steps)},setCfgScale:(t,e)=>{t.cfgScale=e.payload},setThreshold:(t,e)=>{t.threshold=e.payload},setPerlin:(t,e)=>{t.perlin=e.payload},setHeight:(t,e)=>{t.height=e.payload},setWidth:(t,e)=>{t.width=e.payload},setSampler:(t,e)=>{t.sampler=e.payload},setSeed:(t,e)=>{t.seed=e.payload,t.shouldRandomizeSeed=!1},setImg2imgStrength:(t,e)=>{t.img2imgStrength=e.payload},setMaskPath:(t,e)=>{t.maskPath=e.payload},setSeamless:(t,e)=>{t.seamless=e.payload},setShouldFitToWidthHeight:(t,e)=>{t.shouldFitToWidthHeight=e.payload},resetSeed:t=>{t.seed=-1},setParameter:(t,e)=>{const{key:n,value:r}=e.payload,i={...t,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(t,e)=>{t.shouldGenerateVariations=e.payload},setVariationAmount:(t,e)=>{t.variationAmount=e.payload},setSeedWeights:(t,e)=>{t.seedWeights=e.payload,t.shouldGenerateVariations=!0,t.variationAmount=0},setAllTextToImageParameters:(t,e)=>{const{sampler:n,prompt:r,seed:i,variations:a,steps:s,cfg_scale:u,threshold:c,perlin:f,seamless:h,_hires_fix:p,width:g,height:y}=e.payload.image;a&&a.length>0?(t.seedWeights=Ow(a),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,i&&(t.seed=i,t.shouldRandomizeSeed=!1),r&&(t.prompt=dd(r)),n&&(t.sampler=n),s&&(t.steps=s),u&&(t.cfgScale=u),typeof c>"u"?t.threshold=0:t.threshold=c,typeof f>"u"?t.perlin=0:t.perlin=f,typeof h=="boolean"&&(t.seamless=h),g&&(t.width=g),y&&(t.height=y)},setAllImageToImageParameters:(t,e)=>{const{type:n,strength:r,fit:i,init_image_path:a,mask_image_path:s}=e.payload.image;n==="img2img"&&(a&&(t.initialImage=a),s&&(t.maskPath=s),r&&(t.img2imgStrength=r),typeof i=="boolean"&&(t.shouldFitToWidthHeight=i))},setAllParameters:(t,e)=>{const{type:n,sampler:r,prompt:i,seed:a,variations:s,steps:u,cfg_scale:c,threshold:f,perlin:h,seamless:p,_hires_fix:g,width:y,height:v,strength:w,fit:x,init_image_path:_,mask_image_path:S}=e.payload.image;if(n==="img2img"&&(_&&(t.initialImage=_),S&&(t.maskPath=S),w&&(t.img2imgStrength=w),typeof x=="boolean"&&(t.shouldFitToWidthHeight=x)),s&&s.length>0?(t.seedWeights=Ow(s),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,a&&(t.seed=a,t.shouldRandomizeSeed=!1),i){const[C,O]=O5(i);C&&(t.prompt=C),O?t.negativePrompt=O:t.negativePrompt=""}r&&(t.sampler=r),u&&(t.steps=u),c&&(t.cfgScale=c),typeof f>"u"?t.threshold=0:t.threshold=f,typeof h>"u"?t.perlin=0:t.perlin=h,typeof p=="boolean"&&(t.seamless=p),y&&(t.width=y),v&&(t.height=v)},resetParametersState:t=>({...t,...nk}),setShouldRandomizeSeed:(t,e)=>{t.shouldRandomizeSeed=e.payload},setInitialImage:(t,e)=>{t.initialImage=e.payload},clearInitialImage:t=>{t.initialImage=void 0},setSeamSize:(t,e)=>{t.seamSize=e.payload},setSeamBlur:(t,e)=>{t.seamBlur=e.payload},setSeamStrength:(t,e)=>{t.seamStrength=e.payload},setSeamSteps:(t,e)=>{t.seamSteps=e.payload},setTileSize:(t,e)=>{t.tileSize=e.payload},setInfillMethod:(t,e)=>{t.infillMethod=e.payload},setShouldUseSymmetry:(t,e)=>{t.shouldUseSymmetry=e.payload},setHorizontalSymmetrySteps:(t,e)=>{t.horizontalSymmetrySteps=e.payload},setVerticalSymmetrySteps:(t,e)=>{t.verticalSymmetrySteps=e.payload}}}),{clampSymmetrySteps:uj,clearInitialImage:L5,resetParametersState:cj,resetSeed:fj,setAllImageToImageParameters:dj,setAllParameters:hj,setAllTextToImageParameters:pj,setCfgScale:gj,setHeight:mj,setImg2imgStrength:vj,setInfillMethod:M5,setInitialImage:D5,setIterations:yj,setMaskPath:N5,setParameter:Sj,setPerlin:_j,setPrompt:wj,setNegativePrompt:bj,setSampler:Cj,setSeamBlur:xj,setSeamless:kj,setSeamSize:Pj,setSeamSteps:Ej,setSeamStrength:Oj,setSeed:Tj,setSeedWeights:Rj,setShouldFitToWidthHeight:Aj,setShouldGenerateVariations:Ij,setShouldRandomizeSeed:Lj,setSteps:Mj,setThreshold:Dj,setTileSize:Nj,setVariationAmount:Bj,setWidth:Fj,setShouldUseSymmetry:$j,setHorizontalSymmetrySteps:zj,setVerticalSymmetrySteps:Gj}=rk.actions,B5=rk.reducer,ik={codeformerFidelity:.75,facetoolStrength:.75,facetoolType:"gfpgan",hiresFix:!1,hiresStrength:.75,shouldLoopback:!1,shouldRunESRGAN:!1,shouldRunFacetool:!1,upscalingLevel:4,upscalingDenoising:.75,upscalingStrength:.75},F5=ik,ak=vo({name:"postprocessing",initialState:F5,reducers:{setFacetoolStrength:(t,e)=>{t.facetoolStrength=e.payload},setCodeformerFidelity:(t,e)=>{t.codeformerFidelity=e.payload},setUpscalingLevel:(t,e)=>{t.upscalingLevel=e.payload},setUpscalingDenoising:(t,e)=>{t.upscalingDenoising=e.payload},setUpscalingStrength:(t,e)=>{t.upscalingStrength=e.payload},setHiresFix:(t,e)=>{t.hiresFix=e.payload},setHiresStrength:(t,e)=>{t.hiresStrength=e.payload},resetPostprocessingState:t=>({...t,...ik}),setShouldRunFacetool:(t,e)=>{t.shouldRunFacetool=e.payload},setFacetoolType:(t,e)=>{t.facetoolType=e.payload},setShouldRunESRGAN:(t,e)=>{t.shouldRunESRGAN=e.payload},setShouldLoopback:(t,e)=>{t.shouldLoopback=e.payload}}}),{resetPostprocessingState:Uj,setCodeformerFidelity:jj,setFacetoolStrength:Wj,setFacetoolType:Hj,setHiresFix:Vj,setHiresStrength:qj,setShouldLoopback:Kj,setShouldRunESRGAN:Yj,setShouldRunFacetool:Xj,setUpscalingLevel:Qj,setUpscalingDenoising:Jj,setUpscalingStrength:Zj}=ak.actions,$5=ak.reducer;function Sr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tw(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||U5,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i1?r-1:0),a=1;a-1?u.replace(/###/g,"."):u}function i(){return!t||typeof t=="string"}for(var a=typeof e!="string"?[].concat(e):e.split(".");a.length>1;){if(i())return{};var s=r(a.shift());!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={}}return i()?{}:{obj:t,k:r(a.shift())}}function Mw(t,e,n){var r=O0(t,e,Object),i=r.obj,a=r.k;i[a]=n}function H5(t,e,n,r){var i=O0(t,e,Object),a=i.obj,s=i.k;a[s]=a[s]||[],r&&(a[s]=a[s].concat(n)),r||a[s].push(n)}function rh(t,e){var n=O0(t,e),r=n.obj,i=n.k;if(r)return r[i]}function Dw(t,e,n){var r=rh(t,n);return r!==void 0?r:rh(e,n)}function uk(t,e,n){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):uk(t[r],e[r],n):t[r]=e[r]);return t}function es(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var V5={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function q5(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,function(e){return V5[e]}):t}var Qh=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,K5=[" ",",","?","!",";"];function Y5(t,e,n){e=e||"",n=n||"";var r=K5.filter(function(u){return e.indexOf(u)<0&&n.indexOf(u)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(u){return u==="?"?"\\?":u}).join("|"),")")),a=!i.test(t);if(!a){var s=t.indexOf(n);s>0&&!i.test(t.substring(0,s))&&(a=!0)}return a}function Nw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tf(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ck(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(t){if(t[e])return t[e];for(var r=e.split(n),i=t,a=0;aa+s;)s++,u=r.slice(a,a+s).join(n),c=i[u];if(c===void 0)return;if(c===null)return null;if(e.endsWith(u)){if(typeof c=="string")return c;if(u&&typeof c[u]=="string")return c[u]}var f=r.slice(a+s).join(n);return f?ck(c,f,n):void 0}i=i[r[a]]}return i}}var J5=function(t){Xh(n,t);var e=X5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Ea(i)),i.data=r||{},i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return _r(n,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var a=this.options.ns.indexOf(i);a>-1&&this.options.ns.splice(a,1)}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator,f=u.ignoreJSONStructure!==void 0?u.ignoreJSONStructure:this.options.ignoreJSONStructure,h=[i,a];s&&typeof s!="string"&&(h=h.concat(s)),s&&typeof s=="string"&&(h=h.concat(c?s.split(c):s)),i.indexOf(".")>-1&&(h=i.split("."));var p=rh(this.data,h);return p||!f||typeof s!="string"?p:ck(this.data&&this.data[i]&&this.data[i][a],s,c)}},{key:"addResource",value:function(i,a,s,u){var c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},f=this.options.keySeparator;f===void 0&&(f=".");var h=[i,a];s&&(h=h.concat(f?s.split(f):s)),i.indexOf(".")>-1&&(h=i.split("."),u=a,a=h[1]),this.addNamespaces(a),Mw(this.data,h,u),c.silent||this.emit("added",i,a,s,u)}},{key:"addResources",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var c in s)(typeof s[c]=="string"||Object.prototype.toString.apply(s[c])==="[object Array]")&&this.addResource(i,a,c,s[c],{silent:!0});u.silent||this.emit("added",i,a,s)}},{key:"addResourceBundle",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},h=[i,a];i.indexOf(".")>-1&&(h=i.split("."),u=s,s=a,a=h[1]),this.addNamespaces(a);var p=rh(this.data,h)||{};u?uk(p,s,c):p=Tf(Tf({},p),s),Mw(this.data,h,p),f.silent||this.emit("added",i,a,s)}},{key:"removeResourceBundle",value:function(i,a){this.hasResourceBundle(i,a)&&delete this.data[i][a],this.removeNamespaces(a),this.emit("removed",i,a)}},{key:"hasResourceBundle",value:function(i,a){return this.getResource(i,a)!==void 0}},{key:"getResourceBundle",value:function(i,a){return a||(a=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Tf(Tf({},{}),this.getResource(i,a)):this.getResource(i,a)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var a=this.getDataByLanguage(i),s=a&&Object.keys(a)||[];return!!s.find(function(u){return a[u]&&Object.keys(a[u]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(Aa),fk={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,n,r,i,a){var s=this;return e.forEach(function(u){s.processors[u]&&(n=s.processors[u].process(n,r,i,a))}),n}};function Bw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mn(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Fw={},$w=function(t){Xh(n,t);var e=Z5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Ea(i)),W5(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Ea(i)),i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ii.create("translator"),i}return _r(n,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var s=this.resolve(i,a);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(i,a){var s=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var u=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ns||this.options.defaultNS||[],f=s&&i.indexOf(s)>-1,h=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!Y5(i,s,u);if(f&&!h){var p=i.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:i,namespaces:c};var g=i.split(s);(s!==u||s===u&&this.options.ns.indexOf(g[0])>-1)&&(c=g.shift()),i=g.join(u)}return typeof c=="string"&&(c=[c]),{key:i,namespaces:c}}},{key:"translate",value:function(i,a,s){var u=this;if(gr(a)!=="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),a||(a={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var c=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,f=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,h=this.extractFromKey(i[i.length-1],a),p=h.key,g=h.namespaces,y=g[g.length-1],v=a.lng||this.language,w=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(v&&v.toLowerCase()==="cimode"){if(w){var x=a.nsSeparator||this.options.nsSeparator;return c?{res:"".concat(y).concat(x).concat(p),usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:"".concat(y).concat(x).concat(p)}return c?{res:p,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:p}var _=this.resolve(i,a),S=_&&_.res,C=_&&_.usedKey||p,O=_&&_.exactUsedKey||p,I=Object.prototype.toString.apply(S),L=["[object Number]","[object Function]","[object RegExp]"],D=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,U=!this.i18nFormat||this.i18nFormat.handleAsObject,X=typeof S!="string"&&typeof S!="boolean"&&typeof S!="number";if(U&&S&&X&&L.indexOf(I)<0&&!(typeof D=="string"&&I==="[object Array]")){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var K=this.options.returnedObjectHandler?this.options.returnedObjectHandler(C,S,mn(mn({},a),{},{ns:g})):"key '".concat(p," (").concat(this.language,")' returned an object instead of string.");return c?(_.res=K,_):K}if(f){var te=I==="[object Array]",ce=te?[]:{},j=te?O:C;for(var T in S)if(Object.prototype.hasOwnProperty.call(S,T)){var $="".concat(j).concat(f).concat(T);ce[T]=this.translate($,mn(mn({},a),{joinArrays:!1,ns:g})),ce[T]===$&&(ce[T]=S[T])}S=ce}}else if(U&&typeof D=="string"&&I==="[object Array]")S=S.join(D),S&&(S=this.extendTranslation(S,i,a,s));else{var V=!1,ie=!1,W=a.count!==void 0&&typeof a.count!="string",Y=n.hasDefaultValue(a),Q=W?this.pluralResolver.getSuffix(v,a.count,a):"",oe=a["defaultValue".concat(Q)]||a.defaultValue;!this.isValidLookup(S)&&Y&&(V=!0,S=oe),this.isValidLookup(S)||(ie=!0,S=p);var ve=a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,we=ve&&ie?void 0:S,Ue=Y&&oe!==S&&this.options.updateMissing;if(ie||V||Ue){if(this.logger.log(Ue?"updateKey":"missingKey",v,y,p,Ue?oe:S),f){var At=this.resolve(p,mn(mn({},a),{},{keySeparator:!1}));At&&At.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var me=[],qt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&qt&&qt[0])for(var Bt=0;Bt1&&arguments[1]!==void 0?arguments[1]:{},u,c,f,h,p;return typeof i=="string"&&(i=[i]),i.forEach(function(g){if(!a.isValidLookup(u)){var y=a.extractFromKey(g,s),v=y.key;c=v;var w=y.namespaces;a.options.fallbackNS&&(w=w.concat(a.options.fallbackNS));var x=s.count!==void 0&&typeof s.count!="string",_=x&&!s.ordinal&&s.count===0&&a.pluralResolver.shouldUseIntlApi(),S=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",C=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);w.forEach(function(O){a.isValidLookup(u)||(p=O,!Fw["".concat(C[0],"-").concat(O)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(p)&&(Fw["".concat(C[0],"-").concat(O)]=!0,a.logger.warn('key "'.concat(c,'" for languages "').concat(C.join(", "),`" won't get resolved as namespace "`).concat(p,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),C.forEach(function(I){if(!a.isValidLookup(u)){h=I;var L=[v];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(L,v,I,O,s);else{var D;x&&(D=a.pluralResolver.getSuffix(I,s.count,s));var U="".concat(a.options.pluralSeparator,"zero");if(x&&(L.push(v+D),_&&L.push(v+U)),S){var X="".concat(v).concat(a.options.contextSeparator).concat(s.context);L.push(X),x&&(L.push(X+D),_&&L.push(X+U))}}for(var K;K=L.pop();)a.isValidLookup(u)||(f=K,u=a.getResource(I,O,K,s))}}))})}}),{res:u,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:p}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,a,s,u):this.resourceStore.getResource(i,a,s,u)}}],[{key:"hasDefaultValue",value:function(i){var a="defaultValue";for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&a===s.substring(0,a.length)&&i[s]!==void 0)return!0;return!1}}]),n}(Aa);function xm(t){return t.charAt(0).toUpperCase()+t.slice(1)}var zw=function(){function t(e){Sr(this,t),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ii.create("languageUtils")}return _r(t,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=n.split("-");return this.options.lowerCaseLng?i=i.map(function(a){return a.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=xm(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var i;return n.forEach(function(a){if(!i){var s=r.formatLanguageCode(a);(!r.options.supportedLngs||r.isSupportedCode(s))&&(i=s)}}),!i&&this.options.supportedLngs&&n.forEach(function(a){if(!i){var s=r.getLanguagePartFromCode(a);if(r.isSupportedCode(s))return i=s;i=r.options.supportedLngs.find(function(u){if(u.indexOf(s)===0)return u})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var i=n[r];return i||(i=n[this.getScriptPartFromCode(r)]),i||(i=n[this.formatLanguageCode(r)]),i||(i=n[this.getLanguagePartFromCode(r)]),i||(i=n.default),i||[]}},{key:"toResolveHierarchy",value:function(n,r){var i=this,a=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],u=function(f){f&&(i.isSupportedCode(f)?s.push(f):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(f)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(n))):typeof n=="string"&&u(this.formatLanguageCode(n)),a.forEach(function(c){s.indexOf(c)<0&&u(i.formatLanguageCode(c))}),s}}]),t}(),t4=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],n4={1:function(e){return Number(e>1)},2:function(e){return Number(e!=1)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(e==1?0:e>=2&&e<=4?1:2)},7:function(e){return Number(e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(e==1?0:e==2?1:e!=8&&e!=11?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(e==1?0:e==2?1:e<7?2:e<11?3:4)},11:function(e){return Number(e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(e!==0)},14:function(e){return Number(e==1?0:e==2?1:e==3?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:e!==0?1:2)},17:function(e){return Number(e==1||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(e==0?0:e==1?1:2)},19:function(e){return Number(e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(e==1?0:e==0||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3)}},r4=["v1","v2","v3"],Gw={zero:0,one:1,two:2,few:3,many:4,other:5};function i4(){var t={};return t4.forEach(function(e){e.lngs.forEach(function(n){t[n]={numbers:e.nr,plurals:n4[e.fc]}})}),t}var a4=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.languageUtils=e,this.options=n,this.logger=ii.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=i4()}return _r(t,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,i).map(function(a){return"".concat(r).concat(a)})}},{key:"getSuffixes",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort(function(s,u){return Gw[s]-Gw[u]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):a.numbers.map(function(s){return r.getSuffix(n,s,i)}):[]}},{key:"getSuffix",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(a.select(r)):this.getSuffixRetroCompatible(a,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var i=this,a=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[a];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var u=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):u():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?u():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}},{key:"shouldUseIntlApi",value:function(){return!r4.includes(this.options.compatibilityJSON)}}]),t}();function Uw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(n){return n},this.init(e)}return _r(t,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:q5,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?es(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?es(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?es(r.nestingPrefix):r.nestingPrefixEscaped||es("$t("),this.nestingSuffix=r.nestingSuffix?es(r.nestingSuffix):r.nestingSuffixEscaped||es(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(n,r,i,a){var s=this,u,c,f,h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function p(x){return x.replace(/\$/g,"$$$$")}var g=function(_){if(_.indexOf(s.formatSeparator)<0){var S=Dw(r,h,_);return s.alwaysFormat?s.format(S,void 0,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:_})):S}var C=_.split(s.formatSeparator),O=C.shift().trim(),I=C.join(s.formatSeparator).trim();return s.format(Dw(r,h,O),I,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:O}))};this.resetRegExp();var y=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,v=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,w=[{regex:this.regexpUnescape,safeValue:function(_){return p(_)}},{regex:this.regexp,safeValue:function(_){return s.escapeValue?p(s.escape(_)):p(_)}}];return w.forEach(function(x){for(f=0;u=x.regex.exec(n);){var _=u[1].trim();if(c=g(_),c===void 0)if(typeof y=="function"){var S=y(n,u,a);c=typeof S=="string"?S:""}else if(a&&Object.prototype.hasOwnProperty.call(a,_))c="";else if(v){c=u[0];continue}else s.logger.warn("missed to pass in variable ".concat(_," for interpolating ").concat(n)),c="";else typeof c!="string"&&!s.useRawValueToEscape&&(c=Lw(c));var C=x.safeValue(c);if(n=n.replace(u[0],C),v?(x.regex.lastIndex+=c.length,x.regex.lastIndex-=u[0].length):x.regex.lastIndex=0,f++,f>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,u,c;function f(y,v){var w=this.nestingOptionsSeparator;if(y.indexOf(w)<0)return y;var x=y.split(new RegExp("".concat(w,"[ ]*{"))),_="{".concat(x[1]);y=x[0],_=this.interpolate(_,c);var S=_.match(/'/g),C=_.match(/"/g);(S&&S.length%2===0&&!C||C.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),v&&(c=Ar(Ar({},v),c))}catch(O){return this.logger.warn("failed parsing options string in nesting for key ".concat(y),O),"".concat(y).concat(w).concat(_)}return delete c.defaultValue,y}for(;s=this.nestingRegexp.exec(n);){var h=[];c=Ar({},a),c=c.replace&&typeof c.replace!="string"?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;var p=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var g=s[1].split(this.formatSeparator).map(function(y){return y.trim()});s[1]=g.shift(),h=g,p=!0}if(u=r(f.call(this,s[1].trim(),c),c),u&&s[0]===n&&typeof u!="string")return u;typeof u!="string"&&(u=Lw(u)),u||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),u=""),p&&(u=h.reduce(function(y,v){return i.format(y,v,a.lng,Ar(Ar({},a),{},{interpolationkey:s[1].trim()}))},u.trim())),n=n.replace(s[0],u),this.regexp.lastIndex=0}return n}}]),t}();function jw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ri(t){for(var e=1;e-1){var r=t.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)n.currency||(n.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)n.range||(n.range=i.trim());else{var a=i.split(";");a.forEach(function(s){if(s){var u=s.split(":"),c=G5(u),f=c[0],h=c.slice(1),p=h.join(":").trim().replace(/^'+|'+$/g,"");n[f.trim()]||(n[f.trim()]=p),p==="false"&&(n[f.trim()]=!1),p==="true"&&(n[f.trim()]=!0),isNaN(p)||(n[f.trim()]=parseInt(p,10))}})}}return{formatName:e,formatOptions:n}}function ts(t){var e={};return function(r,i,a){var s=i+JSON.stringify(a),u=e[s];return u||(u=t(i,a),e[s]=u),u(r)}}var l4=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("formatter"),this.options=e,this.formats={number:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri({},r));return function(a){return i.format(a)}}),currency:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri(Ri({},r),{},{style:"currency"}));return function(a){return i.format(a)}}),datetime:ts(function(n,r){var i=new Intl.DateTimeFormat(n,Ri({},r));return function(a){return i.format(a)}}),relativetime:ts(function(n,r){var i=new Intl.RelativeTimeFormat(n,Ri({},r));return function(a){return i.format(a,r.range||"day")}}),list:ts(function(n,r){var i=new Intl.ListFormat(n,Ri({},r));return function(a){return i.format(a)}})},this.init(e)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"addCached",value:function(n,r){this.formats[n.toLowerCase().trim()]=ts(r)}},{key:"format",value:function(n,r,i){var a=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},u=r.split(this.formatSeparator),c=u.reduce(function(f,h){var p=s4(h),g=p.formatName,y=p.formatOptions;if(a.formats[g]){var v=f;try{var w=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},x=w.locale||w.lng||s.locale||s.lng||i;v=a.formats[g](f,x,Ri(Ri(Ri({},y),s),w))}catch(_){a.logger.warn(_)}return v}else a.logger.warn("there was no format function for ".concat(g));return f},n);return c}}]),t}();function Ww(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hw(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function f4(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}var d4=function(t){Xh(n,t);var e=u4(n);function n(r,i,a){var s,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Sr(this,n),s=e.call(this),Qh&&Aa.call(Ea(s)),s.backend=r,s.store=i,s.services=a,s.languageUtils=a.languageUtils,s.options=u,s.logger=ii.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=u.maxParallelReads||10,s.readingCalls=0,s.maxRetries=u.maxRetries>=0?u.maxRetries:5,s.retryTimeout=u.retryTimeout>=1?u.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(a,u.backend,u),s}return _r(n,[{key:"queueLoad",value:function(i,a,s,u){var c=this,f={},h={},p={},g={};return i.forEach(function(y){var v=!0;a.forEach(function(w){var x="".concat(y,"|").concat(w);!s.reload&&c.store.hasResourceBundle(y,w)?c.state[x]=2:c.state[x]<0||(c.state[x]===1?h[x]===void 0&&(h[x]=!0):(c.state[x]=1,v=!1,h[x]===void 0&&(h[x]=!0),f[x]===void 0&&(f[x]=!0),g[w]===void 0&&(g[w]=!0)))}),v||(p[y]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:u}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(p),toLoadNamespaces:Object.keys(g)}}},{key:"loaded",value:function(i,a,s){var u=i.split("|"),c=u[0],f=u[1];a&&this.emit("failedLoading",c,f,a),s&&this.store.addResourceBundle(c,f,s),this.state[i]=a?-1:2;var h={};this.queue.forEach(function(p){H5(p.loaded,[c],f),f4(p,i),a&&p.errors.push(a),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(function(g){h[g]||(h[g]={});var y=p.loaded[g];y.length&&y.forEach(function(v){h[g][v]===void 0&&(h[g][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(function(p){return!p.done})}},{key:"read",value:function(i,a,s){var u=this,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,h=arguments.length>5?arguments[5]:void 0;if(!i.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:a,fcName:s,tried:c,wait:f,callback:h});return}this.readingCalls++;var p=function(w,x){if(u.readingCalls--,u.waitingReads.length>0){var _=u.waitingReads.shift();u.read(_.lng,_.ns,_.fcName,_.tried,_.wait,_.callback)}if(w&&x&&c2&&arguments[2]!==void 0?arguments[2]:{},c=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof a=="string"&&(a=[a]);var f=this.queueLoad(i,a,u,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(function(h){s.loadOne(h)})}},{key:"load",value:function(i,a,s){this.prepareLoading(i,a,{},s)}},{key:"reload",value:function(i,a,s){this.prepareLoading(i,a,{reload:!0},s)}},{key:"loadOne",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",u=i.split("|"),c=u[0],f=u[1];this.read(c,f,"read",void 0,void 0,function(h,p){h&&a.logger.warn("".concat(s,"loading namespace ").concat(f," for language ").concat(c," failed"),h),!h&&p&&a.logger.log("".concat(s,"loaded namespace ").concat(f," for language ").concat(c),p),a.loaded(i,h,p)})}},{key:"saveMissing",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(a)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(a,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){var p=Hw(Hw({},f),{},{isUpdate:c}),g=this.backend.create.bind(this.backend);if(g.length<6)try{var y;g.length===5?y=g(i,a,s,u,p):y=g(i,a,s,u),y&&typeof y.then=="function"?y.then(function(v){return h(null,v)}).catch(h):h(null,y)}catch(v){h(v)}else g(i,a,s,u,h,p)}!i||!i[0]||this.store.addResource(i[0],a,s,u)}}}]),n}(Aa);function Vw(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var n={};if(gr(e[1])==="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),gr(e[2])==="object"||gr(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:function(e,n,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function qw(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function Kw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qr(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rf(){}function g4(t){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach(function(n){typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}var ih=function(t){Xh(n,t);var e=h4(n);function n(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(Sr(this,n),r=e.call(this),Qh&&Aa.call(Ea(r)),r.options=qw(i),r.services={},r.logger=ii,r.modules={external:[]},g4(Ea(r)),a&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,a),Ju(r,Ea(r));setTimeout(function(){r.init(i,a)},0)}return r}return _r(n,[{key:"init",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof a=="function"&&(s=a,a={}),!a.defaultNS&&a.defaultNS!==!1&&a.ns&&(typeof a.ns=="string"?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));var u=Vw();this.options=Qr(Qr(Qr({},u),this.options),qw(a)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Qr(Qr({},u.interpolation),this.options.interpolation)),a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);function c(_){return _?typeof _=="function"?new _:_:null}if(!this.options.isClone){this.modules.logger?ii.init(c(this.modules.logger),this.options):ii.init(null,this.options);var f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=l4);var h=new zw(this.options);this.store=new J5(this.options.resources,this.options);var p=this.services;p.logger=ii,p.resourceStore=this.store,p.languageUtils=h,p.pluralResolver=new a4(h,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===u.interpolation.format)&&(p.formatter=c(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new o4(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new d4(c(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(_){for(var S=arguments.length,C=new Array(S>1?S-1:0),O=1;O1?S-1:0),O=1;O0&&g[0]!=="dev"&&(this.options.lng=g[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var y=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];y.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments),i}});var w=Bl(),x=function(){var S=function(O,I){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),w.resolve(I),s(O,I)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return S(null,i.t.bind(i));i.changeLanguage(i.options.lng,S)};return this.options.resources||!this.options.initImmediate?x():setTimeout(x,0),w}},{key:"loadResources",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rf,u=s,c=typeof i=="string"?i:this.language;if(typeof i=="function"&&(u=i),!this.options.resources||this.options.partialBundledLanguages){if(c&&c.toLowerCase()==="cimode")return u();var f=[],h=function(y){if(y){var v=a.services.languageUtils.toResolveHierarchy(y);v.forEach(function(w){f.indexOf(w)<0&&f.push(w)})}};if(c)h(c);else{var p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.forEach(function(g){return h(g)})}this.options.preload&&this.options.preload.forEach(function(g){return h(g)}),this.services.backendConnector.load(f,this.options.ns,function(g){!g&&!a.resolvedLanguage&&a.language&&a.setResolvedLanguage(a.language),u(g)})}else u(null)}},{key:"reloadResources",value:function(i,a,s){var u=Bl();return i||(i=this.languages),a||(a=this.options.ns),s||(s=Rf),this.services.backendConnector.reload(i,a,function(c){u.resolve(),s(c)}),u}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&fk.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var a=0;a-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(i,a){var s=this;this.isLanguageChangingTo=i;var u=Bl();this.emit("languageChanging",i);var c=function(g){s.language=g,s.languages=s.services.languageUtils.toResolveHierarchy(g),s.resolvedLanguage=void 0,s.setResolvedLanguage(g)},f=function(g,y){y?(c(y),s.translator.changeLanguage(y),s.isLanguageChangingTo=void 0,s.emit("languageChanged",y),s.logger.log("languageChanged",y)):s.isLanguageChangingTo=void 0,u.resolve(function(){return s.t.apply(s,arguments)}),a&&a(g,function(){return s.t.apply(s,arguments)})},h=function(g){!i&&!g&&s.services.languageDetector&&(g=[]);var y=typeof g=="string"?g:s.services.languageUtils.getBestMatchFromCodes(g);y&&(s.language||c(y),s.translator.language||s.translator.changeLanguage(y),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(y)),s.loadResources(y,function(v){f(v,y)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(i),u}},{key:"getFixedT",value:function(i,a,s){var u=this,c=function f(h,p){var g;if(gr(p)!=="object"){for(var y=arguments.length,v=new Array(y>2?y-2:0),w=2;w1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var u=this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(u.toLowerCase()==="cimode")return!0;var h=function(y,v){var w=a.services.backendConnector.state["".concat(y,"|").concat(v)];return w===-1||w===2};if(s.precheck){var p=s.precheck(this,h);if(p!==void 0)return p}return!!(this.hasResourceBundle(u,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(u,i)&&(!c||h(f,i)))}},{key:"loadNamespaces",value:function(i,a){var s=this,u=Bl();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(c){s.options.ns.indexOf(c)<0&&s.options.ns.push(c)}),this.loadResources(function(c){u.resolve(),a&&a(c)}),u):(a&&a(),Promise.resolve())}},{key:"loadLanguages",value:function(i,a){var s=Bl();typeof i=="string"&&(i=[i]);var u=this.options.preload||[],c=i.filter(function(f){return u.indexOf(f)<0});return c.length?(this.options.preload=u.concat(c),this.loadResources(function(f){s.resolve(),a&&a(f)}),s):(a&&a(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services&&this.services.languageUtils||new zw(Vw());return a.indexOf(s.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rf,u=Qr(Qr(Qr({},this.options),a),{isClone:!0}),c=new n(u);(a.debug!==void 0||a.prefix!==void 0)&&(c.logger=c.logger.clone(a));var f=["store","services","language"];return f.forEach(function(h){c[h]=i[h]}),c.services=Qr({},this.services),c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c.translator=new $w(c.services,c.options),c.translator.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),y=1;y0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new ih(t,e)});var Ae=ih.createInstance();Ae.createInstance=ih.createInstance;Ae.createInstance;Ae.dir;Ae.init;Ae.loadResources;Ae.reloadResources;Ae.use;Ae.changeLanguage;Ae.getFixedT;Ae.t;Ae.exists;Ae.setDefaultNamespace;Ae.hasLoadedNamespace;Ae.loadNamespaces;Ae.loadLanguages;var dk=[],m4=dk.forEach,v4=dk.slice;function y4(t){return m4.call(v4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}var Yw=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,S4=function(e,n,r){var i=r||{};i.path=i.path||"/";var a=encodeURIComponent(n),s="".concat(e,"=").concat(a);if(i.maxAge>0){var u=i.maxAge-0;if(Number.isNaN(u))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(u))}if(i.domain){if(!Yw.test(i.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(i.domain)}if(i.path){if(!Yw.test(i.path))throw new TypeError("option path is invalid");s+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite){var c=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(c){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},Xw={create:function(e,n,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+r*60*1e3)),i&&(a.domain=i),document.cookie=S4(e,encodeURIComponent(n),a)},read:function(e){for(var n="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),a=i.split("&"),s=0;s0){var c=a[s].substring(0,u);c===e.lookupQuerystring&&(n=a[s].substring(u+1))}}}return n}},Fl=null,Qw=function(){if(Fl!==null)return Fl;try{Fl=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Fl=!1}return Fl},b4={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&Qw()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&Qw()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},$l=null,Jw=function(){if($l!==null)return $l;try{$l=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{$l=!1}return $l},C4={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&Jw()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&Jw()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},x4={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},k4={name:"htmlTag",lookup:function(e){var n,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},P4={name:"path",lookup:function(e){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;n=r[e.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},E4={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};function O4(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var hk=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=y4(r,this.options||{},O4()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(_4),this.addDetector(w4),this.addDetector(b4),this.addDetector(C4),this.addDetector(x4),this.addDetector(k4),this.addDetector(P4),this.addDetector(E4)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(a){if(r.detectors[a]){var s=r.detectors[a].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(i=i.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(a){i.detectors[a]&&i.detectors[a].cacheUserLanguage(n,i.options)}))}}]),t}();hk.type="languageDetector";function Wv(t){return Wv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wv(t)}var pk=[],T4=pk.forEach,R4=pk.slice;function Hv(t){return T4.call(R4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}function gk(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Wv(XMLHttpRequest))==="object"}function A4(t){return!!t&&typeof t.then=="function"}function I4(t){return A4(t)?t:Promise.resolve(t)}function L4(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $u={},M4={get exports(){return $u},set exports(t){$u=t}},gu={},D4={get exports(){return gu},set exports(t){gu=t}},Zw;function N4(){return Zw||(Zw=1,function(t,e){var n=typeof self<"u"?self:yn,r=function(){function a(){this.fetch=!1,this.DOMException=n.DOMException}return a.prototype=n,new a}();(function(a){(function(s){var u={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function c(T){return T&&DataView.prototype.isPrototypeOf(T)}if(u.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&f.indexOf(Object.prototype.toString.call(T))>-1};function p(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(T))throw new TypeError("Invalid character in header field name");return T.toLowerCase()}function g(T){return typeof T!="string"&&(T=String(T)),T}function y(T){var $={next:function(){var V=T.shift();return{done:V===void 0,value:V}}};return u.iterable&&($[Symbol.iterator]=function(){return $}),$}function v(T){this.map={},T instanceof v?T.forEach(function($,V){this.append(V,$)},this):Array.isArray(T)?T.forEach(function($){this.append($[0],$[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function($){this.append($,T[$])},this)}v.prototype.append=function(T,$){T=p(T),$=g($);var V=this.map[T];this.map[T]=V?V+", "+$:$},v.prototype.delete=function(T){delete this.map[p(T)]},v.prototype.get=function(T){return T=p(T),this.has(T)?this.map[T]:null},v.prototype.has=function(T){return this.map.hasOwnProperty(p(T))},v.prototype.set=function(T,$){this.map[p(T)]=g($)},v.prototype.forEach=function(T,$){for(var V in this.map)this.map.hasOwnProperty(V)&&T.call($,this.map[V],V,this)},v.prototype.keys=function(){var T=[];return this.forEach(function($,V){T.push(V)}),y(T)},v.prototype.values=function(){var T=[];return this.forEach(function($){T.push($)}),y(T)},v.prototype.entries=function(){var T=[];return this.forEach(function($,V){T.push([V,$])}),y(T)},u.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function w(T){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}function x(T){return new Promise(function($,V){T.onload=function(){$(T.result)},T.onerror=function(){V(T.error)}})}function _(T){var $=new FileReader,V=x($);return $.readAsArrayBuffer(T),V}function S(T){var $=new FileReader,V=x($);return $.readAsText(T),V}function C(T){for(var $=new Uint8Array(T),V=new Array($.length),ie=0;ie<$.length;ie++)V[ie]=String.fromCharCode($[ie]);return V.join("")}function O(T){if(T.slice)return T.slice(0);var $=new Uint8Array(T.byteLength);return $.set(new Uint8Array(T)),$.buffer}function I(){return this.bodyUsed=!1,this._initBody=function(T){this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:u.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:u.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():u.arrayBuffer&&u.blob&&c(T)?(this._bodyArrayBuffer=O(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=O(T):this._bodyText=T=Object.prototype.toString.call(T):this._bodyText="",this.headers.get("content-type")||(typeof T=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(_)}),this.text=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(X)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function D(T){var $=T.toUpperCase();return L.indexOf($)>-1?$:T}function U(T,$){$=$||{};var V=$.body;if(T instanceof U){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,$.headers||(this.headers=new v(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!V&&T._bodyInit!=null&&(V=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=$.credentials||this.credentials||"same-origin",($.headers||!this.headers)&&(this.headers=new v($.headers)),this.method=D($.method||this.method||"GET"),this.mode=$.mode||this.mode||null,this.signal=$.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(V)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function X(T){var $=new FormData;return T.trim().split("&").forEach(function(V){if(V){var ie=V.split("="),W=ie.shift().replace(/\+/g," "),Y=ie.join("=").replace(/\+/g," ");$.append(decodeURIComponent(W),decodeURIComponent(Y))}}),$}function K(T){var $=new v,V=T.replace(/\r?\n[\t ]+/g," ");return V.split(/\r?\n/).forEach(function(ie){var W=ie.split(":"),Y=W.shift().trim();if(Y){var Q=W.join(":").trim();$.append(Y,Q)}}),$}I.call(U.prototype);function te(T,$){$||($={}),this.type="default",this.status=$.status===void 0?200:$.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in $?$.statusText:"OK",this.headers=new v($.headers),this.url=$.url||"",this._initBody(T)}I.call(te.prototype),te.prototype.clone=function(){return new te(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},te.error=function(){var T=new te(null,{status:0,statusText:""});return T.type="error",T};var ce=[301,302,303,307,308];te.redirect=function(T,$){if(ce.indexOf($)===-1)throw new RangeError("Invalid status code");return new te(null,{status:$,headers:{location:T}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function($,V){this.message=$,this.name=V;var ie=Error($);this.stack=ie.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function j(T,$){return new Promise(function(V,ie){var W=new U(T,$);if(W.signal&&W.signal.aborted)return ie(new s.DOMException("Aborted","AbortError"));var Y=new XMLHttpRequest;function Q(){Y.abort()}Y.onload=function(){var oe={status:Y.status,statusText:Y.statusText,headers:K(Y.getAllResponseHeaders()||"")};oe.url="responseURL"in Y?Y.responseURL:oe.headers.get("X-Request-URL");var ve="response"in Y?Y.response:Y.responseText;V(new te(ve,oe))},Y.onerror=function(){ie(new TypeError("Network request failed"))},Y.ontimeout=function(){ie(new TypeError("Network request failed"))},Y.onabort=function(){ie(new s.DOMException("Aborted","AbortError"))},Y.open(W.method,W.url,!0),W.credentials==="include"?Y.withCredentials=!0:W.credentials==="omit"&&(Y.withCredentials=!1),"responseType"in Y&&u.blob&&(Y.responseType="blob"),W.headers.forEach(function(oe,ve){Y.setRequestHeader(ve,oe)}),W.signal&&(W.signal.addEventListener("abort",Q),Y.onreadystatechange=function(){Y.readyState===4&&W.signal.removeEventListener("abort",Q)}),Y.send(typeof W._bodyInit>"u"?null:W._bodyInit)})}return j.polyfill=!0,a.fetch||(a.fetch=j,a.Headers=v,a.Request=U,a.Response=te),s.Headers=v,s.Request=U,s.Response=te,s.fetch=j,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(D4,gu)),gu}(function(t,e){var n;if(typeof fetch=="function"&&(typeof yn<"u"&&yn.fetch?n=yn.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof L4<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||N4();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(M4,$u);const mk=$u,eb=h2({__proto__:null,default:mk},[$u]);function ah(t){return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ah(t)}var Fi;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Fi=global.fetch:typeof window<"u"&&window.fetch?Fi=window.fetch:Fi=fetch);var zu;gk()&&(typeof global<"u"&&global.XMLHttpRequest?zu=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(zu=window.XMLHttpRequest));var oh;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?oh=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(oh=window.ActiveXObject));!Fi&&eb&&!zu&&!oh&&(Fi=mk||eb);typeof Fi!="function"&&(Fi=void 0);var Vv=function(e,n){if(n&&ah(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},tb=function(e,n,r){Fi(e,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(a){r(null,{status:i.status,data:a})}).catch(r)}).catch(r)},nb=!1,B4=function(e,n,r,i){e.queryStringParams&&(n=Vv(n,e.queryStringParams));var a=Hv({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);r&&(a["Content-Type"]="application/json");var s=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,u=Hv({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:a},nb?{}:s);try{tb(n,u,i)}catch(c){if(!s||Object.keys(s).length===0||!c.message||c.message.indexOf("not implemented")<0)return i(c);try{Object.keys(s).forEach(function(f){delete u[f]}),tb(n,u,i),nb=!0}catch(f){i(f)}}},F4=function(e,n,r,i){r&&ah(r)==="object"&&(r=Vv("",r).slice(1)),e.queryStringParams&&(n=Vv(n,e.queryStringParams));try{var a;zu?a=new zu:a=new oh("MSXML2.XMLHTTP.3.0"),a.open(r?"POST":"GET",n,1),e.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.withCredentials=!!e.withCredentials,r&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.overrideMimeType&&a.overrideMimeType("application/json");var s=e.customHeaders;if(s=typeof s=="function"?s():s,s)for(var u in s)a.setRequestHeader(u,s[u]);a.onreadystatechange=function(){a.readyState>3&&i(a.status>=400?a.statusText:null,{status:a.status,data:a.responseText})},a.send(r)}catch(c){console&&console.log(c)}},$4=function(e,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Fi&&n.indexOf("file:")!==0)return B4(e,n,r,i);if(gk()||typeof ActiveXObject=="function")return F4(e,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Gu(t){return Gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gu(t)}function z4(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rb(t,e){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};z4(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return G4(t,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=Hv(i,this.options||{},W4()),this.allOptions=a,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,a,s){var u=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,i)),c=I4(c),c.then(function(f){if(!f)return s(null,{});var h=u.services.interpolator.interpolate(f,{lng:n.join("+"),ns:i.join("+")});u.loadUrl(h,s,r,a)})}},{key:"loadUrl",value:function(n,r,i,a){var s=this;this.options.request(this.options,n,void 0,function(u,c){if(c&&(c.status>=500&&c.status<600||!c.status))return r("failed loading "+n+"; status code: "+c.status,!0);if(c&&c.status>=400&&c.status<500)return r("failed loading "+n+"; status code: "+c.status,!1);if(!c&&u&&u.message&&u.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+u.message,!0);if(u)return r(u,!1);var f,h;try{typeof c.data=="string"?f=s.options.parse(c.data,i,a):f=c.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,a,s){var u=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,i,a),f=0,h=[],p=[];n.forEach(function(g){var y=u.options.addPath;typeof u.options.addPath=="function"&&(y=u.options.addPath(g,r));var v=u.services.interpolator.interpolate(y,{lng:g,ns:r});u.options.request(u.options,v,c,function(w,x){f+=1,h.push(w),p.push(x),f===n.length&&typeof s=="function"&&s(h,p)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,a=r.languageUtils,s=r.logger,u=i.language;if(!(u&&u.toLowerCase()==="cimode")){var c=[],f=function(p){var g=a.toResolveHierarchy(p);g.forEach(function(y){c.indexOf(y)<0&&c.push(y)})};f(u),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return f(h)}),c.forEach(function(h){n.allOptions.ns.forEach(function(p){i.read(h,p,"read",null,null,function(g,y){g&&s.warn("loading namespace ".concat(p," for language ").concat(h," failed"),g),!g&&y&&s.log("loaded namespace ".concat(p," for language ").concat(h),y),i.loaded("".concat(h,"|").concat(p),g,y)})})})}}}]),t}();yk.type="backend";function H4(){if(console&&console.warn){for(var t,e=arguments.length,n=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var s=function(c,f){var h=e.services.backendConnector.state["".concat(c,"|").concat(f)];return h===-1||h===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(r,t)&&(!i||s(a,t)))}function q4(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return qv("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(t,{precheck:function(a,s){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!s(a.isLanguageChangingTo,t))return!1}}):V4(t,e,n)}var K4=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Y4={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},X4=function(e){return Y4[e]},Q4=function(e){return e.replace(K4,X4)};function ob(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sb(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Kv=sb(sb({},Kv),t)}function Z4(){return Kv}var Sk;function eB(t){Sk=t}function tB(){return Sk}var nB={type:"3rdParty",init:function(e){J4(e.options.react),eB(e)}},rB=be.createContext(),iB=function(){function t(){Sr(this,t),this.usedNamespaces={}}return _r(t,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),t}();function aB(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,u=[],c=!0,f=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(h){f=!0,i=h}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(f)throw i}}return u}}function oB(t,e){return ok(t)||aB(t,e)||sk(t,e)||lk()}function lb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function km(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},n=e.i18n,r=be.useContext(rB)||{},i=r.i18n,a=r.defaultNS,s=n||i||tB();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new iB),!s){qv("You will need to pass in an i18next instance by using initReactI18next");var u=function(X,K){return typeof K=="string"?K:K&&gr(K)==="object"&&typeof K.defaultValue=="string"?K.defaultValue:Array.isArray(X)?X[X.length-1]:X},c=[u,{},!1];return c.t=u,c.i18n={},c.ready=!1,c}s.options.react&&s.options.react.wait!==void 0&&qv("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=km(km(km({},Z4()),s.options.react),e),h=f.useSuspense,p=f.keyPrefix,g=t||a||s.options&&s.options.defaultNS;g=typeof g=="string"?[g]:g||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(g);var y=(s.isInitialized||s.initializedStoreOnce)&&g.every(function(U){return q4(U,s,f)});function v(){return s.getFixedT(null,f.nsMode==="fallback"?g:g[0],p)}var w=be.useState(v),x=oB(w,2),_=x[0],S=x[1],C=g.join(),O=sB(C),I=be.useRef(!0);be.useEffect(function(){var U=f.bindI18n,X=f.bindI18nStore;I.current=!0,!y&&!h&&ab(s,g,function(){I.current&&S(v)}),y&&O&&O!==C&&I.current&&S(v);function K(){I.current&&S(v)}return U&&s&&s.on(U,K),X&&s&&s.store.on(X,K),function(){I.current=!1,U&&s&&U.split(" ").forEach(function(te){return s.off(te,K)}),X&&s&&X.split(" ").forEach(function(te){return s.store.off(te,K)})}},[s,C]);var L=be.useRef(!0);be.useEffect(function(){I.current&&!L.current&&S(v),L.current=!1},[s,p]);var D=[_,s,y];if(D.t=_,D.i18n=s,D.ready=y,y||!y&&!h)return D;throw new Promise(function(U){ab(s,g,function(){U()})})}Ae.use(yk).use(hk).use(nB).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const uB={isConnected:!1,isProcessing:!1,log:[],shouldShowLogViewer:!1,shouldDisplayInProgressType:"latents",shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,socketId:"",shouldConfirmOnDelete:!0,openAccordions:[0],currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatus:Ae.isInitialized?Ae.t("common.statusDisconnected"):"Disconnected",currentStatusHasSteps:!1,model:"",model_id:"",model_hash:"",app_id:"",app_version:"",model_list:{},infill_methods:[],hasError:!1,wasErrorSeen:!0,isCancelable:!0,saveIntermediatesInterval:5,enableImageDebugging:!1,toastQueue:[],searchFolder:null,foundModels:null,openModel:null,cancelOptions:{cancelType:"immediate",cancelAfter:null}},_k=vo({name:"system",initialState:uB,reducers:{setShouldDisplayInProgressType:(t,e)=>{t.shouldDisplayInProgressType=e.payload},setIsProcessing:(t,e)=>{t.isProcessing=e.payload},setCurrentStatus:(t,e)=>{t.currentStatus=e.payload},setSystemStatus:(t,e)=>({...t,...e.payload}),errorOccurred:t=>{t.hasError=!0,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusError"),t.wasErrorSeen=!1},errorSeen:t=>{t.hasError=!1,t.wasErrorSeen=!0,t.currentStatus=t.isConnected?Ae.t("common.statusConnected"):Ae.t("common.statusDisconnected")},addLogEntry:(t,e)=>{const{timestamp:n,message:r,level:i}=e.payload,s={timestamp:n,message:r,level:i||"info"};t.log.push(s)},setShouldShowLogViewer:(t,e)=>{t.shouldShowLogViewer=e.payload},setIsConnected:(t,e)=>{t.isConnected=e.payload,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.hasError=!1},setSocketId:(t,e)=>{t.socketId=e.payload},setShouldConfirmOnDelete:(t,e)=>{t.shouldConfirmOnDelete=e.payload},setOpenAccordions:(t,e)=>{t.openAccordions=e.payload},setSystemConfig:(t,e)=>({...t,...e.payload}),setShouldDisplayGuides:(t,e)=>{t.shouldDisplayGuides=e.payload},processingCanceled:t=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusProcessingCanceled")},generationRequested:t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusPreparing")},setModelList:(t,e)=>{t.model_list=e.payload},setIsCancelable:(t,e)=>{t.isCancelable=e.payload},modelChangeRequested:t=>{t.currentStatus=Ae.t("common.statusLoadingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelConvertRequested:t=>{t.currentStatus=Ae.t("common.statusConvertingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelMergingRequested:t=>{t.currentStatus=Ae.t("common.statusMergingModels"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},setSaveIntermediatesInterval:(t,e)=>{t.saveIntermediatesInterval=e.payload},setEnableImageDebugging:(t,e)=>{t.enableImageDebugging=e.payload},addToast:(t,e)=>{t.toastQueue.push(e.payload)},clearToastQueue:t=>{t.toastQueue=[]},setProcessingIndeterminateTask:(t,e)=>{t.isProcessing=!0,t.currentStatus=e.payload,t.currentStatusHasSteps=!1},setSearchFolder:(t,e)=>{t.searchFolder=e.payload},setFoundModels:(t,e)=>{t.foundModels=e.payload},setOpenModel:(t,e)=>{t.openModel=e.payload},setCancelType:(t,e)=>{t.cancelOptions.cancelType=e.payload},setCancelAfter:(t,e)=>{t.cancelOptions.cancelAfter=e.payload}}}),{setShouldDisplayInProgressType:eW,setIsProcessing:ei,addLogEntry:Gt,setShouldShowLogViewer:tW,setIsConnected:ub,setSocketId:nW,setShouldConfirmOnDelete:rW,setOpenAccordions:iW,setSystemStatus:cB,setCurrentStatus:ns,setSystemConfig:fB,setShouldDisplayGuides:aW,processingCanceled:dB,errorOccurred:cb,errorSeen:oW,setModelList:rs,setIsCancelable:Af,modelChangeRequested:hB,modelConvertRequested:pB,modelMergingRequested:gB,setSaveIntermediatesInterval:sW,setEnableImageDebugging:lW,generationRequested:mB,addToast:zl,clearToastQueue:uW,setProcessingIndeterminateTask:cW,setSearchFolder:vB,setFoundModels:yB,setOpenModel:fW,setCancelType:dW,setCancelAfter:hW}=_k.actions,SB=_k.reducer,wk=["txt2img","img2img","unifiedCanvas","nodes","postprocessing","training"],_B={activeTab:0,currentTheme:"dark",parametersPanelScrollPosition:0,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,addNewModelUIOption:null,shouldPinGallery:!0,shouldShowGallery:!0},wB=_B,bk=vo({name:"ui",initialState:wB,reducers:{setActiveTab:(t,e)=>{typeof e.payload=="number"?t.activeTab=e.payload:t.activeTab=wk.indexOf(e.payload)},setCurrentTheme:(t,e)=>{t.currentTheme=e.payload},setParametersPanelScrollPosition:(t,e)=>{t.parametersPanelScrollPosition=e.payload},setShouldPinParametersPanel:(t,e)=>{t.shouldPinParametersPanel=e.payload,t.shouldShowParametersPanel=!0},setShouldShowParametersPanel:(t,e)=>{t.shouldShowParametersPanel=e.payload},setShouldShowImageDetails:(t,e)=>{t.shouldShowImageDetails=e.payload},setShouldUseCanvasBetaLayout:(t,e)=>{t.shouldUseCanvasBetaLayout=e.payload},setShouldShowExistingModelsInSearch:(t,e)=>{t.shouldShowExistingModelsInSearch=e.payload},setShouldUseSliders:(t,e)=>{t.shouldUseSliders=e.payload},setAddNewModelUIOption:(t,e)=>{t.addNewModelUIOption=e.payload},setShouldPinGallery:(t,e)=>{t.shouldPinGallery=e.payload},setShouldShowGallery:(t,e)=>{t.shouldShowGallery=e.payload},togglePinGalleryPanel:t=>{t.shouldPinGallery=!t.shouldPinGallery},togglePinParametersPanel:t=>{t.shouldPinParametersPanel=!t.shouldPinParametersPanel},toggleParametersPanel:t=>{t.shouldShowParametersPanel=!t.shouldShowParametersPanel},toggleGalleryPanel:t=>{t.shouldShowGallery=!t.shouldShowGallery},togglePanels:t=>{t.shouldShowGallery||t.shouldShowParametersPanel?(t.shouldShowGallery=!1,t.shouldShowParametersPanel=!1):(t.shouldShowGallery=!0,t.shouldShowParametersPanel=!0)}}}),{setActiveTab:pW,setCurrentTheme:gW,setParametersPanelScrollPosition:mW,setShouldPinParametersPanel:vW,setShouldShowParametersPanel:yW,setShouldShowImageDetails:SW,setShouldUseCanvasBetaLayout:_W,setShouldShowExistingModelsInSearch:wW,setShouldUseSliders:bW,setAddNewModelUIOption:CW,setShouldPinGallery:xW,setShouldShowGallery:kW,togglePanels:PW,togglePinGalleryPanel:EW,togglePinParametersPanel:OW,toggleParametersPanel:TW,toggleGalleryPanel:RW}=bk.actions,bB=bk.reducer,di=Object.create(null);di.open="0";di.close="1";di.ping="2";di.pong="3";di.message="4";di.upgrade="5";di.noop="6";const hd=Object.create(null);Object.keys(di).forEach(t=>{hd[di[t]]=t});const CB={type:"error",data:"parser error"},xB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",kB=typeof ArrayBuffer=="function",PB=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ck=({type:t,data:e},n,r)=>xB&&e instanceof Blob?n?r(e):fb(e,r):kB&&(e instanceof ArrayBuffer||PB(e))?n?r(e):fb(new Blob([e]),r):r(di[t]+(e||"")),fb=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)},db="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eu=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,a,s,u,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const f=new ArrayBuffer(e),h=new Uint8Array(f);for(r=0;r>4,h[i++]=(s&15)<<4|u>>2,h[i++]=(u&3)<<6|c&63;return f},OB=typeof ArrayBuffer=="function",xk=(t,e)=>{if(typeof t!="string")return{type:"message",data:kk(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:TB(t.substring(1),e)}:hd[n]?t.length>1?{type:hd[n],data:t.substring(1)}:{type:hd[n]}:CB},TB=(t,e)=>{if(OB){const n=EB(t);return kk(n,e)}else return{base64:!0,data:t}},kk=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}},Pk=String.fromCharCode(30),RB=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((a,s)=>{Ck(a,!1,u=>{r[s]=u,++i===n&&e(r.join(Pk))})})},AB=(t,e)=>{const n=t.split(Pk),r=[];for(let i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Ok(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const LB=fr.setTimeout,MB=fr.clearTimeout;function Jh(t,e){e.useNativeTimers?(t.setTimeoutFn=LB.bind(fr),t.clearTimeoutFn=MB.bind(fr)):(t.setTimeoutFn=fr.setTimeout.bind(fr),t.clearTimeoutFn=fr.clearTimeout.bind(fr))}const DB=1.33;function NB(t){return typeof t=="string"?BB(t):Math.ceil((t.byteLength||t.size)*DB)}function BB(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}class FB extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Tk extends Rt{constructor(e){super(),this.writable=!1,Jh(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new FB(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=xk(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}}const Rk="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Yv=64,$B={};let hb=0,If=0,pb;function gb(t){let e="";do e=Rk[t%Yv]+e,t=Math.floor(t/Yv);while(t>0);return e}function Ak(){const t=gb(+new Date);return t!==pb?(hb=0,pb=t):t+"."+gb(hb++)}for(;If{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};AB(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,RB(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Ak()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=Ik(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ui(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class ui extends Rt{constructor(e,n){super(),Jh(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const e=Ok(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const n=this.xhr=new Mk(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ui.requestsCount++,ui.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=UB,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ui.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}ui.requestsCount=0;ui.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",mb);else if(typeof addEventListener=="function"){const t="onpagehide"in fr?"pagehide":"unload";addEventListener(t,mb,!1)}}function mb(){for(let t in ui.requests)ui.requests.hasOwnProperty(t)&&ui.requests[t].abort()}const Dk=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0))(),Lf=fr.WebSocket||fr.MozWebSocket,vb=!0,HB="arraybuffer",yb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class VB extends Tk{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=yb?{}:Ok(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=vb&&!yb?n?new Lf(e,n):new Lf(e):new Lf(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||HB,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{const s={};try{vb&&this.ws.send(a)}catch{}i&&Dk(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Ak()),this.supportsBinary||(e.b64=1);const i=Ik(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!Lf}}const qB={websocket:VB,polling:WB},KB=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,YB=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xv(t){const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=KB.exec(t||""),a={},s=14;for(;s--;)a[YB[s]]=i[s]||"";return n!=-1&&r!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=XB(a,a.path),a.queryKey=QB(a,a.query),a}function XB(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function QB(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let Nk=class os extends Rt{constructor(e,n={}){super(),this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Xv(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Xv(n.host).host),Jh(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=zB(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=Ek,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new qB[e](r)}open(){let e;if(this.opts.rememberUpgrade&&os.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(e){let n=this.createTransport(e),r=!1;os.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;os.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function a(){r||(r=!0,h(),n.close(),n=null)}const s=p=>{const g=new Error("probe error: "+p);g.transport=n.name,a(),this.emitReserved("upgradeError",g)};function u(){s("transport closed")}function c(){s("socket closed")}function f(p){n&&p.name!==n.name&&a()}const h=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",f)};n.once("open",i),n.once("error",s),n.once("close",u),this.once("close",c),this.once("upgrading",f),n.open()}onOpen(){if(this.readyState="open",os.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:e,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){os.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const i=e.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Bk=Object.prototype.toString,tF=typeof Blob=="function"||typeof Blob<"u"&&Bk.call(Blob)==="[object BlobConstructor]",nF=typeof File=="function"||typeof File<"u"&&Bk.call(File)==="[object FileConstructor]";function T0(t){return ZB&&(t instanceof ArrayBuffer||eF(t))||tF&&t instanceof Blob||nF&&t instanceof File}function pd(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num0;case Be.ACK:case Be.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class sF{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=iF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const lF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:R0,Encoder:oF,get PacketType(){return Be},protocol:aF},Symbol.toStringTag,{value:"Module"}));function Dr(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const uF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Fk extends Rt{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Dr(e,"open",this.onopen.bind(this)),Dr(e,"packet",this.onpacket.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(uF.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:Be.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const s=this.ids++,u=n.pop();this._registerAckCallback(s,u),r.id=s}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s{this.io.clearTimeoutFn(a),n.apply(this,[null,...s])}}emitWithAck(e,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((s,u)=>r?s?a(s):i(u):i(s)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...a)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Be.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Be.EVENT:case Be.BINARY_EVENT:this.onevent(e);break;case Be.ACK:case Be.BINARY_ACK:this.onack(e);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Be.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}Vs.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};Vs.prototype.reset=function(){this.attempts=0};Vs.prototype.setMin=function(t){this.ms=t};Vs.prototype.setMax=function(t){this.max=t};Vs.prototype.setJitter=function(t){this.jitter=t};class Zv extends Rt{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Jh(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Vs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||lF;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Nk(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Dr(n,"open",function(){r.onopen(),e&&e()}),a=Dr(n,"error",s=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",s),e?e(s):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const s=this._timeout;s===0&&i();const u=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},s);this.opts.autoUnref&&u.unref(),this.subs.push(function(){clearTimeout(u)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Dr(e,"ping",this.onping.bind(this)),Dr(e,"data",this.ondata.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this)),Dr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Dk(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Fk(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Gl={};function gd(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=JB(t,e.path||"/socket.io"),r=n.source,i=n.id,a=n.path,s=Gl[i]&&a in Gl[i].nsps,u=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let c;return u?c=new Zv(r,e):(Gl[i]||(Gl[i]=new Zv(r,e)),c=Gl[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(gd,{Manager:Zv,Socket:Fk,io:gd,connect:gd});const AW=["ddim","plms","k_lms","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_dpmpp_2_a","k_euler","k_euler_a","k_heun"],IW=["ddim","plms","k_lms","dpmpp_2","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_euler","k_euler_a","k_heun"],LW=Array.from(Array(65)).map((t,e)=>e*64),MW=Array.from(Array(65)).map((t,e)=>e*64),DW=[{key:"2x",value:2},{key:"4x",value:4}],cF=0,fF=4294967295,NW=["gfpgan","codeformer"],BW=[{key:"None",value:"none"},{key:"Fast",value:"latents"},{key:"Accurate",value:"full-res"}];var dF=Math.PI/180;function hF(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Os=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},pe={_global:Os,version:"8.4.2",isBrowser:hF(),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle(t){return pe.angleDeg?t*dF:t},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,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return pe.DD.isDragging},isDragReady(){return!!pe.DD.node},releaseCanvasOnDestroy:!0,document:Os.document,_injectGlobal(t){Os.Konva=t}},yt=t=>{pe[t.prototype.getClassName()]=t};pe._injectGlobal(pe);class Wn{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Wn(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){var n=Math.cos(e),r=Math.sin(e),i=this.m[0]*n+this.m[2]*r,a=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,u=this.m[1]*-r+this.m[3]*n;return this.m[0]=i,this.m[1]=a,this.m[2]=s,this.m[3]=u,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){var r=this.m[0]+this.m[2]*n,i=this.m[1]+this.m[3]*n,a=this.m[2]+this.m[0]*e,s=this.m[3]+this.m[1]*e;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=s,this}multiply(e){var n=this.m[0]*e.m[0]+this.m[2]*e.m[1],r=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],s=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],u=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,r=-this.m[1]*e,i=-this.m[2]*e,a=this.m[0]*e,s=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),u=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}getMatrix(){return this.m}decompose(){var e=this.m[0],n=this.m[1],r=this.m[2],i=this.m[3],a=this.m[4],s=this.m[5],u=e*i-n*r;let c={x:a,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){var f=Math.sqrt(e*e+n*n);c.rotation=n>0?Math.acos(e/f):-Math.acos(e/f),c.scaleX=f,c.scaleY=u/f,c.skewX=(e*r+n*i)/u,c.skewY=0}else if(r!=0||i!=0){var h=Math.sqrt(r*r+i*i);c.rotation=Math.PI/2-(i>0?Math.acos(-r/h):-Math.acos(r/h)),c.scaleX=u/h,c.scaleY=h,c.skewX=0,c.skewY=(e*r+n*i)/u}return c.rotation=G._getRotation(c.rotation),c}}var pF="[object Array]",gF="[object Number]",mF="[object String]",vF="[object Boolean]",yF=Math.PI/180,SF=180/Math.PI,Pm="#",_F="",wF="0",bF="Konva warning: ",Sb="Konva error: ",CF="rgb(",Em={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]},xF=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Mf=[];const kF=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,60)},G={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===pF},_isNumber(t){return Object.prototype.toString.call(t)===gF&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===mF},_isBoolean(t){return Object.prototype.toString.call(t)===vF},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!="string")return!1;var e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){return t===0||t>0?1:-1},requestAnimFrame(t){Mf.push(t),Mf.length===1&&kF(function(){const e=Mf;Mf=[],e.forEach(function(n){n()})})},createCanvasElement(){var t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){var n=G.createImageElement();n.onload=function(){e(n)},n.src=t},_rgbToHex(t,e,n){return((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},_hexToRgb(t){t=t.replace(Pm,_F);var e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){for(var t=(Math.random()*16777215<<0).toString(16);t.length<6;)t=wF+t;return Pm+t},getRGB(t){var e;return t in Em?(e=Em[t],{r:e[0],g:e[1],b:e[2]}):t[0]===Pm?this._hexToRgb(t.substring(1)):t.substr(0,4)===CF?(e=xF.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",G._namedColorToRBA(t)||G._hex3ColorToRGBA(t)||G._hex4ColorToRGBA(t)||G._hex6ColorToRGBA(t)||G._hex8ColorToRGBA(t)||G._rgbColorToRGBA(t)||G._rgbaColorToRGBA(t)||G._hslColorToRGBA(t)},_namedColorToRBA(t){var e=Em[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];var e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];var e=t.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),r=Number(n[0])/360,i=Number(n[1])/100,a=Number(n[2])/100;let s,u,c;if(i===0)return c=a*255,{r:Math.round(c),g:Math.round(c),b:Math.round(c),a:1};a<.5?s=a*(1+i):s=a+i-a*i;const f=2*a-s,h=[0,0,0];for(let p=0;p<3;p++)u=r+1/3*-(p-1),u<0&&u++,u>1&&u--,6*u<1?c=f+(s-f)*6*u:2*u<1?c=s:3*u<2?c=f+(s-f)*(2/3-u)*6:c=f,h[p]=c*255;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.widtht.y+t.height||e.y+e.height1?(s=n,u=r,c=(n-i)*(n-i)+(r-a)*(r-a)):(s=t+h*(n-t),u=e+h*(r-e),c=(s-i)*(s-i)+(u-a)*(u-a))}return[s,u,c]},_getProjectionToLine(t,e,n){var r=G.cloneObject(t),i=Number.MAX_VALUE;return e.forEach(function(a,s){if(!(!n&&s===e.length-1)){var u=e[(s+1)%e.length],c=G._getProjectionToSegment(a.x,a.y,u.x,u.y,t.x,t.y),f=c[0],h=c[1],p=c[2];pe.length){var s=e;e=t,t=s}for(r=0;r{e.width=0,e.height=0})},drawRoundedRectPath(t,e,n,r){let i=0,a=0,s=0,u=0;typeof r=="number"?i=a=s=u=Math.min(r,e/2,n/2):(i=Math.min(r[0]||0,e/2,n/2),a=Math.min(r[1]||0,e/2,n/2),u=Math.min(r[2]||0,e/2,n/2),s=Math.min(r[3]||0,e/2,n/2)),t.moveTo(i,0),t.lineTo(e-a,0),t.arc(e-a,a,a,Math.PI*3/2,0,!1),t.lineTo(e,n-u),t.arc(e-u,n-u,u,0,Math.PI/2,!1),t.lineTo(s,n),t.arc(s,n-s,s,Math.PI/2,Math.PI,!1),t.lineTo(0,i),t.arc(i,i,i,Math.PI,Math.PI*3/2,!1)}};function Da(t){return G._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||G._isBoolean(t)?t:Object.prototype.toString.call(t)}function $k(t){return t>255?255:t<0?0:Math.round(t)}function le(){if(pe.isUnminified)return function(t,e){return G._isNumber(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function A0(t){if(pe.isUnminified)return function(e,n){let r=G._isNumber(e),i=G._isArray(e)&&e.length==t;return!r&&!i&&G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function I0(){if(pe.isUnminified)return function(t,e){var n=G._isNumber(t),r=t==="auto";return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function qs(){if(pe.isUnminified)return function(t,e){return G._isString(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function zk(){if(pe.isUnminified)return function(t,e){const n=G._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function PF(){if(pe.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(G._isArray(t)?t.forEach(function(r){G._isNumber(r)||G.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function jr(){if(pe.isUnminified)return function(t,e){var n=t===!0||t===!1;return n||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function EF(t){if(pe.isUnminified)return function(e,n){return e==null||G.isObject(e)||G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}var Ul="get",jl="set";const A={addGetterSetter(t,e,n,r,i){A.addGetter(t,e,n),A.addSetter(t,e,r,i),A.addOverloadedGetterSetter(t,e)},addGetter(t,e,n){var r=Ul+G._capitalize(e);t.prototype[r]=t.prototype[r]||function(){var i=this.attrs[e];return i===void 0?n:i}},addSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]||A.overWriteSetter(t,e,n,r)},overWriteSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]=function(a){return n&&a!==void 0&&a!==null&&(a=n.call(this,a,e)),this._setAttr(e,a),r&&r.call(this),this}},addComponentsGetterSetter(t,e,n,r,i){var a=n.length,s=G._capitalize,u=Ul+s(e),c=jl+s(e),f,h;t.prototype[u]=function(){var g={};for(f=0;f{this._setAttr(e+s(w),void 0)}),this._fireChangeEvent(e,y,g),i&&i.call(this),this},A.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){var n=G._capitalize(e),r=jl+n,i=Ul+n;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,n,r){G.error("Adding deprecated "+e);var i=Ul+G._capitalize(e),a=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){G.error(a);var s=this.attrs[e];return s===void 0?n:s},A.addSetter(t,e,r,function(){G.error(a)}),A.addOverloadedGetterSetter(t,e)},backCompat(t,e){G.each(e,function(n,r){var i=t.prototype[r],a=Ul+G._capitalize(n),s=jl+G._capitalize(n);function u(){i.apply(this,arguments),G.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}t.prototype[n]=u,t.prototype[a]=u,t.prototype[s]=u})},afterSetFilter(){this._filterUpToDate=!1}};function OF(t){var e=[],n=t.length,r=G,i,a;for(i=0;itypeof h=="number"?Math.floor(h):h)),a+=TF+f.join(_b)+RF)):(a+=u.property,e||(a+=DF+u.val)),a+=LF;return a}clearTrace(){this.traceArr=[]}_trace(e){var n=this.traceArr,r;n.push(e),r=n.length,r>=BF&&n.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var 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){var n=e.getLineCap();n&&this.setAttr("lineCap",n)}_applyOpacity(e){var n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){var n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,i,a,s){this._context.arc(e,n,r,i,a,s)}arcTo(e,n,r,i,a){this._context.arcTo(e,n,r,i,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,a,s){this._context.bezierCurveTo(e,n,r,i,a,s)}clearRect(e,n,r,i){this._context.clearRect(e,n,r,i)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,n){var 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,a,s){return this._context.createRadialGradient(e,n,r,i,a,s)}drawImage(e,n,r,i,a,s,u,c,f){var h=arguments,p=this._context;h.length===3?p.drawImage(e,n,r):h.length===5?p.drawImage(e,n,r,i,a):h.length===9&&p.drawImage(e,n,r,i,a,s,u,c,f)}ellipse(e,n,r,i,a,s,u,c){this._context.ellipse(e,n,r,i,a,s,u,c)}isPointInPath(e,n,r,i){return r?this._context.isPointInPath(r,e,n,i):this._context.isPointInPath(e,n,i)}fill(e){e?this._context.fill(e):this._context.fill()}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)}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,a,s){this._context.setTransform(e,n,r,i,a,s)}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,a,s){this._context.transform(e,n,r,i,a,s)}translate(e,n){this._context.translate(e,n)}_enableTrace(){var e=this,n=wb.length,r=this.setAttr,i,a,s=function(u){var c=e[u],f;e[u]=function(){return a=OF(Array.prototype.slice.call(arguments,0)),f=c.apply(e,arguments),e._trace({method:u,args:a}),f}};for(i=0;i{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return Ge._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];Ge._dragElements.forEach((n,r)=>{const{node:i}=n,a=i.getStage();a.setPointersPositions(t),n.pointerId===void 0&&(n.pointerId=G._getFirstPointerId(t));const s=a._changedPointerPositions.find(f=>f.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){var u=i.dragDistance(),c=Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y));if(c{n.fire("dragmove",{type:"dragmove",target:n,evt:t},!0)})},_endDragBefore(t){const e=[];Ge._dragElements.forEach(n=>{const{node:r}=n,i=r.getStage();if(t&&i.setPointersPositions(t),!i._changedPointerPositions.find(u=>u.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Ge.justDragged=!0,pe._mouseListenClick=!1,pe._touchListenClick=!1,pe._pointerListenClick=!1,n.dragStatus="stopped");const s=n.node.getLayer()||n.node instanceof pe.Stage&&n.node;s&&e.indexOf(s)===-1&&e.push(s)}),e.forEach(n=>{n.draw()})},_endDragAfter(t){Ge._dragElements.forEach((e,n)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&Ge._dragElements.delete(n)})}};pe.isBrowser&&(window.addEventListener("mouseup",Ge._endDragBefore,!0),window.addEventListener("touchend",Ge._endDragBefore,!0),window.addEventListener("mousemove",Ge._drag),window.addEventListener("touchmove",Ge._drag),window.addEventListener("mouseup",Ge._endDragAfter,!1),window.addEventListener("touchend",Ge._endDragAfter,!1));var md="absoluteOpacity",Nf="allEventListeners",Ii="absoluteTransform",bb="absoluteScale",Xa="canvas",GF="Change",UF="children",jF="konva",ey="listening",Cb="mouseenter",xb="mouseleave",kb="set",Pb="Shape",vd=" ",Eb="stage",ua="transform",WF="Stage",ty="visible",HF=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(vd);let VF=1;class se{constructor(e){this._id=VF++,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===ua||e===Ii)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){var r=this._cache.get(e),i=e===ua||e===Ii,a=r===void 0||i&&r.dirty===!0;return a&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const i=n.map(a=>a+"Change.konva").join(vd);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(Xa)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ii&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Xa)){const{scene:e,filter:n,hit:r}=this._cache.get(Xa);G.releaseCanvas(e,n,r),this._cache.delete(Xa)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var n=e||{},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()}));var i=Math.ceil(n.width||r.width),a=Math.ceil(n.height||r.height),s=n.pixelRatio,u=n.x===void 0?Math.floor(r.x):n.x,c=n.y===void 0?Math.floor(r.y):n.y,f=n.offset||0,h=n.drawBorder||!1,p=n.hitCanvasPixelRatio||1;if(!i||!a){G.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=f*2+1,a+=f*2+1,u-=f,c-=f;var g=new Ts({pixelRatio:s,width:i,height:a}),y=new Ts({pixelRatio:s,width:0,height:0}),v=new L0({pixelRatio:p,width:i,height:a}),w=g.getContext(),x=v.getContext();return v.isCache=!0,g.isCache=!0,this._cache.delete(Xa),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(g.getContext()._context.imageSmoothingEnabled=!1,y.getContext()._context.imageSmoothingEnabled=!1),w.save(),x.save(),w.translate(-u,-c),x.translate(-u,-c),this._isUnderCache=!0,this._clearSelfAndDescendantCache(md),this._clearSelfAndDescendantCache(bb),this.drawScene(g,this),this.drawHit(v,this),this._isUnderCache=!1,w.restore(),x.restore(),h&&(w.save(),w.beginPath(),w.rect(0,0,i,a),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),this._cache.set(Xa,{scene:g,filter:y,hit:v,x:u,y:c}),this._requestDraw(),this}isCached(){return this._cache.has(Xa)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){var 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}],i,a,s,u,c=this.getAbsoluteTransform(n);return r.forEach(function(f){var h=c.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),{x:i,y:a,width:s-i,height:u-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/i,r.height/i),e.restore()}_drawCachedHitCanvas(e){var 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(){var e=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,a=i.getContext(),s,u,c,f;if(e){if(!this._filterUpToDate){var h=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=e.length,a.clear(),a.drawImage(r._canvas,0,0,r.getWidth()/h,r.getHeight()/h),u=a.getImageData(0,0,i.getWidth(),i.getHeight()),c=0;c{var n,r;if(!e)return this;for(n in e)n!==UF&&(r=kb+G._capitalize(n),G._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(ey,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(ty,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);var r=this.getLayer(),i=!1;Ge._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var a=!n&&!pe.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),n=this,r=0,i,a,s,u;function c(f){for(i=[],a=f.length,s=0;s0&&i[0].getDepth()<=e&&c(i)}return n.nodeType!==WF&&c(n.getStage().getChildren()),r}getDepth(){for(var e=0,n=this.parent;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(ua),this._clearSelfAndDescendantCache(Ii)),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(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);var i=this.getAbsoluteTransform(e).getMatrix(),a=new Wn,s=this.offset();return a.m=i.slice(),a.translate(s.x,s.y),a.getTranslation()}setAbsolutePosition(e){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(ua);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(e.x,e.y),e={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:e.x,y:e.y}),this._clearCache(ua),this._clearSelfAndDescendantCache(Ii),this}_setTransform(e){var n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){var 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){var n=e.x,r=e.y,i=this.x(),a=this.y();return n!==void 0&&(i+=n),r!==void 0&&(a+=r),this.setPosition({x:i,y:a}),this}_eachAncestorReverse(e,n){var r=[],i=this.getParent(),a,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(a=r.length,s=0;s0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return G.warn("Node has no parent. moveToBottom function is ignored."),!1;var 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 G.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&G.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)+".");var 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(md,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},n=this.getAttrs(),r,i,a,s,u;e.attrs={};for(r in n)i=n[r],u=G.isObject(i)&&!G._isPlainObject(i)&&!G._isArray(i),!u&&(a=typeof this[r]=="function"&&this[r],delete n[r],s=a?a.call(this):null,n[r]=i,s!==i&&(e.attrs[r]=i));return e.className=this.getClassName(),G._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){var i=[];n&&this._isMatch(e)&&i.push(this);for(var a=this.parent;a;){if(a===r)return i;a._isMatch(e)&&i.push(a),a=a.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);var n=e.replace(/ /g,"").split(","),r=n.length,i,a;for(i=0;i{try{const i=e==null?void 0:e.callback;i&&delete e.callback,G._urlToImage(this.toDataURL(e),function(a){n(a),i==null||i(a)})}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(a=>{n(a),i==null||i(a)})}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():pe.dragDistance}_off(e,n,r){var i=this.eventListeners[e],a,s,u;for(a=0;a=0;if(r&&!this.isDragging()){var i=!1;Ge._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(i=!0)}),i||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const n=Ge._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Ge._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 G.haveIntersection(r,this.getClientRect())}static create(e,n){return G._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){var r=se.prototype.getClassName.call(e),i=e.children,a,s,u;n&&(e.attrs.container=n),pe[r]||(G.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const c=pe[r];if(a=new c(e.attrs),i)for(s=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(var n=0;n0?n[0]:void 0}_generalFind(e,n){var r=[];return this._descendants(i=>{const a=i._isMatch(e);return a&&r.push(i),!!(a&&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(){var e=se.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){for(var n=e.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){var n=se.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){var n=[];return this.find("Shape").forEach(function(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){var r=this.getLayer(),i=e||r&&r.getCanvas(),a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.scene,c=i&&i.isCache;if(!this.isVisible()&&!c)return this;if(u){a.save();var f=this.getAbsoluteTransform(n).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=e||r&&r.hitCanvas,a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.hit;if(u){a.save();var c=this.getAbsoluteTransform(n).getMatrix();a.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r){var i,a=n&&n.getContext(),s=this.clipWidth(),u=this.clipHeight(),c=this.clipFunc(),f=s&&u||c;const h=r===this;if(f){a.save();var p=this.getAbsoluteTransform(r),g=p.getMatrix();if(a.transform(g[0],g[1],g[2],g[3],g[4],g[5]),a.beginPath(),c)c.call(this,a,this);else{var y=this.clipX(),v=this.clipY();a.rect(y,v,s,u)}a.clip(),g=p.copy().invert().getMatrix(),a.transform(g[0],g[1],g[2],g[3],g[4],g[5])}var w=!h&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";w&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(x){x[e](n,r)}),w&&a.restore(),f&&a.restore()}getClientRect(e){var n;e=e||{};var r=e.skipTransform,i=e.relativeTo,a,s,u,c,f={x:1/0,y:1/0,width:0,height:0},h=this;(n=this.children)===null||n===void 0||n.forEach(function(w){if(w.visible()){var x=w.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});x.width===0&&x.height===0||(a===void 0?(a=x.x,s=x.y,u=x.x+x.width,c=x.y+x.height):(a=Math.min(a,x.x),s=Math.min(s,x.y),u=Math.max(u,x.x+x.width),c=Math.max(c,x.y+x.height)))}});for(var p=this.find("Shape"),g=!1,y=0;yt.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",is=t=>{const e=iu(t);if(e==="pointer")return pe.pointerEventsEnabled&&Tm.pointer;if(e==="touch")return Tm.touch;if(e==="mouse")return Tm.mouse};function Tb(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&G.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const ZF="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);",yd=[];class tp extends qn{constructor(e){super(Tb(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),yd.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Tb(this.attrs)}),this._checkVisibility()}_validateAdd(e){const n=e.getType()==="Layer",r=e.getType()==="FastLayer";n||r||G.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===KF){if(e.charAt(0)==="."){var n=e.slice(1);e=document.getElementsByClassName(n)[0]}else{var r;e.charAt(0)!=="#"?r=e:r=e.slice(1),e=document.getElementById(r)}if(!e)throw"Can not find container in document with id "+r}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e=this.children,n=e.length,r;for(r=0;r-1&&yd.splice(n,1),G.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(G.warn(ZF),null)}_getPointerById(e){return this._pointerPositions.find(n=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e=e||{},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var n=new Ts({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),r=n.getContext()._context,i=this.children;return(e.x||e.y)&&r.translate(-1*e.x,-1*e.y),i.forEach(function(a){if(a.isVisible()){var s=a._toKonvaCanvas(e);r.drawImage(s._canvas,e.x,e.y,s.getWidth()/s.getPixelRatio(),s.getHeight()/s.getPixelRatio())}}),n}getIntersection(e){if(!e)return null;var n=this.children,r=n.length,i=r-1,a;for(a=i;a>=0;a--){const s=n[a].getIntersection(e);if(s)return s}return null}_resizeDOM(){var e=this.width(),n=this.height();this.content&&(this.content.style.width=e+Ob,this.content.style.height=n+Ob),this.bufferCanvas.setSize(e,n),this.bufferHitCanvas.setSize(e,n),this.children.forEach(r=>{r.setSize({width:e,height:n}),r.draw()})}add(e,...n){if(arguments.length>1){for(var r=0;rQF&&G.warn("The stage has "+i+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),pe.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return Uk(e,this)}setPointerCapture(e){jk(e,this)}releaseCapture(e){mu(e)}getLayers(){return this.children}_bindContentEvents(){pe.isBrowser&&JF.forEach(([e,n])=>{this.content.addEventListener(e,r=>{this[n](r)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];return n&&!n.getStage()&&(n=null),n}_pointerleave(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=this._getTargetShape(r),a=!Ge.isDragging||pe.hitOnDragEnabled;i&&a?(i._fireAndBubble(n.pointerout,{evt:e}),i._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[r+"targetShape"]=null):a&&(this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=!1;this._changedPointerPositions.forEach(a=>{var s=this.getIntersection(a);if(Ge.justDragged=!1,pe["_"+r+"ListenClick"]=!0,!(s&&s.isListening()))return;pe.capturePointerEventsEnabled&&s.setPointerCapture(a.id),this[r+"ClickStartShape"]=s,s._fireAndBubble(n.pointerdown,{evt:e,pointerId:a.id}),i=!0;const c=e.type.indexOf("touch")>=0;s.preventDefault()&&e.cancelable&&c&&e.preventDefault()}),i||this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const n=is(e.type),r=iu(e.type);if(!n)return;Ge.isDragging&&Ge.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e);var i=!Ge.isDragging||pe.hitOnDragEnabled;if(!i)return;var a={};let s=!1;var u=this._getTargetShape(r);this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c),h=c.id,p={evt:e,pointerId:h};var g=u!==f;if(g&&u&&(u._fireAndBubble(n.pointerout,Object.assign({},p),f),u._fireAndBubble(n.pointerleave,Object.assign({},p),f)),f){if(a[f._id])return;a[f._id]=!0}f&&f.isListening()?(s=!0,g&&(f._fireAndBubble(n.pointerover,Object.assign({},p),u),f._fireAndBubble(n.pointerenter,Object.assign({},p),u),this[r+"targetShape"]=f),f._fireAndBubble(n.pointermove,Object.assign({},p))):u&&(this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:h}),this[r+"targetShape"]=null)}),s||this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const n=is(e.type),r=iu(e.type);if(!n)return;this.setPointersPositions(e);const i=this[r+"ClickStartShape"],a=this[r+"ClickEndShape"];var s={};let u=!1;this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c);if(f){if(f.releaseCapture(c.id),s[f._id])return;s[f._id]=!0}const h=c.id,p={evt:e,pointerId:h};let g=!1;pe["_"+r+"InDblClickWindow"]?(g=!0,clearTimeout(this[r+"DblTimeout"])):Ge.justDragged||(pe["_"+r+"InDblClickWindow"]=!0,clearTimeout(this[r+"DblTimeout"])),this[r+"DblTimeout"]=setTimeout(function(){pe["_"+r+"InDblClickWindow"]=!1},pe.dblClickWindow),f&&f.isListening()?(u=!0,this[r+"ClickEndShape"]=f,f._fireAndBubble(n.pointerup,Object.assign({},p)),pe["_"+r+"ListenClick"]&&i&&i===f&&(f._fireAndBubble(n.pointerclick,Object.assign({},p)),g&&a&&a===f&&f._fireAndBubble(n.pointerdblclick,Object.assign({},p)))):(this[r+"ClickEndShape"]=null,pe["_"+r+"ListenClick"]&&this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:h}),g&&this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:h}))}),u||this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),pe["_"+r+"ListenClick"]=!1,e.cancelable&&r!=="touch"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ny,{evt:e}):this._fire(ny,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ry,{evt:e}):this._fire(ry,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const n=Om(e.pointerId)||this.getIntersection(this.getPointerPosition());n&&n._fireAndBubble(Ss,M0(e)),mu(e.pointerId)}_lostpointercapture(e){mu(e.pointerId)}setPointersPositions(e){var n=this._getContentPosition(),r=null,i=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,a=>{this._pointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,a=>{this._changedPointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})})):(r=(e.clientX-n.left)/n.scaleX,i=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}],this._changedPointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}])}_setPointerPosition(e){G.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ts({width:this.width(),height:this.height()}),this.bufferHitCanvas=new L0({pixelRatio:1,width:this.width(),height:this.height()}),!!pe.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}cache(){return G.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}}tp.prototype.nodeType=qF;yt(tp);A.addGetterSetter(tp,"container");var eP="hasShadow",tP="shadowRGBA",nP="patternImage",rP="linearGradient",iP="radialGradient";let Gf;function Rm(){return Gf||(Gf=G.createCanvasElement().getContext("2d"),Gf)}const vu={};function e$(t){t.fill()}function t$(t){t.stroke()}function n$(t){t.fill()}function r$(t){t.stroke()}function i$(){this._clearCache(eP)}function a$(){this._clearCache(tP)}function o$(){this._clearCache(nP)}function s$(){this._clearCache(rP)}function l$(){this._clearCache(iP)}class re extends se{constructor(e){super(e);let n;for(;n=G.getRandomColor(),!(n&&!(n in vu)););this.colorKey=n,vu[n]=this}getContext(){return G.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return G.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(eP,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(nP,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var e=Rm();const n=e.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){const r=new Wn;r.translate(this.fillPatternX(),this.fillPatternY()),r.rotate(pe.getAngle(this.fillPatternRotation())),r.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),r.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=r.getMatrix(),a=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);n.setTransform(a)}return n}}_getLinearGradient(){return this._getCache(rP,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var n=Rm(),r=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),a=n.createLinearGradient(r.x,r.y,i.x,i.y),s=0;sthis.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 e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var n=this.getStage(),r=n.bufferHitCanvas,i;return r.getContext().clear(),this.drawHit(r,null,!0),i=r.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data,i[3]>0}destroy(){return se.prototype.destroy.call(this),delete vu[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!this.getStage()||!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=e||this.hasFill(),a=this.hasStroke(),s=this.getAbsoluteOpacity()!==1;if(i&&a&&s)return!0;const u=this.hasShadow(),c=this.shadowForStrokeEnabled();return!!(i&&a&&u&&c)}setStrokeHitEnabled(e){G.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const n=e.skipTransform,r=e.relativeTo,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,u=i.width+s,c=i.height+s,f=!e.skipShadow&&this.hasShadow(),h=f?this.shadowOffsetX():0,p=f?this.shadowOffsetY():0,g=u+Math.abs(h),y=c+Math.abs(p),v=f&&this.shadowBlur()||0,w=g+v*2,x=y+v*2,_={width:w,height:x,x:-(s/2+v)+Math.min(h,0)+i.x,y:-(s/2+v)+Math.min(p,0)+i.y};return n?_:this._transformedRect(_,r)}drawScene(e,n){var r=this.getLayer(),i=e||r.getCanvas(),a=i.getContext(),s=this._getCanvasCache(),u=this.getSceneFunc(),c=this.hasShadow(),f,h,p,g=i.isCache,y=n===this;if(!this.isVisible()&&!y)return this;if(s){a.save();var v=this.getAbsoluteTransform(n).getMatrix();return a.transform(v[0],v[1],v[2],v[3],v[4],v[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!u)return this;if(a.save(),this._useBufferCanvas()&&!g){f=this.getStage(),h=f.bufferCanvas,p=h.getContext(),p.clear(),p.save(),p._applyLineJoin(this);var w=this.getAbsoluteTransform(n).getMatrix();p.transform(w[0],w[1],w[2],w[3],w[4],w[5]),u.call(this,p,this),p.restore();var x=h.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(h._canvas,0,0,h.width/x,h.height/x)}else{if(a._applyLineJoin(this),!y){var w=this.getAbsoluteTransform(n).getMatrix();a.transform(w[0],w[1],w[2],w[3],w[4],w[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),u.call(this,a,this)}return a.restore(),this}drawHit(e,n,r=!1){if(!this.shouldDrawHit(n,r))return this;var i=this.getLayer(),a=e||i.hitCanvas,s=a&&a.getContext(),u=this.hitFunc()||this.sceneFunc(),c=this._getCanvasCache(),f=c&&c.hit;if(this.colorKey||G.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()"),f){s.save();var h=this.getAbsoluteTransform(n).getMatrix();return s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(s),s.restore(),this}if(!u)return this;if(s.save(),s._applyLineJoin(this),!(this===n)){var g=this.getAbsoluteTransform(n).getMatrix();s.transform(g[0],g[1],g[2],g[3],g[4],g[5])}return u.call(this,s,this),s.restore(),this}drawHitFromCache(e=0){var n=this._getCanvasCache(),r=this._getCachedSceneCanvas(),i=n.hit,a=i.getContext(),s=i.getWidth(),u=i.getHeight(),c,f,h,p,g,y;a.clear(),a.drawImage(r._canvas,0,0,s,u);try{for(c=a.getImageData(0,0,s,u),f=c.data,h=f.length,p=G._hexToRgb(this.colorKey),g=0;ge?(f[g]=p.r,f[g+1]=p.g,f[g+2]=p.b,f[g+3]=255):f[g+3]=0;a.putImageData(c,0,0)}catch(v){G.error("Unable to draw hit graph from cached scene canvas. "+v.message)}return this}hasPointerCapture(e){return Uk(e,this)}setPointerCapture(e){jk(e,this)}releaseCapture(e){mu(e)}}re.prototype._fillFunc=e$;re.prototype._strokeFunc=t$;re.prototype._fillFuncHit=n$;re.prototype._strokeFuncHit=r$;re.prototype._centroid=!1;re.prototype.nodeType="Shape";yt(re);re.prototype.eventListeners={};re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",i$);re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",a$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",o$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",s$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",l$);A.addGetterSetter(re,"stroke",void 0,zk());A.addGetterSetter(re,"strokeWidth",2,le());A.addGetterSetter(re,"fillAfterStrokeEnabled",!1);A.addGetterSetter(re,"hitStrokeWidth","auto",I0());A.addGetterSetter(re,"strokeHitEnabled",!0,jr());A.addGetterSetter(re,"perfectDrawEnabled",!0,jr());A.addGetterSetter(re,"shadowForStrokeEnabled",!0,jr());A.addGetterSetter(re,"lineJoin");A.addGetterSetter(re,"lineCap");A.addGetterSetter(re,"sceneFunc");A.addGetterSetter(re,"hitFunc");A.addGetterSetter(re,"dash");A.addGetterSetter(re,"dashOffset",0,le());A.addGetterSetter(re,"shadowColor",void 0,qs());A.addGetterSetter(re,"shadowBlur",0,le());A.addGetterSetter(re,"shadowOpacity",1,le());A.addComponentsGetterSetter(re,"shadowOffset",["x","y"]);A.addGetterSetter(re,"shadowOffsetX",0,le());A.addGetterSetter(re,"shadowOffsetY",0,le());A.addGetterSetter(re,"fillPatternImage");A.addGetterSetter(re,"fill",void 0,zk());A.addGetterSetter(re,"fillPatternX",0,le());A.addGetterSetter(re,"fillPatternY",0,le());A.addGetterSetter(re,"fillLinearGradientColorStops");A.addGetterSetter(re,"strokeLinearGradientColorStops");A.addGetterSetter(re,"fillRadialGradientStartRadius",0);A.addGetterSetter(re,"fillRadialGradientEndRadius",0);A.addGetterSetter(re,"fillRadialGradientColorStops");A.addGetterSetter(re,"fillPatternRepeat","repeat");A.addGetterSetter(re,"fillEnabled",!0);A.addGetterSetter(re,"strokeEnabled",!0);A.addGetterSetter(re,"shadowEnabled",!0);A.addGetterSetter(re,"dashEnabled",!0);A.addGetterSetter(re,"strokeScaleEnabled",!0);A.addGetterSetter(re,"fillPriority","color");A.addComponentsGetterSetter(re,"fillPatternOffset",["x","y"]);A.addGetterSetter(re,"fillPatternOffsetX",0,le());A.addGetterSetter(re,"fillPatternOffsetY",0,le());A.addComponentsGetterSetter(re,"fillPatternScale",["x","y"]);A.addGetterSetter(re,"fillPatternScaleX",1,le());A.addGetterSetter(re,"fillPatternScaleY",1,le());A.addComponentsGetterSetter(re,"fillLinearGradientStartPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientStartPointX",0);A.addGetterSetter(re,"strokeLinearGradientStartPointX",0);A.addGetterSetter(re,"fillLinearGradientStartPointY",0);A.addGetterSetter(re,"strokeLinearGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillLinearGradientEndPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientEndPointX",0);A.addGetterSetter(re,"strokeLinearGradientEndPointX",0);A.addGetterSetter(re,"fillLinearGradientEndPointY",0);A.addGetterSetter(re,"strokeLinearGradientEndPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientStartPointX",0);A.addGetterSetter(re,"fillRadialGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientEndPointX",0);A.addGetterSetter(re,"fillRadialGradientEndPointY",0);A.addGetterSetter(re,"fillPatternRotation",0);A.backCompat(re,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var u$="#",c$="beforeDraw",f$="draw",aP=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],d$=aP.length;class yo extends qn{constructor(e){super(e),this.canvas=new Ts,this.hitCanvas=new L0({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);var 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;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(c$,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),qn.prototype.drawScene.call(this,i,n),this._fire(f$,{node:this}),this}drawHit(e,n){var r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),qn.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return G.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}yo.prototype.nodeType="Layer";yt(yo);A.addGetterSetter(yo,"imageSmoothingEnabled",!0);A.addGetterSetter(yo,"clearBeforeDraw",!0);A.addGetterSetter(yo,"hitGraphEnabled",!0,jr());class D0 extends yo{constructor(e){super(e),this.listening(!1),G.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}D0.prototype.nodeType="FastLayer";yt(D0);class zs extends qn{_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&G.throw("You may only add groups and shapes to groups.")}}zs.prototype.nodeType="Group";yt(zs);var Am=function(){return Os.performance&&Os.performance.now?function(){return Os.performance.now()}:function(){return new Date().getTime()}}();class dr{constructor(e,n){this.id=dr.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Am(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){var n=[];return e?e.length>0?n=e:n=[e]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(e){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=Rb,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=Ab,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var e=this.getTimer()-this._startTime;this.state===Rb?this.setTime(e):this.state===Ab&&this.setTime(this.duration-e)}pause(){this.state=p$,this.fire("onPause")}getTimer(){return new Date().getTime()}}class kt{constructor(e){var n=this,r=e.node,i=r._id,a,s=e.easing||yu.Linear,u=!!e.yoyo,c;typeof e.duration>"u"?a=.3:e.duration===0?a=.001:a=e.duration,this.node=r,this._id=g$++;var f=r.getLayer()||(r instanceof pe.Stage?r.getLayers():null);f||G.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new dr(function(){n.tween.onEnterFrame()},f),this.tween=new m$(c,function(h){n._tweenFunc(h)},s,0,1,a*1e3,u),this._addListeners(),kt.attrs[i]||(kt.attrs[i]={}),kt.attrs[i][this._id]||(kt.attrs[i][this._id]={}),kt.tweens[i]||(kt.tweens[i]={});for(c in e)h$[c]===void 0&&this._addAttr(c,e[c]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){var r=this.node,i=r._id,a,s,u,c,f,h,p,g;if(u=kt.tweens[i][e],u&&delete kt.attrs[i][u][e],a=r.getAttr(e),G._isArray(n))if(s=[],f=Math.max(n.length,a.length),e==="points"&&n.length!==a.length&&(n.length>a.length?(p=a,a=G._prepareArrayForTween(a,n,r.closed())):(h=n,n=G._prepareArrayForTween(n,a,r.closed()))),e.indexOf("fill")===0)for(c=0;c{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueEnd&&e.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueStart&&e.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e=this.node._id,n=this._id,r=kt.tweens[e],i;this.pause();for(i in r)delete kt.tweens[e][i];delete kt.attrs[e][n]}}kt.attrs={};kt.tweens={};se.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()};var n=new kt(t);n.play()};const yu={BackEaseIn(t,e,n,r){var i=1.70158;return n*(t/=r)*t*((i+1)*t-i)+e},BackEaseOut(t,e,n,r){var i=1.70158;return n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},BackEaseInOut(t,e,n,r){var i=1.70158;return(t/=r/2)<1?n/2*(t*t*(((i*=1.525)+1)*t-i))+e:n/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+e},ElasticEaseIn(t,e,n,r,i,a){var s=0;return t===0?e:(t/=r)===1?e+n:(a||(a=r*.3),!i||i0?e:n),h=s*n,p=u*(u>0?e:n),g=c*(c>0?n:e);return{x:f,y:r?-1*g:p,width:h-f,height:g-p}}}Hi.prototype._centroid=!0;Hi.prototype.className="Arc";Hi.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(Hi);A.addGetterSetter(Hi,"innerRadius",0,le());A.addGetterSetter(Hi,"outerRadius",0,le());A.addGetterSetter(Hi,"angle",0,le());A.addGetterSetter(Hi,"clockwise",!1,jr());function iy(t,e,n,r,i,a,s){var u=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),c=Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2)),f=s*u/(u+c),h=s*c/(u+c),p=n-f*(i-t),g=r-f*(a-e),y=n+h*(i-t),v=r+h*(a-e);return[p,g,y,v]}function Mb(t,e){var n=t.length,r=[],i,a;for(i=2;i4){for(u=this.getTensionPoints(),c=u.length,f=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);fh?f:h,x=f>h?1:f/h,_=f>h?h/f:1;e.translate(u,c),e.rotate(y),e.scale(x,_),e.arc(0,0,w,p,p+g,1-v),e.scale(1/x,1/_),e.rotate(-y),e.translate(-u,-c);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(f){if(f.command==="A"){var h=f.points[4],p=f.points[5],g=f.points[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;v-=y){const w=tt.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],v,0);e.push(w.x,w.y)}else for(let v=h+y;vthis.dataArray[r].pathLength;)e-=this.dataArray[r].pathLength,++r;if(r===i)return n=this.dataArray[r-1].points.slice(-2),{x:n[0],y:n[1]};if(e<.01)return n=this.dataArray[r].points.slice(0,2),{x:n[0],y:n[1]};var a=this.dataArray[r],s=a.points;switch(a.command){case"L":return tt.getPointOnLine(e,a.start.x,a.start.y,s[0],s[1]);case"C":return tt.getPointOnCubicBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return tt.getPointOnQuadraticBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var u=s[0],c=s[1],f=s[2],h=s[3],p=s[4],g=s[5],y=s[6];return p+=g*e/a.pathLength,tt.getPointOnEllipticalArc(u,c,f,h,p,y)}return null}static getLineLength(e,n,r,i){return Math.sqrt((r-e)*(r-e)+(i-n)*(i-n))}static getPointOnLine(e,n,r,i,a,s,u){s===void 0&&(s=n),u===void 0&&(u=r);var c=(a-r)/(i-n+1e-8),f=Math.sqrt(e*e/(1+c*c));i0&&!isNaN(v[0]);){var S=null,C=[],O=c,I=f,L,D,U,X,K,te,ce,j,T,$;switch(y){case"l":c+=v.shift(),f+=v.shift(),S="L",C.push(c,f);break;case"L":c=v.shift(),f=v.shift(),C.push(c,f);break;case"m":var V=v.shift(),ie=v.shift();if(c+=V,f+=ie,S="M",s.length>2&&s[s.length-1].command==="z"){for(var W=s.length-2;W>=0;W--)if(s[W].command==="M"){c=s[W].points[0]+V,f=s[W].points[1]+ie;break}}C.push(c,f),y="l";break;case"M":c=v.shift(),f=v.shift(),S="M",C.push(c,f),y="L";break;case"h":c+=v.shift(),S="L",C.push(c,f);break;case"H":c=v.shift(),S="L",C.push(c,f);break;case"v":f+=v.shift(),S="L",C.push(c,f);break;case"V":f=v.shift(),S="L",C.push(c,f);break;case"C":C.push(v.shift(),v.shift(),v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"c":C.push(c+v.shift(),f+v.shift(),c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"S":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,v.shift(),v.shift()),c=v.shift(),f=v.shift(),S="C",C.push(c,f);break;case"s":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"Q":C.push(v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"q":C.push(c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="Q",C.push(c,f);break;case"T":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c=v.shift(),f=v.shift(),S="Q",C.push(D,U,c,f);break;case"t":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c+=v.shift(),f+=v.shift(),S="Q",C.push(D,U,c,f);break;case"A":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c=v.shift(),f=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break;case"a":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c+=v.shift(),f+=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break}s.push({command:S||y,points:C,start:{x:O,y:I},pathLength:this.calcLength(O,I,S||y,C)})}(y==="z"||y==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,i){var a,s,u,c,f=tt;switch(r){case"L":return f.getLineLength(e,n,i[0],i[1]);case"C":for(a=0,s=f.getPointOnCubicBezier(0,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),c=.01;c<=1;c+=.01)u=f.getPointOnCubicBezier(c,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"Q":for(a=0,s=f.getPointOnQuadraticBezier(0,e,n,i[0],i[1],i[2],i[3]),c=.01;c<=1;c+=.01)u=f.getPointOnQuadraticBezier(c,e,n,i[0],i[1],i[2],i[3]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"A":a=0;var h=i[4],p=i[5],g=i[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;c-=y)u=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;else for(c=h+y;c1&&(u*=Math.sqrt(y),c*=Math.sqrt(y));var v=Math.sqrt((u*u*(c*c)-u*u*(g*g)-c*c*(p*p))/(u*u*(g*g)+c*c*(p*p)));a===s&&(v*=-1),isNaN(v)&&(v=0);var w=v*u*g/c,x=v*-c*p/u,_=(e+r)/2+Math.cos(h)*w-Math.sin(h)*x,S=(n+i)/2+Math.sin(h)*w+Math.cos(h)*x,C=function(K){return Math.sqrt(K[0]*K[0]+K[1]*K[1])},O=function(K,te){return(K[0]*te[0]+K[1]*te[1])/(C(K)*C(te))},I=function(K,te){return(K[0]*te[1]=1&&(X=0),s===0&&X>0&&(X=X-2*Math.PI),s===1&&X<0&&(X=X+2*Math.PI),[_,S,u,c,L,X,h,s]}}tt.prototype.className="Path";tt.prototype._attrsAffectingSize=["data"];yt(tt);A.addGetterSetter(tt,"data");class So extends Vi{_sceneFunc(e){super._sceneFunc(e);var n=Math.PI*2,r=this.points(),i=r,a=this.tension()!==0&&r.length>4;a&&(i=this.getTensionPoints());var s=this.pointerLength(),u=r.length,c,f;if(a){const g=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[u-2],r[u-1]],y=tt.calcLength(i[i.length-4],i[i.length-3],"C",g),v=tt.getPointOnQuadraticBezier(Math.min(1,1-s/y),g[0],g[1],g[2],g[3],g[4],g[5]);c=r[u-2]-v.x,f=r[u-1]-v.y}else c=r[u-2]-r[u-4],f=r[u-1]-r[u-3];var h=(Math.atan2(f,c)+n)%n,p=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),a?(c=(i[0]+i[2])/2-r[0],f=(i[1]+i[3])/2-r[1]):(c=r[2]-r[0],f=r[3]-r[1]),e.rotate((Math.atan2(-f,-c)+n)%n),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var 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-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}}So.prototype.className="Arrow";yt(So);A.addGetterSetter(So,"pointerLength",10,le());A.addGetterSetter(So,"pointerWidth",10,le());A.addGetterSetter(So,"pointerAtBeginning",!1);A.addGetterSetter(So,"pointerAtEnding",!0);class Ks extends re{_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)}}Ks.prototype._centroid=!0;Ks.prototype.className="Circle";Ks.prototype._attrsAffectingSize=["radius"];yt(Ks);A.addGetterSetter(Ks,"radius",0,le());class Na extends re{_sceneFunc(e){var 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)}}Na.prototype.className="Ellipse";Na.prototype._centroid=!0;Na.prototype._attrsAffectingSize=["radiusX","radiusY"];yt(Na);A.addComponentsGetterSetter(Na,"radius",["x","y"]);A.addGetterSetter(Na,"radiusX",0,le());A.addGetterSetter(Na,"radiusY",0,le());let hi=class oP extends re{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),a=this.attrs.image;let s;if(a){const u=this.attrs.cropWidth,c=this.attrs.cropHeight;u&&c?s=[a,this.cropX(),this.cropY(),u,c,0,0,n,r]:s=[a,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),a&&(i&&e.clip(),e.drawImage.apply(e,s))}_hitFunc(e){var n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?G.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){var i=G.createImageElement();i.onload=function(){var a=new oP({image:i});n(a)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}};hi.prototype.className="Image";yt(hi);A.addGetterSetter(hi,"cornerRadius",0,A0(4));A.addGetterSetter(hi,"image");A.addComponentsGetterSetter(hi,"crop",["x","y","width","height"]);A.addGetterSetter(hi,"cropX",0,le());A.addGetterSetter(hi,"cropY",0,le());A.addGetterSetter(hi,"cropWidth",0,le());A.addGetterSetter(hi,"cropHeight",0,le());var sP=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],v$="Change.konva",y$="none",ay="up",oy="right",sy="down",ly="left",S$=sP.length;class N0 extends zs{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){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),a=Math.max(a,s.y)}),{x:n,y:i,width:r-n,height:a-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}wo.prototype.className="RegularPolygon";wo.prototype._centroid=!0;wo.prototype._attrsAffectingSize=["radius"];yt(wo);A.addGetterSetter(wo,"radius",0,le());A.addGetterSetter(wo,"sides",0,le());var Db=Math.PI*2;class bo extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Db,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Db,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)}}bo.prototype.className="Ring";bo.prototype._centroid=!0;bo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(bo);A.addGetterSetter(bo,"innerRadius",0,le());A.addGetterSetter(bo,"outerRadius",0,le());class pi extends re{constructor(e){super(e),this._updated=!0,this.anim=new dr(()=>{var 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){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+0],c=a[i+1],f=a[i+2],h=a[i+3],p=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,f,h),e.closePath(),e.fillStrokeShape(this)),p)if(s){var g=s[n],y=r*2;e.drawImage(p,u,c,f,h,g[y+0],g[y+1],f,h)}else e.drawImage(p,u,c,f,h,0,0,f,h)}_hitFunc(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+2],c=a[i+3];if(e.beginPath(),s){var f=s[n],h=r*2;e.rect(f[h+0],f[h+1],u,c)}else e.rect(0,0,u,c);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var 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(){var e=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],a=i.length/4;e{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}var jf;function Lm(){return jf||(jf=G.createCanvasElement().getContext(b$),jf)}function L$(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function M$(t){t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function D$(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let vt=class extends re{constructor(e){super(D$(e)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(_+=s)}}}_hitFunc(e){var n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){var n=G._isString(e)?e:e==null?"":e+"";return this._setAttr(C$,n),this}getWidth(){var e=this.attrs.width===as||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===as||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return G.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=Lm(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(e),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Uf+this.fontVariant()+Uf+(this.fontSize()+E$)+I$(this.fontFamily())}_addTextLine(e){this.align()===Wl&&(e=e.trim());var r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){var n=this.letterSpacing(),r=e.length;return Lm().measureText(e).width+(r?n*(r-1):0)}_setTextData(){var e=this.text().split(` `),n=+this.fontSize(),r=0,i=this.lineHeight()*n,a=this.attrs.width,s=this.attrs.height,u=a!==as&&a!==void 0,c=s!==as&&s!==void 0,f=this.padding(),h=a-f*2,p=s-f*2,g=0,y=this.wrap(),v=y!==Fb,w=y!==R$&&v,x=this.ellipsis();this.textArr=[],Lm().font=this._getContextFont();for(var _=x?this._getTextWidth(Im):0,S=0,C=e.length;Sh)for(;O.length>0;){for(var L=0,D=O.length,U="",X=0;L>>1,te=O.slice(0,K+1),ce=this._getTextWidth(te)+_;ce<=h?(L=K+1,U=te,X=ce):D=K}if(U){if(w){var j,T=O[U.length],$=T===Uf||T===Nb;$&&X<=h?j=U.length:j=Math.max(U.lastIndexOf(Uf),U.lastIndexOf(Nb))+1,j>0&&(L=j,U=U.slice(0,L),X=this._getTextWidth(U))}U=U.trimRight(),this._addTextLine(U),r=Math.max(r,X),g+=i;var V=this._shouldHandleEllipsis(g);if(V){this._tryToAddEllipsisToLastLine();break}if(O=O.slice(L),O=O.trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=h)){this._addTextLine(O),g+=i,r=Math.max(r,I);break}}else break}else this._addTextLine(O),g+=i,r=Math.max(r,I),this._shouldHandleEllipsis(g)&&Sp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,a=i!==as&&i!==void 0,s=this.padding(),u=i-s*2,c=this.wrap(),f=c!==Fb;return!f||a&&e+r>u}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,n=e!==as&&e!==void 0,r=this.padding(),i=e-r*2,a=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!a)){if(n){var u=this._getTextWidth(s.text+Im)=1){var r=n[0].p0;e.moveTo(r.x,r.y)}for(var i=0;i0&&(u+=e.dataArray[c].pathLength);var f=0;i==="center"&&(f=Math.max(0,u/2-s/2)),i==="right"&&(f=Math.max(0,u-s));for(var h=lP(this.text()),p=this.text().split(" ").length-1,g,y,v,w=-1,x=0,_=function(){x=0;for(var ce=e.dataArray,j=w+1;j0)return w=j,ce[j];ce[j].command==="M"&&(g={x:ce[j].points[0],y:ce[j].points[1]})}return{}},S=function(ce){var j=e._getTextSize(ce).width+r;ce===" "&&i==="justify"&&(j+=(u-s)/p);var T=0,$=0;for(y=void 0;Math.abs(j-T)/j>.01&&$<20;){$++;for(var V=T;v===void 0;)v=_(),v&&V+v.pathLengthj?y=tt.getPointOnLine(j,g.x,g.y,v.points[0],v.points[1],g.x,g.y):v=void 0;break;case"A":var W=v.points[4],Y=v.points[5],Q=v.points[4]+Y;x===0?x=W+1e-8:j>T?x+=Math.PI/180*Y/Math.abs(Y):x-=Math.PI/360*Y/Math.abs(Y),(Y<0&&x=0&&x>Q)&&(x=Q,ie=!0),y=tt.getPointOnEllipticalArc(v.points[0],v.points[1],v.points[2],v.points[3],x,v.points[6]);break;case"C":x===0?j>v.pathLength?x=1e-8:x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength/2:x=Math.max(x-(T-j)/v.pathLength/2,0),x>1&&(x=1,ie=!0),y=tt.getPointOnCubicBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3],v.points[4],v.points[5]);break;case"Q":x===0?x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength:x-=(T-j)/v.pathLength,x>1&&(x=1,ie=!0),y=tt.getPointOnQuadraticBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3]);break}y!==void 0&&(T=tt.getLineLength(g.x,g.y,y.x,y.y)),ie&&(ie=!1,v=void 0)}},C="C",O=e._getTextSize(C).width+r,I=f/O-1,L=0;Lt+`.${gP}`).join(" "),$b="nodesRect",F$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],$$={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const z$="ontouchstart"in pe._global;function G$(t,e){if(t==="rotater")return"crosshair";e+=G.degToRad($$[t]||0);var n=(G.radToDeg(e)%360+360)%360;return G._inRange(n,315+22.5,360)||G._inRange(n,0,22.5)?"ns-resize":G._inRange(n,45-22.5,45+22.5)?"nesw-resize":G._inRange(n,90-22.5,90+22.5)?"ew-resize":G._inRange(n,135-22.5,135+22.5)?"nwse-resize":G._inRange(n,180-22.5,180+22.5)?"ns-resize":G._inRange(n,225-22.5,225+22.5)?"nesw-resize":G._inRange(n,270-22.5,270+22.5)?"ew-resize":G._inRange(n,315-22.5,315+22.5)?"nwse-resize":(G.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var sh=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],zb=1e8;function U$(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 mP(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 Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:r,y:i})}function j$(t,e){const n=U$(t);return mP(t,e,n)}function W$(t,e,n){let r=e;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");r.on(a,i),r.on(F$.map(s=>s+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&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(),a=i.x-n.x,s=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const c=u.getAbsolutePosition();u.setAbsolutePosition({x:c.x+a,y:c.y+s}),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($b),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache($b,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){var i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(r),s=e.getAbsolutePosition(r),u=i.x*a.x-e.offsetX()*a.x,c=i.y*a.y-e.offsetY()*a.y;const f=(pe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:s.x+u*Math.cos(f)+c*Math.sin(-f),y:s.y+c*Math.cos(f)+u*Math.sin(f),width:i.width*a.x,height:i.height*a.y,rotation:f};return mP(h,-pe.getAngle(n),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-zb,y:-zb,width:0,height:0,rotation:0};const n=[];this.nodes().map(f=>{const h=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var p=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],g=f.getAbsoluteTransform();p.forEach(function(y){var v=g.point(y);n.push(v)})});const r=new Wn;r.rotate(-pe.getAngle(this.rotation()));var i,a,s,u;n.forEach(function(f){var h=r.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),r.invert();const c=r.point({x:i,y:a});return{x:c.x,y:c.y,width:s-i,height:u-a,rotation:pe.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(),sh.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var n=new Zu({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:z$?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",()=>{var i=pe.getAngle(this.rotation()),a=G$(e,i);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var e=new re({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*G._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var 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){this._movingAnchorName=e.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,a=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(r/a),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;var s=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-s.x,y:u.y-s.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(c=>{c._fire("transformstart",{evt:e.evt,target:c})})}_handleMouseMove(e){var n,r,i,a=this.findOne("."+this._movingAnchorName),s=a.getStage();s.setPointersPositions(e);const u=s.getPointerPosition();let c={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const f=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(f,c,e)),a.setAbsolutePosition(c);const h=a.getAbsolutePosition();if(!(f.x===h.x&&f.y===h.y)){if(this._movingAnchorName==="rotater"){var p=this._getNodeRect();n=a.x()-p.width/2,r=-a.y()+p.height/2;let ce=Math.atan2(-r,n)+Math.PI/2;p.height<0&&(ce-=Math.PI);var g=pe.getAngle(this.rotation());const j=g+ce,T=pe.getAngle(this.rotationSnapTolerance()),V=W$(this.rotationSnaps(),j,T)-p.rotation,ie=j$(p,V);this._fitNodesInto(ie,e);return}var y=this.keepRatio()||e.shiftKey,S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-left").x()>v.x?-1:1,x=this.findOne(".top-left").y()>v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-left").x(v.x-n),this.findOne(".top-left").y(v.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){var v=S?{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(a.x()-v.x,2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-right").x()v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-right").x(v.x+n),this.findOne(".top-right").y(v.y-r)}var _=a.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(a.y()-v.y,2));var w=v.x{r._fire("transformend",{evt:e,target:r})}),this._movingAnchorName=null}}_fitNodesInto(e,n){var r=this._getNodeRect();const i=1;if(G._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(G._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=this.flipEnabled();var s=new Wn;if(s.rotate(pe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=s.point({x:-this.padding()*2,y:0});if(e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,!a){this.update();return}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2,!a){this.update();return}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=s.point({x:0,y:-this.padding()*2});if(e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,e);p?e=p:G.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const u=1e7,c=new Wn;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/u,r.height/u);const f=new Wn;f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(e.width/u,e.height/u);const h=f.multiply(c.invert());this._nodes.forEach(p=>{var g;const y=p.getParent().getAbsoluteTransform(),v=p.getTransform().copy();v.translate(p.offsetX(),p.offsetY());const w=new Wn;w.multiply(y.copy().invert()).multiply(h).multiply(y).multiply(v);const x=w.decompose();p.setAttrs(x),this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p}),(g=p.getLayer())===null||g===void 0||g.batchDraw()}),this.rotation(G._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e,n=this._getNodeRect();this.rotation(G._getRotation(n.rotation));var r=n.width,i=n.height,a=this.enabledAnchors(),s=this.resizeEnabled(),u=this.padding(),c=this.anchorSize();this.find("._anchor").forEach(f=>{f.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+u,offsetY:c/2+u,visible:s&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:c/2+u,visible:s&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:c/2-u,offsetY:c/2+u,visible:s&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:c/2+u,visible:s&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:c/2-u,visible:s&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:c/2+u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:c/2-u,visible:s&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:c/2-u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*G._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}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),zs.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return se.prototype.toObject.call(this)}clone(e){var n=se.prototype.clone.call(this,e);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function H$(t){return t instanceof Array||G.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sh.indexOf(e)===-1&&G.warn("Unknown anchor name: "+e+". Available names are: "+sh.join(", "))}),t||[]}Ke.prototype.className="Transformer";yt(Ke);A.addGetterSetter(Ke,"enabledAnchors",sh,H$);A.addGetterSetter(Ke,"flipEnabled",!0,jr());A.addGetterSetter(Ke,"resizeEnabled",!0);A.addGetterSetter(Ke,"anchorSize",10,le());A.addGetterSetter(Ke,"rotateEnabled",!0);A.addGetterSetter(Ke,"rotationSnaps",[]);A.addGetterSetter(Ke,"rotateAnchorOffset",50,le());A.addGetterSetter(Ke,"rotationSnapTolerance",5,le());A.addGetterSetter(Ke,"borderEnabled",!0);A.addGetterSetter(Ke,"anchorStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"anchorStrokeWidth",1,le());A.addGetterSetter(Ke,"anchorFill","white");A.addGetterSetter(Ke,"anchorCornerRadius",0,le());A.addGetterSetter(Ke,"borderStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"borderStrokeWidth",1,le());A.addGetterSetter(Ke,"borderDash");A.addGetterSetter(Ke,"keepRatio",!0);A.addGetterSetter(Ke,"centeredScaling",!1);A.addGetterSetter(Ke,"ignoreStroke",!1);A.addGetterSetter(Ke,"padding",0,le());A.addGetterSetter(Ke,"node");A.addGetterSetter(Ke,"nodes");A.addGetterSetter(Ke,"boundBoxFunc");A.addGetterSetter(Ke,"anchorDragBoundFunc");A.addGetterSetter(Ke,"shouldOverdrawWholeArea",!1);A.addGetterSetter(Ke,"useSingleNodeRotation",!0);A.backCompat(Ke,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class qi extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,pe.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)}}qi.prototype.className="Wedge";qi.prototype._centroid=!0;qi.prototype._attrsAffectingSize=["radius"];yt(qi);A.addGetterSetter(qi,"radius",0,le());A.addGetterSetter(qi,"angle",0,le());A.addGetterSetter(qi,"clockwise",!1);A.backCompat(qi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Gb(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var V$=[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],q$=[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 K$(t,e){var n=t.data,r=t.width,i=t.height,a,s,u,c,f,h,p,g,y,v,w,x,_,S,C,O,I,L,D,U,X,K,te,ce,j=e+e+1,T=r-1,$=i-1,V=e+1,ie=V*(V+1)/2,W=new Gb,Y=null,Q=W,oe=null,ve=null,we=V$[e],Ue=q$[e];for(u=1;u>Ue,te!==0?(te=255/te,n[h]=(g*we>>Ue)*te,n[h+1]=(y*we>>Ue)*te,n[h+2]=(v*we>>Ue)*te):n[h]=n[h+1]=n[h+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=p+((c=a+e+1)>Ue,te>0?(te=255/te,n[c]=(g*we>>Ue)*te,n[c+1]=(y*we>>Ue)*te,n[c+2]=(v*we>>Ue)*te):n[c]=n[c+1]=n[c+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=a+((c=s+V)<$?c:$)*r<<2,g+=O+=oe.r=n[c],y+=I+=oe.g=n[c+1],v+=L+=oe.b=n[c+2],w+=D+=oe.a=n[c+3],oe=oe.next,x+=U=ve.r,_+=X=ve.g,S+=K=ve.b,C+=te=ve.a,O-=U,I-=X,L-=K,D-=te,ve=ve.next,h+=r}}const Y$=function(e){var n=Math.round(this.blurRadius());n>0&&K$(e,n)};A.addGetterSetter(se,"blurRadius",0,le(),A.afterSetFilter);const X$=function(t){var e=this.brightness()*255,n=t.data,r=n.length,i;for(i=0;i255?255:i,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,n[u]=i,n[u+1]=a,n[u+2]=s};A.addGetterSetter(se,"contrast",0,le(),A.afterSetFilter);const J$=function(t){var e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),a=0,s=0,u=t.data,c=t.width,f=t.height,h=c*4,p=f;switch(r){case"top-left":a=-1,s=-1;break;case"top":a=-1,s=0;break;case"top-right":a=-1,s=1;break;case"right":a=0,s=1;break;case"bottom-right":a=1,s=1;break;case"bottom":a=1,s=0;break;case"bottom-left":a=1,s=-1;break;case"left":a=0,s=-1;break;default:G.error("Unknown emboss direction: "+r)}do{var g=(p-1)*h,y=a;p+y<1&&(y=0),p+y>f&&(y=0);var v=(p-1+y)*c*4,w=c;do{var x=g+(w-1)*4,_=s;w+_<1&&(_=0),w+_>c&&(_=0);var S=v+(w-1+_)*4,C=u[x]-u[S],O=u[x+1]-u[S+1],I=u[x+2]-u[S+2],L=C,D=L>0?L:-L,U=O>0?O:-O,X=I>0?I:-I;if(U>D&&(L=O),X>D&&(L=I),L*=e,i){var K=u[x]+L,te=u[x+1]+L,ce=u[x+2]+L;u[x]=K>255?255:K<0?0:K,u[x+1]=te>255?255:te<0?0:te,u[x+2]=ce>255?255:ce<0?0:ce}else{var j=n-L;j<0?j=0:j>255&&(j=255),u[x]=u[x+1]=u[x+2]=j}}while(--w)}while(--p)};A.addGetterSetter(se,"embossStrength",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossWhiteLevel",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossDirection","top-left",null,A.afterSetFilter);A.addGetterSetter(se,"embossBlend",!1,null,A.afterSetFilter);function Mm(t,e,n,r,i){var a=n-e,s=i-r,u;return a===0?r+s/2:s===0?r:(u=(t-e)/a,u=s*u+r,u)}const Z$=function(t){var e=t.data,n=e.length,r=e[0],i=r,a,s=e[1],u=s,c,f=e[2],h=f,p,g,y=this.enhance();if(y!==0){for(g=0;gi&&(i=a),c=e[g+1],cu&&(u=c),p=e[g+2],ph&&(h=p);i===r&&(i=255,r=0),u===s&&(u=255,s=0),h===f&&(h=255,f=0);var v,w,x,_,S,C,O,I,L;for(y>0?(w=i+y*(255-i),x=r-y*(r-0),S=u+y*(255-u),C=s-y*(s-0),I=h+y*(255-h),L=f-y*(f-0)):(v=(i+r)*.5,w=i+y*(i-v),x=r+y*(r-v),_=(u+s)*.5,S=u+y*(u-_),C=s+y*(s-_),O=(h+f)*.5,I=h+y*(h-O),L=f+y*(f-O)),g=0;g_?x:_;var S=s,C=a,O,I,L=360/C*Math.PI/180,D,U;for(I=0;IC?S:C;var O=s,I=a,L,D,U=n.polarRotation||0,X,K;for(h=0;he&&(O=C,I=0,L=-1),i=0;i=0&&y=0&&v=0&&y=0&&v=255*4?255:0}return s}function dz(t,e,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),s=[],u=0;u=0&&y=0&&v=n))for(a=w;a=r||(s=(n*a+i)*4,u+=O[s+0],c+=O[s+1],f+=O[s+2],h+=O[s+3],C+=1);for(u=u/C,c=c/C,f=f/C,h=h/C,i=y;i=n))for(a=w;a=r||(s=(n*a+i)*4,O[s+0]=u,O[s+1]=c,O[s+2]=f,O[s+3]=h)}};A.addGetterSetter(se,"pixelSize",8,le(),A.afterSetFilter);const mz=function(t){var e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e,a;for(a=0;a255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,$k,A.afterSetFilter);const yz=function(t){var e=t.data,n=e.length,r=this.red(),i=this.green(),a=this.blue(),s=this.alpha(),u,c;for(u=0;u255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,$k,A.afterSetFilter);A.addGetterSetter(se,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const Sz=function(t){var e=t.data,n=e.length,r,i,a,s;for(r=0;r127&&(f=255-f),h>127&&(h=255-h),p>127&&(p=255-p),e[c]=f,e[c+1]=h,e[c+2]=p}while(--u)}while(--a)},wz=function(t){var e=this.threshold()*255,n=t.data,r=n.length,i;for(i=0;i{const{width:n,height:r}=e,i=document.createElement("div"),a=new Vl.Stage({container:i,width:n,height:r}),s=new Vl.Layer,u=new Vl.Layer;s.add(new Vl.Rect({...e,fill:"white"})),t.forEach(f=>u.add(new Vl.Line({points:f.points,stroke:"black",strokeWidth:f.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:f.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(u);const c=a.toDataURL({...e});return i.remove(),c};let vP=null,yP=null;const $W=t=>{vP=t},Cz=()=>vP,zW=t=>{yP=t},GW=()=>yP,xz=t=>{const e=window.open("");e&&t.forEach(n=>{const r=new Image;r.src=n.base64,e.document.write(n.caption),e.document.write("
"),e.document.write(r.outerHTML),e.document.write("

")})},kz=(t,e)=>Math.floor(Math.random()*(e-t+1)+t),Pz=t=>{const e=Cz(),{generationMode:n,generationState:r,postprocessingState:i,canvasState:a,systemState:s}=t,{codeformerFidelity:u,facetoolStrength:c,facetoolType:f,hiresFix:h,hiresStrength:p,shouldRunESRGAN:g,shouldRunFacetool:y,upscalingLevel:v,upscalingStrength:w,upscalingDenoising:x}=i,{cfgScale:_,height:S,img2imgStrength:C,infillMethod:O,initialImage:I,iterations:L,perlin:D,prompt:U,negativePrompt:X,sampler:K,seamBlur:te,seamless:ce,seamSize:j,seamSteps:T,seamStrength:$,seed:V,seedWeights:ie,shouldFitToWidthHeight:W,shouldGenerateVariations:Y,shouldRandomizeSeed:Q,steps:oe,threshold:ve,tileSize:we,variationAmount:Ue,width:At,shouldUseSymmetry:me,horizontalSymmetrySteps:qt,verticalSymmetrySteps:Bt}=r,{shouldDisplayInProgressType:bn,saveIntermediatesInterval:wr,enableImageDebugging:Ft}=s,xe={prompt:U,iterations:L,steps:oe,cfg_scale:_,threshold:ve,perlin:D,height:S,width:At,sampler_name:K,seed:V,progress_images:bn==="full-res",progress_latents:bn==="latents",save_intermediates:wr,generation_mode:n,init_mask:""};let Wr=!1,Et=!1;if(X!==""&&(xe.prompt=`${U} [${X}]`),xe.seed=Q?kz(cF,fF):V,me&&(qt>0&&(xe.h_symmetry_time_pct=Math.max(0,Math.min(1,qt/oe))),Bt>0&&(xe.v_symmetry_time_pct=Math.max(0,Math.min(1,Bt/oe)))),n==="txt2img"&&(xe.hires_fix=h,h&&(xe.strength=p)),["txt2img","img2img"].includes(n)&&(xe.seamless=ce,g&&(Wr={level:v,denoise_str:x,strength:w}),y&&(Et={type:f,strength:c},f==="codeformer"&&(Et.codeformer_fidelity=u))),n==="img2img"&&I&&(xe.init_img=typeof I=="string"?I:I.url,xe.strength=C,xe.fit=W),n==="unifiedCanvas"&&e){const{layerState:{objects:gi},boundingBoxCoordinates:Xs,boundingBoxDimensions:Mn,stageScale:Fa,isMaskEnabled:Qs,shouldPreserveMaskedArea:er,boundingBoxScaleMethod:Kt,scaledBoundingBoxDimensions:Dn}=a,bt={...Xs,...Mn},$a=bz(Qs?gi.filter(Qx):[],bt);xe.init_mask=$a,xe.fit=!1,xe.strength=C,xe.invert_mask=er,xe.bounding_box=bt;const Hr=e.scale();e.scale({x:1/Fa,y:1/Fa});const Co=e.getAbsolutePosition(),Vr=e.toDataURL({x:bt.x+Co.x,y:bt.y+Co.y,width:bt.width,height:bt.height});Ft&&xz([{base64:$a,caption:"mask sent as init_mask"},{base64:Vr,caption:"image sent as init_img"}]),e.scale(Hr),xe.init_img=Vr,xe.progress_images=!1,Kt!=="none"&&(xe.inpaint_width=Dn.width,xe.inpaint_height=Dn.height),xe.seam_size=j,xe.seam_blur=te,xe.seam_strength=$,xe.seam_steps=T,xe.tile_size=we,xe.infill_method=O,xe.force_outpaint=!1}return Y?(xe.variation_amount=Ue,ie&&(xe.with_variations=A5(ie))):xe.variation_amount=0,Ft&&(xe.enable_image_debugging=Ft),{generationParameters:xe,esrganParameters:Wr,facetoolParameters:Et}};var Ez=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Oz=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Tz=/[^-+\dA-Z]/g;function Ut(t,e,n,r){if(arguments.length===1&&typeof t=="string"&&!/\d/.test(t)&&(e=t,t=void 0),t=t||t===0?t:new Date,t instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");e=String(Ub[e]||e||Ub.default);var i=e.slice(0,4);(i==="UTC:"||i==="GMT:")&&(e=e.slice(4),n=!0,i==="GMT:"&&(r=!0));var a=function(){return n?"getUTC":"get"},s=function(){return t[a()+"Date"]()},u=function(){return t[a()+"Day"]()},c=function(){return t[a()+"Month"]()},f=function(){return t[a()+"FullYear"]()},h=function(){return t[a()+"Hours"]()},p=function(){return t[a()+"Minutes"]()},g=function(){return t[a()+"Seconds"]()},y=function(){return t[a()+"Milliseconds"]()},v=function(){return n?0:t.getTimezoneOffset()},w=function(){return Rz(t)},x=function(){return Az(t)},_={d:function(){return s()},dd:function(){return Un(s())},ddd:function(){return En.dayNames[u()]},DDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:En.dayNames[u()],short:!0})},dddd:function(){return En.dayNames[u()+7]},DDDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:En.dayNames[u()+7]})},m:function(){return c()+1},mm:function(){return Un(c()+1)},mmm:function(){return En.monthNames[c()]},mmmm:function(){return En.monthNames[c()+12]},yy:function(){return String(f()).slice(2)},yyyy:function(){return Un(f(),4)},h:function(){return h()%12||12},hh:function(){return Un(h()%12||12)},H:function(){return h()},HH:function(){return Un(h())},M:function(){return p()},MM:function(){return Un(p())},s:function(){return g()},ss:function(){return Un(g())},l:function(){return Un(y(),3)},L:function(){return Un(Math.floor(y()/10))},t:function(){return h()<12?En.timeNames[0]:En.timeNames[1]},tt:function(){return h()<12?En.timeNames[2]:En.timeNames[3]},T:function(){return h()<12?En.timeNames[4]:En.timeNames[5]},TT:function(){return h()<12?En.timeNames[6]:En.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":Iz(t)},o:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60)*100+Math.abs(v())%60,4)},p:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60),2)+":"+Un(Math.floor(Math.abs(v())%60),2)},S:function(){return["th","st","nd","rd"][s()%10>3?0:(s()%100-s()%10!=10)*s()%10]},W:function(){return w()},WW:function(){return Un(w())},N:function(){return x()}};return e.replace(Ez,function(S){return S in _?_[S]():S.slice(1,S.length-1)})}var Ub={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},En={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Un=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(e).padStart(n,"0")},jb=function(e){var n=e.y,r=e.m,i=e.d,a=e._,s=e.dayName,u=e.short,c=u===void 0?!1:u,f=new Date,h=new Date;h.setDate(h[a+"Date"]()-1);var p=new Date;p.setDate(p[a+"Date"]()+1);var g=function(){return f[a+"Date"]()},y=function(){return f[a+"Month"]()},v=function(){return f[a+"FullYear"]()},w=function(){return h[a+"Date"]()},x=function(){return h[a+"Month"]()},_=function(){return h[a+"FullYear"]()},S=function(){return p[a+"Date"]()},C=function(){return p[a+"Month"]()},O=function(){return p[a+"FullYear"]()};return v()===n&&y()===r&&g()===i?c?"Tdy":"Today":_()===n&&x()===r&&w()===i?c?"Ysd":"Yesterday":O()===n&&C()===r&&S()===i?c?"Tmw":"Tomorrow":s},Rz=function(e){var n=new Date(e.getFullYear(),e.getMonth(),e.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var a=(n-r)/(864e5*7);return 1+Math.floor(a)},Az=function(e){var n=e.getDay();return n===0&&(n=7),n},Iz=function(e){return(String(e).match(Oz)||[""]).pop().replace(Tz,"").replace(/GMT\+0000/g,"UTC")};const Lz=(t,e)=>{const{dispatch:n,getState:r}=t;return{emitGenerateImage:i=>{n(ei(!0));const a=r(),{generation:s,postprocessing:u,system:c,canvas:f}=a,h={generationMode:i,generationState:s,postprocessingState:u,canvasState:f,systemState:c};n(mB());const{generationParameters:p,esrganParameters:g,facetoolParameters:y}=Pz(h);e.emit("generateImage",p,g,y),p.init_mask&&(p.init_mask=p.init_mask.substr(0,64).concat("...")),p.init_img&&(p.init_img=p.init_img.substr(0,64).concat("...")),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...p,...g,...y})}`}))},emitRunESRGAN:i=>{n(ei(!0));const{postprocessing:{upscalingLevel:a,upscalingDenoising:s,upscalingStrength:u}}=r(),c={upscale:[a,s,u]};e.emit("runPostprocessing",i,{type:"esrgan",...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...c})}`}))},emitRunFacetool:i=>{n(ei(!0));const{postprocessing:{facetoolType:a,facetoolStrength:s,codeformerFidelity:u}}=r(),c={facetool_strength:s};a==="codeformer"&&(c.codeformer_fidelity=u),e.emit("runPostprocessing",i,{type:a,...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...c})}`}))},emitDeleteImage:i=>{const{url:a,uuid:s,category:u,thumbnail:c}=i;n(ek(i)),e.emit("deleteImage",a,c,s,u)},emitRequestImages:i=>{const a=r().gallery,{earliest_mtime:s}=a.categories[i];e.emit("requestImages",i,s)},emitRequestNewImages:i=>{const a=r().gallery,{latest_mtime:s}=a.categories[i];e.emit("requestLatestImages",i,s)},emitCancelProcessing:()=>{e.emit("cancel")},emitRequestSystemConfig:()=>{e.emit("requestSystemConfig")},emitSearchForModels:i=>{e.emit("searchForModels",i)},emitAddNewModel:i=>{e.emit("addNewModel",i)},emitDeleteModel:i=>{e.emit("deleteModel",i)},emitConvertToDiffusers:i=>{n(pB()),e.emit("convertToDiffusers",i)},emitMergeDiffusersModels:i=>{n(gB()),e.emit("mergeDiffusersModels",i)},emitRequestModelChange:i=>{n(hB()),e.emit("requestModelChange",i)},emitSaveStagingAreaImageToGallery:i=>{e.emit("requestSaveStagingAreaImageToGallery",i)},emitRequestEmptyTempFolder:()=>{e.emit("requestEmptyTempFolder")}}};let Hf;const Mz=new Uint8Array(16);function Dz(){if(!Hf&&(Hf=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hf))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hf(Mz)}const Jt=[];for(let t=0;t<256;++t)Jt.push((t+256).toString(16).slice(1));function Nz(t,e=0){return(Jt[t[e+0]]+Jt[t[e+1]]+Jt[t[e+2]]+Jt[t[e+3]]+"-"+Jt[t[e+4]]+Jt[t[e+5]]+"-"+Jt[t[e+6]]+Jt[t[e+7]]+"-"+Jt[t[e+8]]+Jt[t[e+9]]+"-"+Jt[t[e+10]]+Jt[t[e+11]]+Jt[t[e+12]]+Jt[t[e+13]]+Jt[t[e+14]]+Jt[t[e+15]]).toLowerCase()}const Bz=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Wb={randomUUID:Bz};function Vf(t,e,n){if(Wb.randomUUID&&!e&&!t)return Wb.randomUUID();t=t||{};const r=t.random||(t.rng||Dz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return Nz(r)}const UW=dt("socketio/generateImage"),jW=dt("socketio/runESRGAN"),WW=dt("socketio/runFacetool"),HW=dt("socketio/deleteImage"),Hb=dt("socketio/requestImages"),Vb=dt("socketio/requestNewImages"),VW=dt("socketio/cancelProcessing"),Fz=dt("socketio/requestSystemConfig"),qW=dt("socketio/searchForModels"),KW=dt("socketio/addNewModel"),YW=dt("socketio/deleteModel"),XW=dt("socketio/convertToDiffusers"),QW=dt("socketio/mergeDiffusersModels"),JW=dt("socketio/requestModelChange"),ZW=dt("socketio/saveStagingAreaImageToGallery"),eH=dt("socketio/requestEmptyTempFolder"),$z=t=>{const{dispatch:e,getState:n}=t;return{onConnect:()=>{try{e(ub(!0)),e(ns(Ae.t("common.statusConnected"))),e(Fz());const r=n().gallery;r.categories.result.latest_mtime?e(Vb("result")):e(Hb("result")),r.categories.user.latest_mtime?e(Vb("user")):e(Hb("user"))}catch(r){console.error(r)}},onDisconnect:()=>{try{e(ub(!1)),e(ns(Ae.t("common.statusDisconnected"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const i=n(),{activeTab:a}=i.ui,{shouldLoopback:s}=i.postprocessing,{boundingBox:u,generationMode:c,...f}=r,h={uuid:Vf(),...f};if(["txt2img","img2img"].includes(c)&&e(Of({category:"result",image:{...h,category:"result"}})),c==="unifiedCanvas"&&r.boundingBox){const{boundingBox:p}=r;e(S5({image:{...h,category:"temp"},boundingBox:p})),i.canvas.shouldAutoSave&&e(Of({image:{...h,category:"result"},category:"result"}))}if(s)switch(wk[a]){case"img2img":{e(D5(h));break}}e(Cm()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{e(C5({uuid:Vf(),...r,category:"result"})),r.isBase64||e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{e(Of({category:"result",image:{uuid:Vf(),...r,category:"result"}})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{e(ei(!0)),e(cB(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:a}=r;try{e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),e(cb()),e(Cm())}catch(s){console.error(s)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:a,category:s}=r,u=i.map(c=>({uuid:Vf(),...c}));e(b5({images:u,areMoreImagesAvailable:a,category:s})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{e(dB());const{intermediateImage:r}=n().gallery;r&&(r.isBase64||(e(Of({category:"result",image:r})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`}))),e(Cm())),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;e(ek(r));const{generation:{initialImage:a,maskPath:s}}=n();(a===i||(a==null?void 0:a.url)===i)&&e(L5()),s===i&&e(N5("")),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onSystemConfig:r=>{e(fB(r)),r.infill_methods.includes("patchmatch")||e(M5(r.infill_methods[0]))},onFoundModels:r=>{const{search_folder:i,found_models:a}=r;e(vB(i)),e(yB(a))},onNewModelAdded:r=>{const{new_model_name:i,model_list:a,update:s}=r;e(rs(a)),e(ei(!1)),e(ns(Ae.t("modelManager.modelAdded"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model Added: ${i}`,level:"info"})),e(zl({title:s?`${Ae.t("modelManager.modelUpdated")}: ${i}`:`${Ae.t("modelManager.modelAdded")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:r=>{const{deleted_model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`${Ae.t("modelManager.modelAdded")}: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelEntryDeleted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelConverted:r=>{const{converted_model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelConverted"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model converted: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelConverted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelsMerged:r=>{const{merged_models:i,merged_model_name:a,model_list:s}=r;e(rs(s)),e(ns(Ae.t("common.statusMergedModels"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Models merged: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelsMerged")}: ${a}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelChanged"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Af(!0)),e(cb()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))},onTempFolderEmptied:()=>{e(zl({title:Ae.t("toast.tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}},zz=()=>{const{origin:t}=new URL(window.location.href),e=gd(t,{timeout:6e4,path:`${window.location.pathname}socket.io`});let n=!1;return i=>a=>s=>{const{onConnect:u,onDisconnect:c,onError:f,onPostprocessingResult:h,onGenerationResult:p,onIntermediateResult:g,onProgressUpdate:y,onGalleryImages:v,onProcessingCanceled:w,onImageDeleted:x,onSystemConfig:_,onModelChanged:S,onFoundModels:C,onNewModelAdded:O,onModelDeleted:I,onModelConverted:L,onModelsMerged:D,onModelChangeFailed:U,onTempFolderEmptied:X}=$z(i),{emitGenerateImage:K,emitRunESRGAN:te,emitRunFacetool:ce,emitDeleteImage:j,emitRequestImages:T,emitRequestNewImages:$,emitCancelProcessing:V,emitRequestSystemConfig:ie,emitSearchForModels:W,emitAddNewModel:Y,emitDeleteModel:Q,emitConvertToDiffusers:oe,emitMergeDiffusersModels:ve,emitRequestModelChange:we,emitSaveStagingAreaImageToGallery:Ue,emitRequestEmptyTempFolder:At}=Lz(i,e);switch(n||(e.on("connect",()=>u()),e.on("disconnect",()=>c()),e.on("error",me=>f(me)),e.on("generationResult",me=>p(me)),e.on("postprocessingResult",me=>h(me)),e.on("intermediateResult",me=>g(me)),e.on("progressUpdate",me=>y(me)),e.on("galleryImages",me=>v(me)),e.on("processingCanceled",()=>{w()}),e.on("imageDeleted",me=>{x(me)}),e.on("systemConfig",me=>{_(me)}),e.on("foundModels",me=>{C(me)}),e.on("newModelAdded",me=>{O(me)}),e.on("modelDeleted",me=>{I(me)}),e.on("modelConverted",me=>{L(me)}),e.on("modelsMerged",me=>{D(me)}),e.on("modelChanged",me=>{S(me)}),e.on("modelChangeFailed",me=>{U(me)}),e.on("tempFolderEmptied",()=>{X()}),n=!0),s.type){case"socketio/generateImage":{K(s.payload);break}case"socketio/runESRGAN":{te(s.payload);break}case"socketio/runFacetool":{ce(s.payload);break}case"socketio/deleteImage":{j(s.payload);break}case"socketio/requestImages":{T(s.payload);break}case"socketio/requestNewImages":{$(s.payload);break}case"socketio/cancelProcessing":{V();break}case"socketio/requestSystemConfig":{ie();break}case"socketio/searchForModels":{W(s.payload);break}case"socketio/addNewModel":{Y(s.payload);break}case"socketio/deleteModel":{Q(s.payload);break}case"socketio/convertToDiffusers":{oe(s.payload);break}case"socketio/mergeDiffusersModels":{ve(s.payload);break}case"socketio/requestModelChange":{we(s.payload);break}case"socketio/saveStagingAreaImageToGallery":{Ue(s.payload);break}case"socketio/requestEmptyTempFolder":{At();break}}a(s)}},Gz=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map(t=>`canvas.${t}`),Uz=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel","cancelOptions.cancelAfter"].map(t=>`system.${t}`),jz=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","intermediateImage"].map(t=>`gallery.${t}`),Wz=["isLightboxOpen"].map(t=>`lightbox.${t}`),SP=Fx({generation:B5,postprocessing:$5,gallery:x5,system:SB,canvas:_5,ui:bB,lightbox:E5}),Hz=Yx.getPersistConfig({key:"root",storage:Kx,rootReducer:SP,blacklist:[...Gz,...Uz,...jz,...Wz],debounce:300}),Vz=ZN(Hz,SP),_P=TN({reducer:Vz,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat(zz()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}}),qz=a5(_P);function Kz(t){if(t.sheet)return t.sheet;for(var e=0;e0?en(Ys,--Ln):0,Gs--,Ot===10&&(Gs=1,rp--),Ot}function Kn(){return Ot=Ln2||Wu(Ot)>3?"":" "}function oG(t,e){for(;--e&&Kn()&&!(Ot<48||Ot>102||Ot>57&&Ot<65||Ot>70&&Ot<97););return ec(t,Sd()+(e<6&&ci()==32&&Kn()==32))}function cy(t){for(;Kn();)switch(Ot){case t:return Ln;case 34:case 39:t!==34&&t!==39&&cy(Ot);break;case 40:t===41&&cy(t);break;case 92:Kn();break}return Ln}function sG(t,e){for(;Kn()&&t+Ot!==47+10;)if(t+Ot===42+42&&ci()===47)break;return"/*"+ec(e,Ln-1)+"*"+np(t===47?t:Kn())}function lG(t){for(;!Wu(ci());)Kn();return ec(t,Ln)}function uG(t){return PP(wd("",null,null,null,[""],t=kP(t),0,[0],t))}function wd(t,e,n,r,i,a,s,u,c){for(var f=0,h=0,p=s,g=0,y=0,v=0,w=1,x=1,_=1,S=0,C="",O=i,I=a,L=r,D=C;x;)switch(v=S,S=Kn()){case 40:if(v!=108&&en(D,p-1)==58){uy(D+=qe(_d(S),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:D+=_d(S);break;case 9:case 10:case 13:case 32:D+=aG(v);break;case 92:D+=oG(Sd()-1,7);continue;case 47:switch(ci()){case 42:case 47:qf(cG(sG(Kn(),Sd()),e,n),c);break;default:D+="/"}break;case 123*w:u[f++]=ti(D)*_;case 125*w:case 59:case 0:switch(S){case 0:case 125:x=0;case 59+h:y>0&&ti(D)-p&&qf(y>32?Kb(D+";",r,n,p-1):Kb(qe(D," ","")+";",r,n,p-2),c);break;case 59:D+=";";default:if(qf(L=qb(D,e,n,f,h,i,u,C,O=[],I=[],p),a),S===123)if(h===0)wd(D,e,L,L,O,a,p,u,I);else switch(g===99&&en(D,3)===110?100:g){case 100:case 109:case 115:wd(t,L,L,r&&qf(qb(t,L,L,0,0,i,u,C,i,O=[],p),I),i,I,p,u,r?O:I);break;default:wd(D,L,L,L,[""],I,0,u,I)}}f=h=y=0,w=_=1,C=D="",p=s;break;case 58:p=1+ti(D),y=v;default:if(w<1){if(S==123)--w;else if(S==125&&w++==0&&iG()==125)continue}switch(D+=np(S),S*w){case 38:_=h>0?1:(D+="\f",-1);break;case 44:u[f++]=(ti(D)-1)*_,_=1;break;case 64:ci()===45&&(D+=_d(Kn())),g=ci(),h=p=ti(C=D+=lG(Sd())),S++;break;case 45:v===45&&ti(D)==2&&(w=0)}}return a}function qb(t,e,n,r,i,a,s,u,c,f,h){for(var p=i-1,g=i===0?a:[""],y=$0(g),v=0,w=0,x=0;v0?g[_]+" "+S:qe(S,/&\f/g,g[_])))&&(c[x++]=C);return ip(t,e,n,i===0?B0:u,c,f,h)}function cG(t,e,n){return ip(t,e,n,wP,np(rG()),ju(t,2,-2),0)}function Kb(t,e,n,r){return ip(t,e,n,F0,ju(t,0,r),ju(t,r+1,-1),r)}function Rs(t,e){for(var n="",r=$0(t),i=0;i6)switch(en(t,e+1)){case 109:if(en(t,e+4)!==45)break;case 102:return qe(t,/(.+:)(.+)-([^]+)/,"$1"+He+"$2-$3$1"+lh+(en(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~uy(t,"stretch")?OP(qe(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(en(t,e+1)!==115)break;case 6444:switch(en(t,ti(t)-3-(~uy(t,"!important")&&10))){case 107:return qe(t,":",":"+He)+t;case 101:return qe(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+He+(en(t,14)===45?"inline-":"")+"box$3$1"+He+"$2$3$1"+ln+"$2box$3")+t}break;case 5936:switch(en(t,e+11)){case 114:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return He+t+ln+t+t}return t}var SG=function(e,n,r,i){if(e.length>-1&&!e.return)switch(e.type){case F0:e.return=OP(e.value,e.length);break;case bP:return Rs([ql(e,{value:qe(e.value,"@","@"+He)})],i);case B0:if(e.length)return nG(e.props,function(a){switch(tG(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Rs([ql(e,{props:[qe(a,/:(read-\w+)/,":"+lh+"$1")]})],i);case"::placeholder":return Rs([ql(e,{props:[qe(a,/:(plac\w+)/,":"+He+"input-$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,":"+lh+"$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,ln+"input-$1")]})],i)}return""})}},_G=[SG],wG=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var x=w.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var i=e.stylisPlugins||_G,a={},s,u=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var x=w.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var kG={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},PG=/[A-Z]|^ms/g,EG=/_EMO_([^_]+?)_([^]*?)_EMO_/g,AP=function(e){return e.charCodeAt(1)===45},Qb=function(e){return e!=null&&typeof e!="boolean"},Dm=EP(function(t){return AP(t)?t:t.replace(PG,"-$&").toLowerCase()}),Jb=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(EG,function(r,i,a){return ni={name:i,styles:a,next:ni},i})}return kG[e]!==1&&!AP(e)&&typeof n=="number"&&n!==0?n+"px":n};function Hu(t,e,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return ni={name:n.name,styles:n.styles,next:ni},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ni={name:r.name,styles:r.styles,next:ni},r=r.next;var i=n.styles+";";return i}return OG(t,e,n)}case"function":{if(t!==void 0){var a=ni,s=n(t);return ni=a,Hu(t,e,s)}break}}if(e==null)return n;var u=e[n];return u!==void 0?u:n}function OG(t,e,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return t}var NP=be.createContext({});NP.displayName="ColorModeContext";function BP(){const t=be.useContext(NP);if(t===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return t}function DG(){const t=BP(),e=DP();return{...t,theme:e}}function NG(t,e,n){var r,i;if(e==null)return e;const a=s=>{var u,c;return(c=(u=t.__breakpoints)==null?void 0:u.asArray)==null?void 0:c[s]};return(i=(r=a(e))!=null?r:a(n))!=null?i:n}function BG(t,e,n){var r,i;if(e==null)return e;const a=s=>{var u,c;return(c=(u=t.__cssMap)==null?void 0:u[s])==null?void 0:c.value};return(i=(r=a(e))!=null?r:a(n))!=null?i:n}function rH(t,e,n){const r=DP();return FG(t,e,n)(r)}function FG(t,e,n){const r=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];return a=>{const s=i.filter(Boolean),u=r.map((c,f)=>{var h,p;if(t==="breakpoints")return NG(a,c,(h=s[f])!=null?h:c);const g=`${t}.${c}`;return BG(a,g,(p=s[f])!=null?p:c)});return Array.isArray(e)?u:u[0]}}var FP=(...t)=>t.filter(Boolean).join(" ");function $G(){return!1}function zr(t){const e=typeof t;return t!=null&&(e==="object"||e==="function")&&!Array.isArray(t)}var iH=t=>{const{condition:e,message:n}=t;e&&$G()&&console.warn(n)};function io(t,...e){return zG(t)?t(...e):t}var zG=t=>typeof t=="function",aH=t=>t?"":void 0,oH=t=>t?!0:void 0;function sH(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function lH(...t){return function(n){t.forEach(r=>{r==null||r(n)})}}var uh={},GG={get exports(){return uh},set exports(t){uh=t}};(function(t,e){var n=200,r="__lodash_hash_undefined__",i=800,a=16,s=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",h="[object Boolean]",p="[object Date]",g="[object Error]",y="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",_="[object Null]",S="[object Object]",C="[object Proxy]",O="[object RegExp]",I="[object Set]",L="[object String]",D="[object Undefined]",U="[object WeakMap]",X="[object ArrayBuffer]",K="[object DataView]",te="[object Float32Array]",ce="[object Float64Array]",j="[object Int8Array]",T="[object Int16Array]",$="[object Int32Array]",V="[object Uint8Array]",ie="[object Uint8ClampedArray]",W="[object Uint16Array]",Y="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,ve=/^(?:0|[1-9]\d*)$/,we={};we[te]=we[ce]=we[j]=we[T]=we[$]=we[V]=we[ie]=we[W]=we[Y]=!0,we[u]=we[c]=we[X]=we[h]=we[K]=we[p]=we[g]=we[y]=we[w]=we[x]=we[S]=we[O]=we[I]=we[L]=we[U]=!1;var Ue=typeof yn=="object"&&yn&&yn.Object===Object&&yn,At=typeof self=="object"&&self&&self.Object===Object&&self,me=Ue||At||Function("return this")(),qt=e&&!e.nodeType&&e,Bt=qt&&!0&&t&&!t.nodeType&&t,bn=Bt&&Bt.exports===qt,wr=bn&&Ue.process,Ft=function(){try{var E=Bt&&Bt.require&&Bt.require("util").types;return E||wr&&wr.binding&&wr.binding("util")}catch{}}(),xe=Ft&&Ft.isTypedArray;function Wr(E,N,H){switch(H.length){case 0:return E.call(N);case 1:return E.call(N,H[0]);case 2:return E.call(N,H[0],H[1]);case 3:return E.call(N,H[0],H[1],H[2])}return E.apply(N,H)}function Et(E,N){for(var H=-1,fe=Array(E);++H-1}function mp(E,N){var H=this.__data__,fe=yi(H,E);return fe<0?(++this.size,H.push([E,N])):H[fe][1]=N,this}xr.prototype.clear=tl,xr.prototype.delete=pp,xr.prototype.get=nl,xr.prototype.has=gp,xr.prototype.set=mp;function Xi(E){var N=-1,H=E==null?0:E.length;for(this.clear();++N1?H[Ie-1]:void 0,Pe=Ie>2?H[2]:void 0;for(Ye=E.length>3&&typeof Ye=="function"?(Ie--,Ye):void 0,Pe&&hc(H[0],H[1],Pe)&&(Ye=Ie<3?void 0:Ye,Ie=1),N=Object(N);++fe-1&&E%1==0&&E0){if(++N>=i)return arguments[0]}else N=0;return E.apply(void 0,arguments)}}function yc(E){if(E!=null){try{return Dn.call(E)}catch{}try{return E+""}catch{}}return""}function Mo(E,N){return E===N||E!==E&&N!==N}var ul=il(function(){return arguments}())?il:function(E){return za(E)&&bt.call(E,"callee")&&!Js.call(E,"callee")},cl=Array.isArray;function Do(E){return E!=null&&_c(E.length)&&!fl(E)}function Dp(E){return za(E)&&Do(E)}var Sc=sp||Fp;function fl(E){if(!kr(E))return!1;var N=To(E);return N==y||N==v||N==f||N==C}function _c(E){return typeof E=="number"&&E>-1&&E%1==0&&E<=s}function kr(E){var N=typeof E;return E!=null&&(N=="object"||N=="function")}function za(E){return E!=null&&typeof E=="object"}function Np(E){if(!za(E)||To(E)!=S)return!1;var N=Eo(E);if(N===null)return!0;var H=bt.call(N,"constructor")&&N.constructor;return typeof H=="function"&&H instanceof H&&Dn.call(H)==Co}var wc=xe?gi(xe):ic;function Bp(E){return uc(E,bc(E))}function bc(E){return Do(E)?Ep(E,!0):Rp(E)}var nt=Ro(function(E,N,H,fe){ac(E,N,H,fe)});function et(E){return function(){return E}}function Cc(E){return E}function Fp(){return!1}t.exports=nt})(GG,uh);const ai=uh;var UG=t=>/!(important)?$/.test(t),t2=t=>typeof t=="string"?t.replace(/!(important)?$/,"").trim():t,jG=(t,e)=>n=>{const r=String(e),i=UG(r),a=t2(r),s=t?`${t}.${a}`:a;let u=zr(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:e;return u=t2(u),i?`${u} !important`:u};function G0(t){const{scale:e,transform:n,compose:r}=t;return(a,s)=>{var u;const c=jG(e,a)(s);let f=(u=n==null?void 0:n(c,s))!=null?u:c;return r&&(f=r(f,s)),f}}var Kf=(...t)=>e=>t.reduce((n,r)=>r(n),e);function Ir(t,e){return n=>{const r={property:n,scale:t};return r.transform=G0({scale:t,transform:e}),r}}var WG=({rtl:t,ltr:e})=>n=>n.direction==="rtl"?t:e;function HG(t){const{property:e,scale:n,transform:r}=t;return{scale:n,property:WG(e),transform:n?G0({scale:n,compose:r}):r}}var $P=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function VG(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...$P].join(" ")}function qG(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...$P].join(" ")}var KG={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},YG={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function XG(t){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":t,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var QG={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},fy={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},JG=new Set(Object.values(fy)),zP=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),ZG=t=>t.trim();function e6(t,e){if(t==null||zP.has(t))return t;const r=/(^[a-z-A-Z]+)\((.*)\)/g.exec(t),i=r==null?void 0:r[1],a=r==null?void 0:r[2];if(!i||!a)return t;const s=i.includes("-gradient")?i:`${i}-gradient`,[u,...c]=a.split(",").map(ZG).filter(Boolean);if((c==null?void 0:c.length)===0)return t;const f=u in fy?fy[u]:u;c.unshift(f);const h=c.map(p=>{if(JG.has(p))return p;const g=p.indexOf(" "),[y,v]=g!==-1?[p.substr(0,g),p.substr(g+1)]:[p],w=GP(v)?v:v&&v.split(" "),x=`colors.${y}`,_=x in e.__cssMap?e.__cssMap[x].varRef:y;return w?[_,...Array.isArray(w)?w:[w]].join(" "):_});return`${s}(${h.join(", ")})`}var GP=t=>typeof t=="string"&&t.includes("(")&&t.includes(")"),t6=(t,e)=>e6(t,e??{});function n6(t){return/^var\(--.+\)$/.test(t)}var r6=t=>{const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}},Jr=t=>e=>`${t}(${e})`,Fe={filter(t){return t!=="auto"?t:KG},backdropFilter(t){return t!=="auto"?t:YG},ring(t){return XG(Fe.px(t))},bgClip(t){return t==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:t}},transform(t){return t==="auto"?VG():t==="auto-gpu"?qG():t},vh(t){return t==="$100vh"?"var(--chakra-vh)":t},px(t){if(t==null)return t;const{unitless:e}=r6(t);return e||typeof t=="number"?`${t}px`:t},fraction(t){return typeof t!="number"||t>1?t:`${t*100}%`},float(t,e){const n={left:"right",right:"left"};return e.direction==="rtl"?n[t]:t},degree(t){if(n6(t)||t==null)return t;const e=typeof t=="string"&&!t.endsWith("deg");return typeof t=="number"||e?`${t}deg`:t},gradient:t6,blur:Jr("blur"),opacity:Jr("opacity"),brightness:Jr("brightness"),contrast:Jr("contrast"),dropShadow:Jr("drop-shadow"),grayscale:Jr("grayscale"),hueRotate:Jr("hue-rotate"),invert:Jr("invert"),saturate:Jr("saturate"),sepia:Jr("sepia"),bgImage(t){return t==null||GP(t)||zP.has(t)?t:`url(${t})`},outline(t){const e=String(t)==="0"||String(t)==="none";return t!==null&&e?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:t}},flexDirection(t){var e;const{space:n,divide:r}=(e=QG[t])!=null?e:{},i={flexDirection:t};return n&&(i[n]=1),r&&(i[r]=1),i}},B={borderWidths:Ir("borderWidths"),borderStyles:Ir("borderStyles"),colors:Ir("colors"),borders:Ir("borders"),radii:Ir("radii",Fe.px),space:Ir("space",Kf(Fe.vh,Fe.px)),spaceT:Ir("space",Kf(Fe.vh,Fe.px)),degreeT(t){return{property:t,transform:Fe.degree}},prop(t,e,n){return{property:t,scale:e,...e&&{transform:G0({scale:e,transform:n})}}},propT(t,e){return{property:t,transform:e}},sizes:Ir("sizes",Kf(Fe.vh,Fe.px)),sizesT:Ir("sizes",Kf(Fe.vh,Fe.fraction)),shadows:Ir("shadows"),logical:HG,blur:Ir("blur",Fe.blur)},bd={background:B.colors("background"),backgroundColor:B.colors("backgroundColor"),backgroundImage:B.propT("backgroundImage",Fe.bgImage),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Fe.bgClip},bgSize:B.prop("backgroundSize"),bgPosition:B.prop("backgroundPosition"),bg:B.colors("background"),bgColor:B.colors("backgroundColor"),bgPos:B.prop("backgroundPosition"),bgRepeat:B.prop("backgroundRepeat"),bgAttachment:B.prop("backgroundAttachment"),bgGradient:B.propT("backgroundImage",Fe.gradient),bgClip:{transform:Fe.bgClip}};Object.assign(bd,{bgImage:bd.backgroundImage,bgImg:bd.backgroundImage});var We={border:B.borders("border"),borderWidth:B.borderWidths("borderWidth"),borderStyle:B.borderStyles("borderStyle"),borderColor:B.colors("borderColor"),borderRadius:B.radii("borderRadius"),borderTop:B.borders("borderTop"),borderBlockStart:B.borders("borderBlockStart"),borderTopLeftRadius:B.radii("borderTopLeftRadius"),borderStartStartRadius:B.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:B.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:B.radii("borderTopRightRadius"),borderStartEndRadius:B.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:B.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:B.borders("borderRight"),borderInlineEnd:B.borders("borderInlineEnd"),borderBottom:B.borders("borderBottom"),borderBlockEnd:B.borders("borderBlockEnd"),borderBottomLeftRadius:B.radii("borderBottomLeftRadius"),borderBottomRightRadius:B.radii("borderBottomRightRadius"),borderLeft:B.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:B.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:B.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:B.borders(["borderLeft","borderRight"]),borderInline:B.borders("borderInline"),borderY:B.borders(["borderTop","borderBottom"]),borderBlock:B.borders("borderBlock"),borderTopWidth:B.borderWidths("borderTopWidth"),borderBlockStartWidth:B.borderWidths("borderBlockStartWidth"),borderTopColor:B.colors("borderTopColor"),borderBlockStartColor:B.colors("borderBlockStartColor"),borderTopStyle:B.borderStyles("borderTopStyle"),borderBlockStartStyle:B.borderStyles("borderBlockStartStyle"),borderBottomWidth:B.borderWidths("borderBottomWidth"),borderBlockEndWidth:B.borderWidths("borderBlockEndWidth"),borderBottomColor:B.colors("borderBottomColor"),borderBlockEndColor:B.colors("borderBlockEndColor"),borderBottomStyle:B.borderStyles("borderBottomStyle"),borderBlockEndStyle:B.borderStyles("borderBlockEndStyle"),borderLeftWidth:B.borderWidths("borderLeftWidth"),borderInlineStartWidth:B.borderWidths("borderInlineStartWidth"),borderLeftColor:B.colors("borderLeftColor"),borderInlineStartColor:B.colors("borderInlineStartColor"),borderLeftStyle:B.borderStyles("borderLeftStyle"),borderInlineStartStyle:B.borderStyles("borderInlineStartStyle"),borderRightWidth:B.borderWidths("borderRightWidth"),borderInlineEndWidth:B.borderWidths("borderInlineEndWidth"),borderRightColor:B.colors("borderRightColor"),borderInlineEndColor:B.colors("borderInlineEndColor"),borderRightStyle:B.borderStyles("borderRightStyle"),borderInlineEndStyle:B.borderStyles("borderInlineEndStyle"),borderTopRadius:B.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:B.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:B.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:B.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(We,{rounded:We.borderRadius,roundedTop:We.borderTopRadius,roundedTopLeft:We.borderTopLeftRadius,roundedTopRight:We.borderTopRightRadius,roundedTopStart:We.borderStartStartRadius,roundedTopEnd:We.borderStartEndRadius,roundedBottom:We.borderBottomRadius,roundedBottomLeft:We.borderBottomLeftRadius,roundedBottomRight:We.borderBottomRightRadius,roundedBottomStart:We.borderEndStartRadius,roundedBottomEnd:We.borderEndEndRadius,roundedLeft:We.borderLeftRadius,roundedRight:We.borderRightRadius,roundedStart:We.borderInlineStartRadius,roundedEnd:We.borderInlineEndRadius,borderStart:We.borderInlineStart,borderEnd:We.borderInlineEnd,borderTopStartRadius:We.borderStartStartRadius,borderTopEndRadius:We.borderStartEndRadius,borderBottomStartRadius:We.borderEndStartRadius,borderBottomEndRadius:We.borderEndEndRadius,borderStartRadius:We.borderInlineStartRadius,borderEndRadius:We.borderInlineEndRadius,borderStartWidth:We.borderInlineStartWidth,borderEndWidth:We.borderInlineEndWidth,borderStartColor:We.borderInlineStartColor,borderEndColor:We.borderInlineEndColor,borderStartStyle:We.borderInlineStartStyle,borderEndStyle:We.borderInlineEndStyle});var i6={color:B.colors("color"),textColor:B.colors("color"),fill:B.colors("fill"),stroke:B.colors("stroke")},dy={boxShadow:B.shadows("boxShadow"),mixBlendMode:!0,blendMode:B.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:B.prop("backgroundBlendMode"),opacity:!0};Object.assign(dy,{shadow:dy.boxShadow});var a6={filter:{transform:Fe.filter},blur:B.blur("--chakra-blur"),brightness:B.propT("--chakra-brightness",Fe.brightness),contrast:B.propT("--chakra-contrast",Fe.contrast),hueRotate:B.degreeT("--chakra-hue-rotate"),invert:B.propT("--chakra-invert",Fe.invert),saturate:B.propT("--chakra-saturate",Fe.saturate),dropShadow:B.propT("--chakra-drop-shadow",Fe.dropShadow),backdropFilter:{transform:Fe.backdropFilter},backdropBlur:B.blur("--chakra-backdrop-blur"),backdropBrightness:B.propT("--chakra-backdrop-brightness",Fe.brightness),backdropContrast:B.propT("--chakra-backdrop-contrast",Fe.contrast),backdropHueRotate:B.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:B.propT("--chakra-backdrop-invert",Fe.invert),backdropSaturate:B.propT("--chakra-backdrop-saturate",Fe.saturate)},ch={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Fe.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:B.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:B.space("gap"),rowGap:B.space("rowGap"),columnGap:B.space("columnGap")};Object.assign(ch,{flexDir:ch.flexDirection});var UP={gridGap:B.space("gridGap"),gridColumnGap:B.space("gridColumnGap"),gridRowGap:B.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},o6={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Fe.outline},outlineOffset:!0,outlineColor:B.colors("outlineColor")},lr={width:B.sizesT("width"),inlineSize:B.sizesT("inlineSize"),height:B.sizes("height"),blockSize:B.sizes("blockSize"),boxSize:B.sizes(["width","height"]),minWidth:B.sizes("minWidth"),minInlineSize:B.sizes("minInlineSize"),minHeight:B.sizes("minHeight"),minBlockSize:B.sizes("minBlockSize"),maxWidth:B.sizes("maxWidth"),maxInlineSize:B.sizes("maxInlineSize"),maxHeight:B.sizes("maxHeight"),maxBlockSize:B.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,hideFrom:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.minWQuery)!=null?i:`@media screen and (min-width: ${t})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.maxWQuery)!=null?i:`@media screen and (max-width: ${t})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:B.propT("float",Fe.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(lr,{w:lr.width,h:lr.height,minW:lr.minWidth,maxW:lr.maxWidth,minH:lr.minHeight,maxH:lr.maxHeight,overscroll:lr.overscrollBehavior,overscrollX:lr.overscrollBehaviorX,overscrollY:lr.overscrollBehaviorY});var s6={listStyleType:!0,listStylePosition:!0,listStylePos:B.prop("listStylePosition"),listStyleImage:!0,listStyleImg:B.prop("listStyleImage")};function l6(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},c6=u6(l6),f6={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},d6={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Nm=(t,e,n)=>{const r={},i=c6(t,e,{});for(const a in i)a in n&&n[a]!=null||(r[a]=i[a]);return r},h6={srOnly:{transform(t){return t===!0?f6:t==="focusable"?d6:{}}},layerStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`layerStyles.${t}`,n)},textStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`textStyles.${t}`,n)},apply:{processResult:!0,transform:(t,e,n)=>Nm(e,t,n)}},Su={position:!0,pos:B.prop("position"),zIndex:B.prop("zIndex","zIndices"),inset:B.spaceT("inset"),insetX:B.spaceT(["left","right"]),insetInline:B.spaceT("insetInline"),insetY:B.spaceT(["top","bottom"]),insetBlock:B.spaceT("insetBlock"),top:B.spaceT("top"),insetBlockStart:B.spaceT("insetBlockStart"),bottom:B.spaceT("bottom"),insetBlockEnd:B.spaceT("insetBlockEnd"),left:B.spaceT("left"),insetInlineStart:B.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:B.spaceT("right"),insetInlineEnd:B.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Su,{insetStart:Su.insetInlineStart,insetEnd:Su.insetInlineEnd});var p6={ring:{transform:Fe.ring},ringColor:B.colors("--chakra-ring-color"),ringOffset:B.prop("--chakra-ring-offset-width"),ringOffsetColor:B.colors("--chakra-ring-offset-color"),ringInset:B.prop("--chakra-ring-inset")},st={margin:B.spaceT("margin"),marginTop:B.spaceT("marginTop"),marginBlockStart:B.spaceT("marginBlockStart"),marginRight:B.spaceT("marginRight"),marginInlineEnd:B.spaceT("marginInlineEnd"),marginBottom:B.spaceT("marginBottom"),marginBlockEnd:B.spaceT("marginBlockEnd"),marginLeft:B.spaceT("marginLeft"),marginInlineStart:B.spaceT("marginInlineStart"),marginX:B.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:B.spaceT("marginInline"),marginY:B.spaceT(["marginTop","marginBottom"]),marginBlock:B.spaceT("marginBlock"),padding:B.space("padding"),paddingTop:B.space("paddingTop"),paddingBlockStart:B.space("paddingBlockStart"),paddingRight:B.space("paddingRight"),paddingBottom:B.space("paddingBottom"),paddingBlockEnd:B.space("paddingBlockEnd"),paddingLeft:B.space("paddingLeft"),paddingInlineStart:B.space("paddingInlineStart"),paddingInlineEnd:B.space("paddingInlineEnd"),paddingX:B.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:B.space("paddingInline"),paddingY:B.space(["paddingTop","paddingBottom"]),paddingBlock:B.space("paddingBlock")};Object.assign(st,{m:st.margin,mt:st.marginTop,mr:st.marginRight,me:st.marginInlineEnd,marginEnd:st.marginInlineEnd,mb:st.marginBottom,ml:st.marginLeft,ms:st.marginInlineStart,marginStart:st.marginInlineStart,mx:st.marginX,my:st.marginY,p:st.padding,pt:st.paddingTop,py:st.paddingY,px:st.paddingX,pb:st.paddingBottom,pl:st.paddingLeft,ps:st.paddingInlineStart,paddingStart:st.paddingInlineStart,pr:st.paddingRight,pe:st.paddingInlineEnd,paddingEnd:st.paddingInlineEnd});var g6={textDecorationColor:B.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:B.shadows("textShadow")},m6={clipPath:!0,transform:B.propT("transform",Fe.transform),transformOrigin:!0,translateX:B.spaceT("--chakra-translate-x"),translateY:B.spaceT("--chakra-translate-y"),skewX:B.degreeT("--chakra-skew-x"),skewY:B.degreeT("--chakra-skew-y"),scaleX:B.prop("--chakra-scale-x"),scaleY:B.prop("--chakra-scale-y"),scale:B.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:B.degreeT("--chakra-rotate")},v6={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:B.prop("transitionDuration","transition.duration"),transitionProperty:B.prop("transitionProperty","transition.property"),transitionTimingFunction:B.prop("transitionTimingFunction","transition.easing")},y6={fontFamily:B.prop("fontFamily","fonts"),fontSize:B.prop("fontSize","fontSizes",Fe.px),fontWeight:B.prop("fontWeight","fontWeights"),lineHeight:B.prop("lineHeight","lineHeights"),letterSpacing:B.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(t){if(t===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},S6={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:B.spaceT("scrollMargin"),scrollMarginTop:B.spaceT("scrollMarginTop"),scrollMarginBottom:B.spaceT("scrollMarginBottom"),scrollMarginLeft:B.spaceT("scrollMarginLeft"),scrollMarginRight:B.spaceT("scrollMarginRight"),scrollMarginX:B.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:B.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:B.spaceT("scrollPadding"),scrollPaddingTop:B.spaceT("scrollPaddingTop"),scrollPaddingBottom:B.spaceT("scrollPaddingBottom"),scrollPaddingLeft:B.spaceT("scrollPaddingLeft"),scrollPaddingRight:B.spaceT("scrollPaddingRight"),scrollPaddingX:B.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:B.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function jP(t){return zr(t)&&t.reference?t.reference:String(t)}var ap=(t,...e)=>e.map(jP).join(` ${t} `).replace(/calc/g,""),n2=(...t)=>`calc(${ap("+",...t)})`,r2=(...t)=>`calc(${ap("-",...t)})`,hy=(...t)=>`calc(${ap("*",...t)})`,i2=(...t)=>`calc(${ap("/",...t)})`,a2=t=>{const e=jP(t);return e!=null&&!Number.isNaN(parseFloat(e))?String(e).startsWith("-")?String(e).slice(1):`-${e}`:hy(e,-1)},eo=Object.assign(t=>({add:(...e)=>eo(n2(t,...e)),subtract:(...e)=>eo(r2(t,...e)),multiply:(...e)=>eo(hy(t,...e)),divide:(...e)=>eo(i2(t,...e)),negate:()=>eo(a2(t)),toString:()=>t.toString()}),{add:n2,subtract:r2,multiply:hy,divide:i2,negate:a2});function _6(t,e="-"){return t.replace(/\s+/g,e)}function w6(t){const e=_6(t.toString());return C6(b6(e))}function b6(t){return t.includes("\\.")?t:!Number.isInteger(parseFloat(t.toString()))?t.replace(".","\\."):t}function C6(t){return t.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function x6(t,e=""){return[e,t].filter(Boolean).join("-")}function k6(t,e){return`var(${t}${e?`, ${e}`:""})`}function P6(t,e=""){return w6(`--${x6(t,e)}`)}function E6(t,e,n){const r=P6(t,n);return{variable:r,reference:k6(r,e)}}function O6(t){const e=t==null?0:t.length;return e?t[e-1]:void 0}function T6(t){const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}}function py(t){if(t==null)return t;const{unitless:e}=T6(t);return e||typeof t=="number"?`${t}px`:t}var WP=(t,e)=>parseInt(t[1],10)>parseInt(e[1],10)?1:-1,U0=t=>Object.fromEntries(Object.entries(t).sort(WP));function o2(t){const e=U0(t);return Object.assign(Object.values(e),e)}function R6(t){const e=Object.keys(U0(t));return new Set(e)}function s2(t){var e;if(!t)return t;t=(e=py(t))!=null?e:t;const n=-.02;return typeof t=="number"?`${t+n}`:t.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function au(t,e){const n=["@media screen"];return t&&n.push("and",`(min-width: ${py(t)})`),e&&n.push("and",`(max-width: ${py(e)})`),n.join(" ")}function A6(t){var e;if(!t)return null;t.base=(e=t.base)!=null?e:"0px";const n=o2(t),r=Object.entries(t).sort(WP).map(([s,u],c,f)=>{var h;let[,p]=(h=f[c+1])!=null?h:[];return p=parseFloat(p)>0?s2(p):void 0,{_minW:s2(u),breakpoint:s,minW:u,maxW:p,maxWQuery:au(null,p),minWQuery:au(u),minMaxQuery:au(u,p)}}),i=R6(t),a=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const u=Object.keys(s);return u.length>0&&u.every(c=>i.has(c))},asObject:U0(t),asArray:o2(t),details:r,get(s){return r.find(u=>u.breakpoint===s)},media:[null,...n.map(s=>au(s)).slice(1)],toArrayValue(s){if(!zr(s))throw new Error("toArrayValue: value must be an object");const u=a.map(c=>{var f;return(f=s[c])!=null?f:null});for(;O6(u)===null;)u.pop();return u},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((u,c,f)=>{const h=a[f];return h!=null&&c!=null&&(u[h]=c),u},{})}}}var Qt={hover:(t,e)=>`${t}:hover ${e}, ${t}[data-hover] ${e}`,focus:(t,e)=>`${t}:focus ${e}, ${t}[data-focus] ${e}`,focusVisible:(t,e)=>`${t}:focus-visible ${e}`,focusWithin:(t,e)=>`${t}:focus-within ${e}`,active:(t,e)=>`${t}:active ${e}, ${t}[data-active] ${e}`,disabled:(t,e)=>`${t}:disabled ${e}, ${t}[data-disabled] ${e}`,invalid:(t,e)=>`${t}:invalid ${e}, ${t}[data-invalid] ${e}`,checked:(t,e)=>`${t}:checked ${e}, ${t}[data-checked] ${e}`,indeterminate:(t,e)=>`${t}:indeterminate ${e}, ${t}[aria-checked=mixed] ${e}, ${t}[data-indeterminate] ${e}`,readOnly:(t,e)=>`${t}:read-only ${e}, ${t}[readonly] ${e}, ${t}[data-read-only] ${e}`,expanded:(t,e)=>`${t}:read-only ${e}, ${t}[aria-expanded=true] ${e}, ${t}[data-expanded] ${e}`,placeholderShown:(t,e)=>`${t}:placeholder-shown ${e}`},la=t=>HP(e=>t(e,"&"),"[role=group]","[data-group]",".group"),Ai=t=>HP(e=>t(e,"~ &"),"[data-peer]",".peer"),HP=(t,...e)=>e.map(t).join(", "),op={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:la(Qt.hover),_peerHover:Ai(Qt.hover),_groupFocus:la(Qt.focus),_peerFocus:Ai(Qt.focus),_groupFocusVisible:la(Qt.focusVisible),_peerFocusVisible:Ai(Qt.focusVisible),_groupActive:la(Qt.active),_peerActive:Ai(Qt.active),_groupDisabled:la(Qt.disabled),_peerDisabled:Ai(Qt.disabled),_groupInvalid:la(Qt.invalid),_peerInvalid:Ai(Qt.invalid),_groupChecked:la(Qt.checked),_peerChecked:Ai(Qt.checked),_groupFocusWithin:la(Qt.focusWithin),_peerFocusWithin:Ai(Qt.focusWithin),_peerPlaceholderShown:Ai(Qt.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]"},I6=Object.keys(op);function l2(t,e){return E6(String(t).replace(/\./g,"-"),void 0,e)}function L6(t,e){let n={};const r={};for(const[i,a]of Object.entries(t)){const{isSemantic:s,value:u}=a,{variable:c,reference:f}=l2(i,e==null?void 0:e.cssVarPrefix);if(!s){if(i.startsWith("space")){const g=i.split("."),[y,...v]=g,w=`${y}.-${v.join(".")}`,x=eo.negate(u),_=eo.negate(f);r[w]={value:x,var:c,varRef:_}}n[c]=u,r[i]={value:u,var:c,varRef:f};continue}const h=g=>{const v=[String(i).split(".")[0],g].join(".");if(!t[v])return g;const{reference:x}=l2(v,e==null?void 0:e.cssVarPrefix);return x},p=zr(u)?u:{default:u};n=ai(n,Object.entries(p).reduce((g,[y,v])=>{var w,x;const _=h(v);if(y==="default")return g[c]=_,g;const S=(x=(w=op)==null?void 0:w[y])!=null?x:y;return g[S]={[c]:_},g},{})),r[i]={value:f,var:c,varRef:f}}return{cssVars:n,cssMap:r}}function M6(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function D6(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var N6=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function B6(t){return D6(t,N6)}function F6(t){return t.semanticTokens}function $6(t){const{__cssMap:e,__cssVars:n,__breakpoints:r,...i}=t;return i}function z6({tokens:t,semanticTokens:e}){var n,r;const i=Object.entries((n=gy(t))!=null?n:{}).map(([s,u])=>[s,{isSemantic:!1,value:u}]),a=Object.entries((r=gy(e,1))!=null?r:{}).map(([s,u])=>[s,{isSemantic:!0,value:u}]);return Object.fromEntries([...i,...a])}function gy(t,e=1/0){return!zr(t)&&!Array.isArray(t)||!e?t:Object.entries(t).reduce((n,[r,i])=>(zr(i)||Array.isArray(i)?Object.entries(gy(i,e-1)).forEach(([a,s])=>{n[`${r}.${a}`]=s}):n[r]=i,n),{})}function uH(t){var e;const n=$6(t),r=B6(n),i=F6(n),a=z6({tokens:r,semanticTokens:i}),s=(e=n.config)==null?void 0:e.cssVarPrefix,{cssMap:u,cssVars:c}=L6(a,{cssVarPrefix:s});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...c},__cssMap:u,__breakpoints:A6(n.breakpoints)}),n}var j0=ai({},bd,We,i6,ch,lr,a6,p6,o6,UP,h6,Su,dy,st,S6,y6,g6,m6,s6,v6),G6=Object.assign({},st,lr,ch,UP,Su),cH=Object.keys(G6),U6=[...Object.keys(j0),...I6],j6={...j0,...op},W6=t=>t in j6,H6=t=>e=>{if(!e.__breakpoints)return t;const{isResponsive:n,toArrayValue:r,media:i}=e.__breakpoints,a={};for(const s in t){let u=io(t[s],e);if(u==null)continue;if(u=zr(u)&&n(u)?r(u):u,!Array.isArray(u)){a[s]=u;continue}const c=u.slice(0,i.length).length;for(let f=0;ft.startsWith("--")&&typeof e=="string"&&!q6(e),Y6=(t,e)=>{var n,r;if(e==null)return e;const i=c=>{var f,h;return(h=(f=t.__cssMap)==null?void 0:f[c])==null?void 0:h.varRef},a=c=>{var f;return(f=i(c))!=null?f:c},[s,u]=V6(e);return e=(r=(n=i(s))!=null?n:a(u))!=null?r:a(e),e};function X6(t){const{configs:e={},pseudos:n={},theme:r}=t,i=(a,s=!1)=>{var u,c,f;const h=io(a,r),p=H6(h)(r);let g={};for(let y in p){const v=p[y];let w=io(v,r);y in n&&(y=n[y]),K6(y,w)&&(w=Y6(r,w));let x=e[y];if(x===!0&&(x={property:y}),zr(w)){g[y]=(u=g[y])!=null?u:{},g[y]=ai({},g[y],i(w,!0));continue}let _=(f=(c=x==null?void 0:x.transform)==null?void 0:c.call(x,w,r,h))!=null?f:w;_=x!=null&&x.processResult?i(_,!0):_;const S=io(x==null?void 0:x.property,r);if(!s&&(x!=null&&x.static)){const C=io(x.static,r);g=ai({},g,C)}if(S&&Array.isArray(S)){for(const C of S)g[C]=_;continue}if(S){S==="&"&&zr(_)?g=ai({},g,_):g[S]=_;continue}if(zr(_)){g=ai({},g,_);continue}g[y]=_}return g};return i}var Q6=t=>e=>X6({theme:e,pseudos:op,configs:j0})(t);function fH(t){return t}function dH(t){return t}function hH(t){return{definePartsStyle(e){return e},defineMultiStyleConfig(e){return{parts:t,...e}}}}function J6(t,e){if(Array.isArray(t))return t;if(zr(t))return e(t);if(t!=null)return[t]}function Z6(t,e){for(let n=e+1;n{ai(f,{[C]:g?S[C]:{[_]:S[C]}})});continue}if(!y){g?ai(f,S):f[_]=S;continue}f[_]=S}}return f}}function t8(t){return e=>{var n;const{variant:r,size:i,theme:a}=e,s=e8(a);return ai({},io((n=t.baseStyle)!=null?n:{},e),s(t,"sizes",i,e),s(t,"variants",r,e))}}function pH(t,e,n){var r,i,a;return(a=(i=(r=t.__cssMap)==null?void 0:r[`${e}.${n}`])==null?void 0:i.varRef)!=null?a:n}function VP(t){return M6(t,["styleConfig","size","variant","colorScheme"])}function n8(t,e){const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function r8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},a8=i8(r8);function qP(t,e){const n={};return Object.keys(t).forEach(r=>{const i=t[r];e(i,r,t)&&(n[r]=i)}),n}var KP=t=>qP(t,e=>e!=null);function o8(t){return typeof t=="function"}function s8(t,...e){return o8(t)?t(...e):t}function gH(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var l8=typeof Element<"u",u8=typeof Map=="function",c8=typeof Set=="function",f8=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Cd(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Cd(t[r],e[r]))return!1;return!0}var a;if(u8&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!Cd(r.value[1],e.get(r.value[0])))return!1;return!0}if(c8&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(f8&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(l8&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!Cd(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var d8=function(e,n){try{return Cd(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};function YP(t,e={}){var n;const{styleConfig:r,...i}=e,{theme:a,colorMode:s}=DG(),u=t?a8(a,`components.${t}`):void 0,c=r||u,f=ai({theme:a,colorMode:s},(n=c==null?void 0:c.defaultProps)!=null?n:{},KP(n8(i,["children"]))),h=be.useRef({});if(c){const g=t8(c)(f);d8(h.current,g)||(h.current=g)}return h.current}function XP(t,e={}){return YP(t,e)}function mH(t,e={}){return YP(t,e)}var h8=new Set([...U6,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),p8=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function g8(t){return p8.has(t)||!h8.has(t)}function m8(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function v8(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");const n={...t};for(const r of e)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}var y8=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,S8=EP(function(t){return y8.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),_8=S8,w8=function(e){return e!=="theme"},u2=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?_8:w8},c2=function(e,n,r){var i;if(n){var a=n.shouldForwardProp;i=e.__emotion_forwardProp&&a?function(s){return e.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=e.__emotion_forwardProp),i},b8=function(e){var n=e.cache,r=e.serialized,i=e.isStringTag;return TP(n,r,i),RG(function(){return RP(n,r,i)}),null},C8=function t(e,n){var r=e.__emotion_real===e,i=r&&e.__emotion_base||e,a,s;n!==void 0&&(a=n.label,s=n.target);var u=c2(e,n,r),c=u||u2(i),f=!c("as");return function(){var h=arguments,p=r&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(a!==void 0&&p.push("label:"+a+";"),h[0]==null||h[0].raw===void 0)p.push.apply(p,h);else{p.push(h[0][0]);for(var g=h.length,y=1;ye=>{const{theme:n,css:r,__css:i,sx:a,...s}=e,u=qP(s,(p,g)=>W6(g)),c=s8(t,e),f=v8({},i,c,KP(u),a),h=Q6(f)(e.theme);return r?[h,r]:h};function Bm(t,e){const{baseStyle:n,...r}=e??{};r.shouldForwardProp||(r.shouldForwardProp=g8);const i=P8({baseStyle:n}),a=k8(t,r)(i);return As.forwardRef(function(c,f){const{colorMode:h,forced:p}=BP();return As.createElement(a,{ref:f,"data-theme":p?h:void 0,...c})})}function E8(){const t=new Map;return new Proxy(Bm,{apply(e,n,r){return Bm(...r)},get(e,n){return t.has(n)||t.set(n,Bm(n)),t.get(n)}})}var dh=E8();function W0(t){return be.forwardRef(t)}var O8=MG({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QP=W0((t,e)=>{const n=XP("Spinner",t),{label:r="Loading...",thickness:i="2px",speed:a="0.45s",emptyColor:s="transparent",className:u,...c}=VP(t),f=FP("chakra-spinner",u),h={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${O8} ${a} linear infinite`,...n};return jt.jsx(dh.div,{ref:e,__css:h,className:f,...c,children:r&&jt.jsx(dh.span,{srOnly:!0,children:r})})});QP.displayName="Spinner";var JP=W0(function(e,n){const r=XP("Text",e),{className:i,align:a,decoration:s,casing:u,...c}=VP(e),f=m8({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return jt.jsx(dh.p,{ref:n,className:FP("chakra-text",e.className),...f,...c,__css:r})});JP.displayName="Text";var ZP=W0(function(e,n){const{direction:r,align:i,justify:a,wrap:s,basis:u,grow:c,shrink:f,...h}=e,p={display:"flex",flexDirection:r,alignItems:i,justifyContent:a,flexWrap:s,flexBasis:u,flexGrow:c,flexShrink:f};return jt.jsx(dh.div,{ref:n,__css:p,...h})});ZP.displayName="Flex";const d2=t=>{const{t:e}=lB(),{showText:n=!1,text:r=e("common.loadingInvokeAI")}=t;return jt.jsxs(ZP,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#121212",flexDirection:"column",rowGap:4,children:[jt.jsx(QP,{color:"grey",w:"5rem",h:"5rem"}),n&&jt.jsx(JP,{color:"grey",fontWeight:"semibold",fontFamily:"'Inter', sans-serif",children:r})]})},T8=be.lazy(()=>bx(()=>import("./App-843b023b.js"),["./App-843b023b.js","./storeHooks-eaf47ae3.js","./App-08e5c546.css"],import.meta.url)),R8=be.lazy(()=>bx(()=>import("./ThemeLocaleProvider-680f01c6.js"),["./ThemeLocaleProvider-680f01c6.js","./storeHooks-eaf47ae3.js"],import.meta.url));function A8(t){return jt.jsx(As.StrictMode,{children:jt.jsx(Y3,{store:_P,children:jt.jsx(Ax,{loading:jt.jsx(d2,{}),persistor:qz,children:jt.jsx(As.Suspense,{fallback:jt.jsx(d2,{showText:!0}),children:jt.jsx(R8,{children:jt.jsx(T8,{children:t.children})})})})})})}Fm.createRoot(document.getElementById("root")).render(jt.jsx(A8,{}));export{rW as $,Vf as A,Of as B,yU as C,D5 as D,lB as E,ZP as F,xd as G,tW as H,oW as I,XW as J,KW as K,qW as L,wW as M,vB as N,yB as O,CW as P,JW as Q,As as R,QP as S,JP as T,fW as U,YW as V,rH as W,QW as X,BW as Y,eW as Z,Xd as _,FP as a,IW as a$,aW as a0,_W as a1,bW as a2,lW as a3,qz as a4,sW as a5,gW as a6,vU as a7,vW as a8,TW as a9,gj as aA,Ow as aB,Rj as aC,kj as aD,Vj as aE,Fj as aF,mj as aG,N5 as aH,vj as aI,Aj as aJ,tj as aK,ej as aL,L5 as aM,Xj as aN,zj as aO,Gj as aP,$j as aQ,Lj as aR,kz as aS,fF as aT,cF as aU,Yj as aV,Ij as aW,R5 as aX,Bj as aY,MW as aZ,yj as a_,yW as aa,OW as ab,NW as ac,Hj as ad,Wj as ae,jj as af,Jj as ag,Zj as ah,DW as ai,Qj as aj,HW as ak,dd as al,O5 as am,wj as an,bj as ao,lj as ap,pW as aq,hj as ar,Tj as as,jW as at,WW as au,SW as av,Dj as aw,_j as ax,Cj as ay,Mj as az,sH as b,XU as b$,AW as b0,uj as b1,LW as b2,iW as b3,VW as b4,hW as b5,dW as b6,Ew as b7,UW as b8,Kj as b9,VU as bA,Qx as bB,z8 as bC,G8 as bD,U8 as bE,jU as bF,tU as bG,eU as bH,X8 as bI,UU as bJ,ZW as bK,Q8 as bL,lU as bM,uU as bN,Ef as bO,va as bP,PU as bQ,xU as bR,wU as bS,N8 as bT,B8 as bU,$W as bV,zW as bW,pU as bX,oU as bY,sU as bZ,nU as b_,qj as ba,$m as bb,AL as bc,pe as bd,Lb as be,kU as bf,HU as bg,WU as bh,iU as bi,DU as bj,qU as bk,GW as bl,K8 as bm,_U as bn,Vl as bo,gU as bp,Y8 as bq,Cz as br,SU as bs,H8 as bt,mU as bu,V8 as bv,Z8 as bw,L8 as bx,M8 as by,D8 as bz,dh as c,cW as c0,Af as c1,ei as c2,zl as c3,Ae as c4,TU as c5,ns as c6,F8 as c7,EU as c8,rU as c9,uW as cA,kW as cB,dj as cC,ZU as cD,aj as cE,nj as cF,rj as cG,ij as cH,sj as cI,Hb as cJ,EW as cK,RW as cL,BP as cM,nH as cN,NP as cO,fH as cP,hH as cQ,E6 as cR,dH as cS,ai as cT,uH as cU,tH as cV,a8 as cW,Q6 as cX,Yd as cY,T3 as cZ,I8 as c_,aU as ca,W8 as cb,j8 as cc,eH as cd,q8 as ce,GU as cf,RU as cg,AU as ch,FU as ci,hU as cj,dU as ck,OU as cl,JU as cm,MU as cn,IU as co,zU as cp,$8 as cq,M5 as cr,Nj as cs,QU as ct,fU as cu,xj as cv,Pj as cw,Ej as cx,Oj as cy,PW as cz,mH as d,XP as e,W0 as f,aH as g,oH as h,lH as i,jt as j,MG as k,jv as l,Ur as m,s8 as n,VP as o,gH as p,zr as q,be as r,DP as s,io as t,DG as u,cH as v,iH as w,pH as x,wk as y,_t as z};