function U7(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Om=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var U4={exports:{}},Xf={},z4={exports:{}},ut={};/** * @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 uh=Symbol.for("react.element"),z7=Symbol.for("react.portal"),G7=Symbol.for("react.fragment"),V7=Symbol.for("react.strict_mode"),q7=Symbol.for("react.profiler"),W7=Symbol.for("react.provider"),H7=Symbol.for("react.context"),Y7=Symbol.for("react.forward_ref"),K7=Symbol.for("react.suspense"),X7=Symbol.for("react.memo"),$7=Symbol.for("react.lazy"),Rm=Symbol.iterator;function Q7(t){return t===null||typeof t!="object"?null:(t=Rm&&t[Rm]||t["@@iterator"],typeof t=="function"?t:null)}var G4={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},V4=Object.assign,q4={};function fc(t,e,n){this.props=t,this.context=e,this.refs=q4,this.updater=n||G4}fc.prototype.isReactComponent={};fc.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")};fc.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function W4(){}W4.prototype=fc.prototype;function F5(t,e,n){this.props=t,this.context=e,this.refs=q4,this.updater=n||G4}var I5=F5.prototype=new W4;I5.constructor=F5;V4(I5,fc.prototype);I5.isPureReactComponent=!0;var Bm=Array.isArray,H4=Object.prototype.hasOwnProperty,O5={current:null},Y4={key:!0,ref:!0,__self:!0,__source:!0};function K4(t,e,n){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)H4.call(e,r)&&!Y4.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,M=K[de];if(0>>1;dei(ne,X))iei(V,ne)?(K[de]=V,K[ie]=X,de=ie):(K[de]=ne,K[H]=X,de=H);else if(iei(V,X))K[de]=V,K[ie]=X,de=ie;else break e}}return te}function i(K,te){var X=K.sortIndex-te.sortIndex;return X!==0?X:K.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();t.unstable_now=function(){return s.now()-a}}var l=[],u=[],d=1,p=null,g=3,h=!1,w=!1,_=!1,x=typeof setTimeout=="function"?setTimeout:null,v=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 y(K){for(var te=n(u);te!==null;){if(te.callback===null)r(u);else if(te.startTime<=K)r(u),te.sortIndex=te.expirationTime,e(l,te);else break;te=n(u)}}function A(K){if(_=!1,y(K),!w)if(n(l)!==null)w=!0,ee(L);else{var te=n(u);te!==null&&se(A,te.startTime-K)}}function L(K,te){w=!1,_&&(_=!1,v(k),k=-1),h=!0;var X=g;try{for(y(te),p=n(l);p!==null&&(!(p.expirationTime>te)||K&&!P());){var de=p.callback;if(typeof de=="function"){p.callback=null,g=p.priorityLevel;var M=de(p.expirationTime<=te);te=t.unstable_now(),typeof M=="function"?p.callback=M:p===n(l)&&r(l),y(te)}else r(l);p=n(l)}if(p!==null)var G=!0;else{var H=n(u);H!==null&&se(A,H.startTime-te),G=!1}return G}finally{p=null,g=X,h=!1}}var R=!1,D=null,k=-1,z=5,T=-1;function P(){return!(t.unstable_now()-TK||125de?(K.sortIndex=X,e(u,K),n(l)===null&&K===n(u)&&(_?(v(k),k=-1):_=!0,se(A,X-de))):(K.sortIndex=M,e(l,K),w||h||(w=!0,ee(L))),K},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(K){var te=g;return function(){var X=g;g=te;try{return K.apply(this,arguments)}finally{g=X}}}})(Z4);J4.exports=Z4;var cb=J4.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ub=re,Gr=cb;function Le(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"),u2=Object.prototype.hasOwnProperty,hb=/^[: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]*$/,Um={},zm={};function db(t){return u2.call(zm,t)?!0:u2.call(Um,t)?!1:hb.test(t)?zm[t]=!0:(Um[t]=!0,!1)}function fb(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 pb(t,e,n,r){if(e===null||typeof e>"u"||fb(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 yr(t,e,n,r,i,o,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=o,this.removeEmptyString=s}var Hn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Hn[t]=new yr(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Hn[e]=new yr(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Hn[t]=new yr(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Hn[t]=new yr(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){Hn[t]=new yr(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Hn[t]=new yr(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Hn[t]=new yr(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Hn[t]=new yr(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Hn[t]=new yr(t,5,!1,t.toLowerCase(),null,!1,!1)});var B5=/[\-:]([a-z])/g;function D5(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(B5,D5);Hn[e]=new yr(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(B5,D5);Hn[e]=new yr(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(B5,D5);Hn[e]=new yr(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Hn[t]=new yr(t,1,!1,t.toLowerCase(),null,!1,!1)});Hn.xlinkHref=new yr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Hn[t]=new yr(t,1,!1,t.toLowerCase(),null,!0,!0)});function U5(t,e,n,r){var i=Hn.hasOwnProperty(e)?Hn[e]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` `+i[s].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{ap=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?_u(t):""}function gb(t){switch(t.tag){case 5:return _u(t.type);case 16:return _u("Lazy");case 13:return _u("Suspense");case 19:return _u("SuspenseList");case 0:case 2:case 15:return t=lp(t.type,!1),t;case 11:return t=lp(t.type.render,!1),t;case 1:return t=lp(t.type,!0),t;default:return""}}function p2(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 Ml:return"Fragment";case Tl:return"Portal";case h2:return"Profiler";case z5:return"StrictMode";case d2:return"Suspense";case f2:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ny:return(t.displayName||"Context")+".Consumer";case ty:return(t._context.displayName||"Context")+".Provider";case G5:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V5:return e=t.displayName||null,e!==null?e:p2(t.type)||"Memo";case ds:e=t._payload,t=t._init;try{return p2(t(e))}catch{}}return null}function mb(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 p2(e);case 8:return e===z5?"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 js(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function iy(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function vb(t){var e=iy(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.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 md(t){t._valueTracker||(t._valueTracker=vb(t))}function oy(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=iy(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function ff(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 g2(t,e){var n=e.checked;return Jt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Vm(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=js(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 sy(t,e){e=e.checked,e!=null&&U5(t,"checked",e,!1)}function m2(t,e){sy(t,e);var n=js(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")?v2(t,e.type,n):e.hasOwnProperty("defaultValue")&&v2(t,e.type,js(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function qm(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 v2(t,e,n){(e!=="number"||ff(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Su=Array.isArray;function ql(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=vd.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Uu(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Nu={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},yb=["Webkit","ms","Moz","O"];Object.keys(Nu).forEach(function(t){yb.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Nu[e]=Nu[t]})});function uy(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Nu.hasOwnProperty(t)&&Nu[t]?(""+e).trim():e+"px"}function hy(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=uy(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var wb=Jt({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 b2(t,e){if(e){if(wb[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Le(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Le(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Le(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Le(62))}}function _2(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 S2=null;function q5(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var x2=null,Wl=null,Hl=null;function Ym(t){if(t=fh(t)){if(typeof x2!="function")throw Error(Le(280));var e=t.stateNode;e&&(e=e1(e),x2(t.stateNode,t.type,e))}}function dy(t){Wl?Hl?Hl.push(t):Hl=[t]:Wl=t}function fy(){if(Wl){var t=Wl,e=Hl;if(Hl=Wl=null,Ym(t),e)for(t=0;t>>=0,t===0?32:31-(Eb(t)/Tb|0)|0}var yd=64,wd=4194304;function xu(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 vf(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=xu(a):(o&=s,o!==0&&(r=xu(o)))}else s=n&~i,s!==0?r=xu(s):o!==0&&(r=xu(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function hh(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Ti(e),t[e]=n}function Ib(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=Pu),nv=" ",rv=!1;function jy(t,e){switch(t){case"keyup":return c_.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fy(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var jl=!1;function h_(t,e){switch(t){case"compositionend":return Fy(e);case"keypress":return e.which!==32?null:(rv=!0,nv);case"textInput":return t=e.data,t===nv&&rv?null:t;default:return null}}function d_(t,e){if(jl)return t==="compositionend"||!J5&&jy(t,e)?(t=Ty(),Kd=X5=ws=null,jl=!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=av(n)}}function By(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?By(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Dy(){for(var t=window,e=ff();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ff(t.document)}return e}function Z5(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 __(t){var e=Dy(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&By(n.ownerDocument.documentElement,n)){if(r!==null&&Z5(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=lv(n,o);var s=lv(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(),o>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,Fl=null,k2=null,ku=null,E2=!1;function cv(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;E2||Fl==null||Fl!==ff(r)||(r=Fl,"selectionStart"in r&&Z5(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}),ku&&Hu(ku,r)||(ku=r,r=bf(k2,"onSelect"),0Rl||(t.current=O2[Rl],O2[Rl]=null,Rl--)}function Dt(t,e){Rl++,O2[Rl]=t.current,t.current=e}var Fs={},ar=Us(Fs),Lr=Us(!1),Aa=Fs;function nc(t,e){var n=t.type.contextTypes;if(!n)return Fs;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function kr(t){return t=t.childContextTypes,t!=null}function Sf(){Vt(Lr),Vt(ar)}function mv(t,e,n){if(ar.current!==Fs)throw Error(Le(168));Dt(ar,e),Dt(Lr,n)}function Ky(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(Le(108,mb(t)||"Unknown",i));return Jt({},n,r)}function xf(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Fs,Aa=ar.current,Dt(ar,t),Dt(Lr,Lr.current),!0}function vv(t,e,n){var r=t.stateNode;if(!r)throw Error(Le(169));n?(t=Ky(t,e,Aa),r.__reactInternalMemoizedMergedChildContext=t,Vt(Lr),Vt(ar),Dt(ar,t)):Vt(Lr),Dt(Lr,n)}var Po=null,t1=!1,Sp=!1;function Xy(t){Po===null?Po=[t]:Po.push(t)}function j_(t){t1=!0,Xy(t)}function zs(){if(!Sp&&Po!==null){Sp=!0;var t=0,e=Lt;try{var n=Po;for(Lt=1;t>=s,i-=s,ko=1<<32-Ti(e)+i|n<k?(z=D,D=null):z=D.sibling;var T=g(v,D,y[k],A);if(T===null){D===null&&(D=z);break}t&&D&&T.alternate===null&&e(v,D),S=o(T,S,k),R===null?L=T:R.sibling=T,R=T,D=z}if(k===y.length)return n(v,D),Wt&&ha(v,k),L;if(D===null){for(;kk?(z=D,D=null):z=D.sibling;var P=g(v,D,T.value,A);if(P===null){D===null&&(D=z);break}t&&D&&P.alternate===null&&e(v,D),S=o(P,S,k),R===null?L=P:R.sibling=P,R=P,D=z}if(T.done)return n(v,D),Wt&&ha(v,k),L;if(D===null){for(;!T.done;k++,T=y.next())T=p(v,T.value,A),T!==null&&(S=o(T,S,k),R===null?L=T:R.sibling=T,R=T);return Wt&&ha(v,k),L}for(D=r(v,D);!T.done;k++,T=y.next())T=h(D,v,k,T.value,A),T!==null&&(t&&T.alternate!==null&&D.delete(T.key===null?k:T.key),S=o(T,S,k),R===null?L=T:R.sibling=T,R=T);return t&&D.forEach(function(E){return e(v,E)}),Wt&&ha(v,k),L}function x(v,S,y,A){if(typeof y=="object"&&y!==null&&y.type===Ml&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case gd:e:{for(var L=y.key,R=S;R!==null;){if(R.key===L){if(L=y.type,L===Ml){if(R.tag===7){n(v,R.sibling),S=i(R,y.props.children),S.return=v,v=S;break e}}else if(R.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===ds&&bv(L)===R.type){n(v,R.sibling),S=i(R,y.props),S.ref=cu(v,R,y),S.return=v,v=S;break e}n(v,R);break}else e(v,R);R=R.sibling}y.type===Ml?(S=ba(y.props.children,v.mode,A,y.key),S.return=v,v=S):(A=nf(y.type,y.key,y.props,null,v.mode,A),A.ref=cu(v,S,y),A.return=v,v=A)}return s(v);case Tl:e:{for(R=y.key;S!==null;){if(S.key===R)if(S.tag===4&&S.stateNode.containerInfo===y.containerInfo&&S.stateNode.implementation===y.implementation){n(v,S.sibling),S=i(S,y.children||[]),S.return=v,v=S;break e}else{n(v,S);break}else e(v,S);S=S.sibling}S=Ep(y,v.mode,A),S.return=v,v=S}return s(v);case ds:return R=y._init,x(v,S,R(y._payload),A)}if(Su(y))return w(v,S,y,A);if(iu(y))return _(v,S,y,A);Cd(v,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,S!==null&&S.tag===6?(n(v,S.sibling),S=i(S,y),S.return=v,v=S):(n(v,S),S=kp(y,v.mode,A),S.return=v,v=S),s(v)):n(v,S)}return x}var ic=Zy(!0),e6=Zy(!1),Cf=Us(null),Pf=null,Ul=null,rg=null;function ig(){rg=Ul=Pf=null}function og(t){var e=Cf.current;Vt(Cf),t._currentValue=e}function D2(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Kl(t,e){Pf=t,rg=Ul=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Pr=!0),t.firstContext=null)}function si(t){var e=t._currentValue;if(rg!==t)if(t={context:t,memoizedValue:e,next:null},Ul===null){if(Pf===null)throw Error(Le(308));Ul=t,Pf.dependencies={lanes:0,firstContext:t}}else Ul=Ul.next=t;return e}var ma=null;function sg(t){ma===null?ma=[t]:ma.push(t)}function t6(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,sg(e)):(n.next=i.next,i.next=n),e.interleaved=n,Io(t,r)}function Io(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var fs=!1;function ag(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function n6(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function To(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ps(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,vt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Io(t,n)}return i=r.interleaved,i===null?(e.next=e,sg(r)):(e.next=i.next,i.next=e),r.interleaved=e,Io(t,n)}function $d(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,H5(t,n)}}function _v(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Lf(t,e,n,r){var i=t.updateQueue;fs=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==s&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(o!==null){var p=i.baseState;s=0,d=u=l=null,a=o;do{var g=a.lane,h=a.eventTime;if((r&g)===g){d!==null&&(d=d.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var w=t,_=a;switch(g=e,h=n,_.tag){case 1:if(w=_.payload,typeof w=="function"){p=w.call(h,p,g);break e}p=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=_.payload,g=typeof w=="function"?w.call(h,p,g):w,g==null)break e;p=Jt({},p,g);break e;case 2:fs=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,g=i.effects,g===null?i.effects=[a]:g.push(a))}else h={eventTime:h,lane:g,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=h,l=p):d=d.next=h,s|=g;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;g=a,a=g.next,g.next=null,i.lastBaseUpdate=g,i.shared.pending=null}}while(!0);if(d===null&&(l=p),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Pa|=s,t.lanes=s,t.memoizedState=p}}function Sv(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Ap.transition;Ap.transition={};try{t(!1),e()}finally{Lt=n,Ap.transition=r}}function w6(){return ai().memoizedState}function R_(t,e,n){var r=ks(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},b6(t))_6(e,n);else if(n=t6(t,e,n,r),n!==null){var i=gr();Mi(n,t,r,i),S6(n,e,r)}}function B_(t,e,n){var r=ks(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(b6(t))_6(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,Fi(a,s)){var l=e.interleaved;l===null?(i.next=i,sg(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=t6(t,e,i,r),n!==null&&(i=gr(),Mi(n,t,r,i),S6(n,e,r))}}function b6(t){var e=t.alternate;return t===Qt||e!==null&&e===Qt}function _6(t,e){Eu=Ef=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function S6(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,H5(t,n)}}var Tf={readContext:si,useCallback:$n,useContext:$n,useEffect:$n,useImperativeHandle:$n,useInsertionEffect:$n,useLayoutEffect:$n,useMemo:$n,useReducer:$n,useRef:$n,useState:$n,useDebugValue:$n,useDeferredValue:$n,useTransition:$n,useMutableSource:$n,useSyncExternalStore:$n,useId:$n,unstable_isNewReconciler:!1},D_={readContext:si,useCallback:function(t,e){return Ji().memoizedState=[t,e===void 0?null:e],t},useContext:si,useEffect:Av,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Jd(4194308,4,p6.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Jd(4194308,4,t,e)},useInsertionEffect:function(t,e){return Jd(4,2,t,e)},useMemo:function(t,e){var n=Ji();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ji();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=R_.bind(null,Qt,t),[r.memoizedState,t]},useRef:function(t){var e=Ji();return t={current:t},e.memoizedState=t},useState:xv,useDebugValue:gg,useDeferredValue:function(t){return Ji().memoizedState=t},useTransition:function(){var t=xv(!1),e=t[0];return t=O_.bind(null,t[1]),Ji().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Qt,i=Ji();if(Wt){if(n===void 0)throw Error(Le(407));n=n()}else{if(n=e(),Un===null)throw Error(Le(349));Ca&30||s6(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,Av(l6.bind(null,r,o,t),[t]),r.flags|=2048,eh(9,a6.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=Ji(),e=Un.identifierPrefix;if(Wt){var n=Eo,r=ko;n=(r&~(1<<32-Ti(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Ju++,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[Zi]=e,t[Xu]=r,M6(t,e,!1,!1),e.stateNode=t;e:{switch(s=_2(n,r),n){case"dialog":Ut("cancel",t),Ut("close",t),i=r;break;case"iframe":case"object":case"embed":Ut("load",t),i=r;break;case"video":case"audio":for(i=0;iac&&(e.flags|=128,r=!0,uu(o,!1),e.lanes=4194304)}else{if(!r)if(t=kf(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),uu(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Wt)return Qn(e),null}else 2*pn()-o.renderingStartTime>ac&&n!==1073741824&&(e.flags|=128,r=!0,uu(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=pn(),e.sibling=null,n=Xt.current,Dt(Xt,r?n&1|2:n&1),e):(Qn(e),null);case 22:case 23:return _g(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Br&1073741824&&(Qn(e),e.subtreeFlags&6&&(e.flags|=8192)):Qn(e),null;case 24:return null;case 25:return null}throw Error(Le(156,e.tag))}function Y_(t,e){switch(tg(e),e.tag){case 1:return kr(e.type)&&Sf(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return oc(),Vt(Lr),Vt(ar),ug(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return cg(e),null;case 13:if(Vt(Xt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Le(340));rc()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Vt(Xt),null;case 4:return oc(),null;case 10:return og(e.type._context),null;case 22:case 23:return _g(),null;case 24:return null;default:return null}}var Ld=!1,ir=!1,K_=typeof WeakSet=="function"?WeakSet:Set,De=null;function zl(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){an(t,e,r)}else n.current=null}function K2(t,e,n){try{n()}catch(r){an(t,e,r)}}var Iv=!1;function X_(t,e){if(T2=yf,t=Dy(),Z5(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,d=0,p=t,g=null;t:for(;;){for(var h;p!==n||i!==0&&p.nodeType!==3||(a=s+i),p!==o||r!==0&&p.nodeType!==3||(l=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(h=p.firstChild)!==null;)g=p,p=h;for(;;){if(p===t)break t;if(g===n&&++u===i&&(a=s),g===o&&++d===r&&(l=s),(h=p.nextSibling)!==null)break;p=g,g=p.parentNode}p=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(M2={focusedElem:t,selectionRange:n},yf=!1,De=e;De!==null;)if(e=De,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,De=t;else for(;De!==null;){e=De;try{var w=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var _=w.memoizedProps,x=w.memoizedState,v=e.stateNode,S=v.getSnapshotBeforeUpdate(e.elementType===e.type?_:Pi(e.type,_),x);v.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var y=e.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Le(163))}}catch(A){an(e,e.return,A)}if(t=e.sibling,t!==null){t.return=e.return,De=t;break}De=e.return}return w=Iv,Iv=!1,w}function Tu(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&K2(e,n,o)}i=i.next}while(i!==r)}}function i1(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 X2(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 I6(t){var e=t.alternate;e!==null&&(t.alternate=null,I6(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Zi],delete e[Xu],delete e[I2],delete e[T_],delete e[M_])),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 O6(t){return t.tag===5||t.tag===3||t.tag===4}function Ov(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||O6(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 $2(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=_f));else if(r!==4&&(t=t.child,t!==null))for($2(t,e,n),t=t.sibling;t!==null;)$2(t,e,n),t=t.sibling}function Q2(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(Q2(t,e,n),t=t.sibling;t!==null;)Q2(t,e,n),t=t.sibling}var qn=null,ki=!1;function ss(t,e,n){for(n=n.child;n!==null;)R6(t,e,n),n=n.sibling}function R6(t,e,n){if(no&&typeof no.onCommitFiberUnmount=="function")try{no.onCommitFiberUnmount($f,n)}catch{}switch(n.tag){case 5:ir||zl(n,e);case 6:var r=qn,i=ki;qn=null,ss(t,e,n),qn=r,ki=i,qn!==null&&(ki?(t=qn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):qn.removeChild(n.stateNode));break;case 18:qn!==null&&(ki?(t=qn,n=n.stateNode,t.nodeType===8?_p(t.parentNode,n):t.nodeType===1&&_p(t,n),qu(t)):_p(qn,n.stateNode));break;case 4:r=qn,i=ki,qn=n.stateNode.containerInfo,ki=!0,ss(t,e,n),qn=r,ki=i;break;case 0:case 11:case 14:case 15:if(!ir&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&K2(n,e,s),i=i.next}while(i!==r)}ss(t,e,n);break;case 1:if(!ir&&(zl(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){an(n,e,a)}ss(t,e,n);break;case 21:ss(t,e,n);break;case 22:n.mode&1?(ir=(r=ir)||n.memoizedState!==null,ss(t,e,n),ir=r):ss(t,e,n);break;default:ss(t,e,n)}}function Rv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new K_),e.forEach(function(r){var i=i9.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function wi(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=pn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Q_(r/1960))-r,10t?16:t,bs===null)var r=!1;else{if(t=bs,bs=null,Ff=0,vt&6)throw Error(Le(331));var i=vt;for(vt|=4,De=t.current;De!==null;){var o=De,s=o.child;if(De.flags&16){var a=o.deletions;if(a!==null){for(var l=0;lpn()-wg?wa(t,0):yg|=n),Er(t,e)}function W6(t,e){e===0&&(t.mode&1?(e=wd,wd<<=1,!(wd&130023424)&&(wd=4194304)):e=1);var n=gr();t=Io(t,e),t!==null&&(hh(t,e,n),Er(t,n))}function r9(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),W6(t,n)}function i9(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(Le(314))}r!==null&&r.delete(e),W6(t,n)}var H6;H6=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Lr.current)Pr=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Pr=!1,W_(t,e,n);Pr=!!(t.flags&131072)}else Pr=!1,Wt&&e.flags&1048576&&$y(e,Nf,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Zd(t,e),t=e.pendingProps;var i=nc(e,ar.current);Kl(e,n),i=dg(null,e,r,t,i,n);var o=fg();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,kr(r)?(o=!0,xf(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ag(e),i.updater=r1,e.stateNode=i,i._reactInternals=e,z2(e,r,t,n),e=q2(null,e,r,!0,o,n)):(e.tag=0,Wt&&o&&eg(e),pr(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Zd(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=s9(r),t=Pi(r,t),i){case 0:e=V2(null,e,r,t,n);break e;case 1:e=Mv(null,e,r,t,n);break e;case 11:e=Ev(null,e,r,t,n);break e;case 14:e=Tv(null,e,r,Pi(r.type,t),n);break e}throw Error(Le(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pi(r,i),V2(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pi(r,i),Mv(t,e,r,i,n);case 3:e:{if(k6(e),t===null)throw Error(Le(387));r=e.pendingProps,o=e.memoizedState,i=o.element,n6(t,e),Lf(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=sc(Error(Le(423)),e),e=jv(t,e,r,n,i);break e}else if(r!==i){i=sc(Error(Le(424)),e),e=jv(t,e,r,n,i);break e}else for(Dr=Cs(e.stateNode.containerInfo.firstChild),zr=e,Wt=!0,Ei=null,n=e6(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(rc(),r===i){e=Oo(t,e,n);break e}pr(t,e,r,n)}e=e.child}return e;case 5:return r6(e),t===null&&B2(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,j2(r,i)?s=null:o!==null&&j2(r,o)&&(e.flags|=32),L6(t,e),pr(t,e,s,n),e.child;case 6:return t===null&&B2(e),null;case 13:return E6(t,e,n);case 4:return lg(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ic(e,null,r,n):pr(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pi(r,i),Ev(t,e,r,i,n);case 7:return pr(t,e,e.pendingProps,n),e.child;case 8:return pr(t,e,e.pendingProps.children,n),e.child;case 12:return pr(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Dt(Cf,r._currentValue),r._currentValue=s,o!==null)if(Fi(o.value,s)){if(o.children===i.children&&!Lr.current){e=Oo(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=To(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),D2(o.return,n,e),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(Le(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),D2(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}pr(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Kl(e,n),i=si(i),r=r(i),e.flags|=1,pr(t,e,r,n),e.child;case 14:return r=e.type,i=Pi(r,e.pendingProps),i=Pi(r.type,i),Tv(t,e,r,i,n);case 15:return C6(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Pi(r,i),Zd(t,e),e.tag=1,kr(r)?(t=!0,xf(e)):t=!1,Kl(e,n),x6(e,r,i),z2(e,r,i,n),q2(null,e,r,!0,t,n);case 19:return T6(t,e,n);case 22:return P6(t,e,n)}throw Error(Le(156,e.tag))};function Y6(t,e){return by(t,e)}function o9(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 ii(t,e,n,r){return new o9(t,e,n,r)}function xg(t){return t=t.prototype,!(!t||!t.isReactComponent)}function s9(t){if(typeof t=="function")return xg(t)?1:0;if(t!=null){if(t=t.$$typeof,t===G5)return 11;if(t===V5)return 14}return 2}function Es(t,e){var n=t.alternate;return n===null?(n=ii(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 nf(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")xg(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Ml:return ba(n.children,i,o,e);case z5:s=8,i|=8;break;case h2:return t=ii(12,n,e,i|2),t.elementType=h2,t.lanes=o,t;case d2:return t=ii(13,n,e,i),t.elementType=d2,t.lanes=o,t;case f2:return t=ii(19,n,e,i),t.elementType=f2,t.lanes=o,t;case ry:return s1(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ty:s=10;break e;case ny:s=9;break e;case G5:s=11;break e;case V5:s=14;break e;case ds:s=16,r=null;break e}throw Error(Le(130,t==null?t:typeof t,""))}return e=ii(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function ba(t,e,n,r){return t=ii(7,t,r,e),t.lanes=n,t}function s1(t,e,n,r){return t=ii(22,t,r,e),t.elementType=ry,t.lanes=n,t.stateNode={isHidden:!1},t}function kp(t,e,n){return t=ii(6,t,null,e),t.lanes=n,t}function Ep(t,e,n){return e=ii(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function a9(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=up(0),this.expirationTimes=up(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=up(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ag(t,e,n,r,i,o,s,a,l){return t=new a9(t,e,n,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=ii(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ag(o),t}function l9(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Q6)}catch(t){console.error(t)}}Q6(),Q4.exports=Vr;var J6=Q4.exports;const f9=Kf(J6);var Wv=J6;c2.createRoot=Wv.createRoot,c2.hydrateRoot=Wv.hydrateRoot;/** * @remix-run/router v1.21.0 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function nh(){return nh=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Z6(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function g9(){return Math.random().toString(36).substr(2,8)}function Yv(t,e){return{usr:t.state,key:t.key,idx:e}}function n5(t,e,n,r){return n===void 0&&(n=null),nh({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?mc(e):e,{state:n,key:e&&e.key||r||g9()})}function Rf(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function mc(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function m9(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,a=_s.Pop,l=null,u=d();u==null&&(u=0,s.replaceState(nh({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function p(){a=_s.Pop;let x=d(),v=x==null?null:x-u;u=x,l&&l({action:a,location:_.location,delta:v})}function g(x,v){a=_s.Push;let S=n5(_.location,x,v);u=d()+1;let y=Yv(S,u),A=_.createHref(S);try{s.pushState(y,"",A)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;i.location.assign(A)}o&&l&&l({action:a,location:_.location,delta:1})}function h(x,v){a=_s.Replace;let S=n5(_.location,x,v);u=d();let y=Yv(S,u),A=_.createHref(S);s.replaceState(y,"",A),o&&l&&l({action:a,location:_.location,delta:0})}function w(x){let v=i.location.origin!=="null"?i.location.origin:i.location.href,S=typeof x=="string"?x:Rf(x);return S=S.replace(/ $/,"%20"),yn(v,"No window.location.(origin|href) available to create URL for href: "+S),new URL(S,v)}let _={get action(){return a},get location(){return t(i,s)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Hv,p),l=x,()=>{i.removeEventListener(Hv,p),l=null}},createHref(x){return e(i,x)},createURL:w,encodeLocation(x){let v=w(x);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:g,replace:h,go(x){return s.go(x)}};return _}var Kv;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Kv||(Kv={}));function v9(t,e,n){return n===void 0&&(n="/"),y9(t,e,n,!1)}function y9(t,e,n,r){let i=typeof e=="string"?mc(e):e,o=Lg(i.pathname||"/",n);if(o==null)return null;let s=e8(t);w9(s);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};l.relativePath.startsWith("/")&&(yn(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Ts([r,l.relativePath]),d=n.concat(l);o.children&&o.children.length>0&&(yn(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),e8(o.children,e,d,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:C9(u,o.index),routesMeta:d})};return t.forEach((o,s)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))i(o,s);else for(let l of t8(o.path))i(o,s,l)}),e}function t8(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let s=t8(r.join("/")),a=[];return a.push(...s.map(l=>l===""?o:[o,l].join("/"))),i&&a.push(...s),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function w9(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:P9(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const b9=/^:[\w-]+$/,_9=3,S9=2,x9=1,A9=10,N9=-2,Xv=t=>t==="*";function C9(t,e){let n=t.split("/"),r=n.length;return n.some(Xv)&&(r+=N9),e&&(r+=S9),n.filter(i=>!Xv(i)).reduce((i,o)=>i+(b9.test(o)?_9:o===""?x9:A9),r)}function P9(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function L9(t,e,n){let{routesMeta:r}=t,i={},o="/",s=[];for(let a=0;a{let{paramName:g,isOptional:h}=d;if(g==="*"){let _=a[p]||"";s=o.slice(0,o.length-_.length).replace(/(.)\/+$/,"$1")}const w=a[p];return h&&!w?u[g]=void 0:u[g]=(w||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:s,pattern:t}}function k9(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Z6(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function E9(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Z6(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Lg(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function T9(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?mc(t):t;return{pathname:n?n.startsWith("/")?n:M9(n,e):e,search:I9(r),hash:O9(i)}}function M9(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Tp(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function j9(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function kg(t,e){let n=j9(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Eg(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=mc(t):(i=nh({},t),yn(!i.pathname||!i.pathname.includes("?"),Tp("?","pathname","search",i)),yn(!i.pathname||!i.pathname.includes("#"),Tp("#","pathname","hash",i)),yn(!i.search||!i.search.includes("#"),Tp("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,a;if(s==null)a=n;else{let p=e.length-1;if(!r&&s.startsWith("..")){let g=s.split("/");for(;g[0]==="..";)g.shift(),p-=1;i.pathname=g.join("/")}a=p>=0?e[p]:"/"}let l=T9(i,a),u=s&&s!=="/"&&s.endsWith("/"),d=(o||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const Ts=t=>t.join("/").replace(/\/\/+/g,"/"),F9=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),I9=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,O9=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function R9(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const n8=["post","put","patch","delete"];new Set(n8);const B9=["get",...n8];new Set(B9);/** * React Router v6.28.0 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function rh(){return rh=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),re.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let p=Eg(u,JSON.parse(s),o,d.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:Ts([e,p.pathname])),(d.replace?r.replace:r.push)(p,d.state,d)},[e,r,s,o,t])}const G9=re.createContext(null);function V9(t){let e=re.useContext(so).outlet;return e&&re.createElement(G9.Provider,{value:t},e)}function o8(){let{matches:t}=re.useContext(so),e=t[t.length-1];return e?e.params:{}}function s8(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=re.useContext(Gs),{matches:i}=re.useContext(so),{pathname:o}=Do(),s=JSON.stringify(kg(i,r.v7_relativeSplatPath));return re.useMemo(()=>Eg(t,JSON.parse(s),o,n==="path"),[t,s,o,n])}function q9(t,e){return W9(t,e)}function W9(t,e,n,r){vc()||yn(!1);let{navigator:i}=re.useContext(Gs),{matches:o}=re.useContext(so),s=o[o.length-1],a=s?s.params:{};s&&s.pathname;let l=s?s.pathnameBase:"/";s&&s.route;let u=Do(),d;if(e){var p;let x=typeof e=="string"?mc(e):e;l==="/"||(p=x.pathname)!=null&&p.startsWith(l)||yn(!1),d=x}else d=u;let g=d.pathname||"/",h=g;if(l!=="/"){let x=l.replace(/^\//,"").split("/");h="/"+g.replace(/^\//,"").split("/").slice(x.length).join("/")}let w=v9(t,{pathname:h}),_=$9(w&&w.map(x=>Object.assign({},x,{params:Object.assign({},a,x.params),pathname:Ts([l,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:Ts([l,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),o,n,r);return e&&_?re.createElement(h1.Provider,{value:{location:rh({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:_s.Pop}},_):_}function H9(){let t=eS(),e=R9(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return re.createElement(re.Fragment,null,re.createElement("h2",null,"Unexpected Application Error!"),re.createElement("h3",{style:{fontStyle:"italic"}},e),n?re.createElement("pre",{style:i},n):null,null)}const Y9=re.createElement(H9,null);class K9 extends re.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?re.createElement(so.Provider,{value:this.props.routeContext},re.createElement(r8.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function X9(t){let{routeContext:e,match:n,children:r}=t,i=re.useContext(Tg);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),re.createElement(so.Provider,{value:e},r)}function $9(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var o;if(!n)return null;if(n.errors)t=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let d=s.findIndex(p=>p.route.id&&(a==null?void 0:a[p.route.id])!==void 0);d>=0||yn(!1),s=s.slice(0,Math.min(s.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,p,g)=>{let h,w=!1,_=null,x=null;n&&(h=a&&p.route.id?a[p.route.id]:void 0,_=p.route.errorElement||Y9,l&&(u<0&&g===0?(w=!0,x=null):u===g&&(w=!0,x=p.route.hydrateFallbackElement||null)));let v=e.concat(s.slice(0,g+1)),S=()=>{let y;return h?y=_:w?y=x:p.route.Component?y=re.createElement(p.route.Component,null):p.route.element?y=p.route.element:y=d,re.createElement(X9,{match:p,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:y})};return n&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?re.createElement(K9,{location:n.location,revalidation:n.revalidation,component:_,error:h,children:S(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):S()},null)}var a8=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(a8||{}),Bf=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Bf||{});function Q9(t){let e=re.useContext(Tg);return e||yn(!1),e}function J9(t){let e=re.useContext(D9);return e||yn(!1),e}function Z9(t){let e=re.useContext(so);return e||yn(!1),e}function l8(t){let e=Z9(),n=e.matches[e.matches.length-1];return n.route.id||yn(!1),n.route.id}function eS(){var t;let e=re.useContext(r8),n=J9(Bf.UseRouteError),r=l8(Bf.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function tS(){let{router:t}=Q9(a8.UseNavigateStable),e=l8(Bf.UseNavigateStable),n=re.useRef(!1);return i8(()=>{n.current=!0}),re.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,rh({fromRouteId:e},o)))},[t,e])}const Qv={};function nS(t,e){Qv[e]||(Qv[e]=!0,console.warn(e))}const Jv=(t,e,n)=>nS(t,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+t+"` future flag to opt-in early. ")+("For more information, see "+n+"."));function rS(t,e){t!=null&&t.v7_startTransition||Jv("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(t!=null&&t.v7_relativeSplatPath)&&!e&&Jv("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath")}function iS(t){let{to:e,replace:n,state:r,relative:i}=t;vc()||yn(!1);let{future:o,static:s}=re.useContext(Gs),{matches:a}=re.useContext(so),{pathname:l}=Do(),u=ao(),d=Eg(e,kg(a,o.v7_relativeSplatPath),l,i==="path"),p=JSON.stringify(d);return re.useEffect(()=>u(JSON.parse(p),{replace:n,state:r,relative:i}),[u,p,i,n,r]),null}function oS(t){return V9(t.context)}function Rr(t){yn(!1)}function sS(t){let{basename:e="/",children:n=null,location:r,navigationType:i=_s.Pop,navigator:o,static:s=!1,future:a}=t;vc()&&yn(!1);let l=e.replace(/^\/*/,"/"),u=re.useMemo(()=>({basename:l,navigator:o,static:s,future:rh({v7_relativeSplatPath:!1},a)}),[l,a,o,s]);typeof r=="string"&&(r=mc(r));let{pathname:d="/",search:p="",hash:g="",state:h=null,key:w="default"}=r,_=re.useMemo(()=>{let x=Lg(d,l);return x==null?null:{location:{pathname:x,search:p,hash:g,state:h,key:w},navigationType:i}},[l,d,p,g,h,w,i]);return _==null?null:re.createElement(Gs.Provider,{value:u},re.createElement(h1.Provider,{children:n,value:_}))}function aS(t){let{children:e,location:n}=t;return q9(r5(e),n)}new Promise(()=>{});function r5(t,e){e===void 0&&(e=[]);let n=[];return re.Children.forEach(t,(r,i)=>{if(!re.isValidElement(r))return;let o=[...e,i];if(r.type===re.Fragment){n.push.apply(n,r5(r.props.children,o));return}r.type!==Rr&&yn(!1),!r.props.index||!r.props.children||yn(!1);let s={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=r5(r.props.children,o)),n.push(s)}),n}/** * React Router DOM v6.28.0 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function i5(){return i5=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function cS(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function uS(t,e){return t.button===0&&(!e||e==="_self")&&!cS(t)}function o5(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function hS(t,e){let n=o5(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(o=>{n.append(i,o)})}),n}const dS=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],fS="6";try{window.__reactRouterVersion=fS}catch{}const pS="startTransition",Zv=nb[pS];function gS(t){let{basename:e,children:n,future:r,window:i}=t,o=re.useRef();o.current==null&&(o.current=p9({window:i,v5Compat:!0}));let s=o.current,[a,l]=re.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},d=re.useCallback(p=>{u&&Zv?Zv(()=>l(p)):l(p)},[l,u]);return re.useLayoutEffect(()=>s.listen(d),[s,d]),re.useEffect(()=>rS(r),[r]),re.createElement(sS,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:s,future:r})}const mS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",vS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ro=re.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:o,replace:s,state:a,target:l,to:u,preventScrollReset:d,viewTransition:p}=e,g=lS(e,dS),{basename:h}=re.useContext(Gs),w,_=!1;if(typeof u=="string"&&vS.test(u)&&(w=u,mS))try{let y=new URL(window.location.href),A=u.startsWith("//")?new URL(y.protocol+u):new URL(u),L=Lg(A.pathname,h);A.origin===y.origin&&L!=null?u=L+A.search+A.hash:_=!0}catch{}let x=U9(u,{relative:i}),v=yS(u,{replace:s,state:a,target:l,preventScrollReset:d,relative:i,viewTransition:p});function S(y){r&&r(y),y.defaultPrevented||v(y)}return re.createElement("a",i5({},g,{href:w||x,onClick:_||o?r:S,ref:n,target:l}))});var e3;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(e3||(e3={}));var t3;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(t3||(t3={}));function yS(t,e){let{target:n,replace:r,state:i,preventScrollReset:o,relative:s,viewTransition:a}=e===void 0?{}:e,l=ao(),u=Do(),d=s8(t,{relative:s});return re.useCallback(p=>{if(uS(p,n)){p.preventDefault();let g=r!==void 0?r:Rf(u)===Rf(d);l(t,{replace:g,state:i,preventScrollReset:o,relative:s,viewTransition:a})}},[u,l,d,r,i,n,t,o,s,a])}function c8(t){let e=re.useRef(o5(t)),n=re.useRef(!1),r=Do(),i=re.useMemo(()=>hS(r.search,n.current?null:e.current),[r.search]),o=ao(),s=re.useCallback((a,l)=>{const u=o5(typeof a=="function"?a(i):a);n.current=!0,o("?"+u,l)},[o,i]);return[i,s]}const wS="_container_lfw20_3",bS="_searchBar_lfw20_18",_S="_filterBar_lfw20_40",SS="_tile_lfw20_45",xS="_imgStyle_lfw20_67",AS="_favorite_lfw20_73",NS="_dragging_lfw20_81",CS="_linkStyle_lfw20_89",ys={container:wS,searchBar:bS,filterBar:_S,tile:SS,imgStyle:xS,favorite:AS,dragging:NS,linkStyle:CS};var fn=function(){return fn=Object.assign||function(e){for(var n,r=1,i=arguments.length;r0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function Fu(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;rn?+n3(t-n,n-e,r)+n:t}function LS(t,[e,n],[r,i]){const[[o,s],[a,l]]=t;return[r3(e,o,s,r),r3(n,a,l,i)]}function kS(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ES(t){var e=kS(t,"string");return typeof e=="symbol"?e:String(e)}function Nr(t,e,n){return e=ES(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i3(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 $t(t){for(var e=1;e{var n,r;return e.target===t.currentTarget||((n=t.currentTarget)===null||n===void 0||(r=n.contains)===null||r===void 0?void 0:r.call(n,e.target))})}function BS(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function f8(t){return d1(t)?BS(t)[0]:t}function DS(t){return RS(t).map(e=>e.identifier)}function Mp(t){const e=f8(t);return d1(t)?e.identifier:e.pointerId}function s3(t){const e=f8(t);return[e.clientX,e.clientY]}function US(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:n,altKey:r,metaKey:i,ctrlKey:o}=t;Object.assign(e,{shiftKey:n,altKey:r,metaKey:i,ctrlKey:o})}return e}function Df(t,...e){return typeof t=="function"?t(...e):t}function zS(){}function GS(...t){return t.length===0?zS:t.length===1?t[0]:function(){let e;for(const n of t)e=n.apply(this,arguments)||e;return e}}function a3(t,e){return Object.assign({},e,t||{})}const VS=32;class qS{constructor(e,n,r){this.ctrl=e,this.args=n,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:n,ingKey:r,args:i}=this;n[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const n=this.state,r=this.config;n._active||(this.reset(),this.computeInitial(),n._active=!0,n.target=e.target,n.currentTarget=e.currentTarget,n.lastOffset=r.from?Df(r.from,n):n.offset,n.offset=n.lastOffset,n.startTime=n.timeStamp=e.timeStamp)}computeValues(e){const n=this.state;n._values=e,n.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:n,config:r,shared:i}=this;n.args=this.args;let o=0;if(e&&(n.event=e,r.preventDefault&&e.cancelable&&n.event.preventDefault(),n.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,US(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,o=e.timeStamp-n.timeStamp,n.timeStamp=e.timeStamp,n.elapsedTime=n.timeStamp-n.startTime),n._active){const R=n._delta.map(Math.abs);sr.addTo(n._distance,R)}this.axisIntent&&this.axisIntent(e);const[s,a]=n._movement,[l,u]=r.threshold,{_step:d,values:p}=n;if(r.hasCustomTransform?(d[0]===!1&&(d[0]=Math.abs(s)>=l&&p[0]),d[1]===!1&&(d[1]=Math.abs(a)>=u&&p[1])):(d[0]===!1&&(d[0]=Math.abs(s)>=l&&Math.sign(s)*l),d[1]===!1&&(d[1]=Math.abs(a)>=u&&Math.sign(a)*u)),n.intentional=d[0]!==!1||d[1]!==!1,!n.intentional)return;const g=[0,0];if(r.hasCustomTransform){const[R,D]=p;g[0]=d[0]!==!1?R-d[0]:0,g[1]=d[1]!==!1?D-d[1]:0}else g[0]=d[0]!==!1?s-d[0]:0,g[1]=d[1]!==!1?a-d[1]:0;this.restrictToAxis&&!n._blocked&&this.restrictToAxis(g);const h=n.offset,w=n._active&&!n._blocked||n.active;w&&(n.first=n._active&&!n.active,n.last=!n._active&&n.active,n.active=i[this.ingKey]=n._active,e&&(n.first&&("bounds"in r&&(n._bounds=Df(r.bounds,n)),this.setup&&this.setup()),n.movement=g,this.computeOffset()));const[_,x]=n.offset,[[v,S],[y,A]]=n._bounds;n.overflow=[_S?1:0,xA?1:0],n._movementBound[0]=n.overflow[0]?n._movementBound[0]===!1?n._movement[0]:n._movementBound[0]:!1,n._movementBound[1]=n.overflow[1]?n._movementBound[1]===!1?n._movement[1]:n._movementBound[1]:!1;const L=n._active?r.rubberband||[0,0]:[0,0];if(n.offset=LS(n._bounds,n.offset,L),n.delta=sr.sub(n.offset,h),this.computeMovement(),w&&(!n.last||o>VS)){n.delta=sr.sub(n.offset,h);const R=n.delta.map(Math.abs);sr.addTo(n.distance,R),n.direction=n.delta.map(Math.sign),n._direction=n._delta.map(Math.sign),!n.first&&o>0&&(n.velocity=[R[0]/o,R[1]/o],n.timeDelta=o)}}emit(){const e=this.state,n=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const i=this.handler($t($t($t({},n),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function WS([t,e],n){const r=Math.abs(t),i=Math.abs(e);if(r>i&&r>n)return"x";if(i>r&&i>n)return"y"}class HS extends qS{constructor(...e){super(...e),Nr(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=sr.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=sr.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const n=this.state,r=this.config;if(!n.axis&&e){const i=typeof r.axisThreshold=="object"?r.axisThreshold[d8(e)]:r.axisThreshold;n.axis=WS(n._movement,i)}n._blocked=(r.lockDirection||!!r.axis)&&!n.axis||!!r.axis&&r.axis!==n.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const YS=t=>t,l3=.15,p8={enabled(t=!0){return t},eventOptions(t,e,n){return $t($t({},n.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[l3,l3];case!1:return[0,0];default:return sr.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return sr.toVector(t)},transform(t,e,n){const r=t||n.shared.transform;return this.hasCustomTransform=!!r,r||YS},threshold(t){return sr.toVector(t,0)}},KS=0,gh=$t($t({},p8),{},{axis(t,e,{axis:n}){if(this.lockDirection=n==="lock",!this.lockDirection)return n},axisThreshold(t=KS){return t},bounds(t={}){if(typeof t=="function")return o=>gh.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:n=1/0,top:r=-1/0,bottom:i=1/0}=t;return[[e,n],[r,i]]}}),c3={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class XS extends HS{constructor(...e){super(...e),Nr(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const n=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),i={left:n.left-r.left+e.offset[0],right:n.right-r.right+e.offset[0],top:n.top-r.top+e.offset[1],bottom:n.bottom-r.bottom+e.offset[1]};e._bounds=gh.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const n=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(n.pointerButtons)?!n.pointerButtons.includes(e.buttons):n.pointerButtons!==-1&&n.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);n.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=Mp(e),r._pointerActive=!0,this.computeValues(s3(e)),this.computeInitial(),n.preventScrollAxis&&d8(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):n.delay>0?(this.setupDelayTrigger(e),n.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const n=this.state;n._active=!0,n._preventScroll=!0,n._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const n=this.state,r=this.config;if(!n._pointerActive)return;const i=Mp(e);if(n._pointerId!==void 0&&i!==n._pointerId)return;const o=s3(e);if(document.pointerLockElement===e.target?n._delta=[e.movementX,e.movementY]:(n._delta=sr.sub(o,n._values),this.computeValues(o)),sr.addTo(n._movement,n._delta),this.compute(e),n._delayed&&n.intentional){this.timeoutStore.remove("dragDelay"),n.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!n._preventScroll)if(n.axis)if(n.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){n._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const n=this.state,r=this.config;if(!n._active||!n._pointerActive)return;const i=Mp(e);if(n._pointerId!==void 0&&i!==n._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,s]=n._distance;if(n.tap=o<=r.tapsThreshold&&s<=r.tapsThreshold,n.tap&&r.filterTaps)n._force=!0;else{const[a,l]=n._delta,[u,d]=n._movement,[p,g]=r.swipe.velocity,[h,w]=r.swipe.distance,_=r.swipe.duration;if(n.elapsedTime<_){const x=Math.abs(a/n.timeDelta),v=Math.abs(l/n.timeDelta);x>p&&Math.abs(u)>h&&(n.swipe[0]=Math.sign(a)),v>g&&Math.abs(d)>w&&(n.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const n=this.config,r=n.device;n.pointerLock&&e.currentTarget.requestPointerLock(),n.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,$S(e);const n=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",n),this.eventStore.add(this.sharedConfig.window,"touch","cancel",n),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const n=c3[e.key];if(n){const r=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=n(this.config.keyboardDisplacement,i),r._keyboardActive=!0,sr.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in c3&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const n=this.config.device;e(n,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(n,"change",this.pointerMove.bind(this)),e(n,"end",this.pointerUp.bind(this)),e(n,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function $S(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const mh=typeof window<"u"&&window.document&&window.document.createElement;function g8(){return mh&&"ontouchstart"in window}function QS(){return g8()||mh&&window.navigator.maxTouchPoints>1}function JS(){return mh&&"onpointerdown"in window}function ZS(){return mh&&"exitPointerLock"in window.document}function ex(){try{return"constructor"in GestureEvent}catch{return!1}}const ri={isBrowser:mh,gesture:ex(),touch:g8(),touchscreen:QS(),pointer:JS(),pointerLock:ZS()},tx=250,nx=180,rx=.5,ix=50,ox=250,sx=10,u3={mouse:0,touch:0,pen:8},ax=$t($t({},gh),{},{device(t,e,{pointer:{touch:n=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&ri.pointerLock,ri.touch&&n?"touch":this.pointerLock?"mouse":ri.pointer&&!i?"pointer":ri.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:n}){if(this.preventScrollDelay=typeof n=="number"?n:n||n===void 0&&t?tx:void 0,!(!ri.touchscreen||n===!1))return t||(n!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:n=!0,buttons:r=1,keys:i=!0}={}}){return this.pointerButtons=r,this.keys=i,!this.pointerLock&&this.device==="pointer"&&n},threshold(t,e,{filterTaps:n=!1,tapsThreshold:r=3,axis:i=void 0}){const o=sr.toVector(t,n?r:i?1:0);return this.filterTaps=n,this.tapsThreshold=r,o},swipe({velocity:t=rx,distance:e=ix,duration:n=ox}={}){return{velocity:this.transform(sr.toVector(t)),distance:this.transform(sr.toVector(e)),duration:n}},delay(t=0){switch(t){case!0:return nx;case!1:return 0;default:return t}},axisThreshold(t){return t?$t($t({},u3),t):u3},keyboardDisplacement(t=sx){return t}});$t($t({},p8),{},{device(t,e,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!ri.touch&&ri.gesture)return"gesture";if(ri.touch&&r)return"touch";if(ri.touchscreen){if(ri.pointer)return"pointer";if(ri.touch)return"touch"}},bounds(t,e,{scaleBounds:n={},angleBounds:r={}}){const i=s=>{const a=a3(Df(n,s),{min:-1/0,max:1/0});return[a.min,a.max]},o=s=>{const a=a3(Df(r,s),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof n!="function"&&typeof r!="function"?[i(),o()]:s=>[i(s),o(s)]},threshold(t,e,n){return this.lockDirection=n.axis==="lock",sr.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});$t($t({},gh),{},{mouseOnly:(t=!0)=>t});$t($t({},gh),{},{mouseOnly:(t=!0)=>t});const m8=new Map,s5=new Map;function lx(t){m8.set(t.key,t.engine),s5.set(t.key,t.resolver)}const cx={key:"drag",engine:XS,resolver:ax};function ux(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function hx(t,e){if(t==null)return{};var n=ux(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}const dx={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=ri.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},fx=["target","eventOptions","window","enabled","transform"];function rf(t={},e){const n={};for(const[r,i]of Object.entries(e))switch(typeof i){case"function":n[r]=i.call(n,t[r],r,t);break;case"object":n[r]=rf(t[r],i);break;case"boolean":i&&(n[r]=t[r]);break}return n}function px(t,e,n={}){const r=t,{target:i,eventOptions:o,window:s,enabled:a,transform:l}=r,u=hx(r,fx);if(n.shared=rf({target:i,eventOptions:o,window:s,enabled:a,transform:l},dx),e){const d=s5.get(e);n[e]=rf($t({shared:n.shared},u),d)}else for(const d in u){const p=s5.get(d);p&&(n[d]=rf($t({shared:n.shared},u[d]),p))}return n}class v8{constructor(e,n){Nr(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=n}add(e,n,r,i,o){const s=this._listeners,a=OS(n,r),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=$t($t({},l),o);e.addEventListener(a,i,u);const d=()=>{e.removeEventListener(a,i,u),s.delete(d)};return s.add(d),d}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class gx{constructor(){Nr(this,"_timeouts",new Map)}add(e,n,r=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(n,r,...i))}remove(e){const n=this._timeouts.get(e);n&&window.clearTimeout(n)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class mx{constructor(e){Nr(this,"gestures",new Set),Nr(this,"_targetEventStore",new v8(this)),Nr(this,"gestureEventStores",{}),Nr(this,"gestureTimeoutStores",{}),Nr(this,"handlers",{}),Nr(this,"config",{}),Nr(this,"pointerIds",new Set),Nr(this,"touchIds",new Set),Nr(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),vx(this,e)}setEventIds(e){if(d1(e))return this.touchIds=new Set(DS(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,n){this.handlers=e,this.nativeHandlers=n}applyConfig(e,n){this.config=px(e,n,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const n=this.config.shared,r={};let i;if(!(n.target&&(i=n.target(),!i))){if(n.enabled){for(const s of this.gestures){const a=this.config[s],l=h3(r,a.eventOptions,!!i);if(a.enabled){const u=m8.get(s);new u(this,e,s).bind(l)}}const o=h3(r,n.eventOptions,!!i);for(const s in this.nativeHandlers)o(s,"",a=>this.nativeHandlers[s]($t($t({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const o in r)r[o]=GS(...r[o]);if(!i)return r;for(const o in r){const{device:s,capture:a,passive:l}=IS(o);this._targetEventStore.add(i,s,"",r[o],{capture:a,passive:l})}}}}function bl(t,e){t.gestures.add(e),t.gestureEventStores[e]=new v8(t,e),t.gestureTimeoutStores[e]=new gx}function vx(t,e){e.drag&&bl(t,"drag"),e.wheel&&bl(t,"wheel"),e.scroll&&bl(t,"scroll"),e.move&&bl(t,"move"),e.pinch&&bl(t,"pinch"),e.hover&&bl(t,"hover")}const h3=(t,e,n)=>(r,i,o,s={},a=!1)=>{var l,u;const d=(l=s.capture)!==null&&l!==void 0?l:e.capture,p=(u=s.passive)!==null&&u!==void 0?u:e.passive;let g=a?r:jS(r,i,d);n&&p&&(g+="Passive"),t[g]=t[g]||[],t[g].push(o)};function yx(t,e={},n,r){const i=Lo.useMemo(()=>new mx(t),[]);if(i.applyHandlers(t,r),i.applyConfig(e,n),Lo.useEffect(i.effect.bind(i)),Lo.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function wx(t,e){return lx(cx),yx({drag:t},e||{},"drag")}var y8=function(t,e,n){return new Array(t).fill(null).map(function(r){return new Array(e).fill(n)})},bx=function(t){return Fu([],Is(t)).map(function(e){return Fu([],Is(e))})},Ma=function(t){var e=t.length,n=e?t[0].length:0;return{rows:e,cols:n}},_x=function(t){return!t.find(function(e){return!!e})},w8=function(t,e){var n=e.col,r=e.row,i=Ma(t),o=i.cols,s=i.rows;return{col:n<0?0:n>=o?o-1:n,row:r<0?0:r>=s?s-1:r}},b8=function(t,e,n,r){var i=r.elementWidth,o=r.elementHeight,s=Math.floor(e/i),a=Math.floor(n/o);return w8(t,{col:s,row:a})},Sx=function(t,e){for(var n=Ma(e),r=n.rows,i=n.cols,o=t.row;or||s>i||e[o][s])return!1;return!0},of=function(t,e,n){for(var r=bx(n),i=t.row;i=a))for(var d=function(g){if(g>=l)return"continue";var h=t[u][g];h&&!o.find(function(w){return w.data===h.data})&&o.push(h)},p=n;p=e.col&&a.xo*e.colSpan-s)return"right";if(t.row<=e.row&&a.y>i*e.rowSpan-s)return"bottom";if(t.row>=e.row&&a.ys&&a.ys&&a.y=0?T[W-1]:void 0;return B===d?void 0:{insertionPoint:{right:E,left:(B==null?void 0:B.row)===E.row?B:void 0}}}else{var Q=W+1A.cols)return;var k=s[y.row][D];if(!k)return;var z=(e=x(_,R==="left"?"right":"left",k))===null||e===void 0?void 0:e.insertionPoint;return console.log("SHIFTING: ",{shiftedInsertionPoint:z,touchPoint:R}),{insertionPoint:{left:R==="left"?z==null?void 0:z.right:void 0,right:R==="right"?z==null?void 0:z.left:void 0}}}return x(_,R,L)}}}}},onDragEnd:function(t){var e=t.state,n=e.insertionPoint,r=e.draggingTile,i=e.tiles;if(console.log("Drag end start:",{insertionPoint:n,draggingTile:r,tiles:i}),!(!i||!r||!n)){var o=i.filter(function(p){return p.data!==r.data}),s=n.left,a=n.right,l=s?o.findIndex(function(p){return p.data===s.data})+1:-1,u=a?o.findIndex(function(p){return p.data===a.data}):-1,d=l>0?l:u;return d<0?o.push(r):o.splice(d,0,r),console.log("Drag end:",{insertionPoint:n,insertionLeftIdx:l,insertionRightIdx:u,draggingTile:r,tiles:i,newTiles:o}),{tiles:o}}}},Px=function(t){var e=t.enabled,n=t.strategy,r=t.elementWidth,i=t.elementHeight,o=t.activeBorderSize,s=t.columns,a=t.currentTiles,l=t.canAcceptDrop,u=t.changeTilesOrder,d=t.didDrop,p=n==="reorder"?Cx:Nx,g=Is(re.useState({dragging:!1,droppable:!1}),2),h=g[0],w=g[1],_=h.tiles,x=h.dragging,v=h.insertionPoint,S=e&&x&&_||a,y=re.useMemo(function(){return Ax(S,s)},[S,s]),A=re.useMemo(function(){return xx(y)},[y]),L={elementHeight:i,elementWidth:r,activeBorderSize:o,columns:s},R=wx(function(T){var P=Is(T.args,1),E=P[0],W=T.dragging,B=T.tap,Q=T.xy,ee=T.movement,se=T.event;if(W)if(B||(se.preventDefault(),se.stopPropagation()),h.dragging){var X=p.onDragMove({offsetX:ee[0],offsetY:ee[1],canAcceptDrop:l,config:L,state:h,table:y})||{};w(function(G){return fn(fn(fn({},G),{offset:{x:ee[0],y:ee[1]},dropTargetTile:void 0,droppable:!1,insertionPoint:void 0}),X)})}else{var K=se.currentTarget.getBoundingClientRect(),te=A.find(function(G){return G.data===E});if(!te)return;w({dragging:!0,droppable:!1,tiles:A,draggingTile:te,dragPosition:{x:Q[0]-K.x,y:Q[1]-K.y},offset:{x:ee[0],y:ee[1]},start:{col:te.col,row:te.row}})}else{if(h.draggingTile&&h.dropTargetTile&&h.droppable)d(h.draggingTile,h.dropTargetTile);else{var de=p.onDragEnd({offsetX:ee[0],offsetY:ee[1],canAcceptDrop:l,config:L,state:h,table:y})||{},M=fn(fn({},h),de);M.tiles&&u(M.tiles)}w({dragging:!1,droppable:!1})}},{filterTaps:!0,enabled:e}),D=re.useMemo(function(){return e?A.map(function(T){var P,E,W,B,Q,ee,se,K,te,X,de,M,G,H;return fn(fn({},T),{tileWidth:r,tileHeight:i,isDragging:T.data===((P=h.draggingTile)===null||P===void 0?void 0:P.data),isDropTarget:T.data===((E=h.dropTargetTile)===null||E===void 0?void 0:E.data),insertAtLeft:T.data===((B=(W=h.insertionPoint)===null||W===void 0?void 0:W.left)===null||B===void 0?void 0:B.data),insertAtRight:T.data===((ee=(Q=h.insertionPoint)===null||Q===void 0?void 0:Q.right)===null||ee===void 0?void 0:ee.data),isDroppable:T.data===((se=h.draggingTile)===null||se===void 0?void 0:se.data)&&h.droppable,isDroppableAtInsertPosition:!!(T.data===((K=h.draggingTile)===null||K===void 0?void 0:K.data)&&h.insertionPoint),x:T.data===((te=h.draggingTile)===null||te===void 0?void 0:te.data)?(((X=h.start)===null||X===void 0?void 0:X.col)||0)*r+(((de=h.offset)===null||de===void 0?void 0:de.x)||0):T.col*r,y:T.data===((M=h.draggingTile)===null||M===void 0?void 0:M.data)?(((G=h.start)===null||G===void 0?void 0:G.row)||0)*i+(((H=h.offset)===null||H===void 0?void 0:H.y)||0):T.row*i})}).sort(function(T,P){return T.key-P.key}):A.map(function(T){return fn(fn({},T),{tileWidth:r,tileHeight:i,isDragging:!1,isDropTarget:!1,isDroppable:!1,isDroppableAtInsertPosition:!1,insertAtLeft:!1,insertAtRight:!1,x:T.col*r,y:T.row*i})}).sort(function(T,P){return T.key-P.key})},[h,A,i,r,e]),k=h.draggingTile,z=re.useMemo(function(){var T=v||{},P=T.left,E=T.right;if(P)return{x:(P.col+P.colSpan)*r,y:P.row*i};if(E)return{x:E.col*r,y:E.row*i};if(k)return{x:k.col*r,y:k.row*i}},[v,i,r,k]);return{table:y,tableHeight:y.length*i,tiles:A,insertIndicatorPosition:z,bind:R,renderTileProps:D}},Lx=function(){},A8=typeof window<"u",kx=A8?re.useLayoutEffect:re.useEffect,N8={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function Ex(){var t=re.useState(null),e=t[0],n=t[1],r=re.useState(N8),i=r[0],o=r[1],s=re.useMemo(function(){return new window.ResizeObserver(function(a){if(a[0]){var l=a[0].contentRect,u=l.x,d=l.y,p=l.width,g=l.height,h=l.top,w=l.left,_=l.bottom,x=l.right;o({x:u,y:d,width:p,height:g,top:h,left:w,bottom:_,right:x})}})},[]);return kx(function(){if(e)return s.observe(e),function(){s.disconnect()}},[e]),[n,i]}const Tx=A8&&typeof window.ResizeObserver<"u"?Ex:function(){return[Lx,N8]};var Td={container:"TilesContainer-module_container__2hgud",tile:"TilesContainer-module_tile__1R3DP",dragging:"TilesContainer-module_dragging__2mUA2",indicator:"TilesContainer-module_indicator__t_Y_b"},Mx=function(){for(var t=[],e=0;e-1&&t%1==0&&t-1&&t%1==0&&t<=lA}function cA(t){return t!=null&&T8(t.length)&&!k8(t)}var uA=Object.prototype;function hA(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||uA;return t===n}function dA(t,e){for(var n=-1,r=Array(t);++n-1}function wN(t,e){var n=this.__data__,r=f1(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function zo(t){var e=-1,n=t==null?0:t.length;for(this.clear();++ea))return!1;var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var p=-1,g=!0,h=n&QN?new zf:void 0;for(o.set(t,e),o.set(e,t);++pt?`${Rn}/room-types`:`${jd}/room-types`,add:`${Rn}/room-types/add`},floors:{add:`${Rn}/floors/add`,load:`${Rn}/my-maps/load`,delete:`${Rn}/floors/delete`},view_maps:{display:`${jd}/maps`,load:t=>t?`${Rn}/load-map`:`${jd}/load-map`,navigate:`${jd}/navigate`,add_favourite:`${Rn}/favourites/add`,add_report:`${Rn}/reports/create`},favourites:{display:`${Rn}/favourites`,add:`${Rn}/favourites/add`,delete:`${Rn}/favourites/delete`},auth:{login:`${Rp}/login`,register:`${Rp}/register`,verify:`${Rp}/verify`,oauth:{github:{state:`${ei}/oauth/state`,redirectUri:`${ei}/oauth/callback`}}},admin:{display:`${ei}/admin`,load_pr:`${ei}/admin/load-pr`,approve_pr:`${ei}/admin/pr/approve`,deny_pr:`${ei}/admin/pr/deny`,load_reports:`${ei}/admin/load-reports`}};class It{constructor(e=!1){this.auth=e,this.responseType="json"}setAuthenticated(){this.auth=!0}setResponseType(e){e==="text"?this.responseType="text":e==="json"?this.responseType="json":console.error("unsupported response type in http service")}async request(e,n,r=null){const i={method:e,headers:{"Content-Type":"application/json"}};if(this.auth){const s=localStorage.getItem("token");if(s)i.headers.Authorization=`Bearer ${s}`;else throw new Error("No token found!")}r&&(i.body=JSON.stringify(r));const o=await fetch(`${n}`,i);if(!o.ok){switch(o.status){case 401:console.log("Unauthorized: Invalid token or session expired");break;case 403:console.log("Forbidden: You don't have permission to access this resource"),window.location.href="/Login";break;case 500:console.log("Server error: Try again later");break;default:console.log(`Unexpected error: ${o.status}`)}throw new Error(`Error! status: ${o.status}`)}if(console.log("HTTPSERVICE: RESPONSE:",o),this.responseType==="json")return o.json();if(this.responseType==="text")return o.text();console.error("bad resp type")}get(e){return this.request("GET",e)}post(e,n){return this.request("POST",e,n)}put(e,n){return this.request("PUT",e,n)}delete(e){return this.request("DELETE",e)}}const kC="/assets/novo_logo_nobg_cropped-CwjcgfS6.png",EC="_logoContainer_803b2_1",TC="_logoImage_803b2_9",MC="_fixedLogoContainer_803b2_20",jC="_inlineLogoContainer_803b2_28",Bp={logoContainer:EC,logoImage:TC,fixedLogoContainer:MC,inlineLogoContainer:jC};function Vs({position:t="fixed"}){const e=ao(),n=()=>{e("/")};return N.jsx("div",{className:t==="fixed"?Bp.fixedLogoContainer:Bp.inlineLogoContainer,onClick:n,children:N.jsx("img",{src:kC,alt:"Logo",className:Bp.logoImage})})}const FC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAAAXNSR0IArs4c6QAABCZJREFUeF7tm0162jAQhiWx6ynISUJOkrAoxsueoM0JunTMhvQkkJPEp+guUhmQWwH+kTT6Mel4k+dJPMLz8mlmPJpwRheKAEdZkzEjgEgREEACiCSANCcFEkAkAaQ5KZAAIgkgzUmBBBBJAGlOCiSASAJIc1IgAUQSQJqTAj8TwKqq5rPZbKGUmnPO75VSC8ZYwzlvpJSNEOLt4+OjKctyj/Q7mPlkFFjX9Q/G2HcLzxrG2K+iKOD+7Fd2gFp1W602FyCgyoeyLAFotisrwM1m86SU2iK8z67GbACrqloIIXYneIox/+Y4KHGZKy5mA7jZbHYe27ZPrE1RFHcIJXubZgFokTCepZR7UBXESMbYXAgBGbk3yRwy9+t6vV56k/A0zAUQ9mzXNbgdAabe9gD18sqylZMDPCUOuT2LeToE6qw6WOOdx86W4WkBG3tPofWaJQf48vKyPRTGT5dP5LIF+9Y4UHxOXR9OBiDnfLlarV5tFNKtQsY45/vVavVgs0aoe5IDrOv6HZLCpQNSyjvboljHQljnKg6mzsY3CRCo1XXdmYiKokjqU9IPA8cv67+2hHZJAH1vMC5x9Ja3cGfTwMX5/zqJ9CUAUISNCofsXRLRzSrwlAD4e8+771ghvRCC70xb8y1ayt93ZfktaXcmeQzUCWCs9+f8KpejBgRfsgBE9ACNnfdPeznqv/ZBsgCEDx+o5ZzDk03sdF7U0iAbQMutPOpGjsRhPlRWgIYSobHa1WEZApil+3L5QNkBHiH+rObii4AGg82hEpgkbxr0fZOTANg+XHusKaW8Z0LMuXGsqZR6g+NN24bD6N4PdMOkAAbyKekyBBCJmwASQCQBpHl2BeqC+tjih3kY+AmzMdov+Pn33RaSiG46TGZOJjnAFpgxPITUwGn4CLJ0exSKXdDFPglAQ2WPHgWziz9w73HcIxXMqAB17w5mX1zfMkahWQ6DgDqfY9aOUQCiwFmSuSZ8bWj8JhrIoAC7Jge8eYxq0GsmKfhIXDCAiPbUWRLQ3I7Ztj3m1PMx8KtjKJjNZnN43Tv0AWFexjU8BB2JCwLQA14wJ9r3Z8bY4/C01/leCNUGCwKw74z2fBdCDaeijubawDTjYohDeDRAiynTaAF8KEzq54L22NAWR7fF0AD7RjXaeiz1sI8J1Zj67wQZ4iwlGkAh5cPXifw7QsxZmhAAL2ZUTlEm9YzKWNUTa5YmDMCOYo8Ajn2l+u92GdhyMeRtPkU79osOo0ALx32cs1h28Jbxz1SsKNYoBihjePo0ChxH4Qv7ZhR45WA8JpYswyS7G1GgySQs+dtVoKVOYt+WHWBsB6e+PnoLT93B2M9HAJGECSABRBJAmpMCCSCSANKcFEgAkQSQ5qRAAogkgDQnBRJAJAGkOSmQACIJIM1JgUiAfwCxSwtvY4KpRwAAAABJRU5ErkJggg==",IC="_fixedProfileContainer_1ubol_1",OC="_inlineProfileContainer_1ubol_8",RC="_profileWrapper_1ubol_13",BC="_profileIconContainer_1ubol_19",DC="_profileImage_1ubol_24",UC="_dropdownMenu_1ubol_35",zC="_username_1ubol_49",GC="_menuList_1ubol_57",VC="_menuItem_1ubol_63",bi={fixedProfileContainer:IC,inlineProfileContainer:OC,profileWrapper:RC,profileIconContainer:BC,profileImage:DC,dropdownMenu:UC,username:zC,menuList:GC,menuItem:VC},qC=async(t,e,n)=>{const r=localStorage.getItem("token"),i=new It;try{const o=await i.get(`${bt.auth.verify}?token=${r}`);o.username?(t(!0),e(o.username),console.log("/verify resp: ",o.username)):(t(!1),n(!1))}catch{t(!1)}finally{n(!1)}},B8=re.createContext(),WC=({children:t})=>{const[e,n]=re.useState(!1),[r,i]=re.useState(""),[o,s]=re.useState(!0);return re.useEffect(()=>{qC(n,i,s)},[]),N.jsx(B8.Provider,{value:{isAuthenticated:e,username:r,loading:o,setIsAuthenticated:n,setUsername:i,setLoading:s},children:t})},mr=()=>re.useContext(B8);function wc({position:t="fixed"}){const{username:e,isAuthenticated:n}=mr(),[r,i]=re.useState(!1),o=re.useRef(null),s=re.useRef(null),a=ao(),l=n?["My Maps","Logout"]:["Login"];re.useEffect(()=>{const d=p=>{o.current&&s.current&&!o.current.contains(p.target)&&!s.current.contains(p.target)&&i(!1)};return document.addEventListener("click",d),()=>{document.removeEventListener("click",d)}},[]);const u=d=>{console.log("click profile"),d==="My Maps"?a("/MyMaps"):d==="Logout"&&(localStorage.removeItem("token"),window.location.reload()),i(!1)};return N.jsx("div",{className:t==="fixed"?bi.fixedProfileContainer:bi.inlineProfileContainer,children:N.jsxs("div",{className:bi.profileWrapper,children:[N.jsx("div",{className:bi.profileIconContainer,onClick:()=>{i(!r),console.log("open",r)},children:N.jsx("img",{src:FC,alt:"profile",className:bi.profileImage,ref:s})}),r&&N.jsxs("div",{ref:o,className:bi.dropdownMenu,children:[n&&N.jsx("div",{className:bi.username,children:e}),N.jsx("ul",{className:bi.menuList,children:l.map(d=>d==="Login"?N.jsx("li",{className:bi.menuItem,children:N.jsx(Ro,{to:"/login",className:bi.linkStyle,children:d})},d):N.jsx("li",{onClick:()=>u(d),className:bi.menuItem,children:d},d))})]})]})})}const HC="_wrapper_1mlzu_6",YC="_scrollableContainer_1mlzu_13",KC="_buttonValue_1mlzu_23",XC="_active_1mlzu_40",_l={wrapper:HC,scrollableContainer:YC,buttonValue:KC,active:XC};function $C({mapTypes:t,setFilter:e}){const[n,r]=re.useState("all"),i=re.useCallback(o=>{e(o),r(o)},[]);return N.jsx("div",{className:_l.wrapper,children:N.jsxs("div",{className:_l.scrollableContainer,children:[N.jsx("button",{className:`${_l.buttonValue} ${n==="all"?_l.active:""}`,onClick:()=>i("all"),children:"All"}),t==null?void 0:t.map((o,s)=>N.jsx("button",{className:`${_l.buttonValue} ${n===o?_l.active:""}`,onClick:()=>i(o),children:o},s))]})})}let fu=[];const QC=({data:t,isDragging:e,toggleFavorite:n})=>N.jsxs("div",{style:{padding:"1rem",width:"100%",position:"relative"},children:[N.jsx(Ro,{to:`/Maps/View/${t.text}`,className:ys.linkStyle,children:N.jsxs("div",{className:`${ys.tile} ${e?ys.dragging:""}`,style:{width:"100%",height:"100%"},children:[N.jsx("img",{src:_a,className:ys.imgStyle,alt:"Map Thumbnail"}),N.jsxs("div",{style:{fontFamily:"exo"},children:[t.text," ",e?"DRAGGING":null]})]})}),N.jsx("div",{className:ys.favorite,onClick:()=>n(t.text,t.isFavorite),children:N.jsx("img",{src:t.isFavorite?LC:PC,alt:"Favorite Icon",style:{width:"20px",height:"20px"}})})]}),JC=t=>({colSpan:t.cols,rowSpan:t.rows});function ZC(){const[t,e]=re.useState(""),[n,r]=re.useState([]),{username:i,isAuthenticated:o}=mr(),[s,a]=re.useState("all"),[l,u]=re.useState([]);re.useEffect(()=>{(async()=>{const _=new It;let x=[],v=["Hospital","Faculty","House","Other"];if(o){const S=await _.get(`${bt.favourites.display}?username=${i}`);console.log("RESPONSE FAVORITE MAPS",S);const y=S.map(R=>({text:R.mapName,cols:1,rows:1,isFavorite:!0,type:R.mapType}));console.log("TUKA");const A=await _.get(bt.view_maps.display);console.log("RESPONSE MAPS PUBLIC",A);const L=A.filter(R=>!y.some(D=>D.text===R.mapName)).map(R=>({text:R.mapName,cols:1,rows:1,isFavorite:!1,type:R.mapType}));x=[...y,...L]}else{const S=await _.get(bt.view_maps.display);console.log("RESPONSE MAPS PUBLIC",S),x=S.map(y=>({text:y.mapName,cols:1,rows:1,isFavorite:!1,type:y.mapType}))}console.log("TYPES:",v),u(v),fu=[...x],g(x),r(x)})()},[o,i]);const d=async(w,_)=>{const x=new It,v=_?`${bt.favourites.delete}?username=${i}&mapName=${encodeURIComponent(w)}`:`${bt.favourites.add}?username=${i}&mapName=${encodeURIComponent(w)}`;console.log("Request URL:",v);let S;_?S=await x.delete(v):S=await x.post(v),console.log("Response received:",S);const y=n.map(A=>A.text===w?{...A,isFavorite:!A.isFavorite}:A);fu=[...y],g(y),r(y)},p=w=>{const _=w.target.value.toLowerCase();e(_);const x=fu.filter(v=>v.text.toLowerCase().includes(_));g(x),r(x)},g=w=>{w.sort((_,x)=>_.isFavorite===x.isFavorite?_.text.localeCompare(x.text):_.isFavorite?-1:1)},h=w=>{if(a(w),w==="all")r(fu);else{const _=fu.filter(x=>x.type===w);r(_)}};return N.jsxs("div",{className:ys.container,children:[N.jsx("h1",{children:"Explore Maps"}),N.jsx(Vs,{}),N.jsx(wc,{}),N.jsx("div",{className:ys.searchBar,children:N.jsx("input",{type:"text",placeholder:"Search for maps...",value:t,onChange:p})}),N.jsx("div",{className:ys.filterBar,children:N.jsx($C,{mapTypes:l,setFilter:h})}),s!=="all"&&n.length===0&&N.jsxs("p",{children:["No maps of type ",s," found"]}),N.jsx(Ou,{data:n,renderTile:w=>QC({...w,toggleFavorite:d}),tileSize:JC,forceTileWidth:170,forceTileHeight:200})]})}const eP="_illustration_ry689_9",tP="_wrapper_ry689_14",nP="_form_ry689_25",rP="_heading_ry689_38",iP="_or_ry689_45",oP="_socialButtons_ry689_86",sP="_socialButton_ry689_86",aP="_error_ry689_202",_i={illustration:eP,wrapper:tP,form:nP,heading:rP,or:iP,socialButtons:oP,socialButton:sP,error:aP},D8="/assets/illustration_img-DZiNlDVv.png",lP="/assets/Logo-google-icon-PNG-BunlQUFk.png",cP="/assets/github-mark-white-BsLkggKK.png",uP=()=>{const[t,e]=re.useState(""),[n,r]=re.useState(""),[i,o]=re.useState(null),s=ao(),a=Do(),{setUsername:l,setIsAuthenticated:u}=mr(),{targetPath:d}=a.state||{targetPath:{pathname:"/"}},p={username:t,password:n},g=async()=>new It().post(bt.auth.login,p),h=async x=>{x.preventDefault(),g().then(v=>{v.token?(s(d),localStorage.setItem("token",v.token),l(v.username),u(!0),console.log("ROLES",v.roles)):o("Invalid username or password.")}).catch(v=>{console.error("Login failed",v),o("Login failed. Please try again.")})},w=async()=>{const x=new It;x.setResponseType("text");const v=await x.get(bt.auth.oauth.github.state),S="Iv23liqzhX5wMYNDHtnz",y=encodeURI(`${ei}/oauth/callback/github`),A=`https://github.com/login/oauth/authorize?client_id=${encodeURI(S)}&redirect_uri=${y}&state=${encodeURI(v)}&scope=user:email`;window.location.href=A},_=async()=>{console.log("Continue with Google");const x=new It;x.setResponseType("text");const v=await x.get(bt.auth.oauth.github.state),S="1024418489231-ml40ukvqcg9ad1h5ejor5dm6ipt6p8fo.apps.googleusercontent.com",y=encodeURI(`${ei}/oauth/callback/google`),A=`https://accounts.google.com/o/oauth2/v2/auth?client_id=${encodeURIComponent(S)}&redirect_uri=${encodeURIComponent(y)}&state=${encodeURIComponent(v)}&response_type=code&scope=${encodeURIComponent("openid profile email")}`;window.location.href=A};return N.jsxs("div",{className:_i.wrapper,children:[N.jsx(Vs,{}),N.jsx("div",{className:_i.illustration,children:N.jsx("img",{src:D8,alt:"illustration"})}),N.jsxs("div",{className:_i.form,children:[N.jsx("div",{className:_i.heading,children:"LOGIN"}),N.jsxs("form",{onSubmit:h,children:[N.jsxs("div",{children:[N.jsx("label",{htmlFor:"username",children:"Username"}),N.jsx("input",{type:"text",id:"name",placeholder:"Enter your username",onChange:x=>e(x.target.value),value:t,required:!0})]}),N.jsxs("div",{children:[N.jsx("label",{htmlFor:"password",children:"Password"}),N.jsx("input",{type:"password",id:"password",placeholder:"Enter your password",onChange:x=>r(x.target.value),value:n,required:!0})]}),i&&N.jsx("p",{className:_i.error,children:i}),N.jsx("button",{type:"submit",children:"Submit"})]}),N.jsx("div",{className:_i.or,children:"OR"}),N.jsxs("div",{className:_i.socialButtons,children:[N.jsxs("button",{className:_i.socialButton,onClick:_,children:[N.jsx("img",{src:lP,alt:"Facebook Icon",className:_i.socialIcon}),"Sign In With Google"]}),N.jsxs("button",{className:_i.socialButton,onClick:w,children:[N.jsx("img",{src:cP,alt:"GitHub Icon",className:_i.socialIcon}),"Sign In With GitHub"]})]}),N.jsxs("p",{children:["Don't have an account? ",N.jsx(Ro,{to:"/Signup",children:" Sign Up "})]})]})]})},hP="_wrapper_179e9_1",dP="_form_179e9_11",fP="_heading_179e9_21",pP="_illustration_179e9_91",gP="_errorMessage_179e9_134",mP="_successMessage_179e9_135",Sl={wrapper:hP,form:dP,heading:fP,illustration:pP,errorMessage:gP,successMessage:mP};function vP(){const[t,e]=re.useState(""),[n,r]=re.useState(""),[i,o]=re.useState(""),[s,a]=re.useState(""),[l,u]=re.useState(""),[d,p]=re.useState(""),g=ao(),h=async w=>{if(w.preventDefault(),i!==s){p("error"),u("Passwords do not match.");return}const _={username:t,email:n,password:i};try{const x=await fetch("http://localhost:8080/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)});x.ok?(p("success"),u("User registered successfully!"),setTimeout(()=>{g("/login")},3e3)):x.status===409?(p("error"),u("Email is already taken.")):(p("error"),u("Registration failed."))}catch(x){console.error("Error:",x),p("error"),u("Error registering user.")}};return N.jsxs("div",{className:Sl.wrapper,children:[N.jsx(Vs,{}),N.jsx("div",{className:Sl.illustration,children:N.jsx("img",{src:D8,alt:"illustration"})}),N.jsxs("div",{className:Sl.form,children:[N.jsx("div",{className:Sl.heading,children:"CREATE AN ACCOUNT"}),N.jsxs("form",{onSubmit:h,children:[N.jsxs("div",{children:[N.jsx("label",{htmlFor:"name",children:"Username"}),N.jsx("input",{type:"text",id:"name",value:t,onChange:w=>e(w.target.value),placeholder:"Enter your username",required:!0})]}),N.jsxs("div",{children:[N.jsx("label",{htmlFor:"email",children:"E-Mail"}),N.jsx("input",{type:"email",id:"email",value:n,onChange:w=>r(w.target.value),placeholder:"Enter your email",required:!0})]}),N.jsxs("div",{children:[N.jsx("label",{htmlFor:"password",children:"Password"}),N.jsx("input",{type:"password",id:"password",value:i,onChange:w=>o(w.target.value),placeholder:"Enter your password",required:!0})]}),N.jsxs("div",{children:[N.jsx("label",{htmlFor:"confirmPassword",children:"Confirm Password"}),N.jsx("input",{type:"password",id:"confirmPassword",value:s,onChange:w=>a(w.target.value),placeholder:"Confirm your password",required:!0})]}),N.jsx("button",{type:"submit",children:"Submit"}),l&&N.jsx("p",{className:d==="success"?Sl.successMessage:Sl.errorMessage,children:l})]}),N.jsxs("p",{children:["Have an account? ",N.jsx(Ro,{to:"/Login",children:" Login "})]})]})]})}function yP(){re.useState(!1);const{isAuthenticated:t}=mr();return N.jsx("nav",{className:"modern-navbar",children:N.jsxs("div",{className:"navbar-container",children:[N.jsx("div",{className:"navbar-left",children:N.jsx(Vs,{position:"relative"})}),N.jsx("div",{className:"navbar-right",children:t?N.jsx(wc,{position:"relative"}):N.jsxs(N.Fragment,{children:[N.jsx(Ro,{to:"/Login",className:"navbar-btn navbar-login",children:"Log In"}),N.jsx(Ro,{to:"/Signup",className:"navbar-btn navbar-signup",children:"Sign Up"})]})})]})})}const T3=["btn--primary","btn--outline","btn--test"],M3=["btn--medium","btn--large"],j3=({children:t,type:e,onClick:n,buttonStyle:r,buttonSize:i})=>{const o=T3.includes(r)?r:T3[0],s=M3.includes(i)?i:M3[0];return N.jsx("button",{className:`btn ${o} ${s}`,onClick:n,type:e,children:t})};function pu(t){return N.jsx(N.Fragment,{children:N.jsx("li",{className:"cards__item",children:N.jsxs("a",{className:"cards__item__link",href:t.path,children:[N.jsx("figure",{className:"cards__item__pic-wrap","data-category":t.label,children:N.jsx("img",{className:"cards__item__img",alt:"Travel Image",src:t.src})}),N.jsx("div",{className:"cards__item__info",children:N.jsx("h5",{className:"cards__item__text",children:t.text})})]})})})}const wP="/assets/img-9-ptiH4wdI.jpg",bP="/assets/img-2-BkMBXPmR.jpg",_P="/assets/img-3-CGN-Vi5W.jpg",SP="/assets/img-4-BNWLy8zx.jpg",xP="/assets/img-8-VmDlpmuo.jpg";function AP(){return N.jsxs("div",{className:"cards",children:[N.jsx("h1",{children:"iMaps offers:"}),N.jsx("div",{className:"cards__container",children:N.jsxs("div",{className:"cards__wrapper",children:[N.jsxs("ul",{className:"cards__items",children:[N.jsx(pu,{src:wP,text:"Create intricate floor plans for your building with precision and ease.",label:"Create",path:"/services"}),N.jsx(pu,{src:bP,text:"Explore and navigate through complex building layouts seamlessly.",label:"Explore",path:"/services"})]}),N.jsxs("ul",{className:"cards__items",children:[N.jsx(pu,{src:_P,text:"Add custom icons, labels, and markers to personalize your indoor maps.",label:"Customize",path:"/services"}),N.jsx(pu,{src:SP,text:"Ensure accessibility by mapping out routes and facilities for all users.",label:"Accessibility",path:"/products"}),N.jsx(pu,{src:xP,text:"Share your maps with others and collaborate in real-time for efficient space planning.",label:"Collaboration",path:"/sign-up"})]})]})})]})}function NP(){return N.jsx("div",{className:"footer-container",children:N.jsx("section",{className:"social-media",children:N.jsxs("div",{className:"social-media-wrap",children:[N.jsx("div",{className:"footer-logo",children:N.jsx("a",{href:"#",className:"social-logo",children:"iMaps"})}),N.jsxs("small",{className:"website-rights",children:["iMaps © ",2024]}),N.jsxs("div",{className:"social-icons",children:[N.jsx("a",{className:"social-icon-link facebook",href:"#","aria-label":"Facebook",children:N.jsx("i",{className:"fab fa-facebook-f"})}),N.jsx("a",{className:"social-icon-link instagram",href:"#","aria-label":"Instagram",children:N.jsx("i",{className:"fab fa-instagram"})}),N.jsx("a",{className:"social-icon-link youtube",href:"#","aria-label":"Youtube",children:N.jsx("i",{className:"fab fa-youtube"})}),N.jsx("a",{className:"social-icon-link twitter",href:"#","aria-label":"Twitter",children:N.jsx("i",{className:"fab fa-twitter"})}),N.jsx("a",{className:"social-icon-link linkedin",href:"#","aria-label":"LinkedIn",children:N.jsx("i",{className:"fab fa-linkedin"})})]})]})})})}function CP(){return N.jsxs("div",{className:"home",children:[N.jsxs("div",{className:"hero-container",children:[N.jsx("h1",{children:"Map Your World"}),N.jsx("h2",{className:"description",children:"Create and explore detailed indoor maps."}),N.jsxs("div",{className:"hero-btns",children:[N.jsx(Ro,{to:"/Maps",children:N.jsxs(j3,{buttonSize:"btn--large",children:["Browse Maps ",N.jsx("i",{className:"far fa-play-circle"})]})}),N.jsx(Ro,{to:"/myMaps",children:N.jsx(j3,{buttonSize:"btn--large",buttonStyle:"btn--outline",children:"Create Maps"})})]})]}),N.jsx(AP,{}),N.jsx(NP,{})]})}function PP(){return N.jsxs("div",{className:"homebg",children:[N.jsx(yP,{}),N.jsx(CP,{})]})}const LP="_topPanelH_1dtk6_10",kP="_logo_1dtk6_18",EP="_title_1dtk6_22",TP="_titleLink_1dtk6_33",MP="_paragraph_1dtk6_40",jP="_guideWrapper_1dtk6_44",FP="_wrapper_1dtk6_52",IP="_cont_1dtk6_59",OP="_panel_1dtk6_68",RP="_buttonContainer_1dtk6_84",BP="_renderButton_1dtk6_93",DP="_shapeOptions_1dtk6_122",UP="_shapeOption_1dtk6_122",zP="_templateCont_1dtk6_154",GP="_fpscounter_1dtk6_161",VP="_popup_1dtk6_176",qP="_fadeInOut_1dtk6_1",WP="_popupContent_1dtk6_206",HP="_entrance_1dtk6_212",YP="_wall_1dtk6_216",KP="_room_1dtk6_220",XP="_stairs_1dtk6_223",$P="_floorSection_1dtk6_226",QP="_floorLabel_1dtk6_238",JP="_floorList_1dtk6_246",ZP="_floorItems_1dtk6_254",eL="_addFloorButton_1dtk6_262",tL="_icon_1dtk6_285",nL="_floorButton_1dtk6_291",rL="_active_1dtk6_308",iL="_floorInput_1dtk6_314",oL="_floorActions_1dtk6_331",sL="_errorMessage_1dtk6_339",aL="_floorItemWrapper_1dtk6_345",lL="_floorItem_1dtk6_254",cL="_activeFloor_1dtk6_369",uL="_deleteFloorButton_1dtk6_375",wt={topPanelH:LP,logo:kP,title:EP,titleLink:TP,paragraph:MP,guideWrapper:jP,wrapper:FP,cont:IP,panel:OP,buttonContainer:RP,renderButton:BP,shapeOptions:DP,shapeOption:UP,templateCont:zP,fpscounter:GP,popup:VP,fadeInOut:qP,popupContent:WP,entrance:HP,wall:YP,room:KP,stairs:XP,floorSection:$P,floorLabel:QP,floorList:JP,floorItems:ZP,addFloorButton:eL,icon:tL,floorButton:nL,active:rL,floorInput:iL,floorActions:oL,errorMessage:sL,floorItemWrapper:aL,floorItem:lL,activeFloor:cL,deleteFloorButton:uL},hL="_activeModal_wxjvs_2",dL="_modal_wxjvs_7",fL="_overlay_wxjvs_8",pL="_draggableHeader_wxjvs_21",gL="_modalContent_wxjvs_31",mL="_title_wxjvs_47",vL="_btnModal_wxjvs_52",yL="_closeModal_wxjvs_68",wL="_form_wxjvs_84",bL="_formGroup_wxjvs_89",_L="_formGroupCheckbox_wxjvs_116",SL="_addButton_wxjvs_132",xL="_submitButton_wxjvs_147",AL="_pinList_wxjvs_162",NL="_pinItem_wxjvs_168",CL="_removeButton_wxjvs_179",An={activeModal:hL,modal:dL,overlay:fL,draggableHeader:pL,modalContent:gL,title:mL,btnModal:vL,closeModal:yL,form:wL,formGroup:bL,formGroupCheckbox:_L,addButton:SL,submitButton:xL,pinList:AL,pinItem:NL,removeButton:CL};function g1({shapeInfo:t,updateModalData:e,phtext:n}){return N.jsxs("div",{className:An.formGroup,children:[N.jsx("label",{htmlFor:"name",children:"Name:"}),N.jsx("input",{type:"text",id:"name",name:"name",value:t.name,onChange:e,placeholder:n,required:!0})]})}function m1({shapeInfo:t,updateModalData:e}){return N.jsxs("div",{className:An.formGroup,children:[N.jsx("label",{htmlFor:"description",children:"Description:"}),N.jsx("textarea",{id:"description",name:"description",value:t.description,onChange:e,rows:"3"})]})}function v1({saveDetails:t}){return N.jsx("div",{className:An.formGroup,children:N.jsx("button",{type:"button",id:"submit-details",onClick:t,className:An.submitButton,children:"Save"})})}function y1({children:t,title:e,isOpen:n,toggleModal:r}){const i=re.useRef(null),[o,s]=re.useState(!1),[a,l]=re.useState({x:"50%",y:"50%"}),[u,d]=re.useState({x:0,y:0}),p=w=>{if(!i.current)return;s(!0);const _=i.current.getBoundingClientRect();d({x:w.clientX-_.left,y:w.clientY-_.top})},g=w=>{o&&l({x:w.clientX-u.x,y:w.clientY-u.y})},h=()=>{s(!1)};return re.useEffect(()=>(o?(window.addEventListener("mousemove",g),window.addEventListener("mouseup",h)):(window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",h)),()=>{window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",h)}),[o]),n?document.body.classList.add(An.activeModal):document.body.classList.remove(An.activeModal),N.jsx(N.Fragment,{children:n&&N.jsxs("div",{className:An.modal,children:[N.jsx("div",{onClick:r,className:An.overlay}),N.jsxs("div",{ref:i,className:An.modalContent,style:{top:typeof a.y=="string"?a.y:`${a.y}px`,left:typeof a.x=="string"?a.x:`${a.x}px`,transform:typeof a.x=="string"&&typeof a.y=="string"?"translate(-50%, -50%)":"none"},children:[N.jsx("div",{className:An.draggableHeader,onMouseDown:p,children:N.jsx("h2",{className:An.title,children:e})}),N.jsxs("form",{className:An.form,children:[t,N.jsx("button",{className:An.closeModal,onClick:r,children:"CLOSE"})]})]})]})})}const PL="_activeModal_knxpl_3",LL="_modal_knxpl_7",kL="_overlay_knxpl_8",EL="_modalContent_knxpl_22",TL="_btnModal_knxpl_42",ML="_closeModal_knxpl_58",jL="_form_knxpl_74",FL="_formGroup_knxpl_79",IL="_submitButton_knxpl_110",OL={activeModal:PL,modal:LL,overlay:kL,modalContent:EL,btnModal:TL,closeModal:ML,form:jL,formGroup:FL,submitButton:IL};function RL({shapeInfo:t,updateModalData:e,roomTypes:n}){return console.log("ROOM TYPES: "+n),N.jsxs("div",{className:OL.formGroup,children:[N.jsx("label",{htmlFor:"type",children:"Type:"}),N.jsxs("select",{id:"type",name:"type",onChange:e,value:t.type,required:!0,children:[N.jsx("option",{value:"",children:"Select Room Type"}),n==null?void 0:n.map((r,i)=>N.jsx("option",{value:r.name,children:r.name},i))]})]})}let U8=!0;const F3=new CustomEvent("mapsave",{}),I3=t=>{U8=t},$l=()=>{U8&&(window.dispatchEvent(F3),I3(!1),setTimeout(()=>{I3(!0),window.dispatchEvent(F3)},2e3))};function w1(t){const[e,n]=re.useState(!1),[r,i]=re.useState(null),[o,s]=re.useState({}),a=()=>{e&&(r.setInfo(o),t.updateRoomNames(),$l(),console.log("SHAPE BEF CLOSE:",r.info),t.attachKeyPressEventListeners()),n(!e)};return{modalState:{isOpen:e,shapeInfo:o,setIsOpen:n,shape:r,setShape:i,setShapeInfo:s},handlers:{toggleModal:a,updateModalData:d=>{const{name:p,value:g,type:h,checked:w}=d.target;s(_=>({..._,[p]:h==="checkbox"?w:g})),console.log("SHAPE INFO UPDATE",r.info)},saveDetails:()=>{r&&a()}}}}function b1(t,e){re.useEffect(()=>{if(e!=null)return window.addEventListener(e,t),()=>{window.removeEventListener(e,t)}},[])}function BL({map:t,roomTypes:e}){const{modalState:{isOpen:n,setIsOpen:r,setShape:i,shapeInfo:o,setShapeInfo:s},handlers:{toggleModal:a,updateModalData:l,saveDetails:u}}=w1(t);return b1(d=>{const p=d.detail.room;i(p),s(p.info),r(!0),d.detail.map.detachKeyPressEventListeners()},"openRoomModalEvent"),N.jsxs(y1,{isOpen:n,toggleModal:a,title:"Enter Room Details",children:[N.jsx(g1,{shapeInfo:o,updateModalData:l}),N.jsx(RL,{updateModalData:l,shapeInfo:o,roomTypes:e}),N.jsx(m1,{shapeInfo:o,updateModalData:l}),N.jsx(v1,{saveDetails:u})]})}var z8={exports:{}},DL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",UL=DL,zL=UL;function G8(){}function V8(){}V8.resetWarningCache=G8;var GL=function(){function t(r,i,o,s,a,l){if(l!==zL){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:V8,resetWarningCache:G8};return n.PropTypes=n,n};z8.exports=GL();var VL=z8.exports;const Sa=Kf(VL);var $e={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const e=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}t.glob=typeof Om<"u"?Om:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},t.Konva={_global:t.glob,version:"9.3.16",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return t.Konva.angleDeg?i*e:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return t.Konva.DD.isDragging},isTransforming(){var i;return(i=t.Konva.Transformer)===null||i===void 0?void 0:i.isTransforming()},isDragReady(){return!!t.Konva.DD.node},releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(i){t.glob.Konva=i}};const r=i=>{t.Konva[i.prototype.getClassName()]=i};t._registerNode=r,t.Konva._injectGlobal(t.Konva)})($e);var Mg={exports:{}},_1={},q8={},Zt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=$e;class n{constructor(A=[1,0,0,1,0,0]){this.dirty=!1,this.m=A&&A.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(A){A.m[0]=this.m[0],A.m[1]=this.m[1],A.m[2]=this.m[2],A.m[3]=this.m[3],A.m[4]=this.m[4],A.m[5]=this.m[5]}point(A){const L=this.m;return{x:L[0]*A.x+L[2]*A.y+L[4],y:L[1]*A.x+L[3]*A.y+L[5]}}translate(A,L){return this.m[4]+=this.m[0]*A+this.m[2]*L,this.m[5]+=this.m[1]*A+this.m[3]*L,this}scale(A,L){return this.m[0]*=A,this.m[1]*=A,this.m[2]*=L,this.m[3]*=L,this}rotate(A){const L=Math.cos(A),R=Math.sin(A),D=this.m[0]*L+this.m[2]*R,k=this.m[1]*L+this.m[3]*R,z=this.m[0]*-R+this.m[2]*L,T=this.m[1]*-R+this.m[3]*L;return this.m[0]=D,this.m[1]=k,this.m[2]=z,this.m[3]=T,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(A,L){const R=this.m[0]+this.m[2]*L,D=this.m[1]+this.m[3]*L,k=this.m[2]+this.m[0]*A,z=this.m[3]+this.m[1]*A;return this.m[0]=R,this.m[1]=D,this.m[2]=k,this.m[3]=z,this}multiply(A){const L=this.m[0]*A.m[0]+this.m[2]*A.m[1],R=this.m[1]*A.m[0]+this.m[3]*A.m[1],D=this.m[0]*A.m[2]+this.m[2]*A.m[3],k=this.m[1]*A.m[2]+this.m[3]*A.m[3],z=this.m[0]*A.m[4]+this.m[2]*A.m[5]+this.m[4],T=this.m[1]*A.m[4]+this.m[3]*A.m[5]+this.m[5];return this.m[0]=L,this.m[1]=R,this.m[2]=D,this.m[3]=k,this.m[4]=z,this.m[5]=T,this}invert(){const A=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),L=this.m[3]*A,R=-this.m[1]*A,D=-this.m[2]*A,k=this.m[0]*A,z=A*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),T=A*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=L,this.m[1]=R,this.m[2]=D,this.m[3]=k,this.m[4]=z,this.m[5]=T,this}getMatrix(){return this.m}decompose(){const A=this.m[0],L=this.m[1],R=this.m[2],D=this.m[3],k=this.m[4],z=this.m[5],T=A*D-L*R,P={x:k,y:z,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(A!=0||L!=0){const E=Math.sqrt(A*A+L*L);P.rotation=L>0?Math.acos(A/E):-Math.acos(A/E),P.scaleX=E,P.scaleY=T/E,P.skewX=(A*R+L*D)/T,P.skewY=0}else if(R!=0||D!=0){const E=Math.sqrt(R*R+D*D);P.rotation=Math.PI/2-(D>0?Math.acos(-R/E):-Math.acos(R/E)),P.scaleX=T/E,P.scaleY=E,P.skewX=0,P.skewY=(A*R+L*D)/T}return P.rotation=t.Util._getRotation(P.rotation),P}}t.Transform=n;let r="[object Array]",i="[object Number]",o="[object String]",s="[object Boolean]",a=Math.PI/180,l=180/Math.PI,u="#",d="",p="0",g="Konva warning: ",h="Konva error: ",w="rgb(",_={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]},x=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,v=[];const S=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(y){setTimeout(y,60)};t.Util={_isElement(y){return!!(y&&y.nodeType==1)},_isFunction(y){return!!(y&&y.constructor&&y.call&&y.apply)},_isPlainObject(y){return!!y&&y.constructor===Object},_isArray(y){return Object.prototype.toString.call(y)===r},_isNumber(y){return Object.prototype.toString.call(y)===i&&!isNaN(y)&&isFinite(y)},_isString(y){return Object.prototype.toString.call(y)===o},_isBoolean(y){return Object.prototype.toString.call(y)===s},isObject(y){return y instanceof Object},isValidSelector(y){if(typeof y!="string")return!1;const A=y[0];return A==="#"||A==="."||A===A.toUpperCase()},_sign(y){return y===0||y>0?1:-1},requestAnimFrame(y){v.push(y),v.length===1&&S(function(){const A=v;v=[],A.forEach(function(L){L()})})},createCanvasElement(){const y=document.createElement("canvas");try{y.style=y.style||{}}catch{}return y},createImageElement(){return document.createElement("img")},_isInDocument(y){for(;y=y.parentNode;)if(y==document)return!0;return!1},_urlToImage(y,A){const L=t.Util.createImageElement();L.onload=function(){A(L)},L.src=y},_rgbToHex(y,A,L){return((1<<24)+(y<<16)+(A<<8)+L).toString(16).slice(1)},_hexToRgb(y){y=y.replace(u,d);const A=parseInt(y,16);return{r:A>>16&255,g:A>>8&255,b:A&255}},getRandomColor(){let y=(Math.random()*16777215<<0).toString(16);for(;y.length<6;)y=p+y;return u+y},getRGB(y){let A;return y in _?(A=_[y],{r:A[0],g:A[1],b:A[2]}):y[0]===u?this._hexToRgb(y.substring(1)):y.substr(0,4)===w?(A=x.exec(y.replace(/ /g,"")),{r:parseInt(A[1],10),g:parseInt(A[2],10),b:parseInt(A[3],10)}):{r:0,g:0,b:0}},colorToRGBA(y){return y=y||"black",t.Util._namedColorToRBA(y)||t.Util._hex3ColorToRGBA(y)||t.Util._hex4ColorToRGBA(y)||t.Util._hex6ColorToRGBA(y)||t.Util._hex8ColorToRGBA(y)||t.Util._rgbColorToRGBA(y)||t.Util._rgbaColorToRGBA(y)||t.Util._hslColorToRGBA(y)},_namedColorToRBA(y){const A=_[y.toLowerCase()];return A?{r:A[0],g:A[1],b:A[2],a:1}:null},_rgbColorToRGBA(y){if(y.indexOf("rgb(")===0){y=y.match(/rgb\(([^)]+)\)/)[1];const A=y.split(/ *, */).map(Number);return{r:A[0],g:A[1],b:A[2],a:1}}},_rgbaColorToRGBA(y){if(y.indexOf("rgba(")===0){y=y.match(/rgba\(([^)]+)\)/)[1];const A=y.split(/ *, */).map((L,R)=>L.slice(-1)==="%"?R===3?parseInt(L)/100:parseInt(L)/100*255:Number(L));return{r:A[0],g:A[1],b:A[2],a:A[3]}}},_hex8ColorToRGBA(y){if(y[0]==="#"&&y.length===9)return{r:parseInt(y.slice(1,3),16),g:parseInt(y.slice(3,5),16),b:parseInt(y.slice(5,7),16),a:parseInt(y.slice(7,9),16)/255}},_hex6ColorToRGBA(y){if(y[0]==="#"&&y.length===7)return{r:parseInt(y.slice(1,3),16),g:parseInt(y.slice(3,5),16),b:parseInt(y.slice(5,7),16),a:1}},_hex4ColorToRGBA(y){if(y[0]==="#"&&y.length===5)return{r:parseInt(y[1]+y[1],16),g:parseInt(y[2]+y[2],16),b:parseInt(y[3]+y[3],16),a:parseInt(y[4]+y[4],16)/255}},_hex3ColorToRGBA(y){if(y[0]==="#"&&y.length===4)return{r:parseInt(y[1]+y[1],16),g:parseInt(y[2]+y[2],16),b:parseInt(y[3]+y[3],16),a:1}},_hslColorToRGBA(y){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(y)){const[A,...L]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(y),R=Number(L[0])/360,D=Number(L[1])/100,k=Number(L[2])/100;let z,T,P;if(D===0)return P=k*255,{r:Math.round(P),g:Math.round(P),b:Math.round(P),a:1};k<.5?z=k*(1+D):z=k+D-k*D;const E=2*k-z,W=[0,0,0];for(let B=0;B<3;B++)T=R+1/3*-(B-1),T<0&&T++,T>1&&T--,6*T<1?P=E+(z-E)*6*T:2*T<1?P=z:3*T<2?P=E+(z-E)*(2/3-T)*6:P=E,W[B]=P*255;return{r:Math.round(W[0]),g:Math.round(W[1]),b:Math.round(W[2]),a:1}}},haveIntersection(y,A){return!(A.x>y.x+y.width||A.x+A.widthy.y+y.height||A.y+A.height1?(z=L,T=R,P=(L-D)*(L-D)+(R-k)*(R-k)):(z=y+W*(L-y),T=A+W*(R-A),P=(z-D)*(z-D)+(T-k)*(T-k))}return[z,T,P]},_getProjectionToLine(y,A,L){const R=t.Util.cloneObject(y);let D=Number.MAX_VALUE;return A.forEach(function(k,z){if(!L&&z===A.length-1)return;const T=A[(z+1)%A.length],P=t.Util._getProjectionToSegment(k.x,k.y,T.x,T.y,y.x,y.y),E=P[0],W=P[1],B=P[2];BA.length){const T=A;A=y,y=T}for(R=0;R{A.width=0,A.height=0})},drawRoundedRectPath(y,A,L,R){let D=0,k=0,z=0,T=0;typeof R=="number"?D=k=z=T=Math.min(R,A/2,L/2):(D=Math.min(R[0]||0,A/2,L/2),k=Math.min(R[1]||0,A/2,L/2),T=Math.min(R[2]||0,A/2,L/2),z=Math.min(R[3]||0,A/2,L/2)),y.moveTo(D,0),y.lineTo(A-k,0),y.arc(A-k,k,k,Math.PI*3/2,0,!1),y.lineTo(A,L-T),y.arc(A-T,L-T,T,0,Math.PI/2,!1),y.lineTo(z,L),y.arc(z,L-z,z,Math.PI/2,Math.PI,!1),y.lineTo(0,D),y.arc(D,D,D,Math.PI,Math.PI*3/2,!1)}}})(Zt);var Ht={},at={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.RGBComponent=qL;Xe.alphaComponent=WL;Xe.getNumberValidator=HL;Xe.getNumberOrArrayOfNumbersValidator=YL;Xe.getNumberOrAutoValidator=KL;Xe.getStringValidator=XL;Xe.getStringOrGradientValidator=$L;Xe.getFunctionValidator=QL;Xe.getNumberArrayValidator=JL;Xe.getBooleanValidator=ZL;Xe.getComponentValidator=ek;const Go=$e,ln=Zt;function Vo(t){return ln.Util._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||ln.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}function qL(t){return t>255?255:t<0?0:Math.round(t)}function WL(t){return t>1?1:t<1e-4?1e-4:t}function HL(){if(Go.Konva.isUnminified)return function(t,e){return ln.Util._isNumber(t)||ln.Util.warn(Vo(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function YL(t){if(Go.Konva.isUnminified)return function(e,n){const r=ln.Util._isNumber(e),i=ln.Util._isArray(e)&&e.length==t;return!r&&!i&&ln.Util.warn(Vo(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function KL(){if(Go.Konva.isUnminified)return function(t,e){return ln.Util._isNumber(t)||t==="auto"||ln.Util.warn(Vo(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function XL(){if(Go.Konva.isUnminified)return function(t,e){return ln.Util._isString(t)||ln.Util.warn(Vo(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function $L(){if(Go.Konva.isUnminified)return function(t,e){const n=ln.Util._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||ln.Util.warn(Vo(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function QL(){if(Go.Konva.isUnminified)return function(t,e){return ln.Util._isFunction(t)||ln.Util.warn(Vo(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}}function JL(){if(Go.Konva.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(ln.Util._isArray(t)?t.forEach(function(r){ln.Util._isNumber(r)||ln.Util.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):ln.Util.warn(Vo(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function ZL(){if(Go.Konva.isUnminified)return function(t,e){return t===!0||t===!1||ln.Util.warn(Vo(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function ek(t){if(Go.Konva.isUnminified)return function(e,n){return e==null||ln.Util.isObject(e)||ln.Util.warn(Vo(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const e=Zt,n=Xe,r="get",i="set";t.Factory={addGetterSetter(o,s,a,l,u){t.Factory.addGetter(o,s,a),t.Factory.addSetter(o,s,l,u),t.Factory.addOverloadedGetterSetter(o,s)},addGetter(o,s,a){const l=r+e.Util._capitalize(s);o.prototype[l]=o.prototype[l]||function(){const u=this.attrs[s];return u===void 0?a:u}},addSetter(o,s,a,l){const u=i+e.Util._capitalize(s);o.prototype[u]||t.Factory.overWriteSetter(o,s,a,l)},overWriteSetter(o,s,a,l){const u=i+e.Util._capitalize(s);o.prototype[u]=function(d){return a&&d!==void 0&&d!==null&&(d=a.call(this,d,s)),this._setAttr(s,d),l&&l.call(this),this}},addComponentsGetterSetter(o,s,a,l,u){let d=a.length,p=e.Util._capitalize,g=r+p(s),h=i+p(s),w,_;o.prototype[g]=function(){const v={};for(w=0;w{this._setAttr(s+p(A),void 0)}),this._fireChangeEvent(s,S,v),u&&u.call(this),this},t.Factory.addOverloadedGetterSetter(o,s)},addOverloadedGetterSetter(o,s){const a=e.Util._capitalize(s),l=i+a,u=r+a;o.prototype[s]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,s,a,l){e.Util.error("Adding deprecated "+s);const u=r+e.Util._capitalize(s),d=s+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){e.Util.error(d);const p=this.attrs[s];return p===void 0?a:p},t.Factory.addSetter(o,s,l,function(){e.Util.error(d)}),t.Factory.addOverloadedGetterSetter(o,s)},backCompat(o,s){e.Util.each(s,function(a,l){const u=o.prototype[l],d=r+e.Util._capitalize(a),p=i+e.Util._capitalize(a);function g(){u.apply(this,arguments),e.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[a]=g,o.prototype[d]=g,o.prototype[p]=g})},afterSetFilter(){this._filterUpToDate=!1}}})(at);var ji={},Mo={};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.HitContext=Mo.SceneContext=Mo.Context=void 0;const W8=Zt,tk=$e;function nk(t){let e=[],n=t.length,r=W8.Util,i,o;for(i=0;itypeof d=="number"?Math.floor(d):d)),o+=rk+u.join(O3)+ik)):(o+=a.property,e||(o+=ck+a.val)),o+=ak;return o}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,r;n.push(e),r=n.length,r>=hk&&n.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){const n=e.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(e){const n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){const n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,i,o,s){this._context.arc(e,n,r,i,o,s)}arcTo(e,n,r,i,o){this._context.arcTo(e,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,o,s){this._context.bezierCurveTo(e,n,r,i,o,s)}clearRect(e,n,r,i){this._context.clearRect(e,n,r,i)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){const r=arguments;if(r.length===2)return this._context.createImageData(e,n);if(r.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,r,i){return this._context.createLinearGradient(e,n,r,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,i,o,s){return this._context.createRadialGradient(e,n,r,i,o,s)}drawImage(e,n,r,i,o,s,a,l,u){const d=arguments,p=this._context;d.length===3?p.drawImage(e,n,r):d.length===5?p.drawImage(e,n,r,i,o):d.length===9&&p.drawImage(e,n,r,i,o,s,a,l,u)}ellipse(e,n,r,i,o,s,a,l){this._context.ellipse(e,n,r,i,o,s,a,l)}isPointInPath(e,n,r,i){return r?this._context.isPointInPath(r,e,n,i):this._context.isPointInPath(e,n,i)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,r,i){this._context.fillRect(e,n,r,i)}strokeRect(e,n,r,i){this._context.strokeRect(e,n,r,i)}fillText(e,n,r,i){i?this._context.fillText(e,n,r,i):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,i){return this._context.getImageData(e,n,r,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,i){this._context.rect(e,n,r,i)}roundRect(e,n,r,i,o){this._context.roundRect(e,n,r,i,o)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,i){this._context.quadraticCurveTo(e,n,r,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,r,i,o,s){this._context.setTransform(e,n,r,i,o,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,o,s){this._context.transform(e,n,r,i,o,s)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=R3.length,r=this.setAttr,i,o;const s=function(a){let l=e[a],u;e[a]=function(){return o=nk(Array.prototype.slice.call(arguments,0)),u=l.apply(e,arguments),e._trace({method:a,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){let r;return t.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];t.DD._dragElements.forEach((o,s)=>{const{node:a}=o,l=a.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(d=>d.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){const d=a.dragDistance();if(Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y)){o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];t.DD._dragElements.forEach(o=>{const{node:s}=o,a=s.getStage();if(r&&a.setPointersPositions(r),!a._changedPointerPositions.find(d=>d.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(t.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof e.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){t.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&t.DD._dragElements.delete(o)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",t.DD._endDragBefore,!0),window.addEventListener("mousemove",t.DD._drag),window.addEventListener("touchmove",t.DD._drag),window.addEventListener("mouseup",t.DD._endDragAfter,!1),window.addEventListener("touchend",t.DD._endDragAfter,!1),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))})(A1);Object.defineProperty(Ht,"__esModule",{value:!0});Ht.Node=void 0;const dt=Zt,yh=at,gu=ji,as=$e,Zr=A1,wn=Xe,sf="absoluteOpacity",Id="allEventListeners",No="absoluteTransform",B3="absoluteScale",ca="canvas",wk="Change",bk="children",_k="konva",d5="listening",D3="mouseenter",U3="mouseleave",z3="set",G3="Shape",af=" ",V3="stage",hs="transform",Sk="Stage",f5="visible",xk=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(af);let Ak=1;class Je{constructor(e){this._id=Ak++,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===hs||e===No)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){let r=this._cache.get(e);return(r===void 0||(e===hs||e===No)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const i=n.map(o=>o+"Change.konva").join(af);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(ca)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===No&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ca)){const{scene:e,filter:n,hit:r}=this._cache.get(ca);dt.Util.releaseCanvas(e,n,r),this._cache.delete(ca)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const n=e||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,d=n.drawBorder||!1,p=n.hitCanvasPixelRatio||1;if(!i||!o){dt.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const g=Math.abs(Math.round(r.x)-a)>.5?1:0,h=Math.abs(Math.round(r.y)-l)>.5?1:0;i+=u*2+g,o+=u*2+h,a-=u,l-=u;const w=new gu.SceneCanvas({pixelRatio:s,width:i,height:o}),_=new gu.SceneCanvas({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),x=new gu.HitCanvas({pixelRatio:p,width:i,height:o}),v=w.getContext(),S=x.getContext();return x.isCache=!0,w.isCache=!0,this._cache.delete(ca),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(w.getContext()._context.imageSmoothingEnabled=!1,_.getContext()._context.imageSmoothingEnabled=!1),v.save(),S.save(),v.translate(-a,-l),S.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(sf),this._clearSelfAndDescendantCache(B3),this.drawScene(w,this),this.drawHit(x,this),this._isUnderCache=!1,v.restore(),S.restore(),d&&(v.save(),v.beginPath(),v.rect(0,0,i,o),v.closePath(),v.setAttr("strokeStyle","red"),v.setAttr("lineWidth",5),v.stroke(),v.restore()),this._cache.set(ca,{scene:w,filter:_,hit:x,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(ca)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){const r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let i=1/0,o=1/0,s=-1/0,a=-1/0;const l=this.getAbsoluteTransform(n);return r.forEach(function(u){const d=l.point(u);i===void 0&&(i=s=d.x,o=a=d.y),i=Math.min(i,d.x),o=Math.min(o,d.y),s=Math.max(s,d.x),a=Math.max(a,d.y)}),{x:i,y:o,width:s-i,height:a-o}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),i=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/i,r.height/i),e.restore()}_drawCachedHitCanvas(e){const n=this._getCanvasCache(),r=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),s,a,l,u;if(e){if(!this._filterUpToDate){const d=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=e.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/d,r.getHeight()/d),a=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{let n,r;if(!e)return this;for(n in e)n!==bk&&(r=z3+dt.Util._capitalize(n),dt.Util._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(d5,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(f5,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);const r=this.getLayer();let i=!1;Zr.DD._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});const o=!n&&!as.Konva.hitOnDragEnabled&&(i||as.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),n=this,r=0,i,o,s,a;function l(d){for(i=[],o=d.length,s=0;s0&&i[0].getDepth()<=e&&l(i)}const u=this.getStage();return n.nodeType!==Sk&&u&&l(u.getChildren()),r}getDepth(){let e=0,n=this.parent;for(;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(hs),this._clearSelfAndDescendantCache(No)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const n=e.getPointerPosition();if(!n)return null;const r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);const i=this.getAbsoluteTransform(e).getMatrix(),o=new dt.Transform,s=this.offset();return o.m=i.slice(),o.translate(s.x,s.y),o.getTranslation()}setAbsolutePosition(e){const{x:n,y:r,...i}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(hs);const o=this._getAbsoluteTransform().copy();return o.invert(),o.translate(e.x,e.y),e={x:this.attrs.x+o.getTranslation().x,y:this.attrs.y+o.getTranslation().y},this._setTransform(i),this.setPosition({x:e.x,y:e.y}),this._clearCache(hs),this._clearSelfAndDescendantCache(No),this}_setTransform(e){let n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){const e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let n=e.x,r=e.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(e,n){let r=[],i=this.getParent(),o,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,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 dt.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return dt.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&dt.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(sf,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),n,r,i,o,s;const a={attrs:{},className:this.getClassName()};for(n in e)r=e[n],s=dt.Util.isObject(r)&&!dt.Util._isPlainObject(r)&&!dt.Util._isArray(r),!s&&(i=typeof this[n]=="function"&&this[n],delete e[n],o=i?i.call(this):null,e[n]=r,o!==r&&(a.attrs[n]=r));return dt.Util._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){const i=[];n&&this._isMatch(e)&&i.push(this);let o=this.parent;for(;o;){if(o===r)return i;o._isMatch(e)&&i.push(o),o=o.parent}return i}isAncestorOf(e){return!1}findAncestor(e,n,r){return this.findAncestors(e,n,r)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);let n=e.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=e==null?void 0:e.callback;i&&delete e.callback,dt.Util._urlToImage(this.toDataURL(e),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(e){return new Promise((n,r)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(o=>{n(o),i==null||i(o)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(i){r(i)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():as.Konva.dragDistance}_off(e,n,r){let i=this.eventListeners[e],o,s,a;for(o=0;o=0)||this.isDragging())return;let i=!1;Zr.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const n=Zr.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Zr.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return dt.Util.haveIntersection(r,this.getClientRect())}static create(e,n){return dt.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){let r=Je.prototype.getClassName.call(e),i=e.children,o,s,a;n&&(e.attrs.container=n),as.Konva[r]||(dt.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=as.Konva[r];if(o=new l(e.attrs),i)for(s=i.length,a=0;a0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let r=0;r0?n[0]:void 0}_generalFind(e,n){const r=[];return this._descendants(i=>{const o=i._isMatch(e);return o&&r.push(i),!!(o&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const i of r){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){const e=Dp.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){let n=e.getParent();for(;n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){const n=Dp.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){const n=[];return this.find("Shape").forEach(r=>{r.isVisible()&&r.intersects(e)&&n.push(r)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(e,n,r){const i=this.getLayer(),o=e||i&&i.getCanvas(),s=o&&o.getContext(),a=this._getCanvasCache(),l=a&&a.scene,u=o&&o.isCache;if(!this.isVisible()&&!u)return this;if(l){s.save();const d=this.getAbsoluteTransform(n).getMatrix();s.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",o,n,r);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;const r=this.getLayer(),i=e||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache();if(s&&s.hit){o.save();const l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r,i){var o;const s=n&&n.getContext(),a=this.clipWidth(),l=this.clipHeight(),u=this.clipFunc(),d=typeof a=="number"&&typeof l=="number"||u,p=r===this;if(d){s.save();const h=this.getAbsoluteTransform(r);let w=h.getMatrix();s.transform(w[0],w[1],w[2],w[3],w[4],w[5]),s.beginPath();let _;if(u)_=u.call(this,s,this);else{const x=this.clipX(),v=this.clipY();s.rect(x||0,v||0,a,l)}s.clip.apply(s,_),w=h.copy().invert().getMatrix(),s.transform(w[0],w[1],w[2],w[3],w[4],w[5])}const g=!p&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";g&&(s.save(),s._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(h){h[e](n,r,i)}),g&&s.restore(),d&&s.restore()}getClientRect(e={}){var n;const r=e.skipTransform,i=e.relativeTo;let o,s,a,l,u={x:1/0,y:1/0,width:0,height:0};const d=this;(n=this.children)===null||n===void 0||n.forEach(function(h){if(!h.visible())return;const w=h.getClientRect({relativeTo:d,skipShadow:e.skipShadow,skipStroke:e.skipStroke});w.width===0&&w.height===0||(o===void 0?(o=w.x,s=w.y,a=w.x+w.width,l=w.y+w.height):(o=Math.min(o,w.x),s=Math.min(s,w.y),a=Math.max(a,w.x+w.width),l=Math.max(l,w.y+w.height)))});const p=this.find("Shape");let g=!1;for(let h=0;hie.indexOf("pointer")>=0?"pointer":ie.indexOf("touch")>=0?"touch":"mouse",M=ie=>{const V=de(ie);if(V==="pointer")return i.Konva.pointerEventsEnabled&&X.pointer;if(V==="touch")return X.touch;if(V==="mouse")return X.mouse};function G(ie={}){return(ie.clipFunc||ie.clipWidth||ie.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),ie}const H="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";t.stages=[];class ne extends r.Container{constructor(V){super(G(V)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),t.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(V){const Z=V.getType()==="Layer",ce=V.getType()==="FastLayer";Z||ce||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const V=this.visible()?"":"none";this.content.style.display=V}setContainer(V){if(typeof V===d){if(V.charAt(0)==="."){const ce=V.slice(1);V=document.getElementsByClassName(ce)[0]}else{var Z;V.charAt(0)!=="#"?Z=V:Z=V.slice(1),V=document.getElementById(Z)}if(!V)throw"Can not find container in document with id "+Z}return this._setAttr("container",V),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),V.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let V=this.children,Z=V.length,ce;for(ce=0;ce-1&&t.stages.splice(Z,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const V=this._pointerPositions[0]||this._changedPointerPositions[0];return V?{x:V.x,y:V.y}:(e.Util.warn(H),null)}_getPointerById(V){return this._pointerPositions.find(Z=>Z.id===V)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(V){V=V||{},V.x=V.x||0,V.y=V.y||0,V.width=V.width||this.width(),V.height=V.height||this.height();const Z=new o.SceneCanvas({width:V.width,height:V.height,pixelRatio:V.pixelRatio||1}),ce=Z.getContext()._context,xe=this.children;return(V.x||V.y)&&ce.translate(-1*V.x,-1*V.y),xe.forEach(function(we){if(!we.isVisible())return;const Ce=we._toKonvaCanvas(V);ce.drawImage(Ce._canvas,V.x,V.y,Ce.getWidth()/Ce.getPixelRatio(),Ce.getHeight()/Ce.getPixelRatio())}),Z}getIntersection(V){if(!V)return null;let Z=this.children,ce=Z.length,xe=ce-1,we;for(we=xe;we>=0;we--){const Ce=Z[we].getIntersection(V);if(Ce)return Ce}return null}_resizeDOM(){const V=this.width(),Z=this.height();this.content&&(this.content.style.width=V+p,this.content.style.height=Z+p),this.bufferCanvas.setSize(V,Z),this.bufferHitCanvas.setSize(V,Z),this.children.forEach(ce=>{ce.setSize({width:V,height:Z}),ce.draw()})}add(V,...Z){if(arguments.length>1){for(let xe=0;xeK&&e.Util.warn("The stage has "+ce+" 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."),V.setSize({width:this.width(),height:this.height()}),V.draw(),i.Konva.isBrowser&&this.content.appendChild(V.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(V){return l.hasPointerCapture(V,this)}setPointerCapture(V){l.setPointerCapture(V,this)}releaseCapture(V){l.releaseCapture(V,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&te.forEach(([V,Z])=>{this.content.addEventListener(V,ce=>{this[Z](ce)},{passive:!1})})}_pointerenter(V){this.setPointersPositions(V);const Z=M(V.type);Z&&this._fire(Z.pointerenter,{evt:V,target:this,currentTarget:this})}_pointerover(V){this.setPointersPositions(V);const Z=M(V.type);Z&&this._fire(Z.pointerover,{evt:V,target:this,currentTarget:this})}_getTargetShape(V){let Z=this[V+"targetShape"];return Z&&!Z.getStage()&&(Z=null),Z}_pointerleave(V){const Z=M(V.type),ce=de(V.type);if(!Z)return;this.setPointersPositions(V);const xe=this._getTargetShape(ce),we=!(i.Konva.isDragging()||i.Konva.isTransforming())||i.Konva.hitOnDragEnabled;xe&&we?(xe._fireAndBubble(Z.pointerout,{evt:V}),xe._fireAndBubble(Z.pointerleave,{evt:V}),this._fire(Z.pointerleave,{evt:V,target:this,currentTarget:this}),this[ce+"targetShape"]=null):we&&(this._fire(Z.pointerleave,{evt:V,target:this,currentTarget:this}),this._fire(Z.pointerout,{evt:V,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(V){const Z=M(V.type),ce=de(V.type);if(!Z)return;this.setPointersPositions(V);let xe=!1;this._changedPointerPositions.forEach(we=>{const Ce=this.getIntersection(we);if(s.DD.justDragged=!1,i.Konva["_"+ce+"ListenClick"]=!0,!Ce||!Ce.isListening()){this[ce+"ClickStartShape"]=void 0;return}i.Konva.capturePointerEventsEnabled&&Ce.setPointerCapture(we.id),this[ce+"ClickStartShape"]=Ce,Ce._fireAndBubble(Z.pointerdown,{evt:V,pointerId:we.id}),xe=!0;const ke=V.type.indexOf("touch")>=0;Ce.preventDefault()&&V.cancelable&&ke&&V.preventDefault()}),xe||this._fire(Z.pointerdown,{evt:V,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(V){const Z=M(V.type),ce=de(V.type);if(!Z||(i.Konva.isDragging()&&s.DD.node.preventDefault()&&V.cancelable&&V.preventDefault(),this.setPointersPositions(V),!(!(i.Konva.isDragging()||i.Konva.isTransforming())||i.Konva.hitOnDragEnabled)))return;const we={};let Ce=!1;const ke=this._getTargetShape(ce);this._changedPointerPositions.forEach(ze=>{const me=l.getCapturedShape(ze.id)||this.getIntersection(ze),J=ze.id,qe={evt:V,pointerId:J},Be=ke!==me;if(Be&&ke&&(ke._fireAndBubble(Z.pointerout,{...qe},me),ke._fireAndBubble(Z.pointerleave,{...qe},me)),me){if(we[me._id])return;we[me._id]=!0}me&&me.isListening()?(Ce=!0,Be&&(me._fireAndBubble(Z.pointerover,{...qe},ke),me._fireAndBubble(Z.pointerenter,{...qe},ke),this[ce+"targetShape"]=me),me._fireAndBubble(Z.pointermove,{...qe})):ke&&(this._fire(Z.pointerover,{evt:V,target:this,currentTarget:this,pointerId:J}),this[ce+"targetShape"]=null)}),Ce||this._fire(Z.pointermove,{evt:V,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(V){const Z=M(V.type),ce=de(V.type);if(!Z)return;this.setPointersPositions(V);const xe=this[ce+"ClickStartShape"],we=this[ce+"ClickEndShape"],Ce={};let ke=!1;this._changedPointerPositions.forEach(ze=>{const me=l.getCapturedShape(ze.id)||this.getIntersection(ze);if(me){if(me.releaseCapture(ze.id),Ce[me._id])return;Ce[me._id]=!0}const J=ze.id,qe={evt:V,pointerId:J};let Be=!1;i.Konva["_"+ce+"InDblClickWindow"]?(Be=!0,clearTimeout(this[ce+"DblTimeout"])):s.DD.justDragged||(i.Konva["_"+ce+"InDblClickWindow"]=!0,clearTimeout(this[ce+"DblTimeout"])),this[ce+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ce+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),me&&me.isListening()?(ke=!0,this[ce+"ClickEndShape"]=me,me._fireAndBubble(Z.pointerup,{...qe}),i.Konva["_"+ce+"ListenClick"]&&xe&&xe===me&&(me._fireAndBubble(Z.pointerclick,{...qe}),Be&&we&&we===me&&me._fireAndBubble(Z.pointerdblclick,{...qe}))):(this[ce+"ClickEndShape"]=null,i.Konva["_"+ce+"ListenClick"]&&this._fire(Z.pointerclick,{evt:V,target:this,currentTarget:this,pointerId:J}),Be&&this._fire(Z.pointerdblclick,{evt:V,target:this,currentTarget:this,pointerId:J}))}),ke||this._fire(Z.pointerup,{evt:V,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ce+"ListenClick"]=!1,V.cancelable&&ce!=="touch"&&V.preventDefault()}_contextmenu(V){this.setPointersPositions(V);const Z=this.getIntersection(this.getPointerPosition());Z&&Z.isListening()?Z._fireAndBubble(E,{evt:V}):this._fire(E,{evt:V,target:this,currentTarget:this})}_wheel(V){this.setPointersPositions(V);const Z=this.getIntersection(this.getPointerPosition());Z&&Z.isListening()?Z._fireAndBubble(se,{evt:V}):this._fire(se,{evt:V,target:this,currentTarget:this})}_pointercancel(V){this.setPointersPositions(V);const Z=l.getCapturedShape(V.pointerId)||this.getIntersection(this.getPointerPosition());Z&&Z._fireAndBubble(L,l.createEvent(V)),l.releaseCapture(V.pointerId)}_lostpointercapture(V){l.releaseCapture(V.pointerId)}setPointersPositions(V){let Z=this._getContentPosition(),ce=null,xe=null;V=V||window.event,V.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(V.touches,we=>{this._pointerPositions.push({id:we.identifier,x:(we.clientX-Z.left)/Z.scaleX,y:(we.clientY-Z.top)/Z.scaleY})}),Array.prototype.forEach.call(V.changedTouches||V.touches,we=>{this._changedPointerPositions.push({id:we.identifier,x:(we.clientX-Z.left)/Z.scaleX,y:(we.clientY-Z.top)/Z.scaleY})})):(ce=(V.clientX-Z.left)/Z.scaleX,xe=(V.clientY-Z.top)/Z.scaleY,this.pointerPos={x:ce,y:xe},this._pointerPositions=[{x:ce,y:xe,id:e.Util._getFirstPointerId(V)}],this._changedPointerPositions=[{x:ce,y:xe,id:e.Util._getFirstPointerId(V)}])}_setPointerPosition(V){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(V)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const V=this.content.getBoundingClientRect();return{top:V.top,left:V.left,scaleX:V.width/this.content.clientWidth||1,scaleY:V.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!i.Konva.isBrowser)return;const V=this.container();if(!V)throw"Stage has no container. A container is required.";V.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"),V.appendChild(this.content),this._resizeDOM()}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(V){V.batchDraw()}),this}}t.Stage=ne,ne.prototype.nodeType=u,(0,a._registerNode)(ne),n.Factory.addGetterSetter(ne,"container"),i.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach(ie=>{ie.batchDraw()})})})(K8);var wh={},Mn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=$e,n=Zt,r=at,i=Ht,o=Xe,s=$e,a=qs,l="hasShadow",u="shadowRGBA",d="patternImage",p="linearGradient",g="radialGradient";let h;function w(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}t.shapes={};function _(z){const T=this.attrs.fillRule;T?z.fill(T):z.fill()}function x(z){z.stroke()}function v(z){const T=this.attrs.fillRule;T?z.fill(T):z.fill()}function S(z){z.stroke()}function y(){this._clearCache(l)}function A(){this._clearCache(u)}function L(){this._clearCache(d)}function R(){this._clearCache(p)}function D(){this._clearCache(g)}class k extends i.Node{constructor(T){super(T);let P;for(;P=n.Util.getRandomColor(),!(P&&!(P in t.shapes)););this.colorKey=P,t.shapes[P]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(d,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const P=w().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(P&&P.setTransform){const E=new n.Transform;E.translate(this.fillPatternX(),this.fillPatternY()),E.rotate(e.Konva.getAngle(this.fillPatternRotation())),E.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),E.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const W=E.getMatrix(),B=typeof DOMMatrix>"u"?{a:W[0],b:W[1],c:W[2],d:W[3],e:W[4],f:W[5]}:new DOMMatrix(W);P.setTransform(B)}return P}}_getLinearGradient(){return this._getCache(p,this.__getLinearGradient)}__getLinearGradient(){const T=this.fillLinearGradientColorStops();if(T){const P=w(),E=this.fillLinearGradientStartPoint(),W=this.fillLinearGradientEndPoint(),B=P.createLinearGradient(E.x,E.y,W.x,W.y);for(let Q=0;Qthis.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 T=this.hitStrokeWidth();return T==="auto"?this.hasStroke():this.strokeEnabled()&&!!T}intersects(T){const P=this.getStage();if(!P)return!1;const E=P.bufferHitCanvas;return E.getContext().clear(),this.drawHit(E,void 0,!0),E.context.getImageData(Math.round(T.x),Math.round(T.y),1,1).data[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(T){var P;if(!((P=this.attrs.perfectDrawEnabled)!==null&&P!==void 0?P:!0))return!1;const W=T||this.hasFill(),B=this.hasStroke(),Q=this.getAbsoluteOpacity()!==1;if(W&&B&&Q)return!0;const ee=this.hasShadow(),se=this.shadowForStrokeEnabled();return!!(W&&B&&ee&&se)}setStrokeHitEnabled(T){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),T?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const T=this.size();return{x:this._centroid?-T.width/2:0,y:this._centroid?-T.height/2:0,width:T.width,height:T.height}}getClientRect(T={}){let P=!1,E=this.getParent();for(;E;){if(E.isCached()){P=!0;break}E=E.getParent()}const W=T.skipTransform,B=T.relativeTo||P&&this.getStage()||void 0,Q=this.getSelfRect(),se=!T.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,K=Q.width+se,te=Q.height+se,X=!T.skipShadow&&this.hasShadow(),de=X?this.shadowOffsetX():0,M=X?this.shadowOffsetY():0,G=K+Math.abs(de),H=te+Math.abs(M),ne=X&&this.shadowBlur()||0,ie=G+ne*2,V=H+ne*2,Z={width:ie,height:V,x:-(se/2+ne)+Math.min(de,0)+Q.x,y:-(se/2+ne)+Math.min(M,0)+Q.y};return W?Z:this._transformedRect(Z,B)}drawScene(T,P,E){const W=this.getLayer();let B=T||W.getCanvas(),Q=B.getContext(),ee=this._getCanvasCache(),se=this.getSceneFunc(),K=this.hasShadow(),te,X;const de=B.isCache,M=P===this;if(!this.isVisible()&&!M)return this;if(ee){Q.save();const H=this.getAbsoluteTransform(P).getMatrix();return Q.transform(H[0],H[1],H[2],H[3],H[4],H[5]),this._drawCachedSceneCanvas(Q),Q.restore(),this}if(!se)return this;if(Q.save(),this._useBufferCanvas()&&!de){te=this.getStage();const H=E||te.bufferCanvas;X=H.getContext(),X.clear(),X.save(),X._applyLineJoin(this);var G=this.getAbsoluteTransform(P).getMatrix();X.transform(G[0],G[1],G[2],G[3],G[4],G[5]),se.call(this,X,this),X.restore();const ne=H.pixelRatio;K&&Q._applyShadow(this),Q._applyOpacity(this),Q._applyGlobalCompositeOperation(this),Q.drawImage(H._canvas,0,0,H.width/ne,H.height/ne)}else{if(Q._applyLineJoin(this),!M){var G=this.getAbsoluteTransform(P).getMatrix();Q.transform(G[0],G[1],G[2],G[3],G[4],G[5]),Q._applyOpacity(this),Q._applyGlobalCompositeOperation(this)}K&&Q._applyShadow(this),se.call(this,Q,this)}return Q.restore(),this}drawHit(T,P,E=!1){if(!this.shouldDrawHit(P,E))return this;const W=this.getLayer(),B=T||W.hitCanvas,Q=B&&B.getContext(),ee=this.hitFunc()||this.sceneFunc(),se=this._getCanvasCache(),K=se&&se.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),K){Q.save();const X=this.getAbsoluteTransform(P).getMatrix();return Q.transform(X[0],X[1],X[2],X[3],X[4],X[5]),this._drawCachedHitCanvas(Q),Q.restore(),this}if(!ee)return this;if(Q.save(),Q._applyLineJoin(this),!(this===P)){const X=this.getAbsoluteTransform(P).getMatrix();Q.transform(X[0],X[1],X[2],X[3],X[4],X[5])}return ee.call(this,Q,this),Q.restore(),this}drawHitFromCache(T=0){let P=this._getCanvasCache(),E=this._getCachedSceneCanvas(),W=P.hit,B=W.getContext(),Q=W.getWidth(),ee=W.getHeight(),se,K,te,X,de,M;B.clear(),B.drawImage(E._canvas,0,0,Q,ee);try{for(se=B.getImageData(0,0,Q,ee),K=se.data,te=K.length,X=n.Util._hexToRgb(this.colorKey),de=0;deT?(K[de]=X.r,K[de+1]=X.g,K[de+2]=X.b,K[de+3]=255):K[de+3]=0;B.putImageData(se,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(T){return a.hasPointerCapture(T,this)}setPointerCapture(T){a.setPointerCapture(T,this)}releaseCapture(T){a.releaseCapture(T,this)}}t.Shape=k,k.prototype._fillFunc=_,k.prototype._strokeFunc=x,k.prototype._fillFuncHit=v,k.prototype._strokeFuncHit=S,k.prototype._centroid=!1,k.prototype.nodeType="Shape",(0,s._registerNode)(k),k.prototype.eventListeners={},k.prototype.on.call(k.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",y),k.prototype.on.call(k.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",A),k.prototype.on.call(k.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",L),k.prototype.on.call(k.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",R),k.prototype.on.call(k.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",D),r.Factory.addGetterSetter(k,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(k,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(k,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(k,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(k,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(k,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(k,"lineJoin"),r.Factory.addGetterSetter(k,"lineCap"),r.Factory.addGetterSetter(k,"sceneFunc"),r.Factory.addGetterSetter(k,"hitFunc"),r.Factory.addGetterSetter(k,"dash"),r.Factory.addGetterSetter(k,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(k,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(k,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(k,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"fillPatternImage"),r.Factory.addGetterSetter(k,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(k,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(k,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(k,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(k,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(k,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(k,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(k,"fillEnabled",!0),r.Factory.addGetterSetter(k,"strokeEnabled",!0),r.Factory.addGetterSetter(k,"shadowEnabled",!0),r.Factory.addGetterSetter(k,"dashEnabled",!0),r.Factory.addGetterSetter(k,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(k,"fillPriority","color"),r.Factory.addComponentsGetterSetter(k,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(k,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(k,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(k,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(k,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(k,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(k,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(k,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(k,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(k,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(k,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(k,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(k,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(k,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(k,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(k,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(k,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(k,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(k,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(k,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(k,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(k,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(k,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(k,"fillPatternRotation",0),r.Factory.addGetterSetter(k,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(k,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Mn);Object.defineProperty(wh,"__esModule",{value:!0});wh.Layer=void 0;const xo=Zt,Up=Ia,xl=Ht,Fg=at,q3=ji,kk=Xe,Ek=Mn,Tk=$e,Mk="#",jk="beforeDraw",Fk="draw",Q8=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Ik=Q8.length;class _c extends Up.Container{constructor(e){super(e),this.canvas=new q3.SceneCanvas,this.hitCanvas=new q3.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let n=1,r=!1;for(;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(e,n){const r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(jk,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Up.Container.prototype.drawScene.call(this,i,n),this._fire(Fk,{node:this}),this}drawHit(e,n){const r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Up.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){xo.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return xo.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return xo.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}wh.Layer=_c;_c.prototype.nodeType="Layer";(0,Tk._registerNode)(_c);Fg.Factory.addGetterSetter(_c,"imageSmoothingEnabled",!0);Fg.Factory.addGetterSetter(_c,"clearBeforeDraw",!0);Fg.Factory.addGetterSetter(_c,"hitGraphEnabled",!0,(0,kk.getBooleanValidator)());var C1={};Object.defineProperty(C1,"__esModule",{value:!0});C1.FastLayer=void 0;const Ok=Zt,Rk=wh,Bk=$e;class Ig extends Rk.Layer{constructor(e){super(e),this.listening(!1),Ok.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}C1.FastLayer=Ig;Ig.prototype.nodeType="FastLayer";(0,Bk._registerNode)(Ig);var Sc={};Object.defineProperty(Sc,"__esModule",{value:!0});Sc.Group=void 0;const Dk=Zt,Uk=Ia,zk=$e;class Og extends Uk.Container{_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&Dk.Util.throw("You may only add groups and shapes to groups.")}}Sc.Group=Og;Og.prototype.nodeType="Group";(0,zk._registerNode)(Og);var xc={};Object.defineProperty(xc,"__esModule",{value:!0});xc.Animation=void 0;const zp=$e,W3=Zt,Gp=function(){return zp.glob.performance&&zp.glob.performance.now?function(){return zp.glob.performance.now()}:function(){return new Date().getTime()}}();class eo{constructor(e,n){this.id=eo.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Gp(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];return e&&(n=Array.isArray(e)?e:[e]),this.layers=n,this}getLayers(){return this.layers}addLayer(e){const n=this.layers,r=n.length;for(let i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():w<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=w,this.update())}getTime(){return this._time}setPosition(w){this.prevPos=this._pos,this.propFunc(w),this._pos=w}getPosition(w){return w===void 0&&(w=this._time),this.func(w,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(w){this.pause(),this._time=w,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const w=this.getTimer()-this._startTime;this.state===a?this.setTime(w):this.state===l&&this.setTime(this.duration-w)}pause(){this.state=s,this.fire("onPause")}getTimer(){return new Date().getTime()}}class g{constructor(w){let _=this,x=w.node,v=x._id,S,y=w.easing||t.Easings.Linear,A=!!w.yoyo,L;typeof w.duration>"u"?S=.3:w.duration===0?S=.001:S=w.duration,this.node=x,this._id=u++;const R=x.getLayer()||(x instanceof i.Konva.Stage?x.getLayers():null);R||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){_.tween.onEnterFrame()},R),this.tween=new p(L,function(D){_._tweenFunc(D)},y,0,1,S*1e3,A),this._addListeners(),g.attrs[v]||(g.attrs[v]={}),g.attrs[v][this._id]||(g.attrs[v][this._id]={}),g.tweens[v]||(g.tweens[v]={});for(L in w)o[L]===void 0&&this._addAttr(L,w[L]);this.reset(),this.onFinish=w.onFinish,this.onReset=w.onReset,this.onUpdate=w.onUpdate}_addAttr(w,_){let x=this.node,v=x._id,S,y,A,L,R,D,k,z;if(A=g.tweens[v][w],A&&delete g.attrs[v][A][w],S=x.getAttr(w),e.Util._isArray(_))if(y=[],R=Math.max(_.length,S.length),w==="points"&&_.length!==S.length&&(_.length>S.length?(k=S,S=e.Util._prepareArrayForTween(S,_,x.closed())):(D=_,_=e.Util._prepareArrayForTween(_,S,x.closed()))),w.indexOf("fill")===0)for(L=0;L{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const w=this.node,_=g.attrs[w._id][this._id];_.points&&_.points.trueEnd&&w.setAttr("points",_.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const w=this.node,_=g.attrs[w._id][this._id];_.points&&_.points.trueStart&&w.points(_.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(w){return this.tween.seek(w*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let w=this.node._id,_=this._id,x=g.tweens[w],v;this.pause();for(v in x)delete g.tweens[w][v];delete g.attrs[w][_]}}t.Tween=g,g.attrs={},g.tweens={},r.Node.prototype.to=function(h){const w=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),w&&w()},new g(h).play()},t.Easings={BackEaseIn(h,w,_,x){return _*(h/=x)*h*((1.70158+1)*h-1.70158)+w},BackEaseOut(h,w,_,x){return _*((h=h/x-1)*h*((1.70158+1)*h+1.70158)+1)+w},BackEaseInOut(h,w,_,x){let v=1.70158;return(h/=x/2)<1?_/2*(h*h*(((v*=1.525)+1)*h-v))+w:_/2*((h-=2)*h*(((v*=1.525)+1)*h+v)+2)+w},ElasticEaseIn(h,w,_,x,v,S){let y=0;return h===0?w:(h/=x)===1?w+_:(S||(S=x*.3),!v||v0?e:n),d=s*n,p=a*(a>0?e:n),g=l*(l>0?n:e);return{x:u,y:r?-1*g:p,width:d-u,height:g-p}}}P1.Arc=qo;qo.prototype._centroid=!0;qo.prototype.className="Arc";qo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Vk._registerNode)(qo);L1.Factory.addGetterSetter(qo,"innerRadius",0,(0,k1.getNumberValidator)());L1.Factory.addGetterSetter(qo,"outerRadius",0,(0,k1.getNumberValidator)());L1.Factory.addGetterSetter(qo,"angle",0,(0,k1.getNumberValidator)());L1.Factory.addGetterSetter(qo,"clockwise",!1,(0,k1.getBooleanValidator)());var E1={},bh={};Object.defineProperty(bh,"__esModule",{value:!0});bh.Line=void 0;const T1=at,qk=$e,Wk=Mn,Z8=Xe;function p5(t,e,n,r,i,o,s){const a=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=s*a/(a+l),d=s*l/(a+l),p=n-u*(i-t),g=r-u*(o-e),h=n+d*(i-t),w=r+d*(o-e);return[p,g,h,w]}function Y3(t,e){const n=t.length,r=[];for(let i=2;i4){for(a=this.getTensionPoints(),l=a.length,u=o?0:4,o||e.quadraticCurveTo(a[0],a[1],a[2],a[3]);u{let u,d;const g=l/2;u=0;for(let h=0;h<20;h++)d=g*t.tValues[20][h]+g,u+=t.cValues[20][h]*r(s,a,d);return g*u};t.getCubicArcLength=e;const n=(s,a,l)=>{l===void 0&&(l=1);const u=s[0]-2*s[1]+s[2],d=a[0]-2*a[1]+a[2],p=2*s[1]-2*s[0],g=2*a[1]-2*a[0],h=4*(u*u+d*d),w=4*(u*p+d*g),_=p*p+g*g;if(h===0)return l*Math.sqrt(Math.pow(s[2]-s[0],2)+Math.pow(a[2]-a[0],2));const x=w/(2*h),v=_/h,S=l+x,y=v-x*x,A=S*S+y>0?Math.sqrt(S*S+y):0,L=x*x+y>0?Math.sqrt(x*x+y):0,R=x+Math.sqrt(x*x+y)!==0?y*Math.log(Math.abs((S+A)/(x+L))):0;return Math.sqrt(h)/2*(S*A-x*L+R)};t.getQuadraticArcLength=n;function r(s,a,l){const u=i(1,l,s),d=i(1,l,a),p=u*u+d*d;return Math.sqrt(p)}const i=(s,a,l)=>{const u=l.length-1;let d,p;if(u===0)return 0;if(s===0){p=0;for(let g=0;g<=u;g++)p+=t.binomialCoefficients[u][g]*Math.pow(1-a,u-g)*Math.pow(a,g)*l[g];return p}else{d=new Array(u);for(let g=0;g{let u=1,d=s/a,p=(s-l(d))/a,g=0;for(;u>.001;){const h=l(d+p),w=Math.abs(s-h)/a;if(w500)break}return d};t.t2length=o})(ew);Object.defineProperty(Ac,"__esModule",{value:!0});Ac.Path=void 0;const Hk=at,Yk=Mn,Kk=$e,Al=ew;class kn extends Yk.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=kn.parsePathData(this.data()),this.pathLength=kn.getPathLength(this.dataArray)}_sceneFunc(e){const n=this.dataArray;e.beginPath();let r=!1;for(let _=0;_a?s:a,h=s>a?1:s/a,w=s>a?a/s:1;e.translate(i,o),e.rotate(d),e.scale(h,w),e.arc(0,0,g,l,l+u,1-p),e.scale(1/h,1/w),e.rotate(-d),e.translate(-i,-o);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(l){if(l.command==="A"){const u=l.points[4],d=l.points[5],p=l.points[4]+d;let g=Math.PI/180;if(Math.abs(u-p)p;h-=g){const w=kn.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],h,0);e.push(w.x,w.y)}else for(let h=u+g;hn[i].pathLength;)e-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(e<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};const s=n[i],a=s.points;switch(s.command){case"L":return kn.getPointOnLine(e,s.start.x,s.start.y,a[0],a[1]);case"C":return kn.getPointOnCubicBezier((0,Al.t2length)(e,kn.getPathLength(n),_=>(0,Al.getCubicArcLength)([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],_)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return kn.getPointOnQuadraticBezier((0,Al.t2length)(e,kn.getPathLength(n),_=>(0,Al.getQuadraticArcLength)([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],_)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":var l=a[0],u=a[1],d=a[2],p=a[3],g=a[4],h=a[5],w=a[6];return g+=h*e/s.pathLength,kn.getPointOnEllipticalArc(l,u,d,p,g,w)}return null}static getPointOnLine(e,n,r,i,o,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,i,o);if(l<1e-10)return{x:n,y:r};if(i===n)return{x:s,y:a+(o>r?e:-e)};const u=(o-r)/(i-n),d=Math.sqrt(e*e/(1+u*u))*(i0&&!isNaN(T[0]);){let P="",E=[];const W=l,B=u;var g,h,w,_,x,v,S,y,A,L;switch(z){case"l":l+=T.shift(),u+=T.shift(),P="L",E.push(l,u);break;case"L":l=T.shift(),u=T.shift(),E.push(l,u);break;case"m":var R=T.shift(),D=T.shift();if(l+=R,u+=D,P="M",s.length>2&&s[s.length-1].command==="z"){for(let Q=s.length-2;Q>=0;Q--)if(s[Q].command==="M"){l=s[Q].points[0]+R,u=s[Q].points[1]+D;break}}E.push(l,u),z="l";break;case"M":l=T.shift(),u=T.shift(),P="M",E.push(l,u),z="L";break;case"h":l+=T.shift(),P="L",E.push(l,u);break;case"H":l=T.shift(),P="L",E.push(l,u);break;case"v":u+=T.shift(),P="L",E.push(l,u);break;case"V":u=T.shift(),P="L",E.push(l,u);break;case"C":E.push(T.shift(),T.shift(),T.shift(),T.shift()),l=T.shift(),u=T.shift(),E.push(l,u);break;case"c":E.push(l+T.shift(),u+T.shift(),l+T.shift(),u+T.shift()),l+=T.shift(),u+=T.shift(),P="C",E.push(l,u);break;case"S":h=l,w=u,g=s[s.length-1],g.command==="C"&&(h=l+(l-g.points[2]),w=u+(u-g.points[3])),E.push(h,w,T.shift(),T.shift()),l=T.shift(),u=T.shift(),P="C",E.push(l,u);break;case"s":h=l,w=u,g=s[s.length-1],g.command==="C"&&(h=l+(l-g.points[2]),w=u+(u-g.points[3])),E.push(h,w,l+T.shift(),u+T.shift()),l+=T.shift(),u+=T.shift(),P="C",E.push(l,u);break;case"Q":E.push(T.shift(),T.shift()),l=T.shift(),u=T.shift(),E.push(l,u);break;case"q":E.push(l+T.shift(),u+T.shift()),l+=T.shift(),u+=T.shift(),P="Q",E.push(l,u);break;case"T":h=l,w=u,g=s[s.length-1],g.command==="Q"&&(h=l+(l-g.points[0]),w=u+(u-g.points[1])),l=T.shift(),u=T.shift(),P="Q",E.push(h,w,l,u);break;case"t":h=l,w=u,g=s[s.length-1],g.command==="Q"&&(h=l+(l-g.points[0]),w=u+(u-g.points[1])),l+=T.shift(),u+=T.shift(),P="Q",E.push(h,w,l,u);break;case"A":_=T.shift(),x=T.shift(),v=T.shift(),S=T.shift(),y=T.shift(),A=l,L=u,l=T.shift(),u=T.shift(),P="A",E=this.convertEndpointToCenterParameterization(A,L,l,u,S,y,_,x,v);break;case"a":_=T.shift(),x=T.shift(),v=T.shift(),S=T.shift(),y=T.shift(),A=l,L=u,l+=T.shift(),u+=T.shift(),P="A",E=this.convertEndpointToCenterParameterization(A,L,l,u,S,y,_,x,v);break}s.push({command:P||z,points:E,start:{x:W,y:B},pathLength:this.calcLength(W,B,P||z,E)})}(z==="z"||z==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,i){let o,s,a,l;const u=kn;switch(r){case"L":return u.getLineLength(e,n,i[0],i[1]);case"C":return(0,Al.getCubicArcLength)([e,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,Al.getQuadraticArcLength)([e,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var d=i[4],p=i[5],g=i[4]+p,h=Math.PI/180;if(Math.abs(d-g)g;l-=h)a=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=d+h;l1&&(a*=Math.sqrt(h),l*=Math.sqrt(h));let w=Math.sqrt((a*a*(l*l)-a*a*(g*g)-l*l*(p*p))/(a*a*(g*g)+l*l*(p*p)));o===s&&(w*=-1),isNaN(w)&&(w=0);const _=w*a*g/l,x=w*-l*p/a,v=(e+r)/2+Math.cos(d)*_-Math.sin(d)*x,S=(n+i)/2+Math.sin(d)*_+Math.cos(d)*x,y=function(T){return Math.sqrt(T[0]*T[0]+T[1]*T[1])},A=function(T,P){return(T[0]*P[0]+T[1]*P[1])/(y(T)*y(P))},L=function(T,P){return(T[0]*P[1]=1&&(z=0),s===0&&z>0&&(z=z-2*Math.PI),s===1&&z<0&&(z=z+2*Math.PI),[v,S,a,l,R,z,d,s]}}Ac.Path=kn;kn.prototype.className="Path";kn.prototype._attrsAffectingSize=["data"];(0,Kk._registerNode)(kn);Hk.Factory.addGetterSetter(kn,"data");Object.defineProperty(E1,"__esModule",{value:!0});E1.Arrow=void 0;const M1=at,Xk=bh,tw=Xe,$k=$e,K3=Ac;class Ra extends Xk.Line{_sceneFunc(e){super._sceneFunc(e);const n=Math.PI*2,r=this.points();let i=r;const o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());const s=this.pointerLength(),a=r.length;let l,u;if(o){const g=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[a-2],r[a-1]],h=K3.Path.calcLength(i[i.length-4],i[i.length-3],"C",g),w=K3.Path.getPointOnQuadraticBezier(Math.min(1,1-s/h),g[0],g[1],g[2],g[3],g[4],g[5]);l=r[a-2]-w.x,u=r[a-1]-w.y}else l=r[a-2]-r[a-4],u=r[a-1]-r[a-3];const d=(Math.atan2(u,l)+n)%n,p=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[a-2],r[a-1]),e.rotate(d),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]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),e.rotate((Math.atan2(-u,-l)+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){const n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}}E1.Arrow=Ra;Ra.prototype.className="Arrow";(0,$k._registerNode)(Ra);M1.Factory.addGetterSetter(Ra,"pointerLength",10,(0,tw.getNumberValidator)());M1.Factory.addGetterSetter(Ra,"pointerWidth",10,(0,tw.getNumberValidator)());M1.Factory.addGetterSetter(Ra,"pointerAtBeginning",!1);M1.Factory.addGetterSetter(Ra,"pointerAtEnding",!0);var j1={};Object.defineProperty(j1,"__esModule",{value:!0});j1.Circle=void 0;const Qk=at,Jk=Mn,Zk=Xe,eE=$e;class Nc extends Jk.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}j1.Circle=Nc;Nc.prototype._centroid=!0;Nc.prototype.className="Circle";Nc.prototype._attrsAffectingSize=["radius"];(0,eE._registerNode)(Nc);Qk.Factory.addGetterSetter(Nc,"radius",0,(0,Zk.getNumberValidator)());var F1={};Object.defineProperty(F1,"__esModule",{value:!0});F1.Ellipse=void 0;const Rg=at,tE=Mn,nw=Xe,nE=$e;class Hs extends tE.Shape{_sceneFunc(e){const n=this.radiusX(),r=this.radiusY();e.beginPath(),e.save(),n!==r&&e.scale(1,r/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}F1.Ellipse=Hs;Hs.prototype.className="Ellipse";Hs.prototype._centroid=!0;Hs.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,nE._registerNode)(Hs);Rg.Factory.addComponentsGetterSetter(Hs,"radius",["x","y"]);Rg.Factory.addGetterSetter(Hs,"radiusX",0,(0,nw.getNumberValidator)());Rg.Factory.addGetterSetter(Hs,"radiusY",0,(0,nw.getNumberValidator)());var I1={};Object.defineProperty(I1,"__esModule",{value:!0});I1.Image=void 0;const Vp=Zt,Ba=at,rE=Mn,iE=$e,_h=Xe;let lo=class rw extends rE.Shape{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(){const e=!!this.cornerRadius(),n=this.hasShadow();return e&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let s;if(o){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[o,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?Vp.Util.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),o&&(i&&e.clip(),e.drawImage.apply(e,s))}_hitFunc(e){const n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?Vp.Util.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,r=null){const i=Vp.Util.createImageElement();i.onload=function(){const o=new rw({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}};I1.Image=lo;lo.prototype.className="Image";(0,iE._registerNode)(lo);Ba.Factory.addGetterSetter(lo,"cornerRadius",0,(0,_h.getNumberOrArrayOfNumbersValidator)(4));Ba.Factory.addGetterSetter(lo,"image");Ba.Factory.addComponentsGetterSetter(lo,"crop",["x","y","width","height"]);Ba.Factory.addGetterSetter(lo,"cropX",0,(0,_h.getNumberValidator)());Ba.Factory.addGetterSetter(lo,"cropY",0,(0,_h.getNumberValidator)());Ba.Factory.addGetterSetter(lo,"cropWidth",0,(0,_h.getNumberValidator)());Ba.Factory.addGetterSetter(lo,"cropHeight",0,(0,_h.getNumberValidator)());var cc={};Object.defineProperty(cc,"__esModule",{value:!0});cc.Tag=cc.Label=void 0;const O1=at,oE=Mn,sE=Sc,Bg=Xe,iw=$e,ow=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],aE="Change.konva",lE="none",g5="up",m5="right",v5="down",y5="left",cE=ow.length;class Dg extends sE.Group{constructor(e){super(e),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let n=this,r;const i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}B1.RegularPolygon=Ua;Ua.prototype.className="RegularPolygon";Ua.prototype._centroid=!0;Ua.prototype._attrsAffectingSize=["radius"];(0,mE._registerNode)(Ua);sw.Factory.addGetterSetter(Ua,"radius",0,(0,aw.getNumberValidator)());sw.Factory.addGetterSetter(Ua,"sides",0,(0,aw.getNumberValidator)());var D1={};Object.defineProperty(D1,"__esModule",{value:!0});D1.Ring=void 0;const lw=at,vE=Mn,cw=Xe,yE=$e,X3=Math.PI*2;class za extends vE.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,X3,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),X3,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)}}D1.Ring=za;za.prototype.className="Ring";za.prototype._centroid=!0;za.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,yE._registerNode)(za);lw.Factory.addGetterSetter(za,"innerRadius",0,(0,cw.getNumberValidator)());lw.Factory.addGetterSetter(za,"outerRadius",0,(0,cw.getNumberValidator)());var U1={};Object.defineProperty(U1,"__esModule",{value:!0});U1.Sprite=void 0;const Ga=at,wE=Mn,bE=xc,uw=Xe,_E=$e;class co extends wE.Shape{constructor(e){super(e),this._updated=!0,this.anim=new bE.Animation(()=>{const n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+0],l=o[i+1],u=o[i+2],d=o[i+3],p=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,u,d),e.closePath(),e.fillStrokeShape(this)),p)if(s){const g=s[n],h=r*2;e.drawImage(p,a,l,u,d,g[h+0],g[h+1],u,d)}else e.drawImage(p,a,l,u,d,0,0,u,d)}_hitFunc(e){const n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+2],l=o[i+3];if(e.beginPath(),s){const u=s[n],d=r*2;e.rect(u[d+0],u[d+1],a,l)}else e.rect(0,0,a,l);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;e(new RegExp("\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?(?:\\u200D\\p{Emoji_Presentation})+","u").test(n)?e.push(n):new RegExp("\\p{Regional_Indicator}{2}","u").test(n+(i[r+1]||""))?e.push(n+i[r+1]):r>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(n)?e[e.length-1]+=n:e.push(n),e),[])}const Nl="auto",CE="center",dw="inherit",mu="justify",PE="Change.konva",LE="2d",$3="-",fw="left",kE="text",EE="Text",TE="top",ME="bottom",Q3="middle",pw="normal",jE="px ",Od=" ",FE="right",J3="rtl",IE="word",OE="char",Z3="none",Wp="…",gw=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],RE=gw.length;function BE(t){return t.split(",").map(e=>{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}let Rd;function Hp(){return Rd||(Rd=w5.Util.createCanvasElement().getContext(LE),Rd)}function DE(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function UE(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function zE(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}class cn extends AE.Shape{constructor(e){super(zE(e)),this._partialTextX=0,this._partialTextY=0;for(let n=0;n1&&(S+=s)}}_hitFunc(e){const n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){const n=w5.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(kE,n),this}getWidth(){return this.attrs.width===Nl||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Nl||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return w5.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n,r,i,o,s,a,l,u,d,p,g;let h=Hp(),w=this.fontSize(),_;h.save(),h.font=this._getContextFont(),_=h.measureText(e),h.restore();const x=w/100;return{actualBoundingBoxAscent:(n=_.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*x,actualBoundingBoxDescent:(r=_.actualBoundingBoxDescent)!==null&&r!==void 0?r:0,actualBoundingBoxLeft:(i=_.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*x,actualBoundingBoxRight:(o=_.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*x,alphabeticBaseline:(s=_.alphabeticBaseline)!==null&&s!==void 0?s:0,emHeightAscent:(a=_.emHeightAscent)!==null&&a!==void 0?a:100*x,emHeightDescent:(l=_.emHeightDescent)!==null&&l!==void 0?l:-20*x,fontBoundingBoxAscent:(u=_.fontBoundingBoxAscent)!==null&&u!==void 0?u:91*x,fontBoundingBoxDescent:(d=_.fontBoundingBoxDescent)!==null&&d!==void 0?d:21*x,hangingBaseline:(p=_.hangingBaseline)!==null&&p!==void 0?p:72.80000305175781*x,ideographicBaseline:(g=_.ideographicBaseline)!==null&&g!==void 0?g:-21*x,width:_.width,height:w}}_getContextFont(){return this.fontStyle()+Od+this.fontVariant()+Od+(this.fontSize()+jE)+BE(this.fontFamily())}_addTextLine(e){this.align()===mu&&(e=e.trim());const r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){const n=this.letterSpacing(),r=e.length;return Hp().measureText(e).width+(r?n*(r-1):0)}_setTextData(){let e=this.text().split(` `),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,s=this.attrs.height,a=o!==Nl&&o!==void 0,l=s!==Nl&&s!==void 0,u=this.padding(),d=o-u*2,p=s-u*2,g=0,h=this.wrap(),w=h!==Z3,_=h!==OE&&w,x=this.ellipsis();this.textArr=[],Hp().font=this._getContextFont();const v=x?this._getTextWidth(Wp):0;for(let y=0,A=e.length;yd)for(;L.length>0;){let D=0,k=L.length,z="",T=0;for(;D>>1,E=L.slice(0,P+1),W=this._getTextWidth(E)+v;W<=d?(D=P+1,z=E,T=W):k=P}if(z){if(_){var S;const E=L[z.length];(E===Od||E===$3)&&T<=d?S=z.length:S=Math.max(z.lastIndexOf(Od),z.lastIndexOf($3))+1,S>0&&(D=S,z=z.slice(0,D),T=this._getTextWidth(z))}if(z=z.trimRight(),this._addTextLine(z),r=Math.max(r,T),g+=i,this._shouldHandleEllipsis(g)){this._tryToAddEllipsisToLastLine();break}if(L=L.slice(D),L=L.trimLeft(),L.length>0&&(R=this._getTextWidth(L),R<=d)){this._addTextLine(L),g+=i,r=Math.max(r,R);break}}else break}else this._addTextLine(L),g+=i,r=Math.max(r,R),this._shouldHandleEllipsis(g)&&yp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){const n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Nl&&i!==void 0,s=this.padding(),a=i-s*2;return!(this.wrap()!==Z3)||o&&e+r>a}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,n=e!==Nl&&e!==void 0,r=this.padding(),i=e-r*2,o=this.ellipsis(),s=this.textArr[this.textArr.length-1];!s||!o||(n&&(this._getTextWidth(s.text+Wp)n?null:vu.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=vu.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&e.beginPath();for(let s=0;s=1){const r=n[0].p0;e.moveTo(r.x,r.y)}for(let r=0;rt+`.${bw}`).join(" "),n4="nodesRect",XE=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],$E={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},QE="ontouchstart"in Ci.Konva._global;function JE(t,e,n){if(t==="rotater")return n;e+=Tt.Util.degToRad($E[t]||0);const r=(Tt.Util.radToDeg(e)%360+360)%360;return Tt.Util._inRange(r,315+22.5,360)||Tt.Util._inRange(r,0,22.5)?"ns-resize":Tt.Util._inRange(r,45-22.5,45+22.5)?"nesw-resize":Tt.Util._inRange(r,90-22.5,90+22.5)?"ew-resize":Tt.Util._inRange(r,135-22.5,135+22.5)?"nwse-resize":Tt.Util._inRange(r,180-22.5,180+22.5)?"ns-resize":Tt.Util._inRange(r,225-22.5,225+22.5)?"nesw-resize":Tt.Util._inRange(r,270-22.5,270+22.5)?"ew-resize":Tt.Util._inRange(r,315-22.5,315+22.5)?"nwse-resize":(Tt.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}const Vf=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],r4=1e8;function ZE(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 _w(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:r,y:i}}function eT(t,e){const n=ZE(t);return _w(t,e,n)}function tT(t,e,n){let r=e;for(let i=0;ii.isAncestorOf(this)?(Tt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=n,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},s=i._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");i.on(s,o),i.on(XE.map(a=>a+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=e.getAbsolutePosition(),o=i.x-n.x,s=i.y-n.y;this.nodes().forEach(a=>{if(a===e||a.isDragging())return;const l=a.getAbsolutePosition();a.setAbsolutePosition({x:l.x+o,y:l.y+s}),a.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(n4),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(n4,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(r),s=e.getAbsolutePosition(r),a=i.x*o.x-e.offsetX()*o.x,l=i.y*o.y-e.offsetY()*o.y,u=(Ci.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),d={x:s.x+a*Math.cos(u)+l*Math.sin(-u),y:s.y+l*Math.cos(u)+a*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return _w(d,-Ci.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-r4,y:-r4,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const d=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),p=[{x:d.x,y:d.y},{x:d.x+d.width,y:d.y},{x:d.x+d.width,y:d.y+d.height},{x:d.x,y:d.y+d.height}],g=u.getAbsoluteTransform();p.forEach(function(h){const w=g.point(h);n.push(w)})});const r=new Tt.Transform;r.rotate(-Ci.Konva.getAngle(this.rotation()));let i=1/0,o=1/0,s=-1/0,a=-1/0;n.forEach(function(u){const d=r.point(u);i===void 0&&(i=s=d.x,o=a=d.y),i=Math.min(i,d.x),o=Math.min(o,d.y),s=Math.max(s,d.x),a=Math.max(a,d.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:s-i,height:a-o,rotation:Ci.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Vf.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const n=new HE.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:QE?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{const i=Ci.Konva.getAngle(this.rotation()),o=this.rotateAnchorCursor(),s=JE(e,i,o);n.getStage().content&&(n.getStage().content.style.cursor=s),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){const e=new WE.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n,r){const i=r.getParent(),o=i.padding();n.beginPath(),n.rect(-o,-o,r.width()+o*2,r.height()+o*2),n.moveTo(r.width()/2,-o),i.rotateEnabled()&&i.rotateLineVisible()&&n.lineTo(r.width()/2,-i.rotateAnchorOffset()*Tt.Util._sign(r.height())-o),n.fillStrokeShape(r)},hitFunc:(n,r)=>{if(!this.shouldOverdrawWholeArea())return;const i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}});this.add(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const s=e.target.getAbsolutePosition(),a=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-s.x,y:a.y-s.y},b5++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:e.evt,target:l})})}_handleMouseMove(e){let n,r,i;const o=this.findOne("."+this._movingAnchorName),s=o.getStage();s.setPointersPositions(e);const a=s.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,e)),o.setAbsolutePosition(l);const d=o.getAbsolutePosition();if(u.x===d.x&&u.y===d.y)return;if(this._movingAnchorName==="rotater"){const L=this._getNodeRect();n=o.x()-L.width/2,r=-o.y()+L.height/2;let R=Math.atan2(-r,n)+Math.PI/2;L.height<0&&(R-=Math.PI);const k=Ci.Konva.getAngle(this.rotation())+R,z=Ci.Konva.getAngle(this.rotationSnapTolerance()),P=tT(this.rotationSnaps(),k,z)-L.rotation,E=eT(L,P);this._fitNodesInto(E,e);return}const p=this.shiftBehavior();let g;p==="inverted"?g=this.keepRatio()&&!e.shiftKey:p==="none"?g=this.keepRatio():g=this.keepRatio()||e.shiftKey;var v=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(g){var h=v?{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(h.x-o.x(),2)+Math.pow(h.y-o.y(),2));var w=this.findOne(".top-left").x()>h.x?-1:1,_=this.findOne(".top-left").y()>h.y?-1:1;n=i*this.cos*w,r=i*this.sin*_,this.findOne(".top-left").x(h.x-n),this.findOne(".top-left").y(h.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(g){var h=v?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-h.x,2)+Math.pow(h.y-o.y(),2));var w=this.findOne(".top-right").x()h.y?-1:1;n=i*this.cos*w,r=i*this.sin*_,this.findOne(".top-right").x(h.x+n),this.findOne(".top-right").y(h.y-r)}var x=o.position();this.findOne(".top-left").y(x.y),this.findOne(".bottom-right").x(x.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(g){var h=v?{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(h.x-o.x(),2)+Math.pow(o.y()-h.y,2));var w=h.x{var o;i._fire("transformend",{evt:e,target:i}),(o=i.getLayer())===null||o===void 0||o.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,n){const r=this._getNodeRect(),i=1;if(Tt.Util._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(Tt.Util._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const o=new Tt.Transform;if(o.rotate(Ci.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const g=o.point({x:-this.padding()*2,y:0});e.x+=g.x,e.y+=g.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=g.x,this._anchorDragOffset.y-=g.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const g=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=g.x,this._anchorDragOffset.y-=g.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const g=o.point({x:0,y:-this.padding()*2});e.x+=g.x,e.y+=g.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=g.x,this._anchorDragOffset.y-=g.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const g=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=g.x,this._anchorDragOffset.y-=g.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const g=this.boundBoxFunc()(r,e);g?e=g:Tt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,a=new Tt.Transform;a.translate(r.x,r.y),a.rotate(r.rotation),a.scale(r.width/s,r.height/s);const l=new Tt.Transform,u=e.width/s,d=e.height/s;this.flipEnabled()===!1?(l.translate(e.x,e.y),l.rotate(e.rotation),l.translate(e.width<0?e.width:0,e.height<0?e.height:0),l.scale(Math.abs(u),Math.abs(d))):(l.translate(e.x,e.y),l.rotate(e.rotation),l.scale(u,d));const p=l.multiply(a.invert());this._nodes.forEach(g=>{var h;const w=g.getParent().getAbsoluteTransform(),_=g.getTransform().copy();_.translate(g.offsetX(),g.offsetY());const x=new Tt.Transform;x.multiply(w.copy().invert()).multiply(p).multiply(w).multiply(_);const v=x.decompose();g.setAttrs(v),(h=g.getLayer())===null||h===void 0||h.batchDraw()}),this.rotation(Tt.Util._getRotation(e.rotation)),this._nodes.forEach(g=>{this._fire("transform",{evt:n,target:g}),g._fire("transform",{evt:n,target:g})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e;const n=this._getNodeRect();this.rotation(Tt.Util._getRotation(n.rotation));const r=n.width,i=n.height,o=this.enabledAnchors(),s=this.resizeEnabled(),a=this.padding(),l=this.anchorSize(),u=this.find("._anchor");u.forEach(p=>{p.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+a,offsetY:l/2+a,visible:s&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+a,visible:s&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:s&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+a,visible:s&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-a,visible:s&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-a,visible:s&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Tt.Util._sign(i)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const d=this.anchorStyleFunc();d&&u.forEach(p=>{d(p)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),t4.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return e4.Node.prototype.toObject.call(this)}clone(e){return e4.Node.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}V1.Transformer=ft;ft.isTransforming=()=>b5>0;function nT(t){return t instanceof Array||Tt.Util.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){Vf.indexOf(e)===-1&&Tt.Util.warn("Unknown anchor name: "+e+". Available names are: "+Vf.join(", "))}),t||[]}ft.prototype.className="Transformer";(0,YE._registerNode)(ft);St.Factory.addGetterSetter(ft,"enabledAnchors",Vf,nT);St.Factory.addGetterSetter(ft,"flipEnabled",!0,(0,Xs.getBooleanValidator)());St.Factory.addGetterSetter(ft,"resizeEnabled",!0);St.Factory.addGetterSetter(ft,"anchorSize",10,(0,Xs.getNumberValidator)());St.Factory.addGetterSetter(ft,"rotateEnabled",!0);St.Factory.addGetterSetter(ft,"rotateLineVisible",!0);St.Factory.addGetterSetter(ft,"rotationSnaps",[]);St.Factory.addGetterSetter(ft,"rotateAnchorOffset",50,(0,Xs.getNumberValidator)());St.Factory.addGetterSetter(ft,"rotateAnchorCursor","crosshair");St.Factory.addGetterSetter(ft,"rotationSnapTolerance",5,(0,Xs.getNumberValidator)());St.Factory.addGetterSetter(ft,"borderEnabled",!0);St.Factory.addGetterSetter(ft,"anchorStroke","rgb(0, 161, 255)");St.Factory.addGetterSetter(ft,"anchorStrokeWidth",1,(0,Xs.getNumberValidator)());St.Factory.addGetterSetter(ft,"anchorFill","white");St.Factory.addGetterSetter(ft,"anchorCornerRadius",0,(0,Xs.getNumberValidator)());St.Factory.addGetterSetter(ft,"borderStroke","rgb(0, 161, 255)");St.Factory.addGetterSetter(ft,"borderStrokeWidth",1,(0,Xs.getNumberValidator)());St.Factory.addGetterSetter(ft,"borderDash");St.Factory.addGetterSetter(ft,"keepRatio",!0);St.Factory.addGetterSetter(ft,"shiftBehavior","default");St.Factory.addGetterSetter(ft,"centeredScaling",!1);St.Factory.addGetterSetter(ft,"ignoreStroke",!1);St.Factory.addGetterSetter(ft,"padding",0,(0,Xs.getNumberValidator)());St.Factory.addGetterSetter(ft,"node");St.Factory.addGetterSetter(ft,"nodes");St.Factory.addGetterSetter(ft,"boundBoxFunc");St.Factory.addGetterSetter(ft,"anchorDragBoundFunc");St.Factory.addGetterSetter(ft,"anchorStyleFunc");St.Factory.addGetterSetter(ft,"shouldOverdrawWholeArea",!1);St.Factory.addGetterSetter(ft,"useSingleNodeRotation",!0);St.Factory.backCompat(ft,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var q1={};Object.defineProperty(q1,"__esModule",{value:!0});q1.Wedge=void 0;const W1=at,rT=Mn,iT=$e,Sw=Xe,oT=$e;class Wo extends rT.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,iT.Konva.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}q1.Wedge=Wo;Wo.prototype.className="Wedge";Wo.prototype._centroid=!0;Wo.prototype._attrsAffectingSize=["radius"];(0,oT._registerNode)(Wo);W1.Factory.addGetterSetter(Wo,"radius",0,(0,Sw.getNumberValidator)());W1.Factory.addGetterSetter(Wo,"angle",0,(0,Sw.getNumberValidator)());W1.Factory.addGetterSetter(Wo,"clockwise",!1);W1.Factory.backCompat(Wo,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var H1={};Object.defineProperty(H1,"__esModule",{value:!0});H1.Blur=void 0;const i4=at,sT=Ht,aT=Xe;function o4(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const lT=[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],cT=[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 uT(t,e){const n=t.data,r=t.width,i=t.height;let o,s,a,l,u,d,p,g,h,w,_,x,v,S,y,A,L,R,D,k,z,T,P,E,W=e+e+1,B=r-1,Q=i-1,ee=e+1,se=ee*(ee+1)/2,K=new o4,te=null,X=K,de=null,M=null,G=lT[e],H=cT[e];for(a=1;a>H,P!==0?(P=255/P,n[d]=(g*G>>H)*P,n[d+1]=(h*G>>H)*P,n[d+2]=(w*G>>H)*P):n[d]=n[d+1]=n[d+2]=0,g-=x,h-=v,w-=S,_-=y,x-=de.r,v-=de.g,S-=de.b,y-=de.a,l=p+((l=o+e+1)>H,P>0?(P=255/P,n[l]=(g*G>>H)*P,n[l+1]=(h*G>>H)*P,n[l+2]=(w*G>>H)*P):n[l]=n[l+1]=n[l+2]=0,g-=x,h-=v,w-=S,_-=y,x-=de.r,v-=de.g,S-=de.b,y-=de.a,l=o+((l=s+ee)0&&uT(e,n)};H1.Blur=hT;i4.Factory.addGetterSetter(sT.Node,"blurRadius",0,(0,aT.getNumberValidator)(),i4.Factory.afterSetFilter);var Y1={};Object.defineProperty(Y1,"__esModule",{value:!0});Y1.Brighten=void 0;const s4=at,dT=Ht,fT=Xe,pT=function(t){let e=this.brightness()*255,n=t.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,s=s<0?0:s>255?255:s,n[a]=i,n[a+1]=o,n[a+2]=s};K1.Contrast=vT;a4.Factory.addGetterSetter(gT.Node,"contrast",0,(0,mT.getNumberValidator)(),a4.Factory.afterSetFilter);var X1={};Object.defineProperty(X1,"__esModule",{value:!0});X1.Emboss=void 0;const Os=at,$1=Ht,yT=Zt,xw=Xe,wT=function(t){let e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,s=0,a=t.data,l=t.width,u=t.height,d=l*4,p=u;switch(r){case"top-left":o=-1,s=-1;break;case"top":o=-1,s=0;break;case"top-right":o=-1,s=1;break;case"right":o=0,s=1;break;case"bottom-right":o=1,s=1;break;case"bottom":o=1,s=0;break;case"bottom-left":o=1,s=-1;break;case"left":o=0,s=-1;break;default:yT.Util.error("Unknown emboss direction: "+r)}do{const g=(p-1)*d;let h=o;p+h<1&&(h=0),p+h>u&&(h=0);const w=(p-1+h)*l*4;let _=l;do{const x=g+(_-1)*4;let v=s;_+v<1&&(v=0),_+v>l&&(v=0);const S=w+(_-1+v)*4,y=a[x]-a[S],A=a[x+1]-a[S+1],L=a[x+2]-a[S+2];let R=y;const D=R>0?R:-R,k=A>0?A:-A,z=L>0?L:-L;if(k>D&&(R=A),z>D&&(R=L),R*=e,i){const T=a[x]+R,P=a[x+1]+R,E=a[x+2]+R;a[x]=T>255?255:T<0?0:T,a[x+1]=P>255?255:P<0?0:P,a[x+2]=E>255?255:E<0?0:E}else{let T=n-R;T<0?T=0:T>255&&(T=255),a[x]=a[x+1]=a[x+2]=T}}while(--_)}while(--p)};X1.Emboss=wT;Os.Factory.addGetterSetter($1.Node,"embossStrength",.5,(0,xw.getNumberValidator)(),Os.Factory.afterSetFilter);Os.Factory.addGetterSetter($1.Node,"embossWhiteLevel",.5,(0,xw.getNumberValidator)(),Os.Factory.afterSetFilter);Os.Factory.addGetterSetter($1.Node,"embossDirection","top-left",null,Os.Factory.afterSetFilter);Os.Factory.addGetterSetter($1.Node,"embossBlend",!1,null,Os.Factory.afterSetFilter);var Q1={};Object.defineProperty(Q1,"__esModule",{value:!0});Q1.Enhance=void 0;const l4=at,bT=Ht,_T=Xe;function Xp(t,e,n,r,i){let o=n-e,s=i-r,a;return o===0?r+s/2:s===0?r:(a=(t-e)/o,a=s*a+r,a)}const ST=function(t){let e=t.data,n=e.length,r=e[0],i=r,o,s=e[1],a=s,l,u=e[2],d=u,p,g;const h=this.enhance();if(h===0)return;for(g=0;gi&&(i=o),l=e[g+1],la&&(a=l),p=e[g+2],pd&&(d=p);i===r&&(i=255,r=0),a===s&&(a=255,s=0),d===u&&(d=255,u=0);let w,_,x,v,S,y,A,L,R;for(h>0?(_=i+h*(255-i),x=r-h*(r-0),S=a+h*(255-a),y=s-h*(s-0),L=d+h*(255-d),R=u-h*(u-0)):(w=(i+r)*.5,_=i+h*(i-w),x=r+h*(r-w),v=(a+s)*.5,S=a+h*(a-v),y=s+h*(s-v),A=(d+u)*.5,L=d+h*(d-A),R=u+h*(u-A)),g=0;gv?x:v;let S=s,y=o,A,L,R=360/y*Math.PI/180,D,k;for(L=0;Ly?S:y;let A=s,L=o,R,D,k=0,z,T;for(d=0;de&&(A=y,L=0,R=-1),i=0;i=0&&h=0&&w=0&&h=0&&w=255*4?255:0}return s}function RT(t,e,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),s=[];for(let a=0;a=0&&h=0&&w=n))for(o=_;o=r||(s=(n*o+i)*4,a+=A[s+0],l+=A[s+1],u+=A[s+2],d+=A[s+3],y+=1);for(a=a/y,l=l/y,u=u/y,d=d/y,i=h;i=n))for(o=_;o=r||(s=(n*o+i)*4,A[s+0]=a,A[s+1]=l,A[s+2]=u,A[s+3]=d)}};o0.Pixelate=WT;d4.Factory.addGetterSetter(VT.Node,"pixelSize",8,(0,qT.getNumberValidator)(),d4.Factory.afterSetFilter);var s0={};Object.defineProperty(s0,"__esModule",{value:!0});s0.Posterize=void 0;const f4=at,HT=Ht,YT=Xe,KT=function(t){let e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e,o;for(o=0;o255?255:t<0?0:Math.round(t)});Wf.Factory.addGetterSetter(Hg.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});Wf.Factory.addGetterSetter(Hg.Node,"blue",0,XT.RGBComponent,Wf.Factory.afterSetFilter);var l0={};Object.defineProperty(l0,"__esModule",{value:!0});l0.RGBA=void 0;const lh=at,c0=Ht,QT=Xe,JT=function(t){const e=t.data,n=e.length,r=this.red(),i=this.green(),o=this.blue(),s=this.alpha();for(let a=0;a255?255:t<0?0:Math.round(t)});lh.Factory.addGetterSetter(c0.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});lh.Factory.addGetterSetter(c0.Node,"blue",0,QT.RGBComponent,lh.Factory.afterSetFilter);lh.Factory.addGetterSetter(c0.Node,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});var u0={};Object.defineProperty(u0,"__esModule",{value:!0});u0.Sepia=void 0;const ZT=function(t){let e=t.data,n=e.length,r,i,o,s;for(r=0;r127&&(u=255-u),d>127&&(d=255-d),p>127&&(p=255-p),e[l]=u,e[l+1]=d,e[l+2]=p}while(--a)}while(--o)};h0.Solarize=eM;var d0={};Object.defineProperty(d0,"__esModule",{value:!0});d0.Threshold=void 0;const p4=at,tM=Ht,nM=Xe,rM=function(t){const e=this.threshold()*255,n=t.data,r=n.length;for(let i=0;idocument.body.style.cursor="pointer"),this.on("mouseout",()=>document.body.style.cursor="default"),this.on("click",o=>{o.evt.altKey&&(this.moveToTop(),this.getLayer().find("Transformer").forEach(s=>s.moveToTop()))}),i&&(this.on("dragend",this.snapToGrid.bind(this)),this.on("dblclick",this.snapToGrid.bind(this))),this.on("transform",()=>{const o=this.scaleX(),s=this.scaleY();this.strokeWidth(1/Math.max(o,s))}),this.on("dragmove",()=>{this.infoText&&this.updateTextPosition()})}loadInfo(e){console.log("Abstract function")}initText(){this.textOffsetX=0,this.textOffsetY=-30,this.infoText=new Kt.Text({x:this.x()+this.textOffsetX,y:this.y()+this.textOffsetY,text:this._info.name,fontSize:12,fontFamily:"Verdana",fill:"white"})}updateTextPosition(){this.infoText&&(this.infoText.x(this.x()+this.textOffsetX),this.infoText.y(this.y()+this.textOffsetY))}displayName(e){this.infoText&&(this.infoText.text(this._info.name),e.add(this.infoText))}destroy(){super.destroy(),this.infoText!==null&&(this.infoText.remove(),console.log("cleared text"))}setInfo(e){this.info=e}load(){console.log("Abstract function")}_sceneFunc(e){let n=this.width(),r=this.height();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}clearText(){this.infoText!==null&&(this.infoText.remove(),console.log("cleared text"))}updateText(e){this.infoText.text=e,console.log("Updated text to : "+e)}snapToGrid(){this.position({x:Math.round(this.x()/this.blockSize)*this.blockSize,y:Math.round(this.y()/this.blockSize)*this.blockSize})}saveShapeDetails(){console.log("This shape does not contain information")}get info(){return this._info}set info(e){this._info=e}get type(){return this._type}set type(e){this._type=e}}class oo extends xh{constructor(e,n,r,i){if(new.target===oo)throw new Error("Cannot instantiate abstract class NodeShape directly.");super(e,n,r,i),this.connectionLines=[],this.connLine=new Kt.Line({stroke:"rgba(245,37,37,0.85)",dash:[2,3],strokeWidth:2,lineCap:"round",lineJoin:"miter",opacity:.8}),this.connLine.cache(),this.on("dragmove",()=>{this.connectionLines.forEach(o=>{console.log("other",o.otherShape);let s=[this.x(),this.y(),o.otherShape.x(),o.otherShape.y()];o.line.points(s)})})}connect(e,n=!0){if(e.info.selectedPins.includes(this.info.name)||(console.log("vleze conn 2ds"),e.info.selectedPins.push(this.info.name)),!n)return;const r=this.connLine.clone({points:[this.x(),this.y(),e.x(),e.y()]});let i={line:r,otherShape:e};this.connectionLines.push(i);let o={line:r,otherShape:this};e.addLineReference(o),this.layer.add(i.line)}addLineReference(e){this.connectionLines.push(e)}removeLineWrapper(e){this.connectionLines=this.connectionLines.filter(n=>n.otherShape!==e)}removeConnection(e){this.info.selectedPins=this.info.selectedPins.filter(n=>n!==e.info.name)}removeConnectionLine(e){this.connectionLines.forEach(n=>{n.otherShape===e&&(n.line.remove(),e.removeLineWrapper(this),this.removeLineWrapper(e))})}destroy(){super.destroy(),this.connectionLines.forEach(e=>{e.line.remove(),e.otherShape.removeLineWrapper(this)})}}class Yg extends oo{constructor(e,n){e.fromLoad||(e.height*=2),super({x:e.position.x,y:e.position.y,width:e.width*e.scaleX,height:e.height*e.scaleY,fill:"rgb(126,238,167)",stroke:"#252627",strokeWidth:1,opacity:.9,name:"mapObj",draggable:!0,rotation:e.rotation,zIndex:1},e.layer,e.blockSize,e.snap),this.type="Entrance",this.eventName="openEntranceModalEvent",this.floorNum=e.floorNum,this.id=n,this._info={name:`Entrance${n} [${this.floorNum}F]`,connectedRoom:"",description:"",isMainEntrance:!1,selectedPin:"",selectedPins:[]},this.initText(),this.moveToTop()}loadInfo(e){this.info.name=e.obj_name,this.info.connectedRoom=e.connected_room,this.info.description=e.description,this.info.isMainEntrance=e.is_main_entrance,this.info.selectedPins=e.connected_pins,this.floorNum=e.floor_num}saveShapeDetails(){console.info("fnum entrance",this.attrs.floorNum),this.setAttr("connected_pins",this.info.selectedPins),this.setAttr("obj_name",this.info.name),this.setAttr("description",this.info.description),this.setAttr("is_main_entrance",this.info.isMainEntrance),this.setAttr("connected_room",this.info.connectedRoom),this.setAttr("floor_num",this.floorNum)}connect(e,n=!0){this.floorNum===e.floorNum&&super.connect(e)}setInfo(e){console.log("SA VIKNA SETINFO"),this.info=e,this.info.connectedRoom==null||this.info.connectedRoom===""?(this.strokeWidth(2),this.stroke("#a10114")):(this.strokeWidth(1),this.stroke("black"))}}Yg.prototype.className="Entrance";$e._registerNode(Yg);class Kg extends xh{constructor(e){e.fromLoad||(e.height*=8),super({x:e.position.x,y:e.position.y,width:e.width*e.scaleX,height:e.height*e.scaleY,fill:"#d3d3d3",stroke:"grey",strokeWidth:1,name:"mapObj",draggable:!0,rotation:e.rotation,zIndex:0},e.layer,e.blockSize,e.snap),this.type="Wall",this.floorNum=e.floorNum}loadInfo(e){this.floorNum=e.floor_num}saveShapeDetails(){this.setAttr("floor_num",this.floorNum)}}Kg.prototype.className="Wall";$e._registerNode(Kg);class Xg extends xh{constructor(e,n){e.fromLoad||(e.width*=12,e.height*=8),console.log(e.position,"hehe"),super({x:e.position.x,y:e.position.y,width:e.width*e.scaleX,height:e.height*e.scaleY,fill:"rgb(86,168,253)",stroke:"grey",strokeWidth:1,name:"mapObj",rotation:e.rotation,draggable:!0},e.layer,e.blockSize,e.snap),this.floorNum=e.floorNum,this._info={name:`Room${n} [${this.floorNum}F]`,type:"",description:""},this.type="Room",this.eventName="openRoomModalEvent",this.id=n,this.initText()}loadInfo(e){this.info.name=e.obj_name,this.info.type=e.room_type,this.info.description=e.description,this.floorNum=e.floor_num}saveShapeDetails(){this.setAttr("obj_name",this.info.name),this.setAttr("room_type",this.info.type),this.setAttr("description",this.info.description),this.setAttr("floor_num",this.floorNum)}}Xg.prototype.className="Room";$e._registerNode(Xg);class $g extends oo{constructor(e,n){e.snap=!1,super({x:e.position.x,y:e.position.y,radiusX:e.blockSize*.5,radiusY:e.blockSize*.7,tailHeight:e.blockSize*1.2,fill:"#f60000",stroke:"#1b1b1b",strokeWidth:1,draggable:!0,name:"mapObj"},e.layer,e.blockSize,e.snap),this.id=n,this.eventName="openPinModalEvent",this.floorNum=e.floorNum,this.type="InfoPin",this._info={name:`Pin${n} [${this.floorNum}F]`,selectedPins:[],description:""},this.on("mouseover",()=>{this.fill("#FFD700")}),this.on("mouseout",()=>{this.fill("#f60000")}),this.initText()}_sceneFunc(e,n){const{radiusX:r,radiusY:i,tailHeight:o}=this.attrs;e.beginPath(),e.ellipse(0,0,r,i,0,0,Math.PI*2),e.closePath(),e.fillStrokeShape(n),e.beginPath(),e.moveTo(-r,i),e.lineTo(0,i+o),e.lineTo(r,i),e.closePath(),e.fillStrokeShape(n)}loadInfo(e){this.info.name=e.obj_name,this.info.selectedPins=e.connected_pins,this.info.description=e.description,this.floorNum=e.floor_num}saveShapeDetails(){this.setAttr("obj_name",this.info.name),this.setAttr("connected_pins",this.info.selectedPins),this.setAttr("description",this.info.description),this.setAttr("floor_num",this.floorNum),console.log(this.info,"vnatre vo info")}connect(e,n=!0){this.floorNum===e.floorNum&&super.connect(e)}}$g.prototype.className="InfoPin";$e._registerNode($g);class Pc extends Kt.Shape{constructor(e){if(new.target===Pc)throw new Error("Cannot instantiate abstract class RenderedMapShape directly.");super(e),this.info={name:"",description:"",type:""},this.class="Rect",this.infoText=null,this.textOffsetX=0,this.textOffsetY=0,this.eventName=""}initText(){const e=this.width(),n=this.height();this.infoText=new Kt.Text({x:this.x(),y:this.y(),text:this.info.name||"no name",fontSize:10,fontFamily:"Exo",fill:"black",align:"center",verticalAlign:"middle"}),this.infoText.offsetX(this.infoText.width()/2),this.infoText.offsetY(this.infoText.height()/2),this.infoText.x(this.x()+e/2),this.infoText.y(this.y()+n/2),this.infoText.rotation(this.rotation())}updateTextPosition(){this.infoText&&(this.infoText.x(this.x()+this.textOffsetX),this.infoText.y(this.y()+this.textOffsetY))}clearText(){this.infoText!==null&&(this.infoText.remove(),console.log("cleared text"))}_sceneFunc(e){let n=this.width(),r=this.height();const i=this.attrs.cornerRadius;e.beginPath(),i?Kt.Util.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}displayName(e){this.infoText!=null&&e.add(this.infoText)}}class Qg extends Pc{constructor(e,n,r){super({x:e.x,y:e.y,width:e.width,height:e.height,fill:"#A2D9FF",stroke:"black",strokeWidth:1,draggable:!1,rotation:e.rotation,cornerRadius:3}),console.info("FNUM RENDER:",e.floor_num),this.floorNum=e.floor_num,this.info.name=e.obj_name,this.info.type=e.room_type,this.info.description=e.description,this.class="Room",this.textOffsetX=-50,this.eventName="openRoomInfoPanel",this.on("mouseenter",()=>{console.log(this.info.name,"NAME"),this.fill("#65c3f8")}),this.on("mouseleave",()=>{this.fill("#A2D9FF")}),this.initText()}highlight(){this.fill("rgba(29,238,78,0.49)"),this.strokeWidth(2)}unHighlight(){this.fill("#A2D9FF"),this.strokeWidth(1)}}Qg.prototype.className="RenderedRoom";$e._registerNode(Qg);class Jg extends Pc{constructor(e,n,r){super({x:e.x,y:e.y,width:e.width,height:e.height,fill:"#7fef83",stroke:"black",strokeWidth:1,draggable:!1,rotation:e.rotation,cornerRadius:3,zIndex:0}),this.info.name=e.obj_name,this.info.description=e.description,this.info.isMainEntrance=e.is_main_entrance,this.floorNum=e.floor_num,this.class="Entrance",console.log("ATTRS VIEW: "+e),this.on("mouseenter",()=>{this.stroke("purple")}),this.on("mouseleave",()=>{this.opacity(1),this.stroke("black")})}}Jg.prototype.className="RenderedEntrance";$e._registerNode(Jg);class Zg extends Pc{constructor(e,n,r){super({x:e.x,y:e.y,width:e.width,height:e.height,fill:"#4B4B4B",stroke:"black",strokeWidth:1,draggable:!1,rotation:e.rotation,cornerRadius:3})}}Zg.prototype.className="RenderedWall";$e._registerNode(Zg);class em extends oo{constructor(e,n){e.fromLoad||(e.width*=4),super({x:e.position.x,y:e.position.y,width:e.width*e.scaleX,height:e.height*e.scaleY,fill:"rgb(225,213,124)",stroke:"rgb(16,15,15)",strokeWidth:1,name:"mapObj",rotation:e.rotation,draggable:!0},e.layer,e.blockSize,e.snap),this.floorNum=e.floorNum,this.type="Stairs",this._info={name:`Stairs${n} [${this.floorNum}F]`,description:"",selectedPins:[]},this.id=n,this.eventName="openStairsModalEvent",this.initText()}_sceneFunc(e,n){const{width:r,height:i}=this.attrs;let o=5;e.beginPath();for(let s=0;s{Cw[t]++},Ud=t=>Cw[t];class ya{static createShape(e,n){console.log(n,"attrs in factory"),console.log("position in factory: "+n.position.x);let r=n.scaleX?parseFloat(n.scaleX):1,i=n.scaleY?parseFloat(n.scaleY):1;switch(n.scaleX=r,n.scaleY=i,e){case"Entrance":return n.increment&&Dd("entrance"),new Yg(n,Ud("entrance"));case"Room":return n.increment&&Dd("room"),new Xg(n,Ud("room"));case"Wall":return new Kg(n);case"InfoPin":return n.increment&&Dd("infoPin"),new $g(n,Ud("infoPin"));case"Stairs":return n.increment&&Dd("stairs"),new em(n,Ud("stairs"));default:throw new Error("Invalid shape type: "+e)}}static createRenderedShape(e,n){let r=n.scaleX?parseFloat(n.scaleX):1,i=n.scaleY?parseFloat(n.scaleY):1;switch(n.width*=r,n.height*=i,console.log("SCALEX "+r),console.log("SCALEY "+i),e){case"Entrance":return new Jg(n,r,i);case"Room":return new Qg(n,r,i);case"Wall":return new Zg(n,r,i);case"Stairs":return new tm(n,r,i);default:throw new Error("Invalid shape type."+e)}}}const Pw=(t,e,n=!1)=>{if(n&&!t.evt.shiftKey)return;t.evt.preventDefault();const r=t.evt.deltaY>0?.85:1.2,i=e.scaleX();let o=i*r;const s=e.getRelativePointerPosition();let a={x:(s.x-e.x())/i,y:(s.y-e.y())/i};e.scale({x:o,y:o});let l={x:s.x-a.x*o,y:s.y-a.y*o};e.position(l),e.batchDraw()},lf=(t,e,n)=>{t.on(n,()=>{const r=t.eventName;if(r){const i={room:t,map:e},o=new CustomEvent(r,{detail:i});window.dispatchEvent(o)}})};class dc{static findAllByType(...e){return on.getShapes().filter(n=>e.includes(n.className))}static findNodeByName(e,n){return e.filter(r=>r instanceof oo&&r.info.name===n)[0]}static findAllByTypeAndFloor(e,...n){return on.getShapes().filter(r=>n.includes(r.className)&&r.floorNum===e)}static getAllNodes(e=null){return on.getShapes(e).filter(n=>n instanceof oo)}}class Ru{constructor(){return Ru.instance||(this.store={floors:{}},Ru.instance=this),Ru.instance}getShapes(e=null){return this.store.floors[e]||(this.store.floors[e]=[]),e!=null?this.store.floors[e]:Object.values(this.store.floors).flat()}add(e){console.log("floor: "+e.floorNum),this.store.floors[e.floorNum]||(this.store.floors[e.floorNum]=[]),this.store.floors[e.floorNum].push(e)}delete(e){const n=this.store.floors[e.floorNum];if(n){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}}clear(e=null){if(e!=null){const n=this.store.floors[e];Array.isArray(n)&&(n.forEach(r=>r.destroy()),this.store.floors[e]=[])}else Object.keys(this.store.floors).forEach(n=>{const r=this.store.floors[n];Array.isArray(r)&&(r.forEach(i=>i.destroy()),this.store.floors[n]=[])})}updateConnections(){Object.values(this.store.floors).forEach(e=>{e.forEach(n=>{(n.className==="InfoPin"||n.className==="Entrance"||n.className==="Stairs")&&n.info.selectedPins.forEach(r=>{const i=e.find(o=>o.info.name===r);i&&(i.className==="InfoPin"||i.className==="Entrance"||i.className==="Stairs")&&(i.info.selectedPins.includes(n.info.name)||i.info.selectedPins.push(n.info.name))})})})}drawConnection(e,n){const r=Object.values(this.store.floors).flat().find(o=>o instanceof oo&&o.info.name===e),i=Object.values(this.store.floors).flat().find(o=>o instanceof oo&&o.info.name===n);console.log("NODE1: "+JSON.stringify(r)),console.log("NODE2: "+JSON.stringify(i)),r&&i?(r.connect(i),console.log("N1",r.info.selectedPins,"N2",i.info.selectedPins)):console.error("Cant find node1 or node 2.","Node1: "+r,"Node2: "+i)}removeConnection(e,n){let r=Object.values(this.store.floors).flat(),i=dc.findNodeByName(r,e),o=dc.findNodeByName(r,n);i.floorNum===o.floorNum&&i.removeConnectionLine(o),Object.values(this.store.floors).flat().filter(s=>s.info.name===e||s.info.name===n).forEach(s=>{s.info.name===e?s.info.selectedPins=s.info.selectedPins.filter(a=>a!==n):s.info.selectedPins=s.info.selectedPins.filter(a=>a!==e)}),console.log("Remove")}saveDetails(){Object.values(this.store.floors).flat().forEach(e=>{e.saveShapeDetails(),console.log(e.info)})}}const on=new Ru;Object.freeze(on);class nm{constructor(e,n,r){this.container=document.getElementById(e),this.stage=new Kt.Stage({container:e,width:this.container.clientWidth,height:this.container.clientHeight}),this._floorNum=n,this.mapName=r,this.gridLayer=new Kt.Layer,this.mainLayer=new Kt.Layer,this.dragLayer=new Kt.Layer,this.infoPinLayer=new Kt.Layer,this.prioLayer=new Kt.Layer,this.textLayer=new Kt.Layer,this.gridLayer.listening(!1),this.isDrawEventBound=!1,this.othStairs=[],this.blockSize=10,this.efficientDrawingMode=!1,this.roomTypes=[],this.gridLine=new Kt.Line({points:[],stroke:"grey",strokeWidth:1,opacity:.3}),this.gridLine.cache(),this.mainTransformer=new Kt.Transformer({centeredScaling:!1,rotationSnaps:[0,90,180,270],anchorSize:5,padding:2,anchorFill:"#f6031f",borderStroke:"black",anchorStroke:"black",cornerRadius:20,anchorCornerRadius:10,anchorDragBoundFunc:this.transformerSnapFunc()}),this.selectionRectangle=new Kt.Rect({fill:"rgba(56,194,245,0.5)",visible:!1,listening:!1,zIndex:100}),this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.selecting=!1,this.initialize()}initialize(){this.drawGrid(),this.mainLayer.add(this.mainTransformer),this.mainLayer.add(this.selectionRectangle),this.stage.add(this.gridLayer),this.stage.add(this.dragLayer),this.stage.add(this.mainLayer),this.stage.add(this.infoPinLayer),this.stage.add(this.textLayer),this.setupEventListeners()}setupEventListeners(){document.getElementById("shapeOptions").addEventListener("click",this.selectShape.bind(this)),window.addEventListener("resize",this.handleResize.bind(this)),this.boundEscapeEventListener=this.handleExitSelection.bind(this),this.boundDeleteEventListener=this.handleDelete.bind(this),this.boundRotateShapeEventListener=this.rotateShapesBy90Deg.bind(this),this.boundEfficientDrawingModeEventListener=this.toggleEfficientDrawingMode.bind(this),this.attachKeyPressEventListeners(),this.stage.on("mousedown touchstart",this.handleMouseDown.bind(this)),this.stage.on("mousemove touchmove",this.handleMouseMove.bind(this)),this.stage.on("mouseup touchend",this.handleMouseUp.bind(this)),this.stage.on("click tap",this.handleStageClick.bind(this)),this.stage.on("contextmenu",this.placeInfoPin.bind(this)),this.stage.on("dragmove",this.dragStage.bind(this)),this.stage.on("wheel",this.zoom.bind(this))}detachKeyPressEventListeners(){console.log("DETACH"),window.removeEventListener("keydown",this.boundEscapeEventListener),window.removeEventListener("keydown",this.boundDeleteEventListener),window.removeEventListener("keydown",this.boundRotateShapeEventListener),window.removeEventListener("keydown",this.boundEfficientDrawingModeEventListener)}attachKeyPressEventListeners(){console.log("ATTACH"),window.addEventListener("keydown",this.boundEscapeEventListener),window.addEventListener("keydown",this.boundDeleteEventListener),window.addEventListener("keydown",this.boundRotateShapeEventListener),window.addEventListener("keydown",this.boundEfficientDrawingModeEventListener)}dragStage(e){e.evt.shiftKey&&this.drawGrid()}transformerSnapFunc(){return(e,n)=>{if(this.mainTransformer.getActiveAnchor()==="rotater"||Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))>8)return n;const o=Math.round(n.x/this.blockSize)*this.blockSize,s=Math.abs(n.x-o),a=Math.round(n.y/this.blockSize)*this.blockSize,l=Math.abs(n.y-a),u=s<8,d=l<8;return u&&!d?{x:o,y:e.y}:!u&&d?{x:e.x,y:a}:u&&d?{x:o,y:a}:n}}handleResize(){this.stage.width(this.container.offsetWidth),this.stage.height(this.container.offsetHeight),this.drawGrid()}zoom(e){Pw(e,this.stage,!0),this.drawGrid()}get floorNum(){return this._floorNum}set floorNum(e){this._floorNum=e}drawGrid(){this.gridLayer.destroyChildren();let e=this.stage.width(),n=this.stage.height(),r=this.stage.getAbsoluteTransform().copy().invert(),i=r.point({x:0,y:0}),o=r.point({x:e,y:n}),s=Math.floor(i.x/this.blockSize)*this.blockSize,a=Math.floor(i.y/this.blockSize)*this.blockSize,l=Math.ceil(o.x/this.blockSize)*this.blockSize,u=Math.ceil(o.y/this.blockSize)*this.blockSize;for(let d=s;d<=l;d+=this.blockSize){let p=this.gridLine.clone({points:[d+.5,i.y-this.blockSize,d+.5,o.y+this.blockSize]});p.transformsEnabled("position"),p.perfectDrawEnabled(!1),p.shadowForStrokeEnabled(!1),this.gridLayer.add(p)}for(let d=a;d<=u;d+=this.blockSize){let p=this.gridLine.clone({points:[i.x-this.blockSize,d+.5,o.x+this.blockSize,d+.5]});p.perfectDrawEnabled(!1),p.shadowForStrokeEnabled(!1),p.transformsEnabled("position"),this.gridLayer.add(p)}this.mainLayer.moveToTop(),this.infoPinLayer.moveToTop(),this.gridLayer.batchDraw()}placeInfoPin(e){e.evt.preventDefault();const r={type:"InfoPin",position:this.stage.getRelativePointerPosition(),blockSize:this.blockSize,layer:this.mainLayer,rotation:0,scaleX:1,scaleY:1,increment:!0,floorNum:this.floorNum};let i=ya.createShape("InfoPin",r);lf(i,this,"dblclick"),on.add(i),this.mainLayer.add(i),i.displayName(this.textLayer),$l(),console.log(i.name())}toggleEfficientDrawingMode(e){(e.key==="e"||e.key==="E")&&(this.efficientDrawingMode=!this.efficientDrawingMode,console.log("EFFICIENT DRAWING MODE is: ",this.efficientDrawingMode),this.efficientDrawingMode||this.stopDrawing())}placeShape(){const n={position:this.stage.getRelativePointerPosition(),width:this.blockSize,height:this.blockSize,layer:this.mainLayer,rotation:this.hoverObj.rotation(),scaleX:1,scaleY:1,increment:!0,snap:!0,fromLoad:!1,blockSize:this.blockSize,floorNum:this.floorNum},r=ya.createShape(this.hoverObj.type,n);r&&(console.info("ATTRS FNUM",n.floorNum),this.mainLayer.add(r),on.add(r),lf(r,this,"dblclick"),this.mainLayer.draw(),r.displayName(this.textLayer),r.snapToGrid(),$l(),this.efficientDrawingMode||this.stopDrawing(),this.mainTransformer.nodes([]))}stopDrawing(){this.isDrawEventBound&&(this.mainTransformer.nodes([]),this.hoverObj!=null&&this.hoverObj.remove(),this.dragLayer.removeChildren(),this.stage.off("mousemove",this.boundMouseMoveHandler),this.stage.off("click",this.boundPlaceShapeHandler),this.isDrawEventBound=!1)}mouseMoveHandler(){const e=this.stage.getRelativePointerPosition();this.hoverObj.position({x:e.x,y:e.y}),this.hoverObj.visible(!0)}startDrawing(e){const n={position:{x:0,y:0},width:this.blockSize,height:this.blockSize,layer:this.mainLayer,rotation:0,scaleX:1,scaleY:1,increment:!1,snap:!0,fromLoad:!1,blockSize:this.blockSize};this.hoverObj=ya.createShape(e,n),console.log("HOVBER OBK:",this.hoverObj),this.hoverObj.visible(!1),this.dragLayer.add(this.hoverObj),this.dragLayer.moveToTop(),this.boundMouseMoveHandler=this.mouseMoveHandler.bind(this),this.boundPlaceShapeHandler=this.placeShape.bind(this),this.isDrawEventBound=!0,this.stage.on("mousemove",this.boundMouseMoveHandler),this.stage.on("click",this.boundPlaceShapeHandler)}selectShape(e){if(e.target.tagName==="LI"){this.stopDrawing();const n=e.target.getAttribute("data-info");this.startDrawing(n)}}rotateShapesBy90Deg(e){(e.key==="r"||e.key==="R")&&(this.hoverObj&&this.hoverObj.rotate(90),this.mainTransformer.nodes().forEach(n=>{n.rotate(90)}))}handleDelete(e){e.key==="Delete"&&(this.mainTransformer.nodes().forEach(n=>{n.remove(),n.destroy(),on.delete(n),$l()}),this.mainTransformer.nodes([]),this.mainLayer.batchDraw())}handleExitSelection(e){e.key==="Escape"&&(this.mainTransformer.nodes([]),this.stopDrawing())}handleMouseDown(e){this.stage.draggable(e.evt.shiftKey),e.target===this.stage&&(e.evt.preventDefault(),this.x1=this.stage.getRelativePointerPosition().x,this.y1=this.stage.getRelativePointerPosition().y,this.x2=this.stage.getRelativePointerPosition().x,this.y2=this.stage.getRelativePointerPosition().y,this.selectionRectangle.width(0),this.selectionRectangle.height(0),this.selecting=!0)}handleMouseMove(e){this.selecting&&(e.evt.preventDefault(),this.x2=this.stage.getRelativePointerPosition().x,this.y2=this.stage.getRelativePointerPosition().y,this.selectionRectangle.setAttrs({visible:!0,x:Math.min(this.x1,this.x2),y:Math.min(this.y1,this.y2),width:Math.abs(this.x2-this.x1),height:Math.abs(this.y2-this.y1)}))}handleMouseUp(e){if(this.selecting=!1,this.stage.draggable(!1),!this.selectionRectangle.visible())return;e.evt.preventDefault(),this.selectionRectangle.visible(!1);const n=this.stage.find(".mapObj"),r=this.selectionRectangle.getClientRect(),i=n.filter(o=>Kt.Util.haveIntersection(r,o.getClientRect()));this.mainTransformer.nodes(i),console.log(this.mainTransformer.nodes())}saveShapeDetails(){return on.saveDetails(),console.log("thisflornum",this.floorNum),{shapes:on.getShapes(this.floorNum),roomTypes:JSON.stringify(this.roomTypes),mapName:this.mapName,floorNum:this.floorNum}}handleStageClick(e){if(this.selectionRectangle.visible()){console.log("STAGECLICK1");return}if(e.target===this.stage){console.log("STAGECLICK2"),this.mainTransformer.nodes([]);return}if(!e.target.hasName("mapObj")){console.log("STAGECLICK3");return}const n=e.evt.shiftKey||e.evt.ctrlKey||e.evt.metaKey,r=this.mainTransformer.nodes().indexOf(e.target)>=0;if(!n&&!r)this.mainTransformer.nodes([e.target]),console.log("Sel 1");else if(n&&r){const i=this.mainTransformer.nodes().slice();i.splice(i.indexOf(e.target),1),this.mainTransformer.nodes(i)}else if(n&&!r){const i=this.mainTransformer.nodes().concat([e.target]);this.mainTransformer.nodes(i)}}addRoomType(e){this.roomTypes.push(e)}removeRoomType(e){this.roomTypes=this.roomTypes.filter(n=>n!==e)}getEntrances(){return this.getShapeInfoByType("Entrance")}getShapeInfoByType(e){return on.getShapes(this.floorNum).filter(n=>n.className===e).map(n=>n.info)}drawConnection(e,n){on.drawConnection(e,n)}getNodeByName(e){return on.getShapes(this.floorNum).filter(n=>n instanceof oo&&n.info.name===e)[0]}removeConnection(e,n){on.removeConnection(e,n)}updateRoomNames(){this.textLayer.removeChildren(),on.getShapes(this.floorNum).forEach(e=>{e.displayName(this.textLayer)})}clearMap(){this.mainLayer.removeChildren(),this.hoverObj=null}loadNewFloor(e){this._floorNum=e==null?void 0:e.num;let n=e==null?void 0:e.mapData;n==null||n===""||(this.deserializeMap(n),on.getShapes(this.floorNum).forEach(r=>{this.mainLayer.add(r)}))}deserializeMap(e){console.log("DESERIALIZING: ",e),on.clear(this.floorNum),e!=null&&(JSON.parse(e).forEach(i=>{const o={position:{x:i.attrs.x,y:i.attrs.y},width:i.attrs.width,height:i.attrs.height,layer:this.mainLayer,blockSize:this.blockSize,rotation:i.attrs.rotation,scaleX:i.attrs.scaleX,scaleY:i.attrs.scaleY,increment:!1,snap:!0,fromLoad:!0,floorNum:this.floorNum},s=ya.createShape(i.className,o);s.loadInfo(i.attrs),on.add(s),lf(s,this,"dblclick")}),on.getShapes(this.floorNum).filter(i=>i.className==="InfoPin"||i.className==="Entrance"||i.className==="Stairs").forEach(i=>{let o=i.info.selectedPins;o&&o.forEach(s=>{console.log("CONN node1: "+i+"conn node2: "+s),this.drawConnection(i.info.name,s)})})),this.mainTransformer.nodes([]),this.mainLayer.add(this.mainTransformer),this.mainLayer.add(this.selectionRectangle),on.getShapes(this.floorNum).forEach(n=>n.displayName(this.textLayer))}}function GM({shapeInfo:t,availableRooms:e,updateModalData:n}){return N.jsxs("div",{className:An.formGroup,children:[N.jsx("label",{htmlFor:"connectedRoom",children:"Select room associated with entrance:"}),N.jsxs("select",{id:"connectedRoom",name:"connectedRoom",value:t.connectedRoom,onChange:n,required:!0,children:[N.jsx("option",{value:"",children:"Select Room"}),e.map((r,i)=>N.jsx("option",{value:r.info.name,children:r.info.name},i))]})]})}function rm({connections:t,removePinFromList:e}){return re.useEffect(()=>{console.log("CONNNECTIONS: "+t)},[]),N.jsxs(N.Fragment,{children:[N.jsx("h3",{children:"Connections:"}),N.jsx("ul",{className:An.pinList,children:t.length>0?t.map((n,r)=>N.jsxs("li",{className:An.pinItem,children:[n,N.jsx("button",{onClick:()=>e(n),className:An.removeButton,children:"Remove"})]},r)):N.jsx("li",{children:"No connections added"})}),N.jsx("br",{})]})}function VM({shapeInfo:t,updateModalData:e}){return N.jsxs("div",{className:An.formGroupCheckbox,children:[N.jsx("input",{type:"checkbox",id:"isMainEntrance",name:"isMainEntrance",checked:t.isMainEntrance,onChange:e}),N.jsx("label",{htmlFor:"isMainEntrance",style:{color:"white"},children:"Main Entrance"})]})}function im(t,e,n){const[r,i]=re.useState([]);return{connectionState:{connections:r,setConnections:i},handlers:{addConnection:()=>{!e.selectedPin||r.includes(e.selectedPin)||i(a=>{const l=[...a,e.selectedPin];return n(u=>({...u,selectedPin:"",selectedPins:l})),console.log(e.name,e.selectedPin,"TEST"),t.drawConnection(e.name,e.selectedPin),l})},removeConnection:a=>{i(l=>{const u=l.filter(d=>d!==a);return n(d=>({...d,selectedPins:u})),u}),t.removeConnection(e.name,a)}}}}function f0({shapeInfo:t,updateModalData:e,addConnection:n,availableShapes:r}){return console.log("shapes modal",r),N.jsxs("div",{className:An.formGroup,children:[N.jsx("label",{htmlFor:"selectedPin",children:"Select connections:"}),N.jsxs("select",{id:"selectedPin",name:"selectedPin",value:t.selectedPin,onChange:e,children:[N.jsx("option",{value:"",children:"Select Connection"}),r.filter(i=>!i.info.selectedPins.includes(t.name)&&i.info.name!==""&&i.info.name!==t.name).map((i,o)=>N.jsx("option",{value:i.info.name,children:i.info.name},o))]}),N.jsx("button",{type:"button",onClick:n,className:An.addButton,children:"Add Connection"})]})}f0.propTypes={shapeInfo:Sa.object,updateModalData:Sa.func,addConnection:Sa.func};function Lw({map:t}){const{modalState:{isOpen:e,setIsOpen:n,shape:r,setShape:i,shapeInfo:o,setShapeInfo:s},handlers:{toggleModal:a,updateModalData:l,saveDetails:u}}=w1(t),{connectionState:{connections:d,setConnections:p},handlers:{addConnection:g,removeConnection:h}}=im(t,o,s);return b1(w=>{const _=w.detail.room;i(_),s({..._.info,selectedPin:""});const x=_.info.selectedPins||[];p(x),n(!0),w.detail.map.detachKeyPressEventListeners(),console.log(x,"Loaded pins on modal open")},"openEntranceModalEvent"),N.jsxs(y1,{isOpen:e,toggleModal:a,title:"Enter Entrance Details",children:[N.jsx(g1,{shapeInfo:o,updateModalData:l}),N.jsx(GM,{shapeInfo:o,availableRooms:dc.findAllByTypeAndFloor(r==null?void 0:r.floorNum,"Room"),updateModalData:l}),N.jsx(f0,{availableShapes:dc.findAllByType("InfoPin","Entrance"),addConnection:g,updateModalData:l,shapeInfo:o}),N.jsx(rm,{connections:d,removePinFromList:h}),N.jsx(m1,{shapeInfo:o,updateModalData:l}),N.jsx(VM,{shapeInfo:o,updateModalData:l}),N.jsx(v1,{saveDetails:u})]})}Lw.propTypes={map:Sa.instanceOf(nm)};const qM="_activeModal_xoq0w_3",WM="_modal_xoq0w_7",HM="_overlay_xoq0w_8",YM="_title_xoq0w_23",KM="_paragraph_xoq0w_27",XM="_modalContent_xoq0w_31",$M="_btnModal_xoq0w_51",QM="_iconImage_xoq0w_78",JM="_closeModal_xoq0w_83",ZM="_form_xoq0w_99",ej="_formGroup_xoq0w_104",tj="_submitButton_xoq0w_135",ls={activeModal:qM,modal:WM,overlay:HM,title:YM,paragraph:KM,modalContent:XM,btnModal:$M,iconImage:QM,closeModal:JM,form:ZM,formGroup:ej,submitButton:tj};function nj(){const[t,e]=re.useState(!1),n=()=>{e(!t)};return N.jsxs(N.Fragment,{children:[N.jsx("button",{onClick:n,className:ls.btnModal}),t&&N.jsxs("div",{className:ls.modal,children:[N.jsx("div",{onClick:n,className:ls.overlay}),N.jsxs("div",{className:ls.modalContent,children:[N.jsx("h2",{className:ls.title,children:"How to Use the Map Builder"}),N.jsx("p",{className:ls.paragraph,children:"Welcome to the Map Builder! Here you can create an indoor map, render it and enjoy!:"}),N.jsx("br",{}),N.jsxs("ul",{children:[N.jsx("h3",{children:"Shapes and Placement"}),N.jsx("li",{children:"There are 4 types of shapes : Walls, Rooms, Entrances and Pins. "}),N.jsx("li",{children:"By clicking on a shape's respective icon, that shape will follow your mouse untill you place it by clicking anywhere on the canvas"}),N.jsx("li",{children:"Placed shapes automatically get snapped in place, with respect to the grid"}),N.jsx("li",{children:"You can place a pin on the canvas by right clicking and then left clicking - imat bug tuka nekogas direktno se postavuvaat"}),N.jsx("br",{}),N.jsx("h3",{children:"Adding information"}),N.jsx("li",{children:"By double clicking on any shape (except a Wall), you can add information to the shape"}),N.jsx("li",{children:"Every shape holds basic information like a name, and more advanced information for navigation aswell"}),N.jsx("br",{}),N.jsx("li",{children:"To explore map building in detail you can check our own wiki page. TODO"})]}),N.jsx("br",{}),N.jsx("p",{className:ls.paragraph,children:"After completing your map, click the render button and go to the View page to see your full featured map!"}),N.jsx("button",{className:ls.closeModal,onClick:n,children:"CLOSE"})]})]})]})}const rj="_activeModal_hib35_2",ij="_modal_hib35_7",oj="_overlay_hib35_8",sj="_modalContent_hib35_24",aj="_btnModal_hib35_47",lj="_closeModal_hib35_64",cj="_form_hib35_81",uj="_formGroup_hib35_87",hj="_addButton_hib35_122",dj="_roomTypeList_hib35_137",fj="_roomTypeItem_hib35_144",pj="_removeButton_hib35_156",Si={activeModal:rj,modal:ij,overlay:oj,modalContent:sj,btnModal:aj,closeModal:lj,form:cj,formGroup:uj,addButton:hj,roomTypeList:dj,roomTypeItem:fj,removeButton:pj};function gj({map:t,roomTypes:e,addRoomTypeDB:n}){const[r,i]=re.useState(!1),[o,s]=re.useState(""),a=()=>{i(!r)},l=async()=>{await n(o),s("")},u=d=>{const{name:p,value:g}=d.target;s(g)};return N.jsxs(N.Fragment,{children:[N.jsx("button",{onClick:a,className:Si.btnModal,children:"Room Types"}),r&&N.jsxs("div",{className:Si.modal,children:[N.jsx("div",{onClick:a,className:Si.overlay}),N.jsxs("div",{className:Si.modalContent,children:[N.jsx("h2",{style:{color:"white"},children:"Manage Room Types"}),N.jsx("form",{className:Si.form,children:N.jsxs("div",{className:Si.formGroup,children:[N.jsx("label",{htmlFor:"roomTypeName",children:"Add New Room Type:"}),N.jsx("input",{type:"text",id:"roomTypeName",name:"roomTypeName",value:o,onChange:u,placeholder:"Enter a new room type (e.g., Office, Classroom)"}),N.jsx("button",{type:"button",className:Si.addButton,onClick:l,children:"Add Type"})]})}),N.jsx("h3",{children:"Available Room Types:"}),N.jsx("ul",{className:Si.roomTypeList,children:e.length>0?e.map((d,p)=>N.jsxs("li",{className:Si.roomTypeItem,children:[d.name,N.jsx("button",{className:Si.removeButton,children:"Remove"})]},p)):N.jsx("li",{children:"No room types available"})}),N.jsx("button",{className:Si.closeModal,onClick:a,children:"CLOSE"})]})]})]})}function kw({map:t}){const{modalState:{isOpen:e,shapeInfo:n,shape:r,setIsOpen:i,setShape:o,setShapeInfo:s},handlers:{toggleModal:a,updateModalData:l,saveDetails:u}}=w1(t),{connectionState:{connections:d,setConnections:p},handlers:{addConnection:g,removeConnection:h}}=im(t,n,s);return b1(w=>{const _=w.detail.room;o(_),s({..._.info,selectedPin:""}),p(_.info.selectedPins||[]),i(!0),w.detail.map.detachKeyPressEventListeners(),console.log(_.info.selectedPins,"Loaded pins on modal open")},"openPinModalEvent"),N.jsxs(y1,{isOpen:e,toggleModal:a,title:"Enter Pin Details",children:[N.jsx(g1,{shapeInfo:n,updateModalData:l}),N.jsx(f0,{shapeInfo:n,availableShapes:dc.findAllByTypeAndFloor(t==null?void 0:t.floorNum,"Stairs","InfoPin","Entrance"),updateModalData:l,addConnection:g}),N.jsx(rm,{connections:d,removePinFromList:h}),N.jsx(m1,{shapeInfo:n,updateModalData:l}),N.jsx(v1,{saveDetails:u})]})}kw.propTypes={map:Sa.instanceOf(nm)};const mj="_saveMapContainer_1k6lk_1",vj="_saveMapForm_1k6lk_8",yj="_saveMapInput_1k6lk_15",wj="_saveMapButton_1k6lk_22",$p={saveMapContainer:mj,saveMapForm:vj,saveMapInput:yj,saveMapButton:wj},bj=({submitHandler:t})=>{re.useState("");const e=n=>{n.preventDefault(),$l()};return N.jsx(N.Fragment,{children:N.jsx("div",{className:$p.saveMapContainer,children:N.jsx("form",{onSubmit:e,className:$p.saveMapForm,children:N.jsx("div",{children:N.jsx("button",{type:"submit",className:$p.saveMapButton,children:"Save Map"})})})})})};function _j({map:t}){const{modalState:{isOpen:e,setIsOpen:n,setShape:r,shapeInfo:i,setShapeInfo:o},handlers:{toggleModal:s,updateModalData:a,saveDetails:l}}=w1(t),{connectionState:{connections:u,setConnections:d},handlers:{addConnection:p,removeConnection:g}}=im(t,i,o);return b1(h=>{const w=h.detail.room;r(w),o(w.info),console.log("stairs connections shape info: "+w.info.selectedPins),d(w.info.selectedPins||[]),n(!0),console.log(w.info.selectedPins,"Loaded pins on modal open"),h.detail.map.detachKeyPressEventListeners()},"openStairsModalEvent"),N.jsxs(y1,{isOpen:e,toggleModal:s,title:"Enter Stair Details",children:[N.jsx(g1,{shapeInfo:i,updateModalData:a,phtext:"Enter name of stairs"}),N.jsx(f0,{shapeInfo:i,updateModalData:a,addConnection:p,availableShapes:dc.findAllByType("Stairs")}),N.jsx(rm,{connections:u,removePinFromList:g}),N.jsx(m1,{shapeInfo:i,updateModalData:a}),N.jsx(v1,{saveDetails:l})]})}function Ew(t,e,n){if(t==null||t==="")return[];const r=JSON.parse(t);console.log("VLEZE use");let i=[];return r.filter(e).forEach(o=>{console.log(o.attrs,"Sattrs pls"),o.attrs.position={x:o.attrs.x,y:o.attrs.y};const s=n?ya.createRenderedShape(o.className,o.attrs):ya.createShape(o.className,o.attrs);n||(s.loadInfo(o.attrs),on.add(s)),i.push(s)}),i}const Sj=(t,e,n,r)=>{const[i,o]=re.useState([]),[s,a]=re.useState(!1),[l,u]=re.useState(null);re.useEffect(()=>{n.has("floor")||r({floor:"0"},{replace:!0})},[r,n]),re.useEffect(()=>{s||(async()=>{const g=new It;try{const h=await g.get(`${bt.my_maps.load}?mapName=${t}&username=${e}`);console.log("Floors loaded:",h),o(h),a(!0),h.forEach(w=>{Ew(w.mapData,()=>!0,!1)})}catch(h){console.error("Can't load map:",h.message)}})()},[t,e]),re.useEffect(()=>{if(!s||i===void 0||i.length===0)return;const p=parseInt(n.get("floor")),g=i.find(w=>w.num===p);if(!g){console.error(`Floor ${p} not found`);return}console.log("Changing to floor:",g);const h=new nm("container",p,t);h.loadNewFloor(g),u(h),console.log("Fchange"),$l()},[n,s]);const d=async()=>{const p=l.saveShapeDetails(),g=new It(!0);try{const h=await g.put(`${bt.my_maps.save}?username=${e}`,p);console.log("FLOORS",i.length),o(w=>w.map(_=>_.num===h.num?h:_)),console.log(h,"resp in builder")}catch(h){console.log("ERROR --> Could not Save map --->",h)}};return re.useEffect(()=>{if(l){const p=()=>{console.log("mapsave event triggered"),d()};return window.addEventListener("mapsave",p),()=>{window.removeEventListener("mapsave",p)}}},[l]),re.useEffect(()=>()=>{l&&(l.clearMap(),l.stage.destroy())},[l]),{app:l,floors:i,saveFloor:d,setFloors:o}},_5="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAAAoJJREFUeF7tm2tOwlAQRmENJur+V2eIrgHTkChW2nncmX7eePjbeZRzOhdKL+cTLymBs7Q7zU8IEF8ECECAmIC4PROAADEBcXsmAAFiAuL2TAACxATE7ZkABIgJiNszAQgQExC3ZwIQICYgbs8EIEBMQNyeCUBAjMDb5eO6l/H6/DTVRTXVyS7gERC7YMujEVCONFZwW8CyMp1PLEExnuFoJiCMrDYBAbU8w9UQEEZWm4CAWp7haggII6tN2BOw3NS8cCNWC3xdjQno5WtWXwtYrvr73ya4DzARjgUwAWP8hrMRMIxwrAACxvgNZyNgGOFYAQSM8RvOfru8X5dfPbdefAsaRrxfgAloBmyV/yng9gzg/sUEWAQHjy8C1jdfCBiEGklnCYrQaojlx7gGqJGSTIBBywL0KH1vTY/IOSK2+kO+fF+QtWvhCEhLjy6pEws4Cn1vnykEdF19vWi/qz8+/559RwcuQUfh6+0zxQT8QtA9Ep76nhiHuzkFON6YK6QIoqvXRtD/FpAkV+ntzwtIMnKnPfyae0e4GpD7xJKB5R/CyfNwp1k3eghwo8wFsi0lx60siwkoQ5krhIAct7IsHsiUocwVYgJy3MqyEFCGMlcIATluZVkIKEOZK8TGrBy3sqy1AP4fUIbWV4glyMepLQoBbWh9hRHg49QWxd7QNrS+wkyAj1Nb1JeAjcdcPA9oQ38rzH1AM2CrPEuQRaj5OAKaAVvlEWARaj7OA5lmwFZ5JsAixPEQgen2BYXe3QTBCBBLQgACxATE7ZkABIgJiNszAQgQExC3ZwIQICYgbs8EIEBMQNyeCUCAmIC4PROAADEBcXsmAAFiAuL2TIBYwCdmLPZhW7llLQAAAABJRU5ErkJggg==",xj=({floorConfig:t})=>{const{floors:e,searchParams:n,addFloorHandler:r,setSearchParams:i,deleteFloorHandler:o}=t;return N.jsx("div",{className:wt.floorSection,children:N.jsxs("div",{className:wt.floorList,children:[N.jsx("label",{className:wt.floorLabel,children:"Available Floors:"}),N.jsxs("div",{className:wt.floorItems,children:[N.jsx("button",{className:wt.addFloorButton,onClick:()=>{const s=Math.max(...e.map(a=>a.num))+1;r(s)},children:N.jsx("img",{src:_5,alt:"Add Positive Floor",className:wt.icon})}),e.sort((s,a)=>a.num-s.num).map(s=>N.jsxs("div",{className:wt.floorItemWrapper,children:[N.jsxs("button",{onClick:()=>i({floor:s.num},{replace:!0}),className:`${wt.floorItem} ${n.get("floor")==s.num?wt.activeFloor:""}`,children:["Floor ",s.num]}),N.jsx("button",{className:wt.deleteFloorButton,onClick:()=>o(s.num),children:"🗑️"})]},s.num)),N.jsx("button",{className:wt.addFloorButton,onClick:()=>{const s=Math.min(...e.map(a=>a.num))-1;r(s)},children:N.jsx("img",{src:_5,alt:"Add Negative Floor",className:wt.icon})})]})]})})},Aj=(t,e,n)=>(re.useEffect(()=>{(async()=>{const o=new It;o.setAuthenticated();const s=await o.get(`${bt.room_types.display(!0)}?mapName=${e}&username=${n}`);console.log("loaded ROOM TYPES: "+s),t(s)})().then(o=>{console.log("LOADED ROOM TYPES")})},[]),{addRoomType:async i=>{const o=new It;o.setAuthenticated(),await o.post(`${bt.room_types.add}?roomTypeName=${i}&username=${n}&mapName=${e}`),t(s=>[...s,{name:i}])}});function Nj(){const{mapName:t}=o8(),{username:e}=mr(),[n,r]=re.useState(!1),[i,o]=re.useState("Error"),[s,a]=re.useState(!1),[l,u]=c8(),[d,p]=re.useState([]),{app:g,floors:h,saveFloor:w,setFloors:_}=Sj(t,e,l,u),{addRoomType:x}=Aj(p,t,e),v=async A=>{const L=new It;L.setAuthenticated();const R={num:A,mapName:t};try{await L.put(`${bt.floors.add}`,R),console.log(`Added floor ${A}`),_(D=>[...D,{num:A}])}catch(D){console.error("Error adding floor:",D)}},S=async A=>{if(A===0)return;const L=new It;L.setAuthenticated();try{await L.delete(`${bt.floors.delete}?floorNum=${A}&mapName=${t}`),_(D=>D.filter(k=>k.num!==A)),l.get("floor")==A&&u({floor:"0"},{replace:!0}),console.log(`Deleted floor ${A}`)}catch(R){console.error("Error deleting floor:",R)}};re.useEffect(()=>()=>{on.clear()},[]);const y=async()=>{w(),r(!0),setTimeout(()=>{r(!1)},3e3)};return N.jsxs("div",{className:wt.wrapper,id:"wrapper",children:[N.jsx(Vs,{}),N.jsx("div",{id:"container",className:wt.cont}),N.jsxs("div",{className:wt.panel,children:[N.jsx("div",{className:wt.topPanelH,children:N.jsx(wc,{position:"inline"})}),N.jsx(Ro,{to:`/myMaps/View/${t}`,className:wt.titleLink,children:N.jsx("h1",{className:wt.title,children:t})}),N.jsx("div",{className:wt.guideWrapper,children:N.jsx(nj,{})}),N.jsx("hr",{}),N.jsx("br",{}),N.jsxs("ul",{className:wt.shapeOptions,id:"shapeOptions",children:[N.jsx("li",{"data-info":"Entrance",className:`${wt.shapeOption} ${wt.entrance}`}),N.jsx("li",{"data-info":"Wall",className:`${wt.shapeOption} ${wt.wall}`,id:"wall"}),N.jsx("li",{"data-info":"Room",className:`${wt.shapeOption} ${wt.room}`,id:"room"}),N.jsx("li",{"data-info":"Stairs",className:`${wt.shapeOption} ${wt.stairs}`,id:"stairs"})]}),N.jsx(gj,{map:g,roomTypes:d,addRoomTypeDB:x}),N.jsx("br",{}),N.jsx("hr",{}),N.jsx("br",{}),N.jsx(xj,{floorConfig:{floors:h,searchParams:l,setSearchParams:u,addFloorHandler:v,deleteFloorHandler:S}}),N.jsx("br",{}),N.jsx("hr",{}),N.jsx("br",{}),s&&N.jsx("p",{style:{color:"red",textAlign:"center"},children:i}),N.jsx("div",{className:wt.templateCont,children:N.jsx(bj,{submitHandler:y})}),N.jsxs("div",{className:wt.hide,children:[N.jsx(BL,{map:g,roomTypes:d}),N.jsx(Lw,{map:g}),N.jsx(kw,{map:g}),N.jsx(_j,{map:g})]})]}),n&&N.jsx("div",{className:wt.popup,children:N.jsxs("div",{className:wt.popupContent,children:[N.jsx("h2",{children:"Map Saved!"}),N.jsx("p",{children:"Your map has been successfully saved."})]})})]})}function Cj(){return N.jsx("h1",{children:"Oops! Page not found !"})}const Pj=()=>N.jsx("div",{className:"loading-container",children:N.jsx("div",{className:"spinner"})}),Lj=()=>{const t=Do(),{loading:e,isAuthenticated:n}=mr();return e?N.jsx(Pj,{}):n?N.jsx(oS,{}):N.jsx(iS,{to:"/Login",state:{targetPath:t},replace:!0})},kj=(t,e,n,r)=>{const i=new CustomEvent("navigate",{detail:{nodes:t,offset:e,changeFloorTo:n,shape:r}});window.dispatchEvent(i)},Ej=(t,e)=>{let n=new CustomEvent(t,{detail:e});window.dispatchEvent(n)},Tj="modulepreload",Mj=function(t){return"/"+t},v4={},S5=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=Mj(l),l in v4)return;v4[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":Tj,u||(p.as="script"),p.crossOrigin="",p.href=l,a&&p.setAttribute("nonce",a),document.head.appendChild(p),u)return new Promise((g,h)=>{p.addEventListener("load",g),p.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return i.then(s=>{for(const a of s||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})};function Pt(t){"@babel/helpers - typeof";return Pt=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},Pt(t)}var or=Uint8Array,Ur=Uint16Array,om=Int32Array,p0=new or([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),g0=new or([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),x5=new or([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tw=function(t,e){for(var n=new Ur(31),r=0;r<31;++r)n[r]=e+=1<>1|(Gt&21845)<<1;cs=(cs&52428)>>2|(cs&13107)<<2,cs=(cs&61680)>>4|(cs&3855)<<4,N5[Gt]=((cs&65280)>>8|(cs&255)<<8)>>1}var io=function(t,e,n){for(var r=t.length,i=0,o=new Ur(e);i>l]=u}else for(a=new Ur(r),i=0;i>15-t[i]);return a},Rs=new or(288);for(var Gt=0;Gt<144;++Gt)Rs[Gt]=8;for(var Gt=144;Gt<256;++Gt)Rs[Gt]=9;for(var Gt=256;Gt<280;++Gt)Rs[Gt]=7;for(var Gt=280;Gt<288;++Gt)Rs[Gt]=8;var ch=new or(32);for(var Gt=0;Gt<32;++Gt)ch[Gt]=5;var Fj=io(Rs,9,0),Ij=io(Rs,9,1),Oj=io(ch,5,0),Rj=io(ch,5,1),Qp=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},xi=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(e&7)&n},Jp=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},sm=function(t){return(t+7)/8|0},Iw=function(t,e,n){return(n==null||n>t.length)&&(n=t.length),new or(t.subarray(e,n))},Bj=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Li=function(t,e,n){var r=new Error(e||Bj[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,Li),!n)throw r;return r},Dj=function(t,e,n,r){var i=t.length,o=0;if(!i||e.f&&!e.l)return n||new or(0);var s=!n,a=s||e.i!=2,l=e.i;s&&(n=new or(i*3));var u=function(we){var Ce=n.length;if(we>Ce){var ke=new or(Math.max(Ce*2,we));ke.set(n),n=ke}},d=e.f||0,p=e.p||0,g=e.b||0,h=e.l,w=e.d,_=e.m,x=e.n,v=i*8;do{if(!h){d=xi(t,p,1);var S=xi(t,p+1,3);if(p+=3,S)if(S==1)h=Ij,w=Rj,_=9,x=5;else if(S==2){var R=xi(t,p,31)+257,D=xi(t,p+10,15)+4,k=R+xi(t,p+5,31)+1;p+=14;for(var z=new or(k),T=new or(19),P=0;P>4;if(y<16)z[P++]=y;else{var ee=0,se=0;for(y==16?(se=3+xi(t,p,3),p+=2,ee=z[P-1]):y==17?(se=3+xi(t,p,7),p+=3):y==18&&(se=11+xi(t,p,127),p+=7);se--;)z[P++]=ee}}var K=z.subarray(0,R),te=z.subarray(R);_=Qp(K),x=Qp(te),h=io(K,_,1),w=io(te,x,1)}else Li(1);else{var y=sm(p)+4,A=t[y-4]|t[y-3]<<8,L=y+A;if(L>i){l&&Li(0);break}a&&u(g+A),n.set(t.subarray(y,L),g),e.b=g+=A,e.p=p=L*8,e.f=d;continue}if(p>v){l&&Li(0);break}}a&&u(g+131072);for(var X=(1<<_)-1,de=(1<>4;if(p+=ee&15,p>v){l&&Li(0);break}if(ee||Li(2),G<256)n[g++]=G;else if(G==256){M=p,h=null;break}else{var H=G-254;if(G>264){var P=G-257,ne=p0[P];H=xi(t,p,(1<>4;ie||Li(3),p+=ie&15;var te=jj[V];if(V>3){var ne=g0[V];te+=Jp(t,p)&(1<v){l&&Li(0);break}a&&u(g+131072);var Z=g+H;if(g>8},wu=function(t,e,n){n<<=e&7;var r=e/8|0;t[r]|=n,t[r+1]|=n>>8,t[r+2]|=n>>16},Zp=function(t,e){for(var n=[],r=0;rg&&(g=o[r].s);var h=new Ur(g+1),w=C5(n[d-1],h,0);if(w>e){var r=0,_=0,x=w-e,v=1<e)_+=v-(1<>=x;_>0;){var y=o[r].s;h[y]=0&&_;--r){var A=o[r].s;h[A]==e&&(--h[A],++_)}w=e}return{t:new or(h),l:w}},C5=function(t,e,n){return t.s==-1?Math.max(C5(t.l,e,n+1),C5(t.r,e,n+1)):e[t.s]=n},w4=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Ur(++e),r=0,i=t[0],o=1,s=function(l){n[r++]=l},a=1;a<=e;++a)if(t[a]==i&&a!=e)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=t[a]}return{c:n.subarray(0,r),n:e}},bu=function(t,e){for(var n=0,r=0;r>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var o=0;o4&&!T[x5[E-1]];--E);var W=u+5<<3,B=bu(i,Rs)+bu(o,ch)+s,Q=bu(i,g)+bu(o,_)+s+14+3*E+bu(D,T)+2*D[16]+3*D[17]+7*D[18];if(l>=0&&W<=B&&W<=Q)return Ow(e,d,t.subarray(l,l+u));var ee,se,K,te;if(Ao(e,d,1+(Q15&&(Ao(e,d,G[k]>>5&127),d+=G[k]>>12)}}else ee=Fj,se=Rs,K=Oj,te=ch;for(var k=0;k255){var H=ne>>18&31;wu(e,d,ee[H+257]),d+=se[H+257],H>7&&(Ao(e,d,ne>>23&31),d+=p0[H]);var ie=ne&31;wu(e,d,K[ie]),d+=te[ie],ie>3&&(wu(e,d,ne>>5&8191),d+=g0[ie])}else wu(e,d,ee[ne]),d+=se[ne]}return wu(e,d,ee[256]),d+se[256]},Uj=new om([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Rw=new or(0),zj=function(t,e,n,r,i,o){var s=o.z||t.length,a=new or(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),u=o.l,d=(o.r||0)&7;if(e){d&&(l[0]=o.r>>3);for(var p=Uj[e-1],g=p>>13,h=p&8191,w=(1<7e3||T>24576)&&(ee>423||!u)){d=b4(t,l,0,A,L,R,k,T,E,z-E,d),T=D=k=0,E=z;for(var se=0;se<286;++se)L[se]=0;for(var se=0;se<30;++se)R[se]=0}var K=2,te=0,X=h,de=B-Q&32767;if(ee>2&&W==y(z-de))for(var M=Math.min(g,ee)-1,G=Math.min(32767,z),H=Math.min(258,ee);de<=G&&--X&&B!=Q;){if(t[z+K]==t[z+K-de]){for(var ne=0;neK){if(K=ne,te=de,ne>M)break;for(var ie=Math.min(de,ne-2),V=0,se=0;seV&&(V=xe,Q=Z)}}}B=Q,Q=_[B],de+=B-Q&32767}if(te){A[T++]=268435456|A5[K]<<18|y4[te];var we=A5[K]&31,Ce=y4[te]&31;k+=p0[we]+g0[Ce],++L[257+we],++R[Ce],P=z+K,++D}else A[T++]=t[z],++L[t[z]]}}for(z=Math.max(z,P);z=s&&(l[d/8|0]=u,ke=s),d=Ow(l,d+1,t.subarray(z,ke))}o.i=s}return Iw(a,0,r+sm(d)+i)},Bw=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,o=n.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s>16),i=(i&65535)+15*(i>>16)}t=r,e=i},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},Gj=function(t,e,n,r,i){if(!i&&(i={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),s=new or(o.length+t.length);s.set(o),s.set(t,o.length),t=s,i.w=o.length}return zj(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,n,r,i)},Dw=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},Vj=function(t,e){var n=e.level,r=n==0?0:n<6?1:n==9?3:2;if(t[0]=120,t[1]=r<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var i=Bw();i.p(e.dictionary),Dw(t,2,i.d())}},qj=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&Li(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&Li(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function P5(t,e){e||(e={});var n=Bw();n.p(t);var r=Gj(t,e,e.dictionary?6:2,4);return Vj(r,e),Dw(r,r.length-4,n.d()),r}function Wj(t,e){return Dj(t.subarray(qj(t,e),-4),{i:2},e,e)}var Hj=typeof TextDecoder<"u"&&new TextDecoder,Yj=0;try{Hj.decode(Rw,{stream:!0}),Yj=1}catch{}var Ke=function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this}();function e2(){Ke.console&&typeof Ke.console.log=="function"&&Ke.console.log.apply(Ke.console,arguments)}var Ft={log:e2,warn:function(t){Ke.console&&(typeof Ke.console.warn=="function"?Ke.console.warn.apply(Ke.console,arguments):e2.call(null,arguments))},error:function(t){Ke.console&&(typeof Ke.console.error=="function"?Ke.console.error.apply(Ke.console,arguments):e2(t))}};function t2(t,e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="blob",r.onload=function(){fa(r.response,e,n)},r.onerror=function(){Ft.error("could not download file")},r.send()}function _4(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch{}return e.status>=200&&e.status<=299}function zd(t){try{t.dispatchEvent(new MouseEvent("click"))}catch{var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var Bu,L5,fa=Ke.saveAs||((typeof window>"u"?"undefined":Pt(window))!=="object"||window!==Ke?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(t,e,n){var r=Ke.URL||Ke.webkitURL,i=document.createElement("a");e=e||t.name||"download",i.download=e,i.rel="noopener",typeof t=="string"?(i.href=t,i.origin!==location.origin?_4(i.href)?t2(t,e,n):zd(i,i.target="_blank"):zd(i)):(i.href=r.createObjectURL(t),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){zd(i)},0))}:"msSaveOrOpenBlob"in navigator?function(t,e,n){if(e=e||t.name||"download",typeof t=="string")if(_4(t))t2(t,e,n);else{var r=document.createElement("a");r.href=t,r.target="_blank",setTimeout(function(){zd(r)})}else navigator.msSaveOrOpenBlob(function(i,o){return o===void 0?o={autoBom:!1}:Pt(o)!=="object"&&(Ft.warn("Deprecated: Expected third argument to be a object"),o={autoBom:!o}),o.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}(t,n),e)}:function(t,e,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),typeof t=="string")return t2(t,e,n);var i=t.type==="application/octet-stream",o=/constructor/i.test(Ke.HTMLElement)||Ke.safari,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||i&&o)&&(typeof FileReader>"u"?"undefined":Pt(FileReader))==="object"){var a=new FileReader;a.onloadend=function(){var d=a.result;d=s?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=d:location=d,r=null},a.readAsDataURL(t)}else{var l=Ke.URL||Ke.webkitURL,u=l.createObjectURL(t);r?r.location=u:location.href=u,r=null,setTimeout(function(){l.revokeObjectURL(u)},4e4)}});/** * A class to parse color values * @author Stoyan Stefanov * {@link http://www.phpied.com/rgb-color-parser-in-javascript/} * @license Use it if you like it */function Uw(t){var e;t=t||"",this.ok=!1,t.charAt(0)=="#"&&(t=t.substr(1,6)),t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[t=(t=t.replace(/ /g,"")).toLowerCase()]||t;for(var n=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],r=0;r255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var a=this.r.toString(16),l=this.g.toString(16),u=this.b.toString(16);return a.length==1&&(a="0"+a),l.length==1&&(l="0"+l),u.length==1&&(u="0"+u),"#"+a+l+u}}/** * @license * Joseph Myers does not specify a particular license for his work. * * Author: Joseph Myers * Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js * * Modified by: Owen Leong */function n2(t,e){var n=t[0],r=t[1],i=t[2],o=t[3];n=Jn(n,r,i,o,e[0],7,-680876936),o=Jn(o,n,r,i,e[1],12,-389564586),i=Jn(i,o,n,r,e[2],17,606105819),r=Jn(r,i,o,n,e[3],22,-1044525330),n=Jn(n,r,i,o,e[4],7,-176418897),o=Jn(o,n,r,i,e[5],12,1200080426),i=Jn(i,o,n,r,e[6],17,-1473231341),r=Jn(r,i,o,n,e[7],22,-45705983),n=Jn(n,r,i,o,e[8],7,1770035416),o=Jn(o,n,r,i,e[9],12,-1958414417),i=Jn(i,o,n,r,e[10],17,-42063),r=Jn(r,i,o,n,e[11],22,-1990404162),n=Jn(n,r,i,o,e[12],7,1804603682),o=Jn(o,n,r,i,e[13],12,-40341101),i=Jn(i,o,n,r,e[14],17,-1502002290),n=Zn(n,r=Jn(r,i,o,n,e[15],22,1236535329),i,o,e[1],5,-165796510),o=Zn(o,n,r,i,e[6],9,-1069501632),i=Zn(i,o,n,r,e[11],14,643717713),r=Zn(r,i,o,n,e[0],20,-373897302),n=Zn(n,r,i,o,e[5],5,-701558691),o=Zn(o,n,r,i,e[10],9,38016083),i=Zn(i,o,n,r,e[15],14,-660478335),r=Zn(r,i,o,n,e[4],20,-405537848),n=Zn(n,r,i,o,e[9],5,568446438),o=Zn(o,n,r,i,e[14],9,-1019803690),i=Zn(i,o,n,r,e[3],14,-187363961),r=Zn(r,i,o,n,e[8],20,1163531501),n=Zn(n,r,i,o,e[13],5,-1444681467),o=Zn(o,n,r,i,e[2],9,-51403784),i=Zn(i,o,n,r,e[7],14,1735328473),n=er(n,r=Zn(r,i,o,n,e[12],20,-1926607734),i,o,e[5],4,-378558),o=er(o,n,r,i,e[8],11,-2022574463),i=er(i,o,n,r,e[11],16,1839030562),r=er(r,i,o,n,e[14],23,-35309556),n=er(n,r,i,o,e[1],4,-1530992060),o=er(o,n,r,i,e[4],11,1272893353),i=er(i,o,n,r,e[7],16,-155497632),r=er(r,i,o,n,e[10],23,-1094730640),n=er(n,r,i,o,e[13],4,681279174),o=er(o,n,r,i,e[0],11,-358537222),i=er(i,o,n,r,e[3],16,-722521979),r=er(r,i,o,n,e[6],23,76029189),n=er(n,r,i,o,e[9],4,-640364487),o=er(o,n,r,i,e[12],11,-421815835),i=er(i,o,n,r,e[15],16,530742520),n=tr(n,r=er(r,i,o,n,e[2],23,-995338651),i,o,e[0],6,-198630844),o=tr(o,n,r,i,e[7],10,1126891415),i=tr(i,o,n,r,e[14],15,-1416354905),r=tr(r,i,o,n,e[5],21,-57434055),n=tr(n,r,i,o,e[12],6,1700485571),o=tr(o,n,r,i,e[3],10,-1894986606),i=tr(i,o,n,r,e[10],15,-1051523),r=tr(r,i,o,n,e[1],21,-2054922799),n=tr(n,r,i,o,e[8],6,1873313359),o=tr(o,n,r,i,e[15],10,-30611744),i=tr(i,o,n,r,e[6],15,-1560198380),r=tr(r,i,o,n,e[13],21,1309151649),n=tr(n,r,i,o,e[4],6,-145523070),o=tr(o,n,r,i,e[11],10,-1120210379),i=tr(i,o,n,r,e[2],15,718787259),r=tr(r,i,o,n,e[9],21,-343485551),t[0]=Ss(n,t[0]),t[1]=Ss(r,t[1]),t[2]=Ss(i,t[2]),t[3]=Ss(o,t[3])}function m0(t,e,n,r,i,o){return e=Ss(Ss(e,t),Ss(r,o)),Ss(e<>>32-i,n)}function Jn(t,e,n,r,i,o,s){return m0(e&n|~e&r,t,e,i,o,s)}function Zn(t,e,n,r,i,o,s){return m0(e&r|n&~r,t,e,i,o,s)}function er(t,e,n,r,i,o,s){return m0(e^n^r,t,e,i,o,s)}function tr(t,e,n,r,i,o,s){return m0(n^(e|~r),t,e,i,o,s)}function zw(t){var e,n=t.length,r=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=t.length;e+=64)n2(r,Kj(t.substring(e-64,e)));t=t.substring(e-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e>2]|=t.charCodeAt(e)<<(e%4<<3);if(i[e>>2]|=128<<(e%4<<3),e>55)for(n2(r,i),e=0;e<16;e++)i[e]=0;return i[14]=8*n,n2(r,i),r}function Kj(t){var e,n=[];for(e=0;e<64;e+=4)n[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return n}Bu=Ke.atob.bind(Ke),L5=Ke.btoa.bind(Ke);var S4="0123456789abcdef".split("");function Xj(t){for(var e="",n=0;n<4;n++)e+=S4[t>>8*n+4&15]+S4[t>>8*n&15];return e}function $j(t){return String.fromCharCode((255&t)>>0,(65280&t)>>8,(16711680&t)>>16,(4278190080&t)>>24)}function k5(t){return zw(t).map($j).join("")}var Qj=function(t){for(var e=0;e>16)+(e>>16)+(n>>16)<<16|65535&n}return t+e&4294967295}/** * @license * FPDF is released under a permissive license: there is no usage restriction. * You may embed it freely in your application (commercial or not), with or * without modifications. * * Reference: http://www.fpdf.org/en/script/script37.php */function E5(t,e){var n,r,i,o;if(t!==n){for(var s=(i=t,o=1+(256/t.length>>0),new Array(o+1).join(i)),a=[],l=0;l<256;l++)a[l]=l;var u=0;for(l=0;l<256;l++){var d=a[l];u=(u+d+s.charCodeAt(l))%256,a[l]=a[u],a[u]=d}n=t,r=a}else a=r;var p=e.length,g=0,h=0,w="";for(l=0;l€/\f©þdSiz";var o=(e+this.padding).substr(0,32),s=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(o,s),this.P=-(1+(255^i)),this.encryptionKey=k5(o+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=E5(this.encryptionKey,this.padding)}function El(t){if(/[^\u0000-\u00ff]/.test(t))throw new Error("Invalid PDF Name Object: "+t+", Only accept ASCII characters.");for(var e="",n=t.length,r=0;r126?e+="#"+("0"+i.toString(16)).slice(-2):e+=t[r]}return e}function A4(t){if(Pt(t)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var e={};this.subscribe=function(n,r,i){if(i=i||!1,typeof n!="string"||typeof r!="function"||typeof i!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");e.hasOwnProperty(n)||(e[n]={});var o=Math.random().toString(35);return e[n][o]=[r,!!i],o},this.unsubscribe=function(n){for(var r in e)if(e[r][n])return delete e[r][n],Object.keys(e[r]).length===0&&delete e[r],!0;return!1},this.publish=function(n){if(e.hasOwnProperty(n)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var o in e[n]){var s=e[n][o];try{s[0].apply(t,r)}catch(a){Ke.console&&Ft.error("jsPDF PubSub Error",a.message,a)}s[1]&&i.push(o)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return e}}function Hf(t){if(!(this instanceof Hf))return new Hf(t);var e="opacity,stroke-opacity".split(",");for(var n in t)t.hasOwnProperty(n)&&e.indexOf(n)>=0&&(this[n]=t[n]);this.id="",this.objectNumber=-1}function Gw(t,e){this.gState=t,this.matrix=e,this.id="",this.objectNumber=-1}function pa(t,e,n,r,i){if(!(this instanceof pa))return new pa(t,e,n,r,i);this.type=t==="axial"?2:3,this.coords=e,this.colors=n,Gw.call(this,r,i)}function Vl(t,e,n,r,i){if(!(this instanceof Vl))return new Vl(t,e,n,r,i);this.boundingBox=t,this.xStep=e,this.yStep=n,this.stream="",this.cloneIndex=0,Gw.call(this,r,i)}function Ye(t){var e,n=typeof arguments[0]=="string"?arguments[0]:"p",r=arguments[1],i=arguments[2],o=arguments[3],s=[],a=1,l=16,u="S",d=null;Pt(t=t||{})==="object"&&(n=t.orientation,r=t.unit||r,i=t.format||i,o=t.compress||t.compressPdf||o,(d=t.encryption||null)!==null&&(d.userPassword=d.userPassword||"",d.ownerPassword=d.ownerPassword||"",d.userPermissions=d.userPermissions||[]),a=typeof t.userUnit=="number"?Math.abs(t.userUnit):1,t.precision!==void 0&&(e=t.precision),t.floatPrecision!==void 0&&(l=t.floatPrecision),u=t.defaultPathOperation||"S"),s=t.filters||(o===!0?["FlateEncode"]:s),r=r||"mm",n=(""+(n||"P")).toLowerCase();var p=t.putOnlyUsedFonts||!1,g={},h={internal:{},__private__:{}};h.__private__.PubSub=A4;var w="1.3",_=h.__private__.getPdfVersion=function(){return w};h.__private__.setPdfVersion=function(m){w=m};var x={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};h.__private__.getPageFormats=function(){return x};var v=h.__private__.getPageFormat=function(m){return x[m]};i=i||"a4";var S={COMPAT:"compat",ADVANCED:"advanced"},y=S.COMPAT;function A(){this.saveGraphicsState(),J(new He(Ie,0,0,-Ie,0,Ko()*Ie).toString()+" cm"),this.setFontSize(this.getFontSize()/Ie),u="n",y=S.ADVANCED}function L(){this.restoreGraphicsState(),u="S",y=S.COMPAT}var R=h.__private__.combineFontStyleAndFontWeight=function(m,F){if(m=="bold"&&F=="normal"||m=="bold"&&F==400||m=="normal"&&F=="italic"||m=="bold"&&F=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return F&&(m=F==400||F==="normal"?m==="italic"?"italic":"normal":F!=700&&F!=="bold"||m!=="normal"?(F==700?"bold":F)+""+m:"bold"),m};h.advancedAPI=function(m){var F=y===S.COMPAT;return F&&A.call(this),typeof m!="function"||(m(this),F&&L.call(this)),this},h.compatAPI=function(m){var F=y===S.ADVANCED;return F&&L.call(this),typeof m!="function"||(m(this),F&&A.call(this)),this},h.isAdvancedAPI=function(){return y===S.ADVANCED};var D,k=function(m){if(y!==S.ADVANCED)throw new Error(m+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},z=h.roundToPrecision=h.__private__.roundToPrecision=function(m,F){var $=e||F;if(isNaN(m)||isNaN($))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return m.toFixed($).replace(/0+$/,"")};D=h.hpf=h.__private__.hpf=typeof l=="number"?function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.hpf");return z(m,l)}:l==="smart"?function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.hpf");return z(m,m>-1&&m<1?16:5)}:function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.hpf");return z(m,16)};var T=h.f2=h.__private__.f2=function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.f2");return z(m,2)},P=h.__private__.f3=function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.f3");return z(m,3)},E=h.scale=h.__private__.scale=function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.scale");return y===S.COMPAT?m*Ie:y===S.ADVANCED?m:void 0},W=function(m){return y===S.COMPAT?Ko()-m:y===S.ADVANCED?m:void 0},B=function(m){return E(W(m))};h.__private__.setPrecision=h.setPrecision=function(m){typeof parseInt(m,10)=="number"&&(e=parseInt(m,10))};var Q,ee="00000000000000000000000000000000",se=h.__private__.getFileId=function(){return ee},K=h.__private__.setFileId=function(m){return ee=m!==void 0&&/^[a-fA-F0-9]{32}$/.test(m)?m.toUpperCase():ee.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),d!==null&&(Kn=new kl(d.userPermissions,d.userPassword,d.ownerPassword,ee)),ee};h.setFileId=function(m){return K(m),this},h.getFileId=function(){return se()};var te=h.__private__.convertDateToPDFDate=function(m){var F=m.getTimezoneOffset(),$=F<0?"+":"-",oe=Math.floor(Math.abs(F/60)),fe=Math.abs(F%60),ye=[$,H(oe),"'",H(fe),"'"].join("");return["D:",m.getFullYear(),H(m.getMonth()+1),H(m.getDate()),H(m.getHours()),H(m.getMinutes()),H(m.getSeconds()),ye].join("")},X=h.__private__.convertPDFDateToDate=function(m){var F=parseInt(m.substr(2,4),10),$=parseInt(m.substr(6,2),10)-1,oe=parseInt(m.substr(8,2),10),fe=parseInt(m.substr(10,2),10),ye=parseInt(m.substr(12,2),10),Ne=parseInt(m.substr(14,2),10);return new Date(F,$,oe,fe,ye,Ne,0)},de=h.__private__.setCreationDate=function(m){var F;if(m===void 0&&(m=new Date),m instanceof Date)F=te(m);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(m))throw new Error("Invalid argument passed to jsPDF.setCreationDate");F=m}return Q=F},M=h.__private__.getCreationDate=function(m){var F=Q;return m==="jsDate"&&(F=X(Q)),F};h.setCreationDate=function(m){return de(m),this},h.getCreationDate=function(m){return M(m)};var G,H=h.__private__.padd2=function(m){return("0"+parseInt(m)).slice(-2)},ne=h.__private__.padd2Hex=function(m){return("00"+(m=m.toString())).substr(m.length)},ie=0,V=[],Z=[],ce=0,xe=[],we=[],Ce=!1,ke=Z,ze=function(){ie=0,ce=0,Z=[],V=[],xe=[],fo=bn(),hi=bn()};h.__private__.setCustomOutputDestination=function(m){Ce=!0,ke=m};var me=function(m){Ce||(ke=m)};h.__private__.resetCustomOutputDestination=function(){Ce=!1,ke=Z};var J=h.__private__.out=function(m){return m=m.toString(),ce+=m.length+1,ke.push(m),ke},qe=h.__private__.write=function(m){return J(arguments.length===1?m.toString():Array.prototype.join.call(arguments," "))},Be=h.__private__.getArrayBuffer=function(m){for(var F=m.length,$=new ArrayBuffer(F),oe=new Uint8Array($);F--;)oe[F]=m.charCodeAt(F);return $},Pe=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];h.__private__.getStandardFonts=function(){return Pe};var Ee=t.fontSize||16;h.__private__.setFontSize=h.setFontSize=function(m){return Ee=y===S.ADVANCED?m/Ie:m,this};var Fe,je=h.__private__.getFontSize=h.getFontSize=function(){return y===S.COMPAT?Ee:Ee*Ie},Ge=t.R2L||!1;h.__private__.setR2L=h.setR2L=function(m){return Ge=m,this},h.__private__.getR2L=h.getR2L=function(){return Ge};var et,st=h.__private__.setZoomMode=function(m){var F=[void 0,null,"fullwidth","fullheight","fullpage","original"];if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(m))Fe=m;else if(isNaN(m)){if(F.indexOf(m)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+m+'" is not recognized.');Fe=m}else Fe=parseInt(m,10)};h.__private__.getZoomMode=function(){return Fe};var lt,gt=h.__private__.setPageMode=function(m){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(m)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+m+'" is not recognized.');et=m};h.__private__.getPageMode=function(){return et};var kt=h.__private__.setLayoutMode=function(m){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(m)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+m+'" is not recognized.');lt=m};h.__private__.getLayoutMode=function(){return lt},h.__private__.setDisplayMode=h.setDisplayMode=function(m,F,$){return st(m),kt(F),gt($),this};var Qe={title:"",subject:"",author:"",keywords:"",creator:""};h.__private__.getDocumentProperty=function(m){if(Object.keys(Qe).indexOf(m)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Qe[m]},h.__private__.getDocumentProperties=function(){return Qe},h.__private__.setDocumentProperties=h.setProperties=h.setDocumentProperties=function(m){for(var F in Qe)Qe.hasOwnProperty(F)&&m[F]&&(Qe[F]=m[F]);return this},h.__private__.setDocumentProperty=function(m,F){if(Object.keys(Qe).indexOf(m)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Qe[m]=F};var ct,Ie,Yn,yt,li,Mt={},qt={},Bi=[],xt={},$s={},en={},ci={},ho=null,tn=0,tt=[],At=new A4(h),Qs=t.hotfixes||[],zn={},Di={},Ui=[],He=function m(F,$,oe,fe,ye,Ne){if(!(this instanceof m))return new m(F,$,oe,fe,ye,Ne);isNaN(F)&&(F=1),isNaN($)&&($=0),isNaN(oe)&&(oe=0),isNaN(fe)&&(fe=1),isNaN(ye)&&(ye=0),isNaN(Ne)&&(Ne=0),this._matrix=[F,$,oe,fe,ye,Ne]};Object.defineProperty(He.prototype,"sx",{get:function(){return this._matrix[0]},set:function(m){this._matrix[0]=m}}),Object.defineProperty(He.prototype,"shy",{get:function(){return this._matrix[1]},set:function(m){this._matrix[1]=m}}),Object.defineProperty(He.prototype,"shx",{get:function(){return this._matrix[2]},set:function(m){this._matrix[2]=m}}),Object.defineProperty(He.prototype,"sy",{get:function(){return this._matrix[3]},set:function(m){this._matrix[3]=m}}),Object.defineProperty(He.prototype,"tx",{get:function(){return this._matrix[4]},set:function(m){this._matrix[4]=m}}),Object.defineProperty(He.prototype,"ty",{get:function(){return this._matrix[5]},set:function(m){this._matrix[5]=m}}),Object.defineProperty(He.prototype,"a",{get:function(){return this._matrix[0]},set:function(m){this._matrix[0]=m}}),Object.defineProperty(He.prototype,"b",{get:function(){return this._matrix[1]},set:function(m){this._matrix[1]=m}}),Object.defineProperty(He.prototype,"c",{get:function(){return this._matrix[2]},set:function(m){this._matrix[2]=m}}),Object.defineProperty(He.prototype,"d",{get:function(){return this._matrix[3]},set:function(m){this._matrix[3]=m}}),Object.defineProperty(He.prototype,"e",{get:function(){return this._matrix[4]},set:function(m){this._matrix[4]=m}}),Object.defineProperty(He.prototype,"f",{get:function(){return this._matrix[5]},set:function(m){this._matrix[5]=m}}),Object.defineProperty(He.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(He.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(He.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(He.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),He.prototype.join=function(m){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(D).join(m)},He.prototype.multiply=function(m){var F=m.sx*this.sx+m.shy*this.shx,$=m.sx*this.shy+m.shy*this.sy,oe=m.shx*this.sx+m.sy*this.shx,fe=m.shx*this.shy+m.sy*this.sy,ye=m.tx*this.sx+m.ty*this.shx+this.tx,Ne=m.tx*this.shy+m.ty*this.sy+this.ty;return new He(F,$,oe,fe,ye,Ne)},He.prototype.decompose=function(){var m=this.sx,F=this.shy,$=this.shx,oe=this.sy,fe=this.tx,ye=this.ty,Ne=Math.sqrt(m*m+F*F),Oe=(m/=Ne)*$+(F/=Ne)*oe;$-=m*Oe,oe-=F*Oe;var Ve=Math.sqrt($*$+oe*oe);return Oe/=Ve,m*(oe/=Ve)>16&255,oe=Ve>>8&255,fe=255&Ve}if(oe===void 0||ye===void 0&&$===oe&&oe===fe)if(typeof $=="string")F=$+" "+Ne[0];else switch(m.precision){case 2:F=T($/255)+" "+Ne[0];break;case 3:default:F=P($/255)+" "+Ne[0]}else if(ye===void 0||Pt(ye)==="object"){if(ye&&!isNaN(ye.a)&&ye.a===0)return F=["1.","1.","1.",Ne[1]].join(" ");if(typeof $=="string")F=[$,oe,fe,Ne[1]].join(" ");else switch(m.precision){case 2:F=[T($/255),T(oe/255),T(fe/255),Ne[1]].join(" ");break;default:case 3:F=[P($/255),P(oe/255),P(fe/255),Ne[1]].join(" ")}}else if(typeof $=="string")F=[$,oe,fe,ye,Ne[2]].join(" ");else switch(m.precision){case 2:F=[T($),T(oe),T(fe),T(ye),Ne[2]].join(" ");break;case 3:default:F=[P($),P(oe),P(fe),P(ye),Ne[2]].join(" ")}return F},Gi=h.__private__.getFilters=function(){return s},Wr=h.__private__.putStream=function(m){var F=(m=m||{}).data||"",$=m.filters||Gi(),oe=m.alreadyAppliedFilters||[],fe=m.addLength1||!1,ye=F.length,Ne=m.objectId,Oe=function(Xn){return Xn};if(d!==null&&Ne===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");d!==null&&(Oe=Kn.encryptor(Ne,0));var Ve={};$===!0&&($=["FlateEncode"]);var it=m.additionalKeyValues||[],nt=(Ve=Ye.API.processDataByFilters!==void 0?Ye.API.processDataByFilters(F,$):{data:F,reverseChain:[]}).reverseChain+(Array.isArray(oe)?oe.join(" "):oe.toString());if(Ve.data.length!==0&&(it.push({key:"Length",value:Ve.data.length}),fe===!0&&it.push({key:"Length1",value:ye})),nt.length!=0)if(nt.split("/").length-1==1)it.push({key:"Filter",value:nt});else{it.push({key:"Filter",value:"["+nt+"]"});for(var pt=0;pt>"),Ve.data.length!==0&&(J("stream"),J(Oe(Ve.data)),J("endstream"))},Vi=h.__private__.putPage=function(m){var F=m.number,$=m.data,oe=m.objId,fe=m.contentsObjId;Mr(oe,!0),J("<>"),J("endobj");var ye=$.join(` `);return y===S.ADVANCED&&(ye+=` Q`),Mr(fe,!0),Wr({data:ye,filters:Gi(),objectId:fe}),J("endobj"),oe},Js=h.__private__.putPages=function(){var m,F,$=[];for(m=1;m<=tn;m++)tt[m].objId=bn(),tt[m].contentsObjId=bn();for(m=1;m<=tn;m++)$.push(Vi({number:m,data:we[m],objId:tt[m].objId,contentsObjId:tt[m].contentsObjId,mediaBox:tt[m].mediaBox,cropBox:tt[m].cropBox,bleedBox:tt[m].bleedBox,trimBox:tt[m].trimBox,artBox:tt[m].artBox,userUnit:tt[m].userUnit,rootDictionaryObjId:fo,resourceDictionaryObjId:hi}));Mr(fo,!0),J("<>"),J("endobj"),At.publish("postPutPages")},Wa=function(m){At.publish("putFont",{font:m,out:J,newObject:Cn,putStream:Wr}),m.isAlreadyPutted!==!0&&(m.objectNumber=Cn(),J("<<"),J("/Type /Font"),J("/BaseFont /"+El(m.postScriptName)),J("/Subtype /Type1"),typeof m.encoding=="string"&&J("/Encoding /"+m.encoding),J("/FirstChar 32"),J("/LastChar 255"),J(">>"),J("endobj"))},Ha=function(){for(var m in Mt)Mt.hasOwnProperty(m)&&(p===!1||p===!0&&g.hasOwnProperty(m))&&Wa(Mt[m])},Ya=function(m){m.objectNumber=Cn();var F=[];F.push({key:"Type",value:"/XObject"}),F.push({key:"Subtype",value:"/Form"}),F.push({key:"BBox",value:"["+[D(m.x),D(m.y),D(m.x+m.width),D(m.y+m.height)].join(" ")+"]"}),F.push({key:"Matrix",value:"["+m.matrix.toString()+"]"});var $=m.pages[1].join(` `);Wr({data:$,additionalKeyValues:F,objectId:m.objectNumber}),J("endobj")},Ka=function(){for(var m in zn)zn.hasOwnProperty(m)&&Ya(zn[m])},Ah=function(m,F){var $,oe=[],fe=1/(F-1);for($=0;$<1;$+=fe)oe.push($);if(oe.push(1),m[0].offset!=0){var ye={offset:0,color:m[0].color};m.unshift(ye)}if(m[m.length-1].offset!=1){var Ne={offset:1,color:m[m.length-1].color};m.push(Ne)}for(var Oe="",Ve=0,it=0;itm[Ve+1].offset;)Ve++;var nt=m[Ve].offset,pt=($-nt)/(m[Ve+1].offset-nt),Yt=m[Ve].color,nn=m[Ve+1].color;Oe+=ne(Math.round((1-pt)*Yt[0]+pt*nn[0]).toString(16))+ne(Math.round((1-pt)*Yt[1]+pt*nn[1]).toString(16))+ne(Math.round((1-pt)*Yt[2]+pt*nn[2]).toString(16))}return Oe.trim()},v0=function(m,F){F||(F=21);var $=Cn(),oe=Ah(m.colors,F),fe=[];fe.push({key:"FunctionType",value:"0"}),fe.push({key:"Domain",value:"[0.0 1.0]"}),fe.push({key:"Size",value:"["+F+"]"}),fe.push({key:"BitsPerSample",value:"8"}),fe.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),fe.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Wr({data:oe,additionalKeyValues:fe,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:$}),J("endobj"),m.objectNumber=Cn(),J("<< /ShadingType "+m.type),J("/ColorSpace /DeviceRGB");var ye="/Coords ["+D(parseFloat(m.coords[0]))+" "+D(parseFloat(m.coords[1]))+" ";m.type===2?ye+=D(parseFloat(m.coords[2]))+" "+D(parseFloat(m.coords[3])):ye+=D(parseFloat(m.coords[2]))+" "+D(parseFloat(m.coords[3]))+" "+D(parseFloat(m.coords[4]))+" "+D(parseFloat(m.coords[5])),J(ye+="]"),m.matrix&&J("/Matrix ["+m.matrix.toString()+"]"),J("/Function "+$+" 0 R"),J("/Extend [true true]"),J(">>"),J("endobj")},y0=function(m,F){var $=bn(),oe=Cn();F.push({resourcesOid:$,objectOid:oe}),m.objectNumber=oe;var fe=[];fe.push({key:"Type",value:"/Pattern"}),fe.push({key:"PatternType",value:"1"}),fe.push({key:"PaintType",value:"1"}),fe.push({key:"TilingType",value:"1"}),fe.push({key:"BBox",value:"["+m.boundingBox.map(D).join(" ")+"]"}),fe.push({key:"XStep",value:D(m.xStep)}),fe.push({key:"YStep",value:D(m.yStep)}),fe.push({key:"Resources",value:$+" 0 R"}),m.matrix&&fe.push({key:"Matrix",value:"["+m.matrix.toString()+"]"}),Wr({data:m.stream,additionalKeyValues:fe,objectId:m.objectNumber}),J("endobj")},Xa=function(m){var F;for(F in xt)xt.hasOwnProperty(F)&&(xt[F]instanceof pa?v0(xt[F]):xt[F]instanceof Vl&&y0(xt[F],m))},Nh=function(m){for(var F in m.objectNumber=Cn(),J("<<"),m)switch(F){case"opacity":J("/ca "+T(m[F]));break;case"stroke-opacity":J("/CA "+T(m[F]))}J(">>"),J("endobj")},w0=function(){var m;for(m in en)en.hasOwnProperty(m)&&Nh(en[m])},Lc=function(){for(var m in J("/XObject <<"),zn)zn.hasOwnProperty(m)&&zn[m].objectNumber>=0&&J("/"+m+" "+zn[m].objectNumber+" 0 R");At.publish("putXobjectDict"),J(">>")},b0=function(){Kn.oid=Cn(),J("<<"),J("/Filter /Standard"),J("/V "+Kn.v),J("/R "+Kn.r),J("/U <"+Kn.toHexString(Kn.U)+">"),J("/O <"+Kn.toHexString(Kn.O)+">"),J("/P "+Kn.P),J(">>"),J("endobj")},Ch=function(){for(var m in J("/Font <<"),Mt)Mt.hasOwnProperty(m)&&(p===!1||p===!0&&g.hasOwnProperty(m))&&J("/"+m+" "+Mt[m].objectNumber+" 0 R");J(">>")},_0=function(){if(Object.keys(xt).length>0){for(var m in J("/Shading <<"),xt)xt.hasOwnProperty(m)&&xt[m]instanceof pa&&xt[m].objectNumber>=0&&J("/"+m+" "+xt[m].objectNumber+" 0 R");At.publish("putShadingPatternDict"),J(">>")}},$a=function(m){if(Object.keys(xt).length>0){for(var F in J("/Pattern <<"),xt)xt.hasOwnProperty(F)&&xt[F]instanceof h.TilingPattern&&xt[F].objectNumber>=0&&xt[F].objectNumber>")}},S0=function(){if(Object.keys(en).length>0){var m;for(m in J("/ExtGState <<"),en)en.hasOwnProperty(m)&&en[m].objectNumber>=0&&J("/"+m+" "+en[m].objectNumber+" 0 R");At.publish("putGStateDict"),J(">>")}},un=function(m){Mr(m.resourcesOid,!0),J("<<"),J("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),Ch(),_0(),$a(m.objectOid),S0(),Lc(),J(">>"),J("endobj")},Ph=function(){var m=[];Ha(),w0(),Ka(),Xa(m),At.publish("putResources"),m.forEach(un),un({resourcesOid:hi,objectOid:Number.MAX_SAFE_INTEGER}),At.publish("postPutResources")},Lh=function(){At.publish("putAdditionalObjects");for(var m=0;m>8&&(Ve=!0);m=Oe.join("")}for($=m.length;Ve===void 0&&$!==0;)m.charCodeAt($-1)>>8&&(Ve=!0),$--;if(!Ve)return m;for(Oe=F.noBOM?[]:[254,255],$=0,oe=m.length;$>8)>>8)throw new Error("Character at position "+$+" of string '"+m+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Oe.push(nt),Oe.push(it-(nt<<8))}return String.fromCharCode.apply(void 0,Oe)},br=h.__private__.pdfEscape=h.pdfEscape=function(m,F){return Qa(m,F).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Ec=h.__private__.beginPage=function(m){we[++tn]=[],tt[tn]={objId:0,contentsObjId:0,userUnit:Number(a),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(m[0]),topRightY:Number(m[1])}},Th(tn),me(we[G])},Eh=function(m,F){var $,oe,fe;switch(n=F||n,typeof m=="string"&&($=v(m.toLowerCase()),Array.isArray($)&&(oe=$[0],fe=$[1])),Array.isArray(m)&&(oe=m[0]*Ie,fe=m[1]*Ie),isNaN(oe)&&(oe=i[0],fe=i[1]),(oe>14400||fe>14400)&&(Ft.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),oe=Math.min(14400,oe),fe=Math.min(14400,fe)),i=[oe,fe],n.substr(0,1)){case"l":fe>oe&&(i=[fe,oe]);break;case"p":oe>fe&&(i=[fe,oe])}Ec(i),Rh(Fc),J(gi),Oc!==0&&J(Oc+" J"),Rc!==0&&J(Rc+" j"),At.publish("addPage",{pageNumber:tn})},A0=function(m){m>0&&m<=tn&&(we.splice(m,1),tt.splice(m,1),tn--,G>tn&&(G=tn),this.setPage(G))},Th=function(m){m>0&&m<=tn&&(G=m)},N0=h.__private__.getNumberOfPages=h.getNumberOfPages=function(){return we.length-1},Mh=function(m,F,$){var oe,fe=void 0;return $=$||{},m=m!==void 0?m:Mt[ct].fontName,F=F!==void 0?F:Mt[ct].fontStyle,oe=m.toLowerCase(),qt[oe]!==void 0&&qt[oe][F]!==void 0?fe=qt[oe][F]:qt[m]!==void 0&&qt[m][F]!==void 0?fe=qt[m][F]:$.disableWarning===!1&&Ft.warn("Unable to look up font label for font '"+m+"', '"+F+"'. Refer to getFontList() for available fonts."),fe||$.noFallback||(fe=qt.times[F])==null&&(fe=qt.times.normal),fe},C0=h.__private__.putInfo=function(){var m=Cn(),F=function(oe){return oe};for(var $ in d!==null&&(F=Kn.encryptor(m,0)),J("<<"),J("/Producer ("+br(F("jsPDF "+Ye.version))+")"),Qe)Qe.hasOwnProperty($)&&Qe[$]&&J("/"+$.substr(0,1).toUpperCase()+$.substr(1)+" ("+br(F(Qe[$]))+")");J("/CreationDate ("+br(F(Q))+")"),J(">>"),J("endobj")},Tc=h.__private__.putCatalog=function(m){var F=(m=m||{}).rootDictionaryObjId||fo;switch(Cn(),J("<<"),J("/Type /Catalog"),J("/Pages "+F+" 0 R"),Fe||(Fe="fullwidth"),Fe){case"fullwidth":J("/OpenAction [3 0 R /FitH null]");break;case"fullheight":J("/OpenAction [3 0 R /FitV null]");break;case"fullpage":J("/OpenAction [3 0 R /Fit]");break;case"original":J("/OpenAction [3 0 R /XYZ null null 1]");break;default:var $=""+Fe;$.substr($.length-1)==="%"&&(Fe=parseInt(Fe)/100),typeof Fe=="number"&&J("/OpenAction [3 0 R /XYZ null null "+T(Fe)+"]")}switch(lt||(lt="continuous"),lt){case"continuous":J("/PageLayout /OneColumn");break;case"single":J("/PageLayout /SinglePage");break;case"two":case"twoleft":J("/PageLayout /TwoColumnLeft");break;case"tworight":J("/PageLayout /TwoColumnRight")}et&&J("/PageMode /"+et),At.publish("putCatalog"),J(">>"),J("endobj")},P0=h.__private__.putTrailer=function(){J("trailer"),J("<<"),J("/Size "+(ie+1)),J("/Root "+ie+" 0 R"),J("/Info "+(ie-1)+" 0 R"),d!==null&&J("/Encrypt "+Kn.oid+" 0 R"),J("/ID [ <"+ee+"> <"+ee+"> ]"),J(">>")},L0=h.__private__.putHeader=function(){J("%PDF-"+w),J("%ºß¬à")},k0=h.__private__.putXRef=function(){var m="0000000000";J("xref"),J("0 "+(ie+1)),J("0000000000 65535 f ");for(var F=1;F<=ie;F++)typeof V[F]=="function"?J((m+V[F]()).slice(-10)+" 00000 n "):V[F]!==void 0?J((m+V[F]).slice(-10)+" 00000 n "):J("0000000000 00000 n ")},po=h.__private__.buildDocument=function(){ze(),me(Z),At.publish("buildDocument"),L0(),Js(),Lh(),Ph(),d!==null&&b0(),C0(),Tc();var m=ce;return k0(),P0(),J("startxref"),J(""+m),J("%%EOF"),me(we[G]),Z.join(` `)},Ja=h.__private__.getBlob=function(m){return new Blob([Be(m)],{type:"application/pdf"})},Za=h.output=h.__private__.output=pi(function(m,F){switch(typeof(F=F||{})=="string"?F={filename:F}:F.filename=F.filename||"generated.pdf",m){case void 0:return po();case"save":h.save(F.filename);break;case"arraybuffer":return Be(po());case"blob":return Ja(po());case"bloburi":case"bloburl":if(Ke.URL!==void 0&&typeof Ke.URL.createObjectURL=="function")return Ke.URL&&Ke.URL.createObjectURL(Ja(po()))||void 0;Ft.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var $="",oe=po();try{$=L5(oe)}catch{$=L5(unescape(encodeURIComponent(oe)))}return"data:application/pdf;filename="+F.filename+";base64,"+$;case"pdfobjectnewwindow":if(Object.prototype.toString.call(Ke)==="[object Window]"){var fe="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",ye=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';F.pdfObjectUrl&&(fe=F.pdfObjectUrl,ye="");var Ne='