const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Solution-UxgEyHAk.js","assets/Solution-CHzd9PW-.css","assets/Price-BKsSK3KO.js","assets/Pay-DJEO52Rm.js","assets/Pay-vsy3DUVX.css","assets/Price-DbjRl147.css","assets/Preview-CF5SqRHZ.js","assets/Preview-BLjBJJLK.css"])))=>i.map(i=>d[i]);
var R1=Object.defineProperty;var I1=(e,t,r)=>t in e?R1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Pe=(e,t,r)=>I1(e,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const n of o.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&a(n)}).observe(document,{childList:!0,subtree:!0});function r(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 a(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();/**
* @vue/shared v3.4.35
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**//*! #__NO_SIDE_EFFECTS__ */function Qu(e,t){const r=new Set(e.split(","));return a=>r.has(a)}const We={},ka=[],Qt=()=>{},M1=()=>!1,$s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Ju=e=>e.startsWith("onUpdate:"),nt=Object.assign,Zu=(e,t)=>{const r=e.indexOf(t);r>-1&&e.splice(r,1)},L1=Object.prototype.hasOwnProperty,Se=(e,t)=>L1.call(e,t),ve=Array.isArray,_a=e=>js(e)==="[object Map]",C0=e=>js(e)==="[object Set]",pe=e=>typeof e=="function",Xe=e=>typeof e=="string",mi=e=>typeof e=="symbol",He=e=>e!==null&&typeof e=="object",k0=e=>(He(e)||pe(e))&&pe(e.then)&&pe(e.catch),_0=Object.prototype.toString,js=e=>_0.call(e),O1=e=>js(e).slice(8,-1),S0=e=>js(e)==="[object Object]",ef=e=>Xe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,xo=Qu(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),zs=e=>{const t=Object.create(null);return r=>t[r]||(t[r]=e(r))},D1=/-(\w)/g,lr=zs(e=>e.replace(D1,(t,r)=>r?r.toUpperCase():"")),B1=/\B([A-Z])/g,ea=zs(e=>e.replace(B1,"-$1").toLowerCase()),Hs=zs(e=>e.charAt(0).toUpperCase()+e.slice(1)),El=zs(e=>e?`on${Hs(e)}`:""),vi=(e,t)=>!Object.is(e,t),Gn=(e,...t)=>{for(let r=0;r<e.length;r++)e[r](...t)},T0=(e,t,r,a=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:a,value:r})},jc=e=>{const t=parseFloat(e);return isNaN(t)?e:t},F1=e=>{const t=Xe(e)?Number(e):NaN;return isNaN(t)?e:t};let xh;const A0=()=>xh||(xh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Fo(e){if(ve(e)){const t={};for(let r=0;r<e.length;r++){const a=e[r],i=Xe(a)?z1(a):Fo(a);if(i)for(const o in i)t[o]=i[o]}return t}else if(Xe(e)||He(e))return e}const N1=/;(?![^(]*\))/g,$1=/:([^]+)/,j1=/\/\*[^]*?\*\//g;function z1(e){const t={};return e.replace(j1,"").split(N1).forEach(r=>{if(r){const a=r.split($1);a.length>1&&(t[a[0].trim()]=a[1].trim())}}),t}function tf(e){let t="";if(Xe(e))t=e;else if(ve(e))for(let r=0;r<e.length;r++){const a=tf(e[r]);a&&(t+=a+" ")}else if(He(e))for(const r in e)e[r]&&(t+=r+" ");return t.trim()}const H1="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",W1=Qu(H1);function E0(e){return!!e||e===""}const P0=e=>!!(e&&e.__v_isRef===!0),zc=e=>Xe(e)?e:e==null?"":ve(e)||He(e)&&(e.toString===_0||!pe(e.toString))?P0(e)?zc(e.value):JSON.stringify(e,R0,2):String(e),R0=(e,t)=>P0(t)?R0(e,t.value):_a(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((r,[a,i],o)=>(r[Pl(a,o)+" =>"]=i,r),{})}:C0(t)?{[`Set(${t.size})`]:[...t.values()].map(r=>Pl(r))}:mi(t)?Pl(t):He(t)&&!ve(t)&&!S0(t)?String(t):t,Pl=(e,t="")=>{var r;return mi(e)?`Symbol(${(r=e.description)!=null?r:t})`:e};/**
* @vue/reactivity v3.4.35
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let sr;class U1{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=sr,!t&&sr&&(this.index=(sr.scopes||(sr.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const r=sr;try{return sr=this,t()}finally{sr=r}}}on(){sr=this}off(){sr=this.parent}stop(t){if(this._active){let r,a;for(r=0,a=this.effects.length;r<a;r++)this.effects[r].stop();for(r=0,a=this.cleanups.length;r<a;r++)this.cleanups[r]();if(this.scopes)for(r=0,a=this.scopes.length;r<a;r++)this.scopes[r].stop(!0);if(!this.detached&&this.parent&&!t){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0,this._active=!1}}}function V1(e,t=sr){t&&t.active&&t.effects.push(e)}function q1(){return sr}let zi;class rf{constructor(t,r,a,i){this.fn=t,this.trigger=r,this.scheduler=a,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,V1(this,i)}get dirty(){if(this._dirtyLevel===2||this._dirtyLevel===3){this._dirtyLevel=1,bi();for(let t=0;t<this._depsLength;t++){const r=this.deps[t];if(r.computed&&(K1(r.computed),this._dirtyLevel>=4))break}this._dirtyLevel===1&&(this._dirtyLevel=0),wi()}return this._dirtyLevel>=4}set dirty(t){this._dirtyLevel=t?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=hi,r=zi;try{return hi=!0,zi=this,this._runnings++,Ch(this),this.fn()}finally{kh(this),this._runnings--,zi=r,hi=t}}stop(){this.active&&(Ch(this),kh(this),this.onStop&&this.onStop(),this.active=!1)}}function K1(e){return e.value}function Ch(e){e._trackId++,e._depsLength=0}function kh(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t<e.deps.length;t++)I0(e.deps[t],e);e.deps.length=e._depsLength}}function I0(e,t){const r=e.get(t);r!==void 0&&t._trackId!==r&&(e.delete(t),e.size===0&&e.cleanup())}let hi=!0,Hc=0;const M0=[];function bi(){M0.push(hi),hi=!1}function wi(){const e=M0.pop();hi=e===void 0?!0:e}function af(){Hc++}function of(){for(Hc--;!Hc&&Wc.length;)Wc.shift()()}function L0(e,t,r){if(t.get(e)!==e._trackId){t.set(e,e._trackId);const a=e.deps[e._depsLength];a!==t?(a&&I0(a,e),e.deps[e._depsLength++]=t):e._depsLength++}}const Wc=[];function O0(e,t,r){af();for(const a of e.keys()){let i;a._dirtyLevel<t&&(i??(i=e.get(a)===a._trackId))&&(a._shouldSchedule||(a._shouldSchedule=a._dirtyLevel===0),a._dirtyLevel=t),a._shouldSchedule&&(i??(i=e.get(a)===a._trackId))&&(a.trigger(),(!a._runnings||a.allowRecurse)&&a._dirtyLevel!==2&&(a._shouldSchedule=!1,a.scheduler&&Wc.push(a.scheduler)))}of()}const D0=(e,t)=>{const r=new Map;return r.cleanup=e,r.computed=t,r},hs=new WeakMap,Hi=Symbol(""),Uc=Symbol("");function Ot(e,t,r){if(hi&&zi){let a=hs.get(e);a||hs.set(e,a=new Map);let i=a.get(r);i||a.set(r,i=D0(()=>a.delete(r))),L0(zi,i)}}function Nr(e,t,r,a,i,o){const n=hs.get(e);if(!n)return;let s=[];if(t==="clear")s=[...n.values()];else if(r==="length"&&ve(e)){const u=Number(a);n.forEach((c,l)=>{(l==="length"||!mi(l)&&l>=u)&&s.push(c)})}else switch(r!==void 0&&s.push(n.get(r)),t){case"add":ve(e)?ef(r)&&s.push(n.get("length")):(s.push(n.get(Hi)),_a(e)&&s.push(n.get(Uc)));break;case"delete":ve(e)||(s.push(n.get(Hi)),_a(e)&&s.push(n.get(Uc)));break;case"set":_a(e)&&s.push(n.get(Hi));break}af();for(const u of s)u&&O0(u,4);of()}function Y1(e,t){const r=hs.get(e);return r&&r.get(t)}const G1=Qu("__proto__,__v_isRef,__isVue"),B0=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(mi)),_h=X1();function X1(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...r){const a=Ee(this);for(let o=0,n=this.length;o<n;o++)Ot(a,"get",o+"");const i=a[t](...r);return i===-1||i===!1?a[t](...r.map(Ee)):i}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...r){bi(),af();const a=Ee(this)[t].apply(this,r);return of(),wi(),a}}),e}function Q1(e){mi(e)||(e=String(e));const t=Ee(this);return Ot(t,"has",e),t.hasOwnProperty(e)}class F0{constructor(t=!1,r=!1){this._isReadonly=t,this._isShallow=r}get(t,r,a){const i=this._isReadonly,o=this._isShallow;if(r==="__v_isReactive")return!i;if(r==="__v_isReadonly")return i;if(r==="__v_isShallow")return o;if(r==="__v_raw")return a===(i?o?u2:z0:o?j0:$0).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(a)?t:void 0;const n=ve(t);if(!i){if(n&&Se(_h,r))return Reflect.get(_h,r,a);if(r==="hasOwnProperty")return Q1}const s=Reflect.get(t,r,a);return(mi(r)?B0.has(r):G1(r))||(i||Ot(t,"get",r),o)?s:kt(s)?n&&ef(r)?s:s.value:He(s)?i?W0(s):ta(s):s}}class N0 extends F0{constructor(t=!1){super(!1,t)}set(t,r,a,i){let o=t[r];if(!this._isShallow){const u=Qi(o);if(!Ia(a)&&!Qi(a)&&(o=Ee(o),a=Ee(a)),!ve(t)&&kt(o)&&!kt(a))return u?!1:(o.value=a,!0)}const n=ve(t)&&ef(r)?Number(r)<t.length:Se(t,r),s=Reflect.set(t,r,a,i);return t===Ee(i)&&(n?vi(a,o)&&Nr(t,"set",r,a):Nr(t,"add",r,a)),s}deleteProperty(t,r){const a=Se(t,r);t[r];const i=Reflect.deleteProperty(t,r);return i&&a&&Nr(t,"delete",r,void 0),i}has(t,r){const a=Reflect.has(t,r);return(!mi(r)||!B0.has(r))&&Ot(t,"has",r),a}ownKeys(t){return Ot(t,"iterate",ve(t)?"length":Hi),Reflect.ownKeys(t)}}class J1 extends F0{constructor(t=!1){super(!0,t)}set(t,r){return!0}deleteProperty(t,r){return!0}}const Z1=new N0,e2=new J1,t2=new N0(!0);const nf=e=>e,Ws=e=>Reflect.getPrototypeOf(e);function Cn(e,t,r=!1,a=!1){e=e.__v_raw;const i=Ee(e),o=Ee(t);r||(vi(t,o)&&Ot(i,"get",t),Ot(i,"get",o));const{has:n}=Ws(i),s=a?nf:r?cf:No;if(n.call(i,t))return s(e.get(t));if(n.call(i,o))return s(e.get(o));e!==i&&e.get(t)}function kn(e,t=!1){const r=this.__v_raw,a=Ee(r),i=Ee(e);return t||(vi(e,i)&&Ot(a,"has",e),Ot(a,"has",i)),e===i?r.has(e):r.has(e)||r.has(i)}function _n(e,t=!1){return e=e.__v_raw,!t&&Ot(Ee(e),"iterate",Hi),Reflect.get(e,"size",e)}function Sh(e,t=!1){!t&&!Ia(e)&&!Qi(e)&&(e=Ee(e));const r=Ee(this);return Ws(r).has.call(r,e)||(r.add(e),Nr(r,"add",e,e)),this}function Th(e,t,r=!1){!r&&!Ia(t)&&!Qi(t)&&(t=Ee(t));const a=Ee(this),{has:i,get:o}=Ws(a);let n=i.call(a,e);n||(e=Ee(e),n=i.call(a,e));const s=o.call(a,e);return a.set(e,t),n?vi(t,s)&&Nr(a,"set",e,t):Nr(a,"add",e,t),this}function Ah(e){const t=Ee(this),{has:r,get:a}=Ws(t);let i=r.call(t,e);i||(e=Ee(e),i=r.call(t,e)),a&&a.call(t,e);const o=t.delete(e);return i&&Nr(t,"delete",e,void 0),o}function Eh(){const e=Ee(this),t=e.size!==0,r=e.clear();return t&&Nr(e,"clear",void 0,void 0),r}function Sn(e,t){return function(a,i){const o=this,n=o.__v_raw,s=Ee(n),u=t?nf:e?cf:No;return!e&&Ot(s,"iterate",Hi),n.forEach((c,l)=>a.call(i,u(c),u(l),o))}}function Tn(e,t,r){return function(...a){const i=this.__v_raw,o=Ee(i),n=_a(o),s=e==="entries"||e===Symbol.iterator&&n,u=e==="keys"&&n,c=i[e](...a),l=r?nf:t?cf:No;return!t&&Ot(o,"iterate",u?Uc:Hi),{next(){const{value:f,done:h}=c.next();return h?{value:f,done:h}:{value:s?[l(f[0]),l(f[1])]:l(f),done:h}},[Symbol.iterator](){return this}}}}function qr(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function r2(){const e={get(o){return Cn(this,o)},get size(){return _n(this)},has:kn,add:Sh,set:Th,delete:Ah,clear:Eh,forEach:Sn(!1,!1)},t={get(o){return Cn(this,o,!1,!0)},get size(){return _n(this)},has:kn,add(o){return Sh.call(this,o,!0)},set(o,n){return Th.call(this,o,n,!0)},delete:Ah,clear:Eh,forEach:Sn(!1,!0)},r={get(o){return Cn(this,o,!0)},get size(){return _n(this,!0)},has(o){return kn.call(this,o,!0)},add:qr("add"),set:qr("set"),delete:qr("delete"),clear:qr("clear"),forEach:Sn(!0,!1)},a={get(o){return Cn(this,o,!0,!0)},get size(){return _n(this,!0)},has(o){return kn.call(this,o,!0)},add:qr("add"),set:qr("set"),delete:qr("delete"),clear:qr("clear"),forEach:Sn(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{e[o]=Tn(o,!1,!1),r[o]=Tn(o,!0,!1),t[o]=Tn(o,!1,!0),a[o]=Tn(o,!0,!0)}),[e,r,t,a]}const[i2,a2,o2,n2]=r2();function sf(e,t){const r=t?e?n2:o2:e?a2:i2;return(a,i,o)=>i==="__v_isReactive"?!e:i==="__v_isReadonly"?e:i==="__v_raw"?a:Reflect.get(Se(r,i)&&i in a?r:a,i,o)}const s2={get:sf(!1,!1)},l2={get:sf(!1,!0)},c2={get:sf(!0,!1)};const $0=new WeakMap,j0=new WeakMap,z0=new WeakMap,u2=new WeakMap;function f2(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function h2(e){return e.__v_skip||!Object.isExtensible(e)?0:f2(O1(e))}function ta(e){return Qi(e)?e:lf(e,!1,Z1,s2,$0)}function H0(e){return lf(e,!1,t2,l2,j0)}function W0(e){return lf(e,!0,e2,c2,z0)}function lf(e,t,r,a,i){if(!He(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=i.get(e);if(o)return o;const n=h2(e);if(n===0)return e;const s=new Proxy(e,n===2?a:r);return i.set(e,s),s}function Co(e){return Qi(e)?Co(e.__v_raw):!!(e&&e.__v_isReactive)}function Qi(e){return!!(e&&e.__v_isReadonly)}function Ia(e){return!!(e&&e.__v_isShallow)}function U0(e){return e?!!e.__v_raw:!1}function Ee(e){const t=e&&e.__v_raw;return t?Ee(t):e}function d2(e){return Object.isExtensible(e)&&T0(e,"__v_skip",!0),e}const No=e=>He(e)?ta(e):e,cf=e=>He(e)?W0(e):e;class V0{constructor(t,r,a,i){this.getter=t,this._setter=r,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new rf(()=>t(this._value),()=>Xn(this,this.effect._dirtyLevel===2?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=a}get value(){const t=Ee(this);return(!t._cacheable||t.effect.dirty)&&vi(t._value,t._value=t.effect.run())&&Xn(t,4),q0(t),t.effect._dirtyLevel>=2&&Xn(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function v2(e,t,r=!1){let a,i;const o=pe(e);return o?(a=e,i=Qt):(a=e.get,i=e.set),new V0(a,i,o||!i,r)}function q0(e){var t;hi&&zi&&(e=Ee(e),L0(zi,(t=e.dep)!=null?t:e.dep=D0(()=>e.dep=void 0,e instanceof V0?e:void 0)))}function Xn(e,t=4,r,a){e=Ee(e);const i=e.dep;i&&O0(i,t)}function kt(e){return!!(e&&e.__v_isRef===!0)}function Ie(e){return K0(e,!1)}function g2(e){return K0(e,!0)}function K0(e,t){return kt(e)?e:new y2(e,t)}class y2{constructor(t,r){this.__v_isShallow=r,this.dep=void 0,this.__v_isRef=!0,this._rawValue=r?t:Ee(t),this._value=r?t:No(t)}get value(){return q0(this),this._value}set value(t){const r=this.__v_isShallow||Ia(t)||Qi(t);t=r?t:Ee(t),vi(t,this._rawValue)&&(this._rawValue,this._rawValue=t,this._value=r?t:No(t),Xn(this,4))}}function bt(e){return kt(e)?e.value:e}const p2={get:(e,t,r)=>bt(Reflect.get(e,t,r)),set:(e,t,r,a)=>{const i=e[t];return kt(i)&&!kt(r)?(i.value=r,!0):Reflect.set(e,t,r,a)}};function Y0(e){return Co(e)?e:new Proxy(e,p2)}function uf(e){const t=ve(e)?new Array(e.length):{};for(const r in e)t[r]=b2(e,r);return t}class m2{constructor(t,r,a){this._object=t,this._key=r,this._defaultValue=a,this.__v_isRef=!0}get value(){const t=this._object[this._key];return t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return Y1(Ee(this._object),this._key)}}function b2(e,t,r){const a=e[t];return kt(a)?a:new m2(e,t,r)}/**
* @vue/runtime-core v3.4.35
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function di(e,t,r,a){try{return a?e(...a):e()}catch(i){Us(i,t,r)}}function Zt(e,t,r,a){if(pe(e)){const i=di(e,t,r,a);return i&&k0(i)&&i.catch(o=>{Us(o,t,r)}),i}if(ve(e)){const i=[];for(let o=0;o<e.length;o++)i.push(Zt(e[o],t,r,a));return i}}function Us(e,t,r,a=!0){const i=t?t.vnode:null;if(t){let o=t.parent;const n=t.proxy,s=`https://vuejs.org/error-reference/#runtime-${r}`;for(;o;){const c=o.ec;if(c){for(let l=0;l<c.length;l++)if(c[l](e,n,s)===!1)return}o=o.parent}const u=t.appContext.config.errorHandler;if(u){bi(),di(u,null,10,[e,n,s]),wi();return}}w2(e,r,i,a)}function w2(e,t,r,a=!0){console.error(e)}let $o=!1,Vc=!1;const yt=[];let xr=0;const Sa=[];let Zr=null,Oi=0;const G0=Promise.resolve();let ff=null;function tn(e){const t=ff||G0;return e?t.then(this?e.bind(this):e):t}function x2(e){let t=xr+1,r=yt.length;for(;t<r;){const a=t+r>>>1,i=yt[a],o=jo(i);o<e||o===e&&i.pre?t=a+1:r=a}return t}function hf(e){(!yt.length||!yt.includes(e,$o&&e.allowRecurse?xr+1:xr))&&(e.id==null?yt.push(e):yt.splice(x2(e.id),0,e),X0())}function X0(){!$o&&!Vc&&(Vc=!0,ff=G0.then(J0))}function C2(e){const t=yt.indexOf(e);t>xr&&yt.splice(t,1)}function k2(e){ve(e)?Sa.push(...e):(!Zr||!Zr.includes(e,e.allowRecurse?Oi+1:Oi))&&Sa.push(e),X0()}function Ph(e,t,r=$o?xr+1:0){for(;r<yt.length;r++){const a=yt[r];if(a&&a.pre){if(e&&a.id!==e.uid)continue;yt.splice(r,1),r--,a()}}}function Q0(e){if(Sa.length){const t=[...new Set(Sa)].sort((r,a)=>jo(r)-jo(a));if(Sa.length=0,Zr){Zr.push(...t);return}for(Zr=t,Oi=0;Oi<Zr.length;Oi++){const r=Zr[Oi];r.active!==!1&&r()}Zr=null,Oi=0}}const jo=e=>e.id==null?1/0:e.id,_2=(e,t)=>{const r=jo(e)-jo(t);if(r===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return r};function J0(e){Vc=!1,$o=!0,yt.sort(_2);try{for(xr=0;xr<yt.length;xr++){const t=yt[xr];t&&t.active!==!1&&di(t,t.i,t.i?15:14)}}finally{xr=0,yt.length=0,Q0(),$o=!1,ff=null,(yt.length||Sa.length)&&J0()}}let Pt=null,Vs=null;function ds(e){const t=Pt;return Pt=e,Vs=e&&e.type.__scopeId||null,t}function Z0(e){Vs=e}function ep(){Vs=null}function S2(e,t=Pt,r){if(!t||e._n)return e;const a=(...i)=>{a._d&&zh(-1);const o=ds(t);let n;try{n=e(...i)}finally{ds(o),a._d&&zh(1)}return n};return a._n=!0,a._c=!0,a._d=!0,a}function tp(e,t){if(Pt===null)return e;const r=Js(Pt),a=e.dirs||(e.dirs=[]);for(let i=0;i<t.length;i++){let[o,n,s,u=We]=t[i];o&&(pe(o)&&(o={mounted:o,updated:o}),o.deep&&oi(n),a.push({dir:o,instance:r,value:n,oldValue:void 0,arg:s,modifiers:u}))}return e}function Si(e,t,r,a){const i=e.dirs,o=t&&t.dirs;for(let n=0;n<i.length;n++){const s=i[n];o&&(s.oldValue=o[n].value);let u=s.dir[a];u&&(bi(),Zt(u,r,8,[e.el,s,e,t]),wi())}}const ei=Symbol("_leaveCb"),An=Symbol("_enterCb");function T2(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ir(()=>{e.isMounted=!0}),Ys(()=>{e.isUnmounting=!0}),e}const Kt=[Function,Array],rp={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Kt,onEnter:Kt,onAfterEnter:Kt,onEnterCancelled:Kt,onBeforeLeave:Kt,onLeave:Kt,onAfterLeave:Kt,onLeaveCancelled:Kt,onBeforeAppear:Kt,onAppear:Kt,onAfterAppear:Kt,onAppearCancelled:Kt},ip=e=>{const t=e.subTree;return t.component?ip(t.component):t},A2={name:"BaseTransition",props:rp,setup(e,{slots:t}){const r=xi(),a=T2();return()=>{const i=t.default&&op(t.default(),!0);if(!i||!i.length)return;let o=i[0];if(i.length>1){for(const h of i)if(h.type!==Et){o=h;break}}const n=Ee(e),{mode:s}=n;if(a.isLeaving)return Rl(o);const u=Rh(o);if(!u)return Rl(o);let c=qc(u,n,a,r,h=>c=h);vs(u,c);const l=r.subTree,f=l&&Rh(l);if(f&&f.type!==Et&&!Di(u,f)&&ip(r).type!==Et){const h=qc(f,n,a,r);if(vs(f,h),s==="out-in"&&u.type!==Et)return a.isLeaving=!0,h.afterLeave=()=>{a.isLeaving=!1,r.update.active!==!1&&(r.effect.dirty=!0,r.update())},Rl(o);s==="in-out"&&u.type!==Et&&(h.delayLeave=(d,v,y)=>{const g=ap(a,f);g[String(f.key)]=f,d[ei]=()=>{v(),d[ei]=void 0,delete c.delayedLeave},c.delayedLeave=y})}return o}}},E2=A2;function ap(e,t){const{leavingVNodes:r}=e;let a=r.get(t.type);return a||(a=Object.create(null),r.set(t.type,a)),a}function qc(e,t,r,a,i){const{appear:o,mode:n,persisted:s=!1,onBeforeEnter:u,onEnter:c,onAfterEnter:l,onEnterCancelled:f,onBeforeLeave:h,onLeave:d,onAfterLeave:v,onLeaveCancelled:y,onBeforeAppear:g,onAppear:m,onAfterAppear:w,onAppearCancelled:p}=t,x=String(e.key),T=ap(r,e),A=(z,U)=>{z&&Zt(z,a,9,U)},I=(z,U)=>{const _=U[1];A(z,U),ve(z)?z.every(k=>k.length<=1)&&_():z.length<=1&&_()},R={mode:n,persisted:s,beforeEnter(z){let U=u;if(!r.isMounted)if(o)U=g||u;else return;z[ei]&&z[ei](!0);const _=T[x];_&&Di(e,_)&&_.el[ei]&&_.el[ei](),A(U,[z])},enter(z){let U=c,_=l,k=f;if(!r.isMounted)if(o)U=m||c,_=w||l,k=p||f;else return;let S=!1;const P=z[An]=B=>{S||(S=!0,B?A(k,[z]):A(_,[z]),R.delayedLeave&&R.delayedLeave(),z[An]=void 0)};U?I(U,[z,P]):P()},leave(z,U){const _=String(e.key);if(z[An]&&z[An](!0),r.isUnmounting)return U();A(h,[z]);let k=!1;const S=z[ei]=P=>{k||(k=!0,U(),P?A(y,[z]):A(v,[z]),z[ei]=void 0,T[_]===e&&delete T[_])};T[_]=e,d?I(d,[z,S]):S()},clone(z){const U=qc(z,t,r,a,i);return i&&i(U),U}};return R}function Rl(e){if(qs(e))return e=gi(e),e.children=null,e}function Rh(e){if(!qs(e))return e;const{shapeFlag:t,children:r}=e;if(r){if(t&16)return r[0];if(t&32&&pe(r.default))return r.default()}}function vs(e,t){e.shapeFlag&6&&e.component?vs(e.component.subTree,t):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function op(e,t=!1,r){let a=[],i=0;for(let o=0;o<e.length;o++){let n=e[o];const s=r==null?n.key:String(r)+String(n.key!=null?n.key:o);n.type===wt?(n.patchFlag&128&&i++,a=a.concat(op(n.children,t,s))):(t||n.type!==Et)&&a.push(s!=null?gi(n,{key:s}):n)}if(i>1)for(let o=0;o<a.length;o++)a[o].patchFlag=-2;return a}/*! #__NO_SIDE_EFFECTS__ */function Ge(e,t){return pe(e)?nt({name:e.name},t,{setup:e}):e}const Qn=e=>!!e.type.__asyncLoader,qs=e=>e.type.__isKeepAlive;function P2(e,t){np(e,"a",t)}function R2(e,t){np(e,"da",t)}function np(e,t,r=ft){const a=e.__wdc||(e.__wdc=()=>{let i=r;for(;i;){if(i.isDeactivated)return;i=i.parent}return e()});if(Ks(t,a,r),r){let i=r.parent;for(;i&&i.parent;)qs(i.parent.vnode)&&I2(a,t,r,i),i=i.parent}}function I2(e,t,r,a){const i=Ks(t,e,a,!0);rn(()=>{Zu(a[t],i)},r)}function Ks(e,t,r=ft,a=!1){if(r){const i=r[e]||(r[e]=[]),o=t.__weh||(t.__weh=(...n)=>{bi();const s=an(r),u=Zt(t,r,e,n);return s(),wi(),u});return a?i.unshift(o):i.push(o),o}}const Vr=e=>(t,r=ft)=>{(!Qs||e==="sp")&&Ks(e,(...a)=>t(...a),r)},df=Vr("bm"),ir=Vr("m"),M2=Vr("bu"),sp=Vr("u"),Ys=Vr("bum"),rn=Vr("um"),L2=Vr("sp"),O2=Vr("rtg"),D2=Vr("rtc");function B2(e,t=ft){Ks("ec",e,t)}const F2="components";function N2(e,t){return j2(F2,e,!0,t)||e}const $2=Symbol.for("v-ndc");function j2(e,t,r=!0,a=!1){const i=Pt||ft;if(i){const o=i.type;{const s=Rx(o,!1);if(s&&(s===t||s===lr(t)||s===Hs(lr(t))))return o}const n=Ih(i[e]||o[e],t)||Ih(i.appContext[e],t);return!n&&a?o:n}}function Ih(e,t){return e&&(e[t]||e[lr(t)]||e[Hs(lr(t))])}function cK(e,t,r,a){let i;const o=r;if(ve(e)||Xe(e)){i=new Array(e.length);for(let n=0,s=e.length;n<s;n++)i[n]=t(e[n],n,void 0,o)}else if(typeof e=="number"){i=new Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,o)}else if(He(e))if(e[Symbol.iterator])i=Array.from(e,(n,s)=>t(n,s,void 0,o));else{const n=Object.keys(e);i=new Array(n.length);for(let s=0,u=n.length;s<u;s++){const c=n[s];i[s]=t(e[c],c,s,o)}}else i=[];return i}const Kc=e=>e?Pp(e)?Js(e):Kc(e.parent):null,ko=nt(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Kc(e.parent),$root:e=>Kc(e.root),$emit:e=>e.emit,$options:e=>vf(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,hf(e.update)}),$nextTick:e=>e.n||(e.n=tn.bind(e.proxy)),$watch:e=>ux.bind(e)}),Il=(e,t)=>e!==We&&!e.__isScriptSetup&&Se(e,t),z2={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:r,setupState:a,data:i,props:o,accessCache:n,type:s,appContext:u}=e;let c;if(t[0]!=="$"){const d=n[t];if(d!==void 0)switch(d){case 1:return a[t];case 2:return i[t];case 4:return r[t];case 3:return o[t]}else{if(Il(a,t))return n[t]=1,a[t];if(i!==We&&Se(i,t))return n[t]=2,i[t];if((c=e.propsOptions[0])&&Se(c,t))return n[t]=3,o[t];if(r!==We&&Se(r,t))return n[t]=4,r[t];Yc&&(n[t]=0)}}const l=ko[t];let f,h;if(l)return t==="$attrs"&&Ot(e.attrs,"get",""),l(e);if((f=s.__cssModules)&&(f=f[t]))return f;if(r!==We&&Se(r,t))return n[t]=4,r[t];if(h=u.config.globalProperties,Se(h,t))return h[t]},set({_:e},t,r){const{data:a,setupState:i,ctx:o}=e;return Il(i,t)?(i[t]=r,!0):a!==We&&Se(a,t)?(a[t]=r,!0):Se(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=r,!0)},has({_:{data:e,setupState:t,accessCache:r,ctx:a,appContext:i,propsOptions:o}},n){let s;return!!r[n]||e!==We&&Se(e,n)||Il(t,n)||(s=o[0])&&Se(s,n)||Se(a,n)||Se(ko,n)||Se(i.config.globalProperties,n)},defineProperty(e,t,r){return r.get!=null?e._.accessCache[t]=0:Se(r,"value")&&this.set(e,t,r.value,null),Reflect.defineProperty(e,t,r)}};function Mh(e){return ve(e)?e.reduce((t,r)=>(t[r]=null,t),{}):e}let Yc=!0;function H2(e){const t=vf(e),r=e.proxy,a=e.ctx;Yc=!1,t.beforeCreate&&Lh(t.beforeCreate,e,"bc");const{data:i,computed:o,methods:n,watch:s,provide:u,inject:c,created:l,beforeMount:f,mounted:h,beforeUpdate:d,updated:v,activated:y,deactivated:g,beforeDestroy:m,beforeUnmount:w,destroyed:p,unmounted:x,render:T,renderTracked:A,renderTriggered:I,errorCaptured:R,serverPrefetch:z,expose:U,inheritAttrs:_,components:k,directives:S,filters:P}=t;if(c&&W2(c,a,null),n)for(const H in n){const L=n[H];pe(L)&&(a[H]=L.bind(r))}if(i){const H=i.call(r,r);He(H)&&(e.data=ta(H))}if(Yc=!0,o)for(const H in o){const L=o[H],M=pe(L)?L.bind(r,r):pe(L.get)?L.get.bind(r,r):Qt,j=!pe(L)&&pe(L.set)?L.set.bind(r):Qt,W=fe({get:M,set:j});Object.defineProperty(a,H,{enumerable:!0,configurable:!0,get:()=>W.value,set:F=>W.value=F})}if(s)for(const H in s)lp(s[H],a,r,H);if(u){const H=pe(u)?u.call(r):u;Reflect.ownKeys(H).forEach(L=>{Ta(L,H[L])})}l&&Lh(l,e,"c");function D(H,L){ve(L)?L.forEach(M=>H(M.bind(r))):L&&H(L.bind(r))}if(D(df,f),D(ir,h),D(M2,d),D(sp,v),D(P2,y),D(R2,g),D(B2,R),D(D2,A),D(O2,I),D(Ys,w),D(rn,x),D(L2,z),ve(U))if(U.length){const H=e.exposed||(e.exposed={});U.forEach(L=>{Object.defineProperty(H,L,{get:()=>r[L],set:M=>r[L]=M})})}else e.exposed||(e.exposed={});T&&e.render===Qt&&(e.render=T),_!=null&&(e.inheritAttrs=_),k&&(e.components=k),S&&(e.directives=S)}function W2(e,t,r=Qt){ve(e)&&(e=Gc(e));for(const a in e){const i=e[a];let o;He(i)?"default"in i?o=Ct(i.from||a,i.default,!0):o=Ct(i.from||a):o=Ct(i),kt(o)?Object.defineProperty(t,a,{enumerable:!0,configurable:!0,get:()=>o.value,set:n=>o.value=n}):t[a]=o}}function Lh(e,t,r){Zt(ve(e)?e.map(a=>a.bind(t.proxy)):e.bind(t.proxy),t,r)}function lp(e,t,r,a){const i=a.includes(".")?_p(r,a):()=>r[a];if(Xe(e)){const o=t[e];pe(o)&&ut(i,o)}else if(pe(e))ut(i,e.bind(r));else if(He(e))if(ve(e))e.forEach(o=>lp(o,t,r,a));else{const o=pe(e.handler)?e.handler.bind(r):t[e.handler];pe(o)&&ut(i,o,e)}}function vf(e){const t=e.type,{mixins:r,extends:a}=t,{mixins:i,optionsCache:o,config:{optionMergeStrategies:n}}=e.appContext,s=o.get(t);let u;return s?u=s:!i.length&&!r&&!a?u=t:(u={},i.length&&i.forEach(c=>gs(u,c,n,!0)),gs(u,t,n)),He(t)&&o.set(t,u),u}function gs(e,t,r,a=!1){const{mixins:i,extends:o}=t;o&&gs(e,o,r,!0),i&&i.forEach(n=>gs(e,n,r,!0));for(const n in t)if(!(a&&n==="expose")){const s=U2[n]||r&&r[n];e[n]=s?s(e[n],t[n]):t[n]}return e}const U2={data:Oh,props:Dh,emits:Dh,methods:po,computed:po,beforeCreate:pt,created:pt,beforeMount:pt,mounted:pt,beforeUpdate:pt,updated:pt,beforeDestroy:pt,beforeUnmount:pt,destroyed:pt,unmounted:pt,activated:pt,deactivated:pt,errorCaptured:pt,serverPrefetch:pt,components:po,directives:po,watch:q2,provide:Oh,inject:V2};function Oh(e,t){return t?e?function(){return nt(pe(e)?e.call(this,this):e,pe(t)?t.call(this,this):t)}:t:e}function V2(e,t){return po(Gc(e),Gc(t))}function Gc(e){if(ve(e)){const t={};for(let r=0;r<e.length;r++)t[e[r]]=e[r];return t}return e}function pt(e,t){return e?[...new Set([].concat(e,t))]:t}function po(e,t){return e?nt(Object.create(null),e,t):t}function Dh(e,t){return e?ve(e)&&ve(t)?[...new Set([...e,...t])]:nt(Object.create(null),Mh(e),Mh(t??{})):t}function q2(e,t){if(!e)return t;if(!t)return e;const r=nt(Object.create(null),e);for(const a in t)r[a]=pt(e[a],t[a]);return r}function cp(){return{app:null,config:{isNativeTag:M1,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let K2=0;function Y2(e,t){return function(a,i=null){pe(a)||(a=nt({},a)),i!=null&&!He(i)&&(i=null);const o=cp(),n=new WeakSet;let s=!1;const u=o.app={_uid:K2++,_component:a,_props:i,_container:null,_context:o,_instance:null,version:Mx,get config(){return o.config},set config(c){},use(c,...l){return n.has(c)||(c&&pe(c.install)?(n.add(c),c.install(u,...l)):pe(c)&&(n.add(c),c(u,...l))),u},mixin(c){return o.mixins.includes(c)||o.mixins.push(c),u},component(c,l){return l?(o.components[c]=l,u):o.components[c]},directive(c,l){return l?(o.directives[c]=l,u):o.directives[c]},mount(c,l,f){if(!s){const h=de(a,i);return h.appContext=o,f===!0?f="svg":f===!1&&(f=void 0),l&&t?t(h,c):e(h,c,f),s=!0,u._container=c,c.__vue_app__=u,Js(h.component)}},unmount(){s&&(e(null,u._container),delete u._container.__vue_app__)},provide(c,l){return o.provides[c]=l,u},runWithContext(c){const l=_o;_o=u;try{return c()}finally{_o=l}}};return u}}let _o=null;function Ta(e,t){if(ft){let r=ft.provides;const a=ft.parent&&ft.parent.provides;a===r&&(r=ft.provides=Object.create(a)),r[e]=t}}function Ct(e,t,r=!1){const a=ft||Pt;if(a||_o){const i=a?a.parent==null?a.vnode.appContext&&a.vnode.appContext.provides:a.parent.provides:_o._context.provides;if(i&&e in i)return i[e];if(arguments.length>1)return r&&pe(t)?t.call(a&&a.proxy):t}}const up={},fp=()=>Object.create(up),hp=e=>Object.getPrototypeOf(e)===up;function G2(e,t,r,a=!1){const i={},o=fp();e.propsDefaults=Object.create(null),dp(e,t,i,o);for(const n in e.propsOptions[0])n in i||(i[n]=void 0);r?e.props=a?i:H0(i):e.type.props?e.props=i:e.props=o,e.attrs=o}function X2(e,t,r,a){const{props:i,attrs:o,vnode:{patchFlag:n}}=e,s=Ee(i),[u]=e.propsOptions;let c=!1;if((a||n>0)&&!(n&16)){if(n&8){const l=e.vnode.dynamicProps;for(let f=0;f<l.length;f++){let h=l[f];if(Gs(e.emitsOptions,h))continue;const d=t[h];if(u)if(Se(o,h))d!==o[h]&&(o[h]=d,c=!0);else{const v=lr(h);i[v]=Xc(u,s,v,d,e,!1)}else d!==o[h]&&(o[h]=d,c=!0)}}}else{dp(e,t,i,o)&&(c=!0);let l;for(const f in s)(!t||!Se(t,f)&&((l=ea(f))===f||!Se(t,l)))&&(u?r&&(r[f]!==void 0||r[l]!==void 0)&&(i[f]=Xc(u,s,f,void 0,e,!0)):delete i[f]);if(o!==s)for(const f in o)(!t||!Se(t,f))&&(delete o[f],c=!0)}c&&Nr(e.attrs,"set","")}function dp(e,t,r,a){const[i,o]=e.propsOptions;let n=!1,s;if(t)for(let u in t){if(xo(u))continue;const c=t[u];let l;i&&Se(i,l=lr(u))?!o||!o.includes(l)?r[l]=c:(s||(s={}))[l]=c:Gs(e.emitsOptions,u)||(!(u in a)||c!==a[u])&&(a[u]=c,n=!0)}if(o){const u=Ee(r),c=s||We;for(let l=0;l<o.length;l++){const f=o[l];r[f]=Xc(i,u,f,c[f],e,!Se(c,f))}}return n}function Xc(e,t,r,a,i,o){const n=e[r];if(n!=null){const s=Se(n,"default");if(s&&a===void 0){const u=n.default;if(n.type!==Function&&!n.skipFactory&&pe(u)){const{propsDefaults:c}=i;if(r in c)a=c[r];else{const l=an(i);a=c[r]=u.call(null,t),l()}}else a=u}n[0]&&(o&&!s?a=!1:n[1]&&(a===""||a===ea(r))&&(a=!0))}return a}const Q2=new WeakMap;function vp(e,t,r=!1){const a=r?Q2:t.propsCache,i=a.get(e);if(i)return i;const o=e.props,n={},s=[];let u=!1;if(!pe(e)){const l=f=>{u=!0;const[h,d]=vp(f,t,!0);nt(n,h),d&&s.push(...d)};!r&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}if(!o&&!u)return He(e)&&a.set(e,ka),ka;if(ve(o))for(let l=0;l<o.length;l++){const f=lr(o[l]);Bh(f)&&(n[f]=We)}else if(o)for(const l in o){const f=lr(l);if(Bh(f)){const h=o[l],d=n[f]=ve(h)||pe(h)?{type:h}:nt({},h),v=d.type;let y=!1,g=!0;if(ve(v))for(let m=0;m<v.length;++m){const w=v[m],p=pe(w)&&w.name;if(p==="Boolean"){y=!0;break}else p==="String"&&(g=!1)}else y=pe(v)&&v.name==="Boolean";d[0]=y,d[1]=g,(y||Se(d,"default"))&&s.push(f)}}const c=[n,s];return He(e)&&a.set(e,c),c}function Bh(e){return e[0]!=="$"&&!xo(e)}const gp=e=>e[0]==="_"||e==="$stable",gf=e=>ve(e)?e.map(wr):[wr(e)],J2=(e,t,r)=>{if(t._n)return t;const a=S2((...i)=>gf(t(...i)),r);return a._c=!1,a},yp=(e,t,r)=>{const a=e._ctx;for(const i in e){if(gp(i))continue;const o=e[i];if(pe(o))t[i]=J2(i,o,a);else if(o!=null){const n=gf(o);t[i]=()=>n}}},pp=(e,t)=>{const r=gf(t);e.slots.default=()=>r},mp=(e,t,r)=>{for(const a in t)(r||a!=="_")&&(e[a]=t[a])},Z2=(e,t,r)=>{const a=e.slots=fp();if(e.vnode.shapeFlag&32){const i=t._;i?(mp(a,t,r),r&&T0(a,"_",i,!0)):yp(t,a)}else t&&pp(e,t)},ex=(e,t,r)=>{const{vnode:a,slots:i}=e;let o=!0,n=We;if(a.shapeFlag&32){const s=t._;s?r&&s===1?o=!1:mp(i,t,r):(o=!t.$stable,yp(t,i)),n=t}else t&&(pp(e,t),n={default:1});if(o)for(const s in i)!gp(s)&&n[s]==null&&delete i[s]};function Qc(e,t,r,a,i=!1){if(ve(e)){e.forEach((h,d)=>Qc(h,t&&(ve(t)?t[d]:t),r,a,i));return}if(Qn(a)&&!i)return;const o=a.shapeFlag&4?Js(a.component):a.el,n=i?null:o,{i:s,r:u}=e,c=t&&t.r,l=s.refs===We?s.refs={}:s.refs,f=s.setupState;if(c!=null&&c!==u&&(Xe(c)?(l[c]=null,Se(f,c)&&(f[c]=null)):kt(c)&&(c.value=null)),pe(u))di(u,s,12,[n,l]);else{const h=Xe(u),d=kt(u);if(h||d){const v=()=>{if(e.f){const y=h?Se(f,u)?f[u]:l[u]:u.value;i?ve(y)&&Zu(y,o):ve(y)?y.includes(o)||y.push(o):h?(l[u]=[o],Se(f,u)&&(f[u]=l[u])):(u.value=[o],e.k&&(l[e.k]=u.value))}else h?(l[u]=n,Se(f,u)&&(f[u]=n)):d&&(u.value=n,e.k&&(l[e.k]=n))};n?(v.id=-1,At(v,r)):v()}}}const bp=Symbol("_vte"),tx=e=>e.__isTeleport,So=e=>e&&(e.disabled||e.disabled===""),Fh=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Nh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Jc=(e,t)=>{const r=e&&e.to;return Xe(r)?t?t(r):null:r},rx={name:"Teleport",__isTeleport:!0,process(e,t,r,a,i,o,n,s,u,c){const{mc:l,pc:f,pbc:h,o:{insert:d,querySelector:v,createText:y,createComment:g}}=c,m=So(t.props);let{shapeFlag:w,children:p,dynamicChildren:x}=t;if(e==null){const T=t.el=y(""),A=t.anchor=y("");d(T,r,a),d(A,r,a);const I=t.target=Jc(t.props,v),R=xp(I,t,y,d);I&&(n==="svg"||Fh(I)?n="svg":(n==="mathml"||Nh(I))&&(n="mathml"));const z=(U,_)=>{w&16&&l(p,U,_,i,o,n,s,u)};m?z(r,A):I&&z(I,R)}else{t.el=e.el,t.targetStart=e.targetStart;const T=t.anchor=e.anchor,A=t.target=e.target,I=t.targetAnchor=e.targetAnchor,R=So(e.props),z=R?r:A,U=R?T:I;if(n==="svg"||Fh(A)?n="svg":(n==="mathml"||Nh(A))&&(n="mathml"),x?(h(e.dynamicChildren,x,z,i,o,n,s),yf(e,t,!0)):u||f(e,t,z,U,i,o,n,s,!1),m)R?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):En(t,r,T,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const _=t.target=Jc(t.props,v);_&&En(t,_,null,c,0)}else R&&En(t,A,I,c,1)}wp(t)},remove(e,t,r,{um:a,o:{remove:i}},o){const{shapeFlag:n,children:s,anchor:u,targetStart:c,targetAnchor:l,target:f,props:h}=e;if(f&&(i(c),i(l)),o&&i(u),n&16){const d=o||!So(h);for(let v=0;v<s.length;v++){const y=s[v];a(y,t,r,d,!!y.dynamicChildren)}}},move:En,hydrate:ix};function En(e,t,r,{o:{insert:a},m:i},o=2){o===0&&a(e.targetAnchor,t,r);const{el:n,anchor:s,shapeFlag:u,children:c,props:l}=e,f=o===2;if(f&&a(n,t,r),(!f||So(l))&&u&16)for(let h=0;h<c.length;h++)i(c[h],t,r,2);f&&a(s,t,r)}function ix(e,t,r,a,i,o,{o:{nextSibling:n,parentNode:s,querySelector:u,insert:c,createText:l}},f){const h=t.target=Jc(t.props,u);if(h){const d=h._lpa||h.firstChild;if(t.shapeFlag&16)if(So(t.props))t.anchor=f(n(e),t,s(e),r,a,i,o),t.targetStart=d,t.targetAnchor=d&&n(d);else{t.anchor=n(e);let v=d;for(;v;){if(v&&v.nodeType===8){if(v.data==="teleport start anchor")t.targetStart=v;else if(v.data==="teleport anchor"){t.targetAnchor=v,h._lpa=t.targetAnchor&&n(t.targetAnchor);break}}v=n(v)}t.targetAnchor||xp(h,t,l,c),f(d&&n(d),t,h,r,a,i,o)}wp(t)}return t.anchor&&n(t.anchor)}const Zc=rx;function wp(e){const t=e.ctx;if(t&&t.ut){let r=e.children[0].el;for(;r&&r!==e.targetAnchor;)r.nodeType===1&&r.setAttribute("data-v-owner",t.uid),r=r.nextSibling;t.ut()}}function xp(e,t,r,a){const i=t.targetStart=r(""),o=t.targetAnchor=r("");return i[bp]=o,e&&(a(i,e),a(o,e)),o}const At=mx;function ax(e){return ox(e)}function ox(e,t){const r=A0();r.__VUE__=!0;const{insert:a,remove:i,patchProp:o,createElement:n,createText:s,createComment:u,setText:c,setElementText:l,parentNode:f,nextSibling:h,setScopeId:d=Qt,insertStaticContent:v}=e,y=(O,$,G,Z=null,J=null,ee=null,te=void 0,oe=null,ne=!!$.dynamicChildren)=>{if(O===$)return;O&&!Di(O,$)&&(Z=K(O),F(O,J,ee,!0),O=null),$.patchFlag===-2&&(ne=!1,$.dynamicChildren=null);const{type:ae,ref:ie,shapeFlag:se}=$;switch(ae){case Ka:g(O,$,G,Z);break;case Et:m(O,$,G,Z);break;case Jn:O==null&&w($,G,Z,te);break;case wt:k(O,$,G,Z,J,ee,te,oe,ne);break;default:se&1?T(O,$,G,Z,J,ee,te,oe,ne):se&6?S(O,$,G,Z,J,ee,te,oe,ne):(se&64||se&128)&&ae.process(O,$,G,Z,J,ee,te,oe,ne,C)}ie!=null&&J&&Qc(ie,O&&O.ref,ee,$||O,!$)},g=(O,$,G,Z)=>{if(O==null)a($.el=s($.children),G,Z);else{const J=$.el=O.el;$.children!==O.children&&c(J,$.children)}},m=(O,$,G,Z)=>{O==null?a($.el=u($.children||""),G,Z):$.el=O.el},w=(O,$,G,Z)=>{[O.el,O.anchor]=v(O.children,$,G,Z,O.el,O.anchor)},p=({el:O,anchor:$},G,Z)=>{let J;for(;O&&O!==$;)J=h(O),a(O,G,Z),O=J;a($,G,Z)},x=({el:O,anchor:$})=>{let G;for(;O&&O!==$;)G=h(O),i(O),O=G;i($)},T=(O,$,G,Z,J,ee,te,oe,ne)=>{$.type==="svg"?te="svg":$.type==="math"&&(te="mathml"),O==null?A($,G,Z,J,ee,te,oe,ne):z(O,$,J,ee,te,oe,ne)},A=(O,$,G,Z,J,ee,te,oe)=>{let ne,ae;const{props:ie,shapeFlag:se,transition:le,dirs:ge}=O;if(ne=O.el=n(O.type,ee,ie&&ie.is,ie),se&8?l(ne,O.children):se&16&&R(O.children,ne,null,Z,J,Ml(O,ee),te,oe),ge&&Si(O,null,Z,"created"),I(ne,O,O.scopeId,te,Z),ie){for(const Oe in ie)Oe!=="value"&&!xo(Oe)&&o(ne,Oe,null,ie[Oe],ee,Z);"value"in ie&&o(ne,"value",null,ie.value,ee),(ae=ie.onVnodeBeforeMount)&&dr(ae,Z,O)}ge&&Si(O,null,Z,"beforeMount");const we=nx(J,le);we&&le.beforeEnter(ne),a(ne,$,G),((ae=ie&&ie.onVnodeMounted)||we||ge)&&At(()=>{ae&&dr(ae,Z,O),we&&le.enter(ne),ge&&Si(O,null,Z,"mounted")},J)},I=(O,$,G,Z,J)=>{if(G&&d(O,G),Z)for(let ee=0;ee<Z.length;ee++)d(O,Z[ee]);if(J){let ee=J.subTree;if($===ee){const te=J.vnode;I(O,te,te.scopeId,te.slotScopeIds,J.parent)}}},R=(O,$,G,Z,J,ee,te,oe,ne=0)=>{for(let ae=ne;ae<O.length;ae++){const ie=O[ae]=oe?ti(O[ae]):wr(O[ae]);y(null,ie,$,G,Z,J,ee,te,oe)}},z=(O,$,G,Z,J,ee,te)=>{const oe=$.el=O.el;let{patchFlag:ne,dynamicChildren:ae,dirs:ie}=$;ne|=O.patchFlag&16;const se=O.props||We,le=$.props||We;let ge;if(G&&Ti(G,!1),(ge=le.onVnodeBeforeUpdate)&&dr(ge,G,$,O),ie&&Si($,O,G,"beforeUpdate"),G&&Ti(G,!0),(se.innerHTML&&le.innerHTML==null||se.textContent&&le.textContent==null)&&l(oe,""),ae?U(O.dynamicChildren,ae,oe,G,Z,Ml($,J),ee):te||L(O,$,oe,null,G,Z,Ml($,J),ee,!1),ne>0){if(ne&16)_(oe,se,le,G,J);else if(ne&2&&se.class!==le.class&&o(oe,"class",null,le.class,J),ne&4&&o(oe,"style",se.style,le.style,J),ne&8){const we=$.dynamicProps;for(let Oe=0;Oe<we.length;Oe++){const Me=we[Oe],it=se[Me],ar=le[Me];(ar!==it||Me==="value")&&o(oe,Me,it,ar,J,G)}}ne&1&&O.children!==$.children&&l(oe,$.children)}else!te&&ae==null&&_(oe,se,le,G,J);((ge=le.onVnodeUpdated)||ie)&&At(()=>{ge&&dr(ge,G,$,O),ie&&Si($,O,G,"updated")},Z)},U=(O,$,G,Z,J,ee,te)=>{for(let oe=0;oe<$.length;oe++){const ne=O[oe],ae=$[oe],ie=ne.el&&(ne.type===wt||!Di(ne,ae)||ne.shapeFlag&70)?f(ne.el):G;y(ne,ae,ie,null,Z,J,ee,te,!0)}},_=(O,$,G,Z,J)=>{if($!==G){if($!==We)for(const ee in $)!xo(ee)&&!(ee in G)&&o(O,ee,$[ee],null,J,Z);for(const ee in G){if(xo(ee))continue;const te=G[ee],oe=$[ee];te!==oe&&ee!=="value"&&o(O,ee,oe,te,J,Z)}"value"in G&&o(O,"value",$.value,G.value,J)}},k=(O,$,G,Z,J,ee,te,oe,ne)=>{const ae=$.el=O?O.el:s(""),ie=$.anchor=O?O.anchor:s("");let{patchFlag:se,dynamicChildren:le,slotScopeIds:ge}=$;ge&&(oe=oe?oe.concat(ge):ge),O==null?(a(ae,G,Z),a(ie,G,Z),R($.children||[],G,ie,J,ee,te,oe,ne)):se>0&&se&64&&le&&O.dynamicChildren?(U(O.dynamicChildren,le,G,J,ee,te,oe),($.key!=null||J&&$===J.subTree)&&yf(O,$,!0)):L(O,$,G,ie,J,ee,te,oe,ne)},S=(O,$,G,Z,J,ee,te,oe,ne)=>{$.slotScopeIds=oe,O==null?$.shapeFlag&512?J.ctx.activate($,G,Z,te,ne):P($,G,Z,J,ee,te,ne):B(O,$,ne)},P=(O,$,G,Z,J,ee,te)=>{const oe=O.component=Sx(O,Z,J);if(qs(O)&&(oe.ctx.renderer=C),Tx(oe,!1,te),oe.asyncDep){if(J&&J.registerDep(oe,D,te),!O.el){const ne=oe.subTree=de(Et);m(null,ne,$,G)}}else D(oe,O,$,G,J,ee,te)},B=(O,$,G)=>{const Z=$.component=O.component;if(gx(O,$,G))if(Z.asyncDep&&!Z.asyncResolved){H(Z,$,G);return}else Z.next=$,C2(Z.update),Z.effect.dirty=!0,Z.update();else $.el=O.el,Z.vnode=$},D=(O,$,G,Z,J,ee,te)=>{const oe=()=>{if(O.isMounted){let{next:ie,bu:se,u:le,parent:ge,vnode:we}=O;{const oa=Cp(O);if(oa){ie&&(ie.el=we.el,H(O,ie,te)),oa.asyncDep.then(()=>{O.isUnmounted||oe()});return}}let Oe=ie,Me;Ti(O,!1),ie?(ie.el=we.el,H(O,ie,te)):ie=we,se&&Gn(se),(Me=ie.props&&ie.props.onVnodeBeforeUpdate)&&dr(Me,ge,ie,we),Ti(O,!0);const it=Ll(O),ar=O.subTree;O.subTree=it,y(ar,it,f(ar.el),K(ar),O,J,ee),ie.el=it.el,Oe===null&&yx(O,it.el),le&&At(le,J),(Me=ie.props&&ie.props.onVnodeUpdated)&&At(()=>dr(Me,ge,ie,we),J)}else{let ie;const{el:se,props:le}=$,{bm:ge,m:we,parent:Oe}=O,Me=Qn($);if(Ti(O,!1),ge&&Gn(ge),!Me&&(ie=le&&le.onVnodeBeforeMount)&&dr(ie,Oe,$),Ti(O,!0),se&&N){const it=()=>{O.subTree=Ll(O),N(se,O.subTree,O,J,null)};Me?$.type.__asyncLoader().then(()=>!O.isUnmounted&&it()):it()}else{const it=O.subTree=Ll(O);y(null,it,G,Z,O,J,ee),$.el=it.el}if(we&&At(we,J),!Me&&(ie=le&&le.onVnodeMounted)){const it=$;At(()=>dr(ie,Oe,it),J)}($.shapeFlag&256||Oe&&Qn(Oe.vnode)&&Oe.vnode.shapeFlag&256)&&O.a&&At(O.a,J),O.isMounted=!0,$=G=Z=null}},ne=O.effect=new rf(oe,Qt,()=>hf(ae),O.scope),ae=O.update=()=>{ne.dirty&&ne.run()};ae.i=O,ae.id=O.uid,Ti(O,!0),ae()},H=(O,$,G)=>{$.component=O;const Z=O.vnode.props;O.vnode=$,O.next=null,X2(O,$.props,Z,G),ex(O,$.children,G),bi(),Ph(O),wi()},L=(O,$,G,Z,J,ee,te,oe,ne=!1)=>{const ae=O&&O.children,ie=O?O.shapeFlag:0,se=$.children,{patchFlag:le,shapeFlag:ge}=$;if(le>0){if(le&128){j(ae,se,G,Z,J,ee,te,oe,ne);return}else if(le&256){M(ae,se,G,Z,J,ee,te,oe,ne);return}}ge&8?(ie&16&&Q(ae,J,ee),se!==ae&&l(G,se)):ie&16?ge&16?j(ae,se,G,Z,J,ee,te,oe,ne):Q(ae,J,ee,!0):(ie&8&&l(G,""),ge&16&&R(se,G,Z,J,ee,te,oe,ne))},M=(O,$,G,Z,J,ee,te,oe,ne)=>{O=O||ka,$=$||ka;const ae=O.length,ie=$.length,se=Math.min(ae,ie);let le;for(le=0;le<se;le++){const ge=$[le]=ne?ti($[le]):wr($[le]);y(O[le],ge,G,null,J,ee,te,oe,ne)}ae>ie?Q(O,J,ee,!0,!1,se):R($,G,Z,J,ee,te,oe,ne,se)},j=(O,$,G,Z,J,ee,te,oe,ne)=>{let ae=0;const ie=$.length;let se=O.length-1,le=ie-1;for(;ae<=se&&ae<=le;){const ge=O[ae],we=$[ae]=ne?ti($[ae]):wr($[ae]);if(Di(ge,we))y(ge,we,G,null,J,ee,te,oe,ne);else break;ae++}for(;ae<=se&&ae<=le;){const ge=O[se],we=$[le]=ne?ti($[le]):wr($[le]);if(Di(ge,we))y(ge,we,G,null,J,ee,te,oe,ne);else break;se--,le--}if(ae>se){if(ae<=le){const ge=le+1,we=ge<ie?$[ge].el:Z;for(;ae<=le;)y(null,$[ae]=ne?ti($[ae]):wr($[ae]),G,we,J,ee,te,oe,ne),ae++}}else if(ae>le)for(;ae<=se;)F(O[ae],J,ee,!0),ae++;else{const ge=ae,we=ae,Oe=new Map;for(ae=we;ae<=le;ae++){const Nt=$[ae]=ne?ti($[ae]):wr($[ae]);Nt.key!=null&&Oe.set(Nt.key,ae)}let Me,it=0;const ar=le-we+1;let oa=!1,mh=0;const io=new Array(ar);for(ae=0;ae<ar;ae++)io[ae]=0;for(ae=ge;ae<=se;ae++){const Nt=O[ae];if(it>=ar){F(Nt,J,ee,!0);continue}let hr;if(Nt.key!=null)hr=Oe.get(Nt.key);else for(Me=we;Me<=le;Me++)if(io[Me-we]===0&&Di(Nt,$[Me])){hr=Me;break}hr===void 0?F(Nt,J,ee,!0):(io[hr-we]=ae+1,hr>=mh?mh=hr:oa=!0,y(Nt,$[hr],G,null,J,ee,te,oe,ne),it++)}const bh=oa?sx(io):ka;for(Me=bh.length-1,ae=ar-1;ae>=0;ae--){const Nt=we+ae,hr=$[Nt],wh=Nt+1<ie?$[Nt+1].el:Z;io[ae]===0?y(null,hr,G,wh,J,ee,te,oe,ne):oa&&(Me<0||ae!==bh[Me]?W(hr,G,wh,2):Me--)}}},W=(O,$,G,Z,J=null)=>{const{el:ee,type:te,transition:oe,children:ne,shapeFlag:ae}=O;if(ae&6){W(O.component.subTree,$,G,Z);return}if(ae&128){O.suspense.move($,G,Z);return}if(ae&64){te.move(O,$,G,C);return}if(te===wt){a(ee,$,G);for(let se=0;se<ne.length;se++)W(ne[se],$,G,Z);a(O.anchor,$,G);return}if(te===Jn){p(O,$,G);return}if(Z!==2&&ae&1&&oe)if(Z===0)oe.beforeEnter(ee),a(ee,$,G),At(()=>oe.enter(ee),J);else{const{leave:se,delayLeave:le,afterLeave:ge}=oe,we=()=>a(ee,$,G),Oe=()=>{se(ee,()=>{we(),ge&&ge()})};le?le(ee,we,Oe):Oe()}else a(ee,$,G)},F=(O,$,G,Z=!1,J=!1)=>{const{type:ee,props:te,ref:oe,children:ne,dynamicChildren:ae,shapeFlag:ie,patchFlag:se,dirs:le,cacheIndex:ge}=O;if(se===-2&&(J=!1),oe!=null&&Qc(oe,null,G,O,!0),ge!=null&&($.renderCache[ge]=void 0),ie&256){$.ctx.deactivate(O);return}const we=ie&1&&le,Oe=!Qn(O);let Me;if(Oe&&(Me=te&&te.onVnodeBeforeUnmount)&&dr(Me,$,O),ie&6)q(O.component,G,Z);else{if(ie&128){O.suspense.unmount(G,Z);return}we&&Si(O,null,$,"beforeUnmount"),ie&64?O.type.remove(O,$,G,C,Z):ae&&!ae.hasOnce&&(ee!==wt||se>0&&se&64)?Q(ae,$,G,!1,!0):(ee===wt&&se&384||!J&&ie&16)&&Q(ne,$,G),Z&&V(O)}(Oe&&(Me=te&&te.onVnodeUnmounted)||we)&&At(()=>{Me&&dr(Me,$,O),we&&Si(O,null,$,"unmounted")},G)},V=O=>{const{type:$,el:G,anchor:Z,transition:J}=O;if($===wt){Y(G,Z);return}if($===Jn){x(O);return}const ee=()=>{i(G),J&&!J.persisted&&J.afterLeave&&J.afterLeave()};if(O.shapeFlag&1&&J&&!J.persisted){const{leave:te,delayLeave:oe}=J,ne=()=>te(G,ee);oe?oe(O.el,ee,ne):ne()}else ee()},Y=(O,$)=>{let G;for(;O!==$;)G=h(O),i(O),O=G;i($)},q=(O,$,G)=>{const{bum:Z,scope:J,update:ee,subTree:te,um:oe,m:ne,a:ae}=O;$h(ne),$h(ae),Z&&Gn(Z),J.stop(),ee&&(ee.active=!1,F(te,O,$,G)),oe&&At(oe,$),At(()=>{O.isUnmounted=!0},$),$&&$.pendingBranch&&!$.isUnmounted&&O.asyncDep&&!O.asyncResolved&&O.suspenseId===$.pendingId&&($.deps--,$.deps===0&&$.resolve())},Q=(O,$,G,Z=!1,J=!1,ee=0)=>{for(let te=ee;te<O.length;te++)F(O[te],$,G,Z,J)},K=O=>{if(O.shapeFlag&6)return K(O.component.subTree);if(O.shapeFlag&128)return O.suspense.next();const $=h(O.anchor||O.el),G=$&&$[bp];return G?h(G):$};let X=!1;const b=(O,$,G)=>{O==null?$._vnode&&F($._vnode,null,null,!0):y($._vnode||null,O,$,null,null,null,G),X||(X=!0,Ph(),Q0(),X=!1),$._vnode=O},C={p:y,um:F,m:W,r:V,mt:P,mc:R,pc:L,pbc:U,n:K,o:e};let E,N;return{render:b,hydrate:E,createApp:Y2(b,E)}}function Ml({type:e,props:t},r){return r==="svg"&&e==="foreignObject"||r==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:r}function Ti({effect:e,update:t},r){e.allowRecurse=t.allowRecurse=r}function nx(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function yf(e,t,r=!1){const a=e.children,i=t.children;if(ve(a)&&ve(i))for(let o=0;o<a.length;o++){const n=a[o];let s=i[o];s.shapeFlag&1&&!s.dynamicChildren&&((s.patchFlag<=0||s.patchFlag===32)&&(s=i[o]=ti(i[o]),s.el=n.el),!r&&s.patchFlag!==-2&&yf(n,s)),s.type===Ka&&(s.el=n.el)}}function sx(e){const t=e.slice(),r=[0];let a,i,o,n,s;const u=e.length;for(a=0;a<u;a++){const c=e[a];if(c!==0){if(i=r[r.length-1],e[i]<c){t[a]=i,r.push(a);continue}for(o=0,n=r.length-1;o<n;)s=o+n>>1,e[r[s]]<c?o=s+1:n=s;c<e[r[o]]&&(o>0&&(t[a]=r[o-1]),r[o]=a)}}for(o=r.length,n=r[o-1];o-- >0;)r[o]=n,n=t[n];return r}function Cp(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Cp(t)}function $h(e){if(e)for(let t=0;t<e.length;t++)e[t].active=!1}const lx=Symbol.for("v-scx"),cx=()=>Ct(lx),Pn={};function ut(e,t,r){return kp(e,t,r)}function kp(e,t,{immediate:r,deep:a,flush:i,once:o,onTrack:n,onTrigger:s}=We){if(t&&o){const A=t;t=(...I)=>{A(...I),T()}}const u=ft,c=A=>a===!0?A:oi(A,a===!1?1:void 0);let l,f=!1,h=!1;if(kt(e)?(l=()=>e.value,f=Ia(e)):Co(e)?(l=()=>c(e),f=!0):ve(e)?(h=!0,f=e.some(A=>Co(A)||Ia(A)),l=()=>e.map(A=>{if(kt(A))return A.value;if(Co(A))return c(A);if(pe(A))return di(A,u,2)})):pe(e)?t?l=()=>di(e,u,2):l=()=>(d&&d(),Zt(e,u,3,[v])):l=Qt,t&&a){const A=l;l=()=>oi(A())}let d,v=A=>{d=p.onStop=()=>{di(A,u,4),d=p.onStop=void 0}},y;if(Qs)if(v=Qt,t?r&&Zt(t,u,3,[l(),h?[]:void 0,v]):l(),i==="sync"){const A=cx();y=A.__watcherHandles||(A.__watcherHandles=[])}else return Qt;let g=h?new Array(e.length).fill(Pn):Pn;const m=()=>{if(!(!p.active||!p.dirty))if(t){const A=p.run();(a||f||(h?A.some((I,R)=>vi(I,g[R])):vi(A,g)))&&(d&&d(),Zt(t,u,3,[A,g===Pn?void 0:h&&g[0]===Pn?[]:g,v]),g=A)}else p.run()};m.allowRecurse=!!t;let w;i==="sync"?w=m:i==="post"?w=()=>At(m,u&&u.suspense):(m.pre=!0,u&&(m.id=u.uid),w=()=>hf(m));const p=new rf(l,Qt,w),x=q1(),T=()=>{p.stop(),x&&Zu(x.effects,p)};return t?r?m():g=p.run():i==="post"?At(p.run.bind(p),u&&u.suspense):p.run(),y&&y.push(T),T}function ux(e,t,r){const a=this.proxy,i=Xe(e)?e.includes(".")?_p(a,e):()=>a[e]:e.bind(a,a);let o;pe(t)?o=t:(o=t.handler,r=t);const n=an(this),s=kp(i,o.bind(a),r);return n(),s}function _p(e,t){const r=t.split(".");return()=>{let a=e;for(let i=0;i<r.length&&a;i++)a=a[r[i]];return a}}function oi(e,t=1/0,r){if(t<=0||!He(e)||e.__v_skip||(r=r||new Set,r.has(e)))return e;if(r.add(e),t--,kt(e))oi(e.value,t,r);else if(ve(e))for(let a=0;a<e.length;a++)oi(e[a],t,r);else if(C0(e)||_a(e))e.forEach(a=>{oi(a,t,r)});else if(S0(e)){for(const a in e)oi(e[a],t,r);for(const a of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,a)&&oi(e[a],t,r)}return e}const fx=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${lr(t)}Modifiers`]||e[`${ea(t)}Modifiers`];function hx(e,t,...r){if(e.isUnmounted)return;const a=e.vnode.props||We;let i=r;const o=t.startsWith("update:"),n=o&&fx(a,t.slice(7));n&&(n.trim&&(i=r.map(l=>Xe(l)?l.trim():l)),n.number&&(i=r.map(jc)));let s,u=a[s=El(t)]||a[s=El(lr(t))];!u&&o&&(u=a[s=El(ea(t))]),u&&Zt(u,e,6,i);const c=a[s+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,Zt(c,e,6,i)}}function Sp(e,t,r=!1){const a=t.emitsCache,i=a.get(e);if(i!==void 0)return i;const o=e.emits;let n={},s=!1;if(!pe(e)){const u=c=>{const l=Sp(c,t,!0);l&&(s=!0,nt(n,l))};!r&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}return!o&&!s?(He(e)&&a.set(e,null),null):(ve(o)?o.forEach(u=>n[u]=null):nt(n,o),He(e)&&a.set(e,n),n)}function Gs(e,t){return!e||!$s(t)?!1:(t=t.slice(2).replace(/Once$/,""),Se(e,t[0].toLowerCase()+t.slice(1))||Se(e,ea(t))||Se(e,t))}function Ll(e){const{type:t,vnode:r,proxy:a,withProxy:i,propsOptions:[o],slots:n,attrs:s,emit:u,render:c,renderCache:l,props:f,data:h,setupState:d,ctx:v,inheritAttrs:y}=e,g=ds(e);let m,w;try{if(r.shapeFlag&4){const x=i||a,T=x;m=wr(c.call(T,x,l,f,d,h,v)),w=s}else{const x=t;m=wr(x.length>1?x(f,{attrs:s,slots:n,emit:u}):x(f,null)),w=t.props?s:dx(s)}}catch(x){To.length=0,Us(x,e,1),m=de(Et)}let p=m;if(w&&y!==!1){const x=Object.keys(w),{shapeFlag:T}=p;x.length&&T&7&&(o&&x.some(Ju)&&(w=vx(w,o)),p=gi(p,w,!1,!0))}return r.dirs&&(p=gi(p,null,!1,!0),p.dirs=p.dirs?p.dirs.concat(r.dirs):r.dirs),r.transition&&(p.transition=r.transition),m=p,ds(g),m}const dx=e=>{let t;for(const r in e)(r==="class"||r==="style"||$s(r))&&((t||(t={}))[r]=e[r]);return t},vx=(e,t)=>{const r={};for(const a in e)(!Ju(a)||!(a.slice(9)in t))&&(r[a]=e[a]);return r};function gx(e,t,r){const{props:a,children:i,component:o}=e,{props:n,children:s,patchFlag:u}=t,c=o.emitsOptions;if(t.dirs||t.transition)return!0;if(r&&u>=0){if(u&1024)return!0;if(u&16)return a?jh(a,n,c):!!n;if(u&8){const l=t.dynamicProps;for(let f=0;f<l.length;f++){const h=l[f];if(n[h]!==a[h]&&!Gs(c,h))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:a===n?!1:a?n?jh(a,n,c):!0:!!n;return!1}function jh(e,t,r){const a=Object.keys(t);if(a.length!==Object.keys(e).length)return!0;for(let i=0;i<a.length;i++){const o=a[i];if(t[o]!==e[o]&&!Gs(r,o))return!0}return!1}function yx({vnode:e,parent:t},r){for(;t;){const a=t.subTree;if(a.suspense&&a.suspense.activeBranch===e&&(a.el=e.el),a===e)(e=t.vnode).el=r,t=t.parent;else break}}const px=e=>e.__isSuspense;function mx(e,t){t&&t.pendingBranch?ve(e)?t.effects.push(...e):t.effects.push(e):k2(e)}const wt=Symbol.for("v-fgt"),Ka=Symbol.for("v-txt"),Et=Symbol.for("v-cmt"),Jn=Symbol.for("v-stc"),To=[];let zt=null;function Wi(e=!1){To.push(zt=e?null:[])}function bx(){To.pop(),zt=To[To.length-1]||null}let zo=1;function zh(e){zo+=e,e<0&&zt&&(zt.hasOnce=!0)}function Tp(e){return e.dynamicChildren=zo>0?zt||ka:null,bx(),zo>0&&zt&&zt.push(e),e}function Xs(e,t,r,a,i,o){return Tp(Ce(e,t,r,a,i,o,!0))}function eu(e,t,r,a,i){return Tp(de(e,t,r,a,i,!0))}function Ma(e){return e?e.__v_isVNode===!0:!1}function Di(e,t){return e.type===t.type&&e.key===t.key}const Ap=({key:e})=>e??null,Zn=({ref:e,ref_key:t,ref_for:r})=>(typeof e=="number"&&(e=""+e),e!=null?Xe(e)||kt(e)||pe(e)?{i:Pt,r:e,k:t,f:!!r}:e:null);function Ce(e,t=null,r=null,a=0,i=null,o=e===wt?0:1,n=!1,s=!1){const u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ap(t),ref:t&&Zn(t),scopeId:Vs,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:a,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Pt};return s?(mf(u,r),o&128&&e.normalize(u)):r&&(u.shapeFlag|=Xe(r)?8:16),zo>0&&!n&&zt&&(u.patchFlag>0||o&6)&&u.patchFlag!==32&&zt.push(u),u}const de=xx;function xx(e,t=null,r=null,a=0,i=null,o=!1){if((!e||e===$2)&&(e=Et),Ma(e)){const s=gi(e,t,!0);return r&&mf(s,r),zo>0&&!o&&zt&&(s.shapeFlag&6?zt[zt.indexOf(e)]=s:zt.push(s)),s.patchFlag=-2,s}if(Ix(e)&&(e=e.__vccOpts),t){t=Cx(t);let{class:s,style:u}=t;s&&!Xe(s)&&(t.class=tf(s)),He(u)&&(U0(u)&&!ve(u)&&(u=nt({},u)),t.style=Fo(u))}const n=Xe(e)?1:px(e)?128:tx(e)?64:He(e)?4:pe(e)?2:0;return Ce(e,t,r,a,i,n,o,!0)}function Cx(e){return e?U0(e)||hp(e)?nt({},e):e:null}function gi(e,t,r=!1,a=!1){const{props:i,ref:o,patchFlag:n,children:s,transition:u}=e,c=t?ni(i||{},t):i,l={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Ap(c),ref:t&&t.ref?r&&o?ve(o)?o.concat(Zn(t)):[o,Zn(t)]:Zn(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==wt?n===-1?16:n|16:n,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:u,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&gi(e.ssContent),ssFallback:e.ssFallback&&gi(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return u&&a&&vs(l,u.clone(l)),l}function Ep(e=" ",t=0){return de(Ka,null,e,t)}function pf(e,t){const r=de(Jn,null,e);return r.staticCount=t,r}function Hh(e="",t=!1){return t?(Wi(),eu(Et,null,e)):de(Et,null,e)}function wr(e){return e==null||typeof e=="boolean"?de(Et):ve(e)?de(wt,null,e.slice()):typeof e=="object"?ti(e):de(Ka,null,String(e))}function ti(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:gi(e)}function mf(e,t){let r=0;const{shapeFlag:a}=e;if(t==null)t=null;else if(ve(t))r=16;else if(typeof t=="object")if(a&65){const i=t.default;i&&(i._c&&(i._d=!1),mf(e,i()),i._c&&(i._d=!0));return}else{r=32;const i=t._;!i&&!hp(t)?t._ctx=Pt:i===3&&Pt&&(Pt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else pe(t)?(t={default:t,_ctx:Pt},r=32):(t=String(t),a&64?(r=16,t=[Ep(t)]):r=8);e.children=t,e.shapeFlag|=r}function ni(...e){const t={};for(let r=0;r<e.length;r++){const a=e[r];for(const i in a)if(i==="class")t.class!==a.class&&(t.class=tf([t.class,a.class]));else if(i==="style")t.style=Fo([t.style,a.style]);else if($s(i)){const o=t[i],n=a[i];n&&o!==n&&!(ve(o)&&o.includes(n))&&(t[i]=o?[].concat(o,n):n)}else i!==""&&(t[i]=a[i])}return t}function dr(e,t,r,a=null){Zt(e,t,7,[r,a])}const kx=cp();let _x=0;function Sx(e,t,r){const a=e.type,i=(t?t.appContext:e.appContext)||kx,o={uid:_x++,vnode:e,type:a,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,scope:new U1(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:vp(a,i),emitsOptions:Sp(a,i),emit:null,emitted:null,propsDefaults:We,inheritAttrs:a.inheritAttrs,ctx:We,data:We,props:We,attrs:We,slots:We,refs:We,setupState:We,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=hx.bind(null,o),e.ce&&e.ce(o),o}let ft=null;const xi=()=>ft||Pt;let ys,tu;{const e=A0(),t=(r,a)=>{let i;return(i=e[r])||(i=e[r]=[]),i.push(a),o=>{i.length>1?i.forEach(n=>n(o)):i[0](o)}};ys=t("__VUE_INSTANCE_SETTERS__",r=>ft=r),tu=t("__VUE_SSR_SETTERS__",r=>Qs=r)}const an=e=>{const t=ft;return ys(e),e.scope.on(),()=>{e.scope.off(),ys(t)}},Wh=()=>{ft&&ft.scope.off(),ys(null)};function Pp(e){return e.vnode.shapeFlag&4}let Qs=!1;function Tx(e,t=!1,r=!1){t&&tu(t);const{props:a,children:i}=e.vnode,o=Pp(e);G2(e,a,o,t),Z2(e,i,r);const n=o?Ax(e,t):void 0;return t&&tu(!1),n}function Ax(e,t){const r=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,z2);const{setup:a}=r;if(a){const i=e.setupContext=a.length>1?Px(e):null,o=an(e);bi();const n=di(a,e,0,[e.props,i]);if(wi(),o(),k0(n)){if(n.then(Wh,Wh),t)return n.then(s=>{Uh(e,s,t)}).catch(s=>{Us(s,e,0)});e.asyncDep=n}else Uh(e,n,t)}else Rp(e,t)}function Uh(e,t,r){pe(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:He(t)&&(e.setupState=Y0(t)),Rp(e,r)}let Vh;function Rp(e,t,r){const a=e.type;if(!e.render){if(!t&&Vh&&!a.render){const i=a.template||vf(e).template;if(i){const{isCustomElement:o,compilerOptions:n}=e.appContext.config,{delimiters:s,compilerOptions:u}=a,c=nt(nt({isCustomElement:o,delimiters:s},n),u);a.render=Vh(i,c)}}e.render=a.render||Qt}{const i=an(e);bi();try{H2(e)}finally{wi(),i()}}}const Ex={get(e,t){return Ot(e,"get",""),e[t]}};function Px(e){const t=r=>{e.exposed=r||{}};return{attrs:new Proxy(e.attrs,Ex),slots:e.slots,emit:e.emit,expose:t}}function Js(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Y0(d2(e.exposed)),{get(t,r){if(r in t)return t[r];if(r in ko)return ko[r](e)},has(t,r){return r in t||r in ko}})):e.proxy}function Rx(e,t=!0){return pe(e)?e.displayName||e.name:e.name||t&&e.__name}function Ix(e){return pe(e)&&"__vccOpts"in e}const fe=(e,t)=>v2(e,t,Qs);function Tr(e,t,r){const a=arguments.length;return a===2?He(t)&&!ve(t)?Ma(t)?de(e,null,[t]):de(e,t):de(e,null,t):(a>3?r=Array.prototype.slice.call(arguments,2):a===3&&Ma(r)&&(r=[r]),de(e,t,r))}const Mx="3.4.35";/**
* @vue/runtime-dom v3.4.35
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/const Lx="http://www.w3.org/2000/svg",Ox="http://www.w3.org/1998/Math/MathML",Ir=typeof document<"u"?document:null,qh=Ir&&Ir.createElement("template"),Dx={insert:(e,t,r)=>{t.insertBefore(e,r||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,r,a)=>{const i=t==="svg"?Ir.createElementNS(Lx,e):t==="mathml"?Ir.createElementNS(Ox,e):r?Ir.createElement(e,{is:r}):Ir.createElement(e);return e==="select"&&a&&a.multiple!=null&&i.setAttribute("multiple",a.multiple),i},createText:e=>Ir.createTextNode(e),createComment:e=>Ir.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ir.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,r,a,i,o){const n=r?r.previousSibling:t.lastChild;if(i&&(i===o||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),r),!(i===o||!(i=i.nextSibling)););else{qh.innerHTML=a==="svg"?`<svg>${e}</svg>`:a==="mathml"?`<math>${e}</math>`:e;const s=qh.content;if(a==="svg"||a==="mathml"){const u=s.firstChild;for(;u.firstChild;)s.appendChild(u.firstChild);s.removeChild(u)}t.insertBefore(s,r)}return[n?n.nextSibling:t.firstChild,r?r.previousSibling:t.lastChild]}},Kr="transition",ao="animation",Ho=Symbol("_vtc"),bf=(e,{slots:t})=>Tr(E2,Bx(e),t);bf.displayName="Transition";const Ip={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};bf.props=nt({},rp,Ip);const Ai=(e,t=[])=>{ve(e)?e.forEach(r=>r(...t)):e&&e(...t)},Kh=e=>e?ve(e)?e.some(t=>t.length>1):e.length>1:!1;function Bx(e){const t={};for(const k in e)k in Ip||(t[k]=e[k]);if(e.css===!1)return t;const{name:r="v",type:a,duration:i,enterFromClass:o=`${r}-enter-from`,enterActiveClass:n=`${r}-enter-active`,enterToClass:s=`${r}-enter-to`,appearFromClass:u=o,appearActiveClass:c=n,appearToClass:l=s,leaveFromClass:f=`${r}-leave-from`,leaveActiveClass:h=`${r}-leave-active`,leaveToClass:d=`${r}-leave-to`}=e,v=Fx(i),y=v&&v[0],g=v&&v[1],{onBeforeEnter:m,onEnter:w,onEnterCancelled:p,onLeave:x,onLeaveCancelled:T,onBeforeAppear:A=m,onAppear:I=w,onAppearCancelled:R=p}=t,z=(k,S,P)=>{Ei(k,S?l:s),Ei(k,S?c:n),P&&P()},U=(k,S)=>{k._isLeaving=!1,Ei(k,f),Ei(k,d),Ei(k,h),S&&S()},_=k=>(S,P)=>{const B=k?I:w,D=()=>z(S,k,P);Ai(B,[S,D]),Yh(()=>{Ei(S,k?u:o),Yr(S,k?l:s),Kh(B)||Gh(S,a,y,D)})};return nt(t,{onBeforeEnter(k){Ai(m,[k]),Yr(k,o),Yr(k,n)},onBeforeAppear(k){Ai(A,[k]),Yr(k,u),Yr(k,c)},onEnter:_(!1),onAppear:_(!0),onLeave(k,S){k._isLeaving=!0;const P=()=>U(k,S);Yr(k,f),Yr(k,h),jx(),Yh(()=>{k._isLeaving&&(Ei(k,f),Yr(k,d),Kh(x)||Gh(k,a,g,P))}),Ai(x,[k,P])},onEnterCancelled(k){z(k,!1),Ai(p,[k])},onAppearCancelled(k){z(k,!0),Ai(R,[k])},onLeaveCancelled(k){U(k),Ai(T,[k])}})}function Fx(e){if(e==null)return null;if(He(e))return[Ol(e.enter),Ol(e.leave)];{const t=Ol(e);return[t,t]}}function Ol(e){return F1(e)}function Yr(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.add(r)),(e[Ho]||(e[Ho]=new Set)).add(t)}function Ei(e,t){t.split(/\s+/).forEach(a=>a&&e.classList.remove(a));const r=e[Ho];r&&(r.delete(t),r.size||(e[Ho]=void 0))}function Yh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Nx=0;function Gh(e,t,r,a){const i=e._endId=++Nx,o=()=>{i===e._endId&&a()};if(r)return setTimeout(o,r);const{type:n,timeout:s,propCount:u}=$x(e,t);if(!n)return a();const c=n+"end";let l=0;const f=()=>{e.removeEventListener(c,h),o()},h=d=>{d.target===e&&++l>=u&&f()};setTimeout(()=>{l<u&&f()},s+1),e.addEventListener(c,h)}function $x(e,t){const r=window.getComputedStyle(e),a=v=>(r[v]||"").split(", "),i=a(`${Kr}Delay`),o=a(`${Kr}Duration`),n=Xh(i,o),s=a(`${ao}Delay`),u=a(`${ao}Duration`),c=Xh(s,u);let l=null,f=0,h=0;t===Kr?n>0&&(l=Kr,f=n,h=o.length):t===ao?c>0&&(l=ao,f=c,h=u.length):(f=Math.max(n,c),l=f>0?n>c?Kr:ao:null,h=l?l===Kr?o.length:u.length:0);const d=l===Kr&&/\b(transform|all)(,|$)/.test(a(`${Kr}Property`).toString());return{type:l,timeout:f,propCount:h,hasTransform:d}}function Xh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((r,a)=>Qh(r)+Qh(e[a])))}function Qh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function jx(){return document.body.offsetHeight}function zx(e,t,r){const a=e[Ho];a&&(t=(t?[t,...a]:[...a]).join(" ")),t==null?e.removeAttribute("class"):r?e.setAttribute("class",t):e.className=t}const ps=Symbol("_vod"),Mp=Symbol("_vsh"),Lp={beforeMount(e,{value:t},{transition:r}){e[ps]=e.style.display==="none"?"":e.style.display,r&&t?r.beforeEnter(e):oo(e,t)},mounted(e,{value:t},{transition:r}){r&&t&&r.enter(e)},updated(e,{value:t,oldValue:r},{transition:a}){!t!=!r&&(a?t?(a.beforeEnter(e),oo(e,!0),a.enter(e)):a.leave(e,()=>{oo(e,!1)}):oo(e,t))},beforeUnmount(e,{value:t}){oo(e,t)}};function oo(e,t){e.style.display=t?e[ps]:"none",e[Mp]=!t}const Hx=Symbol(""),Wx=/(^|;)\s*display\s*:/;function Ux(e,t,r){const a=e.style,i=Xe(r);let o=!1;if(r&&!i){if(t)if(Xe(t))for(const n of t.split(";")){const s=n.slice(0,n.indexOf(":")).trim();r[s]==null&&es(a,s,"")}else for(const n in t)r[n]==null&&es(a,n,"");for(const n in r)n==="display"&&(o=!0),es(a,n,r[n])}else if(i){if(t!==r){const n=a[Hx];n&&(r+=";"+n),a.cssText=r,o=Wx.test(r)}}else t&&e.removeAttribute("style");ps in e&&(e[ps]=o?a.display:"",e[Mp]&&(a.display="none"))}const Jh=/\s*!important$/;function es(e,t,r){if(ve(r))r.forEach(a=>es(e,t,a));else if(r==null&&(r=""),t.startsWith("--"))e.setProperty(t,r);else{const a=Vx(e,t);Jh.test(r)?e.setProperty(ea(a),r.replace(Jh,""),"important"):e[a]=r}}const Zh=["Webkit","Moz","ms"],Dl={};function Vx(e,t){const r=Dl[t];if(r)return r;let a=lr(t);if(a!=="filter"&&a in e)return Dl[t]=a;a=Hs(a);for(let i=0;i<Zh.length;i++){const o=Zh[i]+a;if(o in e)return Dl[t]=o}return t}const ed="http://www.w3.org/1999/xlink";function td(e,t,r,a,i,o=W1(t)){a&&t.startsWith("xlink:")?r==null?e.removeAttributeNS(ed,t.slice(6,t.length)):e.setAttributeNS(ed,t,r):r==null||o&&!E0(r)?e.removeAttribute(t):e.setAttribute(t,o?"":mi(r)?String(r):r)}function qx(e,t,r,a){if(t==="innerHTML"||t==="textContent"){if(r==null)return;e[t]=r;return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const n=i==="OPTION"?e.getAttribute("value")||"":e.value,s=r==null?"":String(r);(n!==s||!("_value"in e))&&(e.value=s),r==null&&e.removeAttribute(t),e._value=r;return}let o=!1;if(r===""||r==null){const n=typeof e[t];n==="boolean"?r=E0(r):r==null&&n==="string"?(r="",o=!0):n==="number"&&(r=0,o=!0)}try{e[t]=r}catch{}o&&e.removeAttribute(t)}function da(e,t,r,a){e.addEventListener(t,r,a)}function Kx(e,t,r,a){e.removeEventListener(t,r,a)}const rd=Symbol("_vei");function Yx(e,t,r,a,i=null){const o=e[rd]||(e[rd]={}),n=o[t];if(a&&n)n.value=a;else{const[s,u]=Gx(t);if(a){const c=o[t]=Jx(a,i);da(e,s,c,u)}else n&&(Kx(e,s,n,u),o[t]=void 0)}}const id=/(?:Once|Passive|Capture)$/;function Gx(e){let t;if(id.test(e)){t={};let a;for(;a=e.match(id);)e=e.slice(0,e.length-a[0].length),t[a[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ea(e.slice(2)),t]}let Bl=0;const Xx=Promise.resolve(),Qx=()=>Bl||(Xx.then(()=>Bl=0),Bl=Date.now());function Jx(e,t){const r=a=>{if(!a._vts)a._vts=Date.now();else if(a._vts<=r.attached)return;Zt(Zx(a,r.value),t,5,[a])};return r.value=e,r.attached=Qx(),r}function Zx(e,t){if(ve(t)){const r=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{r.call(e),e._stopped=!0},t.map(a=>i=>!i._stopped&&a&&a(i))}else return t}const ad=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,eC=(e,t,r,a,i,o)=>{const n=i==="svg";t==="class"?zx(e,a,n):t==="style"?Ux(e,r,a):$s(t)?Ju(t)||Yx(e,t,r,a,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):tC(e,t,a,n))?(qx(e,t,a),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&td(e,t,a,n,o,t!=="value")):(t==="true-value"?e._trueValue=a:t==="false-value"&&(e._falseValue=a),td(e,t,a,n))};function tC(e,t,r,a){if(a)return!!(t==="innerHTML"||t==="textContent"||t in e&&ad(t)&&pe(r));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const i=e.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return ad(t)&&Xe(r)?!1:t in e}const od=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ve(t)?r=>Gn(t,r):t};function rC(e){e.target.composing=!0}function nd(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Fl=Symbol("_assign"),uK={created(e,{modifiers:{lazy:t,trim:r,number:a}},i){e[Fl]=od(i);const o=a||i.props&&i.props.type==="number";da(e,t?"change":"input",n=>{if(n.target.composing)return;let s=e.value;r&&(s=s.trim()),o&&(s=jc(s)),e[Fl](s)}),r&&da(e,"change",()=>{e.value=e.value.trim()}),t||(da(e,"compositionstart",rC),da(e,"compositionend",nd),da(e,"change",nd))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:r,modifiers:{lazy:a,trim:i,number:o}},n){if(e[Fl]=od(n),e.composing)return;const s=(o||e.type==="number")&&!/^0\d/.test(e.value)?jc(e.value):e.value,u=t??"";s!==u&&(document.activeElement===e&&e.type!=="range"&&(a&&t===r||i&&e.value.trim()===u)||(e.value=u))}},iC=["ctrl","shift","alt","meta"],aC={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>iC.some(r=>e[`${r}Key`]&&!t.includes(r))},fK=(e,t)=>{const r=e._withMods||(e._withMods={}),a=t.join(".");return r[a]||(r[a]=(i,...o)=>{for(let n=0;n<t.length;n++){const s=aC[t[n]];if(s&&s(i,t))return}return e(i,...o)})},oC=nt({patchProp:eC},Dx);let sd;function nC(){return sd||(sd=ax(oC))}const wf=(...e)=>{const t=nC().createApp(...e),{mount:r}=t;return t.mount=a=>{const i=lC(a);if(!i)return;const o=t._component;!pe(o)&&!o.render&&!o.template&&(o.template=i.innerHTML),i.innerHTML="";const n=r(i,!1,sC(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),n},t};function sC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function lC(e){return Xe(e)?document.querySelector(e):e}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function ru(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r<t;r++)a[r]=e[r];return a}function Op(e,t){if(e){if(typeof e=="string")return ru(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ru(e,t):void 0}}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function cC(e){if(Array.isArray(e))return ru(e)}function uC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function fC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iu(e){return cC(e)||uC(e)||Op(e)||fC()}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function _t(e){"@babel/helpers - typeof";return _t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(e)}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function hC(e,t){if(_t(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t||"default");if(_t(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dC(e){var t=hC(e,"string");return _t(t)=="symbol"?t:t+""}function ze(e,t,r){return(t=dC(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var ma=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function vC(e){var t=_t(e);return e!=null&&(t=="object"||t=="function")}var st=vC;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var gC=_t(ma)=="object"&&ma&&ma.Object===Object&&ma,Dp=gC,yC=Dp,pC=(typeof self>"u"?"undefined":_t(self))=="object"&&self&&self.Object===Object&&self,mC=yC||pC||Function("return this")(),ur=mC,bC=ur,wC=bC.Symbol,Ya=wC,ld=Ya,Bp=Object.prototype,xC=Bp.hasOwnProperty,CC=Bp.toString,no=ld?ld.toStringTag:void 0;function kC(e){var t=xC.call(e,no),r=e[no];try{e[no]=void 0;var a=!0}catch{}var i=CC.call(e);return a&&(t?e[no]=r:delete e[no]),i}var _C=kC,SC=Object.prototype,TC=SC.toString;function AC(e){return TC.call(e)}var EC=AC,cd=Ya,PC=_C,RC=EC,IC="[object Null]",MC="[object Undefined]",ud=cd?cd.toStringTag:void 0;function LC(e){return e==null?e===void 0?MC:IC:ud&&ud in Object(e)?PC(e):RC(e)}var Ci=LC;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var OC=Ci,DC=st,BC="[object AsyncFunction]",FC="[object Function]",NC="[object GeneratorFunction]",$C="[object Proxy]";function jC(e){if(!DC(e))return!1;var t=OC(e);return t==FC||t==NC||t==BC||t==$C}var Dt=jC;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var zC=ur,HC=zC["__core-js_shared__"],WC=HC,Nl=WC,fd=function(){var e=/[^.]+$/.exec(Nl&&Nl.keys&&Nl.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function UC(e){return!!fd&&fd in e}var VC=UC,qC=Function.prototype,KC=qC.toString;function YC(e){if(e!=null){try{return KC.call(e)}catch{}try{return e+""}catch{}}return""}var Fp=YC,GC=Dt,XC=VC,QC=st,JC=Fp,ZC=/[\\^$.*+?()[\]{}|]/g,ek=/^\[object .+?Constructor\]$/,tk=Function.prototype,rk=Object.prototype,ik=tk.toString,ak=rk.hasOwnProperty,ok=RegExp("^"+ik.call(ak).replace(ZC,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nk(e){if(!QC(e)||XC(e))return!1;var t=GC(e)?ok:ek;return t.test(JC(e))}var sk=nk;function lk(e,t){return e==null?void 0:e[t]}var ck=lk,uk=sk,fk=ck;function hk(e,t){var r=fk(e,t);return uk(r)?r:void 0}var ra=hk,dk=ra,vk=ur,gk=dk(vk,"Map"),xf=gk;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var yk=ra,pk=function(){try{var e=yk(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Np=pk;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function mk(e,t){return e===t||e!==e&&t!==t}var on=mk;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var hd=Np;function bk(e,t,r){t=="__proto__"&&hd?hd(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Zs=bk,wk=Zs,xk=on,Ck=Object.prototype,kk=Ck.hasOwnProperty;function _k(e,t,r){var a=e[t];(!(kk.call(e,t)&&xk(a,r))||r===void 0&&!(t in e))&&wk(e,t,r)}var $p=_k;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function Sk(){this.__data__=[],this.size=0}var Tk=Sk,Ak=on;function Ek(e,t){for(var r=e.length;r--;)if(Ak(e[r][0],t))return r;return-1}var el=Ek,Pk=el,Rk=Array.prototype,Ik=Rk.splice;function Mk(e){var t=this.__data__,r=Pk(t,e);if(r<0)return!1;var a=t.length-1;return r==a?t.pop():Ik.call(t,r,1),--this.size,!0}var Lk=Mk,Ok=el;function Dk(e){var t=this.__data__,r=Ok(t,e);return r<0?void 0:t[r][1]}var Bk=Dk,Fk=el;function Nk(e){return Fk(this.__data__,e)>-1}var $k=Nk,jk=el;function zk(e,t){var r=this.__data__,a=jk(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this}var Hk=zk,Wk=Tk,Uk=Lk,Vk=Bk,qk=$k,Kk=Hk;function Ga(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}Ga.prototype.clear=Wk;Ga.prototype.delete=Uk;Ga.prototype.get=Vk;Ga.prototype.has=qk;Ga.prototype.set=Kk;var tl=Ga,Yk=ra,Gk=Yk(Object,"create"),rl=Gk,dd=rl;function Xk(){this.__data__=dd?dd(null):{},this.size=0}var Qk=Xk;function Jk(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Zk=Jk,e_=rl,t_="__lodash_hash_undefined__",r_=Object.prototype,i_=r_.hasOwnProperty;function a_(e){var t=this.__data__;if(e_){var r=t[e];return r===t_?void 0:r}return i_.call(t,e)?t[e]:void 0}var o_=a_,n_=rl,s_=Object.prototype,l_=s_.hasOwnProperty;function c_(e){var t=this.__data__;return n_?t[e]!==void 0:l_.call(t,e)}var u_=c_,f_=rl,h_="__lodash_hash_undefined__";function d_(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=f_&&t===void 0?h_:t,this}var v_=d_,g_=Qk,y_=Zk,p_=o_,m_=u_,b_=v_;function Xa(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}Xa.prototype.clear=g_;Xa.prototype.delete=y_;Xa.prototype.get=p_;Xa.prototype.has=m_;Xa.prototype.set=b_;var w_=Xa,vd=w_,x_=tl,C_=xf;function k_(){this.size=0,this.__data__={hash:new vd,map:new(C_||x_),string:new vd}}var __=k_;function S_(e){var t=_t(e);return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var T_=S_,A_=T_;function E_(e,t){var r=e.__data__;return A_(t)?r[typeof t=="string"?"string":"hash"]:r.map}var il=E_,P_=il;function R_(e){var t=P_(this,e).delete(e);return this.size-=t?1:0,t}var I_=R_,M_=il;function L_(e){return M_(this,e).get(e)}var O_=L_,D_=il;function B_(e){return D_(this,e).has(e)}var F_=B_,N_=il;function $_(e,t){var r=N_(this,e),a=r.size;return r.set(e,t),this.size+=r.size==a?0:1,this}var j_=$_,z_=__,H_=I_,W_=O_,U_=F_,V_=j_;function Qa(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var a=e[t];this.set(a[0],a[1])}}Qa.prototype.clear=z_;Qa.prototype.delete=H_;Qa.prototype.get=W_;Qa.prototype.has=U_;Qa.prototype.set=V_;var Cf=Qa;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var q_=9007199254740991;function K_(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=q_}var kf=K_,Y_=Dt,G_=kf;function X_(e){return e!=null&&G_(e.length)&&!Y_(e)}var nn=X_;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function Q_(e){return e!=null&&_t(e)=="object"}var fr=Q_;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function J_(e){return function(t){return e(t)}}var _f=J_;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var yi={exports:{}};function Z_(){return!1}var eS=Z_;(function(e,t){var r=ur,a=eS,i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,n=o&&o.exports===i,s=n?r.Buffer:void 0,u=s?s.isBuffer:void 0,c=u||a;e.exports=c})(yi,yi.exports);yi.exports;var tS=Ci,rS=kf,iS=fr,aS="[object Arguments]",oS="[object Array]",nS="[object Boolean]",sS="[object Date]",lS="[object Error]",cS="[object Function]",uS="[object Map]",fS="[object Number]",hS="[object Object]",dS="[object RegExp]",vS="[object Set]",gS="[object String]",yS="[object WeakMap]",pS="[object ArrayBuffer]",mS="[object DataView]",bS="[object Float32Array]",wS="[object Float64Array]",xS="[object Int8Array]",CS="[object Int16Array]",kS="[object Int32Array]",_S="[object Uint8Array]",SS="[object Uint8ClampedArray]",TS="[object Uint16Array]",AS="[object Uint32Array]",je={};je[bS]=je[wS]=je[xS]=je[CS]=je[kS]=je[_S]=je[SS]=je[TS]=je[AS]=!0;je[aS]=je[oS]=je[pS]=je[nS]=je[mS]=je[sS]=je[lS]=je[cS]=je[uS]=je[fS]=je[hS]=je[dS]=je[vS]=je[gS]=je[yS]=!1;function ES(e){return iS(e)&&rS(e.length)&&!!je[tS(e)]}var PS=ES,La={exports:{}};(function(e,t){var r=Dp,a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,n=o&&r.process,s=function(){try{var u=i&&i.require&&i.require("util").types;return u||n&&n.binding&&n.binding("util")}catch{}}();e.exports=s})(La,La.exports);La.exports;var RS=PS,IS=_f,gd=La.exports,yd=gd&&gd.isTypedArray,MS=yd?IS(yd):RS,al=MS,LS=Object.prototype;function OS(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||LS;return e===r}var ol=OS;function DS(e,t){return function(r){return e(t(r))}}var jp=DS;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var BS=Ci,FS=fr,NS="[object Arguments]";function $S(e){return FS(e)&&BS(e)==NS}var jS=$S,pd=jS,zS=fr,zp=Object.prototype,HS=zp.hasOwnProperty,WS=zp.propertyIsEnumerable,US=pd(function(){return arguments}())?pd:function(e){return zS(e)&&HS.call(e,"callee")&&!WS.call(e,"callee")},sn=US;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var VS=Array.isArray,Bt=VS;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var qS=9007199254740991,KS=/^(?:0|[1-9]\d*)$/;function YS(e,t){var r=_t(e);return t=t??qS,!!t&&(r=="number"||r!="symbol"&&KS.test(e))&&e>-1&&e%1==0&&e<t}var Sf=YS;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function GS(e,t){for(var r=-1,a=Array(e);++r<e;)a[r]=t(r);return a}var XS=GS,QS=XS,JS=sn,ZS=Bt,eT=yi.exports,tT=Sf,rT=al,iT=Object.prototype,aT=iT.hasOwnProperty;function oT(e,t){var r=ZS(e),a=!r&&JS(e),i=!r&&!a&&eT(e),o=!r&&!a&&!i&&rT(e),n=r||a||i||o,s=n?QS(e.length,String):[],u=s.length;for(var c in e)(t||aT.call(e,c))&&!(n&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||tT(c,u)))&&s.push(c);return s}var Hp=oT,nT=tl;function sT(){this.__data__=new nT,this.size=0}var lT=sT;function cT(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var uT=cT;function fT(e){return this.__data__.get(e)}var hT=fT;function dT(e){return this.__data__.has(e)}var vT=dT,gT=tl,yT=xf,pT=Cf,mT=200;function bT(e,t){var r=this.__data__;if(r instanceof gT){var a=r.__data__;if(!yT||a.length<mT-1)return a.push([e,t]),this.size=++r.size,this;r=this.__data__=new pT(a)}return r.set(e,t),this.size=r.size,this}var wT=bT,xT=tl,CT=lT,kT=uT,_T=hT,ST=vT,TT=wT;function Ja(e){var t=this.__data__=new xT(e);this.size=t.size}Ja.prototype.clear=CT;Ja.prototype.delete=kT;Ja.prototype.get=_T;Ja.prototype.has=ST;Ja.prototype.set=TT;var nl=Ja,AT=ur,ET=AT.Uint8Array,Wp=ET,Wo={exports:{}};(function(e,t){var r=ur,a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,n=o?r.Buffer:void 0,s=n?n.allocUnsafe:void 0;function u(c,l){if(l)return c.slice();var f=c.length,h=s?s(f):new c.constructor(f);return c.copy(h),h}e.exports=u})(Wo,Wo.exports);Wo.exports;var md=Wp;function PT(e){var t=new e.constructor(e.byteLength);return new md(t).set(new md(e)),t}var Tf=PT,RT=Tf;function IT(e,t){var r=t?RT(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var Up=IT;function MT(e,t){var r=-1,a=e.length;for(t||(t=Array(a));++r<a;)t[r]=e[r];return t}var Vp=MT,LT=st,bd=Object.create,OT=function(){function e(){}return function(t){if(!LT(t))return{};if(bd)return bd(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),DT=OT,BT=jp,FT=BT(Object.getPrototypeOf,Object),Af=FT,NT=DT,$T=Af,jT=ol;function zT(e){return typeof e.constructor=="function"&&!jT(e)?NT($T(e)):{}}var qp=zT,HT=$p,WT=Zs;function UT(e,t,r,a){var i=!r;r||(r={});for(var o=-1,n=t.length;++o<n;){var s=t[o],u=a?a(r[s],e[s],s,r,e):void 0;u===void 0&&(u=e[s]),i?WT(r,s,u):HT(r,s,u)}return r}var Za=UT;function VT(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var qT=VT,KT=st,YT=ol,GT=qT,XT=Object.prototype,QT=XT.hasOwnProperty;function JT(e){if(!KT(e))return GT(e);var t=YT(e),r=[];for(var a in e)a=="constructor"&&(t||!QT.call(e,a))||r.push(a);return r}var ZT=JT,eA=Hp,tA=ZT,rA=nn;function iA(e){return rA(e)?eA(e,!0):tA(e)}var ln=iA;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function aA(e){return e}var Ef=aA;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function oA(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var nA=oA,sA=nA,wd=Math.max;function lA(e,t,r){return t=wd(t===void 0?e.length-1:t,0),function(){for(var a=arguments,i=-1,o=wd(a.length-t,0),n=Array(o);++i<o;)n[i]=a[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=a[i];return s[t]=r(n),sA(e,this,s)}}var Kp=lA;function cA(e){return function(){return e}}var uA=cA,fA=uA,xd=Np,hA=Ef,dA=xd?function(e,t){return xd(e,"toString",{configurable:!0,enumerable:!1,value:fA(t),writable:!0})}:hA,vA=dA,gA=800,yA=16,pA=Date.now;function mA(e){var t=0,r=0;return function(){var a=pA(),i=yA-(a-r);if(r=a,i>0){if(++t>=gA)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var bA=mA,wA=vA,xA=bA,CA=xA(wA),Yp=CA;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var kA=nn,_A=fr;function SA(e){return _A(e)&&kA(e)}var TA=SA,AA=Ef,EA=Kp,PA=Yp;function RA(e,t){return PA(EA(e,t,AA),e+"")}var IA=RA;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var MA=Ci,LA=Af,OA=fr,DA="[object Object]",BA=Function.prototype,FA=Object.prototype,Gp=BA.toString,NA=FA.hasOwnProperty,$A=Gp.call(Object);function jA(e){if(!OA(e)||MA(e)!=DA)return!1;var t=LA(e);if(t===null)return!0;var r=NA.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Gp.call(r)==$A}var Xp=jA;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var zA=on,HA=nn,WA=Sf,UA=st;function VA(e,t,r){if(!UA(r))return!1;var a=_t(t);return(a=="number"?HA(r)&&WA(t,r.length):a=="string"&&t in r)?zA(r[t],e):!1}var qA=VA;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var KA={classPrefix:"t",animation:{include:["ripple","expand","fade"],exclude:[]},calendar:{firstDayOfWeek:1,fillWithZero:!0,controllerConfig:void 0},icon:{},input:{autocomplete:""},dialog:{closeOnEscKeydown:!0,closeOnOverlayClick:!0,confirmBtnTheme:{default:"primary",info:"primary",warning:"primary",danger:"primary",success:"primary"}},message:{},popconfirm:{confirmBtnTheme:{default:"primary",warning:"primary",danger:"primary"}},table:{expandIcon:void 0,sortIcon:void 0,filterIcon:void 0,treeExpandAndFoldIcon:void 0,hideSortTips:!1,size:"medium"},select:{clearIcon:void 0,filterable:!1},drawer:{closeOnEscKeydown:!0,closeOnOverlayClick:!0,size:"small"},tree:{folderIcon:void 0},datePicker:{firstDayOfWeek:1},steps:{checkIcon:void 0,errorIcon:void 0},tag:{closeIcon:void 0},form:{requiredMark:void 0}};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var YA={pagination:{itemsPerPage:"{size} 条/页",jumpTo:"跳至",page:"页",total:"共 {total} 条数据"},cascader:{empty:"暂无数据",loadingText:"加载中",placeholder:"请选择"},calendar:{yearSelection:"{year} 年",monthSelection:"{month} 月",yearRadio:"年",monthRadio:"月",hideWeekend:"隐藏周末",showWeekend:"显示周末",today:"今天",thisMonth:"本月",week:"一,二,三,四,五,六,日",cellMonth:"1 月,2 月,3 月,4 月,5 月,6 月,7 月,8 月,9 月,10 月,11 月,12 月"},transfer:{title:"{checked} / {total} 项",empty:"暂无数据",placeholder:"请输入关键词搜索"},timePicker:{dayjsLocale:"zh-cn",now:"此刻",confirm:"确定",anteMeridiem:"上午",postMeridiem:"下午",placeholder:"选择时间"},dialog:{confirm:"确认",cancel:"取消"},drawer:{confirm:"确认",cancel:"取消"},popconfirm:{confirm:{content:"确定"},cancel:{content:"取消"}},table:{empty:"暂无数据",loadingText:"正在加载中，请稍后",loadingMoreText:"点击加载更多",filterInputPlaceholder:"请输入内容（无默认值）",sortAscendingOperationText:"点击升序",sortCancelOperationText:"点击取消排序",sortDescendingOperationText:"点击降序",clearFilterResultButtonText:"清空筛选",columnConfigButtonText:"列配置",columnConfigTitleText:"表格列配置",columnConfigDescriptionText:"请选择需要在表格中显示的数据列",confirmText:"确认",cancelText:"取消",resetText:"重置",selectAllText:"全选",searchResultText:"搜索“{result}”，找到 {count} 条结果"},select:{empty:"暂无数据",loadingText:"加载中",placeholder:"请选择"},tree:{empty:"暂无数据"},treeSelect:{empty:"暂无数据",loadingText:"加载中",placeholder:"请选择"},datePicker:{dayjsLocale:"zh-cn",placeholder:{date:"请选择日期",month:"请选择月份",year:"请选择年份",quarter:"请选择季度",week:"请选择周"},weekdays:["一","二","三","四","五","六","日"],months:["1 月","2 月","3 月","4 月","5 月","6 月","7 月","8 月","9 月","10 月","11 月","12 月"],quarters:["一季度","二季度","三季度","四季度"],rangeSeparator:" - ",direction:"ltr",format:"YYYY-MM-DD",dayAriaLabel:"日",weekAbbreviation:"周",yearAriaLabel:"年",monthAriaLabel:"月",confirm:"确定",selectTime:"选择时间",selectDate:"选择日期",nextYear:"下一年",preYear:"上一年",nextMonth:"下个月",preMonth:"上个月",preDecade:"上个十年",nextDecade:"下个十年",now:"当前"},upload:{sizeLimitMessage:"文件大小不能超过 {sizeLimit}",cancelUploadText:"取消上传",triggerUploadText:{fileInput:"选择文件",image:"点击上传图片",normal:"点击上传",reupload:"重新选择",continueUpload:"继续选择",delete:"删除",uploading:"上传中"},dragger:{dragDropText:"释放鼠标",draggingText:"拖拽到此区域",clickAndDragText:"点击上方“选择文件”或将文件拖拽到此区域"},file:{fileNameText:"文件名",fileSizeText:"文件大小",fileStatusText:"状态",fileOperationText:"操作",fileOperationDateText:"上传日期"},progress:{uploadingText:"上传中",waitingText:"待上传",failText:"上传失败",successText:"上传成功"}},form:{errorMessage:{date:"请输入正确的${name}",url:"请输入正确的${name}",required:"${name}必填",max:"${name}字符长度不能超过 ${validate} 个字符，一个中文等于两个字符",min:"${name}字符长度不能少于 ${validate} 个字符，一个中文等于两个字符",len:"${name}字符长度必须是 ${validate}",enum:"${name}只能是${validate}等",idcard:"请输入正确的${name}",telnumber:"请输入正确的${name}",pattern:"请输入正确的${name}",validator:"${name}不符合要求",boolean:"${name}数据类型必须是布尔类型",number:"${name}必须是数字"}},input:{placeholder:"请输入"},list:{loadingText:"正在加载中，请稍等",loadingMoreText:"点击加载更多"},alert:{expandText:"展开更多",collapseText:"收起"},anchor:{copySuccessText:"链接复制成功",copyText:"复制链接"},colorPicker:{swatchColorTitle:"系统预设颜色",recentColorTitle:"最近使用颜色",clearConfirmText:"确定清空最近使用的颜色吗？"},guide:{finishButtonProps:{content:"完成",theme:"primary"},nextButtonProps:{content:"下一步",theme:"primary"},skipButtonProps:{content:"跳过",theme:"default"},prevButtonProps:{content:"上一步",theme:"default"}},image:{errorText:"图片无法显示",loadingText:"图片加载中"},imageViewer:{errorText:"图片加载失败，可尝试重新加载",mirrorTipText:"镜像",rotateTipText:"旋转",originalSizeTipText:"原始大小"},typography:{expandText:"展开",collapseText:"收起",copiedText:"复制成功"}};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function GA(e){return function(t,r,a){for(var i=-1,o=Object(t),n=a(t),s=n.length;s--;){var u=n[e?s:++i];if(r(o[u],u,o)===!1)break}return t}}var XA=GA,QA=XA,JA=QA(),Qp=JA,ZA=Zs,eE=on;function tE(e,t,r){(r!==void 0&&!eE(e[t],r)||r===void 0&&!(t in e))&&ZA(e,t,r)}var Jp=tE;function rE(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Zp=rE,iE=Za,aE=ln;function oE(e){return iE(e,aE(e))}var nE=oE,Cd=Jp,sE=Wo.exports,lE=Up,cE=Vp,uE=qp,kd=sn,_d=Bt,fE=TA,hE=yi.exports,dE=Dt,vE=st,gE=Xp,yE=al,Sd=Zp,pE=nE;function mE(e,t,r,a,i,o,n){var s=Sd(e,r),u=Sd(t,r),c=n.get(u);if(c){Cd(e,r,c);return}var l=o?o(s,u,r+"",e,t,n):void 0,f=l===void 0;if(f){var h=_d(u),d=!h&&hE(u),v=!h&&!d&&yE(u);l=u,h||d||v?_d(s)?l=s:fE(s)?l=cE(s):d?(f=!1,l=sE(u,!0)):v?(f=!1,l=lE(u,!0)):l=[]:gE(u)||kd(u)?(l=s,kd(s)?l=pE(s):(!vE(s)||dE(s))&&(l=uE(u))):f=!1}f&&(n.set(u,l),i(l,u,a,o,n),n.delete(u)),Cd(e,r,l)}var bE=mE,wE=nl,xE=Jp,CE=Qp,kE=bE,_E=st,SE=ln,TE=Zp;function em(e,t,r,a,i){e!==t&&CE(t,function(o,n){if(i||(i=new wE),_E(o))kE(e,t,n,r,em,a,i);else{var s=a?a(TE(e,n),o,n+"",e,t,i):void 0;s===void 0&&(s=o),xE(e,n,s)}},SE)}var tm=em,AE=IA,EE=qA;function PE(e){return AE(function(t,r){var a=-1,i=r.length,o=i>1?r[i-1]:void 0,n=i>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,n&&EE(r[0],r[1],n)&&(o=i<3?void 0:o,i=1),t=Object(t);++a<i;){var s=r[a];s&&e(t,s,a,o)}return t})}var rm=PE,RE=tm,IE=rm,ME=IE(function(e,t,r){RE(e,t,r)}),im=ME,LE=tm,OE=rm;OE(function(e,t,r,a){LE(e,t,r,a)});var sl=function(e){return e.ripple="ripple",e.expand="expand",e.fade="fade",e}(sl||{}),DE=im(KA,YA),BE=Symbol("configProvide");/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var FE=ra,NE=ur,$E=FE(NE,"Set"),jE=$E;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var zE=jp,HE=zE(Object.keys,Object),WE=HE,UE=ol,VE=WE,qE=Object.prototype,KE=qE.hasOwnProperty;function YE(e){if(!UE(e))return VE(e);var t=[];for(var r in Object(e))KE.call(e,r)&&r!="constructor"&&t.push(r);return t}var am=YE,GE=ra,XE=ur,QE=GE(XE,"DataView"),JE=QE,ZE=ra,eP=ur,tP=ZE(eP,"Promise"),rP=tP,iP=ra,aP=ur,oP=iP(aP,"WeakMap"),nP=oP,au=JE,ou=xf,nu=rP,su=jE,lu=nP,om=Ci,eo=Fp,Td="[object Map]",sP="[object Object]",Ad="[object Promise]",Ed="[object Set]",Pd="[object WeakMap]",Rd="[object DataView]",lP=eo(au),cP=eo(ou),uP=eo(nu),fP=eo(su),hP=eo(lu),Ii=om;(au&&Ii(new au(new ArrayBuffer(1)))!=Rd||ou&&Ii(new ou)!=Td||nu&&Ii(nu.resolve())!=Ad||su&&Ii(new su)!=Ed||lu&&Ii(new lu)!=Pd)&&(Ii=function(t){var r=om(t),a=r==sP?t.constructor:void 0,i=a?eo(a):"";if(i)switch(i){case lP:return Rd;case cP:return Td;case uP:return Ad;case fP:return Ed;case hP:return Pd}return r});var cn=Ii;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function dP(e,t){for(var r=-1,a=t.length,i=e.length;++r<a;)e[i+r]=t[r];return e}var Pf=dP;function vP(e,t){for(var r=-1,a=e==null?0:e.length,i=0,o=[];++r<a;){var n=e[r];t(n,r,e)&&(o[i++]=n)}return o}var gP=vP;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var yP=Hp,pP=am,mP=nn;function bP(e){return mP(e)?yP(e):pP(e)}var un=bP,wP=Pf,xP=Bt;function CP(e,t,r){var a=t(e);return xP(e)?a:wP(a,r(e))}var nm=CP;function kP(){return[]}var sm=kP,_P=gP,SP=sm,TP=Object.prototype,AP=TP.propertyIsEnumerable,Id=Object.getOwnPropertySymbols,EP=Id?function(e){return e==null?[]:(e=Object(e),_P(Id(e),function(t){return AP.call(e,t)}))}:SP,Rf=EP,PP=nm,RP=Rf,IP=un;function MP(e){return PP(e,IP,RP)}var lm=MP;function LP(e,t){for(var r=-1,a=e==null?0:e.length;++r<a&&t(e[r],r,e)!==!1;);return e}var OP=LP,DP=Za,BP=un;function FP(e,t){return e&&DP(t,BP(t),e)}var NP=FP,$P=Za,jP=ln;function zP(e,t){return e&&$P(t,jP(t),e)}var HP=zP,WP=Za,UP=Rf;function VP(e,t){return WP(e,UP(e),t)}var qP=VP,KP=Pf,YP=Af,GP=Rf,XP=sm,QP=Object.getOwnPropertySymbols,JP=QP?function(e){for(var t=[];e;)KP(t,GP(e)),e=YP(e);return t}:XP,cm=JP,ZP=Za,eR=cm;function tR(e,t){return ZP(e,eR(e),t)}var rR=tR,iR=nm,aR=cm,oR=ln;function nR(e){return iR(e,oR,aR)}var um=nR,sR=Object.prototype,lR=sR.hasOwnProperty;function cR(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&lR.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var uR=cR,fR=Tf;function hR(e,t){var r=t?fR(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var dR=hR,vR=/\w*$/;function gR(e){var t=new e.constructor(e.source,vR.exec(e));return t.lastIndex=e.lastIndex,t}var yR=gR,Md=Ya,Ld=Md?Md.prototype:void 0,Od=Ld?Ld.valueOf:void 0;function pR(e){return Od?Object(Od.call(e)):{}}var mR=pR,bR=Tf,wR=dR,xR=yR,CR=mR,kR=Up,_R="[object Boolean]",SR="[object Date]",TR="[object Map]",AR="[object Number]",ER="[object RegExp]",PR="[object Set]",RR="[object String]",IR="[object Symbol]",MR="[object ArrayBuffer]",LR="[object DataView]",OR="[object Float32Array]",DR="[object Float64Array]",BR="[object Int8Array]",FR="[object Int16Array]",NR="[object Int32Array]",$R="[object Uint8Array]",jR="[object Uint8ClampedArray]",zR="[object Uint16Array]",HR="[object Uint32Array]";function WR(e,t,r){var a=e.constructor;switch(t){case MR:return bR(e);case _R:case SR:return new a(+e);case LR:return wR(e,r);case OR:case DR:case BR:case FR:case NR:case $R:case jR:case zR:case HR:return kR(e,r);case TR:return new a;case AR:case RR:return new a(e);case ER:return xR(e);case PR:return new a;case IR:return CR(e)}}var UR=WR,VR=cn,qR=fr,KR="[object Map]";function YR(e){return qR(e)&&VR(e)==KR}var GR=YR,XR=GR,QR=_f,Dd=La.exports,Bd=Dd&&Dd.isMap,JR=Bd?QR(Bd):XR,ZR=JR,e5=cn,t5=fr,r5="[object Set]";function i5(e){return t5(e)&&e5(e)==r5}var a5=i5,o5=a5,n5=_f,Fd=La.exports,Nd=Fd&&Fd.isSet,s5=Nd?n5(Nd):o5,l5=s5,c5=nl,u5=OP,f5=$p,h5=NP,d5=HP,v5=Wo.exports,g5=Vp,y5=qP,p5=rR,m5=lm,b5=um,w5=cn,x5=uR,C5=UR,k5=qp,_5=Bt,S5=yi.exports,T5=ZR,A5=st,E5=l5,P5=un,R5=ln,I5=1,M5=2,L5=4,fm="[object Arguments]",O5="[object Array]",D5="[object Boolean]",B5="[object Date]",F5="[object Error]",hm="[object Function]",N5="[object GeneratorFunction]",$5="[object Map]",j5="[object Number]",dm="[object Object]",z5="[object RegExp]",H5="[object Set]",W5="[object String]",U5="[object Symbol]",V5="[object WeakMap]",q5="[object ArrayBuffer]",K5="[object DataView]",Y5="[object Float32Array]",G5="[object Float64Array]",X5="[object Int8Array]",Q5="[object Int16Array]",J5="[object Int32Array]",Z5="[object Uint8Array]",e4="[object Uint8ClampedArray]",t4="[object Uint16Array]",r4="[object Uint32Array]",$e={};$e[fm]=$e[O5]=$e[q5]=$e[K5]=$e[D5]=$e[B5]=$e[Y5]=$e[G5]=$e[X5]=$e[Q5]=$e[J5]=$e[$5]=$e[j5]=$e[dm]=$e[z5]=$e[H5]=$e[W5]=$e[U5]=$e[Z5]=$e[e4]=$e[t4]=$e[r4]=!0;$e[F5]=$e[hm]=$e[V5]=!1;function ts(e,t,r,a,i,o){var n,s=t&I5,u=t&M5,c=t&L5;if(r&&(n=i?r(e,a,i,o):r(e)),n!==void 0)return n;if(!A5(e))return e;var l=_5(e);if(l){if(n=x5(e),!s)return g5(e,n)}else{var f=w5(e),h=f==hm||f==N5;if(S5(e))return v5(e,s);if(f==dm||f==fm||h&&!i){if(n=u||h?{}:k5(e),!s)return u?p5(e,d5(n,e)):y5(e,h5(n,e))}else{if(!$e[f])return i?e:{};n=C5(e,f,s)}}o||(o=new c5);var d=o.get(e);if(d)return d;o.set(e,n),E5(e)?e.forEach(function(g){n.add(ts(g,t,r,g,e,o))}):T5(e)&&e.forEach(function(g,m){n.set(m,ts(g,t,r,m,e,o))});var v=c?u?b5:m5:u?R5:P5,y=l?void 0:v(e);return u5(y||e,function(g,m){y&&(m=g,g=e[m]),f5(n,m,ts(g,t,r,m,e,o))}),n}var i4=ts;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var a4="__lodash_hash_undefined__";function o4(e){return this.__data__.set(e,a4),this}var n4=o4;function s4(e){return this.__data__.has(e)}var l4=s4,c4=Cf,u4=n4,f4=l4;function ms(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new c4;++t<r;)this.add(e[t])}ms.prototype.add=ms.prototype.push=u4;ms.prototype.has=f4;var h4=ms;function d4(e,t){return e.has(t)}var v4=d4;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function g4(e){var t=-1,r=Array(e.size);return e.forEach(function(a){r[++t]=a}),r}var y4=g4;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function p4(e,t){for(var r=-1,a=e==null?0:e.length;++r<a;)if(t(e[r],r,e))return!0;return!1}var m4=p4,b4=h4,w4=m4,x4=v4,C4=1,k4=2;function _4(e,t,r,a,i,o){var n=r&C4,s=e.length,u=t.length;if(s!=u&&!(n&&u>s))return!1;var c=o.get(e),l=o.get(t);if(c&&l)return c==t&&l==e;var f=-1,h=!0,d=r&k4?new b4:void 0;for(o.set(e,t),o.set(t,e);++f<s;){var v=e[f],y=t[f];if(a)var g=n?a(y,v,f,t,e,o):a(v,y,f,e,t,o);if(g!==void 0){if(g)continue;h=!1;break}if(d){if(!w4(t,function(m,w){if(!x4(d,w)&&(v===m||i(v,m,r,a,o)))return d.push(w)})){h=!1;break}}else if(!(v===y||i(v,y,r,a,o))){h=!1;break}}return o.delete(e),o.delete(t),h}var vm=_4;function S4(e){var t=-1,r=Array(e.size);return e.forEach(function(a,i){r[++t]=[i,a]}),r}var T4=S4,$d=Ya,jd=Wp,A4=on,E4=vm,P4=T4,R4=y4,I4=1,M4=2,L4="[object Boolean]",O4="[object Date]",D4="[object Error]",B4="[object Map]",F4="[object Number]",N4="[object RegExp]",$4="[object Set]",j4="[object String]",z4="[object Symbol]",H4="[object ArrayBuffer]",W4="[object DataView]",zd=$d?$d.prototype:void 0,$l=zd?zd.valueOf:void 0;function U4(e,t,r,a,i,o,n){switch(r){case W4:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case H4:return!(e.byteLength!=t.byteLength||!o(new jd(e),new jd(t)));case L4:case O4:case F4:return A4(+e,+t);case D4:return e.name==t.name&&e.message==t.message;case N4:case j4:return e==t+"";case B4:var s=P4;case $4:var u=a&I4;if(s||(s=R4),e.size!=t.size&&!u)return!1;var c=n.get(e);if(c)return c==t;a|=M4,n.set(e,t);var l=E4(s(e),s(t),a,i,o,n);return n.delete(e),l;case z4:if($l)return $l.call(e)==$l.call(t)}return!1}var V4=U4,Hd=lm,q4=1,K4=Object.prototype,Y4=K4.hasOwnProperty;function G4(e,t,r,a,i,o){var n=r&q4,s=Hd(e),u=s.length,c=Hd(t),l=c.length;if(u!=l&&!n)return!1;for(var f=u;f--;){var h=s[f];if(!(n?h in t:Y4.call(t,h)))return!1}var d=o.get(e),v=o.get(t);if(d&&v)return d==t&&v==e;var y=!0;o.set(e,t),o.set(t,e);for(var g=n;++f<u;){h=s[f];var m=e[h],w=t[h];if(a)var p=n?a(w,m,h,t,e,o):a(m,w,h,e,t,o);if(!(p===void 0?m===w||i(m,w,r,a,o):p)){y=!1;break}g||(g=h=="constructor")}if(y&&!g){var x=e.constructor,T=t.constructor;x!=T&&"constructor"in e&&"constructor"in t&&!(typeof x=="function"&&x instanceof x&&typeof T=="function"&&T instanceof T)&&(y=!1)}return o.delete(e),o.delete(t),y}var X4=G4,jl=nl,Q4=vm,J4=V4,Z4=X4,Wd=cn,Ud=Bt,Vd=yi.exports,e6=al,t6=1,qd="[object Arguments]",Kd="[object Array]",Rn="[object Object]",r6=Object.prototype,Yd=r6.hasOwnProperty;function i6(e,t,r,a,i,o){var n=Ud(e),s=Ud(t),u=n?Kd:Wd(e),c=s?Kd:Wd(t);u=u==qd?Rn:u,c=c==qd?Rn:c;var l=u==Rn,f=c==Rn,h=u==c;if(h&&Vd(e)){if(!Vd(t))return!1;n=!0,l=!1}if(h&&!l)return o||(o=new jl),n||e6(e)?Q4(e,t,r,a,i,o):J4(e,t,u,r,a,i,o);if(!(r&t6)){var d=l&&Yd.call(e,"__wrapped__"),v=f&&Yd.call(t,"__wrapped__");if(d||v){var y=d?e.value():e,g=v?t.value():t;return o||(o=new jl),i(y,g,r,a,o)}}return h?(o||(o=new jl),Z4(e,t,r,a,i,o)):!1}var a6=i6,o6=a6,Gd=fr;function gm(e,t,r,a,i){return e===t?!0:e==null||t==null||!Gd(e)&&!Gd(t)?e!==e&&t!==t:o6(e,t,r,a,gm,i)}var If=gm,n6=If;function s6(e,t){return n6(e,t)}var l6=s6;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var c6=Ci,u6=fr,f6="[object Symbol]";function h6(e){return _t(e)=="symbol"||u6(e)&&c6(e)==f6}var ll=h6;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function d6(e,t){for(var r=-1,a=e==null?0:e.length,i=Array(a);++r<a;)i[r]=t(e[r],r,e);return i}var ym=d6,Xd=Ya,v6=ym,g6=Bt,y6=ll,p6=1/0,Qd=Xd?Xd.prototype:void 0,Jd=Qd?Qd.toString:void 0;function pm(e){if(typeof e=="string")return e;if(g6(e))return v6(e,pm)+"";if(y6(e))return Jd?Jd.call(e):"";var t=e+"";return t=="0"&&1/e==-p6?"-0":t}var m6=pm,b6=m6;function w6(e){return e==null?"":b6(e)}var fn=w6;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var x6=Bt,C6=ll,k6=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_6=/^\w*$/;function S6(e,t){if(x6(e))return!1;var r=_t(e);return r=="number"||r=="symbol"||r=="boolean"||e==null||C6(e)?!0:_6.test(e)||!k6.test(e)||t!=null&&e in Object(t)}var Mf=S6,mm=Cf,T6="Expected a function";function Lf(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(T6);var r=function a(){var i=arguments,o=t?t.apply(this,i):i[0],n=a.cache;if(n.has(o))return n.get(o);var s=e.apply(this,i);return a.cache=n.set(o,s)||n,s};return r.cache=new(Lf.Cache||mm),r}Lf.Cache=mm;var A6=Lf,E6=A6,P6=500;function R6(e){var t=E6(e,function(a){return r.size===P6&&r.clear(),a}),r=t.cache;return t}var I6=R6,M6=I6,L6=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,O6=/\\(\\)?/g,D6=M6(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(L6,function(r,a,i,o){t.push(i?o.replace(O6,"$1"):a||r)}),t}),B6=D6,F6=Bt,N6=Mf,$6=B6,j6=fn;function z6(e,t){return F6(e)?e:N6(e,t)?[e]:$6(j6(e))}var cl=z6,H6=ll,W6=1/0;function U6(e){if(typeof e=="string"||H6(e))return e;var t=e+"";return t=="0"&&1/e==-W6?"-0":t}var hn=U6,V6=cl,q6=hn;function K6(e,t){t=V6(t,e);for(var r=0,a=t.length;e!=null&&r<a;)e=e[q6(t[r++])];return r&&r==a?e:void 0}var Of=K6;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var Y6=Of;function G6(e,t,r){var a=e==null?void 0:Y6(e,t);return a===void 0?r:a}var X6=G6;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function Q6(e,t){return e!=null&&t in Object(e)}var J6=Q6,Z6=cl,eI=sn,tI=Bt,rI=Sf,iI=kf,aI=hn;function oI(e,t,r){t=Z6(t,e);for(var a=-1,i=t.length,o=!1;++a<i;){var n=aI(t[a]);if(!(o=e!=null&&r(e,n)))break;e=e[n]}return o||++a!=i?o:(i=e==null?0:e.length,!!i&&iI(i)&&rI(n,i)&&(tI(e)||eI(e)))}var nI=oI,sI=J6,lI=nI;function cI(e,t){return e!=null&&lI(e,t,sI)}var uI=cI;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function fI(e){return function(t){return t==null?void 0:t[e]}}var hI=fI;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function dI(e){if(Array.isArray(e))return e}function vI(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var a,i,o,n,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(a=o.call(r)).done)&&(s.push(a.value),s.length!==t);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&r.return!=null&&(n=r.return(),Object(n)!==n))return}finally{if(c)throw i}}return s}}function gI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ul(e,t){return dI(e)||vI(e,t)||Op(e,t)||gI()}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function bs(e,t){var r=Object.keys(t);r.forEach(function(a){e.style[a]=t[a]})}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var yI=Ci,pI=Bt,mI=fr,bI="[object String]";function wI(e){return typeof e=="string"||!pI(e)&&mI(e)&&yI(e)==bI}var dn=wI;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function xI(){if(typeof navigator>"u"||!navigator)return Number.MAX_SAFE_INTEGER;var e=navigator,t=e.userAgent,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1,a=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1;if(r){var i=new RegExp("MSIE (\\d+\\.\\d+);"),o=t.match(i);if(!o)return-1;var n=parseFloat(o[1]);return n<7?6:n}return a?11:Number.MAX_SAFE_INTEGER}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function Zd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function In(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zd(Object(r),!0).forEach(function(a){ze(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zd(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function CI(e){var t,r,a,i={};if(!(!e||typeof window>"u")){var o=(t=window)===null||t===void 0||(r=t.getComputedStyle)===null||r===void 0?void 0:r.call(t,e),n=o.color,s=o.fontSize,u=(a=window)===null||a===void 0||(a=a.navigator)===null||a===void 0?void 0:a.userAgent,c=/Safari/.test(u)&&!/Chrome/.test(u),l=/(?=.*iPhone)[?=.*MicroMessenger]/.test(u)&&!/Chrome/.test(u);if((c||l)&&(i={transformOrigin:"0px 0px",transform:"scale(".concat(parseInt(s,10)/12,")")}),n&&xI()>11){var f=n.match(/[\d.]+/g),h=f?"rgba(".concat(f[0],", ").concat(f[1],", ").concat(f[2],", 0)"):"";bs(e,In(In({},i),{},{background:"conic-gradient(from 90deg at 50% 50%,".concat(h," 0deg, ").concat(n," 360deg)")}))}else bs(e,In(In({},i),{},{background:""}))}}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var kI=Ie();function fl(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0,r=xi()?Ct(BE,null):kI,a=fe(function(){return(r==null?void 0:r.value)||DE}),i=fe(function(){return Object.assign({},a.value[e],t)}),o=fe(function(){return a.value.classPrefix}),n=function(u){for(var c=arguments.length,l=new Array(c>1?c-1:0),f=1;f<c;f++)l[f-1]=arguments[f];var h=l[0];if(dn(u)){if(!h)return u;var d=/\{\s*([\w-]+)\s*\}/g,v=u.replace(d,function(y,g){return h?String(h[g]):""});return v}return Dt(u)?l.length?u.apply(void 0,l):u(Tr):""};return{t:n,global:i,globalConfig:i,classPrefix:o}}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function tt(e){var t=fl("classPrefix"),r=t.classPrefix;return fe(function(){return e?"".concat(r.value,"-").concat(e):r.value})}function Df(){var e=fl("classPrefix"),t=e.classPrefix;return{SIZE:fe(function(){return{small:"".concat(t.value,"-size-s"),medium:"".concat(t.value,"-size-m"),large:"".concat(t.value,"-size-l"),default:"",xs:"".concat(t.value,"-size-xs"),xl:"".concat(t.value,"-size-xl"),block:"".concat(t.value,"-size-full-width")}}),STATUS:fe(function(){return{loading:"".concat(t.value,"-is-loading"),loadMore:"".concat(t.value,"-is-load-more"),disabled:"".concat(t.value,"-is-disabled"),focused:"".concat(t.value,"-is-focused"),success:"".concat(t.value,"-is-success"),error:"".concat(t.value,"-is-error"),warning:"".concat(t.value,"-is-warning"),selected:"".concat(t.value,"-is-selected"),active:"".concat(t.value,"-is-active"),checked:"".concat(t.value,"-is-checked"),current:"".concat(t.value,"-is-current"),hidden:"".concat(t.value,"-is-hidden"),visible:"".concat(t.value,"-is-visible"),expanded:"".concat(t.value,"-is-expanded"),indeterminate:"".concat(t.value,"-is-indeterminate")}})}}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var _I=Ge({name:"TLoadingGradient",setup:function(){var t=tt();return ir(function(){var r=xi().refs.circle;tn(function(){CI(r)})}),{classPrefix:t}},render:function(){var t=this.classPrefix,r="".concat(t,"-loading__gradient"),a=[r,"".concat(t,"-icon-loading")];return de("svg",{class:a,viewBox:"0 0 12 12",version:"1.1",width:"1em",height:"1em",xmlns:"http://www.w3.org/2000/svg"},[de("foreignObject",{x:"0",y:"0",width:"12",height:"12"},[de("div",{class:"".concat(r,"-conic"),ref:"circle"},null)])])}});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var Bf={exports:{}},mo={exports:{}};(function(){var e,t,r,a,i,o;typeof performance<"u"&&performance!==null&&performance.now?mo.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(mo.exports=function(){return(e()-i)/1e6},t=process.hrtime,e=function(){var s;return s=t(),s[0]*1e9+s[1]},a=e(),o=process.uptime()*1e9,i=a-o):Date.now?(mo.exports=function(){return Date.now()-r},r=Date.now()):(mo.exports=function(){return new Date().getTime()-r},r=new Date().getTime())}).call(ma);var SI=mo.exports,$r=typeof window>"u"?ma:window,Mn=["moz","webkit"],Aa="AnimationFrame",Oa=$r["request"+Aa],Uo=$r["cancel"+Aa]||$r["cancelRequest"+Aa];for(var so=0;!Oa&&so<Mn.length;so++)Oa=$r[Mn[so]+"Request"+Aa],Uo=$r[Mn[so]+"Cancel"+Aa]||$r[Mn[so]+"CancelRequest"+Aa];if(!Oa||!Uo){var zl=0,ev=0,Pi=[],TI=1e3/60;Oa=function(t){if(Pi.length===0){var r=SI(),a=Math.max(0,TI-(r-zl));zl=a+r,setTimeout(function(){var i=Pi.slice(0);Pi.length=0;for(var o=function(){if(!i[n].cancelled)try{i[n].callback(zl)}catch(u){setTimeout(function(){throw u},0)}},n=0;n<i.length;n++)o()},Math.round(a))}return Pi.push({handle:++ev,callback:t,cancelled:!1}),ev},Uo=function(t){for(var r=0;r<Pi.length;r++)Pi[r].handle===t&&(Pi[r].cancelled=!0)}}Bf.exports=function(e){return Oa.call($r,e)};Bf.exports.cancel=function(){Uo.apply($r,arguments)};Bf.exports.polyfill=function(e){e||(e=$r),e.requestAnimationFrame=Oa,e.cancelAnimationFrame=Uo};var Ff=typeof window>"u",AI=function(t){return(t||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")},Nf=function(){return!Ff&&document.addEventListener?function(e,t,r,a){e&&t&&r&&e.addEventListener(t,r,a)}:function(e,t,r){e&&t&&r&&e.attachEvent("on".concat(t),r)}}(),ws=function(){return!Ff&&document.removeEventListener?function(e,t,r,a){e&&t&&e.removeEventListener(t,r,a)}:function(e,t,r){e&&t&&e.detachEvent("on".concat(t),r)}}();function EI(e,t,r,a){var i=Dt(r)?r:r.handleEvent,o=function n(s){i(s),ws(e,t,n,a)};Nf(e,t,o,a)}function bm(e,t){if(!e||!t)return!1;if(t.indexOf(" ")!==-1)throw new Error("className should not contain space.");return e.classList?e.classList.contains(t):" ".concat(e.className," ").indexOf(" ".concat(t," "))>-1}function cu(e,t){if(e){for(var r=e.className,a=(t||"").split(" "),i=0,o=a.length;i<o;i++){var n=a[i];n&&(e.classList?e.classList.add(n):bm(e,n)||(r+=" ".concat(n)))}e.classList||(e.className=r)}}function uu(e,t){if(!(!e||!t)){for(var r=t.split(" "),a=" ".concat(e.className," "),i=0,o=r.length;i<o;i++){var n=r[i];n&&(e.classList?e.classList.remove(n):bm(e,n)&&(a=a.replace(" ".concat(n," ")," ")))}e.classList||(e.className=AI(a))}}var hl=function(t,r){var a=Dt(t)?t(r):t;return a?dn(a)?document.querySelector(a):a instanceof HTMLElement?a:document.body:document.body},wm=function(){};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var PI=am,RI=cn,II=sn,MI=Bt,LI=nn,OI=yi.exports,DI=ol,BI=al,FI="[object Map]",NI="[object Set]",$I=Object.prototype,jI=$I.hasOwnProperty;function zI(e){if(e==null)return!0;if(LI(e)&&(MI(e)||typeof e=="string"||typeof e.splice=="function"||OI(e)||BI(e)||II(e)))return!e.length;var t=RI(e);if(t==FI||t==NI)return!e.size;if(DI(e))return!PI(e).length;for(var r in e)if(jI.call(e,r))return!1;return!0}var tv=zI;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function HI(e,t,r){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++a<i;)o[a]=e[a+t];return o}var xm=HI;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var WI=xm;function UI(e,t,r){var a=e.length;return r=r===void 0?a:r,!t&&r>=a?e:WI(e,t,r)}var VI=UI,qI="\\ud800-\\udfff",KI="\\u0300-\\u036f",YI="\\ufe20-\\ufe2f",GI="\\u20d0-\\u20ff",XI=KI+YI+GI,QI="\\ufe0e\\ufe0f",JI="\\u200d",ZI=RegExp("["+JI+qI+XI+QI+"]");function e3(e){return ZI.test(e)}var Cm=e3;function t3(e){return e.split("")}var r3=t3,km="\\ud800-\\udfff",i3="\\u0300-\\u036f",a3="\\ufe20-\\ufe2f",o3="\\u20d0-\\u20ff",n3=i3+a3+o3,s3="\\ufe0e\\ufe0f",l3="["+km+"]",fu="["+n3+"]",hu="\\ud83c[\\udffb-\\udfff]",c3="(?:"+fu+"|"+hu+")",_m="[^"+km+"]",Sm="(?:\\ud83c[\\udde6-\\uddff]){2}",Tm="[\\ud800-\\udbff][\\udc00-\\udfff]",u3="\\u200d",Am=c3+"?",Em="["+s3+"]?",f3="(?:"+u3+"(?:"+[_m,Sm,Tm].join("|")+")"+Em+Am+")*",h3=Em+Am+f3,d3="(?:"+[_m+fu+"?",fu,Sm,Tm,l3].join("|")+")",v3=RegExp(hu+"(?="+hu+")|"+d3+h3,"g");function g3(e){return e.match(v3)||[]}var y3=g3,p3=r3,m3=Cm,b3=y3;function w3(e){return m3(e)?b3(e):p3(e)}var x3=w3;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function C3(e,t,r,a){var i=-1,o=e==null?0:e.length;for(a&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}var k3=C3;function _3(e){return function(t){return e==null?void 0:e[t]}}var S3=_3,T3=S3,A3={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",Ĳ:"IJ",ĳ:"ij",Œ:"Oe",œ:"oe",ŉ:"'n",ſ:"s"},E3=T3(A3),P3=E3,R3=P3,I3=fn,M3=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,L3="\\u0300-\\u036f",O3="\\ufe20-\\ufe2f",D3="\\u20d0-\\u20ff",B3=L3+O3+D3,F3="["+B3+"]",N3=RegExp(F3,"g");function $3(e){return e=I3(e),e&&e.replace(M3,R3).replace(N3,"")}var j3=$3,z3=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function H3(e){return e.match(z3)||[]}var W3=H3,U3=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function V3(e){return U3.test(e)}var q3=V3,Pm="\\ud800-\\udfff",K3="\\u0300-\\u036f",Y3="\\ufe20-\\ufe2f",G3="\\u20d0-\\u20ff",X3=K3+Y3+G3,Rm="\\u2700-\\u27bf",Im="a-z\\xdf-\\xf6\\xf8-\\xff",Q3="\\xac\\xb1\\xd7\\xf7",J3="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Z3="\\u2000-\\u206f",e8=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Mm="A-Z\\xc0-\\xd6\\xd8-\\xde",t8="\\ufe0e\\ufe0f",Lm=Q3+J3+Z3+e8,Om="['’]",rv="["+Lm+"]",r8="["+X3+"]",Dm="\\d+",i8="["+Rm+"]",Bm="["+Im+"]",Fm="[^"+Pm+Lm+Dm+Rm+Im+Mm+"]",a8="\\ud83c[\\udffb-\\udfff]",o8="(?:"+r8+"|"+a8+")",n8="[^"+Pm+"]",Nm="(?:\\ud83c[\\udde6-\\uddff]){2}",$m="[\\ud800-\\udbff][\\udc00-\\udfff]",va="["+Mm+"]",s8="\\u200d",iv="(?:"+Bm+"|"+Fm+")",l8="(?:"+va+"|"+Fm+")",av="(?:"+Om+"(?:d|ll|m|re|s|t|ve))?",ov="(?:"+Om+"(?:D|LL|M|RE|S|T|VE))?",jm=o8+"?",zm="["+t8+"]?",c8="(?:"+s8+"(?:"+[n8,Nm,$m].join("|")+")"+zm+jm+")*",u8="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",f8="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",h8=zm+jm+c8,d8="(?:"+[i8,Nm,$m].join("|")+")"+h8,v8=RegExp([va+"?"+Bm+"+"+av+"(?="+[rv,va,"$"].join("|")+")",l8+"+"+ov+"(?="+[rv,va+iv,"$"].join("|")+")",va+"?"+iv+"+"+av,va+"+"+ov,f8,u8,Dm,d8].join("|"),"g");function g8(e){return e.match(v8)||[]}var y8=g8,p8=W3,m8=q3,b8=fn,w8=y8;function x8(e,t,r){return e=b8(e),t=r?void 0:t,t===void 0?m8(e)?w8(e):p8(e):e.match(t)||[]}var C8=x8,k8=k3,_8=j3,S8=C8,T8="['’]",A8=RegExp(T8,"g");function E8(e){return function(t){return k8(S8(_8(t).replace(A8,"")),e,"")}}var Hm=E8;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var P8=VI,R8=Cm,I8=x3,M8=fn;function L8(e){return function(t){t=M8(t);var r=R8(t)?I8(t):void 0,a=r?r[0]:t.charAt(0),i=r?P8(r,1).join(""):t.slice(1);return a[e]()+i}}var O8=L8,D8=O8,B8=D8("toUpperCase"),F8=B8,N8=fn,$8=F8;function j8(e){return $8(N8(e).toLowerCase())}var z8=j8,H8=z8,W8=Hm,U8=W8(function(e,t,r){return t=t.toLowerCase(),e+(r?H8(t):t)}),dl=U8;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var V8=Hm,q8=V8(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),vn=q8;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function vl(e){var t;return st(e)&&"defaultNode"in e?t=e.defaultNode:(Ma(e)||dn(e))&&(t=e),t}function gl(e){return st(e)&&"params"in e?e.params:{}}function K8(e){return st(e)&&"slotFirst"in e?e.slotFirst:{}}function nv(e,t,r){var a,i,o,n,s=(a=(i=e.$slots)[dl(r)])===null||a===void 0?void 0:a.call(i,t);return s||(s=(o=(n=e.$slots)[vn(r)])===null||o===void 0?void 0:o.call(n,t),s)?s:null}var xs=function(t,r,a){var i=gl(a),o=vl(a),n;if(r in t&&(n=t[r]),!(n===!1||n===null)){if(n===!0&&o)return nv(t,i,r)||o;if(Dt(n))return n(Tr,i);var s=[void 0,i,""].includes(n);return s&&(t.$slots[dl(r)]||t.$slots[vn(r)])?nv(t,i,r):n}},Y8=function(t,r,a,i){var o=gl(i),n=vl(i),s=o?{params:o}:void 0,u=xs(t,r,s),c=xs(t,a,s),l=tv(u)?c:u;return tv(l)?n:l};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var G8={attach:{type:[String,Function],default:""},content:{type:[String,Function]},default:{type:[String,Function]},delay:{type:Number,default:0},fullscreen:Boolean,indicator:{type:[Boolean,Function],default:!0},inheritColor:Boolean,loading:{type:Boolean,default:!0},preventScrollThrough:{type:Boolean,default:!0},showOverlay:{type:Boolean,default:!0},size:{type:String,default:"medium"},text:{type:[String,Function]},zIndex:{type:Number}};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var X8=function(t,r){var a=Dt(t)?fe(t):Ie(t),i=Dt(r)?fe(r):Ie(r),o=Ie(),n=function(){o.value=wm()||hl(a.value,i.value)};return ir(function(){return n()}),ut([a,i],function(){return n()}),o};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var Q8=function(){return{name:tt("loading"),centerClass:tt("loading--center"),fullscreenClass:tt("loading__fullscreen"),lockClass:tt("loading--lock"),overlayClass:tt("loading__overlay"),relativeClass:tt("loading__parent"),fullClass:tt("loading--full"),inheritColorClass:tt("loading--inherit-color")}},du=Ge({name:"TLoading",inheritAttrs:!1,props:G8,setup:function(t,r){var a=r.slots,i=Ie(!1),o=Q8(),n=o.name,s=o.centerClass,u=o.fullscreenClass,c=o.lockClass,l=o.overlayClass,f=o.relativeClass,h=o.fullClass,d=o.inheritColorClass,v=tt(),y=Df(),g=y.SIZE,m=function(){i.value=!1;var D=setTimeout(function(){i.value=!0,clearTimeout(D)},t.delay)},w=X8(function(){return t.attach}),p=fe(function(){return!!(!t.delay||t.delay&&i.value)}),x=fe(function(){var B={};return t.zIndex!==void 0&&(B.zIndex=t.zIndex),["small","medium","large"].includes(t.size)||(B["font-size"]=t.size),B}),T=fe(function(){return!!(t.default||a.default||t.content||a.content)}),A=fe(function(){return t.preventScrollThrough&&t.fullscreen}),I=fe(function(){return!!(t.text||a.text)}),R=fe(function(){return T.value&&t.loading&&p.value}),z=fe(function(){return t.fullscreen&&t.loading&&p.value}),U=fe(function(){return t.attach&&t.loading&&p.value}),_=fe(function(){return t.attach&&t.loading&&p.value}),k=fe(function(){var B=[s.value,g.value[t.size],ze({},d.value,t.inheritColor)],D=[n.value,u.value,s.value,l.value];return{baseClasses:B,attachClasses:B.concat([n.value,h.value,ze({},l.value,t.showOverlay)]),withContentClasses:B.concat([n.value,h.value,ze({},l.value,t.showOverlay)]),fullScreenClasses:D,normalClasses:B.concat([n.value])}}),S=uf(t),P=S.loading;return ut([P],function(B){var D=ul(B,1),H=D[0];H?(m(),A.value&&cu(document.body,c.value)):A.value&&uu(document.body,c.value)}),ir(function(){t.delay&&m()}),{classPrefix:v,relativeClass:f,delayShowLoading:i,styles:x,showText:I,hasContent:T,classes:k,lockFullscreen:A,showWrapLoading:R,showNormalLoading:U,showFullScreenLoading:z,showAttachedLoading:_,teleportElement:w}},render:function(){var t=this,r=this.classes,a=r.fullScreenClasses,i=r.baseClasses,o=r.withContentClasses,n=r.attachClasses,s=r.normalClasses,u=de(_I,{size:this.size},null),c=this.loading&&xs(this,"indicator",u),l=this.showText&&de("div",{class:"".concat(this.classPrefix,"-loading__text")},[xs(this,"text")]);return this.fullscreen?!this.showFullScreenLoading||!this.loading?null:de(Zc,{disabled:!this.attach||!this.teleportElement,to:this.teleportElement},{default:function(){return[de("div",ni({class:a,style:t.styles},t.$attrs),[de("div",{class:i},[c,l])])]}}):this.hasContent?de("div",ni({class:this.relativeClass},this.$attrs),[Y8(this,"default","content"),this.showWrapLoading&&de("div",{class:o,style:this.styles},[c,l])]):this.attach?!this.showAttachedLoading||!this.loading?null:de(Zc,{disabled:!this.attach||!this.teleportElement,to:this.teleportElement},{default:function(){return[de("div",ni({class:n,style:t.styles},t.$attrs),[c,l])]}}):this.loading?de("div",ni({class:s,style:this.styles},this.$attrs),[c,l]):null}});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function sv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function J8(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sv(Object(r),!0).forEach(function(a){ze(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var ba=null;function Z8(e){var t=im({fullscreen:!1,attach:"body",loading:!0,preventScrollThrough:!0},e);return t}function lv(e){var t=Z8(e);if(t.fullscreen&&ba)return ba;var r=Ge({setup:function(){var f=ta(t);return{loadingOptions:f}},render:function(){return Tr(du,J8({},this.loadingOptions))}}),a=hl(t.fullscreen?"body":t.attach),i=wf(r),o=i.mount(document.createElement("div")),n=tt("loading__parent--relative").value,s=tt("loading--lock"),u=t.preventScrollThrough&&t.fullscreen;u&&cu(document.body,s.value),a?cu(a,n):console.error("attach is not exist");var c={hide:function(){o.loading=!1,uu(a,n),uu(document.body,s.value),i.unmount()}};return c}function Wm(e){if(e===!0)return ba=lv({fullscreen:!0,loading:!0,attach:"body",preventScrollThrough:!0}),ba;if(e===!1){var t;(t=ba)===null||t===void 0||t.hide(),ba=null;return}return lv(e)}var Um=Wm;Um.install=function(e){e.config.globalProperties.$loading=Wm};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var eM=Qp,tM=un;function rM(e,t){return e&&eM(e,t,tM)}var iM=rM,aM=nl,oM=If,nM=1,sM=2;function lM(e,t,r,a){var i=r.length,o=i,n=!a;if(e==null)return!o;for(e=Object(e);i--;){var s=r[i];if(n&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=r[i];var u=s[0],c=e[u],l=s[1];if(n&&s[2]){if(c===void 0&&!(u in e))return!1}else{var f=new aM;if(a)var h=a(c,l,u,e,t,f);if(!(h===void 0?oM(l,c,nM|sM,a,f):h))return!1}}return!0}var cM=lM,uM=st;function fM(e){return e===e&&!uM(e)}var Vm=fM,hM=Vm,dM=un;function vM(e){for(var t=dM(e),r=t.length;r--;){var a=t[r],i=e[a];t[r]=[a,i,hM(i)]}return t}var gM=vM;function yM(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var qm=yM,pM=cM,mM=gM,bM=qm;function wM(e){var t=mM(e);return t.length==1&&t[0][2]?bM(t[0][0],t[0][1]):function(r){return r===e||pM(r,e,t)}}var xM=wM,CM=If,kM=X6,_M=uI,SM=Mf,TM=Vm,AM=qm,EM=hn,PM=1,RM=2;function IM(e,t){return SM(e)&&TM(t)?AM(EM(e),t):function(r){var a=kM(r,e);return a===void 0&&a===t?_M(r,e):CM(t,a,PM|RM)}}var MM=IM,LM=Of;function OM(e){return function(t){return LM(t,e)}}var DM=OM,BM=hI,FM=DM,NM=Mf,$M=hn;function jM(e){return NM(e)?BM($M(e)):FM(e)}var zM=jM,HM=xM,WM=MM,UM=Ef,VM=Bt,qM=zM;function KM(e){return typeof e=="function"?e:e==null?UM:_t(e)=="object"?VM(e)?WM(e[0],e[1]):HM(e):qM(e)}var YM=KM,GM=Zs,XM=iM,QM=YM;function JM(e,t){var r={};return t=QM(t),XM(e,function(a,i,o){GM(r,t(a,i,o),a)}),r}var ZM=JM,vu=Symbol("TdLoading"),cv=function(t,r){var a=r.modifiers,i=a.fullscreen,o=a.inheritColor,n={attach:function(){return t},fullscreen:i??!1,inheritColor:o??!1,loading:r.value};st(r.value)&&ZM(r.value,function(s,u){n[u]=s}),t[vu]={options:n,instance:Um(n)}},eL={mounted:function(t,r){r.value&&cv(t,r)},updated:function(t,r){var a=t[vu],i=r.value,o=r.oldValue;if(!l6(i,o)){var n,s=(n=i==null?void 0:i.loading)!==null&&n!==void 0?n:i;s?cv(t,r):a==null||a.instance.hide()}},unmounted:function(t){var r;(r=t[vu])===null||r===void 0||r.instance.hide()}};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function yl(e,t,r){var a=e;return a.install=function(i,o){i.component(t||o||a.name,e),r&&i.directive(r.name,r.comp)},a}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var Km=yl(du,du.name,{name:"loading",comp:eL});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var tL={block:Boolean,content:{type:[String,Function]},default:{type:[String,Function]},disabled:{type:Boolean,default:void 0},ghost:Boolean,href:{type:String,default:""},icon:{type:Function},loading:Boolean,loadingProps:{type:Object},shape:{type:String,default:"rectangle",validator:function(t){return t?["rectangle","square","round","circle"].includes(t):!0}},size:{type:String,default:"medium",validator:function(t){return t?["extra-small","small","medium","large"].includes(t):!0}},suffix:{type:Function},tag:{type:String,validator:function(t){return t?["button","a","div"].includes(t):!0}},theme:{type:String,validator:function(t){return t?["default","primary","danger","warning","success"].includes(t):!0}},type:{type:String,default:"button",validator:function(t){return t?["submit","reset","button"].includes(t):!0}},variant:{type:String,default:"base",validator:function(t){return t?["base","outline","dashed","text"].includes(t):!0}},onClick:Function};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var rL=sl.expand,iL=sl.ripple,aL=sl.fade;function oL(){var e=fl("animation"),t=e.globalConfig,r=function(i){var o,n,s=t.value;return s&&!((o=s.exclude)!==null&&o!==void 0&&o.includes(i))&&((n=s.include)===null||n===void 0?void 0:n.includes(i))};return{keepExpand:r(rL),keepRipple:r(iL),keepFade:r(aL)}}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function uv(e,t){var r=Object.keys(t);r.forEach(function(a){e.style[a]=t[a]})}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var Hl=200,nL="rgba(0, 0, 0, 0)",sL="rgba(0, 0, 0, 0.35)",lL=function(t,r){var a;if(t!=null&&(a=t.dataset)!==null&&a!==void 0&&a.ripple){var i=t.dataset.ripple;return i}var o=getComputedStyle(t).getPropertyValue("--ripple-color");return o||sL};function cL(e,t){var r=Ie(null),a=tt(),i=oL(),o=i.keepRipple,n=function(u){var c=e.value,l=lL(c);if(!(u.button!==0||!e||!o)&&!(c.classList.contains("".concat(a.value,"-is-active"))||c.classList.contains("".concat(a.value,"-is-disabled"))||c.classList.contains("".concat(a.value,"-is-checked"))||c.classList.contains("".concat(a.value,"-is-loading")))){var f=getComputedStyle(c),h=parseInt(f.borderWidth,10),d=h>0?h:0,v=c.offsetWidth,y=c.offsetHeight;r.value.parentNode===null&&(uv(r.value,{position:"absolute",left:"".concat(0-d,"px"),top:"".concat(0-d,"px"),width:"".concat(v,"px"),height:"".concat(y,"px"),borderRadius:f.borderRadius,pointerEvents:"none",overflow:"hidden"}),c.appendChild(r.value));var g=document.createElement("div");uv(g,{marginTop:"0",marginLeft:"0",right:"".concat(v,"px"),width:"".concat(v+20,"px"),height:"100%",transition:"transform ".concat(Hl,"ms cubic-bezier(.38, 0, .24, 1), background ").concat(Hl*2,"ms linear"),transform:"skewX(-8deg)",pointerEvents:"none",position:"absolute",zIndex:0,backgroundColor:l,opacity:"0.9"});for(var m=new WeakMap,w=c.children.length,p=0;p<w;++p){var x=c.children[p];x.style.zIndex===""&&x!==r.value&&(x.style.zIndex="1",m.set(x,!0))}var T=c.style.position?c.style.position:getComputedStyle(c).position;(T===""||T==="static")&&(c.style.position="relative"),r.value.insertBefore(g,r.value.firstChild),setTimeout(function(){g.style.transform="translateX(".concat(v,"px)")},0);var A=function I(){g.style.backgroundColor=nL,e.value&&(e.value.removeEventListener("pointerup",I,!1),e.value.removeEventListener("pointerleave",I,!1),setTimeout(function(){g.remove(),r.value.children.length===0&&r.value.remove()},Hl*2+100))};e.value.addEventListener("pointerup",A,!1),e.value.addEventListener("pointerleave",A,!1)}};ir(function(){var s=e==null?void 0:e.value;s&&(r.value=document.createElement("div"),s.addEventListener("pointerdown",n,!1))}),rn(function(){var s;e==null||(s=e.value)===null||s===void 0||s.removeEventListener("pointerdown",n,!1)})}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function fv(e,t,r){var a,i,o,n,s=(a=(i=e.slots)[dl(t)])===null||a===void 0?void 0:a.call(i,r);return s&&s.filter(function(u){return u.type.toString()!=="Symbol(v-cmt)"}).length||(s=(o=(n=e.slots)[vn(t)])===null||o===void 0?void 0:o.call(n,r),s&&s.filter(function(u){return u.type.toString()!=="Symbol(v-cmt)"}).length)?s:null}function hv(e){if([void 0,null,""].includes(e))return!0;var t=e instanceof Array?e:[e],r=t.filter(function(a){var i;return(a==null||(i=a.type)===null||i===void 0?void 0:i.toString())!=="Symbol(Comment)"});return!r.length}var gn=function(){var t=xi();return function(r,a){var i=gl(a),o=vl(a),n=K8(a),s;if(Object.keys(t.props).includes(r)&&(s=t.props[r]),!(s===!1||s===null)){if(s===!0)return fv(t,r,i)||o;if(Dt(s))return s(Tr,i);var u=[void 0,i,""].includes(s);return(u||n)&&(t.slots[dl(r)]||t.slots[vn(r)])?fv(t,r,i):s}}},pl=function(){var t=gn();return function(r,a,i){var o=gl(i),n=vl(i),s=o?{params:o}:void 0,u=t(r,s),c=t(a,s),l=hv(u)?c:u;return hv(l)?n:l}};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var uL=Ci,fL=fr,hL="[object Boolean]";function dL(e){return e===!0||e===!1||fL(e)&&uL(e)==hL}var Ln=dL;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function vL(e){var t=xi(),r=fe(function(){return t.props.disabled}),a=Ct("formDisabled",Object.create(null));return fe(function(){var i;return Ln(void 0)?e.beforeDisabled.value:Ln(r.value)?r.value:Ln(void 0)?e.afterDisabled.value:Ln((i=a.disabled)===null||i===void 0?void 0:i.value)?a.disabled.value:!1})}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function dv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function On(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dv(Object(r),!0).forEach(function(a){ze(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var gL=Ge({name:"TButton",props:tL,setup:function(t,r){var a=r.attrs,i=r.slots,o=gn(),n=pl(),s=tt("button"),u=Df(),c=u.STATUS,l=u.SIZE,f=Ie();cL(f);var h=vL(),d=fe(function(){var y=t.theme,g=t.variant;return y||(g==="base"?"primary":"default")}),v=fe(function(){return["".concat(s.value),"".concat(s.value,"--variant-").concat(t.variant),"".concat(s.value,"--theme-").concat(d.value),ze(ze(ze(ze(ze(ze({},l.value[t.size],t.size!=="medium"),c.value.disabled,h.value),c.value.loading,t.loading),"".concat(s.value,"--shape-").concat(t.shape),t.shape!=="rectangle"),"".concat(s.value,"--ghost"),t.ghost),l.value.block,t.block)]});return function(){var y=n("default","content"),g=t.loading?de(Km,On({inheritColor:!0},t.loadingProps),null):o("icon"),m=g&&!y,w=t.suffix||i.suffix?de("span",{className:"".concat(s.value,"__suffix")},[o("suffix")]):null;y=y?de("span",{class:"".concat(s.value,"__text")},[y]):"",g&&(y=[g,y]),w&&(y=[y].concat(w));var p=function(){return!t.tag&&t.href?"a":t.tag||"button"},x={class:[].concat(iu(v.value),[ze({},"".concat(s.value,"--icon-only"),m)]),type:t.type,disabled:h.value||t.loading,href:t.href,tabindex:h.value?void 0:"0"};return Tr(p(),On(On(On({ref:f},a),x),{},{onClick:t.onClick}),[y])}}});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var yL=yl(gL);function to(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function gv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vv(Object(r),!0).forEach(function(a){to(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function pL(e){var t=["fillOpacity","fillRule","clipRule"];return t.includes(e)?e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase():e}function ro(e,t){var r=Object.keys(e.attrs).reduce((a,i)=>(a[pL(i)]=e.attrs[i],a),{});return Tr(e.tag,gv(gv({},r),t),(e.children||[]).map(a=>ro(a,{})))}var mL="t",bL="zh-CN",wL={classPrefix:mL,locale:bL};function xL(){var{classPrefix:e}=wL;return{SIZE:{default:"",xs:"".concat(e,"-size-xs"),small:"".concat(e,"-size-s"),medium:"".concat(e,"-size-m"),large:"".concat(e,"-size-l"),xl:"".concat(e,"-size-xl"),block:"".concat(e,"-size-full-width")},STATUS:{loading:"".concat(e,"-is-loading"),disabled:"".concat(e,"-is-disabled"),focused:"".concat(e,"-is-focused"),success:"".concat(e,"-is-success"),error:"".concat(e,"-is-error"),warning:"".concat(e,"-is-warning"),selected:"".concat(e,"-is-selected"),active:"".concat(e,"-is-active"),checked:"".concat(e,"-is-checked"),current:"".concat(e,"-is-current"),hidden:"".concat(e,"-is-hidden"),visible:"".concat(e,"-is-visible"),expanded:"".concat(e,"-is-expanded"),indeterminate:"".concat(e,"-is-indeterminate")}}}function yn(e){var t=xL().SIZE,r=fe(()=>e.value in t?t[e.value]:""),a=fe(()=>e.value===void 0||e.value in t?{}:{fontSize:e.value});return{style:a,className:r}}function yv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function pv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yv(Object(r),!0).forEach(function(a){to(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var CL={tag:"svg",attrs:{fill:"none",viewBox:"0 0 24 24",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 23a11 11 0 100-22 11 11 0 000 22zM7.5 10.59l3 3 6-6L17.91 9l-7.41 7.41L6.09 12l1.41-1.41z"}}]},kL=Ge({name:"CheckCircleFilledIcon",props:{size:{type:String},onClick:{type:Function}},setup(e,t){var{attrs:r}=t,a=fe(()=>e.size),{className:i,style:o}=yn(a),n=fe(()=>["t-icon","t-icon-check-circle-filled",i.value]),s=fe(()=>pv(pv({},o.value),r.style)),u=fe(()=>({class:n.value,style:s.value,onClick:c=>{var l;return(l=e.onClick)===null||l===void 0?void 0:l.call(e,{e:c})}}));return()=>ro(CL,u.value)}});function mv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function bv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mv(Object(r),!0).forEach(function(a){to(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var _L={tag:"svg",attrs:{fill:"none",viewBox:"0 0 24 24",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.05 5.64L12 10.59l4.95-4.95 1.41 1.41L13.41 12l4.95 4.95-1.41 1.41L12 13.41l-4.95 4.95-1.41-1.41L10.59 12 5.64 7.05l1.41-1.41z"}}]},SL=Ge({name:"CloseIcon",props:{size:{type:String},onClick:{type:Function}},setup(e,t){var{attrs:r}=t,a=fe(()=>e.size),{className:i,style:o}=yn(a),n=fe(()=>["t-icon","t-icon-close",i.value]),s=fe(()=>bv(bv({},o.value),r.style)),u=fe(()=>({class:n.value,style:s.value,onClick:c=>{var l;return(l=e.onClick)===null||l===void 0?void 0:l.call(e,{e:c})}}));return()=>ro(_L,u.value)}});function wv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function xv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wv(Object(r),!0).forEach(function(a){to(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var TL={tag:"svg",attrs:{fill:"none",viewBox:"0 0 24 24",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 1a11 11 0 110 22 11 11 0 010-22zm-1 13h2V6.5h-2V14zm2 1.5h-2v2h2v-2z"}}]},AL=Ge({name:"ErrorCircleFilledIcon",props:{size:{type:String},onClick:{type:Function}},setup(e,t){var{attrs:r}=t,a=fe(()=>e.size),{className:i,style:o}=yn(a),n=fe(()=>["t-icon","t-icon-error-circle-filled",i.value]),s=fe(()=>xv(xv({},o.value),r.style)),u=fe(()=>({class:n.value,style:s.value,onClick:c=>{var l;return(l=e.onClick)===null||l===void 0?void 0:l.call(e,{e:c})}}));return()=>ro(TL,u.value)}});function Cv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function kv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Cv(Object(r),!0).forEach(function(a){to(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var EL={tag:"svg",attrs:{fill:"none",viewBox:"0 0 24 24",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 23a11 11 0 100-22 11 11 0 000 22zm-.17-11.11c.43-.53.97-.97 1.4-1.32A2 2 0 0012 7a2 2 0 00-1.89 1.33l-.33.95L7.9 8.6l.34-.94a4 4 0 116.24 4.47 7 7 0 00-1.1 1.01c-.27.34-.37.61-.37.85v1.25h-2V14c0-.87.39-1.57.83-2.11zM11 18.25v-2h2v2h-2z"}}]},PL=Ge({name:"HelpCircleFilledIcon",props:{size:{type:String},onClick:{type:Function}},setup(e,t){var{attrs:r}=t,a=fe(()=>e.size),{className:i,style:o}=yn(a),n=fe(()=>["t-icon","t-icon-help-circle-filled",i.value]),s=fe(()=>kv(kv({},o.value),r.style)),u=fe(()=>({class:n.value,style:s.value,onClick:c=>{var l;return(l=e.onClick)===null||l===void 0?void 0:l.call(e,{e:c})}}));return()=>ro(EL,u.value)}});function _v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function Sv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_v(Object(r),!0).forEach(function(a){to(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_v(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var RL={tag:"svg",attrs:{fill:"none",viewBox:"0 0 24 24",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 23a11 11 0 100-22 11 11 0 000 22zM11 8.5v-2h2v2h-2zm2 1.5v7.5h-2V10h2z"}}]},IL=Ge({name:"InfoCircleFilledIcon",props:{size:{type:String},onClick:{type:Function}},setup(e,t){var{attrs:r}=t,a=fe(()=>e.size),{className:i,style:o}=yn(a),n=fe(()=>["t-icon","t-icon-info-circle-filled",i.value]),s=fe(()=>Sv(Sv({},o.value),r.style)),u=fe(()=>({class:n.value,style:s.value,onClick:c=>{var l;return(l=e.onClick)===null||l===void 0?void 0:l.call(e,{e:c})}}));return()=>ro(RL,u.value)}});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var ML=["info","success","warning","error","question","loading"],Yt="32px",Ym={top:{top:Yt,left:"50%",transform:"translateX(-50%)"},center:{left:"50%",top:"50%",transform:"translateX(-50%) translateY(-50%)"},left:{left:Yt,top:"50%",transform:"translateY(-50%)"},bottom:{bottom:Yt,left:"50%",transform:"translateX(-50%)"},right:{right:Yt,top:"50%",transform:"translateY(-50%)",display:"flex",flexDirection:"column",alignItems:"flex-end"},"top-left":{left:Yt,top:Yt},"top-right":{right:Yt,top:Yt,display:"flex",flexDirection:"column",alignItems:"flex-end"},"bottom-right":{right:Yt,bottom:Yt,display:"flex",flexDirection:"column",alignItems:"flex-end"},"bottom-left":{left:Yt,bottom:Yt}},Gm=Object.keys(Ym);/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var LL={closeBtn:{type:[String,Boolean,Function],default:void 0},content:{type:[String,Function]},duration:{type:Number,default:3e3},icon:{type:[Boolean,Function],default:!0},theme:{type:String,default:"info",validator:function(t){return t?["info","success","warning","error","question","loading"].includes(t):!0}},onClose:Function,onCloseBtnClick:Function,onDurationEnd:Function};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function OL(e){var t=fl("icon"),r=t.globalConfig,a={};return Object.keys(e).forEach(function(i){var o;a[i]=((o=r.value)===null||o===void 0?void 0:o[i])||e[i]}),a}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var Xm={duration:200,easing:"linear"};function DL(e,t){if(e){var r=(e==null?void 0:e.offsetWidth)||0,a=(e==null?void 0:e.offsetHeight)||0,i=FL(t,r,a);if(i){var o=i[i.length-1];Qm(e,o),e.animate&&e.animate(i,Xm)}}}function BL(e,t,r){if(e){var a=(e==null?void 0:e.offsetHeight)||0,i=NL(t,a);if(!i)return r();var o=i[i.length-1];Qm(e,o);var n=e.animate&&e.animate(i,Xm);n?n.onfinish=function(){e.style.display="none",r()}:(e.style.display="none",r())}}function Qm(e,t){for(var r=Object.keys(t),a=0;a<r.length;a+=1){var i=r[a];e.style[i]=t[i]}}function FL(e,t,r){if(!Gm.includes(e))return null;if(["top-left","left","bottom-left"].includes(e))return[{opacity:0,marginLeft:"-".concat(t,"px")},{opacity:1,marginLeft:"0"}];if(["top-right","right","bottom-right"].includes(e))return[{opacity:0,marginRight:"-".concat(t,"px")},{opacity:1,marginRight:"0"}];if(["top","center"].includes(e))return[{opacity:0,marginTop:"-".concat(r,"px")},{opacity:1,marginTop:"0"}];if(["bottom"].includes(e))return[{opacity:0,transform:"translate3d(0, ".concat(r,"px, 0)")},{opacity:1,transform:"translate3d(0, 0, 0)"}]}function NL(e,t){if(!Gm.includes(e))return null;if(["bottom-left","bottom","bottom-right"].includes(e)){var r="".concat(t,"px");return[{opacity:1,marginTop:"0px"},{opacity:0,marginTop:r}]}var a="-".concat(t,"px");return[{opacity:1,marginTop:"0px"},{opacity:0,marginTop:a}]}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function Tv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function Av(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Tv(Object(r),!0).forEach(function(a){ze(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var $L=Ge({name:"TMessage",props:Av(Av({},LL),{},{placement:String}),setup:function(t,r){var a=r.slots,i=r.expose,o=tt("message"),n=OL({InfoCircleFilledIcon:IL,CheckCircleFilledIcon:kL,ErrorCircleFilledIcon:AL,HelpCircleFilledIcon:PL,CloseIcon:SL}),s=n.InfoCircleFilledIcon,u=n.CheckCircleFilledIcon,c=n.ErrorCircleFilledIcon,l=n.HelpCircleFilledIcon,f=n.CloseIcon,h=tt(),d=gn(),v=pl(),y=Ie(null),g=Ie(null),m=fe(function(){var I={};return ML.forEach(function(R){return I["".concat(h.value,"-is-").concat(R)]=t.theme===R}),[o.value,I,ze({},"".concat(h.value,"-is-closable"),t.closeBtn||a.closeBtn)]}),w=function(R){var z,U;(z=t.onClose)===null||z===void 0||z.call(t,{trigger:"close-click",e:R}),(U=t.onCloseBtnClick)===null||U===void 0||U.call(t,{e:R})},p=function(){t.duration&&clearTimeout(g.value)},x=function(){t.duration&&(g.value=Number(setTimeout(function(){p();var R=y.value;BL(R,t.placement,function(){var z,U;(z=t.onClose)===null||z===void 0||z.call(t,{trigger:"duration-end"}),(U=t.onDurationEnd)===null||U===void 0||U.call(t)})},t.duration)))},T=function(){var R=de(f,null,null);return de("span",{class:"".concat(o.value,"__close"),onClick:w},[d("closeBtn",R)])},A=function(){if(t.icon!==!1){if(Dt(t.icon))return t.icon(Tr);if(a.icon)return a.icon(null);var R={info:s,success:u,warning:c,error:c,question:l,loading:Km}[t.theme];return de(R,null,null)}};return df(function(){t.duration&&x()}),ir(function(){var I=y.value;DL(I,t.placement)}),i({close:w}),function(){return de("div",{ref:y,class:m.value,onMouseenter:p,onMouseleave:x},[A(),v("content","default"),T()])}}});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function Ev(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function na(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ev(Object(r),!0).forEach(function(a){ze(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ev(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var gu=6e3,jL=function(){var e=0;return function(){return e+=1,e}}(),zL=Ge({name:"TMessageList",props:{zIndex:{type:Number,default:0},placement:{type:String,default:""}},setup:function(t,r){var a=r.expose,i=tt("message__list"),o=Ie([]),n=Ie([]),s=fe(function(){return na(na({},Ym[t.placement]),{},{zIndex:t.zIndex!==gu?t.zIndex:gu})}),u=function(g){var m=na(na({},g),{},{key:jL()});return o.value.push(m),m.key},c=function(g){o.value.splice(g,1)},l=function(){o.value=[]},f=function(g){if(g)return isNaN(Number(g))?g:"".concat(g,"px")},h=function(g){return g.offset&&{position:"relative",left:f(g.offset[0]),top:f(g.offset[1])}},d=function(g,m){return na(na({},m),{},{onCloseBtnClick:function(p){return m.onCloseBtnClick&&m.onCloseBtnClick(p),c(g)},onDurationEnd:function(){return m.onDurationEnd&&m.onDurationEnd(),c(g)}})},v=function(g){g&&n.value.push(g)};return a({add:u,removeAll:l,list:o,messageList:n}),function(){if(o.value.length)return de("div",{class:i.value,style:s.value},[o.value.map(function(y,g){return de($L,ni({key:y.key,style:h(y),ref:v},d(g,y)),null)})])}}});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function Pv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function yu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pv(Object(r),!0).forEach(function(a){ze(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var Bi=new Map;function HL(e){var t=yu({duration:3e3,attach:"body",zIndex:gu,placement:"top"},e);return t.content=e.content,t}var WL=function(t){var r=HL(t),a=r.attach,i=r.placement,o=hl(a);Bi.get(o)||Bi.set(o,{});var n=Bi.get(o)[i],s;if(n)s=n.add(r);else{var u=document.createElement("div"),c=wf(zL,{zIndex:r.zIndex,placement:r.placement}).mount(u);s=c.add(r),Bi.get(o)[i]=c,o.appendChild(u)}return new Promise(function(l){var f=Bi.get(o)[i];tn(function(){var h=f.messageList;l(h==null?void 0:h.find(function(d){var v;return((v=d.$)===null||v===void 0||(v=v.vnode)===null||v===void 0?void 0:v.key)===s}))})})},ri=function(t,r,a){var i={theme:t};return dn(r)?i.content=r:st(r)&&!(r instanceof Array)&&(i=yu(yu({},i),r)),(a||a===0)&&(i.duration=a),WL(i)},Cs={info:function(t,r){return ri("info",t,r)},success:function(t,r){return ri("success",t,r)},warning:function(t,r){return ri("warning",t,r)},error:function(t,r){return ri("error",t,r)},question:function(t,r){return ri("question",t,r)},loading:function(t,r){return ri("loading",t,r)},close:function(t){t.then(function(r){return r==null?void 0:r.close()})},closeAll:function(){Bi instanceof Map&&Bi.forEach(function(t){Object.keys(t).forEach(function(r){var a=t[r];a.list=[]})})}},pr=ri;pr.install=function(e){e.config.globalProperties.$message=ri,Object.keys(Cs).forEach(function(t){e.config.globalProperties.$message[t]=Cs[t]})};Object.keys(Cs).forEach(function(e){pr[e]=Cs[e]});var Mt="top",tr="bottom",rr="right",Lt="left",$f="auto",pn=[Mt,tr,rr,Lt],Da="start",Vo="end",UL="clippingParents",Jm="viewport",lo="popper",VL="reference",Rv=pn.reduce(function(e,t){return e.concat([t+"-"+Da,t+"-"+Vo])},[]),Zm=[].concat(pn,[$f]).reduce(function(e,t){return e.concat([t,t+"-"+Da,t+"-"+Vo])},[]),qL="beforeRead",KL="read",YL="afterRead",GL="beforeMain",XL="main",QL="afterMain",JL="beforeWrite",ZL="write",eO="afterWrite",tO=[qL,KL,YL,GL,XL,QL,JL,ZL,eO];function Sr(e){return e?(e.nodeName||"").toLowerCase():null}function Ut(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ji(e){var t=Ut(e).Element;return e instanceof t||e instanceof Element}function er(e){var t=Ut(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function jf(e){if(typeof ShadowRoot>"u")return!1;var t=Ut(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function rO(e){var t=e.state;Object.keys(t.elements).forEach(function(r){var a=t.styles[r]||{},i=t.attributes[r]||{},o=t.elements[r];!er(o)||!Sr(o)||(Object.assign(o.style,a),Object.keys(i).forEach(function(n){var s=i[n];s===!1?o.removeAttribute(n):o.setAttribute(n,s===!0?"":s)}))})}function iO(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach(function(a){var i=t.elements[a],o=t.attributes[a]||{},n=Object.keys(t.styles.hasOwnProperty(a)?t.styles[a]:r[a]),s=n.reduce(function(u,c){return u[c]="",u},{});!er(i)||!Sr(i)||(Object.assign(i.style,s),Object.keys(o).forEach(function(u){i.removeAttribute(u)}))})}}const aO={name:"applyStyles",enabled:!0,phase:"write",fn:rO,effect:iO,requires:["computeStyles"]};function _r(e){return e.split("-")[0]}var Ui=Math.max,ks=Math.min,Ba=Math.round;function pu(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function eb(){return!/^((?!chrome|android).)*safari/i.test(pu())}function Fa(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!1);var a=e.getBoundingClientRect(),i=1,o=1;t&&er(e)&&(i=e.offsetWidth>0&&Ba(a.width)/e.offsetWidth||1,o=e.offsetHeight>0&&Ba(a.height)/e.offsetHeight||1);var n=Ji(e)?Ut(e):window,s=n.visualViewport,u=!eb()&&r,c=(a.left+(u&&s?s.offsetLeft:0))/i,l=(a.top+(u&&s?s.offsetTop:0))/o,f=a.width/i,h=a.height/o;return{width:f,height:h,top:l,right:c+f,bottom:l+h,left:c,x:c,y:l}}function zf(e){var t=Fa(e),r=e.offsetWidth,a=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-a)<=1&&(a=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:a}}function tb(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&jf(r)){var a=t;do{if(a&&e.isSameNode(a))return!0;a=a.parentNode||a.host}while(a)}return!1}function Ur(e){return Ut(e).getComputedStyle(e)}function oO(e){return["table","td","th"].indexOf(Sr(e))>=0}function ki(e){return((Ji(e)?e.ownerDocument:e.document)||window.document).documentElement}function ml(e){return Sr(e)==="html"?e:e.assignedSlot||e.parentNode||(jf(e)?e.host:null)||ki(e)}function Iv(e){return!er(e)||Ur(e).position==="fixed"?null:e.offsetParent}function nO(e){var t=/firefox/i.test(pu()),r=/Trident/i.test(pu());if(r&&er(e)){var a=Ur(e);if(a.position==="fixed")return null}var i=ml(e);for(jf(i)&&(i=i.host);er(i)&&["html","body"].indexOf(Sr(i))<0;){var o=Ur(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function mn(e){for(var t=Ut(e),r=Iv(e);r&&oO(r)&&Ur(r).position==="static";)r=Iv(r);return r&&(Sr(r)==="html"||Sr(r)==="body"&&Ur(r).position==="static")?t:r||nO(e)||t}function Hf(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Ao(e,t,r){return Ui(e,ks(t,r))}function sO(e,t,r){var a=Ao(e,t,r);return a>r?r:a}function rb(){return{top:0,right:0,bottom:0,left:0}}function ib(e){return Object.assign({},rb(),e)}function ab(e,t){return t.reduce(function(r,a){return r[a]=e,r},{})}var lO=function(t,r){return t=typeof t=="function"?t(Object.assign({},r.rects,{placement:r.placement})):t,ib(typeof t!="number"?t:ab(t,pn))};function cO(e){var t,r=e.state,a=e.name,i=e.options,o=r.elements.arrow,n=r.modifiersData.popperOffsets,s=_r(r.placement),u=Hf(s),c=[Lt,rr].indexOf(s)>=0,l=c?"height":"width";if(!(!o||!n)){var f=lO(i.padding,r),h=zf(o),d=u==="y"?Mt:Lt,v=u==="y"?tr:rr,y=r.rects.reference[l]+r.rects.reference[u]-n[u]-r.rects.popper[l],g=n[u]-r.rects.reference[u],m=mn(o),w=m?u==="y"?m.clientHeight||0:m.clientWidth||0:0,p=y/2-g/2,x=f[d],T=w-h[l]-f[v],A=w/2-h[l]/2+p,I=Ao(x,A,T),R=u;r.modifiersData[a]=(t={},t[R]=I,t.centerOffset=I-A,t)}}function uO(e){var t=e.state,r=e.options,a=r.element,i=a===void 0?"[data-popper-arrow]":a;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||tb(t.elements.popper,i)&&(t.elements.arrow=i))}const fO={name:"arrow",enabled:!0,phase:"main",fn:cO,effect:uO,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Na(e){return e.split("-")[1]}var hO={top:"auto",right:"auto",bottom:"auto",left:"auto"};function dO(e,t){var r=e.x,a=e.y,i=t.devicePixelRatio||1;return{x:Ba(r*i)/i||0,y:Ba(a*i)/i||0}}function Mv(e){var t,r=e.popper,a=e.popperRect,i=e.placement,o=e.variation,n=e.offsets,s=e.position,u=e.gpuAcceleration,c=e.adaptive,l=e.roundOffsets,f=e.isFixed,h=n.x,d=h===void 0?0:h,v=n.y,y=v===void 0?0:v,g=typeof l=="function"?l({x:d,y}):{x:d,y};d=g.x,y=g.y;var m=n.hasOwnProperty("x"),w=n.hasOwnProperty("y"),p=Lt,x=Mt,T=window;if(c){var A=mn(r),I="clientHeight",R="clientWidth";if(A===Ut(r)&&(A=ki(r),Ur(A).position!=="static"&&s==="absolute"&&(I="scrollHeight",R="scrollWidth")),A=A,i===Mt||(i===Lt||i===rr)&&o===Vo){x=tr;var z=f&&A===T&&T.visualViewport?T.visualViewport.height:A[I];y-=z-a.height,y*=u?1:-1}if(i===Lt||(i===Mt||i===tr)&&o===Vo){p=rr;var U=f&&A===T&&T.visualViewport?T.visualViewport.width:A[R];d-=U-a.width,d*=u?1:-1}}var _=Object.assign({position:s},c&&hO),k=l===!0?dO({x:d,y},Ut(r)):{x:d,y};if(d=k.x,y=k.y,u){var S;return Object.assign({},_,(S={},S[x]=w?"0":"",S[p]=m?"0":"",S.transform=(T.devicePixelRatio||1)<=1?"translate("+d+"px, "+y+"px)":"translate3d("+d+"px, "+y+"px, 0)",S))}return Object.assign({},_,(t={},t[x]=w?y+"px":"",t[p]=m?d+"px":"",t.transform="",t))}function vO(e){var t=e.state,r=e.options,a=r.gpuAcceleration,i=a===void 0?!0:a,o=r.adaptive,n=o===void 0?!0:o,s=r.roundOffsets,u=s===void 0?!0:s,c={placement:_r(t.placement),variation:Na(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Mv(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:n,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Mv(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const gO={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:vO,data:{}};var Dn={passive:!0};function yO(e){var t=e.state,r=e.instance,a=e.options,i=a.scroll,o=i===void 0?!0:i,n=a.resize,s=n===void 0?!0:n,u=Ut(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&c.forEach(function(l){l.addEventListener("scroll",r.update,Dn)}),s&&u.addEventListener("resize",r.update,Dn),function(){o&&c.forEach(function(l){l.removeEventListener("scroll",r.update,Dn)}),s&&u.removeEventListener("resize",r.update,Dn)}}const pO={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:yO,data:{}};var mO={left:"right",right:"left",bottom:"top",top:"bottom"};function rs(e){return e.replace(/left|right|bottom|top/g,function(t){return mO[t]})}var bO={start:"end",end:"start"};function Lv(e){return e.replace(/start|end/g,function(t){return bO[t]})}function Wf(e){var t=Ut(e),r=t.pageXOffset,a=t.pageYOffset;return{scrollLeft:r,scrollTop:a}}function Uf(e){return Fa(ki(e)).left+Wf(e).scrollLeft}function wO(e,t){var r=Ut(e),a=ki(e),i=r.visualViewport,o=a.clientWidth,n=a.clientHeight,s=0,u=0;if(i){o=i.width,n=i.height;var c=eb();(c||!c&&t==="fixed")&&(s=i.offsetLeft,u=i.offsetTop)}return{width:o,height:n,x:s+Uf(e),y:u}}function xO(e){var t,r=ki(e),a=Wf(e),i=(t=e.ownerDocument)==null?void 0:t.body,o=Ui(r.scrollWidth,r.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),n=Ui(r.scrollHeight,r.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),s=-a.scrollLeft+Uf(e),u=-a.scrollTop;return Ur(i||r).direction==="rtl"&&(s+=Ui(r.clientWidth,i?i.clientWidth:0)-o),{width:o,height:n,x:s,y:u}}function Vf(e){var t=Ur(e),r=t.overflow,a=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+i+a)}function ob(e){return["html","body","#document"].indexOf(Sr(e))>=0?e.ownerDocument.body:er(e)&&Vf(e)?e:ob(ml(e))}function Eo(e,t){var r;t===void 0&&(t=[]);var a=ob(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),o=Ut(a),n=i?[o].concat(o.visualViewport||[],Vf(a)?a:[]):a,s=t.concat(n);return i?s:s.concat(Eo(ml(n)))}function mu(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function CO(e,t){var r=Fa(e,!1,t==="fixed");return r.top=r.top+e.clientTop,r.left=r.left+e.clientLeft,r.bottom=r.top+e.clientHeight,r.right=r.left+e.clientWidth,r.width=e.clientWidth,r.height=e.clientHeight,r.x=r.left,r.y=r.top,r}function Ov(e,t,r){return t===Jm?mu(wO(e,r)):Ji(t)?CO(t,r):mu(xO(ki(e)))}function kO(e){var t=Eo(ml(e)),r=["absolute","fixed"].indexOf(Ur(e).position)>=0,a=r&&er(e)?mn(e):e;return Ji(a)?t.filter(function(i){return Ji(i)&&tb(i,a)&&Sr(i)!=="body"}):[]}function _O(e,t,r,a){var i=t==="clippingParents"?kO(e):[].concat(t),o=[].concat(i,[r]),n=o[0],s=o.reduce(function(u,c){var l=Ov(e,c,a);return u.top=Ui(l.top,u.top),u.right=ks(l.right,u.right),u.bottom=ks(l.bottom,u.bottom),u.left=Ui(l.left,u.left),u},Ov(e,n,a));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function nb(e){var t=e.reference,r=e.element,a=e.placement,i=a?_r(a):null,o=a?Na(a):null,n=t.x+t.width/2-r.width/2,s=t.y+t.height/2-r.height/2,u;switch(i){case Mt:u={x:n,y:t.y-r.height};break;case tr:u={x:n,y:t.y+t.height};break;case rr:u={x:t.x+t.width,y:s};break;case Lt:u={x:t.x-r.width,y:s};break;default:u={x:t.x,y:t.y}}var c=i?Hf(i):null;if(c!=null){var l=c==="y"?"height":"width";switch(o){case Da:u[c]=u[c]-(t[l]/2-r[l]/2);break;case Vo:u[c]=u[c]+(t[l]/2-r[l]/2);break}}return u}function qo(e,t){t===void 0&&(t={});var r=t,a=r.placement,i=a===void 0?e.placement:a,o=r.strategy,n=o===void 0?e.strategy:o,s=r.boundary,u=s===void 0?UL:s,c=r.rootBoundary,l=c===void 0?Jm:c,f=r.elementContext,h=f===void 0?lo:f,d=r.altBoundary,v=d===void 0?!1:d,y=r.padding,g=y===void 0?0:y,m=ib(typeof g!="number"?g:ab(g,pn)),w=h===lo?VL:lo,p=e.rects.popper,x=e.elements[v?w:h],T=_O(Ji(x)?x:x.contextElement||ki(e.elements.popper),u,l,n),A=Fa(e.elements.reference),I=nb({reference:A,element:p,strategy:"absolute",placement:i}),R=mu(Object.assign({},p,I)),z=h===lo?R:A,U={top:T.top-z.top+m.top,bottom:z.bottom-T.bottom+m.bottom,left:T.left-z.left+m.left,right:z.right-T.right+m.right},_=e.modifiersData.offset;if(h===lo&&_){var k=_[i];Object.keys(U).forEach(function(S){var P=[rr,tr].indexOf(S)>=0?1:-1,B=[Mt,tr].indexOf(S)>=0?"y":"x";U[S]+=k[B]*P})}return U}function SO(e,t){t===void 0&&(t={});var r=t,a=r.placement,i=r.boundary,o=r.rootBoundary,n=r.padding,s=r.flipVariations,u=r.allowedAutoPlacements,c=u===void 0?Zm:u,l=Na(a),f=l?s?Rv:Rv.filter(function(v){return Na(v)===l}):pn,h=f.filter(function(v){return c.indexOf(v)>=0});h.length===0&&(h=f);var d=h.reduce(function(v,y){return v[y]=qo(e,{placement:y,boundary:i,rootBoundary:o,padding:n})[_r(y)],v},{});return Object.keys(d).sort(function(v,y){return d[v]-d[y]})}function TO(e){if(_r(e)===$f)return[];var t=rs(e);return[Lv(e),t,Lv(t)]}function AO(e){var t=e.state,r=e.options,a=e.name;if(!t.modifiersData[a]._skip){for(var i=r.mainAxis,o=i===void 0?!0:i,n=r.altAxis,s=n===void 0?!0:n,u=r.fallbackPlacements,c=r.padding,l=r.boundary,f=r.rootBoundary,h=r.altBoundary,d=r.flipVariations,v=d===void 0?!0:d,y=r.allowedAutoPlacements,g=t.options.placement,m=_r(g),w=m===g,p=u||(w||!v?[rs(g)]:TO(g)),x=[g].concat(p).reduce(function(Y,q){return Y.concat(_r(q)===$f?SO(t,{placement:q,boundary:l,rootBoundary:f,padding:c,flipVariations:v,allowedAutoPlacements:y}):q)},[]),T=t.rects.reference,A=t.rects.popper,I=new Map,R=!0,z=x[0],U=0;U<x.length;U++){var _=x[U],k=_r(_),S=Na(_)===Da,P=[Mt,tr].indexOf(k)>=0,B=P?"width":"height",D=qo(t,{placement:_,boundary:l,rootBoundary:f,altBoundary:h,padding:c}),H=P?S?rr:Lt:S?tr:Mt;T[B]>A[B]&&(H=rs(H));var L=rs(H),M=[];if(o&&M.push(D[k]<=0),s&&M.push(D[H]<=0,D[L]<=0),M.every(function(Y){return Y})){z=_,R=!1;break}I.set(_,M)}if(R)for(var j=v?3:1,W=function(q){var Q=x.find(function(K){var X=I.get(K);if(X)return X.slice(0,q).every(function(b){return b})});if(Q)return z=Q,"break"},F=j;F>0;F--){var V=W(F);if(V==="break")break}t.placement!==z&&(t.modifiersData[a]._skip=!0,t.placement=z,t.reset=!0)}}const EO={name:"flip",enabled:!0,phase:"main",fn:AO,requiresIfExists:["offset"],data:{_skip:!1}};function Dv(e,t,r){return r===void 0&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Bv(e){return[Mt,rr,tr,Lt].some(function(t){return e[t]>=0})}function PO(e){var t=e.state,r=e.name,a=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,n=qo(t,{elementContext:"reference"}),s=qo(t,{altBoundary:!0}),u=Dv(n,a),c=Dv(s,i,o),l=Bv(u),f=Bv(c);t.modifiersData[r]={referenceClippingOffsets:u,popperEscapeOffsets:c,isReferenceHidden:l,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":f})}const RO={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:PO};function IO(e,t,r){var a=_r(e),i=[Lt,Mt].indexOf(a)>=0?-1:1,o=typeof r=="function"?r(Object.assign({},t,{placement:e})):r,n=o[0],s=o[1];return n=n||0,s=(s||0)*i,[Lt,rr].indexOf(a)>=0?{x:s,y:n}:{x:n,y:s}}function MO(e){var t=e.state,r=e.options,a=e.name,i=r.offset,o=i===void 0?[0,0]:i,n=Zm.reduce(function(l,f){return l[f]=IO(f,t.rects,o),l},{}),s=n[t.placement],u=s.x,c=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=c),t.modifiersData[a]=n}const LO={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:MO};function OO(e){var t=e.state,r=e.name;t.modifiersData[r]=nb({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const DO={name:"popperOffsets",enabled:!0,phase:"read",fn:OO,data:{}};function BO(e){return e==="x"?"y":"x"}function FO(e){var t=e.state,r=e.options,a=e.name,i=r.mainAxis,o=i===void 0?!0:i,n=r.altAxis,s=n===void 0?!1:n,u=r.boundary,c=r.rootBoundary,l=r.altBoundary,f=r.padding,h=r.tether,d=h===void 0?!0:h,v=r.tetherOffset,y=v===void 0?0:v,g=qo(t,{boundary:u,rootBoundary:c,padding:f,altBoundary:l}),m=_r(t.placement),w=Na(t.placement),p=!w,x=Hf(m),T=BO(x),A=t.modifiersData.popperOffsets,I=t.rects.reference,R=t.rects.popper,z=typeof y=="function"?y(Object.assign({},t.rects,{placement:t.placement})):y,U=typeof z=="number"?{mainAxis:z,altAxis:z}:Object.assign({mainAxis:0,altAxis:0},z),_=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,k={x:0,y:0};if(A){if(o){var S,P=x==="y"?Mt:Lt,B=x==="y"?tr:rr,D=x==="y"?"height":"width",H=A[x],L=H+g[P],M=H-g[B],j=d?-R[D]/2:0,W=w===Da?I[D]:R[D],F=w===Da?-R[D]:-I[D],V=t.elements.arrow,Y=d&&V?zf(V):{width:0,height:0},q=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:rb(),Q=q[P],K=q[B],X=Ao(0,I[D],Y[D]),b=p?I[D]/2-j-X-Q-U.mainAxis:W-X-Q-U.mainAxis,C=p?-I[D]/2+j+X+K+U.mainAxis:F+X+K+U.mainAxis,E=t.elements.arrow&&mn(t.elements.arrow),N=E?x==="y"?E.clientTop||0:E.clientLeft||0:0,O=(S=_==null?void 0:_[x])!=null?S:0,$=H+b-O-N,G=H+C-O,Z=Ao(d?ks(L,$):L,H,d?Ui(M,G):M);A[x]=Z,k[x]=Z-H}if(s){var J,ee=x==="x"?Mt:Lt,te=x==="x"?tr:rr,oe=A[T],ne=T==="y"?"height":"width",ae=oe+g[ee],ie=oe-g[te],se=[Mt,Lt].indexOf(m)!==-1,le=(J=_==null?void 0:_[T])!=null?J:0,ge=se?ae:oe-I[ne]-R[ne]-le+U.altAxis,we=se?oe+I[ne]+R[ne]-le-U.altAxis:ie,Oe=d&&se?sO(ge,oe,we):Ao(d?ge:ae,oe,d?we:ie);A[T]=Oe,k[T]=Oe-oe}t.modifiersData[a]=k}}const NO={name:"preventOverflow",enabled:!0,phase:"main",fn:FO,requiresIfExists:["offset"]};function $O(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function jO(e){return e===Ut(e)||!er(e)?Wf(e):$O(e)}function zO(e){var t=e.getBoundingClientRect(),r=Ba(t.width)/e.offsetWidth||1,a=Ba(t.height)/e.offsetHeight||1;return r!==1||a!==1}function HO(e,t,r){r===void 0&&(r=!1);var a=er(t),i=er(t)&&zO(t),o=ki(t),n=Fa(e,i,r),s={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(a||!a&&!r)&&((Sr(t)!=="body"||Vf(o))&&(s=jO(t)),er(t)?(u=Fa(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):o&&(u.x=Uf(o))),{x:n.left+s.scrollLeft-u.x,y:n.top+s.scrollTop-u.y,width:n.width,height:n.height}}function WO(e){var t=new Map,r=new Set,a=[];e.forEach(function(o){t.set(o.name,o)});function i(o){r.add(o.name);var n=[].concat(o.requires||[],o.requiresIfExists||[]);n.forEach(function(s){if(!r.has(s)){var u=t.get(s);u&&i(u)}}),a.push(o)}return e.forEach(function(o){r.has(o.name)||i(o)}),a}function UO(e){var t=WO(e);return tO.reduce(function(r,a){return r.concat(t.filter(function(i){return i.phase===a}))},[])}function VO(e){var t;return function(){return t||(t=new Promise(function(r){Promise.resolve().then(function(){t=void 0,r(e())})})),t}}function qO(e){var t=e.reduce(function(r,a){var i=r[a.name];return r[a.name]=i?Object.assign({},i,a,{options:Object.assign({},i.options,a.options),data:Object.assign({},i.data,a.data)}):a,r},{});return Object.keys(t).map(function(r){return t[r]})}var Fv={placement:"bottom",modifiers:[],strategy:"absolute"};function Nv(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return!t.some(function(a){return!(a&&typeof a.getBoundingClientRect=="function")})}function KO(e){e===void 0&&(e={});var t=e,r=t.defaultModifiers,a=r===void 0?[]:r,i=t.defaultOptions,o=i===void 0?Fv:i;return function(s,u,c){c===void 0&&(c=o);var l={placement:"bottom",orderedModifiers:[],options:Object.assign({},Fv,o),modifiersData:{},elements:{reference:s,popper:u},attributes:{},styles:{}},f=[],h=!1,d={state:l,setOptions:function(m){var w=typeof m=="function"?m(l.options):m;y(),l.options=Object.assign({},o,l.options,w),l.scrollParents={reference:Ji(s)?Eo(s):s.contextElement?Eo(s.contextElement):[],popper:Eo(u)};var p=UO(qO([].concat(a,l.options.modifiers)));return l.orderedModifiers=p.filter(function(x){return x.enabled}),v(),d.update()},forceUpdate:function(){if(!h){var m=l.elements,w=m.reference,p=m.popper;if(Nv(w,p)){l.rects={reference:HO(w,mn(p),l.options.strategy==="fixed"),popper:zf(p)},l.reset=!1,l.placement=l.options.placement,l.orderedModifiers.forEach(function(U){return l.modifiersData[U.name]=Object.assign({},U.data)});for(var x=0;x<l.orderedModifiers.length;x++){if(l.reset===!0){l.reset=!1,x=-1;continue}var T=l.orderedModifiers[x],A=T.fn,I=T.options,R=I===void 0?{}:I,z=T.name;typeof A=="function"&&(l=A({state:l,options:R,name:z,instance:d})||l)}}}},update:VO(function(){return new Promise(function(g){d.forceUpdate(),g(l)})}),destroy:function(){y(),h=!0}};if(!Nv(s,u))return d;d.setOptions(c).then(function(g){!h&&c.onFirstUpdate&&c.onFirstUpdate(g)});function v(){l.orderedModifiers.forEach(function(g){var m=g.name,w=g.options,p=w===void 0?{}:w,x=g.effect;if(typeof x=="function"){var T=x({state:l,name:m,instance:d,options:p}),A=function(){};f.push(T||A)}})}function y(){f.forEach(function(g){return g()}),f=[]}return d}}var YO=[pO,DO,gO,aO,LO,EO,NO,fO,RO],GO=KO({defaultModifiers:YO});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var XO=/\s/;function QO(e){for(var t=e.length;t--&&XO.test(e.charAt(t)););return t}var JO=QO,ZO=JO,eD=/^\s+/;function tD(e){return e&&e.slice(0,ZO(e)+1).replace(eD,"")}var rD=tD,iD=rD,$v=st,aD=ll,jv=NaN,oD=/^[-+]0x[0-9a-f]+$/i,nD=/^0b[01]+$/i,sD=/^0o[0-7]+$/i,lD=parseInt;function cD(e){if(typeof e=="number")return e;if(aD(e))return jv;if($v(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=$v(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=iD(e);var r=nD.test(e);return r||sD.test(e)?lD(e.slice(2),r?2:8):oD.test(e)?jv:+e}var uD=cD;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var fD=ur,hD=function(){return fD.Date.now()},dD=hD,vD=st,Wl=dD,zv=uD,gD="Expected a function",yD=Math.max,pD=Math.min;function mD(e,t,r){var a,i,o,n,s,u,c=0,l=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(gD);t=zv(t)||0,vD(r)&&(l=!!r.leading,f="maxWait"in r,o=f?yD(zv(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h);function d(A){var I=a,R=i;return a=i=void 0,c=A,n=e.apply(R,I),n}function v(A){return c=A,s=setTimeout(m,t),l?d(A):n}function y(A){var I=A-u,R=A-c,z=t-I;return f?pD(z,o-R):z}function g(A){var I=A-u,R=A-c;return u===void 0||I>=t||I<0||f&&R>=o}function m(){var A=Wl();if(g(A))return w(A);s=setTimeout(m,y(A))}function w(A){return s=void 0,h&&a?d(A):(a=i=void 0,n)}function p(){s!==void 0&&clearTimeout(s),c=0,a=u=i=s=void 0}function x(){return s===void 0?n:w(Wl())}function T(){var A=Wl(),I=g(A);if(a=arguments,i=this,u=A,I){if(s===void 0)return v(u);if(f)return clearTimeout(s),s=setTimeout(m,t),d(u)}return s===void 0&&(s=setTimeout(m,t)),n}return T.cancel=p,T.flush=x,T}var bD=mD;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function sb(e,t,r,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"value",o=xi(),n=o.emit,s=o.vnode,u=Ie(),c=s.props||{},l=Object.prototype.hasOwnProperty.call(c,"modelValue")||Object.prototype.hasOwnProperty.call(c,"model-value"),f=Object.prototype.hasOwnProperty.call(c,i)||Object.prototype.hasOwnProperty.call(c,vn(i));return l?[t,function(h){n("update:modelValue",h);for(var d=arguments.length,v=new Array(d>1?d-1:0),y=1;y<d;y++)v[y-1]=arguments[y];a==null||a.apply(void 0,[h].concat(v))}]:f?[e,function(h){n("update:".concat(i),h);for(var d=arguments.length,v=new Array(d>1?d-1:0),y=1;y<d;y++)v[y-1]=arguments[y];a==null||a.apply(void 0,[h].concat(v))}]:(u.value=r,[u,function(h){u.value=h;for(var d=arguments.length,v=new Array(d>1?d-1:0),y=1;y<d;y++)v[y-1]=arguments[y];a==null||a.apply(void 0,[h].concat(v))}])}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var qf={attach:{type:[String,Function],default:"body"},content:{type:[String,Function]},default:{type:[String,Function]},delay:{type:[Number,Array]},destroyOnClose:Boolean,disabled:Boolean,hideEmptyPopup:Boolean,overlayClassName:{type:[String,Object,Array]},overlayInnerClassName:{type:[String,Object,Array]},overlayInnerStyle:{type:[Boolean,Object,Function]},overlayStyle:{type:[Boolean,Object,Function]},placement:{type:String,default:"top"},popperOptions:{type:Object},showArrow:Boolean,trigger:{type:String,default:"hover",validator:function(t){return t?["hover","click","focus","mousedown","context-menu"].includes(t):!0}},triggerElement:{type:[String,Function]},visible:{type:Boolean,default:void 0},modelValue:{type:Boolean,default:void 0},defaultVisible:Boolean,zIndex:{type:Number},onOverlayClick:Function,onScroll:Function,onScrollToBottom:Function,onVisibleChange:Function};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function lb(e,t){if(!(typeof window>"u")){var r=window&&window.ResizeObserver;if(r){var a=null,i=function(){!a||!e.value||(a.unobserve(e.value),a.disconnect(),a=null)},o=function(s){a=new ResizeObserver(t),a.observe(s)};e&&ut(e,function(n){i(),n&&o(n)},{immediate:!0,flush:"post"}),Ys(function(){i()})}}}/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function wD(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Ma(e)}function cb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=[];return e.forEach(function(r){Bt(r)?t.push.apply(t,iu(r)):r.type===wt?t.push.apply(t,iu(cb(r.children))):t.push(r)}),t.filter(function(r){return!(r&&(r.type===Et||r.type===wt&&r.children.length===0||r.type===Ka&&r.children.trim()===""))})}function xD(e,t){return!e&&!t?!1:!!(!e||!t||["width","height","x","y"].some(function(r){return e[r]!==t[r]}))}function ub(e){var t=xi(),r=Ie();return ir(function(){r.value=e(t)}),sp(function(){var a=e(t);r.value!==a&&(r.value=a)}),r}var CD=Ge({name:"TPopupTrigger",props:{forwardRef:Function},emits:["resize"],setup:function(t,r){var a=r.emit,i=r.slots,o=ub(function(s){var u=s.parent.vnode;return u.el.nextElementSibling}),n=Ie();return ut(o,function(){var s;(s=t.forwardRef)===null||s===void 0||s.call(t,o.value)}),lb(o,function(s){var u=ul(s,1),c=u[0].contentRect;n.value=c}),ut(n,function(s,u){xD(s,u)&&a("resize")}),function(){var s,u,c=cb((s=i.default)===null||s===void 0?void 0:s.call(i));return c.length>1||((u=c[0])===null||u===void 0?void 0:u.type)===Ka?de("span",null,[c]):c[0]}}}),kD=Ge({name:"TPopupContent",emits:["resize"],setup:function(t,r){var a=r.emit,i=r.slots,o=ub(function(n){return n.vnode.el.children[0]});return lb(o,function(){a("resize")}),function(){return de("div",{style:"position: absolute; top: 0px; left: 0px; width: 100%"},[i.default()])}}}),_D=Ge({name:"TPopupContainer",inheritAttrs:!1,props:{parent:Object,visible:Boolean,attach:qf.attach,forwardRef:Function},emits:["resize","contentMounted"],setup:function(t,r){var a=r.emit,i=r.attrs,o=r.slots,n=r.expose,s=Ie(),u=Ie(!1);function c(){a("resize")}return ir(function(){requestAnimationFrame(function(){u.value=t.visible})}),ut(function(){return t.visible},function(l){l&&(u.value=t.visible)}),n({unmountContent:function(){u.value=!1}}),function(){var l,f=function(){return wm()||hl(t.attach,s.value)};return de(wt,null,[de(CD,{class:i.class,forwardRef:function(d){t.forwardRef(d),s.value=d},onResize:c},wD(l=o.default())?l:{default:function(){return[l]}}),u.value&&de(Zc,{disabled:!f(),to:f()},{default:function(){return[de(kD,{onResize:c,onVnodeMounted:function(){return a("contentMounted")}},{default:function(){return[o.content&&o.content()]}})]}})])}}}),Hv={};function Wv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function Ul(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wv(Object(r),!0).forEach(function(a){ze(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function SD(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Ma(e)}var fb="data-td-popup",bu="data-td-popup-parent";function Vl(e,t){var r=[],a=[bu,fb];if(!e)return r;return t&&a.unshift(a.pop()),i(e),r;function i(o){var n=document.querySelectorAll("[".concat(a[0],'="').concat(o,'"]'));n.forEach(function(s){r.push(s);var u=s.getAttribute(a[1]);u&&u!==o&&i(u)})}}var Uv=Symbol();function TD(e){return e.replace(/-(left|top)$/,"-start").replace(/-(right|bottom)$/,"-end")}function AD(e){var t=[];return{add:function(a,i){a&&(Nf(e.value,a,i),t.push(function(){ws(e.value,a,i)}))},clean:function(){t.forEach(function(a){return a==null?void 0:a()}),t.length=0}}}var ED=Ge({name:"TPopup",props:Ul(Ul({},qf),{},{expandAnimation:{type:Boolean}}),setup:function(t,r){var a,i=r.expose,o=uf(t),n=o.visible,s=o.modelValue,u=sb(n,s,t.defaultVisible,t.onVisibleChange,"visible"),c=ul(u,2),l=c[0],f=c[1],h=gn(),d=pl(),v,y,g,m=Ie(null),w=Ie(null),p=Ie(null),x=Ie(null),T=Ie(!1),A=typeof process<"u"&&(a=Hv)!==null&&a!==void 0&&a.TEST?"":Date.now().toString(36),I=Ct(Uv,void 0);Ta(Uv,{id:A,assertMouseLeave:F});var R=tt("popup"),z=Df(),U=z.STATUS,_=fe(function(){var K,X,b=t.trigger!=="hover"?[0,0]:[].concat((K=t.delay)!==null&&K!==void 0?K:[250,150]);return{show:b[0],hide:(X=b[1])!==null&&X!==void 0?X:b[0]}}),k=AD(m);ut(function(){return[t.trigger,m.value]},function(){m.value&&(k.clean(),k.add({hover:"mouseenter",focus:"focusin","context-menu":"contextmenu",click:"click"}[t.trigger],function(K){if(!t.disabled){if(K.type==="contextmenu"&&K.preventDefault(),(K.type==="click"||K.type==="contextmenu")&&l.value){L(K);return}H(K)}}),k.add({hover:"mouseleave",focus:"focusout"}[t.trigger],L))}),ut(function(){return[t.overlayStyle,t.overlayInnerStyle,w.value]},function(){P(),B()}),ut(function(){return t.placement},function(){D(),B()}),ut(function(){return l.value},function(K){if(K){Nf(document,"mousedown",W,!0),t.trigger==="focus"&&EI(m.value,"keydown",function(X){var b,C=typeof process<"u"&&(b=Hv)!==null&&b!==void 0&&b.TEST?"27":"Escape";X.code===C&&L(X)});return}ws(document,"mousedown",W,!0)}),rn(function(){D(),M(),ws(document,"mousedown",W,!0)}),i({update:B,getOverlay:function(){return w.value},getOverlayState:function(){return{hover:T.value}},close:function(){return L()}});function S(){var K=t.overlayStyle;if(!(!m.value||!w.value)){if(Dt(K))return K(m.value,w.value);if(st(K))return K}}function P(){var K=t.overlayInnerStyle;!m.value||!w.value||(Dt(K)?bs(w.value,K(m.value,w.value)):st(K)&&bs(w.value,K))}function B(){if(!(!p.value||!l.value)){if(v){if(m.value.getRootNode()instanceof ShadowRoot)v.state.elements.reference=m.value,v.update();else{for(var K=m.value.getBoundingClientRect(),X=m.value;X&&X!==document.body;)X=X.parentElement;var b=X!==document.body||K.width===0&&K.height===0;b?f(!1,{trigger:j({type:"mouseenter"})}):(v.state.elements.reference=m.value,v.update())}return}v=GO(m.value,p.value,Ul({placement:TD(t.placement),onFirstUpdate:function(){tn(B)}},t.popperOptions))}}function D(){if(v){var K;(K=v)===null||K===void 0||K.destroy(),v=null}if(t.destroyOnClose){var X;(X=x.value)===null||X===void 0||X.unmountContent()}}function H(K){M(),y=setTimeout(function(){f(!0,{trigger:j(K)})},_.value.show)}function L(K){M(),g=setTimeout(function(){f(!1,{trigger:j(K),e:K})},_.value.hide)}function M(){clearTimeout(y),clearTimeout(g)}function j(K){switch(K==null?void 0:K.type){case"mouseenter":return"trigger-element-hover";case"mouseleave":return"trigger-element-hover";case"focusin":return"trigger-element-focus";case"focusout":return"trigger-element-blur";case"click":return"trigger-element-click";case"context-menu":case"keydown":return"keydown-esc";case"mousedown":return"document";default:return"trigger-element-close"}}function W(K){var X,b;if(!((X=p.value)!==null&&X!==void 0&&X.contains(K.target))&&!((b=m.value)!==null&&b!==void 0&&b.contains(K.target))){var C=Vl(A).find(function(E){return E.contains(K.target)});C&&Vl(C.getAttribute(bu),!0).some(function(E){return E===p.value})||L(K)}}function F(K){if(T.value=!1,!(t.trigger!=="hover"||m.value.contains(K.target))){var X=Vl(A).some(function(b){var C=b.getBoundingClientRect();return K.x>C.x&&K.x<C.x+C.width&&K.y>C.y&&K.y<C.y+C.height});X||(L(K),I==null||I.assertMouseLeave(K))}}function V(){T.value=!0,l.value&&t.trigger==="hover"&&M()}function Y(K){var X;(X=t.onOverlayClick)===null||X===void 0||X.call(t,{e:K})}var q=Ct("updateScrollTop",void 0);function Q(K){var X,b=K.target,C=b.scrollTop,E=b.clientHeight,N=b.scrollHeight,O=bD(function($){var G;return(G=t.onScrollToBottom)===null||G===void 0?void 0:G.call(t,{e:$})},100);E+Math.floor(C)===N&&O(K),(X=t.onScroll)===null||X===void 0||X.call(t,{e:K})}return ut(function(){return[l.value,w.value]},function(){l.value&&w.value&&q&&(q==null||q(w.value))}),function(){var K=h("content"),X=t.hideEmptyPopup&&["",void 0,null].includes(K),b=l.value||!t.destroyOnClose?tp(de("div",ni(ze(ze({},fb,A),bu,I==null?void 0:I.id),{class:[R.value,t.overlayClassName],ref:function(E){return p.value=E},style:[{zIndex:t.zIndex},S(),X&&{visibility:"hidden"}],onClick:Y,onMouseenter:V,onMouseleave:F}),[de("div",{class:["".concat(R.value,"__content"),ze(ze(ze({},"".concat(R.value,"__content--text"),dn(t.content)),"".concat(R.value,"__content--arrow"),t.showArrow),U.value.disabled,t.disabled),t.overlayInnerClassName],ref:w,onScroll:Q},[K,t.showArrow&&de("div",{class:"".concat(R.value,"__arrow")},null)])]),[[Lp,l.value]]):null;return de(_D,{ref:function(E){return x.value=E},forwardRef:function(E){return m.value=E},onContentMounted:function(){if(l.value){B();var E=setTimeout(function(){P(),clearTimeout(E)},60)}},onResize:function(){l.value&&B()},visible:l.value,attach:t.attach},{content:function(){return de(bf,{name:"".concat(R.value,"--animation").concat(t.expandAnimation?"-expand":""),appear:!0,onEnter:B,onAfterLeave:D},SD(b)?b:{default:function(){return[b]}})},default:function(){return d("default","triggerElement")}})}}});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var PD=yl(ED);/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function RD(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var ID=RD;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var Vv=Ya,MD=sn,LD=Bt,qv=Vv?Vv.isConcatSpreadable:void 0;function OD(e){return LD(e)||MD(e)||!!(qv&&e&&e[qv])}var DD=OD,BD=Pf,FD=DD;function hb(e,t,r,a,i){var o=-1,n=e.length;for(r||(r=FD),i||(i=[]);++o<n;){var s=e[o];t>0&&r(s)?t>1?hb(s,t-1,r,a,i):BD(i,s):a||(i[i.length]=s)}return i}var ND=hb,$D=ND;function jD(e){var t=e==null?0:e.length;return t?$D(e,1):[]}var zD=jD,HD=zD,WD=Kp,UD=Yp;function VD(e){return UD(WD(e,void 0,HD),e+"")}var qD=VD;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var KD=Of,YD=xm;function GD(e,t){return t.length<2?e:KD(e,YD(t,0,-1))}var XD=GD,QD=cl,JD=ID,ZD=XD,eB=hn;function tB(e,t){return t=QD(t,e),e=ZD(e,t),e==null||delete e[eB(JD(t))]}var rB=tB,iB=Xp;function aB(e){return iB(e)?void 0:e}var oB=aB,nB=ym,sB=i4,lB=rB,cB=cl,uB=Za,fB=oB,hB=qD,dB=um,vB=1,gB=2,yB=4,pB=hB(function(e,t){var r={};if(e==null)return r;var a=!1;t=nB(t,function(o){return o=cB(o,e),a||(a=o.length>1),o}),uB(e,dB(e),r),a&&(r=sB(r,vB|gB|yB,fB));for(var i=t.length;i--;)lB(r,t[i]);return r}),mB=pB;/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var bB={delay:{type:Number},destroyOnClose:{type:Boolean,default:!0},duration:{type:Number},placement:{type:String,default:"top"},showArrow:{type:Boolean,default:!0},theme:{type:String,default:"default",validator:function(t){return t?["default","primary","success","danger","warning","light"].includes(t):!0}}};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var wB=function(){var t=Ie(0),r=Ie(0),a=function(o){t.value=o.clientX,r.value=o.clientY};return Ff||(ir(function(){window.addEventListener("mousemove",a,{passive:!0})}),rn(function(){window.removeEventListener("mousemove",a)})),{x:t,y:r}};/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */function Kv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function sa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Kv(Object(r),!0).forEach(function(a){ze(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kv(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}var xB=Ge({name:"TTooltip",props:sa(sa({},qf),bB),setup:function(t,r){var a=Ie(null),i=Ie(null),o=uf(t),n=o.visible,s=o.modelValue,u=sb(n,s,t.defaultVisible,t.onVisibleChange,"visible"),c=ul(u,2),l=c[0],f=c[1],h=xi(),d=Ie(t.visible||t.defaultVisible),v=tt(),y=gn(),g=pl(),m=wB(),w=m.x,p=Ie(w.value);ir(function(){t.duration&&d.value&&(a.value=setTimeout(function(){f(!1,{}),clearTimeout(a.value),a.value=null},t.duration))});var x=function(U,_){a.value&&(_==null?void 0:_.trigger)!=="document"||(U&&(p.value=w.value),f(U,_))},T=fe(function(){return["".concat(v.value,"-tooltip"),ze({},"".concat(v.value,"-tooltip--").concat(t.theme),t.theme),t.overlayClassName]}),A=fe(function(){return sa(sa({},(h==null?void 0:h.vnode.props)||{}),{},{placement:t.placement==="mouse"?"bottom-left":t.placement,showArrow:t.placement==="mouse"?!1:t.showArrow,overlayClassName:T.value,onVisibleChange:x,disabled:t.disabled})}),I=fe(function(){if(t.placement!=="mouse"||p.value===0)return t.overlayInnerStyle;var z=function(_){return{transform:"translateX(".concat(p.value-_.getBoundingClientRect().left,"px)")}};return t.overlayInnerStyle?function(U,_){return sa(sa({},z(U)),Dt(t.overlayInnerStyle)?t.overlayInnerStyle(U,_):t.overlayInnerStyle)}:z});ut(function(){return d.value},function(){a.value&&!d.value&&(clearTimeout(a.value),a.value=null)});var R=function(){var U,_;(U=i.value)===null||U===void 0||(_=U.update)===null||_===void 0||_.call(U)};return r.expose({updatePopper:R}),function(){var z=y("content");return!z&&!t.content?g("default","triggerElement"):de(PD,ni(mB(A.value,["content","default"]),{ref:i,overlayInnerStyle:I.value,visible:l.value}),{default:function(){return[g("default","triggerElement")]},content:function(){return z}})}}});/**
 * tdesign v1.9.8
 * (c) 2024 tdesign
 * @license MIT
 */var CB=yl(xB);const wu=Ie(!1);function hK(){return{showLoading:()=>{wu.value=!0},hideLoading:()=>{wu.value=!1}}}const db=e=>(Z0("data-v-d0b99985"),e=e(),ep(),e),kB={class:"box"},_B=db(()=>Ce("div",{class:"boxLoading"},null,-1)),SB=db(()=>Ce("p",{class:"tip"},"加载中……",-1)),TB=[_B,SB],AB=Ge({__name:"Loading",setup(e){return(t,r)=>tp((Wi(),Xs("div",kB,TB,512)),[[Lp,bt(wu)]])}}),vb=(e,t)=>{const r=e.__vccOpts||e;for(const[a,i]of t)r[a]=i;return r},EB=vb(AB,[["__scopeId","data-v-d0b99985"]]);var qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dK(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function a(){return this instanceof a?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})}),r}var Kf={exports:{}},gb=function(t,r){return function(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];return t.apply(r,i)}},PB=gb,_i=Object.prototype.toString;function Yf(e){return Array.isArray(e)}function xu(e){return typeof e>"u"}function RB(e){return e!==null&&!xu(e)&&e.constructor!==null&&!xu(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function yb(e){return _i.call(e)==="[object ArrayBuffer]"}function IB(e){return _i.call(e)==="[object FormData]"}function MB(e){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&yb(e.buffer),t}function LB(e){return typeof e=="string"}function OB(e){return typeof e=="number"}function pb(e){return e!==null&&typeof e=="object"}function is(e){if(_i.call(e)!=="[object Object]")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function DB(e){return _i.call(e)==="[object Date]"}function BB(e){return _i.call(e)==="[object File]"}function FB(e){return _i.call(e)==="[object Blob]"}function mb(e){return _i.call(e)==="[object Function]"}function NB(e){return pb(e)&&mb(e.pipe)}function $B(e){return _i.call(e)==="[object URLSearchParams]"}function jB(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function zB(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Gf(e,t){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),Yf(e))for(var r=0,a=e.length;r<a;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}function Cu(){var e={};function t(i,o){is(e[o])&&is(i)?e[o]=Cu(e[o],i):is(i)?e[o]=Cu({},i):Yf(i)?e[o]=i.slice():e[o]=i}for(var r=0,a=arguments.length;r<a;r++)Gf(arguments[r],t);return e}function HB(e,t,r){return Gf(t,function(i,o){r&&typeof i=="function"?e[o]=PB(i,r):e[o]=i}),e}function WB(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var Ft={isArray:Yf,isArrayBuffer:yb,isBuffer:RB,isFormData:IB,isArrayBufferView:MB,isString:LB,isNumber:OB,isObject:pb,isPlainObject:is,isUndefined:xu,isDate:DB,isFile:BB,isBlob:FB,isFunction:mb,isStream:NB,isURLSearchParams:$B,isStandardBrowserEnv:zB,forEach:Gf,merge:Cu,extend:HB,trim:jB,stripBOM:WB},la=Ft;function Yv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var bb=function(t,r,a){if(!r)return t;var i;if(a)i=a(r);else if(la.isURLSearchParams(r))i=r.toString();else{var o=[];la.forEach(r,function(u,c){u===null||typeof u>"u"||(la.isArray(u)?c=c+"[]":u=[u],la.forEach(u,function(f){la.isDate(f)?f=f.toISOString():la.isObject(f)&&(f=JSON.stringify(f)),o.push(Yv(c)+"="+Yv(f))}))}),i=o.join("&")}if(i){var n=t.indexOf("#");n!==-1&&(t=t.slice(0,n)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t},UB=Ft;function wl(){this.handlers=[]}wl.prototype.use=function(t,r,a){return this.handlers.push({fulfilled:t,rejected:r,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1};wl.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};wl.prototype.forEach=function(t){UB.forEach(this.handlers,function(a){a!==null&&t(a)})};var VB=wl,qB=Ft,KB=function(t,r){qB.forEach(t,function(i,o){o!==r&&o.toUpperCase()===r.toUpperCase()&&(t[r]=i,delete t[o])})},wb=function(t,r,a,i,o){return t.config=r,a&&(t.code=a),t.request=i,t.response=o,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},xb={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ql,Gv;function Cb(){if(Gv)return ql;Gv=1;var e=wb;return ql=function(r,a,i,o,n){var s=new Error(r);return e(s,a,i,o,n)},ql}var Kl,Xv;function YB(){if(Xv)return Kl;Xv=1;var e=Cb();return Kl=function(r,a,i){var o=i.config.validateStatus;!i.status||!o||o(i.status)?r(i):a(e("Request failed with status code "+i.status,i.config,null,i.request,i))},Kl}var Yl,Qv;function GB(){if(Qv)return Yl;Qv=1;var e=Ft;return Yl=e.isStandardBrowserEnv()?function(){return{write:function(a,i,o,n,s,u){var c=[];c.push(a+"="+encodeURIComponent(i)),e.isNumber(o)&&c.push("expires="+new Date(o).toGMTString()),e.isString(n)&&c.push("path="+n),e.isString(s)&&c.push("domain="+s),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(a){var i=document.cookie.match(new RegExp("(^|;\\s*)("+a+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(a){this.write(a,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Yl}var Gl,Jv;function XB(){return Jv||(Jv=1,Gl=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}),Gl}var Xl,Zv;function QB(){return Zv||(Zv=1,Xl=function(t,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t}),Xl}var Ql,eg;function JB(){if(eg)return Ql;eg=1;var e=XB(),t=QB();return Ql=function(a,i){return a&&!e(i)?t(a,i):i},Ql}var Jl,tg;function ZB(){if(tg)return Jl;tg=1;var e=Ft,t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return Jl=function(a){var i={},o,n,s;return a&&e.forEach(a.split(`
`),function(c){if(s=c.indexOf(":"),o=e.trim(c.substr(0,s)).toLowerCase(),n=e.trim(c.substr(s+1)),o){if(i[o]&&t.indexOf(o)>=0)return;o==="set-cookie"?i[o]=(i[o]?i[o]:[]).concat([n]):i[o]=i[o]?i[o]+", "+n:n}}),i},Jl}var Zl,rg;function eF(){if(rg)return Zl;rg=1;var e=Ft;return Zl=e.isStandardBrowserEnv()?function(){var r=/(msie|trident)/i.test(navigator.userAgent),a=document.createElement("a"),i;function o(n){var s=n;return r&&(a.setAttribute("href",s),s=a.href),a.setAttribute("href",s),{href:a.href,protocol:a.protocol?a.protocol.replace(/:$/,""):"",host:a.host,search:a.search?a.search.replace(/^\?/,""):"",hash:a.hash?a.hash.replace(/^#/,""):"",hostname:a.hostname,port:a.port,pathname:a.pathname.charAt(0)==="/"?a.pathname:"/"+a.pathname}}return i=o(window.location.href),function(s){var u=e.isString(s)?o(s):s;return u.protocol===i.protocol&&u.host===i.host}}():function(){return function(){return!0}}(),Zl}var ec,ig;function xl(){if(ig)return ec;ig=1;function e(t){this.message=t}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,ec=e,ec}var tc,ag;function og(){if(ag)return tc;ag=1;var e=Ft,t=YB(),r=GB(),a=bb,i=JB(),o=ZB(),n=eF(),s=Cb(),u=xb,c=xl();return tc=function(f){return new Promise(function(d,v){var y=f.data,g=f.headers,m=f.responseType,w;function p(){f.cancelToken&&f.cancelToken.unsubscribe(w),f.signal&&f.signal.removeEventListener("abort",w)}e.isFormData(y)&&delete g["Content-Type"];var x=new XMLHttpRequest;if(f.auth){var T=f.auth.username||"",A=f.auth.password?unescape(encodeURIComponent(f.auth.password)):"";g.Authorization="Basic "+btoa(T+":"+A)}var I=i(f.baseURL,f.url);x.open(f.method.toUpperCase(),a(I,f.params,f.paramsSerializer),!0),x.timeout=f.timeout;function R(){if(x){var U="getAllResponseHeaders"in x?o(x.getAllResponseHeaders()):null,_=!m||m==="text"||m==="json"?x.responseText:x.response,k={data:_,status:x.status,statusText:x.statusText,headers:U,config:f,request:x};t(function(P){d(P),p()},function(P){v(P),p()},k),x=null}}if("onloadend"in x?x.onloadend=R:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(R)},x.onabort=function(){x&&(v(s("Request aborted",f,"ECONNABORTED",x)),x=null)},x.onerror=function(){v(s("Network Error",f,null,x)),x=null},x.ontimeout=function(){var _=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded",k=f.transitional||u;f.timeoutErrorMessage&&(_=f.timeoutErrorMessage),v(s(_,f,k.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",x)),x=null},e.isStandardBrowserEnv()){var z=(f.withCredentials||n(I))&&f.xsrfCookieName?r.read(f.xsrfCookieName):void 0;z&&(g[f.xsrfHeaderName]=z)}"setRequestHeader"in x&&e.forEach(g,function(_,k){typeof y>"u"&&k.toLowerCase()==="content-type"?delete g[k]:x.setRequestHeader(k,_)}),e.isUndefined(f.withCredentials)||(x.withCredentials=!!f.withCredentials),m&&m!=="json"&&(x.responseType=f.responseType),typeof f.onDownloadProgress=="function"&&x.addEventListener("progress",f.onDownloadProgress),typeof f.onUploadProgress=="function"&&x.upload&&x.upload.addEventListener("progress",f.onUploadProgress),(f.cancelToken||f.signal)&&(w=function(U){x&&(v(!U||U&&U.type?new c("canceled"):U),x.abort(),x=null)},f.cancelToken&&f.cancelToken.subscribe(w),f.signal&&(f.signal.aborted?w():f.signal.addEventListener("abort",w))),y||(y=null),x.send(y)})},tc}var lt=Ft,ng=KB,tF=wb,rF=xb,iF={"Content-Type":"application/x-www-form-urlencoded"};function sg(e,t){!lt.isUndefined(e)&&lt.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function aF(){var e;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(e=og()),e}function oF(e,t,r){if(lt.isString(e))try{return(t||JSON.parse)(e),lt.trim(e)}catch(a){if(a.name!=="SyntaxError")throw a}return(0,JSON.stringify)(e)}var Cl={transitional:rF,adapter:aF(),transformRequest:[function(t,r){return ng(r,"Accept"),ng(r,"Content-Type"),lt.isFormData(t)||lt.isArrayBuffer(t)||lt.isBuffer(t)||lt.isStream(t)||lt.isFile(t)||lt.isBlob(t)?t:lt.isArrayBufferView(t)?t.buffer:lt.isURLSearchParams(t)?(sg(r,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):lt.isObject(t)||r&&r["Content-Type"]==="application/json"?(sg(r,"application/json"),oF(t)):t}],transformResponse:[function(t){var r=this.transitional||Cl.transitional,a=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,o=!a&&this.responseType==="json";if(o||i&&lt.isString(t)&&t.length)try{return JSON.parse(t)}catch(n){if(o)throw n.name==="SyntaxError"?tF(n,this,"E_JSON_PARSE"):n}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};lt.forEach(["delete","get","head"],function(t){Cl.headers[t]={}});lt.forEach(["post","put","patch"],function(t){Cl.headers[t]=lt.merge(iF)});var Xf=Cl,nF=Ft,sF=Xf,lF=function(t,r,a){var i=this||sF;return nF.forEach(a,function(n){t=n.call(i,t,r)}),t},rc,lg;function kb(){return lg||(lg=1,rc=function(t){return!!(t&&t.__CANCEL__)}),rc}var cg=Ft,ic=lF,cF=kb(),uF=Xf,fF=xl();function ac(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fF("canceled")}var hF=function(t){ac(t),t.headers=t.headers||{},t.data=ic.call(t,t.data,t.headers,t.transformRequest),t.headers=cg.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),cg.forEach(["delete","get","head","post","put","patch","common"],function(i){delete t.headers[i]});var r=t.adapter||uF.adapter;return r(t).then(function(i){return ac(t),i.data=ic.call(t,i.data,i.headers,t.transformResponse),i},function(i){return cF(i)||(ac(t),i&&i.response&&(i.response.data=ic.call(t,i.response.data,i.response.headers,t.transformResponse))),Promise.reject(i)})},$t=Ft,_b=function(t,r){r=r||{};var a={};function i(l,f){return $t.isPlainObject(l)&&$t.isPlainObject(f)?$t.merge(l,f):$t.isPlainObject(f)?$t.merge({},f):$t.isArray(f)?f.slice():f}function o(l){if($t.isUndefined(r[l])){if(!$t.isUndefined(t[l]))return i(void 0,t[l])}else return i(t[l],r[l])}function n(l){if(!$t.isUndefined(r[l]))return i(void 0,r[l])}function s(l){if($t.isUndefined(r[l])){if(!$t.isUndefined(t[l]))return i(void 0,t[l])}else return i(void 0,r[l])}function u(l){if(l in r)return i(t[l],r[l]);if(l in t)return i(void 0,t[l])}var c={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:u};return $t.forEach(Object.keys(t).concat(Object.keys(r)),function(f){var h=c[f]||o,d=h(f);$t.isUndefined(d)&&h!==u||(a[f]=d)}),a},oc,ug;function Sb(){return ug||(ug=1,oc={version:"0.26.1"}),oc}var dF=Sb().version,Qf={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){Qf[e]=function(a){return typeof a===e||"a"+(t<1?"n ":" ")+e}});var fg={};Qf.transitional=function(t,r,a){function i(o,n){return"[Axios v"+dF+"] Transitional option '"+o+"'"+n+(a?". "+a:"")}return function(o,n,s){if(t===!1)throw new Error(i(n," has been removed"+(r?" in "+r:"")));return r&&!fg[n]&&(fg[n]=!0,console.warn(i(n," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,n,s):!0}};function vF(e,t,r){if(typeof e!="object")throw new TypeError("options must be an object");for(var a=Object.keys(e),i=a.length;i-- >0;){var o=a[i],n=t[o];if(n){var s=e[o],u=s===void 0||n(s,o,e);if(u!==!0)throw new TypeError("option "+o+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+o)}}var gF={assertOptions:vF,validators:Qf},Tb=Ft,yF=bb,hg=VB,dg=hF,kl=_b,Ab=gF,ca=Ab.validators;function bn(e){this.defaults=e,this.interceptors={request:new hg,response:new hg}}bn.prototype.request=function(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=kl(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var a=r.transitional;a!==void 0&&Ab.assertOptions(a,{silentJSONParsing:ca.transitional(ca.boolean),forcedJSONParsing:ca.transitional(ca.boolean),clarifyTimeoutError:ca.transitional(ca.boolean)},!1);var i=[],o=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(r)===!1||(o=o&&d.synchronous,i.unshift(d.fulfilled,d.rejected))});var n=[];this.interceptors.response.forEach(function(d){n.push(d.fulfilled,d.rejected)});var s;if(!o){var u=[dg,void 0];for(Array.prototype.unshift.apply(u,i),u=u.concat(n),s=Promise.resolve(r);u.length;)s=s.then(u.shift(),u.shift());return s}for(var c=r;i.length;){var l=i.shift(),f=i.shift();try{c=l(c)}catch(h){f(h);break}}try{s=dg(c)}catch(h){return Promise.reject(h)}for(;n.length;)s=s.then(n.shift(),n.shift());return s};bn.prototype.getUri=function(t){return t=kl(this.defaults,t),yF(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")};Tb.forEach(["delete","get","head","options"],function(t){bn.prototype[t]=function(r,a){return this.request(kl(a||{},{method:t,url:r,data:(a||{}).data}))}});Tb.forEach(["post","put","patch"],function(t){bn.prototype[t]=function(r,a,i){return this.request(kl(i||{},{method:t,url:r,data:a}))}});var pF=bn,nc,vg;function mF(){if(vg)return nc;vg=1;var e=xl();function t(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var a;this.promise=new Promise(function(n){a=n});var i=this;this.promise.then(function(o){if(i._listeners){var n,s=i._listeners.length;for(n=0;n<s;n++)i._listeners[n](o);i._listeners=null}}),this.promise.then=function(o){var n,s=new Promise(function(u){i.subscribe(u),n=u}).then(o);return s.cancel=function(){i.unsubscribe(n)},s},r(function(n){i.reason||(i.reason=new e(n),a(i.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]},t.prototype.unsubscribe=function(a){if(this._listeners){var i=this._listeners.indexOf(a);i!==-1&&this._listeners.splice(i,1)}},t.source=function(){var a,i=new t(function(n){a=n});return{token:i,cancel:a}},nc=t,nc}var sc,gg;function bF(){return gg||(gg=1,sc=function(t){return function(a){return t.apply(null,a)}}),sc}var lc,yg;function wF(){if(yg)return lc;yg=1;var e=Ft;return lc=function(r){return e.isObject(r)&&r.isAxiosError===!0},lc}var pg=Ft,xF=gb,as=pF,CF=_b,kF=Xf;function Eb(e){var t=new as(e),r=xF(as.prototype.request,t);return pg.extend(r,as.prototype,t),pg.extend(r,t),r.create=function(i){return Eb(CF(e,i))},r}var Ar=Eb(kF);Ar.Axios=as;Ar.Cancel=xl();Ar.CancelToken=mF();Ar.isCancel=kb();Ar.VERSION=Sb().version;Ar.all=function(t){return Promise.all(t)};Ar.spread=bF();Ar.isAxiosError=wF();Kf.exports=Ar;Kf.exports.default=Ar;var _F=Kf.exports,SF=_F;const $a=bl(SF);var Pb={exports:{}};(function(e,t){(function(r,a){e.exports=a()})(qe,function(){var r=1e3,a=6e4,i=36e5,o="millisecond",n="second",s="minute",u="hour",c="day",l="week",f="month",h="quarter",d="year",v="date",y="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(P){var B=["th","st","nd","rd"],D=P%100;return"["+P+(B[(D-20)%10]||B[D]||B[0])+"]"}},p=function(P,B,D){var H=String(P);return!H||H.length>=B?P:""+Array(B+1-H.length).join(D)+P},x={s:p,z:function(P){var B=-P.utcOffset(),D=Math.abs(B),H=Math.floor(D/60),L=D%60;return(B<=0?"+":"-")+p(H,2,"0")+":"+p(L,2,"0")},m:function P(B,D){if(B.date()<D.date())return-P(D,B);var H=12*(D.year()-B.year())+(D.month()-B.month()),L=B.clone().add(H,f),M=D-L<0,j=B.clone().add(H+(M?-1:1),f);return+(-(H+(D-L)/(M?L-j:j-L))||0)},a:function(P){return P<0?Math.ceil(P)||0:Math.floor(P)},p:function(P){return{M:f,y:d,w:l,d:c,D:v,h:u,m:s,s:n,ms:o,Q:h}[P]||String(P||"").toLowerCase().replace(/s$/,"")},u:function(P){return P===void 0}},T="en",A={};A[T]=w;var I="$isDayjsObject",R=function(P){return P instanceof k||!(!P||!P[I])},z=function P(B,D,H){var L;if(!B)return T;if(typeof B=="string"){var M=B.toLowerCase();A[M]&&(L=M),D&&(A[M]=D,L=M);var j=B.split("-");if(!L&&j.length>1)return P(j[0])}else{var W=B.name;A[W]=B,L=W}return!H&&L&&(T=L),L||!H&&T},U=function(P,B){if(R(P))return P.clone();var D=typeof B=="object"?B:{};return D.date=P,D.args=arguments,new k(D)},_=x;_.l=z,_.i=R,_.w=function(P,B){return U(P,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var k=function(){function P(D){this.$L=z(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[I]=!0}var B=P.prototype;return B.parse=function(D){this.$d=function(H){var L=H.date,M=H.utc;if(L===null)return new Date(NaN);if(_.u(L))return new Date;if(L instanceof Date)return new Date(L);if(typeof L=="string"&&!/Z$/i.test(L)){var j=L.match(g);if(j){var W=j[2]-1||0,F=(j[7]||"0").substring(0,3);return M?new Date(Date.UTC(j[1],W,j[3]||1,j[4]||0,j[5]||0,j[6]||0,F)):new Date(j[1],W,j[3]||1,j[4]||0,j[5]||0,j[6]||0,F)}}return new Date(L)}(D),this.init()},B.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},B.$utils=function(){return _},B.isValid=function(){return this.$d.toString()!==y},B.isSame=function(D,H){var L=U(D);return this.startOf(H)<=L&&L<=this.endOf(H)},B.isAfter=function(D,H){return U(D)<this.startOf(H)},B.isBefore=function(D,H){return this.endOf(H)<U(D)},B.$g=function(D,H,L){return _.u(D)?this[H]:this.set(L,D)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(D,H){var L=this,M=!!_.u(H)||H,j=_.p(D),W=function(b,C){var E=_.w(L.$u?Date.UTC(L.$y,C,b):new Date(L.$y,C,b),L);return M?E:E.endOf(c)},F=function(b,C){return _.w(L.toDate()[b].apply(L.toDate("s"),(M?[0,0,0,0]:[23,59,59,999]).slice(C)),L)},V=this.$W,Y=this.$M,q=this.$D,Q="set"+(this.$u?"UTC":"");switch(j){case d:return M?W(1,0):W(31,11);case f:return M?W(1,Y):W(0,Y+1);case l:var K=this.$locale().weekStart||0,X=(V<K?V+7:V)-K;return W(M?q-X:q+(6-X),Y);case c:case v:return F(Q+"Hours",0);case u:return F(Q+"Minutes",1);case s:return F(Q+"Seconds",2);case n:return F(Q+"Milliseconds",3);default:return this.clone()}},B.endOf=function(D){return this.startOf(D,!1)},B.$set=function(D,H){var L,M=_.p(D),j="set"+(this.$u?"UTC":""),W=(L={},L[c]=j+"Date",L[v]=j+"Date",L[f]=j+"Month",L[d]=j+"FullYear",L[u]=j+"Hours",L[s]=j+"Minutes",L[n]=j+"Seconds",L[o]=j+"Milliseconds",L)[M],F=M===c?this.$D+(H-this.$W):H;if(M===f||M===d){var V=this.clone().set(v,1);V.$d[W](F),V.init(),this.$d=V.set(v,Math.min(this.$D,V.daysInMonth())).$d}else W&&this.$d[W](F);return this.init(),this},B.set=function(D,H){return this.clone().$set(D,H)},B.get=function(D){return this[_.p(D)]()},B.add=function(D,H){var L,M=this;D=Number(D);var j=_.p(H),W=function(Y){var q=U(M);return _.w(q.date(q.date()+Math.round(Y*D)),M)};if(j===f)return this.set(f,this.$M+D);if(j===d)return this.set(d,this.$y+D);if(j===c)return W(1);if(j===l)return W(7);var F=(L={},L[s]=a,L[u]=i,L[n]=r,L)[j]||1,V=this.$d.getTime()+D*F;return _.w(V,this)},B.subtract=function(D,H){return this.add(-1*D,H)},B.format=function(D){var H=this,L=this.$locale();if(!this.isValid())return L.invalidDate||y;var M=D||"YYYY-MM-DDTHH:mm:ssZ",j=_.z(this),W=this.$H,F=this.$m,V=this.$M,Y=L.weekdays,q=L.months,Q=L.meridiem,K=function(C,E,N,O){return C&&(C[E]||C(H,M))||N[E].slice(0,O)},X=function(C){return _.s(W%12||12,C,"0")},b=Q||function(C,E,N){var O=C<12?"AM":"PM";return N?O.toLowerCase():O};return M.replace(m,function(C,E){return E||function(N){switch(N){case"YY":return String(H.$y).slice(-2);case"YYYY":return _.s(H.$y,4,"0");case"M":return V+1;case"MM":return _.s(V+1,2,"0");case"MMM":return K(L.monthsShort,V,q,3);case"MMMM":return K(q,V);case"D":return H.$D;case"DD":return _.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return K(L.weekdaysMin,H.$W,Y,2);case"ddd":return K(L.weekdaysShort,H.$W,Y,3);case"dddd":return Y[H.$W];case"H":return String(W);case"HH":return _.s(W,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return b(W,F,!0);case"A":return b(W,F,!1);case"m":return String(F);case"mm":return _.s(F,2,"0");case"s":return String(H.$s);case"ss":return _.s(H.$s,2,"0");case"SSS":return _.s(H.$ms,3,"0");case"Z":return j}return null}(C)||j.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(D,H,L){var M,j=this,W=_.p(H),F=U(D),V=(F.utcOffset()-this.utcOffset())*a,Y=this-F,q=function(){return _.m(j,F)};switch(W){case d:M=q()/12;break;case f:M=q();break;case h:M=q()/3;break;case l:M=(Y-V)/6048e5;break;case c:M=(Y-V)/864e5;break;case u:M=Y/i;break;case s:M=Y/a;break;case n:M=Y/r;break;default:M=Y}return L?M:_.a(M)},B.daysInMonth=function(){return this.endOf(f).$D},B.$locale=function(){return A[this.$L]},B.locale=function(D,H){if(!D)return this.$L;var L=this.clone(),M=z(D,H,!0);return M&&(L.$L=M),L},B.clone=function(){return _.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},P}(),S=k.prototype;return U.prototype=S,[["$ms",o],["$s",n],["$m",s],["$H",u],["$W",c],["$M",f],["$y",d],["$D",v]].forEach(function(P){S[P[1]]=function(B){return this.$g(B,P[0],P[1])}}),U.extend=function(P,B){return P.$i||(P(B,k,U),P.$i=!0),U},U.locale=z,U.isDayjs=R,U.unix=function(P){return U(1e3*P)},U.en=A[T],U.Ls=A,U.p={},U})})(Pb);var Rb=Pb.exports;const Jf=bl(Rb);function TF(e){if(!(!e||typeof e!="object")){Array.isArray(e)&&(e.length=0);for(const t in e)e[t]=void 0}}function mg(e,t){TF(e),Object.assign(e,t)}function Ib(e){let t;const r=new RegExp("(^| )"+e+"=([^;]*)(;|$)");return(t=document.cookie.match(r))?decodeURIComponent(t[2]):""}function Mb(e,t,r){const a=window;let i=a.escape(e)+"="+a.escape(t)+";";if(r||(r={}),r.expires){const o=new Date(new Date().getTime()+r.expires*1e3*60*60*24);i+="expires="+o.toUTCString()+";"}r.path&&(i+="path="+r.path+";"),r.domain&&(i+="domain="+r.domain+";"),document.cookie=i}function AF(e,t){Ib(e)&&(t||(t={}),t.expires=-1,Mb(e,"",t))}const co=ta({id:""}),bg=ta({unread:0}),wg=()=>{let e=location.hostname;const t=e.split(".");return t.length<3||t.length===4&&+t[0]>0&&+t[1]>0&&+t[2]>0&&+t[3]>0?e=location.hostname:e.endsWith(".com.cn")||e.endsWith(".org.cn")?e=t.slice(-3).join("."):e=t.slice(-2).join("."),e},Lb=()=>{const e=async(i,o="/account/profile")=>{const n={},s=await $a.get(o,{params:n});if(s)return s.amount||(s.amount=0),r(s),co},t=async()=>{const i=await $a.post("/message/unread/count");i&&(bg.unread=i.unread)},r=async i=>{if(i.department&&!i.department.id&&delete i.department,i.vip){const o=new Date(i.vip);o>new Date?(i.vipExpired=!1,i.vipData?i.vipData.name||(i.vipData.name="普通会员"):i.vipData={name:"普通会员"}):o>new Date("2023-01-17T08:00:00+08:00")?i.vipExpired=!0:i.vip=void 0}if(i.roles){for(const o of i.roles)if(o.indexOf("运营")>-1){i.isOperation=!0;break}}i.created=Jf(i.createdAt).format("YYYY-MM-DD HH:mm:ss"),i.token&&(Mb("token",i.token,{path:"/",domain:wg()}),delete i.token),mg(co,i),window.userId=co.id};return{user:co,message:bg,getUser:e,getMessage:t,setUser:r,signout:()=>{mg(co,{});const i=wg();i&&AF("token",{path:"/",domain:i})}}};/*!
  * vue-router v4.4.2
  * (c) 2024 Eduardo San Martin Morote
  * @license MIT
  */const ga=typeof document<"u";function EF(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const Le=Object.assign;function cc(e,t){const r={};for(const a in t){const i=t[a];r[a]=cr(i)?i.map(e):e(i)}return r}const Po=()=>{},cr=Array.isArray,Ob=/#/g,PF=/&/g,RF=/\//g,IF=/=/g,MF=/\?/g,Db=/\+/g,LF=/%5B/g,OF=/%5D/g,Bb=/%5E/g,DF=/%60/g,Fb=/%7B/g,BF=/%7C/g,Nb=/%7D/g,FF=/%20/g;function Zf(e){return encodeURI(""+e).replace(BF,"|").replace(LF,"[").replace(OF,"]")}function NF(e){return Zf(e).replace(Fb,"{").replace(Nb,"}").replace(Bb,"^")}function ku(e){return Zf(e).replace(Db,"%2B").replace(FF,"+").replace(Ob,"%23").replace(PF,"%26").replace(DF,"`").replace(Fb,"{").replace(Nb,"}").replace(Bb,"^")}function $F(e){return ku(e).replace(IF,"%3D")}function jF(e){return Zf(e).replace(Ob,"%23").replace(MF,"%3F")}function zF(e){return e==null?"":jF(e).replace(RF,"%2F")}function Ko(e){try{return decodeURIComponent(""+e)}catch{}return""+e}const HF=/\/$/,WF=e=>e.replace(HF,"");function uc(e,t,r="/"){let a,i={},o="",n="";const s=t.indexOf("#");let u=t.indexOf("?");return s<u&&s>=0&&(u=-1),u>-1&&(a=t.slice(0,u),o=t.slice(u+1,s>-1?s:t.length),i=e(o)),s>-1&&(a=a||t.slice(0,s),n=t.slice(s,t.length)),a=KF(a??t,r),{fullPath:a+(o&&"?")+o+n,path:a,query:i,hash:Ko(n)}}function UF(e,t){const r=t.query?e(t.query):"";return t.path+(r&&"?")+r+(t.hash||"")}function xg(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function VF(e,t,r){const a=t.matched.length-1,i=r.matched.length-1;return a>-1&&a===i&&ja(t.matched[a],r.matched[i])&&$b(t.params,r.params)&&e(t.query)===e(r.query)&&t.hash===r.hash}function ja(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function $b(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(!qF(e[r],t[r]))return!1;return!0}function qF(e,t){return cr(e)?Cg(e,t):cr(t)?Cg(t,e):e===t}function Cg(e,t){return cr(t)?e.length===t.length&&e.every((r,a)=>r===t[a]):e.length===1&&e[0]===t}function KF(e,t){if(e.startsWith("/"))return e;if(!e)return t;const r=t.split("/"),a=e.split("/"),i=a[a.length-1];(i===".."||i===".")&&a.push("");let o=r.length-1,n,s;for(n=0;n<a.length;n++)if(s=a[n],s!==".")if(s==="..")o>1&&o--;else break;return r.slice(0,o).join("/")+"/"+a.slice(n).join("/")}const Gr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var Yo;(function(e){e.pop="pop",e.push="push"})(Yo||(Yo={}));var Ro;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Ro||(Ro={}));function YF(e){if(!e)if(ga){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),WF(e)}const GF=/^[^#]+#/;function XF(e,t){return e.replace(GF,"#")+t}function QF(e,t){const r=document.documentElement.getBoundingClientRect(),a=e.getBoundingClientRect();return{behavior:t.behavior,left:a.left-r.left-(t.left||0),top:a.top-r.top-(t.top||0)}}const _l=()=>({left:window.scrollX,top:window.scrollY});function JF(e){let t;if("el"in e){const r=e.el,a=typeof r=="string"&&r.startsWith("#"),i=typeof r=="string"?a?document.getElementById(r.slice(1)):document.querySelector(r):r;if(!i)return;t=QF(i,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function kg(e,t){return(history.state?history.state.position-t:-1)+e}const _u=new Map;function ZF(e,t){_u.set(e,t)}function e9(e){const t=_u.get(e);return _u.delete(e),t}let t9=()=>location.protocol+"//"+location.host;function jb(e,t){const{pathname:r,search:a,hash:i}=t,o=e.indexOf("#");if(o>-1){let s=i.includes(e.slice(o))?e.slice(o).length:1,u=i.slice(s);return u[0]!=="/"&&(u="/"+u),xg(u,"")}return xg(r,e)+a+i}function r9(e,t,r,a){let i=[],o=[],n=null;const s=({state:h})=>{const d=jb(e,location),v=r.value,y=t.value;let g=0;if(h){if(r.value=d,t.value=h,n&&n===v){n=null;return}g=y?h.position-y.position:0}else a(d);i.forEach(m=>{m(r.value,v,{delta:g,type:Yo.pop,direction:g?g>0?Ro.forward:Ro.back:Ro.unknown})})};function u(){n=r.value}function c(h){i.push(h);const d=()=>{const v=i.indexOf(h);v>-1&&i.splice(v,1)};return o.push(d),d}function l(){const{history:h}=window;h.state&&h.replaceState(Le({},h.state,{scroll:_l()}),"")}function f(){for(const h of o)h();o=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",l)}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",l,{passive:!0}),{pauseListeners:u,listen:c,destroy:f}}function _g(e,t,r,a=!1,i=!1){return{back:e,current:t,forward:r,replaced:a,position:window.history.length,scroll:i?_l():null}}function i9(e){const{history:t,location:r}=window,a={value:jb(e,r)},i={value:t.state};i.value||o(a.value,{back:null,current:a.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(u,c,l){const f=e.indexOf("#"),h=f>-1?(r.host&&document.querySelector("base")?e:e.slice(f))+u:t9()+e+u;try{t[l?"replaceState":"pushState"](c,"",h),i.value=c}catch(d){console.error(d),r[l?"replace":"assign"](h)}}function n(u,c){const l=Le({},t.state,_g(i.value.back,u,i.value.forward,!0),c,{position:i.value.position});o(u,l,!0),a.value=u}function s(u,c){const l=Le({},i.value,t.state,{forward:u,scroll:_l()});o(l.current,l,!0);const f=Le({},_g(a.value,u,null),{position:l.position+1},c);o(u,f,!1),a.value=u}return{location:a,state:i,push:s,replace:n}}function a9(e){e=YF(e);const t=i9(e),r=r9(e,t.state,t.location,t.replace);function a(o,n=!0){n||r.pauseListeners(),history.go(o)}const i=Le({location:"",base:e,go:a,createHref:XF.bind(null,e)},t,r);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>t.state.value}),i}function o9(e){return typeof e=="string"||e&&typeof e=="object"}function zb(e){return typeof e=="string"||typeof e=="symbol"}const Hb=Symbol("");var Sg;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(Sg||(Sg={}));function za(e,t){return Le(new Error,{type:e,[Hb]:!0},t)}function Er(e,t){return e instanceof Error&&Hb in e&&(t==null||!!(e.type&t))}const Tg="[^/]+?",n9={sensitive:!1,strict:!1,start:!0,end:!0},s9=/[.+*?^${}()[\]/\\]/g;function l9(e,t){const r=Le({},n9,t),a=[];let i=r.start?"^":"";const o=[];for(const c of e){const l=c.length?[]:[90];r.strict&&!c.length&&(i+="/");for(let f=0;f<c.length;f++){const h=c[f];let d=40+(r.sensitive?.25:0);if(h.type===0)f||(i+="/"),i+=h.value.replace(s9,"\\$&"),d+=40;else if(h.type===1){const{value:v,repeatable:y,optional:g,regexp:m}=h;o.push({name:v,repeatable:y,optional:g});const w=m||Tg;if(w!==Tg){d+=10;try{new RegExp(`(${w})`)}catch(x){throw new Error(`Invalid custom RegExp for param "${v}" (${w}): `+x.message)}}let p=y?`((?:${w})(?:/(?:${w}))*)`:`(${w})`;f||(p=g&&c.length<2?`(?:/${p})`:"/"+p),g&&(p+="?"),i+=p,d+=20,g&&(d+=-8),y&&(d+=-20),w===".*"&&(d+=-50)}l.push(d)}a.push(l)}if(r.strict&&r.end){const c=a.length-1;a[c][a[c].length-1]+=.7000000000000001}r.strict||(i+="/?"),r.end?i+="$":r.strict&&(i+="(?:/|$)");const n=new RegExp(i,r.sensitive?"":"i");function s(c){const l=c.match(n),f={};if(!l)return null;for(let h=1;h<l.length;h++){const d=l[h]||"",v=o[h-1];f[v.name]=d&&v.repeatable?d.split("/"):d}return f}function u(c){let l="",f=!1;for(const h of e){(!f||!l.endsWith("/"))&&(l+="/"),f=!1;for(const d of h)if(d.type===0)l+=d.value;else if(d.type===1){const{value:v,repeatable:y,optional:g}=d,m=v in c?c[v]:"";if(cr(m)&&!y)throw new Error(`Provided param "${v}" is an array but it is not repeatable (* or + modifiers)`);const w=cr(m)?m.join("/"):m;if(!w)if(g)h.length<2&&(l.endsWith("/")?l=l.slice(0,-1):f=!0);else throw new Error(`Missing required param "${v}"`);l+=w}}return l||"/"}return{re:n,score:a,keys:o,parse:s,stringify:u}}function c9(e,t){let r=0;for(;r<e.length&&r<t.length;){const a=t[r]-e[r];if(a)return a;r++}return e.length<t.length?e.length===1&&e[0]===80?-1:1:e.length>t.length?t.length===1&&t[0]===80?1:-1:0}function Wb(e,t){let r=0;const a=e.score,i=t.score;for(;r<a.length&&r<i.length;){const o=c9(a[r],i[r]);if(o)return o;r++}if(Math.abs(i.length-a.length)===1){if(Ag(a))return 1;if(Ag(i))return-1}return i.length-a.length}function Ag(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const u9={type:0,value:""},f9=/[a-zA-Z0-9_]/;function h9(e){if(!e)return[[]];if(e==="/")return[[u9]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(d){throw new Error(`ERR (${r})/"${c}": ${d}`)}let r=0,a=r;const i=[];let o;function n(){o&&i.push(o),o=[]}let s=0,u,c="",l="";function f(){c&&(r===0?o.push({type:0,value:c}):r===1||r===2||r===3?(o.length>1&&(u==="*"||u==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:c,regexp:l,repeatable:u==="*"||u==="+",optional:u==="*"||u==="?"})):t("Invalid state to consume buffer"),c="")}function h(){c+=u}for(;s<e.length;){if(u=e[s++],u==="\\"&&r!==2){a=r,r=4;continue}switch(r){case 0:u==="/"?(c&&f(),n()):u===":"?(f(),r=1):h();break;case 4:h(),r=a;break;case 1:u==="("?r=2:f9.test(u)?h():(f(),r=0,u!=="*"&&u!=="?"&&u!=="+"&&s--);break;case 2:u===")"?l[l.length-1]=="\\"?l=l.slice(0,-1)+u:r=3:l+=u;break;case 3:f(),r=0,u!=="*"&&u!=="?"&&u!=="+"&&s--,l="";break;default:t("Unknown state");break}}return r===2&&t(`Unfinished custom RegExp for param "${c}"`),f(),n(),i}function d9(e,t,r){const a=l9(h9(e.path),r),i=Le(a,{record:e,parent:t,children:[],alias:[]});return t&&!i.record.aliasOf==!t.record.aliasOf&&t.children.push(i),i}function v9(e,t){const r=[],a=new Map;t=Rg({strict:!1,end:!0,sensitive:!1},t);function i(f){return a.get(f)}function o(f,h,d){const v=!d,y=g9(f);y.aliasOf=d&&d.record;const g=Rg(t,f),m=[y];if("alias"in f){const x=typeof f.alias=="string"?[f.alias]:f.alias;for(const T of x)m.push(Le({},y,{components:d?d.record.components:y.components,path:T,aliasOf:d?d.record:y}))}let w,p;for(const x of m){const{path:T}=x;if(h&&T[0]!=="/"){const A=h.record.path,I=A[A.length-1]==="/"?"":"/";x.path=h.record.path+(T&&I+T)}if(w=d9(x,h,g),d?d.alias.push(w):(p=p||w,p!==w&&p.alias.push(w),v&&f.name&&!Pg(w)&&n(f.name)),Ub(w)&&u(w),y.children){const A=y.children;for(let I=0;I<A.length;I++)o(A[I],w,d&&d.children[I])}d=d||w}return p?()=>{n(p)}:Po}function n(f){if(zb(f)){const h=a.get(f);h&&(a.delete(f),r.splice(r.indexOf(h),1),h.children.forEach(n),h.alias.forEach(n))}else{const h=r.indexOf(f);h>-1&&(r.splice(h,1),f.record.name&&a.delete(f.record.name),f.children.forEach(n),f.alias.forEach(n))}}function s(){return r}function u(f){const h=m9(f,r);r.splice(h,0,f),f.record.name&&!Pg(f)&&a.set(f.record.name,f)}function c(f,h){let d,v={},y,g;if("name"in f&&f.name){if(d=a.get(f.name),!d)throw za(1,{location:f});g=d.record.name,v=Le(Eg(h.params,d.keys.filter(p=>!p.optional).concat(d.parent?d.parent.keys.filter(p=>p.optional):[]).map(p=>p.name)),f.params&&Eg(f.params,d.keys.map(p=>p.name))),y=d.stringify(v)}else if(f.path!=null)y=f.path,d=r.find(p=>p.re.test(y)),d&&(v=d.parse(y),g=d.record.name);else{if(d=h.name?a.get(h.name):r.find(p=>p.re.test(h.path)),!d)throw za(1,{location:f,currentLocation:h});g=d.record.name,v=Le({},h.params,f.params),y=d.stringify(v)}const m=[];let w=d;for(;w;)m.unshift(w.record),w=w.parent;return{name:g,path:y,params:v,matched:m,meta:p9(m)}}e.forEach(f=>o(f));function l(){r.length=0,a.clear()}return{addRoute:o,resolve:c,removeRoute:n,clearRoutes:l,getRoutes:s,getRecordMatcher:i}}function Eg(e,t){const r={};for(const a of t)a in e&&(r[a]=e[a]);return r}function g9(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:y9(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function y9(e){const t={},r=e.props||!1;if("component"in e)t.default=r;else for(const a in e.components)t[a]=typeof r=="object"?r[a]:r;return t}function Pg(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function p9(e){return e.reduce((t,r)=>Le(t,r.meta),{})}function Rg(e,t){const r={};for(const a in e)r[a]=a in t?t[a]:e[a];return r}function m9(e,t){let r=0,a=t.length;for(;r!==a;){const o=r+a>>1;Wb(e,t[o])<0?a=o:r=o+1}const i=b9(e);return i&&(a=t.lastIndexOf(i,a-1)),a}function b9(e){let t=e;for(;t=t.parent;)if(Ub(t)&&Wb(e,t)===0)return t}function Ub({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function w9(e){const t={};if(e===""||e==="?")return t;const a=(e[0]==="?"?e.slice(1):e).split("&");for(let i=0;i<a.length;++i){const o=a[i].replace(Db," "),n=o.indexOf("="),s=Ko(n<0?o:o.slice(0,n)),u=n<0?null:Ko(o.slice(n+1));if(s in t){let c=t[s];cr(c)||(c=t[s]=[c]),c.push(u)}else t[s]=u}return t}function Ig(e){let t="";for(let r in e){const a=e[r];if(r=$F(r),a==null){a!==void 0&&(t+=(t.length?"&":"")+r);continue}(cr(a)?a.map(o=>o&&ku(o)):[a&&ku(a)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+r,o!=null&&(t+="="+o))})}return t}function x9(e){const t={};for(const r in e){const a=e[r];a!==void 0&&(t[r]=cr(a)?a.map(i=>i==null?null:""+i):a==null?a:""+a)}return t}const C9=Symbol(""),Mg=Symbol(""),Sl=Symbol(""),eh=Symbol(""),Su=Symbol("");function uo(){let e=[];function t(a){return e.push(a),()=>{const i=e.indexOf(a);i>-1&&e.splice(i,1)}}function r(){e=[]}return{add:t,list:()=>e.slice(),reset:r}}function ii(e,t,r,a,i,o=n=>n()){const n=a&&(a.enterCallbacks[i]=a.enterCallbacks[i]||[]);return()=>new Promise((s,u)=>{const c=h=>{h===!1?u(za(4,{from:r,to:t})):h instanceof Error?u(h):o9(h)?u(za(2,{from:t,to:h})):(n&&a.enterCallbacks[i]===n&&typeof h=="function"&&n.push(h),s())},l=o(()=>e.call(a&&a.instances[i],t,r,c));let f=Promise.resolve(l);e.length<3&&(f=f.then(c)),f.catch(h=>u(h))})}function fc(e,t,r,a,i=o=>o()){const o=[];for(const n of e)for(const s in n.components){let u=n.components[s];if(!(t!=="beforeRouteEnter"&&!n.instances[s]))if(k9(u)){const l=(u.__vccOpts||u)[t];l&&o.push(ii(l,r,a,n,s,i))}else{let c=u();o.push(()=>c.then(l=>{if(!l)return Promise.reject(new Error(`Couldn't resolve component "${s}" at "${n.path}"`));const f=EF(l)?l.default:l;n.components[s]=f;const d=(f.__vccOpts||f)[t];return d&&ii(d,r,a,n,s,i)()}))}}return o}function k9(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Lg(e){const t=Ct(Sl),r=Ct(eh),a=fe(()=>{const u=bt(e.to);return t.resolve(u)}),i=fe(()=>{const{matched:u}=a.value,{length:c}=u,l=u[c-1],f=r.matched;if(!l||!f.length)return-1;const h=f.findIndex(ja.bind(null,l));if(h>-1)return h;const d=Og(u[c-2]);return c>1&&Og(l)===d&&f[f.length-1].path!==d?f.findIndex(ja.bind(null,u[c-2])):h}),o=fe(()=>i.value>-1&&A9(r.params,a.value.params)),n=fe(()=>i.value>-1&&i.value===r.matched.length-1&&$b(r.params,a.value.params));function s(u={}){return T9(u)?t[bt(e.replace)?"replace":"push"](bt(e.to)).catch(Po):Promise.resolve()}return{route:a,href:fe(()=>a.value.href),isActive:o,isExactActive:n,navigate:s}}const _9=Ge({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Lg,setup(e,{slots:t}){const r=ta(Lg(e)),{options:a}=Ct(Sl),i=fe(()=>({[Dg(e.activeClass,a.linkActiveClass,"router-link-active")]:r.isActive,[Dg(e.exactActiveClass,a.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const o=t.default&&t.default(r);return e.custom?o:Tr("a",{"aria-current":r.isExactActive?e.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:i.value},o)}}}),S9=_9;function T9(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function A9(e,t){for(const r in t){const a=t[r],i=e[r];if(typeof a=="string"){if(a!==i)return!1}else if(!cr(i)||i.length!==a.length||a.some((o,n)=>o!==i[n]))return!1}return!0}function Og(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Dg=(e,t,r)=>e??t??r,E9=Ge({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:r}){const a=Ct(Su),i=fe(()=>e.route||a.value),o=Ct(Mg,0),n=fe(()=>{let c=bt(o);const{matched:l}=i.value;let f;for(;(f=l[c])&&!f.components;)c++;return c}),s=fe(()=>i.value.matched[n.value]);Ta(Mg,fe(()=>n.value+1)),Ta(C9,s),Ta(Su,i);const u=Ie();return ut(()=>[u.value,s.value,e.name],([c,l,f],[h,d,v])=>{l&&(l.instances[f]=c,d&&d!==l&&c&&c===h&&(l.leaveGuards.size||(l.leaveGuards=d.leaveGuards),l.updateGuards.size||(l.updateGuards=d.updateGuards))),c&&l&&(!d||!ja(l,d)||!h)&&(l.enterCallbacks[f]||[]).forEach(y=>y(c))},{flush:"post"}),()=>{const c=i.value,l=e.name,f=s.value,h=f&&f.components[l];if(!h)return Bg(r.default,{Component:h,route:c});const d=f.props[l],v=d?d===!0?c.params:typeof d=="function"?d(c):d:null,g=Tr(h,Le({},v,t,{onVnodeUnmounted:m=>{m.component.isUnmounted&&(f.instances[l]=null)},ref:u}));return Bg(r.default,{Component:g,route:c})||g}}});function Bg(e,t){if(!e)return null;const r=e(t);return r.length===1?r[0]:r}const P9=E9;function R9(e){const t=v9(e.routes,e),r=e.parseQuery||w9,a=e.stringifyQuery||Ig,i=e.history,o=uo(),n=uo(),s=uo(),u=g2(Gr);let c=Gr;ga&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const l=cc.bind(null,K=>""+K),f=cc.bind(null,zF),h=cc.bind(null,Ko);function d(K,X){let b,C;return zb(K)?(b=t.getRecordMatcher(K),C=X):C=K,t.addRoute(C,b)}function v(K){const X=t.getRecordMatcher(K);X&&t.removeRoute(X)}function y(){return t.getRoutes().map(K=>K.record)}function g(K){return!!t.getRecordMatcher(K)}function m(K,X){if(X=Le({},X||u.value),typeof K=="string"){const $=uc(r,K,X.path),G=t.resolve({path:$.path},X),Z=i.createHref($.fullPath);return Le($,G,{params:h(G.params),hash:Ko($.hash),redirectedFrom:void 0,href:Z})}let b;if(K.path!=null)b=Le({},K,{path:uc(r,K.path,X.path).path});else{const $=Le({},K.params);for(const G in $)$[G]==null&&delete $[G];b=Le({},K,{params:f($)}),X.params=f(X.params)}const C=t.resolve(b,X),E=K.hash||"";C.params=l(h(C.params));const N=UF(a,Le({},K,{hash:NF(E),path:C.path})),O=i.createHref(N);return Le({fullPath:N,hash:E,query:a===Ig?x9(K.query):K.query||{}},C,{redirectedFrom:void 0,href:O})}function w(K){return typeof K=="string"?uc(r,K,u.value.path):Le({},K)}function p(K,X){if(c!==K)return za(8,{from:X,to:K})}function x(K){return I(K)}function T(K){return x(Le(w(K),{replace:!0}))}function A(K){const X=K.matched[K.matched.length-1];if(X&&X.redirect){const{redirect:b}=X;let C=typeof b=="function"?b(K):b;return typeof C=="string"&&(C=C.includes("?")||C.includes("#")?C=w(C):{path:C},C.params={}),Le({query:K.query,hash:K.hash,params:C.path!=null?{}:K.params},C)}}function I(K,X){const b=c=m(K),C=u.value,E=K.state,N=K.force,O=K.replace===!0,$=A(b);if($)return I(Le(w($),{state:typeof $=="object"?Le({},E,$.state):E,force:N,replace:O}),X||b);const G=b;G.redirectedFrom=X;let Z;return!N&&VF(a,C,b)&&(Z=za(16,{to:G,from:C}),W(C,C,!0,!1)),(Z?Promise.resolve(Z):U(G,C)).catch(J=>Er(J)?Er(J,2)?J:j(J):L(J,G,C)).then(J=>{if(J){if(Er(J,2))return I(Le({replace:O},w(J.to),{state:typeof J.to=="object"?Le({},E,J.to.state):E,force:N}),X||G)}else J=k(G,C,!0,O,E);return _(G,C,J),J})}function R(K,X){const b=p(K,X);return b?Promise.reject(b):Promise.resolve()}function z(K){const X=Y.values().next().value;return X&&typeof X.runWithContext=="function"?X.runWithContext(K):K()}function U(K,X){let b;const[C,E,N]=I9(K,X);b=fc(C.reverse(),"beforeRouteLeave",K,X);for(const $ of C)$.leaveGuards.forEach(G=>{b.push(ii(G,K,X))});const O=R.bind(null,K,X);return b.push(O),Q(b).then(()=>{b=[];for(const $ of o.list())b.push(ii($,K,X));return b.push(O),Q(b)}).then(()=>{b=fc(E,"beforeRouteUpdate",K,X);for(const $ of E)$.updateGuards.forEach(G=>{b.push(ii(G,K,X))});return b.push(O),Q(b)}).then(()=>{b=[];for(const $ of N)if($.beforeEnter)if(cr($.beforeEnter))for(const G of $.beforeEnter)b.push(ii(G,K,X));else b.push(ii($.beforeEnter,K,X));return b.push(O),Q(b)}).then(()=>(K.matched.forEach($=>$.enterCallbacks={}),b=fc(N,"beforeRouteEnter",K,X,z),b.push(O),Q(b))).then(()=>{b=[];for(const $ of n.list())b.push(ii($,K,X));return b.push(O),Q(b)}).catch($=>Er($,8)?$:Promise.reject($))}function _(K,X,b){s.list().forEach(C=>z(()=>C(K,X,b)))}function k(K,X,b,C,E){const N=p(K,X);if(N)return N;const O=X===Gr,$=ga?history.state:{};b&&(C||O?i.replace(K.fullPath,Le({scroll:O&&$&&$.scroll},E)):i.push(K.fullPath,E)),u.value=K,W(K,X,b,O),j()}let S;function P(){S||(S=i.listen((K,X,b)=>{if(!q.listening)return;const C=m(K),E=A(C);if(E){I(Le(E,{replace:!0}),C).catch(Po);return}c=C;const N=u.value;ga&&ZF(kg(N.fullPath,b.delta),_l()),U(C,N).catch(O=>Er(O,12)?O:Er(O,2)?(I(O.to,C).then($=>{Er($,20)&&!b.delta&&b.type===Yo.pop&&i.go(-1,!1)}).catch(Po),Promise.reject()):(b.delta&&i.go(-b.delta,!1),L(O,C,N))).then(O=>{O=O||k(C,N,!1),O&&(b.delta&&!Er(O,8)?i.go(-b.delta,!1):b.type===Yo.pop&&Er(O,20)&&i.go(-1,!1)),_(C,N,O)}).catch(Po)}))}let B=uo(),D=uo(),H;function L(K,X,b){j(K);const C=D.list();return C.length?C.forEach(E=>E(K,X,b)):console.error(K),Promise.reject(K)}function M(){return H&&u.value!==Gr?Promise.resolve():new Promise((K,X)=>{B.add([K,X])})}function j(K){return H||(H=!K,P(),B.list().forEach(([X,b])=>K?b(K):X()),B.reset()),K}function W(K,X,b,C){const{scrollBehavior:E}=e;if(!ga||!E)return Promise.resolve();const N=!b&&e9(kg(K.fullPath,0))||(C||!b)&&history.state&&history.state.scroll||null;return tn().then(()=>E(K,X,N)).then(O=>O&&JF(O)).catch(O=>L(O,K,X))}const F=K=>i.go(K);let V;const Y=new Set,q={currentRoute:u,listening:!0,addRoute:d,removeRoute:v,clearRoutes:t.clearRoutes,hasRoute:g,getRoutes:y,resolve:m,options:e,push:x,replace:T,go:F,back:()=>F(-1),forward:()=>F(1),beforeEach:o.add,beforeResolve:n.add,afterEach:s.add,onError:D.add,isReady:M,install(K){const X=this;K.component("RouterLink",S9),K.component("RouterView",P9),K.config.globalProperties.$router=X,Object.defineProperty(K.config.globalProperties,"$route",{enumerable:!0,get:()=>bt(u)}),ga&&!V&&u.value===Gr&&(V=!0,x(i.location).catch(E=>{}));const b={};for(const E in Gr)Object.defineProperty(b,E,{get:()=>u.value[E],enumerable:!0});K.provide(Sl,X),K.provide(eh,H0(b)),K.provide(Su,u);const C=K.unmount;Y.add(K),K.unmount=function(){Y.delete(K),Y.size<1&&(c=Gr,S&&S(),S=null,u.value=Gr,V=!1,H=!1),C()}}};function Q(K){return K.reduce((X,b)=>X.then(()=>z(b)),Promise.resolve())}return q}function I9(e,t){const r=[],a=[],i=[],o=Math.max(t.matched.length,e.matched.length);for(let n=0;n<o;n++){const s=t.matched[n];s&&(e.matched.find(c=>ja(c,s))?a.push(s):r.push(s));const u=e.matched[n];u&&(t.matched.find(c=>ja(c,u))||i.push(u))}return[r,a,i]}function M9(){return Ct(Sl)}function L9(e){return Ct(eh)}const O9="https://assets.le5lecdn.com/le5le/img/logo.png",D9="https://assets.le5lecdn.com/le5le/img/drop-view.svg",B9="https://assets.le5lecdn.com/le5le/img/drop-3d.svg",F9="https://assets.le5lecdn.com/le5le/img/drop-2d.svg",N9="https://assets.le5lecdn.com/le5le/img/meta2d.svg",$9="https://assets.le5lecdn.com/le5le/img/header-phone.svg",j9="https://assets.le5lecdn.com/le5le/img/accountInfo.svg",z9="https://assets.le5lecdn.com/le5le/img/myTeam.svg",H9="https://assets.le5lecdn.com/le5le/img/securitySettings.svg",W9="https://assets.le5lecdn.com/le5le/img/logoff.svg",U9="https://assets.le5lecdn.com/le5le/img/nav_open.svg",V9="https://assets.le5lecdn.com/le5le/img/nav_close.svg",q9={class:"font-small flex-v-center"},K9=pf('<a href="/" class="flex-v-center logo"><img src="'+O9+'" alt=""></a><nav class="menu flex-v-center"><a class="menu-item" href="/enterprise/solution">解决方案</a><div class="menu-item dropdown pc-dropdown"><div class="flex-v-center"><span>产品</span><svg width="12px" height="12px"><line x1="10%" y1="30%" x2="50%" y2="70%"></line><line x1="50%" y1="70%" x2="90%" y2="30%"></line></svg></div><ul class="dropdown-content"><li><a href="/product/view.html" class="dropdown-item dropitem-hover grid-db-lines"><img src="'+D9+'" alt="" class="first"><p class="font-base">乐吾乐大屏可视化</p><p class="desc font-mini">数据可视化组态编辑平台</p></a></li><li><a href="/product/3d.html" class="dropdown-item dropitem-hover grid-db-lines"><img src="'+B9+'" alt="" class="first"><p class="font-base">乐吾乐3D可视化</p><p class="desc font-mini">数字孪生可视化软件</p></a></li><li><a href="/product/2d.html" class="dropdown-item dropitem-hover grid-db-lines"><img src="'+F9+'" alt="" class="first"><p class="font-base">乐吾乐2D可视化</p><p class="desc font-mini">Web可视化组态软件</p></a></li><li><a href="https://doc.le5le.com/document/119359590" target="_blank" class="dropdown-item dropitem-hover grid-db-lines"><img src="'+N9+'" alt="" class="first"><p class="font-base">乐吾乐开源可视化引擎</p><p class="desc font-mini">Le5le Meta2d.js</p></a></li></ul></div><a class="menu-item" href="/enterprise/price">价格</a><a class="menu-item" href="https://doc.le5le.com/" target="_blank">文档中心</a><a class="menu-item" href="/us/index.html">关于我们</a><div class="menu-item phone"><img src="'+$9+'" alt=""><p>技术咨询 17740685317</p><p>商务咨询 19107154517</p></div></nav>',2),Y9={class:"flex-v-center"},G9={class:"avatar-box"},X9=["src"],Q9={class:"dropdown-content"},J9={class:"dropdown-item grid-db-lines"},Z9={class:"avatar-box-big first"},eN=["src"],tN={class:"font-base"},rN=pf('<li class="dropdown-item dropitem-hover"><a href="https://account.le5le.com/account/info" class="flex-v-center" target="_blank"><img src="'+j9+'" alt=""><p>账号信息</p></a></li><li class="dropdown-item dropitem-hover"><a href="https://account.le5le.com/account/teams" class="flex-v-center" target="_blank"><img src="'+z9+'" alt=""><p>我的团队</p></a></li><li class="dropdown-item dropitem-hover"><a href="https://account.le5le.com/account/security" class="flex-v-center" target="_blank"><img src="'+H9+'" alt=""><p>安全设置</p></a></li>',3),iN=Ce("img",{src:W9,alt:""},null,-1),aN=Ce("p",null,"退出登录",-1),oN=[iN,aN],nN=["href"],sN=Ce("img",{class:"nav_open",src:U9,alt:""},null,-1),lN=Ce("img",{class:"nav_close",src:V9,alt:""},null,-1),cN=Ge({__name:"Header",setup(e){const{user:t,signout:r}=Lb(),a=()=>`https://account.le5le.com/?cb=${encodeURIComponent(location.href)}`;return(i,o)=>{var n;return Wi(),Xs("header",q9,[K9,Ce("div",Y9,[Ce("div",{class:"mine dropdown flex-v-center pc-dropdown",style:Fo(bt(t).id?"display:flex;":"display:none;")},[Ce("div",G9,[Ce("img",{class:"avatar",src:bt(t).avatarUrl||"/img/avatar.svg",alt:""},null,8,X9)]),Ce("ul",Q9,[Ce("li",J9,[Ce("div",Z9,[Ce("img",{class:"avatar",src:bt(t).avatarUrl||"/img/avatar.svg",alt:""},null,8,eN)]),Ce("p",tN,zc(bt(t).username||"用户名"),1),Ce("p",null,zc(((n=bt(t).vipData)==null?void 0:n.name)||"注册用户"),1)]),rN,Ce("li",{class:"dropdown-item dropitem-hover flex-v-center",onClick:o[0]||(o[0]=(...s)=>bt(r)&&bt(r)(...s))},oN)])],4),Ce("a",{href:a(),class:"login-btn btn",style:Fo(bt(t).id?"display:none;":"display:flex;")}," 登录/注册 ",12,nN),sN,lN])])}}}),uN="https://assets.le5lecdn.com/le5le/img/technicalAdvice.svg",fN="https://assets.le5lecdn.com/le5le/img/businessConsulting_noarrow.svg",hN="https://assets.le5lecdn.com/le5le/img/miniPrograms.png",dN="https://assets.le5lecdn.com/le5le/img/github.svg",vN="https://assets.le5lecdn.com/le5le/img/wechat.svg",gN="https://assets.le5lecdn.com/le5le/img/officialAccount.svg",yN="https://assets.le5lecdn.com/le5le/img/toutiao.svg",pN=pf('<ul><li class="flex-between"> 产品 <svg width="12px" height="12px"><line x1="20%" y1="0" x2="80%" y2="50%"></line><line x1="80%" y1="50%" x2="20%" y2="100%"></line></svg></li><li><a href="https://v.le5le.com/" target="_blank">乐吾乐大屏可视化</a></li><li><a href="https://3d.le5le.com/" target="_blank">乐吾乐3D可视化</a></li><li><a href="https://2d.le5le.com/" target="_blank">乐吾乐2D可视化</a></li><li><a href="/enterprise/solution">解决方案</a></li><li><a href="/enterprise/price">价格</a></li></ul><ul><li class="flex-between"> 使用与帮助 <svg width="12px" height="12px"><line x1="20%" y1="0" x2="80%" y2="50%"></line><line x1="80%" y1="50%" x2="20%" y2="100%"></line></svg></li><li><a href="https://doc.le5le.com/" target="_blank">文档中心</a></li><li><a href="https://doc.le5le.com/document/119304389" target="_blank">视频教程</a></li><li><a href="https://doc.le5le.com/document/138340312" target="_blank">用户手册</a></li><li><a href="https://doc.le5le.com/document/118946256" target="_blank">部署试用</a></li></ul><ul><li class="flex-between"> 开源与社区 <svg width="12px" height="12px"><line x1="20%" y1="0" x2="80%" y2="50%"></line><line x1="80%" y1="50%" x2="20%" y2="100%"></line></svg></li><li><a href="https://github.com/le5le-com/meta2d.js" target="_blank">Github</a></li><li><a href="https://gitee.com/le5le/meta2d.js" target="_blank">Gitee</a></li><li><a href="https://doc.le5le.com/document/120479036" target="_blank">技术群</a></li></ul><ul><li class="flex-between"> 了解乐吾乐 <svg width="12px" height="12px"><line x1="20%" y1="0" x2="80%" y2="50%"></line><line x1="80%" y1="50%" x2="20%" y2="100%"></line></svg></li><li><a href="/us/index.html">关于我们</a></li></ul><ul class="contact"><li class="flex-between"> 联系我们 <svg width="12px" height="12px"><line x1="20%" y1="0" x2="80%" y2="50%"></line><line x1="80%" y1="50%" x2="20%" y2="100%"></line></svg></li><li><img src="'+uN+'" alt=""><img src="'+fN+'" alt=""><span>技术咨询</span><span>商务咨询</span><span>17740685317</span><span>19107154517</span></li></ul>',5),mN={class:"img-area"},bN=Ce("li",null,null,-1),wN=Ce("li",null,[Ce("img",{src:hN,alt:""}),Ce("span",null,"更多案例")],-1),xN=Ce("a",{href:"https://github.com/le5le-com/meta2d.js",target:"_blank"},[Ce("img",{src:dN,alt:""})],-1),CN={class:"pointer"},kN=Ce("img",{class:"official-account",src:gN,alt:""},null,-1),_N=Ce("a",{href:"https://www.toutiao.com/c/user/token/MS4wLjABAAAAuRrYbu7PE4gIDoxdxxpivdW39VZ3w7XM75jqXkbsjCVHX3d213iclVlv0EIP0nsi/?wid=1704276230577",target:"_blank"},[Ce("img",{src:yN,alt:""})],-1),SN=Ce("div",{class:"record"},[Ce("span",null,"@2024 乐吾乐"),Ce("span",null,[Ep("ICP证： "),Ce("a",{href:"https://beian.miit.gov.cn/",target:"_blank"},"鄂ICP备2020015756号-1")])],-1),TN=Ge({__name:"Footer",setup(e){function t(){const a=document.querySelectorAll("footer .img-area li:nth-child(2) img");for(let i=0;i<a.length;i++)a[i].style.opacity="0.3"}function r(){const a=document.querySelectorAll("footer .img-area li:nth-child(2) img");for(let i=0;i<a.length;i++)a[i].style.opacity="1"}return(a,i)=>(Wi(),Xs(wt,null,[Ce("footer",null,[pN,Ce("ul",mN,[bN,wN,Ce("li",null,[xN,Ce("div",CN,[Ce("img",{class:"official-icon",src:vN,alt:"",onMouseenter:t,onMouseleave:r},null,32),kN]),_N])])]),SN],64))}});function AN(){if(document.documentElement.clientWidth<=768){document.querySelector("footer").addEventListener("click",RN);const e=document.querySelector("header .menu");e.classList.contains("pc-dropdown")&&e.classList.remove("pc-dropdown"),document.querySelector(".nav_open").addEventListener("click",Fg),document.querySelector(".nav_close").addEventListener("click",Fg),document.querySelector(".dropdown").addEventListener("click",PN),document.querySelector("#mask").addEventListener("click",EN)}}function Fg(e){e.target.classList.contains("nav_open")?Tu(!0):Tu(!1)}function Tu(e){const t=document.querySelector(".nav_open"),r=document.querySelector(".nav_close"),a=document.querySelector("nav.menu"),i=document.querySelector("#mask");e?(a.classList.add("show"),r.style.display="block",t.style.display="none",document.body.style.overflow="hidden",i.style.display="block"):(a.classList.remove("show"),r.style.display="none",t.style.display="block",document.body.style.overflow="auto",i.style.display="none")}function EN(){Tu(!1)}function PN(e){const t=(e||window.event).currentTarget;t.classList.contains("unfold")?t.classList.remove("unfold"):t.classList.add("unfold")}function RN(e){const t=(e||window.event).target;if(t.tagName==="LI"&&t.classList.contains("flex-between")){const r=t.parentNode;r.classList.contains("unfold")?r.classList.remove("unfold"):r.classList.add("unfold")}}function vK(){const e=document.querySelector("section.partners .partners-content");if(!e)return;const t=e.children,r=document.documentElement.clientWidth,a=t[0].children[0].clientWidth,i=t[0].children[0].clientHeight,o=Math.ceil(r/a);e.style.height=(t.length-2)*i+"px";for(let n=0;n<t.length;n++){const s=t[n];if(s.tagName=="UL"&&s.classList.contains("partner-list")){s.style.top=i*n+"px",s.style.setProperty("--realNum",s.children.length);for(let u=0;u<o;u++){const c=s.children[u].cloneNode(!0);s.appendChild(c)}n%2==0?s.classList.add("scrollLTR"):s.classList.add("scrollRTL")}}}function gK(e){let t=location.hostname;const r="le5le.com";if(t==r)return typeof e=="string"?e:void 0;if(e||(e=document.querySelectorAll("a")),t=="localhost"||t=="127.0.0.1"?t="le5le.com":t=t.split(".").slice(-2).join("."),typeof e=="string")return Ng(e,t,r);for(let a=0;a<e.length;a++)e[a].href=Ng(e[a].href,t,r)}function Ng(e,t,r){if(!e)return;const a=new URL(e),i=a.hostname;if(i.includes(r)){const o=i.split(".").slice(0,-2).join(".");return o&&(a.hostname=o+"."+t),a.href}return e}function yK(e,t){let r=null;return function(){r&&clearTimeout(r),r=setTimeout(()=>{e(),r=null},t)}}function Ha(e,t){var r=t||new Path2D,a=e.calculative.borderRadius||0,i=a,o=e.calculative.worldRect,n=o.x,s=o.y,u=o.width,c=o.height,l=o.ex,f=o.ey;a<1&&(a=u*a,i=c*i);var h=a<i?a:i;if(u<2*h&&(h=u/2),c<2*h&&(h=c/2),r.moveTo(n+h,s),r.arcTo(l,s,l,f,h),r.arcTo(l,f,n,f,h),r.arcTo(n,f,n,s,h),r.arcTo(n,s,l,s,h),r instanceof Path2D)return r}var IN=Ha;function MN(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.ellipse(i+n/2,o+s/2,n/2,s/2,0,0,Math.PI*2),r instanceof Path2D)return r}var Ae;(function(e){e[e.Node=0]="Node",e[e.Line=1]="Line"})(Ae||(Ae={}));var ke;(function(e){e[e.None=0]="None",e[e.DisableEdit=1]="DisableEdit",e[e.DisableMove=2]="DisableMove",e[e.DisableScale=3]="DisableScale",e[e.DisableMoveScale=4]="DisableMoveScale",e[e.Disable=10]="Disable"})(ke||(ke={}));var $g;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out"})($g||($g={}));var Wa;(function(e){e[e.None=0]="None",e[e.Linear=1]="Linear",e[e.Radial=2]="Radial"})(Wa||(Wa={}));var _e;(function(e){e[e.CanvasTemplate=1]="CanvasTemplate",e[e.CanvasImageBottom=2]="CanvasImageBottom",e[e.CanvasMain=3]="CanvasMain",e[e.CanvasImage=4]="CanvasImage"})(_e||(_e={}));var LN=["text","textWidth","textHeight","textLeft","textTop","fontFamily","fontSize","lineHeight","fontStyle","fontWeight","textAlign","textBaseline","whiteSpace","ellipsis","keepDecimal"],ON=["x","y","width","height","flipX","flipY"],DN=["paddingTop","paddingRight","paddingBottom","paddingLeft","flipX","flipY","visible","showChild"],BN=["iconLeft","iconTop","iconRotate"],Ht;(function(e){e[e.Normal=0]="Normal",e[e.Beads=1]="Beads",e[e.Dot=2]="Dot",e[e.Arrow=3]="Arrow",e[e.WaterDrop=4]="WaterDrop"})(Ht||(Ht={}));var FN=["gif","iframe","video","echarts","highcharts","lightningCharts"],NN=["radio","checkbox","button","inputDom","slider"],fo=new Set(["borderRadius","paddingLeft","paddingRight","paddingTop","paddingBottom","progress","progressColor","verticalProgress","reverseProgress","flipX","flipY","input","lineDash","lineCap","lineJoin","strokeType","lineGradientFromColor","lineGradientToColor","lineGradientAngle","color","hoverColor","activeColor","lineWidth","bkType","gradientFromColor","gradientToColor","gradientAngle","gradientRadius","hoverBackground","activeBackground","globalAlpha","anchorColor","anchorRadius","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textHasShadow","fontFamily","fontSize","textColor","hoverTextColor","activeTextColor","textBackground","fontStyle","fontWeight","textAlign","textBaseline","lineHeight","whiteSpace","textWidth","textHeight","textLeft","textTop","ellipsis","hiddenText","keepDecimal","borderWidth","borderColor","animateLineWidth","lineAnimateType","frames","animateColor","animateType","animateReverse","background","gradientColors","lineGradientColors","animateLineWidth","gradientSmooth","lineSmooth","animations"]);function $N(e){e.onAdd=void 0,e.onValue=void 0,e.onBeforeValue=void 0,e.onDestroy=void 0,e.onMove=void 0,e.onResize=void 0,e.onRotate=void 0,e.onClick=void 0,e.onMouseEnter=void 0,e.onMouseLeave=void 0,e.onMouseDown=void 0,e.onMouseMove=void 0,e.onMouseUp=void 0,e.onShowInput=void 0,e.onInput=void 0,e.onChangeId=void 0,e.onBinds=void 0,e.onStartVideo=void 0,e.onPauseVideo=void 0,e.onStopVideo=void 0,e.onRenderPenRaw=void 0,e.onKeyDown=void 0,e.onContextmenu=void 0,e.onScale=void 0,e.onWheel=void 0,e.onConnectLine=void 0}var ue;(function(e){e[e.None=0]="None",e[e.LineAnchor=1]="LineAnchor",e[e.NodeAnchor=2]="NodeAnchor",e[e.Line=3]="Line",e[e.Node=4]="Node",e[e.Resize=5]="Resize",e[e.Rotate=6]="Rotate",e[e.LineAnchorPrev=7]="LineAnchorPrev",e[e.LineAnchorNext=8]="LineAnchorNext"})(ue||(ue={}));var Re;(function(e){e[e.None=0]="None",e[e.Translate=1]="Translate",e[e.Select=2]="Select",e[e.Resize=3]="Resize",e[e.AddAnchor=4]="AddAnchor"})(Re||(Re={}));var Mr;(function(e){e[e.None=0]="None",e[e.Down=1]="Down",e[e.Translate=2]="Translate"})(Mr||(Mr={}));var me;(function(e){e[e.None=-1]="None",e[e.Up=0]="Up",e[e.Right=1]="Right",e[e.Bottom=2]="Bottom",e[e.Left=3]="Left"})(me||(me={}));var jg=["nw-resize","ne-resize","se-resize","sw-resize"],zg=["n-resize","e-resize","s-resize","w-resize"],jN=["curve","polyline","line"],Vb=["dash","lineWidth","lineCap","lineJoin","strokeType","color","lineGradientFromColor","lineGradientToColor","lineGradientAngle","globalAlpha","bkType","background","gradientFromColor","gradientToColor","gradientAngle","gradientRadius","fontFamily","fontSize","textColor","hoverTextColor","activeTextColor","textBackground","fontStyle","fontWeight","textAlign","textBaseline","lineHeight","whiteSpace","textLeft","textTop","flipX","flipY","lineDash","visible","iconColor"],Vi;(function(e){e[e.Mirror=0]="Mirror",e[e.Bilateral=1]="Bilateral",e[e.Free=2]="Free"})(Vi||(Vi={}));var ct;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out",e[e.DisableConnected=3]="DisableConnected",e[e.DisableConnectTo=4]="DisableConnectTo",e[e.Disable=10]="Disable"})(ct||(ct={}));var Lr;(function(e){e[e.Default=0]="Default",e[e.Line=1]="Line"})(Lr||(Lr={}));function De(e,t,r){if(!(!t||t%360===0)){var a=t*Math.PI/180,i=(e.x-r.x)*Math.cos(a)-(e.y-r.y)*Math.sin(a)+r.x,o=(e.x-r.x)*Math.sin(a)+(e.y-r.y)*Math.cos(a)+r.y;e.x=i,e.y=o,e.prev&&De(e.prev,t,r),e.next&&De(e.next,t,r)}}function ya(e,t,r,a){if(r===void 0&&(r=5),t.type===Lr.Line){var i=a.rotate;a.flipX&&(i*=-1),a.flipY&&(i*=-1);var o=t.rotate+i;return a.flipX&&(o*=-1),a.flipY&&(o*=-1),Jr(e,{x:t.x-t.length*a.calculative.canvas.store.data.scale/2,y:t.y-r,width:t.length*a.calculative.canvas.store.data.scale,height:r*2,rotate:o})}else return e.x>t.x-r&&e.x<t.x+r&&e.y>t.y-r&&e.y<t.y+r}function _s(e,t,r){e.x=r.x-(r.x-e.x)*t,e.y=r.y-(r.y-e.y)*t}function Xt(e,t){if(e.x===t.x)return e.y<=t.y?0:180;if(e.y===t.y)return e.x<t.x?270:90;var r=e.x-t.x,a=e.y-t.y,i=Math.atan(Math.abs(r/a))/(2*Math.PI)*360;return r>0&&a>0?i=180-i:r<0&&a>0?i+=180:r<0&&a<0&&(i=360-i),i}function Tl(e,t){var r=e.x-t.x,a=e.y-t.y;return Math.sqrt(r*r+a*a)}function zN(e,t){var r=me.None;if(!t)return r;var a=e.x-t.x,i=e.y-t.y;return Math.abs(a)>Math.abs(i)?a>0?r=me.Right:r=me.Left:i>0?r=me.Bottom:r=me.Up,r}function Io(e,t,r){e&&(e.x+=t,e.y+=r,e.next&&(e.next.x+=t,e.next.y+=r),e.prev&&(e.prev.x+=t,e.prev.y+=r))}function Hg(e,t){return e.anchorId===t.anchorId&&e.connectTo===t.connectTo}function Bn(e,t,r){var a=Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))/r.data.scale;t.rotate===0?e.x<t.x?r.pens[t.penId].flipX||(a*=-1):r.pens[t.penId].flipX&&(a*=-1):e.y<t.y?r.pens[t.penId].flipY||(a*=-1):r.pens[t.penId].flipY&&(a*=-1),e.distance=a}const HN="@meta2d/core",WN="1.0.54",UN="@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",VN="index.js",qN="index.d.ts",KN={copy:"shx cp package.build.json ../../dist/core/package.json",build:"tsc && npm run copy"},YN=["meta2d","diagram","2D","canvas"],GN="alsmile123@qq.com",XN="MIT",QN={type:"git",url:"git+https://github.com/le5le-com/meta2d.js.git"},JN={url:"https://github.com/le5le-com/meta2d.js/issues"},ZN="https://github.com/le5le-com/meta2d.js#readme",e$={"@types/marked":"^4.0.3","@types/offscreencanvas":"latest"},t$={mitt:"^2.1.0",mqtt:"^4.2.6"},r$={access:"public"},i$="78f2a53ca1839c89b56e2e498d17ba4eb987ad14",qb={name:HN,version:WN,description:UN,main:VN,types:qN,scripts:KN,keywords:YN,author:GN,license:XN,repository:QN,bugs:JN,homepage:ZN,devDependencies:e$,dependencies:t$,publishConfig:r$,gitHead:i$};var he={version:qb.version,path2dDraws:{},canvasDraws:{},anchors:{},htmlElements:{}};function mr(e){Object.assign(he.path2dDraws,e)}function Rr(e){Object.assign(he.canvasDraws,e)}function Au(e){Object.assign(he.anchors,e)}function a$(e){return{all:e=e||new Map,on:function(t,r){var a=e.get(t);a&&a.push(r)||e.set(t,[r])},off:function(t,r){var a=e.get(t);a&&a.splice(a.indexOf(r)>>>0,1)},emit:function(t,r){(e.get(t)||[]).slice().map(function(a){a(r)}),(e.get("*")||[]).slice().map(function(a){a(t,r)})}}}var Ni;(function(e){e[e.None=-1]="None",e[e.Document=0]="Document",e[e.Canvas=1]="Canvas"})(Ni||(Ni={}));var o$={fontFamily:'"Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial',fontSize:12,lineHeight:1.5,textAlign:"center",textBaseline:"middle",color:"#222222",activeColor:"#278df8",hoverColor:"rgba(39,141,248,0.50)",anchorColor:"#278DF8",hoverAnchorColor:"#FF4101",anchorRadius:4,anchorBackground:"#fff",dockColor:"rgba(39,141,248,0.50)",dockPenColor:"#1890FF",dragColor:"#1890ff",rotateCursor:"rotate.cur",rightCursor:"right.cur",downCursor:"down.cur",hoverCursor:"pointer",minScale:.1,maxScale:10,keydown:Ni.Document,gridSize:20,gridColor:"#e2e2e2",ruleColor:"#888888",drawingLineName:"curve",interval:30,animateInterval:30,autoPolyline:!0,autoAnchor:!0,autoAlignGrid:!1,animateColor:"#30EEDC",ruleLineColor:"#FF4101",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:64,shadowColor:"#00000014",globalAlpha:1,defaultAnchors:[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}],measureTextWidth:!0,moveConnectedLine:!0,mouseRightActive:!0,disableClipboard:!1,drawingLineLength:0,disableTouchPadScale:!1,cdn:"",polylineSpace:10,domShapes:[],containerShapes:["tablePlus"],textFlip:!0,textRotate:!0,unavailableKeys:[],diagramOptions:{},svgPathStroke:!0},n$={dark:{color:"#bdc7db",background:"#1e2430",parentBackground:"#080b0f",ruleColor:"#222E47",ruleOptions:{background:"#121924",textColor:"#6E7B91"}},light:{color:"#222222",background:"#FFFFFF",parentBackground:"#F0F1F2",ruleColor:"#C8D0E1",ruleOptions:{background:"#F7F8FA",textColor:"#C8D0E1"}}},Ss=function(){return Ss=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Ss.apply(this,arguments)},s$=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ce;(function(e){e[e.Add=0]="Add",e[e.Update=1]="Update",e[e.Delete=2]="Delete",e[e.Replace=3]="Replace"})(ce||(ce={}));var l$=function(){return{data:{x:0,y:0,scale:1,pens:[],origin:{x:0,y:0},center:{x:0,y:0},paths:{},theme:"light"},histories:[],pens:{},path2dMap:new WeakMap,animateMap:new WeakMap,active:[],animates:new Set,options:Ss({},o$),theme:Ss({},n$),emitter:a$(),bindDatas:{},bind:{},pensNetwork:{},cacheDatas:[],messageEvents:{},templatePens:{},globalTriggers:{}}},c$=function(e){return e===void 0&&(e="default"),he[e]||(he[e]=l$(),he[e].id=e),he[e]},u$=function(e,t){var r,a,i=e.data.template===t;if(i)try{for(var o=s$(e.data.pens),n=o.next();!n.done;n=o.next()){var s=n.value;s.canvasLayer===_e.CanvasTemplate&&(e.templatePens[s.id]=s)}}catch(u){r={error:u}}finally{try{n&&!n.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}e.lastScale=e.data.scale,e.data={x:0,y:0,scale:1,pens:[],origin:{x:0,y:0},center:{x:0,y:0},paths:{},template:i?t:null},e.sameTemplate=i,e.pens={},e.histories=[],e.historyIndex=null,e.path2dMap=new WeakMap,e.animateMap=new WeakMap,e.bindDatas={},e.bind={},e.pensNetwork={},e.active=[],e.hover=void 0,e.lastHover=void 0,e.animates.clear()},Wg=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},f$=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},h$=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function Cr(e){var t=e.calculative,r=t.paddingTop,a=t.paddingBottom,i=t.paddingLeft,o=t.paddingRight,n=t.worldRect,s=t.canvas,u=e.calculative,c=u.textLeft,l=u.textTop,f=u.textWidth,h=u.textHeight,d=i,v=r,y=n.width-i-o-((e.textAlign==="right"?-c:c)||0),g=n.height-r-a-((e.textBaseline==="bottom"?-l:l)||0);f&&f<1&&(f*=n.width),h&&h<1&&(h*=n.height),f<e.calculative.fontSize&&(f=e.calculative.fontSize),d+=(c||0)+n.x,v+=(l||0)+n.y;var m=e.textAlign||s.store.options.textAlign,w=e.textBaseline||s.store.options.textBaseline;switch(m){case"center":d+=(y-(f||y))/2;break;case"right":d+=y-(f||y);break}switch(w){case"middle":v+=(g-(h||g))/2;break;case"bottom":v+=g-(h||g);break}var p={x:d,y:v,width:f||y,height:h||g};Ke(p),e.calculative.worldTextRect=p,wn(e),e.calculative.textDrawRect=void 0}function Kb(e,t){var r=t.calculative.fontSize*t.calculative.lineHeight,a=t.calculative.textLines.length*r,i=d$(e,t),o=t.calculative.worldTextRect,n=o.x+(o.width-i)/2,s=o.y+(o.height-a)/2,u=t.calculative.canvas.store.options,c=t.textAlign||u.textAlign;switch(c){case"left":n=o.x;break;case"right":n=o.x+o.width-i;break}var l=t.textBaseline||u.textBaseline;switch(l){case"top":s=o.y;break;case"bottom":s=o.ey-a;break}t.calculative.textDrawRect={x:n,y:s,width:i,height:a},Ke(t.calculative.textDrawRect)}function wn(e,t){var r,a,i,o;if(t===void 0&&(t=e.calculative.text),t==null){e.calculative.textLines=[];return}t=t.toString();var n=[],s=e.calculative.fontSize*e.calculative.lineHeight,u=e.calculative.worldTextRect.height,c=Math.floor(u/s),l=c>1?c:1;switch(e.whiteSpace){case"nowrap":if(e.ellipsis!==!1){var f=Ug(t.split(""),e);f[0]&&(n.push(f[0]),f.length>1&&hc(n))}else n.push(t);break;case"pre-line":n=t.split(/[\n]/g),e.ellipsis!==!1&&n.length>l&&(n=n.slice(0,l),hc(n));break;case"break-all":default:var h=t.split(/[\n]/g),d=0;try{e:for(var v=Wg(h),y=v.next();!y.done;y=v.next()){var g=y.value,m=e.whiteSpace==="break-all"?g.split(""):Yb(g),w=Ug(m,e);if(w.length===0&&(w=[""]),e.ellipsis!=!1)try{for(var p=(i=void 0,Wg(w)),x=p.next();!x.done;x=p.next()){var T=x.value;if(d++,d>l){hc(n);break e}else n.push(T)}}catch(I){i={error:I}}finally{try{x&&!x.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}else n.push.apply(n,h$([],f$(w),!1))}}catch(I){r={error:I}}finally{try{y&&!y.done&&(a=v.return)&&a.call(v)}finally{if(r)throw r.error}}break}var A=e.calculative.keepDecimal;return A!=null&&n.forEach(function(I,R){var z=Number(I);isNaN(z)||(n[R]=z.toFixed(A))}),e.calculative.textLines=n,n}function Yb(e){e===void 0&&(e="");for(var t=[],r="",a=0;a<e.length;++a){var i=e.charCodeAt(a);i<33||i>126?(r&&(t.push(r),r=""),t.push(e[a])):r+=e[a]}return r&&t.push(r),t}function Ug(e,t){var r=t.calculative.canvas,a=r.offscreen.getContext("2d"),i=t.calculative,o=i.fontStyle,n=i.fontWeight,s=i.fontSize,u=i.fontFamily,c=i.lineHeight;a.save();for(var l=[],f=e[0]||"",h=1;h<e.length;++h){var d=e[h]||"",v=f+d,y=0;if(r.store.options.measureTextWidth)a.font=qt({fontStyle:o,fontWeight:n,fontFamily:u||r.store.options.fontFamily,fontSize:s,lineHeight:c}),y=a.measureText(v).width;else{var g=v.match(/[^\x00-\xff]/g)||"",m=g.length*s,w=v.match(/\s/g)||"",p=w.length*s*.3,x=(v.length-g.length-w.length)*s*.6;y=m+p+x}var T=t.calculative.worldTextRect.width;y<=T+.1?f+=d:(f.length&&l.push(f),f=d)}return f.length&&l.push(f),a.restore(),l}function d$(e,t){var r=0;return t.calculative.textLineWidths=[],t.calculative.textLines.forEach(function(a){var i=e.measureText(a).width;t.calculative.textLineWidths.push(i),r<i&&(r=i)}),r}function hc(e){e[e.length-1]=e[e.length-1].slice(0,-3)+"..."}function v$(e){var t=e.text.split(`
`),r=e.calculative.canvas,a=r.offscreen.getContext("2d"),i=e.calculative,o=i.fontStyle,n=i.fontWeight,s=i.fontSize,u=i.fontFamily,c=i.lineHeight,l=0,f=0;a.save();for(var h=0;h<t.length;h++){if(r.store.options.measureTextWidth)a.font=qt({fontStyle:o,fontWeight:n,fontFamily:u||r.store.options.fontFamily,fontSize:s,lineHeight:c}),f=a.measureText(t[h]).width;else{var d=t[h].match(/[^\x00-\xff]/g)||"",v=d.length*s,y=t[h].match(/\s/g)||"",g=y.length*s*.3,m=(t[h].length-d.length-y.length)*s*.6;f=v+g+m}f>l&&(l=f)}a.restore();var w=t.length*s*c;e.textAlign==="left"||(e.textAlign==="right"?e.x=e.x-(l-e.width):e.x=e.x-(l-e.width)/2),e.textBaseline==="top"||(e.textBaseline==="bottom"?e.y=e.y-(w-e.height):e.y=e.y-(w-e.height)/2),e.height=w+2,e.width=l+2,e.calculative.canvas.updatePenRect(e),e.calculative.canvas.calcActiveRect()}function re(e,t){if(t===void 0&&(t=!1),Array.isArray(e)){var r=[];return e.forEach(function(o){r.push(re(o,t))}),r}else if(typeof e=="object"){if(e===null)return null;if(e.constructor===RegExp)return e;var a={};for(var i in e)if(!(["canvas","lastFrame"].includes(i)||e[i]instanceof HTMLImageElement||e[i]instanceof HTMLMediaElement)){{if(i==="calculative"&&!t)continue;if(i==="singleton"){t?a[i]={}:a[i]=e[i];continue}}a[i]=re(e[i],t)}return a}return e}function Eu(e,t,r){if(Array.isArray(e)){var a=[];return e.forEach(function(n){a.push(Eu(n,t,r))}),a}else if(typeof e=="object"){if(e===null)return null;var i=function(n){if(t.includes(n))if(Array.isArray(e[n]))e[n].forEach(function(s,u){Number.isNaN(Number(s))||(e[n][u]=Number(s*r))});else{if(Number.isNaN(Number(e[n])))return"continue";e[n]=Number(e[n])*r}else e[n]=Eu(e[n],t,r)};for(var o in e)i(o);return e}return e}var Vt={};function Gb(e,t,r){if(Vt[t.fromArrow]){var a=Ve(t),i=a.x,o=a.y,n={x:i,y:o};if(n.step=(t.fromArrowSize||10)*r.data.scale,a.next)n.rotate=Xt(a.next,a)+90;else{var s=t.calculative.worldAnchors[1];if(!s)return;s.prev?n.rotate=Xt(s.prev,a)+90:n.rotate=Xt(s,a)+90}e.save(),e.beginPath(),e.setLineDash([]);var u=t.fromArrowColor||t.calculative.color;u&&(e.strokeStyle=u),Vt[t.fromArrow](e,t,r,n),e.restore()}}function Xb(e,t,r){if(!(!Vt[t.toArrow]||t.calculative.worldAnchors.length<2)){e.save();var a=Te(t),i=a.x,o=a.y,n={x:i,y:o};if(n.step=(t.toArrowSize||10)*r.data.scale,a.prev)n.rotate=Xt(a.prev,a)+90;else{var s=t.calculative.worldAnchors[t.calculative.worldAnchors.length-2];s.next?n.rotate=Xt(s.next,a)+90:n.rotate=Xt(s,a)+90}e.beginPath(),e.setLineDash([]);var u=t.toArrowColor||t.calculative.color;u&&(e.strokeStyle=u),Vt[t.toArrow](e,t,r,n),e.restore()}}Vt.triangleSolid=function(e,t,r,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.x-a.step;e.moveTo(i,a.y-a.step/4),e.lineTo(a.x,a.y),e.lineTo(i,a.y+a.step/4),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};Vt.triangle=function(e,t,r,a){e.save(),e.lineWidth<2&&(e.lineWidth=2),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.x-a.step;e.moveTo(i,a.y-a.step/4),e.lineTo(a.x,a.y),e.lineTo(i,a.y+a.step/4),e.closePath(),e.stroke(),e.fillStyle=r.data.background||"#ffffff",e.fill(),e.restore()};Vt.circleSolid=function(e,t,r,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.step/2;e.arc(a.x-i,a.y,i,0,2*Math.PI),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};Vt.circle=function(e,t,r,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.step/2;e.arc(a.x-i,a.y,i,0,2*Math.PI),e.stroke(),e.fillStyle=r.data.background||"#ffffff",e.fill(),e.restore()};Vt.diamondSolid=function(e,t,r,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.x-a.step,o=a.step/2;e.moveTo(i,a.y),e.lineTo(i+o,a.y-o/2),e.lineTo(a.x,a.y),e.lineTo(i+o,a.y+o/2),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};Vt.diamond=function(e,t,r,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.x-a.step,o=a.step/2;e.moveTo(i,a.y),e.lineTo(i+o,a.y-o/2),e.lineTo(a.x,a.y),e.lineTo(i+o,a.y+o/2),e.closePath(),e.stroke(),e.fillStyle=r.data.background||"#ffffff",e.fill(),e.restore()};Vt.line=function(e,t,r,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.x-a.step;e.moveTo(i,a.y-a.step/3),e.lineTo(a.x,a.y),e.lineTo(i,a.y+a.step/3),e.stroke(),e.restore()};Vt.lineUp=function(e,t,r,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.x-a.step;e.moveTo(i,a.y-a.step/3),e.lineTo(a.x,a.y),e.stroke(),e.restore()};Vt.lineDown=function(e,t,r,a){e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);var i=a.x-a.step;e.moveTo(i,a.y+a.step/3),e.lineTo(a.x,a.y),e.stroke(),e.restore()};var g$=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o};function Pu(e){var t=parseInt,r=Math.round,a=e.length,i={};if(a>9){var o=g$(e=e.split(","),4),n=o[0],s=o[1],u=o[2],c=o[3];if(a=e.length,a<3||a>4)return null;i.r=t(n[3]=="a"?n.slice(5):n.slice(4)),i.g=t(s),i.b=t(u),i.a=c?parseFloat(c):-1}else{if(a==8||a==6||a<4)return null;a<6&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(a>4?e[4]+e[4]:"")),e=t(e.slice(1),16),a==9||a==5?(i.r=e>>24&255,i.g=e>>16&255,i.b=e>>8&255,i.a=r((e&255)/.255)/1e3):(i.r=e>>16,i.g=e>>8&255,i.b=e&255,i.a=-1)}return i}function ht(e,t,r,a){var i,o,n,s,u,c,l,f=Math.round,h=typeof r=="string";return typeof e!="number"||e<-1||e>1||typeof t!="string"||t[0]!="r"&&t[0]!="#"||r&&!h||(l=t.length>9,l=h?r.length>9?!0:r=="c"?!l:!1:l,u=Pu(t),s=e<0,c=r&&r!="c"?Pu(r):s?{r:0,g:0,b:0,a:-1}:{r:255,g:255,b:255,a:-1},e=s?e*-1:e,s=1-e,!u||!c)?null:(a?(i=f(s*u.r+e*c.r),o=f(s*u.g+e*c.g),n=f(s*u.b+e*c.b)):(i=f(Math.pow(s*Math.pow(u.r,2)+e*Math.pow(c.r,2),.5)),o=f(Math.pow(s*Math.pow(u.g,2)+e*Math.pow(c.g,2),.5)),n=f(Math.pow(s*Math.pow(u.b,2)+e*Math.pow(c.b,2),.5))),h=u.a,c=c.a,u=h>=0||c>=0,h=u?h<0?c:c<0?h:h*s+c*e:0,l?"rgb"+(u?"a(":"(")+i+","+o+","+n+(u?","+f(h*1e3)/1e3:"")+")":"#"+(4294967296+i*16777216+o*65536+n*256+(u?f(h*255):0)).toString(16).slice(1,u?void 0:-2))}globalThis.pSBC=ht;function Ts(e,t){var r=Pu(e)||{r:0,g:0,b:0};return r.a<0?"rgba("+r.r+","+r.g+","+r.b+","+t+")":"rgba("+r.r+","+r.g+","+r.b+","+(t+r.a)+")"}var Mo=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},y$=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function ua(e,t){if(isNaN(e)){console.warn("realValue not number");return}if(typeof t!="string"){console.warn("collection must be string");return}var r=Mo([t[0],t[t.length-1]],2),a=r[0],i=r[1];if(!["[","("].includes(a)){console.warn('collection must start with "[" or "("');return}if(!["]",")"].includes(i)){console.warn('collection must end with "]" or ")"');return}var o=t.substring(1,t.length-1).split(",");if(o.length!==2){console.warn("collection must have 2 numbers");return}var n=Mo([+o[0],+o[1]],2),s=n[0],u=n[1];if(s>=u){console.warn("startNum must less than endNum");return}var c=e>s||a==="["&&e===s;if(!c)return!1;var l=e<u||i==="]"&&e===u;return l}function fa(e,t){var r,a;if(typeof t!="string"){console.warn("collection must be string");return}var i=Mo([t[0],t[t.length-1]],2),o=i[0],n=i[1];if(o!=="["||n!=="]"){console.warn('collection must start with "[" and end with "]"');return}var s=t.substring(1,t.length-1).split(",");try{for(var u=y$(s),c=u.next();!c.done;c=u.next()){var l=c.value;if(l.includes("..")){var f=Mo(l.split(".."),2),h=f[0],d=f[1],v=Mo([+h,+d],2),y=v[0],g=v[1];if(y>=g){console.warn("startNum must less than endNum");return}if(e>=y&&e<=g)return!0}else if(e==l)return!0}}catch(m){r={error:m}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}return!1}function xe(){return((1+Math.random())*4294967296|0).toString(16).substring(1)}var Or=function(e){var t=0,r=0,a=0,i=0;if(typeof e=="number")t=r=a=i=e;else if(typeof e=="string"){var o=parseInt(e,10);t=r=a=i=o}else Array.isArray(e)&&(t=e[0],a=dc(e[1])?e[0]:e[1],i=dc(e[2])?e[0]:e[2],r=dc(e[3])?a:e[3]);return[t,a,i,r]};function dc(e){return e==null}var Qb=function(e,t,r,a){function i(o){return o instanceof r?o:new r(function(n){n(o)})}return new(r||(r=Promise))(function(o,n){function s(l){try{c(a.next(l))}catch(f){n(f)}}function u(l){try{c(a.throw(l))}catch(f){n(f)}}function c(l){l.done?o(l.value):i(l.value).then(s,u)}c((a=a.apply(e,t||[])).next())})},Jb=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a,i,o,n;return n={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function s(c){return function(l){return u([c,l])}}function u(c){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{a=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};function p$(e){return Qb(this,void 0,void 0,function(){return Jb(this,function(t){return[2,new Promise(function(r,a){var i=new FileReader;i.onload=function(o){r(o.target.result)},i.onerror=function(o){a(o)},i.readAsDataURL(e)})]})})}function m$(e,t,r,a){return Qb(this,void 0,void 0,function(){var i,o,n;return Jb(this,function(s){switch(s.label){case 0:if(i=new FormData,i.append("file",e),r)for(o in r)r.hasOwnProperty(o)&&i.append(o,r[o]);return[4,fetch(t,{method:"POST",headers:a,body:i})];case 1:return n=s.sent(),[4,n.json()];case 2:return[2,s.sent().url]}})})}function b$(e,t,r){var a=document.createElement("link");a.href=e,a.rel="stylesheet",t&&(a.onload=t),document.head.appendChild(a)}function Vg(e){var t=e||window.location.search.split("?")[1],r=new URLSearchParams(t),a=Object.fromEntries(r.entries());return a}function wa(e,t){if(t==null)return e;for(var r=t.split(".");r.length&&(e=e[r.shift()]););return e}function Ru(e,t,r){t!=null&&t.split(".").reduce(function(a,i,o){return a[i]=t.split(".").length===++o?r:a[i]||{}},e)}var Iu=function(){return Iu=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Iu.apply(this,arguments)},th=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},rh=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))},Go=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function w$(e,t){if(!e||!t)return!1;for(var r=jt(e);r;){if(r.id===t.id)return!0;r=jt(r)}return!1}function jt(e,t){if(!(!e||!e.parentId||!e.calculative)){var r=e.calculative.canvas.store,a=r.pens[e.parentId];return t&&jt(a,t)||a}}function br(e,t){if(!e||!e.children)return[];var r=[];return e.children.forEach(function(a){var i=t.pens[a];i&&(r.push(i),r.push.apply(r,rh([],th(br(i,t)),!1)))}),r}function ih(e,t){if(!e||!e.followers)return[];var r=[];return e.followers.forEach(function(a){var i=t.pens[a];i&&!i.parentId&&(r.push(i),r.push.apply(r,rh([],th(ih(i,t)),!1)))}),r}function x$(e,t){var r=t.calculative,a=r.worldRect,i=r.gradientFromColor,o=r.gradientToColor,n=r.gradientAngle;return ew(e,a,i,o,n)}function C$(e,t){var r=t.calculative,a=r.worldRect,i=r.gradientFromColor,o=r.gradientToColor,n=r.gradientRadius;if(!(!i||!o)){var s=a.width,u=a.height,c=a.center,l=c.x,f=c.y,h=s;h<u&&(h=u),h*=.5;var d=e.createRadialGradient(l,f,h*(n||0),l,f,h);return d.addColorStop(0,i),d.addColorStop(1,o),d}}function k$(e,t,r,a,i){var o=0;o=Math.PI/2-Math.atan2(a-t,r-e);var n=(e+r)/2,s=(t+a)/2,u=n+i*Math.sin(90*Math.PI/180-o),c=s+i*-Math.cos(90*Math.PI/180-o),l=n+i*Math.sin(270*Math.PI/180-o),f=s+i*-Math.cos(270*Math.PI/180-o);return[u,c,l,f]}function _$(e,t){var r=t.calculative,a=r.worldRect,i=r.gradientColors,o=r.gradientRadius;if(i){var n=a.width,s=a.height,u=a.center,c=u.x,l=u.y,f=n;f<s&&(f=s),f*=.5;var h=ia(i).colors,d=e.createRadialGradient(c,l,f*(o||0),c,l,f);return h.forEach(function(v){d.addColorStop(v.i,v.color)}),d}}function S$(e,t){var r=t.calculative.worldRect,a=r.x,i=r.y,o=r.ex,n=r.width,s=r.height,u=r.center,c=[{x:o,y:i+s/2},{x:a,y:i+s/2}],l=ia(t.calculative.gradientColors),f=l.angle,h=l.colors,d=ah(f,n,s);return c.forEach(function(v){De(v,f,u)}),Al(e,c,h,d)}function T$(e,t){var r=t.calculative,a=r.worldRect,i=r.textGradientColors;if(i){var o=a.width,n=a.height,s=a.center,u=s.x,c=s.y,l=o;l<n&&(l=n),l*=.5;var f=ia(i).colors,h=e.createRadialGradient(u,c,0,u,c,l);return f.forEach(function(d){h.addColorStop(d.i,d.color)}),h}}function A$(e,t){var r=t.calculative.worldRect,a=r.x,i=r.y,o=r.ex,n=r.width,s=r.height,u=r.center,c=[{x:o,y:i+s/2},{x:a,y:i+s/2}],l=ia(t.calculative.textGradientColors),f=l.angle,h=l.colors,d=ah(f,n,s);return c.forEach(function(v){De(v,f,u)}),Al(e,c,h,d)}function ah(e,t,r){var a=Math.atan(r/t)/Math.PI*180,i=(e-90)%360,o=0;return i>a&&i<180-a||i>180+a&&i<360-a||i<0?(i>270?i=360-i:i>180?i=i-180:i>90&&(i=180-i),o=Math.abs(r/Math.sin(i/180*Math.PI)/2)):(i>270?i=360-i:i>180?i=i-180:i>90&&(i=180-i),o=Math.abs(t/Math.cos(i/180*Math.PI)/2)),o}function ia(e){if(typeof e=="string"&&e.startsWith("linear-gradient")){var t=e.slice(16,-2).split("deg,");if(t.length>1){var r=t[1].split("%,"),a=[];return r.forEach(function(i){if(/rgba?/.test(i)){var o=i.split(") ");a.push({color:E$(o[0]+")"),i:parseFloat(o[1])/100})}else{var n=i.split(" ");n.length>2?a.push({color:n[1],i:parseFloat(n[2])/100}):a.push({color:n[0],i:parseFloat(n[1])/100})}}),{angle:parseFloat(t[0]),colors:a}}else return{angle:parseFloat(t[0]),colors:[]}}else return{angle:0,colors:[]}}function E$(e){if(/rgba?/.test(e)){var t=e.split(",");if(t.length<3)return"";e="#";for(var r=0,a=void 0;a=t[r++];)if(r<4)a=parseInt(a.replace(/[^\d]/gi,""),10).toString(16),e+=a.length==1?"0"+a:a;else{a=a.replace(")","");var i=parseInt(a*255+""),o=i.toString(16);o=o.length===2?o:"0"+o,e+=o}e=e.toUpperCase()}return e}function P$(e,t){var r=t.calculative.worldRect,a=r.x,i=r.y,o=r.ex,n=r.width,s=r.height,u=r.center,c=[{x:o,y:i+s/2},{x:a,y:i+s/2}],l=ia(t.calculative.lineGradientColors),f=l.angle,h=l.colors,d=ah(f,n,s);return c.forEach(function(v){De(v,f,u)}),Al(e,c,h,d)}function Al(e,t,r,a){var i=k$(t[0].x,t[0].y,t[1].x,t[1].y,a),o=e.createLinearGradient(i[0],i[1],i[2],i[3]);return r.forEach(function(n){o.addColorStop(n.i,n.color)}),o}function Qr(e,t,r){var a=[];t.calculative.gradientColorStop?a=t.calculative.gradientColorStop:(a=ia(t.calculative.lineGradientColors).colors,t.calculative.gradientColorStop=a),e.strokeStyle=Al(e,r,a,t.calculative.lineWidth/2),e.beginPath(),e.moveTo(r[0].x,r[0].y),e.lineTo(r[1].x,r[1].y),e.stroke()}function Zb(e,t){for(var r=t.calculative.worldAnchors,a=t.calculative.lineWidth*(t.calculative.gradientSmooth||t.calculative.lineSmooth||0),i=0;i<r.length-1;i++)if((t.lineName==="curve"||t.lineName==="mind")&&r[i].curvePoints){if(i>0){var o=r[i-1].curvePoints;o?Fn(e,t,a,o[o.length-1],r[i],r[i].curvePoints[0]):Fn(e,t,a,r[i-1],r[i],r[i].curvePoints[0]);var n=Br(a,r[i],r[i].curvePoints[0]);Qr(e,t,[n,r[i].curvePoints[1]])}else Qr(e,t,[r[i],r[i].curvePoints[0]]),Qr(e,t,[r[i].curvePoints[0],r[i].curvePoints[1]]);for(var s=r[i].curvePoints.length-1,u=1;u<s;u++)Qr(e,t,[r[i].curvePoints[u],r[i].curvePoints[u+1]]);var c=Br(a,r[i+1],r[i].curvePoints[s]);Qr(e,t,[r[i].curvePoints[s],c])}else{var l=r[i],f=r[i+1];if(i>0&&i<r.length-1){var o=r[i-1].curvePoints;o?Fn(e,t,a,o[o.length-1],r[i],r[i+1]):Fn(e,t,a,r[i-1],r[i],r[i+1])}i>0&&i<r.length-1&&(l=Br(a,r[i],r[i+1])),i<r.length-2&&(f=Br(a,r[i+1],r[i]));var h=!1;if(i===0&&t.fromLineCap&&t.fromLineCap!=="butt"&&(e.save(),h=!0,e.lineCap=t.fromLineCap),i!==0&&i===r.length-2&&t.toLineCap&&t.toLineCap!=="butt"&&(e.save(),h=!0,e.lineCap=t.toLineCap),Qr(e,t,[l,f]),h&&e.restore(),r.length===2&&i===0){e.save(),h=!0,e.lineCap=t.toLineCap;var d=.1,v=.1;l.x-f.x===0?v=0:d=(l.y-f.y)/(l.x-f.x)*.1,Qr(e,t,[{x:f.x-v,y:f.y-d},f]),e.restore()}}}function Br(e,t,r){var a=Math.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y));return a===0?{x:t.x,y:t.y}:e<a?{x:t.x+(r.x-t.x)*e/a,y:t.y+(r.y-t.y)*e/a}:{x:t.x+(r.x-t.x)/a/2,y:t.y+(r.y-t.y)/a/2}}function Fn(e,t,r,a,i,o){for(var n=Br(r,i,a),s=Br(r,i,o),u={x:i.x,y:i.y},c=R$(t.calculative.canvas.store.data.smoothNum||20,n,u,s),l=0;l<c.length-1;l++)Qr(e,t,[{x:c[l].x,y:c[l].y},{x:c[l+1].x,y:c[l+1].y}])}function qg(e,t,r,a){var i=Br(t,r,a),o={x:r.x,y:r.y};e.quadraticCurveTo(o.x,o.y,i.x,i.y)}function oh(e){for(var t=e.calculative.worldAnchors,r=e.calculative.lineWidth*(e.calculative.gradientSmooth||e.calculative.lineSmooth||0),a=new Path2D,i=0;i<t.length-1;i++){t[i];var o=t[i+1];if(i==0&&a.moveTo(t[i].x,t[i].y),i>0&&i<t.length-1){var n=t[i-1].curvePoints;qg(a,r,t[i],t[i+1])}i>0&&i<t.length-1&&Br(r,t[i],t[i+1]),i<t.length-2&&(o=Br(r,t[i+1],t[i])),a.lineTo(o.x,o.y)}return a}function R$(e,t,r,a,i){e===void 0&&(e=100);var o=null,n=[];!a&&!i?o=I$:a&&!i?o=M$:a&&i&&(o=L$);for(var s=0;s<e;s++)n.push(o(s/e,t,r,a,i));return a&&n.push(a),n}function I$(e,t,r){var a=t.x,i=t.y,o=r.x,n=r.y,s=a+(o-a)*e,u=i+(n-i)*e;return{x:s,y:u}}function M$(e,t,r,a){var i=t.x,o=t.y,n=r.x,s=r.y,u=a.x,c=a.y,l=(1-e)*(1-e)*i+2*e*(1-e)*n+e*e*u,f=(1-e)*(1-e)*o+2*e*(1-e)*s+e*e*c;return{x:l,y:f}}function L$(e,t,r,a,i){var o=t.x,n=t.y,s=i.x,u=i.y,c=r.x,l=r.y,f=a.x,h=a.y,d=o*(1-e)*(1-e)*(1-e)+3*c*e*(1-e)*(1-e)+3*f*e*e*(1-e)+s*e*e*e,v=n*(1-e)*(1-e)*(1-e)+3*l*e*(1-e)*(1-e)+3*h*e*e*(1-e)+u*e*e*e;return{x:d,y:v}}function O$(e,t){var r=t.calculative,a=r.worldRect,i=r.lineGradientFromColor,o=r.lineGradientToColor,n=r.lineGradientAngle;return ew(e,a,i,o,n)}function ew(e,t,r,a,i){if(!(!r||!a)){var o=t.x,n=t.y,s=t.center,u=t.ex,c=t.ey,l={x:o,y:s.y},f={x:u,y:s.y};i%90===0&&i%180?(l.x=s.x,f.x=s.x,i%270?(l.y=n,f.y=c):(l.y=c,f.y=n)):i&&(De(l,i,t.center),De(f,i,t.center));var h=e.createLinearGradient(l.x,l.y,f.x,f.y);return h.addColorStop(0,r),h.addColorStop(1,a),h}}function D$(e){var t=e.calculative,r=t.worldIconRect,a=t.iconWidth,i=t.iconHeight,o=t.imgNaturalWidth,n=t.imgNaturalHeight,s=r.x,u=r.y,c=r.width,l=r.height;if(a&&(c=a),i&&(l=i),o&&n&&e.imageRatio){var f=r.width/o,h=r.height/n,d=Math.min(f,h),v=o/n;a?l=a/v:i?c=i*v:(c=d*o,l=d*n)}switch(s+=(r.width-c)/2,u+=(r.height-l)/2,e.iconAlign){case"top":u=r.y;break;case"bottom":u=r.ey-l;break;case"left":s=r.x;break;case"right":s=r.ex-c;break;case"left-top":s=r.x,u=r.y;break;case"right-top":s=r.ex-c,u=r.y;break;case"left-bottom":s=r.x,u=r.ey-l;break;case"right-bottom":s=r.ex-c,u=r.ey-l;break}return{x:s,y:u,width:c,height:l}}function Ea(e,t){var r=D$(t),a=r.x,i=r.y,o=r.width,n=r.height,s=t.calculative,u=s.worldIconRect,c=s.iconRotate,l=s.img;if(c){var f=u.center,h=f.x,d=f.y;e.translate(h,d),e.rotate(c*Math.PI/180),e.translate(-h,-d)}if(t.imageRadius){e.save();var v=t.calculative.imageRadius||0,y=v,g=t.calculative.worldRect,m=g.x,w=g.y,p=g.width,x=g.height,T=g.ex,A=g.ey;v<1&&(v=p*v,y=x*y);var I=v<y?v:y;p<2*I&&(I=p/2),x<2*I&&(I=x/2),e.beginPath(),e.moveTo(m+I,w),e.arcTo(T,w,T,A,I),e.arcTo(T,A,m,A,I),e.arcTo(m,A,m,w,I),e.arcTo(m,w,T,w,I),e.clip(),e.drawImage(l,a,i,o,n),e.restore()}else e.drawImage(l,a,i,o,n)}function pi(e,t){var r=e.calculative,a=r.textColor,i=r.color,o=t.data,n=t.options;return a||i||o.textColor||o.color||n.textColor||n.color}function tw(e,t){var r=t.calculative,a=r.fontStyle,i=r.fontWeight,o=r.fontSize,n=r.fontFamily,s=r.lineHeight,u=r.text,c=r.hiddenText,l=r.canvas,f=r.textHasShadow,h=r.textBackground,d=r.textType;if(!(u==null||c)){var v=l.store;e.save(),f||(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0);var y=void 0;t.calculative.disabled?y=t.disabledTextColor||t.disabledColor||ht(.4,pi(t,v)):t.calculative.hover?y=t.hoverTextColor||t.hoverColor||v.options.hoverColor:t.calculative.active&&(y=t.activeTextColor||t.activeColor||v.options.activeColor);var g=void 0;d===Wa.Linear?g=A$(e,t):d===Wa.Radial&&(g=T$(e,t)),e.fillStyle=y||g||pi(t,v),e.font=qt({fontStyle:a,fontWeight:i,fontFamily:n||v.options.fontFamily,fontSize:o,lineHeight:s}),!t.calculative.textDrawRect&&Kb(e,t);var m=t.calculative.textDrawRect,w=m.x,p=m.y,x=m.width,T=m.height;h&&(e.save(),e.fillStyle=h,e.fillRect(w,p,x,T),e.restore());var A=.55,I=t.textAlign||v.options.textAlign,R=o*s;t.calculative.textLines.forEach(function(z,U){var _=t.calculative.textLineWidths[U],k=0;I==="center"?k=(x-_)/2:I==="right"&&(k=x-_),e.fillText(z,w+k,p+(U+A)*R);var S=t.textDecorationColor,P=t.textDecorationDash,B=t.textDecoration;B&&B$(e,{x:w+k,y:p+(U+A)*R,width:_},{textDecorationColor:S,textDecorationDash:P,fontSize:o});var D=t.textStrickoutColor,H=t.textStrickoutDash,L=t.textStrickout;L&&F$(e,{x:w+k,y:p+(U+A)*R,width:_},{textStrickoutColor:D,textStrickoutDash:H,fontSize:o})}),e.restore()}}function B$(e,t,r){var a=r.textDecorationColor,i=r.textDecorationDash,o=r.fontSize,n=t.x,s=t.y,u=t.width;switch(e.textBaseline){case"top":s+=o;break;case"middle":s+=o/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(n,s),e.setLineDash(i||[]),e.lineTo(n+u,s),e.stroke(),e.restore()}function F$(e,t,r){var a=r.textStrickoutColor,i=r.textStrickoutDash,o=r.fontSize,n=t.x,s=t.y,u=t.width;switch(e.textBaseline){case"top":s+=o/2;break;case"bottom":s-=o/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(n,s),e.setLineDash(i||[]),e.lineTo(n+u,s),e.stroke(),e.restore()}function rw(e,t,r){var a,i;if(r!=null){var o=t.calculative,n=o.fontStyle,s=o.fontWeight,u=o.fontSize,c=o.fontFamily,l=o.lineHeight,f=o.canvas,h=f.store;e.save();var d=void 0;t.calculative.hover?d=t.hoverTextColor||t.hoverColor||h.options.hoverColor:t.calculative.active&&(d=t.activeTextColor||t.activeColor||h.options.activeColor),e.fillStyle=d||pi(t,h),e.font=qt({fontStyle:n,fontWeight:s,fontFamily:c||h.options.fontFamily,fontSize:u,lineHeight:l});var v=e.measureText(r).width,y,g;try{for(var m=Go(t.calculative.worldAnchors),w=m.next();!w.done;w=m.next()){var p=w.value;if(!g){g=p;continue}var x=Tl(g,p),T=Math.floor(x/v);y="";for(var A=0;A<T;A++)y+=r;var I=Xt(g,p)-270;if(e.save(),I%360!==0){var R=g.x,z=g.y;e.translate(R,z);var U=I*Math.PI/180;e.rotate(U),e.translate(-R,-z)}e.fillText(y,g.x,g.y+l/2),e.restore(),g=p}}catch(_){a={error:_}}finally{try{w&&!w.done&&(i=m.return)&&i.call(m)}finally{if(a)throw a.error}}e.restore()}}function iw(e,t){var r=t.calculative.canvas.store;e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.textAlign="center",e.textBaseline="middle";var a=t.calculative.worldIconRect,i=a.x+a.width/2,o=a.y+a.height/2;switch(t.iconAlign){case"top":o=a.y,e.textBaseline="top";break;case"bottom":o=a.ey,e.textBaseline="bottom";break;case"left":i=a.x,e.textAlign="left";break;case"right":i=a.ex,e.textAlign="right";break;case"left-top":i=a.x,o=a.y,e.textAlign="left",e.textBaseline="top";break;case"right-top":i=a.ex,o=a.y,e.textAlign="right",e.textBaseline="top";break;case"left-bottom":i=a.x,o=a.ey,e.textAlign="left",e.textBaseline="bottom";break;case"right-bottom":i=a.ex,o=a.ey,e.textAlign="right",e.textBaseline="bottom";break}var n=t.calculative.iconWeight,s=void 0,u=t.calculative.iconFamily;t.calculative.iconSize>0?s=t.calculative.iconSize:a.width>a.height?s=a.height:s=a.width,e.font=qt({fontSize:s,fontWeight:n,fontFamily:u}),e.fillStyle=t.calculative.iconColor||pi(t,r),t.calculative.iconRotate&&(e.translate(a.center.x,a.center.y),e.rotate(t.calculative.iconRotate*Math.PI/180),e.translate(-a.center.x,-a.center.y)),e.beginPath(),e.fillText(t.calculative.icon,i,o),e.restore()}function qt(e){var t=e===void 0?{}:e,r=t.fontStyle,a=r===void 0?"normal":r,i=t.textDecoration,o=i===void 0?"normal":i,n=t.fontWeight,s=n===void 0?"normal":n,u=t.fontSize,c=u===void 0?12:u,l=t.fontFamily,f=l===void 0?"Arial":l,h=t.lineHeight,d=h===void 0?1:h;return a+" "+o+" "+s+" "+c+"px/"+d+" "+f}function qi(e,t){var r=t.calculative.worldRect||{},a=r.x,i=r.ex,o=r.y,n=r.ey;t.calculative.flipX&&(e.translate(a+i+.5,.5),e.scale(-1,1)),t.calculative.flipY&&(e.translate(.5,o+n+.5),e.scale(1,-1))}function jr(e,t,r){r===void 0&&(r=!1);var a=t.calculative.worldRect.pivot||t.calculative.worldRect.center,i=a.x,o=a.y;e.translate(i,o);var n=t.calculative.rotate*Math.PI/180;r||(t.calculative.flipX&&(n*=-1),t.calculative.flipY&&(n*=-1)),e.rotate(n),e.translate(-i,-o)}function Mi(e,t,r){var a,i;e.save(),e.translate(.5,.5),e.beginPath();var o=t.calculative.canvas.store,n=t.textFlip||o.options.textFlip,s=t.textRotate||o.options.textRotate;(!n||!s)&&e.save(),qi(e,t),t.calculative.rotate&&t.name!=="line"&&jr(e,t),(t.calculative.lineWidth>1||r)&&(e.lineWidth=t.calculative.lineWidth),K$(e,o,t);var u,c=!1,l=void 0;t.calculative.disabled?(l=t.disabledColor||o.options.disabledColor||ht(.4,t.calculative.color||Lo(o)),u=t.disabledBackground||o.options.disabledBackground||ht(.4,t.calculative.background||o.data.penBackground)):t.mouseDownValid&&t.calculative.mouseDown?(l=t.mouseDownColor||ht(-.4,t.calculative.color||Lo(o)),u=t.mouseDownBackground||ht(-.4,t.calculative.background||o.data.penBackground)):t.calculative.hover?(l=t.hoverColor||o.options.hoverColor,u=t.hoverBackground||o.options.hoverBackground):t.calculative.active?(l=t.activeColor||o.options.activeColor,u=t.activeBackground||o.options.activeBackground):t.calculative.isDock&&(t.type===Ae.Line?l=o.options.dockPenColor:u=Ts(o.options.dockPenColor,.2));var f=t.calculative.strokeImg;if(t.calculative.strokeImage&&f)e.strokeStyle=l||e.createPattern(f,"repeat");else{var h=void 0;t.calculative.strokeType?t.calculative.lineGradientColors?t.name==="line"?c=!0:t.calculative.lineGradient?h=t.calculative.lineGradient:(h=P$(e,t),t.calculative.lineGradient=h):h=O$(e,t):h=t.calculative.color||Lo(o),e.strokeStyle=l||h}var d=t.calculative.backgroundImg;if(t.calculative.backgroundImage&&d)e.fillStyle=u||e.createPattern(d,"repeat"),u=!0;else{var v=void 0;t.calculative.bkType===Wa.Linear?t.calculative.gradientColors?t.calculative.gradient?v=t.calculative.gradient:(v=S$(e,t),t.calculative.gradient=v):v=x$(e,t):t.calculative.bkType===Wa.Radial?t.calculative.gradientColors?t.calculative.radialGradient?v=t.calculative.radialGradient:(v=_$(e,t),t.calculative.radialGradient=v):v=C$(e,t):v=t.calculative.background||o.data.penBackground,e.fillStyle=u||v,u=!!v}if(aw(e,t),ow(e,t),Ki(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash.map(function(w){return w*t.calculative.canvas.store.data.scale})),t.calculative.lineDashOffset&&(e.lineDashOffset=t.calculative.lineDashOffset),t.calculative.shadowColor&&(e.shadowColor=t.calculative.shadowColor,e.shadowOffsetX=t.calculative.shadowOffsetX,e.shadowOffsetY=t.calculative.shadowOffsetY,e.shadowBlur=t.calculative.shadowBlur),c?(Zb(e,t),sw(!0,e,t,o)):(nw(!0,e,t,o,u),vw(e,t)),!(t.image&&t.calculative.img)&&t.calculative.icon&&iw(e,t),(!n||!s)&&e.restore(),n&&!s&&qi(e,t),!n&&s&&t.calculative.rotate&&t.name!=="line"&&jr(e,t,!0),tw(e,t),t.type===Ae.Line&&t.fillTexts)try{for(var y=Go(t.fillTexts),g=y.next();!g.done;g=y.next()){var m=g.value;rw(e,t,m)}}catch(w){a={error:w}}finally{try{g&&!g.done&&(i=y.return)&&i.call(y)}finally{if(a)throw a.error}}e.restore()}function aw(e,t){var r=t.lineCap||(t.type?"round":"square");r?e.lineCap=r:t.type&&(e.lineCap="round")}function ow(e,t){var r=t.lineJoin;r?e.lineJoin=r:t.type&&(e.lineJoin="round")}function As(e,t,r,a){var i,o,n,s;e.save(),r&&e.translate(-r.x,-r.y),(s=(n=e).setAttrs)===null||s===void 0||s.call(n,t);var u=!1,c=t.calculative.canvas.store,l=t.textFlip||c.options.textFlip,f=t.textRotate||c.options.textRotate;e.beginPath(),(!l||!f)&&e.save(),t.calculative.flipX&&(e.translate(t.calculative.worldRect.x+t.calculative.worldRect.ex,0),e.scale(-1,1)),t.calculative.flipY&&(e.translate(0,t.calculative.worldRect.y+t.calculative.worldRect.ey),e.scale(1,-1)),t.calculative.rotate&&t.name!=="line"&&jr(e,t),(t.calculative.lineWidth>1||a)&&(e.lineWidth=t.calculative.lineWidth);var h;if(t.calculative.hover)e.strokeStyle=t.hoverColor||c.options.hoverColor,e.fillStyle=t.hoverBackground||c.options.hoverBackground,h=t.hoverBackground||c.options.hoverBackground;else if(t.calculative.active)e.strokeStyle=t.activeColor||c.options.activeColor,e.fillStyle=t.activeBackground||c.options.activeBackground,h=t.activeBackground||c.options.activeBackground;else{if(t.strokeImage)t.calculative.strokeImg&&(e.strokeStyle=e.createPattern(t.calculative.strokeImg,"repeat"),h=!0);else{var d=void 0;t.calculative.strokeType&&t.calculative.lineGradientColors&&t.name==="line"?u=!0:d=t.calculative.color||Lo(c),e.strokeStyle=d}t.backgroundImage?t.calculative.backgroundImg&&(e.fillStyle=e.createPattern(t.calculative.backgroundImg,"repeat"),h=!0):(e.fillStyle=t.background,h=!!t.background)}if(aw(e,t),ow(e,t),Ki(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash),t.calculative.lineDashOffset&&(e.lineDashOffset=t.calculative.lineDashOffset),t.calculative.shadowColor&&(e.shadowColor=t.calculative.shadowColor,e.shadowOffsetX=t.calculative.shadowOffsetX,e.shadowOffsetY=t.calculative.shadowOffsetY,e.shadowBlur=t.calculative.shadowBlur),u?(Zb(e,t),sw(!0,e,t,c)):(nw(!1,e,t,c,h),vw(e,t)),t.calculative.img?(e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,Ea(e,t),e.restore()):t.calculative.icon&&iw(e,t),(!l||!f)&&e.restore(),l&&!f&&(t.calculative.flipX&&(e.translate(t.calculative.worldRect.x+t.calculative.worldRect.ex,0),e.scale(-1,1)),t.calculative.flipY&&(e.translate(0,t.calculative.worldRect.y+t.calculative.worldRect.ey),e.scale(1,-1))),!l&&f&&t.calculative.rotate&&t.name!=="line"&&jr(e,t,!0),tw(e,t),t.type===Ae.Line&&t.fillTexts)try{for(var v=Go(t.fillTexts),y=v.next();!y.done;y=v.next()){var g=y.value;rw(e,t,g)}}catch(m){i={error:m}}finally{try{y&&!y.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}e.restore()}function nw(e,t,r,a,i){e===void 0&&(e=!0);var o=e?a.path2dMap.get(r):he.path2dDraws[r.name],n=null,s=null;if(r.type===Ae.Line&&(r.fromLineCap&&r.fromLineCap!=="butt"&&(t.lineCap="butt",n=new Path2D,n.moveTo(r.calculative.worldAnchors[0].x,r.calculative.worldAnchors[0].y),n.lineTo(r.calculative.worldAnchors[0].x,r.calculative.worldAnchors[0].y)),r.toLineCap&&r.toLineCap!=="butt"&&(t.lineCap="butt",s=new Path2D,s.moveTo(r.calculative.worldAnchors[r.calculative.worldAnchors.length-1].x,r.calculative.worldAnchors[r.calculative.worldAnchors.length-1].y),s.lineTo(r.calculative.worldAnchors[r.calculative.worldAnchors.length-1].x,r.calculative.worldAnchors[r.calculative.worldAnchors.length-1].y))),o){if(r.type===Ae.Line&&r.borderWidth){t.save(),t.beginPath();var u=r.calculative.lineWidth+r.calculative.borderWidth;t.lineWidth=u,t.strokeStyle=r.borderColor,n&&(t.save(),t.lineCap=r.fromLineCap,t.stroke(n),t.restore()),o instanceof Path2D?(i&&t.fill(o),u&&t.stroke(o)):(o(r,t),i&&t.fill(),u&&t.stroke()),s&&(t.save(),t.lineCap=r.toLineCap,t.stroke(s),t.restore()),t.restore()}o instanceof Path2D?r.type?r.close&&i&&t.fill(o):i&&t.fill(o):(t.save(),o(r,t),i&&t.fill(),t.restore());var c=r.calculative.progress;if(c!=null){t.save();var l=r.calculative.worldRect,f=l.ex,h=l.x,d=l.y,v=l.width,y=l.height,g=l.ey,m=null;if(r.verticalProgress?m=r.reverseProgress?t.createLinearGradient(h,d,h,d+y*c):t.createLinearGradient(h,g,h,d+y*(1-c)):m=r.reverseProgress?t.createLinearGradient(f,d,h+v*(1-c),d):t.createLinearGradient(h,d,h+v*c,d),r.calculative.progressGradientColors){var w=ia(r.calculative.progressGradientColors).colors;w.forEach(function(T){m.addColorStop(T.i,T.color)})}else{var p=r.calculative.progressColor||r.calculative.color||a.options.activeColor;m.addColorStop(0,p),m.addColorStop(1,p)}m.addColorStop(1,"transparent"),t.fillStyle=m,o instanceof Path2D?t.fill(o):(o(r,t),t.fill()),t.restore()}if(r.calculative.lineWidth&&(o instanceof Path2D?(a.options.svgPathStroke||r.name!=="svgPath")&&(n&&(t.save(),t.lineCap=r.fromLineCap,t.stroke(n),t.restore()),t.stroke(o),s&&(t.save(),t.lineCap=r.toLineCap,t.stroke(s),t.restore())):(o(r,t),t.stroke())),r.type){if(r.calculative.animatePos){if(t.save(),lw(t,r,a),r.lineAnimateType===Ht.Arrow||r.lineAnimateType===Ht.WaterDrop){var x=kw(r,t);x instanceof Path2D?(t.stroke(x),t.fill(x)):(t.stroke(),t.fill())}else o instanceof Path2D?(n&&!r.lineAnimateType&&(t.save(),t.lineCap=r.fromLineCap,t.stroke(n),t.restore()),t.lineCap=r.lineCap,t.stroke(o)):(o(r,t),t.stroke());t.restore()}r.fromArrow&&Gb(t,r,a),r.toArrow&&Xb(t,r,a),r.calculative.active&&!r.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&cw(t,r)}}}function sw(e,t,r,a){var i=a.path2dMap.get(r);if(i&&r.type){if(r.calculative.animatePos){if(t.save(),lw(t,r,a),t.beginPath(),i instanceof Path2D)if(r.lineName==="polyline"||r.lineName==="line")if(r.lineAnimateType===Ht.Arrow||r.lineAnimateType===Ht.WaterDrop){var o=kw(r);t.stroke(o),t.fill(o)}else r.calculative.gradientSmooth||r.calculative.lineSmooth?(r.calculative.gradientAnimatePath||(r.calculative.gradientAnimatePath=oh(r)),r.calculative.gradientAnimatePath instanceof Path2D&&t.stroke(r.calculative.gradientAnimatePath)):t.stroke(i);else t.stroke(i);else i(r,t),t.stroke();t.restore()}r.fromArrow&&Gb(t,r,a),r.toArrow&&Xb(t,r,a),r.calculative.active&&!r.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&cw(t,r)}}function lw(e,t,r){e.strokeStyle=t.animateColor||r.options.animateColor,t.animateShadow&&(e.shadowBlur=t.animateShadowBlur||t.animateLineWidth||6,e.shadowColor=t.animateShadowColor||t.animateColor||r.options.animateColor),t.calculative.animateLineWidth&&(e.lineWidth=t.calculative.animateLineWidth*r.data.scale);var a=0;switch(t.lineAnimateType){case Ht.Beads:t.animateReverse?e.lineDashOffset=t.calculative.animatePos:e.lineDashOffset=t.length-t.calculative.animatePos,a=t.calculative.lineWidth||5,a<5&&(a=5);var i=t.animateLineDash&&t.animateLineDash.map(function(o){return o*a/5});e.setLineDash(i||[a,a*2]);break;case Ht.Dot:t.animateReverse?e.lineDashOffset=t.calculative.animatePos:e.lineDashOffset=t.length-t.calculative.animatePos,a=t.calculative.animateDotSize||t.calculative.lineWidth*2||6,a<6&&(a=6),a>40&&(a=40),e.lineWidth=(t.calculative.animateLineWidth||a)*r.data.scale,e.setLineDash([.1,t.length]);break;case Ht.Arrow:e.fillStyle=t.animateColor||r.options.animateColor,e.lineWidth=1;break;case Ht.WaterDrop:e.fillStyle=t.animateColor||r.options.animateColor,e.lineWidth=1;break;default:t.animateReverse?(e.lineDashOffset=Number.EPSILON,e.setLineDash([0,t.length-t.calculative.animatePos+1,t.calculative.animatePos])):e.setLineDash([t.calculative.animatePos,t.length+.01-t.calculative.animatePos]);break}}function Lo(e){var t=e.data,r=e.options;return t.color||r.color}function cw(e,t){var r=t.calculative.canvas.store;e.save(),e.lineWidth=1,e.fillStyle=t.activeColor||r.options.activeColor,t.calculative.worldAnchors.forEach(function(a){!a.hidden&&!a.isTemp&&N$(e,a,t)}),e.restore()}function N$(e,t,r){if(t){var a=r.calculative.canvas.store.activeAnchor===r.calculative.activeAnchor&&r.calculative.activeAnchor===t,i=3;r.calculative.lineWidth>3&&(i=r.calculative.lineWidth),r.anchorRadius&&(i=r.anchorRadius),t.radius&&(i=t.radius),a?(t.prev&&(e.save(),e.strokeStyle="#4dffff",e.beginPath(),e.moveTo(t.prev.x,t.prev.y),e.lineTo(t.x,t.y),e.stroke(),e.restore(),e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.prev.x,t.prev.y,i,0,Math.PI*2),e.fill(),e.stroke(),e.restore()),t.next&&(e.save(),e.strokeStyle="#4dffff",e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(t.next.x,t.next.y),e.stroke(),e.restore(),e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.next.x,t.next.y,i,0,Math.PI*2),e.fill(),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,i,0,Math.PI*2),e.fill(),e.stroke()),e.beginPath(),e.arc(t.x,t.y,i,0,Math.PI*2),e.fill(),e.stroke()):(e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.x,t.y,i,0,Math.PI*2),e.fill(),e.stroke(),e.restore())}}function uw(e){var t=e.calculative.canvas.store,r={x:e.x,y:e.y};if(!e.parentId||e.parentId&&!t.pens[e.parentId])e.parentId=void 0,r.width=e.width,r.height=e.height,r.rotate=e.rotate,Ke(r),Ue(r),e.pivot&&Ou(r,e.pivot);else{var a=t.pens[e.parentId],i=a.calculative.worldRect;i||(i=uw(a)),r.x=i.x+i.width*e.x,r.y=i.y+i.height*e.y,r.width=i.width*e.width,r.height=i.height*e.height,a.flipX&&(r.x=i.width-(r.x-i.x+r.width)+i.x),a.flipY&&(r.y=i.height-(r.y-i.y+r.height)+i.y),Ke(r),r.rotate=i.rotate+e.rotate,Ue(r),e.pivot&&Ou(r,e.pivot)}return e.calculative.worldRect=r,nh(e,r),r}function nh(e,t){!e.paddingTop&&(e.calculative.paddingTop=0),!e.paddingBottom&&(e.calculative.paddingBottom=0),!e.paddingLeft&&(e.calculative.paddingLeft=0),!e.paddingRight&&(e.calculative.paddingRight=0),Math.abs(e.calculative.paddingTop)<1&&(e.calculative.paddingTop*=t.height),Math.abs(e.calculative.paddingBottom)<1&&(e.calculative.paddingBottom*=t.height),Math.abs(e.calculative.paddingLeft)<1&&(e.calculative.paddingLeft*=t.width),Math.abs(e.calculative.paddingRight)<1&&(e.calculative.paddingRight*=t.width)}function os(e){var t=re(e.calculative.worldRect);if(delete t.pivot,!e.parentId){Object.assign(e,t);return}var r=e.calculative.canvas.store,a=r.pens[e.parentId].calculative.worldRect;Object.assign(e,ss(t,a))}function Oo(e){var t=e.calculative.canvas.store,r=[];if(e.anchors){var a=re(e.anchors);e.flipX&&a.forEach(function(c){c.x=.5-(c.x-.5)}),e.flipY&&a.forEach(function(c){c.y=.5-(c.y-.5)}),a.forEach(function(c){r.push($$(e,c))})}if(!r.length&&!e.type&&!e.calculative.canvas.parent.isCombine(e)){var i=e.calculative.worldRect,o=i.x,n=i.y,s=i.width,u=i.height;r=t.options.defaultAnchors.map(function(c,l){return{id:""+l,penId:e.id,x:o+s*c.x,y:n+u*c.y}})}e.calculative.rotate&&r.forEach(function(c){De(c,e.calculative.rotate,e.calculative.worldRect.pivot||e.calculative.worldRect.center)}),(!e.type||e.anchors)&&(e.calculative.worldAnchors=r),e.calculative.activeAnchor&&r.length&&(e.calculative.activeAnchor=r.find(function(c){c.id,e.calculative.activeAnchor.id})),e.calculative.gradientAnimatePath=void 0}function fw(e){var t;if(!((t=e.children)===null||t===void 0)&&t.length){var r=e.calculative.worldRect;e.children.forEach(function(a){var i=e.calculative.canvas.store.pens[a];i.calculative.initRect&&i.calculative.initRelativeRect&&(i.calculative.initRect.x=r.x+r.width*i.calculative.initRelativeRect.x,i.calculative.initRect.y=r.y+r.height*i.calculative.initRelativeRect.y,i.calculative.initRect.ex=i.calculative.initRect.x+r.width*i.calculative.initRelativeRect.width,i.calculative.initRect.ey=i.calculative.initRect.y+r.height+i.calculative.initRelativeRect.height,Ue(i.calculative.initRect)),fw(i)})}}function $$(e,t){var r=Iu({},t),a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;return r.x=i+n*t.x,r.y=o+s*t.y,t.prev&&(r.prev={penId:e.id,connectTo:t.prev.connectTo,x:i+n*t.prev.x,y:o+s*t.prev.y}),t.next&&(r.next={penId:e.id,connectTo:t.next.connectTo,x:i+n*t.next.x,y:o+s*t.next.y}),r}function Kg(e,t){var r=t.calculative,a=r.paddingTop,i=r.paddingBottom,o=r.paddingLeft,n=r.paddingRight,s=o,u=a,c=t.calculative.worldRect.width-o-n,l=t.calculative.worldRect.height-a-i,f=t.calculative.iconLeft,h=t.calculative.iconTop;f&&Math.abs(f)<1&&(f=t.calculative.worldRect.width*f),h&&Math.abs(h)<1&&(h=t.calculative.worldRect.height*h),s+=f||0,u+=h||0,c-=f||0,l-=h||0;var d=t.calculative.iconRotate||0;if(t.parentId){var v=e[t.parentId].calculative;v&&(d+=v.rotate,d%=360)}s=t.calculative.worldRect.x+s,u=t.calculative.worldRect.y+u,t.calculative.worldIconRect={x:s,y:u,width:c,height:l,rotate:d},Ke(t.calculative.worldIconRect),Ue(t.calculative.worldIconRect)}function ha(e,t,r){Qo(e.calculative.worldRect,t,r,e.pivot),e.calculative.initRect&&Qo(e.calculative.initRect,t,r,e.pivot),hw(e,t,r),e.calculative.x&&_s(e.calculative,t,r),e.type&&Oo(e)}function hw(e,t,r){var a;!((a=e.children)===null||a===void 0)&&a.length&&e.children.forEach(function(i){var o=e.calculative.canvas.store.pens[i];o&&o.calculative.initRect&&Qo(o.calculative.initRect,t,r),hw(o,t,r)})}function j$(e,t){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);var r={id:t.id,penId:e.id,x:t.x,y:t.y};if(e.calculative.worldAnchors.push(r),e.calculative.worldRect){e.rotate%360&&De(t,-e.rotate,e.calculative.worldRect.center);var a={id:t.id,penId:e.id,x:(t.x-e.calculative.worldRect.x)/e.calculative.worldRect.width,y:(t.y-e.calculative.worldRect.y)/e.calculative.worldRect.height};e.anchors.push(a)}return r}function z$(e,t,r){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);var a=q7(e,t,r);return e.calculative.worldAnchors.splice(r+1,0,a),e.anchors.splice(r+1,0,Do(a,e.calculative.worldRect)),e.calculative.activeAnchor=a,a}function H$(e,t){if(!(!e||!e.calculative.worldAnchors)){var r=e.calculative.worldAnchors.findIndex(function(a){return a.id===t.id});r>-1&&e.calculative.worldAnchors.splice(r,1),r=e.anchors.findIndex(function(a){return a.id===t.id}),r>-1&&e.anchors.splice(r,1)}}function Ua(e,t){if(!t||!t.calculative||!t.calculative.worldRect.center)return me.None;if(e.anchorId){var r=t.anchors.filter(function(a){return a.id===e.anchorId});if(r.length&&r[0].direction>-1)return r[0].direction}return zN(e,t.calculative.worldRect.center)}function xa(e,t){var r=1/0,a;return e.calculative.worldAnchors.forEach(function(i){var o=Tl(t,i);r>o&&(r=o,a=i)}),a}function Yg(e,t,r){e.x+=t,e.y+=r,e.anchors&&e.anchors.forEach(function(a){Io(a,t,r)}),e.calculative.worldAnchors&&e.calculative.worldAnchors.forEach(function(a){Io(a,t,r)})}function sh(e){if(e&&e.calculative&&e.calculative.worldAnchors.length){var t=Te(e);if(!e.anchors||!e.anchors.length)for(;e.calculative.worldAnchors.length&&t!==e.calculative.activeAnchor;)e.calculative.worldAnchors.pop(),t=Te(e);else t===e.calculative.activeAnchor?e.calculative.worldAnchors=[e.calculative.worldAnchors[0]]:e.calculative.worldAnchors[0]===e.calculative.activeAnchor&&(e.calculative.worldAnchors=[e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]])}}function ot(e,t,r,a){var i,o,n,s,u,c;if(!(!e||!t||!r||!a||t.twoWay===ct.DisableConnected||t.twoWay===ct.Disable||a.twoWay===ct.DisableConnectTo||a.twoWay===ct.Disable)){if(t.twoWay===ct.In){if(r.calculative.worldAnchors.length===1)return;var l=Te(r);if(a.id!==l.id)return}if(t.twoWay===ct.Out){var f=Ve(r);if(a.id!==f.id)return}if(!(a.connectTo===e.id&&a.anchorId===t.id)){if(a.connectTo){var h=e.calculative.canvas.store.pens[a.connectTo];Ca(h,Li(h,a.anchorId),r,a)}e.connectedLines||(e.connectedLines=[]);var d=e.connectedLines.findIndex(function(g){return g.lineId===r.id&&g.lineAnchor===a.id&&g.anchor===t.id});d<0&&e.connectedLines.push({lineId:r.id,lineAnchor:a.id,anchor:t.id}),a.connectTo=e.id,a.anchorId=t.id,e.type&&ot(r,a,e,t),e.calculative.canvas.store.emitter.emit("connectLine",{line:r,lineAnchor:a,pen:e,anchor:t});var v=((i=r.calculative.worldAnchors)===null||i===void 0?void 0:i.length)>=2?(o=r.calculative.worldAnchors)===null||o===void 0?void 0:o[0].connectTo:void 0,y=((n=r.calculative.worldAnchors)===null||n===void 0?void 0:n.length)>=2?(u=r.calculative.canvas.store.pens[(s=r.calculative.worldAnchors)===null||s===void 0?void 0:s[0].connectTo])===null||u===void 0?void 0:u.anchors.find(function(g){var m;return g.id===((m=r.calculative.worldAnchors)===null||m===void 0?void 0:m[0].anchorId)}):void 0;return(c=e.onConnectLine)===null||c===void 0||c.call(e,e,{line:r,lineAnchor:a,pen:e,anchor:t,fromPen:v,fromAnchor:y}),!0}}}function Ca(e,t,r,a){if(!(!e||!t||!r||!a)&&!(!e.connectedLines||!e.connectedLines.length))return r.lastConnected||(r.lastConnected={}),r.lastConnected[e.id]||(r.lastConnected[e.id]=re(e.connectedLines)),e.connectedLines.forEach(function(i,o,n){(i.lineId===r.id||i.lineId===r.id)&&i.lineAnchor===a.id&&i.anchor===t.id&&n.splice(o,1)}),a.connectTo=void 0,a.anchorId=void 0,e.type&&t.connectTo===r.id&&t.anchorId===a.id&&Ca(r,a,e,t),e.calculative.canvas.store.emitter.emit("disconnectLine",{line:r,lineAnchor:a,pen:e,anchor:t}),!0}function Li(e,t){var r;if(!(!e||!t))return(r=e.calculative.worldAnchors)===null||r===void 0?void 0:r.find(function(a){return a.id===t})}function Ve(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[0]}function Te(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]}function W$(e,t){var r,a,i,o,n,s;if(e.calculative.start===0||!e.frames||!e.frames.length)return e.calculative.start=void 0,0;if(!e.calculative.duration){e.calculative.duration=0;try{for(var u=Go(e.frames),c=u.next();!c.done;c=u.next()){var l=c.value;e.calculative.duration+=l.duration;for(var f in l)f!=="duration"&&!e[f]&&f==="scale"&&(e[f]=1)}}catch(R){r={error:R}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}}if(e.animateCycle||(e.animateCycle=1/0),e.calculative.start){var d=0,v=Math.ceil((t-e.calculative.start)/e.calculative.duration);if(v>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,Xg(e,1),0;var y=(t-e.calculative.start)%e.calculative.duration,g=0;try{for(var m=Go(e.frames),w=m.next();!w.done;w=m.next()){var p=w.value;if(g+=p.duration,y>g)++d;else break}}catch(R){i={error:R}}finally{try{w&&!w.done&&(o=m.return)&&o.call(m)}finally{if(i)throw i.error}}if(!e.frames[d])return!0;e.calculative.frameDuration=e.frames[d].duration,e.calculative.frameStart=e.calculative.start+e.calculative.duration*(v-1),e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration;var x=d!==e.calculative.frameIndex,T=v>e.calculative.cycleIndex;if(x&&(e.calculative.frameIndex=d),T&&(e.calculative.cycleIndex=v),x||T)if(e.calculative.x=e.calculative.initRect.x,e.calculative.y=e.calculative.initRect.y,!((s=e.children)===null||s===void 0)&&s.length&&!e.parentId?e.calculative.canvas.rotatePen(e,(e.calculative.initRect.rotate||0)-(e.calculative.rotate||0),e.calculative.initRect):e.calculative.rotate=e.calculative.initRect.rotate||0,d>0){e.prevFrame={};var A=e.frames[d-1];for(var f in A)e.prevFrame[f]=A[f];Object.assign(e.prevFrame,{rotate:A.rotate||0,x:A.x||0,y:A.y||0,scale:A.scale||1})}else Gg(e)}else{if(e.calculative.start=t,e.calculative.frameIndex=0,e.calculative.frameStart=e.calculative.start,e.calculative.frameDuration=e.frames[0].duration,e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration,e.calculative.cycleIndex=1,e.calculative.x=e.calculative.worldRect.x,e.calculative.y=e.calculative.worldRect.y,e.calculative.initRect=re(e.calculative.worldRect),e.parentId&&(e.calculative.initRelativeRect={x:e.x,y:e.y,width:e.width,height:e.height}),!((n=e.children)===null||n===void 0)&&n.length){var h=e.calculative.canvas.store;e.calculative.childrenVisible={},e.children.forEach(function(R){e.calculative.childrenVisible[R]=h.pens[R].visible})}e.calculative.initRect.rotate=e.calculative.rotate||0,Gg(e)}var I=(t-e.calculative.frameStart)/e.calculative.frameDuration%1;return Xg(e,I),!0}function Gg(e){e.prevFrame={};for(var t in e)(typeof e[t]!="object"||t==="lineDash")&&(e.prevFrame[t]=e[t]);e.prevFrame.rotate=0,e.prevFrame.x=0,e.prevFrame.y=0,e.prevFrame.scale=1}function Xg(e,t){var r,a;if(!(t<0)){t>1&&(t=1);var i=e.frames[e.calculative.frameIndex];for(var o in i)if(o!=="duration"){if(o==="scale"){e.calculative.worldRect=re(e.calculative.initRect),Qo(e.calculative.worldRect,e.prevFrame.scale,e.calculative.worldRect.center);var n=e.prevFrame.scale+(i[o]-e.prevFrame.scale)*t;Qo(e.calculative.worldRect,n/e.prevFrame.scale,e.calculative.worldRect.center),e.calculative.patchFlags=!0}else if(o==="x"){var s=gc(e,o,e.calculative.frameIndex);e.calculative.worldRect.x=e.calculative.initRect.x+s,e.calculative.worldRect.ex=e.calculative.initRect.ex+s,$i(e.calculative.worldRect,i[o]*t*e.calculative.canvas.store.data.scale,0),e.calculative.patchFlags=!0}else if(o==="y"){var s=gc(e,o,e.calculative.frameIndex);e.calculative.worldRect.y=e.calculative.initRect.y+s,e.calculative.worldRect.ey=e.calculative.initRect.ey+s,$i(e.calculative.worldRect,0,i[o]*t*e.calculative.canvas.store.data.scale),e.calculative.patchFlags=!0}else if(o==="rotate"){e.prevFrame[o]>=360&&(e.prevFrame[o]%=360);var s=gc(e,o,e.calculative.frameIndex),u=(e.calculative.initRect.rotate+s+i[o]*t)%360-(e.calculative.rotate||0);!((r=e.children)===null||r===void 0)&&r.length?e.calculative.canvas.rotatePen(e,u,e.calculative.initRect):e.calculative.rotate=(e.calculative.initRect.rotate+s+i[o]*t)%360,e.calculative.patchFlags=!0}else if(o==="image")e.image=i.image,e.calculative.image=void 0,e.calculative.canvas.loadImage(e),e.canvasLayer===_e.CanvasImageBottom?e.calculative.canvas.canvasImageBottom.init():e.canvasLayer===_e.CanvasImage&&e.calculative.canvas.canvasImage.init();else if(U$(i[o],o,e)){e.prevFrame[o]==null&&(o==="globalAlpha"?e.prevFrame[o]=1:e.prevFrame[o]=0);var c=e.prevFrame[o]+(i[o]-e.prevFrame[o])*t;e.calculative[o]=Math.round(c*100)/100}else{if(o==="visible"){if(e.calculative.image)e.canvasLayer===_e.CanvasImageBottom?e.calculative.canvas.canvasImageBottom.init():e.canvasLayer===_e.CanvasImage&&e.calculative.canvas.canvasImage.init();else if(!((a=e.children)===null||a===void 0)&&a.length){var l=br(e,e.calculative.canvas.store);e.calculative.canvas.initImageCanvas(l)}}e.calculative[o]=i[o];var f={};f[o]=i[o],lh(e,f)}o==="text"&&wn(e)}}}function U$(e,t,r){var a=["strokeType","bkType","showChild"];return typeof e=="number"&&r.linear!==!1&&!a.includes(t)}function V$(e,t){if(e.calculative.start===0)return e.calculative.start=void 0,0;if(e.animateCycle||(e.animateCycle=1/0),e.animateSpan||(e.animateSpan=1),e.calculative.animatePos+=e.animateSpan*(e.calculative.canvas.store.data.scale||1),!e.calculative.start)e.calculative.start=Date.now(),e.calculative.animatePos=e.animateSpan*(e.calculative.canvas.store.data.scale||1),e.calculative.cycleIndex=1;else if(e.calculative.animatePos>e.length){if(++e.calculative.cycleIndex,e.calculative.cycleIndex>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,0;e.calculative.animatePos=e.animateSpan}return!0}function pa(e,t){if(t===void 0&&(t=!0),!!e.children){var r=e.calculative.canvas.store;e.children.forEach(function(a){var i=r.pens[a];i&&(i.calculative.active=t,pa(i,t))})}}function bo(e,t){if(t===void 0&&(t=!0),!!e){var r=e.calculative.canvas.store;e.calculative.hover=t,e.children&&e.children.forEach(function(a){var i,o;((i=r.pens[a])===null||i===void 0?void 0:i.hoverColor)==null&&((o=r.pens[a])===null||o===void 0?void 0:o.hoverBackground)==null&&bo(r.pens[a],t)})}}function Ye(e,t){if(t){var r=e.calculative.canvas.store,a=e.calculative.worldRect;t.style.opacity=e.globalAlpha+"",t.style.position="absolute",t.style.outline="none",t.style.left=a.x+r.data.x+"px",t.style.top=a.y+r.data.y+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.style.display=e.calculative.inView!=!1?e.calculative.cssDisplay||"inline":"none",!e.calculative.rotate&&(e.calculative.rotate=0),t.style.transform="rotate("+e.calculative.rotate+"deg)",e.calculative.rotate||(e.calculative.flipX&&(t.style.transform="rotateY(180deg)"),e.calculative.flipY&&(t.style.transform="rotateX(180deg)"),e.calculative.flipX&&e.calculative.flipY&&(t.style.transform="rotateZ(180deg)")),t.style.zIndex=e.calculative.zIndex!==void 0?e.calculative.zIndex+"":"5",e.calculative.zIndex>e.calculative.canvas.maxZindex&&(e.calculative.canvas.maxZindex=e.calculative.zIndex),e.locked===ke.DisableEdit||e.locked===ke.DisableMove||r.data.locked?(t.style.userSelect="initial",t.style.pointerEvents="initial",e.name==="gif"&&(t.style.userSelect="none",t.style.pointerEvents="none")):(t.style.userSelect="none",t.style.pointerEvents="none")}}function vc(e){return e.every(function(t){return t.locked})}function Qg(e){return e.every(function(t){return t.disableRotate})}function dw(e,t,r){var a;e.type?(e.calculative.worldAnchors.forEach(function(i){De(i,t,r.center)}),q$(e),os(e)):(e.calculative.rotate?e.calculative.rotate+=t:e.calculative.rotate=t,De(e.calculative.worldRect.center,t,r.center),e.parentId&&(e.calculative.worldRect.x=e.calculative.worldRect.center.x-e.calculative.worldRect.width/2,e.calculative.worldRect.y=e.calculative.worldRect.center.y-e.calculative.worldRect.height/2,e.x=(e.calculative.worldRect.x-r.x)/r.width,e.y=(e.calculative.worldRect.y-r.y)/r.height)),(a=e.children)===null||a===void 0||a.forEach(function(i){var o=e.calculative.canvas.store.pens[i];dw(o,t,r)})}function q$(e){var t;if(!((t=e.calculative.worldAnchors)===null||t===void 0)&&t.length&&!(!isFinite(e.x)||!isFinite(e.x))&&!(e.x==null||e.y==null)){var r=Nu(e);e.parentId||Object.assign(e,r);var a=e.calculative.canvas.store.options,i=a.fontSize,o=a.lineHeight;e.fontSize||(e.fontSize=i,e.calculative.fontSize=e.fontSize*e.calculative.canvas.store.data.scale),e.lineHeight||(e.lineHeight=o,e.calculative.lineHeight=e.lineHeight),Ue(r),e.calculative.worldRect=r,nh(e,r),Cr(e),e.calculative.worldAnchors&&(e.anchors=e.calculative.worldAnchors.map(function(n){return Do(n,e.calculative.worldRect)}))}}function Jg(e){return e.every(function(t){return t.disableSize||t.pivot})}function gc(e,t,r){if(!e.frames||!t)return 0;for(var a=0,i=0;i<r;i++)e.frames[i]&&(a+=e.frames[i][t]||0);return a}function Es(e,t){for(var r,a=e;a&&a.parentId;){var i=a;a=t.pens[a.parentId];var o=(r=a==null?void 0:a.calculative)===null||r===void 0?void 0:r.showChild;if(o!=null){var n=a.children[o];if(n!==i.id)return!1}}return!0}function Dr(e,t){var r,a;t===void 0&&(t=!1);var i=e.calculative.canvas,o=i.store,n=i.canvasRect;if(t&&((r=e.children)===null||r===void 0||r.forEach(function(v){var y=o.pens[v];y&&Dr(y,!0)})),e.calculative.inView=!0,!Es(e,o)||e.visible==!1||e.calculative.visible==!1)e.calculative.inView=!1;else{var s=e.calculative.worldRect,u=s.x,c=s.y,l=s.width,f=s.height,h=s.rotate,d={x:u+o.data.x,y:c+o.data.y,width:l,height:f,rotate:h};Ke(d),si(d,n)||(e.calculative.inView=!1)}!((a=e.calculative.singleton)===null||a===void 0)&&a.div&&Ye(e,e.calculative.singleton.div)}function K$(e,t,r){if(t.fillWorldTextRect){e.save(),e.fillStyle="#c3deb7";var a=r.calculative.worldTextRect,i=a.x,o=a.y,n=a.width,s=a.height;e.fillRect(i,o,n,s),e.restore()}}function Ki(e,t){var r=t.calculative.globalAlpha;typeof r=="number"&&r<1&&!isNaN(r)&&(e.globalAlpha=r)}function vw(e,t){var r=Y$(e,t)||he.canvasDraws[t.name];r&&(e.save(),r(e,t),e.restore())}function Y$(e,t){var r=t.drawCommand;if(!(!r||t.name==="line"))return function(a,i){r.forEach(function(o){try{o.steps.reduce(function(n,s){var u=G$(s,i,n.x,n.y);try{if(u.c){var c=[];for(var l in u.v)c.push(u.v[l]);return a[u.c].apply(a,rh([],th(c),!1)),a.moveTo(u.startX||u.v.x,u.startY||u.v.y),{x:u.startX||u.v.x,y:u.startY||u.v.y}}return{x:n.x,y:n.y}}catch{}},{})}catch{}}),a.stroke()}}function G$(e,t,r,a){var i={visio:Q$,dxf:X$};return i[t.parseType](e,t,r,a)}function X$(e,t,r,a){var i=t.calculative.worldRect;switch(i.x,i.y,i.width,i.height,e.c){case"moveTo":return{c:"moveTo",v:{x:e.v.x*t.calculative.canvas.store.data.scale,y:window.innerHeight-e.v.y*t.calculative.canvas.store.data.scale}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*t.calculative.canvas.store.data.scale,y:window.innerHeight-e.v.y*t.calculative.canvas.store.data.scale}};case"arc":return{c:"arc",v:{x:e.v.x*t.calculative.canvas.store.data.scale,y:window.innerHeight-e.v.y*t.calculative.canvas.store.data.scale,r:e.v.r*t.calculative.canvas.store.data.scale,startAngle:e.v.startAngle,endAngle:e.v.endAngle}}}return e}function Q$(e,t,r,a){var i=t.calculative.worldRect,o=i.x,n=i.y,s=i.width,u=i.height,c=t.origin,l=c.width,f=c.height;switch(e.c){case"MoveTo":return{c:"moveTo",v:{x:+e.v.X*100*(s/l)+o,y:+e.v.Y*100*(u/f)+n}};case"RelMoveTo":return{c:"moveTo",v:{x:+e.v.X*l*(s/l)+o,y:+e.v.Y*f*(u/f)+n}};case"LineTo":return{c:"lineTo",v:{x:+e.v.X*100*(s/l)+o,y:+e.v.Y*100*(u/f)+n}};case"RelLineTo":return{c:"lineTo",v:{x:+e.v.X*l*(s/l)+o,y:+e.v.Y*f*(u/f)+n}};case"Ellipse":var h=e.v.X,d=e.v.Y,v=Math.abs(e.v.A-e.v.C),y=Math.abs(e.v.B-e.v.D);return{c:"ellipse",v:{x:h*100*(s/l)+o,y:d*100*(u/f)+n,radiuX:v*100*(s/l),radiuY:y*100*(u/f),rotation:0,startAngle:0,endAngle:Math.PI*2,anticlockwise:!0}};case"EllipticalArcTo":var g=e.v.X*100*(s/l)+o,m=e.v.Y*100*(u/f)+n,w=e.v.A*100*(s/l)+o,p=e.v.B*100*(u/f)+n,x=e.v.C,T=e.v.D*(s/u)*(f/l),A=J$(r,a,g,m,w,p,T);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=Zg(A.x0,A.y0,r,a)),!e.orign.endA&&(e.orign.endA=Zg(A.x0,A.y0,g,m)),{c:"ellipse",v:{centerX:A.x0,centerY:A.y0,radiuX:A.a,radiuY:A.b,rotation:0,startAngle:e.orign.startA,endAngle:e.orign.endA,anticlockwise:+x<0},startX:g,startY:m};case"ArcTo":var I=e.v.X*100*s/l+o,R=e.v.Y*100*u/f+n,z=e.v.A*100*(s/u)*(f/l),U=(r+I)/2,_=(a+R)/2,k=Math.sqrt(Math.pow(I-r,2)+Math.pow(R-a,2)),S=Math.pow(k,2)/(8*z)+z/2,P=-(R-a)/k,B=(I-r)/k,D=U+P*S,H=_+B*S,L=D,M=H,j=Math.atan2(a-M,r-L),W=Math.atan2(R-M,I-L);return{c:"arc",v:{x:L,y:M,radius:S,startAngle:j,endAngle:W,aclockwise:!0}};default:return{}}}function lh(e,t){for(var r in t)Vb.includes(r)&&(e[r]=t[r],["fontSize","lineWidth"].includes(r)?(e.calculative[r]=t[r]*e.calculative.canvas.store.data.scale,Cr(e)):e.calculative[r]=t[r]);if(e.calculative.canvas.parent.isCombine(e)){var a=e.children;a==null||a.forEach(function(i){var o=re(t);e.calculative.childrenVisible&&e.calculative.childrenVisible[i]===!1&&delete o.visible;var n=e.calculative.canvas.store.pens[i];n&&lh(n,o)})}}function J$(e,t,r,a,i,o,n){var s=(e-r)*(e+r)*(a-o)-(r-i)*(r+i)*(t-a)+n*n*(t-a)*(a-o)*(t-o),u=2*((e-r)*(a-o)-(r-i)*(t-a)),c=s/u,l=(e-r)*(r-i)*(e-i)+n*n*((r-i)*(t-a)*(t+a)-(e-r)*(a-o)*(a+o)),f=2*n*n*((r-i)*(t-a)-(e-r)*(a-o)),h=l/f,d=Math.sqrt(Math.pow(e-c,2)+Math.pow(n*(t-h),2)),v=d/n;return{x0:c,y0:h,a:d,b:v}}function Zg(e,t,r,a){var i=r-e,o=a-t,n=Math.atan2(o,i);return n<0&&(n+=2*Math.PI),n}var Xo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Mu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},ns=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function ey(e,t,r){var a,i,o,n,s=1/0,u=1/0,c=8,l=function(v){if(v.calculative.inView===!1)return"continue";var y=ch(v);y.forEach(function(g){if(!(g===t||g===r)){var m=(v.calculative.worldRect.center.x-t.x)*(v.calculative.worldRect.center.x-t.x)+(v.calculative.worldRect.center.y-t.y)*(v.calculative.worldRect.center.y-t.y),w=Math.abs(g.x-t.x);w>0&&w<c&&m<s&&(o={x:Math.round(g.x)+.5,y:Math.round(g.y)+.5,prev:{x:Math.round(t.x)+.5,y:Math.round(t.y)+.5},step:g.x-t.x},s=m);var p=Math.abs(g.y-t.y);p>0&&p<c&&m<u&&(n={x:Math.round(g.x)+.5,y:Math.round(g.y)+.5,prev:{x:Math.round(t.x)+.5,y:Math.round(t.y)+.5},step:g.y-t.y},u=m)}})};try{for(var f=Xo(e.data.pens),h=f.next();!h.done;h=f.next()){var d=h.value;l(d)}}catch(v){a={error:v}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(a)throw a.error}}return{xDock:o,yDock:n}}function Z$(e,t,r,a){var i=[];return r.length===1?(i=re(ch(r[0])),i.forEach(function(o){o.x+=a.x,o.y+=a.y})):(Ue(t),i=ns([t.center],Mu(zr(t)),!1)),gw(e,i,t,!0)}function ch(e){if(e.type){if(e.type===Ae.Line)return e.calculative.worldAnchors}else{var t=zr(e.calculative.worldRect);return Ue(e.calculative.worldRect),ns(ns(ns([],Mu(e.calculative.worldAnchors),!1),Mu(t),!1),[e.calculative.worldRect.center],!1)}}function e7(e,t,r,a){var i=zr(t);return gw(e,i,t)}function gw(e,t,r,a){a===void 0&&(a=!1);var i,o,n=1/0,s=1/0,u=10,c=c7(r,u);return e.data.pens.forEach(function(l){var f,h,d,v,y=l.calculative,g=y.inView,m=y.worldRect,w=y.active;if(!(g===!1||!a&&w||l7(c,m)||l.type&&e.active.some(function(P){return yw(e,P,l)}))){var p=ch(l);if(p)try{for(var x=Xo(p),T=x.next();!T.done;T=x.next()){var A=T.value;try{for(var I=(d=void 0,Xo(t)),R=I.next();!R.done;R=I.next()){var z=R.value,U=A.x-z.x,_=A.y-z.y,k=Math.abs(U),S=Math.abs(_);r.center||(r.center={x:r.x+r.width/2,y:r.y+r.height/2}),k<u&&k<n&&(i={x:Math.round(A.x)+.5,y:Math.round(A.y)+.5,step:U,prev:{x:Math.round(z.x)+.5,y:Math.round(z.y)+.5},penId:l.id,anchorId:z.id,dockAnchorId:A.id},n=k),S<u&&S<s&&(o={x:Math.round(A.x)+.5,y:Math.round(A.y)+.5,step:_,prev:{x:Math.round(z.x)+.5,y:Math.round(z.y)+.5},penId:l.id,anchorId:z.id,dockAnchorId:A.id},s=S)}}catch(P){d={error:P}}finally{try{R&&!R.done&&(v=I.return)&&v.call(I)}finally{if(d)throw d.error}}}}catch(P){f={error:P}}finally{try{T&&!T.done&&(h=x.return)&&h.call(x)}finally{if(f)throw f.error}}}}),{xDock:i,yDock:o}}function yw(e,t,r){var a,i,o,n;if(!r.type)return!1;if(Array.isArray(t==null?void 0:t.connectedLines))try{for(var s=Xo(t==null?void 0:t.connectedLines),u=s.next();!u.done;u=s.next()){var c=u.value;if(c.lineId===r.id)return!0}}catch(v){a={error:v}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(a)throw a.error}}if(Array.isArray(t==null?void 0:t.children))try{for(var l=Xo(t.children),f=l.next();!f.done;f=l.next()){var h=f.value,d=e.pens[h];if(yw(e,d,r))return!0}}catch(v){o={error:v}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(o)throw o.error}}return!1}function Lu(e,t){return e.toFixed(12)==t}var t7=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function ty(e){var t,r;if(e.id=xe(),Array.isArray(e.anchors))try{for(var a=t7(e.anchors),i=a.next();!i.done;i=a.next()){var o=i.value;e.type&&(o.id=xe()),o.penId=e.id,o.prev&&(e.type&&(o.prev.id=xe()),o.prev.penId=e.id),o.next&&(e.type&&(o.next.id=xe()),o.next.penId=e.id)}}catch(n){t={error:n}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}var ry=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},iy=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function r7(){var e=null,t=new Map;return function(r,a,i,o){if(o===void 0&&(o=!1),t.has(r)&&t.get(r)?e=t.get(r):t.set(r,e=new Map),typeof i!="function")return function(){console.warn("[rewritePenLifeCycle] warn: not a function ")};var n=new Set,s=new Map;e.has(a)&&e.get(a)?n=e.get(a):(s.set(a,r[a]),e.set(a,n)),o?n.delete(i):n.add(i);var u=s.get(a),c=function(){for(var l=[],f=0;f<arguments.length;f++)l[f]=arguments[f];u==null||u.apply(void 0,iy([],ry(l),!1)),n.forEach(function(h){h.apply(void 0,iy([],ry(l),!1))})};r[a]=c}}var i7=r7();function a7(e){return!e.name&&!e.install?(console.error("installPenPlugin Error: Validation Failed"),!1):!0}var pw=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o7=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},n7=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function Jr(e,t){if(t){if(t.ex==null&&Ke(t),!t.rotate||t.rotate%360===0)return e.x>t.x&&e.x<t.ex&&e.y>t.y&&e.y<t.ey;t.center||Ue(t);var r=[{x:t.x,y:t.y},{x:t.ex,y:t.y},{x:t.ex,y:t.ey},{x:t.x,y:t.ey}];return r.forEach(function(a){De(a,t.rotate,t.pivot||t.center)}),s7(e,r)}}function Yi(e,t,r){r===void 0&&(r=0);var a=t.x,i=t.y,o=t.ex,n=t.ey;return e.x>=a-r&&e.x<=o+r&&e.y>=i-r&&e.y<=n+r}function Ue(e){e.center||(e.center={}),e.center.x=e.x+e.width/2,e.center.y=e.y+e.height/2}function Ke(e){e.ex=e.x+e.width,e.ey=e.y+e.height}function Ou(e,t){e.pivot||(e.pivot={}),e.pivot.x=e.x+e.width*t.x,e.pivot.y=e.y+e.height*t.y}function s7(e,t){var r,a;if(t.length<3)return!1;var i=!1,o=t[t.length-1];try{for(var n=pw(t),s=n.next();!s.done;s=n.next()){var u=s.value;o.y>e.y!=u.y>e.y&&u.x+(e.y-u.y)*(o.x-u.x)/(o.y-u.y)>e.x&&(i=!i),o=u}}catch(c){r={error:c}}finally{try{s&&!s.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return i}function kr(e){var t=[];e.forEach(function(a){if(!a.isRuleLine){var i=a.calculative.worldRect;if(i){var o=zr(i);t.push.apply(t,n7([],o7(o),!1))}}});var r=xn(t);return Ue(r),r}function zr(e){var t=[{x:e.x,y:e.y},{x:e.ex,y:e.y},{x:e.ex,y:e.ey},{x:e.x,y:e.ey}];return e.rotate&&(e.center||Ue(e),t.forEach(function(r){De(r,e.rotate,e.pivot||e.center)})),t}function xn(e){var t=1/0,r=1/0,a=-1/0,i=-1/0;return e==null||e.forEach(function(o){!isFinite(o.x)||!isFinite(o.y)||(t=Math.min(t,o.x),r=Math.min(r,o.y),a=Math.max(a,o.x),i=Math.max(i,o.y))}),{x:t,y:r,ex:a,ey:i,width:a-t,height:i-r}}function si(e,t,r){return e.rotate&&(e=xn(zr(e))),r?e.x>t.x&&e.ex<t.ex&&e.y>t.y&&e.ey<t.ey:!(e.x>t.ex||e.ex<t.x||e.ey<t.y||e.y>t.ey)}function l7(e,t){return(t.x>e.ex||t.ex<e.x)&&(t.y>e.ey||t.ey<e.y)}function c7(e,t){var r=Or(t),a={x:e.x-r[3],y:e.y-r[0],width:e.width+r[1]+r[3],height:e.height+r[0]+r[2]};return Ke(a),a}function $i(e,t,r){e.x+=t,e.y+=r,e.ex+=t,e.ey+=r,e.center&&(e.center.x+=t,e.center.y+=r),e.pivot&&(e.pivot.x+=t,e.pivot.y+=r)}function u7(e,t){var r=(e.to.y-e.from.y)/(e.to.x-e.from.x),a=(t.to.y-t.from.y)/(t.to.x-t.from.x);return Du({k:r,point:e.from},{k:a,point:t.from})}function Du(e,t){if(Lu(e.k,0))return{x:t.point.x,y:e.point.y};if(Lu(t.k,0))return{x:e.point.x,y:t.point.y};var r=e.point.y-e.k*e.point.x,a=t.point.y-t.k*t.point.x,i=(a-r)/(e.k-t.k),o=e.k*i+r;return{x:i,y:o}}function f7(e,t){var r,a,i=u7({from:e[0],to:e[2]},{from:e[1],to:e[3]});try{for(var o=pw(e),n=o.next();!n.done;n=o.next()){var s=n.value;De(s,-t,i)}}catch(u){r={error:u}}finally{try{n&&!n.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return xn(e)}function ay(e,t,r,a){var i=e.rotate?e.rotate%360:0;if(i){var o=zr(e),n=(o[0].y-o[1].y)/(o[0].x-o[1].x),s=(o[1].y-o[2].y)/(o[1].x-o[2].x);if(a<4){if(o[a].x+=t,e.ratio)if(a===0||a===2){var u=t*Math.tan((90-(360-i)-Math.atan(e.width/e.height)/Math.PI*180)/180*Math.PI);o[a].y+=u}else{var u=t*Math.tan((90-(360-i)+Math.atan(e.width/e.height)/Math.PI*180)/180*Math.PI);o[a].y+=u}else o[a].y+=r;var c=o[(a+2)%4];o[(a+1)%4]=Du({k:a%2?s:n,point:o[a]},{k:a%2?n:s,point:c}),o[(a+4-1)%4]=Du({k:a%2?n:s,point:o[a]},{k:a%2?s:n,point:c})}else{var l=[4,6].includes(a)?s:n;Lu(l,0)?(o[a%4].x+=t,o[(a+1)%4].x+=t):(o[a%4].y+=r,o[a%4].x+=r/l,o[(a+1)%4].y+=r,o[(a+1)%4].x+=r/l)}if(Math.pow(o[0].x-o[1].x,2)+Math.pow(o[0].y-o[1].y,2)<25||Math.pow(o[1].x-o[2].x,2)+Math.pow(o[1].y-o[2].y,2)<25)return;var f=f7(o,e.rotate);Ue(f),Object.assign(e,f);return}switch(a){case 0:if(e.width-t<5||e.height-r<5)break;e.x+=t,e.y+=r,e.width-=t,e.height-=r;break;case 1:if(e.width+t<5||e.height-r<5)break;e.ex+=t,e.y+=r,e.width+=t,e.height-=r;break;case 2:if(e.width+t<5||e.height+r<5)break;e.ex+=t,e.ey+=r,e.width+=t,e.height+=r;break;case 3:if(e.width-t<5||e.height+r<5)break;e.x+=t,e.ey+=r,e.width-=t,e.height+=r;break;case 4:if(e.height-r<5)break;e.y+=r,e.height-=r;break;case 5:if(e.width+t<5)break;e.ex+=t,e.width+=t;break;case 6:if(e.height+r<5)break;e.ey+=r,e.height+=r;break;case 7:if(e.width-t<5)break;e.x+=t,e.width-=t;break}}function Qo(e,t,r,a){e&&(e.width*=t,e.height*=t,_s(e,t,r),Ke(e),Ue(e),a&&Ou(e,a))}function ss(e,t){var r={x:(e.x-t.x)/t.width,y:(e.y-t.y)/t.height,width:e.width/t.width,height:e.height/t.height};return Ke(r),r}function Do(e,t){var r=t.x,a=t.y,i=t.width,o=t.height,n=e.penId,s=e.connectTo,u=Object.assign({},e,{x:i?(e.x-r)/i:0,y:o?(e.y-a)/o:0});return e.prev&&(u.prev={penId:n,connectTo:s,x:i?(e.prev.x-r)/i:0,y:o?(e.prev.y-a)/o:0}),e.next&&(u.next={penId:n,connectTo:s,x:i?(e.next.x-r)/i:0,y:o?(e.next.y-a)/o:0}),u}function h7(e,t){for(var r=!1,a=0,i=t.length-1;a<t.length;i=a++){var o=t[a].x,n=t[a].y,s=t[i].x,u=t[i].y,c=n>e.y!=u>e.y&&e.x<(s-o)*(e.y-n)/(u-n)+o;c&&(r=!r)}return r}var d7=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},v7=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))},g7=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},y7=/^[\t\n\f\r ]*([MLHVZCSQTAmlhvzcsqta])[\t\n\f\r ]*/,oy=/^[01]/,Be=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,p7=/^(([\t\n\f\r ]+,?[\t\n\f\r ]*)|(,[\t\n\f\r ]*))/,m7={M:[Be,Be],L:[Be,Be],H:[Be],V:[Be],Z:[],C:[Be,Be,Be,Be,Be,Be],S:[Be,Be,Be,Be],Q:[Be,Be,Be,Be],T:[Be,Be],A:[Be,Be,Be,oy,oy,Be,Be]};function b7(e){for(var t=0,r=[];t<e.length;){var a=e.slice(t).match(y7);if(a!==null){var i=a[1];t+=a[0].length;var o=k7(i,e,t);t=o.cursor,r.push.apply(r,v7([],d7(o.commands),!1))}else throw new Error("malformed path (first error at "+t+")")}return{commands:r}}function ny(e){var t=1/0,r=1/0,a=-1/0,i=-1/0;return S7(e),e.commands.forEach(function(o){o.worldPoints.forEach(function(n,s){s%2===0?(n<t&&(t=n),n>a&&(a=n)):(n<r&&(r=n),n>i&&(i=n))})}),--t,--r,{x:t,y:r,ex:a,ey:i,width:a-t+1,height:i-r+1}}function w7(e,t,r){r==null&&(r=t),e.commands.forEach(function(a,i){if(!(a.relative&&i))switch(a.key){case"A":case"a":a.values[5]+=t,a.values[6]+=r;break;case"V":case"v":a.values[0]+=r;break;default:a.values.forEach(function(o,n){a.values[n]=o+(n%2===0?t:r)});break}})}function x7(e,t,r){r==null&&(r=t),e.commands.forEach(function(a){switch(a.key){case"A":case"a":var i=a.values[0],o=a.values[1],n=Math.PI*a.values[2]/180,s=Math.cos(n),u=Math.sin(n),c=o*o*r*r*s*s+i*i*r*r*u*u,l=2*t*r*s*u*(o*o-i*i),f=i*i*t*t*s*s+o*o*t*t*u*u,h=-(i*i*o*o*t*t*r*r),d=l*l-4*c*f,v=Math.sqrt((c-f)*(c-f)+l*l);a.values[2]=l!==0?Math.atan((f-c-v)/l)*180/Math.PI:c<f?0:90,a.values[0]=-Math.sqrt(2*d*h*(c+f+v))/d,a.values[1]=-Math.sqrt(2*d*h*(c+f-v))/d,a.values[5]*=t,a.values[6]*=r,a.values[4]=t*r>=0?a.values[4]:1-a.values[4];break;case"V":case"v":a.values[0]*=r;break;default:a.values.forEach(function(y,g){a.values[g]=y*(g%2===0?t:r)});break}})}function C7(e){var t="";return e.commands.forEach(function(r){t+=r.key+" ",r.values.forEach(function(a){t+=a+" "})}),t}function k7(e,t,r){for(var a,i,o=m7[e.toUpperCase()],n=[];r<=t.length;){var s={key:e,values:[]};try{for(var u=(a=void 0,g7(o)),c=u.next();!c.done;c=u.next()){var l=c.value,f=t.slice(r).match(l);if(f!==null){s.values.push(+f[0]),r+=f[0].length;var h=t.slice(r).match(p7);h!==null&&(r+=h[0].length)}else{if(s.values.length===0)return{cursor:r,commands:n};throw new Error("malformed path (first error at "+r+")")}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(a)throw a.error}}if(s.relative=s.key.toUpperCase()!==s.key,n.push(s),o.length===0)return{cursor:r,commands:n};e==="m"&&(e="l"),e==="M"&&(e="L")}throw new Error("malformed path (first error at "+r+")")}function _7(e,t){for(var r=[],a=e.relative&&t?{x:t.worldPoints[t.worldPoints.length-2],y:t.worldPoints[t.worldPoints.length-1]}:{x:0,y:0},i=0;i<e.values.length-1;i+=2)r.push(a.x+e.values[i]),r.push(a.y+e.values[i+1]);e.worldPoints=r}function S7(e){var t,r=0,a=0;e.commands.forEach(function(i){switch(i.key){case"Z":case"z":i.worldPoints=[r,a];break;case"H":i.worldPoints=[i.values[0],t.worldPoints[t.worldPoints.length-1]];break;case"h":i.worldPoints=[i.values[0]+t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1]];break;case"V":i.worldPoints=[t.worldPoints[t.worldPoints.length-2],i.values[0]];break;case"v":i.worldPoints=[t.worldPoints[t.worldPoints.length-2],i.values[0]+t.worldPoints[t.worldPoints.length-1]];break;case"A":i.worldPoints=[t.worldPoints[t.worldPoints.length-2],i.values[0]+t.worldPoints[t.worldPoints.length-1]];break;default:_7(i,t);break}(i.key==="M"||i.key==="m"||i.key==="Z"||i.key==="z")&&(r=i.worldPoints[i.worldPoints.length-2],a=i.worldPoints[i.worldPoints.length-1]),t=i})}function T7(e,t){var r,a,i=e.calculative.canvas.store,o=i.data.paths[e.pathId];if(!o)return new Path2D;var n=b7(o);e.calculative.svgRect=ny(n),Ue(e.calculative.svgRect),(e.calculative.svgRect.width!==e.calculative.worldRect.width||e.calculative.svgRect.height!==e.calculative.worldRect.height)&&x7(n,e.calculative.worldRect.width/e.calculative.svgRect.width,e.calculative.worldRect.height/e.calculative.svgRect.height);var s=ny(n);Ue(s),w7(n,e.calculative.worldRect.x-s.x,e.calculative.worldRect.y-s.y);var u=C7(n);if(t){(a=(r=t).svgPath)===null||a===void 0||a.call(r,u);return}var c=new Path2D(u);return c}function A7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i+n/2,o),r.lineTo(i+n,o+s/2),r.lineTo(i+n/2,o+s),r.lineTo(i,o+s/2),r.lineTo(i+n/2,o),r.closePath(),r instanceof Path2D)return r}function E7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i+n/2,o),r.lineTo(i+n,o+s),r.lineTo(i,o+s),r.lineTo(i+n/2,o),r.closePath(),r instanceof Path2D)return r}function P7(e){var t=[{x:.5,y:0},{x:.75,y:.5},{x:.5,y:1},{x:.25,y:.5}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function R7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i+n/2,o),r.lineTo(i+n,o+s*2/5),r.lineTo(i+n*4/5,o+s),r.lineTo(i+n/5,o+s),r.lineTo(i,o+s*2/5),r.closePath(),r instanceof Path2D)return r}function I7(e){var t=[{x:.5,y:0},{x:1,y:.4},{x:.8,y:1},{x:.2,y:1},{x:0,y:.4}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}var M7=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},L7=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function O7(e,t){e.onResize||(e.onResize=D7);var r=t||new Path2D,a=e.calculative.worldRect,i=a.width,o=a.height,n=a.center,s=i>o?o:i,u=n.x,c=n.y,l=c-s/2,f=c-s/4,h=-(f-c)*Math.sin(Math.PI/180*324)+u,d=(f-c)*Math.cos(Math.PI/180*324)+c;r.moveTo(h,d);for(var v=0;v<5;++v)r.lineTo(-(l-c)*Math.sin(Math.PI/180*72*v)+u,(l-c)*Math.cos(Math.PI/180*72*v)+c),r.lineTo((h-u)*Math.cos(Math.PI/180*72*(v+1))-(d-c)*Math.sin(Math.PI/180*72*(v+1))+u,(h-u)*Math.sin(Math.PI/180*72*(v+1))+(d-c)*Math.cos(Math.PI/180*72*(v+1))+c);if(r.closePath(),r instanceof Path2D)return r}function mw(e){for(var t=e.width,r=e.height,a=t>r?r:t,i=[],o=0;o<5;++o)i.push({flag:1,id:String(o),penId:e.id,x:.5+a/2*Math.sin(Math.PI/180*72*o)/t,y:-a/2*Math.cos(Math.PI/180*72*o)/r+.5});e.anchors=i}function D7(e){var t,r=e.anchors.filter(function(a){return a.flag!==1});mw(e),e.anchors=(t=e.anchors).concat.apply(t,L7([],M7(r),!1))}function B7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i+n/4,o),r.lineTo(i+n*3/4,o),r.lineTo(i+n,o+s/2),r.lineTo(i+n*3/4,o+s),r.lineTo(i+n*1/4,o+s),r.lineTo(i,o+s/2),r.lineTo(i+n/4,o),r.closePath(),r instanceof Path2D)return r}function F7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i,o+s/2),r.lineTo(i+s/2,o),r.lineTo(i+s/2,o+s/3),r.lineTo(i+n,o+s/3),r.lineTo(i+n,o+s*2/3),r.lineTo(i+s/2,o+s*2/3),r.lineTo(i+s/2,o+s*2/3),r.lineTo(i+s/2,o+s),r.closePath(),r instanceof Path2D)return r}function N7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i,o+s/3),r.lineTo(i+(n-s/2),o+s/3),r.lineTo(i+(n-s/2),o),r.lineTo(i+n,o+s/2),r.lineTo(i+(n-s/2),o+s),r.lineTo(i+(n-s/2),o+s*2/3),r.lineTo(i,o+s*2/3),r.closePath(),r instanceof Path2D)return r}function $7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i,o+s/2),r.lineTo(i+s/2,o),r.lineTo(i+s/2,o+s/3),r.lineTo(i+(n-s/2),o+s/3),r.lineTo(i+(n-s/2),o),r.lineTo(i+n,o+s/2),r.lineTo(i+(n-s/2),o+s),r.lineTo(i+(n-s/2),o+s*2/3),r.lineTo(i+s/2,o+s*2/3),r.lineTo(i+s/2,o+s),r.closePath(),r instanceof Path2D)return r}function j7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.ey;if(r.moveTo(i,o),r.lineTo(i+n,o),r.lineTo(i+n,o+s*3/4),r.lineTo(i+n*8/16,o+s*3/4),r.lineTo(i+n/4,u),r.lineTo(i+n*5/16,o+s*3/4),r.lineTo(i,o+s*3/4),r.closePath(),r instanceof Path2D)return r}function z7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i+n/5,o+s*13/16),r.bezierCurveTo(i-n/15,o+s*13/16,i-n/15,o+s*7/16,i+n/5,o+s*7/16),r.bezierCurveTo(i+n/5,o,i+n*4/5,o,i+n*4/5,o+s*7/16),r.bezierCurveTo(i+n*16/15,o+s*7/16,i+n*16/15,o+s*13/16,i+n*4/5,o+s*13/16),r.closePath(),r instanceof Path2D)return r}function H7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.ex,u=a.ey,c=n/6;if(r.moveTo(i,o),r.lineTo(s-c,o),r.lineTo(s,o+c),r.lineTo(s,u),r.lineTo(i,u),r.closePath(),r.moveTo(s-c,o),r.lineTo(s-c,o+c),r.lineTo(s,o+c),r.closePath(),r instanceof Path2D)return r}function W7(e,t){var r=t.calculative.worldRect,a=r.x,i=r.y,o=r.width,n=r.ex,s=r.ey,u=o*.25,c=t.z;c>1?u=c:c>0&&(u=o*c);var l={x:a,y:i+u},f={x:n-u,y:i+u},h={x:n-u,y:s},d={x:a,y:s};yc(e,[l,f,h,d],t.backgroundFront||t.background,t.color),yc(e,[l,{x:a+u,y:i},{x:n,y:i},f],t.backgroundUp||t.background,t.color),yc(e,[f,{x:n,y:i},{x:n,y:s-u},h],t.backgroundRight||t.background,t.color)}function yc(e,t,r,a){r===void 0&&(r=""),a===void 0&&(a=""),e.save(),r&&(e.fillStyle=r),a&&(e.strokeStyle=a),e.beginPath();for(var i=0;i<t.length;++i)i?e.lineTo(t[i].x,t[i].y):e.moveTo(t[i].x,t[i].y);e.closePath(),r&&e.fill(),e.stroke(),e.restore()}function U7(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.ex,u=a.ey,c=n/4,l=i+n/2;if(r.arc(l,o+c,c,0,Math.PI*2),r.moveTo(i,o+c*3),r.lineTo(s,o+c*3),r.moveTo(l,o+c*2),r.lineTo(l,o+c*4),r.moveTo(l,o+c*4),r.lineTo(i,u),r.moveTo(l,o+c*4),r.lineTo(s,u),r.closePath(),r instanceof Path2D)return r}var Bu=function(){return Bu=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Bu.apply(this,arguments)};function V7(e,t,r){if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),r)t.calculative.activeAnchor&&(t.calculative.activeAnchor.next={penId:t.id,x:r.x,y:r.y},Tl(t.calculative.activeAnchor.next,t.calculative.activeAnchor)<5?t.calculative.activeAnchor.next=void 0:(t.calculative.activeAnchor.prev=Bu({},t.calculative.activeAnchor.next),De(t.calculative.activeAnchor.prev,180,t.calculative.activeAnchor)));else{var a=t.calculative.worldAnchors[0];if(!a.next){var i=Ua(a,e.pens[a.connectTo]);sy(a,i,50),a.prev=void 0}var o=t.calculative.worldAnchors[t.calculative.worldAnchors.length-1];if(o&&o!==a&&!o.prev){var n=Ua(o,e.pens[o.connectTo]);sy(o,n,-50),o.next=void 0}}}function sy(e,t,r){switch(t){case me.Up:e.prev={penId:e.penId,x:e.x,y:e.y+r},e.next={penId:e.penId,x:e.x,y:e.y-r};break;case me.Right:e.prev={penId:e.penId,x:e.x-r,y:e.y},e.next={penId:e.penId,x:e.x+r,y:e.y};break;case me.Bottom:e.prev={penId:e.penId,x:e.x,y:e.y-r},e.next={penId:e.penId,x:e.x,y:e.y+r};break;case me.Left:e.prev={penId:e.penId,x:e.x+r,y:e.y},e.next={penId:e.penId,x:e.x-r,y:e.y};break}}function Fu(e,t,r,a){var i=1-e,o=i*i*t.x+2*i*e*r.x+e*e*a.x,n=i*i*t.y+2*i*e*r.y+e*e*a.y;return{x:o,y:n,step:e}}function bw(e,t,r,a,i){var o=t.x,n=t.y,s=i.x,u=i.y,c=r.x,l=r.y,f=a.x,h=a.y,d=1-e,v=o*d*d*d+3*c*e*d*d+3*f*e*e*d+s*e*e*e,y=n*d*d*d+3*l*e*d*d+3*h*e*e*d+u*e*e*e;return{x:v,y,step:e}}function Xr(e,t,r){return{x:e.x+r*(t.x-e.x),y:e.y+r*(t.y-e.y)}}function q7(e,t,r){var a=e.calculative.worldAnchors[r],i=e.calculative.worldAnchors[r+1];!i&&e.close&&(i=e.calculative.worldAnchors[0]);var o=t.step,n;if(a.next&&i.prev){var s=a,u=a.next,c=i.prev,l=i,f=Xr(s,u,o),h=Xr(u,c,o),d=Xr(c,l,o),v=Xr(f,h,o),y=Xr(h,d,o);n=Xr(v,y,o),v.penId=e.id,n.prev=v,y.penId=e.id,n.next=y,a.next.x=f.x,a.next.y=f.y,i.prev.x=d.x,i.prev.y=d.y}else if(a.next||i.prev){var s=a,u=a.next||i.prev,c=i,l=Xr(s,u,o),f=Xr(u,c,o);n=t,l.penId=e.id,f.penId=e.id,n.prev=l,n.next=f,a.next=void 0,i.prev=void 0}else n=t;return n.penId=e.id,n.id=xe(),n.prevNextType=Vi.Bilateral,n}function K7(e,t,r){if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),!(t.calculative.worldAnchors.length<2)){var a=t.calculative.activeAnchor,i=r||Te(t);if(!(!a||!i)){var o=20,n=e.pens[a.connectTo],s=Ua(a,n);switch(s===me.None&&(i.x>a.x?s=me.Right:s=me.Left),a.next={id:xe(),penId:t.id,x:a.x,y:a.y,prevNextType:2},i.prev={id:xe(),penId:t.id,x:i.x,y:i.y,prevNextType:2},s){case me.Up:a.next.y-=o,i.prev.y=a.y;break;case me.Bottom:a.next.y+=o,i.prev.y=a.y;break;case me.Left:a.next.x-=o,i.prev.x=a.x;break;default:a.next.x+=o,i.prev.x=a.x;break}}}}var ly=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},cy=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))},ww=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Y7(e,t){var r=t||new Path2D;if((e.lineName==="line"||e.lineName==="polyline")&&e.calculative.lineSmooth){var a=oh(e);if(r.addPath(a),r instanceof Path2D)return r}var i=e.calculative.worldAnchors;if(i.length>1){var o;i.forEach(function(n){o?uy(r,o,n):n.start=!0,o=n}),e.close&&uy(r,o,i[0])}if(r instanceof Path2D)return r}function G7(e,t,r){var a;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),!(t.calculative.worldAnchors.length<2||((a=t.anchors)===null||a===void 0?void 0:a.length)>1)){var i=Ve(t),o=Te(t);!i||!o||!o.id||i===o||(i.next=void 0,sh(t),o.prev=void 0,t.calculative.worldAnchors.push(o))}}function uy(e,t,r){!r||r.isTemp||(t.start&&e.moveTo(t.x,t.y),t.next?r.prev?e.bezierCurveTo(t.next.x,t.next.y,r.prev.x,r.prev.y,r.x,r.y):e.quadraticCurveTo(t.next.x,t.next.y,r.x,r.y):r.prev?e.quadraticCurveTo(r.prev.x,r.prev.y,r.x,r.y):e.lineTo(r.x,r.y))}function Nu(e){return $u(e),xn(xw(e))}function xw(e){var t=[],r;return e.calculative.worldAnchors.forEach(function(a){t.push(a),r&&t.push.apply(t,cy([],ly(fy(r,a,e)),!1)),r=a}),e.close&&e.calculative.worldAnchors.length>1&&t.push.apply(t,cy([],ly(fy(r,e.calculative.worldAnchors[0],e)),!1)),t}function Ps(e){return e!=null&&e.lineWidth?e.lineWidth/2+4:4}function fy(e,t,r){var a=[];if(!t)return a;var i=.02;if(e.lineLength){var o=Ps(r);i=o/e.lineLength}if(e.next)if(t.prev)for(var n=i;n<1;n+=i)a.push(bw(n,e,e.next,t.prev,t));else for(var n=i;n<1;n+=i)a.push(Fu(n,e,e.next,t));else if(t.prev)for(var n=i;n<1;n+=i)a.push(Fu(n,e,t.prev,t));else a.push({x:t.x,y:t.y});return a.length>1&&(e.curvePoints=a),a}function X7(e,t){var r,a,i=Ps(t),o=0,n,s;try{for(var u=ww(t.calculative.worldAnchors),c=u.next();!c.done;c=u.next()){var l=c.value;if(n){if(s=hy(e,n,l,i),s)return{i:o,point:s};++o}n=l}}catch(f){r={error:f}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}if(t.close&&t.calculative.worldAnchors.length>1&&(s=hy(e,n,t.calculative.worldAnchors[0],i)))return{i:o,point:s}}function hy(e,t,r,a){var i,o;if(a===void 0&&(a=4),!t.next&&!r.prev){var n=t.x,s=t.y,u=r.x,c=r.y,l=Math.min(n,u),f=Math.max(n,u),h=Math.min(s,c),d=Math.max(s,c);return e.x>=l-a&&e.x<=f+a&&e.y>=h-a&&e.y<=d+a?Q7(e,t,r,a):void 0}else if(t.curvePoints)try{for(var v=ww(t.curvePoints),y=v.next();!y.done;y=v.next()){var g=y.value;if(ya(e,g,a))return g}}catch(m){i={error:m}}finally{try{y&&!y.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}}function Q7(e,t,r,a){if(a===void 0&&(a=4),t.x===r.x){var i=Math.abs(e.x-t.x);if(i<=a)return{x:t.x,y:e.y}}else{var o=(t.y-r.y)/(t.x-r.x),n=t.y-o*t.x,i=Math.abs((o*e.x+n-e.y)/Math.sqrt(o*o+1));if(i<=a){var s=e.x+o*e.y,u=(s-o*n)/(o*o+1);return{x:u,y:o*u+n}}}}function dy(e,t,r,a){if(!t&&!r)return Math.sqrt(Math.pow(Math.abs(e.x-a.x),2)+Math.pow(Math.abs(e.y-a.y),2))||0;var i=document.createElementNS("http://www.w3.org/2000/svg","path");return t&&r?i.setAttribute("d","M"+e.x+" "+e.y+" C"+t.x+" "+t.y+" "+r.x+" "+r.y+" "+a.x+" "+a.y):t?i.setAttribute("d","M"+e.x+" "+e.y+" Q"+t.x+" "+t.y+" "+a.x+" "+a.y):i.setAttribute("d","M"+e.x+" "+e.y+" Q"+r.x+" "+r.y+" "+a.x+" "+a.y),i.getTotalLength()||0}function $u(e){if(e.calculative.worldAnchors.length<2)return 0;var t=0,r;if(e.calculative.worldAnchors.forEach(function(i){r&&(r.lineLength=dy(r,r.next,i.prev,i),t+=r.lineLength),r=i}),e.close){var a=Ve(e);r.lineLength=dy(r,r.next,a.prev,a),t+=r.lineLength}return e.calculative.animatePos&&(e.calculative.animatePos=t/e.length*e.calculative.animatePos),e.length=t,t}function pc(e,t){for(var r=e.calculative.worldAnchors,a=0;a<r.length-1;a++){var i=r[a],o=r[a+1];if(!i.next&&!o.prev){if(Cw(i,o,t))return!0}else if(J7(i,o,t))return!0}return!1}function Cw(e,t,r){if(Yi(e,r)||Yi(t,r))return!0;var a=e.x,i=e.y,o=t.x,n=t.y,s=r.x,u=r.y,c=r.ex,l=r.ey,f=i-n,h=o-a,d=a*n-o*i;if(f*s+h*u+d>=0&&f*c+h*l+d<=0||f*s+h*u+d<=0&&f*c+h*l+d>=0||f*s+h*l+d>=0&&f*c+h*u+d<=0||f*s+h*l+d<=0&&f*c+h*u+d>=0){if(s>c){var v=s;s=c,c=v}if(u<l){var y=u;u=l,l=y}return!(a<s&&o<s||a>c&&o>c||i>u&&n>u||i<l&&n<l)}else return!1}function J7(e,t,r){var a=.02;if(!e.next&&!t.prev)return Cw(e,t,r);if(e.next&&t.prev)for(var i=a;i<1;i+=a){var o=bw(i,e,e.next,t.prev,t);if(Yi(o,r))return!0}else if(e.next||t.prev)for(var i=a;i<1;i+=a){var o=Fu(i,e,e.next||t.prev,t);if(Yi(o,r))return!0}return!1}var ho=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},vo=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))},Rt=10;function Z7(e,t,r){var a;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),Rt=e.options.polylineSpace||10,!(t.calculative.worldAnchors.length<2)){var i=Ve(t),o=Te(t);if(!(!i||!o)){var n;if(!((a=t.anchors)===null||a===void 0)&&a.length&&i===t.calculative.activeAnchor?(n=!0,i=o,o=Ve(t)):(!t.anchors||!t.anchors.length)&&i!==t.calculative.activeAnchor&&(i=t.calculative.activeAnchor),!(!i||!o)){i.next=void 0,o.prev=void 0;var s=o.connectTo;sh(t);var u=[],c=e.pens[i.connectTo],l=e.pens[o.connectTo],f=Ua(i,c),h=Ua(o,l),d=vy(i,f,Rt);d&&(i=d,u.push(d)),d=vy(o,h,Rt);var v=o,y=void 0;if(d&&(o=d,v.connectTo&&(d.y>v.y&&i.y<v.y||d.y<v.y&&i.y>v.y))){y=d;var g=Rt;i.x<d.x&&(g=-g),Math.abs(i.x-d.x)<g&&(g=-g);var m={x:d.x+g,y:d.y,id:xe()};o=m}switch(f){case me.Up:u.push.apply(u,vo([],ho(ej(i,o,h)),!1));break;case me.Right:u.push.apply(u,vo([],ho(tj(i,o,h)),!1));break;case me.Bottom:u.push.apply(u,vo([],ho(rj(i,o,h)),!1));break;case me.Left:u.push.apply(u,vo([],ho(ij(i,o,h)),!1));break;default:u.push.apply(u,vo([],ho(aj(t,i,o)),!1));break}if(u.forEach(function(p){p.id=xe(),p.penId=t.id,t.calculative.worldAnchors.push(p)}),t.calculative.worldAnchors.push(o),y&&t.calculative.worldAnchors.push(y),d&&t.calculative.worldAnchors.push(v),n&&t.calculative.worldAnchors.reverse(),s){var w=t.calculative.worldAnchors.length-2;t.calculative.worldAnchors[w].isTemp=!1,t.calculative.worldAnchors[1].isTemp=!1}}}}}function vy(e,t,r){var a={x:e.x,y:e.y,id:xe()};switch(t){case me.Up:a.y-=r;break;case me.Right:a.x+=r;break;case me.Bottom:a.y+=r;break;case me.Left:a.x-=r;break;default:return}return a}function ej(e,t,r){if(e.x===t.x||e.y===t.y)return[];var a=[],i,o;switch(r){case me.Up:e.y<t.y?(i=t.x,o=e.y):(i=e.x,o=t.y),a.push({x:i,y:o});break;case me.Bottom:if(i=t.x,o=e.y,t.y>e.y)i=e.x+(t.x-e.x)/2,a.push({x:i,y:e.y},{x:i,y:t.y});else{var n=(e.y+t.y)/2;a.push({x:e.x,y:n},{x:t.x,y:n})}break;case me.Right:i=t.x,o=e.y,t.x<e.x&&t.y<e.y&&(i=e.x,o=t.y),a.push({x:i,y:o});break;case me.Left:i=t.x,o=e.y,t.x>e.x&&t.y<e.y&&(i=e.x,o=t.y),a.push({x:i,y:o});break;default:if(t.y>e.y-Rt)i=e.x+(t.x-e.x)/2,a.push({x:i,y:e.y},{x:i,y:t.y});else{var n=(e.y+t.y+Rt)/2;a.push({x:e.x,y:n},{x:t.x,y:n})}break}return a}function tj(e,t,r){if(e.x===t.x||e.y===t.y)return[];var a=[],i,o;switch(r){case me.Up:i=e.x,o=t.y,t.x>e.x&&t.y>e.y&&(i=t.x,o=e.y),a.push({x:i,y:o});break;case me.Bottom:i=e.x,o=t.y,t.x>e.x&&t.y<e.y&&(i=t.x,o=e.y),a.push({x:i,y:o});break;case me.Left:if(i=t.x,o=e.y,t.x<e.x)o=e.y+(t.y-e.y)/2,a.push({x:e.x,y:o},{x:t.x,y:o});else{var n=(e.x+t.x)/2;a.push({x:n,y:o},{x:n,y:t.y})}break;case me.Right:t.x<e.x?a.push({x:e.x,y:t.y}):a.push({x:t.x,y:e.y});break;default:if(i=t.x,o=t.y,t.x<e.x+Rt)a.push({x:e.x,y:o});else{var n=(e.x+t.x-Rt)/2;a.push({x:n,y:e.y},{x:n,y:o})}break}return a}function rj(e,t,r){if(e.x===t.x||e.y===t.y)return[];var a=[],i,o;switch(r){case me.Up:if(i=e.x,o=t.y,t.y<e.y)i=e.x+(t.x-e.x)/2,a.push({x:i,y:e.y},{x:i,y:t.y});else{var n=(e.y+t.y)/2;a.push({x:i,y:n},{x:t.x,y:n})}break;case me.Right:i=t.x,o=e.y,t.x<e.x&&t.y>e.y&&(i=e.x,o=t.y),a.push({x:i,y:o});break;case me.Bottom:e.y>t.y?(i=t.x,o=e.y):(i=e.x,o=t.y),a.push({x:i,y:o});break;case me.Left:i=t.x,o=e.y,t.x>e.x&&t.y>e.y&&(i=e.x,o=t.y),a.push({x:i,y:o});break;default:if(i=e.x,t.y<e.y+Rt)i=e.x+(t.x-e.x)/2,a.push({x:i,y:e.y},{x:i,y:t.y});else{var n=(e.y+t.y-Rt)/2;a.push({x:i,y:n},{x:t.x,y:n})}break}return a}function ij(e,t,r){if(e.x===t.x||e.y===t.y)return[];var a=[],i,o;switch(r){case me.Up:i=e.x,o=t.y,t.x<e.x&&t.y>e.y&&(i=t.x,o=e.y),a.push({x:i,y:o});break;case me.Bottom:i=e.x,o=t.y,t.x<e.x&&t.y<e.y&&(i=t.x,o=e.y),a.push({x:i,y:o});break;case me.Right:if(i=e.x,o=t.y,t.x>e.x)i=t.x,o=e.y+(t.y-e.y)/2,a.push({x:e.x,y:o},{x:t.x,y:o});else{var n=(e.x+t.x)/2;a.push({x:n,y:e.y},{x:n,y:t.y})}break;case me.Left:t.x>e.x?a.push({x:e.x,y:t.y}):a.push({x:t.x,y:e.y});break;default:if(i=e.x,o=t.y,t.x<e.x-Rt){var n=(e.x+t.x+Rt)/2;a.push({x:n,y:e.y},{x:n,y:o})}else a.push({x:e.x,y:o});break}return a}function aj(e,t,r){var a=[];e.calculative.drawlineH==null&&(e.calculative.drawlineH=Math.abs(r.x-t.x)>Math.abs(r.y-t.y));var i=e.calculative.worldAnchors.findIndex(function(n){return n.id==t.id});if(i>1){var o=e.calculative.worldAnchors[i-1];if(o.x===t.x&&o.y!==t.y)return a.push({x:r.x,y:t.y}),a;if(o.y===t.y&&o.x!==t.x)return a.push({x:t.x,y:r.y}),a}return e.calculative.worldAnchors.length&&(r.isTemp=void 0,e.calculative.drawlineH?(a.push({x:r.x,y:t.y}),Math.abs(r.y-t.y)<Rt&&(r.isTemp=!0)):(a.push({x:t.x,y:r.y}),Math.abs(r.x-t.x)<Rt&&(r.isTemp=!0))),a}function Nn(e,t,r){var a,i;r===void 0&&(r=!0);var o=e.calculative.worldAnchors;r||(o=[],e.calculative.worldAnchors.forEach(function(s){o.unshift(s)}));for(var n=0;n<o.length&&o[n].id!==t.id;n++)if(o[n].y!==t.y||o[n].x===((a=o[n+1])===null||a===void 0?void 0:a.x)&&o[n].y!==((i=o[n+1])===null||i===void 0?void 0:i.y))return!1;return!0}function $n(e,t,r){var a,i;r===void 0&&(r=!0);var o=e.calculative.worldAnchors;r||(o=[],e.calculative.worldAnchors.forEach(function(s){o.unshift(s)}));for(var n=0;n<o.length&&o[n].id!==t.id;n++)if(o[n].x!==t.x||o[n].y===((a=o[n+1])===null||a===void 0?void 0:a.y)&&o[n].x!==((i=o[n+1])===null||i===void 0?void 0:i.x))return!1;return!0}function oj(e,t,r){if(e.calculative.worldAnchors){var a=e.calculative.worldAnchors.findIndex(function(f){return f.id===t.id}),i=Ve(e),o=Te(e),n=e.calculative.worldAnchors[a-1],s=e.calculative.worldAnchors[a+1];if(e.calculative.h==null&&(i.connectTo&&(Nn(e,t,!0)?e.calculative.h=!0:$n(e,t,!0)&&(e.calculative.h=!1)),e.calculative.h==null&&o.connectTo&&(Nn(e,t,!1)?e.calculative.h=!0:$n(e,t,!1)&&(e.calculative.h=!1)),e.calculative.h==null&&(n?e.calculative.h=n.y===t.y:s&&(e.calculative.h=s.y===t.y))),e.calculative.h){if(t.x=r.x,i.connectTo&&Nn(e,t,!0)){s&&s.y!==t.y&&(s.x=t.x);return}if(o.connectTo&&Nn(e,t,!1)){n&&n.y!==t.y&&(n.x=t.x);return}for(var u=e.anchors[a],c=void 0,l=a-1;l>-1;l--)if(n=e.anchors[l],c==null&&(c=n.y===u.y),c===!0)if(n.y===u.y)e.calculative.worldAnchors[l].y=r.y;else break;else if(n.x===u.x)e.calculative.worldAnchors[l].x=r.x;else break;c=void 0;for(var l=a+1;l<e.calculative.worldAnchors.length&&(s=e.anchors[l],s);l++)if(c==null&&(c=s.y===u.y),c===!0)if(s.y===u.y)e.calculative.worldAnchors[l].y=r.y;else break;else if(s.x===u.x)e.calculative.worldAnchors[l].x=r.x;else break;t.y=r.y}else{if(t.y=r.y,i.connectTo&&$n(e,t,!0)){s&&s.x!==t.x&&(s.y=t.y);return}if(o.connectTo&&$n(e,t,!1)){n&&n.x!==t.x&&(n.y=t.y);return}for(var u=e.anchors[a],c=void 0,l=a-1;l>-1;l--)if(n=e.anchors[l],c==null&&(c=n.x===u.x),c===!0)if(n.x===u.x)e.calculative.worldAnchors[l].x=r.x;else break;else if(n.y===u.y)e.calculative.worldAnchors[l].y=r.y;else break;c=void 0;for(var l=a+1;l<e.calculative.worldAnchors.length&&(s=e.anchors[l],s);l++)if(c==null&&(c=s.x===u.x),c===!0)if(s.x===u.x)e.calculative.worldAnchors[l].x=r.x;else break;else if(s.y===u.y)e.calculative.worldAnchors[l].y=r.y;else break;t.x=r.x}}}var Fi=function(){return Fi=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Fi.apply(this,arguments)},gy=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},yy=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function ju(e,t,r,a){var i=[],o,n,s,u,c,l,f,h,d,v,y,g,m,w;d=e[r],v=e[a],s=d.x,u=d.y,f=v.x-s,h=v.y-u,w=f*f+h*h,o=t;for(var p=r+1;p<a;p++)y=e[p],f!==0||h!==0?(g=((y.x-s)*f+(y.y-u)*h)/w,g>1?(c=y.x-v.x,l=y.y-v.y):g>0?(c=y.x-(s+f*g),l=y.y-(u+h*g)):(c=y.x-s,l=y.y-u)):(c=y.x-s,l=y.y-u),m=c*c+l*l,m>o&&(n=p,o=m);return o>t&&(n-r>1&&i.push.apply(i,yy([],gy(ju(e,t,r,n)),!1)),i.push({id:e[n].id,penId:e[n].penId,x:e[n].x,y:e[n].y}),a-n>1&&i.push.apply(i,yy([],gy(ju(e,t,n,a)),!1))),i}function nj(e,t,r){if(t===void 0&&(t=.8),r===void 0&&(r=!1),e.length<3)return e;var a,i,o,n,s,u,c,l,f,h,d,v,y,g,m,w=function(T,A,I,R){return n=Math.sqrt(T*T+A*A),n>0?(v=T/n,g=A/n):(v=1,g=0),s=Math.sqrt(I*I+R*R),s>0?(y=I/s,m=R/s):(y=1,m=0),Math.acos(v*y+g*m)};h=[],d=e.length,a=e[0],e[d-1],h.push(Fi({},e[0]));for(var p=0;p<d-1;p++){if(i=e[p],o=e[p+1],f=Math.abs(w(i.x-a.x,i.y-a.y,o.x-i.x,o.y-i.y)),n)if(f<t*3.14)if(r&&(n=Math.min(n,s),s=n),u=(v+y)/2,c=(g+m)/2,l=Math.sqrt(u*u+c*c),l===0)h.push(Fi({},i));else{u/=l,c/=l;var x=Fi({},i);x.prevNextType=Vi.Bilateral,x.prev={penId:x.penId,x:i.x-u*n*.25,y:i.y-c*n*.25},x.next={penId:x.penId,x:i.x+u*s*.25,y:i.y+c*s*.25},h.push(x)}else h.push(Fi({},i));a=i}return h.push(Fi({},e[e.length-1])),h}function kw(e,t){var r=t||new Path2D,a=e.calculative.worldAnchors,i=e.calculative.canvas.store.data.scale,o=(e.calculative.animateLineWidth||6)*i,n=(e.animateLineWidth*2||12)*i;e.lineAnimateType===Ht.WaterDrop&&(n=(e.animateLineWidth*4||24)*i);var s=(e.animateInterval||100)*i,u=e.calculative.lineWidth*(e.calculative.lineSmooth||0),c=(e.calculative.animateLineWidth/2||3)*i;if(e.animateReverse&&(n=-n,o=-o),a.length>1)for(var l=void 0,f=0,h=0;h<a.length;h++){var d=a[h];if(l){var v=sj(l,d),y={x:l.x+(e.calculative.animatePos-f)%s*Math.cos(v*Math.PI/180),y:l.y-(e.calculative.animatePos-f)%s*Math.sin(v*Math.PI/180)};e.animateReverse&&(y={x:l.x+(e.length-(e.calculative.animatePos+f))%s*Math.cos(v*Math.PI/180),y:l.y-(e.length-(e.calculative.animatePos+f))%s*Math.sin(v*Math.PI/180)});for(var g=Math.sqrt(Math.pow(y.x-l.x,2)+Math.pow(y.y-l.y,2)),m=Math.sqrt(Math.pow(d.x-l.x,2)+Math.pow(d.y-l.y,2));g<m;)(e.animateReverse&&g-n<m||!e.animateReverse&&g>n)&&g>u+n&&m-g>u&&(e.lineAnimateType===Ht.Arrow?lj(r,y,o,v,c,n):e.lineAnimateType===Ht.WaterDrop&&cj(r,y,e.animateReverse,v,c,n)),y.x+=s*Math.cos(v*Math.PI/180),y.y-=s*Math.sin(v*Math.PI/180),g=Math.sqrt(Math.pow(y.x-l.x,2)+Math.pow(y.y-l.y,2))}l=d}if(r instanceof Path2D)return r}function sj(e,t){var r=t.x-e.x,a=t.y-e.y,i=Math.atan(a/r)*180/Math.PI;return t.x>=e.x?i=-i:i=180-i,i}function ai(e,t,r){var a=(180-r)*Math.PI/180;return{x:(e.x-t.x)*Math.cos(a)-(e.y-t.y)*Math.sin(a)+t.x,y:(e.x-t.x)*Math.sin(a)+(e.y-t.y)*Math.cos(a)+t.y}}function lj(e,t,r,a,i,o){var n=ai({x:t.x+r,y:t.y+.57*r},{x:t.x,y:t.y},a),s=ai({x:t.x+r,y:t.y-.57*r},{x:t.x,y:t.y},a),u=ai({x:t.x+r,y:t.y+i/2},{x:t.x,y:t.y},a),c=ai({x:t.x+o,y:t.y+i/2},{x:t.x,y:t.y},a),l=ai({x:t.x+r,y:t.y-i/2},{x:t.x,y:t.y},a),f=ai({x:t.x+o,y:t.y-i/2},{x:t.x,y:t.y},a);e.moveTo(n.x,n.y),e.lineTo(t.x,t.y),e.lineTo(s.x,s.y),e.lineTo(l.x,l.y),e.lineTo(f.x,f.y),e.lineTo(c.x,c.y),e.lineTo(u.x,u.y),e.lineTo(n.x,n.y)}function cj(e,t,r,a,i,o){var n=i/2;r&&(n=-i/2);var s=ai({x:t.x,y:t.y+n},{x:t.x,y:t.y},a),u=ai({x:t.x+o,y:t.y},{x:t.x,y:t.y},a),c=Math.PI/2;r&&(c=-Math.PI/2),e.moveTo(t.x,t.y),e.arc(t.x,t.y,i/2,-c-a/180*Math.PI,c-a/180*Math.PI,!1),e.lineTo(u.x,u.y),e.lineTo(s.x,s.y)}function uj(e){var t;e.onDestroy||(e.onDestroy=fj,e.onMove=jn,e.onResize=jn,e.onRotate=jn,e.onValue=jn,e.onMouseMove=dj,e.onBeforeValue=hj,e.onRenderPenRaw=vj),e.calculative.singleton||(e.calculative.singleton={});var r=e.calculative.worldRect;if(!e.calculative.singleton.div){var a=document.createElement("div");a.style.position="absolute",a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.style.width=r.width+"px",a.style.height=r.height+"px",document.body.appendChild(a),(t=e.calculative.canvas.externalElements)===null||t===void 0||t.parentElement.appendChild(a),Ye(e,a),e.calculative.singleton.div=a;var i=document.createElement("iframe");i.style.width="100%",i.style.height="100%",i.scrolling=e.scrolling||"no",i.frameBorder="0",i.style.border="none",i.src=e.iframe,e.calculative.iframe=e.iframe,a.appendChild(i),Sw(e),i.onload=function(){i.setAttribute("document.domain","")}}return e.calculative.patchFlags&&Ye(e,e.calculative.singleton.div),e.onRenderPenRaw(e),new Path2D}function fj(e){Tw(e),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function jn(e){e.calculative.singleton.div&&Ye(e,e.calculative.singleton.div)}function hj(e,t){if(t.iframe&&e.calculative.singleton.div&&(e.calculative.singleton.div.children[0].src=t.iframe,e.calculative.iframe=t.iframe),t.operationalRect||t["operationalRect.x"]!==void 0||t["operationalRect.y"]!==void 0||t["operationalRect.width"]!==void 0||t["operationalRect.height"]!==void 0){e.operationalRect||(e.operationalRect={});var r=re(t);if(r.operationalRect||(r.operationalRect={}),r["operationalRect.x"]!==void 0&&(r.operationalRect.x=r["operationalRect.x"]),r["operationalRect.y"]!==void 0&&(r.operationalRect.y=r["operationalRect.y"]),r["operationalRect.width"]!==void 0&&(r.operationalRect.width=r["operationalRect.width"]),r["operationalRect.height"]!==void 0&&(r.operationalRect.height=r["operationalRect.height"]),Object.assign(e.operationalRect,r.operationalRect),e.calculative.singleton.div){var a=e.calculative.singleton.div.children.length;a===1?Sw(e):(e.calculative.singleton.div.children[1].style.height=e.operationalRect.y*100+"%",e.calculative.singleton.div.children[1].style.left=e.operationalRect.x*100+"%",e.calculative.singleton.div.children[1].style.width=e.operationalRect.width*100+"%",e.calculative.singleton.div.children[2].style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",e.calculative.singleton.div.children[3].style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",e.calculative.singleton.div.children[3].style.left=e.operationalRect.x*100+"%",e.calculative.singleton.div.children[3].style.width=e.operationalRect.width*100+"%",e.calculative.singleton.div.children[4].style.width=e.operationalRect.x*100+"%")}}if(t.blur!==void 0)for(var i=1;i<5;i++)e.calculative.singleton.div.children[i].style["backdrop-filter"]="blur("+(t.blur||2)+"px)";if(t.blurBackground!==void 0)for(var i=1;i<5;i++)e.calculative.singleton.div.children[i].style.backgroundColor=t.blurBackground;return t}function dj(e,t){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&_w(e.operationalRect)&&e.calculative.zIndex<5&&t.x>e.x+e.width*e.operationalRect.x&&t.x<e.x+e.width*(e.operationalRect.x+e.operationalRect.width)&&t.y>e.y+e.height*e.operationalRect.y&&t.y<e.y+e.height*(e.operationalRect.y+e.operationalRect.height)&&e.calculative.singleton.div)for(var r=e.calculative.singleton.div.parentNode.children,a=0;a<6;a++)r[a].style.pointerEvents="none"}function _w(e){return e?!e.width||!e.height?!1:(e.x===void 0&&(e.x=(1-e.width)/2),e.y===void 0&&(e.y=(1-e.height)/2),!0):!1}function Sw(e){if(_w(e.operationalRect)){var t=e.calculative.singleton.div;if(t){var r=document.createElement("div");r.style.position="absolute",r.style.left=e.operationalRect.x*100+"%",r.style.top="0px",r.style.width=e.operationalRect.width*100+"%",r.style.height=e.operationalRect.y*100+"%",r.style["backdrop-filter"]="blur("+(e.blur||2)+"px)",r.style.backgroundColor=e.blurBackground,t.appendChild(r);var a=document.createElement("div");a.style.position="absolute",a.style.right="0px",a.style.top="0px",a.style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",a.style.height="100%",a.style["backdrop-filter"]="blur("+(e.blur||2)+"px)",a.style.backgroundColor=e.blurBackground,t.appendChild(a);var i=document.createElement("div");i.style.position="absolute",i.style.left=e.operationalRect.x*100+"%",i.style.bottom="0px",i.style.width=e.operationalRect.width*100+"%",i.style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",i.style["backdrop-filter"]="blur("+(e.blur||2)+"px)",i.style.backgroundColor=e.blurBackground,t.appendChild(i);var o=document.createElement("div");o.style.position="absolute",o.style.left="0px",o.style.top="0px",o.style.width=e.operationalRect.x*100+"%",o.style.height="100%",o.style["backdrop-filter"]="blur("+(e.blur||2)+"px)",o.style.backgroundColor=e.blurBackground,t.appendChild(o);var n=function(){Tw(e)};r.onmouseenter=n,i.onmouseenter=n,a.onmouseenter=n,o.onmouseenter=n,t.onmouseleave=n}}}function Tw(e){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&e.calculative.zIndex<5)for(var t=e.calculative.singleton.div.parentNode.children,r=1;r<6;r++)t[r].style.pointerEvents="initial"}function vj(e){if(e.thumbImg&&!e.calculative.img){var t=new Image;t.crossOrigin=e.crossOrigin==="undefined"?void 0:e.crossOrigin||"anonymous",e.calculative.canvas.store.options.cdn&&!(e.thumbImg.startsWith("http")||e.thumbImg.startsWith("//")||e.thumbImg.startsWith("data:image"))?t.src=e.calculative.canvas.store.options.cdn+e.thumbImg:t.src=e.thumbImg,t.onerror=function(r){t.remove(),e.calculative.img=void 0},e.calculative.img=t}}var It={},ls=['<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M473.088 125.44L256 256H52.224C23.552 256 0 279.552 0 308.224V716.8c0 28.16 23.04 51.2 51.2 51.2h204.8l217.088 130.56c16.896 10.24 38.912-2.048 38.912-22.016V147.456c0-19.968-21.504-32.256-38.912-22.016zM699.904 320.512c-20.992-18.944-53.248-17.408-72.192 3.584-18.944 20.992-17.408 53.248 3.584 72.192 0.512 0.512 58.368 54.784 58.368 121.344 0 37.888-19.456 74.752-58.368 110.08-20.992 18.944-22.528 51.2-3.584 72.192 10.24 11.264 24.064 16.896 37.888 16.896 12.288 0 24.576-4.608 34.304-13.312 61.44-55.296 92.16-117.76 92.16-185.856 0-112.64-88.576-193.536-92.16-197.12z" fill="" p-id="2434"></path><path d="M853.504 166.4c-20.992-18.944-53.248-16.896-72.192 4.096-18.944 20.992-16.896 53.248 4.096 72.192 1.536 1.024 135.68 122.88 135.68 280.576 0 90.624-45.568 177.152-135.68 257.536-20.992 18.944-23.04 51.2-4.096 72.192 10.24 11.264 24.064 16.896 38.4 16.896 12.288 0 24.576-4.096 34.304-12.8 112.64-100.864 169.984-212.992 169.984-333.824-1.024-202.752-163.84-350.208-170.496-356.864z"></path></svg>','<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" ><path d="M256 768H51.2c-28.16 0-51.2-23.04-51.2-51.2V308.224C0 279.552 23.552 256 52.224 256H256v512zM512 147.456v728.576c0 19.968-21.504 32.256-38.912 22.016L256 768V256l217.088-130.56c17.408-10.24 38.912 2.048 38.912 22.016zM623.104 656.896c-19.968-19.968-19.968-52.224 0-72.192l217.088-217.088c19.968-19.968 52.224-19.968 72.192 0 19.968 19.968 19.968 52.224 0 72.192l-217.088 217.088c-19.456 19.968-52.224 19.968-72.192 0z" fill="" p-id="2582"></path><path d="M623.104 367.104c19.968-19.968 52.224-19.968 72.192 0l217.088 217.088c19.968 19.968 19.968 52.224 0 72.192-19.968 19.968-52.224 19.968-72.192 0l-217.088-217.088c-19.968-19.456-19.968-52.224 0-72.192z"></path></svg>'];function gj(e){var t;if(e.onDestroy||(e.onDestroy=yj,e.onMove=mc,e.onResize=mc,e.onRotate=mc,e.onClick=py,e.onValue=mj,e.onChangeId=pj),It[e.id])e.video&&e.calculative.media&&e.video!==e.calculative.video?(console.warn("video 更改, 此处是否执行？"),e.calculative.media.src=e.video,e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop,e.calculative.video=e.video):e.audio&&e.calculative.media&&e.audio!==e.calculative.audio&&(e.calculative.media.src=e.audio,e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop,e.calculative.audio=e.audio);else{var r=document.createElement("div"),a=document.createElement("div");a.style.position="absolute",a.style.outline="none",a.style.left="0",a.style.bottom="0",a.style.width="0",a.style.height="2px",a.style.background="#52c41a",a.style.zIndex="1",e.hideProgress&&(a.style.display="none");var i=document.createElement("div");i.innerHTML=ls[1],i.style.position="absolute",i.style.right="0",i.style.bottom="0",i.style.width="20px",i.style.height="20px",i.style.fill="hsla(0, 0%, 100%, .8)",i.style.zIndex="1",i.style.display="none",r.appendChild(a),r.appendChild(i),i.onclick=function(n){n.stopPropagation(),e.calculative.media.muted?(i.innerHTML=ls[0],e.calculative.media.muted=!1):(i.innerHTML=ls[1],e.calculative.media.muted=!0)},e.calculative.singleton||(e.calculative.singleton={}),e.calculative.singleton.muted=i,r.onmouseenter=function(n){i.style.display="block"},r.onmouseleave=function(n){i.style.display="none"},r.onclick=function(n){n.stopPropagation(),py(e)};var o;e.video?(o=document.createElement("video"),o.src=e.video):e.audio&&(o=document.createElement("audio"),o.src=e.audio),o.loop=e.playLoop,o.ontimeupdate=function(){Aw(a,o,e.calculative.worldRect.width)},o.onended=function(){e.calculative.onended&&e.calculative.onended(e)},e.calculative.media=o,o.style.position="absolute",o.style.outline="none",o.style.left="0",o.style.top="0",o.style.width="100%",o.style.height="100%",r.appendChild(o),It[e.id]=r,(t=e.calculative.canvas.externalElements)===null||t===void 0||t.parentElement.appendChild(r),Ye(e,r),e.autoPlay&&(o.autoplay=!0,o.muted=!0)}return e.calculative.patchFlags&&Ye(e,It[e.id]),new Path2D}function yj(e){It[e.id].onclick=null,It[e.id].remove(),It[e.id]=void 0}function mc(e){Ye(e,It[e.id]);var t=It[e.id].children[0],r=It[e.id].children[1];Aw(t,r,e.calculative.worldRect.width)}function py(e){e.calculative.media&&(e.calculative.media.muted=!1,e.calculative.singleton.muted.innerHTML=ls[0],e.calculative.media.paused?e.calculative.media.play():e.calculative.media.pause())}function Aw(e,t,r){e.style.width=t.currentTime/t.duration*r+"px"}function pj(e,t,r){It[t]&&(It[r]=It[t],delete It[t])}function mj(e){var t=It[e.id];if(t){Ye(e,t);var r=e.calculative.media.getAttribute("src");e.video?r!==e.video&&(e.calculative.media.src=e.video):e.audio&&r!==e.audio&&(e.calculative.media.src=e.audio),e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop}}function Fr(){try{var e=new OffscreenCanvas(0,0),t=e.getContext("2d");return t&&t.arc?e:document.createElement("canvas")}catch{return document.createElement("canvas")}}var bj=function(){function e(t,r){var a=this;this.parentElement=t,this.store=r,this.box=document.createElement("div"),this.text=document.createElement("div"),this.arrowUp=document.createElement("div"),this.arrowDown=document.createElement("div"),this.box.className="meta2d-tooltip",this.text.className="text",this.arrowUp.className="arrow",this.arrowDown.className="arrow down",this.box.appendChild(this.text),this.box.appendChild(this.arrowUp),this.box.appendChild(this.arrowDown),t.appendChild(this.box),this.box.onmouseleave=function(){a.hide(),a.store.lastHover=void 0};for(var i,o=0;o<document.styleSheets.length;o++)document.styleSheets[o].title==="le5le.com/tooltip"&&(i=document.styleSheets[o]);if(!i){var n=document.createElement("style");n.type="text/css",n.title="le5le.com/tooltip",document.head.appendChild(n),n=document.createElement("style"),n.type="text/css",document.head.appendChild(n),i=n.sheet,i.insertRule(".meta2d-tooltip{position:absolute;padding:8px 0;z-index:10;left: -9999px;top: -9999px;}"),i.insertRule(".meta2d-tooltip .text{max-width:320px;min-height:30px;max-height:400px;outline:none;padding:8px 16px;border-radius:4px;background:#777777;color:#ffffff;line-height:1.8;overflow-y:auto;}"),i.insertRule(".meta2d-tooltip .arrow{position:absolute;border:10px solid transparent;background:transparent;top:-5px;left:50%;transform:translateX(-50%)}"),i.insertRule(".meta2d-tooltip .arrow.down{top:initial;bottom: -1px;}")}}return e.getTitle=function(t){if(t.titleFnJs&&!t.titleFn)try{t.titleFn=new Function("pen",t.titleFnJs)}catch(r){console.log("titleFnJs",r)}return t.titleFn?t.titleFn(t):String(t.title)},e.prototype.setText=function(t){var r=this.box.getBoundingClientRect(),a=globalThis.marked,i=e.getTitle(t);if(a){this.text.innerHTML=a(i);for(var o=this.text.getElementsByTagName("A"),n=0;n<o.length;++n)o[n].setAttribute("target","_blank")}else this.text.innerHTML=i;return r},e.prototype.updateText=function(t){var r;if(((r=this.currentPen)===null||r===void 0?void 0:r.id)===t.id&&!e.titleEmpty(t)){var a=this.setText(t),i=this.box.getBoundingClientRect();this.changePositionByText(a,i)}},e.prototype.changePositionByText=function(t,r){this.x-=(r.width-t.width)/2,this.y-=r.height-t.height,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"},e.titleEmpty=function(t){return!t.title&&!t.titleFn&&!t.titleFnJs},e.prototype.show=function(t,r){if(this.currentPen=t,e.titleEmpty(t)){var a=jt(t,!0);a&&this.show(a,r);return}this.setText(t);var i=this.box.getBoundingClientRect(),o=t.calculative.worldRect,n=t.calculative.canvas.store.data.x+r.x-i.width/2,s=t.calculative.canvas.store.data.y+r.y-i.height;t.type||(n=t.calculative.canvas.store.data.x+o.x-(i.width-o.width)/2,s=t.calculative.canvas.store.data.y+o.ey-i.height-o.height),s>0?(this.arrowUp.style.borderBottomColor="transparent",this.arrowDown.style.borderTopColor="#777777"):(s+=i.height+o.height+5,this.arrowUp.style.borderBottomColor="#777777",this.arrowDown.style.borderTopColor="transparent"),this.x=n,this.y=s,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"},e.prototype.hide=function(){this.currentPen=null,this.x=-9999,this.box.style.left="-9999px"},e.prototype.translate=function(t,r){this.x<-1e3||(this.x+=t,this.y+=r,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px")},e.prototype.destroy=function(){this.box.onmouseleave=null},e}(),Ew=function(){function e(t){var r=this;this.parent=t,this.onMouseDownH=function(n){n.preventDefault(),n.stopPropagation(),r.isDownH=n.x,r.x=r.parent.store.data.x||0,r.lastScrollX=r.scrollX},this.onMouseDownV=function(n){n.preventDefault(),n.stopPropagation(),r.isDownV=n.y,r.y=r.parent.store.data.y||0,r.lastScrollY=r.scrollY},this.onMouseMove=function(n){if(r.isDownH){var s=n.x-r.isDownH;r.scrollX=r.lastScrollX+s,r.h.style.left=r.scrollX+"px",r.parent.store.data.x=r.x-s*r.rect.width/r.parent.parentElement.clientWidth}if(r.isDownV){var u=n.y-r.isDownV;if(r.pageMode&&r.canMouseMove(u))return;r.scrollY=r.lastScrollY+u,r.v.style.top=r.scrollY+"px",r.parent.store.data.y=r.y-u*r.rect.height/r.parent.parentElement.clientHeight}(r.isDownH||r.isDownV)&&(r.parent.onMovePens(),r.parent.canvasTemplate.init(),r.parent.canvasImage.init(),r.parent.canvasImageBottom.init(),r.parent.render())},this.onMouseUp=function(n){!r.isDownH&&!r.isDownV||(r.isDownH=void 0,r.isDownV=void 0,r.scrollX<20?(r.scrollX=20,r.h.style.left=r.scrollX+"px"):r.scrollX>r.parent.parentElement.clientWidth-r.hSize-20&&(r.scrollX=r.parent.parentElement.clientWidth-r.hSize-20,r.h.style.left=r.scrollX+"px"),r.scrollY<20?(r.scrollY=20,r.v.style.top=r.scrollY+"px"):r.scrollY>r.parent.parentElement.clientHeight-r.vSize-20&&(r.scrollY=r.parent.parentElement.clientHeight-r.vSize-20,r.v.style.top=r.scrollY+"px"),r.resize())},this.h=document.createElement("div"),this.v=document.createElement("div"),this.parent.externalElements.appendChild(this.h),this.parent.externalElements.appendChild(this.v),this.h.className="meta2d-scroll h",this.h.onmousedown=this.onMouseDownH,this.v.className="meta2d-scroll v",this.v.onmousedown=this.onMouseDownV,document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp);for(var a,i=0;i<document.styleSheets.length;i++)document.styleSheets[i].title==="le5le/scroll"&&(a=document.styleSheets[i]);if(!a){var o=document.createElement("style");o.type="text/css",o.title="le5le.com/scroll",document.head.appendChild(o),o=document.createElement("style"),o.type="text/css",document.head.appendChild(o),a=o.sheet,a.insertRule(".meta2d-scroll{position:absolute;width:8px;height:200px;background:#dddddd;border-radius:10px;z-index:20;cursor:default;}"),a.insertRule(".meta2d-scroll:hover{background:#cccccc;cursor:pointer}"),a.insertRule(".meta2d-scroll.v{right:0;top:calc(50% - 100px);}"),a.insertRule(".meta2d-scroll.h{bottom:2px;left:calc(50% - 100px);width:200px;height:8px;}")}this.init()}return e.prototype.init=function(){this.isShow=!0,this.resize(),this.initPos()},e.prototype.canMouseMove=function(t){var r=this.parent.parent.getRect();return t<0&&r.y+this.parent.store.data.y>=0||t>0&&r.ey-this.parent.height+this.parent.store.data.y<=0},e.prototype.changeMode=function(){this.pageMode=!0,this.h.style.display="none";var t=this.parent.parent.getRect();t.height<this.parent.height&&(this.v.style.display="none")},e.prototype.initPos=function(){this.scrollX=(this.parent.parentElement.clientWidth-this.hSize)/2,this.scrollY=(this.parent.parentElement.clientHeight-this.vSize)/2,this.h.style.left=this.scrollX+"px",this.v.style.top=this.scrollY+"px"},e.prototype.resize=function(){this.rect=kr(this.parent.store.data.pens),this.rect.width<1400&&(this.rect.width=1400),this.rect.height<900&&(this.rect.height=900),this.parent.store.data.x>0?this.rect.width+=this.parent.store.data.x+(this.rect.x>0?0:this.rect.x):this.rect.width-=this.parent.store.data.x+(this.rect.x>0?0:this.rect.x),this.parent.store.data.y>0?this.rect.height+=this.parent.store.data.y+(this.rect.y>0?0:this.rect.y):this.rect.height-=this.parent.store.data.y+(this.rect.y>0?0:this.rect.y),this.rect.width<1400&&(this.rect.width=1400),this.rect.height<900&&(this.rect.height=900),this.hSize=1e3*this.parent.parentElement.clientWidth/this.rect.width/3,this.vSize=1e3*this.parent.parentElement.clientHeight/this.rect.height/3,this.h.style.width=this.hSize+"px",this.v.style.height=this.vSize+"px"},e.prototype.show=function(){this.isShow=!0,this.h.style.display="block",this.v.style.display="block",document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},e.prototype.hide=function(){this.isShow=!1,this.h.style.display="none",this.v.style.display="none",this.destroy()},e.prototype.translate=function(t,r){t&&(this.scrollX-=t*this.parent.parentElement.clientWidth/this.rect.width,this.h.style.left=this.scrollX+"px"),r&&(this.scrollY-=r*this.parent.parentElement.clientHeight/this.rect.height,this.v.style.top=this.scrollY+"px")},e.prototype.wheel=function(t){var r=10;t&&(r=-10),!(this.pageMode&&this.canMouseMove(r))&&(this.scrollY+=r,this.v.style.top=this.scrollY+"px",this.parent.store.data.y-=r*this.rect.height/this.parent.parentElement.clientHeight,this.parent.onMovePens(),this.parent.canvasTemplate.init(),this.parent.canvasImage.init(),this.parent.canvasImageBottom.init(),this.parent.render())},e.prototype.destroy=function(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},e}(),go=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},my=function(){function e(t,r,a){this.parentElement=t,this.store=r,this.isBottom=a,this.canvas=document.createElement("canvas"),this.otherOffsreen=Fr(),this.offscreen=Fr(),this.animateOffsScreen=Fr(),this.fitOffscreen=Fr(),this.fitFlag=!1,t.appendChild(this.canvas),this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0"}return e.prototype.resize=function(t,r){this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",t=t*this.store.dpiRatio|0,r=r*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=r,this.otherOffsreen.width=t,this.otherOffsreen.height=r,this.offscreen.width=t,this.offscreen.height=r,this.animateOffsScreen.width=t,this.animateOffsScreen.height=r,this.fitOffscreen.width=t,this.fitOffscreen.height=r,this.otherOffsreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.otherOffsreen.getContext("2d").textBaseline="middle",this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.animateOffsScreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.animateOffsScreen.getContext("2d").textBaseline="middle",this.fitOffscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.fitOffscreen.getContext("2d").textBaseline="middle",this.init()},e.prototype.init=function(){var t,r;this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.animateOffsScreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.fitOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);try{for(var a=go(this.store.data.pens),i=a.next();!i.done;i=a.next()){var o=i.value;this.hasImage(o)&&(o.calculative.imageDrawed=!1)}}catch(n){t={error:n}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}this.isBottom?this.store.patchFlagsBackground=!0:this.store.patchFlagsTop=!0},e.prototype.clear=function(){this.otherOffsreen.getContext("2d").clearRect(0,0,this.otherOffsreen.width,this.otherOffsreen.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.animateOffsScreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.fitOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)},e.prototype.hasImage=function(t){return t.calculative.hasImage=t.calculative&&t.calculative.inView&&(this.isBottom&&t.canvasLayer===_e.CanvasImageBottom||!this.isBottom&&t.canvasLayer===_e.CanvasImage)&&t.image&&t.calculative.img&&t.name!=="gif",t.calculative.hasImage},e.prototype.render=function(){var t,r,a,i,o,n,s,u,c,l=!1,f=!1;try{for(var h=go(this.store.data.pens),d=h.next();!d.done;d=h.next()){var v=d.value;this.hasImage(v)&&(this.store.animates.has(v)?f=!0:v.calculative.imageDrawed||(l=!0),v.parentId&&this.store.animates.has(jt(v,!0))&&(f=!0))}}catch(B){t={error:B}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}var y=this.store.patchFlagsBackground,g=this.store.patchFlagsTop;if(g&&!this.isBottom){var m=this.otherOffsreen.getContext("2d");m.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderRule(m)}var w=this.store.patchFlagsLast;if(w){var m=this.offscreen.getContext("2d");m.clearRect(0,0,this.canvas.width,this.canvas.height)}if(l){var m=this.offscreen.getContext("2d");m.save(),m.clearRect(0,0,this.canvas.width,this.canvas.height),m.translate(this.store.data.x,this.store.data.y);try{for(var p=go(this.store.data.pens),x=p.next();!x.done;x=p.next()){var v=x.value;!v.calculative.hasImage||this.store.animates.has(v)||this.store.animates.has(jt(v,!0))||v.canvasLayer!==_e.CanvasTemplate&&(v.calculative.imageDrawed=!0,m.save(),qi(m,v),v.calculative.rotate&&jr(m,v),Ki(m,v),Ea(m,v),m.restore())}}catch(D){a={error:D}}finally{try{x&&!x.done&&(i=p.return)&&i.call(p)}finally{if(a)throw a.error}}m.restore()}if(f){var m=this.animateOffsScreen.getContext("2d");m.save(),m.clearRect(0,0,this.canvas.width,this.canvas.height),m.translate(this.store.data.x,this.store.data.y);try{for(var T=go(this.store.animates),A=T.next();!A.done;A=T.next()){var v=A.value;v.calculative.hasImage&&v.canvasLayer!==_e.CanvasTemplate&&(v.calculative.imageDrawed=!0,m.save(),qi(m,v),v.calculative.rotate&&jr(m,v),Ki(m,v),Ea(m,v),m.restore())}}catch(D){o={error:D}}finally{try{A&&!A.done&&(n=T.return)&&n.call(T)}finally{if(o)throw o.error}}try{for(var I=go(this.store.data.pens),R=I.next();!R.done;R=I.next()){var v=R.value;!v.calculative.hasImage||!v.parentId||v.canvasLayer!==_e.CanvasTemplate&&this.store.animates.has(jt(v,!0))&&(v.calculative.imageDrawed=!0,m.save(),qi(m,v),v.calculative.rotate&&jr(m,v),Ki(m,v),Ea(m,v),m.restore())}}catch(D){s={error:D}}finally{try{R&&!R.done&&(u=I.return)&&u.call(I)}finally{if(s)throw s.error}}m.restore()}if(!this.isBottom&&!this.store.data.locked&&this.fitFlag){var z=(this.store.data.width||this.store.options.width)*this.store.data.scale,U=(this.store.data.height||this.store.options.height)*this.store.data.scale,_=this.store.data.origin.x+this.store.data.x||this.store.options.x||0,k=this.store.data.origin.y+this.store.data.y||this.store.options.y||0,S=this.fitOffscreen.getContext("2d");S.save(),S.clearRect(0,0,this.canvas.width,this.canvas.height),S.fillStyle="#ffffff66",S.strokeStyle=this.store.options.activeColor,(c=this.store.data.fits)===null||c===void 0||c.forEach(function(B,D){S.fillRect(_+z*B.x,k+U*B.y,z*B.width,U*B.height),B.active&&S.strokeRect(_+z*B.x,k+U*B.y,z*B.width,U*B.height)}),S.restore()}if(l||f||y&&this.isBottom||g&&!this.isBottom){var P=this.canvas.getContext("2d");P.clearRect(0,0,this.canvas.width,this.canvas.height),this.isBottom&&(this.store.patchFlagsBackground=!1),P.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),P.drawImage(this.animateOffsScreen,0,0,this.canvas.width,this.canvas.height),this.isBottom||(P.drawImage(this.otherOffsreen,0,0,this.canvas.width,this.canvas.height),this.store.patchFlagsTop=!1,!this.store.data.locked&&this.fitFlag&&P.drawImage(this.fitOffscreen,0,0,this.canvas.width,this.canvas.height))}},e.prototype.renderRule=function(t){var r,a,i,o,n,s,u,c,l=this.store,f=l.data,h=l.options,d=f.rule,v=f.ruleColor,y=f.scale,g=f.origin;if(d??h.rule){var m=y*10;t.save();var w=v||h.ruleColor;t.strokeStyle=Ts(w,.7);var p=g.x+f.x,x=g.y+f.y,T=this.canvas,A=T.width,I=T.height,R=((r=h.ruleOptions)===null||r===void 0?void 0:r.height)||20;!((a=h.ruleOptions)===null||a===void 0)&&a.background&&(t.beginPath(),t.fillStyle=(i=h.ruleOptions)===null||i===void 0?void 0:i.background,t.rect(0,0,A,R),t.fill(),t.rect(0,0,R,I),t.fill()),!((o=h.ruleOptions)===null||o===void 0)&&o.underline&&(t.beginPath(),t.fillStyle=Ts(w,.7),t.moveTo(0,R),t.lineTo(A,R),t.stroke(),t.moveTo(R,0),t.lineTo(R,I),t.stroke());var z=R/4;((n=h.ruleOptions)===null||n===void 0?void 0:n.baseline)==="bottom"&&(z=R*3/4),t.beginPath(),t.lineWidth=R/2,t.lineDashOffset=-p%m,t.setLineDash([1,m-1]),t.moveTo(0,z),t.lineTo(A,z),t.stroke(),t.beginPath(),t.lineDashOffset=-x%m,t.moveTo(z,0),t.lineTo(z,I),t.stroke(),t.strokeStyle=w,t.beginPath(),t.lineWidth=R,t.lineDashOffset=-p%(m*10),t.setLineDash([1,m*10-1]),t.moveTo(0,R/2),t.lineTo(A,R/2),t.stroke(),t.beginPath(),t.lineDashOffset=-x%(m*10),t.moveTo(R/2,0),t.lineTo(R/2,I),t.stroke(),t.beginPath(),t.fillStyle=((s=h.ruleOptions)===null||s===void 0?void 0:s.textColor)||t.strokeStyle;var U=0-Math.floor(p/m/10)*100,_=((u=h.ruleOptions)===null||u===void 0?void 0:u.textTop)||16,k=((c=h.ruleOptions)===null||c===void 0?void 0:c.textLeft)||4;p<0&&(U-=100);for(var S=p%(m*10);S<A;S+=10*m,U+=100)m<3&&U%500||t.fillText(U.toString(),S+k,_);U=0-Math.floor(x/m/10)*100,x<0&&(U-=100);for(var S=x%(m*10);S<I;S+=10*m,U+=100)m<3&&U%500||(t.save(),t.beginPath(),t.translate(_,S-k),t.rotate(270*Math.PI/180),t.fillText(U.toString(),0,0),t.restore());t.restore()}},e}(),wj=function(){function e(t,r,a){this.parentCanvas=t,this.parentElement=r,this.store=a,this.canvas=document.createElement("canvas"),this.magnifierScreen=Fr(),this.offscreen=Fr(),this.magnifierSize=300,r.appendChild(this.canvas),this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0"}return e.prototype.resize=function(t,r){this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",t=t*this.store.dpiRatio|0,r=r*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=r,this.offscreen.width=t,this.offscreen.height=r,this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.magnifierScreen.width=this.magnifierSize+5,this.magnifierScreen.height=this.magnifierSize+5},e.prototype.renderMagnifier=function(){var t=this;if(this.magnifier){var r=this.magnifierSize/2,a=this.magnifierSize+5,i=this.magnifierScreen.getContext("2d");i.clearRect(0,0,a,a),i.lineWidth=5,i.save(),i.translate(2.5,2.5),i.save(),i.arc(r,r,r,0,Math.PI*2,!1),i.clip(),i.translate(-r,-r),i.scale(2,2);var o={x:(this.parentCanvas.mousePos.x+this.store.data.x)*this.store.dpiRatio,y:(this.parentCanvas.mousePos.y+this.store.data.y)*this.store.dpiRatio},n=[this.parentCanvas.canvasTemplate.bgOffscreen,this.parentCanvas.canvasTemplate.offscreen,this.parentCanvas.canvasImageBottom.offscreen,this.parentCanvas.canvasImageBottom.animateOffsScreen,this.parentCanvas.offscreen,this.parentCanvas.canvasImage.offscreen,this.parentCanvas.canvasImage.animateOffsScreen];n.forEach(function(c){i.drawImage(c,o.x-r,o.y-r,t.magnifierSize,t.magnifierSize,0,0,t.magnifierSize,t.magnifierSize)}),i.restore(),i.beginPath();var s=i.createRadialGradient(r,r,r-5,r,r,r);s.addColorStop(0,"rgba(0,0,0,0.2)"),s.addColorStop(.8,"rgb(200,200,200)"),s.addColorStop(.9,"rgb(200,200,200)"),s.addColorStop(1,"rgba(200,200,200,0.9)"),i.strokeStyle=s,i.arc(r,r,r,0,Math.PI*2,!1),i.stroke(),i.restore();var u=this.offscreen.getContext("2d");u.drawImage(this.magnifierScreen,0,0,this.magnifierSize+5,this.magnifierSize+5,(o.x-r-2.5)/this.store.dpiRatio,(o.y-r-2.5)/this.store.dpiRatio,(this.magnifierSize+5)/this.store.dpiRatio,(this.magnifierSize+5)/this.store.dpiRatio)}},e.prototype.render=function(){this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.renderMagnifier();var t=this.canvas.getContext("2d");t.clearRect(0,0,this.canvas.width,this.canvas.height),t.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height)},e}();function Pw(e){if(e.data.locked)throw new Error("canvas is locked")}var xj=function(){function e(t){var r=this;this.parentElement=t,this.box=document.createElement("div"),this.dialog=document.createElement("div");var a=document.createElement("div");this.title=document.createElement("div"),this.close=document.createElement("span"),this.close.innerHTML=`
      <svg fill="none" viewBox="0 0 16 16" width="1em" height="1em">
      <path
        fill="currentColor"
        d="M8 8.92L11.08 12l.92-.92L8.92 8 12 4.92 11.08 4 8 7.08 4.92 4 4 4.92 7.08 8 4 11.08l.92.92L8 8.92z"
        fill-opacity="0.9"
      ></path>
    </svg>`;var i=document.createElement("div");this.iframe=document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.box.className="meta2d-dialog_mask",this.dialog.className="meta2d-dialog",i.className="meta2d-dialog_body",a.className="meta2d-dialog_header",this.title.className="meta2d-dialog-content",this.close.className="meta2d-dialog-close",a.appendChild(this.title),a.appendChild(this.close),i.appendChild(this.iframe),this.dialog.appendChild(a),this.dialog.appendChild(i),this.box.appendChild(this.dialog),t.appendChild(this.box),this.dialog.onclick=function(u){u.stopPropagation()},this.box.onclick=function(){r.hide()},this.close.onclick=function(){r.hide()};for(var o,n=0;n<document.styleSheets.length;n++)document.styleSheets[n].title==="le5le.com/dialog"&&(o=document.styleSheets[n]);if(!o){var s=document.createElement("style");s.type="text/css",s.title="le5le.com/dialog",document.head.appendChild(s),s=document.createElement("style"),s.type="text/css",document.head.appendChild(s),o=s.sheet,o.insertRule(`.meta2d-dialog_mask {
        display: none;
        position: absolute;
        top: 0%;
        left: 0%;
        width: 100%;
        height: 100%;
        background-color: #0000006f;
        z-index: 9999;`),o.insertRule(`.meta2d-dialog_mask .meta2d-dialog {
            position: absolute;
            top: 15vh;
            left: 10%;
            width: 80%;
            padding: 16px 20px;
            border-radius: 9px;
            background-color: #1e2430;
            z-index: 19999;
            overflow: auto;
        }`),o.insertRule(`.meta2d-dialog_header {
            display: flex;
        }`),o.insertRule(`.meta2d-dialog-content {
            width: calc(100% - 20px);
            font-weight: 600;
            font-size: 14px;
            color: #bdc7db;
        }`),o.insertRule(`.meta2d-dialog-close {
            width: 20px;
            height: 20px;
            line-height: 20px;
            text-align: center;
            color: #617b91;
        }`),o.insertRule(`.meta2d-dialog-close :hover{
            cursor: pointer;
        }`),o.insertRule(`.meta2d-dialog_body{
            margin-top: 4px;
        } `),o.insertRule(`.meta2d-dialog_body iframe{
            width: 100%;
            height: 400px;
        }`)}}return e.prototype.show=function(t,r){this.box.style.display="block",r&&this.iframe.setAttribute("src",r),t&&(this.title.innerText=t)},e.prototype.hide=function(){this.box.style.display="none"},e.prototype.destroy=function(){this.dialog.onclick=void 0,this.box.onclick=void 0,this.close.onclick=void 0},e}(),Cj=function(){function e(t){this.parentElement=t,this.box=document.createElement("div"),this.box.className="meta2d-title",t.appendChild(this.box);for(var r,a=0;a<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le.com/title"&&(r=document.styleSheets[a]);if(!r){var i=document.createElement("style");i.type="text/css",i.title="le5le.com/title",document.head.appendChild(i),i=document.createElement("style"),i.type="text/css",document.head.appendChild(i),r=i.sheet,r.insertRule(".meta2d-title{position:absolute;padding:0;z-index:10;left: -9999px;top: -9999px;background:#fff;color:#000; cursor: crosshair;border: 1px solid black;}")}}return e.getTitle=function(t){},e.prototype.setText=function(t){this.box.innerText=t.title},e.prototype.updateText=function(t){var r;((r=this.currentAnchor)===null||r===void 0?void 0:r.id)===t.id&&(e.titleEmpty(t)||(this.setText(t),this.changePositionByAnchor(t)))},e.prototype.changePositionByAnchor=function(t){this.box.style.left=t.x+10+"px",this.box.style.top=t.y+10+"px"},e.titleEmpty=function(t){return!t.title},e.prototype.show=function(t,r){if(!e.titleEmpty(t)){this.currentAnchor=t,this.setText(t);var a={x:r.calculative.canvas.store.data.x+t.x,y:r.calculative.canvas.store.data.y+t.y};this.changePositionByAnchor(a)}},e.prototype.hide=function(){this.box.style.left="-9999px",this.box.innerText="",this.currentAnchor=null},e.prototype.destroy=function(){this.box.onmouseleave=null},e}(),kj=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_j=function(){function e(t,r){this.parentElement=t,this.store=r,this.canvas=document.createElement("canvas"),this.offscreen=Fr(),this.bgOffscreen=Fr(),t.appendChild(this.canvas),this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0"}return e.prototype.resize=function(t,r){this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",t=t*this.store.dpiRatio|0,r=r*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=r,this.bgOffscreen.width=t,this.bgOffscreen.height=r,this.offscreen.width=t,this.offscreen.height=r,this.bgOffscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.bgOffscreen.getContext("2d").textBaseline="middle",this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.init()},e.prototype.init=function(){this.bgOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.patchFlags=!0,this.bgPatchFlags=!0},e.prototype.hidden=function(){this.canvas.style.display="none"},e.prototype.show=function(){this.canvas.style.display="block"},e.prototype.clear=function(){this.bgOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.bgPatchFlags=!0,this.patchFlags=!0},e.prototype.render=function(){var t,r,a;if(this.bgPatchFlags){var i=this.bgOffscreen.getContext("2d");i.clearRect(0,0,this.canvas.width,this.canvas.height);var o=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height,s=this.store.data.x||this.store.options.x||0,u=this.store.data.y||this.store.options.y||0,c=this.store.data.background||this.store.options.background;c&&(i.save(),i.fillStyle=c,o&&n?(i.globalAlpha=(a=this.store.data.globalAlpha)!==null&&a!==void 0?a:this.store.options.globalAlpha,i.shadowOffsetX=this.store.options.shadowOffsetX,i.shadowOffsetY=this.store.options.shadowOffsetY,i.shadowBlur=this.store.options.shadowBlur,i.shadowColor=this.store.options.shadowColor,i.fillRect(this.store.data.origin.x+s,this.store.data.origin.y+u,o*this.store.data.scale,n*this.store.data.scale)):i.fillRect(0,0,this.canvas.width,this.canvas.height),i.restore()),o&&n&&this.store.bkImg&&(i.save(),i.drawImage(this.store.bkImg,this.store.data.origin.x+s,this.store.data.origin.y+u,o*this.store.data.scale,n*this.store.data.scale),i.restore()),this.renderGrid(i)}if(this.patchFlags){var i=this.offscreen.getContext("2d");i.save(),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.translate(this.store.data.x,this.store.data.y);try{for(var l=kj(this.store.data.pens),f=l.next();!f.done;f=l.next()){var h=f.value;isFinite(h.x)&&h.canvasLayer===_e.CanvasTemplate&&h.calculative.inView&&(Mi(i,h),h.image&&h.name!=="gif"&&h.calculative.img&&(i.save(),qi(i,h),h.calculative.rotate&&jr(i,h),Ki(i,h),Ea(i,h),i.restore()))}}catch(y){t={error:y}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}i.restore()}if(this.patchFlags||this.bgPatchFlags){var d=this.canvas.getContext("2d");d.clearRect(0,0,this.canvas.width,this.canvas.height),d.drawImage(this.bgOffscreen,0,0,this.canvas.width,this.canvas.height),d.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),this.patchFlags=!1,this.bgPatchFlags=!1}},e.prototype.renderGrid=function(t){var r=this.store,a=r.data,i=r.options,o=a.grid,n=a.gridRotate,s=a.gridColor,u=a.gridSize,c=a.scale,l=a.origin;if(o??i.grid){t.save();var f=(a.width||i.width)*c,h=(a.height||i.height)*c,d=(a.x||i.x||0)+l.x,v=(a.y||i.y||0)+l.y;n&&(t.translate(f/2,h/2),t.rotate(n*Math.PI/180),t.translate(-f/2,-h/2)),t.lineWidth=1,t.strokeStyle=s||i.gridColor,t.beginPath();var y=(u||i.gridSize)*c;if(!f||!h){for(var g=this.store.dpiRatio,m=this.canvas.width/g,w=this.canvas.height/g,p=d/y,x=v/y,T=y*10,A=d-Math.ceil(p)*y,I=v-Math.ceil(x)*y,R=m+A+T,z=w+I+T,U=A;U<=R;U+=y)t.moveTo(U,I),t.lineTo(U,w+I+T);for(var U=I;U<=z;U+=y)t.moveTo(A,U),t.lineTo(m+A+T,U)}else{for(var R=f+d,z=h+v,U=d;U<=R;U+=y)t.moveTo(U,v),t.lineTo(U,h+v);for(var U=v;U<=z;U+=y)t.moveTo(d,U),t.lineTo(f+d,U)}t.stroke(),t.restore()}},e}(),gt=function(){return gt=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},gt.apply(this,arguments)},or=function(e,t,r,a){function i(o){return o instanceof r?o:new r(function(n){n(o)})}return new(r||(r=Promise))(function(o,n){function s(l){try{c(a.next(l))}catch(f){n(f)}}function u(l){try{c(a.throw(l))}catch(f){n(f)}}function c(l){l.done?o(l.value):i(l.value).then(s,u)}c((a=a.apply(e,t||[])).next())})},nr=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a,i,o,n;return n={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function s(c){return function(l){return u([c,l])}}function u(c){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{a=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},vr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},gr=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))},Ne=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Tt="-moving",by=function(){function e(t,r,a){var i=this;this.parent=t,this.parentElement=r,this.store=a,this.canvas=document.createElement("canvas"),this.offscreen=Fr(),this.externalElements=document.createElement("div"),this.lastRotate=0,this.hoverType=ue.None,this.resizeIndex=0,this.lastOffsetX=0,this.lastOffsetY=0,this.drawLineFns=gr([],vr(jN),!1),this.patchFlagsLines=new Set,this.lastMouseTime=0,this.hoverTimer=0,this.fitTimer=0,this.patchFlags=!1,this.lastRender=0,this.touchStart=0,this.lastAnimateRender=0,this.animateRendering=!1,this.pointSize=8,this.pasteOffset=!0,this.opening=!1,this.maxZindex=5,this.canMoveLine=!1,this.inputParent=document.createElement("div"),this.inputDiv=document.createElement("div"),this.inputRight=document.createElement("div"),this.dropdown=document.createElement("ul"),this.mousePos={x:0,y:0},this.autoPolylineFlag=!1,this.stopPropagation=function(o){o.stopPropagation()},this.curve=V7,this.polyline=Z7,this.mind=K7,this.line=G7,this.onCopy=function(o){i.store.options.disableClipboard||o.target!==i.externalElements&&o.target!==document.body&&o.target.offsetParent!==i.externalElements||i.copy()},this.onCut=function(o){i.store.options.disableClipboard||o.target!==i.externalElements&&o.target!==document.body&&o.target.offsetParent!==i.externalElements||i.cut()},this.onPaste=function(o){if(!(i.store.data.locked||i.store.options.disableClipboard)&&!(o.target!==i.externalElements&&o.target!==document.body&&o.target.offsetParent!==i.externalElements)){var n;if(navigator.clipboard&&o.clipboardData){var s=o.clipboardData.items;if(s){for(var u=0;u<s.length;u++)if(s[u].type.indexOf("image")!==-1&&s[u].getAsFile()){n=!0;break}}}if(n){var s=o.clipboardData.items;if(s)for(var c=function(f){if(s[f].type.indexOf("image")!==-1&&s[f].getAsFile()){var h=i.mousePos,d=h.x,v=h.y,y=s[f].getAsFile(),g=s[f].type.slice(6)==="gif"?"gif":"image";if(y!==null){var m,w=new FileReader;w.onload=function(p){m=p.target.result;var x=new Image;x.src=m,x.onload=function(){var T=x.width,A=x.height,I={name:g,x:d-50/2,y:v-A/T*50,externElement:g==="gif",width:100,height:A/T*100,image:m};i.addPens([I]),i.active([I]),i.copy([I])}},w.readAsDataURL(y)}}},u=0;u<s.length;u++)c(u)}else i.paste()}},this.onwheel=function(o){if(i.inputDiv.contentEditable!=="true"&&!i.drawingLine&&!i.pencil){if(i.store.hover&&i.store.hover.onWheel){i.store.hover.onWheel(i.store.hover,o);return}if(!i.store.options.disableScale&&(o.preventDefault(),o.stopPropagation(),!(i.mouseDown&&(i.hoverType===ue.Node||i.hoverType===ue.Line))&&i.store.data.locked!==ke.Disable&&i.store.data.locked!==ke.DisableScale&&i.store.data.locked!==ke.DisableMoveScale)){if(!o.ctrlKey&&Math.abs(o.wheelDelta)<100&&o.deltaY.toString().indexOf(".")===-1){if(i.store.options.scroll&&!o.metaKey&&i.scroll){i.scroll.wheel(o.deltaY<0);return}var n=i.store.data.scale||1;i.translate(-o.deltaX/n,-o.deltaY/n);return}if(Math.abs(o.wheelDelta)>100&&i.store.options.scroll&&i.scroll&&!i.store.options.scrollButScale){i.scroll.wheel(o.deltaY<0);return}if(!i.store.options.disableTouchPadScale){var s=.015;if(i.store.options.scaleOff)s=i.store.options.scaleOff,o.deltaY>0&&(s=-i.store.options.scaleOff);else{var u=/mac os /i.test(navigator.userAgent);if(u)o.ctrlKey?o.deltaY>0&&(s*=-1):s*=o.wheelDeltaY/240;else{var c=.2;o.deltaY.toString().indexOf(".")!==-1&&(c=.01),o.deltaY>0?s=-c:s=c}}var l=o.offsetX,f=o.offsetY;i.scale(i.store.data.scale+s,{x:l,y:f}),i.externalElements.focus()}}}},this.onkeydown=function(o){var n,s,u;if(i.store.data.locked>=ke.DisableEdit&&o.target.tagName!=="INPUT"&&o.target.tagName!=="TEXTAREA"&&!o.target.dataset.meta2dIgnore&&i.store.active.forEach(function(g){var m;(m=g.onKeyDown)===null||m===void 0||m.call(g,g,o.key)}),!(i.store.data.locked>=ke.DisableEdit||o.target.tagName==="INPUT"||o.target.tagName==="TEXTAREA"||o.target.dataset.meta2dIgnore)&&!i.store.options.unavailableKeys.includes(o.key)){i.keyOptions||(i.keyOptions={}),i.keyOptions.altKey=o.altKey,i.keyOptions.shiftKey=o.shiftKey,i.keyOptions.ctrlKey=o.ctrlKey,i.keyOptions.metaKey=o.metaKey;var c=10,l=10,f=null;if(i.store.options.strictScope){var h=i.store.data.width||i.store.options.width,d=i.store.data.height||i.store.options.height;h&&d&&(f={x:i.store.data.origin.x,y:i.store.data.origin.y,width:h*i.store.data.scale,height:d*i.store.data.scale})}switch(o.key){case" ":i.hotkeyType=Re.Translate;break;case"Control":i.drawingLine?i.drawingLine.calculative.drawlineH=!i.drawingLine.calculative.drawlineH:i.hotkeyType||(i.patchFlags=!0,i.hotkeyType=Re.Select);break;case"Meta":break;case"Shift":i.store.active.length===1&&i.store.active[0].type&&i.store.activeAnchor?i.toggleAnchorHand():i.hotkeyType||(i.patchFlags=!0,i.store.options.resizeMode||(i.hotkeyType=Re.Resize));break;case"Alt":if(!o.ctrlKey&&!o.shiftKey&&i.drawingLine){var v=Te(i.drawingLine);v!==i.drawingLine.calculative.activeAnchor?(sh(i.drawingLine),i.drawingLine.calculative.worldAnchors.push(v)):i.drawingLine.calculative.worldAnchors.push({x:v.x,y:v.y});var y=i.drawLineFns.indexOf(i.drawingLineName);i.drawingLineName=i.drawLineFns[(y+1)%i.drawLineFns.length],i.drawingLine.lineName=i.drawingLineName,i.drawline(),i.patchFlags=!0}o.preventDefault();break;case"a":case"A":o.ctrlKey||o.metaKey?(i.active(i.store.data.pens.filter(function(g){return!g.parentId&&g.locked!==ke.Disable})),o.preventDefault()):i.toggleAnchorMode();break;case"Delete":case"Backspace":if(i.canvasImage.fitFlag&&i.canvasImage.activeFit){i.deleteFit();break}!i.store.data.locked&&i.delete();break;case"ArrowLeft":if(i.movingAnchor){i.translateAnchor(-1,0);break}if(c=-1,o.shiftKey&&(c=-5),(o.ctrlKey||o.metaKey)&&(c=-10),c=c*i.store.data.scale,i.store.activeAnchor&&i.store.active&&i.store.active.length===1&&i.store.active[0].type){i.moveLineAnchor({x:i.store.activeAnchor.x+c,y:i.store.activeAnchor.y},{});break}f&&i.activeRect.x+c<f.x&&(c=f.x-i.activeRect.x),i.translatePens(i.store.active,c,0);break;case"ArrowUp":if(i.movingAnchor){i.translateAnchor(0,-1);break}if(l=-1,o.shiftKey&&(l=-5),(o.ctrlKey||o.metaKey)&&(l=-10),l=l*i.store.data.scale,f&&i.activeRect.y+l<f.y&&(l=f.y-i.activeRect.y),i.store.activeAnchor&&i.store.active&&i.store.active.length===1&&i.store.active[0].type){i.moveLineAnchor({x:i.store.activeAnchor.x,y:i.store.activeAnchor.y+l},{});break}i.translatePens(i.store.active,0,l);break;case"ArrowRight":if(i.movingAnchor){i.translateAnchor(1,0);break}if(c=1,o.shiftKey&&(c=5),(o.ctrlKey||o.metaKey)&&(c=10),c=c*i.store.data.scale,i.store.activeAnchor&&i.store.active&&i.store.active.length===1&&i.store.active[0].type){i.moveLineAnchor({x:i.store.activeAnchor.x+c,y:i.store.activeAnchor.y},{});break}f&&i.activeRect.x+i.activeRect.width+c>f.x+f.width&&(c=f.x+f.width-(i.activeRect.x+i.activeRect.width)),i.translatePens(i.store.active,c,0);break;case"ArrowDown":if(i.movingAnchor){i.translateAnchor(0,1);break}if(l=1,o.shiftKey&&(l=5),(o.ctrlKey||o.metaKey)&&(l=10),l=l*i.store.data.scale,f&&i.activeRect.y+i.activeRect.height+l>f.y+f.height&&(l=f.y+f.height-(i.activeRect.y+i.activeRect.height)),i.store.activeAnchor&&i.store.active&&i.store.active.length===1&&i.store.active[0].type){i.moveLineAnchor({x:i.store.activeAnchor.x,y:i.store.activeAnchor.y+l},{});break}i.translatePens(i.store.active,0,l);break;case"d":case"D":!((n=i.store.active[0])===null||n===void 0)&&n.locked||i.removeAnchorHand();break;case"h":case"H":!((s=i.store.active[0])===null||s===void 0)&&s.locked||i.addAnchorHand();break;case"m":case"M":i.toggleMagnifier();break;case"g":case"G":i.hoverType===ue.NodeAnchor&&(i.movingAnchor=i.store.hoverAnchor,i.externalElements.style.cursor="move");break;case"s":case"S":!i.store.data.locked&&i.hoverType===ue.LineAnchor&&i.store.hover===i.store.active[0]&&i.splitLine(i.store.active[0],i.store.hoverAnchor),(o.ctrlKey||o.metaKey)&&i.store.emitter.emit("save",{event:o});break;case"c":case"C":(o.ctrlKey||o.metaKey)&&i.store.options.disableClipboard&&i.copy();break;case"x":case"X":(o.ctrlKey||o.metaKey)&&i.store.options.disableClipboard&&i.cut();break;case"√":case"v":case"V":!o.ctrlKey&&!o.metaKey&&(i.pencil&&i.stopPencil(),i.drawingLineName?(i.finishDrawline(),i.drawingLineName=""):i.drawingLineName=i.store.options.drawingLineName),!i.store.data.locked&&(o.ctrlKey||o.metaKey)&&(i.store.options.disableClipboard||!i.store.options.disableClipboard&&o.altKey)&&i.paste();break;case"b":case"B":i.drawingLineName&&(i.finishDrawline(),i.drawingLineName=""),i.pencil?i.stopPencil():i.drawingPencil();break;case"y":case"Y":(o.ctrlKey||o.metaKey)&&i.redo();break;case"z":case"Z":o.ctrlKey||o.metaKey?i.undo():o.shiftKey&&i.redo();break;case"Enter":i.drawingLineName&&(i.finishDrawline(!0),i.store.active[0].anchors[0].connectTo?i.drawingLineName="":i.drawingLineName=i.store.options.drawingLineName),i.store.active&&(i.store.active.forEach(function(g){g.type?(g.close=!g.close,g.close&&xw(g),i.store.path2dMap.set(g,he.path2dDraws.line(g)),$u(g)):g.calculative.focus=!0}),i.render());break;case"Escape":i.drawingLineName&&i.finishDrawline(),i.drawingLineName=void 0,i.stopPencil(),i.store.active&&i.store.active.forEach(function(g){g.type||(g.calculative.focus=!1)}),i.movingPens&&(i.getAllByPens(i.movingPens).forEach(function(g){i.store.pens[g.id]=void 0}),i.movingPens=void 0,i.mouseDown=void 0,i.clearDock(),(u=i.store.active)===null||u===void 0||u.forEach(function(g){i.updateLines(g)}),i.calcActiveRect(),i.patchFlags=!0),i.hotkeyType=Re.None,i.movingAnchor=void 0,i.magnifierCanvas.magnifier&&(i.magnifierCanvas.magnifier=!1,i.patchFlags=!0);break;case"E":case"e":i.store.options.disableAnchor=!i.store.options.disableAnchor,i.store.emitter.emit("disableAnchor",i.store.options.disableAnchor);break;case"=":(o.ctrlKey||o.metaKey)&&(i.scale(i.store.data.scale+.1),o.preventDefault(),o.stopPropagation());break;case"-":(o.ctrlKey||o.metaKey)&&(i.scale(i.store.data.scale-.1),o.preventDefault(),o.stopPropagation());break;case"l":case"L":i.canMoveLine=!0;break;case"[":i.parent.down();break;case"]":i.parent.up();break;case"{":i.parent.bottom();break;case"}":i.parent.top();break;case"F":case"f":i.setFollowers();break}i.render(!1)}},this.onkeyup=function(o){switch(o.key){case"l":case"L":i.canMoveLine=!1;break}i.hotkeyType&&i.render(),i.hotkeyType<Re.AddAnchor&&(i.hotkeyType=Re.None)},this.ondrop=function(o){return or(i,void 0,void 0,function(){var n,s,u,c,l;return nr(this,function(f){switch(f.label){case 0:if(this.store.data.locked)return console.warn("canvas is locked, can not drop"),[2];o.preventDefault(),o.stopPropagation(),n=o.dataTransfer.getData("Meta2d")||o.dataTransfer.getData("Text"),s=null;try{n&&(s=JSON.parse(n))}catch{}return s?[3,3]:(u=o.dataTransfer.files,u.length&&u[0].type.match("image.*")&&!(this.addCaches&&this.addCaches.length)?(c=u[0].type==="image/gif",[4,this.fileToPen(u[0],c)]):[3,2]);case 1:return s=f.sent(),[3,3];case 2:if(this.addCaches&&this.addCaches.length)s=this.addCaches,this.addCaches=[];else return this.store.emitter.emit("drop",void 0),[2];f.label=3;case 3:return s=Array.isArray(s)?s:[s],s[0]&&s[0].draggable!==!1&&(l={x:o.offsetX,y:o.offsetY},this.calibrateMouse(l),this.dropPens(s,l),this.addCaches=[],this.getContainerHover(l),this.mousePos.x=l.x,this.mousePos.y=l.y,this.store.emitter.emit("mouseup",{x:l.x,y:l.y,pen:this.store.hoverContainer})),this.store.emitter.emit("drop",s||n),[2]}})})},this.ontouchstart=function(o){i.store.data.locked!==ke.Disable&&(i.touchStartTimer&&clearTimeout(i.touchStartTimer),i.touchStartTimer=setTimeout(function(){i.touchStart=performance.now();var n=o.touches[0].pageX-i.clientRect.x,s=o.touches[0].pageY-i.clientRect.y,u={x:n,y:s};if(i.calibrateMouse(u),i.getHover(u),i.onMouseDown({x:n,y:s,clientX:o.touches[0].clientX,clientY:o.touches[0].clientY,pageX:o.touches[0].pageX,pageY:o.touches[0].pageY,ctrlKey:o.ctrlKey||o.metaKey,shiftKey:o.shiftKey,altKey:o.altKey,buttons:1}),o.touches.length===2){i.initTouchDis=Math.hypot(o.touches[0].pageX-o.touches[1].pageX,o.touches[0].pageY-o.touches[1].pageY),i.initScale=i.store.data.scale,i.startTouches=o.touches,i.touchCenter={x:o.touches[0].pageX+(o.touches[1].pageX-o.touches[0].pageX)/2-i.clientRect.x,y:o.touches[0].pageY+(o.touches[1].pageY-o.touches[0].pageY)/2-i.clientRect.y};return}else o.touches.length===3&&(i.store.emitter.emit("contextmenu",{e:{x:n,y:s,clientX:o.touches[0].clientX,clientY:o.touches[0].clientY,pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},clientRect:i.clientRect}),o.preventDefault(),o.stopPropagation());i.touchStartTimer=void 0},50))},this.ontouchmove=function(o){var n;if(i.store.data.locked!==ke.Disable){o.stopPropagation(),o.preventDefault();var s=performance.now();if(!(s-i.touchStart<50)){i.touchStart=s;var u=o.touches,c=u.length,l=o.touches[0].pageX-i.clientRect.x,f=o.touches[0].pageY-i.clientRect.y;if(c===1)i.onMouseMove({x:l,y:f,clientX:o.changedTouches[0].clientX,clientY:o.changedTouches[0].clientY,pageX:o.changedTouches[0].pageX,pageY:o.changedTouches[0].pageY,ctrlKey:o.ctrlKey||o.metaKey,shiftKey:o.shiftKey,altKey:o.altKey,buttons:1});else if(c===2&&((n=i.startTouches)===null||n===void 0?void 0:n.length)===2){if(!i.touchMoving&&!i.touchScaling){var h=i.startTouches[0].pageX-u[0].pageX,d=i.startTouches[1].pageX-u[1].pageX,v=i.startTouches[0].pageY-u[0].pageY,y=i.startTouches[1].pageY-u[1].pageY;(h>=0&&d<0||h<=0&&d>0)&&(v>=0&&y<0||v<=0&&y>0)?i.touchScaling=!0:i.touchMoving=!0}if(i.touchScaling){if(i.store.options.disableScale)return;var g=Math.hypot(u[0].pageX-u[1].pageX,u[0].pageY-u[1].pageY)/i.initTouchDis;i.scale(i.initScale*g,re(i.touchCenter))}if(i.touchMoving){if(i.store.data.locked>=ke.DisableMove&&i.store.data.locked!==ke.DisableScale||i.store.options.disableScale)return;if(i.lastOffsetX){var g=i.store.data.scale;i.translate((l-i.lastOffsetX)/g,(f-i.lastOffsetY)/g)}i.lastOffsetX=l,i.lastOffsetY=f}}}}},this.ontouchend=function(o){if(i.store.data.locked!==ke.Disable){i.touchCenter=void 0,i.touchScaling=void 0,i.touchMoving=void 0,i.startTouches=void 0,i.lastOffsetX=0,i.lastOffsetY=0;var n=o.changedTouches[0].pageX-i.clientRect.x,s=o.changedTouches[0].pageY-i.clientRect.y;i.onMouseUp({x:n,y:s,clientX:o.changedTouches[0].clientX,clientY:o.changedTouches[0].clientY,pageX:o.changedTouches[0].pageX,pageY:o.changedTouches[0].pageY,ctrlKey:o.ctrlKey||o.metaKey,shiftKey:o.shiftKey,altKey:o.altKey,buttons:1}),setTimeout(function(){i.render()},20)}},this.onGesturestart=function(o){o.preventDefault()},this.onMouseDown=function(o){var n,s,u;if(o.buttons===2&&!i.drawingLine&&(i.mouseRight=Mr.Down),i.hideInput(),i.store.data.locked===ke.Disable||o.buttons!==1&&o.buttons!==2){i.hoverType=ue.None;return}if(!i.magnifierCanvas.magnifier){if(i.calibrateMouse(o),i.mousePos.x=o.x,i.mousePos.y=o.y,i.mouseDown=o,i.lastMouseTime=performance.now(),i.canvasImage.fitFlag){i.canvasImage.currentFit||i.calcuActiveFit();return}if(i.hotkeyType===Re.AddAnchor){i.setAnchor(i.store.pointAt);return}if(!i.store.options.autoAnchor&&!i.drawingLine&&o.shiftKey&&o.ctrlKey&&o.altKey){i.setAnchor(i.store.pointAt),i.drawingLineName=i.store.options.drawingLineName;var c=i.store.activeAnchor;if(!c)return;var l={id:xe(),x:c.x,y:c.y};i.drawingLine=i.createDrawingLine(l);var f=Ve(i.drawingLine);i.drawingLine.calculative.activeAnchor=f,ot(i.store.hover,c,i.drawingLine,l),i.drawline();return}if(!(i.hotkeyType===Re.Translate||i.mouseRight===Mr.Down&&!i.store.options.mouseRightActive)){if(i.drawingLine){if(i.store.hoverAnchor){var h=Te(i.drawingLine);i.store.hoverAnchor.type===Lr.Line?Bn(h,i.store.hoverAnchor,i.store):(h.x=i.store.hoverAnchor.x,h.y=i.store.hoverAnchor.y),ot(i.store.hover,i.store.hoverAnchor,i.drawingLine,h),i.drawline(),i.finishDrawline(!0);return}if(!i.store.options.autoAnchor&&o.shiftKey&&o.altKey&&o.ctrlKey){i.setAnchor(i.store.pointAt);var d=Te(i.drawingLine),c=i.store.activeAnchor;if(!c)return;d.x=c.x,d.y=c.y,ot(i.store.hover,c,i.drawingLine,d),i.drawline(),i.finishDrawline(!0);return}if(o.buttons===2||i.drawingLineName==="mind"&&((n=i.drawingLine)===null||n===void 0?void 0:n.calculative.worldAnchors.length)>1||i.store.options.drawingLineLength&&((s=i.drawingLine)===null||s===void 0?void 0:s.calculative.worldAnchors.length)>i.store.options.drawingLineLength){i.finishDrawline(!0),!((u=i.store.active[0])===null||u===void 0)&&u.anchors[0].connectTo||i.store.active.length==0?i.drawingLineName="":i.drawingLineName=i.store.options.drawingLineName;return}if(i.store.options.autoAnchor&&i.hoverType===ue.Node){var v=Te(i.drawingLine),c=xa(i.store.hover,o);v.x=c.x,v.y=c.y,i.drawingLine.autoTo=!0,ot(i.store.hover,c,i.drawingLine,v),i.drawline(),i.finishDrawline(!0);return}var y=Te(i.drawingLine);y.isTemp?(i.drawingLine.calculative.activeAnchor=i.drawingLine.calculative.worldAnchors[i.drawingLine.calculative.worldAnchors.length-2],y.isTemp=void 0):(i.drawingLine.calculative.activeAnchor=y,i.drawingLine.calculative.worldAnchors.push({x:y.x,y:y.y,penId:y.penId})),i.drawingLine.calculative.drawlineH=void 0,i.drawingLineName!=="polyline"&&i.drawline()}if(i.drawingLineName){if(i.hoverType===ue.Node)if(i.store.options.autoAnchor){i.inactive(!0);var c=xa(i.store.hover,o);i.store.hoverAnchor=c;var l={id:xe(),x:c.x,y:c.y};i.drawingLine=i.createDrawingLine(l),i.drawingLine.autoFrom=!0,ot(i.store.hover,c,i.drawingLine,l)}else i.inactive(),i.hoverType=ue.None;else if(i.hoverType===ue.NodeAnchor){i.drawingLineName=i.store.options.drawingLineName;var l={id:xe(),x:i.store.hoverAnchor.x,y:i.store.hoverAnchor.y};i.drawingLine=i.createDrawingLine(l),i.drawingLine.calculative.activeAnchor=l,ot(i.store.hover,i.store.hoverAnchor,i.drawingLine,l)}else if(!i.drawingLine&&i.drawingLineName!=="curve"){i.inactive(!0);var l={id:xe(),x:o.x,y:o.y};i.drawingLine=i.createDrawingLine(l),i.drawingLine.calculative.activeAnchor=l}}else if(i.pencil){i.inactive(!0);var g=xe(),l={x:o.x,y:o.y,id:xe(),penId:g};i.pencilLine=i.getInitPencilLine(l)}else{switch(i.hoverType){case ue.None:(i.store.data.rule||i.store.options.rule)&&!i.store.options.disableRuleLine&&i.addRuleLine(o),i.store.options.resizeMode&&(i.hotkeyType=Re.None),i.inactive();break;case ue.Node:case ue.Line:if(i.store.hover){var m=jt(i.store.hover,!0)||i.store.hover;o.ctrlKey&&!o.shiftKey?(m.calculative.active?i.willInactivePen=m:i.store.active.length>0&&(m.calculative.active=!0,pa(m),i.store.active.push(m),i.store.emitter.emit("active",i.store.active)),i.patchFlags=!0):o.ctrlKey&&o.shiftKey&&i.store.hover.parentId?i.active([i.store.hover]):(!(i.activeRect&&Jr({x:o.x,y:o.y},i.activeRect))||i.store.active.length==1)&&(m.calculative.active||(i.active([m]),i.store.options.resizeMode&&(i.hotkeyType=Re.Resize))),i.calcActiveRect()}break;case ue.LineAnchor:i.store.activeAnchor=i.store.hoverAnchor,i.store.hover.calculative.activeAnchor=i.store.hoverAnchor,i.active([i.store.hover]);break;case ue.LineAnchorPrev:case ue.LineAnchorNext:i.store.activeAnchor&&(i.prevAnchor=gt({},i.store.activeAnchor.prev),i.nextAnchor=gt({},i.store.activeAnchor.next));break;case ue.Resize:i.activeInitPos=[],i.store.active.forEach(function(w){i.activeInitPos.push({x:(w.calculative.worldRect.x-i.activeRect.x)/i.activeRect.width,y:(w.calculative.worldRect.y-i.activeRect.y)/i.activeRect.height})});break}i.store.hover&&(i.store.hover.calculative.mouseDown=!0),i.store.emitter.emit("mousedown",{x:o.x,y:o.y,pen:i.store.hover})}i.render()}}},this.onMouseMove=function(o){var n,s,u,c,l,f,h,d;if(i.store.data.locked===ke.Disable){i.hoverType=ue.None;return}if(i.mouseDown&&!i.mouseDown.restore&&o.buttons!==1&&o.buttons!==2){i.onMouseUp(o);return}if(i.lastMouseTime){var v=performance.now();if(v-i.lastMouseTime<50){i.lastMouseTime=0;return}i.lastMouseTime=0}if(i.calibrateMouse(o),i.mousePos.x=o.x,i.mousePos.y=o.y,i.magnifierCanvas.magnifier){i.render();return}if(i.canvasImage.fitFlag&&i.canvasImage.activeFit){var y=performance.now();y-i.fitTimer>100&&(i.mouseDown?i.updateFit(o):i.inFitBorder(i.mousePos),i.fitTimer=y);return}if(i.mouseDown&&!i.store.options.disableTranslate){if(i.mouseRight===Mr.Down&&(i.mouseRight=Mr.Translate),i.store.data.locked===ke.DisableEdit||i.store.data.locked===ke.DisableScale||i.hotkeyType===Re.Translate||i.mouseRight===Mr.Translate){var g=i.store.data.scale,m=(o.x-i.mouseDown.x)/g,w=(o.y-i.mouseDown.y)/g;o.shiftKey&&!o.ctrlKey&&(w=0),o.ctrlKey&&(m=0),i.translate(m,w);return}if(i.store.data.locked)return;if(!i.drawingLine&&!i.pencil){if(!i.drawingLineName&&!i.movingAnchor){if(i.hoverType===ue.NodeAnchor){if(!i.store.hoverAnchor)return;i.drawingLineName=i.store.options.drawingLineName;var p={id:xe(),x:i.store.hoverAnchor.x,y:i.store.hoverAnchor.y};i.drawingLine=i.createDrawingLine(p),i.drawingLine.calculative.activeAnchor=p,ot(i.store.hover,i.store.hoverAnchor,i.drawingLine,p),i.drawline();return}}else if(i.drawingLineName&&i.hoverType===ue.None){var p={id:xe(),x:o.x,y:o.y};i.drawingLine=i.createDrawingLine(p),i.drawingLine.calculative.activeAnchor=p,i.drawline();return}if(o.buttons===1&&(o.ctrlKey||!i.hoverType&&!i.hotkeyType)&&!(o.ctrlKey&&(i.store.activeAnchor||!((n=i.store.active)===null||n===void 0)&&n.length))){i.dragRect={x:Math.min(i.mouseDown.x,o.x),y:Math.min(i.mouseDown.y,o.y),ex:Math.max(i.mouseDown.x,o.x),ey:Math.max(i.mouseDown.y,o.y),width:Math.abs(o.x-i.mouseDown.x),height:Math.abs(o.y-i.mouseDown.y)},i.render();return}if(i.movingAnchor){var m=o.x-i.movingAnchor.x,w=o.y-i.movingAnchor.y;i.translateAnchor(m,w),i.render();return}else if(!(!((s=i.store.active[0])===null||s===void 0)&&s.locked)){var p={x:o.x,y:o.y};if(i.hoverType===ue.LineAnchor){(i.dockInAnchor(o)||((u=i.store.active[0])===null||u===void 0?void 0:u.lineName)==="line")&&!i.store.options.disableDock&&!i.store.options.disableLineDock&&(i.clearDock(),i.dock=ey(i.store,p,i.store.activeAnchor),!((c=i.dock)===null||c===void 0)&&c.xDock&&(p.x+=i.dock.xDock.step),!((l=i.dock)===null||l===void 0)&&l.yDock&&(p.y+=i.dock.yDock.step)),i.moveLineAnchor(p,o);return}if(i.hoverType===ue.LineAnchorPrev){i.moveLineAnchorPrev(o);return}if(i.hoverType===ue.LineAnchorNext){i.moveLineAnchorNext(o);return}}if(i.hoverType===ue.Rotate){i.rotatePens({x:o.x,y:o.y});return}if(i.hoverType===ue.Resize){i.resizePens(o);return}if(i.hoverType===ue.Node||i.hoverType===ue.Line){var m=o.x-i.mouseDown.x,w=o.y-i.mouseDown.y,x=20;if(o.ctrlKey&&!o.shiftKey&&(Math.abs(m)>=x||Math.abs(w)>=x)&&(i.willInactivePen=void 0),i.store.active.length===1){var T=i.store.active[0];if((T.locked===void 0||T.locked<ke.DisableMove)&&((f=T==null?void 0:T.onMouseMove)===null||f===void 0||f.call(T,T,i.mousePos)),T.calculative.focus)return}i.movePens(o),i.getContainerHover(o);return}}else if(i.pencil){var p=gt({},o);p.id=xe(),p.penId=i.pencilLine.id,i.pencilLine.calculative.worldAnchors.push(p),i.store.path2dMap.set(i.pencilLine,he.path2dDraws[i.pencilLine.name](i.pencilLine)),i.patchFlags=!0}}if(i.drawingLine){var p=gt({},o);if(p.id=xe(),p.penId=i.drawingLine.id,!i.store.options.disableDock&&!i.store.options.disableLineDock&&(i.clearDock(),i.dock=ey(i.store,p),!((h=i.dock)===null||h===void 0)&&h.xDock&&(p.x+=i.dock.xDock.step),!((d=i.dock)===null||d===void 0)&&d.yDock&&(p.y+=i.dock.yDock.step)),i.mouseDown&&i.drawingLineName==="curve"&&!i.drawingLine.calculative.worldAnchors[0].connectTo)i.drawline(p);else{var A=void 0;if(i.drawingLine.calculative.worldAnchors.length>1&&(A=Te(i.drawingLine)),A?(A.prev=void 0,A.next=void 0,A.id||(A.id=xe()),A.x=p.x,A.y=p.y,A.connectTo=void 0):(A=gt({},p),i.drawingLine.calculative.worldAnchors.push(A)),(i.hoverType===ue.NodeAnchor||i.hoverType===ue.LineAnchor)&&(i.store.hoverAnchor.type!==Lr.Line&&(A.x=i.store.hoverAnchor.x,A.y=i.store.hoverAnchor.y),A.connectTo=i.store.hoverAnchor.penId,i.drawingLineName==="polyline"&&(A.isTemp=!1)),i.drawingLineName==="line"){if(o.ctrlKey&&!o.shiftKey)A.x=i.drawingLine.calculative.worldAnchors[i.drawingLine.calculative.worldAnchors.length-2].x;else if(o.shiftKey&&!o.ctrlKey)A.y=i.drawingLine.calculative.worldAnchors[i.drawingLine.calculative.worldAnchors.length-2].y;else if(o.shiftKey&&o.ctrlKey){var I=i.drawingLine.calculative.worldAnchors[i.drawingLine.calculative.worldAnchors.length-2];i.getSpecialAngle(A,I)}}i.drawline()}}globalThis.debug&&console.time("hover");var R=performance.now();R-i.hoverTimer>50&&(i.hoverTimer=R,i.getHover(o)),globalThis.debug&&console.timeEnd("hover"),i.hotkeyType===Re.AddAnchor&&(i.patchFlags=!0),i.render(!1)},this.onMouseUp=function(o){var n,s;if(i.store.data.locked===ke.Disable){i.hoverType=ue.None;return}if(i.mouseDown){if(i.mouseRight===Mr.Down&&(i.store.hover&&i.store.hover.calculative.focus?i.store.hover.onContextmenu&&i.store.hover.onContextmenu(i.store.hover,o):i.store.emitter.emit("contextmenu",{e:o,clientRect:i.clientRect,pen:i.store.hover})),i.mouseRight=Mr.None,i.calibrateMouse(o),i.mousePos.x=o.x,i.mousePos.y=o.y,i.pencil&&i.finishPencil(),i.drawingLine){if(i.store.hoverAnchor){var u=Te(i.drawingLine);i.store.hoverAnchor.type===Lr.Line?Bn(u,i.store.hoverAnchor,i.store):(u.x=i.store.hoverAnchor.x,u.y=i.store.hoverAnchor.y),ot(i.store.hover,i.store.hoverAnchor,i.drawingLine,u),i.drawline(),i.finishDrawline(!0);return}if(i.store.options.autoAnchor&&i.hoverType===ue.Node){var u=Te(i.drawingLine),c=xa(i.store.hover,o);u.x=c.x,u.y=c.y,i.drawingLine.autoTo=!0,ot(i.store.hover,c,i.drawingLine,u),i.drawline(),i.finishDrawline(!0);return}}if(i.hoverType===ue.LineAnchor&&i.store.hover&&i.store.active[0]&&i.store.active[0].name==="line"&&i.store.active[0]!==i.store.hover){var l=i.store.active[0],f=Ve(l),u=Te(l);if(i.store.hoverAnchor){var h=i.store.hover,d=Ve(h)===i.store.hoverAnchor,v=Te(h)===i.store.hoverAnchor,y=f===i.store.activeAnchor,g=u===i.store.activeAnchor;if((o.ctrlKey||o.altKey)&&h.type===Ae.Line&&(d||v)&&(y||g)){var m=h.calculative.worldAnchors.map(function(A){return gt(gt({},A),{penId:l.id})});d?m.shift():v&&m.pop(),(d&&y||v&&g)&&m.reverse(),y?(l.calculative.worldAnchors[0].connectTo=void 0,(n=l.calculative.worldAnchors).unshift.apply(n,gr([],vr(m),!1))):g&&(l.calculative.worldAnchors[l.calculative.worldAnchors.length-1].connectTo=void 0,(s=l.calculative.worldAnchors).push.apply(s,gr([],vr(m),!1))),i.delete([h]),i.render()}else i.store.activeAnchor&&(i.store.hoverAnchor.type===Lr.Line?Bn(i.store.activeAnchor,i.store.hoverAnchor,i.store):(i.store.activeAnchor.x=i.store.hoverAnchor.x,i.store.activeAnchor.y=i.store.hoverAnchor.y),ot(i.store.hover,i.store.hoverAnchor,l,i.store.activeAnchor));i[l.lineName]&&l.lineName!=="polyline"&&i[l.lineName](i.store,l),i.store.path2dMap.set(l,he.path2dDraws.line(l)),i.initLineRect(l)}else f===i.store.activeAnchor&&l.autoFrom?i.calcAutoAnchor(l,f,i.store.hover):u===i.store.activeAnchor&&l.autoTo&&i.calcAutoAnchor(l,u,i.store.hover)}if(i.addCaches&&i.addCaches.length){if(!i.store.data.locked){if(i.dragRect&&i.addCaches.length===1){var w=i.addCaches[0];w.width=i.dragRect.width/i.store.data.scale,w.height=i.dragRect.height/i.store.data.scale,o.x=(i.dragRect.x+i.dragRect.ex)/2,o.y=(i.dragRect.y+i.dragRect.ey)/2}i.dropPens(i.addCaches,o)}i.addCaches=void 0}if(i.hoverType===ue.Rotate&&(i.getSizeCPs(),i.store.active.forEach(function(T){T.rotate=T.calculative.rotate})),i.patchFlagsLines.forEach(function(T){T.type&&i.initLineRect(T)}),i.patchFlagsLines.clear(),i.dragRect)if(i.canvasImage.fitFlag)i.makeFit();else{var p=i.store.data.pens.filter(function(T){if(T.visible===!1||T.locked>=ke.DisableMove||T.parentId||T.isRuleLine)return!1;if(si(T.calculative.worldRect,i.dragRect,o.ctrlKey||i.store.options.dragAllIn))return T.type===Ae.Line&&!i.store.options.dragAllIn?pc(T,i.dragRect):!0});i.active(p)}if(o.button!==2&&(Tl(i.mouseDown,o)<2&&(i.store.hover&&i.store.hover.input&&i.showInput(i.store.hover),i.store.emitter.emit("click",{x:o.x,y:o.y,pen:i.store.hover})),i.store.hover&&(i.store.hover.calculative.mouseDown=!1),i.store.hover!=i.store.hoverContainer&&i.store.emitter.emit("mouseup",{x:o.x,y:o.y,pen:i.store.hover}),i.store.emitter.emit("mouseup",{x:o.x,y:o.y,pen:i.store.hoverContainer})),i.willInactivePen){i.willInactivePen.calculative.active=void 0,pa(i.willInactivePen,!1);var x=i.store.active.findIndex(function(T){return T===i.willInactivePen});x>=0&&i.store.active.splice(x,1),i.calcActiveRect(),i.willInactivePen=void 0,i.store.emitter.emit("inactive",[i.willInactivePen]),i.render()}i.movingPens&&(o.altKey&&!o.shiftKey?i.copyMovedPens():i.movedActivePens(o.ctrlKey&&o.shiftKey),i.getAllByPens(i.movingPens).forEach(function(T){i.store.pens[T.id]=void 0}),i.movingPens=void 0),i.store.active&&i.store.active[0]&&(i.store.active[0].calculative.h=void 0),i.mouseDown=void 0,i.lastOffsetX=0,i.lastOffsetY=0,i.clearDock(),i.dragRect=void 0,i.initActiveRect=void 0,i.render()}},this.clearDock=function(){var o,n,s,u,c=(n=(o=i.dock)===null||o===void 0?void 0:o.xDock)===null||n===void 0?void 0:n.penId,l=(u=(s=i.dock)===null||s===void 0?void 0:s.yDock)===null||u===void 0?void 0:u.penId,f=i.store.pens[c];f&&(f.calculative.isDock=!1);var h=i.store.pens[l];h&&(h.calculative.isDock=!1),i.dock=void 0},this.onResize=function(){i.timer&&clearTimeout(i.timer),i.timer=setTimeout(function(){i.resize(),i.timer=void 0},100)},this.onScroll=function(){i.timer&&clearTimeout(i.timer),i.timer=setTimeout(function(){i.clientRect=i.canvas.getBoundingClientRect(),i.timer=void 0},100)},this.calibrateMouse=function(o){return o.x-=i.store.data.x,o.y-=i.store.data.y,o},this.getContainerHover=function(o){var n;if(!i.dragRect){i.store.hoverContainer=void 0;var s=i.store.data.pens.filter(function(f){var h;return f.container||((h=i.store.options.containerShapes)===null||h===void 0?void 0:h.includes(f.name))});if(s.length)for(var u=s.length-1;u>=0;--u){var c=s[u];if(!(c.visible==!1||c.calculative.inView==!1||c.locked===ke.Disable)){if(Jr(o,c.calculative.worldRect))i.store.hoverContainer=c,(n=c==null?void 0:c.onMouseMove)===null||n===void 0||n.call(c,c,o),i.store.lastHoverContainer!==i.store.hoverContainer&&(i.patchFlags=!0,i.store.lastHoverContainer&&(i.store.lastHoverContainer.calculative.containerHover=!1,i.store.emitter.emit("leave",i.store.lastHoverContainer)),i.store.hoverContainer&&(i.store.hoverContainer.calculative.containerHover=!0,i.store.emitter.emit("enter",i.store.hoverContainer)),i.store.lastHoverContainer=i.store.hoverContainer);else if(i.store.hoverContainer=void 0,i.store.lastHoverContainer!==i.store.hoverContainer){i.patchFlags=!0;var l=i.store.lastHoverContainer.calculative.canvas.store.pens[i.store.lastHoverContainer.id+Tt];i.store.lastHoverContainer&&!l&&(i.store.lastHoverContainer.calculative.containerHover=!1,i.store.emitter.emit("leave",i.store.lastHoverContainer)),i.store.lastHoverContainer=i.store.hoverContainer}}}}},this.getHover=function(o){var n,s;if(!i.dragRect&&!i.canvasImage.fitFlag){var u=ue.None;i.store.hover=void 0,i.store.hoverAnchor=void 0,i.title.hide(),i.store.pointAt=void 0,i.store.pointAtIndex=void 0;var c=i.store.active.length===1&&i.store.active[0].type;if(!i.drawingLineName&&i.hotkeyType!==Re.AddAnchor&&i.activeRect&&!c&&!i.store.data.locked){var l=vc(i.store.active),f=Qg(i.store.active)||i.store.options.disableRotate,h=Jg(i.store.active)||i.store.options.disableSize;if(!l&&!f){var d={x:i.activeRect.center.x,y:i.activeRect.y-30};i.activeRect.rotate&&De(d,i.activeRect.rotate,i.activeRect.pivot||i.activeRect.center),!i.hotkeyType&&ya(o,d,i.pointSize)&&(u=ue.Rotate,i.externalElements.style.cursor='url("'+i.store.options.rotateCursor+'"), auto')}if(!l&&!h)for(var v=0;v<8;v++){var y=v<4,g=i.hotkeyType===Re.Resize||y&&!i.hotkeyType;if(g&&ya(o,i.sizeCPs[v],i.pointSize)){var m=y?jg:zg,w=0;Math.abs(i.activeRect.rotate%90-45)<25?(m=y?zg:jg,w=Math.round((i.activeRect.rotate-45)/90)+(y?0:1)):w=Math.round(i.activeRect.rotate/90),u=ue.Resize,i.resizeIndex=v,i.externalElements.style.cursor=m[(v+w)%4];break}}}u===ue.None&&(u=i.inPens(o,i.store.data.pens)),!u&&!c&&Jr(o,i.activeRect)&&(u=ue.Node,i.externalElements.style.cursor="move"),i.hoverType=u,u===ue.None&&(i.drawingLineName||i.pencil?i.externalElements.style.cursor="crosshair":i.mouseDown||(i.externalElements.style.cursor="default"),i.store.hover=void 0),i.store.lastHover!==i.store.hover&&(i.patchFlags=!0,i.store.lastHover&&(i.store.lastHover.calculative.hover=!1,bo(jt(i.store.lastHover,!0)||i.store.lastHover,!1),i.store.emitter.emit("leave",i.store.lastHover),i.tooltip.hide()),i.store.hover&&(i.store.hover.calculative.hover=!0,bo(jt(i.store.hover,!0)||i.store.hover),i.store.emitter.emit("enter",i.store.hover),i.tooltip.show(i.store.hover,o)),i.store.lastHover=i.store.hover),(s=(n=i.store.hover)===null||n===void 0?void 0:n.onMouseMove)===null||s===void 0||s.call(n,i.store.hover,i.mousePos)}},this.inPens=function(o,n){var s,u=ue.None,c=function(h){var d,v,y,g,m=n[h];if(m.visible==!1||m.calculative.inView==!1||m.locked===ke.Disable)return"continue";var w=Ps(m);if(!m.calculative.active&&!Yi(o,m.calculative.worldRect,w)&&!Jr(o,m.calculative.worldRect))return"continue";if(!i.store.data.locked&&i.hotkeyType!==Re.Resize&&m.calculative.worldAnchors)try{for(var p=(d=void 0,Ne(m.calculative.worldAnchors)),x=p.next();!x.done;x=p.next()){var T=x.value;if(u=i.inAnchor(o,m,T),u){var A=re(T);return Object.assign(A,o),i.title.show(A,m),"break-outer"}}}catch(q){d={error:q}}finally{try{x&&!x.done&&(v=p.return)&&v.call(p)}finally{if(d)throw d.error}}if(m.type){if(m.isRuleLine){var I=((s=i.store.options.ruleOptions)===null||s===void 0?void 0:s.height)||20;if(o.x+i.store.data.x>I&&o.y+i.store.data.y>I)return"break"}var R=X7(o,m);if(R)return!i.store.data.locked&&!m.locked?i.hotkeyType===Re.AddAnchor?i.externalElements.style.cursor="pointer":i.externalElements.style.cursor="move":i.externalElements.style.cursor=i.store.options.hoverCursor,m.calculative.disabled&&(i.externalElements.style.cursor="not-allowed"),i.store.hover=m,i.store.pointAt=R.point,i.store.pointAtIndex=R.i,i.initTemplateCanvas([i.store.hover]),u=ue.Line,"break"}else{if(m.children){var z=[];if(m.children.forEach(function(q){i.store.pens[q]&&z.push(i.store.pens[q])}),u=i.inPens(o,z),u)return"break"}var U=!1;if(m.name==="line"?U=Yi(o,m.calculative.worldRect,m.lineWidth):U=Jr(o,m.calculative.worldRect),U){if(m.type===Ae.Node&&m.name==="line"){var _=h7(o,m.calculative.worldAnchors);if(!_)return"continue"}if(!i.store.data.locked&&!m.locked?i.hotkeyType===Re.AddAnchor?i.externalElements.style.cursor="pointer":i.externalElements.style.cursor="move":i.externalElements.style.cursor=i.store.options.hoverCursor,m.calculative.disabled&&(i.externalElements.style.cursor="not-allowed"),i.store.hover=m,i.initTemplateCanvas([i.store.hover]),u=ue.Node,i.store.pointAt=o,!o.ctrlKey){var k=i.store.hover.calculative.worldRect,S=k.x,P=k.y,B=k.ex,D=k.ey,H=k.rotate,L=k.center;if(H){var M=[{x:S,y:P},{x:B,y:P},{x:B,y:D},{x:S,y:D}];M.forEach(function(q){De(q,H,L)});var j=M[M.length-1];try{for(var W=(y=void 0,Ne(M)),F=W.next();!F.done;F=W.next()){var V=F.value;if(j.y>o.y!=V.y>o.y){var Y=V.x+(o.y-V.y)*(j.x-V.x)/(j.y-V.y);Math.abs(Y-i.store.pointAt.x)<10&&(i.store.pointAt.x=Y)}j=V}}catch(q){y={error:q}}finally{try{F&&!F.done&&(g=W.return)&&g.call(W)}finally{if(y)throw y.error}}}else i.store.pointAt.x-10<S?i.store.pointAt.x=S:i.store.pointAt.x+10>B&&(i.store.pointAt.x=B),i.store.pointAt.y-10<P?i.store.pointAt.y=P:i.store.pointAt.y+10>D&&(i.store.pointAt.y=D)}return"break"}}};e:for(var l=n.length-1;l>=0;--l){var f=c(l);if(f==="break")break;switch(f){case"break-outer":break e}}return u},this.dockInAnchor=function(o){var n,s,u,c;i.store.hover=void 0;for(var l=i.store.data.pens.length-1;l>=0;--l){var f=i.store.data.pens[l];if(!(f.visible==!1||f.locked===ke.Disable||f===i.store.active[0])){var h=Ps(f);if(h+=2*i.store.options.anchorRadius,!!Yi(o,f.calculative.worldRect,h)&&(i.store.hover=f,i.hotkeyType!==Re.Resize&&f.calculative.worldAnchors))try{for(var d=(n=void 0,Ne(f.calculative.worldAnchors)),v=d.next();!v.done;v=d.next()){var y=v.value;if(y.twoWay===ct.In){var g=Te(i.store.active[0]);if(i.store.activeAnchor.id!==g.id)continue}if(y.twoWay===ct.Out){var m=Ve(i.store.active[0]);if(i.store.activeAnchor.id!==m.id)continue}if(!(y.twoWay===ct.DisableConnected||y.twoWay===ct.Disable||((u=i.store.activeAnchor)===null||u===void 0?void 0:u.twoWay)===ct.DisableConnectTo||((c=i.store.activeAnchor)===null||c===void 0?void 0:c.twoWay)===ct.Disable)&&(i.title.hide(),i.inAnchor(o,f,y))){var w=re(y);return Object.assign(w,o),i.title.show(w,f),!0}}}catch(p){n={error:p}}finally{try{v&&!v.done&&(s=d.return)&&s.call(d)}finally{if(n)throw n.error}}}}},this.render=function(o){if(o&&(i.opening=!1),!i.opening){var n;if(o==null||o===!0||o===1/0?(n=performance.now(),i.patchFlags=!0):o>1?n=o:n=performance.now(),!!i.patchFlags){if(n-i.lastRender<i.store.options.interval){i.renderTimer&&cancelAnimationFrame(i.renderTimer),i.renderTimer=requestAnimationFrame(i.render);return}i.renderTimer=void 0,i.lastRender=n;var s=i.offscreen.getContext("2d");s.clearRect(0,0,i.offscreen.width,i.offscreen.height),s.save(),s.translate(i.store.data.x,i.store.data.y),globalThis.debugRender&&console.time("renderPens"),i.renderPens(),globalThis.debugRender&&console.timeEnd("renderPens"),i.renderBorder(),i.renderHoverPoint(),s.restore(),i.magnifierCanvas.render();var u=i.canvas.getContext("2d");u.clearRect(0,0,i.canvas.width,i.canvas.height),u.drawImage(i.offscreen,0,0,i.width,i.height),i.canvasTemplate.render(),i.canvasImageBottom.render(),i.canvasImage.render(),i.patchFlags=!1}}},this.renderPens=function(){var o,n,s=i.offscreen.getContext("2d");s.strokeStyle=Lo(i.store);try{for(var u=Ne(i.store.data.pens),c=u.next();!c.done;c=u.next()){var l=c.value;isFinite(l.x)&&l.canvasLayer!==_e.CanvasTemplate&&l.calculative.inView&&(l.canvasLayer===_e.CanvasMain&&l.name!=="gif"&&l.image&&l.calculative.img&&(s.save(),qi(s,l),l.calculative.rotate&&jr(s,l),Ki(s,l),Ea(s,l),s.restore()),Mi(s,l))}}catch(f){o={error:f}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}i.drawingLine&&Mi(s,i.drawingLine),i.pencilLine&&Mi(s,i.pencilLine),i.movingPens&&i.movingPens.forEach(function(f){i.renderPenContainChild(s,f)})},this.renderPenContainChild=function(o,n){var s;n.calculative.inView&&Mi(o,n),(s=n.children)===null||s===void 0||s.forEach(function(u){var c=i.store.pens[u];c&&i.renderPenContainChild(o,c)})},this.renderBorder=function(){if(!i.store.data.locked&&i.activeRect&&!(i.store.active.length===1&&i.store.active[0].type)&&!i.movingPens){var o=i.offscreen.getContext("2d");o.save(),o.translate(.5,.5);var n=i.activeRect.pivot||i.activeRect.center;if(i.activeRect.rotate&&(o.translate(n.x,n.y),o.rotate(i.activeRect.rotate*Math.PI/180),o.translate(-n.x,-n.y)),o.strokeStyle=i.store.options.activeColor,o.globalAlpha=i.store.options.activeGlobalAlpha===void 0?.3:i.store.options.activeGlobalAlpha,o.beginPath(),o.lineWidth=i.store.options.activeLineWidth||1,o.setLineDash(i.store.options.activeLineDash||[]),o.strokeRect(i.activeRect.x,i.activeRect.y,i.activeRect.width,i.activeRect.height),o.setLineDash([]),o.lineWidth=1,o.globalAlpha=1,vc(i.store.active)||Qg(i.store.active)||i.store.options.disableRotate){o.restore();return}o.beginPath(),o.moveTo(i.activeRect.center.x,i.activeRect.y),o.lineTo(i.activeRect.center.x,i.activeRect.y-30),o.stroke(),o.beginPath(),o.strokeStyle=i.store.options.activeColor,o.fillStyle="#ffffff",o.arc(i.activeRect.center.x,i.activeRect.y-30,5,0,Math.PI*2),o.fill(),o.stroke(),o.restore()}},this.renderHoverPoint=function(){if(!i.store.data.locked){var o=i.offscreen.getContext("2d");if(o.save(),o.translate(.5,.5),!i.store.options.disableAnchor&&i.store.hover&&!i.store.hover.disableAnchor&&(i.hotkeyType!==Re.Resize||i.store.active.length!==1||i.store.active[0]!==i.store.hover)){var n=gr([],vr(i.store.hover.calculative.worldAnchors),!1);i.store.pointAt&&i.hotkeyType===Re.AddAnchor&&n.push(i.store.pointAt),n&&(o.strokeStyle=i.store.hover.anchorColor||i.store.options.anchorColor,o.fillStyle=i.store.hover.anchorBackground||i.store.options.anchorBackground,n.forEach(function(s){if(!(s.hidden&&s.locked>ke.DisableEdit)){if(s===i.store.hoverAnchor){o.save();var u=i.store.hover.hoverAnchorColor||i.store.options.hoverAnchorColor;o.strokeStyle=u,o.fillStyle=u}o.beginPath();var c=s.radius||i.store.hover.anchorRadius||i.store.options.anchorRadius;if(i.store.hover.type&&!s.radius&&!i.store.hover.anchorRadius&&(c=3,i.store.hover.calculative.lineWidth>3&&(c=i.store.hover.calculative.lineWidth)),s.type===Lr.Line){var l=i.store.pens[s.penId].rotate||0;i.store.pens[s.penId].calculative.flipX&&(l*=-1),i.store.pens[s.penId].calculative.flipY&&(l*=-1);var f=s.rotate+l;i.store.pens[s.penId].calculative.flipX&&(f*=-1),i.store.pens[s.penId].calculative.flipY&&(f*=-1),o.save(),o.translate(s.x,s.y),o.rotate(f*Math.PI/180),o.translate(-s.x,-s.y),o.rect(s.x-s.length*i.store.data.scale/2,s.y-c,s.length*i.store.data.scale,c*2),o.restore()}else o.arc(s.x,s.y,c,0,Math.PI*2);if(i.store.hover.type&&i.store.hoverAnchor===s?(o.save(),o.strokeStyle=i.store.hover.activeColor||i.store.options.activeColor,o.fillStyle=o.strokeStyle):(s.color||s.background)&&(o.save(),o.strokeStyle=s.color,o.fillStyle=s.background),o.fill(),o.stroke(),s===i.store.hoverAnchor&&o.restore(),(i.store.hover.type&&i.store.hoverAnchor===s||s.color||s.background)&&o.restore(),!i.store.hover.parentId&&i.store.hover.children&&i.store.hover.children.length>0&&s===i.store.hoverAnchor){o.save(),o.beginPath(),o.lineWidth=3;var u=i.store.hover.hoverAnchorColor||i.store.options.hoverAnchorColor;globalThis.pSBC&&(o.strokeStyle=globalThis.pSBC(.5,u)),o.arc(s.x,s.y,c+1.5,0,Math.PI*2),o.stroke(),o.restore()}}}))}i.hotkeyType!==Re.AddAnchor&&!i.movingPens&&i.activeRect&&!(i.store.active.length===1&&i.store.active[0].type)&&!vc(i.store.active)&&!Jg(i.store.active)&&!i.store.options.disableSize&&(o.strokeStyle=i.store.options.activeColor,o.fillStyle="#ffffff",i.sizeCPs.forEach(function(s,u){i.activeRect.rotate&&(o.save(),o.translate(s.x,s.y),o.rotate(i.activeRect.rotate*Math.PI/180),o.translate(-s.x,-s.y)),(u<4||i.hotkeyType===Re.Resize)&&(o.beginPath(),o.fillRect(s.x-4.5,s.y-4.5,8,8),o.strokeRect(s.x-5.5,s.y-5.5,10,10)),i.activeRect.rotate&&o.restore()})),!i.store.data.locked&&i.dragRect&&(o.save(),o.fillStyle=Ts(i.store.options.dragColor,.2),o.strokeStyle=i.store.options.dragColor,o.beginPath(),o.strokeRect(i.dragRect.x,i.dragRect.y,i.dragRect.width,i.dragRect.height),o.fillRect(i.dragRect.x,i.dragRect.y,i.dragRect.width,i.dragRect.height),o.restore()),i.dock&&(o.strokeStyle=i.store.options.dockColor,i.dock.xDock&&(o.beginPath(),o.moveTo(i.dock.xDock.x,i.dock.xDock.y),o.lineTo(i.dock.xDock.x,i.dock.xDock.prev.y),o.stroke()),i.dock.yDock&&(o.beginPath(),o.moveTo(i.dock.yDock.x,i.dock.yDock.y),o.lineTo(i.dock.yDock.prev.x,i.dock.yDock.y),o.stroke())),o.restore()}},this.pastePen=function(o,n){var s,u,c=o.id;if(ty(o),o.parentId=n,o.type===Ae.Line?i.changeNodeConnectedLine(c,o,i.store.clipboard.pens):i.changeLineAnchors(c,o,i.store.clipboard.pens),!o.parentId){var l=i.getPenRect(o,i.store.clipboard.origin,i.store.clipboard.scale),f=i.getPenRect(i.store.clipboard.initRect,i.store.clipboard.origin,i.store.clipboard.scale),h=i.store.data,d=h.origin,v=h.scale;o.x=d.x+l.x*v,o.y=d.y+l.y*v,o.width=l.width*v,o.height=l.height*v,f.x=d.x+f.x*v,f.y=d.y+f.y*v,Ue(f),i.store.clipboard.pos&&(o.x-=f.center.x-i.store.clipboard.pos.x,o.y-=f.center.y-i.store.clipboard.pos.y),i.keyOptions&&i.keyOptions.altKey&&(i.keyOptions.ctrlKey||i.keyOptions.metaKey)?(o.x=-i.store.data.x+i.width/2-o.width/2,o.y=-i.store.data.y+i.height/2-o.height/2):i.keyOptions&&i.keyOptions.shiftKey&&(i.keyOptions.ctrlKey||i.keyOptions.metaKey)||(o.x+=i.store.clipboard.offset*i.store.data.scale,o.y+=i.store.clipboard.offset*i.store.data.scale)}i.makePen(o);var y=[];if(Array.isArray(o.children)){var g=function(x){var T=i.store.clipboard.pens.find(function(A){return A.id===x});T&&y.push(i.pastePen(T,o.id).id)};try{for(var m=Ne(o.children),w=m.next();!w.done;w=m.next()){var p=w.value;g(p)}}catch(x){s={error:x}}finally{try{w&&!w.done&&(u=m.return)&&u.call(m)}finally{if(s)throw s.error}}}return o.children=y,Dr(o,!0),o},this.ondblclick=function(o){i.store.hover&&(!i.store.data.locked||i.store.hover.dbInput)&&!i.store.options.disableInput&&(i.store.hover.onShowInput?i.store.hover.onShowInput(i.store.hover,o):i.showInput(i.store.hover)),i.store.emitter.emit("dblclick",{x:o.x,y:o.y,pen:i.store.hover})},this.showInput=function(o,n,s){if(s===void 0&&(s="transparent"),!(!window||!i.store.hover||i.store.hover.locked||i.store.hover.externElement||i.store.hover.disableInput||i.store.hover.disabled)){if(i.inputDiv.dataset.penId===o.id){i.inputDiv.dataset.isInput="true",i.inputDiv.contentEditable="true",i.inputDiv.focus();var u=window.getSelection();u.selectAllChildren(i.inputDiv),u.collapseToEnd(),i.inputDiv.scrollTop=i.inputDiv.scrollHeight,i.inputDiv.scrollLeft=i.inputDiv.scrollWidth;return}!n&&!o.dbInput?i.setInputStyle(o):(i.inputDiv.style.width="100%",i.inputDiv.style.height="100%");var c=n||o.calculative.worldTextRect,l=o.calculative.tempText===void 0?o.text+""||"":o.calculative.tempText,f=l.replace(/\x20/g,"&nbsp;").split(/[\s\n]/),h=(f.join("</div><div>")+"</div>").replace("</div>","").replace(/\<div\>\<\/div\>/g,"<div><br></div>");i.inputDiv.innerHTML=h,i.inputParent.style.left=c.x+i.store.data.x-(o.textLeft||0)+"px",i.inputParent.style.top=c.y+i.store.data.y-(o.textTop||0)+"px";var d=c.width+(o.textLeft||0);i.inputParent.style.width=(d<0?12:d)+"px",i.inputParent.style.height=c.height+(o.textTop||0)+"px",i.inputParent.style.zIndex="9999",i.inputParent.style.background=s,o.rotate%360?i.inputParent.style.transform="rotate("+o.rotate+"deg)":i.inputParent.style.transform=null,i.inputParent.style.display="flex",i.inputDiv.dataset.penId=o.id,i.inputDiv.contentEditable=o.disableInput==null?"true":o.disableInput.toString(),o.dropdownList&&i.dropdown.style.display!=="block"?(i.store.data.locked||(i.inputRight.style.display="none"),i.setDropdownList()):i.inputRight.style.display="none",i.inputDiv.contentEditable="true",i.inputDiv.focus();var v=window.getSelection();v.selectAllChildren(i.inputDiv),v.collapseToEnd(),i.inputDiv.scrollTop=i.inputDiv.scrollHeight,i.inputDiv.scrollLeft=i.inputDiv.scrollWidth,o.calculative.text=void 0,i.initTemplateCanvas([o]),i.render()}},this.setInputStyle=function(o){o.text||(o.text="");for(var n,s=0;s<document.styleSheets.length;s++)document.styleSheets[s].title==="le5le.com"&&(n=document.styleSheets[s]);var u="overflow: scroll;",c="",l=1,f=i.store.data.scale;if(o.fontSize<12&&(l=12/o.fontSize),o.textAlign?u+="text-align: "+o.textAlign+";":u+="text-align: center;",o.textAlign&&o.whiteSpace==="pre-line"){var h={left:"start",center:"center",right:"end"};u+="align-items: "+h[o.textAlign]+";"}if(o.textBaseline){var d={top:"start",middle:"center",bottom:"end"};u+="justify-content: "+d[o.textBaseline]+";"}else u+="justify-content: center;";if(o.fontFamily&&(u+="font-family: "+o.fontFamily+";"),o.fontSize&&(o.fontSize*f<12?(u+="font-size:"+o.fontSize+"px;",u+="zoom:"+o.fontSize/12*f+";"):u+="font-size:"+o.fontSize*f+"px;"),u+="color:"+pi(o,i.store)+";",o.fontStyle&&(u+="font-style: "+o.fontStyle+";"),o.fontWeight&&(u+="font-weight: "+o.fontWeight+";"),o.textLeft&&(u+="margin-left:"+(f>1?o.textLeft*l:o.textLeft*l/f)+"px;"),o.textTop&&(u+="margin-top:"+(f>1?o.textTop*l:o.textTop*l/f)+"px;"),o.lineHeight&&(u+="line-height:"+(f>1?o.fontSize*o.lineHeight*f:o.fontSize*o.lineHeight*l)+"px;"),o.textHeight)u+="height:"+(f>1?o.textHeight*l*f:o.textHeight*l)+"px;";else{var v=o.calculative.worldRect.height/f-(o.textTop||0);v<0&&(v=0);var y=o.fontSize*f<12?v*l:v*f*l;y<o.fontSize*o.lineHeight*f&&(y=o.fontSize*o.lineHeight*f,u+="top:-"+y/2+"px;"),u+="height:"+y+"px;"}var g=null;if(o.textWidth)g=o.textWidth<1&&o.textWidth>-1?o.textWidth*o.calculative.worldRect.width:o.textWidth,o.whiteSpace!=="pre-line"&&(g<o.fontSize?u+="width:"+o.fontSize*1.2*l+"px;":u+="width:"+(f>1?g*l*f:g*l)+"px;");else if(o.whiteSpace===void 0||o.whiteSpace==="break-all"){var v=(o.calculative.worldTextRect.width||12)/f;v<0&&(v=0),u+="width:"+(o.fontSize*f<12?v*l:v*f)+"px;"}if(o.whiteSpace&&(o.whiteSpace==="pre-line"?u+="white-space:pre;":(u+="white-space:"+o.whiteSpace+";",o.whiteSpace==="nowrap"&&(c+="display:contents;"))),o.whiteSpace!=="nowrap"){var m=o.fontSize*1.2*o.text.length,w=(g||o.calculative.worldRect.width/f)*Math.floor(o.calculative.worldRect.height/f/(o.lineHeight*o.fontSize));m>w&&(u+="justify-content: start;")}n.deleteRule(0),n.deleteRule(0),n.insertRule(`.meta2d-input
      .input-div{
        resize:none;border:none;outline:none;background:transparent;position:absolute;flex-grow:1;height:100%;width: 100%;position:absolute;left:0;top:0;display:flex;flex-direction: column;cursor: text;`+u+"}"),n.insertRule(".input-div div{"+c+"}")},this.hideInput=function(){if(i.inputParent.style.display==="flex"){i.inputParent.style.display="none";var o=i.store.pens[i.inputDiv.dataset.penId];if(!o)return;if(o.calculative.text=o.text,i.inputDiv.dataset.value=i.inputDiv.innerHTML.replace(/\<div\>/g,`
`).replace(/\<\/div\>/g,"").replace(/\<br\>/g,"").replace(/&nbsp;/g," ").replace(/(<([^>]+)>)/gi,""),i.inputDiv.dataset.value=i.convertSpecialCharacter(i.inputDiv.dataset.value),o.onInput)o.onInput(o,i.inputDiv.dataset.value);else if(o.text!==i.inputDiv.dataset.value){var n=[re(o,!0)];o.text=i.inputDiv.dataset.value,o.calculative.text=o.text,i.inputDiv.dataset.penId=void 0,o.name==="text"&&o.textAutoAdjust&&v$(o),Cr(o),i.patchFlags=!0,i.pushHistory({type:ce.Update,pens:[re(o,!0)],initPens:n}),i.store.emitter.emit("change",o),i.store.emitter.emit("valueUpdate",o)}else o.text===i.inputDiv.dataset.value&&o.calculative.textLines.length==0&&Cr(o);i.initTemplateCanvas([o])}i.inputDiv.dataset.penId=void 0,i.dropdown.style.display="none",i.inputDiv.dataset.isInput="false",i.inputDiv.contentEditable="false",i.render()},this.setDropdownList=function(o){var n,s;i.clearDropdownList();var u=i.store.pens[i.inputDiv.dataset.penId];if(!(!i.store.data.locked&&!["tablePlus"].includes(u.name))){if(i.dropdown.style.display="block",i.inputRight.style.display="block",setTimeout(function(){i.inputRight.style.transform="rotate(315deg)",i.inputRight.style.zoom=i.store.data.scale}),!u||!u.dropdownList){i.dropdown.style.display="none",i.inputRight.style.display="none",i.inputRight.style.transform="rotate(135deg)";return}if(!u.dropdownList.length){var c=document.createElement("div");c.innerText="None",c.style.padding="5px 12px",c.style.color="#ddd",i.dropdown.appendChild(c);return}var l=i.inputDiv.innerHTML.replace(/\<div\>/g,`
`).replace(/\<\/div\>/g,"").replace(/\<br\>/g,""),f=0;try{for(var h=Ne(u.dropdownList),d=h.next();!d.done;d=h.next()){var v=d.value,y=typeof v=="string"?v:v.text;o&&l?y.includes(l)&&i.dropdownAppendOption(y,f):i.dropdownAppendOption(y,f),++f}}catch(g){n={error:g}}finally{try{d&&!d.done&&(s=h.return)&&s.call(h)}finally{if(n)throw n.error}}if(!i.dropdown.hasChildNodes()){var c=document.createElement("div");c.innerText="None",c.style.padding="5px 12px",c.style.color="#ddd",i.dropdown.appendChild(c)}}},this.selectDropdown=function(o){var n=o.target,s=i.store.pens[i.inputDiv.dataset.penId];if(!(!n||!s||!s.dropdownList)){var u=+n.dataset.i,c=s.dropdownList[u];if(c){var l=[re(s,!0)];typeof c=="object"?(i.updateValue(s,gt({},c)),s.calculative.text=void 0,i.calcActiveRect()):s.text=c+"",i.inputDiv.innerText=s.text,i.hideInput(),i.pushHistory({type:ce.Update,pens:[re(s,!0)],initPens:l}),i.render(),i.store.emitter.emit("change",s),i.store.emitter.emit("valueUpdate",s)}}},this.inFitBorder=function(o){var n=void 0,s=i.store.data.width||i.store.options.width,u=i.store.data.height||i.store.options.height,c={x:(o.x-i.store.data.origin.x)/i.store.data.scale,y:(o.y-i.store.data.origin.y)/i.store.data.scale},l=i.canvasImage.activeFit;i.externalElements.style.cursor="default",c.y>u*l.y-10&&c.y<u*l.y+10&&(n="top",i.externalElements.style.cursor="row-resize"),c.y>u*(l.y+l.height)-10&&c.y<u*(l.y+l.height)+10&&(n="bottom",i.externalElements.style.cursor="row-resize"),c.x>s*l.x-10&&c.x<s*l.x&&(n="left",i.externalElements.style.cursor="col-resize"),c.x>s*(l.x+l.width)-10&&c.x<s*(l.x+l.width)+10&&(n="right",i.externalElements.style.cursor="col-resize"),i.canvasImage.currentFit=n},this.canvasTemplate=new _j(r,a),this.canvasTemplate.canvas.style.zIndex="1",this.canvasImageBottom=new my(r,a,!0),this.canvasImageBottom.canvas.style.zIndex="2",r.appendChild(this.canvas),this.canvas.style.position="absolute",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.zIndex="3",this.canvasImage=new my(r,a),this.canvasImage.canvas.style.zIndex="4",this.magnifierCanvas=new wj(this,r,a),this.magnifierCanvas.canvas.style.zIndex="5",this.externalElements.style.position="absolute",this.externalElements.style.left="0",this.externalElements.style.top="0",this.externalElements.style.outline="none",this.externalElements.style.background="transparent",this.externalElements.style.zIndex="5",r.style.position="relative",r.appendChild(this.externalElements),this.createInput(),this.tooltip=new bj(r,a),this.tooltip.box.onmouseleave=function(o){i.patchFlags=!0,i.store.lastHover&&(i.store.lastHover.calculative.hover=!1);var n=i.store.data.pens.find(function(s){return s.calculative.hover===!0});bo(n,!1)},this.dialog=new xj(r),this.title=new Cj(r),this.store.options.scroll&&(this.scroll=new Ew(this)),this.store.dpiRatio=globalThis.devicePixelRatio||1,this.store.dpiRatio<1?this.store.dpiRatio=1:this.store.dpiRatio>1&&this.store.dpiRatio<1.5&&(this.store.dpiRatio=1.5),this.clientRect=this.externalElements.getBoundingClientRect(),this.listen(),window==null||window.addEventListener("resize",this.onResize),window==null||window.addEventListener("scroll",this.onScroll)}return e.prototype.listen=function(){var t=this;switch(this.externalElements.addEventListener("gesturestart",this.onGesturestart),this.externalElements.ondragover=function(r){return r.preventDefault()},this.externalElements.ondrop=this.ondrop,this.externalElements.oncontextmenu=function(r){return r.preventDefault()},this.store.options.interval=50,this.externalElements.ontouchstart=this.ontouchstart,this.externalElements.ontouchmove=this.ontouchmove,this.externalElements.ontouchend=this.ontouchend,this.externalElements.onmousedown=function(r){t.onMouseDown({x:r.offsetX,y:r.offsetY,clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY,ctrlKey:r.ctrlKey||r.metaKey,shiftKey:r.shiftKey,altKey:r.altKey,buttons:r.buttons})},this.externalElements.onmousemove=function(r){r.target===t.externalElements&&t.onMouseMove({x:r.offsetX,y:r.offsetY,clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY,ctrlKey:r.ctrlKey||r.metaKey,shiftKey:r.shiftKey,altKey:r.altKey,buttons:r.buttons})},this.externalElements.onmouseup=function(r){t.onMouseUp({x:r.offsetX,y:r.offsetY,clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY,ctrlKey:r.ctrlKey||r.metaKey,shiftKey:r.shiftKey,altKey:r.altKey,buttons:r.buttons,button:r.button})},this.externalElements.onmouseleave=function(r){t.store.data.pens.forEach(function(a){a.calculative.hover&&(a.calculative.hover=!1)}),t.store.hover&&(t.store.hover.calculative.hover=!1,t.store.hover=void 0),t.render(),r.toElement!==t.tooltip.box&&r.toElement!==t.tooltip.arrowUp&&r.toElement!==t.tooltip.arrowDown&&(t.tooltip.hide(),t.store.lastHover=void 0)},this.externalElements.ondblclick=this.ondblclick,this.externalElements.tabIndex=0,this.externalElements.onblur=function(){t.mouseDown=void 0},this.externalElements.onwheel=this.onwheel,document.addEventListener("copy",this.onCopy),document.addEventListener("cut",this.onCut),document.addEventListener("paste",this.onPaste),this.store.options.keydown){case Ni.Document:document.addEventListener("keydown",this.onkeydown),document.addEventListener("keyup",this.onkeyup);break;case Ni.Canvas:this.externalElements.addEventListener("keydown",this.onkeydown),this.externalElements.addEventListener("keyup",this.onkeyup);break}},e.prototype.splitLine=function(t,r){var a=t.calculative.worldAnchors,i=a.findIndex(function(l){return l===r});if(![-1,0,a.length-1].includes(i)){var o=re(t,!0),n=re(t,!0),s=xe();n.id=s,n.calculative.canvas=this,n.calculative.active=!1,n.calculative.hover=!1;var u=re(a.slice(0,i+1)),c=re(a.slice(i)).map(function(l){return l.penId=s,l});t.calculative.worldAnchors=u,n.calculative.worldAnchors=c,this.initLineRect(t),this.initLineRect(n),this.store.data.pens.push(n),this.store.pens[s]=n,this.pushHistory({type:ce.Add,pens:[re(n,!0)],step:2}),this.pushHistory({type:ce.Update,initPens:[o],pens:[re(t,!0)],step:2})}},e.prototype.translateAnchor=function(t,r){var a=this;this.movingAnchor.x+=t,this.movingAnchor.y+=r;var i=this.movingAnchor.penId;if(i){var o=this.store.pens[i],n=o.calculative.worldRect;this.movingAnchor.x<n.x?this.movingAnchor.x=n.x:this.movingAnchor.x>n.ex&&(this.movingAnchor.x=n.ex),this.movingAnchor.y<n.y?this.movingAnchor.y=n.y:this.movingAnchor.y>n.ey&&(this.movingAnchor.y=n.ey);var s=Do(this.movingAnchor,n),u=o.anchors.findIndex(function(c){return c.id===a.movingAnchor.id});o.anchors[u]=s,this.patchFlags=!0}},e.prototype.fileToPen=function(t,r){return or(this,void 0,void 0,function(){var a;return nr(this,function(i){switch(i.label){case 0:return a="",this.store.options.uploadFn?[4,this.store.options.uploadFn(t)]:[3,2];case 1:return a=i.sent(),[3,6];case 2:return this.store.options.uploadUrl?[4,m$(t,this.store.options.uploadUrl,this.store.options.uploadParams,this.store.options.uploadHeaders)]:[3,4];case 3:return a=i.sent(),[3,6];case 4:return[4,p$(t)];case 5:a=i.sent(),i.label=6;case 6:return[2,new Promise(function(o,n){var s=new Image;s.onload=function(){he.htmlElements[a]=s,o({width:s.width,height:s.height,name:r?"gif":"image",image:a})},s.onerror=function(u){n(u)},s.crossOrigin="anonymous",s.src=a})]}})})},e.prototype.dropPens=function(t,r){var a;return or(this,void 0,void 0,function(){var i,o,T,n,s,T,u,c,T,l,f,h,d,v,T,y,g,m,w,p,x,T,A,I,R,z,U,_,k,S,P,B,D,H=this;return nr(this,function(L){switch(L.label){case 0:this.randomIdObj={};try{for(i=Ne(t),o=i.next();!o.done;o=i.next())T=o.value,!T.parentId&&this.randomCombineId(T,t)}catch(M){I={error:M}}finally{try{o&&!o.done&&(R=i.return)&&R.call(i)}finally{if(I)throw I.error}}if(Object.keys(this.randomIdObj).length!==0)try{for(n=Ne(t),s=n.next();!s.done;s=n.next())T=s.value,T.type?(T.anchors[0].connectTo=this.randomIdObj[T.anchors[0].connectTo],T.anchors[T.anchors.length-1].connectTo=this.randomIdObj[T.anchors[T.anchors.length-1].connectTo]):(a=T.connectedLines)===null||a===void 0||a.forEach(function(M){M.lineAnchor=H.randomIdObj[M.lineAnchor],M.lineId=H.randomIdObj[M.lineId]})}catch(M){z={error:M}}finally{try{s&&!s.done&&(U=n.return)&&U.call(n)}finally{if(z)throw z.error}}try{for(u=Ne(t),c=u.next();!c.done;c=u.next())T=c.value,T.id||(T.id=xe()),!T.calculative&&(T.calculative={canvas:this}),this.store.pens[T.id]=T}catch(M){_={error:M}}finally{try{c&&!c.done&&(k=u.return)&&k.call(u)}finally{if(_)throw _.error}}l=0,f=0,h=0;try{for(d=Ne(t),v=d.next();!v.done;v=d.next())T=v.value,T.parentId||(T.width*=this.store.data.scale,T.height*=this.store.data.scale,T.x=r.x-T.width/2+h,T.y=r.y-T.height/2+f,T.tags&&T.tags.includes("meta3d")&&(T.x=this.store.data.origin.x,T.y=this.store.data.origin.y),T.dataset&&(l%2===0?h=T.width-40*this.store.data.scale:h=0,l++,l%2===0&&(f+=T.height+10*this.store.data.scale)))}catch(M){S={error:M}}finally{try{v&&!v.done&&(P=d.return)&&P.call(d)}finally{if(S)throw S.error}}if(y=this.store.data.width||this.store.options.width,g=this.store.data.height||this.store.options.height,y&&g){m={x:this.store.data.origin.x,y:this.store.data.origin.y,width:y*this.store.data.scale,height:g*this.store.data.scale},w=!0;try{for(p=Ne(t),x=p.next();!x.done;x=p.next())if(T=x.value,!T.parentId&&(A=[{x:T.x,y:T.y},{x:T.x+T.width,y:T.y},{x:T.x,y:T.y+T.height},{x:T.x+T.width,y:T.y+T.height},{x:T.x+T.width/2,y:T.y+T.height/2}],T.x===m.x&&T.y===m.y&&T.width===m.width&&T.height===m.height||A.some(function(M){return Jr(M,m)}))){w=!1,this.store.options.strictScope&&(T.x<m.x&&(T.x=m.x),T.y<m.y&&(T.y=m.y),T.x+T.width>m.x+m.width&&(T.x=m.x+m.width-T.width),T.y+T.height>m.y+m.height&&(T.y=m.y+m.height-T.height));break}}catch(M){B={error:M}}finally{try{x&&!x.done&&(D=p.return)&&D.call(p)}finally{if(B)throw B.error}}if(w)return console.info("画笔在大屏范围外"),[2]}return[4,this.addPens(t,!0)];case 1:return L.sent(),this.active(t.filter(function(M){return!M.parentId})),this.render(),this.externalElements.focus(),[2]}})})},e.prototype.randomCombineId=function(t,r,a){var i,o,n=null;t.type?(t.anchors[0].connectTo||t.anchors[t.anchors.length-1].connectTo)&&(n=[t.id,t.anchors[0].id,t.anchors[t.anchors.length-1].id]):t.connectedLines&&t.connectedLines.length&&(n=[t.id]),ty(t),n&&(n.length===1?this.randomIdObj[n[0]]=t.id:(this.randomIdObj[n[0]]=t.id,this.randomIdObj[n[1]]=t.anchors[0].id,this.randomIdObj[n[2]]=t.anchors[t.anchors.length-1].id)),t.parentId=a;var s=[];if(Array.isArray(t.children)){var u=function(d){var v=r.find(function(y){return y.id===d});v&&s.push(c.randomCombineId(v,r,t.id).id)},c=this;try{for(var l=Ne(t.children),f=l.next();!f.done;f=l.next()){var h=f.value;u(h)}}catch(d){i={error:d}}finally{try{f&&!f.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}}return t.children=s,t},e.prototype.addPens=function(t,r){return or(this,void 0,void 0,function(){var a,i,o,n,s,u,c;return nr(this,function(l){switch(l.label){case 0:return a=this.beforeAddPens,a?[4,this.beforeAddPens(t)]:[3,2];case 1:a=l.sent()!=!0,l.label=2;case 2:if(a)return[2,[]];i=[];try{for(o=Ne(t),n=o.next();!n.done;n=o.next())s=n.value,!(this.beforeAddPen&&this.beforeAddPen(s)!=!0)&&(this.makePen(s),i.push(s))}catch(f){u={error:f}}finally{try{n&&!n.done&&(c=o.return)&&c.call(o)}finally{if(u)throw u.error}}return this.render(),this.store.emitter.emit("add",i),r&&this.pushHistory({type:ce.Add,pens:re(i,!0)}),[2,i]}})})},e.prototype.getInitPencilLine=function(t){var r=this.store,a=r.data,i=r.options,o=a.scale,n=a.lineWidth||1;return{id:t.penId,name:"line",x:t.x,y:t.y,type:Ae.Line,calculative:{canvas:this,pencil:!0,active:!0,worldAnchors:[t],lineWidth:n*o},fromArrow:a.fromArrow||i.fromArrow,toArrow:a.toArrow||i.toArrow,lineWidth:n}},e.prototype.createDrawingLine=function(t){this.inactive();var r=this.store,a=r.data,i=r.options,o=a.scale,n=a.lineWidth||1;return t.penId=xe(),{id:t.penId,name:"line",lineName:this.drawingLineName,x:t.x,y:t.y,type:Ae.Line,calculative:{canvas:this,active:!0,worldAnchors:[t],lineWidth:n*o},fromArrow:a.fromArrow||i.fromArrow,toArrow:a.toArrow||i.toArrow,lineWidth:n}},e.prototype.addRuleLine=function(t){var r=this.store.data,a=r.x,i=r.y,o=r.scale,n=r.origin,s=t.x+a,u=t.y+i,c=t.x,l=t.y,f=0,h=0,d=0,v=0;if(s<=u&&s<20)c=-a,f=this.width,d=1,t.ctrlKey||(l=Math.round((l-n.y)/(o*10))*(o*10)+n.y);else if(u<s&&u<20)l=-i,h=this.height,v=1,t.ctrlKey||(c=Math.round((c-n.x)/(o*10))*(o*10)+n.x);else return;this.addPen({isRuleLine:!0,type:Ae.Line,name:"line",lineName:"line",x:c,y:l,width:f,height:h,color:this.store.options.ruleLineColor,anchors:[{x:0,y:0},{x:d,y:v}]})},e.prototype.clearRuleLines=function(){this.delete(this.ruleLines)},Object.defineProperty(e.prototype,"ruleLines",{get:function(){return this.store.data.pens.filter(function(t){return t.isRuleLine})},enumerable:!1,configurable:!0}),e.prototype.alignPenToGrid=function(t){var r,a=this.store.options.autoAlignGrid&&this.store.data.grid;if(a&&!t.type){var i=this.store.data.gridSize||this.store.options.gridSize,o=this.store.data,n=o.origin,s=o.scale,u=t.x,c=t.y,l={x:u,y:c},f=this.getPenRect(t),h=parseInt((f.x/i).toFixed()),d=parseInt((f.y/i).toFixed()),v=h*i,y=d*i;l.x=n.x+v*s,l.y=n.y+y*s,Object.assign(t,l),(r=t.onMove)===null||r===void 0||r.call(t,t),this.updatePenRect(t),this.calcActiveRect(),this.getSizeCPs()}},e.prototype.movedActivePens=function(t){var r=this,a=this.getAllFollowersByPens(this.store.active,!1),i=re(a,!0),o=this.store.data.gridSize||this.store.options.gridSize,n=this.store.data,s=n.origin,u=n.scale,c=this.store.options.autoAlignGrid&&this.store.data.grid;if(a.forEach(function(w){var p,x=r.movingPens.findIndex(function(P){return P.id===w.id+Tt});if(!(x<0)){var T=r.movingPens[x],A=T.x,I=T.y,R={x:A,y:I};if(c&&!r.movingPens[x].type){var z=r.getPenRect(r.movingPens[x]),U=parseInt((z.x/o).toFixed()),_=parseInt((z.y/o).toFixed()),k=U*o,S=_*o;R.x=s.x+k*u,R.y=s.y+S*u}Object.assign(w,R),(p=w.onMove)===null||p===void 0||p.call(w,w),r.updatePenRect(w),r.updateLines(w),r.store.emitter.emit("updateLines",w),r.patchFlagsLines.forEach(function(P){P.type&&r.initLineRect(P)}),r.patchFlagsLines.clear(),w.calculative.x=w.x,w.calculative.y=w.y,w.calculative.initRect&&(w.calculative.initRect.x=w.calculative.x,w.calculative.initRect.y=w.calculative.y,w.calculative.initRect.ex=w.calculative.x+w.calculative.width,w.calculative.initRect.ey=w.calculative.y+w.calculative.height),fw(w)}}),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),!!this.dock){var l=this.dock,f=l.xDock,h=l.yDock,d;f&&(d=this.store.pens[f.penId]),!d&&h&&(d=this.store.pens[h.penId]);var v=re(this.store.active,!0);if(t&&this.store.active.length===1&&(d==null?void 0:d.type)===1&&(f!=null&&f.anchorId||h!=null&&h.anchorId)){var y=Ve(d),g=Te(d);if(f!=null&&f.anchorId){var m=this.store.pens[this.store.active[0].id+Tt].calculative.worldAnchors.find(function(w){return w.id===f.anchorId});m.x===y.x&&m.y===y.y?(i.push(re(d,!0)),ot(this.store.active[0],m,d,y),v.push(re(d,!0))):m.x===g.x&&m.y===g.y&&(i.push(re(d,!0)),ot(this.store.active[0],m,d,g),v.push(re(d,!0)))}else if(h!=null&&h.anchorId){var m=this.store.pens[this.store.active[0].id+Tt].calculative.worldAnchors.find(function(p){return p.id===h.anchorId});m.x===y.x&&m.y===y.y?(i.push(re(d,!0)),ot(this.store.active[0],m,d,y),v.push(re(d,!0))):m.x===g.x&&m.y===g.y&&(i.push(re(d,!0)),ot(this.store.active[0],m,d,g),v.push(re(d,!0)))}}c&&(this.calcActiveRect(),this.getSizeCPs()),this.pushHistory({type:ce.Update,pens:v,initPens:i}),this.store.emitter.emit("translatePens",v)}},e.prototype.copyMovedPens=function(){var t=this;this.copy(this.store.active.map(function(r,a){var i=t.movingPens[a],o=i.x,n=i.y;return t.updateLines(r),gt(gt({},r),{x:o,y:n})})),this.pasteOffset=!1,this.paste()},e.prototype.initImageCanvas=function(t){var r=this;t.some(function(a){return r.hasImage(a,!1)})&&this.canvasImage.init(),t.some(function(a){return r.hasImage(a,!0)})&&this.canvasImageBottom.init()},e.prototype.initTemplateCanvas=function(t){t.some(function(r){return r.canvasLayer===_e.CanvasTemplate})&&this.canvasTemplate.init()},e.prototype.hasImage=function(t,r){var a=this,i;return t.image&&t.name!=="gif"?r?t.canvasLayer===_e.CanvasImageBottom:t.canvasLayer===_e.CanvasImage:(i=t.children)===null||i===void 0?void 0:i.some(function(o){var n=a.store.pens[o];return n&&a.hasImage(n,r)})},e.prototype.inactive=function(t){this.store.active.length&&(this.initTemplateCanvas(this.store.active),this.store.active.forEach(function(r){r.calculative.active=void 0,r.calculative.activeAnchor=void 0,r.calculative.hover=!1,pa(r,!1)}),!t&&this.store.emitter.emit("inactive",this.store.active),this.store.active=[],this.activeRect=void 0,this.sizeCPs=void 0,this.store.activeAnchor=void 0,this.patchFlags=!0)},e.prototype.active=function(t,r){var a,i,o;if(r===void 0&&(r=!0),this.store.active){r&&this.store.emitter.emit("inactive",this.store.active);try{for(var n=Ne(this.store.active),s=n.next();!s.done;s=n.next()){var u=s.value;u.calculative.active=void 0,u.calculative.hover=!1,pa(u,!1)}}catch(c){a={error:c}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(a)throw a.error}}}this.store.active=[],t.forEach(function(c){c.calculative.active=!0,pa(c)}),(o=this.store.active).push.apply(o,gr([],vr(t),!1)),this.activeRect=void 0,this.calcActiveRect(),this.initTemplateCanvas(t),this.patchFlags=!0,r&&this.store.emitter.emit("active",this.store.active)},e.prototype.getSizeCPs=function(){var t=this;this.sizeCPs=zr(this.activeRect);var r=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}],a=this.activeRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.rotate,c=a.center;r.forEach(function(l){var f={x:l.x*n+i,y:l.y*s+o};De(f,u,c),t.sizeCPs.push(f)})},e.prototype.getSpecialAngle=function(t,r){var a=0;t.x-r.x!==0?(a=Math.atan((r.y-t.y)/(t.x-r.x))*180/Math.PI,t.x<r.x&&(a>0?a-=180:a+=180)):r.y>t.y?a=90:r.y<t.y&&(a=-90),a=Math.round(a/15)*15;var i=Math.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y));t.x=r.x+Math.cos(a/180*Math.PI)*i,t.y=r.y-Math.sin(a/180*Math.PI)*i},e.prototype.clearHover=function(){this.hoverType=ue.None,this.store.hover=null,this.store.hoverAnchor=null},e.prototype.inAnchor=function(t,r,a){var i;if(this.store.hoverAnchor=void 0,this.movingAnchor=void 0,!a||a.locked>ke.DisableEdit||!(r.type&&r.calculative.active)&&this.store.options.disableAnchor||r.disableAnchor)return ue.None;if((this.mouseDown||this.drawingLine)&&r.name==="line"&&a.connectTo){var o=this.findOne(a.connectTo);if(o!=null&&o.calculative&&!(o!=null&&o.calculative.active)){r=o;var n=o.calculative.worldAnchors.find(function(u){return u.id===a.anchorId});n&&(a=n)}}if(a.twoWay===ct.Disable&&r.name!=="line")return ue.None;if(r.name==="line"&&a.connectTo){var s=(i=this.findOne(a.connectTo))===null||i===void 0?void 0:i.anchors.find(function(u){return u.id===a.anchorId});if(s&&s.twoWay)return ue.None}if(this.drawingLine){if(a.twoWay===ct.Out)return ue.None}else if(!(this.mouseDown&&this.hoverType===ue.LineAnchor)){if(a.twoWay===ct.In)return ue.None}if(ya(t,a,this.pointSize,a.penId?this.store.pens[a.penId]:void 0))return a!==this.store.hoverAnchor&&(this.patchFlags=!0),this.store.hoverAnchor=a,this.store.hover=r,r.type?a.connectTo&&!r.calculative.active&&(this.store.hover=this.store.pens[a.connectTo],this.store.hover)?(this.store.hoverAnchor=this.store.hover.calculative.worldAnchors.find(function(u){return u.id===a.anchorId}),this.store.hoverAnchor?(this.externalElements.style.cursor="crosshair",ue.NodeAnchor):ue.None):(this.hotkeyType===Re.AddAnchor?this.externalElements.style.cursor="vertical-text":this.externalElements.style.cursor="pointer",ue.LineAnchor):(this.hotkeyType===Re.AddAnchor?this.externalElements.style.cursor="vertical-text":this.externalElements.style.cursor="crosshair",ue.NodeAnchor);if(!this.mouseDown&&r.type){if(r.calculative.active&&a.prev&&ya(t,a.prev,this.pointSize))return this.store.hoverAnchor=a,this.store.hover=r,this.externalElements.style.cursor="pointer",ue.LineAnchorPrev;if(r.calculative.active&&a.next&&ya(t,a.next,this.pointSize))return this.store.hoverAnchor=a,this.store.hover=r,this.externalElements.style.cursor="pointer",ue.LineAnchorNext}return ue.None},e.prototype.resize=function(t,r){var a,i;t=t||this.parentElement.clientWidth,r=r||this.parentElement.clientHeight,this.width=t,this.height=r,this.canvasRect={x:0,y:0,width:t,height:r},Ke(this.canvasRect),this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",this.externalElements.style.width=t+"px",this.externalElements.style.height=r+"px",this.canvasTemplate.resize(t,r),this.canvasImage.resize(t,r),this.canvasImageBottom.resize(t,r),this.magnifierCanvas.resize(t,r),t=t*this.store.dpiRatio|0,r=r*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=r,this.offscreen.width=t,this.offscreen.height=r,this.clientRect=this.externalElements.getBoundingClientRect(),this.canvas.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle";try{for(var o=Ne(this.store.data.pens),n=o.next();!n.done;n=o.next()){var s=n.value;s.isRuleLine&&(s.width?s.height||(s.width=this.width):s.height=this.height),Dr(s)}}catch(u){a={error:u}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(a)throw a.error}}this.render()},e.prototype.clearCanvas=function(){this.activeRect=void 0,this.sizeCPs=void 0,this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.offscreen.width,this.offscreen.height),this.store.data.template||this.canvasTemplate.clear(),this.canvasImage.clear(),this.canvasImageBottom.clear()},e.prototype.addPen=function(t,r,a){return or(this,void 0,void 0,function(){var i;return nr(this,function(o){switch(o.label){case 0:return i=this.beforeAddPens,i?[4,this.beforeAddPens([t])]:[3,2];case 1:i=o.sent()!=!0,o.label=2;case 2:return i?[2]:this.beforeAddPen&&this.beforeAddPen(t)!=!0?[2]:(this.makePen(t),this.active([t]),this.render(),a&&this.store.emitter.emit("add",[t]),r&&this.pushHistory({type:ce.Add,pens:[t]}),[2,t])}})})},e.prototype.pushHistory=function(t){var r=this,a;if(!this.store.data.locked){var i=this.store.data,o=i.origin,n=i.scale;t.origin=re(o),t.scale=n,t.type!==ce.Update&&t.pens&&t.pens.forEach(function(s){s.calculative&&(s.calculative.layer=r.store.data.pens.findIndex(function(u){return u.id===s.id}))}),this.store.historyIndex<this.store.histories.length-1&&this.store.histories.splice(this.store.historyIndex+1,this.store.histories.length-this.store.historyIndex-1),(a=t.pens)===null||a===void 0||a.forEach(function(s){var u,c,l;if(t.initPens)try{for(var f=Ne(t.initPens),h=f.next();!h.done;h=f.next()){var d=h.value;d.id===s.id&&(l=d)}}catch(y){u={error:y}}finally{try{h&&!h.done&&(c=f.return)&&c.call(f)}finally{if(u)throw u.error}}if(l)for(var v in s)l[v]==null&&(l[v]=void 0)}),this.store.histories.push(t),this.store.historyIndex=this.store.histories.length-1,this.store.emitter.emit("update",{previous:t.initPens,current:t.pens})}},e.prototype.undo=function(){if(!(this.store.data.locked||this.store.historyIndex==null||this.store.historyIndex<0)){var t=this.store.histories[this.store.historyIndex--];this.doEditAction(t,!0);for(var r=t.step;r>1;){var a=this.store.histories[this.store.historyIndex--];this.doEditAction(a,!0),r--}(t.type==ce.Add||t.type==ce.Delete||t.type==ce.Update)&&this.activeHistory()}},e.prototype.redo=function(){if(!(this.store.data.locked||this.store.historyIndex==null||this.store.historyIndex>this.store.histories.length-2)){var t=this.store.histories[++this.store.historyIndex];this.doEditAction(t,!1);for(var r=t.step;r>1;){var a=this.store.histories[++this.store.historyIndex];this.doEditAction(a,!1),r--}(t.type==ce.Add||t.type==ce.Delete||t.type==ce.Update)&&this.activeHistory()}},e.prototype.activeHistory=function(){var t=this,r=this.store.histories[this.store.historyIndex+1],a=[];if(r&&r.type===ce.Update){r.pens.forEach(function(o){a.push(t.store.pens[o.id])}),this.active(a);return}var i=this.store.histories[this.store.historyIndex];i&&(i.type===ce.Add||i.type===ce.Delete)&&(i.pens.forEach(function(o){a.push(t.store.pens[o.id])}),this.active(a))},e.prototype.doEditAction=function(t,r){var a=this;switch(this.inactive(),this.store.hoverAnchor=void 0,this.store.hover=void 0,t.type){case ce.Add:t.pens.forEach(function(u){var c,l=re(u,!0),f=a.store.data.pens.findIndex(function(h){return h.id===l.id});f>-1&&((c=l.onDestroy)===null||c===void 0||c.call(l,a.store.pens[l.id]),a.store.data.pens.splice(f,1),a.store.pens[l.id]=void 0,l.calculative||(l.calculative={}),l.calculative.canvas=a,a.store.animates.delete(l),a.store.animateMap.delete(l))}),t.type=ce.Delete;break;case ce.Update:var i=r?t.initPens:t.pens,o=r?t.pens:t.initPens;i.forEach(function(u){var c=re(u,!0),l=a.store.data.pens.findIndex(function(y){return y.id===c.id});if(l>-1){if(c.calculative=a.store.data.pens[l].calculative,a.store.data.pens[l].type&&a.store.data.pens[l].lastConnected)for(var f in a.store.data.pens[l].lastConnected)a.store.pens[f]&&(a.store.pens[f].connectedLines=a.store.data.pens[l].lastConnected[f]);a.store.data.pens[l]=c,a.store.pens[c.id]=c;for(var h in c)(typeof c[h]!="object"||h==="lineDash")&&(c.calculative[h]=c[h]);c.calculative.image=void 0;var d=a.getPenRect(c,t.origin,t.scale);if(a.setPenRect(c,d,!1),a.updateLines(c,!0),c.calculative.canvas.parent.isCombine(c)){var v=o.find(function(y){return y.id===c.id});Vb.forEach(function(y){var g;c[y]!==v[y]&&a.parent.setValue((g={id:c.id},g[y]=c[y],g),{render:!0,doEvent:!1})})}}});break;case ce.Delete:t.pens.reverse().forEach(function(u){var c,l,f=re(u,!0);if(f.calculative||(f.calculative={}),a.store.data.pens.splice(((c=f.calculative)===null||c===void 0?void 0:c.layer)!==-1?(l=f.calculative)===null||l===void 0?void 0:l.layer:a.store.data.pens.length,0,f),a.store.pens[f.id]=f,f.type&&f.lastConnected)for(var h in f.lastConnected)a.store.pens[h]&&(a.store.pens[h].connectedLines=f.lastConnected[h]);f.calculative.canvas=a}),t.pens.reverse().forEach(function(u){var c=a.store.pens[u.id],l=a.getPenRect(c,t.origin,t.scale);a.setPenRect(c,l,!1),c.calculative.image=void 0,c.calculative.backgroundImage=void 0,c.calculative.strokeImage=void 0,a.loadImage(c)}),t.type=ce.Add;break;case ce.Replace:{var n=r?t.initPens:t.pens,s=r?t.pens:t.initPens;s.forEach(function(u){var c,l=re(u,!0),f=a.store.data.pens.findIndex(function(d){return d.id===l.id});if(f>-1){(c=l.onDestroy)===null||c===void 0||c.call(l,a.store.data.pens.find(function(d){return d.id===l.id}));var h=a.store.data.pens.findIndex(function(d){return d.id===l.id});a.store.data.pens.splice(h,1),a.store.pens[l.id]=void 0,l.calculative||(l.calculative={}),l.calculative.canvas=a,a.store.animates.delete(l),a.store.animateMap.delete(l)}}),n.reverse().forEach(function(u){var c,l,f=re(u,!0);if(f.calculative||(f.calculative={}),a.store.data.pens.splice(((c=f.calculative)===null||c===void 0?void 0:c.layer)!==-1?(l=f.calculative)===null||l===void 0?void 0:l.layer:a.store.data.pens.length,0,f),a.store.pens[f.id]=f,f.type&&f.lastConnected)for(var h in f.lastConnected)a.store.pens[h]&&(a.store.pens[h].connectedLines=f.lastConnected[h]);f.calculative.canvas=a}),n.reverse().forEach(function(u){var c=a.store.data.pens.find(function(f){return f.id===u.id}),l=a.getPenRect(c,t.origin,t.scale);a.setPenRect(c,l,!1),c.calculative.image=void 0,c.calculative.backgroundImage=void 0,c.calculative.strokeImage=void 0,a.loadImage(c)}),t.type=ce.Replace;break}}if(t.type===ce.Update){var i=gr(gr([],vr(t.pens),!1),vr(t.initPens),!1);this.initImageCanvas(i),this.initTemplateCanvas(i)}else this.initImageCanvas(t.pens),this.initTemplateCanvas(t.pens);this.parent.onSizeUpdate(),this.render(),this.store.emitter.emit(r?"undo":"redo",t)},e.prototype.makePen=function(t){var r=this,a;if(t.id||(t.id=xe()),Math.abs(this.store.lastScale-this.store.data.scale)<1e-4&&this.store.sameTemplate&&this.store.templatePens[t.id]&&t.canvasLayer===_e.CanvasTemplate){t=this.store.templatePens[t.id],this.store.data.pens.push(t),this.updatePenRect(t);return}if(this.store.data.pens.push(t),this.store.pens[t.id]=t,t.path){!t.pathId&&(t.pathId=xe());var i=this.store.data.paths;!i[t.pathId]&&(i[t.pathId]=t.path),t.path=void 0}t.lineWidth==null&&(t.lineWidth=1);var o=this.store.options,n=o.fontSize,s=o.lineHeight;t.fontSize||(t.fontSize=n),t.lineHeight||(t.lineHeight=s),t.image&&t.name!=="gif"&&t.canvasLayer===void 0&&(t.isBottom?t.canvasLayer=_e.CanvasImageBottom:t.canvasLayer=_e.CanvasImage,delete t.isBottom),t.template&&(t.canvasLayer=_e.CanvasTemplate),t.calculative={canvas:this,singleton:(a=t.calculative)===null||a===void 0?void 0:a.singleton},(t.video||t.audio)&&(t.calculative.onended=function(l){r.nextAnimate(l)});for(var u in t)(typeof t[u]!="object"||u==="lineDash")&&(t.calculative[u]=t[u]);if(t.calculative.image=void 0,t.calculative.backgroundImage=void 0,t.calculative.strokeImage=void 0,!t.anchors&&he.anchors[t.name]&&(t.anchors||(t.anchors=[]),he.anchors[t.name](t)),!t.anchors){var c=re(this.store.options.defaultAnchors);c.forEach(function(l,f){l.id=""+f,l.penId=t.id}),t.anchors=c}this.updatePenRect(t),!t.anchors&&t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(function(l){return Do(l,t.calculative.worldRect)})),!t.rotate&&(t.rotate=0),this.loadImage(t),this.parent.penNetwork(t)},e.prototype.drawline=function(t){var r;this.drawingLine&&((r=this[this.drawingLineName])===null||r===void 0||r.call(this,this.store,this.drawingLine,t),this.store.path2dMap.set(this.drawingLine,he.path2dDraws.line(this.drawingLine)),this.patchFlags=!0)},e.prototype.initLineRect=function(t){var r;if(t){if(!(!((r=t.calculative.worldAnchors)===null||r===void 0)&&r.length)){this._del([t]);return}if(!(!isFinite(t.x)||!isFinite(t.x))&&!(t.x==null||t.y==null)){var a=Nu(t);t.parentId||Object.assign(t,a);var i=this.store.options,o=i.fontSize,n=i.lineHeight;t.fontSize||(t.fontSize=o,t.calculative.fontSize=t.fontSize*this.store.data.scale),t.lineHeight||(t.lineHeight=n,t.calculative.lineHeight=t.lineHeight),Ue(a),t.calculative.worldRect=a,nh(t,a),Cr(t),Dr(t),t.calculative&&(t.calculative.gradientAnimatePath=void 0),this.store.path2dMap.set(t,he.path2dDraws[t.name](t)),t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(function(s){return Do(s,t.calculative.worldRect)}))}}},e.prototype.drawingPencil=function(){Pw(this.store),this.pencil=!0,this.externalElements.style.cursor="crosshair"},e.prototype.stopPencil=function(){this.pencil=!1,this.pencilLine=void 0,this.externalElements.style.cursor="default"},e.prototype.finishDrawline=function(t){return or(this,void 0,void 0,function(){var r,a,i,o,n,s,u=this;return nr(this,function(c){switch(c.label){case 0:if(!this.drawingLine)return[2];if(r=Ve(this.drawingLine),a=Te(this.drawingLine),a.isTemp&&(this.drawingLine.calculative.worldAnchors.pop(),a=Te(this.drawingLine)),!t&&(!a.connectTo&&this.drawingLine.calculative.worldAnchors.pop(),Ve(this.drawingLine)===this.drawingLine.calculative.activeAnchor))return this.drawingLine=void 0,this.render(),[2];if(!r.connectTo||!a.connectTo){if(this.store.options.disableEmptyLine)return r.connectTo&&(this.store.pens[r.connectTo].connectedLines=this.store.pens[r.connectTo].connectedLines.filter(function(l){return l.lineId!==u.drawingLine.id})),this.drawingLine=void 0,this.render(),[2]}else if(this.store.options.disableRepeatLine&&(i=this.store.data.pens.find(function(l){if(l.type){var f=Ve(l),h=Te(l);return Hg(f,r)&&Hg(h,a)}}),i))return this.drawingLine=void 0,this.render(),[2];return o=Nu(this.drawingLine),Object.assign(this.drawingLine,o),this.drawingLine.calculative.worldRect=o,this.drawingLine.calculative.activeAnchor=Te(this.drawingLine),this.store.activeAnchor=this.drawingLine.calculative.activeAnchor,s=!this.beforeAddPens,s?[3,2]:[4,this.beforeAddPens([this.drawingLine])];case 1:s=c.sent(),c.label=2;case 2:return n=s&&(!this.beforeAddPen||this.beforeAddPen(this.drawingLine)),n&&(this.initLineRect(this.drawingLine),this.store.data.pens.push(this.drawingLine),this.store.pens[this.drawingLine.id]=this.drawingLine,this.store.emitter.emit("add",[this.drawingLine]),this.active([this.drawingLine]),this.pushHistory({type:ce.Add,pens:re([this.drawingLine],!0)})),this.store.path2dMap.set(this.drawingLine,he.path2dDraws[this.drawingLine.name](this.drawingLine)),this.drawingLine=void 0,this.drawingLineName=void 0,this.render(),[2]}})})},e.prototype.finishPencil=function(){return or(this,void 0,void 0,function(){var t,r,a,i;return nr(this,function(o){switch(o.label){case 0:return this.pencilLine?(t=ju(this.pencilLine.calculative.worldAnchors,10,0,this.pencilLine.calculative.worldAnchors.length-1),r=Ve(this.pencilLine),t.unshift({id:r.id,penId:r.penId,x:r.x,y:r.y}),r=Te(this.pencilLine),t.push({id:r.id,penId:r.penId,x:r.x,y:r.y}),this.pencilLine.calculative.worldAnchors=nj(t),this.pencilLine.calculative.worldAnchors.length>1?(this.pencilLine.calculative.pencil=!1,this.store.path2dMap.set(this.pencilLine,he.path2dDraws[this.pencilLine.name](this.pencilLine)),i=!this.beforeAddPens,i?[3,2]:[4,this.beforeAddPens([this.pencilLine])]):[3,3]):[3,4];case 1:i=o.sent(),o.label=2;case 2:a=i&&(!this.beforeAddPen||this.beforeAddPen(this.pencilLine)),a&&(this.initLineRect(this.pencilLine),this.store.data.pens.push(this.pencilLine),this.store.pens[this.pencilLine.id]=this.pencilLine,this.store.emitter.emit("add",[this.pencilLine]),this.active([this.pencilLine]),this.pushHistory({type:ce.Add,pens:re([this.pencilLine],!0)})),o.label=3;case 3:this.pencilLine=void 0,this.render(),o.label=4;case 4:return[2]}})})},e.prototype.firefoxLoadSvg=function(t){var r=this,a=new Image,i=new XMLHttpRequest;i.open("GET",t.image,!0),i.onload=function(){var o=new DOMParser,n=o.parseFromString(i.responseText,"text/xml"),s=n.getElementsByTagName("svg")[0],u=t.calculative.worldRect,c=u.width,l=u.height;s.setAttribute("width",c+"px"),s.setAttribute("height",l+"px");var f=btoa(unescape(encodeURIComponent(new XMLSerializer().serializeToString(s)))),h="data:image/svg+xml;base64,"+f;a.src=h,a.onload=function(){t.calculative.img=a,t.calculative.imgNaturalWidth=a.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=a.naturalHeight||t.iconHeight,he.htmlElements[t.image]=a,r.imageLoaded(),t.canvasLayer===_e.CanvasTemplate&&r.templateImageLoaded()}},i.send()},e.prototype.loadImage=function(t){var r=this;if(t.image!==t.calculative.image||!t.calculative.img){if(t.calculative.img=void 0,t.image)if(he.htmlElements[t.image]){var a=he.htmlElements[t.image];t.calculative.img=a,t.calculative.imgNaturalWidth=a.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=a.naturalHeight||t.iconHeight,this.imageLoaded(),t.canvasLayer===_e.CanvasTemplate&&this.templateImageLoaded()}else if(navigator.userAgent.includes("Firefox")&&t.image.endsWith(".svg"))this.firefoxLoadSvg(t);else{var i=new Image;i.crossOrigin=t.crossOrigin==="undefined"?void 0:t.crossOrigin||"anonymous",i.src=t.image,this.store.options.cdn&&!(t.image.startsWith("http")||t.image.startsWith("//")||t.image.startsWith("data:image"))&&(i.src=this.store.options.cdn+t.image),i.onload=function(){t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,he.htmlElements[t.image]=i,r.imageLoaded(),t.canvasLayer===_e.CanvasTemplate&&r.templateImageLoaded()}}t.calculative.image=t.image}if(t.backgroundImage!==t.calculative.backgroundImage){if(t.calculative.backgroundImg=void 0,t.backgroundImage)if(he.htmlElements[t.backgroundImage]){var a=he.htmlElements[t.backgroundImage];t.calculative.backgroundImg=a}else{var o=new Image;o.crossOrigin="anonymous",o.src=t.backgroundImage,this.store.options.cdn&&!(t.backgroundImage.startsWith("http")||t.backgroundImage.startsWith("//")||t.backgroundImage.startsWith("data:image"))&&(o.src=this.store.options.cdn+t.backgroundImage),o.onload=function(){t.calculative.backgroundImg=o,he.htmlElements[t.backgroundImage]=o,r.imageLoaded(),t.canvasLayer===_e.CanvasTemplate&&r.templateImageLoaded()}}t.calculative.backgroundImage=t.backgroundImage}if(t.strokeImage!==t.calculative.strokeImage){if(t.calculative.strokeImg=void 0,t.strokeImage)if(he.htmlElements[t.strokeImage]){var a=he.htmlElements[t.strokeImage];t.calculative.strokeImg=a}else{var n=new Image;n.crossOrigin="anonymous",n.src=t.strokeImage,this.store.options.cdn&&!(t.strokeImage.startsWith("http")||t.strokeImage.startsWith("//")||t.strokeImage.startsWith("data:image"))&&(n.src=this.store.options.cdn+t.strokeImage),n.onload=function(){t.calculative.strokeImg=n,he.htmlElements[t.strokeImage]=n,r.imageLoaded(),t.canvasLayer===_e.CanvasTemplate&&t.name!=="gif"&&r.templateImageLoaded()}}t.calculative.strokeImage=t.strokeImage}},e.prototype.imageLoaded=function(){var t=this;this.imageTimer&&clearTimeout(this.imageTimer),this.imageTimer=setTimeout(function(){t.canvasImage.init(),t.canvasImageBottom.init(),t.render()},100)},e.prototype.templateImageLoaded=function(){var t=this;this.templateImageTimer&&clearTimeout(this.templateImageTimer),this.templateImageTimer=setTimeout(function(){t.canvasTemplate.init(),t.render()},100)},e.prototype.setCalculativeByScale=function(t){var r=this.store.data.scale;t.calculative.lineWidth=t.lineWidth*r,t.calculative.fontSize=t.fontSize*r,t.fontSize<1&&(t.calculative.fontSize=t.fontSize*t.calculative.worldRect.height),t.calculative.iconSize=t.iconSize*r,t.calculative.iconWidth=t.iconWidth*r,t.calculative.iconHeight=t.iconHeight*r,t.calculative.iconLeft=t.iconLeft<1&&t.iconLeft>-1?t.iconLeft:t.iconLeft*r,t.calculative.iconTop=t.iconTop<1&&t.iconTop>-1?t.iconTop:t.iconTop*r,t.calculative.textWidth=t.textWidth<1&&t.textWidth>-1?t.textWidth:t.textWidth*r,t.calculative.textHeight=t.textHeight<1&&t.textHeight>-1?t.textHeight:t.textHeight*r,t.calculative.textLeft=t.textLeft<1&&t.textLeft>-1?t.textLeft*t.calculative.worldRect.width:t.textLeft*r,t.calculative.textTop=t.textTop<1&&t.textTop>-1?t.textTop*t.calculative.worldRect.height:t.textTop*r,t.type===Ae.Line&&t.borderWidth&&(t.calculative.borderWidth=t.borderWidth*r)},e.prototype.updatePenRect=function(t,r){var a=this,i=r===void 0?{}:r,o=i.worldRectIsReady,n=i.playingAnimate;o?os(t):uw(t),n||this.setCalculativeByScale(t),Oo(t),Kg(this.store.pens,t),Cr(t),Dr(t),he.path2dDraws[t.name]&&this.store.path2dMap.set(t,he.path2dDraws[t.name](t)),t.calculative.patchFlags=!0,this.patchFlags=!0,t.children&&t.children.forEach(function(s){var u=a.store.pens[s];u&&a.updatePenRect(u,{worldRectIsReady:!1})}),t.type&&this.initLineRect(t),t.calculative.gradientTimer&&clearTimeout(t.calculative.gradientTimer),t.calculative.gradientTimer=setTimeout(function(){t.calculative.lineGradient&&(t.calculative.lineGradient=null),t.calculative.gradient&&(t.calculative.gradient=null),t.calculative.radialGradient&&(t.calculative.radialGradient=null),a.patchFlags=!0,t.calculative.gradientTimer=void 0},50)},e.prototype.translate=function(t,r){if(t===void 0&&(t=0),r===void 0&&(r=0),this.store.data.x+=t*this.store.data.scale,this.store.data.y+=r*this.store.data.scale,this.store.data.x=Math.round(this.store.data.x),this.store.data.y=Math.round(this.store.data.y),this.store.options.padding){var a=Or(this.store.options.padding),i=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height;this.width<(i+a[1]+a[3])*this.store.data.scale&&(this.store.data.x+this.store.data.origin.x>a[3]*this.store.data.scale&&(this.store.data.x=a[3]*this.store.data.scale-this.store.data.origin.x),this.store.data.x+this.store.data.origin.x+i*this.store.data.scale<this.width-a[1]*this.store.data.scale&&(this.store.data.x=this.width-a[1]*this.store.data.scale-(this.store.data.origin.x+i*this.store.data.scale))),this.height<(o+a[0]+a[2])*this.store.data.scale&&(this.store.data.y+this.store.data.origin.y>a[0]*this.store.data.scale&&(this.store.data.y=a[0]*this.store.data.scale-this.store.data.origin.y),this.store.data.y+this.store.data.origin.y+o*this.store.data.scale<this.height-a[2]*this.store.data.scale&&(this.store.data.y=this.height-a[2]*this.store.data.scale-(this.store.data.origin.y+o*this.store.data.scale)))}this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render(),this.store.emitter.emit("translate",{x:this.store.data.x,y:this.store.data.y}),this.tooltip.translate(t,r),this.scroll&&this.scroll.isShow&&this.scroll.translate(t,r),this.onMovePens()},e.prototype.onMovePens=function(){var t,r,a,i=this.parent.map;i&&i.isShow&&i.setView();try{for(var o=Ne(this.store.data.pens),n=o.next();!n.done;n=o.next()){var s=n.value;Dr(s),(a=s.onMove)===null||a===void 0||a.call(s,s),s.isRuleLine&&(s.width?s.height||(s.x=-this.store.data.x):s.y=-this.store.data.y,this.updatePenRect(s))}}catch(u){t={error:u}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},e.prototype.scale=function(t,r){var a=this,i;r===void 0&&(r={x:0,y:0});var o=this.store.data.minScale||this.store.options.minScale,n=this.store.data.maxScale||this.store.options.maxScale;if(t>=o&&t<=n){this.calibrateMouse(r);var s=t/this.store.data.scale;this.store.data.scale=t,this.store.data.center=r,!((i=this.store.clipboard)===null||i===void 0)&&i.pos&&_s(this.store.clipboard.pos,s,r),_s(this.store.data.origin,s,r),this.store.data.pens.forEach(function(c){if(!c.parentId){if(ha(c,s,r),c.onScale&&c.onScale(c),c.isRuleLine){var l=1/s,f=c.calculative.worldRect.center;c.width&&c.height||ha(c,l,f)}a.updatePenRect(c,{worldRectIsReady:!0}),a.execPenResize(c)}}),this.onMovePens(),this.calcActiveRect(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init();var u=this.parent.map;u&&u.isShow&&u.setView(),this.render(),this.store.emitter.emit("scale",this.store.data.scale)}},e.prototype.templateScale=function(t,r){var a=this;r===void 0&&(r={x:0,y:0});var i=this.store.options,o=i.minScale,n=i.maxScale;if(t>=o&&t<=n){var s=t/this.store.data.scale;this.store.data.scale=t,this.store.data.center={x:0,y:0},this.store.data.origin={x:0,y:0},this.store.data.pens.forEach(function(u){if(!u.parentId){if(ha(u,s,r),u.onScale&&u.onScale(u),u.isRuleLine){var c=s>1?1:1/s/s,l=u.calculative.worldRect.center;u.width&&u.height||ha(u,c,l)}a.execPenResize(u)}}),this.calcActiveRect()}},e.prototype.rotatePens=function(t){var r,a,i=this;this.initPens||(this.initPens=re(this.getAllByPens(this.store.active))),this.activeRect.rotate=Xt(t,this.activeRect.center),this.activeRect.rotate%90<10&&(this.activeRect.rotate-=this.activeRect.rotate%90),this.activeRect.rotate%90>80&&(this.activeRect.rotate+=90-this.activeRect.rotate%90),this.store.active.length===1&&(this.lastRotate=this.store.active[0].rotate||0);var o=this.activeRect.rotate-this.lastRotate;try{for(var n=Ne(this.store.active),s=n.next();!s.done;s=n.next()){var u=s.value;if(u.parentId)return;this.rotatePen(u,o,this.activeRect),u.onRotate&&u.onRotate(u),this.updateLines(u)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}this.lastRotate=this.activeRect.rotate,this.getSizeCPs(),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),this.render(),this.store.emitter.emit("rotatePens",this.store.active),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){i.timer=void 0,i.pushHistory({type:ce.Update,pens:re(i.getAllByPens(i.store.active)),initPens:i.initPens}),i.initPens=void 0},200)},e.prototype.resizePens=function(t){var r=this;if(this.initPens||(this.initPens=re(this.store.active,!0)),!this.initActiveRect){this.initActiveRect=re(this.activeRect);return}var a={x:this.mouseDown.x,y:this.mouseDown.y},i={x:t.x,y:t.y},o=i.x-a.x,n=i.y-a.y,s=re(this.initActiveRect);if(ay(s,o,n,this.resizeIndex),Ue(s),!this.store.options.disableDock){this.clearDock();var u=this.customResizeDock||e7;this.dock=u(this.store,s,this.store.active,this.resizeIndex);var c=this.dock,l=c.xDock,f=c.yDock;if(l){o+=l.step;var h=this.store.pens[l.penId];h.calculative.isDock=!0}if(f){n+=f.step;var h=this.store.pens[f.penId];h.calculative.isDock=!0}}var d=this.activeRect.width,v=this.activeRect.height,y=o-this.lastOffsetX,g=n-this.lastOffsetY;if(this.lastOffsetX=o,this.lastOffsetY=n,t.ctrlKey||this.initPens.length===1&&this.initPens[0].ratio){var m=[1,3].includes(this.resizeIndex)?-1:1;g=m*(y*v)/d}if(this.activeRect.ratio=this.initPens[0].ratio,ay(this.activeRect,y,g,this.resizeIndex),this.store.options.strictScope){var w=this.store.data.width||this.store.options.width,p=this.store.data.height||this.store.options.height;if(w&&p){var x={x:this.store.data.origin.x,y:this.store.data.origin.y,width:w*this.store.data.scale,height:p*this.store.data.scale};this.activeRect.x<x.x&&(this.activeRect.width=this.activeRect.width-(x.x-this.activeRect.x),this.activeRect.x=x.x),this.activeRect.y<x.y&&(this.activeRect.height=this.activeRect.height-(x.y-this.activeRect.y),this.activeRect.y=x.y),this.activeRect.x+this.activeRect.width>x.x+x.width&&(this.activeRect.width=this.activeRect.width-(this.activeRect.x+this.activeRect.width-(x.x+x.width)),this.activeRect.x=x.x+x.width-this.activeRect.width,this.activeRect.ex=this.activeRect.x+this.activeRect.width),this.activeRect.y+this.activeRect.height>x.y+x.height&&(this.activeRect.height=this.activeRect.height-(this.activeRect.y+this.activeRect.height-(x.y+x.height)),this.activeRect.y=x.y+x.height-this.activeRect.height,this.activeRect.ey=this.activeRect.y+this.activeRect.height)}}Ue(this.activeRect);var T=this.activeRect.width/d,A=this.activeRect.height/v;this.store.active.forEach(function(I,R){I.calculative.worldRect.x=r.activeInitPos[R].x*r.activeRect.width+r.activeRect.x,I.calculative.worldRect.y=r.activeInitPos[R].y*r.activeRect.height+r.activeRect.y,I.calculative.worldRect.width*=T,I.calculative.iconWidth&&(I.calculative.iconWidth*=T),I.calculative.worldRect.height*=A,I.calculative.iconHeight&&(I.calculative.iconHeight*=A),Ke(I.calculative.worldRect),Ue(I.calculative.worldRect),r.updatePenRect(I,{worldRectIsReady:!0}),r.execPenResize(I),r.updateLines(I)}),this.getSizeCPs(),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),this.render(),this.store.emitter.emit("resizePens",this.store.active),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){r.timer=void 0,r.pushHistory({type:ce.Update,pens:re(r.store.active,!0),initPens:r.initPens}),r.initPens=void 0},200)},e.prototype.movePens=function(t){var r,a;if(!(!this.activeRect||this.store.data.locked)){if(!this.initActiveRect){this.initActiveRect=re(this.activeRect);return}if(!(!this.store.options.moveConnectedLine&&!this.canMoveLine&&this.store.active.length===1&&(!((r=this.store.active[0].anchors[0])===null||r===void 0)&&r.connectTo||!((a=this.store.active[0].anchors[this.store.active[0].anchors.length-1])===null||a===void 0)&&a.connectTo))&&(this.movingPens||(this.initMovingPens(),this.store.active.forEach(function(m){bo(m,!1)}),this.store.hover=void 0),!!this.mouseDown)){var i=t.x-this.mouseDown.x,o=t.y-this.mouseDown.y;t.shiftKey&&!t.ctrlKey&&(o=0),t.ctrlKey&&(i=0);var n=re(this.initActiveRect);$i(n,i,o);var s=!1;if(this.store.options.strictScope){var u=this.store.data.width||this.store.options.width,c=this.store.data.height||this.store.options.height;if(u&&c){var l={x:this.store.data.origin.x,y:this.store.data.origin.y,width:u*this.store.data.scale,height:c*this.store.data.scale};n.x<l.x&&(n.x=l.x,s=!0),n.y<l.y&&(n.y=l.y,s=!0),n.x+n.width>l.x+l.width&&(n.x=l.x+l.width-n.width,s=!0),n.y+n.height>l.y+l.height&&(n.y=l.y+l.height-n.height,s=!0)}}var f={x:n.x-this.activeRect.x,y:n.y-this.activeRect.y};if(!this.store.options.disableDock&&!s){this.clearDock();var h=this.customMoveDock||Z$;this.dock=h(this.store,n,this.movingPens,f);var d=this.dock,v=d.xDock,y=d.yDock,g=void 0;v&&(f.x+=v.step,g=this.store.pens[v.penId],g.calculative.isDock=!0),y&&(f.y+=y.step,g=this.store.pens[y.penId],g.calculative.isDock=!0)}this.translatePens(this.movingPens,f.x,f.y,!0)}}},e.prototype.changeIdsByMoving=function(t,r){t.id+=Tt,t.parentId&&r.find(function(a){return a.id===t.parentId})&&(t.parentId+=Tt),t.children&&(t.children=t.children.map(function(a){return a+Tt})),t.connectedLines&&(t.connectedLines=t.connectedLines.map(function(a){return r.find(function(i){return i.id===a.lineId})&&(a.lineId+=Tt),a})),t.type&&t.calculative.worldAnchors&&(t.calculative.worldAnchors=t.calculative.worldAnchors.map(function(a){return a.connectTo&&r.find(function(i){return i.id===a.connectTo})&&(a.connectTo+=Tt),a}))},e.prototype.initMovingPens=function(){var t=this,r,a;if(!this.store.options.moveConnectedLine&&!this.canMoveLine)for(var i=0;i<this.store.active.length;i++){var o=this.store.active[i];(!((r=o.anchors[0])===null||r===void 0)&&r.connectTo||!((a=o.anchors[o.anchors.length-1])===null||a===void 0)&&a.connectTo)&&(this.store.active.splice(i,1),o.calculative.active=void 0,--i)}this.movingPens=re(this.store.active,!0),this.movingPens=this.getAllFollowersByPens(this.movingPens);var n=this.getAllByPens(this.movingPens),s=re(n,!0);n.forEach(function(u){t.changeIdsByMoving(u,s),t.store.pens[u.id]=u,u.calculative.canvas=t;var c={globalAlpha:.5};u.lineWidth===0&&(c.lineWidth=1),(u.name.endsWith("Dom")||FN.includes(u.name)||t.store.options.domShapes.includes(u.name)||u.image)&&(c.name="rectangle",c.onDestroy=void 0),t.updateValue(u,c),u.calculative.image=void 0})},e.prototype.moveLineAnchor=function(t,r){var a=this,i,o,n,s,u;if(!(!this.activeRect||this.store.data.locked)){if(this.initPens||(this.initPens=re(this.store.active,!0)),!((i=this.store.activeAnchor)===null||i===void 0)&&i.connectTo){var c=this.store.pens[this.store.activeAnchor.connectTo];Ca(c,Li(c,this.store.activeAnchor.anchorId),this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor)}var l=(o=this.store.activeAnchor)===null||o===void 0?void 0:o.id,f=(s=(n=this.store.pens[this.store.activeAnchor.penId])===null||n===void 0?void 0:n.connectedLines)===null||s===void 0?void 0:s.filter(function(p){return p.anchor===l});f&&f.length>0&&f.forEach(function(p){var x=a.store.pens[p.lineId];Ca(a.store.pens[a.store.activeAnchor.penId],a.store.activeAnchor,x,Li(x,p.lineAnchor))});var h=this.store.active[0];Ve(h);var d=Te(h);if(h.lineName==="polyline"&&!r.shiftKey)oj(h,this.store.activeAnchor,t);else{var v=0,y=0;if(h.lineName==="line"){var g=h.calculative.worldAnchors.findIndex(function(p){return p.id===a.store.activeAnchor.id});g===0&&(g=2);var m=h.calculative.worldAnchors[g-1];if(r.ctrlKey&&r.shiftKey){var w=re(t);this.getSpecialAngle(w,m),v=w.x-this.store.activeAnchor.x,y=w.y-this.store.activeAnchor.y}else if(!r.ctrlKey&&r.shiftKey){var w={x:t.x,y:m.y};v=w.x-this.store.activeAnchor.x,y=w.y-this.store.activeAnchor.y}else if(r.ctrlKey&&!r.shiftKey){var w={x:m.x,y:t.y};v=w.x-this.store.activeAnchor.x,y=w.y-this.store.activeAnchor.y}else v=t.x-this.store.activeAnchor.x,y=t.y-this.store.activeAnchor.y}else!r.ctrlKey&&r.shiftKey?(v=t.x-this.store.activeAnchor.x,y=0):r.ctrlKey&&!r.shiftKey?(v=0,y=t.y-this.store.activeAnchor.y):(v=t.x-this.store.activeAnchor.x,y=t.y-this.store.activeAnchor.y);Io(this.store.activeAnchor,v,y),this.store.hover&&this.store.hoverAnchor&&this.store.hoverAnchor.penId!==this.store.activeAnchor.penId&&(this.store.hoverAnchor.type===Lr.Line?(v=t.x-this.store.activeAnchor.x,y=t.y-this.store.activeAnchor.y,Bn(this.store.activeAnchor,this.store.hoverAnchor,this.store)):(v=this.store.hoverAnchor.x-this.store.activeAnchor.x,y=this.store.hoverAnchor.y-this.store.activeAnchor.y),Io(this.store.activeAnchor,v,y),d.prev=void 0,h.lineName!=="polyline"&&((u=this[h.lineName])===null||u===void 0||u.call(this,this.store,h)))}this.patchFlagsLines.add(h),this.store.path2dMap.set(h,he.path2dDraws[h.name](h)),this.render(),this.store.active[0].calculative&&(this.store.active[0].calculative.gradientAnimatePath=void 0),this.store.emitter.emit("moveLineAnchor",{pen:this.store.active[0],anchor:this.store.activeAnchor}),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){a.timer=void 0,a.pushHistory({type:ce.Update,pens:re(a.store.active,!0),initPens:a.initPens}),a.initPens=void 0},500)}},e.prototype.moveLineAnchorPrev=function(t){var r=this;if(!(!this.activeRect||this.store.data.locked||!this.store.activeAnchor)){if(this.initPens||(this.initPens=re(this.store.active,!0)),this.store.activeAnchor.prev.x=t.x,this.store.activeAnchor.prev.y=t.y,this.store.activeAnchor.next){if(!this.store.activeAnchor.prevNextType)this.store.activeAnchor.next.x=t.x,this.store.activeAnchor.next.y=t.y,De(this.store.activeAnchor.next,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===Vi.Bilateral&&this.prevAnchor){var a=Xt(t,this.store.activeAnchor),i=Xt(this.prevAnchor,this.store.activeAnchor);this.store.activeAnchor.next.x=this.nextAnchor.x,this.store.activeAnchor.next.y=this.nextAnchor.y,De(this.store.activeAnchor.next,a-i,this.store.activeAnchor)}}var o=this.store.active[0];this.patchFlagsLines.add(o),this.store.path2dMap.set(o,he.path2dDraws[o.name](o)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){r.timer=void 0,r.pushHistory({type:ce.Update,pens:re(r.store.active,!0),initPens:r.initPens}),r.initPens=void 0},200)}},e.prototype.moveLineAnchorNext=function(t){var r=this;if(!(!this.activeRect||this.store.data.locked||!this.store.activeAnchor)){if(this.initPens||(this.initPens=re(this.store.active,!0)),this.store.activeAnchor.next.x=t.x,this.store.activeAnchor.next.y=t.y,this.store.activeAnchor.prev){if(!this.store.activeAnchor.prevNextType)this.store.activeAnchor.prev.x=t.x,this.store.activeAnchor.prev.y=t.y,De(this.store.activeAnchor.prev,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===Vi.Bilateral&&this.nextAnchor){var a=Xt(t,this.store.activeAnchor),i=Xt(this.nextAnchor,this.store.activeAnchor);this.store.activeAnchor.prev.x=this.prevAnchor.x,this.store.activeAnchor.prev.y=this.prevAnchor.y,De(this.store.activeAnchor.prev,a-i,this.store.activeAnchor)}}var o=this.store.active[0];this.patchFlagsLines.add(o),this.store.path2dMap.set(o,he.path2dDraws[o.name](o)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){r.timer=void 0,r.pushHistory({type:ce.Update,pens:re(r.store.active,!0),initPens:r.initPens}),r.initPens=void 0},200)}},e.prototype.setAnchor=function(t){var r;return or(this,void 0,void 0,function(){var a,i,o,n,s,s;return nr(this,function(u){switch(u.label){case 0:return a=[re(this.store.hover,!0)],i=this.store.hover,this.store.hoverAnchor?(o=this.beforeRemoveAnchor,o?[4,this.beforeRemoveAnchor(i,this.store.hoverAnchor)]:[3,2]):[3,3];case 1:o=!u.sent(),u.label=2;case 2:return o?[2]:(i.type===Ae.Line&&((r=i.calculative.worldAnchors)===null||r===void 0?void 0:r.length)<=2?this.delete([i]):(H$(i,this.store.hoverAnchor),i.type===Ae.Line&&this.initLineRect(i)),this.store.hoverAnchor=void 0,this.store.activeAnchor=void 0,this.externalElements.style.cursor="default",[3,6]);case 3:return i?(n=this.beforeAddAnchor,n?[4,this.beforeAddAnchor(i,this.store.pointAt)]:[3,5]):[3,6];case 4:n=!u.sent(),u.label=5;case 5:if(n)return[2];i.type===Ae.Line?(this.store.activeAnchor=z$(i,this.store.pointAt,this.store.pointAtIndex),this.initLineRect(i),s={x:t.x,y:t.y},this.getHover(s)):(s={id:xe(),x:t.x,y:t.y},this.store.activeAnchor=j$(i,s)),u.label=6;case 6:return this.hotkeyType=Re.None,this.render(),i&&this.pushHistory({type:ce.Update,pens:[re(i,!0)],initPens:a}),[2]}})})},e.prototype.checkDisconnect=function(t,r){var a=this;if(t.id.indexOf(Tt)>0){var i=t.id;t=this.store.pens[i.replace(Tt,"")]}t.anchors.forEach(function(o){if(o.connectTo&&!r.find(function(s){return s.id===o.connectTo||s.id===o.connectTo+Tt})){var n=a.store.pens[o.connectTo];if(!n||n.type)return;Ca(n,Li(n,o.anchorId),t,o)}})},e.prototype.translatePens=function(t,r,a,i){var o=this;if(t===void 0&&(t=this.store.active),!(!t||!t.length)){var n=t.some(function(c){if(c.locked>=ke.DisableMove)return!0});if(!n){var s=!i&&re(t,!0);this.activeRect&&$i(this.activeRect,r,a);var u=this.getAllByPens(t);t.forEach(function(c){var l,f;if(!(c.locked>=ke.DisableMove)){if(c.type===Ae.Line){if(!o.store.options.moveConnectedLine&&!o.canMoveLine||c.isRuleLine)return;Yg(c,r,a),o.checkDisconnect(c,u),o.store.path2dMap.set(c,he.path2dDraws[c.name](c)),i||(o.initLineRect(c),(l=c.connectedLines)===null||l===void 0||l.forEach(function(h){var d=o.store.pens[h.lineId];o.initLineRect(d)}))}else $i(c.calculative.worldRect,r,a),o.updatePenRect(c,{worldRectIsReady:!0}),c.calculative.x=c.x,c.calculative.y=c.y,c.calculative.initRect&&(c.calculative.initRect.x=c.calculative.x,c.calculative.initRect.y=c.calculative.y,c.calculative.initRect.ex=c.calculative.x+c.calculative.width,c.calculative.initRect.ey=c.calculative.y+c.calculative.height);o.updateLines(c),(f=c.onMove)===null||f===void 0||f.call(c,c)}}),this.activeRect&&this.getSizeCPs(),this.render(),this.tooltip.translate(r,a),i||(this.pushHistory({type:ce.Update,pens:re(t,!0),initPens:s}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.store.emitter.emit("translatePens",t)),this.store.emitter.emit("translatingPens",t)}}},e.prototype.templateTranslatePens=function(t,r,a){var i=this;if(t===void 0&&(t=this.store.active),!(!t||!t.length)){var o=this.getAllByPens(t);t.forEach(function(n){var s;if(n.type===Ae.Line){if(!i.store.options.moveConnectedLine&&!i.canMoveLine)return;Yg(n,r,a),i.checkDisconnect(n,o),i.store.path2dMap.set(n,he.path2dDraws[n.name](n))}else $i(n.calculative.worldRect,r,a),i.updatePenRect(n,{worldRectIsReady:!0}),n.calculative.x=n.x,n.calculative.y=n.y,n.calculative.initRect&&(n.calculative.initRect.x=n.calculative.x,n.calculative.initRect.y=n.calculative.y,n.calculative.initRect.ex=n.calculative.x+n.calculative.width,n.calculative.initRect.ey=n.calculative.y+n.calculative.height);(s=n.onMove)===null||s===void 0||s.call(n,n)})}},e.prototype.calcAutoAnchor=function(t,r,a,i){var o=Ve(t),n=Te(t),s=xa(a,r===o?n:o);s&&(r.x=s.x,r.y=s.y,r.prev=void 0,r.next=void 0,i?i.anchor=s.id:ot(a,s,t,r),this[t.lineName]&&this[t.lineName](this.store,t),this.store.path2dMap.set(t,he.path2dDraws.line(t)),this.initLineRect(t))},e.prototype.restoreNodeAnimate=function(t){var r,a;if(t.calculative.initRect){if(t.keepAnimateState)for(var i in t)t.calculative[i]!==void 0&&i!=="x"&&i!=="y"&&i!=="width"&&i!=="height"&&i!=="initRect"&&(typeof t[i]!="object"||i==="lineDash")&&(i==="fontSize"||i==="lineWidth"?t[i]=t.calculative[i]/t.calculative.canvas.store.data.scale:t[i]=t.calculative[i]);else{var o=t.calculative.initRect.rotate-t.calculative.rotate;for(var i in t)i!=="x"&&i!=="y"&&i!=="width"&&i!=="height"&&i!=="initRect"&&i!=="rotate"&&(typeof t[i]!="object"||i==="lineDash")&&(t.calculative[i]=t[i]);!((r=t.children)===null||r===void 0)&&r.length?o&&dw(t,o,t.calculative.worldRect):t.calculative.rotate=t.rotate;var n=re(this.store.animateMap.get(t));n&&(n.id=t.id,this.parent.setValue(n,{doEvent:!1,render:!0,history:!1})),t.calculative.worldRect=t.calculative.initRect}this.updatePenRect(t,{worldRectIsReady:!0}),this.updateLines(t),t.image&&t.name!=="gif"&&(this.canvasImage.init(),this.canvasImageBottom.init()),t.calculative.text!==t.text&&(t.calculative.text=t.text,wn(t)),!((a=this.store.active)===null||a===void 0)&&a.length&&this.calcActiveRect(),t.calculative.initRect=void 0}},e.prototype.updateLines=function(t,r){var a=this,i;(i=t.children)===null||i===void 0||i.forEach(function(o){var n=a.store.pens[o];n&&a.updateLines(n,r)}),t.connectedLines&&t.connectedLines.forEach(function(o,n){var s=a.store.pens[o.lineId];if(!(!s||s.calculative.active)){var u=Li(s,o.lineAnchor);if(u){if(!u.connectTo){t.connectedLines.splice(n,1);return}if(s.autoFrom){var c=Ve(s);c.id===u.id&&a.calcAutoAnchor(s,c,t,o)}if(s.autoTo){var l=Te(s);l.id===u.id&&a.calcAutoAnchor(s,l,t,o)}var f=Li(t,o.anchor);if(f){var h=t.rotate;t.flipX&&(h*=-1),t.flipY&&(h*=-1);var d=u.distance*a.store.data.scale*Math.cos((h+f.rotate)/180*Math.PI)||0,v=u.distance*a.store.data.scale*Math.sin((h+f.rotate)/180*Math.PI)||0;if(t.flipX&&(d=-d),t.flipY&&(v=-v),Io(u,f.x-u.x+d,f.y-u.y+v),a.store.options.autoPolyline&&!a.autoPolylineFlag&&s.autoPolyline!==!1&&s.lineName==="polyline"){var c=Ve(s),l=Te(s),y=!1;c.id===u.id?(c=u,y=!0):l.id===u.id&&(l=u,y=!0),y&&(s.calculative.worldAnchors=[c,l],s.calculative.activeAnchor=c,a.polyline(a.store,s,l),a.initLineRect(s))}a.store.path2dMap.set(s,he.path2dDraws[s.name](s)),a.patchFlagsLines.add(s),s.calculative.gradientSmooth&&(s.calculative.gradientAnimatePath=oh(s)),r&&$u(s)}}}})},e.prototype.calcActiveRect=function(){var t=this.store.active.filter(function(r){return(!r.locked||r.locked<ke.DisableMove)&&r.visible!=!1});if(t.length)t.length===1?(this.activeRect=re(t[0].calculative.worldRect),this.activeRect.rotate=t[0].calculative.rotate||0,Ue(this.activeRect)):(this.activeRect=kr(t),this.activeRect.rotate=0);else return;this.lastRotate=0,this.getSizeCPs()},e.prototype.rotatePen=function(t,r,a){var i=this;t.type?(t.calculative.worldAnchors.forEach(function(o){De(o,r,a.center)}),this.initLineRect(t),os(t)):(t.calculative.rotate?t.calculative.rotate+=r:t.calculative.rotate=r,De(t.calculative.worldRect.center,r,a.center),t.parentId?(t.calculative.worldRect.x=t.calculative.worldRect.center.x-t.calculative.worldRect.width/2,t.calculative.worldRect.y=t.calculative.worldRect.center.y-t.calculative.worldRect.height/2,t.x=(t.calculative.worldRect.x-a.x)/a.width,t.y=(t.calculative.worldRect.y-a.y)/a.height):(t.x=t.calculative.worldRect.center.x-t.width/2,t.y=t.calculative.worldRect.center.y-t.height/2),t.rotate=t.calculative.rotate,this.updatePenRect(t),t.children&&t.children.forEach(function(o){var n=i.store.pens[o];i.rotatePen(n,r,t.calculative.worldRect)}))},e.prototype.nextAnimate=function(t){var r=this;if(t){this.store.emitter.emit("animateEnd",t);var a;t.nextAnimate&&(a=this.store.data.pens.filter(function(i){return i.id===t.nextAnimate||i.tags&&i.tags.indexOf(t.nextAnimate)>-1})),a&&(a.forEach(function(i){var o,n,s,u,c;if(i.calculative.pause){var l=Date.now()-i.calculative.pause;i.calculative.pause=void 0,i.calculative.frameStart+=l,i.calculative.frameEnd+=l}else if(i.name==="video")i.calculative.media.currentTime=0,(o=i.calculative.media)===null||o===void 0||o.play(),(n=i.onStartVideo)===null||n===void 0||n.call(i,i);else if(i.type||!((s=i.frames)===null||s===void 0)&&s.length||i.animations&&i.animations.length){if(i.type){if(!((c=i.animations)===null||c===void 0)&&c.length){var d=re(i.animations[0]);delete d.name,d.currentAnimation=0,r.parent.setValue(gt({id:i.id},d),{doEvent:!1,history:!1})}}else{if(!i.frames&&i.animations&&i.animations.length){var f=(u=i.animations)===null||u===void 0?void 0:u.findIndex(function(v){return v.autoPlay}),h=f===-1?0:f,d=re(i.animations[h]);delete d.name,d.currentAnimation=h,!i.type&&d.frames&&(d.showDuration=r.parent.calcAnimateDuration(d)),r.parent.setValue(gt({id:i.id},d),{doEvent:!1,history:!1})}r.store.animateMap.set(i,r.getFrameProps(i))}r.store.animates.add(i)}}),this.animate())}},e.prototype.getFrameProps=function(t){var r={};return t.frames&&t.frames.forEach(function(a){for(var i in a)!["duration","x","y","width","height","rotate"].includes(i)&&!r[i]&&(r[i]=t[i])}),r},e.prototype.animate=function(){var t=this;this.animateRendering||requestAnimationFrame(function(){var r,a,i=Date.now();if(i-t.lastAnimateRender<t.store.options.animateInterval){t.store.animates.size>0&&t.animate();return}t.lastAnimateRender=i,t.animateRendering=!0;var o=[],n=!1,s=function(f){if(f.calculative.pause)return"continue";if(f.calculative.active&&!f.type&&!t.movingPens&&(n=!0),!f.type)W$(f,i)?f.calculative.patchFlags&&(Ue(f.calculative.worldRect),t.updatePenRect(f,{worldRectIsReady:!0,playingAnimate:!0})):(requestAnimationFrame(function(){t.restoreNodeAnimate(f)}),o.push(f),t.nextAnimate(f)),t.updateLines(f,!0);else if(!V$(f)){if(f.keepAnimateState){for(var h in f)f.calculative[h]!==void 0&&h!=="length"&&(typeof f[h]!="object"||h==="lineDash")&&(h==="lineWidth"?f[h]=f.calculative[h]/f.calculative.canvas.store.data.scale:f[h]=f.calculative[h]);os(f)}else for(var h in f)(typeof f[h]!="object"||h==="lineDash")&&(h==="lineWidth"?f.calculative[h]=f[h]*f.calculative.canvas.store.data.scale:f.calculative[h]=f[h]);o.push(f),t.nextAnimate(f)}t.patchFlags=!0};try{for(var u=Ne(t.store.animates),c=u.next();!c.done;c=u.next()){var l=c.value;s(l)}}catch(f){r={error:f}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}n&&t.calcActiveRect(),o.forEach(function(f){t.store.animates.delete(f)}),t.render(!1),t.animateRendering=!1,t.animate()})},Object.defineProperty(e.prototype,"clipboardName",{get:function(){return"meta2d-clipboard"},enumerable:!1,configurable:!0}),e.prototype.copy=function(t,r){return r===void 0&&(r=!0),or(this,void 0,void 0,function(){var a,i,o,n,s,u,c=this;return nr(this,function(l){switch(l.label){case 0:if(a=xe(),i=this.store.data,o=i.origin,n=i.scale,this.store.clipboard=void 0,localStorage.removeItem(this.clipboardName),sessionStorage.setItem("page",a),s=this.getAllByPens(re(t||this.store.active,!0)),s.forEach(function(f){f.copyIndex=c.store.data.pens.findIndex(function(h){return h.id===f.id}),f.pathId&&(f.path=c.store.data.paths[f.pathId])}),s.sort(function(f,h){return f.copyIndex-h.copyIndex}),s.forEach(function(f){delete f.copyIndex}),u={meta2d:!0,pens:s,origin:re(o),scale:n,page:a,initRect:re(this.activeRect),offset:10},!(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox")))return[3,5];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(JSON.stringify(u))];case 2:return l.sent(),[3,4];case 3:return l.sent(),localStorage.setItem(this.clipboardName,JSON.stringify(u)),[3,4];case 4:return[3,6];case 5:localStorage.setItem(this.clipboardName,JSON.stringify(u)),l.label=6;case 6:return r&&this.store.emitter.emit("copy",u.pens),[2]}})})},e.prototype.cut=function(t){this.copy(t,!1),this.delete(t),this.store.emitter.emit("cut",t)},e.prototype.paste=function(){var t;return or(this,void 0,void 0,function(){var r,a,i,o,n,s,u,c,l,f,h,d;return nr(this,function(v){switch(v.label){case 0:if(!(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox")))return[3,5];v.label=1;case 1:return v.trys.push([1,3,,4]),[4,(t=navigator.clipboard)===null||t===void 0?void 0:t.readText()];case 2:return r=v.sent(),[3,4];case 3:return v.sent(),r=localStorage.getItem(this.clipboardName),[3,4];case 4:return[3,6];case 5:r=localStorage.getItem(this.clipboardName),v.label=6;case 6:if(r){try{a=JSON.parse(r)}catch(y){return console.warn("剪切板数据不是json",y.message),[2]}if(!a||!a.meta2d)return[2]}else return[2];return i=this.beforeAddPens,i?[4,this.beforeAddPens(a.pens)]:[3,8];case 7:i=v.sent()!=!0,v.label=8;case 8:if(i)return[2];this.store.clipboard&&(o=this.store.clipboard.offset+10,n=this.store.clipboard.pos),this.store.clipboard=re(a),s=sessionStorage.getItem("page"),s!==a.page?(this.store.clipboard.pos={x:this.mousePos.x,y:this.mousePos.y},this.store.clipboard.offset=0):this.pasteOffset?(o&&(this.store.clipboard.offset=o),n&&(this.store.clipboard.pos=n)):(this.store.clipboard.offset=0,this.pasteOffset=!0),u=this.store.clipboard.pens.filter(function(y){return!y.parentId});try{for(c=Ne(u),l=c.next();!l.done;l=c.next())f=l.value,this.pastePen(f,void 0)}catch(y){h={error:y}}finally{try{l&&!l.done&&(d=c.return)&&d.call(c)}finally{if(h)throw h.error}}return sessionStorage.setItem("page",a.page),this.active(u),this.pushHistory({type:ce.Add,pens:this.store.clipboard.pens}),this.render(),this.store.emitter.emit("add",this.store.clipboard.pens),this.store.emitter.emit("paste",this.store.clipboard.pens),[2]}})})},e.prototype.getAllByPens=function(t){var r,a,i=[];try{for(var o=Ne(t),n=o.next();!n.done;n=o.next()){var s=n.value;i.push.apply(i,gr([],vr(re(br(s,this.store),!0)),!1))}}catch(u){r={error:u}}finally{try{n&&!n.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return i.concat(t)},e.prototype.getAllFollowersByPens=function(t,r){var a,i,o,n;r===void 0&&(r=!0);var s=t;try{for(var u=Ne(t),c=u.next();!c.done;c=u.next()){var l=c.value,f=ih(l,this.store);r&&(f=re(f,!0));var h=function(g){s.find(function(m){return m.id===g.id})||s.push(g)};try{for(var d=(o=void 0,Ne(f)),v=d.next();!v.done;v=d.next()){var y=v.value;h(y)}}catch(g){o={error:g}}finally{try{v&&!v.done&&(n=d.return)&&n.call(d)}finally{if(o)throw o.error}}}}catch(g){a={error:g}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(a)throw a.error}}return s},e.prototype.setFollowers=function(t){if(t===void 0&&(t=this.store.active),!!t)if(t.length<2)t[0].followers=[];else{var r=t.map(function(i){return i.id});r.pop();var a=t[t.length-1];a.followers?r.forEach(function(i){a.followers.includes(i)||a.followers.push(i)}):a.followers=r}},e.prototype.changeLineAnchors=function(t,r,a){if(Array.isArray(r.connectedLines))for(var i=function(s){var u=r.connectedLines[s].lineId,c=a.find(function(h){return h.id===u});if(c){var l=c.anchors[0],f=c.anchors[c.anchors.length-1];l.connectTo===t&&(l.connectTo=r.id),f.connectTo===t&&(f.connectTo=r.id)}else r.connectedLines.splice(s,1),s--;o=s},o,n=0;n<r.connectedLines.length;n++)i(n),n=o},e.prototype.changeNodeConnectedLine=function(t,r,a){var i,o,n,s=r.anchors[0],u=r.anchors[r.anchors.length-1],c=[s,u],l=function(v){var y=v.connectTo;if(y){var g=a.find(function(m){return m.id===y});g?(n=g.connectedLines)===null||n===void 0||n.forEach(function(m){m.lineId===t&&(m.lineId=r.id,m.lineAnchor=v.id)}):(v.connectTo=void 0,v.prev&&(v.prev.connectTo=void 0),v.next&&(v.next.connectTo=void 0))}};try{for(var f=Ne(c),h=f.next();!h.done;h=f.next()){var d=h.value;l(d)}}catch(v){i={error:v}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}},e.prototype.delete=function(t,r,a){return t===void 0&&(t=this.store.active),r===void 0&&(r=!1),a===void 0&&(a=!0),or(this,void 0,void 0,function(){var i,o;return nr(this,function(n){switch(n.label){case 0:return!t||!t.length?[2]:(i=this.beforeRemovePens,i?[4,this.beforeRemovePens(t)]:[3,2]);case 1:i=n.sent()!=!0,n.label=2;case 2:if(i)return[2];if(r||(t=t.filter(function(s){return!s.locked})),!t||!t.length)return[2];if(o=[],this._del(t,o,r),this.initImageCanvas(o),this.initTemplateCanvas(o),this.inactive(),this.clearHover(),this.render(),a){if(o.length===0)return[2];this.pushHistory({type:ce.Delete,pens:o})}return this.store.emitter.emit("delete",t),[2]}})})},e.prototype._del=function(t,r,a){var i=this;t&&t.forEach(function(o){if(o.type&&(o.lastConnected={}),o.parentId){var n=i.getLockedParent(o);if(n){console.warn("父节点锁定");return}else{var s=jt(o),u=s.children.indexOf(o.id);s.children.splice(u,1),r&&i.getDelPens(o,r),i.delForce(o)}}else{if(!a&&o.locked)return;r&&i.getDelPens(o,r),i.delForce(o)}})},e.prototype.getDelPens=function(t,r){var a=this;if(t){var i=this.store.data.pens.findIndex(function(n){return n.id===t.id});if(i>-1){var o=this.store.pens[t.id];o.calculative.active=void 0,r.push(o)}t.children&&t.children.forEach(function(n){a.getDelPens(a.store.pens[n],r)})}},e.prototype.getLockedParent=function(t){if(!t.parentId)return!1;var r=jt(t);if(r.locked)return r;this.getLockedParent(r)},e.prototype.delForce=function(t){var r=this,a;if(t){var i=this.store.data.pens.findIndex(function(o){return o.id===t.id});i>-1&&(this.delConnectedLines(this.store.data.pens[i]),this.store.data.pens.splice(i,1),this.store.pens[t.id]=void 0,delete this.store.pens[t.id]),this.store.animates.delete(t),this.store.animateMap.delete(t),t.children&&t.children.forEach(function(o){r.delForce(r.store.pens[o])}),(a=t.onDestroy)===null||a===void 0||a.call(t,t)}},e.prototype.delConnectedLines=function(t){var r=this,a;if(t.connectedLines)for(var i=function(s){var u=t.connectedLines[s],c=u.lineId,l=u.lineAnchor,f=o.store.pens[c];if(f){var h=f.anchors.find(function(d){return d.id===l});(h==null?void 0:h.connectTo)===t.id&&(h.connectTo=void 0,h.anchorId=void 0,h.prev&&(h.prev.connectTo=void 0),h.next&&(h.next.connectTo=void 0)),h=Li(f,l),h&&(h.connectTo=void 0,h.anchorId=void 0,h.prev&&(h.prev.connectTo=void 0),h.next&&(h.next.connectTo=void 0))}},o=this,n=0;n<t.connectedLines.length;n++)i(n);t.type&&((a=t.calculative.worldAnchors)===null||a===void 0||a.forEach(function(s,u){var c;if(s.connectTo){var l=r.store.pens[s.connectTo];l&&((c=l.calculative.worldAnchors)===null||c===void 0||c.forEach(function(f){Ca(l,f,t,s)}))}}))},e.prototype.convertSpecialCharacter=function(t){var r={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return t.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(a,i){return r[i]})},e.prototype.createInput=function(){var t=this;this.inputParent.classList.add("meta2d-input"),this.inputRight.classList.add("right"),this.inputDiv.classList.add("input-div"),this.inputParent.appendChild(this.inputDiv),this.inputParent.appendChild(this.inputRight),this.dropdown.onmouseleave=function(){t.store.hover=null},this.inputParent.appendChild(this.dropdown),this.externalElements.appendChild(this.inputParent),this.inputParent.onmousedown=this.stopPropagation,this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.contentEditable="false",this.inputRight.onmousedown=this.stopPropagation,this.dropdown.onmousedown=this.stopPropagation,this.inputRight.style.transform="rotate(135deg)";for(var r,a=0;a<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le.com"&&(r=document.styleSheets[a]);if(!r){var i=document.createElement("style");i.title="le5le.com",document.head.appendChild(i),r=i.sheet,r.insertRule(".meta2d-input{display:none;position:absolute;outline:none;align-items: center;}"),r.insertRule(".meta2d-input textarea{resize:none;border:none;outline:none;background:transparent;flex-grow:1;height:100%;left:0;top:0}"),r.insertRule(".meta2d-input .right{width:10px;height:10px;flex-shrink:0;border-top: 1px solid;border-right: 1px solid;margin-right: 5px;transition: all .3s cubic-bezier(.645,.045,.355,1);position:absolute;right:1px;}"),r.insertRule(".meta2d-input ul{position:absolute;top:100%;left:-5px;width:calc(100% + 10px);min-height:30px;border-radius: 2px;box-shadow: 0 2px 8px #00000026;list-style-type: none;background-color: #fff;padding: 4px 0;max-height: 105px;overflow-y: auto;}"),r.insertRule(".meta2d-input ul li{padding: 5px 12px;line-height: 22px;white-space: nowrap;cursor: pointer;}"),r.insertRule(".meta2d-input ul li:hover{background: #eeeeee;}"),r.insertRule(".input-div::-webkit-scrollbar {display:none}"),r.insertRule(".input-div{scrollbar-width: none;}"),r.insertRule(".meta2d-input .input-div{resize:none;border:none;outline:none;background:transparent;flex-grow:1;height:100%;width: 100%;left:0;top:0;display:flex;text-align: center;justify-content: center;flex-direction: column;}"),r.insertRule(".input-div div{}")}this.inputDiv.onfocus=function(o){if(navigator.userAgent.includes("Firefox")){if(!o.target.innerText){var n=t.inputDiv.offsetWidth/2,s=window.getComputedStyle(t.inputDiv,null);s.textAlign!=="center"&&(n=0),t.inputDiv.innerHTML='<br style="margin-left:'+n+'px;margin-top:4px;" />'}}else if(o.target.innerText)t.inputDiv.style.paddingTop="";else{var s=window.getComputedStyle(t.inputDiv,null);s.justifyContent==="center"&&(t.inputDiv.style.paddingTop=" "+(t.inputDiv.offsetHeight/2-parseFloat(s.lineHeight)/2)+"px")}},this.inputDiv.onblur=function(){setTimeout(function(){t.hideInput()},300)},this.inputDiv.oninput=function(o){var n=t.store.pens[t.inputDiv.dataset.penId];if(n&&n.inputType==="number"){var s=o.target.innerText,u=s.replace(/[^0-9]/g,"");s!==u&&(o.preventDefault(),o.target.innerText=u)}if(navigator.userAgent.includes("Firefox")){if(!o.target.innerText.trim()){var c=t.inputDiv.offsetWidth/2,l=window.getComputedStyle(t.inputDiv,null);l.textAlign!=="center"&&(c=0),t.inputDiv.innerHTML='<br style="margin-left:'+c+'px;margin-top:4px;" />'}}else if(o.target.innerText)t.inputDiv.style.paddingTop="";else{var l=window.getComputedStyle(t.inputDiv,null);l.justifyContent==="center"&&(t.inputDiv.style.paddingTop=" "+(t.inputDiv.offsetHeight/2-parseFloat(l.lineHeight)/2)+"px")}t.store.emitter.emit("input",n)},this.inputDiv.onclick=function(o){o.stopPropagation();var n=t.store.pens[t.inputDiv.dataset.penId];t.dropdown.style.display==="block"?(t.dropdown.style.display="none",t.inputRight.style.transform="rotate(135deg)"):n!=null&&n.dropdownList&&t.store.data.locked&&(t.dropdown.style.display="block",t.inputRight.style.transform="rotate(315deg)"),t.store.emitter.emit("clickInput",n)},this.inputDiv.onkeyup=function(o){t.setDropdownList(!0);var n=t.store.pens[t.inputDiv.dataset.penId];t.store.emitter.emit("input",{pen:n,text:o.key}),o.stopPropagation()},this.inputDiv.onkeydown=function(o){o.stopPropagation()},this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.onwheel=function(o){o.stopPropagation()},this.inputDiv.onpaste=function(o){o.preventDefault();var n="";o.clipboardData&&o.clipboardData.getData&&(n=o.clipboardData.getData("text/plain")),document.execCommand("insertHTML",!1,n)}},e.prototype.clearDropdownList=function(){if(this.dropdown.hasChildNodes())for(var t=0;t<this.dropdown.childNodes.length;t++)this.dropdown.childNodes[t].remove(),--t},e.prototype.dropdownAppendOption=function(t,r){var a=document.createElement("li");a.onwheel=this.stopPropagation,a.innerText=t,a.style.overflow="hidden",a.style.textOverflow="ellipsis",a.title=t,a.style.zoom=this.store.data.scale,a.onmousedown=this.stopPropagation,a.dataset.i=r+"",a.onclick=this.selectDropdown,this.dropdown.appendChild(a)},e.prototype.find=function(t){return this.store.data.pens.filter(function(r){return r.id==t||r.tags&&r.tags.indexOf(t)>-1})},e.prototype.findOne=function(t){return this.store.data.pens.find(function(r){return r.id==t||r.tags&&r.tags.indexOf(t)>-1})},e.prototype.changePenId=function(t,r){var a=this,i,o,n,s,u,c,l;if(t!==r){var f=this.store.pens[t];if(f&&!this.store.pens[r]){if(f.id=r,this.store.pens[r]=this.store.pens[t],(i=f.onChangeId)===null||i===void 0||i.call(f,f,t,r),delete this.store.pens[t],f.parentId){var h=this.store.pens[f.parentId],d=(o=h.children)===null||o===void 0?void 0:o.findIndex(function(v){return v===t});d!==-1&&((n=h.children)===null||n===void 0||n.splice(d,1,r))}(s=f.children)===null||s===void 0||s.forEach(function(v){var y=a.store.pens[v];y.parentId=r}),f.type===Ae.Line?this.changeNodeConnectedLine(t,f,this.store.data.pens):(this.changeLineAnchors(t,f,this.store.data.pens),(u=f.connectedLines)===null||u===void 0||u.forEach(function(v){var y=v.lineId,g=a.store.pens[y];Oo(g)})),(c=f.anchors)===null||c===void 0||c.forEach(function(v){return v.penId=r}),(l=f.calculative.worldAnchors)===null||l===void 0||l.forEach(function(v){return v.penId=r})}}},e.prototype.updateValue=function(t,r){var a,i,o,n,s,u,c=this.getPenRect(t),l=t.name;Object.assign(t,r);var f=l!==t.name;r.newId&&this.changePenId(t.id,r.newId);var h=!1,d=!1,v=!1,y=!1,g=!1,m=!1,w=void 0,p=!1;for(var x in r)x.indexOf(".")===-1?(x==="rotate"?w=t.calculative.rotate||0:x==="canvasLayer"||x==="isBottom"||x==="showChild"?m=!0:x==="image"&&(p=!0),(typeof t[x]!="object"||x==="lineDash")&&(t.calculative[x]=r[x]),LN.includes(x)&&(d=!0),["name","borderRadius","lineSmooth"].includes(x)&&(h=!0),ON.includes(x)&&(g=!0),DN.includes(x)&&(v=!0),BN.includes(x)&&(y=!0),t.image&&t.name!=="gif"&&["globalAlpha","flipY","flipX","x","y","width","height"].includes(x)&&(p=!0)):(delete t[x],Ru(t,x,r[x])),x.split(".")[0]==="anchors"&&Oo(t);if(this.setCalculativeByScale(t),f&&((a=t.onDestroy)===null||a===void 0||a.call(t,t),$N(t)),g){var T={x:(i=r.x)!==null&&i!==void 0?i:c.x,y:(o=r.y)!==null&&o!==void 0?o:c.y,width:(n=r.width)!==null&&n!==void 0?n:c.width,height:(s=r.height)!==null&&s!==void 0?s:c.height};this.setPenRect(t,T,!1),this.updateLines(t,!0),this.store.active&&this.store.active.length&&t.id===this.store.active[0].id&&this.calcActiveRect()}else v?this.updatePenRect(t):(d&&Cr(t),y&&Kg(this.store.pens,t),h&&he.path2dDraws[t.name]&&this.store.path2dMap.set(t,he.path2dDraws[t.name](t)));if(w!==void 0){var A=t.calculative.rotate;t.calculative.rotate=w,this.rotatePen(t,A-w,t.calculative.worldRect)}(r.image||r.backgroundImage||r.strokeImage)&&(t.calculative.image=void 0,t.calculative.backgroundImage=void 0,t.calculative.strokeImage=void 0,this.loadImage(t)),r.lineGradientColors&&(t.calculative.lineGradient=void 0,t.calculative.gradientColorStop=void 0),r.gradientColors&&(t.calculative.gradient=void 0,t.calculative.radialGradient=void 0),r.gradientRadius&&(t.calculative.gradient=void 0,t.calculative.radialGradient=void 0),r.animateLineWidth&&(t.calculative.gradientAnimatePath=void 0),r.gradientSmooth&&(t.calculative.gradientAnimatePath=void 0),m?(this.canvasImage.init(),this.canvasImageBottom.init()):p&&(t.canvasLayer===void 0&&(t.canvasLayer=_e.CanvasImageBottom,t.calculative.canvasLayer=_e.CanvasImageBottom),t.canvasLayer===_e.CanvasImageBottom?this.canvasImageBottom.init():t.canvasLayer===_e.CanvasImage&&this.canvasImage.init()),(r.canvasLayer!==void 0||t.canvasLayer===_e.CanvasTemplate)&&this.initTemplateCanvas([t]),r.zIndex!==void 0&&!((u=t.calculative.singleton)===null||u===void 0)&&u.div&&Ye(t,t.calculative.singleton.div)},e.prototype.execPenResize=function(t){var r=this,a,i;(a=t.onResize)===null||a===void 0||a.call(t,t),(i=t.children)===null||i===void 0||i.forEach(function(o){var n=r.store.pens[o];n&&r.execPenResize(n)})},e.prototype.setPenRect=function(t,r,a){if(a===void 0&&(a=!0),t.parentId)Object.assign(t,r);else{var i=this.store.data,o=i.origin,n=i.scale;t.x=o.x+r.x*n,t.y=o.y+r.y*n,t.width=r.width*n,t.height=r.height*n}this.updatePenRect(t),this.execPenResize(t),a&&this.render()},e.prototype.getPenRect=function(t,r,a){if(r===void 0&&(r=this.store.data.origin),a===void 0&&(a=this.store.data.scale),!!t)return t.parentId?{x:t.x,y:t.y,width:t.width,height:t.height}:{x:(t.x-r.x)/a,y:(t.y-r.y)/a,width:t.width/a,height:t.height/a}},e.prototype.toPng=function(t,r,a,i){var o,n;t===void 0&&(t=2),a===void 0&&(a=!1);var s=kr(this.store.data.pens),u=this.store.data.scale;if(!isFinite(s.width))throw new Error("can not to png, because width is not finite");var c=re(s),l=this.store.data,f=a&&!l.background&&this.store.bkImg,h=!1,d=!1;if(f){if(s.x+=l.x,s.y+=l.y,Ke(s),si(s,this.canvasRect,!0))Object.assign(s,this.canvasRect);else{var v=xn(gr(gr([],vr(zr(s)),!1),vr(zr(this.canvasRect)),!1));Object.assign(s,v)}h=s.x===0,d=s.y===0}var y=this.store.data.width||this.store.options.width,g=this.store.data.height||this.store.options.height,m=!1;y&&g&&!this.store.data.component&&(m=!0),m&&(s.x=this.store.data.origin.x,s.y=this.store.data.origin.y,s.width=y*this.store.data.scale,s.height=g*this.store.data.scale);var w=re(s),p=Or(t);s.x-=p[3]*u,s.y-=p[0]*u,s.width+=(p[3]+p[1])*u,s.height+=(p[0]+p[2])*u;var x=(i||1920)/s.width;s.width*=x,s.height*=x,Ke(s);var T=document.createElement("canvas");if(T.width=s.width,T.height=s.height,T.width>32767||T.height>32767||!navigator.userAgent.includes("Firefox")&&T.height*T.width>268435456||navigator.userAgent.includes("Firefox")&&T.height*T.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");var A=T.getContext("2d");A.textBaseline="middle",A.scale(x,x);var I=this.store.data.background||this.store.options.background;if(I&&(A.save(),A.fillStyle=I,m?A.fillRect(0,0,w.width+(p[1]+p[3])*u,w.height+(p[0]+p[2])*u):A.fillRect(0,0,c.width+(p[3]+p[1])*u,c.height+(p[0]+p[2])*u),A.restore()),f)if(m)A.drawImage(this.store.bkImg,p[3]*u||0,p[0]*u||0,w.width,w.height);else{var R=s.x<0?-s.x:0,z=s.y<0?-s.y:0;A.drawImage(this.store.bkImg,R,z,this.canvasRect.width,this.canvasRect.height)}f?m?A.translate(-c.x+p[3]*u||0,-c.y+p[0]*u||0):A.translate((h?l.x:-c.x)+p[3]*u||0,(d?l.y:-c.y)+p[0]*u||0):A.translate(-s.x,-s.y);try{for(var U=Ne(this.store.data.pens),_=U.next();!_.done;_=U.next()){var k=_.value;if(!(!Es(k,this.store)||k.visible==!1)){var S=k.calculative.active;k.calculative.active=!1,k.calculative.img?As(A,k):Mi(A,k,!0),k.calculative.active=S}}}catch(P){o={error:P}}finally{try{_&&!_.done&&(n=U.return)&&n.call(U)}finally{if(o)throw o.error}}if(r){T.toBlob(r);return}return T.toDataURL()},e.prototype.activeToPng=function(t,r){return t===void 0&&(t=2),this.pensToPng(this.store.active,t,r)},e.prototype.pensToPng=function(t,r,a){var i,o;if(t===void 0&&(t=this.store.active),r===void 0&&(r=2),t.length!==0){var n=this.getAllByPens(t),s=n.map(function(p){return p.id}),u=kr(n);if(!isFinite(u.width))throw new Error("can not to png, because width is not finite");var c=re(u),l=Or(r);u.x-=l[3],u.y-=l[0],u.width+=l[3]+l[1],u.height+=l[0]+l[2],Ke(u);var f=(a||u.width)/u.width;u.width*=f,u.height*=f;var h=document.createElement("canvas");if(h.width=u.width,h.height=u.height,h.width>32767||h.height>32767||!navigator.userAgent.includes("Firefox")&&h.height*h.width>268435456||navigator.userAgent.includes("Firefox")&&h.height*h.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");var d=h.getContext("2d");d.textBaseline="middle",d.scale(f,f);var v=this.store.data.background||this.store.options.background;v&&(d.save(),d.fillStyle=v,d.fillRect(0,0,c.width+(l[3]+l[1]),c.height+(l[0]+l[2])),d.restore()),d.translate(-c.x+l[3],-c.y+l[0]);try{for(var y=Ne(this.store.data.pens),g=y.next();!g.done;g=y.next()){var m=g.value;if(s.includes(m.id)){if(!Es(m,this.store)||m.visible==!1)continue;var w=m.calculative.active;m.calculative.active=!1,m.calculative.img?As(d,m):Mi(d,m),m.calculative.active=w}}}catch(p){i={error:p}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}finally{if(i)throw i.error}}return h.toDataURL()}},e.prototype.toggleAnchorMode=function(){var t;if(this.hotkeyType)this.hotkeyType===Re.AddAnchor&&(this.hotkeyType=Re.None,this.store.hoverAnchor?this.externalElements.style.cursor="vertical-text":this.store.hover&&(this.externalElements.style.cursor="move"));else{if(this.store.options.disableAnchor||!((t=this.store.hover)===null||t===void 0)&&t.disableAnchor)return;this.hotkeyType=Re.AddAnchor,this.store.hover&&(this.externalElements.style.cursor="pointer")}this.patchFlags=!0},e.prototype.addAnchorHand=function(){if(this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){var t=[re(this.store.active[0],!0)];this.store.activeAnchor.prev?this.store.activeAnchor.next||(this.store.activeAnchor.next=gt({},this.store.activeAnchor.prev),De(this.store.activeAnchor.next,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0):(this.store.activeAnchor.next||(this.store.activeAnchor.next={penId:this.store.activeAnchor.penId,x:this.store.activeAnchor.x+50,y:this.store.activeAnchor.y}),this.store.activeAnchor.prev=gt({},this.store.activeAnchor.next),De(this.store.activeAnchor.prev,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:ce.Update,pens:[re(this.store.active[0],!0)],initPens:t})}},e.prototype.removeAnchorHand=function(){if(this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){var t=[re(this.store.active[0],!0)];this.hoverType===ue.LineAnchorPrev?(this.store.activeAnchor.prev=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0):this.hoverType===ue.LineAnchorNext?(this.store.activeAnchor.next=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0):(this.store.activeAnchor.prev=void 0,this.store.activeAnchor.next=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:ce.Update,pens:[re(this.store.active[0])],initPens:t})}},e.prototype.toggleAnchorHand=function(){this.store.active.length===1&&this.store.active[0].type&&this.store.activeAnchor&&(this.store.activeAnchor.prevNextType||(this.store.activeAnchor.prevNextType=Vi.Mirror),this.store.activeAnchor.prevNextType=(this.store.activeAnchor.prevNextType+1)%3)},e.prototype.gotoView=function(t,r){var a=kr(this.store.data.pens);if(!isFinite(a.width))throw new Error("can not move view, because width is not finite");var i=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height;i&&o&&(a={x:this.store.data.origin.x,y:this.store.data.origin.y,width:i*this.store.data.scale,height:o*this.store.data.scale}),this.store.data.x=this.canvas.clientWidth/2-t*a.width-a.x,this.store.data.y=this.canvas.clientHeight/2-r*a.height-a.y,this.onMovePens(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render()},e.prototype.showMagnifier=function(){this.magnifierCanvas.magnifier=!0,this.externalElements.style.cursor="default",this.render()},e.prototype.hideMagnifier=function(){this.magnifierCanvas.magnifier=!1,this.externalElements.style.cursor="default",this.render()},e.prototype.showFit=function(){this.store.data.locked=0,this.canvasImage.fitFlag=!0,this.canvasImage.activeFit=void 0,this.canvasImage.currentFit=void 0,this.store.data.fits||(this.store.data.fits=[]),this.store.data.fits.forEach(function(t){return t.active=!1}),this.canvasImage.init(),this.canvasImage.render()},e.prototype.hideFit=function(){this.canvasImage.fitFlag=!1,this.canvasImage.activeFit=void 0,this.canvasImage.currentFit=void 0,this.canvasImage.init(),this.canvasImage.render()},e.prototype.makeFit=function(){var t=this;if(!(this.dragRect.width<100&&this.dragRect.height<100)){var r=this.store.data.pens.filter(function(l){if(l.parentId||l.isRuleLine)return!1;if(si(l.calculative.worldRect,t.dragRect,!0))return l.type===Ae.Line&&!t.store.options.dragAllIn?pc(l,t.dragRect):!0});if(r.length){var a=this.parent.getRect(r),i=this.store.data.scale,o=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height,s=(Math.floor(a.x)-this.store.data.origin.x)/i/o,u=(Math.floor(a.y)-this.store.data.origin.y)/i/n,c={x:s,y:u,width:(Math.ceil(a.width)+1)/i/o,height:(Math.ceil(a.height)+1)/i/n,children:r.map(function(l){return l.id}),id:xe(),active:!0};c.x<-.1&&(c.x=-.1),c.y<-.1&&(c.y=-.1),c.width>.5?(c.left=!0,c.right=!0,c.leftValue=(c.x-0)*i*o,c.rightValue=(1-(c.x+c.width))*i*o):c.x<.5?(c.left=!0,c.leftValue=(c.x-0)*i*o):(c.right=!0,c.rightValue=(1-(c.x+c.width))*i*o),c.leftValue<1&&(c.leftValue=0),c.rightValue<1&&(c.rightValue=0),c.height>.5?(c.top=!0,c.bottom=!0,c.topValue=(c.y-0)*i*n,c.bottomValue=(1-(c.y+c.height))*i*n):c.y<.5?(c.top=!0,c.topValue=(c.y-0)*i*n):(c.bottom=!0,c.bottomValue=(1-(c.y+c.height))*i*n),c.topValue<1&&(c.topValue=0),c.bottomValue<1&&(c.bottomValue=0),this.store.data.fits||(this.store.data.fits=[]),this.store.data.fits.forEach(function(l){l.active=!1}),this.store.data.fits.push(c),this.canvasImage.activeFit=c,this.store.emitter.emit("fit",c),this.canvasImage.init(),this.canvasImage.render()}}},e.prototype.updateFit=function(t){var r=this,a=this.store.data.scale,i=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height,n=(t.x-this.store.data.origin.x)/a/i,s=(t.y-this.store.data.origin.y)/a/o;if(this.canvasImage.currentFit){var u=this.canvasImage.activeFit;if(this.canvasImage.currentFit==="top"){s<-.1&&(s=-.1);var c=s-u.y;if(u.height-=c,u.height<.01){u.height=.01;return}u.y=s}if(this.canvasImage.currentFit==="bottom"&&(s>1.1&&(s=1.1),u.height=s-u.y,u.height<=.01&&(u.height=.01)),this.canvasImage.currentFit==="left"){n<-.1&&(n=-.1);var c=n-u.x;if(u.width-=c,u.width<.01){u.width=.01;return}u.x=n}this.canvasImage.currentFit==="right"&&(n>1.1&&(n=1.1),u.width=n-u.x,u.width<=.01&&(u.width=.01));var l={x:u.x*i*a+this.store.data.origin.x,y:u.y*o*a+this.store.data.origin.y,width:u.width*i*a,height:u.height*o*a};Ke(l);var f=this.store.data.pens.filter(function(h){if(h.parentId||h.isRuleLine)return!1;if(si(h.calculative.worldRect,l,!0))return h.type===Ae.Line&&!r.store.options.dragAllIn?pc(h,l):!0});u.left=void 0,u.leftValue=void 0,u.right=void 0,u.rightValue=void 0,u.top=void 0,u.topValue=void 0,u.bottom=void 0,u.bottomValue=void 0,u.width>.5?(u.left=!0,u.right=!0,u.leftValue=(u.x-0)*a*i,u.rightValue=(1-(u.x+u.width))*a*i):u.x<.5?(u.left=!0,u.leftValue=(u.x-0)*a*i):(u.right=!0,u.rightValue=(1-(u.x+u.width))*a*i),Math.abs(u.leftValue)<1&&(u.leftValue=0),Math.abs(u.rightValue)<1&&(u.rightValue=0),u.height>.5?(u.top=!0,u.bottom=!0,u.topValue=(u.y-0)*a*o,u.bottomValue=(1-(u.y+u.height))*a*o):u.y<.5?(u.top=!0,u.topValue=(u.y-0)*a*o):(u.bottom=!0,u.bottomValue=(1-(u.y+u.height))*a*o),Math.abs(u.topValue)<1&&(u.topValue=0),Math.abs(u.bottomValue)<1&&(u.bottomValue=0),u.children=f.map(function(h){return h.id}),this.store.emitter.emit("fit",u),this.mouseDown.x=t.x,this.mouseDown.y=t.y,this.canvasImage.init(),this.canvasImage.render()}},e.prototype.updateFitRect=function(t){t===void 0&&(t=this.canvasImage.activeFit);var r=this.store.data.width||this.store.options.width,a=this.store.data.height||this.store.options.height;t.left&&(t.leftValue?t.x=Math.abs(t.leftValue)<1?t.leftValue:t.leftValue/r:t.x=0),t.right&&(t.rightValue?t.width=1-(Math.abs(t.rightValue)<1?t.rightValue:t.rightValue/r)-t.x:t.width=1-t.x),t.top&&(t.topValue?t.y=Math.abs(t.topValue)<1?t.topValue:t.topValue/a:t.y=0),t.bottom&&(t.bottomValue?t.height=1-(Math.abs(t.bottomValue)<1?t.bottomValue:t.bottomValue/a)-t.y:t.height=1-t.y),this.canvasImage.init(),this.canvasImage.render()},e.prototype.deleteFit=function(t){if(t===void 0&&(t=this.canvasImage.activeFit),!!t){var r=this.store.data.fits.findIndex(function(a){return a.id===t.id});this.store.data.fits.splice(r,1),this.canvasImage.activeFit=void 0,this.canvasImage.init(),this.canvasImage.render(),this.store.emitter.emit("fit",void 0)}},e.prototype.calcuActiveFit=function(){var t,r=this.store.data.width||this.store.options.width,a=this.store.data.height||this.store.options.height,i=(this.mouseDown.x-this.store.data.origin.x)/this.store.data.scale/r,o=(this.mouseDown.y-this.store.data.origin.y)/this.store.data.scale/a,n=-1,s=-1;(t=this.store.data.fits)===null||t===void 0||t.forEach(function(u,c){u.ex=null,u.ey=null,Jr({x:i,y:o},u)&&(n=c),u.active&&(s=c)}),n!==-1&&n!==s?(this.canvasImage.activeFit=this.store.data.fits[n],this.store.data.fits[n].active=!0,s!==-1&&(this.store.data.fits[s].active=!1),this.store.emitter.emit("fit",this.store.data.fits[n])):n===-1&&s!==-1&&(this.store.data.fits[s].active=!1,this.store.emitter.emit("fit",void 0),this.canvasImage.activeFit=null),this.inactive(),this.canvasImage.init(),this.canvasImage.render()},e.prototype.toggleMagnifier=function(){this.magnifierCanvas.magnifier=!this.magnifierCanvas.magnifier,this.magnifierCanvas.magnifier&&(this.externalElements.style.cursor="default"),this.render()},e.prototype.destroy=function(){var t,r,a;switch(this.scroll&&this.scroll.destroy(),(t=this.tooltip)===null||t===void 0||t.destroy(),(r=this.dialog)===null||r===void 0||r.destroy(),(a=this.title)===null||a===void 0||a.destroy(),this.externalElements.removeEventListener("gesturestart",this.onGesturestart),this.externalElements.ondragover=function(i){return i.preventDefault()},this.externalElements.ondrop=void 0,this.externalElements.ontouchstart=void 0,this.externalElements.ontouchmove=void 0,this.externalElements.ontouchend=void 0,this.externalElements.onmousedown=void 0,this.externalElements.onmousemove=void 0,this.externalElements.onmouseup=void 0,this.externalElements.onmouseleave=void 0,this.externalElements.ondblclick=void 0,this.store.options.keydown){case Ni.Document:document.removeEventListener("keydown",this.onkeydown),document.removeEventListener("keyup",this.onkeyup);break;case Ni.Canvas:this.externalElements.removeEventListener("keydown",this.onkeydown),this.externalElements.removeEventListener("keyup",this.onkeyup);break}document.removeEventListener("copy",this.onCopy),document.removeEventListener("cut",this.onCut),document.removeEventListener("paste",this.onPaste),window&&window.removeEventListener("resize",this.onResize),window&&window.removeEventListener("scroll",this.onScroll)},e}();function Sj(e,t){var r=t||new Path2D;e.onDestroy||(e.onDestroy=Ej,e.onMove=wy,e.onRotate=wy,e.onMouseEnter=Pj,e.onMouseLeave=Rj,e.onMouseMove=Mj,e.onMouseUp=Ij,e.onInput=Aj);var a=e.calculative.borderRadius||0,i=a,o=e.calculative.worldRect,n=o.x,s=o.y,u=o.width,c=o.height,l=o.ex,f=o.ey,h=e.calculative.worldTextRect.x;a<1&&(a=u*a,i=c*i);var d=a<i?a:i;u<2*d&&(d=u/2),c<2*d&&(d=c/2);var v=Tj(e.text,e.calculative.fontSize);if(r.moveTo(n+d,s),r.lineTo(h-5,s),r.moveTo(h+v+5,s),r.lineTo(h+v+5,s),r.arcTo(l,s,l,f,d),r.arcTo(l,f,n,f,d),r.arcTo(n,f,n,s,d),r.arcTo(n,s,l,s,d),r instanceof Path2D)return r}function Tj(e,t){var r=e.match(/[^\x00-\xff]/g)||"",a=r.length*t,i=e.match(/\s/g)||"",o=i.length*t*.3,n=(e.length-r.length-i.length)*t*.6,s=a+o+n;return s}function Aj(e,t){e.text=t,e.calculative.text=e.text,e.calculative.canvas.updatePenRect(e)}function Ej(e){}function wy(e){}function Pj(e){}function Rj(e){var t=e.calculative.canvas.store.active;t&&t.length&&t.forEach(function(r){if(e.followers){var a=e.followers.findIndex(function(n){return n===r.id});if(a!==-1){var i=e.calculative.canvas.store.pens[r.id+Tt];if(i&&i.calculative){var o=si(i.calculative.worldRect,e.calculative.worldRect,!0);o||e.followers.splice(a,1)}}}})}function Ij(e){var t=e.calculative.canvas.store.active;t&&t.length&&t.forEach(function(r){var a=e.calculative.canvas.store.pens[r.id+Tt];if(a&&a.calculative){var i=re(e.calculative.worldRect);i.x-=1,i.y-=1,i.width+=2,i.height+=2,si(a.calculative.worldRect,i,!0)&&(e.followers||(e.followers=[]),e.followers.includes(r.id)||e.followers.push(r.id))}})}function Mj(e,t){}var Ze={};function Lj(e){e.onDestroy||(e.onDestroy=Oj,e.onMove=xy,e.onResize=Dj,e.onRotate=xy,e.onValue=Bj,e.onChangeId=Fj);var t=new Path2D;if(e.image){if(!Ze[e.id]){var r=new Image;r.crossOrigin="anonymous",r.src=e.image,e.calculative.canvas.parent.store.options.cdn&&!(e.image.startsWith("http")||e.image.startsWith("//")||e.image.startsWith("data:image"))&&(r.src=e.calculative.canvas.parent.store.options.cdn+e.image),Ze[e.id]=r,r.onload=function(){var a;Ze[e.id]===r&&(e.calculative.img=r,e.calculative.imgNaturalWidth=r.naturalWidth||e.iconWidth,e.calculative.imgNaturalHeight=r.naturalHeight||e.iconHeight,(a=e.calculative.canvas.externalElements)===null||a===void 0||a.parentElement.appendChild(r),Jo(e,r))}}return e.calculative.patchFlags&&Ze[e.id]&&Jo(e,Ze[e.id]),t}}function Oj(e){Ze[e.id]&&(Ze[e.id].remove(),Ze[e.id]=void 0)}function xy(e){Ze[e.id]&&Jo(e,Ze[e.id])}function Dj(e){Ze[e.id]&&Jo(e,Ze[e.id])}function Bj(e){Ze[e.id]&&(Jo(e,Ze[e.id]),Ze[e.id].getAttribute("src")!==e.image&&(Ze[e.id].src=e.image))}function Fj(e,t,r){Ze[t]&&(Ze[r]=Ze[t],delete Ze[t])}function Jo(e,t){t.style.objectFit=e.imageRatio?"contain":"fill",Ye(e,t)}var Nj=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},$j=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function jj(e,t){return e.onResize||(e.onResize=Rw,e.onValue=zj),Ha(e,t)}function Rw(e){var t,r=e.anchors.filter(function(a){return a.flag!==1});Iw(e),e.anchors=(t=e.anchors).concat.apply(t,$j([],Nj(r),!1))}function zj(e){Rw(e),Oo(e)}function Iw(e){for(var t=[],r=e.x,a=e.y,i=e.width,o=e.height,n=Hj(e),s=5,u=0;u<s;u++)if(u!==2){var c=r+i*(u+1)/(s+1),l=a;c<r+n?l=Hn(r+n,l+n,c,n,-1):c>r+i-n&&(l=Hn(r+i-n,l+n,c,n,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(c-r)/i,y:(l-a)/o})}for(var f=3,u=0;u<f;u++){var l=a+o*(u+1)/(f+1),c=r+i;l<a+n?c=zn(c-n,a+n,l,n):l>a+o-n&&(c=zn(c-n,a+o-n,l,n)),t.push({id:String(t.length),flag:1,penId:e.id,x:(c-r)/i,y:(l-a)/o})}for(var h=5,u=0;u<h;u++)if(u!==2){var c=r+i*(u+1)/(h+1),l=a+o;c<r+n?l=Hn(r+n,l-n,c,n):c>r+i-n&&(l=Hn(r+i-n,l-n,c,n)),t.push({id:String(t.length),flag:1,penId:e.id,x:(c-r)/i,y:(l-a)/o})}for(var d=3,u=0;u<d;u++){var l=a+o*(u+1)/(d+1),c=r;l<a+n?c=zn(c+n,a+n,l,n,-1):l>a+o-n&&(c=zn(c+n,a+o-n,l,n,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(c-r)/i,y:(l-a)/o})}e.anchors=t}function Hj(e){var t=e.calculative.borderRadius||0,r=e.calculative.borderRadius||0,a=e.width,i=e.height;e.calculative.borderRadius<1&&(t=a*e.calculative.borderRadius,r=i*e.calculative.borderRadius);var o=t<r?t:r;return a<2*o&&(o=a/2),i<2*o&&(o=i/2),o}function zn(e,t,r,a,i){return i===void 0&&(i=1),i*Math.sqrt(Math.pow(a,2)-Math.pow(r-t,2))+e}function Hn(e,t,r,a,i){return i===void 0&&(i=1),i*Math.sqrt(Math.pow(a,2)-Math.pow(r-e,2))+t}function Wj(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.moveTo(i,o+s),r.lineTo(i+n,o+s),r.closePath(),r instanceof Path2D)return r}function Uj(e){var t=[{x:0,y:1},{x:1,y:1}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:a+"",x:i,y:o,penId:e.id}})}function Vj(){return{rectangle:Ha,square:IN,circle:MN,svgPath:T7,diamond:A7,triangle:E7,pentagon:R7,pentagram:O7,hexagon:B7,leftArrow:F7,rightArrow:N7,twowayArrow:$7,message:j7,cloud:z7,file:H7,people:U7,line:Y7,iframe:uj,video:gj,gif:Lj,mindNode:jj,mindLine:Wj,mindNode2:Ha,panel:Sj}}function qj(){return{triangle:P7,pentagon:I7,pentagram:mw,mindNode:Iw,mindLine:Uj}}var Je;(function(e){e[e.Link=0]="Link",e[e.SetProps=1]="SetProps",e[e.StartAnimate=2]="StartAnimate",e[e.PauseAnimate=3]="PauseAnimate",e[e.StopAnimate=4]="StopAnimate",e[e.JS=5]="JS",e[e.GlobalFn=6]="GlobalFn",e[e.Emit=7]="Emit",e[e.StartVideo=8]="StartVideo",e[e.PauseVideo=9]="PauseVideo",e[e.StopVideo=10]="StopVideo",e[e.SendPropData=11]="SendPropData",e[e.SendVarData=12]="SendVarData",e[e.Navigator=13]="Navigator",e[e.Dialog=14]="Dialog",e[e.SendData=15]="SendData",e[e.PostMessage=16]="PostMessage",e[e.PostMessageToParent=17]="PostMessageToParent"})(Je||(Je={}));var Kj=function(){function e(t){var r=this,a;this.parent=t,this.boxWidth=320,this.boxHeight=180,this.ratio=this.boxWidth/this.boxHeight,this.padding=5,this.onMouseDown=function(s){s.preventDefault(),s.stopPropagation(),r.isDown=!0},this.onMouseMove=function(s){if(s.preventDefault(),s.stopPropagation(),r.isDown)try{r.parent.gotoView(s.offsetX/r.box.clientWidth,s.offsetY/r.box.clientHeight)}catch(u){console.warn(u.message),r.isDown=!1}},this.onMouseUp=function(s){s.preventDefault(),s.stopPropagation();try{r.parent.gotoView(s.offsetX/r.box.clientWidth,s.offsetY/r.box.clientHeight)}catch(u){console.warn(u.message)}finally{r.isDown=!1}},this.onWheel=function(s){var u=.015;if(r.parent.store.options.scaleOff)u=r.parent.store.options.scaleOff,s.deltaY>0&&(u=-r.parent.store.options.scaleOff);else{var c=/mac os /i.test(navigator.userAgent);if(c)s.ctrlKey?s.deltaY>0&&(u*=-1):u*=s.wheelDeltaY/240;else{var l=.2;s.deltaY.toString().indexOf(".")!==-1&&(l=.01),s.deltaY>0?u=-l:u=l}}var f=s.offsetX,h=s.offsetY,d=r.parent.store.data.width||r.parent.store.options.width,v=r.parent.store.data.height||r.parent.store.options.height;if(d&&v)f=f/r.boxWidth*d*r.parent.store.data.scale+r.parent.store.data.origin.x+r.parent.store.data.x,h=h/r.boxHeight*v*r.parent.store.data.scale+r.parent.store.data.origin.y+r.parent.store.data.y;else{var y=r.parent.parent.getRect();f=f/r.boxWidth*y.width+y.x+r.parent.store.data.x,h=h/r.boxHeight*y.height+y.y+r.parent.store.data.y}r.parent.scale(r.parent.store.data.scale+u,{x:f,y:h})},this.box=document.createElement("div"),this.img=new Image,this.view=document.createElement("div"),this.box.appendChild(this.img),this.box.appendChild(this.view),(a=this.parent.externalElements)===null||a===void 0||a.parentElement.appendChild(this.box),this.box.className="meta2d-map",this.box.onmousedown=this.onMouseDown,this.box.onmousemove=this.onMouseMove,this.box.onmouseup=this.onMouseUp,this.box.onwheel=this.onWheel;for(var i,o=0;o<document.styleSheets.length;o++)document.styleSheets[o].title==="le5le/map"&&(i=document.styleSheets[o]);if(!i){var n=document.createElement("style");n.type="text/css",n.title="le5le.com/map",document.head.appendChild(n),n=document.createElement("style"),n.type="text/css",document.head.appendChild(n),i=n.sheet,i.insertRule(".meta2d-map{display:flex;width:"+(this.boxWidth+2*this.padding)+"px;height:"+(this.boxHeight+2*this.padding)+"px;padding:"+this.padding+"px;background:#f4f4f4;border:1px solid #ffffff;box-shadow: 0px 0px 14px 0px rgba(0,10,38,0.30);border-radius:8px;position:absolute;z-index:9999;right:0;bottom:0;justify-content:center;align-items:center;cursor:default;user-select:none;overflow: hidden;}"),i.insertRule(".meta2d-map img{max-width:100%;max-height:100%;pointer-events: none;}"),i.insertRule(".meta2d-map div{pointer-events: none;border:1px solid #1890ff;position:absolute}")}}return e.prototype.show=function(){this.box.style.display="flex";var t=this.parent.store.data;t.pens.length?(this.img.style.display="block",this.img.src=this.parent.toPng(),this.setView()):this.img.style.display="none",this.isShow=!0},e.prototype.hide=function(){this.box.style.display="none",this.isShow=!1},e.prototype.setView=function(){var t=this.parent.store.data;if(t.pens.length){var r=kr(t.pens),a=this.parent.store.data.width||this.parent.store.options.width,i=this.parent.store.data.height||this.parent.store.options.height;a&&i&&(r={x:this.parent.store.data.origin.x,y:this.parent.store.data.origin.y,width:a*this.parent.store.data.scale,height:i*this.parent.store.data.scale}),$i(r,t.x,t.y);var o=r.width/r.height;if(o>this.ratio){var n=r.width/this.ratio;r.y-=(n-r.height)/2,r.height=n,Ke(r)}else{var s=r.height*this.ratio;r.x-=(s-r.width)/2,r.width=s,Ke(r)}var u=this.parent.canvasRect,c=0,l=0;if(r.x<0)c=-r.x/r.width;else if(r.x+r.width>u.width){var f=0;u.width>r.width&&(f=u.width-r.width),c=(-r.x+f)/r.width}if(r.y<0)l=-r.y/r.height;else if(r.y+r.height>u.height){var f=0;u.height>r.height&&(f=u.height-r.height),l=(-r.y+f)/r.height}var h=u.width>r.width?1:u.width/r.width,d=u.height>r.height?1:u.height/r.height;this.view.style.left=this.padding+c*this.boxWidth+"px",this.view.style.width=h*this.boxWidth+"px",this.view.style.top=this.padding+l*this.boxHeight+"px",this.view.style.height=d*this.boxHeight+"px"}},e}();function li(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Mw={exports:{}};(function(e,t){(function(r){e.exports=r()})(function(){return function(){return function r(a,i,o){function n(c,l){if(!i[c]){if(!a[c]){var f=typeof li=="function"&&li;if(!l&&f)return f(c,!0);if(s)return s(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var d=i[c]={exports:{}};a[c][0].call(d.exports,function(v){return n(a[c][1][v]||v)},d,d.exports,r,a,i,o)}return i[c].exports}for(var s=typeof li=="function"&&li,u=0;u<o.length;u++)n(o[u]);return n}}()({1:[function(r,a,i){(function(o,n){(function(){const s=r("events").EventEmitter,u=r("./store"),c=r("./topic-alias-recv"),l=r("./topic-alias-send"),f=r("mqtt-packet"),h=r("./default-message-id-provider"),d=r("readable-stream").Writable,v=r("inherits"),y=r("reinterval"),g=r("rfdc/default"),m=r("./validations"),w=r("xtend"),p=r("debug")("mqttjs:client"),x=o?o.nextTick:function(S){setTimeout(S,0)},T=n.setImmediate||function(S){x(S)},A={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},I={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function R(S,P){let B;P.properties&&(B=P.properties.topicAlias);let D=P.topic.toString();if(D.length===0){if(B===void 0)return new Error("Unregistered Topic Alias");if((D=S.topicAliasSend.getTopicByAlias(B))===void 0)return new Error("Unregistered Topic Alias");P.topic=D}B&&delete P.properties.topicAlias}function z(S,P,B){p("sendPacket :: packet: %O",P),p("sendPacket :: emitting `packetsend`"),S.emit("packetsend",P),p("sendPacket :: writing to stream");const D=f.writeToStream(P,S.stream,S.options);p("sendPacket :: writeToStream result %s",D),!D&&B&&B!==_?(p("sendPacket :: handle events on `drain` once through callback."),S.stream.once("drain",B)):B&&(p("sendPacket :: invoking cb"),B())}function U(S,P,B,D){p("storeAndSend :: store packet with cmd %s to outgoingStore",P.cmd);let H,L=P;if(L.cmd==="publish"&&(L=g(P),H=R(S,L)))return B&&B(H);S.outgoingStore.put(L,function(M){if(M)return B&&B(M);D(),z(S,P,B)})}function _(S){p("nop ::",S)}function k(S,P){let B;const D=this;if(!(this instanceof k))return new k(S,P);for(B in this.options=P||{},A)this.options[B]===void 0?this.options[B]=A[B]:this.options[B]=P[B];p("MqttClient :: options.protocol",P.protocol),p("MqttClient :: options.protocolVersion",P.protocolVersion),p("MqttClient :: options.username",P.username),p("MqttClient :: options.keepalive",P.keepalive),p("MqttClient :: options.reconnectPeriod",P.reconnectPeriod),p("MqttClient :: options.rejectUnauthorized",P.rejectUnauthorized),p("MqttClient :: options.topicAliasMaximum",P.topicAliasMaximum),this.options.clientId=typeof P.clientId=="string"?P.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),p("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=P.protocolVersion===5&&P.customHandleAcks?P.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=S,this.messageIdProvider=this.options.messageIdProvider===void 0?new h:this.options.messageIdProvider,this.outgoingStore=P.outgoingStore||new u,this.incomingStore=P.incomingStore||new u,this.queueQoSZero=P.queueQoSZero===void 0||P.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,P.topicAliasMaximum>0&&(P.topicAliasMaximum>65535?p("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new c(P.topicAliasMaximum)),this.on("connect",function(){const H=this.queue;p("connect :: sending queued packets"),function L(){const M=H.shift();p("deliver :: entry %o",M);let j=null;if(!M)return void D._resubscribe();j=M.packet,p("deliver :: call _sendPacket for %o",j);let W=!0;j.messageId&&j.messageId!==0&&(D.messageIdProvider.register(j.messageId)||(W=!1)),W?D._sendPacket(j,function(F){M.cb&&M.cb(F),L()}):(p("messageId: %d has already used. The message is skipped and removed.",j.messageId),L())}()}),this.on("close",function(){p("close :: connected set to `false`"),this.connected=!1,p("close :: clearing connackTimer"),clearTimeout(this.connackTimer),p("close :: clearing ping timer"),D.pingTimer!==null&&(D.pingTimer.clear(),D.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),p("close :: calling _setupReconnect"),this._setupReconnect()}),s.call(this),p("MqttClient :: setting up stream"),this._setupStream()}v(k,s),k.prototype._setupStream=function(){const S=this,P=new d,B=f.parser(this.options);let D=null;const H=[];function L(){if(H.length)x(M);else{const W=D;D=null,W()}}function M(){p("work :: getting next packet in queue");const W=H.shift();if(W)p("work :: packet pulled from queue"),S._handlePacket(W,L);else{p("work :: no packets in queue");const F=D;D=null,p("work :: done flag is %s",!!F),F&&F()}}p("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),p("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),B.on("packet",function(W){p("parser :: on packet push to packets array."),H.push(W)}),P._write=function(W,F,V){D=V,p("writable stream :: parsing buffer"),B.parse(W),M()},p("_setupStream :: pipe stream to writable stream"),this.stream.pipe(P),this.stream.on("error",function(W){p("streamErrorHandler :: error",W.message),W.code?(p("streamErrorHandler :: emitting error"),S.emit("error",W)):_(W)}),this.stream.on("close",function(){var W;p("(%s)stream :: on close",S.options.clientId),(W=S.outgoing)&&(p("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(W).forEach(function(F){W[F].volatile&&typeof W[F].cb=="function"&&(W[F].cb(new Error("Connection closed")),delete W[F])})),p("stream: emit close to MqttClient"),S.emit("close")}),p("_setupStream: sending packet `connect`");const j=Object.create(this.options);if(j.cmd="connect",this.topicAliasRecv&&(j.properties||(j.properties={}),this.topicAliasRecv&&(j.properties.topicAliasMaximum=this.topicAliasRecv.max)),z(this,j),B.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return S.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"&&z(this,w({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){p("!!connectTimeout hit!! Calling _cleanUp with force `true`"),S._cleanUp(!0)},this.options.connectTimeout)},k.prototype._handlePacket=function(S,P){const B=this.options;if(B.protocolVersion===5&&B.properties&&B.properties.maximumPacketSize&&B.properties.maximumPacketSize<S.length)return this.emit("error",new Error("exceeding packets size "+S.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(p("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",S),S.cmd){case"publish":this._handlePublish(S,P);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(S),P();break;case"pubrel":this._handlePubrel(S,P);break;case"connack":this._handleConnack(S),P();break;case"auth":this._handleAuth(S),P();break;case"pingresp":this._handlePingresp(S),P();break;case"disconnect":this._handleDisconnect(S),P()}},k.prototype._checkDisconnecting=function(S){return this.disconnecting&&(S&&S!==_?S(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},k.prototype.publish=function(S,P,B,D){p("publish :: message `%s` to topic `%s`",P,S);const H=this.options;if(typeof B=="function"&&(D=B,B=null),B=w({qos:0,retain:!1,dup:!1},B),this._checkDisconnecting(D))return this;const L=this,M=function(){let j=0;if((B.qos===1||B.qos===2)&&(j=L._nextId())===null)return p("No messageId left"),!1;const W={cmd:"publish",topic:S,payload:P,qos:B.qos,retain:B.retain,messageId:j,dup:B.dup};switch(H.protocolVersion===5&&(W.properties=B.properties),p("publish :: qos",B.qos),B.qos){case 1:case 2:L.outgoing[W.messageId]={volatile:!1,cb:D||_},p("MqttClient:publish: packet cmd: %s",W.cmd),L._sendPacket(W,void 0,B.cbStorePut);break;default:p("MqttClient:publish: packet cmd: %s",W.cmd),L._sendPacket(W,D,B.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!M())&&this._storeProcessingQueue.push({invoke:M,cbStorePut:B.cbStorePut,callback:D}),this},k.prototype.subscribe=function(){const S=this,P=new Array(arguments.length);for(let Y=0;Y<arguments.length;Y++)P[Y]=arguments[Y];const B=[];let D=P.shift();const H=D.resubscribe;let L=P.pop()||_,M=P.pop();const j=this.options.protocolVersion;delete D.resubscribe,typeof D=="string"&&(D=[D]),typeof L!="function"&&(M=L,L=_);const W=m.validateTopics(D);if(W!==null)return T(L,new Error("Invalid topic "+W)),this;if(this._checkDisconnecting(L))return p("subscribe: discconecting true"),this;const F={qos:0};if(j===5&&(F.nl=!1,F.rap=!1,F.rh=0),M=w(F,M),Array.isArray(D)?D.forEach(function(Y){if(p("subscribe: array topic %s",Y),!Object.prototype.hasOwnProperty.call(S._resubscribeTopics,Y)||S._resubscribeTopics[Y].qos<M.qos||H){const q={topic:Y,qos:M.qos};j===5&&(q.nl=M.nl,q.rap=M.rap,q.rh=M.rh,q.properties=M.properties),p("subscribe: pushing topic `%s` and qos `%s` to subs list",q.topic,q.qos),B.push(q)}}):Object.keys(D).forEach(function(Y){if(p("subscribe: object topic %s",Y),!Object.prototype.hasOwnProperty.call(S._resubscribeTopics,Y)||S._resubscribeTopics[Y].qos<D[Y].qos||H){const q={topic:Y,qos:D[Y].qos};j===5&&(q.nl=D[Y].nl,q.rap=D[Y].rap,q.rh=D[Y].rh,q.properties=M.properties),p("subscribe: pushing `%s` to subs list",q),B.push(q)}}),!B.length)return L(null,[]),this;const V=function(){const Y=S._nextId();if(Y===null)return p("No messageId left"),!1;const q={cmd:"subscribe",subscriptions:B,qos:1,retain:!1,dup:!1,messageId:Y};if(M.properties&&(q.properties=M.properties),S.options.resubscribe){p("subscribe :: resubscribe true");const Q=[];B.forEach(function(K){if(S.options.reconnectPeriod>0){const X={qos:K.qos};j===5&&(X.nl=K.nl||!1,X.rap=K.rap||!1,X.rh=K.rh||0,X.properties=K.properties),S._resubscribeTopics[K.topic]=X,Q.push(K.topic)}}),S.messageIdToTopic[q.messageId]=Q}return S.outgoing[q.messageId]={volatile:!0,cb:function(Q,K){if(!Q){const X=K.granted;for(let b=0;b<X.length;b+=1)B[b].qos=X[b]}L(Q,B)}},p("subscribe :: call _sendPacket"),S._sendPacket(q),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!V())&&this._storeProcessingQueue.push({invoke:V,callback:L}),this},k.prototype.unsubscribe=function(){const S=this,P=new Array(arguments.length);for(let j=0;j<arguments.length;j++)P[j]=arguments[j];let B=P.shift(),D=P.pop()||_,H=P.pop();typeof B=="string"&&(B=[B]),typeof D!="function"&&(H=D,D=_);const L=m.validateTopics(B);if(L!==null)return T(D,new Error("Invalid topic "+L)),this;if(S._checkDisconnecting(D))return this;const M=function(){const j=S._nextId();if(j===null)return p("No messageId left"),!1;const W={cmd:"unsubscribe",qos:1,messageId:j};return typeof B=="string"?W.unsubscriptions=[B]:Array.isArray(B)&&(W.unsubscriptions=B),S.options.resubscribe&&W.unsubscriptions.forEach(function(F){delete S._resubscribeTopics[F]}),typeof H=="object"&&H.properties&&(W.properties=H.properties),S.outgoing[W.messageId]={volatile:!0,cb:D},p("unsubscribe: call _sendPacket"),S._sendPacket(W),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!M())&&this._storeProcessingQueue.push({invoke:M,callback:D}),this},k.prototype.end=function(S,P,B){const D=this;function H(){p("end :: (%s) :: finish :: calling _cleanUp with force %s",D.options.clientId,S),D._cleanUp(S,()=>{p("end :: finish :: calling process.nextTick on closeStores"),x((function(){p("end :: closeStores: closing incoming and outgoing stores"),D.disconnected=!0,D.incomingStore.close(function(L){D.outgoingStore.close(function(M){if(p("end :: closeStores: emitting end"),D.emit("end"),B){const j=L||M;p("end :: closeStores: invoking callback with args"),B(j)}})}),D._deferredReconnect&&D._deferredReconnect()}).bind(D))},P)}return p("end :: (%s)",this.options.clientId),S!=null&&typeof S=="boolean"||(B=P||_,P=S,S=!1,typeof P!="object"&&(B=P,P=null,typeof B!="function"&&(B=_))),typeof P!="object"&&(B=P,P=null),p("end :: cb? %s",!!B),B=B||_,this.disconnecting?(B(),this):(this._clearReconnect(),this.disconnecting=!0,!S&&Object.keys(this.outgoing).length>0?(p("end :: (%s) :: calling finish in 10ms once outgoing is empty",D.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,H,10))):(p("end :: (%s) :: immediately calling finish",D.options.clientId),H()),this)},k.prototype.removeOutgoingMessage=function(S){const P=this.outgoing[S]?this.outgoing[S].cb:null;return delete this.outgoing[S],this.outgoingStore.del({messageId:S},function(){P(new Error("Message removed"))}),this},k.prototype.reconnect=function(S){p("client reconnect");const P=this,B=function(){S?(P.options.incomingStore=S.incomingStore,P.options.outgoingStore=S.outgoingStore):(P.options.incomingStore=null,P.options.outgoingStore=null),P.incomingStore=P.options.incomingStore||new u,P.outgoingStore=P.options.outgoingStore||new u,P.disconnecting=!1,P.disconnected=!1,P._deferredReconnect=null,P._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=B:B(),this},k.prototype._reconnect=function(){p("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),p("client already connected. disconnecting first.")):(p("_reconnect: calling _setupStream"),this._setupStream())},k.prototype._setupReconnect=function(){const S=this;!S.disconnecting&&!S.reconnectTimer&&S.options.reconnectPeriod>0?(this.reconnecting||(p("_setupReconnect :: emit `offline` state"),this.emit("offline"),p("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),p("_setupReconnect :: setting reconnectTimer for %d ms",S.options.reconnectPeriod),S.reconnectTimer=setInterval(function(){p("reconnectTimer :: reconnect triggered!"),S._reconnect()},S.options.reconnectPeriod)):p("_setupReconnect :: doing nothing...")},k.prototype._clearReconnect=function(){p("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},k.prototype._cleanUp=function(S,P){const B=arguments[2];if(P&&(p("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",P)),p("_cleanUp :: forced? %s",S),S)this.options.reconnectPeriod===0&&this.options.clean&&(D=this.outgoing)&&(p("flush: queue exists? %b",!!D),Object.keys(D).forEach(function(H){typeof D[H].cb=="function"&&(D[H].cb(new Error("Connection closed")),delete D[H])})),p("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const H=w({cmd:"disconnect"},B);p("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(H,T.bind(null,this.stream.end.bind(this.stream)))}var D;this.disconnecting||(p("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(p("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),P&&!this.connected&&(p("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",P),P())},k.prototype._sendPacket=function(S,P,B){p("_sendPacket :: (%s) ::  start",this.options.clientId),B=B||_,P=P||_;const D=function(H,L){if(H.options.protocolVersion===5&&L.cmd==="publish"){let M;L.properties&&(M=L.properties.topicAlias);const j=L.topic.toString();if(H.topicAliasSend)if(M){if(j.length!==0&&(p("applyTopicAlias :: register topic: %s - alias: %d",j,M),!H.topicAliasSend.put(j,M)))return p("applyTopicAlias :: error out of range. topic: %s - alias: %d",j,M),new Error("Sending Topic Alias out of range")}else j.length!==0&&(H.options.autoAssignTopicAlias?(M=H.topicAliasSend.getAliasByTopic(j))?(L.topic="",L.properties={...L.properties,topicAlias:M},p("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",j,M)):(M=H.topicAliasSend.getLruAlias(),H.topicAliasSend.put(j,M),L.properties={...L.properties,topicAlias:M},p("applyTopicAlias :: auto assign topic: %s - alias: %d",j,M)):H.options.autoUseTopicAlias&&(M=H.topicAliasSend.getAliasByTopic(j))&&(L.topic="",L.properties={...L.properties,topicAlias:M},p("applyTopicAlias :: auto use topic: %s - alias: %d",j,M)));else if(M)return p("applyTopicAlias :: error out of range. topic: %s - alias: %d",j,M),new Error("Sending Topic Alias out of range")}}(this,S);if(D)P(D);else{if(!this.connected)return S.cmd==="auth"?(this._shiftPingInterval(),void z(this,S,P)):(p("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(S,P,B));switch(this._shiftPingInterval(),S.cmd){case"publish":break;case"pubrel":return void U(this,S,P,B);default:return void z(this,S,P)}switch(S.qos){case 2:case 1:U(this,S,P,B);break;case 0:default:z(this,S,P)}p("_sendPacket :: (%s) ::  end",this.options.clientId)}},k.prototype._storePacket=function(S,P,B){p("_storePacket :: packet: %o",S),p("_storePacket :: cb? %s",!!P),B=B||_;let D=S;if(D.cmd==="publish"){const H=R(this,D=g(S));if(H)return P&&P(H)}(D.qos||0)===0&&this.queueQoSZero||D.cmd!=="publish"?this.queue.push({packet:D,cb:P}):D.qos>0?(P=this.outgoing[D.messageId]?this.outgoing[D.messageId].cb:null,this.outgoingStore.put(D,function(H){if(H)return P&&P(H);B()})):P&&P(new Error("No connection to broker"))},k.prototype._setupPingTimer=function(){p("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const S=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=y(function(){S._checkPing()},1e3*this.options.keepalive))},k.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},k.prototype._checkPing=function(){p("_checkPing :: checking ping..."),this.pingResp?(p("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(p("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},k.prototype._handlePingresp=function(){this.pingResp=!0},k.prototype._handleConnack=function(S){p("_handleConnack");const P=this.options,B=P.protocolVersion===5?S.reasonCode:S.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,S.properties){if(S.properties.topicAliasMaximum){if(S.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));S.properties.topicAliasMaximum>0&&(this.topicAliasSend=new l(S.properties.topicAliasMaximum))}S.properties.serverKeepAlive&&P.keepalive&&(P.keepalive=S.properties.serverKeepAlive,this._shiftPingInterval()),S.properties.maximumPacketSize&&(P.properties||(P.properties={}),P.properties.maximumPacketSize=S.properties.maximumPacketSize)}if(B===0)this.reconnecting=!1,this._onConnect(S);else if(B>0){const D=new Error("Connection refused: "+I[B]);D.code=B,this.emit("error",D)}},k.prototype._handleAuth=function(S){const P=this.options.protocolVersion,B=P===5?S.reasonCode:S.returnCode;if(P!==5){const H=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+P);return H.code=B,void this.emit("error",H)}const D=this;this.handleAuth(S,function(H,L){if(H)D.emit("error",H);else if(B===24)D.reconnecting=!1,D._sendPacket(L);else{const M=new Error("Connection refused: "+I[B]);H.code=B,D.emit("error",M)}})},k.prototype.handleAuth=function(S,P){P()},k.prototype._handlePublish=function(S,P){p("_handlePublish: packet %o",S),P=P!==void 0?P:_;let B=S.topic.toString();const D=S.payload,H=S.qos,L=S.messageId,M=this,j=this.options,W=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let F;if(S.properties&&(F=S.properties.topicAlias),F!==void 0)if(B.length===0){if(!(F>0&&F<=65535))return p("_handlePublish :: topic alias out of range. alias: %d",F),void this.emit("error",new Error("Received Topic Alias is out of range"));{const V=this.topicAliasRecv.getTopicByAlias(F);if(!V)return p("_handlePublish :: unregistered topic alias. alias: %d",F),void this.emit("error",new Error("Received unregistered Topic Alias"));p("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",B=V,F)}}else{if(!this.topicAliasRecv.put(B,F))return p("_handlePublish :: topic alias out of range. alias: %d",F),void this.emit("error",new Error("Received Topic Alias is out of range"));p("_handlePublish :: registered topic: %s - alias: %d",B,F)}}switch(p("_handlePublish: qos %d",H),H){case 2:j.customHandleAcks(B,D,S,function(F,V){return F instanceof Error||(V=F,F=null),F?M.emit("error",F):W.indexOf(V)===-1?M.emit("error",new Error("Wrong reason code for pubrec")):void(V?M._sendPacket({cmd:"pubrec",messageId:L,reasonCode:V},P):M.incomingStore.put(S,function(){M._sendPacket({cmd:"pubrec",messageId:L},P)}))});break;case 1:j.customHandleAcks(B,D,S,function(F,V){return F instanceof Error||(V=F,F=null),F?M.emit("error",F):W.indexOf(V)===-1?M.emit("error",new Error("Wrong reason code for puback")):(V||M.emit("message",B,D,S),void M.handleMessage(S,function(Y){if(Y)return P&&P(Y);M._sendPacket({cmd:"puback",messageId:L,reasonCode:V},P)}))});break;case 0:this.emit("message",B,D,S),this.handleMessage(S,P);break;default:p("_handlePublish: unknown QoS. Doing nothing.")}},k.prototype.handleMessage=function(S,P){P()},k.prototype._handleAck=function(S){const P=S.messageId,B=S.cmd;let D=null;const H=this.outgoing[P]?this.outgoing[P].cb:null,L=this;let M;if(H){switch(p("_handleAck :: packet type",B),B){case"pubcomp":case"puback":{const j=S.reasonCode;j&&j>0&&j!==16&&((M=new Error("Publish error: "+I[j])).code=j,H(M,S)),delete this.outgoing[P],this.outgoingStore.del(S,H),this.messageIdProvider.deallocate(P),this._invokeStoreProcessingQueue();break}case"pubrec":{D={cmd:"pubrel",qos:2,messageId:P};const j=S.reasonCode;j&&j>0&&j!==16?((M=new Error("Publish error: "+I[j])).code=j,H(M,S)):this._sendPacket(D);break}case"suback":delete this.outgoing[P],this.messageIdProvider.deallocate(P);for(let j=0;j<S.granted.length;j++)if(128&S.granted[j]){const W=this.messageIdToTopic[P];W&&W.forEach(function(F){delete L._resubscribeTopics[F]})}this._invokeStoreProcessingQueue(),H(null,S);break;case"unsuback":delete this.outgoing[P],this.messageIdProvider.deallocate(P),this._invokeStoreProcessingQueue(),H(null);break;default:L.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")}else p("_handleAck :: Server sent an ack in error. Ignoring.")},k.prototype._handlePubrel=function(S,P){p("handling pubrel packet"),P=P!==void 0?P:_;const B=this,D={cmd:"pubcomp",messageId:S.messageId};B.incomingStore.get(S,function(H,L){H?B._sendPacket(D,P):(B.emit("message",L.topic,L.payload,L),B.handleMessage(L,function(M){if(M)return P(M);B.incomingStore.del(L,_),B._sendPacket(D,P)}))})},k.prototype._handleDisconnect=function(S){this.emit("disconnect",S)},k.prototype._nextId=function(){return this.messageIdProvider.allocate()},k.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},k.prototype._resubscribe=function(){p("_resubscribe");const S=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&S.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){p("_resubscribe: protocolVersion 5");for(let P=0;P<S.length;P++){const B={};B[S[P]]=this._resubscribeTopics[S[P]],B.resubscribe=!0,this.subscribe(B,{properties:B[S[P]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},k.prototype._onConnect=function(S){if(this.disconnected)return void this.emit("connect",S);const P=this;this.connackPacket=S,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function B(){let D=P.outgoingStore.createStream();function H(){P._storeProcessing=!1,P._packetIdsDuringStoreProcessing={}}function L(){D.destroy(),D=null,P._flushStoreProcessingQueue(),H()}P.once("close",L),D.on("error",function(M){H(),P._flushStoreProcessingQueue(),P.removeListener("close",L),P.emit("error",M)}),D.on("end",function(){let M=!0;for(const j in P._packetIdsDuringStoreProcessing)if(!P._packetIdsDuringStoreProcessing[j]){M=!1;break}M?(H(),P.removeListener("close",L),P._invokeAllStoreProcessingQueue(),P.emit("connect",S)):B()}),function M(){if(!D)return;P._storeProcessing=!0;const j=D.read(1);let W;j?P._packetIdsDuringStoreProcessing[j.messageId]?M():P.disconnecting||P.reconnectTimer?D.destroy&&D.destroy():(W=P.outgoing[j.messageId]?P.outgoing[j.messageId].cb:null,P.outgoing[j.messageId]={volatile:!1,cb:function(F,V){W&&W(F,V),M()}},P._packetIdsDuringStoreProcessing[j.messageId]=!0,P.messageIdProvider.register(j.messageId)?P._sendPacket(j):p("messageId: %d has already used.",j.messageId)):D.once("readable",M)}()}()},k.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const S=this._storeProcessingQueue[0];if(S&&S.invoke())return this._storeProcessingQueue.shift(),!0}return!1},k.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},k.prototype._flushStoreProcessingQueue=function(){for(const S of this._storeProcessingQueue)S.cbStorePut&&S.cbStorePut(new Error("Connection closed")),S.callback&&S.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},a.exports=k}).call(this)}).call(this,r("_process"),typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(r,a,i){const{Buffer:o}=r("buffer"),n=r("readable-stream").Transform,s=r("duplexify");let u,c,l,f=!1;a.exports=function(h,d){if(d.hostname=d.hostname||d.host,!d.hostname)throw new Error("Could not determine host. Specify host manually.");const v=d.protocolId==="MQIsdp"&&d.protocolVersion===3?"mqttv3.1":"mqtt";(function(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})})(d);const y=function(g,m){const w=g.protocol==="alis"?"wss":"ws";let p=w+"://"+g.hostname+g.path;return g.port&&g.port!==80&&g.port!==443&&(p=w+"://"+g.hostname+":"+g.port+g.path),typeof g.transformWsUrl=="function"&&(p=g.transformWsUrl(p,g,m)),p}(d,h);return(u=d.my).connectSocket({url:y,protocols:v}),c=function(){const g=new n;return g._write=function(m,w,p){u.sendSocketMessage({data:m.buffer,success:function(){p()},fail:function(){p(new Error)}})},g._flush=function(m){u.closeSocket({success:function(){m()}})},g}(),l=s.obj(),f||(f=!0,u.onSocketOpen(function(){l.setReadable(c),l.setWritable(c),l.emit("connect")}),u.onSocketMessage(function(g){if(typeof g.data=="string"){const m=o.from(g.data,"base64");c.push(m)}else{const m=new FileReader;m.addEventListener("load",function(){let w=m.result;w=w instanceof ArrayBuffer?o.from(w):o.from(w,"utf8"),c.push(w)}),m.readAsArrayBuffer(g.data)}}),u.onSocketClose(function(){l.end(),l.destroy()}),u.onSocketError(function(g){l.destroy(g)})),l}},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(r,a,i){const o=r("net"),n=r("debug")("mqttjs:tcp");a.exports=function(s,u){u.port=u.port||1883,u.hostname=u.hostname||u.host||"localhost";const c=u.port,l=u.hostname;return n("port %d and host %s",c,l),o.createConnection(c,l)}},{debug:18,net:16}],4:[function(r,a,i){const o=r("tls"),n=r("net"),s=r("debug")("mqttjs:tls");a.exports=function(u,c){c.port=c.port||8883,c.host=c.hostname||c.host||"localhost",n.isIP(c.host)===0&&(c.servername=c.host),c.rejectUnauthorized=c.rejectUnauthorized!==!1,delete c.path,s("port %d host %s rejectUnauthorized %b",c.port,c.host,c.rejectUnauthorized);const l=o.connect(c);function f(h){c.rejectUnauthorized&&u.emit("error",h),l.end()}return l.on("secureConnect",function(){c.rejectUnauthorized&&!l.authorized?l.emit("error",new Error("TLS not authorized")):l.removeListener("error",f)}),l.on("error",f),l}},{debug:18,net:16,tls:16}],5:[function(r,a,i){(function(o){(function(){const{Buffer:n}=r("buffer"),s=r("ws"),u=r("debug")("mqttjs:ws"),c=r("duplexify"),l=r("readable-stream").Transform,f=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],h=o!==void 0&&o.title==="browser"||typeof __webpack_require__=="function";function d(y,g){let m=y.protocol+"://"+y.hostname+":"+y.port+y.path;return typeof y.transformWsUrl=="function"&&(m=y.transformWsUrl(m,y,g)),m}function v(y){const g=y;return y.hostname||(g.hostname="localhost"),y.port||(y.protocol==="wss"?g.port=443:g.port=80),y.path||(g.path="/"),y.wsOptions||(g.wsOptions={}),h||y.protocol!=="wss"||f.forEach(function(m){Object.prototype.hasOwnProperty.call(y,m)&&!Object.prototype.hasOwnProperty.call(y.wsOptions,m)&&(g.wsOptions[m]=y[m])}),g}a.exports=h?function(y,g){let m;u("browserStreamBuilder");const w=function(S){const P=v(S);if(P.hostname||(P.hostname=P.host),!P.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const B=new URL(document.URL);P.hostname=B.hostname,P.port||(P.port=B.port)}return P.objectMode===void 0&&(P.objectMode=!(P.binary===!0||P.binary===void 0)),P}(g).browserBufferSize||524288,p=g.browserBufferTimeout||1e3,x=!g.objectMode,T=function(S,P){const B=P.protocolId==="MQIsdp"&&P.protocolVersion===3?"mqttv3.1":"mqtt",D=d(P,S),H=new WebSocket(D,[B]);return H.binaryType="arraybuffer",H}(y,g),A=function(S,P,B){const D=new l({objectModeMode:S.objectMode});return D._write=P,D._flush=B,D}(g,function S(P,B,D){T.bufferedAmount>w&&setTimeout(S,p,P,B,D),x&&typeof P=="string"&&(P=n.from(P,"utf8"));try{T.send(P)}catch(H){return D(H)}D()},function(S){T.close(),S()});g.objectMode||(A._writev=k),A.on("close",()=>{T.close()});const I=T.addEventListener!==void 0;function R(){m.setReadable(A),m.setWritable(A),m.emit("connect")}function z(){m.end(),m.destroy()}function U(S){m.destroy(S)}function _(S){let P=S.data;P=P instanceof ArrayBuffer?n.from(P):n.from(P,"utf8"),A.push(P)}function k(S,P){const B=new Array(S.length);for(let D=0;D<S.length;D++)typeof S[D].chunk=="string"?B[D]=n.from(S[D],"utf8"):B[D]=S[D].chunk;this._write(n.concat(B),"binary",P)}return T.readyState===T.OPEN?m=A:(m=m=c(void 0,void 0,g),g.objectMode||(m._writev=k),I?T.addEventListener("open",R):T.onopen=R),m.socket=T,I?(T.addEventListener("close",z),T.addEventListener("error",U),T.addEventListener("message",_)):(T.onclose=z,T.onerror=U,T.onmessage=_),m}:function(y,g){u("streamBuilder");const m=v(g),w=d(m,y),p=function(T,A,I){u("createWebSocket"),u("protocol: "+I.protocolId+" "+I.protocolVersion);const R=I.protocolId==="MQIsdp"&&I.protocolVersion===3?"mqttv3.1":"mqtt";return u("creating new Websocket for url: "+A+" and protocol: "+R),new s(A,[R],I.wsOptions)}(0,w,m),x=s.createWebSocketStream(p,m.wsOptions);return x.url=w,p.on("close",()=>{x.destroy()}),x}}).call(this)}).call(this,r("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(r,a,i){const{Buffer:o}=r("buffer"),n=r("readable-stream").Transform,s=r("duplexify");let u,c,l;a.exports=function(f,h){if(h.hostname=h.hostname||h.host,!h.hostname)throw new Error("Could not determine host. Specify host manually.");const d=h.protocolId==="MQIsdp"&&h.protocolVersion===3?"mqttv3.1":"mqtt";(function(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})})(h);const v=function(g,m){const w=g.protocol==="wxs"?"wss":"ws";let p=w+"://"+g.hostname+g.path;return g.port&&g.port!==80&&g.port!==443&&(p=w+"://"+g.hostname+":"+g.port+g.path),typeof g.transformWsUrl=="function"&&(p=g.transformWsUrl(p,g,m)),p}(h,f);u=wx.connectSocket({url:v,protocols:[d]}),c=function(){const g=new n;return g._write=function(m,w,p){u.send({data:m.buffer,success:function(){p()},fail:function(x){p(new Error(x))}})},g._flush=function(m){u.close({success:function(){m()}})},g}(),(l=s.obj())._destroy=function(g,m){u.close({success:function(){m&&m(g)}})};const y=l.destroy;return l.destroy=(function(){l.destroy=y;const g=this;setTimeout(function(){u.close({fail:function(){g._destroy(new Error)}})},0)}).bind(l),u.onOpen(function(){l.setReadable(c),l.setWritable(c),l.emit("connect")}),u.onMessage(function(g){let m=g.data;m=m instanceof ArrayBuffer?o.from(m):o.from(m,"utf8"),c.push(m)}),u.onClose(function(){l.end(),l.destroy()}),u.onError(function(g){l.destroy(new Error(g.errMsg))}),l}},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(r,a,i){function o(){if(!(this instanceof o))return new o;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}o.prototype.allocate=function(){const n=this.nextId++;return this.nextId===65536&&(this.nextId=1),n},o.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},o.prototype.register=function(n){return!0},o.prototype.deallocate=function(n){},o.prototype.clear=function(){},a.exports=o},{}],8:[function(r,a,i){const o=r("xtend"),n=r("readable-stream").Readable,s={objectMode:!0},u={clean:!0};function c(l){if(!(this instanceof c))return new c(l);this.options=l||{},this.options=o(u,l),this._inflights=new Map}c.prototype.put=function(l,f){return this._inflights.set(l.messageId,l),f&&f(),this},c.prototype.createStream=function(){const l=new n(s),f=[];let h=!1,d=0;return this._inflights.forEach(function(v,y){f.push(v)}),l._read=function(){!h&&d<f.length?this.push(f[d++]):this.push(null)},l.destroy=function(){if(h)return;const v=this;h=!0,setTimeout(function(){v.emit("close")},0)},l},c.prototype.del=function(l,f){return(l=this._inflights.get(l.messageId))?(this._inflights.delete(l.messageId),f(null,l)):f&&f(new Error("missing packet")),this},c.prototype.get=function(l,f){return(l=this._inflights.get(l.messageId))?f(null,l):f&&f(new Error("missing packet")),this},c.prototype.close=function(l){this.options.clean&&(this._inflights=null),l&&l()},a.exports=c},{"readable-stream":69,xtend:81}],9:[function(r,a,i){function o(n){if(!(this instanceof o))return new o(n);this.aliasToTopic={},this.max=n}o.prototype.put=function(n,s){return!(s===0||s>this.max)&&(this.aliasToTopic[s]=n,this.length=Object.keys(this.aliasToTopic).length,!0)},o.prototype.getTopicByAlias=function(n){return this.aliasToTopic[n]},o.prototype.clear=function(){this.aliasToTopic={}},a.exports=o},{}],10:[function(r,a,i){const o=r("lru-cache"),n=r("number-allocator").NumberAllocator;function s(u){if(!(this instanceof s))return new s(u);u>0&&(this.aliasToTopic=new o({max:u}),this.topicToAlias={},this.numberAllocator=new n(1,u),this.max=u,this.length=0)}s.prototype.put=function(u,c){if(c===0||c>this.max)return!1;const l=this.aliasToTopic.get(c);return l&&delete this.topicToAlias[l],this.aliasToTopic.set(c,u),this.topicToAlias[u]=c,this.numberAllocator.use(c),this.length=this.aliasToTopic.length,!0},s.prototype.getTopicByAlias=function(u){return this.aliasToTopic.get(u)},s.prototype.getAliasByTopic=function(u){const c=this.topicToAlias[u];return c!==void 0&&this.aliasToTopic.get(c),c},s.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},s.prototype.getLruAlias=function(){return this.numberAllocator.firstVacant()||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},a.exports=s},{"lru-cache":37,"number-allocator":46}],11:[function(r,a,i){function o(n){const s=n.split("/");for(let u=0;u<s.length;u++)if(s[u]!=="+"){if(s[u]==="#")return u===s.length-1;if(s[u].indexOf("+")!==-1||s[u].indexOf("#")!==-1)return!1}return!0}a.exports={validateTopics:function(n){if(n.length===0)return"empty_topic_list";for(let s=0;s<n.length;s++)if(!o(n[s]))return n[s];return null}}},{}],12:[function(r,a,i){(function(o){(function(){const n=r("../client"),s=r("../store"),u=r("url"),c=r("xtend"),l=r("debug")("mqttjs"),f={};function h(d,v){if(l("connecting to an MQTT broker..."),typeof d!="object"||v||(v=d,d=null),v=v||{},d){const g=u.parse(d,!0);if(g.port!=null&&(g.port=Number(g.port)),(v=c(g,v)).protocol===null)throw new Error("Missing protocol");v.protocol=v.protocol.replace(/:$/,"")}if(function(g){let m;g.auth&&((m=g.auth.match(/^(.+):(.+)$/))?(g.username=m[1],g.password=m[2]):g.username=g.auth)}(v),v.query&&typeof v.query.clientId=="string"&&(v.clientId=v.query.clientId),v.cert&&v.key){if(!v.protocol)throw new Error("Missing secure protocol key");if(["mqtts","wss","wxs","alis"].indexOf(v.protocol)===-1)switch(v.protocol){case"mqtt":v.protocol="mqtts";break;case"ws":v.protocol="wss";break;case"wx":v.protocol="wxs";break;case"ali":v.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+v.protocol+'"!')}}if(!f[v.protocol]){const g=["mqtts","wss"].indexOf(v.protocol)!==-1;v.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(m,w){return(!g||w%2!=0)&&typeof f[m]=="function"})[0]}if(v.clean===!1&&!v.clientId)throw new Error("Missing clientId for unclean clients");v.protocol&&(v.defaultProtocol=v.protocol);const y=new n(function(g){return v.servers&&(g._reconnectCount&&g._reconnectCount!==v.servers.length||(g._reconnectCount=0),v.host=v.servers[g._reconnectCount].host,v.port=v.servers[g._reconnectCount].port,v.protocol=v.servers[g._reconnectCount].protocol?v.servers[g._reconnectCount].protocol:v.defaultProtocol,v.hostname=v.host,g._reconnectCount++),l("calling streambuilder for",v.protocol),f[v.protocol](g,v)},v);return y.on("error",function(){}),y}o!==void 0&&o.title!=="browser"||typeof __webpack_require__!="function"?(f.mqtt=r("./tcp"),f.tcp=r("./tcp"),f.ssl=r("./tls"),f.tls=r("./tls"),f.mqtts=r("./tls")):(f.wx=r("./wx"),f.wxs=r("./wx"),f.ali=r("./ali"),f.alis=r("./ali")),f.ws=r("./ws"),f.wss=r("./ws"),a.exports=h,a.exports.connect=h,a.exports.MqttClient=n,a.exports.Store=s}).call(this)}).call(this,r("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(r,a,i){i.byteLength=function(d){var v=f(d),y=v[0],g=v[1];return 3*(y+g)/4-g},i.toByteArray=function(d){var v,y,g=f(d),m=g[0],w=g[1],p=new s(function(A,I,R){return 3*(I+R)/4-R}(0,m,w)),x=0,T=w>0?m-4:m;for(y=0;y<T;y+=4)v=n[d.charCodeAt(y)]<<18|n[d.charCodeAt(y+1)]<<12|n[d.charCodeAt(y+2)]<<6|n[d.charCodeAt(y+3)],p[x++]=v>>16&255,p[x++]=v>>8&255,p[x++]=255&v;return w===2&&(v=n[d.charCodeAt(y)]<<2|n[d.charCodeAt(y+1)]>>4,p[x++]=255&v),w===1&&(v=n[d.charCodeAt(y)]<<10|n[d.charCodeAt(y+1)]<<4|n[d.charCodeAt(y+2)]>>2,p[x++]=v>>8&255,p[x++]=255&v),p},i.fromByteArray=function(d){for(var v,y=d.length,g=y%3,m=[],w=0,p=y-g;w<p;w+=16383)m.push(h(d,w,w+16383>p?p:w+16383));return g===1?(v=d[y-1],m.push(o[v>>2]+o[v<<4&63]+"==")):g===2&&(v=(d[y-2]<<8)+d[y-1],m.push(o[v>>10]+o[v>>4&63]+o[v<<2&63]+"=")),m.join("")};for(var o=[],n=[],s=typeof Uint8Array<"u"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=u.length;c<l;++c)o[c]=u[c],n[u.charCodeAt(c)]=c;function f(d){var v=d.length;if(v%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var y=d.indexOf("=");return y===-1&&(y=v),[y,y===v?0:4-y%4]}function h(d,v,y){for(var g,m,w=[],p=v;p<y;p+=3)g=(d[p]<<16&16711680)+(d[p+1]<<8&65280)+(255&d[p+2]),w.push(o[(m=g)>>18&63]+o[m>>12&63]+o[m>>6&63]+o[63&m]);return w.join("")}n[45]=62,n[95]=63},{}],14:[function(r,a,i){const{Buffer:o}=r("buffer"),n=Symbol.for("BufferList");function s(u){if(!(this instanceof s))return new s(u);s._init.call(this,u)}s._init=function(u){Object.defineProperty(this,n,{value:!0}),this._bufs=[],this.length=0,u&&this.append(u)},s.prototype._new=function(u){return new s(u)},s.prototype._offset=function(u){if(u===0)return[0,0];let c=0;for(let l=0;l<this._bufs.length;l++){const f=c+this._bufs[l].length;if(u<f||l===this._bufs.length-1)return[l,u-c];c=f}},s.prototype._reverseOffset=function(u){const c=u[0];let l=u[1];for(let f=0;f<c;f++)l+=this._bufs[f].length;return l},s.prototype.get=function(u){if(u>this.length||u<0)return;const c=this._offset(u);return this._bufs[c[0]][c[1]]},s.prototype.slice=function(u,c){return typeof u=="number"&&u<0&&(u+=this.length),typeof c=="number"&&c<0&&(c+=this.length),this.copy(null,0,u,c)},s.prototype.copy=function(u,c,l,f){if((typeof l!="number"||l<0)&&(l=0),(typeof f!="number"||f>this.length)&&(f=this.length),l>=this.length||f<=0)return u||o.alloc(0);const h=!!u,d=this._offset(l),v=f-l;let y=v,g=h&&c||0,m=d[1];if(l===0&&f===this.length){if(!h)return this._bufs.length===1?this._bufs[0]:o.concat(this._bufs,this.length);for(let w=0;w<this._bufs.length;w++)this._bufs[w].copy(u,g),g+=this._bufs[w].length;return u}if(y<=this._bufs[d[0]].length-m)return h?this._bufs[d[0]].copy(u,c,m,m+y):this._bufs[d[0]].slice(m,m+y);h||(u=o.allocUnsafe(v));for(let w=d[0];w<this._bufs.length;w++){const p=this._bufs[w].length-m;if(!(y>p)){this._bufs[w].copy(u,g,m,m+y),g+=p;break}this._bufs[w].copy(u,g,m),g+=p,y-=p,m&&(m=0)}return u.length>g?u.slice(0,g):u},s.prototype.shallowSlice=function(u,c){if(u=u||0,c=typeof c!="number"?this.length:c,u<0&&(u+=this.length),c<0&&(c+=this.length),u===c)return this._new();const l=this._offset(u),f=this._offset(c),h=this._bufs.slice(l[0],f[0]+1);return f[1]===0?h.pop():h[h.length-1]=h[h.length-1].slice(0,f[1]),l[1]!==0&&(h[0]=h[0].slice(l[1])),this._new(h)},s.prototype.toString=function(u,c,l){return this.slice(c,l).toString(u)},s.prototype.consume=function(u){if(u=Math.trunc(u),Number.isNaN(u)||u<=0)return this;for(;this._bufs.length;){if(!(u>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(u),this.length-=u;break}u-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const u=this._new();for(let c=0;c<this._bufs.length;c++)u.append(this._bufs[c]);return u},s.prototype.append=function(u){if(u==null)return this;if(u.buffer)this._appendBuffer(o.from(u.buffer,u.byteOffset,u.byteLength));else if(Array.isArray(u))for(let c=0;c<u.length;c++)this.append(u[c]);else if(this._isBufferList(u))for(let c=0;c<u._bufs.length;c++)this.append(u._bufs[c]);else typeof u=="number"&&(u=u.toString()),this._appendBuffer(o.from(u));return this},s.prototype._appendBuffer=function(u){this._bufs.push(u),this.length+=u.length},s.prototype.indexOf=function(u,c,l){if(l===void 0&&typeof c=="string"&&(l=c,c=void 0),typeof u=="function"||Array.isArray(u))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof u=="number"?u=o.from([u]):typeof u=="string"?u=o.from(u,l):this._isBufferList(u)?u=u.slice():Array.isArray(u.buffer)?u=o.from(u.buffer,u.byteOffset,u.byteLength):o.isBuffer(u)||(u=o.from(u)),c=Number(c||0),isNaN(c)&&(c=0),c<0&&(c=this.length+c),c<0&&(c=0),u.length===0)return c>this.length?this.length:c;const f=this._offset(c);let h=f[0],d=f[1];for(;h<this._bufs.length;h++){const v=this._bufs[h];for(;d<v.length;)if(v.length-d>=u.length){const y=v.indexOf(u,d);if(y!==-1)return this._reverseOffset([h,y]);d=v.length-u.length+1}else{const y=this._reverseOffset([h,d]);if(this._match(y,u))return y;d++}d=0}return-1},s.prototype._match=function(u,c){if(this.length-u<c.length)return!1;for(let l=0;l<c.length;l++)if(this.get(u+l)!==c[l])return!1;return!0},function(){const u={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const c in u)(function(l){s.prototype[l]=u[l]===null?function(f,h){return this.slice(f,f+h)[l](0,h)}:function(f=0){return this.slice(f,f+u[l])[l](0)}})(c)}(),s.prototype._isBufferList=function(u){return u instanceof s||s.isBufferList(u)},s.isBufferList=function(u){return u!=null&&u[n]},a.exports=s},{buffer:17}],15:[function(r,a,i){const o=r("readable-stream").Duplex,n=r("inherits"),s=r("./BufferList");function u(c){if(!(this instanceof u))return new u(c);if(typeof c=="function"){this._callback=c;const l=(function(f){this._callback&&(this._callback(f),this._callback=null)}).bind(this);this.on("pipe",function(f){f.on("error",l)}),this.on("unpipe",function(f){f.removeListener("error",l)}),c=null}s._init.call(this,c),o.call(this)}n(u,o),Object.assign(u.prototype,s.prototype),u.prototype._new=function(c){return new u(c)},u.prototype._write=function(c,l,f){this._appendBuffer(c),typeof f=="function"&&f()},u.prototype._read=function(c){if(!this.length)return this.push(null);c=Math.min(c,this.length),this.push(this.slice(0,c)),this.consume(c)},u.prototype.end=function(c){o.prototype.end.call(this,c),this._callback&&(this._callback(null,this.slice()),this._callback=null)},u.prototype._destroy=function(c,l){this._bufs.length=0,this.length=0,l(c)},u.prototype._isBufferList=function(c){return c instanceof u||c instanceof s||u.isBufferList(c)},u.isBufferList=s.isBufferList,a.exports=u,a.exports.BufferListStream=u,a.exports.BufferList=s},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(r,a,i){},{}],17:[function(r,a,i){(function(o){(function(){var n=r("base64-js"),s=r("ieee754");i.Buffer=l,i.SlowBuffer=function(b){return+b!=b&&(b=0),l.alloc(+b)},i.INSPECT_MAX_BYTES=50;var u=2147483647;function c(b){if(b>u)throw new RangeError('The value "'+b+'" is invalid for option "size"');var C=new Uint8Array(b);return C.__proto__=l.prototype,C}function l(b,C,E){if(typeof b=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(b)}return f(b,C,E)}function f(b,C,E){if(typeof b=="string")return function($,G){if(typeof G=="string"&&G!==""||(G="utf8"),!l.isEncoding(G))throw new TypeError("Unknown encoding: "+G);var Z=0|g($,G),J=c(Z),ee=J.write($,G);return ee!==Z&&(J=J.slice(0,ee)),J}(b,C);if(ArrayBuffer.isView(b))return v(b);if(b==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b);if(K(b,ArrayBuffer)||b&&K(b.buffer,ArrayBuffer))return function($,G,Z){if(G<0||$.byteLength<G)throw new RangeError('"offset" is outside of buffer bounds');if($.byteLength<G+(Z||0))throw new RangeError('"length" is outside of buffer bounds');var J;return J=G===void 0&&Z===void 0?new Uint8Array($):Z===void 0?new Uint8Array($,G):new Uint8Array($,G,Z),J.__proto__=l.prototype,J}(b,C,E);if(typeof b=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var N=b.valueOf&&b.valueOf();if(N!=null&&N!==b)return l.from(N,C,E);var O=function($){if(l.isBuffer($)){var G=0|y($.length),Z=c(G);return Z.length===0||$.copy(Z,0,0,G),Z}if($.length!==void 0)return typeof $.length!="number"||X($.length)?c(0):v($);if($.type==="Buffer"&&Array.isArray($.data))return v($.data)}(b);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof b[Symbol.toPrimitive]=="function")return l.from(b[Symbol.toPrimitive]("string"),C,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b)}function h(b){if(typeof b!="number")throw new TypeError('"size" argument must be of type number');if(b<0)throw new RangeError('The value "'+b+'" is invalid for option "size"')}function d(b){return h(b),c(b<0?0:0|y(b))}function v(b){for(var C=b.length<0?0:0|y(b.length),E=c(C),N=0;N<C;N+=1)E[N]=255&b[N];return E}function y(b){if(b>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return 0|b}function g(b,C){if(l.isBuffer(b))return b.length;if(ArrayBuffer.isView(b)||K(b,ArrayBuffer))return b.byteLength;if(typeof b!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof b);var E=b.length,N=arguments.length>2&&arguments[2]===!0;if(!N&&E===0)return 0;for(var O=!1;;)switch(C){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return Y(b).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*E;case"hex":return E>>>1;case"base64":return q(b).length;default:if(O)return N?-1:Y(b).length;C=(""+C).toLowerCase(),O=!0}}function m(b,C,E){var N=b[C];b[C]=b[E],b[E]=N}function w(b,C,E,N,O){if(b.length===0)return-1;if(typeof E=="string"?(N=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),X(E=+E)&&(E=O?0:b.length-1),E<0&&(E=b.length+E),E>=b.length){if(O)return-1;E=b.length-1}else if(E<0){if(!O)return-1;E=0}if(typeof C=="string"&&(C=l.from(C,N)),l.isBuffer(C))return C.length===0?-1:p(b,C,E,N,O);if(typeof C=="number")return C&=255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(b,C,E):Uint8Array.prototype.lastIndexOf.call(b,C,E):p(b,[C],E,N,O);throw new TypeError("val must be string, number or Buffer")}function p(b,C,E,N,O){var $,G=1,Z=b.length,J=C.length;if(N!==void 0&&((N=String(N).toLowerCase())==="ucs2"||N==="ucs-2"||N==="utf16le"||N==="utf-16le")){if(b.length<2||C.length<2)return-1;G=2,Z/=2,J/=2,E/=2}function ee(ae,ie){return G===1?ae[ie]:ae.readUInt16BE(ie*G)}if(O){var te=-1;for($=E;$<Z;$++)if(ee(b,$)===ee(C,te===-1?0:$-te)){if(te===-1&&(te=$),$-te+1===J)return te*G}else te!==-1&&($-=$-te),te=-1}else for(E+J>Z&&(E=Z-J),$=E;$>=0;$--){for(var oe=!0,ne=0;ne<J;ne++)if(ee(b,$+ne)!==ee(C,ne)){oe=!1;break}if(oe)return $}return-1}function x(b,C,E,N){E=Number(E)||0;var O=b.length-E;N?(N=Number(N))>O&&(N=O):N=O;var $=C.length;N>$/2&&(N=$/2);for(var G=0;G<N;++G){var Z=parseInt(C.substr(2*G,2),16);if(X(Z))return G;b[E+G]=Z}return G}function T(b,C,E,N){return Q(Y(C,b.length-E),b,E,N)}function A(b,C,E,N){return Q(function(O){for(var $=[],G=0;G<O.length;++G)$.push(255&O.charCodeAt(G));return $}(C),b,E,N)}function I(b,C,E,N){return A(b,C,E,N)}function R(b,C,E,N){return Q(q(C),b,E,N)}function z(b,C,E,N){return Q(function(O,$){for(var G,Z,J,ee=[],te=0;te<O.length&&!(($-=2)<0);++te)G=O.charCodeAt(te),Z=G>>8,J=G%256,ee.push(J),ee.push(Z);return ee}(C,b.length-E),b,E,N)}function U(b,C,E){return C===0&&E===b.length?n.fromByteArray(b):n.fromByteArray(b.slice(C,E))}function _(b,C,E){E=Math.min(b.length,E);for(var N=[],O=C;O<E;){var $,G,Z,J,ee=b[O],te=null,oe=ee>239?4:ee>223?3:ee>191?2:1;if(O+oe<=E)switch(oe){case 1:ee<128&&(te=ee);break;case 2:(192&($=b[O+1]))==128&&(J=(31&ee)<<6|63&$)>127&&(te=J);break;case 3:$=b[O+1],G=b[O+2],(192&$)==128&&(192&G)==128&&(J=(15&ee)<<12|(63&$)<<6|63&G)>2047&&(J<55296||J>57343)&&(te=J);break;case 4:$=b[O+1],G=b[O+2],Z=b[O+3],(192&$)==128&&(192&G)==128&&(192&Z)==128&&(J=(15&ee)<<18|(63&$)<<12|(63&G)<<6|63&Z)>65535&&J<1114112&&(te=J)}te===null?(te=65533,oe=1):te>65535&&(te-=65536,N.push(te>>>10&1023|55296),te=56320|1023&te),N.push(te),O+=oe}return function(ne){var ae=ne.length;if(ae<=k)return String.fromCharCode.apply(String,ne);for(var ie="",se=0;se<ae;)ie+=String.fromCharCode.apply(String,ne.slice(se,se+=k));return ie}(N)}i.kMaxLength=u,l.TYPED_ARRAY_SUPPORT=function(){try{var b=new Uint8Array(1);return b.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},b.foo()===42}catch{return!1}}(),l.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),l.poolSize=8192,l.from=function(b,C,E){return f(b,C,E)},l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,l.alloc=function(b,C,E){return function(N,O,$){return h(N),N<=0?c(N):O!==void 0?typeof $=="string"?c(N).fill(O,$):c(N).fill(O):c(N)}(b,C,E)},l.allocUnsafe=function(b){return d(b)},l.allocUnsafeSlow=function(b){return d(b)},l.isBuffer=function(b){return b!=null&&b._isBuffer===!0&&b!==l.prototype},l.compare=function(b,C){if(K(b,Uint8Array)&&(b=l.from(b,b.offset,b.byteLength)),K(C,Uint8Array)&&(C=l.from(C,C.offset,C.byteLength)),!l.isBuffer(b)||!l.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(b===C)return 0;for(var E=b.length,N=C.length,O=0,$=Math.min(E,N);O<$;++O)if(b[O]!==C[O]){E=b[O],N=C[O];break}return E<N?-1:N<E?1:0},l.isEncoding=function(b){switch(String(b).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(b,C){if(!Array.isArray(b))throw new TypeError('"list" argument must be an Array of Buffers');if(b.length===0)return l.alloc(0);var E;if(C===void 0)for(C=0,E=0;E<b.length;++E)C+=b[E].length;var N=l.allocUnsafe(C),O=0;for(E=0;E<b.length;++E){var $=b[E];if(K($,Uint8Array)&&($=l.from($)),!l.isBuffer($))throw new TypeError('"list" argument must be an Array of Buffers');$.copy(N,O),O+=$.length}return N},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var b=this.length;if(b%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var C=0;C<b;C+=2)m(this,C,C+1);return this},l.prototype.swap32=function(){var b=this.length;if(b%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var C=0;C<b;C+=4)m(this,C,C+3),m(this,C+1,C+2);return this},l.prototype.swap64=function(){var b=this.length;if(b%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var C=0;C<b;C+=8)m(this,C,C+7),m(this,C+1,C+6),m(this,C+2,C+5),m(this,C+3,C+4);return this},l.prototype.toString=function(){var b=this.length;return b===0?"":arguments.length===0?_(this,0,b):(function(C,E,N){var O=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0)<=(E>>>=0))return"";for(C||(C="utf8");;)switch(C){case"hex":return B(this,E,N);case"utf8":case"utf-8":return _(this,E,N);case"ascii":return S(this,E,N);case"latin1":case"binary":return P(this,E,N);case"base64":return U(this,E,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,E,N);default:if(O)throw new TypeError("Unknown encoding: "+C);C=(C+"").toLowerCase(),O=!0}}).apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(b){if(!l.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||l.compare(this,b)===0},l.prototype.inspect=function(){var b="",C=i.INSPECT_MAX_BYTES;return b=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(b+=" ... "),"<Buffer "+b+">"},l.prototype.compare=function(b,C,E,N,O){if(K(b,Uint8Array)&&(b=l.from(b,b.offset,b.byteLength)),!l.isBuffer(b))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof b);if(C===void 0&&(C=0),E===void 0&&(E=b?b.length:0),N===void 0&&(N=0),O===void 0&&(O=this.length),C<0||E>b.length||N<0||O>this.length)throw new RangeError("out of range index");if(N>=O&&C>=E)return 0;if(N>=O)return-1;if(C>=E)return 1;if(C>>>=0,E>>>=0,N>>>=0,O>>>=0,this===b)return 0;for(var $=O-N,G=E-C,Z=Math.min($,G),J=this.slice(N,O),ee=b.slice(C,E),te=0;te<Z;++te)if(J[te]!==ee[te]){$=J[te],G=ee[te];break}return $<G?-1:G<$?1:0},l.prototype.includes=function(b,C,E){return this.indexOf(b,C,E)!==-1},l.prototype.indexOf=function(b,C,E){return w(this,b,C,E,!0)},l.prototype.lastIndexOf=function(b,C,E){return w(this,b,C,E,!1)},l.prototype.write=function(b,C,E,N){if(C===void 0)N="utf8",E=this.length,C=0;else if(E===void 0&&typeof C=="string")N=C,E=this.length,C=0;else{if(!isFinite(C))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");C>>>=0,isFinite(E)?(E>>>=0,N===void 0&&(N="utf8")):(N=E,E=void 0)}var O=this.length-C;if((E===void 0||E>O)&&(E=O),b.length>0&&(E<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var $=!1;;)switch(N){case"hex":return x(this,b,C,E);case"utf8":case"utf-8":return T(this,b,C,E);case"ascii":return A(this,b,C,E);case"latin1":case"binary":return I(this,b,C,E);case"base64":return R(this,b,C,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,b,C,E);default:if($)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),$=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(b,C,E){var N="";E=Math.min(b.length,E);for(var O=C;O<E;++O)N+=String.fromCharCode(127&b[O]);return N}function P(b,C,E){var N="";E=Math.min(b.length,E);for(var O=C;O<E;++O)N+=String.fromCharCode(b[O]);return N}function B(b,C,E){var N=b.length;(!C||C<0)&&(C=0),(!E||E<0||E>N)&&(E=N);for(var O="",$=C;$<E;++$)O+=V(b[$]);return O}function D(b,C,E){for(var N=b.slice(C,E),O="",$=0;$<N.length;$+=2)O+=String.fromCharCode(N[$]+256*N[$+1]);return O}function H(b,C,E){if(b%1!=0||b<0)throw new RangeError("offset is not uint");if(b+C>E)throw new RangeError("Trying to access beyond buffer length")}function L(b,C,E,N,O,$){if(!l.isBuffer(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>O||C<$)throw new RangeError('"value" argument is out of bounds');if(E+N>b.length)throw new RangeError("Index out of range")}function M(b,C,E,N,O,$){if(E+N>b.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function j(b,C,E,N,O){return C=+C,E>>>=0,O||M(b,0,E,4),s.write(b,C,E,N,23,4),E+4}function W(b,C,E,N,O){return C=+C,E>>>=0,O||M(b,0,E,8),s.write(b,C,E,N,52,8),E+8}l.prototype.slice=function(b,C){var E=this.length;b=~~b,C=C===void 0?E:~~C,b<0?(b+=E)<0&&(b=0):b>E&&(b=E),C<0?(C+=E)<0&&(C=0):C>E&&(C=E),C<b&&(C=b);var N=this.subarray(b,C);return N.__proto__=l.prototype,N},l.prototype.readUIntLE=function(b,C,E){b>>>=0,C>>>=0,E||H(b,C,this.length);for(var N=this[b],O=1,$=0;++$<C&&(O*=256);)N+=this[b+$]*O;return N},l.prototype.readUIntBE=function(b,C,E){b>>>=0,C>>>=0,E||H(b,C,this.length);for(var N=this[b+--C],O=1;C>0&&(O*=256);)N+=this[b+--C]*O;return N},l.prototype.readUInt8=function(b,C){return b>>>=0,C||H(b,1,this.length),this[b]},l.prototype.readUInt16LE=function(b,C){return b>>>=0,C||H(b,2,this.length),this[b]|this[b+1]<<8},l.prototype.readUInt16BE=function(b,C){return b>>>=0,C||H(b,2,this.length),this[b]<<8|this[b+1]},l.prototype.readUInt32LE=function(b,C){return b>>>=0,C||H(b,4,this.length),(this[b]|this[b+1]<<8|this[b+2]<<16)+16777216*this[b+3]},l.prototype.readUInt32BE=function(b,C){return b>>>=0,C||H(b,4,this.length),16777216*this[b]+(this[b+1]<<16|this[b+2]<<8|this[b+3])},l.prototype.readIntLE=function(b,C,E){b>>>=0,C>>>=0,E||H(b,C,this.length);for(var N=this[b],O=1,$=0;++$<C&&(O*=256);)N+=this[b+$]*O;return N>=(O*=128)&&(N-=Math.pow(2,8*C)),N},l.prototype.readIntBE=function(b,C,E){b>>>=0,C>>>=0,E||H(b,C,this.length);for(var N=C,O=1,$=this[b+--N];N>0&&(O*=256);)$+=this[b+--N]*O;return $>=(O*=128)&&($-=Math.pow(2,8*C)),$},l.prototype.readInt8=function(b,C){return b>>>=0,C||H(b,1,this.length),128&this[b]?-1*(255-this[b]+1):this[b]},l.prototype.readInt16LE=function(b,C){b>>>=0,C||H(b,2,this.length);var E=this[b]|this[b+1]<<8;return 32768&E?4294901760|E:E},l.prototype.readInt16BE=function(b,C){b>>>=0,C||H(b,2,this.length);var E=this[b+1]|this[b]<<8;return 32768&E?4294901760|E:E},l.prototype.readInt32LE=function(b,C){return b>>>=0,C||H(b,4,this.length),this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24},l.prototype.readInt32BE=function(b,C){return b>>>=0,C||H(b,4,this.length),this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]},l.prototype.readFloatLE=function(b,C){return b>>>=0,C||H(b,4,this.length),s.read(this,b,!0,23,4)},l.prototype.readFloatBE=function(b,C){return b>>>=0,C||H(b,4,this.length),s.read(this,b,!1,23,4)},l.prototype.readDoubleLE=function(b,C){return b>>>=0,C||H(b,8,this.length),s.read(this,b,!0,52,8)},l.prototype.readDoubleBE=function(b,C){return b>>>=0,C||H(b,8,this.length),s.read(this,b,!1,52,8)},l.prototype.writeUIntLE=function(b,C,E,N){b=+b,C>>>=0,E>>>=0,N||L(this,b,C,E,Math.pow(2,8*E)-1,0);var O=1,$=0;for(this[C]=255&b;++$<E&&(O*=256);)this[C+$]=b/O&255;return C+E},l.prototype.writeUIntBE=function(b,C,E,N){b=+b,C>>>=0,E>>>=0,N||L(this,b,C,E,Math.pow(2,8*E)-1,0);var O=E-1,$=1;for(this[C+O]=255&b;--O>=0&&($*=256);)this[C+O]=b/$&255;return C+E},l.prototype.writeUInt8=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,1,255,0),this[C]=255&b,C+1},l.prototype.writeUInt16LE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,2,65535,0),this[C]=255&b,this[C+1]=b>>>8,C+2},l.prototype.writeUInt16BE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,2,65535,0),this[C]=b>>>8,this[C+1]=255&b,C+2},l.prototype.writeUInt32LE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,4,4294967295,0),this[C+3]=b>>>24,this[C+2]=b>>>16,this[C+1]=b>>>8,this[C]=255&b,C+4},l.prototype.writeUInt32BE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,4,4294967295,0),this[C]=b>>>24,this[C+1]=b>>>16,this[C+2]=b>>>8,this[C+3]=255&b,C+4},l.prototype.writeIntLE=function(b,C,E,N){if(b=+b,C>>>=0,!N){var O=Math.pow(2,8*E-1);L(this,b,C,E,O-1,-O)}var $=0,G=1,Z=0;for(this[C]=255&b;++$<E&&(G*=256);)b<0&&Z===0&&this[C+$-1]!==0&&(Z=1),this[C+$]=(b/G>>0)-Z&255;return C+E},l.prototype.writeIntBE=function(b,C,E,N){if(b=+b,C>>>=0,!N){var O=Math.pow(2,8*E-1);L(this,b,C,E,O-1,-O)}var $=E-1,G=1,Z=0;for(this[C+$]=255&b;--$>=0&&(G*=256);)b<0&&Z===0&&this[C+$+1]!==0&&(Z=1),this[C+$]=(b/G>>0)-Z&255;return C+E},l.prototype.writeInt8=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,1,127,-128),b<0&&(b=255+b+1),this[C]=255&b,C+1},l.prototype.writeInt16LE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,2,32767,-32768),this[C]=255&b,this[C+1]=b>>>8,C+2},l.prototype.writeInt16BE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,2,32767,-32768),this[C]=b>>>8,this[C+1]=255&b,C+2},l.prototype.writeInt32LE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,4,2147483647,-2147483648),this[C]=255&b,this[C+1]=b>>>8,this[C+2]=b>>>16,this[C+3]=b>>>24,C+4},l.prototype.writeInt32BE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,4,2147483647,-2147483648),b<0&&(b=4294967295+b+1),this[C]=b>>>24,this[C+1]=b>>>16,this[C+2]=b>>>8,this[C+3]=255&b,C+4},l.prototype.writeFloatLE=function(b,C,E){return j(this,b,C,!0,E)},l.prototype.writeFloatBE=function(b,C,E){return j(this,b,C,!1,E)},l.prototype.writeDoubleLE=function(b,C,E){return W(this,b,C,!0,E)},l.prototype.writeDoubleBE=function(b,C,E){return W(this,b,C,!1,E)},l.prototype.copy=function(b,C,E,N){if(!l.isBuffer(b))throw new TypeError("argument should be a Buffer");if(E||(E=0),N||N===0||(N=this.length),C>=b.length&&(C=b.length),C||(C=0),N>0&&N<E&&(N=E),N===E||b.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),b.length-C<N-E&&(N=b.length-C+E);var O=N-E;if(this===b&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(C,E,N);else if(this===b&&E<C&&C<N)for(var $=O-1;$>=0;--$)b[$+C]=this[$+E];else Uint8Array.prototype.set.call(b,this.subarray(E,N),C);return O},l.prototype.fill=function(b,C,E,N){if(typeof b=="string"){if(typeof C=="string"?(N=C,C=0,E=this.length):typeof E=="string"&&(N=E,E=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!l.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(b.length===1){var O=b.charCodeAt(0);(N==="utf8"&&O<128||N==="latin1")&&(b=O)}}else typeof b=="number"&&(b&=255);if(C<0||this.length<C||this.length<E)throw new RangeError("Out of range index");if(E<=C)return this;var $;if(C>>>=0,E=E===void 0?this.length:E>>>0,b||(b=0),typeof b=="number")for($=C;$<E;++$)this[$]=b;else{var G=l.isBuffer(b)?b:l.from(b,N),Z=G.length;if(Z===0)throw new TypeError('The value "'+b+'" is invalid for argument "value"');for($=0;$<E-C;++$)this[$+C]=G[$%Z]}return this};var F=/[^+/0-9A-Za-z-_]/g;function V(b){return b<16?"0"+b.toString(16):b.toString(16)}function Y(b,C){var E;C=C||1/0;for(var N=b.length,O=null,$=[],G=0;G<N;++G){if((E=b.charCodeAt(G))>55295&&E<57344){if(!O){if(E>56319){(C-=3)>-1&&$.push(239,191,189);continue}if(G+1===N){(C-=3)>-1&&$.push(239,191,189);continue}O=E;continue}if(E<56320){(C-=3)>-1&&$.push(239,191,189),O=E;continue}E=65536+(O-55296<<10|E-56320)}else O&&(C-=3)>-1&&$.push(239,191,189);if(O=null,E<128){if((C-=1)<0)break;$.push(E)}else if(E<2048){if((C-=2)<0)break;$.push(E>>6|192,63&E|128)}else if(E<65536){if((C-=3)<0)break;$.push(E>>12|224,E>>6&63|128,63&E|128)}else{if(!(E<1114112))throw new Error("Invalid code point");if((C-=4)<0)break;$.push(E>>18|240,E>>12&63|128,E>>6&63|128,63&E|128)}}return $}function q(b){return n.toByteArray(function(C){if((C=(C=C.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;C.length%4!=0;)C+="=";return C}(b))}function Q(b,C,E,N){for(var O=0;O<N&&!(O+E>=C.length||O>=b.length);++O)C[O+E]=b[O];return O}function K(b,C){return b instanceof C||b!=null&&b.constructor!=null&&b.constructor.name!=null&&b.constructor.name===C.name}function X(b){return b!=b}}).call(this)}).call(this,r("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(r,a,i){(function(o){(function(){i.formatArgs=function(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+a.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;s.splice(1,0,u,"color: inherit");let c=0,l=0;s[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&f==="%c"&&(l=++c)}),s.splice(l,0,u)},i.save=function(s){try{s?i.storage.setItem("debug",s):i.storage.removeItem("debug")}catch{}},i.load=function(){let s;try{s=i.storage.getItem("debug")}catch{}return!s&&o!==void 0&&"env"in o&&(s=o.env.DEBUG),s},i.useColors=function(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},i.storage=function(){try{return localStorage}catch{}}(),i.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),i.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],i.log=console.debug||console.log||(()=>{}),a.exports=r("./common")(i);const{formatters:n}=a.exports;n.j=function(s){try{return JSON.stringify(s)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}).call(this)}).call(this,r("_process"))},{"./common":19,_process:50}],19:[function(r,a,i){a.exports=function(o){function n(c){let l,f,h,d=null;function v(...y){if(!v.enabled)return;const g=v,m=Number(new Date),w=m-(l||m);g.diff=w,g.prev=l,g.curr=m,l=m,y[0]=n.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let p=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(x,T)=>{if(x==="%%")return"%";p++;const A=n.formatters[T];if(typeof A=="function"){const I=y[p];x=A.call(g,I),y.splice(p,1),p--}return x}),n.formatArgs.call(g,y),(g.log||n.log).apply(g,y)}return v.namespace=c,v.useColors=n.useColors(),v.color=n.selectColor(c),v.extend=s,v.destroy=n.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==n.namespaces&&(f=n.namespaces,h=n.enabled(c)),h),set:y=>{d=y}}),typeof n.init=="function"&&n.init(v),v}function s(c,l){const f=n(this.namespace+(l===void 0?":":l)+c);return f.log=this.log,f}function u(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(c){return c instanceof Error?c.stack||c.message:c},n.disable=function(){const c=[...n.names.map(u),...n.skips.map(u).map(l=>"-"+l)].join(",");return n.enable(""),c},n.enable=function(c){let l;n.save(c),n.namespaces=c,n.names=[],n.skips=[];const f=(typeof c=="string"?c:"").split(/[\s,]+/),h=f.length;for(l=0;l<h;l++)f[l]&&((c=f[l].replace(/\*/g,".*?"))[0]==="-"?n.skips.push(new RegExp("^"+c.substr(1)+"$")):n.names.push(new RegExp("^"+c+"$")))},n.enabled=function(c){if(c[c.length-1]==="*")return!0;let l,f;for(l=0,f=n.skips.length;l<f;l++)if(n.skips[l].test(c))return!1;for(l=0,f=n.names.length;l<f;l++)if(n.names[l].test(c))return!0;return!1},n.humanize=r("ms"),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(o).forEach(c=>{n[c]=o[c]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(c){let l=0;for(let f=0;f<c.length;f++)l=(l<<5)-l+c.charCodeAt(f),l|=0;return n.colors[Math.abs(l)%n.colors.length]},n.enable(n.load()),n}},{ms:45}],20:[function(r,a,i){(function(o,n){(function(){var s=r("readable-stream"),u=r("end-of-stream"),c=r("inherits"),l=r("stream-shift"),f=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),h=function(g,m){g._corked?g.once("uncork",m):m()},d=function(g,m){return function(w){w?function(p,x){p._autoDestroy&&p.destroy(x)}(g,w.message==="premature close"?null:w):m&&!g._ended&&g.end()}},v=function(){},y=function(g,m,w){if(!(this instanceof y))return new y(g,m,w);s.Duplex.call(this,w),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!w||w.autoDestroy!==!1,this._forwardDestroy=!w||w.destroy!==!1,this._forwardEnd=!w||w.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,g&&this.setWritable(g),m&&this.setReadable(m)};c(y,s.Duplex),y.obj=function(g,m,w){return w||(w={}),w.objectMode=!0,w.highWaterMark=16,new y(g,m,w)},y.prototype.cork=function(){++this._corked==1&&this.emit("cork")},y.prototype.uncork=function(){this._corked&&--this._corked==0&&this.emit("uncork")},y.prototype.setWritable=function(g){if(this._unwrite&&this._unwrite(),this.destroyed)g&&g.destroy&&g.destroy();else if(g!==null&&g!==!1){var m=this,w=u(g,{writable:!0,readable:!1},d(this,this._forwardEnd)),p=function(){var x=m._ondrain;m._ondrain=null,x&&x()};this._unwrite&&o.nextTick(p),this._writable=g,this._writable.on("drain",p),this._unwrite=function(){m._writable.removeListener("drain",p),w()},this.uncork()}else this.end()},y.prototype.setReadable=function(g){if(this._unread&&this._unread(),this.destroyed)g&&g.destroy&&g.destroy();else{if(g===null||g===!1)return this.push(null),void this.resume();var m,w=this,p=u(g,{writable:!1,readable:!0},d(this)),x=function(){w._forward()},T=function(){w.push(null)};this._drained=!0,this._readable=g,this._readable2=g._readableState?g:(m=g,new s.Readable({objectMode:!0,highWaterMark:16}).wrap(m)),this._readable2.on("readable",x),this._readable2.on("end",T),this._unread=function(){w._readable2.removeListener("readable",x),w._readable2.removeListener("end",T),p()},this._forward()}},y.prototype._read=function(){this._drained=!0,this._forward()},y.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var g;for(this._forwarding=!0;this._drained&&(g=l(this._readable2))!==null;)this.destroyed||(this._drained=this.push(g));this._forwarding=!1}},y.prototype.destroy=function(g,m){if(m||(m=v),this.destroyed)return m(null);this.destroyed=!0;var w=this;o.nextTick(function(){w._destroy(g),m(null)})},y.prototype._destroy=function(g){if(g){var m=this._ondrain;this._ondrain=null,m?m(g):this.emit("error",g)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},y.prototype._write=function(g,m,w){if(!this.destroyed)return this._corked?h(this,this._write.bind(this,g,m,w)):g===f?this._finish(w):this._writable?void(this._writable.write(g)===!1?this._ondrain=w:this.destroyed||w()):w()},y.prototype._finish=function(g){var m=this;this.emit("preend"),h(this,function(){var w,p;w=m._forwardEnd&&m._writable,p=function(){m._writableState.prefinished===!1&&(m._writableState.prefinished=!0),m.emit("prefinish"),h(m,g)},w?w._writableState&&w._writableState.finished?p():w._writableState?w.end(p):(w.end(),p()):p()})},y.prototype.end=function(g,m,w){return typeof g=="function"?this.end(null,null,g):typeof m=="function"?this.end(g,null,m):(this._ended=!0,g&&this.write(g),this._writableState.ending||this._writableState.destroyed||this.write(f),s.Writable.prototype.end.call(this,w))},a.exports=y}).call(this)}).call(this,r("_process"),r("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(r,a,i){(function(o){(function(){var n=r("once"),s=function(){},u=function(c,l,f){if(typeof l=="function")return u(c,null,l);l||(l={}),f=n(f||s);var h=c._writableState,d=c._readableState,v=l.readable||l.readable!==!1&&c.readable,y=l.writable||l.writable!==!1&&c.writable,g=!1,m=function(){c.writable||w()},w=function(){y=!1,v||f.call(c)},p=function(){v=!1,y||f.call(c)},x=function(z){f.call(c,z?new Error("exited with error code: "+z):null)},T=function(z){f.call(c,z)},A=function(){o.nextTick(I)},I=function(){if(!g)return(!v||d&&d.ended&&!d.destroyed)&&(!y||h&&h.ended&&!h.destroyed)?void 0:f.call(c,new Error("premature close"))},R=function(){c.req.on("finish",w)};return function(z){return z.setHeader&&typeof z.abort=="function"}(c)?(c.on("complete",w),c.on("abort",A),c.req?R():c.on("request",R)):y&&!h&&(c.on("end",m),c.on("close",m)),function(z){return z.stdio&&Array.isArray(z.stdio)&&z.stdio.length===3}(c)&&c.on("exit",x),c.on("end",p),c.on("finish",w),l.error!==!1&&c.on("error",T),c.on("close",A),function(){g=!0,c.removeListener("complete",w),c.removeListener("abort",A),c.removeListener("request",R),c.req&&c.req.removeListener("finish",w),c.removeListener("end",m),c.removeListener("close",m),c.removeListener("finish",w),c.removeListener("exit",x),c.removeListener("end",p),c.removeListener("error",T),c.removeListener("close",A)}};a.exports=u}).call(this)}).call(this,r("_process"))},{_process:50,once:48}],22:[function(r,a,i){var o=Object.create||function(p){var x=function(){};return x.prototype=p,new x},n=Object.keys||function(p){var x=[];for(var T in p)Object.prototype.hasOwnProperty.call(p,T)&&x.push(T);return T},s=Function.prototype.bind||function(p){var x=this;return function(){return x.apply(p,arguments)}};function u(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=o(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}a.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._maxListeners=void 0;var c,l=10;try{var f={};Object.defineProperty&&Object.defineProperty(f,"x",{value:0}),c=f.x===0}catch{c=!1}function h(p){return p._maxListeners===void 0?u.defaultMaxListeners:p._maxListeners}function d(p,x,T,A){var I,R,z;if(typeof T!="function")throw new TypeError('"listener" argument must be a function');if((R=p._events)?(R.newListener&&(p.emit("newListener",x,T.listener?T.listener:T),R=p._events),z=R[x]):(R=p._events=o(null),p._eventsCount=0),z){if(typeof z=="function"?z=R[x]=A?[T,z]:[z,T]:A?z.unshift(T):z.push(T),!z.warned&&(I=h(p))&&I>0&&z.length>I){z.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+z.length+' "'+String(x)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');U.name="MaxListenersExceededWarning",U.emitter=p,U.type=x,U.count=z.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",U.name,U.message)}}else z=R[x]=T,++p._eventsCount;return p}function v(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var p=new Array(arguments.length),x=0;x<p.length;++x)p[x]=arguments[x];this.listener.apply(this.target,p)}}function y(p,x,T){var A={fired:!1,wrapFn:void 0,target:p,type:x,listener:T},I=s.call(v,A);return I.listener=T,A.wrapFn=I,I}function g(p,x,T){var A=p._events;if(!A)return[];var I=A[x];return I?typeof I=="function"?T?[I.listener||I]:[I]:T?function(R){for(var z=new Array(R.length),U=0;U<z.length;++U)z[U]=R[U].listener||R[U];return z}(I):w(I,I.length):[]}function m(p){var x=this._events;if(x){var T=x[p];if(typeof T=="function")return 1;if(T)return T.length}return 0}function w(p,x){for(var T=new Array(x),A=0;A<x;++A)T[A]=p[A];return T}c?Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(p){if(typeof p!="number"||p<0||p!=p)throw new TypeError('"defaultMaxListeners" must be a positive number');l=p}}):u.defaultMaxListeners=l,u.prototype.setMaxListeners=function(p){if(typeof p!="number"||p<0||isNaN(p))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=p,this},u.prototype.getMaxListeners=function(){return h(this)},u.prototype.emit=function(p){var x,T,A,I,R,z,U=p==="error";if(z=this._events)U=U&&z.error==null;else if(!U)return!1;if(U){if(arguments.length>1&&(x=arguments[1]),x instanceof Error)throw x;var _=new Error('Unhandled "error" event. ('+x+")");throw _.context=x,_}if(!(T=z[p]))return!1;var k=typeof T=="function";switch(A=arguments.length){case 1:(function(S,P,B){if(P)S.call(B);else for(var D=S.length,H=w(S,D),L=0;L<D;++L)H[L].call(B)})(T,k,this);break;case 2:(function(S,P,B,D){if(P)S.call(B,D);else for(var H=S.length,L=w(S,H),M=0;M<H;++M)L[M].call(B,D)})(T,k,this,arguments[1]);break;case 3:(function(S,P,B,D,H){if(P)S.call(B,D,H);else for(var L=S.length,M=w(S,L),j=0;j<L;++j)M[j].call(B,D,H)})(T,k,this,arguments[1],arguments[2]);break;case 4:(function(S,P,B,D,H,L){if(P)S.call(B,D,H,L);else for(var M=S.length,j=w(S,M),W=0;W<M;++W)j[W].call(B,D,H,L)})(T,k,this,arguments[1],arguments[2],arguments[3]);break;default:for(I=new Array(A-1),R=1;R<A;R++)I[R-1]=arguments[R];(function(S,P,B,D){if(P)S.apply(B,D);else for(var H=S.length,L=w(S,H),M=0;M<H;++M)L[M].apply(B,D)})(T,k,this,I)}return!0},u.prototype.addListener=function(p,x){return d(this,p,x,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(p,x){return d(this,p,x,!0)},u.prototype.once=function(p,x){if(typeof x!="function")throw new TypeError('"listener" argument must be a function');return this.on(p,y(this,p,x)),this},u.prototype.prependOnceListener=function(p,x){if(typeof x!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(p,y(this,p,x)),this},u.prototype.removeListener=function(p,x){var T,A,I,R,z;if(typeof x!="function")throw new TypeError('"listener" argument must be a function');if(!(A=this._events))return this;if(!(T=A[p]))return this;if(T===x||T.listener===x)--this._eventsCount==0?this._events=o(null):(delete A[p],A.removeListener&&this.emit("removeListener",p,T.listener||x));else if(typeof T!="function"){for(I=-1,R=T.length-1;R>=0;R--)if(T[R]===x||T[R].listener===x){z=T[R].listener,I=R;break}if(I<0)return this;I===0?T.shift():function(U,_){for(var k=_,S=k+1,P=U.length;S<P;k+=1,S+=1)U[k]=U[S];U.pop()}(T,I),T.length===1&&(A[p]=T[0]),A.removeListener&&this.emit("removeListener",p,z||x)}return this},u.prototype.removeAllListeners=function(p){var x,T,A;if(!(T=this._events))return this;if(!T.removeListener)return arguments.length===0?(this._events=o(null),this._eventsCount=0):T[p]&&(--this._eventsCount==0?this._events=o(null):delete T[p]),this;if(arguments.length===0){var I,R=n(T);for(A=0;A<R.length;++A)(I=R[A])!=="removeListener"&&this.removeAllListeners(I);return this.removeAllListeners("removeListener"),this._events=o(null),this._eventsCount=0,this}if(typeof(x=T[p])=="function")this.removeListener(p,x);else if(x)for(A=x.length-1;A>=0;A--)this.removeListener(p,x[A]);return this},u.prototype.listeners=function(p){return g(this,p,!0)},u.prototype.rawListeners=function(p){return g(this,p,!1)},u.listenerCount=function(p,x){return typeof p.listenerCount=="function"?p.listenerCount(x):m.call(p,x)},u.prototype.listenerCount=m,u.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(r,a,i){i.read=function(o,n,s,u,c){var l,f,h=8*c-u-1,d=(1<<h)-1,v=d>>1,y=-7,g=s?c-1:0,m=s?-1:1,w=o[n+g];for(g+=m,l=w&(1<<-y)-1,w>>=-y,y+=h;y>0;l=256*l+o[n+g],g+=m,y-=8);for(f=l&(1<<-y)-1,l>>=-y,y+=u;y>0;f=256*f+o[n+g],g+=m,y-=8);if(l===0)l=1-v;else{if(l===d)return f?NaN:1/0*(w?-1:1);f+=Math.pow(2,u),l-=v}return(w?-1:1)*f*Math.pow(2,l-u)},i.write=function(o,n,s,u,c,l){var f,h,d,v=8*l-c-1,y=(1<<v)-1,g=y>>1,m=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=u?0:l-1,p=u?1:-1,x=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(h=isNaN(n)?1:0,f=y):(f=Math.floor(Math.log(n)/Math.LN2),n*(d=Math.pow(2,-f))<1&&(f--,d*=2),(n+=f+g>=1?m/d:m*Math.pow(2,1-g))*d>=2&&(f++,d/=2),f+g>=y?(h=0,f=y):f+g>=1?(h=(n*d-1)*Math.pow(2,c),f+=g):(h=n*Math.pow(2,g-1)*Math.pow(2,c),f=0));c>=8;o[s+w]=255&h,w+=p,h/=256,c-=8);for(f=f<<c|h,v+=c;v>0;o[s+w]=255&f,w+=p,f/=256,v-=8);o[s+w-p]|=128*x}},{}],24:[function(r,a,i){typeof Object.create=="function"?a.exports=function(o,n){n&&(o.super_=n,o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:a.exports=function(o,n){if(n){o.super_=n;var s=function(){};s.prototype=n.prototype,o.prototype=new s,o.prototype.constructor=o}}},{}],25:[function(r,a,i){Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function n(s,u){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=s,this.value=u}return n.prototype.rotateLeft=function(){var s=this.parent,u=this.brother,c=this.leftChild,l=this.rightChild;if(!l)throw new Error("unknown error");var f=l.leftChild,h=l.rightChild;return s&&(s.leftChild===this?s.leftChild=l:s.rightChild===this&&(s.rightChild=l)),l.parent=s,l.brother=u,l.leftChild=this,l.rightChild=h,u&&(u.brother=l),this.parent=l,this.brother=h,this.leftChild=c,this.rightChild=f,h&&(h.parent=l,h.brother=this),c&&(c.parent=this,c.brother=f),f&&(f.parent=this,f.brother=c),l},n.prototype.rotateRight=function(){var s=this.parent,u=this.brother,c=this.leftChild;if(!c)throw new Error("unknown error");var l=this.rightChild,f=c.leftChild,h=c.rightChild;return s&&(s.leftChild===this?s.leftChild=c:s.rightChild===this&&(s.rightChild=c)),c.parent=s,c.brother=u,c.leftChild=f,c.rightChild=this,u&&(u.brother=c),f&&(f.parent=c,f.brother=this),this.parent=c,this.brother=f,this.leftChild=h,this.rightChild=l,h&&(h.parent=this,h.brother=l),l&&(l.parent=this,l.brother=h),c},n.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},n.TreeNodeColorType={red:!0,black:!1},n}();Object.freeze(o),i.default=o},{}],26:[function(r,a,i){var o=this&&this.__generator||function(s,u){var c,l,f,h,d={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return h={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function v(y){return function(g){return function(m){if(c)throw new TypeError("Generator is already executing.");for(;d;)try{if(c=1,l&&(f=2&m[0]?l.return:m[0]?l.throw||((f=l.return)&&f.call(l),0):l.next)&&!(f=f.call(l,m[1])).done)return f;switch(l=0,f&&(m=[2&m[0],f.value]),m[0]){case 0:case 1:f=m;break;case 4:return d.label++,{value:m[1],done:!1};case 5:d.label++,l=m[1],m=[0];continue;case 7:m=d.ops.pop(),d.trys.pop();continue;default:if(!(f=(f=d.trys).length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){d=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){d.label=m[1];break}if(m[0]===6&&d.label<f[1]){d.label=f[1],f=m;break}if(f&&d.label<f[2]){d.label=f[2],d.ops.push(m);break}f[2]&&d.ops.pop(),d.trys.pop();continue}m=u.call(s,d)}catch(w){m=[6,w],l=0}finally{c=f=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([y,g])}}};function n(s){var u=this;s===void 0&&(s=[]);var c=[],l=0,f=0,h=0,d=0,v=0,y=0;this.size=function(){return y},this.empty=function(){return y===0},this.clear=function(){l=h=f=d=v=y=0,m.call(this,n.bucketSize),y=0},this.front=function(){return c[l][f]},this.back=function(){return c[h][d]},this.forEach=function(w){if(!this.empty()){var p=0;if(l!==h){for(T=f;T<n.bucketSize;++T)w(c[l][T],p++);for(T=l+1;T<h;++T)for(var x=0;x<n.bucketSize;++x)w(c[T][x],p++);for(T=0;T<=d;++T)w(c[h][T],p++)}else for(var T=f;T<=d;++T)w(c[l][T],p++)}};var g=function(w){var p=l*n.bucketSize+f,x=p+w,T=h*n.bucketSize+d;if(x<p||x>T)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(x/n.bucketSize),curNodePointerIndex:x%n.bucketSize}};this.getElementByPos=function(w){var p=g(w),x=p.curNodeBucketIndex,T=p.curNodePointerIndex;return c[x][T]},this.eraseElementByPos=function(w){var p=this;if(w<0||w>y)throw new Error("pos should more than 0 and less than queue's size");if(w===0)this.popFront();else if(w===this.size())this.popBack();else{for(var x=[],T=w+1;T<y;++T)x.push(this.getElementByPos(T));this.cut(w),this.popBack(),x.forEach(function(A){return p.pushBack(A)})}},this.eraseElementByValue=function(w){if(!this.empty()){var p=[];this.forEach(function(A){A!==w&&p.push(A)});for(var x=p.length,T=0;T<x;++T)this.setElementByPos(T,p[T]);this.cut(x-1)}};var m=function(w){for(var p=[],x=w*n.sigma,T=Math.max(Math.ceil(x/n.bucketSize),2),A=0;A<T;++A)p.push(new Array(n.bucketSize));var I=Math.ceil(w/n.bucketSize),R=Math.floor(T/2)-Math.floor(I/2),z=R,U=0;if(this.size())for(A=0;A<I;++A){for(var _=0;_<n.bucketSize;++_)if(p[R+A][_]=this.front(),this.popFront(),this.empty()){z=R+A,U=_;break}if(this.empty())break}c=p,l=R,f=0,h=z,d=U,v=T,y=w};this.pushBack=function(w){this.empty()||(h===v-1&&d===n.bucketSize-1&&m.call(this,this.size()),d<n.bucketSize-1?++d:h<v-1&&(++h,d=0)),++y,c[h][d]=w},this.popBack=function(){this.empty()||(this.size()!==1&&(d>0?--d:l<h&&(--h,d=n.bucketSize-1)),y>0&&--y)},this.setElementByPos=function(w,p){var x=g(w),T=x.curNodeBucketIndex,A=x.curNodePointerIndex;c[T][A]=p},this.insert=function(w,p,x){var T=this;if(x===void 0&&(x=1),w===0)for(;x--;)this.pushFront(p);else if(w===this.size())for(;x--;)this.pushBack(p);else{for(var A=[],I=w;I<y;++I)A.push(this.getElementByPos(I));for(this.cut(w-1),I=0;I<x;++I)this.pushBack(p);A.forEach(function(R){return T.pushBack(R)})}},this.find=function(w){if(l===h){for(var p=f;p<=d;++p)if(c[l][p]===w)return!0;return!1}for(p=f;p<n.bucketSize;++p)if(c[l][p]===w)return!0;for(p=l+1;p<h;++p)for(var x=0;x<n.bucketSize;++x)if(c[p][x]===w)return!0;for(p=0;p<=d;++p)if(c[h][p]===w)return!0;return!1},this.reverse=function(){for(var w=0,p=y-1;w<p;){var x=this.getElementByPos(w);this.setElementByPos(w,this.getElementByPos(p)),this.setElementByPos(p,x),++w,--p}},this.unique=function(){if(!this.empty()){var w=[],p=this.front();this.forEach(function(T,A){A!==0&&T===p||(w.push(T),p=T)});for(var x=0;x<y;++x)this.setElementByPos(x,w[x]);this.cut(w.length-1)}},this.sort=function(w){var p=[];this.forEach(function(T){p.push(T)}),p.sort(w);for(var x=0;x<y;++x)this.setElementByPos(x,p[x])},this.pushFront=function(w){this.empty()||(l===0&&f===0&&m.call(this,this.size()),f>0?--f:l>0&&(--l,f=n.bucketSize-1)),++y,c[l][f]=w},this.popFront=function(){this.empty()||(this.size()!==1&&(f<n.bucketSize-1?++f:l<h&&(++l,f=0)),y>0&&--y)},this.shrinkToFit=function(){var w=this,p=[];this.forEach(function(I){p.push(I)});var x=p.length;c=[];for(var T=Math.ceil(x/n.bucketSize),A=0;A<T;++A)c.push(new Array(n.bucketSize));this.clear(),p.forEach(function(I){return w.pushBack(I)})},this.cut=function(w){if(w<0)this.clear();else{var p=g(w),x=p.curNodeBucketIndex,T=p.curNodePointerIndex;h=x,d=T,y=w+1}},this[Symbol.iterator]=function(){return function(){var w,p;return o(this,function(x){switch(x.label){case 0:if(y===0)return[2];if(l!==h)return[3,5];p=f,x.label=1;case 1:return p<=d?[4,c[l][p]]:[3,4];case 2:x.sent(),x.label=3;case 3:return++p,[3,1];case 4:return[2];case 5:p=f,x.label=6;case 6:return p<n.bucketSize?[4,c[l][p]]:[3,9];case 7:x.sent(),x.label=8;case 8:return++p,[3,6];case 9:p=l+1,x.label=10;case 10:if(!(p<h))return[3,15];w=0,x.label=11;case 11:return w<n.bucketSize?[4,c[p][w]]:[3,14];case 12:x.sent(),x.label=13;case 13:return++w,[3,11];case 14:return++p,[3,10];case 15:p=0,x.label=16;case 16:return p<=d?[4,c[h][p]]:[3,19];case 17:x.sent(),x.label=18;case 18:return++p,[3,16];case 19:return[2]}})}()},function(){var w=n.bucketSize;s.size?w=s.size():s.length&&(w=s.length);var p=w*n.sigma;v=Math.ceil(p/n.bucketSize),v=Math.max(v,3);for(var x=0;x<v;++x)c.push(new Array(n.bucketSize));var T=Math.ceil(w/n.bucketSize);l=Math.floor(v/2)-Math.floor(T/2),h=l,s.forEach(function(A){return u.pushBack(A)})}(),Object.freeze(this)}Object.defineProperty(i,"__esModule",{value:!0}),n.sigma=3,n.bucketSize=5e3,Object.freeze(n),i.default=n},{}],27:[function(r,a,i){var o=this&&this.__generator||function(l,f){var h,d,v,y,g={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(w){return function(p){return function(x){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,d&&(v=2&x[0]?d.return:x[0]?d.throw||((v=d.return)&&v.call(d),0):d.next)&&!(v=v.call(d,x[1])).done)return v;switch(d=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return g.label++,{value:x[1],done:!1};case 5:g.label++,d=x[1],x=[0];continue;case 7:x=g.ops.pop(),g.trys.pop();continue;default:if(!(v=(v=g.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){g=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){g.label=x[1];break}if(x[0]===6&&g.label<v[1]){g.label=v[1],v=x;break}if(v&&g.label<v[2]){g.label=v[2],g.ops.push(x);break}v[2]&&g.ops.pop(),g.trys.pop();continue}x=f.call(l,g)}catch(T){x=[6,T],d=0}finally{h=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([w,p])}}},n=this&&this.__values||function(l){var f=typeof Symbol=="function"&&Symbol.iterator,h=f&&l[f],d=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&d>=l.length&&(l=void 0),{value:l&&l[d++],done:!l}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i,"__esModule",{value:!0});var s=r("../LinkList/LinkList"),u=r("../Map/Map");function c(l,f,h){var d=this;if(l===void 0&&(l=[]),f===void 0&&(f=c.initSize),h=h||function(m){var w,p,x=0,T="";if(typeof m=="number")x=((x=Math.floor(m))<<5)-x,x&=x;else{T=typeof m!="string"?JSON.stringify(m):m;try{for(var A=n(T),I=A.next();!I.done;I=A.next())x=(x<<5)-x+I.value.charCodeAt(0),x&=x}catch(R){w={error:R}}finally{try{I&&!I.done&&(p=A.return)&&p.call(A)}finally{if(w)throw w.error}}}return x^=x>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var v=0,y=[],g=Math.max(c.initSize,Math.min(c.maxSize,f));this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,g=f,y=[]},this.forEach=function(m){var w=0;y.forEach(function(p){p.forEach(function(x){m(x,w++)})})},this.setElement=function(m,w){var p,x;if(m==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(w!=null){var T=h(m)&g-1;if(y[T]){var A=y[T].size();if(y[T]instanceof s.default){try{for(var I=n(y[T]),R=I.next();!R.done;R=I.next()){var z=R.value;if(z.key===m)return void(z.value=w)}}catch(_){p={error:_}}finally{try{R&&!R.done&&(x=I.return)&&x.call(I)}finally{if(p)throw p.error}}y[T].pushBack({key:m,value:w}),y[T].size()>=c.treeifyThreshold&&(y[T]=new u.default(y[T]))}else y[T].setElement(m,w);var U=y[T].size();v+=U-A}else++v,y[T]=new s.default([{key:m,value:w}]);v>g*c.sigma&&(function(_){if(!(_>=c.maxSize)){g=2*_;var k=[];y.forEach(function(S,P){if(!S.empty()){if(S instanceof s.default&&S.size()===1){var B=S.front(),D=B.key,H=B.value;k[h(D)&g-1]=new s.default([{key:D,value:H}])}else if(S instanceof u.default){var L=new s.default,M=new s.default;S.forEach(function(F){h(F.key)&_?M.pushBack(F):L.pushBack(F)}),L.size()>c.untreeifyThreshold?k[P]=new u.default(L):L.size()&&(k[P]=L),M.size()>c.untreeifyThreshold?k[P+_]=new u.default(M):M.size()&&(k[P+_]=M)}else{var j=new s.default,W=new s.default;S.forEach(function(F){h(F.key)&_?W.pushBack(F):j.pushBack(F)}),j.size()&&(k[P]=j),W.size()&&(k[P+_]=W)}y[P].clear()}}),y=k}}).call(this,g)}else this.eraseElementByKey(m)},this.getElementByKey=function(m){var w,p,x=h(m)&g-1;if(y[x]){if(y[x]instanceof u.default)return y[x].getElementByKey(m);try{for(var T=n(y[x]),A=T.next();!A.done;A=T.next()){var I=A.value;if(I.key===m)return I.value}}catch(R){w={error:R}}finally{try{A&&!A.done&&(p=T.return)&&p.call(T)}finally{if(w)throw w.error}}}},this.eraseElementByKey=function(m){var w,p,x=h(m)&g-1;if(y[x]){var T=y[x].size();if(y[x]instanceof u.default)y[x].eraseElementByKey(m),y[x].size()<=c.untreeifyThreshold&&(y[x]=new s.default(y[x]));else{var A=-1;try{for(var I=n(y[x]),R=I.next();!R.done;R=I.next())if(++A,R.value.key===m){y[x].eraseElementByPos(A);break}}catch(U){w={error:U}}finally{try{R&&!R.done&&(p=I.return)&&p.call(I)}finally{if(w)throw w.error}}}var z=y[x].size();v+=z-T}},this.find=function(m){var w,p,x=h(m)&g-1;if(!y[x])return!1;if(y[x]instanceof u.default)return y[x].find(m);try{for(var T=n(y[x]),A=T.next();!A.done;A=T.next())if(A.value.key===m)return!0}catch(I){w={error:I}}finally{try{A&&!A.done&&(p=T.return)&&p.call(T)}finally{if(w)throw w.error}}return!1},this[Symbol.iterator]=function(){return function(){var m,w,p,x,T,A;return o(this,function(I){switch(I.label){case 0:m=0,I.label=1;case 1:if(!(m<g))return[3,10];for(;m<g&&!y[m];)++m;if(m>=g)return[3,10];I.label=2;case 2:I.trys.push([2,7,8,9]),T=void 0,w=n(y[m]),p=w.next(),I.label=3;case 3:return p.done?[3,6]:[4,p.value];case 4:I.sent(),I.label=5;case 5:return p=w.next(),[3,3];case 6:return[3,9];case 7:return x=I.sent(),T={error:x},[3,9];case 8:try{p&&!p.done&&(A=w.return)&&A.call(w)}finally{if(T)throw T.error}return[7];case 9:return++m,[3,1];case 10:return[2]}})}()},l.forEach(function(m){var w=m.key,p=m.value;return d.setElement(w,p)}),Object.freeze(this)}c.initSize=16,c.maxSize=1<<30,c.sigma=.75,c.treeifyThreshold=8,c.untreeifyThreshold=6,c.minTreeifySize=64,Object.freeze(c),i.default=c},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(r,a,i){var o=this&&this.__generator||function(l,f){var h,d,v,y,g={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(w){return function(p){return function(x){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,d&&(v=2&x[0]?d.return:x[0]?d.throw||((v=d.return)&&v.call(d),0):d.next)&&!(v=v.call(d,x[1])).done)return v;switch(d=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return g.label++,{value:x[1],done:!1};case 5:g.label++,d=x[1],x=[0];continue;case 7:x=g.ops.pop(),g.trys.pop();continue;default:if(!(v=(v=g.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){g=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){g.label=x[1];break}if(x[0]===6&&g.label<v[1]){g.label=v[1],v=x;break}if(v&&g.label<v[2]){g.label=v[2],g.ops.push(x);break}v[2]&&g.ops.pop(),g.trys.pop();continue}x=f.call(l,g)}catch(T){x=[6,T],d=0}finally{h=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([w,p])}}},n=this&&this.__values||function(l){var f=typeof Symbol=="function"&&Symbol.iterator,h=f&&l[f],d=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&d>=l.length&&(l=void 0),{value:l&&l[d++],done:!l}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i,"__esModule",{value:!0});var s=r("../Set/Set"),u=r("../LinkList/LinkList");function c(l,f,h){var d=this;if(l===void 0&&(l=[]),f===void 0&&(f=c.initSize),h=h||function(m){var w=0,p="";if(typeof m=="number")w=((w=Math.floor(m))<<5)-w,w&=w;else{p=typeof m!="string"?JSON.stringify(m):m;for(var x=0;x<p.length;x++)w=(w<<5)-w+p.charCodeAt(x),w&=w}return w^=w>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var v=0,y=[],g=Math.max(c.initSize,Math.min(c.maxSize,f));this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,g=f,y=[]},this.forEach=function(m){var w=0;y.forEach(function(p){p.forEach(function(x){m(x,w++)})})},this.insert=function(m){if(m==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var w=h(m)&g-1;if(y[w]){var p=y[w].size();if(y[w]instanceof u.default){if(y[w].find(m))return;y[w].pushBack(m),y[w].size()>=c.treeifyThreshold&&(y[w]=new s.default(y[w]))}else y[w].insert(m);var x=y[w].size();v+=x-p}else y[w]=new u.default([m]),++v;v>g*c.sigma&&(function(T){if(!(T>=c.maxSize)){g=2*T;var A=[];y.forEach(function(I,R){if(!I.empty()){if(I instanceof u.default&&I.size()===1){var z=I.front();if(z===void 0)throw new Error("unknown error");A[h(z)&g-1]=new u.default([z])}else if(I instanceof s.default){var U=new u.default,_=new u.default;I.forEach(function(P){h(P)&T?_.pushBack(P):U.pushBack(P)}),U.size()>c.untreeifyThreshold?A[R]=new s.default(U):U.size()&&(A[R]=U),_.size()>c.untreeifyThreshold?A[R+T]=new s.default(_):_.size()&&(A[R+T]=_)}else{var k=new u.default,S=new u.default;I.forEach(function(P){h(P)&T?S.pushBack(P):k.pushBack(P)}),k.size()&&(A[R]=k),S.size()&&(A[R+T]=S)}y[R].clear()}}),y=A}}).call(this,g)},this.eraseElementByValue=function(m){var w=h(m)&g-1;if(y[w]){var p=y[w].size();y[w].eraseElementByValue(m),y[w]instanceof s.default&&y[w].size()<=c.untreeifyThreshold&&(y[w]=new u.default(y[w]));var x=y[w].size();v+=x-p}},this.find=function(m){var w=h(m)&g-1;return!!y[w]&&y[w].find(m)},this[Symbol.iterator]=function(){return function(){var m,w,p,x,T,A;return o(this,function(I){switch(I.label){case 0:m=0,I.label=1;case 1:if(!(m<g))return[3,10];for(;m<g&&!y[m];)++m;if(m>=g)return[3,10];I.label=2;case 2:I.trys.push([2,7,8,9]),T=void 0,w=n(y[m]),p=w.next(),I.label=3;case 3:return p.done?[3,6]:[4,p.value];case 4:I.sent(),I.label=5;case 5:return p=w.next(),[3,3];case 6:return[3,9];case 7:return x=I.sent(),T={error:x},[3,9];case 8:try{p&&!p.done&&(A=w.return)&&A.call(w)}finally{if(T)throw T.error}return[7];case 9:return++m,[3,1];case 10:return[2]}})}()},l.forEach(function(m){return d.insert(m)}),Object.freeze(this)}c.initSize=16,c.maxSize=1<<30,c.sigma=.75,c.treeifyThreshold=8,c.untreeifyThreshold=6,c.minTreeifySize=64,Object.freeze(c),i.default=c},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(r,a,i){var o=this&&this.__generator||function(u,c){var l,f,h,d,v={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]};return d={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function y(g){return function(m){return function(w){if(l)throw new TypeError("Generator is already executing.");for(;v;)try{if(l=1,f&&(h=2&w[0]?f.return:w[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,w[1])).done)return h;switch(f=0,h&&(w=[2&w[0],h.value]),w[0]){case 0:case 1:h=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,f=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(!(h=(h=v.trys).length>0&&h[h.length-1])&&(w[0]===6||w[0]===2)){v=0;continue}if(w[0]===3&&(!h||w[1]>h[0]&&w[1]<h[3])){v.label=w[1];break}if(w[0]===6&&v.label<h[1]){v.label=h[1],h=w;break}if(h&&v.label<h[2]){v.label=h[2],v.ops.push(w);break}h[2]&&v.ops.pop(),v.trys.pop();continue}w=c.call(u,v)}catch(p){w=[6,p],f=0}finally{l=h=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}([g,m])}}};Object.defineProperty(i,"__esModule",{value:!0});var n=function(){return function(u){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=u}}();function s(u){var c=this;u===void 0&&(u=[]);var l=0,f=void 0,h=void 0;this.size=function(){return l},this.empty=function(){return l===0},this.clear=function(){f=h=void 0,l=0},this.front=function(){return f==null?void 0:f.value},this.back=function(){return h==null?void 0:h.value},this.forEach=function(d){for(var v=f,y=0;v;){if(v.value===void 0)throw new Error("unknown error");d(v.value,y++),v=v.next}},this.getElementByPos=function(d){if(d<0||d>=l)throw new Error("pos must more then 0 and less then the list length");for(var v=f;d--&&v;)v=v.next;if(!v||v.value===void 0)throw new Error("unknown error");return v.value},this.eraseElementByPos=function(d){if(d<0||d>=l)throw new Error("erase pos must more then 0 and less then the list length");if(d===0)this.popFront();else if(d===l-1)this.popBack();else{for(var v=f;d--;){if(!(v!=null&&v.next))throw new Error("unknown error");v=v.next}if(!v||!v.pre||!v.next)throw new Error("unknown error");var y=v.pre,g=v.next;g.pre=y,y.next=g,l>0&&--l}},this.eraseElementByValue=function(d){for(;f&&f.value===d;)this.popFront();for(;h&&h.value===d;)this.popBack();if(f)for(var v=f;v;){if(v.value===d){var y=v.pre,g=v.next;g&&(g.pre=y),y&&(y.next=g),l>0&&--l}v=v.next}},this.pushBack=function(d){if(d==null)throw new Error("you can't push null or undefined here");++l;var v=new n(d);h?(h.next=v,v.pre=h,h=v):f=h=v},this.popBack=function(){h&&(l>0&&--l,h&&(f===h?f=h=void 0:(h=h.pre)&&(h.next=void 0)))},this.setElementByPos=function(d,v){if(v==null)throw new Error("you can't set null or undefined here");if(d<0||d>=l)throw new Error("pos must more then 0 and less then the list length");for(var y=f;d--;){if(!y)throw new Error("unknown error");y=y.next}y&&(y.value=v)},this.insert=function(d,v,y){if(y===void 0&&(y=1),v==null)throw new Error("you can't insert null or undefined here");if(d<0||d>l)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(y<0)throw new Error("insert size must more than 0");if(d===0)for(;y--;)this.pushFront(v);else if(d===l)for(;y--;)this.pushBack(v);else{for(var g=f,m=1;m<d;++m){if(!(g!=null&&g.next))throw new Error("unknown error");g=g==null?void 0:g.next}if(!g)throw new Error("unknown error");var w=g.next;for(l+=y;y--;)g.next=new n(v),g.next.pre=g,g=g.next;g.next=w,w&&(w.pre=g)}},this.find=function(d){for(var v=f;v;){if(v.value===d)return!0;v=v.next}return!1},this.reverse=function(){for(var d=f,v=h,y=0;d&&v&&2*y<l;){var g=d.value;d.value=v.value,v.value=g,d=d.next,v=v.pre,++y}},this.unique=function(){for(var d=f;d;){for(var v=d;v&&v.next&&v.value===v.next.value;)v=v.next,l>0&&--l;d.next=v.next,d.next&&(d.next.pre=d),d=d.next}},this.sort=function(d){var v=[];this.forEach(function(g){v.push(g)}),v.sort(d);var y=f;v.forEach(function(g){y&&(y.value=g,y=y.next)})},this.pushFront=function(d){if(d==null)throw new Error("you can't push null or undefined here");++l;var v=new n(d);f?(v.next=f,f.pre=v,f=v):f=h=v},this.popFront=function(){f&&(l>0&&--l,f&&(f===h?f=h=void 0:(f=f.next)&&(f.pre=void 0)))},this.merge=function(d){var v=this,y=f;d.forEach(function(g){for(;y&&y.value!==void 0&&y.value<=g;)y=y.next;if(y===void 0)v.pushBack(g),y=h;else if(y===f)v.pushFront(g),y=f;else{++l;var m=y.pre;m&&(m.next=new n(g),m.next.pre=m,m.next.next=y,y&&(y.pre=m.next))}})},this[Symbol.iterator]=function(){return function(){var d;return o(this,function(v){switch(v.label){case 0:d=f,v.label=1;case 1:if(d===void 0)return[3,3];if(!d.value)throw new Error("unknown error");return[4,d.value];case 2:return v.sent(),d=d.next,[3,1];case 3:return[2]}})}()},u.forEach(function(d){return c.pushBack(d)}),Object.freeze(this)}Object.freeze(s),i.default=s},{}],30:[function(r,a,i){var o=this&&this.__generator||function(c,l){var f,h,d,v,y={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return v={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function g(m){return function(w){return function(p){if(f)throw new TypeError("Generator is already executing.");for(;y;)try{if(f=1,h&&(d=2&p[0]?h.return:p[0]?h.throw||((d=h.return)&&d.call(h),0):h.next)&&!(d=d.call(h,p[1])).done)return d;switch(h=0,d&&(p=[2&p[0],d.value]),p[0]){case 0:case 1:d=p;break;case 4:return y.label++,{value:p[1],done:!1};case 5:y.label++,h=p[1],p=[0];continue;case 7:p=y.ops.pop(),y.trys.pop();continue;default:if(!(d=(d=y.trys).length>0&&d[d.length-1])&&(p[0]===6||p[0]===2)){y=0;continue}if(p[0]===3&&(!d||p[1]>d[0]&&p[1]<d[3])){y.label=p[1];break}if(p[0]===6&&y.label<d[1]){y.label=d[1],d=p;break}if(d&&y.label<d[2]){y.label=d[2],y.ops.push(p);break}d[2]&&y.ops.pop(),y.trys.pop();continue}p=l.call(c,y)}catch(x){p=[6,x],h=0}finally{f=d=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([m,w])}}},n=this&&this.__values||function(c){var l=typeof Symbol=="function"&&Symbol.iterator,f=l&&c[l],h=0;if(f)return f.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&h>=c.length&&(c=void 0),{value:c&&c[h++],done:!c}}};throw new TypeError(l?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i,"__esModule",{value:!0});var s=r("../Base/TreeNode");function u(c,l){var f=this;c===void 0&&(c=[]),l=l||function(_,k){return _<k?-1:_>k?1:0};var h=0,d=new s.default;d.color=s.default.TreeNodeColorType.black,this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){h=0,d.key=d.value=void 0,d.leftChild=d.rightChild=d.brother=void 0};var v=function(_){if(!_||_.key===void 0)throw new Error("unknown error");return _.leftChild?v(_.leftChild):_},y=function(_){if(!_||_.key===void 0)throw new Error("unknown error");return _.rightChild?y(_.rightChild):_};this.front=function(){if(!this.empty()){var _=v(d);if(_.key===void 0||_.value===void 0)throw new Error("unknown error");return{key:_.key,value:_.value}}},this.back=function(){if(!this.empty()){var _=y(d);if(_.key===void 0||_.value===void 0)throw new Error("unknown error");return{key:_.key,value:_.value}}},this.forEach=function(_){var k,S,P=0;try{for(var B=n(this),D=B.next();!D.done;D=B.next())_(D.value,P++)}catch(H){k={error:H}}finally{try{D&&!D.done&&(S=B.return)&&S.call(B)}finally{if(k)throw k.error}}},this.getElementByPos=function(_){var k,S;if(_<0||_>=this.size())throw new Error("pos must more than 0 and less than set's size");var P=0;try{for(var B=n(this),D=B.next();!D.done;D=B.next()){var H=D.value;if(P===_)return H;++P}}catch(L){k={error:L}}finally{try{D&&!D.done&&(S=B.return)&&S.call(B)}finally{if(k)throw k.error}}throw new Error("unknown Error")};var g=function(_,k){if(_&&_.key!==void 0&&_.value!==void 0){var S=l(_.key,k);return S===0?{key:_.key,value:_.value}:S<0?g(_.rightChild,k):g(_.leftChild,k)||{key:_.key,value:_.value}}};this.lowerBound=function(_){return g(d,_)};var m=function(_,k){if(_&&_.key!==void 0&&_.value!==void 0)return l(_.key,k)<=0?m(_.rightChild,k):m(_.leftChild,k)||{key:_.key,value:_.value}};this.upperBound=function(_){return m(d,_)};var w=function(_,k){if(_&&_.key!==void 0&&_.value!==void 0){var S=l(_.key,k);return S===0?{key:_.key,value:_.value}:S>0?w(_.leftChild,k):w(_.rightChild,k)||{key:_.key,value:_.value}}};this.reverseLowerBound=function(_){return w(d,_)};var p=function(_,k){if(_&&_.key!==void 0&&_.value!==void 0)return l(_.key,k)>=0?p(_.leftChild,k):p(_.rightChild,k)||{key:_.key,value:_.value}};this.reverseUpperBound=function(_){return p(d,_)};var x=function(_){var k=_.parent;if(!k){if(_===d)return;throw new Error("unknown error")}if(_.color!==s.default.TreeNodeColorType.red){var S=_.brother;if(!S)throw new Error("unknown error");if(_===k.leftChild)if(S.color===s.default.TreeNodeColorType.red){S.color=s.default.TreeNodeColorType.black,k.color=s.default.TreeNodeColorType.red;var P=k.rotateLeft();d===k&&(d=P),x(_)}else S.color===s.default.TreeNodeColorType.black&&(S.rightChild&&S.rightChild.color===s.default.TreeNodeColorType.red?(S.color=k.color,k.color=s.default.TreeNodeColorType.black,S.rightChild&&(S.rightChild.color=s.default.TreeNodeColorType.black),P=k.rotateLeft(),d===k&&(d=P),_.color=s.default.TreeNodeColorType.black):S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||!S.leftChild||S.leftChild.color!==s.default.TreeNodeColorType.red?S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||(S.color=s.default.TreeNodeColorType.red,x(k)):(S.color=s.default.TreeNodeColorType.red,S.leftChild&&(S.leftChild.color=s.default.TreeNodeColorType.black),P=S.rotateRight(),d===S&&(d=P),x(_)));else _===k.rightChild&&(S.color===s.default.TreeNodeColorType.red?(S.color=s.default.TreeNodeColorType.black,k.color=s.default.TreeNodeColorType.red,P=k.rotateRight(),d===k&&(d=P),x(_)):S.color===s.default.TreeNodeColorType.black&&(S.leftChild&&S.leftChild.color===s.default.TreeNodeColorType.red?(S.color=k.color,k.color=s.default.TreeNodeColorType.black,S.leftChild&&(S.leftChild.color=s.default.TreeNodeColorType.black),P=k.rotateRight(),d===k&&(d=P),_.color=s.default.TreeNodeColorType.black):S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||!S.rightChild||S.rightChild.color!==s.default.TreeNodeColorType.red?S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||(S.color=s.default.TreeNodeColorType.red,x(k)):(S.color=s.default.TreeNodeColorType.red,S.rightChild&&(S.rightChild.color=s.default.TreeNodeColorType.black),P=S.rotateLeft(),d===S&&(d=P),x(_))))}else _.color=s.default.TreeNodeColorType.black},T=function(_){for(var k=_;k.leftChild||k.rightChild;){if(k.rightChild){k=v(k.rightChild);var S=_.key;_.key=k.key,k.key=S;var P=_.value;_.value=k.value,k.value=P,_=k}k.leftChild&&(k=y(k.leftChild),S=_.key,_.key=k.key,k.key=S,P=_.value,_.value=k.value,k.value=P,_=k)}x(k),k&&k.remove(),--h,d.color=s.default.TreeNodeColorType.black},A=function(_,k){return!(!_||_.key===void 0)&&(!!A(_.leftChild,k)||!!k(_)||A(_.rightChild,k))};this.eraseElementByPos=function(_){if(_<0||_>=h)throw new Error("pos must more than 0 and less than set's size");var k=0;A(d,function(S){return _===k?(T(S),!0):(++k,!1)})},this.eraseElementByKey=function(_){if(!this.empty()){var k=z(d,_);k!==void 0&&k.key!==void 0&&l(k.key,_)===0&&T(k)}};var I=function(_,k){if(!_||_.key===void 0)throw new Error("unknown error");var S=l(k,_.key);return S<0?_.leftChild?I(_.leftChild,k):(_.leftChild=new s.default,_.leftChild.parent=_,_.leftChild.brother=_.rightChild,_.rightChild&&(_.rightChild.brother=_.leftChild),_.leftChild):S>0?_.rightChild?I(_.rightChild,k):(_.rightChild=new s.default,_.rightChild.parent=_,_.rightChild.brother=_.leftChild,_.leftChild&&(_.leftChild.brother=_.rightChild),_.rightChild):_},R=function(_){var k=_.parent;if(!k){if(_===d)return;throw new Error("unknown error")}if(k.color!==s.default.TreeNodeColorType.black&&k.color===s.default.TreeNodeColorType.red){var S=k.brother,P=k.parent;if(!P)throw new Error("unknown error");if(S&&S.color===s.default.TreeNodeColorType.red)S.color=k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red,R(P);else if(!S||S.color===s.default.TreeNodeColorType.black)if(k===P.leftChild)if(_===k.leftChild){k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red;var B=P.rotateRight();P===d&&(d=B)}else _===k.rightChild&&(B=k.rotateLeft(),P===d&&(d=B),R(k));else k===P.rightChild&&(_===k.leftChild?(B=k.rotateRight(),P===d&&(d=B),R(k)):_===k.rightChild&&(k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red,B=P.rotateLeft(),P===d&&(d=B)))}};this.setElement=function(_,k){if(_==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(k!=null){if(this.empty())return++h,d.key=_,d.value=k,void(d.color=s.default.TreeNodeColorType.black);var S=I(d,_);S.key===void 0||l(S.key,_)!==0?(++h,S.key=_,S.value=k,R(S),d.color=s.default.TreeNodeColorType.black):S.value=k}else this.eraseElementByKey(_)};var z=function(_,k){if(_&&_.key!==void 0){var S=l(k,_.key);return S<0?z(_.leftChild,k):S>0?z(_.rightChild,k):_}};this.find=function(_){return!!z(d,_)},this.getElementByKey=function(_){var k=z(d,_);if((k==null?void 0:k.key)===void 0||(k==null?void 0:k.value)===void 0)throw new Error("unknown error");return k.value},this.union=function(_){var k=this;_.forEach(function(S){var P=S.key,B=S.value;return k.setElement(P,B)})},this.getHeight=function(){if(this.empty())return 0;var _=function(k){return k?Math.max(_(k.leftChild),_(k.rightChild))+1:1};return _(d)};var U=function(_){return o(this,function(k){switch(k.label){case 0:return _&&_.key!==void 0&&_.value!==void 0?[5,n(U(_.leftChild))]:[2];case 1:return k.sent(),[4,{key:_.key,value:_.value}];case 2:return k.sent(),[5,n(U(_.rightChild))];case 3:return k.sent(),[2]}})};this[Symbol.iterator]=function(){return U(d)},c.forEach(function(_){var k=_.key,S=_.value;return f.setElement(k,S)}),Object.freeze(this)}Object.freeze(u),i.default=u},{"../Base/TreeNode":25}],31:[function(r,a,i){function o(n,s){n===void 0&&(n=[]),s=s||function(h,d){return h>d?-1:h<d?1:0};var u=[];n.forEach(function(h){return u.push(h)});var c=u.length,l=function(h,d){if(h<0||h>=c)throw new Error("unknown error");if(d<0||d>=c)throw new Error("unknown error");var v=u[h];u[h]=u[d],u[d]=v},f=function(h){if(h<0||h>=c)throw new Error("unknown error");var d=2*h+1,v=2*h+2;d<c&&s(u[h],u[d])>0&&l(h,d),v<c&&s(u[h],u[v])>0&&l(h,v)};(function(){for(var h=Math.floor((c-1)/2);h>=0;--h)for(var d=h,v=2*d+1;v<c;){var y=v+1,g=v;if(y<c&&s(u[v],u[y])>0&&(g=y),s(u[d],u[g])<=0)break;l(d,g),v=2*(d=g)+1}})(),this.size=function(){return c},this.empty=function(){return c===0},this.clear=function(){c=0,u.length=0},this.push=function(h){if(u.push(h),++c!==1)for(var d=c-1;d>0;){var v=Math.floor((d-1)/2);if(s(u[v],h)<=0)break;f(v),d=v}},this.pop=function(){if(!this.empty())if(this.size()!==1){var h=u[c-1];--c;for(var d=0;d<this.size();){var v=2*d+1,y=2*d+2;if(v>=this.size())break;var g=v;if(y<this.size()&&s(u[v],u[y])>0&&(g=y),s(u[g],h)>=0)break;u[d]=u[g],d=g}u[d]=h}else--c},this.top=function(){return u[0]},Object.freeze(this)}Object.defineProperty(i,"__esModule",{value:!0}),Object.freeze(o),i.default=o},{}],32:[function(r,a,i){Object.defineProperty(i,"__esModule",{value:!0});var o=r("../LinkList/LinkList");function n(s){s===void 0&&(s=[]);var u=new o.default(s);this.size=function(){return u.size()},this.empty=function(){return u.empty()},this.clear=function(){u.clear()},this.push=function(c){u.pushBack(c)},this.pop=function(){u.popFront()},this.front=function(){return u.front()},Object.freeze(this)}Object.freeze(n),i.default=n},{"../LinkList/LinkList":29}],33:[function(r,a,i){var o=this&&this.__generator||function(c,l){var f,h,d,v,y={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return v={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function g(m){return function(w){return function(p){if(f)throw new TypeError("Generator is already executing.");for(;y;)try{if(f=1,h&&(d=2&p[0]?h.return:p[0]?h.throw||((d=h.return)&&d.call(h),0):h.next)&&!(d=d.call(h,p[1])).done)return d;switch(h=0,d&&(p=[2&p[0],d.value]),p[0]){case 0:case 1:d=p;break;case 4:return y.label++,{value:p[1],done:!1};case 5:y.label++,h=p[1],p=[0];continue;case 7:p=y.ops.pop(),y.trys.pop();continue;default:if(!(d=(d=y.trys).length>0&&d[d.length-1])&&(p[0]===6||p[0]===2)){y=0;continue}if(p[0]===3&&(!d||p[1]>d[0]&&p[1]<d[3])){y.label=p[1];break}if(p[0]===6&&y.label<d[1]){y.label=d[1],d=p;break}if(d&&y.label<d[2]){y.label=d[2],y.ops.push(p);break}d[2]&&y.ops.pop(),y.trys.pop();continue}p=l.call(c,y)}catch(x){p=[6,x],h=0}finally{f=d=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([m,w])}}},n=this&&this.__values||function(c){var l=typeof Symbol=="function"&&Symbol.iterator,f=l&&c[l],h=0;if(f)return f.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&h>=c.length&&(c=void 0),{value:c&&c[h++],done:!c}}};throw new TypeError(l?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i,"__esModule",{value:!0});var s=r("../Base/TreeNode");function u(c,l){var f=this;c===void 0&&(c=[]),l=l||function(_,k){return _<k?-1:_>k?1:0};var h=0,d=new s.default;d.color=s.default.TreeNodeColorType.black,this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){h=0,d.key=void 0,d.leftChild=d.rightChild=d.brother=d.parent=void 0,d.color=s.default.TreeNodeColorType.black};var v=function(_){if(!_||_.key===void 0)throw new Error("unknown error");return _.leftChild?v(_.leftChild):_},y=function(_){if(!_||_.key===void 0)throw new Error("unknown error");return _.rightChild?y(_.rightChild):_};this.front=function(){if(!this.empty())return v(d).key},this.back=function(){if(!this.empty())return y(d).key},this.forEach=function(_){var k,S,P=0;try{for(var B=n(this),D=B.next();!D.done;D=B.next())_(D.value,P++)}catch(H){k={error:H}}finally{try{D&&!D.done&&(S=B.return)&&S.call(B)}finally{if(k)throw k.error}}},this.getElementByPos=function(_){var k,S;if(_<0||_>=this.size())throw new Error("pos must more than 0 and less than set's size");var P=0;try{for(var B=n(this),D=B.next();!D.done;D=B.next()){var H=D.value;if(P===_)return H;++P}}catch(L){k={error:L}}finally{try{D&&!D.done&&(S=B.return)&&S.call(B)}finally{if(k)throw k.error}}throw new Error("unknown error")};var g=function(_){var k=_.parent;if(!k){if(_===d)return;throw new Error("unknown error")}if(_.color!==s.default.TreeNodeColorType.red){var S=_.brother;if(!S)throw new Error("unknown error");if(_===k.leftChild)if(S.color===s.default.TreeNodeColorType.red){S.color=s.default.TreeNodeColorType.black,k.color=s.default.TreeNodeColorType.red;var P=k.rotateLeft();d===k&&(d=P),g(_)}else S.color===s.default.TreeNodeColorType.black&&(S.rightChild&&S.rightChild.color===s.default.TreeNodeColorType.red?(S.color=k.color,k.color=s.default.TreeNodeColorType.black,S.rightChild&&(S.rightChild.color=s.default.TreeNodeColorType.black),P=k.rotateLeft(),d===k&&(d=P),_.color=s.default.TreeNodeColorType.black):S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||!S.leftChild||S.leftChild.color!==s.default.TreeNodeColorType.red?S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||(S.color=s.default.TreeNodeColorType.red,g(k)):(S.color=s.default.TreeNodeColorType.red,S.leftChild&&(S.leftChild.color=s.default.TreeNodeColorType.black),P=S.rotateRight(),d===S&&(d=P),g(_)));else _===k.rightChild&&(S.color===s.default.TreeNodeColorType.red?(S.color=s.default.TreeNodeColorType.black,k.color=s.default.TreeNodeColorType.red,P=k.rotateRight(),d===k&&(d=P),g(_)):S.color===s.default.TreeNodeColorType.black&&(S.leftChild&&S.leftChild.color===s.default.TreeNodeColorType.red?(S.color=k.color,k.color=s.default.TreeNodeColorType.black,S.leftChild&&(S.leftChild.color=s.default.TreeNodeColorType.black),P=k.rotateRight(),d===k&&(d=P),_.color=s.default.TreeNodeColorType.black):S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||!S.rightChild||S.rightChild.color!==s.default.TreeNodeColorType.red?S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||(S.color=s.default.TreeNodeColorType.red,g(k)):(S.color=s.default.TreeNodeColorType.red,S.rightChild&&(S.rightChild.color=s.default.TreeNodeColorType.black),P=S.rotateLeft(),d===S&&(d=P),g(_))))}else _.color=s.default.TreeNodeColorType.black},m=function(_){for(var k=_;k.leftChild||k.rightChild;){if(k.rightChild){k=v(k.rightChild);var S=_.key;_.key=k.key,k.key=S,_=k}k.leftChild&&(k=y(k.leftChild),S=_.key,_.key=k.key,k.key=S,_=k)}g(k),k&&k.remove(),--h,d.color=s.default.TreeNodeColorType.black},w=function(_,k){return!(!_||_.key===void 0)&&(!!w(_.leftChild,k)||!!k(_)||w(_.rightChild,k))};this.eraseElementByPos=function(_){if(_<0||_>=h)throw new Error("pos must more than 0 and less than set's size");var k=0;w(d,function(S){return _===k?(m(S),!0):(++k,!1)})},this.eraseElementByValue=function(_){if(!this.empty()){var k=T(d,_);k!==void 0&&k.key!==void 0&&l(k.key,_)===0&&m(k)}};var p=function(_,k){if(!_||_.key===void 0)throw new Error("unknown error");var S=l(k,_.key);return S<0?_.leftChild?p(_.leftChild,k):(_.leftChild=new s.default,_.leftChild.parent=_,_.leftChild.brother=_.rightChild,_.rightChild&&(_.rightChild.brother=_.leftChild),_.leftChild):S>0?_.rightChild?p(_.rightChild,k):(_.rightChild=new s.default,_.rightChild.parent=_,_.rightChild.brother=_.leftChild,_.leftChild&&(_.leftChild.brother=_.rightChild),_.rightChild):_},x=function(_){var k=_.parent;if(!k){if(_===d)return;throw new Error("unknown error")}if(k.color!==s.default.TreeNodeColorType.black&&k.color===s.default.TreeNodeColorType.red){var S=k.brother,P=k.parent;if(!P)throw new Error("unknown error");if(S&&S.color===s.default.TreeNodeColorType.red)S.color=k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red,x(P);else if(!S||S.color===s.default.TreeNodeColorType.black)if(k===P.leftChild)if(_===k.leftChild){k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red;var B=P.rotateRight();P===d&&(d=B)}else _===k.rightChild&&(B=k.rotateLeft(),P===d&&(d=B),x(k));else k===P.rightChild&&(_===k.leftChild?(B=k.rotateRight(),P===d&&(d=B),x(k)):_===k.rightChild&&(k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red,B=P.rotateLeft(),P===d&&(d=B)))}};this.insert=function(_){if(_==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++h,d.key=_,void(d.color=s.default.TreeNodeColorType.black);var k=p(d,_);k.key!==void 0&&l(k.key,_)===0||(++h,k.key=_,x(k),d.color=s.default.TreeNodeColorType.black)};var T=function(_,k){if(_&&_.key!==void 0){var S=l(k,_.key);return S<0?T(_.leftChild,k):S>0?T(_.rightChild,k):_}};this.find=function(_){var k=T(d,_);return k!==void 0&&k.key!==void 0&&l(k.key,_)===0};var A=function(_,k){if(_&&_.key!==void 0){var S=l(_.key,k);if(S===0)return _.key;if(S<0)return A(_.rightChild,k);var P=A(_.leftChild,k);return P!==void 0?P:_.key}};this.lowerBound=function(_){return A(d,_)};var I=function(_,k){if(_&&_.key!==void 0){if(l(_.key,k)<=0)return I(_.rightChild,k);var S=I(_.leftChild,k);return S!==void 0?S:_.key}};this.upperBound=function(_){return I(d,_)};var R=function(_,k){if(_&&_.key!==void 0){var S=l(_.key,k);if(S===0)return _.key;if(S>0)return R(_.leftChild,k);var P=R(_.rightChild,k);return P!==void 0?P:_.key}};this.reverseLowerBound=function(_){return R(d,_)};var z=function(_,k){if(_&&_.key!==void 0){if(l(_.key,k)>=0)return z(_.leftChild,k);var S=z(_.rightChild,k);return S!==void 0?S:_.key}};this.reverseUpperBound=function(_){return z(d,_)},this.union=function(_){var k=this;_.forEach(function(S){return k.insert(S)})},this.getHeight=function(){if(this.empty())return 0;var _=function(k){return k?Math.max(_(k.leftChild),_(k.rightChild))+1:1};return _(d)};var U=function(_){return o(this,function(k){switch(k.label){case 0:return _&&_.key!==void 0?[5,n(U(_.leftChild))]:[2];case 1:return k.sent(),[4,_.key];case 2:return k.sent(),[5,n(U(_.rightChild))];case 3:return k.sent(),[2]}})};this[Symbol.iterator]=function(){return U(d)},c.forEach(function(_){return f.insert(_)}),Object.freeze(this)}Object.freeze(u),i.default=u},{"../Base/TreeNode":25}],34:[function(r,a,i){function o(n){var s=this;n===void 0&&(n=[]);var u=0,c=[];this.size=function(){return u},this.empty=function(){return u===0},this.clear=function(){u=0,c.length=0},this.push=function(l){c.push(l),++u},this.pop=function(){c.pop(),u>0&&--u},this.top=function(){return c[u-1]},n.forEach(function(l){return s.push(l)}),Object.freeze(this)}Object.defineProperty(i,"__esModule",{value:!0}),Object.freeze(o),i.default=o},{}],35:[function(r,a,i){var o=this&&this.__generator||function(l,f){var h,d,v,y,g={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(w){return function(p){return function(x){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,d&&(v=2&x[0]?d.return:x[0]?d.throw||((v=d.return)&&v.call(d),0):d.next)&&!(v=v.call(d,x[1])).done)return v;switch(d=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return g.label++,{value:x[1],done:!1};case 5:g.label++,d=x[1],x=[0];continue;case 7:x=g.ops.pop(),g.trys.pop();continue;default:if(!(v=(v=g.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){g=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){g.label=x[1];break}if(x[0]===6&&g.label<v[1]){g.label=v[1],v=x;break}if(v&&g.label<v[2]){g.label=v[2],g.ops.push(x);break}v[2]&&g.ops.pop(),g.trys.pop();continue}x=f.call(l,g)}catch(T){x=[6,T],d=0}finally{h=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([w,p])}}},n=this&&this.__read||function(l,f){var h=typeof Symbol=="function"&&l[Symbol.iterator];if(!h)return l;var d,v,y=h.call(l),g=[];try{for(;(f===void 0||f-- >0)&&!(d=y.next()).done;)g.push(d.value)}catch(m){v={error:m}}finally{try{d&&!d.done&&(h=y.return)&&h.call(y)}finally{if(v)throw v.error}}return g},s=this&&this.__spreadArray||function(l,f,h){if(h||arguments.length===2)for(var d,v=0,y=f.length;v<y;v++)!d&&v in f||(d||(d=Array.prototype.slice.call(f,0,v)),d[v]=f[v]);return l.concat(d||Array.prototype.slice.call(f))},u=this&&this.__values||function(l){var f=typeof Symbol=="function"&&Symbol.iterator,h=f&&l[f],d=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&d>=l.length&&(l=void 0),{value:l&&l[d++],done:!l}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};function c(l){var f=this;l===void 0&&(l=[]);var h=0,d=[];this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){h=0,d.length=0},this.front=function(){if(!this.empty())return d[0]},this.back=function(){if(!this.empty())return d[h-1]},this.forEach=function(v){d.forEach(v)},this.getElementByPos=function(v){if(v<0||v>=h)throw new Error("pos must more than 0 and less than vector's size");return d[v]},this.eraseElementByPos=function(v){if(v<0||v>=h)throw new Error("pos must more than 0 and less than vector's size");for(var y=v;y<h-1;++y)d[y]=d[y+1];this.popBack()},this.eraseElementByValue=function(v){var y=[];this.forEach(function(m){m!==v&&y.push(m)}),y.forEach(function(m,w){d[w]=m});for(var g=y.length;h>g;)this.popBack()},this.pushBack=function(v){d.push(v),++h},this.popBack=function(){d.pop(),h>0&&--h},this.setElementByPos=function(v,y){if(v<0||v>=h)throw new Error("pos must more than 0 and less than vector's size");d[v]=y},this.insert=function(v,y,g){if(g===void 0&&(g=1),v<0||v>h)throw new Error("pos must more than 0 and less than or equal to vector's size");d.splice.apply(d,s([v,0],n(new Array(g).fill(y)),!1)),h+=g},this.find=function(v){return d.includes(v)},this.reverse=function(){d.reverse()},this.unique=function(){var v,y=[];this.forEach(function(m,w){w!==0&&m===v||(y.push(m),v=m)}),y.forEach(function(m,w){d[w]=m});for(var g=y.length;h>g;)this.popBack()},this.sort=function(v){d.sort(v)},this[Symbol.iterator]=function(){return function(){return o(this,function(v){switch(v.label){case 0:return[5,u(d)];case 1:return[2,v.sent()]}})}()},l.forEach(function(v){return f.pushBack(v)}),Object.freeze(this)}Object.defineProperty(i,"__esModule",{value:!0}),Object.freeze(c),i.default=c},{}],36:[function(r,a,i){Object.defineProperty(i,"__esModule",{value:!0}),i.HashMap=i.HashSet=i.Map=i.Set=i.PriorityQueue=i.Deque=i.LinkList=i.Queue=i.Stack=i.Vector=void 0;var o=r("./Vector/Vector");i.Vector=o.default;var n=r("./Stack/Stack");i.Stack=n.default;var s=r("./Queue/Queue");i.Queue=s.default;var u=r("./LinkList/LinkList");i.LinkList=u.default;var c=r("./Deque/Deque");i.Deque=c.default;var l=r("./PriorityQueue/PriorityQueue");i.PriorityQueue=l.default;var f=r("./Set/Set");i.Set=f.default;var h=r("./Map/Map");i.Map=h.default;var d=r("./HashSet/HashSet");i.HashSet=d.default;var v=r("./HashMap/HashMap");i.HashMap=v.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(r,a,i){const o=r("yallist"),n=Symbol("max"),s=Symbol("length"),u=Symbol("lengthCalculator"),c=Symbol("allowStale"),l=Symbol("maxAge"),f=Symbol("dispose"),h=Symbol("noDisposeOnSet"),d=Symbol("lruList"),v=Symbol("cache"),y=Symbol("updateAgeOnGet"),g=()=>1,m=(I,R,z)=>{const U=I[v].get(R);if(U){const _=U.value;if(w(I,_)){if(x(I,U),!I[c])return}else z&&(I[y]&&(U.value.now=Date.now()),I[d].unshiftNode(U));return _.value}},w=(I,R)=>{if(!R||!R.maxAge&&!I[l])return!1;const z=Date.now()-R.now;return R.maxAge?z>R.maxAge:I[l]&&z>I[l]},p=I=>{if(I[s]>I[n])for(let R=I[d].tail;I[s]>I[n]&&R!==null;){const z=R.prev;x(I,R),R=z}},x=(I,R)=>{if(R){const z=R.value;I[f]&&I[f](z.key,z.value),I[s]-=z.length,I[v].delete(z.key),I[d].removeNode(R)}};class T{constructor(R,z,U,_,k){this.key=R,this.value=z,this.length=U,this.now=_,this.maxAge=k||0}}const A=(I,R,z,U)=>{let _=z.value;w(I,_)&&(x(I,z),I[c]||(_=void 0)),_&&R.call(U,_.value,_.key,I)};a.exports=class{constructor(I){if(typeof I=="number"&&(I={max:I}),I||(I={}),I.max&&(typeof I.max!="number"||I.max<0))throw new TypeError("max must be a non-negative number");this[n]=I.max||1/0;const R=I.length||g;if(this[u]=typeof R!="function"?g:R,this[c]=I.stale||!1,I.maxAge&&typeof I.maxAge!="number")throw new TypeError("maxAge must be a number");this[l]=I.maxAge||0,this[f]=I.dispose,this[h]=I.noDisposeOnSet||!1,this[y]=I.updateAgeOnGet||!1,this.reset()}set max(I){if(typeof I!="number"||I<0)throw new TypeError("max must be a non-negative number");this[n]=I||1/0,p(this)}get max(){return this[n]}set allowStale(I){this[c]=!!I}get allowStale(){return this[c]}set maxAge(I){if(typeof I!="number")throw new TypeError("maxAge must be a non-negative number");this[l]=I,p(this)}get maxAge(){return this[l]}set lengthCalculator(I){typeof I!="function"&&(I=g),I!==this[u]&&(this[u]=I,this[s]=0,this[d].forEach(R=>{R.length=this[u](R.value,R.key),this[s]+=R.length})),p(this)}get lengthCalculator(){return this[u]}get length(){return this[s]}get itemCount(){return this[d].length}rforEach(I,R){R=R||this;for(let z=this[d].tail;z!==null;){const U=z.prev;A(this,I,z,R),z=U}}forEach(I,R){R=R||this;for(let z=this[d].head;z!==null;){const U=z.next;A(this,I,z,R),z=U}}keys(){return this[d].toArray().map(I=>I.key)}values(){return this[d].toArray().map(I=>I.value)}reset(){this[f]&&this[d]&&this[d].length&&this[d].forEach(I=>this[f](I.key,I.value)),this[v]=new Map,this[d]=new o,this[s]=0}dump(){return this[d].map(I=>!w(this,I)&&{k:I.key,v:I.value,e:I.now+(I.maxAge||0)}).toArray().filter(I=>I)}dumpLru(){return this[d]}set(I,R,z){if((z=z||this[l])&&typeof z!="number")throw new TypeError("maxAge must be a number");const U=z?Date.now():0,_=this[u](R,I);if(this[v].has(I)){if(_>this[n])return x(this,this[v].get(I)),!1;const S=this[v].get(I).value;return this[f]&&(this[h]||this[f](I,S.value)),S.now=U,S.maxAge=z,S.value=R,this[s]+=_-S.length,S.length=_,this.get(I),p(this),!0}const k=new T(I,R,_,U,z);return k.length>this[n]?(this[f]&&this[f](I,R),!1):(this[s]+=k.length,this[d].unshift(k),this[v].set(I,this[d].head),p(this),!0)}has(I){if(!this[v].has(I))return!1;const R=this[v].get(I).value;return!w(this,R)}get(I){return m(this,I,!0)}peek(I){return m(this,I,!1)}pop(){const I=this[d].tail;return I?(x(this,I),I.value):null}del(I){x(this,this[v].get(I))}load(I){this.reset();const R=Date.now();for(let z=I.length-1;z>=0;z--){const U=I[z],_=U.e||0;if(_===0)this.set(U.k,U.v);else{const k=_-R;k>0&&this.set(U.k,U.v,k)}}}prune(){this[v].forEach((I,R)=>m(this,R,!1))}}},{yallist:83}],38:[function(r,a,i){(function(o){(function(){const n=a.exports;n.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},n.codes={};for(const u in n.types){const c=n.types[u];n.codes[c]=u}n.CMD_SHIFT=4,n.CMD_MASK=240,n.DUP_MASK=8,n.QOS_MASK=3,n.QOS_SHIFT=1,n.RETAIN_MASK=1,n.VARBYTEINT_MASK=127,n.VARBYTEINT_FIN_MASK=128,n.VARBYTEINT_MAX=268435455,n.SESSIONPRESENT_MASK=1,n.SESSIONPRESENT_HEADER=o.from([n.SESSIONPRESENT_MASK]),n.CONNACK_HEADER=o.from([n.codes.connack<<n.CMD_SHIFT]),n.USERNAME_MASK=128,n.PASSWORD_MASK=64,n.WILL_RETAIN_MASK=32,n.WILL_QOS_MASK=24,n.WILL_QOS_SHIFT=3,n.WILL_FLAG_MASK=4,n.CLEAN_SESSION_MASK=2,n.CONNECT_HEADER=o.from([n.codes.connect<<n.CMD_SHIFT]),n.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},n.propertiesCodes={};for(const u in n.properties){const c=n.properties[u];n.propertiesCodes[c]=u}function s(u){return[0,1,2].map(c=>[0,1].map(l=>[0,1].map(f=>{const h=o.alloc(1);return h.writeUInt8(n.codes[u]<<n.CMD_SHIFT|(l?n.DUP_MASK:0)|c<<n.QOS_SHIFT|f,0,!0),h})))}n.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},n.PUBLISH_HEADER=s("publish"),n.SUBSCRIBE_HEADER=s("subscribe"),n.SUBSCRIBE_OPTIONS_QOS_MASK=3,n.SUBSCRIBE_OPTIONS_NL_MASK=1,n.SUBSCRIBE_OPTIONS_NL_SHIFT=2,n.SUBSCRIBE_OPTIONS_RAP_MASK=1,n.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,n.SUBSCRIBE_OPTIONS_RH_MASK=3,n.SUBSCRIBE_OPTIONS_RH_SHIFT=4,n.SUBSCRIBE_OPTIONS_RH=[0,16,32],n.SUBSCRIBE_OPTIONS_NL=4,n.SUBSCRIBE_OPTIONS_RAP=8,n.SUBSCRIBE_OPTIONS_QOS=[0,1,2],n.UNSUBSCRIBE_HEADER=s("unsubscribe"),n.ACKS={unsuback:s("unsuback"),puback:s("puback"),pubcomp:s("pubcomp"),pubrel:s("pubrel"),pubrec:s("pubrec")},n.SUBACK_HEADER=o.from([n.codes.suback<<n.CMD_SHIFT]),n.VERSION3=o.from([3]),n.VERSION4=o.from([4]),n.VERSION5=o.from([5]),n.VERSION131=o.from([131]),n.VERSION132=o.from([132]),n.QOS=[0,1,2].map(u=>o.from([u])),n.EMPTY={pingreq:o.from([n.codes.pingreq<<4,0]),pingresp:o.from([n.codes.pingresp<<4,0]),disconnect:o.from([n.codes.disconnect<<4,0])}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],39:[function(r,a,i){(function(o){(function(){const n=r("./writeToStream"),s=r("events");class u extends s{constructor(){super(),this._array=new Array(20),this._i=0}write(l){return this._array[this._i++]=l,!0}concat(){let l=0;const f=new Array(this._array.length),h=this._array;let d,v=0;for(d=0;d<h.length&&h[d]!==void 0;d++)typeof h[d]!="string"?f[d]=h[d].length:f[d]=o.byteLength(h[d]),l+=f[d];const y=o.allocUnsafe(l);for(d=0;d<h.length&&h[d]!==void 0;d++)typeof h[d]!="string"?(h[d].copy(y,v),v+=f[d]):(y.write(h[d],v),v+=f[d]);return y}}a.exports=function(c,l){const f=new u;return n(c,f,l),f.concat()}}).call(this)}).call(this,r("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(r,a,i){i.parser=r("./parser").parser,i.generate=r("./generate"),i.writeToStream=r("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(r,a,i){(function(o){(function(){const s={},u=o.isBuffer(o.from([1,2]).subarray(0,1));function c(l){const f=o.allocUnsafe(2);return f.writeUInt8(l>>8,0),f.writeUInt8(255&l,1),f}a.exports={cache:s,generateCache:function(){for(let l=0;l<65536;l++)s[l]=c(l)},generateNumber:c,genBufVariableByteInt:function(l){let f=0,h=0;const d=o.allocUnsafe(4);do f=l%128|0,(l=l/128|0)>0&&(f|=128),d.writeUInt8(f,h++);while(l>0&&h<4);return l>0&&(h=0),u?d.subarray(0,h):d.slice(0,h)},generate4ByteBuffer:function(l){const f=o.allocUnsafe(4);return f.writeUInt32BE(l,0),f}}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],42:[function(r,a,i){a.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},{}],43:[function(r,a,i){const o=r("bl"),n=r("events"),s=r("./packet"),u=r("./constants"),c=r("debug")("mqtt-packet:parser");class l extends n{constructor(){super(),this.parser=this.constructor.parser}static parser(h){return this instanceof l?(this.settings=h||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new l().parser(h)}_resetState(){c("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new s,this.error=null,this._list=o(),this._stateCounter=0}parse(h){for(this.error&&this._resetState(),this._list.append(h),c("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,c("parse: state complete. _stateCounter is now: %d",this._stateCounter),c("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return c("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const h=this._list.readUInt8(0);return this.packet.cmd=u.types[h>>u.CMD_SHIFT],this.packet.retain=(h&u.RETAIN_MASK)!=0,this.packet.qos=h>>u.QOS_SHIFT&u.QOS_MASK,this.packet.dup=(h&u.DUP_MASK)!=0,c("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const h=this._parseVarByteNum(!0);return h&&(this.packet.length=h.value,this._list.consume(h.bytes)),c("_parseLength %d",h.value),!!h}_parsePayload(){c("_parsePayload: payload %O",this._list);let h=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}h=!0}return c("_parsePayload complete result: %s",h),h}_parseConnect(){let h,d,v,y;c("_parseConnect");const g={},m=this.packet,w=this._parseString();if(w===null)return this._emitError(new Error("Cannot parse protocolId"));if(w!=="MQTT"&&w!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(m.protocolId=w,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(m.protocolVersion=this._list.readUInt8(this._pos),m.protocolVersion>=128&&(m.bridgeMode=!0,m.protocolVersion=m.protocolVersion-128),m.protocolVersion!==3&&m.protocolVersion!==4&&m.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(g.username=this._list.readUInt8(this._pos)&u.USERNAME_MASK,g.password=this._list.readUInt8(this._pos)&u.PASSWORD_MASK,g.will=this._list.readUInt8(this._pos)&u.WILL_FLAG_MASK,g.will&&(m.will={},m.will.retain=(this._list.readUInt8(this._pos)&u.WILL_RETAIN_MASK)!=0,m.will.qos=(this._list.readUInt8(this._pos)&u.WILL_QOS_MASK)>>u.WILL_QOS_SHIFT),m.clean=(this._list.readUInt8(this._pos)&u.CLEAN_SESSION_MASK)!=0,this._pos++,m.keepalive=this._parseNum(),m.keepalive===-1)return this._emitError(new Error("Packet too short"));if(m.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(m.properties=x)}const p=this._parseString();if(p===null)return this._emitError(new Error("Packet too short"));if(m.clientId=p,c("_parseConnect: packet.clientId: %s",m.clientId),g.will){if(m.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(m.will.properties=x)}if((h=this._parseString())===null)return this._emitError(new Error("Cannot parse will topic"));if(m.will.topic=h,c("_parseConnect: packet.will.topic: %s",m.will.topic),(d=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse will payload"));m.will.payload=d,c("_parseConnect: packet.will.paylaod: %s",m.will.payload)}if(g.username){if((y=this._parseString())===null)return this._emitError(new Error("Cannot parse username"));m.username=y,c("_parseConnect: packet.username: %s",m.username)}if(g.password){if((v=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse password"));m.password=v}return this.settings=m,c("_parseConnect: complete"),m}_parseConnack(){c("_parseConnack");const h=this.packet;if(this._list.length<1)return null;if(h.sessionPresent=!!(this._list.readUInt8(this._pos++)&u.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?h.reasonCode=this._list.readUInt8(this._pos++):h.reasonCode=0;else{if(this._list.length<2)return null;h.returnCode=this._list.readUInt8(this._pos++)}if(h.returnCode===-1||h.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}c("_parseConnack: complete")}_parsePublish(){c("_parsePublish");const h=this.packet;if(h.topic=this._parseString(),h.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(h.qos>0)||this._parseMessageId()){if(this.settings.protocolVersion===5){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}h.payload=this._list.slice(this._pos,h.length),c("_parsePublish: payload from buffer list: %o",h.payload)}}_parseSubscribe(){c("_parseSubscribe");const h=this.packet;let d,v,y,g,m,w,p;if(h.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(h.subscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(h.properties=x)}for(;this._pos<h.length;){if((d=this._parseString())===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=h.length)return this._emitError(new Error("Malformed Subscribe Payload"));y=(v=this._parseByte())&u.SUBSCRIBE_OPTIONS_QOS_MASK,w=(v>>u.SUBSCRIBE_OPTIONS_NL_SHIFT&u.SUBSCRIBE_OPTIONS_NL_MASK)!=0,m=(v>>u.SUBSCRIBE_OPTIONS_RAP_SHIFT&u.SUBSCRIBE_OPTIONS_RAP_MASK)!=0,g=v>>u.SUBSCRIBE_OPTIONS_RH_SHIFT&u.SUBSCRIBE_OPTIONS_RH_MASK,p={topic:d,qos:y},this.settings.protocolVersion===5?(p.nl=w,p.rap=m,p.rh=g):this.settings.bridgeMode&&(p.rh=0,p.rap=!0,p.nl=!0),c("_parseSubscribe: push subscription `%s` to subscription",p),h.subscriptions.push(p)}}}_parseSuback(){c("_parseSuback");const h=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){c("_parseUnsubscribe");const h=this.packet;if(h.unsubscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}for(;this._pos<h.length;){const d=this._parseString();if(d===null)return this._emitError(new Error("Cannot parse topic"));c("_parseUnsubscribe: push topic `%s` to unsubscriptions",d),h.unsubscriptions.push(d)}}}_parseUnsuback(){c("_parseUnsuback");const h=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const d=this._parseProperties();for(Object.getOwnPropertyNames(d).length&&(h.properties=d),h.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){c("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const h=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(h.length>2?(h.reasonCode=this._parseByte(),c("_parseConfirmation: packet.reasonCode `%d`",h.reasonCode)):h.reasonCode=0,h.length>3)){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}return!0}_parseDisconnect(){const h=this.packet;if(c("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?h.reasonCode=this._parseByte():h.reasonCode=0;const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}return c("_parseDisconnect result: true"),!0}_parseAuth(){c("_parseAuth");const h=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));h.reasonCode=this._parseByte();const d=this._parseProperties();return Object.getOwnPropertyNames(d).length&&(h.properties=d),c("_parseAuth: result: true"),!0}_parseMessageId(){const h=this.packet;return h.messageId=this._parseNum(),h.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(c("_parseMessageId: packet.messageId %d",h.messageId),!0)}_parseString(h){const d=this._parseNum(),v=d+this._pos;if(d===-1||v>this._list.length||v>this.packet.length)return null;const y=this._list.toString("utf8",this._pos,v);return this._pos+=d,c("_parseString: result: %s",y),y}_parseStringPair(){return c("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const h=this._parseNum(),d=h+this._pos;if(h===-1||d>this._list.length||d>this.packet.length)return null;const v=this._list.slice(this._pos,d);return this._pos+=h,c("_parseBuffer: result: %o",v),v}_parseNum(){if(this._list.length-this._pos<2)return-1;const h=this._list.readUInt16BE(this._pos);return this._pos+=2,c("_parseNum: result: %s",h),h}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const h=this._list.readUInt32BE(this._pos);return this._pos+=4,c("_parse4ByteNum: result: %s",h),h}_parseVarByteNum(h){c("_parseVarByteNum");let d,v=0,y=1,g=0,m=!1;const w=this._pos?this._pos:0;for(;v<4&&w+v<this._list.length;){if(g+=y*((d=this._list.readUInt8(w+v++))&u.VARBYTEINT_MASK),y*=128,(d&u.VARBYTEINT_FIN_MASK)==0){m=!0;break}if(this._list.length<=v)break}return!m&&v===4&&this._list.length>=v&&this._emitError(new Error("Invalid variable byte integer")),w&&(this._pos+=v),c("_parseVarByteNum: result: %o",m=!!m&&(h?{bytes:v,value:g}:g)),m}_parseByte(){let h;return this._pos<this._list.length&&(h=this._list.readUInt8(this._pos),this._pos++),c("_parseByte: result: %o",h),h}_parseByType(h){switch(c("_parseByType: type: %s",h),h){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){c("_parseProperties");const h=this._parseVarByteNum(),d=this._pos+h,v={};for(;this._pos<d;){const y=this._parseByte();if(!y)return this._emitError(new Error("Cannot parse property code type")),!1;const g=u.propertiesCodes[y];if(!g)return this._emitError(new Error("Unknown property")),!1;if(g!=="userProperties")v[g]?Array.isArray(v[g])?v[g].push(this._parseByType(u.propertiesTypes[g])):(v[g]=[v[g]],v[g].push(this._parseByType(u.propertiesTypes[g]))):v[g]=this._parseByType(u.propertiesTypes[g]);else{v[g]||(v[g]=Object.create(null));const m=this._parseByType(u.propertiesTypes[g]);if(v[g][m.name])if(Array.isArray(v[g][m.name]))v[g][m.name].push(m.value);else{const w=v[g][m.name];v[g][m.name]=[w],v[g][m.name].push(m.value)}else v[g][m.name]=m.value}}return v}_newPacket(){return c("_newPacket"),this.packet&&(this._list.consume(this.packet.length),c("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),c("_newPacket: new packet"),this.packet=new s,this._pos=0,!0}_emitError(h){c("_emitError"),this.error=h,this.emit("error",h)}}a.exports=l},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(r,a,i){(function(o){(function(){const n=r("./constants"),s=o.allocUnsafe(0),u=o.from([0]),c=r("./numbers"),l=r("process-nextick-args").nextTick,f=r("debug")("mqtt-packet:writeToStream"),h=c.cache,d=c.generateNumber,v=c.generateCache,y=c.genBufVariableByteInt,g=c.generate4ByteBuffer;let m=z,w=!0;function p(L,M,j){switch(f("generate called"),M.cork&&(M.cork(),l(x,M)),w&&(w=!1,v()),f("generate: packet.cmd: %s",L.cmd),L.cmd){case"connect":return function(W,F,V){const Y=W||{},q=Y.protocolId||"MQTT";let Q=Y.protocolVersion||4;const K=Y.will;let X=Y.clean;const b=Y.keepalive||0,C=Y.clientId||"",E=Y.username,N=Y.password,O=Y.properties;X===void 0&&(X=!0);let $=0;if(!q||typeof q!="string"&&!o.isBuffer(q))return F.emit("error",new Error("Invalid protocolId")),!1;if($+=q.length+2,Q!==3&&Q!==4&&Q!==5)return F.emit("error",new Error("Invalid protocol version")),!1;if($+=1,(typeof C=="string"||o.isBuffer(C))&&(C||Q>=4)&&(C||X))$+=o.byteLength(C)+2;else{if(Q<4)return F.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*X==0)return F.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof b!="number"||b<0||b>65535||b%1!=0)return F.emit("error",new Error("Invalid keepalive")),!1;if($+=2,$+=1,Q===5){var G=k(F,O);if(!G)return!1;$+=G.length}if(K){if(typeof K!="object")return F.emit("error",new Error("Invalid will")),!1;if(!K.topic||typeof K.topic!="string")return F.emit("error",new Error("Invalid will topic")),!1;if($+=o.byteLength(K.topic)+2,$+=2,K.payload){if(!(K.payload.length>=0))return F.emit("error",new Error("Invalid will payload")),!1;typeof K.payload=="string"?$+=o.byteLength(K.payload):$+=K.payload.length}var Z={};if(Q===5){if(!(Z=k(F,K.properties)))return!1;$+=Z.length}}let J=!1;if(E!=null){if(!H(E))return F.emit("error",new Error("Invalid username")),!1;J=!0,$+=o.byteLength(E)+2}if(N!=null){if(!J)return F.emit("error",new Error("Username is required to use password")),!1;if(!H(N))return F.emit("error",new Error("Invalid password")),!1;$+=D(N)+2}F.write(n.CONNECT_HEADER),A(F,$),_(F,q),Y.bridgeMode&&(Q+=128),F.write(Q===131?n.VERSION131:Q===132?n.VERSION132:Q===4?n.VERSION4:Q===5?n.VERSION5:n.VERSION3);let ee=0;return ee|=E!=null?n.USERNAME_MASK:0,ee|=N!=null?n.PASSWORD_MASK:0,ee|=K&&K.retain?n.WILL_RETAIN_MASK:0,ee|=K&&K.qos?K.qos<<n.WILL_QOS_SHIFT:0,ee|=K?n.WILL_FLAG_MASK:0,ee|=X?n.CLEAN_SESSION_MASK:0,F.write(o.from([ee])),m(F,b),Q===5&&G.write(),_(F,C),K&&(Q===5&&Z.write(),I(F,K.topic),_(F,K.payload)),E!=null&&_(F,E),N!=null&&_(F,N),!0}(L,M);case"connack":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=Y===5?q.reasonCode:q.returnCode,K=q.properties;let X=2;if(typeof Q!="number")return F.emit("error",new Error("Invalid return code")),!1;let b=null;if(Y===5){if(!(b=k(F,K)))return!1;X+=b.length}return F.write(n.CONNACK_HEADER),A(F,X),F.write(q.sessionPresent?n.SESSIONPRESENT_HEADER:u),F.write(o.from([Q])),b!=null&&b.write(),!0}(L,M,j);case"publish":return function(W,F,V){f("publish: packet: %o",W);const Y=V?V.protocolVersion:4,q=W||{},Q=q.qos||0,K=q.retain?n.RETAIN_MASK:0,X=q.topic,b=q.payload||s,C=q.messageId,E=q.properties;let N=0;if(typeof X=="string")N+=o.byteLength(X)+2;else{if(!o.isBuffer(X))return F.emit("error",new Error("Invalid topic")),!1;N+=X.length+2}if(o.isBuffer(b)?N+=b.length:N+=o.byteLength(b),Q&&typeof C!="number")return F.emit("error",new Error("Invalid messageId")),!1;Q&&(N+=2);let O=null;if(Y===5){if(!(O=k(F,E)))return!1;N+=O.length}return F.write(n.PUBLISH_HEADER[Q][q.dup?1:0][K?1:0]),A(F,N),m(F,D(X)),F.write(X),Q>0&&m(F,C),O!=null&&O.write(),f("publish: payload: %o",b),F.write(b)}(L,M,j);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.cmd||"puback",K=q.messageId,X=q.dup&&Q==="pubrel"?n.DUP_MASK:0;let b=0;const C=q.reasonCode,E=q.properties;let N=Y===5?3:2;if(Q==="pubrel"&&(b=1),typeof K!="number")return F.emit("error",new Error("Invalid messageId")),!1;let O=null;if(Y===5&&typeof E=="object"){if(!(O=S(F,E,V,N)))return!1;N+=O.length}return F.write(n.ACKS[Q][b][X][0]),A(F,N),m(F,K),Y===5&&F.write(o.from([C])),O!==null&&O.write(),!0}(L,M,j);case"subscribe":return function(W,F,V){f("subscribe: packet: ");const Y=V?V.protocolVersion:4,q=W||{},Q=q.dup?n.DUP_MASK:0,K=q.messageId,X=q.subscriptions,b=q.properties;let C=0;if(typeof K!="number")return F.emit("error",new Error("Invalid messageId")),!1;C+=2;let E=null;if(Y===5){if(!(E=k(F,b)))return!1;C+=E.length}if(typeof X!="object"||!X.length)return F.emit("error",new Error("Invalid subscriptions")),!1;for(let O=0;O<X.length;O+=1){const $=X[O].topic,G=X[O].qos;if(typeof $!="string")return F.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof G!="number")return F.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Y===5){if(typeof(X[O].nl||!1)!="boolean")return F.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(X[O].rap||!1)!="boolean")return F.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const ee=X[O].rh||0;if(typeof ee!="number"||ee>2)return F.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}C+=o.byteLength($)+2+1}f("subscribe: writing to stream: %o",n.SUBSCRIBE_HEADER),F.write(n.SUBSCRIBE_HEADER[1][Q?1:0][0]),A(F,C),m(F,K),E!==null&&E.write();let N=!0;for(const O of X){const $=O.topic,G=O.qos,Z=+O.nl,J=+O.rap,ee=O.rh;let te;I(F,$),te=n.SUBSCRIBE_OPTIONS_QOS[G],Y===5&&(te|=Z?n.SUBSCRIBE_OPTIONS_NL:0,te|=J?n.SUBSCRIBE_OPTIONS_RAP:0,te|=ee?n.SUBSCRIBE_OPTIONS_RH[ee]:0),N=F.write(o.from([te]))}return N}(L,M,j);case"suback":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.messageId,K=q.granted,X=q.properties;let b=0;if(typeof Q!="number")return F.emit("error",new Error("Invalid messageId")),!1;if(b+=2,typeof K!="object"||!K.length)return F.emit("error",new Error("Invalid qos vector")),!1;for(let E=0;E<K.length;E+=1){if(typeof K[E]!="number")return F.emit("error",new Error("Invalid qos vector")),!1;b+=1}let C=null;if(Y===5){if(!(C=S(F,X,V,b)))return!1;b+=C.length}return F.write(n.SUBACK_HEADER),A(F,b),m(F,Q),C!==null&&C.write(),F.write(o.from(K))}(L,M,j);case"unsubscribe":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.messageId,K=q.dup?n.DUP_MASK:0,X=q.unsubscriptions,b=q.properties;let C=0;if(typeof Q!="number")return F.emit("error",new Error("Invalid messageId")),!1;if(C+=2,typeof X!="object"||!X.length)return F.emit("error",new Error("Invalid unsubscriptions")),!1;for(let O=0;O<X.length;O+=1){if(typeof X[O]!="string")return F.emit("error",new Error("Invalid unsubscriptions")),!1;C+=o.byteLength(X[O])+2}let E=null;if(Y===5){if(!(E=k(F,b)))return!1;C+=E.length}F.write(n.UNSUBSCRIBE_HEADER[1][K?1:0][0]),A(F,C),m(F,Q),E!==null&&E.write();let N=!0;for(let O=0;O<X.length;O++)N=I(F,X[O]);return N}(L,M,j);case"unsuback":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.messageId,K=q.dup?n.DUP_MASK:0,X=q.granted,b=q.properties,C=q.cmd;let E=2;if(typeof Q!="number")return F.emit("error",new Error("Invalid messageId")),!1;if(Y===5){if(typeof X!="object"||!X.length)return F.emit("error",new Error("Invalid qos vector")),!1;for(let O=0;O<X.length;O+=1){if(typeof X[O]!="number")return F.emit("error",new Error("Invalid qos vector")),!1;E+=1}}let N=null;if(Y===5){if(!(N=S(F,b,V,E)))return!1;E+=N.length}return F.write(n.ACKS[C][0][K][0]),A(F,E),m(F,Q),N!==null&&N.write(),Y===5&&F.write(o.from(X)),!0}(L,M,j);case"pingreq":case"pingresp":return function(W,F,V){return F.write(n.EMPTY[W.cmd])}(L,M);case"disconnect":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.reasonCode,K=q.properties;let X=Y===5?1:0,b=null;if(Y===5){if(!(b=S(F,K,V,X)))return!1;X+=b.length}return F.write(o.from([n.codes.disconnect<<4])),A(F,X),Y===5&&F.write(o.from([Q])),b!==null&&b.write(),!0}(L,M,j);case"auth":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.reasonCode,K=q.properties;let X=Y===5?1:0;Y!==5&&F.emit("error",new Error("Invalid mqtt version for auth packet"));const b=S(F,K,V,X);return b?(X+=b.length,F.write(o.from([n.codes.auth<<4])),A(F,X),F.write(o.from([Q])),b!==null&&b.write(),!0):!1}(L,M,j);default:return M.emit("error",new Error("Unknown command")),!1}}function x(L){L.uncork()}Object.defineProperty(p,"cacheNumbers",{get:()=>m===z,set(L){L?(h&&Object.keys(h).length!==0||(w=!0),m=z):(w=!1,m=U)}});const T={};function A(L,M){if(M>n.VARBYTEINT_MAX)return L.emit("error",new Error(`Invalid variable byte integer: ${M}`)),!1;let j=T[M];return j||(j=y(M),M<16384&&(T[M]=j)),f("writeVarByteInt: writing to stream: %o",j),L.write(j)}function I(L,M){const j=o.byteLength(M);return m(L,j),f("writeString: %s",M),L.write(M,"utf8")}function R(L,M,j){I(L,M),I(L,j)}function z(L,M){return f("writeNumberCached: number: %d",M),f("writeNumberCached: %o",h[M]),L.write(h[M])}function U(L,M){const j=d(M);return f("writeNumberGenerated: %o",j),L.write(j)}function _(L,M){typeof M=="string"?I(L,M):M?(m(L,M.length),L.write(M)):m(L,0)}function k(L,M){if(typeof M!="object"||M.length!=null)return{length:1,write(){B(L,{},0)}};let j=0;function W(F,V){let Y=0;switch(n.propertiesTypes[F]){case"byte":if(typeof V!="boolean")return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=2;break;case"int8":if(typeof V!="number"||V<0||V>255)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=2;break;case"binary":if(V&&V===null)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=1+o.byteLength(V)+2;break;case"int16":if(typeof V!="number"||V<0||V>65535)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=3;break;case"int32":if(typeof V!="number"||V<0||V>4294967295)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=5;break;case"var":if(typeof V!="number"||V<0||V>268435455)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=1+o.byteLength(y(V));break;case"string":if(typeof V!="string")return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=3+o.byteLength(V.toString());break;case"pair":if(typeof V!="object")return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=Object.getOwnPropertyNames(V).reduce((q,Q)=>{const K=V[Q];return Array.isArray(K)?q+=K.reduce((X,b)=>X+=3+o.byteLength(Q.toString())+2+o.byteLength(b.toString()),0):q+=3+o.byteLength(Q.toString())+2+o.byteLength(V[Q].toString()),q},0);break;default:return L.emit("error",new Error(`Invalid property ${F}: ${V}`)),!1}return Y}if(M)for(const F in M){let V=0,Y=0;const q=M[F];if(Array.isArray(q))for(let Q=0;Q<q.length;Q++){if(!(Y=W(F,q[Q])))return!1;V+=Y}else{if(!(Y=W(F,q)))return!1;V=Y}if(!V)return!1;j+=V}return{length:o.byteLength(y(j))+j,write(){B(L,M,j)}}}function S(L,M,j,W){const F=["reasonString","userProperties"],V=j&&j.properties&&j.properties.maximumPacketSize?j.properties.maximumPacketSize:0;let Y=k(L,M);if(V)for(;W+Y.length>V;){const q=F.shift();if(!q||!M[q])return!1;delete M[q],Y=k(L,M)}return Y}function P(L,M,j){switch(n.propertiesTypes[M]){case"byte":L.write(o.from([n.properties[M]])),L.write(o.from([+j]));break;case"int8":L.write(o.from([n.properties[M]])),L.write(o.from([j]));break;case"binary":L.write(o.from([n.properties[M]])),_(L,j);break;case"int16":L.write(o.from([n.properties[M]])),m(L,j);break;case"int32":L.write(o.from([n.properties[M]])),function(W,F){const V=g(F);f("write4ByteNumber: %o",V),W.write(V)}(L,j);break;case"var":L.write(o.from([n.properties[M]])),A(L,j);break;case"string":L.write(o.from([n.properties[M]])),I(L,j);break;case"pair":Object.getOwnPropertyNames(j).forEach(W=>{const F=j[W];Array.isArray(F)?F.forEach(V=>{L.write(o.from([n.properties[M]])),R(L,W.toString(),V.toString())}):(L.write(o.from([n.properties[M]])),R(L,W.toString(),F.toString()))});break;default:return L.emit("error",new Error(`Invalid property ${M} value: ${j}`)),!1}}function B(L,M,j){A(L,j);for(const W in M)if(Object.prototype.hasOwnProperty.call(M,W)&&M[W]!==null){const F=M[W];if(Array.isArray(F))for(let V=0;V<F.length;V++)P(L,W,F[V]);else P(L,W,F)}}function D(L){return L?L instanceof o?L.length:o.byteLength(L):0}function H(L){return typeof L=="string"||L instanceof o}a.exports=p}).call(this)}).call(this,r("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(r,a,i){var o=1e3,n=60*o,s=60*n,u=24*s,c=7*u,l=365.25*u;function f(h,d,v,y){var g=d>=1.5*v;return Math.round(h/v)+" "+y+(g?"s":"")}a.exports=function(h,d){d=d||{};var v=typeof h;if(v==="string"&&h.length>0)return function(y){if(!((y=String(y)).length>100)){var g=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(y);if(g){var m=parseFloat(g[1]);switch((g[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return m*l;case"weeks":case"week":case"w":return m*c;case"days":case"day":case"d":return m*u;case"hours":case"hour":case"hrs":case"hr":case"h":return m*s;case"minutes":case"minute":case"mins":case"min":case"m":return m*n;case"seconds":case"second":case"secs":case"sec":case"s":return m*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}(h);if(v==="number"&&isFinite(h))return d.long?function(y){var g=Math.abs(y);return g>=u?f(y,g,u,"day"):g>=s?f(y,g,s,"hour"):g>=n?f(y,g,n,"minute"):g>=o?f(y,g,o,"second"):y+" ms"}(h):function(y){var g=Math.abs(y);return g>=u?Math.round(y/u)+"d":g>=s?Math.round(y/s)+"h":g>=n?Math.round(y/n)+"m":g>=o?Math.round(y/o)+"s":y+"ms"}(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))}},{}],46:[function(r,a,i){const o=r("./lib/number-allocator.js");a.exports.NumberAllocator=o},{"./lib/number-allocator.js":47}],47:[function(r,a,i){const o=r("js-sdsl").Set,n=r("debug")("number-allocator:trace"),s=r("debug")("number-allocator:error");function u(l,f){this.low=l,this.high=f}function c(l,f){if(!(this instanceof c))return new c(l,f);this.min=l,this.max=f,this.ss=new o([],(h,d)=>h.compare(d)),n("Create"),this.clear()}u.prototype.equals=function(l){return this.low===l.low&&this.high===l.high},u.prototype.compare=function(l){return this.low<l.low&&this.high<l.low?-1:l.low<this.low&&l.high<this.low?1:0},c.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},c.prototype.alloc=function(){if(this.ss.size()===0)return n("alloc():empty"),null;const l=this.ss.front(),f=l.low;return f+1<=l.high?++l.low:this.ss.eraseElementByPos(0),n("alloc():"+f),f},c.prototype.use=function(l){const f=new u(l,l),h=this.ss.lowerBound(f);if(h){if(h.equals(f))return this.ss.eraseElementByValue(h),n("use():"+l),!0;if(h.low>l)return!1;if(h.low===l)return++h.low,n("use():"+l),!0;if(h.high===l)return--h.high,n("use():"+l),!0;const d=h.low;return h.low=l+1,this.ss.insert(new u(d,l-1)),n("use():"+l),!0}return n("use():failed"),!1},c.prototype.free=function(l){if(l<this.min||l>this.max)return void s("free():"+l+" is out of range");const f=new u(l,l),h=this.ss.lowerBound(f);if(h){if(h.low<=l&&l<=h.high)return void s("free():"+l+" has already been vacant");if(h===this.ss.front())l+1===h.low?--h.low:this.ss.insert(f);else{const d=this.ss.reverseLowerBound(f);d.high+1===l?l+1===h.low?(this.ss.eraseElementByValue(d),h.low=d.low):d.high=l:l+1===h.low?h.low=l:this.ss.insert(f)}}else{if(h===this.ss.front())return void this.ss.insert(f);const d=this.ss.reverseLowerBound(f);d.high+1===l?d.high=l:this.ss.insert(f)}n("free():"+l)},c.prototype.clear=function(){n("clear()"),this.ss.clear(),this.ss.insert(new u(this.min,this.max))},c.prototype.intervalCount=function(){return this.ss.size()},c.prototype.dump=function(){console.log("length:"+this.ss.size());for(const l of this.ss)console.log(l)},a.exports=c},{debug:18,"js-sdsl":36}],48:[function(r,a,i){var o=r("wrappy");function n(u){var c=function(){return c.called?c.value:(c.called=!0,c.value=u.apply(this,arguments))};return c.called=!1,c}function s(u){var c=function(){if(c.called)throw new Error(c.onceError);return c.called=!0,c.value=u.apply(this,arguments)},l=u.name||"Function wrapped with `once`";return c.onceError=l+" shouldn't be called more than once",c.called=!1,c}a.exports=o(n),a.exports.strict=o(s),n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})})},{wrappy:79}],49:[function(r,a,i){(function(o){(function(){o===void 0||!o.version||o.version.indexOf("v0.")===0||o.version.indexOf("v1.")===0&&o.version.indexOf("v1.8.")!==0?a.exports={nextTick:function(n,s,u,c){if(typeof n!="function")throw new TypeError('"callback" argument must be a function');var l,f,h=arguments.length;switch(h){case 0:case 1:return o.nextTick(n);case 2:return o.nextTick(function(){n.call(null,s)});case 3:return o.nextTick(function(){n.call(null,s,u)});case 4:return o.nextTick(function(){n.call(null,s,u,c)});default:for(l=new Array(h-1),f=0;f<l.length;)l[f++]=arguments[f];return o.nextTick(function(){n.apply(null,l)})}}}:a.exports=o}).call(this)}).call(this,r("_process"))},{_process:50}],50:[function(r,a,i){var o,n,s=a.exports={};function u(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function l(p){if(o===setTimeout)return setTimeout(p,0);if((o===u||!o)&&setTimeout)return o=setTimeout,setTimeout(p,0);try{return o(p,0)}catch{try{return o.call(null,p,0)}catch{return o.call(this,p,0)}}}(function(){try{o=typeof setTimeout=="function"?setTimeout:u}catch{o=u}try{n=typeof clearTimeout=="function"?clearTimeout:c}catch{n=c}})();var f,h=[],d=!1,v=-1;function y(){d&&f&&(d=!1,f.length?h=f.concat(h):v=-1,h.length&&g())}function g(){if(!d){var p=l(y);d=!0;for(var x=h.length;x;){for(f=h,h=[];++v<x;)f&&f[v].run();v=-1,x=h.length}f=null,d=!1,function(T){if(n===clearTimeout)return clearTimeout(T);if((n===c||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(T);try{n(T)}catch{try{return n.call(null,T)}catch{return n.call(this,T)}}}(p)}}function m(p,x){this.fun=p,this.array=x}function w(){}s.nextTick=function(p){var x=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)x[T-1]=arguments[T];h.push(new m(p,x)),h.length!==1||d||l(g)},m.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=w,s.addListener=w,s.once=w,s.off=w,s.removeListener=w,s.removeAllListeners=w,s.emit=w,s.prependListener=w,s.prependOnceListener=w,s.listeners=function(p){return[]},s.binding=function(p){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(p){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],51:[function(r,a,i){(function(o){(function(){(function(n){var s=typeof i=="object"&&i&&!i.nodeType&&i,u=typeof a=="object"&&a&&!a.nodeType&&a,c=typeof o=="object"&&o;c.global!==c&&c.window!==c&&c.self!==c||(n=c);var l,f,h=2147483647,d=36,v=1,y=26,g=38,m=700,w=72,p=128,x="-",T=/^xn--/,A=/[^\x20-\x7E]/,I=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=d-v,U=Math.floor,_=String.fromCharCode;function k(W){throw new RangeError(R[W])}function S(W,F){for(var V=W.length,Y=[];V--;)Y[V]=F(W[V]);return Y}function P(W,F){var V=W.split("@"),Y="";return V.length>1&&(Y=V[0]+"@",W=V[1]),Y+S((W=W.replace(I,".")).split("."),F).join(".")}function B(W){for(var F,V,Y=[],q=0,Q=W.length;q<Q;)(F=W.charCodeAt(q++))>=55296&&F<=56319&&q<Q?(64512&(V=W.charCodeAt(q++)))==56320?Y.push(((1023&F)<<10)+(1023&V)+65536):(Y.push(F),q--):Y.push(F);return Y}function D(W){return S(W,function(F){var V="";return F>65535&&(V+=_((F-=65536)>>>10&1023|55296),F=56320|1023&F),V+=_(F)}).join("")}function H(W,F){return W+22+75*(W<26)-((F!=0)<<5)}function L(W,F,V){var Y=0;for(W=V?U(W/m):W>>1,W+=U(W/F);W>z*y>>1;Y+=d)W=U(W/z);return U(Y+(z+1)*W/(W+g))}function M(W){var F,V,Y,q,Q,K,X,b,C,E,N,O=[],$=W.length,G=0,Z=p,J=w;for((V=W.lastIndexOf(x))<0&&(V=0),Y=0;Y<V;++Y)W.charCodeAt(Y)>=128&&k("not-basic"),O.push(W.charCodeAt(Y));for(q=V>0?V+1:0;q<$;){for(Q=G,K=1,X=d;q>=$&&k("invalid-input"),((b=(N=W.charCodeAt(q++))-48<10?N-22:N-65<26?N-65:N-97<26?N-97:d)>=d||b>U((h-G)/K))&&k("overflow"),G+=b*K,!(b<(C=X<=J?v:X>=J+y?y:X-J));X+=d)K>U(h/(E=d-C))&&k("overflow"),K*=E;J=L(G-Q,F=O.length+1,Q==0),U(G/F)>h-Z&&k("overflow"),Z+=U(G/F),G%=F,O.splice(G++,0,Z)}return D(O)}function j(W){var F,V,Y,q,Q,K,X,b,C,E,N,O,$,G,Z,J=[];for(O=(W=B(W)).length,F=p,V=0,Q=w,K=0;K<O;++K)(N=W[K])<128&&J.push(_(N));for(Y=q=J.length,q&&J.push(x);Y<O;){for(X=h,K=0;K<O;++K)(N=W[K])>=F&&N<X&&(X=N);for(X-F>U((h-V)/($=Y+1))&&k("overflow"),V+=(X-F)*$,F=X,K=0;K<O;++K)if((N=W[K])<F&&++V>h&&k("overflow"),N==F){for(b=V,C=d;!(b<(E=C<=Q?v:C>=Q+y?y:C-Q));C+=d)Z=b-E,G=d-E,J.push(_(H(E+Z%G,0))),b=U(Z/G);J.push(_(H(b,0))),Q=L(V,$,Y==q),V=0,++Y}++V,++F}return J.join("")}if(l={version:"1.4.1",ucs2:{decode:B,encode:D},decode:M,encode:j,toASCII:function(W){return P(W,function(F){return A.test(F)?"xn--"+j(F):F})},toUnicode:function(W){return P(W,function(F){return T.test(F)?M(F.slice(4).toLowerCase()):F})}},s&&u)if(a.exports==s)u.exports=l;else for(f in l)l.hasOwnProperty(f)&&(s[f]=l[f]);else n.punycode=l})(this)}).call(this)}).call(this,typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(r,a,i){function o(s,u){return Object.prototype.hasOwnProperty.call(s,u)}a.exports=function(s,u,c,l){u=u||"&",c=c||"=";var f={};if(typeof s!="string"||s.length===0)return f;var h=/\+/g;s=s.split(u);var d=1e3;l&&typeof l.maxKeys=="number"&&(d=l.maxKeys);var v=s.length;d>0&&v>d&&(v=d);for(var y=0;y<v;++y){var g,m,w,p,x=s[y].replace(h,"%20"),T=x.indexOf(c);T>=0?(g=x.substr(0,T),m=x.substr(T+1)):(g=x,m=""),w=decodeURIComponent(g),p=decodeURIComponent(m),o(f,w)?n(f[w])?f[w].push(p):f[w]=[f[w],p]:f[w]=p}return f};var n=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"}},{}],53:[function(r,a,i){var o=function(c){switch(typeof c){case"string":return c;case"boolean":return c?"true":"false";case"number":return isFinite(c)?c:"";default:return""}};a.exports=function(c,l,f,h){return l=l||"&",f=f||"=",c===null&&(c=void 0),typeof c=="object"?s(u(c),function(d){var v=encodeURIComponent(o(d))+f;return n(c[d])?s(c[d],function(y){return v+encodeURIComponent(o(y))}).join(l):v+encodeURIComponent(o(c[d]))}).join(l):h?encodeURIComponent(o(h))+f+encodeURIComponent(o(c)):""};var n=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"};function s(c,l){if(c.map)return c.map(l);for(var f=[],h=0;h<c.length;h++)f.push(l(c[h],h));return f}var u=Object.keys||function(c){var l=[];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&l.push(f);return l}},{}],54:[function(r,a,i){i.decode=i.parse=r("./decode"),i.encode=i.stringify=r("./encode")},{"./decode":52,"./encode":53}],55:[function(r,a,i){var o={};function n(u,c,l){l||(l=Error);var f=function(h){var d,v;function y(g,m,w){return h.call(this,function(p,x,T){return typeof c=="string"?c:c(p,x,T)}(g,m,w))||this}return v=h,(d=y).prototype=Object.create(v.prototype),d.prototype.constructor=d,d.__proto__=v,y}(l);f.prototype.name=l.name,f.prototype.code=u,o[u]=f}function s(u,c){if(Array.isArray(u)){var l=u.length;return u=u.map(function(f){return String(f)}),l>2?"one of ".concat(c," ").concat(u.slice(0,l-1).join(", "),", or ")+u[l-1]:l===2?"one of ".concat(c," ").concat(u[0]," or ").concat(u[1]):"of ".concat(c," ").concat(u[0])}return"of ".concat(c," ").concat(String(u))}n("ERR_INVALID_OPT_VALUE",function(u,c){return'The value "'+c+'" is invalid for option "'+u+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(u,c,l){var f,h,d;if(typeof c=="string"&&(h="not ",c.substr(0,h.length)===h)?(f="must not be",c=c.replace(/^not /,"")):f="must be",function(y,g,m){return(m===void 0||m>y.length)&&(m=y.length),y.substring(m-g.length,m)===g}(u," argument"))d="The ".concat(u," ").concat(f," ").concat(s(c,"type"));else{var v=function(y,g,m){return typeof m!="number"&&(m=0),!(m+g.length>y.length)&&y.indexOf(g,m)!==-1}(u,".")?"property":"argument";d='The "'.concat(u,'" ').concat(v," ").concat(f," ").concat(s(c,"type"))}return d+=". Received type ".concat(typeof l)},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(u){return"The "+u+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(u){return"Cannot call "+u+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(u){return"Unknown encoding: "+u},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),a.exports.codes=o},{}],56:[function(r,a,i){(function(o){(function(){var n=Object.keys||function(y){var g=[];for(var m in y)g.push(m);return g};a.exports=h;var s=r("./_stream_readable"),u=r("./_stream_writable");r("inherits")(h,s);for(var c=n(u.prototype),l=0;l<c.length;l++){var f=c[l];h.prototype[f]||(h.prototype[f]=u.prototype[f])}function h(y){if(!(this instanceof h))return new h(y);s.call(this,y),u.call(this,y),this.allowHalfOpen=!0,y&&(y.readable===!1&&(this.readable=!1),y.writable===!1&&(this.writable=!1),y.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||o.nextTick(v,this)}function v(y){y.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(h.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(h.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=y,this._writableState.destroyed=y)}})}).call(this)}).call(this,r("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(r,a,i){a.exports=n;var o=r("./_stream_transform");function n(s){if(!(this instanceof n))return new n(s);o.call(this,s)}r("inherits")(n,o),n.prototype._transform=function(s,u,c){c(null,s)}},{"./_stream_transform":59,inherits:24}],58:[function(r,a,i){(function(o,n){(function(){var s;a.exports=k,k.ReadableState=_,r("events").EventEmitter;var u=function(b,C){return b.listeners(C).length},c=r("./internal/streams/stream"),l=r("buffer").Buffer,f=n.Uint8Array||function(){},h,d=r("util");h=d&&d.debuglog?d.debuglog("stream"):function(){};var v,y,g,m=r("./internal/streams/buffer_list"),w=r("./internal/streams/destroy"),p=r("./internal/streams/state").getHighWaterMark,x=r("../errors").codes,T=x.ERR_INVALID_ARG_TYPE,A=x.ERR_STREAM_PUSH_AFTER_EOF,I=x.ERR_METHOD_NOT_IMPLEMENTED,R=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r("inherits")(k,c);var z=w.errorOrDestroy,U=["error","close","destroy","pause","resume"];function _(b,C,E){s=s||r("./_stream_duplex"),b=b||{},typeof E!="boolean"&&(E=C instanceof s),this.objectMode=!!b.objectMode,E&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=p(this,b,"readableHighWaterMark",E),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(v||(v=r("string_decoder/").StringDecoder),this.decoder=new v(b.encoding),this.encoding=b.encoding)}function k(b){if(s=s||r("./_stream_duplex"),!(this instanceof k))return new k(b);var C=this instanceof s;this._readableState=new _(b,this,C),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),c.call(this)}function S(b,C,E,N,O){h("readableAddChunk",C);var $,G=b._readableState;if(C===null)G.reading=!1,function(Z,J){if(h("onEofChunk"),!J.ended){if(J.decoder){var ee=J.decoder.end();ee&&ee.length&&(J.buffer.push(ee),J.length+=J.objectMode?1:ee.length)}J.ended=!0,J.sync?H(Z):(J.needReadable=!1,J.emittedReadable||(J.emittedReadable=!0,L(Z)))}}(b,G);else if(O||($=function(Z,J){var ee;te=J,l.isBuffer(te)||te instanceof f||typeof J=="string"||J===void 0||Z.objectMode||(ee=new T("chunk",["string","Buffer","Uint8Array"],J));var te;return ee}(G,C)),$)z(b,$);else if(G.objectMode||C&&C.length>0)if(typeof C=="string"||G.objectMode||Object.getPrototypeOf(C)===l.prototype||(C=function(Z){return l.from(Z)}(C)),N)G.endEmitted?z(b,new R):P(b,G,C,!0);else if(G.ended)z(b,new A);else{if(G.destroyed)return!1;G.reading=!1,G.decoder&&!E?(C=G.decoder.write(C),G.objectMode||C.length!==0?P(b,G,C,!1):M(b,G)):P(b,G,C,!1)}else N||(G.reading=!1,M(b,G));return!G.ended&&(G.length<G.highWaterMark||G.length===0)}function P(b,C,E,N){C.flowing&&C.length===0&&!C.sync?(C.awaitDrain=0,b.emit("data",E)):(C.length+=C.objectMode?1:E.length,N?C.buffer.unshift(E):C.buffer.push(E),C.needReadable&&H(b)),M(b,C)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(b){this._readableState&&(this._readableState.destroyed=b)}}),k.prototype.destroy=w.destroy,k.prototype._undestroy=w.undestroy,k.prototype._destroy=function(b,C){C(b)},k.prototype.push=function(b,C){var E,N=this._readableState;return N.objectMode?E=!0:typeof b=="string"&&((C=C||N.defaultEncoding)!==N.encoding&&(b=l.from(b,C),C=""),E=!0),S(this,b,C,!1,E)},k.prototype.unshift=function(b){return S(this,b,null,!0,!1)},k.prototype.isPaused=function(){return this._readableState.flowing===!1},k.prototype.setEncoding=function(b){v||(v=r("string_decoder/").StringDecoder);var C=new v(b);this._readableState.decoder=C,this._readableState.encoding=this._readableState.decoder.encoding;for(var E=this._readableState.buffer.head,N="";E!==null;)N+=C.write(E.data),E=E.next;return this._readableState.buffer.clear(),N!==""&&this._readableState.buffer.push(N),this._readableState.length=N.length,this};var B=1073741824;function D(b,C){return b<=0||C.length===0&&C.ended?0:C.objectMode?1:b!=b?C.flowing&&C.length?C.buffer.head.data.length:C.length:(b>C.highWaterMark&&(C.highWaterMark=function(E){return E>=B?E=B:(E--,E|=E>>>1,E|=E>>>2,E|=E>>>4,E|=E>>>8,E|=E>>>16,E++),E}(b)),b<=C.length?b:C.ended?C.length:(C.needReadable=!0,0))}function H(b){var C=b._readableState;h("emitReadable",C.needReadable,C.emittedReadable),C.needReadable=!1,C.emittedReadable||(h("emitReadable",C.flowing),C.emittedReadable=!0,o.nextTick(L,b))}function L(b){var C=b._readableState;h("emitReadable_",C.destroyed,C.length,C.ended),C.destroyed||!C.length&&!C.ended||(b.emit("readable"),C.emittedReadable=!1),C.needReadable=!C.flowing&&!C.ended&&C.length<=C.highWaterMark,Y(b)}function M(b,C){C.readingMore||(C.readingMore=!0,o.nextTick(j,b,C))}function j(b,C){for(;!C.reading&&!C.ended&&(C.length<C.highWaterMark||C.flowing&&C.length===0);){var E=C.length;if(h("maybeReadMore read 0"),b.read(0),E===C.length)break}C.readingMore=!1}function W(b){var C=b._readableState;C.readableListening=b.listenerCount("readable")>0,C.resumeScheduled&&!C.paused?C.flowing=!0:b.listenerCount("data")>0&&b.resume()}function F(b){h("readable nexttick read 0"),b.read(0)}function V(b,C){h("resume",C.reading),C.reading||b.read(0),C.resumeScheduled=!1,b.emit("resume"),Y(b),C.flowing&&!C.reading&&b.read(0)}function Y(b){var C=b._readableState;for(h("flow",C.flowing);C.flowing&&b.read()!==null;);}function q(b,C){return C.length===0?null:(C.objectMode?E=C.buffer.shift():!b||b>=C.length?(E=C.decoder?C.buffer.join(""):C.buffer.length===1?C.buffer.first():C.buffer.concat(C.length),C.buffer.clear()):E=C.buffer.consume(b,C.decoder),E);var E}function Q(b){var C=b._readableState;h("endReadable",C.endEmitted),C.endEmitted||(C.ended=!0,o.nextTick(K,C,b))}function K(b,C){if(h("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,C.readable=!1,C.emit("end"),b.autoDestroy)){var E=C._writableState;(!E||E.autoDestroy&&E.finished)&&C.destroy()}}function X(b,C){for(var E=0,N=b.length;E<N;E++)if(b[E]===C)return E;return-1}k.prototype.read=function(b){h("read",b),b=parseInt(b,10);var C=this._readableState,E=b;if(b!==0&&(C.emittedReadable=!1),b===0&&C.needReadable&&((C.highWaterMark!==0?C.length>=C.highWaterMark:C.length>0)||C.ended))return h("read: emitReadable",C.length,C.ended),C.length===0&&C.ended?Q(this):H(this),null;if((b=D(b,C))===0&&C.ended)return C.length===0&&Q(this),null;var N,O=C.needReadable;return h("need readable",O),(C.length===0||C.length-b<C.highWaterMark)&&h("length less than watermark",O=!0),C.ended||C.reading?h("reading or ended",O=!1):O&&(h("do read"),C.reading=!0,C.sync=!0,C.length===0&&(C.needReadable=!0),this._read(C.highWaterMark),C.sync=!1,C.reading||(b=D(E,C))),(N=b>0?q(b,C):null)===null?(C.needReadable=C.length<=C.highWaterMark,b=0):(C.length-=b,C.awaitDrain=0),C.length===0&&(C.ended||(C.needReadable=!0),E!==b&&C.ended&&Q(this)),N!==null&&this.emit("data",N),N},k.prototype._read=function(b){z(this,new I("_read()"))},k.prototype.pipe=function(b,C){var E=this,N=this._readableState;switch(N.pipesCount){case 0:N.pipes=b;break;case 1:N.pipes=[N.pipes,b];break;default:N.pipes.push(b)}N.pipesCount+=1,h("pipe count=%d opts=%j",N.pipesCount,C);var O=(!C||C.end!==!1)&&b!==o.stdout&&b!==o.stderr?G:ae;function $(ie,se){h("onunpipe"),ie===E&&se&&se.hasUnpiped===!1&&(se.hasUnpiped=!0,h("cleanup"),b.removeListener("close",oe),b.removeListener("finish",ne),b.removeListener("drain",Z),b.removeListener("error",te),b.removeListener("unpipe",$),E.removeListener("end",G),E.removeListener("end",ae),E.removeListener("data",ee),J=!0,!N.awaitDrain||b._writableState&&!b._writableState.needDrain||Z())}function G(){h("onend"),b.end()}N.endEmitted?o.nextTick(O):E.once("end",O),b.on("unpipe",$);var Z=function(ie){return function(){var se=ie._readableState;h("pipeOnDrain",se.awaitDrain),se.awaitDrain&&se.awaitDrain--,se.awaitDrain===0&&u(ie,"data")&&(se.flowing=!0,Y(ie))}}(E);b.on("drain",Z);var J=!1;function ee(ie){h("ondata");var se=b.write(ie);h("dest.write",se),se===!1&&((N.pipesCount===1&&N.pipes===b||N.pipesCount>1&&X(N.pipes,b)!==-1)&&!J&&(h("false write response, pause",N.awaitDrain),N.awaitDrain++),E.pause())}function te(ie){h("onerror",ie),ae(),b.removeListener("error",te),u(b,"error")===0&&z(b,ie)}function oe(){b.removeListener("finish",ne),ae()}function ne(){h("onfinish"),b.removeListener("close",oe),ae()}function ae(){h("unpipe"),E.unpipe(b)}return E.on("data",ee),function(ie,se,le){if(typeof ie.prependListener=="function")return ie.prependListener(se,le);ie._events&&ie._events[se]?Array.isArray(ie._events[se])?ie._events[se].unshift(le):ie._events[se]=[le,ie._events[se]]:ie.on(se,le)}(b,"error",te),b.once("close",oe),b.once("finish",ne),b.emit("pipe",E),N.flowing||(h("pipe resume"),E.resume()),b},k.prototype.unpipe=function(b){var C=this._readableState,E={hasUnpiped:!1};if(C.pipesCount===0)return this;if(C.pipesCount===1)return b&&b!==C.pipes?this:(b||(b=C.pipes),C.pipes=null,C.pipesCount=0,C.flowing=!1,b&&b.emit("unpipe",this,E),this);if(!b){var N=C.pipes,O=C.pipesCount;C.pipes=null,C.pipesCount=0,C.flowing=!1;for(var $=0;$<O;$++)N[$].emit("unpipe",this,{hasUnpiped:!1});return this}var G=X(C.pipes,b);return G===-1?this:(C.pipes.splice(G,1),C.pipesCount-=1,C.pipesCount===1&&(C.pipes=C.pipes[0]),b.emit("unpipe",this,E),this)},k.prototype.on=function(b,C){var E=c.prototype.on.call(this,b,C),N=this._readableState;return b==="data"?(N.readableListening=this.listenerCount("readable")>0,N.flowing!==!1&&this.resume()):b==="readable"&&(N.endEmitted||N.readableListening||(N.readableListening=N.needReadable=!0,N.flowing=!1,N.emittedReadable=!1,h("on readable",N.length,N.reading),N.length?H(this):N.reading||o.nextTick(F,this))),E},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(b,C){var E=c.prototype.removeListener.call(this,b,C);return b==="readable"&&o.nextTick(W,this),E},k.prototype.removeAllListeners=function(b){var C=c.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||o.nextTick(W,this),C},k.prototype.resume=function(){var b=this._readableState;return b.flowing||(h("resume"),b.flowing=!b.readableListening,function(C,E){E.resumeScheduled||(E.resumeScheduled=!0,o.nextTick(V,C,E))}(this,b)),b.paused=!1,this},k.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(b){var C=this,E=this._readableState,N=!1;for(var O in b.on("end",function(){if(h("wrapped end"),E.decoder&&!E.ended){var G=E.decoder.end();G&&G.length&&C.push(G)}C.push(null)}),b.on("data",function(G){h("wrapped data"),E.decoder&&(G=E.decoder.write(G)),(!E.objectMode||G!=null)&&(E.objectMode||G&&G.length)&&(C.push(G)||(N=!0,b.pause()))}),b)this[O]===void 0&&typeof b[O]=="function"&&(this[O]=function(G){return function(){return b[G].apply(b,arguments)}}(O));for(var $=0;$<U.length;$++)b.on(U[$],this.emit.bind(this,U[$]));return this._read=function(G){h("wrapped _read",G),N&&(N=!1,b.resume())},this},typeof Symbol=="function"&&(k.prototype[Symbol.asyncIterator]=function(){return y===void 0&&(y=r("./internal/streams/async_iterator")),y(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(b){this._readableState&&(this._readableState.flowing=b)}}),k._fromList=q,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(k.from=function(b,C){return g===void 0&&(g=r("./internal/streams/from")),g(k,b,C)})}).call(this)}).call(this,r("_process"),typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(r,a,i){a.exports=f;var o=r("../errors").codes,n=o.ERR_METHOD_NOT_IMPLEMENTED,s=o.ERR_MULTIPLE_CALLBACK,u=o.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=o.ERR_TRANSFORM_WITH_LENGTH_0,l=r("./_stream_duplex");function f(v){if(!(this instanceof f))return new f(v);l.call(this,v),this._transformState={afterTransform:(function(y,g){var m=this._transformState;m.transforming=!1;var w=m.writecb;if(w===null)return this.emit("error",new s);m.writechunk=null,m.writecb=null,g!=null&&this.push(g),w(y);var p=this._readableState;p.reading=!1,(p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}).bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,v&&(typeof v.transform=="function"&&(this._transform=v.transform),typeof v.flush=="function"&&(this._flush=v.flush)),this.on("prefinish",h)}function h(){var v=this;typeof this._flush!="function"||this._readableState.destroyed?d(this,null,null):this._flush(function(y,g){d(v,y,g)})}function d(v,y,g){if(y)return v.emit("error",y);if(g!=null&&v.push(g),v._writableState.length)throw new c;if(v._transformState.transforming)throw new u;return v.push(null)}r("inherits")(f,l),f.prototype.push=function(v,y){return this._transformState.needTransform=!1,l.prototype.push.call(this,v,y)},f.prototype._transform=function(v,y,g){g(new n("_transform()"))},f.prototype._write=function(v,y,g){var m=this._transformState;if(m.writecb=g,m.writechunk=v,m.writeencoding=y,!m.transforming){var w=this._readableState;(m.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},f.prototype._read=function(v){var y=this._transformState;y.writechunk===null||y.transforming?y.needTransform=!0:(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform))},f.prototype._destroy=function(v,y){l.prototype._destroy.call(this,v,function(g){y(g)})}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(r,a,i){(function(o,n){(function(){function s(M){var j=this;this.next=null,this.entry=null,this.finish=function(){(function(W,F,V){var Y=W.entry;for(W.entry=null;Y;){var q=Y.callback;F.pendingcb--,q(V),Y=Y.next}F.corkedRequestsFree.next=W})(j,M)}}var u;a.exports=k,k.WritableState=_;var c={deprecate:r("util-deprecate")},l=r("./internal/streams/stream"),f=r("buffer").Buffer,h=n.Uint8Array||function(){},d,v=r("./internal/streams/destroy"),y=r("./internal/streams/state").getHighWaterMark,g=r("../errors").codes,m=g.ERR_INVALID_ARG_TYPE,w=g.ERR_METHOD_NOT_IMPLEMENTED,p=g.ERR_MULTIPLE_CALLBACK,x=g.ERR_STREAM_CANNOT_PIPE,T=g.ERR_STREAM_DESTROYED,A=g.ERR_STREAM_NULL_VALUES,I=g.ERR_STREAM_WRITE_AFTER_END,R=g.ERR_UNKNOWN_ENCODING,z=v.errorOrDestroy;function U(){}function _(M,j,W){u=u||r("./_stream_duplex"),M=M||{},typeof W!="boolean"&&(W=j instanceof u),this.objectMode=!!M.objectMode,W&&(this.objectMode=this.objectMode||!!M.writableObjectMode),this.highWaterMark=y(this,M,"writableHighWaterMark",W),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var F=M.decodeStrings===!1;this.decodeStrings=!F,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(V){(function(Y,q){var Q=Y._writableState,K=Q.sync,X=Q.writecb;if(typeof X!="function")throw new p;if(function(C){C.writing=!1,C.writecb=null,C.length-=C.writelen,C.writelen=0}(Q),q)(function(C,E,N,O,$){--E.pendingcb,N?(o.nextTick($,O),o.nextTick(L,C,E),C._writableState.errorEmitted=!0,z(C,O)):($(O),C._writableState.errorEmitted=!0,z(C,O),L(C,E))})(Y,Q,K,q,X);else{var b=D(Q)||Y.destroyed;b||Q.corked||Q.bufferProcessing||!Q.bufferedRequest||B(Y,Q),K?o.nextTick(P,Y,Q,b,X):P(Y,Q,b,X)}})(j,V)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=M.emitClose!==!1,this.autoDestroy=!!M.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function k(M){var j=this instanceof(u=u||r("./_stream_duplex"));if(!j&&!d.call(k,this))return new k(M);this._writableState=new _(M,this,j),this.writable=!0,M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final)),l.call(this)}function S(M,j,W,F,V,Y,q){j.writelen=F,j.writecb=q,j.writing=!0,j.sync=!0,j.destroyed?j.onwrite(new T("write")):W?M._writev(V,j.onwrite):M._write(V,Y,j.onwrite),j.sync=!1}function P(M,j,W,F){W||function(V,Y){Y.length===0&&Y.needDrain&&(Y.needDrain=!1,V.emit("drain"))}(M,j),j.pendingcb--,F(),L(M,j)}function B(M,j){j.bufferProcessing=!0;var W=j.bufferedRequest;if(M._writev&&W&&W.next){var F=j.bufferedRequestCount,V=new Array(F),Y=j.corkedRequestsFree;Y.entry=W;for(var q=0,Q=!0;W;)V[q]=W,W.isBuf||(Q=!1),W=W.next,q+=1;V.allBuffers=Q,S(M,j,!0,j.length,V,"",Y.finish),j.pendingcb++,j.lastBufferedRequest=null,Y.next?(j.corkedRequestsFree=Y.next,Y.next=null):j.corkedRequestsFree=new s(j),j.bufferedRequestCount=0}else{for(;W;){var K=W.chunk,X=W.encoding,b=W.callback;if(S(M,j,!1,j.objectMode?1:K.length,K,X,b),W=W.next,j.bufferedRequestCount--,j.writing)break}W===null&&(j.lastBufferedRequest=null)}j.bufferedRequest=W,j.bufferProcessing=!1}function D(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}function H(M,j){M._final(function(W){j.pendingcb--,W&&z(M,W),j.prefinished=!0,M.emit("prefinish"),L(M,j)})}function L(M,j){var W=D(j);if(W&&(function(V,Y){Y.prefinished||Y.finalCalled||(typeof V._final!="function"||Y.destroyed?(Y.prefinished=!0,V.emit("prefinish")):(Y.pendingcb++,Y.finalCalled=!0,o.nextTick(H,V,Y)))}(M,j),j.pendingcb===0&&(j.finished=!0,M.emit("finish"),j.autoDestroy))){var F=M._readableState;(!F||F.autoDestroy&&F.endEmitted)&&M.destroy()}return W}r("inherits")(k,l),_.prototype.getBuffer=function(){for(var M=this.bufferedRequest,j=[];M;)j.push(M),M=M.next;return j},function(){try{Object.defineProperty(_.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(M){return!!d.call(this,M)||this===k&&M&&M._writableState instanceof _}})):d=function(M){return M instanceof this},k.prototype.pipe=function(){z(this,new x)},k.prototype.write=function(M,j,W){var F,V=this._writableState,Y=!1,q=!V.objectMode&&(F=M,f.isBuffer(F)||F instanceof h);return q&&!f.isBuffer(M)&&(M=function(Q){return f.from(Q)}(M)),typeof j=="function"&&(W=j,j=null),q?j="buffer":j||(j=V.defaultEncoding),typeof W!="function"&&(W=U),V.ending?function(Q,K){var X=new I;z(Q,X),o.nextTick(K,X)}(this,W):(q||function(Q,K,X,b){var C;return X===null?C=new A:typeof X=="string"||K.objectMode||(C=new m("chunk",["string","Buffer"],X)),!C||(z(Q,C),o.nextTick(b,C),!1)}(this,V,M,W))&&(V.pendingcb++,Y=function(Q,K,X,b,C,E){if(!X){var N=function(Z,J,ee){return Z.objectMode||Z.decodeStrings===!1||typeof J!="string"||(J=f.from(J,ee)),J}(K,b,C);b!==N&&(X=!0,C="buffer",b=N)}var O=K.objectMode?1:b.length;K.length+=O;var $=K.length<K.highWaterMark;if($||(K.needDrain=!0),K.writing||K.corked){var G=K.lastBufferedRequest;K.lastBufferedRequest={chunk:b,encoding:C,isBuf:X,callback:E,next:null},G?G.next=K.lastBufferedRequest:K.bufferedRequest=K.lastBufferedRequest,K.bufferedRequestCount+=1}else S(Q,K,!1,O,b,C,E);return $}(this,V,q,M,j,W)),Y},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,M.writing||M.corked||M.bufferProcessing||!M.bufferedRequest||B(this,M))},k.prototype.setDefaultEncoding=function(M){if(typeof M=="string"&&(M=M.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((M+"").toLowerCase())>-1))throw new R(M);return this._writableState.defaultEncoding=M,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),k.prototype._write=function(M,j,W){W(new w("_write()"))},k.prototype._writev=null,k.prototype.end=function(M,j,W){var F=this._writableState;return typeof M=="function"?(W=M,M=null,j=null):typeof j=="function"&&(W=j,j=null),M!=null&&this.write(M,j),F.corked&&(F.corked=1,this.uncork()),F.ending||function(V,Y,q){Y.ending=!0,L(V,Y),q&&(Y.finished?o.nextTick(q):V.once("finish",q)),Y.ended=!0,V.writable=!1}(this,F,W),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(M){this._writableState&&(this._writableState.destroyed=M)}}),k.prototype.destroy=v.destroy,k.prototype._undestroy=v.undestroy,k.prototype._destroy=function(M,j){j(M)}}).call(this)}).call(this,r("_process"),typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(r,a,i){(function(o){(function(){var n;function s(x,T,A){return T in x?Object.defineProperty(x,T,{value:A,enumerable:!0,configurable:!0,writable:!0}):x[T]=A,x}var u=r("./end-of-stream"),c=Symbol("lastResolve"),l=Symbol("lastReject"),f=Symbol("error"),h=Symbol("ended"),d=Symbol("lastPromise"),v=Symbol("handlePromise"),y=Symbol("stream");function g(x,T){return{value:x,done:T}}function m(x){var T=x[c];if(T!==null){var A=x[y].read();A!==null&&(x[d]=null,x[c]=null,x[l]=null,T(g(A,!1)))}}var w=Object.getPrototypeOf(function(){}),p=Object.setPrototypeOf((s(n={get stream(){return this[y]},next:function(){var x=this,T=this[f];if(T!==null)return Promise.reject(T);if(this[h])return Promise.resolve(g(void 0,!0));if(this[y].destroyed)return new Promise(function(z,U){o.nextTick(function(){x[f]?U(x[f]):z(g(void 0,!0))})});var A,I=this[d];if(I)A=new Promise(function(z,U){return function(_,k){z.then(function(){U[h]?_(g(void 0,!0)):U[v](_,k)},k)}}(I,this));else{var R=this[y].read();if(R!==null)return Promise.resolve(g(R,!1));A=new Promise(this[v])}return this[d]=A,A}},Symbol.asyncIterator,function(){return this}),s(n,"return",function(){var x=this;return new Promise(function(T,A){x[y].destroy(null,function(I){I?A(I):T(g(void 0,!0))})})}),n),w);a.exports=function(x){var T,A=Object.create(p,(s(T={},y,{value:x,writable:!0}),s(T,c,{value:null,writable:!0}),s(T,l,{value:null,writable:!0}),s(T,f,{value:null,writable:!0}),s(T,h,{value:x._readableState.endEmitted,writable:!0}),s(T,v,{value:function(I,R){var z=A[y].read();z?(A[d]=null,A[c]=null,A[l]=null,I(g(z,!1))):(A[c]=I,A[l]=R)},writable:!0}),T));return A[d]=null,u(x,function(I){if(I&&I.code!=="ERR_STREAM_PREMATURE_CLOSE"){var R=A[l];return R!==null&&(A[d]=null,A[c]=null,A[l]=null,R(I)),void(A[f]=I)}var z=A[c];z!==null&&(A[d]=null,A[c]=null,A[l]=null,z(g(void 0,!0))),A[h]=!0}),x.on("readable",(function(I){o.nextTick(m,I)}).bind(null,A)),A}}).call(this)}).call(this,r("_process"))},{"./end-of-stream":64,_process:50}],62:[function(r,a,i){function o(f,h){var d=Object.keys(f);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(f);h&&(v=v.filter(function(y){return Object.getOwnPropertyDescriptor(f,y).enumerable})),d.push.apply(d,v)}return d}function n(f,h,d){return h in f?Object.defineProperty(f,h,{value:d,enumerable:!0,configurable:!0,writable:!0}):f[h]=d,f}function s(f,h){for(var d=0;d<h.length;d++){var v=h[d];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}var u=r("buffer").Buffer,c=r("util").inspect,l=c&&c.custom||"inspect";a.exports=function(){function f(){(function(v,y){if(!(v instanceof y))throw new TypeError("Cannot call a class as a function")})(this,f),this.head=null,this.tail=null,this.length=0}var h,d;return h=f,(d=[{key:"push",value:function(v){var y={data:v,next:null};this.length>0?this.tail.next=y:this.head=y,this.tail=y,++this.length}},{key:"unshift",value:function(v){var y={data:v,next:this.head};this.length===0&&(this.tail=y),this.head=y,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var y=this.head,g=""+y.data;y=y.next;)g+=v+y.data;return g}},{key:"concat",value:function(v){if(this.length===0)return u.alloc(0);for(var y,g,m,w=u.allocUnsafe(v>>>0),p=this.head,x=0;p;)y=p.data,g=w,m=x,u.prototype.copy.call(y,g,m),x+=p.data.length,p=p.next;return w}},{key:"consume",value:function(v,y){var g;return v<this.head.data.length?(g=this.head.data.slice(0,v),this.head.data=this.head.data.slice(v)):g=v===this.head.data.length?this.shift():y?this._getString(v):this._getBuffer(v),g}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(v){var y=this.head,g=1,m=y.data;for(v-=m.length;y=y.next;){var w=y.data,p=v>w.length?w.length:v;if(p===w.length?m+=w:m+=w.slice(0,v),(v-=p)===0){p===w.length?(++g,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=w.slice(p));break}++g}return this.length-=g,m}},{key:"_getBuffer",value:function(v){var y=u.allocUnsafe(v),g=this.head,m=1;for(g.data.copy(y),v-=g.data.length;g=g.next;){var w=g.data,p=v>w.length?w.length:v;if(w.copy(y,y.length-v,0,p),(v-=p)===0){p===w.length?(++m,g.next?this.head=g.next:this.head=this.tail=null):(this.head=g,g.data=w.slice(p));break}++m}return this.length-=m,y}},{key:l,value:function(v,y){return c(this,function(g){for(var m=1;m<arguments.length;m++){var w=arguments[m]!=null?arguments[m]:{};m%2?o(Object(w),!0).forEach(function(p){n(g,p,w[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(w)):o(Object(w)).forEach(function(p){Object.defineProperty(g,p,Object.getOwnPropertyDescriptor(w,p))})}return g}({},y,{depth:0,customInspect:!1}))}}])&&s(h.prototype,d),f}()},{buffer:17,util:16}],63:[function(r,a,i){(function(o){(function(){function n(c,l){u(c,l),s(c)}function s(c){c._writableState&&!c._writableState.emitClose||c._readableState&&!c._readableState.emitClose||c.emit("close")}function u(c,l){c.emit("error",l)}a.exports={destroy:function(c,l){var f=this,h=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return h||d?(l?l(c):c&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,o.nextTick(u,this,c)):o.nextTick(u,this,c)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(c||null,function(v){!l&&v?f._writableState?f._writableState.errorEmitted?o.nextTick(s,f):(f._writableState.errorEmitted=!0,o.nextTick(n,f,v)):o.nextTick(n,f,v):l?(o.nextTick(s,f),l(v)):o.nextTick(s,f)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(c,l){var f=c._readableState,h=c._writableState;f&&f.autoDestroy||h&&h.autoDestroy?c.destroy(l):c.emit("error",l)}}}).call(this)}).call(this,r("_process"))},{_process:50}],64:[function(r,a,i){var o=r("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}a.exports=function s(u,c,l){if(typeof c=="function")return s(u,null,c);c||(c={}),l=function(T){var A=!1;return function(){if(!A){A=!0;for(var I=arguments.length,R=new Array(I),z=0;z<I;z++)R[z]=arguments[z];T.apply(this,R)}}}(l||n);var f=c.readable||c.readable!==!1&&u.readable,h=c.writable||c.writable!==!1&&u.writable,d=function(){u.writable||y()},v=u._writableState&&u._writableState.finished,y=function(){h=!1,v=!0,f||l.call(u)},g=u._readableState&&u._readableState.endEmitted,m=function(){f=!1,g=!0,h||l.call(u)},w=function(T){l.call(u,T)},p=function(){var T;return f&&!g?(u._readableState&&u._readableState.ended||(T=new o),l.call(u,T)):h&&!v?(u._writableState&&u._writableState.ended||(T=new o),l.call(u,T)):void 0},x=function(){u.req.on("finish",y)};return function(T){return T.setHeader&&typeof T.abort=="function"}(u)?(u.on("complete",y),u.on("abort",p),u.req?x():u.on("request",x)):h&&!u._writableState&&(u.on("end",d),u.on("close",d)),u.on("end",m),u.on("finish",y),c.error!==!1&&u.on("error",w),u.on("close",p),function(){u.removeListener("complete",y),u.removeListener("abort",p),u.removeListener("request",x),u.req&&u.req.removeListener("finish",y),u.removeListener("end",d),u.removeListener("close",d),u.removeListener("finish",y),u.removeListener("end",m),u.removeListener("error",w),u.removeListener("close",p)}}},{"../../../errors":55}],65:[function(r,a,i){a.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(r,a,i){var o,n=r("../../../errors").codes,s=n.ERR_MISSING_ARGS,u=n.ERR_STREAM_DESTROYED;function c(h){if(h)throw h}function l(h){h()}function f(h,d){return h.pipe(d)}a.exports=function(){for(var h=arguments.length,d=new Array(h),v=0;v<h;v++)d[v]=arguments[v];var y,g=function(w){return w.length?typeof w[w.length-1]!="function"?c:w.pop():c}(d);if(Array.isArray(d[0])&&(d=d[0]),d.length<2)throw new s("streams");var m=d.map(function(w,p){var x=p<d.length-1;return function(T,A,I,R){R=function(_){var k=!1;return function(){k||(k=!0,_.apply(void 0,arguments))}}(R);var z=!1;T.on("close",function(){z=!0}),o===void 0&&(o=r("./end-of-stream")),o(T,{readable:A,writable:I},function(_){if(_)return R(_);z=!0,R()});var U=!1;return function(_){if(!z&&!U)return U=!0,function(k){return k.setHeader&&typeof k.abort=="function"}(T)?T.abort():typeof T.destroy=="function"?T.destroy():void R(_||new u("pipe"))}}(w,x,p>0,function(T){y||(y=T),T&&m.forEach(l),x||(m.forEach(l),g(y))})});return d.reduce(f)}},{"../../../errors":55,"./end-of-stream":64}],67:[function(r,a,i){var o=r("../../../errors").codes.ERR_INVALID_OPT_VALUE;a.exports={getHighWaterMark:function(n,s,u,c){var l=function(f,h,d){return f.highWaterMark!=null?f.highWaterMark:h?f[d]:null}(s,c,u);if(l!=null){if(!isFinite(l)||Math.floor(l)!==l||l<0)throw new o(c?u:"highWaterMark",l);return Math.floor(l)}return n.objectMode?16:16384}}},{"../../../errors":55}],68:[function(r,a,i){a.exports=r("events").EventEmitter},{events:22}],69:[function(r,a,i){(i=a.exports=r("./lib/_stream_readable.js")).Stream=i,i.Readable=i,i.Writable=r("./lib/_stream_writable.js"),i.Duplex=r("./lib/_stream_duplex.js"),i.Transform=r("./lib/_stream_transform.js"),i.PassThrough=r("./lib/_stream_passthrough.js"),i.finished=r("./lib/internal/streams/end-of-stream.js"),i.pipeline=r("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(r,a,i){a.exports=function(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var o;if(arguments.length>0){o=new Array(arguments.length-2);for(var n=0;n<o.length;n++)o[n]=arguments[n+2]}return new function(s,u,c){var l=this;this._callback=s,this._args=c,this._interval=setInterval(s,u,this._args),this.reschedule=function(f){f||(f=l._interval),l._interval&&clearInterval(l._interval),l._interval=setInterval(l._callback,f,l._args)},this.clear=function(){l._interval&&(clearInterval(l._interval),l._interval=void 0)},this.destroy=function(){l._interval&&clearInterval(l._interval),l._callback=void 0,l._interval=void 0,l._args=void 0}}(arguments[0],arguments[1],o)}},{}],71:[function(r,a,i){a.exports=r("./index.js")()},{"./index.js":72}],72:[function(r,a,i){(function(o){(function(){function n(s){return s instanceof o?o.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}a.exports=function(s){return(s=s||{}).circles?function(c){var l=[],f=[];return c.proto?function d(v){if(typeof v!="object"||v===null)return v;if(v instanceof Date)return new Date(v);if(Array.isArray(v))return h(v,d);if(v instanceof Map)return new Map(h(Array.from(v),d));if(v instanceof Set)return new Set(h(Array.from(v),d));var y={};for(var g in l.push(v),f.push(y),v){var m=v[g];if(typeof m!="object"||m===null)y[g]=m;else if(m instanceof Date)y[g]=new Date(m);else if(m instanceof Map)y[g]=new Map(h(Array.from(m),d));else if(m instanceof Set)y[g]=new Set(h(Array.from(m),d));else if(ArrayBuffer.isView(m))y[g]=n(m);else{var w=l.indexOf(m);y[g]=w!==-1?f[w]:d(m)}}return l.pop(),f.pop(),y}:function d(v){if(typeof v!="object"||v===null)return v;if(v instanceof Date)return new Date(v);if(Array.isArray(v))return h(v,d);if(v instanceof Map)return new Map(h(Array.from(v),d));if(v instanceof Set)return new Set(h(Array.from(v),d));var y={};for(var g in l.push(v),f.push(y),v)if(Object.hasOwnProperty.call(v,g)!==!1){var m=v[g];if(typeof m!="object"||m===null)y[g]=m;else if(m instanceof Date)y[g]=new Date(m);else if(m instanceof Map)y[g]=new Map(h(Array.from(m),d));else if(m instanceof Set)y[g]=new Set(h(Array.from(m),d));else if(ArrayBuffer.isView(m))y[g]=n(m);else{var w=l.indexOf(m);y[g]=w!==-1?f[w]:d(m)}}return l.pop(),f.pop(),y};function h(d,v){for(var y=Object.keys(d),g=new Array(y.length),m=0;m<y.length;m++){var w=y[m],p=d[w];if(typeof p!="object"||p===null)g[w]=p;else if(p instanceof Date)g[w]=new Date(p);else if(ArrayBuffer.isView(p))g[w]=n(p);else{var x=l.indexOf(p);g[w]=x!==-1?f[x]:v(p)}}return g}}(s):s.proto?function c(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return u(l,c);if(l instanceof Map)return new Map(u(Array.from(l),c));if(l instanceof Set)return new Set(u(Array.from(l),c));var f={};for(var h in l){var d=l[h];typeof d!="object"||d===null?f[h]=d:d instanceof Date?f[h]=new Date(d):d instanceof Map?f[h]=new Map(u(Array.from(d),c)):d instanceof Set?f[h]=new Set(u(Array.from(d),c)):ArrayBuffer.isView(d)?f[h]=n(d):f[h]=c(d)}return f}:function c(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return u(l,c);if(l instanceof Map)return new Map(u(Array.from(l),c));if(l instanceof Set)return new Set(u(Array.from(l),c));var f={};for(var h in l)if(Object.hasOwnProperty.call(l,h)!==!1){var d=l[h];typeof d!="object"||d===null?f[h]=d:d instanceof Date?f[h]=new Date(d):d instanceof Map?f[h]=new Map(u(Array.from(d),c)):d instanceof Set?f[h]=new Set(u(Array.from(d),c)):ArrayBuffer.isView(d)?f[h]=n(d):f[h]=c(d)}return f};function u(c,l){for(var f=Object.keys(c),h=new Array(f.length),d=0;d<f.length;d++){var v=f[d],y=c[v];typeof y!="object"||y===null?h[v]=y:y instanceof Date?h[v]=new Date(y):ArrayBuffer.isView(y)?h[v]=n(y):h[v]=l(y)}return h}}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],73:[function(r,a,i){var o=r("buffer"),n=o.Buffer;function s(c,l){for(var f in c)l[f]=c[f]}function u(c,l,f){return n(c,l,f)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?a.exports=o:(s(o,i),i.Buffer=u),u.prototype=Object.create(n.prototype),s(n,u),u.from=function(c,l,f){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,l,f)},u.alloc=function(c,l,f){if(typeof c!="number")throw new TypeError("Argument must be a number");var h=n(c);return l!==void 0?typeof f=="string"?h.fill(l,f):h.fill(l):h.fill(0),h},u.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},u.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return o.SlowBuffer(c)}},{buffer:17}],74:[function(r,a,i){a.exports=function(o){var n=o._readableState;return n?n.objectMode||typeof o._duplexState=="number"?o.read():o.read((s=n,s.buffer.length?s.buffer.head?s.buffer.head.data.length:s.buffer[0].length:s.length)):null;var s}},{}],75:[function(r,a,i){var o=r("safe-buffer").Buffer,n=o.isEncoding||function(g){switch((g=""+g)&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(g){var m;switch(this.encoding=function(w){var p=function(x){if(!x)return"utf8";for(var T;;)switch(x){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return x;default:if(T)return;x=(""+x).toLowerCase(),T=!0}}(w);if(typeof p!="string"&&(o.isEncoding===n||!n(w)))throw new Error("Unknown encoding: "+w);return p||w}(g),this.encoding){case"utf16le":this.text=l,this.end=f,m=4;break;case"utf8":this.fillLast=c,m=4;break;case"base64":this.text=h,this.end=d,m=3;break;default:return this.write=v,void(this.end=y)}this.lastNeed=0,this.lastTotal=0,this.lastChar=o.allocUnsafe(m)}function u(g){return g<=127?0:g>>5==6?2:g>>4==14?3:g>>3==30?4:g>>6==2?-1:-2}function c(g){var m=this.lastTotal-this.lastNeed,w=function(p,x,T){if((192&x[0])!=128)return p.lastNeed=0,"�";if(p.lastNeed>1&&x.length>1){if((192&x[1])!=128)return p.lastNeed=1,"�";if(p.lastNeed>2&&x.length>2&&(192&x[2])!=128)return p.lastNeed=2,"�"}}(this,g);return w!==void 0?w:this.lastNeed<=g.length?(g.copy(this.lastChar,m,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(g.copy(this.lastChar,m,0,g.length),void(this.lastNeed-=g.length))}function l(g,m){if((g.length-m)%2==0){var w=g.toString("utf16le",m);if(w){var p=w.charCodeAt(w.length-1);if(p>=55296&&p<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",m,g.length-1)}function f(g){var m=g&&g.length?this.write(g):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return m+this.lastChar.toString("utf16le",0,w)}return m}function h(g,m){var w=(g.length-m)%3;return w===0?g.toString("base64",m):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",m,g.length-w))}function d(g){var m=g&&g.length?this.write(g):"";return this.lastNeed?m+this.lastChar.toString("base64",0,3-this.lastNeed):m}function v(g){return g.toString(this.encoding)}function y(g){return g&&g.length?this.write(g):""}i.StringDecoder=s,s.prototype.write=function(g){if(g.length===0)return"";var m,w;if(this.lastNeed){if((m=this.fillLast(g))===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<g.length?m?m+this.text(g,w):this.text(g,w):m||""},s.prototype.end=function(g){var m=g&&g.length?this.write(g):"";return this.lastNeed?m+"�":m},s.prototype.text=function(g,m){var w=function(x,T,A){var I=T.length-1;if(I<A)return 0;var R=u(T[I]);return R>=0?(R>0&&(x.lastNeed=R-1),R):--I<A||R===-2?0:(R=u(T[I]))>=0?(R>0&&(x.lastNeed=R-2),R):--I<A||R===-2?0:(R=u(T[I]))>=0?(R>0&&(R===2?R=0:x.lastNeed=R-3),R):0}(this,g,m);if(!this.lastNeed)return g.toString("utf8",m);this.lastTotal=w;var p=g.length-(w-this.lastNeed);return g.copy(this.lastChar,0,p),g.toString("utf8",m,p)},s.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length}},{"safe-buffer":73}],76:[function(r,a,i){var o=r("punycode"),n=r("./util");function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}i.parse=T,i.resolve=function(A,I){return T(A,!1,!0).resolve(I)},i.resolveObject=function(A,I){return A?T(A,!1,!0).resolveObject(I):I},i.format=function(A){return n.isString(A)&&(A=T(A)),A instanceof s?A.format():s.prototype.format.call(A)},i.Url=s;var u=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
`,"	"]),h=["'"].concat(f),d=["%","/","?",";","#"].concat(h),v=["/","?","#"],y=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},p={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=r("querystring");function T(A,I,R){if(A&&n.isObject(A)&&A instanceof s)return A;var z=new s;return z.parse(A,I,R),z}s.prototype.parse=function(A,I,R){if(!n.isString(A))throw new TypeError("Parameter 'url' must be a string, not "+typeof A);var z=A.indexOf("?"),U=z!==-1&&z<A.indexOf("#")?"?":"#",_=A.split(U);_[0]=_[0].replace(/\\/g,"/");var k=A=_.join(U);if(k=k.trim(),!R&&A.split("#").length===1){var S=l.exec(k);if(S)return this.path=k,this.href=k,this.pathname=S[1],S[2]?(this.search=S[2],this.query=I?x.parse(this.search.substr(1)):this.search.substr(1)):I&&(this.search="",this.query={}),this}var P=u.exec(k);if(P){var B=(P=P[0]).toLowerCase();this.protocol=B,k=k.substr(P.length)}if(R||P||k.match(/^\/\/[^@\/]+@[^@\/]+/)){var D=k.substr(0,2)==="//";!D||P&&w[P]||(k=k.substr(2),this.slashes=!0)}if(!w[P]&&(D||P&&!p[P])){for(var H,L,M=-1,j=0;j<v.length;j++)(W=k.indexOf(v[j]))!==-1&&(M===-1||W<M)&&(M=W);for((L=M===-1?k.lastIndexOf("@"):k.lastIndexOf("@",M))!==-1&&(H=k.slice(0,L),k=k.slice(L+1),this.auth=decodeURIComponent(H)),M=-1,j=0;j<d.length;j++){var W;(W=k.indexOf(d[j]))!==-1&&(M===-1||W<M)&&(M=W)}M===-1&&(M=k.length),this.host=k.slice(0,M),k=k.slice(M),this.parseHost(),this.hostname=this.hostname||"";var F=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!F)for(var V=this.hostname.split(/\./),Y=(j=0,V.length);j<Y;j++){var q=V[j];if(q&&!q.match(y)){for(var Q="",K=0,X=q.length;K<X;K++)q.charCodeAt(K)>127?Q+="x":Q+=q[K];if(!Q.match(y)){var b=V.slice(0,j),C=V.slice(j+1),E=q.match(g);E&&(b.push(E[1]),C.unshift(E[2])),C.length&&(k="/"+C.join(".")+k),this.hostname=b.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=o.toASCII(this.hostname));var N=this.port?":"+this.port:"",O=this.hostname||"";this.host=O+N,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!m[B])for(j=0,Y=h.length;j<Y;j++){var $=h[j];if(k.indexOf($)!==-1){var G=encodeURIComponent($);G===$&&(G=escape($)),k=k.split($).join(G)}}var Z=k.indexOf("#");Z!==-1&&(this.hash=k.substr(Z),k=k.slice(0,Z));var J=k.indexOf("?");if(J!==-1?(this.search=k.substr(J),this.query=k.substr(J+1),I&&(this.query=x.parse(this.query)),k=k.slice(0,J)):I&&(this.search="",this.query={}),k&&(this.pathname=k),p[B]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){N=this.pathname||"";var ee=this.search||"";this.path=N+ee}return this.href=this.format(),this},s.prototype.format=function(){var A=this.auth||"";A&&(A=(A=encodeURIComponent(A)).replace(/%3A/i,":"),A+="@");var I=this.protocol||"",R=this.pathname||"",z=this.hash||"",U=!1,_="";this.host?U=A+this.host:this.hostname&&(U=A+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(U+=":"+this.port)),this.query&&n.isObject(this.query)&&Object.keys(this.query).length&&(_=x.stringify(this.query));var k=this.search||_&&"?"+_||"";return I&&I.substr(-1)!==":"&&(I+=":"),this.slashes||(!I||p[I])&&U!==!1?(U="//"+(U||""),R&&R.charAt(0)!=="/"&&(R="/"+R)):U||(U=""),z&&z.charAt(0)!=="#"&&(z="#"+z),k&&k.charAt(0)!=="?"&&(k="?"+k),I+U+(R=R.replace(/[?#]/g,function(S){return encodeURIComponent(S)}))+(k=k.replace("#","%23"))+z},s.prototype.resolve=function(A){return this.resolveObject(T(A,!1,!0)).format()},s.prototype.resolveObject=function(A){if(n.isString(A)){var I=new s;I.parse(A,!1,!0),A=I}for(var R=new s,z=Object.keys(this),U=0;U<z.length;U++){var _=z[U];R[_]=this[_]}if(R.hash=A.hash,A.href==="")return R.href=R.format(),R;if(A.slashes&&!A.protocol){for(var k=Object.keys(A),S=0;S<k.length;S++){var P=k[S];P!=="protocol"&&(R[P]=A[P])}return p[R.protocol]&&R.hostname&&!R.pathname&&(R.path=R.pathname="/"),R.href=R.format(),R}if(A.protocol&&A.protocol!==R.protocol){if(!p[A.protocol]){for(var B=Object.keys(A),D=0;D<B.length;D++){var H=B[D];R[H]=A[H]}return R.href=R.format(),R}if(R.protocol=A.protocol,A.host||w[A.protocol])R.pathname=A.pathname;else{for(var L=(A.pathname||"").split("/");L.length&&!(A.host=L.shift()););A.host||(A.host=""),A.hostname||(A.hostname=""),L[0]!==""&&L.unshift(""),L.length<2&&L.unshift(""),R.pathname=L.join("/")}if(R.search=A.search,R.query=A.query,R.host=A.host||"",R.auth=A.auth,R.hostname=A.hostname||A.host,R.port=A.port,R.pathname||R.search){var M=R.pathname||"",j=R.search||"";R.path=M+j}return R.slashes=R.slashes||A.slashes,R.href=R.format(),R}var W=R.pathname&&R.pathname.charAt(0)==="/",F=A.host||A.pathname&&A.pathname.charAt(0)==="/",V=F||W||R.host&&A.pathname,Y=V,q=R.pathname&&R.pathname.split("/")||[],Q=(L=A.pathname&&A.pathname.split("/")||[],R.protocol&&!p[R.protocol]);if(Q&&(R.hostname="",R.port=null,R.host&&(q[0]===""?q[0]=R.host:q.unshift(R.host)),R.host="",A.protocol&&(A.hostname=null,A.port=null,A.host&&(L[0]===""?L[0]=A.host:L.unshift(A.host)),A.host=null),V=V&&(L[0]===""||q[0]==="")),F)R.host=A.host||A.host===""?A.host:R.host,R.hostname=A.hostname||A.hostname===""?A.hostname:R.hostname,R.search=A.search,R.query=A.query,q=L;else if(L.length)q||(q=[]),q.pop(),q=q.concat(L),R.search=A.search,R.query=A.query;else if(!n.isNullOrUndefined(A.search))return Q&&(R.hostname=R.host=q.shift(),(E=!!(R.host&&R.host.indexOf("@")>0)&&R.host.split("@"))&&(R.auth=E.shift(),R.host=R.hostname=E.shift())),R.search=A.search,R.query=A.query,n.isNull(R.pathname)&&n.isNull(R.search)||(R.path=(R.pathname?R.pathname:"")+(R.search?R.search:"")),R.href=R.format(),R;if(!q.length)return R.pathname=null,R.search?R.path="/"+R.search:R.path=null,R.href=R.format(),R;for(var K=q.slice(-1)[0],X=(R.host||A.host||q.length>1)&&(K==="."||K==="..")||K==="",b=0,C=q.length;C>=0;C--)(K=q[C])==="."?q.splice(C,1):K===".."?(q.splice(C,1),b++):b&&(q.splice(C,1),b--);if(!V&&!Y)for(;b--;b)q.unshift("..");!V||q[0]===""||q[0]&&q[0].charAt(0)==="/"||q.unshift(""),X&&q.join("/").substr(-1)!=="/"&&q.push("");var E,N=q[0]===""||q[0]&&q[0].charAt(0)==="/";return Q&&(R.hostname=R.host=N?"":q.length?q.shift():"",(E=!!(R.host&&R.host.indexOf("@")>0)&&R.host.split("@"))&&(R.auth=E.shift(),R.host=R.hostname=E.shift())),(V=V||R.host&&q.length)&&!N&&q.unshift(""),q.length?R.pathname=q.join("/"):(R.pathname=null,R.path=null),n.isNull(R.pathname)&&n.isNull(R.search)||(R.path=(R.pathname?R.pathname:"")+(R.search?R.search:"")),R.auth=A.auth||R.auth,R.slashes=R.slashes||A.slashes,R.href=R.format(),R},s.prototype.parseHost=function(){var A=this.host,I=c.exec(A);I&&((I=I[0])!==":"&&(this.port=I.substr(1)),A=A.substr(0,A.length-I.length)),A&&(this.hostname=A)}},{"./util":77,punycode:51,querystring:54}],77:[function(r,a,i){a.exports={isString:function(o){return typeof o=="string"},isObject:function(o){return typeof o=="object"&&o!==null},isNull:function(o){return o===null},isNullOrUndefined:function(o){return o==null}}},{}],78:[function(r,a,i){(function(o){(function(){function n(s){try{if(!o.localStorage)return!1}catch{return!1}var u=o.localStorage[s];return u!=null&&String(u).toLowerCase()==="true"}a.exports=function(s,u){if(n("noDeprecation"))return s;var c=!1;return function(){if(!c){if(n("throwDeprecation"))throw new Error(u);n("traceDeprecation")?console.trace(u):console.warn(u),c=!0}return s.apply(this,arguments)}}}).call(this)}).call(this,typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(r,a,i){a.exports=function o(n,s){if(n&&s)return o(n)(s);if(typeof n!="function")throw new TypeError("need wrapper function");return Object.keys(n).forEach(function(c){u[c]=n[c]}),u;function u(){for(var c=new Array(arguments.length),l=0;l<c.length;l++)c[l]=arguments[l];var f=n.apply(this,c),h=c[c.length-1];return typeof f=="function"&&f!==h&&Object.keys(h).forEach(function(d){f[d]=h[d]}),f}}},{}],80:[function(r,a,i){a.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(r,a,i){a.exports=function(){for(var n={},s=0;s<arguments.length;s++){var u=arguments[s];for(var c in u)o.call(u,c)&&(n[c]=u[c])}return n};var o=Object.prototype.hasOwnProperty},{}],82:[function(r,a,i){a.exports=function(o){o.prototype[Symbol.iterator]=function*(){for(let n=this.head;n;n=n.next)yield n.value}}},{}],83:[function(r,a,i){function o(l){var f=this;if(f instanceof o||(f=new o),f.tail=null,f.head=null,f.length=0,l&&typeof l.forEach=="function")l.forEach(function(v){f.push(v)});else if(arguments.length>0)for(var h=0,d=arguments.length;h<d;h++)f.push(arguments[h]);return f}function n(l,f,h){var d=f===l.head?new c(h,null,f,l):new c(h,f,f.next,l);return d.next===null&&(l.tail=d),d.prev===null&&(l.head=d),l.length++,d}function s(l,f){l.tail=new c(f,l.tail,null,l),l.head||(l.head=l.tail),l.length++}function u(l,f){l.head=new c(f,null,l.head,l),l.tail||(l.tail=l.head),l.length++}function c(l,f,h,d){if(!(this instanceof c))return new c(l,f,h,d);this.list=d,this.value=l,f?(f.next=this,this.prev=f):this.prev=null,h?(h.prev=this,this.next=h):this.next=null}a.exports=o,o.Node=c,o.create=o,o.prototype.removeNode=function(l){if(l.list!==this)throw new Error("removing node which does not belong to this list");var f=l.next,h=l.prev;return f&&(f.prev=h),h&&(h.next=f),l===this.head&&(this.head=f),l===this.tail&&(this.tail=h),l.list.length--,l.next=null,l.prev=null,l.list=null,f},o.prototype.unshiftNode=function(l){if(l!==this.head){l.list&&l.list.removeNode(l);var f=this.head;l.list=this,l.next=f,f&&(f.prev=l),this.head=l,this.tail||(this.tail=l),this.length++}},o.prototype.pushNode=function(l){if(l!==this.tail){l.list&&l.list.removeNode(l);var f=this.tail;l.list=this,l.prev=f,f&&(f.next=l),this.tail=l,this.head||(this.head=l),this.length++}},o.prototype.push=function(){for(var l=0,f=arguments.length;l<f;l++)s(this,arguments[l]);return this.length},o.prototype.unshift=function(){for(var l=0,f=arguments.length;l<f;l++)u(this,arguments[l]);return this.length},o.prototype.pop=function(){if(this.tail){var l=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,l}},o.prototype.shift=function(){if(this.head){var l=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,l}},o.prototype.forEach=function(l,f){f=f||this;for(var h=this.head,d=0;h!==null;d++)l.call(f,h.value,d,this),h=h.next},o.prototype.forEachReverse=function(l,f){f=f||this;for(var h=this.tail,d=this.length-1;h!==null;d--)l.call(f,h.value,d,this),h=h.prev},o.prototype.get=function(l){for(var f=0,h=this.head;h!==null&&f<l;f++)h=h.next;if(f===l&&h!==null)return h.value},o.prototype.getReverse=function(l){for(var f=0,h=this.tail;h!==null&&f<l;f++)h=h.prev;if(f===l&&h!==null)return h.value},o.prototype.map=function(l,f){f=f||this;for(var h=new o,d=this.head;d!==null;)h.push(l.call(f,d.value,this)),d=d.next;return h},o.prototype.mapReverse=function(l,f){f=f||this;for(var h=new o,d=this.tail;d!==null;)h.push(l.call(f,d.value,this)),d=d.prev;return h},o.prototype.reduce=function(l,f){var h,d=this.head;if(arguments.length>1)h=f;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");d=this.head.next,h=this.head.value}for(var v=0;d!==null;v++)h=l(h,d.value,v),d=d.next;return h},o.prototype.reduceReverse=function(l,f){var h,d=this.tail;if(arguments.length>1)h=f;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");d=this.tail.prev,h=this.tail.value}for(var v=this.length-1;d!==null;v--)h=l(h,d.value,v),d=d.prev;return h},o.prototype.toArray=function(){for(var l=new Array(this.length),f=0,h=this.head;h!==null;f++)l[f]=h.value,h=h.next;return l},o.prototype.toArrayReverse=function(){for(var l=new Array(this.length),f=0,h=this.tail;h!==null;f++)l[f]=h.value,h=h.prev;return l},o.prototype.slice=function(l,f){(f=f||this.length)<0&&(f+=this.length),(l=l||0)<0&&(l+=this.length);var h=new o;if(f<l||f<0)return h;l<0&&(l=0),f>this.length&&(f=this.length);for(var d=0,v=this.head;v!==null&&d<l;d++)v=v.next;for(;v!==null&&d<f;d++,v=v.next)h.push(v.value);return h},o.prototype.sliceReverse=function(l,f){(f=f||this.length)<0&&(f+=this.length),(l=l||0)<0&&(l+=this.length);var h=new o;if(f<l||f<0)return h;l<0&&(l=0),f>this.length&&(f=this.length);for(var d=this.length,v=this.tail;v!==null&&d>f;d--)v=v.prev;for(;v!==null&&d>l;d--,v=v.prev)h.push(v.value);return h},o.prototype.splice=function(l,f,...h){l>this.length&&(l=this.length-1),l<0&&(l=this.length+l);for(var d=0,v=this.head;v!==null&&d<l;d++)v=v.next;var y=[];for(d=0;v&&d<f;d++)y.push(v.value),v=this.removeNode(v);for(v===null&&(v=this.tail),v!==this.head&&v!==this.tail&&(v=v.prev),d=0;d<h.length;d++)v=n(this,v,h[d]);return y},o.prototype.reverse=function(){for(var l=this.head,f=this.tail,h=l;h!==null;h=h.prev){var d=h.prev;h.prev=h.next,h.next=d}return this.head=f,this.tail=l,this};try{r("./iterator.js")(o)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(Mw);var bc=Mw.exports,mt=function(){return mt=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},mt.apply(this,arguments)},dt=function(e,t,r,a){function i(o){return o instanceof r?o:new r(function(n){n(o)})}return new(r||(r=Promise))(function(o,n){function s(l){try{c(a.next(l))}catch(f){n(f)}}function u(l){try{c(a.throw(l))}catch(f){n(f)}}function c(l){l.done?o(l.value):i(l.value).then(s,u)}c((a=a.apply(e,t||[])).next())})},vt=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a,i,o,n;return n={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function s(c){return function(l){return u([c,l])}}function u(c){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{a=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Qe=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},St=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},at=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))},pK=function(){function e(t,r){var a=this;r===void 0&&(r={}),this.penPluginMap=new Map,this.events={},this.facePen=Ua,this.getWords=Yb,this.calcTextLines=wn,this.calcTextRect=Cr,this.calcTextDrawRect=Kb,this.register=mr,this.registerCanvasDraw=Rr,this.registerAnchors=Au,this.websocketTimes=0,this.mqttTimes=0,this.httpTimerList=[],this.updateTimerList=[],this.onEvent=function(i,o){switch(i){case"add":o.forEach(function(n){var s;(s=n.onAdd)===null||s===void 0||s.call(n,n)}),a.onSizeUpdate();break;case"enter":o&&o.onMouseEnter&&o.onMouseEnter(o,a.canvas.mousePos),a.store.data.locked&&a.doEvent(o,i);break;case"leave":o&&o.onMouseLeave&&o.onMouseLeave(o,a.canvas.mousePos),a.store.data.locked&&a.doEvent(o,i);break;case"active":case"inactive":a.store.data.locked&&o.forEach(function(n){a.doEvent(n,i)});break;case"click":o.pen&&o.pen.onClick&&!o.pen.disabled&&o.pen.onClick(o.pen,a.canvas.mousePos),a.store.data.locked&&o.pen&&!o.pen.disabled&&a.doEvent(o.pen,i);break;case"contextmenu":o.pen&&o.pen.onContextmenu&&!o.pen.disabled&&o.pen.onContextmenu(o.pen,a.canvas.mousePos),a.store.data.locked&&o.pen&&!o.pen.disabled&&a.doEvent(o.pen,i);break;case"mousedown":o.pen&&o.pen.onMouseDown&&!o.pen.disabled&&o.pen.onMouseDown(o.pen,a.canvas.mousePos),a.store.data.locked&&o.pen&&!o.pen.disabled&&a.doEvent(o.pen,i);break;case"mouseup":o.pen&&o.pen.onMouseUp&&!o.pen.disabled&&o.pen.onMouseUp(o.pen,a.canvas.mousePos),a.store.data.locked&&o.pen&&!o.pen.disabled&&a.doEvent(o.pen,i);break;case"dblclick":a.store.data.locked&&o.pen&&!o.pen.disabled&&a.doEvent(o.pen,i);break;case"valueUpdate":a.store.data.locked&&a.doEvent(o,i),a.canvas.tooltip.updateText(o);break;case"update":case"delete":case"translatePens":case"rotatePens":case"resizePens":a.onSizeUpdate();break;case"navigator":a.store.data.id||console.warn("请先保存当前图纸"),a.navigatorTo(o.params);break;case"input":a.store.data.locked&&o&&!o.disabled&&a.doEvent(o,i);break;case"change":a.store.data.locked&&o&&!o.disabled&&a.doEvent(o,i);break}a.store.messageEvents[i]&&a.store.messageEvents[i].forEach(function(n){var s=!1;n.event.conditions&&n.event.conditions.length?n.event.conditionType==="and"?s=n.event.conditions.every(function(u){return a.judgeCondition(n.pen,u.key,u)}):n.event.conditionType==="or"&&(s=n.event.conditions.some(function(u){return a.judgeCondition(n.pen,u.key,u)})):s=!0,s&&n.event.actions.forEach(function(u){a.events[u.action](n.pen,u)})})},this.doEvent=function(i,o){var n,s,u,c,l,f,h,d,v,y,g,m,w,p;if(i){var x=!1,T=[];if((l=i.events)===null||l===void 0||l.forEach(function(P,B){var D;if(P.actions&&P.actions.length){if(P.name===o){var H=!1;P.conditions&&P.conditions.length?P.conditionType==="and"?H=P.conditions.every(function(Q){return a.judgeCondition(i,Q.key,Q)}):P.conditionType==="or"&&(H=P.conditions.some(function(Q){return a.judgeCondition(i,Q.key,Q)})):H=!0,H&&T.push(B)}}else if(x=!0,a.events[P.action]&&P.name===o){var L=!(!((D=P.where)===null||D===void 0)&&D.type);if(P.where){var M=P.where,j=M.fn,W=M.fnJs,F=M.comparison,V=M.key,Y=M.value;if(j)L=j(i,{meta2d:a});else if(W){try{P.where.fn=new Function("pen","context",W)}catch(Q){console.error("Error: make function:",Q)}P.where.fn&&(L=P.where.fn(i,{meta2d:a}))}else{var q=i[V];switch(["x","y","width","height"].includes(V)&&(q=a.getPenRect(i)[V]),F){case">":L=q>+Y;break;case">=":L=q>=+Y;break;case"<":L=q<+Y;break;case"<=":L=q<=+Y;break;case"=":case"==":L=q==Y;break;case"!=":L=q!=Y;break;case"[)":L=ua(+q,Y);break;case"![)":L=!ua(+q,Y);break;case"[]":L=fa(q,Y);break;case"![]":L=!fa(q,Y);break}}}L&&T.push(B)}}),x?(f=i.events)===null||f===void 0||f.forEach(function(P,B){T.includes(B)&&a.events[P.action](i,P)}):(h=i.events)===null||h===void 0||h.forEach(function(P,B){T.includes(B)&&P.actions.forEach(function(D){a.events[D.action]&&a.events[D.action](i,D)})}),o==="valueUpdate"){(d=i.realTimes)===null||d===void 0||d.forEach(function(P){var B,D,H=[];(B=P.triggers)===null||B===void 0||B.forEach(function(L,M){var j,W=!1;!((j=L.conditions)===null||j===void 0)&&j.length?L.conditionType==="and"?W=L.conditions.every(function(F){return a.judgeCondition(i,P.key,F)}):L.conditionType==="or"&&(W=L.conditions.some(function(F){return a.judgeCondition(i,P.key,F)})):W=!0,W&&H.push(M)}),(D=P.triggers)===null||D===void 0||D.forEach(function(L,M){var j;H.includes(M)&&((j=L.actions)===null||j===void 0||j.forEach(function(W){a.events[W.action](i,W)}))})});var A=[];if((v=a.store.globalTriggers[i.id])===null||v===void 0||v.forEach(function(P,B){var D,H=!1;!((D=P.conditions)===null||D===void 0)&&D.length?P.conditionType==="and"?H=P.conditions.every(function(L){return a.judgeCondition(a.store.pens[L.source],L.key,L)}):P.conditionType==="or"&&(H=P.conditions.some(function(L){return a.judgeCondition(a.store.pens[L.source],L.key,L)})):H=!0,H&&A.push(B)}),(y=a.store.globalTriggers[i.id])===null||y===void 0||y.forEach(function(P,B){var D;A.includes(B)&&((D=P.actions)===null||D===void 0||D.forEach(function(H){a.events[H.action](i,H)}))}),!((g=i.triggers)===null||g===void 0)&&g.length)try{for(var I=Qe(i.triggers),R=I.next();!R.done;R=I.next()){var z=R.value;if(!((m=z.status)===null||m===void 0)&&m.length)try{for(var U=(u=void 0,Qe(z.status)),_=U.next();!_.done;_=U.next()){var k=_.value,S=!1;if(!((w=k.conditions)===null||w===void 0)&&w.length?k.conditionType==="and"?S=k.conditions.every(function(P){return a.judgeCondition(i,P.key,P)}):k.conditionType==="or"&&(S=k.conditions.some(function(P){return a.judgeCondition(i,P.key,P)})):S=!0,S){(p=k.actions)===null||p===void 0||p.forEach(function(P){a.events[P.action](i,P)});break}}}catch(P){u={error:P}}finally{try{_&&!_.done&&(c=U.return)&&c.call(U)}finally{if(u)throw u.error}}}}catch(P){n={error:P}}finally{try{R&&!R.done&&(s=I.return)&&s.call(I)}finally{if(n)throw n.error}}}a.doEvent(a.store.pens[i.parentId],o)}},this.doDataEvent=function(i){var o,n,s;if(!((o=a.store.data.dataEvents)===null||o===void 0)&&o.length){var u=i.reduce(function(l,f){var h=f.dataId,d=f.id,v=f.value;return l[d||h]=v,l},{}),c=[];(n=a.store.data.dataEvents)===null||n===void 0||n.forEach(function(l,f){var h=!1;l.conditions&&l.conditions.length?l.conditionType==="and"?h=l.conditions.every(function(d){return a.dataJudegeCondition(u,d.key,d)}):l.conditionType==="or"&&(h=l.conditions.some(function(d){return a.dataJudegeCondition(u,d.key,d)})):h=!0,h&&c.push(f)}),(s=a.store.data.dataEvents)===null||s===void 0||s.forEach(function(l,f){var h;c.includes(f)&&((h=l.actions)===null||h===void 0||h.forEach(function(d){a.events[d.action](u,d)}))})}},this.renderPenRaw=As,this.setElemPosition=Ye,this.setLifeCycleFunc=i7,this.store=c$(xe()),this.setOptions(r),this.setDatabyOptions(r),this.init(t),this.register(Vj()),this.registerCanvasDraw({cube:W7}),this.registerAnchors(qj()),globalThis.meta2d=this,this.initEventFns(),this.store.emitter.on("*",this.onEvent)}return Object.defineProperty(e.prototype,"beforeAddPen",{get:function(){return this.canvas.beforeAddPen},set:function(t){this.canvas.beforeAddPen=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"beforeAddPens",{get:function(){return this.canvas.beforeAddPens},set:function(t){this.canvas.beforeAddPens=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"beforeAddAnchor",{get:function(){return this.canvas.beforeAddAnchor},set:function(t){this.canvas.beforeAddAnchor=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"beforeRemovePens",{get:function(){return this.canvas.beforeRemovePens},set:function(t){this.canvas.beforeRemovePens=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"beforeRemoveAnchor",{get:function(){return this.canvas.beforeRemoveAnchor},set:function(t){this.canvas.beforeRemoveAnchor=t},enumerable:!1,configurable:!0}),e.prototype.setOptions=function(t){var r;t===void 0&&(t={}),(t.grid!==void 0||t.gridColor!==void 0||t.gridSize!==void 0)&&this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),(t.rule!==void 0||t.ruleColor!==void 0||t.ruleOptions!==void 0)&&(this.store.patchFlagsTop=!0,t.ruleOptions&&!((r=this.store.options)===null||r===void 0)&&r.ruleOptions&&(Object.assign(this.store.options.ruleOptions,t.ruleOptions),t.ruleOptions=this.store.options.ruleOptions)),t.background!==void 0&&this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),t.resizeMode!==void 0&&(t.resizeMode||(this.canvas.hotkeyType=Re.None)),(t.width!==void 0||t.height!==void 0)&&(this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),this.canvas&&this.canvas.canvasTemplate.canvas.style.backgroundImage&&(this.canvas.canvasTemplate.canvas.style.backgroundImage="")),this.store.options=Object.assign(this.store.options,t),this.canvas&&t.scroll!==void 0&&(t.scroll?(!this.canvas.scroll&&(this.canvas.scroll=new Ew(this.canvas)),this.canvas.scroll.show()):this.canvas.scroll&&this.canvas.scroll.hide())},e.prototype.getOptions=function(){return this.store.options},e.prototype.setTheme=function(t){this.store.data.theme=t,this.setBackgroundColor(this.store.theme[t].background),this.canvas.parentElement.style.background=this.store.theme[t].parentBackground,this.store.data.color=this.store.theme[t].color,this.setOptions({ruleColor:this.store.theme[t].ruleColor,ruleOptions:this.store.theme[t].ruleOptions}),this.render()},e.prototype.setDatabyOptions=function(t){t===void 0&&(t={});var r=t.color,a=t.activeColor,i=t.activeBackground,o=t.grid,n=t.gridColor,s=t.gridSize,u=t.fromArrow,c=t.toArrow,l=t.rule,f=t.ruleColor,h=t.textColor;this.setRule({rule:l,ruleColor:f}),this.setGrid({grid:o,gridColor:n,gridSize:s}),this.store.data=Object.assign(this.store.data,{textColor:h,color:r,activeColor:a,activeBackground:i,fromArrow:u,toArrow:c})},e.prototype.init=function(t){typeof t=="string"?this.canvas=new by(this,document.getElementById(t),this.store):this.canvas=new by(this,t,this.store),this.resize(),this.canvas.listen()},e.prototype.initEventFns=function(){var t=this;this.events[Je.Link]=function(r,a){var i;if(window&&a.value&&typeof a.value=="string"){window.open(a.value,(i=a.params)!==null&&i!==void 0?i:"_blank");return}console.warn("[meta2d] Link param is not a string")},this.events[Je.SetProps]=function(r,a){var i=a.value;if(i&&typeof i=="object"){var o=a.params?t.find(a.params):t.find(r.id);o.forEach(function(n){i.hasOwnProperty("visible")&&n.visible!==i.visible&&t.setVisible(n,i.visible),t.setValue(mt({id:n.id},i),{render:!1,doEvent:!1})}),t.render();return}console.warn("[meta2d] SetProps value is not an object")},this.events[Je.StartAnimate]=function(r,a){var i=r;if(a.value&&(i=t.findOne(a.value)),!(t.store.animates.has(i)&&!i.calculative.pause)){if(a.targetType&&a.params){t.startAnimate(a.value||[r],a.params);return}if(!a.value||typeof a.value=="string"){t.startAnimate(a.value||[r]);return}console.warn("[meta2d] StartAnimate value is not a string")}},this.events[Je.PauseAnimate]=function(r,a){if(!a.value||typeof a.value=="string"){t.pauseAnimate(a.value||[r]);return}console.warn("[meta2d] PauseAnimate value is not a string")},this.events[Je.StopAnimate]=function(r,a){if(!a.value||typeof a.value=="string"){if(a.value){var i=t.findOne(a.value);if(!t.store.animates.has(i))return}else if(!t.store.animates.has(r))return;t.stopAnimate(a.value||[r]);return}console.warn("[meta2d] StopAnimate event value is not a string")},this.events[Je.StartVideo]=function(r,a){if(!a.value||typeof a.value=="string"){t.startVideo(a.value||[r]);return}console.warn("[meta2d] StartVideo value is not a string")},this.events[Je.PauseVideo]=function(r,a){if(!a.value||typeof a.value=="string"){t.pauseVideo(a.value||[r]);return}console.warn("[meta2d] PauseVideo value is not a string")},this.events[Je.StopVideo]=function(r,a){if(!a.value||typeof a.value=="string"){t.stopVideo(a.value||[r]);return}console.warn("[meta2d] StopVideo event value is not a string")},this.events[Je.JS]=function(r,a){var i;if(a.value&&!a.fn)try{if(typeof a.value!="string")throw new Error("[meta2d] Function value must be string");var o=a.value;a.fn=new Function("pen","params","context",o)}catch(n){console.error("[meta2d]: Error on make a function:",n)}(i=a.fn)===null||i===void 0||i.call(a,r,a.params,{meta2d:t,eventName:a.name})},this.events[Je.GlobalFn]=function(r,a){if(typeof a.value!="string"){console.warn("[meta2d] GlobalFn value must be a string");return}globalThis[a.value]&&globalThis[a.value](r,a.params)},this.events[Je.Emit]=function(r,a){if(typeof a.value!="string"){console.warn("[meta2d] Emit value must be a string");return}t.store.emitter.emit(a.value,{pen:r,params:a.params,eventName:a.name})},this.events[Je.SendPropData]=function(r,a){var i=re(a.value);if(i&&typeof i=="object"){var o=a.params?t.findOne(a.params):r;for(var n in i)(i[n]===void 0||i[n]==="")&&(i[n]=o[n]);i.id=o.id,t.doSendDataEvent(i,a.extend);return}console.warn("[meta2d] SendPropData value is not an object")},this.events[Je.SendVarData]=function(r,a){var i=re(a.value);if(i&&typeof i=="object"){var o=a.params?t.findOne(a.params):r,n=[],s=function(c){var l={dataId:c,value:i[c]};if(!l.value){var f=o.form.find(function(h){return h.dataIds&&h.dataIds.dataId===l.dataId});f&&(l.value=o[f.key])}n.push(l)};for(var u in i)s(u);t.doSendDataEvent(n,a.extend);return}console.warn("[meta2d] SendVarData value is not an object")},this.events[Je.Navigator]=function(r,a){a.value&&typeof a.value=="string"&&t.navigatorTo(a.value)},this.events[Je.Dialog]=function(r,a){a.params&&typeof a.params=="string"&&a.value&&typeof a.value=="string"&&t.canvas.dialog.show(a.value,a.params)},this.events[Je.SendData]=function(r,a){var i=re(a.value);if(i&&typeof i=="object"&&a.targetType==="id"){var o=a.params?t.findOne(a.params):r;for(var n in i)(i[n]===void 0||i[n]==="")&&(i[n]=o[n]);o.deviceId&&(i.deviceId=o.deviceId),t.sendDataToNetWork(i,r,a);return}},this.events[Je.PostMessage]=function(r,a){if(typeof a.value!="string"){console.warn("[meta2d] Emit value must be a string");return}var i=a.params?t.findOne(a.params):r;if(i.name!=="iframe"||!i.iframe){console.warn("不是嵌入页面");return}var o=Vg(i.iframe.split("?")[1]);i.calculative.singleton.div.children[0].contentWindow.postMessage(JSON.stringify({name:a.value,id:o.id}),"*")},this.events[Je.PostMessageToParent]=function(r,a){if(typeof a.value!="string"){console.warn("[meta2d] Emit value must be a string");return}window.parent.postMessage(JSON.stringify(a.value),"*")}},e.prototype.navigatorTo=function(t){if(t){var r=window.location.href,a=r.split("id=");if(a.length>1){var i=a[1].indexOf("&");i===-1?window.location.href=a[0]+"id="+t:window.location.href=a[0]+"id="+t+a[1].slice(i)}}},e.prototype.doSendDataEvent=function(t,r){var a=this,i=JSON.stringify(t);this.mqttClient&&this.mqttClient.connected&&(r?r.split(",").forEach(function(o){a.mqttClient.publish(o,i)}):this.store.data.mqttTopics&&this.store.data.mqttTopics.split(",").forEach(function(o){a.mqttClient.publish(o,i)})),this.websocket&&this.websocket.readyState===1&&this.websocket.send(i),(this.store.data.https||this.store.data.http)&&this.sendDatabyHttp(i),this.store.emitter.emit("sendData",i)},e.prototype.sendDataToNetWork=function(t,r,a){var i;return dt(this,void 0,void 0,function(){var o,n,c,s,u,c,l,f,h,d,v,y,g,m=this;return vt(this,function(w){switch(w.label){case 0:if(o=re(a.network),o.data&&(Object.assign(o,o.data),delete o.data),!o.url)return[2];if(o.protocol!=="http")return[3,5];if(typeof o.headers=="object")for(n in o.headers)typeof o.headers[n]=="string"&&(c=o.headers[n].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g")),c&&(o.headers[n]=o.headers[n].replace("${"+c[0]+"}",this.getDynamicParam(c[0]))));return s=void 0,u=o.url,o.method==="GET"&&(s="?"+Object.keys(t).map(function(p){return p+"="+t[p]}).join("&")),o.method==="POST"&&u.indexOf("${")>-1&&(c=u.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g")),c&&c.forEach(function(p){u=u.replace("${"+p+"}",wa(r,p)||m.getDynamicParam(p))})),[4,fetch(u+(s||""),{headers:o.headers||{},method:o.method,body:o.method==="POST"?JSON.stringify(t):void 0})];case 1:return l=w.sent(),l.ok?a.callback?[4,l.text()]:[3,3]:[3,4];case 2:if(f=w.sent(),!a.fn)try{if(typeof a.callback!="string")throw new Error("[meta2d] Function callback must be string");h=a.callback,a.fn=new Function("pen","data","context",h)}catch(p){console.error("[meta2d]: Error on make a function:",p)}(i=a.fn)===null||i===void 0||i.call(a,r,f,{meta2d:this,e:a}),w.label=3;case 3:console.info("http消息发送成功"),w.label=4;case 4:return[3,6];case 5:o.protocol==="mqtt"?(d=this.mqttClients.filter(function(p){return p.options.href===o.url}),d&&d.length?d[0].connected&&o.topics.split(",").forEach(function(p){d[0].publish(p,t)}):(v=bc.connect(o.url,o.options),v.on("connect",function(){console.info("mqtt连接成功"),o.topics.split(",").forEach(function(p){v.publish(p,t),v==null||v.end()})}))):o.protocol==="websocket"&&(y=this.websockets.filter(function(p){return p.url===o.url}),y&&y.length?y[0].readyState===1&&y[0].send(t):(g=new WebSocket(o.url,o.protocols||void 0),g.onopen=function(){console.info("websocket连接成功"),g.send(t),setTimeout(function(){g.close()},100)})),w.label=6;case 6:return[2]}})})},e.prototype.resize=function(t,r){this.canvas.resize(t,r),this.render(),this.store.emitter.emit("resize",{width:t,height:r}),this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.init()},e.prototype.addPen=function(t,r,a){return a===void 0&&(a=!0),dt(this,void 0,void 0,function(){return vt(this,function(i){switch(i.label){case 0:return[4,this.canvas.addPen(t,r,a)];case 1:return[2,i.sent()]}})})},e.prototype.addPens=function(t,r){return dt(this,void 0,void 0,function(){return vt(this,function(a){switch(a.label){case 0:return[4,this.canvas.addPens(t,r)];case 1:return[2,a.sent()]}})})},e.prototype.render=function(t){var r;(r=this.canvas)===null||r===void 0||r.render(t)},e.prototype.setBackgroundImage=function(t,r){var a,i,o,n;return dt(this,void 0,void 0,function(){function s(h){return dt(this,void 0,void 0,function(){return vt(this,function(d){return[2,new Promise(function(v){var y=new Image;y.src=h,u.store.options.cdn&&!(h.startsWith("http")||h.startsWith("//")||h.startsWith("data:image"))&&(y.src=u.store.options.cdn+h),y.crossOrigin="anonymous",y.onload=function(){v(y)}})]})})}var u,c,l,f;return vt(this,function(h){switch(h.label){case 0:return u=this,this.store.data.bkImage=t,c=(r==null?void 0:r.width)||((a=this.store.data)===null||a===void 0?void 0:a.width)||((i=this.store.options)===null||i===void 0?void 0:i.width),l=(r==null?void 0:r.height)||((o=this.store.data)===null||o===void 0?void 0:o.height)||((n=this.store.options)===null||n===void 0?void 0:n.height),c&&l?(this.canvas.canvasTemplate.canvas.style.backgroundImage=null,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)):this.canvas.canvasTemplate.canvas.style.backgroundImage=t?"url('"+t+"')":"",t?[4,s(t)]:[3,2];case 1:return f=h.sent(),this.store.bkImg=f,c&&l&&this.canvas&&(this.canvas.canvasTemplate.init(),this.render()),[3,3];case 2:this.store.bkImg=null,h.label=3;case 3:return[2]}})})},e.prototype.setBackgroundColor=function(t){t===void 0&&(t=this.store.data.background),this.store.data.background=t,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)},e.prototype.setGrid=function(t){var r=t===void 0?{}:t,a=r.grid,i=a===void 0?this.store.data.grid:a,o=r.gridColor,n=o===void 0?this.store.data.gridColor:o,s=r.gridSize,u=s===void 0?this.store.data.gridSize:s,c=r.gridRotate,l=c===void 0?this.store.data.gridRotate:c;this.store.data.grid=i,this.store.data.gridColor=n,this.store.data.gridSize=u,this.store.data.gridRotate=l,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)},e.prototype.setRule=function(t){var r=t===void 0?{}:t,a=r.rule,i=a===void 0?this.store.data.rule:a,o=r.ruleColor,n=o===void 0?this.store.data.ruleColor:o;this.store.data.rule=i,this.store.data.ruleColor=n,this.store.patchFlagsTop=!0},e.prototype.open=function(t,r){var a,i,o,n,s,u,c=this;if(r===void 0&&(r=!0),this.clear(!1,t==null?void 0:t.template),this.canvas.autoPolylineFlag=!0,t){this.setBackgroundImage(t.bkImage,t),Object.assign(this.store.data,t),this.store.data.pens=[];try{for(var l=Qe(t.pens),f=l.next();!f.done;f=l.next()){var h=f.value;h.id||(h.id=xe()),!h.calculative&&(h.calculative={canvas:this.canvas}),this.store.pens[h.id]=h}}catch(w){a={error:w}}finally{try{f&&!f.done&&(i=l.return)&&i.call(l)}finally{if(a)throw a.error}}try{for(var d=Qe(t.pens),v=d.next();!v.done;v=d.next()){var h=v.value;this.canvas.makePen(h)}}catch(w){o={error:w}}finally{try{v&&!v.done&&(n=d.return)&&n.call(d)}finally{if(o)throw o.error}}}if(this.canvas.patchFlagsLines.forEach(function(w){w.type&&c.canvas.initLineRect(w)}),this.store.data.template||(this.store.data.template=xe()),r||(this.canvas.opening=!0),this.initBindDatas(),this.initBinds(),this.initMessageEvents(),this.initGlobalTriggers(),this.render(),this.listenSocket(),this.connectSocket(),this.connectNetwork(),this.startDataMock(),this.startAnimate(),this.startVideo(),this.doInitJS(),this.store.data.iconUrls)try{for(var y=Qe(this.store.data.iconUrls),g=y.next();!g.done;g=y.next()){var m=g.value;b$(m,function(){c.render()})}}catch(w){s={error:w}}finally{try{g&&!g.done&&(u=y.return)&&u.call(y)}finally{if(s)throw s.error}}this.canvas.autoPolylineFlag=!1,this.store.emitter.emit("opened"),this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.init()},e.prototype.cacheData=function(t){if(t&&this.store.options.cacheLength){var r=this.store.cacheDatas.findIndex(function(i){return i.data&&i.data._id===t});if(r===-1)this.store.cacheDatas.push({data:re(this.store.data,!0)}),this.store.cacheDatas.length>this.store.options.cacheLength&&this.store.cacheDatas.shift();else{var a=this.store.cacheDatas.splice(r,1)[0];this.store.cacheDatas.push(a)}}},e.prototype.loadCacheData=function(t){var r=this,a=this.store.cacheDatas.findIndex(function(i){return i.data&&i.data._id===t});a!==-1&&(this.store.data=this.store.cacheDatas[a].data,this.setBackgroundImage(this.store.data.bkImage),this.store.pens={},this.store.data.pens.forEach(function(i){i.calculative.canvas=r.canvas,r.store.pens[i.id]=i,he.path2dDraws[i.name]&&r.store.path2dMap.set(i,he.path2dDraws[i.name](i)),i.type&&r.store.path2dMap.set(i,he.path2dDraws[i.name](i)),i.image&&(i.calculative.imageDrawed=!1,r.canvas.loadImage(i))}),this.render())},e.prototype.initBindDatas=function(){var t=this;this.store.bindDatas={},this.store.data.pens.forEach(function(r){var a;(a=r.form)===null||a===void 0||a.forEach(function(i){var o;i.dataIds&&(Array.isArray(i.dataIds)?o=i.dataIds:o=[i.dataIds]),o==null||o.forEach(function(n){t.store.bindDatas[n.dataId]||(t.store.bindDatas[n.dataId]=[]),t.store.bindDatas[n.dataId].push({id:r.id,formItem:i})})})})},e.prototype.initBinds=function(){var t=this;this.store.bind={},this.store.data.pens.forEach(function(r){var a;(a=r.realTimes)===null||a===void 0||a.forEach(function(i){i.bind&&i.bind.id&&(t.store.bind[i.bind.id]||(t.store.bind[i.bind.id]=[]),t.store.bind[i.bind.id].push({id:r.id,key:i.key}))})})},e.prototype.connectSocket=function(){this.connectWebsocket(),this.connectMqtt(),this.connectHttp()},e.prototype.doInitJS=function(){var t=this.store.data.initJs;if(t&&t.trim())try{var r=new Function("context",t);r({meta2d:this})}catch(a){console.warn("initJs error",a)}},e.prototype.drawLine=function(t){t&&Pw(this.store),this.canvas.drawingLineName=t},e.prototype.alignPenToGrid=function(t){this.canvas.alignPenToGrid(t)},e.prototype.drawingPencil=function(){this.canvas.drawingPencil()},e.prototype.stopPencil=function(){this.canvas.stopPencil()},e.prototype.lock=function(t){this.store.data.locked=t,this.finishDrawLine(!0),this.canvas.drawingLineName="",this.stopPencil(),this.store.data.pens.forEach(function(r){var a;r.externElement===!0&&!((a=r.calculative.singleton)===null||a===void 0)&&a.div&&Ye(r,r.calculative.singleton.div)}),t>0&&this.initMessageEvents()},e.prototype.finishDrawLine=function(t){return dt(this,void 0,void 0,function(){return vt(this,function(r){switch(r.label){case 0:return[4,this.canvas.finishDrawline(t)];case 1:return r.sent(),[2]}})})},e.prototype.finishPencil=function(){return dt(this,void 0,void 0,function(){return vt(this,function(t){switch(t.label){case 0:return[4,this.canvas.finishPencil()];case 1:return t.sent(),[2]}})})},e.prototype.updateLineType=function(t,r){if(!(!t||t.name!="line"||!r||!this.canvas[r])){t.lineName=r;var a=Ve(t),i=Te(t);a.prev=void 0,a.next=void 0,i.prev=void 0,i.next=void 0,t.calculative.worldAnchors=[a,i],t.calculative.activeAnchor=a,this.canvas[r](this.store,t,i),t.lineName==="curve"&&(a.prev={penId:a.penId,x:a.x-50,y:a.y},a.next={penId:a.penId,x:a.x+50,y:a.y},i.prev={penId:i.penId,x:i.x-50,y:i.y},i.next={penId:i.penId,x:i.x+50,y:i.y}),t.calculative.activeAnchor=void 0,this.canvas.initLineRect(t),this.render()}},e.prototype.addDrawLineFn=function(t,r){this.canvas[t]=r,this.canvas.drawLineFns.push(t)},e.prototype.removeDrawLineFn=function(t){var r=this.canvas.drawLineFns.indexOf(t);r>-1&&this.canvas.drawLineFns.splice(r,1)},e.prototype.showMagnifier=function(){this.canvas.showMagnifier()},e.prototype.hideMagnifier=function(){this.canvas.hideMagnifier()},e.prototype.toggleMagnifier=function(){this.canvas.toggleMagnifier()},e.prototype.clear=function(t,r){var a,i,o;t===void 0&&(t=!0);try{for(var n=Qe(this.store.data.pens),s=n.next();!s.done;s=n.next()){var u=s.value;(o=u.onDestroy)===null||o===void 0||o.call(u,u)}}catch(c){a={error:c}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(a)throw a.error}}u$(this.store,r),this.hideInput(),this.canvas.tooltip.hide(),this.map&&this.map.isShow&&(this.map.show(),this.map.setView()),this.canvas.clearCanvas(),sessionStorage.removeItem("page"),this.store.clipboard=void 0,this.store.sameTemplate||(this.canvas.canvasTemplate.bgPatchFlags=!0),this.store.patchFlagsBackground=!0,this.store.patchFlagsTop=!0,this.setBackgroundImage(void 0),t&&this.render()},e.prototype.emit=function(t,r){this.store.emitter.emit(t,r)},e.prototype.on=function(t,r){return this.store.emitter.on(t,r),this},e.prototype.off=function(t,r){return this.store.emitter.off(t,r),this},e.prototype.registerMoveDock=function(t){this.canvas.customMoveDock=t},e.prototype.registerResizeDock=function(t){this.canvas.customResizeDock=t},e.prototype.find=function(t){return this.canvas.find(t)},e.prototype.findOne=function(t){return this.canvas.findOne(t)},e.prototype.getPenRect=function(t){return this.canvas.getPenRect(t)},e.prototype.setPenRect=function(t,r,a){a===void 0&&(a=!0),this.canvas.setPenRect(t,r,a)},e.prototype.startAnimate=function(t,r){var a=this;this.stopAnimate(t);var i;t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(function(o){return(o.type||o.frames)&&o.autoPlay||o.animations&&o.animations.length&&o.animations.findIndex(function(n){return n.autoPlay})!==-1}),i.length&&(i.forEach(function(o){var n,s;if(o.calculative.pause){var u=Date.now()-o.calculative.pause;o.calculative.pause=void 0,o.calculative.frameStart+=u,o.calculative.frameEnd+=u}else{var c=-1;if(r!==void 0&&o.animations){if(typeof r=="string"){if(c=o.animations.findIndex(function(f){return f.name===r}),c===-1)return}else if(typeof r=="number")if(o.animations.length>r)c=r;else return}else r===void 0&&(c=(n=o.animations)===null||n===void 0?void 0:n.findIndex(function(f){return f.autoPlay}),c===-1&&(!((s=o.animations)===null||s===void 0)&&s.length)&&(c=0));if(c!==-1&&c!==void 0){var l=re(o.animations[c]);delete l.name,l.currentAnimation=c,!o.type&&l.frames&&(l.showDuration=a.calcAnimateDuration(l)),a.setValue(mt({id:o.id},l),{doEvent:!1,history:!1})}a.store.animates.add(o),o.type||a.store.animateMap.set(o,o.calculative.canvas.getFrameProps(o))}}),this.initImageCanvas(i),this.canvas.animate())},e.prototype.pauseAnimate=function(t){var r=[];t?typeof t=="string"?r=this.find(t):r=t:this.store.animates.forEach(function(a){r.push(a)}),r.forEach(function(a){a.calculative.pause||(a.calculative.pause=Date.now())})},e.prototype.stopAnimate=function(t){var r=this,a=[];t?typeof t=="string"?a=this.find(t):a=t:this.store.animates.forEach(function(i){a.push(i)}),a.forEach(function(i){i.currentAnimation=void 0,i.calculative.pause=void 0,i.calculative.start=void 0,i.calculative.duration=void 0,i.calculative.animatePos=0,r.store.animates.delete(i),r.canvas.restoreNodeAnimate(i),r.canvas.updateLines(i),r.store.animateMap.delete(i)}),this.initImageCanvas(a),setTimeout(function(){var i;(i=r.canvas)===null||i===void 0||i.calcActiveRect(),r.render()},20)},e.prototype.startVideo=function(t){var r;t?typeof t=="string"?r=this.find(t):r=t:r=this.store.data.pens.filter(function(a){return(a.video||a.audio)&&a.autoPlay}),r.forEach(function(a){var i,o;(i=a.calculative.media)===null||i===void 0||i.play(),(o=a.onStartVideo)===null||o===void 0||o.call(a,a)})},e.prototype.pauseVideo=function(t){var r=[];t?typeof t=="string"?r=this.find(t):r=t:r=this.store.data.pens.filter(function(a){return(a.video||a.audio)&&a.autoPlay}),r.forEach(function(a){var i,o;(i=a.calculative.media)===null||i===void 0||i.pause(),(o=a.onPauseVideo)===null||o===void 0||o.call(a,a)})},e.prototype.stopVideo=function(t){var r=[];t?typeof t=="string"?r=this.find(t):r=t:r=this.store.data.pens.filter(function(a){return(a.video||a.audio)&&a.autoPlay}),r.forEach(function(a){var i;a.calculative.media&&(a.calculative.media.currentTime=0,a.calculative.media.pause()),(i=a.onStopVideo)===null||i===void 0||i.call(a,a)})},e.prototype.calcAnimateDuration=function(t){return t.frames.reduce(function(r,a){return r+a.duration},0)},e.prototype.combine=function(t,r){var a=this;if(t===void 0&&(t=this.store.active),!(!t||!t.length)){var i=re(t);if(t.length===1&&t[0].type){t[0].type=Ae.Node,this.canvas.active(t),this.pushHistory({type:ce.Update,initPens:i,pens:re(t,!0)}),this.render();return}var o=kr(t),n=mt(mt({id:xe(),name:"combine"},o),{children:[],showChild:r});this.canvas.makePen(n);var s=re(n),u=1/0;return t.forEach(function(c){var l,f=a.store.data.pens.findIndex(function(d){return d.id===c.id});if(f<u&&(u=f),!(c===n||c.parentId===n.id||c.id===n.id)){n.children.push(c.id),c.parentId=n.id;var h=ss(c.calculative.worldRect,o);Object.assign(c,h),c.locked=(l=c.lockedOnCombine)!==null&&l!==void 0?l:ke.DisableMove,c.locked=c.interaction||NN.includes(c.name)?0:c.locked}}),this.store.data.pens.splice(u,0,n),this.store.data.pens.pop(),this.canvas.active([n]),this.pushHistory({type:ce.Add,pens:[s],step:3}),this.pushHistory({type:ce.Update,initPens:[s],pens:[n],step:3}),this.pushHistory({type:ce.Update,initPens:i,pens:t,step:3}),r!=null&&(t.forEach(function(c){Dr(c,!0)}),this.initImageCanvas([n])),this.store.emitter.emit("combine",[n]),this.render(),n}},e.prototype.uncombine=function(t){var r=this;if(!t&&this.store.active&&(t=this.store.active[0]),!(!t||!t.children)){var a=t.children.map(function(n){return r.store.pens[n]}),i=re(a);a.forEach(function(n){n.parentId=void 0,n.x=n.calculative.worldRect.x,n.y=n.calculative.worldRect.y,n.width=n.calculative.worldRect.width,n.height=n.calculative.worldRect.height,n.locked=ke.None,n.calculative.active=void 0,n.calculative.hover=!1,r.setVisible(n,!0)});var o=this.isCombine(t)?3:2;this.pushHistory({type:ce.Update,initPens:i,pens:a,step:o}),i=[re(t)],t.children=void 0,this.pushHistory({type:ce.Update,initPens:i,pens:[t],step:o}),this.isCombine(t)&&(this.delete([t]),this.store.histories[this.store.histories.length-1].step=o),this.inactive()}},e.prototype.appendChild=function(t){if(t===void 0&&(t=this.store.active),!!t&&!(t.length<2)){var r=t.findIndex(function(i){return i.name==="combine"&&i.showChild!==void 0});if(r!==-1){var a=t[r];this.pushChildren(a,at(at([],St(t.slice(0,r)),!1),St(t.slice(r+1)),!1)),t.forEach(function(i){Dr(i,!0)}),this.initImageCanvas(t),this.render()}else console.warn("Invalid operation!")}},e.prototype.isCombine=function(t){return!!(t.name==="combine"||t.children&&t.children.length>0)},e.prototype.active=function(t,r){r===void 0&&(r=!0),this.canvas.active(t,r)},e.prototype.inactive=function(){this.canvas.inactive()},e.prototype.activeAll=function(){this.canvas.active(this.store.data.pens.filter(function(t){return!t.parentId&&t.locked!==ke.Disable})),this.render()},e.prototype.delete=function(t,r,a){r===void 0&&(r=!1),a===void 0&&(a=!0),this.canvas.delete(t,r,a)},e.prototype.scale=function(t,r){r===void 0&&(r={x:0,y:0}),this.canvas.scale(t,r)},e.prototype.translate=function(t,r){this.canvas.translate(t,r)},e.prototype.translatePens=function(t,r,a){this.canvas.translatePens(t,r,a)},e.prototype.getParent=function(t,r){return jt(t,r)},e.prototype.getAllChildren=function(t){return br(t,this.store)},e.prototype.getAllFollowers=function(t){return ih(t,this.store)},e.prototype.data=function(){var t=re(this.store.data),r=this.store.data,a=r.pens,i=r.paths;t.version=qb.version,t.paths={};var o=function(s){Object.prototype.hasOwnProperty.call(i,s)&&a.find(function(u){return u.pathId===s})&&(t.paths[s]=i[s])};for(var n in i)o(n);return t.dataPoints=at(at([],St(Object.keys(this.store.bind)),!1),St(Object.keys(this.store.bindDatas)),!1),t},e.prototype.copy=function(t){this.canvas.copy(t)},e.prototype.cut=function(t){this.canvas.cut(t)},e.prototype.paste=function(){this.canvas.paste()},e.prototype.undo=function(){this.canvas.undo()},e.prototype.redo=function(){this.canvas.redo()},e.prototype.listenSocket=function(){try{var t=void 0,r=this.store.data.socketCbJs;if(r&&(t=new Function("e","context",r)),!t)return this.socketFn=null,!1;this.socketFn=t}catch(a){return console.error("Create the function for socket:",a),!1}return!0},e.prototype.connectWebsocket=function(t){var r=this;this.closeWebsocket(),t&&(this.store.data.websocket=t),this.store.data.websocket&&(this.websocket=new WebSocket(this.store.data.websocket,this.store.data.websocketProtocols||void 0),this.websocket.onmessage=function(a){r.socketCallback(a.data,{type:"websocket",url:r.store.data.websocket})},this.websocket.onerror=function(a){r.store.emitter.emit("error",{type:"websocket",error:a})},this.websocket.onclose=function(){if(r.store.options.reconnetTimes&&(r.websocketTimes++,r.websocketTimes>=r.store.options.reconnetTimes)){r.websocketTimes=0,r.closeWebsocket();return}console.info("Canvas websocket closed and reconneting..."),r.connectWebsocket()})},e.prototype.closeWebsocket=function(){this.websocket&&(this.websocket.onclose=void 0,this.websocket.close(),this.websocket=void 0)},e.prototype.connectMqtt=function(t){var r=this;if(this.closeMqtt(),t&&(this.store.data.mqtt=t.mqtt,this.store.data.mqttTopics=t.mqttTopics,this.store.data.mqttOptions=t.mqttOptions),this.store.data.mqtt){this.store.data.mqttOptions.clientId&&!this.store.data.mqttOptions.customClientId&&(this.store.data.mqttOptions.clientId=xe());var a=mt({},this.store.data.mqttOptions);a.username||delete a.username,a.password||delete a.password;var i=a.username,o=a.password;i&&o||!i&&!o?(this.mqttClient=bc.connect(this.store.data.mqtt,a),this.mqttClient.on("message",function(n,s){r.socketCallback(s.toString(),{topic:n,type:"mqtt",url:r.store.data.mqtt})}),this.mqttClient.on("error",function(n){r.store.emitter.emit("error",{type:"mqtt",error:n})}),this.mqttClient.on("close",function(){r.store.options.reconnetTimes&&(r.mqttTimes++,r.mqttTimes>=r.store.options.reconnetTimes&&(r.mqttTimes=0,r.closeMqtt()))}),this.store.data.mqttTopics&&this.mqttClient.subscribe(this.store.data.mqttTopics.split(","))):console.warn("缺少用户名或密码")}},e.prototype.closeMqtt=function(){var t;(t=this.mqttClient)===null||t===void 0||t.end()},e.prototype.connectHttp=function(){var t=this;this.closeHttp();var r=this.store.data.https;if(r)this.store.data.cancelFirstConnect||r.forEach(function(s){return dt(t,void 0,void 0,function(){return vt(this,function(u){return this.oldRequestHttp(s),[2]})})}),r.forEach(function(s,u){s.http&&(s.times=0,t.httpTimerList[u]=setInterval(function(){return dt(t,void 0,void 0,function(){return vt(this,function(c){return this.oldRequestHttp(s),this.store.options.reconnetTimes&&(s.times++,s.times>=this.store.options.reconnetTimes&&(s.times=0,clearInterval(this.httpTimerList[u]),this.httpTimerList[u]=void 0)),[2]})})},s.httpTimeInterval||1e3))});else{var a=this.store.data,i=a.http,o=a.httpTimeInterval,n=a.httpHeaders;i&&(this.httpTimer=setInterval(function(){return dt(t,void 0,void 0,function(){var s,u;return vt(this,function(c){switch(c.label){case 0:return[4,fetch(i,{headers:n})];case 1:return s=c.sent(),s.ok?[4,s.text()]:[3,3];case 2:u=c.sent(),this.socketCallback(u,{type:"http",url:i}),c.label=3;case 3:return[2]}})})},o||1e3))}},e.prototype.oldRequestHttp=function(t){return dt(this,void 0,void 0,function(){var r,a,i;return vt(this,function(o){switch(o.label){case 0:return r=re(t),r.http?[4,fetch(r.http,{headers:r.httpHeaders,method:r.method||"GET",body:r.method==="POST"?JSON.stringify(r.body):void 0})]:[3,4];case 1:return a=o.sent(),a.ok?[4,a.text()]:[3,3];case 2:return i=o.sent(),this.socketCallback(i,{type:"http",url:r.http}),[3,4];case 3:this.store.emitter.emit("error",{type:"http",error:a}),o.label=4;case 4:return[2]}})})},e.prototype.sendDatabyHttp=function(t){return dt(this,void 0,void 0,function(){var r,a,i,o,n,s=this;return vt(this,function(u){switch(u.label){case 0:return r=this.store.data.https,r?(r.forEach(function(c){return dt(s,void 0,void 0,function(){var l;return vt(this,function(f){switch(f.label){case 0:return c.http?[4,fetch(c.http,{method:"post",body:t,headers:c.httpHeaders})]:[3,2];case 1:l=f.sent(),l.ok&&console.info("http消息发送成功"),f.label=2;case 2:return[2]}})})}),[3,3]):[3,1];case 1:return a=this.store.data,i=a.http,o=a.httpHeaders,i?[4,fetch(i,{method:"post",body:t,headers:o})]:[3,3];case 2:n=u.sent(),n.ok&&console.info("http消息发送成功"),u.label=3;case 3:return[2]}})})},e.prototype.closeHttp=function(){clearInterval(this.httpTimer),this.httpTimer=void 0,this.httpTimerList&&this.httpTimerList.forEach(function(t){clearInterval(t),t=void 0})},e.prototype.connectNetwork=function(){var t=this;this.closeNetwork();var r=this.store.data.networks,a=[];if(r){var i=0;this.mqttClients=[];var o=0;this.websockets=[],r.forEach(function(n){n.type==="subscribe"&&(n.protocol==="mqtt"?(n.index=i,n.options.clientId&&!n.options.customClientId&&(n.options.clientId=xe()),n.times=0,t.mqttClients[i]=bc.connect(n.url,n.options),t.mqttClients[i].on("message",function(s,u){t.socketCallback(u.toString(),{topic:s,type:"mqtt",url:n.url})}),t.mqttClients[i].on("error",function(s){t.store.emitter.emit("error",{type:"mqtt",error:s})}),t.mqttClients[i].on("close",function(){var s;t.store.options.reconnetTimes&&(n.times++,n.times>=t.store.options.reconnetTimes&&(n.times=0,t.mqttClients&&((s=t.mqttClients[n.index])===null||s===void 0||s.end())))}),n.topics&&t.mqttClients[i].subscribe(n.topics.split(",")),i+=1):n.protocol==="websocket"?(n.index=o,t.connectNetWebSocket(n),o+=1):n.protocol==="http"&&a.push({url:n.url,interval:n.interval,headers:n.headers||void 0,method:n.method,body:n.body}))})}this.onNetworkConnect(a)},e.prototype.connectNetWebSocket=function(t){var r=this,a;this.websockets[t.index]&&(this.websockets[t.index].onclose=void 0,(a=this.websockets[t.index])===null||a===void 0||a.close(),this.websockets[t.index]=void 0),this.websockets[t.index]=new WebSocket(t.url,t.protocols||void 0),this.websockets[t.index].onmessage=function(i){r.socketCallback(i.data,{type:"websocket",url:t.url})},this.websockets[t.index].onerror=function(i){r.store.emitter.emit("error",{type:"websocket",error:i})},this.websockets[t.index].onclose=function(){var i;if(r.store.options.reconnetTimes&&(t.times++,t.times>=r.store.options.reconnetTimes)){t.times=0,r.websockets[t.index].onclose=void 0,(i=r.websockets[t.index])===null||i===void 0||i.close(),r.websockets[t.index]=void 0;return}setTimeout(function(){console.info("Canvas websocket closed and reconneting..."),r.connectNetWebSocket(t)},2e3)}},e.prototype.randomString=function(t){t=t||32;for(var r="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",a=r.length,i="",o=0;o<t;o++)i+=r.charAt(Math.floor(Math.random()*a));return i},e.prototype.mockValue=function(t){var r=void 0;if(t.enableMock&&t.mock!==void 0)if(t.type==="float")if(t.mock&&t.mock.indexOf(",")!==-1){var a=t.mock.split(","),i=Math.floor(Math.random()*a.length);r=parseFloat(a[i])}else if(t.mock&&t.mock.indexOf("-")!==-1){var o=void 0,n=void 0,s=void 0,a=t.mock.split("-");if(t.mock.charAt(0)==="-"?a.length===4?(o=-parseFloat(a[3]),n=-parseFloat(a[1]),s=a[3]):(o=parseFloat(a[2]),n=-parseFloat(a[1]),s=a[2]):(o=parseFloat(a[1]),n=parseFloat(a[0]),s=a[1]),(s+"").indexOf(".")!==-1){var u=(s+"").split(".")[1].length;r=(Math.random()*(o-n)+n).toFixed(u)}else r=Math.random()*(o-n)+n}else r=parseFloat(t.mock);else if(t.type==="integer")if(t.mock&&t.mock.indexOf(",")!==-1){var a=t.mock.split(","),i=Math.floor(Math.random()*a.length);r=parseInt(a[i])}else if(t.mock&&t.mock.indexOf("-")!==-1){var o=void 0,n=void 0,a=t.mock.split("-");t.mock.charAt(0)==="-"?a.length===4?(o=-parseFloat(a[3]),n=-parseFloat(a[1])):(o=parseFloat(a[2]),n=-parseFloat(a[1])):(o=parseInt(a[1]),n=parseInt(a[0])),r=parseInt(Math.random()*(o-n)+n+"")}else r=parseInt(t.mock);else if(t.type==="bool")typeof t.mock=="boolean"?r=t.mock:t.mock==="true"?r=!0:t.mock==="false"?r=!1:r=Math.random()<.5;else if(t.type==="object"||t.type==="array")t.mock;else if(t.mock&&t.mock.indexOf(",")!==-1){var c=t.mock.substring(1,t.mock.length-1),a=c.split(","),i=Math.floor(Math.random()*a.length);r=a[i]}else if(t.mock&&t.mock.startsWith("[")&&t.mock.endsWith("]")){var s=parseInt(t.mock.substring(1,t.mock.length-1));r=this.randomString(s)}else r=t.mock;return r},e.prototype.dataMock=function(){var t=this,r,a,i=[];(a=(r=this.store.data.dataset)===null||r===void 0?void 0:r.devices)===null||a===void 0||a.forEach(function(o){var n=t.mockValue(o);n!==void 0&&i.push({id:o.id,value:n})}),i.length&&this.setDatas(i,{render:!0,doEvent:!0,history:!1})},e.prototype.startDataMock=function(){var t=this,r=this.store.data.enableMock;r&&(this.stopDataMock(),this.initBinds(),this.updateTimer=setInterval(function(){t.store.data.pens.forEach(function(a){t.penMock(a)}),t.dataMock(),t.render()},this.store.data.networkInterval||1e3))},e.prototype.stopDataMock=function(){clearInterval(this.updateTimer),this.updateTimer=void 0},e.prototype.penMock=function(t){var r=this,a;if(t.realTimes){var i={};if(t.realTimes.forEach(function(n){var s=r.mockValue(n);s!==void 0&&(i[n.key]=s)}),Object.keys(i).length){var o=t.onBeforeValue?t.onBeforeValue(t,i):i;this.canvas.updateValue(t,o),(a=t.onValue)===null||a===void 0||a.call(t,t),this.store.emitter.emit("valueUpdate",t)}}},e.prototype.penNetwork=function(t){var r={url:t.apiUrl,method:t.apiMethod,headers:t.apiHeaders,body:t.apiBody};this.requestHttp(r),t.apiEnable?(this.store.pensNetwork||(this.store.pensNetwork={}),this.store.pensNetwork[t.id]=r):delete this.store.pensNetwork[t.id]},e.prototype.getDynamicParam=function(t){function r(o){var n,s=new RegExp("(^| )"+o+"=([^;]*)(;|$)");return(n=document.cookie.match(s))?decodeURIComponent(n[2]):""}var a=Vg(),i=a[t]||localStorage[t]||r(t)||"";return i},e.prototype.onNetworkConnect=function(t){var r=this;if(t&&t.length){if(this.store.pensNetwork)for(var a in this.store.pensNetwork)t.push(this.store.pensNetwork[a]);this.store.data.cancelFirstConnect||t.forEach(function(i){return dt(r,void 0,void 0,function(){return vt(this,function(o){return this.requestHttp(i),[2]})})}),t.forEach(function(i,o){i.times=0,r.updateTimerList[o]=setInterval(function(){return dt(r,void 0,void 0,function(){return vt(this,function(n){return this.requestHttp(i),this.store.options.reconnetTimes&&(i.times++,i.times>=this.store.options.reconnetTimes&&(i.times=0,clearInterval(this.updateTimerList[o]),this.updateTimerList[o]=void 0)),[2]})})},i.interval||1e3)})}},e.prototype.requestHttp=function(t){return dt(this,void 0,void 0,function(){var r,a,i,a,i,o,n;return vt(this,function(s){switch(s.label){case 0:if(r=re(t),!r.url)return[3,4];if(typeof r.headers=="object")for(a in r.headers)typeof r.headers[a]=="string"&&(i=r.headers[a].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g")),i&&(r.headers[a]=r.headers[a].replace("${"+i[0]+"}",this.getDynamicParam(i[0]))));if(typeof r.body=="object")for(a in r.body)typeof r.body[a]=="string"&&(i=r.body[a].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g")),i&&(r.body[a]=r.body[a].replace("${"+i[0]+"}",this.getDynamicParam(i[0]))));return[4,fetch(r.url,{headers:r.headers,method:r.method,body:r.method==="GET"?void 0:JSON.stringify(r.body)})];case 1:return o=s.sent(),o.ok?[4,o.text()]:[3,3];case 2:return n=s.sent(),this.socketCallback(n,{type:"http",url:r.url}),[3,4];case 3:this.store.emitter.emit("error",{type:"http",error:o}),s.label=4;case 4:return[2]}})})},e.prototype.closeNetwork=function(){this.mqttClients&&this.mqttClients.forEach(function(t){t.end()}),this.websockets&&this.websockets.forEach(function(t){t&&(t.onclose=void 0,t.close(),t=void 0)}),this.mqttClients=void 0,this.websockets=void 0,this.updateTimerList&&this.updateTimerList.forEach(function(t){clearInterval(t),t=void 0})},e.prototype.socketCallback=function(t,r){var a=this;this.store.emitter.emit("socket",{message:t,context:r});var i=t;if(!(this.socketFn&&(i=this.socketFn(t,{meta2d:this,type:r.type,topic:r.topic,url:r.url}),!i))){i===!0&&(i=t);var o;if(i.constructor===Object||i.constructor===Array)o=i;else if(typeof i=="string")try{o=JSON.parse(i)}catch(n){console.warn("Invalid socket data:",o,n)}else return;o&&(Array.isArray(o)||(o=[o]),o.length&&(o[0].dataId?this.setDatas(o):o.forEach(function(n){a.setValue(n)})))}},e.prototype.setDatas=function(t,r){var a=this,i=r===void 0?{}:r,o=i.render,n=o===void 0?!0:o,s=i.doEvent,u=s===void 0?!0:s,c=i.history,l=new Map;t.forEach(function(d){var v,y;(v=a.store.bindDatas[d.dataId])===null||v===void 0||v.forEach(function(g){var m,w=a.store.pens[g.id];if(w){var p=l.get(w);if(!w.noOnBinds&&typeof w.onBinds=="function"){if(p)return;l.set(w,w.onBinds(w,t,g.formItem));return}p?p[g.formItem.key]=d.value:(p=(m={id:g.id},m[g.formItem.key]=d.value,m),l.set(w,p))}}),(y=a.store.bind[d.id])===null||y===void 0||y.forEach(function(g){var m,w=a.store.pens[g.id];if(w){var p=l.get(w);p?p[g.key]=d.value:(p=(m={id:g.id},m[g.key]=d.value,m),l.set(w,p))}})}),this.store.data.locked&&this.doDataEvent(t);var f,h;c&&(f=[]),l.forEach(function(d,v){a.setValue(d,{render:!1,doEvent:u,history:!1}),c&&(f.push(re(v,!0)),h.push(v))}),n&&this.render(),c&&this.pushHistory({type:ce.Update,initPens:f,pens:h})},e.prototype.setValue=function(t,r){var a=this,i=r===void 0?{}:r,o=i.render,n=o===void 0?!0:o,s=i.doEvent,u=s===void 0?!0:s,c=i.history,l=[];if(t){if(t.id){if(t.id===this.store.data.id){this.setDatabyOptions(t),t.bkImage&&this.setBackgroundImage(t.bkImage),t.background&&this.setBackgroundColor(t.background),this.render();return}var f=this.store.pens[t.id];if(f)l=[f];else{var h=this.store.bind[t.id];if(h&&h.length){l=[],this.setDatas([t],{render:n,doEvent:u,history:c});return}}}else if(t.dataId){l=[],this.setDatas([t],{render:n,doEvent:u,history:c});return}else if(t.tag)l=this.find(t.tag);else{var d=[];for(var v in t)d.push({dataId:v,id:v,value:t[v]});d.length&&this.setDatas(d,{render:n,doEvent:u,history:c});return}c=c&&!this.store.data.locked;var y;if(c&&(y=re(l)),l.forEach(function(m){var w,p=m.onBeforeValue?m.onBeforeValue(m,t):t;t.frames&&(a.stopAnimate([m]),t.showDuration||(t.showDuration=t.frames.reduce(function(x,T){return x+T.duration},0))),lh(m,p),a.canvas.updateValue(m,p),(w=m.onValue)===null||w===void 0||w.call(m,m)}),!this.store.data.locked&&this.store.active.length&&!this.canvas.movingPens&&this.canvas.calcActiveRect(),c){var g=re(l);this.pushHistory({type:ce.Update,initPens:y,pens:g})}u&&l.forEach(function(m){a.store.emitter.emit("valueUpdate",m)}),n&&this.render()}},e.prototype._setValue=function(t,r){r===void 0&&(r=!1),this.setValue(t,{history:r,render:!1,doEvent:!1})},e.prototype.pushHistory=function(t){this.canvas.pushHistory(t)},e.prototype.showInput=function(t,r){this.canvas.showInput(t,r)},e.prototype.hideInput=function(){this.canvas.hideInput()},e.prototype.clearDropdownList=function(){this.canvas.clearDropdownList()},e.prototype.clearRuleLines=function(){this.canvas.clearRuleLines()},e.prototype.initGlobalTriggers=function(){var t=this,r;this.store.globalTriggers={},(r=this.store.data.triggers)===null||r===void 0||r.forEach(function(a){a.conditions.forEach(function(i){i.source&&(t.store.globalTriggers[i.source]||(t.store.globalTriggers[i.source]=[]),t.store.globalTriggers[i.source].includes(a)||t.store.globalTriggers[i.source].push(a))})})},e.prototype.initMessageEvents=function(){var t=this;this.store.messageEvents={},this.store.data.pens.forEach(function(r){var a;(a=r.events)===null||a===void 0||a.forEach(function(i){i.name==="message"&&i.message&&(t.store.messageEvents[i.message]||(t.store.messageEvents[i.message]=[]),t.store.messageEvents[i.message].push({pen:r,event:i}))})})},e.prototype.dataJudegeCondition=function(t,r,a){var i=a.type;a.target;var o=a.fnJs,n=a.fn,s=a.operator,u=a.valueType,c=!1;if(i==="fn"){if(n)c=n(t,{meta2d:this});else if(o){try{a.fn=new Function("data","context",o)}catch(h){console.error("Error: make function:",h)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{var l=a.value;u==="prop"&&(l=t[a.value]);var f=t[r];switch(s){case">":c=f>+l;break;case">=":c=f>=+l;break;case"<":c=f<+l;break;case"<=":c=f<=+l;break;case"=":case"==":c=f==l;break;case"!=":c=f!=l;break;case"[)":c=ua(+f,l);break;case"![)":c=!ua(+f,l);break;case"[]":c=fa(f,l);break;case"![]":c=!fa(f,l);break}}return c},e.prototype.judgeCondition=function(t,r,a){var i=a.type,o=a.target,n=a.fnJs,s=a.fn,u=a.operator,c=a.valueType,l=!1;if(i==="fn"){if(s)l=s(t,{meta2d:this});else if(n){try{a.fn=new Function("pen","context",n)}catch(d){console.error("Error: make function:",d)}a.fn&&(l=a.fn(t,{meta2d:this}))}}else{var f=a.value;c==="prop"&&(f=this.store.pens[o][a.value]);var h=wa(t,r);switch(["x","y","width","height"].includes(r)&&(h=this.getPenRect(t)[r]),u){case">":l=h>+f;break;case">=":l=h>=+f;break;case"<":l=h<+f;break;case"<=":l=h<=+f;break;case"=":case"==":l=h==f;break;case"!=":l=h!=f;break;case"[)":l=ua(+h,f);break;case"![)":l=!ua(+h,f);break;case"[]":l=fa(h,f);break;case"![]":l=!fa(h,f);break}}return l},e.prototype.pushChildren=function(t,r){var a=this,i=[re(t,!0)],o=[];t.children||(t.children=[]);var n=[];r.forEach(function(u){var c,l=re(u,!0);if((!u.id||!a.store.pens[u.id])&&(a.canvas.makePen(u),l=null),u.parentId){var f=a.store.pens[u.parentId],h=f.children.findIndex(function(v){return v===u.id});i.push(re(f,!0)),f.children.splice(h,1),n.push(re(f,!0))}t.children.push(u.id),u.parentId=t.id;var d=ss(u.calculative.worldRect,t.calculative.worldRect);Object.assign(u,d),u.locked=(c=u.lockedOnCombine)!==null&&c!==void 0?c:ke.DisableMove,l?(i.push(l),n.push(re(u,!0))):o.push(re(u,!0))}),n.push(re(t,!0));var s=1;o.length&&(s=2,this.pushHistory({type:ce.Add,pens:o,step:s})),this.pushHistory({type:ce.Update,initPens:i,pens:n,step:s})},e.prototype.toPng=function(t,r,a,i){return a===void 0&&(a=!1),this.canvas.toPng(t,r,a,i)},e.prototype.activeToPng=function(t,r){return this.canvas.activeToPng(t,r)},e.prototype.pensToPng=function(t,r,a){return t===void 0&&(t=this.store.active),this.canvas.pensToPng(t,r,a)},e.prototype.downloadPng=function(t,r,a){var i,o,n=this,s;try{for(var u=Qe(this.store.data.pens),c=u.next();!c.done;c=u.next()){var l=c.value;(l.calculative.img||["iframe"].includes(l.name))&&((s=l.onRenderPenRaw)===null||s===void 0||s.call(l,l))}}catch(f){i={error:f}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}setTimeout(function(){var f=document.createElement("a");f.setAttribute("download",(t||n.store.data.name||"le5le.meta2d")+".png"),f.setAttribute("href",n.toPng(r,void 0,!0,a));var h=document.createEvent("MouseEvents");h.initEvent("click",!0,!0),f.dispatchEvent(h)},1e3)},e.prototype.downloadSvg=function(){var t,r;if(!window.C2S)throw console.error("请先加载乐吾乐官网下的canvas2svg.js","https://assets.le5lecdn.com/2d/canvas2svg.js"),new Error("请先加载乐吾乐官网下的canvas2svg.js");var a=this.getRect();a.x-=10,a.y-=10;var i=new window.C2S(a.width+20,a.height+20);i.textBaseline="middle";try{for(var o=Qe(this.store.data.pens),n=o.next();!n.done;n=o.next()){var s=n.value;s.visible==!1||!Es(s,this.store)||As(i,s,a,!0)}}catch(v){t={error:v}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}var u=i.getSerializedSvg();this.store.data.background?(u=u.replace("{{bk}}",""),u=u.replace("{{bkRect}}",'<rect x="0" y="0" width="100%" height="100%" fill="'+this.store.data.background+'"></rect>')):(u=u.replace("{{bk}}",""),u=u.replace("{{bkRect}}","")),u=u.replace(/--le5le--/g,"&#x");var c=window.URL,l=new Blob([u]),f=c.createObjectURL(l),h=document.createElement("a");h.setAttribute("download",(this.store.data.name||"le5le.meta2d")+".svg"),h.setAttribute("href",f);var d=document.createEvent("MouseEvents");d.initEvent("click",!0,!0),h.dispatchEvent(d)},e.prototype.getRect=function(t){return t===void 0&&(t=this.store.data.pens),kr(t)},e.prototype.hiddenTemplate=function(){this.canvas.canvasTemplate.hidden()},e.prototype.showTemplate=function(){this.canvas.canvasTemplate.show()},e.prototype.lockTemplate=function(t){this.store.data.pens.forEach(function(r){r.canvasLayer===_e.CanvasTemplate&&(r.locked=t)})},e.prototype.fitView=function(t,r){var a,i;if(t===void 0&&(t=!0),r===void 0&&(r=10),!!this.hasView()){var o=this.canvas.canvas,n=o.offsetWidth,s=o.offsetHeight;this.resize(n,s);var u=Or(r),c=this.getRect(),l=(n-u[1]-u[3])/c.width,f=(s-u[0]-u[2])/c.height,h=l;t?h=l>f?f:l:h=l>f?l:f,!((a=this.store.data.fits)===null||a===void 0)&&a.length&&(this.canvas.opening=!0),this.scale(h*this.store.data.scale),this.centerView(),!((i=this.store.data.fits)===null||i===void 0)&&i.length&&this.fillView()}},e.prototype.fillView=function(){var t=this,r,a,i=this.getRect(),o=this.canvas.width-i.width,n=this.canvas.height-i.height;if(Math.abs(o)>10){(r=this.store.data.fits)===null||r===void 0||r.forEach(function(u){var c=[];u.children.forEach(function(v){t.store.pens[v].locked=ke.None,c.push(t.store.pens[v])});var l=o/2;if(u.left&&u.right){var f=u.leftValue,h=u.rightValue;f?f=Math.abs(f)<1?f*t.canvas.width:f:f=0,h?h=Math.abs(h)<1?h*t.canvas.width:h:h=0;var d=(t.canvas.width-f-h)/(i.width-f-h);c.forEach(function(v){var y;v.image&&v.imageRatio&&v.calculative.worldRect.width/t.canvas.width>.1&&(v.imageRatio=!1),v.calculative.worldRect.x=i.x-o/2+f+(v.calculative.worldRect.x-i.x)*d,v.calculative.worldRect.width*=d,v.calculative.worldRect.ex=v.calculative.worldRect.x+v.calculative.worldRect.width,v.calculative.width=v.calculative.worldRect.width,v.calculative.x=v.calculative.worldRect.x,v.width=v.calculative.worldRect.width,v.x=v.calculative.worldRect.x,t.canvas.updatePenRect(v,{worldRectIsReady:!1}),v.externElement&&((y=v.onResize)===null||y===void 0||y.call(v,v))})}else u.left?(l=-l,u.leftValue&&(l+=Math.abs(u.leftValue)<1?u.leftValue*t.canvas.width:u.leftValue),t.translatePens(c,l,0)):u.right&&(u.rightValue&&(l=l-(Math.abs(u.rightValue)<1?u.rightValue*t.canvas.width:u.rightValue)),t.translatePens(c,l,0))});var s=this.store.data.pens.filter(function(u){return u.name==="iframe"});s==null||s.forEach(function(u){var c,l,f=u.calculative.worldRect;if(f.width/t.store.data.scale>i.width*.8){var h=f.width;u.calculative.worldRect.x=f.x-o/2,u.calculative.worldRect.width=f.width+o,u.calculative.worldRect.ex=f.ex+o,u.operationalRect.x=u.operationalRect.x*h/u.calculative.worldRect.width,u.operationalRect.width=(u.calculative.worldRect.width-(1-u.operationalRect.width)*h)/u.calculative.worldRect.width,(c=u.onBeforeValue)===null||c===void 0||c.call(u,u,{operationalRect:u.operationalRect}),(l=u.onResize)===null||l===void 0||l.call(u,u)}})}if(Math.abs(n)>10){(a=this.store.data.fits)===null||a===void 0||a.forEach(function(c){var l=[];c.children.forEach(function(y){t.store.pens[y].locked=ke.None,l.push(t.store.pens[y])});var f=n/2;if(c.top&&c.bottom){var h=c.topValue,d=c.bottomValue;h?h=Math.abs(h)<1?h*t.canvas.height:h:h=0,d?d=Math.abs(d)<1?d*t.canvas.height:d:d=0;var v=(t.canvas.height-h-d)/(i.height-h-d);l.forEach(function(y){var g;y.image&&y.imageRatio&&y.calculative.worldRect.height/t.canvas.height>.1&&(y.imageRatio=!1),y.calculative.worldRect.y=i.y-n/2+h+(y.calculative.worldRect.y-i.y)*v,y.calculative.worldRect.height*=v,y.calculative.worldRect.ey=y.calculative.worldRect.y+y.calculative.worldRect.height,y.calculative.height=y.calculative.worldRect.height,y.calculative.y=y.calculative.worldRect.y,y.height=y.calculative.worldRect.height,y.y=y.calculative.worldRect.y,t.canvas.updatePenRect(y,{worldRectIsReady:!1}),y.externElement&&((g=y.onResize)===null||g===void 0||g.call(y,y))})}else c.top?(f=-f,c.topValue&&(f+=Math.abs(c.topValue)<1?c.topValue*t.canvas.height:c.topValue),t.translatePens(l,0,f)):c.bottom&&(c.bottomValue&&(f=f-(Math.abs(c.bottomValue)<1?c.bottomValue*t.canvas.height:c.bottomValue)),t.translatePens(l,0,f))});var s=this.store.data.pens.filter(function(c){return c.name==="iframe"});s==null||s.forEach(function(c){var l,f,h=c.calculative.worldRect;if(h.height/t.store.data.scale>i.height*.8){var d=h.height;c.calculative.worldRect.y=h.y-n/2,c.calculative.worldRect.height=h.height+n,c.calculative.worldRect.ey=h.ey+n,c.operationalRect.y=c.operationalRect.y*d/c.calculative.worldRect.width,c.operationalRect.height=(c.calculative.worldRect.height-(1-c.operationalRect.height)*d)/c.calculative.worldRect.height,(l=c.onBeforeValue)===null||l===void 0||l.call(c,c,{operationalRect:c.operationalRect}),(f=c.onResize)===null||f===void 0||f.call(c,c)}})}this.canvas.canvasTemplate.init(),this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render(!0)},e.prototype.trimPens=function(){var t=this.store.data.pens.filter(function(r){return r.name==="line"&&r.anchors.length<2});this.delete(t)},e.prototype.fitTemplateView=function(t,r){var a=this;if(t===void 0&&(t=!0),r===void 0&&(r=10),!!this.hasView()){var i=this.canvas.canvas,o=i.offsetWidth,n=i.offsetHeight,s=Or(r),u=this.getRect(),c=(o-s[1]-s[3])/u.width,l=(n-s[0]-s[2])/u.height,f=c;t?f=c>l?l:c:f=c>l?c:l,this.canvas.templateScale(f*this.store.data.scale);var h=this.getRect(),d=this.store.data.pens.filter(function(v){return!v.parentId});this.canvas.templateTranslatePens(d,-h.x,-h.y),this.store.data.pens.forEach(function(v){v.type?a.canvas.initLineRect(v):a.canvas.updateLines(v)}),this.centerView()}},e.prototype.fitSizeView=function(t,r){var a,i;t===void 0&&(t=!0),r===void 0&&(r=10);var o=this.canvas.canvas,n=o.offsetWidth,s=o.offsetHeight;this.resize(n,s);var u=Or(r),c=(this.store.data.width||this.store.options.width)*this.store.data.scale,l=(this.store.data.height||this.store.options.height)*this.store.data.scale,f=(n-u[1]-u[3])/c,h=(s-u[0]-u[2])/l,d=f;t==="width"?d=f:t==="height"?d=h:t?d=f>h?h:f:d=f>h?f:h,!((a=this.store.data.fits)===null||a===void 0)&&a.length&&(this.canvas.opening=!0),this.scale(d*this.store.data.scale),this.centerSizeView(),!((i=this.store.data.fits)===null||i===void 0)&&i.length&&this.fillView()},e.prototype.centerSizeView=function(){var t=this.getViewCenter(),r=this.store.data.width||this.store.options.width,a=this.store.data.height||this.store.options.height,i={x:0,y:0,width:r,height:a};Ue(i);var o=i.center,n=this.store.data,s=n.scale,u=n.origin,c=n.x,l=n.y;this.translate((t.x-u.x)/s-o.x-c/s,(t.y-u.y)/s-o.y-l/s);var f=this.canvas.canvas,h=(f.scrollWidth-f.offsetWidth)/2,d=(f.scrollHeight-f.offsetHeight)/2;f.scrollTo(h,d)},e.prototype.scrollView=function(t,r){if(t===void 0&&(t=10),r===void 0&&(r=!1),!!this.hasView()&&this.canvas.scroll){var a=this.canvas.canvas,i=a.offsetWidth,o=a.offsetHeight;this.resize(i,o);var n=Or(t),s=this.getRect(),u=(i-n[1]-n[3])/s.width;this.scale(u*this.store.data.scale),this.topView(n[0]),r&&this.canvas.scroll.changeMode()}},e.prototype.screenView=function(t,r){if(t===void 0&&(t=10),r===void 0&&(r=!0),!!this.hasView()){var a=this.canvas.canvas,i=a.offsetWidth,o=a.offsetHeight;this.resize(i,o);var n=Or(t),s=this.getRect(),u=(i-n[1]-n[3])/s.width;r||(u=(o-n[0]-n[2])/s.height),this.scale(u*this.store.data.scale),this.topView(n[0])}},e.prototype.topView=function(t){if(t===void 0&&(t=10),!!this.hasView()){var r=this.getRect(),a=this.getViewCenter(),i=this.getPenRect(r);Ue(i);var o=i.center,n=this.store.data,s=n.scale,u=n.origin,c=n.x,l=n.y;this.translate((a.x-u.x)/s-o.x-c/s,(t-u.y)/s-i.y-l/s);var f=this.canvas.canvas,h=(f.scrollWidth-f.offsetWidth)/2,d=(f.scrollHeight-f.offsetHeight)/2;f.scrollTo(h,d)}},e.prototype.centerView=function(){if(this.hasView()){var t=this.getRect(),r=this.getViewCenter(),a=this.getPenRect(t);Ue(a);var i=a.center,o=this.store.data,n=o.scale,s=o.origin,u=o.x,c=o.y;this.translate((r.x-s.x)/n-i.x-u/n,(r.y-s.y)/n-i.y-c/n);var l=this.canvas.canvas,f=(l.scrollWidth-l.offsetWidth)/2,h=(l.scrollHeight-l.offsetHeight)/2;l.scrollTo(f,h)}},e.prototype.hasView=function(){return!!this.store.data.pens.filter(function(t){return!t.isRuleLine}).length},e.prototype.getViewCenter=function(){var t=this.canvas,r=t.width,a=t.height;return{x:r/2,y:a/2}},e.prototype.beSameByFirst=function(t,r){t===void 0&&(t=this.store.data.pens);for(var a=re(t),i=t[0],o=this.getPenRect(i),n=o.width,s=o.height,u=1;u<t.length;u++){var c=t[u];r==="width"?this.setValue({id:c.id,width:n},{render:!1,doEvent:!1}):r==="height"?this.setValue({id:c.id,height:s},{render:!1,doEvent:!1}):this.setValue({id:c.id,width:n,height:s},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:ce.Update,initPens:a,pens:t})},e.prototype.beSameByLast=function(t,r){t===void 0&&(t=this.store.data.pens);for(var a=re(t),i=t[t.length-1],o=this.getPenRect(i),n=o.width,s=o.height,u=0;u<t.length-1;u++){var c=t[u];r==="width"?this.setValue({id:c.id,width:n},{render:!1,doEvent:!1}):r==="height"?this.setValue({id:c.id,height:s},{render:!1,doEvent:!1}):this.setValue({id:c.id,width:n,height:s},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:ce.Update,initPens:a,pens:t})},e.prototype.formatPainterByFirst=function(t){t===void 0&&(t=this.store.data.pens);var r=re(t),a=t[0],i={};fo.forEach(function(s){i[s]=a[s]});for(var o=1;o<t.length;o++){var n=t[o];this.setValue(mt({id:n.id},i),{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:ce.Update,initPens:r,pens:t})},e.prototype.formatPainterByLast=function(t){t===void 0&&(t=this.store.data.pens);var r=re(t),a=t[t.length-1],i={};fo.forEach(function(s){i[s]=a[s]});for(var o=0;o<t.length-1;o++){var n=t[o];this.setValue(mt({id:n.id},i),{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:ce.Update,initPens:r,pens:t})},e.prototype.setFormatPainter=function(){var t=this,r=this.store.active,a={};if(r.length>0){var i=r[0];fo.forEach(function(n){a[n]=i[n]!==void 0?i[n]:t.store.options.defaultFormat[n]||t.store.options[n]})}else{var o={};fo.forEach(function(n){o[n]=t.store.options.defaultFormat[n]||t.store.options[n]||void 0})}localStorage.setItem("meta2d-formatPainter",JSON.stringify(a))},e.prototype.formatPainter=function(){for(var t=this.store.active,r=re(t),a=JSON.parse(localStorage.getItem("meta2d-formatPainter")),i=0;i<t.length;i++){var o=t[i];this.setValue(mt({id:o.id},a),{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:ce.Update,initPens:r,pens:t})},e.prototype.clearFormatPainter=function(){var t=this,r=this.store.active,a=re(r);fo.forEach(function(i){for(var o=0;o<r.length;o++){var n=r[o],s=t.store.options,u=s.fontSize,c=s.lineHeight;i==="lineWidth"?(n.lineWidth=1,n.calculative.lineWidth=1):i==="fontSize"?(n.fontSize=u,n.calculative.fontSize=u):i==="lineHeight"?(n.lineHeight=c,n.calculative.lineHeight=c):(delete n[i],delete n.calculative[i])}}),this.render(),this.pushHistory({type:ce.Update,initPens:a,pens:r})},e.prototype.alignNodes=function(t,r,a){var i,o;r===void 0&&(r=this.store.data.pens),!a&&(a=this.getPenRect(this.getRect(r)));var n=re(r);try{for(var s=Qe(r),u=s.next();!u.done;u=s.next()){var c=u.value;this.alignPen(t,c,a)}}catch(l){i={error:l}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}this.initImageCanvas(r),this.initTemplateCanvas(r),this.render(),this.pushHistory({type:ce.Update,initPens:n,pens:r})},e.prototype.alignNodesV=function(t,r){var a,i;r===void 0&&(r=this.store.data.pens);var o=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height,s={x:0,y:0,width:o,height:n},u=re(r);try{for(var c=Qe(r),l=c.next();!l.done;l=c.next()){var f=l.value;this.alignPen(t,f,s)}}catch(h){a={error:h}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(a)throw a.error}}this.initImageCanvas(r),this.initTemplateCanvas(r),this.render(),this.pushHistory({type:ce.Update,initPens:u,pens:r})},e.prototype.alignNodesByFirst=function(t,r){r===void 0&&(r=this.store.data.pens);for(var a=re(r),i=r[0],o=this.getPenRect(i),n=1;n<r.length;n++){var s=r[n];this.alignPen(t,s,o)}this.initImageCanvas(r),this.initTemplateCanvas(r),this.render(),this.pushHistory({type:ce.Update,initPens:a,pens:r})},e.prototype.alignNodesByLast=function(t,r){r===void 0&&(r=this.store.data.pens);for(var a=re(r),i=r[r.length-1],o=this.getPenRect(i),n=0;n<r.length-1;n++){var s=r[n];this.alignPen(t,s,o)}this.initImageCanvas(r),this.initTemplateCanvas(r),this.render(),this.pushHistory({type:ce.Update,initPens:a,pens:r})},e.prototype.alignPen=function(t,r,a){var i=this.getPenRect(r);switch(t){case"left":i.x=a.x;break;case"right":i.x=a.x+a.width-i.width;break;case"top":i.y=a.y;break;case"bottom":i.y=a.y+a.height-i.height;break;case"center":i.x=a.x+a.width/2-i.width/2;break;case"middle":i.y=a.y+a.height/2-i.height/2;break}this.setValue(mt({id:r.id},i),{render:!1,doEvent:!1})},e.prototype.spaceBetweenByDirection=function(t,r,a){var i,o,n=this;if(r===void 0&&(r=this.store.data.pens),!a&&(a=this.getPenRect(this.getRect(r))[t]),r=r.filter(function(g){return!g.parentId}),!(r.length<=2)){var s=re(r),u=r.reduce(function(g,m){var w=n.getPenRect(m);return g+w[t]},0),c=(a-u)/(r.length-1);r=r.sort(function(g,m){return t==="width"?g.x-m.x:g.y-m.y});var l=this.getPenRect(r[0]),f=t==="width"?l.x:l.y;try{for(var h=Qe(r),d=h.next();!d.done;d=h.next()){var v=d.value,y=this.getPenRect(v);t==="width"?y.x=f:y.y=f,f+=y[t]+c,this.setValue(mt({id:v.id},y),{render:!1,doEvent:!1})}}catch(g){i={error:g}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}this.initImageCanvas(r),this.initTemplateCanvas(r),this.render(),this.pushHistory({type:ce.Update,initPens:s,pens:r})}},e.prototype.spaceBetween=function(t,r){this.spaceBetweenByDirection("width",t,r)},e.prototype.spaceBetweenColumn=function(t,r){this.spaceBetweenByDirection("height",t,r)},e.prototype.layout=function(t,r,a){var i=this;t===void 0&&(t=this.store.data.pens),a===void 0&&(a=30);var o=this.getPenRect(kr(t));!r&&(r=o.width),t=t.filter(function(l){return!l.type&&!l.parentId});var n=re(t),s=0;t.forEach(function(l){var f=i.getPenRect(l);f.height>s&&(s=f.height)});var u=o.x,c=o.y;t.forEach(function(l,f){var h=i.getPenRect(l);if(h.x=u,h.y=c+s/2-h.height/2,i.setValue(mt({id:l.id},h),{render:!1,doEvent:!1}),f!==t.length-1){var d=u+h.width-o.x,v=i.getPenRect(t[f+1]);Math.round(r-d)>=Math.round(v.width+a)?u+=h.width+a:(u=o.x,c+=s+a)}}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.render(),this.pushHistory({type:ce.Update,initPens:n,pens:t})},e.prototype.gotoView=function(t){var r,a,i=this.getViewCenter(),o=i.x-t.calculative.worldRect.x-t.calculative.worldRect.width/2,n=i.y-t.calculative.worldRect.y-t.calculative.worldRect.height/2;this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.translate(o-this.store.data.x,n-this.store.data.y),this.store.data.x=o,this.store.data.y=n;try{for(var s=Qe(this.store.data.pens),u=s.next();!u.done;u=s.next()){var c=u.value;Dr(c)}}catch(l){r={error:l}}finally{try{u&&!u.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render()},e.prototype.showMap=function(){this.map||(this.map=new Kj(this.canvas)),this.map.show()},e.prototype.hideMap=function(){this.map.hide()},e.prototype.onSizeUpdate=function(){var t=this;this.mapTimer&&(clearTimeout(this.mapTimer),this.mapTimer=void 0),this.mapTimer=setTimeout(function(){t.map&&t.map.isShow&&t.map.show(),t.canvas.scroll&&t.canvas.scroll.isShow&&t.canvas.scroll.resize()},500)},e.prototype.toggleAnchorMode=function(){this.canvas.toggleAnchorMode()},e.prototype.addAnchorHand=function(){this.canvas.addAnchorHand()},e.prototype.removeAnchorHand=function(){this.canvas.removeAnchorHand()},e.prototype.toggleAnchorHand=function(){this.canvas.toggleAnchorHand()},e.prototype.top=function(t){var r,a,i=this;t||(t=this.store.active),Array.isArray(t)||(t=[t]);var o=function(l){var f=n.store.data.pens,h=at(at([],St(br(l,n.store)),!1),[l],!1).map(function(v){return v.id}),d=f.filter(function(v){return h.includes(v.id)});d.forEach(function(v){var y=f.findIndex(function(g){return g.id===v.id});y>-1&&(f.push(f[y]),f.splice(y,1),i.initTemplateCanvas([v]),i.initImageCanvas([v])),i.specificLayerMove(v,"top")})},n=this;try{for(var s=Qe(t),u=s.next();!u.done;u=s.next()){var c=u.value;o(c)}}catch(l){r={error:l}}finally{try{u&&!u.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}this.store.emitter.emit("layer",{type:"top",pens:t})},e.prototype.initImageCanvas=function(t){this.canvas.initImageCanvas(t)},e.prototype.initTemplateCanvas=function(t){this.canvas.initTemplateCanvas(t)},e.prototype.bottom=function(t){var r,a;t||(t=this.store.active),Array.isArray(t)||(t=[t]);var i=function(c){for(var l=o.store.data.pens,f=at(at([],St(br(c,o.store)),!1),[c],!1).map(function(y){return y.id}),h=l.filter(function(y){return f.includes(y.id)}),d=function(y){var g=h[y],m=l.findIndex(function(w){return w.id===g.id});m>-1&&(l.unshift(l[m]),l.splice(m+1,1),o.initTemplateCanvas([g]),o.initImageCanvas([g])),o.specificLayerMove(g,"bottom")},v=h.length-1;v>=0;v--)d(v)},o=this;try{for(var n=Qe(t),s=n.next();!s.done;s=n.next()){var u=s.value;i(u)}}catch(c){r={error:c}}finally{try{s&&!s.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}this.store.emitter.emit("layer",{type:"bottom",pens:t})},e.prototype.upByArea=function(t){var r,a,i,o=this,n=this.store.data.pens.findIndex(function(m){return m.id===t.id});if(n===-1){console.warn("upByArea: pen not in canvas");return}var s=at([t],St(br(t,this.store)),!1),u=s.map(function(m){return o.store.data.pens.findIndex(function(w){return w.id===m.id})});u.includes(-1)&&(console.warn("upByArea: pen children not in canvas"),u=u.filter(function(m){return m!==-1}));var c=Math.min.apply(Math,at([],St(u),!1)),l=t.calculative.worldRect,f=this.store.data.pens.findIndex(function(m,w){if(w<=c||m.id===t.id||w$(m,t))return!1;var p=m.calculative.worldRect;return si(l,p)});if(f===-1){this.up(t);return}(r=this.store.data.pens).splice.apply(r,at([f+1,0],St(s),!1));var h=function(m){var w=d.store.data.pens.findIndex(function(p){return p.id===m.id});w>-1&&d.store.data.pens.splice(w,1)},d=this;try{for(var v=Qe(s),y=v.next();!y.done;y=v.next()){var g=y.value;h(g)}}catch(m){a={error:m}}finally{try{y&&!y.done&&(i=v.return)&&i.call(v)}finally{if(a)throw a.error}}this.initImageCanvas([t])},e.prototype.specificLayerMove=function(t,r){var a;if(t.image&&t.name!=="gif"){var i=_e.CanvasImageBottom;r==="top"?i=_e.CanvasImage:(r==="up"||r==="down")&&(i=_e.CanvasMain),this.setValue({id:t.id,canvasLayer:i},{render:!1,doEvent:!1,history:!1})}else if(t.externElement||t.name==="gif"){var o=0;r==="top"?(t.calculative.canvas.maxZindex+=1,o=t.calculative.canvas.maxZindex):r==="up"?o=t.calculative.zIndex===void 0?6:t.calculative.zIndex+1:r==="down"&&(o=t.calculative.zIndex===void 0?3:t.calculative.zIndex-1,o<0&&(o=0)),this.setValue({id:t.id,zIndex:o},{render:!1,doEvent:!1,history:!1}),!((a=t.calculative.singleton)===null||a===void 0)&&a.div&&Ye(t,t.calculative.singleton.div)}},e.prototype.up=function(t){var r,a,i=this;t||(t=this.store.active),Array.isArray(t)||(t=[t]);var o=function(l){var f=n.store.data.pens;if(l.children&&l.children.length){for(var h=at(at([],St(br(l,n.store)),!1),[l],!1),d=[],v=function(w){var p=f[w];h.findIndex(function(x){return x.id===p.id})!==-1&&(p.temIndex=w,d.push(p))},y=0;y<f.length;y++)v(y);var g=-1,m=0;d.forEach(function(w){w.temIndex-=m,f.splice(w.temIndex,1),m+=1,g=w.temIndex,delete w.temIndex,i.specificLayerMove(w,"up")}),f.splice.apply(f,at([g+1,0],St(d),!1)),n.initTemplateCanvas(d),n.initImageCanvas(d)}else{var y=f.findIndex(function(p){return p.id===l.id});y>-1&&y!==f.length-1&&(f.splice(y+2,0,f[y]),f.splice(y,1),n.initTemplateCanvas([l]),n.initImageCanvas([l])),n.specificLayerMove(l,"up")}},n=this;try{for(var s=Qe(t),u=s.next();!u.done;u=s.next()){var c=u.value;o(c)}}catch(l){r={error:l}}finally{try{u&&!u.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}this.store.emitter.emit("layer",{type:"up",pens:t})},e.prototype.down=function(t){var r,a,i=this;t||(t=this.store.active),Array.isArray(t)||(t=[t]);var o=function(l){var f=n.store.data.pens;if(l.children&&l.children.length){for(var h=at(at([],St(br(l,n.store)),!1),[l],!1),d=[],v=function(w){var p=f[w];h.findIndex(function(x){return x.id===p.id})!==-1&&(p.temIndex=w,d.push(p))},y=0;y<f.length;y++)v(y);var g=-1,m=0;d.forEach(function(w,p){w.temIndex-=m,f.splice(w.temIndex,1),m+=1,p===0&&(g=w.temIndex),delete w.temIndex,i.specificLayerMove(w,"down")}),f.splice.apply(f,at([g-1,0],St(d),!1)),n.initTemplateCanvas(d),n.initImageCanvas(d)}else{var y=f.findIndex(function(p){return p.id===l.id});y>-1&&y!==0&&(f.splice(y-1,0,f[y]),f.splice(y+1,1),n.initTemplateCanvas([l]),n.initImageCanvas([l])),n.specificLayerMove(l,"down")}},n=this;try{for(var s=Qe(t),u=s.next();!u.done;u=s.next()){var c=u.value;o(c)}}catch(l){r={error:l}}finally{try{u&&!u.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}this.store.emitter.emit("layer",{type:"down",pens:t})},e.prototype.setLayer=function(t,r,a){a===void 0&&(a=this.store.data.pens);var i=a.findIndex(function(o){return o.id===t.id});i>-1&&(i>r?(a.splice(r,0,a[i]),a.splice(i+1,1)):i<r&&(a.splice(r,0,a[i]),a.splice(i,1)))},e.prototype.changePenId=function(t,r){this.canvas.changePenId(t,r)},e.prototype.getLines=function(t,r){var a=this,i;if(r===void 0&&(r="all"),t.type===Ae.Line)return[];var o=[];return(i=t.connectedLines)===null||i===void 0||i.forEach(function(n){var s=n.lineId,u=a.store.pens[s];if(!u){console.warn(t,"node contain a error connectedLine");return}if(!o.find(function(c){return c.id===u.id}))switch(r){case"all":o.push(u);break;case"in":Te(u).connectTo===t.id&&o.push(u);break;case"out":Ve(u).connectTo===t.id&&o.push(u);break}}),o},e.prototype.nextNode=function(t){var r=this;if(t.type===Ae.Line){var a=this.store.pens[Te(t).connectTo];return a?[a]:[]}else{var i=this.getLines(t,"out"),o=[];return i.forEach(function(n){var s,u,c=r.nextNode(n),l=function(v){var y=o.find(function(g){return g.id===v.id});!y&&o.push(v)};try{for(var f=Qe(c),h=f.next();!h.done;h=f.next()){var d=h.value;l(d)}}catch(v){s={error:v}}finally{try{h&&!h.done&&(u=f.return)&&u.call(f)}finally{if(s)throw s.error}}}),o}},e.prototype.previousNode=function(t){var r=this;if(t.type===Ae.Line){var a=this.store.pens[Ve(t).connectTo];return a?[a]:[]}else{var i=this.getLines(t,"in"),o=[];return i.forEach(function(n){var s,u,c=r.previousNode(n),l=function(v){var y=o.find(function(g){return g.id===v.id});!y&&o.push(v)};try{for(var f=Qe(c),h=f.next();!h.done;h=f.next()){var d=h.value;l(d)}}catch(v){s={error:v}}finally{try{h&&!h.done&&(u=f.return)&&u.call(f)}finally{if(s)throw s.error}}}),o}},e.prototype.getNext=function(t){var r=this,a;if(t.type===Ae.Line){console.warn("非连线节点");return}var i=[];return(a=t.connectedLines)===null||a===void 0||a.forEach(function(o){var n,s,u=o.lineId,c=o.anchor,l=(n=t.anchors)===null||n===void 0?void 0:n.filter(function(g){return g.id===c})[0],f=r.findOne(u);if(f.anchors[0].connectTo==t.id){var h=f.anchors[f.anchors.length-1].connectTo;if(h){var d=r.findOne(h),v=(s=d.connectedLines)===null||s===void 0?void 0:s.filter(function(g){return g.lineId===f.id})[0],y=d.anchors.filter(function(g){return g.id===v.anchor})[0];i.push({from:t,fromAnchor:l,line:f,to:d,toAnchor:y})}}}),i},e.prototype.addAnchor=function(t,r,a){if(t){if(t.anchors||(t.anchors=[]),t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.type===Ae.Line&&(a<0&&(a=t.anchors.length+1+a),a>t.anchors.length&&(a=t.anchors.length),a<0&&(a=0),a==0&&t.anchors[0].connectTo||a==t.anchors.length&&t.anchors[a-1].connectTo)){console.warn("端点存在连接关系");return}var i=null,o=null;r.x<=1&&r.x>=0&&r.y<=1&&r.y>=0?(o={id:r.id||xe(),penId:t.id,x:t.calculative.worldRect.x+t.calculative.worldRect.width*r.x,y:t.calculative.worldRect.y+t.calculative.worldRect.height*r.y},t.calculative.worldRect&&t.rotate%360&&De(o,t.rotate,t.calculative.worldRect.center),i={id:o.id,penId:t.id,x:r.x,y:r.y}):(o={id:r.id||xe(),penId:t.id,x:r.x,y:r.y},t.calculative.worldRect&&(t.rotate%360&&De(r,-t.rotate,t.calculative.worldRect.center),i={id:o.id,penId:t.id,x:(r.x-t.calculative.worldRect.x)/t.calculative.worldRect.width,y:(r.y-t.calculative.worldRect.y)/t.calculative.worldRect.height})),t.type===Ae.Line?(t.calculative.worldAnchors.splice(a,0,o),t.anchors.splice(a,0,i),this.canvas.updateLines(t),this.canvas.initLineRect(t),this.render()):(t.calculative.worldAnchors.push(o),t.anchors.push(i))}},e.prototype.connectLine=function(t,r,a,i,o){if(o===void 0&&(o=!0),!a){var n=r.calculative.worldRect;a=xa(t,{x:n.x+n.width/2,y:n.y+n.height/2})}if(!i){var n=t.calculative.worldRect;i=xa(r,{x:n.x+n.width/2,y:n.y+n.height/2})}var s=Math.abs(a.x-i.x),u=Math.abs(a.y-i.y),c={height:u,lineName:"line",lineWidth:1,name:"line",type:1,width:s,x:Math.min(a.x,i.x),y:Math.min(a.y,i.y),anchors:[{x:a.x>i.x?1:0,y:a.y>i.y?1:0,id:xe()},{x:a.x>i.x?0:1,y:a.x>i.x?0:1,id:xe()}]};return this.addPens([c]),ot(t,a,c,c.calculative.worldAnchors[0]),ot(r,i,c,c.calculative.worldAnchors[1]),c.calculative.active=!1,this.canvas.updateLines(c),this.canvas.updateLines(t),this.canvas.updateLines(r),this.canvas.initLineRect(c),o&&this.render(),c},e.prototype.toComponent=function(t,r,a){if(t===void 0&&(t=this.store.data.pens),t.length===1){var i=re(t[0]);return i.type=Ae.Node,i.id=void 0,[i]}var o=re(t,!0),n=kr(o),s=mt(mt({id:xe(),name:"combine"},n),{children:[],showChild:r});a&&(s.anchors=[{id:"0",penId:s.id,x:.5,y:0},{id:"1",penId:s.id,x:1,y:.5},{id:"2",penId:s.id,x:.5,y:1},{id:"3",penId:s.id,x:0,y:.5}]);var u=o.filter(function(f){return!f.parentId}),c=o.find(function(f){return f.width===n.width&&f.height===n.height}),l=c&&r===void 0;return u.length===1?s=u[0]:l&&(c.children||(c.children=[]),s=c),o.forEach(function(f){var h;if(!(f===s||f.parentId===s.id)&&!f.parentId){s.children.push(f.id),f.parentId=s.id;var d=ss(f.calculative.worldRect,n);Object.assign(f,d),f.locked=(h=f.lockedOnCombine)!==null&&h!==void 0?h:ke.DisableMove}}),l||u.length===1?re(o):re(at([s],St(o),!1))},e.prototype.installPenPlugins=function(t,r){var a=this;if(!(!t.tag&&!t.name&&!t.id)){var i;t.id?i="id":t.tag?i="tag":t.name&&(i="name"),r.forEach(function(o){var n,s,u=o.plugin,c=o.options;if(u&&a7(u)&&i)if(u.install(t,c),!a.penPluginMap.has(u))a.penPluginMap.set(u,[(n={},n[i]=t[i],n.option=c,n)]);else{var l=a.penPluginMap.get(u).find(function(f){return f[i]===t[i]});l?l.option=c:a.penPluginMap.get(u).push((s={},s[i]=t[i],s.option=c,s))}})}},e.prototype.uninstallPenPlugins=function(t,r){var a=this,i;t.id?i="id":t.tag?i="tag":t.name&&(i="name"),i&&r.forEach(function(o){var n=o.plugin;n.uninstall(t,o.options);var s=a.penPluginMap.get(n),u=s.findIndex(function(c){return c[i]===t[i]});u!==-1&&(s.splice(u,1),s.length===0&&a.penPluginMap.delete(n))})},e.prototype.setVisible=function(t,r,a){var i,o;if(a===void 0&&(a=!0),this.onSizeUpdate(),this.setValue({id:t.id,visible:r},{render:!1,doEvent:!1}),t.children)try{for(var n=Qe(t.children),s=n.next();!s.done;s=n.next()){var u=s.value,c=this.store.pens[u];c&&this.setVisible(c,r,!1)}}catch(f){i={error:f}}finally{try{s&&!s.done&&(o=n.return)&&o.call(n)}finally{if(i)throw i.error}}var l=br(t,this.store);l.push(t),this.initImageCanvas(l),a&&this.render()},e.prototype.clearHover=function(){this.canvas.clearHover()},e.prototype.closeSocket=function(){this.closeWebsocket(),this.closeMqtt(),this.closeHttp()},e.prototype.destroy=function(t){if(this.clear(!1),this.closeSocket(),this.closeNetwork(),this.store.emitter.all.clear(),this.canvas.destroy(),this.canvas=void 0,he[this.store.id]=void 0,!t){for(var r in he)delete he[r];he.path2dDraws={},he.canvasDraws={},he.anchors={},he.htmlElements={}}},e}();function Yj(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.ey,u=n/4;if(r.moveTo(i+u,o),r.lineTo(i,o),r.lineTo(i,s),r.lineTo(i+u,s),r instanceof Path2D)return r}function Gj(e){var t=[{x:.25,y:0},{x:.25,y:1},{x:0,y:.5}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:a+"",x:i,y:o,penId:e.id}})}function Xj(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.ex,u=a.ey,c=e.offsetX,l=n/7;if(c>1?l=c:c>0&&(l=n*c),r.moveTo(i+l,o),r.lineTo(s,o),r.lineTo(i+n-l,u),r.lineTo(i,u),r.closePath(),r instanceof Path2D)return r}function Qj(e){var t=[{x:.5,y:0},{x:.9285714285714286,y:.5},{x:.5,y:1},{x:.07142857142857142,y:.5}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function Jj(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.ex,c=a.ey,l=n/8;if(r.moveTo(i+l,o),r.lineTo(u-l,o),r.bezierCurveTo(u+l/3,o,u+l/3,c,u-l,c),r.lineTo(i+l,c),r.lineTo(i,o+s/2),r.closePath(),r instanceof Path2D)return r}function Zj(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.ex,c=a.center,l=c.x,f=o+s*6/7,h=s/6;if(r.moveTo(i,o),r.lineTo(u,o),r.lineTo(u,f),r.bezierCurveTo(u-20,f-h,l+n/5,f-h,l,f),r.bezierCurveTo(l-n/5,f+h,i,f+h,i,f),r.closePath(),r instanceof Path2D)return r}function ez(e){var t=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:.8571428571428571},{x:0,y:.5}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function tz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.ex,u=a.ey,c=n/10;if(r.moveTo(i+c*2,o),r.bezierCurveTo(i-c*2/3,o,i-c*2/3,u,i+c*2,u),r.lineTo(s,u),r.bezierCurveTo(s-c,u,s-c,o,s,o),r.closePath(),r instanceof Path2D)return r}function rz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.ex,u=a.ey;r.moveTo(i,o),r.lineTo(s,o),r.lineTo(s,u),r.lineTo(i,u),r.closePath();var c=n/7;if(r.moveTo(i,o+c),r.lineTo(s,o+c),r.moveTo(i+c,o),r.lineTo(i+c,u),r instanceof Path2D)return r}function iz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.height,s=a.ex,u=a.ey,c=n/4;if(r.moveTo(i,o+c),r.lineTo(s,o),r.lineTo(s,u),r.lineTo(i,u),r.closePath(),r instanceof Path2D)return r}function az(e){var t=[{x:.5,y:.125},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function oz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.ex,s=a.ey;if(r.moveTo(i,o),r.lineTo(n,o),r.moveTo(i,s),r.lineTo(n,s),r instanceof Path2D)return r}function nz(e){var t=[{x:.5,y:0},{x:.5,y:1}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:a+"",x:i,y:o,penId:e.id}})}function sz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.ex,c=a.ey;if(r.ellipse(i+n/2,o+s/2,n/2,s/2,0,0,Math.PI*2),r.moveTo(i+n/2,c),r.lineTo(u,c),r.closePath(),r instanceof Path2D)return r}function lz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.ex,u=a.ey,c=n/7;if(r.moveTo(i,o),r.lineTo(s,o),r.lineTo(s,u),r.lineTo(i,u),r.closePath(),r.moveTo(i+c,o),r.lineTo(i+c,u),r.moveTo(s-c,o),r.lineTo(s-c,u),r instanceof Path2D)return r}function cz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.height,s=a.ex,u=a.ey,c=n/7;if(r.moveTo(i,o+c),r.bezierCurveTo(i,o-c/2|0,s,o-c/2|0,s,o+c),r.lineTo(s,u-c),r.bezierCurveTo(s,u+c/2|0,i,u+c/2|0,i,u-c),r.closePath(),r.moveTo(i,u-c),r.bezierCurveTo(i,u-c*2|0,s,u-c*2|0,s,u-c),r instanceof Path2D)return r}function uz(){return{flowComment:Yj,flowData:Xj,flowDb:cz,flowDisplay:Jj,flowDocument:Zj,flowExternStorage:tz,flowInternalStorage:rz,flowManually:iz,flowParallel:oz,flowQueue:sz,flowSubprocess:lz}}function fz(){return{flowDocument:ez,flowManually:az,flowParallel:nz,flowComment:Gj,flowData:Qj}}function hz(e,t){var r=t.calculative.worldRect,a=r.x,i=r.y,o=r.width,n=r.height;e.beginPath(),e.ellipse(a+o/2,i+n/2,o/2,n/2,0,0,Math.PI*2),e.stroke(),e.beginPath(),e.fillStyle=e.strokeStyle,e.ellipse(a+o/2,i+n/2,o/4,n/4,0,0,Math.PI*2),e.fill()}function dz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.ey,c=e.calculative.lineLeft||.08,l=e.calculative.borderRadius||0,f=l;l<1&&(l=n*l,f=s*l);var h=l<f?l:f;if(n<2*h&&(h=n/2),s<2*h&&(h=s/2),r.moveTo(i+h,o),r.arcTo(i+n,o,i+n,o+s,h),r.arcTo(i+n,o+s,i,o+s,h),r.arcTo(i,o+s,i,o,h),r.arcTo(i,o,i+n,o,h),r.closePath(),r.moveTo(i+c*n,o),r.lineTo(i+c*n,u),r instanceof Path2D)return r}function vz(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.ex,c=e.calculative.lineTop||.08,l=e.calculative.borderRadius||0,f=l;l<1&&(l=n*l,f=s*f);var h=l<f?l:f;if(n<2*h&&(h=n/2),s<2*h&&(h=s/2),r.moveTo(i+h,o),r.arcTo(i+n,o,i+n,o+s,h),r.arcTo(i+n,o+s,i,o+s,h),r.arcTo(i,o+s,i,o,h),r.arcTo(i,o,i+n,o,h),r.closePath(),r.moveTo(i,o+c*s),r.lineTo(u,o+c*s),r instanceof Path2D)return r}function gz(){return{forkV:Ha,forkH:Ha,swimlaneH:dz,swimlaneV:vz}}function yz(){return{activityFinal:hz}}function pz(e,t){e.onDestroy||(e.onDestroy=bz,e.onAdd=mz);var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.ex,c=e.calculative.borderRadius||0,l=c;c<1&&(c*=n,l*=s);var f=c<l?c:l;n<2*f&&(f=n/2),s<2*f&&(f=s/2),r.moveTo(i+f,o),r.arcTo(i+n,o,i+n,o+s,f),r.arcTo(i+n,o+s,i,o+s,f),r.arcTo(i,o+s,i,o,f),r.arcTo(i,o,i+n,o,f);var h=.2*s;r.moveTo(i,o+h),r.lineTo(u,o+h);var d=o+h+(s-h)/2;if(r.moveTo(i,d),r.lineTo(u,d),r.closePath(),r instanceof Path2D)return r}function mz(e){var t=e.calculative.worldRect,r=t.x,a=t.y,i=t.width,o=t.height,n=e.list,s={name:"text",x:r,y:a+.2*o,width:i,height:.4*o,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10},u={name:"text",x:r,y:a+.6*o,width:i,height:.4*o,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10};Object.assign(s,n[0]),Object.assign(u,n[1]),e.calculative.canvas.makePen(s),e.calculative.canvas.makePen(u),e.calculative.canvas.parent.pushChildren(e,[s]),e.calculative.canvas.parent.pushChildren(e,[u])}function bz(e){var t=e.calculative.canvas.store;e.children.forEach(function(r){var a=t.data.pens.findIndex(function(i){return i.id===r});a>-1&&(t.data.pens.splice(a,1),t.pens[r]=void 0)}),e.children=void 0}function wz(e,t){e.onDestroy||(e.onDestroy=Cz,e.onAdd=xz);var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=a.ex,c=e.calculative.borderRadius||0,l=c;c<1&&(c=n*c,l=s*l);var f=c<l?c:l;n<2*f&&(f=n/2),s<2*f&&(f=s/2),r.moveTo(i+f,o),r.arcTo(i+n,o,i+n,o+s,f),r.lineTo(i+n,o+s-f),r.arcTo(i+n,o+s,i,o+s,f),r.arcTo(i,o+s,i,o,f),r.arcTo(i,o,i+n,o,f);var h=.2*s;if(r.moveTo(i,o+h),r.lineTo(u,o+h),r.closePath(),r instanceof Path2D)return r}function xz(e){var t=e.calculative.worldRect,r=t.x,a=t.y,i=t.width,o=t.height,n=e.list,s={name:"text",x:r,y:a+.2*o,width:i,height:.8*o,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10};Object.assign(s,n[0]),e.calculative.canvas.makePen(s),e.calculative.canvas.parent.pushChildren(e,[s])}function Cz(e){var t=e.calculative.canvas.store;e.children.forEach(function(r){var a=t.data.pens.findIndex(function(i){return i.id===r});a>-1&&(t.data.pens.splice(a,1),t.pens[r]=void 0)}),e.children=[]}function kz(){return{interfaceClass:pz,simpleClass:wz}}function _z(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height;if(r.rect(i,o,n,s),r.closePath(),r instanceof Path2D)return r}function Sz(e,t){var r,a=(r=t.headHeight)!==null&&r!==void 0?r:50,i=t.calculative.worldRect,o=i.x,n=i.y,s=i.width,u=i.height,c=i.ey,l=t.calculative.borderRadius||0,f=l;t.calculative.borderRadius<1&&(l*=s,f*=u);var h=l<f?l:f;s<2*h&&(h=s/2),a<2*h&&(h=a/2),e.beginPath(),e.moveTo(o+h,n),e.arcTo(o+s,n,o+s,n+a,h),e.arcTo(o+s,n+a,o,n+a,h),e.arcTo(o,n+a,o,n,h),e.arcTo(o,n,o+s,n,h),e.closePath(),e.stroke(),e.save(),e.beginPath(),e.lineWidth=1,e.setLineDash([7,7]);var d=o+s/2;e.moveTo(d,n+a+1),e.lineTo(d,c),e.closePath(),e.stroke(),e.restore()}function Tz(){return{sequenceFocus:_z}}function Az(){return{lifeline:Sz}}function Ez(e){var t=["天","一","二","三","四","五","六"],r=new Date,a=r.getFullYear(),i=r.getMonth()+1,o=r.getDate(),n=r.getDay(),s=r.getHours(),u=r.getMinutes(),c=r.getSeconds(),l=new Function("year","month","day","week","hours","minutes","seconds",e?"return "+e:"return `${year}:${month}:${day} ${hours}:${minutes}:${seconds} 星期${week}`"),f=l(a,i,o,t[n],s,u,c);return f}var wc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},xc=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))},Bo;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(Bo||(Bo={}));var zu=["fontSize","nameGap","margin","width","symbolSize","itemWidth","itemHeight","fontWeight","top","left","right","bottom","zoom","edgeSymbolSize","nodeWidth","nodeGap","distance","length","length2","offsetCenter","size","symbolOffset","padding","barWidth","symbolOffset","shadowOffsetY","shadowOffsetX"];function Pz(e){var t,r,a=globalThis.echarts;if(!(!e.echarts||!a)){if(typeof e.echarts=="string")try{e.echarts=JSON.parse(e.echarts)}catch{}zu=((t=e.calculative.canvas.store.options.diagramOptions.chart)===null||t===void 0?void 0:t.keyWords)||zu,e.onDestroy||(e.onDestroy=Rz,e.onMove=Cc,e.onResize=Iz,e.onRotate=Cc,e.onValue=Mz,e.onBeforeValue=Lz,e.onBinds=Oz,e.onMouseEnter=Cc,e.onRenderPenRaw=kc),e.calculative.singleton||(e.calculative.singleton={});var i=new Path2D,o=e.calculative.worldRect;if(!e.calculative.singleton.div){var n=document.createElement("div");n.style.position="absolute",n.style.outline="none",n.style.left="-9999px",n.style.top="-9999px",n.style.width=o.width+"px",n.style.height=o.height+"px",document.body.appendChild(n),(r=e.calculative.canvas.externalElements)===null||r===void 0||r.parentElement.appendChild(n),Ye(e,n),e.calculative.singleton.div=n,e.calculative.singleton.echart=a.init(n,e.echarts.theme),e.calculative.singleton.echartsReady=!0,e.echarts.geoName&&!a.getMap(e.echarts.geoName)&&(e.echarts.geoJson?a.registerMap(e.echarts.geoName,e.echarts.geoJson):e.echarts.geoUrl&&(e.calculative.singleton.echartsReady=!1,fetch(e.echarts.geoUrl).then(function(s){s.text().then(function(u){if(typeof u=="string")try{u=JSON.parse(u)}catch{}if(u.constructor!==Object&&u.constructor!==Array){console.warn("Invalid data:",u);return}a.registerMap(e.echarts.geoName,u),e.calculative.singleton.echartsReady=!0,e.calculative.singleton.echart.setOption(Rs(e.echarts.option,e.calculative.canvas.store.data.scale),!0),e.calculative.singleton.echart.resize(),setTimeout(function(){kc(e)},300)})}))),e.calculative.singleton.echartsReady&&setTimeout(function(){e.calculative.singleton.echart.setOption(Rs(e.echarts.option,e.calculative.canvas.store.data.scale),!0),setTimeout(function(){return kc(e)},300)})}return i}}function Rz(e){if(e.calculative.singleton&&e.calculative.singleton.div){e.calculative.singleton.div.remove();var t=globalThis.echarts;t&&t.dispose(e.calculative.singleton.echart),delete e.calculative.singleton.div,delete e.calculative.singleton.echart}}function Cc(e){e.calculative.singleton.div&&Ye(e,e.calculative.singleton.div)}function Iz(e){if(e.calculative.singleton.echart){var t=globalThis.echarts;Ye(e,e.calculative.singleton.div),!(e.echarts.geoName&&!t.getMap(e.echarts.geoName))&&(e.calculative.singleton.echart.setOption(Rs(e.echarts.option,e.calculative.canvas.store.data.scale),!0),e.calculative.singleton.echart.resize())}}function Mz(e){if(e.calculative.singleton.echart&&(Ye(e,e.calculative.singleton.div),e.calculative.singleton.echartsReady))if(e.calculative.partialOption){var t=e.calculative.partialOption.echarts.option;e.calculative.singleton.echart.setOption(re(t))}else e.calculative.singleton.echart.setOption(Rs(e.echarts.option,e.calculative.canvas.store.data.scale),!0)}function Lz(e,t){if(e.calculative.partialOption=null,t.echarts){var r=globalThis.echarts;return t.echarts.geoName&&!r.getMap(t.echarts.geoName)&&(t.echarts.geoJson?r.registerMap(t.echarts.geoName,t.echarts.geoJson):t.echarts.geoUrl&&(e.calculative.singleton.echartsReady=!1,fetch(t.echarts.geoUrl).then(function(D){D.text().then(function(H){if(typeof H=="string")try{H=JSON.parse(H)}catch{}if(H.constructor!==Object&&H.constructor!==Array){console.warn("Invalid data:",H);return}return r.registerMap(t.echarts.geoName,H),e.calculative.singleton.echartsReady=!0,e.onValue(e),!1})}))),t}if(e.realTimes&&e.realTimes.length){var a=e.echarts.option,i=a.xAxis;a.yAxis;var o=e.echarts,n=o.max,s=o.replaceMode,u=o.timeFormat,c=[];for(var l in t)if(l.includes("echarts.option")){var f=wa(e,l);if(Array.isArray(f)&&s===Bo.Add){f.push(t[l]),n&&f.splice(0,f.length-n),t[l]=f;var h="echarts.option.xAxis.data";Array.isArray(i)&&i.length&&(h="echarts.option.xAxis.0.data");var d=wa(e,h),v=Ez(u||"`${hours}:${minutes}:${seconds}`");d.push(v),n&&d.splice(0,d.length-n),t[h]=d}if(l.includes(".data.")){var h=l.substring(0,l.indexOf(".data.")+5);c.includes(h)||c.push(h)}}var y=re(t);return e.calculative.partialOption=Dz(y),c.forEach(function(D){var H=wa(e,D);Ru(e.calculative.partialOption,D,H)}),t}if(!t.dataX&&!t.dataY)return t;var g=e.echarts,m=g.max,w=g.replaceMode,p=t.dataX,x=t.dataY,T=[];x&&T.push("echarts.option.series");var A=g.option.series,I=A.length,R=g.option,z=R.xAxis,U=R.yAxis;Array.isArray(z)&&z.length>1&&console.warn("echarts 只支持单 x 轴，多 x 轴将被忽略");var _=Array.isArray(z)?z[0]:z,k=Array.isArray(U)?U[0]:U;if(w)if(w===Bo.Replace){if(!_&&!k)x&&(I===1?(!Array.isArray(x)&&(x=[x]),x.forEach(function(D,H){var L=A[0].data.find(function(M){return M.name===D.name});L&&(L.value=D.value)})):A.forEach(function(D,H){Array.isArray(x[H])||(x[H]=[x[H]]),x[H].forEach(function(L,M){var j=D.data.find(function(W){return W.name===L.name});j&&(j.value=L.value)})}));else if((_.type==="category"||k.type==="category")&&p&&x){var B=_.type==="category"?_.data:k.data;!Array.isArray(p)&&(p=[p]),!Array.isArray(x)&&(x=[x]),_.type==="category"?T.push("echarts.option.xAxis"):T.push("echarts.option.yAxis"),I===1?x.forEach(function(D,H){var L=B.indexOf(p[H]);A[0].data[L]=D}):A.forEach(function(D,H){x[H].forEach(function(L,M){var j=B.indexOf(p[M]);D.data[j]=L})})}}else w===Bo.ReplaceAll&&(p&&(_.data=p,_.data.splice(0,_.data.length-m),T.push("echarts.option.xAxis")),x&&(I===1?(A[0].data=x,A[0].data.splice(0,A[0].data.length-m)):A.forEach(function(D,H){D.data=x[H],D.data.splice(0,D.data.length-m)})));else{if(p){!Array.isArray(p)&&(p=[p]);var S=_.data;S.push.apply(S,xc([],wc(p),!1)),S.splice(0,S.length-m),T.push("echarts.option.xAxis")}if(x)if(I===1){!Array.isArray(x)&&(x=[x]);var P=A[0].data;P.push.apply(P,xc([],wc(x),!1)),P.splice(0,P.length-m)}else A.forEach(function(D,H){Array.isArray(x[H])||(x[H]=[x[H]]);var L=D.data;L.push.apply(L,xc([],wc(x[H]),!1)),L.splice(0,L.length-m)})}return e.calculative.partialOption={},T.forEach(function(D){var H=wa(e,D);Ru(e.calculative.partialOption,D,H)}),delete t.dataX,delete t.dataY,Object.assign(t,{echarts:g})}function Oz(e,t,r){if(r.key==="dataY"){var a=e.echarts,i=a.option,o=i.xAxis,n=i.yAxis;Array.isArray(o)&&o.length>1&&console.warn("echarts 只支持单 x 轴，多 x 轴将被忽略");var s=Array.isArray(o)?o[0]:o,u=Array.isArray(n)?n[0]:n,c=a.option.series;if(!s&&!u){var l=[];if(Array.isArray(c)&&c.length===1)return c[0].data.forEach(function(m){var w=r.dataIds.find(function(x){return x.name===m.name}).dataId;if(w){var p=t.find(function(x){return x.dataId===w});p&&l.push({name:m.name,value:p.value})}}),{id:e.id,dataY:l}}else if(s.type==="category"||u.type==="category"){var f=[],h=[],d=s.type==="category"?s.data:u.data;return d==null||d.forEach(function(m){var w=r.dataIds.find(function(x){return x.name===m}).dataId;if(w){var p=t.find(function(x){return x.dataId===w});p&&(h.push(m),f.push(p.value))}}),{id:e.id,dataY:f,dataX:h}}else if(s.type==="time"){var v=[],y=+new Date,g=!1;if(c.forEach(function(m,w){var p=[],x=r.dataIds.find(function(A){return A.name===m.name}).dataId;if(x){var T=t.find(function(A){return A.dataId===x});T&&(p.push([y,T.value]),g=!0)}v[w]=p}),g)v.forEach(function(m,w){if(!m||m.length===0){var p=c[w].data[c[w].data.length-1];v[w]=[[y,p[1]]]}});else return;return{id:e.id,dataY:v.length===1?v[0]:v}}}}function kc(e){var t,r,a=new Image;a.src=(r=(t=e.calculative.singleton)===null||t===void 0?void 0:t.echart)===null||r===void 0?void 0:r.getDataURL({pixelRatio:2}),e.calculative.img=a}function Rs(e,t){var r=re(e);if(r.dataZoom)for(var a=["right","top","width","height","left","bottom"],i=function(n){r.dataZoom.forEach(function(s){isNaN(s[a[n]])||(s[a[n]]*=t)})},o=0;o<a.length;o++)i(o);return Eu(r,zu,t),r}function Dz(e){var t={};return Object.keys(e).forEach(function(r){var a=r.split("."),i=t;a.forEach(function(o,n){var s=!isNaN(parseInt(o));if(n===a.length-1)s?(Array.isArray(i)||(i=[]),i[parseInt(o)]=e[r]):i[o]=e[r];else if(s){var u=parseInt(o);if(Array.isArray(i)||i[a[n-1]],i[u]||(i[u]={}),Array.isArray(i))for(var c=0;c<parseInt(o);c++)i[c]||(i[c]={});i=i[u]}else i[o]||(o==="series"?i[o]=[]:i[o]={}),i=i[o]})}),t}var Cy=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Bz(e){var t=globalThis.lcjs;if(!(!e.lightningCharts||!t)){if(typeof e.lightningCharts=="string")try{e.lightningCharts=JSON.parse(e.lightningCharts)}catch{}if(e.lightningCharts){e.onDestroy||(e.onDestroy=Nz,e.onMove=ky,e.onResize=$z,e.onRotate=ky,e.onValue=jz,e.onRenderPenRaw=zz);var r=new Path2D,a=e.calculative.worldRect;if(e.calculative.singleton||(e.calculative.singleton={}),!e.calculative.singleton.div){var i=document.createElement("div");i.style.position="absolute",i.style.outline="none",i.style.left="-9999px",i.style.top="-9999px",i.style.width=a.width+"px",i.style.height=a.height+"px",i.id=e.id,document.body.appendChild(i),e.calculative.singleton.div=i,setTimeout(function(){Lw(e)},100),setTimeout(function(){e.calculative.canvas.externalElements&&e.calculative.canvas.externalElements.parentElement.appendChild(i),Ye(e,i);var o=new Image;o.src=e.calculative.singleton.div.children[0].toDataURL(),e.calculative.img=o},400)}return e.calculative.patchFlags&&e.calculative.singleton.div&&Ye(e,e.calculative.singleton.div),r}}}function Fz(e){var t=e.toLowerCase(),r=/^#([0-9|a-f]{3}|[0-9|a-f]{6})$/,a=/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;if(t&&r.test(t)){t.length==4&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);for(var i=[],o=1;o<7;o+=2)i.push(parseInt("0x"+t.slice(o,o+2)));return i}else if(t&&a.test(t)){var n=t.match(/\(([^)]*)\)/)[1],s=n.split(",").map(function(u){return parseInt(u)});return s}return t}function Lw(e){var t=lcjs.lightningChart;lcjs.PieChartTypes;var r=lcjs.LegendBoxBuilders,a=lcjs.SliceLabelFormatters,i=lcjs.Themes;lcjs.GaugeChartTypes,lcjs.SolidLine;var o=lcjs.SolidFill,n=lcjs.ColorRGBA,s=lcjs.UIOrigins,u=lcjs.emptyLine,c=lcjs.AutoCursorModes,l=lcjs.AxisScrollStrategies,f=lcjs.AxisTickStrategies,h=lcjs.UIElementBuilders,d=e.lightningCharts.option.data,v=e.lightningCharts.option.title||"Title",y=i[e.lightningCharts.option.theme||"lightNew"];switch(e.calculative.singleton.lightningChart=t(),e.lightningCharts.option.type){case"line":var g=e.calculative.singleton.lightningChart.ChartXY({container:e.id}).setTitle(v);d.forEach(function(R){g.addLineSeries().setName(R.name).add(R.data)});break;case"bar":var m=e.calculative.singleton.lightningChart,w=void 0;w=function(R){var z=10,U=z*.25,_=U*3,k=[],S=[],P=m.ChartXY(R).setTitle(v).setAutoCursorMode(c.onHover).setMouseInteractions(!1).setPadding({bottom:30}),B=P.getDefaultAxisX().setMouseInteractions(!1).setScrollStrategy(void 0).setTickStrategy(f.Empty);P.getDefaultAxisY().setMouseInteractions(!1).setTitle(e.lightningCharts.option.yTitle).setInterval(0,70).setScrollStrategy(l.fitting),P.setAutoCursor(function(W){return W.disposePointMarker().disposeTickMarkerX().disposeTickMarkerY().setGridStrokeXStyle(u).setGridStrokeYStyle(u).setResultTable(function(F){F.setOrigin(s.CenterBottom)})});var D=function(W){var F=P.addRectangleSeries();return F.setCursorResultTableFormatter(function(V,Y,q){var Q={name:W.name,value:W.data[W.figures.indexOf(q)]};return V.addRow("Department:",Q.name).addRow("# of employees:",String(Q.value))}),F},H=P.addLegendBox(r.VerticalLegendBox).setAutoDispose({type:"max-width",maxWidth:.2}),L=function(){for(var W,F,V=0,Y=0;Y<k.length;Y++){var q=k[Y],Q=V;try{for(var K=(W=void 0,Cy(S)),X=K.next();!X.done;X=K.next()){var b=X.value,C=b.data[Y];if(C!==void 0){var E=b.figures[Y];E.setDimensions({x:V,y:0,width:z,height:C}),V+=z+U}}}catch(N){W={error:N}}finally{try{X&&!X.done&&(F=K.return)&&F.call(K)}finally{if(W)throw W.error}}q.tick.setValue((Q+V-U)/2),V+=_}B.setInterval(-(_+U),V)},M=function(W){var F,V,Y=function(X){k.push({name:X,tick:B.addCustomTick(h.AxisTick).setGridStrokeLength(0).setTextFormatter(function(b){return X})})};try{for(var q=Cy(W),Q=q.next();!Q.done;Q=q.next()){var K=Q.value;Y(K)}}catch(X){F={error:X}}finally{try{Q&&!Q.done&&(V=q.return)&&V.call(q)}finally{if(F)throw F.error}}},j=function(W){var F=D(W).setName(W.name);W.figures=W.data.map(function(V){return F.add({x:0,y:0,width:0,height:0})}),H.add(F),S.push(W),L()};return{addCategory:j,addGroups:M}};var p=w({theme:y,container:e.id});p.addGroups(e.lightningCharts.option.groups);var x=e.lightningCharts.option.categories;d.forEach(function(R,z){return p.addCategory({name:x[z],data:R})});break;case"pie":var T=e.calculative.singleton.lightningChart.Pie({theme:y,container:e.id}).setTitle(v).setAnimationsEnabled(!0).setMultipleSliceExplosion(!0);d.map(function(R){return T.addSlice(R.name,R.value)}),T.setInnerRadius(e.lightningCharts.option.innerRadius||0).setLabelFormatter(a.NamePlusRelativeValue),T.addLegendBox(r.VerticalLegendBox).setAutoDispose({type:"max-width",maxWidth:.3}).add(T);break;case"gauge":var A=e.calculative.singleton.lightningChart.Gauge({theme:y,container:e.id}).setTitle(v).setThickness(20).setAngleInterval(e.lightningCharts.option.startAngle||225,e.lightningCharts.option.endAngle||-45),I=Fz(e.lightningCharts.option.background);A.getDefaultSlice().setInterval(e.lightningCharts.option.min||0,e.lightningCharts.option.max||100).setValue(d).setFillStyle(new o({color:n(I[0],I[1],I[2])}));break}}function Nz(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div,delete e.calculative.singleton.lightningChart)}function ky(e){e.calculative.singleton.div&&Ye(e,e.calculative.singleton.div)}function $z(e){e.calculative.singleton.div&&Ye(e,e.calculative.singleton.div)}function jz(e){e.calculative.singleton.div&&(Lw(e),Ye(e,e.calculative.singleton.div))}function zz(e){var t;if(!((t=e.calculative)===null||t===void 0)&&t.singleton){var r=new Image;r.src=e.calculative.singleton.div.children[0].toDataURL(),e.calculative.img=r}}function Hz(e){mr({echarts:Pz})}function Wz(e){mr({lightningCharts:Bz})}var Is;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(Is||(Is={}));function Ow(e,t){var r=t.calculative.worldRect.height*14/16,a=e.match(/[\u4e00-\u9fa5]/g)||"",i=a.length,o=(e.length-i)*r*.6+i*r;return o}function Dw(e){if(e.direction=="horizontal"){var t=[],r=0,a=e.height;e.checkboxHeight=a,e.options.forEach(function(s,u){t.push(u*(40+a)+r),r+=Ow(s.text,e)}),e.optionPos=t;var i=t.length*(40+a)+r;e.checkboxWidth=i,e.width=i,e.calculative.width=i,e.calculative.worldRect={x:e.x,y:e.y,height:e.height,width:e.width,center:{x:e.x+e.width/2,y:e.y+e.height/2}},Ke(e.calculative.worldRect)}else if(e.direction=="vertical"){e.optionInterval==null&&(e.optionInterval=20),e.optionHeight||(e.optionHeight=20);var o=[];e.options.forEach(function(s,u){o.push(u*(e.optionInterval+e.optionHeight))}),e.optionPos=o;var n=o[o.length-1]+e.optionHeight;e.checkboxHeight=n,e.width||(e.height=n,e.calculative.height=n,e.calculative.worldRect={x:e.x,y:e.y,height:e.height,width:e.width,center:{x:e.x+e.width/2,y:e.y+e.height/2}},Ke(e.calculative.worldRect))}}var Ms=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function _y(e,t){t.onAdd||(t.onAdd=Bw,(!t.rowPos||!t.colPos||!t.calculative.maxOffsetY)&&t.onAdd(t),t.onMouseMove=Xz,t.onMouseLeave=Qz,t.onMouseDown=Jz,t.onShowInput=Yz,t.onInput=Gz,t.onValue=tH,t.onBeforeValue=rH,t.onMouseEnter=sH,t.onWheel=iH,t.onDestroy=oH),t.data.length!==t.rowPos.length&&(t.initWorldRect=null,t.calculative.isUpdateData=!0,t.onValue(t)),t.data[0].length!==t.colPos.length&&(t.initWorldRect=null,t.calculative.isUpdateData=!0,t.onValue(t));var r=t.calculative.canvas.store.data,a=t.calculative.canvas.store.options;if(t.color=t.color||r.color||a.color,t.textColor=t.textColor||t.color||r.textColor||a.textColor,t.activeColor=t.activeColor||a.activeColor,t.hoverColor=t.hoverColor||a.hoverColor,t.activeBackground=t.activeBackground||a.activeBackground,t.hoverBackground=t.hoverBackground||a.hoverBackground,!t.hasHeader){e.save(),e.beginPath();var i=t.calculative.worldRect,o=i.x,n=i.y,s=i.width,u=i.height;e.fillStyle="#fff0",e.rect(o-1,n-1,s+2,u+2),e.fill(),e.clip()}qz(e,t),Kz(e,t),Uz(e,t),e.restore(),t.isFirstTime=!1}function Uz(e,t){if(t.calculative.hover&&t.calculative.hoverCell&&!t.calculative.isInput&&t.calculative.isHover){var r=t.calculative.worldRect,a=t.calculative.canvas.mousePos;if(!(a.x>r.x&&a.x<r.x+r.width&&a.y>r.y&&a.y<r.y+r.height)){t.calculative.hover=!1,t.calculative.isHover=!1,t.calculative.hoverCell=void 0;return}var i=t.calculative.hoverCell,o=i.row,n=i.col,s=t.calculative.canvas.mousePos,u=s.x,c=s.y;if(t.data[o]){var l=t.data[o][n];if(!(typeof l=="object"||!l)){e.save(),e.beginPath(),e.textAlign="start",e.textBaseline="middle",e.font=e.font=(t.calculative.fontStyle||"")+" normal "+(t.calculative.fontWeight||"")+" "+(t.calculative.fontSize||12)+"px "+t.calculative.fontFamily;var f=e.measureText(l).width;e.beginPath(),e.fillStyle="#fff",e.strokeStyle="#000",e.moveTo(u,c),e.rect(u-10,c,f+20,20),e.fill(),e.stroke(),e.beginPath(),e.fillStyle="#000",e.fillText(l,u,c+10),e.restore()}}}}function Vz(e){var t=[],r=[],a={};e.rowHeight||(e.rowHeight=40),e.colWidth||(e.colWidth=150);var i=0,o=e.styles&&e.styles.filter(function(m){return m.col!==void 0&&m.row===void 0&&m.width}),n={};o&&o.forEach(function(m){n[m.col]=m.width});for(var s=function(m){i+=(n[m]||e.colWidth)*e.calculative.canvas.store.data.scale,t.push(i);var w=e.styles&&e.styles.filter(function(p){return p.col===m&&p.row===void 0});w&&(a[m]=w[0])},u=0;u<e.data[0].length;u++)s(u);var c=0,l=e.styles&&e.styles.filter(function(m){return m.col===void 0&&m.row!==void 0&&m.height}),f={};l&&l.forEach(function(m){f[m.row]=m.height});for(var h=c,d=0;d<e.data.length;d++)c+=(f[d]||e.rowHeight)*e.calculative.canvas.store.data.scale,r.push(c),d<e.maxNum&&(h=c);if(e.calculative.maxOffsetY=(c-h)/e.calculative.canvas.store.data.scale,!e.initWorldRect){e.colPos=t,e.rowPos=r,e.colStyle=a,e.initScale=e.calculative.canvas.store.data.scale,e.tableWidth=i,e.tableHeight=h||c,e.calculative.width=i,e.calculative.height=h||c,e.calculative.width=i,e.calculative.height=h||c,e.height||(e.height=e.calculative.height),e.width||(e.width=e.calculative.width);var v=e.x,y=e.y;if(e.parentId){var g=e.calculative.canvas.store.pens[e.parentId];v=g.calculative.worldRect.x+g.calculative.worldRect.width*e.x,y=g.calculative.worldRect.y+g.calculative.worldRect.height*e.y}e.calculative.worldRect={x:v,y,height:e.calculative.height,width:e.calculative.width,center:{x:e.x+e.calculative.width/2,y:e.y+e.calculative.height/2}},e.width=e.calculative.width,e.height=e.calculative.height,e.initWorldRect||(e.initWorldRect={width:e.calculative.worldRect.width,height:e.calculative.worldRect.height}),Ke(e.calculative.worldRect)}}function qz(e,t){var r,a;if(t.colPos){var i=t.calculative.worldRect,o=i.x,n=i.y,s=i.width,u=i.height,c=i.ex,l=i.ey;e.save(),e.beginPath(),e.strokeStyle=t.color;var f=t.calculative.borderRadius||0,h=f;f<1&&(f=s*f,h=u*h);var d=f<h?f:h;if(s<2*d&&(d=s/2),u<2*d&&(d=u/2),e.moveTo(o+d,n),e.arcTo(c,n,c,l,d),e.arcTo(c,l,o,l,d),e.arcTo(o,l,o,n,d),e.arcTo(o,n,c,n,d),t.background&&(e.fillStyle=t.background,e.fill()),t.bordered!==!1&&(e.strokeStyle=t.borderColor||"#424B61",e.stroke()),t.hLine!==!1){var v=t.rowPos[t.rowPos.length-1];t.hasHeader&&(e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight),e.strokeStyle=t.borderColor||"#424B61",e.stroke());try{for(var y=Ms(t.rowPos),g=y.next();!g.done;g=y.next()){var m=g.value;if(m!==v){var w=m*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale;if(t.hasHeader){if(w<0+t.rowPos[0]||w>t.calculative.worldRect.height)continue}else if(w<0||w>t.calculative.worldRect.height)continue;e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+w),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+w),e.strokeStyle=t.borderColor||"#424B61",e.stroke()}}}catch(x){r={error:x}}finally{try{g&&!g.done&&(a=y.return)&&a.call(y)}finally{if(r)throw r.error}}}if(t.vLine!==!1){var p=t.colPos[t.colPos.length-1];t.colPos.forEach(function(x,T){if(x!==p){var A=x*t.calculative.worldRect.width/t.tableWidth;e.beginPath(),e.moveTo(t.calculative.worldRect.x+A,t.calculative.worldRect.y),e.lineTo(t.calculative.worldRect.x+A,t.calculative.worldRect.ey),e.strokeStyle=t.borderColor||"#424B61",e.stroke()}})}e.restore()}}function Kz(e,t){var r,a,i,o,n;if(t.colPos){t.calculative.texts||(t.calculative.texts=[]);for(var s=1,u=function(l){if(t.hasHeader&&l===1){e.save(),e.beginPath();var f=t.calculative.worldRect,h=f.x,d=f.y,v=f.width,y=f.height;e.fillStyle="#fff0",e.rect(h-1,d+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight-1,v+2,y-t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight+2),e.fill(),e.clip()}for(var g=Zz(t,l).style,m=function(p){var x=Nw(t,l,p),T=x.value,A=x.style,I=!0;if(Array.isArray(A)&&A.length>0){var R=0;A.forEach(function(q,Q){if(q.wheres){var K=q.wheres.every(function(X){var b=new Function("attr","return attr "+X.comparison+" "+X.value);return b(T)});K&&(R=Q)}}),A=A[R]}else A.wheres&&Array.isArray(A.wheres)&&(I=!1,I=A.wheres.every(function(q){var Q=new Function("attr","return attr "+q.comparison+" "+q.value);return Q(T)}));var z=t.color,U=t.textColor||t.color,_=null,k=null,S=null,P=null;I&&(z=A.color||g.color||t.color,U=A.textColor||g.textColor||t.textColor,_=A.background||g.background,k=(A.fontSize||g.fontSize||0)*t.calculative.canvas.store.data.scale,S=A.fontWeight||g.fontWeight,P=A.fontStyle||g.fontStyle);var B=void 0;t.stripe&&(t.hasHeader!==!1?l%2===1&&(_=_||t.stripeColor||"#407FFF1F"):l%2===0&&(_=_||t.stripeColor||"#407FFF1F")),t.calculative.active&&((r=t.calculative.activeCell)===null||r===void 0?void 0:r.row)===l&&((a=t.calculative.activeCell)===null||a===void 0?void 0:a.col)===p&&(z=t.activeColor,_=t.activeBackground,B=z,U=t.activeTextColor||t.activeColor),t.calculative.hover&&((i=t.calculative.hoverCell)===null||i===void 0?void 0:i.row)===l&&((o=t.calculative.hoverCell)===null||o===void 0?void 0:o.col)===p&&(z=t.hoverColor,_=t.hoverBackground,U=t.hoverTextColor||t.hoverColor,B=z);var D=jw(t,l,p);if(D.y+D.height<t.calculative.worldRect.y||D.y>t.calculative.worldRect.height+t.calculative.worldRect.y)return"continue";_&&(e.save(),e.beginPath(),e.fillStyle=_,e.fillRect(D.x,D.y,D.width+.25*t.calculative.canvas.store.data.scale,D.height),e.restore()),B&&(e.save(),e.beginPath(),e.strokeStyle=B,e.strokeRect(D.x,D.y,D.width,D.height),e.restore()),t.calculative.worldTextRect=D;var H=t.calculative.texts[l];if(t.calculative.texts[l]||(H=[],t.calculative.texts.push(H)),H[p]==null){if(typeof T=="object"){var L=t.styles&&t.styles.filter(function(q){return q.col===p&&q.row===void 0&&q.pens});if(L.length>0){if(H[p]="",t.isFirstTime){t.maxNum&&t.hasHeader&&l>=t.maxNum&&(T.visible=!1);var M=JSON.parse(JSON.stringify(L[0].pens));M.forEach(function(q){Object.assign(q,{row:l,col:p},T),q.activeBackground=q.background,q.hoverBackground=q.background,q.activeColor=q.color,q.hoverColor=q.color,q.activeTextColor=q.textColor,q.hoverTextColor=q.textColor,q.height*=t.calculative.canvas.store.data.scale,q.width*=t.calculative.canvas.store.data.scale}),eH(t,D,M),t.calculative.canvas.parent.pushChildren(t,M)}return"continue"}}else T===void 0?H[p]="":H[p]=T.text||T+"";if(!H[p])return"continue";H[p]=wn(t,H[p])}if(!H[p])return"continue";e.save(),e.beginPath(),e.fillStyle=U,e.textAlign="center",e.textBaseline="middle",e.font=(P||t.calculative.fontStyle||"")+" normal "+(S||t.calculative.fontWeight||"")+" "+(k||t.calculative.fontSize||12)*s+"px "+t.calculative.fontFamily;var j=t.colStyle&&((n=t.colStyle[p])===null||n===void 0?void 0:n.textAlign);if(j&&(e.textAlign=j),H[p].length===1)j==="left"?e.fillText(H[p][0],D.x,D.y+D.height/2):j==="right"?e.fillText(H[p][0],D.x+D.width,D.y+D.height/2):e.fillText(H[p][0],D.x+D.width/2,D.y+D.height/2);else{var W=.55,F=(k||t.calculative.fontSize)*t.calculative.lineHeight*s,V=H[p].length*F,Y=(D.height-V)/2;j==="left"?H[p].forEach(function(q,Q){e.fillText(q,D.x,D.y+Y+(Q+W)*F)}):j==="right"?H[p].forEach(function(q,Q){e.fillText(q,D.x+D.width,D.y+Y+(Q+W)*F)}):H[p].forEach(function(q,Q){e.fillText(q,D.x+D.width/2,D.y+Y+(Q+W)*F)})}e.restore()},w=0;w<t.colPos.length;w++)m(w)},c=0;c<t.rowPos.length;c++)u(c)}}function Bw(e){var t;fh(e),!((t=e.children)===null||t===void 0)&&t.length||(e.isFirstTime=!0),e.offsetY||(e.offsetY=0),Vz(e)}function Yz(e,t){if(e.calculative.hoverCell){var r=Nw(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col).value;if(typeof r!="object"){e.calculative.isHover=!1,e.calculative.isInput=!0,e.calculative.canvas.render(),e.calculative.inputCell=e.calculative.hoverCell;var a=jw(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);e.calculative.tempText=r.text||r+"",e.calculative.canvas.showInput(e,a,"#ffffff")}}}function Gz(e,t){e.calculative.inputCell&&($w(e,e.calculative.inputCell.row,e.calculative.inputCell.col,t),e.calculative.isInput=!1,e.calculative.isHover=!0,e.calculative.canvas.render())}function Xz(e,t){e.timer&&(e.calculative.isHover=!1,clearTimeout(e.timer)),e.timer=setTimeout(function(){e.calculative.isHover=!0,e.calculative.canvas.render()},500),e.calculative.hoverCell=Fw(e,t),e.calculative.canvas.render()}function Qz(e,t){fh(e),e.calculative.hoverCell=void 0,e.calculative.canvas.render()}function Jz(e,t){e.calculative.activeCell=Fw(e,t),e.calculative.canvas.render()}function Fw(e,t){for(var r=e.calculative.worldRect.width/e.tableWidth,a=e.calculative.worldRect.height/e.tableHeight,i={row:0,col:0},o=0;o<e.colPos.length;o++)t.x>e.calculative.worldRect.x+e.colPos[o]*r&&(i.col=o+1);for(var o=0;o<e.rowPos.length;o++)t.y>e.calculative.worldRect.y+e.rowPos[o]*a-e.offsetY*e.calculative.canvas.store.data.scale&&(i.row=o+1);return i}function Nw(e,t,r){if(!(!e.data||!Array.isArray(e.data))){var a=e.data[t],i=e.styles&&e.styles.filter(function(o){return o.row===t&&o.col===r});if(Array.isArray(a))return{value:a[r],style:(i==null?void 0:i.length)>0?i.length>1?i:i[0]:{}};if(!a.data||!Array.isArray(a.data))return}}function Zz(e,t){if(!(!e.data||!Array.isArray(e.data))){var r=e.data[t],a=e.styles&&e.styles.filter(function(i){return i.row===t&&!i.col});if(Array.isArray(r))return{value:r,style:(a==null?void 0:a.length)>0?a[0]:{}};if(!r.data||!Array.isArray(r.data))return}}function $w(e,t,r,a){if(!(!e.data||!Array.isArray(e.data))){e.isFirstTime=!1,e.calculative.texts=void 0;var i=e.data[t];i&&(i[r]instanceof Object||(i[r]=a),e.calculative.canvas.store.emitter.emit("valueUpdate",e))}}function jw(e,t,r){var a=e.calculative.worldRect.width/e.tableWidth,i=e.calculative.worldRect.height/e.tableHeight,o=0,n=e.colPos[r]*a;r>0&&(o=e.colPos[r-1]*a);var s=0,u=e.rowPos[t]*i;t>0&&(s=e.rowPos[t-1]*i);var c=e.offsetY*e.calculative.canvas.store.data.scale;return t===0&&e.hasHeader&&(c=0),{x:e.calculative.worldRect.x+o,y:e.calculative.worldRect.y+s-c,ex:e.calculative.worldRect.x+n,ey:e.calculative.worldRect.y+u-c,width:n-o,height:u-s}}function eH(e,t,r){var a,i,o,n;if(r&&r.length){var s=e.calculative.worldRect.width/e.tableWidth,u=e.calculative.worldRect.height/e.tableHeight,c=1,l=1;e.initWorldRect&&(e.calculative.worldRect.width!==e.initWorldRect.width&&(c=e.calculative.worldRect.width/e.initWorldRect.width),e.calculative.worldRect.height!==e.initWorldRect.height&&(l=e.calculative.worldRect.height/e.initWorldRect.height));var f=0,h=0,d=0,v=e.calculative.canvas.store.data.scale;if(r.length>1){try{for(var y=Ms(r),g=y.next();!g.done;g=y.next()){var m=g.value;h+m.width*s+20*v*s<t.width?(m.x=t.x+h+10*v*s,m.y=t.y+d+10*v*u,h+=(m.width+10*v)*s,f=Math.max(f,d+(m.height+10*v)*u)):(h=0,d=f,m.x=t.x+h+10*v*s,m.y=t.y+d+10*v*u,f+=(m.height+10*v)*u)}}catch(T){a={error:T}}finally{try{g&&!g.done&&(i=y.return)&&i.call(y)}finally{if(a)throw a.error}}if(f+20*v*u<t.height){var w=(t.height-f-10*v*u)/2;try{for(var p=Ms(r),x=p.next();!x.done;x=p.next()){var m=x.value;m.y+=w}}catch(T){o={error:T}}finally{try{x&&!x.done&&(n=p.return)&&n.call(p)}finally{if(o)throw o.error}}}}else r[0].x=t.x+(t.width-r[0].width)/2,r[0].y=t.y+(t.height-r[0].height)/2;r.forEach(function(T){T.width=T.width*c,T.height=T.height*l})}}function tH(e){if(e.calculative.isUpdateData){delete e.calculative.isUpdateData;var t=re(e.children);e.children=[],Bw(e),t&&t.forEach(function(r){e.calculative.canvas.delForce(e.calculative.canvas.findOne(r))}),e.calculative.texts=void 0}}function rH(e,t){var r,a;if(e.calculative.isUpdateData=!1,e.swiper!==void 0&&(e.swiper?fh(e):uh(e)),t.styles&&(e.initWorldRect=void 0),t.table||t.col==null&&t.row==null){if(t.dataY){var i=e.replaceMode,o=[];return i?i===Is.Replace?(o=e.data,t.dataX&&t.dataX.forEach(function(l,f){o[l]=t.dataY[f]})):i===Is.ReplaceAll&&(t.dataX?o[0]=t.dataX:o[0]=e.data[0],o=o.concat(t.dataY)):o=e.data.concat(t.dataY),delete t.dataX,delete t.dataY,e.calculative.isUpdateData=!0,Object.assign(t,{data:o})}(t.data||t.styles||t.maxNum||t.rowHeight||t.colWidth)&&(e.calculative.isUpdateData=!0,e.initWorldRect=null);try{for(var n=Ms(Object.keys(t)),s=n.next();!s.done;s=n.next()){var u=s.value;u.includes("data.")&&(e.calculative.isUpdateData=!0)}}catch(l){r={error:l}}finally{try{s&&!s.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return t}var c=e.data[t.row];return c&&(c[t.col]instanceof Object||(c[t.col]=t.value),$w(e,t.row,t.col,t.value),e.calculative.canvas.render(),delete t.col,delete t.row),t}function iH(e,t){if(!(!e.locked&&!e.calculative.canvas.store.data.locked)&&e.maxNum){var r=0;t.deltaY>0?r=4:r=-4,Hu(e,r)}}function Hu(e,t){var r;e.offsetY||(e.offsetY=0),e.offsetY+=t,e.offsetY>e.calculative.maxOffsetY&&(e.offsetY=e.calculative.maxOffsetY),e.offsetY<0&&(e.offsetY=0),(r=e.children)===null||r===void 0||r.forEach(function(a){var i=e.calculative.canvas.store.pens[a];aH(e,i)}),e.calculative.canvas.render()}function aH(e,t){if(t){t.oldY||(t.oldY=t.y);var r=t.calculative.worldRect;r.y,r.height;var a=e.calculative.worldRect;a.y,a.height;var i=e.calculative.canvas.store.data.scale;e.calculative.worldRect.height/e.tableHeight;var o=e.rowHeight;t.y=t.oldY-e.offsetY*i/e.calculative.worldRect.height;var n=o*(e.initScale||1)/e.tableHeight*e.maxNum;if(e.calculative.canvas.updatePenRect(t),e.hasHeader)if(t.y<e.rowPos[0]/e.tableHeight){if(t.calculative.visible=!1,t.visible=!1,t.y<e.rowPos[0]/e.tableHeight/2){t.oldY+=n;var s=t.row+e.maxNum;if(!e.data[s])return;var u=re(e.data[s][t.col]);u.background&&(u.activeBackground=u.background,u.hoverBackground=u.background),u.color&&(u.hoverColor=u.color,u.activeColor=u.color),u.textColor&&(u.activeTextColor=u.textColor,u.hoverTextColor=u.textColor),Object.assign(t,u,{row:s}),Object.assign(t.calculative,u,{row:s})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y+t.height/2>1){t.oldY-=n;var s=t.row-e.maxNum;if(!e.data[s])return;var u=re(e.data[s][t.col]);u.background&&(u.activeBackground=u.background,u.hoverBackground=u.background),u.color&&(u.hoverColor=u.color,u.activeColor=u.color),u.textColor&&(u.activeTextColor=u.textColor,u.hoverTextColor=u.textColor),Object.assign(t,u,{row:s}),Object.assign(t.calculative,u,{row:s})}}else t.visible=!0,t.calculative.visible=!0;else if(t.y<0){if(t.calculative.visible=!1,t.visible=!1,t.y<-o/e.tableHeight/2){t.oldY+=n;var s=t.row+e.maxNum;if(!e.data[s])return;var u=re(e.data[s][t.col]);u.background&&(u.activeBackground=u.background,u.hoverBackground=u.background),u.color&&(u.hoverColor=u.color,u.activeColor=u.color),u.textColor&&(u.activeTextColor=u.textColor,u.hoverTextColor=u.textColor),Object.assign(t,u,{row:s}),Object.assign(t.calculative,u,{row:s})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y+t.height/2>1){t.oldY-=n;var s=t.row-e.maxNum;if(!e.data[s])return;var u=re(e.data[s][t.col]);u.background&&(u.activeBackground=u.background,u.hoverBackground=u.background),u.color&&(u.hoverColor=u.color,u.activeColor=u.color),u.textColor&&(u.activeTextColor=u.textColor,u.hoverTextColor=u.textColor),Object.assign(t,u,{row:s}),Object.assign(t.calculative,u,{row:s})}}else t.calculative.visible=!0,t.visible=!0}}function oH(e){uh(e)}function uh(e){e.interval&&(globalThis.clearInterval(e.interval),e.interval=null)}function fh(e){if(e.maxNum&&e.swiper){if(e.interval)return;e.interval=globalThis.setInterval(function(){e.offsetY>=e.calculative.maxOffsetY?(e.offsetY=0,nH(e)):e.offsetY%e.rowHeight?Hu(e,1):(e.calculative.stap||(e.calculative.stap=0),e.calculative.stap+=1,e.calculative.stap==12&&(e.calculative.stap=0,Hu(e,1)))},50)}}function nH(e){var t;(t=e.children)===null||t===void 0||t.forEach(function(r){var a=e.rowHeight,i=e.calculative.canvas.store.pens[r];if(i){var o=a*(e.initScale||1)/e.tableHeight*e.maxNum;i.oldY-=o;var n=i.row-e.maxNum;if(e.data[n]){var s=re(e.data[n][i.col]);s.background&&(s.activeBackground=s.background,s.hoverBackground=s.background),s.color&&(s.hoverColor=s.color,s.activeColor=s.color),s.textColor&&(s.activeTextColor=s.textColor,s.hoverTextColor=s.textColor),i.calculative.visible=!0,i.visible=!0,Object.assign(i,s,{row:n}),Object.assign(i.calculative,s,{row:n})}}}),e.calculative.canvas.render()}function sH(e){uh(e)}function lH(e,t){t.onClick||(t.onClick=cH);var r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.width,o=t.calculative.worldRect.height;i<o*1.5&&(i=1.5*o),e.beginPath(),e.arc(r+o/2,a+o/2,o/2,Math.PI/2,Math.PI*3/2),e.lineTo(r+i-o/2,a),e.arc(r+i-o/2,a+o/2,o/2,-Math.PI/2,Math.PI/2),e.lineTo(r+o/2,a+o),t.checked?(e.fillStyle=t.onColor,(t.disabled||t.disable)&&(e.fillStyle=t.disableOnColor||ht(.6,t.onColor)),t.lineWidth&&(e.strokeStyle=t.onStrokeColor,e.stroke()),e.fill(),e.closePath(),e.beginPath(),e.fillStyle="#ffffff",e.moveTo(r+o*2,a+o/2),e.arc(r+i-o/2,a+o/2,o/2>2?o/2-2:1,0,Math.PI*2),e.fill()):(e.fillStyle=t.offColor,(t.disabled||t.disable)&&(e.fillStyle=t.disableOffColor||ht(.6,t.offColor)),t.lineWidth&&(e.strokeStyle=t.offStrokeColor,e.stroke()),e.fill(),e.closePath(),e.beginPath(),e.fillStyle="#ffffff",e.moveTo(r+o,a+o/2),e.arc(r+o/2,a+o/2,o/2>2?o/2-2:1,0,Math.PI*2),e.fill()),e.closePath()}function cH(e){e.disabled||e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function uH(e,t){t.onAdd||(t.onAdd=wo,t.onResize=wo,t.onMove=wo,t.onMouseMove=fH,t.onMouseDown=zw,t.onValue=hH,t.onBeforeValue=dH),t.calculative.barRect||wo(t),t.calculative.canvas.store.data;var r=t.calculative.canvas.store.options,a=t.background;t.disabled&&(a=t.disabledBackground||ht(.6,a)),e.fillStyle=a,e.beginPath();var i=t.calculative.worldRect.x+t.calculative.barRect.x,o=t.calculative.worldRect.y+t.calculative.barRect.y,n=t.calculative.barRect.width,s=t.calculative.barRect.height,u=s/2;e.moveTo(i+u,o),e.arcTo(i+n,o,i+n,o+s,u),e.arcTo(i+n,o+s,i,o+s,u),e.arcTo(i,o+s,t.x,t.y,u),e.arcTo(i,o,i+n,o,u),e.fill();var c=t.activeColor||r.activeColor;t.disabled&&(c=t.disabledColor||ht(.6,c)),e.fillStyle=c,e.beginPath(),n=t.calculative.ballRect.x,e.moveTo(i+u,o),e.arcTo(i+n,o,i+n,o+s,u),e.arcTo(i+n,o+s,i,o+s,u),e.arcTo(i,o+s,t.x,t.y,u),e.arcTo(i,o,i+n,o,u),e.fill(),e.fillStyle=t.btnBackground||"#fff",e.strokeStyle=c,e.lineWidth=2,e.beginPath(),i=t.calculative.worldRect.x+t.calculative.ballRect.x,o=t.calculative.worldRect.y+t.calculative.ballRect.y+t.calculative.ballRect.height/2,e.lineWidth=t.calculative.ballRect.width/10,e.arc(i,o,t.calculative.ballRect.width/2,0,Math.PI*2),e.fill(),e.stroke()}function wo(e){if(e._textWidth||(e._textWidth=e.textWidth||50,e._fontSize=e.fontSize||12),e.textWidth=e.calculative.worldRect.width,e.calculative.textWidth=e.textWidth,e.unit||(e.unit="%"),e.sliderWidth||(e.sliderWidth=e.width),e.sliderHeight||(e.sliderHeight=e.height),!!e.calculative.worldRect){var t=e.calculative.worldRect.width/e.sliderWidth,r=e.calculative.worldRect.height/e.sliderHeight,a=Math.min(t,r);e.fontSize=e._fontSize*a;var i=e.calculative.worldRect.width-e._textWidth*a;e.textLeft=i+10*a,e.calculative.textLeft=e.textLeft,e.calculative.barRect={x:0,y:(e.calculative.worldRect.height-e.barHeight*r)/2,width:i,height:e.barHeight*r},Ke(e.calculative.barRect),hh(e)}}function hh(e){var t=e.calculative.barRect.height*3.5,r=e.calculative.barRect.width*e.value/100;e.calculative.ballRect={x:r,y:(e.calculative.worldRect.height-t)/2,width:t,height:t},Ke(e.calculative.ballRect),e.calculative.text=e.value+e.unit,Cr(e)}function zw(e,t){if(!e.disabled){var r=t.x-e.calculative.worldRect.x;if(!(r>e.calculative.barRect.width)){var a=Math.round(r/e.calculative.barRect.width*100);a<e.min||a>e.max||a<0||a>100||(e.value=a,hh(e),e.calculative.text=e.value+e.unit,Cr(e),e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}}}function fH(e,t){e.calculative.canvas.mouseDown&&zw(e,t)}function hH(e){e.calculative.isUpdateData&&(delete e.calculative.isUpdateData,wo(e)),hh(e)}function dH(e,t){return e.calculative.isUpdateData=!1,(t.textWidth||t.barHeight)&&(t.textWidth&&(e._textWidth=0),e.calculative.isUpdateData=!0),t}function vH(e,t){t.onMouseDown||(t.onMouseDown=gH),t.options||(t.options=t.data);var r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height;t.calculative.worldRect.width;var o=t.calculative,n=o.fontStyle,s=o.fontWeight,u=o.fontSize,c=o.fontFamily,l=o.lineHeight,f=2;e.beginPath(),e.moveTo(r,a),e.arcTo(r+i,a,r+i,a+i,f),e.arcTo(r+i,a+i,r,a+i,f),e.arcTo(r,a+i,r,a,f),e.arcTo(r,a,r+i,a,f),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.checked&&(e.fillStyle=t.background||"#1890ff",e.strokeStyle=t.background||"#1890ff"),(t.isForbidden||t.disabled)&&(e.fillStyle=t.disabledBackground||ht(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||ht(.6,t.color)||"#d9d9d9"),e.closePath(),e.fill(),e.stroke(),e.save(),t.checked&&(e.beginPath(),e.lineWidth=i/10,e.strokeStyle="#ffffff",e.moveTo(r+102/506*i,a+i/2),e.lineTo(r+220/506*i,a+346/460*i),e.lineTo(r+404/506*i,a+142/460*i),e.stroke()),e.restore(),e.save(),e.fillStyle=t.disabled||t.isForbidden?t.disabledTextColor||ht(.6,t.textColor||t.color)||"#00000040":pi(t,t.calculative.canvas.parent.store)||"#000000d9",e.textAlign="start",e.textBaseline="middle",e.font=qt({fontStyle:n,fontWeight:s,fontFamily:c||t.calculative.canvas.parent.store.options.fontFamily,fontSize:u,lineHeight:l}),e.fillText(t.value+"",r+i+10,a+i/2),e.restore()}function gH(e,t){e.isForbidden||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function yH(e,t){t.options||(t.options=t.data),t.onAdd||(t.onAdd=pH,t.optionPos||(t.onAdd(t),t.calculative.canvas.parent.active([t])),t.onMouseDown=mH,t.onValue=bH);var r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height,o=t.calculative.worldRect.width;if(t.optionPos){var n=t.calculative,s=n.fontStyle,u=n.fontWeight;n.fontSize;var c=n.fontFamily,l=n.lineHeight;if(t.direction=="horizontal")for(var f=0;f<t.optionPos.length;f++){var h=t.optionPos[f]*o/t.checkboxWidth,d=t.options[f].isForbidden||t.disabled;e.beginPath(),e.arc(r+h+i/2,a+i/2,i/2,0,Math.PI*2),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.options[f].text===t.checked&&(e.strokeStyle=t.options[f].background||t.background||"#1890ff"),d&&(e.fillStyle=t.disabledBackground||ht(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||ht(.6,t.color)||"#d9d9d9",t.options[f].text===t.checked&&(e.fillStyle="#ffffff00")),e.closePath(),e.fill(),e.stroke(),e.save(),t.options[f].text===t.checked&&(e.beginPath(),e.strokeStyle=t.options[f].background?t.options[f].background+"20":t.background||"#1890ff20",d&&(e.strokeStyle=t.disabledBackground||ht(.6,t.background)||"#ebebeb"),e.arc(r+i/2+h,a+i/2,i/2+1.5,0,Math.PI*2),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle=t.options[f].background||t.background||"#1890ff",d&&(e.fillStyle=t.disabledBackground||ht(.6,t.background)||"#ebebeb"),e.arc(r+i/2+h,a+i/2,i/4,0,Math.PI*2),e.fill(),e.closePath()),e.restore(),e.save(),e.fillStyle=d?t.disabledTextColor||"#00000040":pi(t,t.calculative.canvas.parent.store)||"#000000d9";var v=t.calculative.worldRect.height*14/16;e.textAlign="start",e.textBaseline="middle",e.font=qt({fontStyle:s,fontWeight:u,fontFamily:c||t.calculative.canvas.parent.store.options.fontFamily,fontSize:v,lineHeight:l}),e.fillText(t.options[f].text,r+i+h+10/t.checkboxWidth*o,a+i/2),e.restore()}else if(t.direction=="vertical")for(var y=t.optionHeight*i/t.checkboxHeight,f=0;f<t.optionPos.length;f++){var h=t.optionPos[f]*i/t.checkboxHeight,d=t.options[f].isForbidden;e.beginPath(),e.arc(r+y/2,a+y/2+h,y/2,0,Math.PI*2),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.options[f].text===t.checked&&(e.strokeStyle=t.options[f].background||"#1890ff"),d&&(e.fillStyle="#ebebeb",e.strokeStyle="#d9d9d9"),e.closePath(),e.fill(),e.stroke(),e.save(),!d&&t.options[f].text===t.checked&&(e.beginPath(),e.strokeStyle=t.options[f].background?t.options[f].background+"20":"#1890ff20",e.arc(r+y/2,a+y/2+h,y/2+1.5,0,Math.PI*2),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle=t.options[f].background||"#1890ff",e.arc(r+y/2,a+y/2+h,y/4,0,Math.PI*2),e.fill(),e.closePath()),e.restore(),e.save(),e.fillStyle=d?"#00000040":pi(t,t.calculative.canvas.parent.store)||"#000000d9";var v=14*t.calculative.worldRect.height/t.checkboxHeight;e.textAlign="start",e.textBaseline="middle",e.font=qt({fontStyle:s,fontWeight:u,fontFamily:c||t.calculative.canvas.parent.store.options.fontFamily,fontSize:v,lineHeight:l}),e.fillText(t.options[f].text,r+y+10,a+y/2+h),e.restore()}}}function pH(e){Dw(e)}function mH(e,t){if(e.direction=="horizontal")for(var r=0;r<e.optionPos.length;r++)!e.options[r].isForbidden&&t.x>e.calculative.worldRect.x+e.optionPos[r]*e.calculative.worldRect.width/e.checkboxWidth&&t.x<e.calculative.worldRect.x+(e.optionPos[r]+e.height)/e.checkboxWidth*e.calculative.worldRect.width+Ow(e.options[r].text,e)+10/e.checkboxWidth*e.calculative.worldRect.width&&(e.checked=e.options[r].text,e.calculative.canvas.store.emitter.emit("valueUpdate",e));else if(e.direction=="vertical")for(var a=e.calculative.worldRect.height/e.checkboxHeight,r=0;r<e.optionPos.length;r++)!e.options[r].isForbidden&&t.y>e.calculative.worldRect.y+e.optionPos[r]*a&&t.y<e.calculative.worldRect.y+(e.optionPos[r]+e.optionHeight)*a&&(e.checked=e.options[r].text,e.calculative.canvas.store.emitter.emit("valueUpdate",e));e.calculative.canvas.render()}function bH(e){Dw(e)}function wH(){return{radio:yH,switch:lH,slider:uH,checkbox:vH,table:_y,table2:_y}}var Wu=function(){return Wu=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Wu.apply(this,arguments)},xH=15;function Ri(e,t){t===void 0&&(t=xH);var r=""+e;return r.indexOf(".")>=0&&(r=Number.parseFloat(r).toFixed(t)),Number.parseFloat(r)}function _c(e){return typeof e=="number"&&Number.isFinite(e)}function CH(e){e=Wu({max:null,min:null,splitNumber:4,symmetrical:!1,deviation:!1,preferZero:!1},e);var t=[10,15,20,25,30,40,50,60,70,80,90,100,150],r=e.max,a=e.min,i=e.splitNumber,o=e.symmetrical,n=e.deviation,s=e.preferZero;if(!_c(r)||!_c(a)||r<a)return{splitNumber:i};if(r===a&&r===0)return{max:Ri(t[0]*i),min:a,interval:t[0],splitNumber:i};r===a&&(s=!0),(!_c(i)||i<=0)&&(i=4),s&&r*a>0&&(r<0?r=0:a=0);var u=(r-a)/i,c=Math.floor(Math.log10(u)-1);c=Math.pow(10,c);var l=u/c,f=t[0]*c,h=-1,d;for(d=0;d<t.length;d++)if(t[d]>l){f=t[d]*c;break}var v=r,y=a;function g(p){if(v=parseInt(""+(r/p+1))*p,y=parseInt(""+(a/p-1))*p,r===0&&(v=0),a===0&&(y=0),o&&v*y<0){var x=Math.max(Math.abs(v),Math.abs(y));v=x,y=-x}}if(g(f),n)return{max:Ri(v),min:Ri(y),interval:Ri(f),splitNumber:Math.round((v-y)/f)};if(!o||v*y>0){var m=void 0;e:do{if(m=Math.round((v-y)/f),(d-h)*(m-i)<0){for(;m<i;)if(y-a<=v-r&&y!==0||v===0?y-=f:v+=f,m++,m===i)break e}if(d>=t.length-1||d<=0||m===i)break;h=d,m>i?f=t[++d]*c:f=t[--d]*c,g(f)}while(m!==i)}v=Ri(v),y=Ri(y);var w=Ri((v-y)/i);return{max:v,min:y,interval:w,splitNumber:i}}function Hw(e,t){var r,a,i,o,n,s,u,c,l,f,h,d,v,y,g,m,w,p,x,T,A,I,R,z,U,_,k,S,P=t.calculative.worldRect.x,B=t.calculative.worldRect.y,D=t.calculative.worldRect.width,H=t.calculative.worldRect.height,L=t.calculative.canvas.store.data.scale,M=[];if(t.echarts)for(var j=0;j<t.echarts.option.series.length;j++)M.push(t.echarts.option.series[j].data);else M=t.data;for(var W=[],j=0;j<M.length;j++)W=W.concat(M[j]);var F={max:Math.max.apply(null,W),min:Math.min.apply(null,W),splitNumber:5},V=CH(F),Y=t.echarts?t.echarts.option.xAxis.data.length:t.xAxisData.length;e.beginPath(),e.strokeStyle="#BFBFBF",e.lineWidth=6*L,e.lineCap="butt";var q=(D-1*(Y+1))/Y;e.setLineDash([1,q]),e.moveTo(P,B+H+3*L),e.lineTo(P+D,B+H+3*L),e.stroke(),e.closePath(),e.beginPath(),e.lineWidth=1*L,e.setLineDash([]),e.moveTo(P,B+H),e.lineTo(P+D,B+H),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle="#BFBFBF",e.strokeStyle="#E9E9E9",e.setLineDash([2,2]);var Q={fontStyle:((a=(r=t.yAxis)===null||r===void 0?void 0:r.axisLabel)===null||a===void 0?void 0:a.fontStyle)||t.fontStyle,textDecoration:(o=(i=t.yAxis)===null||i===void 0?void 0:i.axisLabel)===null||o===void 0?void 0:o.textDecoration,fontWeight:((s=(n=t.yAxis)===null||n===void 0?void 0:n.axisLabel)===null||s===void 0?void 0:s.fontWeight)||t.fontWeight,fontFamily:((c=(u=t.yAxis)===null||u===void 0?void 0:u.axisLabel)===null||c===void 0?void 0:c.fontFamily)||t.fontFamily,fontSize:((f=(l=t.yAxis)===null||l===void 0?void 0:l.axisLabel)===null||f===void 0?void 0:f.fontSize)||t.fontSize,lineHeight:((d=(h=t.yAxis)===null||h===void 0?void 0:h.axisLabel)===null||d===void 0?void 0:d.lineHeight)||t.lineHeight};e.fillStyle=((y=(v=t.yAxis)===null||v===void 0?void 0:v.axisLabel)===null||y===void 0?void 0:y.fontColor)||t.color;for(var j=0;j<V.splitNumber+1;j++){var K=j*H/V.splitNumber;e.textAlign="right",e.textBaseline="middle",e.font=qt(Q),e.fillText(V.max-j*V.interval+"",P-10*L,B+K),e.fill(),j<V.splitNumber&&(e.beginPath(),e.moveTo(P,B+K),e.lineTo(P+D,B+K),e.stroke())}e.closePath(),e.beginPath(),e.strokeStyle="#BFBFBF";for(var X=t.echarts?t.echarts.option.xAxis.data:t.xAxisData,b=0,j=0;j<X.length;j++){b=P+(1+q/2)+(q+1)*j,e.textAlign="center",e.textBaseline="top";var C={fontStyle:((m=(g=t.xAxis)===null||g===void 0?void 0:g.axisLabel)===null||m===void 0?void 0:m.fontStyle)||t.calculative.fontStyle,textDecoration:(p=(w=t.xAxis)===null||w===void 0?void 0:w.axisLabel)===null||p===void 0?void 0:p.textDecoration,fontWeight:((T=(x=t.xAxis)===null||x===void 0?void 0:x.axisLabel)===null||T===void 0?void 0:T.fontWeight)||t.calculative.fontWeight,fontFamily:((I=(A=t.xAxis)===null||A===void 0?void 0:A.axisLabel)===null||I===void 0?void 0:I.fontFamily)||t.calculative.fontFamily,fontSize:((z=(R=t.xAxis)===null||R===void 0?void 0:R.axisLabel)===null||z===void 0?void 0:z.fontSize)||t.calculative.fontSize,lineHeight:((_=(U=t.xAxis)===null||U===void 0?void 0:U.axisLabel)===null||_===void 0?void 0:_.lineHeight)||t.calculative.lineHeight};e.font=qt(C),e.fillStyle=((S=(k=t.xAxis)===null||k===void 0?void 0:k.axisLabel)===null||S===void 0?void 0:S.fontColor)||t.calculative.color,e.fillText(X[j],b,B+H+10*L),e.fill()}return e.closePath(),e.setLineDash([]),{dash:q,normalizedOption:V}}function kH(e,t){if(!isNaN(e))return Math.round(Number(e)*1e3)/1e3}var Va;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(Va||(Va={}));var Wn=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},Un=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function _H(e,t){t.onBeforeValue||(t.onBeforeValue=Ww);var r=t.calculative.worldRect.x,a=t.calculative.worldRect.y;t.calculative.worldRect.width;var i=t.calculative.worldRect.height,o=t.calculative.canvas.store.data.scale,n=[];t.echarts&&!t.echarts.option.color&&(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]);var s=Hw(e,t),u=s.dash,c=s.normalizedOption,l=!!(t.echarts?t.echarts.option.series[0].smooth:t.smooth),f=[];if(t.echarts)for(var h=0;h<t.echarts.option.series.length;h++)n.push(t.echarts.option.series[h].data);else n=t.data;for(var d=function(y){e.beginPath();var g=n[y];e.strokeStyle=t.echarts?t.echarts.option.color[y]:t.chartsColor[y],e.fillStyle=t.echarts?t.echarts.option.color[y]:t.chartsColor[y];var m=r+(1+u/2),w=a+i-(g[0]-c.min)/(c.max-c.min)*i;if(e.moveTo(m,w),f.push({x:m,y:w}),l)if(g.length<=2)for(var p=1;p<g.length;p++)m=r+(1+u/2)+(u+1)*p,w=a+i-(g[p]-c.min)/(c.max-c.min)*i,e.lineTo(m,w),f.push({x:m,y:w});else{var x,T,A,I;g.forEach(function(R,z){m=r+(1+u/2)+(u+1)*z,w=a+i-(g[z]-c.min)/(c.max-c.min)*i;var U=r+(1+u/2)+(u+1)*(z+1),_=a+i-(g[z+1]-c.min)/(c.max-c.min)*i,k=r+(1+u/2)+(u+1)*(z-1),S=a+i-(g[z-1]-c.min)/(c.max-c.min)*i,P=r+(1+u/2)+(u+1)*(z+2),B=a+i-(g[z+2]-c.min)/(c.max-c.min)*i;z===0?(k=r+(1+u/2)+(u+1)*z,S=a+i-(g[z]-c.min)/(c.max-c.min)*i):z===g.length-2&&(P=r+(1+u/2)+(u+1)*(z+1),B=a+i-(g[z+1]-c.min)/(c.max-c.min)*i),f.push({x:m,y:w}),x=m+(U-k)/4,T=w+(_-S)/4,A=U-(P-m)/4,I=_-(B-w)/4,e.bezierCurveTo(x,T,A,I,U,_)})}else for(var p=1;p<g.length;p++)m=r+(1+u/2)+(u+1)*p,w=a+i-(g[p]-c.min)/(c.max-c.min)*i,e.lineTo(m,w),f.push({x:m,y:w});e.stroke(),e.closePath(),e.save(),f.forEach(function(R,z){e.beginPath(),e.strokeStyle="#fff",e.lineWidth=2*o,e.arc(R.x,R.y,4*o,0,Math.PI*2),e.stroke(),e.fill(),e.closePath()}),e.restore(),f=[]},v=0;v<n.length;v++)d(v)}function Ww(e,t){if(t.xAxisData||t.data||!t.dataX&&!t.dataY)return t;var r=e.xAxisData,a=e.data,i=e.replaceMode,o=[],n=[];return i?i===Va.Replace?(t.dataX.forEach(function(s,u){var c=r.indexOf(s);a.forEach(function(l,f){l[c]=t.dataY[f][u]})}),o=r,n=a):i===Va.ReplaceAll&&(o=t.dataX,n=t.dataY):(o=Un(Un([],Wn(r),!1),Wn(t.dataX),!1),a.forEach(function(s,u){var c=Un(Un([],Wn(s),!1),Wn(t.dataY[u]),!1);n.push(c)})),delete t.dataX,delete t.dataY,Object.assign(t,{xAxisData:o,data:n})}var Sy=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),i,o=[],n;try{for(;(t===void 0||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},Ty=function(e,t,r){if(r||arguments.length===2)for(var a=0,i=t.length,o;a<i;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))};function SH(e,t){var r,a;t.onBeforeValue||(t.onBeforeValue=TH);var i=t.calculative.canvas.store.data.scale,o=t.calculative.worldRect.x,n=t.calculative.worldRect.y,s=t.calculative.worldRect.width,u=t.calculative.worldRect.height,c=!!t.echarts;t.echarts?(t.echarts.option.color||(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]),t.chartsColor=t.echarts.option.color):t.chartsColor||(t.chartsColor=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]);for(var l=c?t.echarts.option.series:t.data,f=0,h=function(y){var g=l[y],m=s/2;u<s&&(m=u/2);var w=o+s/2,p=n+u/2,x=0;c?x=g.data.reduce(function(U,_){return U+_.value},0):x=g.reduce(function(U,_){return U+_.value},0);var T=m*parseFloat(c?g.radius[0]:t.chartsRadius[y][0])/100,A=m*parseFloat(c?g.radius[1]:t.chartsRadius[y][1])/100;if(T>A)return{value:void 0};var I=0,R=0;e.strokeStyle=c&&((r=g.itemStyle)===null||r===void 0?void 0:r.borderColor)||"#fff",e.lineWidth=(c&&((a=g.itemStyle)===null||a===void 0?void 0:a.borderWidth)||2)*i;var z=c?g.data:g;z.forEach(function(U,_){var k,S,P,B,D,H,L,M,j,W,F,V,Y;R+=Math.PI*2*U.value/x,e.beginPath();var q=f+_;q>=t.chartsColor.length&&(q=q%t.chartsColor.length),e.fillStyle=c?t.echarts.option.color[q]:t.chartsColor[q],e.moveTo(w+T*Math.sin(R),p-T*Math.cos(R)),e.arc(w,p,T,-Math.PI/2+R,-Math.PI/2+I,!0),e.lineTo(w+A*Math.sin(I),p-A*Math.cos(I)),e.arc(w,p,A,-Math.PI/2+I,-Math.PI/2+R),e.lineTo(w+T*Math.sin(R),p-T*Math.cos(R)),e.stroke(),e.fill(),e.closePath();var Q=(I+R)/2,K=w+(A+10*i)*Math.sin(Q),X=p-(A+10*i)*Math.cos(Q),b=e.fillStyle;g.label||(g.label={position:"outside",show:!0}),c&&["inner","inside"].includes(g.label.position)?(e.fillStyle="#ffffff",K=w+(A-T)/2*Math.sin(Q),X=p-(A-T)/2*Math.cos(Q)):c&&g.label.position=="outside",g.labelLine||(g.labelLine={show:!0}),(c&&g.labelLine.show!==!1||!c)&&(e.beginPath(),e.strokeStyle=c?t.echarts.option.color[f+_]:t.chartsColor[f+_],e.moveTo(w+A*Math.sin(Q),p-A*Math.cos(Q)),e.lineTo(K,X));var C={fontStyle:((k=t.tickLabel)===null||k===void 0?void 0:k.fontStyle)||t.calculative.fontStyle,fontWeight:((S=t.tickLabel)===null||S===void 0?void 0:S.fontWeight)||t.calculative.fontWeight,fontFamily:((P=t.tickLabel)===null||P===void 0?void 0:P.fontFamily)||t.calculative.fontFamily,lineHeight:((B=t.tickLabel)===null||B===void 0?void 0:B.lineHeight)||t.calculative.lineHeight,fontSize:(((D=t.tickLabel)===null||D===void 0?void 0:D.fontSize)||t.calculative.fontSize)*i};e.font=qt(C),e.textBaseline="middle",e.textAlign="center",Q>Math.PI?((c&&g.label.position==="outside"||!c)&&(e.textAlign="end"),(c&&g.labelLine.show!==!1||!c&&(!((M=(L=(H=t.tickLabel)===null||H===void 0?void 0:H.labelLine)===null||L===void 0?void 0:L.show)!==null&&M!==void 0)||M))&&e.lineTo(K-5*i,X),(c&&g.label.show!==!1||!c&&(!((W=(j=t.tickLabel)===null||j===void 0?void 0:j.show)!==null&&W!==void 0)||W))&&e.fillText(U.name,K-5*i,X)):((c&&g.label.position==="outside"||!c)&&(e.textAlign="start"),(c&&g.labelLine.show!==!1||!c)&&e.lineTo(K+5*i,X),(c&&g.label.show!==!1||!c&&(!((V=(F=t.tickLabel)===null||F===void 0?void 0:F.show)!==null&&V!==void 0)||V))&&e.fillText(U.name,K+5*i,X)),e.stroke(),e.closePath(),e.fillStyle=b,e.strokeStyle=c&&((Y=g.itemStyle)===null||Y===void 0?void 0:Y.borderColor)||"#fff",I=R}),f+=z.length},d=0;d<l.length;d++){var v=h(d);if(typeof v=="object")return v.value}}function TH(e,t){if(t.data||!t.dataX&&!t.dataY)return t;var r=e.data,a=e.replaceMode,i=[];return a?a===Va.Replace?(t.dataY.forEach(function(o,n){o.forEach(function(s,u){var c=r[n].filter(function(l){return l.name===s.name});c.length>0&&(c[0].value=s.value)})}),i=r):a===Va.ReplaceAll&&(i=t.dataY):r.forEach(function(o,n){var s=Ty(Ty([],Sy(o),!1),Sy(t.dataY[n]),!1);i.push(s)}),delete t.dataX,delete t.dataY,Object.assign(t,{data:i})}function AH(e,t){t.onBeforeValue||(t.onBeforeValue=Ww);var r=t.calculative.canvas.store.data.scale,a=t.calculative.worldRect.x,i=t.calculative.worldRect.y;t.calculative.worldRect.width;var o=t.calculative.worldRect.height,n=[];if(t.echarts&&!t.echarts.option.color&&(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]),t.echarts)for(var s=0;s<t.echarts.option.series.length;s++)n.push(t.echarts.option.series[s].data);else n=t.data;for(var u=Hw(e,t),c=u.dash,l=u.normalizedOption,f=c*4/5/n.length,h=0;h<n.length;h++){e.beginPath();var d=n[h];e.fillStyle=t.echarts?t.echarts.option.color[h]:t.chartsColor[h],e.strokeStyle="#ffffff",e.lineWidth=1*r;for(var v=0,y=0,g=0,s=0;s<d.length;s++)v=a+(1+.1*c)+(c+1)*s+f*h,g=(d[s]-l.min)/(l.max-l.min)*o,y=i+o-g,e.rect(v,y,f-1,g-1),e.stroke(),e.fill();e.closePath()}}var Ls=function(){return Ls=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Ls.apply(this,arguments)};function EH(e,t){var r,a,i,o,n,s,u,c,l,f,h,d,v,y;t.onAdd||(t.onAdd=PH,t.onDestroy=RH,t.onClick=IH,t.clockInterval&&(t.onDestroy(t),t.onAdd(t)));var g=t.calculative.worldRect.x,m=t.calculative.worldRect.y,w=t.calculative.worldRect.width,p=t.calculative.worldRect.height,x=t.calculative.canvas.store.data.scale,T={startAngle:225,endAngle:-45,min:0,max:100,splitNumber:10};if(t.echarts&&t.echarts.option){var A=t.echarts.option.series[0];t.startAngle=A.startAngle||T.startAngle,t.endAngle=A.endAngle||T.endAngle,t.min=A.min||T.min,t.max=A.max||T.max,t.axisLine=A.axisLine.lineStyle.color,t.unit=A.detail.formatter.replace("{value}",""),t.value=A.data[0].value,t.splitNumber=A.splitNumber||T.splitNumber}t=Ls(Ls({},T),t);var I=w>p?p/2*9/10:w/2*9/10,R=g+w/2,z=m+p/2,U=t.echarts?t.echarts.option.series[0].data[0].value:t.value,_,k=t.startAngle-t.endAngle,S=t.background||"#E6EBF8";e.strokeStyle=S;var P=I/10;e.lineWidth=P,e.beginPath(),e.lineCap="round",e.arc(R,z,I,-t.startAngle/180*Math.PI,-t.endAngle/180*Math.PI),e.stroke(),e.closePath();var B=0;if(t.axisLine&&!t.isClock)for(var D=t.axisLine.length-1;D>=0;D--)t.axisLine[D][0]*(t.max-t.min)<U?B=t.axisLine[D][0]:(B=(U-t.min)/(t.max-t.min),_=t.axisLine[D][1]),e.beginPath(),e.strokeStyle=t.axisLine[D][1],e.arc(R,z,I,-t.startAngle/180*Math.PI,(-t.startAngle+B*k)/180*Math.PI),e.stroke(),e.closePath();e.lineCap="butt";var H=2*x,L=I-P;L<0&&(L=0);var M=k/180*Math.PI*L,j=(M-H*t.splitNumber)/t.splitNumber,W=k/180*Math.PI*H/2/M;e.beginPath(),e.strokeStyle=t.color||"#999999",e.lineWidth=I/20,e.setLineDash([H,j]),e.arc(R,z,L,-t.startAngle/180*Math.PI-W,-t.endAngle/180*Math.PI+W),e.stroke(),e.closePath();var F=1*x,V=I-P;V<0&&(V=0);var Y=k/180*Math.PI*V,q=(Y-F*5*t.splitNumber)/5/t.splitNumber,Q=k/180*Math.PI*F/2/Y;e.beginPath(),e.strokeStyle=t.color||"#999999",e.lineWidth=I/40,e.setLineDash([F,q]),e.arc(R,z,V,-t.startAngle/180*Math.PI-Q,-t.endAngle/180*Math.PI+Q),e.stroke(),e.closePath(),e.beginPath();var K=t.max-t.min,X=K/t.splitNumber,b={fontStyle:((r=t.tickLabel)===null||r===void 0?void 0:r.fontStyle)||t.calculative.fontStyle,textDecoration:((a=t.tickLabel)===null||a===void 0?void 0:a.textDecoration)||t.textDecoration,fontWeight:((i=t.tickLabel)===null||i===void 0?void 0:i.fontWeight)||t.calculative.fontWeight,fontFamily:((o=t.tickLabel)===null||o===void 0?void 0:o.fontFamily)||t.calculative.fontFamily,fontSize:(((n=t.tickLabel)===null||n===void 0?void 0:n.fontSize)||t.calculative.fontSize)*x,lineHeight:((s=t.tickLabel)===null||s===void 0?void 0:s.lineHeight)||t.calculative.lineHeight};e.font=qt(b);for(var C=I-P-I/20,D=0;D<=t.splitNumber;D++)if(!(Math.abs(t.startAngle)+Math.abs(t.endAngle)===360&&D==0)){var E=t.startAngle-X*D/K*k,N=Math.cos(E/180*Math.PI),O=Math.sin(E/180*Math.PI);e.fillStyle=((u=t.tickLabel)===null||u===void 0?void 0:u.color)||"#999999",N>.02?e.textAlign="end":N<-.02?e.textAlign="start":e.textAlign="center",O>.02?e.textBaseline="top":O<-.02?e.textBaseline="bottom":e.textBaseline="middle",e.fillText(kH(X*D+t.min),R+C*N,z-C*O),e.fill()}e.closePath();var $=1,G=["value"];if(t.isClock&&($=3,G=["hourvalue","minutevalue","secondvalue"]),t.isClock)for(var D=0;D<$;D++){var Z=(t.startAngle-(t[G[D]]-t.min)/(t.max-t.min)*k)/180*Math.PI;D>0&&(Z=(t.startAngle-(t[G[D]]-t.min)/(t.max*5-t.min)*k)/180*Math.PI);var J=4/5*I;G[D]==="hourvalue"&&(J=3/5*I),G[D]==="minutevalue"&&(J=3.5/5*I);var ee=I*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=I/(D+1)/20,e.strokeStyle=t.color||"#999999",e.moveTo(R-ee*3*Math.cos(Z),z+ee*3*Math.sin(Z)),e.lineTo(R+J*Math.cos(Z),z-J*Math.sin(Z)),e.stroke()}else{var Z=(t.startAngle-(U-t.min)/(t.max-t.min)*k)/180*Math.PI,J=4/5*I,ee=I*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=2,e.fillStyle=_,e.moveTo(R-ee*3*Math.cos(Z),z+ee*3*Math.sin(Z)),e.lineTo(R+ee*Math.cos(Z-Math.PI/2),z-ee*Math.sin(Z-Math.PI/2)),e.lineTo(R+J*Math.cos(Z),z-J*Math.sin(Z)),e.lineTo(R+ee*Math.cos(Z+Math.PI/2),z-ee*Math.sin(Z+Math.PI/2)),e.lineTo(R-ee*3*Math.cos(Z),z+ee*3*Math.sin(Z)),e.fill()}e.beginPath(),e.textAlign="center",e.textBaseline="middle";var te={fontStyle:((c=t.titleLabel)===null||c===void 0?void 0:c.fontStyle)||t.calculative.fontStyle,textDecoration:((l=t.titleLabel)===null||l===void 0?void 0:l.textDecoration)||t.textDecoration,fontWeight:((f=t.titleLabel)===null||f===void 0?void 0:f.fontWeight)||t.calculative.fontWeight,fontFamily:((h=t.titleLabel)===null||h===void 0?void 0:h.fontFamily)||t.calculative.fontFamily,fontSize:(((d=t.titleLabel)===null||d===void 0?void 0:d.fontSize)||t.calculative.fontSize)*x,lineHeight:((v=t.titleLabel)===null||v===void 0?void 0:v.lineHeight)||t.calculative.lineHeight};e.font=qt(te),e.fillStyle=((y=t.titleLabel)===null||y===void 0?void 0:y.color)||_,t.isClock?e.fillText(("0"+parseInt(t.hourvalue)).slice(-2)+":"+("0"+parseInt(t.minutevalue)).slice(-2)+":"+("0"+parseInt(t.secondvalue)).slice(-2),R,z+I/2):e.fillText(U+" "+(t.unit||""),R,z+I/2),e.fill(),t.isClock&&(e.beginPath(),e.fillStyle=t.color||"#999999",e.strokeStyle="#ffffff",e.arc(R,z,I/20,0,Math.PI*2),e.stroke(),e.fill(),e.closePath())}function PH(e){if(e.isClock)e.clockInterval=setInterval(function(){var r=new Date,a=r.getSeconds(),i=r.getMinutes()+a/60,o=r.getHours()%12+i/60;e.calculative.canvas.parent.setValue({id:e.id,hourvalue:o,minutevalue:i,secondvalue:a},{render:!0,doEvent:!1})},1e3);else{var t=e.value;e.value=0,e.frames=[{duration:2e3,value:t}],e.calculative.canvas.parent.startAnimate(e.id),setTimeout(function(){e.value=t},1e3)}}function RH(e){e.clockInterval&&(clearInterval(e.clockInterval),e.clockInterval=void 0)}function IH(e){e.isClock&&(e.onDestroy(e),e.onAdd(e))}function MH(){return{lineChart:_H,histogram:AH,pieChart:SH,gauge:EH}}function LH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s/6,c=n/4;if(r.moveTo(i+c*2,o+0),r.lineTo(i+c*2,o+u),r.moveTo(i,o+u+c*2),r.arc(i+c*2,o+u+c*2,c*2,Math.PI*1,Math.PI*2,!1),r.lineTo(i+c*4,o+u*5),r.lineTo(i,o+u*5),r.lineTo(i,o+u+c*2),r.moveTo(i+c,o+u*5),r.lineTo(i+c,o+u*6),r.moveTo(i+c*2,o+u*5),r.lineTo(i+c*2,o+u*6),r.moveTo(i+c*3,o+u*5),r.lineTo(i+c*3,o+u*6),r.closePath(),r instanceof Path2D)return r}function Ay(e){var t=[{x:.5,y:0},{x:.25,y:1},{x:.5,y:1},{x:.75,y:1}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function OH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s-n,c=.5*n;if(r.moveTo(i+n/2,o),r.lineTo(i+n/2,o+u),r.moveTo(i+n,o+c+u),r.arc(i+n/2,o+c+u,c,0,Math.PI*2,!1),r.closePath(),r instanceof Path2D)return r}function Ey(e){var t=[{x:.5,y:0},{x:.5,y:1}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function DH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s/2,c=n/5;if(r.moveTo(i,o+u),r.lineTo(i+c,o+u),r.moveTo(i+c*5,o+u),r.ellipse(i+c*3,o+u,2*c,u,0,0,Math.PI*2),r.closePath(),r instanceof Path2D)return r}function BH(e){var t=[{x:.6,y:0},{x:1,y:.5},{x:.6,y:1},{x:0,y:.5}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function FH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s/4,c=.5*n;if(r.moveTo(i+c,o),r.lineTo(i+c,o+u),r.moveTo(i,o+u),r.rect(i,o+u,c*2,u*2),r.moveTo(i+c,o+3*u),r.lineTo(i+c,o+4*u),r.closePath(),r instanceof Path2D)return r}function NH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s/8,c=.25*n;if(r.moveTo(i+c*2,o),r.lineTo(i+c*2,o+u*2),r.lineTo(i+c*3,o+u*3),r.lineTo(i+c*3,o+u*5),r.lineTo(i+c*2,o+u*6),r.lineTo(i+c*1,o+u*5),r.lineTo(i+c*1,o+u*3),r.lineTo(i+c*2,o+u*2),r.moveTo(i+c*3,o+u*4),r.lineTo(i+c*4,o+u*4),r.moveTo(i+c*2,o+u*6),r.lineTo(i+c*2,o+u*8),r.closePath(),r instanceof Path2D)return r}function $H(e){var t=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function jH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=n/2,c=s/10;if(r.moveTo(i+u,o),r.lineTo(i+u,o+c),r.moveTo(i+u,o+c),r.quadraticCurveTo(i+u*2,o+c,i+u*2,o+c*9),r.moveTo(i+u,o+c),r.quadraticCurveTo(i,o+c,i,o+c*9),r.quadraticCurveTo(i+u,o+c*6,i+u*2,o+c*9),r.moveTo(i+u,o+s*3/4),r.lineTo(i+u,o+s),r.moveTo(i+u*2/5,o+s*201/250),r.lineTo(i+u*2/5,o+s),r.moveTo(i+u*8/5,o+s*201/250),r.lineTo(i+u*8/5,o+s),r.closePath(),r instanceof Path2D)return r}function Py(e){var t=[{x:.5,y:0},{x:.2,y:1},{x:.5,y:1},{x:.8,y:1}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function zH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s/6,c=n/4;if(r.moveTo(i+c*2,o+0),r.lineTo(i+c*2,o+u),r.moveTo(i,o+u+c*2),r.arc(i+c*2,o+u+c*2,c*2,Math.PI*1,Math.PI*2,!1),r.lineTo(i+c*4,o+u*5),r.lineTo(i,o+u*5),r.lineTo(i,o+u+c*2),r.moveTo(i,o+u*5-u/3),r.lineTo(i+c*4,o+u*5-u/3),r.moveTo(i+c,o+u*5),r.lineTo(i+c,o+u*6),r.moveTo(i+c*2,o+u*5),r.lineTo(i+c*2,o+u*6),r.moveTo(i+c*3,o+u*5),r.lineTo(i+c*3,o+u*6),r.closePath(),r instanceof Path2D)return r}function HH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s/4,c=.5*n;if(r.moveTo(i+c,o),r.lineTo(i+c,o+u),r.lineTo(i+c*2,o+u*2),r.lineTo(i+c*2,o+u*4),r.lineTo(i,o+u*4),r.lineTo(i,o+u*2),r.lineTo(i+c,o+u),r.closePath(),r instanceof Path2D)return r}function WH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s/4,c=n/2;if(r.moveTo(i+c,o),r.lineTo(i+c,o+u),r.lineTo(i+c*2,o+u*4),r.lineTo(i,o+u*4),r.lineTo(i+c,o+u),r.closePath(),r instanceof Path2D)return r}function UH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=s/3,c=.5*n;if(r.moveTo(i+c,o),r.lineTo(i+c,o+u),r.lineTo(i+n,o+2*u),r.lineTo(i+c,o+s),r.lineTo(i,o+2*u),r.lineTo(i+c,o+u),r.closePath(),r instanceof Path2D)return r}function VH(e){var t=[{x:.5,y:0},{x:1,y:.6666666666666666},{x:.5,y:1},{x:0,y:.6666666666666666}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function qH(e,t){var r=t||new Path2D,a=e.calculative.worldRect,i=a.x,o=a.y,n=a.width,s=a.height,u=n/2,c=s/10;if(r.moveTo(i+u,o),r.lineTo(i+u,o+c),r.moveTo(i+u,o+c),r.quadraticCurveTo(i+u*2,o+c,i+u*2,o+c*9),r.moveTo(i+u,o+c),r.quadraticCurveTo(i,o+c,i,o+c*9),r.quadraticCurveTo(i+u,o+c*6,i+u*2,o+c*9),r.moveTo(i,o+c*10),r.quadraticCurveTo(i+u,o+c*7,i+u*2,o+c*10),r.moveTo(i+u*2/5,o+s*201/250+c),r.lineTo(i+u*2/5,o+s),r.moveTo(i+u*8/5,o+s*201/250+c),r.lineTo(i+u*8/5,o+s),r.closePath(),r instanceof Path2D)return r}function KH(e){var t=[{x:.5,y:0},{x:.2,y:1},{x:.8,y:1}];e.anchors=t.map(function(r,a){var i=r.x,o=r.y;return{id:""+a,penId:e.id,x:i,y:o}})}function YH(e,t){var r=t.calculative.worldRect,a=r.x,i=r.y,o=r.width,n=r.height,s=o/2,u=n/10;e.beginPath(),e.moveTo(a+s,i),e.lineTo(a+s,i+u),e.moveTo(a+s,i+u),e.quadraticCurveTo(a+s*2,i+u,a+s*2,i+u*9),e.moveTo(a+s,i+u),e.quadraticCurveTo(a,i+u,a,i+u*9),e.quadraticCurveTo(a+s,i+u*6,a+s*2,i+u*9),e.moveTo(a+s,i+n*3/4),e.lineTo(a+s,i+n*9/10),e.moveTo(a+s*2/5,i+n*201/250),e.lineTo(a+s*2/5,i+n*9/10),e.moveTo(a+s*8/5,i+n*201/250),e.lineTo(a+s*8/5,i+n*9/10),e.stroke(),e.closePath(),e.beginPath();var c=s*2>u*10?u:s/5;e.fillStyle="#333333",e.font=c+"px Arial",e.textBaseline="bottom",e.textAlign="center",e.fillText("o",a+s,i+n),e.fillText("m",a+s*2/5,i+n),e.fillText("o",a+s*8/5,i+n),e.closePath()}function GH(){return{andGate:LH,basicEvent:OH,conditionalEvent:DH,event:FH,forbiddenGate:NH,orGate:jH,priorityAndGate:zH,switchEvent:HH,transferSymbol:WH,unexpandedEvent:UH,xorGate:qH}}function XH(){return{votingGate:YH}}function QH(){return{andGate:Ay,orGate:Py,priorityAndGate:Ay,votingGate:Py,xorGate:KH,forbiddenGate:$H,basicEvent:Ey,unexpandedEvent:VH,conditionalEvent:BH,transferSymbol:Ey}}function Uw({fontStyle:e="normal",textDecoration:t="normal",fontWeight:r="normal",fontSize:a=12,fontFamily:i="Arial",lineHeight:o=1}={}){return`${e} ${t} ${r} ${a}px/${o} ${i}`}function Vw(e,t,r,a,i){i&&(e.font=Uw(i));const{x:o,y:n}=r;for(let[s,u]of Object.entries(a))e[s]=u;e.fillText(t,o,n)}function Hr(e,t,r){const{x:a,y:i,r:o}=t,{startAngle:n=0,endAngle:s=2*Math.PI,strokeStyle:u,fillStyle:c}=r;e.arc(a,i,o,n,s),u&&(e.strokeStyle=u,e.stroke()),c&&(e.fillStyle=c,e.fill())}function Wr(e,t,r){const{x:a,y:i,w:o,h:n}=t,{strokeStyle:s,fillStyle:u,lineWidth:c=1}=r;e.lineWidth=c,u&&(e.fillStyle=u,e.fillRect(a,i,o,n)),s&&(e.strokeStyle=s,e.strokeRect(a,i,o,n))}function qa(e,t,r){const{x:a,y:i,centerX:o,centerY:n,x1:s,y1:u,r:c}=t,{strokeStyle:l,startAngle:f=0,endAngle:h=2*Math.PI,direction:d=!1,fillStyle:v,lineWidth:y=1}=r;e.moveTo(a,i),e.arc(o,n,c,f,h,d),e.lineTo(s,u),e.lineWidth=y,l&&(e.strokeStyle=l,e.stroke()),v&&(e.fillStyle=v,e.fill())}function JH(e,t){const{x:r,y:a,width:i,height:o}=t.calculative.worldRect,{fontStyle:n,fontWeight:s,fontSize:u,fontFamily:c}=t.calculative;let l=i/2<=o/6?i/2:o/6,f=l/2;const h=a+o-l-Math.cos(Math.asin(.5))*l,d=t.max||20,v=t.min||-20;return ZH(e,r,a,o,l,f,i,{strokeStyle:t.textColor||"#4583FF",min:t.min,max:t.max,fontSize:u,fontStyle:n,fontWeight:s,fontFamily:c}),tW(e,r,a,h,o,l,f,{strokeStyle:t.color,fillStyle:t.background}),e.beginPath(),eW(e,r,a,h,o,l,f,{value:t.value,min:v,max:d,background:t.background||"#FF5D3C33",activeBackground:t.activeBackground||"#FF5D3C"}),e.closePath(),!1}function ZH(e,t,r,a,i,o,n,s){const{min:u,max:c,strokeStyle:l,fontStyle:f,fontWeight:h,fontSize:d,fontFamily:v}=s;t+=o+i,r+=o;const y=(a-i-o-Math.sqrt(3)/2*i)/(c-u);e.fillStyle=l||"#FFFFFFB3",e.font=Uw({fontSize:d,fontStyle:f,fontWeight:h,fontFamily:v}),e.textBaseline="middle",e.textAlign="left";for(let g=c;g>=u;g--)e.beginPath(),e.moveTo(t,r),g%10==0?(e.lineWidth=2,e.lineTo(t+o,r),e.fillText(g,t+o+d/2,r)):(e.lineWidth=1,g%5==0?e.lineTo(t+o*2/3,r):e.lineTo(t+o/3,r)),r+=y,e.stroke()}function eW(e,t,r,a,i,o,n,s){let{background:u,activeBackground:c,value:l,min:f,max:h}=s;const d=.3*o,v=n-d,y=o-d,g=t+3*n-d,m=t+n+d;if(e.beginPath(),qa(e,{x:m,y:a,centerX:t+o,centerY:r+n,x1:g,y1:a,r:v},{startAngle:Math.PI,direction:!1}),l<f)Hr(e,{x:t+o,y:r+i-o,r:y},{fillStyle:u,startAngle:-1/3*Math.PI,endAngle:4/3*Math.PI}),e.closePath(),e.beginPath();else if(l<=h){const w=(l-f)/(h-f)*(a-r-n);e.fillStyle=u,e.fill(),e.closePath(),e.beginPath(),e.moveTo(m,a),e.lineTo(m,a-w),e.lineTo(g,a-w),e.lineTo(g,a)}Hr(e,{x:t+o,y:r+i-o,r:y},{fillStyle:c,startAngle:-1/3*Math.PI,endAngle:4/3*Math.PI}),e.closePath()}function tW(e,t,r,a,i,o,n,s){const{strokeStyle:u}=s;e.beginPath(),qa(e,{x:t+n,y:a,centerX:t+o,centerY:r+n,x1:t+3*n,y1:a,r:n},{strokeStyle:u,startAngle:Math.PI,direction:!1}),Hr(e,{x:t+o,y:r+i-o,r:o},{strokeStyle:u,startAngle:-1/3*Math.PI,endAngle:4/3*Math.PI}),e.closePath()}function rW(e,t){return aW(e,t),t.scaleShow&&oW(e,t),iW(e,t),!1}function iW(e,t){const r=t.calculative.worldRect.width>t.calculative.worldRect.height?t.calculative.worldRect.height:t.calculative.worldRect.width,a=t.calculative.worldRect.width>t.calculative.worldRect.height?t.calculative.worldRect.width:t.calculative.worldRect.height,i=Math.floor(r/2),o=t.calculative.lineWidth!==void 0?t.calculative.lineWidth:1;if(!o)return;let n=t.calculative.worldRect.x,s=t.calculative.worldRect.y;const u=i-o/2;e.lineWidth=o;let c,l;t.calculative.worldRect.width>t.calculative.worldRect.height?(c=n+a/2,l=s+i):t.calculative.worldRect.width<t.calculative.worldRect.height?(c=n+i,l=s+a/2):(c=n+i,l=s+i),e.beginPath(),e.moveTo(c+u,l),e.arc(c,l,u,0,2*Math.PI),e.stroke(),e.closePath()}function aW(e,t){const r=t.calculative.worldRect.width,a=t.calculative.worldRect.height,i=t.calculative.canvas.store.data.scale,o=t.calculative.lineWidth!==void 0?t.calculative.lineWidth:1,n=r>a?a-o*2-(t.distance||0)*i:r-o*2-(t.distance||0)*i,s=.1/(t.wAmplitude||2),u=t.hAmplitude||5;t.calculative.xOffset||(t.calculative.xOffset=0);const c=t.calculative.xOffset;t.calculative.xOffset+=.2,t.calculative.xOffset>10&&(t.calculative.xOffset=0);const l=t.calculative.value/100*n;let f=0,h=Math.abs(l-n/2),d=t.calculative.worldRect.x+r/2-Math.sqrt(n/2*(n/2)-h*h),v=t.calculative.worldRect.x+r/2+Math.sqrt(n/2*(n/2)-h*h);l/(n/2)>=1?f=Math.asin(h/(n/2)):f=-Math.asin(h/(n/2)),e.save(),e.arc(t.calculative.worldRect.x+r/2,t.calculative.worldRect.y+a/2,n/2,0,Math.PI*2),e.clip(),e.beginPath(),e.fillStyle=t.background,t.calculative.value>t.max&&(e.fillStyle=t.maxBackground||"#f5222d"),t.calculative.value<t.min&&(e.fillStyle=t.minBackground||"#52c41a"),e.arc(t.calculative.worldRect.x+r/2,t.calculative.worldRect.y+a/2,n/2,-f,Math.PI+f);for(let y=d+20/(v-d);y<v-20/(v-d);y+=20/(v-d)){const g=u*Math.sin((d+y)*s+c)+t.calculative.worldRect.y+a/2-l;e.lineTo(y,n/2+g)}e.fill(),e.closePath(),e.restore()}function oW(e,t){const r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.width,o=t.calculative.worldRect.height,n=i>o?i:o,s=i>o?o:i,u=Math.floor(s/2),c=7,l=s,f=t.max,h=t.min;let d,v,y,g,m,w,p=0;t.maxText||(t.maxText="max"),t.minText||(t.minText="min"),h&&(i>o?(d=Math.abs(a+(100-h)/100*l-(a+l/2)),v=Math.sqrt(Math.pow(u,2)-Math.pow(d,2)),y=u-v+r+n/2-s/2):(i<o,d=Math.abs(a+(100-h)/100*l-(a+l/2)),v=Math.sqrt(Math.pow(u,2)-Math.pow(d,2)),y=u-v+r)),f&&(i>o?(g=Math.abs(a+(100-f)/100*l-(a+l/2)),m=Math.sqrt(Math.pow(u,2)-Math.pow(g,2)),w=u-m+r+n/2-s/2):(i<o,g=Math.abs(a+(100-f)/100*l-(a+l/2)),m=Math.sqrt(Math.pow(u,2)-Math.pow(g,2)),w=u-m+r)),e.beginPath(),e.fillStyle="#000";let x=s/10;e.font=x+"px Arial",h&&f?y>w?(p=y-w,i>=o?(e.moveTo(y,a+(100-h)/100*l),e.lineTo(y-c-p,a+(100-h)/100*l),e.direction="rtl",e.fillText(t.minText,y-c-p,a+(100-h)/100*l+3),e.fillText(h,y-c-p,a+(100-h)/100*l+x),e.moveTo(w,a+(100-f)/100*l),e.lineTo(w-c,a+(100-f)/100*l),e.direction="rtl",e.fillText(t.maxText,w-c,a+(100-f)/100*l+3),e.fillText(f,w-c,a+(100-f)/100*l+x)):(e.moveTo(y,a+(100-h)/100*l+n/2-s/2),e.lineTo(y-c-p,a+(100-h)/100*l+n/2-s/2),e.direction="rtl",e.fillText(t.minText,y-c-p,a+(100-h)/100*l+n/2-s/2+3),e.fillText(h,y-c-p,a+(100-h)/100*l+n/2-s/2+x),e.moveTo(w,a+(100-f)/100*l+n/2-s/2),e.lineTo(w-c,a+(100-f)/100*l+n/2-s/2),e.direction="rtl",e.fillText(t.maxText,w-c,a+(100-f)/100*l+n/2-s/2+3),e.fillText(f,w-c,a+(100-f)/100*l+n/2-s/2+x))):(p=w-y,i>=o?(e.moveTo(y,a+(100-h)/100*l),e.lineTo(y-c,a+(100-h)/100*l),e.direction="rtl",e.fillText(t.minText,y-c,a+(100-h)/100*l+3),e.fillText(h,y-c,a+(100-h)/100*l+15),e.moveTo(w,a+(100-f)/100*l),e.lineTo(w-c-p,a+(100-f)/100*l),e.direction="rtl",e.fillText(t.maxText,w-c-p,a+(100-f)/100*l+3),e.fillText(f,w-c-p,a+(100-f)/100*l+15)):(e.moveTo(y,a+(100-h)/100*l+n/2-s/2),e.lineTo(y-c,a+(100-h)/100*l+n/2-s/2),e.direction="rtl",e.fillText(t.minText,y-c,a+(100-h)/100*l+n/2-s/2+3),e.fillText(h,y-c,a+(100-h)/100*l+n/2-s/2+x),e.moveTo(w,a+(100-f)/100*l+n/2-s/2),e.lineTo(w-c-p,a+(100-f)/100*l+n/2-s/2),e.direction="rtl",e.fillText(t.maxText,w-c-p,a+(100-f)/100*l+n/2-s/2+3),e.fillText(f,w-c-p,a+(100-f)/100*l+n/2-s/2+x))):h&&!f?i>=o?(e.moveTo(y,a+(100-h)/100*l),e.lineTo(y-c,a+(100-h)/100*l),e.direction="rtl",e.fillText(t.minText,y-c,a+(100-h)/100*l+3),e.fillText(h,y-c,a+(100-h)/100*l+15)):(e.moveTo(y,a+(100-h)/100*l+n/2-s/2),e.lineTo(y-c,a+(100-h)/100*l+n/2-s/2),e.direction="rtl",e.fillText(t.minText,y-c,a+(100-h)/100*l+n/2-s/2+3),e.fillText(h,y-c,a+(100-h)/100*l+n/2-s/2+x)):f&&!h&&(i>=o?(e.moveTo(w,a+(100-f)/100*l),e.lineTo(w-c,a+(100-f)/100*l),e.direction="rtl",e.fillText(t.maxText,w-c,a+(100-f)/100*l+3),e.fillText(f,w-c,a+(100-f)/100*l+15)):(e.moveTo(w,a+(100-f)/100*l+n/2-s/2),e.lineTo(w-c,a+(100-f)/100*l+n/2-s/2),e.direction="rtl",e.fillText(t.maxText,w-c,a+(100-f)/100*l+n/2-s/2+3),e.fillText(f,w-c,a+(100-f)/100*l+n/2-s/2+x))),e.stroke(),e.closePath()}function nW(e,t){const{x:r,y:a,width:i,height:o}=t.calculative.worldRect;t.checked=!0,isFinite(e.globalAlpha)&&e.globalAlpha;const n=t.checked?t.onColor:t.color,s=t.checked?t.onColor+"66":t.background,u=1/8*i;if(t.displayStatus===0){const c=.375*i,l=a+o-u;let f={x:r+u,y:l,centerX:r+i/2,centerY:a+c,r:c,x1:r+i-u,y1:l};e.beginPath(),qa(e,f,{strokeStyle:n,startAngle:Math.PI,endAngle:2*Math.PI,fillStyle:s}),e.closePath(),f.x+=u,f.x1-=u,f.r-=u,e.beginPath(),qa(e,f,{strokeStyle:n,startAngle:Math.PI,endAngle:2*Math.PI,fillStyle:s}),e.closePath(),Wr(e,{x:r,y:l,w:i,h:u},{strokeStyle:t.color,fillStyle:t.background})}else if(t.displayStatus===1)Wr(e,{x:r,y:a,w:i,h:o},{strokeStyle:n,fillStyle:s}),Wr(e,{x:r+u,y:a+u,w:i-2*u,h:o-2*u},{strokeStyle:n,fillStyle:s});else if(t.displayStatus===2){const c=i>o?o/2:i/2;Hr(e,{x:r+i/2,y:a+o/2,r:c},{strokeStyle:n,fillStyle:s}),e.beginPath(),Hr(e,{x:r+i/2,y:a+o/2,r:c-u},{strokeStyle:n,fillStyle:s})}return!1}function sW(e,t){const{x:r,y:a,width:i,height:o}=t.calculative.worldRect,n=i/o>.5?o/8:i/4,s=t.color,u=t.background,c=t.checked?t.onColor:t.offColor,l=t.checked?t.onColor+"66":t.offColor+"66",f=.3*i,h=.1*o;t.onClick||(t.onClick=lW),Wr(e,{x:r,y:a,w:i,h:13/16*o},{strokeStyle:s,fillStyle:u}),Wr(e,{x:r+f,y:a+h,w:i-2*f,h:13/16*o-h*3},{strokeStyle:s}),e.clearRect(r+f,a+h,i-2*f,13/16*o-h*3);const d={x:r+i*8/18,y:t.checked?a+o/32:a+o*25/64,w:i/9,h:o*23/64};return Wr(e,d,{strokeStyle:s,fillStyle:u}),Hr(e,{x:r+i/2,y:t.checked?d.y-n:d.y+d.h+n,r:n},{strokeStyle:c,fillStyle:l}),!1}function lW(e){e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function cW(e,t){const{x:r,y:a,width:i,height:o}=t.calculative.worldRect;let n=o;if(t.onClick||(t.onClick=fW),o>i&&(n=i),n=n*3/2,e.beginPath(),uW(e,t,r+i/2,a+o/2,6,n/4),e.closePath(),e.beginPath(),Hr(e,{x:r+i/2,y:a+o/2,r:n/8},{strokeStyle:t.color}),e.closePath(),e.beginPath(),t.checked){const s=t.onColor+"66"||"#58CC8466",u=t.onColor||"#58CC84",c={x:r+i/2+n/12,y:a+o/2-n/4+n/10.5,centerX:r+i/2,centerY:a+o/2,x1:r+i/2-n/12,y1:a+o/2-n/4+n/10.5,r:n/12};qa(e,c,{startAngle:0,endAngle:Math.PI,strokeStyle:u}),e.moveTo(r+i/2+n/8,a+o/2-n/4),Hr(e,{x:r+i/2,y:a+o/2-n/4,r:n/8},{fillStyle:s,strokeStyle:u})}else{const s=t.offColor+"66"||"#FF5D3C66",u=t.offColor||"#FF5D3C",c={x:r+i/2-n/12,y:a+o/2+n/4-n/10.5,centerX:r+i/2,centerY:a+o/2,x1:r+i/2+n/12,y1:a+o/2+n/4-n/10.5,r:n/12};qa(e,c,{startAngle:Math.PI,endAngle:2*Math.PI,strokeStyle:u}),e.moveTo(r+i/2+n/8,a+o/2+n/4),Hr(e,{x:r+i/2,y:a+o/2+n/4,r:n/8},{fillStyle:s,strokeStyle:u})}return!1}function uW(e,t,r,a,i,o){var n,s;for(s=Math.PI*2/i,e.save(),e.fillStyle=t.background,e.strokeStyle=t.color,e.lineWidth=1,e.translate(r,a),e.moveTo(-o,0),e.beginPath(),n=0;n<i;n++)e.rotate(s),e.lineTo(-o,0);e.closePath(),e.stroke(),e.fill(),e.restore()}function fW(e){e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}let ci=!1,be=0;function hW(e,t){t.onMouseMove||(t.onMouseMove=gW),mW(e,t),pW(e,t);const r=t.structure.ringArr;ci=!1,be=2*r[r.length-1].outerRingRadius,r.forEach((a,i)=>{a.type===0?wW(e,t,a.rotate,a.textProp,a.innerRingRadius,a.outerRingRadius,t.data[i]):a.type===2?dh(e,t,a.rotate,a.textProp,a.innerRingRadius,a.outerRingRadius,t.data[i]):a.type===3?xW(e,t,a.rotate,a.textProp,a.innerRingRadius,a.outerRingRadius,t.data[i]):a.type===4?CW(e,t,a.rotate,a.textProp,a.innerRingRadius,a.outerRingRadius,t.data[i]):bW(e,t,a.rotate,a.textProp,a.innerRingRadius,a.outerRingRadius,t.data[i])}),yW(e,t),vW(e,t),dW(e,t,t.calculative.note||"")}function dW(e,t,r){if(ci){const a={x:t.calculative.mouseX,y:t.calculative.mouseY};let i={background:"#FFFFEEee",fontSize:t.fontSize,fontColor:"#000000",color:"#A9A9A9",width:200,fontFamily:"楷体",lineHight:22};t.structure.note&&Object.assign(i,t.structure.note),e.save(),e.textAlign="start",e.textBaseline="bottom",e.font=(i.fontSize||t.fontSize)+"px "+(i.fontFamily||"楷体");const o=e.measureText(r).width,n=Math.ceil(o/i.width);e.beginPath(),e.fillStyle=i.background,e.strokeStyle=i.color,e.moveTo(a.x,a.y),e.rect(a.x-10,a.y,(o<i.width?o:i.width)+20,(n+.5)*(i.lineHight||22)),e.fill(),e.stroke(),e.beginPath(),e.fillStyle=i.fontColor;const s=i.width/(o/r.length);for(let u=0;u<n;u++)e.fillText(r.substring(u*s,(u+1)*s),a.x,a.y+(u+1)*(i.lineHight||22));e.restore()}}function vW(e,t){const{width:r,height:a,center:i}=t.calculative.worldRect,{x:o,y:n}=i;let s=r;a<r&&(s=a);const u=t.structure.lineArr;t.calculative.mouseAngle||(t.calculative.mouseAngle=0),u.forEach((c,l)=>{const f=c.radius/be*s;if(l===0){const h=t.calculative.mouseAngle/180*Math.PI+Math.PI/2,d=o+f*Math.cos(h),v=n+f*Math.sin(h),y=o+f*Math.cos(h+Math.PI),g=n+f*Math.sin(h+Math.PI);e.beginPath(),e.save(),e.lineWidth=c.lineWidth||1,e.strokeStyle=c.color||"#ff0000",e.moveTo(d,v),e.lineTo(y,g);const m=o-(f-2/be*s)*Math.cos(h-Math.PI/36),w=n-(f-2/be*s)*Math.sin(h-Math.PI/36),p=o-(f-2/be*s)*Math.cos(h+Math.PI/36),x=n-(f-2/be*s)*Math.sin(h+Math.PI/36);e.moveTo(m,w),e.lineTo(y,g),e.lineTo(p,x);const T=o-(f+1/be*s)*Math.cos(h-Math.PI/36+Math.PI),A=n-(f+1/be*s)*Math.sin(h-Math.PI/36+Math.PI),I=o-(f+1/be*s)*Math.cos(h+Math.PI/36+Math.PI),R=n-(f+1/be*s)*Math.sin(h+Math.PI/36+Math.PI);e.moveTo(T,A),e.lineTo(d,v),e.lineTo(I,R),e.closePath(),e.stroke(),e.restore()}else{const h=(t.calculative.mouseAngle+c.offsetRotate)/180*Math.PI+Math.PI/2,d=o+f*Math.cos(h),v=n+f*Math.sin(h);e.beginPath(),e.save(),e.lineWidth=c.lineWidth||1,e.strokeStyle=c.color,e.moveTo(d,v),e.lineTo(o,n),e.stroke(),e.restore()}})}function gW(e,t){if(!e.locked){const{width:r,height:a,center:i}=e.calculative.worldRect,{x:o,y:n}=i;let s=r;if(a<r&&(s=a),Math.sqrt((t.y-n)*(t.y-n)+(t.x-o)*(t.x-o))<s/2){const c=Math.atan((t.y-n)/(t.x-o))/Math.PI*180;let l=0;t.y>=n?c>0?l=c-90:l=90+c:c>0?l=c+90:l=c-90,e.calculative.mouseAngle=l}}e.calculative.mouseX=t.x,e.calculative.mouseY=t.y,e.calculative.canvas.render()}function yW(e,t){const{width:r,height:a,center:i}=t.calculative.worldRect,{x:o,y:n}=i;let s=r;a<r&&(s=a);const u=t.structure.dot,c=u.innerRadius/be*s,l=u.outerRadius/be*s,f=u.rotate/180*Math.PI+Math.PI/2,h=o+c*Math.cos(f),d=n+c*Math.sin(f),v=o+l*Math.cos(f),y=n+l*Math.sin(f);e.beginPath(),e.save(),e.lineWidth=u.lineWidth||1,e.strokeStyle=u.color||"#ff0000",e.moveTo(h,d),e.lineTo(v,y),e.stroke(),e.restore()}function pW(e,t){const{width:r,height:a,center:i}=t.calculative.worldRect,{x:o,y:n}=i;let s=r;a<r&&(s=a);const u=t.structure.arrow,c=u.radius/be*s,l=u.rotate/180*Math.PI+Math.PI/2,f=o+c*Math.cos(l),h=n+c*Math.sin(l),d=o-c*Math.cos(l),v=n-c*Math.sin(l),y=o-(c-.5/be*s)*Math.cos(l-Math.PI/18),g=n-(c-.5/be*s)*Math.sin(l-Math.PI/18),m=o-(c-.5/be*s)*Math.cos(l+Math.PI/18),w=n-(c-.5/be*s)*Math.sin(l+Math.PI/18);e.beginPath(),e.save(),e.strokeStyle=u.color||"#ff0000",e.lineWidth=u.lineWidth||1,e.moveTo(f,h),e.lineTo(d,v),e.moveTo(y,g),e.lineTo(d,v),e.lineTo(m,w),e.stroke(),e.restore()}function mW(e,t){const{x:r,y:a,width:i,height:o,center:n}=t.calculative.worldRect,{x:s,y:u}=n,c=t.watermark;if(c.img){let l=new Image;l.src=c.img,e.drawImage(l,r+(c.x||.4)*i,a+(c.y||.4)*o,(c.imgWidth||.2)*i,(c.imgHeight||.2)*o)}else e.beginPath(),e.textAlign="center",e.textBaseline="middle",e.font=(c.fontSize||t.fontSize)+"px "+(c.fontFamily||"楷体"),e.fillText(c.text||"乐吾乐",r+c.x*i||s,a+c.y*o||u)}function bW(e,t,r,a,i,o,n){const{width:s,height:u,center:c}=t.calculative.worldRect,{x:l,y:f}=c;let h=s;u<s&&(h=u),e.lineWidth=1;const d=i/be*h,v=o/be*h;e.beginPath(),e.arc(l,f,d,0,Math.PI*2),e.closePath(),e.stroke(),e.beginPath(),e.arc(l,f,v,0,Math.PI*2),e.closePath(),e.stroke(),n.forEach((y,g)=>{let m=0,w=360/y.length;const p=(o-i)/2;let x=(i+(y[0].radius||p))/be*h;y.forEach((T,A)=>{const I=(90+r+m)/180*Math.PI,R=I+(T.angle||y[0].angle||w)/180*Math.PI,z=l+v*Math.cos(I),U=f+v*Math.sin(I),_=l+d*Math.cos(R),k=f+d*Math.sin(R);let S=T.text.toString();g===0&&(e.fillStyle=T.background||"#ffffff00",e.beginPath(),e.moveTo(_,k),e.arc(l,f,d,R,I,!0),e.lineTo(z,U),e.arc(l,f,v,I,R,!1),e.closePath(),e.fill(),T.hasLine&&e.stroke()),e.fillStyle="#000000",e.textAlign="center",e.textBaseline="middle";const P=(T.fontSize||y[0].fontSize||n[0][0].fontSize||t.fontSize)*a/be/10*h;e.font=P+"px 楷体",n[0][A].background==="#1f1a17"&&(e.fillStyle="#ffffff");let B=0,D="",H=S.length===1?0:(I-R)/S.length,L=S.length===1?(I+R)/2:R+H/2;if(y[0].chartSize&&(H=-(y[0].chartSize/180)*Math.PI),y[0].startAngle&&(L=R-y[0].startAngle/180*Math.PI+H/2),T.chartSize&&(H=-(T.chartSize/180)*Math.PI),T.startAngle&&(L=R-T.startAngle/180*Math.PI+H/2),y[0].isSymbol||T.isSymbol){const M=l+x*Math.cos(L),j=f+x*Math.sin(L);let W=(i+(y[0].radius||p)-.2)/be*h,F=(i+(y[0].radius||p)+.2)/be*h;switch(e.save(),e.lineWidth=.1/be*h,e.lineCap="round",T.text){case 1:e.beginPath(),e.arc(l,f,W,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,W,L-H/8,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,x,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,x,L-H/8,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,F,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,F,L-H/8,L-H/2),e.stroke();break;case 2:e.beginPath(),e.arc(l,f,W,L+H/2,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,x,L+H/2,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,F,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,F,L-H/8,L-H/2),e.stroke();break;case 3:e.beginPath(),e.arc(l,f,W,L+H/2,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,x,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,x,L-H/8,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,F,L+H/2,L-H/2),e.stroke();break;case 4:e.beginPath(),e.arc(l,f,W,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,W,L-H/8,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,x,L+H/2,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,F,L+H/2,L-H/2),e.stroke();break;case 5:break;case 6:e.beginPath(),e.arc(l,f,W,L+H/2,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,x,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,x,L-H/8,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,F,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,F,L-H/8,L-H/2),e.stroke();break;case 7:e.beginPath(),e.arc(l,f,W,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,W,L-H/8,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,x,L+H/2,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,F,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,F,L-H/8,L-H/2),e.stroke();break;case 8:e.beginPath(),e.arc(l,f,W,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,W,L-H/8,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,x,L+H/2,L+H/8),e.stroke(),e.beginPath(),e.arc(l,f,x,L-H/8,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,F,L+H/2,L-H/2),e.stroke();break;case 9:e.beginPath(),e.arc(l,f,W,L+H/2,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,x,L+H/2,L-H/2),e.stroke(),e.beginPath(),e.arc(l,f,F,L+H/2,L-H/2),e.stroke();break}e.restore(),T.note&&Math.sqrt((t.calculative.mouseX-M)*(t.calculative.mouseX-M)+(t.calculative.mouseY-j)*(t.calculative.mouseY-j))<(F-W)/2&&!ci&&(t.calculative.note=T.note,ci=!0,t.calculative.canvas.render())}else for(;B<S.length;){D=S.charAt(B);const M=l+x*Math.cos(L),j=f+x*Math.sin(L);e.save(),e.beginPath(),e.translate(M,j),e.rotate(L-Math.PI/2),e.fillText(D,0,0),e.restore(),T.note&&!T.starsAngle&&Math.sqrt((t.calculative.mouseX-M)*(t.calculative.mouseX-M)+(t.calculative.mouseY-j)*(t.calculative.mouseY-j))<P/2&&!ci&&(ci=!0,t.calculative.note=T.note,t.calculative.canvas.render()),L+=H,B++}m+=T.angle||y[0].angle||w})})}function wW(e,t,r,a,i,o,n){const{width:s,height:u,center:c}=t.calculative.worldRect,{x:l,y:f}=c;let h=s;u<s&&(h=u),e.lineWidth=1;const d=i/be*h,v=o/be*h;e.beginPath(),e.arc(l,f,d,0,Math.PI*2),e.closePath(),e.stroke(),e.beginPath(),e.arc(l,f,v,0,Math.PI*2),e.closePath(),e.stroke(),n.forEach((y,g)=>{let m=JSON.parse(JSON.stringify(y));m.sort(function(A,I){return A.starAngle-I.starAngle});const w=(o-i)/2;let p=(i+(y[0].radius||w))/be*h,x=-720,T=y[0].chartSize||5;m.forEach((A,I)=>{const R={lineWidth:1,color:"#000",length:.3};Object.assign(R,y[0],A),A.starAngle-T>x?x=A.starAngle:x=x+=T;let z=(90+A.starAngle)/180*Math.PI,U=(90+x)/180*Math.PI,_=l+p*Math.cos(U),k=f+p*Math.sin(U);const S=(A.fontSize||y[0].fontSize||n[0][0].fontSize||t.fontSize)*a/be/10*h;e.font=S+"px 楷体",e.save(),e.beginPath(),e.translate(_,k),e.rotate(U-Math.PI/2),e.fillText(A.text,0,0),e.restore(),e.save(),e.beginPath(),e.strokeStyle=R.color,e.lineWidth=R.lineWidth;const P=l+v*Math.cos(z),B=f+v*Math.sin(z),D=l+(v+R.length/be*h)*Math.cos(z),H=f+(v+R.length/be*h)*Math.sin(z),L=l+(p+v)/2*Math.cos(U),M=f+(p+v)/2*Math.sin(U);e.moveTo(D,H),e.lineTo(P,B),e.lineTo(L,M),e.stroke(),e.restore(),A.note&&Math.sqrt((t.calculative.mouseX-_)*(t.calculative.mouseX-_)+(t.calculative.mouseY-k)*(t.calculative.mouseY-k))<S/2&&!ci&&(ci=!0,t.calculative.note=A.note,t.calculative.canvas.render())})})}function dh(e,t,r,a,i,o,n){const{width:s,height:u,center:c}=t.calculative.worldRect,{x:l,y:f}=c;let h=s;u<s&&(h=u);const d=(90+r)/180*Math.PI,v=o/be*h;e.beginPath(),e.arc(l,f,v,0,Math.PI*2),e.closePath(),e.stroke(),n.forEach(y=>{let g=(i+y.length/2)/be*h,m=2*Math.PI*g,w=(m-360/y.angle)/(360/y.angle),p=.5/m*2*Math.PI;if(e.save(),e.beginPath(),e.lineWidth=y.length/be*h,e.setLineDash([1,w]),e.arc(l,f,g,d-p,2*Math.PI+d-p),e.stroke(),e.closePath(),e.restore(),y.hasDot||y.hasText){let x=(i+y.dotRadius)/be*h,T=(i+y.textRadius)/be*h,A=(y.max-y.min)/(360/y.angle);for(let I=0;I<360/y.angle;I++){let R=d+I*y.angle/180*Math.PI,z=l+x*Math.cos(R),U=f+x*Math.sin(R),_=l+T*Math.cos(R),k=f+T*Math.sin(R);y.hasDot&&(e.beginPath(),e.moveTo(z,U),e.arc(z,U,.1/be*h,0,Math.PI*2),e.fill()),y.hasText&&(e.save(),e.font=(y.fontSize||n[0].fontSize||t.fontSize)*a/be/10*h+"px 楷体",e.beginPath(),e.translate(_,k),e.rotate(R-Math.PI/2),e.fillText(A*I+"",0,0),e.restore())}}})}function xW(e,t,r,a,i,o,n){dh(e,t,r,a,i,o,[{angle:1,length:o-i}]);const{width:s,height:u,center:c}=t.calculative.worldRect,{x:l,y:f}=c;let h=s;u<s&&(h=u);const d=(o-i)/2;n.forEach((v,y)=>{let g=(90+r+.5)/180*Math.PI;v.forEach(m=>{e.font=(m.fontSize||v[0].fontSize||n[0][0].fontSize||t.fontSize)*a/be/10*h+"px 楷体";let w=(i+(v[0].radius||d))/be*h,p=m.angle;for(;p>0;){const x=l+w*Math.cos(g),T=f+w*Math.sin(g);p%2==1&&(e.save(),e.beginPath(),e.translate(x,T),e.rotate(g-Math.PI/2),e.fillText(p,0,0),e.restore()),g+=1/180*Math.PI,p--}})})}function CW(e,t,r,a,i,o,n){dh(e,t,r,a,i,o,[{angle:1,length:o-i}]);const{width:s,height:u,center:c}=t.calculative.worldRect,{x:l,y:f}=c;let h=s;u<s&&(h=u);const d=(o-i)/2;n.forEach((v,y)=>{let g=(90+r+.5)/180*Math.PI;v.forEach(m=>{e.font=(m.fontSize||v[0].fontSize||n[0][0].fontSize||t.fontSize)*a/be/10*h+"px 楷体";let w=(i+(v[0].radius||d))/be*h;m.angle;const p=l+w*Math.cos(g),x=f+w*Math.sin(g);let T="○";m.text==1&&(T="△"),m.text==2&&(T="×"),e.save(),e.beginPath(),e.translate(p,x),e.rotate(g-Math.PI/2),e.fillText(T,0,0),e.restore(),g+=1/180*Math.PI})})}const xt={};function kW(e,t){const r=t||new Path2D,{x:a,y:i,width:o,height:n}=e.calculative.worldRect;if(r.rect(a,i,o,n),e.id.indexOf("-moving")>0)return r instanceof Path2D?r:void 0;if(!e.onDestroy){{if(e.onDestroy=SW,e.onMove=Ry,e.onResize=Iy,e.onRotate=Ry,e.onBeforeValue=TW,e.onChangeId=AW,e.onStartVideo=qw,e.onPauseVideo=EW,e.onStopVideo=Kw,_W(e),!WebVideoCtrl)return e.text||(e.text="请先加载相关的海康视频js文件！",e.calculative.text=e.text,setTimeout(()=>{e.calculative.canvas.dirtyPenRect(e,{worldRectIsReady:!0})})),r instanceof Path2D?r:void 0;var s=WebVideoCtrl.I_CheckPluginInstall();if(s==-1)return e.text||(e.text="当前浏览器不支持视频，请使用最新的Chrome/Firefox/Edge浏览器！",e.calculative.text=e.text,setTimeout(()=>{e.calculative.canvas.dirtyPenRect(e,{worldRectIsReady:!0})})),r instanceof Path2D?r:void 0;console.info("WebVideoCtrl.I_CheckPluginInstall success"),WebVideoCtrl.I_InitPlugin("100%","100%",{iWndowType:e.iWndowType,bNoPlugin:!0,bDebugMode:!0,cbInitPluginComplete:()=>{console.info("WebVideoCtrl.I_InitPlugin success。视频窗口个数：",e.iWndowType),WebVideoCtrl.I_InsertOBJECTPlugin(e.id)===0?(console.info("WebVideoCtrl.I_InsertOBJECTPlugin（嵌入播放器） success"),WebVideoCtrl.I_Login(e.videoIp,+e.videoPrototocol,+e.videoPort,e.username,e.password,{success:c=>{e.calculative.logined=!0,console.info("初始化： WebVideoCtrl.I_Login success!",e.calculative.logined),WebVideoCtrl.I_StartRealPlay(e.videoIp+"_"+e.videoPort,{iRtspPort:554,iStreamType:1,iChannelID:1,bZeroChannel:!1,error:(l,f)=>{console.error(l===403?"设备不支持Websocket取流！":"海康视频预览失败！")}})},error:(c,l)=>{console.error("初始化：登录海康视频失败！",e.videoIp,+e.videoPrototocol,+e.videoPort,e.username,e.password,c,l)}}),setTimeout(()=>{Iy(e)},1e3)):(e.text="嵌入播放器失败！",e.calculative.text=e.text,setTimeout(()=>{e.calculative.canvas.updatePenRect(e,{worldRectIsReady:!0})}),console.error("WebVideoCtrl.I_InsertOBJECTPlugin（嵌入播放器） failed!",e))}})}if(r instanceof Path2D)return r}}function _W(e){var r;const t=e.calculative.worldRect;if(!xt[e.id]||!xt[e.id].div){const a=document.createElement("div");a.id=e.id,a.style.position="absolute",a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.style.width=t.width+"px",a.style.height=t.height+"px",xt[e.id]={div:a},(r=e.calculative.canvas.externalElements)==null||r.parentElement.appendChild(a),e.calculative.canvas.parent.setElemPosition(e,a)}}function SW(e){WebVideoCtrl.I_Stop({}),WebVideoCtrl.I_Logout(e.videoIp+"_"+e.videoPrototocol),xt[e.id].div.remove(),xt[e.id]=void 0}function Ry(e){xt[e.id]&&e.calculative.canvas.parent.setElemPosition(e,xt[e.id].div)}function Iy(e){if(!xt[e.id])return;const{width:t,height:r}=e.calculative.worldRect;e.calculative.canvas.parent.setElemPosition(e,xt[e.id].div),e.calculative.resizeTimer&&clearTimeout(e.calculative.resizeTimer),e.calculative.resizeTimer=setTimeout(()=>{WebVideoCtrl.I_Stop(),console.info("WebVideoCtrl resize",t,r,e.videoIp+"_"+e.videoPort),WebVideoCtrl.I_Resize(t,r),setTimeout(()=>{qw(e)},1e3),e.calculative.resizeTimer=void 0},100)}function TW(e,t){if(xt[e.id])return t.videoIp?(WebVideoCtrl.I_Logout(e.videoIp+"_"+e.videoPrototocol),WebVideoCtrl.I_Login(e.videoIp,+e.videoPrototocol,+e.videoPort,e.username,e.password,{success:r=>{e.calculative.logined=!0,console.info("值变化： WebVideoCtrl.I_Login success!",e.calculative.logined),WebVideoCtrl.I_StartRealPlay(e.videoIp+"_"+e.videoPort,{iRtspPort:554,iStreamType:1,iChannelID:1,bZeroChannel:!1,error:(a,i)=>{a===403?console.error("设备不支持Websocket取流！"):console.error("海康视频预览失败！",e.videoIp,+e.videoPrototocol,+e.videoPort,e.username,e.password)}})},error:(r,a)=>{console.error("值变化：登录海康视频失败！",e.videoIp,+e.videoPrototocol,+e.videoPort,e.username,e.password,r,a)}})):Kw(),e.calculative.canvas.parent.setElemPosition(e,xt[e.id].div),t}function AW(e,t,r){xt[t]&&(xt[r]=xt[t],delete xt[t])}function qw(e){if(!(!e.videoIp||!e.username||!e.password||e.calculative.logined===0)){if(!e.videoPort){e.videoPort=80;return}WebVideoCtrl.I_StartRealPlay(e.videoIp+"_"+e.videoPort,{iRtspPort:554,iStreamType:1,iChannelID:1,bZeroChannel:!1,error:(t,r)=>{console.error(t===403?"设备不支持Websocket取流！":"海康视频预览失败！")}})}}function EW(e){WebVideoCtrl.I_Stop({})}function Kw(e){WebVideoCtrl.I_Stop({})}function PW(e,t){const{x:r,y:a,width:i,height:o}=t.calculative.worldRect;let{fontStyle:n,fontWeight:s,fontSize:u,fontFamily:c,lineHeight:l}=t.calculative;const{value:f=0,max:h=20,min:d=-20}=t,v=i/6,{background:y="#FF5D3C33",activeBacground:g="#FF5D3C"}=t;let m;f<d?m=1:f>h?m=0:m=(h-f)/(h-d);const w=85/128*o,p=a+31/128*o;return Wr(e,{x:r,y:a,w:i,h:o},{strokeStyle:t.color||"#4583FF"}),Vw(e,"℃",{x:r+v,y:a+o/15},{fillStyle:t.textColor||"#FFFFFFB6",textAlign:"center",textBaseline:"top"},{fontStyle:n,fontWeight:s,fontSize:u,fontFamily:c,lineHeight:l}),Wr(e,{x:r+v,y:a+31/128*o,w:i/6,h:w*m},{fillStyle:y}),Wr(e,{x:r+v,y:p+w*m,w:i/6,h:w*(1-m)},{fillStyle:g}),RW(e,w,r+2*v,p,v,{max:h,min:d,fillStyle:t.textColor||"#FFFFFFB6",textAlign:"left",textBaseline:"middle"},{fontStyle:n,fontWeight:s,fontSize:u/2,fontFamily:c,lineHeight:l}),!1}function RW(e,t,r,a,i,o,n){let{max:s,min:u,fillStyle:c,textAlign:l,textBaseline:f}=o;const{fontSize:h}=n,d=t/(s-u);for(let v=s;v>=u;v--)e.beginPath(),e.moveTo(r,a),v%10==0?(e.lineWidth=2,e.lineTo(r+i,a),Vw(e,v,{x:r+i+h,y:a},{fillStyle:c,textAlign:l,textBaseline:f},n)):(e.lineWidth=1,v%5==0?e.lineTo(r+i*.75,a):e.lineTo(r+i*.5,a)),e.stroke(),e.closePath(),a+=d}function IW(e,t){t.onClick||(t.onClick=MW);const{x:r,y:a,width:i,height:o}=t.calculative.worldRect;return e.beginPath(),e.moveTo(r+10/180*i,a),e.strokeStyle=t.color,e.lineWidth=1,e.lineTo(r+170/180*i,a),e.lineTo(r+170/180*i,a+55/240*o),e.lineTo(r+10/180*i,a+55/240*o),e.lineTo(r+10/180*i,a),e.closePath(),e.fillStyle=t.background,e.fill(),e.stroke(),e.beginPath(),e.moveTo(r+42/180*i,a+28/240*o),e.arc(r+31/180*i,a+28/240*o,11/180*i,0,Math.PI*2),e.closePath(),e.moveTo(r+102/180*i,a+28/240*o),e.arc(r+91/180*i,a+28/240*o,11/180*i,0,Math.PI*2),e.closePath(),e.moveTo(r+162/180*i,a+28/240*o),e.arc(r+151/180*i,a+28/240*o,11/180*i,0,Math.PI*2),e.closePath(),e.stroke(),e.beginPath(),e.lineWidth=1,e.rect(r,a+55/240*o,60/180*i,130/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.lineWidth=1,e.rect(r+60/180*i,a+55/240*o,60/180*i,130/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.lineWidth=1,e.rect(r+120/180*i,a+55/240*o,60/180*i,130/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.moveTo(r+10/180*i,a+185/240*o),e.strokeStyle=t.color,e.lineWidth=1,e.lineTo(r+170/180*i,a+185/240*o),e.lineTo(r+170/180*i,a+240/240*o),e.lineTo(r+10/180*i,a+240/240*o),e.lineTo(r+10/180*i,a+185/240*o),e.closePath(),e.fillStyle=t.background,e.fill(),e.stroke(),e.beginPath(),e.moveTo(r+42/180*i,a+213/240*o),e.arc(r+31/180*i,a+213/240*o,11/180*i,0,Math.PI*2),e.closePath(),e.moveTo(r+102/180*i,a+213/240*o),e.arc(r+91/180*i,a+213/240*o,11/180*i,0,Math.PI*2),e.closePath(),e.moveTo(r+162/180*i,a+213/240*o),e.arc(r+151/180*i,a+213/240*o,11/180*i,0,Math.PI*2),e.closePath(),e.stroke(),t.switch?(e.beginPath(),e.strokeStyle=t.onColor||"#0AECA1",e.lineWidth=1,e.rect(r,a+120/240*o,180/180*i,12.5/240*o),e.closePath(),e.stroke(),e.fillStyle=t.onColor+"33"||"#0AECA173",e.fill(),e.beginPath(),e.rect(r+16/180*i,a+(120+12.5)/240*o,28/180*i,10/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+16/180*i,a+(120+12.5+10)/240*o,28/180*i,30/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+76/180*i,a+(120+12.5)/240*o,28/180*i,10/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+76/180*i,a+(120+12.5+10)/240*o,28/180*i,30/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+136/180*i,a+(120+12.5)/240*o,28/180*i,10/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+136/180*i,a+(120+12.5+10)/240*o,28/180*i,30/240*o),e.closePath(),e.stroke(),e.fill()):(e.beginPath(),e.strokeStyle=t.offColor||"#F53E6C",e.lineWidth=1,e.rect(r,a+(170+2.5)/240*o,180/180*i,12.5/240*o),e.closePath(),e.stroke(),e.fillStyle=t.offColor+"33"||"#F53E6C73",e.fill(),e.beginPath(),e.lineWidth=1,e.strokeStyle=t.color,e.moveTo(r,a+(120+12.5)/240*o),e.lineTo(r+180/180*i,a+(120+12.5)/240*o),e.stroke(),e.closePath(),e.beginPath(),e.lineWidth=1,e.strokeStyle="rgb(234,62,108)",e.rect(r+16/180*i,a+(120+12.5)/240*o,28/180*i,30/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+16/180*i,a+(120+12.5+30)/240*o,28/180*i,10/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+76/180*i,a+(120+12.5)/240*o,28/180*i,30/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+76/180*i,a+(120+12.5+30)/240*o,28/180*i,10/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+136/180*i,a+(120+12.5)/240*o,28/180*i,30/240*o),e.closePath(),e.stroke(),e.fill(),e.beginPath(),e.rect(r+136/180*i,a+(120+12.5+30)/240*o,28/180*i,10/240*o),e.closePath(),e.stroke(),e.fill()),!1}function MW(e){e.switch=!e.switch,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render()}function My(e,t){const{x:r,y:a,height:i,ex:o,ey:n}=t.calculative.worldRect,s=i/7;e.beginPath(),e.moveTo(r,n-s),e.bezierCurveTo(r,n-s*2.5|0,o,n-s*2.5|0,o,n-s),e.stroke();const u=(t.calculative.progress||0)*(i-2*s),c=n-s-u;return t.calculative.progress&&(e.save(),e.beginPath(),e.fillStyle=t.calculative.progressColor,e.moveTo(r,c),e.bezierCurveTo(r,c+s*3/2|0,o,c+s*3/2|0,o,c),e.lineTo(o,n-s),e.bezierCurveTo(o,n+s/2|0,r,n+s/2|0,r,n-s),e.closePath(),e.fill(),e.restore()),e.beginPath(),window.pSBC&&(e.fillStyle=window.pSBC(-.4,t.calculative.progressColor)),e.moveTo(r,c),e.bezierCurveTo(r,c-s*3/2|0,o,c-s*3/2|0,o,c),e.bezierCurveTo(o,c+s*3/2|0,r,c+s*3/2|0,r,c),e.closePath(),e.fill(),e.beginPath(),e.moveTo(r,a+s),e.bezierCurveTo(r,a-s/2|0,o,a-s/2|0,o,a+s),e.lineTo(o,n-s),e.bezierCurveTo(o,n+s/2|0,r,n+s/2|0,r,n-s),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(o,a+s),e.bezierCurveTo(o,a+s*2.5|0,r,a+s*2.5|0,r,a+s),e.stroke(),!1}function Yw(){return{hikVideo:kW}}function Gw(){return{thermometer:JH,watermeter:rW,indicatorLight:nW,toggleSwitch:cW,knifeSwitch:sW,compass:hW,thermometer1:PW,airSwitch:IW,waterTank:My,waterLevel:My}}const LW=setInterval(()=>{const e=globalThis.meta2d;e&&(e.register(Yw()),e.registerCanvasDraw(Gw()),clearInterval(LW))},1e3);globalThis.userDefinedDiagram=[{name:"特殊图元（企业）",show:!0,list:[{name:"海康威视摄像头",icon:"t-icon t-10",data:{name:"hikVideo",width:200,height:200,disableAnchor:!0,videoPrototocol:1,port:80,username:"admin",iWndowType:1,form:[{key:"videoPrototocol",name:"协议",type:"select",options:[{label:"HTTP",value:1},{label:"HTTPS",value:2}]},{key:"videoIp",name:"IP地址",type:"text"},{key:"videoPort",name:"Port端口",type:"text"},{key:"username",name:"用户名",type:"text"},{key:"password",name:"密码",type:"text"},{key:"iWndowType",name:"屏幕数",type:"number"}]}},{name:"温度计",icon:"t-icon t-wenduji",data:{name:"thermometer",width:100,height:300,disableAnchor:!0,background:"#F40",value:10,min:-20,max:20,form:[{key:"value",name:"温度",type:"number"},{key:"min",name:"最小值",type:"number"},{key:"max",name:"最大值",type:"number"}]}},{name:"温度计1",icon:"t-icon t-wenduji",data:{name:"thermometer1",width:200,height:300,disableAnchor:!0,backgroundColor:"#666",value:0,min:-20,max:20,markColor:"#fff",barrelColor:"#624",barrelShowColor:"#d26",fontColor:"#fff",sub:5,barrel:{x:.3,y:.2,width:.2,height:7/9},form:[{key:"value",name:"温度",type:"number"},{key:"min",name:"最小值",type:"number"},{key:"max",name:"最大值",type:"number"},{key:"backgroundColor",name:"背景颜色",type:"color"},{key:"markColor",name:"刻度颜色",type:"color"},{key:"barrelColor",name:"温度柱体背景颜色",type:"color"},{key:"barrelShowColor",name:"温度柱体高亮颜色",type:"color"},{key:"fontColor",name:"字体颜色",type:"color"},{key:"sub",name:"最小间隔",type:"number"}]}},{name:"水位",icon:"t-icon t-db",data:{name:"waterTank",width:100,height:100,disableAnchor:!0,color:"#FFFFFF00",progress:.5,progressColor:"#00a9e6",form:[{key:"progress",name:"进度",type:"number",step:.1,max:1,min:0},{key:"progressColor",name:"进度颜色",type:"color"}]}},{name:"水流检查器",icon:"t-icon t-shuiliujianceqi",data:{name:"watermeter",width:100,height:100,disableAnchor:!0,background:"#faad14",value:50,max:70,min:20,maxBackground:"#f5222d",minBackground:"#52c41a",scaleShow:!1,form:[{key:"value",name:"流量",type:"number"},{key:"max",name:"最大值",type:"number"},{key:"min",name:"最小值",type:"number"},{key:"maxBackground",name:"最大值背景",type:"color"},{key:"minBackground",name:"最小值背景",type:"color"},{key:"scaleShow",name:"显示刻度",type:"switch"},{key:"maxText",name:"最大值文字",type:"text"},{key:"minText",name:"最小值文字",type:"text"}]}},{name:"指示灯",icon:"t-icon t-tuxingzhishideng1",data:{name:"indicatorLight",width:100,height:100,displayStatus:0,background:"#5ac8f7",color:"#5ac8f7",hiddenText:!0,form:[{key:"displayStatus",name:"显示状态",type:"select",options:[{label:"默认",value:0},{label:"方形",value:1},{label:"圆形",value:2}]}],frames:[{background:"#f53e6c",color:"#f53e6c",bkType:0,duration:200,strokeType:0,visible:!0},{background:"#5ac8f7",color:"#5ac8f7",bkType:0,duration:200,strokeType:0,visible:!0}],animateType:"custom"}},{name:"闸刀",icon:"t-icon t-zhadao",data:{name:"knifeSwitch",width:100,height:100,switch:!1,color:"#0AECA140",background:"#748E9140",form:[{key:"switch",name:"开关",type:"switch"}],events:[{action:5,name:"click",value:"window.meta2d.setValue({id:pen.id,switch:!pen.switch});"}]}},{name:"拨动开关",icon:"t-icon t-bodongkaiguan",data:{name:"toggleSwitch",width:100,height:100,switch:!1,color:"#0AECA140",background:"#748E9140",form:[{key:"switch",name:"开关",type:"switch"}],events:[{action:5,name:"click",value:"window.meta2d.setValue({id:pen.id,switch:!pen.switch});window.meta2d.render()"}]}},{name:"空气开关",icon:"t-icon t-bodongkaiguan",data:{name:"airSwitch",width:180,height:240,switch:!0,color:"#748E9173",background:"#748E9140",form:[{key:"switch",name:"开关",type:"switch"}]}},{name:"天象星盘",icon:"t-icon t-baguatu",data:{name:"compass",width:500,height:500,hoverColor:"#000",activeColor:"#000",form:[{key:"data",name:"data",type:"code",language:"json",isNotString:!0}],structure:{ringArr:[{type:1,rotate:-22.5,textProp:.5,innerRingRadius:3,outerRingRadius:4.2},{type:1,rotate:-15,textProp:.7,innerRingRadius:4.2,outerRingRadius:5.3},{type:1,rotate:-15,textProp:.7,innerRingRadius:5.3,outerRingRadius:6.5},{type:0,rotate:-15,textProp:1,innerRingRadius:6.5,outerRingRadius:8},{type:2,rotate:-15,textProp:1,innerRingRadius:8,outerRingRadius:8.6},{type:1,rotate:-7.5,textProp:1.2,innerRingRadius:8.6,outerRingRadius:10.2},{type:1,rotate:0,textProp:.7,innerRingRadius:10.2,outerRingRadius:11.2},{type:1,rotate:0,textProp:.5,innerRingRadius:11.2,outerRingRadius:12.8},{type:3,rotate:-7,textProp:.25,innerRingRadius:12.8,outerRingRadius:13.2},{type:4,rotate:0,textProp:.25,innerRingRadius:13.2,outerRingRadius:13.6},{type:1,rotate:-7,textProp:.5,innerRingRadius:13.6,outerRingRadius:14.6},{type:1,rotate:-15,textProp:.4,innerRingRadius:14.6,outerRingRadius:16.3},{type:0,rotate:0,textProp:1,innerRingRadius:16.3,outerRingRadius:17.8},{type:2,rotate:0,textProp:.4,innerRingRadius:17.8,outerRingRadius:18.8}],arrow:{rotate:0,radius:3.8,color:"#ff0000"},dot:{color:"#ff0000",innerRadius:17.8,outerRadius:18.8,lineWidth:4,rotate:45},lineArr:[{radius:20,color:"#ff0000",lineWidth:10},{radius:20,color:"#00ff00",offsetRotate:30,lineWidth:10},{radius:20,color:"#00ff00",offsetRotate:-30},{radius:20,color:"#00ff00",offsetRotate:120},{radius:20,color:"#00ff00",offsetRotate:-120}],note:{background:"#FFFFEEee",fontColor:"#000000",color:"#A9A9A9",width:200,fontFamily:"楷体",lineHight:22}},data:[[[{text:"坎",hasLine:!0,startAngle:36,chartSize:7.5,note:"坎 注注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解注解解注解"},{text:"艮",hasLine:!0,note:"艮 注解注解"},{text:"震",hasLine:!0,radius:.6},{text:"巽",hasLine:!0,radius:.6},{text:"離",hasLine:!0,radius:.6},{text:"坤",hasLine:!0,radius:.6},{text:"兑",hasLine:!0,radius:.6},{text:"乾",hasLine:!0,radius:.6}],[{text:1,startAngle:9.5,chartSize:26,isSymbol:!0,fontSize:30,note:"1 符号注解注解注解"},{text:8,note:"8 符号注解注解注解"},{text:3},{text:4},{text:9},{text:2},{text:7},{text:6}]],[[{text:"子土",angle:30,hasLine:!0,background:"#fff305",note:"子解释解释解释"},{text:"丑土",angle:30,hasLine:!0,radius:.4,background:"#fff305"},{text:"寅木",angle:30,hasLine:!0,radius:.4,background:"#00923f"},{text:"卯火",angle:30,hasLine:!0,radius:.4,background:"#da251c"},{text:"辰金",angle:30,hasLine:!0,radius:.4,background:"#EB891A"},{text:"巳水",angle:30,hasLine:!0,radius:.4,background:"#1f1a17"},{text:"午日",angle:30,hasLine:!0,radius:.4,background:"#ffffff"},{text:"未月",angle:30,hasLine:!0,radius:.4,background:"#ffffff"},{text:"申水",angle:30,hasLine:!0,radius:.4,background:"#1f1a17"},{text:"酉金",angle:30,hasLine:!0,radius:.4,background:"#EB891A"},{text:"戌火",angle:30,hasLine:!0,radius:.4,background:"#da251c"},{text:"亥木",angle:30,hasLine:!0,radius:.4,background:"#00923f"}]],[[{text:"禄官",angle:30,hasLine:!0,radius:.6,note:"禄官 注解注解"},{text:"迁移",angle:30,hasLine:!0,radius:.6,note:"迁移 注解注解"},{text:"厄疾",angle:30,hasLine:!0,radius:.6},{text:"妻夫",angle:30,hasLine:!0,radius:.6},{text:"仆奴",angle:30,hasLine:!0,radius:.6},{text:"女男",angle:30,hasLine:!0,radius:.6},{text:"宅田",angle:30,hasLine:!0,radius:.6},{text:"弟兄",angle:30,hasLine:!0,radius:.6},{text:"帛财",angle:30,hasLine:!0,radius:.6},{text:"宫命",angle:30,hasLine:!0,radius:.6},{text:"貌相",angle:30,hasLine:!0,radius:.6},{text:"德福",angle:30,hasLine:!0,radius:.6}]],[[{text:"土",starAngle:-1,radius:.9,lineWidth:1,color:"#000",length:.3,chartSize:7,note:"土 注解"},{text:"日",starAngle:-5},{text:"火",starAngle:35},{text:"金",starAngle:32},{text:"水",starAngle:20},{text:"羅",starAngle:76},{text:"炁",starAngle:202},{text:"孛",starAngle:233},{text:"計",starAngle:257},{text:"月",starAngle:271},{text:"木",starAngle:336}]],[{angle:1,length:.3},{angle:5,length:.4},{angle:30,length:.6}],[[{text:"子",hasLine:!0,background:"#da251c",radius:.9},{text:"癸",hasLine:!0,background:"#da251c",radius:.9},{text:"丑",hasLine:!0,radius:.9},{text:"艮",hasLine:!0,background:"#da251c",radius:.9},{text:"寅",hasLine:!0,background:"#da251c",radius:.9},{text:"甲",hasLine:!0,background:"#da251c",radius:.9},{text:"卯",hasLine:!0,radius:.9},{text:"乙",hasLine:!0,background:"#da251c",radius:.9},{text:"辰",hasLine:!0,background:"#da251c",radius:.9},{text:"巽",hasLine:!0,radius:.9},{text:"巳",hasLine:!0,radius:.9},{text:"丙",hasLine:!0,radius:.9},{text:"午",hasLine:!0,background:"#da251c",radius:.9},{text:"丁",hasLine:!0,radius:.9},{text:"未",hasLine:!0,radius:.9},{text:"坤",background:"#da251c",hasLine:!0,radius:.9},{text:"申",background:"#da251c",hasLine:!0,radius:.9},{text:"庚",hasLine:!0,radius:.9},{text:"酉",hasLine:!0,radius:.9},{text:"辛",hasLine:!0,radius:.9},{text:"戌",background:"#da251c",hasLine:!0,radius:.9},{text:"乾",background:"#da251c",hasLine:!0,radius:.9},{text:"亥",hasLine:!0,radius:.9},{text:"壬",background:"#da251c",hasLine:!0,radius:.9}]],[[{text:"大寒",hasLine:!0,radius:.6},{text:"小寒",hasLine:!0,radius:.6},{text:"冬至",hasLine:!0,radius:.6},{text:"大雪",hasLine:!0,radius:.6},{text:"小雪",hasLine:!0,radius:.6},{text:"立冬",hasLine:!0,radius:.6},{text:"霜降",hasLine:!0,radius:.6},{text:"寒露",hasLine:!0,radius:.6},{text:"秋分",hasLine:!0,radius:.6},{text:"白露",hasLine:!0,radius:.6},{text:"處暑",hasLine:!0,radius:.6},{text:"立秋",hasLine:!0,radius:.6},{text:"大暑",hasLine:!0,radius:.6},{text:"小暑",hasLine:!0,radius:.6},{text:"夏至",hasLine:!0,radius:.6},{text:"芒穜",hasLine:!0,radius:.6},{text:"小满",hasLine:!0,radius:.6},{text:"立夏",hasLine:!0,radius:.6},{text:"毂雨",hasLine:!0,radius:.6},{text:"清明",hasLine:!0,radius:.6},{text:"春分",hasLine:!0,radius:.6},{text:"驚蛰",hasLine:!0,radius:.6},{text:"雨水",hasLine:!0,radius:.6},{text:"立春",hasLine:!0,radius:.6}]],[[{text:"复",hasLine:!0,radius:1.2,note:"复 注解 注解 注解"},{text:"颐",hasLine:!0,radius:1.2},{text:"屯",hasLine:!0,radius:1.2},{text:"益",hasLine:!0,radius:1.2},{text:"震",hasLine:!0,radius:1.2,background:"#da251c"},{text:"嗑",hasLine:!0,radius:1.2},{text:"随",hasLine:!0,radius:1.2},{text:"妄",hasLine:!0,radius:1.2},{text:"明",hasLine:!0,radius:1.2},{text:"贲",hasLine:!0,radius:1.2},{text:"既",hasLine:!0,radius:1.2},{text:"家",hasLine:!0,radius:1.2},{text:"丰",hasLine:!0,radius:1.2},{text:"离",hasLine:!0,radius:1.2,background:"#da251c"},{text:"革",hasLine:!0,radius:1.2},{text:"同",hasLine:!0,radius:1.2},{text:"临",hasLine:!0,radius:1.2},{text:"损",hasLine:!0,radius:1.2},{text:"节",hasLine:!0,radius:1.2},{text:"中",hasLine:!0,radius:1.2},{text:"归",hasLine:!0,radius:1.2},{text:"睽",hasLine:!0,radius:1.2},{text:"兑",hasLine:!0,radius:1.2,background:"#da251c"},{text:"履",hasLine:!0,radius:1.2},{text:"泰",hasLine:!0,radius:1.2},{text:"大畜",hasLine:!0,radius:1.2},{text:"需",hasLine:!0,radius:1.2},{text:"小畜",hasLine:!0,radius:1.2},{text:"壮",hasLine:!0,radius:1.2},{text:"有",hasLine:!0,radius:1.2},{text:"夬",hasLine:!0,radius:1.2},{text:"乾",hasLine:!0,radius:1.2,background:"#da251c"},{text:"姤",hasLine:!0,radius:1.2},{text:"大过",hasLine:!0,radius:1.2},{text:"鼎",hasLine:!0,radius:1.2},{text:"恒",hasLine:!0,radius:1.2},{text:"巽",hasLine:!0,radius:1.2,background:"#da251c"},{text:"井",hasLine:!0,radius:1.2},{text:"蛊",hasLine:!0,radius:1.2},{text:"申",hasLine:!0,radius:1.2},{text:"讼",hasLine:!0,radius:1.2},{text:"困",hasLine:!0,radius:1.2},{text:"未",hasLine:!0,radius:1.2},{text:"解",hasLine:!0,radius:1.2},{text:"涣",hasLine:!0,radius:1.2},{text:"坎",hasLine:!0,radius:1.2,background:"#da251c"},{text:"蒙",hasLine:!0,radius:1.2},{text:"师",hasLine:!0,radius:1.2},{text:"遁",hasLine:!0,radius:1.2},{text:"咸",hasLine:!0,radius:1.2},{text:"旅",hasLine:!0,radius:1.2},{text:"小过",hasLine:!0,radius:1.2},{text:"渐",hasLine:!0,radius:1.2},{text:"蹇",hasLine:!0,radius:1.2},{text:"艮",hasLine:!0,radius:1.2,background:"#da251c"},{text:"谦",hasLine:!0,radius:1.2},{text:"否",hasLine:!0,radius:1.2},{text:"萃",hasLine:!0,radius:1.2},{text:"晋",hasLine:!0,radius:1.2},{text:"豫",hasLine:!0,radius:1.2},{text:"观",hasLine:!0,radius:1.2},{text:"比",hasLine:!0,radius:1.2},{text:"剥",hasLine:!0,radius:1.2},{text:"坤",hasLine:!0,radius:1.2,background:"#da251c"}],[{text:1,radius:.4,angle:5.625,startAngle:3.625,chartSize:2,note:"1 注解 注解 注解"},{text:"6"},{text:"7"},{text:"2"},{text:8},{text:3},{text:4},{text:9},{text:1},{text:6},{text:7},{text:2},{text:8},{text:3},{text:4},{text:9},{text:1},{text:6},{text:7},{text:2},{text:8},{text:3},{text:4},{text:9},{text:1},{text:6},{text:7},{text:2},{text:8},{text:3},{text:4},{text:9},{text:9},{text:4},{text:3},{text:8},{text:2},{text:7},{text:6},{text:1},{text:9},{text:4},{text:3},{text:8},{text:2},{text:7},{text:6},{text:1},{text:9},{text:4},{text:3},{text:8},{text:2},{text:7},{text:6},{text:1},{text:9},{text:4},{text:3},{text:8},{text:2},{text:7},{text:6},{text:1}],[{text:1,radius:.4,startAngle:.5,chartSize:3,isSymbol:!0,note:"1 1 注解 注解 注解"},{text:6},{text:7},{text:2},{text:8},{text:3},{text:4},{text:9},{text:1},{text:6},{text:7},{text:2},{text:8},{text:3},{text:4},{text:9},{text:1},{text:6},{text:7},{text:2},{text:8},{text:3},{text:4},{text:9},{text:1},{text:6},{text:7},{text:2},{text:8},{text:3},{text:4},{text:9},{text:9},{text:4},{text:3},{text:8},{text:2},{text:7},{text:6},{text:1},{text:9},{text:4},{text:3},{text:8},{text:2},{text:7},{text:6},{text:1},{text:9},{text:4},{text:3},{text:8},{text:2},{text:7},{text:6},{text:1},{text:9},{text:4},{text:3},{text:8},{text:2},{text:7},{text:6},{text:1}]],[[{angle:11},{angle:8,radius:.35},{angle:24,radius:.35},{angle:9,radius:.35},{angle:15,radius:.35},{angle:8,radius:.35},{angle:5,radius:.35},{angle:18,radius:.35},{angle:11,radius:.35},{angle:11,radius:.35},{angle:13,radius:.35},{angle:17,radius:.35},{angle:18,radius:.35},{angle:8,radius:.35},{angle:17,radius:.35},{angle:5,radius:.35},{angle:31,radius:.35},{angle:11,radius:.35},{angle:1,radius:.35},{angle:15,radius:.35},{angle:9,radius:.35},{angle:12,radius:.35},{angle:13,radius:.35},{angle:11,radius:.35},{angle:13,radius:.35},{angle:16,radius:.35},{angle:20,radius:.35},{angle:10,radius:.35}]],[[{text:0,angle:1},{text:1,angle:1},{text:2,angle:1,radius:.35},{text:0,angle:1,radius:.35},{text:1,angle:1,radius:.35},{text:2,angle:1,radius:.35}]],[[{text:"女土十一度",hasLine:!0,angle:11,radius:.6},{text:"牛金八度",hasLine:!0,angle:8,radius:.6},{text:"斗木二十四度",hasLine:!0,angle:24,radius:.6},{text:"箕水九度",hasLine:!0,angle:9,radius:.6},{text:"尾火十五度",hasLine:!0,angle:15,radius:.6},{text:"心火八度",hasLine:!0,angle:8,radius:.6},{text:"?火五度",hasLine:!0,angle:5,radius:.6},{text:"氏土十八度",hasLine:!0,angle:18,radius:.6},{text:"亢金十一度",hasLine:!0,angle:11,radius:.6},{text:"角木十一度",hasLine:!0,angle:11,radius:.6},{text:"軫水十三度",hasLine:!0,angle:13,radius:.6},{text:"翼火十七度",hasLine:!0,angle:17,radius:.6},{text:"張火十八度",hasLine:!0,angle:18,radius:.6},{text:"星火八度",hasLine:!0,angle:8,radius:.6},{text:"柳土十七度",hasLine:!0,angle:17,radius:.6},{text:"鬼金五度",hasLine:!0,angle:5,radius:.6},{text:"井木三十一度",hasLine:!0,angle:31,radius:.6},{text:"参水十一度",hasLine:!0,angle:11,radius:.6},{text:"",hasLine:!0,angle:1,radius:.6},{text:"？火十五度",hasLine:!0,angle:15,radius:.6},{text:"昂火九度",hasLine:!0,angle:9,radius:.6},{text:"胃土十二度",hasLine:!0,angle:12,radius:.6},{text:"？金十三度",hasLine:!0,angle:13,radius:.6},{text:"奎木十一度",hasLine:!0,angle:11,radius:.6},{text:"壁水十三度",hasLine:!0,angle:13,radius:.6},{text:"室火十六度",hasLine:!0,angle:16,radius:.6},{text:"危火二十度",hasLine:!0,angle:20,radius:.6},{text:"虔火十度",hasLine:!0,angle:10,radius:.6}]],[[{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45,startAngle:10,chartSize:3},{text:"二狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45},{text:"刃狗耗受",hasLine:!0,angle:30,radius:.45}],[{text:"陽天天注",radius:1.35,startAngle:10,chartSize:3},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35},{text:"陽天天注",radius:1.35}],[{text:"死",radius:.9,startAngle:6,chartSize:4},{text:"墓",radius:.9},{text:"绝",radius:.9},{text:"胎",radius:.9},{text:"养",radius:.9},{text:"",radius:.9},{text:"",radius:.9},{text:"",radius:.9},{text:"",radius:.9},{text:"",radius:.9},{text:"衰",radius:.9},{text:"病",radius:.9}]],[[{text:"日",starAngle:-5,note:"日 注解"},{text:"土",starAngle:-1,radius:.9,lineWidth:1,color:"#000",length:.3,note:"土 注解"},{text:"火",starAngle:35,note:"火 注解"},{text:"金",starAngle:32,note:"金 注解"},{text:"水",starAngle:20,note:"水 注解"},{text:"羅",starAngle:76},{text:"炁",starAngle:202},{text:"孛",starAngle:233},{text:"計",starAngle:257},{text:"月",starAngle:271},{text:"木",starAngle:336}]],[{angle:1,length:.3},{angle:5,hasText:!0,textRadius:.75,hasDot:!0,dotRadius:.4,length:.3,min:0,max:360}]],watermark:{img:"http://t.le5le.com/img/logo.png",fontSize:"20",fontFamily:"宋体"}}}]}];const OW=/^[\t\n\f\r ]*([MLHVZCSQTAmlhvzcsqta])[\t\n\f\r ]*/,Ly=/^[01]/,Fe=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,DW=/^(([\t\n\f\r ]+,?[\t\n\f\r ]*)|(,[\t\n\f\r ]*))/,BW={M:[Fe,Fe],L:[Fe,Fe],H:[Fe],V:[Fe],Z:[],C:[Fe,Fe,Fe,Fe,Fe,Fe],S:[Fe,Fe,Fe,Fe],Q:[Fe,Fe,Fe,Fe],T:[Fe,Fe],A:[Fe,Fe,Fe,Ly,Ly,Fe,Fe]};function FW(e){let t=0;const r=[];for(;t<e.length;){const a=e.slice(t).match(OW);if(a!==null){const i=a[1];t+=a[0].length;const o=zW(i,e,t);t=o.cursor,r.push(...o.commands)}else throw new Error("malformed path (first error at "+t+")")}return{commands:r}}function Oy(e){let t=1/0,r=1/0,a=-1/0,i=-1/0;return WW(e),e.commands.forEach(o=>{o.worldPoints.forEach((n,s)=>{s%2===0?(n<t&&(t=n),n>a&&(a=n)):(n<r&&(r=n),n>i&&(i=n))})}),--t,--r,{x:t,y:r,ex:a,ey:i,width:a-t+1,height:i-r+1}}function NW(e,t,r){r==null&&(r=t),e.commands.forEach((a,i)=>{if(!(a.relative&&i))switch(a.key){case"A":case"a":a.values[5]+=t,a.values[6]+=r;break;case"V":case"v":a.values[0]+=r;break;default:a.values.forEach((o,n)=>{a.values[n]=o+(n%2===0?t:r)});break}})}function $W(e,t,r){r==null&&(r=t),e.commands.forEach(a=>{switch(a.key){case"A":case"a":const i=a.values[0],o=a.values[1],n=Math.PI*a.values[2]/180,s=Math.cos(n),u=Math.sin(n),c=o*o*r*r*s*s+i*i*r*r*u*u,l=2*t*r*s*u*(o*o-i*i),f=i*i*t*t*s*s+o*o*t*t*u*u,h=-(i*i*o*o*t*t*r*r),d=l*l-4*c*f,v=Math.sqrt((c-f)*(c-f)+l*l);a.values[2]=l!==0?Math.atan((f-c-v)/l)*180/Math.PI:c<f?0:90,a.values[0]=-Math.sqrt(2*d*h*(c+f+v))/d,a.values[1]=-Math.sqrt(2*d*h*(c+f-v))/d,a.values[5]*=t,a.values[6]*=r,a.values[4]=t*r>=0?a.values[4]:1-a.values[4];break;case"V":case"v":a.values[0]*=r;break;default:a.values.forEach((y,g)=>{a.values[g]=y*(g%2===0?t:r)});break}})}function jW(e){let t="";return e.commands.forEach(r=>{t+=r.key+" ",r.values.forEach(a=>{t+=a+" "})}),t}function zW(e,t,r){const a=BW[e.toUpperCase()],i=[];for(;r<=t.length;){const o={key:e,values:[]};for(const n of a){const s=t.slice(r).match(n);if(s!==null){o.values.push(+s[0]),r+=s[0].length;const u=t.slice(r).match(DW);u!==null&&(r+=u[0].length)}else{if(o.values.length===0)return{cursor:r,commands:i};throw new Error("malformed path (first error at "+r+")")}}if(o.relative=o.key.toUpperCase()!==o.key,i.push(o),a.length===0)return{cursor:r,commands:i};e==="m"&&(e="l"),e==="M"&&(e="L")}throw new Error("malformed path (first error at "+r+")")}function HW(e,t){const r=[];let a=e.relative&&t?{x:t.worldPoints[t.worldPoints.length-2],y:t.worldPoints[t.worldPoints.length-1]}:{x:0,y:0};for(let i=0;i<e.values.length-1;i+=2)r.push(a.x+e.values[i]),r.push(a.y+e.values[i+1]);e.worldPoints=r}function WW(e){let t,r=0,a=0;e.commands.forEach(i=>{switch(i.key){case"Z":case"z":i.worldPoints=[r,a];break;case"H":i.worldPoints=[i.values[0],t.worldPoints[t.worldPoints.length-1]];break;case"h":i.worldPoints=[i.values[0]+t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1]];break;case"V":i.worldPoints=[t.worldPoints[t.worldPoints.length-2],i.values[0]];break;case"v":i.worldPoints=[t.worldPoints[t.worldPoints.length-2],i.values[0]+t.worldPoints[t.worldPoints.length-1]];break;case"A":i.worldPoints=[t.worldPoints[t.worldPoints.length-2],i.values[0]+t.worldPoints[t.worldPoints.length-1]];break;default:HW(i,t);break}(i.key==="M"||i.key==="m"||i.key==="Z"||i.key==="z")&&(r=i.worldPoints[i.worldPoints.length-2],a=i.worldPoints[i.worldPoints.length-1]),t=i})}function UW(e){e.center||(e.center={}),e.center.x=e.x+e.width/2,e.center.y=e.y+e.height/2}function VW(e,t){t&&globalThis.html2canvas&&globalThis.html2canvas(t).then(function(r){const a=new Image;a.src=r.toDataURL("image/png",.1),a.src.length>10&&(e.calculative.img=a)})}function qW(e,t){if(!t)return;const r=e.calculative.canvas.store,a=e.calculative.worldRect;t.style.opacity=e.globalAlpha+"",t.style.position="absolute",t.style.outline="none",t.style.left=a.x+r.data.x+"px",t.style.top=a.y+r.data.y+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.style.display=e.calculative.inView!=!1?e.calculative.cssDisplay||"inline":"none",!e.calculative.rotate&&(e.calculative.rotate=0),t.style.transform=`rotate(${e.calculative.rotate}deg)`,e.calculative.rotate||(e.calculative.flipX&&(t.style.transform="rotateY(180deg)"),e.calculative.flipY&&(t.style.transform="rotateX(180deg)"),e.calculative.flipX&&e.calculative.flipY&&(t.style.transform="rotateZ(180deg)")),t.style.zIndex=e.calculative.zIndex!==void 0?e.calculative.zIndex+"":"5",e.calculative.zIndex>e.calculative.canvas.maxZindex&&(e.calculative.canvas.maxZindex=e.calculative.zIndex),e.locked===1||e.locked===2||r.data.locked?(t.style.userSelect="initial",t.style.pointerEvents="initial",e.name==="gif"&&(t.style.userSelect="none",t.style.pointerEvents="none")):(t.style.userSelect="none",t.style.pointerEvents="none")}function ye(e){e.calculative.singleton.div&&qW(e,e.calculative.singleton.div)}function aa(e){e.calculative.singleton.div&&VW(e,e.calculative.singleton.div)}function et({fontStyle:e="normal",textDecoration:t="normal",fontWeight:r="normal",fontSize:a=12,fontFamily:i="Arial",lineHeight:o=1}={}){return`${e} ${t} ${r} ${a}px/${o} ${i}`}function ji(e,t){const{textColor:r,color:a}=e.calculative,{data:i,options:o}=t;return r||a||i.textColor||i.color||o.textColor||o.color}function Zi(e){let t;const r=e.calculative.canvas.parent.store;return e.calculative.hover?t=e.hoverTextColor||e.hoverColor||r.options.hoverColor:e.calculative.active&&(t=e.activeTextColor||e.activeColor||r.options.activeColor),t||ji(e,r)}function Uu(e,t,r){const a=FW(e);let i=Oy(a);(i.width!==r.width||i.height!==r.height)&&$W(a,r.width/i.width,r.height/i.height),i=Oy(a),UW(i),NW(a,t.x-i.center.x,t.y-i.center.y);const o=jW(a);return new Path2D(o)}function Jt(e,t,r,a,i){i&&(typeof i=="string"?e.font=i:e.font=et(i));const{x:o,y:n}=r;for(let[s,u]of Object.entries(a))e[s]=u;e.fillText(t,o,n)}function Wt(e,t,r){const{x:a,y:i,r:o}=t,{startAngle:n=0,endAngle:s=2*Math.PI,strokeStyle:u,fillStyle:c,lineWidth:l}=r;e.arc(a,i,o,n,s),l&&(e.lineWidth=l),u&&(e.strokeStyle=u,e.stroke()),c&&(e.fillStyle=c,e.fill())}function ui(e,t,r){const{x:a,y:i,w:o,h:n}=t,{strokeStyle:s,fillStyle:u}=r;u&&(e.fillStyle=u,e.fillRect(a,i,o,n)),s&&(e.strokeStyle=s,e.strokeRect(a,i,o,n))}function Gi(e,t){const{shadowColor:r,blur:a}=t;e.shadowBlur=a,e.shadowColor=r}function yo(e,t){e.save(),e.fillStyle=t.color,e.textAlign="center",e.textBaseline="middle",e.font=et({fontWeight:t.fontWeight,fontFamily:t.iconFamily,fontSize:t.fontSize}),e.fillText(t.icon,t.x,t.y),e.restore()}function Pr(e,t){const{x:r,y:a,width:i,height:o}=t;return e.x>=r&&e.x<=r+i&&e.y>=a&&e.y<=a+o}function Os(e,t,r){if(e[t]!==e.calculative[t]||!e[t]||!e.calculative[r]){if(e.calculative[r]=void 0,e[t])if(navigator.userAgent.includes("Firefox")&&e[t].endsWith(".svg"))KW(e,t,r);else{const a=new Image;a.crossOrigin=e.crossOrigin==="undefined"?void 0:e.crossOrigin||"anonymous",a.src=e[t],a.onload=()=>{e.calculative[r]=a,e.calculative[r+"NaturalWidth"]=a.naturalWidth,e.calculative[r+"NaturalHeight"]=a.naturalHeight}}e.calculative[t]=e[t]}}function KW(e,t,r){const a=new Image,i=new XMLHttpRequest;i.open("GET",e[t],!0),i.onload=()=>{const s=new DOMParser().parseFromString(i.responseText,"text/xml").getElementsByTagName("svg")[0],{width:u,height:c}=e.calculative.worldRect;s.setAttribute("width",`${u}px`),s.setAttribute("height",`${c}px`);const f="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(new XMLSerializer().serializeToString(s))));a.src=f,a.onload=()=>{e.calculative[r]=a,e.calculative[r+"NaturalWidth"]=a.naturalWidth||e.iconWidth,e.calculative[r+"NaturalHeight"]=a.naturalHeight||e.iconHeight}},i.send()}var Vu=(e=>(e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll",e))(Vu||{});function YW(e,t){const r={x:(e.x-t.x)/t.width,y:(e.y-t.y)/t.height,width:e.width/t.width,height:e.height/t.height};return GW(r),r}function GW(e){e.ex=e.x+e.width,e.ey=e.y+e.height}function XW(e,t){var r;if(t.onDestroy||(t.onDestroy=JW,t.onMove=ye,t.onResize=ye,t.onRotate=ye,t.onValue=ZW,t.onScale=Fy,t.onMouseEnter=ye),t.calculative.singleton||(t.calculative.singleton={}),t.calculative.singleton.div)t.calculative.patchFlags&&ye(t);else{const a=document.createElement("div");if(t.calculative.cssDisplay="flex",a.setAttribute("style",`
    margin:0;
    position: relative;
    border-width: 1px;
    border-style: solid;
    padding: 0 4px;
    display: flex;
    align-items: center;
    overflow: hidden;`),a.style.position="absolute",a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.className=`le-div-${t.id} ${t.className||""}`,a.onmouseover=()=>{a.style.borderColor="#0052d9"},a.onmouseout=()=>{a.style.borderColor=t.color||"#4583FF"},t.prefix){let o='<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-lock-on"><path fill="currentColor" d="M6 10v1h4v-1H6z" fill-opacity="0.9"></path><path fill="currentColor" d="M4.5 5v1H3a.5.5 0 00-.5.5v7c0 .28.22.5.5.5h10a.5.5 0 00.5-.5v-7A.5.5 0 0013 6h-1.5V5a3.5 3.5 0 00-7 0zm6 1h-5V5a2.5 2.5 0 015 0v1zm-7 1h9v6h-9V7z" fill-opacity="0.9"></path></svg>';typeof t.prefix=="string"&&(o=t.prefix);const n=Dy(o);a.appendChild(n)}const i=Xw(t);if(a.appendChild(i),t.suffix){let o='<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-browse-off t-input__suffix-clear"><path fill="currentColor" d="M10.77 11.98l1.38 1.37.7-.7-9.7-9.7-.7.7 1.2 1.21a7.9 7.9 0 00-2.53 2.91L1 8l.12.23a7.72 7.72 0 009.65 3.75zM10 11.2A6.67 6.67 0 012.11 8c.56-1 1.34-1.83 2.26-2.43l1.08 1.09a2.88 2.88 0 003.9 3.9l.64.64zM6.21 7.42l2.37 2.37a1.88 1.88 0 01-2.37-2.37zM14.88 8.23L15 8l-.12-.23a7.73 7.73 0 00-9.35-3.86l.8.8A6.7 6.7 0 0113.9 8a6.87 6.87 0 01-2.02 2.26l.7.7a7.9 7.9 0 002.3-2.73z" fill-opacity="0.9"></path><path fill="currentColor" d="M10.88 8c0 .37-.07.73-.2 1.06l-.82-.82.02-.24a1.88 1.88 0 00-2.12-1.86l-.82-.82A2.87 2.87 0 0110.88 8z" fill-opacity="0.9"></path></svg>';typeof t.suffix=="string"&&(o=t.suffix);const n=Dy(o);n.dataset.off="false",n.onclick=s=>{if(t.suffixOff){const u=t.calculative.singleton.div;let c=2;t.prefix||(c=1);const l=u.childNodes[c];l.dataset.off==="false"?(l.dataset.off="true",l.previousSibling.type="text",By(l,t.suffixOff,'<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-browse t-input__suffix-clear"><path fill="currentColor" d="M10.88 8a2.88 2.88 0 11-5.76 0 2.88 2.88 0 015.76 0zm-1 0a1.88 1.88 0 10-3.76 0 1.88 1.88 0 003.76 0z" fill-opacity="0.9"></path><path fill="currentColor" d="M1.12 8.23A7.72 7.72 0 008 12.5c2.9 0 5.54-1.63 6.88-4.27L15 8l-.12-.23A7.73 7.73 0 008 3.5a7.74 7.74 0 00-6.88 4.27L1 8l.12.23zM8 11.5A6.73 6.73 0 012.11 8 6.73 6.73 0 0113.9 8 6.74 6.74 0 018 11.5z" fill-opacity="0.9"></path></svg>')):(l.dataset.off="false",l.previousSibling.type="password",By(l,t.suffix,'<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-browse-off t-input__suffix-clear"><path fill="currentColor" d="M10.77 11.98l1.38 1.37.7-.7-9.7-9.7-.7.7 1.2 1.21a7.9 7.9 0 00-2.53 2.91L1 8l.12.23a7.72 7.72 0 009.65 3.75zM10 11.2A6.67 6.67 0 012.11 8c.56-1 1.34-1.83 2.26-2.43l1.08 1.09a2.88 2.88 0 003.9 3.9l.64.64zM6.21 7.42l2.37 2.37a1.88 1.88 0 01-2.37-2.37zM14.88 8.23L15 8l-.12-.23a7.73 7.73 0 00-9.35-3.86l.8.8A6.7 6.7 0 0113.9 8a6.87 6.87 0 01-2.02 2.26l.7.7a7.9 7.9 0 002.3-2.73z" fill-opacity="0.9"></path><path fill="currentColor" d="M10.88 8c0 .37-.07.73-.2 1.06l-.82-.82.02-.24a1.88 1.88 0 00-2.12-1.86l-.82-.82A2.87 2.87 0 0110.88 8z" fill-opacity="0.9"></path></svg>'))}},a.appendChild(n)}t.calculative.singleton.div=a,setTimeout(()=>{aa(t)},1e3),(r=t.calculative.canvas.externalElements)==null||r.parentElement.appendChild(a),Qw(t),ye(t),Fy(t)}}function Xw(e){const t=document.createElement("input");return t.className=`le-input le-input-${e.id} ${e.className||""}`,t.setAttribute("style",` flex: 1;
      border: none;
      outline: none;
      padding: 0;
      max-width: 100%;
      min-width: 0;
      padding:4px;
      background-color: transparent;
      box-sizing: border-box;
      white-space: nowrap;
      word-wrap: normal;
      overflow: hidden;
      text-overflow: ellipsis;
      color:#FFFFFFD9;
      `),t.style.width="100%",t.style.height="100%",t.type=e.inputType||"text",t.placeholder=e.placeholder||"请输入",t.oninput=r=>{e.text=r.target.value,e.calculative.canvas.store.emitter.emit("input",e)},t}function Dy(e){const t=document.createElement("span");if(t.setAttribute("style",`    z-index: 2;
      height: 100%;
      text-align: center;
      display: flex;
      color:#4583FF;
      align-items: center;`),typeof e=="string"&&e.startsWith("<svg"))t.innerHTML=e;else{const r=document.createElement("i");r.className=e,t.appendChild(r)}return t}function QW(e,t,r){if(t=="false"){const a=e.firstChild;a.innerHTML=""}else{const a=e.firstChild;t=="true"?a.innerHTML='<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-lock-on"><path fill="currentColor" d="M6 10v1h4v-1H6z" fill-opacity="0.9"></path><path fill="currentColor" d="M4.5 5v1H3a.5.5 0 00-.5.5v7c0 .28.22.5.5.5h10a.5.5 0 00.5-.5v-7A.5.5 0 0013 6h-1.5V5a3.5 3.5 0 00-7 0zm6 1h-5V5a2.5 2.5 0 015 0v1zm-7 1h9v6h-9V7z" fill-opacity="0.9"></path></svg>':t.startsWith("<svg")?a.innerHTML=t:a.innerHTML=`<i class="${t}"></i>`}}function By(e,t,r){let a=r;if(typeof t=="string"&&(a=t),a.startsWith("<svg"))e.innerHTML=a;else{const i=document.createElement("i");i.className=a,e.innerHTML=null,e.appendChild(i)}}function Fy(e){const t=Array.from(e.calculative.singleton.div.childNodes);for(let r of t)r.style.zoom=e.calculative.canvas.parent.store.data.scale}function JW(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function ZW(e){Qw(e)}function Qw(e){if(e.calculative.singleton){const t=e.calculative.singleton.div;if(t){const r=e.calculative.worldRect;let a=e.calculative.borderRadius||0,i=e.calculative.borderRadius||0;const{width:o,height:n}=e;e.calculative.borderRadius<1&&(a=o*e.calculative.borderRadius,i=n*e.calculative.borderRadius);let s=a<i?a:i;t.style.width=r.width+"px",t.style.height=r.height+"px",t.style.borderRadius=(s||2)+"px",t.style.borderWidth=(e.lineWidth||0)+"px",t.style.background=e.background||"#181818",t.style.color=e.textColor||"#FFF",t.style.borderColor=e.color||"#dcdcdc",QW(t,String(e.prefix||!0),String(e.suffix||!0)),t.childNodes.forEach(u=>{u.localName==="input"?(u.type=e.inputType||"text",u.style.fontSize=(e.fontSize||12)+"px",u.placeholder=e.placeholder):u.style.color=e.iconColor})}}}const Jw='<svg class="t-fake-arrow" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" disabled="false"><path d="M3.75 5.7998L7.99274 10.0425L12.2361 5.79921" stroke="black" stroke-opacity="0.9" stroke-width="1.3"></path></svg>',Zw='<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em" class="t-icon t-icon-lock-on"><path fill="currentColor" d="M6 10v1h4v-1H6z" fill-opacity="0.9"></path><path fill="currentColor" d="M4.5 5v1H3a.5.5 0 00-.5.5v7c0 .28.22.5.5.5h10a.5.5 0 00.5-.5v-7A.5.5 0 0013 6h-1.5V5a3.5 3.5 0 00-7 0zm6 1h-5V5a2.5 2.5 0 015 0v1zm-7 1h9v6h-9V7z" fill-opacity="0.9"></path></svg>';function eU(e,t){var r;if(t.onDestroy||(t.onDestroy=t1,t.onMove=ye,t.onResize=ye,t.onRotate=ye,t.onBeforeValue=iU,t.onValue=aU,t.onScale=$y,t.onMouseEnter=ye),t.calculative.singleton||(t.calculative.singleton={}),t.calculative.singleton.div)t.calculative.patchFlags&&ye(t);else{const a=Xi("div",{style:`
        margin:0;
        position: relative;
        border-style: solid;
        padding: 0 4px;
        display: flex;
        align-items: center;
        `});t.calculative.cssDisplay="flex",a.style.borderWidth=(t.borderWidth||1)+"px",a.style.borderColor=t.borderColor||"#FFFFFF",a.style.position="absolute",a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.className=`le-div-${t.id} ${t.className||""}`,a.style.background=t.background||"#FFFFFF",a.onclick=n=>{n.stopPropagation()},Ny(t,t.prefix,a,Zw);const i=Xw(t);i.readOnly=!0,a.appendChild(i),Ny(t,t.suffix,a,Jw);const o=Xi("div",{style:`
      position:absolute;
      border-radius:10px;
      display:none;
      box-shadow :0 5px 5px -3px rgba(0, 0, 0, 0.1), 0 8px 10px 1px rgba(0, 0, 0, 0.06), 0 3px 14px 6px rgba(0, 0, 0, 0.05);
      padding:5px 15px;
      left:0;
      min-width:100%;
    `});a.appendChild(o),o.style.background=t.background||"#FFFFFF",e1(t.data,o,0,t,i,"none"),Ku(Array.from(o.childNodes),t,i),t.calculative.singleton.div=a,setTimeout(()=>{aa(t)},1e3),i.onclick=n=>{n.stopPropagation();const s=parseFloat(a.style.height);o.style.top=s+5+"px",o.style.display="block"},document.onclick=()=>{o.style.display=="block"&&(o.style.display="none"),qu({},!0,Array.from(o.childNodes)),cs("",Array.from(o.childNodes),!0)},(r=t.calculative.canvas.externalElements)==null||r.parentElement.appendChild(a),r1(t),ye(t),$y(t)}}function Ny(e,t,r,a){const i=Xi("span",{style:`z-index: 2;
      height: 100%;
      text-align: center;
      display: flex;
      color:#afafaf;
      align-items: center;`});if(t&&t!="false")if(t!=!0&&t!="true"&&(a=t),a.startsWith("<svg"))i.innerHTML=a;else{const o=Xi("i",{className:a});i.appendChild(o)}r.appendChild(i)}function Xi(e,t){const r=document.createElement(e);return t.style&&r.setAttribute("style",t.style),t.className&&(r.className=t.className),r}function $y(e){const t=Array.from(e.calculative.singleton.div.childNodes);for(let r of t)r.style.zoom=e.calculative.canvas.parent.store.data.scale}function e1(e,t,r,a,i,o){for(let n of e){const s=Xi("div",{style:`
      display: flex;
      flex-wrap: nowrap;
      margin-top:5px;
      `});s.dataset.fatherKey=o,s.dataset.key=n.key,t.appendChild(s);const u=Xi("i",{style:`
      margin-right:5px;
      width:15px;
      height:100%;
      transform-origin:center;
      transition:200ms;
    `}),c=Xi("span",{style:`
      line-height:22px;
      display:flex;
      align-items:center;
      flex:1;
      border-radius: 5px;
      cursor: pointer;
      white-space: nowrap;
      word-wrap: normal;
      overflow: hidden;
      text-overflow: ellipsis;
      padding:2px 20px 2px 4px;
      `});tU(c,a),o!="none"&&(s.style.display="none"),c.innerText=n.title,s.append(u,c),s.style.paddingLeft=r*20+"px",n.children&&n.children.length>0&&(u.className="t-icon t-triangle-right",e1(n.children,t,r+1,a,i,n.key)),u.onclick=l=>{l.stopPropagation(),cs(n.key,Array.from(t.childNodes),!1),qu(u,!1,Array.from(t.childNodes))},c.onclick=l=>{if(l.stopPropagation(),a.selectKey==s.dataset.key){Ku(Array.from(t.childNodes),a,i,c),cs(n.key,Array.from(t.childNodes),!1);return}else a.selectKey=s.dataset.key,a.selectedKeys=rU(Array.from(t.childNodes),s),Ku(Array.from(t.childNodes),a,i),t.style.display="none",cs(n.key,Array.from(t.childNodes),!0),qu(u,!0,Array.from(t.childNodes));a.calculative.canvas.store.emitter.emit("valueUpdate",a)}}}function qu(e,t,r){if(t){r.forEach(i=>{const o=i.firstChild;o.style.transform="rotate(0deg)"});return}!e.style.transform||e.style.transform=="rotate(0deg)"?e.style.transform="rotate(90deg)":e.style.transform="rotate(0deg)";const a=[e.parentElement.dataset.key];r.forEach(i=>{const o=i.firstChild;a.includes(i.dataset.fatherKey)&&(a.push(i.dataset.key),o.style.transform=="rotate(90deg)"&&(o.style.transform="rotate(0deg)"))})}function cs(e,t,r){if(r){for(let i of t)i.dataset.fatherKey!="none"&&(i.style.display="none");return}const a=[e];for(let i=0;i<t.length;i++)if(a.includes(t[i].dataset.fatherKey))if(t[i].style.display=="none")t[i].style.display="flex";else{t[i].style.display="none";for(let o=i;o<t.length;o++)t[o].dataset.fatherKey==t[i].dataset.key&&t[o].style.display=="flex"&&a.push(t[i].dataset.key)}}function tU(e,t){e.onmouseenter=()=>{t.selectKey!=e.parentElement.dataset.key&&(e.style.background=t.hoverBackground||"#F3F3F3")},e.onmouseleave=()=>{t.selectKey!=e.parentElement.dataset.key&&(e.style.background="transparent")}}function Ku(e,t,r,a){if(a){a.style.background="transparent",a.style.color=t.textColor||"#000000";return}for(let i of e)t.selectKey==i.dataset.key?(r.value=i.innerText,i.lastChild.style.background=t.activeBackground||"#F2F3FF"):i.lastChild.style.background="transparent"}function rU(e,t){const r=[];r.push(t.dataset.key);let a=t.dataset.fatherKey;for(;a!="none";)for(let i of e)if(a==i.dataset.key){r.push(a),a=i.dataset.fatherKey;break}return r}function t1(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div,document.onclick=null)}function iU(e,t){return t.data&&t1(e),t}function aU(e){r1(e)}function oU(e,t,r){t.forEach(a=>{r.selectKey==a.dataset.key&&(a.lastChild.style.background=e)})}function nU(e,t,r){if(!t||t=="false"){const a=e.firstChild;a.hasChildNodes()&&a.removeChild(a.firstChild)}else{const a=e.firstChild;t=="true"?a.innerHTML=Zw:t.startsWith("<svg")?a.innerHTML=t:a.innerHTML=`<i class="${t}"></i>`}if(r=="false"){const a=e.childNodes[2];a.hasChildNodes()&&a.removeChild(a.lastChild)}else{const a=e.childNodes[2];r=="true"?a.innerHTML=Jw:r.startsWith("<svg")?a.innerHTML=r:a.innerHTML=`<i class="${r}"></i>`}}function r1(e){if(e.calculative.singleton){const t=e.calculative.singleton.div;if(t){const r=e.calculative.worldRect;let a=e.calculative.borderRadius||0,i=e.calculative.borderRadius||0;const{width:o,height:n}=e;e.calculative.borderRadius<1&&(a=o*e.calculative.borderRadius,i=n*e.calculative.borderRadius);let s=a<i?a:i;t.style.width=r.width+"px",t.style.height=r.height+"px",t.style.borderRadius=(s||5)+"px",t.style.background=e.background||"#FFFFFF",t.lastChild.style.background=e.dropContentBgColor||e.background||"#FFFFFF",t.style.color=e.textColor,e.activeBackground&&oU(e.activeBackground,Array.from(t.lastChild.childNodes),e),nU(t,String(e.prefix||!0),String(e.suffix||!0)),t.lastChild.style.fontSize=(e.fontSize||12)+"px",t.childNodes.forEach(u=>{u.localName==="input"&&(u.type=e.inputType||"text",u.style.fontSize=(e.fontSize||12)+"px")})}}}const sU="#272C33",Zo="#FFFFFF99",i1="#FFFFFFFF";function lU(e,t){var r;if(t.onDestroy||(t.onDestroy=o1,t.onMove=ye,t.onResize=ye,t.onRotate=ye,t.onBeforeValue=uU,t.onValue=fU,t.onScale=zy,t.onMouseEnter=ye),t.calculative.singleton||(t.calculative.singleton={}),t.calculative.singleton.div)t.calculative.patchFlags&&ye(t);else{const a=document.createElement("div");t.calculative.cssDisplay="flex",a.setAttribute("style",`
      position:absolute;
      display: flex;
      user-select: none;
      padding:0 5px;
      z-index:999;
      `),a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.style.background=t.background||sU,a.style.color=t.textColor||Zo,a.style.borderRadius=(t.borderRadius||0)+"px",a.style.fontSize=(t.fontSize||16)+"px",a.className=`le-div-${t.id} ${t.className||""}`;const i=document.createElement("ul");a.appendChild(i),i.setAttribute("style",`
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin:0;
    padding:0;
    width:100%;`),Array.isArray(t.data)&&a1(t,i,t.data,1),t.calculative.singleton.div=a,(r=t.calculative.canvas.externalElements)==null||r.parentElement.appendChild(a),setTimeout(()=>{aa(t)},1e3),ye(t),zy(t)}}function a1(e,t,r,a){r.forEach((i,o)=>{const n=document.createElement("li");t.appendChild(n),n.dataset.key=i.key||o+"",n.setAttribute("style",`
      height:100%;
      flex-shrink:0;
      display:list-item;
      list-style: none;
      cursor: pointer;
      position: relative;
      padding: 0 20px;
      background-repeat: no-repeat;
      background-position: center;
      background-size: cover;
      justify-conten:center;
      box-sizing:border-box;
      `),n.style.borderRadius=(e.borderRadius||0)+"px";const s=document.createElement("div");n.appendChild(s),s.setAttribute("style",`
      height:100%;
      display:flex;
      align-items:center;
      border-style:solid;
      user-select:none;
      `),s.style.borderWidth=(e.borderWidth||0)+"px",s.style.borderColor=(e.borderColor||0)+"px";const u=document.createElement("i");s.appendChild(u);const c=document.createElement("i");s.appendChild(c),i.icon?(u.className=i.icon,u.style.fontSize=(e.iconSize||12)+"px"):a==2&&(u.style.width=(e.iconSize||12)+"px",u.style.height=(e.iconSize||12)+"px"),u.classList.add("icon"),a>1?(u.style.marginRight="5px",n.style.padding="5px"):(n.style.width=e.menuItemWidth+"px"||"auto",n.style.height=e.menuItemHeight+"px"||"auto",e.iconPosition==="left"?u.style.marginRight=(e.marginRight||5)+"px":s.style.flexDirection="column",e.menuItemBgImg&&(n.style.backgroundImage=`url(${e.menuItemBgImg})`));const l=document.createElement("span");if(l.setAttribute("style","white-space: nowrap;"),l.innerText=i.title,s.insertBefore(l,c),e.selectedKeys.includes(i.key)?(n.style.backgroundColor=e.activeBackground||"#4583FF33",n.style.color=e.activeColor||i1,n.style.border="2px solid #4583ff"):(n.style.backgroundColor="transparent",n.style.color=e.textColor||Zo,n.style.border="2px solid transparent"),i.children&&i.children.length>0&&e.renderSubMenu){const f=document.createElement("ul");n.appendChild(f),f.setAttribute("style",`
          box-sizing:content-box;
          padding:5px;
          transition:max-height 0.24 linear, width .24s linear,opacity .2s linear;
          display:none;
          position: absolute;
          list-style:none;
        `),a>1?(c.className="t-icon t-angle-right",c.setAttribute("style","padding-left:6px;"),f.style.left="100%",f.style.top="5%"):(f.style.left="-5px",f.style.top="100%"),jy(n,e,i,!1),f.style.background=e.dropContentBgColor||e.background||"#272C33",a1(e,f,i.children,a+1)}else a==2&&(c.style.width=(e.iconSize||20)+"px",c.style.height=(e.iconSize||20)+"px"),jy(n,e,i,!0),n.onclick=()=>{e.selectKey=i.key,cU(n,e),vh(e,Array.from(e.calculative.singleton.div.childNodes[0].childNodes)),e.calculative.canvas.store.emitter.emit("valueUpdate",e)}})}function cU(e,t){for(t.selectedKeys=[e.dataset.key];e.parentElement.parentElement.dataset.key;)t.selectedKeys.push(e.parentElement.parentElement.dataset.key),e=e.parentElement.parentElement}function uU(e,t){return(t.data||t.renderSubMenu)&&o1(e),t}function o1(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function jy(e,t,r,a){if(t.selectedKeys||(t.selectedKeys=[]),a)e.onmouseenter=()=>{t.selectedKeys.includes(r.key)||(e.style.backgroundColor=t.hoverBackground||"#4583FF33",e.style.color=t.hoverColor||Zo)},e.onmouseleave=()=>{t.selectedKeys.includes(r.key)||(e.style.color=t.textColor||Zo,e.style.backgroundColor="transparent")};else{const i=e.lastChild;e.onmouseenter=()=>{i.style.display="block",i.style.boxShadow="0 5px 5px -3px rgba(0, 0, 0, 0.1), 0 8px 10px 1px rgba(0, 0, 0, 0.06), 0 3px 14px 6px rgba(0, 0, 0, 0.05)"},e.onmouseleave=()=>{i.style.display="none",i.style.boxShadow="none"}}}function vh(e,t){t.forEach(r=>{e.selectedKeys.includes(r.dataset.key)?(r.style.backgroundColor=e.activeBackground||"#4583FF33",r.style.color=e.activeColor||i1,r.style.border="2px solid #4583ff"):(r.style.backgroundColor="transparent",r.style.color=e.textColor||Zo,r.style.border="2px solid transparent"),r.childNodes[1]&&r.childNodes[1].childNodes&&vh(e,Array.from(r.childNodes[1].childNodes))})}function zy(e){const t=Array.from(e.calculative.singleton.div.childNodes);for(let r of t)r.style.zoom=e.calculative.canvas.parent.store.data.scale}function fU(e){hU(e)}function hU(e){if(e.calculative.singleton){const t=e.calculative.singleton.div;if(t){const r=e.calculative.worldRect;let a=e.calculative.borderRadius||0,i=e.calculative.borderRadius||0;const{width:o,height:n}=e;e.calculative.borderRadius<1&&(a=o*e.calculative.borderRadius,i=n*e.calculative.borderRadius);let s=a<i?a:i;t.style.width=r.width+"px",t.style.height=r.height+"px",t.style.borderRadius=(s||0)+"px",t.style.background=e.background||"#272C33",t.lastChild.style.background=e.background||"#272C33",t.lastChild.style.fontSize=(e.fontSize||12)+"px",Array.from(document.getElementsByClassName("icon")).forEach(l=>{l.style.fontSize=(e.iconSize||12)+"px"}),t.style.fontSize=(e.iconSize||12)+"px";const c=Array.from(e.calculative.singleton.div.childNodes[0].childNodes);vh(e,Array.from(e.calculative.singleton.div.childNodes[0].childNodes)),c.forEach(l=>{l.style.backgroundImage=`url(${e.menuItemBgImg})`,l.style.width=e.menuItemWidth+"px"||"auto",l.style.height=e.menuItemHeight+"px"||"auto",l.firstChild.style.borderWidth=(e.borderWidth||0)+"px",l.firstChild.style.borderColor=e.borderColor||"#000",l.lastChild.tagName=="UL"&&(l.lastChild.style.background=e.dropContentBgColor||e.background||"#272C33"),e.iconPosition==="left"?(l.firstChild.firstChild.style.marginRight=(e.marginRight||5)+"px",l.firstChild.style.flexDirection="row"):l.firstChild.style.flexDirection="column"})}}}function dU(e,t){t.onDestroy||(t.onDestroy=l1,t.onMove=mU,t.onResize=pU,t.onBeforeValue=bU,t.onValue=wU,t.onScale=n1),t.calculative.singleton||(t.calculative.singleton={}),t.expandAll===void 0&&(t.expandAll=!0),t.calculative.singleton.div?t.calculative.patchFlags&&ye(t):vU(t)}function vU(e){var r;const t=document.createElement("div");t.setAttribute("style",`
  margin:0;
  position: relative;
  border-width: 0;
  border-style: solid;
  padding: 16px 8px;
  align-items: center;
  border-radius:6px;
  overflow: auto;`),t.style.background=e.background||"#272C33",t.style.position="absolute",t.style.outline="none",t.style.left="-9999px",t.style.top="-9999px",t.className=`le-div-${e.id} ${e.className||""}`,Array.isArray(e.data)&&t.appendChild(s1(e,e.data,[])),t.appendChild(gU(e)),e.calculative.singleton.div=t,(r=e.calculative.canvas.externalElements)==null||r.parentElement.appendChild(t),setTimeout(()=>{aa(e)},1e3),ye(e),n1(e)}function gU(e){const t=document.createElement("button"),r=document.createElement("i");return r.className="l-icon l-triangle-left",t.setAttribute("style",`
    position:fixed;
    left:10px;
    bottom:10px;
    border: 0px;
  `),t.style.color=e.textColor||"#FFFFFF99",t.appendChild(r),t.style.background="transparent",t.onmouseover=a=>{const i=e.calculative.singleton.div;i&&(i.childNodes[1].style.background=e.hoverBackground||"#4583FF33")},t.onmouseout=a=>{const i=e.calculative.singleton.div;i&&(i.childNodes[1].style.background="transparent")},t.onclick=a=>{e.expandAll?(e.expandAll=!1,e.oldWidth=e.calculative.canvas.parent.getPenRect(e).width):e.expandAll=!0,yU(e,e.expandAll),e.calculative.canvas.parent.setValue({id:e.id,width:e.expandAll?e.oldWidth:60},{history:!1,doEvent:!1,render:!1}),e.clickType="expand",e.calculative.canvas.store.emitter.emit("valueUpdate",e)},t}function n1(e){const t=Array.from(e.calculative.singleton.div.childNodes);for(let r of t)r.style.zoom=e.calculative.canvas.parent.store.data.scale}function s1(e,t,r){const a=document.createElement("ul");a.setAttribute("style",`
  padding:0;
  overflow:hidden;
  margin:0;
  line-height:22px;
  `);let i=[];return t.forEach((o,n)=>{const s=[...r];s.push(n);let u=s.join("-"),c=document.createElement("li");c.setAttribute("style",`
    display : list-item;
    list-style :none;
    white-space : nowrap;
    position :relative;
    `);let l=document.createElement("div");l.setAttribute("style",`
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    text-overflow: ellipsis;
    margin: 4px 0;
    padding: 0 10px 0 16px;
    height: 40px;
    line-height: 40px;
    border-bottom: 0;
    text-align: left;
    transition: background-color .28s cubic-bezier(.38,0,.24,1),padding .28s cubic-bezier(.38,0,.24,1);
    box-sizing: border-box;
    `),o.key||(o.key=u),l.style.color=e.textColor||"#FFFFFF99",l.style.fontSize=(e.fontSize||12)+"px",l.dataset.lekey=o.key,i.push(o.key),l.onmouseover=d=>{d.target.localName==="div"?e.selectedKeys&&e.selectedKeys.includes(d.target.dataset.lekey)||(d.target.style.background=e.hoverBackground||"#4583FF33"):e.selectedKeys&&e.selectedKeys.includes(d.target.parentElement.dataset.lekey)||(d.target.parentElement.style.background=e.hoverBackground||"#4583FF33")},l.onmouseout=d=>{d.target.localName==="div"?e.selectedKeys&&e.selectedKeys.includes(d.target.dataset.lekey)||(d.target.style.background="transparent"):e.selectedKeys&&e.selectedKeys.includes(d.target.parentElement.dataset.lekey)||(d.target.parentElement.style.background="transparent")};const f=document.createElement("i");f.className=o.icon||"t-icon t-04",f.setAttribute("style",`
      width:20px;
      height:100%;
      `),l.appendChild(f);const h=document.createElement("span");if(h.innerText=o.title,h.setAttribute("style",`
       margin-left:8px;
       overflow: hidden;
       text-overflow: ellipsis;
       white-space: nowrap;
    `),l.appendChild(h),o.children){const d=document.createElement("i");d.className="t-icon t-angle-top",d.setAttribute("style",`
        margin-left: auto;
        min-width: 16px;
      `),l.appendChild(d)}if(c.appendChild(l),o.children){let d=s1(e,o.children,s);o.childKeys=d.dataset.childKeys.split(","),o.childKeys&&Array.isArray(o.childKeys)&&i.push(...o.childKeys),c.appendChild(d)}o.show||(o.show=!0),o.children?l.onclick=d=>{e.expandAll&&(o.show?(o.show=!1,d.target.localName==="div"?(d.target.parentElement.childNodes[1].style.display="none",d.target.childNodes[2].className="t-icon t-angle-down"):(d.target.parentElement.parentElement.childNodes[1].style.display="none",d.target.parentElement.childNodes[2].className="t-icon t-angle-down")):(o.show=!0,d.target.localName==="div"?(d.target.parentElement.childNodes[1].style.display="inline",d.target.childNodes[2].className="t-icon t-angle-top"):(d.target.parentElement.parentElement.childNodes[1].style.display="inline",d.target.parentElement.childNodes[2].className="t-icon t-angle-top")))}:l.onclick=d=>{e.expandAll&&(e.selectedKeys=[o.key||u],e.selectKey=o.key,gh(e,e.calculative.singleton.div.childNodes[0].childNodes),e.clickType="select",e.calculative.canvas.store.emitter.emit("valueUpdate",e))},s.length===2&&(l.style.paddingLeft="37px"),s.length===3&&(l.style.paddingLeft="50px"),a.appendChild(c)}),a.dataset.childKeys=i.join(","),a}function gh(e,t){t.forEach(r=>{r.childNodes&&r.childNodes.length>1?gh(e,r.childNodes[1].childNodes):e.selectedKeys&&e.selectedKeys.includes(r.childNodes[0].dataset.lekey)?(r.childNodes[0].style.background=e.activeBackground||"#4583FF33",r.childNodes[0].style.color=e.activeTextColor||"#FFFFFFFF"):(r.childNodes[0].style.background="transparent",r.childNodes[0].style.color=e.textColor||"#FFFFFF99")})}function yU(e,t){let r=t?"inline":"none";e.calculative.singleton&&e.calculative.singleton.div.childNodes[0].childNodes.forEach((a,i)=>{a.childNodes[1]&&(a.childNodes[1].style.display=r),a.childNodes[0].childNodes[1]&&(a.childNodes[0].childNodes[1].style.display=r),a.childNodes[0].childNodes[2]&&(a.childNodes[0].childNodes[2].style.display=r),e.selectedKeys&&(e.data[i].childKeys&&e.data[i].childKeys.includes(e.selectedKeys[0])||e.selectedKeys.includes(e.data[i].key))&&(delete a.childNodes[0].style.background,delete a.childNodes[0].style.color,t?(a.style.background="transparent",a.style.color=e.textColor||"#FFFFFF99"):(a.style.background=e.activeBackground||"#4583FF33",a.style.color=e.activeColor||"#4583FF33"))})}function pU(e){ye(e)}function mU(e){ye(e)}function l1(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function bU(e,t){return t.data&&l1(e),t}function c1(e,t){e.forEach(r=>{r.firstChild.style.color=t.textColor,r.firstChild.style.fontSize=(t.fontSize||12)+"px",t.selectedKeys&&t.selectedKeys.includes(r.firstChild.dataset.lekey)&&(r.firstChild.style.background=t.activeBackground),r.lastChild.localName=="ul"&&c1(Array.from(r.lastChild.childNodes),t)})}function wU(e){xU(e)}function xU(e){if(e.calculative.singleton){const t=e.calculative.singleton.div;if(t){const r=e.calculative.worldRect;let a=e.calculative.borderRadius||0,i=e.calculative.borderRadius||0;const{width:o,height:n}=e;e.calculative.borderRadius<1&&(a=o*e.calculative.borderRadius,i=n*e.calculative.borderRadius);let s=a<i?a:i;t.style.width=r.width+"px",t.style.height=r.height+"px",t.style.borderRadius=(s||5)+"px",t.style.background=e.background||"#272C33FF",c1(Array.from(t.firstChild.childNodes),e),t.lastChild.firstChild.style.color=e.textColor,gh(e,e.calculative.singleton.div.childNodes[0].childNodes)}}}function CU(e,t){var r;if(t.onDestroy||(t.onDestroy=_U,t.onMove=ye,t.onResize=ye,t.onRotate=ye,t.onValue=SU,t.onScale=Hy,t.onMouseEnter=ye),t.calculative.singleton||(t.calculative.singleton={}),t.calculative.singleton.div)t.calculative.patchFlags&&ye(t);else{t.verifyState=!1;const a=document.createElement("div");t.calculative.cssDisplay="flex",a.setAttribute("style",`
      display: flex;
      align-items: center;
      justify-content:center;
      position:absolute;
      padding: 8px;
      overflow:hidden;
      `),a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.style.background=t.background||"RGB(242,243,245)",a.style.borderRadius=(t.borderRadius||0)+"px",a.className=`le-div-${t.id} ${t.className||""}`,a.onmouseover=()=>{a.style.borderColor="#0052d9"},a.onmouseout=()=>{a.style.borderColor=t.color||"#dcdcdc"};const i=document.createElement("div");i.setAttribute("style",`
    position:absolute;
    left:0;
    top:0;
    height:100%;
    z-index:2;
    `),i.style.background=t.sliderBgColor||"#03cb12",i.style.borderTopLeftRadius=(t.borderRadius||0)+"px",i.style.borderBottomLeftRadius=(t.borderRadius||0)+"px";const o=document.createElement("div");o.setAttribute("style",`
    height: 100%;
    width: 15%;
    box-sizing: border-box;
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor:pointer;
    `),o.style.background=t.sliderBarBgColor||"#fbf5f5",o.style.borderTopRightRadius=(t.borderRadius||0)+"px",o.style.borderBottomRightRadius=(t.borderRadius||0)+"px";const n=document.createElement("i");n.className=t.icon||"t-icon t-angle-right",o.style.color=t.iconColor||"#000",o.appendChild(n);const s=document.createElement("p");s.setAttribute("style",`
      z-index:1;
      margin:0;
      user-select:none;
    `),s.style.color=t.textColor||"#CFCECE",s.style.fontSize=t.fontSize+"px",s.innerText=t.placeholder||"请按住滑块，拖动到最右边完成验证",a.append(o,s,i),o.onmousedown=u=>{let c=u.clientX;document.onmousemove=l=>{l.stopPropagation();let f=l.clientX-c,h=a.offsetWidth,d=o.offsetWidth;f>=0&&f<=h-d&&(o.style.left=f+"px",i.style.width=f+"px"),f>=h-d&&(o.style.left="85%",i.style.width="85%",s.innerText=t.successText||"验证成功",s.style.color=t.activeColor||"#FFFFFF",s.style.zIndex="3",t.verifyState=!0,o.onmousedown=null,document.onmousemove=null,document.onmouseup=null)}},document.onmouseup=u=>{o.style.left="0px",i.style.width="0px",document.onmousemove=null},t.calculative.singleton.div=a,(r=t.calculative.canvas.externalElements)==null||r.parentElement.appendChild(a),setTimeout(()=>{aa(t)},1e3),ye(t),Hy(t)}}function kU(e,t){t!="false"?t!="true"?t.startsWith("svg")?e.innerHTML=t:e.innerHTML=`<i class="${t}"></i>`:e.innerHTML='<i class="t-icon t-angle-right"></i>':e.removeChild(e.firstChild)}function _U(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function SU(e){TU(e)}function Hy(e){const t=Array.from(e.calculative.singleton.div.childNodes);for(let r of t)r.style.zoom=e.calculative.canvas.parent.store.data.scale}function TU(e){if(e.calculative.singleton){const t=e.calculative.singleton.div;if(t){const r=e.calculative.worldRect;e.calculative.borderRadius,e.calculative.borderRadius;const{width:a,height:i}=e;e.calculative.borderRadius<1&&(a*e.calculative.borderRadius,i*e.calculative.borderRadius),t.style.width=r.width+"px",t.style.height=r.height+"px",t.style.background=e.background||"RGB(242,243,245)",t.firstChild.style.background=e.sliderBarBgColor||"#fbf5f5",t.firstChild.style.color=e.iconColor||"#000",kU(t.firstChild,String(e.icon||!0)),t.childNodes[1].style.fontSize=e.fontSize+"px",t.childNodes[1].innerText=e.placeholder||"请按住滑块，拖动到最右边完成验证",t.lastChild.style.background=e.sliderBgColor||"green",t.style.color=e.textColor}}}function AU(e,t){const r=t||new Path2D,{x:a,y:i,width:o,height:n}=e.calculative.worldRect;if(r.rect(a,i,o,n),e.onAdd||(e.onAdd=PU,e.onDestroy=RU,e.interval&&(e.onDestroy(e),e.onAdd(e))),r instanceof Path2D)return r}function EU(e){const r=new Date().getTime(),i=new Date(e.deadline||new Date().getFullYear()+1+"/1/1 00:00:00").getTime();let o=Math.floor((i-r)/1e3),n=0;(e.timeFormat&&e.timeFormat.indexOf("day")!==-1||!e.timeFormat)&&(n=Math.floor(o/86400),o=o%86400);let s=0;(e.timeFormat&&e.timeFormat.indexOf("hours")!==-1||!e.timeFormat)&&(s=Math.floor(o/3600),o%=3600);let u=0;return(e.timeFormat&&e.timeFormat.indexOf("minutes")!==-1||!e.timeFormat)&&(u=Math.floor(o/60),o%=60),new Function("day","hours","minutes","seconds",e.timeFormat?`return ${e.timeFormat}`:"return `${day}天${hours}小时${minutes}分钟${seconds}秒`")(n,s,u,o)}function PU(e){e.interval=setInterval(()=>{const t=EU(e);e.calculative.canvas.parent.setValue({id:e.id,text:t},{history:!1,doEvent:!1,render:!1}),e.calculative.canvas.render()},e.timeout||1e3)}function RU(e){e.interval&&(clearInterval(e.interval),e.interval=void 0)}function IU(e,t){let r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height,o=t.calculative.worldRect.width;const n=t.data;let s=t.calculative.canvas.store.data.scale,u=20*s,c=10*s;const{fontStyle:l,fontWeight:f,fontSize:h,fontFamily:d,lineHeight:v}=t.calculative;let y;const g=t.calculative.canvas.parent.store,m=et({fontStyle:l,fontWeight:f,fontFamily:d||t.calculative.canvas.parent.store.options.fontFamily,fontSize:h,lineHeight:v});if(t.calculative.hover?y=t.hoverTextColor||t.hoverColor||g.options.hoverColor:t.calculative.active&&(y=t.activeTextColor||t.activeColor||g.options.activeColor),t.direction=="vertical"){let w=(i-2*u)/(n.length-1);n.forEach((p,x)=>{e.beginPath();let T=a+u+x*w,A=p.circleBg||t.background||"#4583FF";if(p.path){let _=Uu(p.path,{x:r+o/2,y:T},{width:c,height:c});e.stroke(_),e.fill(_)}else Wt(e,{x:r+o/2,y:T,r:c/4},{fillStyle:A}),A=p.circleShadow||A+"33",Wt(e,{x:r+o/2,y:T,r:c/2},{fillStyle:A});e.closePath(),A=y||p.textColor||ji(t,g);const I=et({fontStyle:l,fontWeight:f,fontFamily:d||t.calculative.canvas.parent.store.options.fontFamily,fontSize:h,lineHeight:v});let R=r+o/2+c+4*s,z="left";t.labelAlign==="right"&&(R=r+o/2-c-4*s,z="right"),Jt(e,p.label,{x:R,y:T},{textAlign:z,textBaseline:"middle",fillStyle:A},I);let U=(t.fontSize||12)+4*s;t.mode==="alternate"&&(U=0,R=r+o/2-c-4*s,z="right",t.labelAlign==="right"&&(R=r+o/2+c+4*s,z="left")),Jt(e,p.content,{x:R,y:T+U},{textAlign:z,textBaseline:"middle",fillStyle:A}),x<n.length-1&&(e.beginPath(),e.strokeStyle=p.color||t.color||"#FFFFFF14",e.moveTo(r+o/2,T+c),e.lineTo(r+o/2,T+w-c),e.stroke(),e.closePath())})}else{let w=(o-2*u)/(n.length-1);n.forEach((p,x)=>{e.beginPath();let T=r+u+x*w,A=p.circleBg||t.background||"#4583FF";if(p.path){let z=Uu(p.path,{x:T,y:a+i/2},{width:c,height:c});e.stroke(z),e.fill(z)}else Wt(e,{x:T,y:a+i/2,r:c/4},{fillStyle:A}),A=p.circleShadow||A+"33",Wt(e,{x:T,y:a+i/2,r:c/2},{fillStyle:A});e.closePath(),A=y||p.textColor||ji(t,g);let I=a+i/2+c+4*s,R=I+(t.fontSize||12)+4*s;t.labelAlign==="bottom"&&(I=a+i/2-c-4*s,R=I-((t.fontSize||12)+4*s)),t.mode==="alternate"&&(I<a+i/2?R=a+i/2+c+4*s:R=a+i/2-c-4*s),Jt(e,p.label,{x:T,y:I},{textAlign:"center",textBaseline:"middle",fillStyle:A},m),Jt(e,p.content,{x:T,y:R},{textAlign:"center",textBaseline:"middle",fillStyle:A}),x<n.length-1&&(e.beginPath(),e.strokeStyle=p.color||t.color||"#FFFFFF14",e.moveTo(T+c,a+i/2),e.lineTo(T+w-c,a+i/2),e.stroke(),e.closePath())})}}function MU(e,t){var h;t.onAdd||(t.onAdd=LU,t.onDestroy=OU,t.onBeforeValue=DU,t.onMouseEnter=BU,t.onMouseLeave=FU,t.interval&&(t.onDestroy(t),t.onAdd(t)));let r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height,o=t.calculative.worldRect.width;t.offset==null&&(t.offset=5);let n=100;const{fontStyle:s,fontWeight:u,fontSize:c,fontFamily:l,lineHeight:f}=t.calculative;if(e.font=et({fontStyle:s,fontWeight:u,fontFamily:l||t.calculative.canvas.parent.store.options.fontFamily,fontSize:c,lineHeight:f}),e.textAlign="left",t.direction==="vertical"){e.save(),e.fillStyle="#fff0",e.rect(r,a,o,i),e.fill(),e.clip(),e.beginPath(),e.fillStyle=Zi(t);let d=Math.floor(c*f);t.calculative.textH=d;let v=t.data.length*d;for(let g=0;g<t.data.length;g++){let m=Math.floor(a+d/2+d*g+t.offset);e.fillText(t.data[g],r+10,m)}let y=2;for(let g=1;g<y;g++)for(let m=0;m<t.data.length;m++){let w=Math.floor(a+d/2+d*m+t.offset+g*v);e.fillText(t.data[m],r+10,w)}t.offset+v*y<d&&t.offset+v*y>-d&&(t.offset=-v*(y-1)+d,u1(t)(0)),e.restore()}else{e.save(),e.fillStyle="#fff0",e.rect(r,a,o,i),e.fill(),e.clip(),e.beginPath(),e.fillStyle=Zi(t);let d=(h=t.data)==null?void 0:h.join("       ");e.fillText(d,r+t.offset,a+i/2);let v=e.measureText(d).width;for(let y=0;y<3;y++)e.fillText(d,r+t.offset+(v+n)*y,a+i/2);v+n+t.offset<5&&v+n+t.offset>-5&&(t.offset=-5),v+n+t.offset<-5&&(t.offset=-5),e.restore()}}function u1(e){let t=0;return e.interval&&clearInterval(e.interval),r=>{t=r||0;let a=e.calculative.textH?Math.floor(e.calculative.textH):0,i=20,o=0;e.interval=setInterval(()=>{t>=a?o>=i?(t=0,o=0):o+=1:(e.offset-=1,t+=1,e.calculative.canvas.render())},e.timeout||50)}}function LU(e){e.direction==="vertical"?u1(e)(0):e.interval=setInterval(()=>{e.offset-=1,e.calculative.canvas.render()},e.timeout||10)}function OU(e){e.interval&&(clearInterval(e.interval),e.interval=void 0)}function DU(e,t){return t.timeout&&setTimeout(()=>{e.onDestroy(e),e.onAdd(e)}),t}function BU(e){var t;(t=e.onDestroy)==null||t.call(e,e)}function FU(e){var t;(t=e.onAdd)==null||t.call(e,e)}function NU(e,t){var n;t.onDestroy||(t.onAdd=f1,t.onDestroy=h1,t.onMove=ye,t.onResize=$U,t.onRotate=ye,t.onBeforeValue=zU,t.onScale=jU,t.onMouseEnter=ye,t.interval&&(t.onDestroy(t),t.onAdd(t))),t.calculative.singleton||(t.calculative.singleton={});let{width:r,height:a,x:i,y:o}=t.calculative.worldRect;if(t.calculative.singleton.div)t.calculative.patchFlags&&ye(t);else{const s=document.createElement("div");t.calculative.cssDisplay="flex",s.setAttribute("style",`
    margin:0;
    position: relative;
    padding: 0 4px;
    display: flex;
    align-items: center;
    overflow: hidden;`),s.style.position="absolute",s.style.outline="none",s.style.left="-9999px",s.style.top="-9999px",s.className=`le-div-${t.id} ${t.className||""}`;const u=document.createElement("div");u.className="le-swiper",u.setAttribute("style",`
      width: 100%;
      height: 100%;
      position: relative;
      overflow: hidden;`);const c=document.createElement("ul");if(c.className="le-ul-box",c.setAttribute("style",`list-style-type: none;
      width: 1000%;
      position: absolute;
      top: 0;
      left: 0;
      padding-inline-start:0px;
      `),u.appendChild(c),s.appendChild(u),t.data.length)for(let y of t.data){const g=document.createElement("li");if(c.appendChild(g),g.setAttribute("style",`
          width: ${r}px;
          height: ${a}px;
          float: left;
        `),t.swiperType==="iframe"){const m=document.createElement("iframe");m.style.border="0",m.src=y.src,g.appendChild(m),m.setAttribute("style",`
        width:${r}px;
        height:${a}px;`)}else{const m=document.createElement("img");m.src=y.src,g.appendChild(m),m.setAttribute("style",`
        width:${r}px;
        height:${a}px;`)}}const l=document.createElement("div");l.innerHTML="&lt;";const f=document.createElement("div");f.innerHTML="&gt;";let h=`
    display: none;
    width: 20px;
    height: 30px;
    line-height: 30px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.3);
    `;l.setAttribute("style",h+"left: 0;padding-left:3px;"),f.setAttribute("style",h+" right: 0;padding-left:5px;");const d=document.createElement("ul");d.setAttribute("style",`
      list-style-type: none;
      position: absolute;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
    `),t.tem_num=0,t.tem_dot=0;for(let y=0;y<t.data.length;y++){let g=document.createElement("li");d.appendChild(g),g.setAttribute("index",y+""),g.addEventListener("click",function(){for(var m=0;m<d.children.length;m++)d.children[m].className="";this.className="current";let w=this.getAttribute("index");t.tem_num=parseInt(w),t.tem_dot=parseInt(w),Sc(c,-w*c.children[0].offsetWidth)}),g.setAttribute("style",`
        width: 10px;
        height: 10px;
        border-radius: 50%;
        z-index: 999;
        float: left;
        cursor: pointer;
        margin: 0 2px;
        border: 1px solid #fff;
      `)}u.appendChild(d),u.appendChild(l),u.appendChild(f),u.addEventListener("mouseenter",()=>{l.style.display="block",f.style.display="block",clearInterval(t.interval),t.interval=null}),u.addEventListener("mouseleave",()=>{l.style.display="none",f.style.display="none",t.interval=setInterval(()=>{f.click()},t.timeout||3e3)}),d.children[0].className="current",f.addEventListener("click",function(){t.tem_num===c.children.length-1&&(c.style.left="0",t.tem_num=0),t.tem_num++,Sc(c,-t.tem_num*c.children[0].offsetWidth),t.tem_dot++,t.tem_dot==d.children.length&&(t.tem_dot=0);for(let y=0;y<d.children.length;y++)d.children[y].className="";d.children[t.tem_dot].className="current"}),l.addEventListener("click",function(){t.tem_num===0&&(t.tem_num=c.children.length-1,c.style.left=-t.tem_num*c.children[0].offsetWidth+"px"),t.tem_num--,Sc(c,-t.tem_num*c.children[0].offsetWidth),t.tem_dot--,t.tem_dot<0&&(t.tem_dot=d.children.length-1);for(var y=0;y<d.children.length;y++)d.children[y].className="";d.children[t.tem_dot].className="current"}),HU("le-swiper",`
    .le-swiper .current{
      background-color: #1890ff;
    }
    `),t.calculative.singleton.div=s,setTimeout(()=>{aa(t)},1e3),(n=t.calculative.canvas.externalElements)==null||n.parentElement.appendChild(s),ye(t)}}function Sc(e,t,r){clearInterval(e.timer),e.timer=setInterval(()=>{var a=(t-e.offsetLeft)/10;a=a>0?Math.ceil(a):Math.floor(a),e.offsetLeft===t&&clearInterval(e.timer),e.style.left=e.offsetLeft+a+"px"},40)}function f1(e){e.interval=setInterval(()=>{var t;(t=e.calculative.singleton)==null||t.div.children[0].children[3].click()},e.timeout||3e3)}function h1(e){e.interval&&(clearInterval(e.interval),e.interval=void 0),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function $U(e){var o;ye(e);let{width:t,height:r}=e.calculative.worldRect,a=e.calculative.canvas.parent.store.data.scale;const i=(o=e.calculative.singleton)==null?void 0:o.div.children[0].children[0];for(let n of i.children)n.style.width=`${t/a}px`,n.style.height=`${r/a}px`,n.children[0].style.width=`${t/a}px`,n.children[0].style.height=`${r/a}px`}function jU(e){const t=Array.from(e.calculative.singleton.div.childNodes);for(let r of t)r.style.zoom=e.calculative.canvas.parent.store.data.scale}function zU(e,t){return t.data&&(h1(e),f1(e)),t}function HU(e,t){let r;for(let a=0;a<document.styleSheets.length;a++)document.styleSheets[a].title===`le5le.com/${e}`&&(r=document.styleSheets[a]);if(!r){let a=document.createElement("style");a.type="text/css",a.title=`le5le.com/${e}`,document.head.appendChild(a),a=document.createElement("style"),a.type="text/css",document.head.appendChild(a),r=a.sheet,r.insertRule(t)}}function WU(e,t){let{x:r,y:a,width:i,height:o,ex:n,ey:s}=t.calculative.worldRect;const{fontStyle:u,fontWeight:c,fontSize:l,fontFamily:f,lineHeight:h}=t.calculative;t.onMouseMove||(t.onMouseMove=VU,t.onKeyDown=KU,t.onMouseDown=qU,t.onShowInput=YU,t.onInput=GU),t.calculative.hoverType==="hour"&&(t.onWheel||(t.onWheel=QU)),e.save(),e.fillStyle=t.background||"#fff",e.strokeStyle=t.color||"#4583FF";let d=t.calculative.borderRadius||5,v=d;d<1&&(d=i*d,v=o*v);let y=d<v?d:v;i<2*y&&(y=i/2),o<2*y&&(y=o/2),e.beginPath(),e.moveTo(r+y,a),e.arcTo(n,a,n,s,y),e.arcTo(n,s,r,s,y),e.arcTo(r,s,r,a,y),e.arcTo(r,a,n,a,y),e.fill(),e.stroke(),e.restore();let g=i;t.calendarType==="time"&&(g=280/496*i);let m=12/326*o,w=12/280*g,p=40/326*o,x=48/326*o;const T=t.calculative.canvas.mousePos;!t.year&&(t.year=new Date().getFullYear()),!t.month&&(t.month=new Date().getMonth()+1),t.calculative.day=void 0,t.calculative.hoverBtn=void 0;let A=t.year,I=t.month;e.save(),e.fillStyle="#FFFFFFFF",e.font=et({fontStyle:u,fontWeight:"700",fontFamily:f||t.calculative.canvas.parent.store.options.fontFamily,fontSize:l+3,lineHeight:h}),e.textAlign="start",e.textBaseline="middle";let R={x:r+w,y:a+m,width:80/280*g,height:32/326*o},z="#313740";Pr(T,R)&&t.calculative.canvas.inputDiv.dataset.penId!==t.id&&(z="#4583FF",t.calculative.worldTextRect=Wy(R),t.calculative.hoverType="month"),yr(e,R,z,void 0),e.fillText(`${I}月`,r+w+8/280*g,a+m+16/326*o),e.beginPath();let U={x:r+w+8/280*g+80/280*g,y:a+m,width:80/280*g,height:32/326*o},_="#313740";Pr(T,U)&&t.calculative.canvas.inputDiv.dataset.penId!==t.id&&(_="#4583FF",t.calculative.worldTextRect=Wy(U),t.calculative.hoverType="year"),yr(e,U,_,void 0),e.fillText(`${A}`,r+w+8/280*g+80/280*g+8/280*g,a+m+16/326*o),e.restore();let k=t.calculative.fontSize;yo(e,{icon:"",x:r+w+8/280*g+56/280*g,y:a+m+16/326*o,color:"#ffffff",iconFamily:"l-icon",fontSize:k}),yo(e,{icon:"",x:r+w+8/280*g+8/280*g+80/280*g+56/280*g,y:a+m+16/326*o,color:"#ffffff",iconFamily:"l-icon",fontSize:k});let S={x:r+208/280*g-k,y:a+m+16/326*o-k,width:k*2,height:k*2};Pr(T,S)&&(yr(e,S,"#00000000","#313740"),t.calculative.hoverBtn="last"),yo(e,{icon:"",x:r+208/280*g,y:a+m+16/326*o,color:"#ffffff",iconFamily:"l-icon",fontSize:k});let P={x:r+232/280*g-k,y:a+m+16/326*o-k,width:k*2,height:k*2};Pr(T,P)&&(yr(e,P,"#00000000","#313740"),t.calculative.hoverBtn="current"),yo(e,{icon:"",x:r+232/280*g,y:a+m+16/326*o,color:"#ffffff",iconFamily:"l-icon",fontSize:k});let B={x:r+256/280*g-k,y:a+m+16/326*o-k,width:k*2,height:k*2};Pr(T,B)&&(yr(e,B,"#00000000","#313740"),t.calculative.hoverBtn="next"),yo(e,{icon:"",x:r+256/280*g,y:a+m+16/326*o,color:"#ffffff",iconFamily:"l-icon",fontSize:k}),e.save(),e.beginPath();let D=UU(A,I);t.calculative.calendardata=D;let H=(g-w*2)/7,L=(o-m*2-p-x)/D.data.length,M=0,j=t.textColor||t.color||"#fff";e.font=et({fontStyle:u,fontWeight:c,fontFamily:f||t.calculative.canvas.parent.store.options.fontFamily,fontSize:l,lineHeight:h}),t.calculative.hoverIndex=-1;for(let V=0;V<D.data.length;V++)for(let Y=0;Y<7;Y++){let q=r+w+Y*H,Q=a+m+p+V*L,K=q+H/2,X=Q+L/2;e.fillStyle=j,(M<=D.start||M>=D.end)&&globalThis.pSBC&&(e.fillStyle="#FFFFFF42"),M<7&&(e.fillStyle="#FFFFFF66"),M>=7&&M===D.current&&(yr(e,{x:q,y:Q,width:H,height:L},"#4583FF00","#001B52"),e.fillStyle="#4583FF");const{x:b,y:C}=t.calculative.canvas.mousePos;M>=7&&b>q&&b<q+H&&C>Q&&C<Q+L&&(yr(e,{x:q,y:Q,width:H,height:L},"#4583FF",void 0),t.calculative.hoverIndex=M,t.calculative.day=D.data[V][Y],t.calculative.hoverType="day"),t.value===`${t.year}-${t.month}-${D.data[V][Y]}`&&(V>=5&&D.data[V][Y]<=15||V<=1&&D.data[V][Y]>=15||yr(e,{x:q,y:Q,width:H,height:L},"#4583FF",void 0)),e.textAlign="center",e.fillText(D.data[V][Y],K,X),M++}if(e.restore(),t.calendarType==="time"){t.hour===void 0&&(t.hour=new Date().getHours()),t.minutes===void 0&&(t.minutes=new Date().getMinutes()),t.seconds===void 0&&(t.seconds=new Date().getSeconds()),e.moveTo(r+g+(i-g)/2,a+29/326*o),e.textAlign="center",e.textBaseline="middle",e.font=et({fontStyle:u,fontWeight:c,fontFamily:f||t.calculative.canvas.parent.store.options.fontFamily,fontSize:l+3,lineHeight:h}),e.fillStyle="#ffffff",e.fillText(`${(t.hour+"").padStart(2,"0")} : ${(t.minutes+"").padStart(2,"0")} : ${(t.seconds+"").padStart(2,"0")}`,r+g+(i-g)/2,a+29/326*o),e.font=et({fontStyle:u,fontWeight:c,fontFamily:f||t.calculative.canvas.parent.store.options.fontFamily,fontSize:l,lineHeight:h});let V=(i-g)/3,Y=XU(t.hour,t.minutes,t.seconds),q={x:r+w+g+V/2-31/496*g,y:a+m+p,width:62/496*g,height:o-m-p-x};Pr(T,q)&&(t.calculative.hoverType="hour");let Q={x:r+w+g+V/2+V-31/496*g,y:a+m+p,width:62/496*g,height:o-m-p-x};Pr(T,Q)&&(t.calculative.hoverType="minutes");let K={x:r+w+g+V/2+2*V-31/496*g,y:a+m+p,width:62/496*g,height:o-m-p-x};Pr(T,K)&&(t.calculative.hoverType="seconds");for(let X=0;X<3;X++)for(let b=0;b<7;b++){let C=r+w+g+V/2+X*V,E=a+m+p+b*L+L/2;e.fillStyle="#FFFFFF99",b===3&&(yr(e,{x:C-31/496*g,y:E-12/326*o,width:62/496*g,height:24/326*o},"#ffffff00","#001B52FF"),e.fillStyle="#4583FFFF"),e.fillText(Y[X][b],C,E)}}e.save(),e.beginPath(),e.strokeStyle="#FFFFFF42",e.moveTo(r,a+o-x),e.lineTo(r+i,a+o-x),e.stroke();let W={x:r+i-44/280*g,y:a+o-36/326*o,width:32/280*g,height:24/326*o},F="#4583FF";Pr(T,W)&&(F="#7DA4FF",t.calculative.hoverBtn="ok"),yr(e,W,"#00000000",F),e.fillStyle="#ffffff",e.textAlign="center",e.textBaseline="middle",e.font=et({fontStyle:u,fontWeight:c,fontFamily:f||t.calculative.canvas.parent.store.options.fontFamily,fontSize:l,lineHeight:h}),e.fillText("确定",r+i-28/280*g,a+o-24/326*o),t.calendarType==="time"&&(e.fillStyle="#4583FF",e.fillText("时间",r+i-82/280*g,a+o-24/326*o)),e.restore()}function yr(e,t,r,a,i){e.save(),e.beginPath(),e.fillStyle=a,e.strokeStyle=r;let o=5;e.beginPath(),e.moveTo(t.x+o,t.y),e.arcTo(t.x+t.width,t.y,t.x+t.width,t.y+t.height,o),e.arcTo(t.x+t.width,t.y+t.height,t.x,t.y+t.height,o),e.arcTo(t.x,t.y+t.height,t.x,t.y,o),e.arcTo(t.x,t.y,t.x+t.width,t.y,o),a&&e.fill(),r&&e.stroke(),e.restore()}function UU(e,t){e=e||new Date().getFullYear(),t=t||new Date().getMonth()+1;var r=new Date(e,t-1,0),a=r.getDate(),i=r.getDay(),o=new Date(e,t,0),n=o.getDate(),s=new Date().getDate(),u=new Date().getFullYear(),c=new Date().getMonth()+1,l=a-i,f=1;let h=[];h.push(["日","一","二","三","四","五","六"]);let d=0,v=-1,y=-1,g=[];for(var m=0;m<=6;m++)m<=i?g.push(l++):(u==e&&c==t&&s==f&&y<0&&(y=d),g.push(f++)),d++;h.push(g);for(var w=6-i+1,p=1,x=1;x<=5;x++){let A=[];for(var T=0;T<7;T++)w<=n?(u==e&&c==t&&s==w&&y<0&&(y=d),A.push(w++)):(v<0&&(v=d),A.push(p++)),d++;h.push(A)}return{data:h,start:i+7,end:v+7,current:y+7}}function VU(e,t){e.calculative.canvas.render()}function qU(e,t){if(e.calculative.hoverType==="year"){e.calculative.text=e.year,e.text=e.year;let r=[],a=parseInt(e.year);for(let i=a-20;i<a+20;i++)r.push({text:i});e.dropdownList=r}else e.calculative.hoverType==="month"&&(e.calculative.text=e.month+"月",e.text=e.month+"月",e.dropdownList=[{text:"1月"},{text:"2月"},{text:"3月"},{text:"4月"},{text:"5月"},{text:"6月"},{text:"7月"},{text:"8月"},{text:"9月"},{text:"10月"},{text:"11月"},{text:"12月"}]);e.calculative.day&&(e.day=e.calculative.day,e.value=`${e.year}-${e.month}-${e.day}`),e.calculative.yearActive=!1,e.calculative.monthActive=!1,e.calculative.activeMousePos={x:t.x,y:t.y},(e.calculative.hoverIndex>0&&e.calculative.calendardata||e.calculative.hoverBtn)&&(e.calculative.hoverIndex>=7&&e.calculative.hoverIndex<=e.calculative.calendardata.start||e.calculative.hoverBtn==="last"?(e.month-=1,e.month<1&&(e.month=12,e.year-=1)):e.calculative.hoverIndex>=e.calculative.calendardata.end||e.calculative.hoverBtn==="next"?(e.month+=1,e.month>12&&(e.month=1,e.year+=1)):e.calculative.hoverBtn==="current"&&(e.year=new Date().getFullYear(),e.month=new Date().getMonth()+1)),e.calculative.hoverBtn==="ok"&&(e.calendarType==="time"?e.value=`${e.year}-${e.month}-${e.day} ${e.hour}:${e.minutes}:${e.seconds}`:e.value=`${e.year}-${e.month}-${e.day}`),e.calculative.canvas.render()}function KU(e,t){t==="ArrowUp"||t==="ArrowLeft"?(e.calculative.yearActive&&(e.year+=1,e.calculative.canvas.render()),e.calculative.monthActive&&(e.month+=1,e.month>12&&(e.month=1),e.calculative.canvas.render())):(t==="ArrowRight"||t==="ArrowDown")&&(e.calculative.yearActive&&(e.year-=1,e.calculative.canvas.render()),e.calculative.monthActive&&(e.month-=1,e.month<1&&(e.month=12),e.calculative.canvas.render()))}function YU(e,t){e.calculative.hoverType!=="year"&&e.calculative.hoverType!=="month"||e.calculative.canvas.showInput(e,e.calculative.worldTextRect,"#ffffff")}function GU(e,t){e.calculative.hoverType==="year"?e.year=parseInt(t):e.calculative.hoverType==="month"&&(e.month=parseInt(t.slice(0,-1))),e.calculative.canvas.render()}function Wy(e){return{x:e.x,y:e.y,width:e.width,height:e.height,ex:e.x+e.width,ey:e.y+e.height}}function XU(e,t,r){let a=[],i=[],o=[];for(let n=0;n<7;n++){let s=e-3+n;s>23||s<0?s="":s=(s+"").padStart(2,"0"),a.push(s)}for(let n=0;n<7;n++){let s=t-3+n;s>59||s<0?s="":s=(s+"").padStart(2,"0"),i.push(s)}for(let n=0;n<7;n++){let s=r-3+n;s>59||s<0?s="":s=(s+"").padStart(2,"0"),o.push(s)}return[a,i,o]}function QU(e,t){let r=0;t.deltaY>0?r=1:r=-1,e.calculative.hoverType==="hour"?(e.hour=parseInt(e.hour)+r,e.hour<0&&(e.hour=0),e.hour>23&&(e.hour=23)):e.calculative.hoverType==="minutes"?(e.minutes=parseInt(e.minutes)+r,e.minutes<0&&(e.minutes=0),e.minutes>59&&(e.minutes=59)):e.calculative.hoverType==="seconds"&&(e.seconds=parseInt(e.seconds)+r,e.seconds<0&&(e.seconds=0),e.seconds>59&&(e.seconds=59)),["hour","minutes","seconds"].includes(e.calculative.hoverType)&&e.calculative.canvas.render()}function JU(e,t){let r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height,o=t.calculative.worldRect.width,{fontStyle:n,fontWeight:s,fontSize:u,fontFamily:c,lineHeight:l}=t.calculative;const f=t.calculative.canvas.parent.store;ji(t,f);let h,d,v;t.calculative.hover?(v=t.hoverColor||f.options.hoverColor,h=t.hoverTextColor||v,d=t.hoverBackground||f.options.hoverBackground):t.calculative.active&&(v=t.activeColor||f.options.activeColor,h=t.activeTextColor||v,d=t.activeBackground||f.options.activeBackground);for(let y of t.data){if(e.save(),e.font=et({fontStyle:y.fontStyle||n,fontWeight:y.fontWeight||s,fontFamily:c||t.calculative.canvas.parent.store.options.fontFamily,fontSize:y.fontSize||u,lineHeight:l}),y.type==="icon"){e.fillStyle=d||y.background||ji(t,f),e.strokeStyle=v||y.color||ji(t,f);let g=Uu(y.path,{x:r+o*y.x,y:a+i/2-.2*u},{width:u,height:u});e.stroke(g),e.fill(g)}else e.fillStyle=h||y.textColor||ji(t,f),e.fillText(y.text,r+o*y.x,a+i/2);e.restore()}}function ZU(e,t){let{x:r,y:a,width:i,height:o}=t.calculative.worldRect,n=t.borderRadius,s=t.borderRadius;t.borderRadius<1&&(n=i*t.borderRadius,s=o*t.borderRadius);let u=n<s?n:s;i<2*u&&(u=i/2),o<2*u&&(u=o/2);const c=t.calculative.canvas.store;e.beginPath();let l,f;t.calculative.hover?(f=t.hoverColor||c.options.hoverColor,l=t.hoverBackground||c.options.hoverBackground):t.calculative.active&&(f=t.activeColor||c.options.activeColor,l=t.activeBackground||c.options.activeBackground),e.fillStyle=l||t.background,e.strokeStyle=f||t.color,e.moveTo(r+u,a),e.arcTo(r+i,a,r+i,a+o,u),e.arcTo(r+i,a+o,r,a+o,u),e.arcTo(r,a+o,r,a,u),e.arcTo(r,a,r+i,a,u),e.closePath(),t.lineWidth>0&&e.stroke(),e.fill(),e.beginPath(),e.fillStyle=t.progressColor,e.moveTo(r+u,a);let h=t.progress>1?1:t.progress||0;e.arcTo(r+i*h,a,r+i*h,a+o,u),e.arcTo(r+i*h,a+o,r,a+o,u),e.arcTo(r,a+o,r,a,u),e.arcTo(r,a,r+i,a,u),e.closePath(),e.fill()}const Uy="#FFFFFF",eV="#666666";function tV(e,t){var r;if(t.onDestroy||(t.onDestroy=d1,t.onMove=ye,t.onResize=ye,t.onRotate=ye,t.onBeforeValue=oV,t.onValue=iV,t.onScale=Vy,t.onMouseEnter=ye),t.calculative.singleton||(t.calculative.singleton={}),t.calculative.singleton.div)t.calculative.patchFlags&&ye(t);else{const a=document.createElement("div");a.setAttribute("style",`
      position:relative;
      padding: 0px;
      `),a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.style.background=t.background||Uy,a.style.color=t.textColor||eV,a.style.borderRadius=(t.borderRadius||5)+"px",a.style.fontSize=(t.fontSize||16)+"px",a.className=`le-div-${t.id} ${t.className||""}`;const i=document.createElement("div");i.setAttribute("style",`
      padding: 10px;
      height:100%;
      width:100%;
      border:solid;
      display:flex;
      align-items:center;
      justify-content: center;
      `),i.style.borderWidth=(t.borderWidth||0)+"px",i.style.borderColor=t.borderColor||"#cccccc",i.innerText=t.placeholder||"测试";const o=document.createElement("div");o.setAttribute("style",`
      padding: 5px;
      display:none;
      max-height:0;
      `);const n=document.createElement("ul");o.appendChild(n),a.append(i,o),n.setAttribute("style",`
      border-radius:5px;
      margin:0;
      padding:5px;
      text-align:center;
      box-shadow:
      0px 0px 22.9px rgba(0, 0, 0, 0.068),
      0px 0px 30px rgba(0, 0, 0, 0.07);`),n.style.background=t.dropContentBgColor||t.background||Uy,a.onmouseenter=()=>{o.style.display="block"},a.onmouseleave=()=>{o.style.display="none"},Array.isArray(t.data)&&n.append(...rV(t,t.data,o)),t.calculative.singleton.div=a,setTimeout(()=>{aa(t)},1e3),(r=t.calculative.canvas.externalElements)==null||r.parentElement.appendChild(a),ye(t),Vy(t)}}function rV(e,t,r,a){const i=[];return t.forEach(o=>{const n=document.createElement("li");n.dataset.key=o.key,n.setAttribute("style",`
      display:list-item;
      list-style:none;
      cursor: pointer;
      padding: 5px;
      border-radius:10px;
      background:transparent;
      `),n.innerHTML=o.title,i.push(n),aV(n,e),n.onclick=()=>{e.selectedKeys=[o.key],e.selectKey=o.key,e.calculative.canvas.store.emitter.emit("valueUpdate",e),r.style.display="none"}}),i}function Vy(e){const t=Array.from(e.calculative.singleton.div.childNodes);for(let r of t)r.style.zoom=e.calculative.canvas.parent.store.data.scale}function iV(e){nV(e)}function d1(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function aV(e,t){e.onmouseenter=()=>{e.style.background=t.hoverBackground||"#F3F3F3"},e.onmouseleave=()=>{e.style.background="transparent"}}function oV(e,t){return t.data&&d1(e),t}function nV(e){if(e.calculative.singleton){const t=e.calculative.singleton.div;if(t){const r=e.calculative.worldRect;let a=e.calculative.borderRadius||0,i=e.calculative.borderRadius||0;const{width:o,height:n}=e;e.calculative.borderRadius<1&&(a=o*e.calculative.borderRadius,i=n*e.calculative.borderRadius);let s=a<i?a:i;t.style.width=r.width+"px",t.style.height=r.height+"px",t.style.borderRadius=(s||5)+"px",t.style.background=e.background||"#fff",t.lastChild.firstChild.style.background=e.dropContentBgColor||e.background||"#fff",t.firstChild.style.borderWidth=(e.borderWidth||0)+"px",t.firstChild.style.borderColor=e.borderColor||"#cccccc",t.firstChild.style.borderRadius="5px",t.firstChild.innerText=e.placeholder||"测试",t.style.color=e.textColor||"#000000",t.style.fontSize=(e.fontSize||12)+"px"}}}function sV(e,t){var r;if(t.onDestroy||(t.onDestroy=lV,t.onMove=Tc,t.onResize=Tc,t.onRotate=Tc,t.onBeforeValue=cV,t.onValue=uV),t.calculative.singleton||(t.calculative.singleton={}),t.calculative.singleton.div)t.calculative.patchFlags&&ye(t);else{const a=document.createElement("div");let i=document.createElement("video");i.muted=!0,i.controls=!0,i.style.position="absolute",i.style.outline="none",i.style.left="0",i.style.top="0",i.style.width="100%",i.style.height="100%",a.appendChild(i),t.calculative.singleton.div=a,v1(t),(r=t.calculative.canvas.externalElements)==null||r.parentElement.appendChild(a),ye(t)}}function v1(e){if(e.calculative.singleton&&e.calculative.singleton.div){const t=e.calculative.singleton.div;let r=e.calculative.singleton.player;typeof r<"u"&&r!=null&&(r.unload(),r.detachMediaElement(),r.destroy(),r=null),r=globalThis.flvjs&&globalThis.flvjs.createPlayer({type:"flv",url:e.video,isLive:!0,hasAudio:!1,hasVideo:!0,enableStashBuffer:!1,...e.mediaDataSource},{enableWorker:!1,enableStashBuffer:!1,autoCleanupSourceBuffer:!0,...e.optionalConfig}),r.attachMediaElement(t.children[0]),r.load(),e.calculative.singleton.player=r}}function lV(e){e.calculative.singleton&&e.calculative.singleton.player&&(e.calculative.singleton.player.unload(),e.calculative.singleton.player.detachMediaElement(),e.calculative.singleton.player.destroy(),e.calculative.singleton.player=null),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),e.calculative.singleton.div=void 0)}function Tc(e){ye(e)}function cV(e,t){return e.reload=!1,(t.video||t.mediaDataSource||t.optionalConfig)&&(e.reload=!0),t}function uV(e){e.reload&&(v1(e),delete e.reload)}function fV(e,t){let r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height,o=t.calculative.worldRect.width;const n=t.data,s=t.calculative.canvas.store.data.scale||1,{btnWidth:u,btnHeight:c,gap:l=8}=t,f=l*s,h=n.length;let d=a+f,v=r+f;Os(t,"activeBgImage","activeBgImg"),Os(t,"bgImage","bgImg"),t.onMouseDown||(t.onMouseDown=hV);const y=t.data[0].radius||[0,0,0,0];if(t.direction=="horizontal"){const g=u*s||(o-(h+1)*f)/h,m=c*s||i-f*2;n.forEach((w,p)=>{qy(e,w,v,d,t,w.isForbidden,g,m,y),Ky(e,w,v+g/2,d+m/2,t,w.isForbidden),v+=g+f})}else{const g=u*s||o-f*2,m=c*s||(i-(h+1)*f)/h;n.forEach((w,p)=>{qy(e,w,v,d,t,w.isForbidden,g,m,y),Ky(e,w,v+g/2,d+m/2,t,w.isForbidden),d+=m+f})}}const qy=(e,t,r,a,i,o,n,s,u)=>{const c=t.radius||u;o?(e.strokeStyle=t.forbiddenColor||"#636363",Ac(e,{x:r,y:a,width:n,height:s},c,t.forbiddenBgColor||"#434343")):!i.multiple&&t.key==i.selectedKey||i.multiple&&i.selectedKeys.includes(t.key)?(e.strokeStyle=t.activeColor||i.activeColor||"#4583FF",i.calculative.activeBgImg?e.drawImage(i.calculative.activeBgImg,r,a,n,s):Ac(e,{x:r,y:a,width:n,height:s},c,t.activeBackground||i.activeBackground||"rgba(69,131,255,0.2)")):(e.strokeStyle=t.color||i.color||"#313740",i.calculative.bgImg?e.drawImage(i.calculative.bgImg,r,a,n,s):Ac(e,{x:r,y:a,width:n,height:s},c,t.background||i.background||"#272c33")),e.stroke()};function Ac(e,t,r,a){const{x:i,y:o,width:n,height:s}=t,[u,c,l,f]=r;e.beginPath(),e.moveTo(i+u,o),e.arcTo(i+n,o,i+n,o+c,c),e.arcTo(i+n,o+s,i+n-u,o+s,l),e.arcTo(i,o+s,i,o+s-f,f),e.arcTo(i,o,i+u,o,u),e.fillStyle=a,e.fill()}function Ky(e,t,r,a,i,o){const n=t.text,{fontStyle:s,fontWeight:u,fontSize:c,fontFamily:l,lineHeight:f}=i.calculative;e.font=e.font=et({fontStyle:s,fontWeight:u,fontFamily:l||i.calculative.canvas.parent.store.options.fontFamily,fontSize:c,lineHeight:f}),e.textBaseline="middle",e.textAlign="center";let h=!1;(!i.multiple&&t.key==i.selectedKey||i.multiple&&i.selectedKeys.includes(t.key))&&(h=!0),e.fillStyle=o?t.forbiddenTextColor||"rgba(255,255,255,0.26)":h?t.activeTextColor||i.activeTextColor||"#FFFFFF":t.textColor||i.textColor||"#FFFFFF",e.fillText(n,r,a)}function hV(e,t){const{x:r,y:a,width:i,height:o}=e.calculative.worldRect,n=e.calculative.canvas.store.data.scale||1,{btnWidth:s,btnHeight:u,gap:c=8}=e,l=c*n,f=e.data.length;if(e.direction=="horizontal"){const h=s*n||(i-(f+1)*l)/f;if(e.multiple)for(let d=0;d<e.data.length;d++){let v=d==0?r+l:r+l+d*(h+l);if(!e.data[d].isForbidden&&t.x>v&&t.x<v+h){if(e.selectedKeys.includes(e.data[d].key)){const y=e.selectedKeys.findIndex(g=>g==e.data[d].key);e.selectedKeys.splice(y,1)}else e.selectedKeys.push(e.data[d].key);e.calculative.canvas.store.emitter.emit("valueUpdate",e)}}else for(let d=0;d<e.data.length;d++){let v=d==0?r+l:r+l+d*(h+l);!e.data[d].isForbidden&&t.x>v&&t.x<v+h&&(e.selectedKey=e.data[d].key,e.calculative.canvas.store.emitter.emit("valueUpdate",e))}}else if(e.direction=="vertical"){const h=u*n||(o-(f+1)*l)/f;if(e.multiple)for(let d=0;d<e.data.length;d++){let v=d==0?a+l:a+l+d*(h+l);if(!e.data[d].isForbidden&&t.y>v&&t.y<v+h){if(e.selectedKeys.includes(e.data[d].key)){const y=e.selectedKeys.findIndex(g=>g==e.data[d].key);e.selectedKeys.splice(y,1)}else e.selectedKeys.push(e.data[d].key);e.calculative.canvas.store.emitter.emit("valueUpdate",e)}}for(let d=0;d<e.data.length;d++){let v=d==0?a+l:a+l+d*(h+l);!e.data[d].isForbidden&&t.y>v&&t.y<v+h&&(e.selectedKey=e.data[d].key,e.calculative.canvas.store.emitter.emit("valueUpdate",e))}}e.calculative.canvas.render()}function dV(e,t){let r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height,o=t.calculative.worldRect.width;t.itemPosition=[],t.data||(t.data=t.options,t.onMouseDown=void 0),t.options&&(delete t.options,t.onMouseDown=void 0),t.onMouseDown||(t.onMouseDown=vV);const n=10;if(t.direction=="horizontal"){const{fontSize:s}=t.calculative,u=s/2;let c=0;t.data.forEach(h=>{c+=h.text.length*s});let l=a+i/2,f=r;if(t.theme=="button"){const h=(o-c)/(t.data.length*2),d=h>n?h:n;t.data.forEach((v,y)=>{const g=v.text.length*s+2*d;Gy(e,v,f,a,t,g,i,v.isForbidden),Vn(e,v.text,f+d,l,t,v.isForbidden,"start"),t.itemPosition.push({x:f,itemWidth:g}),f+=g})}else{f+=u;const h=(o-(t.data.length*(2*u+n)+c))/(t.data.length-1),d=h>n?h:n;t.data.forEach((v,y)=>{const g=v.text.length*s;Yy(e,t,{x:f,y:l,radius:u},v.key,v.isForbidden),Vn(e,v.text,f+n+u,l,t,v.isForbidden,"start");const m=2*u+n+g;t.itemPosition.push({x:f-u,itemWidth:m}),f+=m+d})}}else if(t.direction=="vertical"){let s=a,u=r;if(t.theme=="button"){const c=i/t.data.length;u+=o/2,t.data.forEach((l,f)=>{Gy(e,l,r,s,t,o,c,l.isForbidden),Vn(e,l.text,u,s+c/2,t,l.isForbidden,"center"),s+=c})}else{const{fontSize:c}=t.calculative,l=c/2;t.textAlign,u+=n+l;const f=(i-t.data.length*c)/(t.data.length-1),h=f>n?f:n;s+=l,t.data.forEach((d,v)=>{const y=d.text.length*c;t.data[v].y=s,Yy(e,t,{x:u,y:s,radius:l},d.key,d.isForbidden),Vn(e,d.text,u+n+y/2,s,t,d.isForbidde,"center"),s+=2*l+h})}}}const Yy=(e,t,r,a,i)=>{if(e.beginPath(),e.arc(r.x,r.y,r.radius,0,Math.PI*2),t.selectKey==a){let o=t.background||"#4583FF";(i||t.disabled)&&(window.pSBC?o=t.disabledBackground||window.pSBC(.6,t.background||"#4583FF"):o=t.disabledBackground||"#20242A"),e.strokeStyle=o}else e.strokeStyle="#56595e";if(e.stroke(),e.closePath(),t.selectKey==a){e.beginPath();let o=t.background||"#4583FF";(i||t.disabled)&&(window.pSBC?o=t.disabledBackground||window.pSBC(.6,t.background||"#4583FF"):o=t.disabledBackground||"#20242A"),e.fillStyle=o,e.arc(r.x,r.y,r.radius*.5,0,Math.PI*2),e.fill(),e.closePath()}},Gy=(e,t,r,a,i,o,n,s)=>{if(t.key==i.selectKey){let u=i.background||"#272c33";(s||i.disabled)&&(window.pSBC?u=i.disabledBackground||(i.background?window.pSBC(.6,i.background):"#636363"):u=i.disabledBackground||"#636363"),e.fillStyle=u,e.fillRect(r,a,o,n),u=i.activeBackground||"RGBA(69,131,255,0.2)",(s||i.disabled)&&window.pSBC&&(u=window.pSBC(.6,u)),e.fillStyle=u}else e.fillStyle=i.background||"#272c33";e.fillRect(r,a,o,n)};function Vn(e,t,r,a,i,o,n){const{fontStyle:s,fontWeight:u,fontSize:c,fontFamily:l,lineHeight:f}=i.calculative;e.font=e.font=et({fontStyle:s,fontWeight:u,fontFamily:l||i.calculative.canvas.parent.store.options.fontFamily,fontSize:c,lineHeight:f}),e.textBaseline="middle",e.textAlign=n;let h=Zi(i)||"#FFFFFF";(o||i.disabled)&&(window.pSBC?h=i.disabledTextColor||window.pSBC(.6,i.color)||"rgba(255,255,255,0.26)":h=i.disabledTextColor||"rgba(255,255,255,0.26)"),e.fillStyle=h,e.fillText(t,r,a)}function vV(e,t){const{height:r,width:a,x:i,y:o}=e.calculative.worldRect;if(e.direction=="horizontal"){for(let n=0;n<e.data.length;n++)if(!e.data[n].isForbidden&&t.x>e.itemPosition[n].x&&t.x<e.itemPosition[n].x+e.itemPosition[n].itemWidth){e.selectKey=e.data[n].key,e.calculative.canvas.store.emitter.emit("valueUpdate",e);break}}else if(e.direction=="vertical")if(e.theme=="button"){const n=r/e.data.length;for(let s=0;s<e.data.length;s++)!e.data[s].isForbidden&&t.y>o+n*s&&t.y<o+n*(s+1)&&(e.selectKey=e.data[s].key,e.calculative.canvas.store.emitter.emit("valueUpdate",e))}else{const{fontSize:n}=e.calculative,s=n/2;for(let u=0;u<e.data.length;u++)!e.data[u].isForbidden&&t.y>e.data[u].y-s&&t.y<e.data[u].y+s&&(e.selectKey=e.data[u].key,e.calculative.canvas.store.emitter.emit("valueUpdate",e))}e.calculative.canvas.render()}function gV(e,t){let r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height,o=t.calculative.worldRect.width;t.data||(t.data=t.options,t.onMouseDown=void 0),t.options&&(delete t.options,t.onMouseDown=void 0),t.onMouseDown||(t.onMouseDown=yV);const n=8;if(t.itemPosition=[],t.direction=="horizontal"){const{fontSize:s}=t.calculative,u=s;let c=0;t.data.forEach((h,d)=>{c+=h.text.length*s});let l=a+(i-u)/2,f=r;if(t.theme=="button"){const h=(o-c)/(t.data.length*2),d=h>n?h:n;t.data.forEach((v,y)=>{const g=v.text.length*s+2*d;Qy(e,v,f,a,t,g,i,v.isForbidden),qn(e,v.text,f+g/2,l,t,v.isForbidden,"top","center"),t.itemPosition.push({x:f,itemWidth:g}),f+=g})}else{const h=(o-(t.data.length*(u+n)+c))/(t.data.length-1),d=h>n?h:n;t.data.forEach((v,y)=>{const g=v.text.length*s;Xy(e,t,{x:f,y:l,side:u},v.key,v.isForbidden),qn(e,v.text,f+n+u,l,t,v.isForbidden,"top","start");const m=u+n+g;t.itemPosition.push({x:f,itemWidth:m}),f+=m+d})}}else if(t.direction=="vertical")if(t.theme=="button"){const s=i/t.data.length,u=r+o/2;t.data.forEach((c,l)=>{const f=a+l*s;Qy(e,c,r,f,t,o,s,c.isForbidden),qn(e,c.text,u,f+s/2,t,c.isForbidden,"middle","center")})}else{const{fontSize:s}=t.calculative,u=s,c=(i-t.data.length*u)/(t.data.length-1),l=c>n?c:n;let f=a;t.data.forEach((h,d)=>{Xy(e,t,{x:r,y:f,side:u},h.key,h.isForbidden),qn(e,h.text,r+n+u,f,t,h.isForbidden,"top","start"),t.itemPosition.push({y:f}),f+=u+l})}}const Xy=(e,t,r,a,i)=>{const{x:o,y:n}=r,{fontSize:s}=t.calculative;if(e.strokeStyle="#313740",e.strokeRect(o,n,s,s),t.selectedKeys.includes(a)){let u=t.background||"#4583FF";(i||t.disabled)&&(u=t.disabledBackground||"#20242A",window.pSBC&&(u=t.disabledBackground||(t.background?window.pSBC(.6,t.background):"#20242A"))),e.fillStyle=u,e.fillRect(o,n,s,s),e.beginPath(),e.strokeStyle="#FFFFFF",e.moveTo(o+s*.3,n+s*.5),e.lineTo(o+s*.5,n+s*.7),e.lineTo(o+s*.7,n+s*.3),e.stroke(),e.closePath()}},Qy=(e,t,r,a,i,o,n,s)=>{s||i.disabled?window.pSBC?e.fillStyle=i.disabledBackground||window.pSBC(.6,i.background)||"#636363":e.fillStyle=i.disabledBackground||"#636363":i.selectedKeys.includes(t.key)?(e.fillStyle=i.background||"#272c33",e.fillRect(r,a,o,n),e.fillStyle=i.activeBackground||"RGBA(69,131,255,0.2)"):e.fillStyle=i.background||"#272c33",e.fillRect(r,a,o,n)};function qn(e,t,r,a,i,o,n,s){const{fontStyle:u,fontWeight:c,fontSize:l,fontFamily:f,lineHeight:h}=i.calculative;e.font=e.font=et({fontStyle:u,fontWeight:c,fontFamily:f||i.calculative.canvas.parent.store.options.fontFamily,fontSize:l,lineHeight:h}),e.textBaseline=n,e.textAlign=s;let d=Zi(i)||"#FFFFFF";(o||i.disabled)&&(window.pSBC?d=i.disabledTextColor||window.pSBC(.6,i.color)||"rgba(255,255,255,0.26)":d=i.disabledTextColor||"rgba(255,255,255,0.26)"),e.fillStyle=d,e.fillText(t,r,a)}function yV(e,t){const{height:r,y:a}=e.calculative.worldRect;if(e.direction=="horizontal"){for(let i=0;i<e.data.length;i++)if(!e.data[i].isForbidden&&t.x>e.itemPosition[i].x&&t.x<e.itemPosition[i].x+e.itemPosition[i].itemWidth){if(e.selectedKeys.includes(e.data[i].key)){const o=e.selectedKeys.findIndex(n=>n==e.data[i].key);e.selectedKeys.splice(o,1)}else e.selectedKeys.push(e.data[i].key);e.calculative.canvas.store.emitter.emit("valueUpdate",e)}}else if(e.direction=="vertical")if(e.theme=="button"){const i=r/e.data.length;for(let o=0;o<e.data.length;o++)if(!e.data[o].isForbidden&&t.y>a+i*o&&t.y<a+i*(o+1)){if(e.selectedKeys.includes(e.data[o].key)){const n=e.selectedKeys.findIndex(s=>s==e.data[o].key);e.selectedKeys.splice(n,1)}else e.selectedKeys.push(e.data[o].key);e.calculative.canvas.store.emitter.emit("valueUpdate",e)}}else{const{fontSize:i}=e.calculative;for(let o=0;o<e.data.length;o++)if(!e.data[o].isForbidden&&t.y>e.itemPosition[o].y&&t.y<e.itemPosition[o].y+i){if(e.selectedKeys.includes(e.data[o].key)){const n=e.selectedKeys.findIndex(s=>s==e.data[o].key);e.selectedKeys.splice(n,1)}else e.selectedKeys.push(e.data[o].key);e.calculative.canvas.store.emitter.emit("valueUpdate",e)}}e.calculative.canvas.render()}function g1(e,t){const{fontSize:r}=t.calculative;let a=t.calculative.worldRect.x+r/2,i=t.calculative.worldRect.y+r/2;t.onMouseDown||(t.onMouseDown=y1);const o=.4*r,n={small:2*r,medium:3*r};t.itemPosition=[];let s=Math.ceil(t.total/t.pageSize),u=t.maxPageBtn,c=[];if(u<5?u=5:u%2==0&&(u-=1),s<=u){c.push("pre");for(let d=1;d<=s;d++)c.push(d);c.push("next")}else if(t.current<u-1){let d=1;for(c.push("pre");c.length<u+3;)d<u?c.push(d++):c.push("...",s,"next")}else if(t.current>s-u+2){let d=s;for(c.push("next");c.length<u+3;)d>s-u+1?c.unshift(d--):c.unshift("pre",1,"...")}else{let d=u-2,v=t.current-Math.floor(d/2),y=v;for(;c.length<u+4;)c.length==0?c.push("pre",1,"..."):v<y+d?c.push(v++):c.push("...",s,"next")}let l=a,f=n[t.size]/2;const h=n[t.size]||n.medium;if(!t.position||t.position==="right"){let d=(c.length+3)*(o+h);l=t.calculative.worldRect.x+(t.calculative.worldRect.width-d)}for(let d of c)d=="pre"||d=="next"?Kn(e,l,i,t,h,d,d):d=="..."?Pa(e,d,l+f,i+f,t,!1):(Kn(e,l,i,t,h,d),t.current==d?Pa(e,d,l+f,i+f,t,!0):Pa(e,d,l+f,i+f,t,!1)),t.itemPosition.push({x:l,y:i,type:d}),l+=o+h;t.pageSizeOptions&&t.pageSizeOptions.length>0&&Kn(e,l,i,t,h,-1,"pageSizeSelect"),t.itemPosition.push({x:l,y:i,type:"pageSizeSelect"})}const Ec=(e,t,r)=>{e.beginPath(),e.strokeStyle=r.textColor||"RGBA(255,255,255,0.6)",e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineTo(t.x3,t.y3),e.stroke(),e.closePath()},Yu=(e,t,r,a,i,o,n,s=!0,u)=>{e.beginPath(),e.strokeStyle=t.current==u?t.activeColor||"#4583FF":t.color||"#313740",e.moveTo(r+i,a),e.arcTo(o,a,o,a+i,i),e.arcTo(o,n,o-i,n,i),e.arcTo(r,n,r,n-i,i),e.arcTo(r,a,r+i,a,i),s&&e.stroke(),t.current==u?e.fillStyle=t.activeBackground||"rgba(69,131,255,0.2)":e.fillStyle=t.background||"transparent",e.fill(),e.closePath()},Kn=(e,t,r,a,i,o,n)=>{let s=i,u=.1*i,c=t+i,l=r+i;if(Yu(e,a,t,r,u,n=="pageSizeSelect"?t+i*3:c,l,!0,o),n=="pre"){const f={x1:t+.6*i,x2:t+.4*i,x3:t+.6*i,y1:r+.35*i,y2:r+.5*i,y3:r+.65*i};Ec(e,f,a)}else if(n=="next"){const f={x1:t+.4*i,x2:t+.6*i,x3:t+.4*i,y1:r+.35*i,y2:r+.5*i,y3:r+.65*i};Ec(e,f,a)}else if(n=="pageSizeSelect"){s=i*3,c=t+s;const f={x1:t+.8*s,x2:t+.85*s,x3:t+.9*s,y1:r+.4*i,y2:r+.6*i,y3:r+.4*i};Ec(e,f,a),Pa(e,`${a.pageSize}条/页`,t+.4*s,r+i/2,a,!1),pV(e,t,r+i+10,s,i,a)}},pV=(e,t,r,a,i,o)=>{if(o.action=="showMenu"&&o.calculative.active){const n=o.pageSizeOptions.length*i+8,s=.1*i,u=t+a,c=r+n;Yu(e,o,t,r,s,u,c);let l=r+4,f=t+4,h=f+a-8,d=l+i;for(let v of o.pageSizeOptions)Yu(e,o,f,l,s,h,d,!1),o.pageSize==v?(e.fillStyle=o.activeBackground||"#001b52",e.fill(),Pa(e,`${v}条/页`,t+a/2,l+i/2,o,!0)):Pa(e,`${v}条/页`,t+a/2,l+i/2,o,!1),o.itemPosition.push({x:t,y:l,type:"menuItem",pageSize:v}),l=d,d=l+i}};function Pa(e,t,r,a,i,o){const{fontStyle:n,fontWeight:s,fontSize:u,fontFamily:c,lineHeight:l}=i.calculative;e.font=et({fontStyle:n,fontWeight:s,fontFamily:c||i.calculative.canvas.parent.store.options.fontFamily,fontSize:u,lineHeight:l}),e.textAlign="center",o?e.fillStyle=i.activeTextColor||"#4583FF":e.fillStyle=i.textColor||"RGBA(255,255,255,0.6)",e.fillText(t,r,a)}function y1(e,t){const{fontSize:r}=e.calculative,a={small:2*r,medium:3*r};e.action="";let i=Math.ceil(e.total/e.pageSize),o=e.itemPosition,n=a[e.size],s=n,u=!1;for(let c of o)c.type=="menuItem"||c.type=="pageSizeSelect"?s=n*3:s=n,t.x>=c.x&&t.x<=c.x+s&&t.y>=c.y&&t.y<=c.y+n&&(c.type=="pre"?(e.action="descend",e.current>1&&(e.current--,u=!0)):c.type=="next"?(e.action="increase",e.current<i&&(e.current++,u=!0)):c.type=="pageSizeSelect"?e.action="showMenu":c.type=="menuItem"?(e.pageSize!==c.pageSize&&(u=!0),e.pageSize=c.pageSize,Math.ceil(e.total/e.pageSize)<=e.current&&(e.current=1,u=!0)):isNaN(c.type)||(e.current<c.type?(u=!0,e.action="increase"):(e.action="descend",e.current!==parseInt(c.type)&&(u=!0)),e.current=parseInt(c.type)));e.pageChange=u,e.calculative.canvas.render()}function mV(e,t){let{x:r,y:a,width:i,height:o}=t.calculative.worldRect;const n=t.statusColor||{default:{titleColor:"#FFFFFF66",contentColor:"#FFFFFF66",iconColor:"#FFFFFF66"},finish:{titleColor:"#FFFFFFE6",contentColor:"#FFFFFF99",iconColor:"#4583FF"},process:{titleColor:"#4583FF",contentColor:"#FFFFFF99",iconColor:"#4583FF "},error:{titleColor:"#FF5D3C",contentColor:"#FFFFFF99",iconColor:"#FF5D3C"}},s=t.data||[];let u=t.calculative.canvas.store.data.scale,c=10*u;const{fontStyle:l,fontWeight:f,fontSize:h,fontFamily:d,lineHeight:v}=t.calculative;let y=t.theme=="dot"?4*u:12*u,g=s.length,m=0,w="left",p=y+c,x=0,T="#4583ff",A=y+c,I="",R=0;const z=[];r+=y+c,a+=y+c,e.font=et({fontStyle:l,fontWeight:f,fontSize:h,fontFamily:d,lineHeight:v}),t.direction=="vertical"?(x=0,A=0,m=(o-2*(c+y)*g)/(g-1),s.forEach(U=>{const _=e.measureText(U.title).width;z.push({lineOffset:y+c,textWidth:2*_})})):(p=0,t.theme=="dot"?(s.forEach(U=>{const _=e.measureText(U.title).width;z.push({lineOffset:y+c,textWidth:2*_})}),m=(i-2*(c+y)*g)/(g-1),w="center",x=y+c+h/2,p=0,A=0):(s.forEach(U=>{const _=e.measureText(U.title).width;z.push({lineOffset:_+c,textWidth:_}),R+=_}),m=(i-R-(3*c+2*y)*g)/(g-1),s.forEach(U=>{U.textWidth+=m}))),s.forEach((U,_)=>{T=I=n[U.status].iconColor;const k=z[_].textWidth,S=z[_].lineOffset;e.beginPath(),t.theme=="dot"?(U.status!="process"&&(T=void 0),Wt(e,{x:r,y:a,r:y},{strokeStyle:I,lineWidth:2,fillStyle:T})):(U.status!="process"&&(T=void 0),Wt(e,{x:r,y:a,r:y},{strokeStyle:I,fillStyle:T}),U.status=="finish"?(e.beginPath(),Ds(e,[{x:r-.4*y,y:a},{x:r,y:a+.4*y},{x:r+.5*y,y:a-.3*y}],{strokeStyle:I})):U.status=="error"?wV(e,{x:r,y:a,r:y},{strokeStyle:n[U.status].iconColor}):Jt(e,_+"",{x:r,y:a},{fillStyle:"#fff",textAlign:"center",textBaseline:"middle"})),r+=A,Jt(e,U.title,{x:r+p,y:a+x},{fillStyle:n[U.status].titleColor,textAlign:w,textBaseline:"middle"}),bV(e,U.content,{x:r+p,y:a+x+c},{fillStyle:n[U.status].contentColor,textAlign:w,textWidth:k,lineHeight:h,textBaseline:"top"});let P=a,B=r;t.direction=="vertical"?(a+=S,P=a+m):(r+=S,B=r+m),_!=s.length-1&&(e.beginPath(),Ds(e,[{x:r,y:a},{x:B,y:P}],{strokeStyle:"#4583FF",lineWidth:1}),t.direction!="vertical"?r+=m+c+y:a+=m+c+y)})}const Ds=(e,t,r)=>{const{x:a,y:i}=t.shift();e.moveTo(a,i);for(let o of t){const{x:n,y:s}=o;e.lineTo(n,s)}for(let[o,n]of Object.entries(r))e[o]=n;e.stroke()},bV=(e,t,r,a)=>{const{textWidth:i,lineHeight:o,textAlign:n,fillStyle:s,textBaseline:u}=a;let{x:c,y:l}=r,f="";if(e.measureText(t).width<=i)Jt(e,t,{x:c,y:l},{fillStyle:s,textBaseline:u});else{for(var h=0;h<t.length;h++)f+=t[h],e.measureText(f).width>i&&(Jt(e,f,{x:c,y:l},{fillStyle:s,textAlign:n,textBaseline:u}),l+=o,f="");Jt(e,f,{x:c,y:l},{fillStyle:s})}},wV=(e,t,r)=>{const{x:a,y:i,r:o}=t,{strokeStyle:n}=r;e.beginPath(),Ds(e,[{x:a-.4*o,y:i-.4*o},{x:a+.4*o,y:i+.4*o}],{strokeStyle:n}),e.beginPath(),Ds(e,[{x:a+.4*o,y:i-.4*o},{x:a-.4*o,y:i+.4*o}],{strokeStyle:n}),e.closePath()};function xV(e,t){let r=t.calculative.borderRadius||0,a=r;const{x:i,y:o,width:n,height:s,ex:u,ey:c}=t.calculative.worldRect;r<1&&(r=n*r,a=s*a);let l=r<a?r:a;n<2*l&&(l=n/2),s<2*l&&(l=s/2);const{fontStyle:f,fontWeight:h,fontSize:d,fontFamily:v,lineHeight:y}=t.calculative;e.font=et({fontStyle:f,fontWeight:t.headingWeight||h,fontFamily:v||t.calculative.canvas.parent.store.options.fontFamily,fontSize:t.headingSize*t.calculative.canvas.store.data.scale||d,lineHeight:y}),e.moveTo(i+l,o),e.arcTo(u,o,u,c,l),e.arcTo(u,c,i,c,l),e.arcTo(i,c,i,o,l),e.arcTo(i,o,u,o,l),e.fill(),e.save(),e.textAlign="start",e.textBaseline="middle",e.fillStyle=t.headingColor||t.textColor||t.color,e.fillText(t.heading,i+t.textLeft*t.calculative.canvas.store.data.scale,o+(t.iconTop+t.iconSize/2)*t.calculative.canvas.store.data.scale),e.restore()}function CV(e,t){let{x:r,y:a,width:i,height:o,ex:n,ey:s}=t.calculative.worldRect;if(!t.data||!Array.isArray(t.data))return;let u=t.calculative.borderRadius||0,c=u;u<1&&(u=i*u,c=o*c);let l=u<c?u:c;i<2*l&&(l=i/2),o<2*l&&(l=o/2);let f=o/t.data.length;const{fontStyle:h,fontWeight:d,fontSize:v,fontFamily:y,lineHeight:g}=t.calculative,m={fontStyle:h,fontWeight:d,fontFamily:y||t.calculative.canvas.parent.store.options.fontFamily,fontSize:v,lineHeight:g},w=t.borderWidth,p="start";let x=t.calculative.canvas.store.data.scale,T=10,A;t.data.forEach((I,R)=>{let z=a+f*R,U=f-T*x;e.beginPath(),e.fillStyle=t.background||"#282E3B",e.strokeStyle=t.borderColor||"#424B61",e.moveTo(r+l,z),e.arcTo(n,z,n,z+U,l),e.arcTo(n,z+U,r,z+U,l),e.arcTo(r,z+U,r,z,l),e.arcTo(r,z,n,z,l),w&&e.stroke(),Gi(e,{blur:30,shadowColor:"#0000000D"}),e.fill(),Gi(e,{blur:0});let _=10,k=20;if(t.iconSize||40*x,I.image,e.beginPath(),I.title){A=t.headingColor||t.textColor||t.color||"#FFFFFFE6";let S={fontStyle:h,fontWeight:d,fontFamily:y||t.calculative.canvas.parent.store.options.fontFamily,fontSize:(t.headingSize||v)*x,lineHeight:g};Jt(e,I.title,{x:r+_*x,y:z+k*x},{textAlign:p,textBaseline:"middle",fillStyle:A},S),k+=(t.headingSize||v)*g}e.beginPath(),I.description&&(A=Zi(t)||"#FFFFFF99",Jt(e,I.description,{x:r+_*x,y:z+k*x},{textAlign:p,textBaseline:"middle",fillStyle:A},m))})}function kV(e,t){let r=t.calculative.worldRect.x,a=t.calculative.worldRect.y;t.onMouseDown=SV;const i=t.data||[],{fontStyle:o,fontWeight:n,fontSize:s,fontFamily:u,lineHeight:c}=t.calculative,l=Zi(t)||"RGBA(255,255,255,0.6)",f=t.expanded||[],h=1.5*s,d=1.4*s;let v=t.expandAll||!1;t.itemPosition=p1(e,i,{color:l,itemHeight:h,expandAll:v,textMarginLeft:d},{fontStyle:o,fontWeight:n,fontSize:s,fontFamily:u,lineHeight:c},{x:r+s,y:a+s},f)}const p1=(e,t,r,a,i,o,n)=>{let{x:s,y:u}=i;const{fontSize:c}=a,{color:l,itemHeight:f,expandAll:h,textMarginLeft:d}=r,v=[];return t.forEach((y,g)=>{if(_V(e,y.label,{x:s+d,y:u},a,l),v.push({x:s,y:u,key:y.key}),y.children&&y.children.length>0)if(o.includes(y.key)||h){y.children.length*c;const m={x1:s+.2*c,x2:s+.5*c,x3:s+.8*c,y1:u+.3*c,y2:u+.6*c,y3:u+.3*c};Jy(e,m,l),v.push(...p1(e,y.children,r,a,{x:s+c,y:u+f},o))}else{const m={x1:s+.3*c,x2:s+.6*c,x3:s+.3*c,y1:u+.1*c,y2:u+.4*c,y3:u+.7*c};Jy(e,m,l)}u=v.at(-1).y+f}),v},Jy=(e,t,r)=>{e.strokeStyle=r,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineTo(t.x3,t.y3),e.fillStyle=r,e.fill(),e.closePath()};function _V(e,t,r,a,i){const{x:o,y:n}=r;e.font=et(a),e.textBaseline="top",e.textAlign="left",e.fillStyle=i,e.fillText(t,o,n)}function SV(e,t){const r=e.itemPosition||[],{fontSize:a}=e.calculative;for(let i of r)if(t.x>=i.x&&t.x<=i.x+a&&t.y>=i.y&&t.y<=i.y+a){const o=e.expanded.indexOf(i.key);o!=-1?e.expanded.splice(o,1):e.expanded.push(i.key)}}function TV(e,t){let{width:r,height:a,x:i,y:o}=t.calculative.worldRect;t.onClick||(t.onClick=AV);const n=1/6*r,s=3/32*a,u=r/a>.5625?1/16*a:1/9*r;ui(e,{x:i,y:o,w:r,h:a},{strokeStyle:t.color,fillStyle:t.background}),ui(e,{x:i+n,y:o+s,w:r-n*2,h:a-s*2},{strokeStyle:t.color}),t.checked?(ui(e,{x:i+n,y:o+s,w:r-n*2,h:s},{fillStyle:t.background,strokeStyle:t.color}),e.lineWidth=t.lineWidth*2,Wt(e,{x:i+r/2,y:o+3/8*a,r:u},{strokeStyle:t.color}),Gi(e,{blur:8,shadowColor:t.onShadowColor}),e.beginPath(),e.strokeStyle=t.onColor,e.moveTo(i+r/2,o+a-7/32*a),e.lineTo(i+r/2,o+a-7/32*a-1/8*a),e.stroke()):(ui(e,{x:i+n,y:o+s,w:r-n*2,h:a-3*s},{fillStyle:t.background,strokeStyle:t.color}),e.lineWidth=t.lineWidth*2,e.strokeStyle=t.color,e.moveTo(i+r/2,o+a-7/32*a-s),e.lineTo(i+r/2,o+a-7/32*a-1/8*a-s),e.stroke(),e.beginPath(),Gi(e,{blur:8,shadowColor:t.offShadowColor}),Wt(e,{x:i+r/2,y:o+3/8*a-s,r:u},{strokeStyle:t.offColor}))}function AV(e){e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function EV(e,t){let{width:r,height:a,x:i,y:o}=t.calculative.worldRect;const n=r>a?a/2:r/2,s={x:i+r/2,y:o+a/2,r:n};t.onClick||(t.onClick=RV);let u=t.background||"rgba(69,131,255,0.2)",c=t.color||"#4583FF",l=t.checked?t.onColor:c,f=t.checked?c:t.offColor,h=t.checked?t.onShadowColor:t.offShadowColor;Wt(e,s,{fillStyle:u,strokeStyle:c}),e.beginPath(),Wt(e,{...s,r:n*.75},{fillStyle:u,strokeStyle:c}),t.checked||Gi(e,{blur:8,shadowColor:h}),e.beginPath(),e.lineWidth=t.lineWidth*2,Wt(e,{x:s.x,y:s.y-.25*n,r:n*.125},{strokeStyle:f}),t.checked?Gi(e,{blur:8,shadowColor:h}):Gi(e,{blur:0}),PV(e,{y1:s.y+.5*n,y:s.y+.25*n,x:s.x},{lineColor:l})}const PV=(e,t,r)=>{const{x:a,y:i,y1:o}=t,{lineColor:n}=r;e.beginPath(),e.moveTo(a,i),e.lineTo(a,o),e.strokeStyle=n,e.stroke(),e.closePath()};function RV(e){e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function IV(e,t){let{x:r,y:a,height:i,width:o}=t.calculative.worldRect;const{fontSize:n,fontFamily:s,fontWeight:u,fontStyle:c,lineHeight:l}=t.calculative,f=t.data||[],h=t.gap||n;t.itemPosition=[],a+=i/2,r+=o*.05,t.onMouseDown||(t.onMouseDown=LV);const d=n/4,v=h/2;e.font=et({fontStyle:c,fontWeight:u,fontFamily:s,fontSize:n,lineHeight:l}),f.forEach((y,g)=>{const m=e.measureText(y.title).width;let w=Zi(t)||"RGBA(255,255,255,0.6)",p="";t.selectKey==y.key?p=t.activeTextColor||"#4583FF":p=w,Jt(e,y.title,{x:r,y:a},{fillStyle:p,textBaseline:"middle"});const x=r+m+v,T={x1:x,x2:x+d,x3:x,y1:a-.3*n,y2:a,y3:a+.3*n};g!=f.length-1&&MV(e,T,{color:w}),t.itemPosition.push({x:r,w:m}),r=x+d+v})}const MV=(e,t,r)=>{const{x1:a,x2:i,x3:o,y1:n,y2:s,y3:u}=t,{color:c}=r;e.strokeStyle=c,e.beginPath(),e.moveTo(a,n),e.lineTo(i,s),e.lineTo(o,u),e.stroke(),e.closePath()};function LV(e,t){const r=e.itemPosition||[];e.data.forEach((a,i)=>{const{x:o,w:n}=r[i];if(t.x>=o&&t.x<=o+n){e.selectKey=a.key,e.calculative.canvas.store.data.locked&&a.to&&window.open(a.to,a.target||"_blank"),e.calculative.canvas.store.emitter.emit("valueUpdate",e);return}}),e.calculative.canvas.render()}function OV(e,t){let{width:r,height:a,x:i,y:o}=t.calculative.worldRect;const n=r>a?a*.28125:r*.28125,s={x:i+r/2,y:o+a/2,r:n};t.onClick||(t.onClick=FV);let u={x:i+r,y:s.y-.4444*n,centerX:s.x,centerY:s.y,x1:i+r,y1:s.y+.4444*n,startAngle:-.5*Math.PI,endAngle:-1.5*Math.PI,r:.4444*n},c={start:+Math.asin(4/9),end:-Math.asin(4/9)},l={x:u.x,y:u.y,w:-r/2+Math.cos(Math.asin(4/9))*n,h:.8888*n},f=t.background||"rgba(69,131,255,0.2)",h=t.color||"#4583FF",d=t.checked?t.onColor:h,v=t.checked?h:t.offColor,y=t.checked?t.onShadowColor:t.offShadowColor;t.checked&&(u={x:s.x+.4444*n,y:o+a,centerX:s.x,centerY:s.y,x1:s.x-.4444*n,y1:o+a,startAngle:0,endAngle:-1*Math.PI,r:.4444*n},c={start:.5*Math.PI+Math.asin(4/9),end:.5*Math.PI-Math.asin(4/9)},l={x:u.x1,y:u.y,h:-a/2+Math.cos(Math.asin(4/9))*n,w:.8888*n}),ui(e,{x:i,y:o,w:r,h:a},{fillStyle:f,strokeStyle:h}),DV(e,{...u},{strokeStyle:h}),ui(e,l,{fillStyle:f}),e.beginPath(),Wt(e,s,{fillStyle:f,strokeStyle:h,startAngle:c.start,endAngle:c.end}),e.beginPath(),e.lineWidth=t.lineWidth*2,t.checked||Pc(e,{blur:8,shadowColor:y}),Wt(e,{x:i+.3889*n,y:s.y,r:n*.17},{strokeStyle:v}),t.checked?Pc(e,{blur:8,shadowColor:y}):Pc(e,{blur:0}),BV(e,{y1:o+.5556*n,y:o+.2222*n,x:s.x},{lineColor:d})}const DV=(e,t,r)=>{const{x:a,y:i,centerX:o,centerY:n,x1:s,y1:u,startAngle:c,endAngle:l,r:f}=t,{strokeStyle:h}=r;e.strokeStyle=h,e.beginPath(),e.moveTo(a,i),e.arc(o,n,f,c,l,!0),e.lineTo(s,u),e.stroke(),e.closePath()},BV=(e,t,r)=>{const{x:a,y:i,y1:o}=t,{lineColor:n}=r;e.beginPath(),e.moveTo(a,i),e.lineTo(a,o),e.strokeStyle=n,e.stroke(),e.closePath()},Pc=(e,t)=>{const{shadowColor:r,blur:a}=t;e.shadowBlur=a,e.shadowColor=r};function FV(e){e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function NV(e,t){var r;if(t.onDestroy||(t.onDestroy=WV,t.onMove=Rc,t.onResize=Rc,t.onRotate=Rc,t.onBeforeValue=UV,t.onValue=VV),t.calculative.singleton||(t.calculative.singleton={}),t.calculative.singleton.div)t.calculative.patchFlags&&ye(t);else{const a=document.createElement("div");let i=document.createElement("video");i.id="video",i.muted=!0,i.controls=!0,i.autoplay=!0,i.style.position="absolute",i.style.outline="none",i.style.left="0",i.style.top="0",i.style.width="100%",i.style.height="100%",a.appendChild(i),t.calculative.singleton.div=a,setTimeout(()=>{t.mse?b1(t):m1(t)},500),(r=t.calculative.canvas.externalElements)==null||r.parentElement.appendChild(a),ye(t)}}function m1(e){const t=e.calculative.singleton;t.stream=new MediaStream,t.div.children[0].srcObject=t.stream,t.connection&&t.connection.close();const r=new RTCPeerConnection({iceServers:[{urls:["stun:stun.l.google.com:19302"]}]});r.addTransceiver("video",{direction:"sendrecv"}),r.addTransceiver("audio",{direction:"sendrecv"}),r.onnegotiationneeded=async()=>{let a=await r.createOffer();await r.setLocalDescription(a);const i=await fetch(e.url||location.host+"/api/rtsp/webrtc",{method:"POST",body:JSON.stringify({rtspUrl:e.rtspUrl,sdp:btoa(r.localDescription.sdp)})});if(i.ok){let o=await i.text();if(typeof o=="string")try{o=JSON.parse(o)}catch(n){console.warn("Invalid socket data:",o,n)}r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:atob(o.sdp)}))}},r.ontrack=a=>{t.stream.addTrack(a.track)},t.connection=r}function b1(e){const t=e.calculative.singleton;t&&(t.buf=new Uint8Array(2*1024*1024),t.bufLen=0,t.player=t.div.children[0],t.player.onpause=zV(e),t.player.onplay=HV(e),t.mediaSource=new MediaSource,t.player.src=URL.createObjectURL(t.mediaSource),t.mediaSource.addEventListener("sourceopen",()=>{const r=location.protocol==="https:"?"wss":"ws";let a=new WebSocket((e.url||r+"://"+location.host+"/ws/rtsp/mse")+"?url="+encodeURIComponent(e.rtspUrl));a.binaryType="arraybuffer",a.onopen=i=>{console.log("MSE: Connect to ws")},t.ws=a,a.onmessage=function(i){let o=new Uint8Array(i.data);if(o[0]==9){const n=new TextDecoder("utf-8").decode(o.slice(1));n.indexOf(",")>0?t.videoSound=!0:t.videoSound=!1,t.sourceBuffer=t.mediaSource.addSourceBuffer(`video/mp4; codecs="${n}"`),t.sourceBuffer.mode="segments",t.sourceBuffer.addEventListener("updateend",jV(e))}else $V(i.data,e)}},!1))}function $V(e,t){const r=t.calculative.singleton;if(r&&r.sourceBuffer)if(r.sourceBuffer.updating||r.bufLen>0){const a=new Uint8Array(e);r.buf.set(a,r.bufLen),r.bufLen+=a.byteLength}else r.sourceBuffer.appendBuffer(e)}const jV=e=>{const t=e.calculative.singleton;if(t&&t.sourceBuffer&&!t.sourceBuffer.updating){if(t.bufLen>0){const r=t.buf.slice(0,t.bufLen);t.bufLen=0,t.sourceBuffer.appendBuffer(r)}t.player.buffered.length>0&&document.hidden&&!t.videoSound&&(t.player.currentTime=t.player.buffered.end(t.player.buffered.length-1)+1)}};function zV(e){const t=e.calculative.singleton;t&&(t.isPause=!0)}function HV(e){const t=e.calculative.singleton;t&&t.isPause&&(t.isPause=!1,t.player.buffered.length>0&&(t.player.currentTime=t.player.buffered.end(t.player.buffered.length-1)+1))}function WV(e){var r,a;const t=e.calculative.singleton;t&&t.div&&(e.mse?(t.ws&&(t.ws.onopen=null,t.ws.onmessage=null),(r=t.ws)==null||r.close(),t.ws=null,t.sourceBuffer=null,t.videoSound=null,t.player=null,t.bufLen=null,t.buf=null,t.mediaSource=null,t.isPause=null):(t.stream=null,(a=t.connection)==null||a.close(),t.connection=null),t.div.remove(),t.div=null)}function Rc(e){ye(e)}function UV(e,t){return e.calculative.reload=!1,(t.url!==void 0||t.rtspUrl!==void 0||t.url!==void 0||t.mse!==void 0)&&(e.calculative.reload=!0),t}function VV(e){e.calculative.reload&&(qV(e),e.mse?b1(e):m1(e),delete e.calculative.reload)}function qV(e){var r,a;const t=e.calculative.singleton;e.mse?(t.ws&&(t.ws.onopen=null,t.ws.onmessage=null),(r=t.ws)==null||r.close(),t.ws=null,t.mediaSource=null,t.buf=null,t.bufLen=null,t.player=null,t.videoSound=null,t.sourceBuffer=null,t.isPause=null):(t.stream=null,(a=t.connection)==null||a.close(),t.connection=null)}function KV(e,t){const{x:r,y:a,width:i,height:o,ex:n,ey:s}=t.calculative.worldRect;let u=t.calculative.borderRadius||0,c=u;u<1&&(u=i*u,c=o*c);let l=u<c?u:c;i<2*l&&(l=i/2),o<2*l&&(l=o/2);let f=.1;e.beginPath(),e.moveTo(r+1/3*i+l,a),e.arcTo(r+2/3*i,a,r+2/3*i,a+f*o,l),e.lineTo(r+2/3*i,a+f*o),e.lineTo(r+1/3*i,a+f*o),e.arcTo(r+1/3*i,a,r+2/3*i,a,l),e.stroke(),e.fill(),e.beginPath(),e.moveTo(r+l,a+f*o),e.arcTo(n,a+f*o,n,s,l),e.arcTo(n,s,r,s,l),e.arcTo(r,s,r,a+f*o,l),e.arcTo(r,a+f*o,n,a+f*o,l),e.stroke(),e.fill();let h=i*(t.gap||.1),d=t.splitNumber||5,v=t.min||0,y=t.max||1,g=t.calculative.progress||0,m=Math.round((g-v)/((y-v)/d)),w=i-2*h,p=((1-f)*o-(d+1)*h)/d;e.save(),e.fillStyle=t.calculative.progressColor||"green";for(let x=0;x<d;x++)x<d-m||(e.beginPath(),e.rect(r+h,a+f*o+h+x*(p+h),w,p),e.fill());e.restore()}var Zy;(function(e){e[e.Node=0]="Node",e[e.Line=1]="Line"})(Zy||(Zy={}));var e0;(function(e){e[e.None=0]="None",e[e.DisableEdit=1]="DisableEdit",e[e.DisableMove=2]="DisableMove",e[e.DisableScale=3]="DisableScale",e[e.DisableMoveScale=4]="DisableMoveScale",e[e.Disable=10]="Disable"})(e0||(e0={}));var t0;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out"})(t0||(t0={}));var r0;(function(e){e[e.None=0]="None",e[e.Linear=1]="Linear",e[e.Radial=2]="Radial"})(r0||(r0={}));var i0;(function(e){e[e.CanvasTemplate=1]="CanvasTemplate",e[e.CanvasImageBottom=2]="CanvasImageBottom",e[e.CanvasMain=3]="CanvasMain",e[e.CanvasImage=4]="CanvasImage"})(i0||(i0={}));var a0;(function(e){e[e.Normal=0]="Normal",e[e.Beads=1]="Beads",e[e.Dot=2]="Dot",e[e.Arrow=3]="Arrow",e[e.WaterDrop=4]="WaterDrop"})(a0||(a0={}));var o0;(function(e){e[e.None=0]="None",e[e.LineAnchor=1]="LineAnchor",e[e.NodeAnchor=2]="NodeAnchor",e[e.Line=3]="Line",e[e.Node=4]="Node",e[e.Resize=5]="Resize",e[e.Rotate=6]="Rotate",e[e.LineAnchorPrev=7]="LineAnchorPrev",e[e.LineAnchorNext=8]="LineAnchorNext"})(o0||(o0={}));var n0;(function(e){e[e.None=0]="None",e[e.Translate=1]="Translate",e[e.Select=2]="Select",e[e.Resize=3]="Resize",e[e.AddAnchor=4]="AddAnchor"})(n0||(n0={}));var s0;(function(e){e[e.None=0]="None",e[e.Down=1]="Down",e[e.Translate=2]="Translate"})(s0||(s0={}));var l0;(function(e){e[e.None=-1]="None",e[e.Up=0]="Up",e[e.Right=1]="Right",e[e.Bottom=2]="Bottom",e[e.Left=3]="Left"})(l0||(l0={}));var c0;(function(e){e[e.Mirror=0]="Mirror",e[e.Bilateral=1]="Bilateral",e[e.Free=2]="Free"})(c0||(c0={}));var u0;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out",e[e.DisableConnected=3]="DisableConnected",e[e.DisableConnectTo=4]="DisableConnectTo",e[e.Disable=10]="Disable"})(u0||(u0={}));var f0;(function(e){e[e.Default=0]="Default",e[e.Line=1]="Line"})(f0||(f0={}));var Gu;(function(e){e[e.None=-1]="None",e[e.Document=0]="Document",e[e.Canvas=1]="Canvas"})(Gu||(Gu={}));Gu.Document;var h0;(function(e){e[e.Add=0]="Add",e[e.Update=1]="Update",e[e.Delete=2]="Delete",e[e.Replace=3]="Replace"})(h0||(h0={}));function YV(e,t=e.calculative.text){if(t==null){e.calculative.textLines=[];return}t=t.toString();let r=[];const a=e.calculative.fontSize*e.calculative.lineHeight,i=e.calculative.worldTextRect.height,o=Math.floor(i/a),n=o>1?o:1;switch(e.whiteSpace){case"nowrap":if(e.ellipsis!==!1){const l=d0(t.split(""),e);l[0]&&(r.push(l[0]),l.length>1&&Ic(r))}else r.push(t);break;case"pre-line":r=t.split(/[\n]/g),e.ellipsis!==!1&&r.length>n&&(r=r.slice(0,n),Ic(r));break;case"break-all":default:const u=t.split(/[\n]/g);let c=0;e:for(const l of u){const f=e.whiteSpace==="break-all"?l.split(""):GV(l);let h=d0(f,e);if(h.length===0&&(h=[""]),e.ellipsis!=!1)for(const d of h)if(c++,c>n){Ic(r);break e}else r.push(d);else r.push(...h)}break}const s=e.calculative.keepDecimal;return s!=null&&r.forEach((u,c)=>{const l=Number(u);isNaN(l)||(r[c]=l.toFixed(s))}),e.calculative.textLines=r,r}function GV(e=""){const t=[];let r="";for(let a=0;a<e.length;++a){const i=e.charCodeAt(a);i<33||i>126?(r&&(t.push(r),r=""),t.push(e[a])):r+=e[a]}return r&&t.push(r),t}function d0(e,t){const r=t.calculative.canvas,a=r.offscreen.getContext("2d"),{fontStyle:i,fontWeight:o,fontSize:n,fontFamily:s,lineHeight:u}=t.calculative;a.save();const c=[];let l=e[0]||"";for(let f=1;f<e.length;++f){const h=e[f]||"",d=l+h;let v=0;if(r.store.options.measureTextWidth)a.font=QV({fontStyle:i,fontWeight:o,fontFamily:s||r.store.options.fontFamily,fontSize:n,lineHeight:u}),v=a.measureText(d).width;else{const g=d.match(/[^\x00-\xff]/g)||"",m=g.length*n,w=d.match(/\s/g)||"",p=w.length*n*.3,x=(d.length-g.length-w.length)*n*.6;v=m+p+x}const y=t.calculative.worldTextRect.width;v<=y+.1?l+=h:(l.length&&c.push(l),l=h)}return l.length&&c.push(l),a.restore(),c}function Ic(e){e[e.length-1]=e[e.length-1].slice(0,-3)+"..."}function rt(e,t=!1){if(Array.isArray(e)){const r=[];return e.forEach(a=>{r.push(rt(a,t))}),r}else if(typeof e=="object"){if(e===null)return null;if(e.constructor===RegExp)return e;const r={};for(const a in e)if(!(["canvas","lastFrame"].includes(a)||e[a]instanceof HTMLImageElement||e[a]instanceof HTMLMediaElement)){{if(a==="calculative"&&!t)continue;if(a==="singleton"){t?r[a]={}:r[a]=e[a];continue}}r[a]=rt(e[a],t)}return r}return e}function v0(e){const t=parseInt,r=Math.round;let a=e.length,i={};if(a>9){const[o,n,s,u]=e=e.split(",");if(a=e.length,a<3||a>4)return null;i.r=t(o[3]=="a"?o.slice(5):o.slice(4)),i.g=t(n),i.b=t(s),i.a=u?parseFloat(u):-1}else{if(a==8||a==6||a<4)return null;a<6&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(a>4?e[4]+e[4]:"")),e=t(e.slice(1),16),a==9||a==5?(i.r=e>>24&255,i.g=e>>16&255,i.b=e>>8&255,i.a=r((e&255)/.255)/1e3):(i.r=e>>16,i.g=e>>8&255,i.b=e&255,i.a=-1)}return i}function XV(e,t,r,a){let i,o,n,s,u,c,l,f=Math.round,h=typeof r=="string";return typeof e!="number"||e<-1||e>1||typeof t!="string"||t[0]!="r"&&t[0]!="#"||r&&!h||(l=t.length>9,l=h?r.length>9?!0:r=="c"?!l:!1:l,u=v0(t),s=e<0,c=r&&r!="c"?v0(r):s?{r:0,g:0,b:0,a:-1}:{r:255,g:255,b:255,a:-1},e=s?e*-1:e,s=1-e,!u||!c)?null:(a?(i=f(s*u.r+e*c.r),o=f(s*u.g+e*c.g),n=f(s*u.b+e*c.b)):(i=f((s*u.r**2+e*c.r**2)**.5),o=f((s*u.g**2+e*c.g**2)**.5),n=f((s*u.b**2+e*c.b**2)**.5)),h=u.a,c=c.a,u=h>=0||c>=0,h=u?h<0?c:c<0?h:h*s+c*e:0,l?"rgb"+(u?"a(":"(")+i+","+o+","+n+(u?","+f(h*1e3)/1e3:"")+")":"#"+(4294967296+i*16777216+o*65536+n*256+(u?f(h*255):0)).toString(16).slice(1,u?void 0:-2))}globalThis.pSBC=XV;function QV({fontStyle:e="normal",textDecoration:t="normal",fontWeight:r="normal",fontSize:a=12,fontFamily:i="Arial",lineHeight:o=1}={}){return`${e} ${t} ${r} ${a}px/${o} ${i}`}function g0(e){e.center||(e.center={}),e.center.x=e.x+e.width/2,e.center.y=e.y+e.height/2}function Xu(e){e.ex=e.x+e.width,e.ey=e.y+e.height}var y0;(function(e){e[e.Link=0]="Link",e[e.SetProps=1]="SetProps",e[e.StartAnimate=2]="StartAnimate",e[e.PauseAnimate=3]="PauseAnimate",e[e.StopAnimate=4]="StopAnimate",e[e.JS=5]="JS",e[e.GlobalFn=6]="GlobalFn",e[e.Emit=7]="Emit",e[e.StartVideo=8]="StartVideo",e[e.PauseVideo=9]="PauseVideo",e[e.StopVideo=10]="StopVideo",e[e.SendPropData=11]="SendPropData",e[e.SendVarData=12]="SendVarData",e[e.Navigator=13]="Navigator",e[e.Dialog=14]="Dialog",e[e.SendData=15]="SendData",e[e.PostMessage=16]="PostMessage",e[e.PostMessageToParent=17]="PostMessageToParent"})(y0||(y0={}));var JV={exports:{}};(function(e,t){(function(r){e.exports=r()})(function(){return function(){return function r(a,i,o){function n(c,l){if(!i[c]){if(!a[c]){var f=typeof li=="function"&&li;if(!l&&f)return f(c,!0);if(s)return s(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var d=i[c]={exports:{}};a[c][0].call(d.exports,function(v){return n(a[c][1][v]||v)},d,d.exports,r,a,i,o)}return i[c].exports}for(var s=typeof li=="function"&&li,u=0;u<o.length;u++)n(o[u]);return n}}()({1:[function(r,a,i){(function(o,n){(function(){const s=r("events").EventEmitter,u=r("./store"),c=r("./topic-alias-recv"),l=r("./topic-alias-send"),f=r("mqtt-packet"),h=r("./default-message-id-provider"),d=r("readable-stream").Writable,v=r("inherits"),y=r("reinterval"),g=r("rfdc/default"),m=r("./validations"),w=r("xtend"),p=r("debug")("mqttjs:client"),x=o?o.nextTick:function(S){setTimeout(S,0)},T=n.setImmediate||function(S){x(S)},A={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},I={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function R(S,P){let B;P.properties&&(B=P.properties.topicAlias);let D=P.topic.toString();if(D.length===0){if(B===void 0)return new Error("Unregistered Topic Alias");if((D=S.topicAliasSend.getTopicByAlias(B))===void 0)return new Error("Unregistered Topic Alias");P.topic=D}B&&delete P.properties.topicAlias}function z(S,P,B){p("sendPacket :: packet: %O",P),p("sendPacket :: emitting `packetsend`"),S.emit("packetsend",P),p("sendPacket :: writing to stream");const D=f.writeToStream(P,S.stream,S.options);p("sendPacket :: writeToStream result %s",D),!D&&B&&B!==_?(p("sendPacket :: handle events on `drain` once through callback."),S.stream.once("drain",B)):B&&(p("sendPacket :: invoking cb"),B())}function U(S,P,B,D){p("storeAndSend :: store packet with cmd %s to outgoingStore",P.cmd);let H,L=P;if(L.cmd==="publish"&&(L=g(P),H=R(S,L)))return B&&B(H);S.outgoingStore.put(L,function(M){if(M)return B&&B(M);D(),z(S,P,B)})}function _(S){p("nop ::",S)}function k(S,P){let B;const D=this;if(!(this instanceof k))return new k(S,P);for(B in this.options=P||{},A)this.options[B]===void 0?this.options[B]=A[B]:this.options[B]=P[B];p("MqttClient :: options.protocol",P.protocol),p("MqttClient :: options.protocolVersion",P.protocolVersion),p("MqttClient :: options.username",P.username),p("MqttClient :: options.keepalive",P.keepalive),p("MqttClient :: options.reconnectPeriod",P.reconnectPeriod),p("MqttClient :: options.rejectUnauthorized",P.rejectUnauthorized),p("MqttClient :: options.topicAliasMaximum",P.topicAliasMaximum),this.options.clientId=typeof P.clientId=="string"?P.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),p("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=P.protocolVersion===5&&P.customHandleAcks?P.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=S,this.messageIdProvider=this.options.messageIdProvider===void 0?new h:this.options.messageIdProvider,this.outgoingStore=P.outgoingStore||new u,this.incomingStore=P.incomingStore||new u,this.queueQoSZero=P.queueQoSZero===void 0||P.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,P.topicAliasMaximum>0&&(P.topicAliasMaximum>65535?p("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new c(P.topicAliasMaximum)),this.on("connect",function(){const H=this.queue;p("connect :: sending queued packets"),function L(){const M=H.shift();p("deliver :: entry %o",M);let j=null;if(!M)return void D._resubscribe();j=M.packet,p("deliver :: call _sendPacket for %o",j);let W=!0;j.messageId&&j.messageId!==0&&(D.messageIdProvider.register(j.messageId)||(W=!1)),W?D._sendPacket(j,function(F){M.cb&&M.cb(F),L()}):(p("messageId: %d has already used. The message is skipped and removed.",j.messageId),L())}()}),this.on("close",function(){p("close :: connected set to `false`"),this.connected=!1,p("close :: clearing connackTimer"),clearTimeout(this.connackTimer),p("close :: clearing ping timer"),D.pingTimer!==null&&(D.pingTimer.clear(),D.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),p("close :: calling _setupReconnect"),this._setupReconnect()}),s.call(this),p("MqttClient :: setting up stream"),this._setupStream()}v(k,s),k.prototype._setupStream=function(){const S=this,P=new d,B=f.parser(this.options);let D=null;const H=[];function L(){if(H.length)x(M);else{const W=D;D=null,W()}}function M(){p("work :: getting next packet in queue");const W=H.shift();if(W)p("work :: packet pulled from queue"),S._handlePacket(W,L);else{p("work :: no packets in queue");const F=D;D=null,p("work :: done flag is %s",!!F),F&&F()}}p("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),p("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),B.on("packet",function(W){p("parser :: on packet push to packets array."),H.push(W)}),P._write=function(W,F,V){D=V,p("writable stream :: parsing buffer"),B.parse(W),M()},p("_setupStream :: pipe stream to writable stream"),this.stream.pipe(P),this.stream.on("error",function(W){p("streamErrorHandler :: error",W.message),W.code?(p("streamErrorHandler :: emitting error"),S.emit("error",W)):_(W)}),this.stream.on("close",function(){var W;p("(%s)stream :: on close",S.options.clientId),(W=S.outgoing)&&(p("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(W).forEach(function(F){W[F].volatile&&typeof W[F].cb=="function"&&(W[F].cb(new Error("Connection closed")),delete W[F])})),p("stream: emit close to MqttClient"),S.emit("close")}),p("_setupStream: sending packet `connect`");const j=Object.create(this.options);if(j.cmd="connect",this.topicAliasRecv&&(j.properties||(j.properties={}),this.topicAliasRecv&&(j.properties.topicAliasMaximum=this.topicAliasRecv.max)),z(this,j),B.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return S.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"&&z(this,w({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){p("!!connectTimeout hit!! Calling _cleanUp with force `true`"),S._cleanUp(!0)},this.options.connectTimeout)},k.prototype._handlePacket=function(S,P){const B=this.options;if(B.protocolVersion===5&&B.properties&&B.properties.maximumPacketSize&&B.properties.maximumPacketSize<S.length)return this.emit("error",new Error("exceeding packets size "+S.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(p("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",S),S.cmd){case"publish":this._handlePublish(S,P);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(S),P();break;case"pubrel":this._handlePubrel(S,P);break;case"connack":this._handleConnack(S),P();break;case"auth":this._handleAuth(S),P();break;case"pingresp":this._handlePingresp(S),P();break;case"disconnect":this._handleDisconnect(S),P()}},k.prototype._checkDisconnecting=function(S){return this.disconnecting&&(S&&S!==_?S(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},k.prototype.publish=function(S,P,B,D){p("publish :: message `%s` to topic `%s`",P,S);const H=this.options;if(typeof B=="function"&&(D=B,B=null),B=w({qos:0,retain:!1,dup:!1},B),this._checkDisconnecting(D))return this;const L=this,M=function(){let j=0;if((B.qos===1||B.qos===2)&&(j=L._nextId())===null)return p("No messageId left"),!1;const W={cmd:"publish",topic:S,payload:P,qos:B.qos,retain:B.retain,messageId:j,dup:B.dup};switch(H.protocolVersion===5&&(W.properties=B.properties),p("publish :: qos",B.qos),B.qos){case 1:case 2:L.outgoing[W.messageId]={volatile:!1,cb:D||_},p("MqttClient:publish: packet cmd: %s",W.cmd),L._sendPacket(W,void 0,B.cbStorePut);break;default:p("MqttClient:publish: packet cmd: %s",W.cmd),L._sendPacket(W,D,B.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!M())&&this._storeProcessingQueue.push({invoke:M,cbStorePut:B.cbStorePut,callback:D}),this},k.prototype.subscribe=function(){const S=this,P=new Array(arguments.length);for(let Y=0;Y<arguments.length;Y++)P[Y]=arguments[Y];const B=[];let D=P.shift();const H=D.resubscribe;let L=P.pop()||_,M=P.pop();const j=this.options.protocolVersion;delete D.resubscribe,typeof D=="string"&&(D=[D]),typeof L!="function"&&(M=L,L=_);const W=m.validateTopics(D);if(W!==null)return T(L,new Error("Invalid topic "+W)),this;if(this._checkDisconnecting(L))return p("subscribe: discconecting true"),this;const F={qos:0};if(j===5&&(F.nl=!1,F.rap=!1,F.rh=0),M=w(F,M),Array.isArray(D)?D.forEach(function(Y){if(p("subscribe: array topic %s",Y),!Object.prototype.hasOwnProperty.call(S._resubscribeTopics,Y)||S._resubscribeTopics[Y].qos<M.qos||H){const q={topic:Y,qos:M.qos};j===5&&(q.nl=M.nl,q.rap=M.rap,q.rh=M.rh,q.properties=M.properties),p("subscribe: pushing topic `%s` and qos `%s` to subs list",q.topic,q.qos),B.push(q)}}):Object.keys(D).forEach(function(Y){if(p("subscribe: object topic %s",Y),!Object.prototype.hasOwnProperty.call(S._resubscribeTopics,Y)||S._resubscribeTopics[Y].qos<D[Y].qos||H){const q={topic:Y,qos:D[Y].qos};j===5&&(q.nl=D[Y].nl,q.rap=D[Y].rap,q.rh=D[Y].rh,q.properties=M.properties),p("subscribe: pushing `%s` to subs list",q),B.push(q)}}),!B.length)return L(null,[]),this;const V=function(){const Y=S._nextId();if(Y===null)return p("No messageId left"),!1;const q={cmd:"subscribe",subscriptions:B,qos:1,retain:!1,dup:!1,messageId:Y};if(M.properties&&(q.properties=M.properties),S.options.resubscribe){p("subscribe :: resubscribe true");const Q=[];B.forEach(function(K){if(S.options.reconnectPeriod>0){const X={qos:K.qos};j===5&&(X.nl=K.nl||!1,X.rap=K.rap||!1,X.rh=K.rh||0,X.properties=K.properties),S._resubscribeTopics[K.topic]=X,Q.push(K.topic)}}),S.messageIdToTopic[q.messageId]=Q}return S.outgoing[q.messageId]={volatile:!0,cb:function(Q,K){if(!Q){const X=K.granted;for(let b=0;b<X.length;b+=1)B[b].qos=X[b]}L(Q,B)}},p("subscribe :: call _sendPacket"),S._sendPacket(q),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!V())&&this._storeProcessingQueue.push({invoke:V,callback:L}),this},k.prototype.unsubscribe=function(){const S=this,P=new Array(arguments.length);for(let j=0;j<arguments.length;j++)P[j]=arguments[j];let B=P.shift(),D=P.pop()||_,H=P.pop();typeof B=="string"&&(B=[B]),typeof D!="function"&&(H=D,D=_);const L=m.validateTopics(B);if(L!==null)return T(D,new Error("Invalid topic "+L)),this;if(S._checkDisconnecting(D))return this;const M=function(){const j=S._nextId();if(j===null)return p("No messageId left"),!1;const W={cmd:"unsubscribe",qos:1,messageId:j};return typeof B=="string"?W.unsubscriptions=[B]:Array.isArray(B)&&(W.unsubscriptions=B),S.options.resubscribe&&W.unsubscriptions.forEach(function(F){delete S._resubscribeTopics[F]}),typeof H=="object"&&H.properties&&(W.properties=H.properties),S.outgoing[W.messageId]={volatile:!0,cb:D},p("unsubscribe: call _sendPacket"),S._sendPacket(W),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!M())&&this._storeProcessingQueue.push({invoke:M,callback:D}),this},k.prototype.end=function(S,P,B){const D=this;function H(){p("end :: (%s) :: finish :: calling _cleanUp with force %s",D.options.clientId,S),D._cleanUp(S,()=>{p("end :: finish :: calling process.nextTick on closeStores"),x((function(){p("end :: closeStores: closing incoming and outgoing stores"),D.disconnected=!0,D.incomingStore.close(function(L){D.outgoingStore.close(function(M){if(p("end :: closeStores: emitting end"),D.emit("end"),B){const j=L||M;p("end :: closeStores: invoking callback with args"),B(j)}})}),D._deferredReconnect&&D._deferredReconnect()}).bind(D))},P)}return p("end :: (%s)",this.options.clientId),S!=null&&typeof S=="boolean"||(B=P||_,P=S,S=!1,typeof P!="object"&&(B=P,P=null,typeof B!="function"&&(B=_))),typeof P!="object"&&(B=P,P=null),p("end :: cb? %s",!!B),B=B||_,this.disconnecting?(B(),this):(this._clearReconnect(),this.disconnecting=!0,!S&&Object.keys(this.outgoing).length>0?(p("end :: (%s) :: calling finish in 10ms once outgoing is empty",D.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,H,10))):(p("end :: (%s) :: immediately calling finish",D.options.clientId),H()),this)},k.prototype.removeOutgoingMessage=function(S){const P=this.outgoing[S]?this.outgoing[S].cb:null;return delete this.outgoing[S],this.outgoingStore.del({messageId:S},function(){P(new Error("Message removed"))}),this},k.prototype.reconnect=function(S){p("client reconnect");const P=this,B=function(){S?(P.options.incomingStore=S.incomingStore,P.options.outgoingStore=S.outgoingStore):(P.options.incomingStore=null,P.options.outgoingStore=null),P.incomingStore=P.options.incomingStore||new u,P.outgoingStore=P.options.outgoingStore||new u,P.disconnecting=!1,P.disconnected=!1,P._deferredReconnect=null,P._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=B:B(),this},k.prototype._reconnect=function(){p("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),p("client already connected. disconnecting first.")):(p("_reconnect: calling _setupStream"),this._setupStream())},k.prototype._setupReconnect=function(){const S=this;!S.disconnecting&&!S.reconnectTimer&&S.options.reconnectPeriod>0?(this.reconnecting||(p("_setupReconnect :: emit `offline` state"),this.emit("offline"),p("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),p("_setupReconnect :: setting reconnectTimer for %d ms",S.options.reconnectPeriod),S.reconnectTimer=setInterval(function(){p("reconnectTimer :: reconnect triggered!"),S._reconnect()},S.options.reconnectPeriod)):p("_setupReconnect :: doing nothing...")},k.prototype._clearReconnect=function(){p("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},k.prototype._cleanUp=function(S,P){const B=arguments[2];if(P&&(p("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",P)),p("_cleanUp :: forced? %s",S),S)this.options.reconnectPeriod===0&&this.options.clean&&(D=this.outgoing)&&(p("flush: queue exists? %b",!!D),Object.keys(D).forEach(function(H){typeof D[H].cb=="function"&&(D[H].cb(new Error("Connection closed")),delete D[H])})),p("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const H=w({cmd:"disconnect"},B);p("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(H,T.bind(null,this.stream.end.bind(this.stream)))}var D;this.disconnecting||(p("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(p("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),P&&!this.connected&&(p("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",P),P())},k.prototype._sendPacket=function(S,P,B){p("_sendPacket :: (%s) ::  start",this.options.clientId),B=B||_,P=P||_;const D=function(H,L){if(H.options.protocolVersion===5&&L.cmd==="publish"){let M;L.properties&&(M=L.properties.topicAlias);const j=L.topic.toString();if(H.topicAliasSend)if(M){if(j.length!==0&&(p("applyTopicAlias :: register topic: %s - alias: %d",j,M),!H.topicAliasSend.put(j,M)))return p("applyTopicAlias :: error out of range. topic: %s - alias: %d",j,M),new Error("Sending Topic Alias out of range")}else j.length!==0&&(H.options.autoAssignTopicAlias?(M=H.topicAliasSend.getAliasByTopic(j))?(L.topic="",L.properties={...L.properties,topicAlias:M},p("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",j,M)):(M=H.topicAliasSend.getLruAlias(),H.topicAliasSend.put(j,M),L.properties={...L.properties,topicAlias:M},p("applyTopicAlias :: auto assign topic: %s - alias: %d",j,M)):H.options.autoUseTopicAlias&&(M=H.topicAliasSend.getAliasByTopic(j))&&(L.topic="",L.properties={...L.properties,topicAlias:M},p("applyTopicAlias :: auto use topic: %s - alias: %d",j,M)));else if(M)return p("applyTopicAlias :: error out of range. topic: %s - alias: %d",j,M),new Error("Sending Topic Alias out of range")}}(this,S);if(D)P(D);else{if(!this.connected)return S.cmd==="auth"?(this._shiftPingInterval(),void z(this,S,P)):(p("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(S,P,B));switch(this._shiftPingInterval(),S.cmd){case"publish":break;case"pubrel":return void U(this,S,P,B);default:return void z(this,S,P)}switch(S.qos){case 2:case 1:U(this,S,P,B);break;case 0:default:z(this,S,P)}p("_sendPacket :: (%s) ::  end",this.options.clientId)}},k.prototype._storePacket=function(S,P,B){p("_storePacket :: packet: %o",S),p("_storePacket :: cb? %s",!!P),B=B||_;let D=S;if(D.cmd==="publish"){const H=R(this,D=g(S));if(H)return P&&P(H)}(D.qos||0)===0&&this.queueQoSZero||D.cmd!=="publish"?this.queue.push({packet:D,cb:P}):D.qos>0?(P=this.outgoing[D.messageId]?this.outgoing[D.messageId].cb:null,this.outgoingStore.put(D,function(H){if(H)return P&&P(H);B()})):P&&P(new Error("No connection to broker"))},k.prototype._setupPingTimer=function(){p("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const S=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=y(function(){S._checkPing()},1e3*this.options.keepalive))},k.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},k.prototype._checkPing=function(){p("_checkPing :: checking ping..."),this.pingResp?(p("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(p("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},k.prototype._handlePingresp=function(){this.pingResp=!0},k.prototype._handleConnack=function(S){p("_handleConnack");const P=this.options,B=P.protocolVersion===5?S.reasonCode:S.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,S.properties){if(S.properties.topicAliasMaximum){if(S.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));S.properties.topicAliasMaximum>0&&(this.topicAliasSend=new l(S.properties.topicAliasMaximum))}S.properties.serverKeepAlive&&P.keepalive&&(P.keepalive=S.properties.serverKeepAlive,this._shiftPingInterval()),S.properties.maximumPacketSize&&(P.properties||(P.properties={}),P.properties.maximumPacketSize=S.properties.maximumPacketSize)}if(B===0)this.reconnecting=!1,this._onConnect(S);else if(B>0){const D=new Error("Connection refused: "+I[B]);D.code=B,this.emit("error",D)}},k.prototype._handleAuth=function(S){const P=this.options.protocolVersion,B=P===5?S.reasonCode:S.returnCode;if(P!==5){const H=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+P);return H.code=B,void this.emit("error",H)}const D=this;this.handleAuth(S,function(H,L){if(H)D.emit("error",H);else if(B===24)D.reconnecting=!1,D._sendPacket(L);else{const M=new Error("Connection refused: "+I[B]);H.code=B,D.emit("error",M)}})},k.prototype.handleAuth=function(S,P){P()},k.prototype._handlePublish=function(S,P){p("_handlePublish: packet %o",S),P=P!==void 0?P:_;let B=S.topic.toString();const D=S.payload,H=S.qos,L=S.messageId,M=this,j=this.options,W=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let F;if(S.properties&&(F=S.properties.topicAlias),F!==void 0)if(B.length===0){if(!(F>0&&F<=65535))return p("_handlePublish :: topic alias out of range. alias: %d",F),void this.emit("error",new Error("Received Topic Alias is out of range"));{const V=this.topicAliasRecv.getTopicByAlias(F);if(!V)return p("_handlePublish :: unregistered topic alias. alias: %d",F),void this.emit("error",new Error("Received unregistered Topic Alias"));p("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",B=V,F)}}else{if(!this.topicAliasRecv.put(B,F))return p("_handlePublish :: topic alias out of range. alias: %d",F),void this.emit("error",new Error("Received Topic Alias is out of range"));p("_handlePublish :: registered topic: %s - alias: %d",B,F)}}switch(p("_handlePublish: qos %d",H),H){case 2:j.customHandleAcks(B,D,S,function(F,V){return F instanceof Error||(V=F,F=null),F?M.emit("error",F):W.indexOf(V)===-1?M.emit("error",new Error("Wrong reason code for pubrec")):void(V?M._sendPacket({cmd:"pubrec",messageId:L,reasonCode:V},P):M.incomingStore.put(S,function(){M._sendPacket({cmd:"pubrec",messageId:L},P)}))});break;case 1:j.customHandleAcks(B,D,S,function(F,V){return F instanceof Error||(V=F,F=null),F?M.emit("error",F):W.indexOf(V)===-1?M.emit("error",new Error("Wrong reason code for puback")):(V||M.emit("message",B,D,S),void M.handleMessage(S,function(Y){if(Y)return P&&P(Y);M._sendPacket({cmd:"puback",messageId:L,reasonCode:V},P)}))});break;case 0:this.emit("message",B,D,S),this.handleMessage(S,P);break;default:p("_handlePublish: unknown QoS. Doing nothing.")}},k.prototype.handleMessage=function(S,P){P()},k.prototype._handleAck=function(S){const P=S.messageId,B=S.cmd;let D=null;const H=this.outgoing[P]?this.outgoing[P].cb:null,L=this;let M;if(H){switch(p("_handleAck :: packet type",B),B){case"pubcomp":case"puback":{const j=S.reasonCode;j&&j>0&&j!==16&&((M=new Error("Publish error: "+I[j])).code=j,H(M,S)),delete this.outgoing[P],this.outgoingStore.del(S,H),this.messageIdProvider.deallocate(P),this._invokeStoreProcessingQueue();break}case"pubrec":{D={cmd:"pubrel",qos:2,messageId:P};const j=S.reasonCode;j&&j>0&&j!==16?((M=new Error("Publish error: "+I[j])).code=j,H(M,S)):this._sendPacket(D);break}case"suback":delete this.outgoing[P],this.messageIdProvider.deallocate(P);for(let j=0;j<S.granted.length;j++)if(128&S.granted[j]){const W=this.messageIdToTopic[P];W&&W.forEach(function(F){delete L._resubscribeTopics[F]})}this._invokeStoreProcessingQueue(),H(null,S);break;case"unsuback":delete this.outgoing[P],this.messageIdProvider.deallocate(P),this._invokeStoreProcessingQueue(),H(null);break;default:L.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")}else p("_handleAck :: Server sent an ack in error. Ignoring.")},k.prototype._handlePubrel=function(S,P){p("handling pubrel packet"),P=P!==void 0?P:_;const B=this,D={cmd:"pubcomp",messageId:S.messageId};B.incomingStore.get(S,function(H,L){H?B._sendPacket(D,P):(B.emit("message",L.topic,L.payload,L),B.handleMessage(L,function(M){if(M)return P(M);B.incomingStore.del(L,_),B._sendPacket(D,P)}))})},k.prototype._handleDisconnect=function(S){this.emit("disconnect",S)},k.prototype._nextId=function(){return this.messageIdProvider.allocate()},k.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},k.prototype._resubscribe=function(){p("_resubscribe");const S=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&S.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){p("_resubscribe: protocolVersion 5");for(let P=0;P<S.length;P++){const B={};B[S[P]]=this._resubscribeTopics[S[P]],B.resubscribe=!0,this.subscribe(B,{properties:B[S[P]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},k.prototype._onConnect=function(S){if(this.disconnected)return void this.emit("connect",S);const P=this;this.connackPacket=S,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function B(){let D=P.outgoingStore.createStream();function H(){P._storeProcessing=!1,P._packetIdsDuringStoreProcessing={}}function L(){D.destroy(),D=null,P._flushStoreProcessingQueue(),H()}P.once("close",L),D.on("error",function(M){H(),P._flushStoreProcessingQueue(),P.removeListener("close",L),P.emit("error",M)}),D.on("end",function(){let M=!0;for(const j in P._packetIdsDuringStoreProcessing)if(!P._packetIdsDuringStoreProcessing[j]){M=!1;break}M?(H(),P.removeListener("close",L),P._invokeAllStoreProcessingQueue(),P.emit("connect",S)):B()}),function M(){if(!D)return;P._storeProcessing=!0;const j=D.read(1);let W;j?P._packetIdsDuringStoreProcessing[j.messageId]?M():P.disconnecting||P.reconnectTimer?D.destroy&&D.destroy():(W=P.outgoing[j.messageId]?P.outgoing[j.messageId].cb:null,P.outgoing[j.messageId]={volatile:!1,cb:function(F,V){W&&W(F,V),M()}},P._packetIdsDuringStoreProcessing[j.messageId]=!0,P.messageIdProvider.register(j.messageId)?P._sendPacket(j):p("messageId: %d has already used.",j.messageId)):D.once("readable",M)}()}()},k.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const S=this._storeProcessingQueue[0];if(S&&S.invoke())return this._storeProcessingQueue.shift(),!0}return!1},k.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},k.prototype._flushStoreProcessingQueue=function(){for(const S of this._storeProcessingQueue)S.cbStorePut&&S.cbStorePut(new Error("Connection closed")),S.callback&&S.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},a.exports=k}).call(this)}).call(this,r("_process"),typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(r,a,i){const{Buffer:o}=r("buffer"),n=r("readable-stream").Transform,s=r("duplexify");let u,c,l,f=!1;a.exports=function(h,d){if(d.hostname=d.hostname||d.host,!d.hostname)throw new Error("Could not determine host. Specify host manually.");const v=d.protocolId==="MQIsdp"&&d.protocolVersion===3?"mqttv3.1":"mqtt";(function(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})})(d);const y=function(g,m){const w=g.protocol==="alis"?"wss":"ws";let p=w+"://"+g.hostname+g.path;return g.port&&g.port!==80&&g.port!==443&&(p=w+"://"+g.hostname+":"+g.port+g.path),typeof g.transformWsUrl=="function"&&(p=g.transformWsUrl(p,g,m)),p}(d,h);return(u=d.my).connectSocket({url:y,protocols:v}),c=function(){const g=new n;return g._write=function(m,w,p){u.sendSocketMessage({data:m.buffer,success:function(){p()},fail:function(){p(new Error)}})},g._flush=function(m){u.closeSocket({success:function(){m()}})},g}(),l=s.obj(),f||(f=!0,u.onSocketOpen(function(){l.setReadable(c),l.setWritable(c),l.emit("connect")}),u.onSocketMessage(function(g){if(typeof g.data=="string"){const m=o.from(g.data,"base64");c.push(m)}else{const m=new FileReader;m.addEventListener("load",function(){let w=m.result;w=w instanceof ArrayBuffer?o.from(w):o.from(w,"utf8"),c.push(w)}),m.readAsArrayBuffer(g.data)}}),u.onSocketClose(function(){l.end(),l.destroy()}),u.onSocketError(function(g){l.destroy(g)})),l}},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(r,a,i){const o=r("net"),n=r("debug")("mqttjs:tcp");a.exports=function(s,u){u.port=u.port||1883,u.hostname=u.hostname||u.host||"localhost";const c=u.port,l=u.hostname;return n("port %d and host %s",c,l),o.createConnection(c,l)}},{debug:18,net:16}],4:[function(r,a,i){const o=r("tls"),n=r("net"),s=r("debug")("mqttjs:tls");a.exports=function(u,c){c.port=c.port||8883,c.host=c.hostname||c.host||"localhost",n.isIP(c.host)===0&&(c.servername=c.host),c.rejectUnauthorized=c.rejectUnauthorized!==!1,delete c.path,s("port %d host %s rejectUnauthorized %b",c.port,c.host,c.rejectUnauthorized);const l=o.connect(c);function f(h){c.rejectUnauthorized&&u.emit("error",h),l.end()}return l.on("secureConnect",function(){c.rejectUnauthorized&&!l.authorized?l.emit("error",new Error("TLS not authorized")):l.removeListener("error",f)}),l.on("error",f),l}},{debug:18,net:16,tls:16}],5:[function(r,a,i){(function(o){(function(){const{Buffer:n}=r("buffer"),s=r("ws"),u=r("debug")("mqttjs:ws"),c=r("duplexify"),l=r("readable-stream").Transform,f=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],h=o!==void 0&&o.title==="browser"||typeof __webpack_require__=="function";function d(y,g){let m=y.protocol+"://"+y.hostname+":"+y.port+y.path;return typeof y.transformWsUrl=="function"&&(m=y.transformWsUrl(m,y,g)),m}function v(y){const g=y;return y.hostname||(g.hostname="localhost"),y.port||(y.protocol==="wss"?g.port=443:g.port=80),y.path||(g.path="/"),y.wsOptions||(g.wsOptions={}),h||y.protocol!=="wss"||f.forEach(function(m){Object.prototype.hasOwnProperty.call(y,m)&&!Object.prototype.hasOwnProperty.call(y.wsOptions,m)&&(g.wsOptions[m]=y[m])}),g}a.exports=h?function(y,g){let m;u("browserStreamBuilder");const w=function(S){const P=v(S);if(P.hostname||(P.hostname=P.host),!P.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const B=new URL(document.URL);P.hostname=B.hostname,P.port||(P.port=B.port)}return P.objectMode===void 0&&(P.objectMode=!(P.binary===!0||P.binary===void 0)),P}(g).browserBufferSize||524288,p=g.browserBufferTimeout||1e3,x=!g.objectMode,T=function(S,P){const B=P.protocolId==="MQIsdp"&&P.protocolVersion===3?"mqttv3.1":"mqtt",D=d(P,S),H=new WebSocket(D,[B]);return H.binaryType="arraybuffer",H}(y,g),A=function(S,P,B){const D=new l({objectModeMode:S.objectMode});return D._write=P,D._flush=B,D}(g,function S(P,B,D){T.bufferedAmount>w&&setTimeout(S,p,P,B,D),x&&typeof P=="string"&&(P=n.from(P,"utf8"));try{T.send(P)}catch(H){return D(H)}D()},function(S){T.close(),S()});g.objectMode||(A._writev=k),A.on("close",()=>{T.close()});const I=T.addEventListener!==void 0;function R(){m.setReadable(A),m.setWritable(A),m.emit("connect")}function z(){m.end(),m.destroy()}function U(S){m.destroy(S)}function _(S){let P=S.data;P=P instanceof ArrayBuffer?n.from(P):n.from(P,"utf8"),A.push(P)}function k(S,P){const B=new Array(S.length);for(let D=0;D<S.length;D++)typeof S[D].chunk=="string"?B[D]=n.from(S[D],"utf8"):B[D]=S[D].chunk;this._write(n.concat(B),"binary",P)}return T.readyState===T.OPEN?m=A:(m=m=c(void 0,void 0,g),g.objectMode||(m._writev=k),I?T.addEventListener("open",R):T.onopen=R),m.socket=T,I?(T.addEventListener("close",z),T.addEventListener("error",U),T.addEventListener("message",_)):(T.onclose=z,T.onerror=U,T.onmessage=_),m}:function(y,g){u("streamBuilder");const m=v(g),w=d(m,y),p=function(T,A,I){u("createWebSocket"),u("protocol: "+I.protocolId+" "+I.protocolVersion);const R=I.protocolId==="MQIsdp"&&I.protocolVersion===3?"mqttv3.1":"mqtt";return u("creating new Websocket for url: "+A+" and protocol: "+R),new s(A,[R],I.wsOptions)}(0,w,m),x=s.createWebSocketStream(p,m.wsOptions);return x.url=w,p.on("close",()=>{x.destroy()}),x}}).call(this)}).call(this,r("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(r,a,i){const{Buffer:o}=r("buffer"),n=r("readable-stream").Transform,s=r("duplexify");let u,c,l;a.exports=function(f,h){if(h.hostname=h.hostname||h.host,!h.hostname)throw new Error("Could not determine host. Specify host manually.");const d=h.protocolId==="MQIsdp"&&h.protocolVersion===3?"mqttv3.1":"mqtt";(function(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})})(h);const v=function(g,m){const w=g.protocol==="wxs"?"wss":"ws";let p=w+"://"+g.hostname+g.path;return g.port&&g.port!==80&&g.port!==443&&(p=w+"://"+g.hostname+":"+g.port+g.path),typeof g.transformWsUrl=="function"&&(p=g.transformWsUrl(p,g,m)),p}(h,f);u=wx.connectSocket({url:v,protocols:[d]}),c=function(){const g=new n;return g._write=function(m,w,p){u.send({data:m.buffer,success:function(){p()},fail:function(x){p(new Error(x))}})},g._flush=function(m){u.close({success:function(){m()}})},g}(),(l=s.obj())._destroy=function(g,m){u.close({success:function(){m&&m(g)}})};const y=l.destroy;return l.destroy=(function(){l.destroy=y;const g=this;setTimeout(function(){u.close({fail:function(){g._destroy(new Error)}})},0)}).bind(l),u.onOpen(function(){l.setReadable(c),l.setWritable(c),l.emit("connect")}),u.onMessage(function(g){let m=g.data;m=m instanceof ArrayBuffer?o.from(m):o.from(m,"utf8"),c.push(m)}),u.onClose(function(){l.end(),l.destroy()}),u.onError(function(g){l.destroy(new Error(g.errMsg))}),l}},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(r,a,i){function o(){if(!(this instanceof o))return new o;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}o.prototype.allocate=function(){const n=this.nextId++;return this.nextId===65536&&(this.nextId=1),n},o.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},o.prototype.register=function(n){return!0},o.prototype.deallocate=function(n){},o.prototype.clear=function(){},a.exports=o},{}],8:[function(r,a,i){const o=r("xtend"),n=r("readable-stream").Readable,s={objectMode:!0},u={clean:!0};function c(l){if(!(this instanceof c))return new c(l);this.options=l||{},this.options=o(u,l),this._inflights=new Map}c.prototype.put=function(l,f){return this._inflights.set(l.messageId,l),f&&f(),this},c.prototype.createStream=function(){const l=new n(s),f=[];let h=!1,d=0;return this._inflights.forEach(function(v,y){f.push(v)}),l._read=function(){!h&&d<f.length?this.push(f[d++]):this.push(null)},l.destroy=function(){if(h)return;const v=this;h=!0,setTimeout(function(){v.emit("close")},0)},l},c.prototype.del=function(l,f){return(l=this._inflights.get(l.messageId))?(this._inflights.delete(l.messageId),f(null,l)):f&&f(new Error("missing packet")),this},c.prototype.get=function(l,f){return(l=this._inflights.get(l.messageId))?f(null,l):f&&f(new Error("missing packet")),this},c.prototype.close=function(l){this.options.clean&&(this._inflights=null),l&&l()},a.exports=c},{"readable-stream":69,xtend:81}],9:[function(r,a,i){function o(n){if(!(this instanceof o))return new o(n);this.aliasToTopic={},this.max=n}o.prototype.put=function(n,s){return!(s===0||s>this.max)&&(this.aliasToTopic[s]=n,this.length=Object.keys(this.aliasToTopic).length,!0)},o.prototype.getTopicByAlias=function(n){return this.aliasToTopic[n]},o.prototype.clear=function(){this.aliasToTopic={}},a.exports=o},{}],10:[function(r,a,i){const o=r("lru-cache"),n=r("number-allocator").NumberAllocator;function s(u){if(!(this instanceof s))return new s(u);u>0&&(this.aliasToTopic=new o({max:u}),this.topicToAlias={},this.numberAllocator=new n(1,u),this.max=u,this.length=0)}s.prototype.put=function(u,c){if(c===0||c>this.max)return!1;const l=this.aliasToTopic.get(c);return l&&delete this.topicToAlias[l],this.aliasToTopic.set(c,u),this.topicToAlias[u]=c,this.numberAllocator.use(c),this.length=this.aliasToTopic.length,!0},s.prototype.getTopicByAlias=function(u){return this.aliasToTopic.get(u)},s.prototype.getAliasByTopic=function(u){const c=this.topicToAlias[u];return c!==void 0&&this.aliasToTopic.get(c),c},s.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},s.prototype.getLruAlias=function(){return this.numberAllocator.firstVacant()||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},a.exports=s},{"lru-cache":37,"number-allocator":46}],11:[function(r,a,i){function o(n){const s=n.split("/");for(let u=0;u<s.length;u++)if(s[u]!=="+"){if(s[u]==="#")return u===s.length-1;if(s[u].indexOf("+")!==-1||s[u].indexOf("#")!==-1)return!1}return!0}a.exports={validateTopics:function(n){if(n.length===0)return"empty_topic_list";for(let s=0;s<n.length;s++)if(!o(n[s]))return n[s];return null}}},{}],12:[function(r,a,i){(function(o){(function(){const n=r("../client"),s=r("../store"),u=r("url"),c=r("xtend"),l=r("debug")("mqttjs"),f={};function h(d,v){if(l("connecting to an MQTT broker..."),typeof d!="object"||v||(v=d,d=null),v=v||{},d){const g=u.parse(d,!0);if(g.port!=null&&(g.port=Number(g.port)),(v=c(g,v)).protocol===null)throw new Error("Missing protocol");v.protocol=v.protocol.replace(/:$/,"")}if(function(g){let m;g.auth&&((m=g.auth.match(/^(.+):(.+)$/))?(g.username=m[1],g.password=m[2]):g.username=g.auth)}(v),v.query&&typeof v.query.clientId=="string"&&(v.clientId=v.query.clientId),v.cert&&v.key){if(!v.protocol)throw new Error("Missing secure protocol key");if(["mqtts","wss","wxs","alis"].indexOf(v.protocol)===-1)switch(v.protocol){case"mqtt":v.protocol="mqtts";break;case"ws":v.protocol="wss";break;case"wx":v.protocol="wxs";break;case"ali":v.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+v.protocol+'"!')}}if(!f[v.protocol]){const g=["mqtts","wss"].indexOf(v.protocol)!==-1;v.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(m,w){return(!g||w%2!=0)&&typeof f[m]=="function"})[0]}if(v.clean===!1&&!v.clientId)throw new Error("Missing clientId for unclean clients");v.protocol&&(v.defaultProtocol=v.protocol);const y=new n(function(g){return v.servers&&(g._reconnectCount&&g._reconnectCount!==v.servers.length||(g._reconnectCount=0),v.host=v.servers[g._reconnectCount].host,v.port=v.servers[g._reconnectCount].port,v.protocol=v.servers[g._reconnectCount].protocol?v.servers[g._reconnectCount].protocol:v.defaultProtocol,v.hostname=v.host,g._reconnectCount++),l("calling streambuilder for",v.protocol),f[v.protocol](g,v)},v);return y.on("error",function(){}),y}o!==void 0&&o.title!=="browser"||typeof __webpack_require__!="function"?(f.mqtt=r("./tcp"),f.tcp=r("./tcp"),f.ssl=r("./tls"),f.tls=r("./tls"),f.mqtts=r("./tls")):(f.wx=r("./wx"),f.wxs=r("./wx"),f.ali=r("./ali"),f.alis=r("./ali")),f.ws=r("./ws"),f.wss=r("./ws"),a.exports=h,a.exports.connect=h,a.exports.MqttClient=n,a.exports.Store=s}).call(this)}).call(this,r("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(r,a,i){i.byteLength=function(d){var v=f(d),y=v[0],g=v[1];return 3*(y+g)/4-g},i.toByteArray=function(d){var v,y,g=f(d),m=g[0],w=g[1],p=new s(function(A,I,R){return 3*(I+R)/4-R}(0,m,w)),x=0,T=w>0?m-4:m;for(y=0;y<T;y+=4)v=n[d.charCodeAt(y)]<<18|n[d.charCodeAt(y+1)]<<12|n[d.charCodeAt(y+2)]<<6|n[d.charCodeAt(y+3)],p[x++]=v>>16&255,p[x++]=v>>8&255,p[x++]=255&v;return w===2&&(v=n[d.charCodeAt(y)]<<2|n[d.charCodeAt(y+1)]>>4,p[x++]=255&v),w===1&&(v=n[d.charCodeAt(y)]<<10|n[d.charCodeAt(y+1)]<<4|n[d.charCodeAt(y+2)]>>2,p[x++]=v>>8&255,p[x++]=255&v),p},i.fromByteArray=function(d){for(var v,y=d.length,g=y%3,m=[],w=0,p=y-g;w<p;w+=16383)m.push(h(d,w,w+16383>p?p:w+16383));return g===1?(v=d[y-1],m.push(o[v>>2]+o[v<<4&63]+"==")):g===2&&(v=(d[y-2]<<8)+d[y-1],m.push(o[v>>10]+o[v>>4&63]+o[v<<2&63]+"=")),m.join("")};for(var o=[],n=[],s=typeof Uint8Array<"u"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=u.length;c<l;++c)o[c]=u[c],n[u.charCodeAt(c)]=c;function f(d){var v=d.length;if(v%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var y=d.indexOf("=");return y===-1&&(y=v),[y,y===v?0:4-y%4]}function h(d,v,y){for(var g,m,w=[],p=v;p<y;p+=3)g=(d[p]<<16&16711680)+(d[p+1]<<8&65280)+(255&d[p+2]),w.push(o[(m=g)>>18&63]+o[m>>12&63]+o[m>>6&63]+o[63&m]);return w.join("")}n[45]=62,n[95]=63},{}],14:[function(r,a,i){const{Buffer:o}=r("buffer"),n=Symbol.for("BufferList");function s(u){if(!(this instanceof s))return new s(u);s._init.call(this,u)}s._init=function(u){Object.defineProperty(this,n,{value:!0}),this._bufs=[],this.length=0,u&&this.append(u)},s.prototype._new=function(u){return new s(u)},s.prototype._offset=function(u){if(u===0)return[0,0];let c=0;for(let l=0;l<this._bufs.length;l++){const f=c+this._bufs[l].length;if(u<f||l===this._bufs.length-1)return[l,u-c];c=f}},s.prototype._reverseOffset=function(u){const c=u[0];let l=u[1];for(let f=0;f<c;f++)l+=this._bufs[f].length;return l},s.prototype.get=function(u){if(u>this.length||u<0)return;const c=this._offset(u);return this._bufs[c[0]][c[1]]},s.prototype.slice=function(u,c){return typeof u=="number"&&u<0&&(u+=this.length),typeof c=="number"&&c<0&&(c+=this.length),this.copy(null,0,u,c)},s.prototype.copy=function(u,c,l,f){if((typeof l!="number"||l<0)&&(l=0),(typeof f!="number"||f>this.length)&&(f=this.length),l>=this.length||f<=0)return u||o.alloc(0);const h=!!u,d=this._offset(l),v=f-l;let y=v,g=h&&c||0,m=d[1];if(l===0&&f===this.length){if(!h)return this._bufs.length===1?this._bufs[0]:o.concat(this._bufs,this.length);for(let w=0;w<this._bufs.length;w++)this._bufs[w].copy(u,g),g+=this._bufs[w].length;return u}if(y<=this._bufs[d[0]].length-m)return h?this._bufs[d[0]].copy(u,c,m,m+y):this._bufs[d[0]].slice(m,m+y);h||(u=o.allocUnsafe(v));for(let w=d[0];w<this._bufs.length;w++){const p=this._bufs[w].length-m;if(!(y>p)){this._bufs[w].copy(u,g,m,m+y),g+=p;break}this._bufs[w].copy(u,g,m),g+=p,y-=p,m&&(m=0)}return u.length>g?u.slice(0,g):u},s.prototype.shallowSlice=function(u,c){if(u=u||0,c=typeof c!="number"?this.length:c,u<0&&(u+=this.length),c<0&&(c+=this.length),u===c)return this._new();const l=this._offset(u),f=this._offset(c),h=this._bufs.slice(l[0],f[0]+1);return f[1]===0?h.pop():h[h.length-1]=h[h.length-1].slice(0,f[1]),l[1]!==0&&(h[0]=h[0].slice(l[1])),this._new(h)},s.prototype.toString=function(u,c,l){return this.slice(c,l).toString(u)},s.prototype.consume=function(u){if(u=Math.trunc(u),Number.isNaN(u)||u<=0)return this;for(;this._bufs.length;){if(!(u>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(u),this.length-=u;break}u-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const u=this._new();for(let c=0;c<this._bufs.length;c++)u.append(this._bufs[c]);return u},s.prototype.append=function(u){if(u==null)return this;if(u.buffer)this._appendBuffer(o.from(u.buffer,u.byteOffset,u.byteLength));else if(Array.isArray(u))for(let c=0;c<u.length;c++)this.append(u[c]);else if(this._isBufferList(u))for(let c=0;c<u._bufs.length;c++)this.append(u._bufs[c]);else typeof u=="number"&&(u=u.toString()),this._appendBuffer(o.from(u));return this},s.prototype._appendBuffer=function(u){this._bufs.push(u),this.length+=u.length},s.prototype.indexOf=function(u,c,l){if(l===void 0&&typeof c=="string"&&(l=c,c=void 0),typeof u=="function"||Array.isArray(u))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof u=="number"?u=o.from([u]):typeof u=="string"?u=o.from(u,l):this._isBufferList(u)?u=u.slice():Array.isArray(u.buffer)?u=o.from(u.buffer,u.byteOffset,u.byteLength):o.isBuffer(u)||(u=o.from(u)),c=Number(c||0),isNaN(c)&&(c=0),c<0&&(c=this.length+c),c<0&&(c=0),u.length===0)return c>this.length?this.length:c;const f=this._offset(c);let h=f[0],d=f[1];for(;h<this._bufs.length;h++){const v=this._bufs[h];for(;d<v.length;)if(v.length-d>=u.length){const y=v.indexOf(u,d);if(y!==-1)return this._reverseOffset([h,y]);d=v.length-u.length+1}else{const y=this._reverseOffset([h,d]);if(this._match(y,u))return y;d++}d=0}return-1},s.prototype._match=function(u,c){if(this.length-u<c.length)return!1;for(let l=0;l<c.length;l++)if(this.get(u+l)!==c[l])return!1;return!0},function(){const u={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const c in u)(function(l){s.prototype[l]=u[l]===null?function(f,h){return this.slice(f,f+h)[l](0,h)}:function(f=0){return this.slice(f,f+u[l])[l](0)}})(c)}(),s.prototype._isBufferList=function(u){return u instanceof s||s.isBufferList(u)},s.isBufferList=function(u){return u!=null&&u[n]},a.exports=s},{buffer:17}],15:[function(r,a,i){const o=r("readable-stream").Duplex,n=r("inherits"),s=r("./BufferList");function u(c){if(!(this instanceof u))return new u(c);if(typeof c=="function"){this._callback=c;const l=(function(f){this._callback&&(this._callback(f),this._callback=null)}).bind(this);this.on("pipe",function(f){f.on("error",l)}),this.on("unpipe",function(f){f.removeListener("error",l)}),c=null}s._init.call(this,c),o.call(this)}n(u,o),Object.assign(u.prototype,s.prototype),u.prototype._new=function(c){return new u(c)},u.prototype._write=function(c,l,f){this._appendBuffer(c),typeof f=="function"&&f()},u.prototype._read=function(c){if(!this.length)return this.push(null);c=Math.min(c,this.length),this.push(this.slice(0,c)),this.consume(c)},u.prototype.end=function(c){o.prototype.end.call(this,c),this._callback&&(this._callback(null,this.slice()),this._callback=null)},u.prototype._destroy=function(c,l){this._bufs.length=0,this.length=0,l(c)},u.prototype._isBufferList=function(c){return c instanceof u||c instanceof s||u.isBufferList(c)},u.isBufferList=s.isBufferList,a.exports=u,a.exports.BufferListStream=u,a.exports.BufferList=s},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(r,a,i){},{}],17:[function(r,a,i){(function(o){(function(){var n=r("base64-js"),s=r("ieee754");i.Buffer=l,i.SlowBuffer=function(b){return+b!=b&&(b=0),l.alloc(+b)},i.INSPECT_MAX_BYTES=50;var u=2147483647;function c(b){if(b>u)throw new RangeError('The value "'+b+'" is invalid for option "size"');var C=new Uint8Array(b);return C.__proto__=l.prototype,C}function l(b,C,E){if(typeof b=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(b)}return f(b,C,E)}function f(b,C,E){if(typeof b=="string")return function($,G){if(typeof G=="string"&&G!==""||(G="utf8"),!l.isEncoding(G))throw new TypeError("Unknown encoding: "+G);var Z=0|g($,G),J=c(Z),ee=J.write($,G);return ee!==Z&&(J=J.slice(0,ee)),J}(b,C);if(ArrayBuffer.isView(b))return v(b);if(b==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b);if(K(b,ArrayBuffer)||b&&K(b.buffer,ArrayBuffer))return function($,G,Z){if(G<0||$.byteLength<G)throw new RangeError('"offset" is outside of buffer bounds');if($.byteLength<G+(Z||0))throw new RangeError('"length" is outside of buffer bounds');var J;return J=G===void 0&&Z===void 0?new Uint8Array($):Z===void 0?new Uint8Array($,G):new Uint8Array($,G,Z),J.__proto__=l.prototype,J}(b,C,E);if(typeof b=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var N=b.valueOf&&b.valueOf();if(N!=null&&N!==b)return l.from(N,C,E);var O=function($){if(l.isBuffer($)){var G=0|y($.length),Z=c(G);return Z.length===0||$.copy(Z,0,0,G),Z}if($.length!==void 0)return typeof $.length!="number"||X($.length)?c(0):v($);if($.type==="Buffer"&&Array.isArray($.data))return v($.data)}(b);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof b[Symbol.toPrimitive]=="function")return l.from(b[Symbol.toPrimitive]("string"),C,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b)}function h(b){if(typeof b!="number")throw new TypeError('"size" argument must be of type number');if(b<0)throw new RangeError('The value "'+b+'" is invalid for option "size"')}function d(b){return h(b),c(b<0?0:0|y(b))}function v(b){for(var C=b.length<0?0:0|y(b.length),E=c(C),N=0;N<C;N+=1)E[N]=255&b[N];return E}function y(b){if(b>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return 0|b}function g(b,C){if(l.isBuffer(b))return b.length;if(ArrayBuffer.isView(b)||K(b,ArrayBuffer))return b.byteLength;if(typeof b!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof b);var E=b.length,N=arguments.length>2&&arguments[2]===!0;if(!N&&E===0)return 0;for(var O=!1;;)switch(C){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return Y(b).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*E;case"hex":return E>>>1;case"base64":return q(b).length;default:if(O)return N?-1:Y(b).length;C=(""+C).toLowerCase(),O=!0}}function m(b,C,E){var N=b[C];b[C]=b[E],b[E]=N}function w(b,C,E,N,O){if(b.length===0)return-1;if(typeof E=="string"?(N=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),X(E=+E)&&(E=O?0:b.length-1),E<0&&(E=b.length+E),E>=b.length){if(O)return-1;E=b.length-1}else if(E<0){if(!O)return-1;E=0}if(typeof C=="string"&&(C=l.from(C,N)),l.isBuffer(C))return C.length===0?-1:p(b,C,E,N,O);if(typeof C=="number")return C&=255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(b,C,E):Uint8Array.prototype.lastIndexOf.call(b,C,E):p(b,[C],E,N,O);throw new TypeError("val must be string, number or Buffer")}function p(b,C,E,N,O){var $,G=1,Z=b.length,J=C.length;if(N!==void 0&&((N=String(N).toLowerCase())==="ucs2"||N==="ucs-2"||N==="utf16le"||N==="utf-16le")){if(b.length<2||C.length<2)return-1;G=2,Z/=2,J/=2,E/=2}function ee(ae,ie){return G===1?ae[ie]:ae.readUInt16BE(ie*G)}if(O){var te=-1;for($=E;$<Z;$++)if(ee(b,$)===ee(C,te===-1?0:$-te)){if(te===-1&&(te=$),$-te+1===J)return te*G}else te!==-1&&($-=$-te),te=-1}else for(E+J>Z&&(E=Z-J),$=E;$>=0;$--){for(var oe=!0,ne=0;ne<J;ne++)if(ee(b,$+ne)!==ee(C,ne)){oe=!1;break}if(oe)return $}return-1}function x(b,C,E,N){E=Number(E)||0;var O=b.length-E;N?(N=Number(N))>O&&(N=O):N=O;var $=C.length;N>$/2&&(N=$/2);for(var G=0;G<N;++G){var Z=parseInt(C.substr(2*G,2),16);if(X(Z))return G;b[E+G]=Z}return G}function T(b,C,E,N){return Q(Y(C,b.length-E),b,E,N)}function A(b,C,E,N){return Q(function(O){for(var $=[],G=0;G<O.length;++G)$.push(255&O.charCodeAt(G));return $}(C),b,E,N)}function I(b,C,E,N){return A(b,C,E,N)}function R(b,C,E,N){return Q(q(C),b,E,N)}function z(b,C,E,N){return Q(function(O,$){for(var G,Z,J,ee=[],te=0;te<O.length&&!(($-=2)<0);++te)G=O.charCodeAt(te),Z=G>>8,J=G%256,ee.push(J),ee.push(Z);return ee}(C,b.length-E),b,E,N)}function U(b,C,E){return C===0&&E===b.length?n.fromByteArray(b):n.fromByteArray(b.slice(C,E))}function _(b,C,E){E=Math.min(b.length,E);for(var N=[],O=C;O<E;){var $,G,Z,J,ee=b[O],te=null,oe=ee>239?4:ee>223?3:ee>191?2:1;if(O+oe<=E)switch(oe){case 1:ee<128&&(te=ee);break;case 2:(192&($=b[O+1]))==128&&(J=(31&ee)<<6|63&$)>127&&(te=J);break;case 3:$=b[O+1],G=b[O+2],(192&$)==128&&(192&G)==128&&(J=(15&ee)<<12|(63&$)<<6|63&G)>2047&&(J<55296||J>57343)&&(te=J);break;case 4:$=b[O+1],G=b[O+2],Z=b[O+3],(192&$)==128&&(192&G)==128&&(192&Z)==128&&(J=(15&ee)<<18|(63&$)<<12|(63&G)<<6|63&Z)>65535&&J<1114112&&(te=J)}te===null?(te=65533,oe=1):te>65535&&(te-=65536,N.push(te>>>10&1023|55296),te=56320|1023&te),N.push(te),O+=oe}return function(ne){var ae=ne.length;if(ae<=k)return String.fromCharCode.apply(String,ne);for(var ie="",se=0;se<ae;)ie+=String.fromCharCode.apply(String,ne.slice(se,se+=k));return ie}(N)}i.kMaxLength=u,l.TYPED_ARRAY_SUPPORT=function(){try{var b=new Uint8Array(1);return b.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},b.foo()===42}catch{return!1}}(),l.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),l.poolSize=8192,l.from=function(b,C,E){return f(b,C,E)},l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,l.alloc=function(b,C,E){return function(N,O,$){return h(N),N<=0?c(N):O!==void 0?typeof $=="string"?c(N).fill(O,$):c(N).fill(O):c(N)}(b,C,E)},l.allocUnsafe=function(b){return d(b)},l.allocUnsafeSlow=function(b){return d(b)},l.isBuffer=function(b){return b!=null&&b._isBuffer===!0&&b!==l.prototype},l.compare=function(b,C){if(K(b,Uint8Array)&&(b=l.from(b,b.offset,b.byteLength)),K(C,Uint8Array)&&(C=l.from(C,C.offset,C.byteLength)),!l.isBuffer(b)||!l.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(b===C)return 0;for(var E=b.length,N=C.length,O=0,$=Math.min(E,N);O<$;++O)if(b[O]!==C[O]){E=b[O],N=C[O];break}return E<N?-1:N<E?1:0},l.isEncoding=function(b){switch(String(b).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(b,C){if(!Array.isArray(b))throw new TypeError('"list" argument must be an Array of Buffers');if(b.length===0)return l.alloc(0);var E;if(C===void 0)for(C=0,E=0;E<b.length;++E)C+=b[E].length;var N=l.allocUnsafe(C),O=0;for(E=0;E<b.length;++E){var $=b[E];if(K($,Uint8Array)&&($=l.from($)),!l.isBuffer($))throw new TypeError('"list" argument must be an Array of Buffers');$.copy(N,O),O+=$.length}return N},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var b=this.length;if(b%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var C=0;C<b;C+=2)m(this,C,C+1);return this},l.prototype.swap32=function(){var b=this.length;if(b%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var C=0;C<b;C+=4)m(this,C,C+3),m(this,C+1,C+2);return this},l.prototype.swap64=function(){var b=this.length;if(b%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var C=0;C<b;C+=8)m(this,C,C+7),m(this,C+1,C+6),m(this,C+2,C+5),m(this,C+3,C+4);return this},l.prototype.toString=function(){var b=this.length;return b===0?"":arguments.length===0?_(this,0,b):(function(C,E,N){var O=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0)<=(E>>>=0))return"";for(C||(C="utf8");;)switch(C){case"hex":return B(this,E,N);case"utf8":case"utf-8":return _(this,E,N);case"ascii":return S(this,E,N);case"latin1":case"binary":return P(this,E,N);case"base64":return U(this,E,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,E,N);default:if(O)throw new TypeError("Unknown encoding: "+C);C=(C+"").toLowerCase(),O=!0}}).apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(b){if(!l.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||l.compare(this,b)===0},l.prototype.inspect=function(){var b="",C=i.INSPECT_MAX_BYTES;return b=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(b+=" ... "),"<Buffer "+b+">"},l.prototype.compare=function(b,C,E,N,O){if(K(b,Uint8Array)&&(b=l.from(b,b.offset,b.byteLength)),!l.isBuffer(b))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof b);if(C===void 0&&(C=0),E===void 0&&(E=b?b.length:0),N===void 0&&(N=0),O===void 0&&(O=this.length),C<0||E>b.length||N<0||O>this.length)throw new RangeError("out of range index");if(N>=O&&C>=E)return 0;if(N>=O)return-1;if(C>=E)return 1;if(C>>>=0,E>>>=0,N>>>=0,O>>>=0,this===b)return 0;for(var $=O-N,G=E-C,Z=Math.min($,G),J=this.slice(N,O),ee=b.slice(C,E),te=0;te<Z;++te)if(J[te]!==ee[te]){$=J[te],G=ee[te];break}return $<G?-1:G<$?1:0},l.prototype.includes=function(b,C,E){return this.indexOf(b,C,E)!==-1},l.prototype.indexOf=function(b,C,E){return w(this,b,C,E,!0)},l.prototype.lastIndexOf=function(b,C,E){return w(this,b,C,E,!1)},l.prototype.write=function(b,C,E,N){if(C===void 0)N="utf8",E=this.length,C=0;else if(E===void 0&&typeof C=="string")N=C,E=this.length,C=0;else{if(!isFinite(C))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");C>>>=0,isFinite(E)?(E>>>=0,N===void 0&&(N="utf8")):(N=E,E=void 0)}var O=this.length-C;if((E===void 0||E>O)&&(E=O),b.length>0&&(E<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var $=!1;;)switch(N){case"hex":return x(this,b,C,E);case"utf8":case"utf-8":return T(this,b,C,E);case"ascii":return A(this,b,C,E);case"latin1":case"binary":return I(this,b,C,E);case"base64":return R(this,b,C,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,b,C,E);default:if($)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),$=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(b,C,E){var N="";E=Math.min(b.length,E);for(var O=C;O<E;++O)N+=String.fromCharCode(127&b[O]);return N}function P(b,C,E){var N="";E=Math.min(b.length,E);for(var O=C;O<E;++O)N+=String.fromCharCode(b[O]);return N}function B(b,C,E){var N=b.length;(!C||C<0)&&(C=0),(!E||E<0||E>N)&&(E=N);for(var O="",$=C;$<E;++$)O+=V(b[$]);return O}function D(b,C,E){for(var N=b.slice(C,E),O="",$=0;$<N.length;$+=2)O+=String.fromCharCode(N[$]+256*N[$+1]);return O}function H(b,C,E){if(b%1!=0||b<0)throw new RangeError("offset is not uint");if(b+C>E)throw new RangeError("Trying to access beyond buffer length")}function L(b,C,E,N,O,$){if(!l.isBuffer(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>O||C<$)throw new RangeError('"value" argument is out of bounds');if(E+N>b.length)throw new RangeError("Index out of range")}function M(b,C,E,N,O,$){if(E+N>b.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function j(b,C,E,N,O){return C=+C,E>>>=0,O||M(b,0,E,4),s.write(b,C,E,N,23,4),E+4}function W(b,C,E,N,O){return C=+C,E>>>=0,O||M(b,0,E,8),s.write(b,C,E,N,52,8),E+8}l.prototype.slice=function(b,C){var E=this.length;b=~~b,C=C===void 0?E:~~C,b<0?(b+=E)<0&&(b=0):b>E&&(b=E),C<0?(C+=E)<0&&(C=0):C>E&&(C=E),C<b&&(C=b);var N=this.subarray(b,C);return N.__proto__=l.prototype,N},l.prototype.readUIntLE=function(b,C,E){b>>>=0,C>>>=0,E||H(b,C,this.length);for(var N=this[b],O=1,$=0;++$<C&&(O*=256);)N+=this[b+$]*O;return N},l.prototype.readUIntBE=function(b,C,E){b>>>=0,C>>>=0,E||H(b,C,this.length);for(var N=this[b+--C],O=1;C>0&&(O*=256);)N+=this[b+--C]*O;return N},l.prototype.readUInt8=function(b,C){return b>>>=0,C||H(b,1,this.length),this[b]},l.prototype.readUInt16LE=function(b,C){return b>>>=0,C||H(b,2,this.length),this[b]|this[b+1]<<8},l.prototype.readUInt16BE=function(b,C){return b>>>=0,C||H(b,2,this.length),this[b]<<8|this[b+1]},l.prototype.readUInt32LE=function(b,C){return b>>>=0,C||H(b,4,this.length),(this[b]|this[b+1]<<8|this[b+2]<<16)+16777216*this[b+3]},l.prototype.readUInt32BE=function(b,C){return b>>>=0,C||H(b,4,this.length),16777216*this[b]+(this[b+1]<<16|this[b+2]<<8|this[b+3])},l.prototype.readIntLE=function(b,C,E){b>>>=0,C>>>=0,E||H(b,C,this.length);for(var N=this[b],O=1,$=0;++$<C&&(O*=256);)N+=this[b+$]*O;return N>=(O*=128)&&(N-=Math.pow(2,8*C)),N},l.prototype.readIntBE=function(b,C,E){b>>>=0,C>>>=0,E||H(b,C,this.length);for(var N=C,O=1,$=this[b+--N];N>0&&(O*=256);)$+=this[b+--N]*O;return $>=(O*=128)&&($-=Math.pow(2,8*C)),$},l.prototype.readInt8=function(b,C){return b>>>=0,C||H(b,1,this.length),128&this[b]?-1*(255-this[b]+1):this[b]},l.prototype.readInt16LE=function(b,C){b>>>=0,C||H(b,2,this.length);var E=this[b]|this[b+1]<<8;return 32768&E?4294901760|E:E},l.prototype.readInt16BE=function(b,C){b>>>=0,C||H(b,2,this.length);var E=this[b+1]|this[b]<<8;return 32768&E?4294901760|E:E},l.prototype.readInt32LE=function(b,C){return b>>>=0,C||H(b,4,this.length),this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24},l.prototype.readInt32BE=function(b,C){return b>>>=0,C||H(b,4,this.length),this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]},l.prototype.readFloatLE=function(b,C){return b>>>=0,C||H(b,4,this.length),s.read(this,b,!0,23,4)},l.prototype.readFloatBE=function(b,C){return b>>>=0,C||H(b,4,this.length),s.read(this,b,!1,23,4)},l.prototype.readDoubleLE=function(b,C){return b>>>=0,C||H(b,8,this.length),s.read(this,b,!0,52,8)},l.prototype.readDoubleBE=function(b,C){return b>>>=0,C||H(b,8,this.length),s.read(this,b,!1,52,8)},l.prototype.writeUIntLE=function(b,C,E,N){b=+b,C>>>=0,E>>>=0,N||L(this,b,C,E,Math.pow(2,8*E)-1,0);var O=1,$=0;for(this[C]=255&b;++$<E&&(O*=256);)this[C+$]=b/O&255;return C+E},l.prototype.writeUIntBE=function(b,C,E,N){b=+b,C>>>=0,E>>>=0,N||L(this,b,C,E,Math.pow(2,8*E)-1,0);var O=E-1,$=1;for(this[C+O]=255&b;--O>=0&&($*=256);)this[C+O]=b/$&255;return C+E},l.prototype.writeUInt8=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,1,255,0),this[C]=255&b,C+1},l.prototype.writeUInt16LE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,2,65535,0),this[C]=255&b,this[C+1]=b>>>8,C+2},l.prototype.writeUInt16BE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,2,65535,0),this[C]=b>>>8,this[C+1]=255&b,C+2},l.prototype.writeUInt32LE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,4,4294967295,0),this[C+3]=b>>>24,this[C+2]=b>>>16,this[C+1]=b>>>8,this[C]=255&b,C+4},l.prototype.writeUInt32BE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,4,4294967295,0),this[C]=b>>>24,this[C+1]=b>>>16,this[C+2]=b>>>8,this[C+3]=255&b,C+4},l.prototype.writeIntLE=function(b,C,E,N){if(b=+b,C>>>=0,!N){var O=Math.pow(2,8*E-1);L(this,b,C,E,O-1,-O)}var $=0,G=1,Z=0;for(this[C]=255&b;++$<E&&(G*=256);)b<0&&Z===0&&this[C+$-1]!==0&&(Z=1),this[C+$]=(b/G>>0)-Z&255;return C+E},l.prototype.writeIntBE=function(b,C,E,N){if(b=+b,C>>>=0,!N){var O=Math.pow(2,8*E-1);L(this,b,C,E,O-1,-O)}var $=E-1,G=1,Z=0;for(this[C+$]=255&b;--$>=0&&(G*=256);)b<0&&Z===0&&this[C+$+1]!==0&&(Z=1),this[C+$]=(b/G>>0)-Z&255;return C+E},l.prototype.writeInt8=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,1,127,-128),b<0&&(b=255+b+1),this[C]=255&b,C+1},l.prototype.writeInt16LE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,2,32767,-32768),this[C]=255&b,this[C+1]=b>>>8,C+2},l.prototype.writeInt16BE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,2,32767,-32768),this[C]=b>>>8,this[C+1]=255&b,C+2},l.prototype.writeInt32LE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,4,2147483647,-2147483648),this[C]=255&b,this[C+1]=b>>>8,this[C+2]=b>>>16,this[C+3]=b>>>24,C+4},l.prototype.writeInt32BE=function(b,C,E){return b=+b,C>>>=0,E||L(this,b,C,4,2147483647,-2147483648),b<0&&(b=4294967295+b+1),this[C]=b>>>24,this[C+1]=b>>>16,this[C+2]=b>>>8,this[C+3]=255&b,C+4},l.prototype.writeFloatLE=function(b,C,E){return j(this,b,C,!0,E)},l.prototype.writeFloatBE=function(b,C,E){return j(this,b,C,!1,E)},l.prototype.writeDoubleLE=function(b,C,E){return W(this,b,C,!0,E)},l.prototype.writeDoubleBE=function(b,C,E){return W(this,b,C,!1,E)},l.prototype.copy=function(b,C,E,N){if(!l.isBuffer(b))throw new TypeError("argument should be a Buffer");if(E||(E=0),N||N===0||(N=this.length),C>=b.length&&(C=b.length),C||(C=0),N>0&&N<E&&(N=E),N===E||b.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),b.length-C<N-E&&(N=b.length-C+E);var O=N-E;if(this===b&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(C,E,N);else if(this===b&&E<C&&C<N)for(var $=O-1;$>=0;--$)b[$+C]=this[$+E];else Uint8Array.prototype.set.call(b,this.subarray(E,N),C);return O},l.prototype.fill=function(b,C,E,N){if(typeof b=="string"){if(typeof C=="string"?(N=C,C=0,E=this.length):typeof E=="string"&&(N=E,E=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!l.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(b.length===1){var O=b.charCodeAt(0);(N==="utf8"&&O<128||N==="latin1")&&(b=O)}}else typeof b=="number"&&(b&=255);if(C<0||this.length<C||this.length<E)throw new RangeError("Out of range index");if(E<=C)return this;var $;if(C>>>=0,E=E===void 0?this.length:E>>>0,b||(b=0),typeof b=="number")for($=C;$<E;++$)this[$]=b;else{var G=l.isBuffer(b)?b:l.from(b,N),Z=G.length;if(Z===0)throw new TypeError('The value "'+b+'" is invalid for argument "value"');for($=0;$<E-C;++$)this[$+C]=G[$%Z]}return this};var F=/[^+/0-9A-Za-z-_]/g;function V(b){return b<16?"0"+b.toString(16):b.toString(16)}function Y(b,C){var E;C=C||1/0;for(var N=b.length,O=null,$=[],G=0;G<N;++G){if((E=b.charCodeAt(G))>55295&&E<57344){if(!O){if(E>56319){(C-=3)>-1&&$.push(239,191,189);continue}if(G+1===N){(C-=3)>-1&&$.push(239,191,189);continue}O=E;continue}if(E<56320){(C-=3)>-1&&$.push(239,191,189),O=E;continue}E=65536+(O-55296<<10|E-56320)}else O&&(C-=3)>-1&&$.push(239,191,189);if(O=null,E<128){if((C-=1)<0)break;$.push(E)}else if(E<2048){if((C-=2)<0)break;$.push(E>>6|192,63&E|128)}else if(E<65536){if((C-=3)<0)break;$.push(E>>12|224,E>>6&63|128,63&E|128)}else{if(!(E<1114112))throw new Error("Invalid code point");if((C-=4)<0)break;$.push(E>>18|240,E>>12&63|128,E>>6&63|128,63&E|128)}}return $}function q(b){return n.toByteArray(function(C){if((C=(C=C.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;C.length%4!=0;)C+="=";return C}(b))}function Q(b,C,E,N){for(var O=0;O<N&&!(O+E>=C.length||O>=b.length);++O)C[O+E]=b[O];return O}function K(b,C){return b instanceof C||b!=null&&b.constructor!=null&&b.constructor.name!=null&&b.constructor.name===C.name}function X(b){return b!=b}}).call(this)}).call(this,r("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(r,a,i){(function(o){(function(){i.formatArgs=function(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+a.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;s.splice(1,0,u,"color: inherit");let c=0,l=0;s[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&f==="%c"&&(l=++c)}),s.splice(l,0,u)},i.save=function(s){try{s?i.storage.setItem("debug",s):i.storage.removeItem("debug")}catch{}},i.load=function(){let s;try{s=i.storage.getItem("debug")}catch{}return!s&&o!==void 0&&"env"in o&&(s=o.env.DEBUG),s},i.useColors=function(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},i.storage=function(){try{return localStorage}catch{}}(),i.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),i.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],i.log=console.debug||console.log||(()=>{}),a.exports=r("./common")(i);const{formatters:n}=a.exports;n.j=function(s){try{return JSON.stringify(s)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}).call(this)}).call(this,r("_process"))},{"./common":19,_process:50}],19:[function(r,a,i){a.exports=function(o){function n(c){let l,f,h,d=null;function v(...y){if(!v.enabled)return;const g=v,m=Number(new Date),w=m-(l||m);g.diff=w,g.prev=l,g.curr=m,l=m,y[0]=n.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let p=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(x,T)=>{if(x==="%%")return"%";p++;const A=n.formatters[T];if(typeof A=="function"){const I=y[p];x=A.call(g,I),y.splice(p,1),p--}return x}),n.formatArgs.call(g,y),(g.log||n.log).apply(g,y)}return v.namespace=c,v.useColors=n.useColors(),v.color=n.selectColor(c),v.extend=s,v.destroy=n.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==n.namespaces&&(f=n.namespaces,h=n.enabled(c)),h),set:y=>{d=y}}),typeof n.init=="function"&&n.init(v),v}function s(c,l){const f=n(this.namespace+(l===void 0?":":l)+c);return f.log=this.log,f}function u(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(c){return c instanceof Error?c.stack||c.message:c},n.disable=function(){const c=[...n.names.map(u),...n.skips.map(u).map(l=>"-"+l)].join(",");return n.enable(""),c},n.enable=function(c){let l;n.save(c),n.namespaces=c,n.names=[],n.skips=[];const f=(typeof c=="string"?c:"").split(/[\s,]+/),h=f.length;for(l=0;l<h;l++)f[l]&&((c=f[l].replace(/\*/g,".*?"))[0]==="-"?n.skips.push(new RegExp("^"+c.substr(1)+"$")):n.names.push(new RegExp("^"+c+"$")))},n.enabled=function(c){if(c[c.length-1]==="*")return!0;let l,f;for(l=0,f=n.skips.length;l<f;l++)if(n.skips[l].test(c))return!1;for(l=0,f=n.names.length;l<f;l++)if(n.names[l].test(c))return!0;return!1},n.humanize=r("ms"),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(o).forEach(c=>{n[c]=o[c]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(c){let l=0;for(let f=0;f<c.length;f++)l=(l<<5)-l+c.charCodeAt(f),l|=0;return n.colors[Math.abs(l)%n.colors.length]},n.enable(n.load()),n}},{ms:45}],20:[function(r,a,i){(function(o,n){(function(){var s=r("readable-stream"),u=r("end-of-stream"),c=r("inherits"),l=r("stream-shift"),f=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),h=function(g,m){g._corked?g.once("uncork",m):m()},d=function(g,m){return function(w){w?function(p,x){p._autoDestroy&&p.destroy(x)}(g,w.message==="premature close"?null:w):m&&!g._ended&&g.end()}},v=function(){},y=function(g,m,w){if(!(this instanceof y))return new y(g,m,w);s.Duplex.call(this,w),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!w||w.autoDestroy!==!1,this._forwardDestroy=!w||w.destroy!==!1,this._forwardEnd=!w||w.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,g&&this.setWritable(g),m&&this.setReadable(m)};c(y,s.Duplex),y.obj=function(g,m,w){return w||(w={}),w.objectMode=!0,w.highWaterMark=16,new y(g,m,w)},y.prototype.cork=function(){++this._corked==1&&this.emit("cork")},y.prototype.uncork=function(){this._corked&&--this._corked==0&&this.emit("uncork")},y.prototype.setWritable=function(g){if(this._unwrite&&this._unwrite(),this.destroyed)g&&g.destroy&&g.destroy();else if(g!==null&&g!==!1){var m=this,w=u(g,{writable:!0,readable:!1},d(this,this._forwardEnd)),p=function(){var x=m._ondrain;m._ondrain=null,x&&x()};this._unwrite&&o.nextTick(p),this._writable=g,this._writable.on("drain",p),this._unwrite=function(){m._writable.removeListener("drain",p),w()},this.uncork()}else this.end()},y.prototype.setReadable=function(g){if(this._unread&&this._unread(),this.destroyed)g&&g.destroy&&g.destroy();else{if(g===null||g===!1)return this.push(null),void this.resume();var m,w=this,p=u(g,{writable:!1,readable:!0},d(this)),x=function(){w._forward()},T=function(){w.push(null)};this._drained=!0,this._readable=g,this._readable2=g._readableState?g:(m=g,new s.Readable({objectMode:!0,highWaterMark:16}).wrap(m)),this._readable2.on("readable",x),this._readable2.on("end",T),this._unread=function(){w._readable2.removeListener("readable",x),w._readable2.removeListener("end",T),p()},this._forward()}},y.prototype._read=function(){this._drained=!0,this._forward()},y.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var g;for(this._forwarding=!0;this._drained&&(g=l(this._readable2))!==null;)this.destroyed||(this._drained=this.push(g));this._forwarding=!1}},y.prototype.destroy=function(g,m){if(m||(m=v),this.destroyed)return m(null);this.destroyed=!0;var w=this;o.nextTick(function(){w._destroy(g),m(null)})},y.prototype._destroy=function(g){if(g){var m=this._ondrain;this._ondrain=null,m?m(g):this.emit("error",g)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},y.prototype._write=function(g,m,w){if(!this.destroyed)return this._corked?h(this,this._write.bind(this,g,m,w)):g===f?this._finish(w):this._writable?void(this._writable.write(g)===!1?this._ondrain=w:this.destroyed||w()):w()},y.prototype._finish=function(g){var m=this;this.emit("preend"),h(this,function(){var w,p;w=m._forwardEnd&&m._writable,p=function(){m._writableState.prefinished===!1&&(m._writableState.prefinished=!0),m.emit("prefinish"),h(m,g)},w?w._writableState&&w._writableState.finished?p():w._writableState?w.end(p):(w.end(),p()):p()})},y.prototype.end=function(g,m,w){return typeof g=="function"?this.end(null,null,g):typeof m=="function"?this.end(g,null,m):(this._ended=!0,g&&this.write(g),this._writableState.ending||this._writableState.destroyed||this.write(f),s.Writable.prototype.end.call(this,w))},a.exports=y}).call(this)}).call(this,r("_process"),r("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(r,a,i){(function(o){(function(){var n=r("once"),s=function(){},u=function(c,l,f){if(typeof l=="function")return u(c,null,l);l||(l={}),f=n(f||s);var h=c._writableState,d=c._readableState,v=l.readable||l.readable!==!1&&c.readable,y=l.writable||l.writable!==!1&&c.writable,g=!1,m=function(){c.writable||w()},w=function(){y=!1,v||f.call(c)},p=function(){v=!1,y||f.call(c)},x=function(z){f.call(c,z?new Error("exited with error code: "+z):null)},T=function(z){f.call(c,z)},A=function(){o.nextTick(I)},I=function(){if(!g)return(!v||d&&d.ended&&!d.destroyed)&&(!y||h&&h.ended&&!h.destroyed)?void 0:f.call(c,new Error("premature close"))},R=function(){c.req.on("finish",w)};return function(z){return z.setHeader&&typeof z.abort=="function"}(c)?(c.on("complete",w),c.on("abort",A),c.req?R():c.on("request",R)):y&&!h&&(c.on("end",m),c.on("close",m)),function(z){return z.stdio&&Array.isArray(z.stdio)&&z.stdio.length===3}(c)&&c.on("exit",x),c.on("end",p),c.on("finish",w),l.error!==!1&&c.on("error",T),c.on("close",A),function(){g=!0,c.removeListener("complete",w),c.removeListener("abort",A),c.removeListener("request",R),c.req&&c.req.removeListener("finish",w),c.removeListener("end",m),c.removeListener("close",m),c.removeListener("finish",w),c.removeListener("exit",x),c.removeListener("end",p),c.removeListener("error",T),c.removeListener("close",A)}};a.exports=u}).call(this)}).call(this,r("_process"))},{_process:50,once:48}],22:[function(r,a,i){var o=Object.create||function(p){var x=function(){};return x.prototype=p,new x},n=Object.keys||function(p){var x=[];for(var T in p)Object.prototype.hasOwnProperty.call(p,T)&&x.push(T);return T},s=Function.prototype.bind||function(p){var x=this;return function(){return x.apply(p,arguments)}};function u(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=o(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}a.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._maxListeners=void 0;var c,l=10;try{var f={};Object.defineProperty&&Object.defineProperty(f,"x",{value:0}),c=f.x===0}catch{c=!1}function h(p){return p._maxListeners===void 0?u.defaultMaxListeners:p._maxListeners}function d(p,x,T,A){var I,R,z;if(typeof T!="function")throw new TypeError('"listener" argument must be a function');if((R=p._events)?(R.newListener&&(p.emit("newListener",x,T.listener?T.listener:T),R=p._events),z=R[x]):(R=p._events=o(null),p._eventsCount=0),z){if(typeof z=="function"?z=R[x]=A?[T,z]:[z,T]:A?z.unshift(T):z.push(T),!z.warned&&(I=h(p))&&I>0&&z.length>I){z.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+z.length+' "'+String(x)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');U.name="MaxListenersExceededWarning",U.emitter=p,U.type=x,U.count=z.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",U.name,U.message)}}else z=R[x]=T,++p._eventsCount;return p}function v(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var p=new Array(arguments.length),x=0;x<p.length;++x)p[x]=arguments[x];this.listener.apply(this.target,p)}}function y(p,x,T){var A={fired:!1,wrapFn:void 0,target:p,type:x,listener:T},I=s.call(v,A);return I.listener=T,A.wrapFn=I,I}function g(p,x,T){var A=p._events;if(!A)return[];var I=A[x];return I?typeof I=="function"?T?[I.listener||I]:[I]:T?function(R){for(var z=new Array(R.length),U=0;U<z.length;++U)z[U]=R[U].listener||R[U];return z}(I):w(I,I.length):[]}function m(p){var x=this._events;if(x){var T=x[p];if(typeof T=="function")return 1;if(T)return T.length}return 0}function w(p,x){for(var T=new Array(x),A=0;A<x;++A)T[A]=p[A];return T}c?Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(p){if(typeof p!="number"||p<0||p!=p)throw new TypeError('"defaultMaxListeners" must be a positive number');l=p}}):u.defaultMaxListeners=l,u.prototype.setMaxListeners=function(p){if(typeof p!="number"||p<0||isNaN(p))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=p,this},u.prototype.getMaxListeners=function(){return h(this)},u.prototype.emit=function(p){var x,T,A,I,R,z,U=p==="error";if(z=this._events)U=U&&z.error==null;else if(!U)return!1;if(U){if(arguments.length>1&&(x=arguments[1]),x instanceof Error)throw x;var _=new Error('Unhandled "error" event. ('+x+")");throw _.context=x,_}if(!(T=z[p]))return!1;var k=typeof T=="function";switch(A=arguments.length){case 1:(function(S,P,B){if(P)S.call(B);else for(var D=S.length,H=w(S,D),L=0;L<D;++L)H[L].call(B)})(T,k,this);break;case 2:(function(S,P,B,D){if(P)S.call(B,D);else for(var H=S.length,L=w(S,H),M=0;M<H;++M)L[M].call(B,D)})(T,k,this,arguments[1]);break;case 3:(function(S,P,B,D,H){if(P)S.call(B,D,H);else for(var L=S.length,M=w(S,L),j=0;j<L;++j)M[j].call(B,D,H)})(T,k,this,arguments[1],arguments[2]);break;case 4:(function(S,P,B,D,H,L){if(P)S.call(B,D,H,L);else for(var M=S.length,j=w(S,M),W=0;W<M;++W)j[W].call(B,D,H,L)})(T,k,this,arguments[1],arguments[2],arguments[3]);break;default:for(I=new Array(A-1),R=1;R<A;R++)I[R-1]=arguments[R];(function(S,P,B,D){if(P)S.apply(B,D);else for(var H=S.length,L=w(S,H),M=0;M<H;++M)L[M].apply(B,D)})(T,k,this,I)}return!0},u.prototype.addListener=function(p,x){return d(this,p,x,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(p,x){return d(this,p,x,!0)},u.prototype.once=function(p,x){if(typeof x!="function")throw new TypeError('"listener" argument must be a function');return this.on(p,y(this,p,x)),this},u.prototype.prependOnceListener=function(p,x){if(typeof x!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(p,y(this,p,x)),this},u.prototype.removeListener=function(p,x){var T,A,I,R,z;if(typeof x!="function")throw new TypeError('"listener" argument must be a function');if(!(A=this._events))return this;if(!(T=A[p]))return this;if(T===x||T.listener===x)--this._eventsCount==0?this._events=o(null):(delete A[p],A.removeListener&&this.emit("removeListener",p,T.listener||x));else if(typeof T!="function"){for(I=-1,R=T.length-1;R>=0;R--)if(T[R]===x||T[R].listener===x){z=T[R].listener,I=R;break}if(I<0)return this;I===0?T.shift():function(U,_){for(var k=_,S=k+1,P=U.length;S<P;k+=1,S+=1)U[k]=U[S];U.pop()}(T,I),T.length===1&&(A[p]=T[0]),A.removeListener&&this.emit("removeListener",p,z||x)}return this},u.prototype.removeAllListeners=function(p){var x,T,A;if(!(T=this._events))return this;if(!T.removeListener)return arguments.length===0?(this._events=o(null),this._eventsCount=0):T[p]&&(--this._eventsCount==0?this._events=o(null):delete T[p]),this;if(arguments.length===0){var I,R=n(T);for(A=0;A<R.length;++A)(I=R[A])!=="removeListener"&&this.removeAllListeners(I);return this.removeAllListeners("removeListener"),this._events=o(null),this._eventsCount=0,this}if(typeof(x=T[p])=="function")this.removeListener(p,x);else if(x)for(A=x.length-1;A>=0;A--)this.removeListener(p,x[A]);return this},u.prototype.listeners=function(p){return g(this,p,!0)},u.prototype.rawListeners=function(p){return g(this,p,!1)},u.listenerCount=function(p,x){return typeof p.listenerCount=="function"?p.listenerCount(x):m.call(p,x)},u.prototype.listenerCount=m,u.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(r,a,i){i.read=function(o,n,s,u,c){var l,f,h=8*c-u-1,d=(1<<h)-1,v=d>>1,y=-7,g=s?c-1:0,m=s?-1:1,w=o[n+g];for(g+=m,l=w&(1<<-y)-1,w>>=-y,y+=h;y>0;l=256*l+o[n+g],g+=m,y-=8);for(f=l&(1<<-y)-1,l>>=-y,y+=u;y>0;f=256*f+o[n+g],g+=m,y-=8);if(l===0)l=1-v;else{if(l===d)return f?NaN:1/0*(w?-1:1);f+=Math.pow(2,u),l-=v}return(w?-1:1)*f*Math.pow(2,l-u)},i.write=function(o,n,s,u,c,l){var f,h,d,v=8*l-c-1,y=(1<<v)-1,g=y>>1,m=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=u?0:l-1,p=u?1:-1,x=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(h=isNaN(n)?1:0,f=y):(f=Math.floor(Math.log(n)/Math.LN2),n*(d=Math.pow(2,-f))<1&&(f--,d*=2),(n+=f+g>=1?m/d:m*Math.pow(2,1-g))*d>=2&&(f++,d/=2),f+g>=y?(h=0,f=y):f+g>=1?(h=(n*d-1)*Math.pow(2,c),f+=g):(h=n*Math.pow(2,g-1)*Math.pow(2,c),f=0));c>=8;o[s+w]=255&h,w+=p,h/=256,c-=8);for(f=f<<c|h,v+=c;v>0;o[s+w]=255&f,w+=p,f/=256,v-=8);o[s+w-p]|=128*x}},{}],24:[function(r,a,i){typeof Object.create=="function"?a.exports=function(o,n){n&&(o.super_=n,o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:a.exports=function(o,n){if(n){o.super_=n;var s=function(){};s.prototype=n.prototype,o.prototype=new s,o.prototype.constructor=o}}},{}],25:[function(r,a,i){Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function n(s,u){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=s,this.value=u}return n.prototype.rotateLeft=function(){var s=this.parent,u=this.brother,c=this.leftChild,l=this.rightChild;if(!l)throw new Error("unknown error");var f=l.leftChild,h=l.rightChild;return s&&(s.leftChild===this?s.leftChild=l:s.rightChild===this&&(s.rightChild=l)),l.parent=s,l.brother=u,l.leftChild=this,l.rightChild=h,u&&(u.brother=l),this.parent=l,this.brother=h,this.leftChild=c,this.rightChild=f,h&&(h.parent=l,h.brother=this),c&&(c.parent=this,c.brother=f),f&&(f.parent=this,f.brother=c),l},n.prototype.rotateRight=function(){var s=this.parent,u=this.brother,c=this.leftChild;if(!c)throw new Error("unknown error");var l=this.rightChild,f=c.leftChild,h=c.rightChild;return s&&(s.leftChild===this?s.leftChild=c:s.rightChild===this&&(s.rightChild=c)),c.parent=s,c.brother=u,c.leftChild=f,c.rightChild=this,u&&(u.brother=c),f&&(f.parent=c,f.brother=this),this.parent=c,this.brother=f,this.leftChild=h,this.rightChild=l,h&&(h.parent=this,h.brother=l),l&&(l.parent=this,l.brother=h),c},n.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},n.TreeNodeColorType={red:!0,black:!1},n}();Object.freeze(o),i.default=o},{}],26:[function(r,a,i){var o=this&&this.__generator||function(s,u){var c,l,f,h,d={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return h={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function v(y){return function(g){return function(m){if(c)throw new TypeError("Generator is already executing.");for(;d;)try{if(c=1,l&&(f=2&m[0]?l.return:m[0]?l.throw||((f=l.return)&&f.call(l),0):l.next)&&!(f=f.call(l,m[1])).done)return f;switch(l=0,f&&(m=[2&m[0],f.value]),m[0]){case 0:case 1:f=m;break;case 4:return d.label++,{value:m[1],done:!1};case 5:d.label++,l=m[1],m=[0];continue;case 7:m=d.ops.pop(),d.trys.pop();continue;default:if(!(f=(f=d.trys).length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){d=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){d.label=m[1];break}if(m[0]===6&&d.label<f[1]){d.label=f[1],f=m;break}if(f&&d.label<f[2]){d.label=f[2],d.ops.push(m);break}f[2]&&d.ops.pop(),d.trys.pop();continue}m=u.call(s,d)}catch(w){m=[6,w],l=0}finally{c=f=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([y,g])}}};function n(s){var u=this;s===void 0&&(s=[]);var c=[],l=0,f=0,h=0,d=0,v=0,y=0;this.size=function(){return y},this.empty=function(){return y===0},this.clear=function(){l=h=f=d=v=y=0,m.call(this,n.bucketSize),y=0},this.front=function(){return c[l][f]},this.back=function(){return c[h][d]},this.forEach=function(w){if(!this.empty()){var p=0;if(l!==h){for(T=f;T<n.bucketSize;++T)w(c[l][T],p++);for(T=l+1;T<h;++T)for(var x=0;x<n.bucketSize;++x)w(c[T][x],p++);for(T=0;T<=d;++T)w(c[h][T],p++)}else for(var T=f;T<=d;++T)w(c[l][T],p++)}};var g=function(w){var p=l*n.bucketSize+f,x=p+w,T=h*n.bucketSize+d;if(x<p||x>T)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(x/n.bucketSize),curNodePointerIndex:x%n.bucketSize}};this.getElementByPos=function(w){var p=g(w),x=p.curNodeBucketIndex,T=p.curNodePointerIndex;return c[x][T]},this.eraseElementByPos=function(w){var p=this;if(w<0||w>y)throw new Error("pos should more than 0 and less than queue's size");if(w===0)this.popFront();else if(w===this.size())this.popBack();else{for(var x=[],T=w+1;T<y;++T)x.push(this.getElementByPos(T));this.cut(w),this.popBack(),x.forEach(function(A){return p.pushBack(A)})}},this.eraseElementByValue=function(w){if(!this.empty()){var p=[];this.forEach(function(A){A!==w&&p.push(A)});for(var x=p.length,T=0;T<x;++T)this.setElementByPos(T,p[T]);this.cut(x-1)}};var m=function(w){for(var p=[],x=w*n.sigma,T=Math.max(Math.ceil(x/n.bucketSize),2),A=0;A<T;++A)p.push(new Array(n.bucketSize));var I=Math.ceil(w/n.bucketSize),R=Math.floor(T/2)-Math.floor(I/2),z=R,U=0;if(this.size())for(A=0;A<I;++A){for(var _=0;_<n.bucketSize;++_)if(p[R+A][_]=this.front(),this.popFront(),this.empty()){z=R+A,U=_;break}if(this.empty())break}c=p,l=R,f=0,h=z,d=U,v=T,y=w};this.pushBack=function(w){this.empty()||(h===v-1&&d===n.bucketSize-1&&m.call(this,this.size()),d<n.bucketSize-1?++d:h<v-1&&(++h,d=0)),++y,c[h][d]=w},this.popBack=function(){this.empty()||(this.size()!==1&&(d>0?--d:l<h&&(--h,d=n.bucketSize-1)),y>0&&--y)},this.setElementByPos=function(w,p){var x=g(w),T=x.curNodeBucketIndex,A=x.curNodePointerIndex;c[T][A]=p},this.insert=function(w,p,x){var T=this;if(x===void 0&&(x=1),w===0)for(;x--;)this.pushFront(p);else if(w===this.size())for(;x--;)this.pushBack(p);else{for(var A=[],I=w;I<y;++I)A.push(this.getElementByPos(I));for(this.cut(w-1),I=0;I<x;++I)this.pushBack(p);A.forEach(function(R){return T.pushBack(R)})}},this.find=function(w){if(l===h){for(var p=f;p<=d;++p)if(c[l][p]===w)return!0;return!1}for(p=f;p<n.bucketSize;++p)if(c[l][p]===w)return!0;for(p=l+1;p<h;++p)for(var x=0;x<n.bucketSize;++x)if(c[p][x]===w)return!0;for(p=0;p<=d;++p)if(c[h][p]===w)return!0;return!1},this.reverse=function(){for(var w=0,p=y-1;w<p;){var x=this.getElementByPos(w);this.setElementByPos(w,this.getElementByPos(p)),this.setElementByPos(p,x),++w,--p}},this.unique=function(){if(!this.empty()){var w=[],p=this.front();this.forEach(function(T,A){A!==0&&T===p||(w.push(T),p=T)});for(var x=0;x<y;++x)this.setElementByPos(x,w[x]);this.cut(w.length-1)}},this.sort=function(w){var p=[];this.forEach(function(T){p.push(T)}),p.sort(w);for(var x=0;x<y;++x)this.setElementByPos(x,p[x])},this.pushFront=function(w){this.empty()||(l===0&&f===0&&m.call(this,this.size()),f>0?--f:l>0&&(--l,f=n.bucketSize-1)),++y,c[l][f]=w},this.popFront=function(){this.empty()||(this.size()!==1&&(f<n.bucketSize-1?++f:l<h&&(++l,f=0)),y>0&&--y)},this.shrinkToFit=function(){var w=this,p=[];this.forEach(function(I){p.push(I)});var x=p.length;c=[];for(var T=Math.ceil(x/n.bucketSize),A=0;A<T;++A)c.push(new Array(n.bucketSize));this.clear(),p.forEach(function(I){return w.pushBack(I)})},this.cut=function(w){if(w<0)this.clear();else{var p=g(w),x=p.curNodeBucketIndex,T=p.curNodePointerIndex;h=x,d=T,y=w+1}},this[Symbol.iterator]=function(){return function(){var w,p;return o(this,function(x){switch(x.label){case 0:if(y===0)return[2];if(l!==h)return[3,5];p=f,x.label=1;case 1:return p<=d?[4,c[l][p]]:[3,4];case 2:x.sent(),x.label=3;case 3:return++p,[3,1];case 4:return[2];case 5:p=f,x.label=6;case 6:return p<n.bucketSize?[4,c[l][p]]:[3,9];case 7:x.sent(),x.label=8;case 8:return++p,[3,6];case 9:p=l+1,x.label=10;case 10:if(!(p<h))return[3,15];w=0,x.label=11;case 11:return w<n.bucketSize?[4,c[p][w]]:[3,14];case 12:x.sent(),x.label=13;case 13:return++w,[3,11];case 14:return++p,[3,10];case 15:p=0,x.label=16;case 16:return p<=d?[4,c[h][p]]:[3,19];case 17:x.sent(),x.label=18;case 18:return++p,[3,16];case 19:return[2]}})}()},function(){var w=n.bucketSize;s.size?w=s.size():s.length&&(w=s.length);var p=w*n.sigma;v=Math.ceil(p/n.bucketSize),v=Math.max(v,3);for(var x=0;x<v;++x)c.push(new Array(n.bucketSize));var T=Math.ceil(w/n.bucketSize);l=Math.floor(v/2)-Math.floor(T/2),h=l,s.forEach(function(A){return u.pushBack(A)})}(),Object.freeze(this)}Object.defineProperty(i,"__esModule",{value:!0}),n.sigma=3,n.bucketSize=5e3,Object.freeze(n),i.default=n},{}],27:[function(r,a,i){var o=this&&this.__generator||function(l,f){var h,d,v,y,g={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(w){return function(p){return function(x){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,d&&(v=2&x[0]?d.return:x[0]?d.throw||((v=d.return)&&v.call(d),0):d.next)&&!(v=v.call(d,x[1])).done)return v;switch(d=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return g.label++,{value:x[1],done:!1};case 5:g.label++,d=x[1],x=[0];continue;case 7:x=g.ops.pop(),g.trys.pop();continue;default:if(!(v=(v=g.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){g=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){g.label=x[1];break}if(x[0]===6&&g.label<v[1]){g.label=v[1],v=x;break}if(v&&g.label<v[2]){g.label=v[2],g.ops.push(x);break}v[2]&&g.ops.pop(),g.trys.pop();continue}x=f.call(l,g)}catch(T){x=[6,T],d=0}finally{h=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([w,p])}}},n=this&&this.__values||function(l){var f=typeof Symbol=="function"&&Symbol.iterator,h=f&&l[f],d=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&d>=l.length&&(l=void 0),{value:l&&l[d++],done:!l}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i,"__esModule",{value:!0});var s=r("../LinkList/LinkList"),u=r("../Map/Map");function c(l,f,h){var d=this;if(l===void 0&&(l=[]),f===void 0&&(f=c.initSize),h=h||function(m){var w,p,x=0,T="";if(typeof m=="number")x=((x=Math.floor(m))<<5)-x,x&=x;else{T=typeof m!="string"?JSON.stringify(m):m;try{for(var A=n(T),I=A.next();!I.done;I=A.next())x=(x<<5)-x+I.value.charCodeAt(0),x&=x}catch(R){w={error:R}}finally{try{I&&!I.done&&(p=A.return)&&p.call(A)}finally{if(w)throw w.error}}}return x^=x>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var v=0,y=[],g=Math.max(c.initSize,Math.min(c.maxSize,f));this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,g=f,y=[]},this.forEach=function(m){var w=0;y.forEach(function(p){p.forEach(function(x){m(x,w++)})})},this.setElement=function(m,w){var p,x;if(m==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(w!=null){var T=h(m)&g-1;if(y[T]){var A=y[T].size();if(y[T]instanceof s.default){try{for(var I=n(y[T]),R=I.next();!R.done;R=I.next()){var z=R.value;if(z.key===m)return void(z.value=w)}}catch(_){p={error:_}}finally{try{R&&!R.done&&(x=I.return)&&x.call(I)}finally{if(p)throw p.error}}y[T].pushBack({key:m,value:w}),y[T].size()>=c.treeifyThreshold&&(y[T]=new u.default(y[T]))}else y[T].setElement(m,w);var U=y[T].size();v+=U-A}else++v,y[T]=new s.default([{key:m,value:w}]);v>g*c.sigma&&(function(_){if(!(_>=c.maxSize)){g=2*_;var k=[];y.forEach(function(S,P){if(!S.empty()){if(S instanceof s.default&&S.size()===1){var B=S.front(),D=B.key,H=B.value;k[h(D)&g-1]=new s.default([{key:D,value:H}])}else if(S instanceof u.default){var L=new s.default,M=new s.default;S.forEach(function(F){h(F.key)&_?M.pushBack(F):L.pushBack(F)}),L.size()>c.untreeifyThreshold?k[P]=new u.default(L):L.size()&&(k[P]=L),M.size()>c.untreeifyThreshold?k[P+_]=new u.default(M):M.size()&&(k[P+_]=M)}else{var j=new s.default,W=new s.default;S.forEach(function(F){h(F.key)&_?W.pushBack(F):j.pushBack(F)}),j.size()&&(k[P]=j),W.size()&&(k[P+_]=W)}y[P].clear()}}),y=k}}).call(this,g)}else this.eraseElementByKey(m)},this.getElementByKey=function(m){var w,p,x=h(m)&g-1;if(y[x]){if(y[x]instanceof u.default)return y[x].getElementByKey(m);try{for(var T=n(y[x]),A=T.next();!A.done;A=T.next()){var I=A.value;if(I.key===m)return I.value}}catch(R){w={error:R}}finally{try{A&&!A.done&&(p=T.return)&&p.call(T)}finally{if(w)throw w.error}}}},this.eraseElementByKey=function(m){var w,p,x=h(m)&g-1;if(y[x]){var T=y[x].size();if(y[x]instanceof u.default)y[x].eraseElementByKey(m),y[x].size()<=c.untreeifyThreshold&&(y[x]=new s.default(y[x]));else{var A=-1;try{for(var I=n(y[x]),R=I.next();!R.done;R=I.next())if(++A,R.value.key===m){y[x].eraseElementByPos(A);break}}catch(U){w={error:U}}finally{try{R&&!R.done&&(p=I.return)&&p.call(I)}finally{if(w)throw w.error}}}var z=y[x].size();v+=z-T}},this.find=function(m){var w,p,x=h(m)&g-1;if(!y[x])return!1;if(y[x]instanceof u.default)return y[x].find(m);try{for(var T=n(y[x]),A=T.next();!A.done;A=T.next())if(A.value.key===m)return!0}catch(I){w={error:I}}finally{try{A&&!A.done&&(p=T.return)&&p.call(T)}finally{if(w)throw w.error}}return!1},this[Symbol.iterator]=function(){return function(){var m,w,p,x,T,A;return o(this,function(I){switch(I.label){case 0:m=0,I.label=1;case 1:if(!(m<g))return[3,10];for(;m<g&&!y[m];)++m;if(m>=g)return[3,10];I.label=2;case 2:I.trys.push([2,7,8,9]),T=void 0,w=n(y[m]),p=w.next(),I.label=3;case 3:return p.done?[3,6]:[4,p.value];case 4:I.sent(),I.label=5;case 5:return p=w.next(),[3,3];case 6:return[3,9];case 7:return x=I.sent(),T={error:x},[3,9];case 8:try{p&&!p.done&&(A=w.return)&&A.call(w)}finally{if(T)throw T.error}return[7];case 9:return++m,[3,1];case 10:return[2]}})}()},l.forEach(function(m){var w=m.key,p=m.value;return d.setElement(w,p)}),Object.freeze(this)}c.initSize=16,c.maxSize=1<<30,c.sigma=.75,c.treeifyThreshold=8,c.untreeifyThreshold=6,c.minTreeifySize=64,Object.freeze(c),i.default=c},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(r,a,i){var o=this&&this.__generator||function(l,f){var h,d,v,y,g={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(w){return function(p){return function(x){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,d&&(v=2&x[0]?d.return:x[0]?d.throw||((v=d.return)&&v.call(d),0):d.next)&&!(v=v.call(d,x[1])).done)return v;switch(d=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return g.label++,{value:x[1],done:!1};case 5:g.label++,d=x[1],x=[0];continue;case 7:x=g.ops.pop(),g.trys.pop();continue;default:if(!(v=(v=g.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){g=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){g.label=x[1];break}if(x[0]===6&&g.label<v[1]){g.label=v[1],v=x;break}if(v&&g.label<v[2]){g.label=v[2],g.ops.push(x);break}v[2]&&g.ops.pop(),g.trys.pop();continue}x=f.call(l,g)}catch(T){x=[6,T],d=0}finally{h=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([w,p])}}},n=this&&this.__values||function(l){var f=typeof Symbol=="function"&&Symbol.iterator,h=f&&l[f],d=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&d>=l.length&&(l=void 0),{value:l&&l[d++],done:!l}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i,"__esModule",{value:!0});var s=r("../Set/Set"),u=r("../LinkList/LinkList");function c(l,f,h){var d=this;if(l===void 0&&(l=[]),f===void 0&&(f=c.initSize),h=h||function(m){var w=0,p="";if(typeof m=="number")w=((w=Math.floor(m))<<5)-w,w&=w;else{p=typeof m!="string"?JSON.stringify(m):m;for(var x=0;x<p.length;x++)w=(w<<5)-w+p.charCodeAt(x),w&=w}return w^=w>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var v=0,y=[],g=Math.max(c.initSize,Math.min(c.maxSize,f));this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,g=f,y=[]},this.forEach=function(m){var w=0;y.forEach(function(p){p.forEach(function(x){m(x,w++)})})},this.insert=function(m){if(m==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var w=h(m)&g-1;if(y[w]){var p=y[w].size();if(y[w]instanceof u.default){if(y[w].find(m))return;y[w].pushBack(m),y[w].size()>=c.treeifyThreshold&&(y[w]=new s.default(y[w]))}else y[w].insert(m);var x=y[w].size();v+=x-p}else y[w]=new u.default([m]),++v;v>g*c.sigma&&(function(T){if(!(T>=c.maxSize)){g=2*T;var A=[];y.forEach(function(I,R){if(!I.empty()){if(I instanceof u.default&&I.size()===1){var z=I.front();if(z===void 0)throw new Error("unknown error");A[h(z)&g-1]=new u.default([z])}else if(I instanceof s.default){var U=new u.default,_=new u.default;I.forEach(function(P){h(P)&T?_.pushBack(P):U.pushBack(P)}),U.size()>c.untreeifyThreshold?A[R]=new s.default(U):U.size()&&(A[R]=U),_.size()>c.untreeifyThreshold?A[R+T]=new s.default(_):_.size()&&(A[R+T]=_)}else{var k=new u.default,S=new u.default;I.forEach(function(P){h(P)&T?S.pushBack(P):k.pushBack(P)}),k.size()&&(A[R]=k),S.size()&&(A[R+T]=S)}y[R].clear()}}),y=A}}).call(this,g)},this.eraseElementByValue=function(m){var w=h(m)&g-1;if(y[w]){var p=y[w].size();y[w].eraseElementByValue(m),y[w]instanceof s.default&&y[w].size()<=c.untreeifyThreshold&&(y[w]=new u.default(y[w]));var x=y[w].size();v+=x-p}},this.find=function(m){var w=h(m)&g-1;return!!y[w]&&y[w].find(m)},this[Symbol.iterator]=function(){return function(){var m,w,p,x,T,A;return o(this,function(I){switch(I.label){case 0:m=0,I.label=1;case 1:if(!(m<g))return[3,10];for(;m<g&&!y[m];)++m;if(m>=g)return[3,10];I.label=2;case 2:I.trys.push([2,7,8,9]),T=void 0,w=n(y[m]),p=w.next(),I.label=3;case 3:return p.done?[3,6]:[4,p.value];case 4:I.sent(),I.label=5;case 5:return p=w.next(),[3,3];case 6:return[3,9];case 7:return x=I.sent(),T={error:x},[3,9];case 8:try{p&&!p.done&&(A=w.return)&&A.call(w)}finally{if(T)throw T.error}return[7];case 9:return++m,[3,1];case 10:return[2]}})}()},l.forEach(function(m){return d.insert(m)}),Object.freeze(this)}c.initSize=16,c.maxSize=1<<30,c.sigma=.75,c.treeifyThreshold=8,c.untreeifyThreshold=6,c.minTreeifySize=64,Object.freeze(c),i.default=c},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(r,a,i){var o=this&&this.__generator||function(u,c){var l,f,h,d,v={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]};return d={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function y(g){return function(m){return function(w){if(l)throw new TypeError("Generator is already executing.");for(;v;)try{if(l=1,f&&(h=2&w[0]?f.return:w[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,w[1])).done)return h;switch(f=0,h&&(w=[2&w[0],h.value]),w[0]){case 0:case 1:h=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,f=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(!(h=(h=v.trys).length>0&&h[h.length-1])&&(w[0]===6||w[0]===2)){v=0;continue}if(w[0]===3&&(!h||w[1]>h[0]&&w[1]<h[3])){v.label=w[1];break}if(w[0]===6&&v.label<h[1]){v.label=h[1],h=w;break}if(h&&v.label<h[2]){v.label=h[2],v.ops.push(w);break}h[2]&&v.ops.pop(),v.trys.pop();continue}w=c.call(u,v)}catch(p){w=[6,p],f=0}finally{l=h=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}([g,m])}}};Object.defineProperty(i,"__esModule",{value:!0});var n=function(){return function(u){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=u}}();function s(u){var c=this;u===void 0&&(u=[]);var l=0,f=void 0,h=void 0;this.size=function(){return l},this.empty=function(){return l===0},this.clear=function(){f=h=void 0,l=0},this.front=function(){return f==null?void 0:f.value},this.back=function(){return h==null?void 0:h.value},this.forEach=function(d){for(var v=f,y=0;v;){if(v.value===void 0)throw new Error("unknown error");d(v.value,y++),v=v.next}},this.getElementByPos=function(d){if(d<0||d>=l)throw new Error("pos must more then 0 and less then the list length");for(var v=f;d--&&v;)v=v.next;if(!v||v.value===void 0)throw new Error("unknown error");return v.value},this.eraseElementByPos=function(d){if(d<0||d>=l)throw new Error("erase pos must more then 0 and less then the list length");if(d===0)this.popFront();else if(d===l-1)this.popBack();else{for(var v=f;d--;){if(!(v!=null&&v.next))throw new Error("unknown error");v=v.next}if(!v||!v.pre||!v.next)throw new Error("unknown error");var y=v.pre,g=v.next;g.pre=y,y.next=g,l>0&&--l}},this.eraseElementByValue=function(d){for(;f&&f.value===d;)this.popFront();for(;h&&h.value===d;)this.popBack();if(f)for(var v=f;v;){if(v.value===d){var y=v.pre,g=v.next;g&&(g.pre=y),y&&(y.next=g),l>0&&--l}v=v.next}},this.pushBack=function(d){if(d==null)throw new Error("you can't push null or undefined here");++l;var v=new n(d);h?(h.next=v,v.pre=h,h=v):f=h=v},this.popBack=function(){h&&(l>0&&--l,h&&(f===h?f=h=void 0:(h=h.pre)&&(h.next=void 0)))},this.setElementByPos=function(d,v){if(v==null)throw new Error("you can't set null or undefined here");if(d<0||d>=l)throw new Error("pos must more then 0 and less then the list length");for(var y=f;d--;){if(!y)throw new Error("unknown error");y=y.next}y&&(y.value=v)},this.insert=function(d,v,y){if(y===void 0&&(y=1),v==null)throw new Error("you can't insert null or undefined here");if(d<0||d>l)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(y<0)throw new Error("insert size must more than 0");if(d===0)for(;y--;)this.pushFront(v);else if(d===l)for(;y--;)this.pushBack(v);else{for(var g=f,m=1;m<d;++m){if(!(g!=null&&g.next))throw new Error("unknown error");g=g==null?void 0:g.next}if(!g)throw new Error("unknown error");var w=g.next;for(l+=y;y--;)g.next=new n(v),g.next.pre=g,g=g.next;g.next=w,w&&(w.pre=g)}},this.find=function(d){for(var v=f;v;){if(v.value===d)return!0;v=v.next}return!1},this.reverse=function(){for(var d=f,v=h,y=0;d&&v&&2*y<l;){var g=d.value;d.value=v.value,v.value=g,d=d.next,v=v.pre,++y}},this.unique=function(){for(var d=f;d;){for(var v=d;v&&v.next&&v.value===v.next.value;)v=v.next,l>0&&--l;d.next=v.next,d.next&&(d.next.pre=d),d=d.next}},this.sort=function(d){var v=[];this.forEach(function(g){v.push(g)}),v.sort(d);var y=f;v.forEach(function(g){y&&(y.value=g,y=y.next)})},this.pushFront=function(d){if(d==null)throw new Error("you can't push null or undefined here");++l;var v=new n(d);f?(v.next=f,f.pre=v,f=v):f=h=v},this.popFront=function(){f&&(l>0&&--l,f&&(f===h?f=h=void 0:(f=f.next)&&(f.pre=void 0)))},this.merge=function(d){var v=this,y=f;d.forEach(function(g){for(;y&&y.value!==void 0&&y.value<=g;)y=y.next;if(y===void 0)v.pushBack(g),y=h;else if(y===f)v.pushFront(g),y=f;else{++l;var m=y.pre;m&&(m.next=new n(g),m.next.pre=m,m.next.next=y,y&&(y.pre=m.next))}})},this[Symbol.iterator]=function(){return function(){var d;return o(this,function(v){switch(v.label){case 0:d=f,v.label=1;case 1:if(d===void 0)return[3,3];if(!d.value)throw new Error("unknown error");return[4,d.value];case 2:return v.sent(),d=d.next,[3,1];case 3:return[2]}})}()},u.forEach(function(d){return c.pushBack(d)}),Object.freeze(this)}Object.freeze(s),i.default=s},{}],30:[function(r,a,i){var o=this&&this.__generator||function(c,l){var f,h,d,v,y={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return v={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function g(m){return function(w){return function(p){if(f)throw new TypeError("Generator is already executing.");for(;y;)try{if(f=1,h&&(d=2&p[0]?h.return:p[0]?h.throw||((d=h.return)&&d.call(h),0):h.next)&&!(d=d.call(h,p[1])).done)return d;switch(h=0,d&&(p=[2&p[0],d.value]),p[0]){case 0:case 1:d=p;break;case 4:return y.label++,{value:p[1],done:!1};case 5:y.label++,h=p[1],p=[0];continue;case 7:p=y.ops.pop(),y.trys.pop();continue;default:if(!(d=(d=y.trys).length>0&&d[d.length-1])&&(p[0]===6||p[0]===2)){y=0;continue}if(p[0]===3&&(!d||p[1]>d[0]&&p[1]<d[3])){y.label=p[1];break}if(p[0]===6&&y.label<d[1]){y.label=d[1],d=p;break}if(d&&y.label<d[2]){y.label=d[2],y.ops.push(p);break}d[2]&&y.ops.pop(),y.trys.pop();continue}p=l.call(c,y)}catch(x){p=[6,x],h=0}finally{f=d=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([m,w])}}},n=this&&this.__values||function(c){var l=typeof Symbol=="function"&&Symbol.iterator,f=l&&c[l],h=0;if(f)return f.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&h>=c.length&&(c=void 0),{value:c&&c[h++],done:!c}}};throw new TypeError(l?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i,"__esModule",{value:!0});var s=r("../Base/TreeNode");function u(c,l){var f=this;c===void 0&&(c=[]),l=l||function(_,k){return _<k?-1:_>k?1:0};var h=0,d=new s.default;d.color=s.default.TreeNodeColorType.black,this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){h=0,d.key=d.value=void 0,d.leftChild=d.rightChild=d.brother=void 0};var v=function(_){if(!_||_.key===void 0)throw new Error("unknown error");return _.leftChild?v(_.leftChild):_},y=function(_){if(!_||_.key===void 0)throw new Error("unknown error");return _.rightChild?y(_.rightChild):_};this.front=function(){if(!this.empty()){var _=v(d);if(_.key===void 0||_.value===void 0)throw new Error("unknown error");return{key:_.key,value:_.value}}},this.back=function(){if(!this.empty()){var _=y(d);if(_.key===void 0||_.value===void 0)throw new Error("unknown error");return{key:_.key,value:_.value}}},this.forEach=function(_){var k,S,P=0;try{for(var B=n(this),D=B.next();!D.done;D=B.next())_(D.value,P++)}catch(H){k={error:H}}finally{try{D&&!D.done&&(S=B.return)&&S.call(B)}finally{if(k)throw k.error}}},this.getElementByPos=function(_){var k,S;if(_<0||_>=this.size())throw new Error("pos must more than 0 and less than set's size");var P=0;try{for(var B=n(this),D=B.next();!D.done;D=B.next()){var H=D.value;if(P===_)return H;++P}}catch(L){k={error:L}}finally{try{D&&!D.done&&(S=B.return)&&S.call(B)}finally{if(k)throw k.error}}throw new Error("unknown Error")};var g=function(_,k){if(_&&_.key!==void 0&&_.value!==void 0){var S=l(_.key,k);return S===0?{key:_.key,value:_.value}:S<0?g(_.rightChild,k):g(_.leftChild,k)||{key:_.key,value:_.value}}};this.lowerBound=function(_){return g(d,_)};var m=function(_,k){if(_&&_.key!==void 0&&_.value!==void 0)return l(_.key,k)<=0?m(_.rightChild,k):m(_.leftChild,k)||{key:_.key,value:_.value}};this.upperBound=function(_){return m(d,_)};var w=function(_,k){if(_&&_.key!==void 0&&_.value!==void 0){var S=l(_.key,k);return S===0?{key:_.key,value:_.value}:S>0?w(_.leftChild,k):w(_.rightChild,k)||{key:_.key,value:_.value}}};this.reverseLowerBound=function(_){return w(d,_)};var p=function(_,k){if(_&&_.key!==void 0&&_.value!==void 0)return l(_.key,k)>=0?p(_.leftChild,k):p(_.rightChild,k)||{key:_.key,value:_.value}};this.reverseUpperBound=function(_){return p(d,_)};var x=function(_){var k=_.parent;if(!k){if(_===d)return;throw new Error("unknown error")}if(_.color!==s.default.TreeNodeColorType.red){var S=_.brother;if(!S)throw new Error("unknown error");if(_===k.leftChild)if(S.color===s.default.TreeNodeColorType.red){S.color=s.default.TreeNodeColorType.black,k.color=s.default.TreeNodeColorType.red;var P=k.rotateLeft();d===k&&(d=P),x(_)}else S.color===s.default.TreeNodeColorType.black&&(S.rightChild&&S.rightChild.color===s.default.TreeNodeColorType.red?(S.color=k.color,k.color=s.default.TreeNodeColorType.black,S.rightChild&&(S.rightChild.color=s.default.TreeNodeColorType.black),P=k.rotateLeft(),d===k&&(d=P),_.color=s.default.TreeNodeColorType.black):S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||!S.leftChild||S.leftChild.color!==s.default.TreeNodeColorType.red?S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||(S.color=s.default.TreeNodeColorType.red,x(k)):(S.color=s.default.TreeNodeColorType.red,S.leftChild&&(S.leftChild.color=s.default.TreeNodeColorType.black),P=S.rotateRight(),d===S&&(d=P),x(_)));else _===k.rightChild&&(S.color===s.default.TreeNodeColorType.red?(S.color=s.default.TreeNodeColorType.black,k.color=s.default.TreeNodeColorType.red,P=k.rotateRight(),d===k&&(d=P),x(_)):S.color===s.default.TreeNodeColorType.black&&(S.leftChild&&S.leftChild.color===s.default.TreeNodeColorType.red?(S.color=k.color,k.color=s.default.TreeNodeColorType.black,S.leftChild&&(S.leftChild.color=s.default.TreeNodeColorType.black),P=k.rotateRight(),d===k&&(d=P),_.color=s.default.TreeNodeColorType.black):S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||!S.rightChild||S.rightChild.color!==s.default.TreeNodeColorType.red?S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||(S.color=s.default.TreeNodeColorType.red,x(k)):(S.color=s.default.TreeNodeColorType.red,S.rightChild&&(S.rightChild.color=s.default.TreeNodeColorType.black),P=S.rotateLeft(),d===S&&(d=P),x(_))))}else _.color=s.default.TreeNodeColorType.black},T=function(_){for(var k=_;k.leftChild||k.rightChild;){if(k.rightChild){k=v(k.rightChild);var S=_.key;_.key=k.key,k.key=S;var P=_.value;_.value=k.value,k.value=P,_=k}k.leftChild&&(k=y(k.leftChild),S=_.key,_.key=k.key,k.key=S,P=_.value,_.value=k.value,k.value=P,_=k)}x(k),k&&k.remove(),--h,d.color=s.default.TreeNodeColorType.black},A=function(_,k){return!(!_||_.key===void 0)&&(!!A(_.leftChild,k)||!!k(_)||A(_.rightChild,k))};this.eraseElementByPos=function(_){if(_<0||_>=h)throw new Error("pos must more than 0 and less than set's size");var k=0;A(d,function(S){return _===k?(T(S),!0):(++k,!1)})},this.eraseElementByKey=function(_){if(!this.empty()){var k=z(d,_);k!==void 0&&k.key!==void 0&&l(k.key,_)===0&&T(k)}};var I=function(_,k){if(!_||_.key===void 0)throw new Error("unknown error");var S=l(k,_.key);return S<0?_.leftChild?I(_.leftChild,k):(_.leftChild=new s.default,_.leftChild.parent=_,_.leftChild.brother=_.rightChild,_.rightChild&&(_.rightChild.brother=_.leftChild),_.leftChild):S>0?_.rightChild?I(_.rightChild,k):(_.rightChild=new s.default,_.rightChild.parent=_,_.rightChild.brother=_.leftChild,_.leftChild&&(_.leftChild.brother=_.rightChild),_.rightChild):_},R=function(_){var k=_.parent;if(!k){if(_===d)return;throw new Error("unknown error")}if(k.color!==s.default.TreeNodeColorType.black&&k.color===s.default.TreeNodeColorType.red){var S=k.brother,P=k.parent;if(!P)throw new Error("unknown error");if(S&&S.color===s.default.TreeNodeColorType.red)S.color=k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red,R(P);else if(!S||S.color===s.default.TreeNodeColorType.black)if(k===P.leftChild)if(_===k.leftChild){k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red;var B=P.rotateRight();P===d&&(d=B)}else _===k.rightChild&&(B=k.rotateLeft(),P===d&&(d=B),R(k));else k===P.rightChild&&(_===k.leftChild?(B=k.rotateRight(),P===d&&(d=B),R(k)):_===k.rightChild&&(k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red,B=P.rotateLeft(),P===d&&(d=B)))}};this.setElement=function(_,k){if(_==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(k!=null){if(this.empty())return++h,d.key=_,d.value=k,void(d.color=s.default.TreeNodeColorType.black);var S=I(d,_);S.key===void 0||l(S.key,_)!==0?(++h,S.key=_,S.value=k,R(S),d.color=s.default.TreeNodeColorType.black):S.value=k}else this.eraseElementByKey(_)};var z=function(_,k){if(_&&_.key!==void 0){var S=l(k,_.key);return S<0?z(_.leftChild,k):S>0?z(_.rightChild,k):_}};this.find=function(_){return!!z(d,_)},this.getElementByKey=function(_){var k=z(d,_);if((k==null?void 0:k.key)===void 0||(k==null?void 0:k.value)===void 0)throw new Error("unknown error");return k.value},this.union=function(_){var k=this;_.forEach(function(S){var P=S.key,B=S.value;return k.setElement(P,B)})},this.getHeight=function(){if(this.empty())return 0;var _=function(k){return k?Math.max(_(k.leftChild),_(k.rightChild))+1:1};return _(d)};var U=function(_){return o(this,function(k){switch(k.label){case 0:return _&&_.key!==void 0&&_.value!==void 0?[5,n(U(_.leftChild))]:[2];case 1:return k.sent(),[4,{key:_.key,value:_.value}];case 2:return k.sent(),[5,n(U(_.rightChild))];case 3:return k.sent(),[2]}})};this[Symbol.iterator]=function(){return U(d)},c.forEach(function(_){var k=_.key,S=_.value;return f.setElement(k,S)}),Object.freeze(this)}Object.freeze(u),i.default=u},{"../Base/TreeNode":25}],31:[function(r,a,i){function o(n,s){n===void 0&&(n=[]),s=s||function(h,d){return h>d?-1:h<d?1:0};var u=[];n.forEach(function(h){return u.push(h)});var c=u.length,l=function(h,d){if(h<0||h>=c)throw new Error("unknown error");if(d<0||d>=c)throw new Error("unknown error");var v=u[h];u[h]=u[d],u[d]=v},f=function(h){if(h<0||h>=c)throw new Error("unknown error");var d=2*h+1,v=2*h+2;d<c&&s(u[h],u[d])>0&&l(h,d),v<c&&s(u[h],u[v])>0&&l(h,v)};(function(){for(var h=Math.floor((c-1)/2);h>=0;--h)for(var d=h,v=2*d+1;v<c;){var y=v+1,g=v;if(y<c&&s(u[v],u[y])>0&&(g=y),s(u[d],u[g])<=0)break;l(d,g),v=2*(d=g)+1}})(),this.size=function(){return c},this.empty=function(){return c===0},this.clear=function(){c=0,u.length=0},this.push=function(h){if(u.push(h),++c!==1)for(var d=c-1;d>0;){var v=Math.floor((d-1)/2);if(s(u[v],h)<=0)break;f(v),d=v}},this.pop=function(){if(!this.empty())if(this.size()!==1){var h=u[c-1];--c;for(var d=0;d<this.size();){var v=2*d+1,y=2*d+2;if(v>=this.size())break;var g=v;if(y<this.size()&&s(u[v],u[y])>0&&(g=y),s(u[g],h)>=0)break;u[d]=u[g],d=g}u[d]=h}else--c},this.top=function(){return u[0]},Object.freeze(this)}Object.defineProperty(i,"__esModule",{value:!0}),Object.freeze(o),i.default=o},{}],32:[function(r,a,i){Object.defineProperty(i,"__esModule",{value:!0});var o=r("../LinkList/LinkList");function n(s){s===void 0&&(s=[]);var u=new o.default(s);this.size=function(){return u.size()},this.empty=function(){return u.empty()},this.clear=function(){u.clear()},this.push=function(c){u.pushBack(c)},this.pop=function(){u.popFront()},this.front=function(){return u.front()},Object.freeze(this)}Object.freeze(n),i.default=n},{"../LinkList/LinkList":29}],33:[function(r,a,i){var o=this&&this.__generator||function(c,l){var f,h,d,v,y={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return v={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function g(m){return function(w){return function(p){if(f)throw new TypeError("Generator is already executing.");for(;y;)try{if(f=1,h&&(d=2&p[0]?h.return:p[0]?h.throw||((d=h.return)&&d.call(h),0):h.next)&&!(d=d.call(h,p[1])).done)return d;switch(h=0,d&&(p=[2&p[0],d.value]),p[0]){case 0:case 1:d=p;break;case 4:return y.label++,{value:p[1],done:!1};case 5:y.label++,h=p[1],p=[0];continue;case 7:p=y.ops.pop(),y.trys.pop();continue;default:if(!(d=(d=y.trys).length>0&&d[d.length-1])&&(p[0]===6||p[0]===2)){y=0;continue}if(p[0]===3&&(!d||p[1]>d[0]&&p[1]<d[3])){y.label=p[1];break}if(p[0]===6&&y.label<d[1]){y.label=d[1],d=p;break}if(d&&y.label<d[2]){y.label=d[2],y.ops.push(p);break}d[2]&&y.ops.pop(),y.trys.pop();continue}p=l.call(c,y)}catch(x){p=[6,x],h=0}finally{f=d=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([m,w])}}},n=this&&this.__values||function(c){var l=typeof Symbol=="function"&&Symbol.iterator,f=l&&c[l],h=0;if(f)return f.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&h>=c.length&&(c=void 0),{value:c&&c[h++],done:!c}}};throw new TypeError(l?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i,"__esModule",{value:!0});var s=r("../Base/TreeNode");function u(c,l){var f=this;c===void 0&&(c=[]),l=l||function(_,k){return _<k?-1:_>k?1:0};var h=0,d=new s.default;d.color=s.default.TreeNodeColorType.black,this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){h=0,d.key=void 0,d.leftChild=d.rightChild=d.brother=d.parent=void 0,d.color=s.default.TreeNodeColorType.black};var v=function(_){if(!_||_.key===void 0)throw new Error("unknown error");return _.leftChild?v(_.leftChild):_},y=function(_){if(!_||_.key===void 0)throw new Error("unknown error");return _.rightChild?y(_.rightChild):_};this.front=function(){if(!this.empty())return v(d).key},this.back=function(){if(!this.empty())return y(d).key},this.forEach=function(_){var k,S,P=0;try{for(var B=n(this),D=B.next();!D.done;D=B.next())_(D.value,P++)}catch(H){k={error:H}}finally{try{D&&!D.done&&(S=B.return)&&S.call(B)}finally{if(k)throw k.error}}},this.getElementByPos=function(_){var k,S;if(_<0||_>=this.size())throw new Error("pos must more than 0 and less than set's size");var P=0;try{for(var B=n(this),D=B.next();!D.done;D=B.next()){var H=D.value;if(P===_)return H;++P}}catch(L){k={error:L}}finally{try{D&&!D.done&&(S=B.return)&&S.call(B)}finally{if(k)throw k.error}}throw new Error("unknown error")};var g=function(_){var k=_.parent;if(!k){if(_===d)return;throw new Error("unknown error")}if(_.color!==s.default.TreeNodeColorType.red){var S=_.brother;if(!S)throw new Error("unknown error");if(_===k.leftChild)if(S.color===s.default.TreeNodeColorType.red){S.color=s.default.TreeNodeColorType.black,k.color=s.default.TreeNodeColorType.red;var P=k.rotateLeft();d===k&&(d=P),g(_)}else S.color===s.default.TreeNodeColorType.black&&(S.rightChild&&S.rightChild.color===s.default.TreeNodeColorType.red?(S.color=k.color,k.color=s.default.TreeNodeColorType.black,S.rightChild&&(S.rightChild.color=s.default.TreeNodeColorType.black),P=k.rotateLeft(),d===k&&(d=P),_.color=s.default.TreeNodeColorType.black):S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||!S.leftChild||S.leftChild.color!==s.default.TreeNodeColorType.red?S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||(S.color=s.default.TreeNodeColorType.red,g(k)):(S.color=s.default.TreeNodeColorType.red,S.leftChild&&(S.leftChild.color=s.default.TreeNodeColorType.black),P=S.rotateRight(),d===S&&(d=P),g(_)));else _===k.rightChild&&(S.color===s.default.TreeNodeColorType.red?(S.color=s.default.TreeNodeColorType.black,k.color=s.default.TreeNodeColorType.red,P=k.rotateRight(),d===k&&(d=P),g(_)):S.color===s.default.TreeNodeColorType.black&&(S.leftChild&&S.leftChild.color===s.default.TreeNodeColorType.red?(S.color=k.color,k.color=s.default.TreeNodeColorType.black,S.leftChild&&(S.leftChild.color=s.default.TreeNodeColorType.black),P=k.rotateRight(),d===k&&(d=P),_.color=s.default.TreeNodeColorType.black):S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||!S.rightChild||S.rightChild.color!==s.default.TreeNodeColorType.red?S.leftChild&&S.leftChild.color!==s.default.TreeNodeColorType.black||S.rightChild&&S.rightChild.color!==s.default.TreeNodeColorType.black||(S.color=s.default.TreeNodeColorType.red,g(k)):(S.color=s.default.TreeNodeColorType.red,S.rightChild&&(S.rightChild.color=s.default.TreeNodeColorType.black),P=S.rotateLeft(),d===S&&(d=P),g(_))))}else _.color=s.default.TreeNodeColorType.black},m=function(_){for(var k=_;k.leftChild||k.rightChild;){if(k.rightChild){k=v(k.rightChild);var S=_.key;_.key=k.key,k.key=S,_=k}k.leftChild&&(k=y(k.leftChild),S=_.key,_.key=k.key,k.key=S,_=k)}g(k),k&&k.remove(),--h,d.color=s.default.TreeNodeColorType.black},w=function(_,k){return!(!_||_.key===void 0)&&(!!w(_.leftChild,k)||!!k(_)||w(_.rightChild,k))};this.eraseElementByPos=function(_){if(_<0||_>=h)throw new Error("pos must more than 0 and less than set's size");var k=0;w(d,function(S){return _===k?(m(S),!0):(++k,!1)})},this.eraseElementByValue=function(_){if(!this.empty()){var k=T(d,_);k!==void 0&&k.key!==void 0&&l(k.key,_)===0&&m(k)}};var p=function(_,k){if(!_||_.key===void 0)throw new Error("unknown error");var S=l(k,_.key);return S<0?_.leftChild?p(_.leftChild,k):(_.leftChild=new s.default,_.leftChild.parent=_,_.leftChild.brother=_.rightChild,_.rightChild&&(_.rightChild.brother=_.leftChild),_.leftChild):S>0?_.rightChild?p(_.rightChild,k):(_.rightChild=new s.default,_.rightChild.parent=_,_.rightChild.brother=_.leftChild,_.leftChild&&(_.leftChild.brother=_.rightChild),_.rightChild):_},x=function(_){var k=_.parent;if(!k){if(_===d)return;throw new Error("unknown error")}if(k.color!==s.default.TreeNodeColorType.black&&k.color===s.default.TreeNodeColorType.red){var S=k.brother,P=k.parent;if(!P)throw new Error("unknown error");if(S&&S.color===s.default.TreeNodeColorType.red)S.color=k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red,x(P);else if(!S||S.color===s.default.TreeNodeColorType.black)if(k===P.leftChild)if(_===k.leftChild){k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red;var B=P.rotateRight();P===d&&(d=B)}else _===k.rightChild&&(B=k.rotateLeft(),P===d&&(d=B),x(k));else k===P.rightChild&&(_===k.leftChild?(B=k.rotateRight(),P===d&&(d=B),x(k)):_===k.rightChild&&(k.color=s.default.TreeNodeColorType.black,P.color=s.default.TreeNodeColorType.red,B=P.rotateLeft(),P===d&&(d=B)))}};this.insert=function(_){if(_==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++h,d.key=_,void(d.color=s.default.TreeNodeColorType.black);var k=p(d,_);k.key!==void 0&&l(k.key,_)===0||(++h,k.key=_,x(k),d.color=s.default.TreeNodeColorType.black)};var T=function(_,k){if(_&&_.key!==void 0){var S=l(k,_.key);return S<0?T(_.leftChild,k):S>0?T(_.rightChild,k):_}};this.find=function(_){var k=T(d,_);return k!==void 0&&k.key!==void 0&&l(k.key,_)===0};var A=function(_,k){if(_&&_.key!==void 0){var S=l(_.key,k);if(S===0)return _.key;if(S<0)return A(_.rightChild,k);var P=A(_.leftChild,k);return P!==void 0?P:_.key}};this.lowerBound=function(_){return A(d,_)};var I=function(_,k){if(_&&_.key!==void 0){if(l(_.key,k)<=0)return I(_.rightChild,k);var S=I(_.leftChild,k);return S!==void 0?S:_.key}};this.upperBound=function(_){return I(d,_)};var R=function(_,k){if(_&&_.key!==void 0){var S=l(_.key,k);if(S===0)return _.key;if(S>0)return R(_.leftChild,k);var P=R(_.rightChild,k);return P!==void 0?P:_.key}};this.reverseLowerBound=function(_){return R(d,_)};var z=function(_,k){if(_&&_.key!==void 0){if(l(_.key,k)>=0)return z(_.leftChild,k);var S=z(_.rightChild,k);return S!==void 0?S:_.key}};this.reverseUpperBound=function(_){return z(d,_)},this.union=function(_){var k=this;_.forEach(function(S){return k.insert(S)})},this.getHeight=function(){if(this.empty())return 0;var _=function(k){return k?Math.max(_(k.leftChild),_(k.rightChild))+1:1};return _(d)};var U=function(_){return o(this,function(k){switch(k.label){case 0:return _&&_.key!==void 0?[5,n(U(_.leftChild))]:[2];case 1:return k.sent(),[4,_.key];case 2:return k.sent(),[5,n(U(_.rightChild))];case 3:return k.sent(),[2]}})};this[Symbol.iterator]=function(){return U(d)},c.forEach(function(_){return f.insert(_)}),Object.freeze(this)}Object.freeze(u),i.default=u},{"../Base/TreeNode":25}],34:[function(r,a,i){function o(n){var s=this;n===void 0&&(n=[]);var u=0,c=[];this.size=function(){return u},this.empty=function(){return u===0},this.clear=function(){u=0,c.length=0},this.push=function(l){c.push(l),++u},this.pop=function(){c.pop(),u>0&&--u},this.top=function(){return c[u-1]},n.forEach(function(l){return s.push(l)}),Object.freeze(this)}Object.defineProperty(i,"__esModule",{value:!0}),Object.freeze(o),i.default=o},{}],35:[function(r,a,i){var o=this&&this.__generator||function(l,f){var h,d,v,y,g={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(w){return function(p){return function(x){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,d&&(v=2&x[0]?d.return:x[0]?d.throw||((v=d.return)&&v.call(d),0):d.next)&&!(v=v.call(d,x[1])).done)return v;switch(d=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return g.label++,{value:x[1],done:!1};case 5:g.label++,d=x[1],x=[0];continue;case 7:x=g.ops.pop(),g.trys.pop();continue;default:if(!(v=(v=g.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){g=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]<v[3])){g.label=x[1];break}if(x[0]===6&&g.label<v[1]){g.label=v[1],v=x;break}if(v&&g.label<v[2]){g.label=v[2],g.ops.push(x);break}v[2]&&g.ops.pop(),g.trys.pop();continue}x=f.call(l,g)}catch(T){x=[6,T],d=0}finally{h=v=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([w,p])}}},n=this&&this.__read||function(l,f){var h=typeof Symbol=="function"&&l[Symbol.iterator];if(!h)return l;var d,v,y=h.call(l),g=[];try{for(;(f===void 0||f-- >0)&&!(d=y.next()).done;)g.push(d.value)}catch(m){v={error:m}}finally{try{d&&!d.done&&(h=y.return)&&h.call(y)}finally{if(v)throw v.error}}return g},s=this&&this.__spreadArray||function(l,f,h){if(h||arguments.length===2)for(var d,v=0,y=f.length;v<y;v++)!d&&v in f||(d||(d=Array.prototype.slice.call(f,0,v)),d[v]=f[v]);return l.concat(d||Array.prototype.slice.call(f))},u=this&&this.__values||function(l){var f=typeof Symbol=="function"&&Symbol.iterator,h=f&&l[f],d=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&d>=l.length&&(l=void 0),{value:l&&l[d++],done:!l}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};function c(l){var f=this;l===void 0&&(l=[]);var h=0,d=[];this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){h=0,d.length=0},this.front=function(){if(!this.empty())return d[0]},this.back=function(){if(!this.empty())return d[h-1]},this.forEach=function(v){d.forEach(v)},this.getElementByPos=function(v){if(v<0||v>=h)throw new Error("pos must more than 0 and less than vector's size");return d[v]},this.eraseElementByPos=function(v){if(v<0||v>=h)throw new Error("pos must more than 0 and less than vector's size");for(var y=v;y<h-1;++y)d[y]=d[y+1];this.popBack()},this.eraseElementByValue=function(v){var y=[];this.forEach(function(m){m!==v&&y.push(m)}),y.forEach(function(m,w){d[w]=m});for(var g=y.length;h>g;)this.popBack()},this.pushBack=function(v){d.push(v),++h},this.popBack=function(){d.pop(),h>0&&--h},this.setElementByPos=function(v,y){if(v<0||v>=h)throw new Error("pos must more than 0 and less than vector's size");d[v]=y},this.insert=function(v,y,g){if(g===void 0&&(g=1),v<0||v>h)throw new Error("pos must more than 0 and less than or equal to vector's size");d.splice.apply(d,s([v,0],n(new Array(g).fill(y)),!1)),h+=g},this.find=function(v){return d.includes(v)},this.reverse=function(){d.reverse()},this.unique=function(){var v,y=[];this.forEach(function(m,w){w!==0&&m===v||(y.push(m),v=m)}),y.forEach(function(m,w){d[w]=m});for(var g=y.length;h>g;)this.popBack()},this.sort=function(v){d.sort(v)},this[Symbol.iterator]=function(){return function(){return o(this,function(v){switch(v.label){case 0:return[5,u(d)];case 1:return[2,v.sent()]}})}()},l.forEach(function(v){return f.pushBack(v)}),Object.freeze(this)}Object.defineProperty(i,"__esModule",{value:!0}),Object.freeze(c),i.default=c},{}],36:[function(r,a,i){Object.defineProperty(i,"__esModule",{value:!0}),i.HashMap=i.HashSet=i.Map=i.Set=i.PriorityQueue=i.Deque=i.LinkList=i.Queue=i.Stack=i.Vector=void 0;var o=r("./Vector/Vector");i.Vector=o.default;var n=r("./Stack/Stack");i.Stack=n.default;var s=r("./Queue/Queue");i.Queue=s.default;var u=r("./LinkList/LinkList");i.LinkList=u.default;var c=r("./Deque/Deque");i.Deque=c.default;var l=r("./PriorityQueue/PriorityQueue");i.PriorityQueue=l.default;var f=r("./Set/Set");i.Set=f.default;var h=r("./Map/Map");i.Map=h.default;var d=r("./HashSet/HashSet");i.HashSet=d.default;var v=r("./HashMap/HashMap");i.HashMap=v.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(r,a,i){const o=r("yallist"),n=Symbol("max"),s=Symbol("length"),u=Symbol("lengthCalculator"),c=Symbol("allowStale"),l=Symbol("maxAge"),f=Symbol("dispose"),h=Symbol("noDisposeOnSet"),d=Symbol("lruList"),v=Symbol("cache"),y=Symbol("updateAgeOnGet"),g=()=>1,m=(I,R,z)=>{const U=I[v].get(R);if(U){const _=U.value;if(w(I,_)){if(x(I,U),!I[c])return}else z&&(I[y]&&(U.value.now=Date.now()),I[d].unshiftNode(U));return _.value}},w=(I,R)=>{if(!R||!R.maxAge&&!I[l])return!1;const z=Date.now()-R.now;return R.maxAge?z>R.maxAge:I[l]&&z>I[l]},p=I=>{if(I[s]>I[n])for(let R=I[d].tail;I[s]>I[n]&&R!==null;){const z=R.prev;x(I,R),R=z}},x=(I,R)=>{if(R){const z=R.value;I[f]&&I[f](z.key,z.value),I[s]-=z.length,I[v].delete(z.key),I[d].removeNode(R)}};class T{constructor(R,z,U,_,k){this.key=R,this.value=z,this.length=U,this.now=_,this.maxAge=k||0}}const A=(I,R,z,U)=>{let _=z.value;w(I,_)&&(x(I,z),I[c]||(_=void 0)),_&&R.call(U,_.value,_.key,I)};a.exports=class{constructor(I){if(typeof I=="number"&&(I={max:I}),I||(I={}),I.max&&(typeof I.max!="number"||I.max<0))throw new TypeError("max must be a non-negative number");this[n]=I.max||1/0;const R=I.length||g;if(this[u]=typeof R!="function"?g:R,this[c]=I.stale||!1,I.maxAge&&typeof I.maxAge!="number")throw new TypeError("maxAge must be a number");this[l]=I.maxAge||0,this[f]=I.dispose,this[h]=I.noDisposeOnSet||!1,this[y]=I.updateAgeOnGet||!1,this.reset()}set max(I){if(typeof I!="number"||I<0)throw new TypeError("max must be a non-negative number");this[n]=I||1/0,p(this)}get max(){return this[n]}set allowStale(I){this[c]=!!I}get allowStale(){return this[c]}set maxAge(I){if(typeof I!="number")throw new TypeError("maxAge must be a non-negative number");this[l]=I,p(this)}get maxAge(){return this[l]}set lengthCalculator(I){typeof I!="function"&&(I=g),I!==this[u]&&(this[u]=I,this[s]=0,this[d].forEach(R=>{R.length=this[u](R.value,R.key),this[s]+=R.length})),p(this)}get lengthCalculator(){return this[u]}get length(){return this[s]}get itemCount(){return this[d].length}rforEach(I,R){R=R||this;for(let z=this[d].tail;z!==null;){const U=z.prev;A(this,I,z,R),z=U}}forEach(I,R){R=R||this;for(let z=this[d].head;z!==null;){const U=z.next;A(this,I,z,R),z=U}}keys(){return this[d].toArray().map(I=>I.key)}values(){return this[d].toArray().map(I=>I.value)}reset(){this[f]&&this[d]&&this[d].length&&this[d].forEach(I=>this[f](I.key,I.value)),this[v]=new Map,this[d]=new o,this[s]=0}dump(){return this[d].map(I=>!w(this,I)&&{k:I.key,v:I.value,e:I.now+(I.maxAge||0)}).toArray().filter(I=>I)}dumpLru(){return this[d]}set(I,R,z){if((z=z||this[l])&&typeof z!="number")throw new TypeError("maxAge must be a number");const U=z?Date.now():0,_=this[u](R,I);if(this[v].has(I)){if(_>this[n])return x(this,this[v].get(I)),!1;const S=this[v].get(I).value;return this[f]&&(this[h]||this[f](I,S.value)),S.now=U,S.maxAge=z,S.value=R,this[s]+=_-S.length,S.length=_,this.get(I),p(this),!0}const k=new T(I,R,_,U,z);return k.length>this[n]?(this[f]&&this[f](I,R),!1):(this[s]+=k.length,this[d].unshift(k),this[v].set(I,this[d].head),p(this),!0)}has(I){if(!this[v].has(I))return!1;const R=this[v].get(I).value;return!w(this,R)}get(I){return m(this,I,!0)}peek(I){return m(this,I,!1)}pop(){const I=this[d].tail;return I?(x(this,I),I.value):null}del(I){x(this,this[v].get(I))}load(I){this.reset();const R=Date.now();for(let z=I.length-1;z>=0;z--){const U=I[z],_=U.e||0;if(_===0)this.set(U.k,U.v);else{const k=_-R;k>0&&this.set(U.k,U.v,k)}}}prune(){this[v].forEach((I,R)=>m(this,R,!1))}}},{yallist:83}],38:[function(r,a,i){(function(o){(function(){const n=a.exports;n.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},n.codes={};for(const u in n.types){const c=n.types[u];n.codes[c]=u}n.CMD_SHIFT=4,n.CMD_MASK=240,n.DUP_MASK=8,n.QOS_MASK=3,n.QOS_SHIFT=1,n.RETAIN_MASK=1,n.VARBYTEINT_MASK=127,n.VARBYTEINT_FIN_MASK=128,n.VARBYTEINT_MAX=268435455,n.SESSIONPRESENT_MASK=1,n.SESSIONPRESENT_HEADER=o.from([n.SESSIONPRESENT_MASK]),n.CONNACK_HEADER=o.from([n.codes.connack<<n.CMD_SHIFT]),n.USERNAME_MASK=128,n.PASSWORD_MASK=64,n.WILL_RETAIN_MASK=32,n.WILL_QOS_MASK=24,n.WILL_QOS_SHIFT=3,n.WILL_FLAG_MASK=4,n.CLEAN_SESSION_MASK=2,n.CONNECT_HEADER=o.from([n.codes.connect<<n.CMD_SHIFT]),n.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},n.propertiesCodes={};for(const u in n.properties){const c=n.properties[u];n.propertiesCodes[c]=u}function s(u){return[0,1,2].map(c=>[0,1].map(l=>[0,1].map(f=>{const h=o.alloc(1);return h.writeUInt8(n.codes[u]<<n.CMD_SHIFT|(l?n.DUP_MASK:0)|c<<n.QOS_SHIFT|f,0,!0),h})))}n.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},n.PUBLISH_HEADER=s("publish"),n.SUBSCRIBE_HEADER=s("subscribe"),n.SUBSCRIBE_OPTIONS_QOS_MASK=3,n.SUBSCRIBE_OPTIONS_NL_MASK=1,n.SUBSCRIBE_OPTIONS_NL_SHIFT=2,n.SUBSCRIBE_OPTIONS_RAP_MASK=1,n.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,n.SUBSCRIBE_OPTIONS_RH_MASK=3,n.SUBSCRIBE_OPTIONS_RH_SHIFT=4,n.SUBSCRIBE_OPTIONS_RH=[0,16,32],n.SUBSCRIBE_OPTIONS_NL=4,n.SUBSCRIBE_OPTIONS_RAP=8,n.SUBSCRIBE_OPTIONS_QOS=[0,1,2],n.UNSUBSCRIBE_HEADER=s("unsubscribe"),n.ACKS={unsuback:s("unsuback"),puback:s("puback"),pubcomp:s("pubcomp"),pubrel:s("pubrel"),pubrec:s("pubrec")},n.SUBACK_HEADER=o.from([n.codes.suback<<n.CMD_SHIFT]),n.VERSION3=o.from([3]),n.VERSION4=o.from([4]),n.VERSION5=o.from([5]),n.VERSION131=o.from([131]),n.VERSION132=o.from([132]),n.QOS=[0,1,2].map(u=>o.from([u])),n.EMPTY={pingreq:o.from([n.codes.pingreq<<4,0]),pingresp:o.from([n.codes.pingresp<<4,0]),disconnect:o.from([n.codes.disconnect<<4,0])}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],39:[function(r,a,i){(function(o){(function(){const n=r("./writeToStream"),s=r("events");class u extends s{constructor(){super(),this._array=new Array(20),this._i=0}write(l){return this._array[this._i++]=l,!0}concat(){let l=0;const f=new Array(this._array.length),h=this._array;let d,v=0;for(d=0;d<h.length&&h[d]!==void 0;d++)typeof h[d]!="string"?f[d]=h[d].length:f[d]=o.byteLength(h[d]),l+=f[d];const y=o.allocUnsafe(l);for(d=0;d<h.length&&h[d]!==void 0;d++)typeof h[d]!="string"?(h[d].copy(y,v),v+=f[d]):(y.write(h[d],v),v+=f[d]);return y}}a.exports=function(c,l){const f=new u;return n(c,f,l),f.concat()}}).call(this)}).call(this,r("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(r,a,i){i.parser=r("./parser").parser,i.generate=r("./generate"),i.writeToStream=r("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(r,a,i){(function(o){(function(){const s={},u=o.isBuffer(o.from([1,2]).subarray(0,1));function c(l){const f=o.allocUnsafe(2);return f.writeUInt8(l>>8,0),f.writeUInt8(255&l,1),f}a.exports={cache:s,generateCache:function(){for(let l=0;l<65536;l++)s[l]=c(l)},generateNumber:c,genBufVariableByteInt:function(l){let f=0,h=0;const d=o.allocUnsafe(4);do f=l%128|0,(l=l/128|0)>0&&(f|=128),d.writeUInt8(f,h++);while(l>0&&h<4);return l>0&&(h=0),u?d.subarray(0,h):d.slice(0,h)},generate4ByteBuffer:function(l){const f=o.allocUnsafe(4);return f.writeUInt32BE(l,0),f}}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],42:[function(r,a,i){a.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},{}],43:[function(r,a,i){const o=r("bl"),n=r("events"),s=r("./packet"),u=r("./constants"),c=r("debug")("mqtt-packet:parser");class l extends n{constructor(){super(),this.parser=this.constructor.parser}static parser(h){return this instanceof l?(this.settings=h||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new l().parser(h)}_resetState(){c("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new s,this.error=null,this._list=o(),this._stateCounter=0}parse(h){for(this.error&&this._resetState(),this._list.append(h),c("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,c("parse: state complete. _stateCounter is now: %d",this._stateCounter),c("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return c("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const h=this._list.readUInt8(0);return this.packet.cmd=u.types[h>>u.CMD_SHIFT],this.packet.retain=(h&u.RETAIN_MASK)!=0,this.packet.qos=h>>u.QOS_SHIFT&u.QOS_MASK,this.packet.dup=(h&u.DUP_MASK)!=0,c("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const h=this._parseVarByteNum(!0);return h&&(this.packet.length=h.value,this._list.consume(h.bytes)),c("_parseLength %d",h.value),!!h}_parsePayload(){c("_parsePayload: payload %O",this._list);let h=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}h=!0}return c("_parsePayload complete result: %s",h),h}_parseConnect(){let h,d,v,y;c("_parseConnect");const g={},m=this.packet,w=this._parseString();if(w===null)return this._emitError(new Error("Cannot parse protocolId"));if(w!=="MQTT"&&w!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(m.protocolId=w,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(m.protocolVersion=this._list.readUInt8(this._pos),m.protocolVersion>=128&&(m.bridgeMode=!0,m.protocolVersion=m.protocolVersion-128),m.protocolVersion!==3&&m.protocolVersion!==4&&m.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(g.username=this._list.readUInt8(this._pos)&u.USERNAME_MASK,g.password=this._list.readUInt8(this._pos)&u.PASSWORD_MASK,g.will=this._list.readUInt8(this._pos)&u.WILL_FLAG_MASK,g.will&&(m.will={},m.will.retain=(this._list.readUInt8(this._pos)&u.WILL_RETAIN_MASK)!=0,m.will.qos=(this._list.readUInt8(this._pos)&u.WILL_QOS_MASK)>>u.WILL_QOS_SHIFT),m.clean=(this._list.readUInt8(this._pos)&u.CLEAN_SESSION_MASK)!=0,this._pos++,m.keepalive=this._parseNum(),m.keepalive===-1)return this._emitError(new Error("Packet too short"));if(m.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(m.properties=x)}const p=this._parseString();if(p===null)return this._emitError(new Error("Packet too short"));if(m.clientId=p,c("_parseConnect: packet.clientId: %s",m.clientId),g.will){if(m.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(m.will.properties=x)}if((h=this._parseString())===null)return this._emitError(new Error("Cannot parse will topic"));if(m.will.topic=h,c("_parseConnect: packet.will.topic: %s",m.will.topic),(d=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse will payload"));m.will.payload=d,c("_parseConnect: packet.will.paylaod: %s",m.will.payload)}if(g.username){if((y=this._parseString())===null)return this._emitError(new Error("Cannot parse username"));m.username=y,c("_parseConnect: packet.username: %s",m.username)}if(g.password){if((v=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse password"));m.password=v}return this.settings=m,c("_parseConnect: complete"),m}_parseConnack(){c("_parseConnack");const h=this.packet;if(this._list.length<1)return null;if(h.sessionPresent=!!(this._list.readUInt8(this._pos++)&u.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?h.reasonCode=this._list.readUInt8(this._pos++):h.reasonCode=0;else{if(this._list.length<2)return null;h.returnCode=this._list.readUInt8(this._pos++)}if(h.returnCode===-1||h.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}c("_parseConnack: complete")}_parsePublish(){c("_parsePublish");const h=this.packet;if(h.topic=this._parseString(),h.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(h.qos>0)||this._parseMessageId()){if(this.settings.protocolVersion===5){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}h.payload=this._list.slice(this._pos,h.length),c("_parsePublish: payload from buffer list: %o",h.payload)}}_parseSubscribe(){c("_parseSubscribe");const h=this.packet;let d,v,y,g,m,w,p;if(h.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(h.subscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(h.properties=x)}for(;this._pos<h.length;){if((d=this._parseString())===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=h.length)return this._emitError(new Error("Malformed Subscribe Payload"));y=(v=this._parseByte())&u.SUBSCRIBE_OPTIONS_QOS_MASK,w=(v>>u.SUBSCRIBE_OPTIONS_NL_SHIFT&u.SUBSCRIBE_OPTIONS_NL_MASK)!=0,m=(v>>u.SUBSCRIBE_OPTIONS_RAP_SHIFT&u.SUBSCRIBE_OPTIONS_RAP_MASK)!=0,g=v>>u.SUBSCRIBE_OPTIONS_RH_SHIFT&u.SUBSCRIBE_OPTIONS_RH_MASK,p={topic:d,qos:y},this.settings.protocolVersion===5?(p.nl=w,p.rap=m,p.rh=g):this.settings.bridgeMode&&(p.rh=0,p.rap=!0,p.nl=!0),c("_parseSubscribe: push subscription `%s` to subscription",p),h.subscriptions.push(p)}}}_parseSuback(){c("_parseSuback");const h=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){c("_parseUnsubscribe");const h=this.packet;if(h.unsubscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}for(;this._pos<h.length;){const d=this._parseString();if(d===null)return this._emitError(new Error("Cannot parse topic"));c("_parseUnsubscribe: push topic `%s` to unsubscriptions",d),h.unsubscriptions.push(d)}}}_parseUnsuback(){c("_parseUnsuback");const h=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const d=this._parseProperties();for(Object.getOwnPropertyNames(d).length&&(h.properties=d),h.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){c("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const h=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(h.length>2?(h.reasonCode=this._parseByte(),c("_parseConfirmation: packet.reasonCode `%d`",h.reasonCode)):h.reasonCode=0,h.length>3)){const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}return!0}_parseDisconnect(){const h=this.packet;if(c("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?h.reasonCode=this._parseByte():h.reasonCode=0;const d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(h.properties=d)}return c("_parseDisconnect result: true"),!0}_parseAuth(){c("_parseAuth");const h=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));h.reasonCode=this._parseByte();const d=this._parseProperties();return Object.getOwnPropertyNames(d).length&&(h.properties=d),c("_parseAuth: result: true"),!0}_parseMessageId(){const h=this.packet;return h.messageId=this._parseNum(),h.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(c("_parseMessageId: packet.messageId %d",h.messageId),!0)}_parseString(h){const d=this._parseNum(),v=d+this._pos;if(d===-1||v>this._list.length||v>this.packet.length)return null;const y=this._list.toString("utf8",this._pos,v);return this._pos+=d,c("_parseString: result: %s",y),y}_parseStringPair(){return c("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const h=this._parseNum(),d=h+this._pos;if(h===-1||d>this._list.length||d>this.packet.length)return null;const v=this._list.slice(this._pos,d);return this._pos+=h,c("_parseBuffer: result: %o",v),v}_parseNum(){if(this._list.length-this._pos<2)return-1;const h=this._list.readUInt16BE(this._pos);return this._pos+=2,c("_parseNum: result: %s",h),h}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const h=this._list.readUInt32BE(this._pos);return this._pos+=4,c("_parse4ByteNum: result: %s",h),h}_parseVarByteNum(h){c("_parseVarByteNum");let d,v=0,y=1,g=0,m=!1;const w=this._pos?this._pos:0;for(;v<4&&w+v<this._list.length;){if(g+=y*((d=this._list.readUInt8(w+v++))&u.VARBYTEINT_MASK),y*=128,(d&u.VARBYTEINT_FIN_MASK)==0){m=!0;break}if(this._list.length<=v)break}return!m&&v===4&&this._list.length>=v&&this._emitError(new Error("Invalid variable byte integer")),w&&(this._pos+=v),c("_parseVarByteNum: result: %o",m=!!m&&(h?{bytes:v,value:g}:g)),m}_parseByte(){let h;return this._pos<this._list.length&&(h=this._list.readUInt8(this._pos),this._pos++),c("_parseByte: result: %o",h),h}_parseByType(h){switch(c("_parseByType: type: %s",h),h){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){c("_parseProperties");const h=this._parseVarByteNum(),d=this._pos+h,v={};for(;this._pos<d;){const y=this._parseByte();if(!y)return this._emitError(new Error("Cannot parse property code type")),!1;const g=u.propertiesCodes[y];if(!g)return this._emitError(new Error("Unknown property")),!1;if(g!=="userProperties")v[g]?Array.isArray(v[g])?v[g].push(this._parseByType(u.propertiesTypes[g])):(v[g]=[v[g]],v[g].push(this._parseByType(u.propertiesTypes[g]))):v[g]=this._parseByType(u.propertiesTypes[g]);else{v[g]||(v[g]=Object.create(null));const m=this._parseByType(u.propertiesTypes[g]);if(v[g][m.name])if(Array.isArray(v[g][m.name]))v[g][m.name].push(m.value);else{const w=v[g][m.name];v[g][m.name]=[w],v[g][m.name].push(m.value)}else v[g][m.name]=m.value}}return v}_newPacket(){return c("_newPacket"),this.packet&&(this._list.consume(this.packet.length),c("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),c("_newPacket: new packet"),this.packet=new s,this._pos=0,!0}_emitError(h){c("_emitError"),this.error=h,this.emit("error",h)}}a.exports=l},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(r,a,i){(function(o){(function(){const n=r("./constants"),s=o.allocUnsafe(0),u=o.from([0]),c=r("./numbers"),l=r("process-nextick-args").nextTick,f=r("debug")("mqtt-packet:writeToStream"),h=c.cache,d=c.generateNumber,v=c.generateCache,y=c.genBufVariableByteInt,g=c.generate4ByteBuffer;let m=z,w=!0;function p(L,M,j){switch(f("generate called"),M.cork&&(M.cork(),l(x,M)),w&&(w=!1,v()),f("generate: packet.cmd: %s",L.cmd),L.cmd){case"connect":return function(W,F,V){const Y=W||{},q=Y.protocolId||"MQTT";let Q=Y.protocolVersion||4;const K=Y.will;let X=Y.clean;const b=Y.keepalive||0,C=Y.clientId||"",E=Y.username,N=Y.password,O=Y.properties;X===void 0&&(X=!0);let $=0;if(!q||typeof q!="string"&&!o.isBuffer(q))return F.emit("error",new Error("Invalid protocolId")),!1;if($+=q.length+2,Q!==3&&Q!==4&&Q!==5)return F.emit("error",new Error("Invalid protocol version")),!1;if($+=1,(typeof C=="string"||o.isBuffer(C))&&(C||Q>=4)&&(C||X))$+=o.byteLength(C)+2;else{if(Q<4)return F.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*X==0)return F.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof b!="number"||b<0||b>65535||b%1!=0)return F.emit("error",new Error("Invalid keepalive")),!1;if($+=2,$+=1,Q===5){var G=k(F,O);if(!G)return!1;$+=G.length}if(K){if(typeof K!="object")return F.emit("error",new Error("Invalid will")),!1;if(!K.topic||typeof K.topic!="string")return F.emit("error",new Error("Invalid will topic")),!1;if($+=o.byteLength(K.topic)+2,$+=2,K.payload){if(!(K.payload.length>=0))return F.emit("error",new Error("Invalid will payload")),!1;typeof K.payload=="string"?$+=o.byteLength(K.payload):$+=K.payload.length}var Z={};if(Q===5){if(!(Z=k(F,K.properties)))return!1;$+=Z.length}}let J=!1;if(E!=null){if(!H(E))return F.emit("error",new Error("Invalid username")),!1;J=!0,$+=o.byteLength(E)+2}if(N!=null){if(!J)return F.emit("error",new Error("Username is required to use password")),!1;if(!H(N))return F.emit("error",new Error("Invalid password")),!1;$+=D(N)+2}F.write(n.CONNECT_HEADER),A(F,$),_(F,q),Y.bridgeMode&&(Q+=128),F.write(Q===131?n.VERSION131:Q===132?n.VERSION132:Q===4?n.VERSION4:Q===5?n.VERSION5:n.VERSION3);let ee=0;return ee|=E!=null?n.USERNAME_MASK:0,ee|=N!=null?n.PASSWORD_MASK:0,ee|=K&&K.retain?n.WILL_RETAIN_MASK:0,ee|=K&&K.qos?K.qos<<n.WILL_QOS_SHIFT:0,ee|=K?n.WILL_FLAG_MASK:0,ee|=X?n.CLEAN_SESSION_MASK:0,F.write(o.from([ee])),m(F,b),Q===5&&G.write(),_(F,C),K&&(Q===5&&Z.write(),I(F,K.topic),_(F,K.payload)),E!=null&&_(F,E),N!=null&&_(F,N),!0}(L,M);case"connack":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=Y===5?q.reasonCode:q.returnCode,K=q.properties;let X=2;if(typeof Q!="number")return F.emit("error",new Error("Invalid return code")),!1;let b=null;if(Y===5){if(!(b=k(F,K)))return!1;X+=b.length}return F.write(n.CONNACK_HEADER),A(F,X),F.write(q.sessionPresent?n.SESSIONPRESENT_HEADER:u),F.write(o.from([Q])),b!=null&&b.write(),!0}(L,M,j);case"publish":return function(W,F,V){f("publish: packet: %o",W);const Y=V?V.protocolVersion:4,q=W||{},Q=q.qos||0,K=q.retain?n.RETAIN_MASK:0,X=q.topic,b=q.payload||s,C=q.messageId,E=q.properties;let N=0;if(typeof X=="string")N+=o.byteLength(X)+2;else{if(!o.isBuffer(X))return F.emit("error",new Error("Invalid topic")),!1;N+=X.length+2}if(o.isBuffer(b)?N+=b.length:N+=o.byteLength(b),Q&&typeof C!="number")return F.emit("error",new Error("Invalid messageId")),!1;Q&&(N+=2);let O=null;if(Y===5){if(!(O=k(F,E)))return!1;N+=O.length}return F.write(n.PUBLISH_HEADER[Q][q.dup?1:0][K?1:0]),A(F,N),m(F,D(X)),F.write(X),Q>0&&m(F,C),O!=null&&O.write(),f("publish: payload: %o",b),F.write(b)}(L,M,j);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.cmd||"puback",K=q.messageId,X=q.dup&&Q==="pubrel"?n.DUP_MASK:0;let b=0;const C=q.reasonCode,E=q.properties;let N=Y===5?3:2;if(Q==="pubrel"&&(b=1),typeof K!="number")return F.emit("error",new Error("Invalid messageId")),!1;let O=null;if(Y===5&&typeof E=="object"){if(!(O=S(F,E,V,N)))return!1;N+=O.length}return F.write(n.ACKS[Q][b][X][0]),A(F,N),m(F,K),Y===5&&F.write(o.from([C])),O!==null&&O.write(),!0}(L,M,j);case"subscribe":return function(W,F,V){f("subscribe: packet: ");const Y=V?V.protocolVersion:4,q=W||{},Q=q.dup?n.DUP_MASK:0,K=q.messageId,X=q.subscriptions,b=q.properties;let C=0;if(typeof K!="number")return F.emit("error",new Error("Invalid messageId")),!1;C+=2;let E=null;if(Y===5){if(!(E=k(F,b)))return!1;C+=E.length}if(typeof X!="object"||!X.length)return F.emit("error",new Error("Invalid subscriptions")),!1;for(let O=0;O<X.length;O+=1){const $=X[O].topic,G=X[O].qos;if(typeof $!="string")return F.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof G!="number")return F.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Y===5){if(typeof(X[O].nl||!1)!="boolean")return F.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(X[O].rap||!1)!="boolean")return F.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const ee=X[O].rh||0;if(typeof ee!="number"||ee>2)return F.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}C+=o.byteLength($)+2+1}f("subscribe: writing to stream: %o",n.SUBSCRIBE_HEADER),F.write(n.SUBSCRIBE_HEADER[1][Q?1:0][0]),A(F,C),m(F,K),E!==null&&E.write();let N=!0;for(const O of X){const $=O.topic,G=O.qos,Z=+O.nl,J=+O.rap,ee=O.rh;let te;I(F,$),te=n.SUBSCRIBE_OPTIONS_QOS[G],Y===5&&(te|=Z?n.SUBSCRIBE_OPTIONS_NL:0,te|=J?n.SUBSCRIBE_OPTIONS_RAP:0,te|=ee?n.SUBSCRIBE_OPTIONS_RH[ee]:0),N=F.write(o.from([te]))}return N}(L,M,j);case"suback":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.messageId,K=q.granted,X=q.properties;let b=0;if(typeof Q!="number")return F.emit("error",new Error("Invalid messageId")),!1;if(b+=2,typeof K!="object"||!K.length)return F.emit("error",new Error("Invalid qos vector")),!1;for(let E=0;E<K.length;E+=1){if(typeof K[E]!="number")return F.emit("error",new Error("Invalid qos vector")),!1;b+=1}let C=null;if(Y===5){if(!(C=S(F,X,V,b)))return!1;b+=C.length}return F.write(n.SUBACK_HEADER),A(F,b),m(F,Q),C!==null&&C.write(),F.write(o.from(K))}(L,M,j);case"unsubscribe":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.messageId,K=q.dup?n.DUP_MASK:0,X=q.unsubscriptions,b=q.properties;let C=0;if(typeof Q!="number")return F.emit("error",new Error("Invalid messageId")),!1;if(C+=2,typeof X!="object"||!X.length)return F.emit("error",new Error("Invalid unsubscriptions")),!1;for(let O=0;O<X.length;O+=1){if(typeof X[O]!="string")return F.emit("error",new Error("Invalid unsubscriptions")),!1;C+=o.byteLength(X[O])+2}let E=null;if(Y===5){if(!(E=k(F,b)))return!1;C+=E.length}F.write(n.UNSUBSCRIBE_HEADER[1][K?1:0][0]),A(F,C),m(F,Q),E!==null&&E.write();let N=!0;for(let O=0;O<X.length;O++)N=I(F,X[O]);return N}(L,M,j);case"unsuback":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.messageId,K=q.dup?n.DUP_MASK:0,X=q.granted,b=q.properties,C=q.cmd;let E=2;if(typeof Q!="number")return F.emit("error",new Error("Invalid messageId")),!1;if(Y===5){if(typeof X!="object"||!X.length)return F.emit("error",new Error("Invalid qos vector")),!1;for(let O=0;O<X.length;O+=1){if(typeof X[O]!="number")return F.emit("error",new Error("Invalid qos vector")),!1;E+=1}}let N=null;if(Y===5){if(!(N=S(F,b,V,E)))return!1;E+=N.length}return F.write(n.ACKS[C][0][K][0]),A(F,E),m(F,Q),N!==null&&N.write(),Y===5&&F.write(o.from(X)),!0}(L,M,j);case"pingreq":case"pingresp":return function(W,F,V){return F.write(n.EMPTY[W.cmd])}(L,M);case"disconnect":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.reasonCode,K=q.properties;let X=Y===5?1:0,b=null;if(Y===5){if(!(b=S(F,K,V,X)))return!1;X+=b.length}return F.write(o.from([n.codes.disconnect<<4])),A(F,X),Y===5&&F.write(o.from([Q])),b!==null&&b.write(),!0}(L,M,j);case"auth":return function(W,F,V){const Y=V?V.protocolVersion:4,q=W||{},Q=q.reasonCode,K=q.properties;let X=Y===5?1:0;Y!==5&&F.emit("error",new Error("Invalid mqtt version for auth packet"));const b=S(F,K,V,X);return b?(X+=b.length,F.write(o.from([n.codes.auth<<4])),A(F,X),F.write(o.from([Q])),b!==null&&b.write(),!0):!1}(L,M,j);default:return M.emit("error",new Error("Unknown command")),!1}}function x(L){L.uncork()}Object.defineProperty(p,"cacheNumbers",{get:()=>m===z,set(L){L?(h&&Object.keys(h).length!==0||(w=!0),m=z):(w=!1,m=U)}});const T={};function A(L,M){if(M>n.VARBYTEINT_MAX)return L.emit("error",new Error(`Invalid variable byte integer: ${M}`)),!1;let j=T[M];return j||(j=y(M),M<16384&&(T[M]=j)),f("writeVarByteInt: writing to stream: %o",j),L.write(j)}function I(L,M){const j=o.byteLength(M);return m(L,j),f("writeString: %s",M),L.write(M,"utf8")}function R(L,M,j){I(L,M),I(L,j)}function z(L,M){return f("writeNumberCached: number: %d",M),f("writeNumberCached: %o",h[M]),L.write(h[M])}function U(L,M){const j=d(M);return f("writeNumberGenerated: %o",j),L.write(j)}function _(L,M){typeof M=="string"?I(L,M):M?(m(L,M.length),L.write(M)):m(L,0)}function k(L,M){if(typeof M!="object"||M.length!=null)return{length:1,write(){B(L,{},0)}};let j=0;function W(F,V){let Y=0;switch(n.propertiesTypes[F]){case"byte":if(typeof V!="boolean")return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=2;break;case"int8":if(typeof V!="number"||V<0||V>255)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=2;break;case"binary":if(V&&V===null)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=1+o.byteLength(V)+2;break;case"int16":if(typeof V!="number"||V<0||V>65535)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=3;break;case"int32":if(typeof V!="number"||V<0||V>4294967295)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=5;break;case"var":if(typeof V!="number"||V<0||V>268435455)return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=1+o.byteLength(y(V));break;case"string":if(typeof V!="string")return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=3+o.byteLength(V.toString());break;case"pair":if(typeof V!="object")return L.emit("error",new Error(`Invalid ${F}: ${V}`)),!1;Y+=Object.getOwnPropertyNames(V).reduce((q,Q)=>{const K=V[Q];return Array.isArray(K)?q+=K.reduce((X,b)=>X+=3+o.byteLength(Q.toString())+2+o.byteLength(b.toString()),0):q+=3+o.byteLength(Q.toString())+2+o.byteLength(V[Q].toString()),q},0);break;default:return L.emit("error",new Error(`Invalid property ${F}: ${V}`)),!1}return Y}if(M)for(const F in M){let V=0,Y=0;const q=M[F];if(Array.isArray(q))for(let Q=0;Q<q.length;Q++){if(!(Y=W(F,q[Q])))return!1;V+=Y}else{if(!(Y=W(F,q)))return!1;V=Y}if(!V)return!1;j+=V}return{length:o.byteLength(y(j))+j,write(){B(L,M,j)}}}function S(L,M,j,W){const F=["reasonString","userProperties"],V=j&&j.properties&&j.properties.maximumPacketSize?j.properties.maximumPacketSize:0;let Y=k(L,M);if(V)for(;W+Y.length>V;){const q=F.shift();if(!q||!M[q])return!1;delete M[q],Y=k(L,M)}return Y}function P(L,M,j){switch(n.propertiesTypes[M]){case"byte":L.write(o.from([n.properties[M]])),L.write(o.from([+j]));break;case"int8":L.write(o.from([n.properties[M]])),L.write(o.from([j]));break;case"binary":L.write(o.from([n.properties[M]])),_(L,j);break;case"int16":L.write(o.from([n.properties[M]])),m(L,j);break;case"int32":L.write(o.from([n.properties[M]])),function(W,F){const V=g(F);f("write4ByteNumber: %o",V),W.write(V)}(L,j);break;case"var":L.write(o.from([n.properties[M]])),A(L,j);break;case"string":L.write(o.from([n.properties[M]])),I(L,j);break;case"pair":Object.getOwnPropertyNames(j).forEach(W=>{const F=j[W];Array.isArray(F)?F.forEach(V=>{L.write(o.from([n.properties[M]])),R(L,W.toString(),V.toString())}):(L.write(o.from([n.properties[M]])),R(L,W.toString(),F.toString()))});break;default:return L.emit("error",new Error(`Invalid property ${M} value: ${j}`)),!1}}function B(L,M,j){A(L,j);for(const W in M)if(Object.prototype.hasOwnProperty.call(M,W)&&M[W]!==null){const F=M[W];if(Array.isArray(F))for(let V=0;V<F.length;V++)P(L,W,F[V]);else P(L,W,F)}}function D(L){return L?L instanceof o?L.length:o.byteLength(L):0}function H(L){return typeof L=="string"||L instanceof o}a.exports=p}).call(this)}).call(this,r("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(r,a,i){var o=1e3,n=60*o,s=60*n,u=24*s,c=7*u,l=365.25*u;function f(h,d,v,y){var g=d>=1.5*v;return Math.round(h/v)+" "+y+(g?"s":"")}a.exports=function(h,d){d=d||{};var v=typeof h;if(v==="string"&&h.length>0)return function(y){if(!((y=String(y)).length>100)){var g=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(y);if(g){var m=parseFloat(g[1]);switch((g[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return m*l;case"weeks":case"week":case"w":return m*c;case"days":case"day":case"d":return m*u;case"hours":case"hour":case"hrs":case"hr":case"h":return m*s;case"minutes":case"minute":case"mins":case"min":case"m":return m*n;case"seconds":case"second":case"secs":case"sec":case"s":return m*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}(h);if(v==="number"&&isFinite(h))return d.long?function(y){var g=Math.abs(y);return g>=u?f(y,g,u,"day"):g>=s?f(y,g,s,"hour"):g>=n?f(y,g,n,"minute"):g>=o?f(y,g,o,"second"):y+" ms"}(h):function(y){var g=Math.abs(y);return g>=u?Math.round(y/u)+"d":g>=s?Math.round(y/s)+"h":g>=n?Math.round(y/n)+"m":g>=o?Math.round(y/o)+"s":y+"ms"}(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))}},{}],46:[function(r,a,i){const o=r("./lib/number-allocator.js");a.exports.NumberAllocator=o},{"./lib/number-allocator.js":47}],47:[function(r,a,i){const o=r("js-sdsl").Set,n=r("debug")("number-allocator:trace"),s=r("debug")("number-allocator:error");function u(l,f){this.low=l,this.high=f}function c(l,f){if(!(this instanceof c))return new c(l,f);this.min=l,this.max=f,this.ss=new o([],(h,d)=>h.compare(d)),n("Create"),this.clear()}u.prototype.equals=function(l){return this.low===l.low&&this.high===l.high},u.prototype.compare=function(l){return this.low<l.low&&this.high<l.low?-1:l.low<this.low&&l.high<this.low?1:0},c.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},c.prototype.alloc=function(){if(this.ss.size()===0)return n("alloc():empty"),null;const l=this.ss.front(),f=l.low;return f+1<=l.high?++l.low:this.ss.eraseElementByPos(0),n("alloc():"+f),f},c.prototype.use=function(l){const f=new u(l,l),h=this.ss.lowerBound(f);if(h){if(h.equals(f))return this.ss.eraseElementByValue(h),n("use():"+l),!0;if(h.low>l)return!1;if(h.low===l)return++h.low,n("use():"+l),!0;if(h.high===l)return--h.high,n("use():"+l),!0;const d=h.low;return h.low=l+1,this.ss.insert(new u(d,l-1)),n("use():"+l),!0}return n("use():failed"),!1},c.prototype.free=function(l){if(l<this.min||l>this.max)return void s("free():"+l+" is out of range");const f=new u(l,l),h=this.ss.lowerBound(f);if(h){if(h.low<=l&&l<=h.high)return void s("free():"+l+" has already been vacant");if(h===this.ss.front())l+1===h.low?--h.low:this.ss.insert(f);else{const d=this.ss.reverseLowerBound(f);d.high+1===l?l+1===h.low?(this.ss.eraseElementByValue(d),h.low=d.low):d.high=l:l+1===h.low?h.low=l:this.ss.insert(f)}}else{if(h===this.ss.front())return void this.ss.insert(f);const d=this.ss.reverseLowerBound(f);d.high+1===l?d.high=l:this.ss.insert(f)}n("free():"+l)},c.prototype.clear=function(){n("clear()"),this.ss.clear(),this.ss.insert(new u(this.min,this.max))},c.prototype.intervalCount=function(){return this.ss.size()},c.prototype.dump=function(){console.log("length:"+this.ss.size());for(const l of this.ss)console.log(l)},a.exports=c},{debug:18,"js-sdsl":36}],48:[function(r,a,i){var o=r("wrappy");function n(u){var c=function(){return c.called?c.value:(c.called=!0,c.value=u.apply(this,arguments))};return c.called=!1,c}function s(u){var c=function(){if(c.called)throw new Error(c.onceError);return c.called=!0,c.value=u.apply(this,arguments)},l=u.name||"Function wrapped with `once`";return c.onceError=l+" shouldn't be called more than once",c.called=!1,c}a.exports=o(n),a.exports.strict=o(s),n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})})},{wrappy:79}],49:[function(r,a,i){(function(o){(function(){o===void 0||!o.version||o.version.indexOf("v0.")===0||o.version.indexOf("v1.")===0&&o.version.indexOf("v1.8.")!==0?a.exports={nextTick:function(n,s,u,c){if(typeof n!="function")throw new TypeError('"callback" argument must be a function');var l,f,h=arguments.length;switch(h){case 0:case 1:return o.nextTick(n);case 2:return o.nextTick(function(){n.call(null,s)});case 3:return o.nextTick(function(){n.call(null,s,u)});case 4:return o.nextTick(function(){n.call(null,s,u,c)});default:for(l=new Array(h-1),f=0;f<l.length;)l[f++]=arguments[f];return o.nextTick(function(){n.apply(null,l)})}}}:a.exports=o}).call(this)}).call(this,r("_process"))},{_process:50}],50:[function(r,a,i){var o,n,s=a.exports={};function u(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function l(p){if(o===setTimeout)return setTimeout(p,0);if((o===u||!o)&&setTimeout)return o=setTimeout,setTimeout(p,0);try{return o(p,0)}catch{try{return o.call(null,p,0)}catch{return o.call(this,p,0)}}}(function(){try{o=typeof setTimeout=="function"?setTimeout:u}catch{o=u}try{n=typeof clearTimeout=="function"?clearTimeout:c}catch{n=c}})();var f,h=[],d=!1,v=-1;function y(){d&&f&&(d=!1,f.length?h=f.concat(h):v=-1,h.length&&g())}function g(){if(!d){var p=l(y);d=!0;for(var x=h.length;x;){for(f=h,h=[];++v<x;)f&&f[v].run();v=-1,x=h.length}f=null,d=!1,function(T){if(n===clearTimeout)return clearTimeout(T);if((n===c||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(T);try{n(T)}catch{try{return n.call(null,T)}catch{return n.call(this,T)}}}(p)}}function m(p,x){this.fun=p,this.array=x}function w(){}s.nextTick=function(p){var x=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)x[T-1]=arguments[T];h.push(new m(p,x)),h.length!==1||d||l(g)},m.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=w,s.addListener=w,s.once=w,s.off=w,s.removeListener=w,s.removeAllListeners=w,s.emit=w,s.prependListener=w,s.prependOnceListener=w,s.listeners=function(p){return[]},s.binding=function(p){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(p){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],51:[function(r,a,i){(function(o){(function(){(function(n){var s=typeof i=="object"&&i&&!i.nodeType&&i,u=typeof a=="object"&&a&&!a.nodeType&&a,c=typeof o=="object"&&o;c.global!==c&&c.window!==c&&c.self!==c||(n=c);var l,f,h=2147483647,d=36,v=1,y=26,g=38,m=700,w=72,p=128,x="-",T=/^xn--/,A=/[^\x20-\x7E]/,I=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=d-v,U=Math.floor,_=String.fromCharCode;function k(W){throw new RangeError(R[W])}function S(W,F){for(var V=W.length,Y=[];V--;)Y[V]=F(W[V]);return Y}function P(W,F){var V=W.split("@"),Y="";return V.length>1&&(Y=V[0]+"@",W=V[1]),Y+S((W=W.replace(I,".")).split("."),F).join(".")}function B(W){for(var F,V,Y=[],q=0,Q=W.length;q<Q;)(F=W.charCodeAt(q++))>=55296&&F<=56319&&q<Q?(64512&(V=W.charCodeAt(q++)))==56320?Y.push(((1023&F)<<10)+(1023&V)+65536):(Y.push(F),q--):Y.push(F);return Y}function D(W){return S(W,function(F){var V="";return F>65535&&(V+=_((F-=65536)>>>10&1023|55296),F=56320|1023&F),V+=_(F)}).join("")}function H(W,F){return W+22+75*(W<26)-((F!=0)<<5)}function L(W,F,V){var Y=0;for(W=V?U(W/m):W>>1,W+=U(W/F);W>z*y>>1;Y+=d)W=U(W/z);return U(Y+(z+1)*W/(W+g))}function M(W){var F,V,Y,q,Q,K,X,b,C,E,N,O=[],$=W.length,G=0,Z=p,J=w;for((V=W.lastIndexOf(x))<0&&(V=0),Y=0;Y<V;++Y)W.charCodeAt(Y)>=128&&k("not-basic"),O.push(W.charCodeAt(Y));for(q=V>0?V+1:0;q<$;){for(Q=G,K=1,X=d;q>=$&&k("invalid-input"),((b=(N=W.charCodeAt(q++))-48<10?N-22:N-65<26?N-65:N-97<26?N-97:d)>=d||b>U((h-G)/K))&&k("overflow"),G+=b*K,!(b<(C=X<=J?v:X>=J+y?y:X-J));X+=d)K>U(h/(E=d-C))&&k("overflow"),K*=E;J=L(G-Q,F=O.length+1,Q==0),U(G/F)>h-Z&&k("overflow"),Z+=U(G/F),G%=F,O.splice(G++,0,Z)}return D(O)}function j(W){var F,V,Y,q,Q,K,X,b,C,E,N,O,$,G,Z,J=[];for(O=(W=B(W)).length,F=p,V=0,Q=w,K=0;K<O;++K)(N=W[K])<128&&J.push(_(N));for(Y=q=J.length,q&&J.push(x);Y<O;){for(X=h,K=0;K<O;++K)(N=W[K])>=F&&N<X&&(X=N);for(X-F>U((h-V)/($=Y+1))&&k("overflow"),V+=(X-F)*$,F=X,K=0;K<O;++K)if((N=W[K])<F&&++V>h&&k("overflow"),N==F){for(b=V,C=d;!(b<(E=C<=Q?v:C>=Q+y?y:C-Q));C+=d)Z=b-E,G=d-E,J.push(_(H(E+Z%G,0))),b=U(Z/G);J.push(_(H(b,0))),Q=L(V,$,Y==q),V=0,++Y}++V,++F}return J.join("")}if(l={version:"1.4.1",ucs2:{decode:B,encode:D},decode:M,encode:j,toASCII:function(W){return P(W,function(F){return A.test(F)?"xn--"+j(F):F})},toUnicode:function(W){return P(W,function(F){return T.test(F)?M(F.slice(4).toLowerCase()):F})}},s&&u)if(a.exports==s)u.exports=l;else for(f in l)l.hasOwnProperty(f)&&(s[f]=l[f]);else n.punycode=l})(this)}).call(this)}).call(this,typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(r,a,i){function o(s,u){return Object.prototype.hasOwnProperty.call(s,u)}a.exports=function(s,u,c,l){u=u||"&",c=c||"=";var f={};if(typeof s!="string"||s.length===0)return f;var h=/\+/g;s=s.split(u);var d=1e3;l&&typeof l.maxKeys=="number"&&(d=l.maxKeys);var v=s.length;d>0&&v>d&&(v=d);for(var y=0;y<v;++y){var g,m,w,p,x=s[y].replace(h,"%20"),T=x.indexOf(c);T>=0?(g=x.substr(0,T),m=x.substr(T+1)):(g=x,m=""),w=decodeURIComponent(g),p=decodeURIComponent(m),o(f,w)?n(f[w])?f[w].push(p):f[w]=[f[w],p]:f[w]=p}return f};var n=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"}},{}],53:[function(r,a,i){var o=function(c){switch(typeof c){case"string":return c;case"boolean":return c?"true":"false";case"number":return isFinite(c)?c:"";default:return""}};a.exports=function(c,l,f,h){return l=l||"&",f=f||"=",c===null&&(c=void 0),typeof c=="object"?s(u(c),function(d){var v=encodeURIComponent(o(d))+f;return n(c[d])?s(c[d],function(y){return v+encodeURIComponent(o(y))}).join(l):v+encodeURIComponent(o(c[d]))}).join(l):h?encodeURIComponent(o(h))+f+encodeURIComponent(o(c)):""};var n=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"};function s(c,l){if(c.map)return c.map(l);for(var f=[],h=0;h<c.length;h++)f.push(l(c[h],h));return f}var u=Object.keys||function(c){var l=[];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&l.push(f);return l}},{}],54:[function(r,a,i){i.decode=i.parse=r("./decode"),i.encode=i.stringify=r("./encode")},{"./decode":52,"./encode":53}],55:[function(r,a,i){var o={};function n(u,c,l){l||(l=Error);var f=function(h){var d,v;function y(g,m,w){return h.call(this,function(p,x,T){return typeof c=="string"?c:c(p,x,T)}(g,m,w))||this}return v=h,(d=y).prototype=Object.create(v.prototype),d.prototype.constructor=d,d.__proto__=v,y}(l);f.prototype.name=l.name,f.prototype.code=u,o[u]=f}function s(u,c){if(Array.isArray(u)){var l=u.length;return u=u.map(function(f){return String(f)}),l>2?"one of ".concat(c," ").concat(u.slice(0,l-1).join(", "),", or ")+u[l-1]:l===2?"one of ".concat(c," ").concat(u[0]," or ").concat(u[1]):"of ".concat(c," ").concat(u[0])}return"of ".concat(c," ").concat(String(u))}n("ERR_INVALID_OPT_VALUE",function(u,c){return'The value "'+c+'" is invalid for option "'+u+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(u,c,l){var f,h,d;if(typeof c=="string"&&(h="not ",c.substr(0,h.length)===h)?(f="must not be",c=c.replace(/^not /,"")):f="must be",function(y,g,m){return(m===void 0||m>y.length)&&(m=y.length),y.substring(m-g.length,m)===g}(u," argument"))d="The ".concat(u," ").concat(f," ").concat(s(c,"type"));else{var v=function(y,g,m){return typeof m!="number"&&(m=0),!(m+g.length>y.length)&&y.indexOf(g,m)!==-1}(u,".")?"property":"argument";d='The "'.concat(u,'" ').concat(v," ").concat(f," ").concat(s(c,"type"))}return d+=". Received type ".concat(typeof l)},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(u){return"The "+u+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(u){return"Cannot call "+u+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(u){return"Unknown encoding: "+u},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),a.exports.codes=o},{}],56:[function(r,a,i){(function(o){(function(){var n=Object.keys||function(y){var g=[];for(var m in y)g.push(m);return g};a.exports=h;var s=r("./_stream_readable"),u=r("./_stream_writable");r("inherits")(h,s);for(var c=n(u.prototype),l=0;l<c.length;l++){var f=c[l];h.prototype[f]||(h.prototype[f]=u.prototype[f])}function h(y){if(!(this instanceof h))return new h(y);s.call(this,y),u.call(this,y),this.allowHalfOpen=!0,y&&(y.readable===!1&&(this.readable=!1),y.writable===!1&&(this.writable=!1),y.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||o.nextTick(v,this)}function v(y){y.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(h.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(h.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=y,this._writableState.destroyed=y)}})}).call(this)}).call(this,r("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(r,a,i){a.exports=n;var o=r("./_stream_transform");function n(s){if(!(this instanceof n))return new n(s);o.call(this,s)}r("inherits")(n,o),n.prototype._transform=function(s,u,c){c(null,s)}},{"./_stream_transform":59,inherits:24}],58:[function(r,a,i){(function(o,n){(function(){var s;a.exports=k,k.ReadableState=_,r("events").EventEmitter;var u=function(b,C){return b.listeners(C).length},c=r("./internal/streams/stream"),l=r("buffer").Buffer,f=n.Uint8Array||function(){},h,d=r("util");h=d&&d.debuglog?d.debuglog("stream"):function(){};var v,y,g,m=r("./internal/streams/buffer_list"),w=r("./internal/streams/destroy"),p=r("./internal/streams/state").getHighWaterMark,x=r("../errors").codes,T=x.ERR_INVALID_ARG_TYPE,A=x.ERR_STREAM_PUSH_AFTER_EOF,I=x.ERR_METHOD_NOT_IMPLEMENTED,R=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r("inherits")(k,c);var z=w.errorOrDestroy,U=["error","close","destroy","pause","resume"];function _(b,C,E){s=s||r("./_stream_duplex"),b=b||{},typeof E!="boolean"&&(E=C instanceof s),this.objectMode=!!b.objectMode,E&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=p(this,b,"readableHighWaterMark",E),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(v||(v=r("string_decoder/").StringDecoder),this.decoder=new v(b.encoding),this.encoding=b.encoding)}function k(b){if(s=s||r("./_stream_duplex"),!(this instanceof k))return new k(b);var C=this instanceof s;this._readableState=new _(b,this,C),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),c.call(this)}function S(b,C,E,N,O){h("readableAddChunk",C);var $,G=b._readableState;if(C===null)G.reading=!1,function(Z,J){if(h("onEofChunk"),!J.ended){if(J.decoder){var ee=J.decoder.end();ee&&ee.length&&(J.buffer.push(ee),J.length+=J.objectMode?1:ee.length)}J.ended=!0,J.sync?H(Z):(J.needReadable=!1,J.emittedReadable||(J.emittedReadable=!0,L(Z)))}}(b,G);else if(O||($=function(Z,J){var ee;te=J,l.isBuffer(te)||te instanceof f||typeof J=="string"||J===void 0||Z.objectMode||(ee=new T("chunk",["string","Buffer","Uint8Array"],J));var te;return ee}(G,C)),$)z(b,$);else if(G.objectMode||C&&C.length>0)if(typeof C=="string"||G.objectMode||Object.getPrototypeOf(C)===l.prototype||(C=function(Z){return l.from(Z)}(C)),N)G.endEmitted?z(b,new R):P(b,G,C,!0);else if(G.ended)z(b,new A);else{if(G.destroyed)return!1;G.reading=!1,G.decoder&&!E?(C=G.decoder.write(C),G.objectMode||C.length!==0?P(b,G,C,!1):M(b,G)):P(b,G,C,!1)}else N||(G.reading=!1,M(b,G));return!G.ended&&(G.length<G.highWaterMark||G.length===0)}function P(b,C,E,N){C.flowing&&C.length===0&&!C.sync?(C.awaitDrain=0,b.emit("data",E)):(C.length+=C.objectMode?1:E.length,N?C.buffer.unshift(E):C.buffer.push(E),C.needReadable&&H(b)),M(b,C)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(b){this._readableState&&(this._readableState.destroyed=b)}}),k.prototype.destroy=w.destroy,k.prototype._undestroy=w.undestroy,k.prototype._destroy=function(b,C){C(b)},k.prototype.push=function(b,C){var E,N=this._readableState;return N.objectMode?E=!0:typeof b=="string"&&((C=C||N.defaultEncoding)!==N.encoding&&(b=l.from(b,C),C=""),E=!0),S(this,b,C,!1,E)},k.prototype.unshift=function(b){return S(this,b,null,!0,!1)},k.prototype.isPaused=function(){return this._readableState.flowing===!1},k.prototype.setEncoding=function(b){v||(v=r("string_decoder/").StringDecoder);var C=new v(b);this._readableState.decoder=C,this._readableState.encoding=this._readableState.decoder.encoding;for(var E=this._readableState.buffer.head,N="";E!==null;)N+=C.write(E.data),E=E.next;return this._readableState.buffer.clear(),N!==""&&this._readableState.buffer.push(N),this._readableState.length=N.length,this};var B=1073741824;function D(b,C){return b<=0||C.length===0&&C.ended?0:C.objectMode?1:b!=b?C.flowing&&C.length?C.buffer.head.data.length:C.length:(b>C.highWaterMark&&(C.highWaterMark=function(E){return E>=B?E=B:(E--,E|=E>>>1,E|=E>>>2,E|=E>>>4,E|=E>>>8,E|=E>>>16,E++),E}(b)),b<=C.length?b:C.ended?C.length:(C.needReadable=!0,0))}function H(b){var C=b._readableState;h("emitReadable",C.needReadable,C.emittedReadable),C.needReadable=!1,C.emittedReadable||(h("emitReadable",C.flowing),C.emittedReadable=!0,o.nextTick(L,b))}function L(b){var C=b._readableState;h("emitReadable_",C.destroyed,C.length,C.ended),C.destroyed||!C.length&&!C.ended||(b.emit("readable"),C.emittedReadable=!1),C.needReadable=!C.flowing&&!C.ended&&C.length<=C.highWaterMark,Y(b)}function M(b,C){C.readingMore||(C.readingMore=!0,o.nextTick(j,b,C))}function j(b,C){for(;!C.reading&&!C.ended&&(C.length<C.highWaterMark||C.flowing&&C.length===0);){var E=C.length;if(h("maybeReadMore read 0"),b.read(0),E===C.length)break}C.readingMore=!1}function W(b){var C=b._readableState;C.readableListening=b.listenerCount("readable")>0,C.resumeScheduled&&!C.paused?C.flowing=!0:b.listenerCount("data")>0&&b.resume()}function F(b){h("readable nexttick read 0"),b.read(0)}function V(b,C){h("resume",C.reading),C.reading||b.read(0),C.resumeScheduled=!1,b.emit("resume"),Y(b),C.flowing&&!C.reading&&b.read(0)}function Y(b){var C=b._readableState;for(h("flow",C.flowing);C.flowing&&b.read()!==null;);}function q(b,C){return C.length===0?null:(C.objectMode?E=C.buffer.shift():!b||b>=C.length?(E=C.decoder?C.buffer.join(""):C.buffer.length===1?C.buffer.first():C.buffer.concat(C.length),C.buffer.clear()):E=C.buffer.consume(b,C.decoder),E);var E}function Q(b){var C=b._readableState;h("endReadable",C.endEmitted),C.endEmitted||(C.ended=!0,o.nextTick(K,C,b))}function K(b,C){if(h("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,C.readable=!1,C.emit("end"),b.autoDestroy)){var E=C._writableState;(!E||E.autoDestroy&&E.finished)&&C.destroy()}}function X(b,C){for(var E=0,N=b.length;E<N;E++)if(b[E]===C)return E;return-1}k.prototype.read=function(b){h("read",b),b=parseInt(b,10);var C=this._readableState,E=b;if(b!==0&&(C.emittedReadable=!1),b===0&&C.needReadable&&((C.highWaterMark!==0?C.length>=C.highWaterMark:C.length>0)||C.ended))return h("read: emitReadable",C.length,C.ended),C.length===0&&C.ended?Q(this):H(this),null;if((b=D(b,C))===0&&C.ended)return C.length===0&&Q(this),null;var N,O=C.needReadable;return h("need readable",O),(C.length===0||C.length-b<C.highWaterMark)&&h("length less than watermark",O=!0),C.ended||C.reading?h("reading or ended",O=!1):O&&(h("do read"),C.reading=!0,C.sync=!0,C.length===0&&(C.needReadable=!0),this._read(C.highWaterMark),C.sync=!1,C.reading||(b=D(E,C))),(N=b>0?q(b,C):null)===null?(C.needReadable=C.length<=C.highWaterMark,b=0):(C.length-=b,C.awaitDrain=0),C.length===0&&(C.ended||(C.needReadable=!0),E!==b&&C.ended&&Q(this)),N!==null&&this.emit("data",N),N},k.prototype._read=function(b){z(this,new I("_read()"))},k.prototype.pipe=function(b,C){var E=this,N=this._readableState;switch(N.pipesCount){case 0:N.pipes=b;break;case 1:N.pipes=[N.pipes,b];break;default:N.pipes.push(b)}N.pipesCount+=1,h("pipe count=%d opts=%j",N.pipesCount,C);var O=(!C||C.end!==!1)&&b!==o.stdout&&b!==o.stderr?G:ae;function $(ie,se){h("onunpipe"),ie===E&&se&&se.hasUnpiped===!1&&(se.hasUnpiped=!0,h("cleanup"),b.removeListener("close",oe),b.removeListener("finish",ne),b.removeListener("drain",Z),b.removeListener("error",te),b.removeListener("unpipe",$),E.removeListener("end",G),E.removeListener("end",ae),E.removeListener("data",ee),J=!0,!N.awaitDrain||b._writableState&&!b._writableState.needDrain||Z())}function G(){h("onend"),b.end()}N.endEmitted?o.nextTick(O):E.once("end",O),b.on("unpipe",$);var Z=function(ie){return function(){var se=ie._readableState;h("pipeOnDrain",se.awaitDrain),se.awaitDrain&&se.awaitDrain--,se.awaitDrain===0&&u(ie,"data")&&(se.flowing=!0,Y(ie))}}(E);b.on("drain",Z);var J=!1;function ee(ie){h("ondata");var se=b.write(ie);h("dest.write",se),se===!1&&((N.pipesCount===1&&N.pipes===b||N.pipesCount>1&&X(N.pipes,b)!==-1)&&!J&&(h("false write response, pause",N.awaitDrain),N.awaitDrain++),E.pause())}function te(ie){h("onerror",ie),ae(),b.removeListener("error",te),u(b,"error")===0&&z(b,ie)}function oe(){b.removeListener("finish",ne),ae()}function ne(){h("onfinish"),b.removeListener("close",oe),ae()}function ae(){h("unpipe"),E.unpipe(b)}return E.on("data",ee),function(ie,se,le){if(typeof ie.prependListener=="function")return ie.prependListener(se,le);ie._events&&ie._events[se]?Array.isArray(ie._events[se])?ie._events[se].unshift(le):ie._events[se]=[le,ie._events[se]]:ie.on(se,le)}(b,"error",te),b.once("close",oe),b.once("finish",ne),b.emit("pipe",E),N.flowing||(h("pipe resume"),E.resume()),b},k.prototype.unpipe=function(b){var C=this._readableState,E={hasUnpiped:!1};if(C.pipesCount===0)return this;if(C.pipesCount===1)return b&&b!==C.pipes?this:(b||(b=C.pipes),C.pipes=null,C.pipesCount=0,C.flowing=!1,b&&b.emit("unpipe",this,E),this);if(!b){var N=C.pipes,O=C.pipesCount;C.pipes=null,C.pipesCount=0,C.flowing=!1;for(var $=0;$<O;$++)N[$].emit("unpipe",this,{hasUnpiped:!1});return this}var G=X(C.pipes,b);return G===-1?this:(C.pipes.splice(G,1),C.pipesCount-=1,C.pipesCount===1&&(C.pipes=C.pipes[0]),b.emit("unpipe",this,E),this)},k.prototype.on=function(b,C){var E=c.prototype.on.call(this,b,C),N=this._readableState;return b==="data"?(N.readableListening=this.listenerCount("readable")>0,N.flowing!==!1&&this.resume()):b==="readable"&&(N.endEmitted||N.readableListening||(N.readableListening=N.needReadable=!0,N.flowing=!1,N.emittedReadable=!1,h("on readable",N.length,N.reading),N.length?H(this):N.reading||o.nextTick(F,this))),E},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(b,C){var E=c.prototype.removeListener.call(this,b,C);return b==="readable"&&o.nextTick(W,this),E},k.prototype.removeAllListeners=function(b){var C=c.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||o.nextTick(W,this),C},k.prototype.resume=function(){var b=this._readableState;return b.flowing||(h("resume"),b.flowing=!b.readableListening,function(C,E){E.resumeScheduled||(E.resumeScheduled=!0,o.nextTick(V,C,E))}(this,b)),b.paused=!1,this},k.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(b){var C=this,E=this._readableState,N=!1;for(var O in b.on("end",function(){if(h("wrapped end"),E.decoder&&!E.ended){var G=E.decoder.end();G&&G.length&&C.push(G)}C.push(null)}),b.on("data",function(G){h("wrapped data"),E.decoder&&(G=E.decoder.write(G)),(!E.objectMode||G!=null)&&(E.objectMode||G&&G.length)&&(C.push(G)||(N=!0,b.pause()))}),b)this[O]===void 0&&typeof b[O]=="function"&&(this[O]=function(G){return function(){return b[G].apply(b,arguments)}}(O));for(var $=0;$<U.length;$++)b.on(U[$],this.emit.bind(this,U[$]));return this._read=function(G){h("wrapped _read",G),N&&(N=!1,b.resume())},this},typeof Symbol=="function"&&(k.prototype[Symbol.asyncIterator]=function(){return y===void 0&&(y=r("./internal/streams/async_iterator")),y(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(b){this._readableState&&(this._readableState.flowing=b)}}),k._fromList=q,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(k.from=function(b,C){return g===void 0&&(g=r("./internal/streams/from")),g(k,b,C)})}).call(this)}).call(this,r("_process"),typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(r,a,i){a.exports=f;var o=r("../errors").codes,n=o.ERR_METHOD_NOT_IMPLEMENTED,s=o.ERR_MULTIPLE_CALLBACK,u=o.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=o.ERR_TRANSFORM_WITH_LENGTH_0,l=r("./_stream_duplex");function f(v){if(!(this instanceof f))return new f(v);l.call(this,v),this._transformState={afterTransform:(function(y,g){var m=this._transformState;m.transforming=!1;var w=m.writecb;if(w===null)return this.emit("error",new s);m.writechunk=null,m.writecb=null,g!=null&&this.push(g),w(y);var p=this._readableState;p.reading=!1,(p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}).bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,v&&(typeof v.transform=="function"&&(this._transform=v.transform),typeof v.flush=="function"&&(this._flush=v.flush)),this.on("prefinish",h)}function h(){var v=this;typeof this._flush!="function"||this._readableState.destroyed?d(this,null,null):this._flush(function(y,g){d(v,y,g)})}function d(v,y,g){if(y)return v.emit("error",y);if(g!=null&&v.push(g),v._writableState.length)throw new c;if(v._transformState.transforming)throw new u;return v.push(null)}r("inherits")(f,l),f.prototype.push=function(v,y){return this._transformState.needTransform=!1,l.prototype.push.call(this,v,y)},f.prototype._transform=function(v,y,g){g(new n("_transform()"))},f.prototype._write=function(v,y,g){var m=this._transformState;if(m.writecb=g,m.writechunk=v,m.writeencoding=y,!m.transforming){var w=this._readableState;(m.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},f.prototype._read=function(v){var y=this._transformState;y.writechunk===null||y.transforming?y.needTransform=!0:(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform))},f.prototype._destroy=function(v,y){l.prototype._destroy.call(this,v,function(g){y(g)})}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(r,a,i){(function(o,n){(function(){function s(M){var j=this;this.next=null,this.entry=null,this.finish=function(){(function(W,F,V){var Y=W.entry;for(W.entry=null;Y;){var q=Y.callback;F.pendingcb--,q(V),Y=Y.next}F.corkedRequestsFree.next=W})(j,M)}}var u;a.exports=k,k.WritableState=_;var c={deprecate:r("util-deprecate")},l=r("./internal/streams/stream"),f=r("buffer").Buffer,h=n.Uint8Array||function(){},d,v=r("./internal/streams/destroy"),y=r("./internal/streams/state").getHighWaterMark,g=r("../errors").codes,m=g.ERR_INVALID_ARG_TYPE,w=g.ERR_METHOD_NOT_IMPLEMENTED,p=g.ERR_MULTIPLE_CALLBACK,x=g.ERR_STREAM_CANNOT_PIPE,T=g.ERR_STREAM_DESTROYED,A=g.ERR_STREAM_NULL_VALUES,I=g.ERR_STREAM_WRITE_AFTER_END,R=g.ERR_UNKNOWN_ENCODING,z=v.errorOrDestroy;function U(){}function _(M,j,W){u=u||r("./_stream_duplex"),M=M||{},typeof W!="boolean"&&(W=j instanceof u),this.objectMode=!!M.objectMode,W&&(this.objectMode=this.objectMode||!!M.writableObjectMode),this.highWaterMark=y(this,M,"writableHighWaterMark",W),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var F=M.decodeStrings===!1;this.decodeStrings=!F,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(V){(function(Y,q){var Q=Y._writableState,K=Q.sync,X=Q.writecb;if(typeof X!="function")throw new p;if(function(C){C.writing=!1,C.writecb=null,C.length-=C.writelen,C.writelen=0}(Q),q)(function(C,E,N,O,$){--E.pendingcb,N?(o.nextTick($,O),o.nextTick(L,C,E),C._writableState.errorEmitted=!0,z(C,O)):($(O),C._writableState.errorEmitted=!0,z(C,O),L(C,E))})(Y,Q,K,q,X);else{var b=D(Q)||Y.destroyed;b||Q.corked||Q.bufferProcessing||!Q.bufferedRequest||B(Y,Q),K?o.nextTick(P,Y,Q,b,X):P(Y,Q,b,X)}})(j,V)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=M.emitClose!==!1,this.autoDestroy=!!M.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function k(M){var j=this instanceof(u=u||r("./_stream_duplex"));if(!j&&!d.call(k,this))return new k(M);this._writableState=new _(M,this,j),this.writable=!0,M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final)),l.call(this)}function S(M,j,W,F,V,Y,q){j.writelen=F,j.writecb=q,j.writing=!0,j.sync=!0,j.destroyed?j.onwrite(new T("write")):W?M._writev(V,j.onwrite):M._write(V,Y,j.onwrite),j.sync=!1}function P(M,j,W,F){W||function(V,Y){Y.length===0&&Y.needDrain&&(Y.needDrain=!1,V.emit("drain"))}(M,j),j.pendingcb--,F(),L(M,j)}function B(M,j){j.bufferProcessing=!0;var W=j.bufferedRequest;if(M._writev&&W&&W.next){var F=j.bufferedRequestCount,V=new Array(F),Y=j.corkedRequestsFree;Y.entry=W;for(var q=0,Q=!0;W;)V[q]=W,W.isBuf||(Q=!1),W=W.next,q+=1;V.allBuffers=Q,S(M,j,!0,j.length,V,"",Y.finish),j.pendingcb++,j.lastBufferedRequest=null,Y.next?(j.corkedRequestsFree=Y.next,Y.next=null):j.corkedRequestsFree=new s(j),j.bufferedRequestCount=0}else{for(;W;){var K=W.chunk,X=W.encoding,b=W.callback;if(S(M,j,!1,j.objectMode?1:K.length,K,X,b),W=W.next,j.bufferedRequestCount--,j.writing)break}W===null&&(j.lastBufferedRequest=null)}j.bufferedRequest=W,j.bufferProcessing=!1}function D(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}function H(M,j){M._final(function(W){j.pendingcb--,W&&z(M,W),j.prefinished=!0,M.emit("prefinish"),L(M,j)})}function L(M,j){var W=D(j);if(W&&(function(V,Y){Y.prefinished||Y.finalCalled||(typeof V._final!="function"||Y.destroyed?(Y.prefinished=!0,V.emit("prefinish")):(Y.pendingcb++,Y.finalCalled=!0,o.nextTick(H,V,Y)))}(M,j),j.pendingcb===0&&(j.finished=!0,M.emit("finish"),j.autoDestroy))){var F=M._readableState;(!F||F.autoDestroy&&F.endEmitted)&&M.destroy()}return W}r("inherits")(k,l),_.prototype.getBuffer=function(){for(var M=this.bufferedRequest,j=[];M;)j.push(M),M=M.next;return j},function(){try{Object.defineProperty(_.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(M){return!!d.call(this,M)||this===k&&M&&M._writableState instanceof _}})):d=function(M){return M instanceof this},k.prototype.pipe=function(){z(this,new x)},k.prototype.write=function(M,j,W){var F,V=this._writableState,Y=!1,q=!V.objectMode&&(F=M,f.isBuffer(F)||F instanceof h);return q&&!f.isBuffer(M)&&(M=function(Q){return f.from(Q)}(M)),typeof j=="function"&&(W=j,j=null),q?j="buffer":j||(j=V.defaultEncoding),typeof W!="function"&&(W=U),V.ending?function(Q,K){var X=new I;z(Q,X),o.nextTick(K,X)}(this,W):(q||function(Q,K,X,b){var C;return X===null?C=new A:typeof X=="string"||K.objectMode||(C=new m("chunk",["string","Buffer"],X)),!C||(z(Q,C),o.nextTick(b,C),!1)}(this,V,M,W))&&(V.pendingcb++,Y=function(Q,K,X,b,C,E){if(!X){var N=function(Z,J,ee){return Z.objectMode||Z.decodeStrings===!1||typeof J!="string"||(J=f.from(J,ee)),J}(K,b,C);b!==N&&(X=!0,C="buffer",b=N)}var O=K.objectMode?1:b.length;K.length+=O;var $=K.length<K.highWaterMark;if($||(K.needDrain=!0),K.writing||K.corked){var G=K.lastBufferedRequest;K.lastBufferedRequest={chunk:b,encoding:C,isBuf:X,callback:E,next:null},G?G.next=K.lastBufferedRequest:K.bufferedRequest=K.lastBufferedRequest,K.bufferedRequestCount+=1}else S(Q,K,!1,O,b,C,E);return $}(this,V,q,M,j,W)),Y},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,M.writing||M.corked||M.bufferProcessing||!M.bufferedRequest||B(this,M))},k.prototype.setDefaultEncoding=function(M){if(typeof M=="string"&&(M=M.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((M+"").toLowerCase())>-1))throw new R(M);return this._writableState.defaultEncoding=M,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),k.prototype._write=function(M,j,W){W(new w("_write()"))},k.prototype._writev=null,k.prototype.end=function(M,j,W){var F=this._writableState;return typeof M=="function"?(W=M,M=null,j=null):typeof j=="function"&&(W=j,j=null),M!=null&&this.write(M,j),F.corked&&(F.corked=1,this.uncork()),F.ending||function(V,Y,q){Y.ending=!0,L(V,Y),q&&(Y.finished?o.nextTick(q):V.once("finish",q)),Y.ended=!0,V.writable=!1}(this,F,W),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(M){this._writableState&&(this._writableState.destroyed=M)}}),k.prototype.destroy=v.destroy,k.prototype._undestroy=v.undestroy,k.prototype._destroy=function(M,j){j(M)}}).call(this)}).call(this,r("_process"),typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(r,a,i){(function(o){(function(){var n;function s(x,T,A){return T in x?Object.defineProperty(x,T,{value:A,enumerable:!0,configurable:!0,writable:!0}):x[T]=A,x}var u=r("./end-of-stream"),c=Symbol("lastResolve"),l=Symbol("lastReject"),f=Symbol("error"),h=Symbol("ended"),d=Symbol("lastPromise"),v=Symbol("handlePromise"),y=Symbol("stream");function g(x,T){return{value:x,done:T}}function m(x){var T=x[c];if(T!==null){var A=x[y].read();A!==null&&(x[d]=null,x[c]=null,x[l]=null,T(g(A,!1)))}}var w=Object.getPrototypeOf(function(){}),p=Object.setPrototypeOf((s(n={get stream(){return this[y]},next:function(){var x=this,T=this[f];if(T!==null)return Promise.reject(T);if(this[h])return Promise.resolve(g(void 0,!0));if(this[y].destroyed)return new Promise(function(z,U){o.nextTick(function(){x[f]?U(x[f]):z(g(void 0,!0))})});var A,I=this[d];if(I)A=new Promise(function(z,U){return function(_,k){z.then(function(){U[h]?_(g(void 0,!0)):U[v](_,k)},k)}}(I,this));else{var R=this[y].read();if(R!==null)return Promise.resolve(g(R,!1));A=new Promise(this[v])}return this[d]=A,A}},Symbol.asyncIterator,function(){return this}),s(n,"return",function(){var x=this;return new Promise(function(T,A){x[y].destroy(null,function(I){I?A(I):T(g(void 0,!0))})})}),n),w);a.exports=function(x){var T,A=Object.create(p,(s(T={},y,{value:x,writable:!0}),s(T,c,{value:null,writable:!0}),s(T,l,{value:null,writable:!0}),s(T,f,{value:null,writable:!0}),s(T,h,{value:x._readableState.endEmitted,writable:!0}),s(T,v,{value:function(I,R){var z=A[y].read();z?(A[d]=null,A[c]=null,A[l]=null,I(g(z,!1))):(A[c]=I,A[l]=R)},writable:!0}),T));return A[d]=null,u(x,function(I){if(I&&I.code!=="ERR_STREAM_PREMATURE_CLOSE"){var R=A[l];return R!==null&&(A[d]=null,A[c]=null,A[l]=null,R(I)),void(A[f]=I)}var z=A[c];z!==null&&(A[d]=null,A[c]=null,A[l]=null,z(g(void 0,!0))),A[h]=!0}),x.on("readable",(function(I){o.nextTick(m,I)}).bind(null,A)),A}}).call(this)}).call(this,r("_process"))},{"./end-of-stream":64,_process:50}],62:[function(r,a,i){function o(f,h){var d=Object.keys(f);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(f);h&&(v=v.filter(function(y){return Object.getOwnPropertyDescriptor(f,y).enumerable})),d.push.apply(d,v)}return d}function n(f,h,d){return h in f?Object.defineProperty(f,h,{value:d,enumerable:!0,configurable:!0,writable:!0}):f[h]=d,f}function s(f,h){for(var d=0;d<h.length;d++){var v=h[d];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}var u=r("buffer").Buffer,c=r("util").inspect,l=c&&c.custom||"inspect";a.exports=function(){function f(){(function(v,y){if(!(v instanceof y))throw new TypeError("Cannot call a class as a function")})(this,f),this.head=null,this.tail=null,this.length=0}var h,d;return h=f,(d=[{key:"push",value:function(v){var y={data:v,next:null};this.length>0?this.tail.next=y:this.head=y,this.tail=y,++this.length}},{key:"unshift",value:function(v){var y={data:v,next:this.head};this.length===0&&(this.tail=y),this.head=y,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var y=this.head,g=""+y.data;y=y.next;)g+=v+y.data;return g}},{key:"concat",value:function(v){if(this.length===0)return u.alloc(0);for(var y,g,m,w=u.allocUnsafe(v>>>0),p=this.head,x=0;p;)y=p.data,g=w,m=x,u.prototype.copy.call(y,g,m),x+=p.data.length,p=p.next;return w}},{key:"consume",value:function(v,y){var g;return v<this.head.data.length?(g=this.head.data.slice(0,v),this.head.data=this.head.data.slice(v)):g=v===this.head.data.length?this.shift():y?this._getString(v):this._getBuffer(v),g}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(v){var y=this.head,g=1,m=y.data;for(v-=m.length;y=y.next;){var w=y.data,p=v>w.length?w.length:v;if(p===w.length?m+=w:m+=w.slice(0,v),(v-=p)===0){p===w.length?(++g,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=w.slice(p));break}++g}return this.length-=g,m}},{key:"_getBuffer",value:function(v){var y=u.allocUnsafe(v),g=this.head,m=1;for(g.data.copy(y),v-=g.data.length;g=g.next;){var w=g.data,p=v>w.length?w.length:v;if(w.copy(y,y.length-v,0,p),(v-=p)===0){p===w.length?(++m,g.next?this.head=g.next:this.head=this.tail=null):(this.head=g,g.data=w.slice(p));break}++m}return this.length-=m,y}},{key:l,value:function(v,y){return c(this,function(g){for(var m=1;m<arguments.length;m++){var w=arguments[m]!=null?arguments[m]:{};m%2?o(Object(w),!0).forEach(function(p){n(g,p,w[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(w)):o(Object(w)).forEach(function(p){Object.defineProperty(g,p,Object.getOwnPropertyDescriptor(w,p))})}return g}({},y,{depth:0,customInspect:!1}))}}])&&s(h.prototype,d),f}()},{buffer:17,util:16}],63:[function(r,a,i){(function(o){(function(){function n(c,l){u(c,l),s(c)}function s(c){c._writableState&&!c._writableState.emitClose||c._readableState&&!c._readableState.emitClose||c.emit("close")}function u(c,l){c.emit("error",l)}a.exports={destroy:function(c,l){var f=this,h=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return h||d?(l?l(c):c&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,o.nextTick(u,this,c)):o.nextTick(u,this,c)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(c||null,function(v){!l&&v?f._writableState?f._writableState.errorEmitted?o.nextTick(s,f):(f._writableState.errorEmitted=!0,o.nextTick(n,f,v)):o.nextTick(n,f,v):l?(o.nextTick(s,f),l(v)):o.nextTick(s,f)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(c,l){var f=c._readableState,h=c._writableState;f&&f.autoDestroy||h&&h.autoDestroy?c.destroy(l):c.emit("error",l)}}}).call(this)}).call(this,r("_process"))},{_process:50}],64:[function(r,a,i){var o=r("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}a.exports=function s(u,c,l){if(typeof c=="function")return s(u,null,c);c||(c={}),l=function(T){var A=!1;return function(){if(!A){A=!0;for(var I=arguments.length,R=new Array(I),z=0;z<I;z++)R[z]=arguments[z];T.apply(this,R)}}}(l||n);var f=c.readable||c.readable!==!1&&u.readable,h=c.writable||c.writable!==!1&&u.writable,d=function(){u.writable||y()},v=u._writableState&&u._writableState.finished,y=function(){h=!1,v=!0,f||l.call(u)},g=u._readableState&&u._readableState.endEmitted,m=function(){f=!1,g=!0,h||l.call(u)},w=function(T){l.call(u,T)},p=function(){var T;return f&&!g?(u._readableState&&u._readableState.ended||(T=new o),l.call(u,T)):h&&!v?(u._writableState&&u._writableState.ended||(T=new o),l.call(u,T)):void 0},x=function(){u.req.on("finish",y)};return function(T){return T.setHeader&&typeof T.abort=="function"}(u)?(u.on("complete",y),u.on("abort",p),u.req?x():u.on("request",x)):h&&!u._writableState&&(u.on("end",d),u.on("close",d)),u.on("end",m),u.on("finish",y),c.error!==!1&&u.on("error",w),u.on("close",p),function(){u.removeListener("complete",y),u.removeListener("abort",p),u.removeListener("request",x),u.req&&u.req.removeListener("finish",y),u.removeListener("end",d),u.removeListener("close",d),u.removeListener("finish",y),u.removeListener("end",m),u.removeListener("error",w),u.removeListener("close",p)}}},{"../../../errors":55}],65:[function(r,a,i){a.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(r,a,i){var o,n=r("../../../errors").codes,s=n.ERR_MISSING_ARGS,u=n.ERR_STREAM_DESTROYED;function c(h){if(h)throw h}function l(h){h()}function f(h,d){return h.pipe(d)}a.exports=function(){for(var h=arguments.length,d=new Array(h),v=0;v<h;v++)d[v]=arguments[v];var y,g=function(w){return w.length?typeof w[w.length-1]!="function"?c:w.pop():c}(d);if(Array.isArray(d[0])&&(d=d[0]),d.length<2)throw new s("streams");var m=d.map(function(w,p){var x=p<d.length-1;return function(T,A,I,R){R=function(_){var k=!1;return function(){k||(k=!0,_.apply(void 0,arguments))}}(R);var z=!1;T.on("close",function(){z=!0}),o===void 0&&(o=r("./end-of-stream")),o(T,{readable:A,writable:I},function(_){if(_)return R(_);z=!0,R()});var U=!1;return function(_){if(!z&&!U)return U=!0,function(k){return k.setHeader&&typeof k.abort=="function"}(T)?T.abort():typeof T.destroy=="function"?T.destroy():void R(_||new u("pipe"))}}(w,x,p>0,function(T){y||(y=T),T&&m.forEach(l),x||(m.forEach(l),g(y))})});return d.reduce(f)}},{"../../../errors":55,"./end-of-stream":64}],67:[function(r,a,i){var o=r("../../../errors").codes.ERR_INVALID_OPT_VALUE;a.exports={getHighWaterMark:function(n,s,u,c){var l=function(f,h,d){return f.highWaterMark!=null?f.highWaterMark:h?f[d]:null}(s,c,u);if(l!=null){if(!isFinite(l)||Math.floor(l)!==l||l<0)throw new o(c?u:"highWaterMark",l);return Math.floor(l)}return n.objectMode?16:16384}}},{"../../../errors":55}],68:[function(r,a,i){a.exports=r("events").EventEmitter},{events:22}],69:[function(r,a,i){(i=a.exports=r("./lib/_stream_readable.js")).Stream=i,i.Readable=i,i.Writable=r("./lib/_stream_writable.js"),i.Duplex=r("./lib/_stream_duplex.js"),i.Transform=r("./lib/_stream_transform.js"),i.PassThrough=r("./lib/_stream_passthrough.js"),i.finished=r("./lib/internal/streams/end-of-stream.js"),i.pipeline=r("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(r,a,i){a.exports=function(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var o;if(arguments.length>0){o=new Array(arguments.length-2);for(var n=0;n<o.length;n++)o[n]=arguments[n+2]}return new function(s,u,c){var l=this;this._callback=s,this._args=c,this._interval=setInterval(s,u,this._args),this.reschedule=function(f){f||(f=l._interval),l._interval&&clearInterval(l._interval),l._interval=setInterval(l._callback,f,l._args)},this.clear=function(){l._interval&&(clearInterval(l._interval),l._interval=void 0)},this.destroy=function(){l._interval&&clearInterval(l._interval),l._callback=void 0,l._interval=void 0,l._args=void 0}}(arguments[0],arguments[1],o)}},{}],71:[function(r,a,i){a.exports=r("./index.js")()},{"./index.js":72}],72:[function(r,a,i){(function(o){(function(){function n(s){return s instanceof o?o.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}a.exports=function(s){return(s=s||{}).circles?function(c){var l=[],f=[];return c.proto?function d(v){if(typeof v!="object"||v===null)return v;if(v instanceof Date)return new Date(v);if(Array.isArray(v))return h(v,d);if(v instanceof Map)return new Map(h(Array.from(v),d));if(v instanceof Set)return new Set(h(Array.from(v),d));var y={};for(var g in l.push(v),f.push(y),v){var m=v[g];if(typeof m!="object"||m===null)y[g]=m;else if(m instanceof Date)y[g]=new Date(m);else if(m instanceof Map)y[g]=new Map(h(Array.from(m),d));else if(m instanceof Set)y[g]=new Set(h(Array.from(m),d));else if(ArrayBuffer.isView(m))y[g]=n(m);else{var w=l.indexOf(m);y[g]=w!==-1?f[w]:d(m)}}return l.pop(),f.pop(),y}:function d(v){if(typeof v!="object"||v===null)return v;if(v instanceof Date)return new Date(v);if(Array.isArray(v))return h(v,d);if(v instanceof Map)return new Map(h(Array.from(v),d));if(v instanceof Set)return new Set(h(Array.from(v),d));var y={};for(var g in l.push(v),f.push(y),v)if(Object.hasOwnProperty.call(v,g)!==!1){var m=v[g];if(typeof m!="object"||m===null)y[g]=m;else if(m instanceof Date)y[g]=new Date(m);else if(m instanceof Map)y[g]=new Map(h(Array.from(m),d));else if(m instanceof Set)y[g]=new Set(h(Array.from(m),d));else if(ArrayBuffer.isView(m))y[g]=n(m);else{var w=l.indexOf(m);y[g]=w!==-1?f[w]:d(m)}}return l.pop(),f.pop(),y};function h(d,v){for(var y=Object.keys(d),g=new Array(y.length),m=0;m<y.length;m++){var w=y[m],p=d[w];if(typeof p!="object"||p===null)g[w]=p;else if(p instanceof Date)g[w]=new Date(p);else if(ArrayBuffer.isView(p))g[w]=n(p);else{var x=l.indexOf(p);g[w]=x!==-1?f[x]:v(p)}}return g}}(s):s.proto?function c(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return u(l,c);if(l instanceof Map)return new Map(u(Array.from(l),c));if(l instanceof Set)return new Set(u(Array.from(l),c));var f={};for(var h in l){var d=l[h];typeof d!="object"||d===null?f[h]=d:d instanceof Date?f[h]=new Date(d):d instanceof Map?f[h]=new Map(u(Array.from(d),c)):d instanceof Set?f[h]=new Set(u(Array.from(d),c)):ArrayBuffer.isView(d)?f[h]=n(d):f[h]=c(d)}return f}:function c(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return u(l,c);if(l instanceof Map)return new Map(u(Array.from(l),c));if(l instanceof Set)return new Set(u(Array.from(l),c));var f={};for(var h in l)if(Object.hasOwnProperty.call(l,h)!==!1){var d=l[h];typeof d!="object"||d===null?f[h]=d:d instanceof Date?f[h]=new Date(d):d instanceof Map?f[h]=new Map(u(Array.from(d),c)):d instanceof Set?f[h]=new Set(u(Array.from(d),c)):ArrayBuffer.isView(d)?f[h]=n(d):f[h]=c(d)}return f};function u(c,l){for(var f=Object.keys(c),h=new Array(f.length),d=0;d<f.length;d++){var v=f[d],y=c[v];typeof y!="object"||y===null?h[v]=y:y instanceof Date?h[v]=new Date(y):ArrayBuffer.isView(y)?h[v]=n(y):h[v]=l(y)}return h}}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],73:[function(r,a,i){var o=r("buffer"),n=o.Buffer;function s(c,l){for(var f in c)l[f]=c[f]}function u(c,l,f){return n(c,l,f)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?a.exports=o:(s(o,i),i.Buffer=u),u.prototype=Object.create(n.prototype),s(n,u),u.from=function(c,l,f){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,l,f)},u.alloc=function(c,l,f){if(typeof c!="number")throw new TypeError("Argument must be a number");var h=n(c);return l!==void 0?typeof f=="string"?h.fill(l,f):h.fill(l):h.fill(0),h},u.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},u.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return o.SlowBuffer(c)}},{buffer:17}],74:[function(r,a,i){a.exports=function(o){var n=o._readableState;return n?n.objectMode||typeof o._duplexState=="number"?o.read():o.read((s=n,s.buffer.length?s.buffer.head?s.buffer.head.data.length:s.buffer[0].length:s.length)):null;var s}},{}],75:[function(r,a,i){var o=r("safe-buffer").Buffer,n=o.isEncoding||function(g){switch((g=""+g)&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(g){var m;switch(this.encoding=function(w){var p=function(x){if(!x)return"utf8";for(var T;;)switch(x){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return x;default:if(T)return;x=(""+x).toLowerCase(),T=!0}}(w);if(typeof p!="string"&&(o.isEncoding===n||!n(w)))throw new Error("Unknown encoding: "+w);return p||w}(g),this.encoding){case"utf16le":this.text=l,this.end=f,m=4;break;case"utf8":this.fillLast=c,m=4;break;case"base64":this.text=h,this.end=d,m=3;break;default:return this.write=v,void(this.end=y)}this.lastNeed=0,this.lastTotal=0,this.lastChar=o.allocUnsafe(m)}function u(g){return g<=127?0:g>>5==6?2:g>>4==14?3:g>>3==30?4:g>>6==2?-1:-2}function c(g){var m=this.lastTotal-this.lastNeed,w=function(p,x,T){if((192&x[0])!=128)return p.lastNeed=0,"�";if(p.lastNeed>1&&x.length>1){if((192&x[1])!=128)return p.lastNeed=1,"�";if(p.lastNeed>2&&x.length>2&&(192&x[2])!=128)return p.lastNeed=2,"�"}}(this,g);return w!==void 0?w:this.lastNeed<=g.length?(g.copy(this.lastChar,m,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(g.copy(this.lastChar,m,0,g.length),void(this.lastNeed-=g.length))}function l(g,m){if((g.length-m)%2==0){var w=g.toString("utf16le",m);if(w){var p=w.charCodeAt(w.length-1);if(p>=55296&&p<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",m,g.length-1)}function f(g){var m=g&&g.length?this.write(g):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return m+this.lastChar.toString("utf16le",0,w)}return m}function h(g,m){var w=(g.length-m)%3;return w===0?g.toString("base64",m):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",m,g.length-w))}function d(g){var m=g&&g.length?this.write(g):"";return this.lastNeed?m+this.lastChar.toString("base64",0,3-this.lastNeed):m}function v(g){return g.toString(this.encoding)}function y(g){return g&&g.length?this.write(g):""}i.StringDecoder=s,s.prototype.write=function(g){if(g.length===0)return"";var m,w;if(this.lastNeed){if((m=this.fillLast(g))===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<g.length?m?m+this.text(g,w):this.text(g,w):m||""},s.prototype.end=function(g){var m=g&&g.length?this.write(g):"";return this.lastNeed?m+"�":m},s.prototype.text=function(g,m){var w=function(x,T,A){var I=T.length-1;if(I<A)return 0;var R=u(T[I]);return R>=0?(R>0&&(x.lastNeed=R-1),R):--I<A||R===-2?0:(R=u(T[I]))>=0?(R>0&&(x.lastNeed=R-2),R):--I<A||R===-2?0:(R=u(T[I]))>=0?(R>0&&(R===2?R=0:x.lastNeed=R-3),R):0}(this,g,m);if(!this.lastNeed)return g.toString("utf8",m);this.lastTotal=w;var p=g.length-(w-this.lastNeed);return g.copy(this.lastChar,0,p),g.toString("utf8",m,p)},s.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length}},{"safe-buffer":73}],76:[function(r,a,i){var o=r("punycode"),n=r("./util");function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}i.parse=T,i.resolve=function(A,I){return T(A,!1,!0).resolve(I)},i.resolveObject=function(A,I){return A?T(A,!1,!0).resolveObject(I):I},i.format=function(A){return n.isString(A)&&(A=T(A)),A instanceof s?A.format():s.prototype.format.call(A)},i.Url=s;var u=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
`,"	"]),h=["'"].concat(f),d=["%","/","?",";","#"].concat(h),v=["/","?","#"],y=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},p={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=r("querystring");function T(A,I,R){if(A&&n.isObject(A)&&A instanceof s)return A;var z=new s;return z.parse(A,I,R),z}s.prototype.parse=function(A,I,R){if(!n.isString(A))throw new TypeError("Parameter 'url' must be a string, not "+typeof A);var z=A.indexOf("?"),U=z!==-1&&z<A.indexOf("#")?"?":"#",_=A.split(U);_[0]=_[0].replace(/\\/g,"/");var k=A=_.join(U);if(k=k.trim(),!R&&A.split("#").length===1){var S=l.exec(k);if(S)return this.path=k,this.href=k,this.pathname=S[1],S[2]?(this.search=S[2],this.query=I?x.parse(this.search.substr(1)):this.search.substr(1)):I&&(this.search="",this.query={}),this}var P=u.exec(k);if(P){var B=(P=P[0]).toLowerCase();this.protocol=B,k=k.substr(P.length)}if(R||P||k.match(/^\/\/[^@\/]+@[^@\/]+/)){var D=k.substr(0,2)==="//";!D||P&&w[P]||(k=k.substr(2),this.slashes=!0)}if(!w[P]&&(D||P&&!p[P])){for(var H,L,M=-1,j=0;j<v.length;j++)(W=k.indexOf(v[j]))!==-1&&(M===-1||W<M)&&(M=W);for((L=M===-1?k.lastIndexOf("@"):k.lastIndexOf("@",M))!==-1&&(H=k.slice(0,L),k=k.slice(L+1),this.auth=decodeURIComponent(H)),M=-1,j=0;j<d.length;j++){var W;(W=k.indexOf(d[j]))!==-1&&(M===-1||W<M)&&(M=W)}M===-1&&(M=k.length),this.host=k.slice(0,M),k=k.slice(M),this.parseHost(),this.hostname=this.hostname||"";var F=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!F)for(var V=this.hostname.split(/\./),Y=(j=0,V.length);j<Y;j++){var q=V[j];if(q&&!q.match(y)){for(var Q="",K=0,X=q.length;K<X;K++)q.charCodeAt(K)>127?Q+="x":Q+=q[K];if(!Q.match(y)){var b=V.slice(0,j),C=V.slice(j+1),E=q.match(g);E&&(b.push(E[1]),C.unshift(E[2])),C.length&&(k="/"+C.join(".")+k),this.hostname=b.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=o.toASCII(this.hostname));var N=this.port?":"+this.port:"",O=this.hostname||"";this.host=O+N,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!m[B])for(j=0,Y=h.length;j<Y;j++){var $=h[j];if(k.indexOf($)!==-1){var G=encodeURIComponent($);G===$&&(G=escape($)),k=k.split($).join(G)}}var Z=k.indexOf("#");Z!==-1&&(this.hash=k.substr(Z),k=k.slice(0,Z));var J=k.indexOf("?");if(J!==-1?(this.search=k.substr(J),this.query=k.substr(J+1),I&&(this.query=x.parse(this.query)),k=k.slice(0,J)):I&&(this.search="",this.query={}),k&&(this.pathname=k),p[B]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){N=this.pathname||"";var ee=this.search||"";this.path=N+ee}return this.href=this.format(),this},s.prototype.format=function(){var A=this.auth||"";A&&(A=(A=encodeURIComponent(A)).replace(/%3A/i,":"),A+="@");var I=this.protocol||"",R=this.pathname||"",z=this.hash||"",U=!1,_="";this.host?U=A+this.host:this.hostname&&(U=A+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(U+=":"+this.port)),this.query&&n.isObject(this.query)&&Object.keys(this.query).length&&(_=x.stringify(this.query));var k=this.search||_&&"?"+_||"";return I&&I.substr(-1)!==":"&&(I+=":"),this.slashes||(!I||p[I])&&U!==!1?(U="//"+(U||""),R&&R.charAt(0)!=="/"&&(R="/"+R)):U||(U=""),z&&z.charAt(0)!=="#"&&(z="#"+z),k&&k.charAt(0)!=="?"&&(k="?"+k),I+U+(R=R.replace(/[?#]/g,function(S){return encodeURIComponent(S)}))+(k=k.replace("#","%23"))+z},s.prototype.resolve=function(A){return this.resolveObject(T(A,!1,!0)).format()},s.prototype.resolveObject=function(A){if(n.isString(A)){var I=new s;I.parse(A,!1,!0),A=I}for(var R=new s,z=Object.keys(this),U=0;U<z.length;U++){var _=z[U];R[_]=this[_]}if(R.hash=A.hash,A.href==="")return R.href=R.format(),R;if(A.slashes&&!A.protocol){for(var k=Object.keys(A),S=0;S<k.length;S++){var P=k[S];P!=="protocol"&&(R[P]=A[P])}return p[R.protocol]&&R.hostname&&!R.pathname&&(R.path=R.pathname="/"),R.href=R.format(),R}if(A.protocol&&A.protocol!==R.protocol){if(!p[A.protocol]){for(var B=Object.keys(A),D=0;D<B.length;D++){var H=B[D];R[H]=A[H]}return R.href=R.format(),R}if(R.protocol=A.protocol,A.host||w[A.protocol])R.pathname=A.pathname;else{for(var L=(A.pathname||"").split("/");L.length&&!(A.host=L.shift()););A.host||(A.host=""),A.hostname||(A.hostname=""),L[0]!==""&&L.unshift(""),L.length<2&&L.unshift(""),R.pathname=L.join("/")}if(R.search=A.search,R.query=A.query,R.host=A.host||"",R.auth=A.auth,R.hostname=A.hostname||A.host,R.port=A.port,R.pathname||R.search){var M=R.pathname||"",j=R.search||"";R.path=M+j}return R.slashes=R.slashes||A.slashes,R.href=R.format(),R}var W=R.pathname&&R.pathname.charAt(0)==="/",F=A.host||A.pathname&&A.pathname.charAt(0)==="/",V=F||W||R.host&&A.pathname,Y=V,q=R.pathname&&R.pathname.split("/")||[],Q=(L=A.pathname&&A.pathname.split("/")||[],R.protocol&&!p[R.protocol]);if(Q&&(R.hostname="",R.port=null,R.host&&(q[0]===""?q[0]=R.host:q.unshift(R.host)),R.host="",A.protocol&&(A.hostname=null,A.port=null,A.host&&(L[0]===""?L[0]=A.host:L.unshift(A.host)),A.host=null),V=V&&(L[0]===""||q[0]==="")),F)R.host=A.host||A.host===""?A.host:R.host,R.hostname=A.hostname||A.hostname===""?A.hostname:R.hostname,R.search=A.search,R.query=A.query,q=L;else if(L.length)q||(q=[]),q.pop(),q=q.concat(L),R.search=A.search,R.query=A.query;else if(!n.isNullOrUndefined(A.search))return Q&&(R.hostname=R.host=q.shift(),(E=!!(R.host&&R.host.indexOf("@")>0)&&R.host.split("@"))&&(R.auth=E.shift(),R.host=R.hostname=E.shift())),R.search=A.search,R.query=A.query,n.isNull(R.pathname)&&n.isNull(R.search)||(R.path=(R.pathname?R.pathname:"")+(R.search?R.search:"")),R.href=R.format(),R;if(!q.length)return R.pathname=null,R.search?R.path="/"+R.search:R.path=null,R.href=R.format(),R;for(var K=q.slice(-1)[0],X=(R.host||A.host||q.length>1)&&(K==="."||K==="..")||K==="",b=0,C=q.length;C>=0;C--)(K=q[C])==="."?q.splice(C,1):K===".."?(q.splice(C,1),b++):b&&(q.splice(C,1),b--);if(!V&&!Y)for(;b--;b)q.unshift("..");!V||q[0]===""||q[0]&&q[0].charAt(0)==="/"||q.unshift(""),X&&q.join("/").substr(-1)!=="/"&&q.push("");var E,N=q[0]===""||q[0]&&q[0].charAt(0)==="/";return Q&&(R.hostname=R.host=N?"":q.length?q.shift():"",(E=!!(R.host&&R.host.indexOf("@")>0)&&R.host.split("@"))&&(R.auth=E.shift(),R.host=R.hostname=E.shift())),(V=V||R.host&&q.length)&&!N&&q.unshift(""),q.length?R.pathname=q.join("/"):(R.pathname=null,R.path=null),n.isNull(R.pathname)&&n.isNull(R.search)||(R.path=(R.pathname?R.pathname:"")+(R.search?R.search:"")),R.auth=A.auth||R.auth,R.slashes=R.slashes||A.slashes,R.href=R.format(),R},s.prototype.parseHost=function(){var A=this.host,I=c.exec(A);I&&((I=I[0])!==":"&&(this.port=I.substr(1)),A=A.substr(0,A.length-I.length)),A&&(this.hostname=A)}},{"./util":77,punycode:51,querystring:54}],77:[function(r,a,i){a.exports={isString:function(o){return typeof o=="string"},isObject:function(o){return typeof o=="object"&&o!==null},isNull:function(o){return o===null},isNullOrUndefined:function(o){return o==null}}},{}],78:[function(r,a,i){(function(o){(function(){function n(s){try{if(!o.localStorage)return!1}catch{return!1}var u=o.localStorage[s];return u!=null&&String(u).toLowerCase()==="true"}a.exports=function(s,u){if(n("noDeprecation"))return s;var c=!1;return function(){if(!c){if(n("throwDeprecation"))throw new Error(u);n("traceDeprecation")?console.trace(u):console.warn(u),c=!0}return s.apply(this,arguments)}}}).call(this)}).call(this,typeof qe<"u"?qe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(r,a,i){a.exports=function o(n,s){if(n&&s)return o(n)(s);if(typeof n!="function")throw new TypeError("need wrapper function");return Object.keys(n).forEach(function(c){u[c]=n[c]}),u;function u(){for(var c=new Array(arguments.length),l=0;l<c.length;l++)c[l]=arguments[l];var f=n.apply(this,c),h=c[c.length-1];return typeof f=="function"&&f!==h&&Object.keys(h).forEach(function(d){f[d]=h[d]}),f}}},{}],80:[function(r,a,i){a.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(r,a,i){a.exports=function(){for(var n={},s=0;s<arguments.length;s++){var u=arguments[s];for(var c in u)o.call(u,c)&&(n[c]=u[c])}return n};var o=Object.prototype.hasOwnProperty},{}],82:[function(r,a,i){a.exports=function(o){o.prototype[Symbol.iterator]=function*(){for(let n=this.head;n;n=n.next)yield n.value}}},{}],83:[function(r,a,i){function o(l){var f=this;if(f instanceof o||(f=new o),f.tail=null,f.head=null,f.length=0,l&&typeof l.forEach=="function")l.forEach(function(v){f.push(v)});else if(arguments.length>0)for(var h=0,d=arguments.length;h<d;h++)f.push(arguments[h]);return f}function n(l,f,h){var d=f===l.head?new c(h,null,f,l):new c(h,f,f.next,l);return d.next===null&&(l.tail=d),d.prev===null&&(l.head=d),l.length++,d}function s(l,f){l.tail=new c(f,l.tail,null,l),l.head||(l.head=l.tail),l.length++}function u(l,f){l.head=new c(f,null,l.head,l),l.tail||(l.tail=l.head),l.length++}function c(l,f,h,d){if(!(this instanceof c))return new c(l,f,h,d);this.list=d,this.value=l,f?(f.next=this,this.prev=f):this.prev=null,h?(h.prev=this,this.next=h):this.next=null}a.exports=o,o.Node=c,o.create=o,o.prototype.removeNode=function(l){if(l.list!==this)throw new Error("removing node which does not belong to this list");var f=l.next,h=l.prev;return f&&(f.prev=h),h&&(h.next=f),l===this.head&&(this.head=f),l===this.tail&&(this.tail=h),l.list.length--,l.next=null,l.prev=null,l.list=null,f},o.prototype.unshiftNode=function(l){if(l!==this.head){l.list&&l.list.removeNode(l);var f=this.head;l.list=this,l.next=f,f&&(f.prev=l),this.head=l,this.tail||(this.tail=l),this.length++}},o.prototype.pushNode=function(l){if(l!==this.tail){l.list&&l.list.removeNode(l);var f=this.tail;l.list=this,l.prev=f,f&&(f.next=l),this.tail=l,this.head||(this.head=l),this.length++}},o.prototype.push=function(){for(var l=0,f=arguments.length;l<f;l++)s(this,arguments[l]);return this.length},o.prototype.unshift=function(){for(var l=0,f=arguments.length;l<f;l++)u(this,arguments[l]);return this.length},o.prototype.pop=function(){if(this.tail){var l=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,l}},o.prototype.shift=function(){if(this.head){var l=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,l}},o.prototype.forEach=function(l,f){f=f||this;for(var h=this.head,d=0;h!==null;d++)l.call(f,h.value,d,this),h=h.next},o.prototype.forEachReverse=function(l,f){f=f||this;for(var h=this.tail,d=this.length-1;h!==null;d--)l.call(f,h.value,d,this),h=h.prev},o.prototype.get=function(l){for(var f=0,h=this.head;h!==null&&f<l;f++)h=h.next;if(f===l&&h!==null)return h.value},o.prototype.getReverse=function(l){for(var f=0,h=this.tail;h!==null&&f<l;f++)h=h.prev;if(f===l&&h!==null)return h.value},o.prototype.map=function(l,f){f=f||this;for(var h=new o,d=this.head;d!==null;)h.push(l.call(f,d.value,this)),d=d.next;return h},o.prototype.mapReverse=function(l,f){f=f||this;for(var h=new o,d=this.tail;d!==null;)h.push(l.call(f,d.value,this)),d=d.prev;return h},o.prototype.reduce=function(l,f){var h,d=this.head;if(arguments.length>1)h=f;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");d=this.head.next,h=this.head.value}for(var v=0;d!==null;v++)h=l(h,d.value,v),d=d.next;return h},o.prototype.reduceReverse=function(l,f){var h,d=this.tail;if(arguments.length>1)h=f;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");d=this.tail.prev,h=this.tail.value}for(var v=this.length-1;d!==null;v--)h=l(h,d.value,v),d=d.prev;return h},o.prototype.toArray=function(){for(var l=new Array(this.length),f=0,h=this.head;h!==null;f++)l[f]=h.value,h=h.next;return l},o.prototype.toArrayReverse=function(){for(var l=new Array(this.length),f=0,h=this.tail;h!==null;f++)l[f]=h.value,h=h.prev;return l},o.prototype.slice=function(l,f){(f=f||this.length)<0&&(f+=this.length),(l=l||0)<0&&(l+=this.length);var h=new o;if(f<l||f<0)return h;l<0&&(l=0),f>this.length&&(f=this.length);for(var d=0,v=this.head;v!==null&&d<l;d++)v=v.next;for(;v!==null&&d<f;d++,v=v.next)h.push(v.value);return h},o.prototype.sliceReverse=function(l,f){(f=f||this.length)<0&&(f+=this.length),(l=l||0)<0&&(l+=this.length);var h=new o;if(f<l||f<0)return h;l<0&&(l=0),f>this.length&&(f=this.length);for(var d=this.length,v=this.tail;v!==null&&d>f;d--)v=v.prev;for(;v!==null&&d>l;d--,v=v.prev)h.push(v.value);return h},o.prototype.splice=function(l,f,...h){l>this.length&&(l=this.length-1),l<0&&(l=this.length+l);for(var d=0,v=this.head;v!==null&&d<l;d++)v=v.next;var y=[];for(d=0;v&&d<f;d++)y.push(v.value),v=this.removeNode(v);for(v===null&&(v=this.tail),v!==this.head&&v!==this.tail&&(v=v.prev),d=0;d<h.length;d++)v=n(this,v,h[d]);return y},o.prototype.reverse=function(){for(var l=this.head,f=this.tail,h=l;h!==null;h=h.prev){var d=h.prev;h.prev=h.next,h.next=d}return this.head=f,this.tail=l,this};try{r("./iterator.js")(o)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(JV);const Mc=new WeakMap;function yh(e,t,r){let a=Mc.get(e);return a?clearTimeout(a.timer):(a={},Mc.set(e,a)),new Promise((i,o)=>{a.timer=setTimeout(async()=>{i(await e(r)),Mc.delete(e)},t)})}let Gt=4,Lc=["echarts","image"];function ZV(e,t){var i,o,n,s;t.onAdd||(t.onAdd=ph,(!t.rowPos||!t.colPos||!t.calculative.maxOffsetY)&&t.onAdd(t),t.onMouseMove=gq,t.onMouseLeave=yq,t.onMouseDown=pq,t.onShowInput=hq,t.onInput=dq,t.onValue=fs,t.onBeforeValue=_q,t.onMouseEnter=Pq,t.onWheel=Sq,t.onDestroy=Aq,t.onResize=Rq,t.onMove=Mq,t.onMouseUp=vq,t.onScale=Iq),!t.pagination&&(t.colHeaders&&t.data.length!==t.rowPos.length-1||!t.colHeaders&&t.data.length!==t.rowPos.length)&&(t.initWorldRect=null,t.calculative.isUpdateData=!0,fs(t)),t.data[0].length!==t.colPos.length&&(t.initWorldRect=null,t.calculative.isUpdateData=!0,fs(t)),t.colHeaders&&(t.columns&&t.columns.length&&t.columns[0].text||(t.columns?t.columns&&t.columns.length&&(t.data[0].forEach((u,c)=>{t.columns[c]?t.columns[c].text=u:t.columns[c]={text:u}}),t.data.splice(0,1)):(t.columns=t.data[0].map(u=>({text:u})),t.data.splice(0,1))));const r=t.calculative.canvas.store.data,a=t.calculative.canvas.store.options;if(t.colHeaders=t.colHeaders===void 0?t.hasHeader:t.colHeaders,t.color=t.color||r.color||a.color,t.textColor=t.textColor||t.color||r.textColor||a.textColor,t.activeColor=t.activeColor||a.activeColor,t.hoverColor=t.hoverColor||a.hoverColor,t.activeBackground=t.activeBackground||a.activeBackground,t.hoverBackground=t.hoverBackground||a.hoverBackground,t.calculative.active||(t.calculative.activeCell=void 0,t.calculative.mergeCell=void 0,t.calculative.activeCol=void 0,t.calculative.activeRow=void 0,(o=(i=t.calculative.singleton)==null?void 0:i.tableContextMenu)==null||o.hide()),t.calculative.canvas.store.data.locked&&((s=(n=t.calculative.singleton)==null?void 0:n.tableContextMenu)==null||s.hide()),t.childActive===void 0&&(t.childActive=!1),t.childHover===void 0&&(t.childHover=!1),t.calculative.focus===void 0&&(t.calculative.focus=!0),!t.colHeaders){e.save(),e.beginPath();const{x:u,y:c,width:l,height:f}=t.calculative.worldRect;e.fillStyle="#fff0",e.rect(u-1,c-1,l+2,f+2),e.fill(),e.clip()}sq(e,t),fq(e,t),cq(e,t),uq(e,t),t.colHeaders&&t.rowPos.length<2||e.restore(),oq(e,t),lq(e,t),eq(e,t),t.pagination&&tq(e,t),t.isFirstTime=!1,t.calculative.initBackRect||(t.calculative.initBackRect=t.calculative.canvas.parent.getPenRect(t))}function eq(e,t){var r;if(!t.locked&&t.calculative.hover&&t.calculative.penCell){let a=null;if(t.rowHeaders&&((r=t.calculative.penCell)==null?void 0:r.col)===0)return;t.colHeaders&&t.calculative.penCell.row===0?a=T1(t,t.calculative.penCell.col):a=en(t,t.calculative.penCell.row,t.calculative.penCell.col),e.save(),e.beginPath(),e.strokeStyle="#d5494199",e.setLineDash([5,5]),e.strokeRect(a.x,a.y,a.width,a.height),e.restore()}}function tq(e,t){rq(t),g1(e,t.calculative.paginationPen);const r=t.calculative.paginationPen.calculative.worldRect;e.beginPath(),e.save(),e.textAlign="start",e.moveTo(r.x,r.y);const{fontSize:a}=t.calculative;let i=t.calculative.paginationPen.size==="small"?2.6*a:3.6*a;e.fillText(`共 ${t.pagination.total} 条数据`,r.x+a,r.y+i/2),e.restore()}function rq(e){e.calculative.paginationPen||(e.calculative.paginationPen=rt(e.pagination));const t=e.calculative.paginationPen;t.calculative=t.calculative||{},t.calculative.canvas=e.calculative.canvas,t.calculative.worldRect={x:e.calculative.worldRect.x,y:e.calculative.worldRect.y+e.calculative.worldRect.height-184*e.calculative.canvas.store.data.scale,width:e.calculative.worldRect.width,height:184*e.calculative.canvas.store.data.scale},t.activeColor="#fff",t.calculative.fontSize=e.calculative.fontSize,t.calculative.active=e.calculative.active}function w1(e){return Object.keys(e).length===0&&e.constructor===Object}function iq(e){var t;if(!e.calculative.childrenArr||w1(e.calculative.childrenArr))e.calculative.childrenArr={};else return;(t=e.children)==null||t.forEach(r=>{const a=e.calculative.canvas.store.pens[r];a&&(e.calculative.childrenArr[`${a.row}:${a.col}`]?e.calculative.childrenArr[`${a.row}:${a.col}`].push(a):e.calculative.childrenArr[`${a.row}:${a.col}`]=[a])})}function aq(e,t){!e.calculative.childrenArr||w1(e.calculative.childrenArr)||Object.keys(e.calculative.childrenArr).forEach(r=>{if(parseInt(r.split(":")[1])>=e.calculative.hoverCell.lineCol){let i=e.calculative.childrenArr[r];i&&i.forEach(o=>{o.calculative.worldRect.x+=t,o.calculative.worldRect.ex+=t;const n=YW(o.calculative.worldRect,e.calculative.worldRect);Object.assign(o,n)})}})}function oq(e,t){if(!t.calculative.hover||!t.calculative.hoverCell||t.calculative.isInput||!t.calculative.isHover)return;let r=t.calculative.worldRect,a=t.calculative.canvas.mousePos;if(!(a.x>r.x&&a.x<r.x+r.width&&a.y>r.y&&a.y<r.y+r.height)){t.calculative.hover=!1,t.calculative.isHover=!1,t.calculative.hoverCell=void 0;return}const{row:i,col:o}=t.calculative.hoverCell,{x:n,y:s}=t.calculative.canvas.mousePos;if(!t.data[i])return;let u=t.data[i][o];if(typeof u=="object"||!u)return;e.save(),e.beginPath(),e.textAlign="start",e.textBaseline="middle",e.font=e.font=(t.calculative.fontStyle||"")+" normal "+(t.calculative.fontWeight||"")+" "+(t.calculative.fontSize||12)+"px "+t.calculative.fontFamily;const c=e.measureText(u).width;e.beginPath(),e.fillStyle="#fff",e.strokeStyle="#000",e.moveTo(n,s),e.rect(n-10,s,c+20,20),e.fill(),e.stroke(),e.beginPath(),e.fillStyle="#000",e.fillText(u,n,s+10),e.restore()}function nq(e){const t=[],r=[],a=e.calculative.canvas.store.data.scale;e.rowHeight||(e.rowHeight=40),e.colWidth||(e.colWidth=150);let i=0;const o=e.styles&&e.styles.filter(y=>y.col!==void 0&&y.row===void 0&&y.width);let n={};o&&o.forEach(y=>{n[y.col]=y.width});for(let y=0;y<e.data[0].length;y++)i+=(n[y]||e.colWidth)*a,t.push(i);let s=0;const u=e.styles&&e.styles.filter(y=>y.col===void 0&&y.row!==void 0&&y.height);let c={};u&&u.forEach(y=>{c[y.row]=y.height});let l=s,f=e.data.length;e.colHeaders&&(f+=1),e.pagination&&e.pagination.pageSize<e.data.length&&(f=e.pagination.pageSize+1);let h=e.maxNum;h&&e.colHeaders&&(h+=1);for(let y=0;y<f;y++)s+=(c[y]||e.rowHeight)*a,r.push(s),y<h&&(l=s);if(e.calculative.maxOffsetY=(s-l)/a,e.initWorldRect)return;e.pagination&&(h?l=l+200*a:l=s+200*a),e.colPos=t,e.rowPos=r,e.initScale=a,e.tableWidth=i,e.tableHeight=l||s,e.calculative.width=i,e.calculative.height=l||s,e.calculative.width=i,e.calculative.height=l||s,e.height||(e.height=e.calculative.height),e.width||(e.width=e.calculative.width);let d=e.x,v=e.y;if(e.parentId){let y=e.calculative.canvas.store.pens[e.parentId];d=y.calculative.worldRect.x+y.calculative.worldRect.width*e.x,v=y.calculative.worldRect.y+y.calculative.worldRect.height*e.y}e.calculative.worldRect={x:d,y:v,height:e.calculative.height,width:e.calculative.width,center:{x:e.x+e.calculative.width/2,y:e.y+e.calculative.height/2}},e.width=e.calculative.width,e.height=e.calculative.height,e.initWorldRect||(e.initWorldRect={width:e.calculative.worldRect.width,height:e.calculative.worldRect.height}),Xu(e.calculative.worldRect)}function x1(e){if(!e.calculative.initBackRect)return;let t=e.calculative.canvas.parent.getPenRect(e),r=t.width/e.calculative.initBackRect.width,a=t.height/e.calculative.initBackRect.height;e.colWidth=e.colWidth*r,e.rowHeight=e.rowHeight*a,e.styles.forEach(i=>{i.height!==void 0&&i.row!==void 0&&i.col===void 0&&(i.height=i.height*a),i.width!==void 0&&i.col!==void 0&&i.row===void 0&&(i.width=i.width*r)}),e.calculative.initBackRect=t,e.initWorldRect=null,e.calculative.isUpdateData=!0,fs(e),e.calculative.canvas.render()}function sq(e,t){var h;if(!t.colPos)return;const{x:r,y:a,width:i,height:o,ex:n,ey:s}=t.calculative.worldRect;e.save(),e.beginPath(),e.strokeStyle=t.color;let u=t.calculative.borderRadius||0,c=u;u<1&&(u=i*u,c=o*c);let l=u<c?u:c;i<2*l&&(l=i/2),o<2*l&&(l=o/2);let f=s;if(t.pagination&&(t.maxNum?t.maxNum>=t.pagination.pageSize?(f=a+t.rowHeight*t.calculative.canvas.store.data.scale*(t.pagination.pageSize+1),t.pagination.pageSize>t.data.length&&(f=a+t.rowHeight*t.calculative.canvas.store.data.scale*(t.data.length+1))):(f=a+t.rowHeight*t.calculative.canvas.store.data.scale*(t.maxNum+1),t.pagination.pageSize>t.data.length&&(f=a+t.rowHeight*t.calculative.canvas.store.data.scale*(t.data.length+1))):f=a+t.rowPos[t.rowPos.length-1]*t.calculative.worldRect.height/t.tableHeight),e.moveTo(r+l,a),e.arcTo(n,a,n,f,l),e.arcTo(n,f,r,f,l),e.arcTo(r,f,r,a,l),e.arcTo(r,a,n,a,l),t.background&&(e.fillStyle=t.background,e.fill()),t.bordered!==!1&&(e.strokeStyle=t.borderColor||"#424B61",e.stroke()),t.hLine!==!1){let d=t.rowPos[t.rowPos.length-1];t.colHeaders&&(e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight),e.strokeStyle=t.borderColor||"#424B61",e.stroke());for(let v=0;v<t.rowPos.length;v++){let y=t.rowPos[v];if(y===d)continue;const g=y*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale;if(t.colHeaders){if(g<0+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight||g>t.calculative.worldRect.height||t.pagination&&g>f-a)continue}else if(g<0||g>t.calculative.worldRect.height||t.pagination&&g>f-a)continue;let m=(h=t.mergeCells)==null?void 0:h.filter(w=>w.row<=v&&v<w.row+w.rowspan-1);if(e.beginPath(),e.strokeStyle=t.borderColor||"#424B61",m!=null&&m.length){m.sort((w,p)=>w.col-p.col),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+g);for(let w=0;w<m.length;w++){let p=m[w].col-1+m[w].colspan;p>=t.colPos.length&&(p=t.colPos.length-1);let x=t.colPos[m[w].col-1]*t.calculative.worldRect.width/t.tableWidth,T=t.colPos[p]*t.calculative.worldRect.width/t.tableWidth;e.lineTo(t.calculative.worldRect.x+x,t.calculative.worldRect.y+g),e.moveTo(t.calculative.worldRect.x+T,t.calculative.worldRect.y+g)}e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+g)}else e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+g),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+g);e.stroke()}}if(t.vLine!==!1){let d=t.colPos[t.colPos.length-1];t.colPos.forEach((v,y)=>{var m;if(v===d)return;let g=(m=t.mergeCells)==null?void 0:m.filter(w=>w.col<=y&&y<w.col+w.colspan-1);if(e.beginPath(),e.strokeStyle=t.borderColor||"#424B61",g!=null&&g.length){g.sort((p,x)=>p.row-x.row);const w=v*t.calculative.worldRect.width/t.tableWidth;e.moveTo(t.calculative.worldRect.x+w,t.calculative.worldRect.y),t.colHeaders&&e.lineTo(t.calculative.worldRect.x+w,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight);for(let p=0;p<g.length;p++){let x=g[p].row-1+g[p].rowspan;x>=t.rowPos.length&&(x=t.rowPos.length-1);let T=t.rowPos[g[p].row-1]*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale,A=t.rowPos[x]*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale;T>t.calculative.worldRect.height&&(T=t.calculative.worldRect.height),T>=0&&e.lineTo(t.calculative.worldRect.x+w,t.calculative.worldRect.y+T),A>t.calculative.worldRect.height&&(A=t.calculative.worldRect.height),A>=0&&e.moveTo(t.calculative.worldRect.x+w,t.calculative.worldRect.y+A)}e.lineTo(t.calculative.worldRect.x+w,f)}else{const w=v*t.calculative.worldRect.width/t.tableWidth;e.moveTo(t.calculative.worldRect.x+w,t.calculative.worldRect.y),e.lineTo(t.calculative.worldRect.x+w,f)}e.stroke()})}e.restore()}function lq(e,t){if(t.calculative.activeCol!==void 0){e.save(),e.beginPath(),e.strokeStyle=t.activeColor,e.fillStyle="#278df833";const r=T1(t,t.calculative.activeCol);e.rect(r.x,r.y,r.width,r.height),e.fill(),e.stroke(),e.restore();const a=t.calculative.canvas.store.data.scale;e.save(),e.beginPath(),e.fillStyle=t.activeColor,e.strokeStyle="#fff",e.rect(r.x+r.width-2.5*a,r.y-2.5*a,5*a,5*a),e.fill(),e.stroke(),e.restore()}}function cq(e,t){if(!t.calculative.mergeCell&&!t.calculative.activeRow&&t.calculative.active&&t.calculative.activeCell&&t.calculative.activeCell.col!==void 0&&t.calculative.activeCell.row!==void 0){const r=t.calculative.canvas.store.data.scale,a=en(t,t.calculative.activeCell.row,t.calculative.activeCell.col);e.save(),e.beginPath(),e.fillStyle=t.activeColor,e.strokeStyle="#fff",e.rect(a.x+a.width-2.5*r,a.y+a.height-2.5*r,5*r,5*r),e.fill(),e.stroke(),e.restore()}}function uq(e,t){if(t.calculative.mergeCell){e.save(),e.beginPath(),e.strokeStyle=t.activeColor,e.fillStyle="#278df833";const r=kq(t,t.calculative.mergeCell);e.rect(r.x,r.y,r.width,r.height),e.stroke(),e.restore();const a=t.calculative.canvas.store.data.scale;e.save(),e.beginPath(),e.fillStyle=t.activeColor,e.strokeStyle="#fff",e.rect(r.x+r.width-2.5*a,r.y+r.height-2.5*a,5*a,5*a),e.fill(),e.stroke(),e.restore()}}function fq(e,t){var n,s,u,c,l,f,h,d,v,y;if(!t.colPos)return;t.calculative.texts||(t.calculative.texts=[]);const r=t.calculative.canvas.store.data.scale,a=1;let i=(t.calculative.lineWidth||1)/2;t.vLine===!1&&(i=0);const o={};for(let g=0;g<t.rowPos.length;g++){if(t.colHeaders&&g===1){e.save(),e.beginPath();const{x:p,y:x,width:T,height:A}=t.calculative.worldRect;e.fillStyle="#fff0",e.rect(p-1,x+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight-1,T+2,A-t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight+2),e.fill(),e.clip()}const m=t.calculative.worldRect.height/t.tableHeight;if(g>0&&t.offsetY*t.calculative.canvas.store.data.scale>t.rowPos[g]*m){g>=t.calculative.startIndex&&(t.calculative.startIndex=g+1);continue}if(t.rowPos[g-1]*m-t.offsetY*t.calculative.canvas.store.data.scale>t.calculative.worldRect.height-(t.pagination?200*r+t.rowHeight*r:0)+4){g<t.calculative.endIndex&&(t.calculative.endIndex=g-1);continue}let{style:w}=mq(t,g);for(let p=0;p<t.colPos.length;p++){o[p]||(o[p]=bq(t,p));let x=o[p].style,{value:T,style:A,mergeCell:I}=C1(t,g,p),R=!0;if(Array.isArray(A)&&A.length>0){let W=0;A.forEach((F,V)=>{F.wheres&&F.wheres.every(q=>new Function("attr",`return attr ${q.comparison} ${q.value}`)(T))&&(W=V)}),A=A[W]}else A.wheres&&Array.isArray(A.wheres)&&(R=!1,R=A.wheres.every(function(W){return new Function("attr",`return attr ${W.comparison} ${W.value}`)(T)}));let z=t.color,U=t.textColor||t.color,_=null,k=null,S=null,P=null,B={};g!==0&&!(x!=null&&x.pens)&&((n=t.columns)!=null&&n.length)&&((s=t.columns[p])!=null&&s.fn)&&(B=t.columns[p].fn(t,T),B||(B={})),g!==0&&(x!=null&&x.pens)&&((u=t.columns)!=null&&u.length)&&((c=t.columns[p])!=null&&c.fn)&&(B=t.columns[p].fn(t,T),B||(B={text:T}),T=B),x!=null&&x.pens&&typeof T=="string"&&(T={text:T}),A!=null&&A.pens&&typeof T=="string"&&(T={text:T}),R&&(z=A.color||B.color||w.color||x.color||t.color,U=A.textColor||B.textColor||w.textColor||x.textColor||t.textColor,_=A.background||B.background||w.background||x.background,k=(A.fontSize||B.fontSize||w.fontSize||x.fontSize||t.fontSize||12)*t.calculative.canvas.store.data.scale,S=A.fontWeight||w.fontWeight||x.fontWeight,P=A.fontStyle||w.fontStyle||x.fontStyle);let D;t.stripe&&(t.colHeaders!==!1?g%2===1&&(_=_||t.stripeColor||"#407FFF1F"):g%2===0&&(_=_||t.stripeColor||"#407FFF1F")),t.calculative.active&&((l=t.calculative.activeCell)==null?void 0:l.row)===g&&((f=t.calculative.activeCell)==null?void 0:f.col)===p&&(z=t.activeColor,D=z,U=t.activeTextColor||t.activeColor),t.calculative.hover&&((h=t.calculative.hoverCell)==null?void 0:h.row)===g&&((d=t.calculative.hoverCell)==null?void 0:d.col)===p&&(z=t.hoverColor,t.colHeaders&&((v=t.calculative.hoverCell)==null?void 0:v.row)===0||t.rowHeaders&&((y=t.calculative.hoverCell)==null||y.col),U=t.hoverTextColor||t.hoverColor,D=z),t.calculative.activeCell&&(t.rowHeaders&&t.colHeaders&&p==0&&!t.calculative.activeCell.lineCol&&g>=t.calculative.activeCell.row&&g<t.calculative.activeCell.row+(t.calculative.activeCell.rowspan||1)&&(_="#4A5263"),t.rowHeaders&&t.colHeaders&&g==0&&!t.calculative.activeCell.lineRow&&p>=t.calculative.activeCell.col&&p<t.calculative.activeCell.col+(t.calculative.activeCell.colspan||1)&&(_="#4A5263")),t.calculative.mergeCell&&t.calculative.mergeCell.row<=g&&g<t.calculative.mergeCell.row+t.calculative.mergeCell.rowspan&&t.calculative.mergeCell.col<=p&&p<t.calculative.mergeCell.col+t.calculative.mergeCell.colspan&&(_="#4583FF1A",t.calculative.activeCell&&t.calculative.activeCell.row===g&&t.calculative.activeCell.col===p&&(_=void 0,D=void 0));const H=en(t,g,p);if(H.y+H.height<t.calculative.worldRect.y||H.y>t.calculative.worldRect.height+t.calculative.worldRect.y||I)continue;_&&(e.save(),e.beginPath(),e.fillStyle=_,e.fillRect(H.x+i,H.y+i,H.width+.25*t.calculative.canvas.store.data.scale-i*2,H.height-i*2),e.restore()),D&&(e.save(),e.beginPath(),e.strokeStyle=D,e.strokeRect(H.x,H.y,H.width,H.height),e.restore()),t.calculative.worldTextRect=H;let L=t.calculative.texts[g];if(t.calculative.texts[g]||(L=[],t.calculative.texts[g]=L),L[p]==null){if(typeof T=="object")if(t.colHeaders&&g===0)L[p]=T.text;else{const W=x.pens,F=A.pens;if((W==null?void 0:W.length)>0){if(L[p]="",t.isFirstTime){t.maxNum&&t.colHeaders&&g>t.maxNum&&(T.visible=!1);let V=JSON.parse(JSON.stringify(W));if(V.forEach((Y,q)=>{const Q=Y.text;Object.assign(Y,{row:g,col:p},Array.isArray(T)?T[q]:T),Y.text||(Y.text=Q),Y.activeBackground=Y.background,Y.hoverBackground=Y.background,Y.activeColor=Y.color,Y.hoverColor=Y.color,Y.activeTextColor=Y.textColor,Y.hoverTextColor=Y.textColor,Y.height*=t.calculative.canvas.store.data.scale,Y.width*=t.calculative.canvas.store.data.scale,Lc.includes(Y.name)&&(Y.hiddenText=!0)}),Oc(t,H,V),t.calculative.canvas.parent.pushChildren(t,V),t.calculative.childrenArr||(t.calculative.childrenArr={}),t.calculative.childrenArr[`${g}:${p}`]=V,t.pagination&&t.pagination.pageSize>=t.maxNum&&g===t.maxNum-1){T.visible=!1;let Y=JSON.parse(JSON.stringify(W));Y.forEach((Q,K)=>{Object.assign(Q,{row:g+1,col:p},Array.isArray(T)?T[K]:T),Q.activeBackground=Q.background,Q.hoverBackground=Q.background,Q.activeColor=Q.color,Q.hoverColor=Q.color,Q.activeTextColor=Q.textColor,Q.hoverTextColor=Q.textColor,Q.height*=t.calculative.canvas.store.data.scale,Q.width*=t.calculative.canvas.store.data.scale,Lc.includes(Q.name)&&(Q.hiddenText=!0)});const q=en(t,g+1,p);Oc(t,q,Y),t.calculative.canvas.parent.pushChildren(t,Y),t.calculative.childrenArr||(t.calculative.childrenArr={}),t.calculative.childrenArr[`${g+1}:${p}`]=Y}}else if(t.calculative.childrenArr){let V=t.calculative.childrenArr[`${g}:${p}`];V==null||V.forEach((Y,q)=>{Object.assign(Y,Array.isArray(T)?T[q]:T)})}continue}if(F!=null&&F.length){if(L[p]="",t.isFirstTime){let V=JSON.parse(JSON.stringify(F));V.forEach((Y,q)=>{Object.assign(Y,{row:g,col:p},Array.isArray(T)?T[q]:T),Y.activeBackground=Y.background,Y.hoverBackground=Y.background,Y.activeColor=Y.color,Y.hoverColor=Y.color,Y.activeTextColor=Y.textColor,Y.hoverTextColor=Y.textColor,Y.height*=t.calculative.canvas.store.data.scale,Y.width*=t.calculative.canvas.store.data.scale,Lc.includes(Y.name)&&(Y.hiddenText=!0)}),Oc(t,H,V),t.calculative.canvas.parent.pushChildren(t,V),t.calculative.childrenArr||(t.calculative.childrenArr={}),t.calculative.childrenArr[`${g}:${p}`]=V}continue}}else T===void 0?L[p]="":L[p]=T.text||T+"";if(!L[p])continue;L[p]=YV(t,L[p])}if(!L[p])continue;e.save(),e.beginPath(),e.fillStyle=U,e.textAlign="center",e.textBaseline="middle",e.font=(P||t.calculative.fontStyle||"")+" normal "+(S||t.calculative.fontWeight||"")+" "+(k||t.calculative.fontSize||12)*a+"px "+t.calculative.fontFamily;let M=(A==null?void 0:A.textAlign)||(B==null?void 0:B.textAlign)||(w==null?void 0:w.textAlign)||(x==null?void 0:x.textAlign)||t.textAlign;M&&(e.textAlign=M);const j=(A==null?void 0:A.textLeft)||(B==null?void 0:B.textLeft)||(w==null?void 0:w.textLeft)||(x==null?void 0:x.textLeft)||t.textLeft||0;if(L[p].length===1)M==="left"?e.fillText(L[p][0],H.x+j,H.y+H.height/2):M==="right"?e.fillText(L[p][0],H.x+H.width+j,H.y+H.height/2):e.fillText(L[p][0],H.x+H.width/2+j,H.y+H.height/2);else{const F=(k||t.calculative.fontSize)*t.calculative.lineHeight*a,V=L[p].length*F;let Y=(H.height-V)/2;M==="left"?L[p].forEach((q,Q)=>{e.fillText(q,H.x,H.y+Y+(Q+.55)*F)}):M==="right"?L[p].forEach((q,Q)=>{e.fillText(q,H.x+H.width,H.y+Y+(Q+.55)*F)}):L[p].forEach((q,Q)=>{e.fillText(q,H.x+H.width/2,H.y+Y+(Q+.55)*F)})}e.restore()}if(t.calculative.activeRow===g){e.save(),e.beginPath(),e.strokeStyle=t.activeColor,e.fillStyle="#278df833";const p=Cq(t,g);e.rect(p.x,p.y,p.width,p.height),e.stroke(),e.fill(),e.restore();const x=t.calculative.canvas.store.data.scale;e.save(),e.beginPath(),e.fillStyle=t.activeColor,e.strokeStyle="#fff",e.rect(p.x-2.5*x,p.y-2.5*x,5*x,5*x),e.fill(),e.stroke(),e.restore()}}iq(t)}function ph(e){var t;e.interval&&(clearInterval(e.interval),e.interval=null),e.offsetY=0,Ns(e),(t=e.children)!=null&&t.length||(e.isFirstTime=!0),e.offsetY||(e.offsetY=0),e.calculative.startIndex=0,e.calculative.endIndex=e.data.length,nq(e),setTimeout(()=>{var r;e.calculative.active&&!(e.locked||e.calculative.canvas.store.data.locked)&&!((r=e.calculative.singleton)!=null&&r.tableContextMenu)&&(e.calculative.singleton||(e.calculative.singleton={}),e.calculative.singleton.tableContextMenu=new A1(e),fi(e))},100)}function hq(e,t){var o;if(!e.calculative.hoverCell||e.calculative.hoverCell.row===void 0||e.calculative.hoverCell.col===void 0)return;const{value:r,mergeCell:a}=C1(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);if(typeof r=="object"&&e.calculative.hoverCell.row!==0)return;e.calculative.isHover=!1,e.calculative.isInput=!0,e.calculative.canvas.render(),e.calculative.inputCell=e.calculative.hoverCell,a&&(e.calculative.inputCell=rt(a));const i=en(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);if(e.calculative.tempText=r.text||r+"",e.dropdownList=void 0,e.inputType=void 0,e.calculative.hoverCell.row!==0&&(o=e.columns)!=null&&o.length){let n=e.columns[e.calculative.hoverCell.col];typeof n=="object"&&(n.type==="select"?e.dropdownList=n.dropdownList:n.type==="numeric"&&(e.inputType="number"))}e.calculative.canvas.showInput(e,i,"#ffffff")}function dq(e,t){e.calculative.inputCell&&(S1(e,e.calculative.inputCell.row,e.calculative.inputCell.col,t),e.calculative.text=void 0,e.text=void 0,e.calculative.isInput=!1,e.calculative.isHover=!0,e.calculative.canvas.render())}function vq(e,t){var r,a,i,o,n,s,u,c;if(e.calculative.canvas.movingPens&&!e.locked&&e.calculative.draggingPen&&e.calculative.penCell){let l=(r=e.calculative.canvas.store.active)==null?void 0:r[0],f=(a=e.calculative.penCell)==null?void 0:a.col,h=(i=e.calculative.penCell)==null?void 0:i.row;if(e.colHeaders&&((o=e.calculative.penCell)==null?void 0:o.row)===0){if(l){if(e.columns||(e.columns=[]),l.name==="rectangle"&&l.dropdownList)e.columns[f]={text:l.text,type:"select",dropdownList:l.dropdownList};else if(l.name==="text"&&l.inputType==="number")e.columns[f]={text:l.text,type:"numeric"};else{const d=e.calculative.canvas.getPenRect(l),v=rt(l,!1);delete v.anchors,delete v.x,delete v.y,delete v.id,delete v.center,v.width=d.width,v.height=d.height,e.styles||(e.styles=[]);const y=e.styles.findIndex(g=>g.col===f&&g.row===void 0);if(y>-1)(n=e.styles[y])!=null&&n.pens||(e.styles[y].pens=[]),(u=(s=e.styles[y])==null?void 0:s.pens)==null||u.push(v),e.styles[y].width||(e.styles[y].width=e.colWidth),v.height+20>e.rowHeight&&(e.rowHeight=v.height+20*e.calculative.canvas.store.data.scale),e.styles[y].width+=v.width+20*e.calculative.canvas.store.data.scale;else{v.height+20>e.rowHeight&&(e.rowHeight=v.height+20*e.calculative.canvas.store.data.scale);let g=v.width+20*e.calculative.canvas.store.data.scale;e.styles.push({col:f,width:g>e.colWidth?g:void 0,pens:[v]})}e.calculative.canvas.parent.setValue({id:e.id,styles:e.styles},{history:!1,render:!1,doEvent:!1})}e.calculative.canvas.delForce(e.calculative.canvas.store.active[0]),e.calculative.canvas.inactive(),e.calculative.canvas.render()}}else if(l){const d=e.styles&&e.styles.filter(T=>T.row===h&&T.col===f)[0],v=e.calculative.canvas.getPenRect(l),y=rt(l,!1);delete y.anchors,delete y.x,delete y.y,delete y.id,delete y.center,y.width=v.width,y.height=v.height;let g=!1;d&&((c=d.pens)!=null&&c.length)?(d.pens.push(y),g=!0):d?d.pens=[y]:e.styles.push({col:f,row:h,pens:[y]});let m=y.width+20*e.calculative.canvas.store.data.scale,w=y.height+20*e.calculative.canvas.store.data.scale;const p=e.styles&&e.styles.filter(T=>T.row===h&&T.col===void 0)[0],x=e.styles&&e.styles.filter(T=>T.row===void 0&&T.col===f)[0];e.rowHeight&&w<e.rowHeight||(p&&(p.height||0)<w?p.height=w:p||e.styles.push({row:h,height:w})),e.colWidth&&m<e.colWidth||(x&&g&&(x.width+=m),x&&(x.width||0)<m?x.width=m:x||e.styles.push({col:f,width:m})),e.calculative.texts=void 0,e.calculative.canvas.parent.setValue({id:e.id,styles:e.styles},{history:!1,render:!1,doEvent:!1}),e.calculative.canvas.delForce(e.calculative.canvas.store.active[0]),e.calculative.canvas.inactive(),e.calculative.canvas.render()}}}function gq(e,t){var r,a,i,o,n;if(e.calculative.draggingPen=!1,e.calculative.penCell=null,e.calculative.focus&&e.calculative.canvas.movingPens&&((r=e.calculative.canvas.store.active)==null?void 0:r.length)===1&&e.calculative.canvas.store.active[0].id!==e.id){e.calculative.penCell=us(e,t),e.calculative.hover=!0,e.calculative.draggingPen=!0,e.calculative.canvas.render();return}if(e.timer&&(e.calculative.isHover=!1,clearTimeout(e.timer)),e.timer=setTimeout(()=>{e.calculative.isHover=!0,e.calculative.canvas.render()},500),e.calculative.focus&&e.calculative.canvas.externalElements.style.cursor.indexOf("resize")!==-1){let s=e.calculative.canvas.store.data.scale;if(e.calculative.hoverCell.lineCol){let u=t.x-e.calculative.downPos.x,c=e.calculative.hoverCell.lineCol<2?0:e.colPos[e.calculative.hoverCell.lineCol-2];if(((a=e.styles)==null?void 0:a.filter(g=>g.col===e.calculative.hoverCell.lineCol-1).some(g=>g.pens))&&u<0||e.colPos[e.calculative.hoverCell.lineCol-1]+u<c+Gt*2)return;let f=(i=e.styles)==null?void 0:i.filter(g=>g.col>=e.calculative.hoverCell.lineCol).some(g=>g.pens);if(e.colPos[e.calculative.hoverCell.lineCol-1]+u>e.colPos[e.calculative.hoverCell.lineCol]-Gt*2||f){for(let g=e.calculative.hoverCell.lineCol;g<e.colPos.length;g++)e.colPos[g]+=u;e.calculative.worldRect.width+=u,e.calculative.width+=u,Xu(e.calculative.worldRect),g0(e.calculative.worldRect),e.tableWidth+=u,e.calculative.canvas.activeRect=e.calculative.worldRect,aq(e,u)}for(let g=0;g<e.calculative.texts.length;g++)e.calculative.texts[g][e.calculative.hoverCell.lineCol-1]=null,e.calculative.texts[g][e.calculative.hoverCell.lineCol]=null;e.colPos[e.calculative.hoverCell.lineCol-1]+=u;let h=e.styles&&e.styles.filter(g=>g.col===e.calculative.hoverCell.lineCol-1&&g.row===void 0)[0],d=e.styles&&e.styles.filter(g=>g.col===e.calculative.hoverCell.lineCol&&g.row===void 0)[0],v=e.colPos[0],y=e.colPos[e.calculative.hoverCell.lineCol]-e.colPos[e.calculative.hoverCell.lineCol-1];e.calculative.hoverCell.lineCol>1&&(v=e.colPos[e.calculative.hoverCell.lineCol-1]-e.colPos[e.calculative.hoverCell.lineCol-2]),h?h.width=v/s:(e.styles||(e.styles=[]),e.styles.push({col:e.calculative.hoverCell.lineCol-1,width:v/s})),d?d.width=y/s:(e.styles||(e.styles=[]),e.styles.push({col:e.calculative.hoverCell.lineCol,width:y/s})),e.calculative.downPos.x=t.x}if(e.calculative.hoverCell.lineRow){let u=t.y-e.calculative.downPos.y,c=e.calculative.hoverCell.lineRow<2?0:e.rowPos[e.calculative.hoverCell.lineRow-2];if(e.rowPos[e.calculative.hoverCell.lineRow-1]+u<c+Gt*2)return;if(e.rowPos[e.calculative.hoverCell.lineRow-1]+u>e.rowPos[e.calculative.hoverCell.lineRow]-Gt*2){for(let v=e.calculative.hoverCell.lineRow;v<e.rowPos.length;v++)e.rowPos[v]+=u;e.calculative.worldRect.height+=u*s,e.calculative.height+=u*s,e.height+=u*s,Xu(e.calculative.worldRect),g0(e.calculative.worldRect),e.tableHeight+=u*s}e.rowPos[e.calculative.hoverCell.lineRow-1]+=u,e.calculative.downPos.y=t.y;let l=e.styles&&e.styles.filter(v=>v.row===e.calculative.hoverCell.lineRow-1&&v.col===void 0)[0],f=e.styles&&e.styles.filter(v=>v.row===e.calculative.hoverCell.lineRow&&v.col===void 0)[0],h=e.rowPos[0],d=e.rowPos[e.calculative.hoverCell.lineRow]-e.rowPos[e.calculative.hoverCell.lineRow-1];e.calculative.hoverCell.lineRow>1&&(h=e.rowPos[e.calculative.hoverCell.lineRow-1]-e.rowPos[e.calculative.hoverCell.lineRow-2]),l?l.height=h/s:e.styles.push({row:e.calculative.hoverCell.lineRow-1,height:h/s}),f?f.height=d/s:e.styles.push({row:e.calculative.hoverCell.lineRow,height:d/s})}e.calculative.initBackRect=null,e.initWorldRect=null,ph(e),e.calculative.canvas.render();return}if(e.calculative.focus&&e.calculative.canvas.mouseDown){if(e.colHeaders&&((o=e.calculative.activeCell)==null?void 0:o.row)<=0||e.rowHeaders&&((n=e.calculative.activeCell)==null?void 0:n.col)<=0)return;e.rowHeaders&&e.calculative.hoverCell.col===0&&(e.calculative.hoverCell.col=1),e.colHeaders&&e.calculative.hoverCell.row===0&&(e.calculative.hoverCell.row=1),e.calculative.hoverCell=us(e,t),!e.locked&&!e.calculative.canvas.store.data.locked&&e.calculative.activeCell&&(e.calculative.mergeCell=wq(e),fi(e,"merge"),e.calculative.canvas.render());return}e.calculative.hoverCell=us(e,t),e.calculative.focus&&!e.locked&&!e.calculative.canvas.store.data.locked&&(e.calculative.hoverCell.lineCol!==void 0&&(e.calculative.canvas.externalElements.style.cursor="col-resize"),e.calculative.hoverCell.lineRow!==void 0&&(e.calculative.canvas.externalElements.style.cursor="row-resize")),e.calculative.canvas.render()}function yq(e,t){var r,a;e.calculative.penCell=null,Ns(e),(a=(r=e.calculative.singleton)==null?void 0:r.tableScroll)==null||a.hideScroll(),e.calculative.canvas.render()}function pq(e,t){var a,i,o,n,s,u,c;e.calculative.downPos=rt(t);let r=us(e,t);if(!(e.calculative.mergeCell&&Ra(r,e.calculative.mergeCell))){if(e.calculative.activeCell=r,e.colHeaders&&((a=e.calculative.activeCell)==null?void 0:a.row)===0&&(e.calculative.activeCell=void 0),e.rowHeaders&&((i=e.calculative.activeCell)==null?void 0:i.col)===0&&(e.calculative.activeCell=void 0),e.calculative.activeCell&&e.mergeCells){const l=(o=e.mergeCells)==null?void 0:o.filter(f=>f.col<=e.calculative.activeCell.col&&f.row<=e.calculative.activeCell.row&&f.col+f.colspan>e.calculative.activeCell.col&&f.row+f.rowspan>e.calculative.activeCell.row);l.length>0&&(e.calculative.activeCell=rt(l[0]))}if(e.pagination&&(y1(e.calculative.paginationPen,t),e.pageChange=e.calculative.paginationPen.pageChange,e.pagination.current=e.calculative.paginationPen.current,e.pagination.pageSize=e.calculative.paginationPen.pageSize),e.calculative.mergeCell&&e.calculative.activeCell&&!Ra({col:e.calculative.activeCell.col,colspan:1,row:e.calculative.activeCell.row,rowspan:1},e.calculative.mergeCell)&&(e.calculative.mergeCell=void 0),e.calculative.focus&&e.calculative.mergeCell===void 0&&e.calculative.activeCell&&e.calculative.activeCell.allRow===void 0)for(let l=0;l<((n=e.mergeCells)==null?void 0:n.length);l++)Ra({col:e.calculative.activeCell.col,colspan:1,row:e.calculative.activeCell.row,rowspan:1},e.mergeCells[l])&&(e.calculative.mergeCell=rt(e.mergeCells[l]),fi(e,"merge"));e.calculative.activeCol=void 0,e.calculative.activeRow=void 0,e.calculative.focus&&!e.locked&&!e.calculative.canvas.store.data.locked&&((s=e.calculative.singleton)!=null&&s.tableContextMenu,((u=e.calculative.hoverCell)==null?void 0:u.allRow)!==void 0&&(e.calculative.activeRow=e.calculative.hoverCell.allRow,e.calculative.mergeCell=void 0,fi(e,"row")),((c=e.calculative.hoverCell)==null?void 0:c.allCol)!==void 0&&(e.calculative.activeCol=e.calculative.hoverCell.allCol,e.calculative.mergeCell=void 0,fi(e,"col")),e.calculative.mergeCell),e.calculative.activeCell&&fi(e,"cell"),e.calculative.canvas.render()}}function us(e,t){var u,c,l;const r=e.calculative.worldRect.width/e.tableWidth,a=e.calculative.worldRect.height/e.tableHeight,i={row:void 0,col:void 0,lineRow:void 0,lineCol:void 0,allRow:void 0,allCol:void 0};for(let f=0;f<e.colPos.length;f++){let h=f===0?0:e.colPos[f-1]*r;t.x<=e.calculative.worldRect.x+e.colPos[f]*r-Gt&&t.x>=e.calculative.worldRect.x+h+Gt&&(i.col=f),f!==0&&t.x<e.calculative.worldRect.x+h+Gt&&t.x>e.calculative.worldRect.x+h-Gt&&(i.lineCol=f)}let o=e.calculative.startIndex||0,n=e.calculative.endIndex||e.rowPos.length;if(e.colHeaders&&t.y<e.calculative.worldRect.y+e.rowPos[0]*a&&(i.row=0),i.row===void 0){for(let h=o;h<=n;h++){let d=h===0?0:e.rowPos[h-1]*a;t.y<=e.calculative.worldRect.y+e.rowPos[h]*a-e.offsetY*e.calculative.canvas.store.data.scale-Gt&&t.y>=e.calculative.worldRect.y+d-e.offsetY*e.calculative.canvas.store.data.scale+Gt&&(i.row=h),h!==0&&t.y<e.calculative.worldRect.y+d-e.offsetY*e.calculative.canvas.store.data.scale+Gt&&t.y>e.calculative.worldRect.y+d-e.offsetY*e.calculative.canvas.store.data.scale-Gt&&h<e.rowPos.length&&(i.lineRow=h)}let f=10*r;if(e.rowHeaders&&(f=e.colPos[0]*r),t.x<e.calculative.worldRect.x+f){i.allRow=0;for(let h=0;h<e.rowPos.length;h++)t.y>e.calculative.worldRect.y+e.rowPos[h]*a-e.offsetY*e.calculative.canvas.store.data.scale&&(i.allRow=h+1)}}let s=10*a;if(e.colHeaders&&(s=e.rowPos[0]*a),t.y<e.calculative.worldRect.y+s){i.allCol=void 0;for(let f=0;f<e.rowPos.length;f++)t.x>e.calculative.worldRect.x+e.colPos[f]*r&&(i.allCol=f+1);t.x>e.calculative.worldRect.x&&t.x<e.calculative.worldRect.x+e.colPos[0]*r&&(i.allCol=0)}if(i.lineCol!==void 0){let f=[];i.row!==void 0&&(f=(u=e.mergeCells)==null?void 0:u.filter(h=>h.col<i.lineCol&&i.lineCol<h.col+h.colspan&&i.row>=h.row&&i.row<h.row+h.rowspan)),i.lineRow!==void 0&&(f=(c=e.mergeCells)==null?void 0:c.filter(h=>h.col<i.lineCol&&i.lineCol<h.col+h.colspan&&i.lineRow>=h.row&&i.lineRow<h.row+h.rowspan)),f!=null&&f.length&&(i.lineCol=void 0,i.col=f[0].col)}if(e.maxNum&&(i.lineRow!==void 0&&(i.row=i.lineRow),i.lineRow=void 0),e.mergeCells){const f=(l=e.mergeCells)==null?void 0:l.filter(h=>h.col<=i.col&&h.row<=i.row&&h.col+h.colspan>i.col&&h.row+h.rowspan>i.row);f.length>0&&(i.row=f[0].row,i.col=f[0].col)}return i}function C1(e,t,r){var u,c;if(!e.data||!Array.isArray(e.data))return;let a=(u=e.mergeCells)==null?void 0:u.filter(l=>l.row<=t&&l.row+l.rowspan>t&&l.col<=r&&l.col+l.colspan>r),i;a!=null&&a.length&&((t!==a[0].row||r!==a[0].col)&&(i={row:a[0].row,col:a[0].col}),t=a[0].row,r=a[0].col);const o=e.styles&&e.styles.filter(l=>l.row===t&&l.col===r);let n=0;if(e.colHeaders&&t===0)return{value:(c=e.columns)==null?void 0:c[r].text,style:(o==null?void 0:o.length)>0?o.length>1?o:o[0]:{},mergeCell:i};e.colHeaders&&(n=1);const s=e.data[t-n];if(!s)return{value:"",style:{},mergeCell:i};if(Array.isArray(s))return{value:s[r],style:(o==null?void 0:o.length)>0?o.length>1?o:o[0]:{},mergeCell:i};if(!s.data||!Array.isArray(s.data))return}function mq(e,t){if(!e.data||!Array.isArray(e.data))return;const r=e.data[t];if(!r)return{value:[],style:{}};const a=e.styles&&e.styles.filter(i=>i.row===t&&i.col===void 0);if(Array.isArray(r))return{value:r,style:(a==null?void 0:a.length)>0?a[0]:{}};if(!r.data||!Array.isArray(r.data))return}function bq(e,t){if(!e.data||!Array.isArray(e.data))return;const r=e.styles&&e.styles.filter(i=>i.col===t&&i.row===void 0);if(e.columns){let i=e.columns[t];i&&i.fnJs&&!i.fn&&(i.fn=new Function("pen","data","index",i.fnJs))}let a={};return r!=null&&r.length&&(a=r[0]),{style:a}}function wq(e){let t=rt(e.calculative.hoverCell);e.colHeaders&&t.row<=0&&(t.row=1),e.rowHeaders&&t.col<=0&&(t.col=1),t.col==null&&(t.col=t.lineCol||1),t.row==null&&(t.row=t.lineRow),t.lineRow=void 0,t.lineCol=void 0;let r=_1([{...e.calculative.activeCell,rowspan:1,colspan:1},{...t,rowspan:1,colspan:1}]);return e.mergeCells&&(r=k1(e,r)),r}function k1(e,t){var a;let r=(a=e.mergeCells)==null?void 0:a.filter(i=>xq(i,t));return r!=null&&r.length?k1(e,_1([t,...r])):t}function xq(e,t){return!(e.row+e.rowspan<=t.row||e.row>=t.row+t.rowspan||e.col+e.colspan<=t.col||e.col>=t.col+t.colspan||Ra(e,t))}function Ra(e,t){return e.row>=t.row&&e.row+(e.rowspan||1)<=t.row+(t.rowspan||1)&&e.col>=t.col&&e.col+(e.colspan||1)<=t.col+(t.colspan||1)}function _1(e){let t=e[0].col,r=e[0].row,a=e[0].col+e[0].colspan,i=e[0].row+e[0].rowspan;return e.forEach(o=>{t=Math.min(t,o.col),r=Math.min(r,o.row),a=Math.max(a,o.col+o.colspan),i=Math.max(i,o.row+o.rowspan)}),{col:t,row:r,colspan:a-t,rowspan:i-r}}function S1(e,t,r,a){if(!e.data||!Array.isArray(e.data))return;e.isFirstTime=!1,e.calculative.texts=void 0;let i=t;e.colHeaders&&(i=t-1);let o;e.colHeaders&&t===0?o=e.columns:o=e.data[i],o&&(o[r]instanceof Object?o[r].text=a:o[r]=a,e.calculative.canvas.store.emitter.emit("valueUpdate",e))}function en(e,t,r){var f;const a=e.calculative.worldRect.width/e.tableWidth,i=e.calculative.worldRect.height/e.tableHeight,o=(f=e.mergeCells)==null?void 0:f.filter(h=>h.col<=r&&h.row<=t&&h.col+h.colspan>r&&h.row+h.rowspan>t);let n=0,s=0;if(r>-1?s=e.colPos[r]*a:r===-1&&(s=0),r>0&&(n=e.colPos[r-1]*a),o!=null&&o.length){o[0].col<1?n=0:n=e.colPos[o[0].col-1]*a;let h=o[0].col+o[0].colspan-1;h>=e.colPos.length&&(h=e.colPos.length-1),s=e.colPos[h]*a}let u=0,c=e.rowPos[t]*i;if(t>0&&(u=e.rowPos[t-1]*i),o!=null&&o.length){u=e.rowPos[o[0].row-1]*i;let h=o[0].row+o[0].rowspan-1;h>=e.rowPos.length&&(h=e.rowPos.length-1),c=e.rowPos[h]*i}let l=e.offsetY*e.calculative.canvas.store.data.scale;return t===0&&e.colHeaders&&(l=0),{x:e.calculative.worldRect.x+n,y:e.calculative.worldRect.y+u-l,ex:e.calculative.worldRect.x+s,ey:e.calculative.worldRect.y+c-l,width:s-n,height:c-u}}function T1(e,t){const r=e.calculative.worldRect.width/e.tableWidth,a=e.calculative.worldRect.height/e.tableHeight;let i=0,o=e.colPos[t]*r;return t>0&&(i=e.colPos[t-1]*r),{x:e.calculative.worldRect.x+i,y:e.calculative.worldRect.y+e.rowPos[0]*a,ex:e.calculative.worldRect.x+o,ey:e.calculative.worldRect.ey,width:o-i,height:e.calculative.worldRect.height-e.rowPos[0]*a}}function Cq(e,t){const r=e.calculative.worldRect.width/e.tableWidth,a=e.calculative.worldRect.height/e.tableHeight;let i=0,o=e.rowPos[t]*a;t>0&&(i=e.rowPos[t-1]*a);let n=e.offsetY*e.calculative.canvas.store.data.scale;t===0&&e.colHeaders&&(n=0);let s=e.colPos[0]*r;return e.rowHeaders||(s=0),{x:e.calculative.worldRect.x+s,y:e.calculative.worldRect.y+i-n,ex:e.calculative.worldRect.ex,ey:e.calculative.worldRect.y+o-n,width:e.calculative.worldRect.width-s,height:o-i}}function kq(e,t){const r=e.calculative.worldRect.width/e.tableWidth,a=e.calculative.worldRect.height/e.tableHeight;let i=e.colPos[t.col-1]*r;t.col===0&&(i=0);let o=e.colPos[t.col+t.colspan-1]*r,n=e.rowPos[t.row-1]*a,s=e.rowPos[t.row+t.rowspan-1]*a,u=e.offsetY*e.calculative.canvas.store.data.scale;return{x:e.calculative.worldRect.x+i,y:e.calculative.worldRect.y+n-u,ex:e.calculative.worldRect.x+o,ey:e.calculative.worldRect.y+s-u,width:o-i,height:s-n}}function Oc(e,t,r){if(!(r&&r.length))return;const a=e.calculative.worldRect.width/e.tableWidth,i=e.calculative.worldRect.height/e.tableHeight;let o=1,n=1;e.initWorldRect&&(e.calculative.worldRect.width!==e.initWorldRect.width&&(o=e.calculative.worldRect.width/e.initWorldRect.width),e.calculative.worldRect.height!==e.initWorldRect.height&&(n=e.calculative.worldRect.height/e.initWorldRect.height));let s=0,u=0,c=0;const l=e.calculative.canvas.store.data.scale;if(r.length>1){for(const f of r)u+f.width*a+20*l*a<t.width?(f.x=t.x+u+10*l*a,f.y=t.y+c+10*l*i,u+=(f.width+10*l)*a,s=Math.max(s,c+(f.height+10*l)*i)):(u=0,c=s,f.x=t.x+u+10*l*a,f.y=t.y+c+10*l*i,s+=(f.height+10*l)*i);if(s+20*l*i<t.height){const f=(t.height-s-10*l*i)/2;for(const h of r)h.y+=f}}else r[0].x=t.x+(t.width-r[0].width)/2,r[0].y=t.y+(t.height-r[0].height)/2;r.forEach(f=>{f.width=f.width*o,f.height=f.height*n})}function fs(e){if(e.calculative.isUpdateData){delete e.calculative.isUpdateData;let t=rt(e.children);e.children=[],ph(e),t&&t.forEach(r=>{e.calculative.canvas.delForce(e.calculative.canvas.findOne(r))}),e.calculative.texts=void 0}}function _q(e,t){var a,i,o;if(t.visible!==void 0&&(t.visible||(i=(a=e.calculative.singleton)==null?void 0:a.tableContextMenu)==null||i.hide()),(t.width||t.height)&&yh(x1,1e3,e),e.calculative.isUpdateData=!1,t.swiper!==void 0&&(e.swiper?Ns(e):Fs(e)),t.visible!==void 0&&(t.visible&&e.swiper?Ns(e):Fs(e)),t.styles&&(e.initWorldRect=void 0),t.table||t.col==null&&t.row==null){if(t.dataY){const n=e.replaceMode;let s=[];return n?n===Vu.Replace?(s=e.data,t.dataX&&t.dataX.forEach((u,c)=>{s[u]=t.dataY[c]})):n===Vu.ReplaceAll&&(t.dataX?s[0]=t.dataX:s[0]=e.data[0],s=s.concat(t.dataY)):s=e.data.concat(t.dataY),delete t.dataX,delete t.dataY,e.calculative.isUpdateData=!0,Object.assign(t,{data:s})}(t.data||t.styles||t.maxNum)&&(e.pagination?(e.calculative.texts=[],(e.pagination.pageSize!==e.data.length-1||e.pagination.pageSize!==((o=t.data)==null?void 0:o.length))&&(e.calculative.isUpdateData=!0,e.initWorldRect=null)):e.maxNum?(e.calculative.isUpdateData=!0,e.initWorldRect=null):e.calculative.isUpdateData=!0,t.data&&(t.data.length!==e.data.length||t.data[0].length!==e.data[0].length)&&(e.calculative.initBackRect=void 0)),(t.rowHeight||t.colWidth)&&(e.calculative.isUpdateData=!0,e.initWorldRect=null);for(let n of Object.keys(t))n.includes("data.")&&(e.calculative.texts=void 0);return t}let r=e.data[t.row];return r&&(r[t.col]instanceof Object||(r[t.col]=t.value),S1(e,t.row,t.col,t.value),e.calculative.canvas.render(),delete t.col,delete t.row),t}function Sq(e,t){var a,i;if(!e.locked&&!e.calculative.canvas.store.data.locked||!e.maxNum)return;let r=0;t.deltaY>0?r=4:r=-4,Bs(e,r),(i=(a=e.calculative.singleton)==null?void 0:a.tableScroll)==null||i.updataScrollHTop()}function Bs(e,t){var r;e.calculative.startIndex=0,e.calculative.endIndex=e.data.length,e.offsetY||(e.offsetY=0),e.offsetY+=t,e.calculative.worldRect.height/e.initWorldRect.height,e.offsetY>e.calculative.maxOffsetY&&(e.offsetY=e.calculative.maxOffsetY),e.offsetY<0&&(e.offsetY=0),(r=e.children)==null||r.forEach(a=>{const i=e.calculative.canvas.store.pens[a];Tq(e,i)}),e.calculative.canvas.render()}function Tq(e,t){var s,u,c,l,f,h,d,v,y,g,m,w;if(!t)return;t.oldY||(t.oldY=t.y,t.initY=t.y,t.initRow=t.row),t.calculative.worldRect;const{y:r,height:a}=e.calculative.worldRect,i=e.calculative.canvas.store.data.scale;e.calculative.worldRect.height/e.tableHeight;const o=e.rowHeight;t.y=t.oldY-e.offsetY*i/e.calculative.worldRect.height;let n=o*(e.initScale||1)/e.tableHeight*e.maxNum;if(e.calculative.canvas.updatePenRect(t),e.pagination)if(t.y<e.rowPos[0]/e.tableHeight){if(t.calculative.visible=!1,t.visible=!1,t.y<e.rowPos[0]/e.tableHeight/4){t.oldY+=n;let p=t.row+e.maxNum-1;if(!e.data[p])return;let x=rt(e.data[p][t.col]);if(typeof x=="string")if((s=e.columns)!=null&&s.length&&((u=e.columns[t.col])!=null&&u.fn)){let T=e.columns[t.col].fn(e,x);T||(T={text:x}),x=T}else x={text:x};x.background&&(x.activeBackground=x.background,x.hoverBackground=x.background),x.color&&(x.hoverColor=x.color,x.activeColor=x.color),x.textColor&&(x.activeTextColor=x.textColor,x.hoverTextColor=x.textColor),Object.assign(t,x,{row:p}),Object.assign(t.calculative,x,{row:p})}}else if(t.y>(a-200*i)/a){if(t.calculative.visible=!1,t.visible=!1,t.y>(a-200*i)/a+o*i/a/2){t.oldY-=n;let p=t.row-e.maxNum;if(!e.data[p])return;let x=rt(e.data[p][t.col]);if(typeof x=="string")if((c=e.columns)!=null&&c.length&&((l=e.columns[t.col])!=null&&l.fn)){let T=e.columns[t.col].fn(e,x);T||(T={text:x}),x=T}else x={text:x};x.background&&(x.activeBackground=x.background,x.hoverBackground=x.background),x.color&&(x.hoverColor=x.color,x.activeColor=x.color),x.textColor&&(x.activeTextColor=x.textColor,x.hoverTextColor=x.textColor),Object.assign(t,x,{row:p}),Object.assign(t.calculative,x,{row:p})}}else t.visible=!0,t.calculative.visible=!0;else if(n=o*(e.initScale||1)/e.tableHeight*(e.maxNum+1),e.colHeaders)if(t.y<e.rowPos[0]/e.tableHeight){if(t.calculative.visible=!1,t.visible=!1,t.y<-o*i/a/2){t.oldY+=n;let p=t.row+(e.maxNum+1);if(!e.data[p-1])return;let x=rt(e.data[p-1][t.col]);if(typeof x=="string")if((f=e.columns)!=null&&f.length&&((h=e.columns[t.col])!=null&&h.fn)){let T=e.columns[t.col].fn(e,x);T||(T={text:x}),x=T}else x={text:x};x.background&&(x.activeBackground=x.background,x.hoverBackground=x.background),x.color&&(x.hoverColor=x.color,x.activeColor=x.color),x.textColor&&(x.activeTextColor=x.textColor,x.hoverTextColor=x.textColor),Object.assign(t,x,{row:p}),Object.assign(t.calculative,x,{row:p})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y>1+o*i/a){t.oldY-=n;let p=t.row-(e.maxNum+1);if(!e.data[p-1])return;let x=rt(e.data[p-1][t.col]);if(typeof x=="string")if((d=e.columns)!=null&&d.length&&((v=e.columns[t.col])!=null&&v.fn)){let T=e.columns[t.col].fn(e,x);T||(T={text:x}),x=T}else x={text:x};x.background&&(x.activeBackground=x.background,x.hoverBackground=x.background),x.color&&(x.hoverColor=x.color,x.activeColor=x.color),x.textColor&&(x.activeTextColor=x.textColor,x.hoverTextColor=x.textColor),Object.assign(t,x,{row:p}),Object.assign(t.calculative,x,{row:p})}}else t.visible=!0,t.calculative.visible=!0;else if(t.y<0){if(t.calculative.visible=!1,t.visible=!1,t.y<-o/e.tableHeight){t.oldY+=n;let p=t.row+e.maxNum+1;if(!e.data[p])return;let x=rt(e.data[p][t.col]);if(typeof x=="string")if((y=e.columns)!=null&&y.length&&((g=e.columns[t.col])!=null&&g.fn)){let T=e.columns[t.col].fn(e,x);T||(T={text:x}),x=T}else x={text:x};x.background&&(x.activeBackground=x.background,x.hoverBackground=x.background),x.color&&(x.hoverColor=x.color,x.activeColor=x.color),x.textColor&&(x.activeTextColor=x.textColor,x.hoverTextColor=x.textColor),Object.assign(t,x,{row:p}),Object.assign(t.calculative,x,{row:p})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y>1+o*i/a){t.oldY-=n;let p=t.row-e.maxNum-1;if(!e.data[p])return;let x=rt(e.data[p][t.col]);if(typeof x=="string")if((m=e.columns)!=null&&m.length&&((w=e.columns[t.col])!=null&&w.fn)){let T=e.columns[t.col].fn(e,x);T||(T={text:x}),x=T}else x={text:x};x.background&&(x.activeBackground=x.background,x.hoverBackground=x.background),x.color&&(x.hoverColor=x.color,x.activeColor=x.color),x.textColor&&(x.activeTextColor=x.textColor,x.hoverTextColor=x.textColor),Object.assign(t,x,{row:p}),Object.assign(t.calculative,x,{row:p})}}else t.calculative.visible=!0,t.visible=!0;t.bkType&&(t.calculative.gradient=null),t.strokeType&&(t.calculative.lineGradient=null)}function Aq(e){var t,r,a,i;Fs(e),(r=(t=e.calculative.singleton)==null?void 0:t.tableScroll)==null||r.destroy(),(i=(a=e.calculative.singleton)==null?void 0:a.tableContextMenu)==null||i.destroy()}function Fs(e){e.interval&&(globalThis.clearInterval(e.interval),e.interval=null)}function Ns(e){if(e.maxNum&&e.swiper){if(e.interval)return;e.interval=globalThis.setInterval(()=>{e.offsetY>=e.calculative.maxOffsetY?setTimeout(()=>{e.offsetY=0,Eq(e)},1e3):e.offsetY%e.rowHeight?Bs(e,1):(e.calculative.stap||(e.calculative.stap=0),e.calculative.stap+=1,e.calculative.stap==12&&(e.calculative.stap=0,Bs(e,1)))},50)}}function Eq(e){var t;(t=e.children)==null||t.forEach(r=>{var s,u;const a=e.rowHeight,i=e.calculative.canvas.store.pens[r];if(!i)return;a*(e.initScale||1)/e.tableHeight*e.maxNum,i.oldY=i.initY;let o=i.initRow;if(!e.data[o])return;e.colHeaders&&(i.row=i.initRow);let n=rt(e.data[e.colHeaders?o-1:o][i.col]);if(typeof n=="string")if((s=e.columns)!=null&&s.length&&((u=e.columns[i.col])!=null&&u.fn)){let c=e.columns[i.col].fn(e,n);c||(c={text:n}),n=c}else n={text:n};n.background&&(n.activeBackground=n.background,n.hoverBackground=n.background),n.color&&(n.hoverColor=n.color,n.activeColor=n.color),n.textColor&&(n.activeTextColor=n.textColor,n.hoverTextColor=n.textColor),i.calculative.visible=!0,i.visible=!0,o>e.maxNum&&(i.calculative.visible=!1,i.visible=!1),!e.colHeaders&&o===e.maxNum&&(i.calculative.visible=!1,i.visible=!1),Object.assign(i,n,{row:o}),Object.assign(i.calculative,n,{row:o})})}function Pq(e){e.calculative.singleton||(e.calculative.singleton={}),!(e.locked||e.calculative.canvas.store.data.locked)&&!e.calculative.singleton.tableContextMenu&&(e.calculative.singleton.tableContextMenu=new A1(e)),Fs(e),e.maxNum&&(e.locked||e.calculative.canvas.store.data.locked)&&(e.calculative.singleton||(e.calculative.singleton={}),e.calculative.singleton.tableScroll||(e.calculative.singleton.tableScroll=new Oq(e)),e.data.length>e.maxNum&&e.calculative.singleton.tableScroll.showScroll())}function Rq(e){var t,r;(r=(t=e.calculative.singleton)==null?void 0:t.tableScroll)==null||r.updataScroll(),fi(e),yh(x1,1e3,e)}function Iq(e){e.calculative.initBackRect=null}function Mq(e){var t,r;(r=(t=e.calculative.singleton)==null?void 0:t.tableScroll)==null||r.updataScroll(),fi(e)}let p0=0;const fi=(e,t)=>{var a,i,o,n;if(e.calculative.canvas.store.data.locked){(i=(a=e.calculative.singleton)==null?void 0:a.tableContextMenu)==null||i.hide();return}if(!e.calculative.inView||!e.calculative.active)return;const r=Date.now();r-p0>=200&&(p0=r,(n=(o=e.calculative.singleton)==null?void 0:o.tableContextMenu)==null||n.updateMenu(t))},Lq={col:[{name:"左插入列",key:"insertColLeft",disabled:!1,svg:'<svg t="1722938253297" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7517" width="16" height="16"><path d="M951.68 472.64h-157.28v524.32h-52.32V420.32h262.08v576.64h-52.48zM375.04 551.36V27.04h262.08v524.32H375.04z m209.76-52.48V79.52h-157.28v419.36h157.28zM592.64 837.12l-86.56 86.56-86.56-86.56c-10.56-10.56-26.24-10.56-36.64 0-10.56 10.4-10.56 26.24 0 36.64l123.2 123.2 123.2-123.2c10.56-10.56 10.56-26.24 0-36.64-10.4-10.56-26.24-10.56-36.64 0z" p-id="7518"></path><path d="M480.3872 944.7712v-274.08h52.48v274.08z" p-id="7519"></path></svg>'},{name:"右插入列",key:"insertColRight",disabled:!1,svg:'<svg t="1722938279463" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8532" width="16" height="16"><path d="M217.76 472.64H60.48v524.32H8V420.32h262.24v576.64h-52.48zM375.04 551.36V27.04h262.08v524.32H375.04z m209.76-52.48V79.52h-157.28v419.36h157.28zM592.64 837.12l-86.56 86.56-86.56-86.56c-10.56-10.56-26.24-10.56-36.64 0-10.56 10.4-10.56 26.24 0 36.64l123.2 123.2 123.2-123.2c10.56-10.56 10.56-26.24 0-36.64-10.4-10.56-26.24-10.56-36.64 0z" p-id="8533"></path><path d="M480.3872 944.7712v-274.08h52.48v274.08z" p-id="8534"></path></svg>'},{name:"删除列",key:"deleteCol",svg:'<svg t="1722938310471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9560" width="16" height="16"><path d="M540.672 788.48l67.584-67.584c8.192-8.192 8.192-20.48 0-28.672-8.192-8.192-20.48-8.192-28.672 0l-67.584 67.584-67.584-67.584c-8.192-8.192-20.48-8.192-28.672 0-8.192 8.192-8.192 20.48 0 28.672l67.584 67.584-67.584 67.584c-8.192 8.192-8.192 20.48 0 28.672 8.192 8.192 20.48 8.192 28.672 0l67.584-67.584 67.584 67.584c8.192 8.192 20.48 8.192 28.672 0 8.192-8.192 8.192-20.48 0-28.672l-67.584-67.584z m-253.952-307.2h-122.88v409.6h-40.96v-450.56h204.8v450.56h-40.96v-409.6z m573.44 0h-122.88v409.6h-40.96v-450.56h204.8v450.56h-40.96v-409.6z m-450.56 61.44v-409.6h204.8v409.6h-204.8z m163.84-40.96v-327.68h-122.88v327.68h122.88z" p-id="9561"></path></svg>'},{name:"清空列",key:"clearCol",svg:'<svg  class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24291" width="16" height="16"><path d="M886.401 395.097h-251.7V80.614c0-22.091-19.899-40-44.447-40H439.148c-24.547 0-44.447 17.909-44.447 40v314.483h-251.7c-22.315 0-40.404 17.909-40.404 40v506.471c0 22.091 18.09 40 40.404 40h743.4c22.315 0 40.404-17.909 40.404-40V435.097c0.001-22.092-18.089-40-40.404-40z m-10.72 536.47h-127.98V831c0-17.673-12.088-32-27-32s-27 14.327-27 32v100.567h-152V792c0-14.912-12.088-27-27-27s-27 12.088-27 27v139.567h-152V831c0-17.673-12.088-32-27-32s-27 14.327-27 32v100.567H152.597V688.332h723.084v243.235z m0-293.235H152.597V445.097h291.882V90.614h137.819v354.483H875.68v193.235z" ></path></svg>'}],row:[{name:"上插入行",key:"insertRowAbove",disabled:!1,svg:'<svg t="1722938153683" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2494" width="16" height="16"><path d="M545.44 957.6v-157.28H21.12v-52.32h576.8v262.08H21.12v-52.48zM466.72 380.96h524.32v262.08H466.72V380.96z m52.48 209.76h419.36v-157.28H519.2v157.28zM181.12 598.56L94.56 512l86.56-86.56c10.56-10.56 10.56-26.24 0-36.64-10.56-10.56-26.24-10.56-36.64 0l-123.2 123.2 123.2 123.2c10.56 10.56 26.24 10.56 36.64 0 10.4-10.4 10.4-26.24 0-36.64z" p-id="2495"></path><path d="M73.44 486.24h274.08v52.48H73.44z" p-id="2496"></path></svg>'},{name:"下插入行",key:"insertRowBelow",disabled:!1,svg:'<svg t="1722938183507" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3506" width="16" height="16"><path d="M545.44 223.68V66.4H21.12V13.92h576.8v262.08H21.12v-52.32zM466.72 380.96h524.32v262.08H466.72V380.96z m52.48 209.76h419.36v-157.28H519.2v157.28zM181.12 598.56L94.56 512l86.56-86.56c10.56-10.56 10.56-26.24 0-36.64-10.56-10.56-26.24-10.56-36.64 0l-123.2 123.2 123.2 123.2c10.56 10.56 26.24 10.56 36.64 0 10.4-10.4 10.4-26.24 0-36.64z" p-id="3507"></path><path d="M73.44 486.24h274.08v52.48H73.44z" p-id="3508"></path></svg>'},{name:"删除行",key:"deleteRow",svg:'<svg t="1722938437719" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15165" width="16" height="16"><path d="M235.52 540.672l67.584 67.584c8.192 8.192 20.48 8.192 28.672 0 8.192-8.192 8.192-20.48 0-28.672l-67.584-67.584 67.584-67.584c8.192-8.192 8.192-20.48 0-28.672-8.192-8.192-20.48-8.192-28.672 0l-67.584 67.584-67.584-67.584c-8.192-8.192-20.48-8.192-28.672 0-8.192 8.192-8.192 20.48 0 28.672l67.584 67.584-67.584 67.584c-8.192 8.192-8.192 20.48 0 28.672 8.192 8.192 20.48 8.192 28.672 0l67.584-67.584z m307.2-253.952v-122.88h-409.6v-40.96h450.56v204.8h-450.56v-40.96h409.6z m0 573.44v-122.88h-409.6v-40.96h450.56v204.8h-450.56v-40.96h409.6z m-61.44-450.56h409.6v204.8h-409.6v-204.8z m40.96 163.84h327.68v-122.88h-327.68v122.88z" ></path></svg>'},{name:"清空行",key:"clearRow",svg:'<svg  class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24291" width="16" height="16"><path d="M886.401 395.097h-251.7V80.614c0-22.091-19.899-40-44.447-40H439.148c-24.547 0-44.447 17.909-44.447 40v314.483h-251.7c-22.315 0-40.404 17.909-40.404 40v506.471c0 22.091 18.09 40 40.404 40h743.4c22.315 0 40.404-17.909 40.404-40V435.097c0.001-22.092-18.089-40-40.404-40z m-10.72 536.47h-127.98V831c0-17.673-12.088-32-27-32s-27 14.327-27 32v100.567h-152V792c0-14.912-12.088-27-27-27s-27 12.088-27 27v139.567h-152V831c0-17.673-12.088-32-27-32s-27 14.327-27 32v100.567H152.597V688.332h723.084v243.235z m0-293.235H152.597V445.097h291.882V90.614h137.819v354.483H875.68v193.235z" ></path></svg>'}],merge:[{name:"取消合并",key:"cancelMerge",svg:'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2342" width="16" height="16"><path d="M882.688 522.24h-196.608v-40.96h196.608l-47.104-47.104c-8.192-8.192-8.192-20.48 0-28.672 8.192-8.192 20.48-8.192 28.672 0l96.256 96.256-96.256 96.256c-8.192 8.192-20.48 8.192-28.672 0-8.192-8.192-8.192-20.48 0-28.672l47.104-47.104z m-741.376-40.96h196.608v40.96h-196.608l47.104 47.104c8.192 8.192 8.192 20.48 0 28.672-8.192 8.192-20.48 8.192-28.672 0l-96.256-96.256 96.256-96.256c8.192-8.192 20.48-8.192 28.672 0 8.192 8.192 8.192 20.48 0 28.672l-47.104 47.104z m718.848 286.72h40.96v61.44c0 34.816-26.624 61.44-61.44 61.44h-225.28c-34.816 0-61.44-26.624-61.44-61.44v-634.88c0-34.816 26.624-61.44 61.44-61.44h225.28c34.816 0 61.44 26.624 61.44 61.44v61.44h-40.96v-61.44c0-10.24-8.192-20.48-20.48-20.48h-225.28c-10.24 0-20.48 8.192-20.48 20.48v634.88c0 12.288 8.192 20.48 20.48 20.48h225.28c10.24 0 20.48-8.192 20.48-20.48v-61.44z m-737.28 0h40.96v61.44c0 12.288 8.192 20.48 20.48 20.48h225.28c10.24 0 20.48-10.24 20.48-20.48v-634.88c0-12.288-8.192-20.48-20.48-20.48h-225.28c-10.24 0-20.48 10.24-20.48 20.48v63.488h-40.96V194.56c0-34.816 26.624-61.44 61.44-61.44h225.28c34.816 0 61.44 26.624 61.44 61.44v634.88c0 34.816-26.624 61.44-61.44 61.44h-225.28c-34.816 0-61.44-26.624-61.44-61.44v-61.44z"></path></svg>'},{name:"合并",key:"mergeCell",svg:'<svg  class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2194" width="16" height="16"><path d="M401.408 522.24h-196.608v-40.96h196.608l-47.104-47.104c-8.192-8.192-8.192-20.48 0-28.672 8.192-8.192 20.48-8.192 28.672 0l96.256 96.256-96.256 96.256c-8.192 8.192-20.48 8.192-28.672 0-8.192-8.192-8.192-20.48 0-28.672l47.104-47.104z m221.184-40.96h196.608v40.96h-196.608l47.104 47.104c8.192 8.192 8.192 20.48 0 28.672-8.192 8.192-20.48 8.192-28.672 0l-96.256-96.256 96.256-96.256c8.192-8.192 20.48-8.192 28.672 0 8.192 8.192 8.192 20.48 0 28.672l-47.104 47.104z m-202.752 286.72h40.96v61.44c0 34.816-26.624 61.44-61.44 61.44h-225.28c-34.816 0-61.44-26.624-61.44-61.44v-634.88c0-34.816 26.624-61.44 61.44-61.44h225.28c34.816 0 61.44 26.624 61.44 61.44v61.44h-40.96v-61.44c0-10.24-8.192-20.48-20.48-20.48h-225.28c-10.24 0-20.48 8.192-20.48 20.48v634.88c0 12.288 8.192 20.48 20.48 20.48h225.28c10.24 0 20.48-8.192 20.48-20.48v-61.44z m143.36 0h40.96v61.44c0 12.288 8.192 20.48 20.48 20.48h225.28c10.24 0 20.48-10.24 20.48-20.48v-634.88c0-12.288-8.192-20.48-20.48-20.48h-225.28c-10.24 0-20.48 10.24-20.48 20.48v63.488h-40.96V194.56c0-34.816 26.624-61.44 61.44-61.44h225.28c34.816 0 61.44 26.624 61.44 61.44v634.88c0 34.816-26.624 61.44-61.44 61.44h-225.28c-34.816 0-61.44-26.624-61.44-61.44v-61.44z"></path></svg>'},{name:"清空单元格",key:"clearCells",svg:'<svg  class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24291" width="16" height="16"><path d="M886.401 395.097h-251.7V80.614c0-22.091-19.899-40-44.447-40H439.148c-24.547 0-44.447 17.909-44.447 40v314.483h-251.7c-22.315 0-40.404 17.909-40.404 40v506.471c0 22.091 18.09 40 40.404 40h743.4c22.315 0 40.404-17.909 40.404-40V435.097c0.001-22.092-18.089-40-40.404-40z m-10.72 536.47h-127.98V831c0-17.673-12.088-32-27-32s-27 14.327-27 32v100.567h-152V792c0-14.912-12.088-27-27-27s-27 12.088-27 27v139.567h-152V831c0-17.673-12.088-32-27-32s-27 14.327-27 32v100.567H152.597V688.332h723.084v243.235z m0-293.235H152.597V445.097h291.882V90.614h137.819v354.483H875.68v193.235z" ></path></svg>'}],cell:[{name:"上插入行",key:"insertRowAbove",disabled:!1,svg:'<svg t="1722938153683" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2494" width="16" height="16"><path d="M545.44 957.6v-157.28H21.12v-52.32h576.8v262.08H21.12v-52.48zM466.72 380.96h524.32v262.08H466.72V380.96z m52.48 209.76h419.36v-157.28H519.2v157.28zM181.12 598.56L94.56 512l86.56-86.56c10.56-10.56 10.56-26.24 0-36.64-10.56-10.56-26.24-10.56-36.64 0l-123.2 123.2 123.2 123.2c10.56 10.56 26.24 10.56 36.64 0 10.4-10.4 10.4-26.24 0-36.64z" p-id="2495"></path><path d="M73.44 486.24h274.08v52.48H73.44z" p-id="2496"></path></svg>'},{name:"下插入行",key:"insertRowBelow",disabled:!1,svg:'<svg t="1722938183507" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3506" width="16" height="16"><path d="M545.44 223.68V66.4H21.12V13.92h576.8v262.08H21.12v-52.32zM466.72 380.96h524.32v262.08H466.72V380.96z m52.48 209.76h419.36v-157.28H519.2v157.28zM181.12 598.56L94.56 512l86.56-86.56c10.56-10.56 10.56-26.24 0-36.64-10.56-10.56-26.24-10.56-36.64 0l-123.2 123.2 123.2 123.2c10.56 10.56 26.24 10.56 36.64 0 10.4-10.4 10.4-26.24 0-36.64z" p-id="3507"></path><path d="M73.44 486.24h274.08v52.48H73.44z" p-id="3508"></path></svg>'},{name:"左插入列",key:"insertColLeft",disabled:!1,svg:'<svg t="1722938253297" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7517" width="16" height="16"><path d="M951.68 472.64h-157.28v524.32h-52.32V420.32h262.08v576.64h-52.48zM375.04 551.36V27.04h262.08v524.32H375.04z m209.76-52.48V79.52h-157.28v419.36h157.28zM592.64 837.12l-86.56 86.56-86.56-86.56c-10.56-10.56-26.24-10.56-36.64 0-10.56 10.4-10.56 26.24 0 36.64l123.2 123.2 123.2-123.2c10.56-10.56 10.56-26.24 0-36.64-10.4-10.56-26.24-10.56-36.64 0z" p-id="7518"></path><path d="M480.3872 944.7712v-274.08h52.48v274.08z" p-id="7519"></path></svg>'},{name:"右插入列",key:"insertColRight",disabled:!1,svg:'<svg t="1722938279463" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8532" width="16" height="16"><path d="M217.76 472.64H60.48v524.32H8V420.32h262.24v576.64h-52.48zM375.04 551.36V27.04h262.08v524.32H375.04z m209.76-52.48V79.52h-157.28v419.36h157.28zM592.64 837.12l-86.56 86.56-86.56-86.56c-10.56-10.56-26.24-10.56-36.64 0-10.56 10.4-10.56 26.24 0 36.64l123.2 123.2 123.2-123.2c10.56-10.56 10.56-26.24 0-36.64-10.4-10.56-26.24-10.56-36.64 0z" p-id="8533"></path><path d="M480.3872 944.7712v-274.08h52.48v274.08z" p-id="8534"></path></svg>'},{name:"清空单元格",key:"clearCells",svg:'<svg  class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24291" width="16" height="16"><path d="M886.401 395.097h-251.7V80.614c0-22.091-19.899-40-44.447-40H439.148c-24.547 0-44.447 17.909-44.447 40v314.483h-251.7c-22.315 0-40.404 17.909-40.404 40v506.471c0 22.091 18.09 40 40.404 40h743.4c22.315 0 40.404-17.909 40.404-40V435.097c0.001-22.092-18.089-40-40.404-40z m-10.72 536.47h-127.98V831c0-17.673-12.088-32-27-32s-27 14.327-27 32v100.567h-152V792c0-14.912-12.088-27-27-27s-27 12.088-27 27v139.567h-152V831c0-17.673-12.088-32-27-32s-27 14.327-27 32v100.567H152.597V688.332h723.084v243.235z m0-293.235H152.597V445.097h291.882V90.614h137.819v354.483H875.68v193.235z" ></path></svg>'}]};class A1{constructor(t){Pe(this,"options");Pe(this,"pen");Pe(this,"menu");Pe(this,"ul");Pe(this,"key");Pe(this,"hand");Pe(this,"down");Pe(this,"popup");Pe(this,"box");Pe(this,"onMouseMove",t=>{if(this.down){let r=t.clientX-this.down.x,a=t.clientY-this.down.y;this.menu.style.left=parseFloat(this.menu.style.left)+r+"px",this.menu.style.top=parseFloat(this.menu.style.top)+a+"px",this.down.x=t.clientX,this.down.y=t.clientY,this.hand.style.cursor="grabbing"}});Pe(this,"onMouseUp",t=>{this.down=void 0,this.hand.style.cursor="grab"});Pe(this,"insertColLeft",(t=this.pen.calculative.activeCell.col)=>{var a,i,o;this.pen.data.forEach(n=>{n.splice(t,0,"")});let r=this.pen.colWidth;t!==0&&(r=this.pen.colPos[t-1]+this.pen.colWidth),this.pen.colPos.splice(t,0,r);for(let n=t+1;n<this.pen.colPos.length;n++)this.pen.colPos[n]+=this.pen.colWidth;this.pen.tableWidth+=this.pen.colWidth,this.pen.calculative.worldRect.width+=this.pen.colWidth,this.pen.calculative.worldRect.center.x+=this.pen.colWidth/2,this.pen.calculative.worldRect.ex+=this.pen.colWidth,this.pen.initWorldRect.width+=this.pen.colWidth,(a=this.pen.styles)==null||a.forEach(n=>{n.col>=t&&(n.col+=1)}),this.pen.calculative.activeCol+=1,(i=this.pen.mergeCells)!=null&&i.length&&((o=this.pen.mergeCells)==null||o.forEach(n=>{n.col<t&&t<n.col+n.colspan&&(n.colspan+=1),n.col>=t&&(n.col+=1)})),this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()});Pe(this,"insertColRight",(t=this.pen.calculative.activeCell.col)=>{var r,a,i;this.pen.data.forEach(o=>{o.splice(t+1,0,"")}),this.pen.colPos.splice(t+1,0,this.pen.colPos[t]+this.pen.colWidth);for(let o=t+2;o<this.pen.colPos.length;o++)this.pen.colPos[o]+=this.pen.colWidth;this.pen.tableWidth+=this.pen.colWidth,this.pen.calculative.worldRect.width+=this.pen.colWidth,this.pen.calculative.worldRect.center.x+=this.pen.colWidth/2,this.pen.calculative.worldRect.ex+=this.pen.colWidth,this.pen.initWorldRect.width+=this.pen.colWidth,(r=this.pen.styles)==null||r.forEach(o=>{o.col>=t&&(o.col+=1)}),(a=this.pen.mergeCells)!=null&&a.length&&((i=this.pen.mergeCells)==null||i.forEach(o=>{o.col<t+1&&t+1<o.col+o.colspan&&(o.colspan+=1),o.col>=t+1&&(o.col+=1)})),this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()});Pe(this,"deleteCol",t=>{var a,i,o;this.pen.data.forEach(n=>{n.splice(t,1)});let r=this.pen.colPos[t]-this.pen.colPos[t-1];t===0&&(r=this.pen.colPos[t]),this.pen.colPos.splice(t,1);for(let n=t;n<this.pen.colPos.length;n++)this.pen.colPos[n]-=r;if(this.pen.tableWidth-=r,this.pen.calculative.worldRect.width-=r,this.pen.calculative.worldRect.center.x-=r/2,this.pen.calculative.worldRect.ex-=r,this.pen.initWorldRect.width-=r,(a=this.pen.styles)==null||a.forEach(n=>{n.col>=t&&(n.col-=1)}),(i=this.pen.mergeCells)!=null&&i.length)for(let n=0;n<((o=this.pen.mergeCells)==null?void 0:o.length);n++){const s=this.pen.mergeCells[n];s.col<=t&&t<s.col+s.colspan&&(s.colspan-=1),s.col>t&&(s.col-=1),(s.colspan<1||s.colspan===1&&s.rowspan===1)&&(this.pen.mergeCells.splice(n,1),n--)}this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()});Pe(this,"clearCol",t=>{this.pen.data.forEach(r=>{r[t]=""}),this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()});Pe(this,"insertRowAbove",(t=this.pen.calculative.activeCell.row)=>{var a;let r=[];for(let i=0;i<this.pen.colPos.length;i++)r.push("");this.pen.data.splice(t,0,r),this.pen.rowPos.splice(t,0,this.pen.rowPos[t-1]+this.pen.rowHeight);for(let i=t+1;i<this.pen.rowPos.length;i++)this.pen.rowPos[i]+=this.pen.rowHeight;this.pen.maxNum?this.pen.calculative.maxOffsetY+=this.pen.rowHeight*this.pen.calculative.canvas.store.data.scale:(this.pen.tableHeight+=this.pen.rowHeight,this.pen.height+=this.pen.rowHeight,this.pen.calculative.worldRect.height+=this.pen.rowHeight,this.pen.calculative.worldRect.center.y+=this.pen.rowHeight/2,this.pen.calculative.worldRect.ey+=this.pen.rowHeight,this.pen.initWorldRect.height+=this.pen.rowHeight,this.pen.calculative.endIndex+=1),this.pen.calculative.activeRow+=1,(a=this.pen.mergeCells)!=null&&a.length&&this.pen.mergeCells.forEach(i=>{i.row<t&&t<i.row+i.rowspan&&(i.rowspan+=1),i.row>=t&&(i.row+=1)}),this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()});Pe(this,"insertRowBelow",(t=this.pen.calculative.activeCell.row)=>{var i;let r=[];for(let o=0;o<this.pen.colPos.length;o++)r.push("");this.pen.data.splice(t+1,0,r);let a=this.pen.rowPos[t+1];t===this.pen.rowPos.length-1&&(a=this.pen.rowPos[t]+this.pen.rowHeight),this.pen.rowPos.splice(t+1,0,a);for(let o=t+2;o<this.pen.rowPos.length;o++)this.pen.rowPos[o]+=this.pen.rowHeight;this.pen.maxNum?this.pen.calculative.maxOffsetY+=this.pen.rowHeight*this.pen.calculative.canvas.store.data.scale:(this.pen.tableHeight+=this.pen.rowHeight,this.pen.height+=this.pen.rowHeight,this.pen.calculative.worldRect.height+=this.pen.rowHeight,this.pen.calculative.worldRect.center.y+=this.pen.rowHeight/2,this.pen.calculative.worldRect.ey+=this.pen.rowHeight,this.pen.initWorldRect.height+=this.pen.rowHeight,this.pen.calculative.endIndex+=1),(i=this.pen.mergeCells)!=null&&i.length&&this.pen.mergeCells.forEach(o=>{o.row<t+1&&t+1<o.row+o.rowspan&&(o.rowspan+=1),o.row>=t+1&&(o.row+=1)}),this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()});Pe(this,"deleteRow",t=>{var r;this.pen.data.splice(t,1),this.pen.rowPos.splice(t,1);for(let a=t;a<this.pen.rowPos.length;a++)this.pen.rowPos[a]-=this.pen.rowHeight;if(this.pen.calculative.maxOffsetY-=this.pen.rowHeight*this.pen.calculative.canvas.store.data.scale,(r=this.pen.mergeCells)!=null&&r.length)for(let a=0;a<this.pen.mergeCells.length;a++){const i=this.pen.mergeCells[a];i.row<=t&&t<i.row+i.rowspan&&(i.rowspan-=1),i.row>t&&(i.row-=1),(i.rowspan<1||i.colspan===1&&i.rowspan===1)&&(this.pen.mergeCells.splice(a,1),a--)}this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()});Pe(this,"clearRow",t=>{for(let r=0;r<this.pen.colPos.length;r++)this.pen.data[t][r]="";this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()});Pe(this,"clearCells",()=>{if(this.pen.calculative.mergeCell){let t=this.pen.calculative.mergeCell;for(let r=t.row;r<t.row+t.rowspan;r++)for(let a=t.col;a<t.col+t.colspan;a++)this.pen.data[r][a]="";this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render()}this.pen.calculative.activeCell&&(this.pen.data[this.pen.calculative.activeCell.row][this.pen.calculative.activeCell.col]="",this.pen.calculative.texts=void 0,this.pen.calculative.canvas.render())});Pe(this,"cancelMerge",()=>{var t;if((t=this.pen.mergeCells)!=null&&t.length){for(let r=0;r<this.pen.mergeCells.length;r++)Ra(this.pen.mergeCells[r],this.pen.calculative.mergeCell)&&(this.pen.mergeCells.splice(r,1),r--);this.pen.calculative.canvas.render()}else console.warn("No cells are merged")});Pe(this,"mergeCell",()=>{var r;const t=this.pen.calculative.mergeCell;if(t){let a=this.pen.data[t.row][t.col];if(this.clearCells(),this.pen.calculative.texts=void 0,this.pen.data[t.row][t.col]=a,t.colspan>1||t.rowspan>1){for(let i=0;i<((r=this.pen.mergeCells)==null?void 0:r.length);i++)Ra(this.pen.mergeCells[i],t)&&(this.pen.mergeCells.splice(i,1),i--);this.pen.mergeCells||(this.pen.mergeCells=[]),this.pen.mergeCells.push(rt(t)),this.pen.calculative.canvas.render()}}});this.pen=t,this.options=Lq,this.init()}init(){var t;this.menu=document.createElement("div"),this.menu.style.position="absolute",this.menu.style.zIndex="999",this.menu.style.backgroundColor="#303746",this.menu.style.listStyleType="none",this.menu.style.border="0px",this.menu.style.height="40px",this.menu.style.borderRadius="4px",this.menu.style.display="none",this.ul=document.createElement("ul"),this.ul.style.display="flex",this.ul.style.padding="4px 16px 4px 4px",this.hand=document.createElement("div"),this.hand.style.display="flex",this.hand.style.justifyContent="center",this.hand.style.alignItems="center",this.hand.style.background="#454f64",this.hand.style.borderTopLeftRadius="4px",this.hand.style.borderBottomLeftRadius="4px",this.hand.style.width="28px",this.hand.style.cursor="grab",this.hand.innerHTML='<svg width="1em" height="1em" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" class="larkui-icon larkui-icon-drag" style="width: 16px; height: 16px;"><path d="M88 187c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18Zm80 0c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18Zm-80-76c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18Zm80 0c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18ZM88 35c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18Zm80 0c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18Z" fill="currentColor" fill-rule="nonzero"></path></svg>',this.hand.onmousedown=r=>{this.down={x:r.clientX,y:r.clientY},this.hand.style.cursor="grabbing",this.box.style.display="block",this.box.style.width=this.pen.calculative.worldRect.width+"px",this.box.style.height=this.pen.calculative.worldRect.height+"px"},this.hand.onmouseup=r=>{this.hand.style.cursor="grab",this.box.style.display="none";let a=parseFloat(this.menu.style.left)-(this.pen.calculative.canvas.store.data.x+this.pen.calculative.worldRect.x),i=parseFloat(this.menu.style.top)-(this.pen.calculative.canvas.store.data.y+this.pen.calculative.worldRect.y-50);this.pen.calculative.canvas.translatePens([this.pen],a,i)},this.hand.onmouseenter=r=>{this.popup.style.display="block",this.popup.innerText="可拖拽表格",this.popup.style.left=14-this.popup.offsetWidth/2+"px"},this.hand.onmouseleave=r=>{this.popup.style.display="none"},this.popup=document.createElement("div"),this.popup.style.position="absolute",this.popup.style.top="-28px",this.popup.style.left="0px",this.popup.style.backgroundColor="#777777",this.popup.style.padding="4px",this.popup.style.borderRadius="4px",this.popup.style.color="#ffffff",this.popup.style.display="none",this.popup.style.whiteSpace="nowrap",this.box=document.createElement("div"),this.box.style.border=`1px solid ${this.pen.calculative.canvas.store.data.color||"#222222"}`,this.box.style.position="absolute",this.box.style.top="50px",this.box.style.left="0px",this.box.style.backgroundColor="#0000",this.box.style.display="none",this.box.style.opacity="0.5",document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp),this.menu.appendChild(this.hand),this.menu.appendChild(this.ul),this.menu.appendChild(this.popup),this.menu.appendChild(this.box),(t=this.pen.calculative.canvas.externalElements)==null||t.parentElement.appendChild(this.menu),this.pen.calculative.singleton||(this.pen.calculative.singleton={});for(let r in this.options)this.options[r].forEach(a=>{this.pen[a.key]=this[a.key]})}updateMenu(t,r){t&&this.key!==t&&(this.key=t,this.setMenuList());let a=this.pen.calculative.canvas.store.data.x+this.pen.calculative.worldRect.x,i=this.pen.calculative.canvas.store.data.y+this.pen.calculative.worldRect.y-50;this.menu.style.display="flex",this.menu.style.left=a+"px",this.menu.style.top=i+"px"}updateHand(){this.hand.style.left=this.pen.calculative.worldRect.x+this.pen.calculative.canvas.store.data.x-25+"px",this.hand.style.top=this.pen.calculative.worldRect.y+this.pen.calculative.canvas.store.data.y-25+"px"}setMenuList(){for(;this.ul.firstChild;)this.ul.removeChild(this.ul.firstChild);for(let t=0;t<this.options[this.key].length;t++){const r=document.createElement("li");if(r.style.width="32px",r.style.height="32px",r.style.color="#bdc7db",r.style.lineHeight="32px",r.style.cursor="pointer",r.style.borderRadius="4px",r.style.display="flex",r.style.justifyContent="center",r.style.alignItems="center",r.style.fill="#bdc7db",r.innerHTML=this.options[this.key][t].svg,r.dataset.mname=this.options[this.key][t].name,r.dataset.mleft=41*t+48+"",r.onclick=()=>{["row","col"].includes(this.key)?this.pen[this.options[this.key][t].key](this.pen.calculative[this.key==="row"?"activeRow":"activeCol"]):this.pen[this.options[this.key][t].key]()},r.onmouseover=()=>{r.style.backgroundColor="#454f64",this.popup.style.display="block",this.popup.innerText=r.dataset.mname,this.popup.style.left=parseFloat(r.dataset.mleft)-this.popup.offsetWidth/2+"px"},r.onmouseleave=()=>{r.style.backgroundColor="",this.popup.style.display="none"},this.ul.appendChild(r),t<this.options[this.key].length-1){const a=document.createElement("div");a.style.width="1px",a.style.height="28px",a.style.marginLeft="4px",a.style.marginRight="4px",a.style.background="rgb(76 81 94)",this.ul.appendChild(a)}}}hide(){this.menu.style.display="none"}destroy(){this.menu.remove()}}class Oq{constructor(t){Pe(this,"pen");Pe(this,"h");Pe(this,"w");Pe(this,"isDownH");Pe(this,"isDownW");Pe(this,"scrollLength",40);Pe(this,"onMouseMove",t=>{if(this.isDownH){const r=t.y-this.isDownH,a=this.pen.calculative.maxOffsetY/this.pen.calculative.worldRect.height;Bs(this.pen,r*a),this.updataScrollHTop(),this.isDownH=t.y}});Pe(this,"onMouseUp",t=>{this.isDownH=0,this.isDownW=0});this.pen=t,this.init(),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)}init(){var t,r;this.h=document.createElement("div"),this.w=document.createElement("div"),(t=this.pen.calculative.canvas.externalElements)==null||t.parentElement.appendChild(this.h),(r=this.pen.calculative.canvas.externalElements)==null||r.parentElement.appendChild(this.w),this.h.style.position="absolute",this.h.style.height="100px",this.h.style.width="5px",this.h.style.borderRadius=`${this.scrollLength}px`,this.h.style.backgroundColor="#454F61",this.h.style.zIndex="999",this.h.style.cursor="pointer",this.h.onmousedown=a=>{a.preventDefault(),a.stopPropagation(),this.isDownH=a.y},this.updataScroll()}updataScroll(){this.h&&(this.h.style.left=this.pen.calculative.worldRect.x+this.pen.calculative.canvas.store.data.x+this.pen.calculative.worldRect.width-5+"px",this.h.style.height=this.scrollLength*this.pen.calculative.canvas.store.data.scale+"px",this.updataScrollHTop())}updataScrollHTop(){if(this.h){const t=this.pen.calculative.canvas.store.data.scale,r=(this.pen.data.length-this.pen.maxNum)*this.pen.rowHeight*t;this.h.style.top=this.pen.calculative.worldRect.y+this.pen.calculative.canvas.store.data.y+this.pen.offsetY/r*t*((this.pen.pagination?this.pen.calculative.worldRect.height-200*t:this.pen.calculative.worldRect.height)-(this.pen.colHeaders?this.pen.rowPos[0]*t:0)-this.scrollLength*t)+(this.pen.colHeaders?this.pen.rowPos[0]*t:0)+"px"}}hideScroll(){this.h&&!this.isDownH&&(this.h.style.display="none")}showScroll(){this.h&&(this.h.style.display="block")}destroy(){this.h.remove(),this.w.remove(),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)}}function Dq(e,t){let r=t.calculative.worldRect.x,a=t.calculative.worldRect.y,i=t.calculative.worldRect.height,o=t.calculative.worldRect.width;const n=t.data,s=t.calculative.canvas.store.data.scale||1,{btnWidth:u,btnHeight:c,gap:l=8}=t,f=l*s,h=n.length;let d=a+f,v=r+f;Os(t,"activeBgImage","activeBgImg"),Os(t,"bgImage","bgImg"),t.onDestroy||(t.onMouseDown=Bq,t.onMouseUp=Fq,t.onMouseLeave=Nq,t.onResize=yh($q,500));const y=t.data[0].radius||[0,0,0,0];if(t.direction=="horizontal"){const g=u*s||(o-(h+1)*f)/h,m=c*s||i-f*2;n.forEach((w,p)=>{m0(e,w,v,d,t,w.isForbidden,g,m,y),b0(e,w,v+g/2,d+m/2,t,w.isForbidden),v+=g+f}),t.dragRange&&ui(e,{x:r,y:d+f+m,w:o,h:i-m-f*2},{strokeStyle:"#313740"}),t.calculative.worldDragRect={x:r,y:d+f+m,ex:r+o,ey:d+i-f}}else{const g=u*s||o-f*2,m=c*s||(i-(h+1)*f)/h;n.forEach((w,p)=>{m0(e,w,v,d,t,w.isForbidden,g,m,y),b0(e,w,v+g/2,d+m/2,t,w.isForbidden),d+=m+f}),t.dragRange&&ui(e,{x:v+g+f,y:a,w:o-g-f*2,h:i},{strokeStyle:"#313740"}),t.calculative.worldDragRect={x:v+g+f,y:a,ex:v+o-f,ey:a+i}}}const m0=(e,t,r,a,i,o,n,s,u)=>{const c=t.radius||u;o?(e.strokeStyle=t.forbiddenColor||"#636363",Dc(e,{x:r,y:a,width:n,height:s},c,t.forbiddenBgColor||"#434343")):!i.multiple&&t.key==i.selectedKey||i.multiple&&i.selectedKeys.includes(t.key)?(e.strokeStyle=t.activeColor||i.activeColor||"#4583FF",i.calculative.activeBgImg?e.drawImage(i.calculative.activeBgImg,r,a,n,s):Dc(e,{x:r,y:a,width:n,height:s},c,t.activeBackground||i.activeBackground||"rgba(69,131,255,0.2)")):(e.strokeStyle=t.color||i.color||"#313740",i.calculative.bgImg?e.drawImage(i.calculative.bgImg,r,a,n,s):Dc(e,{x:r,y:a,width:n,height:s},c,t.background||i.background||"#272c33")),e.stroke()};function Dc(e,t,r,a){const{x:i,y:o,width:n,height:s}=t,[u,c,l,f]=r;e.beginPath(),e.moveTo(i+u,o),e.arcTo(i+n,o,i+n,o+c,c),e.arcTo(i+n,o+s,i+n-u,o+s,l),e.arcTo(i,o+s,i,o+s-f,f),e.arcTo(i,o,i+u,o,u),e.fillStyle=a,e.fill()}function b0(e,t,r,a,i,o){const n=t.text,{fontStyle:s,fontWeight:u,fontSize:c,fontFamily:l,lineHeight:f}=i.calculative;e.font=e.font=et({fontStyle:s,fontWeight:u,fontFamily:l||i.calculative.canvas.parent.store.options.fontFamily,fontSize:c,lineHeight:f}),e.textBaseline="middle",e.textAlign="center";let h=!1;(!i.multiple&&t.key==i.selectedKey||i.multiple&&i.selectedKeys.includes(t.key))&&(h=!0),e.fillStyle=o?t.forbiddenTextColor||"rgba(255,255,255,0.26)":h?t.activeTextColor||i.activeTextColor||"#FFFFFF":t.textColor||i.textColor||"#FFFFFF",e.fillText(n,r,a)}function Bq(e,t){const{x:r,y:a,width:i,height:o}=e.calculative.worldRect,n=e.calculative.canvas.store.data.scale||1,{btnWidth:s,btnHeight:u,gap:c=8}=e,l=c*n,f=e.data.length;if(e.direction=="horizontal"){const h=s*n||(i-(f+1)*l)/f,d=u*n||o-l*2;for(let v=0;v<e.data.length;v++){let y=v==0?r+l:r+l+v*(h+l);!e.data[v].isForbidden&&t.x>y&&t.x<y+h&&t.y>a+l&&t.y<a+l+d&&(Yn(e,!1),e.selectedKey=e.data[v].key,Yn(e,!0),e.calculative.canvas.store.emitter.emit("valueUpdate",e))}}else if(e.direction=="vertical"){const h=s*n||i-l*2,d=u*n||(o-(f+1)*l)/f;for(let v=0;v<e.data.length;v++){let y=v==0?a+l:a+l+v*(d+l);!e.data[v].isForbidden&&t.y>y&&t.y<y+d&&t.x>r+l&&t.x<r+l+h&&(Yn(e,!1),e.selectedKey=e.data[v].key,Yn(e,!0),e.calculative.canvas.store.emitter.emit("valueUpdate",e))}}}function Yn(e,t){const r=e.id+"-"+e.selectedKey;e.followers.forEach(a=>{const i=e.calculative.canvas.store.pens[a];i&&i.tags.includes(r)&&e.calculative.canvas.parent.setVisible(i,t)})}function Fq(e,t){const r=e.calculative.canvas,{x:a,y:i}=e.calculative.worldDragRect;setTimeout(()=>{const o=r.store.active;if(!o||o.some(s=>s.name==="quickTab")||t.x<a||t.y<i)return;const n=e.id+"-"+e.selectedKey;o.forEach(s=>{e.followers.includes(s.id)||(e.followers.push(s.id),s.tags||(s.tags=[]),s.tags.includes(n)||s.tags.push(n))})})}function Nq(e,t){const r=e.calculative.canvas,a=r.store.active,{x:i,y:o,ex:n,ey:s}=e.calculative.worldDragRect;if(!a||a.length==1&&a[0].id==e.id||t.x>i&&t.y>o&&t.x<n&&t.y<s||r.hoverType!=4&&r.hoverType!=5)return;const u=e.id+"-"+e.selectedKey,c=[];a.forEach(l=>{l.id!=e.id&&l.tags&&l.tags.includes(u)&&(l.tags=l.tags.filter(f=>f!==u),c.push(l.id))}),c.length>0&&(e.followers=e.followers.filter(l=>!c.includes(l)&&r.store.pens[l]))}function $q(e,t){const r=e.calculative.canvas,{x:a,y:i,ex:o,ey:n}=e.calculative.worldDragRect,s=e.data.map(u=>e.id+"-"+u.key);e.followers=e.followers.filter(u=>{const c=r.store.pens[u];if(c){const l=c.calculative.worldRect;return l.x<a||l.ex>o||l.y<i||l.ey>n?(r.parent.setVisible(c,!0),c.tags=c.tags.filter(f=>!s.includes(f)),!1):!0}})}function jq(e,t){const{x:r,y:a,width:i,height:o,ex:n,ey:s}=t.calculative.worldRect;let u=t.calculative.borderRadius||0,c=u;u<1&&(u=i*u,c=o*c);let l=u<c?u:c;i<2*l&&(l=i/2),o<2*l&&(l=o/2);let f=t.calculative.progress||t.calculative.value||0;const h=.1/(t.wAmplitude||2),d=t.hAmplitude||5;t.calculative.xOffset||(t.calculative.xOffset=0);let v=t.calculative.xOffset;t.calculative.xOffset+=.2,t.calculative.xOffset>10&&(t.calculative.xOffset=0);let y=t.calculative.worldRect.x+(t.calculative.lineWidth||0)/2+(t.distance||0),g=t.calculative.worldRect.x+i-(t.calculative.lineWidth||0)/2-(t.distance||0),m=t.calculative.worldRect.y+(1-f)*o,w=s-(t.calculative.lineWidth||0)/2-(t.distance||0),p=l-(t.calculative.lineWidth||0)/2-(t.distance||0);if(p<0&&(p=0),f>0&&f<1){e.beginPath();let x=d*Math.sin((r+y)*h+v)+m;e.moveTo(y,x);for(let T=y;T<g;T+=20/(g-y)){const A=d*Math.sin((r+T)*h+v)+m;e.lineTo(T,A)}e.arcTo(g,w,y,w,p),e.arcTo(y-1,w,y,a,p),e.lineTo(y,m),e.fill(),e.closePath()}e.beginPath(),e.moveTo(r+l,a),e.arcTo(n,a,n,s,l),e.arcTo(n,s,r,s,l),e.arcTo(r,s,r,a,l),e.arcTo(r,a,n,a,l),t.calculative.lineWidth&&e.stroke(),f>=1&&e.fill(),e.closePath()}function zq(){return{countdown:AU}}function Hq(){return{timeline:IU,swiperline:MU,tab:fV,radio:dV,checkbox:gV,calendar:WU,indicator:JU,progress:ZU,pagination:g1,steps:mV,notification:xV,list:CV,tree:kV,rockerSwitch:TV,roundSwitch:EV,breadcrumb:IV,transferSwitch:OV,battery:KV,tablePlus:ZV,quickTab:Dq,tank:jq,headMenuDom:lU,inputDom:XW,selectDom:eU,menuDom:dU,sliderVerifyDom:CU,dropdownDom:tV,flvPlayerDom:sV,swiperDom:NU,rtspPlayerDom:NV}}const Bc={color:["#4583ff","#37b3cc","#258ca6","#34bf6e","#239957","#3062da"]};function Wq({fontStyle:e="normal",textDecoration:t="normal",fontWeight:r="normal",fontSize:a=12,fontFamily:i="Arial",lineHeight:o=1}={}){return`${e} ${t} ${r} ${a}px/${o} ${i}`}function Uq(e,t){let{x:r,y:a,width:i,height:o,ex:n,ey:s}=t.calculative.worldRect;t.onMove||(t.onMove=Vq,t.onResize=qq);let u=t.calculative.canvas.store.data.scale;const{fontStyle:c,fontWeight:l,fontSize:f,fontFamily:h,lineHeight:d}=t.calculative;let v=o/8;t.data;let y=t.data.reduce((x,T)=>x+T.value,0);t.calculative.topCPoints||(t.calculative.topCPoints=w0({a:i/2,b:(o-v)/2,p:1,cx:r+i/2,cy:a+(o-v)/2})),t.calculative.bottomCPoints||(t.calculative.bottomCPoints=w0({a:i/2,b:(o-v)/2,p:1,cx:r+i/2,cy:a+(o-v)/2+v}));let g=t.calculative.topCPoints,m=t.calculative.bottomCPoints;if(!g.length||!m.length)return!1;let w={x:r+i/2,y:a+(o-v)/2},p=0;for(let x=0;x<t.data.length;x++){let T=t.data[x];e.beginPath(),e.fillStyle=T.color||Bc.color[x],e.moveTo(w.x,w.y);let A=Math.round(T.value/y*360);p>1&&e.lineTo(g[p-1][0],g[p-1][1]);for(let S=p;S<(p+A>360?360:p+A);S++)e.lineTo(g[S][0],g[S][1]);if(p+=A,x===t.data.length-1){for(let S=p;S<360;S++)e.lineTo(g[S][0],g[S][1]);e.lineTo(g[0][0],g[0][1])}if(e.closePath(),e.fill(),e.beginPath(),e.fillStyle=window.pSBC(-.4,T.color||Bc.color[x]),p-A<=90&&p>90)if(p<270){e.moveTo(g[p-1][0],g[p-1][1]);for(let S=p-1;S>=90;S--)e.lineTo(g[S][0],g[S][1]);for(let S=90;S<p;S++)e.lineTo(m[S][0],m[S][1])}else{e.moveTo(g[270][0],g[270][1]);for(let S=270;S>=90;S--)e.lineTo(g[S][0],g[S][1]);for(let S=90;S<270;S++)e.lineTo(m[S][0],m[S][1])}if(p-A>90&&p<270){e.moveTo(g[p-1][0],g[p-1][1]);for(let S=p-1;S>=p-A-1;S--)e.lineTo(g[S][0],g[S][1]);for(let S=p-A-1;S<p;S++)e.lineTo(m[S][0],m[S][1])}if(p-A>90&&p-A<270&&p>=270){e.moveTo(g[270][0],g[270][1]);for(let S=270;S>=p-A-1;S--)e.lineTo(g[S][0],g[S][1]);for(let S=p-A-1;S<270;S++)e.lineTo(m[S][0],m[S][1])}e.closePath(),e.fill(),e.textBaseline="middle",e.textAlign="center";const I=Wq({fontStyle:c,fontWeight:l,fontFamily:h||t.calculative.canvas.parent.store.options.fontFamily,fontSize:f,lineHeight:d});let R=Math.floor(p-A+A/2),z=0;R>0&&R<180?(e.textAlign="start",z=50*u):(e.textAlign="end",z=-50*u);let U=Math.atan((g[R][1]-w.y)/(g[R][0]-w.x)),_=10*Math.cos(U),k=10*Math.sin(U);R>180&&(_=-_,k=-k),e.beginPath(),e.strokeStyle=T.color||Bc.color[x],e.moveTo(g[R][0],g[R][1]),e.lineTo(g[R][0]+_*u,g[R][1]+k*u),e.lineTo(g[R][0]+_*u+z,g[R][1]+k*u),e.stroke(),e.fillStyle="#fff",e.font=I,e.fillText(T.name,g[R][0]+_*u+z*5/4,g[R][1]+k*u)}}function Vq(e){e.calculative.topCPoints=void 0,e.calculative.bottomCPoints=void 0}function qq(e){e.calculative.topCPoints=void 0,e.calculative.bottomCPoints=void 0}function w0({a:e,b:t,p:r=1,cx:a=0,cy:i=0}){const o=[];for(let n=-90;n<270;n=n+r){let s=e*Math.cos(Math.PI*2*n/360),u=t*Math.sin(Math.PI*2*n/360);o.push([s+a,u+i])}return o}function Kq(){return{pie3D:Uq}}function Yq(){mr(uz()),Au(fz()),mr(gz()),Rr(yz()),mr(kz()),mr(Tz()),Rr(Az()),Hz(),Wz(),Rr(wH()),Rr(MH()),mr(GH()),Rr(XH()),Au(QH()),mr(Yw()),Rr(Gw()),mr(zq()),Rr(Hq()),Rr(Kq())}const Gq=e=>(Z0("data-v-bfc75b86"),e=e(),ep(),e),Xq=Gq(()=>Ce("div",{id:"mask"},null,-1)),Qq=Ge({__name:"App",setup(e){const t=L9(),r=M9(),{getUser:a}=Lb(),i=Ie(!1),o=Ie(!1);ir(()=>{Ta("isPhone",o),window.addEventListener("resize",n),Yq()});const n=()=>{t.path==="/solution"?o.value=document.body.clientWidth<=768:o.value=document.body.clientWidth<=1024};return ut(t,()=>{if(n(),t.query.token){const s={...t.query};delete s.token,r.replace({path:t.path,query:s})}t.path=="/preview"?i.value=!1:(i.value=!0,setTimeout(()=>{AN()},0))}),df(()=>{a()}),Ys(()=>{window.removeEventListener("resize",n)}),(s,u)=>{const c=N2("router-view");return Wi(),Xs(wt,null,[i.value?(Wi(),eu(cN,{key:0})):Hh("",!0),Ce("main",null,[de(c)]),i.value?(Wi(),eu(TN,{key:1})):Hh("",!0),Xq,de(EB)],64)}}}),Jq=vb(Qq,[["__scopeId","data-v-bfc75b86"]]),Zq="modulepreload",eK=function(e){return"https://assets.le5lecdn.com/le5le/"+e},x0={},Fc=function(t,r,a){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),n=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.all(r.map(s=>{if(s=eK(s),s in x0)return;x0[s]=!0;const u=s.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${c}`))return;const l=document.createElement("link");if(l.rel=u?"stylesheet":Zq,u||(l.as="script",l.crossOrigin=""),l.href=s,n&&l.setAttribute("nonce",n),document.head.appendChild(l),u)return new Promise((f,h)=>{l.addEventListener("load",f),l.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${s}`)))})}))}return i.then(()=>t()).catch(o=>{const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=o,window.dispatchEvent(n),!n.defaultPrevented)throw o})},tK=[{path:"/solution",component:()=>Fc(()=>import("./Solution-UxgEyHAk.js"),__vite__mapDeps([0,1]))},{path:"/price",component:()=>Fc(()=>import("./Price-BKsSK3KO.js"),__vite__mapDeps([2,3,4,5]))},{path:"/preview",component:()=>Fc(()=>import("./Preview-CF5SqRHZ.js"),__vite__mapDeps([6,3,4,7]))}],rK=R9({history:a9("/enterprise/"),routes:tK});$a.defaults.timeout=6e4;$a.defaults.withCredentials=!1;const Nc=new Map,$c=new Set;$a.interceptors.request.use(e=>{if(e.baseURL="/api",(!e.url.startsWith("/data")||!e.url.endsWith("/list"))&&(e.headers.Authorization="Bearer "+(Ib("token")||"")),e.params){if(e.params.debounce>0){const t=e.method+e.url,r=Nc.get(t);return r&&(clearTimeout(r.timer),r.reject()),delete e.params.debounce,delete e.params.throttle,new Promise((a,i)=>{const o={reject:i};o.timer=setTimeout(()=>{Nc.delete(t),a(e)},e.params.debounce),Nc.set(t,o)})}else if(e.params.throttle>0){const t=e.method+e.url;if($c.has(t))return Promise.reject("Repeated request.");$c.add(t),setTimeout(()=>{$c.delete(t)},e.params.throttle)}delete e.params.debounce,delete e.params.throttle}return e},e=>Promise.reject(e));$a.interceptors.response.use(e=>{if(e&&e.data&&e.data.error&&pr.error(e.data.error),e)return e.data},e=>{if(!(e&&!e.response)){if(e&&e.response){if(e.response.config.url==="/account/profile")return;if(e.response.status!==401&&e.response&&e.response.data&&e.response.data.error){pr.error(e.response.data.error);return}switch(e.response.status){case 401:break;case 403:pr.error("请求错误，不合法的请求！");break;case 404:e.response.config.url.indexOf("/data/")!==0&&pr.error("访问数据不存在，请检查后重试！");break;case 500:pr.error("请求服务错误，请稍后重试！");break;case 504:pr.error("网络超时，请检测你的网络！");break;default:pr.error("未知网络错误！");break}}return e.response?e.response.data:e}});var E1={exports:{}};(function(e,t){(function(r,a){e.exports=a()})(qe,function(){return function(r,a,i){r=r||{};var o=a.prototype,n={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function s(c,l,f,h){return o.fromToBase(c,l,f,h)}i.en.relativeTime=n,o.fromToBase=function(c,l,f,h,d){for(var v,y,g,m=f.$locale().relativeTime||n,w=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],p=w.length,x=0;x<p;x+=1){var T=w[x];T.d&&(v=h?i(c).diff(f,T.d,!0):f.diff(c,T.d,!0));var A=(r.rounding||Math.round)(Math.abs(v));if(g=v>0,A<=T.r||!T.r){A<=1&&x>0&&(T=w[x-1]);var I=m[T.l];d&&(A=d(""+A)),y=typeof I=="string"?I.replace("%d",A):I(A,l,T.l,g);break}}if(l)return y;var R=g?m.future:m.past;return typeof R=="function"?R(y):R.replace("%s",y)},o.to=function(c,l){return s(c,l,this,!0)},o.from=function(c,l){return s(c,l,this)};var u=function(c){return c.$u?i.utc():i()};o.toNow=function(c){return this.to(u(this),c)},o.fromNow=function(c){return this.from(u(this),c)}}})})(E1);var iK=E1.exports;const aK=bl(iK);var P1={exports:{}};(function(e,t){(function(r,a){e.exports=a(Rb)})(qe,function(r){function a(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var i=a(r),o={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(n,s){return s==="W"?n+"周":n+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(n,s){var u=100*n+s;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return i.default.locale(o,null,!0),o})})(P1);var oK=P1.exports;const nK=bl(oK);Jf.extend(aK);Jf.locale(nK.name);const sK=wf(Jq).use(rK).use(pr).use(CB).use(yL);sK.mount("#app");export{ta as A,vK as B,rn as C,de as D,pf as E,wt as F,N2 as G,S2 as H,Fo as I,fN as J,Fc as K,dK as L,pr as M,qe as N,li as O,bl as P,pK as Q,ut as R,hK as S,eu as T,vb as _,gK as a,df as b,Xs as c,Ge as d,Ce as e,Lp as f,Hh as g,cK as h,Ep as i,L9 as j,M9 as k,Ct as l,$a as m,Wi as n,ir as o,tf as p,fK as q,Ie as r,Z0 as s,zc as t,bt as u,uK as v,tp as w,ep as x,Lb as y,yK as z};
