var jv=Object.defineProperty,Fv=Object.defineProperties;var Nv=Object.getOwnPropertyDescriptors;var ks=Object.getOwnPropertySymbols;var Al=Object.prototype.hasOwnProperty,ml=Object.prototype.propertyIsEnumerable;var Ks=(o,s,_)=>s in o?jv(o,s,{enumerable:!0,configurable:!0,writable:!0,value:_}):o[s]=_,or=(o,s)=>{for(var _ in s||(s={}))Al.call(s,_)&&Ks(o,_,s[_]);if(ks)for(var _ of ks(s))ml.call(s,_)&&Ks(o,_,s[_]);return o},Tr=(o,s)=>Fv(o,Nv(s));var Ps=(o,s)=>{var _={};for(var _e in o)Al.call(o,_e)&&s.indexOf(_e)<0&&(_[_e]=o[_e]);if(o!=null&&ks)for(var _e of ks(o))s.indexOf(_e)<0&&ml.call(o,_e)&&(_[_e]=o[_e]);return _};var Xn=(o,s,_)=>(Ks(o,typeof s!="symbol"?s+"":s,_),_);const p$3=function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const et of document.querySelectorAll('link[rel="modulepreload"]'))_e(et);new MutationObserver(et=>{for(const it of et)if(it.type==="childList")for(const tt of it.addedNodes)tt.tagName==="LINK"&&tt.rel==="modulepreload"&&_e(tt)}).observe(document,{childList:!0,subtree:!0});function _(et){const it={};return et.integrity&&(it.integrity=et.integrity),et.referrerpolicy&&(it.referrerPolicy=et.referrerpolicy),et.crossorigin==="use-credentials"?it.credentials="include":et.crossorigin==="anonymous"?it.credentials="omit":it.credentials="same-origin",it}function _e(et){if(et.ep)return;et.ep=!0;const it=_(et);fetch(et.href,it)}};p$3();var commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"||typeof window!="undefined"?window:typeof self!="undefined"?self:{};function getDefaultExportFromCjs(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function getAugmentedNamespace(o){if(o.__esModule)return o;var s=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(o).forEach(function(_){var _e=Object.getOwnPropertyDescriptor(o,_);Object.defineProperty(s,_,_e.get?_e:{enumerable:!0,get:function(){return o[_]}})}),s}function commonjsRequire(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var react={exports:{}},react_production_min={};/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var getOwnPropertySymbols$1=Object.getOwnPropertySymbols,hasOwnProperty$1=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function shouldUseNative(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},_=0;_<10;_++)s["_"+String.fromCharCode(_)]=_;var _e=Object.getOwnPropertyNames(s).map(function(it){return s[it]});if(_e.join("")!=="0123456789")return!1;var et={};return"abcdefghijklmnopqrst".split("").forEach(function(it){et[it]=it}),Object.keys(Object.assign({},et)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var objectAssign=shouldUseNative()?Object.assign:function(o,s){for(var _,_e=toObject(o),et,it=1;it<arguments.length;it++){_=Object(arguments[it]);for(var tt in _)hasOwnProperty$1.call(_,tt)&&(_e[tt]=_[tt]);if(getOwnPropertySymbols$1){et=getOwnPropertySymbols$1(_);for(var rt=0;rt<et.length;rt++)propIsEnumerable.call(_,et[rt])&&(_e[et[rt]]=_[et[rt]])}}return _e};/** @license React v17.0.2
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var l$1=objectAssign,n$2=60103,p$2=60106;react_production_min.Fragment=60107;react_production_min.StrictMode=60108;react_production_min.Profiler=60114;var q$2=60109,r$2=60110,t$1=60112;react_production_min.Suspense=60113;var u$1=60115,v$1=60116;if(typeof Symbol=="function"&&Symbol.for){var w$1=Symbol.for;n$2=w$1("react.element"),p$2=w$1("react.portal"),react_production_min.Fragment=w$1("react.fragment"),react_production_min.StrictMode=w$1("react.strict_mode"),react_production_min.Profiler=w$1("react.profiler"),q$2=w$1("react.provider"),r$2=w$1("react.context"),t$1=w$1("react.forward_ref"),react_production_min.Suspense=w$1("react.suspense"),u$1=w$1("react.memo"),v$1=w$1("react.lazy")}var x$1=typeof Symbol=="function"&&Symbol.iterator;function y$2(o){return o===null||typeof o!="object"?null:(o=x$1&&o[x$1]||o["@@iterator"],typeof o=="function"?o:null)}function z$2(o){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+o,_=1;_<arguments.length;_++)s+="&args[]="+encodeURIComponent(arguments[_]);return"Minified React error #"+o+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var A$2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B$1={};function C(o,s,_){this.props=o,this.context=s,this.refs=B$1,this.updater=_||A$2}C.prototype.isReactComponent={};C.prototype.setState=function(o,s){if(typeof o!="object"&&typeof o!="function"&&o!=null)throw Error(z$2(85));this.updater.enqueueSetState(this,o,s,"setState")};C.prototype.forceUpdate=function(o){this.updater.enqueueForceUpdate(this,o,"forceUpdate")};function D$1(){}D$1.prototype=C.prototype;function E$2(o,s,_){this.props=o,this.context=s,this.refs=B$1,this.updater=_||A$2}var F$2=E$2.prototype=new D$1;F$2.constructor=E$2;l$1(F$2,C.prototype);F$2.isPureReactComponent=!0;var G$1={current:null},H$1=Object.prototype.hasOwnProperty,I$1={key:!0,ref:!0,__self:!0,__source:!0};function J(o,s,_){var _e,et={},it=null,tt=null;if(s!=null)for(_e in s.ref!==void 0&&(tt=s.ref),s.key!==void 0&&(it=""+s.key),s)H$1.call(s,_e)&&!I$1.hasOwnProperty(_e)&&(et[_e]=s[_e]);var rt=arguments.length-2;if(rt===1)et.children=_;else if(1<rt){for(var nt=Array(rt),ot=0;ot<rt;ot++)nt[ot]=arguments[ot+2];et.children=nt}if(o&&o.defaultProps)for(_e in rt=o.defaultProps,rt)et[_e]===void 0&&(et[_e]=rt[_e]);return{$$typeof:n$2,type:o,key:it,ref:tt,props:et,_owner:G$1.current}}function K(o,s){return{$$typeof:n$2,type:o.type,key:s,ref:o.ref,props:o.props,_owner:o._owner}}function L(o){return typeof o=="object"&&o!==null&&o.$$typeof===n$2}function escape(o){var s={"=":"=0",":":"=2"};return"$"+o.replace(/[=:]/g,function(_){return s[_]})}var M$1=/\/+/g;function N$1(o,s){return typeof o=="object"&&o!==null&&o.key!=null?escape(""+o.key):s.toString(36)}function O$1(o,s,_,_e,et){var it=typeof o;(it==="undefined"||it==="boolean")&&(o=null);var tt=!1;if(o===null)tt=!0;else switch(it){case"string":case"number":tt=!0;break;case"object":switch(o.$$typeof){case n$2:case p$2:tt=!0}}if(tt)return tt=o,et=et(tt),o=_e===""?"."+N$1(tt,0):_e,Array.isArray(et)?(_="",o!=null&&(_=o.replace(M$1,"$&/")+"/"),O$1(et,s,_,"",function(ot){return ot})):et!=null&&(L(et)&&(et=K(et,_+(!et.key||tt&&tt.key===et.key?"":(""+et.key).replace(M$1,"$&/")+"/")+o)),s.push(et)),1;if(tt=0,_e=_e===""?".":_e+":",Array.isArray(o))for(var rt=0;rt<o.length;rt++){it=o[rt];var nt=_e+N$1(it,rt);tt+=O$1(it,s,_,nt,et)}else if(nt=y$2(o),typeof nt=="function")for(o=nt.call(o),rt=0;!(it=o.next()).done;)it=it.value,nt=_e+N$1(it,rt++),tt+=O$1(it,s,_,nt,et);else if(it==="object")throw s=""+o,Error(z$2(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s));return tt}function P$1(o,s,_){if(o==null)return o;var _e=[],et=0;return O$1(o,_e,"","",function(it){return s.call(_,it,et++)}),_e}function Q(o){if(o._status===-1){var s=o._result;s=s(),o._status=0,o._result=s,s.then(function(_){o._status===0&&(_=_.default,o._status=1,o._result=_)},function(_){o._status===0&&(o._status=2,o._result=_)})}if(o._status===1)return o._result;throw o._result}var R$1={current:null};function S$1(){var o=R$1.current;if(o===null)throw Error(z$2(321));return o}var T$1={ReactCurrentDispatcher:R$1,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G$1,IsSomeRendererActing:{current:!1},assign:l$1};react_production_min.Children={map:P$1,forEach:function(o,s,_){P$1(o,function(){s.apply(this,arguments)},_)},count:function(o){var s=0;return P$1(o,function(){s++}),s},toArray:function(o){return P$1(o,function(s){return s})||[]},only:function(o){if(!L(o))throw Error(z$2(143));return o}};react_production_min.Component=C;react_production_min.PureComponent=E$2;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T$1;react_production_min.cloneElement=function(o,s,_){if(o==null)throw Error(z$2(267,o));var _e=l$1({},o.props),et=o.key,it=o.ref,tt=o._owner;if(s!=null){if(s.ref!==void 0&&(it=s.ref,tt=G$1.current),s.key!==void 0&&(et=""+s.key),o.type&&o.type.defaultProps)var rt=o.type.defaultProps;for(nt in s)H$1.call(s,nt)&&!I$1.hasOwnProperty(nt)&&(_e[nt]=s[nt]===void 0&&rt!==void 0?rt[nt]:s[nt])}var nt=arguments.length-2;if(nt===1)_e.children=_;else if(1<nt){rt=Array(nt);for(var ot=0;ot<nt;ot++)rt[ot]=arguments[ot+2];_e.children=rt}return{$$typeof:n$2,type:o.type,key:et,ref:it,props:_e,_owner:tt}};react_production_min.createContext=function(o,s){return s===void 0&&(s=null),o={$$typeof:r$2,_calculateChangedBits:s,_currentValue:o,_currentValue2:o,_threadCount:0,Provider:null,Consumer:null},o.Provider={$$typeof:q$2,_context:o},o.Consumer=o};react_production_min.createElement=J;react_production_min.createFactory=function(o){var s=J.bind(null,o);return s.type=o,s};react_production_min.createRef=function(){return{current:null}};react_production_min.forwardRef=function(o){return{$$typeof:t$1,render:o}};react_production_min.isValidElement=L;react_production_min.lazy=function(o){return{$$typeof:v$1,_payload:{_status:-1,_result:o},_init:Q}};react_production_min.memo=function(o,s){return{$$typeof:u$1,type:o,compare:s===void 0?null:s}};react_production_min.useCallback=function(o,s){return S$1().useCallback(o,s)};react_production_min.useContext=function(o,s){return S$1().useContext(o,s)};react_production_min.useDebugValue=function(){};react_production_min.useEffect=function(o,s){return S$1().useEffect(o,s)};react_production_min.useImperativeHandle=function(o,s,_){return S$1().useImperativeHandle(o,s,_)};react_production_min.useLayoutEffect=function(o,s){return S$1().useLayoutEffect(o,s)};react_production_min.useMemo=function(o,s){return S$1().useMemo(o,s)};react_production_min.useReducer=function(o,s,_){return S$1().useReducer(o,s,_)};react_production_min.useRef=function(o){return S$1().useRef(o)};react_production_min.useState=function(o){return S$1().useState(o)};react_production_min.version="17.0.2";react.exports=react_production_min;var React=react.exports,reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/** @license React v0.20.2
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(o){var s,_,_e,et;if(typeof performance=="object"&&typeof performance.now=="function"){var it=performance;o.unstable_now=function(){return it.now()}}else{var tt=Date,rt=tt.now();o.unstable_now=function(){return tt.now()-rt}}if(typeof window=="undefined"||typeof MessageChannel!="function"){var nt=null,ot=null,st=function(){if(nt!==null)try{var Wt=o.unstable_now();nt(!0,Wt),nt=null}catch($t){throw setTimeout(st,0),$t}};s=function(Wt){nt!==null?setTimeout(s,0,Wt):(nt=Wt,setTimeout(st,0))},_=function(Wt,$t){ot=setTimeout(Wt,$t)},_e=function(){clearTimeout(ot)},o.unstable_shouldYield=function(){return!1},et=o.unstable_forceFrameRate=function(){}}else{var at=window.setTimeout,lt=window.clearTimeout;if(typeof console!="undefined"){var ct=window.cancelAnimationFrame;typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),typeof ct!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var ht=!1,mt=null,dt=-1,ft=5,ut=0;o.unstable_shouldYield=function(){return o.unstable_now()>=ut},et=function(){},o.unstable_forceFrameRate=function(Wt){0>Wt||125<Wt?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ft=0<Wt?Math.floor(1e3/Wt):5};var pt=new MessageChannel,At=pt.port2;pt.port1.onmessage=function(){if(mt!==null){var Wt=o.unstable_now();ut=Wt+ft;try{mt(!0,Wt)?At.postMessage(null):(ht=!1,mt=null)}catch($t){throw At.postMessage(null),$t}}else ht=!1},s=function(Wt){mt=Wt,ht||(ht=!0,At.postMessage(null))},_=function(Wt,$t){dt=at(function(){Wt(o.unstable_now())},$t)},_e=function(){lt(dt),dt=-1}}function gt(Wt,$t){var Jt=Wt.length;Wt.push($t);e:for(;;){var Nt=Jt-1>>>1,Lt=Wt[Nt];if(Lt!==void 0&&0<bt(Lt,$t))Wt[Nt]=$t,Wt[Jt]=Lt,Jt=Nt;else break e}}function vt(Wt){return Wt=Wt[0],Wt===void 0?null:Wt}function yt(Wt){var $t=Wt[0];if($t!==void 0){var Jt=Wt.pop();if(Jt!==$t){Wt[0]=Jt;e:for(var Nt=0,Lt=Wt.length;Nt<Lt;){var Kt=2*(Nt+1)-1,Pt=Wt[Kt],ln=Kt+1,Gt=Wt[ln];if(Pt!==void 0&&0>bt(Pt,Jt))Gt!==void 0&&0>bt(Gt,Pt)?(Wt[Nt]=Gt,Wt[ln]=Jt,Nt=ln):(Wt[Nt]=Pt,Wt[Kt]=Jt,Nt=Kt);else if(Gt!==void 0&&0>bt(Gt,Jt))Wt[Nt]=Gt,Wt[ln]=Jt,Nt=ln;else break e}}return $t}return null}function bt(Wt,$t){var Jt=Wt.sortIndex-$t.sortIndex;return Jt!==0?Jt:Wt.id-$t.id}var Ct=[],xt=[],It=1,St=null,Ot=3,Mt=!1,jt=!1,Ft=!1;function Ut(Wt){for(var $t=vt(xt);$t!==null;){if($t.callback===null)yt(xt);else if($t.startTime<=Wt)yt(xt),$t.sortIndex=$t.expirationTime,gt(Ct,$t);else break;$t=vt(xt)}}function Qt(Wt){if(Ft=!1,Ut(Wt),!jt)if(vt(Ct)!==null)jt=!0,s(Ht);else{var $t=vt(xt);$t!==null&&_(Qt,$t.startTime-Wt)}}function Ht(Wt,$t){jt=!1,Ft&&(Ft=!1,_e()),Mt=!0;var Jt=Ot;try{for(Ut($t),St=vt(Ct);St!==null&&(!(St.expirationTime>$t)||Wt&&!o.unstable_shouldYield());){var Nt=St.callback;if(typeof Nt=="function"){St.callback=null,Ot=St.priorityLevel;var Lt=Nt(St.expirationTime<=$t);$t=o.unstable_now(),typeof Lt=="function"?St.callback=Lt:St===vt(Ct)&&yt(Ct),Ut($t)}else yt(Ct);St=vt(Ct)}if(St!==null)var Kt=!0;else{var Pt=vt(xt);Pt!==null&&_(Qt,Pt.startTime-$t),Kt=!1}return Kt}finally{St=null,Ot=Jt,Mt=!1}}var Zt=et;o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(Wt){Wt.callback=null},o.unstable_continueExecution=function(){jt||Mt||(jt=!0,s(Ht))},o.unstable_getCurrentPriorityLevel=function(){return Ot},o.unstable_getFirstCallbackNode=function(){return vt(Ct)},o.unstable_next=function(Wt){switch(Ot){case 1:case 2:case 3:var $t=3;break;default:$t=Ot}var Jt=Ot;Ot=$t;try{return Wt()}finally{Ot=Jt}},o.unstable_pauseExecution=function(){},o.unstable_requestPaint=Zt,o.unstable_runWithPriority=function(Wt,$t){switch(Wt){case 1:case 2:case 3:case 4:case 5:break;default:Wt=3}var Jt=Ot;Ot=Wt;try{return $t()}finally{Ot=Jt}},o.unstable_scheduleCallback=function(Wt,$t,Jt){var Nt=o.unstable_now();switch(typeof Jt=="object"&&Jt!==null?(Jt=Jt.delay,Jt=typeof Jt=="number"&&0<Jt?Nt+Jt:Nt):Jt=Nt,Wt){case 1:var Lt=-1;break;case 2:Lt=250;break;case 5:Lt=1073741823;break;case 4:Lt=1e4;break;default:Lt=5e3}return Lt=Jt+Lt,Wt={id:It++,callback:$t,priorityLevel:Wt,startTime:Jt,expirationTime:Lt,sortIndex:-1},Jt>Nt?(Wt.sortIndex=Jt,gt(xt,Wt),vt(Ct)===null&&Wt===vt(xt)&&(Ft?_e():Ft=!0,_(Qt,Jt-Nt))):(Wt.sortIndex=Lt,gt(Ct,Wt),jt||Mt||(jt=!0,s(Ht))),Wt},o.unstable_wrapCallback=function(Wt){var $t=Ot;return function(){var Jt=Ot;Ot=$t;try{return Wt.apply(this,arguments)}finally{Ot=Jt}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;/** @license React v17.0.2
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var aa=react.exports,m$2=objectAssign,r$1=scheduler.exports;function y$1(o){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+o,_=1;_<arguments.length;_++)s+="&args[]="+encodeURIComponent(arguments[_]);return"Minified React error #"+o+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!aa)throw Error(y$1(227));var ba=new Set,ca={};function da(o,s){ea(o,s),ea(o+"Capture",s)}function ea(o,s){for(ca[o]=s,o=0;o<s.length;o++)ba.add(s[o])}var fa=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),ha=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ia=Object.prototype.hasOwnProperty,ja={},ka={};function la(o){return ia.call(ka,o)?!0:ia.call(ja,o)?!1:ha.test(o)?ka[o]=!0:(ja[o]=!0,!1)}function ma(o,s,_,_e){if(_!==null&&_.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return _e?!1:_!==null?!_.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function na(o,s,_,_e){if(s===null||typeof s=="undefined"||ma(o,s,_,_e))return!0;if(_e)return!1;if(_!==null)switch(_.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function B(o,s,_,_e,et,it,tt){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=_e,this.attributeNamespace=et,this.mustUseProperty=_,this.propertyName=o,this.type=s,this.sanitizeURL=it,this.removeEmptyString=tt}var D={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){D[o]=new B(o,0,!1,o,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var s=o[0];D[s]=new B(s,1,!1,o[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(o){D[o]=new B(o,2,!1,o.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){D[o]=new B(o,2,!1,o,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o){D[o]=new B(o,3,!1,o.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(o){D[o]=new B(o,3,!0,o,null,!1,!1)});["capture","download"].forEach(function(o){D[o]=new B(o,4,!1,o,null,!1,!1)});["cols","rows","size","span"].forEach(function(o){D[o]=new B(o,6,!1,o,null,!1,!1)});["rowSpan","start"].forEach(function(o){D[o]=new B(o,5,!1,o.toLowerCase(),null,!1,!1)});var oa=/[\-:]([a-z])/g;function pa(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var s=o.replace(oa,pa);D[s]=new B(s,1,!1,o,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var s=o.replace(oa,pa);D[s]=new B(s,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(o){var s=o.replace(oa,pa);D[s]=new B(s,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(o){D[o]=new B(o,1,!1,o.toLowerCase(),null,!1,!1)});D.xlinkHref=new B("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(o){D[o]=new B(o,1,!1,o.toLowerCase(),null,!0,!0)});function qa(o,s,_,_e){var et=D.hasOwnProperty(s)?D[s]:null,it=et!==null?et.type===0:_e?!1:!(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N");it||(na(s,_,et,_e)&&(_=null),_e||et===null?la(s)&&(_===null?o.removeAttribute(s):o.setAttribute(s,""+_)):et.mustUseProperty?o[et.propertyName]=_===null?et.type===3?!1:"":_:(s=et.attributeName,_e=et.attributeNamespace,_===null?o.removeAttribute(s):(et=et.type,_=et===3||et===4&&_===!0?"":""+_,_e?o.setAttributeNS(_e,s,_):o.setAttribute(s,_))))}var ra=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,sa=60103,ta=60106,ua=60107,wa=60108,xa=60114,ya=60109,za=60110,Aa=60112,Ba=60113,Ca=60120,Da=60115,Ea=60116,Fa=60121,Ga=60128,Ha=60129,Ia=60130,Ja=60131;if(typeof Symbol=="function"&&Symbol.for){var E$1=Symbol.for;sa=E$1("react.element"),ta=E$1("react.portal"),ua=E$1("react.fragment"),wa=E$1("react.strict_mode"),xa=E$1("react.profiler"),ya=E$1("react.provider"),za=E$1("react.context"),Aa=E$1("react.forward_ref"),Ba=E$1("react.suspense"),Ca=E$1("react.suspense_list"),Da=E$1("react.memo"),Ea=E$1("react.lazy"),Fa=E$1("react.block"),E$1("react.scope"),Ga=E$1("react.opaque.id"),Ha=E$1("react.debug_trace_mode"),Ia=E$1("react.offscreen"),Ja=E$1("react.legacy_hidden")}var Ka=typeof Symbol=="function"&&Symbol.iterator;function La(o){return o===null||typeof o!="object"?null:(o=Ka&&o[Ka]||o["@@iterator"],typeof o=="function"?o:null)}var Ma;function Na(o){if(Ma===void 0)try{throw Error()}catch(_){var s=_.stack.trim().match(/\n( *(at )?)/);Ma=s&&s[1]||""}return`
`+Ma+o}var Oa=!1;function Pa(o,s){if(!o||Oa)return"";Oa=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(nt){var _e=nt}Reflect.construct(o,[],s)}else{try{s.call()}catch(nt){_e=nt}o.call(s.prototype)}else{try{throw Error()}catch(nt){_e=nt}o()}}catch(nt){if(nt&&_e&&typeof nt.stack=="string"){for(var et=nt.stack.split(`
`),it=_e.stack.split(`
`),tt=et.length-1,rt=it.length-1;1<=tt&&0<=rt&&et[tt]!==it[rt];)rt--;for(;1<=tt&&0<=rt;tt--,rt--)if(et[tt]!==it[rt]){if(tt!==1||rt!==1)do if(tt--,rt--,0>rt||et[tt]!==it[rt])return`
`+et[tt].replace(" at new "," at ");while(1<=tt&&0<=rt);break}}}finally{Oa=!1,Error.prepareStackTrace=_}return(o=o?o.displayName||o.name:"")?Na(o):""}function Qa(o){switch(o.tag){case 5:return Na(o.type);case 16:return Na("Lazy");case 13:return Na("Suspense");case 19:return Na("SuspenseList");case 0:case 2:case 15:return o=Pa(o.type,!1),o;case 11:return o=Pa(o.type.render,!1),o;case 22:return o=Pa(o.type._render,!1),o;case 1:return o=Pa(o.type,!0),o;default:return""}}function Ra(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case ua:return"Fragment";case ta:return"Portal";case xa:return"Profiler";case wa:return"StrictMode";case Ba:return"Suspense";case Ca:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case za:return(o.displayName||"Context")+".Consumer";case ya:return(o._context.displayName||"Context")+".Provider";case Aa:var s=o.render;return s=s.displayName||s.name||"",o.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case Da:return Ra(o.type);case Fa:return Ra(o._render);case Ea:s=o._payload,o=o._init;try{return Ra(o(s))}catch{}}return null}function Sa(o){switch(typeof o){case"boolean":case"number":case"object":case"string":case"undefined":return o;default:return""}}function Ta(o){var s=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Ua(o){var s=Ta(o)?"checked":"value",_=Object.getOwnPropertyDescriptor(o.constructor.prototype,s),_e=""+o[s];if(!o.hasOwnProperty(s)&&typeof _!="undefined"&&typeof _.get=="function"&&typeof _.set=="function"){var et=_.get,it=_.set;return Object.defineProperty(o,s,{configurable:!0,get:function(){return et.call(this)},set:function(tt){_e=""+tt,it.call(this,tt)}}),Object.defineProperty(o,s,{enumerable:_.enumerable}),{getValue:function(){return _e},setValue:function(tt){_e=""+tt},stopTracking:function(){o._valueTracker=null,delete o[s]}}}}function Va(o){o._valueTracker||(o._valueTracker=Ua(o))}function Wa(o){if(!o)return!1;var s=o._valueTracker;if(!s)return!0;var _=s.getValue(),_e="";return o&&(_e=Ta(o)?o.checked?"true":"false":o.value),o=_e,o!==_?(s.setValue(o),!0):!1}function Xa(o){if(o=o||(typeof document!="undefined"?document:void 0),typeof o=="undefined")return null;try{return o.activeElement||o.body}catch{return o.body}}function Ya(o,s){var _=s.checked;return m$2({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:_!=null?_:o._wrapperState.initialChecked})}function Za(o,s){var _=s.defaultValue==null?"":s.defaultValue,_e=s.checked!=null?s.checked:s.defaultChecked;_=Sa(s.value!=null?s.value:_),o._wrapperState={initialChecked:_e,initialValue:_,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function $a(o,s){s=s.checked,s!=null&&qa(o,"checked",s,!1)}function ab(o,s){$a(o,s);var _=Sa(s.value),_e=s.type;if(_!=null)_e==="number"?(_===0&&o.value===""||o.value!=_)&&(o.value=""+_):o.value!==""+_&&(o.value=""+_);else if(_e==="submit"||_e==="reset"){o.removeAttribute("value");return}s.hasOwnProperty("value")?bb(o,s.type,_):s.hasOwnProperty("defaultValue")&&bb(o,s.type,Sa(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(o.defaultChecked=!!s.defaultChecked)}function cb(o,s,_){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var _e=s.type;if(!(_e!=="submit"&&_e!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+o._wrapperState.initialValue,_||s===o.value||(o.value=s),o.defaultValue=s}_=o.name,_!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,_!==""&&(o.name=_)}function bb(o,s,_){(s!=="number"||Xa(o.ownerDocument)!==o)&&(_==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+_&&(o.defaultValue=""+_))}function db(o){var s="";return aa.Children.forEach(o,function(_){_!=null&&(s+=_)}),s}function eb(o,s){return o=m$2({children:void 0},s),(s=db(s.children))&&(o.children=s),o}function fb(o,s,_,_e){if(o=o.options,s){s={};for(var et=0;et<_.length;et++)s["$"+_[et]]=!0;for(_=0;_<o.length;_++)et=s.hasOwnProperty("$"+o[_].value),o[_].selected!==et&&(o[_].selected=et),et&&_e&&(o[_].defaultSelected=!0)}else{for(_=""+Sa(_),s=null,et=0;et<o.length;et++){if(o[et].value===_){o[et].selected=!0,_e&&(o[et].defaultSelected=!0);return}s!==null||o[et].disabled||(s=o[et])}s!==null&&(s.selected=!0)}}function gb(o,s){if(s.dangerouslySetInnerHTML!=null)throw Error(y$1(91));return m$2({},s,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function hb(o,s){var _=s.value;if(_==null){if(_=s.children,s=s.defaultValue,_!=null){if(s!=null)throw Error(y$1(92));if(Array.isArray(_)){if(!(1>=_.length))throw Error(y$1(93));_=_[0]}s=_}s==null&&(s=""),_=s}o._wrapperState={initialValue:Sa(_)}}function ib(o,s){var _=Sa(s.value),_e=Sa(s.defaultValue);_!=null&&(_=""+_,_!==o.value&&(o.value=_),s.defaultValue==null&&o.defaultValue!==_&&(o.defaultValue=_)),_e!=null&&(o.defaultValue=""+_e)}function jb(o){var s=o.textContent;s===o._wrapperState.initialValue&&s!==""&&s!==null&&(o.value=s)}var kb={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function lb(o){switch(o){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function mb(o,s){return o==null||o==="http://www.w3.org/1999/xhtml"?lb(s):o==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var nb,ob=function(o){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(s,_,_e,et){MSApp.execUnsafeLocalFunction(function(){return o(s,_,_e,et)})}:o}(function(o,s){if(o.namespaceURI!==kb.svg||"innerHTML"in o)o.innerHTML=s;else{for(nb=nb||document.createElement("div"),nb.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=nb.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;s.firstChild;)o.appendChild(s.firstChild)}});function pb(o,s){if(s){var _=o.firstChild;if(_&&_===o.lastChild&&_.nodeType===3){_.nodeValue=s;return}}o.textContent=s}var qb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=["Webkit","ms","Moz","O"];Object.keys(qb).forEach(function(o){rb.forEach(function(s){s=s+o.charAt(0).toUpperCase()+o.substring(1),qb[s]=qb[o]})});function sb(o,s,_){return s==null||typeof s=="boolean"||s===""?"":_||typeof s!="number"||s===0||qb.hasOwnProperty(o)&&qb[o]?(""+s).trim():s+"px"}function tb(o,s){o=o.style;for(var _ in s)if(s.hasOwnProperty(_)){var _e=_.indexOf("--")===0,et=sb(_,s[_],_e);_==="float"&&(_="cssFloat"),_e?o.setProperty(_,et):o[_]=et}}var ub=m$2({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vb(o,s){if(s){if(ub[o]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(y$1(137,o));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(y$1(60));if(!(typeof s.dangerouslySetInnerHTML=="object"&&"__html"in s.dangerouslySetInnerHTML))throw Error(y$1(61))}if(s.style!=null&&typeof s.style!="object")throw Error(y$1(62))}}function wb(o,s){if(o.indexOf("-")===-1)return typeof s.is=="string";switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function xb(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var yb=null,zb=null,Ab=null;function Bb(o){if(o=Cb(o)){if(typeof yb!="function")throw Error(y$1(280));var s=o.stateNode;s&&(s=Db(s),yb(o.stateNode,o.type,s))}}function Eb(o){zb?Ab?Ab.push(o):Ab=[o]:zb=o}function Fb(){if(zb){var o=zb,s=Ab;if(Ab=zb=null,Bb(o),s)for(o=0;o<s.length;o++)Bb(s[o])}}function Gb(o,s){return o(s)}function Hb(o,s,_,_e,et){return o(s,_,_e,et)}function Ib(){}var Jb=Gb,Kb=!1,Lb=!1;function Mb(){(zb!==null||Ab!==null)&&(Ib(),Fb())}function Nb(o,s,_){if(Lb)return o(s,_);Lb=!0;try{return Jb(o,s,_)}finally{Lb=!1,Mb()}}function Ob(o,s){var _=o.stateNode;if(_===null)return null;var _e=Db(_);if(_e===null)return null;_=_e[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(_e=!_e.disabled)||(o=o.type,_e=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!_e;break e;default:o=!1}if(o)return null;if(_&&typeof _!="function")throw Error(y$1(231,s,typeof _));return _}var Pb=!1;if(fa)try{var Qb={};Object.defineProperty(Qb,"passive",{get:function(){Pb=!0}}),window.addEventListener("test",Qb,Qb),window.removeEventListener("test",Qb,Qb)}catch{Pb=!1}function Rb(o,s,_,_e,et,it,tt,rt,nt){var ot=Array.prototype.slice.call(arguments,3);try{s.apply(_,ot)}catch(st){this.onError(st)}}var Sb=!1,Tb=null,Ub=!1,Vb=null,Wb={onError:function(o){Sb=!0,Tb=o}};function Xb(o,s,_,_e,et,it,tt,rt,nt){Sb=!1,Tb=null,Rb.apply(Wb,arguments)}function Yb(o,s,_,_e,et,it,tt,rt,nt){if(Xb.apply(this,arguments),Sb){if(Sb){var ot=Tb;Sb=!1,Tb=null}else throw Error(y$1(198));Ub||(Ub=!0,Vb=ot)}}function Zb(o){var s=o,_=o;if(o.alternate)for(;s.return;)s=s.return;else{o=s;do s=o,(s.flags&1026)!==0&&(_=s.return),o=s.return;while(o)}return s.tag===3?_:null}function $b(o){if(o.tag===13){var s=o.memoizedState;if(s===null&&(o=o.alternate,o!==null&&(s=o.memoizedState)),s!==null)return s.dehydrated}return null}function ac(o){if(Zb(o)!==o)throw Error(y$1(188))}function bc(o){var s=o.alternate;if(!s){if(s=Zb(o),s===null)throw Error(y$1(188));return s!==o?null:o}for(var _=o,_e=s;;){var et=_.return;if(et===null)break;var it=et.alternate;if(it===null){if(_e=et.return,_e!==null){_=_e;continue}break}if(et.child===it.child){for(it=et.child;it;){if(it===_)return ac(et),o;if(it===_e)return ac(et),s;it=it.sibling}throw Error(y$1(188))}if(_.return!==_e.return)_=et,_e=it;else{for(var tt=!1,rt=et.child;rt;){if(rt===_){tt=!0,_=et,_e=it;break}if(rt===_e){tt=!0,_e=et,_=it;break}rt=rt.sibling}if(!tt){for(rt=it.child;rt;){if(rt===_){tt=!0,_=it,_e=et;break}if(rt===_e){tt=!0,_e=it,_=et;break}rt=rt.sibling}if(!tt)throw Error(y$1(189))}}if(_.alternate!==_e)throw Error(y$1(190))}if(_.tag!==3)throw Error(y$1(188));return _.stateNode.current===_?o:s}function cc(o){if(o=bc(o),!o)return null;for(var s=o;;){if(s.tag===5||s.tag===6)return s;if(s.child)s.child.return=s,s=s.child;else{if(s===o)break;for(;!s.sibling;){if(!s.return||s.return===o)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}}return null}function dc(o,s){for(var _=o.alternate;s!==null;){if(s===o||s===_)return!0;s=s.return}return!1}var ec,fc,gc,hc,ic=!1,jc=[],kc=null,lc=null,mc=null,nc=new Map,oc=new Map,pc=[],qc="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function rc(o,s,_,_e,et){return{blockedOn:o,domEventName:s,eventSystemFlags:_|16,nativeEvent:et,targetContainers:[_e]}}function sc(o,s){switch(o){case"focusin":case"focusout":kc=null;break;case"dragenter":case"dragleave":lc=null;break;case"mouseover":case"mouseout":mc=null;break;case"pointerover":case"pointerout":nc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":oc.delete(s.pointerId)}}function tc(o,s,_,_e,et,it){return o===null||o.nativeEvent!==it?(o=rc(s,_,_e,et,it),s!==null&&(s=Cb(s),s!==null&&fc(s)),o):(o.eventSystemFlags|=_e,s=o.targetContainers,et!==null&&s.indexOf(et)===-1&&s.push(et),o)}function uc(o,s,_,_e,et){switch(s){case"focusin":return kc=tc(kc,o,s,_,_e,et),!0;case"dragenter":return lc=tc(lc,o,s,_,_e,et),!0;case"mouseover":return mc=tc(mc,o,s,_,_e,et),!0;case"pointerover":var it=et.pointerId;return nc.set(it,tc(nc.get(it)||null,o,s,_,_e,et)),!0;case"gotpointercapture":return it=et.pointerId,oc.set(it,tc(oc.get(it)||null,o,s,_,_e,et)),!0}return!1}function vc(o){var s=wc(o.target);if(s!==null){var _=Zb(s);if(_!==null){if(s=_.tag,s===13){if(s=$b(_),s!==null){o.blockedOn=s,hc(o.lanePriority,function(){r$1.unstable_runWithPriority(o.priority,function(){gc(_)})});return}}else if(s===3&&_.stateNode.hydrate){o.blockedOn=_.tag===3?_.stateNode.containerInfo:null;return}}}o.blockedOn=null}function xc(o){if(o.blockedOn!==null)return!1;for(var s=o.targetContainers;0<s.length;){var _=yc(o.domEventName,o.eventSystemFlags,s[0],o.nativeEvent);if(_!==null)return s=Cb(_),s!==null&&fc(s),o.blockedOn=_,!1;s.shift()}return!0}function zc(o,s,_){xc(o)&&_.delete(s)}function Ac(){for(ic=!1;0<jc.length;){var o=jc[0];if(o.blockedOn!==null){o=Cb(o.blockedOn),o!==null&&ec(o);break}for(var s=o.targetContainers;0<s.length;){var _=yc(o.domEventName,o.eventSystemFlags,s[0],o.nativeEvent);if(_!==null){o.blockedOn=_;break}s.shift()}o.blockedOn===null&&jc.shift()}kc!==null&&xc(kc)&&(kc=null),lc!==null&&xc(lc)&&(lc=null),mc!==null&&xc(mc)&&(mc=null),nc.forEach(zc),oc.forEach(zc)}function Bc(o,s){o.blockedOn===s&&(o.blockedOn=null,ic||(ic=!0,r$1.unstable_scheduleCallback(r$1.unstable_NormalPriority,Ac)))}function Cc(o){function s(et){return Bc(et,o)}if(0<jc.length){Bc(jc[0],o);for(var _=1;_<jc.length;_++){var _e=jc[_];_e.blockedOn===o&&(_e.blockedOn=null)}}for(kc!==null&&Bc(kc,o),lc!==null&&Bc(lc,o),mc!==null&&Bc(mc,o),nc.forEach(s),oc.forEach(s),_=0;_<pc.length;_++)_e=pc[_],_e.blockedOn===o&&(_e.blockedOn=null);for(;0<pc.length&&(_=pc[0],_.blockedOn===null);)vc(_),_.blockedOn===null&&pc.shift()}function Dc(o,s){var _={};return _[o.toLowerCase()]=s.toLowerCase(),_["Webkit"+o]="webkit"+s,_["Moz"+o]="moz"+s,_}var Ec={animationend:Dc("Animation","AnimationEnd"),animationiteration:Dc("Animation","AnimationIteration"),animationstart:Dc("Animation","AnimationStart"),transitionend:Dc("Transition","TransitionEnd")},Fc={},Gc={};fa&&(Gc=document.createElement("div").style,"AnimationEvent"in window||(delete Ec.animationend.animation,delete Ec.animationiteration.animation,delete Ec.animationstart.animation),"TransitionEvent"in window||delete Ec.transitionend.transition);function Hc(o){if(Fc[o])return Fc[o];if(!Ec[o])return o;var s=Ec[o],_;for(_ in s)if(s.hasOwnProperty(_)&&_ in Gc)return Fc[o]=s[_];return o}var Ic=Hc("animationend"),Jc=Hc("animationiteration"),Kc=Hc("animationstart"),Lc=Hc("transitionend"),Mc=new Map,Nc=new Map,Oc=["abort","abort",Ic,"animationEnd",Jc,"animationIteration",Kc,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Lc,"transitionEnd","waiting","waiting"];function Pc(o,s){for(var _=0;_<o.length;_+=2){var _e=o[_],et=o[_+1];et="on"+(et[0].toUpperCase()+et.slice(1)),Nc.set(_e,s),Mc.set(_e,et),da(et,[_e])}}var Qc=r$1.unstable_now;Qc();var F$1=8;function Rc(o){if((1&o)!==0)return F$1=15,1;if((2&o)!==0)return F$1=14,2;if((4&o)!==0)return F$1=13,4;var s=24&o;return s!==0?(F$1=12,s):(o&32)!==0?(F$1=11,32):(s=192&o,s!==0?(F$1=10,s):(o&256)!==0?(F$1=9,256):(s=3584&o,s!==0?(F$1=8,s):(o&4096)!==0?(F$1=7,4096):(s=4186112&o,s!==0?(F$1=6,s):(s=62914560&o,s!==0?(F$1=5,s):o&67108864?(F$1=4,67108864):(o&134217728)!==0?(F$1=3,134217728):(s=805306368&o,s!==0?(F$1=2,s):(1073741824&o)!==0?(F$1=1,1073741824):(F$1=8,o))))))}function Sc(o){switch(o){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function Tc(o){switch(o){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(y$1(358,o))}}function Uc(o,s){var _=o.pendingLanes;if(_===0)return F$1=0;var _e=0,et=0,it=o.expiredLanes,tt=o.suspendedLanes,rt=o.pingedLanes;if(it!==0)_e=it,et=F$1=15;else if(it=_&134217727,it!==0){var nt=it&~tt;nt!==0?(_e=Rc(nt),et=F$1):(rt&=it,rt!==0&&(_e=Rc(rt),et=F$1))}else it=_&~tt,it!==0?(_e=Rc(it),et=F$1):rt!==0&&(_e=Rc(rt),et=F$1);if(_e===0)return 0;if(_e=31-Vc(_e),_e=_&((0>_e?0:1<<_e)<<1)-1,s!==0&&s!==_e&&(s&tt)===0){if(Rc(s),et<=F$1)return s;F$1=et}if(s=o.entangledLanes,s!==0)for(o=o.entanglements,s&=_e;0<s;)_=31-Vc(s),et=1<<_,_e|=o[_],s&=~et;return _e}function Wc(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Xc(o,s){switch(o){case 15:return 1;case 14:return 2;case 12:return o=Yc(24&~s),o===0?Xc(10,s):o;case 10:return o=Yc(192&~s),o===0?Xc(8,s):o;case 8:return o=Yc(3584&~s),o===0&&(o=Yc(4186112&~s),o===0&&(o=512)),o;case 2:return s=Yc(805306368&~s),s===0&&(s=268435456),s}throw Error(y$1(358,o))}function Yc(o){return o&-o}function Zc(o){for(var s=[],_=0;31>_;_++)s.push(o);return s}function $c(o,s,_){o.pendingLanes|=s;var _e=s-1;o.suspendedLanes&=_e,o.pingedLanes&=_e,o=o.eventTimes,s=31-Vc(s),o[s]=_}var Vc=Math.clz32?Math.clz32:ad,bd=Math.log,cd=Math.LN2;function ad(o){return o===0?32:31-(bd(o)/cd|0)|0}var dd=r$1.unstable_UserBlockingPriority,ed=r$1.unstable_runWithPriority,fd=!0;function gd(o,s,_,_e){Kb||Ib();var et=hd,it=Kb;Kb=!0;try{Hb(et,o,s,_,_e)}finally{(Kb=it)||Mb()}}function id(o,s,_,_e){ed(dd,hd.bind(null,o,s,_,_e))}function hd(o,s,_,_e){if(fd){var et;if((et=(s&4)===0)&&0<jc.length&&-1<qc.indexOf(o))o=rc(null,o,s,_,_e),jc.push(o);else{var it=yc(o,s,_,_e);if(it===null)et&&sc(o,_e);else{if(et){if(-1<qc.indexOf(o)){o=rc(it,o,s,_,_e),jc.push(o);return}if(uc(it,o,s,_,_e))return;sc(o,_e)}jd(o,s,_e,null,_)}}}}function yc(o,s,_,_e){var et=xb(_e);if(et=wc(et),et!==null){var it=Zb(et);if(it===null)et=null;else{var tt=it.tag;if(tt===13){if(et=$b(it),et!==null)return et;et=null}else if(tt===3){if(it.stateNode.hydrate)return it.tag===3?it.stateNode.containerInfo:null;et=null}else it!==et&&(et=null)}}return jd(o,s,_e,et,_),null}var kd=null,ld=null,md=null;function nd(){if(md)return md;var o,s=ld,_=s.length,_e,et="value"in kd?kd.value:kd.textContent,it=et.length;for(o=0;o<_&&s[o]===et[o];o++);var tt=_-o;for(_e=1;_e<=tt&&s[_-_e]===et[it-_e];_e++);return md=et.slice(o,1<_e?1-_e:void 0)}function od(o){var s=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&s===13&&(o=13)):o=s,o===10&&(o=13),32<=o||o===13?o:0}function pd$1(){return!0}function qd(){return!1}function rd(o){function s(_,_e,et,it,tt){this._reactName=_,this._targetInst=et,this.type=_e,this.nativeEvent=it,this.target=tt,this.currentTarget=null;for(var rt in o)o.hasOwnProperty(rt)&&(_=o[rt],this[rt]=_?_(it):it[rt]);return this.isDefaultPrevented=(it.defaultPrevented!=null?it.defaultPrevented:it.returnValue===!1)?pd$1:qd,this.isPropagationStopped=qd,this}return m$2(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var _=this.nativeEvent;_&&(_.preventDefault?_.preventDefault():typeof _.returnValue!="unknown"&&(_.returnValue=!1),this.isDefaultPrevented=pd$1)},stopPropagation:function(){var _=this.nativeEvent;_&&(_.stopPropagation?_.stopPropagation():typeof _.cancelBubble!="unknown"&&(_.cancelBubble=!0),this.isPropagationStopped=pd$1)},persist:function(){},isPersistent:pd$1}),s}var sd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},td=rd(sd),ud=m$2({},sd,{view:0,detail:0}),vd=rd(ud),wd,xd,yd,Ad=m$2({},ud,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zd,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==yd&&(yd&&o.type==="mousemove"?(wd=o.screenX-yd.screenX,xd=o.screenY-yd.screenY):xd=wd=0,yd=o),wd)},movementY:function(o){return"movementY"in o?o.movementY:xd}}),Bd=rd(Ad),Cd=m$2({},Ad,{dataTransfer:0}),Dd=rd(Cd),Ed=m$2({},ud,{relatedTarget:0}),Fd=rd(Ed),Gd=m$2({},sd,{animationName:0,elapsedTime:0,pseudoElement:0}),Hd=rd(Gd),Id=m$2({},sd,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),Jd=rd(Id),Kd=m$2({},sd,{data:0}),Ld=rd(Kd),Md={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Od={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pd(o){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(o):(o=Od[o])?!!s[o]:!1}function zd(){return Pd}var Qd=m$2({},ud,{key:function(o){if(o.key){var s=Md[o.key]||o.key;if(s!=="Unidentified")return s}return o.type==="keypress"?(o=od(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?Nd[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zd,charCode:function(o){return o.type==="keypress"?od(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?od(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Rd=rd(Qd),Sd=m$2({},Ad,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Td=rd(Sd),Ud=m$2({},ud,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zd}),Vd=rd(Ud),Wd=m$2({},sd,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xd=rd(Wd),Yd=m$2({},Ad,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),Zd=rd(Yd),$d=[9,13,27,32],ae=fa&&"CompositionEvent"in window,be=null;fa&&"documentMode"in document&&(be=document.documentMode);var ce=fa&&"TextEvent"in window&&!be,de=fa&&(!ae||be&&8<be&&11>=be),ee=String.fromCharCode(32),fe=!1;function ge(o,s){switch(o){case"keyup":return $d.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ie=!1;function je(o,s){switch(o){case"compositionend":return he(s);case"keypress":return s.which!==32?null:(fe=!0,ee);case"textInput":return o=s.data,o===ee&&fe?null:o;default:return null}}function ke(o,s){if(ie)return o==="compositionend"||!ae&&ge(o,s)?(o=nd(),md=ld=kd=null,ie=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return de&&s.locale!=="ko"?null:s.data;default:return null}}var le={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function me(o){var s=o&&o.nodeName&&o.nodeName.toLowerCase();return s==="input"?!!le[o.type]:s==="textarea"}function ne(o,s,_,_e){Eb(_e),s=oe(s,"onChange"),0<s.length&&(_=new td("onChange","change",null,_,_e),o.push({event:_,listeners:s}))}var pe=null,qe=null;function re(o){se(o,0)}function te(o){var s=ue(o);if(Wa(s))return o}function ve(o,s){if(o==="change")return s}var we=!1;if(fa){var xe;if(fa){var ye="oninput"in document;if(!ye){var ze=document.createElement("div");ze.setAttribute("oninput","return;"),ye=typeof ze.oninput=="function"}xe=ye}else xe=!1;we=xe&&(!document.documentMode||9<document.documentMode)}function Ae(){pe&&(pe.detachEvent("onpropertychange",Be),qe=pe=null)}function Be(o){if(o.propertyName==="value"&&te(qe)){var s=[];if(ne(s,qe,o,xb(o)),o=re,Kb)o(s);else{Kb=!0;try{Gb(o,s)}finally{Kb=!1,Mb()}}}}function Ce(o,s,_){o==="focusin"?(Ae(),pe=s,qe=_,pe.attachEvent("onpropertychange",Be)):o==="focusout"&&Ae()}function De(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return te(qe)}function Ee(o,s){if(o==="click")return te(s)}function Fe(o,s){if(o==="input"||o==="change")return te(s)}function Ge(o,s){return o===s&&(o!==0||1/o===1/s)||o!==o&&s!==s}var He=typeof Object.is=="function"?Object.is:Ge,Ie=Object.prototype.hasOwnProperty;function Je(o,s){if(He(o,s))return!0;if(typeof o!="object"||o===null||typeof s!="object"||s===null)return!1;var _=Object.keys(o),_e=Object.keys(s);if(_.length!==_e.length)return!1;for(_e=0;_e<_.length;_e++)if(!Ie.call(s,_[_e])||!He(o[_[_e]],s[_[_e]]))return!1;return!0}function Ke(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Le(o,s){var _=Ke(o);o=0;for(var _e;_;){if(_.nodeType===3){if(_e=o+_.textContent.length,o<=s&&_e>=s)return{node:_,offset:s-o};o=_e}e:{for(;_;){if(_.nextSibling){_=_.nextSibling;break e}_=_.parentNode}_=void 0}_=Ke(_)}}function Me(o,s){return o&&s?o===s?!0:o&&o.nodeType===3?!1:s&&s.nodeType===3?Me(o,s.parentNode):"contains"in o?o.contains(s):o.compareDocumentPosition?!!(o.compareDocumentPosition(s)&16):!1:!1}function Ne(){for(var o=window,s=Xa();s instanceof o.HTMLIFrameElement;){try{var _=typeof s.contentWindow.location.href=="string"}catch{_=!1}if(_)o=s.contentWindow;else break;s=Xa(o.document)}return s}function Oe(o){var s=o&&o.nodeName&&o.nodeName.toLowerCase();return s&&(s==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||s==="textarea"||o.contentEditable==="true")}var Pe=fa&&"documentMode"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(o,s,_){var _e=_.window===_?_.document:_.nodeType===9?_:_.ownerDocument;Te||Qe==null||Qe!==Xa(_e)||(_e=Qe,"selectionStart"in _e&&Oe(_e)?_e={start:_e.selectionStart,end:_e.selectionEnd}:(_e=(_e.ownerDocument&&_e.ownerDocument.defaultView||window).getSelection(),_e={anchorNode:_e.anchorNode,anchorOffset:_e.anchorOffset,focusNode:_e.focusNode,focusOffset:_e.focusOffset}),Se&&Je(Se,_e)||(Se=_e,_e=oe(Re,"onSelect"),0<_e.length&&(s=new td("onSelect","select",null,s,_),o.push({event:s,listeners:_e}),s.target=Qe)))}Pc("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0);Pc("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1);Pc(Oc,2);for(var Ve="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),We=0;We<Ve.length;We++)Nc.set(Ve[We],0);ea("onMouseEnter",["mouseout","mouseover"]);ea("onMouseLeave",["mouseout","mouseover"]);ea("onPointerEnter",["pointerout","pointerover"]);ea("onPointerLeave",["pointerout","pointerover"]);da("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));da("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));da("onBeforeInput",["compositionend","keypress","textInput","paste"]);da("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));da("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));da("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xe="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ye=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xe));function Ze(o,s,_){var _e=o.type||"unknown-event";o.currentTarget=_,Yb(_e,s,void 0,o),o.currentTarget=null}function se(o,s){s=(s&4)!==0;for(var _=0;_<o.length;_++){var _e=o[_],et=_e.event;_e=_e.listeners;e:{var it=void 0;if(s)for(var tt=_e.length-1;0<=tt;tt--){var rt=_e[tt],nt=rt.instance,ot=rt.currentTarget;if(rt=rt.listener,nt!==it&&et.isPropagationStopped())break e;Ze(et,rt,ot),it=nt}else for(tt=0;tt<_e.length;tt++){if(rt=_e[tt],nt=rt.instance,ot=rt.currentTarget,rt=rt.listener,nt!==it&&et.isPropagationStopped())break e;Ze(et,rt,ot),it=nt}}}if(Ub)throw o=Vb,Ub=!1,Vb=null,o}function G(o,s){var _=$e(s),_e=o+"__bubble";_.has(_e)||(af(s,o,2,!1),_.add(_e))}var bf="_reactListening"+Math.random().toString(36).slice(2);function cf(o){o[bf]||(o[bf]=!0,ba.forEach(function(s){Ye.has(s)||df(s,!1,o,null),df(s,!0,o,null)}))}function df(o,s,_,_e){var et=4<arguments.length&&arguments[4]!==void 0?arguments[4]:0,it=_;if(o==="selectionchange"&&_.nodeType!==9&&(it=_.ownerDocument),_e!==null&&!s&&Ye.has(o)){if(o!=="scroll")return;et|=2,it=_e}var tt=$e(it),rt=o+"__"+(s?"capture":"bubble");tt.has(rt)||(s&&(et|=4),af(it,o,et,s),tt.add(rt))}function af(o,s,_,_e){var et=Nc.get(s);switch(et===void 0?2:et){case 0:et=gd;break;case 1:et=id;break;default:et=hd}_=et.bind(null,s,_,o),et=void 0,!Pb||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(et=!0),_e?et!==void 0?o.addEventListener(s,_,{capture:!0,passive:et}):o.addEventListener(s,_,!0):et!==void 0?o.addEventListener(s,_,{passive:et}):o.addEventListener(s,_,!1)}function jd(o,s,_,_e,et){var it=_e;if((s&1)===0&&(s&2)===0&&_e!==null)e:for(;;){if(_e===null)return;var tt=_e.tag;if(tt===3||tt===4){var rt=_e.stateNode.containerInfo;if(rt===et||rt.nodeType===8&&rt.parentNode===et)break;if(tt===4)for(tt=_e.return;tt!==null;){var nt=tt.tag;if((nt===3||nt===4)&&(nt=tt.stateNode.containerInfo,nt===et||nt.nodeType===8&&nt.parentNode===et))return;tt=tt.return}for(;rt!==null;){if(tt=wc(rt),tt===null)return;if(nt=tt.tag,nt===5||nt===6){_e=it=tt;continue e}rt=rt.parentNode}}_e=_e.return}Nb(function(){var ot=it,st=xb(_),at=[];e:{var lt=Mc.get(o);if(lt!==void 0){var ct=td,ht=o;switch(o){case"keypress":if(od(_)===0)break e;case"keydown":case"keyup":ct=Rd;break;case"focusin":ht="focus",ct=Fd;break;case"focusout":ht="blur",ct=Fd;break;case"beforeblur":case"afterblur":ct=Fd;break;case"click":if(_.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ct=Bd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ct=Dd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ct=Vd;break;case Ic:case Jc:case Kc:ct=Hd;break;case Lc:ct=Xd;break;case"scroll":ct=vd;break;case"wheel":ct=Zd;break;case"copy":case"cut":case"paste":ct=Jd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ct=Td}var mt=(s&4)!==0,dt=!mt&&o==="scroll",ft=mt?lt!==null?lt+"Capture":null:lt;mt=[];for(var ut=ot,pt;ut!==null;){pt=ut;var At=pt.stateNode;if(pt.tag===5&&At!==null&&(pt=At,ft!==null&&(At=Ob(ut,ft),At!=null&&mt.push(ef(ut,At,pt)))),dt)break;ut=ut.return}0<mt.length&&(lt=new ct(lt,ht,null,_,st),at.push({event:lt,listeners:mt}))}}if((s&7)===0){e:{if(lt=o==="mouseover"||o==="pointerover",ct=o==="mouseout"||o==="pointerout",lt&&(s&16)===0&&(ht=_.relatedTarget||_.fromElement)&&(wc(ht)||ht[ff]))break e;if((ct||lt)&&(lt=st.window===st?st:(lt=st.ownerDocument)?lt.defaultView||lt.parentWindow:window,ct?(ht=_.relatedTarget||_.toElement,ct=ot,ht=ht?wc(ht):null,ht!==null&&(dt=Zb(ht),ht!==dt||ht.tag!==5&&ht.tag!==6)&&(ht=null)):(ct=null,ht=ot),ct!==ht)){if(mt=Bd,At="onMouseLeave",ft="onMouseEnter",ut="mouse",(o==="pointerout"||o==="pointerover")&&(mt=Td,At="onPointerLeave",ft="onPointerEnter",ut="pointer"),dt=ct==null?lt:ue(ct),pt=ht==null?lt:ue(ht),lt=new mt(At,ut+"leave",ct,_,st),lt.target=dt,lt.relatedTarget=pt,At=null,wc(st)===ot&&(mt=new mt(ft,ut+"enter",ht,_,st),mt.target=pt,mt.relatedTarget=dt,At=mt),dt=At,ct&&ht)t:{for(mt=ct,ft=ht,ut=0,pt=mt;pt;pt=gf(pt))ut++;for(pt=0,At=ft;At;At=gf(At))pt++;for(;0<ut-pt;)mt=gf(mt),ut--;for(;0<pt-ut;)ft=gf(ft),pt--;for(;ut--;){if(mt===ft||ft!==null&&mt===ft.alternate)break t;mt=gf(mt),ft=gf(ft)}mt=null}else mt=null;ct!==null&&hf(at,lt,ct,mt,!1),ht!==null&&dt!==null&&hf(at,dt,ht,mt,!0)}}e:{if(lt=ot?ue(ot):window,ct=lt.nodeName&&lt.nodeName.toLowerCase(),ct==="select"||ct==="input"&&lt.type==="file")var gt=ve;else if(me(lt))if(we)gt=Fe;else{gt=De;var vt=Ce}else(ct=lt.nodeName)&&ct.toLowerCase()==="input"&&(lt.type==="checkbox"||lt.type==="radio")&&(gt=Ee);if(gt&&(gt=gt(o,ot))){ne(at,gt,_,st);break e}vt&&vt(o,lt,ot),o==="focusout"&&(vt=lt._wrapperState)&&vt.controlled&&lt.type==="number"&&bb(lt,"number",lt.value)}switch(vt=ot?ue(ot):window,o){case"focusin":(me(vt)||vt.contentEditable==="true")&&(Qe=vt,Re=ot,Se=null);break;case"focusout":Se=Re=Qe=null;break;case"mousedown":Te=!0;break;case"contextmenu":case"mouseup":case"dragend":Te=!1,Ue(at,_,st);break;case"selectionchange":if(Pe)break;case"keydown":case"keyup":Ue(at,_,st)}var yt;if(ae)e:{switch(o){case"compositionstart":var bt="onCompositionStart";break e;case"compositionend":bt="onCompositionEnd";break e;case"compositionupdate":bt="onCompositionUpdate";break e}bt=void 0}else ie?ge(o,_)&&(bt="onCompositionEnd"):o==="keydown"&&_.keyCode===229&&(bt="onCompositionStart");bt&&(de&&_.locale!=="ko"&&(ie||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&ie&&(yt=nd()):(kd=st,ld="value"in kd?kd.value:kd.textContent,ie=!0)),vt=oe(ot,bt),0<vt.length&&(bt=new Ld(bt,o,null,_,st),at.push({event:bt,listeners:vt}),yt?bt.data=yt:(yt=he(_),yt!==null&&(bt.data=yt)))),(yt=ce?je(o,_):ke(o,_))&&(ot=oe(ot,"onBeforeInput"),0<ot.length&&(st=new Ld("onBeforeInput","beforeinput",null,_,st),at.push({event:st,listeners:ot}),st.data=yt))}se(at,s)})}function ef(o,s,_){return{instance:o,listener:s,currentTarget:_}}function oe(o,s){for(var _=s+"Capture",_e=[];o!==null;){var et=o,it=et.stateNode;et.tag===5&&it!==null&&(et=it,it=Ob(o,_),it!=null&&_e.unshift(ef(o,it,et)),it=Ob(o,s),it!=null&&_e.push(ef(o,it,et))),o=o.return}return _e}function gf(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function hf(o,s,_,_e,et){for(var it=s._reactName,tt=[];_!==null&&_!==_e;){var rt=_,nt=rt.alternate,ot=rt.stateNode;if(nt!==null&&nt===_e)break;rt.tag===5&&ot!==null&&(rt=ot,et?(nt=Ob(_,it),nt!=null&&tt.unshift(ef(_,nt,rt))):et||(nt=Ob(_,it),nt!=null&&tt.push(ef(_,nt,rt)))),_=_.return}tt.length!==0&&o.push({event:s,listeners:tt})}function jf(){}var kf=null,lf=null;function mf(o,s){switch(o){case"button":case"input":case"select":case"textarea":return!!s.autoFocus}return!1}function nf(o,s){return o==="textarea"||o==="option"||o==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var of=typeof setTimeout=="function"?setTimeout:void 0,pf=typeof clearTimeout=="function"?clearTimeout:void 0;function qf(o){o.nodeType===1?o.textContent="":o.nodeType===9&&(o=o.body,o!=null&&(o.textContent=""))}function rf(o){for(;o!=null;o=o.nextSibling){var s=o.nodeType;if(s===1||s===3)break}return o}function sf(o){o=o.previousSibling;for(var s=0;o;){if(o.nodeType===8){var _=o.data;if(_==="$"||_==="$!"||_==="$?"){if(s===0)return o;s--}else _==="/$"&&s++}o=o.previousSibling}return null}var tf=0;function uf(o){return{$$typeof:Ga,toString:o,valueOf:o}}var vf=Math.random().toString(36).slice(2),wf="__reactFiber$"+vf,xf="__reactProps$"+vf,ff="__reactContainer$"+vf,yf="__reactEvents$"+vf;function wc(o){var s=o[wf];if(s)return s;for(var _=o.parentNode;_;){if(s=_[ff]||_[wf]){if(_=s.alternate,s.child!==null||_!==null&&_.child!==null)for(o=sf(o);o!==null;){if(_=o[wf])return _;o=sf(o)}return s}o=_,_=o.parentNode}return null}function Cb(o){return o=o[wf]||o[ff],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function ue(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(y$1(33))}function Db(o){return o[xf]||null}function $e(o){var s=o[yf];return s===void 0&&(s=o[yf]=new Set),s}var zf=[],Af=-1;function Bf(o){return{current:o}}function H(o){0>Af||(o.current=zf[Af],zf[Af]=null,Af--)}function I(o,s){Af++,zf[Af]=o.current,o.current=s}var Cf={},M=Bf(Cf),N=Bf(!1),Df=Cf;function Ef(o,s){var _=o.type.contextTypes;if(!_)return Cf;var _e=o.stateNode;if(_e&&_e.__reactInternalMemoizedUnmaskedChildContext===s)return _e.__reactInternalMemoizedMaskedChildContext;var et={},it;for(it in _)et[it]=s[it];return _e&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=s,o.__reactInternalMemoizedMaskedChildContext=et),et}function Ff(o){return o=o.childContextTypes,o!=null}function Gf(){H(N),H(M)}function Hf(o,s,_){if(M.current!==Cf)throw Error(y$1(168));I(M,s),I(N,_)}function If(o,s,_){var _e=o.stateNode;if(o=s.childContextTypes,typeof _e.getChildContext!="function")return _;_e=_e.getChildContext();for(var et in _e)if(!(et in o))throw Error(y$1(108,Ra(s)||"Unknown",et));return m$2({},_,_e)}function Jf(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Cf,Df=M.current,I(M,o),I(N,N.current),!0}function Kf(o,s,_){var _e=o.stateNode;if(!_e)throw Error(y$1(169));_?(o=If(o,s,Df),_e.__reactInternalMemoizedMergedChildContext=o,H(N),H(M),I(M,o)):H(N),I(N,_)}var Lf=null,Mf=null,Nf=r$1.unstable_runWithPriority,Of=r$1.unstable_scheduleCallback,Pf=r$1.unstable_cancelCallback,Qf=r$1.unstable_shouldYield,Rf=r$1.unstable_requestPaint,Sf=r$1.unstable_now,Tf=r$1.unstable_getCurrentPriorityLevel,Uf=r$1.unstable_ImmediatePriority,Vf=r$1.unstable_UserBlockingPriority,Wf=r$1.unstable_NormalPriority,Xf=r$1.unstable_LowPriority,Yf=r$1.unstable_IdlePriority,Zf={},$f=Rf!==void 0?Rf:function(){},ag=null,bg=null,cg=!1,dg=Sf(),O=1e4>dg?Sf:function(){return Sf()-dg};function eg(){switch(Tf()){case Uf:return 99;case Vf:return 98;case Wf:return 97;case Xf:return 96;case Yf:return 95;default:throw Error(y$1(332))}}function fg(o){switch(o){case 99:return Uf;case 98:return Vf;case 97:return Wf;case 96:return Xf;case 95:return Yf;default:throw Error(y$1(332))}}function gg(o,s){return o=fg(o),Nf(o,s)}function hg(o,s,_){return o=fg(o),Of(o,s,_)}function ig(){if(bg!==null){var o=bg;bg=null,Pf(o)}jg()}function jg(){if(!cg&&ag!==null){cg=!0;var o=0;try{var s=ag;gg(99,function(){for(;o<s.length;o++){var _=s[o];do _=_(!0);while(_!==null)}}),ag=null}catch(_){throw ag!==null&&(ag=ag.slice(o+1)),Of(Uf,ig),_}finally{cg=!1}}}var kg=ra.ReactCurrentBatchConfig;function lg(o,s){if(o&&o.defaultProps){s=m$2({},s),o=o.defaultProps;for(var _ in o)s[_]===void 0&&(s[_]=o[_]);return s}return s}var mg=Bf(null),ng=null,og=null,pg=null;function qg(){pg=og=ng=null}function rg(o){var s=mg.current;H(mg),o.type._context._currentValue=s}function sg(o,s){for(;o!==null;){var _=o.alternate;if((o.childLanes&s)===s){if(_===null||(_.childLanes&s)===s)break;_.childLanes|=s}else o.childLanes|=s,_!==null&&(_.childLanes|=s);o=o.return}}function tg(o,s){ng=o,pg=og=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&s)!==0&&(ug=!0),o.firstContext=null)}function vg(o,s){if(pg!==o&&s!==!1&&s!==0)if((typeof s!="number"||s===1073741823)&&(pg=o,s=1073741823),s={context:o,observedBits:s,next:null},og===null){if(ng===null)throw Error(y$1(308));og=s,ng.dependencies={lanes:0,firstContext:s,responders:null}}else og=og.next=s;return o._currentValue}var wg=!1;function xg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function yg(o,s){o=o.updateQueue,s.updateQueue===o&&(s.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function zg(o,s){return{eventTime:o,lane:s,tag:0,payload:null,callback:null,next:null}}function Ag(o,s){if(o=o.updateQueue,o!==null){o=o.shared;var _=o.pending;_===null?s.next=s:(s.next=_.next,_.next=s),o.pending=s}}function Bg(o,s){var _=o.updateQueue,_e=o.alternate;if(_e!==null&&(_e=_e.updateQueue,_===_e)){var et=null,it=null;if(_=_.firstBaseUpdate,_!==null){do{var tt={eventTime:_.eventTime,lane:_.lane,tag:_.tag,payload:_.payload,callback:_.callback,next:null};it===null?et=it=tt:it=it.next=tt,_=_.next}while(_!==null);it===null?et=it=s:it=it.next=s}else et=it=s;_={baseState:_e.baseState,firstBaseUpdate:et,lastBaseUpdate:it,shared:_e.shared,effects:_e.effects},o.updateQueue=_;return}o=_.lastBaseUpdate,o===null?_.firstBaseUpdate=s:o.next=s,_.lastBaseUpdate=s}function Cg(o,s,_,_e){var et=o.updateQueue;wg=!1;var it=et.firstBaseUpdate,tt=et.lastBaseUpdate,rt=et.shared.pending;if(rt!==null){et.shared.pending=null;var nt=rt,ot=nt.next;nt.next=null,tt===null?it=ot:tt.next=ot,tt=nt;var st=o.alternate;if(st!==null){st=st.updateQueue;var at=st.lastBaseUpdate;at!==tt&&(at===null?st.firstBaseUpdate=ot:at.next=ot,st.lastBaseUpdate=nt)}}if(it!==null){at=et.baseState,tt=0,st=ot=nt=null;do{rt=it.lane;var lt=it.eventTime;if((_e&rt)===rt){st!==null&&(st=st.next={eventTime:lt,lane:0,tag:it.tag,payload:it.payload,callback:it.callback,next:null});e:{var ct=o,ht=it;switch(rt=s,lt=_,ht.tag){case 1:if(ct=ht.payload,typeof ct=="function"){at=ct.call(lt,at,rt);break e}at=ct;break e;case 3:ct.flags=ct.flags&-4097|64;case 0:if(ct=ht.payload,rt=typeof ct=="function"?ct.call(lt,at,rt):ct,rt==null)break e;at=m$2({},at,rt);break e;case 2:wg=!0}}it.callback!==null&&(o.flags|=32,rt=et.effects,rt===null?et.effects=[it]:rt.push(it))}else lt={eventTime:lt,lane:rt,tag:it.tag,payload:it.payload,callback:it.callback,next:null},st===null?(ot=st=lt,nt=at):st=st.next=lt,tt|=rt;if(it=it.next,it===null){if(rt=et.shared.pending,rt===null)break;it=rt.next,rt.next=null,et.lastBaseUpdate=rt,et.shared.pending=null}}while(1);st===null&&(nt=at),et.baseState=nt,et.firstBaseUpdate=ot,et.lastBaseUpdate=st,Dg|=tt,o.lanes=tt,o.memoizedState=at}}function Eg(o,s,_){if(o=s.effects,s.effects=null,o!==null)for(s=0;s<o.length;s++){var _e=o[s],et=_e.callback;if(et!==null){if(_e.callback=null,_e=_,typeof et!="function")throw Error(y$1(191,et));et.call(_e)}}}var Fg=new aa.Component().refs;function Gg(o,s,_,_e){s=o.memoizedState,_=_(_e,s),_=_==null?s:m$2({},s,_),o.memoizedState=_,o.lanes===0&&(o.updateQueue.baseState=_)}var Kg={isMounted:function(o){return(o=o._reactInternals)?Zb(o)===o:!1},enqueueSetState:function(o,s,_){o=o._reactInternals;var _e=Hg(),et=Ig(o),it=zg(_e,et);it.payload=s,_!=null&&(it.callback=_),Ag(o,it),Jg(o,et,_e)},enqueueReplaceState:function(o,s,_){o=o._reactInternals;var _e=Hg(),et=Ig(o),it=zg(_e,et);it.tag=1,it.payload=s,_!=null&&(it.callback=_),Ag(o,it),Jg(o,et,_e)},enqueueForceUpdate:function(o,s){o=o._reactInternals;var _=Hg(),_e=Ig(o),et=zg(_,_e);et.tag=2,s!=null&&(et.callback=s),Ag(o,et),Jg(o,_e,_)}};function Lg(o,s,_,_e,et,it,tt){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(_e,it,tt):s.prototype&&s.prototype.isPureReactComponent?!Je(_,_e)||!Je(et,it):!0}function Mg(o,s,_){var _e=!1,et=Cf,it=s.contextType;return typeof it=="object"&&it!==null?it=vg(it):(et=Ff(s)?Df:M.current,_e=s.contextTypes,it=(_e=_e!=null)?Ef(o,et):Cf),s=new s(_,it),o.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Kg,o.stateNode=s,s._reactInternals=o,_e&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=et,o.__reactInternalMemoizedMaskedChildContext=it),s}function Ng(o,s,_,_e){o=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(_,_e),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(_,_e),s.state!==o&&Kg.enqueueReplaceState(s,s.state,null)}function Og(o,s,_,_e){var et=o.stateNode;et.props=_,et.state=o.memoizedState,et.refs=Fg,xg(o);var it=s.contextType;typeof it=="object"&&it!==null?et.context=vg(it):(it=Ff(s)?Df:M.current,et.context=Ef(o,it)),Cg(o,_,et,_e),et.state=o.memoizedState,it=s.getDerivedStateFromProps,typeof it=="function"&&(Gg(o,s,it,_),et.state=o.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof et.getSnapshotBeforeUpdate=="function"||typeof et.UNSAFE_componentWillMount!="function"&&typeof et.componentWillMount!="function"||(s=et.state,typeof et.componentWillMount=="function"&&et.componentWillMount(),typeof et.UNSAFE_componentWillMount=="function"&&et.UNSAFE_componentWillMount(),s!==et.state&&Kg.enqueueReplaceState(et,et.state,null),Cg(o,_,et,_e),et.state=o.memoizedState),typeof et.componentDidMount=="function"&&(o.flags|=4)}var Pg=Array.isArray;function Qg(o,s,_){if(o=_.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(_._owner){if(_=_._owner,_){if(_.tag!==1)throw Error(y$1(309));var _e=_.stateNode}if(!_e)throw Error(y$1(147,o));var et=""+o;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===et?s.ref:(s=function(it){var tt=_e.refs;tt===Fg&&(tt=_e.refs={}),it===null?delete tt[et]:tt[et]=it},s._stringRef=et,s)}if(typeof o!="string")throw Error(y$1(284));if(!_._owner)throw Error(y$1(290,o))}return o}function Rg(o,s){if(o.type!=="textarea")throw Error(y$1(31,Object.prototype.toString.call(s)==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":s))}function Sg(o){function s(dt,ft){if(o){var ut=dt.lastEffect;ut!==null?(ut.nextEffect=ft,dt.lastEffect=ft):dt.firstEffect=dt.lastEffect=ft,ft.nextEffect=null,ft.flags=8}}function _(dt,ft){if(!o)return null;for(;ft!==null;)s(dt,ft),ft=ft.sibling;return null}function _e(dt,ft){for(dt=new Map;ft!==null;)ft.key!==null?dt.set(ft.key,ft):dt.set(ft.index,ft),ft=ft.sibling;return dt}function et(dt,ft){return dt=Tg(dt,ft),dt.index=0,dt.sibling=null,dt}function it(dt,ft,ut){return dt.index=ut,o?(ut=dt.alternate,ut!==null?(ut=ut.index,ut<ft?(dt.flags=2,ft):ut):(dt.flags=2,ft)):ft}function tt(dt){return o&&dt.alternate===null&&(dt.flags=2),dt}function rt(dt,ft,ut,pt){return ft===null||ft.tag!==6?(ft=Ug(ut,dt.mode,pt),ft.return=dt,ft):(ft=et(ft,ut),ft.return=dt,ft)}function nt(dt,ft,ut,pt){return ft!==null&&ft.elementType===ut.type?(pt=et(ft,ut.props),pt.ref=Qg(dt,ft,ut),pt.return=dt,pt):(pt=Vg(ut.type,ut.key,ut.props,null,dt.mode,pt),pt.ref=Qg(dt,ft,ut),pt.return=dt,pt)}function ot(dt,ft,ut,pt){return ft===null||ft.tag!==4||ft.stateNode.containerInfo!==ut.containerInfo||ft.stateNode.implementation!==ut.implementation?(ft=Wg(ut,dt.mode,pt),ft.return=dt,ft):(ft=et(ft,ut.children||[]),ft.return=dt,ft)}function st(dt,ft,ut,pt,At){return ft===null||ft.tag!==7?(ft=Xg(ut,dt.mode,pt,At),ft.return=dt,ft):(ft=et(ft,ut),ft.return=dt,ft)}function at(dt,ft,ut){if(typeof ft=="string"||typeof ft=="number")return ft=Ug(""+ft,dt.mode,ut),ft.return=dt,ft;if(typeof ft=="object"&&ft!==null){switch(ft.$$typeof){case sa:return ut=Vg(ft.type,ft.key,ft.props,null,dt.mode,ut),ut.ref=Qg(dt,null,ft),ut.return=dt,ut;case ta:return ft=Wg(ft,dt.mode,ut),ft.return=dt,ft}if(Pg(ft)||La(ft))return ft=Xg(ft,dt.mode,ut,null),ft.return=dt,ft;Rg(dt,ft)}return null}function lt(dt,ft,ut,pt){var At=ft!==null?ft.key:null;if(typeof ut=="string"||typeof ut=="number")return At!==null?null:rt(dt,ft,""+ut,pt);if(typeof ut=="object"&&ut!==null){switch(ut.$$typeof){case sa:return ut.key===At?ut.type===ua?st(dt,ft,ut.props.children,pt,At):nt(dt,ft,ut,pt):null;case ta:return ut.key===At?ot(dt,ft,ut,pt):null}if(Pg(ut)||La(ut))return At!==null?null:st(dt,ft,ut,pt,null);Rg(dt,ut)}return null}function ct(dt,ft,ut,pt,At){if(typeof pt=="string"||typeof pt=="number")return dt=dt.get(ut)||null,rt(ft,dt,""+pt,At);if(typeof pt=="object"&&pt!==null){switch(pt.$$typeof){case sa:return dt=dt.get(pt.key===null?ut:pt.key)||null,pt.type===ua?st(ft,dt,pt.props.children,At,pt.key):nt(ft,dt,pt,At);case ta:return dt=dt.get(pt.key===null?ut:pt.key)||null,ot(ft,dt,pt,At)}if(Pg(pt)||La(pt))return dt=dt.get(ut)||null,st(ft,dt,pt,At,null);Rg(ft,pt)}return null}function ht(dt,ft,ut,pt){for(var At=null,gt=null,vt=ft,yt=ft=0,bt=null;vt!==null&&yt<ut.length;yt++){vt.index>yt?(bt=vt,vt=null):bt=vt.sibling;var Ct=lt(dt,vt,ut[yt],pt);if(Ct===null){vt===null&&(vt=bt);break}o&&vt&&Ct.alternate===null&&s(dt,vt),ft=it(Ct,ft,yt),gt===null?At=Ct:gt.sibling=Ct,gt=Ct,vt=bt}if(yt===ut.length)return _(dt,vt),At;if(vt===null){for(;yt<ut.length;yt++)vt=at(dt,ut[yt],pt),vt!==null&&(ft=it(vt,ft,yt),gt===null?At=vt:gt.sibling=vt,gt=vt);return At}for(vt=_e(dt,vt);yt<ut.length;yt++)bt=ct(vt,dt,yt,ut[yt],pt),bt!==null&&(o&&bt.alternate!==null&&vt.delete(bt.key===null?yt:bt.key),ft=it(bt,ft,yt),gt===null?At=bt:gt.sibling=bt,gt=bt);return o&&vt.forEach(function(xt){return s(dt,xt)}),At}function mt(dt,ft,ut,pt){var At=La(ut);if(typeof At!="function")throw Error(y$1(150));if(ut=At.call(ut),ut==null)throw Error(y$1(151));for(var gt=At=null,vt=ft,yt=ft=0,bt=null,Ct=ut.next();vt!==null&&!Ct.done;yt++,Ct=ut.next()){vt.index>yt?(bt=vt,vt=null):bt=vt.sibling;var xt=lt(dt,vt,Ct.value,pt);if(xt===null){vt===null&&(vt=bt);break}o&&vt&&xt.alternate===null&&s(dt,vt),ft=it(xt,ft,yt),gt===null?At=xt:gt.sibling=xt,gt=xt,vt=bt}if(Ct.done)return _(dt,vt),At;if(vt===null){for(;!Ct.done;yt++,Ct=ut.next())Ct=at(dt,Ct.value,pt),Ct!==null&&(ft=it(Ct,ft,yt),gt===null?At=Ct:gt.sibling=Ct,gt=Ct);return At}for(vt=_e(dt,vt);!Ct.done;yt++,Ct=ut.next())Ct=ct(vt,dt,yt,Ct.value,pt),Ct!==null&&(o&&Ct.alternate!==null&&vt.delete(Ct.key===null?yt:Ct.key),ft=it(Ct,ft,yt),gt===null?At=Ct:gt.sibling=Ct,gt=Ct);return o&&vt.forEach(function(It){return s(dt,It)}),At}return function(dt,ft,ut,pt){var At=typeof ut=="object"&&ut!==null&&ut.type===ua&&ut.key===null;At&&(ut=ut.props.children);var gt=typeof ut=="object"&&ut!==null;if(gt)switch(ut.$$typeof){case sa:e:{for(gt=ut.key,At=ft;At!==null;){if(At.key===gt){switch(At.tag){case 7:if(ut.type===ua){_(dt,At.sibling),ft=et(At,ut.props.children),ft.return=dt,dt=ft;break e}break;default:if(At.elementType===ut.type){_(dt,At.sibling),ft=et(At,ut.props),ft.ref=Qg(dt,At,ut),ft.return=dt,dt=ft;break e}}_(dt,At);break}else s(dt,At);At=At.sibling}ut.type===ua?(ft=Xg(ut.props.children,dt.mode,pt,ut.key),ft.return=dt,dt=ft):(pt=Vg(ut.type,ut.key,ut.props,null,dt.mode,pt),pt.ref=Qg(dt,ft,ut),pt.return=dt,dt=pt)}return tt(dt);case ta:e:{for(At=ut.key;ft!==null;){if(ft.key===At)if(ft.tag===4&&ft.stateNode.containerInfo===ut.containerInfo&&ft.stateNode.implementation===ut.implementation){_(dt,ft.sibling),ft=et(ft,ut.children||[]),ft.return=dt,dt=ft;break e}else{_(dt,ft);break}else s(dt,ft);ft=ft.sibling}ft=Wg(ut,dt.mode,pt),ft.return=dt,dt=ft}return tt(dt)}if(typeof ut=="string"||typeof ut=="number")return ut=""+ut,ft!==null&&ft.tag===6?(_(dt,ft.sibling),ft=et(ft,ut),ft.return=dt,dt=ft):(_(dt,ft),ft=Ug(ut,dt.mode,pt),ft.return=dt,dt=ft),tt(dt);if(Pg(ut))return ht(dt,ft,ut,pt);if(La(ut))return mt(dt,ft,ut,pt);if(gt&&Rg(dt,ut),typeof ut=="undefined"&&!At)switch(dt.tag){case 1:case 22:case 0:case 11:case 15:throw Error(y$1(152,Ra(dt.type)||"Component"))}return _(dt,ft)}}var Yg=Sg(!0),Zg=Sg(!1),$g={},ah=Bf($g),bh=Bf($g),ch=Bf($g);function dh(o){if(o===$g)throw Error(y$1(174));return o}function eh(o,s){switch(I(ch,s),I(bh,o),I(ah,$g),o=s.nodeType,o){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:mb(null,"");break;default:o=o===8?s.parentNode:s,s=o.namespaceURI||null,o=o.tagName,s=mb(s,o)}H(ah),I(ah,s)}function fh(){H(ah),H(bh),H(ch)}function gh(o){dh(ch.current);var s=dh(ah.current),_=mb(s,o.type);s!==_&&(I(bh,o),I(ah,_))}function hh(o){bh.current===o&&(H(ah),H(bh))}var P=Bf(0);function ih(o){for(var s=o;s!==null;){if(s.tag===13){var _=s.memoizedState;if(_!==null&&(_=_.dehydrated,_===null||_.data==="$?"||_.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&64)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break;for(;s.sibling===null;){if(s.return===null||s.return===o)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var jh=null,kh=null,lh=!1;function mh(o,s){var _=nh(5,null,null,0);_.elementType="DELETED",_.type="DELETED",_.stateNode=s,_.return=o,_.flags=8,o.lastEffect!==null?(o.lastEffect.nextEffect=_,o.lastEffect=_):o.firstEffect=o.lastEffect=_}function oh(o,s){switch(o.tag){case 5:var _=o.type;return s=s.nodeType!==1||_.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(o.stateNode=s,!0):!1;case 6:return s=o.pendingProps===""||s.nodeType!==3?null:s,s!==null?(o.stateNode=s,!0):!1;case 13:return!1;default:return!1}}function ph(o){if(lh){var s=kh;if(s){var _=s;if(!oh(o,s)){if(s=rf(_.nextSibling),!s||!oh(o,s)){o.flags=o.flags&-1025|2,lh=!1,jh=o;return}mh(jh,_)}jh=o,kh=rf(s.firstChild)}else o.flags=o.flags&-1025|2,lh=!1,jh=o}}function qh(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;jh=o}function rh(o){if(o!==jh)return!1;if(!lh)return qh(o),lh=!0,!1;var s=o.type;if(o.tag!==5||s!=="head"&&s!=="body"&&!nf(s,o.memoizedProps))for(s=kh;s;)mh(o,s),s=rf(s.nextSibling);if(qh(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(y$1(317));e:{for(o=o.nextSibling,s=0;o;){if(o.nodeType===8){var _=o.data;if(_==="/$"){if(s===0){kh=rf(o.nextSibling);break e}s--}else _!=="$"&&_!=="$!"&&_!=="$?"||s++}o=o.nextSibling}kh=null}}else kh=jh?rf(o.stateNode.nextSibling):null;return!0}function sh(){kh=jh=null,lh=!1}var th=[];function uh(){for(var o=0;o<th.length;o++)th[o]._workInProgressVersionPrimary=null;th.length=0}var vh=ra.ReactCurrentDispatcher,wh=ra.ReactCurrentBatchConfig,xh=0,R=null,S=null,T=null,yh=!1,zh=!1;function Ah(){throw Error(y$1(321))}function Bh(o,s){if(s===null)return!1;for(var _=0;_<s.length&&_<o.length;_++)if(!He(o[_],s[_]))return!1;return!0}function Ch(o,s,_,_e,et,it){if(xh=it,R=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,vh.current=o===null||o.memoizedState===null?Dh:Eh,o=_(_e,et),zh){it=0;do{if(zh=!1,!(25>it))throw Error(y$1(301));it+=1,T=S=null,s.updateQueue=null,vh.current=Fh,o=_(_e,et)}while(zh)}if(vh.current=Gh,s=S!==null&&S.next!==null,xh=0,T=S=R=null,yh=!1,s)throw Error(y$1(300));return o}function Hh(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return T===null?R.memoizedState=T=o:T=T.next=o,T}function Ih(){if(S===null){var o=R.alternate;o=o!==null?o.memoizedState:null}else o=S.next;var s=T===null?R.memoizedState:T.next;if(s!==null)T=s,S=o;else{if(o===null)throw Error(y$1(310));S=o,o={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null},T===null?R.memoizedState=T=o:T=T.next=o}return T}function Jh(o,s){return typeof s=="function"?s(o):s}function Kh(o){var s=Ih(),_=s.queue;if(_===null)throw Error(y$1(311));_.lastRenderedReducer=o;var _e=S,et=_e.baseQueue,it=_.pending;if(it!==null){if(et!==null){var tt=et.next;et.next=it.next,it.next=tt}_e.baseQueue=et=it,_.pending=null}if(et!==null){et=et.next,_e=_e.baseState;var rt=tt=it=null,nt=et;do{var ot=nt.lane;if((xh&ot)===ot)rt!==null&&(rt=rt.next={lane:0,action:nt.action,eagerReducer:nt.eagerReducer,eagerState:nt.eagerState,next:null}),_e=nt.eagerReducer===o?nt.eagerState:o(_e,nt.action);else{var st={lane:ot,action:nt.action,eagerReducer:nt.eagerReducer,eagerState:nt.eagerState,next:null};rt===null?(tt=rt=st,it=_e):rt=rt.next=st,R.lanes|=ot,Dg|=ot}nt=nt.next}while(nt!==null&&nt!==et);rt===null?it=_e:rt.next=tt,He(_e,s.memoizedState)||(ug=!0),s.memoizedState=_e,s.baseState=it,s.baseQueue=rt,_.lastRenderedState=_e}return[s.memoizedState,_.dispatch]}function Lh(o){var s=Ih(),_=s.queue;if(_===null)throw Error(y$1(311));_.lastRenderedReducer=o;var _e=_.dispatch,et=_.pending,it=s.memoizedState;if(et!==null){_.pending=null;var tt=et=et.next;do it=o(it,tt.action),tt=tt.next;while(tt!==et);He(it,s.memoizedState)||(ug=!0),s.memoizedState=it,s.baseQueue===null&&(s.baseState=it),_.lastRenderedState=it}return[it,_e]}function Mh(o,s,_){var _e=s._getVersion;_e=_e(s._source);var et=s._workInProgressVersionPrimary;if(et!==null?o=et===_e:(o=o.mutableReadLanes,(o=(xh&o)===o)&&(s._workInProgressVersionPrimary=_e,th.push(s))),o)return _(s._source);throw th.push(s),Error(y$1(350))}function Nh(o,s,_,_e){var et=U$1;if(et===null)throw Error(y$1(349));var it=s._getVersion,tt=it(s._source),rt=vh.current,nt=rt.useState(function(){return Mh(et,s,_)}),ot=nt[1],st=nt[0];nt=T;var at=o.memoizedState,lt=at.refs,ct=lt.getSnapshot,ht=at.source;at=at.subscribe;var mt=R;return o.memoizedState={refs:lt,source:s,subscribe:_e},rt.useEffect(function(){lt.getSnapshot=_,lt.setSnapshot=ot;var dt=it(s._source);if(!He(tt,dt)){dt=_(s._source),He(st,dt)||(ot(dt),dt=Ig(mt),et.mutableReadLanes|=dt&et.pendingLanes),dt=et.mutableReadLanes,et.entangledLanes|=dt;for(var ft=et.entanglements,ut=dt;0<ut;){var pt=31-Vc(ut),At=1<<pt;ft[pt]|=dt,ut&=~At}}},[_,s,_e]),rt.useEffect(function(){return _e(s._source,function(){var dt=lt.getSnapshot,ft=lt.setSnapshot;try{ft(dt(s._source));var ut=Ig(mt);et.mutableReadLanes|=ut&et.pendingLanes}catch(pt){ft(function(){throw pt})}})},[s,_e]),He(ct,_)&&He(ht,s)&&He(at,_e)||(o={pending:null,dispatch:null,lastRenderedReducer:Jh,lastRenderedState:st},o.dispatch=ot=Oh.bind(null,R,o),nt.queue=o,nt.baseQueue=null,st=Mh(et,s,_),nt.memoizedState=nt.baseState=st),st}function Ph(o,s,_){var _e=Ih();return Nh(_e,o,s,_)}function Qh(o){var s=Hh();return typeof o=="function"&&(o=o()),s.memoizedState=s.baseState=o,o=s.queue={pending:null,dispatch:null,lastRenderedReducer:Jh,lastRenderedState:o},o=o.dispatch=Oh.bind(null,R,o),[s.memoizedState,o]}function Rh(o,s,_,_e){return o={tag:o,create:s,destroy:_,deps:_e,next:null},s=R.updateQueue,s===null?(s={lastEffect:null},R.updateQueue=s,s.lastEffect=o.next=o):(_=s.lastEffect,_===null?s.lastEffect=o.next=o:(_e=_.next,_.next=o,o.next=_e,s.lastEffect=o)),o}function Sh(o){var s=Hh();return o={current:o},s.memoizedState=o}function Th(){return Ih().memoizedState}function Uh(o,s,_,_e){var et=Hh();R.flags|=o,et.memoizedState=Rh(1|s,_,void 0,_e===void 0?null:_e)}function Vh(o,s,_,_e){var et=Ih();_e=_e===void 0?null:_e;var it=void 0;if(S!==null){var tt=S.memoizedState;if(it=tt.destroy,_e!==null&&Bh(_e,tt.deps)){Rh(s,_,it,_e);return}}R.flags|=o,et.memoizedState=Rh(1|s,_,it,_e)}function Wh(o,s){return Uh(516,4,o,s)}function Xh(o,s){return Vh(516,4,o,s)}function Yh(o,s){return Vh(4,2,o,s)}function Zh(o,s){if(typeof s=="function")return o=o(),s(o),function(){s(null)};if(s!=null)return o=o(),s.current=o,function(){s.current=null}}function $h(o,s,_){return _=_!=null?_.concat([o]):null,Vh(4,2,Zh.bind(null,s,o),_)}function ai(){}function bi(o,s){var _=Ih();s=s===void 0?null:s;var _e=_.memoizedState;return _e!==null&&s!==null&&Bh(s,_e[1])?_e[0]:(_.memoizedState=[o,s],o)}function ci(o,s){var _=Ih();s=s===void 0?null:s;var _e=_.memoizedState;return _e!==null&&s!==null&&Bh(s,_e[1])?_e[0]:(o=o(),_.memoizedState=[o,s],o)}function di(o,s){var _=eg();gg(98>_?98:_,function(){o(!0)}),gg(97<_?97:_,function(){var _e=wh.transition;wh.transition=1;try{o(!1),s()}finally{wh.transition=_e}})}function Oh(o,s,_){var _e=Hg(),et=Ig(o),it={lane:et,action:_,eagerReducer:null,eagerState:null,next:null},tt=s.pending;if(tt===null?it.next=it:(it.next=tt.next,tt.next=it),s.pending=it,tt=o.alternate,o===R||tt!==null&&tt===R)zh=yh=!0;else{if(o.lanes===0&&(tt===null||tt.lanes===0)&&(tt=s.lastRenderedReducer,tt!==null))try{var rt=s.lastRenderedState,nt=tt(rt,_);if(it.eagerReducer=tt,it.eagerState=nt,He(nt,rt))return}catch{}finally{}Jg(o,et,_e)}}var Gh={readContext:vg,useCallback:Ah,useContext:Ah,useEffect:Ah,useImperativeHandle:Ah,useLayoutEffect:Ah,useMemo:Ah,useReducer:Ah,useRef:Ah,useState:Ah,useDebugValue:Ah,useDeferredValue:Ah,useTransition:Ah,useMutableSource:Ah,useOpaqueIdentifier:Ah,unstable_isNewReconciler:!1},Dh={readContext:vg,useCallback:function(o,s){return Hh().memoizedState=[o,s===void 0?null:s],o},useContext:vg,useEffect:Wh,useImperativeHandle:function(o,s,_){return _=_!=null?_.concat([o]):null,Uh(4,2,Zh.bind(null,s,o),_)},useLayoutEffect:function(o,s){return Uh(4,2,o,s)},useMemo:function(o,s){var _=Hh();return s=s===void 0?null:s,o=o(),_.memoizedState=[o,s],o},useReducer:function(o,s,_){var _e=Hh();return s=_!==void 0?_(s):s,_e.memoizedState=_e.baseState=s,o=_e.queue={pending:null,dispatch:null,lastRenderedReducer:o,lastRenderedState:s},o=o.dispatch=Oh.bind(null,R,o),[_e.memoizedState,o]},useRef:Sh,useState:Qh,useDebugValue:ai,useDeferredValue:function(o){var s=Qh(o),_=s[0],_e=s[1];return Wh(function(){var et=wh.transition;wh.transition=1;try{_e(o)}finally{wh.transition=et}},[o]),_},useTransition:function(){var o=Qh(!1),s=o[0];return o=di.bind(null,o[1]),Sh(o),[o,s]},useMutableSource:function(o,s,_){var _e=Hh();return _e.memoizedState={refs:{getSnapshot:s,setSnapshot:null},source:o,subscribe:_},Nh(_e,o,s,_)},useOpaqueIdentifier:function(){if(lh){var o=!1,s=uf(function(){throw o||(o=!0,_("r:"+(tf++).toString(36))),Error(y$1(355))}),_=Qh(s)[1];return(R.mode&2)===0&&(R.flags|=516,Rh(5,function(){_("r:"+(tf++).toString(36))},void 0,null)),s}return s="r:"+(tf++).toString(36),Qh(s),s},unstable_isNewReconciler:!1},Eh={readContext:vg,useCallback:bi,useContext:vg,useEffect:Xh,useImperativeHandle:$h,useLayoutEffect:Yh,useMemo:ci,useReducer:Kh,useRef:Th,useState:function(){return Kh(Jh)},useDebugValue:ai,useDeferredValue:function(o){var s=Kh(Jh),_=s[0],_e=s[1];return Xh(function(){var et=wh.transition;wh.transition=1;try{_e(o)}finally{wh.transition=et}},[o]),_},useTransition:function(){var o=Kh(Jh)[0];return[Th().current,o]},useMutableSource:Ph,useOpaqueIdentifier:function(){return Kh(Jh)[0]},unstable_isNewReconciler:!1},Fh={readContext:vg,useCallback:bi,useContext:vg,useEffect:Xh,useImperativeHandle:$h,useLayoutEffect:Yh,useMemo:ci,useReducer:Lh,useRef:Th,useState:function(){return Lh(Jh)},useDebugValue:ai,useDeferredValue:function(o){var s=Lh(Jh),_=s[0],_e=s[1];return Xh(function(){var et=wh.transition;wh.transition=1;try{_e(o)}finally{wh.transition=et}},[o]),_},useTransition:function(){var o=Lh(Jh)[0];return[Th().current,o]},useMutableSource:Ph,useOpaqueIdentifier:function(){return Lh(Jh)[0]},unstable_isNewReconciler:!1},ei=ra.ReactCurrentOwner,ug=!1;function fi(o,s,_,_e){s.child=o===null?Zg(s,null,_,_e):Yg(s,o.child,_,_e)}function gi(o,s,_,_e,et){_=_.render;var it=s.ref;return tg(s,et),_e=Ch(o,s,_,_e,it,et),o!==null&&!ug?(s.updateQueue=o.updateQueue,s.flags&=-517,o.lanes&=~et,hi(o,s,et)):(s.flags|=1,fi(o,s,_e,et),s.child)}function ii(o,s,_,_e,et,it){if(o===null){var tt=_.type;return typeof tt=="function"&&!ji(tt)&&tt.defaultProps===void 0&&_.compare===null&&_.defaultProps===void 0?(s.tag=15,s.type=tt,ki(o,s,tt,_e,et,it)):(o=Vg(_.type,null,_e,s,s.mode,it),o.ref=s.ref,o.return=s,s.child=o)}return tt=o.child,(et&it)===0&&(et=tt.memoizedProps,_=_.compare,_=_!==null?_:Je,_(et,_e)&&o.ref===s.ref)?hi(o,s,it):(s.flags|=1,o=Tg(tt,_e),o.ref=s.ref,o.return=s,s.child=o)}function ki(o,s,_,_e,et,it){if(o!==null&&Je(o.memoizedProps,_e)&&o.ref===s.ref)if(ug=!1,(it&et)!==0)(o.flags&16384)!==0&&(ug=!0);else return s.lanes=o.lanes,hi(o,s,it);return li(o,s,_,_e,it)}function mi(o,s,_){var _e=s.pendingProps,et=_e.children,it=o!==null?o.memoizedState:null;if(_e.mode==="hidden"||_e.mode==="unstable-defer-without-hiding")if((s.mode&4)===0)s.memoizedState={baseLanes:0},ni(s,_);else if((_&1073741824)!==0)s.memoizedState={baseLanes:0},ni(s,it!==null?it.baseLanes:_);else return o=it!==null?it.baseLanes|_:_,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:o},ni(s,o),null;else it!==null?(_e=it.baseLanes|_,s.memoizedState=null):_e=_,ni(s,_e);return fi(o,s,et,_),s.child}function oi(o,s){var _=s.ref;(o===null&&_!==null||o!==null&&o.ref!==_)&&(s.flags|=128)}function li(o,s,_,_e,et){var it=Ff(_)?Df:M.current;return it=Ef(s,it),tg(s,et),_=Ch(o,s,_,_e,it,et),o!==null&&!ug?(s.updateQueue=o.updateQueue,s.flags&=-517,o.lanes&=~et,hi(o,s,et)):(s.flags|=1,fi(o,s,_,et),s.child)}function pi(o,s,_,_e,et){if(Ff(_)){var it=!0;Jf(s)}else it=!1;if(tg(s,et),s.stateNode===null)o!==null&&(o.alternate=null,s.alternate=null,s.flags|=2),Mg(s,_,_e),Og(s,_,_e,et),_e=!0;else if(o===null){var tt=s.stateNode,rt=s.memoizedProps;tt.props=rt;var nt=tt.context,ot=_.contextType;typeof ot=="object"&&ot!==null?ot=vg(ot):(ot=Ff(_)?Df:M.current,ot=Ef(s,ot));var st=_.getDerivedStateFromProps,at=typeof st=="function"||typeof tt.getSnapshotBeforeUpdate=="function";at||typeof tt.UNSAFE_componentWillReceiveProps!="function"&&typeof tt.componentWillReceiveProps!="function"||(rt!==_e||nt!==ot)&&Ng(s,tt,_e,ot),wg=!1;var lt=s.memoizedState;tt.state=lt,Cg(s,_e,tt,et),nt=s.memoizedState,rt!==_e||lt!==nt||N.current||wg?(typeof st=="function"&&(Gg(s,_,st,_e),nt=s.memoizedState),(rt=wg||Lg(s,_,rt,_e,lt,nt,ot))?(at||typeof tt.UNSAFE_componentWillMount!="function"&&typeof tt.componentWillMount!="function"||(typeof tt.componentWillMount=="function"&&tt.componentWillMount(),typeof tt.UNSAFE_componentWillMount=="function"&&tt.UNSAFE_componentWillMount()),typeof tt.componentDidMount=="function"&&(s.flags|=4)):(typeof tt.componentDidMount=="function"&&(s.flags|=4),s.memoizedProps=_e,s.memoizedState=nt),tt.props=_e,tt.state=nt,tt.context=ot,_e=rt):(typeof tt.componentDidMount=="function"&&(s.flags|=4),_e=!1)}else{tt=s.stateNode,yg(o,s),rt=s.memoizedProps,ot=s.type===s.elementType?rt:lg(s.type,rt),tt.props=ot,at=s.pendingProps,lt=tt.context,nt=_.contextType,typeof nt=="object"&&nt!==null?nt=vg(nt):(nt=Ff(_)?Df:M.current,nt=Ef(s,nt));var ct=_.getDerivedStateFromProps;(st=typeof ct=="function"||typeof tt.getSnapshotBeforeUpdate=="function")||typeof tt.UNSAFE_componentWillReceiveProps!="function"&&typeof tt.componentWillReceiveProps!="function"||(rt!==at||lt!==nt)&&Ng(s,tt,_e,nt),wg=!1,lt=s.memoizedState,tt.state=lt,Cg(s,_e,tt,et);var ht=s.memoizedState;rt!==at||lt!==ht||N.current||wg?(typeof ct=="function"&&(Gg(s,_,ct,_e),ht=s.memoizedState),(ot=wg||Lg(s,_,ot,_e,lt,ht,nt))?(st||typeof tt.UNSAFE_componentWillUpdate!="function"&&typeof tt.componentWillUpdate!="function"||(typeof tt.componentWillUpdate=="function"&&tt.componentWillUpdate(_e,ht,nt),typeof tt.UNSAFE_componentWillUpdate=="function"&&tt.UNSAFE_componentWillUpdate(_e,ht,nt)),typeof tt.componentDidUpdate=="function"&&(s.flags|=4),typeof tt.getSnapshotBeforeUpdate=="function"&&(s.flags|=256)):(typeof tt.componentDidUpdate!="function"||rt===o.memoizedProps&&lt===o.memoizedState||(s.flags|=4),typeof tt.getSnapshotBeforeUpdate!="function"||rt===o.memoizedProps&&lt===o.memoizedState||(s.flags|=256),s.memoizedProps=_e,s.memoizedState=ht),tt.props=_e,tt.state=ht,tt.context=nt,_e=ot):(typeof tt.componentDidUpdate!="function"||rt===o.memoizedProps&&lt===o.memoizedState||(s.flags|=4),typeof tt.getSnapshotBeforeUpdate!="function"||rt===o.memoizedProps&&lt===o.memoizedState||(s.flags|=256),_e=!1)}return qi(o,s,_,_e,it,et)}function qi(o,s,_,_e,et,it){oi(o,s);var tt=(s.flags&64)!==0;if(!_e&&!tt)return et&&Kf(s,_,!1),hi(o,s,it);_e=s.stateNode,ei.current=s;var rt=tt&&typeof _.getDerivedStateFromError!="function"?null:_e.render();return s.flags|=1,o!==null&&tt?(s.child=Yg(s,o.child,null,it),s.child=Yg(s,null,rt,it)):fi(o,s,rt,it),s.memoizedState=_e.state,et&&Kf(s,_,!0),s.child}function ri(o){var s=o.stateNode;s.pendingContext?Hf(o,s.pendingContext,s.pendingContext!==s.context):s.context&&Hf(o,s.context,!1),eh(o,s.containerInfo)}var si={dehydrated:null,retryLane:0};function ti(o,s,_){var _e=s.pendingProps,et=P.current,it=!1,tt;return(tt=(s.flags&64)!==0)||(tt=o!==null&&o.memoizedState===null?!1:(et&2)!==0),tt?(it=!0,s.flags&=-65):o!==null&&o.memoizedState===null||_e.fallback===void 0||_e.unstable_avoidThisFallback===!0||(et|=1),I(P,et&1),o===null?(_e.fallback!==void 0&&ph(s),o=_e.children,et=_e.fallback,it?(o=ui(s,o,et,_),s.child.memoizedState={baseLanes:_},s.memoizedState=si,o):typeof _e.unstable_expectedLoadTime=="number"?(o=ui(s,o,et,_),s.child.memoizedState={baseLanes:_},s.memoizedState=si,s.lanes=33554432,o):(_=vi({mode:"visible",children:o},s.mode,_,null),_.return=s,s.child=_)):o.memoizedState!==null?it?(_e=wi(o,s,_e.children,_e.fallback,_),it=s.child,et=o.child.memoizedState,it.memoizedState=et===null?{baseLanes:_}:{baseLanes:et.baseLanes|_},it.childLanes=o.childLanes&~_,s.memoizedState=si,_e):(_=xi(o,s,_e.children,_),s.memoizedState=null,_):it?(_e=wi(o,s,_e.children,_e.fallback,_),it=s.child,et=o.child.memoizedState,it.memoizedState=et===null?{baseLanes:_}:{baseLanes:et.baseLanes|_},it.childLanes=o.childLanes&~_,s.memoizedState=si,_e):(_=xi(o,s,_e.children,_),s.memoizedState=null,_)}function ui(o,s,_,_e){var et=o.mode,it=o.child;return s={mode:"hidden",children:s},(et&2)===0&&it!==null?(it.childLanes=0,it.pendingProps=s):it=vi(s,et,0,null),_=Xg(_,et,_e,null),it.return=o,_.return=o,it.sibling=_,o.child=it,_}function xi(o,s,_,_e){var et=o.child;return o=et.sibling,_=Tg(et,{mode:"visible",children:_}),(s.mode&2)===0&&(_.lanes=_e),_.return=s,_.sibling=null,o!==null&&(o.nextEffect=null,o.flags=8,s.firstEffect=s.lastEffect=o),s.child=_}function wi(o,s,_,_e,et){var it=s.mode,tt=o.child;o=tt.sibling;var rt={mode:"hidden",children:_};return(it&2)===0&&s.child!==tt?(_=s.child,_.childLanes=0,_.pendingProps=rt,tt=_.lastEffect,tt!==null?(s.firstEffect=_.firstEffect,s.lastEffect=tt,tt.nextEffect=null):s.firstEffect=s.lastEffect=null):_=Tg(tt,rt),o!==null?_e=Tg(o,_e):(_e=Xg(_e,it,et,null),_e.flags|=2),_e.return=s,_.return=s,_.sibling=_e,s.child=_,_e}function yi(o,s){o.lanes|=s;var _=o.alternate;_!==null&&(_.lanes|=s),sg(o.return,s)}function zi(o,s,_,_e,et,it){var tt=o.memoizedState;tt===null?o.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:_e,tail:_,tailMode:et,lastEffect:it}:(tt.isBackwards=s,tt.rendering=null,tt.renderingStartTime=0,tt.last=_e,tt.tail=_,tt.tailMode=et,tt.lastEffect=it)}function Ai(o,s,_){var _e=s.pendingProps,et=_e.revealOrder,it=_e.tail;if(fi(o,s,_e.children,_),_e=P.current,(_e&2)!==0)_e=_e&1|2,s.flags|=64;else{if(o!==null&&(o.flags&64)!==0)e:for(o=s.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&yi(o,_);else if(o.tag===19)yi(o,_);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break e;for(;o.sibling===null;){if(o.return===null||o.return===s)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}_e&=1}if(I(P,_e),(s.mode&2)===0)s.memoizedState=null;else switch(et){case"forwards":for(_=s.child,et=null;_!==null;)o=_.alternate,o!==null&&ih(o)===null&&(et=_),_=_.sibling;_=et,_===null?(et=s.child,s.child=null):(et=_.sibling,_.sibling=null),zi(s,!1,et,_,it,s.lastEffect);break;case"backwards":for(_=null,et=s.child,s.child=null;et!==null;){if(o=et.alternate,o!==null&&ih(o)===null){s.child=et;break}o=et.sibling,et.sibling=_,_=et,et=o}zi(s,!0,_,null,it,s.lastEffect);break;case"together":zi(s,!1,null,null,void 0,s.lastEffect);break;default:s.memoizedState=null}return s.child}function hi(o,s,_){if(o!==null&&(s.dependencies=o.dependencies),Dg|=s.lanes,(_&s.childLanes)!==0){if(o!==null&&s.child!==o.child)throw Error(y$1(153));if(s.child!==null){for(o=s.child,_=Tg(o,o.pendingProps),s.child=_,_.return=s;o.sibling!==null;)o=o.sibling,_=_.sibling=Tg(o,o.pendingProps),_.return=s;_.sibling=null}return s.child}return null}var Bi,Ci,Di,Ei;Bi=function(o,s){for(var _=s.child;_!==null;){if(_.tag===5||_.tag===6)o.appendChild(_.stateNode);else if(_.tag!==4&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===s)break;for(;_.sibling===null;){if(_.return===null||_.return===s)return;_=_.return}_.sibling.return=_.return,_=_.sibling}};Ci=function(){};Di=function(o,s,_,_e){var et=o.memoizedProps;if(et!==_e){o=s.stateNode,dh(ah.current);var it=null;switch(_){case"input":et=Ya(o,et),_e=Ya(o,_e),it=[];break;case"option":et=eb(o,et),_e=eb(o,_e),it=[];break;case"select":et=m$2({},et,{value:void 0}),_e=m$2({},_e,{value:void 0}),it=[];break;case"textarea":et=gb(o,et),_e=gb(o,_e),it=[];break;default:typeof et.onClick!="function"&&typeof _e.onClick=="function"&&(o.onclick=jf)}vb(_,_e);var tt;_=null;for(ot in et)if(!_e.hasOwnProperty(ot)&&et.hasOwnProperty(ot)&&et[ot]!=null)if(ot==="style"){var rt=et[ot];for(tt in rt)rt.hasOwnProperty(tt)&&(_||(_={}),_[tt]="")}else ot!=="dangerouslySetInnerHTML"&&ot!=="children"&&ot!=="suppressContentEditableWarning"&&ot!=="suppressHydrationWarning"&&ot!=="autoFocus"&&(ca.hasOwnProperty(ot)?it||(it=[]):(it=it||[]).push(ot,null));for(ot in _e){var nt=_e[ot];if(rt=et!=null?et[ot]:void 0,_e.hasOwnProperty(ot)&&nt!==rt&&(nt!=null||rt!=null))if(ot==="style")if(rt){for(tt in rt)!rt.hasOwnProperty(tt)||nt&&nt.hasOwnProperty(tt)||(_||(_={}),_[tt]="");for(tt in nt)nt.hasOwnProperty(tt)&&rt[tt]!==nt[tt]&&(_||(_={}),_[tt]=nt[tt])}else _||(it||(it=[]),it.push(ot,_)),_=nt;else ot==="dangerouslySetInnerHTML"?(nt=nt?nt.__html:void 0,rt=rt?rt.__html:void 0,nt!=null&&rt!==nt&&(it=it||[]).push(ot,nt)):ot==="children"?typeof nt!="string"&&typeof nt!="number"||(it=it||[]).push(ot,""+nt):ot!=="suppressContentEditableWarning"&&ot!=="suppressHydrationWarning"&&(ca.hasOwnProperty(ot)?(nt!=null&&ot==="onScroll"&&G("scroll",o),it||rt===nt||(it=[])):typeof nt=="object"&&nt!==null&&nt.$$typeof===Ga?nt.toString():(it=it||[]).push(ot,nt))}_&&(it=it||[]).push("style",_);var ot=it;(s.updateQueue=ot)&&(s.flags|=4)}};Ei=function(o,s,_,_e){_!==_e&&(s.flags|=4)};function Fi(o,s){if(!lh)switch(o.tailMode){case"hidden":s=o.tail;for(var _=null;s!==null;)s.alternate!==null&&(_=s),s=s.sibling;_===null?o.tail=null:_.sibling=null;break;case"collapsed":_=o.tail;for(var _e=null;_!==null;)_.alternate!==null&&(_e=_),_=_.sibling;_e===null?s||o.tail===null?o.tail=null:o.tail.sibling=null:_e.sibling=null}}function Gi(o,s,_){var _e=s.pendingProps;switch(s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return Ff(s.type)&&Gf(),null;case 3:return fh(),H(N),H(M),uh(),_e=s.stateNode,_e.pendingContext&&(_e.context=_e.pendingContext,_e.pendingContext=null),(o===null||o.child===null)&&(rh(s)?s.flags|=4:_e.hydrate||(s.flags|=256)),Ci(s),null;case 5:hh(s);var et=dh(ch.current);if(_=s.type,o!==null&&s.stateNode!=null)Di(o,s,_,_e,et),o.ref!==s.ref&&(s.flags|=128);else{if(!_e){if(s.stateNode===null)throw Error(y$1(166));return null}if(o=dh(ah.current),rh(s)){_e=s.stateNode,_=s.type;var it=s.memoizedProps;switch(_e[wf]=s,_e[xf]=it,_){case"dialog":G("cancel",_e),G("close",_e);break;case"iframe":case"object":case"embed":G("load",_e);break;case"video":case"audio":for(o=0;o<Xe.length;o++)G(Xe[o],_e);break;case"source":G("error",_e);break;case"img":case"image":case"link":G("error",_e),G("load",_e);break;case"details":G("toggle",_e);break;case"input":Za(_e,it),G("invalid",_e);break;case"select":_e._wrapperState={wasMultiple:!!it.multiple},G("invalid",_e);break;case"textarea":hb(_e,it),G("invalid",_e)}vb(_,it),o=null;for(var tt in it)it.hasOwnProperty(tt)&&(et=it[tt],tt==="children"?typeof et=="string"?_e.textContent!==et&&(o=["children",et]):typeof et=="number"&&_e.textContent!==""+et&&(o=["children",""+et]):ca.hasOwnProperty(tt)&&et!=null&&tt==="onScroll"&&G("scroll",_e));switch(_){case"input":Va(_e),cb(_e,it,!0);break;case"textarea":Va(_e),jb(_e);break;case"select":case"option":break;default:typeof it.onClick=="function"&&(_e.onclick=jf)}_e=o,s.updateQueue=_e,_e!==null&&(s.flags|=4)}else{switch(tt=et.nodeType===9?et:et.ownerDocument,o===kb.html&&(o=lb(_)),o===kb.html?_==="script"?(o=tt.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof _e.is=="string"?o=tt.createElement(_,{is:_e.is}):(o=tt.createElement(_),_==="select"&&(tt=o,_e.multiple?tt.multiple=!0:_e.size&&(tt.size=_e.size))):o=tt.createElementNS(o,_),o[wf]=s,o[xf]=_e,Bi(o,s,!1,!1),s.stateNode=o,tt=wb(_,_e),_){case"dialog":G("cancel",o),G("close",o),et=_e;break;case"iframe":case"object":case"embed":G("load",o),et=_e;break;case"video":case"audio":for(et=0;et<Xe.length;et++)G(Xe[et],o);et=_e;break;case"source":G("error",o),et=_e;break;case"img":case"image":case"link":G("error",o),G("load",o),et=_e;break;case"details":G("toggle",o),et=_e;break;case"input":Za(o,_e),et=Ya(o,_e),G("invalid",o);break;case"option":et=eb(o,_e);break;case"select":o._wrapperState={wasMultiple:!!_e.multiple},et=m$2({},_e,{value:void 0}),G("invalid",o);break;case"textarea":hb(o,_e),et=gb(o,_e),G("invalid",o);break;default:et=_e}vb(_,et);var rt=et;for(it in rt)if(rt.hasOwnProperty(it)){var nt=rt[it];it==="style"?tb(o,nt):it==="dangerouslySetInnerHTML"?(nt=nt?nt.__html:void 0,nt!=null&&ob(o,nt)):it==="children"?typeof nt=="string"?(_!=="textarea"||nt!=="")&&pb(o,nt):typeof nt=="number"&&pb(o,""+nt):it!=="suppressContentEditableWarning"&&it!=="suppressHydrationWarning"&&it!=="autoFocus"&&(ca.hasOwnProperty(it)?nt!=null&&it==="onScroll"&&G("scroll",o):nt!=null&&qa(o,it,nt,tt))}switch(_){case"input":Va(o),cb(o,_e,!1);break;case"textarea":Va(o),jb(o);break;case"option":_e.value!=null&&o.setAttribute("value",""+Sa(_e.value));break;case"select":o.multiple=!!_e.multiple,it=_e.value,it!=null?fb(o,!!_e.multiple,it,!1):_e.defaultValue!=null&&fb(o,!!_e.multiple,_e.defaultValue,!0);break;default:typeof et.onClick=="function"&&(o.onclick=jf)}mf(_,_e)&&(s.flags|=4)}s.ref!==null&&(s.flags|=128)}return null;case 6:if(o&&s.stateNode!=null)Ei(o,s,o.memoizedProps,_e);else{if(typeof _e!="string"&&s.stateNode===null)throw Error(y$1(166));_=dh(ch.current),dh(ah.current),rh(s)?(_e=s.stateNode,_=s.memoizedProps,_e[wf]=s,_e.nodeValue!==_&&(s.flags|=4)):(_e=(_.nodeType===9?_:_.ownerDocument).createTextNode(_e),_e[wf]=s,s.stateNode=_e)}return null;case 13:return H(P),_e=s.memoizedState,(s.flags&64)!==0?(s.lanes=_,s):(_e=_e!==null,_=!1,o===null?s.memoizedProps.fallback!==void 0&&rh(s):_=o.memoizedState!==null,_e&&!_&&(s.mode&2)!==0&&(o===null&&s.memoizedProps.unstable_avoidThisFallback!==!0||(P.current&1)!==0?V===0&&(V=3):((V===0||V===3)&&(V=4),U$1===null||(Dg&134217727)===0&&(Hi&134217727)===0||Ii(U$1,W))),(_e||_)&&(s.flags|=4),null);case 4:return fh(),Ci(s),o===null&&cf(s.stateNode.containerInfo),null;case 10:return rg(s),null;case 17:return Ff(s.type)&&Gf(),null;case 19:if(H(P),_e=s.memoizedState,_e===null)return null;if(it=(s.flags&64)!==0,tt=_e.rendering,tt===null)if(it)Fi(_e,!1);else{if(V!==0||o!==null&&(o.flags&64)!==0)for(o=s.child;o!==null;){if(tt=ih(o),tt!==null){for(s.flags|=64,Fi(_e,!1),it=tt.updateQueue,it!==null&&(s.updateQueue=it,s.flags|=4),_e.lastEffect===null&&(s.firstEffect=null),s.lastEffect=_e.lastEffect,_e=_,_=s.child;_!==null;)it=_,o=_e,it.flags&=2,it.nextEffect=null,it.firstEffect=null,it.lastEffect=null,tt=it.alternate,tt===null?(it.childLanes=0,it.lanes=o,it.child=null,it.memoizedProps=null,it.memoizedState=null,it.updateQueue=null,it.dependencies=null,it.stateNode=null):(it.childLanes=tt.childLanes,it.lanes=tt.lanes,it.child=tt.child,it.memoizedProps=tt.memoizedProps,it.memoizedState=tt.memoizedState,it.updateQueue=tt.updateQueue,it.type=tt.type,o=tt.dependencies,it.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),_=_.sibling;return I(P,P.current&1|2),s.child}o=o.sibling}_e.tail!==null&&O()>Ji&&(s.flags|=64,it=!0,Fi(_e,!1),s.lanes=33554432)}else{if(!it)if(o=ih(tt),o!==null){if(s.flags|=64,it=!0,_=o.updateQueue,_!==null&&(s.updateQueue=_,s.flags|=4),Fi(_e,!0),_e.tail===null&&_e.tailMode==="hidden"&&!tt.alternate&&!lh)return s=s.lastEffect=_e.lastEffect,s!==null&&(s.nextEffect=null),null}else 2*O()-_e.renderingStartTime>Ji&&_!==1073741824&&(s.flags|=64,it=!0,Fi(_e,!1),s.lanes=33554432);_e.isBackwards?(tt.sibling=s.child,s.child=tt):(_=_e.last,_!==null?_.sibling=tt:s.child=tt,_e.last=tt)}return _e.tail!==null?(_=_e.tail,_e.rendering=_,_e.tail=_.sibling,_e.lastEffect=s.lastEffect,_e.renderingStartTime=O(),_.sibling=null,s=P.current,I(P,it?s&1|2:s&1),_):null;case 23:case 24:return Ki(),o!==null&&o.memoizedState!==null!=(s.memoizedState!==null)&&_e.mode!=="unstable-defer-without-hiding"&&(s.flags|=4),null}throw Error(y$1(156,s.tag))}function Li(o){switch(o.tag){case 1:Ff(o.type)&&Gf();var s=o.flags;return s&4096?(o.flags=s&-4097|64,o):null;case 3:if(fh(),H(N),H(M),uh(),s=o.flags,(s&64)!==0)throw Error(y$1(285));return o.flags=s&-4097|64,o;case 5:return hh(o),null;case 13:return H(P),s=o.flags,s&4096?(o.flags=s&-4097|64,o):null;case 19:return H(P),null;case 4:return fh(),null;case 10:return rg(o),null;case 23:case 24:return Ki(),null;default:return null}}function Mi(o,s){try{var _="",_e=s;do _+=Qa(_e),_e=_e.return;while(_e);var et=_}catch(it){et=`
Error generating stack: `+it.message+`
`+it.stack}return{value:o,source:s,stack:et}}function Ni(o,s){try{console.error(s.value)}catch(_){setTimeout(function(){throw _})}}var Oi=typeof WeakMap=="function"?WeakMap:Map;function Pi(o,s,_){_=zg(-1,_),_.tag=3,_.payload={element:null};var _e=s.value;return _.callback=function(){Qi||(Qi=!0,Ri=_e),Ni(o,s)},_}function Si(o,s,_){_=zg(-1,_),_.tag=3;var _e=o.type.getDerivedStateFromError;if(typeof _e=="function"){var et=s.value;_.payload=function(){return Ni(o,s),_e(et)}}var it=o.stateNode;return it!==null&&typeof it.componentDidCatch=="function"&&(_.callback=function(){typeof _e!="function"&&(Ti===null?Ti=new Set([this]):Ti.add(this),Ni(o,s));var tt=s.stack;this.componentDidCatch(s.value,{componentStack:tt!==null?tt:""})}),_}var Ui=typeof WeakSet=="function"?WeakSet:Set;function Vi(o){var s=o.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(_){Wi(o,_)}else s.current=null}function Xi(o,s){switch(s.tag){case 0:case 11:case 15:case 22:return;case 1:if(s.flags&256&&o!==null){var _=o.memoizedProps,_e=o.memoizedState;o=s.stateNode,s=o.getSnapshotBeforeUpdate(s.elementType===s.type?_:lg(s.type,_),_e),o.__reactInternalSnapshotBeforeUpdate=s}return;case 3:s.flags&256&&qf(s.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(y$1(163))}function Yi(o,s,_){switch(_.tag){case 0:case 11:case 15:case 22:if(s=_.updateQueue,s=s!==null?s.lastEffect:null,s!==null){o=s=s.next;do{if((o.tag&3)===3){var _e=o.create;o.destroy=_e()}o=o.next}while(o!==s)}if(s=_.updateQueue,s=s!==null?s.lastEffect:null,s!==null){o=s=s.next;do{var et=o;_e=et.next,et=et.tag,(et&4)!==0&&(et&1)!==0&&(Zi(_,o),$i(_,o)),o=_e}while(o!==s)}return;case 1:o=_.stateNode,_.flags&4&&(s===null?o.componentDidMount():(_e=_.elementType===_.type?s.memoizedProps:lg(_.type,s.memoizedProps),o.componentDidUpdate(_e,s.memoizedState,o.__reactInternalSnapshotBeforeUpdate))),s=_.updateQueue,s!==null&&Eg(_,s,o);return;case 3:if(s=_.updateQueue,s!==null){if(o=null,_.child!==null)switch(_.child.tag){case 5:o=_.child.stateNode;break;case 1:o=_.child.stateNode}Eg(_,s,o)}return;case 5:o=_.stateNode,s===null&&_.flags&4&&mf(_.type,_.memoizedProps)&&o.focus();return;case 6:return;case 4:return;case 12:return;case 13:_.memoizedState===null&&(_=_.alternate,_!==null&&(_=_.memoizedState,_!==null&&(_=_.dehydrated,_!==null&&Cc(_))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(y$1(163))}function aj(o,s){for(var _=o;;){if(_.tag===5){var _e=_.stateNode;if(s)_e=_e.style,typeof _e.setProperty=="function"?_e.setProperty("display","none","important"):_e.display="none";else{_e=_.stateNode;var et=_.memoizedProps.style;et=et!=null&&et.hasOwnProperty("display")?et.display:null,_e.style.display=sb("display",et)}}else if(_.tag===6)_.stateNode.nodeValue=s?"":_.memoizedProps;else if((_.tag!==23&&_.tag!==24||_.memoizedState===null||_===o)&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===o)break;for(;_.sibling===null;){if(_.return===null||_.return===o)return;_=_.return}_.sibling.return=_.return,_=_.sibling}}function bj(o,s){if(Mf&&typeof Mf.onCommitFiberUnmount=="function")try{Mf.onCommitFiberUnmount(Lf,s)}catch{}switch(s.tag){case 0:case 11:case 14:case 15:case 22:if(o=s.updateQueue,o!==null&&(o=o.lastEffect,o!==null)){var _=o=o.next;do{var _e=_,et=_e.destroy;if(_e=_e.tag,et!==void 0)if((_e&4)!==0)Zi(s,_);else{_e=s;try{et()}catch(it){Wi(_e,it)}}_=_.next}while(_!==o)}break;case 1:if(Vi(s),o=s.stateNode,typeof o.componentWillUnmount=="function")try{o.props=s.memoizedProps,o.state=s.memoizedState,o.componentWillUnmount()}catch(it){Wi(s,it)}break;case 5:Vi(s);break;case 4:cj(o,s)}}function dj(o){o.alternate=null,o.child=null,o.dependencies=null,o.firstEffect=null,o.lastEffect=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.return=null,o.updateQueue=null}function ej(o){return o.tag===5||o.tag===3||o.tag===4}function fj(o){e:{for(var s=o.return;s!==null;){if(ej(s))break e;s=s.return}throw Error(y$1(160))}var _=s;switch(s=_.stateNode,_.tag){case 5:var _e=!1;break;case 3:s=s.containerInfo,_e=!0;break;case 4:s=s.containerInfo,_e=!0;break;default:throw Error(y$1(161))}_.flags&16&&(pb(s,""),_.flags&=-17);e:t:for(_=o;;){for(;_.sibling===null;){if(_.return===null||ej(_.return)){_=null;break e}_=_.return}for(_.sibling.return=_.return,_=_.sibling;_.tag!==5&&_.tag!==6&&_.tag!==18;){if(_.flags&2||_.child===null||_.tag===4)continue t;_.child.return=_,_=_.child}if(!(_.flags&2)){_=_.stateNode;break e}}_e?gj(o,_,s):hj(o,_,s)}function gj(o,s,_){var _e=o.tag,et=_e===5||_e===6;if(et)o=et?o.stateNode:o.stateNode.instance,s?_.nodeType===8?_.parentNode.insertBefore(o,s):_.insertBefore(o,s):(_.nodeType===8?(s=_.parentNode,s.insertBefore(o,_)):(s=_,s.appendChild(o)),_=_._reactRootContainer,_!=null||s.onclick!==null||(s.onclick=jf));else if(_e!==4&&(o=o.child,o!==null))for(gj(o,s,_),o=o.sibling;o!==null;)gj(o,s,_),o=o.sibling}function hj(o,s,_){var _e=o.tag,et=_e===5||_e===6;if(et)o=et?o.stateNode:o.stateNode.instance,s?_.insertBefore(o,s):_.appendChild(o);else if(_e!==4&&(o=o.child,o!==null))for(hj(o,s,_),o=o.sibling;o!==null;)hj(o,s,_),o=o.sibling}function cj(o,s){for(var _=s,_e=!1,et,it;;){if(!_e){_e=_.return;e:for(;;){if(_e===null)throw Error(y$1(160));switch(et=_e.stateNode,_e.tag){case 5:it=!1;break e;case 3:et=et.containerInfo,it=!0;break e;case 4:et=et.containerInfo,it=!0;break e}_e=_e.return}_e=!0}if(_.tag===5||_.tag===6){e:for(var tt=o,rt=_,nt=rt;;)if(bj(tt,nt),nt.child!==null&&nt.tag!==4)nt.child.return=nt,nt=nt.child;else{if(nt===rt)break e;for(;nt.sibling===null;){if(nt.return===null||nt.return===rt)break e;nt=nt.return}nt.sibling.return=nt.return,nt=nt.sibling}it?(tt=et,rt=_.stateNode,tt.nodeType===8?tt.parentNode.removeChild(rt):tt.removeChild(rt)):et.removeChild(_.stateNode)}else if(_.tag===4){if(_.child!==null){et=_.stateNode.containerInfo,it=!0,_.child.return=_,_=_.child;continue}}else if(bj(o,_),_.child!==null){_.child.return=_,_=_.child;continue}if(_===s)break;for(;_.sibling===null;){if(_.return===null||_.return===s)return;_=_.return,_.tag===4&&(_e=!1)}_.sibling.return=_.return,_=_.sibling}}function ij(o,s){switch(s.tag){case 0:case 11:case 14:case 15:case 22:var _=s.updateQueue;if(_=_!==null?_.lastEffect:null,_!==null){var _e=_=_.next;do(_e.tag&3)===3&&(o=_e.destroy,_e.destroy=void 0,o!==void 0&&o()),_e=_e.next;while(_e!==_)}return;case 1:return;case 5:if(_=s.stateNode,_!=null){_e=s.memoizedProps;var et=o!==null?o.memoizedProps:_e;o=s.type;var it=s.updateQueue;if(s.updateQueue=null,it!==null){for(_[xf]=_e,o==="input"&&_e.type==="radio"&&_e.name!=null&&$a(_,_e),wb(o,et),s=wb(o,_e),et=0;et<it.length;et+=2){var tt=it[et],rt=it[et+1];tt==="style"?tb(_,rt):tt==="dangerouslySetInnerHTML"?ob(_,rt):tt==="children"?pb(_,rt):qa(_,tt,rt,s)}switch(o){case"input":ab(_,_e);break;case"textarea":ib(_,_e);break;case"select":o=_._wrapperState.wasMultiple,_._wrapperState.wasMultiple=!!_e.multiple,it=_e.value,it!=null?fb(_,!!_e.multiple,it,!1):o!==!!_e.multiple&&(_e.defaultValue!=null?fb(_,!!_e.multiple,_e.defaultValue,!0):fb(_,!!_e.multiple,_e.multiple?[]:"",!1))}}}return;case 6:if(s.stateNode===null)throw Error(y$1(162));s.stateNode.nodeValue=s.memoizedProps;return;case 3:_=s.stateNode,_.hydrate&&(_.hydrate=!1,Cc(_.containerInfo));return;case 12:return;case 13:s.memoizedState!==null&&(jj=O(),aj(s.child,!0)),kj(s);return;case 19:kj(s);return;case 17:return;case 23:case 24:aj(s,s.memoizedState!==null);return}throw Error(y$1(163))}function kj(o){var s=o.updateQueue;if(s!==null){o.updateQueue=null;var _=o.stateNode;_===null&&(_=o.stateNode=new Ui),s.forEach(function(_e){var et=lj.bind(null,o,_e);_.has(_e)||(_.add(_e),_e.then(et,et))})}}function mj(o,s){return o!==null&&(o=o.memoizedState,o===null||o.dehydrated!==null)?(s=s.memoizedState,s!==null&&s.dehydrated===null):!1}var nj=Math.ceil,oj=ra.ReactCurrentDispatcher,pj=ra.ReactCurrentOwner,X=0,U$1=null,Y=null,W=0,qj=0,rj=Bf(0),V=0,sj=null,tj=0,Dg=0,Hi=0,uj=0,vj=null,jj=0,Ji=1/0;function wj(){Ji=O()+500}var Z$1=null,Qi=!1,Ri=null,Ti=null,xj=!1,yj=null,zj=90,Aj=[],Bj=[],Cj=null,Dj=0,Ej=null,Fj=-1,Gj=0,Hj=0,Ij=null,Jj=!1;function Hg(){return(X&48)!==0?O():Fj!==-1?Fj:Fj=O()}function Ig(o){if(o=o.mode,(o&2)===0)return 1;if((o&4)===0)return eg()===99?1:2;if(Gj===0&&(Gj=tj),kg.transition!==0){Hj!==0&&(Hj=vj!==null?vj.pendingLanes:0),o=Gj;var s=4186112&~Hj;return s&=-s,s===0&&(o=4186112&~o,s=o&-o,s===0&&(s=8192)),s}return o=eg(),(X&4)!==0&&o===98?o=Xc(12,Gj):(o=Sc(o),o=Xc(o,Gj)),o}function Jg(o,s,_){if(50<Dj)throw Dj=0,Ej=null,Error(y$1(185));if(o=Kj(o,s),o===null)return null;$c(o,s,_),o===U$1&&(Hi|=s,V===4&&Ii(o,W));var _e=eg();s===1?(X&8)!==0&&(X&48)===0?Lj(o):(Mj(o,_),X===0&&(wj(),ig())):((X&4)===0||_e!==98&&_e!==99||(Cj===null?Cj=new Set([o]):Cj.add(o)),Mj(o,_)),vj=o}function Kj(o,s){o.lanes|=s;var _=o.alternate;for(_!==null&&(_.lanes|=s),_=o,o=o.return;o!==null;)o.childLanes|=s,_=o.alternate,_!==null&&(_.childLanes|=s),_=o,o=o.return;return _.tag===3?_.stateNode:null}function Mj(o,s){for(var _=o.callbackNode,_e=o.suspendedLanes,et=o.pingedLanes,it=o.expirationTimes,tt=o.pendingLanes;0<tt;){var rt=31-Vc(tt),nt=1<<rt,ot=it[rt];if(ot===-1){if((nt&_e)===0||(nt&et)!==0){ot=s,Rc(nt);var st=F$1;it[rt]=10<=st?ot+250:6<=st?ot+5e3:-1}}else ot<=s&&(o.expiredLanes|=nt);tt&=~nt}if(_e=Uc(o,o===U$1?W:0),s=F$1,_e===0)_!==null&&(_!==Zf&&Pf(_),o.callbackNode=null,o.callbackPriority=0);else{if(_!==null){if(o.callbackPriority===s)return;_!==Zf&&Pf(_)}s===15?(_=Lj.bind(null,o),ag===null?(ag=[_],bg=Of(Uf,jg)):ag.push(_),_=Zf):s===14?_=hg(99,Lj.bind(null,o)):(_=Tc(s),_=hg(_,Nj.bind(null,o))),o.callbackPriority=s,o.callbackNode=_}}function Nj(o){if(Fj=-1,Hj=Gj=0,(X&48)!==0)throw Error(y$1(327));var s=o.callbackNode;if(Oj()&&o.callbackNode!==s)return null;var _=Uc(o,o===U$1?W:0);if(_===0)return null;var _e=_,et=X;X|=16;var it=Pj();(U$1!==o||W!==_e)&&(wj(),Qj(o,_e));do try{Rj();break}catch(rt){Sj(o,rt)}while(1);if(qg(),oj.current=it,X=et,Y!==null?_e=0:(U$1=null,W=0,_e=V),(tj&Hi)!==0)Qj(o,0);else if(_e!==0){if(_e===2&&(X|=64,o.hydrate&&(o.hydrate=!1,qf(o.containerInfo)),_=Wc(o),_!==0&&(_e=Tj(o,_))),_e===1)throw s=sj,Qj(o,0),Ii(o,_),Mj(o,O()),s;switch(o.finishedWork=o.current.alternate,o.finishedLanes=_,_e){case 0:case 1:throw Error(y$1(345));case 2:Uj(o);break;case 3:if(Ii(o,_),(_&62914560)===_&&(_e=jj+500-O(),10<_e)){if(Uc(o,0)!==0)break;if(et=o.suspendedLanes,(et&_)!==_){Hg(),o.pingedLanes|=o.suspendedLanes&et;break}o.timeoutHandle=of(Uj.bind(null,o),_e);break}Uj(o);break;case 4:if(Ii(o,_),(_&4186112)===_)break;for(_e=o.eventTimes,et=-1;0<_;){var tt=31-Vc(_);it=1<<tt,tt=_e[tt],tt>et&&(et=tt),_&=~it}if(_=et,_=O()-_,_=(120>_?120:480>_?480:1080>_?1080:1920>_?1920:3e3>_?3e3:4320>_?4320:1960*nj(_/1960))-_,10<_){o.timeoutHandle=of(Uj.bind(null,o),_);break}Uj(o);break;case 5:Uj(o);break;default:throw Error(y$1(329))}}return Mj(o,O()),o.callbackNode===s?Nj.bind(null,o):null}function Ii(o,s){for(s&=~uj,s&=~Hi,o.suspendedLanes|=s,o.pingedLanes&=~s,o=o.expirationTimes;0<s;){var _=31-Vc(s),_e=1<<_;o[_]=-1,s&=~_e}}function Lj(o){if((X&48)!==0)throw Error(y$1(327));if(Oj(),o===U$1&&(o.expiredLanes&W)!==0){var s=W,_=Tj(o,s);(tj&Hi)!==0&&(s=Uc(o,s),_=Tj(o,s))}else s=Uc(o,0),_=Tj(o,s);if(o.tag!==0&&_===2&&(X|=64,o.hydrate&&(o.hydrate=!1,qf(o.containerInfo)),s=Wc(o),s!==0&&(_=Tj(o,s))),_===1)throw _=sj,Qj(o,0),Ii(o,s),Mj(o,O()),_;return o.finishedWork=o.current.alternate,o.finishedLanes=s,Uj(o),Mj(o,O()),null}function Vj(){if(Cj!==null){var o=Cj;Cj=null,o.forEach(function(s){s.expiredLanes|=24&s.pendingLanes,Mj(s,O())})}ig()}function Wj(o,s){var _=X;X|=1;try{return o(s)}finally{X=_,X===0&&(wj(),ig())}}function Xj(o,s){var _=X;X&=-2,X|=8;try{return o(s)}finally{X=_,X===0&&(wj(),ig())}}function ni(o,s){I(rj,qj),qj|=s,tj|=s}function Ki(){qj=rj.current,H(rj)}function Qj(o,s){o.finishedWork=null,o.finishedLanes=0;var _=o.timeoutHandle;if(_!==-1&&(o.timeoutHandle=-1,pf(_)),Y!==null)for(_=Y.return;_!==null;){var _e=_;switch(_e.tag){case 1:_e=_e.type.childContextTypes,_e!=null&&Gf();break;case 3:fh(),H(N),H(M),uh();break;case 5:hh(_e);break;case 4:fh();break;case 13:H(P);break;case 19:H(P);break;case 10:rg(_e);break;case 23:case 24:Ki()}_=_.return}U$1=o,Y=Tg(o.current,null),W=qj=tj=s,V=0,sj=null,uj=Hi=Dg=0}function Sj(o,s){do{var _=Y;try{if(qg(),vh.current=Gh,yh){for(var _e=R.memoizedState;_e!==null;){var et=_e.queue;et!==null&&(et.pending=null),_e=_e.next}yh=!1}if(xh=0,T=S=R=null,zh=!1,pj.current=null,_===null||_.return===null){V=1,sj=s,Y=null;break}e:{var it=o,tt=_.return,rt=_,nt=s;if(s=W,rt.flags|=2048,rt.firstEffect=rt.lastEffect=null,nt!==null&&typeof nt=="object"&&typeof nt.then=="function"){var ot=nt;if((rt.mode&2)===0){var st=rt.alternate;st?(rt.updateQueue=st.updateQueue,rt.memoizedState=st.memoizedState,rt.lanes=st.lanes):(rt.updateQueue=null,rt.memoizedState=null)}var at=(P.current&1)!==0,lt=tt;do{var ct;if(ct=lt.tag===13){var ht=lt.memoizedState;if(ht!==null)ct=ht.dehydrated!==null;else{var mt=lt.memoizedProps;ct=mt.fallback===void 0?!1:mt.unstable_avoidThisFallback!==!0?!0:!at}}if(ct){var dt=lt.updateQueue;if(dt===null){var ft=new Set;ft.add(ot),lt.updateQueue=ft}else dt.add(ot);if((lt.mode&2)===0){if(lt.flags|=64,rt.flags|=16384,rt.flags&=-2981,rt.tag===1)if(rt.alternate===null)rt.tag=17;else{var ut=zg(-1,1);ut.tag=2,Ag(rt,ut)}rt.lanes|=1;break e}nt=void 0,rt=s;var pt=it.pingCache;if(pt===null?(pt=it.pingCache=new Oi,nt=new Set,pt.set(ot,nt)):(nt=pt.get(ot),nt===void 0&&(nt=new Set,pt.set(ot,nt))),!nt.has(rt)){nt.add(rt);var At=Yj.bind(null,it,ot,rt);ot.then(At,At)}lt.flags|=4096,lt.lanes=s;break e}lt=lt.return}while(lt!==null);nt=Error((Ra(rt.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.

Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`)}V!==5&&(V=2),nt=Mi(nt,rt),lt=tt;do{switch(lt.tag){case 3:it=nt,lt.flags|=4096,s&=-s,lt.lanes|=s;var gt=Pi(lt,it,s);Bg(lt,gt);break e;case 1:it=nt;var vt=lt.type,yt=lt.stateNode;if((lt.flags&64)===0&&(typeof vt.getDerivedStateFromError=="function"||yt!==null&&typeof yt.componentDidCatch=="function"&&(Ti===null||!Ti.has(yt)))){lt.flags|=4096,s&=-s,lt.lanes|=s;var bt=Si(lt,it,s);Bg(lt,bt);break e}}lt=lt.return}while(lt!==null)}Zj(_)}catch(Ct){s=Ct,Y===_&&_!==null&&(Y=_=_.return);continue}break}while(1)}function Pj(){var o=oj.current;return oj.current=Gh,o===null?Gh:o}function Tj(o,s){var _=X;X|=16;var _e=Pj();U$1===o&&W===s||Qj(o,s);do try{ak();break}catch(et){Sj(o,et)}while(1);if(qg(),X=_,oj.current=_e,Y!==null)throw Error(y$1(261));return U$1=null,W=0,V}function ak(){for(;Y!==null;)bk(Y)}function Rj(){for(;Y!==null&&!Qf();)bk(Y)}function bk(o){var s=ck(o.alternate,o,qj);o.memoizedProps=o.pendingProps,s===null?Zj(o):Y=s,pj.current=null}function Zj(o){var s=o;do{var _=s.alternate;if(o=s.return,(s.flags&2048)===0){if(_=Gi(_,s,qj),_!==null){Y=_;return}if(_=s,_.tag!==24&&_.tag!==23||_.memoizedState===null||(qj&1073741824)!==0||(_.mode&4)===0){for(var _e=0,et=_.child;et!==null;)_e|=et.lanes|et.childLanes,et=et.sibling;_.childLanes=_e}o!==null&&(o.flags&2048)===0&&(o.firstEffect===null&&(o.firstEffect=s.firstEffect),s.lastEffect!==null&&(o.lastEffect!==null&&(o.lastEffect.nextEffect=s.firstEffect),o.lastEffect=s.lastEffect),1<s.flags&&(o.lastEffect!==null?o.lastEffect.nextEffect=s:o.firstEffect=s,o.lastEffect=s))}else{if(_=Li(s),_!==null){_.flags&=2047,Y=_;return}o!==null&&(o.firstEffect=o.lastEffect=null,o.flags|=2048)}if(s=s.sibling,s!==null){Y=s;return}Y=s=o}while(s!==null);V===0&&(V=5)}function Uj(o){var s=eg();return gg(99,dk.bind(null,o,s)),null}function dk(o,s){do Oj();while(yj!==null);if((X&48)!==0)throw Error(y$1(327));var _=o.finishedWork;if(_===null)return null;if(o.finishedWork=null,o.finishedLanes=0,_===o.current)throw Error(y$1(177));o.callbackNode=null;var _e=_.lanes|_.childLanes,et=_e,it=o.pendingLanes&~et;o.pendingLanes=et,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=et,o.mutableReadLanes&=et,o.entangledLanes&=et,et=o.entanglements;for(var tt=o.eventTimes,rt=o.expirationTimes;0<it;){var nt=31-Vc(it),ot=1<<nt;et[nt]=0,tt[nt]=-1,rt[nt]=-1,it&=~ot}if(Cj!==null&&(_e&24)===0&&Cj.has(o)&&Cj.delete(o),o===U$1&&(Y=U$1=null,W=0),1<_.flags?_.lastEffect!==null?(_.lastEffect.nextEffect=_,_e=_.firstEffect):_e=_:_e=_.firstEffect,_e!==null){if(et=X,X|=32,pj.current=null,kf=fd,tt=Ne(),Oe(tt)){if("selectionStart"in tt)rt={start:tt.selectionStart,end:tt.selectionEnd};else e:if(rt=(rt=tt.ownerDocument)&&rt.defaultView||window,(ot=rt.getSelection&&rt.getSelection())&&ot.rangeCount!==0){rt=ot.anchorNode,it=ot.anchorOffset,nt=ot.focusNode,ot=ot.focusOffset;try{rt.nodeType,nt.nodeType}catch{rt=null;break e}var st=0,at=-1,lt=-1,ct=0,ht=0,mt=tt,dt=null;t:for(;;){for(var ft;mt!==rt||it!==0&&mt.nodeType!==3||(at=st+it),mt!==nt||ot!==0&&mt.nodeType!==3||(lt=st+ot),mt.nodeType===3&&(st+=mt.nodeValue.length),(ft=mt.firstChild)!==null;)dt=mt,mt=ft;for(;;){if(mt===tt)break t;if(dt===rt&&++ct===it&&(at=st),dt===nt&&++ht===ot&&(lt=st),(ft=mt.nextSibling)!==null)break;mt=dt,dt=mt.parentNode}mt=ft}rt=at===-1||lt===-1?null:{start:at,end:lt}}else rt=null;rt=rt||{start:0,end:0}}else rt=null;lf={focusedElem:tt,selectionRange:rt},fd=!1,Ij=null,Jj=!1,Z$1=_e;do try{ek()}catch(Ct){if(Z$1===null)throw Error(y$1(330));Wi(Z$1,Ct),Z$1=Z$1.nextEffect}while(Z$1!==null);Ij=null,Z$1=_e;do try{for(tt=o;Z$1!==null;){var ut=Z$1.flags;if(ut&16&&pb(Z$1.stateNode,""),ut&128){var pt=Z$1.alternate;if(pt!==null){var At=pt.ref;At!==null&&(typeof At=="function"?At(null):At.current=null)}}switch(ut&1038){case 2:fj(Z$1),Z$1.flags&=-3;break;case 6:fj(Z$1),Z$1.flags&=-3,ij(Z$1.alternate,Z$1);break;case 1024:Z$1.flags&=-1025;break;case 1028:Z$1.flags&=-1025,ij(Z$1.alternate,Z$1);break;case 4:ij(Z$1.alternate,Z$1);break;case 8:rt=Z$1,cj(tt,rt);var gt=rt.alternate;dj(rt),gt!==null&&dj(gt)}Z$1=Z$1.nextEffect}}catch(Ct){if(Z$1===null)throw Error(y$1(330));Wi(Z$1,Ct),Z$1=Z$1.nextEffect}while(Z$1!==null);if(At=lf,pt=Ne(),ut=At.focusedElem,tt=At.selectionRange,pt!==ut&&ut&&ut.ownerDocument&&Me(ut.ownerDocument.documentElement,ut)){for(tt!==null&&Oe(ut)&&(pt=tt.start,At=tt.end,At===void 0&&(At=pt),"selectionStart"in ut?(ut.selectionStart=pt,ut.selectionEnd=Math.min(At,ut.value.length)):(At=(pt=ut.ownerDocument||document)&&pt.defaultView||window,At.getSelection&&(At=At.getSelection(),rt=ut.textContent.length,gt=Math.min(tt.start,rt),tt=tt.end===void 0?gt:Math.min(tt.end,rt),!At.extend&&gt>tt&&(rt=tt,tt=gt,gt=rt),rt=Le(ut,gt),it=Le(ut,tt),rt&&it&&(At.rangeCount!==1||At.anchorNode!==rt.node||At.anchorOffset!==rt.offset||At.focusNode!==it.node||At.focusOffset!==it.offset)&&(pt=pt.createRange(),pt.setStart(rt.node,rt.offset),At.removeAllRanges(),gt>tt?(At.addRange(pt),At.extend(it.node,it.offset)):(pt.setEnd(it.node,it.offset),At.addRange(pt)))))),pt=[],At=ut;At=At.parentNode;)At.nodeType===1&&pt.push({element:At,left:At.scrollLeft,top:At.scrollTop});for(typeof ut.focus=="function"&&ut.focus(),ut=0;ut<pt.length;ut++)At=pt[ut],At.element.scrollLeft=At.left,At.element.scrollTop=At.top}fd=!!kf,lf=kf=null,o.current=_,Z$1=_e;do try{for(ut=o;Z$1!==null;){var vt=Z$1.flags;if(vt&36&&Yi(ut,Z$1.alternate,Z$1),vt&128){pt=void 0;var yt=Z$1.ref;if(yt!==null){var bt=Z$1.stateNode;switch(Z$1.tag){case 5:pt=bt;break;default:pt=bt}typeof yt=="function"?yt(pt):yt.current=pt}}Z$1=Z$1.nextEffect}}catch(Ct){if(Z$1===null)throw Error(y$1(330));Wi(Z$1,Ct),Z$1=Z$1.nextEffect}while(Z$1!==null);Z$1=null,$f(),X=et}else o.current=_;if(xj)xj=!1,yj=o,zj=s;else for(Z$1=_e;Z$1!==null;)s=Z$1.nextEffect,Z$1.nextEffect=null,Z$1.flags&8&&(vt=Z$1,vt.sibling=null,vt.stateNode=null),Z$1=s;if(_e=o.pendingLanes,_e===0&&(Ti=null),_e===1?o===Ej?Dj++:(Dj=0,Ej=o):Dj=0,_=_.stateNode,Mf&&typeof Mf.onCommitFiberRoot=="function")try{Mf.onCommitFiberRoot(Lf,_,void 0,(_.current.flags&64)===64)}catch{}if(Mj(o,O()),Qi)throw Qi=!1,o=Ri,Ri=null,o;return(X&8)!==0||ig(),null}function ek(){for(;Z$1!==null;){var o=Z$1.alternate;Jj||Ij===null||((Z$1.flags&8)!==0?dc(Z$1,Ij)&&(Jj=!0):Z$1.tag===13&&mj(o,Z$1)&&dc(Z$1,Ij)&&(Jj=!0));var s=Z$1.flags;(s&256)!==0&&Xi(o,Z$1),(s&512)===0||xj||(xj=!0,hg(97,function(){return Oj(),null})),Z$1=Z$1.nextEffect}}function Oj(){if(zj!==90){var o=97<zj?97:zj;return zj=90,gg(o,fk)}return!1}function $i(o,s){Aj.push(s,o),xj||(xj=!0,hg(97,function(){return Oj(),null}))}function Zi(o,s){Bj.push(s,o),xj||(xj=!0,hg(97,function(){return Oj(),null}))}function fk(){if(yj===null)return!1;var o=yj;if(yj=null,(X&48)!==0)throw Error(y$1(331));var s=X;X|=32;var _=Bj;Bj=[];for(var _e=0;_e<_.length;_e+=2){var et=_[_e],it=_[_e+1],tt=et.destroy;if(et.destroy=void 0,typeof tt=="function")try{tt()}catch(nt){if(it===null)throw Error(y$1(330));Wi(it,nt)}}for(_=Aj,Aj=[],_e=0;_e<_.length;_e+=2){et=_[_e],it=_[_e+1];try{var rt=et.create;et.destroy=rt()}catch(nt){if(it===null)throw Error(y$1(330));Wi(it,nt)}}for(rt=o.current.firstEffect;rt!==null;)o=rt.nextEffect,rt.nextEffect=null,rt.flags&8&&(rt.sibling=null,rt.stateNode=null),rt=o;return X=s,ig(),!0}function gk(o,s,_){s=Mi(_,s),s=Pi(o,s,1),Ag(o,s),s=Hg(),o=Kj(o,1),o!==null&&($c(o,1,s),Mj(o,s))}function Wi(o,s){if(o.tag===3)gk(o,o,s);else for(var _=o.return;_!==null;){if(_.tag===3){gk(_,o,s);break}else if(_.tag===1){var _e=_.stateNode;if(typeof _.type.getDerivedStateFromError=="function"||typeof _e.componentDidCatch=="function"&&(Ti===null||!Ti.has(_e))){o=Mi(s,o);var et=Si(_,o,1);if(Ag(_,et),et=Hg(),_=Kj(_,1),_!==null)$c(_,1,et),Mj(_,et);else if(typeof _e.componentDidCatch=="function"&&(Ti===null||!Ti.has(_e)))try{_e.componentDidCatch(s,o)}catch{}break}}_=_.return}}function Yj(o,s,_){var _e=o.pingCache;_e!==null&&_e.delete(s),s=Hg(),o.pingedLanes|=o.suspendedLanes&_,U$1===o&&(W&_)===_&&(V===4||V===3&&(W&62914560)===W&&500>O()-jj?Qj(o,0):uj|=_),Mj(o,s)}function lj(o,s){var _=o.stateNode;_!==null&&_.delete(s),s=0,s===0&&(s=o.mode,(s&2)===0?s=1:(s&4)===0?s=eg()===99?1:2:(Gj===0&&(Gj=tj),s=Yc(62914560&~Gj),s===0&&(s=4194304))),_=Hg(),o=Kj(o,s),o!==null&&($c(o,s,_),Mj(o,_))}var ck;ck=function(o,s,_){var _e=s.lanes;if(o!==null)if(o.memoizedProps!==s.pendingProps||N.current)ug=!0;else if((_&_e)!==0)ug=(o.flags&16384)!==0;else{switch(ug=!1,s.tag){case 3:ri(s),sh();break;case 5:gh(s);break;case 1:Ff(s.type)&&Jf(s);break;case 4:eh(s,s.stateNode.containerInfo);break;case 10:_e=s.memoizedProps.value;var et=s.type._context;I(mg,et._currentValue),et._currentValue=_e;break;case 13:if(s.memoizedState!==null)return(_&s.child.childLanes)!==0?ti(o,s,_):(I(P,P.current&1),s=hi(o,s,_),s!==null?s.sibling:null);I(P,P.current&1);break;case 19:if(_e=(_&s.childLanes)!==0,(o.flags&64)!==0){if(_e)return Ai(o,s,_);s.flags|=64}if(et=s.memoizedState,et!==null&&(et.rendering=null,et.tail=null,et.lastEffect=null),I(P,P.current),_e)break;return null;case 23:case 24:return s.lanes=0,mi(o,s,_)}return hi(o,s,_)}else ug=!1;switch(s.lanes=0,s.tag){case 2:if(_e=s.type,o!==null&&(o.alternate=null,s.alternate=null,s.flags|=2),o=s.pendingProps,et=Ef(s,M.current),tg(s,_),et=Ch(null,s,_e,o,et,_),s.flags|=1,typeof et=="object"&&et!==null&&typeof et.render=="function"&&et.$$typeof===void 0){if(s.tag=1,s.memoizedState=null,s.updateQueue=null,Ff(_e)){var it=!0;Jf(s)}else it=!1;s.memoizedState=et.state!==null&&et.state!==void 0?et.state:null,xg(s);var tt=_e.getDerivedStateFromProps;typeof tt=="function"&&Gg(s,_e,tt,o),et.updater=Kg,s.stateNode=et,et._reactInternals=s,Og(s,_e,o,_),s=qi(null,s,_e,!0,it,_)}else s.tag=0,fi(null,s,et,_),s=s.child;return s;case 16:et=s.elementType;e:{switch(o!==null&&(o.alternate=null,s.alternate=null,s.flags|=2),o=s.pendingProps,it=et._init,et=it(et._payload),s.type=et,it=s.tag=hk(et),o=lg(et,o),it){case 0:s=li(null,s,et,o,_);break e;case 1:s=pi(null,s,et,o,_);break e;case 11:s=gi(null,s,et,o,_);break e;case 14:s=ii(null,s,et,lg(et.type,o),_e,_);break e}throw Error(y$1(306,et,""))}return s;case 0:return _e=s.type,et=s.pendingProps,et=s.elementType===_e?et:lg(_e,et),li(o,s,_e,et,_);case 1:return _e=s.type,et=s.pendingProps,et=s.elementType===_e?et:lg(_e,et),pi(o,s,_e,et,_);case 3:if(ri(s),_e=s.updateQueue,o===null||_e===null)throw Error(y$1(282));if(_e=s.pendingProps,et=s.memoizedState,et=et!==null?et.element:null,yg(o,s),Cg(s,_e,null,_),_e=s.memoizedState.element,_e===et)sh(),s=hi(o,s,_);else{if(et=s.stateNode,(it=et.hydrate)&&(kh=rf(s.stateNode.containerInfo.firstChild),jh=s,it=lh=!0),it){if(o=et.mutableSourceEagerHydrationData,o!=null)for(et=0;et<o.length;et+=2)it=o[et],it._workInProgressVersionPrimary=o[et+1],th.push(it);for(_=Zg(s,null,_e,_),s.child=_;_;)_.flags=_.flags&-3|1024,_=_.sibling}else fi(o,s,_e,_),sh();s=s.child}return s;case 5:return gh(s),o===null&&ph(s),_e=s.type,et=s.pendingProps,it=o!==null?o.memoizedProps:null,tt=et.children,nf(_e,et)?tt=null:it!==null&&nf(_e,it)&&(s.flags|=16),oi(o,s),fi(o,s,tt,_),s.child;case 6:return o===null&&ph(s),null;case 13:return ti(o,s,_);case 4:return eh(s,s.stateNode.containerInfo),_e=s.pendingProps,o===null?s.child=Yg(s,null,_e,_):fi(o,s,_e,_),s.child;case 11:return _e=s.type,et=s.pendingProps,et=s.elementType===_e?et:lg(_e,et),gi(o,s,_e,et,_);case 7:return fi(o,s,s.pendingProps,_),s.child;case 8:return fi(o,s,s.pendingProps.children,_),s.child;case 12:return fi(o,s,s.pendingProps.children,_),s.child;case 10:e:{_e=s.type._context,et=s.pendingProps,tt=s.memoizedProps,it=et.value;var rt=s.type._context;if(I(mg,rt._currentValue),rt._currentValue=it,tt!==null)if(rt=tt.value,it=He(rt,it)?0:(typeof _e._calculateChangedBits=="function"?_e._calculateChangedBits(rt,it):1073741823)|0,it===0){if(tt.children===et.children&&!N.current){s=hi(o,s,_);break e}}else for(rt=s.child,rt!==null&&(rt.return=s);rt!==null;){var nt=rt.dependencies;if(nt!==null){tt=rt.child;for(var ot=nt.firstContext;ot!==null;){if(ot.context===_e&&(ot.observedBits&it)!==0){rt.tag===1&&(ot=zg(-1,_&-_),ot.tag=2,Ag(rt,ot)),rt.lanes|=_,ot=rt.alternate,ot!==null&&(ot.lanes|=_),sg(rt.return,_),nt.lanes|=_;break}ot=ot.next}}else tt=rt.tag===10&&rt.type===s.type?null:rt.child;if(tt!==null)tt.return=rt;else for(tt=rt;tt!==null;){if(tt===s){tt=null;break}if(rt=tt.sibling,rt!==null){rt.return=tt.return,tt=rt;break}tt=tt.return}rt=tt}fi(o,s,et.children,_),s=s.child}return s;case 9:return et=s.type,it=s.pendingProps,_e=it.children,tg(s,_),et=vg(et,it.unstable_observedBits),_e=_e(et),s.flags|=1,fi(o,s,_e,_),s.child;case 14:return et=s.type,it=lg(et,s.pendingProps),it=lg(et.type,it),ii(o,s,et,it,_e,_);case 15:return ki(o,s,s.type,s.pendingProps,_e,_);case 17:return _e=s.type,et=s.pendingProps,et=s.elementType===_e?et:lg(_e,et),o!==null&&(o.alternate=null,s.alternate=null,s.flags|=2),s.tag=1,Ff(_e)?(o=!0,Jf(s)):o=!1,tg(s,_),Mg(s,_e,et),Og(s,_e,et,_),qi(null,s,_e,!0,o,_);case 19:return Ai(o,s,_);case 23:return mi(o,s,_);case 24:return mi(o,s,_)}throw Error(y$1(156,s.tag))};function ik(o,s,_,_e){this.tag=o,this.key=_,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=_e,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function nh(o,s,_,_e){return new ik(o,s,_,_e)}function ji(o){return o=o.prototype,!(!o||!o.isReactComponent)}function hk(o){if(typeof o=="function")return ji(o)?1:0;if(o!=null){if(o=o.$$typeof,o===Aa)return 11;if(o===Da)return 14}return 2}function Tg(o,s){var _=o.alternate;return _===null?(_=nh(o.tag,s,o.key,o.mode),_.elementType=o.elementType,_.type=o.type,_.stateNode=o.stateNode,_.alternate=o,o.alternate=_):(_.pendingProps=s,_.type=o.type,_.flags=0,_.nextEffect=null,_.firstEffect=null,_.lastEffect=null),_.childLanes=o.childLanes,_.lanes=o.lanes,_.child=o.child,_.memoizedProps=o.memoizedProps,_.memoizedState=o.memoizedState,_.updateQueue=o.updateQueue,s=o.dependencies,_.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},_.sibling=o.sibling,_.index=o.index,_.ref=o.ref,_}function Vg(o,s,_,_e,et,it){var tt=2;if(_e=o,typeof o=="function")ji(o)&&(tt=1);else if(typeof o=="string")tt=5;else e:switch(o){case ua:return Xg(_.children,et,it,s);case Ha:tt=8,et|=16;break;case wa:tt=8,et|=1;break;case xa:return o=nh(12,_,s,et|8),o.elementType=xa,o.type=xa,o.lanes=it,o;case Ba:return o=nh(13,_,s,et),o.type=Ba,o.elementType=Ba,o.lanes=it,o;case Ca:return o=nh(19,_,s,et),o.elementType=Ca,o.lanes=it,o;case Ia:return vi(_,et,it,s);case Ja:return o=nh(24,_,s,et),o.elementType=Ja,o.lanes=it,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case ya:tt=10;break e;case za:tt=9;break e;case Aa:tt=11;break e;case Da:tt=14;break e;case Ea:tt=16,_e=null;break e;case Fa:tt=22;break e}throw Error(y$1(130,o==null?o:typeof o,""))}return s=nh(tt,_,s,et),s.elementType=o,s.type=_e,s.lanes=it,s}function Xg(o,s,_,_e){return o=nh(7,o,_e,s),o.lanes=_,o}function vi(o,s,_,_e){return o=nh(23,o,_e,s),o.elementType=Ia,o.lanes=_,o}function Ug(o,s,_){return o=nh(6,o,null,s),o.lanes=_,o}function Wg(o,s,_){return s=nh(4,o.children!==null?o.children:[],o.key,s),s.lanes=_,s.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},s}function jk(o,s,_){this.tag=s,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=_,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=Zc(0),this.expirationTimes=Zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zc(0),this.mutableSourceEagerHydrationData=null}function kk(o,s,_){var _e=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ta,key:_e==null?null:""+_e,children:o,containerInfo:s,implementation:_}}function lk(o,s,_,_e){var et=s.current,it=Hg(),tt=Ig(et);e:if(_){_=_._reactInternals;t:{if(Zb(_)!==_||_.tag!==1)throw Error(y$1(170));var rt=_;do{switch(rt.tag){case 3:rt=rt.stateNode.context;break t;case 1:if(Ff(rt.type)){rt=rt.stateNode.__reactInternalMemoizedMergedChildContext;break t}}rt=rt.return}while(rt!==null);throw Error(y$1(171))}if(_.tag===1){var nt=_.type;if(Ff(nt)){_=If(_,nt,rt);break e}}_=rt}else _=Cf;return s.context===null?s.context=_:s.pendingContext=_,s=zg(it,tt),s.payload={element:o},_e=_e===void 0?null:_e,_e!==null&&(s.callback=_e),Ag(et,s),Jg(et,tt,it),tt}function mk(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function nk(o,s){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var _=o.retryLane;o.retryLane=_!==0&&_<s?_:s}}function ok(o,s){nk(o,s),(o=o.alternate)&&nk(o,s)}function pk(){return null}function qk(o,s,_){var _e=_!=null&&_.hydrationOptions!=null&&_.hydrationOptions.mutableSources||null;if(_=new jk(o,s,_!=null&&_.hydrate===!0),s=nh(3,null,null,s===2?7:s===1?3:0),_.current=s,s.stateNode=_,xg(s),o[ff]=_.current,cf(o.nodeType===8?o.parentNode:o),_e)for(o=0;o<_e.length;o++){s=_e[o];var et=s._getVersion;et=et(s._source),_.mutableSourceEagerHydrationData==null?_.mutableSourceEagerHydrationData=[s,et]:_.mutableSourceEagerHydrationData.push(s,et)}this._internalRoot=_}qk.prototype.render=function(o){lk(o,this._internalRoot,null,null)};qk.prototype.unmount=function(){var o=this._internalRoot,s=o.containerInfo;lk(null,o,null,function(){s[ff]=null})};function rk(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function sk(o,s){if(s||(s=o?o.nodeType===9?o.documentElement:o.firstChild:null,s=!(!s||s.nodeType!==1||!s.hasAttribute("data-reactroot"))),!s)for(var _;_=o.lastChild;)o.removeChild(_);return new qk(o,0,s?{hydrate:!0}:void 0)}function tk(o,s,_,_e,et){var it=_._reactRootContainer;if(it){var tt=it._internalRoot;if(typeof et=="function"){var rt=et;et=function(){var ot=mk(tt);rt.call(ot)}}lk(s,tt,o,et)}else{if(it=_._reactRootContainer=sk(_,_e),tt=it._internalRoot,typeof et=="function"){var nt=et;et=function(){var ot=mk(tt);nt.call(ot)}}Xj(function(){lk(s,tt,o,et)})}return mk(tt)}ec=function(o){if(o.tag===13){var s=Hg();Jg(o,4,s),ok(o,4)}};fc=function(o){if(o.tag===13){var s=Hg();Jg(o,67108864,s),ok(o,67108864)}};gc=function(o){if(o.tag===13){var s=Hg(),_=Ig(o);Jg(o,_,s),ok(o,_)}};hc=function(o,s){return s()};yb=function(o,s,_){switch(s){case"input":if(ab(o,_),s=_.name,_.type==="radio"&&s!=null){for(_=o;_.parentNode;)_=_.parentNode;for(_=_.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<_.length;s++){var _e=_[s];if(_e!==o&&_e.form===o.form){var et=Db(_e);if(!et)throw Error(y$1(90));Wa(_e),ab(_e,et)}}}break;case"textarea":ib(o,_);break;case"select":s=_.value,s!=null&&fb(o,!!_.multiple,s,!1)}};Gb=Wj;Hb=function(o,s,_,_e,et){var it=X;X|=4;try{return gg(98,o.bind(null,s,_,_e,et))}finally{X=it,X===0&&(wj(),ig())}};Ib=function(){(X&49)===0&&(Vj(),Oj())};Jb=function(o,s){var _=X;X|=2;try{return o(s)}finally{X=_,X===0&&(wj(),ig())}};function uk(o,s){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!rk(s))throw Error(y$1(200));return kk(o,s,null,_)}var vk={Events:[Cb,ue,Db,Eb,Fb,Oj,{current:!1}]},wk={findFiberByHostInstance:wc,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},xk={bundleType:wk.bundleType,version:wk.version,rendererPackageName:wk.rendererPackageName,rendererConfig:wk.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ra.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=cc(o),o===null?null:o.stateNode},findFiberByHostInstance:wk.findFiberByHostInstance||pk,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var yk=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yk.isDisabled&&yk.supportsFiber)try{Lf=yk.inject(xk),Mf=yk}catch{}}reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vk;reactDom_production_min.createPortal=uk;reactDom_production_min.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var s=o._reactInternals;if(s===void 0)throw typeof o.render=="function"?Error(y$1(188)):Error(y$1(268,Object.keys(o)));return o=cc(s),o=o===null?null:o.stateNode,o};reactDom_production_min.flushSync=function(o,s){var _=X;if((_&48)!==0)return o(s);X|=1;try{if(o)return gg(99,o.bind(null,s))}finally{X=_,ig()}};reactDom_production_min.hydrate=function(o,s,_){if(!rk(s))throw Error(y$1(200));return tk(null,o,s,!0,_)};reactDom_production_min.render=function(o,s,_){if(!rk(s))throw Error(y$1(200));return tk(null,o,s,!1,_)};reactDom_production_min.unmountComponentAtNode=function(o){if(!rk(o))throw Error(y$1(40));return o._reactRootContainer?(Xj(function(){tk(null,null,o,!1,function(){o._reactRootContainer=null,o[ff]=null})}),!0):!1};reactDom_production_min.unstable_batchedUpdates=Wj;reactDom_production_min.unstable_createPortal=function(o,s){return uk(o,s,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};reactDom_production_min.unstable_renderSubtreeIntoContainer=function(o,s,_,_e){if(!rk(_))throw Error(y$1(200));if(o==null||o._reactInternals===void 0)throw Error(y$1(38));return tk(o,s,_,!1,_e)};reactDom_production_min.version="17.0.2";function checkDCE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(o){console.error(o)}}checkDCE(),reactDom.exports=reactDom_production_min;var ReactDOM=reactDom.exports,reactIs$1={exports:{}},reactIs_production_min={};/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var b=typeof Symbol=="function"&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e$1=b?Symbol.for("react.fragment"):60107,f$2=b?Symbol.for("react.strict_mode"):60108,g$1=b?Symbol.for("react.profiler"):60114,h$1=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m$1=b?Symbol.for("react.concurrent_mode"):60111,n$1=b?Symbol.for("react.forward_ref"):60112,p$1=b?Symbol.for("react.suspense"):60113,q$1=b?Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;function z$1(o){if(typeof o=="object"&&o!==null){var s=o.$$typeof;switch(s){case c:switch(o=o.type,o){case l:case m$1:case e$1:case g$1:case f$2:case p$1:return o;default:switch(o=o&&o.$$typeof,o){case k:case n$1:case t:case r:case h$1:return o;default:return s}}case d:return s}}}function A$1(o){return z$1(o)===m$1}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m$1;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h$1;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n$1;reactIs_production_min.Fragment=e$1;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;reactIs_production_min.Profiler=g$1;reactIs_production_min.StrictMode=f$2;reactIs_production_min.Suspense=p$1;reactIs_production_min.isAsyncMode=function(o){return A$1(o)||z$1(o)===l};reactIs_production_min.isConcurrentMode=A$1;reactIs_production_min.isContextConsumer=function(o){return z$1(o)===k};reactIs_production_min.isContextProvider=function(o){return z$1(o)===h$1};reactIs_production_min.isElement=function(o){return typeof o=="object"&&o!==null&&o.$$typeof===c};reactIs_production_min.isForwardRef=function(o){return z$1(o)===n$1};reactIs_production_min.isFragment=function(o){return z$1(o)===e$1};reactIs_production_min.isLazy=function(o){return z$1(o)===t};reactIs_production_min.isMemo=function(o){return z$1(o)===r};reactIs_production_min.isPortal=function(o){return z$1(o)===d};reactIs_production_min.isProfiler=function(o){return z$1(o)===g$1};reactIs_production_min.isStrictMode=function(o){return z$1(o)===f$2};reactIs_production_min.isSuspense=function(o){return z$1(o)===p$1};reactIs_production_min.isValidElementType=function(o){return typeof o=="string"||typeof o=="function"||o===e$1||o===m$1||o===g$1||o===f$2||o===p$1||o===q$1||typeof o=="object"&&o!==null&&(o.$$typeof===t||o.$$typeof===r||o.$$typeof===h$1||o.$$typeof===k||o.$$typeof===n$1||o.$$typeof===w||o.$$typeof===x||o.$$typeof===y||o.$$typeof===v)};reactIs_production_min.typeOf=z$1;reactIs$1.exports=reactIs_production_min;var reactIs=reactIs$1.exports,REACT_STATICS={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},KNOWN_STATICS={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},FORWARD_REF_STATICS={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},MEMO_STATICS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},TYPE_STATICS={};TYPE_STATICS[reactIs.ForwardRef]=FORWARD_REF_STATICS;TYPE_STATICS[reactIs.Memo]=MEMO_STATICS;function getStatics(o){return reactIs.isMemo(o)?MEMO_STATICS:TYPE_STATICS[o.$$typeof]||REACT_STATICS}var defineProperty=Object.defineProperty,getOwnPropertyNames=Object.getOwnPropertyNames,getOwnPropertySymbols=Object.getOwnPropertySymbols,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,getPrototypeOf=Object.getPrototypeOf,objectPrototype=Object.prototype;function hoistNonReactStatics(o,s,_){if(typeof s!="string"){if(objectPrototype){var _e=getPrototypeOf(s);_e&&_e!==objectPrototype&&hoistNonReactStatics(o,_e,_)}var et=getOwnPropertyNames(s);getOwnPropertySymbols&&(et=et.concat(getOwnPropertySymbols(s)));for(var it=getStatics(o),tt=getStatics(s),rt=0;rt<et.length;++rt){var nt=et[rt];if(!KNOWN_STATICS[nt]&&!(_&&_[nt])&&!(tt&&tt[nt])&&!(it&&it[nt])){var ot=getOwnPropertyDescriptor(s,nt);try{defineProperty(o,nt,ot)}catch{}}}}return o}var hoistNonReactStatics_cjs=hoistNonReactStatics;const privateData=new WeakMap,wrappers=new WeakMap;function pd(o){const s=privateData.get(o);return console.assert(s!=null,"'this' is expected an Event object, but got",o),s}function setCancelFlag(o){if(o.passiveListener!=null){typeof console!="undefined"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",o.passiveListener);return}!o.event.cancelable||(o.canceled=!0,typeof o.event.preventDefault=="function"&&o.event.preventDefault())}function Event$1(o,s){privateData.set(this,{eventTarget:o,event:s,eventPhase:2,currentTarget:o,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:s.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const _=Object.keys(s);for(let _e=0;_e<_.length;++_e){const et=_[_e];et in this||Object.defineProperty(this,et,defineRedirectDescriptor(et))}}Event$1.prototype={get type(){return pd(this).event.type},get target(){return pd(this).eventTarget},get currentTarget(){return pd(this).currentTarget},composedPath(){const o=pd(this).currentTarget;return o==null?[]:[o]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return pd(this).eventPhase},stopPropagation(){const o=pd(this);o.stopped=!0,typeof o.event.stopPropagation=="function"&&o.event.stopPropagation()},stopImmediatePropagation(){const o=pd(this);o.stopped=!0,o.immediateStopped=!0,typeof o.event.stopImmediatePropagation=="function"&&o.event.stopImmediatePropagation()},get bubbles(){return Boolean(pd(this).event.bubbles)},get cancelable(){return Boolean(pd(this).event.cancelable)},preventDefault(){setCancelFlag(pd(this))},get defaultPrevented(){return pd(this).canceled},get composed(){return Boolean(pd(this).event.composed)},get timeStamp(){return pd(this).timeStamp},get srcElement(){return pd(this).eventTarget},get cancelBubble(){return pd(this).stopped},set cancelBubble(o){if(!o)return;const s=pd(this);s.stopped=!0,typeof s.event.cancelBubble=="boolean"&&(s.event.cancelBubble=!0)},get returnValue(){return!pd(this).canceled},set returnValue(o){o||setCancelFlag(pd(this))},initEvent(){}};Object.defineProperty(Event$1.prototype,"constructor",{value:Event$1,configurable:!0,writable:!0});typeof window!="undefined"&&typeof window.Event!="undefined"&&(Object.setPrototypeOf(Event$1.prototype,window.Event.prototype),wrappers.set(window.Event.prototype,Event$1));function defineRedirectDescriptor(o){return{get(){return pd(this).event[o]},set(s){pd(this).event[o]=s},configurable:!0,enumerable:!0}}function defineCallDescriptor(o){return{value(){const s=pd(this).event;return s[o].apply(s,arguments)},configurable:!0,enumerable:!0}}function defineWrapper(o,s){const _=Object.keys(s);if(_.length===0)return o;function _e(et,it){o.call(this,et,it)}_e.prototype=Object.create(o.prototype,{constructor:{value:_e,configurable:!0,writable:!0}});for(let et=0;et<_.length;++et){const it=_[et];if(!(it in o.prototype)){const rt=typeof Object.getOwnPropertyDescriptor(s,it).value=="function";Object.defineProperty(_e.prototype,it,rt?defineCallDescriptor(it):defineRedirectDescriptor(it))}}return _e}function getWrapper(o){if(o==null||o===Object.prototype)return Event$1;let s=wrappers.get(o);return s==null&&(s=defineWrapper(getWrapper(Object.getPrototypeOf(o)),o),wrappers.set(o,s)),s}function wrapEvent(o,s){const _=getWrapper(Object.getPrototypeOf(s));return new _(o,s)}function isStopped(o){return pd(o).immediateStopped}function setEventPhase(o,s){pd(o).eventPhase=s}function setCurrentTarget(o,s){pd(o).currentTarget=s}function setPassiveListener(o,s){pd(o).passiveListener=s}const listenersMap=new WeakMap,CAPTURE=1,BUBBLE=2,ATTRIBUTE=3;function isObject$3(o){return o!==null&&typeof o=="object"}function getListeners(o){const s=listenersMap.get(o);if(s==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return s}function defineEventAttributeDescriptor(o){return{get(){let _=getListeners(this).get(o);for(;_!=null;){if(_.listenerType===ATTRIBUTE)return _.listener;_=_.next}return null},set(s){typeof s!="function"&&!isObject$3(s)&&(s=null);const _=getListeners(this);let _e=null,et=_.get(o);for(;et!=null;)et.listenerType===ATTRIBUTE?_e!==null?_e.next=et.next:et.next!==null?_.set(o,et.next):_.delete(o):_e=et,et=et.next;if(s!==null){const it={listener:s,listenerType:ATTRIBUTE,passive:!1,once:!1,next:null};_e===null?_.set(o,it):_e.next=it}},configurable:!0,enumerable:!0}}function defineEventAttribute(o,s){Object.defineProperty(o,`on${s}`,defineEventAttributeDescriptor(s))}function defineCustomEventTarget(o){function s(){EventTarget.call(this)}s.prototype=Object.create(EventTarget.prototype,{constructor:{value:s,configurable:!0,writable:!0}});for(let _=0;_<o.length;++_)defineEventAttribute(s.prototype,o[_]);return s}function EventTarget(){if(this instanceof EventTarget){listenersMap.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return defineCustomEventTarget(arguments[0]);if(arguments.length>0){const o=new Array(arguments.length);for(let s=0;s<arguments.length;++s)o[s]=arguments[s];return defineCustomEventTarget(o)}throw new TypeError("Cannot call a class as a function")}EventTarget.prototype={addEventListener(o,s,_){if(s==null)return;if(typeof s!="function"&&!isObject$3(s))throw new TypeError("'listener' should be a function or an object.");const _e=getListeners(this),et=isObject$3(_),tt=Boolean(et?_.capture:_)?CAPTURE:BUBBLE,rt={listener:s,listenerType:tt,passive:et&&Boolean(_.passive),once:et&&Boolean(_.once),next:null};let nt=_e.get(o);if(nt===void 0){_e.set(o,rt);return}let ot=null;for(;nt!=null;){if(nt.listener===s&&nt.listenerType===tt)return;ot=nt,nt=nt.next}ot.next=rt},removeEventListener(o,s,_){if(s==null)return;const _e=getListeners(this),it=(isObject$3(_)?Boolean(_.capture):Boolean(_))?CAPTURE:BUBBLE;let tt=null,rt=_e.get(o);for(;rt!=null;){if(rt.listener===s&&rt.listenerType===it){tt!==null?tt.next=rt.next:rt.next!==null?_e.set(o,rt.next):_e.delete(o);return}tt=rt,rt=rt.next}},dispatchEvent(o){if(o==null||typeof o.type!="string")throw new TypeError('"event.type" should be a string.');const s=getListeners(this),_=o.type;let _e=s.get(_);if(_e==null)return!0;const et=wrapEvent(this,o);let it=null;for(;_e!=null;){if(_e.once?it!==null?it.next=_e.next:_e.next!==null?s.set(_,_e.next):s.delete(_):it=_e,setPassiveListener(et,_e.passive?_e.listener:null),typeof _e.listener=="function")try{_e.listener.call(this,et)}catch(tt){typeof console!="undefined"&&typeof console.error=="function"&&console.error(tt)}else _e.listenerType!==ATTRIBUTE&&typeof _e.listener.handleEvent=="function"&&_e.listener.handleEvent(et);if(isStopped(et))break;_e=_e.next}return setPassiveListener(et,null),setEventPhase(et,0),setCurrentTarget(et,null),!et.defaultPrevented}};Object.defineProperty(EventTarget.prototype,"constructor",{value:EventTarget,configurable:!0,writable:!0});typeof window!="undefined"&&typeof window.EventTarget!="undefined"&&Object.setPrototypeOf(EventTarget.prototype,window.EventTarget.prototype);var flatbuffers={};flatbuffers.SIZEOF_SHORT=2;flatbuffers.SIZEOF_INT=4;flatbuffers.FILE_IDENTIFIER_LENGTH=4;flatbuffers.Encoding={UTF8_BYTES:1,UTF16_STRING:2};flatbuffers.int32=new Int32Array(2);flatbuffers.float32=new Float32Array(flatbuffers.int32.buffer);flatbuffers.float64=new Float64Array(flatbuffers.int32.buffer);flatbuffers.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;flatbuffers.Long=function(o,s){this.low=o|0,this.high=s|0};flatbuffers.Long.create=function(o,s){return o==0&&s==0?flatbuffers.Long.ZERO:new flatbuffers.Long(o,s)};flatbuffers.Long.prototype.toFloat64=function(){return(this.low>>>0)+this.high*4294967296};flatbuffers.Long.prototype.equals=function(o){return this.low==o.low&&this.high==o.high};flatbuffers.Long.ZERO=new flatbuffers.Long(0,0);flatbuffers.Builder=function(o){if(o)var s=o;else var s=1024;this.bb=flatbuffers.ByteBuffer.allocate(s),this.space=s,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1};flatbuffers.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1};flatbuffers.Builder.prototype.forceDefaults=function(o){this.force_defaults=o};flatbuffers.Builder.prototype.dataBuffer=function(){return this.bb};flatbuffers.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())};flatbuffers.Builder.prototype.prep=function(o,s){o>this.minalign&&(this.minalign=o);for(var _=~(this.bb.capacity()-this.space+s)+1&o-1;this.space<_+o+s;){var _e=this.bb.capacity();this.bb=flatbuffers.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-_e}this.pad(_)};flatbuffers.Builder.prototype.pad=function(o){for(var s=0;s<o;s++)this.bb.writeInt8(--this.space,0)};flatbuffers.Builder.prototype.writeInt8=function(o){this.bb.writeInt8(this.space-=1,o)};flatbuffers.Builder.prototype.writeInt16=function(o){this.bb.writeInt16(this.space-=2,o)};flatbuffers.Builder.prototype.writeInt32=function(o){this.bb.writeInt32(this.space-=4,o)};flatbuffers.Builder.prototype.writeInt64=function(o){this.bb.writeInt64(this.space-=8,o)};flatbuffers.Builder.prototype.writeFloat32=function(o){this.bb.writeFloat32(this.space-=4,o)};flatbuffers.Builder.prototype.writeFloat64=function(o){this.bb.writeFloat64(this.space-=8,o)};flatbuffers.Builder.prototype.addInt8=function(o){this.prep(1,0),this.writeInt8(o)};flatbuffers.Builder.prototype.addInt16=function(o){this.prep(2,0),this.writeInt16(o)};flatbuffers.Builder.prototype.addInt32=function(o){this.prep(4,0),this.writeInt32(o)};flatbuffers.Builder.prototype.addInt64=function(o){this.prep(8,0),this.writeInt64(o)};flatbuffers.Builder.prototype.addFloat32=function(o){this.prep(4,0),this.writeFloat32(o)};flatbuffers.Builder.prototype.addFloat64=function(o){this.prep(8,0),this.writeFloat64(o)};flatbuffers.Builder.prototype.addFieldInt8=function(o,s,_){(this.force_defaults||s!=_)&&(this.addInt8(s),this.slot(o))};flatbuffers.Builder.prototype.addFieldInt16=function(o,s,_){(this.force_defaults||s!=_)&&(this.addInt16(s),this.slot(o))};flatbuffers.Builder.prototype.addFieldInt32=function(o,s,_){(this.force_defaults||s!=_)&&(this.addInt32(s),this.slot(o))};flatbuffers.Builder.prototype.addFieldInt64=function(o,s,_){(this.force_defaults||!s.equals(_))&&(this.addInt64(s),this.slot(o))};flatbuffers.Builder.prototype.addFieldFloat32=function(o,s,_){(this.force_defaults||s!=_)&&(this.addFloat32(s),this.slot(o))};flatbuffers.Builder.prototype.addFieldFloat64=function(o,s,_){(this.force_defaults||s!=_)&&(this.addFloat64(s),this.slot(o))};flatbuffers.Builder.prototype.addFieldOffset=function(o,s,_){(this.force_defaults||s!=_)&&(this.addOffset(s),this.slot(o))};flatbuffers.Builder.prototype.addFieldStruct=function(o,s,_){s!=_&&(this.nested(s),this.slot(o))};flatbuffers.Builder.prototype.nested=function(o){if(o!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")};flatbuffers.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")};flatbuffers.Builder.prototype.slot=function(o){this.vtable[o]=this.offset()};flatbuffers.Builder.prototype.offset=function(){return this.bb.capacity()-this.space};flatbuffers.Builder.growByteBuffer=function(o){var s=o.capacity();if(s&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var _=s<<1,_e=flatbuffers.ByteBuffer.allocate(_);return _e.setPosition(_-s),_e.bytes().set(o.bytes(),_-s),_e};flatbuffers.Builder.prototype.addOffset=function(o){this.prep(flatbuffers.SIZEOF_INT,0),this.writeInt32(this.offset()-o+flatbuffers.SIZEOF_INT)};flatbuffers.Builder.prototype.startObject=function(o){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=o;for(var s=0;s<o;s++)this.vtable[s]=0;this.isNested=!0,this.object_start=this.offset()};flatbuffers.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var o=this.offset(),s=this.vtable_in_use-1;s>=0&&this.vtable[s]==0;s--);for(var _=s+1;s>=0;s--)this.addInt16(this.vtable[s]!=0?o-this.vtable[s]:0);var _e=2;this.addInt16(o-this.object_start);var et=(_+_e)*flatbuffers.SIZEOF_SHORT;this.addInt16(et);var it=0,tt=this.space;e:for(s=0;s<this.vtables.length;s++){var rt=this.bb.capacity()-this.vtables[s];if(et==this.bb.readInt16(rt)){for(var nt=flatbuffers.SIZEOF_SHORT;nt<et;nt+=flatbuffers.SIZEOF_SHORT)if(this.bb.readInt16(tt+nt)!=this.bb.readInt16(rt+nt))continue e;it=this.vtables[s];break}}return it?(this.space=this.bb.capacity()-o,this.bb.writeInt32(this.space,it-o)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-o,this.offset()-o)),this.isNested=!1,o};flatbuffers.Builder.prototype.finish=function(o,s){if(s){var _=s;if(this.prep(this.minalign,flatbuffers.SIZEOF_INT+flatbuffers.FILE_IDENTIFIER_LENGTH),_.length!=flatbuffers.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+flatbuffers.FILE_IDENTIFIER_LENGTH);for(var _e=flatbuffers.FILE_IDENTIFIER_LENGTH-1;_e>=0;_e--)this.writeInt8(_.charCodeAt(_e))}this.prep(this.minalign,flatbuffers.SIZEOF_INT),this.addOffset(o),this.bb.setPosition(this.space)};flatbuffers.Builder.prototype.requiredField=function(o,s){var _=this.bb.capacity()-o,_e=_-this.bb.readInt32(_),et=this.bb.readInt16(_e+s)!=0;if(!et)throw new Error("FlatBuffers: field "+s+" must be set")};flatbuffers.Builder.prototype.startVector=function(o,s,_){this.notNested(),this.vector_num_elems=s,this.prep(flatbuffers.SIZEOF_INT,o*s),this.prep(_,o*s)};flatbuffers.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()};flatbuffers.Builder.prototype.createString=function(o){if(o instanceof Uint8Array)var s=o;else for(var s=[],_=0;_<o.length;){var _e,et=o.charCodeAt(_++);if(et<55296||et>=56320)_e=et;else{var it=o.charCodeAt(_++);_e=(et<<10)+it+(65536-(55296<<10)-56320)}_e<128?s.push(_e):(_e<2048?s.push(_e>>6&31|192):(_e<65536?s.push(_e>>12&15|224):s.push(_e>>18&7|240,_e>>12&63|128),s.push(_e>>6&63|128)),s.push(_e&63|128))}this.addInt8(0),this.startVector(1,s.length,1),this.bb.setPosition(this.space-=s.length);for(var _=0,tt=this.space,rt=this.bb.bytes();_<s.length;_++)rt[tt++]=s[_];return this.endVector()};flatbuffers.Builder.prototype.createLong=function(o,s){return flatbuffers.Long.create(o,s)};flatbuffers.ByteBuffer=function(o){this.bytes_=o,this.position_=0};flatbuffers.ByteBuffer.allocate=function(o){return new flatbuffers.ByteBuffer(new Uint8Array(o))};flatbuffers.ByteBuffer.prototype.clear=function(){this.position_=0};flatbuffers.ByteBuffer.prototype.bytes=function(){return this.bytes_};flatbuffers.ByteBuffer.prototype.position=function(){return this.position_};flatbuffers.ByteBuffer.prototype.setPosition=function(o){this.position_=o};flatbuffers.ByteBuffer.prototype.capacity=function(){return this.bytes_.length};flatbuffers.ByteBuffer.prototype.readInt8=function(o){return this.readUint8(o)<<24>>24};flatbuffers.ByteBuffer.prototype.readUint8=function(o){return this.bytes_[o]};flatbuffers.ByteBuffer.prototype.readInt16=function(o){return this.readUint16(o)<<16>>16};flatbuffers.ByteBuffer.prototype.readUint16=function(o){return this.bytes_[o]|this.bytes_[o+1]<<8};flatbuffers.ByteBuffer.prototype.readInt32=function(o){return this.bytes_[o]|this.bytes_[o+1]<<8|this.bytes_[o+2]<<16|this.bytes_[o+3]<<24};flatbuffers.ByteBuffer.prototype.readUint32=function(o){return this.readInt32(o)>>>0};flatbuffers.ByteBuffer.prototype.readInt64=function(o){return new flatbuffers.Long(this.readInt32(o),this.readInt32(o+4))};flatbuffers.ByteBuffer.prototype.readUint64=function(o){return new flatbuffers.Long(this.readUint32(o),this.readUint32(o+4))};flatbuffers.ByteBuffer.prototype.readFloat32=function(o){return flatbuffers.int32[0]=this.readInt32(o),flatbuffers.float32[0]};flatbuffers.ByteBuffer.prototype.readFloat64=function(o){return flatbuffers.int32[flatbuffers.isLittleEndian?0:1]=this.readInt32(o),flatbuffers.int32[flatbuffers.isLittleEndian?1:0]=this.readInt32(o+4),flatbuffers.float64[0]};flatbuffers.ByteBuffer.prototype.writeInt8=function(o,s){this.bytes_[o]=s};flatbuffers.ByteBuffer.prototype.writeUint8=function(o,s){this.bytes_[o]=s};flatbuffers.ByteBuffer.prototype.writeInt16=function(o,s){this.bytes_[o]=s,this.bytes_[o+1]=s>>8};flatbuffers.ByteBuffer.prototype.writeUint16=function(o,s){this.bytes_[o]=s,this.bytes_[o+1]=s>>8};flatbuffers.ByteBuffer.prototype.writeInt32=function(o,s){this.bytes_[o]=s,this.bytes_[o+1]=s>>8,this.bytes_[o+2]=s>>16,this.bytes_[o+3]=s>>24};flatbuffers.ByteBuffer.prototype.writeUint32=function(o,s){this.bytes_[o]=s,this.bytes_[o+1]=s>>8,this.bytes_[o+2]=s>>16,this.bytes_[o+3]=s>>24};flatbuffers.ByteBuffer.prototype.writeInt64=function(o,s){this.writeInt32(o,s.low),this.writeInt32(o+4,s.high)};flatbuffers.ByteBuffer.prototype.writeUint64=function(o,s){this.writeUint32(o,s.low),this.writeUint32(o+4,s.high)};flatbuffers.ByteBuffer.prototype.writeFloat32=function(o,s){flatbuffers.float32[0]=s,this.writeInt32(o,flatbuffers.int32[0])};flatbuffers.ByteBuffer.prototype.writeFloat64=function(o,s){flatbuffers.float64[0]=s,this.writeInt32(o,flatbuffers.int32[flatbuffers.isLittleEndian?0:1]),this.writeInt32(o+4,flatbuffers.int32[flatbuffers.isLittleEndian?1:0])};flatbuffers.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+flatbuffers.SIZEOF_INT+flatbuffers.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var o="",s=0;s<flatbuffers.FILE_IDENTIFIER_LENGTH;s++)o+=String.fromCharCode(this.readInt8(this.position_+flatbuffers.SIZEOF_INT+s));return o};flatbuffers.ByteBuffer.prototype.__offset=function(o,s){var _=o-this.readInt32(o);return s<this.readInt16(_)?this.readInt16(_+s):0};flatbuffers.ByteBuffer.prototype.__union=function(o,s){return o.bb_pos=s+this.readInt32(s),o.bb=this,o};flatbuffers.ByteBuffer.prototype.__string=function(o,s){o+=this.readInt32(o);var _=this.readInt32(o),_e="",et=0;if(o+=flatbuffers.SIZEOF_INT,s===flatbuffers.Encoding.UTF8_BYTES)return this.bytes_.subarray(o,o+_);for(;et<_;){var it,tt=this.readUint8(o+et++);if(tt<192)it=tt;else{var rt=this.readUint8(o+et++);if(tt<224)it=(tt&31)<<6|rt&63;else{var nt=this.readUint8(o+et++);if(tt<240)it=(tt&15)<<12|(rt&63)<<6|nt&63;else{var ot=this.readUint8(o+et++);it=(tt&7)<<18|(rt&63)<<12|(nt&63)<<6|ot&63}}}it<65536?_e+=String.fromCharCode(it):(it-=65536,_e+=String.fromCharCode((it>>10)+55296,(it&(1<<10)-1)+56320))}return _e};flatbuffers.ByteBuffer.prototype.__indirect=function(o){return o+this.readInt32(o)};flatbuffers.ByteBuffer.prototype.__vector=function(o){return o+this.readInt32(o)+flatbuffers.SIZEOF_INT};flatbuffers.ByteBuffer.prototype.__vector_len=function(o){return this.readInt32(o+this.readInt32(o))};flatbuffers.ByteBuffer.prototype.__has_identifier=function(o){if(o.length!=flatbuffers.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+flatbuffers.FILE_IDENTIFIER_LENGTH);for(var s=0;s<flatbuffers.FILE_IDENTIFIER_LENGTH;s++)if(o.charCodeAt(s)!=this.readInt8(this.position_+flatbuffers.SIZEOF_INT+s))return!1;return!0};flatbuffers.ByteBuffer.prototype.createLong=function(o,s){return flatbuffers.Long.create(o,s)};function inRange$2(o,s,_){return s<=o&&o<=_}function ToDictionary(o){if(o===void 0)return{};if(o===Object(o))return o;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(o){for(var s=String(o),_=s.length,_e=0,et=[];_e<_;){var it=s.charCodeAt(_e);if(it<55296||it>57343)et.push(it);else if(56320<=it&&it<=57343)et.push(65533);else if(55296<=it&&it<=56319)if(_e===_-1)et.push(65533);else{var tt=o.charCodeAt(_e+1);if(56320<=tt&&tt<=57343){var rt=it&1023,nt=tt&1023;et.push(65536+(rt<<10)+nt),_e+=1}else et.push(65533)}_e+=1}return et}function codePointsToString(o){for(var s="",_=0;_<o.length;++_){var _e=o[_];_e<=65535?s+=String.fromCharCode(_e):(_e-=65536,s+=String.fromCharCode((_e>>10)+55296,(_e&1023)+56320))}return s}var end_of_stream=-1;function Stream(o){this.tokens=[].slice.call(o)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(o){if(Array.isArray(o))for(var s=o;s.length;)this.tokens.unshift(s.pop());else this.tokens.unshift(o)},push:function(o){if(Array.isArray(o))for(var s=o;s.length;)this.tokens.push(s.shift());else this.tokens.push(o)}};var finished=-1;function decoderError(o,s){if(o)throw TypeError("Decoder error");return s||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(o,s){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(o,s);if(o=o!==void 0?String(o).toLowerCase():DEFAULT_ENCODING,o!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");s=ToDictionary(s),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(s.fatal),this._ignoreBOM=Boolean(s.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function(s,_){var _e;typeof s=="object"&&s instanceof ArrayBuffer?_e=new Uint8Array(s):typeof s=="object"&&"buffer"in s&&s.buffer instanceof ArrayBuffer?_e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength):_e=new Uint8Array(0),_=ToDictionary(_),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(_.stream);for(var et=new Stream(_e),it=[],tt;!et.endOfStream()&&(tt=this._decoder.handler(et,et.read()),tt!==finished);)tt!==null&&(Array.isArray(tt)?it.push.apply(it,tt):it.push(tt));if(!this._streaming){do{if(tt=this._decoder.handler(et,et.read()),tt===finished)break;tt!==null&&(Array.isArray(tt)?it.push.apply(it,tt):it.push(tt))}while(!et.endOfStream());this._decoder=null}return it.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(it[0]===65279?(this._BOMseen=!0,it.shift()):this._BOMseen=!0),codePointsToString(it)}};function TextEncoder$1(o,s){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(o,s);if(o=o!==void 0?String(o).toLowerCase():DEFAULT_ENCODING,o!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");s=ToDictionary(s),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(s.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function(s,_){s=s?String(s):"",_=ToDictionary(_),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=Boolean(_.stream);for(var _e=[],et=new Stream(stringToCodePoints(s)),it;!et.endOfStream()&&(it=this._encoder.handler(et,et.read()),it!==finished);)Array.isArray(it)?_e.push.apply(_e,it):_e.push(it);if(!this._streaming){for(;it=this._encoder.handler(et,et.read()),it!==finished;)Array.isArray(it)?_e.push.apply(_e,it):_e.push(it);this._encoder=null}return new Uint8Array(_e)}};function UTF8Decoder(o){var s=o.fatal,_=0,_e=0,et=0,it=128,tt=191;this.handler=function(rt,nt){if(nt===end_of_stream&&et!==0)return et=0,decoderError(s);if(nt===end_of_stream)return finished;if(et===0){if(inRange$2(nt,0,127))return nt;if(inRange$2(nt,194,223))et=1,_=nt-192;else if(inRange$2(nt,224,239))nt===224&&(it=160),nt===237&&(tt=159),et=2,_=nt-224;else if(inRange$2(nt,240,244))nt===240&&(it=144),nt===244&&(tt=143),et=3,_=nt-240;else return decoderError(s);return _=_<<6*et,null}if(!inRange$2(nt,it,tt))return _=et=_e=0,it=128,tt=191,rt.prepend(nt),decoderError(s);if(it=128,tt=191,_e+=1,_+=nt-128<<6*(et-_e),_e!==et)return null;var ot=_;return _=et=_e=0,ot}}function UTF8Encoder(o){o.fatal,this.handler=function(s,_){if(_===end_of_stream)return finished;if(inRange$2(_,0,127))return _;var _e,et;inRange$2(_,128,2047)?(_e=1,et=192):inRange$2(_,2048,65535)?(_e=2,et=224):inRange$2(_,65536,1114111)&&(_e=3,et=240);for(var it=[(_>>6*_e)+et];_e>0;){var tt=_>>6*(_e-1);it.push(128|tt&63),_e-=1}return it}}const _Buffer$1=typeof Buffer=="function"?Buffer:null,useNativeEncoders=typeof TextDecoder=="function"&&typeof TextEncoder=="function",decodeUtf8=(o=>{if(useNativeEncoders||!_Buffer$1){const s=new o("utf-8");return _=>s.decode(_)}return s=>{const{buffer:_,byteOffset:_e,length:et}=toUint8Array(s);return _Buffer$1.from(_,_e,et).toString()}})(typeof TextDecoder!="undefined"?TextDecoder:TextDecoder$1),encodeUtf8=(o=>{if(useNativeEncoders||!_Buffer$1){const s=new o;return _=>s.encode(_)}return(s="")=>toUint8Array(_Buffer$1.from(s,"utf8"))})(typeof TextEncoder!="undefined"?TextEncoder:TextEncoder$1),ITERATOR_DONE=Object.freeze({done:!0,value:void 0});class ArrowJSON{constructor(s){this._json=s}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class ReadableInterop{tee(){return this._getDOMStream().tee()}pipe(s,_){return this._getNodeStream().pipe(s,_)}pipeTo(s,_){return this._getDOMStream().pipeTo(s,_)}pipeThrough(s,_){return this._getDOMStream().pipeThrough(s,_)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class AsyncQueue extends ReadableInterop{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(s=>this._closedPromiseResolve=s)}get closed(){return this._closedPromise}async cancel(s){await this.return(s)}write(s){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(s):this.resolvers.shift().resolve({done:!1,value:s}))}abort(s){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:s}:this.resolvers.shift().reject({done:!0,value:s}))}close(){if(this._closedPromiseResolve){const{resolvers:s}=this;for(;s.length>0;)s.shift().resolve(ITERATOR_DONE);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(s){return streamAdapters.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,s)}toNodeStream(s){return streamAdapters.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,s)}async throw(s){return await this.abort(s),ITERATOR_DONE}async return(s){return await this.close(),ITERATOR_DONE}async read(s){return(await this.next(s,"read")).value}async peek(s){return(await this.next(s,"peek")).value}next(...s){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((_,_e)=>{this.resolvers.push({resolve:_,reject:_e})}):Promise.resolve(ITERATOR_DONE)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error(`${this} is closed`)}}const[BigIntCtor,BigIntAvailable]=(()=>{const o=()=>{throw new Error("BigInt is not available in this environment")};function s(){throw o()}return s.asIntN=()=>{throw o()},s.asUintN=()=>{throw o()},typeof BigInt!="undefined"?[BigInt,!0]:[s,!1]})(),[BigInt64ArrayCtor,BigInt64ArrayAvailable]=(()=>{const o=()=>{throw new Error("BigInt64Array is not available in this environment")};class s{static get BYTES_PER_ELEMENT(){return 8}static of(){throw o()}static from(){throw o()}constructor(){throw o()}}return typeof BigInt64Array!="undefined"?[BigInt64Array,!0]:[s,!1]})(),[BigUint64ArrayCtor,BigUint64ArrayAvailable]=(()=>{const o=()=>{throw new Error("BigUint64Array is not available in this environment")};class s{static get BYTES_PER_ELEMENT(){return 8}static of(){throw o()}static from(){throw o()}constructor(){throw o()}}return typeof BigUint64Array!="undefined"?[BigUint64Array,!0]:[s,!1]})(),isNumber$2=o=>typeof o=="number",isBoolean=o=>typeof o=="boolean",isFunction$2=o=>typeof o=="function",isObject$2=o=>o!=null&&Object(o)===o,isPromise=o=>isObject$2(o)&&isFunction$2(o.then),isIterable=o=>isObject$2(o)&&isFunction$2(o[Symbol.iterator]),isAsyncIterable=o=>isObject$2(o)&&isFunction$2(o[Symbol.asyncIterator]),isArrowJSON=o=>isObject$2(o)&&isObject$2(o.schema),isIteratorResult=o=>isObject$2(o)&&"done"in o&&"value"in o,isFileHandle=o=>isObject$2(o)&&isFunction$2(o.stat)&&isNumber$2(o.fd),isFetchResponse=o=>isObject$2(o)&&isReadableDOMStream(o.body),isWritableDOMStream=o=>isObject$2(o)&&isFunction$2(o.abort)&&isFunction$2(o.getWriter)&&!(o instanceof ReadableInterop),isReadableDOMStream=o=>isObject$2(o)&&isFunction$2(o.cancel)&&isFunction$2(o.getReader)&&!(o instanceof ReadableInterop),isWritableNodeStream=o=>isObject$2(o)&&isFunction$2(o.end)&&isFunction$2(o.write)&&isBoolean(o.writable)&&!(o instanceof ReadableInterop),isReadableNodeStream=o=>isObject$2(o)&&isFunction$2(o.read)&&isFunction$2(o.pipe)&&isBoolean(o.readable)&&!(o instanceof ReadableInterop);var ByteBuffer$3=flatbuffers.ByteBuffer;const SharedArrayBuf=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:ArrayBuffer;function collapseContiguousByteRanges(o){let s=o[0]?[o[0]]:[],_,_e,et,it;for(let tt,rt,nt=0,ot=0,st=o.length;++nt<st;){if(tt=s[ot],rt=o[nt],!tt||!rt||tt.buffer!==rt.buffer||rt.byteOffset<tt.byteOffset){rt&&(s[++ot]=rt);continue}if({byteOffset:_,byteLength:et}=tt,{byteOffset:_e,byteLength:it}=rt,_+et<_e||_e+it<_){rt&&(s[++ot]=rt);continue}s[ot]=new Uint8Array(tt.buffer,_,_e-_+it)}return s}function memcpy(o,s,_=0,_e=s.byteLength){const et=o.byteLength,it=new Uint8Array(o.buffer,o.byteOffset,et),tt=new Uint8Array(s.buffer,s.byteOffset,Math.min(_e,et));return it.set(tt,_),o}function joinUint8Arrays(o,s){let _=collapseContiguousByteRanges(o),_e=_.reduce((st,at)=>st+at.byteLength,0),et,it,tt,rt=0,nt=-1,ot=Math.min(s||1/0,_e);for(let st=_.length;++nt<st;){if(et=_[nt],it=et.subarray(0,Math.min(et.length,ot-rt)),ot<=rt+it.length){it.length<et.length?_[nt]=et.subarray(it.length):it.length===et.length&&nt++,tt?memcpy(tt,it,rt):tt=it;break}memcpy(tt||(tt=new Uint8Array(ot)),it,rt),rt+=it.length}return[tt||new Uint8Array(0),_.slice(nt),_e-(tt?tt.byteLength:0)]}function toArrayBufferView(o,s){let _=isIteratorResult(s)?s.value:s;return _ instanceof o?o===Uint8Array?new o(_.buffer,_.byteOffset,_.byteLength):_:_?(typeof _=="string"&&(_=encodeUtf8(_)),_ instanceof ArrayBuffer?new o(_):_ instanceof SharedArrayBuf?new o(_):_ instanceof ByteBuffer$3?toArrayBufferView(o,_.bytes()):ArrayBuffer.isView(_)?_.byteLength<=0?new o(0):new o(_.buffer,_.byteOffset,_.byteLength/o.BYTES_PER_ELEMENT):o.from(_)):new o(0)}const toInt8Array=o=>toArrayBufferView(Int8Array,o),toInt16Array=o=>toArrayBufferView(Int16Array,o),toInt32Array=o=>toArrayBufferView(Int32Array,o),toBigInt64Array=o=>toArrayBufferView(BigInt64ArrayCtor,o),toUint8Array=o=>toArrayBufferView(Uint8Array,o),toUint16Array=o=>toArrayBufferView(Uint16Array,o),toUint32Array=o=>toArrayBufferView(Uint32Array,o),toBigUint64Array=o=>toArrayBufferView(BigUint64ArrayCtor,o),toFloat32Array=o=>toArrayBufferView(Float32Array,o),toFloat64Array=o=>toArrayBufferView(Float64Array,o),toUint8ClampedArray=o=>toArrayBufferView(Uint8ClampedArray,o),pump$1=o=>(o.next(),o);function*toArrayBufferViewIterator(o,s){const _=function*(et){yield et},_e=typeof s=="string"||ArrayBuffer.isView(s)||s instanceof ArrayBuffer||s instanceof SharedArrayBuf?_(s):isIterable(s)?s:_(s);yield*pump$1(function*(et){let it=null;do it=et.next(yield toArrayBufferView(o,it));while(!it.done)}(_e[Symbol.iterator]()))}const toInt8ArrayIterator=o=>toArrayBufferViewIterator(Int8Array,o),toInt16ArrayIterator=o=>toArrayBufferViewIterator(Int16Array,o),toInt32ArrayIterator=o=>toArrayBufferViewIterator(Int32Array,o),toUint8ArrayIterator=o=>toArrayBufferViewIterator(Uint8Array,o),toUint16ArrayIterator=o=>toArrayBufferViewIterator(Uint16Array,o),toUint32ArrayIterator=o=>toArrayBufferViewIterator(Uint32Array,o),toFloat32ArrayIterator=o=>toArrayBufferViewIterator(Float32Array,o),toFloat64ArrayIterator=o=>toArrayBufferViewIterator(Float64Array,o),toUint8ClampedArrayIterator=o=>toArrayBufferViewIterator(Uint8ClampedArray,o);async function*toArrayBufferViewAsyncIterator(o,s){if(isPromise(s))return yield*toArrayBufferViewAsyncIterator(o,await s);const _=async function*(it){yield await it},_e=async function*(it){yield*pump$1(function*(tt){let rt=null;do rt=tt.next(yield rt&&rt.value);while(!rt.done)}(it[Symbol.iterator]()))},et=typeof s=="string"||ArrayBuffer.isView(s)||s instanceof ArrayBuffer||s instanceof SharedArrayBuf?_(s):isIterable(s)?_e(s):isAsyncIterable(s)?s:_(s);yield*pump$1(async function*(it){let tt=null;do tt=await it.next(yield toArrayBufferView(o,tt));while(!tt.done)}(et[Symbol.asyncIterator]()))}const toInt8ArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Int8Array,o),toInt16ArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Int16Array,o),toInt32ArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Int32Array,o),toUint8ArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Uint8Array,o),toUint16ArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Uint16Array,o),toUint32ArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Uint32Array,o),toFloat32ArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Float32Array,o),toFloat64ArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Float64Array,o),toUint8ClampedArrayAsyncIterator=o=>toArrayBufferViewAsyncIterator(Uint8ClampedArray,o);function rebaseValueOffsets(o,s,_){if(o!==0){_=_.slice(0,s+1);for(let _e=-1;++_e<=s;)_[_e]+=o}return _}function compareArrayLike(o,s){let _=0,_e=o.length;if(_e!==s.length)return!1;if(_e>0)do if(o[_]!==s[_])return!1;while(++_<_e);return!0}var util_buffer_=Object.freeze(Object.defineProperty({__proto__:null,memcpy,joinUint8Arrays,toArrayBufferView,toInt8Array,toInt16Array,toInt32Array,toBigInt64Array,toUint8Array,toUint16Array,toUint32Array,toBigUint64Array,toFloat32Array,toFloat64Array,toUint8ClampedArray,toArrayBufferViewIterator,toInt8ArrayIterator,toInt16ArrayIterator,toInt32ArrayIterator,toUint8ArrayIterator,toUint16ArrayIterator,toUint32ArrayIterator,toFloat32ArrayIterator,toFloat64ArrayIterator,toUint8ClampedArrayIterator,toArrayBufferViewAsyncIterator,toInt8ArrayAsyncIterator,toInt16ArrayAsyncIterator,toInt32ArrayAsyncIterator,toUint8ArrayAsyncIterator,toUint16ArrayAsyncIterator,toUint32ArrayAsyncIterator,toFloat32ArrayAsyncIterator,toFloat64ArrayAsyncIterator,toUint8ClampedArrayAsyncIterator,rebaseValueOffsets,compareArrayLike},Symbol.toStringTag,{value:"Module"})),streamAdapters={fromIterable(o){return pump(fromIterable(o))},fromAsyncIterable(o){return pump(fromAsyncIterable(o))},fromDOMStream(o){return pump(fromDOMStream(o))},fromNodeStream(o){return pump(fromNodeStream(o))},toDOMStream(o,s){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(o,s){throw new Error('"toNodeStream" not available in this environment')}};const pump=o=>(o.next(),o);function*fromIterable(o){let s,_=!1,_e=[],et,it,tt,rt=0;function nt(){return it==="peek"?joinUint8Arrays(_e,tt)[0]:([et,_e,rt]=joinUint8Arrays(_e,tt),et)}({cmd:it,size:tt}=yield null);let ot=toUint8ArrayIterator(o)[Symbol.iterator]();try{do if({done:s,value:et}=isNaN(tt-rt)?ot.next(void 0):ot.next(tt-rt),!s&&et.byteLength>0&&(_e.push(et),rt+=et.byteLength),s||tt<=rt)do({cmd:it,size:tt}=yield nt());while(tt<rt);while(!s)}catch(st){(_=!0)&&typeof ot.throw=="function"&&ot.throw(st)}finally{_===!1&&typeof ot.return=="function"&&ot.return()}}async function*fromAsyncIterable(o){let s,_=!1,_e=[],et,it,tt,rt=0;function nt(){return it==="peek"?joinUint8Arrays(_e,tt)[0]:([et,_e,rt]=joinUint8Arrays(_e,tt),et)}({cmd:it,size:tt}=yield null);let ot=toUint8ArrayAsyncIterator(o)[Symbol.asyncIterator]();try{do if({done:s,value:et}=isNaN(tt-rt)?await ot.next(void 0):await ot.next(tt-rt),!s&&et.byteLength>0&&(_e.push(et),rt+=et.byteLength),s||tt<=rt)do({cmd:it,size:tt}=yield nt());while(tt<rt);while(!s)}catch(st){(_=!0)&&typeof ot.throw=="function"&&await ot.throw(st)}finally{_===!1&&typeof ot.return=="function"&&await ot.return()}}async function*fromDOMStream(o){let s=!1,_=!1,_e=[],et,it,tt,rt=0;function nt(){return it==="peek"?joinUint8Arrays(_e,tt)[0]:([et,_e,rt]=joinUint8Arrays(_e,tt),et)}({cmd:it,size:tt}=yield null);let ot=new AdaptiveByteReader(o);try{do if({done:s,value:et}=isNaN(tt-rt)?await ot.read(void 0):await ot.read(tt-rt),!s&&et.byteLength>0&&(_e.push(toUint8Array(et)),rt+=et.byteLength),s||tt<=rt)do({cmd:it,size:tt}=yield nt());while(tt<rt);while(!s)}catch(st){(_=!0)&&await ot.cancel(st)}finally{_===!1?await ot.cancel():o.locked&&ot.releaseLock()}}class AdaptiveByteReader{constructor(s){this.source=s,this.byobReader=null,this.defaultReader=null;try{this.supportsBYOB=!!(this.reader=this.getBYOBReader())}catch{this.supportsBYOB=!(this.reader=this.getDefaultReader())}}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=this.byobReader=this.defaultReader=null}async cancel(s){const{reader:_,source:_e}=this;_&&await _.cancel(s).catch(()=>{}),_e&&_e.locked&&this.releaseLock()}async read(s){if(s===0)return{done:this.reader==null,value:new Uint8Array(0)};const _=!this.supportsBYOB||typeof s!="number"?await this.getDefaultReader().read():await this.readFromBYOBReader(s);return!_.done&&(_.value=toUint8Array(_)),_}getDefaultReader(){return this.byobReader&&this.releaseLock(),this.defaultReader||(this.defaultReader=this.source.getReader(),this.defaultReader.closed.catch(()=>{})),this.reader=this.defaultReader}getBYOBReader(){return this.defaultReader&&this.releaseLock(),this.byobReader||(this.byobReader=this.source.getReader({mode:"byob"}),this.byobReader.closed.catch(()=>{})),this.reader=this.byobReader}async readFromBYOBReader(s){return await readInto(this.getBYOBReader(),new ArrayBuffer(s),0,s)}}async function readInto(o,s,_,_e){if(_>=_e)return{done:!1,value:new Uint8Array(s,0,_e)};const{done:et,value:it}=await o.read(new Uint8Array(s,_,_e-_));return(_+=it.byteLength)<_e&&!et?await readInto(o,it.buffer,_,_e):{done:et,value:new Uint8Array(it.buffer,0,_)}}const onEvent=(o,s)=>{let _=et=>_e([s,et]),_e;return[s,_,new Promise(et=>(_e=et)&&o.once(s,_))]};async function*fromNodeStream(o){let s=[],_="error",_e=!1,et=null,it,tt,rt=0,nt=[],ot;function st(){return it==="peek"?joinUint8Arrays(nt,tt)[0]:([ot,nt,rt]=joinUint8Arrays(nt,tt),ot)}if({cmd:it,size:tt}=yield null,o.isTTY)return yield new Uint8Array(0);try{s[0]=onEvent(o,"end"),s[1]=onEvent(o,"error");do{if(s[2]=onEvent(o,"readable"),[_,et]=await Promise.race(s.map(lt=>lt[2])),_==="error")break;if((_e=_==="end")||(isFinite(tt-rt)?(ot=toUint8Array(o.read(tt-rt)),ot.byteLength<tt-rt&&(ot=toUint8Array(o.read(void 0)))):ot=toUint8Array(o.read(void 0)),ot.byteLength>0&&(nt.push(ot),rt+=ot.byteLength)),_e||tt<=rt)do({cmd:it,size:tt}=yield st());while(tt<rt)}while(!_e)}finally{await at(s,_==="error"?et:null)}function at(lt,ct){return ot=nt=null,new Promise(async(ht,mt)=>{for(const[dt,ft]of lt)o.off(dt,ft);try{const dt=o.destroy;dt&&dt.call(o,ct),ct=void 0}catch(dt){ct=dt||ct}finally{ct!=null?mt(ct):ht()}})}}class AbstractVector{}var org$2;(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.V1=0]="V1",et[et.V2=1]="V2",et[et.V3=2]="V3",et[et.V4=3]="V4"})(_e.MetadataVersion||(_e.MetadataVersion={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.Sparse=0]="Sparse",et[et.Dense=1]="Dense"})(_e.UnionMode||(_e.UnionMode={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.HALF=0]="HALF",et[et.SINGLE=1]="SINGLE",et[et.DOUBLE=2]="DOUBLE"})(_e.Precision||(_e.Precision={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.DAY=0]="DAY",et[et.MILLISECOND=1]="MILLISECOND"})(_e.DateUnit||(_e.DateUnit={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.SECOND=0]="SECOND",et[et.MILLISECOND=1]="MILLISECOND",et[et.MICROSECOND=2]="MICROSECOND",et[et.NANOSECOND=3]="NANOSECOND"})(_e.TimeUnit||(_e.TimeUnit={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.YEAR_MONTH=0]="YEAR_MONTH",et[et.DAY_TIME=1]="DAY_TIME"})(_e.IntervalUnit||(_e.IntervalUnit={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.NONE=0]="NONE",et[et.Null=1]="Null",et[et.Int=2]="Int",et[et.FloatingPoint=3]="FloatingPoint",et[et.Binary=4]="Binary",et[et.Utf8=5]="Utf8",et[et.Bool=6]="Bool",et[et.Decimal=7]="Decimal",et[et.Date=8]="Date",et[et.Time=9]="Time",et[et.Timestamp=10]="Timestamp",et[et.Interval=11]="Interval",et[et.List=12]="List",et[et.Struct_=13]="Struct_",et[et.Union=14]="Union",et[et.FixedSizeBinary=15]="FixedSizeBinary",et[et.FixedSizeList=16]="FixedSizeList",et[et.Map=17]="Map",et[et.Duration=18]="Duration",et[et.LargeBinary=19]="LargeBinary",et[et.LargeUtf8=20]="LargeUtf8",et[et.LargeList=21]="LargeList"})(_e.Type||(_e.Type={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.Little=0]="Little",et[et.Big=1]="Big"})(_e.Endianness||(_e.Endianness={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsNull(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startNull(tt){tt.startObject(0)}static endNull(tt){return tt.endObject()}static createNull(tt){return et.startNull(tt),et.endNull(tt)}}_e.Null=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsStruct_(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startStruct_(tt){tt.startObject(0)}static endStruct_(tt){return tt.endObject()}static createStruct_(tt){return et.startStruct_(tt),et.endStruct_(tt)}}_e.Struct_=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsList(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startList(tt){tt.startObject(0)}static endList(tt){return tt.endObject()}static createList(tt){return et.startList(tt),et.endList(tt)}}_e.List=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsLargeList(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startLargeList(tt){tt.startObject(0)}static endLargeList(tt){return tt.endObject()}static createLargeList(tt){return et.startLargeList(tt),et.endLargeList(tt)}}_e.LargeList=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsFixedSizeList(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}listSize(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt32(this.bb_pos+tt):0}static startFixedSizeList(tt){tt.startObject(1)}static addListSize(tt,rt){tt.addFieldInt32(0,rt,0)}static endFixedSizeList(tt){return tt.endObject()}static createFixedSizeList(tt,rt){return et.startFixedSizeList(tt),et.addListSize(tt,rt),et.endFixedSizeList(tt)}}_e.FixedSizeList=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsMap(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}keysSorted(){let tt=this.bb.__offset(this.bb_pos,4);return tt?!!this.bb.readInt8(this.bb_pos+tt):!1}static startMap(tt){tt.startObject(1)}static addKeysSorted(tt,rt){tt.addFieldInt8(0,+rt,0)}static endMap(tt){return tt.endObject()}static createMap(tt,rt){return et.startMap(tt),et.addKeysSorted(tt,rt),et.endMap(tt)}}_e.Map=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsUnion(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}mode(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):o.apache.arrow.flatbuf.UnionMode.Sparse}typeIds(tt){let rt=this.bb.__offset(this.bb_pos,6);return rt?this.bb.readInt32(this.bb.__vector(this.bb_pos+rt)+tt*4):0}typeIdsLength(){let tt=this.bb.__offset(this.bb_pos,6);return tt?this.bb.__vector_len(this.bb_pos+tt):0}typeIdsArray(){let tt=this.bb.__offset(this.bb_pos,6);return tt?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+tt),this.bb.__vector_len(this.bb_pos+tt)):null}static startUnion(tt){tt.startObject(2)}static addMode(tt,rt){tt.addFieldInt16(0,rt,o.apache.arrow.flatbuf.UnionMode.Sparse)}static addTypeIds(tt,rt){tt.addFieldOffset(1,rt,0)}static createTypeIdsVector(tt,rt){tt.startVector(4,rt.length,4);for(let nt=rt.length-1;nt>=0;nt--)tt.addInt32(rt[nt]);return tt.endVector()}static startTypeIdsVector(tt,rt){tt.startVector(4,rt,4)}static endUnion(tt){return tt.endObject()}static createUnion(tt,rt,nt){return et.startUnion(tt),et.addMode(tt,rt),et.addTypeIds(tt,nt),et.endUnion(tt)}}_e.Union=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsInt(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}bitWidth(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt32(this.bb_pos+tt):0}isSigned(){let tt=this.bb.__offset(this.bb_pos,6);return tt?!!this.bb.readInt8(this.bb_pos+tt):!1}static startInt(tt){tt.startObject(2)}static addBitWidth(tt,rt){tt.addFieldInt32(0,rt,0)}static addIsSigned(tt,rt){tt.addFieldInt8(1,+rt,0)}static endInt(tt){return tt.endObject()}static createInt(tt,rt,nt){return et.startInt(tt),et.addBitWidth(tt,rt),et.addIsSigned(tt,nt),et.endInt(tt)}}_e.Int=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsFloatingPoint(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}precision(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):o.apache.arrow.flatbuf.Precision.HALF}static startFloatingPoint(tt){tt.startObject(1)}static addPrecision(tt,rt){tt.addFieldInt16(0,rt,o.apache.arrow.flatbuf.Precision.HALF)}static endFloatingPoint(tt){return tt.endObject()}static createFloatingPoint(tt,rt){return et.startFloatingPoint(tt),et.addPrecision(tt,rt),et.endFloatingPoint(tt)}}_e.FloatingPoint=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsUtf8(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startUtf8(tt){tt.startObject(0)}static endUtf8(tt){return tt.endObject()}static createUtf8(tt){return et.startUtf8(tt),et.endUtf8(tt)}}_e.Utf8=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsBinary(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startBinary(tt){tt.startObject(0)}static endBinary(tt){return tt.endObject()}static createBinary(tt){return et.startBinary(tt),et.endBinary(tt)}}_e.Binary=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsLargeUtf8(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startLargeUtf8(tt){tt.startObject(0)}static endLargeUtf8(tt){return tt.endObject()}static createLargeUtf8(tt){return et.startLargeUtf8(tt),et.endLargeUtf8(tt)}}_e.LargeUtf8=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsLargeBinary(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startLargeBinary(tt){tt.startObject(0)}static endLargeBinary(tt){return tt.endObject()}static createLargeBinary(tt){return et.startLargeBinary(tt),et.endLargeBinary(tt)}}_e.LargeBinary=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsFixedSizeBinary(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}byteWidth(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt32(this.bb_pos+tt):0}static startFixedSizeBinary(tt){tt.startObject(1)}static addByteWidth(tt,rt){tt.addFieldInt32(0,rt,0)}static endFixedSizeBinary(tt){return tt.endObject()}static createFixedSizeBinary(tt,rt){return et.startFixedSizeBinary(tt),et.addByteWidth(tt,rt),et.endFixedSizeBinary(tt)}}_e.FixedSizeBinary=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsBool(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}static startBool(tt){tt.startObject(0)}static endBool(tt){return tt.endObject()}static createBool(tt){return et.startBool(tt),et.endBool(tt)}}_e.Bool=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsDecimal(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}precision(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt32(this.bb_pos+tt):0}scale(){let tt=this.bb.__offset(this.bb_pos,6);return tt?this.bb.readInt32(this.bb_pos+tt):0}static startDecimal(tt){tt.startObject(2)}static addPrecision(tt,rt){tt.addFieldInt32(0,rt,0)}static addScale(tt,rt){tt.addFieldInt32(1,rt,0)}static endDecimal(tt){return tt.endObject()}static createDecimal(tt,rt,nt){return et.startDecimal(tt),et.addPrecision(tt,rt),et.addScale(tt,nt),et.endDecimal(tt)}}_e.Decimal=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsDate(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}unit(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):o.apache.arrow.flatbuf.DateUnit.MILLISECOND}static startDate(tt){tt.startObject(1)}static addUnit(tt,rt){tt.addFieldInt16(0,rt,o.apache.arrow.flatbuf.DateUnit.MILLISECOND)}static endDate(tt){return tt.endObject()}static createDate(tt,rt){return et.startDate(tt),et.addUnit(tt,rt),et.endDate(tt)}}_e.Date=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsTime(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}unit(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):o.apache.arrow.flatbuf.TimeUnit.MILLISECOND}bitWidth(){let tt=this.bb.__offset(this.bb_pos,6);return tt?this.bb.readInt32(this.bb_pos+tt):32}static startTime(tt){tt.startObject(2)}static addUnit(tt,rt){tt.addFieldInt16(0,rt,o.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}static addBitWidth(tt,rt){tt.addFieldInt32(1,rt,32)}static endTime(tt){return tt.endObject()}static createTime(tt,rt,nt){return et.startTime(tt),et.addUnit(tt,rt),et.addBitWidth(tt,nt),et.endTime(tt)}}_e.Time=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsTimestamp(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}unit(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):o.apache.arrow.flatbuf.TimeUnit.SECOND}timezone(tt){let rt=this.bb.__offset(this.bb_pos,6);return rt?this.bb.__string(this.bb_pos+rt,tt):null}static startTimestamp(tt){tt.startObject(2)}static addUnit(tt,rt){tt.addFieldInt16(0,rt,o.apache.arrow.flatbuf.TimeUnit.SECOND)}static addTimezone(tt,rt){tt.addFieldOffset(1,rt,0)}static endTimestamp(tt){return tt.endObject()}static createTimestamp(tt,rt,nt){return et.startTimestamp(tt),et.addUnit(tt,rt),et.addTimezone(tt,nt),et.endTimestamp(tt)}}_e.Timestamp=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsInterval(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}unit(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):o.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH}static startInterval(tt){tt.startObject(1)}static addUnit(tt,rt){tt.addFieldInt16(0,rt,o.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH)}static endInterval(tt){return tt.endObject()}static createInterval(tt,rt){return et.startInterval(tt),et.addUnit(tt,rt),et.endInterval(tt)}}_e.Interval=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsDuration(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}unit(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):o.apache.arrow.flatbuf.TimeUnit.MILLISECOND}static startDuration(tt){tt.startObject(1)}static addUnit(tt,rt){tt.addFieldInt16(0,rt,o.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}static endDuration(tt){return tt.endObject()}static createDuration(tt,rt){return et.startDuration(tt),et.addUnit(tt,rt),et.endDuration(tt)}}_e.Duration=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsKeyValue(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}key(tt){let rt=this.bb.__offset(this.bb_pos,4);return rt?this.bb.__string(this.bb_pos+rt,tt):null}value(tt){let rt=this.bb.__offset(this.bb_pos,6);return rt?this.bb.__string(this.bb_pos+rt,tt):null}static startKeyValue(tt){tt.startObject(2)}static addKey(tt,rt){tt.addFieldOffset(0,rt,0)}static addValue(tt,rt){tt.addFieldOffset(1,rt,0)}static endKeyValue(tt){return tt.endObject()}static createKeyValue(tt,rt,nt){return et.startKeyValue(tt),et.addKey(tt,rt),et.addValue(tt,nt),et.endKeyValue(tt)}}_e.KeyValue=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsDictionaryEncoding(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}id(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt64(this.bb_pos+tt):this.bb.createLong(0,0)}indexType(tt){let rt=this.bb.__offset(this.bb_pos,6);return rt?(tt||new o.apache.arrow.flatbuf.Int).__init(this.bb.__indirect(this.bb_pos+rt),this.bb):null}isOrdered(){let tt=this.bb.__offset(this.bb_pos,8);return tt?!!this.bb.readInt8(this.bb_pos+tt):!1}static startDictionaryEncoding(tt){tt.startObject(3)}static addId(tt,rt){tt.addFieldInt64(0,rt,tt.createLong(0,0))}static addIndexType(tt,rt){tt.addFieldOffset(1,rt,0)}static addIsOrdered(tt,rt){tt.addFieldInt8(2,+rt,0)}static endDictionaryEncoding(tt){return tt.endObject()}static createDictionaryEncoding(tt,rt,nt,ot){return et.startDictionaryEncoding(tt),et.addId(tt,rt),et.addIndexType(tt,nt),et.addIsOrdered(tt,ot),et.endDictionaryEncoding(tt)}}_e.DictionaryEncoding=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsField(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}name(tt){let rt=this.bb.__offset(this.bb_pos,4);return rt?this.bb.__string(this.bb_pos+rt,tt):null}nullable(){let tt=this.bb.__offset(this.bb_pos,6);return tt?!!this.bb.readInt8(this.bb_pos+tt):!1}typeType(){let tt=this.bb.__offset(this.bb_pos,8);return tt?this.bb.readUint8(this.bb_pos+tt):o.apache.arrow.flatbuf.Type.NONE}type(tt){let rt=this.bb.__offset(this.bb_pos,10);return rt?this.bb.__union(tt,this.bb_pos+rt):null}dictionary(tt){let rt=this.bb.__offset(this.bb_pos,12);return rt?(tt||new o.apache.arrow.flatbuf.DictionaryEncoding).__init(this.bb.__indirect(this.bb_pos+rt),this.bb):null}children(tt,rt){let nt=this.bb.__offset(this.bb_pos,14);return nt?(rt||new o.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+nt)+tt*4),this.bb):null}childrenLength(){let tt=this.bb.__offset(this.bb_pos,14);return tt?this.bb.__vector_len(this.bb_pos+tt):0}customMetadata(tt,rt){let nt=this.bb.__offset(this.bb_pos,16);return nt?(rt||new o.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+nt)+tt*4),this.bb):null}customMetadataLength(){let tt=this.bb.__offset(this.bb_pos,16);return tt?this.bb.__vector_len(this.bb_pos+tt):0}static startField(tt){tt.startObject(7)}static addName(tt,rt){tt.addFieldOffset(0,rt,0)}static addNullable(tt,rt){tt.addFieldInt8(1,+rt,0)}static addTypeType(tt,rt){tt.addFieldInt8(2,rt,o.apache.arrow.flatbuf.Type.NONE)}static addType(tt,rt){tt.addFieldOffset(3,rt,0)}static addDictionary(tt,rt){tt.addFieldOffset(4,rt,0)}static addChildren(tt,rt){tt.addFieldOffset(5,rt,0)}static createChildrenVector(tt,rt){tt.startVector(4,rt.length,4);for(let nt=rt.length-1;nt>=0;nt--)tt.addOffset(rt[nt]);return tt.endVector()}static startChildrenVector(tt,rt){tt.startVector(4,rt,4)}static addCustomMetadata(tt,rt){tt.addFieldOffset(6,rt,0)}static createCustomMetadataVector(tt,rt){tt.startVector(4,rt.length,4);for(let nt=rt.length-1;nt>=0;nt--)tt.addOffset(rt[nt]);return tt.endVector()}static startCustomMetadataVector(tt,rt){tt.startVector(4,rt,4)}static endField(tt){return tt.endObject()}static createField(tt,rt,nt,ot,st,at,lt,ct){return et.startField(tt),et.addName(tt,rt),et.addNullable(tt,nt),et.addTypeType(tt,ot),et.addType(tt,st),et.addDictionary(tt,at),et.addChildren(tt,lt),et.addCustomMetadata(tt,ct),et.endField(tt)}}_e.Field=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static createBuffer(tt,rt,nt){return tt.prep(8,16),tt.writeInt64(nt),tt.writeInt64(rt),tt.offset()}}_e.Buffer=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsSchema(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}endianness(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):o.apache.arrow.flatbuf.Endianness.Little}fields(tt,rt){let nt=this.bb.__offset(this.bb_pos,6);return nt?(rt||new o.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+nt)+tt*4),this.bb):null}fieldsLength(){let tt=this.bb.__offset(this.bb_pos,6);return tt?this.bb.__vector_len(this.bb_pos+tt):0}customMetadata(tt,rt){let nt=this.bb.__offset(this.bb_pos,8);return nt?(rt||new o.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+nt)+tt*4),this.bb):null}customMetadataLength(){let tt=this.bb.__offset(this.bb_pos,8);return tt?this.bb.__vector_len(this.bb_pos+tt):0}static startSchema(tt){tt.startObject(3)}static addEndianness(tt,rt){tt.addFieldInt16(0,rt,o.apache.arrow.flatbuf.Endianness.Little)}static addFields(tt,rt){tt.addFieldOffset(1,rt,0)}static createFieldsVector(tt,rt){tt.startVector(4,rt.length,4);for(let nt=rt.length-1;nt>=0;nt--)tt.addOffset(rt[nt]);return tt.endVector()}static startFieldsVector(tt,rt){tt.startVector(4,rt,4)}static addCustomMetadata(tt,rt){tt.addFieldOffset(2,rt,0)}static createCustomMetadataVector(tt,rt){tt.startVector(4,rt.length,4);for(let nt=rt.length-1;nt>=0;nt--)tt.addOffset(rt[nt]);return tt.endVector()}static startCustomMetadataVector(tt,rt){tt.startVector(4,rt,4)}static endSchema(tt){return tt.endObject()}static finishSchemaBuffer(tt,rt){tt.finish(rt)}static createSchema(tt,rt,nt,ot){return et.startSchema(tt),et.addEndianness(tt,rt),et.addFields(tt,nt),et.addCustomMetadata(tt,ot),et.endSchema(tt)}}_e.Schema=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$2||(org$2={}));var org$1;(function(o){(function(s){(function(_){(function(_e){_e.Schema=org$2.apache.arrow.flatbuf.Schema})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$1||(org$1={}));(function(o){(function(s){(function(_){(function(_e){(function(et){et[et.NONE=0]="NONE",et[et.Schema=1]="Schema",et[et.DictionaryBatch=2]="DictionaryBatch",et[et.RecordBatch=3]="RecordBatch",et[et.Tensor=4]="Tensor",et[et.SparseTensor=5]="SparseTensor"})(_e.MessageHeader||(_e.MessageHeader={}))})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$1||(org$1={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static createFieldNode(tt,rt,nt){return tt.prep(8,16),tt.writeInt64(nt),tt.writeInt64(rt),tt.offset()}}_e.FieldNode=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$1||(org$1={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsRecordBatch(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}length(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt64(this.bb_pos+tt):this.bb.createLong(0,0)}nodes(tt,rt){let nt=this.bb.__offset(this.bb_pos,6);return nt?(rt||new o.apache.arrow.flatbuf.FieldNode).__init(this.bb.__vector(this.bb_pos+nt)+tt*16,this.bb):null}nodesLength(){let tt=this.bb.__offset(this.bb_pos,6);return tt?this.bb.__vector_len(this.bb_pos+tt):0}buffers(tt,rt){let nt=this.bb.__offset(this.bb_pos,8);return nt?(rt||new org$2.apache.arrow.flatbuf.Buffer).__init(this.bb.__vector(this.bb_pos+nt)+tt*16,this.bb):null}buffersLength(){let tt=this.bb.__offset(this.bb_pos,8);return tt?this.bb.__vector_len(this.bb_pos+tt):0}static startRecordBatch(tt){tt.startObject(3)}static addLength(tt,rt){tt.addFieldInt64(0,rt,tt.createLong(0,0))}static addNodes(tt,rt){tt.addFieldOffset(1,rt,0)}static startNodesVector(tt,rt){tt.startVector(16,rt,8)}static addBuffers(tt,rt){tt.addFieldOffset(2,rt,0)}static startBuffersVector(tt,rt){tt.startVector(16,rt,8)}static endRecordBatch(tt){return tt.endObject()}static createRecordBatch(tt,rt,nt,ot){return et.startRecordBatch(tt),et.addLength(tt,rt),et.addNodes(tt,nt),et.addBuffers(tt,ot),et.endRecordBatch(tt)}}_e.RecordBatch=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$1||(org$1={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsDictionaryBatch(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}id(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt64(this.bb_pos+tt):this.bb.createLong(0,0)}data(tt){let rt=this.bb.__offset(this.bb_pos,6);return rt?(tt||new o.apache.arrow.flatbuf.RecordBatch).__init(this.bb.__indirect(this.bb_pos+rt),this.bb):null}isDelta(){let tt=this.bb.__offset(this.bb_pos,8);return tt?!!this.bb.readInt8(this.bb_pos+tt):!1}static startDictionaryBatch(tt){tt.startObject(3)}static addId(tt,rt){tt.addFieldInt64(0,rt,tt.createLong(0,0))}static addData(tt,rt){tt.addFieldOffset(1,rt,0)}static addIsDelta(tt,rt){tt.addFieldInt8(2,+rt,0)}static endDictionaryBatch(tt){return tt.endObject()}static createDictionaryBatch(tt,rt,nt,ot){return et.startDictionaryBatch(tt),et.addId(tt,rt),et.addData(tt,nt),et.addIsDelta(tt,ot),et.endDictionaryBatch(tt)}}_e.DictionaryBatch=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$1||(org$1={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsMessage(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}version(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):org$2.apache.arrow.flatbuf.MetadataVersion.V1}headerType(){let tt=this.bb.__offset(this.bb_pos,6);return tt?this.bb.readUint8(this.bb_pos+tt):o.apache.arrow.flatbuf.MessageHeader.NONE}header(tt){let rt=this.bb.__offset(this.bb_pos,8);return rt?this.bb.__union(tt,this.bb_pos+rt):null}bodyLength(){let tt=this.bb.__offset(this.bb_pos,10);return tt?this.bb.readInt64(this.bb_pos+tt):this.bb.createLong(0,0)}customMetadata(tt,rt){let nt=this.bb.__offset(this.bb_pos,12);return nt?(rt||new org$2.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+nt)+tt*4),this.bb):null}customMetadataLength(){let tt=this.bb.__offset(this.bb_pos,12);return tt?this.bb.__vector_len(this.bb_pos+tt):0}static startMessage(tt){tt.startObject(5)}static addVersion(tt,rt){tt.addFieldInt16(0,rt,org$2.apache.arrow.flatbuf.MetadataVersion.V1)}static addHeaderType(tt,rt){tt.addFieldInt8(1,rt,o.apache.arrow.flatbuf.MessageHeader.NONE)}static addHeader(tt,rt){tt.addFieldOffset(2,rt,0)}static addBodyLength(tt,rt){tt.addFieldInt64(3,rt,tt.createLong(0,0))}static addCustomMetadata(tt,rt){tt.addFieldOffset(4,rt,0)}static createCustomMetadataVector(tt,rt){tt.startVector(4,rt.length,4);for(let nt=rt.length-1;nt>=0;nt--)tt.addOffset(rt[nt]);return tt.endVector()}static startCustomMetadataVector(tt,rt){tt.startVector(4,rt,4)}static endMessage(tt){return tt.endObject()}static finishMessageBuffer(tt,rt){tt.finish(rt)}static createMessage(tt,rt,nt,ot,st,at){return et.startMessage(tt),et.addVersion(tt,rt),et.addHeaderType(tt,nt),et.addHeader(tt,ot),et.addBodyLength(tt,st),et.addCustomMetadata(tt,at),et.endMessage(tt)}}_e.Message=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org$1||(org$1={}));org$2.apache.arrow.flatbuf.Type;var DateUnit=org$2.apache.arrow.flatbuf.DateUnit,TimeUnit=org$2.apache.arrow.flatbuf.TimeUnit,Precision=org$2.apache.arrow.flatbuf.Precision,UnionMode=org$2.apache.arrow.flatbuf.UnionMode,IntervalUnit=org$2.apache.arrow.flatbuf.IntervalUnit,MessageHeader=org$1.apache.arrow.flatbuf.MessageHeader,MetadataVersion=org$2.apache.arrow.flatbuf.MetadataVersion,Type$1;(function(o){o[o.NONE=0]="NONE",o[o.Null=1]="Null",o[o.Int=2]="Int",o[o.Float=3]="Float",o[o.Binary=4]="Binary",o[o.Utf8=5]="Utf8",o[o.Bool=6]="Bool",o[o.Decimal=7]="Decimal",o[o.Date=8]="Date",o[o.Time=9]="Time",o[o.Timestamp=10]="Timestamp",o[o.Interval=11]="Interval",o[o.List=12]="List",o[o.Struct=13]="Struct",o[o.Union=14]="Union",o[o.FixedSizeBinary=15]="FixedSizeBinary",o[o.FixedSizeList=16]="FixedSizeList",o[o.Map=17]="Map",o[o.Dictionary=-1]="Dictionary",o[o.Int8=-2]="Int8",o[o.Int16=-3]="Int16",o[o.Int32=-4]="Int32",o[o.Int64=-5]="Int64",o[o.Uint8=-6]="Uint8",o[o.Uint16=-7]="Uint16",o[o.Uint32=-8]="Uint32",o[o.Uint64=-9]="Uint64",o[o.Float16=-10]="Float16",o[o.Float32=-11]="Float32",o[o.Float64=-12]="Float64",o[o.DateDay=-13]="DateDay",o[o.DateMillisecond=-14]="DateMillisecond",o[o.TimestampSecond=-15]="TimestampSecond",o[o.TimestampMillisecond=-16]="TimestampMillisecond",o[o.TimestampMicrosecond=-17]="TimestampMicrosecond",o[o.TimestampNanosecond=-18]="TimestampNanosecond",o[o.TimeSecond=-19]="TimeSecond",o[o.TimeMillisecond=-20]="TimeMillisecond",o[o.TimeMicrosecond=-21]="TimeMicrosecond",o[o.TimeNanosecond=-22]="TimeNanosecond",o[o.DenseUnion=-23]="DenseUnion",o[o.SparseUnion=-24]="SparseUnion",o[o.IntervalDayTime=-25]="IntervalDayTime",o[o.IntervalYearMonth=-26]="IntervalYearMonth"})(Type$1||(Type$1={}));var BufferType;(function(o){o[o.OFFSET=0]="OFFSET",o[o.DATA=1]="DATA",o[o.VALIDITY=2]="VALIDITY",o[o.TYPE=3]="TYPE"})(BufferType||(BufferType={}));function getBool$1(o,s,_,_e){return(_&1<<_e)!==0}function getBit(o,s,_,_e){return(_&1<<_e)>>_e}function setBool$1(o,s,_){return _?!!(o[s>>3]|=1<<s%8)||!0:!(o[s>>3]&=~(1<<s%8))&&!1}function truncateBitmap(o,s,_){const _e=_.byteLength+7&-8;if(o>0||_.byteLength<_e){const et=new Uint8Array(_e);return et.set(o%8===0?_.subarray(o>>3):packBools(iterateBits(_,o,s,null,getBool$1)).subarray(0,_e)),et}return _}function packBools(o){let s=[],_=0,_e=0,et=0;for(const tt of o)tt&&(et|=1<<_e),++_e===8&&(s[_++]=et,et=_e=0);(_===0||_e>0)&&(s[_++]=et);let it=new Uint8Array(s.length+7&-8);return it.set(s),it}function*iterateBits(o,s,_,_e,et){let it=s%8,tt=s>>3,rt=0,nt=_;for(;nt>0;it=0){let ot=o[tt++];do yield et(_e,rt++,ot,it);while(--nt>0&&++it<8)}}function popcnt_bit_range(o,s,_){if(_-s<=0)return 0;if(_-s<8){let it=0;for(const tt of iterateBits(o,s,_-s,o,getBit))it+=tt;return it}const _e=_>>3<<3,et=s+(s%8===0?0:8-s%8);return popcnt_bit_range(o,s,et)+popcnt_bit_range(o,_e,_)+popcnt_array(o,et>>3,_e-et>>3)}function popcnt_array(o,s,_){let _e=0,et=s|0;const it=new DataView(o.buffer,o.byteOffset,o.byteLength),tt=_===void 0?o.byteLength:et+_;for(;tt-et>=4;)_e+=popcnt_uint32(it.getUint32(et)),et+=4;for(;tt-et>=2;)_e+=popcnt_uint32(it.getUint16(et)),et+=2;for(;tt-et>=1;)_e+=popcnt_uint32(it.getUint8(et)),et+=1;return _e}function popcnt_uint32(o){let s=o|0;return s=s-(s>>>1&1431655765),s=(s&858993459)+(s>>>2&858993459),(s+(s>>>4)&252645135)*16843009>>>24}var util_bit_=Object.freeze(Object.defineProperty({__proto__:null,getBool:getBool$1,getBit,setBool:setBool$1,truncateBitmap,packBools,iterateBits,popcnt_bit_range,popcnt_array,popcnt_uint32},Symbol.toStringTag,{value:"Module"}));class Visitor{visitMany(s,..._){return s.map((_e,et)=>this.visit(_e,..._.map(it=>it[et])))}visit(...s){return this.getVisitFn(s[0],!1).apply(this,s)}getVisitFn(s,_=!0){return getVisitFn(this,s,_)}visitNull(s,..._){return null}visitBool(s,..._){return null}visitInt(s,..._){return null}visitFloat(s,..._){return null}visitUtf8(s,..._){return null}visitBinary(s,..._){return null}visitFixedSizeBinary(s,..._){return null}visitDate(s,..._){return null}visitTimestamp(s,..._){return null}visitTime(s,..._){return null}visitDecimal(s,..._){return null}visitList(s,..._){return null}visitStruct(s,..._){return null}visitUnion(s,..._){return null}visitDictionary(s,..._){return null}visitInterval(s,..._){return null}visitFixedSizeList(s,..._){return null}visitMap(s,..._){return null}}function getVisitFn(o,s,_=!0){let _e=null,et=Type$1.NONE;switch(s instanceof Data||s instanceof AbstractVector?et=inferDType(s.type):s instanceof DataType?et=inferDType(s):typeof(et=s)!="number"&&(et=Type$1[s]),et){case Type$1.Null:_e=o.visitNull;break;case Type$1.Bool:_e=o.visitBool;break;case Type$1.Int:_e=o.visitInt;break;case Type$1.Int8:_e=o.visitInt8||o.visitInt;break;case Type$1.Int16:_e=o.visitInt16||o.visitInt;break;case Type$1.Int32:_e=o.visitInt32||o.visitInt;break;case Type$1.Int64:_e=o.visitInt64||o.visitInt;break;case Type$1.Uint8:_e=o.visitUint8||o.visitInt;break;case Type$1.Uint16:_e=o.visitUint16||o.visitInt;break;case Type$1.Uint32:_e=o.visitUint32||o.visitInt;break;case Type$1.Uint64:_e=o.visitUint64||o.visitInt;break;case Type$1.Float:_e=o.visitFloat;break;case Type$1.Float16:_e=o.visitFloat16||o.visitFloat;break;case Type$1.Float32:_e=o.visitFloat32||o.visitFloat;break;case Type$1.Float64:_e=o.visitFloat64||o.visitFloat;break;case Type$1.Utf8:_e=o.visitUtf8;break;case Type$1.Binary:_e=o.visitBinary;break;case Type$1.FixedSizeBinary:_e=o.visitFixedSizeBinary;break;case Type$1.Date:_e=o.visitDate;break;case Type$1.DateDay:_e=o.visitDateDay||o.visitDate;break;case Type$1.DateMillisecond:_e=o.visitDateMillisecond||o.visitDate;break;case Type$1.Timestamp:_e=o.visitTimestamp;break;case Type$1.TimestampSecond:_e=o.visitTimestampSecond||o.visitTimestamp;break;case Type$1.TimestampMillisecond:_e=o.visitTimestampMillisecond||o.visitTimestamp;break;case Type$1.TimestampMicrosecond:_e=o.visitTimestampMicrosecond||o.visitTimestamp;break;case Type$1.TimestampNanosecond:_e=o.visitTimestampNanosecond||o.visitTimestamp;break;case Type$1.Time:_e=o.visitTime;break;case Type$1.TimeSecond:_e=o.visitTimeSecond||o.visitTime;break;case Type$1.TimeMillisecond:_e=o.visitTimeMillisecond||o.visitTime;break;case Type$1.TimeMicrosecond:_e=o.visitTimeMicrosecond||o.visitTime;break;case Type$1.TimeNanosecond:_e=o.visitTimeNanosecond||o.visitTime;break;case Type$1.Decimal:_e=o.visitDecimal;break;case Type$1.List:_e=o.visitList;break;case Type$1.Struct:_e=o.visitStruct;break;case Type$1.Union:_e=o.visitUnion;break;case Type$1.DenseUnion:_e=o.visitDenseUnion||o.visitUnion;break;case Type$1.SparseUnion:_e=o.visitSparseUnion||o.visitUnion;break;case Type$1.Dictionary:_e=o.visitDictionary;break;case Type$1.Interval:_e=o.visitInterval;break;case Type$1.IntervalDayTime:_e=o.visitIntervalDayTime||o.visitInterval;break;case Type$1.IntervalYearMonth:_e=o.visitIntervalYearMonth||o.visitInterval;break;case Type$1.FixedSizeList:_e=o.visitFixedSizeList;break;case Type$1.Map:_e=o.visitMap;break}if(typeof _e=="function")return _e;if(!_)return()=>null;throw new Error(`Unrecognized type '${Type$1[et]}'`)}function inferDType(o){switch(o.typeId){case Type$1.Null:return Type$1.Null;case Type$1.Int:const{bitWidth:s,isSigned:_}=o;switch(s){case 8:return _?Type$1.Int8:Type$1.Uint8;case 16:return _?Type$1.Int16:Type$1.Uint16;case 32:return _?Type$1.Int32:Type$1.Uint32;case 64:return _?Type$1.Int64:Type$1.Uint64}return Type$1.Int;case Type$1.Float:switch(o.precision){case Precision.HALF:return Type$1.Float16;case Precision.SINGLE:return Type$1.Float32;case Precision.DOUBLE:return Type$1.Float64}return Type$1.Float;case Type$1.Binary:return Type$1.Binary;case Type$1.Utf8:return Type$1.Utf8;case Type$1.Bool:return Type$1.Bool;case Type$1.Decimal:return Type$1.Decimal;case Type$1.Time:switch(o.unit){case TimeUnit.SECOND:return Type$1.TimeSecond;case TimeUnit.MILLISECOND:return Type$1.TimeMillisecond;case TimeUnit.MICROSECOND:return Type$1.TimeMicrosecond;case TimeUnit.NANOSECOND:return Type$1.TimeNanosecond}return Type$1.Time;case Type$1.Timestamp:switch(o.unit){case TimeUnit.SECOND:return Type$1.TimestampSecond;case TimeUnit.MILLISECOND:return Type$1.TimestampMillisecond;case TimeUnit.MICROSECOND:return Type$1.TimestampMicrosecond;case TimeUnit.NANOSECOND:return Type$1.TimestampNanosecond}return Type$1.Timestamp;case Type$1.Date:switch(o.unit){case DateUnit.DAY:return Type$1.DateDay;case DateUnit.MILLISECOND:return Type$1.DateMillisecond}return Type$1.Date;case Type$1.Interval:switch(o.unit){case IntervalUnit.DAY_TIME:return Type$1.IntervalDayTime;case IntervalUnit.YEAR_MONTH:return Type$1.IntervalYearMonth}return Type$1.Interval;case Type$1.Map:return Type$1.Map;case Type$1.List:return Type$1.List;case Type$1.Struct:return Type$1.Struct;case Type$1.Union:switch(o.mode){case UnionMode.Dense:return Type$1.DenseUnion;case UnionMode.Sparse:return Type$1.SparseUnion}return Type$1.Union;case Type$1.FixedSizeBinary:return Type$1.FixedSizeBinary;case Type$1.FixedSizeList:return Type$1.FixedSizeList;case Type$1.Dictionary:return Type$1.Dictionary}throw new Error(`Unrecognized type '${Type$1[o.typeId]}'`)}Visitor.prototype.visitInt8=null;Visitor.prototype.visitInt16=null;Visitor.prototype.visitInt32=null;Visitor.prototype.visitInt64=null;Visitor.prototype.visitUint8=null;Visitor.prototype.visitUint16=null;Visitor.prototype.visitUint32=null;Visitor.prototype.visitUint64=null;Visitor.prototype.visitFloat16=null;Visitor.prototype.visitFloat32=null;Visitor.prototype.visitFloat64=null;Visitor.prototype.visitDateDay=null;Visitor.prototype.visitDateMillisecond=null;Visitor.prototype.visitTimestampSecond=null;Visitor.prototype.visitTimestampMillisecond=null;Visitor.prototype.visitTimestampMicrosecond=null;Visitor.prototype.visitTimestampNanosecond=null;Visitor.prototype.visitTimeSecond=null;Visitor.prototype.visitTimeMillisecond=null;Visitor.prototype.visitTimeMicrosecond=null;Visitor.prototype.visitTimeNanosecond=null;Visitor.prototype.visitDenseUnion=null;Visitor.prototype.visitSparseUnion=null;Visitor.prototype.visitIntervalDayTime=null;Visitor.prototype.visitIntervalYearMonth=null;class TypeComparator extends Visitor{compareSchemas(s,_){return s===_||_ instanceof s.constructor&&instance$9.compareFields(s.fields,_.fields)}compareFields(s,_){return s===_||Array.isArray(s)&&Array.isArray(_)&&s.length===_.length&&s.every((_e,et)=>instance$9.compareField(_e,_[et]))}compareField(s,_){return s===_||_ instanceof s.constructor&&s.name===_.name&&s.nullable===_.nullable&&instance$9.visit(s.type,_.type)}}function compareConstructor(o,s){return s instanceof o.constructor}function compareAny(o,s){return o===s||compareConstructor(o,s)}function compareInt(o,s){return o===s||compareConstructor(o,s)&&o.bitWidth===s.bitWidth&&o.isSigned===s.isSigned}function compareFloat(o,s){return o===s||compareConstructor(o,s)&&o.precision===s.precision}function compareFixedSizeBinary(o,s){return o===s||compareConstructor(o,s)&&o.byteWidth===s.byteWidth}function compareDate(o,s){return o===s||compareConstructor(o,s)&&o.unit===s.unit}function compareTimestamp(o,s){return o===s||compareConstructor(o,s)&&o.unit===s.unit&&o.timezone===s.timezone}function compareTime(o,s){return o===s||compareConstructor(o,s)&&o.unit===s.unit&&o.bitWidth===s.bitWidth}function compareList(o,s){return o===s||compareConstructor(o,s)&&o.children.length===s.children.length&&instance$9.compareFields(o.children,s.children)}function compareStruct(o,s){return o===s||compareConstructor(o,s)&&o.children.length===s.children.length&&instance$9.compareFields(o.children,s.children)}function compareUnion(o,s){return o===s||compareConstructor(o,s)&&o.mode===s.mode&&o.typeIds.every((_,_e)=>_===s.typeIds[_e])&&instance$9.compareFields(o.children,s.children)}function compareDictionary(o,s){return o===s||compareConstructor(o,s)&&o.id===s.id&&o.isOrdered===s.isOrdered&&instance$9.visit(o.indices,s.indices)&&instance$9.visit(o.dictionary,s.dictionary)}function compareInterval(o,s){return o===s||compareConstructor(o,s)&&o.unit===s.unit}function compareFixedSizeList(o,s){return o===s||compareConstructor(o,s)&&o.listSize===s.listSize&&o.children.length===s.children.length&&instance$9.compareFields(o.children,s.children)}function compareMap(o,s){return o===s||compareConstructor(o,s)&&o.keysSorted===s.keysSorted&&o.children.length===s.children.length&&instance$9.compareFields(o.children,s.children)}TypeComparator.prototype.visitNull=compareAny;TypeComparator.prototype.visitBool=compareAny;TypeComparator.prototype.visitInt=compareInt;TypeComparator.prototype.visitInt8=compareInt;TypeComparator.prototype.visitInt16=compareInt;TypeComparator.prototype.visitInt32=compareInt;TypeComparator.prototype.visitInt64=compareInt;TypeComparator.prototype.visitUint8=compareInt;TypeComparator.prototype.visitUint16=compareInt;TypeComparator.prototype.visitUint32=compareInt;TypeComparator.prototype.visitUint64=compareInt;TypeComparator.prototype.visitFloat=compareFloat;TypeComparator.prototype.visitFloat16=compareFloat;TypeComparator.prototype.visitFloat32=compareFloat;TypeComparator.prototype.visitFloat64=compareFloat;TypeComparator.prototype.visitUtf8=compareAny;TypeComparator.prototype.visitBinary=compareAny;TypeComparator.prototype.visitFixedSizeBinary=compareFixedSizeBinary;TypeComparator.prototype.visitDate=compareDate;TypeComparator.prototype.visitDateDay=compareDate;TypeComparator.prototype.visitDateMillisecond=compareDate;TypeComparator.prototype.visitTimestamp=compareTimestamp;TypeComparator.prototype.visitTimestampSecond=compareTimestamp;TypeComparator.prototype.visitTimestampMillisecond=compareTimestamp;TypeComparator.prototype.visitTimestampMicrosecond=compareTimestamp;TypeComparator.prototype.visitTimestampNanosecond=compareTimestamp;TypeComparator.prototype.visitTime=compareTime;TypeComparator.prototype.visitTimeSecond=compareTime;TypeComparator.prototype.visitTimeMillisecond=compareTime;TypeComparator.prototype.visitTimeMicrosecond=compareTime;TypeComparator.prototype.visitTimeNanosecond=compareTime;TypeComparator.prototype.visitDecimal=compareAny;TypeComparator.prototype.visitList=compareList;TypeComparator.prototype.visitStruct=compareStruct;TypeComparator.prototype.visitUnion=compareUnion;TypeComparator.prototype.visitDenseUnion=compareUnion;TypeComparator.prototype.visitSparseUnion=compareUnion;TypeComparator.prototype.visitDictionary=compareDictionary;TypeComparator.prototype.visitInterval=compareInterval;TypeComparator.prototype.visitIntervalDayTime=compareInterval;TypeComparator.prototype.visitIntervalYearMonth=compareInterval;TypeComparator.prototype.visitFixedSizeList=compareFixedSizeList;TypeComparator.prototype.visitMap=compareMap;const instance$9=new TypeComparator;class DataType{static isNull(s){return s&&s.typeId===Type$1.Null}static isInt(s){return s&&s.typeId===Type$1.Int}static isFloat(s){return s&&s.typeId===Type$1.Float}static isBinary(s){return s&&s.typeId===Type$1.Binary}static isUtf8(s){return s&&s.typeId===Type$1.Utf8}static isBool(s){return s&&s.typeId===Type$1.Bool}static isDecimal(s){return s&&s.typeId===Type$1.Decimal}static isDate(s){return s&&s.typeId===Type$1.Date}static isTime(s){return s&&s.typeId===Type$1.Time}static isTimestamp(s){return s&&s.typeId===Type$1.Timestamp}static isInterval(s){return s&&s.typeId===Type$1.Interval}static isList(s){return s&&s.typeId===Type$1.List}static isStruct(s){return s&&s.typeId===Type$1.Struct}static isUnion(s){return s&&s.typeId===Type$1.Union}static isFixedSizeBinary(s){return s&&s.typeId===Type$1.FixedSizeBinary}static isFixedSizeList(s){return s&&s.typeId===Type$1.FixedSizeList}static isMap(s){return s&&s.typeId===Type$1.Map}static isDictionary(s){return s&&s.typeId===Type$1.Dictionary}get typeId(){return Type$1.NONE}compareTo(s){return instance$9.visit(this,s)}}DataType[Symbol.toStringTag]=(o=>(o.children=null,o.ArrayType=Array,o[Symbol.toStringTag]="DataType"))(DataType.prototype);class Null$1 extends DataType{toString(){return"Null"}get typeId(){return Type$1.Null}}Null$1[Symbol.toStringTag]=(o=>o[Symbol.toStringTag]="Null")(Null$1.prototype);class Int_ extends DataType{constructor(s,_){super(),this.isSigned=s,this.bitWidth=_}get typeId(){return Type$1.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?Int32Array:Uint32Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}Int_[Symbol.toStringTag]=(o=>(o.isSigned=null,o.bitWidth=null,o[Symbol.toStringTag]="Int"))(Int_.prototype);class Int8 extends Int_{constructor(){super(!0,8)}}class Int16 extends Int_{constructor(){super(!0,16)}}class Int32 extends Int_{constructor(){super(!0,32)}}class Int64$1 extends Int_{constructor(){super(!0,64)}}class Uint8 extends Int_{constructor(){super(!1,8)}}class Uint16 extends Int_{constructor(){super(!1,16)}}class Uint32 extends Int_{constructor(){super(!1,32)}}class Uint64$1 extends Int_{constructor(){super(!1,64)}}Object.defineProperty(Int8.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Int16.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Int32.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Int64$1.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Uint8.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Uint16.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Uint32.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Uint64$1.prototype,"ArrayType",{value:Uint32Array});class Float extends DataType{constructor(s){super(),this.precision=s}get typeId(){return Type$1.Float}get ArrayType(){switch(this.precision){case Precision.HALF:return Uint16Array;case Precision.SINGLE:return Float32Array;case Precision.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Float[Symbol.toStringTag]=(o=>(o.precision=null,o[Symbol.toStringTag]="Float"))(Float.prototype);class Float16 extends Float{constructor(){super(Precision.HALF)}}class Float32 extends Float{constructor(){super(Precision.SINGLE)}}class Float64 extends Float{constructor(){super(Precision.DOUBLE)}}Object.defineProperty(Float16.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Float32.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Float64.prototype,"ArrayType",{value:Float64Array});class Binary$1 extends DataType{constructor(){super()}get typeId(){return Type$1.Binary}toString(){return"Binary"}}Binary$1[Symbol.toStringTag]=(o=>(o.ArrayType=Uint8Array,o[Symbol.toStringTag]="Binary"))(Binary$1.prototype);class Utf8$1 extends DataType{constructor(){super()}get typeId(){return Type$1.Utf8}toString(){return"Utf8"}}Utf8$1[Symbol.toStringTag]=(o=>(o.ArrayType=Uint8Array,o[Symbol.toStringTag]="Utf8"))(Utf8$1.prototype);class Bool$1 extends DataType{constructor(){super()}get typeId(){return Type$1.Bool}toString(){return"Bool"}}Bool$1[Symbol.toStringTag]=(o=>(o.ArrayType=Uint8Array,o[Symbol.toStringTag]="Bool"))(Bool$1.prototype);class Decimal$1 extends DataType{constructor(s,_){super(),this.scale=s,this.precision=_}get typeId(){return Type$1.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}Decimal$1[Symbol.toStringTag]=(o=>(o.scale=null,o.precision=null,o.ArrayType=Uint32Array,o[Symbol.toStringTag]="Decimal"))(Decimal$1.prototype);class Date_ extends DataType{constructor(s){super(),this.unit=s}get typeId(){return Type$1.Date}toString(){return`Date${(this.unit+1)*32}<${DateUnit[this.unit]}>`}}Date_[Symbol.toStringTag]=(o=>(o.unit=null,o.ArrayType=Int32Array,o[Symbol.toStringTag]="Date"))(Date_.prototype);class DateDay extends Date_{constructor(){super(DateUnit.DAY)}}class DateMillisecond extends Date_{constructor(){super(DateUnit.MILLISECOND)}}class Time_ extends DataType{constructor(s,_){super(),this.unit=s,this.bitWidth=_}get typeId(){return Type$1.Time}toString(){return`Time${this.bitWidth}<${TimeUnit[this.unit]}>`}}Time_[Symbol.toStringTag]=(o=>(o.unit=null,o.bitWidth=null,o.ArrayType=Int32Array,o[Symbol.toStringTag]="Time"))(Time_.prototype);class Timestamp_ extends DataType{constructor(s,_){super(),this.unit=s,this.timezone=_}get typeId(){return Type$1.Timestamp}toString(){return`Timestamp<${TimeUnit[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Timestamp_[Symbol.toStringTag]=(o=>(o.unit=null,o.timezone=null,o.ArrayType=Int32Array,o[Symbol.toStringTag]="Timestamp"))(Timestamp_.prototype);class Interval_ extends DataType{constructor(s){super(),this.unit=s}get typeId(){return Type$1.Interval}toString(){return`Interval<${IntervalUnit[this.unit]}>`}}Interval_[Symbol.toStringTag]=(o=>(o.unit=null,o.ArrayType=Int32Array,o[Symbol.toStringTag]="Interval"))(Interval_.prototype);class List$1 extends DataType{constructor(s){super(),this.children=[s]}get typeId(){return Type$1.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}List$1[Symbol.toStringTag]=(o=>(o.children=null,o[Symbol.toStringTag]="List"))(List$1.prototype);class Struct$1 extends DataType{constructor(s){super(),this.children=s}get typeId(){return Type$1.Struct}toString(){return`Struct<{${this.children.map(s=>`${s.name}:${s.type}`).join(", ")}}>`}}Struct$1[Symbol.toStringTag]=(o=>(o.children=null,o[Symbol.toStringTag]="Struct"))(Struct$1.prototype);class Union_ extends DataType{constructor(s,_,_e){super(),this.mode=s,this.children=_e,this.typeIds=_=Int32Array.from(_),this.typeIdToChildIndex=_.reduce((et,it,tt)=>(et[it]=tt)&&et||et,Object.create(null))}get typeId(){return Type$1.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(s=>`${s.type}`).join(" | ")}>`}}Union_[Symbol.toStringTag]=(o=>(o.mode=null,o.typeIds=null,o.children=null,o.typeIdToChildIndex=null,o.ArrayType=Int8Array,o[Symbol.toStringTag]="Union"))(Union_.prototype);class FixedSizeBinary$1 extends DataType{constructor(s){super(),this.byteWidth=s}get typeId(){return Type$1.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}FixedSizeBinary$1[Symbol.toStringTag]=(o=>(o.byteWidth=null,o.ArrayType=Uint8Array,o[Symbol.toStringTag]="FixedSizeBinary"))(FixedSizeBinary$1.prototype);class FixedSizeList$1 extends DataType{constructor(s,_){super(),this.listSize=s,this.children=[_]}get typeId(){return Type$1.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}FixedSizeList$1[Symbol.toStringTag]=(o=>(o.children=null,o.listSize=null,o[Symbol.toStringTag]="FixedSizeList"))(FixedSizeList$1.prototype);class Map_$1 extends DataType{constructor(s,_=!1){super(),this.children=[s],this.keysSorted=_}get typeId(){return Type$1.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}toString(){return`Map<{${this.children[0].type.children.map(s=>`${s.name}:${s.type}`).join(", ")}}>`}}Map_$1[Symbol.toStringTag]=(o=>(o.children=null,o.keysSorted=null,o[Symbol.toStringTag]="Map_"))(Map_$1.prototype);const getId=(o=>()=>++o)(-1);class Dictionary extends DataType{constructor(s,_,_e,et){super(),this.indices=_,this.dictionary=s,this.isOrdered=et||!1,this.id=_e==null?getId():typeof _e=="number"?_e:_e.low}get typeId(){return Type$1.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}Dictionary[Symbol.toStringTag]=(o=>(o.id=null,o.indices=null,o.isOrdered=null,o.dictionary=null,o[Symbol.toStringTag]="Dictionary"))(Dictionary.prototype);function strideForType(o){let s=o;switch(o.typeId){case Type$1.Decimal:return 4;case Type$1.Timestamp:return 2;case Type$1.Date:return 1+s.unit;case Type$1.Interval:return 1+s.unit;case Type$1.Int:return 1+ +(s.bitWidth>32);case Type$1.Time:return 1+ +(s.bitWidth>32);case Type$1.FixedSizeList:return s.listSize;case Type$1.FixedSizeBinary:return s.byteWidth;default:return 1}}const kUnknownNullCount=-1;class Data{constructor(s,_,_e,et,it,tt,rt){this.type=s,this.dictionary=rt,this.offset=Math.floor(Math.max(_||0,0)),this.length=Math.floor(Math.max(_e||0,0)),this._nullCount=Math.floor(Math.max(et||0,-1)),this.childData=(tt||[]).map(ot=>ot instanceof Data?ot:ot.data);let nt;it instanceof Data?(this.stride=it.stride,this.values=it.values,this.typeIds=it.typeIds,this.nullBitmap=it.nullBitmap,this.valueOffsets=it.valueOffsets):(this.stride=strideForType(s),it&&((nt=it[0])&&(this.valueOffsets=nt),(nt=it[1])&&(this.values=nt),(nt=it[2])&&(this.nullBitmap=nt),(nt=it[3])&&(this.typeIds=nt)))}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let s=0,{valueOffsets:_,values:_e,nullBitmap:et,typeIds:it}=this;return _&&(s+=_.byteLength),_e&&(s+=_e.byteLength),et&&(s+=et.byteLength),it&&(s+=it.byteLength),this.childData.reduce((tt,rt)=>tt+rt.byteLength,s)}get nullCount(){let s=this._nullCount,_;return s<=kUnknownNullCount&&(_=this.nullBitmap)&&(this._nullCount=s=this.length-popcnt_bit_range(_,this.offset,this.offset+this.length)),s}clone(s,_=this.offset,_e=this.length,et=this._nullCount,it=this,tt=this.childData){return new Data(s,_,_e,et,it,tt,this.dictionary)}slice(s,_){const{stride:_e,typeId:et,childData:it}=this,tt=+(this._nullCount===0)-1,rt=et===16?_e:1,nt=this._sliceBuffers(s,_,_e,et);return this.clone(this.type,this.offset+s,_,tt,nt,!it.length||this.valueOffsets?it:this._sliceChildren(it,rt*s,rt*_))}_changeLengthAndBackfillNullBitmap(s){if(this.typeId===Type$1.Null)return this.clone(this.type,0,s,0);const{length:_,nullCount:_e}=this,et=new Uint8Array((s+63&-64)>>3).fill(255,0,_>>3);et[_>>3]=(1<<_-(_&-8))-1,_e>0&&et.set(truncateBitmap(this.offset,_,this.nullBitmap),0);const it=this.buffers;return it[BufferType.VALIDITY]=et,this.clone(this.type,0,s,_e+(s-_),it)}_sliceBuffers(s,_,_e,et){let it,{buffers:tt}=this;return(it=tt[BufferType.TYPE])&&(tt[BufferType.TYPE]=it.subarray(s,s+_)),(it=tt[BufferType.OFFSET])&&(tt[BufferType.OFFSET]=it.subarray(s,s+_+1))||(it=tt[BufferType.DATA])&&(tt[BufferType.DATA]=et===6?it:it.subarray(_e*s,_e*(s+_))),tt}_sliceChildren(s,_,_e){return s.map(et=>et.slice(_,_e))}static new(s,_,_e,et,it,tt,rt){switch(it instanceof Data?it=it.buffers:it||(it=[]),s.typeId){case Type$1.Null:return Data.Null(s,_,_e);case Type$1.Int:return Data.Int(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.Dictionary:return Data.Dictionary(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[],rt);case Type$1.Float:return Data.Float(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.Bool:return Data.Bool(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.Decimal:return Data.Decimal(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.Date:return Data.Date(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.Time:return Data.Time(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.Timestamp:return Data.Timestamp(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.Interval:return Data.Interval(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.FixedSizeBinary:return Data.FixedSizeBinary(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.DATA]||[]);case Type$1.Binary:return Data.Binary(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.OFFSET]||[],it[BufferType.DATA]||[]);case Type$1.Utf8:return Data.Utf8(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.OFFSET]||[],it[BufferType.DATA]||[]);case Type$1.List:return Data.List(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.OFFSET]||[],(tt||[])[0]);case Type$1.FixedSizeList:return Data.FixedSizeList(s,_,_e,et||0,it[BufferType.VALIDITY],(tt||[])[0]);case Type$1.Struct:return Data.Struct(s,_,_e,et||0,it[BufferType.VALIDITY],tt||[]);case Type$1.Map:return Data.Map(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.OFFSET]||[],(tt||[])[0]);case Type$1.Union:return Data.Union(s,_,_e,et||0,it[BufferType.VALIDITY],it[BufferType.TYPE]||[],it[BufferType.OFFSET]||tt,tt)}throw new Error(`Unrecognized typeId ${s.typeId}`)}static Null(s,_,_e){return new Data(s,_,_e,0)}static Int(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static Dictionary(s,_,_e,et,it,tt,rt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.indices.ArrayType,tt),toUint8Array(it)],[],rt)}static Float(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static Bool(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static Decimal(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static Date(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static Time(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static Timestamp(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static Interval(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static FixedSizeBinary(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,toArrayBufferView(s.ArrayType,tt),toUint8Array(it)])}static Binary(s,_,_e,et,it,tt,rt){return new Data(s,_,_e,et,[toInt32Array(tt),toUint8Array(rt),toUint8Array(it)])}static Utf8(s,_,_e,et,it,tt,rt){return new Data(s,_,_e,et,[toInt32Array(tt),toUint8Array(rt),toUint8Array(it)])}static List(s,_,_e,et,it,tt,rt){return new Data(s,_,_e,et,[toInt32Array(tt),void 0,toUint8Array(it)],[rt])}static FixedSizeList(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,void 0,toUint8Array(it)],[tt])}static Struct(s,_,_e,et,it,tt){return new Data(s,_,_e,et,[void 0,void 0,toUint8Array(it)],tt)}static Map(s,_,_e,et,it,tt,rt){return new Data(s,_,_e,et,[toInt32Array(tt),void 0,toUint8Array(it)],[rt])}static Union(s,_,_e,et,it,tt,rt,nt){const ot=[void 0,void 0,toUint8Array(it),toArrayBufferView(s.ArrayType,tt)];return s.mode===UnionMode.Sparse?new Data(s,_,_e,et,ot,rt):(ot[BufferType.OFFSET]=toInt32Array(rt),new Data(s,_,_e,et,ot,nt))}}Data.prototype.childData=Object.freeze([]);const undf=void 0;function valueToString(o){if(o===null)return"null";if(o===undf)return"undefined";switch(typeof o){case"number":return`${o}`;case"bigint":return`${o}`;case"string":return`"${o}"`}return typeof o[Symbol.toPrimitive]=="function"?o[Symbol.toPrimitive]("string"):ArrayBuffer.isView(o)?`[${o}]`:JSON.stringify(o)}function createIsValidFunction(o){if(!o||o.length<=0)return function(et){return!0};let s="",_=o.filter(_e=>_e===_e);return _.length>0&&(s=`
    switch (x) {${_.map(_e=>`
        case ${valueToCase(_e)}:`).join("")}
            return false;
    }`),o.length!==_.length&&(s=`if (x !== x) return false;
${s}`),new Function("x",`${s}
return true;`)}function valueToCase(o){return typeof o!="bigint"?valueToString(o):BigIntAvailable?`${valueToString(o)}n`:`"${valueToString(o)}"`}const roundLengthUpToNearest64Bytes=(o,s)=>(o*s+63&-64||64)/s,sliceOrExtendArray=(o,s=0)=>o.length>=s?o.subarray(0,s):memcpy(new o.constructor(s),o,0);class BufferBuilder{constructor(s,_=1){this.buffer=s,this.stride=_,this.BYTES_PER_ELEMENT=s.BYTES_PER_ELEMENT,this.ArrayType=s.constructor,this._resize(this.length=s.length/_|0)}get byteLength(){return this.length*this.stride*this.BYTES_PER_ELEMENT|0}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(s,_){return this}append(s){return this.set(this.length,s)}reserve(s){if(s>0){this.length+=s;const _=this.stride,_e=this.length*_,et=this.buffer.length;_e>=et&&this._resize(et===0?roundLengthUpToNearest64Bytes(_e*1,this.BYTES_PER_ELEMENT):roundLengthUpToNearest64Bytes(_e*2,this.BYTES_PER_ELEMENT))}return this}flush(s=this.length){s=roundLengthUpToNearest64Bytes(s*this.stride,this.BYTES_PER_ELEMENT);const _=sliceOrExtendArray(this.buffer,s);return this.clear(),_}clear(){return this.length=0,this._resize(0),this}_resize(s){return this.buffer=memcpy(new this.ArrayType(s),this.buffer)}}BufferBuilder.prototype.offset=0;class DataBufferBuilder extends BufferBuilder{last(){return this.get(this.length-1)}get(s){return this.buffer[s]}set(s,_){return this.reserve(s-this.length+1),this.buffer[s*this.stride]=_,this}}class BitmapBufferBuilder extends DataBufferBuilder{constructor(s=new Uint8Array(0)){super(s,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(s){return this.buffer[s>>3]>>s%8&1}set(s,_){const{buffer:_e}=this.reserve(s-this.length+1),et=s>>3,it=s%8,tt=_e[et]>>it&1;return _?tt===0&&(_e[et]|=1<<it,++this.numValid):tt===1&&(_e[et]&=~(1<<it),--this.numValid),this}clear(){return this.numValid=0,super.clear()}}class OffsetsBufferBuilder extends DataBufferBuilder{constructor(s=new Int32Array(1)){super(s,1)}append(s){return this.set(this.length-1,s)}set(s,_){const _e=this.length-1,et=this.reserve(s-_e+1).buffer;return _e<s++&&et.fill(et[_e],_e,s),et[s]=et[s-1]+_,this}flush(s=this.length-1){return s>this.length&&this.set(s-1,0),super.flush(s+1)}}class WideBufferBuilder extends BufferBuilder{get ArrayType64(){return this._ArrayType64||(this._ArrayType64=this.buffer instanceof Int32Array?BigInt64ArrayCtor:BigUint64ArrayCtor)}set(s,_){switch(this.reserve(s-this.length+1),typeof _){case"bigint":this.buffer64[s]=_;break;case"number":this.buffer[s*this.stride]=_;break;default:this.buffer.set(_,s*this.stride)}return this}_resize(s){const _=super._resize(s),_e=_.byteLength/(this.BYTES_PER_ELEMENT*this.stride);return BigIntAvailable&&(this.buffer64=new this.ArrayType64(_.buffer,_.byteOffset,_e)),_}}class Builder$2{constructor({type:s,nullValues:_}){this.length=0,this.finished=!1,this.type=s,this.children=[],this.nullValues=_,this.stride=strideForType(s),this._nulls=new BitmapBufferBuilder,_&&_.length>0&&(this._isValid=createIsValidFunction(_))}static new(s){}static throughNode(s){throw new Error('"throughNode" not available in this environment')}static throughDOM(s){throw new Error('"throughDOM" not available in this environment')}static throughIterable(s){return throughIterable(s)}static throughAsyncIterable(s){return throughAsyncIterable(s)}toVector(){return AbstractVector.new(this.flush())}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let s=0;return this._offsets&&(s+=this._offsets.byteLength),this._values&&(s+=this._values.byteLength),this._nulls&&(s+=this._nulls.byteLength),this._typeIds&&(s+=this._typeIds.byteLength),this.children.reduce((_,_e)=>_+_e.byteLength,s)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let s=0;return this._offsets&&(s+=this._offsets.reservedByteLength),this._values&&(s+=this._values.reservedByteLength),this._nulls&&(s+=this._nulls.reservedByteLength),this._typeIds&&(s+=this._typeIds.reservedByteLength),this.children.reduce((_,_e)=>_+_e.reservedByteLength,s)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(s){return this.set(this.length,s)}isValid(s){return this._isValid(s)}set(s,_){return this.setValid(s,this.isValid(_))&&this.setValue(s,_),this}setValue(s,_){this._setValue(this,s,_)}setValid(s,_){return this.length=this._nulls.set(s,+_).length,_}addChild(s,_=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(s){return this.children[s]||null}flush(){const s=[],_=this._values,_e=this._offsets,et=this._typeIds,{length:it,nullCount:tt}=this;et?(s[BufferType.TYPE]=et.flush(it),_e&&(s[BufferType.OFFSET]=_e.flush(it))):_e?(_&&(s[BufferType.DATA]=_.flush(_e.last())),s[BufferType.OFFSET]=_e.flush(it)):_&&(s[BufferType.DATA]=_.flush(it)),tt>0&&(s[BufferType.VALIDITY]=this._nulls.flush(it));const rt=Data.new(this.type,0,it,tt,s,this.children.map(nt=>nt.flush()));return this.clear(),rt}finish(){return this.finished=!0,this.children.forEach(s=>s.finish()),this}clear(){return this.length=0,this._offsets&&this._offsets.clear(),this._values&&this._values.clear(),this._nulls&&this._nulls.clear(),this._typeIds&&this._typeIds.clear(),this.children.forEach(s=>s.clear()),this}}Builder$2.prototype.length=1;Builder$2.prototype.stride=1;Builder$2.prototype.children=null;Builder$2.prototype.finished=!1;Builder$2.prototype.nullValues=null;Builder$2.prototype._isValid=()=>!0;class FixedWidthBuilder extends Builder$2{constructor(s){super(s),this._values=new DataBufferBuilder(new this.ArrayType(0),this.stride)}setValue(s,_){const _e=this._values;return _e.reserve(s-_e.length+1),super.setValue(s,_)}}class VariableWidthBuilder extends Builder$2{constructor(s){super(s),this._pendingLength=0,this._offsets=new OffsetsBufferBuilder}setValue(s,_){const _e=this._pending||(this._pending=new Map),et=_e.get(s);et&&(this._pendingLength-=et.length),this._pendingLength+=_.length,_e.set(s,_)}setValid(s,_){return super.setValid(s,_)?!0:((this._pending||(this._pending=new Map)).set(s,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){const s=this._pending,_=this._pendingLength;return this._pendingLength=0,this._pending=void 0,s&&s.size>0&&this._flushPending(s,_),this}}function throughIterable(o){const{["queueingStrategy"]:s="count"}=o,{["highWaterMark"]:_=s!=="bytes"?1e3:2**14}=o,_e=s!=="bytes"?"length":"byteLength";return function*(et){let it=0,tt=Builder$2.new(o);for(const rt of et)tt.append(rt)[_e]>=_&&++it&&(yield tt.toVector());(tt.finish().length>0||it===0)&&(yield tt.toVector())}}function throughAsyncIterable(o){const{["queueingStrategy"]:s="count"}=o,{["highWaterMark"]:_=s!=="bytes"?1e3:2**14}=o,_e=s!=="bytes"?"length":"byteLength";return async function*(et){let it=0,tt=Builder$2.new(o);for await(const rt of et)tt.append(rt)[_e]>=_&&++it&&(yield tt.toVector());(tt.finish().length>0||it===0)&&(yield tt.toVector())}}class BoolBuilder extends Builder$2{constructor(s){super(s),this._values=new BitmapBufferBuilder}setValue(s,_){this._values.set(s,+_)}}class NullBuilder extends Builder$2{setValue(s,_){}setValid(s,_){return this.length=Math.max(s+1,this.length),_}}class DateBuilder extends FixedWidthBuilder{}class DateDayBuilder extends DateBuilder{}class DateMillisecondBuilder extends DateBuilder{}class DecimalBuilder extends FixedWidthBuilder{}class DictionaryBuilder extends Builder$2{constructor({type:s,nullValues:_,dictionaryHashFunction:_e}){super({type:new Dictionary(s.dictionary,s.indices,s.id,s.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Builder$2.new({type:this.type.indices,nullValues:_}),this.dictionary=Builder$2.new({type:this.type.dictionary,nullValues:null}),typeof _e=="function"&&(this.valueToKey=_e)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(s){return this.indices.isValid(s)}setValid(s,_){const _e=this.indices;return _=_e.setValid(s,_),this.length=_e.length,_}setValue(s,_){let _e=this._keysToIndices,et=this.valueToKey(_),it=_e[et];return it===void 0&&(_e[et]=it=this._dictionaryOffset+this.dictionary.append(_).length-1),this.indices.setValue(s,it)}flush(){const s=this.type,_=this._dictionary,_e=this.dictionary.toVector(),et=this.indices.flush().clone(s);return et.dictionary=_?_.concat(_e):_e,this.finished||(this._dictionaryOffset+=_e.length),this._dictionary=et.dictionary,this.clear(),et}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(s){return typeof s=="string"?s:`${s}`}}class FixedSizeBinaryBuilder extends FixedWidthBuilder{}const f64=new Float64Array(1),u32=new Uint32Array(f64.buffer);function uint16ToFloat64(o){let s=(o&31744)>>10,_=(o&1023)/1024,_e=(-1)**((o&32768)>>15);switch(s){case 31:return _e*(_?NaN:1/0);case 0:return _e*(_?6103515625e-14*_:0)}return _e*2**(s-15)*(1+_)}function float64ToUint16(o){if(o!==o)return 32256;f64[0]=o;let s=(u32[1]&2147483648)>>16&65535,_=u32[1]&2146435072,_e=0;return _>=1089470464?u32[0]>0?_=31744:(_=(_&2080374784)>>16,_e=(u32[1]&1048575)>>10):_<=1056964608?(_e=1048576+(u32[1]&1048575),_e=1048576+(_e<<(_>>20)-998)>>21,_=0):(_=_-1056964608>>10,_e=(u32[1]&1048575)+512>>10),s|_|_e&65535}var util_math_=Object.freeze(Object.defineProperty({__proto__:null,uint16ToFloat64,float64ToUint16},Symbol.toStringTag,{value:"Module"}));class FloatBuilder extends FixedWidthBuilder{}class Float16Builder extends FloatBuilder{setValue(s,_){this._values.set(s,float64ToUint16(_))}}class Float32Builder extends FloatBuilder{setValue(s,_){this._values.set(s,_)}}class Float64Builder extends FloatBuilder{setValue(s,_){this._values.set(s,_)}}const isArrowBigNumSymbol=Symbol.for("isArrowBigNum");function BigNum(o,...s){return s.length===0?Object.setPrototypeOf(toArrayBufferView(this.TypedArray,o),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(o,...s),this.constructor.prototype)}BigNum.prototype[isArrowBigNumSymbol]=!0;BigNum.prototype.toJSON=function(){return`"${bignumToString(this)}"`};BigNum.prototype.valueOf=function(){return bignumToNumber(this)};BigNum.prototype.toString=function(){return bignumToString(this)};BigNum.prototype[Symbol.toPrimitive]=function(o="default"){switch(o){case"number":return bignumToNumber(this);case"string":return bignumToString(this);case"default":return bignumToBigInt(this)}return bignumToString(this)};function SignedBigNum(...o){return BigNum.apply(this,o)}function UnsignedBigNum(...o){return BigNum.apply(this,o)}function DecimalBigNum(...o){return BigNum.apply(this,o)}Object.setPrototypeOf(SignedBigNum.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(UnsignedBigNum.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(DecimalBigNum.prototype,Object.create(Uint32Array.prototype));Object.assign(SignedBigNum.prototype,BigNum.prototype,{constructor:SignedBigNum,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64ArrayCtor});Object.assign(UnsignedBigNum.prototype,BigNum.prototype,{constructor:UnsignedBigNum,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64ArrayCtor});Object.assign(DecimalBigNum.prototype,BigNum.prototype,{constructor:DecimalBigNum,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64ArrayCtor});function bignumToNumber(o){let{buffer:s,byteOffset:_,length:_e,signed:et}=o,it=new Int32Array(s,_,_e),tt=0,rt=0,nt=it.length,ot,st;for(;rt<nt;)st=it[rt++],ot=it[rt++],et||(ot=ot>>>0),tt+=(st>>>0)+ot*rt**32;return tt}let bignumToString,bignumToBigInt;BigIntAvailable?(bignumToBigInt=o=>o.byteLength===8?new o.BigIntArray(o.buffer,o.byteOffset,1)[0]:decimalToString(o),bignumToString=o=>o.byteLength===8?`${new o.BigIntArray(o.buffer,o.byteOffset,1)[0]}`:decimalToString(o)):(bignumToString=decimalToString,bignumToBigInt=bignumToString);function decimalToString(o){let s="",_=new Uint32Array(2),_e=new Uint16Array(o.buffer,o.byteOffset,o.byteLength/2),et=new Uint32Array((_e=new Uint16Array(_e).reverse()).buffer),it=-1,tt=_e.length-1;do{for(_[0]=_e[it=0];it<tt;)_e[it++]=_[1]=_[0]/10,_[0]=(_[0]-_[1]*10<<16)+_e[it];_e[it]=_[1]=_[0]/10,_[0]=_[0]-_[1]*10,s=`${_[0]}${s}`}while(et[0]||et[1]||et[2]||et[3]);return s||"0"}class BN{constructor(s,_){return BN.new(s,_)}static new(s,_){switch(_){case!0:return new SignedBigNum(s);case!1:return new UnsignedBigNum(s)}switch(s.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64ArrayCtor:return new SignedBigNum(s)}return s.byteLength===16?new DecimalBigNum(s):new UnsignedBigNum(s)}static signed(s){return new SignedBigNum(s)}static unsigned(s){return new UnsignedBigNum(s)}static decimal(s){return new DecimalBigNum(s)}}var util_bn_=Object.freeze(Object.defineProperty({__proto__:null,isArrowBigNumSymbol,get bignumToString(){return bignumToString},get bignumToBigInt(){return bignumToBigInt},BN},Symbol.toStringTag,{value:"Module"}));class IntBuilder extends FixedWidthBuilder{setValue(s,_){this._values.set(s,_)}}class Int8Builder extends IntBuilder{}class Int16Builder extends IntBuilder{}class Int32Builder extends IntBuilder{}class Int64Builder extends IntBuilder{constructor(s){s.nullValues&&(s.nullValues=s.nullValues.map(toBigInt)),super(s),this._values=new WideBufferBuilder(new Int32Array(0),2)}get values64(){return this._values.buffer64}isValid(s){return super.isValid(toBigInt(s))}}class Uint8Builder extends IntBuilder{}class Uint16Builder extends IntBuilder{}class Uint32Builder extends IntBuilder{}class Uint64Builder extends IntBuilder{constructor(s){s.nullValues&&(s.nullValues=s.nullValues.map(toBigInt)),super(s),this._values=new WideBufferBuilder(new Uint32Array(0),2)}get values64(){return this._values.buffer64}isValid(s){return super.isValid(toBigInt(s))}}const toBigInt=(o=>s=>(ArrayBuffer.isView(s)&&(o.buffer=s.buffer,o.byteOffset=s.byteOffset,o.byteLength=s.byteLength,s=bignumToBigInt(o),o.buffer=null),s))({BigIntArray:BigInt64ArrayCtor});class TimeBuilder extends FixedWidthBuilder{}class TimeSecondBuilder extends TimeBuilder{}class TimeMillisecondBuilder extends TimeBuilder{}class TimeMicrosecondBuilder extends TimeBuilder{}class TimeNanosecondBuilder extends TimeBuilder{}class TimestampBuilder extends FixedWidthBuilder{}class TimestampSecondBuilder extends TimestampBuilder{}class TimestampMillisecondBuilder extends TimestampBuilder{}class TimestampMicrosecondBuilder extends TimestampBuilder{}class TimestampNanosecondBuilder extends TimestampBuilder{}class IntervalBuilder extends FixedWidthBuilder{}class IntervalDayTimeBuilder extends IntervalBuilder{}class IntervalYearMonthBuilder extends IntervalBuilder{}class BinaryBuilder extends VariableWidthBuilder{constructor(s){super(s),this._values=new BufferBuilder(new Uint8Array(0))}get byteLength(){let s=this._pendingLength+this.length*4;return this._offsets&&(s+=this._offsets.byteLength),this._values&&(s+=this._values.byteLength),this._nulls&&(s+=this._nulls.byteLength),s}setValue(s,_){return super.setValue(s,toUint8Array(_))}_flushPending(s,_){const _e=this._offsets,et=this._values.reserve(_).buffer;let it=0,tt=0,rt=0,nt;for([it,nt]of s)nt===void 0?_e.set(it,0):(tt=nt.length,et.set(nt,rt),_e.set(it,tt),rt+=tt)}}class Utf8Builder extends VariableWidthBuilder{constructor(s){super(s),this._values=new BufferBuilder(new Uint8Array(0))}get byteLength(){let s=this._pendingLength+this.length*4;return this._offsets&&(s+=this._offsets.byteLength),this._values&&(s+=this._values.byteLength),this._nulls&&(s+=this._nulls.byteLength),s}setValue(s,_){return super.setValue(s,encodeUtf8(_))}_flushPending(s,_){}}Utf8Builder.prototype._flushPending=BinaryBuilder.prototype._flushPending;class Run{get length(){return this._values.length}get(s){return this._values[s]}clear(){return this._values=null,this}bind(s){return s instanceof AbstractVector?s:(this._values=s,this)}}const kParent=Symbol.for("parent"),kRowIndex$1=Symbol.for("rowIndex"),kKeyToIdx=Symbol.for("keyToIdx"),kIdxToVal=Symbol.for("idxToVal"),kCustomInspect=Symbol.for("nodejs.util.inspect.custom");class Row{constructor(s,_){this[kParent]=s,this.size=_}entries(){return this[Symbol.iterator]()}has(s){return this.get(s)!==void 0}get(s){let _;if(s!=null){const _e=this[kKeyToIdx]||(this[kKeyToIdx]=new Map);let et=_e.get(s);if(et!==void 0){const it=this[kIdxToVal]||(this[kIdxToVal]=new Array(this.size));(_=it[et])!==void 0||(it[et]=_=this.getValue(et))}else if((et=this.getIndex(s))>-1){_e.set(s,et);const it=this[kIdxToVal]||(this[kIdxToVal]=new Array(this.size));(_=it[et])!==void 0||(it[et]=_=this.getValue(et))}}return _}set(s,_){if(s!=null){const _e=this[kKeyToIdx]||(this[kKeyToIdx]=new Map);let et=_e.get(s);if(et===void 0&&_e.set(s,et=this.getIndex(s)),et>-1){const it=this[kIdxToVal]||(this[kIdxToVal]=new Array(this.size));it[et]=this.setValue(et,_)}}return this}clear(){throw new Error(`Clearing ${this[Symbol.toStringTag]} not supported.`)}delete(s){throw new Error(`Deleting ${this[Symbol.toStringTag]} values not supported.`)}*[Symbol.iterator](){const s=this.keys(),_=this.values(),_e=this[kKeyToIdx]||(this[kKeyToIdx]=new Map),et=this[kIdxToVal]||(this[kIdxToVal]=new Array(this.size));for(let it,tt,rt=0,nt,ot;!((nt=s.next()).done||(ot=_.next()).done);++rt)it=nt.value,tt=ot.value,et[rt]=tt,_e.has(it)||_e.set(it,rt),yield[it,tt]}forEach(s,_){const _e=this.keys(),et=this.values(),it=_===void 0?s:(nt,ot,st)=>s.call(_,nt,ot,st),tt=this[kKeyToIdx]||(this[kKeyToIdx]=new Map),rt=this[kIdxToVal]||(this[kIdxToVal]=new Array(this.size));for(let nt,ot,st=0,at,lt;!((at=_e.next()).done||(lt=et.next()).done);++st)nt=at.value,ot=lt.value,rt[st]=ot,tt.has(nt)||tt.set(nt,st),it(ot,nt,this)}toArray(){return[...this.values()]}toJSON(){const s={};return this.forEach((_,_e)=>s[_e]=_),s}inspect(){return this.toString()}[kCustomInspect](){return this.toString()}toString(){const s=[];return this.forEach((_,_e)=>{_e=valueToString(_e),_=valueToString(_),s.push(`${_e}: ${_}`)}),`{ ${s.join(", ")} }`}}Row[Symbol.toStringTag]=(o=>(Object.defineProperties(o,{size:{writable:!0,enumerable:!1,configurable:!1,value:0},[kParent]:{writable:!0,enumerable:!1,configurable:!1,value:null},[kRowIndex$1]:{writable:!0,enumerable:!1,configurable:!1,value:-1}}),o[Symbol.toStringTag]="Row"))(Row.prototype);class MapRow extends Row{constructor(s){return super(s,s.length),createRowProxy(this)}keys(){return this[kParent].getChildAt(0)[Symbol.iterator]()}values(){return this[kParent].getChildAt(1)[Symbol.iterator]()}getKey(s){return this[kParent].getChildAt(0).get(s)}getIndex(s){return this[kParent].getChildAt(0).indexOf(s)}getValue(s){return this[kParent].getChildAt(1).get(s)}setValue(s,_){this[kParent].getChildAt(1).set(s,_)}}class StructRow extends Row{constructor(s){return super(s,s.type.children.length),defineRowProxyProperties(this)}*keys(){for(const s of this[kParent].type.children)yield s.name}*values(){for(const s of this[kParent].type.children)yield this[s.name]}getKey(s){return this[kParent].type.children[s].name}getIndex(s){return this[kParent].type.children.findIndex(_=>_.name===s)}getValue(s){return this[kParent].getChildAt(s).get(this[kRowIndex$1])}setValue(s,_){return this[kParent].getChildAt(s).set(this[kRowIndex$1],_)}}Object.setPrototypeOf(Row.prototype,Map.prototype);const defineRowProxyProperties=(()=>{const o={enumerable:!0,configurable:!1,get:null,set:null};return s=>{let _=-1,_e=s[kKeyToIdx]||(s[kKeyToIdx]=new Map);const et=tt=>function(){return this.get(tt)},it=tt=>function(rt){return this.set(tt,rt)};for(const tt of s.keys())_e.set(tt,++_),o.get=et(tt),o.set=it(tt),s.hasOwnProperty(tt)||(o.enumerable=!0,Object.defineProperty(s,tt,o)),s.hasOwnProperty(_)||(o.enumerable=!1,Object.defineProperty(s,_,o));return o.get=o.set=null,s}})(),createRowProxy=(()=>{if(typeof Proxy=="undefined")return defineRowProxyProperties;const o=Row.prototype.has,s=Row.prototype.get,_=Row.prototype.set,_e=Row.prototype.getKey,et={isExtensible(){return!1},deleteProperty(){return!1},preventExtensions(){return!0},ownKeys(it){return[...it.keys()].map(tt=>`${tt}`)},has(it,tt){switch(tt){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case kParent:case kRowIndex$1:case kIdxToVal:case kKeyToIdx:case kCustomInspect:return!0}return typeof tt=="number"&&!it.has(tt)&&(tt=it.getKey(tt)),it.has(tt)},get(it,tt,rt){switch(tt){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case kParent:case kRowIndex$1:case kIdxToVal:case kKeyToIdx:case kCustomInspect:return Reflect.get(it,tt,rt)}return typeof tt=="number"&&!o.call(rt,tt)&&(tt=_e.call(rt,tt)),s.call(rt,tt)},set(it,tt,rt,nt){switch(tt){case kParent:case kRowIndex$1:case kIdxToVal:case kKeyToIdx:return Reflect.set(it,tt,rt,nt);case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:return!1}return typeof tt=="number"&&!o.call(nt,tt)&&(tt=_e.call(nt,tt)),o.call(nt,tt)?!!_.call(nt,tt,rt):!1}};return it=>new Proxy(it,et)})();function clampIndex(o,s,_){const _e=o.length,et=s>-1?s:_e+s%_e;return _?_(o,et):et}let tmp;function clampRange(o,s,_,_e){let{length:et=0}=o,it=typeof s!="number"?0:s,tt=typeof _!="number"?et:_;return it<0&&(it=(it%et+et)%et),tt<0&&(tt=(tt%et+et)%et),tt<it&&(tmp=it,it=tt,tt=tmp),tt>et&&(tt=et),_e?_e(o,it,tt):[it,tt]}const big0=BigIntAvailable?BigIntCtor(0):0,isNaNFast=o=>o!==o;function createElementComparator(o){let s=typeof o;if(s!=="object"||o===null)return isNaNFast(o)?isNaNFast:s!=="bigint"?_=>_===o:_=>big0+_===o;if(o instanceof Date){const _=o.valueOf();return _e=>_e instanceof Date?_e.valueOf()===_:!1}return ArrayBuffer.isView(o)?_=>_?compareArrayLike(o,_):!1:o instanceof Map?creatMapComparator(o):Array.isArray(o)?createArrayLikeComparator(o):o instanceof AbstractVector?createVectorComparator(o):createObjectComparator(o)}function createArrayLikeComparator(o){const s=[];for(let _=-1,_e=o.length;++_<_e;)s[_]=createElementComparator(o[_]);return createSubElementsComparator(s)}function creatMapComparator(o){let s=-1;const _=[];return o.forEach(_e=>_[++s]=createElementComparator(_e)),createSubElementsComparator(_)}function createVectorComparator(o){const s=[];for(let _=-1,_e=o.length;++_<_e;)s[_]=createElementComparator(o.get(_));return createSubElementsComparator(s)}function createObjectComparator(o){const s=Object.keys(o);if(s.length===0)return()=>!1;const _=[];for(let _e=-1,et=s.length;++_e<et;)_[_e]=createElementComparator(o[s[_e]]);return createSubElementsComparator(_,s)}function createSubElementsComparator(o,s){return _=>{if(!_||typeof _!="object")return!1;switch(_.constructor){case Array:return compareArray(o,_);case Map:case MapRow:case StructRow:return compareObject(o,_,_.keys());case Object:case void 0:return compareObject(o,_,s||Object.keys(_))}return _ instanceof AbstractVector?compareVector(o,_):!1}}function compareArray(o,s){const _=o.length;if(s.length!==_)return!1;for(let _e=-1;++_e<_;)if(!o[_e](s[_e]))return!1;return!0}function compareVector(o,s){const _=o.length;if(s.length!==_)return!1;for(let _e=-1;++_e<_;)if(!o[_e](s.get(_e)))return!1;return!0}function compareObject(o,s,_){const _e=_[Symbol.iterator](),et=s instanceof Map?s.keys():Object.keys(s)[Symbol.iterator](),it=s instanceof Map?s.values():Object.values(s)[Symbol.iterator]();let tt=0,rt=o.length,nt=it.next(),ot=_e.next(),st=et.next();for(;tt<rt&&!ot.done&&!st.done&&!nt.done&&!(ot.value!==st.value||!o[tt](nt.value));++tt,ot=_e.next(),st=et.next(),nt=it.next());return tt===rt&&ot.done&&st.done&&nt.done?!0:(_e.return&&_e.return(),et.return&&et.return(),it.return&&it.return(),!1)}var util_vector_=Object.freeze(Object.defineProperty({__proto__:null,clampIndex,clampRange,createElementComparator},Symbol.toStringTag,{value:"Module"}));class Chunked extends AbstractVector{constructor(s,_=[],_e=calculateOffsets(_)){super(),this._nullCount=-1,this._type=s,this._chunks=_,this._chunkOffsets=_e,this._length=_e[_e.length-1],this._numChildren=(this._type.children||[]).length}static flatten(...s){return selectChunkArgs(AbstractVector,s)}static concat(...s){const _=Chunked.flatten(...s);return new Chunked(_[0].type,_)}get type(){return this._type}get length(){return this._length}get chunks(){return this._chunks}get typeId(){return this._type.typeId}get VectorName(){return`Chunked<${this._type}>`}get data(){return this._chunks[0]?this._chunks[0].data:null}get ArrayType(){return this._type.ArrayType}get numChildren(){return this._numChildren}get stride(){return this._chunks[0]?this._chunks[0].stride:1}get byteLength(){return this._chunks.reduce((s,_)=>s+_.byteLength,0)}get nullCount(){let s=this._nullCount;return s<0&&(this._nullCount=s=this._chunks.reduce((_,{nullCount:_e})=>_+_e,0)),s}get indices(){if(DataType.isDictionary(this._type)){if(!this._indices){const s=this._chunks;this._indices=s.length===1?s[0].indices:Chunked.concat(...s.map(_=>_.indices))}return this._indices}return null}get dictionary(){return DataType.isDictionary(this._type)?this._chunks[this._chunks.length-1].data.dictionary:null}*[Symbol.iterator](){for(const s of this._chunks)yield*s}clone(s=this._chunks){return new Chunked(this._type,s)}concat(...s){return this.clone(Chunked.flatten(this,...s))}slice(s,_){return clampRange(this,s,_,this._sliceInternal)}getChildAt(s){if(s<0||s>=this._numChildren)return null;let _=this._children||(this._children=[]),_e,et,it;return(_e=_[s])?_e:(et=(this._type.children||[])[s])&&(it=this._chunks.map(tt=>tt.getChildAt(s)).filter(tt=>tt!=null),it.length>0)?_[s]=new Chunked(et.type,it):null}search(s,_){let _e=s,et=this._chunkOffsets,it=et.length-1;if(_e<0||_e>=et[it])return null;if(it<=1)return _?_(this,0,_e):[0,_e];let tt=0,rt=0,nt=0;do{if(tt+1===it)return _?_(this,tt,_e-rt):[tt,_e-rt];nt=tt+(it-tt)/2|0,_e>=et[nt]?tt=nt:it=nt}while(_e<et[it]&&_e>=(rt=et[tt]));return null}isValid(s){return!!this.search(s,this.isValidInternal)}get(s){return this.search(s,this.getInternal)}set(s,_){this.search(s,({chunks:_e},et,it)=>_e[et].set(it,_))}indexOf(s,_){return _&&typeof _=="number"?this.search(_,(_e,et,it)=>this.indexOfInternal(_e,et,it,s)):this.indexOfInternal(this,0,Math.max(0,_||0),s)}toArray(){const{chunks:s}=this,_=s.length;let _e=this._type.ArrayType;if(_<=0)return new _e(0);if(_<=1)return s[0].toArray();let et=0,it=new Array(_);for(let nt=-1;++nt<_;)et+=(it[nt]=s[nt].toArray()).length;_e!==it[0].constructor&&(_e=it[0].constructor);let tt=new _e(et),rt=_e===Array?arraySet:typedSet;for(let nt=-1,ot=0;++nt<_;)ot=rt(it[nt],tt,ot);return tt}getInternal({_chunks:s},_,_e){return s[_].get(_e)}isValidInternal({_chunks:s},_,_e){return s[_].isValid(_e)}indexOfInternal({_chunks:s},_,_e,et){let it=_-1,tt=s.length,rt=_e,nt=0,ot=-1;for(;++it<tt;){if(~(ot=s[it].indexOf(et,rt)))return nt+ot;rt=0,nt+=s[it].length}return-1}_sliceInternal(s,_,_e){const et=[],{chunks:it,_chunkOffsets:tt}=s;for(let rt=-1,nt=it.length;++rt<nt;){const ot=it[rt],st=ot.length,at=tt[rt];if(at>=_e)break;if(_>=at+st)continue;if(at>=_&&at+st<=_e){et.push(ot);continue}const lt=Math.max(0,_-at),ct=Math.min(_e-at,st);et.push(ot.slice(lt,ct))}return s.clone(et)}}function calculateOffsets(o){let s=new Uint32Array((o||[]).length+1),_=s[0]=0,_e=s.length;for(let et=0;++et<_e;)s[et]=_+=o[et-1].length;return s}const typedSet=(o,s,_)=>(s.set(o,_),_+o.length),arraySet=(o,s,_)=>{let _e=_;for(let et=-1,it=o.length;++et<it;)s[_e++]=o[et];return _e};class Column extends Chunked{constructor(s,_=[],_e){if(_=Chunked.flatten(..._),super(s.type,_,_e),this._field=s,_.length===1&&!(this instanceof SingleChunkColumn))return new SingleChunkColumn(s,_[0],this._chunkOffsets)}static new(s,_,..._e){const et=Chunked.flatten(Array.isArray(_)?[..._,..._e]:_ instanceof AbstractVector?[_,..._e]:[AbstractVector.new(_,..._e)]);if(typeof s=="string"){const it=et[0].data.type;s=new Field(s,it,!0)}else!s.nullable&&et.some(({nullCount:it})=>it>0)&&(s=s.clone({nullable:!0}));return new Column(s,et)}get field(){return this._field}get name(){return this._field.name}get nullable(){return this._field.nullable}get metadata(){return this._field.metadata}clone(s=this._chunks){return new Column(this._field,s)}getChildAt(s){if(s<0||s>=this.numChildren)return null;let _=this._children||(this._children=[]),_e,et,it;return(_e=_[s])?_e:(et=(this.type.children||[])[s])&&(it=this._chunks.map(tt=>tt.getChildAt(s)).filter(tt=>tt!=null),it.length>0)?_[s]=new Column(et,it):null}}class SingleChunkColumn extends Column{constructor(s,_,_e){super(s,[_],_e),this._chunk=_}search(s,_){return _?_(this,0,s):[0,s]}isValid(s){return this._chunk.isValid(s)}get(s){return this._chunk.get(s)}set(s,_){this._chunk.set(s,_)}indexOf(s,_){return this._chunk.indexOf(s,_)}}const isArray$1=Array.isArray,selectArgs=(o,s)=>_selectArgs(o,s,[],0),selectColumnArgs=o=>{const[s,_]=_selectFieldArgs(o,[[],[]]);return _.map((_e,et)=>_e instanceof Column?Column.new(_e.field.clone(s[et]),_e):_e instanceof AbstractVector?Column.new(s[et],_e):Column.new(s[et],[]))},selectFieldArgs=o=>_selectFieldArgs(o,[[],[]]),selectChunkArgs=(o,s)=>_selectChunkArgs(o,s,[],0),selectVectorChildrenArgs=(o,s)=>_selectVectorChildrenArgs(o,s,[],0);function _selectArgs(o,s,_,_e){let et,it=_e,tt=-1,rt=s.length;for(;++tt<rt;)isArray$1(et=s[tt])?it=_selectArgs(o,et,_,it).length:et instanceof o&&(_[it++]=et);return _}function _selectChunkArgs(o,s,_,_e){let et,it=_e,tt=-1,rt=s.length;for(;++tt<rt;)isArray$1(et=s[tt])?it=_selectChunkArgs(o,et,_,it).length:et instanceof Chunked?it=_selectChunkArgs(o,et.chunks,_,it).length:et instanceof o&&(_[it++]=et);return _}function _selectVectorChildrenArgs(o,s,_,_e){let et,it=_e,tt=-1,rt=s.length;for(;++tt<rt;)isArray$1(et=s[tt])?it=_selectVectorChildrenArgs(o,et,_,it).length:et instanceof o?it=_selectArgs(AbstractVector,et.schema.fields.map((nt,ot)=>et.getChildAt(ot)),_,it).length:et instanceof AbstractVector&&(_[it++]=et);return _}const toKeysAndValues=(o,[s,_],_e)=>(o[0][_e]=s,o[1][_e]=_,o);function _selectFieldArgs(o,s){let _,_e;switch(_e=o.length){case 0:return s;case 1:if(_=s[0],!o[0])return s;if(isArray$1(o[0]))return _selectFieldArgs(o[0],s);o[0]instanceof Data||o[0]instanceof AbstractVector||o[0]instanceof DataType||([_,o]=Object.entries(o[0]).reduce(toKeysAndValues,s));break;default:isArray$1(_=o[_e-1])?o=isArray$1(o[0])?o[0]:o.slice(0,_e-1):(o=isArray$1(o[0])?o[0]:o,_=[])}let et=-1,it=-1,tt=-1,rt=o.length,nt,ot,[st,at]=s;for(;++tt<rt;)ot=o[tt],ot instanceof Column&&(at[++it]=ot)?st[++et]=ot.field.clone(_[tt],ot.type,!0):({[tt]:nt=tt}=_,ot instanceof DataType&&(at[++it]=ot)?st[++et]=Field.new(nt,ot,!0):ot&&ot.type&&(at[++it]=ot)&&(ot instanceof Data&&(at[it]=ot=AbstractVector.new(ot)),st[++et]=Field.new(nt,ot.type,!0)));return s}class Schema{constructor(s=[],_,_e){this.fields=s||[],this.metadata=_||new Map,_e||(_e=generateDictionaryMap(s)),this.dictionaries=_e}static from(...s){return Schema.new(s[0],s[1])}static new(...s){return new Schema(selectFieldArgs(s)[0])}get[Symbol.toStringTag](){return"Schema"}toString(){return`Schema<{ ${this.fields.map((s,_)=>`${_}: ${s}`).join(", ")} }>`}compareTo(s){return instance$9.compareSchemas(this,s)}select(...s){const _=s.reduce((_e,et)=>(_e[et]=!0)&&_e,Object.create(null));return new Schema(this.fields.filter(_e=>_[_e.name]),this.metadata)}selectAt(...s){return new Schema(s.map(_=>this.fields[_]).filter(Boolean),this.metadata)}assign(...s){const _=s[0]instanceof Schema?s[0]:new Schema(selectArgs(Field,s)),_e=[...this.fields],et=mergeMaps(mergeMaps(new Map,this.metadata),_.metadata),it=_.fields.filter(rt=>{const nt=_e.findIndex(ot=>ot.name===rt.name);return~nt?(_e[nt]=rt.clone({metadata:mergeMaps(mergeMaps(new Map,_e[nt].metadata),rt.metadata)}))&&!1:!0}),tt=generateDictionaryMap(it,new Map);return new Schema([..._e,...it],et,new Map([...this.dictionaries,...tt]))}}class Field{constructor(s,_,_e=!1,et){this.name=s,this.type=_,this.nullable=_e,this.metadata=et||new Map}static new(...s){let[_,_e,et,it]=s;return s[0]&&typeof s[0]=="object"&&({name:_}=s[0],_e===void 0&&(_e=s[0].type),et===void 0&&(et=s[0].nullable),it===void 0&&(it=s[0].metadata)),new Field(`${_}`,_e,et,it)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}compareTo(s){return instance$9.compareField(this,s)}clone(...s){let[_,_e,et,it]=s;return!s[0]||typeof s[0]!="object"?[_=this.name,_e=this.type,et=this.nullable,it=this.metadata]=s:{name:_=this.name,type:_e=this.type,nullable:et=this.nullable,metadata:it=this.metadata}=s[0],Field.new(_,_e,et,it)}}function mergeMaps(o,s){return new Map([...o||new Map,...s||new Map])}function generateDictionaryMap(o,s=new Map){for(let _=-1,_e=o.length;++_<_e;){const it=o[_].type;if(DataType.isDictionary(it)){if(!s.has(it.id))s.set(it.id,it.dictionary);else if(s.get(it.id)!==it.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}it.children&&it.children.length>0&&generateDictionaryMap(it.children,s)}return s}Schema.prototype.fields=null;Schema.prototype.metadata=null;Schema.prototype.dictionaries=null;Field.prototype.type=null;Field.prototype.name=null;Field.prototype.nullable=null;Field.prototype.metadata=null;class ListBuilder extends VariableWidthBuilder{constructor(s){super(s),this._run=new Run,this._offsets=new OffsetsBufferBuilder}addChild(s,_="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=s,this.type=new List$1(new Field(_,s.type,!0)),this.numChildren-1}clear(){return this._run.clear(),super.clear()}_flushPending(s){const _=this._run,_e=this._offsets,et=this._setValue;let it=0,tt;for([it,tt]of s)tt===void 0?_e.set(it,0):(_e.set(it,tt.length),et(this,it,_.bind(tt)))}}class FixedSizeListBuilder extends Builder$2{constructor(){super(...arguments),this._run=new Run}setValue(s,_){super.setValue(s,this._run.bind(_))}addChild(s,_="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");const _e=this.children.push(s);return this.type=new FixedSizeList$1(this.type.listSize,new Field(_,s.type,!0)),_e}clear(){return this._run.clear(),super.clear()}}class MapBuilder extends VariableWidthBuilder{set(s,_){return super.set(s,_)}setValue(s,_){_=_ instanceof Map?_:new Map(Object.entries(_));const _e=this._pending||(this._pending=new Map),et=_e.get(s);et&&(this._pendingLength-=et.size),this._pendingLength+=_.size,_e.set(s,_)}addChild(s,_=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=s,this.type=new Map_$1(new Field(_,s.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(s){const _=this._offsets,_e=this._setValue;s.forEach((et,it)=>{et===void 0?_.set(it,0):(_.set(it,et.size),_e(this,it,et))})}}class StructBuilder extends Builder$2{addChild(s,_=`${this.numChildren}`){const _e=this.children.push(s);return this.type=new Struct$1([...this.type.children,new Field(_,s.type,!0)]),_e}}class UnionBuilder extends Builder$2{constructor(s){super(s),this._typeIds=new DataBufferBuilder(new Int8Array(0),1),typeof s.valueToChildTypeId=="function"&&(this._valueToChildTypeId=s.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(s,_){return this.set(this.length,s,_)}set(s,_,_e){return _e===void 0&&(_e=this._valueToChildTypeId(this,_,s)),this.setValid(s,this.isValid(_))&&this.setValue(s,_,_e),this}setValue(s,_,_e){this._typeIds.set(s,_e),super.setValue(s,_)}addChild(s,_=`${this.children.length}`){const _e=this.children.push(s),{type:{children:et,mode:it,typeIds:tt}}=this,rt=[...et,new Field(_,s.type)];return this.type=new Union_(it,[...tt,_e],rt),_e}_valueToChildTypeId(s,_,_e){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}}class SparseUnionBuilder extends UnionBuilder{}class DenseUnionBuilder extends UnionBuilder{constructor(s){super(s),this._offsets=new DataBufferBuilder(new Int32Array(0))}setValue(s,_,_e){const et=this.type.typeIdToChildIndex[_e];return this._offsets.set(s,this.getChildAt(et).length),super.setValue(s,_,_e)}}class SetVisitor extends Visitor{}const setEpochMsToDays=(o,s,_)=>{o[s]=_/864e5|0},setEpochMsToMillisecondsLong=(o,s,_)=>{o[s]=_%4294967296|0,o[s+1]=_/4294967296|0},setEpochMsToMicrosecondsLong=(o,s,_)=>{o[s]=_*1e3%4294967296|0,o[s+1]=_*1e3/4294967296|0},setEpochMsToNanosecondsLong=(o,s,_)=>{o[s]=_*1e6%4294967296|0,o[s+1]=_*1e6/4294967296|0},setVariableWidthBytes=(o,s,_,_e)=>{const{[_]:et,[_+1]:it}=s;et!=null&&it!=null&&o.set(_e.subarray(0,it-et),et)},setBool=({offset:o,values:s},_,_e)=>{const et=o+_;_e?s[et>>3]|=1<<et%8:s[et>>3]&=~(1<<et%8)},setDateDay=({values:o},s,_)=>{setEpochMsToDays(o,s,_.valueOf())},setDateMillisecond=({values:o},s,_)=>{setEpochMsToMillisecondsLong(o,s*2,_.valueOf())},setNumeric=({stride:o,values:s},_,_e)=>{s[o*_]=_e},setFloat16=({stride:o,values:s},_,_e)=>{s[o*_]=float64ToUint16(_e)},setNumericX2=(o,s,_)=>{switch(typeof _){case"bigint":o.values64[s]=_;break;case"number":o.values[s*o.stride]=_;break;default:const _e=_,{stride:et,ArrayType:it}=o,tt=toArrayBufferView(it,_e);o.values.set(tt.subarray(0,et),et*s)}},setFixedSizeBinary=({stride:o,values:s},_,_e)=>{s.set(_e.subarray(0,o),o*_)},setBinary=({values:o,valueOffsets:s},_,_e)=>setVariableWidthBytes(o,s,_,_e),setUtf8=({values:o,valueOffsets:s},_,_e)=>{setVariableWidthBytes(o,s,_,encodeUtf8(_e))},setInt=(o,s,_)=>{o.type.bitWidth<64?setNumeric(o,s,_):setNumericX2(o,s,_)},setFloat=(o,s,_)=>{o.type.precision!==Precision.HALF?setNumeric(o,s,_):setFloat16(o,s,_)},setDate=(o,s,_)=>{o.type.unit===DateUnit.DAY?setDateDay(o,s,_):setDateMillisecond(o,s,_)},setTimestampSecond=({values:o},s,_)=>setEpochMsToMillisecondsLong(o,s*2,_/1e3),setTimestampMillisecond=({values:o},s,_)=>setEpochMsToMillisecondsLong(o,s*2,_),setTimestampMicrosecond=({values:o},s,_)=>setEpochMsToMicrosecondsLong(o,s*2,_),setTimestampNanosecond=({values:o},s,_)=>setEpochMsToNanosecondsLong(o,s*2,_),setTimestamp=(o,s,_)=>{switch(o.type.unit){case TimeUnit.SECOND:return setTimestampSecond(o,s,_);case TimeUnit.MILLISECOND:return setTimestampMillisecond(o,s,_);case TimeUnit.MICROSECOND:return setTimestampMicrosecond(o,s,_);case TimeUnit.NANOSECOND:return setTimestampNanosecond(o,s,_)}},setTimeSecond=({values:o,stride:s},_,_e)=>{o[s*_]=_e},setTimeMillisecond=({values:o,stride:s},_,_e)=>{o[s*_]=_e},setTimeMicrosecond=({values:o},s,_)=>{o.set(_.subarray(0,2),2*s)},setTimeNanosecond=({values:o},s,_)=>{o.set(_.subarray(0,2),2*s)},setTime=(o,s,_)=>{switch(o.type.unit){case TimeUnit.SECOND:return setTimeSecond(o,s,_);case TimeUnit.MILLISECOND:return setTimeMillisecond(o,s,_);case TimeUnit.MICROSECOND:return setTimeMicrosecond(o,s,_);case TimeUnit.NANOSECOND:return setTimeNanosecond(o,s,_)}},setDecimal=({values:o},s,_)=>{o.set(_.subarray(0,4),4*s)},setList=(o,s,_)=>{const _e=o.getChildAt(0),et=o.valueOffsets;for(let it=-1,tt=et[s],rt=et[s+1];tt<rt;)_e.set(tt++,_.get(++it))},setMap=(o,s,_)=>{const _e=o.getChildAt(0),et=o.valueOffsets,it=_ instanceof Map?[..._]:Object.entries(_);for(let tt=-1,rt=et[s],nt=et[s+1];rt<nt;)_e.set(rt++,it[++tt])},_setStructArrayValue=(o,s)=>(_,_e,et)=>_&&_.set(o,s[et]),_setStructVectorValue=(o,s)=>(_,_e,et)=>_&&_.set(o,s.get(et)),_setStructMapValue=(o,s)=>(_,_e,et)=>_&&_.set(o,s.get(_e.name)),_setStructObjectValue=(o,s)=>(_,_e,et)=>_&&_.set(o,s[_e.name]),setStruct=(o,s,_)=>{const _e=_ instanceof Map?_setStructMapValue(s,_):_ instanceof AbstractVector?_setStructVectorValue(s,_):Array.isArray(_)?_setStructArrayValue(s,_):_setStructObjectValue(s,_);o.type.children.forEach((et,it)=>_e(o.getChildAt(it),et,it))},setUnion=(o,s,_)=>{o.type.mode===UnionMode.Dense?setDenseUnion(o,s,_):setSparseUnion(o,s,_)},setDenseUnion=(o,s,_)=>{const _e=o.typeIdToChildIndex[o.typeIds[s]],et=o.getChildAt(_e);et&&et.set(o.valueOffsets[s],_)},setSparseUnion=(o,s,_)=>{const _e=o.typeIdToChildIndex[o.typeIds[s]],et=o.getChildAt(_e);et&&et.set(s,_)},setDictionary=(o,s,_)=>{const _e=o.getKey(s);_e!==null&&o.setValue(_e,_)},setIntervalValue=(o,s,_)=>{o.type.unit===IntervalUnit.DAY_TIME?setIntervalDayTime(o,s,_):setIntervalYearMonth(o,s,_)},setIntervalDayTime=({values:o},s,_)=>{o.set(_.subarray(0,2),2*s)},setIntervalYearMonth=({values:o},s,_)=>{o[s]=_[0]*12+_[1]%12},setFixedSizeList=(o,s,_)=>{const _e=o.getChildAt(0),{stride:et}=o;for(let it=-1,tt=s*et;++it<et;)_e.set(tt+it,_.get(it))};SetVisitor.prototype.visitBool=setBool;SetVisitor.prototype.visitInt=setInt;SetVisitor.prototype.visitInt8=setNumeric;SetVisitor.prototype.visitInt16=setNumeric;SetVisitor.prototype.visitInt32=setNumeric;SetVisitor.prototype.visitInt64=setNumericX2;SetVisitor.prototype.visitUint8=setNumeric;SetVisitor.prototype.visitUint16=setNumeric;SetVisitor.prototype.visitUint32=setNumeric;SetVisitor.prototype.visitUint64=setNumericX2;SetVisitor.prototype.visitFloat=setFloat;SetVisitor.prototype.visitFloat16=setFloat16;SetVisitor.prototype.visitFloat32=setNumeric;SetVisitor.prototype.visitFloat64=setNumeric;SetVisitor.prototype.visitUtf8=setUtf8;SetVisitor.prototype.visitBinary=setBinary;SetVisitor.prototype.visitFixedSizeBinary=setFixedSizeBinary;SetVisitor.prototype.visitDate=setDate;SetVisitor.prototype.visitDateDay=setDateDay;SetVisitor.prototype.visitDateMillisecond=setDateMillisecond;SetVisitor.prototype.visitTimestamp=setTimestamp;SetVisitor.prototype.visitTimestampSecond=setTimestampSecond;SetVisitor.prototype.visitTimestampMillisecond=setTimestampMillisecond;SetVisitor.prototype.visitTimestampMicrosecond=setTimestampMicrosecond;SetVisitor.prototype.visitTimestampNanosecond=setTimestampNanosecond;SetVisitor.prototype.visitTime=setTime;SetVisitor.prototype.visitTimeSecond=setTimeSecond;SetVisitor.prototype.visitTimeMillisecond=setTimeMillisecond;SetVisitor.prototype.visitTimeMicrosecond=setTimeMicrosecond;SetVisitor.prototype.visitTimeNanosecond=setTimeNanosecond;SetVisitor.prototype.visitDecimal=setDecimal;SetVisitor.prototype.visitList=setList;SetVisitor.prototype.visitStruct=setStruct;SetVisitor.prototype.visitUnion=setUnion;SetVisitor.prototype.visitDenseUnion=setDenseUnion;SetVisitor.prototype.visitSparseUnion=setSparseUnion;SetVisitor.prototype.visitDictionary=setDictionary;SetVisitor.prototype.visitInterval=setIntervalValue;SetVisitor.prototype.visitIntervalDayTime=setIntervalDayTime;SetVisitor.prototype.visitIntervalYearMonth=setIntervalYearMonth;SetVisitor.prototype.visitFixedSizeList=setFixedSizeList;SetVisitor.prototype.visitMap=setMap;const instance$8=new SetVisitor;class GetBuilderCtor extends Visitor{visitNull(){return NullBuilder}visitBool(){return BoolBuilder}visitInt(){return IntBuilder}visitInt8(){return Int8Builder}visitInt16(){return Int16Builder}visitInt32(){return Int32Builder}visitInt64(){return Int64Builder}visitUint8(){return Uint8Builder}visitUint16(){return Uint16Builder}visitUint32(){return Uint32Builder}visitUint64(){return Uint64Builder}visitFloat(){return FloatBuilder}visitFloat16(){return Float16Builder}visitFloat32(){return Float32Builder}visitFloat64(){return Float64Builder}visitUtf8(){return Utf8Builder}visitBinary(){return BinaryBuilder}visitFixedSizeBinary(){return FixedSizeBinaryBuilder}visitDate(){return DateBuilder}visitDateDay(){return DateDayBuilder}visitDateMillisecond(){return DateMillisecondBuilder}visitTimestamp(){return TimestampBuilder}visitTimestampSecond(){return TimestampSecondBuilder}visitTimestampMillisecond(){return TimestampMillisecondBuilder}visitTimestampMicrosecond(){return TimestampMicrosecondBuilder}visitTimestampNanosecond(){return TimestampNanosecondBuilder}visitTime(){return TimeBuilder}visitTimeSecond(){return TimeSecondBuilder}visitTimeMillisecond(){return TimeMillisecondBuilder}visitTimeMicrosecond(){return TimeMicrosecondBuilder}visitTimeNanosecond(){return TimeNanosecondBuilder}visitDecimal(){return DecimalBuilder}visitList(){return ListBuilder}visitStruct(){return StructBuilder}visitUnion(){return UnionBuilder}visitDenseUnion(){return DenseUnionBuilder}visitSparseUnion(){return SparseUnionBuilder}visitDictionary(){return DictionaryBuilder}visitInterval(){return IntervalBuilder}visitIntervalDayTime(){return IntervalDayTimeBuilder}visitIntervalYearMonth(){return IntervalYearMonthBuilder}visitFixedSizeList(){return FixedSizeListBuilder}visitMap(){return MapBuilder}}const instance$7=new GetBuilderCtor;Builder$2.new=newBuilder;function newBuilder(o){const s=o.type,_=new(instance$7.getVisitFn(s)())(o);if(s.children&&s.children.length>0){const _e=o.children||[],et={nullValues:o.nullValues},it=Array.isArray(_e)?(tt,rt)=>_e[rt]||et:({name:tt})=>_e[tt]||et;s.children.forEach((tt,rt)=>{const{type:nt}=tt,ot=it(tt,rt);_.children.push(newBuilder(Tr(or({},ot),{type:nt})))})}return _}Object.keys(Type$1).map(o=>Type$1[o]).filter(o=>typeof o=="number"&&o!==Type$1.NONE).forEach(o=>{const s=instance$7.visit(o);s.prototype._setValue=instance$8.getVisitFn(o)});Utf8Builder.prototype._setValue=instance$8.visitBinary;var org;(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}static getRootAsFooter(tt,rt){return(rt||new et).__init(tt.readInt32(tt.position())+tt.position(),tt)}version(){let tt=this.bb.__offset(this.bb_pos,4);return tt?this.bb.readInt16(this.bb_pos+tt):org$2.apache.arrow.flatbuf.MetadataVersion.V1}schema(tt){let rt=this.bb.__offset(this.bb_pos,6);return rt?(tt||new org$2.apache.arrow.flatbuf.Schema).__init(this.bb.__indirect(this.bb_pos+rt),this.bb):null}dictionaries(tt,rt){let nt=this.bb.__offset(this.bb_pos,8);return nt?(rt||new o.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+nt)+tt*24,this.bb):null}dictionariesLength(){let tt=this.bb.__offset(this.bb_pos,8);return tt?this.bb.__vector_len(this.bb_pos+tt):0}recordBatches(tt,rt){let nt=this.bb.__offset(this.bb_pos,10);return nt?(rt||new o.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+nt)+tt*24,this.bb):null}recordBatchesLength(){let tt=this.bb.__offset(this.bb_pos,10);return tt?this.bb.__vector_len(this.bb_pos+tt):0}static startFooter(tt){tt.startObject(4)}static addVersion(tt,rt){tt.addFieldInt16(0,rt,org$2.apache.arrow.flatbuf.MetadataVersion.V1)}static addSchema(tt,rt){tt.addFieldOffset(1,rt,0)}static addDictionaries(tt,rt){tt.addFieldOffset(2,rt,0)}static startDictionariesVector(tt,rt){tt.startVector(24,rt,8)}static addRecordBatches(tt,rt){tt.addFieldOffset(3,rt,0)}static startRecordBatchesVector(tt,rt){tt.startVector(24,rt,8)}static endFooter(tt){return tt.endObject()}static finishFooterBuffer(tt,rt){tt.finish(rt)}static createFooter(tt,rt,nt,ot,st){return et.startFooter(tt),et.addVersion(tt,rt),et.addSchema(tt,nt),et.addDictionaries(tt,ot),et.addRecordBatches(tt,st),et.endFooter(tt)}}_e.Footer=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org||(org={}));(function(o){(function(s){(function(_){(function(_e){class et{constructor(){this.bb=null,this.bb_pos=0}__init(tt,rt){return this.bb_pos=tt,this.bb=rt,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static createBlock(tt,rt,nt,ot){return tt.prep(8,24),tt.writeInt64(ot),tt.pad(4),tt.writeInt32(nt),tt.writeInt64(rt),tt.offset()}}_e.Block=et})(_.flatbuf||(_.flatbuf={}))})(s.arrow||(s.arrow={}))})(o.apache||(o.apache={}))})(org||(org={}));var Long$2=flatbuffers.Long,Builder$1=flatbuffers.Builder,ByteBuffer$2=flatbuffers.ByteBuffer,_Block=org.apache.arrow.flatbuf.Block,_Footer=org.apache.arrow.flatbuf.Footer;class Footer_{constructor(s,_=MetadataVersion.V4,_e,et){this.schema=s,this.version=_,_e&&(this._recordBatches=_e),et&&(this._dictionaryBatches=et)}static decode(s){s=new ByteBuffer$2(toUint8Array(s));const _=_Footer.getRootAsFooter(s),_e=Schema.decode(_.schema());return new OffHeapFooter(_e,_)}static encode(s){const _=new Builder$1,_e=Schema.encode(_,s.schema);_Footer.startRecordBatchesVector(_,s.numRecordBatches),[...s.recordBatches()].slice().reverse().forEach(tt=>FileBlock.encode(_,tt));const et=_.endVector();_Footer.startDictionariesVector(_,s.numDictionaries),[...s.dictionaryBatches()].slice().reverse().forEach(tt=>FileBlock.encode(_,tt));const it=_.endVector();return _Footer.startFooter(_),_Footer.addSchema(_,_e),_Footer.addVersion(_,MetadataVersion.V4),_Footer.addRecordBatches(_,et),_Footer.addDictionaries(_,it),_Footer.finishFooterBuffer(_,_Footer.endFooter(_)),_.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let s,_=-1,_e=this.numRecordBatches;++_<_e;)(s=this.getRecordBatch(_))&&(yield s)}*dictionaryBatches(){for(let s,_=-1,_e=this.numDictionaries;++_<_e;)(s=this.getDictionaryBatch(_))&&(yield s)}getRecordBatch(s){return s>=0&&s<this.numRecordBatches&&this._recordBatches[s]||null}getDictionaryBatch(s){return s>=0&&s<this.numDictionaries&&this._dictionaryBatches[s]||null}}class OffHeapFooter extends Footer_{constructor(s,_){super(s,_.version()),this._footer=_}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(s){if(s>=0&&s<this.numRecordBatches){const _=this._footer.recordBatches(s);if(_)return FileBlock.decode(_)}return null}getDictionaryBatch(s){if(s>=0&&s<this.numDictionaries){const _=this._footer.dictionaries(s);if(_)return FileBlock.decode(_)}return null}}class FileBlock{static decode(s){return new FileBlock(s.metaDataLength(),s.bodyLength(),s.offset())}static encode(s,_){const{metaDataLength:_e}=_,et=new Long$2(_.offset,0),it=new Long$2(_.bodyLength,0);return _Block.createBlock(s,et,_e,it)}constructor(s,_,_e){this.metaDataLength=s,this.offset=typeof _e=="number"?_e:_e.low,this.bodyLength=typeof _=="number"?_:_.low}}class AsyncByteQueue extends AsyncQueue{write(s){if((s=toUint8Array(s)).byteLength>0)return super.write(s)}toString(s=!1){return s?decodeUtf8(this.toUint8Array(!0)):this.toUint8Array(!1).then(decodeUtf8)}toUint8Array(s=!1){return s?joinUint8Arrays(this._values)[0]:(async()=>{let _=[],_e=0;for await(const et of this)_.push(et),_e+=et.byteLength;return joinUint8Arrays(_,_e)[0]})()}}class ByteStream{constructor(s){s&&(this.source=new ByteStreamSource(streamAdapters.fromIterable(s)))}[Symbol.iterator](){return this}next(s){return this.source.next(s)}throw(s){return this.source.throw(s)}return(s){return this.source.return(s)}peek(s){return this.source.peek(s)}read(s){return this.source.read(s)}}class AsyncByteStream{constructor(s){s instanceof AsyncByteStream?this.source=s.source:s instanceof AsyncByteQueue?this.source=new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(s)):isReadableNodeStream(s)?this.source=new AsyncByteStreamSource(streamAdapters.fromNodeStream(s)):isReadableDOMStream(s)?this.source=new AsyncByteStreamSource(streamAdapters.fromDOMStream(s)):isFetchResponse(s)?this.source=new AsyncByteStreamSource(streamAdapters.fromDOMStream(s.body)):isIterable(s)?this.source=new AsyncByteStreamSource(streamAdapters.fromIterable(s)):isPromise(s)?this.source=new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(s)):isAsyncIterable(s)&&(this.source=new AsyncByteStreamSource(streamAdapters.fromAsyncIterable(s)))}[Symbol.asyncIterator](){return this}next(s){return this.source.next(s)}throw(s){return this.source.throw(s)}return(s){return this.source.return(s)}get closed(){return this.source.closed}cancel(s){return this.source.cancel(s)}peek(s){return this.source.peek(s)}read(s){return this.source.read(s)}}class ByteStreamSource{constructor(s){this.source=s}cancel(s){this.return(s)}peek(s){return this.next(s,"peek").value}read(s){return this.next(s,"read").value}next(s,_="read"){return this.source.next({cmd:_,size:s})}throw(s){return Object.create(this.source.throw&&this.source.throw(s)||ITERATOR_DONE)}return(s){return Object.create(this.source.return&&this.source.return(s)||ITERATOR_DONE)}}class AsyncByteStreamSource{constructor(s){this.source=s,this._closedPromise=new Promise(_=>this._closedPromiseResolve=_)}async cancel(s){await this.return(s)}get closed(){return this._closedPromise}async read(s){return(await this.next(s,"read")).value}async peek(s){return(await this.next(s,"peek")).value}async next(s,_="read"){return await this.source.next({cmd:_,size:s})}async throw(s){const _=this.source.throw&&await this.source.throw(s)||ITERATOR_DONE;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(_)}async return(s){const _=this.source.return&&await this.source.return(s)||ITERATOR_DONE;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(_)}}class RandomAccessFile extends ByteStream{constructor(s,_){super(),this.position=0,this.buffer=toUint8Array(s),this.size=typeof _=="undefined"?this.buffer.byteLength:_}readInt32(s){const{buffer:_,byteOffset:_e}=this.readAt(s,4);return new DataView(_,_e).getInt32(0,!0)}seek(s){return this.position=Math.min(s,this.size),s<this.size}read(s){const{buffer:_,size:_e,position:et}=this;return _&&et<_e?(typeof s!="number"&&(s=1/0),this.position=Math.min(_e,et+Math.min(_e-et,s)),_.subarray(et,this.position)):null}readAt(s,_){const _e=this.buffer,et=Math.min(this.size,s+_);return _e?_e.subarray(s,et):new Uint8Array(_)}close(){this.buffer&&(this.buffer=null)}throw(s){return this.close(),{done:!0,value:s}}return(s){return this.close(),{done:!0,value:s}}}class AsyncRandomAccessFile extends AsyncByteStream{constructor(s,_){super(),this.position=0,this._handle=s,typeof _=="number"?this.size=_:this._pending=(async()=>{this.size=(await s.stat()).size,delete this._pending})()}async readInt32(s){const{buffer:_,byteOffset:_e}=await this.readAt(s,4);return new DataView(_,_e).getInt32(0,!0)}async seek(s){return this._pending&&await this._pending,this.position=Math.min(s,this.size),s<this.size}async read(s){this._pending&&await this._pending;const{_handle:_,size:_e,position:et}=this;if(_&&et<_e){typeof s!="number"&&(s=1/0);let it=et,tt=0,rt=0,nt=Math.min(_e,it+Math.min(_e-it,s)),ot=new Uint8Array(Math.max(0,(this.position=nt)-it));for(;(it+=rt)<nt&&(tt+=rt)<ot.byteLength;)({bytesRead:rt}=await _.read(ot,tt,ot.byteLength-tt,it));return ot}return null}async readAt(s,_){this._pending&&await this._pending;const{_handle:_e,size:et}=this;if(_e&&s+_<et){const it=Math.min(et,s+_),tt=new Uint8Array(it-s);return(await _e.read(tt,0,_,s)).buffer}return new Uint8Array(_)}async close(){const s=this._handle;this._handle=null,s&&await s.close()}async throw(s){return await this.close(),{done:!0,value:s}}async return(s){return await this.close(),{done:!0,value:s}}}const carryBit16=1<<16;function intAsHex(o){return o<0&&(o=4294967295+o+1),`0x${o.toString(16)}`}const kInt32DecimalDigits=8,kPowersOfTen=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class BaseInt64{constructor(s){this.buffer=s}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(s){const _=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),_e=new Uint32Array([s.buffer[1]>>>16,s.buffer[1]&65535,s.buffer[0]>>>16,s.buffer[0]&65535]);let et=_[3]*_e[3];this.buffer[0]=et&65535;let it=et>>>16;return et=_[2]*_e[3],it+=et,et=_[3]*_e[2]>>>0,it+=et,this.buffer[0]+=it<<16,this.buffer[1]=it>>>0<et?carryBit16:0,this.buffer[1]+=it>>>16,this.buffer[1]+=_[1]*_e[3]+_[2]*_e[2]+_[3]*_e[1],this.buffer[1]+=_[0]*_e[3]+_[1]*_e[2]+_[2]*_e[1]+_[3]*_e[0]<<16,this}_plus(s){const _=this.buffer[0]+s.buffer[0]>>>0;this.buffer[1]+=s.buffer[1],_<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=_}lessThan(s){return this.buffer[1]<s.buffer[1]||this.buffer[1]===s.buffer[1]&&this.buffer[0]<s.buffer[0]}equals(s){return this.buffer[1]===s.buffer[1]&&this.buffer[0]==s.buffer[0]}greaterThan(s){return s.lessThan(this)}hex(){return`${intAsHex(this.buffer[1])} ${intAsHex(this.buffer[0])}`}}class Uint64 extends BaseInt64{times(s){return this._times(s),this}plus(s){return this._plus(s),this}static from(s,_=new Uint32Array(2)){return Uint64.fromString(typeof s=="string"?s:s.toString(),_)}static fromNumber(s,_=new Uint32Array(2)){return Uint64.fromString(s.toString(),_)}static fromString(s,_=new Uint32Array(2)){const _e=s.length;let et=new Uint64(_);for(let it=0;it<_e;){const tt=kInt32DecimalDigits<_e-it?kInt32DecimalDigits:_e-it,rt=new Uint64(new Uint32Array([parseInt(s.substr(it,tt),10),0])),nt=new Uint64(new Uint32Array([kPowersOfTen[tt],0]));et.times(nt),et.plus(rt),it+=tt}return et}static convertArray(s){const _=new Uint32Array(s.length*2);for(let _e=-1,et=s.length;++_e<et;)Uint64.from(s[_e],new Uint32Array(_.buffer,_.byteOffset+2*_e*4,2));return _}static multiply(s,_){return new Uint64(new Uint32Array(s.buffer)).times(_)}static add(s,_){return new Uint64(new Uint32Array(s.buffer)).plus(_)}}class Int64 extends BaseInt64{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(s){return this._times(s),this}plus(s){return this._plus(s),this}lessThan(s){const _=this.buffer[1]<<0,_e=s.buffer[1]<<0;return _<_e||_===_e&&this.buffer[0]<s.buffer[0]}static from(s,_=new Uint32Array(2)){return Int64.fromString(typeof s=="string"?s:s.toString(),_)}static fromNumber(s,_=new Uint32Array(2)){return Int64.fromString(s.toString(),_)}static fromString(s,_=new Uint32Array(2)){const _e=s.startsWith("-"),et=s.length;let it=new Int64(_);for(let tt=_e?1:0;tt<et;){const rt=kInt32DecimalDigits<et-tt?kInt32DecimalDigits:et-tt,nt=new Int64(new Uint32Array([parseInt(s.substr(tt,rt),10),0])),ot=new Int64(new Uint32Array([kPowersOfTen[rt],0]));it.times(ot),it.plus(nt),tt+=rt}return _e?it.negate():it}static convertArray(s){const _=new Uint32Array(s.length*2);for(let _e=-1,et=s.length;++_e<et;)Int64.from(s[_e],new Uint32Array(_.buffer,_.byteOffset+2*_e*4,2));return _}static multiply(s,_){return new Int64(new Uint32Array(s.buffer)).times(_)}static add(s,_){return new Int64(new Uint32Array(s.buffer)).plus(_)}}class Int128{constructor(s){this.buffer=s}high(){return new Int64(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Int64(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(s){const _=new Uint64(new Uint32Array([this.buffer[3],0])),_e=new Uint64(new Uint32Array([this.buffer[2],0])),et=new Uint64(new Uint32Array([this.buffer[1],0])),it=new Uint64(new Uint32Array([this.buffer[0],0])),tt=new Uint64(new Uint32Array([s.buffer[3],0])),rt=new Uint64(new Uint32Array([s.buffer[2],0])),nt=new Uint64(new Uint32Array([s.buffer[1],0])),ot=new Uint64(new Uint32Array([s.buffer[0],0]));let st=Uint64.multiply(it,ot);this.buffer[0]=st.low();let at=new Uint64(new Uint32Array([st.high(),0]));return st=Uint64.multiply(et,ot),at.plus(st),st=Uint64.multiply(it,nt),at.plus(st),this.buffer[1]=at.low(),this.buffer[3]=at.lessThan(st)?1:0,this.buffer[2]=at.high(),new Uint64(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Uint64.multiply(_e,ot)).plus(Uint64.multiply(et,nt)).plus(Uint64.multiply(it,rt)),this.buffer[3]+=Uint64.multiply(_,ot).plus(Uint64.multiply(_e,nt)).plus(Uint64.multiply(et,rt)).plus(Uint64.multiply(it,tt)).low(),this}plus(s){let _=new Uint32Array(4);return _[3]=this.buffer[3]+s.buffer[3]>>>0,_[2]=this.buffer[2]+s.buffer[2]>>>0,_[1]=this.buffer[1]+s.buffer[1]>>>0,_[0]=this.buffer[0]+s.buffer[0]>>>0,_[0]<this.buffer[0]>>>0&&++_[1],_[1]<this.buffer[1]>>>0&&++_[2],_[2]<this.buffer[2]>>>0&&++_[3],this.buffer[3]=_[3],this.buffer[2]=_[2],this.buffer[1]=_[1],this.buffer[0]=_[0],this}hex(){return`${intAsHex(this.buffer[3])} ${intAsHex(this.buffer[2])} ${intAsHex(this.buffer[1])} ${intAsHex(this.buffer[0])}`}static multiply(s,_){return new Int128(new Uint32Array(s.buffer)).times(_)}static add(s,_){return new Int128(new Uint32Array(s.buffer)).plus(_)}static from(s,_=new Uint32Array(4)){return Int128.fromString(typeof s=="string"?s:s.toString(),_)}static fromNumber(s,_=new Uint32Array(4)){return Int128.fromString(s.toString(),_)}static fromString(s,_=new Uint32Array(4)){const _e=s.startsWith("-"),et=s.length;let it=new Int128(_);for(let tt=_e?1:0;tt<et;){const rt=kInt32DecimalDigits<et-tt?kInt32DecimalDigits:et-tt,nt=new Int128(new Uint32Array([parseInt(s.substr(tt,rt),10),0,0,0])),ot=new Int128(new Uint32Array([kPowersOfTen[rt],0,0,0]));it.times(ot),it.plus(nt),tt+=rt}return _e?it.negate():it}static convertArray(s){const _=new Uint32Array(s.length*4);for(let _e=-1,et=s.length;++_e<et;)Int128.from(s[_e],new Uint32Array(_.buffer,_.byteOffset+4*4*_e,4));return _}}var util_int_=Object.freeze(Object.defineProperty({__proto__:null,BaseInt64,Uint64,Int64,Int128},Symbol.toStringTag,{value:"Module"}));class VectorLoader extends Visitor{constructor(s,_,_e,et){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=s,this.nodes=_,this.buffers=_e,this.dictionaries=et}visit(s){return super.visit(s instanceof Field?s.type:s)}visitNull(s,{length:_}=this.nextFieldNode()){return Data.Null(s,0,_)}visitBool(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Bool(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitInt(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Int(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitFloat(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Float(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitUtf8(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Utf8(s,0,_,_e,this.readNullBitmap(s,_e),this.readOffsets(s),this.readData(s))}visitBinary(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Binary(s,0,_,_e,this.readNullBitmap(s,_e),this.readOffsets(s),this.readData(s))}visitFixedSizeBinary(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.FixedSizeBinary(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitDate(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Date(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitTimestamp(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Timestamp(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitTime(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Time(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitDecimal(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Decimal(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitList(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.List(s,0,_,_e,this.readNullBitmap(s,_e),this.readOffsets(s),this.visit(s.children[0]))}visitStruct(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Struct(s,0,_,_e,this.readNullBitmap(s,_e),this.visitMany(s.children))}visitUnion(s){return s.mode===UnionMode.Sparse?this.visitSparseUnion(s):this.visitDenseUnion(s)}visitDenseUnion(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Union(s,0,_,_e,this.readNullBitmap(s,_e),this.readTypeIds(s),this.readOffsets(s),this.visitMany(s.children))}visitSparseUnion(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Union(s,0,_,_e,this.readNullBitmap(s,_e),this.readTypeIds(s),this.visitMany(s.children))}visitDictionary(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Dictionary(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s.indices),this.readDictionary(s))}visitInterval(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Interval(s,0,_,_e,this.readNullBitmap(s,_e),this.readData(s))}visitFixedSizeList(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.FixedSizeList(s,0,_,_e,this.readNullBitmap(s,_e),this.visit(s.children[0]))}visitMap(s,{length:_,nullCount:_e}=this.nextFieldNode()){return Data.Map(s,0,_,_e,this.readNullBitmap(s,_e),this.readOffsets(s),this.visit(s.children[0]))}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(s,_,_e=this.nextBufferRange()){return _>0&&this.readData(s,_e)||new Uint8Array(0)}readOffsets(s,_){return this.readData(s,_)}readTypeIds(s,_){return this.readData(s,_)}readData(s,{length:_,offset:_e}=this.nextBufferRange()){return this.bytes.subarray(_e,_e+_)}readDictionary(s){return this.dictionaries.get(s.id)}}class JSONVectorLoader extends VectorLoader{constructor(s,_,_e,et){super(new Uint8Array(0),_,_e,et),this.sources=s}readNullBitmap(s,_,{offset:_e}=this.nextBufferRange()){return _<=0?new Uint8Array(0):packBools(this.sources[_e])}readOffsets(s,{offset:_}=this.nextBufferRange()){return toArrayBufferView(Uint8Array,toArrayBufferView(Int32Array,this.sources[_]))}readTypeIds(s,{offset:_}=this.nextBufferRange()){return toArrayBufferView(Uint8Array,toArrayBufferView(s.ArrayType,this.sources[_]))}readData(s,{offset:_}=this.nextBufferRange()){const{sources:_e}=this;return DataType.isTimestamp(s)||(DataType.isInt(s)||DataType.isTime(s))&&s.bitWidth===64||DataType.isDate(s)&&s.unit===DateUnit.MILLISECOND?toArrayBufferView(Uint8Array,Int64.convertArray(_e[_])):DataType.isDecimal(s)?toArrayBufferView(Uint8Array,Int128.convertArray(_e[_])):DataType.isBinary(s)||DataType.isFixedSizeBinary(s)?binaryDataFromJSON(_e[_]):DataType.isBool(s)?packBools(_e[_]):DataType.isUtf8(s)?encodeUtf8(_e[_].join("")):toArrayBufferView(Uint8Array,toArrayBufferView(s.ArrayType,_e[_].map(et=>+et)))}}function binaryDataFromJSON(o){const s=o.join(""),_=new Uint8Array(s.length/2);for(let _e=0;_e<s.length;_e+=2)_[_e>>1]=parseInt(s.substr(_e,2),16);return _}var Long$1=flatbuffers.Long,Null=org$2.apache.arrow.flatbuf.Null,Int=org$2.apache.arrow.flatbuf.Int,FloatingPoint=org$2.apache.arrow.flatbuf.FloatingPoint,Binary=org$2.apache.arrow.flatbuf.Binary,Bool=org$2.apache.arrow.flatbuf.Bool,Utf8=org$2.apache.arrow.flatbuf.Utf8,Decimal=org$2.apache.arrow.flatbuf.Decimal,Date$1=org$2.apache.arrow.flatbuf.Date,Time=org$2.apache.arrow.flatbuf.Time,Timestamp=org$2.apache.arrow.flatbuf.Timestamp,Interval=org$2.apache.arrow.flatbuf.Interval,List=org$2.apache.arrow.flatbuf.List,Struct=org$2.apache.arrow.flatbuf.Struct_,Union=org$2.apache.arrow.flatbuf.Union,DictionaryEncoding=org$2.apache.arrow.flatbuf.DictionaryEncoding,FixedSizeBinary=org$2.apache.arrow.flatbuf.FixedSizeBinary,FixedSizeList=org$2.apache.arrow.flatbuf.FixedSizeList,Map_=org$2.apache.arrow.flatbuf.Map;class TypeAssembler extends Visitor{visit(s,_){return s==null||_==null?void 0:super.visit(s,_)}visitNull(s,_){return Null.startNull(_),Null.endNull(_)}visitInt(s,_){return Int.startInt(_),Int.addBitWidth(_,s.bitWidth),Int.addIsSigned(_,s.isSigned),Int.endInt(_)}visitFloat(s,_){return FloatingPoint.startFloatingPoint(_),FloatingPoint.addPrecision(_,s.precision),FloatingPoint.endFloatingPoint(_)}visitBinary(s,_){return Binary.startBinary(_),Binary.endBinary(_)}visitBool(s,_){return Bool.startBool(_),Bool.endBool(_)}visitUtf8(s,_){return Utf8.startUtf8(_),Utf8.endUtf8(_)}visitDecimal(s,_){return Decimal.startDecimal(_),Decimal.addScale(_,s.scale),Decimal.addPrecision(_,s.precision),Decimal.endDecimal(_)}visitDate(s,_){return Date$1.startDate(_),Date$1.addUnit(_,s.unit),Date$1.endDate(_)}visitTime(s,_){return Time.startTime(_),Time.addUnit(_,s.unit),Time.addBitWidth(_,s.bitWidth),Time.endTime(_)}visitTimestamp(s,_){const _e=s.timezone&&_.createString(s.timezone)||void 0;return Timestamp.startTimestamp(_),Timestamp.addUnit(_,s.unit),_e!==void 0&&Timestamp.addTimezone(_,_e),Timestamp.endTimestamp(_)}visitInterval(s,_){return Interval.startInterval(_),Interval.addUnit(_,s.unit),Interval.endInterval(_)}visitList(s,_){return List.startList(_),List.endList(_)}visitStruct(s,_){return Struct.startStruct_(_),Struct.endStruct_(_)}visitUnion(s,_){Union.startTypeIdsVector(_,s.typeIds.length);const _e=Union.createTypeIdsVector(_,s.typeIds);return Union.startUnion(_),Union.addMode(_,s.mode),Union.addTypeIds(_,_e),Union.endUnion(_)}visitDictionary(s,_){const _e=this.visit(s.indices,_);return DictionaryEncoding.startDictionaryEncoding(_),DictionaryEncoding.addId(_,new Long$1(s.id,0)),DictionaryEncoding.addIsOrdered(_,s.isOrdered),_e!==void 0&&DictionaryEncoding.addIndexType(_,_e),DictionaryEncoding.endDictionaryEncoding(_)}visitFixedSizeBinary(s,_){return FixedSizeBinary.startFixedSizeBinary(_),FixedSizeBinary.addByteWidth(_,s.byteWidth),FixedSizeBinary.endFixedSizeBinary(_)}visitFixedSizeList(s,_){return FixedSizeList.startFixedSizeList(_),FixedSizeList.addListSize(_,s.listSize),FixedSizeList.endFixedSizeList(_)}visitMap(s,_){return Map_.startMap(_),Map_.addKeysSorted(_,s.keysSorted),Map_.endMap(_)}}const instance$6=new TypeAssembler;function schemaFromJSON(o,s=new Map){return new Schema(schemaFieldsFromJSON(o,s),customMetadataFromJSON(o.customMetadata),s)}function recordBatchFromJSON(o){return new RecordBatch$1(o.count,fieldNodesFromJSON(o.columns),buffersFromJSON(o.columns))}function dictionaryBatchFromJSON(o){return new DictionaryBatch(recordBatchFromJSON(o.data),o.id,o.isDelta)}function schemaFieldsFromJSON(o,s){return(o.fields||[]).filter(Boolean).map(_=>Field.fromJSON(_,s))}function fieldChildrenFromJSON(o,s){return(o.children||[]).filter(Boolean).map(_=>Field.fromJSON(_,s))}function fieldNodesFromJSON(o){return(o||[]).reduce((s,_)=>[...s,new FieldNode(_.count,nullCountFromJSON(_.VALIDITY)),...fieldNodesFromJSON(_.children)],[])}function buffersFromJSON(o,s=[]){for(let _=-1,_e=(o||[]).length;++_<_e;){const et=o[_];et.VALIDITY&&s.push(new BufferRegion(s.length,et.VALIDITY.length)),et.TYPE&&s.push(new BufferRegion(s.length,et.TYPE.length)),et.OFFSET&&s.push(new BufferRegion(s.length,et.OFFSET.length)),et.DATA&&s.push(new BufferRegion(s.length,et.DATA.length)),s=buffersFromJSON(et.children,s)}return s}function nullCountFromJSON(o){return(o||[]).reduce((s,_)=>s+ +(_===0),0)}function fieldFromJSON(o,s){let _,_e,et,it,tt,rt;return!s||!(it=o.dictionary)?(tt=typeFromJSON(o,fieldChildrenFromJSON(o,s)),et=new Field(o.name,tt,o.nullable,customMetadataFromJSON(o.customMetadata))):s.has(_=it.id)?(_e=(_e=it.indexType)?indexTypeFromJSON(_e):new Int32,rt=new Dictionary(s.get(_),_e,_,it.isOrdered),et=new Field(o.name,rt,o.nullable,customMetadataFromJSON(o.customMetadata))):(_e=(_e=it.indexType)?indexTypeFromJSON(_e):new Int32,s.set(_,tt=typeFromJSON(o,fieldChildrenFromJSON(o,s))),rt=new Dictionary(tt,_e,_,it.isOrdered),et=new Field(o.name,rt,o.nullable,customMetadataFromJSON(o.customMetadata))),et||null}function customMetadataFromJSON(o){return new Map(Object.entries(o||{}))}function indexTypeFromJSON(o){return new Int_(o.isSigned,o.bitWidth)}function typeFromJSON(o,s){const _=o.type.name;switch(_){case"NONE":return new Null$1;case"null":return new Null$1;case"binary":return new Binary$1;case"utf8":return new Utf8$1;case"bool":return new Bool$1;case"list":return new List$1((s||[])[0]);case"struct":return new Struct$1(s||[]);case"struct_":return new Struct$1(s||[])}switch(_){case"int":{const _e=o.type;return new Int_(_e.isSigned,_e.bitWidth)}case"floatingpoint":{const _e=o.type;return new Float(Precision[_e.precision])}case"decimal":{const _e=o.type;return new Decimal$1(_e.scale,_e.precision)}case"date":{const _e=o.type;return new Date_(DateUnit[_e.unit])}case"time":{const _e=o.type;return new Time_(TimeUnit[_e.unit],_e.bitWidth)}case"timestamp":{const _e=o.type;return new Timestamp_(TimeUnit[_e.unit],_e.timezone)}case"interval":{const _e=o.type;return new Interval_(IntervalUnit[_e.unit])}case"union":{const _e=o.type;return new Union_(UnionMode[_e.mode],_e.typeIds||[],s||[])}case"fixedsizebinary":{const _e=o.type;return new FixedSizeBinary$1(_e.byteWidth)}case"fixedsizelist":{const _e=o.type;return new FixedSizeList$1(_e.listSize,(s||[])[0])}case"map":{const _e=o.type;return new Map_$1((s||[])[0],_e.keysSorted)}}throw new Error(`Unrecognized type: "${_}"`)}var Long=flatbuffers.Long,Builder=flatbuffers.Builder,ByteBuffer$1=flatbuffers.ByteBuffer,Type=org$2.apache.arrow.flatbuf.Type,_Field=org$2.apache.arrow.flatbuf.Field,_Schema=org$2.apache.arrow.flatbuf.Schema,_Buffer=org$2.apache.arrow.flatbuf.Buffer,_Message=org$1.apache.arrow.flatbuf.Message,_KeyValue=org$2.apache.arrow.flatbuf.KeyValue,_FieldNode=org$1.apache.arrow.flatbuf.FieldNode,_Endianness=org$2.apache.arrow.flatbuf.Endianness,_RecordBatch=org$1.apache.arrow.flatbuf.RecordBatch,_DictionaryBatch=org$1.apache.arrow.flatbuf.DictionaryBatch;class Message{constructor(s,_,_e,et){this._version=_,this._headerType=_e,this.body=new Uint8Array(0),et&&(this._createHeader=()=>et),this._bodyLength=typeof s=="number"?s:s.low}static fromJSON(s,_){const _e=new Message(0,MetadataVersion.V4,_);return _e._createHeader=messageHeaderFromJSON(s,_),_e}static decode(s){s=new ByteBuffer$1(toUint8Array(s));const _=_Message.getRootAsMessage(s),_e=_.bodyLength(),et=_.version(),it=_.headerType(),tt=new Message(_e,et,it);return tt._createHeader=decodeMessageHeader(_,it),tt}static encode(s){let _=new Builder,_e=-1;return s.isSchema()?_e=Schema.encode(_,s.header()):s.isRecordBatch()?_e=RecordBatch$1.encode(_,s.header()):s.isDictionaryBatch()&&(_e=DictionaryBatch.encode(_,s.header())),_Message.startMessage(_),_Message.addVersion(_,MetadataVersion.V4),_Message.addHeader(_,_e),_Message.addHeaderType(_,s.headerType),_Message.addBodyLength(_,new Long(s.bodyLength,0)),_Message.finishMessageBuffer(_,_Message.endMessage(_)),_.asUint8Array()}static from(s,_=0){if(s instanceof Schema)return new Message(0,MetadataVersion.V4,MessageHeader.Schema,s);if(s instanceof RecordBatch$1)return new Message(_,MetadataVersion.V4,MessageHeader.RecordBatch,s);if(s instanceof DictionaryBatch)return new Message(_,MetadataVersion.V4,MessageHeader.DictionaryBatch,s);throw new Error(`Unrecognized Message header: ${s}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===MessageHeader.Schema}isRecordBatch(){return this.headerType===MessageHeader.RecordBatch}isDictionaryBatch(){return this.headerType===MessageHeader.DictionaryBatch}}class RecordBatch$1{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(s,_,_e){this._nodes=_,this._buffers=_e,this._length=typeof s=="number"?s:s.low}}class DictionaryBatch{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(s,_,_e=!1){this._data=s,this._isDelta=_e,this._id=typeof _=="number"?_:_.low}}class BufferRegion{constructor(s,_){this.offset=typeof s=="number"?s:s.low,this.length=typeof _=="number"?_:_.low}}class FieldNode{constructor(s,_){this.length=typeof s=="number"?s:s.low,this.nullCount=typeof _=="number"?_:_.low}}function messageHeaderFromJSON(o,s){return()=>{switch(s){case MessageHeader.Schema:return Schema.fromJSON(o);case MessageHeader.RecordBatch:return RecordBatch$1.fromJSON(o);case MessageHeader.DictionaryBatch:return DictionaryBatch.fromJSON(o)}throw new Error(`Unrecognized Message type: { name: ${MessageHeader[s]}, type: ${s} }`)}}function decodeMessageHeader(o,s){return()=>{switch(s){case MessageHeader.Schema:return Schema.decode(o.header(new _Schema));case MessageHeader.RecordBatch:return RecordBatch$1.decode(o.header(new _RecordBatch),o.version());case MessageHeader.DictionaryBatch:return DictionaryBatch.decode(o.header(new _DictionaryBatch),o.version())}throw new Error(`Unrecognized Message type: { name: ${MessageHeader[s]}, type: ${s} }`)}}Field.encode=encodeField;Field.decode=decodeField;Field.fromJSON=fieldFromJSON;Schema.encode=encodeSchema;Schema.decode=decodeSchema;Schema.fromJSON=schemaFromJSON;RecordBatch$1.encode=encodeRecordBatch;RecordBatch$1.decode=decodeRecordBatch;RecordBatch$1.fromJSON=recordBatchFromJSON;DictionaryBatch.encode=encodeDictionaryBatch;DictionaryBatch.decode=decodeDictionaryBatch;DictionaryBatch.fromJSON=dictionaryBatchFromJSON;FieldNode.encode=encodeFieldNode;FieldNode.decode=decodeFieldNode;BufferRegion.encode=encodeBufferRegion;BufferRegion.decode=decodeBufferRegion;function decodeSchema(o,s=new Map){const _=decodeSchemaFields(o,s);return new Schema(_,decodeCustomMetadata(o),s)}function decodeRecordBatch(o,s=MetadataVersion.V4){return new RecordBatch$1(o.length(),decodeFieldNodes(o),decodeBuffers(o,s))}function decodeDictionaryBatch(o,s=MetadataVersion.V4){return new DictionaryBatch(RecordBatch$1.decode(o.data(),s),o.id(),o.isDelta())}function decodeBufferRegion(o){return new BufferRegion(o.offset(),o.length())}function decodeFieldNode(o){return new FieldNode(o.length(),o.nullCount())}function decodeFieldNodes(o){const s=[];for(let _,_e=-1,et=-1,it=o.nodesLength();++_e<it;)(_=o.nodes(_e))&&(s[++et]=FieldNode.decode(_));return s}function decodeBuffers(o,s){const _=[];for(let _e,et=-1,it=-1,tt=o.buffersLength();++et<tt;)(_e=o.buffers(et))&&(s<MetadataVersion.V4&&(_e.bb_pos+=8*(et+1)),_[++it]=BufferRegion.decode(_e));return _}function decodeSchemaFields(o,s){const _=[];for(let _e,et=-1,it=-1,tt=o.fieldsLength();++et<tt;)(_e=o.fields(et))&&(_[++it]=Field.decode(_e,s));return _}function decodeFieldChildren(o,s){const _=[];for(let _e,et=-1,it=-1,tt=o.childrenLength();++et<tt;)(_e=o.children(et))&&(_[++it]=Field.decode(_e,s));return _}function decodeField(o,s){let _,_e,et,it,tt,rt;return!s||!(rt=o.dictionary())?(et=decodeFieldType(o,decodeFieldChildren(o,s)),_e=new Field(o.name(),et,o.nullable(),decodeCustomMetadata(o))):s.has(_=rt.id().low)?(it=(it=rt.indexType())?decodeIndexType(it):new Int32,tt=new Dictionary(s.get(_),it,_,rt.isOrdered()),_e=new Field(o.name(),tt,o.nullable(),decodeCustomMetadata(o))):(it=(it=rt.indexType())?decodeIndexType(it):new Int32,s.set(_,et=decodeFieldType(o,decodeFieldChildren(o,s))),tt=new Dictionary(et,it,_,rt.isOrdered()),_e=new Field(o.name(),tt,o.nullable(),decodeCustomMetadata(o))),_e||null}function decodeCustomMetadata(o){const s=new Map;if(o)for(let _,_e,et=-1,it=o.customMetadataLength()|0;++et<it;)(_=o.customMetadata(et))&&(_e=_.key())!=null&&s.set(_e,_.value());return s}function decodeIndexType(o){return new Int_(o.isSigned(),o.bitWidth())}function decodeFieldType(o,s){const _=o.typeType();switch(_){case Type.NONE:return new Null$1;case Type.Null:return new Null$1;case Type.Binary:return new Binary$1;case Type.Utf8:return new Utf8$1;case Type.Bool:return new Bool$1;case Type.List:return new List$1((s||[])[0]);case Type.Struct_:return new Struct$1(s||[])}switch(_){case Type.Int:{const _e=o.type(new org$2.apache.arrow.flatbuf.Int);return new Int_(_e.isSigned(),_e.bitWidth())}case Type.FloatingPoint:{const _e=o.type(new org$2.apache.arrow.flatbuf.FloatingPoint);return new Float(_e.precision())}case Type.Decimal:{const _e=o.type(new org$2.apache.arrow.flatbuf.Decimal);return new Decimal$1(_e.scale(),_e.precision())}case Type.Date:{const _e=o.type(new org$2.apache.arrow.flatbuf.Date);return new Date_(_e.unit())}case Type.Time:{const _e=o.type(new org$2.apache.arrow.flatbuf.Time);return new Time_(_e.unit(),_e.bitWidth())}case Type.Timestamp:{const _e=o.type(new org$2.apache.arrow.flatbuf.Timestamp);return new Timestamp_(_e.unit(),_e.timezone())}case Type.Interval:{const _e=o.type(new org$2.apache.arrow.flatbuf.Interval);return new Interval_(_e.unit())}case Type.Union:{const _e=o.type(new org$2.apache.arrow.flatbuf.Union);return new Union_(_e.mode(),_e.typeIdsArray()||[],s||[])}case Type.FixedSizeBinary:{const _e=o.type(new org$2.apache.arrow.flatbuf.FixedSizeBinary);return new FixedSizeBinary$1(_e.byteWidth())}case Type.FixedSizeList:{const _e=o.type(new org$2.apache.arrow.flatbuf.FixedSizeList);return new FixedSizeList$1(_e.listSize(),(s||[])[0])}case Type.Map:{const _e=o.type(new org$2.apache.arrow.flatbuf.Map);return new Map_$1((s||[])[0],_e.keysSorted())}}throw new Error(`Unrecognized type: "${Type[_]}" (${_})`)}function encodeSchema(o,s){const _=s.fields.map(it=>Field.encode(o,it));_Schema.startFieldsVector(o,_.length);const _e=_Schema.createFieldsVector(o,_),et=s.metadata&&s.metadata.size>0?_Schema.createCustomMetadataVector(o,[...s.metadata].map(([it,tt])=>{const rt=o.createString(`${it}`),nt=o.createString(`${tt}`);return _KeyValue.startKeyValue(o),_KeyValue.addKey(o,rt),_KeyValue.addValue(o,nt),_KeyValue.endKeyValue(o)})):-1;return _Schema.startSchema(o),_Schema.addFields(o,_e),_Schema.addEndianness(o,platformIsLittleEndian?_Endianness.Little:_Endianness.Big),et!==-1&&_Schema.addCustomMetadata(o,et),_Schema.endSchema(o)}function encodeField(o,s){let _=-1,_e=-1,et=-1,it=s.type,tt=s.typeId;DataType.isDictionary(it)?(tt=it.dictionary.typeId,et=instance$6.visit(it,o),_e=instance$6.visit(it.dictionary,o)):_e=instance$6.visit(it,o);const rt=(it.children||[]).map(st=>Field.encode(o,st)),nt=_Field.createChildrenVector(o,rt),ot=s.metadata&&s.metadata.size>0?_Field.createCustomMetadataVector(o,[...s.metadata].map(([st,at])=>{const lt=o.createString(`${st}`),ct=o.createString(`${at}`);return _KeyValue.startKeyValue(o),_KeyValue.addKey(o,lt),_KeyValue.addValue(o,ct),_KeyValue.endKeyValue(o)})):-1;return s.name&&(_=o.createString(s.name)),_Field.startField(o),_Field.addType(o,_e),_Field.addTypeType(o,tt),_Field.addChildren(o,nt),_Field.addNullable(o,!!s.nullable),_!==-1&&_Field.addName(o,_),et!==-1&&_Field.addDictionary(o,et),ot!==-1&&_Field.addCustomMetadata(o,ot),_Field.endField(o)}function encodeRecordBatch(o,s){const _=s.nodes||[],_e=s.buffers||[];_RecordBatch.startNodesVector(o,_.length),_.slice().reverse().forEach(tt=>FieldNode.encode(o,tt));const et=o.endVector();_RecordBatch.startBuffersVector(o,_e.length),_e.slice().reverse().forEach(tt=>BufferRegion.encode(o,tt));const it=o.endVector();return _RecordBatch.startRecordBatch(o),_RecordBatch.addLength(o,new Long(s.length,0)),_RecordBatch.addNodes(o,et),_RecordBatch.addBuffers(o,it),_RecordBatch.endRecordBatch(o)}function encodeDictionaryBatch(o,s){const _=RecordBatch$1.encode(o,s.data);return _DictionaryBatch.startDictionaryBatch(o),_DictionaryBatch.addId(o,new Long(s.id,0)),_DictionaryBatch.addIsDelta(o,s.isDelta),_DictionaryBatch.addData(o,_),_DictionaryBatch.endDictionaryBatch(o)}function encodeFieldNode(o,s){return _FieldNode.createFieldNode(o,new Long(s.length,0),new Long(s.nullCount,0))}function encodeBufferRegion(o,s){return _Buffer.createBuffer(o,new Long(s.offset,0),new Long(s.length,0))}const platformIsLittleEndian=function(){const o=new ArrayBuffer(2);return new DataView(o).setInt16(0,256,!0),new Int16Array(o)[0]===256}();var ByteBuffer=flatbuffers.ByteBuffer;const invalidMessageType=o=>`Expected ${MessageHeader[o]} Message in stream, but was null or length 0.`,nullMessage=o=>`Header pointer of flatbuffer-encoded ${MessageHeader[o]} Message is null or length 0.`,invalidMessageMetadata=(o,s)=>`Expected to read ${o} metadata bytes, but only read ${s}.`,invalidMessageBodyLength=(o,s)=>`Expected to read ${o} bytes for message body, but only read ${s}.`;class MessageReader{constructor(s){this.source=s instanceof ByteStream?s:new ByteStream(s)}[Symbol.iterator](){return this}next(){let s;return(s=this.readMetadataLength()).done||s.value===-1&&(s=this.readMetadataLength()).done||(s=this.readMetadata(s.value)).done?ITERATOR_DONE:s}throw(s){return this.source.throw(s)}return(s){return this.source.return(s)}readMessage(s){let _;if((_=this.next()).done)return null;if(s!=null&&_.value.headerType!==s)throw new Error(invalidMessageType(s));return _.value}readMessageBody(s){if(s<=0)return new Uint8Array(0);const _=toUint8Array(this.source.read(s));if(_.byteLength<s)throw new Error(invalidMessageBodyLength(s,_.byteLength));return _.byteOffset%8===0&&_.byteOffset+_.byteLength<=_.buffer.byteLength?_:_.slice()}readSchema(s=!1){const _=MessageHeader.Schema,_e=this.readMessage(_),et=_e&&_e.header();if(s&&!et)throw new Error(nullMessage(_));return et}readMetadataLength(){const s=this.source.read(PADDING),_=s&&new ByteBuffer(s),_e=_&&_.readInt32(0)||0;return{done:_e===0,value:_e}}readMetadata(s){const _=this.source.read(s);if(!_)return ITERATOR_DONE;if(_.byteLength<s)throw new Error(invalidMessageMetadata(s,_.byteLength));return{done:!1,value:Message.decode(_)}}}class AsyncMessageReader{constructor(s,_){this.source=s instanceof AsyncByteStream?s:isFileHandle(s)?new AsyncRandomAccessFile(s,_):new AsyncByteStream(s)}[Symbol.asyncIterator](){return this}async next(){let s;return(s=await this.readMetadataLength()).done||s.value===-1&&(s=await this.readMetadataLength()).done||(s=await this.readMetadata(s.value)).done?ITERATOR_DONE:s}async throw(s){return await this.source.throw(s)}async return(s){return await this.source.return(s)}async readMessage(s){let _;if((_=await this.next()).done)return null;if(s!=null&&_.value.headerType!==s)throw new Error(invalidMessageType(s));return _.value}async readMessageBody(s){if(s<=0)return new Uint8Array(0);const _=toUint8Array(await this.source.read(s));if(_.byteLength<s)throw new Error(invalidMessageBodyLength(s,_.byteLength));return _.byteOffset%8===0&&_.byteOffset+_.byteLength<=_.buffer.byteLength?_:_.slice()}async readSchema(s=!1){const _=MessageHeader.Schema,_e=await this.readMessage(_),et=_e&&_e.header();if(s&&!et)throw new Error(nullMessage(_));return et}async readMetadataLength(){const s=await this.source.read(PADDING),_=s&&new ByteBuffer(s),_e=_&&_.readInt32(0)||0;return{done:_e===0,value:_e}}async readMetadata(s){const _=await this.source.read(s);if(!_)return ITERATOR_DONE;if(_.byteLength<s)throw new Error(invalidMessageMetadata(s,_.byteLength));return{done:!1,value:Message.decode(_)}}}class JSONMessageReader extends MessageReader{constructor(s){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=s instanceof ArrowJSON?s:new ArrowJSON(s)}next(){const{_json:s}=this;if(!this._schema){this._schema=!0;const _=Message.fromJSON(s.schema,MessageHeader.Schema);return{done:!1,value:_}}if(this._dictionaryIndex<s.dictionaries.length){const _=s.dictionaries[this._dictionaryIndex++];this._body=_.data.columns;const _e=Message.fromJSON(_,MessageHeader.DictionaryBatch);return{done:!1,value:_e}}if(this._batchIndex<s.batches.length){const _=s.batches[this._batchIndex++];this._body=_.columns;const _e=Message.fromJSON(_,MessageHeader.RecordBatch);return{done:!1,value:_e}}return this._body=[],ITERATOR_DONE}readMessageBody(s){return _(this._body);function _(_e){return(_e||[]).reduce((et,it)=>[...et,...it.VALIDITY&&[it.VALIDITY]||[],...it.TYPE&&[it.TYPE]||[],...it.OFFSET&&[it.OFFSET]||[],...it.DATA&&[it.DATA]||[],..._(it.children)],[])}}readMessage(s){let _;if((_=this.next()).done)return null;if(s!=null&&_.value.headerType!==s)throw new Error(invalidMessageType(s));return _.value}readSchema(){const s=MessageHeader.Schema,_=this.readMessage(s),_e=_&&_.header();if(!_||!_e)throw new Error(nullMessage(s));return _e}}const PADDING=4,MAGIC_STR="ARROW1",MAGIC=new Uint8Array(MAGIC_STR.length);for(let o=0;o<MAGIC_STR.length;o+=1)MAGIC[o]=MAGIC_STR.charCodeAt(o);function checkForMagicArrowString(o,s=0){for(let _=-1,_e=MAGIC.length;++_<_e;)if(MAGIC[_]!==o[s+_])return!1;return!0}const magicLength=MAGIC.length,magicAndPadding=magicLength+PADDING,magicX2AndPadding=magicLength*2+PADDING;class VectorAssembler extends Visitor{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...s){const _=new VectorAssembler,_e=selectVectorChildrenArgs(RecordBatch,s),[et=_]=_.visitMany(_e);return et}visit(s){if(!DataType.isDictionary(s.type)){const{data:_,length:_e,nullCount:et}=s;if(_e>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");DataType.isNull(s.type)||addBuffer.call(this,et<=0?new Uint8Array(0):truncateBitmap(_.offset,_e,_.nullBitmap)),this.nodes.push(new FieldNode(_e,et))}return super.visit(s)}visitNull(s){return this}visitDictionary(s){return this.visit(s.indices)}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function addBuffer(o){const s=o.byteLength+7&-8;return this.buffers.push(o),this.bufferRegions.push(new BufferRegion(this._byteLength,s)),this._byteLength+=s,this}function assembleUnion(o){const{type:s,length:_,typeIds:_e,valueOffsets:et}=o;if(addBuffer.call(this,_e),s.mode===UnionMode.Sparse)return assembleNestedVector.call(this,o);if(s.mode===UnionMode.Dense){if(o.offset<=0)return addBuffer.call(this,et),assembleNestedVector.call(this,o);{const it=_e.reduce((st,at)=>Math.max(st,at),_e[0]),tt=new Int32Array(it+1),rt=new Int32Array(it+1).fill(-1),nt=new Int32Array(_),ot=rebaseValueOffsets(-et[0],_,et);for(let st,at,lt=-1;++lt<_;)(at=rt[st=_e[lt]])===-1&&(at=rt[st]=ot[st]),nt[lt]=ot[lt]-at,++tt[st];addBuffer.call(this,nt);for(let st,at=-1,lt=s.children.length;++at<lt;)if(st=o.getChildAt(at)){const ct=s.typeIds[at],ht=Math.min(_,tt[ct]);this.visit(st.slice(rt[ct],ht))}}}return this}function assembleBoolVector(o){let s;return o.nullCount>=o.length?addBuffer.call(this,new Uint8Array(0)):(s=o.values)instanceof Uint8Array?addBuffer.call(this,truncateBitmap(o.offset,o.length,s)):addBuffer.call(this,packBools(o))}function assembleFlatVector(o){return addBuffer.call(this,o.values.subarray(0,o.length*o.stride))}function assembleFlatListVector(o){const{length:s,values:_,valueOffsets:_e}=o,et=_e[0],it=_e[s],tt=Math.min(it-et,_.byteLength-et);return addBuffer.call(this,rebaseValueOffsets(-_e[0],s,_e)),addBuffer.call(this,_.subarray(et,et+tt)),this}function assembleListVector(o){const{length:s,valueOffsets:_}=o;return _&&addBuffer.call(this,rebaseValueOffsets(_[0],s,_)),this.visit(o.getChildAt(0))}function assembleNestedVector(o){return this.visitMany(o.type.children.map((s,_)=>o.getChildAt(_)).filter(Boolean))[0]}VectorAssembler.prototype.visitBool=assembleBoolVector;VectorAssembler.prototype.visitInt=assembleFlatVector;VectorAssembler.prototype.visitFloat=assembleFlatVector;VectorAssembler.prototype.visitUtf8=assembleFlatListVector;VectorAssembler.prototype.visitBinary=assembleFlatListVector;VectorAssembler.prototype.visitFixedSizeBinary=assembleFlatVector;VectorAssembler.prototype.visitDate=assembleFlatVector;VectorAssembler.prototype.visitTimestamp=assembleFlatVector;VectorAssembler.prototype.visitTime=assembleFlatVector;VectorAssembler.prototype.visitDecimal=assembleFlatVector;VectorAssembler.prototype.visitList=assembleListVector;VectorAssembler.prototype.visitStruct=assembleNestedVector;VectorAssembler.prototype.visitUnion=assembleUnion;VectorAssembler.prototype.visitInterval=assembleFlatVector;VectorAssembler.prototype.visitFixedSizeList=assembleListVector;VectorAssembler.prototype.visitMap=assembleListVector;class RecordBatchWriter extends ReadableInterop{constructor(s){super(),this._position=0,this._started=!1,this._sink=new AsyncByteQueue,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,isObject$2(s)||(s={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof s.autoDestroy=="boolean"?s.autoDestroy:!0,this._writeLegacyIpcFormat=typeof s.writeLegacyIpcFormat=="boolean"?s.writeLegacyIpcFormat:!1}static throughNode(s){throw new Error('"throughNode" not available in this environment')}static throughDOM(s,_){throw new Error('"throughDOM" not available in this environment')}toString(s=!1){return this._sink.toString(s)}toUint8Array(s=!1){return this._sink.toUint8Array(s)}writeAll(s){return isPromise(s)?s.then(_=>this.writeAll(_)):isAsyncIterable(s)?writeAllAsync(this,s):writeAll(this,s)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(s){return this._sink.toDOMStream(s)}toNodeStream(s){return this._sink.toNodeStream(s)}close(){return this.reset()._sink.close()}abort(s){return this.reset()._sink.abort(s)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(s=this._sink,_=null){return s===this._sink||s instanceof AsyncByteQueue?this._sink=s:(this._sink=new AsyncByteQueue,s&&isWritableDOMStream(s)?this.toDOMStream({type:"bytes"}).pipeTo(s):s&&isWritableNodeStream(s)&&this.toNodeStream({objectMode:!1}).pipe(s)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!_||!_.compareTo(this._schema))&&(_===null?(this._position=0,this._schema=null):(this._started=!0,this._schema=_,this._writeSchema(_))),this}write(s){let _=null;if(this._sink){if(s==null)return this.finish()&&void 0;if(s instanceof Table&&!(_=s.schema))return this.finish()&&void 0;if(s instanceof RecordBatch&&!(_=s.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(_&&!_.compareTo(this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,_)}s instanceof RecordBatch?s instanceof _InternalEmptyPlaceholderRecordBatch||this._writeRecordBatch(s):s instanceof Table?this.writeAll(s.chunks):isIterable(s)&&this.writeAll(s)}_writeMessage(s,_=8){const _e=_-1,et=Message.encode(s),it=et.byteLength,tt=this._writeLegacyIpcFormat?4:8,rt=it+tt+_e&~_e,nt=rt-it-tt;return s.headerType===MessageHeader.RecordBatch?this._recordBatchBlocks.push(new FileBlock(rt,s.bodyLength,this._position)):s.headerType===MessageHeader.DictionaryBatch&&this._dictionaryBlocks.push(new FileBlock(rt,s.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(rt-tt)),it>0&&this._write(et),this._writePadding(nt)}_write(s){if(this._started){const _=toUint8Array(s);_&&_.byteLength>0&&(this._sink.write(_),this._position+=_.byteLength)}return this}_writeSchema(s){return this._writeMessage(Message.from(s))}_writeFooter(s){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(MAGIC)}_writePadding(s){return s>0?this._write(new Uint8Array(s)):this}_writeRecordBatch(s){const{byteLength:_,nodes:_e,bufferRegions:et,buffers:it}=VectorAssembler.assemble(s),tt=new RecordBatch$1(s.length,_e,et),rt=Message.from(tt,_);return this._writeDictionaries(s)._writeMessage(rt)._writeBodyBuffers(it)}_writeDictionaryBatch(s,_,_e=!1){this._dictionaryDeltaOffsets.set(_,s.length+(this._dictionaryDeltaOffsets.get(_)||0));const{byteLength:et,nodes:it,bufferRegions:tt,buffers:rt}=VectorAssembler.assemble(s),nt=new RecordBatch$1(s.length,it,tt),ot=new DictionaryBatch(nt,_,_e),st=Message.from(ot,et);return this._writeMessage(st)._writeBodyBuffers(rt)}_writeBodyBuffers(s){let _,_e,et;for(let it=-1,tt=s.length;++it<tt;)(_=s[it])&&(_e=_.byteLength)>0&&(this._write(_),(et=(_e+7&-8)-_e)>0&&this._writePadding(et));return this}_writeDictionaries(s){for(let[_,_e]of s.dictionaries){let et=this._dictionaryDeltaOffsets.get(_)||0;if(et===0||(_e=_e.slice(et)).length>0){const it="chunks"in _e?_e.chunks:[_e];for(const tt of it)this._writeDictionaryBatch(tt,_,et>0),et+=tt.length}}return this}}class RecordBatchStreamWriter extends RecordBatchWriter{static writeAll(s,_){const _e=new RecordBatchStreamWriter(_);return isPromise(s)?s.then(et=>_e.writeAll(et)):isAsyncIterable(s)?writeAllAsync(_e,s):writeAll(_e,s)}}class RecordBatchFileWriter extends RecordBatchWriter{constructor(){super(),this._autoDestroy=!0}static writeAll(s){const _=new RecordBatchFileWriter;return isPromise(s)?s.then(_e=>_.writeAll(_e)):isAsyncIterable(s)?writeAllAsync(_,s):writeAll(_,s)}_writeSchema(s){return this._writeMagic()._writePadding(2)}_writeFooter(s){const _=Footer_.encode(new Footer_(s,MetadataVersion.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(s)._write(_)._write(Int32Array.of(_.byteLength))._writeMagic()}}function writeAll(o,s){let _=s;s instanceof Table&&(_=s.chunks,o.reset(void 0,s.schema));for(const _e of _)o.write(_e);return o.finish()}async function writeAllAsync(o,s){for await(const _ of s)o.write(_);return o.finish()}const noopBuf=new Uint8Array(0),nullBufs=o=>[noopBuf,noopBuf,new Uint8Array(o),noopBuf];function ensureSameLengthData(o,s,_=s.reduce((_e,et)=>Math.max(_e,et.length),0)){let _e,et,it=-1,tt=s.length;const rt=[...o.fields],nt=[],ot=(_+63&-64)>>3;for(;++it<tt;)(_e=s[it])&&_e.length===_?nt[it]=_e:((et=rt[it]).nullable||(rt[it]=rt[it].clone({nullable:!0})),nt[it]=_e?_e._changeLengthAndBackfillNullBitmap(_):Data.new(et.type,0,_,_,nullBufs(ot)));return[new Schema(rt),_,nt]}function distributeColumnsIntoRecordBatches(o){return distributeVectorsIntoRecordBatches(new Schema(o.map(({field:s})=>s)),o)}function distributeVectorsIntoRecordBatches(o,s){return uniformlyDistributeChunksAcrossRecordBatches(o,s.map(_=>_ instanceof Chunked?_.chunks.map(_e=>_e.data):[_.data]))}function uniformlyDistributeChunksAcrossRecordBatches(o,s){const _=[...o.fields],_e=[],et={numBatches:s.reduce((at,lt)=>Math.max(at,lt.length),0)};let it=0,tt=0,rt=-1,nt=s.length,ot,st=[];for(;et.numBatches-- >0;){for(tt=Number.POSITIVE_INFINITY,rt=-1;++rt<nt;)st[rt]=ot=s[rt].shift(),tt=Math.min(tt,ot?ot.length:tt);isFinite(tt)&&(st=distributeChildData(_,tt,st,s,et),tt>0&&(_e[it++]=[tt,st.slice()]))}return[o=new Schema(_,o.metadata),_e.map(at=>new RecordBatch(o,...at))]}function distributeChildData(o,s,_,_e,et){let it,tt,rt=0,nt=-1,ot=_e.length;const st=(s+63&-64)>>3;for(;++nt<ot;)(it=_[nt])&&(rt=it.length)>=s?rt===s?_[nt]=it:(_[nt]=it.slice(0,s),it=it.slice(s,rt-s),et.numBatches=Math.max(et.numBatches,_e[nt].unshift(it))):((tt=o[nt]).nullable||(o[nt]=tt.clone({nullable:!0})),_[nt]=it?it._changeLengthAndBackfillNullBitmap(s):Data.new(tt.type,0,s,s,nullBufs(st)));return _}class BaseVector extends AbstractVector{constructor(s,_){super(),this._children=_,this.numChildren=s.childData.length,this._bindDataAccessors(this.data=s)}get type(){return this.data.type}get typeId(){return this.data.typeId}get length(){return this.data.length}get offset(){return this.data.offset}get stride(){return this.data.stride}get nullCount(){return this.data.nullCount}get byteLength(){return this.data.byteLength}get VectorName(){return`${Type$1[this.typeId]}Vector`}get ArrayType(){return this.type.ArrayType}get values(){return this.data.values}get typeIds(){return this.data.typeIds}get nullBitmap(){return this.data.nullBitmap}get valueOffsets(){return this.data.valueOffsets}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}clone(s,_=this._children){return AbstractVector.new(s,_)}concat(...s){return Chunked.concat(this,...s)}slice(s,_){return clampRange(this,s,_,this._sliceInternal)}isValid(s){if(this.nullCount>0){const _=this.offset+s;return(this.nullBitmap[_>>3]&1<<_%8)!==0}return!0}getChildAt(s){return s<0||s>=this.numChildren?null:(this._children||(this._children=[]))[s]||(this._children[s]=AbstractVector.new(this.data.childData[s]))}toJSON(){return[...this]}_sliceInternal(s,_,_e){return s.clone(s.data.slice(_,_e-_),null)}_bindDataAccessors(s){}}BaseVector.prototype[Symbol.isConcatSpreadable]=!0;class BinaryVector extends BaseVector{asUtf8(){return AbstractVector.new(this.data.clone(new Utf8$1))}}class BoolVector extends BaseVector{static from(s){return vectorFromValuesWithType(()=>new Bool$1,s)}}class DateVector extends BaseVector{static from(...s){return s.length===2?vectorFromValuesWithType(()=>s[1]===DateUnit.DAY?new DateDay:new DateMillisecond,s[0]):vectorFromValuesWithType(()=>new DateMillisecond,s[0])}}class DateDayVector extends DateVector{}class DateMillisecondVector extends DateVector{}class DecimalVector extends BaseVector{}class DictionaryVector extends BaseVector{constructor(s){super(s),this.indices=AbstractVector.new(s.clone(this.type.indices))}static from(...s){if(s.length===3){const[_,_e,et]=s,it=new Dictionary(_.type,_e,null,null);return AbstractVector.new(Data.Dictionary(it,0,et.length,0,null,et,_))}return vectorFromValuesWithType(()=>s[0].type,s[0])}get dictionary(){return this.data.dictionary}reverseLookup(s){return this.dictionary.indexOf(s)}getKey(s){return this.indices.get(s)}getValue(s){return this.dictionary.get(s)}setKey(s,_){return this.indices.set(s,_)}setValue(s,_){return this.dictionary.set(s,_)}}DictionaryVector.prototype.indices=null;class FixedSizeBinaryVector extends BaseVector{}class FixedSizeListVector extends BaseVector{}class FloatVector extends BaseVector{static from(s){let _=vectorTypeToDataType$1(this);if(s instanceof ArrayBuffer||ArrayBuffer.isView(s)){let _e=arrayTypeToDataType$1(s.constructor)||_;if(_===null&&(_=_e),_&&_===_e){let et=new _,it=s.byteLength/et.ArrayType.BYTES_PER_ELEMENT;if(!convertTo16Bit(_,s.constructor))return AbstractVector.new(Data.Float(et,0,it,0,null,s))}}if(_)return vectorFromValuesWithType(()=>new _,s);throw s instanceof DataView||s instanceof ArrayBuffer?new TypeError(`Cannot infer float type from instance of ${s.constructor.name}`):new TypeError("Unrecognized FloatVector input")}}class Float16Vector extends FloatVector{toFloat32Array(){return new Float32Array(this)}toFloat64Array(){return new Float64Array(this)}}class Float32Vector extends FloatVector{}class Float64Vector extends FloatVector{}const convertTo16Bit=(o,s)=>o===Float16&&s!==Uint16Array,arrayTypeToDataType$1=o=>{switch(o){case Uint16Array:return Float16;case Float32Array:return Float32;case Float64Array:return Float64;default:return null}},vectorTypeToDataType$1=o=>{switch(o){case Float16Vector:return Float16;case Float32Vector:return Float32;case Float64Vector:return Float64;default:return null}};class IntervalVector extends BaseVector{}class IntervalDayTimeVector extends IntervalVector{}class IntervalYearMonthVector extends IntervalVector{}class IntVector extends BaseVector{static from(...s){let[_,_e=!1]=s,et=vectorTypeToDataType(this,_e);if(_ instanceof ArrayBuffer||ArrayBuffer.isView(_)){let it=arrayTypeToDataType(_.constructor,_e)||et;if(et===null&&(et=it),et&&et===it){let tt=new et,rt=_.byteLength/tt.ArrayType.BYTES_PER_ELEMENT;return convert32To64Bit(et,_.constructor)&&(rt*=.5),AbstractVector.new(Data.Int(tt,0,rt,0,null,_))}}if(et)return vectorFromValuesWithType(()=>new et,_);throw _ instanceof DataView||_ instanceof ArrayBuffer?new TypeError(`Cannot infer integer type from instance of ${_.constructor.name}`):new TypeError("Unrecognized IntVector input")}}class Int8Vector extends IntVector{}class Int16Vector extends IntVector{}class Int32Vector extends IntVector{}class Int64Vector extends IntVector{toBigInt64Array(){return toBigInt64Array(this.values)}get values64(){return this._values64||(this._values64=this.toBigInt64Array())}}class Uint8Vector extends IntVector{}class Uint16Vector extends IntVector{}class Uint32Vector extends IntVector{}class Uint64Vector extends IntVector{toBigUint64Array(){return toBigUint64Array(this.values)}get values64(){return this._values64||(this._values64=this.toBigUint64Array())}}const convert32To64Bit=(o,s)=>(o===Int64$1||o===Uint64$1)&&(s===Int32Array||s===Uint32Array),arrayTypeToDataType=(o,s)=>{switch(o){case Int8Array:return Int8;case Int16Array:return Int16;case Int32Array:return s?Int64$1:Int32;case BigInt64ArrayCtor:return Int64$1;case Uint8Array:return Uint8;case Uint16Array:return Uint16;case Uint32Array:return s?Uint64$1:Uint32;case BigUint64ArrayCtor:return Uint64$1;default:return null}},vectorTypeToDataType=(o,s)=>{switch(o){case Int8Vector:return Int8;case Int16Vector:return Int16;case Int32Vector:return s?Int64$1:Int32;case Int64Vector:return Int64$1;case Uint8Vector:return Uint8;case Uint16Vector:return Uint16;case Uint32Vector:return s?Uint64$1:Uint32;case Uint64Vector:return Uint64$1;default:return null}};class ListVector extends BaseVector{}class MapVector extends BaseVector{asList(){const s=this.type.children[0];return AbstractVector.new(this.data.clone(new List$1(s)))}bind(s){const _=this.getChildAt(0),{[s]:_e,[s+1]:et}=this.valueOffsets;return new MapRow(_.slice(_e,et))}}class NullVector extends BaseVector{}const kRowIndex=Symbol.for("rowIndex");class StructVector extends BaseVector{bind(s){const _=this._row||(this._row=new StructRow(this)),_e=Object.create(_);return _e[kRowIndex]=s,_e}}class TimestampVector extends BaseVector{}class TimestampSecondVector extends TimestampVector{}class TimestampMillisecondVector extends TimestampVector{}class TimestampMicrosecondVector extends TimestampVector{}class TimestampNanosecondVector extends TimestampVector{}class TimeVector extends BaseVector{}class TimeSecondVector extends TimeVector{}class TimeMillisecondVector extends TimeVector{}class TimeMicrosecondVector extends TimeVector{}class TimeNanosecondVector extends TimeVector{}class UnionVector extends BaseVector{get typeIdToChildIndex(){return this.data.type.typeIdToChildIndex}}class DenseUnionVector extends UnionVector{get valueOffsets(){return this.data.valueOffsets}}class SparseUnionVector extends UnionVector{}class Utf8Vector extends BaseVector{static from(s){return vectorFromValuesWithType(()=>new Utf8$1,s)}asBinary(){return AbstractVector.new(this.data.clone(new Binary$1))}}function partial0(o){return function(){return o(this)}}function partial1(o){return function(s){return o(this,s)}}function partial2(o){return function(s,_){return o(this,s,_)}}class GetVisitor extends Visitor{}const epochDaysToMs=(o,s)=>864e5*o[s],epochMillisecondsLongToMs=(o,s)=>4294967296*o[s+1]+(o[s]>>>0),epochMicrosecondsLongToMs=(o,s)=>4294967296*(o[s+1]/1e3)+(o[s]>>>0)/1e3,epochNanosecondsLongToMs=(o,s)=>4294967296*(o[s+1]/1e6)+(o[s]>>>0)/1e6,epochMillisecondsToDate=o=>new Date(o),epochDaysToDate=(o,s)=>epochMillisecondsToDate(epochDaysToMs(o,s)),epochMillisecondsLongToDate=(o,s)=>epochMillisecondsToDate(epochMillisecondsLongToMs(o,s)),getNull=(o,s)=>null,getVariableWidthBytes=(o,s,_)=>{const{[_]:_e,[_+1]:et}=s;return _e!=null&&et!=null?o.subarray(_e,et):null},getBool=({offset:o,values:s},_)=>{const _e=o+_;return(s[_e>>3]&1<<_e%8)!==0},getDateDay=({values:o},s)=>epochDaysToDate(o,s),getDateMillisecond=({values:o},s)=>epochMillisecondsLongToDate(o,s*2),getNumeric=({stride:o,values:s},_)=>s[o*_],getFloat16=({stride:o,values:s},_)=>uint16ToFloat64(s[o*_]),getBigInts=({stride:o,values:s,type:_},_e)=>BN.new(s.subarray(o*_e,o*(_e+1)),_.isSigned),getFixedSizeBinary=({stride:o,values:s},_)=>s.subarray(o*_,o*(_+1)),getBinary=({values:o,valueOffsets:s},_)=>getVariableWidthBytes(o,s,_),getUtf8=({values:o,valueOffsets:s},_)=>{const _e=getVariableWidthBytes(o,s,_);return _e!==null?decodeUtf8(_e):null},getInt=(o,s)=>o.type.bitWidth<64?getNumeric(o,s):getBigInts(o,s),getFloat=(o,s)=>o.type.precision!==Precision.HALF?getNumeric(o,s):getFloat16(o,s),getDate=(o,s)=>o.type.unit===DateUnit.DAY?getDateDay(o,s):getDateMillisecond(o,s),getTimestampSecond=({values:o},s)=>1e3*epochMillisecondsLongToMs(o,s*2),getTimestampMillisecond=({values:o},s)=>epochMillisecondsLongToMs(o,s*2),getTimestampMicrosecond=({values:o},s)=>epochMicrosecondsLongToMs(o,s*2),getTimestampNanosecond=({values:o},s)=>epochNanosecondsLongToMs(o,s*2),getTimestamp=(o,s)=>{switch(o.type.unit){case TimeUnit.SECOND:return getTimestampSecond(o,s);case TimeUnit.MILLISECOND:return getTimestampMillisecond(o,s);case TimeUnit.MICROSECOND:return getTimestampMicrosecond(o,s);case TimeUnit.NANOSECOND:return getTimestampNanosecond(o,s)}},getTimeSecond=({values:o,stride:s},_)=>o[s*_],getTimeMillisecond=({values:o,stride:s},_)=>o[s*_],getTimeMicrosecond=({values:o},s)=>BN.signed(o.subarray(2*s,2*(s+1))),getTimeNanosecond=({values:o},s)=>BN.signed(o.subarray(2*s,2*(s+1))),getTime=(o,s)=>{switch(o.type.unit){case TimeUnit.SECOND:return getTimeSecond(o,s);case TimeUnit.MILLISECOND:return getTimeMillisecond(o,s);case TimeUnit.MICROSECOND:return getTimeMicrosecond(o,s);case TimeUnit.NANOSECOND:return getTimeNanosecond(o,s)}},getDecimal=({values:o},s)=>BN.decimal(o.subarray(4*s,4*(s+1))),getList=(o,s)=>{const _=o.getChildAt(0),{valueOffsets:_e,stride:et}=o;return _.slice(_e[s*et],_e[s*et+1])},getMap=(o,s)=>o.bind(s),getStruct=(o,s)=>o.bind(s),getUnion=(o,s)=>o.type.mode===UnionMode.Dense?getDenseUnion(o,s):getSparseUnion(o,s),getDenseUnion=(o,s)=>{const _=o.typeIdToChildIndex[o.typeIds[s]],_e=o.getChildAt(_);return _e?_e.get(o.valueOffsets[s]):null},getSparseUnion=(o,s)=>{const _=o.typeIdToChildIndex[o.typeIds[s]],_e=o.getChildAt(_);return _e?_e.get(s):null},getDictionary=(o,s)=>o.getValue(o.getKey(s)),getInterval=(o,s)=>o.type.unit===IntervalUnit.DAY_TIME?getIntervalDayTime(o,s):getIntervalYearMonth(o,s),getIntervalDayTime=({values:o},s)=>o.subarray(2*s,2*(s+1)),getIntervalYearMonth=({values:o},s)=>{const _=o[s],_e=new Int32Array(2);return _e[0]=_/12|0,_e[1]=_%12|0,_e},getFixedSizeList=(o,s)=>{const _=o.getChildAt(0),{stride:_e}=o;return _.slice(s*_e,(s+1)*_e)};GetVisitor.prototype.visitNull=getNull;GetVisitor.prototype.visitBool=getBool;GetVisitor.prototype.visitInt=getInt;GetVisitor.prototype.visitInt8=getNumeric;GetVisitor.prototype.visitInt16=getNumeric;GetVisitor.prototype.visitInt32=getNumeric;GetVisitor.prototype.visitInt64=getBigInts;GetVisitor.prototype.visitUint8=getNumeric;GetVisitor.prototype.visitUint16=getNumeric;GetVisitor.prototype.visitUint32=getNumeric;GetVisitor.prototype.visitUint64=getBigInts;GetVisitor.prototype.visitFloat=getFloat;GetVisitor.prototype.visitFloat16=getFloat16;GetVisitor.prototype.visitFloat32=getNumeric;GetVisitor.prototype.visitFloat64=getNumeric;GetVisitor.prototype.visitUtf8=getUtf8;GetVisitor.prototype.visitBinary=getBinary;GetVisitor.prototype.visitFixedSizeBinary=getFixedSizeBinary;GetVisitor.prototype.visitDate=getDate;GetVisitor.prototype.visitDateDay=getDateDay;GetVisitor.prototype.visitDateMillisecond=getDateMillisecond;GetVisitor.prototype.visitTimestamp=getTimestamp;GetVisitor.prototype.visitTimestampSecond=getTimestampSecond;GetVisitor.prototype.visitTimestampMillisecond=getTimestampMillisecond;GetVisitor.prototype.visitTimestampMicrosecond=getTimestampMicrosecond;GetVisitor.prototype.visitTimestampNanosecond=getTimestampNanosecond;GetVisitor.prototype.visitTime=getTime;GetVisitor.prototype.visitTimeSecond=getTimeSecond;GetVisitor.prototype.visitTimeMillisecond=getTimeMillisecond;GetVisitor.prototype.visitTimeMicrosecond=getTimeMicrosecond;GetVisitor.prototype.visitTimeNanosecond=getTimeNanosecond;GetVisitor.prototype.visitDecimal=getDecimal;GetVisitor.prototype.visitList=getList;GetVisitor.prototype.visitStruct=getStruct;GetVisitor.prototype.visitUnion=getUnion;GetVisitor.prototype.visitDenseUnion=getDenseUnion;GetVisitor.prototype.visitSparseUnion=getSparseUnion;GetVisitor.prototype.visitDictionary=getDictionary;GetVisitor.prototype.visitInterval=getInterval;GetVisitor.prototype.visitIntervalDayTime=getIntervalDayTime;GetVisitor.prototype.visitIntervalYearMonth=getIntervalYearMonth;GetVisitor.prototype.visitFixedSizeList=getFixedSizeList;GetVisitor.prototype.visitMap=getMap;const instance$5=new GetVisitor;class IndexOfVisitor extends Visitor{}function nullIndexOf(o,s){return s===null&&o.length>0?0:-1}function indexOfNull(o,s){const{nullBitmap:_}=o;if(!_||o.nullCount<=0)return-1;let _e=0;for(const et of iterateBits(_,o.data.offset+(s||0),o.length,_,getBool$1)){if(!et)return _e;++_e}return-1}function indexOfValue(o,s,_){if(s===void 0)return-1;if(s===null)return indexOfNull(o,_);const _e=createElementComparator(s);for(let et=(_||0)-1,it=o.length;++et<it;)if(_e(o.get(et)))return et;return-1}function indexOfUnion(o,s,_){const _e=createElementComparator(s);for(let et=(_||0)-1,it=o.length;++et<it;)if(_e(o.get(et)))return et;return-1}IndexOfVisitor.prototype.visitNull=nullIndexOf;IndexOfVisitor.prototype.visitBool=indexOfValue;IndexOfVisitor.prototype.visitInt=indexOfValue;IndexOfVisitor.prototype.visitInt8=indexOfValue;IndexOfVisitor.prototype.visitInt16=indexOfValue;IndexOfVisitor.prototype.visitInt32=indexOfValue;IndexOfVisitor.prototype.visitInt64=indexOfValue;IndexOfVisitor.prototype.visitUint8=indexOfValue;IndexOfVisitor.prototype.visitUint16=indexOfValue;IndexOfVisitor.prototype.visitUint32=indexOfValue;IndexOfVisitor.prototype.visitUint64=indexOfValue;IndexOfVisitor.prototype.visitFloat=indexOfValue;IndexOfVisitor.prototype.visitFloat16=indexOfValue;IndexOfVisitor.prototype.visitFloat32=indexOfValue;IndexOfVisitor.prototype.visitFloat64=indexOfValue;IndexOfVisitor.prototype.visitUtf8=indexOfValue;IndexOfVisitor.prototype.visitBinary=indexOfValue;IndexOfVisitor.prototype.visitFixedSizeBinary=indexOfValue;IndexOfVisitor.prototype.visitDate=indexOfValue;IndexOfVisitor.prototype.visitDateDay=indexOfValue;IndexOfVisitor.prototype.visitDateMillisecond=indexOfValue;IndexOfVisitor.prototype.visitTimestamp=indexOfValue;IndexOfVisitor.prototype.visitTimestampSecond=indexOfValue;IndexOfVisitor.prototype.visitTimestampMillisecond=indexOfValue;IndexOfVisitor.prototype.visitTimestampMicrosecond=indexOfValue;IndexOfVisitor.prototype.visitTimestampNanosecond=indexOfValue;IndexOfVisitor.prototype.visitTime=indexOfValue;IndexOfVisitor.prototype.visitTimeSecond=indexOfValue;IndexOfVisitor.prototype.visitTimeMillisecond=indexOfValue;IndexOfVisitor.prototype.visitTimeMicrosecond=indexOfValue;IndexOfVisitor.prototype.visitTimeNanosecond=indexOfValue;IndexOfVisitor.prototype.visitDecimal=indexOfValue;IndexOfVisitor.prototype.visitList=indexOfValue;IndexOfVisitor.prototype.visitStruct=indexOfValue;IndexOfVisitor.prototype.visitUnion=indexOfValue;IndexOfVisitor.prototype.visitDenseUnion=indexOfUnion;IndexOfVisitor.prototype.visitSparseUnion=indexOfUnion;IndexOfVisitor.prototype.visitDictionary=indexOfValue;IndexOfVisitor.prototype.visitInterval=indexOfValue;IndexOfVisitor.prototype.visitIntervalDayTime=indexOfValue;IndexOfVisitor.prototype.visitIntervalYearMonth=indexOfValue;IndexOfVisitor.prototype.visitFixedSizeList=indexOfValue;IndexOfVisitor.prototype.visitMap=indexOfValue;const instance$4=new IndexOfVisitor;class IteratorVisitor extends Visitor{}function nullableIterator(o){const s=instance$5.getVisitFn(o);return iterateBits(o.nullBitmap,o.offset,o.length,o,(_,_e,et,it)=>(et&1<<it)!==0?s(_,_e):null)}function vectorIterator(o){if(o.nullCount>0)return nullableIterator(o);const{type:s,typeId:_,length:_e}=o;return o.stride===1&&(_===Type$1.Timestamp||_===Type$1.Int&&s.bitWidth!==64||_===Type$1.Time&&s.bitWidth!==64||_===Type$1.Float&&s.precision>0)?o.values.subarray(0,_e)[Symbol.iterator]():function*(et){for(let it=-1;++it<_e;)yield et(o,it)}(instance$5.getVisitFn(o))}IteratorVisitor.prototype.visitNull=vectorIterator;IteratorVisitor.prototype.visitBool=vectorIterator;IteratorVisitor.prototype.visitInt=vectorIterator;IteratorVisitor.prototype.visitInt8=vectorIterator;IteratorVisitor.prototype.visitInt16=vectorIterator;IteratorVisitor.prototype.visitInt32=vectorIterator;IteratorVisitor.prototype.visitInt64=vectorIterator;IteratorVisitor.prototype.visitUint8=vectorIterator;IteratorVisitor.prototype.visitUint16=vectorIterator;IteratorVisitor.prototype.visitUint32=vectorIterator;IteratorVisitor.prototype.visitUint64=vectorIterator;IteratorVisitor.prototype.visitFloat=vectorIterator;IteratorVisitor.prototype.visitFloat16=vectorIterator;IteratorVisitor.prototype.visitFloat32=vectorIterator;IteratorVisitor.prototype.visitFloat64=vectorIterator;IteratorVisitor.prototype.visitUtf8=vectorIterator;IteratorVisitor.prototype.visitBinary=vectorIterator;IteratorVisitor.prototype.visitFixedSizeBinary=vectorIterator;IteratorVisitor.prototype.visitDate=vectorIterator;IteratorVisitor.prototype.visitDateDay=vectorIterator;IteratorVisitor.prototype.visitDateMillisecond=vectorIterator;IteratorVisitor.prototype.visitTimestamp=vectorIterator;IteratorVisitor.prototype.visitTimestampSecond=vectorIterator;IteratorVisitor.prototype.visitTimestampMillisecond=vectorIterator;IteratorVisitor.prototype.visitTimestampMicrosecond=vectorIterator;IteratorVisitor.prototype.visitTimestampNanosecond=vectorIterator;IteratorVisitor.prototype.visitTime=vectorIterator;IteratorVisitor.prototype.visitTimeSecond=vectorIterator;IteratorVisitor.prototype.visitTimeMillisecond=vectorIterator;IteratorVisitor.prototype.visitTimeMicrosecond=vectorIterator;IteratorVisitor.prototype.visitTimeNanosecond=vectorIterator;IteratorVisitor.prototype.visitDecimal=vectorIterator;IteratorVisitor.prototype.visitList=vectorIterator;IteratorVisitor.prototype.visitStruct=vectorIterator;IteratorVisitor.prototype.visitUnion=vectorIterator;IteratorVisitor.prototype.visitDenseUnion=vectorIterator;IteratorVisitor.prototype.visitSparseUnion=vectorIterator;IteratorVisitor.prototype.visitDictionary=vectorIterator;IteratorVisitor.prototype.visitInterval=vectorIterator;IteratorVisitor.prototype.visitIntervalDayTime=vectorIterator;IteratorVisitor.prototype.visitIntervalYearMonth=vectorIterator;IteratorVisitor.prototype.visitFixedSizeList=vectorIterator;IteratorVisitor.prototype.visitMap=vectorIterator;const instance$3=new IteratorVisitor;class ToArrayVisitor extends Visitor{}function arrayOfVector(o){const{type:s,length:_,stride:_e}=o;switch(s.typeId){case Type$1.Int:case Type$1.Float:case Type$1.Decimal:case Type$1.Time:case Type$1.Timestamp:return o.values.subarray(0,_*_e)}return[...instance$3.visit(o)]}ToArrayVisitor.prototype.visitNull=arrayOfVector;ToArrayVisitor.prototype.visitBool=arrayOfVector;ToArrayVisitor.prototype.visitInt=arrayOfVector;ToArrayVisitor.prototype.visitInt8=arrayOfVector;ToArrayVisitor.prototype.visitInt16=arrayOfVector;ToArrayVisitor.prototype.visitInt32=arrayOfVector;ToArrayVisitor.prototype.visitInt64=arrayOfVector;ToArrayVisitor.prototype.visitUint8=arrayOfVector;ToArrayVisitor.prototype.visitUint16=arrayOfVector;ToArrayVisitor.prototype.visitUint32=arrayOfVector;ToArrayVisitor.prototype.visitUint64=arrayOfVector;ToArrayVisitor.prototype.visitFloat=arrayOfVector;ToArrayVisitor.prototype.visitFloat16=arrayOfVector;ToArrayVisitor.prototype.visitFloat32=arrayOfVector;ToArrayVisitor.prototype.visitFloat64=arrayOfVector;ToArrayVisitor.prototype.visitUtf8=arrayOfVector;ToArrayVisitor.prototype.visitBinary=arrayOfVector;ToArrayVisitor.prototype.visitFixedSizeBinary=arrayOfVector;ToArrayVisitor.prototype.visitDate=arrayOfVector;ToArrayVisitor.prototype.visitDateDay=arrayOfVector;ToArrayVisitor.prototype.visitDateMillisecond=arrayOfVector;ToArrayVisitor.prototype.visitTimestamp=arrayOfVector;ToArrayVisitor.prototype.visitTimestampSecond=arrayOfVector;ToArrayVisitor.prototype.visitTimestampMillisecond=arrayOfVector;ToArrayVisitor.prototype.visitTimestampMicrosecond=arrayOfVector;ToArrayVisitor.prototype.visitTimestampNanosecond=arrayOfVector;ToArrayVisitor.prototype.visitTime=arrayOfVector;ToArrayVisitor.prototype.visitTimeSecond=arrayOfVector;ToArrayVisitor.prototype.visitTimeMillisecond=arrayOfVector;ToArrayVisitor.prototype.visitTimeMicrosecond=arrayOfVector;ToArrayVisitor.prototype.visitTimeNanosecond=arrayOfVector;ToArrayVisitor.prototype.visitDecimal=arrayOfVector;ToArrayVisitor.prototype.visitList=arrayOfVector;ToArrayVisitor.prototype.visitStruct=arrayOfVector;ToArrayVisitor.prototype.visitUnion=arrayOfVector;ToArrayVisitor.prototype.visitDenseUnion=arrayOfVector;ToArrayVisitor.prototype.visitSparseUnion=arrayOfVector;ToArrayVisitor.prototype.visitDictionary=arrayOfVector;ToArrayVisitor.prototype.visitInterval=arrayOfVector;ToArrayVisitor.prototype.visitIntervalDayTime=arrayOfVector;ToArrayVisitor.prototype.visitIntervalYearMonth=arrayOfVector;ToArrayVisitor.prototype.visitFixedSizeList=arrayOfVector;ToArrayVisitor.prototype.visitMap=arrayOfVector;const instance$2=new ToArrayVisitor,sum=(o,s)=>o+s,variableWidthColumnErrorMessage=o=>`Cannot compute the byte width of variable-width column ${o}`;class ByteWidthVisitor extends Visitor{visitNull(s){return 0}visitInt(s){return s.bitWidth/8}visitFloat(s){return s.ArrayType.BYTES_PER_ELEMENT}visitBinary(s){throw new Error(variableWidthColumnErrorMessage(s))}visitUtf8(s){throw new Error(variableWidthColumnErrorMessage(s))}visitBool(s){return 1/8}visitDecimal(s){return 16}visitDate(s){return(s.unit+1)*4}visitTime(s){return s.bitWidth/8}visitTimestamp(s){return s.unit===TimeUnit.SECOND?4:8}visitInterval(s){return(s.unit+1)*4}visitList(s){throw new Error(variableWidthColumnErrorMessage(s))}visitStruct(s){return this.visitFields(s.children).reduce(sum,0)}visitUnion(s){return this.visitFields(s.children).reduce(sum,0)}visitFixedSizeBinary(s){return s.byteWidth}visitFixedSizeList(s){return s.listSize*this.visitFields(s.children).reduce(sum,0)}visitMap(s){return this.visitFields(s.children).reduce(sum,0)}visitDictionary(s){return this.visit(s.indices)}visitFields(s){return(s||[]).map(_=>this.visit(_.type))}visitSchema(s){return this.visitFields(s.fields).reduce(sum,0)}}const instance$1=new ByteWidthVisitor;class GetVectorConstructor extends Visitor{visitNull(){return NullVector}visitBool(){return BoolVector}visitInt(){return IntVector}visitInt8(){return Int8Vector}visitInt16(){return Int16Vector}visitInt32(){return Int32Vector}visitInt64(){return Int64Vector}visitUint8(){return Uint8Vector}visitUint16(){return Uint16Vector}visitUint32(){return Uint32Vector}visitUint64(){return Uint64Vector}visitFloat(){return FloatVector}visitFloat16(){return Float16Vector}visitFloat32(){return Float32Vector}visitFloat64(){return Float64Vector}visitUtf8(){return Utf8Vector}visitBinary(){return BinaryVector}visitFixedSizeBinary(){return FixedSizeBinaryVector}visitDate(){return DateVector}visitDateDay(){return DateDayVector}visitDateMillisecond(){return DateMillisecondVector}visitTimestamp(){return TimestampVector}visitTimestampSecond(){return TimestampSecondVector}visitTimestampMillisecond(){return TimestampMillisecondVector}visitTimestampMicrosecond(){return TimestampMicrosecondVector}visitTimestampNanosecond(){return TimestampNanosecondVector}visitTime(){return TimeVector}visitTimeSecond(){return TimeSecondVector}visitTimeMillisecond(){return TimeMillisecondVector}visitTimeMicrosecond(){return TimeMicrosecondVector}visitTimeNanosecond(){return TimeNanosecondVector}visitDecimal(){return DecimalVector}visitList(){return ListVector}visitStruct(){return StructVector}visitUnion(){return UnionVector}visitDenseUnion(){return DenseUnionVector}visitSparseUnion(){return SparseUnionVector}visitDictionary(){return DictionaryVector}visitInterval(){return IntervalVector}visitIntervalDayTime(){return IntervalDayTimeVector}visitIntervalYearMonth(){return IntervalYearMonthVector}visitFixedSizeList(){return FixedSizeListVector}visitMap(){return MapVector}}const instance=new GetVectorConstructor;AbstractVector.new=newVector;AbstractVector.from=vectorFrom;function newVector(o,...s){return new(instance.getVisitFn(o)())(o,...s)}function vectorFromValuesWithType(o,s){if(isIterable(s))return AbstractVector.from({nullValues:[null,void 0],type:o(),values:s});if(isAsyncIterable(s))return AbstractVector.from({nullValues:[null,void 0],type:o(),values:s});const{values:_=[],type:_e=o(),nullValues:et=[null,void 0]}=or({},s);return isIterable(_)?AbstractVector.from(Tr(or({nullValues:et},s),{type:_e})):AbstractVector.from(Tr(or({nullValues:et},s),{type:_e}))}function vectorFrom(o){const _e=or({nullValues:[null,void 0]},o),{values:s=[]}=_e,_=Ps(_e,["values"]);if(isIterable(s)){const et=[...Builder$2.throughIterable(_)(s)];return et.length===1?et[0]:Chunked.concat(et)}return(async et=>{const it=Builder$2.throughAsyncIterable(_);for await(const tt of it(s))et.push(tt);return et.length===1?et[0]:Chunked.concat(et)})([])}BaseVector.prototype.get=function(s){return instance$5.visit(this,s)};BaseVector.prototype.set=function(s,_){return instance$8.visit(this,s,_)};BaseVector.prototype.indexOf=function(s,_){return instance$4.visit(this,s,_)};BaseVector.prototype.toArray=function(){return instance$2.visit(this)};BaseVector.prototype.getByteWidth=function(){return instance$1.visit(this.type)};BaseVector.prototype[Symbol.iterator]=function(){return instance$3.visit(this)};BaseVector.prototype._bindDataAccessors=bindBaseVectorDataAccessors;Object.keys(Type$1).map(o=>Type$1[o]).filter(o=>typeof o=="number").filter(o=>o!==Type$1.NONE).forEach(o=>{const s=instance.visit(o);s.prototype.get=partial1(instance$5.getVisitFn(o)),s.prototype.set=partial2(instance$8.getVisitFn(o)),s.prototype.indexOf=partial2(instance$4.getVisitFn(o)),s.prototype.toArray=partial0(instance$2.getVisitFn(o)),s.prototype.getByteWidth=partialType0(instance$1.getVisitFn(o)),s.prototype[Symbol.iterator]=partial0(instance$3.getVisitFn(o))});function partialType0(o){return function(){return o(this.type)}}function wrapNullableGet(o){return function(s){return this.isValid(s)?o.call(this,s):null}}function wrapNullableSet(o){return function(s,_){setBool$1(this.nullBitmap,this.offset+s,_!=null)&&o.call(this,s,_)}}function bindBaseVectorDataAccessors(){const o=this.nullBitmap;o&&o.byteLength>0&&(this.get=wrapNullableGet(this.get),this.set=wrapNullableSet(this.set))}class Table extends Chunked{constructor(...s){let _=null;s[0]instanceof Schema&&(_=s.shift());let _e=selectArgs(RecordBatch,s);if(!_&&!(_=_e[0]&&_e[0].schema))throw new TypeError("Table must be initialized with a Schema or at least one RecordBatch");_e[0]||(_e[0]=new _InternalEmptyPlaceholderRecordBatch(_)),super(new Struct$1(_.fields),_e),this._schema=_,this._chunks=_e}static empty(s=new Schema([])){return new Table(s,[])}static from(s){if(!s)return Table.empty();if(typeof s=="object"){let _e=isIterable(s.values)?tableFromIterable(s):isAsyncIterable(s.values)?tableFromAsyncIterable(s):null;if(_e!==null)return _e}let _=RecordBatchReader.from(s);return isPromise(_)?(async()=>await Table.from(await _))():_.isSync()&&(_=_.open())?_.schema?new Table(_.schema,[..._]):Table.empty():(async _e=>{const et=await _e,it=et.schema,tt=[];if(it){for await(let rt of et)tt.push(rt);return new Table(it,tt)}return Table.empty()})(_.open())}static async fromAsync(s){return await Table.from(s)}static fromStruct(s){return Table.new(s.data.childData,s.type.children)}static new(...s){return new Table(...distributeColumnsIntoRecordBatches(selectColumnArgs(s)))}get schema(){return this._schema}get length(){return this._length}get chunks(){return this._chunks}get numCols(){return this._numChildren}clone(s=this._chunks){return new Table(this._schema,s)}getColumn(s){return this.getColumnAt(this.getColumnIndex(s))}getColumnAt(s){return this.getChildAt(s)}getColumnIndex(s){return this._schema.fields.findIndex(_=>_.name===s)}getChildAt(s){if(s<0||s>=this.numChildren)return null;let _,_e;const et=this._schema.fields,it=this._children||(this._children=[]);if(_e=it[s])return _e;if(_=et[s]){const tt=this._chunks.map(rt=>rt.getChildAt(s)).filter(rt=>rt!=null);if(tt.length>0)return it[s]=new Column(_,tt)}return null}serialize(s="binary",_=!0){return(_?RecordBatchStreamWriter:RecordBatchFileWriter).writeAll(this).toUint8Array(!0)}count(){return this._length}select(...s){const _=this._schema.fields.reduce((_e,et,it)=>_e.set(et.name,it),new Map);return this.selectAt(...s.map(_e=>_.get(_e)).filter(_e=>_e>-1))}selectAt(...s){const _=this._schema.selectAt(...s);return new Table(_,this._chunks.map(({length:_e,data:{childData:et}})=>new RecordBatch(_,_e,s.map(it=>et[it]).filter(Boolean))))}assign(s){const _=this._schema.fields,[_e,et]=s.schema.fields.reduce((rt,nt,ot)=>{const[st,at]=rt,lt=_.findIndex(ct=>ct.name===nt.name);return~lt?at[lt]=ot:st.push(ot),rt},[[],[]]),it=this._schema.assign(s.schema),tt=[..._.map((rt,nt,ot,st=et[nt])=>st===void 0?this.getColumnAt(nt):s.getColumnAt(st)),..._e.map(rt=>s.getColumnAt(rt))].filter(Boolean);return new Table(...distributeVectorsIntoRecordBatches(it,tt))}}function tableFromIterable(o){const{type:s}=o;return s instanceof Struct$1?Table.fromStruct(StructVector.from(o)):null}function tableFromAsyncIterable(o){const{type:s}=o;return s instanceof Struct$1?StructVector.from(o).then(_=>Table.fromStruct(_)):null}class RecordBatch extends StructVector{constructor(...s){let _,_e=s[0],et;if(s[1]instanceof Data)[,_,et]=s;else{const it=_e.fields,[,tt,rt]=s;_=Data.Struct(new Struct$1(it),0,tt,0,null,rt)}super(_,et),this._schema=_e}static from(s){return isIterable(s.values),Table.from(s)}static new(...s){const[_,_e]=selectFieldArgs(s),et=_e.filter(it=>it instanceof AbstractVector);return new RecordBatch(...ensureSameLengthData(new Schema(_),et.map(it=>it.data)))}clone(s,_=this._children){return new RecordBatch(this._schema,s,_)}concat(...s){const _=this._schema,_e=Chunked.flatten(this,...s);return new Table(_,_e.map(({data:et})=>new RecordBatch(_,et)))}get schema(){return this._schema}get numCols(){return this._schema.fields.length}get dictionaries(){return this._dictionaries||(this._dictionaries=DictionaryCollector.collect(this))}select(...s){const _=this._schema.fields.reduce((_e,et,it)=>_e.set(et.name,it),new Map);return this.selectAt(...s.map(_e=>_.get(_e)).filter(_e=>_e>-1))}selectAt(...s){const _=this._schema.selectAt(...s),_e=s.map(et=>this.data.childData[et]).filter(Boolean);return new RecordBatch(_,this.length,_e)}}class _InternalEmptyPlaceholderRecordBatch extends RecordBatch{constructor(s){super(s,0,s.fields.map(_=>Data.new(_.type,0,0,0)))}}class DictionaryCollector extends Visitor{constructor(){super(...arguments),this.dictionaries=new Map}static collect(s){return new DictionaryCollector().visit(s.data,new Struct$1(s.schema.fields)).dictionaries}visit(s,_){return DataType.isDictionary(_)?this.visitDictionary(s,_):(s.childData.forEach((_e,et)=>this.visit(_e,_.children[et].type)),this)}visitDictionary(s,_){const _e=s.dictionary;return _e&&_e.length>0&&this.dictionaries.set(_.id,_e),this}}class RecordBatchReader extends ReadableInterop{constructor(s){super(),this._impl=s}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(s){return this._impl.throw(s)}return(s){return this._impl.return(s)}cancel(){return this._impl.cancel()}reset(s){return this._impl.reset(s),this._DOMStream=void 0,this._nodeStream=void 0,this}open(s){const _=this._impl.open(s);return isPromise(_)?_.then(()=>this):this}readRecordBatch(s){return this._impl.isFile()?this._impl.readRecordBatch(s):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return streamAdapters.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return streamAdapters.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(s){throw new Error('"throughNode" not available in this environment')}static throughDOM(s,_){throw new Error('"throughDOM" not available in this environment')}static from(s){return s instanceof RecordBatchReader?s:isArrowJSON(s)?fromArrowJSON(s):isFileHandle(s)?fromFileHandle(s):isPromise(s)?(async()=>await RecordBatchReader.from(await s))():isFetchResponse(s)||isReadableDOMStream(s)||isReadableNodeStream(s)||isAsyncIterable(s)?fromAsyncByteStream(new AsyncByteStream(s)):fromByteStream(new ByteStream(s))}static readAll(s){return s instanceof RecordBatchReader?s.isSync()?readAllSync(s):readAllAsync(s):isArrowJSON(s)||ArrayBuffer.isView(s)||isIterable(s)||isIteratorResult(s)?readAllSync(s):readAllAsync(s)}}class RecordBatchStreamReader extends RecordBatchReader{constructor(s){super(s),this._impl=s}[Symbol.iterator](){return this._impl[Symbol.iterator]()}async*[Symbol.asyncIterator](){yield*this[Symbol.iterator]()}}class AsyncRecordBatchStreamReader extends RecordBatchReader{constructor(s){super(s),this._impl=s}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class RecordBatchFileReader extends RecordBatchStreamReader{constructor(s){super(s),this._impl=s}}class AsyncRecordBatchFileReader extends AsyncRecordBatchStreamReader{constructor(s){super(s),this._impl=s}}class RecordBatchReaderImpl{constructor(s=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=s}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(s){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=s,this.dictionaries=new Map,this}_loadRecordBatch(s,_){return new RecordBatch(this.schema,s.length,this._loadVectors(s,_,this.schema.fields))}_loadDictionaryBatch(s,_){const{id:_e,isDelta:et,data:it}=s,{dictionaries:tt,schema:rt}=this,nt=tt.get(_e);if(et||!nt){const ot=rt.dictionaries.get(_e);return nt&&et?nt.concat(AbstractVector.new(this._loadVectors(it,_,[ot])[0])):AbstractVector.new(this._loadVectors(it,_,[ot])[0])}return nt}_loadVectors(s,_,_e){return new VectorLoader(_,s.nodes,s.buffers,this.dictionaries).visitMany(_e)}}class RecordBatchStreamReaderImpl extends RecordBatchReaderImpl{constructor(s,_){super(_),this._reader=isArrowJSON(s)?new JSONMessageReader(this._handle=s):new MessageReader(this._handle=s)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(s){return this.closed||(this.autoDestroy=shouldAutoDestroy(this,s),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(s){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(s):ITERATOR_DONE}return(s){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(s):ITERATOR_DONE}next(){if(this.closed)return ITERATOR_DONE;let s,{_reader:_}=this;for(;s=this._readNextMessageAndValidate();)if(s.isSchema())this.reset(s.header());else if(s.isRecordBatch()){this._recordBatchIndex++;const _e=s.header(),et=_.readMessageBody(s.bodyLength),it=this._loadRecordBatch(_e,et);return{done:!1,value:it}}else if(s.isDictionaryBatch()){this._dictionaryIndex++;const _e=s.header(),et=_.readMessageBody(s.bodyLength),it=this._loadDictionaryBatch(_e,et);this.dictionaries.set(_e.id,it)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new _InternalEmptyPlaceholderRecordBatch(this.schema)}):this.return()}_readNextMessageAndValidate(s){return this._reader.readMessage(s)}}class AsyncRecordBatchStreamReaderImpl extends RecordBatchReaderImpl{constructor(s,_){super(_),this._reader=new AsyncMessageReader(this._handle=s)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}async cancel(){!this.closed&&(this.closed=!0)&&(await this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}async open(s){return this.closed||(this.autoDestroy=shouldAutoDestroy(this,s),this.schema||(this.schema=await this._reader.readSchema())||await this.cancel()),this}async throw(s){return!this.closed&&this.autoDestroy&&(this.closed=!0)?await this.reset()._reader.throw(s):ITERATOR_DONE}async return(s){return!this.closed&&this.autoDestroy&&(this.closed=!0)?await this.reset()._reader.return(s):ITERATOR_DONE}async next(){if(this.closed)return ITERATOR_DONE;let s,{_reader:_}=this;for(;s=await this._readNextMessageAndValidate();)if(s.isSchema())await this.reset(s.header());else if(s.isRecordBatch()){this._recordBatchIndex++;const _e=s.header(),et=await _.readMessageBody(s.bodyLength),it=this._loadRecordBatch(_e,et);return{done:!1,value:it}}else if(s.isDictionaryBatch()){this._dictionaryIndex++;const _e=s.header(),et=await _.readMessageBody(s.bodyLength),it=this._loadDictionaryBatch(_e,et);this.dictionaries.set(_e.id,it)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new _InternalEmptyPlaceholderRecordBatch(this.schema)}):await this.return()}async _readNextMessageAndValidate(s){return await this._reader.readMessage(s)}}class RecordBatchFileReaderImpl extends RecordBatchStreamReaderImpl{constructor(s,_){super(s instanceof RandomAccessFile?s:new RandomAccessFile(s),_)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(s){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const _ of this._footer.dictionaryBatches())_&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(s)}readRecordBatch(s){if(this.closed)return null;this._footer||this.open();const _=this._footer&&this._footer.getRecordBatch(s);if(_&&this._handle.seek(_.offset)){const _e=this._reader.readMessage(MessageHeader.RecordBatch);if(_e&&_e.isRecordBatch()){const et=_e.header(),it=this._reader.readMessageBody(_e.bodyLength);return this._loadRecordBatch(et,it)}}return null}_readDictionaryBatch(s){const _=this._footer&&this._footer.getDictionaryBatch(s);if(_&&this._handle.seek(_.offset)){const _e=this._reader.readMessage(MessageHeader.DictionaryBatch);if(_e&&_e.isDictionaryBatch()){const et=_e.header(),it=this._reader.readMessageBody(_e.bodyLength),tt=this._loadDictionaryBatch(et,it);this.dictionaries.set(et.id,tt)}}}_readFooter(){const{_handle:s}=this,_=s.size-magicAndPadding,_e=s.readInt32(_),et=s.readAt(_-_e,_e);return Footer_.decode(et)}_readNextMessageAndValidate(s){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const _=this._footer&&this._footer.getRecordBatch(this._recordBatchIndex);if(_&&this._handle.seek(_.offset))return this._reader.readMessage(s)}return null}}class AsyncRecordBatchFileReaderImpl extends AsyncRecordBatchStreamReaderImpl{constructor(s,..._){const _e=typeof _[0]!="number"?_.shift():void 0,et=_[0]instanceof Map?_.shift():void 0;super(s instanceof AsyncRandomAccessFile?s:new AsyncRandomAccessFile(s,_e),et)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}async open(s){if(!this.closed&&!this._footer){this.schema=(this._footer=await this._readFooter()).schema;for(const _ of this._footer.dictionaryBatches())_&&await this._readDictionaryBatch(this._dictionaryIndex++)}return await super.open(s)}async readRecordBatch(s){if(this.closed)return null;this._footer||await this.open();const _=this._footer&&this._footer.getRecordBatch(s);if(_&&await this._handle.seek(_.offset)){const _e=await this._reader.readMessage(MessageHeader.RecordBatch);if(_e&&_e.isRecordBatch()){const et=_e.header(),it=await this._reader.readMessageBody(_e.bodyLength);return this._loadRecordBatch(et,it)}}return null}async _readDictionaryBatch(s){const _=this._footer&&this._footer.getDictionaryBatch(s);if(_&&await this._handle.seek(_.offset)){const _e=await this._reader.readMessage(MessageHeader.DictionaryBatch);if(_e&&_e.isDictionaryBatch()){const et=_e.header(),it=await this._reader.readMessageBody(_e.bodyLength),tt=this._loadDictionaryBatch(et,it);this.dictionaries.set(et.id,tt)}}}async _readFooter(){const{_handle:s}=this;s._pending&&await s._pending;const _=s.size-magicAndPadding,_e=await s.readInt32(_),et=await s.readAt(_-_e,_e);return Footer_.decode(et)}async _readNextMessageAndValidate(s){if(this._footer||await this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const _=this._footer.getRecordBatch(this._recordBatchIndex);if(_&&await this._handle.seek(_.offset))return await this._reader.readMessage(s)}return null}}class RecordBatchJSONReaderImpl extends RecordBatchStreamReaderImpl{constructor(s,_){super(s,_)}_loadVectors(s,_,_e){return new JSONVectorLoader(_,s.nodes,s.buffers,this.dictionaries).visitMany(_e)}}function shouldAutoDestroy(o,s){return s&&typeof s.autoDestroy=="boolean"?s.autoDestroy:o.autoDestroy}function*readAllSync(o){const s=RecordBatchReader.from(o);try{if(!s.open({autoDestroy:!1}).closed)do yield s;while(!s.reset().open().closed)}finally{s.cancel()}}async function*readAllAsync(o){const s=await RecordBatchReader.from(o);try{if(!(await s.open({autoDestroy:!1})).closed)do yield s;while(!(await s.reset().open()).closed)}finally{await s.cancel()}}function fromArrowJSON(o){return new RecordBatchStreamReader(new RecordBatchJSONReaderImpl(o))}function fromByteStream(o){const s=o.peek(magicLength+7&-8);return s&&s.byteLength>=4?checkForMagicArrowString(s)?new RecordBatchFileReader(new RecordBatchFileReaderImpl(o.read())):new RecordBatchStreamReader(new RecordBatchStreamReaderImpl(o)):new RecordBatchStreamReader(new RecordBatchStreamReaderImpl(function*(){}()))}async function fromAsyncByteStream(o){const s=await o.peek(magicLength+7&-8);return s&&s.byteLength>=4?checkForMagicArrowString(s)?new RecordBatchFileReader(new RecordBatchFileReaderImpl(await o.read())):new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(o)):new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(async function*(){}()))}async function fromFileHandle(o){const{size:s}=await o.stat(),_=new AsyncRandomAccessFile(o,s);return s>=magicX2AndPadding&&checkForMagicArrowString(await _.readAt(0,magicLength+7&-8))?new AsyncRecordBatchFileReader(new AsyncRecordBatchFileReaderImpl(_)):new AsyncRecordBatchStreamReader(new AsyncRecordBatchStreamReaderImpl(_))}function toDOMStream(o,s){if(isAsyncIterable(o))return asyncIterableAsReadableDOMStream(o,s);if(isIterable(o))return iterableAsReadableDOMStream(o,s);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function iterableAsReadableDOMStream(o,s){let _=null;const _e=s&&s.type==="bytes"||!1,et=s&&s.highWaterMark||2**24;return new ReadableStream(Tr(or({},s),{start(tt){it(tt,_||(_=o[Symbol.iterator]()))},pull(tt){_?it(tt,_):tt.close()},cancel(){(_&&_.return&&_.return()||!0)&&(_=null)}}),or({highWaterMark:_e?et:void 0},s));function it(tt,rt){let nt,ot=null,st=tt.desiredSize||null;for(;!(ot=rt.next(_e?st:null)).done;)if(ArrayBuffer.isView(ot.value)&&(nt=toUint8Array(ot.value))&&(st!=null&&_e&&(st=st-nt.byteLength+1),ot.value=nt),tt.enqueue(ot.value),st!=null&&--st<=0)return;tt.close()}}function asyncIterableAsReadableDOMStream(o,s){let _=null;const _e=s&&s.type==="bytes"||!1,et=s&&s.highWaterMark||2**24;return new ReadableStream(Tr(or({},s),{async start(tt){await it(tt,_||(_=o[Symbol.asyncIterator]()))},async pull(tt){_?await it(tt,_):tt.close()},async cancel(){(_&&_.return&&await _.return()||!0)&&(_=null)}}),or({highWaterMark:_e?et:void 0},s));async function it(tt,rt){let nt,ot=null,st=tt.desiredSize||null;for(;!(ot=await rt.next(_e?st:null)).done;)if(ArrayBuffer.isView(ot.value)&&(nt=toUint8Array(ot.value))&&(st!=null&&_e&&(st=st-nt.byteLength+1),ot.value=nt),tt.enqueue(ot.value),st!=null&&--st<=0)return;tt.close()}}function builderThroughDOMStream(o){return new BuilderTransform(o)}class BuilderTransform{constructor(s){this._numChunks=0,this._finished=!1,this._bufferedSize=0;const nt=s,{["readableStrategy"]:_,["writableStrategy"]:_e,["queueingStrategy"]:et="count"}=nt,it=Ps(nt,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Builder$2.new(it),this._getSize=et!=="bytes"?chunkLength:chunkByteLength;const{["highWaterMark"]:tt=et==="bytes"?2**14:1e3}=or({},_),{["highWaterMark"]:rt=et==="bytes"?2**14:1e3}=or({},_e);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:ot=>{this._maybeFlush(this._builder,this._controller=ot)},start:ot=>{this._maybeFlush(this._builder,this._controller=ot)}},{highWaterMark:tt,size:et!=="bytes"?chunkLength:chunkByteLength}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:rt,size:ot=>this._writeValueAndReturnChunkSize(ot)})}_writeValueAndReturnChunkSize(s){const _=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(s)),this._bufferedSize-_}_maybeFlush(s,_){_!==null&&(this._bufferedSize>=_.desiredSize&&++this._numChunks&&this._enqueue(_,s.toVector()),s.finished&&((s.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(_,s.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(_,null)))}_enqueue(s,_){this._bufferedSize=0,this._controller=null,_===null?s.close():s.enqueue(_)}}const chunkLength=o=>o.length,chunkByteLength=o=>o.byteLength;function recordBatchReaderThroughDOMStream(o,s){const _=new AsyncByteQueue;let _e=null;const et=new ReadableStream({async cancel(){await _.close()},async start(rt){await tt(rt,_e||(_e=await it()))},async pull(rt){_e?await tt(rt,_e):rt.close()}});return{writable:new WritableStream(_,or({highWaterMark:2**14},o)),readable:et};async function it(){return await(await RecordBatchReader.from(_)).open(s)}async function tt(rt,nt){let ot=rt.desiredSize,st=null;for(;!(st=await nt.next()).done;)if(rt.enqueue(st.value),ot!=null&&--ot<=0)return;rt.close()}}function recordBatchWriterThroughDOMStream(o,s){const _=new this(o),_e=new AsyncByteStream(_),et=new ReadableStream({type:"bytes",async cancel(){await _e.cancel()},async pull(tt){await it(tt)},async start(tt){await it(tt)}},or({highWaterMark:2**14},s));return{writable:new WritableStream(_,o),readable:et};async function it(tt){let rt=null,nt=tt.desiredSize;for(;rt=await _e.read(nt||null);)if(tt.enqueue(rt),nt!=null&&(nt-=rt.byteLength)<=0)return;tt.close()}}class Value{eq(s){return s instanceof Value||(s=new Literal(s)),new Equals(this,s)}le(s){return s instanceof Value||(s=new Literal(s)),new LTeq(this,s)}ge(s){return s instanceof Value||(s=new Literal(s)),new GTeq(this,s)}lt(s){return new Not(this.ge(s))}gt(s){return new Not(this.le(s))}ne(s){return new Not(this.eq(s))}}class Literal extends Value{constructor(s){super(),this.v=s}}class Col extends Value{constructor(s){super(),this.name=s}bind(s){if(!this.colidx){this.colidx=-1;const _e=s.schema.fields;for(let et=-1;++et<_e.length;)if(_e[et].name===this.name){this.colidx=et;break}if(this.colidx<0)throw new Error(`Failed to bind Col "${this.name}"`)}const _=this.vector=s.getChildAt(this.colidx);return _e=>_.get(_e)}}class Predicate{and(...s){return new And(this,...s)}or(...s){return new Or(this,...s)}not(){return new Not(this)}}class ComparisonPredicate extends Predicate{constructor(s,_){super(),this.left=s,this.right=_}bind(s){return this.left instanceof Literal?this.right instanceof Literal?this._bindLitLit(s,this.left,this.right):this._bindLitCol(s,this.left,this.right):this.right instanceof Literal?this._bindColLit(s,this.left,this.right):this._bindColCol(s,this.left,this.right)}}class CombinationPredicate extends Predicate{constructor(...s){super(),this.children=s}}CombinationPredicate.prototype.children=Object.freeze([]);class And extends CombinationPredicate{constructor(...s){s=s.reduce((_,_e)=>_.concat(_e instanceof And?_e.children:_e),[]),super(...s)}bind(s){const _=this.children.map(_e=>_e.bind(s));return(_e,et)=>_.every(it=>it(_e,et))}}class Or extends CombinationPredicate{constructor(...s){s=s.reduce((_,_e)=>_.concat(_e instanceof Or?_e.children:_e),[]),super(...s)}bind(s){const _=this.children.map(_e=>_e.bind(s));return(_e,et)=>_.some(it=>it(_e,et))}}class Equals extends ComparisonPredicate{_bindLitLit(s,_,_e){const et=_.v==_e.v;return()=>et}_bindColCol(s,_,_e){const et=_.bind(s),it=_e.bind(s);return(tt,rt)=>et(tt,rt)==it(tt,rt)}_bindColLit(s,_,_e){const et=_.bind(s);if(_.vector instanceof DictionaryVector){let it;const tt=_.vector;return tt.dictionary!==this.lastDictionary?(it=tt.reverseLookup(_e.v),this.lastDictionary=tt.dictionary,this.lastKey=it):it=this.lastKey,it===-1?()=>!1:rt=>tt.getKey(rt)===it}else return(it,tt)=>et(it,tt)==_e.v}_bindLitCol(s,_,_e){return this._bindColLit(s,_e,_)}}class LTeq extends ComparisonPredicate{_bindLitLit(s,_,_e){const et=_.v<=_e.v;return()=>et}_bindColCol(s,_,_e){const et=_.bind(s),it=_e.bind(s);return(tt,rt)=>et(tt,rt)<=it(tt,rt)}_bindColLit(s,_,_e){const et=_.bind(s);return(it,tt)=>et(it,tt)<=_e.v}_bindLitCol(s,_,_e){const et=_e.bind(s);return(it,tt)=>_.v<=et(it,tt)}}class GTeq extends ComparisonPredicate{_bindLitLit(s,_,_e){const et=_.v>=_e.v;return()=>et}_bindColCol(s,_,_e){const et=_.bind(s),it=_e.bind(s);return(tt,rt)=>et(tt,rt)>=it(tt,rt)}_bindColLit(s,_,_e){const et=_.bind(s);return(it,tt)=>et(it,tt)>=_e.v}_bindLitCol(s,_,_e){const et=_e.bind(s);return(it,tt)=>_.v>=et(it,tt)}}class Not extends Predicate{constructor(s){super(),this.child=s}bind(s){const _=this.child.bind(s);return(_e,et)=>!_(_e,et)}}Table.prototype.countBy=function(o){return new DataFrame(this.chunks).countBy(o)};Table.prototype.scan=function(o,s){return new DataFrame(this.chunks).scan(o,s)};Table.prototype.scanReverse=function(o,s){return new DataFrame(this.chunks).scanReverse(o,s)};Table.prototype.filter=function(o){return new DataFrame(this.chunks).filter(o)};class DataFrame extends Table{filter(s){return new FilteredDataFrame(this.chunks,s)}scan(s,_){const _e=this.chunks,et=_e.length;for(let it=-1;++it<et;){const tt=_e[it];_&&_(tt);for(let rt=-1,nt=tt.length;++rt<nt;)s(rt,tt)}}scanReverse(s,_){const _e=this.chunks,et=_e.length;for(let it=et;--it>=0;){const tt=_e[it];_&&_(tt);for(let rt=tt.length;--rt>=0;)s(rt,tt)}}countBy(s){const _=this.chunks,_e=_.length,et=typeof s=="string"?new Col(s):s;et.bind(_[_e-1]);const it=et.vector;if(!DataType.isDictionary(it.type))throw new Error("countBy currently only supports dictionary-encoded columns");const tt=Math.ceil(Math.log(it.length)/Math.log(256)),rt=tt==4?Uint32Array:tt>=2?Uint16Array:Uint8Array,nt=new rt(it.dictionary.length);for(let ot=-1;++ot<_e;){const st=_[ot];et.bind(st);const at=et.vector.indices;for(let lt=-1,ct=st.length;++lt<ct;){let ht=at.get(lt);ht!==null&&nt[ht]++}}return new CountByResult(it.dictionary,IntVector.from(nt))}}class CountByResult extends Table{constructor(s,_){const _e=new Schema([new Field("values",s.type),new Field("counts",_.type)]);super(new RecordBatch(_e,_.length,[s,_]))}toJSON(){const s=this.getColumnAt(0),_=this.getColumnAt(1),_e={};for(let et=-1;++et<this.length;)_e[s.get(et)]=_.get(et);return _e}}class FilteredDataFrame extends DataFrame{constructor(s,_){super(s),this._predicate=_}scan(s,_){const _e=this._chunks,et=_e.length;for(let it=-1;++it<et;){const tt=_e[it],rt=this._predicate.bind(tt);let nt=!1;for(let ot=-1,st=tt.length;++ot<st;)rt(ot,tt)&&(_&&!nt&&(_(tt),nt=!0),s(ot,tt))}}scanReverse(s,_){const _e=this._chunks,et=_e.length;for(let it=et;--it>=0;){const tt=_e[it],rt=this._predicate.bind(tt);let nt=!1;for(let ot=tt.length;--ot>=0;)rt(ot,tt)&&(_&&!nt&&(_(tt),nt=!0),s(ot,tt))}}count(){let s=0;const _=this._chunks,_e=_.length;for(let et=-1;++et<_e;){const it=_[et],tt=this._predicate.bind(it);for(let rt=-1,nt=it.length;++rt<nt;)tt(rt,it)&&++s}return s}*[Symbol.iterator](){const s=this._chunks,_=s.length;for(let _e=-1;++_e<_;){const et=s[_e],it=this._predicate.bind(et);for(let tt=-1,rt=et.length;++tt<rt;)it(tt,et)&&(yield et.get(tt))}}filter(s){return new FilteredDataFrame(this._chunks,this._predicate.and(s))}countBy(s){const _=this._chunks,_e=_.length,et=typeof s=="string"?new Col(s):s;et.bind(_[_e-1]);const it=et.vector;if(!DataType.isDictionary(it.type))throw new Error("countBy currently only supports dictionary-encoded columns");const tt=Math.ceil(Math.log(it.length)/Math.log(256)),rt=tt==4?Uint32Array:tt>=2?Uint16Array:Uint8Array,nt=new rt(it.dictionary.length);for(let ot=-1;++ot<_e;){const st=_[ot],at=this._predicate.bind(st);et.bind(st);const lt=et.vector.indices;for(let ct=-1,ht=st.length;++ct<ht;){let mt=lt.get(ct);mt!==null&&at(ct,st)&&nt[mt]++}}return new CountByResult(it.dictionary,IntVector.from(nt))}}or(or(or(or(or(or({},util_bn_),util_int_),util_bit_),util_math_),util_buffer_),util_vector_);streamAdapters.toDOMStream=toDOMStream;Builder$2.throughDOM=builderThroughDOMStream;RecordBatchReader.throughDOM=recordBatchReaderThroughDOMStream;RecordBatchWriter.throughDOM=recordBatchWriterThroughDOMStream;/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var ArrowTable=function(){function o(s,_,_e,et){var it=this;this.getCell=function(tt,rt){var nt=tt<it.headerRows&&rt<it.headerColumns,ot=tt>=it.headerRows&&rt<it.headerColumns,st=tt<it.headerRows&&rt>=it.headerColumns;if(nt){var at=["blank"];return rt>0&&at.push("level"+tt),{type:"blank",classNames:at.join(" "),content:""}}else if(st){var lt=rt-it.headerColumns,at=["col_heading","level"+tt,"col"+lt];return{type:"columns",classNames:at.join(" "),content:it.getContent(it.columnsTable,lt,tt)}}else if(ot){var ct=tt-it.headerRows,at=["row_heading","level"+rt,"row"+ct];return{type:"index",id:"T_"+it.uuid+"level"+rt+"_row"+ct,classNames:at.join(" "),content:it.getContent(it.indexTable,ct,rt)}}else{var ct=tt-it.headerRows,lt=rt-it.headerColumns,at=["data","row"+ct,"col"+lt],ht=it.styler?it.getContent(it.styler.displayValuesTable,ct,lt):it.getContent(it.dataTable,ct,lt);return{type:"data",id:"T_"+it.uuid+"row"+ct+"_col"+lt,classNames:at.join(" "),content:ht}}},this.getContent=function(tt,rt,nt){var ot=tt.getColumnAt(nt);if(ot===null)return"";var st=it.getColumnTypeId(tt,nt);switch(st){case Type$1.Timestamp:return it.nanosToDate(ot.get(rt));default:return ot.get(rt)}},this.dataTable=Table.from(s),this.indexTable=Table.from(_),this.columnsTable=Table.from(_e),this.styler=et?{caption:et.caption,displayValuesTable:Table.from(et.displayValues),styles:et.styles,uuid:et.uuid}:void 0}return Object.defineProperty(o.prototype,"rows",{get:function(){return this.indexTable.length+this.columnsTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"columns",{get:function(){return this.indexTable.numCols+this.columnsTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"headerRows",{get:function(){return this.rows-this.dataRows},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"headerColumns",{get:function(){return this.columns-this.dataColumns},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"dataRows",{get:function(){return this.dataTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"dataColumns",{get:function(){return this.dataTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"uuid",{get:function(){return this.styler&&this.styler.uuid},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"caption",{get:function(){return this.styler&&this.styler.caption},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"styles",{get:function(){return this.styler&&this.styler.styles},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"table",{get:function(){return this.dataTable},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"index",{get:function(){return this.indexTable},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"columnTable",{get:function(){return this.columnsTable},enumerable:!0,configurable:!0}),o.prototype.serialize=function(){return{data:this.dataTable.serialize(),index:this.indexTable.serialize(),columns:this.columnsTable.serialize()}},o.prototype.getColumnTypeId=function(s,_){return s.schema.fields[_].type.typeId},o.prototype.nanosToDate=function(s){return new Date(s/1e6)},o}();/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var __assign$1=globalThis&&globalThis.__assign||function(){return __assign$1=Object.assign||function(o){for(var s,_=1,_e=arguments.length;_<_e;_++){s=arguments[_];for(var et in s)Object.prototype.hasOwnProperty.call(s,et)&&(o[et]=s[et])}return o},__assign$1.apply(this,arguments)},ComponentMessageType;(function(o){o.COMPONENT_READY="streamlit:componentReady",o.SET_COMPONENT_VALUE="streamlit:setComponentValue",o.SET_FRAME_HEIGHT="streamlit:setFrameHeight"})(ComponentMessageType||(ComponentMessageType={}));var Streamlit=function(){function o(){}return o.API_VERSION=1,o.RENDER_EVENT="streamlit:render",o.events=new EventTarget,o.registeredMessageListener=!1,o.setComponentReady=function(){o.registeredMessageListener||(window.addEventListener("message",o.onMessageEvent),o.registeredMessageListener=!0),o.sendBackMsg(ComponentMessageType.COMPONENT_READY,{apiVersion:o.API_VERSION})},o.setFrameHeight=function(s){s===void 0&&(s=document.body.scrollHeight),s!==o.lastFrameHeight&&(o.lastFrameHeight=s,o.sendBackMsg(ComponentMessageType.SET_FRAME_HEIGHT,{height:s}))},o.setComponentValue=function(s){var _;s instanceof ArrowTable?(_="dataframe",s=s.serialize()):isTypedArray(s)?(_="bytes",s=new Uint8Array(s.buffer)):s instanceof ArrayBuffer?(_="bytes",s=new Uint8Array(s)):_="json",o.sendBackMsg(ComponentMessageType.SET_COMPONENT_VALUE,{value:s,dataType:_})},o.onMessageEvent=function(s){var _=s.data.type;switch(_){case o.RENDER_EVENT:o.onRenderMessage(s.data);break}},o.onRenderMessage=function(s){var _=s.args;_==null&&(console.error("Got null args in onRenderMessage. This should never happen"),_={});var _e=s.dfs&&s.dfs.length>0?o.argsDataframeToObject(s.dfs):{};_=__assign$1(__assign$1({},_),_e);var et=Boolean(s.disabled),it=s.theme;it&&_injectTheme(it);var tt={disabled:et,args:_,theme:it},rt=new CustomEvent(o.RENDER_EVENT,{detail:tt});o.events.dispatchEvent(rt)},o.argsDataframeToObject=function(s){var _=s.map(function(_e){var et=_e.key,it=_e.value;return[et,o.toArrowTable(it)]});return Object.fromEntries(_)},o.toArrowTable=function(s){var _=s.data,_e=_.data,et=_.index,it=_.columns,tt=_.styler;return new ArrowTable(_e,et,it,tt)},o.sendBackMsg=function(s,_){window.parent.postMessage(__assign$1({isStreamlitMessage:!0,type:s},_),"*")},o}(),_injectTheme=function(o){var s=document.createElement("style");document.head.appendChild(s),s.innerHTML=`
    :root {
      --primary-color: `+o.primaryColor+`;
      --background-color: `+o.backgroundColor+`;
      --secondary-background-color: `+o.secondaryBackgroundColor+`;
      --text-color: `+o.textColor+`;
      --font: `+o.font+`;
    }

    body {
      background-color: var(--background-color);
      color: var(--text-color);
    }
  `};function isTypedArray(o){var s=!1;try{s=o instanceof BigInt64Array||o instanceof BigUint64Array}catch{}return o instanceof Int8Array||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int16Array||o instanceof Uint16Array||o instanceof Int32Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array||s}/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var __extends$1=globalThis&&globalThis.__extends||function(){var o=function(s,_){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_e,et){_e.__proto__=et}||function(_e,et){for(var it in et)et.hasOwnProperty(it)&&(_e[it]=et[it])},o(s,_)};return function(s,_){o(s,_);function _e(){this.constructor=s}s.prototype=_===null?Object.create(_):(_e.prototype=_.prototype,new _e)}}(),StreamlitComponentBase=function(o){__extends$1(s,o);function s(){return o!==null&&o.apply(this,arguments)||this}return s.prototype.componentDidMount=function(){Streamlit.setFrameHeight()},s.prototype.componentDidUpdate=function(){Streamlit.setFrameHeight()},s}(React.PureComponent);function withStreamlitConnection(o){var s=function(_){__extends$1(_e,_);function _e(et){var it=_.call(this,et)||this;return it.componentDidMount=function(){Streamlit.events.addEventListener(Streamlit.RENDER_EVENT,it.onRenderEvent),Streamlit.setComponentReady()},it.componentDidUpdate=function(){it.state.componentError!=null&&Streamlit.setFrameHeight()},it.componentWillUnmount=function(){Streamlit.events.removeEventListener(Streamlit.RENDER_EVENT,it.onRenderEvent)},it.onRenderEvent=function(tt){var rt=tt;it.setState({renderData:rt.detail})},it.render=function(){return it.state.componentError!=null?React.createElement("div",null,React.createElement("h1",null,"Component Error"),React.createElement("span",null,it.state.componentError.message)):it.state.renderData==null?null:React.createElement(o,{width:window.innerWidth,disabled:it.state.renderData.disabled,args:it.state.renderData.args,theme:it.state.renderData.theme})},it.state={renderData:void 0,componentError:void 0},it}return _e.getDerivedStateFromError=function(et){return{componentError:et}},_e}(React.PureComponent);return hoistNonReactStatics_cjs(s,o)}const scriptRel="modulepreload",seen={},base="./",__vitePreload=function(s,_){return!_||_.length===0?s():Promise.all(_.map(_e=>{if(_e=`${base}${_e}`,_e in seen)return;seen[_e]=!0;const et=_e.endsWith(".css"),it=et?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${_e}"]${it}`))return;const tt=document.createElement("link");if(tt.rel=et?"stylesheet":scriptRel,et||(tt.as="script",tt.crossOrigin=""),tt.href=_e,document.head.appendChild(tt),et)return new Promise((rt,nt)=>{tt.addEventListener("load",rt),tt.addEventListener("error",()=>nt(new Error(`Unable to preload CSS for ${_e}`)))})})).then(()=>s())};/*!
 * html2canvas 1.2.0 <https://html2canvas.hertzen.com>
 * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 *//*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var extendStatics=function(o,s){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,_e){_.__proto__=_e}||function(_,_e){for(var et in _e)_e.hasOwnProperty(et)&&(_[et]=_e[et])},extendStatics(o,s)};function __extends(o,s){extendStatics(o,s);function _(){this.constructor=o}o.prototype=s===null?Object.create(s):(_.prototype=s.prototype,new _)}function __awaiter(o,s,_,_e){return new(_||(_=Promise))(function(et,it){function tt(ot){try{nt(_e.next(ot))}catch(st){it(st)}}function rt(ot){try{nt(_e.throw(ot))}catch(st){it(st)}}function nt(ot){ot.done?et(ot.value):new _(function(st){st(ot.value)}).then(tt,rt)}nt((_e=_e.apply(o,s||[])).next())})}function __generator(o,s){var _={label:0,sent:function(){if(it[0]&1)throw it[1];return it[1]},trys:[],ops:[]},_e,et,it,tt;return tt={next:rt(0),throw:rt(1),return:rt(2)},typeof Symbol=="function"&&(tt[Symbol.iterator]=function(){return this}),tt;function rt(ot){return function(st){return nt([ot,st])}}function nt(ot){if(_e)throw new TypeError("Generator is already executing.");for(;_;)try{if(_e=1,et&&(it=ot[0]&2?et.return:ot[0]?et.throw||((it=et.return)&&it.call(et),0):et.next)&&!(it=it.call(et,ot[1])).done)return it;switch(et=0,it&&(ot=[ot[0]&2,it.value]),ot[0]){case 0:case 1:it=ot;break;case 4:return _.label++,{value:ot[1],done:!1};case 5:_.label++,et=ot[1],ot=[0];continue;case 7:ot=_.ops.pop(),_.trys.pop();continue;default:if(it=_.trys,!(it=it.length>0&&it[it.length-1])&&(ot[0]===6||ot[0]===2)){_=0;continue}if(ot[0]===3&&(!it||ot[1]>it[0]&&ot[1]<it[3])){_.label=ot[1];break}if(ot[0]===6&&_.label<it[1]){_.label=it[1],it=ot;break}if(it&&_.label<it[2]){_.label=it[2],_.ops.push(ot);break}it[2]&&_.ops.pop(),_.trys.pop();continue}ot=s.call(o,_)}catch(st){ot=[6,st],et=0}finally{_e=it=0}if(ot[0]&5)throw ot[1];return{value:ot[0]?ot[1]:void 0,done:!0}}}var Bounds=function(){function o(s,_,_e,et){this.left=s,this.top=_,this.width=_e,this.height=et}return o.prototype.add=function(s,_,_e,et){return new o(this.left+s,this.top+_,this.width+_e,this.height+et)},o.fromClientRect=function(s){return new o(s.left,s.top,s.width,s.height)},o}(),parseBounds=function(o){return Bounds.fromClientRect(o.getBoundingClientRect())},toCodePoints=function(o){for(var s=[],_=0,_e=o.length;_<_e;){var et=o.charCodeAt(_++);if(et>=55296&&et<=56319&&_<_e){var it=o.charCodeAt(_++);(it&64512)===56320?s.push(((et&1023)<<10)+(it&1023)+65536):(s.push(et),_--)}else s.push(et)}return s},fromCodePoint=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];if(String.fromCodePoint)return String.fromCodePoint.apply(String,o);var _=o.length;if(!_)return"";for(var _e=[],et=-1,it="";++et<_;){var tt=o[et];tt<=65535?_e.push(tt):(tt-=65536,_e.push((tt>>10)+55296,tt%1024+56320)),(et+1===_||_e.length>16384)&&(it+=String.fromCharCode.apply(String,_e),_e.length=0)}return it},chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var i=0;i<chars.length;i++)lookup[chars.charCodeAt(i)]=i;var decode=function(o){var s=o.length*.75,_=o.length,_e,et=0,it,tt,rt,nt;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var ot=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined"&&typeof Uint8Array.prototype.slice!="undefined"?new ArrayBuffer(s):new Array(s),st=Array.isArray(ot)?ot:new Uint8Array(ot);for(_e=0;_e<_;_e+=4)it=lookup[o.charCodeAt(_e)],tt=lookup[o.charCodeAt(_e+1)],rt=lookup[o.charCodeAt(_e+2)],nt=lookup[o.charCodeAt(_e+3)],st[et++]=it<<2|tt>>4,st[et++]=(tt&15)<<4|rt>>2,st[et++]=(rt&3)<<6|nt&63;return ot},polyUint16Array=function(o){for(var s=o.length,_=[],_e=0;_e<s;_e+=2)_.push(o[_e+1]<<8|o[_e]);return _},polyUint32Array=function(o){for(var s=o.length,_=[],_e=0;_e<s;_e+=4)_.push(o[_e+3]<<24|o[_e+2]<<16|o[_e+1]<<8|o[_e]);return _},UTRIE2_SHIFT_2=5,UTRIE2_SHIFT_1=6+5,UTRIE2_INDEX_SHIFT=2,UTRIE2_SHIFT_1_2=UTRIE2_SHIFT_1-UTRIE2_SHIFT_2,UTRIE2_LSCP_INDEX_2_OFFSET=65536>>UTRIE2_SHIFT_2,UTRIE2_DATA_BLOCK_LENGTH=1<<UTRIE2_SHIFT_2,UTRIE2_DATA_MASK=UTRIE2_DATA_BLOCK_LENGTH-1,UTRIE2_LSCP_INDEX_2_LENGTH=1024>>UTRIE2_SHIFT_2,UTRIE2_INDEX_2_BMP_LENGTH=UTRIE2_LSCP_INDEX_2_OFFSET+UTRIE2_LSCP_INDEX_2_LENGTH,UTRIE2_UTF8_2B_INDEX_2_OFFSET=UTRIE2_INDEX_2_BMP_LENGTH,UTRIE2_UTF8_2B_INDEX_2_LENGTH=32,UTRIE2_INDEX_1_OFFSET=UTRIE2_UTF8_2B_INDEX_2_OFFSET+UTRIE2_UTF8_2B_INDEX_2_LENGTH,UTRIE2_OMITTED_BMP_INDEX_1_LENGTH=65536>>UTRIE2_SHIFT_1,UTRIE2_INDEX_2_BLOCK_LENGTH=1<<UTRIE2_SHIFT_1_2,UTRIE2_INDEX_2_MASK=UTRIE2_INDEX_2_BLOCK_LENGTH-1,slice16=function(o,s,_){return o.slice?o.slice(s,_):new Uint16Array(Array.prototype.slice.call(o,s,_))},slice32=function(o,s,_){return o.slice?o.slice(s,_):new Uint32Array(Array.prototype.slice.call(o,s,_))},createTrieFromBase64=function(o){var s=decode(o),_=Array.isArray(s)?polyUint32Array(s):new Uint32Array(s),_e=Array.isArray(s)?polyUint16Array(s):new Uint16Array(s),et=24,it=slice16(_e,et/2,_[4]/2),tt=_[5]===2?slice16(_e,(et+_[4])/2):slice32(_,Math.ceil((et+_[4])/4));return new Trie(_[0],_[1],_[2],_[3],it,tt)},Trie=function(){function o(s,_,_e,et,it,tt){this.initialValue=s,this.errorValue=_,this.highStart=_e,this.highValueIndex=et,this.index=it,this.data=tt}return o.prototype.get=function(s){var _;if(s>=0){if(s<55296||s>56319&&s<=65535)return _=this.index[s>>UTRIE2_SHIFT_2],_=(_<<UTRIE2_INDEX_SHIFT)+(s&UTRIE2_DATA_MASK),this.data[_];if(s<=65535)return _=this.index[UTRIE2_LSCP_INDEX_2_OFFSET+(s-55296>>UTRIE2_SHIFT_2)],_=(_<<UTRIE2_INDEX_SHIFT)+(s&UTRIE2_DATA_MASK),this.data[_];if(s<this.highStart)return _=UTRIE2_INDEX_1_OFFSET-UTRIE2_OMITTED_BMP_INDEX_1_LENGTH+(s>>UTRIE2_SHIFT_1),_=this.index[_],_+=s>>UTRIE2_SHIFT_2&UTRIE2_INDEX_2_MASK,_=this.index[_],_=(_<<UTRIE2_INDEX_SHIFT)+(s&UTRIE2_DATA_MASK),this.data[_];if(s<=1114111)return this.data[this.highValueIndex]}return this.errorValue},o}(),base64=" ",LETTER_NUMBER_MODIFIER=50,BK=1,CR=2,LF=3,CM=4,NL=5,WJ=7,ZW=8,GL=9,SP=10,ZWJ=11,B2=12,BA=13,BB=14,HY=15,CB=16,CL=17,CP=18,EX=19,IN=20,NS=21,OP=22,QU=23,IS=24,NU=25,PO=26,PR=27,SY=28,AI=29,AL=30,CJ=31,EB=32,EM=33,H2=34,H3=35,HL=36,ID=37,JL=38,JV=39,JT=40,RI=41,SA=42,XX=43,BREAK_MANDATORY="!",BREAK_NOT_ALLOWED="\xD7",BREAK_ALLOWED="\xF7",UnicodeTrie=createTrieFromBase64(base64),ALPHABETICS=[AL,HL],HARD_LINE_BREAKS=[BK,CR,LF,NL],SPACE=[SP,ZW],PREFIX_POSTFIX=[PR,PO],LINE_BREAKS=HARD_LINE_BREAKS.concat(SPACE),KOREAN_SYLLABLE_BLOCK=[JL,JV,JT,H2,H3],HYPHEN=[HY,BA],codePointsToCharacterClasses=function(o,s){s===void 0&&(s="strict");var _=[],_e=[],et=[];return o.forEach(function(it,tt){var rt=UnicodeTrie.get(it);if(rt>LETTER_NUMBER_MODIFIER?(et.push(!0),rt-=LETTER_NUMBER_MODIFIER):et.push(!1),["normal","auto","loose"].indexOf(s)!==-1&&[8208,8211,12316,12448].indexOf(it)!==-1)return _e.push(tt),_.push(CB);if(rt===CM||rt===ZWJ){if(tt===0)return _e.push(tt),_.push(AL);var nt=_[tt-1];return LINE_BREAKS.indexOf(nt)===-1?(_e.push(_e[tt-1]),_.push(nt)):(_e.push(tt),_.push(AL))}if(_e.push(tt),rt===CJ)return _.push(s==="strict"?NS:ID);if(rt===SA||rt===AI)return _.push(AL);if(rt===XX)return it>=131072&&it<=196605||it>=196608&&it<=262141?_.push(ID):_.push(AL);_.push(rt)}),[_e,_,et]},isAdjacentWithSpaceIgnored=function(o,s,_,_e){var et=_e[_];if(Array.isArray(o)?o.indexOf(et)!==-1:o===et)for(var it=_;it<=_e.length;){it++;var tt=_e[it];if(tt===s)return!0;if(tt!==SP)break}if(et===SP)for(var it=_;it>0;){it--;var rt=_e[it];if(Array.isArray(o)?o.indexOf(rt)!==-1:o===rt)for(var nt=_;nt<=_e.length;){nt++;var tt=_e[nt];if(tt===s)return!0;if(tt!==SP)break}if(rt!==SP)break}return!1},previousNonSpaceClassType=function(o,s){for(var _=o;_>=0;){var _e=s[_];if(_e===SP)_--;else return _e}return 0},_lineBreakAtIndex=function(o,s,_,_e,et){if(_[_e]===0)return BREAK_NOT_ALLOWED;var it=_e-1;if(Array.isArray(et)&&et[it]===!0)return BREAK_NOT_ALLOWED;var tt=it-1,rt=it+1,nt=s[it],ot=tt>=0?s[tt]:0,st=s[rt];if(nt===CR&&st===LF)return BREAK_NOT_ALLOWED;if(HARD_LINE_BREAKS.indexOf(nt)!==-1)return BREAK_MANDATORY;if(HARD_LINE_BREAKS.indexOf(st)!==-1||SPACE.indexOf(st)!==-1)return BREAK_NOT_ALLOWED;if(previousNonSpaceClassType(it,s)===ZW)return BREAK_ALLOWED;if(UnicodeTrie.get(o[it])===ZWJ&&(st===ID||st===EB||st===EM)||nt===WJ||st===WJ||nt===GL||[SP,BA,HY].indexOf(nt)===-1&&st===GL||[CL,CP,EX,IS,SY].indexOf(st)!==-1||previousNonSpaceClassType(it,s)===OP||isAdjacentWithSpaceIgnored(QU,OP,it,s)||isAdjacentWithSpaceIgnored([CL,CP],NS,it,s)||isAdjacentWithSpaceIgnored(B2,B2,it,s))return BREAK_NOT_ALLOWED;if(nt===SP)return BREAK_ALLOWED;if(nt===QU||st===QU)return BREAK_NOT_ALLOWED;if(st===CB||nt===CB)return BREAK_ALLOWED;if([BA,HY,NS].indexOf(st)!==-1||nt===BB||ot===HL&&HYPHEN.indexOf(nt)!==-1||nt===SY&&st===HL||st===IN&&ALPHABETICS.concat(IN,EX,NU,ID,EB,EM).indexOf(nt)!==-1||ALPHABETICS.indexOf(st)!==-1&&nt===NU||ALPHABETICS.indexOf(nt)!==-1&&st===NU||nt===PR&&[ID,EB,EM].indexOf(st)!==-1||[ID,EB,EM].indexOf(nt)!==-1&&st===PO||ALPHABETICS.indexOf(nt)!==-1&&PREFIX_POSTFIX.indexOf(st)!==-1||PREFIX_POSTFIX.indexOf(nt)!==-1&&ALPHABETICS.indexOf(st)!==-1||[PR,PO].indexOf(nt)!==-1&&(st===NU||[OP,HY].indexOf(st)!==-1&&s[rt+1]===NU)||[OP,HY].indexOf(nt)!==-1&&st===NU||nt===NU&&[NU,SY,IS].indexOf(st)!==-1)return BREAK_NOT_ALLOWED;if([NU,SY,IS,CL,CP].indexOf(st)!==-1)for(var at=it;at>=0;){var lt=s[at];if(lt===NU)return BREAK_NOT_ALLOWED;if([SY,IS].indexOf(lt)!==-1)at--;else break}if([PR,PO].indexOf(st)!==-1)for(var at=[CL,CP].indexOf(nt)!==-1?tt:it;at>=0;){var lt=s[at];if(lt===NU)return BREAK_NOT_ALLOWED;if([SY,IS].indexOf(lt)!==-1)at--;else break}if(JL===nt&&[JL,JV,H2,H3].indexOf(st)!==-1||[JV,H2].indexOf(nt)!==-1&&[JV,JT].indexOf(st)!==-1||[JT,H3].indexOf(nt)!==-1&&st===JT||KOREAN_SYLLABLE_BLOCK.indexOf(nt)!==-1&&[IN,PO].indexOf(st)!==-1||KOREAN_SYLLABLE_BLOCK.indexOf(st)!==-1&&nt===PR||ALPHABETICS.indexOf(nt)!==-1&&ALPHABETICS.indexOf(st)!==-1||nt===IS&&ALPHABETICS.indexOf(st)!==-1||ALPHABETICS.concat(NU).indexOf(nt)!==-1&&st===OP||ALPHABETICS.concat(NU).indexOf(st)!==-1&&nt===CP)return BREAK_NOT_ALLOWED;if(nt===RI&&st===RI){for(var ct=_[it],ht=1;ct>0&&(ct--,s[ct]===RI);)ht++;if(ht%2!==0)return BREAK_NOT_ALLOWED}return nt===EB&&st===EM?BREAK_NOT_ALLOWED:BREAK_ALLOWED},cssFormattedClasses=function(o,s){s||(s={lineBreak:"normal",wordBreak:"normal"});var _=codePointsToCharacterClasses(o,s.lineBreak),_e=_[0],et=_[1],it=_[2];(s.wordBreak==="break-all"||s.wordBreak==="break-word")&&(et=et.map(function(rt){return[NU,AL,SA].indexOf(rt)!==-1?ID:rt}));var tt=s.wordBreak==="keep-all"?it.map(function(rt,nt){return rt&&o[nt]>=19968&&o[nt]<=40959}):void 0;return[_e,et,tt]},Break=function(){function o(s,_,_e,et){this.codePoints=s,this.required=_===BREAK_MANDATORY,this.start=_e,this.end=et}return o.prototype.slice=function(){return fromCodePoint.apply(void 0,this.codePoints.slice(this.start,this.end))},o}(),LineBreaker=function(o,s){var _=toCodePoints(o),_e=cssFormattedClasses(_,s),et=_e[0],it=_e[1],tt=_e[2],rt=_.length,nt=0,ot=0;return{next:function(){if(ot>=rt)return{done:!0,value:null};for(var st=BREAK_NOT_ALLOWED;ot<rt&&(st=_lineBreakAtIndex(_,it,et,++ot,tt))===BREAK_NOT_ALLOWED;);if(st!==BREAK_NOT_ALLOWED||ot===rt){var at=new Break(_,st,nt,ot);return nt=ot,{value:at,done:!1}}return{done:!0,value:null}}}},TokenType;(function(o){o[o.STRING_TOKEN=0]="STRING_TOKEN",o[o.BAD_STRING_TOKEN=1]="BAD_STRING_TOKEN",o[o.LEFT_PARENTHESIS_TOKEN=2]="LEFT_PARENTHESIS_TOKEN",o[o.RIGHT_PARENTHESIS_TOKEN=3]="RIGHT_PARENTHESIS_TOKEN",o[o.COMMA_TOKEN=4]="COMMA_TOKEN",o[o.HASH_TOKEN=5]="HASH_TOKEN",o[o.DELIM_TOKEN=6]="DELIM_TOKEN",o[o.AT_KEYWORD_TOKEN=7]="AT_KEYWORD_TOKEN",o[o.PREFIX_MATCH_TOKEN=8]="PREFIX_MATCH_TOKEN",o[o.DASH_MATCH_TOKEN=9]="DASH_MATCH_TOKEN",o[o.INCLUDE_MATCH_TOKEN=10]="INCLUDE_MATCH_TOKEN",o[o.LEFT_CURLY_BRACKET_TOKEN=11]="LEFT_CURLY_BRACKET_TOKEN",o[o.RIGHT_CURLY_BRACKET_TOKEN=12]="RIGHT_CURLY_BRACKET_TOKEN",o[o.SUFFIX_MATCH_TOKEN=13]="SUFFIX_MATCH_TOKEN",o[o.SUBSTRING_MATCH_TOKEN=14]="SUBSTRING_MATCH_TOKEN",o[o.DIMENSION_TOKEN=15]="DIMENSION_TOKEN",o[o.PERCENTAGE_TOKEN=16]="PERCENTAGE_TOKEN",o[o.NUMBER_TOKEN=17]="NUMBER_TOKEN",o[o.FUNCTION=18]="FUNCTION",o[o.FUNCTION_TOKEN=19]="FUNCTION_TOKEN",o[o.IDENT_TOKEN=20]="IDENT_TOKEN",o[o.COLUMN_TOKEN=21]="COLUMN_TOKEN",o[o.URL_TOKEN=22]="URL_TOKEN",o[o.BAD_URL_TOKEN=23]="BAD_URL_TOKEN",o[o.CDC_TOKEN=24]="CDC_TOKEN",o[o.CDO_TOKEN=25]="CDO_TOKEN",o[o.COLON_TOKEN=26]="COLON_TOKEN",o[o.SEMICOLON_TOKEN=27]="SEMICOLON_TOKEN",o[o.LEFT_SQUARE_BRACKET_TOKEN=28]="LEFT_SQUARE_BRACKET_TOKEN",o[o.RIGHT_SQUARE_BRACKET_TOKEN=29]="RIGHT_SQUARE_BRACKET_TOKEN",o[o.UNICODE_RANGE_TOKEN=30]="UNICODE_RANGE_TOKEN",o[o.WHITESPACE_TOKEN=31]="WHITESPACE_TOKEN",o[o.EOF_TOKEN=32]="EOF_TOKEN"})(TokenType||(TokenType={}));var FLAG_UNRESTRICTED=1<<0,FLAG_ID=1<<1,FLAG_INTEGER=1<<2,FLAG_NUMBER=1<<3,LINE_FEED=10,SOLIDUS=47,REVERSE_SOLIDUS=92,CHARACTER_TABULATION=9,SPACE$1=32,QUOTATION_MARK=34,EQUALS_SIGN=61,NUMBER_SIGN=35,DOLLAR_SIGN=36,PERCENTAGE_SIGN=37,APOSTROPHE=39,LEFT_PARENTHESIS=40,RIGHT_PARENTHESIS=41,LOW_LINE=95,HYPHEN_MINUS=45,EXCLAMATION_MARK=33,LESS_THAN_SIGN=60,GREATER_THAN_SIGN=62,COMMERCIAL_AT=64,LEFT_SQUARE_BRACKET=91,RIGHT_SQUARE_BRACKET=93,CIRCUMFLEX_ACCENT=61,LEFT_CURLY_BRACKET=123,QUESTION_MARK=63,RIGHT_CURLY_BRACKET=125,VERTICAL_LINE=124,TILDE=126,CONTROL=128,REPLACEMENT_CHARACTER=65533,ASTERISK=42,PLUS_SIGN=43,COMMA=44,COLON=58,SEMICOLON=59,FULL_STOP=46,NULL=0,BACKSPACE=8,LINE_TABULATION=11,SHIFT_OUT=14,INFORMATION_SEPARATOR_ONE=31,DELETE=127,EOF=-1,ZERO=48,a=97,e=101,f$1=102,u=117,z=122,A=65,E=69,F=70,U=85,Z=90,isDigit=function(o){return o>=ZERO&&o<=57},isSurrogateCodePoint=function(o){return o>=55296&&o<=57343},isHex=function(o){return isDigit(o)||o>=A&&o<=F||o>=a&&o<=f$1},isLowerCaseLetter=function(o){return o>=a&&o<=z},isUpperCaseLetter=function(o){return o>=A&&o<=Z},isLetter=function(o){return isLowerCaseLetter(o)||isUpperCaseLetter(o)},isNonASCIICodePoint=function(o){return o>=CONTROL},isWhiteSpace=function(o){return o===LINE_FEED||o===CHARACTER_TABULATION||o===SPACE$1},isNameStartCodePoint=function(o){return isLetter(o)||isNonASCIICodePoint(o)||o===LOW_LINE},isNameCodePoint=function(o){return isNameStartCodePoint(o)||isDigit(o)||o===HYPHEN_MINUS},isNonPrintableCodePoint=function(o){return o>=NULL&&o<=BACKSPACE||o===LINE_TABULATION||o>=SHIFT_OUT&&o<=INFORMATION_SEPARATOR_ONE||o===DELETE},isValidEscape=function(o,s){return o!==REVERSE_SOLIDUS?!1:s!==LINE_FEED},isIdentifierStart=function(o,s,_){return o===HYPHEN_MINUS?isNameStartCodePoint(s)||isValidEscape(s,_):isNameStartCodePoint(o)?!0:!!(o===REVERSE_SOLIDUS&&isValidEscape(o,s))},isNumberStart=function(o,s,_){return o===PLUS_SIGN||o===HYPHEN_MINUS?isDigit(s)?!0:s===FULL_STOP&&isDigit(_):isDigit(o===FULL_STOP?s:o)},stringToNumber=function(o){var s=0,_=1;(o[s]===PLUS_SIGN||o[s]===HYPHEN_MINUS)&&(o[s]===HYPHEN_MINUS&&(_=-1),s++);for(var _e=[];isDigit(o[s]);)_e.push(o[s++]);var et=_e.length?parseInt(fromCodePoint.apply(void 0,_e),10):0;o[s]===FULL_STOP&&s++;for(var it=[];isDigit(o[s]);)it.push(o[s++]);var tt=it.length,rt=tt?parseInt(fromCodePoint.apply(void 0,it),10):0;(o[s]===E||o[s]===e)&&s++;var nt=1;(o[s]===PLUS_SIGN||o[s]===HYPHEN_MINUS)&&(o[s]===HYPHEN_MINUS&&(nt=-1),s++);for(var ot=[];isDigit(o[s]);)ot.push(o[s++]);var st=ot.length?parseInt(fromCodePoint.apply(void 0,ot),10):0;return _*(et+rt*Math.pow(10,-tt))*Math.pow(10,nt*st)},LEFT_PARENTHESIS_TOKEN={type:TokenType.LEFT_PARENTHESIS_TOKEN},RIGHT_PARENTHESIS_TOKEN={type:TokenType.RIGHT_PARENTHESIS_TOKEN},COMMA_TOKEN={type:TokenType.COMMA_TOKEN},SUFFIX_MATCH_TOKEN={type:TokenType.SUFFIX_MATCH_TOKEN},PREFIX_MATCH_TOKEN={type:TokenType.PREFIX_MATCH_TOKEN},COLUMN_TOKEN={type:TokenType.COLUMN_TOKEN},DASH_MATCH_TOKEN={type:TokenType.DASH_MATCH_TOKEN},INCLUDE_MATCH_TOKEN={type:TokenType.INCLUDE_MATCH_TOKEN},LEFT_CURLY_BRACKET_TOKEN={type:TokenType.LEFT_CURLY_BRACKET_TOKEN},RIGHT_CURLY_BRACKET_TOKEN={type:TokenType.RIGHT_CURLY_BRACKET_TOKEN},SUBSTRING_MATCH_TOKEN={type:TokenType.SUBSTRING_MATCH_TOKEN},BAD_URL_TOKEN={type:TokenType.BAD_URL_TOKEN},BAD_STRING_TOKEN={type:TokenType.BAD_STRING_TOKEN},CDO_TOKEN={type:TokenType.CDO_TOKEN},CDC_TOKEN={type:TokenType.CDC_TOKEN},COLON_TOKEN={type:TokenType.COLON_TOKEN},SEMICOLON_TOKEN={type:TokenType.SEMICOLON_TOKEN},LEFT_SQUARE_BRACKET_TOKEN={type:TokenType.LEFT_SQUARE_BRACKET_TOKEN},RIGHT_SQUARE_BRACKET_TOKEN={type:TokenType.RIGHT_SQUARE_BRACKET_TOKEN},WHITESPACE_TOKEN={type:TokenType.WHITESPACE_TOKEN},EOF_TOKEN={type:TokenType.EOF_TOKEN},Tokenizer=function(){function o(){this._value=[]}return o.prototype.write=function(s){this._value=this._value.concat(toCodePoints(s))},o.prototype.read=function(){for(var s=[],_=this.consumeToken();_!==EOF_TOKEN;)s.push(_),_=this.consumeToken();return s},o.prototype.consumeToken=function(){var s=this.consumeCodePoint();switch(s){case QUOTATION_MARK:return this.consumeStringToken(QUOTATION_MARK);case NUMBER_SIGN:var _=this.peekCodePoint(0),_e=this.peekCodePoint(1),et=this.peekCodePoint(2);if(isNameCodePoint(_)||isValidEscape(_e,et)){var it=isIdentifierStart(_,_e,et)?FLAG_ID:FLAG_UNRESTRICTED,tt=this.consumeName();return{type:TokenType.HASH_TOKEN,value:tt,flags:it}}break;case DOLLAR_SIGN:if(this.peekCodePoint(0)===EQUALS_SIGN)return this.consumeCodePoint(),SUFFIX_MATCH_TOKEN;break;case APOSTROPHE:return this.consumeStringToken(APOSTROPHE);case LEFT_PARENTHESIS:return LEFT_PARENTHESIS_TOKEN;case RIGHT_PARENTHESIS:return RIGHT_PARENTHESIS_TOKEN;case ASTERISK:if(this.peekCodePoint(0)===EQUALS_SIGN)return this.consumeCodePoint(),SUBSTRING_MATCH_TOKEN;break;case PLUS_SIGN:if(isNumberStart(s,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(s),this.consumeNumericToken();break;case COMMA:return COMMA_TOKEN;case HYPHEN_MINUS:var rt=s,nt=this.peekCodePoint(0),ot=this.peekCodePoint(1);if(isNumberStart(rt,nt,ot))return this.reconsumeCodePoint(s),this.consumeNumericToken();if(isIdentifierStart(rt,nt,ot))return this.reconsumeCodePoint(s),this.consumeIdentLikeToken();if(nt===HYPHEN_MINUS&&ot===GREATER_THAN_SIGN)return this.consumeCodePoint(),this.consumeCodePoint(),CDC_TOKEN;break;case FULL_STOP:if(isNumberStart(s,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(s),this.consumeNumericToken();break;case SOLIDUS:if(this.peekCodePoint(0)===ASTERISK)for(this.consumeCodePoint();;){var st=this.consumeCodePoint();if(st===ASTERISK&&(st=this.consumeCodePoint(),st===SOLIDUS))return this.consumeToken();if(st===EOF)return this.consumeToken()}break;case COLON:return COLON_TOKEN;case SEMICOLON:return SEMICOLON_TOKEN;case LESS_THAN_SIGN:if(this.peekCodePoint(0)===EXCLAMATION_MARK&&this.peekCodePoint(1)===HYPHEN_MINUS&&this.peekCodePoint(2)===HYPHEN_MINUS)return this.consumeCodePoint(),this.consumeCodePoint(),CDO_TOKEN;break;case COMMERCIAL_AT:var at=this.peekCodePoint(0),lt=this.peekCodePoint(1),ct=this.peekCodePoint(2);if(isIdentifierStart(at,lt,ct)){var tt=this.consumeName();return{type:TokenType.AT_KEYWORD_TOKEN,value:tt}}break;case LEFT_SQUARE_BRACKET:return LEFT_SQUARE_BRACKET_TOKEN;case REVERSE_SOLIDUS:if(isValidEscape(s,this.peekCodePoint(0)))return this.reconsumeCodePoint(s),this.consumeIdentLikeToken();break;case RIGHT_SQUARE_BRACKET:return RIGHT_SQUARE_BRACKET_TOKEN;case CIRCUMFLEX_ACCENT:if(this.peekCodePoint(0)===EQUALS_SIGN)return this.consumeCodePoint(),PREFIX_MATCH_TOKEN;break;case LEFT_CURLY_BRACKET:return LEFT_CURLY_BRACKET_TOKEN;case RIGHT_CURLY_BRACKET:return RIGHT_CURLY_BRACKET_TOKEN;case u:case U:var ht=this.peekCodePoint(0),mt=this.peekCodePoint(1);return ht===PLUS_SIGN&&(isHex(mt)||mt===QUESTION_MARK)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(s),this.consumeIdentLikeToken();case VERTICAL_LINE:if(this.peekCodePoint(0)===EQUALS_SIGN)return this.consumeCodePoint(),DASH_MATCH_TOKEN;if(this.peekCodePoint(0)===VERTICAL_LINE)return this.consumeCodePoint(),COLUMN_TOKEN;break;case TILDE:if(this.peekCodePoint(0)===EQUALS_SIGN)return this.consumeCodePoint(),INCLUDE_MATCH_TOKEN;break;case EOF:return EOF_TOKEN}return isWhiteSpace(s)?(this.consumeWhiteSpace(),WHITESPACE_TOKEN):isDigit(s)?(this.reconsumeCodePoint(s),this.consumeNumericToken()):isNameStartCodePoint(s)?(this.reconsumeCodePoint(s),this.consumeIdentLikeToken()):{type:TokenType.DELIM_TOKEN,value:fromCodePoint(s)}},o.prototype.consumeCodePoint=function(){var s=this._value.shift();return typeof s=="undefined"?-1:s},o.prototype.reconsumeCodePoint=function(s){this._value.unshift(s)},o.prototype.peekCodePoint=function(s){return s>=this._value.length?-1:this._value[s]},o.prototype.consumeUnicodeRangeToken=function(){for(var s=[],_=this.consumeCodePoint();isHex(_)&&s.length<6;)s.push(_),_=this.consumeCodePoint();for(var _e=!1;_===QUESTION_MARK&&s.length<6;)s.push(_),_=this.consumeCodePoint(),_e=!0;if(_e){var et=parseInt(fromCodePoint.apply(void 0,s.map(function(nt){return nt===QUESTION_MARK?ZERO:nt})),16),it=parseInt(fromCodePoint.apply(void 0,s.map(function(nt){return nt===QUESTION_MARK?F:nt})),16);return{type:TokenType.UNICODE_RANGE_TOKEN,start:et,end:it}}var tt=parseInt(fromCodePoint.apply(void 0,s),16);if(this.peekCodePoint(0)===HYPHEN_MINUS&&isHex(this.peekCodePoint(1))){this.consumeCodePoint(),_=this.consumeCodePoint();for(var rt=[];isHex(_)&&rt.length<6;)rt.push(_),_=this.consumeCodePoint();var it=parseInt(fromCodePoint.apply(void 0,rt),16);return{type:TokenType.UNICODE_RANGE_TOKEN,start:tt,end:it}}else return{type:TokenType.UNICODE_RANGE_TOKEN,start:tt,end:tt}},o.prototype.consumeIdentLikeToken=function(){var s=this.consumeName();return s.toLowerCase()==="url"&&this.peekCodePoint(0)===LEFT_PARENTHESIS?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===LEFT_PARENTHESIS?(this.consumeCodePoint(),{type:TokenType.FUNCTION_TOKEN,value:s}):{type:TokenType.IDENT_TOKEN,value:s}},o.prototype.consumeUrlToken=function(){var s=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===EOF)return{type:TokenType.URL_TOKEN,value:""};var _=this.peekCodePoint(0);if(_===APOSTROPHE||_===QUOTATION_MARK){var _e=this.consumeStringToken(this.consumeCodePoint());return _e.type===TokenType.STRING_TOKEN&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===EOF||this.peekCodePoint(0)===RIGHT_PARENTHESIS)?(this.consumeCodePoint(),{type:TokenType.URL_TOKEN,value:_e.value}):(this.consumeBadUrlRemnants(),BAD_URL_TOKEN)}for(;;){var et=this.consumeCodePoint();if(et===EOF||et===RIGHT_PARENTHESIS)return{type:TokenType.URL_TOKEN,value:fromCodePoint.apply(void 0,s)};if(isWhiteSpace(et))return this.consumeWhiteSpace(),this.peekCodePoint(0)===EOF||this.peekCodePoint(0)===RIGHT_PARENTHESIS?(this.consumeCodePoint(),{type:TokenType.URL_TOKEN,value:fromCodePoint.apply(void 0,s)}):(this.consumeBadUrlRemnants(),BAD_URL_TOKEN);if(et===QUOTATION_MARK||et===APOSTROPHE||et===LEFT_PARENTHESIS||isNonPrintableCodePoint(et))return this.consumeBadUrlRemnants(),BAD_URL_TOKEN;if(et===REVERSE_SOLIDUS)if(isValidEscape(et,this.peekCodePoint(0)))s.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),BAD_URL_TOKEN;else s.push(et)}},o.prototype.consumeWhiteSpace=function(){for(;isWhiteSpace(this.peekCodePoint(0));)this.consumeCodePoint()},o.prototype.consumeBadUrlRemnants=function(){for(;;){var s=this.consumeCodePoint();if(s===RIGHT_PARENTHESIS||s===EOF)return;isValidEscape(s,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},o.prototype.consumeStringSlice=function(s){for(var _=6e4,_e="";s>0;){var et=Math.min(_,s);_e+=fromCodePoint.apply(void 0,this._value.splice(0,et)),s-=et}return this._value.shift(),_e},o.prototype.consumeStringToken=function(s){var _="",_e=0;do{var et=this._value[_e];if(et===EOF||et===void 0||et===s)return _+=this.consumeStringSlice(_e),{type:TokenType.STRING_TOKEN,value:_};if(et===LINE_FEED)return this._value.splice(0,_e),BAD_STRING_TOKEN;if(et===REVERSE_SOLIDUS){var it=this._value[_e+1];it!==EOF&&it!==void 0&&(it===LINE_FEED?(_+=this.consumeStringSlice(_e),_e=-1,this._value.shift()):isValidEscape(et,it)&&(_+=this.consumeStringSlice(_e),_+=fromCodePoint(this.consumeEscapedCodePoint()),_e=-1))}_e++}while(!0)},o.prototype.consumeNumber=function(){var s=[],_=FLAG_INTEGER,_e=this.peekCodePoint(0);for((_e===PLUS_SIGN||_e===HYPHEN_MINUS)&&s.push(this.consumeCodePoint());isDigit(this.peekCodePoint(0));)s.push(this.consumeCodePoint());_e=this.peekCodePoint(0);var et=this.peekCodePoint(1);if(_e===FULL_STOP&&isDigit(et))for(s.push(this.consumeCodePoint(),this.consumeCodePoint()),_=FLAG_NUMBER;isDigit(this.peekCodePoint(0));)s.push(this.consumeCodePoint());_e=this.peekCodePoint(0),et=this.peekCodePoint(1);var it=this.peekCodePoint(2);if((_e===E||_e===e)&&((et===PLUS_SIGN||et===HYPHEN_MINUS)&&isDigit(it)||isDigit(et)))for(s.push(this.consumeCodePoint(),this.consumeCodePoint()),_=FLAG_NUMBER;isDigit(this.peekCodePoint(0));)s.push(this.consumeCodePoint());return[stringToNumber(s),_]},o.prototype.consumeNumericToken=function(){var s=this.consumeNumber(),_=s[0],_e=s[1],et=this.peekCodePoint(0),it=this.peekCodePoint(1),tt=this.peekCodePoint(2);if(isIdentifierStart(et,it,tt)){var rt=this.consumeName();return{type:TokenType.DIMENSION_TOKEN,number:_,flags:_e,unit:rt}}return et===PERCENTAGE_SIGN?(this.consumeCodePoint(),{type:TokenType.PERCENTAGE_TOKEN,number:_,flags:_e}):{type:TokenType.NUMBER_TOKEN,number:_,flags:_e}},o.prototype.consumeEscapedCodePoint=function(){var s=this.consumeCodePoint();if(isHex(s)){for(var _=fromCodePoint(s);isHex(this.peekCodePoint(0))&&_.length<6;)_+=fromCodePoint(this.consumeCodePoint());isWhiteSpace(this.peekCodePoint(0))&&this.consumeCodePoint();var _e=parseInt(_,16);return _e===0||isSurrogateCodePoint(_e)||_e>1114111?REPLACEMENT_CHARACTER:_e}return s===EOF?REPLACEMENT_CHARACTER:s},o.prototype.consumeName=function(){for(var s="";;){var _=this.consumeCodePoint();if(isNameCodePoint(_))s+=fromCodePoint(_);else if(isValidEscape(_,this.peekCodePoint(0)))s+=fromCodePoint(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(_),s}},o}(),Parser=function(){function o(s){this._tokens=s}return o.create=function(s){var _=new Tokenizer;return _.write(s),new o(_.read())},o.parseValue=function(s){return o.create(s).parseComponentValue()},o.parseValues=function(s){return o.create(s).parseComponentValues()},o.prototype.parseComponentValue=function(){for(var s=this.consumeToken();s.type===TokenType.WHITESPACE_TOKEN;)s=this.consumeToken();if(s.type===TokenType.EOF_TOKEN)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(s);var _=this.consumeComponentValue();do s=this.consumeToken();while(s.type===TokenType.WHITESPACE_TOKEN);if(s.type===TokenType.EOF_TOKEN)return _;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},o.prototype.parseComponentValues=function(){for(var s=[];;){var _=this.consumeComponentValue();if(_.type===TokenType.EOF_TOKEN)return s;s.push(_),s.push()}},o.prototype.consumeComponentValue=function(){var s=this.consumeToken();switch(s.type){case TokenType.LEFT_CURLY_BRACKET_TOKEN:case TokenType.LEFT_SQUARE_BRACKET_TOKEN:case TokenType.LEFT_PARENTHESIS_TOKEN:return this.consumeSimpleBlock(s.type);case TokenType.FUNCTION_TOKEN:return this.consumeFunction(s)}return s},o.prototype.consumeSimpleBlock=function(s){for(var _={type:s,values:[]},_e=this.consumeToken();;){if(_e.type===TokenType.EOF_TOKEN||isEndingTokenFor(_e,s))return _;this.reconsumeToken(_e),_.values.push(this.consumeComponentValue()),_e=this.consumeToken()}},o.prototype.consumeFunction=function(s){for(var _={name:s.value,values:[],type:TokenType.FUNCTION};;){var _e=this.consumeToken();if(_e.type===TokenType.EOF_TOKEN||_e.type===TokenType.RIGHT_PARENTHESIS_TOKEN)return _;this.reconsumeToken(_e),_.values.push(this.consumeComponentValue())}},o.prototype.consumeToken=function(){var s=this._tokens.shift();return typeof s=="undefined"?EOF_TOKEN:s},o.prototype.reconsumeToken=function(s){this._tokens.unshift(s)},o}(),isDimensionToken=function(o){return o.type===TokenType.DIMENSION_TOKEN},isNumberToken=function(o){return o.type===TokenType.NUMBER_TOKEN},isIdentToken=function(o){return o.type===TokenType.IDENT_TOKEN},isStringToken=function(o){return o.type===TokenType.STRING_TOKEN},isIdentWithValue=function(o,s){return isIdentToken(o)&&o.value===s},nonWhiteSpace=function(o){return o.type!==TokenType.WHITESPACE_TOKEN},nonFunctionArgSeparator=function(o){return o.type!==TokenType.WHITESPACE_TOKEN&&o.type!==TokenType.COMMA_TOKEN},parseFunctionArgs=function(o){var s=[],_=[];return o.forEach(function(_e){if(_e.type===TokenType.COMMA_TOKEN){if(_.length===0)throw new Error("Error parsing function args, zero tokens for arg");s.push(_),_=[];return}_e.type!==TokenType.WHITESPACE_TOKEN&&_.push(_e)}),_.length&&s.push(_),s},isEndingTokenFor=function(o,s){return s===TokenType.LEFT_CURLY_BRACKET_TOKEN&&o.type===TokenType.RIGHT_CURLY_BRACKET_TOKEN||s===TokenType.LEFT_SQUARE_BRACKET_TOKEN&&o.type===TokenType.RIGHT_SQUARE_BRACKET_TOKEN?!0:s===TokenType.LEFT_PARENTHESIS_TOKEN&&o.type===TokenType.RIGHT_PARENTHESIS_TOKEN},isLength=function(o){return o.type===TokenType.NUMBER_TOKEN||o.type===TokenType.DIMENSION_TOKEN},isLengthPercentage=function(o){return o.type===TokenType.PERCENTAGE_TOKEN||isLength(o)},parseLengthPercentageTuple=function(o){return o.length>1?[o[0],o[1]]:[o[0]]},ZERO_LENGTH={type:TokenType.NUMBER_TOKEN,number:0,flags:FLAG_INTEGER},FIFTY_PERCENT={type:TokenType.PERCENTAGE_TOKEN,number:50,flags:FLAG_INTEGER},HUNDRED_PERCENT={type:TokenType.PERCENTAGE_TOKEN,number:100,flags:FLAG_INTEGER},getAbsoluteValue=function(o,s){if(o.type===TokenType.PERCENTAGE_TOKEN)return o.number/100*s;if(isDimensionToken(o))switch(o.unit){case"rem":case"em":return 16*o.number;case"px":default:return o.number}return o.number},DEG="deg",GRAD="grad",RAD="rad",TURN="turn",angle={name:"angle",parse:function(o){if(o.type===TokenType.DIMENSION_TOKEN)switch(o.unit){case DEG:return Math.PI*o.number/180;case GRAD:return Math.PI/200*o.number;case RAD:return o.number;case TURN:return Math.PI*2*o.number}throw new Error("Unsupported angle type")}},isAngle=function(o){return o.type===TokenType.DIMENSION_TOKEN&&(o.unit===DEG||o.unit===GRAD||o.unit===RAD||o.unit===TURN)},parseNamedSide=function(o){var s=o.filter(isIdentToken).map(function(_){return _.value}).join(" ");switch(s){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ZERO_LENGTH,ZERO_LENGTH];case"to top":case"bottom":return deg(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ZERO_LENGTH,HUNDRED_PERCENT];case"to right":case"left":return deg(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[HUNDRED_PERCENT,HUNDRED_PERCENT];case"to bottom":case"top":return deg(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[HUNDRED_PERCENT,ZERO_LENGTH];case"to left":case"right":return deg(270)}return 0},deg=function(o){return Math.PI*o/180},color$1={name:"color",parse:function(o){if(o.type===TokenType.FUNCTION){var s=SUPPORTED_COLOR_FUNCTIONS[o.name];if(typeof s=="undefined")throw new Error('Attempting to parse an unsupported color function "'+o.name+'"');return s(o.values)}if(o.type===TokenType.HASH_TOKEN){if(o.value.length===3){var _=o.value.substring(0,1),_e=o.value.substring(1,2),et=o.value.substring(2,3);return pack(parseInt(_+_,16),parseInt(_e+_e,16),parseInt(et+et,16),1)}if(o.value.length===4){var _=o.value.substring(0,1),_e=o.value.substring(1,2),et=o.value.substring(2,3),it=o.value.substring(3,4);return pack(parseInt(_+_,16),parseInt(_e+_e,16),parseInt(et+et,16),parseInt(it+it,16)/255)}if(o.value.length===6){var _=o.value.substring(0,2),_e=o.value.substring(2,4),et=o.value.substring(4,6);return pack(parseInt(_,16),parseInt(_e,16),parseInt(et,16),1)}if(o.value.length===8){var _=o.value.substring(0,2),_e=o.value.substring(2,4),et=o.value.substring(4,6),it=o.value.substring(6,8);return pack(parseInt(_,16),parseInt(_e,16),parseInt(et,16),parseInt(it,16)/255)}}if(o.type===TokenType.IDENT_TOKEN){var tt=COLORS[o.value.toUpperCase()];if(typeof tt!="undefined")return tt}return COLORS.TRANSPARENT}},isTransparent=function(o){return(255&o)===0},pack=function(o,s,_,_e){return(o<<24|s<<16|_<<8|Math.round(_e*255)<<0)>>>0},getTokenColorValue=function(o,s){if(o.type===TokenType.NUMBER_TOKEN)return o.number;if(o.type===TokenType.PERCENTAGE_TOKEN){var _=s===3?1:255;return s===3?o.number/100*_:Math.round(o.number/100*_)}return 0},rgb=function(o){var s=o.filter(nonFunctionArgSeparator);if(s.length===3){var _=s.map(getTokenColorValue),_e=_[0],et=_[1],it=_[2];return pack(_e,et,it,1)}if(s.length===4){var tt=s.map(getTokenColorValue),_e=tt[0],et=tt[1],it=tt[2],rt=tt[3];return pack(_e,et,it,rt)}return 0};function hue2rgb(o,s,_){return _<0&&(_+=1),_>=1&&(_-=1),_<1/6?(s-o)*_*6+o:_<1/2?s:_<2/3?(s-o)*6*(2/3-_)+o:o}var hsl=function(o){var s=o.filter(nonFunctionArgSeparator),_=s[0],_e=s[1],et=s[2],it=s[3],tt=(_.type===TokenType.NUMBER_TOKEN?deg(_.number):angle.parse(_))/(Math.PI*2),rt=isLengthPercentage(_e)?_e.number/100:0,nt=isLengthPercentage(et)?et.number/100:0,ot=typeof it!="undefined"&&isLengthPercentage(it)?getAbsoluteValue(it,1):1;if(rt===0)return pack(nt*255,nt*255,nt*255,1);var st=nt<=.5?nt*(rt+1):nt+rt-nt*rt,at=nt*2-st,lt=hue2rgb(at,st,tt+1/3),ct=hue2rgb(at,st,tt),ht=hue2rgb(at,st,tt-1/3);return pack(lt*255,ct*255,ht*255,ot)},SUPPORTED_COLOR_FUNCTIONS={hsl,hsla:hsl,rgb,rgba:rgb},COLORS={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},PropertyDescriptorParsingType;(function(o){o[o.VALUE=0]="VALUE",o[o.LIST=1]="LIST",o[o.IDENT_VALUE=2]="IDENT_VALUE",o[o.TYPE_VALUE=3]="TYPE_VALUE",o[o.TOKEN_VALUE=4]="TOKEN_VALUE"})(PropertyDescriptorParsingType||(PropertyDescriptorParsingType={}));var BACKGROUND_CLIP;(function(o){o[o.BORDER_BOX=0]="BORDER_BOX",o[o.PADDING_BOX=1]="PADDING_BOX",o[o.CONTENT_BOX=2]="CONTENT_BOX"})(BACKGROUND_CLIP||(BACKGROUND_CLIP={}));var backgroundClip={name:"background-clip",initialValue:"border-box",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(o){return o.map(function(s){if(isIdentToken(s))switch(s.value){case"padding-box":return BACKGROUND_CLIP.PADDING_BOX;case"content-box":return BACKGROUND_CLIP.CONTENT_BOX}return BACKGROUND_CLIP.BORDER_BOX})}},backgroundColor={name:"background-color",initialValue:"transparent",prefix:!1,type:PropertyDescriptorParsingType.TYPE_VALUE,format:"color"},parseColorStop=function(o){var s=color$1.parse(o[0]),_=o[1];return _&&isLengthPercentage(_)?{color:s,stop:_}:{color:s,stop:null}},linearGradient=function(o){var s=deg(180),_=[];return parseFunctionArgs(o).forEach(function(_e,et){if(et===0){var it=_e[0];if(it.type===TokenType.IDENT_TOKEN&&it.value==="to"){s=parseNamedSide(_e);return}else if(isAngle(it)){s=angle.parse(it);return}}var tt=parseColorStop(_e);_.push(tt)}),{angle:s,stops:_,type:CSSImageType.LINEAR_GRADIENT}},prefixLinearGradient=function(o){var s=deg(180),_=[];return parseFunctionArgs(o).forEach(function(_e,et){if(et===0){var it=_e[0];if(it.type===TokenType.IDENT_TOKEN&&["top","left","right","bottom"].indexOf(it.value)!==-1){s=parseNamedSide(_e);return}else if(isAngle(it)){s=(angle.parse(it)+deg(270))%deg(360);return}}var tt=parseColorStop(_e);_.push(tt)}),{angle:s,stops:_,type:CSSImageType.LINEAR_GRADIENT}},testRangeBounds=function(o){var s=123;if(o.createRange){var _=o.createRange();if(_.getBoundingClientRect){var _e=o.createElement("boundtest");_e.style.height=s+"px",_e.style.display="block",o.body.appendChild(_e),_.selectNode(_e);var et=_.getBoundingClientRect(),it=Math.round(et.height);if(o.body.removeChild(_e),it===s)return!0}}return!1},testCORS=function(){return typeof new Image().crossOrigin!="undefined"},testResponseType=function(){return typeof new XMLHttpRequest().responseType=="string"},testSVG=function(o){var s=new Image,_=o.createElement("canvas"),_e=_.getContext("2d");if(!_e)return!1;s.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{_e.drawImage(s,0,0),_.toDataURL()}catch{return!1}return!0},isGreenPixel=function(o){return o[0]===0&&o[1]===255&&o[2]===0&&o[3]===255},testForeignObject=function(o){var s=o.createElement("canvas"),_=100;s.width=_,s.height=_;var _e=s.getContext("2d");if(!_e)return Promise.reject(!1);_e.fillStyle="rgb(0, 255, 0)",_e.fillRect(0,0,_,_);var et=new Image,it=s.toDataURL();et.src=it;var tt=createForeignObjectSVG(_,_,0,0,et);return _e.fillStyle="red",_e.fillRect(0,0,_,_),loadSerializedSVG(tt).then(function(rt){_e.drawImage(rt,0,0);var nt=_e.getImageData(0,0,_,_).data;_e.fillStyle="red",_e.fillRect(0,0,_,_);var ot=o.createElement("div");return ot.style.backgroundImage="url("+it+")",ot.style.height=_+"px",isGreenPixel(nt)?loadSerializedSVG(createForeignObjectSVG(_,_,0,0,ot)):Promise.reject(!1)}).then(function(rt){return _e.drawImage(rt,0,0),isGreenPixel(_e.getImageData(0,0,_,_).data)}).catch(function(){return!1})},createForeignObjectSVG=function(o,s,_,_e,et){var it="http://www.w3.org/2000/svg",tt=document.createElementNS(it,"svg"),rt=document.createElementNS(it,"foreignObject");return tt.setAttributeNS(null,"width",o.toString()),tt.setAttributeNS(null,"height",s.toString()),rt.setAttributeNS(null,"width","100%"),rt.setAttributeNS(null,"height","100%"),rt.setAttributeNS(null,"x",_.toString()),rt.setAttributeNS(null,"y",_e.toString()),rt.setAttributeNS(null,"externalResourcesRequired","true"),tt.appendChild(rt),rt.appendChild(et),tt},loadSerializedSVG=function(o){return new Promise(function(s,_){var _e=new Image;_e.onload=function(){return s(_e)},_e.onerror=_,_e.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(o))})},FEATURES={get SUPPORT_RANGE_BOUNDS(){var o=testRangeBounds(document);return Object.defineProperty(FEATURES,"SUPPORT_RANGE_BOUNDS",{value:o}),o},get SUPPORT_SVG_DRAWING(){var o=testSVG(document);return Object.defineProperty(FEATURES,"SUPPORT_SVG_DRAWING",{value:o}),o},get SUPPORT_FOREIGNOBJECT_DRAWING(){var o=typeof Array.from=="function"&&typeof window.fetch=="function"?testForeignObject(document):Promise.resolve(!1);return Object.defineProperty(FEATURES,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:o}),o},get SUPPORT_CORS_IMAGES(){var o=testCORS();return Object.defineProperty(FEATURES,"SUPPORT_CORS_IMAGES",{value:o}),o},get SUPPORT_RESPONSE_TYPE(){var o=testResponseType();return Object.defineProperty(FEATURES,"SUPPORT_RESPONSE_TYPE",{value:o}),o},get SUPPORT_CORS_XHR(){var o="withCredentials"in new XMLHttpRequest;return Object.defineProperty(FEATURES,"SUPPORT_CORS_XHR",{value:o}),o}},Logger=function(){function o(s){var _=s.id,_e=s.enabled;this.id=_,this.enabled=_e,this.start=Date.now()}return o.prototype.debug=function(){for(var s=[],_=0;_<arguments.length;_++)s[_]=arguments[_];this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,[this.id,this.getTime()+"ms"].concat(s)):this.info.apply(this,s))},o.prototype.getTime=function(){return Date.now()-this.start},o.create=function(s){o.instances[s.id]=new o(s)},o.destroy=function(s){delete o.instances[s]},o.getInstance=function(s){var _=o.instances[s];if(typeof _=="undefined")throw new Error("No logger instance found with id "+s);return _},o.prototype.info=function(){for(var s=[],_=0;_<arguments.length;_++)s[_]=arguments[_];this.enabled&&typeof window!="undefined"&&window.console&&typeof console.info=="function"&&console.info.apply(console,[this.id,this.getTime()+"ms"].concat(s))},o.prototype.error=function(){for(var s=[],_=0;_<arguments.length;_++)s[_]=arguments[_];this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.error=="function"?console.error.apply(console,[this.id,this.getTime()+"ms"].concat(s)):this.info.apply(this,s))},o.instances={},o}(),CacheStorage=function(){function o(){}return o.create=function(s,_){return o._caches[s]=new Cache(s,_)},o.destroy=function(s){delete o._caches[s]},o.open=function(s){var _=o._caches[s];if(typeof _!="undefined")return _;throw new Error('Cache with key "'+s+'" not found')},o.getOrigin=function(s){var _=o._link;return _?(_.href=s,_.href=_.href,_.protocol+_.hostname+_.port):"about:blank"},o.isSameOrigin=function(s){return o.getOrigin(s)===o._origin},o.setContext=function(s){o._link=s.document.createElement("a"),o._origin=o.getOrigin(s.location.href)},o.getInstance=function(){var s=o._current;if(s===null)throw new Error("No cache instance attached");return s},o.attachInstance=function(s){o._current=s},o.detachInstance=function(){o._current=null},o._caches={},o._origin="about:blank",o._current=null,o}(),Cache=function(){function o(s,_){this.id=s,this._options=_,this._cache={}}return o.prototype.addImage=function(s){var _=Promise.resolve();return this.has(s)||(isBlobImage(s)||isRenderable(s))&&(this._cache[s]=this.loadImage(s)),_},o.prototype.match=function(s){return this._cache[s]},o.prototype.loadImage=function(s){return __awaiter(this,void 0,void 0,function(){var _,_e,et,it,tt=this;return __generator(this,function(rt){switch(rt.label){case 0:return _=CacheStorage.isSameOrigin(s),_e=!isInlineImage(s)&&this._options.useCORS===!0&&FEATURES.SUPPORT_CORS_IMAGES&&!_,et=!isInlineImage(s)&&!_&&typeof this._options.proxy=="string"&&FEATURES.SUPPORT_CORS_XHR&&!_e,!_&&this._options.allowTaint===!1&&!isInlineImage(s)&&!et&&!_e?[2]:(it=s,et?[4,this.proxy(it)]:[3,2]);case 1:it=rt.sent(),rt.label=2;case 2:return Logger.getInstance(this.id).debug("Added image "+s.substring(0,256)),[4,new Promise(function(nt,ot){var st=new Image;st.onload=function(){return nt(st)},st.onerror=ot,(isInlineBase64Image(it)||_e)&&(st.crossOrigin="anonymous"),st.src=it,st.complete===!0&&setTimeout(function(){return nt(st)},500),tt._options.imageTimeout>0&&setTimeout(function(){return ot("Timed out ("+tt._options.imageTimeout+"ms) loading image")},tt._options.imageTimeout)})];case 3:return[2,rt.sent()]}})})},o.prototype.has=function(s){return typeof this._cache[s]!="undefined"},o.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},o.prototype.proxy=function(s){var _=this,_e=this._options.proxy;if(!_e)throw new Error("No proxy defined");var et=s.substring(0,256);return new Promise(function(it,tt){var rt=FEATURES.SUPPORT_RESPONSE_TYPE?"blob":"text",nt=new XMLHttpRequest;if(nt.onload=function(){if(nt.status===200)if(rt==="text")it(nt.response);else{var st=new FileReader;st.addEventListener("load",function(){return it(st.result)},!1),st.addEventListener("error",function(at){return tt(at)},!1),st.readAsDataURL(nt.response)}else tt("Failed to proxy resource "+et+" with status code "+nt.status)},nt.onerror=tt,nt.open("GET",_e+"?url="+encodeURIComponent(s)+"&responseType="+rt),rt!=="text"&&nt instanceof XMLHttpRequest&&(nt.responseType=rt),_._options.imageTimeout){var ot=_._options.imageTimeout;nt.timeout=ot,nt.ontimeout=function(){return tt("Timed out ("+ot+"ms) proxying "+et)}}nt.send()})},o}(),INLINE_SVG=/^data:image\/svg\+xml/i,INLINE_BASE64=/^data:image\/.*;base64,/i,INLINE_IMG=/^data:image\/.*/i,isRenderable=function(o){return FEATURES.SUPPORT_SVG_DRAWING||!isSVG(o)},isInlineImage=function(o){return INLINE_IMG.test(o)},isInlineBase64Image=function(o){return INLINE_BASE64.test(o)},isBlobImage=function(o){return o.substr(0,4)==="blob"},isSVG=function(o){return o.substr(-3).toLowerCase()==="svg"||INLINE_SVG.test(o)},webkitGradient=function(o){var s=deg(180),_=[],_e=CSSImageType.LINEAR_GRADIENT,et=CSSRadialShape.CIRCLE,it=CSSRadialExtent.FARTHEST_CORNER,tt=[];return parseFunctionArgs(o).forEach(function(rt,nt){var ot=rt[0];if(nt===0){if(isIdentToken(ot)&&ot.value==="linear"){_e=CSSImageType.LINEAR_GRADIENT;return}else if(isIdentToken(ot)&&ot.value==="radial"){_e=CSSImageType.RADIAL_GRADIENT;return}}if(ot.type===TokenType.FUNCTION){if(ot.name==="from"){var st=color$1.parse(ot.values[0]);_.push({stop:ZERO_LENGTH,color:st})}else if(ot.name==="to"){var st=color$1.parse(ot.values[0]);_.push({stop:HUNDRED_PERCENT,color:st})}else if(ot.name==="color-stop"){var at=ot.values.filter(nonFunctionArgSeparator);if(at.length===2){var st=color$1.parse(at[1]),lt=at[0];isNumberToken(lt)&&_.push({stop:{type:TokenType.PERCENTAGE_TOKEN,number:lt.number*100,flags:lt.flags},color:st})}}}}),_e===CSSImageType.LINEAR_GRADIENT?{angle:(s+deg(180))%deg(360),stops:_,type:_e}:{size:it,shape:et,stops:_,position:tt,type:_e}},CLOSEST_SIDE="closest-side",FARTHEST_SIDE="farthest-side",CLOSEST_CORNER="closest-corner",FARTHEST_CORNER="farthest-corner",CIRCLE="circle",ELLIPSE="ellipse",COVER="cover",CONTAIN="contain",radialGradient=function(o){var s=CSSRadialShape.CIRCLE,_=CSSRadialExtent.FARTHEST_CORNER,_e=[],et=[];return parseFunctionArgs(o).forEach(function(it,tt){var rt=!0;if(tt===0){var nt=!1;rt=it.reduce(function(st,at){if(nt)if(isIdentToken(at))switch(at.value){case"center":return et.push(FIFTY_PERCENT),st;case"top":case"left":return et.push(ZERO_LENGTH),st;case"right":case"bottom":return et.push(HUNDRED_PERCENT),st}else(isLengthPercentage(at)||isLength(at))&&et.push(at);else if(isIdentToken(at))switch(at.value){case CIRCLE:return s=CSSRadialShape.CIRCLE,!1;case ELLIPSE:return s=CSSRadialShape.ELLIPSE,!1;case"at":return nt=!0,!1;case CLOSEST_SIDE:return _=CSSRadialExtent.CLOSEST_SIDE,!1;case COVER:case FARTHEST_SIDE:return _=CSSRadialExtent.FARTHEST_SIDE,!1;case CONTAIN:case CLOSEST_CORNER:return _=CSSRadialExtent.CLOSEST_CORNER,!1;case FARTHEST_CORNER:return _=CSSRadialExtent.FARTHEST_CORNER,!1}else if(isLength(at)||isLengthPercentage(at))return Array.isArray(_)||(_=[]),_.push(at),!1;return st},rt)}if(rt){var ot=parseColorStop(it);_e.push(ot)}}),{size:_,shape:s,stops:_e,position:et,type:CSSImageType.RADIAL_GRADIENT}},prefixRadialGradient=function(o){var s=CSSRadialShape.CIRCLE,_=CSSRadialExtent.FARTHEST_CORNER,_e=[],et=[];return parseFunctionArgs(o).forEach(function(it,tt){var rt=!0;if(tt===0?rt=it.reduce(function(ot,st){if(isIdentToken(st))switch(st.value){case"center":return et.push(FIFTY_PERCENT),!1;case"top":case"left":return et.push(ZERO_LENGTH),!1;case"right":case"bottom":return et.push(HUNDRED_PERCENT),!1}else if(isLengthPercentage(st)||isLength(st))return et.push(st),!1;return ot},rt):tt===1&&(rt=it.reduce(function(ot,st){if(isIdentToken(st))switch(st.value){case CIRCLE:return s=CSSRadialShape.CIRCLE,!1;case ELLIPSE:return s=CSSRadialShape.ELLIPSE,!1;case CONTAIN:case CLOSEST_SIDE:return _=CSSRadialExtent.CLOSEST_SIDE,!1;case FARTHEST_SIDE:return _=CSSRadialExtent.FARTHEST_SIDE,!1;case CLOSEST_CORNER:return _=CSSRadialExtent.CLOSEST_CORNER,!1;case COVER:case FARTHEST_CORNER:return _=CSSRadialExtent.FARTHEST_CORNER,!1}else if(isLength(st)||isLengthPercentage(st))return Array.isArray(_)||(_=[]),_.push(st),!1;return ot},rt)),rt){var nt=parseColorStop(it);_e.push(nt)}}),{size:_,shape:s,stops:_e,position:et,type:CSSImageType.RADIAL_GRADIENT}},CSSImageType;(function(o){o[o.URL=0]="URL",o[o.LINEAR_GRADIENT=1]="LINEAR_GRADIENT",o[o.RADIAL_GRADIENT=2]="RADIAL_GRADIENT"})(CSSImageType||(CSSImageType={}));var CSSRadialShape;(function(o){o[o.CIRCLE=0]="CIRCLE",o[o.ELLIPSE=1]="ELLIPSE"})(CSSRadialShape||(CSSRadialShape={}));var CSSRadialExtent;(function(o){o[o.CLOSEST_SIDE=0]="CLOSEST_SIDE",o[o.FARTHEST_SIDE=1]="FARTHEST_SIDE",o[o.CLOSEST_CORNER=2]="CLOSEST_CORNER",o[o.FARTHEST_CORNER=3]="FARTHEST_CORNER"})(CSSRadialExtent||(CSSRadialExtent={}));var image={name:"image",parse:function(o){if(o.type===TokenType.URL_TOKEN){var s={url:o.value,type:CSSImageType.URL};return CacheStorage.getInstance().addImage(o.value),s}if(o.type===TokenType.FUNCTION){var _=SUPPORTED_IMAGE_FUNCTIONS[o.name];if(typeof _=="undefined")throw new Error('Attempting to parse an unsupported image function "'+o.name+'"');return _(o.values)}throw new Error("Unsupported image type")}};function isSupportedImage(o){return o.type!==TokenType.FUNCTION||SUPPORTED_IMAGE_FUNCTIONS[o.name]}var SUPPORTED_IMAGE_FUNCTIONS={"linear-gradient":linearGradient,"-moz-linear-gradient":prefixLinearGradient,"-ms-linear-gradient":prefixLinearGradient,"-o-linear-gradient":prefixLinearGradient,"-webkit-linear-gradient":prefixLinearGradient,"radial-gradient":radialGradient,"-moz-radial-gradient":prefixRadialGradient,"-ms-radial-gradient":prefixRadialGradient,"-o-radial-gradient":prefixRadialGradient,"-webkit-radial-gradient":prefixRadialGradient,"-webkit-gradient":webkitGradient},backgroundImage={name:"background-image",initialValue:"none",type:PropertyDescriptorParsingType.LIST,prefix:!1,parse:function(o){if(o.length===0)return[];var s=o[0];return s.type===TokenType.IDENT_TOKEN&&s.value==="none"?[]:o.filter(function(_){return nonFunctionArgSeparator(_)&&isSupportedImage(_)}).map(image.parse)}},backgroundOrigin={name:"background-origin",initialValue:"border-box",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(o){return o.map(function(s){if(isIdentToken(s))switch(s.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},backgroundPosition={name:"background-position",initialValue:"0% 0%",type:PropertyDescriptorParsingType.LIST,prefix:!1,parse:function(o){return parseFunctionArgs(o).map(function(s){return s.filter(isLengthPercentage)}).map(parseLengthPercentageTuple)}},BACKGROUND_REPEAT;(function(o){o[o.REPEAT=0]="REPEAT",o[o.NO_REPEAT=1]="NO_REPEAT",o[o.REPEAT_X=2]="REPEAT_X",o[o.REPEAT_Y=3]="REPEAT_Y"})(BACKGROUND_REPEAT||(BACKGROUND_REPEAT={}));var backgroundRepeat={name:"background-repeat",initialValue:"repeat",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(o){return parseFunctionArgs(o).map(function(s){return s.filter(isIdentToken).map(function(_){return _.value}).join(" ")}).map(parseBackgroundRepeat)}},parseBackgroundRepeat=function(o){switch(o){case"no-repeat":return BACKGROUND_REPEAT.NO_REPEAT;case"repeat-x":case"repeat no-repeat":return BACKGROUND_REPEAT.REPEAT_X;case"repeat-y":case"no-repeat repeat":return BACKGROUND_REPEAT.REPEAT_Y;case"repeat":default:return BACKGROUND_REPEAT.REPEAT}},BACKGROUND_SIZE;(function(o){o.AUTO="auto",o.CONTAIN="contain",o.COVER="cover"})(BACKGROUND_SIZE||(BACKGROUND_SIZE={}));var backgroundSize={name:"background-size",initialValue:"0",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(o){return parseFunctionArgs(o).map(function(s){return s.filter(isBackgroundSizeInfoToken)})}},isBackgroundSizeInfoToken=function(o){return isIdentToken(o)||isLengthPercentage(o)},borderColorForSide=function(o){return{name:"border-"+o+"-color",initialValue:"transparent",prefix:!1,type:PropertyDescriptorParsingType.TYPE_VALUE,format:"color"}},borderTopColor=borderColorForSide("top"),borderRightColor=borderColorForSide("right"),borderBottomColor=borderColorForSide("bottom"),borderLeftColor=borderColorForSide("left"),borderRadiusForSide=function(o){return{name:"border-radius-"+o,initialValue:"0 0",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(s){return parseLengthPercentageTuple(s.filter(isLengthPercentage))}}},borderTopLeftRadius=borderRadiusForSide("top-left"),borderTopRightRadius=borderRadiusForSide("top-right"),borderBottomRightRadius=borderRadiusForSide("bottom-right"),borderBottomLeftRadius=borderRadiusForSide("bottom-left"),BORDER_STYLE;(function(o){o[o.NONE=0]="NONE",o[o.SOLID=1]="SOLID"})(BORDER_STYLE||(BORDER_STYLE={}));var borderStyleForSide=function(o){return{name:"border-"+o+"-style",initialValue:"solid",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(s){switch(s){case"none":return BORDER_STYLE.NONE}return BORDER_STYLE.SOLID}}},borderTopStyle=borderStyleForSide("top"),borderRightStyle=borderStyleForSide("right"),borderBottomStyle=borderStyleForSide("bottom"),borderLeftStyle=borderStyleForSide("left"),borderWidthForSide=function(o){return{name:"border-"+o+"-width",initialValue:"0",type:PropertyDescriptorParsingType.VALUE,prefix:!1,parse:function(s){return isDimensionToken(s)?s.number:0}}},borderTopWidth=borderWidthForSide("top"),borderRightWidth=borderWidthForSide("right"),borderBottomWidth=borderWidthForSide("bottom"),borderLeftWidth=borderWidthForSide("left"),color$1$1={name:"color",initialValue:"transparent",prefix:!1,type:PropertyDescriptorParsingType.TYPE_VALUE,format:"color"},display={name:"display",initialValue:"inline-block",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(o){return o.filter(isIdentToken).reduce(function(s,_){return s|parseDisplayValue(_.value)},0)}},parseDisplayValue=function(o){switch(o){case"block":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},FLOAT;(function(o){o[o.NONE=0]="NONE",o[o.LEFT=1]="LEFT",o[o.RIGHT=2]="RIGHT",o[o.INLINE_START=3]="INLINE_START",o[o.INLINE_END=4]="INLINE_END"})(FLOAT||(FLOAT={}));var float={name:"float",initialValue:"none",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"left":return FLOAT.LEFT;case"right":return FLOAT.RIGHT;case"inline-start":return FLOAT.INLINE_START;case"inline-end":return FLOAT.INLINE_END}return FLOAT.NONE}},letterSpacing={name:"letter-spacing",initialValue:"0",prefix:!1,type:PropertyDescriptorParsingType.VALUE,parse:function(o){return o.type===TokenType.IDENT_TOKEN&&o.value==="normal"?0:o.type===TokenType.NUMBER_TOKEN||o.type===TokenType.DIMENSION_TOKEN?o.number:0}},LINE_BREAK;(function(o){o.NORMAL="normal",o.STRICT="strict"})(LINE_BREAK||(LINE_BREAK={}));var lineBreak={name:"line-break",initialValue:"normal",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"strict":return LINE_BREAK.STRICT;case"normal":default:return LINE_BREAK.NORMAL}}},lineHeight={name:"line-height",initialValue:"normal",prefix:!1,type:PropertyDescriptorParsingType.TOKEN_VALUE},listStyleImage={name:"list-style-image",initialValue:"none",type:PropertyDescriptorParsingType.VALUE,prefix:!1,parse:function(o){return o.type===TokenType.IDENT_TOKEN&&o.value==="none"?null:image.parse(o)}},LIST_STYLE_POSITION;(function(o){o[o.INSIDE=0]="INSIDE",o[o.OUTSIDE=1]="OUTSIDE"})(LIST_STYLE_POSITION||(LIST_STYLE_POSITION={}));var listStylePosition={name:"list-style-position",initialValue:"outside",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"inside":return LIST_STYLE_POSITION.INSIDE;case"outside":default:return LIST_STYLE_POSITION.OUTSIDE}}},LIST_STYLE_TYPE;(function(o){o[o.NONE=-1]="NONE",o[o.DISC=0]="DISC",o[o.CIRCLE=1]="CIRCLE",o[o.SQUARE=2]="SQUARE",o[o.DECIMAL=3]="DECIMAL",o[o.CJK_DECIMAL=4]="CJK_DECIMAL",o[o.DECIMAL_LEADING_ZERO=5]="DECIMAL_LEADING_ZERO",o[o.LOWER_ROMAN=6]="LOWER_ROMAN",o[o.UPPER_ROMAN=7]="UPPER_ROMAN",o[o.LOWER_GREEK=8]="LOWER_GREEK",o[o.LOWER_ALPHA=9]="LOWER_ALPHA",o[o.UPPER_ALPHA=10]="UPPER_ALPHA",o[o.ARABIC_INDIC=11]="ARABIC_INDIC",o[o.ARMENIAN=12]="ARMENIAN",o[o.BENGALI=13]="BENGALI",o[o.CAMBODIAN=14]="CAMBODIAN",o[o.CJK_EARTHLY_BRANCH=15]="CJK_EARTHLY_BRANCH",o[o.CJK_HEAVENLY_STEM=16]="CJK_HEAVENLY_STEM",o[o.CJK_IDEOGRAPHIC=17]="CJK_IDEOGRAPHIC",o[o.DEVANAGARI=18]="DEVANAGARI",o[o.ETHIOPIC_NUMERIC=19]="ETHIOPIC_NUMERIC",o[o.GEORGIAN=20]="GEORGIAN",o[o.GUJARATI=21]="GUJARATI",o[o.GURMUKHI=22]="GURMUKHI",o[o.HEBREW=22]="HEBREW",o[o.HIRAGANA=23]="HIRAGANA",o[o.HIRAGANA_IROHA=24]="HIRAGANA_IROHA",o[o.JAPANESE_FORMAL=25]="JAPANESE_FORMAL",o[o.JAPANESE_INFORMAL=26]="JAPANESE_INFORMAL",o[o.KANNADA=27]="KANNADA",o[o.KATAKANA=28]="KATAKANA",o[o.KATAKANA_IROHA=29]="KATAKANA_IROHA",o[o.KHMER=30]="KHMER",o[o.KOREAN_HANGUL_FORMAL=31]="KOREAN_HANGUL_FORMAL",o[o.KOREAN_HANJA_FORMAL=32]="KOREAN_HANJA_FORMAL",o[o.KOREAN_HANJA_INFORMAL=33]="KOREAN_HANJA_INFORMAL",o[o.LAO=34]="LAO",o[o.LOWER_ARMENIAN=35]="LOWER_ARMENIAN",o[o.MALAYALAM=36]="MALAYALAM",o[o.MONGOLIAN=37]="MONGOLIAN",o[o.MYANMAR=38]="MYANMAR",o[o.ORIYA=39]="ORIYA",o[o.PERSIAN=40]="PERSIAN",o[o.SIMP_CHINESE_FORMAL=41]="SIMP_CHINESE_FORMAL",o[o.SIMP_CHINESE_INFORMAL=42]="SIMP_CHINESE_INFORMAL",o[o.TAMIL=43]="TAMIL",o[o.TELUGU=44]="TELUGU",o[o.THAI=45]="THAI",o[o.TIBETAN=46]="TIBETAN",o[o.TRAD_CHINESE_FORMAL=47]="TRAD_CHINESE_FORMAL",o[o.TRAD_CHINESE_INFORMAL=48]="TRAD_CHINESE_INFORMAL",o[o.UPPER_ARMENIAN=49]="UPPER_ARMENIAN",o[o.DISCLOSURE_OPEN=50]="DISCLOSURE_OPEN",o[o.DISCLOSURE_CLOSED=51]="DISCLOSURE_CLOSED"})(LIST_STYLE_TYPE||(LIST_STYLE_TYPE={}));var listStyleType={name:"list-style-type",initialValue:"none",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"disc":return LIST_STYLE_TYPE.DISC;case"circle":return LIST_STYLE_TYPE.CIRCLE;case"square":return LIST_STYLE_TYPE.SQUARE;case"decimal":return LIST_STYLE_TYPE.DECIMAL;case"cjk-decimal":return LIST_STYLE_TYPE.CJK_DECIMAL;case"decimal-leading-zero":return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO;case"lower-roman":return LIST_STYLE_TYPE.LOWER_ROMAN;case"upper-roman":return LIST_STYLE_TYPE.UPPER_ROMAN;case"lower-greek":return LIST_STYLE_TYPE.LOWER_GREEK;case"lower-alpha":return LIST_STYLE_TYPE.LOWER_ALPHA;case"upper-alpha":return LIST_STYLE_TYPE.UPPER_ALPHA;case"arabic-indic":return LIST_STYLE_TYPE.ARABIC_INDIC;case"armenian":return LIST_STYLE_TYPE.ARMENIAN;case"bengali":return LIST_STYLE_TYPE.BENGALI;case"cambodian":return LIST_STYLE_TYPE.CAMBODIAN;case"cjk-earthly-branch":return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH;case"cjk-heavenly-stem":return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM;case"cjk-ideographic":return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC;case"devanagari":return LIST_STYLE_TYPE.DEVANAGARI;case"ethiopic-numeric":return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC;case"georgian":return LIST_STYLE_TYPE.GEORGIAN;case"gujarati":return LIST_STYLE_TYPE.GUJARATI;case"gurmukhi":return LIST_STYLE_TYPE.GURMUKHI;case"hebrew":return LIST_STYLE_TYPE.HEBREW;case"hiragana":return LIST_STYLE_TYPE.HIRAGANA;case"hiragana-iroha":return LIST_STYLE_TYPE.HIRAGANA_IROHA;case"japanese-formal":return LIST_STYLE_TYPE.JAPANESE_FORMAL;case"japanese-informal":return LIST_STYLE_TYPE.JAPANESE_INFORMAL;case"kannada":return LIST_STYLE_TYPE.KANNADA;case"katakana":return LIST_STYLE_TYPE.KATAKANA;case"katakana-iroha":return LIST_STYLE_TYPE.KATAKANA_IROHA;case"khmer":return LIST_STYLE_TYPE.KHMER;case"korean-hangul-formal":return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL;case"korean-hanja-formal":return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL;case"korean-hanja-informal":return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL;case"lao":return LIST_STYLE_TYPE.LAO;case"lower-armenian":return LIST_STYLE_TYPE.LOWER_ARMENIAN;case"malayalam":return LIST_STYLE_TYPE.MALAYALAM;case"mongolian":return LIST_STYLE_TYPE.MONGOLIAN;case"myanmar":return LIST_STYLE_TYPE.MYANMAR;case"oriya":return LIST_STYLE_TYPE.ORIYA;case"persian":return LIST_STYLE_TYPE.PERSIAN;case"simp-chinese-formal":return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL;case"simp-chinese-informal":return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL;case"tamil":return LIST_STYLE_TYPE.TAMIL;case"telugu":return LIST_STYLE_TYPE.TELUGU;case"thai":return LIST_STYLE_TYPE.THAI;case"tibetan":return LIST_STYLE_TYPE.TIBETAN;case"trad-chinese-formal":return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL;case"trad-chinese-informal":return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL;case"upper-armenian":return LIST_STYLE_TYPE.UPPER_ARMENIAN;case"disclosure-open":return LIST_STYLE_TYPE.DISCLOSURE_OPEN;case"disclosure-closed":return LIST_STYLE_TYPE.DISCLOSURE_CLOSED;case"none":default:return LIST_STYLE_TYPE.NONE}}},marginForSide=function(o){return{name:"margin-"+o,initialValue:"0",prefix:!1,type:PropertyDescriptorParsingType.TOKEN_VALUE}},marginTop=marginForSide("top"),marginRight=marginForSide("right"),marginBottom=marginForSide("bottom"),marginLeft=marginForSide("left"),OVERFLOW;(function(o){o[o.VISIBLE=0]="VISIBLE",o[o.HIDDEN=1]="HIDDEN",o[o.SCROLL=2]="SCROLL",o[o.AUTO=3]="AUTO"})(OVERFLOW||(OVERFLOW={}));var overflow={name:"overflow",initialValue:"visible",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(o){return o.filter(isIdentToken).map(function(s){switch(s.value){case"hidden":return OVERFLOW.HIDDEN;case"scroll":return OVERFLOW.SCROLL;case"auto":return OVERFLOW.AUTO;case"visible":default:return OVERFLOW.VISIBLE}})}},OVERFLOW_WRAP;(function(o){o.NORMAL="normal",o.BREAK_WORD="break-word"})(OVERFLOW_WRAP||(OVERFLOW_WRAP={}));var overflowWrap={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"break-word":return OVERFLOW_WRAP.BREAK_WORD;case"normal":default:return OVERFLOW_WRAP.NORMAL}}},paddingForSide=function(o){return{name:"padding-"+o,initialValue:"0",prefix:!1,type:PropertyDescriptorParsingType.TYPE_VALUE,format:"length-percentage"}},paddingTop=paddingForSide("top"),paddingRight=paddingForSide("right"),paddingBottom=paddingForSide("bottom"),paddingLeft=paddingForSide("left"),TEXT_ALIGN;(function(o){o[o.LEFT=0]="LEFT",o[o.CENTER=1]="CENTER",o[o.RIGHT=2]="RIGHT"})(TEXT_ALIGN||(TEXT_ALIGN={}));var textAlign={name:"text-align",initialValue:"left",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"right":return TEXT_ALIGN.RIGHT;case"center":case"justify":return TEXT_ALIGN.CENTER;case"left":default:return TEXT_ALIGN.LEFT}}},POSITION;(function(o){o[o.STATIC=0]="STATIC",o[o.RELATIVE=1]="RELATIVE",o[o.ABSOLUTE=2]="ABSOLUTE",o[o.FIXED=3]="FIXED",o[o.STICKY=4]="STICKY"})(POSITION||(POSITION={}));var position={name:"position",initialValue:"static",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"relative":return POSITION.RELATIVE;case"absolute":return POSITION.ABSOLUTE;case"fixed":return POSITION.FIXED;case"sticky":return POSITION.STICKY}return POSITION.STATIC}},textShadow={name:"text-shadow",initialValue:"none",type:PropertyDescriptorParsingType.LIST,prefix:!1,parse:function(o){return o.length===1&&isIdentWithValue(o[0],"none")?[]:parseFunctionArgs(o).map(function(s){for(var _={color:COLORS.TRANSPARENT,offsetX:ZERO_LENGTH,offsetY:ZERO_LENGTH,blur:ZERO_LENGTH},_e=0,et=0;et<s.length;et++){var it=s[et];isLength(it)?(_e===0?_.offsetX=it:_e===1?_.offsetY=it:_.blur=it,_e++):_.color=color$1.parse(it)}return _})}},TEXT_TRANSFORM;(function(o){o[o.NONE=0]="NONE",o[o.LOWERCASE=1]="LOWERCASE",o[o.UPPERCASE=2]="UPPERCASE",o[o.CAPITALIZE=3]="CAPITALIZE"})(TEXT_TRANSFORM||(TEXT_TRANSFORM={}));var textTransform={name:"text-transform",initialValue:"none",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"uppercase":return TEXT_TRANSFORM.UPPERCASE;case"lowercase":return TEXT_TRANSFORM.LOWERCASE;case"capitalize":return TEXT_TRANSFORM.CAPITALIZE}return TEXT_TRANSFORM.NONE}},transform={name:"transform",initialValue:"none",prefix:!0,type:PropertyDescriptorParsingType.VALUE,parse:function(o){if(o.type===TokenType.IDENT_TOKEN&&o.value==="none")return null;if(o.type===TokenType.FUNCTION){var s=SUPPORTED_TRANSFORM_FUNCTIONS[o.name];if(typeof s=="undefined")throw new Error('Attempting to parse an unsupported transform function "'+o.name+'"');return s(o.values)}return null}},matrix=function(o){var s=o.filter(function(_){return _.type===TokenType.NUMBER_TOKEN}).map(function(_){return _.number});return s.length===6?s:null},matrix3d=function(o){var s=o.filter(function(nt){return nt.type===TokenType.NUMBER_TOKEN}).map(function(nt){return nt.number}),_=s[0],_e=s[1];s[2],s[3];var et=s[4],it=s[5];s[6],s[7],s[8],s[9],s[10],s[11];var tt=s[12],rt=s[13];return s[14],s[15],s.length===16?[_,_e,et,it,tt,rt]:null},SUPPORTED_TRANSFORM_FUNCTIONS={matrix,matrix3d},DEFAULT_VALUE={type:TokenType.PERCENTAGE_TOKEN,number:50,flags:FLAG_INTEGER},DEFAULT=[DEFAULT_VALUE,DEFAULT_VALUE],transformOrigin={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:PropertyDescriptorParsingType.LIST,parse:function(o){var s=o.filter(isLengthPercentage);return s.length!==2?DEFAULT:[s[0],s[1]]}},VISIBILITY;(function(o){o[o.VISIBLE=0]="VISIBLE",o[o.HIDDEN=1]="HIDDEN",o[o.COLLAPSE=2]="COLLAPSE"})(VISIBILITY||(VISIBILITY={}));var visibility={name:"visible",initialValue:"none",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"hidden":return VISIBILITY.HIDDEN;case"collapse":return VISIBILITY.COLLAPSE;case"visible":default:return VISIBILITY.VISIBLE}}},WORD_BREAK;(function(o){o.NORMAL="normal",o.BREAK_ALL="break-all",o.KEEP_ALL="keep-all"})(WORD_BREAK||(WORD_BREAK={}));var wordBreak={name:"word-break",initialValue:"normal",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"break-all":return WORD_BREAK.BREAK_ALL;case"keep-all":return WORD_BREAK.KEEP_ALL;case"normal":default:return WORD_BREAK.NORMAL}}},zIndex={name:"z-index",initialValue:"auto",prefix:!1,type:PropertyDescriptorParsingType.VALUE,parse:function(o){if(o.type===TokenType.IDENT_TOKEN)return{auto:!0,order:0};if(isNumberToken(o))return{auto:!1,order:o.number};throw new Error("Invalid z-index number parsed")}},opacity={name:"opacity",initialValue:"1",type:PropertyDescriptorParsingType.VALUE,prefix:!1,parse:function(o){return isNumberToken(o)?o.number:1}},textDecorationColor={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:PropertyDescriptorParsingType.TYPE_VALUE,format:"color"},textDecorationLine={name:"text-decoration-line",initialValue:"none",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(o){return o.filter(isIdentToken).map(function(s){switch(s.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(s){return s!==0})}},fontFamily={name:"font-family",initialValue:"",prefix:!1,type:PropertyDescriptorParsingType.LIST,parse:function(o){var s=[],_=[];return o.forEach(function(_e){switch(_e.type){case TokenType.IDENT_TOKEN:case TokenType.STRING_TOKEN:s.push(_e.value);break;case TokenType.NUMBER_TOKEN:s.push(_e.number.toString());break;case TokenType.COMMA_TOKEN:_.push(s.join(" ")),s.length=0;break}}),s.length&&_.push(s.join(" ")),_.map(function(_e){return _e.indexOf(" ")===-1?_e:"'"+_e+"'"})}},fontSize={name:"font-size",initialValue:"0",prefix:!1,type:PropertyDescriptorParsingType.TYPE_VALUE,format:"length"},fontWeight={name:"font-weight",initialValue:"normal",type:PropertyDescriptorParsingType.VALUE,prefix:!1,parse:function(o){if(isNumberToken(o))return o.number;if(isIdentToken(o))switch(o.value){case"bold":return 700;case"normal":default:return 400}return 400}},fontVariant={name:"font-variant",initialValue:"none",type:PropertyDescriptorParsingType.LIST,prefix:!1,parse:function(o){return o.filter(isIdentToken).map(function(s){return s.value})}},FONT_STYLE$1;(function(o){o.NORMAL="normal",o.ITALIC="italic",o.OBLIQUE="oblique"})(FONT_STYLE$1||(FONT_STYLE$1={}));var fontStyle={name:"font-style",initialValue:"normal",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"oblique":return FONT_STYLE$1.OBLIQUE;case"italic":return FONT_STYLE$1.ITALIC;case"normal":default:return FONT_STYLE$1.NORMAL}}},contains=function(o,s){return(o&s)!==0};PropertyDescriptorParsingType.LIST;PropertyDescriptorParsingType.LIST;PropertyDescriptorParsingType.LIST;PropertyDescriptorParsingType.LIST;var boxShadow={name:"box-shadow",initialValue:"none",type:PropertyDescriptorParsingType.LIST,prefix:!1,parse:function(o){return o.length===1&&isIdentWithValue(o[0],"none")?[]:parseFunctionArgs(o).map(function(s){for(var _={color:255,offsetX:ZERO_LENGTH,offsetY:ZERO_LENGTH,blur:ZERO_LENGTH,spread:ZERO_LENGTH,inset:!1},_e=0,et=0;et<s.length;et++){var it=s[et];isIdentWithValue(it,"inset")?_.inset=!0:isLength(it)?(_e===0?_.offsetX=it:_e===1?_.offsetY=it:_e===2?_.blur=it:_.spread=it,_e++):_.color=color$1.parse(it)}return _})}},objectFit={name:"object-fit",initialValue:"fill",prefix:!1,type:PropertyDescriptorParsingType.IDENT_VALUE,parse:function(o){switch(o){case"contain":return"contain";case"cover":return"cover";case"none":return"none";case"scale-down":return"scale_down";case"fill":return"fill";default:return"fill"}}},CSSParsedDeclaration=function(){function o(s){this.backgroundClip=parse$1(backgroundClip,s.backgroundClip),this.backgroundColor=parse$1(backgroundColor,s.backgroundColor),this.backgroundImage=parse$1(backgroundImage,s.backgroundImage),this.backgroundOrigin=parse$1(backgroundOrigin,s.backgroundOrigin),this.backgroundPosition=parse$1(backgroundPosition,s.backgroundPosition),this.backgroundRepeat=parse$1(backgroundRepeat,s.backgroundRepeat),this.backgroundSize=parse$1(backgroundSize,s.backgroundSize),this.borderTopColor=parse$1(borderTopColor,s.borderTopColor),this.borderRightColor=parse$1(borderRightColor,s.borderRightColor),this.borderBottomColor=parse$1(borderBottomColor,s.borderBottomColor),this.borderLeftColor=parse$1(borderLeftColor,s.borderLeftColor),this.borderTopLeftRadius=parse$1(borderTopLeftRadius,s.borderTopLeftRadius),this.borderTopRightRadius=parse$1(borderTopRightRadius,s.borderTopRightRadius),this.borderBottomRightRadius=parse$1(borderBottomRightRadius,s.borderBottomRightRadius),this.borderBottomLeftRadius=parse$1(borderBottomLeftRadius,s.borderBottomLeftRadius),this.borderTopStyle=parse$1(borderTopStyle,s.borderTopStyle),this.borderRightStyle=parse$1(borderRightStyle,s.borderRightStyle),this.borderBottomStyle=parse$1(borderBottomStyle,s.borderBottomStyle),this.borderLeftStyle=parse$1(borderLeftStyle,s.borderLeftStyle),this.borderTopWidth=parse$1(borderTopWidth,s.borderTopWidth),this.borderRightWidth=parse$1(borderRightWidth,s.borderRightWidth),this.borderBottomWidth=parse$1(borderBottomWidth,s.borderBottomWidth),this.borderLeftWidth=parse$1(borderLeftWidth,s.borderLeftWidth),this.boxShadow=parse$1(boxShadow,s.boxShadow),this.color=parse$1(color$1$1,s.color),this.display=parse$1(display,s.display),this.float=parse$1(float,s.cssFloat),this.fontFamily=parse$1(fontFamily,s.fontFamily),this.fontSize=parse$1(fontSize,s.fontSize),this.fontStyle=parse$1(fontStyle,s.fontStyle),this.fontVariant=parse$1(fontVariant,s.fontVariant),this.fontWeight=parse$1(fontWeight,s.fontWeight),this.letterSpacing=parse$1(letterSpacing,s.letterSpacing),this.lineBreak=parse$1(lineBreak,s.lineBreak),this.lineHeight=parse$1(lineHeight,s.lineHeight),this.listStyleImage=parse$1(listStyleImage,s.listStyleImage),this.listStylePosition=parse$1(listStylePosition,s.listStylePosition),this.listStyleType=parse$1(listStyleType,s.listStyleType),this.marginTop=parse$1(marginTop,s.marginTop),this.marginRight=parse$1(marginRight,s.marginRight),this.marginBottom=parse$1(marginBottom,s.marginBottom),this.marginLeft=parse$1(marginLeft,s.marginLeft),this.opacity=parse$1(opacity,s.opacity);var _=parse$1(overflow,s.overflow);this.overflowX=_[0],this.overflowY=_[_.length>1?1:0],this.overflowWrap=parse$1(overflowWrap,s.overflowWrap),this.paddingTop=parse$1(paddingTop,s.paddingTop),this.paddingRight=parse$1(paddingRight,s.paddingRight),this.paddingBottom=parse$1(paddingBottom,s.paddingBottom),this.paddingLeft=parse$1(paddingLeft,s.paddingLeft),this.position=parse$1(position,s.position),this.textAlign=parse$1(textAlign,s.textAlign),this.textDecorationColor=parse$1(textDecorationColor,s.textDecorationColor||s.color),this.textDecorationLine=parse$1(textDecorationLine,s.textDecorationLine),this.textShadow=parse$1(textShadow,s.textShadow),this.textTransform=parse$1(textTransform,s.textTransform),this.transform=parse$1(transform,s.transform),this.transformOrigin=parse$1(transformOrigin,s.transformOrigin),this.visibility=parse$1(visibility,s.visibility),this.wordBreak=parse$1(wordBreak,s.wordBreak),this.zIndex=parse$1(zIndex,s.zIndex),this.objectFit=parse$1(objectFit,s.objectFit)}return o.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===VISIBILITY.VISIBLE},o.prototype.isTransparent=function(){return isTransparent(this.backgroundColor)},o.prototype.isTransformed=function(){return this.transform!==null},o.prototype.isPositioned=function(){return this.position!==POSITION.STATIC},o.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},o.prototype.isFloating=function(){return this.float!==FLOAT.NONE},o.prototype.isInlineLevel=function(){return contains(this.display,4)||contains(this.display,33554432)||contains(this.display,268435456)||contains(this.display,536870912)||contains(this.display,67108864)||contains(this.display,134217728)},o}(),parse$1=function(o,s){var _=new Tokenizer,_e=s!==null&&typeof s!="undefined"?s.toString():o.initialValue;_.write(_e);var et=new Parser(_.read());switch(o.type){case PropertyDescriptorParsingType.IDENT_VALUE:var it=et.parseComponentValue();return o.parse(isIdentToken(it)?it.value:o.initialValue);case PropertyDescriptorParsingType.VALUE:return o.parse(et.parseComponentValue());case PropertyDescriptorParsingType.LIST:return o.parse(et.parseComponentValues());case PropertyDescriptorParsingType.TOKEN_VALUE:return et.parseComponentValue();case PropertyDescriptorParsingType.TYPE_VALUE:switch(o.format){case"angle":return angle.parse(et.parseComponentValue());case"color":return color$1.parse(et.parseComponentValue());case"image":return image.parse(et.parseComponentValue());case"length":var tt=et.parseComponentValue();return isLength(tt)?tt:ZERO_LENGTH;case"length-percentage":var rt=et.parseComponentValue();return isLengthPercentage(rt)?rt:ZERO_LENGTH}}throw new Error("Attempting to parse unsupported css format type "+o.format)},ElementContainer=function(){function o(s){this.styles=new CSSParsedDeclaration(window.getComputedStyle(s,null)),this.textNodes=[],this.elements=[],this.styles.transform!==null&&isHTMLElementNode(s)&&(s.style.transform="none"),this.bounds=parseBounds(s),this.flags=0}return o}(),TextBounds=function(){function o(s,_){this.text=s,this.bounds=_}return o}(),parseTextBounds=function(o,s,_){var _e=breakText(o,s),et=[],it=0;return _e.forEach(function(tt){if(s.textDecorationLine.length||tt.trim().length>0)if(FEATURES.SUPPORT_RANGE_BOUNDS)et.push(new TextBounds(tt,getRangeBounds(_,it,tt.length)));else{var rt=_.splitText(tt.length);et.push(new TextBounds(tt,getWrapperBounds(_))),_=rt}else FEATURES.SUPPORT_RANGE_BOUNDS||(_=_.splitText(tt.length));it+=tt.length}),et},getWrapperBounds=function(o){var s=o.ownerDocument;if(s){var _=s.createElement("html2canvaswrapper");_.appendChild(o.cloneNode(!0));var _e=o.parentNode;if(_e){_e.replaceChild(_,o);var et=parseBounds(_);return _.firstChild&&_e.replaceChild(_.firstChild,_),et}}return new Bounds(0,0,0,0)},getRangeBounds=function(o,s,_){var _e=o.ownerDocument;if(!_e)throw new Error("Node has no owner document");var et=_e.createRange();return et.setStart(o,s),et.setEnd(o,s+_),Bounds.fromClientRect(et.getBoundingClientRect())},breakText=function(o,s){return s.letterSpacing!==0?toCodePoints(o).map(function(_){return fromCodePoint(_)}):breakWords(o,s)},breakWords=function(o,s){for(var _=LineBreaker(o,{lineBreak:s.lineBreak,wordBreak:s.overflowWrap===OVERFLOW_WRAP.BREAK_WORD?"break-word":s.wordBreak}),_e=[],et;!(et=_.next()).done;)et.value&&_e.push(et.value.slice());return _e},TextContainer=function(){function o(s,_){this.text=transform$1(s.data,_.textTransform),this.textBounds=parseTextBounds(this.text,_,s)}return o}(),transform$1=function(o,s){switch(s){case TEXT_TRANSFORM.LOWERCASE:return o.toLowerCase();case TEXT_TRANSFORM.CAPITALIZE:return o.replace(CAPITALIZE,capitalize);case TEXT_TRANSFORM.UPPERCASE:return o.toUpperCase();default:return o}},CAPITALIZE=/(^|\s|:|-|\(|\))([a-z])/g,capitalize=function(o,s,_){return o.length>0?s+_.toUpperCase():o},ImageElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this;return _e.src=_.currentSrc||_.src,_e.intrinsicWidth=_.naturalWidth,_e.intrinsicHeight=_.naturalHeight,CacheStorage.getInstance().addImage(_e.src),_e}return s}(ElementContainer),CanvasElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this;return _e.canvas=_,_e.intrinsicWidth=_.width,_e.intrinsicHeight=_.height,_e}return s}(ElementContainer),SVGElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this,et=new XMLSerializer;return _e.svg="data:image/svg+xml,"+encodeURIComponent(et.serializeToString(_)),_e.intrinsicWidth=_.width.baseVal.value,_e.intrinsicHeight=_.height.baseVal.value,CacheStorage.getInstance().addImage(_e.svg),_e}return s}(ElementContainer),LIElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this;return _e.value=_.value,_e}return s}(ElementContainer),OLElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this;return _e.start=_.start,_e.reversed=typeof _.reversed=="boolean"&&_.reversed===!0,_e}return s}(ElementContainer),CHECKBOX_BORDER_RADIUS=[{type:TokenType.DIMENSION_TOKEN,flags:0,unit:"px",number:3}],RADIO_BORDER_RADIUS=[{type:TokenType.PERCENTAGE_TOKEN,flags:0,number:50}],reformatInputBounds=function(o){return o.width>o.height?new Bounds(o.left+(o.width-o.height)/2,o.top,o.height,o.height):o.width<o.height?new Bounds(o.left,o.top+(o.height-o.width)/2,o.width,o.width):o},getInputValue=function(o){var s=o.type===PASSWORD?new Array(o.value.length+1).join("\u2022"):o.value;return s.length===0?o.placeholder||"":s},CHECKBOX="checkbox",RADIO="radio",PASSWORD="password",InputElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this;switch(_e.type=_.type.toLowerCase(),_e.checked=_.checked,_e.value=getInputValue(_),(_e.type===CHECKBOX||_e.type===RADIO)&&(_e.styles.backgroundColor=3739148031,_e.styles.borderTopColor=_e.styles.borderRightColor=_e.styles.borderBottomColor=_e.styles.borderLeftColor=2779096575,_e.styles.borderTopWidth=_e.styles.borderRightWidth=_e.styles.borderBottomWidth=_e.styles.borderLeftWidth=1,_e.styles.borderTopStyle=_e.styles.borderRightStyle=_e.styles.borderBottomStyle=_e.styles.borderLeftStyle=BORDER_STYLE.SOLID,_e.styles.backgroundClip=[BACKGROUND_CLIP.BORDER_BOX],_e.styles.backgroundOrigin=[0],_e.bounds=reformatInputBounds(_e.bounds)),_e.type){case CHECKBOX:_e.styles.borderTopRightRadius=_e.styles.borderTopLeftRadius=_e.styles.borderBottomRightRadius=_e.styles.borderBottomLeftRadius=CHECKBOX_BORDER_RADIUS;break;case RADIO:_e.styles.borderTopRightRadius=_e.styles.borderTopLeftRadius=_e.styles.borderBottomRightRadius=_e.styles.borderBottomLeftRadius=RADIO_BORDER_RADIUS;break}return _e}return s}(ElementContainer),SelectElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this,et=_.options[_.selectedIndex||0];return _e.value=et&&et.text||"",_e}return s}(ElementContainer),TextareaElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this;return _e.value=_.value,_e}return s}(ElementContainer),parseColor=function(o){return color$1.parse(Parser.create(o).parseComponentValue())},IFrameElementContainer=function(o){__extends(s,o);function s(_){var _e=o.call(this,_)||this;_e.src=_.src,_e.width=parseInt(_.width,10)||0,_e.height=parseInt(_.height,10)||0,_e.backgroundColor=_e.styles.backgroundColor;try{if(_.contentWindow&&_.contentWindow.document&&_.contentWindow.document.documentElement){_e.tree=parseTree(_.contentWindow.document.documentElement);var et=_.contentWindow.document.documentElement?parseColor(getComputedStyle(_.contentWindow.document.documentElement).backgroundColor):COLORS.TRANSPARENT,it=_.contentWindow.document.body?parseColor(getComputedStyle(_.contentWindow.document.body).backgroundColor):COLORS.TRANSPARENT;_e.backgroundColor=isTransparent(et)?isTransparent(it)?_e.styles.backgroundColor:it:et}}catch{}return _e}return s}(ElementContainer),LIST_OWNERS=["OL","UL","MENU"],parseNodeTree=function(o,s,_){for(var _e=o.firstChild,et=void 0;_e;_e=et)if(et=_e.nextSibling,isTextNode(_e)&&_e.data.trim().length>0)s.textNodes.push(new TextContainer(_e,s.styles));else if(isElementNode(_e)){var it=createContainer(_e);it.styles.isVisible()&&(createsRealStackingContext(_e,it,_)?it.flags|=4:createsStackingContext(it.styles)&&(it.flags|=2),LIST_OWNERS.indexOf(_e.tagName)!==-1&&(it.flags|=8),s.elements.push(it),!isTextareaElement(_e)&&!isSVGElement(_e)&&!isSelectElement(_e)&&parseNodeTree(_e,it,_))}},createContainer=function(o){return isImageElement(o)?new ImageElementContainer(o):isCanvasElement(o)?new CanvasElementContainer(o):isSVGElement(o)?new SVGElementContainer(o):isLIElement(o)?new LIElementContainer(o):isOLElement(o)?new OLElementContainer(o):isInputElement(o)?new InputElementContainer(o):isSelectElement(o)?new SelectElementContainer(o):isTextareaElement(o)?new TextareaElementContainer(o):isIFrameElement(o)?new IFrameElementContainer(o):new ElementContainer(o)},parseTree=function(o){var s=createContainer(o);return s.flags|=4,parseNodeTree(o,s,s),s},createsRealStackingContext=function(o,s,_){return s.styles.isPositionedWithZIndex()||s.styles.opacity<1||s.styles.isTransformed()||isBodyElement(o)&&_.styles.isTransparent()},createsStackingContext=function(o){return o.isPositioned()||o.isFloating()},isTextNode=function(o){return o.nodeType===Node.TEXT_NODE},isElementNode=function(o){return o.nodeType===Node.ELEMENT_NODE},isHTMLElementNode=function(o){return isElementNode(o)&&typeof o.style!="undefined"&&!isSVGElementNode(o)},isSVGElementNode=function(o){return typeof o.className=="object"},isLIElement=function(o){return o.tagName==="LI"},isOLElement=function(o){return o.tagName==="OL"},isInputElement=function(o){return o.tagName==="INPUT"},isSVGElement=function(o){return o.tagName==="svg"},isBodyElement=function(o){return o.tagName==="BODY"},isCanvasElement=function(o){return o.tagName==="CANVAS"},isImageElement=function(o){return o.tagName==="IMG"},isIFrameElement=function(o){return o.tagName==="IFRAME"},isTextareaElement=function(o){return o.tagName==="TEXTAREA"},isSelectElement=function(o){return o.tagName==="SELECT"},PseudoElementType;(function(o){o[o.BEFORE=0]="BEFORE",o[o.AFTER=1]="AFTER"})(PseudoElementType||(PseudoElementType={}));var PathType;(function(o){o[o.VECTOR=0]="VECTOR",o[o.BEZIER_CURVE=1]="BEZIER_CURVE"})(PathType||(PathType={}));var CORNER;(function(o){o[o.TOP_LEFT=0]="TOP_LEFT",o[o.TOP_RIGHT=1]="TOP_RIGHT",o[o.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",o[o.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(CORNER||(CORNER={}));typeof window!="undefined"&&CacheStorage.setContext(window);class BaseComponent extends React.Component{}Xn(BaseComponent,"memo",(s,_)=>s.value===_.value&&s.interpretation===_.interpretation),Xn(BaseComponent,"postprocess",s=>s);var jsxRuntime={exports:{}},reactJsxRuntime_production_min={};/** @license React v17.0.2
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var f=react.exports,g=60103;reactJsxRuntime_production_min.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var h=Symbol.for;g=h("react.element"),reactJsxRuntime_production_min.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};function q(o,s,_){var _e,et={},it=null,tt=null;_!==void 0&&(it=""+_),s.key!==void 0&&(it=""+s.key),s.ref!==void 0&&(tt=s.ref);for(_e in s)n.call(s,_e)&&!p.hasOwnProperty(_e)&&(et[_e]=s[_e]);if(o&&o.defaultProps)for(_e in s=o.defaultProps,s)et[_e]===void 0&&(et[_e]=s[_e]);return{$$typeof:g,type:o,key:it,ref:tt,props:et,_owner:m.current}}reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;jsxRuntime.exports=reactJsxRuntime_production_min;const jsx=jsxRuntime.exports.jsx,jsxs=jsxRuntime.exports.jsxs,Fragment=jsxRuntime.exports.Fragment;class ComponentExample extends React.Component{render(){return jsx("div",{children:this.props.value})}static async preprocess(s,_,_e){return s}}class FileComponentExample extends ComponentExample{static async preprocess(s,_,_e){return{name:s,data:_+"/"+s,is_example:!0}}}class DataURLComponentExample extends ComponentExample{static async preprocess(s,_,_e){let et=_+"/"+s,it=await fetch(et);if(!it.ok)throw new Error(`HTTP error! status: ${it.status}`);let tt=await it.blob();return new Promise((rt,nt)=>{var ot=new FileReader;ot.addEventListener("load",function(){rt(ot.result)},!1),ot.onerror=()=>nt(this),ot.readAsDataURL(tt)})}}var lib={},microphone={},WORKER_ENABLED=!!(window===window.window&&window.URL&&window.Blob&&window.Worker);function InlineWorker(o,s){var _=this,_e;if(s=s||{},WORKER_ENABLED)return _e=o.toString().trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1],new window.Worker(window.URL.createObjectURL(new window.Blob([_e],{type:"text/javascript"})));function et(it){setTimeout(function(){_.onmessage({data:it})},0)}this.self=s,this.self.postMessage=et,setTimeout(o.bind(s,s),0)}InlineWorker.prototype.postMessage=function(s){var _=this;setTimeout(function(){_.self.onmessage({data:s})},0)};var inlineWorker=InlineWorker;Object.defineProperty(microphone,"__esModule",{value:!0});var _createClass$2=function(){function o(s,_){for(var _e=0;_e<_.length;_e++){var et=_[_e];et.enumerable=et.enumerable||!1,et.configurable=!0,"value"in et&&(et.writable=!0),Object.defineProperty(s,et.key,et)}}return function(s,_,_e){return _&&o(s.prototype,_),_e&&o(s,_e),s}}(),_inlineWorker=inlineWorker,_inlineWorker2=_interopRequireDefault$1(_inlineWorker);function _interopRequireDefault$1(o){return o&&o.__esModule?o:{default:o}}function _classCallCheck$2(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}var defaultConfig$1={bufferLen:4096,numChannels:2,mimeType:"audio/wav"},Microphone=function(){function o(s,_){var _e=this;_classCallCheck$2(this,o),this.config=Object.assign({},defaultConfig$1,_),this.recording=!1,this.callbacks={getBuffer:[],exportWAV:[]},this.context=s.context,this.node=(this.context.createScriptProcessor||this.context.createJavaScriptNode).call(this.context,this.config.bufferLen,this.config.numChannels,this.config.numChannels),this.node.onaudioprocess=function(it){if(!!_e.recording){for(var tt=[],rt=0;rt<_e.config.numChannels;rt++)tt.push(it.inputBuffer.getChannelData(rt));_e.worker.postMessage({command:"record",buffer:tt})}},s.connect(this.node),this.node.connect(this.context.destination);var et={};this.worker=new _inlineWorker2.default(function(){var it=0,tt=[],rt=void 0,nt=void 0;this.onmessage=function(At){switch(At.data.command){case"init":ot(At.data.config);break;case"record":st(At.data.buffer);break;case"exportWAV":at(At.data.type);break;case"getBuffer":lt();break;case"clear":ct();break}};function ot(At){rt=At.sampleRate,nt=At.numChannels,ht()}function st(At){for(var gt=0;gt<nt;gt++)tt[gt].push(At[gt]);it+=At[0].length}function at(At){for(var gt=[],vt=0;vt<nt;vt++)gt.push(mt(tt[vt],it));var yt=void 0;nt===2?yt=dt(gt[0],gt[1]):yt=gt[0];var bt=pt(yt),Ct=new Blob([bt],{type:At});this.postMessage({command:"exportWAV",data:Ct})}function lt(){for(var At=[],gt=0;gt<nt;gt++)At.push(mt(tt[gt],it));this.postMessage({command:"getBuffer",data:At})}function ct(){it=0,tt=[],ht()}function ht(){for(var At=0;At<nt;At++)tt[At]=[]}function mt(At,gt){for(var vt=new Float32Array(gt),yt=0,bt=0;bt<At.length;bt++)vt.set(At[bt],yt),yt+=At[bt].length;return vt}function dt(At,gt){for(var vt=At.length+gt.length,yt=new Float32Array(vt),bt=0,Ct=0;bt<vt;)yt[bt++]=At[Ct],yt[bt++]=gt[Ct],Ct++;return yt}function ft(At,gt,vt){for(var yt=0;yt<vt.length;yt++,gt+=2){var bt=Math.max(-1,Math.min(1,vt[yt]));At.setInt16(gt,bt<0?bt*32768:bt*32767,!0)}}function ut(At,gt,vt){for(var yt=0;yt<vt.length;yt+=1)At.setUint8(gt+yt,vt.charCodeAt(yt))}function pt(At){var gt=new ArrayBuffer(44+At.length*2),vt=new DataView(gt);return ut(vt,0,"RIFF"),vt.setUint32(4,36+At.length*2,!0),ut(vt,8,"WAVE"),ut(vt,12,"fmt "),vt.setUint32(16,16,!0),vt.setUint16(20,1,!0),vt.setUint16(22,nt,!0),vt.setUint32(24,rt,!0),vt.setUint32(28,rt*4,!0),vt.setUint16(32,nt*2,!0),vt.setUint16(34,16,!0),ut(vt,36,"data"),vt.setUint32(40,At.length*2,!0),ft(vt,44,At),vt}},et),this.worker.postMessage({command:"init",config:{sampleRate:this.context.sampleRate,numChannels:this.config.numChannels}}),this.worker.onmessage=function(it){var tt=_e.callbacks[it.data.command].pop();typeof tt=="function"&&tt(it.data.data)}}return _createClass$2(o,[{key:"record",value:function(){this.recording=!0}},{key:"stop",value:function(){this.recording=!1}},{key:"clear",value:function(){this.worker.postMessage({command:"clear"})}},{key:"getBuffer",value:function(_){if(_=_||this.config.callback,!_)throw new Error("Callback not set");this.callbacks.getBuffer.push(_),this.worker.postMessage({command:"getBuffer"})}},{key:"exportWAV",value:function(_,_e){if(_e=_e||this.config.mimeType,_=_||this.config.callback,!_)throw new Error("Callback not set");this.callbacks.exportWAV.push(_),this.worker.postMessage({command:"exportWAV",type:_e})}}]),o}();Microphone.forceDownload=function(s,_){var _e=document.createElement("a");_e.style="display: none",document.body.appendChild(_e);var et=window.URL.createObjectURL(s);_e.href=et,_e.download=_,_e.click(),window.URL.revokeObjectURL(et),document.body.removeChild(_e)};microphone.default=Microphone;Object.defineProperty(lib,"__esModule",{value:!0});var _createClass$1=function(){function o(s,_){for(var _e=0;_e<_.length;_e++){var et=_[_e];et.enumerable=et.enumerable||!1,et.configurable=!0,"value"in et&&(et.writable=!0),Object.defineProperty(s,et.key,et)}}return function(s,_,_e){return _&&o(s.prototype,_),_e&&o(s,_e),s}}(),_microphone=microphone,_microphone2=_interopRequireDefault(_microphone);function _interopRequireDefault(o){return o&&o.__esModule?o:{default:o}}function _classCallCheck$1(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}var defaultConfig={nFrequencyBars:255,onAnalysed:null},Recorder=function(){function o(s){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_classCallCheck$1(this,o),this.config=Object.assign({},defaultConfig,_),this.audioContext=s,this.audioInput=null,this.realAudioInput=null,this.inputPoint=null,this.audioRecorder=null,this.rafID=null,this.analyserContext=null,this.recIndex=0,this.stream=null,this.updateAnalysers=this.updateAnalysers.bind(this)}return _createClass$1(o,[{key:"init",value:function(_){var _e=this;return new Promise(function(et){_e.inputPoint=_e.audioContext.createGain(),_e.stream=_,_e.realAudioInput=_e.audioContext.createMediaStreamSource(_),_e.audioInput=_e.realAudioInput,_e.audioInput.connect(_e.inputPoint),_e.analyserNode=_e.audioContext.createAnalyser(),_e.analyserNode.fftSize=2048,_e.inputPoint.connect(_e.analyserNode),_e.audioRecorder=new _microphone2.default(_e.inputPoint);var it=_e.audioContext.createGain();it.gain.value=0,_e.inputPoint.connect(it),it.connect(_e.audioContext.destination),_e.updateAnalysers(),et()})}},{key:"start",value:function(){var _=this;return new Promise(function(_e,et){if(!_.audioRecorder){et("Not currently recording");return}_.audioRecorder.clear(),_.audioRecorder.record(),_e(_.stream)})}},{key:"stop",value:function(){var _=this;return new Promise(function(_e){_.audioRecorder.stop(),_.audioRecorder.getBuffer(function(et){_.audioRecorder.exportWAV(function(it){return _e({buffer:et,blob:it})})})})}},{key:"updateAnalysers",value:function(){if(this.config.onAnalysed){requestAnimationFrame(this.updateAnalysers);var _=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(_);for(var _e=new Array(255),et=0,it=void 0,tt=0;tt<255;tt+=1)it=Math.floor(_[tt])-Math.floor(_[tt])%5,it!==0&&(et=tt),_e[tt]=it;this.config.onAnalysed({data:_e,lineTo:et})}}},{key:"setOnAnalysed",value:function(_){this.config.onAnalysed=_}}]),o}();Recorder.download=function(s){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"audio";_microphone2.default.forceDownload(s,_+".wav")};lib.default=Recorder;var recorderJs=lib,mimeTypes={},require$$0={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana"},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana"},"image/avcs":{source:"iana"},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}};/*!
 * mime-db
 * Copyright(c) 2014 Jonathan Ong
 * MIT Licensed
 */var mimeDb=require$$0,__viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$2=getAugmentedNamespace(__viteBrowserExternal$1);/*!
 * mime-types
 * Copyright(c) 2014 Jonathan Ong
 * Copyright(c) 2015 Douglas Christopher Wilson
 * MIT Licensed
 */(function(o){var s=mimeDb,_=require$$2.extname,_e=/^\s*([^;\s]*)(?:;|\s|$)/,et=/^text\//i;o.charset=it,o.charsets={lookup:it},o.contentType=tt,o.extension=rt,o.extensions=Object.create(null),o.lookup=nt,o.types=Object.create(null),ot(o.extensions,o.types);function it(st){if(!st||typeof st!="string")return!1;var at=_e.exec(st),lt=at&&s[at[1].toLowerCase()];return lt&&lt.charset?lt.charset:at&&et.test(at[1])?"UTF-8":!1}function tt(st){if(!st||typeof st!="string")return!1;var at=st.indexOf("/")===-1?o.lookup(st):st;if(!at)return!1;if(at.indexOf("charset")===-1){var lt=o.charset(at);lt&&(at+="; charset="+lt.toLowerCase())}return at}function rt(st){if(!st||typeof st!="string")return!1;var at=_e.exec(st),lt=at&&o.extensions[at[1].toLowerCase()];return!lt||!lt.length?!1:lt[0]}function nt(st){if(!st||typeof st!="string")return!1;var at=_("x."+st).toLowerCase().substr(1);return at&&o.types[at]||!1}function ot(st,at){var lt=["nginx","apache",void 0,"iana"];Object.keys(s).forEach(function(ht){var mt=s[ht],dt=mt.extensions;if(!(!dt||!dt.length)){st[ht]=dt;for(var ft=0;ft<dt.length;ft++){var ut=dt[ft];if(at[ut]){var pt=lt.indexOf(s[at[ut]].source),At=lt.indexOf(mt.source);if(at[ut]!=="application/octet-stream"&&(pt>At||pt===At&&at[ut].substr(0,12)==="application/"))continue}at[ut]=ht}}})}})(mimeTypes);function prettyBytes(o){let s=["B","KB","MB","GB","PB"],_=0;for(;o>1024;)o/=1024,_++;let _e=s[_];return o.toFixed(1)+" "+_e}function getSaliencyColor(o){var s=null;return o<0?s=[52,152,219]:s=[231,76,60],colorToString(interpolate$1(Math.abs(o),[255,255,255],s))}function interpolate$1(o,s,_){o>1&&(o=1),o=Math.sqrt(o);var _e=[0,0,0],et;for(et=0;et<3;et++)_e[et]=Math.round(s[et]*(1-o)+_[et]*o);return _e}function colorToString(o){return"rgb("+o[0]+", "+o[1]+", "+o[2]+")"}function getObjectFitSize(o,s,_,_e,et){var it=_e/et,tt=s/_,rt=0,nt=0,ot=o?it>tt:it<tt;return ot?(rt=s,nt=rt/it):(nt=_,rt=nt*it),{width:rt,height:nt,x:(s-rt)/2,y:(_-nt)/2}}function paintSaliency(o,s,_,_e){var et=_/o[0].length,it=_e/o.length,tt=0;o.forEach(function(rt){var nt=0;rt.forEach(function(ot){s.fillStyle=getSaliencyColor(ot),s.fillRect(nt*et,tt*it,et,it),nt++}),tt++})}function array_compare(o,s){if(o.length!=s.length)return!1;for(var _ in o)if(o[_]instanceof Array&&s[_]instanceof Array){if(!array_compare(o[_],s[_]))return!1}else if(o[_]!=s[_])return!1;return!0}function randInt(o,s){return Math.floor(Math.random()*(s-o)+o)}function isNumeric(o){return typeof o!="string"?!1:!isNaN(o)&&!isNaN(parseFloat(o))}function CSVToArray(o,s){s=s||",";let _=new RegExp("(\\"+s+'|\\r?\\n|\\r|^)(?:"([^"]*(?:""[^"]*)*)"|([^"\\'+s+"\\r\\n]*))","gi"),_e=[[]],et=null;for(;et=_.exec(o);){let it=et[1],tt=[];it.length&&it!=s&&_e.push([]),et[2]?tt=et[2].replace(new RegExp('""',"g"),'"'):tt=et[3],_e[_e.length-1].push(tt)}for(let it=0;it<_e.length;it++)for(let tt=0;tt<_e[it].length;tt++)isNumeric(_e[it][tt])&&(_e[it][tt]=parseFloat(_e[it][tt]));return _e}function isPlayable(o,s){if(o=="audio"){let _=new Audio,_e=mimeTypes.lookup(s);return _.canPlayType(_e)!=""}else{let _=document.createElement("video"),_e=mimeTypes.lookup(s);return _.canPlayType(_e)!=""}}function getNextColor(o,s){s=s||1;let _=[[255,99,132],[54,162,235],[240,176,26],[153,102,255],[75,192,192],[255,159,64]];if(o<_.length)var _e=_[o];else var _e=[randInt(64,196),randInt(64,196),randInt(64,196)];return"rgba("+_e[0]+", "+_e[1]+", "+_e[2]+", "+s+")"}var classnames={exports:{}};/*!
  Copyright (c) 2018 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/(function(o){(function(){var s={}.hasOwnProperty;function _(){for(var _e=[],et=0;et<arguments.length;et++){var it=arguments[et];if(!!it){var tt=typeof it;if(tt==="string"||tt==="number")_e.push(it);else if(Array.isArray(it)){if(it.length){var rt=_.apply(null,it);rt&&_e.push(rt)}}else if(tt==="object")if(it.toString===Object.prototype.toString)for(var nt in it)s.call(it,nt)&&it[nt]&&_e.push(nt);else _e.push(it.toString())}}return _e.join(" ")}o.exports?(_.default=_,o.exports=_):window.classNames=_})()})(classnames);var classNames=classnames.exports,edit_icon="./assets/edit.82f21b4b.svg",clear_icon="./assets/clear.bf0a458a.svg",propTypes={exports:{}},ReactPropTypesSecret$1="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ReactPropTypesSecret_1=ReactPropTypesSecret$1,ReactPropTypesSecret=ReactPropTypesSecret_1;function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction;var factoryWithThrowingShims=function(){function o(_e,et,it,tt,rt,nt){if(nt!==ReactPropTypesSecret){var ot=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw ot.name="Invariant Violation",ot}}o.isRequired=o;function s(){return o}var _={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:s,element:o,elementType:o,instanceOf:s,node:o,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return _.PropTypes=_,_};propTypes.exports=factoryWithThrowingShims();var PropTypes=propTypes.exports,multiRangeSlider="";const MultiRangeSlider=({min:o,max:s,onChange:_})=>{const[_e,et]=react.exports.useState(o),[it,tt]=react.exports.useState(s),[rt,nt]=react.exports.useState("min"),ot=react.exports.useRef(o),st=react.exports.useRef(s),at=react.exports.useRef(null),lt=react.exports.useCallback(ct=>Math.round((ct-o)/(s-o)*100),[o,s]);return react.exports.useEffect(()=>{const ct=lt(_e),ht=lt(st.current);at.current&&(at.current.style.left=`${ct}%`,at.current.style.width=`${ht-ct}%`)},[_e,lt]),react.exports.useEffect(()=>{const ct=lt(ot.current),ht=lt(it);at.current&&(at.current.style.width=`${ht-ct}%`)},[it,lt]),react.exports.useEffect(()=>{_({min:_e,max:it,lastChange:rt})},[_e,it,_,rt]),jsxs("div",{className:"slider_container",children:[jsx("input",{type:"range",min:o,max:s,value:_e,onChange:ct=>{const ht=Math.min(Number(ct.target.value),it-1);nt("min"),et(ht),ot.current=ht},className:"thumb thumb--left",style:{zIndex:_e>s-100&&"5"}}),jsx("input",{type:"range",min:o,max:s,value:it,onChange:ct=>{const ht=Math.max(Number(ct.target.value),_e+1);nt("max"),tt(ht),st.current=ht},className:"thumb thumb--right"}),jsxs("div",{className:"slider",children:[jsx("div",{className:"slider__track"}),jsx("div",{ref:at,className:"slider__range"})]})]})};MultiRangeSlider.propTypes={min:PropTypes.number.isRequired,max:PropTypes.number.isRequired,onChange:PropTypes.func.isRequired};class AudioInput extends BaseComponent{constructor(_){super(_);Xn(this,"start",()=>{if(this.started)this.recorder.start();else{const _=new(window.AudioContext||window.webkitAudioContext);this.recorder=new recorderJs(_),navigator.mediaDevices.getUserMedia({audio:!0}).then(_e=>{this.recorder.init(_e),this.recorder.start()}),this.started=!0}this.setState({recording:!0})});Xn(this,"stop",()=>{this.recorder.stop().then(({blob:_,buffer:_e})=>{let et=new FileReader;et.onload=function(it){this.props.handleChange({name:"sample.wav",data:it.target.result,is_example:!1})}.bind(this),et.readAsDataURL(_)}),this.setState({recording:!1})});Xn(this,"openFileUpload",()=>{this.uploader.current.click()});Xn(this,"toggleEditor",()=>{let[_,_e]=[0,100];this.props.handleChange({name:this.props.value.name,data:this.props.value.data,is_example:this.props.value.is_example,crop_min:_,crop_max:_e}),this.setState({editorMode:!this.state.editorMode})});Xn(this,"crop",(_,_e,et)=>{this.state.duration&&(et==="min"?this.audioRef.current.currentTime=_/100*this.state.duration:this.audioRef.current.currentTime=_e/100*this.state.duration),this.props.handleChange({name:this.props.value.name,data:this.props.value.data,is_example:this.props.value.is_example,crop_min:_,crop_max:_e})});Xn(this,"reset_playback_within_crop",()=>{let _=this.audioRef.current.currentTime/this.state.duration,_e=this.props.value.crop_min/100,et=this.props.value.crop_max/100;return _>et-1e-5||_<_e-1e-5?(this.audioRef.current.currentTime=this.state.duration*_e,!0):!1});Xn(this,"load_preview_from_drop",_=>{this.load_preview_from_files(_.dataTransfer.files)});Xn(this,"load_preview_from_upload",_=>{this.load_preview_from_files(_.target.files)});Xn(this,"load_preview_from_files",_=>{if(!_.length||!window.FileReader)return;var _e=this,et=new FileReader;let it=_[0];et.readAsDataURL(it),et.onloadend=function(){_e.props.handleChange({name:it.name,data:this.result,is_example:!1})}});this.state={recording:!1,editorMode:!1},this.src={},this.key=0,this.uploader=React.createRef(),this.audioRef=React.createRef(),this.started=!1}render(){if(this.props.value!==null)return(this.props.value.name!=this.src.name||this.props.value.data!==this.src.data)&&(this.key+=1,this.src={name:this.props.value.name,data:this.props.value.data}),jsxs("div",{className:"input_audio",children:[jsxs("div",{className:"edit_buttons",children:[jsx("button",{className:classNames("edit_button",{active:this.state.editorMode}),onClick:this.toggleEditor,children:jsx("img",{src:edit_icon})}),jsx("button",{className:"clear_button",onClick:this.props.handleChange.bind(this,null),children:jsx("img",{src:clear_icon})})]}),jsx("audio",{controls:!0,ref:this.audioRef,onLoadedMetadata:_=>this.setState({duration:_.nativeEvent.target.duration}),onPlay:()=>{this.reset_playback_within_crop(),this.audioRef.current.play()},onTimeUpdate:()=>{if(this.audioRef.current.paused)return;this.reset_playback_within_crop()&&this.audioRef.current.pause()},children:jsx("source",{src:this.props.value.data})},this.key),this.props.interpretation===null?!1:jsx("div",{className:"interpret_range",children:this.props.interpretation.map(_=>jsx("div",{style:{"background-color":getSaliencyColor(_)}}))}),this.state.editorMode?jsx(MultiRangeSlider,{min:0,max:100,onChange:({min:_,max:_e,lastChange:et})=>this.crop(_,_e,et)}):!1]});if(this.props.source==="microphone")return jsx("div",{className:"input_audio",children:this.state.recording?jsx("button",{className:"stop",onClick:this.stop,children:"Recording..."}):jsx("button",{className:"start",onClick:this.start,children:"Record"})});if(this.props.source==="upload"){let _=_e=>{_e.preventDefault(),_e.stopPropagation()};return jsxs("div",{className:"input_image",onDrag:_,onDragStart:_,onDragEnd:_,onDragOver:_,onDragEnter:_,onDragLeave:_,onDrop:_,children:[jsxs("div",{className:"upload_zone",onClick:this.openFileUpload,onDrop:this.load_preview_from_drop,children:["Drop Audio Here",jsx("br",{}),"- or -",jsx("br",{}),"Click to Upload"]}),jsx("input",{className:"hidden_upload",type:"file",ref:this.uploader,onChange:this.load_preview_from_upload,accept:"audio/*",style:{display:"none"}})]})}}}Xn(AudioInput,"memo",(_,_e)=>_.value instanceof Object&&_e.value instanceof Object?_.value.name===_e.value.name&&_.value.data===_e.value.data&&_.value.crop_min===_e.value.crop_min&&_.value.crop_max===_e.value.crop_max:_===_e);class AudioInputExample extends FileComponentExample{render(){return jsx("div",{className:"input_audio_example",children:this.props.value})}}class CheckboxGroupInput extends BaseComponent{constructor(_){super(_);Xn(this,"handleChange",_=>{let _e=[...this.props.value];_e.includes(_)?_e=_e.filter(et=>et!==_):_e.push(_),this.props.handleChange(_e)})}render(){return jsx("div",{className:"input_checkbox_group",children:this.props.choices.map((_,_e)=>jsxs("div",{className:classNames("checkbox_item",{selected:this.props.value.includes(_)}),onClick:this.handleChange.bind(this,_),children:[this.props.interpretation===null?jsx("div",{className:"checkbox",children:jsxs("svg",{className:"check",viewBox:"-10 -10 20 20",children:[jsx("line",{x1:"-7.5",y1:"0",x2:"-2.5",y2:"5"}),jsx("line",{x1:"-2.5",y1:"5",x2:"7.5",y2:"-7.5"})]})}):jsxs("div",{className:"interpretation",children:[jsx("div",{className:"interpretation_box",style:{backgroundColor:getSaliencyColor(this.props.interpretation[_e][0])}}),jsx("div",{className:"interpretation_box",style:{backgroundColor:getSaliencyColor(this.props.interpretation[_e][1])},children:jsxs("svg",{className:"interpret_check",viewBox:"-10 -10 20 20",children:[jsx("line",{x1:"-7.5",y1:"0",x2:"-2.5",y2:"5"}),jsx("line",{x1:"-2.5",y1:"5",x2:"7.5",y2:"-7.5"})]})})]}),_]},_e))})}}class CheckboxGroupInputExample extends ComponentExample{render(){return jsx("div",{className:"input_checkbox_group_example",children:this.props.value.join(", ")})}}class CheckboxInput extends BaseComponent{constructor(_){super(_);Xn(this,"handleChange",()=>{this.props.handleChange(this.props.value!==!0)})}render(){return jsx("div",{className:"input_checkbox",children:jsx("div",{className:classNames("checkbox_item",{selected:this.props.value}),onClick:this.handleChange,children:this.props.interpretation===null?jsx("div",{className:"checkbox",children:jsxs("svg",{className:"check",viewBox:"-10 -10 20 20",children:[jsx("line",{x1:"-7.5",y1:"0",x2:"-2.5",y2:"5"}),jsx("line",{x1:"-2.5",y1:"5",x2:"7.5",y2:"-7.5"})]})}):jsxs("div",{className:"interpretation",children:[jsx("div",{className:"interpretation_box",style:{backgroundColor:getSaliencyColor(this.props.interpretation[0])}}),jsx("div",{className:"interpretation_box",style:{backgroundColor:getSaliencyColor(this.props.interpretation[1])},children:jsxs("svg",{className:"interpret_check",viewBox:"-10 -10 20 20",children:[jsx("line",{x1:"-7.5",y1:"0",x2:"-2.5",y2:"5"}),jsx("line",{x1:"-2.5",y1:"5",x2:"7.5",y2:"-7.5"})]})})]})})})}}class CheckboxInputExample extends ComponentExample{render(){return jsx("div",{className:"input_checkbox_example",children:JSON.stringify(this.props.value)})}}var dist={exports:{}},jsuites={exports:{}};(function(o,s){(function(_,_e){o.exports=_e()})(commonjsGlobal,function(){var _=function(et){var it={},tt="4.9.35",rt=function(ot,st){return ot[st.type]&&ot[st.type]==st?!0:ot.parentNode?rt(ot.parentNode,st):!1},nt=function(ot){if(_.current.length>0)for(var st=0;st<_.current.length;st++)_.current[st]&&!rt(ot,_.current[st])&&_.current[st].close()};return it.init=function(){var ot=null;document.addEventListener("mousedown",function(st){if(st.changedTouches&&st.changedTouches[0])var at=st.changedTouches[0].clientX,lt=st.changedTouches[0].clientY;else var at=st.clientX,lt=st.clientY;var ct=event.path||event.composedPath&&event.composedPath();if(ct)ot=ct[0];else{if(st.target&&st.target.shadowRoot)var ht=st.target.shadowRoot;else var ht=document;ot=ht.elementFromPoint(at,lt)}}),document.addEventListener("click",function(st){nt(ot)}),it.version=tt},it.setExtensions=function(ot){if(typeof ot=="object")for(var st=Object.keys(ot),at=0;at<st.length;at++)it[st[at]]=ot[st[at]]},it.tracking=function(ot,st){if(st==!0)_.current=_.current.filter(function(lt){return lt!==null}),setTimeout(function(){_.current.push(ot)},0);else{var at=_.current.indexOf(ot);at>=0&&(_.current[at]=null)}},it.path=function(ot,st){if(ot=ot.split("."),ot.length){for(var at=this,lt=null;ot.length>1;)if(lt=ot.shift(),at.hasOwnProperty(lt))at=at[lt];else{if(st===void 0)return;at[lt]={},at=at[lt]}if(lt=ot.shift(),st!==void 0)return at[lt]=st,!0;if(at)return at[lt]}return!1},it.setDictionary=function(ot){var st=Object.keys(it.dictionary);if(st.length==0)it.dictionary=ot;else for(var st=Object.keys(ot),at=0;at<st.length;at++)it.dictionary[st[at]]=ot[st[at]];for(var lt=null,at=0;at<_.calendar.weekdays.length;at++)lt=_.translate(_.calendar.weekdays[at]),_.calendar.weekdays[at]&&(_.calendar.weekdays[at]=lt,_.calendar.weekdaysShort[at]=lt.substr(0,3));for(var at=0;at<_.calendar.months.length;at++)lt=_.translate(_.calendar.months[at]),lt&&(_.calendar.months[at]=lt,_.calendar.monthsShort[at]=lt.substr(0,3))},it.dictionary={},it.translate=function(ot){return it.dictionary[ot]||ot},it.current=[],it}();typeof document!="undefined"&&_.init(),_.ajax=function(et,it){if(Array.isArray(et)){var tt={instance:[],complete:it};if(et.length>0)for(var rt=0;rt<et.length;rt++)et[rt].multiple=tt,tt.instance.push(_.ajax(et[rt]));return tt}if(et.data||(et.data={}),et.type&&(et.method=et.type),et.method||(et.method="GET"),et.dataType||(et.dataType="json"),et.data){var nt=function(ht,mt){var dt=[],ft=Object.keys(ht);if(ft.length)for(var ut=0;ut<ft.length;ut++){if(mt)var pt=mt+"["+ft[ut]+"]";else var pt=ft[ut];if(ht[pt]instanceof FileList)dt[pt]=ht[ft[ut]];else if(typeof ht[ft[ut]]=="object")for(var At=nt(ht[ft[ut]],pt),gt=Object.keys(At),vt=0;vt<gt.length;vt++)dt[gt[vt]]=At[gt[vt]];else dt[pt]=ht[ft[ut]]}return dt},ot=nt(et.data),st=Object.keys(ot);if(et.method=="GET"){if(st.length){for(var at=[],rt=0;rt<st.length;rt++)at.push(st[rt]+"="+encodeURIComponent(ot[st[rt]]));et.url.indexOf("?")<0&&(et.url+="?"),et.url+=at.join("&")}}else for(var at=new FormData,rt=0;rt<st.length;rt++)if(ot[st[rt]]instanceof FileList){if(ot[st[rt]].length)for(var lt=0;lt<ot[st[rt]].length;lt++)at.append(st[rt],ot[st[rt]][lt],ot[st[rt]][lt].name)}else at.append(st[rt],ot[st[rt]])}var ct=new XMLHttpRequest;return ct.open(et.method,et.url,!0),ct.setRequestHeader("X-Requested-With","XMLHttpRequest"),et.contentType&&ct.setRequestHeader("Content-Type",et.contentType),et.method=="POST"?ct.setRequestHeader("Accept","application/json"):et.dataType=="blob"?ct.responseType="blob":et.contentType||(et.dataType=="json"?ct.setRequestHeader("Content-Type","text/json"):et.dataType=="html"&&ct.setRequestHeader("Content-Type","text/html")),et.cache!=!0&&(ct.setRequestHeader("pragma","no-cache"),ct.setRequestHeader("cache-control","no-cache")),et.withCredentials==!0&&(ct.withCredentials=!0),typeof et.beforeSend=="function"&&et.beforeSend(ct),typeof _.ajax.beforeSend=="function"&&_.ajax.beforeSend(ct),ct.onload=function(){if(ct.status===200)if(et.dataType=="json")try{var ht=JSON.parse(ct.responseText);et.success&&typeof et.success=="function"&&et.success(ht)}catch(dt){et.error&&typeof et.error=="function"&&et.error(dt,ht)}else{if(et.dataType=="blob")var ht=ct.response;else var ht=ct.responseText;et.success&&typeof et.success=="function"&&et.success(ht)}else et.error&&typeof et.error=="function"&&et.error(ct.responseText,ct.status);if(_.ajax.queue&&_.ajax.queue.length>0&&_.ajax.send(_.ajax.queue.shift()),_.ajax.requests&&_.ajax.requests.length){var mt=_.ajax.requests.indexOf(ct);if(_.ajax.requests.splice(mt,1),_.ajax.requests.length||et.complete&&typeof et.complete=="function"&&et.complete(ht),et.group&&_.ajax.oncomplete&&typeof _.ajax.oncomplete[et.group]=="function"&&(_.ajax.pending(et.group)||(_.ajax.oncomplete[et.group](),_.ajax.oncomplete[et.group]=null)),et.multiple&&et.multiple.instance){var mt=et.multiple.instance.indexOf(ct);et.multiple.instance.splice(mt,1),et.multiple.instance.length||et.multiple.complete&&typeof et.multiple.complete=="function"&&et.multiple.complete(ht)}}},ct.options=et,ct.data=at,et.queue==!0&&_.ajax.requests.length>0?_.ajax.queue.push(ct):_.ajax.send(ct),ct},_.ajax.send=function(et){et.data?Array.isArray(et.data)?et.send(et.data.join("&")):et.send(et.data):et.send(),_.ajax.requests.push(et)},_.ajax.exists=function(et,it){var tt=new XMLHttpRequest;tt.open("HEAD",et,!1),tt.send(),tt.status&&it(tt.status)},_.ajax.pending=function(et){var it=0,tt=_.ajax.requests;if(tt&&tt.length)for(var rt=0;rt<tt.length;rt++)(!et||et==tt[rt].options.group)&&it++;return it},_.ajax.oncomplete={},_.ajax.requests=[],_.ajax.queue=[],_.alert=function(et){_.getWindowWidth()<800&&_.dialog?_.dialog.open({title:"Alert",message:et}):alert(et)},_.animation={},_.animation.slideLeft=function(et,it,tt){it==!0?(et.classList.add("slide-left-in"),setTimeout(function(){et.classList.remove("slide-left-in"),typeof tt=="function"&&tt()},400)):(et.classList.add("slide-left-out"),setTimeout(function(){et.classList.remove("slide-left-out"),typeof tt=="function"&&tt()},400))},_.animation.slideRight=function(et,it,tt){it==!0?(et.classList.add("slide-right-in"),setTimeout(function(){et.classList.remove("slide-right-in"),typeof tt=="function"&&tt()},400)):(et.classList.add("slide-right-out"),setTimeout(function(){et.classList.remove("slide-right-out"),typeof tt=="function"&&tt()},400))},_.animation.slideTop=function(et,it,tt){it==!0?(et.classList.add("slide-top-in"),setTimeout(function(){et.classList.remove("slide-top-in"),typeof tt=="function"&&tt()},400)):(et.classList.add("slide-top-out"),setTimeout(function(){et.classList.remove("slide-top-out"),typeof tt=="function"&&tt()},400))},_.animation.slideBottom=function(et,it,tt){it==!0?(et.classList.add("slide-bottom-in"),setTimeout(function(){et.classList.remove("slide-bottom-in"),typeof tt=="function"&&tt()},400)):(et.classList.add("slide-bottom-out"),setTimeout(function(){et.classList.remove("slide-bottom-out"),typeof tt=="function"&&tt()},100))},_.animation.fadeIn=function(et,it){et.style.display="",et.classList.add("fade-in"),setTimeout(function(){et.classList.remove("fade-in"),typeof it=="function"&&it()},2e3)},_.animation.fadeOut=function(et,it){et.classList.add("fade-out"),setTimeout(function(){et.style.display="none",et.classList.remove("fade-out"),typeof it=="function"&&it()},1e3)},_.calendar=function(et,it){if(et.calendar)return et.calendar.setOptions(it,!0);var tt={type:"calendar"};tt.options={},tt.date=null,tt.setOptions=function(xt,It){for(var St={type:"default",validRange:null,startingDay:null,format:"DD/MM/YYYY",readonly:!0,today:!1,time:!1,resetButton:!0,placeholder:"",months:_.calendar.monthsShort,monthsFull:_.calendar.months,weekdays:_.calendar.weekdays,weekdays_short:_.calendar.weekdays,textDone:_.translate("Done"),textReset:_.translate("Reset"),textUpdate:_.translate("Update"),value:null,fullscreen:!1,opened:!1,onopen:null,onclose:null,onchange:null,onupdate:null,mode:null,position:null,dataType:null},Ot=0;Ot<St.weekdays_short.length;Ot++)St.weekdays_short[Ot]=St.weekdays_short[Ot].substr(0,1);for(var Mt in St)xt&&xt.hasOwnProperty(Mt)?tt.options[Mt]=xt[Mt]:(typeof tt.options[Mt]=="undefined"||It===!0)&&(tt.options[Mt]=St[Mt]);if(tt.options.resetButton==!1?at.style.display="none":at.style.display="",tt.options.readonly?et.setAttribute("readonly","readonly"):et.removeAttribute("readonly"),tt.options.placeholder?et.setAttribute("placeholder",tt.options.placeholder):et.removeAttribute("placeholder"),_.isNumeric(tt.options.value)&&tt.options.value>0&&(tt.options.value=_.calendar.numToDate(tt.options.value),tt.options.dataType="numeric"),at.innerHTML=tt.options.textReset,lt.innerHTML=tt.options.textDone,vt.innerHTML=tt.options.textUpdate,et.setAttribute("data-mask",tt.options.format.toLowerCase()),!tt.options.value&&tt.options.today)var jt=_.calendar.now();else var jt=tt.options.value;return jt&&(tt.options.value=null,tt.setValue(jt)),tt},tt.open=function(xt){if(!st.classList.contains("jcalendar-focus")&&!st.classList.contains("jcalendar-inline")){if(_.calendar.current=tt,_.tracking(tt,!0),tt.getDays(),tt.options.type=="year-month-picker"&&tt.getMonths(),tt.options.time&&(yt.value=tt.date[3],bt.value=tt.date[4]),st.classList.add("jcalendar-focus"),_.getWindowWidth()<800||tt.options.fullscreen)st.classList.add("jcalendar-fullsize"),_.animation.slideBottom(ht,1);else{st.classList.remove("jcalendar-fullsize");var It=et.getBoundingClientRect(),St=ht.getBoundingClientRect();if(tt.options.position)ct.style.position="fixed",window.innerHeight<It.bottom+St.height?ct.style.top=It.top-(St.height+2)+"px":ct.style.top=It.top+It.height+2+"px",ct.style.left=It.left+"px";else{if(window.innerHeight<It.bottom+St.height){var Ot=-1*(It.height+St.height+2);Ot+It.top<0&&(Ot=-1*(It.top+It.height)),ct.style.top=Ot+"px"}else ct.style.top=2+"px";if(window.innerWidth<It.left+St.width){var Ot=window.innerWidth-(It.left+St.width+20);ct.style.left=Ot+"px"}else ct.style.left="0px"}}typeof tt.options.onopen=="function"&&tt.options.onopen(et)}},tt.close=function(xt,It){if(st.classList.contains("jcalendar-focus")){if(It!==!1){var St=st.querySelector(".jcalendar-selected");if(typeof It=="string")var Ot=It;else if(!St||St.classList.contains("jcalendar-disabled"))var Ot=tt.options.value;else var Ot=tt.getValue();tt.setValue(Ot)}!xt&&typeof tt.options.onclose=="function"&&tt.options.onclose(et),st.classList.remove("jcalendar-focus"),_.tracking(tt,!1),_.calendar.current=null}return tt.options.value},tt.prev=function(){tt.options.mode=="years"?(tt.date[0]=tt.date[0]-12,tt.getYears()):tt.options.mode=="months"?(tt.date[0]=parseInt(tt.date[0])-1,tt.getMonths()):(tt.date[1]<2?(tt.date[0]=tt.date[0]-1,tt.date[1]=12):tt.date[1]=tt.date[1]-1,tt.getDays())},tt.next=function(){tt.options.mode=="years"?(tt.date[0]=parseInt(tt.date[0])+12,tt.getYears()):tt.options.mode=="months"?(tt.date[0]=parseInt(tt.date[0])+1,tt.getMonths()):(tt.date[1]>11?(tt.date[0]=parseInt(tt.date[0])+1,tt.date[1]=1):tt.date[1]=parseInt(tt.date[1])+1,tt.getDays())},tt.setToday=function(){var xt=new Date().toISOString().substr(0,10);return tt.setValue(xt),xt},tt.setValue=function(xt){xt||(xt=""+xt);var It=xt,St=tt.options.value;if(St!=It){if(It){tt.setLabel(It,tt.options);var Mt=It.split(" ");Mt[1]||(Mt[1]="00:00:00");var Ot=Mt[1].split(":"),Mt=Mt[0].split("-"),jt=parseInt(Mt[0]),Ft=parseInt(Mt[1]),Ut=parseInt(Mt[2]),Qt=parseInt(Ot[0]),Ht=parseInt(Ot[1]);tt.date=[jt,Ft,Ut,Qt,Ht,0];var xt=tt.setLabel(It,tt.options)}else{tt.date=null;var xt=""}tt.options.value=It,typeof tt.options.onchange=="function"&&tt.options.onchange(et,It,St),et.value!=xt&&(et.value=xt,typeof et.oninput=="function"&&et.oninput({type:"input",target:et,value:et.value}))}tt.getDays()},tt.getValue=function(){return tt.date?tt.options.time?_.two(tt.date[0])+"-"+_.two(tt.date[1])+"-"+_.two(tt.date[2])+" "+_.two(tt.date[3])+":"+_.two(tt.date[4])+":"+_.two(0):_.two(tt.date[0])+"-"+_.two(tt.date[1])+"-"+_.two(tt.date[2])+" "+_.two(0)+":"+_.two(0)+":"+_.two(0):""},tt.update=function(xt,It){if(!xt.classList.contains("jcalendar-disabled")){var St=st.querySelector(".jcalendar-selected");St&&St.classList.remove("jcalendar-selected"),xt.classList.add("jcalendar-selected"),xt.classList.contains("jcalendar-set-month")?tt.date[1]=It:tt.date[2]=xt.innerText,tt.options.time?(tt.date[3]=yt.value,tt.date[4]=bt.value):tt.close()}ot()},tt.reset=function(){tt.setValue(""),tt.date=null,tt.close(!1,!1)},tt.getDays=function(){tt.options.mode="days";var Qt=new Date,xt=tt.date&&_.isNumeric(tt.date[0])?tt.date[0]:parseInt(Qt.getFullYear()),It=tt.date&&_.isNumeric(tt.date[1])?tt.date[1]:parseInt(Qt.getMonth())+1,St=tt.date&&_.isNumeric(tt.date[2])?tt.date[2]:parseInt(Qt.getDate()),Ot=tt.date&&_.isNumeric(tt.date[3])?tt.date[3]:parseInt(Qt.getHours()),Mt=tt.date&&_.isNumeric(tt.date[4])?tt.date[4]:parseInt(Qt.getMinutes());tt.date=[xt,It,St,Ot,Mt,0],mt.innerHTML=xt,dt.innerHTML=tt.options.months[It-1];var jt=Qt.getMonth()==It-1&&Qt.getFullYear()==xt,Ft=Qt.getDate(),Qt=new Date(xt,It,0,0,0),Ut=Qt.getDate(),Qt=new Date(xt,It-1,0,0,0),Ht=Qt.getDay()+1,Jt=tt.options.startingDay||0;Ht=Ht-Jt,ut.innerHTML="";var Zt=document.createElement("tr");Zt.setAttribute("align","center"),ut.appendChild(Zt);for(var Wt=0;Wt<7;Wt++){var $t=document.createElement("td");$t.classList.add("jcalendar-weekday"),$t.innerHTML=tt.options.weekdays_short[Jt],Zt.appendChild($t),Jt++,Jt>6&&(Jt=0)}for(var Jt=0,Nt=0,Lt=0;Lt<6;Lt++){var Zt=document.createElement("tr");Zt.setAttribute("align","center");for(var Kt=!0,Wt=0;Wt<7;Wt++){var $t=document.createElement("td");if($t.classList.add("jcalendar-set-day"),Jt>=Ht&&Jt<Ht+Ut){Nt++,$t.innerHTML=Nt,Nt==St&&$t.classList.add("jcalendar-selected"),jt&&Ft==Nt&&($t.style.fontWeight="bold");var Pt=_.calendar.now(new Date(xt,It-1,Nt),!0);if(tt.options.validRange){if(!tt.options.validRange[0]||Pt>=tt.options.validRange[0])var ln=!0;else var ln=!1;if(!tt.options.validRange[1]||Pt<=tt.options.validRange[1])var Gt=!0;else var Gt=!1;ln&&Gt||$t.classList.add("jcalendar-disabled")}Kt=!1}Zt.appendChild($t),Jt++}Kt==!1&&ut.appendChild(Zt)}tt.options.time?At.style.display="":At.style.display="none",ot()},tt.getMonths=function(){tt.options.mode="months";var xt=tt.options.months;tt.options.value;var It=new Date,St=parseInt(It.getFullYear()),Ot=parseInt(It.getMonth())+1,Mt=tt.date&&_.isNumeric(tt.date[0])?tt.date[0]:St,jt=tt.date&&_.isNumeric(tt.date[1])?tt.date[1]:Ot;mt.innerHTML=tt.date[0],dt.innerHTML=xt[jt-1];var Ft=document.createElement("table");Ft.setAttribute("width","100%");for(var Ut=null,Qt=0;Qt<12;Qt++){if(!(Qt%4)){var Ut=document.createElement("tr");Ut.setAttribute("align","center"),Ft.appendChild(Ut)}var Ht=document.createElement("td");if(Ht.classList.add("jcalendar-set-month"),Ht.setAttribute("data-value",Qt+1),Ht.innerText=xt[Qt],tt.options.validRange){var Zt=Mt+"-"+_.two(Qt+1);if(!tt.options.validRange[0]||Zt>=tt.options.validRange[0].substr(0,7))var Wt=!0;else var Wt=!1;if(!tt.options.validRange[1]||Zt<=tt.options.validRange[1].substr(0,7))var $t=!0;else var $t=!1;Wt&&$t||Ht.classList.add("jcalendar-disabled")}Qt+1==jt&&Ht.classList.add("jcalendar-selected"),St==Mt&&Qt+1==Ot&&(Ht.style.fontWeight="bold"),Ut.appendChild(Ht)}ut.innerHTML='<tr><td colspan="7"></td></tr>',ut.children[0].children[0].appendChild(Ft),ot()},tt.getYears=function(){tt.options.mode="years";for(var xt=new Date,It=xt.getFullYear(),St=tt.date&&_.isNumeric(tt.date[0])?tt.date[0]:parseInt(xt.getFullYear()),Ot=[],Mt=0;Mt<25;Mt++)Ot[Mt]=parseInt(tt.date[0])+(Mt-12);var jt=document.createElement("table");jt.setAttribute("width","100%");for(var Mt=0;Mt<25;Mt++){if(!(Mt%5)){var Ft=document.createElement("tr");Ft.setAttribute("align","center"),jt.appendChild(Ft)}var Ut=document.createElement("td");Ut.classList.add("jcalendar-set-year"),Ut.innerText=Ot[Mt],St==Ot[Mt]&&Ut.classList.add("jcalendar-selected"),It==Ot[Mt]&&(Ut.style.fontWeight="bold"),Ft.appendChild(Ut)}ut.innerHTML='<tr><td colspan="7"></td></tr>',ut.firstChild.firstChild.appendChild(jt),ot()},tt.setLabel=function(xt,It){return _.calendar.getDateString(xt,It)},tt.fromFormatted=function(xt,It){return _.calendar.extractDateFromString(xt,It)};var rt=function(xt){var It=_.findElement(xt.target,"jcalendar-container");if(It){var St=xt.target.className;if(St=="jcalendar-prev")tt.prev();else if(St=="jcalendar-next")tt.next();else if(St=="jcalendar-month")tt.getMonths();else if(St=="jcalendar-year")tt.getYears();else if(St=="jcalendar-set-year")tt.date[0]=xt.target.innerText,tt.options.type=="year-month-picker"?tt.getMonths():tt.getDays();else if(xt.target.classList.contains("jcalendar-set-month")){var Ot=parseInt(xt.target.getAttribute("data-value"));tt.options.type=="year-month-picker"?tt.update(xt.target,Ot):(tt.date[1]=Ot,tt.getDays())}else St=="jcalendar-confirm"||St=="jcalendar-update"||St=="jcalendar-close"?tt.close():St=="jcalendar-backdrop"?tt.close(!1,!1):St=="jcalendar-reset"?tt.reset():xt.target.classList.contains("jcalendar-set-day")&&xt.target.innerText&&tt.update(xt.target)}else tt.close()},nt=function(xt){if(xt.target.value&&xt.target.value.length>3){var It=_.calendar.extractDateFromString(xt.target.value,tt.options.format);It&&tt.setValue(It)}},ot=function(){var xt=st.querySelector(".jcalendar-selected");xt&&xt.classList.contains("jcalendar-disabled")?(vt.setAttribute("disabled","disabled"),yt.setAttribute("disabled","disabled"),bt.setAttribute("disabled","disabled")):(vt.removeAttribute("disabled"),yt.removeAttribute("disabled"),bt.removeAttribute("disabled")),typeof tt.options.onupdate=="function"&&tt.options.onupdate(et,tt.getValue())},st=null,at=null,lt=null,ct=null,ht=null,mt=null,dt=null,ft=null,ut=null,pt=null,At=null,gt=null,vt=null,yt=null,bt=null,Ct=function(){et.tagName=="INPUT"&&et.value&&(it.value=et.value),at=document.createElement("div"),at.className="jcalendar-reset",lt=document.createElement("div"),lt.className="jcalendar-confirm",pt=document.createElement("div"),pt.className="jcalendar-controls",pt.style.borderBottom="1px solid #ddd",pt.appendChild(at),pt.appendChild(lt),ct=document.createElement("div"),ct.className="jcalendar-container",ht=document.createElement("div"),ht.className="jcalendar-content",ct.appendChild(ht),et.tagName=="DIV"?(st=et,st.classList.add("jcalendar-inline")):(ht.appendChild(pt),st=document.createElement("div"),st.className="jcalendar"),st.classList.add("jcalendar-container"),st.appendChild(ct);var xt=document.createElement("div");xt.className="jcalendar-table",ht.appendChild(xt);var It=document.createElement("td");It.setAttribute("colspan","2"),It.className="jcalendar-prev",mt=document.createElement("span"),mt.className="jcalendar-year",dt=document.createElement("span"),dt.className="jcalendar-month";var St=document.createElement("td");St.className="jcalendar-header",St.setAttribute("colspan","3"),St.appendChild(dt),St.appendChild(mt);var Ot=document.createElement("td");Ot.setAttribute("colspan","2"),Ot.className="jcalendar-next";var Mt=document.createElement("thead"),jt=document.createElement("tr");jt.appendChild(It),jt.appendChild(St),jt.appendChild(Ot),Mt.appendChild(jt),ft=document.createElement("table"),ut=document.createElement("tbody"),ft.setAttribute("cellpadding","0"),ft.setAttribute("cellspacing","0"),ft.appendChild(Mt),ft.appendChild(ut),xt.appendChild(ft),yt=document.createElement("select"),yt.className="jcalendar-select",yt.onchange=function(){tt.date[3]=this.value,typeof tt.options.onupdate=="function"&&tt.options.onupdate(et,tt.getValue())};for(var Ft=0;Ft<24;Ft++){var Ut=document.createElement("option");Ut.value=Ft,Ut.innerHTML=_.two(Ft),yt.appendChild(Ut)}bt=document.createElement("select"),bt.className="jcalendar-select",bt.onchange=function(){tt.date[4]=this.value,typeof tt.options.onupdate=="function"&&tt.options.onupdate(et,tt.getValue())};for(var Ft=0;Ft<60;Ft++){var Ut=document.createElement("option");Ut.value=Ft,Ut.innerHTML=_.two(Ft),bt.appendChild(Ut)}var Qt=document.createElement("div");Qt.className="jcalendar-controls",At=document.createElement("div"),At.className="jcalendar-time",At.style.maxWidth="140px",At.appendChild(yt),At.appendChild(bt),vt=document.createElement("button"),vt.setAttribute("type","button"),vt.className="jcalendar-update",gt=document.createElement("div"),gt.style.flexGrow="10",gt.appendChild(vt),Qt.appendChild(At),et.tagName=="INPUT"&&Qt.appendChild(gt),ht.appendChild(Qt);var Ht=document.createElement("div");Ht.className="jcalendar-backdrop",st.appendChild(Ht),et.addEventListener("keyup",nt),st.addEventListener("swipeleft",function(Zt){_.animation.slideLeft(ft,0,function(){tt.next(),_.animation.slideRight(ft,1)}),Zt.preventDefault(),Zt.stopPropagation()}),st.addEventListener("swiperight",function(Zt){_.animation.slideRight(ft,0,function(){tt.prev(),_.animation.slideLeft(ft,1)}),Zt.preventDefault(),Zt.stopPropagation()}),et.onmouseup=function(){tt.open()},"ontouchend"in document.documentElement?st.addEventListener("touchend",rt):st.addEventListener("mouseup",rt),_.calendar.hasEvents||(_.calendar.hasEvents=!0,document.addEventListener("keydown",_.calendar.keydown)),tt.setOptions(it),et.tagName=="INPUT"?(et.parentNode.insertBefore(st,et.nextSibling),et.setAttribute("autocomplete","off"),et.classList.add("jcalendar-input"),et.value=tt.setLabel(tt.getValue(),tt.options)):(tt.getDays(),tt.options.time&&(yt.value=tt.date[3],bt.value=tt.date[4])),tt.options.opened==!0&&tt.open(),et.change=tt.setValue,et.val=function(Zt){if(Zt===void 0)return tt.getValue();tt.setValue(Zt)},et.calendar=st.calendar=tt};return Ct(),tt},_.calendar.keydown=function(et){var it=null;(it=_.calendar.current)&&(et.which==13?it.close(!1,!0):et.which==27&&it.close(!1,!1))},_.calendar.prettify=function(et,it){if(!it)var it={justNow:"Just now",xMinutesAgo:"{0}m ago",xHoursAgo:"{0}h ago",xDaysAgo:"{0}d ago",xWeeksAgo:"{0}w ago",xMonthsAgo:"{0} mon ago",xYearsAgo:"{0}y ago"};var tt=new Date,rt=new Date(et),nt=parseInt((tt-rt)/1e3/60);if(String.prototype.format=function(st){return this.replace("{0}",st)},nt==0)var ot=it.justNow;else if(nt<90)var ot=it.xMinutesAgo.format(nt);else if(nt<1440)var ot=it.xHoursAgo.format(Math.round(nt/60));else if(nt<20160)var ot=it.xDaysAgo.format(Math.round(nt/1440));else if(nt<43200)var ot=it.xWeeksAgo.format(Math.round(nt/10080));else if(nt<1036800)var ot=it.xMonthsAgo.format(Math.round(nt/43200));else var ot=it.xYearsAgo.format(Math.round(nt/525600));return ot},_.calendar.prettifyAll=function(){for(var et=document.querySelectorAll(".prettydate"),it=0;it<et.length;it++)et[it].getAttribute("data-date")?et[it].innerHTML=_.calendar.prettify(et[it].getAttribute("data-date")):et[it].innerHTML&&(et[it].setAttribute("data-date",et[it].innerHTML),et[it].innerHTML=_.calendar.prettify(et[it].innerHTML))},_.calendar.now=function(et,it){if(Array.isArray(et))var tt=et[0],rt=et[1],nt=et[2],ot=et[3],st=et[4],at=et[5];else{if(!et)var et=new Date;var tt=et.getFullYear(),rt=et.getMonth()+1,nt=et.getDate(),ot=et.getHours(),st=et.getMinutes(),at=et.getSeconds()}return it==!0?_.two(tt)+"-"+_.two(rt)+"-"+_.two(nt):_.two(tt)+"-"+_.two(rt)+"-"+_.two(nt)+" "+_.two(ot)+":"+_.two(st)+":"+_.two(at)},_.calendar.toArray=function(et){var tt=et.split(et.indexOf("T")!==-1?"T":" "),it=tt[1],tt=tt[0].split("-"),rt=parseInt(tt[0]),nt=parseInt(tt[1]),ot=parseInt(tt[2]);if(it)var it=it.split(":"),st=parseInt(it[0]),at=parseInt(it[1]);else var st=0,at=0;return[rt,nt,ot,st,at,0]},_.calendar.extractDateFromString=function(et,it){if(et>0&&Number(et)==et){var tt=new Date(Math.round((et-25569)*86400*1e3));return tt.getFullYear()+"-"+_.two(tt.getMonth())+"-"+_.two(tt.getDate())+" 00:00:00"}var rt=_.mask(et,{mask:it},!0);return rt.date[0]&&rt.date[1]?(rt.date[2]||(rt.date[2]=1),rt.date[0]+"-"+_.two(rt.date[1])+"-"+_.two(rt.date[2])+" "+_.two(rt.date[3])+":"+_.two(rt.date[4])+":"+_.two(rt.date[5])):""},_.calendar.dateToNum=function(et,it){et=new Date(et),it||(it="1899-12-30 "+et.getHours()+":"+et.getMinutes()+":"+et.getSeconds()),it=new Date(it);var tt=et.getTime()-it.getTime();return Math.round(tt/864e5)},_.calendar.numToDate=function(et){var it=new Date(Math.round((et-25569)*86400*1e3));return it.getFullYear()+"-"+_.two(it.getMonth()+1)+"-"+_.two(it.getDate())+" 00:00:00"},_.calendar.getDateString=function(et,it){if(!it)var it={};if(it&&typeof it=="object")var tt=it.format;else var tt=it;if(tt||(tt="YYYY-MM-DD"),typeof et=="number"&&tt.indexOf("[h]")>=0){var rt=parseFloat(24*Number(et));if(tt.indexOf("mm")>=0){var nt=(""+rt).split(".");if(nt[1]){var ot=60*parseFloat("0."+nt[1]);ot=parseFloat(ot.toFixed(2))}else var ot=0;rt=parseInt(nt[0])+":"+_.two(ot)}return rt}et instanceof Date?et=_.calendar.now(et):et&&_.isNumeric(et)&&(et=_.calendar.numToDate(et));for(var st=["DAY","WD","DDDD","DDD","DD","D","Q","HH24","HH12","HH","H","AM/PM","MI","SS","MS","YYYY","YYY","YY","Y","MONTH","MON","MMMMM","MMMM","MMM","MM","M","."],at=new RegExp(st.join("|"),"gi"),lt=tt.match(at),ct=0;ct<lt.length;ct++)lt[ct].toUpperCase()=="MM"&&(lt[ct-1]&&lt[ct-1].toUpperCase().indexOf("H")>=0||lt[ct-2]&&lt[ct-2].toUpperCase().indexOf("H")>=0||lt[ct+1]&&lt[ct+1].toUpperCase().indexOf("S")>=0||lt[ct+2]&&lt[ct+2].toUpperCase().indexOf("S")>=0)&&(lt[ct]="mi");var ht={tokens:lt};if(et){var ot=""+et,mt=ot.indexOf("T")!==-1?"T":" ";ot=ot.split(mt);var nt=0,dt=0,ft=0;if(ot[1]&&(nt=ot[1].split(":"),dt=nt[1]?nt[1]:0,ft=nt[2]?nt[2]:0,nt=nt[0]?nt[0]:0),ot=ot[0].split("-"),ot[0]&&ot[1]&&ot[2]&&ot[0]>0&&ot[1]>0&&ot[1]<13&&ot[2]>0&&ot[2]<32){ht.data=[ot[0],ot[1],ot[2],nt,dt,ft],ht.value=[];for(var ut=new Date(ht.data[0],ht.data[1]-1,ht.data[2],ht.data[3],ht.data[4],ht.data[5]),pt=function(vt){var yt=this.tokens[vt],bt=yt.toUpperCase(),Ct=null;bt==="YYYY"?Ct=this.data[0]:bt==="YYY"?Ct=this.data[0].substring(1,4):bt==="YY"?Ct=this.data[0].substring(2,4):bt==="Y"?Ct=this.data[0].substring(3,4):yt==="MON"?Ct=_.calendar.months[ut.getMonth()].substr(0,3).toUpperCase():yt==="mon"?Ct=_.calendar.months[ut.getMonth()].substr(0,3).toLowerCase():yt==="MONTH"?Ct=_.calendar.months[ut.getMonth()].toUpperCase():yt==="month"?Ct=_.calendar.months[ut.getMonth()].toLowerCase():bt==="MMMMM"?Ct=_.calendar.months[ut.getMonth()].substr(0,1):bt==="MMMM"||yt==="Month"?Ct=_.calendar.months[ut.getMonth()]:bt==="MMM"||yt=="Mon"?Ct=_.calendar.months[ut.getMonth()].substr(0,3):bt==="MM"?Ct=_.two(this.data[1]):bt==="M"?Ct=ut.getMonth()+1:yt==="DAY"?Ct=_.calendar.weekdays[ut.getDay()].toUpperCase():yt==="day"?Ct=_.calendar.weekdays[ut.getDay()].toLowerCase():bt==="DDDD"||yt=="Day"?Ct=_.calendar.weekdays[ut.getDay()]:bt==="DDD"?Ct=_.calendar.weekdays[ut.getDay()].substr(0,3):bt==="DD"?Ct=_.two(this.data[2]):bt==="D"?Ct=this.data[2]:bt==="Q"?Ct=Math.floor((ut.getMonth()+3)/3):bt==="HH24"||bt==="HH"?Ct=_.two(this.data[3]):bt==="HH12"?this.data[3]>12?Ct=_.two(this.data[3]-12):Ct=_.two(this.data[3]):bt==="H"?Ct=this.data[3]:bt==="MI"?Ct=_.two(this.data[4]):bt==="SS"?Ct=_.two(this.data[5]):bt==="MS"?Ct=ut.getMilliseconds():bt==="AM/PM"?this.data[3]>=12?Ct="PM":Ct="AM":bt==="WD"&&(Ct=_.calendar.weekdays[ut.getDay()]),Ct===null?this.value[vt]=this.tokens[vt]:this.value[vt]=Ct},ct=0;ct<ht.tokens.length;ct++)pt.call(ht,ct);et=ht.value.join("")}else et=""}return et},_.calendar.weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_.calendar.months=["January","February","March","April","May","June","July","August","September","October","November","December"],_.calendar.weekdaysShort=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_.calendar.monthsShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_.color=function(et,it){if(et.color)return et.color.setOptions(it,!0);var tt={type:"color"};tt.options={};var rt=null,nt=null,ot=null,st=null,at=null,lt=null,ct=null;tt.setOptions=function(Mt,jt){var Ft={placeholder:"",value:null,onopen:null,onclose:null,onchange:null,closeOnChange:!0,palette:null,position:null,doneLabel:"Done",resetLabel:"Reset",fullscreen:!1,opened:!1};Mt||(Mt={}),Mt&&!Mt.palette&&(Mt.palette=_.palette());for(var Ut in Ft)Mt&&Mt.hasOwnProperty(Ut)?tt.options[Ut]=Mt[Ut]:(typeof tt.options[Ut]=="undefined"||jt===!0)&&(tt.options[Ut]=Ft[Ut]);return st&&(st.innerHTML=tt.options.resetLabel),at&&(at.innerHTML=tt.options.doneLabel),tt.options.palette&&ct&&ct.updateContent(0,pt()),typeof tt.options.value=="string"&&(et.value=tt.options.value),tt.options.placeholder?et.setAttribute("placeholder",tt.options.placeholder):et.getAttribute("placeholder")&&et.removeAttribute("placeholder"),tt},tt.open=function(){if(!rt.classList.contains("jcolor-focus")){_.tracking(tt,!0),rt.classList.add("jcolor-focus"),ot.style.marginTop="",ot.style.marginLeft="";var Mt=ot.getBoundingClientRect(),jt=_.getWindowWidth(),Ft=_.getWindowHeight();if(jt<800||tt.options.fullscreen==!0?(ot.classList.add("jcolor-fullscreen"),_.animation.slideBottom(ot,1),nt.style.display="block"):(ot.classList.contains("jcolor-fullscreen")&&(ot.classList.remove("jcolor-fullscreen"),nt.style.display=""),tt.options.position?ot.style.position="fixed":ot.style.position="",Mt.left+Mt.width>jt&&(ot.style.marginLeft=-1*(Mt.left+Mt.width-(jt-20))+"px"),Mt.top+Mt.height>Ft&&(ot.style.marginTop=-1*(Mt.top+Mt.height-(Ft-20))+"px")),typeof tt.options.onopen=="function"&&tt.options.onopen(et),ct.setBorder(ct.getActive()),tt.options.value){var Ut=ut(tt.options.value);xt.forEach(function(Qt,Ht){Qt.value=Ut[Ht],Qt.dispatchEvent(new Event("input"))})}}},tt.close=function(Mt){return rt.classList.contains("jcolor-focus")&&(rt.classList.remove("jcolor-focus"),nt.style.display="",!Mt&&typeof tt.options.onclose=="function"&&tt.options.onclose(et),_.tracking(tt,!1)),tt.options.value},tt.setValue=function(Mt){if(Mt||(Mt=""),Mt!=tt.options.value){tt.options.value=Mt,Ct=Mt;var jt=rt.querySelector(".jcolor-selected");jt&&jt.classList.remove("jcolor-selected"),tt.values[Mt]&&tt.values[Mt].classList.add("jcolor-selected"),typeof tt.options.onchange=="function"&&tt.options.onchange(et,Mt),et.value!=tt.options.value&&(et.value=tt.options.value,typeof et.oninput=="function"&&et.oninput({type:"input",target:et,value:et.value})),tt.options.closeOnChange==!0&&tt.close()}},tt.getValue=function(){return tt.options.value};var ht=!1,mt=function(Mt){var jt=Mt.toString(16);return jt.length===1?"0"+jt:jt},dt=function(Mt,jt,Ft){return"#"+mt(Mt)+mt(jt)+mt(Ft)},ft=function(Mt){return parseInt("0x"+Mt)},ut=function(Mt){return[ft(Mt.substr(1,2)),ft(Mt.substr(3,2)),ft(Mt.substr(5,2))]},pt=function(){var Mt=document.createElement("div");Mt.className="jcolor-grid",tt.values=[];var jt=document.createElement("table");jt.setAttribute("cellpadding","7"),jt.setAttribute("cellspacing","0");for(var Ft=0;Ft<tt.options.palette.length;Ft++){for(var Ut=document.createElement("tr"),Qt=0;Qt<tt.options.palette[Ft].length;Qt++){var Ht=document.createElement("td"),Zt=tt.options.palette[Ft][Qt];Zt.length<7&&Zt.substr(0,1)!=="#"&&(Zt="#"+Zt),Ht.style.backgroundColor=Zt,Ht.setAttribute("data-value",Zt),Ht.innerHTML="",Ut.appendChild(Ht),tt.options.value==Zt&&Ht.classList.add("jcolor-selected"),tt.values[Zt]=Ht}jt.appendChild(Ut)}return Mt.appendChild(jt),Mt.addEventListener("mousedown",function(Wt){if(Wt.target.tagName=="TD"){var $t=Wt.target.getAttribute("data-value");$t&&tt.setValue($t)}}),Mt},At=document.createElement("canvas");At.width=200,At.height=160;var gt=At.getContext("2d"),vt=function(){var Mt=lt.firstChild.getBoundingClientRect();At.width=Mt.width-14,yt()},yt=function(){var Mt=gt.createLinearGradient(0,0,At.width,0);Mt.addColorStop(0,"rgb(255,0,0)"),Mt.addColorStop(.15,"rgb(255,0,255)"),Mt.addColorStop(.33,"rgb(0,0,255)"),Mt.addColorStop(.49,"rgb(0,255,255)"),Mt.addColorStop(.67,"rgb(0,255,0)"),Mt.addColorStop(.84,"rgb(255,255,0)"),Mt.addColorStop(1,"rgb(255,0,0)"),gt.fillStyle=Mt,gt.fillRect(0,0,At.width,At.height),Mt=gt.createLinearGradient(0,0,0,At.height),Mt.addColorStop(0,"rgba(255,255,255,1)"),Mt.addColorStop(.5,"rgba(255,255,255,0)"),Mt.addColorStop(.5,"rgba(0,0,0,0)"),Mt.addColorStop(1,"rgba(0,0,0,1)"),gt.fillStyle=Mt,gt.fillRect(0,0,At.width,At.height)},bt=function(){var Mt=document.createElement("div");Mt.className="jcolor-hsl";var jt=document.createElement("div");jt.className="jcolor-point";var Ft=document.createElement("div");Ft.appendChild(At),Ft.appendChild(jt),Mt.appendChild(Ft);var Ut=function(Qt,Ht,Zt){if(Qt===1){var Wt=Mt.getBoundingClientRect(),$t=Ht-Wt.left,Jt=Zt-Wt.top;$t<0&&($t=0),Jt<0&&(Jt=0),$t>Wt.width&&($t=Wt.width),Jt>Wt.height&&(Jt=Wt.height),jt.style.left=$t+"px",jt.style.top=Jt+"px";var Nt=gt.getImageData($t,Jt,1,1).data;Ct=dt(Nt[0],Nt[1],Nt[2])}};return Mt.addEventListener("mousedown",function(Qt){Ut(Qt.buttons,Qt.clientX,Qt.clientY)}),Mt.addEventListener("mousemove",function(Qt){Ut(Qt.buttons,Qt.clientX,Qt.clientY)}),Mt.addEventListener("touchmove",function(Qt){Ut(1,Qt.changedTouches[0].clientX,Qt.changedTouches[0].clientY)}),Mt},Ct="",xt=[],It=function(){if(Ct!=="")for(var Mt=0;Mt<xt.length;Mt++){var jt=ut(Ct);jt[Mt]=0;var Ft="linear-gradient(90deg, rgb(";Ft+=jt.join(", "),Ft+="), rgb(",jt[Mt]=255,Ft+=jt.join(", "),Ft+="))",xt[Mt].style.backgroundImage=Ft}},St=function(){var Mt=document.createElement("div");Mt.className="jcolor-sliders";var jt=document.createElement("div"),Ft=function(Zt){var Wt=document.createElement("div");Wt.className="jcolor-sliders-input-container";var $t=document.createElement("label");$t.innerText=Zt;var Jt=document.createElement("div");Jt.className="jcolor-sliders-input-subcontainer";var Nt=document.createElement("input");Nt.type="range",Nt.min=0,Nt.max=255,Nt.value=0,Wt.appendChild($t),Jt.appendChild(Nt);var Lt=document.createElement("div");return Lt.innerText=Nt.value,Nt.addEventListener("input",function(){Lt.innerText=Nt.value}),Jt.appendChild(Lt),Wt.appendChild(Jt),jt.appendChild(Wt),Nt};xt=[Ft("Red"),Ft("Green"),Ft("Blue")],Mt.appendChild(jt);var Ut=document.createElement("div");Ut.className="jcolor-sliders-final-color";var Qt=document.createElement("div");Qt.style.visibility="hidden",Qt.innerText="a",Ut.appendChild(Qt);var Ht=function(){var Zt=dt(parseInt(xt[0].value),parseInt(xt[1].value),parseInt(xt[2].value));Qt.innerText=Zt,Qt.style.color=Zt,Qt.style.removeProperty("visibility"),Ct=Zt};return xt.forEach(function(Zt){Zt.addEventListener("input",function(){Ht(),It()})}),Mt.appendChild(Ut),Mt},Ot=function(){tt.setOptions(it),et.tagName=="INPUT"&&(et.classList.add("jcolor-input"),et.readOnly=!0),rt=document.createElement("div"),rt.className="jcolor",nt=document.createElement("div"),nt.className="jcolor-backdrop",rt.appendChild(nt),ot=document.createElement("div"),ot.className="jcolor-content";var Mt=document.createElement("div");Mt.className="jcolor-controls",ot.appendChild(Mt),st=document.createElement("div"),st.className="jcolor-reset",st.innerHTML=tt.options.resetLabel,st.onclick=function(jt){tt.setValue(""),tt.close()},Mt.appendChild(st),at=document.createElement("div"),at.className="jcolor-close",at.innerHTML=tt.options.doneLabel,at.onclick=function(jt){ct.getActive()>0&&tt.setValue(Ct),tt.close()},Mt.appendChild(at),lt=document.createElement("div"),ot.appendChild(lt),ct=_.tabs(lt,{animation:!0,data:[{title:"Grid",contentElement:pt()},{title:"Spectrum",contentElement:bt()},{title:"Sliders",contentElement:St()}],onchange:function(jt,Ft,Ut){if(Ut===1)vt();else{var Qt=Ct!==""?Ct:tt.getValue();if(Ut===2&&Qt){var Ht=ut(Qt);xt.forEach(function(Zt,Wt){Zt.value=Ht[Wt],Zt.dispatchEvent(new Event("input"))})}}},palette:"modern"}),rt.appendChild(ot),et.tagName=="INPUT"?et.parentNode.insertBefore(rt,et.nextSibling):et.appendChild(rt),et.addEventListener("mouseup",function(jt){tt.open()}),nt.addEventListener("mousedown",function(jt){ht=!0}),nt.addEventListener("click",function(jt){ht&&(ht=!1,tt.close())}),window.addEventListener("resize",function(){rt.classList.contains("jcolor-focus")&&ct.getActive()==1&&vt()}),tt.options.opened==!0&&tt.open(),et.change=tt.setValue,et.val=function(jt){if(jt===void 0)return tt.getValue();tt.setValue(jt)},et.color=tt,rt.color=tt};return Ot(),tt},_.contextmenu=function(et,it){var tt={};tt.options={};var rt={items:null,onclick:null};for(var nt in rt)it&&it.hasOwnProperty(nt)?tt.options[nt]=it[nt]:tt.options[nt]=rt[nt];et.classList.add("jcontextmenu"),et.setAttribute("tabindex","900"),tt.open=function(at,lt){if(lt&&(tt.options.items=lt,tt.create(lt)),tt.options.items&&tt.options.items.length>0||et.children.length){if(at.target)var ct=at.clientX,ht=at.clientY;else var ct=at.x,ht=at.y;et.classList.add("jcontextmenu-focus"),et.focus();var mt=et.getBoundingClientRect();if(window.innerHeight<ht+mt.height){var dt=ht-mt.height;dt<0&&(dt=0),et.style.top=dt+"px"}else et.style.top=ht+"px";window.innerWidth<ct+mt.width?ct-mt.width>0?et.style.left=ct-mt.width+"px":et.style.left="10px":et.style.left=ct+"px"}},tt.close=function(){et.classList.contains("jcontextmenu-focus")&&et.classList.remove("jcontextmenu-focus")},tt.create=function(at){et.innerHTML="";var lt=ot();et.appendChild(lt);for(var ct=0;ct<at.length;ct++){var ht=st(at[ct]);et.appendChild(ht)}};function ot(){var at=document.createElement("div");at.classList.add("header"),at.addEventListener("click",function(ht){ht.preventDefault(),ht.stopPropagation()});var lt=document.createElement("a");lt.classList.add("title"),lt.innerHTML=_.translate("Menu"),at.appendChild(lt);var ct=document.createElement("a");return ct.classList.add("close"),ct.innerHTML=_.translate("close"),ct.addEventListener("click",function(ht){tt.close()}),at.appendChild(ct),at}function st(at){if(at.type&&(at.type=="line"||at.type=="divisor"))var lt=document.createElement("hr");else{var lt=document.createElement("div"),ct=document.createElement("a");if(ct.innerHTML=at.title,at.tooltip&&lt.setAttribute("title",at.tooltip),at.icon&&lt.setAttribute("data-icon",at.icon),at.id&&(lt.id=at.id),at.disabled?lt.className="jcontextmenu-disabled":at.onclick&&(lt.method=at.onclick,lt.addEventListener("mousedown",function(gt){gt.preventDefault()}),lt.addEventListener("mouseup",function(gt){this.method(this,gt)})),lt.appendChild(ct),at.submenu){var ht=document.createElement("span");ht.innerHTML="&#9658;",lt.appendChild(ht),lt.classList.add("jcontexthassubmenu");var mt=document.createElement("div");mt.classList.add("jcontextmenu"),mt.setAttribute("tabindex","900");for(var dt=at.submenu,ft=0;ft<dt.length;ft++){var ut=st(dt[ft]);mt.appendChild(ut)}lt.appendChild(mt)}else if(at.shortcut){var pt=document.createElement("span");pt.innerHTML=at.shortcut,lt.appendChild(pt)}}return lt}return typeof tt.options.onclick=="function"&&et.addEventListener("click",function(at){tt.options.onclick(tt,at)}),tt.options.items&&tt.create(tt.options.items),et.addEventListener("blur",function(at){tt.close()}),_.contextmenu.hasEvents||(window.addEventListener("mousewheel",function(){tt.close()}),document.addEventListener("contextmenu",function(at){var lt=_.contextmenu.getElement(at.target);if(lt){var ct=document.querySelector("#"+lt);ct?(ct.contextmenu.open(at),at.preventDefault()):console.error("JSUITES: Contextmenu id not found")}}),_.contextmenu.hasEvents=!0),et.contextmenu=tt,tt},_.contextmenu.getElement=function(et){var it=0;function tt(rt){rt.parentNode&&rt.getAttribute("aria-contextmenu-id")?it=rt.getAttribute("aria-contextmenu-id"):rt.parentNode&&tt(rt.parentNode)}return tt(et),it},_.dropdown=function(et,it){if(et.dropdown)return et.dropdown.setOptions(it,!0);var tt={type:"dropdown"};tt.options={};var rt=function(Ct,xt){Ct&&Ct.length&&(tt.options.sortResults!==!1&&(typeof tt.options.sortResults=="function"?Ct.sort(tt.options.sortResults):Ct.sort(nt)),tt.setData(Ct)),typeof tt.options.onload=="function"&&tt.options.onload(et,tt,Ct,xt),xt&&st(xt),xt==null&&(tt.options.value=""),et.value=tt.options.value,tt.options.opened==!0&&tt.open()},nt=function(Ct,xt){var It,St;return typeof Ct=="string"?It=Ct:Ct.text?It=Ct.text:Ct.name&&(It=Ct.name),typeof xt=="string"?St=xt:xt.text?St=xt.text:xt.name&&(St=xt.name),typeof It=="string"||typeof St=="string"?(typeof It!="string"&&(It=""+It),typeof St!="string"&&(St=""+St),It.localeCompare(St)):It-St},ot=function(){tt.value={};for(var Ct=0;Ct<tt.items.length;Ct++)tt.items[Ct].selected==!0&&(tt.items[Ct].element&&tt.items[Ct].element.classList.remove("jdropdown-selected"),tt.items[Ct].selected=null);tt.options.value=""},st=function(Ct){if(ot(),Ct!==null)if(!Ct)typeof tt.value[""]!="undefined"&&(tt.value[""]="");else{Array.isArray(Ct)||(Ct=(""+Ct).split(";"));for(var xt=0;xt<Ct.length;xt++)tt.value[Ct[xt]]=""}for(var xt=0;xt<tt.items.length;xt++)typeof tt.value[at(xt)]!="undefined"&&(tt.items[xt].element&&tt.items[xt].element.classList.add("jdropdown-selected"),tt.items[xt].selected=!0,tt.value[at(xt)]=lt(xt));tt.options.value=Object.keys(tt.value).join(";"),tt.header.value=tt.getText()},at=function(Ct,xt){if(tt.options.format)var It="id";else var It="value";return tt.items[Ct]?xt!==void 0?tt.items[Ct].data[It]=xt:tt.items[Ct].data[It]:""},lt=function(Ct,xt){if(tt.options.format)var It="name";else var It="text";return tt.items[Ct]?xt!==void 0?tt.items[Ct].data[It]=xt:tt.items[Ct].data[It]:""},ct=function(){return Object.keys(tt.value)},ht=function(){for(var Ct=[],xt=Object.keys(tt.value),It=0;It<xt.length;It++)Ct.push(tt.value[xt[It]]);return Ct};tt.setOptions=function(Ct,xt){Ct||(Ct={});var It={url:null,data:[],format:0,multiple:!1,autocomplete:!1,remoteSearch:!1,lazyLoading:!1,type:null,width:null,maxWidth:null,opened:!1,value:null,placeholder:"",newOptions:!1,position:!1,onchange:null,onload:null,onopen:null,onclose:null,onfocus:null,onblur:null,oninsert:null,onbeforeinsert:null,sortResults:!1,autofocus:!1};for(var St in It)Ct&&Ct.hasOwnProperty(St)?tt.options[St]=Ct[St]:(typeof tt.options[St]=="undefined"||xt===!0)&&(tt.options[St]=It[St]);return(tt.options.remoteSearch==!0||tt.options.type==="searchbar")&&(tt.options.autocomplete=!0),tt.options.newOptions==!0?tt.header.classList.add("jdropdown-add"):tt.header.classList.remove("jdropdown-add"),tt.options.autocomplete==!0?tt.header.removeAttribute("readonly"):tt.header.setAttribute("readonly","readonly"),tt.options.placeholder?tt.header.setAttribute("placeholder",tt.options.placeholder):tt.header.removeAttribute("placeholder"),et.classList.remove("jdropdown-searchbar"),et.classList.remove("jdropdown-picker"),et.classList.remove("jdropdown-list"),tt.options.type=="searchbar"?et.classList.add("jdropdown-searchbar"):tt.options.type=="list"?et.classList.add("jdropdown-list"):tt.options.type=="picker"?et.classList.add("jdropdown-picker"):_.getWindowWidth()<800?tt.options.autocomplete?(et.classList.add("jdropdown-searchbar"),tt.options.type="searchbar"):(et.classList.add("jdropdown-picker"),tt.options.type="picker"):(tt.options.width?(et.style.width=tt.options.width,et.style.minWidth=tt.options.width):(et.style.removeProperty("width"),et.style.removeProperty("min-width")),et.classList.add("jdropdown-default"),tt.options.type="default"),tt.options.type=="searchbar"?mt.appendChild(ut):dt.insertBefore(ut,dt.firstChild),tt.options.url&&!Ct.data?_.ajax({url:tt.options.url,method:"GET",dataType:"json",success:function(Ot){Ot&&rt(Ot,tt.options.value)}}):rt(tt.options.data,tt.options.value),tt};var mt=null,dt=null,ft=null,ut=null,pt=null,At=null,gt=null,vt=function(){if(it||(it={}),et.tagName=="SELECT"){var Ct=_.dropdown.extractFromDom(et,it);et=Ct.el,it=Ct.options}!it.placeholder&&et.getAttribute("placeholder")&&(it.placeholder=et.getAttribute("placeholder")),tt.value={},tt.items=[],tt.groups=[],tt.search="",tt.results=null,et.classList.add("jdropdown"),mt=document.createElement("div"),mt.className="jdropdown-container-header",tt.header=document.createElement("input"),tt.header.className="jdropdown-header",tt.header.type="text",tt.header.setAttribute("autocomplete","off"),tt.header.onfocus=function(){typeof tt.options.onfocus=="function"&&tt.options.onfocus(et)},tt.header.onblur=function(){typeof tt.options.onblur=="function"&&tt.options.onblur(et)},tt.header.onkeyup=function(xt){tt.options.autocomplete==!0&&!gt?(tt.search!=tt.header.value.trim()&&(gt=setTimeout(function(){tt.find(tt.header.value.trim()),gt=null},400)),et.classList.contains("jdropdown-focus")||tt.open()):tt.options.autocomplete||tt.next(xt.key)},_.dropdown.hasEvents||(_.dropdown.hasEvents=!0,document.addEventListener("keydown",_.dropdown.keydown)),dt=document.createElement("div"),dt.className="jdropdown-container",ft=document.createElement("div"),ft.className="jdropdown-content",ut=document.createElement("div"),ut.className="jdropdown-close",ut.innerHTML="Done",pt=document.createElement("div"),pt.className="jdropdown-reset",pt.innerHTML="x",pt.onclick=function(){tt.reset(),tt.close()},At=document.createElement("div"),At.className="jdropdown-backdrop",mt.appendChild(tt.header),dt.appendChild(ft),et.appendChild(mt),et.appendChild(dt),et.appendChild(At),tt.setOptions(it),"ontouchsend"in document.documentElement?et.addEventListener("touchsend",_.dropdown.mouseup):et.addEventListener("mouseup",_.dropdown.mouseup),tt.options.lazyLoading==!0&&_.lazyLoading(ft,{loadUp:tt.loadUp,loadDown:tt.loadDown}),ft.onwheel=function(xt){xt.stopPropagation()},et.change=tt.setValue,et.val=function(xt){if(xt===void 0)return tt.getValue(!!tt.options.multiple);tt.setValue(xt)},et.dropdown=tt};tt.getUrl=function(){return tt.options.url},tt.setUrl=function(Ct,xt){tt.options.url=Ct,_.ajax({url:tt.options.url,method:"GET",dataType:"json",success:function(It){tt.setData(It),typeof xt=="function"&&xt(tt)}})},tt.setId=function(Ct,xt){if(tt.options.format)var It="id";else var It="value";typeof Ct=="object"?Ct[It]=xt:tt.items[Ct].data[It]=xt},tt.add=function(Ct,xt){if(!Ct){var It=tt.options.autocomplete==!0?tt.header.value:"",Ct=prompt(_.translate("Add A New Option"),It);if(!Ct)return!1}if(xt||(xt=_.guid()),tt.options.format)var St={id:xt,name:Ct};else var St={value:xt,text:Ct};if(typeof tt.options.onbeforeinsert=="function"){var Ot=tt.options.onbeforeinsert(tt,St);if(Ot===!1)return!1;Ot&&(St=Ot)}tt.options.data.push(St);var Mt=tt.createItem(St);return ft.appendChild(Mt.element),typeof tt.options.oninsert=="function"&&tt.options.oninsert(tt,St,Mt),ft.style.display=="none"&&(ft.style.display=""),tt.results&&tt.results.push(Mt),St},tt.createItem=function(Ct,xt,It){tt.options.format?(!Ct.id&&Ct.value!==void 0&&(Ct.id=Ct.value),!Ct.name&&Ct.text!==void 0&&(Ct.name=Ct.text)):(!Ct.value&&Ct.id!==void 0&&(Ct.value=Ct.id),!Ct.text&&Ct.name!==void 0&&(Ct.text=Ct.name));var St={};if(St.element=document.createElement("div"),St.element.className="jdropdown-item",St.element.indexValue=tt.items.length,St.data=Ct,xt&&(St.group=xt),Ct.id&&St.element.setAttribute("id",Ct.id),Ct.disabled==!0&&St.element.setAttribute("data-disabled",!0),Ct.tooltip&&St.element.setAttribute("title",Ct.tooltip),Ct.image){var Ot=document.createElement("img");Ot.className="jdropdown-image",Ot.src=Ct.image,Ct.title||Ot.classList.add("jdropdown-image-small"),St.element.appendChild(Ot)}else if(Ct.icon){var Mt=document.createElement("span");Mt.className="jdropdown-icon material-icons",Mt.innerText=Ct.icon,Ct.title||Mt.classList.add("jdropdown-icon-small"),Ct.color&&(Mt.style.color=Ct.color),St.element.appendChild(Mt)}else if(Ct.color){var jt=document.createElement("div");jt.className="jdropdown-color",jt.style.backgroundColor=Ct.color,St.element.appendChild(jt)}if(tt.options.format)var Ft=Ct.name;else var Ft=Ct.text;var Ut=document.createElement("div");if(Ut.className="jdropdown-description",Ut.innerHTML=Ft||"&nbsp;",Ct.title){var Qt=document.createElement("div");Qt.className="jdropdown-title",Qt.innerText=Ct.title,Ut.appendChild(Qt)}if(tt.options.format)var Ht=Ct.id;else var Ht=Ct.value;return tt.value[Ht]&&(St.element.classList.add("jdropdown-selected"),St.selected=!0),tt.items.push(St),St.element.appendChild(Ut),St},tt.appendData=function(Ct){if(Ct.length){for(var xt=[],It=[],St=0;St<Ct.length;St++)Ct[St].group?(It[Ct[St].group]||(It[Ct[St].group]=[]),It[Ct[St].group].push(St)):xt.push(St);var Ot=0,Mt=Object.keys(It);if(Mt.length>0)for(var St=0;St<Mt.length;St++){var jt=document.createElement("div");jt.className="jdropdown-group";var Ft=document.createElement("div");Ft.className="jdropdown-group-name",Ft.innerHTML=Mt[St];var Ut=document.createElement("i");Ut.className="jdropdown-group-arrow jdropdown-group-arrow-down",Ft.appendChild(Ut);var Qt=document.createElement("div");Qt.className="jdropdown-group-items";for(var Ht=0;Ht<It[Mt[St]].length;Ht++){var Zt=tt.createItem(Ct[It[Mt[St]][Ht]],jt,Mt[St]);(tt.options.lazyLoading==!1||Ot<200)&&(Qt.appendChild(Zt.element),Ot++)}jt.appendChild(Ft),jt.appendChild(Qt),tt.groups.push(jt),Qt.children.length>0&&ft.appendChild(jt)}if(xt.length)for(var St=0;St<xt.length;St++){var Zt=tt.createItem(Ct[xt[St]]);(tt.options.lazyLoading==!1||Ot<200)&&(ft.appendChild(Zt.element),Ot++)}}},tt.setData=function(Ct){if(Ct.length){for(var xt=0;xt<Ct.length;xt++)typeof Ct[xt]!="object"&&(tt.options.format?Ct[xt]={id:Ct[xt],name:Ct[xt]}:Ct[xt]={value:Ct[xt],text:Ct[xt]});ot(),ft.innerHTML="",tt.header.value="",tt.items=[],tt.appendData(Ct),tt.options.data=Ct}},tt.getData=function(){return tt.options.data},tt.getPosition=function(Ct){for(var xt=0;xt<tt.items.length;xt++)if(at(xt)==Ct)return xt;return!1},tt.getText=function(Ct){var xt=ht();return Ct?xt:xt.join("; ")},tt.getValue=function(Ct){var xt=ct();return Ct?xt:xt.join(";")};var yt=function(Ct){typeof tt.options.onchange=="function"&&tt.options.onchange(et,tt,Ct,tt.options.value),et.value!=tt.options.value&&(et.value=tt.options.value,typeof et.oninput=="function"&&et.oninput({type:"input",target:et,value:et.value}))};tt.setValue=function(Ct){var xt=tt.getValue();Array.isArray(Ct)&&(Ct=Ct.join(";")),xt!==Ct&&(st(Ct),yt(xt))},tt.resetSelected=function(){tt.setValue(null)},tt.selectIndex=function(It,xt){var It=parseInt(It);if(tt.items&&tt.items[It]&&(xt===!0||tt.items[It].data.disabled!==!0))if(tt.setCursor(It,!1),!tt.options.multiple)tt.items[It].selected?tt.setValue(null):tt.setValue(at(It)),tt.close();else{var St=tt.options.value;tt.items[It].selected?(tt.items[It].element.classList.remove("jdropdown-selected"),tt.items[It].selected=!1,delete tt.value[at(It)]):(tt.items[It].element.classList.add("jdropdown-selected"),tt.items[It].selected=!0,tt.value[at(It)]=lt(It)),tt.options.value=Object.keys(tt.value).join(";"),tt.options.autocomplete==!1&&(tt.header.value=ht().join("; ")),yt(St)}},tt.selectItem=function(Ct){tt.selectIndex(Ct.indexValue)};var bt=function(Ct,xt){for(var It=0;It<xt.length;It++)if(tt.options.format){if(xt[It].id==Ct)return!0}else if(xt[It].value==Ct)return!0;return!1};return tt.find=function(Ct){if(tt.search==Ct.trim())return!1;if(tt.search=Ct,tt.setCursor(),tt.groups.length)for(var xt=0;xt<tt.groups.length;xt++)tt.groups[xt].lastChild.innerHTML="";if(ft.innerHTML="",tt.options.remoteSearch==!0){tt.results=null;var It=tt.options.url+(tt.options.url.indexOf("?")>0?"&":"?")+"q="+Ct;_.ajax({url:It,method:"GET",dataType:"json",success:function(Qt){tt.items=[];var Ht=Object.keys(tt.value);if(Ht.length)for(var Zt=0;Zt<Ht.length;Zt++)bt(Ht[Zt],Qt)||(tt.options.format?Qt.unshift({id:Ht[Zt],name:tt.value[Ht[Zt]]}):Qt.unshift({value:Ht[Zt],text:tt.value[Ht[Zt]]}));tt.appendData(Qt),Qt.length?ft.style.display="":ft.style.display="none"}})}else{Ct=new RegExp(Ct,"gi");for(var St=[],xt=0;xt<tt.items.length;xt++){var Ot=lt(xt),Mt=tt.items[xt].data.title||"",jt=tt.items[xt].data.group||"",Ft=tt.items[xt].data.synonym||"";Ft&&(Ft=Ft.join(" ")),(Ct==null||tt.items[xt].selected==!0||Ot.match(Ct)||Mt.match(Ct)||jt.match(Ct)||Ft.match(Ct))&&St.push(tt.items[xt])}if(!St.length)ft.style.display="none",tt.results=null;else{ft.style.display="",tt.results=St;var Ut=St.length||0;tt.options.lazyLoading==!0&&Ut>200&&(Ut=200);for(var xt=0;xt<Ut;xt++)tt.results[xt].group?(tt.results[xt].group.parentNode||ft.appendChild(tt.results[xt].group),tt.results[xt].group.lastChild.appendChild(tt.results[xt].element)):ft.appendChild(tt.results[xt].element)}}tt.options.autofocus==!0&&tt.first()},tt.open=function(){if(!et.classList.contains("jdropdown-focus")){_.dropdown.current=tt,_.tracking(tt,!0),et.classList.add("jdropdown-focus"),_.getWindowWidth()<800&&(tt.options.type==null||tt.options.type=="picker")&&_.animation.slideBottom(dt,1),tt.options.autocomplete==!0&&(tt.header.value=tt.search,tt.header.focus());var Ct=ct();if(Ct[0]){var xt=tt.getPosition(Ct[0]);xt!==!1&&tt.setCursor(xt)}if(!tt.options.type||tt.options.type=="default"){var It=et.getBoundingClientRect(),St=dt.getBoundingClientRect();tt.options.position?(dt.style.position="fixed",window.innerHeight<It.bottom+St.height?(dt.style.top="",dt.style.bottom=window.innerHeight-It.top+1+"px"):(dt.style.top=It.bottom+"px",dt.style.bottom=""),dt.style.left=It.left+"px"):window.innerHeight<It.bottom+St.height?(dt.style.top="",dt.style.bottom=It.height+1+"px"):(dt.style.top="",dt.style.bottom=""),dt.style.minWidth=It.width+"px",tt.options.maxWidth&&(dt.style.maxWidth=tt.options.maxWidth),!tt.items.length&&tt.options.autocomplete==!0?ft.style.display="none":ft.style.display=""}}typeof tt.options.onopen=="function"&&tt.options.onopen(et)},tt.close=function(Ct){return et.classList.contains("jdropdown-focus")&&(tt.header.value=tt.getText(),tt.setCursor(),!Ct&&typeof tt.options.onclose=="function"&&tt.options.onclose(et),tt.header.blur&&tt.header.blur(),et.classList.remove("jdropdown-focus"),_.tracking(tt,!1),_.dropdown.current=null),tt.getValue()},tt.setCursor=function(Ct,xt){if(tt.currentIndex!=null&&tt.items&&tt.items[tt.currentIndex]&&tt.items[tt.currentIndex].element.classList.remove("jdropdown-cursor"),Ct==null)tt.currentIndex=null;else if(Ct=parseInt(Ct),tt.items[Ct].element.parentNode&&(tt.items[Ct].element.classList.add("jdropdown-cursor"),tt.currentIndex=Ct,xt!==!1&&tt.items[tt.currentIndex].element)){ft.scrollTop;var It=tt.items[tt.currentIndex].element;ft.scrollTop=It.offsetTop-It.scrollTop+It.clientTop-95}},tt.resetCursor=tt.setCursor,tt.updateCursor=tt.setCursor,tt.reset=function(){tt.setCursor(),tt.setValue(null)},tt.first=function(){tt.options.lazyLoading===!0&&tt.loadFirst();var Ct=ft.querySelectorAll(".jdropdown-item");if(Ct.length){var xt=Ct[0].indexValue;tt.setCursor(xt)}},tt.last=function(){tt.options.lazyLoading===!0&&tt.loadLast();var Ct=ft.querySelectorAll(".jdropdown-item");if(Ct.length){var xt=Ct[Ct.length-1].indexValue;tt.setCursor(xt)}},tt.next=function(Ct){var xt=null;if(Ct){if(Ct.length==1){var It=tt.currentIndex||-1;Ct=Ct.toLowerCase();var St=null,Ot=null,Mt=ft.querySelectorAll(".jdropdown-item");if(Mt.length){for(var jt=0;jt<Mt.length;jt++)if(Mt[jt].indexValue>It&&(St=tt.items[Mt[jt].indexValue])&&(Ot=St.element.innerText[0])&&(Ot=Ot.toLowerCase(),Ct==Ot)){xt=Mt[jt].indexValue;break}tt.setCursor(xt)}}}else if(tt.currentIndex==null||tt.currentIndex==null)tt.first();else{var Ft=tt.items[tt.currentIndex].element,Ut=Ft.nextElementSibling;Ut?(Ut.classList.contains("jdropdown-group")&&(Ut=Ut.lastChild.firstChild),xt=Ut.indexValue):Ft.parentNode.classList.contains("jdropdown-group-items")&&((Ut=Ft.parentNode.parentNode.nextElementSibling)&&(Ut.classList.contains("jdropdown-group")?Ut=Ut.lastChild.firstChild:Ut.classList.contains("jdropdown-item")?xt=Ut.indexValue:Ut=null),Ut&&(xt=Ut.indexValue)),xt!==null&&tt.setCursor(xt)}},tt.prev=function(){var Ct=null;if(tt.currentIndex===null)tt.first();else{var xt=tt.items[tt.currentIndex].element,It=xt.previousElementSibling;It?(It.classList.contains("jdropdown-group")&&(It=It.lastChild.lastChild),Ct=It.indexValue):xt.parentNode.classList.contains("jdropdown-group-items")&&((It=xt.parentNode.parentNode.previousElementSibling)&&(It.classList.contains("jdropdown-group")?It=It.lastChild.lastChild:It.classList.contains("jdropdown-item")?Ct=It.indexValue:It=null),It&&(Ct=It.indexValue))}Ct!==null&&tt.setCursor(Ct)},tt.loadFirst=function(){if(tt.results)var Ct=tt.results;else var Ct=tt.items;var xt=Ct.length||0;tt.options.lazyLoading==!0&&xt>200&&(xt=200),ft.innerHTML="";for(var It=0;It<xt;It++)Ct[It].group?(Ct[It].group.parentNode||ft.appendChild(Ct[It].group),Ct[It].group.lastChild.appendChild(Ct[It].element)):ft.appendChild(Ct[It].element);ft.scrollTop=0},tt.loadLast=function(){if(tt.results)var Ct=tt.results;else var Ct=tt.items;var xt=Ct.length;if(xt>200){xt=xt-200,ft.innerHTML="";for(var It=xt;It<Ct.length;It++)Ct[It].group?(Ct[It].group.parentNode||ft.appendChild(Ct[It].group),Ct[It].group.lastChild.appendChild(Ct[It].element)):ft.appendChild(Ct[It].element);ft.scrollTop=ft.scrollHeight}},tt.loadUp=function(){var Ct=!1;if(tt.results)var xt=tt.results;else var xt=tt.items;var It=ft.querySelectorAll(".jdropdown-item"),St=It[0].indexValue;St=tt.items[St];var Ot=xt.indexOf(St)-1;if(Ot>0){for(var Mt=0;Ot>0&&xt[Ot]&&Mt<200;)xt[Ot].group?(xt[Ot].group.parentNode||ft.insertBefore(xt[Ot].group,ft.firstChild),xt[Ot].group.lastChild.insertBefore(xt[Ot].element,xt[Ot].group.lastChild.firstChild)):ft.insertBefore(xt[Ot].element,ft.firstChild),Ot--,Mt++;Ct=!0}return Ct},tt.loadDown=function(){var Ct=!1;if(tt.results)var xt=tt.results;else var xt=tt.items;var It=ft.querySelectorAll(".jdropdown-item"),St=It[It.length-1].indexValue;St=tt.items[St];var Ot=xt.indexOf(St)+1;if(Ot<xt.length){for(var Mt=0;Ot<xt.length&&xt[Ot]&&Mt<200;)xt[Ot].group?(xt[Ot].group.parentNode||ft.appendChild(xt[Ot].group),xt[Ot].group.lastChild.appendChild(xt[Ot].element)):ft.appendChild(xt[Ot].element),Ot++,Mt++;Ct=!0}return Ct},vt(),tt},_.dropdown.keydown=function(et){var it=null;if(it=_.dropdown.current){if(et.which==13||et.which==9)it.header.value&&it.currentIndex==null&&it.options.newOptions?it.add():(it.currentIndex==null&&it.options.autocomplete==!0&&it.header.value!=""&&it.find(it.header.value),it.selectIndex(it.currentIndex));else if(et.which==38)it.currentIndex==null?it.first():it.currentIndex>0&&it.prev(),et.preventDefault();else if(et.which==40)it.currentIndex==null?it.first():it.currentIndex+1<it.items.length&&it.next(),et.preventDefault();else if(et.which==36)it.first(),et.target.classList.contains("jdropdown-header")||et.preventDefault();else if(et.which==35)it.last(),et.target.classList.contains("jdropdown-header")||et.preventDefault();else if(et.which==27)it.close();else if(et.which==33){if(it.currentIndex==null)it.first();else if(it.currentIndex>0)for(var tt=0;tt<7;tt++)it.prev();et.preventDefault()}else if(et.which==34){if(it.currentIndex==null)it.first();else if(it.currentIndex+1<it.items.length)for(var tt=0;tt<7;tt++)it.next();et.preventDefault()}}},_.dropdown.mouseup=function(et){var it=_.findElement(et.target,"jdropdown");if(it){var tt=it.dropdown;if(et.target.classList.contains("jdropdown-header"))if(it.classList.contains("jdropdown-focus")&&it.classList.contains("jdropdown-default")){var rt=it.getBoundingClientRect();if(et.changedTouches&&et.changedTouches[0]){var nt=et.changedTouches[0].clientX;et.changedTouches[0].clientY}else{var nt=et.clientX;et.clientY}rt.width-(nt-rt.left)<30?et.target.classList.contains("jdropdown-add")?tt.add():tt.close():tt.options.autocomplete==!1&&tt.close()}else tt.open();else if(et.target.classList.contains("jdropdown-group-name")){var ot=et.target.nextSibling.children;if(et.target.nextSibling.style.display!="none")for(var st=0;st<ot.length;st++)ot[st].style.display!="none"&&tt.selectItem(ot[st])}else et.target.classList.contains("jdropdown-group-arrow")?et.target.classList.contains("jdropdown-group-arrow-down")?(et.target.classList.remove("jdropdown-group-arrow-down"),et.target.classList.add("jdropdown-group-arrow-up"),et.target.parentNode.nextSibling.style.display="none"):(et.target.classList.remove("jdropdown-group-arrow-up"),et.target.classList.add("jdropdown-group-arrow-down"),et.target.parentNode.nextSibling.style.display=""):et.target.classList.contains("jdropdown-item")?tt.selectItem(et.target):et.target.classList.contains("jdropdown-image")||et.target.classList.contains("jdropdown-description")?tt.selectItem(et.target.parentNode):et.target.classList.contains("jdropdown-title")?tt.selectItem(et.target.parentNode.parentNode):(et.target.classList.contains("jdropdown-close")||et.target.classList.contains("jdropdown-backdrop"))&&tt.close()}},_.dropdown.extractFromDom=function(et,it){var tt=et;if(it||(it={}),et.getAttribute("multiple")&&(!it||it.multiple==null)&&(it.multiple=!0),et.getAttribute("placeholder")&&(!it||it.placeholder==null)&&(it.placeholder=et.getAttribute("placeholder")),et.getAttribute("data-autocomplete")&&(!it||it.autocomplete==null)&&(it.autocomplete=!0),(!it||it.width==null)&&(it.width=et.offsetWidth),et.value&&(!it||it.value==null)&&(it.value=et.value),!it||it.data==null){it.data=[];for(var rt=0;rt<et.children.length;rt++)if(et.children[rt].tagName=="OPTGROUP")for(var nt=0;nt<et.children[rt].children.length;nt++)it.data.push({value:et.children[rt].children[nt].value,text:et.children[rt].children[nt].innerHTML,group:et.children[rt].getAttribute("label")});else it.data.push({value:et.children[rt].value,text:et.children[rt].innerHTML})}(!it||it.onchange==null)&&(it.onchange=function(st,at,lt,ct){it.multiple==!0?obj.items[at].classList.contains("jdropdown-selected")?tt.options[at].setAttribute("selected","selected"):tt.options[at].removeAttribute("selected"):tt.value=ct});var ot=document.createElement("div");return et.parentNode.insertBefore(ot,et),et.style.display="none",et=ot,{el:et,options:it}},_.editor=function(et,it){var tt={type:"editor"};tt.options={};var rt={value:null,snippet:null,toolbar:null,remoteParser:null,placeholder:null,parseURL:!1,filterPaste:!0,dropZone:!1,dropAsSnippet:!1,acceptImages:!1,acceptFiles:!1,maxFileSize:5e6,allowImageResize:!0,border:!0,padding:!0,maxHeight:null,height:null,focus:!1,onclick:null,onfocus:null,onblur:null,onload:null,onkeyup:null,onkeydown:null,onchange:null};for(var nt in rt)it&&it.hasOwnProperty(nt)?tt.options[nt]=it[nt]:tt.options[nt]=rt[nt];var ot=null,st=null,at=[];et.innerHTML="",tt.el=et,typeof tt.options.onclick=="function"&&(et.onclick=function(Nt){tt.options.onclick(et,tt,Nt)}),et.classList.add("jeditor-container"),tt.options.padding==!0&&et.classList.add("jeditor-padding"),tt.options.border==!1&&(et.style.border="0px");var lt=document.createElement("div");lt.className="jsnippet",lt.setAttribute("contenteditable",!1);var ct=document.createElement("div");ct.className="jeditor-toolbar";var ht=document.createElement("div");if(ht.setAttribute("contenteditable",!0),ht.setAttribute("spellcheck",!1),ht.className="jeditor",tt.options.placeholder&&ht.setAttribute("data-placeholder",tt.options.placeholder),(tt.options.maxHeight||tt.options.height)&&(ht.style.overflowY="auto",tt.options.maxHeight&&(ht.style.maxHeight=tt.options.maxHeight),tt.options.height&&(ht.style.height=tt.options.height)),tt.options.value)var mt=tt.options.value;else var mt=et.innerHTML?et.innerHTML:"";if(!mt)var mt="";var dt=function(Nt){typeof tt.options.onchange=="function"&&tt.options.onchange(et,tt,Nt),tt.options.value=tt.getData(),et.value!=tt.options.value&&(et.value=tt.options.value,typeof et.oninput=="function"&&et.oninput({type:"input",target:et,value:et.value}))},ft=function(Nt){var Lt=document.createElement("div");Lt.innerHTML=Nt;var Kt=Lt.querySelectorAll("img");if(Kt.length)for(var Pt=0;Pt<Kt.length;Pt++)tt.addImage(Kt[Pt].src)},ut=function(Nt){var Lt,Kt;window.getSelection&&(Lt=window.getSelection(),Lt.rangeCount&&(Kt=Lt.getRangeAt(0),Kt.toString(),Kt.deleteContents(),Kt.insertNode(Nt),Kt.setStartAfter(Nt),Kt.setEndAfter(Nt),Lt.removeAllRanges(),Lt.addRange(Kt)))},pt=function(){var Nt=null;if(Nt=lt.children[0]){Nt.classList.contains("jslider-grid")||Nt.classList.add("jslider-grid");var Lt=Nt.children.length;Nt.setAttribute("data-number",Lt>4?4:Lt),Lt>4?Nt.setAttribute("data-total",Lt-4):Nt.removeAttribute("data-total")}},At=function(Nt){lt.innerHTML||gt({}),lt.children[0].appendChild(Nt),pt()},gt=function(Nt){lt.innerHTML="";for(var Lt=["image","title","description","host","url"],Kt=0;Kt<Lt.length;Kt++){var Pt=document.createElement("div");if(Pt.className="jsnippet-"+Lt[Kt],Pt.setAttribute("data-k",Lt[Kt]),lt.appendChild(Pt),Nt[Lt[Kt]])if(Lt[Kt]=="image"){Array.isArray(Nt.image)||(Nt.image=[Nt.image]);for(var ln=0;ln<Nt.image.length;ln++){var Gt=document.createElement("img");Gt.src=Nt.image[ln],Pt.appendChild(Gt)}}else Pt.innerHTML=Nt[Lt[Kt]]}ht.appendChild(document.createElement("br")),ht.appendChild(lt)},vt=function(){clearTimeout(ot),ot=setTimeout(function(){var Nt=ht.querySelector(".jsnippet");if(!Nt){var Lt=ht.innerHTML.replace(/\n/g," "),Kt=document.createElement("div");Kt.innerHTML=Lt;var Pt=Kt.innerText,ln=_.editor.detectUrl(Pt);if(ln)if(ln[0].substr(-3)=="jpg"||ln[0].substr(-3)=="png"||ln[0].substr(-3)=="gif")tt.addImage(ln[0],!0);else{var Gt=_.editor.youtubeParser(ln[0]);tt.parseWebsite(ln[0],Gt)}}},1e3)};tt.parseContent=function(){vt()},tt.parseWebsite=function(Nt,Lt){if(!tt.options.remoteParser)console.log("The remoteParser is not defined");else{if(Lt)var Nt="https://www.youtube.com/watch?v="+Lt;var Kt={title:"",description:"",image:"",host:Nt.split("/")[2],url:Nt};_.ajax({url:tt.options.remoteParser+encodeURI(Nt.trim()),method:"GET",dataType:"json",success:function(Pt){Pt.title&&(Kt.title=Pt.title),Pt.description&&(Kt.description=Pt.description),Pt.host&&(Kt.host=Pt.host),Pt.url&&(Kt.url=Pt.url),gt(Kt),Pt.image?tt.addImage(Pt.image,!0):Pt["og:image"]&&tt.addImage(Pt["og:image"],!0)}})}},tt.setData=function(Nt){ht.innerHTML=Nt,tt.options.focus&&_.editor.setCursor(ht,!0),at=[]},tt.getFiles=function(){for(var Nt=ht.querySelectorAll(".jfile"),Lt=[],Kt=0;Kt<Nt.length;Kt++)at[Nt[Kt].src]&&Lt.push(at[Nt[Kt].src]);return Lt},tt.getText=function(){return ht.innerText},tt.getData=function(Nt){if(Nt){var Lt={content:""};if(lt.innerHTML){Lt.snippet={};for(var Kt=0;Kt<lt.children.length;Kt++){var Pt=lt.children[Kt].getAttribute("data-k");if(Pt)if(Pt=="image"){Lt.snippet.image||(Lt.snippet.image=[]);for(var ln=0;ln<lt.children[Kt].children.length;ln++)Lt.snippet.image.push(lt.children[Kt].children[ln].getAttribute("src"))}else Lt.snippet[Pt]=lt.children[Kt].innerHTML}}var Gt=Object.keys(at);if(Gt.length){Lt.files=[];for(var Kt=0;Kt<Gt.length;Kt++)Lt.files.push(at[Gt[Kt]])}var on=ht.innerHTML;on=on.replace(/<br>/g,`
`),on=on.replace(/<\/div>/g,`</div>
`),on=on.replace(/<(?:.|\n)*?>/gm,""),Lt.content=on.trim()}else var Lt=ht.innerHTML;return Lt},tt.reset=function(){ht.innerHTML="",lt.innerHTML="",at=[]},tt.addPdf=function(Nt){if(Nt.result.substr(0,4)!="data")console.error("Invalid source");else{var Lt=document.createElement("canvas");Lt.width=60,Lt.height=60;var Kt=new Image,Pt=Lt.getContext("2d");Pt.drawImage(Kt,0,0,Lt.width,Lt.height),Lt.toBlob(function(ln){var Gt=document.createElement("img");Gt.src=window.URL.createObjectURL(ln),Gt.title=Nt.name,Gt.className="jfile pdf",at[Gt.src]={file:Gt.src,extension:"pdf",content:Nt.result},ut(Gt)})}},tt.addImage=function(Nt,Lt){if(Nt||(Nt=""),Nt.substr(0,4)!="data"&&!tt.options.remoteParser)console.error("remoteParser not defined in your initialization");else{if(Nt.substr(0,4)=="data"){var Kt=Nt.split(";");Kt=Kt[0].split("/"),Kt=Kt[1]}else{var Kt=Nt.substr(Nt.lastIndexOf(".")+1);Nt=tt.options.remoteParser+Nt}var Pt=new Image;Pt.onload=function(){var Gt=document.createElement("canvas");Gt.width=Pt.width,Gt.height=Pt.height;var on=Gt.getContext("2d");on.drawImage(Pt,0,0,Gt.width,Gt.height),Gt.toBlob(function(tn){var _i=document.createElement("img");_i.src=window.URL.createObjectURL(tn),_i.classList.add("jfile"),_i.setAttribute("tabindex","900"),at[_i.src]={file:_i.src,extension:Kt,content:Gt.toDataURL()},tt.options.dropAsSnippet||Lt?(At(_i),at[_i.src].snippet=!0):ut(_i),dt()})},Pt.src=Nt}},tt.addFile=function(Nt){for(var Lt=[],Kt=0;Kt<Nt.length;Kt++)if(Nt[Kt].size>tt.options.maxFileSize)alert("The file is too big");else{var Pt=Nt[Kt].type.split("/");Pt[0]=="image"?Pt=1:Pt[1]=="pdf"?Pt=2:Pt=0,Pt?(Lt[Kt]=new FileReader,Lt[Kt].index=Kt,Lt[Kt].type=Pt,Lt[Kt].name=Nt[Kt].name,Lt[Kt].date=Nt[Kt].lastModified,Lt[Kt].size=Nt[Kt].size,Lt[Kt].addEventListener("load",function(ln){ln.target.type==2?tt.options.acceptFiles==!0&&tt.addPdf(ln.target):tt.addImage(ln.target.result)},!1),Lt[Kt].readAsDataURL(Nt[Kt])):alert("The extension is not allowed")}},tt.destroy=function(){ht.removeEventListener("mouseup",yt),ht.removeEventListener("mousedown",bt),ht.removeEventListener("mousemove",Ct),ht.removeEventListener("keyup",xt),ht.removeEventListener("keydown",It),ht.removeEventListener("dragstart",Qt),ht.removeEventListener("dragenter",Ht),ht.removeEventListener("dragover",Zt),ht.removeEventListener("drop",Wt),ht.removeEventListener("paste",Ut),typeof tt.options.onblur=="function"&&ht.removeEventListener("blur",$t),typeof tt.options.onfocus=="function"&&ht.removeEventListener("focus",Jt),et.editor=null,et.classList.remove("jeditor-container"),ct.remove(),lt.remove(),ht.remove()};var yt=function(Nt){st&&st.e&&st.e.classList.remove("resizing"),st=!1},bt=function(Nt){var Lt=function(Gt){var on=Gt.getBoundingClientRect();on.width-(Nt.clientX-on.left)<40&&Nt.clientY-on.top<40&&(Gt.innerHTML="",Gt.remove())};if(Nt.target.tagName=="IMG")if(Nt.target.style.cursor){var Kt=Nt.target.getBoundingClientRect();st={e:Nt.target,x:Nt.clientX,y:Nt.clientY,w:Kt.width,h:Kt.height,d:Nt.target.style.cursor},Nt.target.width||(Nt.target.width=Kt.width+"px"),Nt.target.height||(Nt.target.height=Kt.height+"px");var Pt=window.getSelection();if(Pt.rangeCount)for(var ln=0;ln<Pt.rangeCount;ln++)Pt.removeRange(Pt.getRangeAt(ln));Nt.target.classList.add("resizing")}else st=!0;else Nt.target.classList.contains("jsnippet")?Lt(Nt.target):Nt.target.parentNode.classList.contains("jsnippet")&&Lt(Nt.target.parentNode),st=!0},Ct=function(Nt){if(Nt.target.tagName=="IMG"&&!Nt.target.parentNode.classList.contains("jsnippet-image")&&tt.options.allowImageResize==!0&&Nt.target.getAttribute("tabindex")){var Lt=Nt.target.getBoundingClientRect();Nt.clientY-Lt.top<5?Lt.width-(Nt.clientX-Lt.left)<5?Nt.target.style.cursor="ne-resize":Nt.clientX-Lt.left<5?Nt.target.style.cursor="nw-resize":Nt.target.style.cursor="n-resize":Lt.height-(Nt.clientY-Lt.top)<5?Lt.width-(Nt.clientX-Lt.left)<5?Nt.target.style.cursor="se-resize":Nt.clientX-Lt.left<5?Nt.target.style.cursor="sw-resize":Nt.target.style.cursor="s-resize":Lt.width-(Nt.clientX-Lt.left)<5?Nt.target.style.cursor="e-resize":Nt.clientX-Lt.left<5?Nt.target.style.cursor="w-resize":Nt.target.style.cursor=""}if(Nt.which==1&&st&&st.d){if(st.d=="e-resize"||st.d=="ne-resize"||st.d=="se-resize")if(st.e.width=st.w+(Nt.clientX-st.x),Nt.shiftKey){var Kt=(Nt.clientX-st.x)*(st.h/st.w);st.e.height=st.h+Kt}else var Kt=null;Kt||(st.d=="s-resize"||st.d=="se-resize"||st.d=="sw-resize")&&(Nt.shiftKey||(st.e.height=st.h+(Nt.clientY-st.y)))}},xt=function(Nt){ht.innerHTML||(ht.innerHTML="<div><br></div>"),typeof tt.options.onkeyup=="function"&&tt.options.onkeyup(et,tt,Nt)},It=function(Nt){tt.options.parseURL==!0&&vt(),typeof tt.options.onkeydown=="function"&&tt.options.onkeydown(et,tt,Nt),Nt.key=="Delete"&&Nt.target.tagName=="IMG"&&Nt.target.parentNode.classList.contains("jsnippet-image")&&(Nt.target.remove(),pt())},St=[HTMLUnknownElement,HTMLAudioElement,HTMLEmbedElement,HTMLIFrameElement,HTMLTextAreaElement,HTMLInputElement,HTMLScriptElement],Ot=["width","height","align","border","src","tabindex"],Mt=["color","font-weight","font-size","background","background-color","margin"],jt=function(Nt){if(Nt.attributes&&Nt.attributes.length){var Lt=null,Kt=Nt.getAttribute("style");if(Kt){Lt=[];for(var Pt=Kt.split(";"),ln=0;ln<Pt.length;ln++){var Gt=Pt[ln].trim().split(":");if(Mt.indexOf(Gt[0].trim())>=0){var on=Gt.shift(),Gt=Gt.join(":");Lt.push(on+":"+Gt)}}}Nt.tagName.toUpperCase()=="IMG"&&(!tt.options.acceptImages||!Nt.src?Nt.parentNode.removeChild(Nt):(Nt.setAttribute("tabindex","900"),tt.addImage(Nt.src)));var tn=[],_i=Nt.attributes.length-1;if(_i>0){for(var Xt=_i;Xt>=0;Xt--)tn.push(Nt.attributes[Xt].name);tn.forEach(function(Vt){Ot.indexOf(Vt)==-1&&Nt.removeAttribute(Vt)})}Nt.style="",Lt&&Lt.length&&Nt.setAttribute("style",Lt.join(";"))}if(Nt.children.length)for(var Xt=0;Xt<Nt.children.length;Xt++)jt(Nt.children[Xt]);St.indexOf(Nt.constructor)>=0&&Nt.remove()},Ft=function(Nt){Nt&&(Nt=Nt.replace(new RegExp("<!--(.*?)-->","gsi"),""));var Lt=new DOMParser,Kt=Lt.parseFromString(Nt,"text/html");jt(Kt);var Pt=document.createElement("span");return Pt.innerHTML=Kt.firstChild.innerHTML,Pt},Ut=function(Nt){if(tt.options.filterPaste==!0){if(Nt.clipboardData||Nt.originalEvent.clipboardData)var Lt=(Nt.originalEvent||Nt).clipboardData.getData("text/html"),Kt=(Nt.originalEvent||Nt).clipboardData.getData("text/plain"),Pt=(Nt.originalEvent||Nt).clipboardData.files;else if(window.clipboardData)var Lt=window.clipboardData.getData("Html"),Kt=window.clipboardData.getData("Text"),Pt=window.clipboardData.files;if(Pt.length)tt.addFile(Pt);else if(!Lt)Lt=Kt.split(`\r
`),Nt.target.innerText?(Lt=Lt.map(function(Gt){return"<div>"+Gt+"</div>"}),document.execCommand("insertHtml",!1,Lt.join(""))):Lt.map(function(Gt){var on=document.createElement("div");on.innerText=Gt,ht.appendChild(on)});else{var ln=Ft(Lt);document.execCommand("insertHtml",!1,ln.innerHTML)}Nt.preventDefault()}},Qt=function(Nt){st&&st.e&&Nt.preventDefault()},Ht=function(Nt){st||tt.options.dropZone==!1||(et.classList.add("jeditor-dragging"),Nt.preventDefault())},Zt=function(Nt){st||tt.options.dropZone==!1||(ot&&clearTimeout(ot),ot=setTimeout(function(){et.classList.remove("jeditor-dragging")},100),Nt.preventDefault())},Wt=function(Nt){if(!(st||tt.options.dropZone==!1)){var Lt=null;document.caretRangeFromPoint?Lt=document.caretRangeFromPoint(Nt.clientX,Nt.clientY):Nt.rangeParent&&(Lt=document.createRange(),Lt.setStart(Nt.rangeParent,Nt.rangeOffset));var Kt=window.getSelection();Kt.removeAllRanges(),Kt.addRange(Lt),Kt.anchorNode.parentNode.focus();var Pt=(Nt.originalEvent||Nt).dataTransfer.getData("text/html"),ln=(Nt.originalEvent||Nt).dataTransfer.getData("text/plain"),Gt=(Nt.originalEvent||Nt).dataTransfer.files;Gt.length?tt.addFile(Gt):ln&&ft(Pt),et.classList.remove("jeditor-dragging"),Nt.preventDefault()}},$t=function(Nt){typeof tt.options.onblur=="function"&&tt.options.onblur(et,tt,Nt),dt(Nt)},Jt=function(Nt){typeof tt.options.onfocus=="function"&&tt.options.onfocus(et,tt,Nt)};return ht.addEventListener("mouseup",yt),ht.addEventListener("mousedown",bt),ht.addEventListener("mousemove",Ct),ht.addEventListener("keyup",xt),ht.addEventListener("keydown",It),ht.addEventListener("dragstart",Qt),ht.addEventListener("dragenter",Ht),ht.addEventListener("dragover",Zt),ht.addEventListener("drop",Wt),ht.addEventListener("paste",Ut),ht.addEventListener("focus",Jt),ht.addEventListener("blur",$t),typeof tt.options.onload=="function"&&tt.options.onload(et,tt,ht),ht.innerHTML=mt,et.appendChild(ht),tt.options.snippet&&gt(tt.options.snippet),tt.options.toolbar==null&&(tt.options.toolbar=_.editor.getDefaultToolbar()),tt.options.toolbar&&(et.appendChild(ct),_.toolbar(ct,{container:!0,responsive:!0,items:tt.options.toolbar})),tt.options.focus&&_.editor.setCursor(ht,tt.options.focus=="initial"),et.change=tt.setData,et.val=function(Nt){if(Nt===void 0){var Lt=et.getAttribute("data-html")!=="true";return tt.getData(Lt)}else tt.setData(Nt)},et.editor=tt,tt},_.editor.setCursor=function(et,it){et.focus(),document.execCommand("selectAll");var tt=window.getSelection(),rt=tt.getRangeAt(0);if(it==!0)var nt=rt.startContainer,ot=0;else var nt=rt.endContainer,ot=nt.length;rt.setStart(nt,ot),rt.setEnd(nt,ot),tt.removeAllRanges(),tt.addRange(rt)},_.editor.getDomain=function(et){return et.replace("http://","").replace("https://","").replace("www.","").split(/[/?#]/)[0].split(/:/g)[0]},_.editor.detectUrl=function(et){var it=/(((https?:\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]+)/ig,tt=et.match(it);return tt&&tt[0].substr(0,3)=="www"&&(tt[0]="http://"+tt[0]),tt},_.editor.youtubeParser=function(et){var it=/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/,tt=et.match(it);return tt&&tt[7].length==11?tt[7]:!1},_.editor.getDefaultToolbar=function(){return[{content:"undo",onclick:function(){document.execCommand("undo")}},{content:"redo",onclick:function(){document.execCommand("redo")}},{type:"divisor"},{content:"format_bold",onclick:function(et,it,tt){document.execCommand("bold"),document.queryCommandState("bold")?tt.classList.add("selected"):tt.classList.remove("selected")}},{content:"format_italic",onclick:function(et,it,tt){document.execCommand("italic"),document.queryCommandState("italic")?tt.classList.add("selected"):tt.classList.remove("selected")}},{content:"format_underline",onclick:function(et,it,tt){document.execCommand("underline"),document.queryCommandState("underline")?tt.classList.add("selected"):tt.classList.remove("selected")}},{type:"divisor"},{content:"format_list_bulleted",onclick:function(et,it,tt){document.execCommand("insertUnorderedList"),document.queryCommandState("insertUnorderedList")?tt.classList.add("selected"):tt.classList.remove("selected")}},{content:"format_list_numbered",onclick:function(et,it,tt){document.execCommand("insertOrderedList"),document.queryCommandState("insertOrderedList")?tt.classList.add("selected"):tt.classList.remove("selected")}},{content:"format_indent_increase",onclick:function(et,it,tt){document.execCommand("indent",!0,null),document.queryCommandState("indent")?tt.classList.add("selected"):tt.classList.remove("selected")}},{content:"format_indent_decrease",onclick:function(){document.execCommand("outdent"),document.queryCommandState("outdent")?this.classList.add("selected"):this.classList.remove("selected")}}]},_.form=function(et,it){var tt={};tt.options={};var rt={url:null,message:"Are you sure? There are unsaved information in your form",ignore:!1,currentHash:null,submitButton:null,validations:null,onbeforeload:null,onload:null,onbeforesave:null,onsave:null,onbeforeremove:null,onremove:null,onerror:function(at,lt){_.alert(lt)}};for(var nt in rt)it&&it.hasOwnProperty(nt)?tt.options[nt]=it[nt]:tt.options[nt]=rt[nt];tt.options.validations||(tt.options.validations={}),tt.options.submitButton||(tt.options.submitButton=et.querySelector("input[type=submit]")),tt.options.submitButton&&tt.options.url&&(tt.options.submitButton.onclick=function(){tt.save()}),tt.options.validations.email||(tt.options.validations.email=_.validations.email),tt.options.validations.length||(tt.options.validations.length=_.validations.length),tt.options.validations.required||(tt.options.validations.required=_.validations.required),tt.setUrl=function(at){tt.options.url=at},tt.load=function(){_.ajax({url:tt.options.url,method:"GET",dataType:"json",queue:!0,success:function(at){if(typeof tt.options.onbeforeload=="function"){var lt=tt.options.onbeforeload(et,at);lt&&(at=lt)}_.form.setElements(et,at),typeof tt.options.onload=="function"&&tt.options.onload(et,at)}})},tt.save=function(){var at=tt.validate();if(at)tt.options.onerror(et,at);else{var lt=_.form.getElements(et,!0);if(typeof tt.options.onbeforesave=="function"){var lt=tt.options.onbeforesave(et,lt);if(lt===!1)return}_.ajax({url:tt.options.url,method:"POST",dataType:"json",data:lt,success:function(ct){typeof tt.options.onsave=="function"&&tt.options.onsave(et,lt,ct)}})}},tt.remove=function(){if(typeof tt.options.onbeforeremove=="function"){var at=tt.options.onbeforeremove(et,tt);if(at===!1)return!1}_.ajax({url:tt.options.url,method:"DELETE",dataType:"json",success:function(lt){typeof tt.options.onremove=="function"&&tt.options.onremove(et,tt,lt),tt.reset()}})};var ot=function(at){at.classList.add("error"),tt.options.submitButton&&tt.options.submitButton.setAttribute("disabled",!0);var lt=at.getAttribute("data-error")||"There is an error in the form";return at.setAttribute("title",lt),lt},st=function(at){var lt=!1;at.classList.remove("error"),at.removeAttribute("title");for(var ct=et.querySelectorAll("input, select, textarea, div[name]"),ht=0;ht<ct.length;ht++)ct[ht].getAttribute("data-validation")&&ct[ht].classList.contains("error")&&(lt=!0);tt.options.submitButton&&(lt?tt.options.submitButton.setAttribute("disabled",!0):tt.options.submitButton.removeAttribute("disabled"))};return tt.validateElement=function(at){var lt=!1,ct=_.form.getValue(at),ht=at.getAttribute("data-validation");return typeof tt.options.validations[ht]=="function"&&!tt.options.validations[ht](ct,at)?lt=ot(at):at.classList.contains("error")&&st(at),lt},tt.reset=function(){for(var at=et.querySelectorAll("input, select, textarea, div[name]"),lt=0;lt<at.length;lt++)at[lt].getAttribute("name")&&(at[lt].type=="checkbox"||at[lt].type=="radio"?at[lt].checked=!1:typeof at[lt].val=="function"?at[lt].val(""):at[lt].value="")},tt.validate=function(){for(var at=[],lt=et.querySelectorAll("input, select, textarea, div[name]"),ct=0;ct<lt.length;ct++)if(lt[ct].getAttribute("data-validation")){var ht=tt.validateElement(lt[ct]);ht&&at.push(ht)}return at.length>0?at.join("<br>"):!1},tt.getError=function(){return!!tt.validation()},tt.setHash=function(){return tt.getHash(_.form.getElements(et))},tt.getHash=function(at){var lt=0,ct,ht;if(at.length===0)return lt;for(ct=0;ct<at.length;ct++)ht=at.charCodeAt(ct),lt=(lt<<5)-lt+ht,lt|=0;return lt},tt.isChanged=function(){var at=tt.setHash();return tt.options.currentHash!=at},tt.resetTracker=function(){tt.options.currentHash=tt.setHash(),tt.options.ignore=!1},tt.setIgnore=function(at){tt.options.ignore=!!at},setTimeout(function(){tt.options.currentHash=tt.setHash()},1e3),et.addEventListener("keyup",function(at){at.target.getAttribute("data-validation")&&tt.validateElement(at.target)}),_.form.hasEvents||(window.addEventListener("beforeunload",function(at){if(tt.isChanged()&&tt.options.ignore==!1){var lt=tt.options.message?tt.options.message:"o/";return lt?(typeof at=="undefined"&&(at=window.event),at&&(at.returnValue=lt),lt):void 0}}),_.form.hasEvents=!0),et.form=tt,tt},_.form.getValue=function(et){var it=null;if(et.type=="checkbox")et.checked==!0&&(it=et.value||!0);else if(et.type=="radio")et.checked==!0&&(it=et.value);else if(et.type=="file")it=et.files;else if(et.tagName=="select"&&et.multiple==!0){it=[];for(var tt=et.querySelectorAll("options[selected]"),rt=0;rt<tt.length;rt++)it.push(tt[rt].value)}else typeof et.val=="function"?it=et.val():it=et.value||"";return it},_.form.getElements=function(et,it){for(var tt={},rt=null,nt=et.querySelectorAll("input, select, textarea, div[name]"),ot=0;ot<nt.length;ot++)(rt=nt[ot].getAttribute("name"))&&(tt[rt]=_.form.getValue(nt[ot])||"");return it==!0?tt:JSON.stringify(tt)},_.form.setElements=function(et,it){for(var tt=null,rt=null,nt=et.querySelectorAll("input, select, textarea, div[name]"),ot=0;ot<nt.length;ot++){var st=nt[ot].getAttribute("type");if(tt=nt[ot].getAttribute("name")){if(tt=tt.replace(new RegExp(/\[(.*?)\]/ig),".$1"),rt=null,tt.match(/\./)){var at=_.path.call(it,tt)||"";typeof at!="undefined"&&(rt=at)}else typeof it[tt]!="undefined"&&(rt=it[tt]);rt!==null&&(st=="checkbox"||st=="radio"?nt[ot].checked=!!rt:st=="file"||(typeof nt[ot].val=="function"?nt[ot].val(rt):nt[ot].value=rt))}}},_.tracker=_.form,_.focus=function(et){if(et.innerText.length){var it=document.createRange(),tt=window.getSelection(),rt=et.childNodes[et.childNodes.length-1];it.setStart(rt,rt.length),it.collapse(!0),tt.removeAllRanges(),tt.addRange(it),et.scrollLeft=et.scrollWidth}},_.isNumeric=function(et){return!isNaN(et)&&et!==null&&et!==""},_.guid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(et){var it=Math.random()*16|0,tt=et=="x"?it:it&3|8;return tt.toString(16)})},_.getNode=function(){var et=document.getSelection().anchorNode;return et?et.nodeType==3?et.parentNode:et:null},_.hash=function(et){var it=0,tt,rt;if(et.length===0)return it;for(tt=0;tt<et.length;tt++)rt=et.charCodeAt(tt),rt>32&&(it=(it<<5)-it+rt,it|=0);return it},_.randomColor=function(et){var it=-.25,tt=String("#"+Math.random().toString(16).slice(2,8).toUpperCase()).replace(/[^0-9a-f]/gi,"");tt.length<6&&(tt=tt[0]+tt[0]+tt[1]+tt[1]+tt[2]+tt[2]);var rt=[],nt,ot;for(ot=0;ot<3;ot++)nt=parseInt(tt.substr(ot*2,2),16),nt=Math.round(Math.min(Math.max(0,nt+nt*it),255)).toString(16),rt.push(("00"+nt).substr(nt.length));return et==!0?"#"+_.two(rt[0].toString(16))+_.two(rt[1].toString(16))+_.two(rt[2].toString(16)):rt},_.getWindowWidth=function(){var et=window,it=document,tt=it.documentElement,rt=it.getElementsByTagName("body")[0],nt=et.innerWidth||tt.clientWidth||rt.clientWidth;return nt},_.getWindowHeight=function(){var et=window,it=document,tt=it.documentElement,rt=it.getElementsByTagName("body")[0],nt=et.innerHeight||tt.clientHeight||rt.clientHeight;return nt},_.getPosition=function(et){if(et.changedTouches&&et.changedTouches[0])var it=et.changedTouches[0].pageX,tt=et.changedTouches[0].pageY;else var it=window.Event?et.pageX:et.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft),tt=window.Event?et.pageY:et.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);return[it,tt]},_.click=function(et){if(et.click)et.click();else{var it=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});et.dispatchEvent(it)}},_.findElement=function(et,it){var tt=!1;function rt(nt){nt&&!tt&&(typeof it=="function"?tt=it(nt):typeof it=="string"&&nt.classList&&nt.classList.contains(it)&&(tt=nt)),nt.parentNode&&!tt&&rt(nt.parentNode)}return rt(et),tt},_.two=function(et){return et=""+et,et.length==1&&(et="0"+et),et},_.sha512=function(Zt){function it(Jt,Nt){this.highOrder=Jt,this.lowOrder=Nt}var tt=[new it(1779033703,4089235720),new it(3144134277,2227873595),new it(1013904242,4271175723),new it(2773480762,1595750129),new it(1359893119,2917565137),new it(2600822924,725511199),new it(528734635,4215389547),new it(1541459225,327033209)],rt=[new it(1116352408,3609767458),new it(1899447441,602891725),new it(3049323471,3964484399),new it(3921009573,2173295548),new it(961987163,4081628472),new it(1508970993,3053834265),new it(2453635748,2937671579),new it(2870763221,3664609560),new it(3624381080,2734883394),new it(310598401,1164996542),new it(607225278,1323610764),new it(1426881987,3590304994),new it(1925078388,4068182383),new it(2162078206,991336113),new it(2614888103,633803317),new it(3248222580,3479774868),new it(3835390401,2666613458),new it(4022224774,944711139),new it(264347078,2341262773),new it(604807628,2007800933),new it(770255983,1495990901),new it(1249150122,1856431235),new it(1555081692,3175218132),new it(1996064986,2198950837),new it(2554220882,3999719339),new it(2821834349,766784016),new it(2952996808,2566594879),new it(3210313671,3203337956),new it(3336571891,1034457026),new it(3584528711,2466948901),new it(113926993,3758326383),new it(338241895,168717936),new it(666307205,1188179964),new it(773529912,1546045734),new it(1294757372,1522805485),new it(1396182291,2643833823),new it(1695183700,2343527390),new it(1986661051,1014477480),new it(2177026350,1206759142),new it(2456956037,344077627),new it(2730485921,1290863460),new it(2820302411,3158454273),new it(3259730800,3505952657),new it(3345764771,106217008),new it(3516065817,3606008344),new it(3600352804,1432725776),new it(4094571909,1467031594),new it(275423344,851169720),new it(430227734,3100823752),new it(506948616,1363258195),new it(659060556,3750685593),new it(883997877,3785050280),new it(958139571,3318307427),new it(1322822218,3812723403),new it(1537002063,2003034995),new it(1747873779,3602036899),new it(1955562222,1575990012),new it(2024104815,1125592928),new it(2227730452,2716904306),new it(2361852424,442776044),new it(2428436474,593698344),new it(2756734187,3733110249),new it(3204031479,2999351573),new it(3329325298,3815920427),new it(3391569614,3928383900),new it(3515267271,566280711),new it(3940187606,3454069534),new it(4118630271,4000239992),new it(116418474,1914138554),new it(174292421,2731055270),new it(289380356,3203993006),new it(460393269,320620315),new it(685471733,587496836),new it(852142971,1086792851),new it(1017036298,365543100),new it(1126000580,2618297676),new it(1288033470,3409855158),new it(1501505948,4234509866),new it(1607167915,987167468),new it(1816402316,1246189591)],nt=new Array(64),ot,st,at,lt,ct,ht,mt,dt,ft,ut,pt,At,gt=8;function vt(Jt){return unescape(encodeURIComponent(Jt))}function yt(Jt){for(var Nt=[],Lt=(1<<gt)-1,Kt=Jt.length*gt,Pt=0;Pt<Kt;Pt+=gt)Nt[Pt>>5]|=(Jt.charCodeAt(Pt/gt)&Lt)<<32-gt-Pt%32;return Nt}function bt(Jt){for(var Nt="0123456789abcdef",Lt="",Kt=Jt.length*4,Pt,ln=0;ln<Kt;ln+=1)Pt=Jt[ln>>2]>>(3-ln%4)*8,Lt+=Nt.charAt(Pt>>4&15)+Nt.charAt(Pt&15);return Lt}function Ct(Jt,Nt){var Lt,Kt,Pt,ln;return Lt=(Jt.lowOrder&65535)+(Nt.lowOrder&65535),Kt=(Jt.lowOrder>>>16)+(Nt.lowOrder>>>16)+(Lt>>>16),Pt=(Kt&65535)<<16|Lt&65535,Lt=(Jt.highOrder&65535)+(Nt.highOrder&65535)+(Kt>>>16),Kt=(Jt.highOrder>>>16)+(Nt.highOrder>>>16)+(Lt>>>16),ln=(Kt&65535)<<16|Lt&65535,new it(ln,Pt)}function xt(Jt,Nt,Lt,Kt){var Pt,ln,Gt,on;return Pt=(Jt.lowOrder&65535)+(Nt.lowOrder&65535)+(Lt.lowOrder&65535)+(Kt.lowOrder&65535),ln=(Jt.lowOrder>>>16)+(Nt.lowOrder>>>16)+(Lt.lowOrder>>>16)+(Kt.lowOrder>>>16)+(Pt>>>16),Gt=(ln&65535)<<16|Pt&65535,Pt=(Jt.highOrder&65535)+(Nt.highOrder&65535)+(Lt.highOrder&65535)+(Kt.highOrder&65535)+(ln>>>16),ln=(Jt.highOrder>>>16)+(Nt.highOrder>>>16)+(Lt.highOrder>>>16)+(Kt.highOrder>>>16)+(Pt>>>16),on=(ln&65535)<<16|Pt&65535,new it(on,Gt)}function It(Jt,Nt,Lt,Kt,Pt){var ln,Gt,on,tn;return ln=(Jt.lowOrder&65535)+(Nt.lowOrder&65535)+(Lt.lowOrder&65535)+(Kt.lowOrder&65535)+(Pt.lowOrder&65535),Gt=(Jt.lowOrder>>>16)+(Nt.lowOrder>>>16)+(Lt.lowOrder>>>16)+(Kt.lowOrder>>>16)+(Pt.lowOrder>>>16)+(ln>>>16),on=(Gt&65535)<<16|ln&65535,ln=(Jt.highOrder&65535)+(Nt.highOrder&65535)+(Lt.highOrder&65535)+(Kt.highOrder&65535)+(Pt.highOrder&65535)+(Gt>>>16),Gt=(Jt.highOrder>>>16)+(Nt.highOrder>>>16)+(Lt.highOrder>>>16)+(Kt.highOrder>>>16)+(Pt.highOrder>>>16)+(ln>>>16),tn=(Gt&65535)<<16|ln&65535,new it(tn,on)}function St(Jt,Nt,Lt){return new it(Jt.highOrder&Nt.highOrder^Jt.highOrder&Lt.highOrder^Nt.highOrder&Lt.highOrder,Jt.lowOrder&Nt.lowOrder^Jt.lowOrder&Lt.lowOrder^Nt.lowOrder&Lt.lowOrder)}function Ot(Jt,Nt,Lt){return new it(Jt.highOrder&Nt.highOrder^~Jt.highOrder&Lt.highOrder,Jt.lowOrder&Nt.lowOrder^~Jt.lowOrder&Lt.lowOrder)}function Mt(Jt,Nt){return Nt<=32?new it(Jt.highOrder>>>Nt|Jt.lowOrder<<32-Nt,Jt.lowOrder>>>Nt|Jt.highOrder<<32-Nt):new it(Jt.lowOrder>>>Nt|Jt.highOrder<<32-Nt,Jt.highOrder>>>Nt|Jt.lowOrder<<32-Nt)}function jt(Jt){var Nt=Mt(Jt,28),Lt=Mt(Jt,34),Kt=Mt(Jt,39);return new it(Nt.highOrder^Lt.highOrder^Kt.highOrder,Nt.lowOrder^Lt.lowOrder^Kt.lowOrder)}function Ft(Jt){var Nt=Mt(Jt,14),Lt=Mt(Jt,18),Kt=Mt(Jt,41);return new it(Nt.highOrder^Lt.highOrder^Kt.highOrder,Nt.lowOrder^Lt.lowOrder^Kt.lowOrder)}function Ut(Jt){var Nt=Mt(Jt,1),Lt=Mt(Jt,8),Kt=Ht(Jt,7);return new it(Nt.highOrder^Lt.highOrder^Kt.highOrder,Nt.lowOrder^Lt.lowOrder^Kt.lowOrder)}function Qt(Jt){var Nt=Mt(Jt,19),Lt=Mt(Jt,61),Kt=Ht(Jt,6);return new it(Nt.highOrder^Lt.highOrder^Kt.highOrder,Nt.lowOrder^Lt.lowOrder^Kt.lowOrder)}function Ht(Jt,Nt){return Nt<=32?new it(Jt.highOrder>>>Nt,Jt.lowOrder>>>Nt|Jt.highOrder<<32-Nt):new it(0,Jt.highOrder<<32-Nt)}var Zt=vt(Zt),Wt=Zt.length*gt;Zt=yt(Zt),Zt[Wt>>5]|=128<<24-Wt%32,Zt[(Wt+128>>10<<5)+31]=Wt;for(var ft=0;ft<Zt.length;ft+=32){ot=tt[0],st=tt[1],at=tt[2],lt=tt[3],ct=tt[4],ht=tt[5],mt=tt[6],dt=tt[7];for(var ut=0;ut<80;ut++)ut<16?nt[ut]=new it(Zt[ut*2+ft],Zt[ut*2+ft+1]):nt[ut]=xt(Qt(nt[ut-2]),nt[ut-7],Ut(nt[ut-15]),nt[ut-16]),pt=It(dt,Ft(ct),Ot(ct,ht,mt),rt[ut],nt[ut]),At=Ct(jt(ot),St(ot,st,at)),dt=mt,mt=ht,ht=ct,ct=Ct(lt,pt),lt=at,at=st,st=ot,ot=Ct(pt,At);tt[0]=Ct(ot,tt[0]),tt[1]=Ct(st,tt[1]),tt[2]=Ct(at,tt[2]),tt[3]=Ct(lt,tt[3]),tt[4]=Ct(ct,tt[4]),tt[5]=Ct(ht,tt[5]),tt[6]=Ct(mt,tt[6]),tt[7]=Ct(dt,tt[7])}for(var $t=[],ft=0;ft<tt.length;ft++)$t.push(tt[ft].highOrder),$t.push(tt[ft].lowOrder);return bt($t)},_.login||(_.login={},_.login.sha512=_.sha512),_.image=_.upload=function(et,it){var tt={};tt.options={};var rt={type:"image",extension:"*",input:!1,minWidth:!1,maxWidth:null,maxHeight:null,maxJpegSizeBytes:null,onchange:null,multiple:!1,remoteParser:null,text:{extensionNotAllowed:"The extension is not allowed"}};for(var nt in rt)it&&it.hasOwnProperty(nt)?tt.options[nt]=it[nt]:tt.options[nt]=rt[nt];tt.options.multiple==!0&&et.setAttribute("data-multiple",!0),et.content=[],et.classList.add("jupload"),tt.options.input==!0&&et.classList.add("input"),tt.add=function(lt){if(tt.options.multiple==!1&&(et.content=[],et.innerText=""),tt.options.type=="image"){var ct=document.createElement("img");ct.setAttribute("src",lt.file),ct.setAttribute("tabindex",-1),et.getAttribute("name")||(ct.className="jfile",ct.content=lt),et.appendChild(ct)}else{if(lt.name)var ht=lt.name;else var ht=lt.file;var mt=document.createElement("div");mt.innerText=ht||tt.options.type,mt.classList.add("jupload-item"),mt.setAttribute("tabindex",-1),et.appendChild(mt)}lt.content&&(lt.file=_.guid()),et.content.push(lt),typeof tt.options.onchange=="function"&&tt.options.onchange(et,lt)},tt.addFromFile=function(lt){var ct=lt.type.split("/");if(ct[0]==tt.options.type){var ht=new FileReader;ht.addEventListener("load",function(mt){var dt={file:mt.srcElement.result,extension:lt.name.substr(lt.name.lastIndexOf(".")+1),name:lt.name,size:lt.size,lastmodified:lt.lastModified,content:mt.srcElement.result};tt.add(dt)}),ht.readAsDataURL(lt)}else alert(tt.options.text.extensionNotAllowed)},tt.addFromUrl=function(lt){if(lt.substr(0,4)!="data"&&!tt.options.remoteParser)console.error("remoteParser not defined in your initialization");else if(lt.substr(0,4)=="data"){var ct=lt.split(";");ct=ct[0].split("/");var ht=ct[0].replace("data:","");if(ht==tt.options.type){var mt={file:lt,name:"",extension:ct[1],content:lt};tt.add(mt)}else alert(tt.options.text.extensionNotAllowed)}else{var ct=lt.substr(lt.lastIndexOf(".")+1);lt=tt.options.remoteParser+lt,_.ajax({url:lt,type:"GET",dataType:"blob",success:function(ft){}})}};var ot=tt.options.type+"/"+tt.options.extension,st=document.createElement("input");st.type="file",st.setAttribute("accept",ot),st.onchange=function(){for(var lt=0;lt<this.files.length;lt++)tt.addFromFile(this.files[lt])},tt.options.multiple==!0&&st.setAttribute("multiple",!0);var at=null;return et.addEventListener("click",function(lt){at=null,!et.children.length||lt.target===et?_.click(st):lt.target.parentNode==et&&(at=lt.target)}),et.addEventListener("dblclick",function(lt){_.click(st)}),et.addEventListener("dragenter",function(lt){et.style.border="1px dashed #000"}),et.addEventListener("dragleave",function(lt){et.style.border="1px solid #eee"}),et.addEventListener("dragstop",function(lt){et.style.border="1px solid #eee"}),et.addEventListener("dragover",function(lt){lt.preventDefault()}),et.addEventListener("keydown",function(lt){if(at&&lt.which==46){var ct=Array.prototype.indexOf.call(et.children,at);ct>=0&&(et.content.splice(ct,1),at.remove(),at=null)}}),et.addEventListener("drop",function(lt){lt.preventDefault(),lt.stopPropagation();var ct=(lt.originalEvent||lt).dataTransfer.getData("text/html"),ht=(lt.originalEvent||lt).dataTransfer.files;if(ht.length)for(var mt=0;mt<lt.dataTransfer.files.length;mt++)tt.addFromFile(lt.dataTransfer.files[mt]);else if(ct){tt.options.multiple==!1&&(et.innerText="");var dt=document.createElement("div");dt.innerHTML=ct;var ft=dt.querySelectorAll("img");if(ft.length)for(var mt=0;mt<ft.length;mt++)tt.addFromUrl(ft[mt].src)}return et.style.border="1px solid #eee",!1}),et.val=function(lt){if(lt===void 0)return et.content&&et.content.length?et.content:null;if(et.innerText="",et.content=[],lt)if(Array.isArray(lt))for(var ct=0;ct<lt.length;ct++)typeof lt[ct]=="string"?tt.add({file:lt[ct]}):tt.add(lt[ct]);else typeof lt=="string"&&tt.add({file:lt})},et.upload=et.image=tt,tt},_.image.create=function(et){var it=document.createElement("img");return it.setAttribute("src",et.file),it.className="jfile",it.setAttribute("tabindex",-1),it.content=et,it},_.lazyLoading=function(et,it){var tt={};(!it.loadUp||typeof it.loadUp!="function")&&(it.loadUp=function(){return!1}),(!it.loadDown||typeof it.loadDown!="function")&&(it.loadDown=function(){return!1}),it.timer||(it.timer=100);var rt=null,nt=function(ot){if(rt==null){var st=!1,at=et.scrollTop;et.scrollTop+et.clientHeight*2>=et.scrollHeight?it.loadDown()&&(at==et.scrollTop&&(et.scrollTop=et.scrollTop-et.clientHeight),st=!0):et.scrollTop<=et.clientHeight&&it.loadUp()&&(at==et.scrollTop&&(et.scrollTop=et.scrollTop+et.clientHeight),st=!0),rt=setTimeout(function(){rt=null},it.timer),st&&typeof it.onupdate=="function"&&it.onupdate()}};return et.onscroll=function(ot){nt()},et.onwheel=function(ot){nt()},tt},_.loading=function(){var et={},it=null;return et.show=function(){it||(it=document.createElement("div"),it.className="jloading"),document.body.appendChild(it)},et.hide=function(){it&&it.parentNode&&document.body.removeChild(it)},et}(),_.mask=function(){var et={currency:["#(.{1})##0?(.{1}0+)?( ?;(.*)?)?","#"],percentage:["0{1}(.{1}0+)?%"],numeric:["0{1}(.{1}0+)?"],datetime:["YYYY","YYY","YY","MMMMM","MMMM","MMM","MM","DDDDD","DDDD","DDD","DD","DY","DAY","WD","D","Q","HH24","HH12","HH","\\[H\\]","H","AM/PM","PM","AM","MI","SS","MS","MONTH","MON","Y","M"],general:["A","0","[0-9a-zA-Z$]+","."]},it=function(){if(this.mask.toLowerCase().indexOf("[h]")!==-1){var St=0;this.date[4]&&(St=parseFloat(this.date[4]/60));var Ot=parseInt(this.date[3])+St;Ot/=24}else!(this.date[0]&&this.date[1]&&this.date[2])&&(this.date[3]||this.date[4])?Ot=_.two(this.date[3])+":"+_.two(this.date[4])+":"+_.two(this.date[5]):(this.date[0]&&this.date[1]&&!this.date[2]&&(this.date[2]=1),Ot=_.two(this.date[0])+"-"+_.two(this.date[1])+"-"+_.two(this.date[2]),(this.date[3]||this.date[4]||this.date[5])&&(Ot+=" "+_.two(this.date[3])+":"+_.two(this.date[4])+":"+_.two(this.date[5])));return Ot},tt=function(St){return St===null||St===""||St===void 0},Ct=function(St){return(""+St).chartAt(0)=="="},rt=function(St){return St==="currency"||St==="percentage"||St==="numeric"},nt=function(St){if(St&&Number(St)==St)return".";if(this.options.decimal)return this.options.decimal;if(this.locale){var Ot=Intl.NumberFormat(this.locale).format(1.1);return this.options.decimal=Ot[1]}else{St||(St=this.mask);var Mt=new RegExp("0{1}(.{1})0+","ig"),Ot=Mt.exec(St);if(Ot&&Ot[1]&&Ot[1].length==1)return this.options.decimal=Ot[1],Ot[1];var Mt=new RegExp("#{1}(.{1})#+","ig"),Ot=Mt.exec(St);Ot&&Ot[1]&&Ot[1].length==1?Ot[1]===","?this.options.decimal=".":this.options.decimal=",":this.options.decimal="1.1".toLocaleString().substring(1,2)}return this.options.decimal?this.options.decimal:null},ot=function(St,Ot){if(St=="")return"";if(Ot||(Ot=nt.call(this)),St=(""+St).split(Ot),St[0]=St[0].match(/[\-0-9]+/g,""),St[0]&&(St[0]=St[0].join("")),St[0]||St[1])St[1]!==void 0&&(St[1]=St[1].match(/[0-9]+/g,""),St[1]?St[1]=St[1].join(""):St[1]="");else return"";return St},st=function(St){if(St=="")return"";var Ot=nt.call(this),Mt=this.options;if(St=ot.call(this,St),St=="")return"";if(St[0]==="-"&&(St[0]="-0"),St[0]){var jt=parseFloat(St[0]);Mt.style=="percent"&&(jt/=100)}else var jt=null;var Ft=new Intl.NumberFormat(this.locale,Mt).format(jt);if(Ft=Ft.split(Ot),typeof Ft[1]!="undefined"){var Ut=Ft[1].replace(/[0-9]*/g,"");Ut&&(Ft[2]=Ut)}return St[1]!==void 0?Ft[1]=Ot+St[1]:Ft[1]="",Ft.join("")},at=function(St){var Ot=ht.call(St);if(!!Ot){nt.call(this);var Mt=st.call(this,Ot),jt=Mt.length-Ot.length,Ft=ct.call(St)+jt;ht.call(St,Mt,Ft,!0)}},lt=function(St){var Ot=ot.call(this,St);return Ot?parseFloat(Ot.join(".")):null},ct=function(St,Ot){if(St===void 0)if(this.tagName=="DIV"){var Mt=0,jt=window.getSelection();if(jt&&jt.rangeCount!==0){var Ft=jt.getRangeAt(0),Ut=Ft.cloneRange();Ut.selectNodeContents(this),Ut.setEnd(Ft.endContainer,Ft.endOffset),Mt=Ut.toString().length}return Mt}else return this.selectionStart;else{var Qt=ht.call(this);if(Ot){for(var Ut=null,Ht=0;Ht<Qt.length;Ht++)(Qt[Ht].match(/[\-0-9]/g)||Qt[Ht]=="."||Qt[Ht]==",")&&(Ut=Ht);Ut===null&&(Ut=Qt.indexOf(" ")),St>=Ut&&(St=Ut+1)}if(St>Qt.length&&(St=Qt.length),St)if(this.tagName=="DIV"){var jt=window.getSelection(),Ft=document.createRange();Ft.setStart(this.childNodes[0],St),jt.removeAllRanges(),jt.addRange(Ft)}else this.selectionStart=St,this.selectionEnd=St}},ht=function(St,Ot,Mt){if(this.tagName=="DIV"){if(St===void 0)return this.innerText;this.innerText!==St&&(this.innerText=St,Ot&&ct.call(this,Ot,Mt))}else{if(St===void 0)return this.value;this.value!==St&&(this.value=St,Ot&&ct.call(this,Ot,Mt))}},mt=_.calendar.weekdays,dt=_.calendar.weekdaysShort,ft=_.calendar.months,ut=_.calendar.monthsShort,pt={YEAR:function(St,Ot){var Mt=""+new Date().getFullYear();if(typeof this.values[this.index]=="undefined"&&(this.values[this.index]=""),parseInt(St)>=0&&parseInt(St)<=10&&this.values[this.index].length<Ot&&(this.values[this.index]+=St),this.values[this.index].length==Ot){if(Ot==2)var Mt=Mt.substr(0,2)+this.values[this.index];else if(Ot==3)var Mt=Mt.substr(0,1)+this.values[this.index];else if(Ot==4)var Mt=this.values[this.index];this.date[0]=Mt,this.index++}},YYYY:function(St){pt.YEAR.call(this,St,4)},YYY:function(St){pt.YEAR.call(this,St,3)},YY:function(St){pt.YEAR.call(this,St,2)},FIND:function(St,Ot){tt(this.values[this.index])&&(this.values[this.index]="");for(var Mt=0,jt=0,Ft=(this.values[this.index]+St).toLowerCase(),Ut=0;Ut<Ot.length;Ut++)Ot[Ut].toLowerCase().indexOf(Ft)==0&&(Mt=Ut,jt++);if(jt>1)this.values[this.index]+=St;else if(jt==1){var Qt=Ot[Mt].length-this.values[this.index].length-1;return this.position+=Qt,this.values[this.index]=Ot[Mt],this.index++,Mt}},MMM:function(St){var Ot=pt.FIND.call(this,St,ut);Ot!==void 0&&(this.date[1]=Ot+1)},MMMM:function(St){var Ot=pt.FIND.call(this,St,ft);Ot!==void 0&&(this.date[1]=Ot+1)},MMMMM:function(St){tt(this.values[this.index])&&(this.values[this.index]="");for(var Ot=(this.values[this.index]+St).toLowerCase(),Mt=0;Mt<ft.length;Mt++)if(ft[Mt][0].toLowerCase().indexOf(Ot)==0){this.values[this.index]=ft[Mt][0],this.date[1]=Mt+1,this.index++;break}},MM:function(St){tt(this.values[this.index])?parseInt(St)>1&&parseInt(St)<10?(this.date[1]=this.values[this.index]="0"+St,this.index++):parseInt(St)<2&&(this.values[this.index]=St):this.values[this.index]==1&&parseInt(St)<3?(this.date[1]=this.values[this.index]+=St,this.index++):this.values[this.index]==0&&parseInt(St)>0&&parseInt(St)<10&&(this.date[1]=this.values[this.index]+=St,this.index++)},M:function(St){var Ot=!1;if(parseInt(St)>=0&&parseInt(St)<10)if(tt(this.values[this.index]))this.values[this.index]=St,St>1&&(this.date[1]=this.values[this.index],this.index++);else if(this.values[this.index]==1&&parseInt(St)<3)this.date[1]=this.values[this.index]+=St,this.index++;else if(this.values[this.index]==0&&parseInt(St)>0)this.date[1]=this.values[this.index]+=St,this.index++;else var Ot=!0;else var Ot=!0;if(Ot==!0){var Mt=parseInt(this.values[this.index]);Mt>0&&Mt<12&&(this.date[2]=this.values[this.index],this.index++,this.position--)}},D:function(St){var Ot=!1;if(parseInt(St)>=0&&parseInt(St)<10)if(tt(this.values[this.index]))this.values[this.index]=St,parseInt(St)>3&&(this.date[2]=this.values[this.index],this.index++);else if(this.values[this.index]==3&&parseInt(St)<2)this.date[2]=this.values[this.index]+=St,this.index++;else if(this.values[this.index]==1||this.values[this.index]==2)this.date[2]=this.values[this.index]+=St,this.index++;else if(this.values[this.index]==0&&parseInt(St)>0)this.date[2]=this.values[this.index]+=St,this.index++;else var Ot=!0;else var Ot=!0;if(Ot==!0){var Mt=parseInt(this.values[this.index]);Mt>0&&Mt<32&&(this.date[2]=this.values[this.index],this.index++,this.position--)}},DD:function(St){tt(this.values[this.index])?parseInt(St)>3&&parseInt(St)<10?(this.date[2]=this.values[this.index]="0"+St,this.index++):parseInt(St)<10&&(this.values[this.index]=St):this.values[this.index]==3&&parseInt(St)<2?(this.date[2]=this.values[this.index]+=St,this.index++):(this.values[this.index]==1||this.values[this.index]==2)&&parseInt(St)<10?(this.date[2]=this.values[this.index]+=St,this.index++):this.values[this.index]==0&&parseInt(St)>0&&parseInt(St)<10&&(this.date[2]=this.values[this.index]+=St,this.index++)},DDD:function(St){pt.FIND.call(this,St,dt)},DDDD:function(St){pt.FIND.call(this,St,mt)},HH12:function(St,Ot){tt(this.values[this.index])?parseInt(St)>1&&parseInt(St)<10?(Ot&&(St=0+St),this.date[3]=this.values[this.index]=St,this.index++):parseInt(St)<10&&(this.values[this.index]=St):this.values[this.index]==1&&parseInt(St)<3?(this.date[3]=this.values[this.index]+=St,this.index++):this.values[this.index]<1&&parseInt(St)<10&&(this.date[3]=this.values[this.index]+=St,this.index++)},HH24:function(St,Ot){parseInt(St)>=0&&parseInt(St)<10&&(this.values[this.index]==null||this.values[this.index]==""?parseInt(St)>2&&parseInt(St)<10?(Ot&&(St=0+St),this.date[3]=this.values[this.index]=St,this.index++):parseInt(St)<10&&(this.values[this.index]=St):this.values[this.index]==2&&parseInt(St)<4?(this.date[3]=this.values[this.index]+=St,this.index++):this.values[this.index]<2&&parseInt(St)<10&&(this.date[3]=this.values[this.index]+=St,this.index++))},HH:function(St){pt.HH24.call(this,St,1)},H:function(St){pt.HH24.call(this,St,0)},"\\[H\\]":function(St){this.values[this.index]==null&&(this.values[this.index]=""),St.match(/[0-9]/g)?this.date[3]=this.values[this.index]+=St:this.values[this.index].match(/[0-9]/g)&&(this.date[3]=this.values[this.index],this.index++,this.position--)},N60:function(St,Ot){this.values[this.index]==null||this.values[this.index]==""?parseInt(St)>5&&parseInt(St)<10?(this.date[Ot]=this.values[this.index]="0"+St,this.index++):parseInt(St)<10&&(this.values[this.index]=St):parseInt(St)<10&&(this.date[Ot]=this.values[this.index]+=St,this.index++)},MI:function(St){pt.N60.call(this,St,4)},SS:function(St){pt.N60.call(this,St,5)},"AM/PM":function(St){this.values[this.index]="",St&&(this.date[3]>12?this.values[this.index]="PM":this.values[this.index]="AM"),this.index++},WD:function(St){typeof this.values[this.index]=="undefined"&&(this.values[this.index]=""),parseInt(St)>=0&&parseInt(St)<7&&(this.values[this.index]=St),this.value[this.index].length==1&&this.index++},"0{1}(.{1}0+)?":function(St){var Ot=nt.call(this),Mt=!1;tt(this.values[this.index])?this.values[this.index]="":this.values[this.index]=="-"&&(Mt=!0);var jt=ot.call(this,this.values[this.index],Ot);jt&&(this.values[this.index]=jt.join(Ot)),parseInt(St)>=0&&parseInt(St)<10?(this.values[this.index]!="0"||St==Ot)&&(this.values[this.index]+=St):Ot&&St==Ot?this.values[this.index].indexOf(Ot)==-1&&(this.values[this.index]||(this.values[this.index]="0"),this.values[this.index]+=St):St=="-"&&(Mt=!0),Mt===!0&&this.values[this.index][0]!=="-"&&(this.values[this.index]="-"+this.values[this.index])},"0{1}(.{1}0+)?%":function(St){pt["0{1}(.{1}0+)?"].call(this,St),this.values[this.index].match(/[\-0-9]/g)?this.values[this.index]&&this.values[this.index].indexOf("%")==-1&&(this.values[this.index]+="%"):this.values[this.index]=""},"#(.{1})##0?(.{1}0+)?( ?;(.*)?)?":function(St){pt["0{1}(.{1}0+)?"].call(this,St);var Ot=nt.call(this),Mt=this.tokens[this.index].substr(1,1),jt=this.values[this.index][0]==="-",Ft=ot.call(this,this.values[this.index],Ot);if(Ft!==""){var Ut=Ft[0].match(/[0-9]/g);if(Ut){Ut=Ut.join("");for(var Qt=[],Ht=0,Zt=Ut.length-1;Zt>=0;Zt--)Qt.push(Ut[Zt]),Ht++,Ht%3||Qt.push(Mt);Qt=Qt.reverse(),Ft[0]=Qt.join(""),Ft[0].substr(0,1)==Mt&&(Ft[0]=Ft[0].substr(1))}else Ft[0]="";this.values[this.index]=Ft.join(Ot),jt&&(this.values[this.index]="-"+this.values[this.index])}},"0":function(St){St.match(/[0-9]/g)&&(this.values[this.index]=St,this.index++)},"[0-9a-zA-Z$]+":function(St){tt(this.values[this.index])&&(this.values[this.index]="");var Ot=this.tokens[this.index],Mt=this.values[this.index],jt=Mt.length;Ot[jt]==St?(this.values[this.index]+=St,this.values[this.index]==Ot&&this.index++):(this.values[this.index]=Ot,this.index++,St.match(/[\-0-9]/g)&&this.position--)},A:function(St){St.match(/[a-zA-Z]/gi)&&(this.values[this.index]=St,this.index++)},".":function(St){pt["[0-9a-zA-Z$]+"].call(this,St)}},At=function(St){if(this.type=="general")var Ot=[].concat(et.general);else var Ot=[].concat(et.currency,et.datetime,et.percentage,et.numeric,et.general);var Mt=new RegExp(Ot.join("|"),"gi");return St.match(Mt)},gt=function(St){if(this.type)if(this.type=="general")var Ot=["general"];else if(this.type=="datetime")var Ot=["numeric","datetime","general"];else var Ot=["currency","percentage","numeric","general"];else var Ot=Object.keys(et);for(var Mt=0;Mt<Ot.length;Mt++)for(var jt=Ot[Mt],Ft=0;Ft<et[jt].length;Ft++){var Ut=new RegExp(et[jt][Ft],"gi"),Qt=St.match(Ut);if(Qt)return{type:jt,method:et[jt][Ft]}}},vt=function(St){for(var Ot=[],Mt=0;Mt<St.length;Mt++){var jt=gt.call(this,St[Mt]);jt?Ot.push(jt.method):Ot.push(null)}for(var Mt=0;Mt<Ot.length;Mt++)Ot[Mt]=="MM"&&(Ot[Mt-1]&&Ot[Mt-1].indexOf("H")>=0||Ot[Mt-2]&&Ot[Mt-2].indexOf("H")>=0||Ot[Mt+1]&&Ot[Mt+1].indexOf("S")>=0||Ot[Mt+2]&&Ot[Mt+2].indexOf("S")>=0)&&(Ot[Mt]="MI");return Ot},yt=function(St){var Ot=gt.call(this,St);if(Ot)var Mt=Ot.type;if(Mt){for(var jt=0,Ft=At.call(this,St),Ut=0;Ut<Ft.length;Ut++)Ot=gt.call(this,Ft[Ut]),Ot&&rt(Ot.type)&&jt++;jt>1&&(Mt="general")}return Mt},bt=function(){typeof pt[this.methods[this.index]]=="function"?(pt[this.methods[this.index]].call(this,this.value[this.position]),this.position++):(this.values[this.index]=this.tokens[this.index],this.index++)},Ct=function(St){var Ot=(""+St)[0];return Ot=="="},xt=function(St){return(""+ +St).replace(/(-?)(\d*)\.?(\d*)e([+-]\d+)/,function(Ot,Mt,jt,Ft,Ut){return Ut<0?Mt+"0."+Array(1-Ut-jt.length).join(0)+jt+Ft:Mt+jt+Ft+Array(Ut-Ft.length+1).join(0)})},It=function(St,Ot,Mt){var jt=null,Ft={input:null,value:null,options:{},values:[],index:0,position:0,date:[0,0,0,0,0,0],number:0};if(typeof St=="object"){if(Ft.input=St.target,Ft.value=ht.call(St.target),Ft.caret=ct.call(St.target),(jt=St.target.getAttribute("data-mask"))&&(Ft.mask=jt),(jt=St.target.getAttribute("data-type"))&&(Ft.type=jt),St.target.mask?(St.target.mask.options&&(Ft.options=St.target.mask.options),St.target.mask.locale&&(Ft.locale=St.target.mask.locale)):(jt=St.target.getAttribute("data-locale"))&&(Ft.locale=jt,Ft.mask&&(Ft.options.style=Ft.mask)),St.target.attributes&&St.target.attributes.length)for(var Ut=0;Ut<St.target.attributes.length;Ut++){var Qt=St.target.attributes[Ut].name,Ht=St.target.attributes[Ut].value;Qt.substr(0,4)=="data"&&(Ft.options[Qt.substr(5)]=Ht)}}else{if(typeof Ot=="string")Ft.mask=Ot;else for(var Qt=Object.keys(Ot),Ut=0;Ut<Qt.length;Ut++)Ft[Qt[Ut]]=Ot[Qt[Ut]];typeof St=="number"&&(nt.call(Ft,Ft.mask),St=(""+St).replace(".",Ft.options.decimal)),Ft.value=St,Ft.input&&(ht.call(Ft.input,St),_.focus(Ft.input),Ft.caret=ct.call(Ft.input))}if(!Ct(Ft.value)&&(Ft.mask||Ft.locale)){if(Ft.mask){if(Ft.mask=Ft.mask.replace("[-]",""),Ft.mask.indexOf("##")!==-1){var Zt=Ft.mask.split(";");Zt[0]&&(Zt[0]=Zt[0].replace("*",""),Zt[0]=Zt[0].replace(/_/g,""),Zt[0]=Zt[0].replace(/-/g,""),Zt[0]=Zt[0].replace("(",""),Zt[0]=Zt[0].replace(")",""),Zt[0]=Zt[0].replace("##0.###","##0.000"),Zt[0]=Zt[0].replace("##0.##","##0.00"),Zt[0]=Zt[0].replace("##0.#","##0.0")),Ft.mask=Zt[0]}Ft.type||(Ft.type=yt.call(Ft,Ft.mask)),Ft.tokens=At.call(Ft,Ft.mask)}if(typeof St!="object"||!St.inputType||St.inputType=="insertText"||St.inputType=="insertFromPaste")if(Ft.locale)if(Ft.input)at.call(Ft,Ft.input);else var Wt=st.call(Ft,Ft.value);else{for(Ft.methods=vt.call(Ft,Ft.tokens);Ft.position<Ft.value.length&&typeof Ft.tokens[Ft.index]!="undefined";)bt.call(Ft);if(rt(Ft.type)){for(;typeof Ft.tokens[Ft.index]!="undefined";){var jt=gt.call(Ft,Ft.tokens[Ft.index]);jt&&jt.type=="general"&&(Ft.values[Ft.index]=Ft.tokens[Ft.index]),Ft.index++}var $t=!0}else var $t=!1;var Wt=Ft.values.join("");if(Ft.input){if(jt=Wt.length-Ft.value.length,jt>0)var Jt=Ft.caret+jt;else var Jt=Ft.caret;ht.call(Ft.input,Wt,Jt,$t)}}if(Ft.input){var Nt=null;rt(Ft.type)?(Ft.number=lt.call(Ft,ht.call(Ft.input)),Ft.type=="percentage"?Nt=Ft.number/100:Nt=Ft.number):Ft.type=="datetime"&&(Nt=it.call(Ft),Ft.date[0]&&Ft.date[1]&&Ft.date[2]&&Ft.input.setAttribute("data-completed",!0)),Nt&&Ft.input.setAttribute("data-value",Nt)}if(Wt!==void 0)return Mt?Ft:Wt}};return It.prepare=function(St,Ot){return Ot||(Ot={}),At.call(Ot,St)},It.apply=function(St){var Ot=ht.call(St.target);St.key.length==1&&(Ot+=St.key),ht.call(St.target,It(Ot,St.target.getAttribute("data-mask")))},It.run=function(St,Ot,Mt){return It(St,{mask:Ot,decimal:Mt})},It.extract=function(St,Ot,Mt){if(tt(St))return St;if(typeof Ot!="object")return Qt;Ot.options||(Ot.options={}),!Ot.mask&&Ot.format&&(Ot.mask=Ot.format),nt.call(Ot,Ot.mask);var jt=null;if(Ot.type=="percent"||Ot.options.style=="percent"?jt="percentage":Ot.mask&&(jt=yt.call(Ot,Ot.mask)),jt==="datetime"){if(St instanceof Date)var Ft=_.calendar.getDateString(Qt,Ot.mask);var Ut=It(St,Ot,!0),Qt=it.call(Ut);if(Ut.date[0]&&Ut.date[1]&&Ut.date[2]&&!(Ut.date[3]||Ut.date[4]||Ut.date[5])){var Ft=_.calendar.now(Ut.date);Qt=_.calendar.dateToNum(Ft)}}else{var Qt=lt.call(Ot,St);jt=="percentage"&&(Qt/=100);var Ut=Ot}return Ut.value=Qt,Mt?Ut:Qt},It.render=function(St,Ot,Mt){if(tt(St)||typeof Ot!="object")return St;Ot.options||(Ot.options={}),!Ot.mask&&Ot.format&&(Ot.mask=Ot.format);var jt=null;Ot.type=="percent"||Ot.options.style=="percent"?jt="percentage":Ot.mask?jt=yt.call(Ot,Ot.mask):St instanceof Date&&(jt="datetime");var Ft=!1;if(jt=="datetime"||Ot.type=="calendar"){var Ut=_.calendar.getDateString(St,Ot.mask);Ut&&(St=Ut),Ot.mask&&Mt&&(Ft=!0)}else if(jt=="percentage"&&(St*=100),typeof St=="number"){var Ut=null;if(Ot.mask&&Mt){var Qt=new RegExp("0{1}(.{1})0+","ig"),Ht=Ot.mask.match(Qt);Ht&&Ht[0]?(Ht=Ht[0].length-2,Ut=St.toFixed(Ht)):Ut=St.toFixed(0)}else if(Ot.locale&&Mt){var Ht=(""+St).split(".");if(Ot.options){typeof Ht[1]=="undefined"&&(Ht[1]="");var Wt=Ht[1].length;if(Ot.options.minimumFractionDigits>Wt)for(var Zt=0;Zt<Ot.options.minimumFractionDigits-Wt;Zt++)Ht[1]+="0"}Ht[1].length?Ut=Ht.join("."):Ut=Ht[0];var Wt=Ht[1].length;Ot.options&&Ot.options.maximumFractionDigits<Wt&&(Ut=parseFloat(Ut).toFixed(Ot.options.maximumFractionDigits))}else Ut=xt(St);Ut!==null&&(St=Ut,nt.call(Ot,Ot.mask),Ot.options.decimal&&(St=St.replace(".",Ot.options.decimal)))}else Ot.mask&&Mt&&(Ft=!0);if(Ft){var $t=Ot.mask.length-St.length;if($t>0)for(var Zt=0;Zt<$t;Zt++)St+=" "}return St=It(St,Ot),St},It.set=function(St,Ot){if(Ot){St.setAttribute("data-mask",Ot);var Mt=new Event("input",{bubbles:!0,cancelable:!0});St.dispatchEvent(Mt)}},typeof document!="undefined"&&document.addEventListener("input",function(St){(St.target.getAttribute("data-mask")||St.target.mask)&&It(St)}),It}(),_.modal=function(et,it){var tt={};tt.options={};var rt={url:null,onopen:null,onclose:null,closed:!1,width:null,height:null,title:null,padding:null,backdrop:!0};for(var nt in rt)it&&it.hasOwnProperty(nt)?tt.options[nt]=it[nt]:tt.options[nt]=rt[nt];!tt.options.title&&et.getAttribute("title")&&(tt.options.title=et.getAttribute("title"));for(var ot=document.createElement("div");et.children[0];)ot.appendChild(et.children[0]);for(tt.content=document.createElement("div"),tt.content.className="jmodal_content",tt.content.innerHTML=et.innerHTML;ot.children[0];)tt.content.appendChild(ot.children[0]);if(tt.container=document.createElement("div"),tt.container.className="jmodal",tt.container.appendChild(tt.content),tt.options.padding&&(tt.content.style.padding=tt.options.padding),tt.options.width&&(tt.container.style.width=tt.options.width),tt.options.height&&(tt.container.style.height=tt.options.height),tt.options.title?tt.container.setAttribute("title",tt.options.title):tt.container.classList.add("no-title"),et.innerHTML="",et.style.display="none",et.appendChild(tt.container),tt.options.backdrop){var st=document.createElement("div");st.className="jmodal_backdrop",st.onclick=function(){tt.close()},et.appendChild(st)}if(tt.open=function(){et.style.display="block";var lt=tt.container.getBoundingClientRect();_.getWindowWidth()<lt.width?(tt.container.style.top="",tt.container.style.left="",tt.container.classList.add("jmodal_fullscreen"),_.animation.slideBottom(tt.container,1)):tt.options.backdrop&&(st.style.display="block"),typeof tt.options.onopen=="function"&&tt.options.onopen(et,tt)},tt.resetPosition=function(){tt.container.style.top="",tt.container.style.left=""},tt.isOpen=function(){return et.style.display!="none"},tt.close=function(){et.style.display="none",tt.options.backdrop&&(st.style.display=""),tt.container.classList.remove("jmodal_fullscreen"),typeof tt.options.onclose=="function"&&tt.options.onclose(et,tt)},!_.modal.hasEvents){var at=null;document.addEventListener("keydown",function(lt){if(lt.which==27)for(var ct=document.querySelectorAll(".jmodal"),ht=0;ht<ct.length;ht++)ct[ht].parentNode.modal.close()}),document.addEventListener("mouseup",function(lt){at&&(at.element.style.cursor="auto",at=null)}),document.addEventListener("mousedown",function(lt){var ct=_.findElement(lt.target,"jmodal");if(ct){var ht=ct.getBoundingClientRect();if(lt.changedTouches&&lt.changedTouches[0])var mt=lt.changedTouches[0].clientX,dt=lt.changedTouches[0].clientY;else var mt=lt.clientX,dt=lt.clientY;ht.width-(mt-ht.left)<50&&dt-ht.top<50?ct.parentNode.modal.close():lt.target.getAttribute("title")&&dt-ht.top<50&&(document.selection?document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),at={left:ht.left,top:ht.top,x:lt.clientX,y:lt.clientY,width:ht.width,height:ht.height,element:ct})}}),document.addEventListener("mousemove",function(lt){if(at){if(lt=lt||window.event,lt.buttons)var ct=lt.buttons;else if(lt.button)var ct=lt.button;else var ct=lt.which;ct?(at.element.style.top=at.top+(lt.clientY-at.y)+at.height/2+"px",at.element.style.left=at.left+(lt.clientX-at.x)+at.width/2+"px",at.element.style.cursor="move"):at.element.style.cursor="auto"}}),_.modal.hasEvents=!0}return tt.options.url?_.ajax({url:tt.options.url,method:"GET",dataType:"text/html",success:function(lt){tt.content.innerHTML=lt,tt.options.closed||tt.open()}}):tt.options.closed||tt.open(),et.modal=tt,tt},_.notification=function(et){var it={};it.options={};var tt={icon:null,name:"Notification",date:null,error:null,title:null,message:null,timeout:4e3,autoHide:!0,closeable:!0};for(var rt in tt)et&&et.hasOwnProperty(rt)?it.options[rt]=et[rt]:it.options[rt]=tt[rt];var nt=document.createElement("div");nt.className="jnotification",it.options.error&&nt.classList.add("jnotification-error");var ot=document.createElement("div");ot.className="jnotification-container",nt.appendChild(ot);var st=document.createElement("div");st.className="jnotification-header",ot.appendChild(st);var at=document.createElement("div");if(at.className="jnotification-image",st.appendChild(at),it.options.icon){var lt=document.createElement("img");lt.src=it.options.icon,at.appendChild(lt)}var ct=document.createElement("div");if(ct.className="jnotification-name",ct.innerHTML=it.options.name,st.appendChild(ct),it.options.closeable==!0){var ht=document.createElement("div");ht.className="jnotification-close",ht.onclick=function(){it.hide()},st.appendChild(ht)}var mt=document.createElement("div");mt.className="jnotification-date",st.appendChild(mt);var dt=document.createElement("div");if(dt.className="jnotification-content",ot.appendChild(dt),it.options.title){var ft=document.createElement("div");ft.className="jnotification-title",ft.innerHTML=it.options.title,dt.appendChild(ft)}var ut=document.createElement("div");if(ut.className="jnotification-message",ut.innerHTML=it.options.message,dt.appendChild(ut),it.show=function(){document.body.appendChild(nt),_.getWindowWidth()>800?_.animation.fadeIn(nt):_.animation.slideTop(nt,1)},it.hide=function(){_.getWindowWidth()>800?_.animation.fadeOut(nt,function(){nt.parentNode&&(nt.parentNode.removeChild(nt),pt&&clearTimeout(pt))}):_.animation.slideTop(nt,0,function(){nt.parentNode&&(nt.parentNode.removeChild(nt),pt&&clearTimeout(pt))})},it.show(),it.options.autoHide==!0)var pt=setTimeout(function(){it.hide()},it.options.timeout);return _.getWindowWidth()<800&&nt.addEventListener("swipeup",function(At){it.hide(),At.preventDefault(),At.stopPropagation()}),it},_.notification.isVisible=function(){var et=document.querySelector(".jnotification");return!!(et&&et.parentNode)},_.palette=function(){var et={material:[["#ffebee","#fce4ec","#f3e5f5","#e8eaf6","#e3f2fd","#e0f7fa","#e0f2f1","#e8f5e9","#f1f8e9","#f9fbe7","#fffde7","#fff8e1","#fff3e0","#fbe9e7","#efebe9","#fafafa","#eceff1"],["#ffcdd2","#f8bbd0","#e1bee7","#c5cae9","#bbdefb","#b2ebf2","#b2dfdb","#c8e6c9","#dcedc8","#f0f4c3","#fff9c4","#ffecb3","#ffe0b2","#ffccbc","#d7ccc8","#f5f5f5","#cfd8dc"],["#ef9a9a","#f48fb1","#ce93d8","#9fa8da","#90caf9","#80deea","#80cbc4","#a5d6a7","#c5e1a5","#e6ee9c","#fff59d","#ffe082","#ffcc80","#ffab91","#bcaaa4","#eeeeee","#b0bec5"],["#e57373","#f06292","#ba68c8","#7986cb","#64b5f6","#4dd0e1","#4db6ac","#81c784","#aed581","#dce775","#fff176","#ffd54f","#ffb74d","#ff8a65","#a1887f","#e0e0e0","#90a4ae"],["#ef5350","#ec407a","#ab47bc","#5c6bc0","#42a5f5","#26c6da","#26a69a","#66bb6a","#9ccc65","#d4e157","#ffee58","#ffca28","#ffa726","#ff7043","#8d6e63","#bdbdbd","#78909c"],["#f44336","#e91e63","#9c27b0","#3f51b5","#2196f3","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#9e9e9e","#607d8b"],["#e53935","#d81b60","#8e24aa","#3949ab","#1e88e5","#00acc1","#00897b","#43a047","#7cb342","#c0ca33","#fdd835","#ffb300","#fb8c00","#f4511e","#6d4c41","#757575","#546e7a"],["#d32f2f","#c2185b","#7b1fa2","#303f9f","#1976d2","#0097a7","#00796b","#388e3c","#689f38","#afb42b","#fbc02d","#ffa000","#f57c00","#e64a19","#5d4037","#616161","#455a64"],["#c62828","#ad1457","#6a1b9a","#283593","#1565c0","#00838f","#00695c","#2e7d32","#558b2f","#9e9d24","#f9a825","#ff8f00","#ef6c00","#d84315","#4e342e","#424242","#37474f"],["#b71c1c","#880e4f","#4a148c","#1a237e","#0d47a1","#006064","#004d40","#1b5e20","#33691e","#827717","#f57f17","#ff6f00","#e65100","#bf360c","#3e2723","#212121","#263238"]],fire:[["0b1a6d","840f38","b60718","de030b","ff0c0c","fd491c","fc7521","faa331","fbb535","ffc73a"],["071147","5f0b28","930513","be0309","ef0000","fa3403","fb670b","f9991b","faad1e","ffc123"],["03071e","370617","6a040f","9d0208","d00000","dc2f02","e85d04","f48c06","faa307","ffba08"],["020619","320615","61040d","8c0207","bc0000","c82a02","d05203","db7f06","e19405","efab00"],["020515","2d0513","58040c","7f0206","aa0000","b62602","b94903","c57205","ca8504","d89b00"]],baby:[["eddcd2","fff1e6","fde2e4","fad2e1","c5dedd","dbe7e4","f0efeb","d6e2e9","bcd4e6","99c1de"],["e1c4b3","ffd5b5","fab6ba","f5a8c4","aacecd","bfd5cf","dbd9d0","baceda","9dc0db","7eb1d5"],["daa990","ffb787","f88e95","f282a9","8fc4c3","a3c8be","cec9b3","9dbcce","82acd2","649dcb"],["d69070","ff9c5e","f66770","f05f8f","74bbb9","87bfae","c5b993","83aac3","699bca","4d89c2"],["c97d5d","f58443","eb4d57","e54a7b","66a9a7","78ae9c","b5a67e","7599b1","5c88b7","4978aa"]],chart:[["#C1D37F","#4C5454","#FFD275","#66586F","#D05D5B","#C96480","#95BF8F","#6EA240","#0F0F0E","#EB8258","#95A3B3","#995D81"]]},it=function(tt){return et[tt]?et[tt]:et.material};return it.get=function(tt){return et[tt]?et[tt]:et},it.set=function(tt,rt){et[tt]=rt},it}(),_.picker=function(et,it){if(et.picker)return et.picker.setOptions(it,!0);var tt={type:"picker"};tt.options={};var rt=null,nt=null,ot=function(){nt.innerHTML="";for(var at=Object.keys(tt.options.data),lt=0;lt<at.length;lt++){var ct=document.createElement("div");ct.classList.add("jpicker-item"),ct.k=at[lt],ct.v=tt.options.data[at[lt]],ct.innerHTML=tt.getLabel(at[lt]),nt.appendChild(ct)}};tt.setOptions=function(at,lt){var ct={value:0,data:null,render:null,onchange:null,onselect:null,onopen:null,onclose:null,onload:null,width:null,header:!0,right:!1,content:!1,columns:null,height:null};at&&at.options&&(at.data=at.options);for(var ht in ct)at&&at.hasOwnProperty(ht)?tt.options[ht]=at[ht]:(typeof tt.options[ht]=="undefined"||lt===!0)&&(tt.options[ht]=ct[ht]);return tt.options.header===!1?rt.style.display="none":rt.style.display="",tt.options.width?rt.style.width=parseInt(tt.options.width)+"px":rt.style.width="",tt.options.height?(nt.style.maxHeight=tt.options.height+"px",nt.style.overflow="scroll"):nt.style.overflow="",tt.options.columns>0&&(nt.classList.add("jpicker-columns"),nt.style.width=tt.options.width?tt.options.width:36*tt.options.columns+"px"),isNaN(tt.options.value)&&(tt.options.value="0"),ot(),tt.setValue(tt.options.value),tt},tt.getValue=function(){return tt.options.value},tt.setValue=function(at){tt.setLabel(at),tt.options.value=String(at),et.value!=tt.options.value&&(et.value=tt.options.value,typeof et.oninput=="function"&&et.oninput({type:"input",target:et,value:et.value})),nt.children[at].getAttribute("type")!=="generic"&&tt.close()},tt.getLabel=function(at){var lt=tt.options.data[at]||null;return typeof tt.options.render=="function"&&(lt=tt.options.render(lt)),lt},tt.setLabel=function(at){if(tt.options.content)var lt='<i class="material-icons">'+tt.options.content+"</i>";else var lt=tt.getLabel(at);rt.innerHTML=lt},tt.open=function(){if(!et.classList.contains("jpicker-focus")){_.tracking(tt,!0),et.classList.add("jpicker-focus"),et.focus();var at=0,lt=0;nt.style.marginLeft="";var ct=rt.getBoundingClientRect(),ht=nt.getBoundingClientRect();window.innerHeight<ct.bottom+ht.height?at=-1*(ht.height+4):at=ct.height+4,tt.options.right===!0&&(lt=-1*ht.width+ct.width),ht.left+lt<0&&(lt=lt+ht.left+10),ht.left+ht.width>window.innerWidth&&(lt=-1*(10+ht.left+ht.width-window.innerWidth)),nt.style.marginTop=parseInt(at)+"px",nt.style.marginLeft=parseInt(lt)+"px",typeof tt.options.onopen=="function"&&tt.options.onopen(et,tt)}},tt.close=function(){et.classList.contains("jpicker-focus")&&(et.classList.remove("jpicker-focus"),_.tracking(tt,!1),typeof tt.options.onclose=="function"&&tt.options.onclose(et,tt))};var st=function(){et.classList.add("jpicker"),et.setAttribute("tabindex","900"),et.onmousedown=function(at){et.classList.contains("jpicker-focus")||tt.open()},rt=document.createElement("div"),rt.classList.add("jpicker-header"),nt=document.createElement("div"),nt.classList.add("jpicker-content"),nt.onclick=function(at){var lt=_.findElement(at.target,"jpicker-item");lt&&lt.parentNode===nt&&(tt.setValue(lt.k),typeof tt.options.onchange=="function"&&tt.options.onchange.call(tt,et,tt,lt.v,lt.v,lt.k))},et.appendChild(rt),et.appendChild(nt),et.value=it.value||0,tt.setOptions(it),typeof tt.options.onload=="function"&&tt.options.onload(et,tt),et.change=tt.setValue,et.val=function(at){if(at===void 0)return tt.getValue();tt.setValue(at)},et.picker=tt};return st(),tt},_.progressbar=function(et,it){var tt={};tt.options={};var rt={value:0,onchange:null,width:null};for(var nt in rt)it&&it.hasOwnProperty(nt)?tt.options[nt]=it[nt]:tt.options[nt]=rt[nt];et.classList.add("jprogressbar"),et.setAttribute("tabindex",1),et.setAttribute("data-value",tt.options.value);var ot=document.createElement("div");ot.style.width=tt.options.value+"%",ot.style.color="#fff",et.appendChild(ot),tt.options.width&&(et.style.width=tt.options.width),tt.setValue=function(at){at=parseInt(at),tt.options.value=at,ot.style.width=at+"%",et.setAttribute("data-value",at+"%"),at<6?et.style.color="#000":et.style.color="#fff",tt.options.value=at,typeof tt.options.onchange=="function"&&tt.options.onchange(et,at),et.value!=tt.options.value&&(et.value=tt.options.value,typeof et.oninput=="function"&&et.oninput({type:"input",target:et,value:et.value}))},tt.getValue=function(){return tt.options.value};var st=function(at){if(at.which){var lt=et.getBoundingClientRect();if(at.changedTouches&&at.changedTouches[0]){var ct=at.changedTouches[0].clientX;at.changedTouches[0].clientY}else{var ct=at.clientX;at.clientY}tt.setValue(Math.round((ct-lt.left)/lt.width*100))}};return"touchstart"in document.documentElement?(et.addEventListener("touchstart",st),et.addEventListener("touchend",st)):(et.addEventListener("mousedown",st),et.addEventListener("mousemove",st)),et.change=tt.setValue,et.val=function(at){if(at===void 0)return tt.getValue();tt.setValue(at)},et.progressbar=tt,tt},_.rating=function(et,it){if(et.rating)return et.rating.setOptions(it,!0);var tt={};tt.options={},tt.setOptions=function(nt,ot){var st={number:5,value:0,tooltip:["Very bad","Bad","Average","Good","Very good"],onchange:null};for(var at in st)nt&&nt.hasOwnProperty(at)?tt.options[at]=nt[at]:(typeof tt.options[at]=="undefined"||ot===!0)&&(tt.options[at]=st[at]);et.innerHTML="";for(var lt=0;lt<tt.options.number;lt++){var ct=document.createElement("div");ct.setAttribute("data-index",lt+1),ct.setAttribute("title",tt.options.tooltip[lt]),et.appendChild(ct)}if(tt.options.value)for(var lt=0;lt<tt.options.number;lt++)lt<tt.options.value&&et.children[lt].classList.add("jrating-selected");return tt},tt.setValue=function(nt){for(var ot=0;ot<tt.options.number;ot++)ot<nt?et.children[ot].classList.add("jrating-selected"):(et.children[ot].classList.remove("jrating-over"),et.children[ot].classList.remove("jrating-selected"));tt.options.value=nt,typeof tt.options.onchange=="function"&&tt.options.onchange(et,nt),et.value!=tt.options.value&&(et.value=tt.options.value,typeof et.oninput=="function"&&et.oninput({type:"input",target:et,value:et.value}))},tt.getValue=function(){return tt.options.value};var rt=function(){tt.setOptions(it),et.classList.add("jrating"),et.addEventListener("click",function(nt){var ot=nt.target.getAttribute("data-index");ot!=null&&(ot==tt.options.value?tt.setValue(0):tt.setValue(ot))}),et.addEventListener("mouseover",function(nt){for(var ot=nt.target.getAttribute("data-index"),st=0;st<tt.options.number;st++)st<ot?et.children[st].classList.add("jrating-over"):et.children[st].classList.remove("jrating-over")}),et.addEventListener("mouseout",function(nt){for(var ot=0;ot<tt.options.number;ot++)et.children[ot].classList.remove("jrating-over")}),et.change=tt.setValue,et.val=function(nt){if(nt===void 0)return tt.getValue();tt.setValue(nt)},et.rating=tt};return rt(),tt},_.search=function(et,it){if(et.search)return et.search;var tt=null,rt=function(ct){if(ct.target.classList.contains("jsearch_item"))var ht=ct.target;else var ht=ct.target.parentNode;at.selectIndex(ht),ct.preventDefault()},nt=function(ct){if(lt.innerHTML="",!ct.length)et.style.display="";else{et.style.display="block";for(var ht=ct.length<11?ct.length:10,mt=0;mt<ht;mt++){if(typeof ct[mt]=="string")var dt=ct[mt],ft=ct[mt];else{var dt=ct[mt].text;!dt&&ct[mt].name&&(dt=ct[mt].name);var ft=ct[mt].value;!ft&&ct[mt].id&&(ft=ct[mt].id)}var ut=document.createElement("div");ut.setAttribute("data-value",ft),ut.setAttribute("data-text",dt),ut.className="jsearch_item",ct[mt].id&&ut.setAttribute("id",ct[mt].id),at.options.forceSelect&&mt==0&&ut.classList.add("selected");var pt=document.createElement("img");ct[mt].image?pt.src=ct[mt].image:pt.style.display="none",ut.appendChild(pt);var At=document.createElement("div");At.innerHTML=dt,ut.appendChild(At),lt.appendChild(ut)}}},ot=function(ct){if(ct!=at.terms)if(at.terms=ct,at.options.forceSelect?tt=0:tt=null,Array.isArray(at.options.data)){var ht=function(dt){if(typeof dt=="string"){if((""+dt).toLowerCase().search(ct.toLowerCase())>=0)return!0}else for(var ft in dt){var ut=dt[ft];if((""+ut).toLowerCase().search(ct.toLowerCase())>=0)return!0}return!1},mt=at.options.data.filter(function(dt){return ht(dt)});nt(mt)}else _.ajax({url:at.options.data+ct,method:"GET",dataType:"json",success:function(dt){nt(dt)}})},st=null,at=function(ct){st&&clearTimeout(st),st=setTimeout(function(){ot(ct)},500)};it.forceSelect===null&&(it.forceSelect=!0),at.options={data:it.data||null,input:it.input||null,onselect:it.onselect||null,forceSelect:it.forceSelect},at.selectIndex=function(ct){var ht=ct.getAttribute("id"),mt=ct.getAttribute("data-text"),dt=ct.getAttribute("data-value");typeof at.options.onselect=="function"&&at.options.onselect(at,mt,dt,ht),at.close()},at.open=function(){et.style.display="block"},at.close=function(){st&&clearTimeout(st),at.terms="",lt.innerHTML="",et.style.display=""},at.isOpened=function(){return!!et.style.display},at.keydown=function(ct){at.isOpened()&&(ct.key=="Enter"?tt!==null&&lt.children[tt]?(at.selectIndex(lt.children[tt]),ct.preventDefault()):at.close():ct.key==="ArrowUp"?(tt!==null&&lt.children[0]&&(lt.children[tt].classList.remove("selected"),!at.options.forceSelect&&tt===0?tt=null:(tt=Math.max(0,tt-1),lt.children[tt].classList.add("selected"))),ct.preventDefault()):ct.key==="ArrowDown"&&(tt==null?tt=-1:lt.children[tt].classList.remove("selected"),tt<9&&lt.children[tt+1]&&tt++,lt.children[tt].classList.add("selected"),ct.preventDefault()))},at.keyup=function(ct){if(at.options.input)at(at.options.input.value);else{var ht=_.getNode();ht&&at(ht.innerText)}},at.options.input&&(at.options.input.addEventListener("keyup",at.keyup),at.options.input.addEventListener("keydown",at.keydown));var lt=document.createElement("div");return lt.classList.add("jsearch_container"),lt.onmousedown=rt,et.appendChild(lt),et.classList.add("jsearch"),et.search=at,at},_.slider=function(et,it){var tt={};if(tt.options={},tt.currentImage=null,it&&(tt.options=it),et.setAttribute("tabindex","900"),tt.options.items=[],!et.classList.contains("jslider")){if(et.classList.add("jslider"),et.classList.add("unselectable"),tt.options.height&&(et.style.minHeight=tt.options.height),tt.options.width&&(et.style.width=tt.options.width),tt.options.grid){et.classList.add("jslider-grid");var rt=et.children.length;rt>4&&et.setAttribute("data-total",rt-4),et.setAttribute("data-number",rt>4?4:rt)}var nt=document.createElement("div");if(nt.classList.add("jslider-counter"),et.children.length>0)for(var ot=0;ot<et.children.length;ot++){tt.options.items.push(et.children[ot]);var st=document.createElement("div");st.onclick=function(){var mt=Array.prototype.slice.call(nt.children).indexOf(this);tt.show(tt.currentImage=tt.options.items[mt])},nt.appendChild(st)}var at=document.createElement("div");at.className="jslider-caption";var lt=document.createElement("div"),ct=document.createElement("div");ct.className="jslider-close",ct.innerHTML="",ct.onclick=function(){tt.close()},lt.appendChild(at),lt.appendChild(ct)}tt.updateCounter=function(mt){for(var dt=0;dt<nt.children.length;dt++)if(nt.children[dt].classList.contains("jslider-counter-focus")){nt.children[dt].classList.remove("jslider-counter-focus");break}nt.children[mt].classList.add("jslider-counter-focus")},tt.show=function(mt){if(!mt)var mt=et.children[0];et.classList.add("jslider-focus"),et.classList.remove("jslider-grid"),et.appendChild(lt),et.appendChild(nt);var dt=tt.options.items.indexOf(mt);tt.updateCounter(dt);for(var ft=0;ft<et.children.length;ft++)et.children[ft].style.display="";mt.style.display="block",mt.previousElementSibling?et.classList.add("jslider-left"):et.classList.remove("jslider-left"),mt.nextElementSibling&&mt.nextElementSibling.tagName=="IMG"?et.classList.add("jslider-right"):et.classList.remove("jslider-right"),tt.currentImage=mt,tt.currentImage.offsetHeight>tt.currentImage.offsetWidth&&tt.currentImage.classList.add("jslider-vertical"),lt.children[0].innerText=tt.currentImage.getAttribute("title")},tt.open=function(){tt.show(),typeof tt.options.onopen=="function"&&tt.options.onopen(et)},tt.close=function(){et.classList.remove("jslider-focus"),et.classList.remove("jslider-left"),et.classList.remove("jslider-right"),tt.options.grid&&et.classList.add("jslider-grid");for(var mt=0;mt<et.children.length;mt++)et.children[mt].style.display="";nt.remove(),lt.remove(),tt.currentImage=null,typeof tt.options.onclose=="function"&&tt.options.onclose(et)},tt.reset=function(){et.innerHTML=""},tt.next=function(){var mt=tt.currentImage.nextElementSibling;mt&&mt.tagName==="IMG"&&tt.show(tt.currentImage.nextElementSibling)},tt.prev=function(){tt.currentImage.previousElementSibling&&tt.show(tt.currentImage.previousElementSibling)};var ht=function(mt){if(mt.target.tagName=="IMG")tt.show(mt.target);else if(!mt.target.classList.contains("jslider-close")&&!(mt.target.parentNode.classList.contains("jslider-counter")||mt.target.classList.contains("jslider-counter"))){var dt=mt.offsetX||mt.changedTouches[0].clientX;mt.target.clientWidth-dt<40?tt.next():dt<40&&tt.prev()}};return"ontouchend"in document.documentElement?et.addEventListener("touchend",ht):et.addEventListener("mouseup",ht),et.addEventListener("swipeleft",function(mt){tt.next(),mt.preventDefault(),mt.stopPropagation()}),et.addEventListener("swiperight",function(mt){tt.prev(),mt.preventDefault(),mt.stopPropagation()}),et.addEventListener("keydown",function(mt){mt.which==27&&tt.close()}),et.slider=tt,tt},_.sorting=function(et,it){var tt={};tt.options={};var rt={pointer:null,direction:null,ondragstart:null,ondragend:null,ondrop:null},nt=null;for(var ot in rt)it&&it.hasOwnProperty(ot)?tt.options[ot]=it[ot]:tt.options[ot]=rt[ot];et.classList.add("jsorting"),et.addEventListener("dragstart",function(lt){var ct=Array.prototype.indexOf.call(lt.target.parentNode.children,lt.target);nt={element:lt.target,o:ct,d:ct},lt.target.style.opacity="0.25",typeof tt.options.ondragstart=="function"&&tt.options.ondragstart(et,lt.target,lt)}),et.addEventListener("dragover",function(lt){if(lt.preventDefault(),st(lt.target)&&nt&&lt.target.getAttribute("draggable")=="true"&&nt.element!=lt.target){if(tt.options.direction)var ct=lt.target.clientWidth/2>lt.offsetX;else var ct=lt.target.clientHeight/2>lt.offsetY;ct?lt.target.parentNode.insertBefore(nt.element,lt.target):lt.target.parentNode.insertBefore(nt.element,lt.target.nextSibling),nt.d=Array.prototype.indexOf.call(lt.target.parentNode.children,nt.element)}}),et.addEventListener("dragleave",function(lt){lt.preventDefault()}),et.addEventListener("dragend",function(lt){lt.preventDefault(),nt&&(typeof tt.options.ondragend=="function"&&tt.options.ondragend(et,nt.element,lt),nt.o<nt.d?lt.target.parentNode.insertBefore(nt.element,lt.target.parentNode.children[nt.o]):lt.target.parentNode.insertBefore(nt.element,lt.target.parentNode.children[nt.o].nextSibling),nt.element.style.opacity="",nt=null)}),et.addEventListener("drop",function(lt){lt.preventDefault(),nt&&nt.o!=nt.d&&typeof tt.options.ondrop=="function"&&tt.options.ondrop(et,nt.o,nt.d,nt.element,lt.target,lt),nt.element.style.opacity="",nt=null});for(var st=function(lt){var ct=!1;function ht(mt){mt.className&&mt.classList.contains("jsorting")&&(ct=!0),ct||ht(mt.parentNode)}return ht(lt),ct},at=0;at<et.children.length;at++)et.children[at].hasAttribute("draggable")||et.children[at].setAttribute("draggable","true");return et.val=function(){for(var lt=null,ct=[],ht=0;ht<et.children.length;ht++)(lt=et.children[ht].getAttribute("data-id"))&&ct.push(lt);return ct},et},_.tabs=function(et,it){var tt={};tt.options={};var rt={data:[],position:null,allowCreate:!1,allowChangePosition:!1,onclick:null,onload:null,onchange:null,oncreate:null,ondelete:null,onbeforecreate:null,onchangeposition:null,animation:!1,hideHeaders:!1,padding:null,palette:null,maxWidth:null};for(var nt in rt)it&&it.hasOwnProperty(nt)?tt.options[nt]=it[nt]:tt.options[nt]=rt[nt];et.classList.add("jtabs");var ot=null,st=null,at=null,lt=function(ft){if(tt.options.animation){var ut=tt.headers.children[ft].getBoundingClientRect();tt.options.palette=="modern"?(at.style.width=ut.width-4+"px",at.style.left=tt.headers.children[ft].offsetLeft+2+"px"):(at.style.width=ut.width+"px",at.style.left=tt.headers.children[ft].offsetLeft+"px"),tt.options.position=="bottom"?at.style.top="0px":at.style.bottom="0px"}},ct=function(ft){typeof tt.headers.scrollTo=="function"?tt.headers.scrollTo({left:ft,behavior:"smooth"}):tt.headers.scrollLeft=ft,ft<=1?ot.classList.add("disabled"):ot.classList.remove("disabled"),ft>=tt.headers.scrollWidth-tt.headers.offsetWidth?st.classList.add("disabled"):st.classList.remove("disabled"),tt.headers.scrollWidth<=tt.headers.offsetWidth?(ot.style.display="none",st.style.display="none"):(ot.style.display="",st.style.display="")};if(tt.setBorder=lt,tt.open=function(ft){for(var ut=null,pt=0;pt<tt.headers.children.length;pt++)tt.headers.children[pt].classList.contains("jtabs-selected")&&(ut=pt),tt.headers.children[pt].classList.remove("jtabs-selected"),tt.content.children[pt]&&tt.content.children[pt].classList.remove("jtabs-selected");if(tt.headers.children[ft].classList.add("jtabs-selected"),tt.content.children[ft]&&tt.content.children[ft].classList.add("jtabs-selected"),ut!=ft&&typeof tt.options.onchange=="function"&&tt.content.children[ft]&&tt.options.onchange(et,tt,ft,tt.headers.children[ft],tt.content.children[ft]),tt.options.hideHeaders==!0&&tt.headers.children.length<3&&tt.options.allowCreate==!1)tt.headers.parentNode.style.display="none";else{lt(ft),tt.headers.parentNode.style.display="";var At=tt.headers.children[ft].offsetLeft,gt=At+tt.headers.children[ft].offsetWidth,vt=tt.headers.scrollLeft,yt=vt+tt.headers.offsetWidth;vt<=At&&yt>=gt||ct(At-1)}},tt.selectIndex=function(ft){var ut=Array.prototype.indexOf.call(tt.headers.children,ft);return ut>=0&&tt.open(ut),ut},tt.rename=function(ft,ut){ut||(ut=prompt("New title",tt.headers.children[ft].innerText)),tt.headers.children[ft].innerText=ut,tt.open(ft)},tt.create=function(ft,ut){if(typeof tt.options.onbeforecreate=="function"){var pt=tt.options.onbeforecreate(et);if(pt===!1)return!1;ft=pt}var At=tt.appendElement(ft);return typeof tt.options.oncreate=="function"&&tt.options.oncreate(et,At),At},tt.remove=function(ft){return tt.deleteElement(ft)},tt.nextNumber=function(){for(var ft=0,ut=0;ut<tt.headers.children.length;ut++){var pt=tt.headers.children[ut].innerText.match(/[0-9].*/);pt>ft&&(ft=parseInt(pt))}return ft?ft++:ft=1,ft},tt.deleteElement=function(ft){if(tt.headers.children[ft])tt.headers.removeChild(tt.headers.children[ft]),tt.content.removeChild(tt.content.children[ft]);else return!1;tt.open(0),typeof tt.options.ondelete=="function"&&tt.options.ondelete(et,ft)},tt.appendElement=function(ft,ut){if(!ft)var ft=prompt("Title?","");if(ft){var pt=document.createElement("div");tt.content.appendChild(pt);var At=document.createElement("div");return At.innerHTML=ft,At.content=pt,tt.headers.insertBefore(At,tt.headers.lastChild),tt.options.allowChangePosition&&At.setAttribute("draggable","true"),tt.selectIndex(At),typeof ut=="function"&&ut(pt,At),pt}},tt.getActive=function(){for(var ft=0;ft<tt.headers.children.length;ft++)if(tt.headers.children[ft].classList.contains("jtabs-selected"))return ft;return 0},tt.updateContent=function(ft,ut){if(typeof ut!="string")var pt=ut;else{var pt=document.createElement("div");pt.innerHTML=ut}tt.content.children[ft].classList.contains("jtabs-selected")&&ut.classList.add("jtabs-selected"),tt.content.replaceChild(ut,tt.content.children[ft])},tt.updatePosition=function(ft,ut){ft>ut?tt.content.insertBefore(tt.content.children[ft],tt.content.children[ut]):tt.content.insertBefore(tt.content.children[ft],tt.content.children[ut].nextSibling),tt.open(ut),typeof tt.options.onchangeposition=="function"&&tt.options.onchangeposition(tt.headers,ft,ut)},tt.move=function(ft,ut){ft>ut?tt.headers.insertBefore(tt.headers.children[ft],tt.headers.children[ut]):tt.headers.insertBefore(tt.headers.children[ft],tt.headers.children[ut].nextSibling),tt.updatePosition(ft,ut)},tt.setBorder=lt,tt.init=function(){et.innerHTML="",tt.headers=document.createElement("div"),tt.content=document.createElement("div"),tt.headers.classList.add("jtabs-headers"),tt.content.classList.add("jtabs-content"),tt.options.palette?et.classList.add("jtabs-modern"):et.classList.remove("jtabs-modern"),tt.options.padding&&(tt.content.style.padding=parseInt(tt.options.padding)+"px");var ft=document.createElement("div");ft.className="jtabs-headers-container",ft.appendChild(tt.headers),tt.options.maxWidth&&(ft.style.maxWidth=parseInt(tt.options.maxWidth)+"px");var ut=document.createElement("div");if(ut.className="jtabs-controls",ut.setAttribute("draggable","false"),ft.appendChild(ut),tt.options.position=="bottom"?(et.appendChild(tt.content),et.appendChild(ft)):(et.appendChild(ft),et.appendChild(tt.content)),tt.options.allowCreate==!0){var pt=document.createElement("div");pt.className="jtabs-add",pt.onclick=function(){tt.create()},ut.appendChild(pt)}ot=document.createElement("div"),ot.className="jtabs-prev",ot.onclick=function(){ct(tt.headers.scrollLeft-tt.headers.offsetWidth)},ut.appendChild(ot),st=document.createElement("div"),st.className="jtabs-next",st.onclick=function(){ct(tt.headers.scrollLeft+tt.headers.offsetWidth)},ut.appendChild(st);for(var At=0;At<tt.options.data.length;At++){if(tt.options.data[At].titleElement)var gt=tt.options.data[At].titleElement;else var gt=document.createElement("div");if(tt.options.data[At].icon){var vt=document.createElement("div"),yt=document.createElement("i");yt.classList.add("material-icons"),yt.innerHTML=tt.options.data[At].icon,vt.appendChild(yt),gt.appendChild(vt)}if(tt.options.data[At].title){var bt=document.createTextNode(tt.options.data[At].title);gt.appendChild(bt)}if(tt.options.data[At].width&&(gt.style.width=tt.options.data[At].width),tt.options.data[At].contentElement)var Ct=tt.options.data[At].contentElement;else{var Ct=document.createElement("div");Ct.innerHTML=tt.options.data[At].content}tt.headers.appendChild(gt),tt.content.appendChild(Ct)}at=document.createElement("div"),at.className="jtabs-border",tt.headers.appendChild(at),tt.options.animation&&et.classList.add("jtabs-animation"),tt.headers.addEventListener("click",function(xt){if(xt.target.parentNode.classList.contains("jtabs-headers"))var It=xt.target;else if(xt.target.tagName=="I")var It=xt.target.parentNode.parentNode;else var It=xt.target.parentNode;var St=tt.selectIndex(It);typeof tt.options.onclick=="function"&&tt.options.onclick(et,tt,St,tt.headers.children[St],tt.content.children[St])}),tt.headers.addEventListener("contextmenu",function(xt){tt.selectIndex(xt.target)}),tt.headers.children.length&&tt.open(0),ct(0),tt.options.allowChangePosition==!0&&_.sorting(tt.headers,{direction:1,ondrop:function(xt,It,St){tt.updatePosition(It,St)}}),typeof tt.options.onload=="function"&&tt.options.onload(et,tt)},et.children[0]&&et.children[0].children.length)for(var ht=0;ht<et.children[0].children.length;ht++){var mt=tt.options.data&&tt.options.data[ht]?tt.options.data[ht]:{};et.children[1]&&et.children[1].children[ht]?(mt.titleElement=et.children[0].children[ht],mt.contentElement=et.children[1].children[ht]):mt.contentElement=et.children[0].children[ht],tt.options.data[ht]=mt}var dt=!1;if(tt.options.data)for(var ht=0;ht<tt.options.data.length;ht++)tt.options.data[ht].url&&(_.ajax({url:tt.options.data[ht].url,type:"GET",dataType:"text/html",index:ht,success:function(ut){tt.options.data[this.index].content=ut},complete:function(){tt.init()}}),dt=!0);return dt||tt.init(),et.tabs=tt,tt},_.tags=function(et,it){if(et.tags)return et.tags.setOptions(it,!0);var tt={type:"tags"};tt.options={};var rt=function(){return!!(tt.options.limit&&et.children.length>=tt.options.limit)},nt=null,ot=null;tt.setOptions=function(bt,Ct){var xt={value:"",limit:null,limitMessage:null,search:null,placeholder:null,validation:null,onbeforechange:null,onlimit:null,onchange:null,onfocus:null,onblur:null,onload:null,colors:null};for(var It in xt)bt&&bt.hasOwnProperty(It)?tt.options[It]=bt[It]:(typeof tt.options[It]=="undefined"||Ct===!0)&&(tt.options[It]=xt[It]);return tt.options.placeholder?et.setAttribute("data-placeholder",tt.options.placeholder):et.removeAttribute("data-placeholder"),et.placeholder=tt.options.placeholder,tt.setValue(tt.options.value),ct(),tt.options.search?ot||(ot=document.createElement("div"),et.parentNode.insertBefore(ot,et.nextSibling),nt=_.search(ot,{data:tt.options.search,onselect:function(St,Ot,Mt){tt.selectIndex(Ot,Mt)}})):ot&&(nt=null,ot.remove(),ot=null),tt},tt.add=function(bt,Ct){if(typeof tt.options.onbeforechange=="function"){var xt=tt.options.onbeforechange(et,tt,tt.options.value,bt);if(xt===!1)return!1;xt!=null&&(bt=xt)}if(nt&&nt.close(),rt())typeof tt.options.onlimit=="function"?tt.options.onlimit(tt,tt.options.limit):tt.options.limitMessage&&alert(tt.options.limitMessage+" "+tt.options.limit);else{var It=_.getNode();if(It&&It.parentNode&&It.parentNode.classList.contains("jtags")&&It.nextSibling&&!(It.nextSibling.innerText&&It.nextSibling.innerText.trim()))St=It.nextSibling;else{if(et.lastChild&&(et.lastChild.innerText.trim()||et.removeChild(et.lastChild)),!bt||typeof bt=="string")var St=at(bt,bt,It);else for(var Ot=0;Ot<=bt.length;Ot++)if(!rt()){if(!bt[Ot]||typeof bt[Ot]=="string")var Mt=bt[Ot]||"",jt=null;else var Mt=bt[Ot].text,jt=bt[Ot].value;var St=at(Mt,jt)}lt()}Ct&&st(St)}},tt.setLimit=function(bt){for(tt.options.limit=bt,et.children.length-bt;et.children.length>bt;)et.removeChild(et.lastChild)},tt.remove=function(bt){bt.parentNode.removeChild(bt),et.children.length?lt():tt.add("",!0)},tt.getData=function(){for(var bt=[],Ct=0;Ct<et.children.length;Ct++){var xt=et.children[Ct].innerText.replace(`
`,""),It=et.children[Ct].getAttribute("data-value");It||(It=xt),(xt||It)&&bt.push({text:xt,value:It})}return bt},tt.getValue=function(bt){var Ct=null;if(bt!=null)Ct=et.children[bt].getAttribute("data-value"),Ct||(Ct=et.children[bt].innerText.replace(`
`,""));else{for(var xt=[],It=0;It<et.children.length;It++)Ct=et.children[It].innerText.replace(`
`,""),Ct&&xt.push(tt.getValue(It));Ct=xt.join(",")}return Ct},tt.setValue=function(bt){if(!bt)tt.reset();else if(et.value!=bt)if(Array.isArray(bt))tt.add(bt);else{var Ct=(""+bt).trim(),xt=mt(Ct);et.innerHTML="",tt.add(xt)}},tt.reset=function(){et.classList.add("jtags-empty"),et.innerHTML="<div></div>",lt()},tt.isValid=function(){for(var bt=0,Ct=0;Ct<et.children.length;Ct++)et.children[Ct].classList.contains("jtags_error")&&bt++;return bt==0},tt.selectIndex=function(bt,Ct){var xt=_.getNode();xt&&(xt.innerText=bt,Ct&&xt.setAttribute("data-value",Ct),xt.classList.remove("jtags_error"),rt()||tt.add("",!0))},tt.search=function(bt){bt.innerText},tt.destroy=function(){et.removeEventListener("mouseup",At),et.removeEventListener("keydown",ft),et.removeEventListener("keyup",ut),et.removeEventListener("paste",pt),et.removeEventListener("focus",gt),et.removeEventListener("blur",vt),et.parentNode.removeChild(et)};var st=function(bt){if(et.children.length>1){var Ct=document.createRange(),xt=window.getSelection();if(!bt)var bt=et.childNodes[et.childNodes.length-1];Ct.setStart(bt,bt.length),Ct.collapse(!0),xt.removeAllRanges(),xt.addRange(Ct),et.scrollLeft=et.scrollWidth}},at=function(bt,Ct,xt){var It=document.createElement("div");return It.innerHTML=bt||"",Ct&&It.setAttribute("data-value",Ct),xt&&xt.parentNode.classList.contains("jtags")?et.insertBefore(It,xt.nextSibling):et.appendChild(It),It},lt=function(){var bt=tt.getValue();bt!=tt.options.value&&(tt.options.value=bt,typeof tt.options.onchange=="function"&&tt.options.onchange(et,tt,tt.options.value),et.value!=tt.options.value&&(et.value=tt.options.value,typeof et.oninput=="function"&&et.oninput({type:"input",target:et,value:et.value}))),ct()},ct=function(){for(var bt=0;bt<et.children.length;bt++)tt.getValue(bt)?(et.children[bt].classList.add("jtags_label"),typeof tt.options.validation=="function"&&tt.getValue(bt)?tt.options.validation(et.children[bt],et.children[bt].innerText,et.children[bt].getAttribute("data-value"))?et.children[bt].classList.remove("jtags_error"):et.children[bt].classList.add("jtags_error"):et.children[bt].classList.remove("jtags_error")):et.children[bt].classList.remove("jtags_label");ht()},ht=function(){et.innerText.trim()?et.classList.remove("jtags-empty"):(et.innerHTML="<div></div>",et.classList.add("jtags-empty"))},mt=function(bt){var Ct=[],xt="";if(bt=bt.trim(),bt){for(var It=0;It<bt.length;It++)bt[It]==","||bt[It]==";"||bt[It]==`
`?xt&&(Ct.push(xt.trim()),xt=""):xt+=bt[It];xt&&Ct.push(xt)}return Ct},dt=0,ft=function(bt){if(dt=window.getSelection().anchorOffset,ht(),bt.key==="Tab"||bt.key===";"||bt.key===","){var Ct=window.getSelection().anchorOffset;Ct>1&&(rt()?typeof tt.options.onlimit=="function"&&tt.options.onlimit(tt,tt.options.limit):tt.add("",!0)),bt.preventDefault()}else if(bt.key=="Enter"){if(!nt||!nt.isOpened()){var Ct=window.getSelection().anchorOffset;Ct>1&&(rt()||tt.add("",!0)),bt.preventDefault()}}else bt.key=="Backspace"&&et.children.length==1&&window.getSelection().anchorOffset<1&&bt.preventDefault();nt&&nt.keydown(bt)},ut=function(bt){if(bt.which==39){var Ct=window.getSelection().anchorOffset;Ct>1&&Ct==dt&&tt.add("",!0)}else bt.which==13||bt.which==38||bt.which==40?bt.preventDefault():nt&&nt.keyup(bt);ct()},pt=function(bt){if(bt.clipboardData||bt.originalEvent.clipboardData)var Ct=(bt.originalEvent||bt).clipboardData.getData("text/plain");else if(window.clipboardData)var Ct=window.clipboardData.getData("Text");var xt=mt(Ct);xt.length>1&&(tt.add(xt,!0),bt.preventDefault())},At=function(bt){if(bt.target.parentNode&&bt.target.parentNode.classList.contains("jtags")&&(bt.target.classList.contains("jtags_label")||bt.target.classList.contains("jtags_error"))){var Ct=bt.target.getBoundingClientRect();Ct.width-(bt.clientX-Ct.left)<16&&tt.remove(bt.target)}bt.target==et&&st()},gt=function(){et.classList.contains("jtags-focus")||((!et.children.length||tt.getValue(et.children.length-1))&&(rt()||at("")),typeof tt.options.onfocus=="function"&&tt.options.onfocus(et,tt,tt.getValue()),et.classList.add("jtags-focus"))},vt=function(){if(et.classList.contains("jtags-focus")){nt&&nt.close();for(var bt=0;bt<et.children.length-1;bt++)tt.getValue(bt)||et.removeChild(et.children[bt]);lt(),et.classList.remove("jtags-focus"),typeof tt.options.onblur=="function"&&tt.options.onblur(et,tt,tt.getValue())}},yt=function(){"touchend"in document.documentElement?et.addEventListener("touchend",At):et.addEventListener("mouseup",At),et.addEventListener("keydown",ft),et.addEventListener("keyup",ut),et.addEventListener("paste",pt),et.addEventListener("focus",gt),et.addEventListener("blur",vt),et.setAttribute("contenteditable",!0),et.classList.add("jtags"),tt.setOptions(it),typeof tt.options.onload=="function"&&tt.options.onload(et,tt),et.change=tt.setValue,et.val=function(bt){if(bt===void 0)return tt.getValue();tt.setValue(bt)},et.tags=tt};return yt(),tt},_.toolbar=function(et,it){var tt={type:"toolbar"};tt.options={};var rt={app:null,container:!1,badge:!1,title:!1,responsive:!1,maxWidth:null,bottom:!0,items:[]};for(var nt in rt)it&&it.hasOwnProperty(nt)?tt.options[nt]=it[nt]:tt.options[nt]=rt[nt];!et&&it.app&&it.app.el&&(et=document.createElement("div"),it.app.el.appendChild(et));var ot=document.createElement("div");ot.classList.add("jtoolbar-item"),ot.classList.add("jtoolbar-arrow");var st=document.createElement("div");st.classList.add("jtoolbar-floating"),ot.appendChild(st),tt.selectItem=function(lt){for(var ct=at.children,ht=0;ht<ct.length;ht++)lt!=ct[ht]&&ct[ht].classList.remove("jtoolbar-selected");lt.classList.add("jtoolbar-selected")},tt.hide=function(){_.animation.slideBottom(et,0,function(){et.style.display="none"})},tt.show=function(){et.style.display="",_.animation.slideBottom(et,1)},tt.get=function(){return et},tt.setBadge=function(lt,ct){at.children[lt].children[1].firstChild.innerHTML=ct},tt.destroy=function(){toolbar.remove(),et.innerHTML=""},tt.update=function(lt,ct){for(var ht=0;ht<at.children.length;ht++){var mt=at.children[ht];typeof mt.updateState=="function"&&mt.updateState(et,tt,mt,lt,ct)}},tt.create=function(lt){at.innerHTML="";for(var ct=0;ct<lt.length;ct++){var ht=document.createElement("div");if(ht.classList.add("jtoolbar-item"),lt[ct].width&&(ht.style.width=parseInt(lt[ct].width)+"px"),lt[ct].k&&(ht.k=lt[ct].k),lt[ct].tooltip&&ht.setAttribute("title",lt[ct].tooltip),lt[ct].id&&ht.setAttribute("id",lt[ct].id),lt[ct].updateState&&(ht.updateState=lt[ct].updateState),lt[ct].active&&ht.classList.add("jtoolbar-active"),lt[ct].type=="select"||lt[ct].type=="dropdown")_.picker(ht,lt[ct]);else if(lt[ct].type=="divisor")ht.classList.add("jtoolbar-divisor");else if(lt[ct].type=="label")ht.classList.add("jtoolbar-label"),ht.innerHTML=lt[ct].content;else{var mt=document.createElement("i");if(typeof lt[ct].class=="undefined")mt.classList.add("material-icons");else for(var dt=lt[ct].class.split(" "),ft=0;ft<dt.length;ft++)mt.classList.add(dt[ft]);if(mt.innerHTML=lt[ct].content?lt[ct].content:"",ht.appendChild(mt),tt.options.badge==!0){var ut=document.createElement("div");ut.classList.add("jbadge");var pt=document.createElement("div");pt.innerHTML=lt[ct].badge?lt[ct].badge:"",ut.appendChild(pt),ht.appendChild(ut)}if(lt[ct].title)if(tt.options.title==!0){var At=document.createElement("span");At.innerHTML=lt[ct].title,ht.appendChild(At)}else ht.setAttribute("title",lt[ct].title);tt.options.app&&lt[ct].route&&(ht.route=lt[ct].route,ht.onclick=function(){tt.options.app.pages(this.route)},tt.options.app.pages(lt[ct].route,{toolbarItem:ht,closed:!0}))}lt[ct].onclick&&(ht.onclick=lt[ct].onclick.bind(lt[ct],et,tt,ht)),at.appendChild(ht)}setTimeout(function(){tt.refresh()},0)},tt.open=function(){ot.classList.add("jtoolbar-arrow-selected"),et.getBoundingClientRect();var lt=st.getBoundingClientRect();lt.bottom>window.innerHeight||tt.options.bottom?st.style.bottom="0":st.style.removeProperty("bottom"),st.style.right="0",ot.children[0].focus(),_.tracking(tt,!0)},tt.close=function(){ot.classList.remove("jtoolbar-arrow-selected"),_.tracking(tt,!1)},tt.refresh=function(){if(tt.options.responsive==!0){var lt=et.parentNode.getBoundingClientRect();tt.options.maxWidth||(tt.options.maxWidth=lt.width);var ct=parseInt(tt.options.maxWidth);for(ot.remove();st.firstChild;)at.appendChild(st.firstChild);if(ct<at.offsetWidth)for(ct-=50;at.lastChild&&ct<at.offsetWidth;)st.insertBefore(at.lastChild,st.firstChild);st.children.length>0&&at.appendChild(ot)}},et.onclick=function(lt){var ct=_.findElement(lt.target,"jtoolbar-item");ct&&tt.selectItem(ct),lt.target.classList.contains("jtoolbar-arrow")&&tt.open()},window.addEventListener("resize",function(){tt.refresh()}),et.classList.add("jtoolbar"),et.innerHTML="",tt.options.container==!0&&et.classList.add("jtoolbar-container");var at=document.createElement("div");return et.appendChild(at),tt.options.app&&et.classList.add("jtoolbar-mobile"),tt.create(tt.options.items),et.toolbar=tt,tt},_.validations=function(et,it){return typeof _.validations[it.type]=="function"?_.validations[it.type](et,it):null},_.validations.email=function(et){var it=new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);return!!(et&&it.test(et))},_.validations.required=function(et){return!!et.trim()},_.validations.number=function(et){return _.isNumber(et)},_.validations.login=function(et){var it=new RegExp(/^[a-zA-Z0-9\_\-\.\s+]+$/);return!!(et&&it.test(et))};var _e=function(et,it){return it.constraint==="="?et===it.reference:it.constraint==="<"?et<it.reference:it.constraint==="<="?et<=it.reference:it.constraint===">"?et>it.reference:it.constraint===">="?et>=it.reference:it.constraint==="between"?et>=it.reference[0]&&et<=it.reference[1]:it.constraint==="not between"?et<it.reference[0]||et>it.reference[1]:null};return _.validations.number=function(et,it){return _.isNumeric(et)?it===void 0||it.constraint===void 0?!0:_e(et,it):!1},_.validations.date=function(et,it){return new Date(et)=="Invalid Date"?!1:it===void 0||it.constraint===void 0?!0:typeof it=="object"?(et=new Date(et).getTime(),Array.isArray(it.reference)?it.reference=it.reference.map(function(tt){return new Date(tt).getTime()}):it.reference=new Date(it.reference).getTime(),_e(et,it)):null},_.validations.itemList=function(et,it){return it.reference.some(function(tt){return tt==et})},_.validations.text=function(et,it){if(typeof et!="string")return!1;if(it===void 0||it.constraint===void 0)return!0;if(it.constraint==="=")return et===it.reference;if(it.constraint==="contains")return et.includes(it.reference);if(it.constraint==="not contain")return!et.includes(it.reference);if(it.constraint==="email")return _.validations.email(et);if(it.constraint==="url"){var tt=new RegExp(/(((https?:\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]+)/ig);return!!tt.test(et)}return null},_.validations.constraints=function(){},_})})(jsuites);(function(module,exports){var formula=function(){var error=function(){var o={};return o.nil=new Error("#NULL!"),o.div0=new Error("#DIV/0!"),o.value=new Error("#VALUE!"),o.ref=new Error("#REF!"),o.name=new Error("#NAME?"),o.num=new Error("#NUM!"),o.na=new Error("#N/A"),o.error=new Error("#ERROR!"),o.data=new Error("#GETTING_DATA"),o}(),utils=function(){var o={};o.flattenShallow=function(_){return!_||!_.reduce?_:_.reduce(function(_e,et){var it=Array.isArray(_e),tt=Array.isArray(et);return it&&tt?_e.concat(et):it?(_e.push(et),_e):tt?[_e].concat(et):[_e,et]})},o.isFlat=function(_){if(!_)return!1;for(var _e=0;_e<_.length;++_e)if(Array.isArray(_[_e]))return!1;return!0},o.flatten=function(){for(var _=o.argsToArray.apply(null,arguments);!o.isFlat(_);)_=o.flattenShallow(_);return _},o.argsToArray=function(_){var _e=[];return o.arrayEach(_,function(et){_e.push(et)}),_e},o.numbers=function(){var _=this.flatten.apply(null,arguments);return _.filter(function(_e){return typeof _e=="number"})},o.cleanFloat=function(_){var _e=1e14;return Math.round(_*_e)/_e},o.parseBool=function(_){if(typeof _=="boolean"||_ instanceof Error)return _;if(typeof _=="number")return _!==0;if(typeof _=="string"){var _e=_.toUpperCase();if(_e==="TRUE")return!0;if(_e==="FALSE")return!1}return _ instanceof Date&&!isNaN(_)?!0:error.value},o.parseNumber=function(_){return _===void 0||_===""||isNaN(_)?error.value:parseFloat(_)},o.parseNumberArray=function(_){var _e;if(!_||(_e=_.length)===0)return error.value;for(var et;_e--;){if(et=o.parseNumber(_[_e]),et===error.value)return et;_[_e]=et}return _},o.parseMatrix=function(_){if(!_||_.length===0)return error.value;for(var _e,et=0;et<_.length;et++)if(_e=o.parseNumberArray(_[et]),_[et]=_e,_e instanceof Error)return _e;return _};var s=new Date(Date.UTC(1900,0,1));return o.parseDate=function(_){if(!isNaN(_)){if(_ instanceof Date)return new Date(_);var _e=parseInt(_,10);return _e<0?error.num:_e<=60?new Date(s.getTime()+(_e-1)*864e5):new Date(s.getTime()+(_e-2)*864e5)}return typeof _=="string"&&(_=new Date(_),!isNaN(_))?_:error.value},o.parseDateArray=function(_){for(var _e=_.length,et;_e--;){if(et=this.parseDate(_[_e]),et===error.value)return et;_[_e]=et}return _},o.anyIsError=function(){for(var _=arguments.length;_--;)if(arguments[_]instanceof Error)return!0;return!1},o.arrayValuesToNumbers=function(_){for(var _e=_.length,et;_e--;)if(et=_[_e],typeof et!="number"){if(et===!0){_[_e]=1;continue}if(et===!1){_[_e]=0;continue}if(typeof et=="string"){var it=this.parseNumber(et);it instanceof Error?_[_e]=0:_[_e]=it}}return _},o.rest=function(_,_e){return _e=_e||1,!_||typeof _.slice!="function"?_:_.slice(_e)},o.initial=function(_,_e){return _e=_e||1,!_||typeof _.slice!="function"?_:_.slice(0,_.length-_e)},o.arrayEach=function(_,_e){for(var et=-1,it=_.length;++et<it&&_e(_[et],et,_)!==!1;);return _},o.transpose=function(_){return _?_[0].map(function(_e,et){return _.map(function(it){return it[et]})}):error.value},o}(),met={};met.datetime=function(){var o={},s=new Date(1900,0,1),_=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]];o.DATE=function(et,it,tt){if(et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),utils.anyIsError(et,it,tt))return error.value;if(et<0||it<0||tt<0)return error.num;var rt=new Date(et,it-1,tt);return rt},o.DATEVALUE=function(et){if(typeof et!="string")return error.value;var it=Date.parse(et);return isNaN(it)?error.value:it<=-22038912e5?(it-s)/864e5+1:(it-s)/864e5+2},o.DAY=function(et){var it=utils.parseDate(et);return it instanceof Error?it:it.getDate()},o.DAYS=function(et,it){return et=utils.parseDate(et),it=utils.parseDate(it),et instanceof Error?et:it instanceof Error?it:_e(et)-_e(it)},o.DAYS360=function(et,it,tt){},o.EDATE=function(et,it){return et=utils.parseDate(et),et instanceof Error?et:isNaN(it)?error.value:(it=parseInt(it,10),et.setMonth(et.getMonth()+it),_e(et))},o.EOMONTH=function(et,it){return et=utils.parseDate(et),et instanceof Error?et:isNaN(it)?error.value:(it=parseInt(it,10),_e(new Date(et.getFullYear(),et.getMonth()+it+1,0)))},o.HOUR=function(et){return et=utils.parseDate(et),et instanceof Error?et:et.getHours()},o.INTERVAL=function(et){if(typeof et!="number"&&typeof et!="string")return error.value;et=parseInt(et,10);var it=Math.floor(et/94608e4);et=et%94608e4;var tt=Math.floor(et/2592e3);et=et%2592e3;var rt=Math.floor(et/86400);et=et%86400;var nt=Math.floor(et/3600);et=et%3600;var ot=Math.floor(et/60);et=et%60;var st=et;return it=it>0?it+"Y":"",tt=tt>0?tt+"M":"",rt=rt>0?rt+"D":"",nt=nt>0?nt+"H":"",ot=ot>0?ot+"M":"",st=st>0?st+"S":"","P"+it+tt+rt+"T"+nt+ot+st},o.ISOWEEKNUM=function(et){if(et=utils.parseDate(et),et instanceof Error)return et;et.setHours(0,0,0),et.setDate(et.getDate()+4-(et.getDay()||7));var it=new Date(et.getFullYear(),0,1);return Math.ceil(((et-it)/864e5+1)/7)},o.MINUTE=function(et){return et=utils.parseDate(et),et instanceof Error?et:et.getMinutes()},o.MONTH=function(et){return et=utils.parseDate(et),et instanceof Error?et:et.getMonth()+1},o.NETWORKDAYS=function(et,it,tt){},o.NETWORKDAYS.INTL=function(et,it,tt,rt){},o.NOW=function(){return new Date},o.SECOND=function(et){return et=utils.parseDate(et),et instanceof Error?et:et.getSeconds()},o.TIME=function(et,it,tt){return et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),utils.anyIsError(et,it,tt)?error.value:et<0||it<0||tt<0?error.num:(3600*et+60*it+tt)/86400},o.TIMEVALUE=function(et){return et=utils.parseDate(et),et instanceof Error?et:(3600*et.getHours()+60*et.getMinutes()+et.getSeconds())/86400},o.TODAY=function(){return new Date},o.WEEKDAY=function(et,it){if(et=utils.parseDate(et),et instanceof Error)return et;it===void 0&&(it=1);var tt=et.getDay();return _[it][tt]},o.WEEKNUM=function(et,it){},o.WORKDAY=function(et,it,tt){},o.WORKDAY.INTL=function(et,it,tt,rt){},o.YEAR=function(et){return et=utils.parseDate(et),et instanceof Error?et:et.getFullYear()},o.YEARFRAC=function(et,it,tt){};function _e(et){var it=et>-22038912e5?2:1;return(et-s)/864e5+it}return o}(),met.database=function(){var exports={};function compact(o){if(!o)return o;for(var s=[],_=0;_<o.length;++_)!o[_]||s.push(o[_]);return s}exports.FINDFIELD=function(o,s){for(var _=null,_e=0;_e<o.length;_e++)if(o[_e][0]===s){_=_e;break}return _==null?error.value:_};function findResultIndex(database,criterias){for(var matches={},i=1;i<database[0].length;++i)matches[i]=!0;var maxCriteriaLength=criterias[0].length;for(i=1;i<criterias.length;++i)criterias[i].length>maxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;k<database.length;++k)for(var l=1;l<database[k].length;++l){for(var currentCriteriaResult=!1,hasMatchingCriteria=!1,j=0;j<criterias.length;++j){var criteria=criterias[j];if(!(criteria.length<maxCriteriaLength)){var criteriaField=criteria[0];if(database[k][0]===criteriaField){hasMatchingCriteria=!0;for(var p=1;p<criteria.length;++p)currentCriteriaResult=currentCriteriaResult||eval(database[k][l]+criteria[p])}}}hasMatchingCriteria&&(matches[l]=matches[l]&&currentCriteriaResult)}for(var result=[],n=0;n<database[0].length;++n)matches[n]&&result.push(n-1);return result}return exports.DAVERAGE=function(o,s,_){if(isNaN(s)&&typeof s!="string")return error.value;var _e=findResultIndex(o,_),et=[];if(typeof s=="string"){var it=exports.FINDFIELD(o,s);et=utils.rest(o[it])}else et=utils.rest(o[s]);for(var tt=0,rt=0;rt<_e.length;rt++)tt+=et[_e[rt]];return _e.length===0?error.div0:tt/_e.length},exports.DCOUNT=function(o,s,_){},exports.DCOUNTA=function(o,s,_){},exports.DGET=function(o,s,_){if(isNaN(s)&&typeof s!="string")return error.value;var _e=findResultIndex(o,_),et=[];if(typeof s=="string"){var it=exports.FINDFIELD(o,s);et=utils.rest(o[it])}else et=utils.rest(o[s]);return _e.length===0?error.value:_e.length>1?error.num:et[_e[0]]},exports.DMAX=function(o,s,_){if(isNaN(s)&&typeof s!="string")return error.value;var _e=findResultIndex(o,_),et=[];if(typeof s=="string"){var it=exports.FINDFIELD(o,s);et=utils.rest(o[it])}else et=utils.rest(o[s]);for(var tt=et[_e[0]],rt=1;rt<_e.length;rt++)tt<et[_e[rt]]&&(tt=et[_e[rt]]);return tt},exports.DMIN=function(o,s,_){if(isNaN(s)&&typeof s!="string")return error.value;var _e=findResultIndex(o,_),et=[];if(typeof s=="string"){var it=exports.FINDFIELD(o,s);et=utils.rest(o[it])}else et=utils.rest(o[s]);for(var tt=et[_e[0]],rt=1;rt<_e.length;rt++)tt>et[_e[rt]]&&(tt=et[_e[rt]]);return tt},exports.DPRODUCT=function(o,s,_){if(isNaN(s)&&typeof s!="string")return error.value;var _e=findResultIndex(o,_),et=[];if(typeof s=="string"){var it=exports.FINDFIELD(o,s);et=utils.rest(o[it])}else et=utils.rest(o[s]);for(var tt=[],rt=0;rt<_e.length;rt++)tt[rt]=et[_e[rt]];tt=compact(tt);var nt=1;for(rt=0;rt<tt.length;rt++)nt*=tt[rt];return nt},exports.DSTDEV=function(o,s,_){},exports.DSTDEVP=function(o,s,_){},exports.DSUM=function(o,s,_){},exports.DVAR=function(o,s,_){},exports.DVARP=function(o,s,_){},exports.MATCH=function(o,s,_){if(!o&&!s||(arguments.length===2&&(_=1),!(s instanceof Array))||_!==-1&&_!==0&&_!==1)return error.na;for(var _e,et,it=0;it<s.length;it++)if(_===1){if(s[it]===o)return it+1;s[it]<o&&(et?s[it]>et&&(_e=it+1,et=s[it]):(_e=it+1,et=s[it]))}else if(_===0){if(typeof o=="string"){if(o=o.replace(/\?/g,"."),s[it].toLowerCase().match(o.toLowerCase()))return it+1}else if(s[it]===o)return it+1}else if(_===-1){if(s[it]===o)return it+1;s[it]>o&&(et?s[it]<et&&(_e=it+1,et=s[it]):(_e=it+1,et=s[it]))}return _e||error.na},exports}(),met.engineering=function(){var o={};function s(_){return/^[01]{1,10}$/.test(_)}return o.BESSELI=function(_,_e){},o.BESSELJ=function(_,_e){},o.BESSELK=function(_,_e){},o.BESSELY=function(_,_e){},o.BIN2DEC=function(_){if(!s(_))return error.num;var _e=parseInt(_,2),et=_.toString();return et.length===10&&et.substring(0,1)==="1"?parseInt(et.substring(1),2)-512:_e},o.BIN2HEX=function(_,_e){if(!s(_))return error.num;var et=_.toString();if(et.length===10&&et.substring(0,1)==="1")return(0xfffffffe00+parseInt(et.substring(1),2)).toString(16);var it=parseInt(_,2).toString(16);return _e===void 0?it:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=it.length?REPT("0",_e-it.length)+it:error.num)},o.BIN2OCT=function(_,_e){if(!s(_))return error.num;var et=_.toString();if(et.length===10&&et.substring(0,1)==="1")return(1073741312+parseInt(et.substring(1),2)).toString(8);var it=parseInt(_,2).toString(8);return _e===void 0?it:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=it.length?REPT("0",_e-it.length)+it:error.num)},o.BITAND=function(_,_e){return _=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e)?error.value:_<0||_e<0||Math.floor(_)!==_||Math.floor(_e)!==_e||_>0xffffffffffff||_e>0xffffffffffff?error.num:_&_e},o.BITLSHIFT=function(_,_e){return _=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e)?error.value:_<0||Math.floor(_)!==_||_>0xffffffffffff||Math.abs(_e)>53?error.num:_e>=0?_<<_e:_>>-_e},o.BITOR=function(_,_e){return _=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e)?error.value:_<0||_e<0||Math.floor(_)!==_||Math.floor(_e)!==_e||_>0xffffffffffff||_e>0xffffffffffff?error.num:_|_e},o.BITRSHIFT=function(_,_e){return _=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e)?error.value:_<0||Math.floor(_)!==_||_>0xffffffffffff||Math.abs(_e)>53?error.num:_e>=0?_>>_e:_<<-_e},o.BITXOR=function(_,_e){return _=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e)?error.value:_<0||_e<0||Math.floor(_)!==_||Math.floor(_e)!==_e||_>0xffffffffffff||_e>0xffffffffffff?error.num:_^_e},o.COMPLEX=function(_,_e,et){if(_=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e))return _;if(et=et===void 0?"i":et,et!=="i"&&et!=="j")return error.value;if(_===0&&_e===0)return 0;if(_===0)return _e===1?et:_e.toString()+et;if(_e===0)return _.toString();var it=_e>0?"+":"";return _.toString()+it+(_e===1?et:_e.toString()+et)},o.CONVERT=function(_,_e,et){if(_=utils.parseNumber(_),_ instanceof Error)return _;for(var it=[["a.u. of action","?",null,"action",!1,!1,105457168181818e-48],["a.u. of charge","e",null,"electric_charge",!1,!1,160217653141414e-33],["a.u. of energy","Eh",null,"energy",!1,!1,435974417757576e-32],["a.u. of length","a?",null,"length",!1,!1,529177210818182e-25],["a.u. of mass","m?",null,"mass",!1,!1,910938261616162e-45],["a.u. of time","?/Eh",null,"time",!1,!1,241888432650516e-31],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["\xE5ngstr\xF6m","\xC5",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,149597870691667e-25],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic \xE5ngstr\xF6m","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,846786664623715e-61],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,416818182544058e-5],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,758660370370369e-22],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,166053886282828e-41],["day","d",["day"],"time",!1,!0,86400],["degree","\xB0",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519538e-3],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,105457168181818e-48],["n.u. of mass","m?",null,"mass",!1,!1,910938261616162e-45],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,128808866778687e-35],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["\u0153rsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","\u03A9",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdest\xE4rke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square \xE5ngstr\xF6m","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,895054210748189e17],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988110336e-6],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],tt={Yi:["yobi",80,12089258196146292e8,"Yi","yotta"],Zi:["zebi",70,11805916207174113e5,"Zi","zetta"],Ei:["exbi",60,1152921504606847e3,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},rt={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},nt=null,ot=null,st=_e,at=et,lt=1,ct=1,ht,mt=0;mt<it.length;mt++)ht=it[mt][2]===null?[]:it[mt][2],(it[mt][1]===st||ht.indexOf(st)>=0)&&(nt=it[mt]),(it[mt][1]===at||ht.indexOf(at)>=0)&&(ot=it[mt]);if(nt===null){var dt=tt[_e.substring(0,2)],ft=rt[_e.substring(0,1)];_e.substring(0,2)==="da"&&(ft=["dekao",10,"da"]),dt?(lt=dt[2],st=_e.substring(2)):ft&&(lt=ft[1],st=_e.substring(ft[2].length));for(var ut=0;ut<it.length;ut++)ht=it[ut][2]===null?[]:it[ut][2],(it[ut][1]===st||ht.indexOf(st)>=0)&&(nt=it[ut])}if(ot===null){var pt=tt[et.substring(0,2)],At=rt[et.substring(0,1)];et.substring(0,2)==="da"&&(At=["dekao",10,"da"]),pt?(ct=pt[2],at=et.substring(2)):At&&(ct=At[1],at=et.substring(At[2].length));for(var gt=0;gt<it.length;gt++)ht=it[gt][2]===null?[]:it[gt][2],(it[gt][1]===at||ht.indexOf(at)>=0)&&(ot=it[gt])}return nt===null||ot===null||nt[3]!==ot[3]?error.na:_*nt[6]*lt/(ot[6]*ct)},o.DEC2BIN=function(_,_e){if(_=utils.parseNumber(_),_ instanceof Error)return _;if(!/^-?[0-9]{1,3}$/.test(_)||_<-512||_>511)return error.num;if(_<0)return"1"+REPT("0",9-(512+_).toString(2).length)+(512+_).toString(2);var et=parseInt(_,10).toString(2);return typeof _e=="undefined"?et:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=et.length?REPT("0",_e-et.length)+et:error.num)},o.DEC2HEX=function(_,_e){if(_=utils.parseNumber(_),_ instanceof Error)return _;if(!/^-?[0-9]{1,12}$/.test(_)||_<-549755813888||_>549755813887)return error.num;if(_<0)return(1099511627776+_).toString(16);var et=parseInt(_,10).toString(16);return typeof _e=="undefined"?et:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=et.length?REPT("0",_e-et.length)+et:error.num)},o.DEC2OCT=function(_,_e){if(_=utils.parseNumber(_),_ instanceof Error)return _;if(!/^-?[0-9]{1,9}$/.test(_)||_<-536870912||_>536870911)return error.num;if(_<0)return(1073741824+_).toString(8);var et=parseInt(_,10).toString(8);return typeof _e=="undefined"?et:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=et.length?REPT("0",_e-et.length)+et:error.num)},o.DELTA=function(_,_e){return _e=_e===void 0?0:_e,_=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e)?error.value:_===_e?1:0},o.ERF=function(_,_e){},o.ERF.PRECISE=function(){},o.ERFC=function(_){},o.ERFC.PRECISE=function(){},o.GESTEP=function(_,_e){return _e=_e||0,_=utils.parseNumber(_),utils.anyIsError(_e,_)?_:_>=_e?1:0},o.HEX2BIN=function(_,_e){if(!/^[0-9A-Fa-f]{1,10}$/.test(_))return error.num;var et=_.length===10&&_.substring(0,1).toLowerCase()==="f",it=et?parseInt(_,16)-1099511627776:parseInt(_,16);if(it<-512||it>511)return error.num;if(et)return"1"+REPT("0",9-(512+it).toString(2).length)+(512+it).toString(2);var tt=it.toString(2);return _e===void 0?tt:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=tt.length?REPT("0",_e-tt.length)+tt:error.num)},o.HEX2DEC=function(_){if(!/^[0-9A-Fa-f]{1,10}$/.test(_))return error.num;var _e=parseInt(_,16);return _e>=549755813888?_e-1099511627776:_e},o.HEX2OCT=function(_,_e){if(!/^[0-9A-Fa-f]{1,10}$/.test(_))return error.num;var et=parseInt(_,16);if(et>536870911&&et<0xffe0000000)return error.num;if(et>=0xffe0000000)return(et-0xffc0000000).toString(8);var it=et.toString(8);return _e===void 0?it:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=it.length?REPT("0",_e-it.length)+it:error.num)},o.IMABS=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);return utils.anyIsError(_e,et)?error.value:Math.sqrt(Math.pow(_e,2)+Math.pow(et,2))},o.IMAGINARY=function(_){if(_===void 0||_===!0||_===!1)return error.value;if(_===0||_==="0")return 0;if(["i","j"].indexOf(_)>=0)return 1;_=_.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var _e=_.indexOf("+"),et=_.indexOf("-");_e===0&&(_e=_.indexOf("+",1)),et===0&&(et=_.indexOf("-",1));var it=_.substring(_.length-1,_.length),tt=it==="i"||it==="j";return _e>=0||et>=0?tt?_e>=0?isNaN(_.substring(0,_e))||isNaN(_.substring(_e+1,_.length-1))?error.num:Number(_.substring(_e+1,_.length-1)):isNaN(_.substring(0,et))||isNaN(_.substring(et+1,_.length-1))?error.num:-Number(_.substring(et+1,_.length-1)):error.num:tt?isNaN(_.substring(0,_.length-1))?error.num:_.substring(0,_.length-1):isNaN(_)?error.num:0},o.IMARGUMENT=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);return utils.anyIsError(_e,et)?error.value:_e===0&&et===0?error.div0:_e===0&&et>0?Math.PI/2:_e===0&&et<0?-Math.PI/2:et===0&&_e>0?0:et===0&&_e<0?-Math.PI:_e>0?Math.atan(et/_e):_e<0&&et>=0?Math.atan(et/_e)+Math.PI:Math.atan(et/_e)-Math.PI},o.IMCONJUGATE=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);return it=it==="i"||it==="j"?it:"i",et!==0?o.COMPLEX(_e,-et,it):_},o.IMCOS=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);return it=it==="i"||it==="j"?it:"i",o.COMPLEX(Math.cos(_e)*(Math.exp(et)+Math.exp(-et))/2,-Math.sin(_e)*(Math.exp(et)-Math.exp(-et))/2,it)},o.IMCOSH=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);return it=it==="i"||it==="j"?it:"i",o.COMPLEX(Math.cos(et)*(Math.exp(_e)+Math.exp(-_e))/2,Math.sin(et)*(Math.exp(_e)-Math.exp(-_e))/2,it)},o.IMCOT=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);return utils.anyIsError(_e,et)?error.value:o.IMDIV(o.IMCOS(_),o.IMSIN(_))},o.IMDIV=function(_,_e){var et=o.IMREAL(_),it=o.IMAGINARY(_),tt=o.IMREAL(_e),rt=o.IMAGINARY(_e);if(utils.anyIsError(et,it,tt,rt))return error.value;var nt=_.substring(_.length-1),ot=_e.substring(_e.length-1),st="i";if((nt==="j"||ot==="j")&&(st="j"),tt===0&&rt===0)return error.num;var at=tt*tt+rt*rt;return o.COMPLEX((et*tt+it*rt)/at,(it*tt-et*rt)/at,st)},o.IMEXP=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);it=it==="i"||it==="j"?it:"i";var tt=Math.exp(_e);return o.COMPLEX(tt*Math.cos(et),tt*Math.sin(et),it)},o.IMLN=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);return it=it==="i"||it==="j"?it:"i",o.COMPLEX(Math.log(Math.sqrt(_e*_e+et*et)),Math.atan(et/_e),it)},o.IMLOG10=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);return it=it==="i"||it==="j"?it:"i",o.COMPLEX(Math.log(Math.sqrt(_e*_e+et*et))/Math.log(10),Math.atan(et/_e)/Math.log(10),it)},o.IMLOG2=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);return it=it==="i"||it==="j"?it:"i",o.COMPLEX(Math.log(Math.sqrt(_e*_e+et*et))/Math.log(2),Math.atan(et/_e)/Math.log(2),it)},o.IMPOWER=function(_,_e){_e=utils.parseNumber(_e);var et=o.IMREAL(_),it=o.IMAGINARY(_);if(utils.anyIsError(_e,et,it))return error.value;var tt=_.substring(_.length-1);tt=tt==="i"||tt==="j"?tt:"i";var rt=Math.pow(o.IMABS(_),_e),nt=o.IMARGUMENT(_);return o.COMPLEX(rt*Math.cos(_e*nt),rt*Math.sin(_e*nt),tt)},o.IMPRODUCT=function(){for(var _=arguments[0],_e=1;_e<arguments.length;_e++){var et=o.IMREAL(_),it=o.IMAGINARY(_),tt=o.IMREAL(arguments[_e]),rt=o.IMAGINARY(arguments[_e]);if(utils.anyIsError(et,it,tt,rt))return error.value;_=o.COMPLEX(et*tt-it*rt,et*rt+it*tt)}return _},o.IMREAL=function(_){if(_===void 0||_===!0||_===!1)return error.value;if(_===0||_==="0"||["i","+i","1i","+1i","-i","-1i","j","+j","1j","+1j","-j","-1j"].indexOf(_)>=0)return 0;var _e=_.indexOf("+"),et=_.indexOf("-");_e===0&&(_e=_.indexOf("+",1)),et===0&&(et=_.indexOf("-",1));var it=_.substring(_.length-1,_.length),tt=it==="i"||it==="j";return _e>=0||et>=0?tt?_e>=0?isNaN(_.substring(0,_e))||isNaN(_.substring(_e+1,_.length-1))?error.num:Number(_.substring(0,_e)):isNaN(_.substring(0,et))||isNaN(_.substring(et+1,_.length-1))?error.num:Number(_.substring(0,et)):error.num:tt?isNaN(_.substring(0,_.length-1))?error.num:0:isNaN(_)?error.num:_},o.IMSEC=function(_){if(_===!0||_===!1)return error.value;var _e=o.IMREAL(_),et=o.IMAGINARY(_);return utils.anyIsError(_e,et)?error.value:o.IMDIV("1",o.IMCOS(_))},o.IMSECH=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);return utils.anyIsError(_e,et)?error.value:o.IMDIV("1",o.IMCOSH(_))},o.IMSIN=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);return it=it==="i"||it==="j"?it:"i",o.COMPLEX(Math.sin(_e)*(Math.exp(et)+Math.exp(-et))/2,Math.cos(_e)*(Math.exp(et)-Math.exp(-et))/2,it)},o.IMSINH=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);return it=it==="i"||it==="j"?it:"i",o.COMPLEX(Math.cos(et)*(Math.exp(_e)-Math.exp(-_e))/2,Math.sin(et)*(Math.exp(_e)+Math.exp(-_e))/2,it)},o.IMSQRT=function(_){var _e=o.IMREAL(_),et=o.IMAGINARY(_);if(utils.anyIsError(_e,et))return error.value;var it=_.substring(_.length-1);it=it==="i"||it==="j"?it:"i";var tt=Math.sqrt(o.IMABS(_)),rt=o.IMARGUMENT(_);return o.COMPLEX(tt*Math.cos(rt/2),tt*Math.sin(rt/2),it)},o.IMCSC=function(_){if(_===!0||_===!1)return error.value;var _e=o.IMREAL(_),et=o.IMAGINARY(_);return utils.anyIsError(_e,et)?error.num:o.IMDIV("1",o.IMSIN(_))},o.IMCSCH=function(_){if(_===!0||_===!1)return error.value;var _e=o.IMREAL(_),et=o.IMAGINARY(_);return utils.anyIsError(_e,et)?error.num:o.IMDIV("1",o.IMSINH(_))},o.IMSUB=function(_,_e){var et=this.IMREAL(_),it=this.IMAGINARY(_),tt=this.IMREAL(_e),rt=this.IMAGINARY(_e);if(utils.anyIsError(et,it,tt,rt))return error.value;var nt=_.substring(_.length-1),ot=_e.substring(_e.length-1),st="i";return(nt==="j"||ot==="j")&&(st="j"),this.COMPLEX(et-tt,it-rt,st)},o.IMSUM=function(){for(var _=utils.flatten(arguments),_e=_[0],et=1;et<_.length;et++){var it=this.IMREAL(_e),tt=this.IMAGINARY(_e),rt=this.IMREAL(_[et]),nt=this.IMAGINARY(_[et]);if(utils.anyIsError(it,tt,rt,nt))return error.value;_e=this.COMPLEX(it+rt,tt+nt)}return _e},o.IMTAN=function(_){if(_===!0||_===!1)return error.value;var _e=o.IMREAL(_),et=o.IMAGINARY(_);return utils.anyIsError(_e,et)?error.value:this.IMDIV(this.IMSIN(_),this.IMCOS(_))},o.OCT2BIN=function(_,_e){if(!/^[0-7]{1,10}$/.test(_))return error.num;var et=_.length===10&&_.substring(0,1)==="7",it=et?parseInt(_,8)-1073741824:parseInt(_,8);if(it<-512||it>511)return error.num;if(et)return"1"+REPT("0",9-(512+it).toString(2).length)+(512+it).toString(2);var tt=it.toString(2);return typeof _e=="undefined"?tt:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=tt.length?REPT("0",_e-tt.length)+tt:error.num)},o.OCT2DEC=function(_){if(!/^[0-7]{1,10}$/.test(_))return error.num;var _e=parseInt(_,8);return _e>=536870912?_e-1073741824:_e},o.OCT2HEX=function(_,_e){if(!/^[0-7]{1,10}$/.test(_))return error.num;var et=parseInt(_,8);if(et>=536870912)return"ff"+(et+3221225472).toString(16);var it=et.toString(16);return _e===void 0?it:isNaN(_e)?error.value:_e<0?error.num:(_e=Math.floor(_e),_e>=it.length?REPT("0",_e-it.length)+it:error.num)},o}(),met.financial=function(){var o={};function s(_e){return _e&&_e.getTime&&!isNaN(_e.getTime())}function _(_e){return _e instanceof Date?_e:new Date(_e)}return o.ACCRINT=function(_e,et,it,tt,rt,nt,ot){return _e=_(_e),et=_(et),it=_(it),!s(_e)||!s(et)||!s(it)?"#VALUE!":tt<=0||rt<=0||[1,2,4].indexOf(nt)===-1||[0,1,2,3,4].indexOf(ot)===-1||it<=_e?"#NUM!":(rt=rt||0,ot=ot||0,rt*tt*YEARFRAC(_e,it,ot))},o.ACCRINTM=null,o.AMORDEGRC=null,o.AMORLINC=null,o.COUPDAYBS=null,o.COUPDAYS=null,o.COUPDAYSNC=null,o.COUPNCD=null,o.COUPNUM=null,o.COUPPCD=null,o.CUMIPMT=function(_e,et,it,tt,rt,nt){if(_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it))return error.value;if(_e<=0||et<=0||it<=0||tt<1||rt<1||tt>rt||nt!==0&&nt!==1)return error.num;var ot=o.PMT(_e,et,it,0,nt),st=0;tt===1&&nt===0&&(st=-it,tt++);for(var at=tt;at<=rt;at++)nt===1?st+=o.FV(_e,at-2,ot,it,1)-ot:st+=o.FV(_e,at-1,ot,it,0);return st*=_e,st},o.CUMPRINC=function(_e,et,it,tt,rt,nt){if(_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it))return error.value;if(_e<=0||et<=0||it<=0||tt<1||rt<1||tt>rt||nt!==0&&nt!==1)return error.num;var ot=o.PMT(_e,et,it,0,nt),st=0;tt===1&&(nt===0?st=ot+it*_e:st=ot,tt++);for(var at=tt;at<=rt;at++)nt>0?st+=ot-(o.FV(_e,at-2,ot,it,1)-ot)*_e:st+=ot-o.FV(_e,at-1,ot,it,0)*_e;return st},o.DB=function(_e,et,it,tt,rt){if(rt=rt===void 0?12:rt,_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),utils.anyIsError(_e,et,it,tt,rt))return error.value;if(_e<0||et<0||it<0||tt<0||[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(rt)===-1||tt>it)return error.num;if(et>=_e)return 0;for(var nt=(1-Math.pow(et/_e,1/it)).toFixed(3),ot=_e*nt*rt/12,st=ot,at=0,lt=tt===it?it-1:tt,ct=2;ct<=lt;ct++)at=(_e-st)*nt,st+=at;return tt===1?ot:tt===it?(_e-st)*nt:at},o.DDB=function(_e,et,it,tt,rt){if(rt=rt===void 0?2:rt,_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),utils.anyIsError(_e,et,it,tt,rt))return error.value;if(_e<0||et<0||it<0||tt<0||rt<=0||tt>it)return error.num;if(et>=_e)return 0;for(var nt=0,ot=0,st=1;st<=tt;st++)ot=Math.min((_e-nt)*(rt/it),_e-et-nt),nt+=ot;return ot},o.DISC=null,o.DOLLARDE=function(_e,et){if(_e=utils.parseNumber(_e),et=utils.parseNumber(et),utils.anyIsError(_e,et))return error.value;if(et<0)return error.num;if(et>=0&&et<1)return error.div0;et=parseInt(et,10);var it=parseInt(_e,10);it+=_e%1*Math.pow(10,Math.ceil(Math.log(et)/Math.LN10))/et;var tt=Math.pow(10,Math.ceil(Math.log(et)/Math.LN2)+1);return it=Math.round(it*tt)/tt,it},o.DOLLARFR=function(_e,et){if(_e=utils.parseNumber(_e),et=utils.parseNumber(et),utils.anyIsError(_e,et))return error.value;if(et<0)return error.num;if(et>=0&&et<1)return error.div0;et=parseInt(et,10);var it=parseInt(_e,10);return it+=_e%1*Math.pow(10,-Math.ceil(Math.log(et)/Math.LN10))*et,it},o.DURATION=null,o.EFFECT=function(_e,et){return _e=utils.parseNumber(_e),et=utils.parseNumber(et),utils.anyIsError(_e,et)?error.value:_e<=0||et<1?error.num:(et=parseInt(et,10),Math.pow(1+_e/et,et)-1)},o.FV=function(_e,et,it,tt,rt){if(tt=tt||0,rt=rt||0,_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),utils.anyIsError(_e,et,it,tt,rt))return error.value;var nt;if(_e===0)nt=tt+it*et;else{var ot=Math.pow(1+_e,et);rt===1?nt=tt*ot+it*(1+_e)*(ot-1)/_e:nt=tt*ot+it*(ot-1)/_e}return-nt},o.FVSCHEDULE=function(_e,et){if(_e=utils.parseNumber(_e),et=utils.parseNumberArray(utils.flatten(et)),utils.anyIsError(_e,et))return error.value;for(var it=et.length,tt=_e,rt=0;rt<it;rt++)tt*=1+et[rt];return tt},o.INTRATE=null,o.IPMT=function(_e,et,it,tt,rt,nt){if(rt=rt||0,nt=nt||0,_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),nt=utils.parseNumber(nt),utils.anyIsError(_e,et,it,tt,rt,nt))return error.value;var ot=o.PMT(_e,it,tt,rt,nt),st;return et===1?nt===1?st=0:st=-tt:nt===1?st=o.FV(_e,et-2,ot,tt,1)-ot:st=o.FV(_e,et-1,ot,tt,0),st*_e},o.IRR=function(_e,et){if(et=et||0,_e=utils.parseNumberArray(utils.flatten(_e)),et=utils.parseNumber(et),utils.anyIsError(_e,et))return error.value;for(var it=function(ft,ut,pt){for(var At=pt+1,gt=ft[0],vt=1;vt<ft.length;vt++)gt+=ft[vt]/Math.pow(At,(ut[vt]-ut[0])/365);return gt},tt=function(ft,ut,pt){for(var At=pt+1,gt=0,vt=1;vt<ft.length;vt++){var yt=(ut[vt]-ut[0])/365;gt-=yt*ft[vt]/Math.pow(At,yt+1)}return gt},rt=[],nt=!1,ot=!1,st=0;st<_e.length;st++)rt[st]=st===0?0:rt[st-1]+365,_e[st]>0&&(nt=!0),_e[st]<0&&(ot=!0);if(!nt||!ot)return error.num;et=et===void 0?.1:et;var at=et,lt=1e-10,ct,ht,mt,dt=!0;do mt=it(_e,rt,at),ct=at-mt/tt(_e,rt,at),ht=Math.abs(ct-at),at=ct,dt=ht>lt&&Math.abs(mt)>lt;while(dt);return at},o.ISPMT=function(_e,et,it,tt){return _e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),utils.anyIsError(_e,et,it,tt)?error.value:tt*_e*(et/it-1)},o.MDURATION=null,o.MIRR=function(_e,et,it){if(_e=utils.parseNumberArray(utils.flatten(_e)),et=utils.parseNumber(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it))return error.value;for(var tt=_e.length,rt=[],nt=[],ot=0;ot<tt;ot++)_e[ot]<0?rt.push(_e[ot]):nt.push(_e[ot]);var st=-o.NPV(it,nt)*Math.pow(1+it,tt-1),at=o.NPV(et,rt)*(1+et);return Math.pow(st/at,1/(tt-1))-1},o.NOMINAL=function(_e,et){return _e=utils.parseNumber(_e),et=utils.parseNumber(et),utils.anyIsError(_e,et)?error.value:_e<=0||et<1?error.num:(et=parseInt(et,10),(Math.pow(_e+1,1/et)-1)*et)},o.NPER=function(_e,et,it,tt,rt){if(rt=rt===void 0?0:rt,tt=tt===void 0?0:tt,_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),utils.anyIsError(_e,et,it,tt,rt))return error.value;var nt=et*(1+_e*rt)-tt*_e,ot=it*_e+et*(1+_e*rt);return Math.log(nt/ot)/Math.log(1+_e)},o.NPV=function(){var _e=utils.parseNumberArray(utils.flatten(arguments));if(_e instanceof Error)return _e;for(var et=_e[0],it=0,tt=1;tt<_e.length;tt++)it+=_e[tt]/Math.pow(1+et,tt);return it},o.ODDFPRICE=null,o.ODDFYIELD=null,o.ODDLPRICE=null,o.ODDLYIELD=null,o.PDURATION=function(_e,et,it){return _e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it)?error.value:_e<=0?error.num:(Math.log(it)-Math.log(et))/Math.log(1+_e)},o.PMT=function(_e,et,it,tt,rt){if(tt=tt||0,rt=rt||0,_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),utils.anyIsError(_e,et,it,tt,rt))return error.value;var nt;if(_e===0)nt=(it+tt)/et;else{var ot=Math.pow(1+_e,et);rt===1?nt=(tt*_e/(ot-1)+it*_e/(1-1/ot))/(1+_e):nt=tt*_e/(ot-1)+it*_e/(1-1/ot)}return-nt},o.PPMT=function(_e,et,it,tt,rt,nt){return rt=rt||0,nt=nt||0,_e=utils.parseNumber(_e),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),nt=utils.parseNumber(nt),utils.anyIsError(_e,it,tt,rt,nt)?error.value:o.PMT(_e,it,tt,rt,nt)-o.IPMT(_e,et,it,tt,rt,nt)},o.PRICE=null,o.PRICEDISC=null,o.PRICEMAT=null,o.PV=function(_e,et,it,tt,rt){return tt=tt||0,rt=rt||0,_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),utils.anyIsError(_e,et,it,tt,rt)?error.value:_e===0?-it*et-tt:((1-Math.pow(1+_e,et))/_e*it*(1+_e*rt)-tt)/Math.pow(1+_e,et)},o.RATE=function(_e,et,it,tt,rt,nt){if(nt=nt===void 0?.01:nt,tt=tt===void 0?0:tt,rt=rt===void 0?0:rt,_e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),rt=utils.parseNumber(rt),nt=utils.parseNumber(nt),utils.anyIsError(_e,et,it,tt,rt,nt))return error.value;for(var ot=1e-6,st=100,at=0,lt=!1,ct=nt;at<st&&!lt;){var ht=Math.pow(ct+1,_e),mt=Math.pow(ct+1,_e-1),dt=tt+ht*it+et*(ht-1)*(ct*rt+1)/ct,ft=_e*mt*it-et*(ht-1)*(ct*rt+1)/Math.pow(ct,2),ut=_e*et*mt*(ct*rt+1)/ct+et*(ht-1)*rt/ct,pt=ct-dt/(ft+ut);Math.abs(pt-ct)<ot&&(lt=!0),at++,ct=pt}return lt?ct:Number.NaN+ct},o.RECEIVED=null,o.RRI=function(_e,et,it){return _e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it)?error.value:_e===0||et===0?error.num:Math.pow(it/et,1/_e)-1},o.SLN=function(_e,et,it){return _e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it)?error.value:it===0?error.num:(_e-et)/it},o.SYD=function(_e,et,it,tt){return _e=utils.parseNumber(_e),et=utils.parseNumber(et),it=utils.parseNumber(it),tt=utils.parseNumber(tt),utils.anyIsError(_e,et,it,tt)?error.value:it===0||tt<1||tt>it?error.num:(tt=parseInt(tt,10),(_e-et)*(it-tt+1)*2/(it*(it+1)))},o.TBILLEQ=function(_e,et,it){return _e=utils.parseDate(_e),et=utils.parseDate(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it)?error.value:it<=0||_e>et||et-_e>31536e6?error.num:365*it/(360-it*DAYS360(_e,et,!1))},o.TBILLPRICE=function(_e,et,it){return _e=utils.parseDate(_e),et=utils.parseDate(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it)?error.value:it<=0||_e>et||et-_e>31536e6?error.num:100*(1-it*DAYS360(_e,et,!1)/360)},o.TBILLYIELD=function(_e,et,it){return _e=utils.parseDate(_e),et=utils.parseDate(et),it=utils.parseNumber(it),utils.anyIsError(_e,et,it)?error.value:it<=0||_e>et||et-_e>31536e6?error.num:(100-it)*360/(it*DAYS360(_e,et,!1))},o.VDB=null,o.XIRR=function(_e,et,it){if(_e=utils.parseNumberArray(utils.flatten(_e)),et=utils.parseDateArray(utils.flatten(et)),it=utils.parseNumber(it),utils.anyIsError(_e,et,it))return error.value;for(var tt=function(ft,ut,pt){for(var At=pt+1,gt=ft[0],vt=1;vt<ft.length;vt++)gt+=ft[vt]/Math.pow(At,DAYS(ut[vt],ut[0])/365);return gt},rt=function(ft,ut,pt){for(var At=pt+1,gt=0,vt=1;vt<ft.length;vt++){var yt=DAYS(ut[vt],ut[0])/365;gt-=yt*ft[vt]/Math.pow(At,yt+1)}return gt},nt=!1,ot=!1,st=0;st<_e.length;st++)_e[st]>0&&(nt=!0),_e[st]<0&&(ot=!0);if(!nt||!ot)return error.num;it=it||.1;var at=it,lt=1e-10,ct,ht,mt,dt=!0;do mt=tt(_e,et,at),ct=at-mt/rt(_e,et,at),ht=Math.abs(ct-at),at=ct,dt=ht>lt&&Math.abs(mt)>lt;while(dt);return at},o.XNPV=function(_e,et,it){if(_e=utils.parseNumber(_e),et=utils.parseNumberArray(utils.flatten(et)),it=utils.parseDateArray(utils.flatten(it)),utils.anyIsError(_e,et,it))return error.value;for(var tt=0,rt=0;rt<et.length;rt++)tt+=et[rt]/Math.pow(1+_e,DAYS(it[rt],it[0])/365);return tt},o.YIELD=null,o.YIELDDISC=null,o.YIELDMAT=null,o}(),met.information=function(){var o={};return o.CELL=null,o.ERROR={},o.ERROR.TYPE=function(s){switch(s){case error.nil:return 1;case error.div0:return 2;case error.value:return 3;case error.ref:return 4;case error.name:return 5;case error.num:return 6;case error.na:return 7;case error.data:return 8}return error.na},o.INFO=null,o.ISBLANK=function(s){return s===null},o.ISBINARY=function(s){return/^[01]{1,10}$/.test(s)},o.ISERR=function(s){return[error.value,error.ref,error.div0,error.num,error.name,error.nil].indexOf(s)>=0||typeof s=="number"&&(isNaN(s)||!isFinite(s))},o.ISERROR=function(s){return o.ISERR(s)||s===error.na},o.ISEVEN=function(s){return!(Math.floor(Math.abs(s))&1)},o.ISFORMULA=null,o.ISLOGICAL=function(s){return s===!0||s===!1},o.ISNA=function(s){return s===error.na},o.ISNONTEXT=function(s){return typeof s!="string"},o.ISNUMBER=function(s){return typeof s=="number"&&!isNaN(s)&&isFinite(s)},o.ISODD=function(s){return!!(Math.floor(Math.abs(s))&1)},o.ISREF=null,o.ISTEXT=function(s){return typeof s=="string"},o.N=function(s){return this.ISNUMBER(s)?s:s instanceof Date?s.getTime():s===!0?1:s===!1?0:this.ISERROR(s)?s:0},o.NA=function(){return error.na},o.SHEET=null,o.SHEETS=null,o.TYPE=function(s){if(this.ISNUMBER(s))return 1;if(this.ISTEXT(s))return 2;if(this.ISLOGICAL(s))return 4;if(this.ISERROR(s))return 16;if(Array.isArray(s))return 64},o}(),met.logical=function(){var o={};return o.AND=function(){for(var s=utils.flatten(arguments),_=!0,_e=0;_e<s.length;_e++)s[_e]||(_=!1);return _},o.CHOOSE=function(){if(arguments.length<2)return error.na;var s=arguments[0];return s<1||s>254||arguments.length<s+1?error.value:arguments[s]},o.FALSE=function(){return!1},o.IF=function(s,_,_e){return s?_:_e},o.IFERROR=function(s,_){return ISERROR(s)?_:s},o.IFNA=function(s,_){return s===error.na?_:s},o.NOT=function(s){return!s},o.OR=function(){for(var s=utils.flatten(arguments),_=!1,_e=0;_e<s.length;_e++)s[_e]&&(_=!0);return _},o.TRUE=function(){return!0},o.XOR=function(){for(var s=utils.flatten(arguments),_=0,_e=0;_e<s.length;_e++)s[_e]&&_++;return!!(Math.floor(Math.abs(_))&1)},o.SWITCH=function(){var s;if(arguments.length>0){var _=arguments[0],_e=arguments.length-1,et=Math.floor(_e/2),it=!1,tt=_e%2===0?null:arguments[arguments.length-1];if(et){for(var rt=0;rt<et;rt++)if(_===arguments[rt*2+1]){s=arguments[rt*2+2],it=!0;break}}!it&&tt&&(s=tt)}return s},o}(),met.math=function(){var exports={};exports.ABS=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.abs(utils.parseNumber(o))},exports.ACOS=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.acos(o)},exports.ACOSH=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.log(o+Math.sqrt(o*o-1))},exports.ACOT=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.atan(1/o)},exports.ACOTH=function(o){return o=utils.parseNumber(o),o instanceof Error?o:.5*Math.log((o+1)/(o-1))},exports.AGGREGATE=null,exports.ARABIC=function(o){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(o))return error.value;var s=0;return o.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(_){s+={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[_]}),s},exports.ASIN=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.asin(o)},exports.ASINH=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.log(o+Math.sqrt(o*o+1))},exports.ATAN=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.atan(o)},exports.ATAN2=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:Math.atan2(o,s)},exports.ATANH=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.log((1+o)/(1-o))/2},exports.BASE=function(o,s,_){if(_=_||0,o=utils.parseNumber(o),s=utils.parseNumber(s),_=utils.parseNumber(_),utils.anyIsError(o,s,_))return error.value;_=_===void 0?0:_;var _e=o.toString(s);return new Array(Math.max(_+1-_e.length,0)).join("0")+_e},exports.CEILING=function(o,s,_){return s=s===void 0?1:s,_=_===void 0?0:_,o=utils.parseNumber(o),s=utils.parseNumber(s),_=utils.parseNumber(_),utils.anyIsError(o,s,_)?error.value:s===0?0:(s=Math.abs(s),o>=0?Math.ceil(o/s)*s:_===0?-1*Math.floor(Math.abs(o)/s)*s:-1*Math.ceil(Math.abs(o)/s)*s)},exports.CEILING.MATH=exports.CEILING,exports.CEILING.PRECISE=exports.CEILING,exports.COMBIN=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:exports.FACT(o)/(exports.FACT(s)*exports.FACT(o-s))},exports.COMBINA=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:o===0&&s===0?1:exports.COMBIN(o+s-1,o-1)},exports.COS=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.cos(o)},exports.COSH=function(o){return o=utils.parseNumber(o),o instanceof Error?o:(Math.exp(o)+Math.exp(-o))/2},exports.COT=function(o){return o=utils.parseNumber(o),o instanceof Error?o:1/Math.tan(o)},exports.COTH=function(o){if(o=utils.parseNumber(o),o instanceof Error)return o;var s=Math.exp(2*o);return(s+1)/(s-1)},exports.CSC=function(o){return o=utils.parseNumber(o),o instanceof Error?o:1/Math.sin(o)},exports.CSCH=function(o){return o=utils.parseNumber(o),o instanceof Error?o:2/(Math.exp(o)-Math.exp(-o))},exports.DECIMAL=function(o,s){return arguments.length<1?error.value:parseInt(o,s)},exports.DEGREES=function(o){return o=utils.parseNumber(o),o instanceof Error?o:o*180/Math.PI},exports.EVEN=function(o){return o=utils.parseNumber(o),o instanceof Error?o:exports.CEILING(o,-2,-1)},exports.EXP=Math.exp;var MEMOIZED_FACT=[];return exports.FACT=function(o){if(o=utils.parseNumber(o),o instanceof Error)return o;var s=Math.floor(o);return s===0||s===1?1:(MEMOIZED_FACT[s]>0||(MEMOIZED_FACT[s]=exports.FACT(s-1)*s),MEMOIZED_FACT[s])},exports.FACTDOUBLE=function(o){if(o=utils.parseNumber(o),o instanceof Error)return o;var s=Math.floor(o);return s<=0?1:s*exports.FACTDOUBLE(s-2)},exports.FLOOR=function(o,s,_){return s=s===void 0?1:s,_=_===void 0?0:_,o=utils.parseNumber(o),s=utils.parseNumber(s),_=utils.parseNumber(_),utils.anyIsError(o,s,_)?error.value:s===0?0:(s=Math.abs(s),o>=0?Math.floor(o/s)*s:_===0?-1*Math.ceil(Math.abs(o)/s)*s:-1*Math.floor(Math.abs(o)/s)*s)},exports.FLOOR.MATH=exports.FLOOR,exports.GCD=null,exports.INT=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.floor(o)},exports.LCM=function(){var o=utils.parseNumberArray(utils.flatten(arguments));if(o instanceof Error)return o;for(var s,_,_e,et,it=1;(_e=o.pop())!==void 0;)for(;_e>1;){if(_e%2){for(s=3,_=Math.floor(Math.sqrt(_e));s<=_&&_e%s;s+=2);et=s<=_?s:_e}else et=2;for(_e/=et,it*=et,s=o.length;s;o[--s]%et===0&&(o[s]/=et)===1&&o.splice(s,1));}return it},exports.LN=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.log(o)},exports.LOG=function(o,s){return o=utils.parseNumber(o),s=s===void 0?10:utils.parseNumber(s),utils.anyIsError(o,s)?error.value:Math.log(o)/Math.log(s)},exports.LOG10=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.log(o)/Math.log(10)},exports.MDETERM=null,exports.MINVERSE=null,exports.MMULT=null,exports.MOD=function(o,s){if(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;if(s===0)return error.div0;var _=Math.abs(o%s);return s>0?_:-_},exports.MROUND=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:o*s<0?error.num:Math.round(o/s)*s},exports.MULTINOMIAL=function(){var o=utils.parseNumberArray(utils.flatten(arguments));if(o instanceof Error)return o;for(var s=0,_=1,_e=0;_e<o.length;_e++)s+=o[_e],_*=exports.FACT(o[_e]);return exports.FACT(s)/_},exports.MUNIT=null,exports.ODD=function(o){if(o=utils.parseNumber(o),o instanceof Error)return o;var s=Math.ceil(Math.abs(o));return s=s&1?s:s+1,o>0?s:-s},exports.PI=function(){return Math.PI},exports.POWER=function(o,s){if(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;var _=Math.pow(o,s);return isNaN(_)?error.num:_},exports.PRODUCT=function(){var o=utils.parseNumberArray(utils.flatten(arguments));if(o instanceof Error)return o;for(var s=1,_=0;_<o.length;_++)s*=o[_];return s},exports.QUOTIENT=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:parseInt(o/s,10)},exports.RADIANS=function(o){return o=utils.parseNumber(o),o instanceof Error?o:o*Math.PI/180},exports.RAND=function(){return Math.random()},exports.RANDBETWEEN=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:o+Math.ceil((s-o+1)*Math.random())-1},exports.ROMAN=null,exports.ROUND=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:Math.round(o*Math.pow(10,s))/Math.pow(10,s)},exports.ROUNDDOWN=function(o,s){if(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;var _=o>0?1:-1;return _*Math.floor(Math.abs(o)*Math.pow(10,s))/Math.pow(10,s)},exports.ROUNDUP=function(o,s){if(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;var _=o>0?1:-1;return _*Math.ceil(Math.abs(o)*Math.pow(10,s))/Math.pow(10,s)},exports.SEC=function(o){return o=utils.parseNumber(o),o instanceof Error?o:1/Math.cos(o)},exports.SECH=function(o){return o=utils.parseNumber(o),o instanceof Error?o:2/(Math.exp(o)+Math.exp(-o))},exports.SERIESSUM=function(o,s,_,_e){if(o=utils.parseNumber(o),s=utils.parseNumber(s),_=utils.parseNumber(_),_e=utils.parseNumberArray(_e),utils.anyIsError(o,s,_,_e))return error.value;for(var et=_e[0]*Math.pow(o,s),it=1;it<_e.length;it++)et+=_e[it]*Math.pow(o,s+it*_);return et},exports.SIGN=function(o){return o=utils.parseNumber(o),o instanceof Error?o:o<0?-1:o===0?0:1},exports.SIN=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.sin(o)},exports.SINH=function(o){return o=utils.parseNumber(o),o instanceof Error?o:(Math.exp(o)-Math.exp(-o))/2},exports.SQRT=function(o){return o=utils.parseNumber(o),o instanceof Error?o:o<0?error.num:Math.sqrt(o)},exports.SQRTPI=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.sqrt(o*Math.PI)},exports.SUBTOTAL=null,exports.ADD=function(o,s){return arguments.length!==2?error.na:(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:o+s)},exports.MINUS=function(o,s){return arguments.length!==2?error.na:(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:o-s)},exports.DIVIDE=function(o,s){return arguments.length!==2?error.na:(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:s===0?error.div0:o/s)},exports.MULTIPLY=function(o,s){return arguments.length!==2?error.na:(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:o*s)},exports.GTE=function(o,s){return arguments.length!==2?error.na:(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.error:o>=s)},exports.LT=function(o,s){return arguments.length!==2?error.na:(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.error:o<s)},exports.LTE=function(o,s){return arguments.length!==2?error.na:(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.error:o<=s)},exports.EQ=function(o,s){return arguments.length!==2?error.na:o===s},exports.NE=function(o,s){return arguments.length!==2?error.na:o!==s},exports.POW=function(o,s){return arguments.length!==2?error.na:(o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.error:exports.POWER(o,s))},exports.SUM=function(){for(var o=0,s=Object.keys(arguments),_=0;_<s.length;++_){var _e=arguments[s[_]];if(typeof _e=="number")o+=_e;else if(typeof _e=="string"){var et=parseFloat(_e);!isNaN(et)&&(o+=et)}else Array.isArray(_e)&&(o+=exports.SUM.apply(null,_e))}return o},exports.SUMIF=function(){var args=utils.argsToArray(arguments),criteria=args.pop(),range=utils.parseNumberArray(utils.flatten(args));if(range instanceof Error)return range;for(var result=0,i=0;i<range.length;i++)result+=eval(range[i]+criteria)?range[i]:0;return result},exports.SUMIFS=function(){var args=utils.argsToArray(arguments),range=utils.parseNumberArray(utils.flatten(args.shift()));if(range instanceof Error)return range;for(var criteria=args,n_range_elements=range.length,n_criterias=criteria.length,result=0,i=0;i<n_range_elements;i++){for(var el=range[i],condition="",c=0;c<n_criterias;c+=2)isNaN(criteria[c][i])?condition+='"'+criteria[c][i]+'"'+criteria[c+1]:condition+=criteria[c][i]+criteria[c+1],c!==n_criterias-1&&(condition+=" && ");condition=condition.slice(0,-4),eval(condition)&&(result+=el)}return result},exports.SUMPRODUCT=null,exports.SUMSQ=function(){var o=utils.parseNumberArray(utils.flatten(arguments));if(o instanceof Error)return o;for(var s=0,_=o.length,_e=0;_e<_;_e++)s+=ISNUMBER(o[_e])?o[_e]*o[_e]:0;return s},exports.SUMX2MY2=function(o,s){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumberArray(utils.flatten(s)),utils.anyIsError(o,s))return error.value;for(var _=0,_e=0;_e<o.length;_e++)_+=o[_e]*o[_e]-s[_e]*s[_e];return _},exports.SUMX2PY2=function(o,s){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumberArray(utils.flatten(s)),utils.anyIsError(o,s))return error.value;var _=0;o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumberArray(utils.flatten(s));for(var _e=0;_e<o.length;_e++)_+=o[_e]*o[_e]+s[_e]*s[_e];return _},exports.SUMXMY2=function(o,s){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumberArray(utils.flatten(s)),utils.anyIsError(o,s))return error.value;var _=0;o=utils.flatten(o),s=utils.flatten(s);for(var _e=0;_e<o.length;_e++)_+=Math.pow(o[_e]-s[_e],2);return _},exports.TAN=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.tan(o)},exports.TANH=function(o){if(o=utils.parseNumber(o),o instanceof Error)return o;var s=Math.exp(2*o);return(s-1)/(s+1)},exports.TRUNC=function(o,s){if(s=s===void 0?0:s,o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;var _=o>0?1:-1;return _*Math.floor(Math.abs(o)*Math.pow(10,s))/Math.pow(10,s)},exports}(),met.misc=function(){var o={};return o.UNIQUE=function(){for(var s=[],_=0;_<arguments.length;++_){for(var _e=!1,et=arguments[_],it=0;it<s.length&&(_e=s[it]===et,!_e);++it);_e||s.push(et)}return s},o.FLATTEN=utils.flatten,o.ARGS2ARRAY=function(){return Array.prototype.slice.call(arguments,0)},o.REFERENCE=function(s,_){try{for(var _e=_.split("."),et=s,it=0;it<_e.length;++it){var tt=_e[it];if(tt[tt.length-1]==="]"){var rt=tt.indexOf("["),nt=tt.substring(rt+1,tt.length-1);et=et[tt.substring(0,rt)][nt]}else et=et[tt]}return et}catch{}},o.JOIN=function(s,_){return s.join(_)},o.NUMBERS=function(){var s=utils.flatten(arguments);return s.filter(function(_){return typeof _=="number"})},o.NUMERAL=null,o}(),met.text=function(){var o={};return o.ASC=null,o.BAHTTEXT=null,o.CHAR=function(s){return s=utils.parseNumber(s),s instanceof Error?s:String.fromCharCode(s)},o.CLEAN=function(s){s=s||"";var _=/[\0-\x1F]/g;return s.replace(_,"")},o.CODE=function(s){return s=s||"",s.charCodeAt(0)},o.CONCATENATE=function(){for(var s=utils.flatten(arguments),_=0;(_=s.indexOf(!0))>-1;)s[_]="TRUE";for(var _e=0;(_e=s.indexOf(!1))>-1;)s[_e]="FALSE";return s.join("")},o.DBCS=null,o.DOLLAR=null,o.EXACT=function(s,_){return s===_},o.FIND=function(s,_,_e){return _e=_e===void 0?0:_e,_?_.indexOf(s,_e-1)+1:null},o.FIXED=null,o.HTML2TEXT=function(s){var _="";return s&&(s instanceof Array?s.forEach(function(_e){_!==""&&(_+=`
`),_+=_e.replace(/<(?:.|\n)*?>/gm,"")}):_=s.replace(/<(?:.|\n)*?>/gm,"")),_},o.LEFT=function(s,_){return _=_===void 0?1:_,_=utils.parseNumber(_),_ instanceof Error||typeof s!="string"?error.value:s?s.substring(0,_):null},o.LEN=function(s){return arguments.length===0?error.error:typeof s=="string"?s?s.length:0:s.length?s.length:error.value},o.LOWER=function(s){return typeof s!="string"?error.value:s&&s.toLowerCase()},o.MID=function(s,_,_e){if(_=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e)||typeof s!="string")return _e;var et=_-1,it=et+_e;return s.substring(et,it)},o.NUMBERVALUE=null,o.PRONETIC=null,o.PROPER=function(s){return s===void 0||s.length===0||(s===!0&&(s="TRUE"),s===!1&&(s="FALSE"),isNaN(s)&&typeof s=="number")?error.value:(typeof s=="number"&&(s=""+s),s.replace(/\w\S*/g,function(_){return _.charAt(0).toUpperCase()+_.substr(1).toLowerCase()}))},o.REGEXEXTRACT=function(s,_){var _e=s.match(new RegExp(_));return _e?_e[_e.length>1?_e.length-1:0]:null},o.REGEXMATCH=function(s,_,_e){var et=s.match(new RegExp(_));return _e?et:!!et},o.REGEXREPLACE=function(s,_,_e){return s.replace(new RegExp(_),_e)},o.REPLACE=function(s,_,_e,et){return _=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(_,_e)||typeof s!="string"||typeof et!="string"?error.value:s.substr(0,_-1)+et+s.substr(_-1+_e)},o.REPT=function(s,_){return _=utils.parseNumber(_),_ instanceof Error?_:new Array(_+1).join(s)},o.RIGHT=function(s,_){return _=_===void 0?1:_,_=utils.parseNumber(_),_ instanceof Error?_:s?s.substring(s.length-_):null},o.SEARCH=function(s,_,_e){var et;return typeof s!="string"||typeof _!="string"?error.value:(_e=_e===void 0?0:_e,et=_.toLowerCase().indexOf(s.toLowerCase(),_e-1)+1,et===0?error.value:et)},o.SPLIT=function(s,_){return s.split(_)},o.SUBSTITUTE=function(s,_,_e,et){if(!s||!_||!_e)return s;if(et===void 0)return s.replace(new RegExp(_,"g"),_e);for(var it=0,tt=0;s.indexOf(_,it)>0;)if(it=s.indexOf(_,it+1),tt++,tt===et)return s.substring(0,it)+_e+s.substring(it+_.length)},o.T=function(s){return typeof s=="string"?s:""},o.TEXT=null,o.TRIM=function(s){return typeof s!="string"?error.value:s.replace(/ +/g," ").trim()},o.UNICHAR=o.CHAR,o.UNICODE=o.CODE,o.UPPER=function(s){return typeof s!="string"?error.value:s.toUpperCase()},o.VALUE=null,o}(),met.stats=function(){var exports={},SQRT2PI=2.5066282746310002;return exports.AVEDEV=null,exports.AVERAGE=function(){for(var o=utils.numbers(utils.flatten(arguments)),s=o.length,_=0,_e=0,et=0;et<s;et++)_+=o[et],_e+=1;return _/_e},exports.AVERAGEA=function(){for(var o=utils.flatten(arguments),s=o.length,_=0,_e=0,et=0;et<s;et++){var it=o[et];typeof it=="number"&&(_+=it),it===!0&&_++,it!==null&&_e++}return _/_e},exports.AVERAGEIF=function(range,criteria,average_range){if(average_range=average_range||range,range=utils.flatten(range),average_range=utils.parseNumberArray(utils.flatten(average_range)),average_range instanceof Error)return average_range;for(var average_count=0,result=0,i=0;i<range.length;i++)eval(range[i]+criteria)&&(result+=average_range[i],average_count++);return result/average_count},exports.AVERAGEIFS=null,exports.COUNT=function(){return utils.numbers(utils.flatten(arguments)).length},exports.COUNTA=function(){var o=utils.flatten(arguments);return o.length-exports.COUNTBLANK(o)},exports.COUNTIN=function(o,s){for(var _=0,_e=0;_e<o.length;_e++)o[_e]===s&&_++;return _},exports.COUNTBLANK=function(){for(var o=utils.flatten(arguments),s=0,_,_e=0;_e<o.length;_e++)_=o[_e],(_===null||_==="")&&s++;return s},exports.COUNTIF=function(){var args=utils.argsToArray(arguments),criteria=args.pop(),range=utils.flatten(args);/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var matches=0,i=0;i<range.length;i++)typeof range[i]!="string"?eval(range[i]+criteria)&&matches++:eval('"'+range[i]+'"'+criteria)&&matches++;return matches},exports.COUNTIFS=function(){for(var args=utils.argsToArray(arguments),results=new Array(utils.flatten(args[0]).length),i=0;i<results.length;i++)results[i]=!0;for(i=0;i<args.length;i+=2){var range=utils.flatten(args[i]),criteria=args[i+1];/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var j=0;j<range.length;j++)typeof range[j]!="string"?results[j]=results[j]&&eval(range[j]+criteria):results[j]=results[j]&&eval('"'+range[j]+'"'+criteria)}var result=0;for(i=0;i<results.length;i++)results[i]&&result++;return result},exports.COUNTUNIQUE=function(){return UNIQUE.apply(null,utils.flatten(arguments)).length},exports.FISHER=function(o){return o=utils.parseNumber(o),o instanceof Error?o:Math.log((1+o)/(1-o))/2},exports.FISHERINV=function(o){if(o=utils.parseNumber(o),o instanceof Error)return o;var s=Math.exp(2*o);return(s-1)/(s+1)},exports.FREQUENCY=function(o,s){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumberArray(utils.flatten(s)),utils.anyIsError(o,s))return error.value;for(var _=o.length,_e=s.length,et=[],it=0;it<=_e;it++){et[it]=0;for(var tt=0;tt<_;tt++)it===0?o[tt]<=s[0]&&(et[0]+=1):it<_e?o[tt]>s[it-1]&&o[tt]<=s[it]&&(et[it]+=1):it===_e&&o[tt]>s[_e-1]&&(et[_e]+=1)}return et},exports.LARGE=function(o,s){return o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),utils.anyIsError(o,s)?o:o.sort(function(_,_e){return _e-_})[s-1]},exports.MAX=function(){var o=utils.numbers(utils.flatten(arguments));return o.length===0?0:Math.max.apply(Math,o)},exports.MAXA=function(){var o=utils.arrayValuesToNumbers(utils.flatten(arguments));return o.length===0?0:Math.max.apply(Math,o)},exports.MIN=function(){var o=utils.numbers(utils.flatten(arguments));return o.length===0?0:Math.min.apply(Math,o)},exports.MINA=function(){var o=utils.arrayValuesToNumbers(utils.flatten(arguments));return o.length===0?0:Math.min.apply(Math,o)},exports.MODE={},exports.MODE.MULT=function(){var o=utils.parseNumberArray(utils.flatten(arguments));if(o instanceof Error)return o;for(var s=o.length,_={},_e=[],et=0,it,tt=0;tt<s;tt++)it=o[tt],_[it]=_[it]?_[it]+1:1,_[it]>et&&(et=_[it],_e=[]),_[it]===et&&(_e[_e.length]=it);return _e},exports.MODE.SNGL=function(){var o=utils.parseNumberArray(utils.flatten(arguments));return o instanceof Error?o:exports.MODE.MULT(o).sort(function(s,_){return s-_})[0]},exports.PERCENTILE={},exports.PERCENTILE.EXC=function(o,s){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;o=o.sort(function(it,tt){return it-tt});var _=o.length;if(s<1/(_+1)||s>1-1/(_+1))return error.num;var _e=s*(_+1)-1,et=Math.floor(_e);return utils.cleanFloat(_e===et?o[_e]:o[et]+(_e-et)*(o[et+1]-o[et]))},exports.PERCENTILE.INC=function(o,s){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;o=o.sort(function(it,tt){return it-tt});var _=o.length,_e=s*(_-1),et=Math.floor(_e);return utils.cleanFloat(_e===et?o[_e]:o[et]+(_e-et)*(o[et+1]-o[et]))},exports.PERCENTRANK={},exports.PERCENTRANK.EXC=function(o,s,_){if(_=_===void 0?3:_,o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),_=utils.parseNumber(_),utils.anyIsError(o,s,_))return error.value;o=o.sort(function(st,at){return st-at});for(var _e=UNIQUE.apply(null,o),et=o.length,it=_e.length,tt=Math.pow(10,_),rt=0,nt=!1,ot=0;!nt&&ot<it;)s===_e[ot]?(rt=(o.indexOf(_e[ot])+1)/(et+1),nt=!0):s>=_e[ot]&&(s<_e[ot+1]||ot===it-1)&&(rt=(o.indexOf(_e[ot])+1+(s-_e[ot])/(_e[ot+1]-_e[ot]))/(et+1),nt=!0),ot++;return Math.floor(rt*tt)/tt},exports.PERCENTRANK.INC=function(o,s,_){if(_=_===void 0?3:_,o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),_=utils.parseNumber(_),utils.anyIsError(o,s,_))return error.value;o=o.sort(function(st,at){return st-at});for(var _e=UNIQUE.apply(null,o),et=o.length,it=_e.length,tt=Math.pow(10,_),rt=0,nt=!1,ot=0;!nt&&ot<it;)s===_e[ot]?(rt=o.indexOf(_e[ot])/(et-1),nt=!0):s>=_e[ot]&&(s<_e[ot+1]||ot===it-1)&&(rt=(o.indexOf(_e[ot])+(s-_e[ot])/(_e[ot+1]-_e[ot]))/(et-1),nt=!0),ot++;return Math.floor(rt*tt)/tt},exports.PERMUT=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:FACT(o)/FACT(o-s)},exports.PERMUTATIONA=function(o,s){return o=utils.parseNumber(o),s=utils.parseNumber(s),utils.anyIsError(o,s)?error.value:Math.pow(o,s)},exports.PHI=function(o){return o=utils.parseNumber(o),o instanceof Error?error.value:Math.exp(-.5*o*o)/SQRT2PI},exports.PROB=function(o,s,_,_e){if(_===void 0)return 0;if(_e=_e===void 0?_:_e,o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumberArray(utils.flatten(s)),_=utils.parseNumber(_),_e=utils.parseNumber(_e),utils.anyIsError(o,s,_,_e))return error.value;if(_===_e)return o.indexOf(_)>=0?s[o.indexOf(_)]:0;for(var et=o.sort(function(nt,ot){return nt-ot}),it=et.length,tt=0,rt=0;rt<it;rt++)et[rt]>=_&&et[rt]<=_e&&(tt+=s[o.indexOf(et[rt])]);return tt},exports.QUARTILE={},exports.QUARTILE.EXC=function(o,s){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;switch(s){case 1:return exports.PERCENTILE.EXC(o,.25);case 2:return exports.PERCENTILE.EXC(o,.5);case 3:return exports.PERCENTILE.EXC(o,.75);default:return error.num}},exports.QUARTILE.INC=function(o,s){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;switch(s){case 1:return exports.PERCENTILE.INC(o,.25);case 2:return exports.PERCENTILE.INC(o,.5);case 3:return exports.PERCENTILE.INC(o,.75);default:return error.num}},exports.RANK={},exports.RANK.AVG=function(o,s,_){if(o=utils.parseNumber(o),s=utils.parseNumberArray(utils.flatten(s)),utils.anyIsError(o,s))return error.value;s=utils.flatten(s),_=_||!1;var _e=_?function(rt,nt){return rt-nt}:function(rt,nt){return nt-rt};s=s.sort(_e);for(var et=s.length,it=0,tt=0;tt<et;tt++)s[tt]===o&&it++;return it>1?(2*s.indexOf(o)+it+1)/2:s.indexOf(o)+1},exports.RANK.EQ=function(o,s,_){if(o=utils.parseNumber(o),s=utils.parseNumberArray(utils.flatten(s)),utils.anyIsError(o,s))return error.value;_=_||!1;var _e=_?function(et,it){return et-it}:function(et,it){return it-et};return s=s.sort(_e),s.indexOf(o)+1},exports.RSQ=function(o,s){return o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumberArray(utils.flatten(s)),utils.anyIsError(o,s)?error.value:Math.pow(exports.PEARSON(o,s),2)},exports.SMALL=function(o,s){return o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),utils.anyIsError(o,s)?o:o.sort(function(_,_e){return _-_e})[s-1]},exports.STANDARDIZE=function(o,s,_){return o=utils.parseNumber(o),s=utils.parseNumber(s),_=utils.parseNumber(_),utils.anyIsError(o,s,_)?error.value:(o-s)/_},exports.STDEV={},exports.STDEV.P=function(){var o=exports.VAR.P.apply(this,arguments);return Math.sqrt(o)},exports.STDEV.S=function(){var o=exports.VAR.S.apply(this,arguments);return Math.sqrt(o)},exports.STDEVA=function(){var o=exports.VARA.apply(this,arguments);return Math.sqrt(o)},exports.STDEVPA=function(){var o=exports.VARPA.apply(this,arguments);return Math.sqrt(o)},exports.VAR={},exports.VAR.P=function(){for(var o=utils.numbers(utils.flatten(arguments)),s=o.length,_=0,_e=exports.AVERAGE(o),et=0;et<s;et++)_+=Math.pow(o[et]-_e,2);return _/s},exports.VAR.S=function(){for(var o=utils.numbers(utils.flatten(arguments)),s=o.length,_=0,_e=exports.AVERAGE(o),et=0;et<s;et++)_+=Math.pow(o[et]-_e,2);return _/(s-1)},exports.VARA=function(){for(var o=utils.flatten(arguments),s=o.length,_=0,_e=0,et=exports.AVERAGEA(o),it=0;it<s;it++){var tt=o[it];typeof tt=="number"?_+=Math.pow(tt-et,2):tt===!0?_+=Math.pow(1-et,2):_+=Math.pow(0-et,2),tt!==null&&_e++}return _/(_e-1)},exports.VARPA=function(){for(var o=utils.flatten(arguments),s=o.length,_=0,_e=0,et=exports.AVERAGEA(o),it=0;it<s;it++){var tt=o[it];typeof tt=="number"?_+=Math.pow(tt-et,2):tt===!0?_+=Math.pow(1-et,2):_+=Math.pow(0-et,2),tt!==null&&_e++}return _/_e},exports.WEIBULL={},exports.WEIBULL.DIST=function(o,s,_,_e){return o=utils.parseNumber(o),s=utils.parseNumber(s),_=utils.parseNumber(_),utils.anyIsError(o,s,_)?error.value:_e?1-Math.exp(-Math.pow(o/_,s)):Math.pow(o,s-1)*Math.exp(-Math.pow(o/_,s))*s/Math.pow(_,s)},exports.Z={},exports.Z.TEST=function(o,s,_){if(o=utils.parseNumberArray(utils.flatten(o)),s=utils.parseNumber(s),utils.anyIsError(o,s))return error.value;_=_||exports.STDEV.S(o);var _e=o.length;return 1-exports.NORM.S.DIST((exports.AVERAGE(o)-s)/(_/Math.sqrt(_e)),!0)},exports}(),met.utils=function(){var o={};return o.PROGRESS=function(s,_){var _e=_||"red",et=s||"0";return'<div style="width:'+et+"%;height:4px;background-color:"+_e+';margin-top:1px;"></div>'},o.RATING=function(s){for(var _='<div class="jrating">',_e=0;_e<5;_e++)_e<s?_+='<div class="jrating-selected"></div>':_+="<div></div>";return _+="</div>",_},o}();for(var i=0;i<Object.keys(met).length;i++)for(var methods=met[Object.keys(met)[i]],keys=Object.keys(methods),j=0;j<keys.length;j++)if(!methods[keys[j]])window[keys[j]]=function(){return keys[j]+"Not implemented"};else if(typeof methods[keys[j]]=="function"||typeof methods[keys[j]]=="object"){if(window[keys[j]]=methods[keys[j]],window[keys[j]].toString=function(){return"#ERROR"},typeof methods[keys[j]]=="object")for(var tmp=Object.keys(methods[keys[j]]),z=0;z<tmp.length;z++)window[keys[j]][tmp[z]].toString=function(){return"#ERROR"}}else window[keys[j]]=function(){return keys[j]+"Not implemented"};var x=null,y=null,instance=null;window.TABLE=function(){return instance},window.COLUMN=window.COL=function(){return parseInt(x)+1},window.ROW=function(){return parseInt(y)+1},window.CELL=function(){return F.getColumnNameFromCoords(x,y)},window.VALUE=function(o,s,_){return instance.getValueFromCoords(parseInt(o)-1,parseInt(s)-1,_)},window.THISROWCELL=function(o){return instance.getValueFromCoords(parseInt(o)-1,parseInt(y))};var secureFormula=function(o,s){for(var _="",_e=0,et=["=","!",">","<"],it=0;it<o.length;it++)o[it]=='"'&&(_e==0?_e=1:_e=0),_e==1?_+=o[it]:(_+=o[it].toUpperCase(),s==!0&&it>0&&o[it]=="="&&et.indexOf(o[it-1])==-1&&et.indexOf(o[it+1])==-1&&(_+="="));return _=_.replace(/\^/g,"**"),_=_.replace(/\<\>/g,"!="),_=_.replace(/\&/g,"+"),_=_.replace(/\$/g,""),_},tokensUpdate=function(o,s){for(var _=0;_<o.length;_++){var _e=F.getTokensFromRange(o[_]);s=s.replace(o[_],"["+_e.join(",")+"]")}return s},F=function(o,s,_,_e,et){instance=et,x=_,y=_e;var it="",tt=Object.keys(s);if(tt.length)for(var _=0;_<tt.length;_++)tt[_].indexOf(".")==-1&&tt[_].indexOf("!")==-1?it+="var "+tt[_]+" = "+s[tt[_]]+`;
`:it+=tt[_]+" = "+s[tt[_]]+`;
`;o=o.replace(/\$/g,""),o=o.replace(/\!/g,"."),o=secureFormula(o,!0);var rt=o.match(/([A-Z]+[0-9]*\.)?(\$?[A-Z]+\$?[0-9]+):(\$?[A-Z]+\$?[0-9]+)?/g);return rt&&rt.length&&(o=tokensUpdate(rt,o)),new Function(it+"; return "+o)()},getColumnName=function(o){var s="";return o>701?(s+=String.fromCharCode(64+parseInt(o/676)),s+=String.fromCharCode(64+parseInt(o%676/26))):o>25&&(s+=String.fromCharCode(64+parseInt(o/26))),s+=String.fromCharCode(65+o%26),s};return F.getColumnNameFromCoords=function(o,s){return getColumnName(parseInt(o))+(parseInt(s)+1)},F.getCoordsFromColumnName=function(o){var s=/^[a-zA-Z]+/.exec(o);if(s){for(var _=0,_e=0;_e<s[0].length;_e++)_+=parseInt(s[0].charCodeAt(_e)-64)*Math.pow(26,s[0].length-1-_e);_--,_<0&&(_=0);var et=parseInt(/[0-9]+$/.exec(o))||null;return et>0&&et--,[_,et]}},F.getRangeFromTokens=function(o){o=o.filter(function(et){return et!="#REF!"});for(var s="",_="",_e=0;_e<o.length;_e++)o[_e].indexOf(".")>=0?s=".":o[_e].indexOf("!")>=0&&(s="!"),s&&(_=o[_e].split(s),o[_e]=_[1],_=_[0]+s);return o.sort(function(et,it){var tt=Helpers.getCoordsFromColumnName(et),rt=Helpers.getCoordsFromColumnName(it);return tt[1]>rt[1]?1:tt[1]<rt[1]?-1:tt[0]>rt[0]?1:tt[0]<rt[0]?-1:0}),o.length?_+(o[0]+":"+o[o.length-1]):"#REF!"},F.getTokensFromRange=function(_){if(_.indexOf(".")>0){var s=_.split(".");_=s[1],s=s[0]+"."}else if(_.indexOf("!")>0){var s=_.split("!");_=s[1],s=s[0]+"!"}else var s="";var _=_.split(":"),_e=F.getCoordsFromColumnName(_[0]),et=F.getCoordsFromColumnName(_[1]);if(_e[0]<=et[0])var it=_e[0],tt=et[0];else var it=et[0],tt=_e[0];if(_e[1]===null&&et[1]==null)for(var rt=null,nt=null,ot=Object.keys(vars),st=0;st<ot.length;st++){var at=F.getCoordsFromColumnName(ot[st]);at[0]===_e[0]&&(rt===null||at[1]<rt)&&(rt=at[1]),at[0]===et[0]&&(nt===null||at[1]>nt)&&(nt=at[1])}else if(_e[1]<=et[1])var rt=_e[1],nt=et[1];else var rt=et[1],nt=_e[1];for(var lt=[],ct=rt;ct<=nt;ct++){for(var ht=[],st=it;st<=tt;st++)ht.push(s+F.getColumnNameFromCoords(st,ct));lt.push(ht)}return lt},F.setFormula=function(o){for(var s=Object.keys(o),_=0;_<s.length;_++)typeof o[s[_]]=="function"&&(window[s[_]]=o[s[_]])},F}();if(!jSuites&&typeof commonjsRequire=="function")var jSuites=jsuites.exports;(function(o,s){module.exports=s()})(commonjsGlobal,function(){var Version=function(){var o={title:"Jspreadsheet",version:"4.9.10",type:"CE",host:"https://bossanova.uk/jspreadsheet",license:"MIT",print:function(){return[this.title+" "+this.type+" "+this.version,this.host,this.license].join(`\r
`)}};return function(){return o}}(),isFormula=function(o){var s=(""+o)[0];return s=="="||s=="#"},getMask=function(o){if(o.format||o.mask||o.locale){var s={};return o.mask?s.mask=o.mask:o.format?s.mask=o.format:(s.locale=o.locale,s.options=o.options),o.decimal&&(s.options||(s.options={}),s.options={decimal:o.decimal}),s}return null},jexcel=function(el,options){var obj={};if(obj.options={},el instanceof Element||el instanceof HTMLDocument){if(el.tagName=="TABLE")if(options=jexcel.createFromTable(el,options)){var div=document.createElement("div");el.parentNode.insertBefore(div,el),el.remove(),el=div}else return console.error("Jspreadsheet: el is not a valid DOM element"),!1}else return console.error("Jspreadsheet: el is not a valid DOM element"),!1;var defaults={url:null,method:"GET",requestVariables:null,data:null,sorting:null,copyCompatibility:!1,root:null,rows:[],columns:[],colHeaders:[],colWidths:[],colAlignments:[],nestedHeaders:null,defaultColWidth:50,defaultColAlign:"center",defaultRowHeight:null,minSpareRows:0,minSpareCols:0,minDimensions:[0,0],allowExport:!0,includeHeadersOnDownload:!1,includeHeadersOnCopy:!1,columnSorting:!0,columnDrag:!1,columnResize:!0,rowResize:!1,rowDrag:!0,editable:!0,allowInsertRow:!0,allowManualInsertRow:!0,allowInsertColumn:!0,allowManualInsertColumn:!0,allowDeleteRow:!0,allowDeletingAllRows:!1,allowDeleteColumn:!0,allowRenameColumn:!0,allowComments:!1,wordWrap:!1,imageOptions:null,csv:null,csvFileName:"jspreadsheet",csvHeaders:!0,csvDelimiter:",",parseTableFirstRowAsHeader:!1,parseTableAutoCellType:!1,selectionCopy:!0,mergeCells:{},toolbar:null,search:!1,pagination:!1,paginationOptions:null,fullscreen:!1,lazyLoading:!1,loadingSpin:!1,tableOverflow:!1,tableHeight:"300px",tableWidth:null,textOverflow:!1,meta:null,style:null,classes:null,parseFormulas:!0,autoIncrement:!0,autoCasting:!0,secureFormulas:!0,stripHTML:!0,stripHTMLOnCopy:!1,filters:!1,footers:null,onundo:null,onredo:null,onload:null,onchange:null,oncomments:null,onbeforechange:null,onafterchanges:null,onbeforeinsertrow:null,oninsertrow:null,onbeforeinsertcolumn:null,oninsertcolumn:null,onbeforedeleterow:null,ondeleterow:null,onbeforedeletecolumn:null,ondeletecolumn:null,onmoverow:null,onmovecolumn:null,onresizerow:null,onresizecolumn:null,onsort:null,onselection:null,oncopy:null,onpaste:null,onbeforepaste:null,onmerge:null,onfocus:null,onblur:null,onchangeheader:null,oncreateeditor:null,oneditionstart:null,oneditionend:null,onchangestyle:null,onchangemeta:null,onchangepage:null,onbeforesave:null,onsave:null,onevent:null,persistance:!1,updateTable:null,detachForUpdates:!1,freezeColumns:null,text:{noRecordsFound:"No records found",showingPage:"Showing page {0} of {1} entries",show:"Show ",search:"Search",entries:" entries",columnName:"Column name",insertANewColumnBefore:"Insert a new column before",insertANewColumnAfter:"Insert a new column after",deleteSelectedColumns:"Delete selected columns",renameThisColumn:"Rename this column",orderAscending:"Order ascending",orderDescending:"Order descending",insertANewRowBefore:"Insert a new row before",insertANewRowAfter:"Insert a new row after",deleteSelectedRows:"Delete selected rows",editComments:"Edit comments",addComments:"Add comments",comments:"Comments",clearComments:"Clear comments",copy:"Copy...",paste:"Paste...",saveAs:"Save as...",about:"About",areYouSureToDeleteTheSelectedRows:"Are you sure to delete the selected rows?",areYouSureToDeleteTheSelectedColumns:"Are you sure to delete the selected columns?",thisActionWillDestroyAnyExistingMergedCellsAreYouSure:"This action will destroy any existing merged cells. Are you sure?",thisActionWillClearYourSearchResultsAreYouSure:"This action will clear your search results. Are you sure?",thereIsAConflictWithAnotherMergedCell:"There is a conflict with another merged cell",invalidMergeProperties:"Invalid merged properties",cellAlreadyMerged:"Cell already merged",noCellsSelected:"No cells selected"},about:!0};for(var property in defaults)if(options&&options.hasOwnProperty(property))if(property==="text"){obj.options[property]=defaults[property];for(var textKey in options[property])options[property].hasOwnProperty(textKey)&&(obj.options[property][textKey]=options[property][textKey])}else obj.options[property]=options[property];else obj.options[property]=defaults[property];obj.el=el,obj.corner=null,obj.contextMenu=null,obj.textarea=null,obj.ads=null,obj.content=null,obj.table=null,obj.thead=null,obj.tbody=null,obj.rows=[],obj.results=null,obj.searchInput=null,obj.toolbar=null,obj.pagination=null,obj.pageNumber=null,obj.headerContainer=null,obj.colgroupContainer=null,obj.headers=[],obj.records=[],obj.history=[],obj.formula=[],obj.colgroup=[],obj.selection=[],obj.highlighted=[],obj.selectedCell=null,obj.selectedContainer=null,obj.style=[],obj.data=null,obj.filter=null,obj.filters=[],obj.cursor=null,obj.historyIndex=-1,obj.ignoreEvents=!1,obj.ignoreHistory=!1,obj.edition=null,obj.hashString=null,obj.resizing=null,obj.dragging=null,obj.options.lazyLoading==!0&&obj.options.tableOverflow==!1&&obj.options.fullscreen==!1&&(console.error("Jspreadsheet: The lazyloading only works when tableOverflow = yes or fullscreen = yes"),obj.options.lazyLoading=!1),obj.fullscreen=function(o){o==null&&(o=!obj.options.fullscreen),obj.options.fullscreen!=o&&(obj.options.fullscreen=o,o==!0?el.classList.add("fullscreen"):el.classList.remove("fullscreen"))},obj.dispatch=function(o){if(!obj.ignoreEvents){if(typeof obj.options.onevent=="function")var s=obj.options.onevent.apply(this,arguments);if(typeof obj.options[o]=="function")var s=obj.options[o].apply(this,Array.prototype.slice.call(arguments,1))}if(o=="onafterchanges"&&obj.options.persistance){var _=obj.options.persistance==!0?obj.options.url:obj.options.persistance,_e=obj.prepareJson(arguments[2]);obj.save(_,_e)}return s},obj.prepareTable=function(){var o=obj.options.columns.length;if(obj.options.data&&typeof obj.options.data[0]!="undefined"){var s=Object.keys(obj.options.data[0]);s.length>o&&(o=s.length)}obj.options.minDimensions[0]>o&&(o=obj.options.minDimensions[0]);for(var _=[],_e=0;_e<o;_e++)obj.options.colHeaders[_e]||(obj.options.colHeaders[_e]=""),obj.options.colWidths[_e]||(obj.options.colWidths[_e]=obj.options.defaultColWidth),obj.options.colAlignments[_e]||(obj.options.colAlignments[_e]=obj.options.defaultColAlign),obj.options.columns[_e]?obj.options.columns[_e].type||(obj.options.columns[_e].type="text"):obj.options.columns[_e]={type:"text"},obj.options.columns[_e].name||(obj.options.columns[_e].name=s&&s[_e]?s[_e]:_e),obj.options.columns[_e].source||(obj.options.columns[_e].source=[]),obj.options.columns[_e].options||(obj.options.columns[_e].options=[]),obj.options.columns[_e].editor||(obj.options.columns[_e].editor=null),obj.options.columns[_e].allowEmpty||(obj.options.columns[_e].allowEmpty=!1),obj.options.columns[_e].title||(obj.options.columns[_e].title=obj.options.colHeaders[_e]?obj.options.colHeaders[_e]:""),obj.options.columns[_e].width||(obj.options.columns[_e].width=obj.options.colWidths[_e]?obj.options.colWidths[_e]:obj.options.defaultColWidth),obj.options.columns[_e].align||(obj.options.columns[_e].align=obj.options.colAlignments[_e]?obj.options.colAlignments[_e]:"center"),obj.options.columns[_e].type=="autocomplete"||obj.options.columns[_e].type=="dropdown"?obj.options.columns[_e].url&&_.push({url:obj.options.columns[_e].url,index:_e,method:"GET",dataType:"json",success:function(et){for(var it=0;it<et.length;it++)obj.options.columns[this.index].source.push(et[it])}}):obj.options.columns[_e].type=="calendar"&&(obj.options.columns[_e].options.format||(obj.options.columns[_e].options.format="DD/MM/YYYY"));_.length?jSuites.ajax(_,function(){obj.createTable()}):obj.createTable()},obj.createTable=function(){obj.table=document.createElement("table"),obj.thead=document.createElement("thead"),obj.tbody=document.createElement("tbody"),obj.headers=[],obj.colgroup=[],obj.content=document.createElement("div"),obj.content.classList.add("jexcel_content"),obj.content.onscroll=function(ft){obj.scrollControls(ft)},obj.content.onwheel=function(ft){obj.wheelControls(ft)},obj.toolbar=document.createElement("div"),obj.toolbar.classList.add("jexcel_toolbar");var o=document.createElement("div"),s=document.createTextNode(obj.options.text.search+": ");obj.searchInput=document.createElement("input"),obj.searchInput.classList.add("jexcel_search"),o.appendChild(s),o.appendChild(obj.searchInput),obj.searchInput.onfocus=function(){obj.resetSelection()};var _=document.createElement("div");if(obj.options.pagination>0&&obj.options.paginationOptions&&obj.options.paginationOptions.length>0){obj.paginationDropdown=document.createElement("select"),obj.paginationDropdown.classList.add("jexcel_pagination_dropdown"),obj.paginationDropdown.onchange=function(){obj.options.pagination=parseInt(this.value),obj.page(0)};for(var _e=0;_e<obj.options.paginationOptions.length;_e++){var et=document.createElement("option");et.value=obj.options.paginationOptions[_e],et.innerHTML=obj.options.paginationOptions[_e],obj.paginationDropdown.appendChild(et)}obj.paginationDropdown.value=obj.options.pagination,_.appendChild(document.createTextNode(obj.options.text.show)),_.appendChild(obj.paginationDropdown),_.appendChild(document.createTextNode(obj.options.text.entries))}var it=document.createElement("div");it.classList.add("jexcel_filter"),it.appendChild(_),it.appendChild(o),obj.colgroupContainer=document.createElement("colgroup");var rt=document.createElement("col");if(rt.setAttribute("width","50"),obj.colgroupContainer.appendChild(rt),obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var tt=0;tt<obj.options.nestedHeaders.length;tt++)obj.thead.appendChild(obj.createNestedHeader(obj.options.nestedHeaders[tt]));else obj.thead.appendChild(obj.createNestedHeader(obj.options.nestedHeaders));obj.headerContainer=document.createElement("tr");var rt=document.createElement("td");rt.classList.add("jexcel_selectall"),obj.headerContainer.appendChild(rt);for(var _e=0;_e<obj.options.columns.length;_e++)obj.createCellHeader(_e),obj.headerContainer.appendChild(obj.headers[_e]),obj.colgroupContainer.appendChild(obj.colgroup[_e]);if(obj.thead.appendChild(obj.headerContainer),obj.options.filters==!0){obj.filter=document.createElement("tr");var nt=document.createElement("td");obj.filter.appendChild(nt);for(var _e=0;_e<obj.options.columns.length;_e++){var nt=document.createElement("td");nt.innerHTML="&nbsp;",nt.setAttribute("data-x",_e),nt.className="jexcel_column_filter",obj.options.columns[_e].type=="hidden"&&(nt.style.display="none"),obj.filter.appendChild(nt)}obj.thead.appendChild(obj.filter)}obj.table=document.createElement("table"),obj.table.classList.add("jexcel"),obj.table.setAttribute("cellpadding","0"),obj.table.setAttribute("cellspacing","0"),obj.table.setAttribute("unselectable","yes"),obj.table.appendChild(obj.colgroupContainer),obj.table.appendChild(obj.thead),obj.table.appendChild(obj.tbody),obj.options.textOverflow||obj.table.classList.add("jexcel_overflow"),obj.corner=document.createElement("div"),obj.corner.className="jexcel_corner",obj.corner.setAttribute("unselectable","on"),obj.corner.setAttribute("onselectstart","return false"),obj.options.selectionCopy==!1&&(obj.corner.style.display="none"),obj.textarea=document.createElement("textarea"),obj.textarea.className="jexcel_textarea",obj.textarea.id="jexcel_textarea",obj.textarea.tabIndex="-1",obj.contextMenu=document.createElement("div"),obj.contextMenu.className="jexcel_contextmenu",jSuites.contextmenu(obj.contextMenu,{onclick:function(){obj.contextMenu.contextmenu.close(!1)}});var ot=document.createElement("a");ot.setAttribute("href","https://bossanova.uk/jspreadsheet/"),obj.ads=document.createElement("div"),obj.ads.className="jexcel_about";try{if(typeof sessionStorage!="undefined"&&!sessionStorage.getItem("jexcel")){sessionStorage.setItem("jexcel",!0);var st=document.createElement("img");st.src="//bossanova.uk/jspreadsheet/logo.png",ot.appendChild(st)}}catch{}var at=document.createElement("span");at.innerHTML="Jspreadsheet CE",ot.appendChild(at),obj.ads.appendChild(ot);var lt=document.createElement("div");lt.classList.add("jexcel_table"),obj.pagination=document.createElement("div"),obj.pagination.classList.add("jexcel_pagination");var ct=document.createElement("div"),ht=document.createElement("div");if(obj.pagination.appendChild(ct),obj.pagination.appendChild(ht),obj.options.pagination||(obj.pagination.style.display="none"),obj.options.search==!0&&el.appendChild(it),obj.content.appendChild(obj.table),obj.content.appendChild(obj.corner),obj.content.appendChild(obj.textarea),el.appendChild(obj.toolbar),el.appendChild(obj.content),el.appendChild(obj.pagination),el.appendChild(obj.contextMenu),el.appendChild(obj.ads),el.classList.add("jexcel_container"),obj.options.toolbar&&obj.options.toolbar.length&&obj.createToolbar(),obj.options.fullscreen==!0?el.classList.add("fullscreen"):obj.options.tableOverflow==!0&&(obj.options.tableHeight&&(obj.content.style["overflow-y"]="auto",obj.content.style["box-shadow"]="rgb(221 221 221) 2px 2px 5px 0.1px",obj.content.style.maxHeight=obj.options.tableHeight),obj.options.tableWidth&&(obj.content.style["overflow-x"]="auto",obj.content.style.width=obj.options.tableWidth)),obj.options.tableOverflow!=!0&&obj.options.toolbar&&el.classList.add("with-toolbar"),obj.options.columnDrag==!0&&obj.thead.classList.add("draggable"),obj.options.columnResize==!0&&obj.thead.classList.add("resizable"),obj.options.rowDrag==!0&&obj.tbody.classList.add("draggable"),obj.options.rowResize==!0&&obj.tbody.classList.add("resizable"),obj.setData(),obj.options.style&&obj.setStyle(obj.options.style,null,null,1,1),obj.options.classes)for(var mt=Object.keys(obj.options.classes),_e=0;_e<mt.length;_e++){var dt=jexcel.getIdFromColumnName(mt[_e],!0);obj.records[dt[1]][dt[0]].classList.add(obj.options.classes[mt[_e]])}},obj.refresh=function(){obj.options.url?(obj.options.loadingSpin==!0&&jSuites.loading.show(),jSuites.ajax({url:obj.options.url,method:obj.options.method,data:obj.options.requestVariables,dataType:"json",success:function(o){obj.options.data=o.data?o.data:o,obj.setData(),obj.options.loadingSpin==!0&&jSuites.loading.hide()}})):obj.setData()},obj.setData=function(o){if(o&&(typeof o=="string"&&(o=JSON.parse(o)),obj.options.data=o),obj.options.data||(obj.options.data=[]),obj.options.data&&obj.options.data[0]&&!Array.isArray(obj.options.data[0])){for(var o=[],_=0;_<obj.options.data.length;_++){for(var s=[],_e=0;_e<obj.options.columns.length;_e++)s[_e]=obj.options.data[_][obj.options.columns[_e].name];o.push(s)}obj.options.data=o}var _=0,_e=0,et=obj.options.columns.length,it=obj.options.data.length,tt=obj.options.minDimensions[0],rt=obj.options.minDimensions[1],nt=tt>et?tt:et,ot=rt>it?rt:it;for(_=0;_<ot;_++)for(_e=0;_e<nt;_e++)obj.options.data[_]==null&&(obj.options.data[_]=[]),obj.options.data[_][_e]==null&&(obj.options.data[_][_e]="");if(obj.rows=[],obj.results=null,obj.records=[],obj.history=[],obj.historyIndex=-1,obj.tbody.innerHTML="",obj.options.lazyLoading==!0){var st=0,at=obj.options.data.length<100?obj.options.data.length:100;obj.options.pagination&&(obj.options.pagination=!1,console.error("Jspreadsheet: Pagination will be disable due the lazyLoading"))}else if(obj.options.pagination)obj.pageNumber||(obj.pageNumber=0),obj.options.pagination,st=obj.options.pagination*obj.pageNumber,at=obj.options.pagination*obj.pageNumber+obj.options.pagination,obj.options.data.length<at&&(at=obj.options.data.length);else var st=0,at=obj.options.data.length;for(_=0;_<obj.options.data.length;_++){var lt=obj.createRow(_,obj.options.data[_]);_>=st&&_<at&&obj.tbody.appendChild(lt)}if(obj.options.lazyLoading==!0||obj.options.pagination&&obj.updatePagination(),obj.options.mergeCells)for(var ct=Object.keys(obj.options.mergeCells),_e=0;_e<ct.length;_e++){var ht=obj.options.mergeCells[ct[_e]];obj.setMerge(ct[_e],ht[0],ht[1],1)}obj.updateTable(),obj.dispatch("onload",el,obj)},obj.getData=function(o,s){for(var _=[],_e=0,et=0,it=s==!0||obj.options.copyCompatibility==!1,tt=obj.options.columns.length,rt=obj.options.data.length,nt=0;nt<rt;nt++){_e=0;for(var ot=0;ot<tt;ot++)(!o||obj.records[nt][ot].classList.contains("highlight"))&&(_[et]||(_[et]=[]),it?_[et][_e]=obj.options.data[nt][ot]:_[et][_e]=obj.records[nt][ot].innerHTML,_e++);_e>0&&et++}return _},obj.getJsonRow=function(o){for(var s=obj.options.data[o],_=obj.options.columns.length,_e={},et=0;et<_;et++)obj.options.columns[et].name||(obj.options.columns[et].name=et),_e[obj.options.columns[et].name]=s[et];return _e},obj.getJson=function(o){for(var s=[],_=obj.options.columns.length,_e=obj.options.data.length,et=0;et<_e;et++){for(var it=null,tt=0;tt<_;tt++)(!o||obj.records[et][tt].classList.contains("highlight"))&&(it==null&&(it={}),obj.options.columns[tt].name||(obj.options.columns[tt].name=tt),it[obj.options.columns[tt].name]=obj.options.data[et][tt]);it!=null&&s.push(it)}return s},obj.prepareJson=function(o){for(var s=[],_=0;_<o.length;_++){var _e=o[_].x,et=o[_].y,it=obj.options.columns[_e].name?obj.options.columns[_e].name:_e;s[et]||(s[et]={row:et,data:{}}),s[et].data[it]=o[_].newValue}return s.filter(function(tt){return tt!=null})},obj.save=function(o,s){var _=obj.dispatch("onbeforesave",el,obj,s);if(_)var s=_;else if(_===!1)return!1;jSuites.ajax({url:o,method:"POST",dataType:"json",data:{data:JSON.stringify(s)},success:function(_e){obj.dispatch("onsave",el,obj,s)}})},obj.getRowData=function(o){return obj.options.data[o]},obj.setRowData=function(o,s){for(var _=0;_<obj.headers.length;_++){var _e=jexcel.getColumnNameFromId([_,o]);s[_]!=null&&obj.setValue(_e,s[_])}},obj.getColumnData=function(o){for(var s=[],_=0;_<obj.options.data.length;_++)s.push(obj.options.data[_][o]);return s},obj.setColumnData=function(o,s){for(var _=0;_<obj.rows.length;_++){var _e=jexcel.getColumnNameFromId([o,_]);s[_]!=null&&obj.setValue(_e,s[_])}},obj.createRow=function(o,s){if(obj.records[o]||(obj.records[o]=[]),!s)var s=obj.options.data[o];obj.rows[o]=document.createElement("tr"),obj.rows[o].setAttribute("data-y",o);var _=null;obj.options.defaultRowHeight&&(obj.rows[o].style.height=obj.options.defaultRowHeight+"px"),obj.options.rows[o]&&(obj.options.rows[o].height&&(obj.rows[o].style.height=obj.options.rows[o].height),obj.options.rows[o].title&&(_=obj.options.rows[o].title)),_||(_=parseInt(o+1));var _e=document.createElement("td");_e.innerHTML=_,_e.setAttribute("data-y",o),_e.className="jexcel_row",obj.rows[o].appendChild(_e);for(var et=0;et<obj.options.columns.length;et++)obj.records[o][et]=obj.createCell(et,o,s[et]),obj.rows[o].appendChild(obj.records[o][et]);return obj.rows[o]},obj.parseValue=function(o,s,_,_e){(""+_).substr(0,1)=="="&&obj.options.parseFormulas==!0&&(_=obj.executeFormula(_,o,s));var et=obj.options.columns[o];if(et&&!isFormula(_)){var it=null;if(it=getMask(et)){_&&_==Number(_)&&(_=Number(_));var tt=jSuites.mask.render(_,it,!0);if(_e&&it.mask){var rt=it.mask.split(";");if(rt[1]){var nt=rt[1].match(new RegExp("\\[Red\\]","gi"));nt&&(_<0?_e.classList.add("red"):_e.classList.remove("red"));var ot=rt[1].match(new RegExp("\\(","gi"));ot&&_<0&&(tt="("+tt+")")}}tt&&(_=tt)}}return _};var validDate=function(o){return o=""+o,o.substr(4,1)=="-"&&o.substr(7,1)=="-"?!0:(o=o.split("-"),o[0].length==4&&o[0]==Number(o[0])&&o[1].length==2&&o[1]==Number(o[1]))};obj.createCell=function(o,s,_){var _e=document.createElement("td");if(_e.setAttribute("data-x",o),_e.setAttribute("data-y",s),(""+_).substr(0,1)=="="&&obj.options.secureFormulas==!0){var et=secureFormula(_);et!=_&&(_=et)}if(obj.options.columns[o].editor)obj.options.stripHTML===!1||obj.options.columns[o].stripHTML===!1?_e.innerHTML=_:_e.innerText=_,typeof obj.options.columns[o].editor.createCell=="function"&&(_e=obj.options.columns[o].editor.createCell(_e));else if(obj.options.columns[o].type=="hidden")_e.style.display="none",_e.innerText=_;else if(obj.options.columns[o].type=="checkbox"||obj.options.columns[o].type=="radio"){var it=document.createElement("input");it.type=obj.options.columns[o].type,it.name="c"+o,it.checked=_==1||_==!0||_=="true",it.onclick=function(){obj.setValue(_e,this.checked)},(obj.options.columns[o].readOnly==!0||obj.options.editable==!1)&&it.setAttribute("disabled","disabled"),_e.appendChild(it),obj.options.data[s][o]=it.checked}else if(obj.options.columns[o].type=="calendar"){var tt=null;if(!validDate(_)){var rt=jSuites.calendar.extractDateFromString(_,obj.options.columns[o].options.format);rt&&(tt=rt)}_e.innerText=jSuites.calendar.getDateString(tt||_,obj.options.columns[o].options.format)}else if(obj.options.columns[o].type=="dropdown"||obj.options.columns[o].type=="autocomplete")_e.classList.add("jexcel_dropdown"),_e.innerText=obj.getDropDownValue(o,_);else if(obj.options.columns[o].type=="color")if(obj.options.columns[o].render=="square"){var nt=document.createElement("div");nt.className="color",nt.style.backgroundColor=_,_e.appendChild(nt)}else _e.style.color=_,_e.innerText=_;else if(obj.options.columns[o].type=="image"){if(_&&_.substr(0,10)=="data:image"){var ot=document.createElement("img");ot.src=_,_e.appendChild(ot)}}else obj.options.columns[o].type=="html"||obj.options.stripHTML===!1||obj.options.columns[o].stripHTML===!1?_e.innerHTML=stripScript(obj.parseValue(o,s,_,_e)):_e.innerText=obj.parseValue(o,s,_,_e);obj.options.columns[o].readOnly==!0&&(_e.className="readonly");var st=obj.options.columns[o].align?obj.options.columns[o].align:"center";return _e.style.textAlign=st,obj.options.columns[o].wordWrap!=!1&&(obj.options.wordWrap==!0||obj.options.columns[o].wordWrap==!0||_e.innerHTML.length>200)&&(_e.style.whiteSpace="pre-wrap"),o>0&&this.options.textOverflow==!0&&(_||_e.innerHTML?obj.records[s][o-1].style.overflow="hidden":o==obj.options.columns.length-1&&(_e.style.overflow="hidden")),_e},obj.createCellHeader=function(o){var s=obj.options.columns[o].width?obj.options.columns[o].width:obj.options.defaultColWidth,_=obj.options.columns[o].align?obj.options.columns[o].align:obj.options.defaultColAlign;obj.headers[o]=document.createElement("td"),obj.options.stripHTML?obj.headers[o].innerText=obj.options.columns[o].title?obj.options.columns[o].title:jexcel.getColumnName(o):obj.headers[o].innerHTML=obj.options.columns[o].title?obj.options.columns[o].title:jexcel.getColumnName(o),obj.headers[o].setAttribute("data-x",o),obj.headers[o].style.textAlign=_,obj.options.columns[o].title&&obj.headers[o].setAttribute("title",obj.options.columns[o].title),obj.options.columns[o].id&&obj.headers[o].setAttribute("id",obj.options.columns[o].id),obj.colgroup[o]=document.createElement("col"),obj.colgroup[o].setAttribute("width",s),obj.options.columns[o].type=="hidden"&&(obj.headers[o].style.display="none",obj.colgroup[o].style.display="none")},obj.updateNestedHeader=function(o,s,_){obj.options.nestedHeaders[s][o].title&&(obj.options.nestedHeaders[s][o].title=_,obj.options.nestedHeaders[s].element.children[o+1].innerText=_)},obj.createNestedHeader=function(o){var s=document.createElement("tr");s.classList.add("jexcel_nested");var _=document.createElement("td");s.appendChild(_),o.element=s;for(var _e=0,et=0;et<o.length;et++){o[et].colspan||(o[et].colspan=1),o[et].align||(o[et].align="center"),o[et].title||(o[et].title="");for(var it=o[et].colspan,tt=[],rt=0;rt<it;rt++)obj.options.columns[_e]&&obj.options.columns[_e].type=="hidden"&&it++,tt.push(_e),_e++;var _=document.createElement("td");_.setAttribute("data-column",tt.join(",")),_.setAttribute("colspan",o[et].colspan),_.setAttribute("align",o[et].align),_.innerText=o[et].title,s.appendChild(_)}return s},obj.createToolbar=function(o){if(o)obj.options.toolbar=o;else var o=obj.options.toolbar;for(var s=0;s<o.length;s++)if(o[s].type=="i"){var _=document.createElement("i");_.classList.add("jexcel_toolbar_item"),_.classList.add("material-icons"),_.setAttribute("data-k",o[s].k),_.setAttribute("data-v",o[s].v),_.setAttribute("id",o[s].id),o[s].tooltip&&_.setAttribute("title",o[s].tooltip),o[s].onclick&&typeof o[s].onclick?_.onclick=function(it){var tt=it;return function(){o[tt].onclick(el,obj,this)}}(s):_.onclick=function(){var it=this.getAttribute("data-k"),tt=this.getAttribute("data-v");obj.setStyle(obj.highlighted,it,tt)},_.innerText=o[s].content,obj.toolbar.appendChild(_)}else if(o[s].type=="select"){var _=document.createElement("select");_.classList.add("jexcel_toolbar_item"),_.setAttribute("data-k",o[s].k),o[s].tooltip&&_.setAttribute("title",o[s].tooltip),o[s].onchange&&typeof o[s].onchange?_.onchange=o[s].onchange:_.onchange=function(){var tt=this.getAttribute("data-k");obj.setStyle(obj.highlighted,tt,this.value)};for(var _e=0;_e<o[s].v.length;_e++){var et=document.createElement("option");et.value=o[s].v[_e],et.innerText=o[s].v[_e],_.appendChild(et)}obj.toolbar.appendChild(_)}else if(o[s].type=="color"){var _=document.createElement("i");_.classList.add("jexcel_toolbar_item"),_.classList.add("material-icons"),_.setAttribute("data-k",o[s].k),_.setAttribute("data-v",""),o[s].tooltip&&_.setAttribute("title",o[s].tooltip),obj.toolbar.appendChild(_),_.innerText=o[s].content,jSuites.color(_,{onchange:function(tt,rt){var nt=tt.getAttribute("data-k");obj.setStyle(obj.highlighted,nt,rt)}})}},obj.setMerge=function(o,s,_,_e){var et=!1;if(!o)if(obj.highlighted.length)var it=parseInt(obj.highlighted[0].getAttribute("data-x")),tt=parseInt(obj.highlighted[0].getAttribute("data-y")),rt=parseInt(obj.highlighted[obj.highlighted.length-1].getAttribute("data-x")),nt=parseInt(obj.highlighted[obj.highlighted.length-1].getAttribute("data-y")),o=jexcel.getColumnNameFromId([it,tt]),s=rt-it+1,_=nt-tt+1;else return alert(obj.options.text.noCellsSelected),null;var ot=jexcel.getIdFromColumnName(o,!0);if(obj.options.mergeCells[o])obj.records[ot[1]][ot[0]].getAttribute("data-merged")&&(et=obj.options.text.cellAlreadyMerged);else if((!s||s<2)&&(!_||_<2))et=obj.options.text.invalidMergeProperties;else for(var st=ot[1];st<ot[1]+_;st++)for(var at=ot[0];at<ot[0]+s;at++)jexcel.getColumnNameFromId([at,st]),obj.records[st][at].getAttribute("data-merged")&&(et=obj.options.text.thereIsAConflictWithAnotherMergedCell);if(et)alert(et);else{s>1?obj.records[ot[1]][ot[0]].setAttribute("colspan",s):s=1,_>1?obj.records[ot[1]][ot[0]].setAttribute("rowspan",_):_=1,obj.options.mergeCells[o]=[s,_,[]],obj.records[ot[1]][ot[0]].setAttribute("data-merged","true"),obj.records[ot[1]][ot[0]].style.overflow="hidden";for(var lt=[],ct=ot[1];ct<ot[1]+_;ct++)for(var ht=ot[0];ht<ot[0]+s;ht++)ot[0]==ht&&ot[1]==ct||(lt.push(obj.options.data[ct][ht]),obj.updateCell(ht,ct,"",!0),obj.options.mergeCells[o][2].push(obj.records[ct][ht]),obj.records[ct][ht].style.display="none",obj.records[ct][ht]=obj.records[ot[1]][ot[0]]);obj.updateSelection(obj.records[ot[1]][ot[0]]),_e||(obj.setHistory({action:"setMerge",column:o,colspan:s,rowspan:_,data:lt}),obj.dispatch("onmerge",el,o,s,_))}},obj.getMerge=function(o){var s={};if(o)obj.options.mergeCells[o]?s=[obj.options.mergeCells[o][0],obj.options.mergeCells[o][1]]:s=null;else if(obj.options.mergeCells){obj.options.mergeCells;for(var _=Object.keys(obj.options.mergeCells),_e=0;_e<_.length;_e++)s[_[_e]]=[obj.options.mergeCells[_[_e]][0],obj.options.mergeCells[_[_e]][1]]}return s},obj.removeMerge=function(o,s,_){if(obj.options.mergeCells[o]){var _e=jexcel.getIdFromColumnName(o,!0);obj.records[_e[1]][_e[0]].removeAttribute("colspan"),obj.records[_e[1]][_e[0]].removeAttribute("rowspan"),obj.records[_e[1]][_e[0]].removeAttribute("data-merged");for(var et=obj.options.mergeCells[o],it=0,tt=0;tt<et[1];tt++)for(var rt=0;rt<et[0];rt++)(tt>0||rt>0)&&(obj.records[_e[1]+tt][_e[0]+rt]=et[2][it],obj.records[_e[1]+tt][_e[0]+rt].style.display="",s&&s[it]&&obj.updateCell(_e[0]+rt,_e[1]+tt,s[it]),it++);obj.updateSelection(obj.records[_e[1]][_e[0]],obj.records[_e[1]+tt-1][_e[0]+rt-1]),_||delete obj.options.mergeCells[o]}},obj.destroyMerged=function(o){if(obj.options.mergeCells){obj.options.mergeCells;for(var s=Object.keys(obj.options.mergeCells),_=0;_<s.length;_++)obj.removeMerge(s[_],null,o)}},obj.isColMerged=function(o,s){var _=[];if(obj.options.mergeCells)for(var _e=Object.keys(obj.options.mergeCells),et=0;et<_e.length;et++){var it=jexcel.getIdFromColumnName(_e[et],!0),tt=obj.options.mergeCells[_e[et]][0],rt=it[0],nt=it[0]+(tt>1?tt-1:0);s==null?rt<=o&&nt>=o&&_.push(_e[et]):s?rt<o&&nt>=o&&_.push(_e[et]):rt<=o&&nt>o&&_.push(_e[et])}return _},obj.isRowMerged=function(o,s){var _=[];if(obj.options.mergeCells)for(var _e=Object.keys(obj.options.mergeCells),et=0;et<_e.length;et++){var it=jexcel.getIdFromColumnName(_e[et],!0),tt=obj.options.mergeCells[_e[et]][1],rt=it[1],nt=it[1]+(tt>1?tt-1:0);s==null?rt<=o&&nt>=o&&_.push(_e[et]):s?rt<o&&nt>=o&&_.push(_e[et]):rt<=o&&nt>o&&_.push(_e[et])}return _},obj.openFilter=function(o){if(!obj.options.filters)console.log("Jspreadsheet: filters not enabled.");else{o=parseInt(o),obj.resetSelection();var s=[];if(obj.options.columns[o].type=="checkbox")s.push({id:"true",name:"True"}),s.push({id:"false",name:"False"});else{for(var _=[],_e=!1,et=0;et<obj.options.data.length;et++){var it=obj.options.data[et][o],tt=obj.records[et][o].innerHTML;if(it&&tt)_[it]=tt;else var _e=!0}for(var rt=Object.keys(_),s=[],et=0;et<rt.length;et++)s.push({id:rt[et],name:_[rt[et]]});_e&&s.push({value:"",id:"",name:"(Blanks)"})}var nt=document.createElement("div");obj.filter.children[o+1].innerHTML="",obj.filter.children[o+1].appendChild(nt),obj.filter.children[o+1].style.paddingLeft="0px",obj.filter.children[o+1].style.paddingRight="0px",obj.filter.children[o+1].style.overflow="initial";var ot={data:s,multiple:!0,autocomplete:!0,opened:!0,value:obj.filters[o]!==void 0?obj.filters[o]:null,width:"100%",position:obj.options.tableOverflow==!0||obj.options.fullscreen==!0,onclose:function(st){obj.resetFilters(),obj.filters[o]=st.dropdown.getValue(!0),obj.filter.children[o+1].innerHTML=st.dropdown.getText(),obj.filter.children[o+1].style.paddingLeft="",obj.filter.children[o+1].style.paddingRight="",obj.filter.children[o+1].style.overflow="",obj.closeFilter(o),obj.refreshSelection()}};jSuites.dropdown(nt,ot)}},obj.resetFilters=function(){if(obj.options.filters)for(var o=0;o<obj.filter.children.length;o++)obj.filter.children[o].innerHTML="&nbsp;",obj.filters[o]=null},obj.closeFilter=function(o){if(!o)for(var s=0;s<obj.filter.children.length;s++)obj.filters[s]&&(o=s);var _=function(it,tt,rt){for(var nt=0;nt<it.length;nt++)if(it[nt]==""&&(obj.options.data[rt][tt]===!1||""+obj.options.data[rt][tt]=="")||it[nt]!=""&&((""+obj.options.data[rt][tt]).search(it[nt])>=0||(""+obj.records[rt][tt].innerHTML).search(it[nt])>=0))return!0;return!1},_e=obj.filters[o];obj.results=[];for(var et=0;et<obj.options.data.length;et++)_(_e,o,et)&&obj.results.push(et);obj.results.length||(obj.results=null),obj.updateResult()},obj.openEditor=function(o,s,_){var _e=o.getAttribute("data-y"),et=o.getAttribute("data-x");obj.dispatch("oneditionstart",el,o,et,_e),et>0&&(obj.records[_e][et-1].style.overflow="hidden");var it=function(ut){var pt=o.getBoundingClientRect(),At=document.createElement(ut);return At.style.width=pt.width+"px",At.style.height=pt.height-2+"px",At.style.minHeight=pt.height-2+"px",o.classList.add("editor"),o.innerHTML="",o.appendChild(At),obj.dispatch("oncreateeditor",el,o,et,_e,At),At};if(o.classList.contains("readonly")!=!0){if(obj.edition=[obj.records[_e][et],obj.records[_e][et].innerHTML,et,_e],obj.options.columns[et].editor)obj.options.columns[et].editor.openEditor(o,el,s,_);else if(obj.options.columns[et].type!="hidden")if(obj.options.columns[et].type=="checkbox"||obj.options.columns[et].type=="radio"){var tt=!o.children[0].checked;obj.setValue(o,tt),obj.edition=null}else if(obj.options.columns[et].type=="dropdown"||obj.options.columns[et].type=="autocomplete"){var tt=obj.options.data[_e][et];if(obj.options.columns[et].multiple&&!Array.isArray(tt)&&(tt=tt.split(";")),typeof obj.options.columns[et].filter=="function")var rt=obj.options.columns[et].filter(el,o,et,_e,obj.options.columns[et].source);else var rt=obj.options.columns[et].source;for(var nt=[],ot=0;ot<rt.length;ot++)nt.push(rt[ot]);var st=it("div"),at={data:nt,multiple:!!obj.options.columns[et].multiple,autocomplete:!!(obj.options.columns[et].autocomplete||obj.options.columns[et].type=="autocomplete"),opened:!0,value:tt,width:"100%",height:st.style.minHeight,position:obj.options.tableOverflow==!0||obj.options.fullscreen==!0,onclose:function(){obj.closeEditor(o,!0)}};obj.options.columns[et].options&&obj.options.columns[et].options.type&&(at.type=obj.options.columns[et].options.type),jSuites.dropdown(st,at)}else if(obj.options.columns[et].type=="calendar"||obj.options.columns[et].type=="color"){var tt=obj.options.data[_e][et],st=it("input");st.value=tt,(obj.options.tableOverflow==!0||obj.options.fullscreen==!0)&&(obj.options.columns[et].options.position=!0),obj.options.columns[et].options.value=obj.options.data[_e][et],obj.options.columns[et].options.opened=!0,obj.options.columns[et].options.onclose=function(At,gt){obj.closeEditor(o,!0)},obj.options.columns[et].type=="color"?jSuites.color(st,obj.options.columns[et].options):jSuites.calendar(st,obj.options.columns[et].options),st.focus()}else if(obj.options.columns[et].type=="html"){var tt=obj.options.data[_e][et],st=it("div");st.style.position="relative";var lt=document.createElement("div");lt.classList.add("jexcel_richtext"),st.appendChild(lt),jSuites.editor(lt,{focus:!0,value:tt});var ct=o.getBoundingClientRect(),ht=lt.getBoundingClientRect();window.innerHeight<ct.bottom+ht.height?lt.style.top=ct.top-(ht.height+2)+"px":lt.style.top=ct.top+"px"}else if(obj.options.columns[et].type=="image"){var mt=o.children[0],st=it("div");st.style.position="relative";var lt=document.createElement("div");lt.classList.add("jclose"),mt&&mt.src&&lt.appendChild(mt),st.appendChild(lt),jSuites.image(lt,obj.options.imageOptions);var ct=o.getBoundingClientRect(),ht=lt.getBoundingClientRect();window.innerHeight<ct.bottom+ht.height?lt.style.top=ct.top-(ht.height+2)+"px":lt.style.top=ct.top+"px"}else{var tt=s==!0?"":obj.options.data[_e][et];if(obj.options.columns[et].wordWrap!=!1&&(obj.options.wordWrap==!0||obj.options.columns[et].wordWrap==!0))var st=it("textarea");else var st=it("input");st.focus(),st.value=tt;var at=obj.options.columns[et],dt=null;if(!isFormula(tt)&&(dt=getMask(at))){if(!at.disabledMaskOnEdition)if(at.mask){var ft=at.mask.split(";");st.setAttribute("data-mask",ft[0])}else at.locale&&st.setAttribute("data-locale",at.locale);dt.input=st,st.mask=dt,jSuites.mask.render(tt,dt,!1)}st.onblur=function(){obj.closeEditor(o,!0)},st.scrollLeft=st.scrollWidth}}},obj.closeEditor=function(o,s){var _=parseInt(o.getAttribute("data-x")),_e=parseInt(o.getAttribute("data-y"));if(s==!0){if(obj.options.columns[_].editor)var et=obj.options.columns[_].editor.closeEditor(o,s);else if(!(obj.options.columns[_].type=="checkbox"||obj.options.columns[_].type=="radio"||obj.options.columns[_].type=="hidden"))if(obj.options.columns[_].type=="dropdown"||obj.options.columns[_].type=="autocomplete")var et=o.children[0].dropdown.close(!0);else if(obj.options.columns[_].type=="calendar")var et=o.children[0].calendar.close(!0);else if(obj.options.columns[_].type=="color")var et=o.children[0].color.close(!0);else if(obj.options.columns[_].type=="html")var et=o.children[0].children[0].editor.getData();else if(obj.options.columns[_].type=="image")var it=o.children[0].children[0].children[0],et=it&&it.tagName=="IMG"?it.src:"";else if(obj.options.columns[_].type=="numeric"){var et=o.children[0].value;(""+et).substr(0,1)!="="&&et==""&&(et=obj.options.columns[_].allowEmpty?"":0),o.children[0].onblur=null}else{var et=o.children[0].value;o.children[0].onblur=null;var tt=obj.options.columns[_],rt=null;if((rt=getMask(tt))&&et!==""&&!isFormula(et)&&typeof et!="number"){var nt=jSuites.mask.extract(et,rt,!0);nt&&nt.value!==""&&(et=nt.value)}}obj.options.data[_e][_]==et?o.innerHTML=obj.edition[1]:obj.setValue(o,et)}else obj.options.columns[_].editor?obj.options.columns[_].editor.closeEditor(o,s):obj.options.columns[_].type=="dropdown"||obj.options.columns[_].type=="autocomplete"?o.children[0].dropdown.close(!0):obj.options.columns[_].type=="calendar"?o.children[0].calendar.close(!0):obj.options.columns[_].type=="color"?o.children[0].color.close(!0):o.children[0].onblur=null,o.innerHTML=obj.edition&&obj.edition[1]?obj.edition[1]:"";obj.dispatch("oneditionend",el,o,_,_e,et,s),o.classList.remove("editor"),obj.edition=null},obj.getCell=function(o){o=jexcel.getIdFromColumnName(o,!0);var s=o[0],_=o[1];return obj.records[_][s]},obj.getColumnOptions=function(o,s){var _=obj.options.columns[o];return _||(_={type:"text"}),_},obj.getCellFromCoords=function(o,s){return obj.records[s][o]},obj.getLabel=function(o){o=jexcel.getIdFromColumnName(o,!0);var s=o[0],_=o[1];return obj.records[_][s].innerHTML},obj.getLabelFromCoords=function(o,s){return obj.records[s][o].innerHTML},obj.getValue=function(o,s){if(typeof o=="object")var _=o.getAttribute("data-x"),_e=o.getAttribute("data-y");else{o=jexcel.getIdFromColumnName(o,!0);var _=o[0],_e=o[1]}var et=null;return _!=null&&_e!=null&&(obj.records[_e]&&obj.records[_e][_]&&(s||obj.options.copyCompatibility==!0)?et=obj.records[_e][_].innerHTML:obj.options.data[_e]&&obj.options.data[_e][_]!="undefined"&&(et=obj.options.data[_e][_])),et},obj.getValueFromCoords=function(o,s,_){var _e=null;return o!=null&&s!=null&&(obj.records[s]&&obj.records[s][o]&&_||obj.options.copyCompatibility==!0?_e=obj.records[s][o].innerHTML:obj.options.data[s]&&obj.options.data[s][o]!="undefined"&&(_e=obj.options.data[s][o])),_e},obj.setValue=function(o,s,_){var _e=[];if(typeof o=="string"){var et=jexcel.getIdFromColumnName(o,!0),it=et[0],tt=et[1];_e.push(obj.updateCell(it,tt,s,_)),obj.updateFormulaChain(it,tt,_e)}else{var it=null,tt=null;if(o&&o.getAttribute)var it=o.getAttribute("data-x"),tt=o.getAttribute("data-y");if(it!=null&&tt!=null)_e.push(obj.updateCell(it,tt,s,_)),obj.updateFormulaChain(it,tt,_e);else{var rt=Object.keys(o);if(rt.length>0)for(var nt=0;nt<rt.length;nt++){if(typeof o[nt]=="string")var et=jexcel.getIdFromColumnName(o[nt],!0),it=et[0],tt=et[1];else if(o[nt].x!=null&&o[nt].y!=null){var it=o[nt].x,tt=o[nt].y;o[nt].newValue!=null?s=o[nt].newValue:o[nt].value!=null&&(s=o[nt].value)}else var it=o[nt].getAttribute("data-x"),tt=o[nt].getAttribute("data-y");it!=null&&tt!=null&&(_e.push(obj.updateCell(it,tt,s,_)),obj.updateFormulaChain(it,tt,_e))}}}obj.setHistory({action:"setValue",records:_e,selection:obj.selectedCell}),obj.updateTable(),obj.onafterchanges(el,_e)},obj.setValueFromCoords=function(o,s,_,_e){var et=[];et.push(obj.updateCell(o,s,_,_e)),obj.updateFormulaChain(o,s,et),obj.setHistory({action:"setValue",records:et,selection:obj.selectedCell}),obj.updateTable(),obj.onafterchanges(el,et)},obj.setCheckRadioValue=function(){for(var o=[],s=Object.keys(obj.highlighted),_=0;_<s.length;_++){var _e=obj.highlighted[_].getAttribute("data-x"),et=obj.highlighted[_].getAttribute("data-y");(obj.options.columns[_e].type=="checkbox"||obj.options.columns[_e].type=="radio")&&o.push(obj.updateCell(_e,et,!obj.options.data[et][_e]))}o.length&&(obj.setHistory({action:"setValue",records:o,selection:obj.selectedCell}),obj.onafterchanges(el,o))};var stripScript=function(o){var s=new Option;s.innerHTML=o;var _=null;for(o=s.getElementsByTagName("script");_=o[0];)_.parentNode.removeChild(_);return s.innerHTML};obj.updateCell=function(o,s,_,_e){if(obj.records[s][o].classList.contains("readonly")==!0&&!_e)var et={x:o,y:s,col:o,row:s};else{if((""+_).substr(0,1)=="="&&obj.options.secureFormulas==!0){var it=secureFormula(_);it!=_&&(_=it)}var it=obj.dispatch("onbeforechange",el,obj.records[s][o],o,s,_);it!=null&&(_=it),obj.options.columns[o].editor&&typeof obj.options.columns[o].editor.updateCell=="function"&&(_=obj.options.columns[o].editor.updateCell(obj.records[s][o],_,_e));var et={x:o,y:s,col:o,row:s,newValue:_,oldValue:obj.options.data[s][o]};if(obj.options.columns[o].editor)obj.options.data[s][o]=_;else if(obj.options.columns[o].type=="checkbox"||obj.options.columns[o].type=="radio"){if(obj.options.columns[o].type=="radio")for(var tt=0;tt<obj.options.data.length;tt++)obj.options.data[tt][o]=!1;obj.records[s][o].children[0].checked=_==1||_==!0||_=="true"||_=="TRUE",obj.options.data[s][o]=obj.records[s][o].children[0].checked}else if(obj.options.columns[o].type=="dropdown"||obj.options.columns[o].type=="autocomplete")obj.options.data[s][o]=_,obj.records[s][o].innerText=obj.getDropDownValue(o,_);else if(obj.options.columns[o].type=="calendar"){var rt=null;if(!validDate(_)){var nt=jSuites.calendar.extractDateFromString(_,obj.options.columns[o].options.format);nt&&(rt=nt)}obj.options.data[s][o]=_,obj.records[s][o].innerText=jSuites.calendar.getDateString(rt||_,obj.options.columns[o].options.format)}else if(obj.options.columns[o].type=="color")if(obj.options.data[s][o]=_,obj.options.columns[o].render=="square"){var ot=document.createElement("div");ot.className="color",ot.style.backgroundColor=_,obj.records[s][o].innerText="",obj.records[s][o].appendChild(ot)}else obj.records[s][o].style.color=_,obj.records[s][o].innerText=_;else if(obj.options.columns[o].type=="image"){if(_=""+_,obj.options.data[s][o]=_,obj.records[s][o].innerHTML="",_&&_.substr(0,10)=="data:image"){var st=document.createElement("img");st.src=_,obj.records[s][o].appendChild(st)}}else obj.options.data[s][o]=_,obj.options.columns[o].type=="html"?obj.records[s][o].innerHTML=stripScript(obj.parseValue(o,s,_)):obj.options.stripHTML===!1||obj.options.columns[o].stripHTML===!1?obj.records[s][o].innerHTML=stripScript(obj.parseValue(o,s,_,obj.records[s][o])):obj.records[s][o].innerText=obj.parseValue(o,s,_,obj.records[s][o]),obj.options.columns[o].wordWrap!=!1&&(obj.options.wordWrap==!0||obj.options.columns[o].wordWrap==!0||obj.records[s][o].innerHTML.length>200)?obj.records[s][o].style.whiteSpace="pre-wrap":obj.records[s][o].style.whiteSpace="";o>0&&(_?obj.records[s][o-1].style.overflow="hidden":obj.records[s][o-1].style.overflow=""),obj.dispatch("onchange",el,obj.records[s]&&obj.records[s][o]?obj.records[s][o]:null,o,s,_,et.oldValue)}return et},obj.copyData=function(o,s){var _=obj.getData(!0,!0),_e=obj.selectedContainer,et=parseInt(o.getAttribute("data-x")),it=parseInt(o.getAttribute("data-y")),tt=parseInt(s.getAttribute("data-x")),rt=parseInt(s.getAttribute("data-y")),nt=[],ot=!1;if(_e[0]==et){if(it<_e[1])var st=it-_e[1];else var st=1;var at=0}else{if(et<_e[0])var at=et-_e[0];else var at=1;var st=0}for(var lt=0,ct=0,ht=it;ht<=rt;ht++)if(!(obj.rows[ht]&&obj.rows[ht].style.display=="none")){if(_[ct]==null&&(ct=0),lt=0,_e[0]!=et)if(et<_e[0])var at=et-_e[0];else var at=1;for(var mt=et;mt<=tt;mt++){if(obj.records[ht][mt]&&!obj.records[ht][mt].classList.contains("readonly")&&obj.records[ht][mt].style.display!="none"&&ot==!1){if(!obj.selection.length&&obj.options.data[ht][mt]!=""){ot=!0;continue}(_[ct]==null||_[ct][lt]==null)&&(lt=0);var dt=_[ct][lt];if(dt&&!_[1]&&obj.options.autoIncrement==!0){if(obj.options.columns[mt].type=="text"||obj.options.columns[mt].type=="number")if((""+dt).substr(0,1)=="="){var ft=dt.match(/([A-Z]+[0-9]+)/g);if(ft){for(var ut=[],pt=0;pt<ft.length;pt++){var At=jexcel.getIdFromColumnName(ft[pt],1);At[0]+=at,At[1]+=st,At[1]<0&&(At[1]=0);var gt=jexcel.getColumnNameFromId([At[0],At[1]]);gt!=ft[pt]&&(ut[ft[pt]]=gt)}ut&&(dt=obj.updateFormula(dt,ut))}}else dt==Number(dt)&&(dt=Number(dt)+st);else if(obj.options.columns[mt].type=="calendar"){var vt=new Date(dt);vt.setDate(vt.getDate()+st),dt=vt.getFullYear()+"-"+jexcel.doubleDigitFormat(parseInt(vt.getMonth()+1))+"-"+jexcel.doubleDigitFormat(vt.getDate())+" 00:00:00"}}nt.push(obj.updateCell(mt,ht,dt)),obj.updateFormulaChain(mt,ht,nt)}lt++,_e[0]!=et&&at++}ct++,st++}obj.setHistory({action:"setValue",records:nt,selection:obj.selectedCell}),obj.updateTable(),obj.onafterchanges(el,nt)},obj.refreshSelection=function(){obj.selectedCell&&obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3])},obj.conditionalSelectionUpdate=function(o,s,_){if(o==1){if(obj.selectedCell&&(s>=obj.selectedCell[1]&&s<=obj.selectedCell[3]||_>=obj.selectedCell[1]&&_<=obj.selectedCell[3])){obj.resetSelection();return}}else if(obj.selectedCell&&(s>=obj.selectedCell[0]&&s<=obj.selectedCell[2]||_>=obj.selectedCell[0]&&_<=obj.selectedCell[2])){obj.resetSelection();return}},obj.resetSelection=function(o){if(obj.highlighted.length)for(var s=1,_=0;_<obj.highlighted.length;_++){obj.highlighted[_].classList.remove("highlight"),obj.highlighted[_].classList.remove("highlight-left"),obj.highlighted[_].classList.remove("highlight-right"),obj.highlighted[_].classList.remove("highlight-top"),obj.highlighted[_].classList.remove("highlight-bottom"),obj.highlighted[_].classList.remove("highlight-selected");var _e=parseInt(obj.highlighted[_].getAttribute("data-x")),et=parseInt(obj.highlighted[_].getAttribute("data-y"));if(obj.highlighted[_].getAttribute("data-merged"))var it=parseInt(obj.highlighted[_].getAttribute("colspan")),tt=parseInt(obj.highlighted[_].getAttribute("rowspan")),rt=it>0?_e+(it-1):_e,nt=tt>0?et+(tt-1):et;else var rt=_e,nt=et;for(var ot=_e;ot<=rt;ot++)obj.headers[ot]&&obj.headers[ot].classList.remove("selected");for(var ot=et;ot<=nt;ot++)obj.rows[ot]&&obj.rows[ot].classList.remove("selected")}else var s=0;return obj.highlighted=[],obj.selectedCell=null,obj.corner.style.top="-2000px",obj.corner.style.left="-2000px",o==!0&&s==1&&obj.dispatch("onblur",el),s},obj.updateSelection=function(o,s,_){var _e=o.getAttribute("data-x"),et=o.getAttribute("data-y");if(s)var it=s.getAttribute("data-x"),tt=s.getAttribute("data-y");else var it=_e,tt=et;obj.updateSelectionFromCoords(_e,et,it,tt,_)},obj.updateSelectionFromCoords=function(o,s,_,_e,et){var it=obj.resetSelection();if(s==null&&(s=0,_e=obj.rows.length-1),_==null&&(_=o),_e==null&&(_e=s),o>=obj.headers.length&&(o=obj.headers.length-1),s>=obj.rows.length&&(s=obj.rows.length-1),_>=obj.headers.length&&(_=obj.headers.length-1),_e>=obj.rows.length&&(_e=obj.rows.length-1),obj.selectedCell=[o,s,_,_e],o!=null){if(obj.records[s][o]&&obj.records[s][o].classList.add("highlight-selected"),parseInt(o)<parseInt(_))var tt=parseInt(o),rt=parseInt(_);else var tt=parseInt(_),rt=parseInt(o);if(parseInt(s)<parseInt(_e))var nt=parseInt(s),ot=parseInt(_e);else var nt=parseInt(_e),ot=parseInt(s);for(var st=tt;st<=rt;st++)for(var at=nt;at<=ot;at++)if(obj.records[at][st]&&obj.records[at][st].getAttribute("data-merged")){var lt=parseInt(obj.records[at][st].getAttribute("data-x")),ct=parseInt(obj.records[at][st].getAttribute("data-y")),ht=parseInt(obj.records[at][st].getAttribute("colspan")),mt=parseInt(obj.records[at][st].getAttribute("rowspan"));ht>1&&(lt<tt&&(tt=lt),lt+ht>rt&&(rt=lt+ht-1)),mt&&(ct<nt&&(nt=ct),ct+mt>ot&&(ot=ct+mt-1))}for(var dt=null,ft=null,ut=null,pt=null,at=nt;at<=ot;at++)obj.rows[at].style.display!="none"&&(ut==null&&(ut=at),pt=at);for(var st=tt;st<=rt;st++){for(var at=nt;at<=ot;at++)obj.rows[at].style.display!="none"&&obj.records[at][st].style.display!="none"&&(obj.records[at][st].classList.add("highlight"),obj.highlighted.push(obj.records[at][st]));obj.options.columns[st].type!="hidden"&&(dt==null&&(dt=st),ft=st)}dt||(dt=0),ft||(ft=0);for(var st=dt;st<=ft;st++)obj.options.columns[st].type!="hidden"&&(obj.records[ut]&&obj.records[ut][st]&&obj.records[ut][st].classList.add("highlight-top"),obj.records[pt]&&obj.records[pt][st]&&obj.records[pt][st].classList.add("highlight-bottom"),obj.headers[st].classList.add("selected"));for(var at=ut;at<=pt;at++)obj.rows[at]&&obj.rows[at].style.display!="none"&&(obj.records[at][dt].classList.add("highlight-left"),obj.records[at][ft].classList.add("highlight-right"),obj.rows[at].classList.add("selected"));obj.selectedContainer=[dt,ut,ft,pt]}it==0&&(obj.dispatch("onfocus",el),obj.removeCopyingSelection()),obj.dispatch("onselection",el,dt,ut,ft,pt,et),obj.updateCornerPosition()},obj.removeCopySelection=function(){for(var o=0;o<obj.selection.length;o++)obj.selection[o].classList.remove("selection"),obj.selection[o].classList.remove("selection-left"),obj.selection[o].classList.remove("selection-right"),obj.selection[o].classList.remove("selection-top"),obj.selection[o].classList.remove("selection-bottom");obj.selection=[]},obj.updateCopySelection=function(o,s){obj.removeCopySelection();var _=obj.selectedContainer[0],_e=obj.selectedContainer[1],et=obj.selectedContainer[2],it=obj.selectedContainer[3];if(o!=null&&s!=null){if(o-et>0)var tt=parseInt(et)+1,rt=parseInt(o);else var tt=parseInt(o),rt=parseInt(_)-1;if(s-it>0)var nt=parseInt(it)+1,ot=parseInt(s);else var nt=parseInt(s),ot=parseInt(_e)-1;if(rt-tt<=ot-nt)var tt=parseInt(_),rt=parseInt(et);else var nt=parseInt(_e),ot=parseInt(it);for(var st=nt;st<=ot;st++)for(var at=tt;at<=rt;at++)obj.records[st][at]&&obj.rows[st].style.display!="none"&&obj.records[st][at].style.display!="none"&&(obj.records[st][at].classList.add("selection"),obj.records[nt][at].classList.add("selection-top"),obj.records[ot][at].classList.add("selection-bottom"),obj.records[st][tt].classList.add("selection-left"),obj.records[st][rt].classList.add("selection-right"),obj.selection.push(obj.records[st][at]))}},obj.updateCornerPosition=function(){if(!obj.highlighted.length)obj.corner.style.top="-2000px",obj.corner.style.left="-2000px";else{var o=obj.highlighted[obj.highlighted.length-1],s=obj.content.getBoundingClientRect(),_=s.left,_e=s.top,et=o.getBoundingClientRect(),it=et.left,tt=et.top,rt=et.width,nt=et.height,ot=it-_+obj.content.scrollLeft+rt-4,st=tt-_e+obj.content.scrollTop+nt-4;if(obj.corner.style.top=st+"px",obj.corner.style.left=ot+"px",obj.options.freezeColumns){var at=obj.getFreezeWidth();it-_+rt<at?obj.corner.style.display="none":obj.options.selectionCopy==!0&&(obj.corner.style.display="")}else obj.options.selectionCopy==!0&&(obj.corner.style.display="")}},obj.updateScroll=function(o){var s=obj.content.getBoundingClientRect(),_=s.left,_e=s.top,et=s.width,it=s.height,tt=obj.records[obj.selectedCell[3]][obj.selectedCell[2]],rt=tt.getBoundingClientRect(),nt=rt.left,ot=rt.top,st=rt.width,at=rt.height;if(o==0||o==1)var lt=nt-_+obj.content.scrollLeft,ct=ot-_e+obj.content.scrollTop-2;else var lt=nt-_+obj.content.scrollLeft+st,ct=ot-_e+obj.content.scrollTop+at;ct>obj.content.scrollTop+30&&ct<obj.content.scrollTop+it||(ct<obj.content.scrollTop+30?obj.content.scrollTop=ct-at:obj.content.scrollTop=ct-(it-2));var ht=obj.getFreezeWidth();lt>obj.content.scrollLeft+ht&&lt<obj.content.scrollLeft+et||(lt<obj.content.scrollLeft+30?(obj.content.scrollLeft=lt,obj.content.scrollLeft<50&&(obj.content.scrollLeft=0)):lt<obj.content.scrollLeft+ht?obj.content.scrollLeft=lt-ht-1:obj.content.scrollLeft=lt-(et-20))},obj.getWidth=function(o){if(o)typeof o=="object"&&(o=$(o).getAttribute("data-x")),s=obj.colgroup[o].getAttribute("width");else for(var s=[],_=0;_<obj.headers.length;_++)s.push(obj.options.columns[_].width);return s},obj.setWidth=function(o,s,_){if(s){if(Array.isArray(o)){if(!_)var _=[];for(var _e=0;_e<o.length;_e++){_[_e]||(_[_e]=obj.colgroup[o[_e]].getAttribute("width"));var et=Array.isArray(s)&&s[_e]?s[_e]:s;obj.colgroup[o[_e]].setAttribute("width",et),obj.options.columns[o[_e]].width=et}}else _||(_=obj.colgroup[o].getAttribute("width")),obj.colgroup[o].setAttribute("width",s),obj.options.columns[o].width=s;obj.setHistory({action:"setWidth",column:o,oldValue:_,newValue:s}),obj.dispatch("onresizecolumn",el,o,s,_),obj.updateCornerPosition()}},obj.setHeight=function(o,s,_){if(s>0){if(typeof o=="object"&&(o=o.getAttribute("data-y")),!_&&(_=obj.rows[o].getAttribute("height"),!_)){var _e=obj.rows[o].getBoundingClientRect();_=_e.height}s=parseInt(s),obj.rows[o].style.height=s+"px",obj.options.rows[o]||(obj.options.rows[o]={}),obj.options.rows[o].height=s,obj.setHistory({action:"setHeight",row:o,oldValue:_,newValue:s}),obj.dispatch("onresizerow",el,o,s,_),obj.updateCornerPosition()}},obj.getHeight=function(o){if(o){typeof o=="object"&&(o=$(o).getAttribute("data-y"));var s=obj.rows[o].style.height}else for(var s=[],_=0;_<obj.rows.length;_++){var _e=obj.rows[_].style.height;_e&&(s[_]=_e)}return s},obj.setFooter=function(o){if(o&&(obj.options.footers=o),obj.options.footers){obj.tfoot||(obj.tfoot=document.createElement("tfoot"),obj.table.appendChild(obj.tfoot));for(var s=0;s<obj.options.footers.length;s++){if(obj.tfoot.children[s])var _=obj.tfoot.children[s];else{var _=document.createElement("tr"),_e=document.createElement("td");_.appendChild(_e),obj.tfoot.appendChild(_)}for(var et=0;et<obj.headers.length;et++){if(obj.options.footers[s][et]||(obj.options.footers[s][et]=""),obj.tfoot.children[s].children[et+1])var _e=obj.tfoot.children[s].children[et+1];else{var _e=document.createElement("td");_.appendChild(_e);var it=obj.options.columns[et].align?obj.options.columns[et].align:"center";_e.style.textAlign=it}_e.innerText=obj.parseValue(+obj.records.length+et,s,obj.options.footers[s][et])}}}},obj.getHeader=function(o){return obj.headers[o].innerText},obj.setHeader=function(o,s){if(obj.headers[o]){var _=obj.headers[o].innerText;s||(s=prompt(obj.options.text.columnName,_)),s&&(obj.headers[o].innerText=s,obj.headers[o].setAttribute("title",s),obj.options.columns[o].title=s),obj.setHistory({action:"setHeader",column:o,oldValue:_,newValue:s}),obj.dispatch("onchangeheader",el,o,_,s)}},obj.getHeaders=function(o){for(var s=[],_=0;_<obj.headers.length;_++)s.push(obj.getHeader(_));return o?s:s.join(obj.options.csvDelimiter)},obj.getMeta=function(o,s){return o?s?obj.options.meta[o]&&obj.options.meta[o][s]?obj.options.meta[o][s]:null:obj.options.meta[o]?obj.options.meta[o]:null:obj.options.meta},obj.setMeta=function(o,s,_){if(obj.options.meta||(obj.options.meta={}),s&&_)obj.options.meta[o]||(obj.options.meta[o]={}),obj.options.meta[o][s]=_;else for(var _e=Object.keys(o),et=0;et<_e.length;et++){obj.options.meta[_e[et]]||(obj.options.meta[_e[et]]={});for(var it=Object.keys(o[_e[et]]),tt=0;tt<it.length;tt++)obj.options.meta[_e[et]][it[tt]]=o[_e[et]][it[tt]]}obj.dispatch("onchangemeta",el,o,s,_)},obj.updateMeta=function(o){if(obj.options.meta){for(var s={},_=Object.keys(obj.options.meta),_e=0;_e<_.length;_e++)o[_[_e]]?s[o[_[_e]]]=obj.options.meta[_[_e]]:s[_[_e]]=obj.options.meta[_[_e]];obj.options.meta=s}},obj.getStyle=function(o,s){if(o)return o=jexcel.getIdFromColumnName(o,!0),s?obj.records[o[1]][o[0]].style[s]:obj.records[o[1]][o[0]].getAttribute("style");for(var _={},_e=obj.options.data[0].length,et=obj.options.data.length,it=0;it<et;it++)for(var tt=0;tt<_e;tt++){var rt=s?obj.records[it][tt].style[s]:obj.records[it][tt].getAttribute("style");if(rt){var nt=jexcel.getColumnNameFromId([tt,it]);_[nt]=rt}}return _},obj.resetStyle=function(o,s){for(var _=Object.keys(o),_e=0;_e<_.length;_e++){var et=jexcel.getIdFromColumnName(_[_e],!0);obj.records[et[1]]&&obj.records[et[1]][et[0]]&&obj.records[et[1]][et[0]].setAttribute("style","")}obj.setStyle(o,null,null,null,s)},obj.setStyle=function(o,s,_,_e,et){var it={},tt={},rt=function(dt,ft,ut){var pt=jexcel.getIdFromColumnName(dt,!0);if(obj.records[pt[1]]&&obj.records[pt[1]][pt[0]]&&(obj.records[pt[1]][pt[0]].classList.contains("readonly")==!1||_e)){var At=obj.records[pt[1]][pt[0]].style[ft];At==ut&&!_e?(ut="",obj.records[pt[1]][pt[0]].style[ft]=""):obj.records[pt[1]][pt[0]].style[ft]=ut,tt[dt]||(tt[dt]=[]),it[dt]||(it[dt]=[]),tt[dt].push([ft+":"+At]),it[dt].push([ft+":"+ut])}};if(s&&_)if(typeof o=="string")rt(o,s,_);else for(var nt=[],ot=0;ot<o.length;ot++){var st=o[ot].getAttribute("data-x"),at=o[ot].getAttribute("data-y"),lt=jexcel.getColumnNameFromId([st,at]);nt[lt]||(rt(lt,s,_),nt[lt]=!0)}else for(var mt=Object.keys(o),ot=0;ot<mt.length;ot++){var ct=o[mt[ot]];typeof ct=="string"&&(ct=ct.split(";"));for(var ht=0;ht<ct.length;ht++)typeof ct[ht]=="string"&&(ct[ht]=ct[ht].split(":")),ct[ht][0].trim()&&rt(mt[ot],ct[ht][0].trim(),ct[ht][1])}for(var mt=Object.keys(tt),ot=0;ot<mt.length;ot++)tt[mt[ot]]=tt[mt[ot]].join(";");for(var mt=Object.keys(it),ot=0;ot<mt.length;ot++)it[mt[ot]]=it[mt[ot]].join(";");et||obj.setHistory({action:"setStyle",oldValue:tt,newValue:it}),obj.dispatch("onchangestyle",el,o,s,_)},obj.getComments=function(o,s){if(o){if(typeof o=="string")var o=jexcel.getIdFromColumnName(o,!0);return s?[obj.records[o[1]][o[0]].getAttribute("title"),obj.records[o[1]][o[0]].getAttribute("author")]:obj.records[o[1]][o[0]].getAttribute("title")||""}else{for(var _={},_e=0;_e<obj.options.data.length;_e++)for(var et=0;et<obj.options.columns.length;et++){var it=obj.records[_e][et].getAttribute("title");if(it){var o=jexcel.getColumnNameFromId([et,_e]);_[o]=it}}return _}},obj.setComments=function(o,s,it){if(typeof o=="string")var _e=jexcel.getIdFromColumnName(o,!0);else var _e=o;var et=obj.records[_e[1]][_e[0]].getAttribute("title"),it=obj.records[_e[1]][_e[0]].getAttribute("data-author"),tt=[et,it];obj.records[_e[1]][_e[0]].setAttribute("title",s||""),obj.records[_e[1]][_e[0]].setAttribute("data-author",it||""),s?obj.records[_e[1]][_e[0]].classList.add("jexcel_comments"):obj.records[_e[1]][_e[0]].classList.remove("jexcel_comments"),obj.setHistory({action:"setComments",column:o,newValue:[s,it],oldValue:tt}),obj.dispatch("oncomments",el,s,et,_e,_e[0],_e[1])},obj.getConfig=function(){var o=obj.options;return o.style=obj.getStyle(),o.mergeCells=obj.getMerge(),o.comments=obj.getComments(),o},obj.orderBy=function(o,s){if(o>=0){if(Object.keys(obj.options.mergeCells).length>0)if(confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))obj.destroyMerged();else return!1;s==null?s=obj.headers[o].classList.contains("arrow-down")?1:0:s=s?1:0;var _=[];if(obj.options.columns[o].type=="number"||obj.options.columns[o].type=="percentage"||obj.options.columns[o].type=="autonumber"||obj.options.columns[o].type=="color")for(var _e=0;_e<obj.options.data.length;_e++)_[_e]=[_e,Number(obj.options.data[_e][o])];else if(obj.options.columns[o].type=="calendar"||obj.options.columns[o].type=="checkbox"||obj.options.columns[o].type=="radio")for(var _e=0;_e<obj.options.data.length;_e++)_[_e]=[_e,obj.options.data[_e][o]];else for(var _e=0;_e<obj.options.data.length;_e++)_[_e]=[_e,obj.records[_e][o].innerText.toLowerCase()];typeof obj.options.sorting!="function"&&(obj.options.sorting=function(it){return function(tt,rt){var nt=tt[1],ot=rt[1];return it?nt===""&&ot!==""?1:nt!==""&&ot===""||nt>ot?-1:nt<ot?1:0:nt===""&&ot!==""?1:nt!==""&&ot===""?-1:nt>ot?1:nt<ot?-1:0}}),_=_.sort(obj.options.sorting(s));for(var et=[],_e=0;_e<_.length;_e++)et[_e]=_[_e][0];return obj.setHistory({action:"orderBy",rows:et,column:o,order:s}),obj.updateOrderArrow(o,s),obj.updateOrder(et),obj.dispatch("onsort",el,o,s),!0}},obj.updateOrderArrow=function(o,s){for(var _=0;_<obj.headers.length;_++)obj.headers[_].classList.remove("arrow-up"),obj.headers[_].classList.remove("arrow-down");s?obj.headers[o].classList.add("arrow-up"):obj.headers[o].classList.add("arrow-down")},obj.updateOrder=function(o){for(var _=[],s=0;s<o.length;s++)_[s]=obj.options.data[o[s]];obj.options.data=_;for(var _=[],s=0;s<o.length;s++)_[s]=obj.records[o[s]];obj.records=_;for(var _=[],s=0;s<o.length;s++)_[s]=obj.rows[o[s]];if(obj.rows=_,obj.updateTableReferences(),obj.results&&obj.results.length)obj.searchInput.value?obj.search(obj.searchInput.value):obj.closeFilter();else if(obj.results=null,obj.pageNumber=0,obj.options.pagination>0)obj.page(0);else if(obj.options.lazyLoading==!0)obj.loadPage(0);else for(var s=0;s<obj.rows.length;s++)obj.tbody.appendChild(obj.rows[s])},obj.moveRow=function(o,s,_){if(Object.keys(obj.options.mergeCells).length>0){if(o>s)var _e=1;else var _e=0;if(obj.isRowMerged(o).length||obj.isRowMerged(s,_e).length)if(confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))obj.destroyMerged();else return!1}if(obj.options.search==!0){if(obj.results&&obj.results.length!=obj.rows.length)if(confirm(obj.options.text.thisActionWillClearYourSearchResultsAreYouSure))obj.resetSearch();else return!1;obj.results=null}_||(Array.prototype.indexOf.call(obj.tbody.children,obj.rows[s])>=0?o>s?obj.tbody.insertBefore(obj.rows[o],obj.rows[s]):obj.tbody.insertBefore(obj.rows[o],obj.rows[s].nextSibling):obj.tbody.removeChild(obj.rows[o])),obj.rows.splice(s,0,obj.rows.splice(o,1)[0]),obj.records.splice(s,0,obj.records.splice(o,1)[0]),obj.options.data.splice(s,0,obj.options.data.splice(o,1)[0]),obj.options.pagination>0&&obj.tbody.children.length!=obj.options.pagination&&obj.page(obj.pageNumber),obj.setHistory({action:"moveRow",oldValue:o,newValue:s}),obj.updateTableReferences(),obj.dispatch("onmoverow",el,o,s)},obj.insertRow=function(o,s,_){if(obj.options.allowInsertRow==!0){var _e=[];if(o>0)var et=o;else{var et=1;o&&(_e=o)}var _=!!_,it=obj.options.data.length-1;if((s==null||s>=parseInt(it)||s<0)&&(s=it),obj.dispatch("onbeforeinsertrow",el,s,et,_)===!1)return!1;if(Object.keys(obj.options.mergeCells).length>0&&obj.isRowMerged(s,_).length)if(confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))obj.destroyMerged();else return!1;if(obj.options.search==!0){if(obj.results&&obj.results.length!=obj.rows.length)if(confirm(obj.options.text.thisActionWillClearYourSearchResultsAreYouSure))obj.resetSearch();else return!1;obj.results=null}for(var tt=_?s:s+1,rt=obj.records.splice(tt),nt=obj.options.data.splice(tt),ot=obj.rows.splice(tt),st=[],at=[],lt=[],ct=tt;ct<et+tt;ct++){obj.options.data[ct]=[];for(var ht=0;ht<obj.options.columns.length;ht++)obj.options.data[ct][ht]=_e[ht]?_e[ht]:"";var mt=obj.createRow(ct,obj.options.data[ct]);ot[0]?Array.prototype.indexOf.call(obj.tbody.children,ot[0])>=0&&obj.tbody.insertBefore(mt,ot[0]):Array.prototype.indexOf.call(obj.tbody.children,obj.rows[s])>=0&&obj.tbody.appendChild(mt),st.push(obj.records[ct]),at.push(obj.options.data[ct]),lt.push(mt)}Array.prototype.push.apply(obj.records,rt),Array.prototype.push.apply(obj.options.data,nt),Array.prototype.push.apply(obj.rows,ot),obj.options.pagination>0&&obj.page(obj.pageNumber),obj.setHistory({action:"insertRow",rowNumber:s,numOfRows:et,insertBefore:_,rowRecords:st,rowData:at,rowNode:lt}),obj.updateTableReferences(),obj.dispatch("oninsertrow",el,s,et,st,_)}},obj.deleteRow=function(o,s){if(obj.options.allowDeleteRow==!0)if(obj.options.allowDeletingAllRows==!0||obj.options.data.length>1){if(o==null){var _=obj.getSelectedRows();_[0]?(o=parseInt(_[0].getAttribute("data-y")),s=_.length):(o=obj.options.data.length-1,s=1)}var _e=obj.options.data.length-1;if((o==null||o>_e||o<0)&&(o=_e),s||(s=1),o+s>=obj.options.data.length&&(s=obj.options.data.length-o),obj.dispatch("onbeforedeleterow",el,o,s)===!1)return!1;if(parseInt(o)>-1){var et=!1;if(Object.keys(obj.options.mergeCells).length>0)for(var it=o;it<o+s;it++)obj.isRowMerged(it,!1).length&&(et=!0);if(et)if(confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))obj.destroyMerged();else return!1;if(obj.options.search==!0){if(obj.results&&obj.results.length!=obj.rows.length)if(confirm(obj.options.text.thisActionWillClearYourSearchResultsAreYouSure))obj.resetSearch();else return!1;obj.results=null}obj.options.allowDeletingAllRows==!1&&_e+1===s&&(s--,console.error("Jspreadsheet: It is not possible to delete the last row"));for(var it=o;it<o+s;it++)Array.prototype.indexOf.call(obj.tbody.children,obj.rows[it])>=0&&(obj.rows[it].className="",obj.rows[it].parentNode.removeChild(obj.rows[it]));var tt=obj.records.splice(o,s),rt=obj.options.data.splice(o,s),nt=obj.rows.splice(o,s);obj.options.pagination>0&&obj.tbody.children.length!=obj.options.pagination&&obj.page(obj.pageNumber),obj.conditionalSelectionUpdate(1,o,o+s-1),obj.setHistory({action:"deleteRow",rowNumber:o,numOfRows:s,insertBefore:1,rowRecords:tt,rowData:rt,rowNode:nt}),obj.updateTableReferences(),obj.dispatch("ondeleterow",el,o,s,tt)}}else console.error("Jspreadsheet: It is not possible to delete the last row")},obj.moveColumn=function(_e,et){if(Object.keys(obj.options.mergeCells).length>0){if(_e>et)var _=1;else var _=0;if(obj.isColMerged(_e).length||obj.isColMerged(et,_).length)if(confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))obj.destroyMerged();else return!1}var _e=parseInt(_e),et=parseInt(et);if(_e>et){obj.headerContainer.insertBefore(obj.headers[_e],obj.headers[et]),obj.colgroupContainer.insertBefore(obj.colgroup[_e],obj.colgroup[et]);for(var it=0;it<obj.rows.length;it++)obj.rows[it].insertBefore(obj.records[it][_e],obj.records[it][et])}else{obj.headerContainer.insertBefore(obj.headers[_e],obj.headers[et].nextSibling),obj.colgroupContainer.insertBefore(obj.colgroup[_e],obj.colgroup[et].nextSibling);for(var it=0;it<obj.rows.length;it++)obj.rows[it].insertBefore(obj.records[it][_e],obj.records[it][et].nextSibling)}obj.options.columns.splice(et,0,obj.options.columns.splice(_e,1)[0]),obj.headers.splice(et,0,obj.headers.splice(_e,1)[0]),obj.colgroup.splice(et,0,obj.colgroup.splice(_e,1)[0]);for(var it=0;it<obj.rows.length;it++)obj.options.data[it].splice(et,0,obj.options.data[it].splice(_e,1)[0]),obj.records[it].splice(et,0,obj.records[it].splice(_e,1)[0]);if(obj.options.footers)for(var it=0;it<obj.options.footers.length;it++)obj.options.footers[it].splice(et,0,obj.options.footers[it].splice(_e,1)[0]);obj.setHistory({action:"moveColumn",oldValue:_e,newValue:et}),obj.updateTableReferences(),obj.dispatch("onmovecolumn",el,_e,et)},obj.insertColumn=function(o,s,_,_e){if(obj.options.allowInsertColumn==!0){var et=[];if(o>0)var it=o;else{var it=1;o&&(et=o)}var _=!!_,tt=obj.options.columns.length-1;if((s==null||s>=parseInt(tt)||s<0)&&(s=tt),obj.dispatch("onbeforeinsertcolumn",el,s,it,_)===!1)return!1;if(Object.keys(obj.options.mergeCells).length>0&&obj.isColMerged(s,_).length)if(confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))obj.destroyMerged();else return!1;_e||(_e=[]);for(var rt=0;rt<it;rt++)_e[rt]||(_e[rt]={type:"text",source:[],options:[],width:obj.options.defaultColWidth,align:obj.options.defaultColAlign});var nt=_?s:s+1;obj.options.columns=jexcel.injectArray(obj.options.columns,nt,_e);for(var ot=obj.headers.splice(nt),st=obj.colgroup.splice(nt),at=[],lt=[],ct=[],ht=[],mt=[],dt=nt;dt<it+nt;dt++)obj.createCellHeader(dt),obj.headerContainer.insertBefore(obj.headers[dt],obj.headerContainer.children[dt+1]),obj.colgroupContainer.insertBefore(obj.colgroup[dt],obj.colgroupContainer.children[dt+1]),at.push(obj.headers[dt]),lt.push(obj.colgroup[dt]);if(obj.options.footers)for(var ft=0;ft<obj.options.footers.length;ft++){mt[ft]=[];for(var rt=0;rt<it;rt++)mt[ft].push("");obj.options.footers[ft].splice(nt,0,mt[ft])}for(var ut=0;ut<obj.options.data.length;ut++){var pt=obj.options.data[ut].splice(nt),At=obj.records[ut].splice(nt);ht[ut]=[],ct[ut]=[];for(var dt=nt;dt<it+nt;dt++){var gt=et[ut]?et[ut]:"";obj.options.data[ut][dt]=gt;var vt=obj.createCell(dt,ut,obj.options.data[ut][dt]);obj.records[ut][dt]=vt,obj.rows[ut]&&obj.rows[ut].insertBefore(vt,obj.rows[ut].children[dt+1]),ht[ut].push(gt),ct[ut].push(vt)}Array.prototype.push.apply(obj.options.data[ut],pt),Array.prototype.push.apply(obj.records[ut],At)}if(Array.prototype.push.apply(obj.headers,ot),Array.prototype.push.apply(obj.colgroup,st),obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var ft=0;ft<obj.options.nestedHeaders.length;ft++){var yt=parseInt(obj.options.nestedHeaders[ft][obj.options.nestedHeaders[ft].length-1].colspan)+it;obj.options.nestedHeaders[ft][obj.options.nestedHeaders[ft].length-1].colspan=yt,obj.thead.children[ft].children[obj.thead.children[ft].children.length-1].setAttribute("colspan",yt);var bt=obj.thead.children[ft].children[obj.thead.children[ft].children.length-1].getAttribute("data-column");bt=bt.split(",");for(var dt=nt;dt<it+nt;dt++)bt.push(dt);obj.thead.children[ft].children[obj.thead.children[ft].children.length-1].setAttribute("data-column",bt)}else{var yt=parseInt(obj.options.nestedHeaders[0].colspan)+it;obj.options.nestedHeaders[0].colspan=yt,obj.thead.children[0].children[obj.thead.children[0].children.length-1].setAttribute("colspan",yt)}obj.setHistory({action:"insertColumn",columnNumber:s,numOfColumns:it,insertBefore:_,columns:_e,headers:at,colgroup:lt,records:ct,footers:mt,data:ht}),obj.updateTableReferences(),obj.dispatch("oninsertcolumn",el,s,it,ct,_)}},obj.deleteColumn=function(o,s){if(obj.options.allowDeleteColumn==!0)if(obj.headers.length>1){if(o==null){var _=obj.getSelectedColumns(!0);_.length?(o=parseInt(_[0]),s=parseInt(_.length)):(o=obj.headers.length-1,s=1)}var _e=obj.options.data[0].length-1;if((o==null||o>_e||o<0)&&(o=_e),s||(s=1),s>obj.options.data[0].length-o&&(s=obj.options.data[0].length-o),obj.dispatch("onbeforedeletecolumn",el,o,s)===!1)return!1;if(parseInt(o)>-1){var et=!1;if(Object.keys(obj.options.mergeCells).length>0)for(var it=o;it<o+s;it++)obj.isColMerged(it,!1).length&&(et=!0);if(et)if(confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))obj.destroyMerged();else return!1;for(var tt=obj.options.columns.splice(o,s),it=o;it<o+s;it++)obj.colgroup[it].className="",obj.headers[it].className="",obj.colgroup[it].parentNode.removeChild(obj.colgroup[it]),obj.headers[it].parentNode.removeChild(obj.headers[it]);for(var rt=obj.headers.splice(o,s),nt=obj.colgroup.splice(o,s),ot=[],st=[],at=[],lt=0;lt<obj.options.data.length;lt++)for(var it=o;it<o+s;it++)obj.records[lt][it].className="",obj.records[lt][it].parentNode.removeChild(obj.records[lt][it]);for(var lt=0;lt<obj.options.data.length;lt++)st[lt]=obj.options.data[lt].splice(o,s),ot[lt]=obj.records[lt].splice(o,s);if(obj.options.footers)for(var lt=0;lt<obj.options.footers.length;lt++)at[lt]=obj.options.footers[lt].splice(o,s);if(obj.conditionalSelectionUpdate(0,o,o+s-1),obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var ct=0;ct<obj.options.nestedHeaders.length;ct++){var ht=parseInt(obj.options.nestedHeaders[ct][obj.options.nestedHeaders[ct].length-1].colspan)-s;obj.options.nestedHeaders[ct][obj.options.nestedHeaders[ct].length-1].colspan=ht,obj.thead.children[ct].children[obj.thead.children[ct].children.length-1].setAttribute("colspan",ht)}else{var ht=parseInt(obj.options.nestedHeaders[0].colspan)-s;obj.options.nestedHeaders[0].colspan=ht,obj.thead.children[0].children[obj.thead.children[0].children.length-1].setAttribute("colspan",ht)}obj.setHistory({action:"deleteColumn",columnNumber:o,numOfColumns:s,insertBefore:1,columns:tt,headers:rt,colgroup:nt,records:ot,footers:at,data:st}),obj.updateTableReferences(),obj.dispatch("ondeletecolumn",el,o,s,ot)}}else console.error("Jspreadsheet: It is not possible to delete the last column")},obj.getSelectedRows=function(o){for(var s=[],_=0;_<obj.rows.length;_++)obj.rows[_].classList.contains("selected")&&(o?s.push(_):s.push(obj.rows[_]));return s},obj.getSelectedColumns=function(){for(var o=[],s=0;s<obj.headers.length;s++)obj.headers[s].classList.contains("selected")&&o.push(s);return o},obj.getHighlighted=function(){return obj.highlighted},obj.updateTableReferences=function(){for(var o=0;o<obj.headers.length;o++){var s=obj.headers[o].getAttribute("data-x");s!=o&&(obj.headers[o].setAttribute("data-x",o),obj.headers[o].getAttribute("title")||(obj.headers[o].innerHTML=jexcel.getColumnName(o)))}for(var _=0;_<obj.rows.length;_++)if(obj.rows[_]){var _e=obj.rows[_].getAttribute("data-y");_e!=_&&(obj.rows[_].setAttribute("data-y",_),obj.rows[_].children[0].setAttribute("data-y",_),obj.rows[_].children[0].innerHTML=_+1)}for(var et=[],it=[],tt=function(ct,ht,mt,dt){if(ct!=mt&&obj.records[dt][mt].setAttribute("data-x",mt),ht!=dt&&obj.records[dt][mt].setAttribute("data-y",dt),ct!=mt||ht!=dt){var ft=jexcel.getColumnNameFromId([ct,ht]),ut=jexcel.getColumnNameFromId([mt,dt]);et[ft]=ut}},_=0;_<obj.records.length;_++)for(var o=0;o<obj.records[0].length;o++)if(obj.records[_][o]){var s=obj.records[_][o].getAttribute("data-x"),_e=obj.records[_][o].getAttribute("data-y");if(obj.records[_][o].getAttribute("data-merged")){var rt=jexcel.getColumnNameFromId([s,_e]),nt=jexcel.getColumnNameFromId([o,_]);if(it[rt]==null)if(rt==nt)it[rt]=!1;else{var ot=parseInt(o-s),st=parseInt(_-_e);it[rt]=[nt,ot,st]}}else tt(s,_e,o,_)}var at=Object.keys(it);if(at.length){for(var o=0;o<at.length;o++)if(it[at[o]]){var lt=jexcel.getIdFromColumnName(at[o],!0),s=lt[0],_e=lt[1];tt(s,_e,s+it[at[o]][1],_e+it[at[o]][2]);for(var rt=at[o],nt=it[at[o]][0],_=0;_<obj.options.mergeCells[rt][2].length;_++){var s=parseInt(obj.options.mergeCells[rt][2][_].getAttribute("data-x")),_e=parseInt(obj.options.mergeCells[rt][2][_].getAttribute("data-y"));obj.options.mergeCells[rt][2][_].setAttribute("data-x",s+it[at[o]][1]),obj.options.mergeCells[rt][2][_].setAttribute("data-y",_e+it[at[o]][2])}obj.options.mergeCells[nt]=obj.options.mergeCells[rt],delete obj.options.mergeCells[rt]}}obj.updateFormulas(et),obj.updateMeta(et),obj.refreshSelection(),obj.updateTable()},obj.updateTable=function(){if(obj.options.minSpareRows>0){for(var o=0,s=obj.rows.length-1;s>=0;s--){for(var _=!1,_e=0;_e<obj.headers.length;_e++)obj.options.data[s][_e]&&(_=!0);if(_)break;o++}obj.options.minSpareRows-o>0&&obj.insertRow(obj.options.minSpareRows-o)}if(obj.options.minSpareCols>0){for(var et=0,_e=obj.headers.length-1;_e>=0;_e--){for(var _=!1,s=0;s<obj.rows.length;s++)obj.options.data[s][_e]&&(_=!0);if(_)break;et++}obj.options.minSpareCols-et>0&&obj.insertColumn(obj.options.minSpareCols-et)}if(typeof obj.options.updateTable=="function"){obj.options.detachForUpdates&&el.removeChild(obj.content);for(var s=0;s<obj.rows.length;s++)for(var _e=0;_e<obj.headers.length;_e++)obj.options.updateTable(el,obj.records[s][_e],_e,s,obj.options.data[s][_e],obj.records[s][_e].innerText,jexcel.getColumnNameFromId([_e,s]));obj.options.detachForUpdates&&el.insertBefore(obj.content,obj.pagination)}obj.options.footers&&obj.setFooter(),setTimeout(function(){obj.updateCornerPosition()},0)},obj.isReadOnly=function(o){if(o=obj.getCell(o))return!!o.classList.contains("readonly")},obj.setReadOnly=function(o,s){(o=obj.getCell(o))&&(s?o.classList.add("readonly"):o.classList.remove("readonly"))},obj.showRow=function(o){obj.rows[o].style.display=""},obj.hideRow=function(o){obj.rows[o].style.display="none"},obj.showColumn=function(o){obj.headers[o].style.display="",obj.colgroup[o].style.display="";for(var s=0;s<obj.options.data.length;s++)obj.records[s][o].style.display=""},obj.hideColumn=function(o){obj.headers[o].style.display="none",obj.colgroup[o].style.display="none";for(var s=0;s<obj.options.data.length;s++)obj.records[s][o].style.display="none"},obj.showIndex=function(){obj.table.classList.remove("jexcel_hidden_index")},obj.hideIndex=function(){obj.table.classList.add("jexcel_hidden_index")};var chainLoopProtection=[];obj.updateFormulaChain=function(o,s,_){var _e=jexcel.getColumnNameFromId([o,s]);if(obj.formula[_e]&&obj.formula[_e].length>0)if(chainLoopProtection[_e])obj.records[s][o].innerHTML="#ERROR",obj.formula[_e]="";else{chainLoopProtection[_e]=!0;for(var et=0;et<obj.formula[_e].length;et++){var it=jexcel.getIdFromColumnName(obj.formula[_e][et],!0),tt=""+obj.options.data[it[1]][it[0]];tt.substr(0,1)=="="?_.push(obj.updateCell(it[0],it[1],tt,!0)):Object.keys(obj.formula)[et]=null,obj.updateFormulaChain(it[0],it[1],_)}}chainLoopProtection=[]},obj.updateFormulas=function(o){for(var s=0;s<obj.options.data.length;s++)for(var _=0;_<obj.options.data[0].length;_++){var _e=""+obj.options.data[s][_];if(_e.substr(0,1)=="="){var et=obj.updateFormula(_e,o);et!=_e&&(obj.options.data[s][_]=et)}}for(var it=[],tt=Object.keys(obj.formula),s=0;s<tt.length;s++){var rt=tt[s],_e=obj.formula[rt];o[rt]&&(rt=o[rt]),it[rt]=[];for(var _=0;_<_e.length;_++){var nt=_e[_];o[nt]&&(nt=o[nt]),it[rt].push(nt)}}obj.formula=it},obj.updateFormula=function(o,s){for(var _=/[A-Z]/,_e=/[0-9]/,et="",it=null,tt=null,rt="",nt=0;nt<o.length;nt++)_.exec(o[nt])?(it=1,tt=0,rt+=o[nt]):_e.exec(o[nt])?(tt=it?1:0,rt+=o[nt]):(it&&tt&&(rt=s[rt]?s[rt]:rt),et+=rt,et+=o[nt],it=0,tt=0,rt="");return rt&&(it&&tt&&(rt=s[rt]?s[rt]:rt),et+=rt),et};var secureFormula=function(o){for(var s="",_=0,_e=0;_e<o.length;_e++)o[_e]=='"'&&(_==0?_=1:_=0),_==1?s+=o[_e]:s+=o[_e].toUpperCase();return s};obj.executeFormula=function(expression,x,y){var formulaResults=[],formulaLoopProtection=[],execute=function(expression,x,y){var parentId=jexcel.getColumnNameFromId([x,y]);if(formulaLoopProtection[parentId])return console.error("Reference loop detected"),"#ERROR";formulaLoopProtection[parentId]=!0;var tokensUpdate=function(o){for(var s=0;s<o.length;s++){var _=[],_e=o[s].split(":"),et=jexcel.getIdFromColumnName(_e[0],!0),it=jexcel.getIdFromColumnName(_e[1],!0);if(et[0]<=it[0])var tt=et[0],rt=it[0];else var tt=it[0],rt=et[0];if(et[1]<=it[1])var nt=et[1],ot=it[1];else var nt=it[1],ot=et[1];for(var st=nt;st<=ot;st++)for(var at=tt;at<=rt;at++)_.push(jexcel.getColumnNameFromId([at,st]));expression=expression.replace(o[s],_.join(","))}};expression=expression.replace(/\$?([A-Z]+)\$?([0-9]+)/g,"$1$2");var tokens=expression.match(/([A-Z]+[0-9]+)\:([A-Z]+[0-9]+)/g);tokens&&tokens.length&&tokensUpdate(tokens);var tokens=expression.match(/([A-Z]+[0-9]+)/g);if(tokens&&tokens.indexOf(parentId)>-1)return console.error("Self Reference detected"),"#ERROR";var formulaExpressions={};if(tokens){for(var i=0;i<tokens.length;i++)if(obj.formula[tokens[i]]||(obj.formula[tokens[i]]=[]),obj.formula[tokens[i]].indexOf(parentId)<0&&obj.formula[tokens[i]].push(parentId),eval("typeof("+tokens[i]+') == "undefined"')){var position=jexcel.getIdFromColumnName(tokens[i],1);if(typeof obj.options.data[position[1]]!="undefined"&&typeof obj.options.data[position[1]][position[0]]!="undefined")var value=obj.options.data[position[1]][position[0]];else var value="";if((""+value).substr(0,1)=="="&&(formulaResults[tokens[i]]?value=formulaResults[tokens[i]]:(value=execute(value,position[0],position[1]),formulaResults[tokens[i]]=value)),(""+value).trim()=="")formulaExpressions[tokens[i]]=null;else if(value==Number(value)&&obj.options.autoCasting==!0)formulaExpressions[tokens[i]]=Number(value);else{var number=obj.parseNumber(value,position[0]);obj.options.autoCasting==!0&&number?formulaExpressions[tokens[i]]=number:formulaExpressions[tokens[i]]='"'+value+'"'}}}try{var res=jexcel.formula(expression.substr(1),formulaExpressions,x,y,obj)}catch(o){var res="#ERROR";console.log(o)}return res};return execute(expression,x,y)},obj.parseNumber=function(o,s){var _=s&&obj.options.columns[s].decimal?obj.options.columns[s].decimal:".",_e=""+o;if(_e=_e.split(_),_e[0]=_e[0].match(/[+-]?[0-9]/g),_e[0]&&(_e[0]=_e[0].join("")),_e[1]&&(_e[1]=_e[1].match(/[0-9]*/g).join("")),_e[0]&&Number(_e[0])>=0)if(_e[1])var o=Number(_e[0]+"."+_e[1]);else var o=Number(_e[0]+".00");else var o=null;return o},obj.row=function(o){},obj.col=function(o){},obj.up=function(o,s){if(o?obj.selectedCell[3]>0&&obj.up.visible(1,s?0:1):(obj.selectedCell[1]>0&&obj.up.visible(0,s?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.options.lazyLoading==!0)if(obj.selectedCell[1]==0||obj.selectedCell[3]==0)obj.loadPage(0),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]);else if(obj.loadValidation())obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]);else{var _=parseInt(obj.tbody.firstChild.getAttribute("data-y"));obj.selectedCell[1]-_<30&&(obj.loadUp(),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]))}else if(obj.options.pagination>0){var _e=obj.whichPage(obj.selectedCell[3]);_e!=obj.pageNumber&&obj.page(_e)}obj.updateScroll(1)},obj.up.visible=function(o,s){if(o==0)var _=parseInt(obj.selectedCell[0]),_e=parseInt(obj.selectedCell[1]);else var _=parseInt(obj.selectedCell[2]),_e=parseInt(obj.selectedCell[3]);if(s==0){for(var et=0;et<_e;et++)if(obj.records[et][_].style.display!="none"&&obj.rows[et].style.display!="none"){_e=et;break}}else _e=obj.up.get(_,_e);o==0?(obj.selectedCell[0]=_,obj.selectedCell[1]=_e):(obj.selectedCell[2]=_,obj.selectedCell[3]=_e)},obj.up.get=function(_,_e){for(var _=parseInt(_),_e=parseInt(_e),et=_e-1;et>=0;et--)if(obj.records[et][_].style.display!="none"&&obj.rows[et].style.display!="none"){if(obj.records[et][_].getAttribute("data-merged")&&obj.records[et][_]==obj.records[_e][_])continue;_e=et;break}return _e},obj.down=function(o,s){if(o?obj.selectedCell[3]<obj.records.length-1&&obj.down.visible(1,s?0:1):(obj.selectedCell[1]<obj.records.length-1&&obj.down.visible(0,s?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.options.lazyLoading==!0)if(obj.selectedCell[1]==obj.records.length-1||obj.selectedCell[3]==obj.records.length-1)obj.loadPage(-1),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]);else if(obj.loadValidation())obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]);else{var _=parseInt(obj.tbody.lastChild.getAttribute("data-y"));_-obj.selectedCell[3]<30&&(obj.loadDown(),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]))}else if(obj.options.pagination>0){var _e=obj.whichPage(obj.selectedCell[3]);_e!=obj.pageNumber&&obj.page(_e)}obj.updateScroll(3)},obj.down.visible=function(o,s){if(o==0)var _=parseInt(obj.selectedCell[0]),_e=parseInt(obj.selectedCell[1]);else var _=parseInt(obj.selectedCell[2]),_e=parseInt(obj.selectedCell[3]);if(s==0){for(var et=obj.rows.length-1;et>_e;et--)if(obj.records[et][_].style.display!="none"&&obj.rows[et].style.display!="none"){_e=et;break}}else _e=obj.down.get(_,_e);o==0?(obj.selectedCell[0]=_,obj.selectedCell[1]=_e):(obj.selectedCell[2]=_,obj.selectedCell[3]=_e)},obj.down.get=function(_,_e){for(var _=parseInt(_),_e=parseInt(_e),et=_e+1;et<obj.rows.length;et++)if(obj.records[et][_].style.display!="none"&&obj.rows[et].style.display!="none"){if(obj.records[et][_].getAttribute("data-merged")&&obj.records[et][_]==obj.records[_e][_])continue;_e=et;break}return _e},obj.right=function(o,s){o?obj.selectedCell[2]<obj.headers.length-1&&obj.right.visible(1,s?0:1):(obj.selectedCell[0]<obj.headers.length-1&&obj.right.visible(0,s?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(2)},obj.right.visible=function(o,s){if(o==0)var _=parseInt(obj.selectedCell[0]),_e=parseInt(obj.selectedCell[1]);else var _=parseInt(obj.selectedCell[2]),_e=parseInt(obj.selectedCell[3]);if(s==0){for(var et=obj.headers.length-1;et>_;et--)if(obj.records[_e][et].style.display!="none"){_=et;break}}else _=obj.right.get(_,_e);o==0?(obj.selectedCell[0]=_,obj.selectedCell[1]=_e):(obj.selectedCell[2]=_,obj.selectedCell[3]=_e)},obj.right.get=function(_,_e){for(var _=parseInt(_),_e=parseInt(_e),et=_+1;et<obj.headers.length;et++)if(obj.records[_e][et].style.display!="none"){if(obj.records[_e][et].getAttribute("data-merged")&&obj.records[_e][et]==obj.records[_e][_])continue;_=et;break}return _},obj.left=function(o,s){o?obj.selectedCell[2]>0&&obj.left.visible(1,s?0:1):(obj.selectedCell[0]>0&&obj.left.visible(0,s?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(0)},obj.left.visible=function(o,s){if(o==0)var _=parseInt(obj.selectedCell[0]),_e=parseInt(obj.selectedCell[1]);else var _=parseInt(obj.selectedCell[2]),_e=parseInt(obj.selectedCell[3]);if(s==0){for(var et=0;et<_;et++)if(obj.records[_e][et].style.display!="none"){_=et;break}}else _=obj.left.get(_,_e);o==0?(obj.selectedCell[0]=_,obj.selectedCell[1]=_e):(obj.selectedCell[2]=_,obj.selectedCell[3]=_e)},obj.left.get=function(_,_e){for(var _=parseInt(_),_e=parseInt(_e),et=_-1;et>=0;et--)if(obj.records[_e][et].style.display!="none"){if(obj.records[_e][et].getAttribute("data-merged")&&obj.records[_e][et]==obj.records[_e][_])continue;_=et;break}return _},obj.first=function(o,s){if(o?s?obj.selectedCell[3]=0:obj.left.visible(1,0):(s?obj.selectedCell[1]=0:obj.left.visible(0,0),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.options.lazyLoading==!0&&(obj.selectedCell[1]==0||obj.selectedCell[3]==0))obj.loadPage(0);else if(obj.options.pagination>0){var _=obj.whichPage(obj.selectedCell[3]);_!=obj.pageNumber&&obj.page(_)}obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(1)},obj.last=function(o,s){if(o?s?obj.selectedCell[3]=obj.records.length-1:obj.right.visible(1,0):(s?obj.selectedCell[1]=obj.records.length-1:obj.right.visible(0,0),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.options.lazyLoading==!0&&(obj.selectedCell[1]==obj.records.length-1||obj.selectedCell[3]==obj.records.length-1))obj.loadPage(-1);else if(obj.options.pagination>0){var _=obj.whichPage(obj.selectedCell[3]);_!=obj.pageNumber&&obj.page(_)}obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(3)},obj.selectAll=function(){obj.selectedCell||(obj.selectedCell=[]),obj.selectedCell[0]=0,obj.selectedCell[1]=0,obj.selectedCell[2]=obj.headers.length-1,obj.selectedCell[3]=obj.records.length-1,obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3])},obj.loadPage=function(o){if(obj.options.search==!0&&obj.results)var s=obj.results;else var s=obj.rows;var _=100;(o==null||o==-1)&&(o=Math.ceil(s.length/_)-1);var _e=o*_,et=o*_+_;et>s.length&&(et=s.length),_e=et-100,_e<0&&(_e=0);for(var it=_e;it<et;it++)obj.options.search==!0&&obj.results?obj.tbody.appendChild(obj.rows[s[it]]):obj.tbody.appendChild(obj.rows[it]),obj.tbody.children.length>_&&obj.tbody.removeChild(obj.tbody.firstChild)},obj.loadUp=function(){if(obj.options.search==!0&&obj.results)var o=obj.results;else var o=obj.rows;var s=0;if(o.length>100){var _=parseInt(obj.tbody.firstChild.getAttribute("data-y"));if(obj.options.search==!0&&obj.results&&(_=o.indexOf(_)),_>0)for(var _e=0;_e<30;_e++)_=_-1,_>-1&&(obj.options.search==!0&&obj.results?obj.tbody.insertBefore(obj.rows[o[_]],obj.tbody.firstChild):obj.tbody.insertBefore(obj.rows[_],obj.tbody.firstChild),obj.tbody.children.length>100&&(obj.tbody.removeChild(obj.tbody.lastChild),s=1))}return s},obj.loadDown=function(){if(obj.options.search==!0&&obj.results)var o=obj.results;else var o=obj.rows;var s=0;if(o.length>100){var _=parseInt(obj.tbody.lastChild.getAttribute("data-y"));if(obj.options.search==!0&&obj.results&&(_=o.indexOf(_)),_<obj.rows.length-1)for(var _e=0;_e<=30;_e++)_<o.length&&(obj.options.search==!0&&obj.results?obj.tbody.appendChild(obj.rows[o[_]]):obj.tbody.appendChild(obj.rows[_]),obj.tbody.children.length>100&&(obj.tbody.removeChild(obj.tbody.firstChild),s=1)),_=_+1}return s},obj.loadValidation=function(){if(obj.selectedCell){var o=parseInt(obj.tbody.firstChild.getAttribute("data-y"))/100,s=parseInt(obj.selectedCell[3]/100),_=parseInt(obj.rows.length/100);if(o!=s&&s<=_&&!Array.prototype.indexOf.call(obj.tbody.children,obj.rows[obj.selectedCell[3]]))return obj.loadPage(s),!0}return!1},obj.resetSearch=function(){obj.searchInput.value="",obj.search(""),obj.results=null},obj.search=function(o){if(o)var o=o.toLowerCase();if(obj.options.filters&&obj.resetFilters(),obj.resetSelection(),obj.pageNumber=0,obj.results=[],o){var s=function(_e,et,it){for(var tt=0;tt<_e.length;tt++)if((""+_e[tt]).toLowerCase().search(et)>=0||(""+obj.records[it][tt].innerHTML).toLowerCase().search(et)>=0)return!0;return!1},_=function(_e){obj.results.indexOf(_e)==-1&&obj.results.push(_e)};obj.options.data.filter(function(_e,et){if(s(_e,o,et)){var it=obj.isRowMerged(et);if(it.length)for(var tt=0;tt<it.length;tt++)for(var rt=jexcel.getIdFromColumnName(it[tt],!0),nt=0;nt<obj.options.mergeCells[it[tt]][1];nt++)_(rt[1]+nt);else _(et);return!0}else return!1})}else obj.results=null;return obj.updateResult()},obj.updateResult=function(){var o=0,s=0;for(obj.options.lazyLoading==!0?o=100:obj.options.pagination>0?o=obj.options.pagination:obj.results?o=obj.results.length:o=obj.rows.length;obj.tbody.firstChild;)obj.tbody.removeChild(obj.tbody.firstChild);for(var _=0;_<obj.rows.length;_++)!obj.results||obj.results.indexOf(_)>-1?(s<o&&(obj.tbody.appendChild(obj.rows[_]),s++),obj.rows[_].style.display=""):obj.rows[_].style.display="none";return obj.options.pagination>0&&obj.updatePagination(),obj.updateCornerPosition(),o},obj.whichPage=function(o){return obj.options.search==!0&&obj.results&&(o=obj.results.indexOf(o)),Math.ceil((parseInt(o)+1)/parseInt(obj.options.pagination))-1},obj.page=function(o){var s=obj.pageNumber;if(obj.options.search==!0&&obj.results)var _=obj.results;else var _=obj.rows;var _e=parseInt(obj.options.pagination);(o==null||o==-1)&&(o=Math.ceil(_.length/_e)-1),obj.pageNumber=o;var et=o*_e,it=o*_e+_e;for(it>_.length&&(it=_.length),et<0&&(et=0);obj.tbody.firstChild;)obj.tbody.removeChild(obj.tbody.firstChild);for(var tt=et;tt<it;tt++)obj.options.search==!0&&obj.results?obj.tbody.appendChild(obj.rows[_[tt]]):obj.tbody.appendChild(obj.rows[tt]);obj.options.pagination>0&&obj.updatePagination(),obj.updateCornerPosition(),obj.dispatch("onchangepage",el,o,s)},obj.updatePagination=function(){if(obj.pagination.children[0].innerHTML="",obj.pagination.children[1].innerHTML="",obj.options.pagination){if(obj.options.search==!0&&obj.results)var o=obj.results.length;else var o=obj.rows.length;if(!o)obj.pagination.children[0].innerHTML=obj.options.text.noRecordsFound;else{var s=Math.ceil(o/obj.options.pagination);if(obj.pageNumber<6)var _=1,_e=s<10?s:10;else if(s-obj.pageNumber<5){var _=s-9,_e=s;_<1&&(_=1)}else var _=obj.pageNumber-4,_e=obj.pageNumber+5;if(_>1){var et=document.createElement("div");et.className="jexcel_page",et.innerHTML="<",et.title=1,obj.pagination.children[1].appendChild(et)}for(var it=_;it<=_e;it++){var et=document.createElement("div");et.className="jexcel_page",et.innerHTML=it,obj.pagination.children[1].appendChild(et),obj.pageNumber==it-1&&et.classList.add("jexcel_page_selected")}if(_e<s){var et=document.createElement("div");et.className="jexcel_page",et.innerHTML=">",et.title=s,obj.pagination.children[1].appendChild(et)}var tt=function(rt){var nt=Array.prototype.slice.call(arguments,1);return rt.replace(/{(\d+)}/g,function(ot,st){return typeof nt[st]!="undefined"?nt[st]:ot})};obj.pagination.children[0].innerHTML=tt(obj.options.text.showingPage,obj.pageNumber+1,s)}}},obj.download=function(o){if(obj.options.allowExport==!1)console.error("Export not allowed");else{var s="";s+=obj.copy(!1,obj.options.csvDelimiter,!0,o,!0);var _=new Blob(["\uFEFF"+s],{type:"text/csv;charset=utf-8;"});if(window.navigator&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(_,obj.options.csvFileName+".csv");else{var _e=document.createElement("a"),et=URL.createObjectURL(_);_e.href=et,_e.setAttribute("download",obj.options.csvFileName+".csv"),document.body.appendChild(_e),_e.click(),_e.parentNode.removeChild(_e)}}},obj.setHistory=function(o){if(obj.ignoreHistory!=!0){var s=++obj.historyIndex;obj.history=obj.history=obj.history.slice(0,s+1),obj.history[s]=o}},obj.copy=function(o,s,_,_e,et){s||(s="	");for(var it=new RegExp(s,"ig"),tt=[],rt=[],nt=[],ot=[],st=[],at=obj.options.data[0].length,lt=obj.options.data.length,ct="",ht=!1,mt="",dt="",ft=0,ut=0,pt=0,At=0,gt=!0,vt=0;vt<lt;vt++)for(var yt=0;yt<at;yt++)(!o||obj.records[vt][yt].classList.contains("highlight"))&&(pt<=yt&&(pt=yt),At<=vt&&(At=vt));if(at===pt+1&&lt===At+1&&(gt=!1),et&&obj.options.includeHeadersOnDownload==!0||!et&&obj.options.includeHeadersOnCopy==!0&&!gt||_e){if(obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0){obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0]?ct=obj.options.nestedHeaders:ct=[obj.options.nestedHeaders];for(var vt=0;vt<ct.length;vt++){for(var bt=[],yt=0;yt<ct[vt].length;yt++){var Ct=parseInt(ct[vt][yt].colspan);bt.push(ct[vt][yt].title);for(var xt=0;xt<Ct-1;xt++)bt.push("")}dt+=bt.join(s)+`\r
`}}ht=!0}obj.style=[];for(var vt=0;vt<lt;vt++){rt=[],nt=[];for(var yt=0;yt<at;yt++)if(!o||obj.records[vt][yt].classList.contains("highlight")){ht==!0&&tt.push(obj.headers[yt].innerText);var It=obj.options.data[vt][yt];if(It.match&&(It.match(it)||It.match(/,/g)||It.match(/\n/)||It.match(/\"/))&&(It=It.replace(new RegExp('"',"g"),'""'),It='"'+It+'"'),rt.push(It),obj.options.columns[yt].type=="checkbox"||obj.options.columns[yt].type=="radio")var St=It;else{if(obj.options.stripHTMLOnCopy==!0)var St=obj.records[vt][yt].innerText;else var St=obj.records[vt][yt].innerHTML;St.match&&(St.match(it)||St.match(/,/g)||St.match(/\n/)||St.match(/\"/))&&(St=St.replace(new RegExp('"',"g"),'""'),St='"'+St+'"')}nt.push(St),ct=obj.records[vt][yt].getAttribute("style"),ct=ct.replace("display: none;",""),obj.style.push(ct||"")}rt.length&&(ht&&(ft=rt.length,ot.push(tt.join(s))),ot.push(rt.join(s))),nt.length&&(ut++,ht&&(st.push(tt.join(s)),ht=!1),st.push(nt.join(s)))}at==ft&&lt==ut&&(mt=dt);var Ot=mt+ot.join(`\r
`),Mt=mt+st.join(`\r
`);if(_||(obj.options.copyCompatibility==!0?obj.textarea.value=Mt:obj.textarea.value=Ot,obj.textarea.select(),document.execCommand("copy")),obj.options.copyCompatibility==!0?obj.data=Mt:obj.data=Ot,obj.hashString=obj.hash(obj.data),!_){if(obj.removeCopyingSelection(),obj.highlighted)for(var yt=0;yt<obj.highlighted.length;yt++)obj.highlighted[yt].classList.add("copying"),obj.highlighted[yt].classList.contains("highlight-left")&&obj.highlighted[yt].classList.add("copying-left"),obj.highlighted[yt].classList.contains("highlight-right")&&obj.highlighted[yt].classList.add("copying-right"),obj.highlighted[yt].classList.contains("highlight-top")&&obj.highlighted[yt].classList.add("copying-top"),obj.highlighted[yt].classList.contains("highlight-bottom")&&obj.highlighted[yt].classList.add("copying-bottom");obj.dispatch("oncopy",el,obj.options.copyCompatibility==!0?st:ot,obj.hashString)}return obj.data},obj.paste=function(o,s,tt){var _e=obj.dispatch("onbeforepaste",el,tt,o,s);if(_e===!1)return!1;if(_e)var tt=_e;var et=obj.hash(tt),it=et==obj.hashString?obj.style:null;if(obj.options.copyCompatibility==!0&&et==obj.hashString)var tt=obj.data;var tt=obj.parseCSV(tt,"	");if(o!=null&&s!=null&&tt){for(var rt=0,nt=0,ot=[],st={},at={},lt=0,ct=parseInt(o),ht=parseInt(s),mt=null;mt=tt[nt];){for(rt=0,ct=parseInt(o);mt[rt]!=null;){var dt=obj.updateCell(ct,ht,mt[rt]);if(ot.push(dt),obj.updateFormulaChain(ct,ht,ot),it&&it[lt]){var ft=jexcel.getColumnNameFromId([ct,ht]);st[ft]=it[lt],at[ft]=obj.getStyle(ft),obj.records[ht][ct].setAttribute("style",it[lt]),lt++}if(rt++,mt[rt]!=null){if(ct>=obj.headers.length-1)if(obj.options.allowInsertColumn==!0)obj.insertColumn();else break;ct=obj.right.get(ct,ht)}}if(nt++,tt[nt]){if(ht>=obj.rows.length-1)if(obj.options.allowInsertRow==!0)obj.insertRow();else break;ht=obj.down.get(o,ht)}}obj.updateSelectionFromCoords(o,s,ct,ht),obj.setHistory({action:"setValue",records:ot,selection:obj.selectedCell,newStyle:st,oldStyle:at}),obj.updateTable(),obj.dispatch("onpaste",el,tt),obj.onafterchanges(el,ot)}obj.removeCopyingSelection()},obj.removeCopyingSelection=function(){for(var o=document.querySelectorAll(".jexcel .copying"),s=0;s<o.length;s++)o[s].classList.remove("copying"),o[s].classList.remove("copying-left"),o[s].classList.remove("copying-right"),o[s].classList.remove("copying-top"),o[s].classList.remove("copying-bottom")},obj.historyProcessRow=function(o,s){var _=s.insertBefore?+s.rowNumber:s.rowNumber+1;if(obj.options.search==!0&&obj.results&&obj.results.length!=obj.rows.length&&obj.resetSearch(),o==1){for(var _e=s.numOfRows,et=_;et<_e+_;et++)obj.rows[et].parentNode.removeChild(obj.rows[et]);obj.records.splice(_,_e),obj.options.data.splice(_,_e),obj.rows.splice(_,_e),obj.conditionalSelectionUpdate(1,_,_e+_-1)}else{obj.records=jexcel.injectArray(obj.records,_,s.rowRecords),obj.options.data=jexcel.injectArray(obj.options.data,_,s.rowData),obj.rows=jexcel.injectArray(obj.rows,_,s.rowNode);for(var it=0,et=_;et<s.numOfRows+_;et++)obj.tbody.insertBefore(s.rowNode[it],obj.tbody.children[et]),it++}obj.options.pagination>0&&obj.page(obj.pageNumber),obj.updateTableReferences()},obj.historyProcessColumn=function(o,s){var _=s.insertBefore?s.columnNumber:s.columnNumber+1;if(o==1){var _e=s.numOfColumns;obj.options.columns.splice(_,_e);for(var et=_;et<_e+_;et++)obj.headers[et].parentNode.removeChild(obj.headers[et]),obj.colgroup[et].parentNode.removeChild(obj.colgroup[et]);obj.headers.splice(_,_e),obj.colgroup.splice(_,_e);for(var it=0;it<s.data.length;it++){for(var et=_;et<_e+_;et++)obj.records[it][et].parentNode.removeChild(obj.records[it][et]);obj.records[it].splice(_,_e),obj.options.data[it].splice(_,_e)}if(obj.options.footers)for(var it=0;it<obj.options.footers.length;it++)obj.options.footers[it].splice(_,_e)}else{obj.options.columns=jexcel.injectArray(obj.options.columns,_,s.columns),obj.headers=jexcel.injectArray(obj.headers,_,s.headers),obj.colgroup=jexcel.injectArray(obj.colgroup,_,s.colgroup);for(var tt=0,et=_;et<s.numOfColumns+_;et++)obj.headerContainer.insertBefore(s.headers[tt],obj.headerContainer.children[et+1]),obj.colgroupContainer.insertBefore(s.colgroup[tt],obj.colgroupContainer.children[et+1]),tt++;for(var it=0;it<s.data.length;it++){obj.options.data[it]=jexcel.injectArray(obj.options.data[it],_,s.data[it]),obj.records[it]=jexcel.injectArray(obj.records[it],_,s.records[it]);for(var tt=0,et=_;et<s.numOfColumns+_;et++)obj.rows[it].insertBefore(s.records[it][tt],obj.rows[it].children[et+1]),tt++}if(obj.options.footers)for(var it=0;it<obj.options.footers.length;it++)obj.options.footers[it]=jexcel.injectArray(obj.options.footers[it],_,s.footers[it])}if(obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var it=0;it<obj.options.nestedHeaders.length;it++){if(o==1)var rt=parseInt(obj.options.nestedHeaders[it][obj.options.nestedHeaders[it].length-1].colspan)-s.numOfColumns;else var rt=parseInt(obj.options.nestedHeaders[it][obj.options.nestedHeaders[it].length-1].colspan)+s.numOfColumns;obj.options.nestedHeaders[it][obj.options.nestedHeaders[it].length-1].colspan=rt,obj.thead.children[it].children[obj.thead.children[it].children.length-1].setAttribute("colspan",rt)}else{if(o==1)var rt=parseInt(obj.options.nestedHeaders[0].colspan)-s.numOfColumns;else var rt=parseInt(obj.options.nestedHeaders[0].colspan)+s.numOfColumns;obj.options.nestedHeaders[0].colspan=rt,obj.thead.children[0].children[obj.thead.children[0].children.length-1].setAttribute("colspan",rt)}obj.updateTableReferences()},obj.undo=function(){var o=!!obj.ignoreEvents,s=!!obj.ignoreHistory;obj.ignoreEvents=!0,obj.ignoreHistory=!0;var _=[];if(obj.historyIndex>=0){var _e=obj.history[obj.historyIndex--];if(_e.action=="insertRow")obj.historyProcessRow(1,_e);else if(_e.action=="deleteRow")obj.historyProcessRow(0,_e);else if(_e.action=="insertColumn")obj.historyProcessColumn(1,_e);else if(_e.action=="deleteColumn")obj.historyProcessColumn(0,_e);else if(_e.action=="moveRow")obj.moveRow(_e.newValue,_e.oldValue);else if(_e.action=="moveColumn")obj.moveColumn(_e.newValue,_e.oldValue);else if(_e.action=="setMerge")obj.removeMerge(_e.column,_e.data);else if(_e.action=="setStyle")obj.setStyle(_e.oldValue,null,null,1);else if(_e.action=="setWidth")obj.setWidth(_e.column,_e.oldValue);else if(_e.action=="setHeight")obj.setHeight(_e.row,_e.oldValue);else if(_e.action=="setHeader")obj.setHeader(_e.column,_e.oldValue);else if(_e.action=="setComments")obj.setComments(_e.column,_e.oldValue[0],_e.oldValue[1]);else if(_e.action=="orderBy"){for(var et=[],it=0;it<_e.rows.length;it++)et[_e.rows[it]]=it;obj.updateOrderArrow(_e.column,_e.order?0:1),obj.updateOrder(et)}else if(_e.action=="setValue"){for(var tt=0;tt<_e.records.length;tt++)_.push({x:_e.records[tt].x,y:_e.records[tt].y,newValue:_e.records[tt].oldValue}),_e.oldStyle&&obj.resetStyle(_e.oldStyle);obj.setValue(_),_e.selection&&obj.updateSelectionFromCoords(_e.selection[0],_e.selection[1],_e.selection[2],_e.selection[3])}}obj.ignoreEvents=o,obj.ignoreHistory=s,obj.dispatch("onundo",el,_e)},obj.redo=function(){var o=!!obj.ignoreEvents,s=!!obj.ignoreHistory;if(obj.ignoreEvents=!0,obj.ignoreHistory=!0,obj.historyIndex<obj.history.length-1){var _=obj.history[++obj.historyIndex];if(_.action=="insertRow")obj.historyProcessRow(0,_);else if(_.action=="deleteRow")obj.historyProcessRow(1,_);else if(_.action=="insertColumn")obj.historyProcessColumn(0,_);else if(_.action=="deleteColumn")obj.historyProcessColumn(1,_);else if(_.action=="moveRow")obj.moveRow(_.oldValue,_.newValue);else if(_.action=="moveColumn")obj.moveColumn(_.oldValue,_.newValue);else if(_.action=="setMerge")obj.setMerge(_.column,_.colspan,_.rowspan,1);else if(_.action=="setStyle")obj.setStyle(_.newValue,null,null,1);else if(_.action=="setWidth")obj.setWidth(_.column,_.newValue);else if(_.action=="setHeight")obj.setHeight(_.row,_.newValue);else if(_.action=="setHeader")obj.setHeader(_.column,_.newValue);else if(_.action=="setComments")obj.setComments(_.column,_.newValue[0],_.newValue[1]);else if(_.action=="orderBy")obj.updateOrderArrow(_.column,_.order),obj.updateOrder(_.rows);else if(_.action=="setValue"){obj.setValue(_.records);for(var _e=0;_e<_.records.length;_e++)_.oldStyle&&obj.resetStyle(_.newStyle);_.selection&&obj.updateSelectionFromCoords(_.selection[0],_.selection[1],_.selection[2],_.selection[3])}}obj.ignoreEvents=o,obj.ignoreHistory=s,obj.dispatch("onredo",el,_)},obj.getDropDownValue=function(o,s){var _=[];if(obj.options.columns[o]&&obj.options.columns[o].source){for(var _e=[],et=obj.options.columns[o].source,it=0;it<et.length;it++)typeof et[it]=="object"?_e[et[it].id]=et[it].name:_e[et[it]]=et[it];for(var tt=Array.isArray(s)?s:(""+s).split(";"),it=0;it<tt.length;it++)typeof tt[it]=="object"?_.push(_e[tt[it].id]):_e[tt[it]]&&_.push(_e[tt[it]])}else console.error("Invalid column");return _.length>0?_.join("; "):""},obj.parseCSV=function(o,s){o=o.replace(/\r?\n$|\r$|\n$/g,""),o.charCodeAt(o.length-1)==9&&(o+="\0"),s=s||",";for(var _=[],_e=!1,et=0,it=0,tt=0;tt<o.length;tt++){var rt=o[tt],nt=o[tt+1];if(_[et]=_[et]||[],_[et][it]=_[et][it]||"",rt=='"'&&_e&&nt=='"'){_[et][it]+=rt,++tt;continue}if(rt=='"'){_e=!_e;continue}if(rt==s&&!_e){++it;continue}if(rt=="\r"&&nt==`
`&&!_e){++et,it=0,++tt;continue}if(rt==`
`&&!_e){++et,it=0;continue}if(rt=="\r"&&!_e){++et,it=0;continue}_[et][it]+=rt}return _},obj.hash=function(o){var s=0,_,_e;if(o.length===0)return s;for(_=0;_<o.length;_++)_e=o.charCodeAt(_),s=(s<<5)-s+_e,s|=0;return s},obj.onafterchanges=function(o,s){obj.dispatch("onafterchanges",o,s)},obj.destroy=function(){jexcel.destroy(el)},obj.init=function(){jexcel.current=obj,typeof jexcel.build=="function"&&(obj.options.root?jexcel.build(obj.options.root):(jexcel.build(document),jexcel.build=null)),el.setAttribute("tabindex",1),el.addEventListener("focus",function(o){jexcel.current&&!obj.selectedCell&&(obj.updateSelectionFromCoords(0,0,0,0),obj.left())}),obj.options.csv?(obj.options.loadingSpin==!0&&jSuites.loading.show(),jSuites.ajax({url:obj.options.csv,method:obj.options.method,data:obj.options.requestVariables,dataType:"text",success:function(o){var s=obj.parseCSV(o,obj.options.csvDelimiter);if(obj.options.csvHeaders==!0&&s.length>0)for(var _=s.shift(),_e=0;_e<_.length;_e++)obj.options.columns[_e]||(obj.options.columns[_e]={type:"text",align:obj.options.defaultColAlign,width:obj.options.defaultColWidth}),typeof obj.options.columns[_e].title=="undefined"&&(obj.options.columns[_e].title=_[_e]);obj.options.data=s,obj.prepareTable(),obj.options.loadingSpin==!0&&jSuites.loading.hide()}})):obj.options.url?(obj.options.loadingSpin==!0&&jSuites.loading.show(),jSuites.ajax({url:obj.options.url,method:obj.options.method,data:obj.options.requestVariables,dataType:"json",success:function(o){obj.options.data=o.data?o.data:o,obj.prepareTable(),obj.options.loadingSpin==!0&&jSuites.loading.hide()}})):obj.prepareTable()},options&&options.contextMenu!=null?obj.options.contextMenu=options.contextMenu:obj.options.contextMenu=function(o,s,_,_e){var et=[];if(_==null)obj.options.allowInsertColumn==!0&&et.push({title:obj.options.text.insertANewColumnBefore,onclick:function(){obj.insertColumn(1,parseInt(s),1)}}),obj.options.allowInsertColumn==!0&&et.push({title:obj.options.text.insertANewColumnAfter,onclick:function(){obj.insertColumn(1,parseInt(s),0)}}),obj.options.allowDeleteColumn==!0&&et.push({title:obj.options.text.deleteSelectedColumns,onclick:function(){obj.deleteColumn(obj.getSelectedColumns().length?void 0:parseInt(s))}}),obj.options.allowRenameColumn==!0&&et.push({title:obj.options.text.renameThisColumn,onclick:function(){obj.setHeader(s)}}),obj.options.columnSorting==!0&&(et.push({type:"line"}),et.push({title:obj.options.text.orderAscending,onclick:function(){obj.orderBy(s,0)}}),et.push({title:obj.options.text.orderDescending,onclick:function(){obj.orderBy(s,1)}}));else if(obj.options.allowInsertRow==!0&&(et.push({title:obj.options.text.insertANewRowBefore,onclick:function(){obj.insertRow(1,parseInt(_),1)}}),et.push({title:obj.options.text.insertANewRowAfter,onclick:function(){obj.insertRow(1,parseInt(_))}})),obj.options.allowDeleteRow==!0&&et.push({title:obj.options.text.deleteSelectedRows,onclick:function(){obj.deleteRow(obj.getSelectedRows().length?void 0:parseInt(_))}}),s&&obj.options.allowComments==!0){et.push({type:"line"});var it=obj.records[_][s].getAttribute("title")||"";et.push({title:it?obj.options.text.editComments:obj.options.text.addComments,onclick:function(){var tt=prompt(obj.options.text.comments,it);tt&&obj.setComments([s,_],tt)}}),it&&et.push({title:obj.options.text.clearComments,onclick:function(){obj.setComments([s,_],"")}})}return et.push({type:"line"}),et.push({title:obj.options.text.copy,shortcut:"Ctrl + C",onclick:function(){obj.copy(!0)}}),navigator&&navigator.clipboard&&et.push({title:obj.options.text.paste,shortcut:"Ctrl + V",onclick:function(){obj.selectedCell&&navigator.clipboard.readText().then(function(tt){tt&&jexcel.current.paste(obj.selectedCell[0],obj.selectedCell[1],tt)})}}),obj.options.allowExport&&et.push({title:obj.options.text.saveAs,shortcut:"Ctrl + S",onclick:function(){obj.download()}}),obj.options.about&&et.push({title:obj.options.text.about,onclick:function(){obj.options.about===!0?alert(Version().print()):alert(obj.options.about)}}),et},obj.scrollControls=function(o){obj.wheelControls(),obj.options.freezeColumns>0&&obj.content.scrollLeft!=scrollLeft&&obj.updateFreezePosition(),(obj.options.lazyLoading==!0||obj.options.tableOverflow==!0)&&obj.edition&&o.target.className.substr(0,9)!="jdropdown"&&obj.closeEditor(obj.edition[0],!0)},obj.wheelControls=function(o){obj.options.lazyLoading==!0&&jexcel.timeControlLoading==null&&(jexcel.timeControlLoading=setTimeout(function(){obj.content.scrollTop+obj.content.clientHeight>=obj.content.scrollHeight-10?obj.loadDown()&&(obj.content.scrollTop+obj.content.clientHeight>obj.content.scrollHeight-10&&(obj.content.scrollTop=obj.content.scrollTop-obj.content.clientHeight),obj.updateCornerPosition()):obj.content.scrollTop<=obj.content.clientHeight&&obj.loadUp()&&(obj.content.scrollTop<10&&(obj.content.scrollTop=obj.content.scrollTop+obj.content.clientHeight),obj.updateCornerPosition()),jexcel.timeControlLoading=null},100))},obj.getFreezeWidth=function(){var o=0;if(obj.options.freezeColumns>0)for(var s=0;s<obj.options.freezeColumns;s++)o+=parseInt(obj.options.columns[s].width);return o};var scrollLeft=0;return obj.updateFreezePosition=function(){scrollLeft=obj.content.scrollLeft;var o=0;if(scrollLeft>50)for(var s=0;s<obj.options.freezeColumns;s++){s>0&&(o+=parseInt(obj.options.columns[s-1].width)),obj.headers[s].classList.add("jexcel_freezed"),obj.headers[s].style.left=o+"px";for(var _=0;_<obj.rows.length;_++)if(obj.rows[_]&&obj.records[_][s]){var _e=scrollLeft+(s>0?obj.records[_][s-1].style.width:0)-51+"px";obj.records[_][s].classList.add("jexcel_freezed"),obj.records[_][s].style.left=_e}}else for(var s=0;s<obj.options.freezeColumns;s++){obj.headers[s].classList.remove("jexcel_freezed"),obj.headers[s].style.left="";for(var _=0;_<obj.rows.length;_++)obj.records[_][s]&&(obj.records[_][s].classList.remove("jexcel_freezed"),obj.records[_][s].style.left="")}obj.updateCornerPosition()},el.addEventListener("DOMMouseScroll",obj.wheelControls),el.addEventListener("mousewheel",obj.wheelControls),el.jexcel=obj,el.jspreadsheet=obj,obj.init(),obj};return jexcel.setDictionary=function(o){jSuites.setDictionary(o)},jexcel.setExtensions=function(o){for(var s=Object.keys(o),_=0;_<s.length;_++)typeof o[s[_]]=="function"&&(jexcel[s[_]]=o[s[_]],jexcel.license&&typeof o[s[_]].license=="function"&&o[s[_]].license(jexcel.license))},typeof formula!="undefined"&&(jexcel.formula=formula),jexcel.version=Version,jexcel.current=null,jexcel.timeControl=null,jexcel.timeControlLoading=null,jexcel.destroy=function(o,s){if(o.jexcel){var _=o.jexcel.options.root?o.jexcel.options.root:document;o.removeEventListener("DOMMouseScroll",o.jexcel.scrollControls),o.removeEventListener("mousewheel",o.jexcel.scrollControls),o.jexcel=null,o.innerHTML="",s&&(_.removeEventListener("mouseup",jexcel.mouseUpControls),_.removeEventListener("mousedown",jexcel.mouseDownControls),_.removeEventListener("mousemove",jexcel.mouseMoveControls),_.removeEventListener("mouseover",jexcel.mouseOverControls),_.removeEventListener("dblclick",jexcel.doubleClickControls),_.removeEventListener("paste",jexcel.pasteControls),_.removeEventListener("contextmenu",jexcel.contextMenuControls),_.removeEventListener("touchstart",jexcel.touchStartControls),_.removeEventListener("touchend",jexcel.touchEndControls),_.removeEventListener("touchcancel",jexcel.touchEndControls),document.removeEventListener("keydown",jexcel.keyDownControls),jexcel=null)}},jexcel.build=function(o){o.addEventListener("mouseup",jexcel.mouseUpControls),o.addEventListener("mousedown",jexcel.mouseDownControls),o.addEventListener("mousemove",jexcel.mouseMoveControls),o.addEventListener("mouseover",jexcel.mouseOverControls),o.addEventListener("dblclick",jexcel.doubleClickControls),o.addEventListener("paste",jexcel.pasteControls),o.addEventListener("contextmenu",jexcel.contextMenuControls),o.addEventListener("touchstart",jexcel.touchStartControls),o.addEventListener("touchend",jexcel.touchEndControls),o.addEventListener("touchcancel",jexcel.touchEndControls),o.addEventListener("touchmove",jexcel.touchEndControls),document.addEventListener("keydown",jexcel.keyDownControls)},jexcel.keyDownControls=function(o){if(jexcel.current){if(jexcel.current.edition)if(o.which==27)jexcel.current.edition&&jexcel.current.closeEditor(jexcel.current.edition[0],!1),o.preventDefault();else if(o.which==13){if(jexcel.current.options.columns[jexcel.current.edition[2]].type=="calendar")jexcel.current.closeEditor(jexcel.current.edition[0],!0);else if(!(jexcel.current.options.columns[jexcel.current.edition[2]].type=="dropdown"||jexcel.current.options.columns[jexcel.current.edition[2]].type=="autocomplete"))if((jexcel.current.options.wordWrap==!0||jexcel.current.options.columns[jexcel.current.edition[2]].wordWrap==!0||jexcel.current.options.data[jexcel.current.edition[3]][jexcel.current.edition[2]].length>200)&&o.altKey){var s=jexcel.current.edition[0].children[0],_=jexcel.current.edition[0].children[0].value,_e=s.selectionStart;_=_.slice(0,_e)+`
`+_.slice(_e),s.value=_,s.focus(),s.selectionStart=_e+1,s.selectionEnd=_e+1}else jexcel.current.edition[0].children[0].blur()}else o.which==9&&(jexcel.current.options.columns[jexcel.current.edition[2]].type=="calendar"?jexcel.current.closeEditor(jexcel.current.edition[0],!0):jexcel.current.edition[0].children[0].blur());if(!jexcel.current.edition&&jexcel.current.selectedCell){if(o.which==37)jexcel.current.left(o.shiftKey,o.ctrlKey),o.preventDefault();else if(o.which==39)jexcel.current.right(o.shiftKey,o.ctrlKey),o.preventDefault();else if(o.which==38)jexcel.current.up(o.shiftKey,o.ctrlKey),o.preventDefault();else if(o.which==40)jexcel.current.down(o.shiftKey,o.ctrlKey),o.preventDefault();else if(o.which==36)jexcel.current.first(o.shiftKey,o.ctrlKey),o.preventDefault();else if(o.which==35)jexcel.current.last(o.shiftKey,o.ctrlKey),o.preventDefault();else if(o.which==32)jexcel.current.options.editable==!0&&jexcel.current.setCheckRadioValue(),o.preventDefault();else if(o.which==46)jexcel.current.options.editable==!0&&(jexcel.current.selectedRow?jexcel.current.options.allowDeleteRow==!0&&confirm(jexcel.current.options.text.areYouSureToDeleteTheSelectedRows)&&jexcel.current.deleteRow():jexcel.current.selectedHeader?jexcel.current.options.allowDeleteColumn==!0&&confirm(jexcel.current.options.text.areYouSureToDeleteTheSelectedColumns)&&jexcel.current.deleteColumn():jexcel.current.setValue(jexcel.current.highlighted,""));else if(o.which==13)o.shiftKey?jexcel.current.up():(jexcel.current.options.allowInsertRow==!0&&jexcel.current.options.allowManualInsertRow==!0&&jexcel.current.selectedCell[1]==jexcel.current.options.data.length-1&&jexcel.current.insertRow(),jexcel.current.down()),o.preventDefault();else if(o.which==9)o.shiftKey?jexcel.current.left():(jexcel.current.options.allowInsertColumn==!0&&jexcel.current.options.allowManualInsertColumn==!0&&jexcel.current.selectedCell[0]==jexcel.current.options.data[0].length-1&&jexcel.current.insertColumn(),jexcel.current.right()),o.preventDefault();else if((o.ctrlKey||o.metaKey)&&!o.shiftKey)o.which==65?(jexcel.current.selectAll(),o.preventDefault()):o.which==83?(jexcel.current.download(),o.preventDefault()):o.which==89?(jexcel.current.redo(),o.preventDefault()):o.which==90?(jexcel.current.undo(),o.preventDefault()):o.which==67?(jexcel.current.copy(!0),o.preventDefault()):o.which==88?(jexcel.current.options.editable==!0?jexcel.cutControls():jexcel.copyControls(),o.preventDefault()):o.which==86&&jexcel.pasteControls();else if(jexcel.current.selectedCell&&jexcel.current.options.editable==!0){var et=jexcel.current.selectedCell[1],it=jexcel.current.selectedCell[0];jexcel.current.options.columns[it].type!="readonly"&&(o.keyCode==32?jexcel.current.options.columns[it].type=="checkbox"||jexcel.current.options.columns[it].type=="radio"?o.preventDefault():jexcel.current.openEditor(jexcel.current.records[et][it],!0):o.keyCode==113?jexcel.current.openEditor(jexcel.current.records[et][it],!1):(o.keyCode==8||o.keyCode>=48&&o.keyCode<=57||o.keyCode>=96&&o.keyCode<=111||o.keyCode>=187&&o.keyCode<=190||(String.fromCharCode(o.keyCode)==o.key||String.fromCharCode(o.keyCode).toLowerCase()==o.key.toLowerCase())&&jexcel.validLetter(String.fromCharCode(o.keyCode)))&&(jexcel.current.openEditor(jexcel.current.records[et][it],!0),jexcel.current.options.columns[it].type=="calendar"&&o.preventDefault()))}}else o.target.classList.contains("jexcel_search")&&(jexcel.timeControl&&clearTimeout(jexcel.timeControl),jexcel.timeControl=setTimeout(function(){jexcel.current.search(o.target.value)},200))}},jexcel.isMouseAction=!1,jexcel.mouseDownControls=function(o){if(o=o||window.event,o.buttons)var s=o.buttons;else if(o.button)var s=o.button;else var s=o.which;var _=jexcel.getElement(o.target);if(_[0]?jexcel.current!=_[0].jexcel&&(jexcel.current&&(jexcel.current.edition&&jexcel.current.closeEditor(jexcel.current.edition[0],!0),jexcel.current.resetSelection()),jexcel.current=_[0].jexcel):jexcel.current&&(jexcel.current.edition&&jexcel.current.closeEditor(jexcel.current.edition[0],!0),jexcel.current.resetSelection(!0),jexcel.current=null),jexcel.current&&s==1){if(o.target.classList.contains("jexcel_selectall"))jexcel.current&&jexcel.current.selectAll();else if(o.target.classList.contains("jexcel_corner"))jexcel.current.options.editable==!0&&(jexcel.current.selectedCorner=!0);else{if(_[1]==1){var _e=o.target.getAttribute("data-x");if(_e){var et=o.target.getBoundingClientRect();if(jexcel.current.options.columnResize==!0&&et.width-o.offsetX<6){jexcel.current.resizing={mousePosition:o.pageX,column:_e,width:et.width},jexcel.current.headers[_e].classList.add("resizing");for(var it=0;it<jexcel.current.records.length;it++)jexcel.current.records[it][_e]&&jexcel.current.records[it][_e].classList.add("resizing")}else if(jexcel.current.options.columnDrag==!0&&et.height-o.offsetY<6)if(jexcel.current.isColMerged(_e).length)console.error("Jspreadsheet: This column is part of a merged cell.");else{jexcel.current.resetSelection(),jexcel.current.dragging={element:o.target,column:_e,destination:_e},jexcel.current.headers[_e].classList.add("dragging");for(var it=0;it<jexcel.current.records.length;it++)jexcel.current.records[it][_e]&&jexcel.current.records[it][_e].classList.add("dragging")}else{if(jexcel.current.selectedHeader&&(o.shiftKey||o.ctrlKey))var tt=jexcel.current.selectedHeader,rt=_e;else{jexcel.current.selectedHeader==_e&&jexcel.current.options.allowRenameColumn==!0&&(jexcel.timeControl=setTimeout(function(){jexcel.current.setHeader(_e)},800)),jexcel.current.selectedHeader=_e;var tt=_e,rt=_e}jexcel.current.updateSelectionFromCoords(tt,0,rt,jexcel.current.options.data.length-1)}}else if(o.target.parentNode.classList.contains("jexcel_nested")){if(o.target.getAttribute("data-column"))var nt=o.target.getAttribute("data-column").split(","),ot=parseInt(nt[0]),st=parseInt(nt[nt.length-1]);else var ot=0,st=jexcel.current.options.columns.length-1;jexcel.current.updateSelectionFromCoords(ot,0,st,jexcel.current.options.data.length-1)}}else jexcel.current.selectedHeader=!1;if(_[1]==2){var at=o.target.getAttribute("data-y");if(o.target.classList.contains("jexcel_row")){var et=o.target.getBoundingClientRect();if(jexcel.current.options.rowResize==!0&&et.height-o.offsetY<6)jexcel.current.resizing={element:o.target.parentNode,mousePosition:o.pageY,row:at,height:et.height},o.target.parentNode.classList.add("resizing");else if(jexcel.current.options.rowDrag==!0&&et.width-o.offsetX<6)jexcel.current.isRowMerged(at).length?console.error("Jspreadsheet: This row is part of a merged cell"):jexcel.current.options.search==!0&&jexcel.current.results?console.error("Jspreadsheet: Please clear your search before perform this action"):(jexcel.current.resetSelection(),jexcel.current.dragging={element:o.target.parentNode,row:at,destination:at},o.target.parentNode.classList.add("dragging"));else{if(jexcel.current.selectedRow&&(o.shiftKey||o.ctrlKey))var tt=jexcel.current.selectedRow,rt=at;else{jexcel.current.selectedRow=at;var tt=at,rt=at}jexcel.current.updateSelectionFromCoords(0,tt,jexcel.current.options.data[0].length-1,rt)}}else if(o.target.classList.contains("jclose")&&o.target.clientWidth-o.offsetX<50&&o.offsetY<50)jexcel.current.closeEditor(jexcel.current.edition[0],!0);else{var lt=function(ht){var mt=ht.getAttribute("data-x"),dt=ht.getAttribute("data-y");if(mt&&dt)return[mt,dt];if(ht.parentNode)return lt(ht.parentNode)},ct=lt(o.target);if(ct){var _e=ct[0],at=ct[1];jexcel.current.edition&&(jexcel.current.edition[2]!=_e||jexcel.current.edition[3]!=at)&&jexcel.current.closeEditor(jexcel.current.edition[0],!0),jexcel.current.edition||(o.shiftKey?jexcel.current.updateSelectionFromCoords(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],_e,at):jexcel.current.updateSelectionFromCoords(_e,at)),jexcel.current.selectedHeader=null,jexcel.current.selectedRow=null}}}else jexcel.current.selectedRow=!1;o.target.classList.contains("jexcel_page")&&(o.target.innerText=="<"?jexcel.current.page(0):o.target.innerText==">"?jexcel.current.page(o.target.getAttribute("title")-1):jexcel.current.page(o.target.innerText-1))}jexcel.current.edition?jexcel.isMouseAction=!1:jexcel.isMouseAction=!0}else jexcel.isMouseAction=!1},jexcel.mouseUpControls=function(o){if(jexcel.current)if(jexcel.current.resizing){if(jexcel.current.resizing.column){var s=jexcel.current.colgroup[jexcel.current.resizing.column].getAttribute("width"),_=jexcel.current.getSelectedColumns();if(_.length>1){for(var _e=[],et=0;et<_.length;et++)_e.push(parseInt(jexcel.current.colgroup[_[et]].getAttribute("width")));var it=_.indexOf(parseInt(jexcel.current.resizing.column));_e[it]=jexcel.current.resizing.width,jexcel.current.setWidth(_,s,_e)}else jexcel.current.setWidth(jexcel.current.resizing.column,s,jexcel.current.resizing.width);jexcel.current.headers[jexcel.current.resizing.column].classList.remove("resizing");for(var tt=0;tt<jexcel.current.records.length;tt++)jexcel.current.records[tt][jexcel.current.resizing.column]&&jexcel.current.records[tt][jexcel.current.resizing.column].classList.remove("resizing")}else{jexcel.current.rows[jexcel.current.resizing.row].children[0].classList.remove("resizing");var rt=jexcel.current.rows[jexcel.current.resizing.row].getAttribute("height");jexcel.current.setHeight(jexcel.current.resizing.row,rt,jexcel.current.resizing.height),jexcel.current.resizing.element.classList.remove("resizing")}jexcel.current.resizing=null}else if(jexcel.current.dragging){if(jexcel.current.dragging){if(jexcel.current.dragging.column){var nt=o.target.getAttribute("data-x");jexcel.current.headers[jexcel.current.dragging.column].classList.remove("dragging");for(var tt=0;tt<jexcel.current.rows.length;tt++)jexcel.current.records[tt][jexcel.current.dragging.column]&&jexcel.current.records[tt][jexcel.current.dragging.column].classList.remove("dragging");for(var et=0;et<jexcel.current.headers.length;et++)jexcel.current.headers[et].classList.remove("dragging-left"),jexcel.current.headers[et].classList.remove("dragging-right");nt&&jexcel.current.dragging.column!=jexcel.current.dragging.destination&&jexcel.current.moveColumn(jexcel.current.dragging.column,jexcel.current.dragging.destination)}else{if(jexcel.current.dragging.element.nextSibling){var ot=parseInt(jexcel.current.dragging.element.nextSibling.getAttribute("data-y"));jexcel.current.dragging.row<ot&&(ot-=1)}else var ot=parseInt(jexcel.current.dragging.element.previousSibling.getAttribute("data-y"));jexcel.current.dragging.row!=jexcel.current.dragging.destination&&jexcel.current.moveRow(jexcel.current.dragging.row,ot,!0),jexcel.current.dragging.element.classList.remove("dragging")}jexcel.current.dragging=null}}else jexcel.current.selectedCorner&&(jexcel.current.selectedCorner=!1,jexcel.current.selection.length>0&&(jexcel.current.copyData(jexcel.current.selection[0],jexcel.current.selection[jexcel.current.selection.length-1]),jexcel.current.removeCopySelection()));jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null),jexcel.isMouseAction=!1},jexcel.mouseMoveControls=function(o){if(o=o||window.event,o.buttons)var s=o.buttons;else if(o.button)var s=o.button;else var s=o.which;if(s||(jexcel.isMouseAction=!1),jexcel.current)if(jexcel.isMouseAction==!0){if(jexcel.current.resizing)if(jexcel.current.resizing.column){var _=o.pageX-jexcel.current.resizing.mousePosition;if(jexcel.current.resizing.width+_>0){var _e=jexcel.current.resizing.width+_;jexcel.current.colgroup[jexcel.current.resizing.column].setAttribute("width",_e),jexcel.current.updateCornerPosition()}}else{var et=o.pageY-jexcel.current.resizing.mousePosition;if(jexcel.current.resizing.height+et>0){var it=jexcel.current.resizing.height+et;jexcel.current.rows[jexcel.current.resizing.row].setAttribute("height",it),jexcel.current.updateCornerPosition()}}}else{var tt=o.target.getAttribute("data-x"),rt=o.target.getAttribute("data-y"),nt=o.target.getBoundingClientRect();jexcel.current.cursor&&(jexcel.current.cursor.style.cursor="",jexcel.current.cursor=null),o.target.parentNode.parentNode&&o.target.parentNode.parentNode.className&&(o.target.parentNode.parentNode.classList.contains("resizable")&&(o.target&&tt&&!rt&&nt.width-(o.clientX-nt.left)<6?(jexcel.current.cursor=o.target,jexcel.current.cursor.style.cursor="col-resize"):o.target&&!tt&&rt&&nt.height-(o.clientY-nt.top)<6&&(jexcel.current.cursor=o.target,jexcel.current.cursor.style.cursor="row-resize")),o.target.parentNode.parentNode.classList.contains("draggable")&&(o.target&&!tt&&rt&&nt.width-(o.clientX-nt.left)<6||o.target&&tt&&!rt&&nt.height-(o.clientY-nt.top)<6)&&(jexcel.current.cursor=o.target,jexcel.current.cursor.style.cursor="move"))}},jexcel.mouseOverControls=function(o){if(o=o||window.event,o.buttons)var s=o.buttons;else if(o.button)var s=o.button;else var s=o.which;if(s||(jexcel.isMouseAction=!1),jexcel.current&&jexcel.isMouseAction==!0){var _=jexcel.getElement(o.target);if(_[0]){if(jexcel.current!=_[0].jexcel&&jexcel.current)return!1;var _e=o.target.getAttribute("data-x"),et=o.target.getAttribute("data-y");if(jexcel.current.dragging){if(jexcel.current.dragging.column){if(_e)if(jexcel.current.isColMerged(_e).length)console.error("Jspreadsheet: This column is part of a merged cell.");else{for(var it=0;it<jexcel.current.headers.length;it++)jexcel.current.headers[it].classList.remove("dragging-left"),jexcel.current.headers[it].classList.remove("dragging-right");jexcel.current.dragging.column==_e?jexcel.current.dragging.destination=parseInt(_e):o.target.clientWidth/2>o.offsetX?(jexcel.current.dragging.column<_e?jexcel.current.dragging.destination=parseInt(_e)-1:jexcel.current.dragging.destination=parseInt(_e),jexcel.current.headers[_e].classList.add("dragging-left")):(jexcel.current.dragging.column<_e?jexcel.current.dragging.destination=parseInt(_e):jexcel.current.dragging.destination=parseInt(_e)+1,jexcel.current.headers[_e].classList.add("dragging-right"))}}else if(et)if(jexcel.current.isRowMerged(et).length)console.error("Jspreadsheet: This row is part of a merged cell.");else{var tt=o.target.clientHeight/2>o.offsetY?o.target.parentNode.nextSibling:o.target.parentNode;jexcel.current.dragging.element!=tt&&(o.target.parentNode.parentNode.insertBefore(jexcel.current.dragging.element,tt),jexcel.current.dragging.destination=Array.prototype.indexOf.call(jexcel.current.dragging.element.parentNode.children,jexcel.current.dragging.element))}}else if(!jexcel.current.resizing){if(_[1]==1&&jexcel.current.selectedHeader){var _e=o.target.getAttribute("data-x"),rt=jexcel.current.selectedHeader,nt=_e;jexcel.current.updateSelectionFromCoords(rt,0,nt,jexcel.current.options.data.length-1)}if(_[1]==2)if(o.target.classList.contains("jexcel_row")){if(jexcel.current.selectedRow){var rt=jexcel.current.selectedRow,nt=et;jexcel.current.updateSelectionFromCoords(0,rt,jexcel.current.options.data[0].length-1,nt)}}else jexcel.current.edition||_e&&et&&(jexcel.current.selectedCorner?jexcel.current.updateCopySelection(_e,et):jexcel.current.selectedCell&&jexcel.current.updateSelectionFromCoords(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],_e,et))}}}jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null)},jexcel.doubleClickControls=function(o){if(jexcel.current)if(o.target.classList.contains("jexcel_corner")){if(jexcel.current.highlighted.length>0){var s=jexcel.current.highlighted[0].getAttribute("data-x"),_=parseInt(jexcel.current.highlighted[jexcel.current.highlighted.length-1].getAttribute("data-y"))+1,_e=jexcel.current.highlighted[jexcel.current.highlighted.length-1].getAttribute("data-x"),et=jexcel.current.records.length-1;jexcel.current.copyData(jexcel.current.records[_][s],jexcel.current.records[et][_e])}}else if(o.target.classList.contains("jexcel_column_filter")){var it=o.target.getAttribute("data-x");jexcel.current.openFilter(it)}else{var tt=jexcel.getElement(o.target);if(tt[1]==1&&jexcel.current.options.columnSorting==!0){var it=o.target.getAttribute("data-x");it&&jexcel.current.orderBy(it)}if(tt[1]==2&&jexcel.current.options.editable==!0&&!jexcel.current.edition){var rt=function(ot){if(ot.parentNode){var st=ot.getAttribute("data-x"),at=ot.getAttribute("data-y");return st&&at?ot:rt(ot.parentNode)}},nt=rt(o.target);nt&&nt.classList.contains("highlight")&&jexcel.current.openEditor(nt)}}},jexcel.copyControls=function(o){jexcel.current&&jexcel.copyControls.enabled&&(jexcel.current.edition||jexcel.current.copy(!0))},jexcel.cutControls=function(o){jexcel.current&&(jexcel.current.edition||(jexcel.current.copy(!0),jexcel.current.options.editable==!0&&jexcel.current.setValue(jexcel.current.highlighted,"")))},jexcel.pasteControls=function(o){jexcel.current&&jexcel.current.selectedCell&&(jexcel.current.edition||jexcel.current.options.editable==!0&&(o&&o.clipboardData?(jexcel.current.paste(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],o.clipboardData.getData("text")),o.preventDefault()):window.clipboardData&&jexcel.current.paste(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],window.clipboardData.getData("text"))))},jexcel.contextMenuControls=function(o){if(o=o||window.event,"buttons"in o?o.buttons:o.which||o.button,jexcel.current){if(jexcel.current.edition)o.preventDefault();else if(jexcel.current.options.contextMenu&&(jexcel.current.contextMenu.contextmenu.close(),jexcel.current)){var s=o.target.getAttribute("data-x"),_=o.target.getAttribute("data-y");if(s||_){(s<parseInt(jexcel.current.selectedCell[0])||s>parseInt(jexcel.current.selectedCell[2])||_<parseInt(jexcel.current.selectedCell[1])||_>parseInt(jexcel.current.selectedCell[3]))&&jexcel.current.updateSelectionFromCoords(s,_,s,_);var _e=jexcel.current.options.contextMenu(jexcel.current,s,_,o);jexcel.current.contextMenu.contextmenu.open(o,_e),o.preventDefault()}}}},jexcel.touchStartControls=function(o){var s=jexcel.getElement(o.target);if(s[0]?jexcel.current!=s[0].jexcel&&(jexcel.current&&jexcel.current.resetSelection(),jexcel.current=s[0].jexcel):jexcel.current&&(jexcel.current.resetSelection(),jexcel.current=null),jexcel.current&&!jexcel.current.edition){var _=o.target.getAttribute("data-x"),_e=o.target.getAttribute("data-y");_&&_e&&(jexcel.current.updateSelectionFromCoords(_,_e),jexcel.timeControl=setTimeout(function(){jexcel.current.options.columns[_].type=="color"?jexcel.tmpElement=null:jexcel.tmpElement=o.target,jexcel.current.openEditor(o.target,!1,o)},500))}},jexcel.touchEndControls=function(o){jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null,jexcel.tmpElement&&jexcel.tmpElement.children[0].tagName=="INPUT"&&jexcel.tmpElement.children[0].focus(),jexcel.tmpElement=null)},jexcel.tabs=function(o,s){var _=[];if(o.classList.contains("jexcel_tabs"))var _e=o.children[0],it=o.children[1];else{o.innerHTML="",o.classList.add("jexcel_tabs"),o.jexcel=[];var et=document.createElement("div"),_e=o.appendChild(et),et=document.createElement("div"),it=o.appendChild(et)}for(var tt=[],rt=[],nt=0;nt<s.length;nt++){tt[nt]=document.createElement("div"),tt[nt].classList.add("jexcel_tab");var ot=jexcel(tt[nt],s[nt]);it.appendChild(tt[nt]),_[nt]=o.jexcel.push(ot),rt[nt]=document.createElement("div"),rt[nt].classList.add("jexcel_tab_link"),rt[nt].setAttribute("data-spreadsheet",o.jexcel.length-1),rt[nt].innerHTML=s[nt].sheetName,rt[nt].onclick=function(){for(var at=0;at<_e.children.length;at++)_e.children[at].classList.remove("selected"),it.children[at].style.display="none";var lt=this.getAttribute("data-spreadsheet");it.children[lt].style.display="block",_e.children[lt].classList.add("selected")},_e.appendChild(rt[nt])}for(var st=0;st<_e.children.length;st++)_e.children[st].classList.remove("selected"),it.children[st].style.display="none";return _e.children[_e.children.length-1].classList.add("selected"),it.children[_e.children.length-1].style.display="block",_},jexcel.createTabs=jexcel.tabs,jexcel.fromSpreadsheet=function(o,s){var _=function(et){var it=[];return et.SheetNames.forEach(function(tt){var rt={};rt.rows=[],rt.columns=[],rt.data=[],rt.style={},rt.sheetName=tt;var dt=et.Sheets[tt]["!cols"];if(dt&&dt.length)for(var nt=0;nt<dt.length;nt++)rt.columns[nt]={},dt[nt]&&dt[nt].wpx&&(rt.columns[nt].width=dt[nt].wpx+"px");var dt=et.Sheets[tt]["!rows"];if(dt&&dt.length)for(var nt=0;nt<dt.length;nt++)dt[nt]&&dt[nt].hpx&&(rt.rows[nt]={},rt.rows[nt].height=dt[nt].hpx+"px");var dt=et.Sheets[tt]["!merges"];if(dt&&dt.length>0){rt.mergeCells=[];for(var nt=0;nt<dt.length;nt++){var ot=dt[nt].s.c,st=dt[nt].s.r,at=dt[nt].e.c,lt=dt[nt].e.r,ct=jexcel.getColumnNameFromId([ot,st]);rt.mergeCells[ct]=[at-ot+1,lt-st+1]}}for(var ht=0,mt=0,dt=Object.keys(et.Sheets[tt]),nt=0;nt<dt.length;nt++)if(dt[nt].substr(0,1)!="!"){var ft=et.Sheets[tt][dt[nt]],ut=jexcel.getIdFromColumnName(dt[nt],!0);rt.data[ut[1]]||(rt.data[ut[1]]=[]),rt.data[ut[1]][ut[0]]=ft.f?"="+ft.f:ft.w,ht<ut[0]&&(ht=ut[0]),mt<ut[1]&&(mt=ut[1]),ft.style&&Object.keys(ft.style).length>0&&(rt.style[dt[nt]]=ft.style),ft.s&&ft.s.fgColor&&(rt.style[dt[nt]]&&(rt.style[dt[nt]]+=";"),rt.style[dt[nt]]+="background-color:#"+ft.s.fgColor.rgb)}for(var pt=rt.columns,At=0;At<=mt;At++)for(var nt=0;nt<=ht;nt++)rt.data[At]||(rt.data[At]=[]),rt.data[At][nt]||pt<nt&&(rt.data[At][nt]="");it.push(rt)}),it},_e;_e=new XMLHttpRequest,_e.open("GET",o,!0),typeof Uint8Array!="undefined"?(_e.responseType="arraybuffer",_e.onload=function(et){var it=_e.response,tt=new Uint8Array(it),rt=XLSX.read(tt,{type:"array",cellFormula:!0,cellStyles:!0});s(_(rt))}):(_e.setRequestHeader("Accept-Charset","x-user-defined"),_e.onreadystatechange=function(){if(_e.readyState==4&&_e.status==200){var et=convertResponseBodyToText(_e.responseBody),it=XLSX.read(et,{type:"binary",cellFormula:!0,cellStyles:!0});s(_(it))}}),_e.send()},jexcel.validLetter=function(o){var s=/([\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC-\u0400-\u04FF']+)/g;return o.match(s)?1:0},jexcel.injectArray=function(o,s,_){return o.slice(0,s).concat(_).concat(o.slice(s))},jexcel.getColumnName=function(o){var s="";return o>701?(s+=String.fromCharCode(64+parseInt(o/676)),s+=String.fromCharCode(64+parseInt(o%676/26))):o>25&&(s+=String.fromCharCode(64+parseInt(o/26))),s+=String.fromCharCode(65+o%26),s},jexcel.getIdFromColumnName=function(o,s){var _=/^[a-zA-Z]+/.exec(o);if(_){for(var _e=0,et=0;et<_[0].length;et++)_e+=parseInt(_[0].charCodeAt(et)-64)*Math.pow(26,_[0].length-1-et);_e--,_e<0&&(_e=0);var it=parseInt(/[0-9]+$/.exec(o));it>0&&it--,s==!0?o=[_e,it]:o=_e+"-"+it}return o},jexcel.getColumnNameFromId=function(o){return Array.isArray(o)||(o=o.split("-")),jexcel.getColumnName(parseInt(o[0]))+(parseInt(o[1])+1)},jexcel.getElement=function(o){var s=0,_=0;function _e(et){et.className&&et.classList.contains("jexcel_container")&&(_=et),et.tagName=="THEAD"?s=1:et.tagName=="TBODY"&&(s=2),et.parentNode&&(_||_e(et.parentNode))}return _e(o),[_,s]},jexcel.doubleDigitFormat=function(o){return o=""+o,o.length==1&&(o="0"+o),o},jexcel.createFromTable=function(o,s){if(o.tagName!="TABLE")console.log("Element is not a table");else{s||(s={}),s.columns=[],s.data=[];var _=o.querySelectorAll("colgroup > col");if(_.length)for(var _e=0;_e<_.length;_e++){var et=_[_e].style.width;if(!et)var et=_[_e].getAttribute("width");et&&(s.columns[_e]||(s.columns[_e]={}),s.columns[_e].width=et)}var it=function(Ot){var Mt=Ot.getBoundingClientRect(),jt=Mt.width>50?Mt.width:50;s.columns[_e]||(s.columns[_e]={}),Ot.getAttribute("data-celltype")?s.columns[_e].type=Ot.getAttribute("data-celltype"):s.columns[_e].type="text",s.columns[_e].width=jt+"px",s.columns[_e].title=Ot.innerHTML,s.columns[_e].align=Ot.style.textAlign||"center",(Mt=Ot.getAttribute("name"))&&(s.columns[_e].name=Mt),(Mt=Ot.getAttribute("id"))&&(s.columns[_e].id=Mt)},tt=[],rt=o.querySelectorAll(":scope > thead > tr");if(rt.length){for(var nt=0;nt<rt.length-1;nt++){for(var ot=[],_e=0;_e<rt[nt].children.length;_e++){var st={title:rt[nt].children[_e].innerText,colspan:rt[nt].children[_e].getAttribute("colspan")||1};ot.push(st)}tt.push(ot)}rt=rt[rt.length-1].children;for(var _e=0;_e<rt.length;_e++)it(rt[_e])}for(var at=0,lt={},ct={},ht={},mt={},vt=o.querySelectorAll(":scope > tr, :scope > tbody > tr"),nt=0;nt<vt.length;nt++)if(s.data[at]=[],s.parseTableFirstRowAsHeader==!0&&!rt.length&&nt==0)for(var _e=0;_e<vt[nt].children.length;_e++)it(vt[nt].children[_e]);else{for(var _e=0;_e<vt[nt].children.length;_e++){var dt=vt[nt].children[_e].getAttribute("data-formula");if(dt)dt.substr(0,1)!="="&&(dt="="+dt);else var dt=vt[nt].children[_e].innerHTML;s.data[at].push(dt);var ft=jexcel.getColumnNameFromId([_e,nt]),ut=vt[nt].children[_e].getAttribute("class");ut&&(mt[ft]=ut);var pt=parseInt(vt[nt].children[_e].getAttribute("colspan"))||0,At=parseInt(vt[nt].children[_e].getAttribute("rowspan"))||0;(pt||At)&&(lt[ft]=[pt||1,At||1]),(gt=vt[nt].children[_e].style&&vt[nt].children[_e].style.display=="none")&&(vt[nt].children[_e].style.display="");var gt=vt[nt].children[_e].getAttribute("style");gt&&(ht[ft]=gt),vt[nt].children[_e].classList.contains("styleBold")&&(ht[ft]?ht[ft]+="; font-weight:bold;":ht[ft]="font-weight:bold;")}vt[nt].style&&vt[nt].style.height&&(ct[nt]={height:vt[nt].style.height}),at++}Object.keys(tt).length>0&&(s.nestedHeaders=tt),Object.keys(ht).length>0&&(s.style=ht),Object.keys(lt).length>0&&(s.mergeCells=lt),Object.keys(ct).length>0&&(s.rows=ct),Object.keys(mt).length>0&&(s.classes=mt);var vt=o.querySelectorAll("tfoot tr");if(vt.length){for(var yt=[],nt=0;nt<vt.length;nt++){for(var bt=[],_e=0;_e<vt[nt].children.length;_e++)bt.push(vt[nt].children[_e].innerText);yt.push(bt)}Object.keys(yt).length>0&&(s.footers=yt)}if(s.parseTableAutoCellType==!0)for(var Ct=[],_e=0;_e<s.columns.length;_e++){var xt=!0,It=!0;Ct[_e]=[];for(var nt=0;nt<s.data.length;nt++){var dt=s.data[nt][_e];Ct[_e][dt]||(Ct[_e][dt]=0),Ct[_e][dt]++,dt.length>25&&(xt=!1),dt.length==10&&dt.substr(4,1)=="-"&&dt.substr(7,1)=="-"||(It=!1)}var St=Object.keys(Ct[_e]).length;It?s.columns[_e].type="calendar":xt==!0&&St>1&&St<=parseInt(s.data.length*.1)&&(s.columns[_e].type="dropdown",s.columns[_e].source=Object.keys(Ct[_e]))}return s}},jexcel.helpers=function(){var o={};return o.getCaretIndex=function(s){if(this.config.root)var _=this.config.root;else var _=window;var _e=0,et=_.getSelection();if(et&&et.rangeCount!==0){var it=et.getRangeAt(0),tt=it.cloneRange();tt.selectNodeContents(s),tt.setEnd(it.endContainer,it.endOffset),_e=tt.toString().length}return _e},o.invert=function(s){for(var _=[],_e=Object.keys(s),et=0;et<_e.length;et++)_[s[_e[et]]]=_e[et];return _},o.getColumnName=function(s){var _="";return s>701?(_+=String.fromCharCode(64+parseInt(s/676)),_+=String.fromCharCode(64+parseInt(s%676/26))):s>25&&(_+=String.fromCharCode(64+parseInt(s/26))),_+=String.fromCharCode(65+s%26),_},o.getColumnNameFromCoords=function(s,_){return o.getColumnName(parseInt(s))+(parseInt(_)+1)},o.getCoordsFromColumnName=function(s){var _=/^[a-zA-Z]+/.exec(s);if(_){for(var _e=0,et=0;et<_[0].length;et++)_e+=parseInt(_[0].charCodeAt(et)-64)*Math.pow(26,_[0].length-1-et);_e--,_e<0&&(_e=0);var it=parseInt(/[0-9]+$/.exec(s))||null;return it>0&&it--,[_e,it]}},o.createFromTable=function(){},o.injectArray=function(s,_,_e){return s.slice(0,_).concat(_e).concat(s.slice(_))},o.parseCSV=function(s,_){_=_||",";for(var _e=0,et=0,it=[[]],tt=0,rt=null,nt=!1,ot=!1,st=0;st<s.length;st++)if(it[et]||(it[et]=[]),it[et][_e]||(it[et][_e]=""),s[st]!="\r")if((s[st]==`
`||s[st]==_)&&(nt==!1||ot==!0||!rt)){if(rt=null,nt=!1,ot=!1,it[et][_e][0]=='"'){var at=it[et][_e].trim();at[at.length-1]=='"'&&(it[et][_e]=at.substr(1,at.length-2))}s[st]==`
`?(_e=0,et++):(_e++,_e>tt&&(tt=_e))}else{if(s[st]=='"'&&(nt=!nt),rt===null){if(rt=nt,rt==!0)continue}else if(rt===!0&&!ot&&s[st]=='"'){s[st+1]=='"'?(nt=!0,it[et][_e]+=s[st],st++):ot=!0;continue}it[et][_e]+=s[st]}for(var lt=0;lt<it.length;lt++)for(var st=0;st<=tt;st++)it[lt][st]===void 0&&(it[lt][st]="");return it},o}(),typeof jQuery!="undefined"&&function(o){o.fn.jspreadsheet=o.fn.jexcel=function(s){var _=o(this).get(0);return _.jexcel?Array.isArray(_.jexcel)?_.jexcel[s][arguments[1]].apply(this,Array.prototype.slice.call(arguments,2)):_.jexcel[s].apply(this,Array.prototype.slice.call(arguments,1)):jexcel(o(this).get(0),arguments[0])}}(jQuery),jexcel})})(dist);var jspreadsheet$1=dist.exports,jspreadsheet="";class DataframeInput extends BaseComponent{constructor(_){super(_);Xn(this,"getConfig",()=>{let _=this.props.col_count,_e={};if(this.props.headers||this.props.datatype){let et=[];for(let it=0;it<_;it++){let tt={};if(this.props.datatype){let rt=this.props.datatype instanceof Array?this.props.datatype[it]:this.props.datatype,nt=this.props.col_width instanceof Array?this.props.col_width[it]:this.props.col_width,ot={str:"text",bool:"checkbox",number:"numeric",date:"calendar"};tt.type=ot[rt],tt.width=nt}this.props.headers&&(tt.title=this.props.headers[it]),et.push(tt)}_e.columns=et}return _e.data=this.props.value,_e});this.wrapper=React.createRef()}componentDidMount(){this.el=jspreadsheet$1(this.wrapper.current,this.getConfig())}resetData(_){let[_e,et]=[_.length,_[0].length],it=this.el.getData(),[tt,rt]=[it.length,it[0].length];tt<_e?this.el.insertRow(_e-tt):tt>_e&&this.el.deleteRow(0,tt-_e),rt<et?this.el.insertColumn(et-rt):rt>et&&this.el.deleteColumn(0,rt-et),this.el.setData(_)}render(){return JSON.stringify(this.props.value)!==JSON.stringify(this.data)&&this.el&&(this.resetData(this.props.value),this.data=this.props.value),jsx("div",{className:"input_dataframe",children:jsx("div",{ref:this.wrapper})})}}class DataframeInputExample extends ComponentExample{render(){let s=[];for(let _ of this.props.value.slice(0,3)){let _e=_.slice(0,3);_.length>3&&_e.push("..."),s.push(_e)}if(this.props.value.length>3){let _=Array(s[0].length).fill("...");s.push(_)}return jsx("table",{className:"input_dataframe_example",children:jsx("tbody",{children:s.map(_=>jsx("tr",{children:_.map(_e=>jsx("td",{children:_e}))}))})})}}class DropdownInput extends BaseComponent{constructor(s){super(s),this.handleChange=this.handleChange.bind(this)}handleChange(s){this.props.handleChange(s)}render(){return jsx("div",{className:"input_dropdown",children:this.props.interpretation===null?jsxs("div",{className:"dropdown",children:[jsxs("button",{className:"selector",children:[this.props.value,jsxs("svg",{className:"caret",viewBox:"0 0 20 20",children:[jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})," "]})]}),jsx("div",{className:"dropdown_menu_holder",children:jsx("ul",{className:"dropdown_menu",children:this.props.choices.map((s,_)=>jsx("li",{className:classNames("dropdown_item",{selected:s===this.props.value}),onClick:this.handleChange.bind(this,s),children:s},_))})})]}):jsx("div",{className:"interpretation",children:this.props.interpretation.map((s,_)=>jsx("div",{className:"interpretation_box",style:{backgroundColor:getSaliencyColor(s)},children:this.props.choices[_]},_))})})}}class DropdownInputExample extends ComponentExample{render(){return jsx("div",{className:"input_dropdown_example",children:this.props.value})}}class FileInput extends BaseComponent{constructor(s){super(s),this.handleChange=this.handleChange.bind(this),this.uploader=React.createRef(),this.openFileUpload=this.openFileUpload.bind(this),this.load_preview_from_files=this.load_preview_from_files.bind(this),this.load_preview_from_upload=this.load_preview_from_upload.bind(this),this.load_preview_from_drop=this.load_preview_from_drop.bind(this)}handleChange(s){this.props.handleChange(s)}openFileUpload(){this.uploader.current.click()}render(){let s=et=>{et.preventDefault(),et.stopPropagation()},_,_e;if(this.props.value!==null){if(this.props.file_count==="single"){let et=Array.isArray(this.props.value)?this.props.value[0]:this.props.value;_=et.name,_e=et.size}else{_=this.props.value.length+" files.",_e=0;let et=Array.isArray(this.props.value)?this.props.value:[this.props.value];for(let it of et)if(it.size===null){_e=null;break}else _e+=it.size}return jsx("div",{className:"input_file",children:jsxs("div",{className:"file_preview_holder",children:[jsx("div",{className:"edit_buttons",children:jsx("button",{className:"clear_button",onClick:this.handleChange.bind(this,null),children:jsx("img",{src:clear_icon})})}),jsx("div",{className:"file_name",children:_}),jsx("div",{className:"file_size",children:_e==null?"":prettyBytes(_e)})]})})}else return jsxs("div",{className:"input_file",onDrag:s,onDragStart:s,onDragEnd:s,onDragOver:s,onDragEnter:s,onDragLeave:s,onDrop:s,children:[jsxs("div",{className:"upload_zone",onClick:this.openFileUpload,onDrop:this.load_preview_from_drop,children:["Drop File Here",jsx("br",{}),"- or -",jsx("br",{}),"Click to Upload"]}),jsx("input",{className:"hidden_upload",type:"file",multiple:this.props.file_count==="multiple",webkitdirectory:this.props.file_count==="directory",mozdirectory:this.props.file_count==="directory",ref:this.uploader,onChange:this.load_preview_from_upload,style:{display:"none"}})]})}load_preview_from_drop(s){this.load_preview_from_files(s.dataTransfer.files)}load_preview_from_upload(s){this.load_preview_from_files(s.target.files)}add_file_to_list(s,_,_e){this.file_data.push({name:_.name,size:_.size,data:s.result,is_example:!1}),this.file_data.length===_e&&this.handleChange(this.file_data)}load_preview_from_files(s){if(!(!s.length||!window.FileReader)){this.file_data=[];for(let _ of s){let _e=new FileReader;_e.readAsDataURL(_),_e.onloadend=this.add_file_to_list.bind(this,_e,_,s.length)}}}}class FileInputExample extends FileComponentExample{render(){return jsx("div",{className:"input_file_example",children:this.props.value})}}var reactWebcam={exports:{}};(function(o,s){(function(_e,et){o.exports=et(react.exports)})(commonjsGlobal,function(_){return function(_e){var et={};function it(tt){if(et[tt])return et[tt].exports;var rt=et[tt]={i:tt,l:!1,exports:{}};return _e[tt].call(rt.exports,rt,rt.exports,it),rt.l=!0,rt.exports}return it.m=_e,it.c=et,it.d=function(tt,rt,nt){it.o(tt,rt)||Object.defineProperty(tt,rt,{enumerable:!0,get:nt})},it.r=function(tt){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(tt,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(tt,"__esModule",{value:!0})},it.t=function(tt,rt){if(rt&1&&(tt=it(tt)),rt&8||rt&4&&typeof tt=="object"&&tt&&tt.__esModule)return tt;var nt=Object.create(null);if(it.r(nt),Object.defineProperty(nt,"default",{enumerable:!0,value:tt}),rt&2&&typeof tt!="string")for(var ot in tt)it.d(nt,ot,function(st){return tt[st]}.bind(null,ot));return nt},it.n=function(tt){var rt=tt&&tt.__esModule?function(){return tt.default}:function(){return tt};return it.d(rt,"a",rt),rt},it.o=function(tt,rt){return Object.prototype.hasOwnProperty.call(tt,rt)},it.p="",it(it.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(_e,et,it){it.r(et);var tt=it("react"),rt=function(){var lt=function(ct,ht){return lt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(mt,dt){mt.__proto__=dt}||function(mt,dt){for(var ft in dt)dt.hasOwnProperty(ft)&&(mt[ft]=dt[ft])},lt(ct,ht)};return function(ct,ht){lt(ct,ht);function mt(){this.constructor=ct}ct.prototype=ht===null?Object.create(ht):(mt.prototype=ht.prototype,new mt)}}(),nt=function(){return nt=Object.assign||function(lt){for(var ct,ht=1,mt=arguments.length;ht<mt;ht++){ct=arguments[ht];for(var dt in ct)Object.prototype.hasOwnProperty.call(ct,dt)&&(lt[dt]=ct[dt])}return lt},nt.apply(this,arguments)},ot=function(lt,ct){var ht={};for(var mt in lt)Object.prototype.hasOwnProperty.call(lt,mt)&&ct.indexOf(mt)<0&&(ht[mt]=lt[mt]);if(lt!=null&&typeof Object.getOwnPropertySymbols=="function")for(var dt=0,mt=Object.getOwnPropertySymbols(lt);dt<mt.length;dt++)ct.indexOf(mt[dt])<0&&Object.prototype.propertyIsEnumerable.call(lt,mt[dt])&&(ht[mt[dt]]=lt[mt[dt]]);return ht};(function(){typeof window!="undefined"&&(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(ct){var ht=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return ht?new Promise(function(mt,dt){ht.call(navigator,ct,mt,dt)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function st(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var at=function(lt){rt(ct,lt);function ct(ht){var mt=lt.call(this,ht)||this;return mt.canvas=null,mt.ctx=null,mt.unmounted=!1,mt.state={hasUserMedia:!1},mt}return ct.prototype.componentDidMount=function(){var ht=this,mt=ht.state,dt=ht.props;if(!st()){dt.onUserMediaError("getUserMedia not supported");return}mt.hasUserMedia||this.requestUserMedia()},ct.prototype.componentDidUpdate=function(ht){var mt=this.props;if(!st()){mt.onUserMediaError("getUserMedia not supported");return}var dt=JSON.stringify(ht.audioConstraints)!==JSON.stringify(mt.audioConstraints),ft=JSON.stringify(ht.videoConstraints)!==JSON.stringify(mt.videoConstraints),ut=ht.minScreenshotWidth!==mt.minScreenshotWidth,pt=ht.minScreenshotHeight!==mt.minScreenshotHeight;(ft||ut||pt)&&(this.canvas=null,this.ctx=null),(dt||ft)&&(this.stopAndCleanup(),this.requestUserMedia())},ct.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},ct.stopMediaStream=function(ht){ht&&(ht.getVideoTracks&&ht.getAudioTracks?(ht.getVideoTracks().map(function(mt){ht.removeTrack(mt),mt.stop()}),ht.getAudioTracks().map(function(mt){ht.removeTrack(mt),mt.stop()})):ht.stop())},ct.prototype.stopAndCleanup=function(){var ht=this.state;ht.hasUserMedia&&(ct.stopMediaStream(this.stream),ht.src&&window.URL.revokeObjectURL(ht.src))},ct.prototype.getScreenshot=function(ht){var mt=this,dt=mt.state,ft=mt.props;if(!dt.hasUserMedia)return null;var ut=this.getCanvas(ht);return ut&&ut.toDataURL(ft.screenshotFormat,ft.screenshotQuality)},ct.prototype.getCanvas=function(ht){var mt=this,dt=mt.state,ft=mt.props;if(!this.video||!dt.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var ut=this.video.videoWidth,pt=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var At=ut/pt;ut=ft.minScreenshotWidth||this.video.clientWidth,pt=ut/At,ft.minScreenshotHeight&&pt<ft.minScreenshotHeight&&(pt=ft.minScreenshotHeight,ut=pt*At)}this.canvas=document.createElement("canvas"),this.canvas.width=(ht==null?void 0:ht.width)||ut,this.canvas.height=(ht==null?void 0:ht.height)||pt,this.ctx=this.canvas.getContext("2d")}var gt=this,vt=gt.ctx,yt=gt.canvas;return vt&&yt&&(ft.mirrored&&(vt.translate(yt.width,0),vt.scale(-1,1)),vt.imageSmoothingEnabled=ft.imageSmoothing,vt.drawImage(this.video,0,0,(ht==null?void 0:ht.width)||yt.width,(ht==null?void 0:ht.height)||yt.height),ft.mirrored&&(vt.scale(-1,1),vt.translate(-yt.width,0))),yt},ct.prototype.requestUserMedia=function(){var ht=this,mt=this.props,dt=function(pt,At){var gt={video:typeof At!="undefined"?At:!0};mt.audio&&(gt.audio=typeof pt!="undefined"?pt:!0),navigator.mediaDevices.getUserMedia(gt).then(function(vt){ht.unmounted?ct.stopMediaStream(vt):ht.handleUserMedia(null,vt)}).catch(function(vt){ht.handleUserMedia(vt)})};if("mediaDevices"in navigator)dt(mt.audioConstraints,mt.videoConstraints);else{var ft=function(pt){return{optional:[{sourceId:pt}]}},ut=function(pt){var At=pt.deviceId;return typeof At=="string"?At:Array.isArray(At)&&At.length>0?At[0]:typeof At=="object"&&At.ideal?At.ideal:null};MediaStreamTrack.getSources(function(pt){var At=null,gt=null;pt.forEach(function(bt){bt.kind==="audio"?At=bt.id:bt.kind==="video"&&(gt=bt.id)});var vt=ut(mt.audioConstraints);vt&&(At=vt);var yt=ut(mt.videoConstraints);yt&&(gt=yt),dt(ft(At),ft(gt))})}},ct.prototype.handleUserMedia=function(ht,mt){var dt=this.props;if(ht||!mt){this.setState({hasUserMedia:!1}),dt.onUserMediaError(ht);return}this.stream=mt;try{this.video&&(this.video.srcObject=mt),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(mt)})}dt.onUserMedia(mt)},ct.prototype.render=function(){var ht=this,mt=this,dt=mt.state,ft=mt.props,ut=ft.audio;ft.forceScreenshotSourceSize,ft.onUserMedia,ft.onUserMediaError,ft.screenshotFormat,ft.screenshotQuality,ft.minScreenshotWidth,ft.minScreenshotHeight,ft.audioConstraints,ft.videoConstraints,ft.imageSmoothing;var pt=ft.mirrored,At=ft.style,gt=At===void 0?{}:At,vt=ot(ft,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style"]),yt=pt?nt(nt({},gt),{transform:(gt.transform||"")+" scaleX(-1)"}):gt;return tt.createElement("video",nt({autoPlay:!0,src:dt.src,muted:ut,playsInline:!0,ref:function(bt){ht.video=bt},style:yt},vt))},ct.defaultProps={audio:!0,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},ct}(tt.Component);et.default=at},react:function(_e,et){_e.exports=_}}).default})})(reactWebcam);var Webcam=getDefaultExportFromCjs(reactWebcam.exports);typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(s,_){if(s==null)throw new TypeError("Cannot convert undefined or null to object");let _e=Object(s);for(let et=1;et<arguments.length;et++){let it=arguments[et];if(it!=null)for(let tt in it)Object.prototype.hasOwnProperty.call(it,tt)&&(_e[tt]=it[tt])}return _e},writable:!0,configurable:!0});class History{constructor(s=10,_=!1){this.undoLimit=s,this.undoList=[],this.redoList=[],this.current=null,this.debug=_}getUndoLimit(){return this.undoLimit}getCurrent(){return this.current}keep(s){try{this.redoList=[],this.current&&this.undoList.push(this.current),this.undoList.length>this.undoLimit&&this.undoList.shift(),this.current=s}finally{this.print()}}undo(){try{return this.current&&(this.redoList.push(this.current),this.redoList.length>this.undoLimit&&this.redoList.shift(),this.undoList.length===0&&(this.current=null)),this.undoList.length>0?(this.current=this.undoList.pop(),this.current):null}finally{this.print()}}redo(){try{return this.redoList.length>0?(this.current&&this.undoList.push(this.current),this.current=this.redoList.pop(),this.current):null}finally{this.print()}}canRedo(){return this.redoList.length>0}canUndo(){return this.undoList.length>0||this.current!==null}clear(){this.undoList=[],this.redoList=[],this.current=null,this.print()}print(){this.debug&&console.log(this.undoList," -> "+this.current+" <- ",this.redoList.slice(0).reverse())}}const linearDistance=(o,s)=>{let _=s.x-o.x,_e=s.y-o.y;return Math.sqrt(_*_+_e*_e)},uuid4=()=>{let o="",s;for(s=0;s<32;s+=1)switch(s){case 8:case 20:o+="-",o+=(Math.random()*16|0).toString(16);break;case 12:o+="-",o+="4";break;case 16:o+="-",o+=(Math.random()*4|8).toString(16);break;default:o+=(Math.random()*16|0).toString(16)}return o},hexToRgbA=o=>{var s;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(o))return s=o.substring(1).split(""),s.length==3&&(s=[s[0],s[0],s[1],s[1],s[2],s[2]]),s="0x"+s.join(""),"rgba("+[s>>16&255,s>>8&255,s&255].join(",")+",0.4)";throw new Error("Bad Hex")},colorNameToHex=o=>{var s={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return typeof s[o.toLowerCase()]!="undefined"?s[o.toLowerCase()]:!1};class FabricCanvasTool{constructor(s){this._canvas=s}configureCanvas(s){}doMouseUp(s){}doMouseDown(s){}doMouseMove(s){}doMouseOut(s){}}var fabric={};(function(o){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var s=s||{version:"4.6.0"};if(o.fabric=s,typeof document!="undefined"&&typeof window!="undefined")document instanceof(typeof HTMLDocument!="undefined"?HTMLDocument:Document)?s.document=document:s.document=document.implementation.createHTMLDocument(""),s.window=window;else{var _=require$$2,_e=new _.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;s.document=_e.document,s.jsdomImplForWrapper=require$$2.implForWrapper,s.nodeCanvas=require$$2.Canvas,s.window=_e,DOMParser=s.window.DOMParser}s.isTouchSupported="ontouchstart"in s.window||"ontouchstart"in s.document||s.window&&s.window.navigator&&s.window.navigator.maxTouchPoints>0,s.isLikelyNode=typeof Buffer!="undefined"&&typeof window=="undefined",s.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],s.DPI=96,s.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",s.commaWsp="(?:\\s+,?\\s*|,\\s*)",s.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig,s.reNonWord=/[ \n\.,;!\?\-]/,s.fontPaths={},s.iMatrix=[1,0,0,1,0,0],s.svgNS="http://www.w3.org/2000/svg",s.perfLimitSizeTotal=2097152,s.maxCacheSideLimit=4096,s.minCacheSideLimit=256,s.charWidthsCache={},s.textureSize=2048,s.disableStyleCopyPaste=!1,s.enableGLFiltering=!0,s.devicePixelRatio=s.window.devicePixelRatio||s.window.webkitDevicePixelRatio||s.window.mozDevicePixelRatio||1,s.browserShadowBlurConstant=1,s.arcToSegmentsCache={},s.boundsOfCurveCache={},s.cachesBoundsOfCurve=!0,s.forceGLPutImageData=!1,s.initFilterBackend=function(){if(s.enableGLFiltering&&s.isWebglSupported&&s.isWebglSupported(s.textureSize))return console.log("max texture size: "+s.maxTextureSize),new s.WebglFilterBackend({tileSize:s.textureSize});if(s.Canvas2dFilterBackend)return new s.Canvas2dFilterBackend},typeof document!="undefined"&&typeof window!="undefined"&&(window.fabric=s),function(){function rt(ct,ht){if(!!this.__eventListeners[ct]){var mt=this.__eventListeners[ct];ht?mt[mt.indexOf(ht)]=!1:s.util.array.fill(mt,!1)}}function nt(ct,ht){if(this.__eventListeners||(this.__eventListeners={}),arguments.length===1)for(var mt in ct)this.on(mt,ct[mt]);else this.__eventListeners[ct]||(this.__eventListeners[ct]=[]),this.__eventListeners[ct].push(ht);return this}function ot(ct,ht){var mt=function(){ht.apply(this,arguments),this.off(ct,mt)}.bind(this);this.on(ct,mt)}function st(ct,ht){if(arguments.length===1)for(var mt in ct)ot.call(this,mt,ct[mt]);else ot.call(this,ct,ht);return this}function at(ct,ht){if(!this.__eventListeners)return this;if(arguments.length===0)for(ct in this.__eventListeners)rt.call(this,ct);else if(arguments.length===1&&typeof arguments[0]=="object")for(var mt in ct)rt.call(this,mt,ct[mt]);else rt.call(this,ct,ht);return this}function lt(ct,ht){if(!this.__eventListeners)return this;var mt=this.__eventListeners[ct];if(!mt)return this;for(var dt=0,ft=mt.length;dt<ft;dt++)mt[dt]&&mt[dt].call(this,ht||{});return this.__eventListeners[ct]=mt.filter(function(ut){return ut!==!1}),this}s.Observable={fire:lt,on:nt,once:st,off:at}}(),s.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var rt=0,nt=arguments.length;rt<nt;rt++)this._onObjectAdded(arguments[rt]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(rt,nt,ot){var st=this._objects;return ot?st[nt]=rt:st.splice(nt,0,rt),this._onObjectAdded&&this._onObjectAdded(rt),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var rt=this._objects,nt,ot=!1,st=0,at=arguments.length;st<at;st++)nt=rt.indexOf(arguments[st]),nt!==-1&&(ot=!0,rt.splice(nt,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[st]));return this.renderOnAddRemove&&ot&&this.requestRenderAll(),this},forEachObject:function(rt,nt){for(var ot=this.getObjects(),st=0,at=ot.length;st<at;st++)rt.call(nt,ot[st],st,ot);return this},getObjects:function(rt){return typeof rt=="undefined"?this._objects.concat():this._objects.filter(function(nt){return nt.type===rt})},item:function(rt){return this._objects[rt]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(rt,nt){return this._objects.indexOf(rt)>-1?!0:nt?this._objects.some(function(ot){return typeof ot.contains=="function"&&ot.contains(rt,!0)}):!1},complexity:function(){return this._objects.reduce(function(rt,nt){return rt+=nt.complexity?nt.complexity():0,rt},0)}},s.CommonMethods={_setOptions:function(rt){for(var nt in rt)this.set(nt,rt[nt])},_initGradient:function(rt,nt){rt&&rt.colorStops&&!(rt instanceof s.Gradient)&&this.set(nt,new s.Gradient(rt))},_initPattern:function(rt,nt,ot){rt&&rt.source&&!(rt instanceof s.Pattern)?this.set(nt,new s.Pattern(rt,ot)):ot&&ot()},_setObject:function(rt){for(var nt in rt)this._set(nt,rt[nt])},set:function(rt,nt){return typeof rt=="object"?this._setObject(rt):this._set(rt,nt),this},_set:function(rt,nt){this[rt]=nt},toggle:function(rt){var nt=this.get(rt);return typeof nt=="boolean"&&this.set(rt,!nt),this},get:function(rt){return this[rt]}},function(rt){var nt=Math.sqrt,ot=Math.atan2,st=Math.pow,at=Math.PI/180,lt=Math.PI/2;s.util={cos:function(ct){if(ct===0)return 1;ct<0&&(ct=-ct);var ht=ct/lt;switch(ht){case 1:case 3:return 0;case 2:return-1}return Math.cos(ct)},sin:function(ct){if(ct===0)return 0;var ht=ct/lt,mt=1;switch(ct<0&&(mt=-1),ht){case 1:return mt;case 2:return 0;case 3:return-mt}return Math.sin(ct)},removeFromArray:function(ct,ht){var mt=ct.indexOf(ht);return mt!==-1&&ct.splice(mt,1),ct},getRandomInt:function(ct,ht){return Math.floor(Math.random()*(ht-ct+1))+ct},degreesToRadians:function(ct){return ct*at},radiansToDegrees:function(ct){return ct/at},rotatePoint:function(ct,ht,mt){var dt=new s.Point(ct.x-ht.x,ct.y-ht.y),ft=s.util.rotateVector(dt,mt);return new s.Point(ft.x,ft.y).addEquals(ht)},rotateVector:function(ct,ht){var mt=s.util.sin(ht),dt=s.util.cos(ht),ft=ct.x*dt-ct.y*mt,ut=ct.x*mt+ct.y*dt;return{x:ft,y:ut}},transformPoint:function(ct,ht,mt){return mt?new s.Point(ht[0]*ct.x+ht[2]*ct.y,ht[1]*ct.x+ht[3]*ct.y):new s.Point(ht[0]*ct.x+ht[2]*ct.y+ht[4],ht[1]*ct.x+ht[3]*ct.y+ht[5])},makeBoundingBoxFromPoints:function(ct,ht){if(ht)for(var mt=0;mt<ct.length;mt++)ct[mt]=s.util.transformPoint(ct[mt],ht);var dt=[ct[0].x,ct[1].x,ct[2].x,ct[3].x],ft=s.util.array.min(dt),ut=s.util.array.max(dt),pt=ut-ft,At=[ct[0].y,ct[1].y,ct[2].y,ct[3].y],gt=s.util.array.min(At),vt=s.util.array.max(At),yt=vt-gt;return{left:ft,top:gt,width:pt,height:yt}},invertTransform:function(ct){var ht=1/(ct[0]*ct[3]-ct[1]*ct[2]),mt=[ht*ct[3],-ht*ct[1],-ht*ct[2],ht*ct[0]],dt=s.util.transformPoint({x:ct[4],y:ct[5]},mt,!0);return mt[4]=-dt.x,mt[5]=-dt.y,mt},toFixed:function(ct,ht){return parseFloat(Number(ct).toFixed(ht))},parseUnit:function(ct,ht){var mt=/\D{0,2}$/.exec(ct),dt=parseFloat(ct);switch(ht||(ht=s.Text.DEFAULT_SVG_FONT_SIZE),mt[0]){case"mm":return dt*s.DPI/25.4;case"cm":return dt*s.DPI/2.54;case"in":return dt*s.DPI;case"pt":return dt*s.DPI/72;case"pc":return dt*s.DPI/72*12;case"em":return dt*ht;default:return dt}},falseFunction:function(){return!1},getKlass:function(ct,ht){return ct=s.util.string.camelize(ct.charAt(0).toUpperCase()+ct.slice(1)),s.util.resolveNamespace(ht)[ct]},getSvgAttributes:function(ct){var ht=["instantiated_by_use","style","id","class"];switch(ct){case"linearGradient":ht=ht.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":ht=ht.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":ht=ht.concat(["offset","stop-color","stop-opacity"]);break}return ht},resolveNamespace:function(ct){if(!ct)return s;var ht=ct.split("."),mt=ht.length,dt,ft=rt||s.window;for(dt=0;dt<mt;++dt)ft=ft[ht[dt]];return ft},loadImage:function(ct,ht,mt,dt){if(!ct){ht&&ht.call(mt,ct);return}var ft=s.util.createImage(),ut=function(){ht&&ht.call(mt,ft,!1),ft=ft.onload=ft.onerror=null};ft.onload=ut,ft.onerror=function(){s.log("Error loading "+ft.src),ht&&ht.call(mt,null,!0),ft=ft.onload=ft.onerror=null},ct.indexOf("data")!==0&&dt!==void 0&&dt!==null&&(ft.crossOrigin=dt),ct.substring(0,14)==="data:image/svg"&&(ft.onload=null,s.util.loadImageInDom(ft,ut)),ft.src=ct},loadImageInDom:function(ct,ht){var mt=s.document.createElement("div");mt.style.width=mt.style.height="1px",mt.style.left=mt.style.top="-100%",mt.style.position="absolute",mt.appendChild(ct),s.document.querySelector("body").appendChild(mt),ct.onload=function(){ht(),mt.parentNode.removeChild(mt),mt=null}},enlivenObjects:function(ct,ht,mt,dt){ct=ct||[];var ft=[],ut=0,pt=ct.length;function At(){++ut===pt&&ht&&ht(ft.filter(function(gt){return gt}))}if(!pt){ht&&ht(ft);return}ct.forEach(function(gt,vt){if(!gt||!gt.type){At();return}var yt=s.util.getKlass(gt.type,mt);yt.fromObject(gt,function(bt,Ct){Ct||(ft[vt]=bt),dt&&dt(gt,bt,Ct),At()})})},enlivenPatterns:function(ct,ht){ct=ct||[];function mt(){++ft===ut&&ht&&ht(dt)}var dt=[],ft=0,ut=ct.length;if(!ut){ht&&ht(dt);return}ct.forEach(function(pt,At){pt&&pt.source?new s.Pattern(pt,function(gt){dt[At]=gt,mt()}):(dt[At]=pt,mt())})},groupSVGElements:function(ct,ht,mt){var dt;return ct&&ct.length===1?ct[0]:(ht&&(ht.width&&ht.height?ht.centerPoint={x:ht.width/2,y:ht.height/2}:(delete ht.width,delete ht.height)),dt=new s.Group(ct,ht),typeof mt!="undefined"&&(dt.sourcePath=mt),dt)},populateWithProperties:function(ct,ht,mt){if(mt&&Object.prototype.toString.call(mt)==="[object Array]")for(var dt=0,ft=mt.length;dt<ft;dt++)mt[dt]in ct&&(ht[mt[dt]]=ct[mt[dt]])},drawDashedLine:function(ct,ht,mt,dt,ft,ut){var pt=dt-ht,At=ft-mt,gt=nt(pt*pt+At*At),vt=ot(At,pt),yt=ut.length,bt=0,Ct=!0;for(ct.save(),ct.translate(ht,mt),ct.moveTo(0,0),ct.rotate(vt),ht=0;gt>ht;)ht+=ut[bt++%yt],ht>gt&&(ht=gt),ct[Ct?"lineTo":"moveTo"](ht,0),Ct=!Ct;ct.restore()},createCanvasElement:function(){return s.document.createElement("canvas")},copyCanvasElement:function(ct){var ht=s.util.createCanvasElement();return ht.width=ct.width,ht.height=ct.height,ht.getContext("2d").drawImage(ct,0,0),ht},toDataURL:function(ct,ht,mt){return ct.toDataURL("image/"+ht,mt)},createImage:function(){return s.document.createElement("img")},multiplyTransformMatrices:function(ct,ht,mt){return[ct[0]*ht[0]+ct[2]*ht[1],ct[1]*ht[0]+ct[3]*ht[1],ct[0]*ht[2]+ct[2]*ht[3],ct[1]*ht[2]+ct[3]*ht[3],mt?0:ct[0]*ht[4]+ct[2]*ht[5]+ct[4],mt?0:ct[1]*ht[4]+ct[3]*ht[5]+ct[5]]},qrDecompose:function(ct){var ht=ot(ct[1],ct[0]),mt=st(ct[0],2)+st(ct[1],2),dt=nt(mt),ft=(ct[0]*ct[3]-ct[2]*ct[1])/dt,ut=ot(ct[0]*ct[2]+ct[1]*ct[3],mt);return{angle:ht/at,scaleX:dt,scaleY:ft,skewX:ut/at,skewY:0,translateX:ct[4],translateY:ct[5]}},calcRotateMatrix:function(ct){if(!ct.angle)return s.iMatrix.concat();var ht=s.util.degreesToRadians(ct.angle),mt=s.util.cos(ht),dt=s.util.sin(ht);return[mt,dt,-dt,mt,0,0]},calcDimensionsMatrix:function(ct){var ht=typeof ct.scaleX=="undefined"?1:ct.scaleX,mt=typeof ct.scaleY=="undefined"?1:ct.scaleY,dt=[ct.flipX?-ht:ht,0,0,ct.flipY?-mt:mt,0,0],ft=s.util.multiplyTransformMatrices,ut=s.util.degreesToRadians;return ct.skewX&&(dt=ft(dt,[1,0,Math.tan(ut(ct.skewX)),1],!0)),ct.skewY&&(dt=ft(dt,[1,Math.tan(ut(ct.skewY)),0,1],!0)),dt},composeMatrix:function(ct){var ht=[1,0,0,1,ct.translateX||0,ct.translateY||0],mt=s.util.multiplyTransformMatrices;return ct.angle&&(ht=mt(ht,s.util.calcRotateMatrix(ct))),(ct.scaleX!==1||ct.scaleY!==1||ct.skewX||ct.skewY||ct.flipX||ct.flipY)&&(ht=mt(ht,s.util.calcDimensionsMatrix(ct))),ht},resetObjectTransform:function(ct){ct.scaleX=1,ct.scaleY=1,ct.skewX=0,ct.skewY=0,ct.flipX=!1,ct.flipY=!1,ct.rotate(0)},saveObjectTransform:function(ct){return{scaleX:ct.scaleX,scaleY:ct.scaleY,skewX:ct.skewX,skewY:ct.skewY,angle:ct.angle,left:ct.left,flipX:ct.flipX,flipY:ct.flipY,top:ct.top}},isTransparent:function(ct,ht,mt,dt){dt>0&&(ht>dt?ht-=dt:ht=0,mt>dt?mt-=dt:mt=0);var ft=!0,ut,pt,At=ct.getImageData(ht,mt,dt*2||1,dt*2||1),gt=At.data.length;for(ut=3;ut<gt&&(pt=At.data[ut],ft=pt<=0,ft!==!1);ut+=4);return At=null,ft},parsePreserveAspectRatioAttribute:function(ct){var ht="meet",mt="Mid",dt="Mid",ft=ct.split(" "),ut;return ft&&ft.length&&(ht=ft.pop(),ht!=="meet"&&ht!=="slice"?(ut=ht,ht="meet"):ft.length&&(ut=ft.pop())),mt=ut!=="none"?ut.slice(1,4):"none",dt=ut!=="none"?ut.slice(5,8):"none",{meetOrSlice:ht,alignX:mt,alignY:dt}},clearFabricFontCache:function(ct){ct=(ct||"").toLowerCase(),ct?s.charWidthsCache[ct]&&delete s.charWidthsCache[ct]:s.charWidthsCache={}},limitDimsByArea:function(ct,ht){var mt=Math.sqrt(ht*ct),dt=Math.floor(ht/mt);return{x:Math.floor(mt),y:dt}},capValue:function(ct,ht,mt){return Math.max(ct,Math.min(ht,mt))},findScaleToFit:function(ct,ht){return Math.min(ht.width/ct.width,ht.height/ct.height)},findScaleToCover:function(ct,ht){return Math.max(ht.width/ct.width,ht.height/ct.height)},matrixToSVG:function(ct){return"matrix("+ct.map(function(ht){return s.util.toFixed(ht,s.Object.NUM_FRACTION_DIGITS)}).join(" ")+")"},removeTransformFromObject:function(ct,ht){var mt=s.util.invertTransform(ht),dt=s.util.multiplyTransformMatrices(mt,ct.calcOwnMatrix());s.util.applyTransformToObject(ct,dt)},addTransformToObject:function(ct,ht){s.util.applyTransformToObject(ct,s.util.multiplyTransformMatrices(ht,ct.calcOwnMatrix()))},applyTransformToObject:function(ct,ht){var mt=s.util.qrDecompose(ht),dt=new s.Point(mt.translateX,mt.translateY);ct.flipX=!1,ct.flipY=!1,ct.set("scaleX",mt.scaleX),ct.set("scaleY",mt.scaleY),ct.skewX=mt.skewX,ct.skewY=mt.skewY,ct.angle=mt.angle,ct.setPositionByOrigin(dt,"center","center")},sizeAfterTransform:function(ct,ht,mt){var dt=ct/2,ft=ht/2,ut=[{x:-dt,y:-ft},{x:dt,y:-ft},{x:-dt,y:ft},{x:dt,y:ft}],pt=s.util.calcDimensionsMatrix(mt),At=s.util.makeBoundingBoxFromPoints(ut,pt);return{x:At.width,y:At.height}}}}(o),function(){var rt=Array.prototype.join,nt={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},ot={m:"l",M:"L"};function st(Wt,$t,Jt,Nt,Lt,Kt,Pt,ln,Gt,on,tn){var _i=s.util.cos(Wt),Xt=s.util.sin(Wt),Vt=s.util.cos($t),qt=s.util.sin($t),rn=Jt*Lt*Vt-Nt*Kt*qt+Pt,nn=Nt*Lt*Vt+Jt*Kt*qt+ln,cn=on+Gt*(-Jt*Lt*Xt-Nt*Kt*_i),un=tn+Gt*(-Nt*Lt*Xt+Jt*Kt*_i),gn=rn+Gt*(Jt*Lt*qt+Nt*Kt*Vt),mn=nn+Gt*(Nt*Lt*qt-Jt*Kt*Vt);return["C",cn,un,gn,mn,rn,nn]}function at(Wt,$t,Jt,Nt,Lt,Kt,Pt){var ln=Math.PI,Gt=Pt*ln/180,on=s.util.sin(Gt),tn=s.util.cos(Gt),_i=0,Xt=0;Jt=Math.abs(Jt),Nt=Math.abs(Nt);var Vt=-tn*Wt*.5-on*$t*.5,qt=-tn*$t*.5+on*Wt*.5,rn=Jt*Jt,nn=Nt*Nt,cn=qt*qt,un=Vt*Vt,gn=rn*nn-rn*cn-nn*un,mn=0;if(gn<0){var dn=Math.sqrt(1-gn/(rn*nn));Jt*=dn,Nt*=dn}else mn=(Lt===Kt?-1:1)*Math.sqrt(gn/(rn*cn+nn*un));var fn=mn*Jt*qt/Nt,sn=-mn*Nt*Vt/Jt,pn=tn*fn-on*sn+Wt*.5,bn=on*fn+tn*sn+$t*.5,An=lt(1,0,(Vt-fn)/Jt,(qt-sn)/Nt),Sn=lt((Vt-fn)/Jt,(qt-sn)/Nt,(-Vt-fn)/Jt,(-qt-sn)/Nt);Kt===0&&Sn>0?Sn-=2*ln:Kt===1&&Sn<0&&(Sn+=2*ln);for(var En=Math.ceil(Math.abs(Sn/ln*2)),Vn=[],Rn=Sn/En,In=8/3*Math.sin(Rn/4)*Math.sin(Rn/4)/Math.sin(Rn/2),zn=An+Rn,Tn=0;Tn<En;Tn++)Vn[Tn]=st(An,zn,tn,on,Jt,Nt,pn,bn,In,_i,Xt),_i=Vn[Tn][5],Xt=Vn[Tn][6],An=zn,zn+=Rn;return Vn}function lt(Wt,$t,Jt,Nt){var Lt=Math.atan2($t,Wt),Kt=Math.atan2(Nt,Jt);return Kt>=Lt?Kt-Lt:2*Math.PI-(Lt-Kt)}function ct(Wt,$t,Jt,Nt,Lt,Kt,Pt,ln){var Gt;if(s.cachesBoundsOfCurve&&(Gt=rt.call(arguments),s.boundsOfCurveCache[Gt]))return s.boundsOfCurveCache[Gt];var on=Math.sqrt,tn=Math.min,_i=Math.max,Xt=Math.abs,Vt=[],qt=[[],[]],rn,nn,cn,un,gn,mn,dn,fn;nn=6*Wt-12*Jt+6*Lt,rn=-3*Wt+9*Jt-9*Lt+3*Pt,cn=3*Jt-3*Wt;for(var sn=0;sn<2;++sn){if(sn>0&&(nn=6*$t-12*Nt+6*Kt,rn=-3*$t+9*Nt-9*Kt+3*ln,cn=3*Nt-3*$t),Xt(rn)<1e-12){if(Xt(nn)<1e-12)continue;un=-cn/nn,0<un&&un<1&&Vt.push(un);continue}dn=nn*nn-4*cn*rn,!(dn<0)&&(fn=on(dn),gn=(-nn+fn)/(2*rn),0<gn&&gn<1&&Vt.push(gn),mn=(-nn-fn)/(2*rn),0<mn&&mn<1&&Vt.push(mn))}for(var pn,bn,An=Vt.length,Sn=An,En;An--;)un=Vt[An],En=1-un,pn=En*En*En*Wt+3*En*En*un*Jt+3*En*un*un*Lt+un*un*un*Pt,qt[0][An]=pn,bn=En*En*En*$t+3*En*En*un*Nt+3*En*un*un*Kt+un*un*un*ln,qt[1][An]=bn;qt[0][Sn]=Wt,qt[1][Sn]=$t,qt[0][Sn+1]=Pt,qt[1][Sn+1]=ln;var Vn=[{x:tn.apply(null,qt[0]),y:tn.apply(null,qt[1])},{x:_i.apply(null,qt[0]),y:_i.apply(null,qt[1])}];return s.cachesBoundsOfCurve&&(s.boundsOfCurveCache[Gt]=Vn),Vn}function ht(Wt,$t,Jt){for(var Nt=Jt[1],Lt=Jt[2],Kt=Jt[3],Pt=Jt[4],ln=Jt[5],Gt=Jt[6],on=Jt[7],tn=at(Gt-Wt,on-$t,Nt,Lt,Pt,ln,Kt),_i=0,Xt=tn.length;_i<Xt;_i++)tn[_i][1]+=Wt,tn[_i][2]+=$t,tn[_i][3]+=Wt,tn[_i][4]+=$t,tn[_i][5]+=Wt,tn[_i][6]+=$t;return tn}function mt(Wt){var $t=0,Jt=0,Nt=Wt.length,Lt=0,Kt=0,Pt,ln,Gt,on=[],tn,_i,Xt;for(ln=0;ln<Nt;++ln){switch(Gt=!1,Pt=Wt[ln].slice(0),Pt[0]){case"l":Pt[0]="L",Pt[1]+=$t,Pt[2]+=Jt;case"L":$t=Pt[1],Jt=Pt[2];break;case"h":Pt[1]+=$t;case"H":Pt[0]="L",Pt[2]=Jt,$t=Pt[1];break;case"v":Pt[1]+=Jt;case"V":Pt[0]="L",Jt=Pt[1],Pt[1]=$t,Pt[2]=Jt;break;case"m":Pt[0]="M",Pt[1]+=$t,Pt[2]+=Jt;case"M":$t=Pt[1],Jt=Pt[2],Lt=Pt[1],Kt=Pt[2];break;case"c":Pt[0]="C",Pt[1]+=$t,Pt[2]+=Jt,Pt[3]+=$t,Pt[4]+=Jt,Pt[5]+=$t,Pt[6]+=Jt;case"C":_i=Pt[3],Xt=Pt[4],$t=Pt[5],Jt=Pt[6];break;case"s":Pt[0]="S",Pt[1]+=$t,Pt[2]+=Jt,Pt[3]+=$t,Pt[4]+=Jt;case"S":tn==="C"?(_i=2*$t-_i,Xt=2*Jt-Xt):(_i=$t,Xt=Jt),$t=Pt[3],Jt=Pt[4],Pt[0]="C",Pt[5]=Pt[3],Pt[6]=Pt[4],Pt[3]=Pt[1],Pt[4]=Pt[2],Pt[1]=_i,Pt[2]=Xt,_i=Pt[3],Xt=Pt[4];break;case"q":Pt[0]="Q",Pt[1]+=$t,Pt[2]+=Jt,Pt[3]+=$t,Pt[4]+=Jt;case"Q":_i=Pt[1],Xt=Pt[2],$t=Pt[3],Jt=Pt[4];break;case"t":Pt[0]="T",Pt[1]+=$t,Pt[2]+=Jt;case"T":tn==="Q"?(_i=2*$t-_i,Xt=2*Jt-Xt):(_i=$t,Xt=Jt),Pt[0]="Q",$t=Pt[1],Jt=Pt[2],Pt[1]=_i,Pt[2]=Xt,Pt[3]=$t,Pt[4]=Jt;break;case"a":Pt[0]="A",Pt[6]+=$t,Pt[7]+=Jt;case"A":Gt=!0,on=on.concat(ht($t,Jt,Pt)),$t=Pt[6],Jt=Pt[7];break;case"z":case"Z":$t=Lt,Jt=Kt;break}Gt||on.push(Pt),tn=Pt[0]}return on}function dt(Wt,$t,Jt,Nt){return Math.sqrt((Jt-Wt)*(Jt-Wt)+(Nt-$t)*(Nt-$t))}function ft(Wt){return Wt*Wt*Wt}function ut(Wt){return 3*Wt*Wt*(1-Wt)}function pt(Wt){return 3*Wt*(1-Wt)*(1-Wt)}function At(Wt){return(1-Wt)*(1-Wt)*(1-Wt)}function gt(Wt,$t,Jt,Nt,Lt,Kt,Pt,ln){return function(Gt){var on=ft(Gt),tn=ut(Gt),_i=pt(Gt),Xt=At(Gt);return{x:Pt*on+Lt*tn+Jt*_i+Wt*Xt,y:ln*on+Kt*tn+Nt*_i+$t*Xt}}}function vt(Wt,$t,Jt,Nt,Lt,Kt,Pt,ln){return function(Gt){var on=1-Gt,tn=3*on*on*(Jt-Wt)+6*on*Gt*(Lt-Jt)+3*Gt*Gt*(Pt-Lt),_i=3*on*on*(Nt-$t)+6*on*Gt*(Kt-Nt)+3*Gt*Gt*(ln-Kt);return Math.atan2(_i,tn)}}function yt(Wt){return Wt*Wt}function bt(Wt){return 2*Wt*(1-Wt)}function Ct(Wt){return(1-Wt)*(1-Wt)}function xt(Wt,$t,Jt,Nt,Lt,Kt){return function(Pt){var ln=yt(Pt),Gt=bt(Pt),on=Ct(Pt);return{x:Lt*ln+Jt*Gt+Wt*on,y:Kt*ln+Nt*Gt+$t*on}}}function It(Wt,$t,Jt,Nt,Lt,Kt){return function(Pt){var ln=1-Pt,Gt=2*ln*(Jt-Wt)+2*Pt*(Lt-Jt),on=2*ln*(Nt-$t)+2*Pt*(Kt-Nt);return Math.atan2(on,Gt)}}function St(Wt,$t,Jt){var Nt={x:$t,y:Jt},Lt,Kt=0,Pt;for(Pt=1;Pt<=100;Pt+=1)Lt=Wt(Pt/100),Kt+=dt(Nt.x,Nt.y,Lt.x,Lt.y),Nt=Lt;return Kt}function Ot(Wt,$t){for(var Jt=0,Nt=0,Lt=Wt.iterator,Kt={x:Wt.x,y:Wt.y},Pt,ln,Gt=.01,on=Wt.angleFinder,tn;Nt<$t&&Jt<=1&&Gt>1e-4;)Pt=Lt(Jt),tn=Jt,ln=dt(Kt.x,Kt.y,Pt.x,Pt.y),ln+Nt>$t?(Gt/=2,Jt-=Gt):(Kt=Pt,Jt+=Gt,Nt+=ln);return Pt.angle=on(tn),Pt}function Mt(Wt){for(var $t=0,Jt=Wt.length,Nt,Lt=0,Kt=0,Pt=0,ln=0,Gt=[],on,tn,_i,Xt=0;Xt<Jt;Xt++){switch(Nt=Wt[Xt],tn={x:Lt,y:Kt,command:Nt[0]},Nt[0]){case"M":tn.length=0,Pt=Lt=Nt[1],ln=Kt=Nt[2];break;case"L":tn.length=dt(Lt,Kt,Nt[1],Nt[2]),Lt=Nt[1],Kt=Nt[2];break;case"C":on=gt(Lt,Kt,Nt[1],Nt[2],Nt[3],Nt[4],Nt[5],Nt[6]),_i=vt(Lt,Kt,Nt[1],Nt[2],Nt[3],Nt[4],Nt[5],Nt[6]),tn.iterator=on,tn.angleFinder=_i,tn.length=St(on,Lt,Kt),Lt=Nt[5],Kt=Nt[6];break;case"Q":on=xt(Lt,Kt,Nt[1],Nt[2],Nt[3],Nt[4]),_i=It(Lt,Kt,Nt[1],Nt[2],Nt[3],Nt[4]),tn.iterator=on,tn.angleFinder=_i,tn.length=St(on,Lt,Kt),Lt=Nt[3],Kt=Nt[4];break;case"Z":case"z":tn.destX=Pt,tn.destY=ln,tn.length=dt(Lt,Kt,Pt,ln),Lt=Pt,Kt=ln;break}$t+=tn.length,Gt.push(tn)}return Gt.push({length:$t,x:Lt,y:Kt}),Gt}function jt(Wt,$t,Jt){Jt||(Jt=Mt(Wt));for(var Nt=0;$t-Jt[Nt].length>0&&Nt<Jt.length-2;)$t-=Jt[Nt].length,Nt++;var Lt=Jt[Nt],Kt=$t/Lt.length,Pt=Lt.command,ln=Wt[Nt],Gt;switch(Pt){case"M":return{x:Lt.x,y:Lt.y,angle:0};case"Z":case"z":return Gt=new s.Point(Lt.x,Lt.y).lerp(new s.Point(Lt.destX,Lt.destY),Kt),Gt.angle=Math.atan2(Lt.destY-Lt.y,Lt.destX-Lt.x),Gt;case"L":return Gt=new s.Point(Lt.x,Lt.y).lerp(new s.Point(ln[1],ln[2]),Kt),Gt.angle=Math.atan2(ln[2]-Lt.y,ln[1]-Lt.x),Gt;case"C":return Ot(Lt,$t);case"Q":return Ot(Lt,$t)}}function Ft(Wt){var $t=[],Jt=[],Nt,Lt,Kt=s.rePathCommand,Pt="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",ln="("+Pt+")"+s.commaWsp,Gt="([01])"+s.commaWsp+"?",on=ln+"?"+ln+"?"+ln+Gt+Gt+ln+"?("+Pt+")",tn=new RegExp(on,"g"),_i,Xt,Vt;if(!Wt||!Wt.match)return $t;Vt=Wt.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);for(var qt=0,rn,nn=Vt.length;qt<nn;qt++){Nt=Vt[qt],Xt=Nt.slice(1).trim(),Jt.length=0;var cn=Nt.charAt(0);if(rn=[cn],cn.toLowerCase()==="a")for(var un;un=tn.exec(Xt);)for(var gn=1;gn<un.length;gn++)Jt.push(un[gn]);else for(;_i=Kt.exec(Xt);)Jt.push(_i[0]);for(var gn=0,mn=Jt.length;gn<mn;gn++)Lt=parseFloat(Jt[gn]),isNaN(Lt)||rn.push(Lt);var dn=nt[cn.toLowerCase()],fn=ot[cn]||cn;if(rn.length-1>dn)for(var sn=1,pn=rn.length;sn<pn;sn+=dn)$t.push([cn].concat(rn.slice(sn,sn+dn))),cn=fn;else $t.push(rn)}return $t}function Ut(Wt,$t){var Jt=[],Nt,Lt=new s.Point(Wt[0].x,Wt[0].y),Kt=new s.Point(Wt[1].x,Wt[1].y),Pt=Wt.length,ln=1,Gt=0,on=Pt>2;for($t=$t||0,on&&(ln=Wt[2].x<Kt.x?-1:Wt[2].x===Kt.x?0:1,Gt=Wt[2].y<Kt.y?-1:Wt[2].y===Kt.y?0:1),Jt.push(["M",Lt.x-ln*$t,Lt.y-Gt*$t]),Nt=1;Nt<Pt;Nt++){if(!Lt.eq(Kt)){var tn=Lt.midPointFrom(Kt);Jt.push(["Q",Lt.x,Lt.y,tn.x,tn.y])}Lt=Wt[Nt],Nt+1<Wt.length&&(Kt=Wt[Nt+1])}return on&&(ln=Lt.x>Wt[Nt-2].x?1:Lt.x===Wt[Nt-2].x?0:-1,Gt=Lt.y>Wt[Nt-2].y?1:Lt.y===Wt[Nt-2].y?0:-1),Jt.push(["L",Lt.x+ln*$t,Lt.y+Gt*$t]),Jt}function Qt(Wt,$t,Jt){return Jt&&($t=s.util.multiplyTransformMatrices($t,[1,0,0,1,-Jt.x,-Jt.y])),Wt.map(function(Nt){for(var Lt=Nt.slice(0),Kt={},Pt=1;Pt<Nt.length-1;Pt+=2)Kt.x=Nt[Pt],Kt.y=Nt[Pt+1],Kt=s.util.transformPoint(Kt,$t),Lt[Pt]=Kt.x,Lt[Pt+1]=Kt.y;return Lt})}function Ht(Wt,$t,Jt,Nt,Lt,Kt,Pt,ln,Gt){for(var on=0,tn=0,_i,Xt=[],Vt=at(ln-Wt,Gt-$t,Jt,Nt,Kt,Pt,Lt),qt=0,rn=Vt.length;qt<rn;qt++)_i=ct(on,tn,Vt[qt][1],Vt[qt][2],Vt[qt][3],Vt[qt][4],Vt[qt][5],Vt[qt][6]),Xt.push({x:_i[0].x+Wt,y:_i[0].y+$t}),Xt.push({x:_i[1].x+Wt,y:_i[1].y+$t}),on=Vt[qt][5],tn=Vt[qt][6];return Xt}function Zt(Wt,$t,Jt,Nt){Nt=Nt.slice(0).unshift("X");var Lt=ht($t,Jt,Nt);Lt.forEach(function(Kt){Wt.bezierCurveTo.apply(Wt,Kt.slice(1))})}s.util.joinPath=function(Wt){return Wt.map(function($t){return $t.join(" ")}).join(" ")},s.util.parsePath=Ft,s.util.makePathSimpler=mt,s.util.getSmoothPathFromPoints=Ut,s.util.getPathSegmentsInfo=Mt,s.util.getBoundsOfCurve=ct,s.util.getPointOnPath=jt,s.util.transformPath=Qt,s.util.fromArcToBeizers=ht,s.util.getBoundsOfArc=Ht,s.util.drawArc=Zt}(),function(){var rt=Array.prototype.slice;function nt(ct,ht){for(var mt=rt.call(arguments,2),dt=[],ft=0,ut=ct.length;ft<ut;ft++)dt[ft]=mt.length?ct[ft][ht].apply(ct[ft],mt):ct[ft][ht].call(ct[ft]);return dt}function ot(ct,ht){return lt(ct,ht,function(mt,dt){return mt>=dt})}function st(ct,ht){return lt(ct,ht,function(mt,dt){return mt<dt})}function at(ct,ht){for(var mt=ct.length;mt--;)ct[mt]=ht;return ct}function lt(ct,ht,mt){if(!(!ct||ct.length===0)){var dt=ct.length-1,ft=ht?ct[dt][ht]:ct[dt];if(ht)for(;dt--;)mt(ct[dt][ht],ft)&&(ft=ct[dt][ht]);else for(;dt--;)mt(ct[dt],ft)&&(ft=ct[dt]);return ft}}s.util.array={fill:at,invoke:nt,min:st,max:ot}}(),function(){function rt(ot,st,at){if(at)if(!s.isLikelyNode&&st instanceof Element)ot=st;else if(st instanceof Array){ot=[];for(var lt=0,ct=st.length;lt<ct;lt++)ot[lt]=rt({},st[lt],at)}else if(st&&typeof st=="object")for(var ht in st)ht==="canvas"||ht==="group"?ot[ht]=null:st.hasOwnProperty(ht)&&(ot[ht]=rt({},st[ht],at));else ot=st;else for(var ht in st)ot[ht]=st[ht];return ot}function nt(ot,st){return rt({},ot,st)}s.util.object={extend:rt,clone:nt},s.util.object.extend(s.util,s.Observable)}(),function(){function rt(lt){return lt.replace(/-+(.)?/g,function(ct,ht){return ht?ht.toUpperCase():""})}function nt(lt,ct){return lt.charAt(0).toUpperCase()+(ct?lt.slice(1):lt.slice(1).toLowerCase())}function ot(lt){return lt.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function st(lt){var ct=0,ht,mt=[];for(ct=0,ht;ct<lt.length;ct++)(ht=at(lt,ct))!==!1&&mt.push(ht);return mt}function at(lt,ct){var ht=lt.charCodeAt(ct);if(isNaN(ht))return"";if(ht<55296||ht>57343)return lt.charAt(ct);if(55296<=ht&&ht<=56319){if(lt.length<=ct+1)throw"High surrogate without following low surrogate";var mt=lt.charCodeAt(ct+1);if(56320>mt||mt>57343)throw"High surrogate without following low surrogate";return lt.charAt(ct)+lt.charAt(ct+1)}if(ct===0)throw"Low surrogate without preceding high surrogate";var dt=lt.charCodeAt(ct-1);if(55296>dt||dt>56319)throw"Low surrogate without preceding high surrogate";return!1}s.util.string={camelize:rt,capitalize:nt,escapeXml:ot,graphemeSplit:st}}(),function(){var rt=Array.prototype.slice,nt=function(){},ot=function(){for(var ht in{toString:1})if(ht==="toString")return!1;return!0}(),st=function(ht,mt,dt){for(var ft in mt)ft in ht.prototype&&typeof ht.prototype[ft]=="function"&&(mt[ft]+"").indexOf("callSuper")>-1?ht.prototype[ft]=function(ut){return function(){var pt=this.constructor.superclass;this.constructor.superclass=dt;var At=mt[ut].apply(this,arguments);if(this.constructor.superclass=pt,ut!=="initialize")return At}}(ft):ht.prototype[ft]=mt[ft],ot&&(mt.toString!==Object.prototype.toString&&(ht.prototype.toString=mt.toString),mt.valueOf!==Object.prototype.valueOf&&(ht.prototype.valueOf=mt.valueOf))};function at(){}function lt(ht){for(var mt=null,dt=this;dt.constructor.superclass;){var ft=dt.constructor.superclass.prototype[ht];if(dt[ht]!==ft){mt=ft;break}dt=dt.constructor.superclass.prototype}return mt?arguments.length>1?mt.apply(this,rt.call(arguments,1)):mt.call(this):console.log("tried to callSuper "+ht+", method not found in prototype chain",this)}function ct(){var ht=null,mt=rt.call(arguments,0);typeof mt[0]=="function"&&(ht=mt.shift());function dt(){this.initialize.apply(this,arguments)}dt.superclass=ht,dt.subclasses=[],ht&&(at.prototype=ht.prototype,dt.prototype=new at,ht.subclasses.push(dt));for(var ft=0,ut=mt.length;ft<ut;ft++)st(dt,mt[ft],ht);return dt.prototype.initialize||(dt.prototype.initialize=nt),dt.prototype.constructor=dt,dt.prototype.callSuper=lt,dt}s.util.createClass=ct}(),function(){var rt=!!s.document.createElement("div").attachEvent,nt=["touchstart","touchmove","touchend"];s.util.addListener=function(st,at,lt,ct){st&&st.addEventListener(at,lt,rt?!1:ct)},s.util.removeListener=function(st,at,lt,ct){st&&st.removeEventListener(at,lt,rt?!1:ct)};function ot(st){var at=st.changedTouches;return at&&at[0]?at[0]:st}s.util.getPointer=function(st){var at=st.target,lt=s.util.getScrollLeftTop(at),ct=ot(st);return{x:ct.clientX+lt.left,y:ct.clientY+lt.top}},s.util.isTouchEvent=function(st){return nt.indexOf(st.type)>-1||st.pointerType==="touch"}}(),function(){function rt(ct,ht){var mt=ct.style;if(!mt)return ct;if(typeof ht=="string")return ct.style.cssText+=";"+ht,ht.indexOf("opacity")>-1?lt(ct,ht.match(/opacity:\s*(\d?\.?\d*)/)[1]):ct;for(var dt in ht)if(dt==="opacity")lt(ct,ht[dt]);else{var ft=dt==="float"||dt==="cssFloat"?typeof mt.styleFloat=="undefined"?"cssFloat":"styleFloat":dt;mt[ft]=ht[dt]}return ct}var nt=s.document.createElement("div"),ot=typeof nt.style.opacity=="string",st=typeof nt.style.filter=="string",at=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,lt=function(ct){return ct};ot?lt=function(ct,ht){return ct.style.opacity=ht,ct}:st&&(lt=function(ct,ht){var mt=ct.style;return ct.currentStyle&&!ct.currentStyle.hasLayout&&(mt.zoom=1),at.test(mt.filter)?(ht=ht>=.9999?"":"alpha(opacity="+ht*100+")",mt.filter=mt.filter.replace(at,ht)):mt.filter+=" alpha(opacity="+ht*100+")",ct}),s.util.setStyle=rt}(),function(){var rt=Array.prototype.slice;function nt(At){return typeof At=="string"?s.document.getElementById(At):At}var ot,st=function(At){return rt.call(At,0)};try{ot=st(s.document.childNodes)instanceof Array}catch{}ot||(st=function(At){for(var gt=new Array(At.length),vt=At.length;vt--;)gt[vt]=At[vt];return gt});function at(At,gt){var vt=s.document.createElement(At);for(var yt in gt)yt==="class"?vt.className=gt[yt]:yt==="for"?vt.htmlFor=gt[yt]:vt.setAttribute(yt,gt[yt]);return vt}function lt(At,gt){At&&(" "+At.className+" ").indexOf(" "+gt+" ")===-1&&(At.className+=(At.className?" ":"")+gt)}function ct(At,gt,vt){return typeof gt=="string"&&(gt=at(gt,vt)),At.parentNode&&At.parentNode.replaceChild(gt,At),gt.appendChild(At),gt}function ht(At){for(var gt=0,vt=0,yt=s.document.documentElement,bt=s.document.body||{scrollLeft:0,scrollTop:0};At&&(At.parentNode||At.host)&&(At=At.parentNode||At.host,At===s.document?(gt=bt.scrollLeft||yt.scrollLeft||0,vt=bt.scrollTop||yt.scrollTop||0):(gt+=At.scrollLeft||0,vt+=At.scrollTop||0),!(At.nodeType===1&&At.style.position==="fixed")););return{left:gt,top:vt}}function mt(At){var gt,vt=At&&At.ownerDocument,yt={left:0,top:0},bt={left:0,top:0},Ct,xt={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!vt)return bt;for(var It in xt)bt[xt[It]]+=parseInt(dt(At,It),10)||0;return gt=vt.documentElement,typeof At.getBoundingClientRect!="undefined"&&(yt=At.getBoundingClientRect()),Ct=ht(At),{left:yt.left+Ct.left-(gt.clientLeft||0)+bt.left,top:yt.top+Ct.top-(gt.clientTop||0)+bt.top}}var dt;s.document.defaultView&&s.document.defaultView.getComputedStyle?dt=function(At,gt){var vt=s.document.defaultView.getComputedStyle(At,null);return vt?vt[gt]:void 0}:dt=function(At,gt){var vt=At.style[gt];return!vt&&At.currentStyle&&(vt=At.currentStyle[gt]),vt},function(){var At=s.document.documentElement.style,gt="userSelect"in At?"userSelect":"MozUserSelect"in At?"MozUserSelect":"WebkitUserSelect"in At?"WebkitUserSelect":"KhtmlUserSelect"in At?"KhtmlUserSelect":"";function vt(bt){return typeof bt.onselectstart!="undefined"&&(bt.onselectstart=s.util.falseFunction),gt?bt.style[gt]="none":typeof bt.unselectable=="string"&&(bt.unselectable="on"),bt}function yt(bt){return typeof bt.onselectstart!="undefined"&&(bt.onselectstart=null),gt?bt.style[gt]="":typeof bt.unselectable=="string"&&(bt.unselectable=""),bt}s.util.makeElementUnselectable=vt,s.util.makeElementSelectable=yt}();function ft(At){var gt=s.jsdomImplForWrapper(At);return gt._canvas||gt._image}function ut(At){if(!!s.isLikelyNode){var gt=s.jsdomImplForWrapper(At);gt&&(gt._image=null,gt._canvas=null,gt._currentSrc=null,gt._attributes=null,gt._classList=null)}}function pt(At,gt){At.imageSmoothingEnabled=At.imageSmoothingEnabled||At.webkitImageSmoothingEnabled||At.mozImageSmoothingEnabled||At.msImageSmoothingEnabled||At.oImageSmoothingEnabled,At.imageSmoothingEnabled=gt}s.util.setImageSmoothing=pt,s.util.getById=nt,s.util.toArray=st,s.util.addClass=lt,s.util.makeElement=at,s.util.wrapElement=ct,s.util.getScrollLeftTop=ht,s.util.getElementOffset=mt,s.util.getNodeCanvas=ft,s.util.cleanUpJsdomNode=ut}(),function(){function rt(st,at){return st+(/\?/.test(st)?"&":"?")+at}function nt(){}function ot(st,at){at||(at={});var lt=at.method?at.method.toUpperCase():"GET",ct=at.onComplete||function(){},ht=new s.window.XMLHttpRequest,mt=at.body||at.parameters;return ht.onreadystatechange=function(){ht.readyState===4&&(ct(ht),ht.onreadystatechange=nt)},lt==="GET"&&(mt=null,typeof at.parameters=="string"&&(st=rt(st,at.parameters))),ht.open(lt,st,!0),(lt==="POST"||lt==="PUT")&&ht.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),ht.send(mt),ht}s.util.request=ot}(),s.log=console.log,s.warn=console.warn,function(){function rt(){return!1}function nt(ht,mt,dt,ft){return-dt*Math.cos(ht/ft*(Math.PI/2))+dt+mt}function ot(ht){var mt=!1;return lt(function(dt){ht||(ht={});var ft=dt||+new Date,ut=ht.duration||500,pt=ft+ut,At,gt=ht.onChange||rt,vt=ht.abort||rt,yt=ht.onComplete||rt,bt=ht.easing||nt,Ct="startValue"in ht?ht.startValue:0,xt="endValue"in ht?ht.endValue:100,It=ht.byValue||xt-Ct;ht.onStart&&ht.onStart(),function St(Ot){At=Ot||+new Date;var Mt=At>pt?ut:At-ft,jt=Mt/ut,Ft=bt(Mt,Ct,It,ut),Ut=Math.abs((Ft-Ct)/It);if(!mt){if(vt(Ft,Ut,jt)){yt(xt,1,1);return}if(At>pt){gt(xt,1,1),yt(xt,1,1);return}else gt(Ft,Ut,jt),lt(St)}}(ft)}),function(){mt=!0}}var st=s.window.requestAnimationFrame||s.window.webkitRequestAnimationFrame||s.window.mozRequestAnimationFrame||s.window.oRequestAnimationFrame||s.window.msRequestAnimationFrame||function(ht){return s.window.setTimeout(ht,1e3/60)},at=s.window.cancelAnimationFrame||s.window.clearTimeout;function lt(){return st.apply(s.window,arguments)}function ct(){return at.apply(s.window,arguments)}s.util.animate=ot,s.util.requestAnimFrame=lt,s.util.cancelAnimFrame=ct}(),function(){function rt(ot,st,at){var lt="rgba("+parseInt(ot[0]+at*(st[0]-ot[0]),10)+","+parseInt(ot[1]+at*(st[1]-ot[1]),10)+","+parseInt(ot[2]+at*(st[2]-ot[2]),10);return lt+=","+(ot&&st?parseFloat(ot[3]+at*(st[3]-ot[3])):1),lt+=")",lt}function nt(ot,st,at,lt){var ct=new s.Color(ot).getSource(),ht=new s.Color(st).getSource(),mt=lt.onComplete,dt=lt.onChange;return lt=lt||{},s.util.animate(s.util.object.extend(lt,{duration:at||500,startValue:ct,endValue:ht,byValue:ht,easing:function(ft,ut,pt,At){var gt=lt.colorEasing?lt.colorEasing(ft,At):1-Math.cos(ft/At*(Math.PI/2));return rt(ut,pt,gt)},onComplete:function(ft,ut,pt){if(mt)return mt(rt(ht,ht,0),ut,pt)},onChange:function(ft,ut,pt){if(dt){if(Array.isArray(ft))return dt(rt(ft,ft,0),ut,pt);dt(ft,ut,pt)}}}))}s.util.animateColor=nt}(),function(){function rt(Ht,Zt,Wt,$t){return Ht<Math.abs(Zt)?(Ht=Zt,$t=Wt/4):Zt===0&&Ht===0?$t=Wt/(2*Math.PI)*Math.asin(1):$t=Wt/(2*Math.PI)*Math.asin(Zt/Ht),{a:Ht,c:Zt,p:Wt,s:$t}}function nt(Ht,Zt,Wt){return Ht.a*Math.pow(2,10*(Zt-=1))*Math.sin((Zt*Wt-Ht.s)*(2*Math.PI)/Ht.p)}function ot(Ht,Zt,Wt,$t){return Wt*((Ht=Ht/$t-1)*Ht*Ht+1)+Zt}function st(Ht,Zt,Wt,$t){return Ht/=$t/2,Ht<1?Wt/2*Ht*Ht*Ht+Zt:Wt/2*((Ht-=2)*Ht*Ht+2)+Zt}function at(Ht,Zt,Wt,$t){return Wt*(Ht/=$t)*Ht*Ht*Ht+Zt}function lt(Ht,Zt,Wt,$t){return-Wt*((Ht=Ht/$t-1)*Ht*Ht*Ht-1)+Zt}function ct(Ht,Zt,Wt,$t){return Ht/=$t/2,Ht<1?Wt/2*Ht*Ht*Ht*Ht+Zt:-Wt/2*((Ht-=2)*Ht*Ht*Ht-2)+Zt}function ht(Ht,Zt,Wt,$t){return Wt*(Ht/=$t)*Ht*Ht*Ht*Ht+Zt}function mt(Ht,Zt,Wt,$t){return Wt*((Ht=Ht/$t-1)*Ht*Ht*Ht*Ht+1)+Zt}function dt(Ht,Zt,Wt,$t){return Ht/=$t/2,Ht<1?Wt/2*Ht*Ht*Ht*Ht*Ht+Zt:Wt/2*((Ht-=2)*Ht*Ht*Ht*Ht+2)+Zt}function ft(Ht,Zt,Wt,$t){return-Wt*Math.cos(Ht/$t*(Math.PI/2))+Wt+Zt}function ut(Ht,Zt,Wt,$t){return Wt*Math.sin(Ht/$t*(Math.PI/2))+Zt}function pt(Ht,Zt,Wt,$t){return-Wt/2*(Math.cos(Math.PI*Ht/$t)-1)+Zt}function At(Ht,Zt,Wt,$t){return Ht===0?Zt:Wt*Math.pow(2,10*(Ht/$t-1))+Zt}function gt(Ht,Zt,Wt,$t){return Ht===$t?Zt+Wt:Wt*(-Math.pow(2,-10*Ht/$t)+1)+Zt}function vt(Ht,Zt,Wt,$t){return Ht===0?Zt:Ht===$t?Zt+Wt:(Ht/=$t/2,Ht<1?Wt/2*Math.pow(2,10*(Ht-1))+Zt:Wt/2*(-Math.pow(2,-10*--Ht)+2)+Zt)}function yt(Ht,Zt,Wt,$t){return-Wt*(Math.sqrt(1-(Ht/=$t)*Ht)-1)+Zt}function bt(Ht,Zt,Wt,$t){return Wt*Math.sqrt(1-(Ht=Ht/$t-1)*Ht)+Zt}function Ct(Ht,Zt,Wt,$t){return Ht/=$t/2,Ht<1?-Wt/2*(Math.sqrt(1-Ht*Ht)-1)+Zt:Wt/2*(Math.sqrt(1-(Ht-=2)*Ht)+1)+Zt}function xt(Ht,Zt,Wt,$t){var Jt=1.70158,Nt=0,Lt=Wt;if(Ht===0)return Zt;if(Ht/=$t,Ht===1)return Zt+Wt;Nt||(Nt=$t*.3);var Kt=rt(Lt,Wt,Nt,Jt);return-nt(Kt,Ht,$t)+Zt}function It(Ht,Zt,Wt,$t){var Jt=1.70158,Nt=0,Lt=Wt;if(Ht===0)return Zt;if(Ht/=$t,Ht===1)return Zt+Wt;Nt||(Nt=$t*.3);var Kt=rt(Lt,Wt,Nt,Jt);return Kt.a*Math.pow(2,-10*Ht)*Math.sin((Ht*$t-Kt.s)*(2*Math.PI)/Kt.p)+Kt.c+Zt}function St(Ht,Zt,Wt,$t){var Jt=1.70158,Nt=0,Lt=Wt;if(Ht===0)return Zt;if(Ht/=$t/2,Ht===2)return Zt+Wt;Nt||(Nt=$t*(.3*1.5));var Kt=rt(Lt,Wt,Nt,Jt);return Ht<1?-.5*nt(Kt,Ht,$t)+Zt:Kt.a*Math.pow(2,-10*(Ht-=1))*Math.sin((Ht*$t-Kt.s)*(2*Math.PI)/Kt.p)*.5+Kt.c+Zt}function Ot(Ht,Zt,Wt,$t,Jt){return Jt===void 0&&(Jt=1.70158),Wt*(Ht/=$t)*Ht*((Jt+1)*Ht-Jt)+Zt}function Mt(Ht,Zt,Wt,$t,Jt){return Jt===void 0&&(Jt=1.70158),Wt*((Ht=Ht/$t-1)*Ht*((Jt+1)*Ht+Jt)+1)+Zt}function jt(Ht,Zt,Wt,$t,Jt){return Jt===void 0&&(Jt=1.70158),Ht/=$t/2,Ht<1?Wt/2*(Ht*Ht*(((Jt*=1.525)+1)*Ht-Jt))+Zt:Wt/2*((Ht-=2)*Ht*(((Jt*=1.525)+1)*Ht+Jt)+2)+Zt}function Ft(Ht,Zt,Wt,$t){return Wt-Ut($t-Ht,0,Wt,$t)+Zt}function Ut(Ht,Zt,Wt,$t){return(Ht/=$t)<1/2.75?Wt*(7.5625*Ht*Ht)+Zt:Ht<2/2.75?Wt*(7.5625*(Ht-=1.5/2.75)*Ht+.75)+Zt:Ht<2.5/2.75?Wt*(7.5625*(Ht-=2.25/2.75)*Ht+.9375)+Zt:Wt*(7.5625*(Ht-=2.625/2.75)*Ht+.984375)+Zt}function Qt(Ht,Zt,Wt,$t){return Ht<$t/2?Ft(Ht*2,0,Wt,$t)*.5+Zt:Ut(Ht*2-$t,0,Wt,$t)*.5+Wt*.5+Zt}s.util.ease={easeInQuad:function(Ht,Zt,Wt,$t){return Wt*(Ht/=$t)*Ht+Zt},easeOutQuad:function(Ht,Zt,Wt,$t){return-Wt*(Ht/=$t)*(Ht-2)+Zt},easeInOutQuad:function(Ht,Zt,Wt,$t){return Ht/=$t/2,Ht<1?Wt/2*Ht*Ht+Zt:-Wt/2*(--Ht*(Ht-2)-1)+Zt},easeInCubic:function(Ht,Zt,Wt,$t){return Wt*(Ht/=$t)*Ht*Ht+Zt},easeOutCubic:ot,easeInOutCubic:st,easeInQuart:at,easeOutQuart:lt,easeInOutQuart:ct,easeInQuint:ht,easeOutQuint:mt,easeInOutQuint:dt,easeInSine:ft,easeOutSine:ut,easeInOutSine:pt,easeInExpo:At,easeOutExpo:gt,easeInOutExpo:vt,easeInCirc:yt,easeOutCirc:bt,easeInOutCirc:Ct,easeInElastic:xt,easeOutElastic:It,easeInOutElastic:St,easeInBack:Ot,easeOutBack:Mt,easeInOutBack:jt,easeInBounce:Ft,easeOutBounce:Ut,easeInOutBounce:Qt}}(),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.extend,st=nt.util.object.clone,at=nt.util.toFixed,lt=nt.util.parseUnit,ct=nt.util.multiplyTransformMatrices,ht=["path","circle","polygon","polyline","ellipse","rect","line","image","text"],mt=["symbol","image","marker","pattern","view","svg"],dt=["pattern","defs","symbol","metadata","clipPath","mask","desc"],ft=["symbol","g","a","svg","clipPath","defs"],ut={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing"},pt={stroke:"strokeOpacity",fill:"fillOpacity"},At="font-size",gt="clip-path";nt.svgValidTagNamesRegEx=bt(ht),nt.svgViewBoxElementsRegEx=bt(mt),nt.svgInvalidAncestorsRegEx=bt(dt),nt.svgValidParentsRegEx=bt(ft),nt.cssRules={},nt.gradientDefs={},nt.clipPaths={};function vt(Nt){return Nt in ut?ut[Nt]:Nt}function yt(Nt,Lt,Kt,Pt){var ln=Object.prototype.toString.call(Lt)==="[object Array]",Gt;if((Nt==="fill"||Nt==="stroke")&&Lt==="none")Lt="";else{if(Nt==="strokeUniform")return Lt==="non-scaling-stroke";if(Nt==="strokeDashArray")Lt==="none"?Lt=null:Lt=Lt.replace(/,/g," ").split(/\s+/).map(parseFloat);else if(Nt==="transformMatrix")Kt&&Kt.transformMatrix?Lt=ct(Kt.transformMatrix,nt.parseTransformAttribute(Lt)):Lt=nt.parseTransformAttribute(Lt);else if(Nt==="visible")Lt=Lt!=="none"&&Lt!=="hidden",Kt&&Kt.visible===!1&&(Lt=!1);else if(Nt==="opacity")Lt=parseFloat(Lt),Kt&&typeof Kt.opacity!="undefined"&&(Lt*=Kt.opacity);else if(Nt==="textAnchor")Lt=Lt==="start"?"left":Lt==="end"?"right":"center";else if(Nt==="charSpacing")Gt=lt(Lt,Pt)/Pt*1e3;else if(Nt==="paintFirst"){var on=Lt.indexOf("fill"),tn=Lt.indexOf("stroke"),Lt="fill";(on>-1&&tn>-1&&tn<on||on===-1&&tn>-1)&&(Lt="stroke")}else{if(Nt==="href"||Nt==="xlink:href"||Nt==="font")return Lt;if(Nt==="imageSmoothing")return Lt==="optimizeQuality";Gt=ln?Lt.map(lt):lt(Lt,Pt)}}return!ln&&isNaN(Gt)?Lt:Gt}function bt(Nt){return new RegExp("^("+Nt.join("|")+")\\b","i")}function Ct(Nt){for(var Lt in pt)if(!(typeof Nt[pt[Lt]]=="undefined"||Nt[Lt]==="")){if(typeof Nt[Lt]=="undefined"){if(!nt.Object.prototype[Lt])continue;Nt[Lt]=nt.Object.prototype[Lt]}if(Nt[Lt].indexOf("url(")!==0){var Kt=new nt.Color(Nt[Lt]);Nt[Lt]=Kt.setAlpha(at(Kt.getAlpha()*Nt[pt[Lt]],2)).toRgba()}}return Nt}function xt(Nt,Lt){var Kt,Pt=[],ln,Gt,on;for(Gt=0,on=Lt.length;Gt<on;Gt++)Kt=Lt[Gt],ln=Nt.getElementsByTagName(Kt),Pt=Pt.concat(Array.prototype.slice.call(ln));return Pt}nt.parseTransformAttribute=function(){function Nt(dn,fn){var sn=nt.util.cos(fn[0]),pn=nt.util.sin(fn[0]),bn=0,An=0;fn.length===3&&(bn=fn[1],An=fn[2]),dn[0]=sn,dn[1]=pn,dn[2]=-pn,dn[3]=sn,dn[4]=bn-(sn*bn-pn*An),dn[5]=An-(pn*bn+sn*An)}function Lt(dn,fn){var sn=fn[0],pn=fn.length===2?fn[1]:fn[0];dn[0]=sn,dn[3]=pn}function Kt(dn,fn,sn){dn[sn]=Math.tan(nt.util.degreesToRadians(fn[0]))}function Pt(dn,fn){dn[4]=fn[0],fn.length===2&&(dn[5]=fn[1])}var ln=nt.iMatrix,Gt=nt.reNum,on=nt.commaWsp,tn="(?:(skewX)\\s*\\(\\s*("+Gt+")\\s*\\))",_i="(?:(skewY)\\s*\\(\\s*("+Gt+")\\s*\\))",Xt="(?:(rotate)\\s*\\(\\s*("+Gt+")(?:"+on+"("+Gt+")"+on+"("+Gt+"))?\\s*\\))",Vt="(?:(scale)\\s*\\(\\s*("+Gt+")(?:"+on+"("+Gt+"))?\\s*\\))",qt="(?:(translate)\\s*\\(\\s*("+Gt+")(?:"+on+"("+Gt+"))?\\s*\\))",rn="(?:(matrix)\\s*\\(\\s*("+Gt+")"+on+"("+Gt+")"+on+"("+Gt+")"+on+"("+Gt+")"+on+"("+Gt+")"+on+"("+Gt+")\\s*\\))",nn="(?:"+rn+"|"+qt+"|"+Vt+"|"+Xt+"|"+tn+"|"+_i+")",cn="(?:"+nn+"(?:"+on+"*"+nn+")*)",un="^\\s*(?:"+cn+"?)\\s*$",gn=new RegExp(un),mn=new RegExp(nn,"g");return function(dn){var fn=ln.concat(),sn=[];if(!dn||dn&&!gn.test(dn))return fn;dn.replace(mn,function(bn){var An=new RegExp(nn).exec(bn).filter(function(Vn){return!!Vn}),Sn=An[1],En=An.slice(2).map(parseFloat);switch(Sn){case"translate":Pt(fn,En);break;case"rotate":En[0]=nt.util.degreesToRadians(En[0]),Nt(fn,En);break;case"scale":Lt(fn,En);break;case"skewX":Kt(fn,En,2);break;case"skewY":Kt(fn,En,1);break;case"matrix":fn=En;break}sn.push(fn.concat()),fn=ln.concat()});for(var pn=sn[0];sn.length>1;)sn.shift(),pn=nt.util.multiplyTransformMatrices(pn,sn[0]);return pn}}();function It(Nt,Lt){var Kt,Pt;Nt.replace(/;\s*$/,"").split(";").forEach(function(ln){var Gt=ln.split(":");Kt=Gt[0].trim().toLowerCase(),Pt=Gt[1].trim(),Lt[Kt]=Pt})}function St(Nt,Lt){var Kt,Pt;for(var ln in Nt)typeof Nt[ln]!="undefined"&&(Kt=ln.toLowerCase(),Pt=Nt[ln],Lt[Kt]=Pt)}function Ot(Nt,Lt){var Kt={};for(var Pt in nt.cssRules[Lt])if(Mt(Nt,Pt.split(" ")))for(var ln in nt.cssRules[Lt][Pt])Kt[ln]=nt.cssRules[Lt][Pt][ln];return Kt}function Mt(Nt,Lt){var Kt,Pt=!0;return Kt=Ft(Nt,Lt.pop()),Kt&&Lt.length&&(Pt=jt(Nt,Lt)),Kt&&Pt&&Lt.length===0}function jt(Nt,Lt){for(var Kt,Pt=!0;Nt.parentNode&&Nt.parentNode.nodeType===1&&Lt.length;)Pt&&(Kt=Lt.pop()),Nt=Nt.parentNode,Pt=Ft(Nt,Kt);return Lt.length===0}function Ft(Nt,Lt){var Kt=Nt.nodeName,Pt=Nt.getAttribute("class"),ln=Nt.getAttribute("id"),Gt,on;if(Gt=new RegExp("^"+Kt,"i"),Lt=Lt.replace(Gt,""),ln&&Lt.length&&(Gt=new RegExp("#"+ln+"(?![a-zA-Z\\-]+)","i"),Lt=Lt.replace(Gt,"")),Pt&&Lt.length)for(Pt=Pt.split(" "),on=Pt.length;on--;)Gt=new RegExp("\\."+Pt[on]+"(?![a-zA-Z\\-]+)","i"),Lt=Lt.replace(Gt,"");return Lt.length===0}function Ut(Nt,Lt){var Kt;if(Nt.getElementById&&(Kt=Nt.getElementById(Lt)),Kt)return Kt;var Pt,ln,Gt,on=Nt.getElementsByTagName("*");for(ln=0,Gt=on.length;ln<Gt;ln++)if(Pt=on[ln],Lt===Pt.getAttribute("id"))return Pt}function Qt(Nt){for(var Lt=xt(Nt,["use","svg:use"]),Kt=0;Lt.length&&Kt<Lt.length;){var Pt=Lt[Kt],ln=Pt.getAttribute("xlink:href")||Pt.getAttribute("href");if(ln===null)return;var Gt=ln.substr(1),on=Pt.getAttribute("x")||0,tn=Pt.getAttribute("y")||0,_i=Ut(Nt,Gt).cloneNode(!0),Xt=(_i.getAttribute("transform")||"")+" translate("+on+", "+tn+")",Vt,qt=Lt.length,rn,nn,cn,un,gn=nt.svgNS;if(Zt(_i),/^svg$/i.test(_i.nodeName)){var mn=_i.ownerDocument.createElementNS(gn,"g");for(nn=0,cn=_i.attributes,un=cn.length;nn<un;nn++)rn=cn.item(nn),mn.setAttributeNS(gn,rn.nodeName,rn.nodeValue);for(;_i.firstChild;)mn.appendChild(_i.firstChild);_i=mn}for(nn=0,cn=Pt.attributes,un=cn.length;nn<un;nn++)rn=cn.item(nn),!(rn.nodeName==="x"||rn.nodeName==="y"||rn.nodeName==="xlink:href"||rn.nodeName==="href")&&(rn.nodeName==="transform"?Xt=rn.nodeValue+" "+Xt:_i.setAttribute(rn.nodeName,rn.nodeValue));_i.setAttribute("transform",Xt),_i.setAttribute("instantiated_by_use","1"),_i.removeAttribute("id"),Vt=Pt.parentNode,Vt.replaceChild(_i,Pt),Lt.length===qt&&Kt++}}var Ht=new RegExp("^\\s*("+nt.reNum+"+)\\s*,?\\s*("+nt.reNum+"+)\\s*,?\\s*("+nt.reNum+"+)\\s*,?\\s*("+nt.reNum+"+)\\s*$");function Zt(Nt){if(!nt.svgViewBoxElementsRegEx.test(Nt.nodeName))return{};var Lt=Nt.getAttribute("viewBox"),Kt=1,Pt=1,ln=0,Gt=0,on,tn,_i,Xt,Vt=Nt.getAttribute("width"),qt=Nt.getAttribute("height"),rn=Nt.getAttribute("x")||0,nn=Nt.getAttribute("y")||0,cn=Nt.getAttribute("preserveAspectRatio")||"",un=!Lt||!(Lt=Lt.match(Ht)),gn=!Vt||!qt||Vt==="100%"||qt==="100%",mn=un&&gn,dn={},fn="",sn=0,pn=0;if(dn.width=0,dn.height=0,dn.toBeParsed=mn,un&&(rn||nn)&&Nt.parentNode&&Nt.parentNode.nodeName!=="#document"&&(fn=" translate("+lt(rn)+" "+lt(nn)+") ",_i=(Nt.getAttribute("transform")||"")+fn,Nt.setAttribute("transform",_i),Nt.removeAttribute("x"),Nt.removeAttribute("y")),mn)return dn;if(un)return dn.width=lt(Vt),dn.height=lt(qt),dn;if(ln=-parseFloat(Lt[1]),Gt=-parseFloat(Lt[2]),on=parseFloat(Lt[3]),tn=parseFloat(Lt[4]),dn.minX=ln,dn.minY=Gt,dn.viewBoxWidth=on,dn.viewBoxHeight=tn,gn?(dn.width=on,dn.height=tn):(dn.width=lt(Vt),dn.height=lt(qt),Kt=dn.width/on,Pt=dn.height/tn),cn=nt.util.parsePreserveAspectRatioAttribute(cn),cn.alignX!=="none"&&(cn.meetOrSlice==="meet"&&(Pt=Kt=Kt>Pt?Pt:Kt),cn.meetOrSlice==="slice"&&(Pt=Kt=Kt>Pt?Kt:Pt),sn=dn.width-on*Kt,pn=dn.height-tn*Kt,cn.alignX==="Mid"&&(sn/=2),cn.alignY==="Mid"&&(pn/=2),cn.alignX==="Min"&&(sn=0),cn.alignY==="Min"&&(pn=0)),Kt===1&&Pt===1&&ln===0&&Gt===0&&rn===0&&nn===0)return dn;if((rn||nn)&&Nt.parentNode.nodeName!=="#document"&&(fn=" translate("+lt(rn)+" "+lt(nn)+") "),_i=fn+" matrix("+Kt+" 0 0 "+Pt+" "+(ln*Kt+sn)+" "+(Gt*Pt+pn)+") ",Nt.nodeName==="svg"){for(Xt=Nt.ownerDocument.createElementNS(nt.svgNS,"g");Nt.firstChild;)Xt.appendChild(Nt.firstChild);Nt.appendChild(Xt)}else Xt=Nt,Xt.removeAttribute("x"),Xt.removeAttribute("y"),_i=Xt.getAttribute("transform")+_i;return Xt.setAttribute("transform",_i),dn}function Wt(Nt,Lt){for(;Nt&&(Nt=Nt.parentNode);)if(Nt.nodeName&&Lt.test(Nt.nodeName.replace("svg:",""))&&!Nt.getAttribute("instantiated_by_use"))return!0;return!1}nt.parseSVGDocument=function(Nt,Lt,Kt,Pt){if(!!Nt){Qt(Nt);var ln=nt.Object.__uid++,Gt,on,tn=Zt(Nt),_i=nt.util.toArray(Nt.getElementsByTagName("*"));if(tn.crossOrigin=Pt&&Pt.crossOrigin,tn.svgUid=ln,_i.length===0&&nt.isLikelyNode){_i=Nt.selectNodes('//*[name(.)!="svg"]');var Xt=[];for(Gt=0,on=_i.length;Gt<on;Gt++)Xt[Gt]=_i[Gt];_i=Xt}var Vt=_i.filter(function(rn){return Zt(rn),nt.svgValidTagNamesRegEx.test(rn.nodeName.replace("svg:",""))&&!Wt(rn,nt.svgInvalidAncestorsRegEx)});if(!Vt||Vt&&!Vt.length){Lt&&Lt([],{});return}var qt={};_i.filter(function(rn){return rn.nodeName.replace("svg:","")==="clipPath"}).forEach(function(rn){var nn=rn.getAttribute("id");qt[nn]=nt.util.toArray(rn.getElementsByTagName("*")).filter(function(cn){return nt.svgValidTagNamesRegEx.test(cn.nodeName.replace("svg:",""))})}),nt.gradientDefs[ln]=nt.getGradientDefs(Nt),nt.cssRules[ln]=nt.getCSSRules(Nt),nt.clipPaths[ln]=qt,nt.parseElements(Vt,function(rn,nn){Lt&&(Lt(rn,tn,nn,_i),delete nt.gradientDefs[ln],delete nt.cssRules[ln],delete nt.clipPaths[ln])},st(tn),Kt,Pt)}};function $t(Nt,Lt){var Kt=["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"],Pt="xlink:href",ln=Lt.getAttribute(Pt).substr(1),Gt=Ut(Nt,ln);if(Gt&&Gt.getAttribute(Pt)&&$t(Nt,Gt),Kt.forEach(function(tn){Gt&&!Lt.hasAttribute(tn)&&Gt.hasAttribute(tn)&&Lt.setAttribute(tn,Gt.getAttribute(tn))}),!Lt.children.length)for(var on=Gt.cloneNode(!0);on.firstChild;)Lt.appendChild(on.firstChild);Lt.removeAttribute(Pt)}var Jt=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+nt.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+nt.reNum+"))?\\s+(.*)");ot(nt,{parseFontDeclaration:function(Nt,Lt){var Kt=Nt.match(Jt);if(!!Kt){var Pt=Kt[1],ln=Kt[3],Gt=Kt[4],on=Kt[5],tn=Kt[6];Pt&&(Lt.fontStyle=Pt),ln&&(Lt.fontWeight=isNaN(parseFloat(ln))?ln:parseFloat(ln)),Gt&&(Lt.fontSize=lt(Gt)),tn&&(Lt.fontFamily=tn),on&&(Lt.lineHeight=on==="normal"?1:on)}},getGradientDefs:function(Nt){var Lt=["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"],Kt=xt(Nt,Lt),Pt,ln=0,Gt={};for(ln=Kt.length;ln--;)Pt=Kt[ln],Pt.getAttribute("xlink:href")&&$t(Nt,Pt),Gt[Pt.getAttribute("id")]=Pt;return Gt},parseAttributes:function(Nt,Lt,Kt){if(!!Nt){var Pt,ln={},Gt,on;typeof Kt=="undefined"&&(Kt=Nt.getAttribute("svgUid")),Nt.parentNode&&nt.svgValidParentsRegEx.test(Nt.parentNode.nodeName)&&(ln=nt.parseAttributes(Nt.parentNode,Lt,Kt));var tn=Lt.reduce(function(cn,un){return Pt=Nt.getAttribute(un),Pt&&(cn[un]=Pt),cn},{}),_i=ot(Ot(Nt,Kt),nt.parseStyleAttribute(Nt));tn=ot(tn,_i),_i[gt]&&Nt.setAttribute(gt,_i[gt]),Gt=on=ln.fontSize||nt.Text.DEFAULT_SVG_FONT_SIZE,tn[At]&&(tn[At]=Gt=lt(tn[At],on));var Xt,Vt,qt={};for(var rn in tn)Xt=vt(rn),Vt=yt(Xt,tn[rn],ln,Gt),qt[Xt]=Vt;qt&&qt.font&&nt.parseFontDeclaration(qt.font,qt);var nn=ot(ln,qt);return nt.svgValidParentsRegEx.test(Nt.nodeName)?nn:Ct(nn)}},parseElements:function(Nt,Lt,Kt,Pt,ln){new nt.ElementsParser(Nt,Lt,Kt,Pt,ln).parse()},parseStyleAttribute:function(Nt){var Lt={},Kt=Nt.getAttribute("style");return Kt&&(typeof Kt=="string"?It(Kt,Lt):St(Kt,Lt)),Lt},parsePointsAttribute:function(Nt){if(!Nt)return null;Nt=Nt.replace(/,/g," ").trim(),Nt=Nt.split(/\s+/);var Lt=[],Kt,Pt;for(Kt=0,Pt=Nt.length;Kt<Pt;Kt+=2)Lt.push({x:parseFloat(Nt[Kt]),y:parseFloat(Nt[Kt+1])});return Lt},getCSSRules:function(Nt){var Lt=Nt.getElementsByTagName("style"),Kt,Pt,ln={},Gt;for(Kt=0,Pt=Lt.length;Kt<Pt;Kt++){var on=Lt[Kt].textContent;on=on.replace(/\/\*[\s\S]*?\*\//g,""),on.trim()!==""&&(Gt=on.match(/[^{]*\{[\s\S]*?\}/g),Gt=Gt.map(function(tn){return tn.trim()}),Gt.forEach(function(tn){var _i=tn.match(/([\s\S]*?)\s*\{([^}]*)\}/),Xt={},Vt=_i[2].trim(),qt=Vt.replace(/;$/,"").split(/\s*;\s*/);for(Kt=0,Pt=qt.length;Kt<Pt;Kt++){var rn=qt[Kt].split(/\s*:\s*/),nn=rn[0],cn=rn[1];Xt[nn]=cn}tn=_i[1],tn.split(",").forEach(function(un){un=un.replace(/^svg/i,"").trim(),un!==""&&(ln[un]?nt.util.object.extend(ln[un],Xt):ln[un]=nt.util.object.clone(Xt))})}))}return ln},loadSVGFromURL:function(Nt,Lt,Kt,Pt){Nt=Nt.replace(/^\n\s*/,"").trim(),new nt.util.request(Nt,{method:"get",onComplete:ln});function ln(Gt){var on=Gt.responseXML;if(!on||!on.documentElement)return Lt&&Lt(null),!1;nt.parseSVGDocument(on.documentElement,function(tn,_i,Xt,Vt){Lt&&Lt(tn,_i,Xt,Vt)},Kt,Pt)}},loadSVGFromString:function(Nt,Lt,Kt,Pt){var ln=new nt.window.DOMParser,Gt=ln.parseFromString(Nt.trim(),"text/xml");nt.parseSVGDocument(Gt.documentElement,function(on,tn,_i,Xt){Lt(on,tn,_i,Xt)},Kt,Pt)}})}(o),s.ElementsParser=function(rt,nt,ot,st,at,lt){this.elements=rt,this.callback=nt,this.options=ot,this.reviver=st,this.svgUid=ot&&ot.svgUid||0,this.parsingOptions=at,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=lt},function(rt){rt.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},rt.createObjects=function(){var nt=this;this.elements.forEach(function(ot,st){ot.setAttribute("svgUid",nt.svgUid),nt.createObject(ot,st)})},rt.findTag=function(nt){return s[s.util.string.capitalize(nt.tagName.replace("svg:",""))]},rt.createObject=function(nt,ot){var st=this.findTag(nt);if(st&&st.fromElement)try{st.fromElement(nt,this.createCallback(ot,nt),this.options)}catch(at){s.log(at)}else this.checkIfDone()},rt.createCallback=function(nt,ot){var st=this;return function(at){var lt;st.resolveGradient(at,ot,"fill"),st.resolveGradient(at,ot,"stroke"),at instanceof s.Image&&at._originalElement&&(lt=at.parsePreserveAspectRatioAttribute(ot)),at._removeTransformMatrix(lt),st.resolveClipPath(at,ot),st.reviver&&st.reviver(ot,at),st.instances[nt]=at,st.checkIfDone()}},rt.extractPropertyDefinition=function(nt,ot,st){var at=nt[ot],lt=this.regexUrl;if(!!lt.test(at)){lt.lastIndex=0;var ct=lt.exec(at)[1];return lt.lastIndex=0,s[st][this.svgUid][ct]}},rt.resolveGradient=function(nt,ot,st){var at=this.extractPropertyDefinition(nt,st,"gradientDefs");if(at){var lt=ot.getAttribute(st+"-opacity"),ct=s.Gradient.fromElement(at,nt,lt,this.options);nt.set(st,ct)}},rt.createClipPathCallback=function(nt,ot){return function(st){st._removeTransformMatrix(),st.fillRule=st.clipRule,ot.push(st)}},rt.resolveClipPath=function(nt,ot){var st=this.extractPropertyDefinition(nt,"clipPath","clipPaths"),at,lt,ct,ht,mt,dt;if(st){ht=[],ct=s.util.invertTransform(nt.calcTransformMatrix());for(var ft=st[0].parentNode,ut=ot;ut.parentNode&&ut.getAttribute("clip-path")!==nt.clipPath;)ut=ut.parentNode;ut.parentNode.appendChild(ft);for(var pt=0;pt<st.length;pt++)at=st[pt],lt=this.findTag(at),lt.fromElement(at,this.createClipPathCallback(nt,ht),this.options);ht.length===1?st=ht[0]:st=new s.Group(ht),mt=s.util.multiplyTransformMatrices(ct,st.calcTransformMatrix()),st.clipPath&&this.resolveClipPath(st,ut);var dt=s.util.qrDecompose(mt);st.flipX=!1,st.flipY=!1,st.set("scaleX",dt.scaleX),st.set("scaleY",dt.scaleY),st.angle=dt.angle,st.skewX=dt.skewX,st.skewY=0,st.setPositionByOrigin({x:dt.translateX,y:dt.translateY},"center","center"),nt.clipPath=st}else delete nt.clipPath},rt.checkIfDone=function(){--this.numElements===0&&(this.instances=this.instances.filter(function(nt){return nt!=null}),this.callback(this.instances,this.elements))}}(s.ElementsParser.prototype),function(rt){var nt=rt.fabric||(rt.fabric={});if(nt.Point){nt.warn("fabric.Point is already defined");return}nt.Point=ot;function ot(st,at){this.x=st,this.y=at}ot.prototype={type:"point",constructor:ot,add:function(st){return new ot(this.x+st.x,this.y+st.y)},addEquals:function(st){return this.x+=st.x,this.y+=st.y,this},scalarAdd:function(st){return new ot(this.x+st,this.y+st)},scalarAddEquals:function(st){return this.x+=st,this.y+=st,this},subtract:function(st){return new ot(this.x-st.x,this.y-st.y)},subtractEquals:function(st){return this.x-=st.x,this.y-=st.y,this},scalarSubtract:function(st){return new ot(this.x-st,this.y-st)},scalarSubtractEquals:function(st){return this.x-=st,this.y-=st,this},multiply:function(st){return new ot(this.x*st,this.y*st)},multiplyEquals:function(st){return this.x*=st,this.y*=st,this},divide:function(st){return new ot(this.x/st,this.y/st)},divideEquals:function(st){return this.x/=st,this.y/=st,this},eq:function(st){return this.x===st.x&&this.y===st.y},lt:function(st){return this.x<st.x&&this.y<st.y},lte:function(st){return this.x<=st.x&&this.y<=st.y},gt:function(st){return this.x>st.x&&this.y>st.y},gte:function(st){return this.x>=st.x&&this.y>=st.y},lerp:function(st,at){return typeof at=="undefined"&&(at=.5),at=Math.max(Math.min(1,at),0),new ot(this.x+(st.x-this.x)*at,this.y+(st.y-this.y)*at)},distanceFrom:function(st){var at=this.x-st.x,lt=this.y-st.y;return Math.sqrt(at*at+lt*lt)},midPointFrom:function(st){return this.lerp(st)},min:function(st){return new ot(Math.min(this.x,st.x),Math.min(this.y,st.y))},max:function(st){return new ot(Math.max(this.x,st.x),Math.max(this.y,st.y))},toString:function(){return this.x+","+this.y},setXY:function(st,at){return this.x=st,this.y=at,this},setX:function(st){return this.x=st,this},setY:function(st){return this.y=st,this},setFromPoint:function(st){return this.x=st.x,this.y=st.y,this},swap:function(st){var at=this.x,lt=this.y;this.x=st.x,this.y=st.y,st.x=at,st.y=lt},clone:function(){return new ot(this.x,this.y)}}}(o),function(rt){var nt=rt.fabric||(rt.fabric={});if(nt.Intersection){nt.warn("fabric.Intersection is already defined");return}function ot(st){this.status=st,this.points=[]}nt.Intersection=ot,nt.Intersection.prototype={constructor:ot,appendPoint:function(st){return this.points.push(st),this},appendPoints:function(st){return this.points=this.points.concat(st),this}},nt.Intersection.intersectLineLine=function(st,at,lt,ct){var ht,mt=(ct.x-lt.x)*(st.y-lt.y)-(ct.y-lt.y)*(st.x-lt.x),dt=(at.x-st.x)*(st.y-lt.y)-(at.y-st.y)*(st.x-lt.x),ft=(ct.y-lt.y)*(at.x-st.x)-(ct.x-lt.x)*(at.y-st.y);if(ft!==0){var ut=mt/ft,pt=dt/ft;0<=ut&&ut<=1&&0<=pt&&pt<=1?(ht=new ot("Intersection"),ht.appendPoint(new nt.Point(st.x+ut*(at.x-st.x),st.y+ut*(at.y-st.y)))):ht=new ot}else mt===0||dt===0?ht=new ot("Coincident"):ht=new ot("Parallel");return ht},nt.Intersection.intersectLinePolygon=function(st,at,lt){var ct=new ot,ht=lt.length,mt,dt,ft,ut;for(ut=0;ut<ht;ut++)mt=lt[ut],dt=lt[(ut+1)%ht],ft=ot.intersectLineLine(st,at,mt,dt),ct.appendPoints(ft.points);return ct.points.length>0&&(ct.status="Intersection"),ct},nt.Intersection.intersectPolygonPolygon=function(st,at){var lt=new ot,ct=st.length,ht;for(ht=0;ht<ct;ht++){var mt=st[ht],dt=st[(ht+1)%ct],ft=ot.intersectLinePolygon(mt,dt,at);lt.appendPoints(ft.points)}return lt.points.length>0&&(lt.status="Intersection"),lt},nt.Intersection.intersectPolygonRectangle=function(st,at,lt){var ct=at.min(lt),ht=at.max(lt),mt=new nt.Point(ht.x,ct.y),dt=new nt.Point(ct.x,ht.y),ft=ot.intersectLinePolygon(ct,mt,st),ut=ot.intersectLinePolygon(mt,ht,st),pt=ot.intersectLinePolygon(ht,dt,st),At=ot.intersectLinePolygon(dt,ct,st),gt=new ot;return gt.appendPoints(ft.points),gt.appendPoints(ut.points),gt.appendPoints(pt.points),gt.appendPoints(At.points),gt.points.length>0&&(gt.status="Intersection"),gt}}(o),function(rt){var nt=rt.fabric||(rt.fabric={});if(nt.Color){nt.warn("fabric.Color is already defined.");return}function ot(at){at?this._tryParsingColor(at):this.setSource([0,0,0,1])}nt.Color=ot,nt.Color.prototype={_tryParsingColor:function(at){var lt;at in ot.colorNameMap&&(at=ot.colorNameMap[at]),at==="transparent"&&(lt=[255,255,255,0]),lt||(lt=ot.sourceFromHex(at)),lt||(lt=ot.sourceFromRgb(at)),lt||(lt=ot.sourceFromHsl(at)),lt||(lt=[0,0,0,1]),lt&&this.setSource(lt)},_rgbToHsl:function(at,lt,ct){at/=255,lt/=255,ct/=255;var ht,mt,dt,ft=nt.util.array.max([at,lt,ct]),ut=nt.util.array.min([at,lt,ct]);if(dt=(ft+ut)/2,ft===ut)ht=mt=0;else{var pt=ft-ut;switch(mt=dt>.5?pt/(2-ft-ut):pt/(ft+ut),ft){case at:ht=(lt-ct)/pt+(lt<ct?6:0);break;case lt:ht=(ct-at)/pt+2;break;case ct:ht=(at-lt)/pt+4;break}ht/=6}return[Math.round(ht*360),Math.round(mt*100),Math.round(dt*100)]},getSource:function(){return this._source},setSource:function(at){this._source=at},toRgb:function(){var at=this.getSource();return"rgb("+at[0]+","+at[1]+","+at[2]+")"},toRgba:function(){var at=this.getSource();return"rgba("+at[0]+","+at[1]+","+at[2]+","+at[3]+")"},toHsl:function(){var at=this.getSource(),lt=this._rgbToHsl(at[0],at[1],at[2]);return"hsl("+lt[0]+","+lt[1]+"%,"+lt[2]+"%)"},toHsla:function(){var at=this.getSource(),lt=this._rgbToHsl(at[0],at[1],at[2]);return"hsla("+lt[0]+","+lt[1]+"%,"+lt[2]+"%,"+at[3]+")"},toHex:function(){var at=this.getSource(),lt,ct,ht;return lt=at[0].toString(16),lt=lt.length===1?"0"+lt:lt,ct=at[1].toString(16),ct=ct.length===1?"0"+ct:ct,ht=at[2].toString(16),ht=ht.length===1?"0"+ht:ht,lt.toUpperCase()+ct.toUpperCase()+ht.toUpperCase()},toHexa:function(){var at=this.getSource(),lt;return lt=Math.round(at[3]*255),lt=lt.toString(16),lt=lt.length===1?"0"+lt:lt,this.toHex()+lt.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(at){var lt=this.getSource();return lt[3]=at,this.setSource(lt),this},toGrayscale:function(){var at=this.getSource(),lt=parseInt((at[0]*.3+at[1]*.59+at[2]*.11).toFixed(0),10),ct=at[3];return this.setSource([lt,lt,lt,ct]),this},toBlackWhite:function(at){var lt=this.getSource(),ct=(lt[0]*.3+lt[1]*.59+lt[2]*.11).toFixed(0),ht=lt[3];return at=at||127,ct=Number(ct)<Number(at)?0:255,this.setSource([ct,ct,ct,ht]),this},overlayWith:function(at){at instanceof ot||(at=new ot(at));var lt=[],ct=this.getAlpha(),ht=.5,mt=this.getSource(),dt=at.getSource(),ft;for(ft=0;ft<3;ft++)lt.push(Math.round(mt[ft]*(1-ht)+dt[ft]*ht));return lt[3]=ct,this.setSource(lt),this}},nt.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i,nt.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,nt.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,nt.Color.colorNameMap={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"};function st(at,lt,ct){return ct<0&&(ct+=1),ct>1&&(ct-=1),ct<1/6?at+(lt-at)*6*ct:ct<1/2?lt:ct<2/3?at+(lt-at)*(2/3-ct)*6:at}nt.Color.fromRgb=function(at){return ot.fromSource(ot.sourceFromRgb(at))},nt.Color.sourceFromRgb=function(at){var lt=at.match(ot.reRGBa);if(lt){var ct=parseInt(lt[1],10)/(/%$/.test(lt[1])?100:1)*(/%$/.test(lt[1])?255:1),ht=parseInt(lt[2],10)/(/%$/.test(lt[2])?100:1)*(/%$/.test(lt[2])?255:1),mt=parseInt(lt[3],10)/(/%$/.test(lt[3])?100:1)*(/%$/.test(lt[3])?255:1);return[parseInt(ct,10),parseInt(ht,10),parseInt(mt,10),lt[4]?parseFloat(lt[4]):1]}},nt.Color.fromRgba=ot.fromRgb,nt.Color.fromHsl=function(at){return ot.fromSource(ot.sourceFromHsl(at))},nt.Color.sourceFromHsl=function(at){var lt=at.match(ot.reHSLa);if(!!lt){var ct=(parseFloat(lt[1])%360+360)%360/360,ht=parseFloat(lt[2])/(/%$/.test(lt[2])?100:1),mt=parseFloat(lt[3])/(/%$/.test(lt[3])?100:1),dt,ft,ut;if(ht===0)dt=ft=ut=mt;else{var pt=mt<=.5?mt*(ht+1):mt+ht-mt*ht,At=mt*2-pt;dt=st(At,pt,ct+1/3),ft=st(At,pt,ct),ut=st(At,pt,ct-1/3)}return[Math.round(dt*255),Math.round(ft*255),Math.round(ut*255),lt[4]?parseFloat(lt[4]):1]}},nt.Color.fromHsla=ot.fromHsl,nt.Color.fromHex=function(at){return ot.fromSource(ot.sourceFromHex(at))},nt.Color.sourceFromHex=function(at){if(at.match(ot.reHex)){var lt=at.slice(at.indexOf("#")+1),ct=lt.length===3||lt.length===4,ht=lt.length===8||lt.length===4,mt=ct?lt.charAt(0)+lt.charAt(0):lt.substring(0,2),dt=ct?lt.charAt(1)+lt.charAt(1):lt.substring(2,4),ft=ct?lt.charAt(2)+lt.charAt(2):lt.substring(4,6),ut=ht?ct?lt.charAt(3)+lt.charAt(3):lt.substring(6,8):"FF";return[parseInt(mt,16),parseInt(dt,16),parseInt(ft,16),parseFloat((parseInt(ut,16)/255).toFixed(2))]}},nt.Color.fromSource=function(at){var lt=new ot;return lt.setSource(at),lt}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=["e","se","s","sw","w","nw","n","ne","e"],st=["ns","nesw","ew","nwse"],at={},lt="left",ct="top",ht="right",mt="bottom",dt="center",ft={top:mt,bottom:ct,left:ht,right:lt,center:dt},ut=nt.util.radiansToDegrees,pt=Math.sign||function(Xt){return(Xt>0)-(Xt<0)||+Xt};function At(Xt,Vt){var qt=Xt.angle+ut(Math.atan2(Vt.y,Vt.x))+360;return Math.round(qt%360/45)}function gt(Xt,Vt){var qt=Vt.transform.target,rn=qt.canvas,nn=nt.util.object.clone(Vt);nn.target=qt,rn&&rn.fire("object:"+Xt,nn),qt.fire(Xt,Vt)}function vt(Xt,Vt){var qt=Vt.canvas,rn=qt.uniScaleKey,nn=Xt[rn];return qt.uniformScaling&&!nn||!qt.uniformScaling&&nn}function yt(Xt){return Xt.originX===dt&&Xt.originY===dt}function bt(Xt,Vt,qt){var rn=Xt.lockScalingX,nn=Xt.lockScalingY;return!!(rn&&nn||!Vt&&(rn||nn)&&qt||rn&&Vt==="x"||nn&&Vt==="y")}function Ct(Xt,Vt,qt){var rn="not-allowed",nn=vt(Xt,qt),cn="";if(Vt.x!==0&&Vt.y===0?cn="x":Vt.x===0&&Vt.y!==0&&(cn="y"),bt(qt,cn,nn))return rn;var un=At(qt,Vt);return ot[un]+"-resize"}function xt(Xt,Vt,qt){var rn="not-allowed";if(Vt.x!==0&&qt.lockSkewingY||Vt.y!==0&&qt.lockSkewingX)return rn;var nn=At(qt,Vt)%4;return st[nn]+"-resize"}function It(Xt,Vt,qt){return Xt[qt.canvas.altActionKey]?at.skewCursorStyleHandler(Xt,Vt,qt):at.scaleCursorStyleHandler(Xt,Vt,qt)}function St(Xt,Vt,qt){var rn=Xt[qt.canvas.altActionKey];if(Vt.x===0)return rn?"skewX":"scaleY";if(Vt.y===0)return rn?"skewY":"scaleX"}function Ot(Xt,Vt,qt){return qt.lockRotation?"not-allowed":Vt.cursorStyle}function Mt(Xt,Vt,qt,rn){return{e:Xt,transform:Vt,pointer:{x:qt,y:rn}}}function jt(Xt){return function(Vt,qt,rn,nn){var cn=qt.target,un=cn.getCenterPoint(),gn=cn.translateToOriginPoint(un,qt.originX,qt.originY),mn=Xt(Vt,qt,rn,nn);return cn.setPositionByOrigin(gn,qt.originX,qt.originY),mn}}function Ft(Xt,Vt){return function(qt,rn,nn,cn){var un=Vt(qt,rn,nn,cn);return un&&gt(Xt,Mt(qt,rn,nn,cn)),un}}function Ut(Xt,Vt,qt,rn,nn){var cn=Xt.target,un=cn.controls[Xt.corner],gn=cn.canvas.getZoom(),mn=cn.padding/gn,dn=cn.toLocalPoint(new nt.Point(rn,nn),Vt,qt);return dn.x>=mn&&(dn.x-=mn),dn.x<=-mn&&(dn.x+=mn),dn.y>=mn&&(dn.y-=mn),dn.y<=mn&&(dn.y+=mn),dn.x-=un.offsetX,dn.y-=un.offsetY,dn}function Qt(Xt){return Xt.flipX!==Xt.flipY}function Ht(Xt,Vt,qt,rn,nn){if(Xt[Vt]!==0){var cn=Xt._getTransformedDimensions()[rn],un=nn/cn*Xt[qt];Xt.set(qt,un)}}function Zt(Xt,Vt,qt,rn){var nn=Vt.target,cn=nn._getTransformedDimensions(0,nn.skewY),un=Ut(Vt,Vt.originX,Vt.originY,qt,rn),gn=Math.abs(un.x*2)-cn.x,mn=nn.skewX,dn;gn<2?dn=0:(dn=ut(Math.atan2(gn/nn.scaleX,cn.y/nn.scaleY)),Vt.originX===lt&&Vt.originY===mt&&(dn=-dn),Vt.originX===ht&&Vt.originY===ct&&(dn=-dn),Qt(nn)&&(dn=-dn));var fn=mn!==dn;if(fn){var sn=nn._getTransformedDimensions().y;nn.set("skewX",dn),Ht(nn,"skewY","scaleY","y",sn)}return fn}function Wt(Xt,Vt,qt,rn){var nn=Vt.target,cn=nn._getTransformedDimensions(nn.skewX,0),un=Ut(Vt,Vt.originX,Vt.originY,qt,rn),gn=Math.abs(un.y*2)-cn.y,mn=nn.skewY,dn;gn<2?dn=0:(dn=ut(Math.atan2(gn/nn.scaleY,cn.x/nn.scaleX)),Vt.originX===lt&&Vt.originY===mt&&(dn=-dn),Vt.originX===ht&&Vt.originY===ct&&(dn=-dn),Qt(nn)&&(dn=-dn));var fn=mn!==dn;if(fn){var sn=nn._getTransformedDimensions().x;nn.set("skewY",dn),Ht(nn,"skewX","scaleX","x",sn)}return fn}function $t(Xt,Vt,qt,rn){var nn=Vt.target,cn=nn.skewX,un,gn=Vt.originY;if(nn.lockSkewingX)return!1;if(cn===0){var mn=Ut(Vt,dt,dt,qt,rn);mn.x>0?un=lt:un=ht}else cn>0&&(un=gn===ct?lt:ht),cn<0&&(un=gn===ct?ht:lt),Qt(nn)&&(un=un===lt?ht:lt);Vt.originX=un;var dn=Ft("skewing",jt(Zt));return dn(Xt,Vt,qt,rn)}function Jt(Xt,Vt,qt,rn){var nn=Vt.target,cn=nn.skewY,un,gn=Vt.originX;if(nn.lockSkewingY)return!1;if(cn===0){var mn=Ut(Vt,dt,dt,qt,rn);mn.y>0?un=ct:un=mt}else cn>0&&(un=gn===lt?ct:mt),cn<0&&(un=gn===lt?mt:ct),Qt(nn)&&(un=un===ct?mt:ct);Vt.originY=un;var dn=Ft("skewing",jt(Wt));return dn(Xt,Vt,qt,rn)}function Nt(Xt,Vt,qt,rn){var nn=Vt,cn=nn.target,un=cn.translateToOriginPoint(cn.getCenterPoint(),nn.originX,nn.originY);if(cn.lockRotation)return!1;var gn=Math.atan2(nn.ey-un.y,nn.ex-un.x),mn=Math.atan2(rn-un.y,qt-un.x),dn=ut(mn-gn+nn.theta),fn=!0;if(cn.snapAngle>0){var sn=cn.snapAngle,pn=cn.snapThreshold||sn,bn=Math.ceil(dn/sn)*sn,An=Math.floor(dn/sn)*sn;Math.abs(dn-An)<pn?dn=An:Math.abs(dn-bn)<pn&&(dn=bn)}return dn<0&&(dn=360+dn),dn%=360,fn=cn.angle!==dn,cn.angle=dn,fn}function Lt(Xt,Vt,qt,rn,nn){nn=nn||{};var cn=Vt.target,un=cn.lockScalingX,gn=cn.lockScalingY,mn=nn.by,dn,fn,sn,pn,bn=vt(Xt,cn),An=bt(cn,mn,bn),Sn,En,Vn=Vt.gestureScale;if(An)return!1;if(Vn)fn=Vt.scaleX*Vn,sn=Vt.scaleY*Vn;else{if(dn=Ut(Vt,Vt.originX,Vt.originY,qt,rn),Sn=mn!=="y"?pt(dn.x):1,En=mn!=="x"?pt(dn.y):1,Vt.signX||(Vt.signX=Sn),Vt.signY||(Vt.signY=En),cn.lockScalingFlip&&(Vt.signX!==Sn||Vt.signY!==En))return!1;if(pn=cn._getTransformedDimensions(),bn&&!mn){var Rn=Math.abs(dn.x)+Math.abs(dn.y),In=Vt.original,zn=Math.abs(pn.x*In.scaleX/cn.scaleX)+Math.abs(pn.y*In.scaleY/cn.scaleY),Tn=Rn/zn;fn=In.scaleX*Tn,sn=In.scaleY*Tn}else fn=Math.abs(dn.x*cn.scaleX/pn.x),sn=Math.abs(dn.y*cn.scaleY/pn.y);yt(Vt)&&(fn*=2,sn*=2),Vt.signX!==Sn&&mn!=="y"&&(Vt.originX=ft[Vt.originX],fn*=-1,Vt.signX=Sn),Vt.signY!==En&&mn!=="x"&&(Vt.originY=ft[Vt.originY],sn*=-1,Vt.signY=En)}var tr=cn.scaleX,Qn=cn.scaleY;return mn?(mn==="x"&&cn.set("scaleX",fn),mn==="y"&&cn.set("scaleY",sn)):(!un&&cn.set("scaleX",fn),!gn&&cn.set("scaleY",sn)),tr!==cn.scaleX||Qn!==cn.scaleY}function Kt(Xt,Vt,qt,rn){return Lt(Xt,Vt,qt,rn)}function Pt(Xt,Vt,qt,rn){return Lt(Xt,Vt,qt,rn,{by:"x"})}function ln(Xt,Vt,qt,rn){return Lt(Xt,Vt,qt,rn,{by:"y"})}function Gt(Xt,Vt,qt,rn){return Xt[Vt.target.canvas.altActionKey]?at.skewHandlerX(Xt,Vt,qt,rn):at.scalingY(Xt,Vt,qt,rn)}function on(Xt,Vt,qt,rn){return Xt[Vt.target.canvas.altActionKey]?at.skewHandlerY(Xt,Vt,qt,rn):at.scalingX(Xt,Vt,qt,rn)}function tn(Xt,Vt,qt,rn){var nn=Vt.target,cn=Ut(Vt,Vt.originX,Vt.originY,qt,rn),un=nn.strokeWidth/(nn.strokeUniform?nn.scaleX:1),gn=yt(Vt)?2:1,mn=nn.width,dn=Math.abs(cn.x*gn/nn.scaleX)-un;return nn.set("width",Math.max(dn,0)),mn!==dn}function _i(Xt,Vt,qt,rn){var nn=Vt.target,cn=qt-Vt.offsetX,un=rn-Vt.offsetY,gn=!nn.get("lockMovementX")&&nn.left!==cn,mn=!nn.get("lockMovementY")&&nn.top!==un;return gn&&nn.set("left",cn),mn&&nn.set("top",un),(gn||mn)&&gt("moving",Mt(Xt,Vt,qt,rn)),gn||mn}at.scaleCursorStyleHandler=Ct,at.skewCursorStyleHandler=xt,at.scaleSkewCursorStyleHandler=It,at.rotationWithSnapping=Ft("rotating",jt(Nt)),at.scalingEqually=Ft("scaling",jt(Kt)),at.scalingX=Ft("scaling",jt(Pt)),at.scalingY=Ft("scaling",jt(ln)),at.scalingYOrSkewingX=Gt,at.scalingXOrSkewingY=on,at.changeWidth=Ft("resizing",jt(tn)),at.skewHandlerX=$t,at.skewHandlerY=Jt,at.dragHandler=_i,at.scaleOrSkewActionName=St,at.rotationStyleHandler=Ot,at.fireEvent=gt,at.wrapWithFixedAnchor=jt,at.wrapWithFireEvent=Ft,at.getLocalPoint=Ut,nt.controlsUtils=at}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.degreesToRadians,st=nt.controlsUtils;function at(ct,ht,mt,dt,ft){dt=dt||{};var ut=this.sizeX||dt.cornerSize||ft.cornerSize,pt=this.sizeY||dt.cornerSize||ft.cornerSize,At=typeof dt.transparentCorners!="undefined"?dt.transparentCorners:ft.transparentCorners,gt=At?"stroke":"fill",vt=!At&&(dt.cornerStrokeColor||ft.cornerStrokeColor),yt=ht,bt=mt,Ct;ct.save(),ct.fillStyle=dt.cornerColor||ft.cornerColor,ct.strokeStyle=dt.cornerStrokeColor||ft.cornerStrokeColor,ut>pt?(Ct=ut,ct.scale(1,pt/ut),bt=mt*ut/pt):pt>ut?(Ct=pt,ct.scale(ut/pt,1),yt=ht*pt/ut):Ct=ut,ct.lineWidth=1,ct.beginPath(),ct.arc(yt,bt,Ct/2,0,2*Math.PI,!1),ct[gt](),vt&&ct.stroke(),ct.restore()}function lt(ct,ht,mt,dt,ft){dt=dt||{};var ut=this.sizeX||dt.cornerSize||ft.cornerSize,pt=this.sizeY||dt.cornerSize||ft.cornerSize,At=typeof dt.transparentCorners!="undefined"?dt.transparentCorners:ft.transparentCorners,gt=At?"stroke":"fill",vt=!At&&(dt.cornerStrokeColor||ft.cornerStrokeColor),yt=ut/2,bt=pt/2;ct.save(),ct.fillStyle=dt.cornerColor||ft.cornerColor,ct.strokeStyle=dt.cornerStrokeColor||ft.cornerStrokeColor,ct.lineWidth=1,ct.translate(ht,mt),ct.rotate(ot(ft.angle)),ct[gt+"Rect"](-yt,-bt,ut,pt),vt&&ct.strokeRect(-yt,-bt,ut,pt),ct.restore()}st.renderCircleControl=at,st.renderSquareControl=lt}(o),function(rt){var nt=rt.fabric||(rt.fabric={});function ot(st){for(var at in st)this[at]=st[at]}nt.Control=ot,nt.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(st,at){return at.cursorStyle},getActionName:function(st,at){return at.actionName},getVisibility:function(st,at){var lt=st._controlsVisibility;return lt&&typeof lt[at]!="undefined"?lt[at]:this.visible},setVisibility:function(st){this.visible=st},positionHandler:function(st,at){var lt=nt.util.transformPoint({x:this.x*st.x+this.offsetX,y:this.y*st.y+this.offsetY},at);return lt},calcCornerCoords:function(st,at,lt,ct,ht){var mt,dt,ft,ut,pt=ht?this.touchSizeX:this.sizeX,At=ht?this.touchSizeY:this.sizeY;if(pt&&At&&pt!==At){var gt=Math.atan2(At,pt),vt=Math.sqrt(pt*pt+At*At)/2,yt=gt-nt.util.degreesToRadians(st),bt=Math.PI/2-gt-nt.util.degreesToRadians(st);mt=vt*nt.util.cos(yt),dt=vt*nt.util.sin(yt),ft=vt*nt.util.cos(bt),ut=vt*nt.util.sin(bt)}else{var Ct=pt&&At?pt:at;vt=Ct*.7071067812;var yt=nt.util.degreesToRadians(45-st);mt=ft=vt*nt.util.cos(yt),dt=ut=vt*nt.util.sin(yt)}return{tl:{x:lt-ut,y:ct-ft},tr:{x:lt+mt,y:ct-dt},bl:{x:lt-mt,y:ct+dt},br:{x:lt+ut,y:ct+ft}}},render:function(st,at,lt,ct,ht){switch(ct=ct||{},ct.cornerStyle||ht.cornerStyle){case"circle":nt.controlsUtils.renderCircleControl.call(this,st,at,lt,ct,ht);break;default:nt.controlsUtils.renderSquareControl.call(this,st,at,lt,ct,ht)}}}}(o),function(){function rt(lt,ct){var ht=lt.getAttribute("style"),mt=lt.getAttribute("offset")||0,dt,ft,ut,pt;if(mt=parseFloat(mt)/(/%$/.test(mt)?100:1),mt=mt<0?0:mt>1?1:mt,ht){var At=ht.split(/\s*;\s*/);for(At[At.length-1]===""&&At.pop(),pt=At.length;pt--;){var gt=At[pt].split(/\s*:\s*/),vt=gt[0].trim(),yt=gt[1].trim();vt==="stop-color"?dt=yt:vt==="stop-opacity"&&(ut=yt)}}return dt||(dt=lt.getAttribute("stop-color")||"rgb(0,0,0)"),ut||(ut=lt.getAttribute("stop-opacity")),dt=new s.Color(dt),ft=dt.getAlpha(),ut=isNaN(parseFloat(ut))?1:parseFloat(ut),ut*=ft*ct,{offset:mt,color:dt.toRgb(),opacity:ut}}function nt(lt){return{x1:lt.getAttribute("x1")||0,y1:lt.getAttribute("y1")||0,x2:lt.getAttribute("x2")||"100%",y2:lt.getAttribute("y2")||0}}function ot(lt){return{x1:lt.getAttribute("fx")||lt.getAttribute("cx")||"50%",y1:lt.getAttribute("fy")||lt.getAttribute("cy")||"50%",r1:0,x2:lt.getAttribute("cx")||"50%",y2:lt.getAttribute("cy")||"50%",r2:lt.getAttribute("r")||"50%"}}var st=s.util.object.clone;s.Gradient=s.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(lt){lt||(lt={}),lt.coords||(lt.coords={});var ct,ht=this;Object.keys(lt).forEach(function(mt){ht[mt]=lt[mt]}),this.id?this.id+="_"+s.Object.__uid++:this.id=s.Object.__uid++,ct={x1:lt.coords.x1||0,y1:lt.coords.y1||0,x2:lt.coords.x2||0,y2:lt.coords.y2||0},this.type==="radial"&&(ct.r1=lt.coords.r1||0,ct.r2=lt.coords.r2||0),this.coords=ct,this.colorStops=lt.colorStops.slice()},addColorStop:function(lt){for(var ct in lt){var ht=new s.Color(lt[ct]);this.colorStops.push({offset:parseFloat(ct),color:ht.toRgb(),opacity:ht.getAlpha()})}return this},toObject:function(lt){var ct={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return s.util.populateWithProperties(this,ct,lt),ct},toSVG:function(lt,ft){var ht=st(this.coords,!0),mt,dt,ft=ft||{},ut,pt,At=st(this.colorStops,!0),gt=ht.r1>ht.r2,vt=this.gradientTransform?this.gradientTransform.concat():s.iMatrix.concat(),yt=-this.offsetX,bt=-this.offsetY,Ct=!!ft.additionalTransform,xt=this.gradientUnits==="pixels"?"userSpaceOnUse":"objectBoundingBox";if(At.sort(function(jt,Ft){return jt.offset-Ft.offset}),xt==="objectBoundingBox"?(yt/=lt.width,bt/=lt.height):(yt+=lt.width/2,bt+=lt.height/2),lt.type==="path"&&this.gradientUnits!=="percentage"&&(yt-=lt.pathOffset.x,bt-=lt.pathOffset.y),vt[4]-=yt,vt[5]-=bt,pt='id="SVGID_'+this.id+'" gradientUnits="'+xt+'"',pt+=' gradientTransform="'+(Ct?ft.additionalTransform+" ":"")+s.util.matrixToSVG(vt)+'" ',this.type==="linear"?ut=["<linearGradient ",pt,' x1="',ht.x1,'" y1="',ht.y1,'" x2="',ht.x2,'" y2="',ht.y2,`">
`]:this.type==="radial"&&(ut=["<radialGradient ",pt,' cx="',gt?ht.x1:ht.x2,'" cy="',gt?ht.y1:ht.y2,'" r="',gt?ht.r1:ht.r2,'" fx="',gt?ht.x2:ht.x1,'" fy="',gt?ht.y2:ht.y1,`">
`]),this.type==="radial"){if(gt)for(At=At.concat(),At.reverse(),mt=0,dt=At.length;mt<dt;mt++)At[mt].offset=1-At[mt].offset;var It=Math.min(ht.r1,ht.r2);if(It>0){var St=Math.max(ht.r1,ht.r2),Ot=It/St;for(mt=0,dt=At.length;mt<dt;mt++)At[mt].offset+=Ot*(1-At[mt].offset)}}for(mt=0,dt=At.length;mt<dt;mt++){var Mt=At[mt];ut.push("<stop ",'offset="',Mt.offset*100+"%",'" style="stop-color:',Mt.color,typeof Mt.opacity!="undefined"?";stop-opacity: "+Mt.opacity:";",`"/>
`)}return ut.push(this.type==="linear"?`</linearGradient>
`:`</radialGradient>
`),ut.join("")},toLive:function(lt){var ct,ht=s.util.object.clone(this.coords),mt,dt;if(!!this.type){for(this.type==="linear"?ct=lt.createLinearGradient(ht.x1,ht.y1,ht.x2,ht.y2):this.type==="radial"&&(ct=lt.createRadialGradient(ht.x1,ht.y1,ht.r1,ht.x2,ht.y2,ht.r2)),mt=0,dt=this.colorStops.length;mt<dt;mt++){var ft=this.colorStops[mt].color,ut=this.colorStops[mt].opacity,pt=this.colorStops[mt].offset;typeof ut!="undefined"&&(ft=new s.Color(ft).setAlpha(ut).toRgba()),ct.addColorStop(pt,ft)}return ct}}}),s.util.object.extend(s.Gradient,{fromElement:function(lt,ct,ht,mt){var dt=parseFloat(ht)/(/%$/.test(ht)?100:1);dt=dt<0?0:dt>1?1:dt,isNaN(dt)&&(dt=1);var ft=lt.getElementsByTagName("stop"),ut,pt=lt.getAttribute("gradientUnits")==="userSpaceOnUse"?"pixels":"percentage",At=lt.getAttribute("gradientTransform")||"",gt=[],vt,yt,bt=0,Ct=0,xt;for(lt.nodeName==="linearGradient"||lt.nodeName==="LINEARGRADIENT"?(ut="linear",vt=nt(lt)):(ut="radial",vt=ot(lt)),yt=ft.length;yt--;)gt.push(rt(ft[yt],dt));xt=s.parseTransformAttribute(At),at(ct,vt,mt,pt),pt==="pixels"&&(bt=-ct.left,Ct=-ct.top);var It=new s.Gradient({id:lt.getAttribute("id"),type:ut,coords:vt,colorStops:gt,gradientUnits:pt,gradientTransform:xt,offsetX:bt,offsetY:Ct});return It}});function at(lt,ct,ht,mt){var dt,ft;Object.keys(ct).forEach(function(ut){dt=ct[ut],dt==="Infinity"?ft=1:dt==="-Infinity"?ft=0:(ft=parseFloat(ct[ut],10),typeof dt=="string"&&/^(\d+\.\d+)%|(\d+)%$/.test(dt)&&(ft*=.01,mt==="pixels"&&((ut==="x1"||ut==="x2"||ut==="r2")&&(ft*=ht.viewBoxWidth||ht.width),(ut==="y1"||ut==="y2")&&(ft*=ht.viewBoxHeight||ht.height)))),ct[ut]=ft})}}(),function(){var rt=s.util.toFixed;s.Pattern=s.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(nt,ot){if(nt||(nt={}),this.id=s.Object.__uid++,this.setOptions(nt),!nt.source||nt.source&&typeof nt.source!="string"){ot&&ot(this);return}else{var st=this;this.source=s.util.createImage(),s.util.loadImage(nt.source,function(at,lt){st.source=at,ot&&ot(st,lt)},null,this.crossOrigin)}},toObject:function(nt){var ot=s.Object.NUM_FRACTION_DIGITS,st,at;return typeof this.source.src=="string"?st=this.source.src:typeof this.source=="object"&&this.source.toDataURL&&(st=this.source.toDataURL()),at={type:"pattern",source:st,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:rt(this.offsetX,ot),offsetY:rt(this.offsetY,ot),patternTransform:this.patternTransform?this.patternTransform.concat():null},s.util.populateWithProperties(this,at,nt),at},toSVG:function(nt){var ot=typeof this.source=="function"?this.source():this.source,st=ot.width/nt.width,at=ot.height/nt.height,lt=this.offsetX/nt.width,ct=this.offsetY/nt.height,ht="";return(this.repeat==="repeat-x"||this.repeat==="no-repeat")&&(at=1,ct&&(at+=Math.abs(ct))),(this.repeat==="repeat-y"||this.repeat==="no-repeat")&&(st=1,lt&&(st+=Math.abs(lt))),ot.src?ht=ot.src:ot.toDataURL&&(ht=ot.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+lt+'" y="'+ct+'" width="'+st+'" height="'+at+`">
<image x="0" y="0" width="`+ot.width+'" height="'+ot.height+'" xlink:href="'+ht+`"></image>
</pattern>
`},setOptions:function(nt){for(var ot in nt)this[ot]=nt[ot]},toLive:function(nt){var ot=this.source;return!ot||typeof ot.src!="undefined"&&(!ot.complete||ot.naturalWidth===0||ot.naturalHeight===0)?"":nt.createPattern(ot,this.repeat)}})}(),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.toFixed;if(nt.Shadow){nt.warn("fabric.Shadow is already defined.");return}nt.Shadow=nt.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(st){typeof st=="string"&&(st=this._parseShadow(st));for(var at in st)this[at]=st[at];this.id=nt.Object.__uid++},_parseShadow:function(st){var at=st.trim(),lt=nt.Shadow.reOffsetsAndBlur.exec(at)||[],ct=at.replace(nt.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)";return{color:ct.trim(),offsetX:parseFloat(lt[1],10)||0,offsetY:parseFloat(lt[2],10)||0,blur:parseFloat(lt[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(st){var at=40,lt=40,ct=nt.Object.NUM_FRACTION_DIGITS,ht=nt.util.rotateVector({x:this.offsetX,y:this.offsetY},nt.util.degreesToRadians(-st.angle)),mt=20,dt=new nt.Color(this.color);return st.width&&st.height&&(at=ot((Math.abs(ht.x)+this.blur)/st.width,ct)*100+mt,lt=ot((Math.abs(ht.y)+this.blur)/st.height,ct)*100+mt),st.flipX&&(ht.x*=-1),st.flipY&&(ht.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+lt+'%" height="'+(100+2*lt)+'%" x="-'+at+'%" width="'+(100+2*at)+`%" >
	<feGaussianBlur in="SourceAlpha" stdDeviation="`+ot(this.blur?this.blur/2:0,ct)+`"></feGaussianBlur>
	<feOffset dx="`+ot(ht.x,ct)+'" dy="'+ot(ht.y,ct)+`" result="oBlur" ></feOffset>
	<feFlood flood-color="`+dt.toRgb()+'" flood-opacity="'+dt.getAlpha()+`"/>
	<feComposite in2="oBlur" operator="in" />
	<feMerge>
		<feMergeNode></feMergeNode>
		<feMergeNode in="SourceGraphic"></feMergeNode>
	</feMerge>
</filter>
`},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var st={},at=nt.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach(function(lt){this[lt]!==at[lt]&&(st[lt]=this[lt])},this),st}}),nt.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/}(o),function(){if(s.StaticCanvas){s.warn("fabric.StaticCanvas is already defined.");return}var rt=s.util.object.extend,nt=s.util.getElementOffset,ot=s.util.removeFromArray,st=s.util.toFixed,at=s.util.transformPoint,lt=s.util.invertTransform,ct=s.util.getNodeCanvas,ht=s.util.createCanvasElement,mt=new Error("Could not initialize `canvas` element");s.StaticCanvas=s.util.createClass(s.CommonMethods,{initialize:function(dt,ft){ft||(ft={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(dt,ft)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:s.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(dt,ft){var ut=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(dt),this._initOptions(ft),this.interactive||this._initRetinaScaling(),ft.overlayImage&&this.setOverlayImage(ft.overlayImage,ut),ft.backgroundImage&&this.setBackgroundImage(ft.backgroundImage,ut),ft.backgroundColor&&this.setBackgroundColor(ft.backgroundColor,ut),ft.overlayColor&&this.setOverlayColor(ft.overlayColor,ut),this.calcOffset()},_isRetinaScaling:function(){return s.devicePixelRatio!==1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?s.devicePixelRatio:1},_initRetinaScaling:function(){if(!!this._isRetinaScaling()){var dt=s.devicePixelRatio;this.__initRetinaScaling(dt,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(dt,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(dt,ft,ut){ft.setAttribute("width",this.width*dt),ft.setAttribute("height",this.height*dt),ut.scale(dt,dt)},calcOffset:function(){return this._offset=nt(this.lowerCanvasEl),this},setOverlayImage:function(dt,ft,ut){return this.__setBgOverlayImage("overlayImage",dt,ft,ut)},setBackgroundImage:function(dt,ft,ut){return this.__setBgOverlayImage("backgroundImage",dt,ft,ut)},setOverlayColor:function(dt,ft){return this.__setBgOverlayColor("overlayColor",dt,ft)},setBackgroundColor:function(dt,ft){return this.__setBgOverlayColor("backgroundColor",dt,ft)},__setBgOverlayImage:function(dt,ft,ut,pt){return typeof ft=="string"?s.util.loadImage(ft,function(At,gt){if(At){var vt=new s.Image(At,pt);this[dt]=vt,vt.canvas=this}ut&&ut(At,gt)},this,pt&&pt.crossOrigin):(pt&&ft.setOptions(pt),this[dt]=ft,ft&&(ft.canvas=this),ut&&ut(ft,!1)),this},__setBgOverlayColor:function(dt,ft,ut){return this[dt]=ft,this._initGradient(ft,dt),this._initPattern(ft,dt,ut),this},_createCanvasElement:function(){var dt=ht();if(!dt||(dt.style||(dt.style={}),typeof dt.getContext=="undefined"))throw mt;return dt},_initOptions:function(dt){var ft=this.lowerCanvasEl;this._setOptions(dt),this.width=this.width||parseInt(ft.width,10)||0,this.height=this.height||parseInt(ft.height,10)||0,this.lowerCanvasEl.style&&(ft.width=this.width,ft.height=this.height,ft.style.width=this.width+"px",ft.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(dt){dt&&dt.getContext?this.lowerCanvasEl=dt:this.lowerCanvasEl=s.util.getById(dt)||this._createCanvasElement(),s.util.addClass(this.lowerCanvasEl,"lower-canvas"),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(dt,ft){return this.setDimensions({width:dt},ft)},setHeight:function(dt,ft){return this.setDimensions({height:dt},ft)},setDimensions:function(dt,ft){var ut;ft=ft||{};for(var pt in dt)ut=dt[pt],ft.cssOnly||(this._setBackstoreDimension(pt,dt[pt]),ut+="px",this.hasLostContext=!0),ft.backstoreOnly||this._setCssDimension(pt,ut);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(),this._initRetinaScaling(),this.calcOffset(),ft.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(dt,ft){return this.lowerCanvasEl[dt]=ft,this.upperCanvasEl&&(this.upperCanvasEl[dt]=ft),this.cacheCanvasEl&&(this.cacheCanvasEl[dt]=ft),this[dt]=ft,this},_setCssDimension:function(dt,ft){return this.lowerCanvasEl.style[dt]=ft,this.upperCanvasEl&&(this.upperCanvasEl.style[dt]=ft),this.wrapperEl&&(this.wrapperEl.style[dt]=ft),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(dt){var ft=this._activeObject,ut=this.backgroundImage,pt=this.overlayImage,At,gt,vt;for(this.viewportTransform=dt,gt=0,vt=this._objects.length;gt<vt;gt++)At=this._objects[gt],At.group||At.setCoords(!0);return ft&&ft.setCoords(),ut&&ut.setCoords(!0),pt&&pt.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(dt,ft){var ut=dt,pt=this.viewportTransform.slice(0);dt=at(dt,lt(this.viewportTransform)),pt[0]=ft,pt[3]=ft;var At=at(dt,pt);return pt[4]+=ut.x-At.x,pt[5]+=ut.y-At.y,this.setViewportTransform(pt)},setZoom:function(dt){return this.zoomToPoint(new s.Point(0,0),dt),this},absolutePan:function(dt){var ft=this.viewportTransform.slice(0);return ft[4]=-dt.x,ft[5]=-dt.y,this.setViewportTransform(ft)},relativePan:function(dt){return this.absolutePan(new s.Point(-dt.x-this.viewportTransform[4],-dt.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(dt){this.stateful&&dt.setupState(),dt._set("canvas",this),dt.setCoords(),this.fire("object:added",{target:dt}),dt.fire("added")},_onObjectRemoved:function(dt){this.fire("object:removed",{target:dt}),dt.fire("removed"),delete dt.canvas},clearContext:function(dt){return dt.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var dt=this.contextContainer;return this.renderCanvas(dt,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=s.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var dt={},ft=this.width,ut=this.height,pt=lt(this.viewportTransform);return dt.tl=at({x:0,y:0},pt),dt.br=at({x:ft,y:ut},pt),dt.tr=new s.Point(dt.br.x,dt.tl.y),dt.bl=new s.Point(dt.tl.x,dt.br.y),this.vptCoords=dt,dt},cancelRequestedRender:function(){this.isRendering&&(s.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(dt,ft){var ut=this.viewportTransform,pt=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(dt),s.util.setImageSmoothing(dt,this.imageSmoothingEnabled),this.fire("before:render",{ctx:dt}),this._renderBackground(dt),dt.save(),dt.transform(ut[0],ut[1],ut[2],ut[3],ut[4],ut[5]),this._renderObjects(dt,ft),dt.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(dt),pt&&(pt.canvas=this,pt.shouldCache(),pt._transformDone=!0,pt.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(dt)),this._renderOverlay(dt),this.controlsAboveOverlay&&this.interactive&&this.drawControls(dt),this.fire("after:render",{ctx:dt})},drawClipPathOnCanvas:function(dt){var ft=this.viewportTransform,ut=this.clipPath;dt.save(),dt.transform(ft[0],ft[1],ft[2],ft[3],ft[4],ft[5]),dt.globalCompositeOperation="destination-in",ut.transform(dt),dt.scale(1/ut.zoomX,1/ut.zoomY),dt.drawImage(ut._cacheCanvas,-ut.cacheTranslationX,-ut.cacheTranslationY),dt.restore()},_renderObjects:function(dt,ft){var ut,pt;for(ut=0,pt=ft.length;ut<pt;++ut)ft[ut]&&ft[ut].render(dt)},_renderBackgroundOrOverlay:function(dt,ft){var ut=this[ft+"Color"],pt=this[ft+"Image"],At=this.viewportTransform,gt=this[ft+"Vpt"];if(!(!ut&&!pt)){if(ut){dt.save(),dt.beginPath(),dt.moveTo(0,0),dt.lineTo(this.width,0),dt.lineTo(this.width,this.height),dt.lineTo(0,this.height),dt.closePath(),dt.fillStyle=ut.toLive?ut.toLive(dt,this):ut,gt&&dt.transform(At[0],At[1],At[2],At[3],At[4],At[5]),dt.transform(1,0,0,1,ut.offsetX||0,ut.offsetY||0);var vt=ut.gradientTransform||ut.patternTransform;vt&&dt.transform(vt[0],vt[1],vt[2],vt[3],vt[4],vt[5]),dt.fill(),dt.restore()}pt&&(dt.save(),gt&&dt.transform(At[0],At[1],At[2],At[3],At[4],At[5]),pt.render(dt),dt.restore())}},_renderBackground:function(dt){this._renderBackgroundOrOverlay(dt,"background")},_renderOverlay:function(dt){this._renderBackgroundOrOverlay(dt,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},centerObjectH:function(dt){return this._centerObject(dt,new s.Point(this.getCenter().left,dt.getCenterPoint().y))},centerObjectV:function(dt){return this._centerObject(dt,new s.Point(dt.getCenterPoint().x,this.getCenter().top))},centerObject:function(dt){var ft=this.getCenter();return this._centerObject(dt,new s.Point(ft.left,ft.top))},viewportCenterObject:function(dt){var ft=this.getVpCenter();return this._centerObject(dt,ft)},viewportCenterObjectH:function(dt){var ft=this.getVpCenter();return this._centerObject(dt,new s.Point(ft.x,dt.getCenterPoint().y)),this},viewportCenterObjectV:function(dt){var ft=this.getVpCenter();return this._centerObject(dt,new s.Point(dt.getCenterPoint().x,ft.y))},getVpCenter:function(){var dt=this.getCenter(),ft=lt(this.viewportTransform);return at({x:dt.left,y:dt.top},ft)},_centerObject:function(dt,ft){return dt.setPositionByOrigin(ft,"center","center"),dt.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(dt){return this.toDatalessObject(dt)},toObject:function(dt){return this._toObjectMethod("toObject",dt)},toDatalessObject:function(dt){return this._toObjectMethod("toDatalessObject",dt)},_toObjectMethod:function(dt,ft){var ut=this.clipPath,pt={version:s.version,objects:this._toObjects(dt,ft)};return ut&&!ut.excludeFromExport&&(pt.clipPath=this._toObject(this.clipPath,dt,ft)),rt(pt,this.__serializeBgOverlay(dt,ft)),s.util.populateWithProperties(this,pt,ft),pt},_toObjects:function(dt,ft){return this._objects.filter(function(ut){return!ut.excludeFromExport}).map(function(ut){return this._toObject(ut,dt,ft)},this)},_toObject:function(dt,ft,ut){var pt;this.includeDefaultValues||(pt=dt.includeDefaultValues,dt.includeDefaultValues=!1);var At=dt[ft](ut);return this.includeDefaultValues||(dt.includeDefaultValues=pt),At},__serializeBgOverlay:function(dt,ft){var ut={},pt=this.backgroundImage,At=this.overlayImage,gt=this.backgroundColor,vt=this.overlayColor;return gt&&gt.toObject?gt.excludeFromExport||(ut.background=gt.toObject(ft)):gt&&(ut.background=gt),vt&&vt.toObject?vt.excludeFromExport||(ut.overlay=vt.toObject(ft)):vt&&(ut.overlay=vt),pt&&!pt.excludeFromExport&&(ut.backgroundImage=this._toObject(pt,dt,ft)),At&&!At.excludeFromExport&&(ut.overlayImage=this._toObject(At,dt,ft)),ut},svgViewportTransformation:!0,toSVG:function(dt,ft){dt||(dt={}),dt.reviver=ft;var ut=[];return this._setSVGPreamble(ut,dt),this._setSVGHeader(ut,dt),this.clipPath&&ut.push('<g clip-path="url(#'+this.clipPath.clipPathId+`)" >
`),this._setSVGBgOverlayColor(ut,"background"),this._setSVGBgOverlayImage(ut,"backgroundImage",ft),this._setSVGObjects(ut,ft),this.clipPath&&ut.push(`</g>
`),this._setSVGBgOverlayColor(ut,"overlay"),this._setSVGBgOverlayImage(ut,"overlayImage",ft),ut.push("</svg>"),ut.join("")},_setSVGPreamble:function(dt,ft){ft.suppressPreamble||dt.push('<?xml version="1.0" encoding="',ft.encoding||"UTF-8",`" standalone="no" ?>
`,'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ',`"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
`)},_setSVGHeader:function(dt,ft){var ut=ft.width||this.width,pt=ft.height||this.height,At,gt='viewBox="0 0 '+this.width+" "+this.height+'" ',vt=s.Object.NUM_FRACTION_DIGITS;ft.viewBox?gt='viewBox="'+ft.viewBox.x+" "+ft.viewBox.y+" "+ft.viewBox.width+" "+ft.viewBox.height+'" ':this.svgViewportTransformation&&(At=this.viewportTransform,gt='viewBox="'+st(-At[4]/At[0],vt)+" "+st(-At[5]/At[3],vt)+" "+st(this.width/At[0],vt)+" "+st(this.height/At[3],vt)+'" '),dt.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',ut,'" ','height="',pt,'" ',gt,`xml:space="preserve">
`,"<desc>Created with Fabric.js ",s.version,`</desc>
`,`<defs>
`,this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(ft),`</defs>
`)},createSVGClipPathMarkup:function(dt){var ft=this.clipPath;return ft?(ft.clipPathId="CLIPPATH_"+s.Object.__uid++,'<clipPath id="'+ft.clipPathId+`" >
`+this.clipPath.toClipPathSVG(dt.reviver)+`</clipPath>
`):""},createSVGRefElementsMarkup:function(){var dt=this,ft=["background","overlay"].map(function(ut){var pt=dt[ut+"Color"];if(pt&&pt.toLive){var At=dt[ut+"Vpt"],gt=dt.viewportTransform,vt={width:dt.width/(At?gt[0]:1),height:dt.height/(At?gt[3]:1)};return pt.toSVG(vt,{additionalTransform:At?s.util.matrixToSVG(gt):""})}});return ft.join("")},createSVGFontFacesMarkup:function(){var dt="",ft={},ut,pt,At,gt,vt,yt,bt,Ct,xt,It=s.fontPaths,St=[];for(this._objects.forEach(function Mt(jt){St.push(jt),jt._objects&&jt._objects.forEach(Mt)}),Ct=0,xt=St.length;Ct<xt;Ct++)if(ut=St[Ct],pt=ut.fontFamily,!(ut.type.indexOf("text")===-1||ft[pt]||!It[pt])&&(ft[pt]=!0,!!ut.styles)){At=ut.styles;for(vt in At){gt=At[vt];for(bt in gt)yt=gt[bt],pt=yt.fontFamily,!ft[pt]&&It[pt]&&(ft[pt]=!0)}}for(var Ot in ft)dt+=[`		@font-face {
`,"			font-family: '",Ot,`';
`,"			src: url('",It[Ot],`');
`,`		}
`].join("");return dt&&(dt=['	<style type="text/css">',`<![CDATA[
`,dt,"]]>",`</style>
`].join("")),dt},_setSVGObjects:function(dt,ft){var ut,pt,At,gt=this._objects;for(pt=0,At=gt.length;pt<At;pt++)ut=gt[pt],!ut.excludeFromExport&&this._setSVGObject(dt,ut,ft)},_setSVGObject:function(dt,ft,ut){dt.push(ft.toSVG(ut))},_setSVGBgOverlayImage:function(dt,ft,ut){this[ft]&&!this[ft].excludeFromExport&&this[ft].toSVG&&dt.push(this[ft].toSVG(ut))},_setSVGBgOverlayColor:function(dt,ft){var ut=this[ft+"Color"],pt=this.viewportTransform,At=this.width,gt=this.height;if(!!ut)if(ut.toLive){var vt=ut.repeat,yt=s.util.invertTransform(pt),bt=this[ft+"Vpt"],Ct=bt?s.util.matrixToSVG(yt):"";dt.push('<rect transform="'+Ct+" translate(",At/2,",",gt/2,')"',' x="',ut.offsetX-At/2,'" y="',ut.offsetY-gt/2,'" ','width="',vt==="repeat-y"||vt==="no-repeat"?ut.source.width:At,'" height="',vt==="repeat-x"||vt==="no-repeat"?ut.source.height:gt,'" fill="url(#SVGID_'+ut.id+')"',`></rect>
`)}else dt.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',ut,'"',`></rect>
`)},sendToBack:function(dt){if(!dt)return this;var ft=this._activeObject,ut,pt,At;if(dt===ft&&dt.type==="activeSelection")for(At=ft._objects,ut=At.length;ut--;)pt=At[ut],ot(this._objects,pt),this._objects.unshift(pt);else ot(this._objects,dt),this._objects.unshift(dt);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(dt){if(!dt)return this;var ft=this._activeObject,ut,pt,At;if(dt===ft&&dt.type==="activeSelection")for(At=ft._objects,ut=0;ut<At.length;ut++)pt=At[ut],ot(this._objects,pt),this._objects.push(pt);else ot(this._objects,dt),this._objects.push(dt);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(dt,ft){if(!dt)return this;var ut=this._activeObject,pt,At,gt,vt,yt,bt=0;if(dt===ut&&dt.type==="activeSelection")for(yt=ut._objects,pt=0;pt<yt.length;pt++)At=yt[pt],gt=this._objects.indexOf(At),gt>0+bt&&(vt=gt-1,ot(this._objects,At),this._objects.splice(vt,0,At)),bt++;else gt=this._objects.indexOf(dt),gt!==0&&(vt=this._findNewLowerIndex(dt,gt,ft),ot(this._objects,dt),this._objects.splice(vt,0,dt));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(dt,ft,ut){var pt,At;if(ut)for(pt=ft,At=ft-1;At>=0;--At){var gt=dt.intersectsWithObject(this._objects[At])||dt.isContainedWithinObject(this._objects[At])||this._objects[At].isContainedWithinObject(dt);if(gt){pt=At;break}}else pt=ft-1;return pt},bringForward:function(dt,ft){if(!dt)return this;var ut=this._activeObject,pt,At,gt,vt,yt,bt=0;if(dt===ut&&dt.type==="activeSelection")for(yt=ut._objects,pt=yt.length;pt--;)At=yt[pt],gt=this._objects.indexOf(At),gt<this._objects.length-1-bt&&(vt=gt+1,ot(this._objects,At),this._objects.splice(vt,0,At)),bt++;else gt=this._objects.indexOf(dt),gt!==this._objects.length-1&&(vt=this._findNewUpperIndex(dt,gt,ft),ot(this._objects,dt),this._objects.splice(vt,0,dt));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(dt,ft,ut){var pt,At,gt;if(ut)for(pt=ft,At=ft+1,gt=this._objects.length;At<gt;++At){var vt=dt.intersectsWithObject(this._objects[At])||dt.isContainedWithinObject(this._objects[At])||this._objects[At].isContainedWithinObject(dt);if(vt){pt=At;break}}else pt=ft+1;return pt},moveTo:function(dt,ft){return ot(this._objects,dt),this._objects.splice(ft,0,dt),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(s.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject(function(dt){dt.dispose&&dt.dispose()}),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove("lower-canvas"),this.lowerCanvasEl.style=this._originalCanvasStyle,delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),s.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),rt(s.StaticCanvas.prototype,s.Observable),rt(s.StaticCanvas.prototype,s.Collection),rt(s.StaticCanvas.prototype,s.DataURLExporter),rt(s.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(dt){var ft=ht();if(!ft||!ft.getContext)return null;var ut=ft.getContext("2d");if(!ut)return null;switch(dt){case"setLineDash":return typeof ut.setLineDash!="undefined";default:return null}}}),s.StaticCanvas.prototype.toJSON=s.StaticCanvas.prototype.toObject,s.isLikelyNode&&(s.StaticCanvas.prototype.createPNGStream=function(){var dt=ct(this.lowerCanvasEl);return dt&&dt.createPNGStream()},s.StaticCanvas.prototype.createJPEGStream=function(dt){var ft=ct(this.lowerCanvasEl);return ft&&ft.createJPEGStream(dt)})}(),s.BaseBrush=s.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(){var rt=this.canvas.contextTop;rt.strokeStyle=this.color,rt.lineWidth=this.width,rt.lineCap=this.strokeLineCap,rt.miterLimit=this.strokeMiterLimit,rt.lineJoin=this.strokeLineJoin,rt.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(rt){var nt=this.canvas.viewportTransform;rt.save(),rt.transform(nt[0],nt[1],nt[2],nt[3],nt[4],nt[5])},_setShadow:function(){if(!!this.shadow){var rt=this.canvas,nt=this.shadow,ot=rt.contextTop,st=rt.getZoom();rt&&rt._isRetinaScaling()&&(st*=s.devicePixelRatio),ot.shadowColor=nt.color,ot.shadowBlur=nt.blur*st,ot.shadowOffsetX=nt.offsetX*st,ot.shadowOffsetY=nt.offsetY*st}},needsFullRender:function(){var rt=new s.Color(this.color);return rt.getAlpha()<1||!!this.shadow},_resetShadow:function(){var rt=this.canvas.contextTop;rt.shadowColor="",rt.shadowBlur=rt.shadowOffsetX=rt.shadowOffsetY=0},_isOutSideCanvas:function(rt){return rt.x<0||rt.x>this.canvas.getWidth()||rt.y<0||rt.y>this.canvas.getHeight()}}),function(){s.PencilBrush=s.util.createClass(s.BaseBrush,{decimate:.4,initialize:function(rt){this.canvas=rt,this._points=[]},_drawSegment:function(rt,nt,ot){var st=nt.midPointFrom(ot);return rt.quadraticCurveTo(nt.x,nt.y,st.x,st.y),st},onMouseDown:function(rt,nt){!this.canvas._isMainEvent(nt.e)||(this._prepareForDrawing(rt),this._captureDrawingPath(rt),this._render())},onMouseMove:function(rt,nt){if(!!this.canvas._isMainEvent(nt.e)&&!(this.limitedToCanvasSize===!0&&this._isOutSideCanvas(rt))&&this._captureDrawingPath(rt)&&this._points.length>1)if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var ot=this._points,st=ot.length,at=this.canvas.contextTop;this._saveAndTransform(at),this.oldEnd&&(at.beginPath(),at.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(at,ot[st-2],ot[st-1],!0),at.stroke(),at.restore()}},onMouseUp:function(rt){return this.canvas._isMainEvent(rt.e)?(this.oldEnd=void 0,this._finalizeAndAddPath(),!1):!0},_prepareForDrawing:function(rt){var nt=new s.Point(rt.x,rt.y);this._reset(),this._addPoint(nt),this.canvas.contextTop.moveTo(nt.x,nt.y)},_addPoint:function(rt){return this._points.length>1&&rt.eq(this._points[this._points.length-1])?!1:(this._points.push(rt),!0)},_reset:function(){this._points=[],this._setBrushStyles(),this._setShadow()},_captureDrawingPath:function(rt){var nt=new s.Point(rt.x,rt.y);return this._addPoint(nt)},_render:function(){var rt=this.canvas.contextTop,nt,ot,st=this._points[0],at=this._points[1];if(this._saveAndTransform(rt),rt.beginPath(),this._points.length===2&&st.x===at.x&&st.y===at.y){var lt=this.width/1e3;st=new s.Point(st.x,st.y),at=new s.Point(at.x,at.y),st.x-=lt,at.x+=lt}for(rt.moveTo(st.x,st.y),nt=1,ot=this._points.length;nt<ot;nt++)this._drawSegment(rt,st,at),st=this._points[nt],at=this._points[nt+1];rt.lineTo(st.x,st.y),rt.stroke(),rt.restore()},convertPointsToSVGPath:function(rt){var nt=this.width/1e3;return s.util.getSmoothPathFromPoints(rt,nt)},_isEmptySVGPath:function(rt){var nt=s.util.joinPath(rt);return nt==="M 0 0 Q 0 0 0 0 L 0 0"},createPath:function(rt){var nt=new s.Path(rt,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,nt.shadow=new s.Shadow(this.shadow)),nt},decimatePoints:function(rt,nt){if(rt.length<=2)return rt;var ot=this.canvas.getZoom(),st=Math.pow(nt/ot,2),at,lt=rt.length-1,ct=rt[0],ht=[ct],mt;for(at=1;at<lt-1;at++)mt=Math.pow(ct.x-rt[at].x,2)+Math.pow(ct.y-rt[at].y,2),mt>=st&&(ct=rt[at],ht.push(ct));return ht.push(rt[lt]),ht},_finalizeAndAddPath:function(){var rt=this.canvas.contextTop;rt.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var nt=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(nt)){this.canvas.requestRenderAll();return}var ot=this.createPath(nt);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:ot}),this.canvas.add(ot),this.canvas.requestRenderAll(),ot.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:ot})}})}(),s.CircleBrush=s.util.createClass(s.BaseBrush,{width:10,initialize:function(rt){this.canvas=rt,this.points=[]},drawDot:function(rt){var nt=this.addPoint(rt),ot=this.canvas.contextTop;this._saveAndTransform(ot),this.dot(ot,nt),ot.restore()},dot:function(rt,nt){rt.fillStyle=nt.fill,rt.beginPath(),rt.arc(nt.x,nt.y,nt.radius,0,Math.PI*2,!1),rt.closePath(),rt.fill()},onMouseDown:function(rt){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(rt)},_render:function(){var rt=this.canvas.contextTop,nt,ot,st=this.points;for(this._saveAndTransform(rt),nt=0,ot=st.length;nt<ot;nt++)this.dot(rt,st[nt]);rt.restore()},onMouseMove:function(rt){this.limitedToCanvasSize===!0&&this._isOutSideCanvas(rt)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(rt),this._render()):this.drawDot(rt))},onMouseUp:function(){var rt=this.canvas.renderOnAddRemove,nt,ot;this.canvas.renderOnAddRemove=!1;var st=[];for(nt=0,ot=this.points.length;nt<ot;nt++){var at=this.points[nt],lt=new s.Circle({radius:at.radius,left:at.x,top:at.y,originX:"center",originY:"center",fill:at.fill});this.shadow&&(lt.shadow=new s.Shadow(this.shadow)),st.push(lt)}var ct=new s.Group(st);ct.canvas=this.canvas,this.canvas.fire("before:path:created",{path:ct}),this.canvas.add(ct),this.canvas.fire("path:created",{path:ct}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=rt,this.canvas.requestRenderAll()},addPoint:function(rt){var nt=new s.Point(rt.x,rt.y),ot=s.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,st=new s.Color(this.color).setAlpha(s.util.getRandomInt(0,100)/100).toRgba();return nt.radius=ot,nt.fill=st,this.points.push(nt),nt}}),s.SprayBrush=s.util.createClass(s.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(rt){this.canvas=rt,this.sprayChunks=[]},onMouseDown:function(rt){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(rt),this.render(this.sprayChunkPoints)},onMouseMove:function(rt){this.limitedToCanvasSize===!0&&this._isOutSideCanvas(rt)||(this.addSprayChunk(rt),this.render(this.sprayChunkPoints))},onMouseUp:function(){var rt=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var nt=[],ot=0,st=this.sprayChunks.length;ot<st;ot++)for(var at=this.sprayChunks[ot],lt=0,ct=at.length;lt<ct;lt++){var ht=new s.Rect({width:at[lt].width,height:at[lt].width,left:at[lt].x+1,top:at[lt].y+1,originX:"center",originY:"center",fill:this.color});nt.push(ht)}this.optimizeOverlapping&&(nt=this._getOptimizedRects(nt));var mt=new s.Group(nt);this.shadow&&mt.set("shadow",new s.Shadow(this.shadow)),this.canvas.fire("before:path:created",{path:mt}),this.canvas.add(mt),this.canvas.fire("path:created",{path:mt}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=rt,this.canvas.requestRenderAll()},_getOptimizedRects:function(rt){var nt={},ot,st,at;for(st=0,at=rt.length;st<at;st++)ot=rt[st].left+""+rt[st].top,nt[ot]||(nt[ot]=rt[st]);var lt=[];for(ot in nt)lt.push(nt[ot]);return lt},render:function(rt){var nt=this.canvas.contextTop,ot,st;for(nt.fillStyle=this.color,this._saveAndTransform(nt),ot=0,st=rt.length;ot<st;ot++){var at=rt[ot];typeof at.opacity!="undefined"&&(nt.globalAlpha=at.opacity),nt.fillRect(at.x,at.y,at.width,at.width)}nt.restore()},_render:function(){var rt=this.canvas.contextTop,nt,ot;for(rt.fillStyle=this.color,this._saveAndTransform(rt),nt=0,ot=this.sprayChunks.length;nt<ot;nt++)this.render(this.sprayChunks[nt]);rt.restore()},addSprayChunk:function(rt){this.sprayChunkPoints=[];var nt,ot,st,at=this.width/2,lt;for(lt=0;lt<this.density;lt++){nt=s.util.getRandomInt(rt.x-at,rt.x+at),ot=s.util.getRandomInt(rt.y-at,rt.y+at),this.dotWidthVariance?st=s.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):st=this.dotWidth;var ct=new s.Point(nt,ot);ct.width=st,this.randomOpacity&&(ct.opacity=s.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(ct)}this.sprayChunks.push(this.sprayChunkPoints)}}),s.PatternBrush=s.util.createClass(s.PencilBrush,{getPatternSrc:function(){var rt=20,nt=5,ot=s.util.createCanvasElement(),st=ot.getContext("2d");return ot.width=ot.height=rt+nt,st.fillStyle=this.color,st.beginPath(),st.arc(rt/2,rt/2,rt/2,0,Math.PI*2,!1),st.closePath(),st.fill(),ot},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(){return this.canvas.contextTop.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(){this.callSuper("_setBrushStyles"),this.canvas.contextTop.strokeStyle=this.getPattern()},createPath:function(rt){var nt=this.callSuper("createPath",rt),ot=nt._getLeftTopCoords().scalarAdd(nt.strokeWidth/2);return nt.stroke=new s.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-ot.x,offsetY:-ot.y}),nt}}),function(){var rt=s.util.getPointer,nt=s.util.degreesToRadians,ot=s.util.isTouchEvent;s.Canvas=s.util.createClass(s.StaticCanvas,{initialize:function(at,lt){lt||(lt={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(at,lt),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",rotationCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=s.PencilBrush&&new s.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var at=this.getActiveObjects(),lt,ct,ht;if(at.length>0&&!this.preserveObjectStacking){ct=[],ht=[];for(var mt=0,dt=this._objects.length;mt<dt;mt++)lt=this._objects[mt],at.indexOf(lt)===-1?ct.push(lt):ht.push(lt);at.length>1&&(this._activeObject._objects=ht),ct.push.apply(ct,ht)}else ct=this._objects;return ct},renderAll:function(){this.contextTopDirty&&!this._groupSelector&&!this.isDrawingMode&&(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&this.renderTopLayer(this.contextTop);var at=this.contextContainer;return this.renderCanvas(at,this._chooseObjectsToRender()),this},renderTopLayer:function(at){at.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(at),this.contextTopDirty=!0),at.restore()},renderTop:function(){var at=this.contextTop;return this.clearContext(at),this.renderTopLayer(at),this.fire("after:render"),this},_normalizePointer:function(at,lt){var ct=at.calcTransformMatrix(),ht=s.util.invertTransform(ct),mt=this.restorePointerVpt(lt);return s.util.transformPoint(mt,ht)},isTargetTransparent:function(at,lt,ct){if(at.shouldCache()&&at._cacheCanvas&&at!==this._activeObject){var ht=this._normalizePointer(at,{x:lt,y:ct}),mt=Math.max(at.cacheTranslationX+ht.x*at.zoomX,0),dt=Math.max(at.cacheTranslationY+ht.y*at.zoomY,0),At=s.util.isTransparent(at._cacheContext,Math.round(mt),Math.round(dt),this.targetFindTolerance);return At}var ft=this.contextCache,ut=at.selectionBackgroundColor,pt=this.viewportTransform;at.selectionBackgroundColor="",this.clearContext(ft),ft.save(),ft.transform(pt[0],pt[1],pt[2],pt[3],pt[4],pt[5]),at.render(ft),ft.restore(),at.selectionBackgroundColor=ut;var At=s.util.isTransparent(ft,lt,ct,this.targetFindTolerance);return At},_isSelectionKeyPressed:function(at){var lt=!1;return Object.prototype.toString.call(this.selectionKey)==="[object Array]"?lt=!!this.selectionKey.find(function(ct){return at[ct]===!0}):lt=at[this.selectionKey],lt},_shouldClearSelection:function(at,lt){var ct=this.getActiveObjects(),ht=this._activeObject;return!lt||lt&&ht&&ct.length>1&&ct.indexOf(lt)===-1&&ht!==lt&&!this._isSelectionKeyPressed(at)||lt&&!lt.evented||lt&&!lt.selectable&&ht&&ht!==lt},_shouldCenterTransform:function(at,lt,ct){if(!!at){var ht;return lt==="scale"||lt==="scaleX"||lt==="scaleY"||lt==="resizing"?ht=this.centeredScaling||at.centeredScaling:lt==="rotate"&&(ht=this.centeredRotation||at.centeredRotation),ht?!ct:ct}},_getOriginFromCorner:function(at,lt){var ct={x:at.originX,y:at.originY};return lt==="ml"||lt==="tl"||lt==="bl"?ct.x="right":(lt==="mr"||lt==="tr"||lt==="br")&&(ct.x="left"),lt==="tl"||lt==="mt"||lt==="tr"?ct.y="bottom":(lt==="bl"||lt==="mb"||lt==="br")&&(ct.y="top"),ct},_getActionFromCorner:function(at,lt,ct,ht){if(!lt||!at)return"drag";var mt=ht.controls[lt];return mt.getActionName(ct,mt,ht)},_setupCurrentTransform:function(at,lt,ct){if(!!lt){var ht=this.getPointer(at),mt=lt.__corner,dt=lt.controls[mt],ft=ct&&mt?dt.getActionHandler(at,lt,dt):s.controlsUtils.dragHandler,ut=this._getActionFromCorner(ct,mt,at,lt),pt=this._getOriginFromCorner(lt,mt),At=at[this.centeredKey],gt={target:lt,action:ut,actionHandler:ft,corner:mt,scaleX:lt.scaleX,scaleY:lt.scaleY,skewX:lt.skewX,skewY:lt.skewY,offsetX:ht.x-lt.left,offsetY:ht.y-lt.top,originX:pt.x,originY:pt.y,ex:ht.x,ey:ht.y,lastX:ht.x,lastY:ht.y,theta:nt(lt.angle),width:lt.width*lt.scaleX,shiftKey:at.shiftKey,altKey:At,original:s.util.saveObjectTransform(lt)};this._shouldCenterTransform(lt,ut,At)&&(gt.originX="center",gt.originY="center"),gt.original.originX=pt.x,gt.original.originY=pt.y,this._currentTransform=gt,this._beforeTransform(at)}},setCursor:function(at){this.upperCanvasEl.style.cursor=at},_drawSelection:function(at){var lt=this._groupSelector,ct=new s.Point(lt.ex,lt.ey),ht=s.util.transformPoint(ct,this.viewportTransform),mt=new s.Point(lt.ex+lt.left,lt.ey+lt.top),dt=s.util.transformPoint(mt,this.viewportTransform),ft=Math.min(ht.x,dt.x),ut=Math.min(ht.y,dt.y),pt=Math.max(ht.x,dt.x),At=Math.max(ht.y,dt.y),gt=this.selectionLineWidth/2;this.selectionColor&&(at.fillStyle=this.selectionColor,at.fillRect(ft,ut,pt-ft,At-ut)),!(!this.selectionLineWidth||!this.selectionBorderColor)&&(at.lineWidth=this.selectionLineWidth,at.strokeStyle=this.selectionBorderColor,ft+=gt,ut+=gt,pt-=gt,At-=gt,s.Object.prototype._setLineDash.call(this,at,this.selectionDashArray),at.strokeRect(ft,ut,pt-ft,At-ut))},findTarget:function(at,lt){if(!this.skipTargetFind){var ct=!0,ht=this.getPointer(at,ct),mt=this._activeObject,dt=this.getActiveObjects(),ft,ut,pt=ot(at),At=dt.length>1&&!lt||dt.length===1;if(this.targets=[],At&&mt._findTargetCorner(ht,pt)||dt.length>1&&!lt&&mt===this._searchPossibleTargets([mt],ht))return mt;if(dt.length===1&&mt===this._searchPossibleTargets([mt],ht))if(this.preserveObjectStacking)ft=mt,ut=this.targets,this.targets=[];else return mt;var gt=this._searchPossibleTargets(this._objects,ht);return at[this.altSelectionKey]&&gt&&ft&&gt!==ft&&(gt=ft,this.targets=ut),gt}},_checkTarget:function(at,lt,ct){if(lt&&lt.visible&&lt.evented&&lt.containsPoint(at))if((this.perPixelTargetFind||lt.perPixelTargetFind)&&!lt.isEditing){var ht=this.isTargetTransparent(lt,ct.x,ct.y);if(!ht)return!0}else return!0},_searchPossibleTargets:function(at,lt){for(var ct,ht=at.length,mt;ht--;){var dt=at[ht],ft=dt.group?this._normalizePointer(dt.group,lt):lt;if(this._checkTarget(ft,dt,lt)){ct=at[ht],ct.subTargetCheck&&ct instanceof s.Group&&(mt=this._searchPossibleTargets(ct._objects,lt),mt&&this.targets.push(mt));break}}return ct},restorePointerVpt:function(at){return s.util.transformPoint(at,s.util.invertTransform(this.viewportTransform))},getPointer:function(at,lt){if(this._absolutePointer&&!lt)return this._absolutePointer;if(this._pointer&&lt)return this._pointer;var ct=rt(at),ht=this.upperCanvasEl,mt=ht.getBoundingClientRect(),dt=mt.width||0,ft=mt.height||0,ut;(!dt||!ft)&&("top"in mt&&"bottom"in mt&&(ft=Math.abs(mt.top-mt.bottom)),"right"in mt&&"left"in mt&&(dt=Math.abs(mt.right-mt.left))),this.calcOffset(),ct.x=ct.x-this._offset.left,ct.y=ct.y-this._offset.top,lt||(ct=this.restorePointerVpt(ct));var pt=this.getRetinaScaling();return pt!==1&&(ct.x/=pt,ct.y/=pt),dt===0||ft===0?ut={width:1,height:1}:ut={width:ht.width/dt,height:ht.height/ft},{x:ct.x*ut.width,y:ct.y*ut.height}},_createUpperCanvas:function(){var at=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),lt=this.lowerCanvasEl,ct=this.upperCanvasEl;ct?ct.className="":(ct=this._createCanvasElement(),this.upperCanvasEl=ct),s.util.addClass(ct,"upper-canvas "+at),this.wrapperEl.appendChild(ct),this._copyCanvasStyle(lt,ct),this._applyCanvasStyle(ct),this.contextTop=ct.getContext("2d")},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=s.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),s.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),s.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(at){var lt=this.width||at.width,ct=this.height||at.height;s.util.setStyle(at,{position:"absolute",width:lt+"px",height:ct+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),at.width=lt,at.height=ct,s.util.makeElementUnselectable(at)},_copyCanvasStyle:function(at,lt){lt.style.cssText=at.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var at=this._activeObject;return at?at.type==="activeSelection"&&at._objects?at._objects.slice(0):[at]:[]},_onObjectRemoved:function(at){at===this._activeObject&&(this.fire("before:selection:cleared",{target:at}),this._discardActiveObject(),this.fire("selection:cleared",{target:at}),at.fire("deselected")),at===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",at)},_fireSelectionEvents:function(at,lt){var ct=!1,ht=this.getActiveObjects(),mt=[],dt=[];at.forEach(function(ft){ht.indexOf(ft)===-1&&(ct=!0,ft.fire("deselected",{e:lt,target:ft}),dt.push(ft))}),ht.forEach(function(ft){at.indexOf(ft)===-1&&(ct=!0,ft.fire("selected",{e:lt,target:ft}),mt.push(ft))}),at.length>0&&ht.length>0?ct&&this.fire("selection:updated",{e:lt,selected:mt,deselected:dt,updated:mt[0]||dt[0],target:this._activeObject}):ht.length>0?this.fire("selection:created",{e:lt,selected:mt,target:this._activeObject}):at.length>0&&this.fire("selection:cleared",{e:lt,deselected:dt})},setActiveObject:function(at,lt){var ct=this.getActiveObjects();return this._setActiveObject(at,lt),this._fireSelectionEvents(ct,lt),this},_setActiveObject:function(at,lt){return this._activeObject===at||!this._discardActiveObject(lt,at)||at.onSelect({e:lt})?!1:(this._activeObject=at,!0)},_discardActiveObject:function(at,lt){var ct=this._activeObject;if(ct){if(ct.onDeselect({e:at,object:lt}))return!1;this._activeObject=null}return!0},discardActiveObject:function(at){var lt=this.getActiveObjects(),ct=this.getActiveObject();return lt.length&&this.fire("before:selection:cleared",{target:ct,e:at}),this._discardActiveObject(at),this._fireSelectionEvents(lt,at),this},dispose:function(){var at=this.wrapperEl;return this.removeListeners(),at.removeChild(this.upperCanvasEl),at.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(lt){s.util.cleanUpJsdomNode(this[lt]),this[lt]=void 0}.bind(this)),at.parentNode&&at.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,s.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(at){var lt=this._activeObject;lt&&lt._renderControls(at)},_toObject:function(at,lt,ct){var ht=this._realizeGroupTransformOnObject(at),mt=this.callSuper("_toObject",at,lt,ct);return this._unwindGroupTransformOnObject(at,ht),mt},_realizeGroupTransformOnObject:function(at){if(at.group&&at.group.type==="activeSelection"&&this._activeObject===at.group){var lt=["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"],ct={};return lt.forEach(function(ht){ct[ht]=at[ht]}),s.util.addTransformToObject(at,this._activeObject.calcOwnMatrix()),ct}else return null},_unwindGroupTransformOnObject:function(at,lt){lt&&at.set(lt)},_setSVGObject:function(at,lt,ct){var ht=this._realizeGroupTransformOnObject(lt);this.callSuper("_setSVGObject",at,lt,ct),this._unwindGroupTransformOnObject(lt,ht)},setViewportTransform:function(at){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),s.StaticCanvas.prototype.setViewportTransform.call(this,at)}});for(var st in s.StaticCanvas)st!=="prototype"&&(s.Canvas[st]=s.StaticCanvas[st])}(),function(){var rt=s.util.addListener,nt=s.util.removeListener,ot=3,st=2,at=1,lt={passive:!1};function ct(ht,mt){return ht.button&&ht.button===mt-1}s.util.object.extend(s.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(rt,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(ht,mt){var dt=this.upperCanvasEl,ft=this._getEventPrefix();ht(s.window,"resize",this._onResize),ht(dt,ft+"down",this._onMouseDown),ht(dt,ft+"move",this._onMouseMove,lt),ht(dt,ft+"out",this._onMouseOut),ht(dt,ft+"enter",this._onMouseEnter),ht(dt,"wheel",this._onMouseWheel),ht(dt,"contextmenu",this._onContextMenu),ht(dt,"dblclick",this._onDoubleClick),ht(dt,"dragover",this._onDragOver),ht(dt,"dragenter",this._onDragEnter),ht(dt,"dragleave",this._onDragLeave),ht(dt,"drop",this._onDrop),this.enablePointerEvents||ht(dt,"touchstart",this._onTouchStart,lt),typeof eventjs!="undefined"&&mt in eventjs&&(eventjs[mt](dt,"gesture",this._onGesture),eventjs[mt](dt,"drag",this._onDrag),eventjs[mt](dt,"orientation",this._onOrientationChange),eventjs[mt](dt,"shake",this._onShake),eventjs[mt](dt,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(nt,"remove");var ht=this._getEventPrefix();nt(s.document,ht+"up",this._onMouseUp),nt(s.document,"touchend",this._onTouchEnd,lt),nt(s.document,ht+"move",this._onMouseMove,lt),nt(s.document,"touchmove",this._onMouseMove,lt)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._simpleEventHandler.bind(this,"drop"),this.eventsBound=!0)},_onGesture:function(ht,mt){this.__onTransformGesture&&this.__onTransformGesture(ht,mt)},_onDrag:function(ht,mt){this.__onDrag&&this.__onDrag(ht,mt)},_onMouseWheel:function(ht){this.__onMouseWheel(ht)},_onMouseOut:function(ht){var mt=this._hoveredTarget;this.fire("mouse:out",{target:mt,e:ht}),this._hoveredTarget=null,mt&&mt.fire("mouseout",{e:ht});var dt=this;this._hoveredTargets.forEach(function(ft){dt.fire("mouse:out",{target:mt,e:ht}),ft&&mt.fire("mouseout",{e:ht})}),this._hoveredTargets=[],this._iTextInstances&&this._iTextInstances.forEach(function(ft){ft.isEditing&&ft.hiddenTextarea.focus()})},_onMouseEnter:function(ht){!this._currentTransform&&!this.findTarget(ht)&&(this.fire("mouse:over",{target:null,e:ht}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(ht,mt){this.__onOrientationChange&&this.__onOrientationChange(ht,mt)},_onShake:function(ht,mt){this.__onShake&&this.__onShake(ht,mt)},_onLongPress:function(ht,mt){this.__onLongPress&&this.__onLongPress(ht,mt)},_onDragOver:function(ht){ht.preventDefault();var mt=this._simpleEventHandler("dragover",ht);this._fireEnterLeaveEvents(mt,ht)},_onContextMenu:function(ht){return this.stopContextMenu&&(ht.stopPropagation(),ht.preventDefault()),!1},_onDoubleClick:function(ht){this._cacheTransformEventData(ht),this._handleEvent(ht,"dblclick"),this._resetTransformEventData(ht)},getPointerId:function(ht){var mt=ht.changedTouches;return mt?mt[0]&&mt[0].identifier:this.enablePointerEvents?ht.pointerId:-1},_isMainEvent:function(ht){return ht.isPrimary===!0?!0:ht.isPrimary===!1?!1:ht.type==="touchend"&&ht.touches.length===0?!0:ht.changedTouches?ht.changedTouches[0].identifier===this.mainTouchId:!0},_onTouchStart:function(ht){ht.preventDefault(),this.mainTouchId===null&&(this.mainTouchId=this.getPointerId(ht)),this.__onMouseDown(ht),this._resetTransformEventData();var mt=this.upperCanvasEl,dt=this._getEventPrefix();rt(s.document,"touchend",this._onTouchEnd,lt),rt(s.document,"touchmove",this._onMouseMove,lt),nt(mt,dt+"down",this._onMouseDown)},_onMouseDown:function(ht){this.__onMouseDown(ht),this._resetTransformEventData();var mt=this.upperCanvasEl,dt=this._getEventPrefix();nt(mt,dt+"move",this._onMouseMove,lt),rt(s.document,dt+"up",this._onMouseUp),rt(s.document,dt+"move",this._onMouseMove,lt)},_onTouchEnd:function(ht){if(!(ht.touches.length>0)){this.__onMouseUp(ht),this._resetTransformEventData(),this.mainTouchId=null;var mt=this._getEventPrefix();nt(s.document,"touchend",this._onTouchEnd,lt),nt(s.document,"touchmove",this._onMouseMove,lt);var dt=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(function(){rt(dt.upperCanvasEl,mt+"down",dt._onMouseDown),dt._willAddMouseDown=0},400)}},_onMouseUp:function(ht){this.__onMouseUp(ht),this._resetTransformEventData();var mt=this.upperCanvasEl,dt=this._getEventPrefix();this._isMainEvent(ht)&&(nt(s.document,dt+"up",this._onMouseUp),nt(s.document,dt+"move",this._onMouseMove,lt),rt(mt,dt+"move",this._onMouseMove,lt))},_onMouseMove:function(ht){!this.allowTouchScrolling&&ht.preventDefault&&ht.preventDefault(),this.__onMouseMove(ht)},_onResize:function(){this.calcOffset()},_shouldRender:function(ht){var mt=this._activeObject;return!!mt!=!!ht||mt&&ht&&mt!==ht?!0:(mt&&mt.isEditing,!1)},__onMouseUp:function(ht){var mt,dt=this._currentTransform,ft=this._groupSelector,ut=!1,pt=!ft||ft.left===0&&ft.top===0;if(this._cacheTransformEventData(ht),mt=this._target,this._handleEvent(ht,"up:before"),ct(ht,ot)){this.fireRightClick&&this._handleEvent(ht,"up",ot,pt);return}if(ct(ht,st)){this.fireMiddleClick&&this._handleEvent(ht,"up",st,pt),this._resetTransformEventData();return}if(this.isDrawingMode&&this._isCurrentlyDrawing){this._onMouseUpInDrawingMode(ht);return}if(!!this._isMainEvent(ht)){if(dt&&(this._finalizeCurrentTransform(ht),ut=dt.actionPerformed),!pt){var At=mt===this._activeObject;this._maybeGroupObjects(ht),ut||(ut=this._shouldRender(mt)||!At&&mt===this._activeObject)}if(mt){if(mt.selectable&&mt!==this._activeObject&&mt.activeOn==="up")this.setActiveObject(mt,ht),ut=!0;else{var gt=mt._findTargetCorner(this.getPointer(ht,!0),s.util.isTouchEvent(ht)),vt=mt.controls[gt],yt=vt&&vt.getMouseUpHandler(ht,mt,vt);if(yt){var bt=this.getPointer(ht);yt(ht,dt,bt.x,bt.y)}}mt.isMoving=!1}this._setCursorFromEvent(ht,mt),this._handleEvent(ht,"up",at,pt),this._groupSelector=null,this._currentTransform=null,mt&&(mt.__corner=0),ut?this.requestRenderAll():pt||this.renderTop()}},_simpleEventHandler:function(ht,mt){var dt=this.findTarget(mt),ft=this.targets,ut={e:mt,target:dt,subTargets:ft};if(this.fire(ht,ut),dt&&dt.fire(ht,ut),!ft)return dt;for(var pt=0;pt<ft.length;pt++)ft[pt].fire(ht,ut);return dt},_handleEvent:function(ht,mt,dt,ft){var ut=this._target,pt=this.targets||[],At={e:ht,target:ut,subTargets:pt,button:dt||at,isClick:ft||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};mt==="up"&&(At.currentTarget=this.findTarget(ht),At.currentSubTargets=this.targets),this.fire("mouse:"+mt,At),ut&&ut.fire("mouse"+mt,At);for(var gt=0;gt<pt.length;gt++)pt[gt].fire("mouse"+mt,At)},_finalizeCurrentTransform:function(ht){var mt=this._currentTransform,dt=mt.target,ft,ut={e:ht,target:dt,transform:mt,action:mt.action};dt._scaling&&(dt._scaling=!1),dt.setCoords(),(mt.actionPerformed||this.stateful&&dt.hasStateChanged())&&(mt.actionPerformed&&(ft=this._addEventOptions(ut,mt),this._fire(ft,ut)),this._fire("modified",ut))},_addEventOptions:function(ht,mt){var dt,ft;switch(mt.action){case"scaleX":dt="scaled",ft="x";break;case"scaleY":dt="scaled",ft="y";break;case"skewX":dt="skewed",ft="x";break;case"skewY":dt="skewed",ft="y";break;case"scale":dt="scaled",ft="equally";break;case"rotate":dt="rotated";break;case"drag":dt="moved";break}return ht.by=ft,dt},_onMouseDownInDrawingMode:function(ht){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(ht).requestRenderAll();var mt=this.getPointer(ht);this.freeDrawingBrush.onMouseDown(mt,{e:ht,pointer:mt}),this._handleEvent(ht,"down")},_onMouseMoveInDrawingMode:function(ht){if(this._isCurrentlyDrawing){var mt=this.getPointer(ht);this.freeDrawingBrush.onMouseMove(mt,{e:ht,pointer:mt})}this.setCursor(this.freeDrawingCursor),this._handleEvent(ht,"move")},_onMouseUpInDrawingMode:function(ht){var mt=this.getPointer(ht);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:ht,pointer:mt}),this._handleEvent(ht,"up")},__onMouseDown:function(ht){this._cacheTransformEventData(ht),this._handleEvent(ht,"down:before");var mt=this._target;if(ct(ht,ot)){this.fireRightClick&&this._handleEvent(ht,"down",ot);return}if(ct(ht,st)){this.fireMiddleClick&&this._handleEvent(ht,"down",st);return}if(this.isDrawingMode){this._onMouseDownInDrawingMode(ht);return}if(!!this._isMainEvent(ht)&&!this._currentTransform){var dt=this._pointer;this._previousPointer=dt;var ft=this._shouldRender(mt),ut=this._shouldGroup(ht,mt);if(this._shouldClearSelection(ht,mt)?this.discardActiveObject(ht):ut&&(this._handleGrouping(ht,mt),mt=this._activeObject),this.selection&&(!mt||!mt.selectable&&!mt.isEditing&&mt!==this._activeObject)&&(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),mt){var pt=mt===this._activeObject;mt.selectable&&mt.activeOn==="down"&&this.setActiveObject(mt,ht);var At=mt._findTargetCorner(this.getPointer(ht,!0),s.util.isTouchEvent(ht));if(mt.__corner=At,mt===this._activeObject&&(At||!ut)){this._setupCurrentTransform(ht,mt,pt);var gt=mt.controls[At],dt=this.getPointer(ht),vt=gt&&gt.getMouseDownHandler(ht,mt,gt);vt&&vt(ht,this._currentTransform,dt.x,dt.y)}}this._handleEvent(ht,"down"),(ft||ut)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(ht){this._resetTransformEventData(),this._pointer=this.getPointer(ht,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(ht)||null},_beforeTransform:function(ht){var mt=this._currentTransform;this.stateful&&mt.target.saveState(),this.fire("before:transform",{e:ht,transform:mt})},__onMouseMove:function(ht){this._handleEvent(ht,"move:before"),this._cacheTransformEventData(ht);var mt,dt;if(this.isDrawingMode){this._onMouseMoveInDrawingMode(ht);return}if(!!this._isMainEvent(ht)){var ft=this._groupSelector;ft?(dt=this._absolutePointer,ft.left=dt.x-ft.ex,ft.top=dt.y-ft.ey,this.renderTop()):this._currentTransform?this._transformObject(ht):(mt=this.findTarget(ht)||null,this._setCursorFromEvent(ht,mt),this._fireOverOutEvents(mt,ht)),this._handleEvent(ht,"move"),this._resetTransformEventData()}},_fireOverOutEvents:function(ht,mt){var dt=this._hoveredTarget,ft=this._hoveredTargets,ut=this.targets,pt=Math.max(ft.length,ut.length);this.fireSyntheticInOutEvents(ht,mt,{oldTarget:dt,evtOut:"mouseout",canvasEvtOut:"mouse:out",evtIn:"mouseover",canvasEvtIn:"mouse:over"});for(var At=0;At<pt;At++)this.fireSyntheticInOutEvents(ut[At],mt,{oldTarget:ft[At],evtOut:"mouseout",evtIn:"mouseover"});this._hoveredTarget=ht,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(ht,mt){var dt=this._draggedoverTarget,ft=this._hoveredTargets,ut=this.targets,pt=Math.max(ft.length,ut.length);this.fireSyntheticInOutEvents(ht,mt,{oldTarget:dt,evtOut:"dragleave",evtIn:"dragenter"});for(var At=0;At<pt;At++)this.fireSyntheticInOutEvents(ut[At],mt,{oldTarget:ft[At],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=ht},fireSyntheticInOutEvents:function(ht,mt,dt){var ft,ut,pt=dt.oldTarget,At,gt,vt=pt!==ht,yt=dt.canvasEvtIn,bt=dt.canvasEvtOut;vt&&(ft={e:mt,target:ht,previousTarget:pt},ut={e:mt,target:pt,nextTarget:ht}),gt=ht&&vt,At=pt&&vt,At&&(bt&&this.fire(bt,ut),pt.fire(dt.evtOut,ut)),gt&&(yt&&this.fire(yt,ft),ht.fire(dt.evtIn,ft))},__onMouseWheel:function(ht){this._cacheTransformEventData(ht),this._handleEvent(ht,"wheel"),this._resetTransformEventData()},_transformObject:function(ht){var mt=this.getPointer(ht),dt=this._currentTransform;dt.reset=!1,dt.shiftKey=ht.shiftKey,dt.altKey=ht[this.centeredKey],this._performTransformAction(ht,dt,mt),dt.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(ht,mt,dt){var ft=dt.x,ut=dt.y,pt=mt.action,At=!1,gt=mt.actionHandler;gt&&(At=gt(ht,mt,ft,ut)),pt==="drag"&&At&&(mt.target.isMoving=!0,this.setCursor(mt.target.moveCursor||this.moveCursor)),mt.actionPerformed=mt.actionPerformed||At},_fire:s.controlsUtils.fireEvent,_setCursorFromEvent:function(ht,mt){if(!mt)return this.setCursor(this.defaultCursor),!1;var dt=mt.hoverCursor||this.hoverCursor,ft=this._activeObject&&this._activeObject.type==="activeSelection"?this._activeObject:null,ut=(!ft||!ft.contains(mt))&&mt._findTargetCorner(this.getPointer(ht,!0));ut?this.setCursor(this.getCornerCursor(ut,mt,ht)):(mt.subTargetCheck&&this.targets.concat().reverse().map(function(pt){dt=pt.hoverCursor||dt}),this.setCursor(dt))},getCornerCursor:function(ht,mt,dt){var ft=mt.controls[ht];return ft.cursorStyleHandler(dt,ft,mt)}})}(),function(){var rt=Math.min,nt=Math.max;s.util.object.extend(s.Canvas.prototype,{_shouldGroup:function(ot,st){var at=this._activeObject;return at&&this._isSelectionKeyPressed(ot)&&st&&st.selectable&&this.selection&&(at!==st||at.type==="activeSelection")&&!st.onSelect({e:ot})},_handleGrouping:function(ot,st){var at=this._activeObject;at.__corner||st===at&&(st=this.findTarget(ot,!0),!st||!st.selectable)||(at&&at.type==="activeSelection"?this._updateActiveSelection(st,ot):this._createActiveSelection(st,ot))},_updateActiveSelection:function(ot,st){var at=this._activeObject,lt=at._objects.slice(0);at.contains(ot)?(at.removeWithUpdate(ot),this._hoveredTarget=ot,this._hoveredTargets=this.targets.concat(),at.size()===1&&this._setActiveObject(at.item(0),st)):(at.addWithUpdate(ot),this._hoveredTarget=at,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(lt,st)},_createActiveSelection:function(ot,st){var at=this.getActiveObjects(),lt=this._createGroup(ot);this._hoveredTarget=lt,this._setActiveObject(lt,st),this._fireSelectionEvents(at,st)},_createGroup:function(ot){var st=this._objects,at=st.indexOf(this._activeObject)<st.indexOf(ot),lt=at?[this._activeObject,ot]:[ot,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new s.ActiveSelection(lt,{canvas:this})},_groupSelectedObjects:function(ot){var st=this._collectObjects(ot),at;st.length===1?this.setActiveObject(st[0],ot):st.length>1&&(at=new s.ActiveSelection(st.reverse(),{canvas:this}),this.setActiveObject(at,ot))},_collectObjects:function(ot){for(var st=[],at,lt=this._groupSelector.ex,ct=this._groupSelector.ey,ht=lt+this._groupSelector.left,mt=ct+this._groupSelector.top,dt=new s.Point(rt(lt,ht),rt(ct,mt)),ft=new s.Point(nt(lt,ht),nt(ct,mt)),ut=!this.selectionFullyContained,pt=lt===ht&&ct===mt,At=this._objects.length;At--&&(at=this._objects[At],!(!(!at||!at.selectable||!at.visible)&&(ut&&at.intersectsWithRect(dt,ft,!0)||at.isContainedWithinRect(dt,ft,!0)||ut&&at.containsPoint(dt,null,!0)||ut&&at.containsPoint(ft,null,!0))&&(st.push(at),pt))););return st.length>1&&(st=st.filter(function(gt){return!gt.onSelect({e:ot})})),st},_maybeGroupObjects:function(ot){this.selection&&this._groupSelector&&this._groupSelectedObjects(ot),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),function(){s.util.object.extend(s.StaticCanvas.prototype,{toDataURL:function(rt){rt||(rt={});var nt=rt.format||"png",ot=rt.quality||1,st=(rt.multiplier||1)*(rt.enableRetinaScaling?this.getRetinaScaling():1),at=this.toCanvasElement(st,rt);return s.util.toDataURL(at,nt,ot)},toCanvasElement:function(rt,nt){rt=rt||1,nt=nt||{};var ot=(nt.width||this.width)*rt,st=(nt.height||this.height)*rt,at=this.getZoom(),lt=this.width,ct=this.height,ht=at*rt,mt=this.viewportTransform,dt=(mt[4]-(nt.left||0))*rt,ft=(mt[5]-(nt.top||0))*rt,ut=this.interactive,pt=[ht,0,0,ht,dt,ft],At=this.enableRetinaScaling,gt=s.util.createCanvasElement(),vt=this.contextTop;return gt.width=ot,gt.height=st,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=pt,this.width=ot,this.height=st,this.calcViewportBoundaries(),this.renderCanvas(gt.getContext("2d"),this._objects),this.viewportTransform=mt,this.width=lt,this.height=ct,this.calcViewportBoundaries(),this.interactive=ut,this.enableRetinaScaling=At,this.contextTop=vt,gt}})}(),s.util.object.extend(s.StaticCanvas.prototype,{loadFromJSON:function(rt,nt,ot){if(!!rt){var st=typeof rt=="string"?JSON.parse(rt):s.util.object.clone(rt),at=this,lt=st.clipPath,ct=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete st.clipPath,this._enlivenObjects(st.objects,function(ht){at.clear(),at._setBgOverlay(st,function(){lt?at._enlivenObjects([lt],function(mt){at.clipPath=mt[0],at.__setupCanvas.call(at,st,ht,ct,nt)}):at.__setupCanvas.call(at,st,ht,ct,nt)})},ot),this}},__setupCanvas:function(rt,nt,ot,st){var at=this;nt.forEach(function(lt,ct){at.insertAt(lt,ct)}),this.renderOnAddRemove=ot,delete rt.objects,delete rt.backgroundImage,delete rt.overlayImage,delete rt.background,delete rt.overlay,this._setOptions(rt),this.renderAll(),st&&st()},_setBgOverlay:function(rt,nt){var ot={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(!rt.backgroundImage&&!rt.overlayImage&&!rt.background&&!rt.overlay){nt&&nt();return}var st=function(){ot.backgroundImage&&ot.overlayImage&&ot.backgroundColor&&ot.overlayColor&&nt&&nt()};this.__setBgOverlay("backgroundImage",rt.backgroundImage,ot,st),this.__setBgOverlay("overlayImage",rt.overlayImage,ot,st),this.__setBgOverlay("backgroundColor",rt.background,ot,st),this.__setBgOverlay("overlayColor",rt.overlay,ot,st)},__setBgOverlay:function(rt,nt,ot,st){var at=this;if(!nt){ot[rt]=!0,st&&st();return}rt==="backgroundImage"||rt==="overlayImage"?s.util.enlivenObjects([nt],function(lt){at[rt]=lt[0],ot[rt]=!0,st&&st()}):this["set"+s.util.string.capitalize(rt,!0)](nt,function(){ot[rt]=!0,st&&st()})},_enlivenObjects:function(rt,nt,ot){if(!rt||rt.length===0){nt&&nt([]);return}s.util.enlivenObjects(rt,function(st){nt&&nt(st)},null,ot)},_toDataURL:function(rt,nt){this.clone(function(ot){nt(ot.toDataURL(rt))})},_toDataURLWithMultiplier:function(rt,nt,ot){this.clone(function(st){ot(st.toDataURLWithMultiplier(rt,nt))})},clone:function(rt,nt){var ot=JSON.stringify(this.toJSON(nt));this.cloneWithoutData(function(st){st.loadFromJSON(ot,function(){rt&&rt(st)})})},cloneWithoutData:function(rt){var nt=s.util.createCanvasElement();nt.width=this.width,nt.height=this.height;var ot=new s.Canvas(nt);this.backgroundImage?(ot.setBackgroundImage(this.backgroundImage.src,function(){ot.renderAll(),rt&&rt(ot)}),ot.backgroundImageOpacity=this.backgroundImageOpacity,ot.backgroundImageStretch=this.backgroundImageStretch):rt&&rt(ot)}}),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.extend,st=nt.util.object.clone,at=nt.util.toFixed,lt=nt.util.string.capitalize,ct=nt.util.degreesToRadians,ht=!nt.isLikelyNode,mt=2;nt.Object||(nt.Object=nt.util.createClass(nt.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgb(178,204,255)",borderDashArray:null,cornerColor:"rgb(178,204,255)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:ht,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",activeOn:"down",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),colorProperties:"fill stroke backgroundColor".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(dt){dt&&this.setOptions(dt)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=nt.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(dt){var ft=nt.perfLimitSizeTotal,ut=dt.width,pt=dt.height,At=nt.maxCacheSideLimit,gt=nt.minCacheSideLimit;if(ut<=At&&pt<=At&&ut*pt<=ft)return ut<gt&&(dt.width=gt),pt<gt&&(dt.height=gt),dt;var vt=ut/pt,yt=nt.util.limitDimsByArea(vt,ft),bt=nt.util.capValue,Ct=bt(gt,yt.x,At),xt=bt(gt,yt.y,At);return ut>Ct&&(dt.zoomX/=ut/Ct,dt.width=Ct,dt.capped=!0),pt>xt&&(dt.zoomY/=pt/xt,dt.height=xt,dt.capped=!0),dt},_getCacheCanvasDimensions:function(){var dt=this.getTotalObjectScaling(),ft=this._getTransformedDimensions(0,0),ut=ft.x*dt.scaleX/this.scaleX,pt=ft.y*dt.scaleY/this.scaleY;return{width:ut+mt,height:pt+mt,zoomX:dt.scaleX,zoomY:dt.scaleY,x:ut,y:pt}},_updateCacheCanvas:function(){var dt=this.canvas;if(this.noScaleCache&&dt&&dt._currentTransform){var ft=dt._currentTransform.target,ut=dt._currentTransform.action;if(this===ft&&ut.slice&&ut.slice(0,5)==="scale")return!1}var pt=this._cacheCanvas,At=this._limitCacheSize(this._getCacheCanvasDimensions()),gt=nt.minCacheSideLimit,vt=At.width,yt=At.height,bt,Ct,xt=At.zoomX,It=At.zoomY,St=vt!==this.cacheWidth||yt!==this.cacheHeight,Ot=this.zoomX!==xt||this.zoomY!==It,Mt=St||Ot,jt=0,Ft=0,Ut=!1;if(St){var Qt=this._cacheCanvas.width,Ht=this._cacheCanvas.height,Zt=vt>Qt||yt>Ht,Wt=(vt<Qt*.9||yt<Ht*.9)&&Qt>gt&&Ht>gt;Ut=Zt||Wt,Zt&&!At.capped&&(vt>gt||yt>gt)&&(jt=vt*.1,Ft=yt*.1)}return this instanceof nt.Text&&this.path&&(Mt=!0,Ut=!0,jt+=this.getHeightOfLine(0)*this.zoomX,Ft+=this.getHeightOfLine(0)*this.zoomY),Mt?(Ut?(pt.width=Math.ceil(vt+jt),pt.height=Math.ceil(yt+Ft)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,pt.width,pt.height)),bt=At.x/2,Ct=At.y/2,this.cacheTranslationX=Math.round(pt.width/2-bt)+bt,this.cacheTranslationY=Math.round(pt.height/2-Ct)+Ct,this.cacheWidth=vt,this.cacheHeight=yt,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(xt,It),this.zoomX=xt,this.zoomY=It,!0):!1},setOptions:function(dt){this._setOptions(dt),this._initGradient(dt.fill,"fill"),this._initGradient(dt.stroke,"stroke"),this._initPattern(dt.fill,"fill"),this._initPattern(dt.stroke,"stroke")},transform:function(dt){var ft=this.group&&!this.group._transformDone||this.group&&this.canvas&&dt===this.canvas.contextTop,ut=this.calcTransformMatrix(!ft);dt.transform(ut[0],ut[1],ut[2],ut[3],ut[4],ut[5])},toObject:function(dt){var ft=nt.Object.NUM_FRACTION_DIGITS,ut={type:this.type,version:nt.version,originX:this.originX,originY:this.originY,left:at(this.left,ft),top:at(this.top,ft),width:at(this.width,ft),height:at(this.height,ft),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:at(this.strokeWidth,ft),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:at(this.strokeMiterLimit,ft),scaleX:at(this.scaleX,ft),scaleY:at(this.scaleY,ft),angle:at(this.angle,ft),flipX:this.flipX,flipY:this.flipY,opacity:at(this.opacity,ft),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:at(this.skewX,ft),skewY:at(this.skewY,ft)};return this.clipPath&&!this.clipPath.excludeFromExport&&(ut.clipPath=this.clipPath.toObject(dt),ut.clipPath.inverted=this.clipPath.inverted,ut.clipPath.absolutePositioned=this.clipPath.absolutePositioned),nt.util.populateWithProperties(this,ut,dt),this.includeDefaultValues||(ut=this._removeDefaultValues(ut)),ut},toDatalessObject:function(dt){return this.toObject(dt)},_removeDefaultValues:function(dt){var ft=nt.util.getKlass(dt.type).prototype,ut=ft.stateProperties;return ut.forEach(function(pt){if(!(pt==="left"||pt==="top")){dt[pt]===ft[pt]&&delete dt[pt];var At=Object.prototype.toString.call(dt[pt])==="[object Array]"&&Object.prototype.toString.call(ft[pt])==="[object Array]";At&&dt[pt].length===0&&ft[pt].length===0&&delete dt[pt]}}),dt},toString:function(){return"#<fabric."+lt(this.type)+">"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var dt=nt.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(dt.scaleX),scaleY:Math.abs(dt.scaleY)}},getTotalObjectScaling:function(){var dt=this.getObjectScaling(),ft=dt.scaleX,ut=dt.scaleY;if(this.canvas){var pt=this.canvas.getZoom(),At=this.canvas.getRetinaScaling();ft*=pt*At,ut*=pt*At}return{scaleX:ft,scaleY:ut}},getObjectOpacity:function(){var dt=this.opacity;return this.group&&(dt*=this.group.getObjectOpacity()),dt},_set:function(dt,ft){var ut=dt==="scaleX"||dt==="scaleY",pt=this[dt]!==ft,At=!1;return ut&&(ft=this._constrainScale(ft)),dt==="scaleX"&&ft<0?(this.flipX=!this.flipX,ft*=-1):dt==="scaleY"&&ft<0?(this.flipY=!this.flipY,ft*=-1):dt==="shadow"&&ft&&!(ft instanceof nt.Shadow)?ft=new nt.Shadow(ft):dt==="dirty"&&this.group&&this.group.set("dirty",ft),this[dt]=ft,pt&&(At=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(dt)>-1?(this.dirty=!0,At&&this.group.set("dirty",!0)):At&&this.stateProperties.indexOf(dt)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:nt.iMatrix.concat()},isNotVisible:function(){return this.opacity===0||!this.width&&!this.height&&this.strokeWidth===0||!this.visible},render:function(dt){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(dt.save(),this._setupCompositeOperation(dt),this.drawSelectionBackground(dt),this.transform(dt),this._setOpacity(dt),this._setShadow(dt,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(dt)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(dt),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),dt.restore())},renderCache:function(dt){dt=dt||{},this._cacheCanvas||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,dt.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&this.stroke!=="transparent"&&this.strokeWidth!==0},hasFill:function(){return this.fill&&this.fill!=="transparent"},needsItsOwnCache:function(){return!!(this.paintFirst==="stroke"&&this.hasFill()&&this.hasStroke()&&typeof this.shadow=="object"||this.clipPath)},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(this.shadow.offsetX!==0||this.shadow.offsetY!==0)},drawClipPathOnCache:function(dt){var ft=this.clipPath;if(dt.save(),ft.inverted?dt.globalCompositeOperation="destination-out":dt.globalCompositeOperation="destination-in",ft.absolutePositioned){var ut=nt.util.invertTransform(this.calcTransformMatrix());dt.transform(ut[0],ut[1],ut[2],ut[3],ut[4],ut[5])}ft.transform(dt),dt.scale(1/ft.zoomX,1/ft.zoomY),dt.drawImage(ft._cacheCanvas,-ft.cacheTranslationX,-ft.cacheTranslationY),dt.restore()},drawObject:function(dt,ft){var ut=this.fill,pt=this.stroke;ft?(this.fill="black",this.stroke="",this._setClippingProperties(dt)):this._renderBackground(dt),this._render(dt),this._drawClipPath(dt),this.fill=ut,this.stroke=pt},_drawClipPath:function(dt){var ft=this.clipPath;!ft||(ft.canvas=this.canvas,ft.shouldCache(),ft._transformDone=!0,ft.renderCache({forClipping:!0}),this.drawClipPathOnCache(dt))},drawCacheOnCanvas:function(dt){dt.scale(1/this.zoomX,1/this.zoomY),dt.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(dt){if(this.isNotVisible())return!1;if(this._cacheCanvas&&!dt&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&!dt){var ft=this.cacheWidth/this.zoomX,ut=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-ft/2,-ut/2,ft,ut)}return!0}return!1},_renderBackground:function(dt){if(!!this.backgroundColor){var ft=this._getNonTransformedDimensions();dt.fillStyle=this.backgroundColor,dt.fillRect(-ft.x/2,-ft.y/2,ft.x,ft.y),this._removeShadow(dt)}},_setOpacity:function(dt){this.group&&!this.group._transformDone?dt.globalAlpha=this.getObjectOpacity():dt.globalAlpha*=this.opacity},_setStrokeStyles:function(dt,ft){var ut=ft.stroke;ut&&(dt.lineWidth=ft.strokeWidth,dt.lineCap=ft.strokeLineCap,dt.lineDashOffset=ft.strokeDashOffset,dt.lineJoin=ft.strokeLineJoin,dt.miterLimit=ft.strokeMiterLimit,ut.toLive?ut.gradientUnits==="percentage"||ut.gradientTransform||ut.patternTransform?this._applyPatternForTransformedGradient(dt,ut):(dt.strokeStyle=ut.toLive(dt,this),this._applyPatternGradientTransform(dt,ut)):dt.strokeStyle=ft.stroke)},_setFillStyles:function(dt,ft){var ut=ft.fill;ut&&(ut.toLive?(dt.fillStyle=ut.toLive(dt,this),this._applyPatternGradientTransform(dt,ft.fill)):dt.fillStyle=ut)},_setClippingProperties:function(dt){dt.globalAlpha=1,dt.strokeStyle="transparent",dt.fillStyle="#000000"},_setLineDash:function(dt,ft){!ft||ft.length===0||(1&ft.length&&ft.push.apply(ft,ft),dt.setLineDash(ft))},_renderControls:function(dt,ft){var ut=this.getViewportTransform(),pt=this.calcTransformMatrix(),At,gt,vt;ft=ft||{},gt=typeof ft.hasBorders!="undefined"?ft.hasBorders:this.hasBorders,vt=typeof ft.hasControls!="undefined"?ft.hasControls:this.hasControls,pt=nt.util.multiplyTransformMatrices(ut,pt),At=nt.util.qrDecompose(pt),dt.save(),dt.translate(At.translateX,At.translateY),dt.lineWidth=1*this.borderScaleFactor,this.group||(dt.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),dt.rotate(ct(At.angle)),ft.forActiveSelection||this.group?gt&&this.drawBordersInGroup(dt,At,ft):gt&&this.drawBorders(dt,ft),vt&&this.drawControls(dt,ft),dt.restore()},_setShadow:function(dt){if(!!this.shadow){var ft=this.shadow,ut=this.canvas,pt,At=ut&&ut.viewportTransform[0]||1,gt=ut&&ut.viewportTransform[3]||1;ft.nonScaling?pt={scaleX:1,scaleY:1}:pt=this.getObjectScaling(),ut&&ut._isRetinaScaling()&&(At*=nt.devicePixelRatio,gt*=nt.devicePixelRatio),dt.shadowColor=ft.color,dt.shadowBlur=ft.blur*nt.browserShadowBlurConstant*(At+gt)*(pt.scaleX+pt.scaleY)/4,dt.shadowOffsetX=ft.offsetX*At*pt.scaleX,dt.shadowOffsetY=ft.offsetY*gt*pt.scaleY}},_removeShadow:function(dt){!this.shadow||(dt.shadowColor="",dt.shadowBlur=dt.shadowOffsetX=dt.shadowOffsetY=0)},_applyPatternGradientTransform:function(dt,ft){if(!ft||!ft.toLive)return{offsetX:0,offsetY:0};var ut=ft.gradientTransform||ft.patternTransform,pt=-this.width/2+ft.offsetX||0,At=-this.height/2+ft.offsetY||0;return ft.gradientUnits==="percentage"?dt.transform(this.width,0,0,this.height,pt,At):dt.transform(1,0,0,1,pt,At),ut&&dt.transform(ut[0],ut[1],ut[2],ut[3],ut[4],ut[5]),{offsetX:pt,offsetY:At}},_renderPaintInOrder:function(dt){this.paintFirst==="stroke"?(this._renderStroke(dt),this._renderFill(dt)):(this._renderFill(dt),this._renderStroke(dt))},_render:function(){},_renderFill:function(dt){!this.fill||(dt.save(),this._setFillStyles(dt,this),this.fillRule==="evenodd"?dt.fill("evenodd"):dt.fill(),dt.restore())},_renderStroke:function(dt){if(!(!this.stroke||this.strokeWidth===0)){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(dt),dt.save(),this.strokeUniform&&this.group){var ft=this.getObjectScaling();dt.scale(1/ft.scaleX,1/ft.scaleY)}else this.strokeUniform&&dt.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(dt,this.strokeDashArray),this._setStrokeStyles(dt,this),dt.stroke(),dt.restore()}},_applyPatternForTransformedGradient:function(dt,ft){var ut=this._limitCacheSize(this._getCacheCanvasDimensions()),pt=nt.util.createCanvasElement(),At,gt=this.canvas.getRetinaScaling(),vt=ut.x/this.scaleX/gt,yt=ut.y/this.scaleY/gt;pt.width=vt,pt.height=yt,At=pt.getContext("2d"),At.beginPath(),At.moveTo(0,0),At.lineTo(vt,0),At.lineTo(vt,yt),At.lineTo(0,yt),At.closePath(),At.translate(vt/2,yt/2),At.scale(ut.zoomX/this.scaleX/gt,ut.zoomY/this.scaleY/gt),this._applyPatternGradientTransform(At,ft),At.fillStyle=ft.toLive(dt),At.fill(),dt.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),dt.scale(gt*this.scaleX/ut.zoomX,gt*this.scaleY/ut.zoomY),dt.strokeStyle=At.createPattern(pt,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var dt=nt.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",dt.scaleX),this.set("scaleY",dt.scaleY),this.angle=dt.angle,this.skewX=dt.skewX,this.skewY=0}},_removeTransformMatrix:function(dt){var ft=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),ft=nt.util.transformPoint(ft,this.transformMatrix)),this.transformMatrix=null,dt&&(this.scaleX*=dt.scaleX,this.scaleY*=dt.scaleY,this.cropX=dt.cropX,this.cropY=dt.cropY,ft.x+=dt.offsetLeft,ft.y+=dt.offsetTop,this.width=dt.width,this.height=dt.height),this.setPositionByOrigin(ft,"center","center")},clone:function(dt,ft){var ut=this.toObject(ft);this.constructor.fromObject?this.constructor.fromObject(ut,dt):nt.Object._fromObject("Object",ut,dt)},cloneAsImage:function(dt,ft){var ut=this.toCanvasElement(ft);return dt&&dt(new nt.Image(ut)),this},toCanvasElement:function(dt){dt||(dt={});var ft=nt.util,ut=ft.saveObjectTransform(this),pt=this.group,At=this.shadow,gt=Math.abs,vt=(dt.multiplier||1)*(dt.enableRetinaScaling?nt.devicePixelRatio:1);delete this.group,dt.withoutTransform&&ft.resetObjectTransform(this),dt.withoutShadow&&(this.shadow=null);var yt=nt.util.createCanvasElement(),bt=this.getBoundingRect(!0,!0),Ct=this.shadow,xt,It={x:0,y:0},St,Ot,Mt;Ct&&(St=Ct.blur,Ct.nonScaling?xt={scaleX:1,scaleY:1}:xt=this.getObjectScaling(),It.x=2*Math.round(gt(Ct.offsetX)+St)*gt(xt.scaleX),It.y=2*Math.round(gt(Ct.offsetY)+St)*gt(xt.scaleY)),Ot=bt.width+It.x,Mt=bt.height+It.y,yt.width=Math.ceil(Ot),yt.height=Math.ceil(Mt);var jt=new nt.StaticCanvas(yt,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});dt.format==="jpeg"&&(jt.backgroundColor="#fff"),this.setPositionByOrigin(new nt.Point(jt.width/2,jt.height/2),"center","center");var Ft=this.canvas;jt.add(this);var Ut=jt.toCanvasElement(vt||1,dt);return this.shadow=At,this.set("canvas",Ft),pt&&(this.group=pt),this.set(ut).setCoords(),jt._objects=[],jt.dispose(),jt=null,Ut},toDataURL:function(dt){return dt||(dt={}),nt.util.toDataURL(this.toCanvasElement(dt),dt.format||"png",dt.quality||1)},isType:function(dt){return this.type===dt},complexity:function(){return 1},toJSON:function(dt){return this.toObject(dt)},rotate:function(dt){var ft=(this.originX!=="center"||this.originY!=="center")&&this.centeredRotation;return ft&&this._setOriginToCenter(),this.set("angle",dt),ft&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(dt,ft){ft=ft||this.canvas.getPointer(dt);var ut=new nt.Point(ft.x,ft.y),pt=this._getLeftTopCoords();return this.angle&&(ut=nt.util.rotatePoint(ut,pt,ct(-this.angle))),{x:ut.x-pt.x,y:ut.y-pt.y}},_setupCompositeOperation:function(dt){this.globalCompositeOperation&&(dt.globalCompositeOperation=this.globalCompositeOperation)}}),nt.util.createAccessors&&nt.util.createAccessors(nt.Object),ot(nt.Object.prototype,nt.Observable),nt.Object.NUM_FRACTION_DIGITS=2,nt.Object._fromObject=function(dt,ft,ut,pt){var At=nt[dt];ft=st(ft,!0),nt.util.enlivenPatterns([ft.fill,ft.stroke],function(gt){typeof gt[0]!="undefined"&&(ft.fill=gt[0]),typeof gt[1]!="undefined"&&(ft.stroke=gt[1]),nt.util.enlivenObjects([ft.clipPath],function(vt){ft.clipPath=vt[0];var yt=pt?new At(ft[pt],ft):new At(ft);ut&&ut(yt)})})},nt.Object.__uid=0)}(o),function(){var rt=s.util.degreesToRadians,nt={left:-.5,center:0,right:.5},ot={top:-.5,center:0,bottom:.5};s.util.object.extend(s.Object.prototype,{translateToGivenOrigin:function(st,at,lt,ct,ht){var mt=st.x,dt=st.y,ft,ut,pt;return typeof at=="string"?at=nt[at]:at-=.5,typeof ct=="string"?ct=nt[ct]:ct-=.5,ft=ct-at,typeof lt=="string"?lt=ot[lt]:lt-=.5,typeof ht=="string"?ht=ot[ht]:ht-=.5,ut=ht-lt,(ft||ut)&&(pt=this._getTransformedDimensions(),mt=st.x+ft*pt.x,dt=st.y+ut*pt.y),new s.Point(mt,dt)},translateToCenterPoint:function(st,at,lt){var ct=this.translateToGivenOrigin(st,at,lt,"center","center");return this.angle?s.util.rotatePoint(ct,st,rt(this.angle)):ct},translateToOriginPoint:function(st,at,lt){var ct=this.translateToGivenOrigin(st,"center","center",at,lt);return this.angle?s.util.rotatePoint(ct,st,rt(this.angle)):ct},getCenterPoint:function(){var st=new s.Point(this.left,this.top);return this.translateToCenterPoint(st,this.originX,this.originY)},getPointByOrigin:function(st,at){var lt=this.getCenterPoint();return this.translateToOriginPoint(lt,st,at)},toLocalPoint:function(st,at,lt){var ct=this.getCenterPoint(),ht,mt;return typeof at!="undefined"&&typeof lt!="undefined"?ht=this.translateToGivenOrigin(ct,"center","center",at,lt):ht=new s.Point(this.left,this.top),mt=new s.Point(st.x,st.y),this.angle&&(mt=s.util.rotatePoint(mt,ct,-rt(this.angle))),mt.subtractEquals(ht)},setPositionByOrigin:function(st,at,lt){var ct=this.translateToCenterPoint(st,at,lt),ht=this.translateToOriginPoint(ct,this.originX,this.originY);this.set("left",ht.x),this.set("top",ht.y)},adjustPosition:function(st){var at=rt(this.angle),lt=this.getScaledWidth(),ct=s.util.cos(at)*lt,ht=s.util.sin(at)*lt,mt,dt;typeof this.originX=="string"?mt=nt[this.originX]:mt=this.originX-.5,typeof st=="string"?dt=nt[st]:dt=st-.5,this.left+=ct*(dt-mt),this.top+=ht*(dt-mt),this.setCoords(),this.originX=st},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var st=this.getCenterPoint();this.originX="center",this.originY="center",this.left=st.x,this.top=st.y},_resetOrigin:function(){var st=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=st.x,this.top=st.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){function rt(lt){return[new s.Point(lt.tl.x,lt.tl.y),new s.Point(lt.tr.x,lt.tr.y),new s.Point(lt.br.x,lt.br.y),new s.Point(lt.bl.x,lt.bl.y)]}var nt=s.util,ot=nt.degreesToRadians,st=nt.multiplyTransformMatrices,at=nt.transformPoint;nt.object.extend(s.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(lt,ct){return ct?lt?this.calcACoords():this.calcLineCoords():((!this.aCoords||!this.lineCoords)&&this.setCoords(!0),lt?this.aCoords:this.lineCoords)},getCoords:function(lt,ct){return rt(this._getCoords(lt,ct))},intersectsWithRect:function(lt,ct,ht,mt){var dt=this.getCoords(ht,mt),ft=s.Intersection.intersectPolygonRectangle(dt,lt,ct);return ft.status==="Intersection"},intersectsWithObject:function(lt,ct,ht){var mt=s.Intersection.intersectPolygonPolygon(this.getCoords(ct,ht),lt.getCoords(ct,ht));return mt.status==="Intersection"||lt.isContainedWithinObject(this,ct,ht)||this.isContainedWithinObject(lt,ct,ht)},isContainedWithinObject:function(lt,ct,ht){for(var mt=this.getCoords(ct,ht),dt=ct?lt.aCoords:lt.lineCoords,ft=0,ut=lt._getImageLines(dt);ft<4;ft++)if(!lt.containsPoint(mt[ft],ut))return!1;return!0},isContainedWithinRect:function(lt,ct,ht,mt){var dt=this.getBoundingRect(ht,mt);return dt.left>=lt.x&&dt.left+dt.width<=ct.x&&dt.top>=lt.y&&dt.top+dt.height<=ct.y},containsPoint:function(lt,ft,ht,mt){var dt=this._getCoords(ht,mt),ft=ft||this._getImageLines(dt),ut=this._findCrossPoints(lt,ft);return ut!==0&&ut%2===1},isOnScreen:function(lt){if(!this.canvas)return!1;var ct=this.canvas.vptCoords.tl,ht=this.canvas.vptCoords.br,mt=this.getCoords(!0,lt);return mt.some(function(dt){return dt.x<=ht.x&&dt.x>=ct.x&&dt.y<=ht.y&&dt.y>=ct.y})||this.intersectsWithRect(ct,ht,!0,lt)?!0:this._containsCenterOfCanvas(ct,ht,lt)},_containsCenterOfCanvas:function(lt,ct,ht){var mt={x:(lt.x+ct.x)/2,y:(lt.y+ct.y)/2};return!!this.containsPoint(mt,null,!0,ht)},isPartiallyOnScreen:function(lt){if(!this.canvas)return!1;var ct=this.canvas.vptCoords.tl,ht=this.canvas.vptCoords.br;if(this.intersectsWithRect(ct,ht,!0,lt))return!0;var mt=this.getCoords(!0,lt).every(function(dt){return(dt.x>=ht.x||dt.x<=ct.x)&&(dt.y>=ht.y||dt.y<=ct.y)});return mt&&this._containsCenterOfCanvas(ct,ht,lt)},_getImageLines:function(lt){var ct={topline:{o:lt.tl,d:lt.tr},rightline:{o:lt.tr,d:lt.br},bottomline:{o:lt.br,d:lt.bl},leftline:{o:lt.bl,d:lt.tl}};return ct},_findCrossPoints:function(lt,ct){var ht,mt,dt,ft,ut,pt=0,At;for(var gt in ct)if(At=ct[gt],!(At.o.y<lt.y&&At.d.y<lt.y)&&!(At.o.y>=lt.y&&At.d.y>=lt.y)&&(At.o.x===At.d.x&&At.o.x>=lt.x?ut=At.o.x:(ht=0,mt=(At.d.y-At.o.y)/(At.d.x-At.o.x),dt=lt.y-ht*lt.x,ft=At.o.y-mt*At.o.x,ut=-(dt-ft)/(ht-mt)),ut>=lt.x&&(pt+=1),pt===2))break;return pt},getBoundingRect:function(lt,ct){var ht=this.getCoords(lt,ct);return nt.makeBoundingBoxFromPoints(ht)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(lt){return Math.abs(lt)<this.minScaleLimit?lt<0?-this.minScaleLimit:this.minScaleLimit:lt===0?1e-4:lt},scale:function(lt){return this._set("scaleX",lt),this._set("scaleY",lt),this.setCoords()},scaleToWidth:function(lt,ct){var ht=this.getBoundingRect(ct).width/this.getScaledWidth();return this.scale(lt/this.width/ht)},scaleToHeight:function(lt,ct){var ht=this.getBoundingRect(ct).height/this.getScaledHeight();return this.scale(lt/this.height/ht)},calcCoords:function(lt){return lt?this.calcACoords():this.calcOCoords()},calcLineCoords:function(){var lt=this.getViewportTransform(),ct=this.padding,ht=ot(this.angle),mt=nt.cos(ht),dt=nt.sin(ht),ft=mt*ct,ut=dt*ct,pt=ft+ut,At=ft-ut,gt=this.calcACoords(),vt={tl:at(gt.tl,lt),tr:at(gt.tr,lt),bl:at(gt.bl,lt),br:at(gt.br,lt)};return ct&&(vt.tl.x-=At,vt.tl.y-=pt,vt.tr.x+=pt,vt.tr.y-=At,vt.bl.x-=pt,vt.bl.y+=At,vt.br.x+=At,vt.br.y+=pt),vt},calcOCoords:function(){var lt=this._calcRotateMatrix(),ct=this._calcTranslateMatrix(),ht=this.getViewportTransform(),mt=st(ht,ct),dt=st(mt,lt),dt=st(dt,[1/ht[0],0,0,1/ht[3],0,0]),ft=this._calculateCurrentDimensions(),ut={};return this.forEachControl(function(pt,At,gt){ut[At]=pt.positionHandler(ft,dt,gt)}),ut},calcACoords:function(){var lt=this._calcRotateMatrix(),ct=this._calcTranslateMatrix(),ht=st(ct,lt),mt=this._getTransformedDimensions(),dt=mt.x/2,ft=mt.y/2;return{tl:at({x:-dt,y:-ft},ht),tr:at({x:dt,y:-ft},ht),bl:at({x:-dt,y:ft},ht),br:at({x:dt,y:ft},ht)}},setCoords:function(lt){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),lt?this:(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords(),this)},_calcRotateMatrix:function(){return nt.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var lt=this.getCenterPoint();return[1,0,0,1,lt.x,lt.y]},transformMatrixKey:function(lt){var ct="_",ht="";return!lt&&this.group&&(ht=this.group.transformMatrixKey(lt)+ct),ht+this.top+ct+this.left+ct+this.scaleX+ct+this.scaleY+ct+this.skewX+ct+this.skewY+ct+this.angle+ct+this.originX+ct+this.originY+ct+this.width+ct+this.height+ct+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(lt){var ct=this.calcOwnMatrix();if(lt||!this.group)return ct;var ht=this.transformMatrixKey(lt),mt=this.matrixCache||(this.matrixCache={});return mt.key===ht?mt.value:(this.group&&(ct=st(this.group.calcTransformMatrix(!1),ct)),mt.key=ht,mt.value=ct,ct)},calcOwnMatrix:function(){var lt=this.transformMatrixKey(!0),ct=this.ownMatrixCache||(this.ownMatrixCache={});if(ct.key===lt)return ct.value;var ht=this._calcTranslateMatrix(),mt={angle:this.angle,translateX:ht[4],translateY:ht[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return ct.key=lt,ct.value=nt.composeMatrix(mt),ct.value},_calcDimensionsTransformMatrix:function(lt,ct,ht){return nt.calcDimensionsMatrix({skewX:lt,skewY:ct,scaleX:this.scaleX*(ht&&this.flipX?-1:1),scaleY:this.scaleY*(ht&&this.flipY?-1:1)})},_getNonTransformedDimensions:function(){var lt=this.strokeWidth,ct=this.width+lt,ht=this.height+lt;return{x:ct,y:ht}},_getTransformedDimensions:function(lt,ct){typeof lt=="undefined"&&(lt=this.skewX),typeof ct=="undefined"&&(ct=this.skewY);var ht,mt,dt,ft=lt===0&&ct===0;if(this.strokeUniform?(mt=this.width,dt=this.height):(ht=this._getNonTransformedDimensions(),mt=ht.x,dt=ht.y),ft)return this._finalizeDimensions(mt*this.scaleX,dt*this.scaleY);var ut=nt.sizeAfterTransform(mt,dt,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:lt,skewY:ct});return this._finalizeDimensions(ut.x,ut.y)},_finalizeDimensions:function(lt,ct){return this.strokeUniform?{x:lt+this.strokeWidth,y:ct+this.strokeWidth}:{x:lt,y:ct}},_calculateCurrentDimensions:function(){var lt=this.getViewportTransform(),ct=this._getTransformedDimensions(),ht=at(ct,lt,!0);return ht.scalarAdd(2*this.padding)}})}(),s.util.object.extend(s.Object.prototype,{sendToBack:function(){return this.group?s.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?s.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(rt){return this.group?s.StaticCanvas.prototype.sendBackwards.call(this.group,this,rt):this.canvas&&this.canvas.sendBackwards(this,rt),this},bringForward:function(rt){return this.group?s.StaticCanvas.prototype.bringForward.call(this.group,this,rt):this.canvas&&this.canvas.bringForward(this,rt),this},moveTo:function(rt){return this.group&&this.group.type!=="activeSelection"?s.StaticCanvas.prototype.moveTo.call(this.group,this,rt):this.canvas&&this.canvas.moveTo(this,rt),this}}),function(){function rt(ot,st){if(st){if(st.toLive)return ot+": url(#SVGID_"+st.id+"); ";var at=new s.Color(st),lt=ot+": "+at.toRgb()+"; ",ct=at.getAlpha();return ct!==1&&(lt+=ot+"-opacity: "+ct.toString()+"; "),lt}else return ot+": none; "}var nt=s.util.toFixed;s.util.object.extend(s.Object.prototype,{getSvgStyles:function(ot){var st=this.fillRule?this.fillRule:"nonzero",at=this.strokeWidth?this.strokeWidth:"0",lt=this.strokeDashArray?this.strokeDashArray.join(" "):"none",ct=this.strokeDashOffset?this.strokeDashOffset:"0",ht=this.strokeLineCap?this.strokeLineCap:"butt",mt=this.strokeLineJoin?this.strokeLineJoin:"miter",dt=this.strokeMiterLimit?this.strokeMiterLimit:"4",ft=typeof this.opacity!="undefined"?this.opacity:"1",ut=this.visible?"":" visibility: hidden;",pt=ot?"":this.getSvgFilter(),At=rt("fill",this.fill),gt=rt("stroke",this.stroke);return[gt,"stroke-width: ",at,"; ","stroke-dasharray: ",lt,"; ","stroke-linecap: ",ht,"; ","stroke-dashoffset: ",ct,"; ","stroke-linejoin: ",mt,"; ","stroke-miterlimit: ",dt,"; ",At,"fill-rule: ",st,"; ","opacity: ",ft,";",pt,ut].join("")},getSvgSpanStyles:function(ot,st){var at="; ",ct=ot.fontFamily?"font-family: "+(ot.fontFamily.indexOf("'")===-1&&ot.fontFamily.indexOf('"')===-1?"'"+ot.fontFamily+"'":ot.fontFamily)+at:"",lt=ot.strokeWidth?"stroke-width: "+ot.strokeWidth+at:"",ct=ct,ht=ot.fontSize?"font-size: "+ot.fontSize+"px"+at:"",mt=ot.fontStyle?"font-style: "+ot.fontStyle+at:"",dt=ot.fontWeight?"font-weight: "+ot.fontWeight+at:"",ft=ot.fill?rt("fill",ot.fill):"",ut=ot.stroke?rt("stroke",ot.stroke):"",pt=this.getSvgTextDecoration(ot),At=ot.deltaY?"baseline-shift: "+-ot.deltaY+"; ":"";return pt&&(pt="text-decoration: "+pt+at),[ut,lt,ct,ht,mt,dt,pt,ft,At,st?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(ot){return["overline","underline","line-through"].filter(function(st){return ot[st.replace("-","")]}).join(" ")},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""},getSvgCommons:function(){return[this.id?'id="'+this.id+'" ':"",this.clipPath?'clip-path="url(#'+this.clipPath.clipPathId+')" ':""].join("")},getSvgTransform:function(ot,st){var at=ot?this.calcTransformMatrix():this.calcOwnMatrix(),lt='transform="'+s.util.matrixToSVG(at);return lt+(st||"")+'" '},_setSVGBg:function(ot){if(this.backgroundColor){var st=s.Object.NUM_FRACTION_DIGITS;ot.push("		<rect ",this._getFillAttributes(this.backgroundColor),' x="',nt(-this.width/2,st),'" y="',nt(-this.height/2,st),'" width="',nt(this.width,st),'" height="',nt(this.height,st),`"></rect>
`)}},toSVG:function(ot){return this._createBaseSVGMarkup(this._toSVG(ot),{reviver:ot})},toClipPathSVG:function(ot){return"	"+this._createBaseClipPathSVGMarkup(this._toSVG(ot),{reviver:ot})},_createBaseClipPathSVGMarkup:function(ot,st){st=st||{};var at=st.reviver,lt=st.additionalTransform||"",ct=[this.getSvgTransform(!0,lt),this.getSvgCommons()].join(""),ht=ot.indexOf("COMMON_PARTS");return ot[ht]=ct,at?at(ot.join("")):ot.join("")},_createBaseSVGMarkup:function(ot,st){st=st||{};var at=st.noStyle,lt=st.reviver,ct=at?"":'style="'+this.getSvgStyles()+'" ',ht=st.withShadow?'style="'+this.getSvgFilter()+'" ':"",mt=this.clipPath,dt=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",ft=mt&&mt.absolutePositioned,ut=this.stroke,pt=this.fill,At=this.shadow,gt,vt=[],yt,bt=ot.indexOf("COMMON_PARTS"),Ct=st.additionalTransform;return mt&&(mt.clipPathId="CLIPPATH_"+s.Object.__uid++,yt='<clipPath id="'+mt.clipPathId+`" >
`+mt.toClipPathSVG(lt)+`</clipPath>
`),ft&&vt.push("<g ",ht,this.getSvgCommons(),` >
`),vt.push("<g ",this.getSvgTransform(!1),ft?"":ht+this.getSvgCommons(),` >
`),gt=[ct,dt,at?"":this.addPaintOrder()," ",Ct?'transform="'+Ct+'" ':""].join(""),ot[bt]=gt,pt&&pt.toLive&&vt.push(pt.toSVG(this)),ut&&ut.toLive&&vt.push(ut.toSVG(this)),At&&vt.push(At.toSVG(this)),mt&&vt.push(yt),vt.push(ot.join("")),vt.push(`</g>
`),ft&&vt.push(`</g>
`),lt?lt(vt.join("")):vt.join("")},addPaintOrder:function(){return this.paintFirst!=="fill"?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var rt=s.util.object.extend,nt="stateProperties";function ot(at,lt,ct){var ht={},mt=!0;ct.forEach(function(dt){ht[dt]=at[dt]}),rt(at[lt],ht,mt)}function st(at,lt,ct){if(at===lt)return!0;if(Array.isArray(at)){if(!Array.isArray(lt)||at.length!==lt.length)return!1;for(var ht=0,mt=at.length;ht<mt;ht++)if(!st(at[ht],lt[ht]))return!1;return!0}else if(at&&typeof at=="object"){var dt=Object.keys(at),ft;if(!lt||typeof lt!="object"||!ct&&dt.length!==Object.keys(lt).length)return!1;for(var ht=0,mt=dt.length;ht<mt;ht++)if(ft=dt[ht],!(ft==="canvas"||ft==="group")&&!st(at[ft],lt[ft]))return!1;return!0}}s.util.object.extend(s.Object.prototype,{hasStateChanged:function(at){at=at||nt;var lt="_"+at;return Object.keys(this[lt]).length<this[at].length?!0:!st(this[lt],this,!0)},saveState:function(at){var lt=at&&at.propertySet||nt,ct="_"+lt;return this[ct]?(ot(this,ct,this[lt]),at&&at.stateProperties&&ot(this,ct,at.stateProperties),this):this.setupState(at)},setupState:function(at){at=at||{};var lt=at.propertySet||nt;return at.propertySet=lt,this["_"+lt]={},this.saveState(at),this}})}(),function(){var rt=s.util.degreesToRadians;s.util.object.extend(s.Object.prototype,{_findTargetCorner:function(nt,ot){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var st=nt.x,at=nt.y,lt,ct,ht=Object.keys(this.oCoords),mt=ht.length-1,dt;for(this.__corner=0;mt>=0;mt--)if(dt=ht[mt],!!this.isControlVisible(dt)&&(ct=this._getImageLines(ot?this.oCoords[dt].touchCorner:this.oCoords[dt].corner),lt=this._findCrossPoints({x:st,y:at},ct),lt!==0&&lt%2===1))return this.__corner=dt,dt;return!1},forEachControl:function(nt){for(var ot in this.controls)nt(this.controls[ot],ot,this)},_setCornerCoords:function(){var nt=this.oCoords;for(var ot in nt){var st=this.controls[ot];nt[ot].corner=st.calcCornerCoords(this.angle,this.cornerSize,nt[ot].x,nt[ot].y,!1),nt[ot].touchCorner=st.calcCornerCoords(this.angle,this.touchCornerSize,nt[ot].x,nt[ot].y,!0)}},drawSelectionBackground:function(nt){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;nt.save();var ot=this.getCenterPoint(),st=this._calculateCurrentDimensions(),at=this.canvas.viewportTransform;return nt.translate(ot.x,ot.y),nt.scale(1/at[0],1/at[3]),nt.rotate(rt(this.angle)),nt.fillStyle=this.selectionBackgroundColor,nt.fillRect(-st.x/2,-st.y/2,st.x,st.y),nt.restore(),this},drawBorders:function(nt,ot){ot=ot||{};var st=this._calculateCurrentDimensions(),at=this.borderScaleFactor,lt=st.x+at,ct=st.y+at,ht=typeof ot.hasControls!="undefined"?ot.hasControls:this.hasControls,mt=!1;return nt.save(),nt.strokeStyle=ot.borderColor||this.borderColor,this._setLineDash(nt,ot.borderDashArray||this.borderDashArray),nt.strokeRect(-lt/2,-ct/2,lt,ct),ht&&(nt.beginPath(),this.forEachControl(function(dt,ft,ut){dt.withConnection&&dt.getVisibility(ut,ft)&&(mt=!0,nt.moveTo(dt.x*lt,dt.y*ct),nt.lineTo(dt.x*lt+dt.offsetX,dt.y*ct+dt.offsetY))}),mt&&nt.stroke()),nt.restore(),this},drawBordersInGroup:function(nt,ot,st){st=st||{};var at=s.util.sizeAfterTransform(this.width,this.height,ot),lt=this.strokeWidth,ct=this.strokeUniform,ht=this.borderScaleFactor,mt=at.x+lt*(ct?this.canvas.getZoom():ot.scaleX)+ht,dt=at.y+lt*(ct?this.canvas.getZoom():ot.scaleY)+ht;return nt.save(),this._setLineDash(nt,st.borderDashArray||this.borderDashArray),nt.strokeStyle=st.borderColor||this.borderColor,nt.strokeRect(-mt/2,-dt/2,mt,dt),nt.restore(),this},drawControls:function(nt,ot){ot=ot||{},nt.save();var st=this.canvas.getRetinaScaling(),at,lt;return nt.setTransform(st,0,0,st,0,0),nt.strokeStyle=nt.fillStyle=ot.cornerColor||this.cornerColor,this.transparentCorners||(nt.strokeStyle=ot.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(nt,ot.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(at=this.group.calcTransformMatrix()),this.forEachControl(function(ct,ht,mt){lt=mt.oCoords[ht],ct.getVisibility(mt,ht)&&(at&&(lt=s.util.transformPoint(lt,at)),ct.render(nt,lt.x,lt.y,ot,mt))}),nt.restore(),this},isControlVisible:function(nt){return this.controls[nt]&&this.controls[nt].getVisibility(this,nt)},setControlVisible:function(nt,ot){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[nt]=ot,this},setControlsVisibility:function(nt){nt||(nt={});for(var ot in nt)this.setControlVisible(ot,nt[ot]);return this},onDeselect:function(){},onSelect:function(){}})}(),s.util.object.extend(s.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(rt,nt){nt=nt||{};var ot=function(){},st=nt.onComplete||ot,at=nt.onChange||ot,lt=this;return s.util.animate({startValue:rt.left,endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(ct){rt.set("left",ct),lt.requestRenderAll(),at()},onComplete:function(){rt.setCoords(),st()}}),this},fxCenterObjectV:function(rt,nt){nt=nt||{};var ot=function(){},st=nt.onComplete||ot,at=nt.onChange||ot,lt=this;return s.util.animate({startValue:rt.top,endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(ct){rt.set("top",ct),lt.requestRenderAll(),at()},onComplete:function(){rt.setCoords(),st()}}),this},fxRemove:function(rt,nt){nt=nt||{};var ot=function(){},st=nt.onComplete||ot,at=nt.onChange||ot,lt=this;return s.util.animate({startValue:rt.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(ct){rt.set("opacity",ct),lt.requestRenderAll(),at()},onComplete:function(){lt.remove(rt),st()}}),this}}),s.util.object.extend(s.Object.prototype,{animate:function(){if(arguments[0]&&typeof arguments[0]=="object"){var rt=[],nt,ot;for(nt in arguments[0])rt.push(nt);for(var st=0,at=rt.length;st<at;st++)nt=rt[st],ot=st!==at-1,this._animate(nt,arguments[0][nt],arguments[1],ot)}else this._animate.apply(this,arguments);return this},_animate:function(rt,nt,ot,st){var at=this,lt;nt=nt.toString(),ot?ot=s.util.object.clone(ot):ot={},~rt.indexOf(".")&&(lt=rt.split("."));var ct=at.colorProperties.indexOf(rt)>-1||lt&&at.colorProperties.indexOf(lt[1])>-1,ht=lt?this.get(lt[0])[lt[1]]:this.get(rt);"from"in ot||(ot.from=ht),ct||(~nt.indexOf("=")?nt=ht+parseFloat(nt.replace("=","")):nt=parseFloat(nt));var mt={startValue:ot.from,endValue:nt,byValue:ot.by,easing:ot.easing,duration:ot.duration,abort:ot.abort&&function(dt,ft,ut){return ot.abort.call(at,dt,ft,ut)},onChange:function(dt,ft,ut){lt?at[lt[0]][lt[1]]=dt:at.set(rt,dt),!st&&ot.onChange&&ot.onChange(dt,ft,ut)},onComplete:function(dt,ft,ut){st||(at.setCoords(),ot.onComplete&&ot.onComplete(dt,ft,ut))}};return ct?s.util.animateColor(mt.startValue,mt.endValue,mt.duration,mt):s.util.animate(mt)}}),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.extend,st=nt.util.object.clone,at={x1:1,x2:1,y1:1,y2:1};if(nt.Line){nt.warn("fabric.Line is already defined");return}nt.Line=nt.util.createClass(nt.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:nt.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(ct,ht){ct||(ct=[0,0,0,0]),this.callSuper("initialize",ht),this.set("x1",ct[0]),this.set("y1",ct[1]),this.set("x2",ct[2]),this.set("y2",ct[3]),this._setWidthHeight(ht)},_setWidthHeight:function(ct){ct||(ct={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in ct?ct.left:this._getLeftToOriginX(),this.top="top"in ct?ct.top:this._getTopToOriginY()},_set:function(ct,ht){return this.callSuper("_set",ct,ht),typeof at[ct]!="undefined"&&this._setWidthHeight(),this},_getLeftToOriginX:lt({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:lt({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(ct){ct.beginPath();var ht=this.calcLinePoints();ct.moveTo(ht.x1,ht.y1),ct.lineTo(ht.x2,ht.y2),ct.lineWidth=this.strokeWidth;var mt=ct.strokeStyle;ct.strokeStyle=this.stroke||ct.fillStyle,this.stroke&&this._renderStroke(ct),ct.strokeStyle=mt},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(ct){return ot(this.callSuper("toObject",ct),this.calcLinePoints())},_getNonTransformedDimensions:function(){var ct=this.callSuper("_getNonTransformedDimensions");return this.strokeLineCap==="butt"&&(this.width===0&&(ct.y-=this.strokeWidth),this.height===0&&(ct.x-=this.strokeWidth)),ct},calcLinePoints:function(){var ct=this.x1<=this.x2?-1:1,ht=this.y1<=this.y2?-1:1,mt=ct*this.width*.5,dt=ht*this.height*.5,ft=ct*this.width*-.5,ut=ht*this.height*-.5;return{x1:mt,x2:ft,y1:dt,y2:ut}},_toSVG:function(){var ct=this.calcLinePoints();return["<line ","COMMON_PARTS",'x1="',ct.x1,'" y1="',ct.y1,'" x2="',ct.x2,'" y2="',ct.y2,`" />
`]}}),nt.Line.ATTRIBUTE_NAMES=nt.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),nt.Line.fromElement=function(ct,ht,mt){mt=mt||{};var dt=nt.parseAttributes(ct,nt.Line.ATTRIBUTE_NAMES),ft=[dt.x1||0,dt.y1||0,dt.x2||0,dt.y2||0];ht(new nt.Line(ft,ot(dt,mt)))},nt.Line.fromObject=function(ct,ht){function mt(ft){delete ft.points,ht&&ht(ft)}var dt=st(ct,!0);dt.points=[ct.x1,ct.y1,ct.x2,ct.y2],nt.Object._fromObject("Line",dt,mt,"points")};function lt(ct,ht){var mt=ct.origin,dt=ct.axis1,ft=ct.axis2,ut=ct.dimension,pt=ht.nearest,At=ht.center,gt=ht.farthest;return function(){switch(this.get(mt)){case pt:return Math.min(this.get(dt),this.get(ft));case At:return Math.min(this.get(dt),this.get(ft))+.5*this.get(ut);case gt:return Math.max(this.get(dt),this.get(ft))}}}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=Math.PI;if(nt.Circle){nt.warn("fabric.Circle is already defined.");return}nt.Circle=nt.util.createClass(nt.Object,{type:"circle",radius:0,startAngle:0,endAngle:ot*2,cacheProperties:nt.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set:function(at,lt){return this.callSuper("_set",at,lt),at==="radius"&&this.setRadius(lt),this},toObject:function(at){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(at))},_toSVG:function(){var at,lt=0,ct=0,ht=(this.endAngle-this.startAngle)%(2*ot);if(ht===0)at=["<circle ","COMMON_PARTS",'cx="'+lt+'" cy="'+ct+'" ','r="',this.radius,`" />
`];else{var mt=nt.util.cos(this.startAngle)*this.radius,dt=nt.util.sin(this.startAngle)*this.radius,ft=nt.util.cos(this.endAngle)*this.radius,ut=nt.util.sin(this.endAngle)*this.radius,pt=ht>ot?"1":"0";at=['<path d="M '+mt+" "+dt," A "+this.radius+" "+this.radius," 0 ",+pt+" 1"," "+ft+" "+ut,'" ',"COMMON_PARTS",` />
`]}return at},_render:function(at){at.beginPath(),at.arc(0,0,this.radius,this.startAngle,this.endAngle,!1),this._renderPaintInOrder(at)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(at){return this.radius=at,this.set("width",at*2).set("height",at*2)}}),nt.Circle.ATTRIBUTE_NAMES=nt.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),nt.Circle.fromElement=function(at,lt){var ct=nt.parseAttributes(at,nt.Circle.ATTRIBUTE_NAMES);if(!st(ct))throw new Error("value of `r` attribute is required and can not be negative");ct.left=(ct.left||0)-ct.radius,ct.top=(ct.top||0)-ct.radius,lt(new nt.Circle(ct))};function st(at){return"radius"in at&&at.radius>=0}nt.Circle.fromObject=function(at,lt){nt.Object._fromObject("Circle",at,lt)}}(o),function(rt){var nt=rt.fabric||(rt.fabric={});if(nt.Triangle){nt.warn("fabric.Triangle is already defined");return}nt.Triangle=nt.util.createClass(nt.Object,{type:"triangle",width:100,height:100,_render:function(ot){var st=this.width/2,at=this.height/2;ot.beginPath(),ot.moveTo(-st,at),ot.lineTo(0,-at),ot.lineTo(st,at),ot.closePath(),this._renderPaintInOrder(ot)},_toSVG:function(){var ot=this.width/2,st=this.height/2,at=[-ot+" "+st,"0 "+-st,ot+" "+st].join(",");return["<polygon ","COMMON_PARTS",'points="',at,'" />']}}),nt.Triangle.fromObject=function(ot,st){return nt.Object._fromObject("Triangle",ot,st)}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=Math.PI*2;if(nt.Ellipse){nt.warn("fabric.Ellipse is already defined.");return}nt.Ellipse=nt.util.createClass(nt.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:nt.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(st){this.callSuper("initialize",st),this.set("rx",st&&st.rx||0),this.set("ry",st&&st.ry||0)},_set:function(st,at){switch(this.callSuper("_set",st,at),st){case"rx":this.rx=at,this.set("width",at*2);break;case"ry":this.ry=at,this.set("height",at*2);break}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(st){return this.callSuper("toObject",["rx","ry"].concat(st))},_toSVG:function(){return["<ellipse ","COMMON_PARTS",'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,`" />
`]},_render:function(st){st.beginPath(),st.save(),st.transform(1,0,0,this.ry/this.rx,0,0),st.arc(0,0,this.rx,0,ot,!1),st.restore(),this._renderPaintInOrder(st)}}),nt.Ellipse.ATTRIBUTE_NAMES=nt.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),nt.Ellipse.fromElement=function(st,at){var lt=nt.parseAttributes(st,nt.Ellipse.ATTRIBUTE_NAMES);lt.left=(lt.left||0)-lt.rx,lt.top=(lt.top||0)-lt.ry,at(new nt.Ellipse(lt))},nt.Ellipse.fromObject=function(st,at){nt.Object._fromObject("Ellipse",st,at)}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.extend;if(nt.Rect){nt.warn("fabric.Rect is already defined");return}nt.Rect=nt.util.createClass(nt.Object,{stateProperties:nt.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:nt.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(st){this.callSuper("initialize",st),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(st){var at=this.rx?Math.min(this.rx,this.width/2):0,lt=this.ry?Math.min(this.ry,this.height/2):0,ct=this.width,ht=this.height,mt=-this.width/2,dt=-this.height/2,ft=at!==0||lt!==0,ut=1-.5522847498;st.beginPath(),st.moveTo(mt+at,dt),st.lineTo(mt+ct-at,dt),ft&&st.bezierCurveTo(mt+ct-ut*at,dt,mt+ct,dt+ut*lt,mt+ct,dt+lt),st.lineTo(mt+ct,dt+ht-lt),ft&&st.bezierCurveTo(mt+ct,dt+ht-ut*lt,mt+ct-ut*at,dt+ht,mt+ct-at,dt+ht),st.lineTo(mt+at,dt+ht),ft&&st.bezierCurveTo(mt+ut*at,dt+ht,mt,dt+ht-ut*lt,mt,dt+ht-lt),st.lineTo(mt,dt+lt),ft&&st.bezierCurveTo(mt,dt+ut*lt,mt+ut*at,dt,mt+at,dt),st.closePath(),this._renderPaintInOrder(st)},toObject:function(st){return this.callSuper("toObject",["rx","ry"].concat(st))},_toSVG:function(){var st=-this.width/2,at=-this.height/2;return["<rect ","COMMON_PARTS",'x="',st,'" y="',at,'" rx="',this.rx,'" ry="',this.ry,'" width="',this.width,'" height="',this.height,`" />
`]}}),nt.Rect.ATTRIBUTE_NAMES=nt.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),nt.Rect.fromElement=function(st,at,lt){if(!st)return at(null);lt=lt||{};var ct=nt.parseAttributes(st,nt.Rect.ATTRIBUTE_NAMES);ct.left=ct.left||0,ct.top=ct.top||0,ct.height=ct.height||0,ct.width=ct.width||0;var ht=new nt.Rect(ot(lt?nt.util.object.clone(lt):{},ct));ht.visible=ht.visible&&ht.width>0&&ht.height>0,at(ht)},nt.Rect.fromObject=function(st,at){return nt.Object._fromObject("Rect",st,at)}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.extend,st=nt.util.array.min,at=nt.util.array.max,lt=nt.util.toFixed;if(nt.Polyline){nt.warn("fabric.Polyline is already defined");return}nt.Polyline=nt.util.createClass(nt.Object,{type:"polyline",points:null,cacheProperties:nt.Object.prototype.cacheProperties.concat("points"),initialize:function(ct,ht){ht=ht||{},this.points=ct||[],this.callSuper("initialize",ht),this._setPositionDimensions(ht)},_setPositionDimensions:function(ct){var ht=this._calcDimensions(ct),mt;this.width=ht.width,this.height=ht.height,ct.fromSVG||(mt=this.translateToGivenOrigin({x:ht.left-this.strokeWidth/2,y:ht.top-this.strokeWidth/2},"left","top",this.originX,this.originY)),typeof ct.left=="undefined"&&(this.left=ct.fromSVG?ht.left:mt.x),typeof ct.top=="undefined"&&(this.top=ct.fromSVG?ht.top:mt.y),this.pathOffset={x:ht.left+this.width/2,y:ht.top+this.height/2}},_calcDimensions:function(){var ct=this.points,ht=st(ct,"x")||0,mt=st(ct,"y")||0,dt=at(ct,"x")||0,ft=at(ct,"y")||0,ut=dt-ht,pt=ft-mt;return{left:ht,top:mt,width:ut,height:pt}},toObject:function(ct){return ot(this.callSuper("toObject",ct),{points:this.points.concat()})},_toSVG:function(){for(var ct=[],ht=this.pathOffset.x,mt=this.pathOffset.y,dt=nt.Object.NUM_FRACTION_DIGITS,ft=0,ut=this.points.length;ft<ut;ft++)ct.push(lt(this.points[ft].x-ht,dt),",",lt(this.points[ft].y-mt,dt)," ");return["<"+this.type+" ","COMMON_PARTS",'points="',ct.join(""),`" />
`]},commonRender:function(ct){var ht,mt=this.points.length,dt=this.pathOffset.x,ft=this.pathOffset.y;if(!mt||isNaN(this.points[mt-1].y))return!1;ct.beginPath(),ct.moveTo(this.points[0].x-dt,this.points[0].y-ft);for(var ut=0;ut<mt;ut++)ht=this.points[ut],ct.lineTo(ht.x-dt,ht.y-ft);return!0},_render:function(ct){!this.commonRender(ct)||this._renderPaintInOrder(ct)},complexity:function(){return this.get("points").length}}),nt.Polyline.ATTRIBUTE_NAMES=nt.SHARED_ATTRIBUTES.concat(),nt.Polyline.fromElementGenerator=function(ct){return function(ht,mt,dt){if(!ht)return mt(null);dt||(dt={});var ft=nt.parsePointsAttribute(ht.getAttribute("points")),ut=nt.parseAttributes(ht,nt[ct].ATTRIBUTE_NAMES);ut.fromSVG=!0,mt(new nt[ct](ft,ot(ut,dt)))}},nt.Polyline.fromElement=nt.Polyline.fromElementGenerator("Polyline"),nt.Polyline.fromObject=function(ct,ht){return nt.Object._fromObject("Polyline",ct,ht,"points")}}(o),function(rt){var nt=rt.fabric||(rt.fabric={});if(nt.Polygon){nt.warn("fabric.Polygon is already defined");return}nt.Polygon=nt.util.createClass(nt.Polyline,{type:"polygon",_render:function(ot){!this.commonRender(ot)||(ot.closePath(),this._renderPaintInOrder(ot))}}),nt.Polygon.ATTRIBUTE_NAMES=nt.SHARED_ATTRIBUTES.concat(),nt.Polygon.fromElement=nt.Polyline.fromElementGenerator("Polygon"),nt.Polygon.fromObject=function(ot,st){nt.Object._fromObject("Polygon",ot,st,"points")}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.array.min,st=nt.util.array.max,at=nt.util.object.extend,lt=Object.prototype.toString,ct=nt.util.toFixed;if(nt.Path){nt.warn("fabric.Path is already defined");return}nt.Path=nt.util.createClass(nt.Object,{type:"path",path:null,cacheProperties:nt.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:nt.Object.prototype.stateProperties.concat("path"),initialize:function(ht,mt){mt=mt||{},this.callSuper("initialize",mt),ht||(ht=[]);var dt=lt.call(ht)==="[object Array]";this.path=nt.util.makePathSimpler(dt?ht:nt.util.parsePath(ht)),this.path&&nt.Polyline.prototype._setPositionDimensions.call(this,mt)},_renderPathCommands:function(ht){var mt,dt=0,ft=0,ut=0,pt=0,At=0,gt=0,vt=-this.pathOffset.x,yt=-this.pathOffset.y;ht.beginPath();for(var bt=0,Ct=this.path.length;bt<Ct;++bt)switch(mt=this.path[bt],mt[0]){case"L":ut=mt[1],pt=mt[2],ht.lineTo(ut+vt,pt+yt);break;case"M":ut=mt[1],pt=mt[2],dt=ut,ft=pt,ht.moveTo(ut+vt,pt+yt);break;case"C":ut=mt[5],pt=mt[6],At=mt[3],gt=mt[4],ht.bezierCurveTo(mt[1]+vt,mt[2]+yt,At+vt,gt+yt,ut+vt,pt+yt);break;case"Q":ht.quadraticCurveTo(mt[1]+vt,mt[2]+yt,mt[3]+vt,mt[4]+yt),ut=mt[3],pt=mt[4],At=mt[1],gt=mt[2];break;case"z":case"Z":ut=dt,pt=ft,ht.closePath();break}},_render:function(ht){this._renderPathCommands(ht),this._renderPaintInOrder(ht)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(ht){return at(this.callSuper("toObject",ht),{path:this.path.map(function(mt){return mt.slice()})})},toDatalessObject:function(ht){var mt=this.toObject(["sourcePath"].concat(ht));return mt.sourcePath&&delete mt.path,mt},_toSVG:function(){var ht=nt.util.joinPath(this.path);return["<path ","COMMON_PARTS",'d="',ht,'" stroke-linecap="round" ',`/>
`]},_getOffsetTransform:function(){var ht=nt.Object.NUM_FRACTION_DIGITS;return" translate("+ct(-this.pathOffset.x,ht)+", "+ct(-this.pathOffset.y,ht)+")"},toClipPathSVG:function(ht){var mt=this._getOffsetTransform();return"	"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:ht,additionalTransform:mt})},toSVG:function(ht){var mt=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:ht,additionalTransform:mt})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var ht=[],mt=[],dt,ft=0,ut=0,pt=0,At=0,gt,vt=0,yt=this.path.length;vt<yt;++vt){switch(dt=this.path[vt],dt[0]){case"L":pt=dt[1],At=dt[2],gt=[];break;case"M":pt=dt[1],At=dt[2],ft=pt,ut=At,gt=[];break;case"C":gt=nt.util.getBoundsOfCurve(pt,At,dt[1],dt[2],dt[3],dt[4],dt[5],dt[6]),pt=dt[5],At=dt[6];break;case"Q":gt=nt.util.getBoundsOfCurve(pt,At,dt[1],dt[2],dt[1],dt[2],dt[3],dt[4]),pt=dt[3],At=dt[4];break;case"z":case"Z":pt=ft,At=ut;break}gt.forEach(function(Mt){ht.push(Mt.x),mt.push(Mt.y)}),ht.push(pt),mt.push(At)}var bt=ot(ht)||0,Ct=ot(mt)||0,xt=st(ht)||0,It=st(mt)||0,St=xt-bt,Ot=It-Ct;return{left:bt,top:Ct,width:St,height:Ot}}}),nt.Path.fromObject=function(ht,mt){if(typeof ht.sourcePath=="string"){var dt=ht.sourcePath;nt.loadSVGFromURL(dt,function(ft){var ut=ft[0];ut.setOptions(ht),mt&&mt(ut)})}else nt.Object._fromObject("Path",ht,mt,"path")},nt.Path.ATTRIBUTE_NAMES=nt.SHARED_ATTRIBUTES.concat(["d"]),nt.Path.fromElement=function(ht,mt,dt){var ft=nt.parseAttributes(ht,nt.Path.ATTRIBUTE_NAMES);ft.fromSVG=!0,mt(new nt.Path(ft.d,at(ft,dt)))}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.array.min,st=nt.util.array.max;nt.Group||(nt.Group=nt.util.createClass(nt.Object,nt.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(at,lt,ct){lt=lt||{},this._objects=[],ct&&this.callSuper("initialize",lt),this._objects=at||[];for(var ht=this._objects.length;ht--;)this._objects[ht].group=this;if(ct)this._updateObjectsACoords();else{var mt=lt&&lt.centerPoint;lt.originX!==void 0&&(this.originX=lt.originX),lt.originY!==void 0&&(this.originY=lt.originY),mt||this._calcBounds(),this._updateObjectsCoords(mt),delete lt.centerPoint,this.callSuper("initialize",lt)}this.setCoords()},_updateObjectsACoords:function(){for(var at=!0,lt=this._objects.length;lt--;)this._objects[lt].setCoords(at)},_updateObjectsCoords:function(lt){for(var lt=lt||this.getCenterPoint(),ct=this._objects.length;ct--;)this._updateObjectCoords(this._objects[ct],lt)},_updateObjectCoords:function(at,lt){var ct=at.left,ht=at.top,mt=!0;at.set({left:ct-lt.x,top:ht-lt.y}),at.group=this,at.setCoords(mt)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(at){var lt=!!this.group;return this._restoreObjectsState(),nt.util.resetObjectTransform(this),at&&(lt&&nt.util.removeTransformFromObject(at,this.group.calcTransformMatrix()),this._objects.push(at),at.group=this,at._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,lt?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(at){return this._restoreObjectsState(),nt.util.resetObjectTransform(this),this.remove(at),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(at){this.dirty=!0,at.group=this,at._set("canvas",this.canvas)},_onObjectRemoved:function(at){this.dirty=!0,delete at.group},_set:function(at,lt){var ct=this._objects.length;if(this.useSetOnGroup)for(;ct--;)this._objects[ct].setOnGroup(at,lt);if(at==="canvas")for(;ct--;)this._objects[ct]._set(at,lt);nt.Object.prototype._set.call(this,at,lt)},toObject:function(at){var lt=this.includeDefaultValues,ct=this._objects.filter(function(mt){return!mt.excludeFromExport}).map(function(mt){var dt=mt.includeDefaultValues;mt.includeDefaultValues=lt;var ft=mt.toObject(at);return mt.includeDefaultValues=dt,ft}),ht=nt.Object.prototype.toObject.call(this,at);return ht.objects=ct,ht},toDatalessObject:function(at){var lt,ct=this.sourcePath;if(ct)lt=ct;else{var ht=this.includeDefaultValues;lt=this._objects.map(function(dt){var ft=dt.includeDefaultValues;dt.includeDefaultValues=ht;var ut=dt.toDatalessObject(at);return dt.includeDefaultValues=ft,ut})}var mt=nt.Object.prototype.toDatalessObject.call(this,at);return mt.objects=lt,mt},render:function(at){this._transformDone=!0,this.callSuper("render",at),this._transformDone=!1},shouldCache:function(){var at=nt.Object.prototype.shouldCache.call(this);if(at){for(var lt=0,ct=this._objects.length;lt<ct;lt++)if(this._objects[lt].willDrawShadow())return this.ownCaching=!1,!1}return at},willDrawShadow:function(){if(nt.Object.prototype.willDrawShadow.call(this))return!0;for(var at=0,lt=this._objects.length;at<lt;at++)if(this._objects[at].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(at){for(var lt=0,ct=this._objects.length;lt<ct;lt++)this._objects[lt].render(at);this._drawClipPath(at)},isCacheDirty:function(at){if(this.callSuper("isCacheDirty",at))return!0;if(!this.statefullCache)return!1;for(var lt=0,ct=this._objects.length;lt<ct;lt++)if(this._objects[lt].isCacheDirty(!0)){if(this._cacheCanvas){var ht=this.cacheWidth/this.zoomX,mt=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-ht/2,-mt/2,ht,mt)}return!0}return!1},_restoreObjectsState:function(){var at=this.calcOwnMatrix();return this._objects.forEach(function(lt){nt.util.addTransformToObject(lt,at),delete lt.group,lt.setCoords()}),this},realizeTransform:function(at,lt){return nt.util.addTransformToObject(at,lt),at},destroy:function(){return this._objects.forEach(function(at){at.set("dirty",!0)}),this._restoreObjectsState()},toActiveSelection:function(){if(!!this.canvas){var at=this._objects,lt=this.canvas;this._objects=[];var ct=this.toObject();delete ct.objects;var ht=new nt.ActiveSelection([]);return ht.set(ct),ht.type="activeSelection",lt.remove(this),at.forEach(function(mt){mt.group=ht,mt.dirty=!0,lt.add(mt)}),ht.canvas=lt,ht._objects=at,lt._activeObject=ht,ht.setCoords(),ht}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){var at=!0;return this.forEachObject(function(lt){lt.setCoords(at)}),this},_calcBounds:function(at){for(var lt=[],ct=[],ht,mt,dt,ft=["tr","br","bl","tl"],ut=0,pt=this._objects.length,At,gt=ft.length;ut<pt;++ut){for(ht=this._objects[ut],dt=ht.calcACoords(),At=0;At<gt;At++)mt=ft[At],lt.push(dt[mt].x),ct.push(dt[mt].y);ht.aCoords=dt}this._getBounds(lt,ct,at)},_getBounds:function(at,lt,ct){var ht=new nt.Point(ot(at),ot(lt)),mt=new nt.Point(st(at),st(lt)),dt=ht.y||0,ft=ht.x||0,ut=mt.x-ht.x||0,pt=mt.y-ht.y||0;this.width=ut,this.height=pt,ct||this.setPositionByOrigin({x:ft,y:dt},"left","top")},_toSVG:function(at){for(var lt=["<g ","COMMON_PARTS",` >
`],ct=0,ht=this._objects.length;ct<ht;ct++)lt.push("		",this._objects[ct].toSVG(at));return lt.push(`</g>
`),lt},getSvgStyles:function(){var at=typeof this.opacity!="undefined"&&this.opacity!==1?"opacity: "+this.opacity+";":"",lt=this.visible?"":" visibility: hidden;";return[at,this.getSvgFilter(),lt].join("")},toClipPathSVG:function(at){for(var lt=[],ct=0,ht=this._objects.length;ct<ht;ct++)lt.push("	",this._objects[ct].toClipPathSVG(at));return this._createBaseClipPathSVGMarkup(lt,{reviver:at})}}),nt.Group.fromObject=function(at,lt){var ct=at.objects,ht=nt.util.object.clone(at,!0);if(delete ht.objects,typeof ct=="string"){nt.loadSVGFromURL(ct,function(mt){var dt=nt.util.groupSVGElements(mt,at,ct);dt.set(ht),lt&&lt(dt)});return}nt.util.enlivenObjects(ct,function(mt){nt.util.enlivenObjects([at.clipPath],function(dt){var ft=nt.util.object.clone(at,!0);ft.clipPath=dt[0],delete ft.objects,lt&&lt(new nt.Group(mt,ft,!0))})})})}(o),function(rt){var nt=rt.fabric||(rt.fabric={});nt.ActiveSelection||(nt.ActiveSelection=nt.util.createClass(nt.Group,{type:"activeSelection",initialize:function(ot,st){st=st||{},this._objects=ot||[];for(var at=this._objects.length;at--;)this._objects[at].group=this;st.originX&&(this.originX=st.originX),st.originY&&(this.originY=st.originY),this._calcBounds(),this._updateObjectsCoords(),nt.Object.prototype.initialize.call(this,st),this.setCoords()},toGroup:function(){var ot=this._objects.concat();this._objects=[];var st=nt.Object.prototype.toObject.call(this),at=new nt.Group([]);if(delete st.type,at.set(st),ot.forEach(function(ct){ct.canvas.remove(ct),ct.group=at}),at._objects=ot,!this.canvas)return at;var lt=this.canvas;return lt.add(at),lt._activeObject=at,at.setCoords(),at},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(ot,st,at){ot.save(),ot.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",ot,st),at=at||{},typeof at.hasControls=="undefined"&&(at.hasControls=!1),at.forActiveSelection=!0;for(var lt=0,ct=this._objects.length;lt<ct;lt++)this._objects[lt]._renderControls(ot,at);ot.restore()}}),nt.ActiveSelection.fromObject=function(ot,st){nt.util.enlivenObjects(ot.objects,function(at){delete ot.objects,st&&st(new nt.ActiveSelection(at,ot,!0))})})}(o),function(rt){var nt=s.util.object.extend;if(rt.fabric||(rt.fabric={}),rt.fabric.Image){s.warn("fabric.Image is already defined.");return}s.Image=s.util.createClass(s.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:s.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:s.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(ot,st){st||(st={}),this.filters=[],this.cacheKey="texture"+s.Object.__uid++,this.callSuper("initialize",st),this._initElement(ot,st)},getElement:function(){return this._element||{}},setElement:function(ot,st){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=ot,this._originalElement=ot,this._initConfig(st),this.filters.length!==0&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(ot){var st=s.filterBackend;st&&st.evictCachesForKey&&st.evictCachesForKey(ot)},dispose:function(){this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(ot){s.util.cleanUpJsdomNode(this[ot]),this[ot]=void 0}.bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var ot=this.getElement();return{width:ot.naturalWidth||ot.width,height:ot.naturalHeight||ot.height}},_stroke:function(ot){if(!(!this.stroke||this.strokeWidth===0)){var st=this.width/2,at=this.height/2;ot.beginPath(),ot.moveTo(-st,-at),ot.lineTo(st,-at),ot.lineTo(st,at),ot.lineTo(-st,at),ot.lineTo(-st,-at),ot.closePath()}},toObject:function(ot){var st=[];this.filters.forEach(function(lt){lt&&st.push(lt.toObject())});var at=nt(this.callSuper("toObject",["cropX","cropY"].concat(ot)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:st});return this.resizeFilter&&(at.resizeFilter=this.resizeFilter.toObject()),at},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var ot=[],st=[],at,lt=this._element,ct=-this.width/2,ht=-this.height/2,mt="",dt="";if(!lt)return[];if(this.hasCrop()){var ft=s.Object.__uid++;ot.push('<clipPath id="imageCrop_'+ft+`">
`,'	<rect x="'+ct+'" y="'+ht+'" width="'+this.width+'" height="'+this.height+`" />
`,`</clipPath>
`),mt=' clip-path="url(#imageCrop_'+ft+')" '}if(this.imageSmoothing||(dt='" image-rendering="optimizeSpeed'),st.push("	<image ","COMMON_PARTS",'xlink:href="',this.getSvgSrc(!0),'" x="',ct-this.cropX,'" y="',ht-this.cropY,'" width="',lt.width||lt.naturalWidth,'" height="',lt.height||lt.height,dt,'"',mt,`></image>
`),this.stroke||this.strokeDashArray){var ut=this.fill;this.fill=null,at=["	<rect ",'x="',ct,'" y="',ht,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),`"/>
`],this.fill=ut}return this.paintFirst!=="fill"?ot=ot.concat(at,st):ot=ot.concat(st,at),ot},getSrc:function(ot){var st=ot?this._element:this._originalElement;return st?st.toDataURL?st.toDataURL():this.srcFromAttribute?st.getAttribute("src"):st.src:this.src||""},setSrc:function(ot,st,at){return s.util.loadImage(ot,function(lt,ct){this.setElement(lt,at),this._setWidthHeight(),st&&st(this,ct)},this,at&&at.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var ot=this.resizeFilter,st=this.minimumScaleTrigger,at=this.getTotalObjectScaling(),lt=at.scaleX,ct=at.scaleY,ht=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!ot||lt>st&&ct>st){this._element=ht,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=lt,this._lastScaleY=ct;return}s.filterBackend||(s.filterBackend=s.initFilterBackend());var mt=s.util.createCanvasElement(),dt=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,ft=ht.width,ut=ht.height;mt.width=ft,mt.height=ut,this._element=mt,this._lastScaleX=ot.scaleX=lt,this._lastScaleY=ot.scaleY=ct,s.filterBackend.applyFilters([ot],ht,ft,ut,this._element,dt),this._filterScalingX=mt.width/this._originalElement.width,this._filterScalingY=mt.height/this._originalElement.height},applyFilters:function(ot){if(ot=ot||this.filters||[],ot=ot.filter(function(ht){return ht&&!ht.isNeutralState()}),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),ot.length===0)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var st=this._originalElement,at=st.naturalWidth||st.width,lt=st.naturalHeight||st.height;if(this._element===this._originalElement){var ct=s.util.createCanvasElement();ct.width=at,ct.height=lt,this._element=ct,this._filteredEl=ct}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,at,lt),this._lastScaleX=1,this._lastScaleY=1;return s.filterBackend||(s.filterBackend=s.initFilterBackend()),s.filterBackend.applyFilters(ot,this._originalElement,at,lt,this._element,this.cacheKey),(this._originalElement.width!==this._element.width||this._originalElement.height!==this._element.height)&&(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(ot){s.util.setImageSmoothing(ot,this.imageSmoothing),this.isMoving!==!0&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(ot),this._renderPaintInOrder(ot)},drawCacheOnCanvas:function(ot){s.util.setImageSmoothing(ot,this.imageSmoothing),s.Object.prototype.drawCacheOnCanvas.call(this,ot)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(ot){var st=this._element;if(!!st){var at=this._filterScalingX,lt=this._filterScalingY,ct=this.width,ht=this.height,mt=Math.min,dt=Math.max,ft=dt(this.cropX,0),ut=dt(this.cropY,0),pt=st.naturalWidth||st.width,At=st.naturalHeight||st.height,gt=ft*at,vt=ut*lt,yt=mt(ct*at,pt-gt),bt=mt(ht*lt,At-vt),Ct=-ct/2,xt=-ht/2,It=mt(ct,pt/at-ft),St=mt(ht,At/lt-ut);st&&ot.drawImage(st,gt,vt,yt,bt,Ct,xt,It,St)}},_needsResize:function(){var ot=this.getTotalObjectScaling();return ot.scaleX!==this._lastScaleX||ot.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(ot,st){this.setElement(s.util.getById(ot),st),s.util.addClass(this.getElement(),s.Image.CSS_CANVAS)},_initConfig:function(ot){ot||(ot={}),this.setOptions(ot),this._setWidthHeight(ot)},_initFilters:function(ot,st){ot&&ot.length?s.util.enlivenObjects(ot,function(at){st&&st(at)},"fabric.Image.filters"):st&&st()},_setWidthHeight:function(ot){ot||(ot={});var st=this.getElement();this.width=ot.width||st.naturalWidth||st.width||0,this.height=ot.height||st.naturalHeight||st.height||0},parsePreserveAspectRatioAttribute:function(){var ot=s.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),st=this._element.width,at=this._element.height,lt=1,ct=1,ht=0,mt=0,dt=0,ft=0,ut,pt=this.width,At=this.height,gt={width:pt,height:At};return ot&&(ot.alignX!=="none"||ot.alignY!=="none")?(ot.meetOrSlice==="meet"&&(lt=ct=s.util.findScaleToFit(this._element,gt),ut=(pt-st*lt)/2,ot.alignX==="Min"&&(ht=-ut),ot.alignX==="Max"&&(ht=ut),ut=(At-at*ct)/2,ot.alignY==="Min"&&(mt=-ut),ot.alignY==="Max"&&(mt=ut)),ot.meetOrSlice==="slice"&&(lt=ct=s.util.findScaleToCover(this._element,gt),ut=st-pt/lt,ot.alignX==="Mid"&&(dt=ut/2),ot.alignX==="Max"&&(dt=ut),ut=at-At/ct,ot.alignY==="Mid"&&(ft=ut/2),ot.alignY==="Max"&&(ft=ut),st=pt/lt,at=At/ct)):(lt=pt/st,ct=At/at),{width:st,height:at,scaleX:lt,scaleY:ct,offsetLeft:ht,offsetTop:mt,cropX:dt,cropY:ft}}}),s.Image.CSS_CANVAS="canvas-img",s.Image.prototype.getSvgSrc=s.Image.prototype.getSrc,s.Image.fromObject=function(ot,st){var at=s.util.object.clone(ot);s.util.loadImage(at.src,function(lt,ct){if(ct){st&&st(null,!0);return}s.Image.prototype._initFilters.call(at,at.filters,function(ht){at.filters=ht||[],s.Image.prototype._initFilters.call(at,[at.resizeFilter],function(mt){at.resizeFilter=mt[0],s.util.enlivenObjects([at.clipPath],function(dt){at.clipPath=dt[0];var ft=new s.Image(lt,at);st(ft,!1)})})})},null,at.crossOrigin)},s.Image.fromURL=function(ot,st,at){s.util.loadImage(ot,function(lt,ct){st&&st(new s.Image(lt,at),ct)},null,at&&at.crossOrigin)},s.Image.ATTRIBUTE_NAMES=s.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),s.Image.fromElement=function(ot,st,at){var lt=s.parseAttributes(ot,s.Image.ATTRIBUTE_NAMES);s.Image.fromURL(lt["xlink:href"],st,nt(at?s.util.object.clone(at):{},lt))}}(o),s.util.object.extend(s.Object.prototype,{_getAngleValueForStraighten:function(){var rt=this.angle%360;return rt>0?Math.round((rt-1)/90)*90:Math.round(rt/90)*90},straighten:function(){return this.rotate(this._getAngleValueForStraighten()),this},fxStraighten:function(rt){rt=rt||{};var nt=function(){},ot=rt.onComplete||nt,st=rt.onChange||nt,at=this;return s.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(lt){at.rotate(lt),st()},onComplete:function(){at.setCoords(),ot()}}),this}}),s.util.object.extend(s.StaticCanvas.prototype,{straightenObject:function(rt){return rt.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(rt){return rt.fxStraighten({onChange:this.requestRenderAllBound}),this}}),function(){function rt(ot,st){var at="precision "+st+` float;
void main(){}`,lt=ot.createShader(ot.FRAGMENT_SHADER);return ot.shaderSource(lt,at),ot.compileShader(lt),!!ot.getShaderParameter(lt,ot.COMPILE_STATUS)}s.isWebglSupported=function(ot){if(s.isLikelyNode)return!1;ot=ot||s.WebglFilterBackend.prototype.tileSize;var st=document.createElement("canvas"),at=st.getContext("webgl")||st.getContext("experimental-webgl"),lt=!1;if(at){s.maxTextureSize=at.getParameter(at.MAX_TEXTURE_SIZE),lt=s.maxTextureSize>=ot;for(var ct=["highp","mediump","lowp"],ht=0;ht<3;ht++)if(rt(at,ct[ht])){s.webGlPrecision=ct[ht];break}}return this.isSupported=lt,lt},s.WebglFilterBackend=nt;function nt(ot){ot&&ot.tileSize&&(this.tileSize=ot.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}nt.prototype={tileSize:2048,resources:{},setupGLContext:function(ot,st){this.dispose(),this.createWebGLCanvas(ot,st),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(ot,st)},chooseFastestCopyGLTo2DMethod:function(ot,st){var at=typeof window.performance!="undefined",lt;try{new ImageData(1,1),lt=!0}catch{lt=!1}var ct=typeof ArrayBuffer!="undefined",ht=typeof Uint8ClampedArray!="undefined";if(!!(at&&lt&&ct&&ht)){var mt=s.util.createCanvasElement(),dt=new ArrayBuffer(ot*st*4);if(s.forceGLPutImageData){this.imageBuffer=dt,this.copyGLTo2D=tt;return}var ft={imageBuffer:dt,destinationWidth:ot,destinationHeight:st,targetCanvas:mt},ut,pt,At;mt.width=ot,mt.height=st,ut=window.performance.now(),it.call(ft,this.gl,ft),pt=window.performance.now()-ut,ut=window.performance.now(),tt.call(ft,this.gl,ft),At=window.performance.now()-ut,pt>At?(this.imageBuffer=dt,this.copyGLTo2D=tt):this.copyGLTo2D=it}},createWebGLCanvas:function(ot,st){var at=s.util.createCanvasElement();at.width=ot,at.height=st;var lt={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},ct=at.getContext("webgl",lt);ct||(ct=at.getContext("experimental-webgl",lt)),ct&&(ct.clearColor(0,0,0,0),this.canvas=at,this.gl=ct)},applyFilters:function(ot,st,at,lt,ct,ht){var mt=this.gl,dt;ht&&(dt=this.getCachedTexture(ht,st));var ft={originalWidth:st.width||st.originalWidth,originalHeight:st.height||st.originalHeight,sourceWidth:at,sourceHeight:lt,destinationWidth:at,destinationHeight:lt,context:mt,sourceTexture:this.createTexture(mt,at,lt,!dt&&st),targetTexture:this.createTexture(mt,at,lt),originalTexture:dt||this.createTexture(mt,at,lt,!dt&&st),passes:ot.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:ct},ut=mt.createFramebuffer();return mt.bindFramebuffer(mt.FRAMEBUFFER,ut),ot.forEach(function(pt){pt&&pt.applyTo(ft)}),et(ft),this.copyGLTo2D(mt,ft),mt.bindTexture(mt.TEXTURE_2D,null),mt.deleteTexture(ft.sourceTexture),mt.deleteTexture(ft.targetTexture),mt.deleteFramebuffer(ut),ct.getContext("2d").setTransform(1,0,0,1,0,0),ft},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(ot,st,at,lt){var ct=ot.createTexture();return ot.bindTexture(ot.TEXTURE_2D,ct),ot.texParameteri(ot.TEXTURE_2D,ot.TEXTURE_MAG_FILTER,ot.NEAREST),ot.texParameteri(ot.TEXTURE_2D,ot.TEXTURE_MIN_FILTER,ot.NEAREST),ot.texParameteri(ot.TEXTURE_2D,ot.TEXTURE_WRAP_S,ot.CLAMP_TO_EDGE),ot.texParameteri(ot.TEXTURE_2D,ot.TEXTURE_WRAP_T,ot.CLAMP_TO_EDGE),lt?ot.texImage2D(ot.TEXTURE_2D,0,ot.RGBA,ot.RGBA,ot.UNSIGNED_BYTE,lt):ot.texImage2D(ot.TEXTURE_2D,0,ot.RGBA,st,at,0,ot.RGBA,ot.UNSIGNED_BYTE,null),ct},getCachedTexture:function(ot,st){if(this.textureCache[ot])return this.textureCache[ot];var at=this.createTexture(this.gl,st.width,st.height,st);return this.textureCache[ot]=at,at},evictCachesForKey:function(ot){this.textureCache[ot]&&(this.gl.deleteTexture(this.textureCache[ot]),delete this.textureCache[ot])},copyGLTo2D:it,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var ot=this.gl,st={renderer:"",vendor:""};if(!ot)return st;var at=ot.getExtension("WEBGL_debug_renderer_info");if(at){var lt=ot.getParameter(at.UNMASKED_RENDERER_WEBGL),ct=ot.getParameter(at.UNMASKED_VENDOR_WEBGL);lt&&(st.renderer=lt.toLowerCase()),ct&&(st.vendor=ct.toLowerCase())}return this.gpuInfo=st,st}}}();function et(rt){var nt=rt.targetCanvas,ot=nt.width,st=nt.height,at=rt.destinationWidth,lt=rt.destinationHeight;(ot!==at||st!==lt)&&(nt.width=at,nt.height=lt)}function it(rt,nt){var ot=rt.canvas,st=nt.targetCanvas,at=st.getContext("2d");at.translate(0,st.height),at.scale(1,-1);var lt=ot.height-st.height;at.drawImage(ot,0,lt,st.width,st.height,0,0,st.width,st.height)}function tt(rt,nt){var ot=nt.targetCanvas,st=ot.getContext("2d"),at=nt.destinationWidth,lt=nt.destinationHeight,ct=at*lt*4,ht=new Uint8Array(this.imageBuffer,0,ct),mt=new Uint8ClampedArray(this.imageBuffer,0,ct);rt.readPixels(0,0,at,lt,rt.RGBA,rt.UNSIGNED_BYTE,ht);var dt=new ImageData(mt,at,lt);st.putImageData(dt,0,0)}(function(){var rt=function(){};s.Canvas2dFilterBackend=nt;function nt(){}nt.prototype={evictCachesForKey:rt,dispose:rt,clearWebGLCaches:rt,resources:{},applyFilters:function(ot,st,at,lt,ct){var ht=ct.getContext("2d");ht.drawImage(st,0,0,at,lt);var mt=ht.getImageData(0,0,at,lt),dt=ht.getImageData(0,0,at,lt),ft={sourceWidth:at,sourceHeight:lt,imageData:mt,originalEl:st,originalImageData:dt,canvasEl:ct,ctx:ht,filterBackend:this};return ot.forEach(function(ut){ut.applyTo(ft)}),(ft.imageData.width!==at||ft.imageData.height!==lt)&&(ct.width=ft.imageData.width,ct.height=ft.imageData.height),ht.putImageData(ft.imageData,0,0),ft}}})(),s.Image=s.Image||{},s.Image.filters=s.Image.filters||{},s.Image.filters.BaseFilter=s.util.createClass({type:"BaseFilter",vertexSource:`attribute vec2 aPosition;
varying vec2 vTexCoord;
void main() {
vTexCoord = aPosition;
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
}`,fragmentSource:`precision highp float;
varying vec2 vTexCoord;
uniform sampler2D uTexture;
void main() {
gl_FragColor = texture2D(uTexture, vTexCoord);
}`,initialize:function(rt){rt&&this.setOptions(rt)},setOptions:function(rt){for(var nt in rt)this[nt]=rt[nt]},createProgram:function(rt,nt,ot){nt=nt||this.fragmentSource,ot=ot||this.vertexSource,s.webGlPrecision!=="highp"&&(nt=nt.replace(/precision highp float/g,"precision "+s.webGlPrecision+" float"));var st=rt.createShader(rt.VERTEX_SHADER);if(rt.shaderSource(st,ot),rt.compileShader(st),!rt.getShaderParameter(st,rt.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+rt.getShaderInfoLog(st));var at=rt.createShader(rt.FRAGMENT_SHADER);if(rt.shaderSource(at,nt),rt.compileShader(at),!rt.getShaderParameter(at,rt.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+rt.getShaderInfoLog(at));var lt=rt.createProgram();if(rt.attachShader(lt,st),rt.attachShader(lt,at),rt.linkProgram(lt),!rt.getProgramParameter(lt,rt.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+rt.getProgramInfoLog(lt));var ct=this.getAttributeLocations(rt,lt),ht=this.getUniformLocations(rt,lt)||{};return ht.uStepW=rt.getUniformLocation(lt,"uStepW"),ht.uStepH=rt.getUniformLocation(lt,"uStepH"),{program:lt,attributeLocations:ct,uniformLocations:ht}},getAttributeLocations:function(rt,nt){return{aPosition:rt.getAttribLocation(nt,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(rt,nt,ot){var st=nt.aPosition,at=rt.createBuffer();rt.bindBuffer(rt.ARRAY_BUFFER,at),rt.enableVertexAttribArray(st),rt.vertexAttribPointer(st,2,rt.FLOAT,!1,0,0),rt.bufferData(rt.ARRAY_BUFFER,ot,rt.STATIC_DRAW)},_setupFrameBuffer:function(rt){var nt=rt.context,ot,st;rt.passes>1?(ot=rt.destinationWidth,st=rt.destinationHeight,(rt.sourceWidth!==ot||rt.sourceHeight!==st)&&(nt.deleteTexture(rt.targetTexture),rt.targetTexture=rt.filterBackend.createTexture(nt,ot,st)),nt.framebufferTexture2D(nt.FRAMEBUFFER,nt.COLOR_ATTACHMENT0,nt.TEXTURE_2D,rt.targetTexture,0)):(nt.bindFramebuffer(nt.FRAMEBUFFER,null),nt.finish())},_swapTextures:function(rt){rt.passes--,rt.pass++;var nt=rt.targetTexture;rt.targetTexture=rt.sourceTexture,rt.sourceTexture=nt},isNeutralState:function(){var rt=this.mainParameter,nt=s.Image.filters[this.type].prototype;if(rt)if(Array.isArray(nt[rt])){for(var ot=nt[rt].length;ot--;)if(this[rt][ot]!==nt[rt][ot])return!1;return!0}else return nt[rt]===this[rt];else return!1},applyTo:function(rt){rt.webgl?(this._setupFrameBuffer(rt),this.applyToWebGL(rt),this._swapTextures(rt)):this.applyTo2d(rt)},retrieveShader:function(rt){return rt.programCache.hasOwnProperty(this.type)||(rt.programCache[this.type]=this.createProgram(rt.context)),rt.programCache[this.type]},applyToWebGL:function(rt){var nt=rt.context,ot=this.retrieveShader(rt);rt.pass===0&&rt.originalTexture?nt.bindTexture(nt.TEXTURE_2D,rt.originalTexture):nt.bindTexture(nt.TEXTURE_2D,rt.sourceTexture),nt.useProgram(ot.program),this.sendAttributeData(nt,ot.attributeLocations,rt.aPosition),nt.uniform1f(ot.uniformLocations.uStepW,1/rt.sourceWidth),nt.uniform1f(ot.uniformLocations.uStepH,1/rt.sourceHeight),this.sendUniformData(nt,ot.uniformLocations),nt.viewport(0,0,rt.destinationWidth,rt.destinationHeight),nt.drawArrays(nt.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(rt,nt,ot){rt.activeTexture(ot),rt.bindTexture(rt.TEXTURE_2D,nt),rt.activeTexture(rt.TEXTURE0)},unbindAdditionalTexture:function(rt,nt){rt.activeTexture(nt),rt.bindTexture(rt.TEXTURE_2D,null),rt.activeTexture(rt.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(rt){this[this.mainParameter]=rt},sendUniformData:function(){},createHelpLayer:function(rt){if(!rt.helpLayer){var nt=document.createElement("canvas");nt.width=rt.sourceWidth,nt.height=rt.sourceHeight,rt.helpLayer=nt}},toObject:function(){var rt={type:this.type},nt=this.mainParameter;return nt&&(rt[nt]=this[nt]),rt},toJSON:function(){return this.toObject()}}),s.Image.filters.BaseFilter.fromObject=function(rt,nt){var ot=new s.Image.filters[rt.type](rt);return nt&&nt(ot),ot},function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.ColorMatrix=st(ot.BaseFilter,{type:"ColorMatrix",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
varying vec2 vTexCoord;
uniform mat4 uColorMatrix;
uniform vec4 uConstants;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color *= uColorMatrix;
color += uConstants;
gl_FragColor = color;
}`,matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(at){this.callSuper("initialize",at),this.matrix=this.matrix.slice(0)},applyTo2d:function(at){var lt=at.imageData,ct=lt.data,ht=ct.length,mt=this.matrix,dt,ft,ut,pt,At,gt=this.colorsOnly;for(At=0;At<ht;At+=4)dt=ct[At],ft=ct[At+1],ut=ct[At+2],gt?(ct[At]=dt*mt[0]+ft*mt[1]+ut*mt[2]+mt[4]*255,ct[At+1]=dt*mt[5]+ft*mt[6]+ut*mt[7]+mt[9]*255,ct[At+2]=dt*mt[10]+ft*mt[11]+ut*mt[12]+mt[14]*255):(pt=ct[At+3],ct[At]=dt*mt[0]+ft*mt[1]+ut*mt[2]+pt*mt[3]+mt[4]*255,ct[At+1]=dt*mt[5]+ft*mt[6]+ut*mt[7]+pt*mt[8]+mt[9]*255,ct[At+2]=dt*mt[10]+ft*mt[11]+ut*mt[12]+pt*mt[13]+mt[14]*255,ct[At+3]=dt*mt[15]+ft*mt[16]+ut*mt[17]+pt*mt[18]+mt[19]*255)},getUniformLocations:function(at,lt){return{uColorMatrix:at.getUniformLocation(lt,"uColorMatrix"),uConstants:at.getUniformLocation(lt,"uConstants")}},sendUniformData:function(at,lt){var ct=this.matrix,ht=[ct[0],ct[1],ct[2],ct[3],ct[5],ct[6],ct[7],ct[8],ct[10],ct[11],ct[12],ct[13],ct[15],ct[16],ct[17],ct[18]],mt=[ct[4],ct[9],ct[14],ct[19]];at.uniformMatrix4fv(lt.uColorMatrix,!1,ht),at.uniform4fv(lt.uConstants,mt)}}),nt.Image.filters.ColorMatrix.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Brightness=st(ot.BaseFilter,{type:"Brightness",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uBrightness;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color.rgb += uBrightness;
gl_FragColor = color;
}`,brightness:0,mainParameter:"brightness",applyTo2d:function(at){if(this.brightness!==0){var lt=at.imageData,ct=lt.data,ht,mt=ct.length,dt=Math.round(this.brightness*255);for(ht=0;ht<mt;ht+=4)ct[ht]=ct[ht]+dt,ct[ht+1]=ct[ht+1]+dt,ct[ht+2]=ct[ht+2]+dt}},getUniformLocations:function(at,lt){return{uBrightness:at.getUniformLocation(lt,"uBrightness")}},sendUniformData:function(at,lt){at.uniform1f(lt.uBrightness,this.brightness)}}),nt.Image.filters.Brightness.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.extend,st=nt.Image.filters,at=nt.util.createClass;st.Convolute=at(st.BaseFilter,{type:"Convolute",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[9];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 3.0; h+=1.0) {
for (float w = 0.0; w < 3.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];
}
}
gl_FragColor = color;
}`,Convolute_3_0:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[9];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 3.0; h+=1.0) {
for (float w = 0.0; w < 3.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,Convolute_5_1:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[25];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 5.0; h+=1.0) {
for (float w = 0.0; w < 5.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];
}
}
gl_FragColor = color;
}`,Convolute_5_0:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[25];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 5.0; h+=1.0) {
for (float w = 0.0; w < 5.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,Convolute_7_1:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[49];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 7.0; h+=1.0) {
for (float w = 0.0; w < 7.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];
}
}
gl_FragColor = color;
}`,Convolute_7_0:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[49];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 7.0; h+=1.0) {
for (float w = 0.0; w < 7.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,Convolute_9_1:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[81];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 9.0; h+=1.0) {
for (float w = 0.0; w < 9.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];
}
}
gl_FragColor = color;
}`,Convolute_9_0:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[81];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 9.0; h+=1.0) {
for (float w = 0.0; w < 9.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`},retrieveShader:function(lt){var ct=Math.sqrt(this.matrix.length),ht=this.type+"_"+ct+"_"+(this.opaque?1:0),mt=this.fragmentSource[ht];return lt.programCache.hasOwnProperty(ht)||(lt.programCache[ht]=this.createProgram(lt.context,mt)),lt.programCache[ht]},applyTo2d:function(lt){var ct=lt.imageData,ht=ct.data,mt=this.matrix,dt=Math.round(Math.sqrt(mt.length)),ft=Math.floor(dt/2),ut=ct.width,pt=ct.height,At=lt.ctx.createImageData(ut,pt),gt=At.data,vt=this.opaque?1:0,yt,bt,Ct,xt,It,St,Ot,Mt,jt,Ft,Ut,Qt,Ht;for(Ut=0;Ut<pt;Ut++)for(Ft=0;Ft<ut;Ft++){for(It=(Ut*ut+Ft)*4,yt=0,bt=0,Ct=0,xt=0,Ht=0;Ht<dt;Ht++)for(Qt=0;Qt<dt;Qt++)Ot=Ut+Ht-ft,St=Ft+Qt-ft,!(Ot<0||Ot>=pt||St<0||St>=ut)&&(Mt=(Ot*ut+St)*4,jt=mt[Ht*dt+Qt],yt+=ht[Mt]*jt,bt+=ht[Mt+1]*jt,Ct+=ht[Mt+2]*jt,vt||(xt+=ht[Mt+3]*jt));gt[It]=yt,gt[It+1]=bt,gt[It+2]=Ct,vt?gt[It+3]=ht[It+3]:gt[It+3]=xt}lt.imageData=At},getUniformLocations:function(lt,ct){return{uMatrix:lt.getUniformLocation(ct,"uMatrix"),uOpaque:lt.getUniformLocation(ct,"uOpaque"),uHalfSize:lt.getUniformLocation(ct,"uHalfSize"),uSize:lt.getUniformLocation(ct,"uSize")}},sendUniformData:function(lt,ct){lt.uniform1fv(ct.uMatrix,this.matrix)},toObject:function(){return ot(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),nt.Image.filters.Convolute.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Grayscale=st(ot.BaseFilter,{type:"Grayscale",fragmentSource:{average:`precision highp float;
uniform sampler2D uTexture;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float average = (color.r + color.b + color.g) / 3.0;
gl_FragColor = vec4(average, average, average, color.a);
}`,lightness:`precision highp float;
uniform sampler2D uTexture;
uniform int uMode;
varying vec2 vTexCoord;
void main() {
vec4 col = texture2D(uTexture, vTexCoord);
float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;
gl_FragColor = vec4(average, average, average, col.a);
}`,luminosity:`precision highp float;
uniform sampler2D uTexture;
uniform int uMode;
varying vec2 vTexCoord;
void main() {
vec4 col = texture2D(uTexture, vTexCoord);
float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;
gl_FragColor = vec4(average, average, average, col.a);
}`},mode:"average",mainParameter:"mode",applyTo2d:function(at){var lt=at.imageData,ct=lt.data,ht,mt=ct.length,dt,ft=this.mode;for(ht=0;ht<mt;ht+=4)ft==="average"?dt=(ct[ht]+ct[ht+1]+ct[ht+2])/3:ft==="lightness"?dt=(Math.min(ct[ht],ct[ht+1],ct[ht+2])+Math.max(ct[ht],ct[ht+1],ct[ht+2]))/2:ft==="luminosity"&&(dt=.21*ct[ht]+.72*ct[ht+1]+.07*ct[ht+2]),ct[ht]=dt,ct[ht+1]=dt,ct[ht+2]=dt},retrieveShader:function(at){var lt=this.type+"_"+this.mode;if(!at.programCache.hasOwnProperty(lt)){var ct=this.fragmentSource[this.mode];at.programCache[lt]=this.createProgram(at.context,ct)}return at.programCache[lt]},getUniformLocations:function(at,lt){return{uMode:at.getUniformLocation(lt,"uMode")}},sendUniformData:function(at,lt){var ct=1;at.uniform1i(lt.uMode,ct)},isNeutralState:function(){return!1}}),nt.Image.filters.Grayscale.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Invert=st(ot.BaseFilter,{type:"Invert",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform int uInvert;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
if (uInvert == 1) {
gl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);
} else {
gl_FragColor = color;
}
}`,invert:!0,mainParameter:"invert",applyTo2d:function(at){var lt=at.imageData,ct=lt.data,ht,mt=ct.length;for(ht=0;ht<mt;ht+=4)ct[ht]=255-ct[ht],ct[ht+1]=255-ct[ht+1],ct[ht+2]=255-ct[ht+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(at,lt){return{uInvert:at.getUniformLocation(lt,"uInvert")}},sendUniformData:function(at,lt){at.uniform1i(lt.uInvert,this.invert)}}),nt.Image.filters.Invert.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.extend,st=nt.Image.filters,at=nt.util.createClass;st.Noise=at(st.BaseFilter,{type:"Noise",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uStepH;
uniform float uNoise;
uniform float uSeed;
varying vec2 vTexCoord;
float rand(vec2 co, float seed, float vScale) {
return fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);
}
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;
gl_FragColor = color;
}`,mainParameter:"noise",noise:0,applyTo2d:function(lt){if(this.noise!==0){var ct=lt.imageData,ht=ct.data,mt,dt=ht.length,ft=this.noise,ut;for(mt=0,dt=ht.length;mt<dt;mt+=4)ut=(.5-Math.random())*ft,ht[mt]+=ut,ht[mt+1]+=ut,ht[mt+2]+=ut}},getUniformLocations:function(lt,ct){return{uNoise:lt.getUniformLocation(ct,"uNoise"),uSeed:lt.getUniformLocation(ct,"uSeed")}},sendUniformData:function(lt,ct){lt.uniform1f(ct.uNoise,this.noise/255),lt.uniform1f(ct.uSeed,Math.random())},toObject:function(){return ot(this.callSuper("toObject"),{noise:this.noise})}}),nt.Image.filters.Noise.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Pixelate=st(ot.BaseFilter,{type:"Pixelate",blocksize:4,mainParameter:"blocksize",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uBlocksize;
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
float blockW = uBlocksize * uStepW;
float blockH = uBlocksize * uStepW;
int posX = int(vTexCoord.x / blockW);
int posY = int(vTexCoord.y / blockH);
float fposX = float(posX);
float fposY = float(posY);
vec2 squareCoords = vec2(fposX * blockW, fposY * blockH);
vec4 color = texture2D(uTexture, squareCoords);
gl_FragColor = color;
}`,applyTo2d:function(at){var lt=at.imageData,ct=lt.data,ht=lt.height,mt=lt.width,dt,ft,ut,pt,At,gt,vt,yt,bt,Ct,xt;for(ft=0;ft<ht;ft+=this.blocksize)for(ut=0;ut<mt;ut+=this.blocksize)for(dt=ft*4*mt+ut*4,pt=ct[dt],At=ct[dt+1],gt=ct[dt+2],vt=ct[dt+3],Ct=Math.min(ft+this.blocksize,ht),xt=Math.min(ut+this.blocksize,mt),yt=ft;yt<Ct;yt++)for(bt=ut;bt<xt;bt++)dt=yt*4*mt+bt*4,ct[dt]=pt,ct[dt+1]=At,ct[dt+2]=gt,ct[dt+3]=vt},isNeutralState:function(){return this.blocksize===1},getUniformLocations:function(at,lt){return{uBlocksize:at.getUniformLocation(lt,"uBlocksize"),uStepW:at.getUniformLocation(lt,"uStepW"),uStepH:at.getUniformLocation(lt,"uStepH")}},sendUniformData:function(at,lt){at.uniform1f(lt.uBlocksize,this.blocksize)}}),nt.Image.filters.Pixelate.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.extend,st=nt.Image.filters,at=nt.util.createClass;st.RemoveColor=at(st.BaseFilter,{type:"RemoveColor",color:"#FFFFFF",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform vec4 uLow;
uniform vec4 uHigh;
varying vec2 vTexCoord;
void main() {
gl_FragColor = texture2D(uTexture, vTexCoord);
if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {
gl_FragColor.a = 0.0;
}
}`,distance:.02,useAlpha:!1,applyTo2d:function(lt){var ct=lt.imageData,ht=ct.data,mt,dt=this.distance*255,ft,ut,pt,At=new nt.Color(this.color).getSource(),gt=[At[0]-dt,At[1]-dt,At[2]-dt],vt=[At[0]+dt,At[1]+dt,At[2]+dt];for(mt=0;mt<ht.length;mt+=4)ft=ht[mt],ut=ht[mt+1],pt=ht[mt+2],ft>gt[0]&&ut>gt[1]&&pt>gt[2]&&ft<vt[0]&&ut<vt[1]&&pt<vt[2]&&(ht[mt+3]=0)},getUniformLocations:function(lt,ct){return{uLow:lt.getUniformLocation(ct,"uLow"),uHigh:lt.getUniformLocation(ct,"uHigh")}},sendUniformData:function(lt,ct){var ht=new nt.Color(this.color).getSource(),mt=parseFloat(this.distance),dt=[0+ht[0]/255-mt,0+ht[1]/255-mt,0+ht[2]/255-mt,1],ft=[ht[0]/255+mt,ht[1]/255+mt,ht[2]/255+mt,1];lt.uniform4fv(ct.uLow,dt),lt.uniform4fv(ct.uHigh,ft)},toObject:function(){return ot(this.callSuper("toObject"),{color:this.color,distance:this.distance})}}),nt.Image.filters.RemoveColor.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass,at={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(var lt in at)ot[lt]=st(ot.ColorMatrix,{type:lt,matrix:at[lt],mainParameter:!1,colorsOnly:!0}),nt.Image.filters[lt].fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric,ot=nt.Image.filters,st=nt.util.createClass;ot.BlendColor=st(ot.BaseFilter,{type:"BlendColor",color:"#F95C63",mode:"multiply",alpha:1,fragmentSource:{multiply:`gl_FragColor.rgb *= uColor.rgb;
`,screen:`gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);
`,add:`gl_FragColor.rgb += uColor.rgb;
`,diff:`gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);
`,subtract:`gl_FragColor.rgb -= uColor.rgb;
`,lighten:`gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);
`,darken:`gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);
`,exclusion:`gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);
`,overlay:`if (uColor.r < 0.5) {
gl_FragColor.r *= 2.0 * uColor.r;
} else {
gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);
}
if (uColor.g < 0.5) {
gl_FragColor.g *= 2.0 * uColor.g;
} else {
gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);
}
if (uColor.b < 0.5) {
gl_FragColor.b *= 2.0 * uColor.b;
} else {
gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);
}
`,tint:`gl_FragColor.rgb *= (1.0 - uColor.a);
gl_FragColor.rgb += uColor.rgb;
`},buildSource:function(at){return`precision highp float;
uniform sampler2D uTexture;
uniform vec4 uColor;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
gl_FragColor = color;
if (color.a > 0.0) {
`+this.fragmentSource[at]+`}
}`},retrieveShader:function(at){var lt=this.type+"_"+this.mode,ct;return at.programCache.hasOwnProperty(lt)||(ct=this.buildSource(this.mode),at.programCache[lt]=this.createProgram(at.context,ct)),at.programCache[lt]},applyTo2d:function(at){var lt=at.imageData,ct=lt.data,ht=ct.length,mt,dt,ft,ut,pt,At,gt,vt=1-this.alpha;gt=new nt.Color(this.color).getSource(),mt=gt[0]*this.alpha,dt=gt[1]*this.alpha,ft=gt[2]*this.alpha;for(var yt=0;yt<ht;yt+=4)switch(ut=ct[yt],pt=ct[yt+1],At=ct[yt+2],this.mode){case"multiply":ct[yt]=ut*mt/255,ct[yt+1]=pt*dt/255,ct[yt+2]=At*ft/255;break;case"screen":ct[yt]=255-(255-ut)*(255-mt)/255,ct[yt+1]=255-(255-pt)*(255-dt)/255,ct[yt+2]=255-(255-At)*(255-ft)/255;break;case"add":ct[yt]=ut+mt,ct[yt+1]=pt+dt,ct[yt+2]=At+ft;break;case"diff":case"difference":ct[yt]=Math.abs(ut-mt),ct[yt+1]=Math.abs(pt-dt),ct[yt+2]=Math.abs(At-ft);break;case"subtract":ct[yt]=ut-mt,ct[yt+1]=pt-dt,ct[yt+2]=At-ft;break;case"darken":ct[yt]=Math.min(ut,mt),ct[yt+1]=Math.min(pt,dt),ct[yt+2]=Math.min(At,ft);break;case"lighten":ct[yt]=Math.max(ut,mt),ct[yt+1]=Math.max(pt,dt),ct[yt+2]=Math.max(At,ft);break;case"overlay":ct[yt]=mt<128?2*ut*mt/255:255-2*(255-ut)*(255-mt)/255,ct[yt+1]=dt<128?2*pt*dt/255:255-2*(255-pt)*(255-dt)/255,ct[yt+2]=ft<128?2*At*ft/255:255-2*(255-At)*(255-ft)/255;break;case"exclusion":ct[yt]=mt+ut-2*mt*ut/255,ct[yt+1]=dt+pt-2*dt*pt/255,ct[yt+2]=ft+At-2*ft*At/255;break;case"tint":ct[yt]=mt+ut*vt,ct[yt+1]=dt+pt*vt,ct[yt+2]=ft+At*vt}},getUniformLocations:function(at,lt){return{uColor:at.getUniformLocation(lt,"uColor")}},sendUniformData:function(at,lt){var ct=new nt.Color(this.color).getSource();ct[0]=this.alpha*ct[0]/255,ct[1]=this.alpha*ct[1]/255,ct[2]=this.alpha*ct[2]/255,ct[3]=this.alpha,at.uniform4fv(lt.uColor,ct)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),nt.Image.filters.BlendColor.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric,ot=nt.Image.filters,st=nt.util.createClass;ot.BlendImage=st(ot.BaseFilter,{type:"BlendImage",image:null,mode:"multiply",alpha:1,vertexSource:`attribute vec2 aPosition;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
uniform mat3 uTransformMatrix;
void main() {
vTexCoord = aPosition;
vTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
}`,fragmentSource:{multiply:`precision highp float;
uniform sampler2D uTexture;
uniform sampler2D uImage;
uniform vec4 uColor;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec4 color2 = texture2D(uImage, vTexCoord2);
color.rgba *= color2.rgba;
gl_FragColor = color;
}`,mask:`precision highp float;
uniform sampler2D uTexture;
uniform sampler2D uImage;
uniform vec4 uColor;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec4 color2 = texture2D(uImage, vTexCoord2);
color.a = color2.a;
gl_FragColor = color;
}`},retrieveShader:function(at){var lt=this.type+"_"+this.mode,ct=this.fragmentSource[this.mode];return at.programCache.hasOwnProperty(lt)||(at.programCache[lt]=this.createProgram(at.context,ct)),at.programCache[lt]},applyToWebGL:function(at){var lt=at.context,ct=this.createTexture(at.filterBackend,this.image);this.bindAdditionalTexture(lt,ct,lt.TEXTURE1),this.callSuper("applyToWebGL",at),this.unbindAdditionalTexture(lt,lt.TEXTURE1)},createTexture:function(at,lt){return at.getCachedTexture(lt.cacheKey,lt._element)},calculateMatrix:function(){var at=this.image,lt=at._element.width,ct=at._element.height;return[1/at.scaleX,0,0,0,1/at.scaleY,0,-at.left/lt,-at.top/ct,1]},applyTo2d:function(at){var lt=at.imageData,ct=at.filterBackend.resources,ht=lt.data,mt=ht.length,dt=lt.width,ft=lt.height,ut,pt,At,gt,vt,yt,bt,Ct,xt,It,St=this.image,Ot;ct.blendImage||(ct.blendImage=nt.util.createCanvasElement()),xt=ct.blendImage,It=xt.getContext("2d"),xt.width!==dt||xt.height!==ft?(xt.width=dt,xt.height=ft):It.clearRect(0,0,dt,ft),It.setTransform(St.scaleX,0,0,St.scaleY,St.left,St.top),It.drawImage(St._element,0,0,dt,ft),Ot=It.getImageData(0,0,dt,ft).data;for(var Mt=0;Mt<mt;Mt+=4)switch(vt=ht[Mt],yt=ht[Mt+1],bt=ht[Mt+2],Ct=ht[Mt+3],ut=Ot[Mt],pt=Ot[Mt+1],At=Ot[Mt+2],gt=Ot[Mt+3],this.mode){case"multiply":ht[Mt]=vt*ut/255,ht[Mt+1]=yt*pt/255,ht[Mt+2]=bt*At/255,ht[Mt+3]=Ct*gt/255;break;case"mask":ht[Mt+3]=gt;break}},getUniformLocations:function(at,lt){return{uTransformMatrix:at.getUniformLocation(lt,"uTransformMatrix"),uImage:at.getUniformLocation(lt,"uImage")}},sendUniformData:function(at,lt){var ct=this.calculateMatrix();at.uniform1i(lt.uImage,1),at.uniformMatrix3fv(lt.uTransformMatrix,!1,ct)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),nt.Image.filters.BlendImage.fromObject=function(at,lt){nt.Image.fromObject(at.image,function(ct){var ht=nt.util.object.clone(at);ht.image=ct,lt(new nt.Image.filters.BlendImage(ht))})}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=Math.pow,st=Math.floor,at=Math.sqrt,lt=Math.abs,ct=Math.round,ht=Math.sin,mt=Math.ceil,dt=nt.Image.filters,ft=nt.util.createClass;dt.Resize=ft(dt.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(ut,pt){return{uDelta:ut.getUniformLocation(pt,"uDelta"),uTaps:ut.getUniformLocation(pt,"uTaps")}},sendUniformData:function(ut,pt){ut.uniform2fv(pt.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),ut.uniform1fv(pt.uTaps,this.taps)},retrieveShader:function(ut){var pt=this.getFilterWindow(),At=this.type+"_"+pt;if(!ut.programCache.hasOwnProperty(At)){var gt=this.generateShader(pt);ut.programCache[At]=this.createProgram(ut.context,gt)}return ut.programCache[At]},getFilterWindow:function(){var ut=this.tempScale;return Math.ceil(this.lanczosLobes/ut)},getTaps:function(){for(var ut=this.lanczosCreate(this.lanczosLobes),pt=this.tempScale,At=this.getFilterWindow(),gt=new Array(At),vt=1;vt<=At;vt++)gt[vt-1]=ut(vt*pt);return gt},generateShader:function(gt){for(var pt=new Array(gt),At=this.fragmentSourceTOP,gt,vt=1;vt<=gt;vt++)pt[vt-1]=vt+".0 * uDelta";return At+="uniform float uTaps["+gt+`];
`,At+=`void main() {
`,At+=`  vec4 color = texture2D(uTexture, vTexCoord);
`,At+=`  float sum = 1.0;
`,pt.forEach(function(yt,bt){At+="  color += texture2D(uTexture, vTexCoord + "+yt+") * uTaps["+bt+`];
`,At+="  color += texture2D(uTexture, vTexCoord - "+yt+") * uTaps["+bt+`];
`,At+="  sum += 2.0 * uTaps["+bt+`];
`}),At+=`  gl_FragColor = color / sum;
`,At+="}",At},fragmentSourceTOP:`precision highp float;
uniform sampler2D uTexture;
uniform vec2 uDelta;
varying vec2 vTexCoord;
`,applyTo:function(ut){ut.webgl?(ut.passes++,this.width=ut.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=ut.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),ut.destinationWidth=this.dW,this._setupFrameBuffer(ut),this.applyToWebGL(ut),this._swapTextures(ut),ut.sourceWidth=ut.destinationWidth,this.height=ut.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),ut.destinationHeight=this.dH,this._setupFrameBuffer(ut),this.applyToWebGL(ut),this._swapTextures(ut),ut.sourceHeight=ut.destinationHeight):this.applyTo2d(ut)},isNeutralState:function(){return this.scaleX===1&&this.scaleY===1},lanczosCreate:function(ut){return function(pt){if(pt>=ut||pt<=-ut)return 0;if(pt<11920929e-14&&pt>-11920929e-14)return 1;pt*=Math.PI;var At=pt/ut;return ht(pt)/pt*ht(At)/At}},applyTo2d:function(ut){var pt=ut.imageData,At=this.scaleX,gt=this.scaleY;this.rcpScaleX=1/At,this.rcpScaleY=1/gt;var vt=pt.width,yt=pt.height,bt=ct(vt*At),Ct=ct(yt*gt),xt;this.resizeType==="sliceHack"?xt=this.sliceByTwo(ut,vt,yt,bt,Ct):this.resizeType==="hermite"?xt=this.hermiteFastResize(ut,vt,yt,bt,Ct):this.resizeType==="bilinear"?xt=this.bilinearFiltering(ut,vt,yt,bt,Ct):this.resizeType==="lanczos"&&(xt=this.lanczosResize(ut,vt,yt,bt,Ct)),ut.imageData=xt},sliceByTwo:function(ut,pt,At,gt,vt){var yt=ut.imageData,bt=.5,Ct=!1,xt=!1,It=pt*bt,St=At*bt,Ot=nt.filterBackend.resources,Mt,jt,Ft=0,Ut=0,Qt=pt,Ht=0;for(Ot.sliceByTwo||(Ot.sliceByTwo=document.createElement("canvas")),Mt=Ot.sliceByTwo,(Mt.width<pt*1.5||Mt.height<At)&&(Mt.width=pt*1.5,Mt.height=At),jt=Mt.getContext("2d"),jt.clearRect(0,0,pt*1.5,At),jt.putImageData(yt,0,0),gt=st(gt),vt=st(vt);!Ct||!xt;)pt=It,At=St,gt<st(It*bt)?It=st(It*bt):(It=gt,Ct=!0),vt<st(St*bt)?St=st(St*bt):(St=vt,xt=!0),jt.drawImage(Mt,Ft,Ut,pt,At,Qt,Ht,It,St),Ft=Qt,Ut=Ht,Ht+=St;return jt.getImageData(Ft,Ut,gt,vt)},lanczosResize:function(ut,pt,At,gt,vt){function yt(Wt){var $t,Jt,Nt,Lt,Kt,Pt,ln,Gt,on,tn,_i;for(Ht.x=(Wt+.5)*St,Zt.x=st(Ht.x),$t=0;$t<vt;$t++){for(Ht.y=($t+.5)*Ot,Zt.y=st(Ht.y),Kt=0,Pt=0,ln=0,Gt=0,on=0,Jt=Zt.x-Ft;Jt<=Zt.x+Ft;Jt++)if(!(Jt<0||Jt>=pt)){tn=st(1e3*lt(Jt-Ht.x)),Qt[tn]||(Qt[tn]={});for(var Xt=Zt.y-Ut;Xt<=Zt.y+Ut;Xt++)Xt<0||Xt>=At||(_i=st(1e3*lt(Xt-Ht.y)),Qt[tn][_i]||(Qt[tn][_i]=It(at(ot(tn*Mt,2)+ot(_i*jt,2))/1e3)),Nt=Qt[tn][_i],Nt>0&&(Lt=(Xt*pt+Jt)*4,Kt+=Nt,Pt+=Nt*bt[Lt],ln+=Nt*bt[Lt+1],Gt+=Nt*bt[Lt+2],on+=Nt*bt[Lt+3]))}Lt=($t*gt+Wt)*4,xt[Lt]=Pt/Kt,xt[Lt+1]=ln/Kt,xt[Lt+2]=Gt/Kt,xt[Lt+3]=on/Kt}return++Wt<gt?yt(Wt):Ct}var bt=ut.imageData.data,Ct=ut.ctx.createImageData(gt,vt),xt=Ct.data,It=this.lanczosCreate(this.lanczosLobes),St=this.rcpScaleX,Ot=this.rcpScaleY,Mt=2/this.rcpScaleX,jt=2/this.rcpScaleY,Ft=mt(St*this.lanczosLobes/2),Ut=mt(Ot*this.lanczosLobes/2),Qt={},Ht={},Zt={};return yt(0)},bilinearFiltering:function(ut,pt,At,gt,vt){var yt,bt,Ct,xt,It,St,Ot,Mt,jt,Ft,Ut,Qt,Ht=0,Zt,Wt=this.rcpScaleX,$t=this.rcpScaleY,Jt=4*(pt-1),Nt=ut.imageData,Lt=Nt.data,Kt=ut.ctx.createImageData(gt,vt),Pt=Kt.data;for(Ot=0;Ot<vt;Ot++)for(Mt=0;Mt<gt;Mt++)for(It=st(Wt*Mt),St=st($t*Ot),jt=Wt*Mt-It,Ft=$t*Ot-St,Zt=4*(St*pt+It),Ut=0;Ut<4;Ut++)yt=Lt[Zt+Ut],bt=Lt[Zt+4+Ut],Ct=Lt[Zt+Jt+Ut],xt=Lt[Zt+Jt+4+Ut],Qt=yt*(1-jt)*(1-Ft)+bt*jt*(1-Ft)+Ct*Ft*(1-jt)+xt*jt*Ft,Pt[Ht++]=Qt;return Kt},hermiteFastResize:function(ut,pt,At,gt,vt){for(var yt=this.rcpScaleX,bt=this.rcpScaleY,Ct=mt(yt/2),xt=mt(bt/2),It=ut.imageData,St=It.data,Ot=ut.ctx.createImageData(gt,vt),Mt=Ot.data,jt=0;jt<vt;jt++)for(var Ft=0;Ft<gt;Ft++){for(var Ut=(Ft+jt*gt)*4,Qt=0,Ht=0,Zt=0,Wt=0,$t=0,Jt=0,Nt=0,Lt=(jt+.5)*bt,Kt=st(jt*bt);Kt<(jt+1)*bt;Kt++)for(var Pt=lt(Lt-(Kt+.5))/xt,ln=(Ft+.5)*yt,Gt=Pt*Pt,on=st(Ft*yt);on<(Ft+1)*yt;on++){var tn=lt(ln-(on+.5))/Ct,_i=at(Gt+tn*tn);_i>1&&_i<-1||(Qt=2*_i*_i*_i-3*_i*_i+1,Qt>0&&(tn=4*(on+Kt*pt),Nt+=Qt*St[tn+3],Zt+=Qt,St[tn+3]<255&&(Qt=Qt*St[tn+3]/250),Wt+=Qt*St[tn],$t+=Qt*St[tn+1],Jt+=Qt*St[tn+2],Ht+=Qt))}Mt[Ut]=Wt/Ht,Mt[Ut+1]=$t/Ht,Mt[Ut+2]=Jt/Ht,Mt[Ut+3]=Nt/Zt}return Ot},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),nt.Image.filters.Resize.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Contrast=st(ot.BaseFilter,{type:"Contrast",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uContrast;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));
color.rgb = contrastF * (color.rgb - 0.5) + 0.5;
gl_FragColor = color;
}`,contrast:0,mainParameter:"contrast",applyTo2d:function(at){if(this.contrast!==0){var lt=at.imageData,ct,mt,ht=lt.data,mt=ht.length,dt=Math.floor(this.contrast*255),ft=259*(dt+255)/(255*(259-dt));for(ct=0;ct<mt;ct+=4)ht[ct]=ft*(ht[ct]-128)+128,ht[ct+1]=ft*(ht[ct+1]-128)+128,ht[ct+2]=ft*(ht[ct+2]-128)+128}},getUniformLocations:function(at,lt){return{uContrast:at.getUniformLocation(lt,"uContrast")}},sendUniformData:function(at,lt){at.uniform1f(lt.uContrast,this.contrast)}}),nt.Image.filters.Contrast.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Saturation=st(ot.BaseFilter,{type:"Saturation",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uSaturation;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float rgMax = max(color.r, color.g);
float rgbMax = max(rgMax, color.b);
color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;
color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;
color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;
gl_FragColor = color;
}`,saturation:0,mainParameter:"saturation",applyTo2d:function(at){if(this.saturation!==0){var lt=at.imageData,ct=lt.data,ht=ct.length,mt=-this.saturation,dt,ft;for(dt=0;dt<ht;dt+=4)ft=Math.max(ct[dt],ct[dt+1],ct[dt+2]),ct[dt]+=ft!==ct[dt]?(ft-ct[dt])*mt:0,ct[dt+1]+=ft!==ct[dt+1]?(ft-ct[dt+1])*mt:0,ct[dt+2]+=ft!==ct[dt+2]?(ft-ct[dt+2])*mt:0}},getUniformLocations:function(at,lt){return{uSaturation:at.getUniformLocation(lt,"uSaturation")}},sendUniformData:function(at,lt){at.uniform1f(lt.uSaturation,-this.saturation)}}),nt.Image.filters.Saturation.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Vibrance=st(ot.BaseFilter,{type:"Vibrance",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uVibrance;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float max = max(color.r, max(color.g, color.b));
float avg = (color.r + color.g + color.b) / 3.0;
float amt = (abs(max - avg) * 2.0) * uVibrance;
color.r += max != color.r ? (max - color.r) * amt : 0.00;
color.g += max != color.g ? (max - color.g) * amt : 0.00;
color.b += max != color.b ? (max - color.b) * amt : 0.00;
gl_FragColor = color;
}`,vibrance:0,mainParameter:"vibrance",applyTo2d:function(at){if(this.vibrance!==0){var lt=at.imageData,ct=lt.data,ht=ct.length,mt=-this.vibrance,dt,ft,ut,pt;for(dt=0;dt<ht;dt+=4)ft=Math.max(ct[dt],ct[dt+1],ct[dt+2]),ut=(ct[dt]+ct[dt+1]+ct[dt+2])/3,pt=Math.abs(ft-ut)*2/255*mt,ct[dt]+=ft!==ct[dt]?(ft-ct[dt])*pt:0,ct[dt+1]+=ft!==ct[dt+1]?(ft-ct[dt+1])*pt:0,ct[dt+2]+=ft!==ct[dt+2]?(ft-ct[dt+2])*pt:0}},getUniformLocations:function(at,lt){return{uVibrance:at.getUniformLocation(lt,"uVibrance")}},sendUniformData:function(at,lt){at.uniform1f(lt.uVibrance,-this.vibrance)}}),nt.Image.filters.Vibrance.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Blur=st(ot.BaseFilter,{type:"Blur",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform vec2 uDelta;
varying vec2 vTexCoord;
const float nSamples = 15.0;
vec3 v3offset = vec3(12.9898, 78.233, 151.7182);
float random(vec3 scale) {
return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);
}
void main() {
vec4 color = vec4(0.0);
float total = 0.0;
float offset = random(v3offset);
for (float t = -nSamples; t <= nSamples; t++) {
float percent = (t + offset - 0.5) / nSamples;
float weight = 1.0 - abs(percent);
color += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;
total += weight;
}
gl_FragColor = color / total;
}`,blur:0,mainParameter:"blur",applyTo:function(at){at.webgl?(this.aspectRatio=at.sourceWidth/at.sourceHeight,at.passes++,this._setupFrameBuffer(at),this.horizontal=!0,this.applyToWebGL(at),this._swapTextures(at),this._setupFrameBuffer(at),this.horizontal=!1,this.applyToWebGL(at),this._swapTextures(at)):this.applyTo2d(at)},applyTo2d:function(at){at.imageData=this.simpleBlur(at)},simpleBlur:function(at){var lt=at.filterBackend.resources,ct,ht,mt=at.imageData.width,dt=at.imageData.height;lt.blurLayer1||(lt.blurLayer1=nt.util.createCanvasElement(),lt.blurLayer2=nt.util.createCanvasElement()),ct=lt.blurLayer1,ht=lt.blurLayer2,(ct.width!==mt||ct.height!==dt)&&(ht.width=ct.width=mt,ht.height=ct.height=dt);var ft=ct.getContext("2d"),ut=ht.getContext("2d"),pt=15,At,gt,vt,yt,bt=this.blur*.06*.5;for(ft.putImageData(at.imageData,0,0),ut.clearRect(0,0,mt,dt),yt=-pt;yt<=pt;yt++)At=(Math.random()-.5)/4,gt=yt/pt,vt=bt*gt*mt+At,ut.globalAlpha=1-Math.abs(gt),ut.drawImage(ct,vt,At),ft.drawImage(ht,0,0),ut.globalAlpha=1,ut.clearRect(0,0,ht.width,ht.height);for(yt=-pt;yt<=pt;yt++)At=(Math.random()-.5)/4,gt=yt/pt,vt=bt*gt*dt+At,ut.globalAlpha=1-Math.abs(gt),ut.drawImage(ct,At,vt),ft.drawImage(ht,0,0),ut.globalAlpha=1,ut.clearRect(0,0,ht.width,ht.height);at.ctx.drawImage(ct,0,0);var Ct=at.ctx.getImageData(0,0,ct.width,ct.height);return ft.globalAlpha=1,ft.clearRect(0,0,ct.width,ct.height),Ct},getUniformLocations:function(at,lt){return{delta:at.getUniformLocation(lt,"uDelta")}},sendUniformData:function(at,lt){var ct=this.chooseRightDelta();at.uniform2fv(lt.delta,ct)},chooseRightDelta:function(){var at=1,lt=[0,0],ct;return this.horizontal?this.aspectRatio>1&&(at=1/this.aspectRatio):this.aspectRatio<1&&(at=this.aspectRatio),ct=at*this.blur*.12,this.horizontal?lt[0]=ct:lt[1]=ct,lt}}),ot.Blur.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Gamma=st(ot.BaseFilter,{type:"Gamma",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform vec3 uGamma;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec3 correction = (1.0 / uGamma);
color.r = pow(color.r, correction.r);
color.g = pow(color.g, correction.g);
color.b = pow(color.b, correction.b);
gl_FragColor = color;
gl_FragColor.rgb *= color.a;
}`,gamma:[1,1,1],mainParameter:"gamma",initialize:function(at){this.gamma=[1,1,1],ot.BaseFilter.prototype.initialize.call(this,at)},applyTo2d:function(at){var lt=at.imageData,ct=lt.data,ht=this.gamma,mt=ct.length,dt=1/ht[0],ft=1/ht[1],ut=1/ht[2],pt;for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),pt=0,mt=256;pt<mt;pt++)this.rVals[pt]=Math.pow(pt/255,dt)*255,this.gVals[pt]=Math.pow(pt/255,ft)*255,this.bVals[pt]=Math.pow(pt/255,ut)*255;for(pt=0,mt=ct.length;pt<mt;pt+=4)ct[pt]=this.rVals[ct[pt]],ct[pt+1]=this.gVals[ct[pt+1]],ct[pt+2]=this.bVals[ct[pt+2]]},getUniformLocations:function(at,lt){return{uGamma:at.getUniformLocation(lt,"uGamma")}},sendUniformData:function(at,lt){at.uniform3fv(lt.uGamma,this.gamma)}}),nt.Image.filters.Gamma.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.Composed=st(ot.BaseFilter,{type:"Composed",subFilters:[],initialize:function(at){this.callSuper("initialize",at),this.subFilters=this.subFilters.slice(0)},applyTo:function(at){at.passes+=this.subFilters.length-1,this.subFilters.forEach(function(lt){lt.applyTo(at)})},toObject:function(){return nt.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map(function(at){return at.toObject()})})},isNeutralState:function(){return!this.subFilters.some(function(at){return!at.isNeutralState()})}}),nt.Image.filters.Composed.fromObject=function(at,lt){var ct=at.subFilters||[],ht=ct.map(function(dt){return new nt.Image.filters[dt.type](dt)}),mt=new nt.Image.filters.Composed({subFilters:ht});return lt&&lt(mt),mt}}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.Image.filters,st=nt.util.createClass;ot.HueRotation=st(ot.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var at=this.rotation*Math.PI,lt=nt.util.cos(at),ct=nt.util.sin(at),ht=1/3,mt=Math.sqrt(ht)*ct,dt=1-lt;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=lt+dt/3,this.matrix[1]=ht*dt-mt,this.matrix[2]=ht*dt+mt,this.matrix[5]=ht*dt+mt,this.matrix[6]=lt+ht*dt,this.matrix[7]=ht*dt-mt,this.matrix[10]=ht*dt-mt,this.matrix[11]=ht*dt+mt,this.matrix[12]=lt+ht*dt},isNeutralState:function(at){return this.calculateMatrix(),ot.BaseFilter.prototype.isNeutralState.call(this,at)},applyTo:function(at){this.calculateMatrix(),ot.BaseFilter.prototype.applyTo.call(this,at)}}),nt.Image.filters.HueRotation.fromObject=nt.Image.filters.BaseFilter.fromObject}(o),function(rt){var nt=rt.fabric||(rt.fabric={}),ot=nt.util.object.clone;if(nt.Text){nt.warn("fabric.Text is already defined");return}var st="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide".split(" ");nt.Text=nt.util.createClass(nt.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide"],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:"left",fontStyle:"normal",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:"",stateProperties:nt.Object.prototype.stateProperties.concat(st),cacheProperties:nt.Object.prototype.cacheProperties.concat(st),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:"left",_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:"ltr",_styleProperties:["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor"],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(at,lt){this.styles=lt?lt.styles||{}:{},this.text=at,this.__skipDimension=!0,this.callSuper("initialize",lt),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:"_dimensionAffectingProps"})},setPathInfo:function(){var at=this.path;at&&(at.segmentsInfo=nt.util.getPathSegmentsInfo(at.path))},getMeasuringContext:function(){return nt._measuringContext||(nt._measuringContext=this.canvas&&this.canvas.contextCache||nt.util.createCanvasElement().getContext("2d")),nt._measuringContext},_splitText:function(){var at=this._splitTextIntoLines(this.text);return this.textLines=at.lines,this._textLines=at.graphemeLines,this._unwrappedTextLines=at._unwrappedLines,this._text=at.graphemeText,at},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.saveState({propertySet:"_dimensionAffectingProps"}))},enlargeSpaces:function(){for(var at,lt,ct,ht,mt,dt,ft,ut=0,pt=this._textLines.length;ut<pt;ut++)if(!(this.textAlign!=="justify"&&(ut===pt-1||this.isEndOfWrapping(ut)))&&(ht=0,mt=this._textLines[ut],lt=this.getLineWidth(ut),lt<this.width&&(ft=this.textLines[ut].match(this._reSpacesAndTabs)))){ct=ft.length,at=(this.width-lt)/ct;for(var At=0,gt=mt.length;At<=gt;At++)dt=this.__charBounds[ut][At],this._reSpaceAndTab.test(mt[At])?(dt.width+=at,dt.kernedWidth+=at,dt.left+=ht,ht+=at):dt.left+=ht}},isEndOfWrapping:function(at){return at===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var at=this.callSuper("_getCacheCanvasDimensions"),lt=this.fontSize;return at.width+=lt*at.zoomX,at.height+=lt*at.zoomY,at},_render:function(at){var lt=this.path;lt&&!lt.isNotVisible()&&lt._render(at),this._setTextStyles(at),this._renderTextLinesBackground(at),this._renderTextDecoration(at,"underline"),this._renderText(at),this._renderTextDecoration(at,"overline"),this._renderTextDecoration(at,"linethrough")},_renderText:function(at){this.paintFirst==="stroke"?(this._renderTextStroke(at),this._renderTextFill(at)):(this._renderTextFill(at),this._renderTextStroke(at))},_setTextStyles:function(at,lt,ct){at.textBaseline="alphabetic",at.font=this._getFontDeclaration(lt,ct)},calcTextWidth:function(){for(var at=this.getLineWidth(0),lt=1,ct=this._textLines.length;lt<ct;lt++){var ht=this.getLineWidth(lt);ht>at&&(at=ht)}return at},_renderTextLine:function(at,lt,ct,ht,mt,dt){this._renderChars(at,lt,ct,ht,mt,dt)},_renderTextLinesBackground:function(at){if(!(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor"))){for(var lt,ct,ht=at.fillStyle,mt,dt,ft=this._getLeftOffset(),ut=this._getTopOffset(),pt=0,At=0,gt,vt,yt=this.path,bt,Ct=0,xt=this._textLines.length;Ct<xt;Ct++){if(lt=this.getHeightOfLine(Ct),!this.textBackgroundColor&&!this.styleHas("textBackgroundColor",Ct)){ut+=lt;continue}mt=this._textLines[Ct],ct=this._getLineLeftOffset(Ct),At=0,pt=0,dt=this.getValueOfPropertyAt(Ct,0,"textBackgroundColor");for(var It=0,St=mt.length;It<St;It++)gt=this.__charBounds[Ct][It],vt=this.getValueOfPropertyAt(Ct,It,"textBackgroundColor"),yt?(at.save(),at.translate(gt.renderLeft,gt.renderTop),at.rotate(gt.angle),at.fillStyle=vt,vt&&at.fillRect(-gt.width/2,-lt/this.lineHeight*(1-this._fontSizeFraction),gt.width,lt/this.lineHeight),at.restore()):vt!==dt?(bt=ft+ct+pt,this.direction==="rtl"&&(bt=this.width-bt-At),at.fillStyle=dt,dt&&at.fillRect(bt,ut,At,lt/this.lineHeight),pt=gt.left,At=gt.width,dt=vt):At+=gt.kernedWidth;vt&&!yt&&(bt=ft+ct+pt,this.direction==="rtl"&&(bt=this.width-bt-At),at.fillStyle=vt,at.fillRect(bt,ut,At,lt/this.lineHeight)),ut+=lt}at.fillStyle=ht,this._removeShadow(at)}},getFontCache:function(at){var lt=at.fontFamily.toLowerCase();nt.charWidthsCache[lt]||(nt.charWidthsCache[lt]={});var ct=nt.charWidthsCache[lt],ht=at.fontStyle.toLowerCase()+"_"+(at.fontWeight+"").toLowerCase();return ct[ht]||(ct[ht]={}),ct[ht]},_measureChar:function(at,lt,ct,ht){var mt=this.getFontCache(lt),dt=this._getFontDeclaration(lt),ft=this._getFontDeclaration(ht),ut=ct+at,pt=dt===ft,At,gt,vt,yt=lt.fontSize/this.CACHE_FONT_SIZE,bt;if(ct&&mt[ct]!==void 0&&(vt=mt[ct]),mt[at]!==void 0&&(bt=At=mt[at]),pt&&mt[ut]!==void 0&&(gt=mt[ut],bt=gt-vt),At===void 0||vt===void 0||gt===void 0){var Ct=this.getMeasuringContext();this._setTextStyles(Ct,lt,!0)}return At===void 0&&(bt=At=Ct.measureText(at).width,mt[at]=At),vt===void 0&&pt&&ct&&(vt=Ct.measureText(ct).width,mt[ct]=vt),pt&&gt===void 0&&(gt=Ct.measureText(ut).width,mt[ut]=gt,bt=gt-vt),{width:At*yt,kernedWidth:bt*yt}},getHeightOfChar:function(at,lt){return this.getValueOfPropertyAt(at,lt,"fontSize")},measureLine:function(at){var lt=this._measureLine(at);return this.charSpacing!==0&&(lt.width-=this._getWidthOfCharSpacing()),lt.width<0&&(lt.width=0),lt},_measureLine:function(at){var lt=0,ct,ht,mt=this._textLines[at],dt,ft,ut=0,pt=new Array(mt.length),At=0,gt,vt,yt=this.path,bt=this.pathSide==="right";for(this.__charBounds[at]=pt,ct=0;ct<mt.length;ct++)ht=mt[ct],ft=this._getGraphemeBox(ht,at,ct,dt),pt[ct]=ft,lt+=ft.kernedWidth,dt=ht;if(pt[ct]={left:ft?ft.left+ft.width:0,width:0,kernedWidth:0,height:this.fontSize},yt){switch(vt=yt.segmentsInfo[yt.segmentsInfo.length-1].length,gt=nt.util.getPointOnPath(yt.path,0,yt.segmentsInfo),gt.x+=yt.pathOffset.x,gt.y+=yt.pathOffset.y,this.textAlign){case"left":At=bt?vt-lt:0;break;case"center":At=(vt-lt)/2;break;case"right":At=bt?0:vt-lt;break}for(At+=this.pathStartOffset*(bt?-1:1),ct=bt?mt.length-1:0;bt?ct>=0:ct<mt.length;bt?ct--:ct++)ft=pt[ct],At>vt?At%=vt:At<0&&(At+=vt),this._setGraphemeOnPath(At,ft,gt),At+=ft.kernedWidth}return{width:lt,numOfSpaces:ut}},_setGraphemeOnPath:function(at,lt,ct){var ht=at+lt.kernedWidth/2,mt=this.path,dt=nt.util.getPointOnPath(mt.path,ht,mt.segmentsInfo);lt.renderLeft=dt.x-ct.x,lt.renderTop=dt.y-ct.y,lt.angle=dt.angle+(this.pathSide==="right"?Math.PI:0)},_getGraphemeBox:function(at,lt,ct,ht,mt){var dt=this.getCompleteStyleDeclaration(lt,ct),ft=ht?this.getCompleteStyleDeclaration(lt,ct-1):{},ut=this._measureChar(at,dt,ht,ft),pt=ut.kernedWidth,At=ut.width,gt;this.charSpacing!==0&&(gt=this._getWidthOfCharSpacing(),At+=gt,pt+=gt);var vt={width:At,left:0,height:dt.fontSize,kernedWidth:pt,deltaY:dt.deltaY};if(ct>0&&!mt){var yt=this.__charBounds[lt][ct-1];vt.left=yt.left+yt.width+ut.kernedWidth-ut.width}return vt},getHeightOfLine:function(at){if(this.__lineHeights[at])return this.__lineHeights[at];for(var lt=this._textLines[at],ct=this.getHeightOfChar(at,0),ht=1,mt=lt.length;ht<mt;ht++)ct=Math.max(this.getHeightOfChar(at,ht),ct);return this.__lineHeights[at]=ct*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var at,lt=0,ct=0,ht=this._textLines.length;ct<ht;ct++)at=this.getHeightOfLine(ct),lt+=ct===ht-1?at/this.lineHeight:at;return lt},_getLeftOffset:function(){return this.direction==="ltr"?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(at,lt){at.save();for(var ct=0,ht=this._getLeftOffset(),mt=this._getTopOffset(),dt=0,ft=this._textLines.length;dt<ft;dt++){var ut=this.getHeightOfLine(dt),pt=ut/this.lineHeight,At=this._getLineLeftOffset(dt);this._renderTextLine(lt,at,this._textLines[dt],ht+At,mt+ct+pt,dt),ct+=ut}at.restore()},_renderTextFill:function(at){!this.fill&&!this.styleHas("fill")||this._renderTextCommon(at,"fillText")},_renderTextStroke:function(at){(!this.stroke||this.strokeWidth===0)&&this.isEmptyStyles()||(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(at),at.save(),this._setLineDash(at,this.strokeDashArray),at.beginPath(),this._renderTextCommon(at,"strokeText"),at.closePath(),at.restore())},_renderChars:function(at,lt,ct,ht,mt,dt){var ft=this.getHeightOfLine(dt),ut=this.textAlign.indexOf("justify")!==-1,pt,At,gt="",vt,yt=0,bt,Ct=this.path,xt=!ut&&this.charSpacing===0&&this.isEmptyStyles(dt)&&!Ct,It=this.direction==="ltr",St=this.direction==="ltr"?1:-1,Ot;if(lt.save(),mt-=ft*this._fontSizeFraction/this.lineHeight,xt){lt.canvas.setAttribute("dir",It?"ltr":"rtl"),lt.direction=It?"ltr":"rtl",lt.textAlign=It?"left":"right",this._renderChar(at,lt,dt,0,ct.join(""),ht,mt,ft),lt.restore();return}for(var Mt=0,jt=ct.length-1;Mt<=jt;Mt++)bt=Mt===jt||this.charSpacing||Ct,gt+=ct[Mt],vt=this.__charBounds[dt][Mt],yt===0?(ht+=St*(vt.kernedWidth-vt.width),yt+=vt.width):yt+=vt.kernedWidth,ut&&!bt&&this._reSpaceAndTab.test(ct[Mt])&&(bt=!0),bt||(pt=pt||this.getCompleteStyleDeclaration(dt,Mt),At=this.getCompleteStyleDeclaration(dt,Mt+1),bt=this._hasStyleChanged(pt,At)),bt&&(Ct?(lt.save(),lt.translate(vt.renderLeft,vt.renderTop),lt.rotate(vt.angle),this._renderChar(at,lt,dt,Mt,gt,-yt/2,0,ft),lt.restore()):(Ot=ht,lt.canvas.setAttribute("dir",It?"ltr":"rtl"),lt.direction=It?"ltr":"rtl",lt.textAlign=It?"left":"right",this._renderChar(at,lt,dt,Mt,gt,Ot,mt,ft)),gt="",pt=At,ht+=St*yt,yt=0);lt.restore()},_applyPatternGradientTransformText:function(at){var lt=nt.util.createCanvasElement(),ct,ht=this.width+this.strokeWidth,mt=this.height+this.strokeWidth;return lt.width=ht,lt.height=mt,ct=lt.getContext("2d"),ct.beginPath(),ct.moveTo(0,0),ct.lineTo(ht,0),ct.lineTo(ht,mt),ct.lineTo(0,mt),ct.closePath(),ct.translate(ht/2,mt/2),ct.fillStyle=at.toLive(ct),this._applyPatternGradientTransform(ct,at),ct.fill(),ct.createPattern(lt,"no-repeat")},handleFiller:function(at,lt,ct){var ht,mt;return ct.toLive?ct.gradientUnits==="percentage"||ct.gradientTransform||ct.patternTransform?(ht=-this.width/2,mt=-this.height/2,at.translate(ht,mt),at[lt]=this._applyPatternGradientTransformText(ct),{offsetX:ht,offsetY:mt}):(at[lt]=ct.toLive(at,this),this._applyPatternGradientTransform(at,ct)):(at[lt]=ct,{offsetX:0,offsetY:0})},_setStrokeStyles:function(at,lt){return at.lineWidth=lt.strokeWidth,at.lineCap=this.strokeLineCap,at.lineDashOffset=this.strokeDashOffset,at.lineJoin=this.strokeLineJoin,at.miterLimit=this.strokeMiterLimit,this.handleFiller(at,"strokeStyle",lt.stroke)},_setFillStyles:function(at,lt){return this.handleFiller(at,"fillStyle",lt.fill)},_renderChar:function(at,lt,ct,ht,mt,dt,ft){var ut=this._getStyleDeclaration(ct,ht),pt=this.getCompleteStyleDeclaration(ct,ht),At=at==="fillText"&&pt.fill,gt=at==="strokeText"&&pt.stroke&&pt.strokeWidth,vt,yt;!gt&&!At||(lt.save(),At&&(vt=this._setFillStyles(lt,pt)),gt&&(yt=this._setStrokeStyles(lt,pt)),lt.font=this._getFontDeclaration(pt),ut&&ut.textBackgroundColor&&this._removeShadow(lt),ut&&ut.deltaY&&(ft+=ut.deltaY),At&&lt.fillText(mt,dt-vt.offsetX,ft-vt.offsetY),gt&&lt.strokeText(mt,dt-yt.offsetX,ft-yt.offsetY),lt.restore())},setSuperscript:function(at,lt){return this._setScript(at,lt,this.superscript)},setSubscript:function(at,lt){return this._setScript(at,lt,this.subscript)},_setScript:function(at,lt,ct){var ht=this.get2DCursorLocation(at,!0),mt=this.getValueOfPropertyAt(ht.lineIndex,ht.charIndex,"fontSize"),dt=this.getValueOfPropertyAt(ht.lineIndex,ht.charIndex,"deltaY"),ft={fontSize:mt*ct.size,deltaY:dt+mt*ct.baseline};return this.setSelectionStyles(ft,at,lt),this},_hasStyleChanged:function(at,lt){return at.fill!==lt.fill||at.stroke!==lt.stroke||at.strokeWidth!==lt.strokeWidth||at.fontSize!==lt.fontSize||at.fontFamily!==lt.fontFamily||at.fontWeight!==lt.fontWeight||at.fontStyle!==lt.fontStyle||at.deltaY!==lt.deltaY},_hasStyleChangedForSvg:function(at,lt){return this._hasStyleChanged(at,lt)||at.overline!==lt.overline||at.underline!==lt.underline||at.linethrough!==lt.linethrough},_getLineLeftOffset:function(at){var lt=this.getLineWidth(at),ct=this.width-lt,ht=this.textAlign,mt=this.direction,ft,dt=0,ft=this.isEndOfWrapping(at);return ht==="justify"||ht==="justify-center"&&!ft||ht==="justify-right"&&!ft||ht==="justify-left"&&!ft?0:(ht==="center"&&(dt=ct/2),ht==="right"&&(dt=ct),ht==="justify-center"&&(dt=ct/2),ht==="justify-right"&&(dt=ct),mt==="rtl"&&(dt-=ct),dt)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var at=this._forceClearCache;return at||(at=this.hasStateChanged("_dimensionAffectingProps")),at&&(this.dirty=!0,this._forceClearCache=!1),at},getLineWidth:function(at){if(this.__lineWidths[at])return this.__lineWidths[at];var lt,ct=this._textLines[at],ht;return ct===""?lt=0:(ht=this.measureLine(at),lt=ht.width),this.__lineWidths[at]=lt,lt},_getWidthOfCharSpacing:function(){return this.charSpacing!==0?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(at,lt,ct){var ht=this._getStyleDeclaration(at,lt);return ht&&typeof ht[ct]!="undefined"?ht[ct]:this[ct]},_renderTextDecoration:function(at,lt){if(!(!this[lt]&&!this.styleHas(lt))){for(var ct,ht,mt,dt,ft,ut,pt,At,gt=this._getLeftOffset(),vt=this._getTopOffset(),yt,bt,Ct,xt,It,St,Ot,Mt,jt=this.path,Ft=this._getWidthOfCharSpacing(),Ut=this.offsets[lt],Qt=0,Ht=this._textLines.length;Qt<Ht;Qt++){if(ct=this.getHeightOfLine(Qt),!this[lt]&&!this.styleHas(lt,Qt)){vt+=ct;continue}pt=this._textLines[Qt],St=ct/this.lineHeight,dt=this._getLineLeftOffset(Qt),bt=0,Ct=0,At=this.getValueOfPropertyAt(Qt,0,lt),Mt=this.getValueOfPropertyAt(Qt,0,"fill"),yt=vt+St*(1-this._fontSizeFraction),ht=this.getHeightOfChar(Qt,0),ft=this.getValueOfPropertyAt(Qt,0,"deltaY");for(var Zt=0,Wt=pt.length;Zt<Wt;Zt++)if(xt=this.__charBounds[Qt][Zt],It=this.getValueOfPropertyAt(Qt,Zt,lt),Ot=this.getValueOfPropertyAt(Qt,Zt,"fill"),mt=this.getHeightOfChar(Qt,Zt),ut=this.getValueOfPropertyAt(Qt,Zt,"deltaY"),jt&&It&&Ot)at.save(),at.fillStyle=Mt,at.translate(xt.renderLeft,xt.renderTop),at.rotate(xt.angle),at.fillRect(-xt.kernedWidth/2,Ut*mt+ut,xt.kernedWidth,this.fontSize/15),at.restore();else if((It!==At||Ot!==Mt||mt!==ht||ut!==ft)&&Ct>0){var $t=gt+dt+bt;this.direction==="rtl"&&($t=this.width-$t-Ct),At&&Mt&&(at.fillStyle=Mt,at.fillRect($t,yt+Ut*ht+ft,Ct,this.fontSize/15)),bt=xt.left,Ct=xt.width,At=It,Mt=Ot,ht=mt,ft=ut}else Ct+=xt.kernedWidth;var $t=gt+dt+bt;this.direction==="rtl"&&($t=this.width-$t-Ct),at.fillStyle=Ot,It&&Ot&&at.fillRect($t,yt+Ut*ht+ft,Ct-Ft,this.fontSize/15),vt+=ct}this._removeShadow(at)}},_getFontDeclaration:function(at,lt){var ct=at||this,ht=this.fontFamily,mt=nt.Text.genericFonts.indexOf(ht.toLowerCase())>-1,dt=ht===void 0||ht.indexOf("'")>-1||ht.indexOf(",")>-1||ht.indexOf('"')>-1||mt?ct.fontFamily:'"'+ct.fontFamily+'"';return[nt.isLikelyNode?ct.fontWeight:ct.fontStyle,nt.isLikelyNode?ct.fontStyle:ct.fontWeight,lt?this.CACHE_FONT_SIZE+"px":ct.fontSize+"px",dt].join(" ")},render:function(at){!this.visible||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",at))},_splitTextIntoLines:function(at){for(var lt=at.split(this._reNewline),ct=new Array(lt.length),ht=[`
`],mt=[],dt=0;dt<lt.length;dt++)ct[dt]=nt.util.string.graphemeSplit(lt[dt]),mt=mt.concat(ct[dt],ht);return mt.pop(),{_unwrappedLines:ct,lines:lt,graphemeText:mt,graphemeLines:ct}},toObject:function(at){var lt=st.concat(at),ct=this.callSuper("toObject",lt);return ct.styles=ot(this.styles,!0),ct.path&&(ct.path=this.path.toObject()),ct},set:function(at,lt){this.callSuper("set",at,lt);var ct=!1,ht=!1;if(typeof at=="object")for(var mt in at)mt==="path"&&this.setPathInfo(),ct=ct||this._dimensionAffectingProps.indexOf(mt)!==-1,ht=ht||mt==="path";else ct=this._dimensionAffectingProps.indexOf(at)!==-1,ht=at==="path";return ht&&this.setPathInfo(),ct&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),nt.Text.ATTRIBUTE_NAMES=nt.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")),nt.Text.DEFAULT_SVG_FONT_SIZE=16,nt.Text.fromElement=function(at,lt,ct){if(!at)return lt(null);var ht=nt.parseAttributes(at,nt.Text.ATTRIBUTE_NAMES),mt=ht.textAnchor||"left";if(ct=nt.util.object.extend(ct?ot(ct):{},ht),ct.top=ct.top||0,ct.left=ct.left||0,ht.textDecoration){var dt=ht.textDecoration;dt.indexOf("underline")!==-1&&(ct.underline=!0),dt.indexOf("overline")!==-1&&(ct.overline=!0),dt.indexOf("line-through")!==-1&&(ct.linethrough=!0),delete ct.textDecoration}"dx"in ht&&(ct.left+=ht.dx),"dy"in ht&&(ct.top+=ht.dy),"fontSize"in ct||(ct.fontSize=nt.Text.DEFAULT_SVG_FONT_SIZE);var ft="";"textContent"in at?ft=at.textContent:"firstChild"in at&&at.firstChild!==null&&"data"in at.firstChild&&at.firstChild.data!==null&&(ft=at.firstChild.data),ft=ft.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var ut=ct.strokeWidth;ct.strokeWidth=0;var pt=new nt.Text(ft,ct),At=pt.getScaledHeight()/pt.height,gt=(pt.height+pt.strokeWidth)*pt.lineHeight-pt.height,vt=gt*At,yt=pt.getScaledHeight()+vt,bt=0;mt==="center"&&(bt=pt.getScaledWidth()/2),mt==="right"&&(bt=pt.getScaledWidth()),pt.set({left:pt.left-bt,top:pt.top-(yt-pt.fontSize*(.07+pt._fontSizeFraction))/pt.lineHeight,strokeWidth:typeof ut!="undefined"?ut:1}),lt(pt)},nt.Text.fromObject=function(at,lt){var ct=ot(at),ht=at.path;return delete ct.path,nt.Object._fromObject("Text",ct,function(mt){ht?nt.Object._fromObject("Path",ht,function(dt){mt.set("path",dt),lt(mt)},"path"):lt(mt)},"text")},nt.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],nt.util.createAccessors&&nt.util.createAccessors(nt.Text)}(o),function(){s.util.object.extend(s.Text.prototype,{isEmptyStyles:function(rt){if(!this.styles||typeof rt!="undefined"&&!this.styles[rt])return!0;var nt=typeof rt=="undefined"?this.styles:{line:this.styles[rt]};for(var ot in nt)for(var st in nt[ot])for(var at in nt[ot][st])return!1;return!0},styleHas:function(rt,nt){if(!this.styles||!rt||rt===""||typeof nt!="undefined"&&!this.styles[nt])return!1;var ot=typeof nt=="undefined"?this.styles:{0:this.styles[nt]};for(var st in ot)for(var at in ot[st])if(typeof ot[st][at][rt]!="undefined")return!0;return!1},cleanStyle:function(rt){if(!this.styles||!rt||rt==="")return!1;var nt=this.styles,ot=0,st,at,lt=!0,ct=0,ht;for(var mt in nt){st=0;for(var dt in nt[mt]){var ht=nt[mt][dt],ft=ht.hasOwnProperty(rt);ot++,ft?(at?ht[rt]!==at&&(lt=!1):at=ht[rt],ht[rt]===this[rt]&&delete ht[rt]):lt=!1,Object.keys(ht).length!==0?st++:delete nt[mt][dt]}st===0&&delete nt[mt]}for(var ut=0;ut<this._textLines.length;ut++)ct+=this._textLines[ut].length;lt&&ot===ct&&(this[rt]=at,this.removeStyle(rt))},removeStyle:function(rt){if(!(!this.styles||!rt||rt==="")){var nt=this.styles,ot,st,at;for(st in nt){ot=nt[st];for(at in ot)delete ot[at][rt],Object.keys(ot[at]).length===0&&delete ot[at];Object.keys(ot).length===0&&delete nt[st]}}},_extendStyles:function(rt,nt){var ot=this.get2DCursorLocation(rt);this._getLineStyle(ot.lineIndex)||this._setLineStyle(ot.lineIndex),this._getStyleDeclaration(ot.lineIndex,ot.charIndex)||this._setStyleDeclaration(ot.lineIndex,ot.charIndex,{}),s.util.object.extend(this._getStyleDeclaration(ot.lineIndex,ot.charIndex),nt)},get2DCursorLocation:function(rt,nt){typeof rt=="undefined"&&(rt=this.selectionStart);for(var ot=nt?this._unwrappedTextLines:this._textLines,st=ot.length,at=0;at<st;at++){if(rt<=ot[at].length)return{lineIndex:at,charIndex:rt};rt-=ot[at].length+this.missingNewlineOffset(at)}return{lineIndex:at-1,charIndex:ot[at-1].length<rt?ot[at-1].length:rt}},getSelectionStyles:function(rt,nt,ot){typeof rt=="undefined"&&(rt=this.selectionStart||0),typeof nt=="undefined"&&(nt=this.selectionEnd||rt);for(var st=[],at=rt;at<nt;at++)st.push(this.getStyleAtPosition(at,ot));return st},getStyleAtPosition:function(rt,nt){var ot=this.get2DCursorLocation(rt),st=nt?this.getCompleteStyleDeclaration(ot.lineIndex,ot.charIndex):this._getStyleDeclaration(ot.lineIndex,ot.charIndex);return st||{}},setSelectionStyles:function(rt,nt,ot){typeof nt=="undefined"&&(nt=this.selectionStart||0),typeof ot=="undefined"&&(ot=this.selectionEnd||nt);for(var st=nt;st<ot;st++)this._extendStyles(st,rt);return this._forceClearCache=!0,this},_getStyleDeclaration:function(rt,nt){var ot=this.styles&&this.styles[rt];return ot?ot[nt]:null},getCompleteStyleDeclaration:function(rt,nt){for(var ot=this._getStyleDeclaration(rt,nt)||{},st={},at,lt=0;lt<this._styleProperties.length;lt++)at=this._styleProperties[lt],st[at]=typeof ot[at]=="undefined"?this[at]:ot[at];return st},_setStyleDeclaration:function(rt,nt,ot){this.styles[rt][nt]=ot},_deleteStyleDeclaration:function(rt,nt){delete this.styles[rt][nt]},_getLineStyle:function(rt){return!!this.styles[rt]},_setLineStyle:function(rt){this.styles[rt]={}},_deleteLineStyle:function(rt){delete this.styles[rt]}})}(),function(){function rt(nt){nt.textDecoration&&(nt.textDecoration.indexOf("underline")>-1&&(nt.underline=!0),nt.textDecoration.indexOf("line-through")>-1&&(nt.linethrough=!0),nt.textDecoration.indexOf("overline")>-1&&(nt.overline=!0),delete nt.textDecoration)}s.IText=s.util.createClass(s.Text,s.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(nt,ot){this.callSuper("initialize",nt,ot),this.initBehavior()},setSelectionStart:function(nt){nt=Math.max(nt,0),this._updateAndFire("selectionStart",nt)},setSelectionEnd:function(nt){nt=Math.min(nt,this.text.length),this._updateAndFire("selectionEnd",nt)},_updateAndFire:function(nt,ot){this[nt]!==ot&&(this._fireSelectionChanged(),this[nt]=ot),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(nt){this.clearContextTop(),this.callSuper("render",nt),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(nt){this.callSuper("_render",nt)},clearContextTop:function(nt){if(!(!this.isEditing||!this.canvas||!this.canvas.contextTop)){var ot=this.canvas.contextTop,st=this.canvas.viewportTransform;ot.save(),ot.transform(st[0],st[1],st[2],st[3],st[4],st[5]),this.transform(ot),this._clearTextArea(ot),nt||ot.restore()}},renderCursorOrSelection:function(){if(!(!this.isEditing||!this.canvas||!this.canvas.contextTop)){var nt=this._getCursorBoundaries(),ot=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(nt,ot):this.renderSelection(nt,ot),ot.restore()}},_clearTextArea:function(nt){var ot=this.width+4,st=this.height+4;nt.clearRect(-ot/2,-st/2,ot,st)},_getCursorBoundaries:function(nt){typeof nt=="undefined"&&(nt=this.selectionStart);var ot=this._getLeftOffset(),st=this._getTopOffset(),at=this._getCursorBoundariesOffsets(nt);return{left:ot,top:st,leftOffset:at.left,topOffset:at.top}},_getCursorBoundariesOffsets:function(nt){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var ot,st,at,lt=0,ct=0,ht,mt=this.get2DCursorLocation(nt);at=mt.charIndex,st=mt.lineIndex;for(var dt=0;dt<st;dt++)lt+=this.getHeightOfLine(dt);ot=this._getLineLeftOffset(st);var ft=this.__charBounds[st][at];return ft&&(ct=ft.left),this.charSpacing!==0&&at===this._textLines[st].length&&(ct-=this._getWidthOfCharSpacing()),ht={top:lt,left:ot+(ct>0?ct:0)},this.direction==="rtl"&&(ht.left*=-1),this.cursorOffsetCache=ht,this.cursorOffsetCache},renderCursor:function(nt,ot){var st=this.get2DCursorLocation(),at=st.lineIndex,lt=st.charIndex>0?st.charIndex-1:0,ct=this.getValueOfPropertyAt(at,lt,"fontSize"),ht=this.scaleX*this.canvas.getZoom(),mt=this.cursorWidth/ht,dt=nt.topOffset,ft=this.getValueOfPropertyAt(at,lt,"deltaY");dt+=(1-this._fontSizeFraction)*this.getHeightOfLine(at)/this.lineHeight-ct*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(nt,ot),ot.fillStyle=this.cursorColor||this.getValueOfPropertyAt(at,lt,"fill"),ot.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,ot.fillRect(nt.left+nt.leftOffset-mt/2,dt+nt.top+ft,mt,ct)},renderSelection:function(nt,ot){for(var st=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,at=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,lt=this.textAlign.indexOf("justify")!==-1,ct=this.get2DCursorLocation(st),ht=this.get2DCursorLocation(at),mt=ct.lineIndex,dt=ht.lineIndex,ft=ct.charIndex<0?0:ct.charIndex,ut=ht.charIndex<0?0:ht.charIndex,pt=mt;pt<=dt;pt++){var At=this._getLineLeftOffset(pt)||0,gt=this.getHeightOfLine(pt),vt=0,yt=0,bt=0;if(pt===mt&&(yt=this.__charBounds[mt][ft].left),pt>=mt&&pt<dt)bt=lt&&!this.isEndOfWrapping(pt)?this.width:this.getLineWidth(pt)||5;else if(pt===dt)if(ut===0)bt=this.__charBounds[dt][ut].left;else{var Ct=this._getWidthOfCharSpacing();bt=this.__charBounds[dt][ut-1].left+this.__charBounds[dt][ut-1].width-Ct}vt=gt,(this.lineHeight<1||pt===dt&&this.lineHeight>1)&&(gt/=this.lineHeight);var xt=nt.left+At+yt,It=bt-yt,St=gt,Ot=0;this.inCompositionMode?(ot.fillStyle=this.compositionColor||"black",St=1,Ot=gt):ot.fillStyle=this.selectionColor,this.direction==="rtl"&&(xt=this.width-xt-It),ot.fillRect(xt,nt.top+nt.topOffset+Ot,It,St),nt.topOffset+=vt}},getCurrentCharFontSize:function(){var nt=this._getCurrentCharIndex();return this.getValueOfPropertyAt(nt.l,nt.c,"fontSize")},getCurrentCharColor:function(){var nt=this._getCurrentCharIndex();return this.getValueOfPropertyAt(nt.l,nt.c,"fill")},_getCurrentCharIndex:function(){var nt=this.get2DCursorLocation(this.selectionStart,!0),ot=nt.charIndex>0?nt.charIndex-1:0;return{l:nt.lineIndex,c:ot}}}),s.IText.fromObject=function(nt,ot){if(rt(nt),nt.styles)for(var st in nt.styles)for(var at in nt.styles[st])rt(nt.styles[st][at]);s.Object._fromObject("IText",nt,ot,"text")}}(),function(){var rt=s.util.object.clone;s.util.object.extend(s.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var nt=this;this.on("added",function(){var ot=nt.canvas;ot&&(ot._hasITextHandlers||(ot._hasITextHandlers=!0,nt._initCanvasHandlers(ot)),ot._iTextInstances=ot._iTextInstances||[],ot._iTextInstances.push(nt))})},initRemovedHandler:function(){var nt=this;this.on("removed",function(){var ot=nt.canvas;ot&&(ot._iTextInstances=ot._iTextInstances||[],s.util.removeFromArray(ot._iTextInstances,nt),ot._iTextInstances.length===0&&(ot._hasITextHandlers=!1,nt._removeCanvasHandlers(ot)))})},_initCanvasHandlers:function(nt){nt._mouseUpITextHandler=function(){nt._iTextInstances&&nt._iTextInstances.forEach(function(ot){ot.__isMousedown=!1})},nt.on("mouse:up",nt._mouseUpITextHandler)},_removeCanvasHandlers:function(nt){nt.off("mouse:up",nt._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(nt,ot,st,at){var lt;return lt={isAborted:!1,abort:function(){this.isAborted=!0}},nt.animate("_currentCursorOpacity",ot,{duration:st,onComplete:function(){lt.isAborted||nt[at]()},onChange:function(){nt.canvas&&nt.selectionStart===nt.selectionEnd&&nt.renderCursorOrSelection()},abort:function(){return lt.isAborted}}),lt},_onTickComplete:function(){var nt=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){nt._currentTickCompleteState=nt._animateCursor(nt,0,this.cursorDuration/2,"_tick")},100)},initDelayedCursor:function(nt){var ot=this,st=nt?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout(function(){ot._tick()},st)},abortCursorAnimation:function(){var nt=this._currentTickState||this._currentTickCompleteState,ot=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,nt&&ot&&ot.clearContext(ot.contextTop||ot.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(nt){var ot=0,st=nt-1;if(this._reSpace.test(this._text[st]))for(;this._reSpace.test(this._text[st]);)ot++,st--;for(;/\S/.test(this._text[st])&&st>-1;)ot++,st--;return nt-ot},findWordBoundaryRight:function(nt){var ot=0,st=nt;if(this._reSpace.test(this._text[st]))for(;this._reSpace.test(this._text[st]);)ot++,st++;for(;/\S/.test(this._text[st])&&st<this._text.length;)ot++,st++;return nt+ot},findLineBoundaryLeft:function(nt){for(var ot=0,st=nt-1;!/\n/.test(this._text[st])&&st>-1;)ot++,st--;return nt-ot},findLineBoundaryRight:function(nt){for(var ot=0,st=nt;!/\n/.test(this._text[st])&&st<this._text.length;)ot++,st++;return nt+ot},searchWordBoundary:function(nt,ot){for(var st=this._text,at=this._reSpace.test(st[nt])?nt-1:nt,lt=st[at],ct=s.reNonWord;!ct.test(lt)&&at>0&&at<st.length;)at+=ot,lt=st[at];return ct.test(lt)&&(at+=ot===1?0:1),at},selectWord:function(nt){nt=nt||this.selectionStart;var ot=this.searchWordBoundary(nt,-1),st=this.searchWordBoundary(nt,1);this.selectionStart=ot,this.selectionEnd=st,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(nt){nt=nt||this.selectionStart;var ot=this.findLineBoundaryLeft(nt),st=this.findLineBoundaryRight(nt);return this.selectionStart=ot,this.selectionEnd=st,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(nt){if(!(this.isEditing||!this.editable))return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(nt),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this._fireSelectionChanged(),this.canvas?(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll(),this):this},exitEditingOnOthers:function(nt){nt._iTextInstances&&nt._iTextInstances.forEach(function(ot){ot.selected=!1,ot.isEditing&&ot.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(nt){if(!(!this.__isMousedown||!this.isEditing)){var ot=this.getSelectionStartFromPointer(nt.e),st=this.selectionStart,at=this.selectionEnd;(ot!==this.__selectionStartOnMouseDown||st===at)&&(st===ot||at===ot)||(ot>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=ot):(this.selectionStart=ot,this.selectionEnd=this.__selectionStartOnMouseDown),(this.selectionStart!==st||this.selectionEnd!==at)&&(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(nt,ot,st){var at=st.slice(0,nt),lt=s.util.string.graphemeSplit(at).length;if(nt===ot)return{selectionStart:lt,selectionEnd:lt};var ct=st.slice(nt,ot),ht=s.util.string.graphemeSplit(ct).length;return{selectionStart:lt,selectionEnd:lt+ht}},fromGraphemeToStringSelection:function(nt,ot,st){var at=st.slice(0,nt),lt=at.join("").length;if(nt===ot)return{selectionStart:lt,selectionEnd:lt};var ct=st.slice(nt,ot),ht=ct.join("").length;return{selectionStart:lt,selectionEnd:lt+ht}},_updateTextarea:function(){if(this.cursorOffsetCache={},!!this.hiddenTextarea){if(!this.inCompositionMode){var nt=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=nt.selectionStart,this.hiddenTextarea.selectionEnd=nt.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(!!this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var nt=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=nt.selectionEnd,this.inCompositionMode||(this.selectionStart=nt.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var nt=this._calcTextareaPosition();this.hiddenTextarea.style.left=nt.left,this.hiddenTextarea.style.top=nt.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var nt=this.inCompositionMode?this.compositionStart:this.selectionStart,ot=this._getCursorBoundaries(nt),st=this.get2DCursorLocation(nt),at=st.lineIndex,lt=st.charIndex,ct=this.getValueOfPropertyAt(at,lt,"fontSize")*this.lineHeight,ht=ot.leftOffset,mt=this.calcTransformMatrix(),dt={x:ot.left+ht,y:ot.top+ot.topOffset+ct},ft=this.canvas.getRetinaScaling(),ut=this.canvas.upperCanvasEl,pt=ut.width/ft,At=ut.height/ft,gt=pt-ct,vt=At-ct,yt=ut.clientWidth/pt,bt=ut.clientHeight/At;return dt=s.util.transformPoint(dt,mt),dt=s.util.transformPoint(dt,this.canvas.viewportTransform),dt.x*=yt,dt.y*=bt,dt.x<0&&(dt.x=0),dt.x>gt&&(dt.x=gt),dt.y<0&&(dt.y=0),dt.y>vt&&(dt.y=vt),dt.x+=this.canvas._offset.left,dt.y+=this.canvas._offset.top,{left:dt.x+"px",top:dt.y+"px",fontSize:ct+"px",charHeight:ct}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){!this._savedProps||(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var nt=this._textBeforeEdit!==this.text,ot=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,ot&&(ot.blur&&ot.blur(),ot.parentNode&&ot.parentNode.removeChild(ot)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),nt&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),nt&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var nt in this.styles)this._textLines[nt]||delete this.styles[nt]},removeStyleFromTo:function(nt,ot){var st=this.get2DCursorLocation(nt,!0),at=this.get2DCursorLocation(ot,!0),lt=st.lineIndex,ct=st.charIndex,ht=at.lineIndex,mt=at.charIndex,dt,ft;if(lt!==ht){if(this.styles[lt])for(dt=ct;dt<this._unwrappedTextLines[lt].length;dt++)delete this.styles[lt][dt];if(this.styles[ht])for(dt=mt;dt<this._unwrappedTextLines[ht].length;dt++)ft=this.styles[ht][dt],ft&&(this.styles[lt]||(this.styles[lt]={}),this.styles[lt][ct+dt-mt]=ft);for(dt=lt+1;dt<=ht;dt++)delete this.styles[dt];this.shiftLineStyles(ht,lt-ht)}else if(this.styles[lt]){ft=this.styles[lt];var ut=mt-ct,pt,At;for(dt=ct;dt<mt;dt++)delete ft[dt];for(At in this.styles[lt])pt=parseInt(At,10),pt>=mt&&(ft[pt-ut]=ft[At],delete ft[At])}},shiftLineStyles:function(nt,ot){var st=rt(this.styles);for(var at in this.styles){var lt=parseInt(at,10);lt>nt&&(this.styles[lt+ot]=st[lt],st[lt-ot]||delete this.styles[lt])}},restartCursorIfNeeded:function(){(!this._currentTickState||this._currentTickState.isAborted||!this._currentTickCompleteState||this._currentTickCompleteState.isAborted)&&this.initDelayedCursor()},insertNewlineStyleObject:function(nt,ot,st,at){var lt,ct={},ht=!1,mt=this._unwrappedTextLines[nt].length===ot;st||(st=1),this.shiftLineStyles(nt,st),this.styles[nt]&&(lt=this.styles[nt][ot===0?ot:ot-1]);for(var dt in this.styles[nt]){var ft=parseInt(dt,10);ft>=ot&&(ht=!0,ct[ft-ot]=this.styles[nt][dt],mt&&ot===0||delete this.styles[nt][dt])}var ut=!1;for(ht&&!mt&&(this.styles[nt+st]=ct,ut=!0),ut&&st--;st>0;)at&&at[st-1]?this.styles[nt+st]={0:rt(at[st-1])}:lt?this.styles[nt+st]={0:rt(lt)}:delete this.styles[nt+st],st--;this._forceClearCache=!0},insertCharStyleObject:function(nt,ot,st,at){this.styles||(this.styles={});var lt=this.styles[nt],ct=lt?rt(lt):{};st||(st=1);for(var ht in ct){var mt=parseInt(ht,10);mt>=ot&&(lt[mt+st]=ct[mt],ct[mt-st]||delete lt[mt])}if(this._forceClearCache=!0,at){for(;st--;)!Object.keys(at[st]).length||(this.styles[nt]||(this.styles[nt]={}),this.styles[nt][ot+st]=rt(at[st]));return}if(!!lt)for(var dt=lt[ot?ot-1:1];dt&&st--;)this.styles[nt][ot+st]=rt(dt)},insertNewStyleBlock:function(nt,ot,st){for(var at=this.get2DCursorLocation(ot,!0),lt=[0],ct=0,ht=0;ht<nt.length;ht++)nt[ht]===`
`?(ct++,lt[ct]=0):lt[ct]++;lt[0]>0&&(this.insertCharStyleObject(at.lineIndex,at.charIndex,lt[0],st),st=st&&st.slice(lt[0]+1)),ct&&this.insertNewlineStyleObject(at.lineIndex,at.charIndex+lt[0],ct);for(var ht=1;ht<ct;ht++)lt[ht]>0?this.insertCharStyleObject(at.lineIndex+ht,0,lt[ht],st):st&&(this.styles[at.lineIndex+ht][0]=st[0]),st=st&&st.slice(lt[ht]+1);lt[ht]>0&&this.insertCharStyleObject(at.lineIndex+ht,0,lt[ht],st)},setSelectionStartEndWithShift:function(nt,ot,st){st<=nt?(ot===nt?this._selectionDirection="left":this._selectionDirection==="right"&&(this._selectionDirection="left",this.selectionEnd=nt),this.selectionStart=st):st>nt&&st<ot?this._selectionDirection==="right"?this.selectionEnd=st:this.selectionStart=st:(ot===nt?this._selectionDirection="right":this._selectionDirection==="left"&&(this._selectionDirection="right",this.selectionStart=ot),this.selectionEnd=st)},setSelectionInBoundaries:function(){var nt=this.text.length;this.selectionStart>nt?this.selectionStart=nt:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>nt?this.selectionEnd=nt:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),s.util.object.extend(s.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(rt){if(!!this.canvas){this.__newClickTime=+new Date;var nt=rt.pointer;this.isTripleClick(nt)&&(this.fire("tripleclick",rt),this._stopEvent(rt.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=nt,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(rt){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===rt.x&&this.__lastPointer.y===rt.y},_stopEvent:function(rt){rt.preventDefault&&rt.preventDefault(),rt.stopPropagation&&rt.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(rt){!this.isEditing||this.selectWord(this.getSelectionStartFromPointer(rt.e))},tripleClickHandler:function(rt){!this.isEditing||this.selectLine(this.getSelectionStartFromPointer(rt.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(rt){!this.canvas||!this.editable||rt.e.button&&rt.e.button!==1||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(rt.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(rt){!this.canvas||!this.editable||rt.e.button&&rt.e.button!==1||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(rt){if(this.__isMousedown=!1,!(!this.editable||this.group||rt.transform&&rt.transform.actionPerformed||rt.e.button&&rt.e.button!==1)){if(this.canvas){var nt=this.canvas._activeObject;if(nt&&nt!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(rt.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(rt){var nt=this.getSelectionStartFromPointer(rt),ot=this.selectionStart,st=this.selectionEnd;rt.shiftKey?this.setSelectionStartEndWithShift(ot,st,nt):(this.selectionStart=nt,this.selectionEnd=nt),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(rt){for(var nt=this.getLocalPointer(rt),ot=0,st=0,at=0,lt=0,ct=0,ht,mt,dt=0,ft=this._textLines.length;dt<ft&&at<=nt.y;dt++)at+=this.getHeightOfLine(dt)*this.scaleY,ct=dt,dt>0&&(lt+=this._textLines[dt-1].length+this.missingNewlineOffset(dt-1));ht=this._getLineLeftOffset(ct),st=ht*this.scaleX,mt=this._textLines[ct],this.direction==="rtl"&&(nt.x=this.width*this.scaleX-nt.x+st);for(var ut=0,pt=mt.length;ut<pt&&(ot=st,st+=this.__charBounds[ct][ut].kernedWidth*this.scaleX,st<=nt.x);ut++)lt++;return this._getNewSelectionStartFromOffset(nt,ot,st,lt,pt)},_getNewSelectionStartFromOffset:function(rt,nt,ot,st,at){var lt=rt.x-nt,ct=ot-rt.x,ht=ct>lt||ct<0?0:1,mt=st+ht;return this.flipX&&(mt=at-mt),mt>this._text.length&&(mt=this._text.length),mt}}),s.util.object.extend(s.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=s.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var rt=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+rt.top+"; left: "+rt.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uFF70top: "+rt.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):s.document.body.appendChild(this.hiddenTextarea),s.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),s.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),s.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),s.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),s.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),s.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),s.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),s.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),s.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(s.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(rt){if(!!this.isEditing){var nt=this.direction==="rtl"?this.keysMapRtl:this.keysMap;if(rt.keyCode in nt)this[nt[rt.keyCode]](rt);else if(rt.keyCode in this.ctrlKeysMapDown&&(rt.ctrlKey||rt.metaKey))this[this.ctrlKeysMapDown[rt.keyCode]](rt);else return;rt.stopImmediatePropagation(),rt.preventDefault(),rt.keyCode>=33&&rt.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(rt){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(rt.keyCode in this.ctrlKeysMapUp&&(rt.ctrlKey||rt.metaKey))this[this.ctrlKeysMapUp[rt.keyCode]](rt);else return;rt.stopImmediatePropagation(),rt.preventDefault(),this.canvas&&this.canvas.requestRenderAll()},onInput:function(rt){var nt=this.fromPaste;if(this.fromPaste=!1,rt&&rt.stopPropagation(),!!this.isEditing){var ot=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,st=this._text.length,at=ot.length,lt,ct,ht=at-st,mt=this.selectionStart,dt=this.selectionEnd,ft=mt!==dt,ut,pt,At;if(this.hiddenTextarea.value===""){this.styles={},this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll());return}var gt=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),vt=mt>gt.selectionStart;ft?(lt=this._text.slice(mt,dt),ht+=dt-mt):at<st&&(vt?lt=this._text.slice(dt+ht,dt):lt=this._text.slice(mt,mt-ht)),ct=ot.slice(gt.selectionEnd-ht,gt.selectionEnd),lt&&lt.length&&(ct.length&&(ut=this.getSelectionStyles(mt,mt+1,!1),ut=ct.map(function(){return ut[0]})),ft?(pt=mt,At=dt):vt?(pt=dt-lt.length,At=dt):(pt=dt,At=dt+lt.length),this.removeStyleFromTo(pt,At)),ct.length&&(nt&&ct.join("")===s.copiedText&&!s.disableStyleCopyPaste&&(ut=s.copiedTextStyle),this.insertNewStyleBlock(ct,mt,ut)),this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(rt){this.compositionStart=rt.target.selectionStart,this.compositionEnd=rt.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(s.copiedText=this.getSelectedText(),s.disableStyleCopyPaste?s.copiedTextStyle=null:s.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(rt){return rt&&rt.clipboardData||s.window.clipboardData},_getWidthBeforeCursor:function(rt,nt){var ot=this._getLineLeftOffset(rt),st;return nt>0&&(st=this.__charBounds[rt][nt-1],ot+=st.left+st.width),ot},getDownCursorOffset:function(rt,nt){var ot=this._getSelectionForOffset(rt,nt),st=this.get2DCursorLocation(ot),at=st.lineIndex;if(at===this._textLines.length-1||rt.metaKey||rt.keyCode===34)return this._text.length-ot;var lt=st.charIndex,ct=this._getWidthBeforeCursor(at,lt),ht=this._getIndexOnLine(at+1,ct),mt=this._textLines[at].slice(lt);return mt.length+ht+1+this.missingNewlineOffset(at)},_getSelectionForOffset:function(rt,nt){return rt.shiftKey&&this.selectionStart!==this.selectionEnd&&nt?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(rt,nt){var ot=this._getSelectionForOffset(rt,nt),st=this.get2DCursorLocation(ot),at=st.lineIndex;if(at===0||rt.metaKey||rt.keyCode===33)return-ot;var lt=st.charIndex,ct=this._getWidthBeforeCursor(at,lt),ht=this._getIndexOnLine(at-1,ct),mt=this._textLines[at].slice(0,lt),dt=this.missingNewlineOffset(at-1);return-this._textLines[at-1].length+ht-mt.length+(1-dt)},_getIndexOnLine:function(rt,nt){for(var ot=this._textLines[rt],st=this._getLineLeftOffset(rt),at=st,lt=0,ct,ht,mt=0,dt=ot.length;mt<dt;mt++)if(ct=this.__charBounds[rt][mt].width,at+=ct,at>nt){ht=!0;var ft=at-ct,ut=at,pt=Math.abs(ft-nt),At=Math.abs(ut-nt);lt=At<pt?mt:mt-1;break}return ht||(lt=ot.length-1),lt},moveCursorDown:function(rt){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",rt)},moveCursorUp:function(rt){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown("Up",rt)},_moveCursorUpOrDown:function(rt,nt){var ot="get"+rt+"CursorOffset",st=this[ot](nt,this._selectionDirection==="right");nt.shiftKey?this.moveCursorWithShift(st):this.moveCursorWithoutShift(st),st!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(rt){var nt=this._selectionDirection==="left"?this.selectionStart+rt:this.selectionEnd+rt;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,nt),rt!==0},moveCursorWithoutShift:function(rt){return rt<0?(this.selectionStart+=rt,this.selectionEnd=this.selectionStart):(this.selectionEnd+=rt,this.selectionStart=this.selectionEnd),rt!==0},moveCursorLeft:function(rt){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight("Left",rt)},_move:function(rt,nt,ot){var st;if(rt.altKey)st=this["findWordBoundary"+ot](this[nt]);else if(rt.metaKey||rt.keyCode===35||rt.keyCode===36)st=this["findLineBoundary"+ot](this[nt]);else return this[nt]+=ot==="Left"?-1:1,!0;if(typeof st!==void 0&&this[nt]!==st)return this[nt]=st,!0},_moveLeft:function(rt,nt){return this._move(rt,nt,"Left")},_moveRight:function(rt,nt){return this._move(rt,nt,"Right")},moveCursorLeftWithoutShift:function(rt){var nt=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(nt=this._moveLeft(rt,"selectionStart")),this.selectionEnd=this.selectionStart,nt},moveCursorLeftWithShift:function(rt){if(this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd)return this._moveLeft(rt,"selectionEnd");if(this.selectionStart!==0)return this._selectionDirection="left",this._moveLeft(rt,"selectionStart")},moveCursorRight:function(rt){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",rt)},_moveCursorLeftOrRight:function(rt,nt){var ot="moveCursor"+rt+"With";this._currentCursorOpacity=1,nt.shiftKey?ot+="Shift":ot+="outShift",this[ot](nt)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(rt){if(this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd)return this._moveRight(rt,"selectionStart");if(this.selectionEnd!==this._text.length)return this._selectionDirection="right",this._moveRight(rt,"selectionEnd")},moveCursorRightWithoutShift:function(rt){var nt=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(nt=this._moveRight(rt,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,nt},removeChars:function(rt,nt){typeof nt=="undefined"&&(nt=rt+1),this.removeStyleFromTo(rt,nt),this._text.splice(rt,nt-rt),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(rt,nt,ot,st){typeof st=="undefined"&&(st=ot),st>ot&&this.removeStyleFromTo(ot,st);var at=s.util.string.graphemeSplit(rt);this.insertNewStyleBlock(at,ot,nt),this._text=[].concat(this._text.slice(0,ot),at,this._text.slice(st)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var rt=s.util.toFixed,nt=/  +/g;s.util.object.extend(s.Text.prototype,{_toSVG:function(){var ot=this._getSVGLeftTopOffsets(),st=this._getSVGTextAndBg(ot.textTop,ot.textLeft);return this._wrapSVGTextAndBg(st)},toSVG:function(ot){return this._createBaseSVGMarkup(this._toSVG(),{reviver:ot,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(ot){var st=!0,at=this.getSvgTextDecoration(this);return[ot.textBgRects.join(""),'		<text xml:space="preserve" ',this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",at?'text-decoration="'+at+'" ':"",'style="',this.getSvgStyles(st),'"',this.addPaintOrder()," >",ot.textSpans.join(""),`</text>
`]},_getSVGTextAndBg:function(ot,st){var at=[],lt=[],ct=ot,ht;this._setSVGBg(lt);for(var mt=0,dt=this._textLines.length;mt<dt;mt++)ht=this._getLineLeftOffset(mt),(this.textBackgroundColor||this.styleHas("textBackgroundColor",mt))&&this._setSVGTextLineBg(lt,mt,st+ht,ct),this._setSVGTextLineText(at,mt,st+ht,ct),ct+=this.getHeightOfLine(mt);return{textSpans:at,textBgRects:lt}},_createTextCharSpan:function(ot,st,at,lt){var ct=ot!==ot.trim()||ot.match(nt),ht=this.getSvgSpanStyles(st,ct),mt=ht?'style="'+ht+'"':"",dt=st.deltaY,ft="",ut=s.Object.NUM_FRACTION_DIGITS;return dt&&(ft=' dy="'+rt(dt,ut)+'" '),['<tspan x="',rt(at,ut),'" y="',rt(lt,ut),'" ',ft,mt,">",s.util.string.escapeXml(ot),"</tspan>"].join("")},_setSVGTextLineText:function(ot,st,at,lt){var ct=this.getHeightOfLine(st),ht=this.textAlign.indexOf("justify")!==-1,mt,dt,ft="",ut,pt,At=0,gt=this._textLines[st],vt;lt+=ct*(1-this._fontSizeFraction)/this.lineHeight;for(var yt=0,bt=gt.length-1;yt<=bt;yt++)vt=yt===bt||this.charSpacing,ft+=gt[yt],ut=this.__charBounds[st][yt],At===0?(at+=ut.kernedWidth-ut.width,At+=ut.width):At+=ut.kernedWidth,ht&&!vt&&this._reSpaceAndTab.test(gt[yt])&&(vt=!0),vt||(mt=mt||this.getCompleteStyleDeclaration(st,yt),dt=this.getCompleteStyleDeclaration(st,yt+1),vt=this._hasStyleChangedForSvg(mt,dt)),vt&&(pt=this._getStyleDeclaration(st,yt)||{},ot.push(this._createTextCharSpan(ft,pt,at,lt)),ft="",mt=dt,at+=At,At=0)},_pushTextBgRect:function(ot,st,at,lt,ct,ht){var mt=s.Object.NUM_FRACTION_DIGITS;ot.push("		<rect ",this._getFillAttributes(st),' x="',rt(at,mt),'" y="',rt(lt,mt),'" width="',rt(ct,mt),'" height="',rt(ht,mt),`"></rect>
`)},_setSVGTextLineBg:function(ot,st,at,lt){for(var ct=this._textLines[st],ht=this.getHeightOfLine(st)/this.lineHeight,mt=0,dt=0,ft,ut,pt=this.getValueOfPropertyAt(st,0,"textBackgroundColor"),At=0,gt=ct.length;At<gt;At++)ft=this.__charBounds[st][At],ut=this.getValueOfPropertyAt(st,At,"textBackgroundColor"),ut!==pt?(pt&&this._pushTextBgRect(ot,pt,at+dt,lt,mt,ht),dt=ft.left,mt=ft.width,pt=ut):mt+=ft.kernedWidth;ut&&this._pushTextBgRect(ot,ut,at+dt,lt,mt,ht)},_getFillAttributes:function(ot){var st=ot&&typeof ot=="string"?new s.Color(ot):"";return!st||!st.getSource()||st.getAlpha()===1?'fill="'+ot+'"':'opacity="'+st.getAlpha()+'" fill="'+st.setAlpha(1).toRgb()+'"'},_getSVGLineTopOffset:function(ot){for(var st=0,at=0,lt=0;lt<ot;lt++)st+=this.getHeightOfLine(lt);return at=this.getHeightOfLine(lt),{lineTop:st,offset:(this._fontSizeMult-this._fontSizeFraction)*at/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(ot){var st=s.Object.prototype.getSvgStyles.call(this,ot);return st+" white-space: pre;"}})}(),function(rt){var nt=rt.fabric||(rt.fabric={});nt.Textbox=nt.util.createClass(nt.IText,nt.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:nt.Text.prototype._dimensionAffectingProps.concat("width"),_wordJoiners:/[ \t\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(ot){for(var st=0,at=0,lt=0,ct={},ht=0;ht<ot.graphemeLines.length;ht++)ot.graphemeText[lt]===`
`&&ht>0?(at=0,lt++,st++):!this.splitByGrapheme&&this._reSpaceAndTab.test(ot.graphemeText[lt])&&ht>0&&(at++,lt++),ct[ht]={line:st,offset:at},lt+=ot.graphemeLines[ht].length,at+=ot.graphemeLines[ht].length;return ct},styleHas:function(ot,st){if(this._styleMap&&!this.isWrapping){var at=this._styleMap[st];at&&(st=at.line)}return nt.Text.prototype.styleHas.call(this,ot,st)},isEmptyStyles:function(ot){if(!this.styles)return!0;var st=0,at=ot+1,lt,ct,ht=!1,mt=this._styleMap[ot],dt=this._styleMap[ot+1];mt&&(ot=mt.line,st=mt.offset),dt&&(at=dt.line,ht=at===ot,lt=dt.offset),ct=typeof ot=="undefined"?this.styles:{line:this.styles[ot]};for(var ft in ct)for(var ut in ct[ft])if(ut>=st&&(!ht||ut<lt))for(var pt in ct[ft][ut])return!1;return!0},_getStyleDeclaration:function(ot,st){if(this._styleMap&&!this.isWrapping){var at=this._styleMap[ot];if(!at)return null;ot=at.line,st=at.offset+st}return this.callSuper("_getStyleDeclaration",ot,st)},_setStyleDeclaration:function(ot,st,at){var lt=this._styleMap[ot];ot=lt.line,st=lt.offset+st,this.styles[ot][st]=at},_deleteStyleDeclaration:function(ot,st){var at=this._styleMap[ot];ot=at.line,st=at.offset+st,delete this.styles[ot][st]},_getLineStyle:function(ot){var st=this._styleMap[ot];return!!this.styles[st.line]},_setLineStyle:function(ot){var st=this._styleMap[ot];this.styles[st.line]={}},_wrapText:function(ot,st){var at=[],lt;for(this.isWrapping=!0,lt=0;lt<ot.length;lt++)at=at.concat(this._wrapLine(ot[lt],lt,st));return this.isWrapping=!1,at},_measureWord:function(ot,st,at){var lt=0,ct,ht=!0;at=at||0;for(var mt=0,dt=ot.length;mt<dt;mt++){var ft=this._getGraphemeBox(ot[mt],st,mt+at,ct,ht);lt+=ft.kernedWidth,ct=ot[mt]}return lt},_wrapLine:function(ot,st,at,xt){var ct=0,ht=this.splitByGrapheme,mt=[],dt=[],ft=ht?nt.util.string.graphemeSplit(ot):ot.split(this._wordJoiners),ut="",pt=0,At=ht?"":" ",gt=0,vt=0,yt=0,bt=!0,Ct=this._getWidthOfCharSpacing(),xt=xt||0;ft.length===0&&ft.push([]),at-=xt;for(var It=0;It<ft.length;It++)ut=ht?ft[It]:nt.util.string.graphemeSplit(ft[It]),gt=this._measureWord(ut,st,pt),pt+=ut.length,ct+=vt+gt-Ct,ct>at&&!bt?(mt.push(dt),dt=[],ct=gt,bt=!0):ct+=Ct,!bt&&!ht&&dt.push(At),dt=dt.concat(ut),vt=ht?0:this._measureWord([At],st,pt),pt++,bt=!1,gt>yt&&(yt=gt);return It&&mt.push(dt),yt+xt>this.dynamicMinWidth&&(this.dynamicMinWidth=yt-Ct+xt),mt},isEndOfWrapping:function(ot){return!this._styleMap[ot+1]||this._styleMap[ot+1].line!==this._styleMap[ot].line},missingNewlineOffset:function(ot){return this.splitByGrapheme?this.isEndOfWrapping(ot)?1:0:1},_splitTextIntoLines:function(ot){for(var st=nt.Text.prototype._splitTextIntoLines.call(this,ot),at=this._wrapText(st.lines,this.width),lt=new Array(at.length),ct=0;ct<at.length;ct++)lt[ct]=at[ct].join("");return st.lines=lt,st.graphemeLines=at,st},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var ot={};for(var st in this._styleMap)this._textLines[st]&&(ot[this._styleMap[st].line]=1);for(var st in this.styles)ot[st]||delete this.styles[st]},toObject:function(ot){return this.callSuper("toObject",["minWidth","splitByGrapheme"].concat(ot))}}),nt.Textbox.fromObject=function(ot,st){return nt.Object._fromObject("Textbox",ot,st,"text")}}(o),function(){var rt=s.controlsUtils,nt=rt.scaleSkewCursorStyleHandler,ot=rt.scaleCursorStyleHandler,st=rt.scalingEqually,at=rt.scalingYOrSkewingX,lt=rt.scalingXOrSkewingY,ct=rt.scaleOrSkewActionName,ht=s.Object.prototype.controls;if(ht.ml=new s.Control({x:-.5,y:0,cursorStyleHandler:nt,actionHandler:lt,getActionName:ct}),ht.mr=new s.Control({x:.5,y:0,cursorStyleHandler:nt,actionHandler:lt,getActionName:ct}),ht.mb=new s.Control({x:0,y:.5,cursorStyleHandler:nt,actionHandler:at,getActionName:ct}),ht.mt=new s.Control({x:0,y:-.5,cursorStyleHandler:nt,actionHandler:at,getActionName:ct}),ht.tl=new s.Control({x:-.5,y:-.5,cursorStyleHandler:ot,actionHandler:st}),ht.tr=new s.Control({x:.5,y:-.5,cursorStyleHandler:ot,actionHandler:st}),ht.bl=new s.Control({x:-.5,y:.5,cursorStyleHandler:ot,actionHandler:st}),ht.br=new s.Control({x:.5,y:.5,cursorStyleHandler:ot,actionHandler:st}),ht.mtr=new s.Control({x:0,y:-.5,actionHandler:rt.rotationWithSnapping,cursorStyleHandler:rt.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),s.Textbox){var mt=s.Textbox.prototype.controls={};mt.mtr=ht.mtr,mt.tr=ht.tr,mt.br=ht.br,mt.tl=ht.tl,mt.bl=ht.bl,mt.mt=ht.mt,mt.mb=ht.mb,mt.mr=new s.Control({x:.5,y:0,actionHandler:rt.changeWidth,cursorStyleHandler:nt,actionName:"resizing"}),mt.ml=new s.Control({x:-.5,y:0,actionHandler:rt.changeWidth,cursorStyleHandler:nt,actionName:"resizing"})}}()})(fabric);class Index extends FabricCanvasTool{configureCanvas(s){let _=this._canvas;_.isDrawingMode=_.selection=!1,_.forEachObject(_e=>_e.selectable=_e.evented=!1),this._width=s.lineWidth,this._color=s.lineColor}doMouseDown(s){this.isDown=!0;let _=this._canvas;var _e=_.getPointer(s.e),et=[_e.x,_e.y,_e.x,_e.y];this.line=new fabric.fabric.Line(et,{strokeWidth:this._width,fill:this._color,stroke:this._color,originX:"center",originY:"center",selectable:!1,evented:!1}),this.head=new fabric.fabric.Triangle({fill:this._color,left:_e.x,top:_e.y,originX:"center",originY:"center",height:3*this._width,width:3*this._width,selectable:!1,evented:!1,angle:90}),_.add(this.line),_.add(this.head)}doMouseMove(s){if(!this.isDown)return;let _=this._canvas;var _e=_.getPointer(s.e);this.line.set({x2:_e.x,y2:_e.y}),this.line.setCoords();let et=_e.x-this.line.x1,it=_e.y-this.line.y1;this.head.set({left:_e.x,top:_e.y,angle:90+Math.atan2(it,et)*180/Math.PI}),_.renderAll()}doMouseUp(s){this.isDown=!1;let _=this._canvas;_.remove(this.line),_.remove(this.head);let _e=new fabric.fabric.Group([this.line,this.head]);_.add(_e)}doMouseOut(s){this.isDown=!1}}var Tools={Circle:"circle",Line:"line",Arrow:"arrow",Pencil:"pencil",Rectangle:"rectangle",RectangleLabel:"rectangle-label",Select:"select",Pan:"pan",Highlighter:"highlighter",DefaultTool:"default-tool"};class DefaultTool extends FabricCanvasTool{configureCanvas(s){let _=this._canvas;_.isDrawingMode=_.selection=!1,_.forEachObject(_e=>_e.selectable=_e.evented=!1),_.discardActiveObject(),_.defaultCursor="pointer",_.renderAll()}}class Select extends FabricCanvasTool{configureCanvas(s){let _=this._canvas;_.isDrawingMode=!1,_.selection=!0,_.forEachObject(_e=>{_e.selectable=_e.evented=!0})}}class Pencil extends FabricCanvasTool{configureCanvas(s){this._canvas.isDrawingMode=!0,this._canvas.freeDrawingBrush.width=s.lineWidth,this._canvas.freeDrawingBrush.color=s.lineColor}}class Line extends FabricCanvasTool{configureCanvas(s){let _=this._canvas;_.isDrawingMode=_.selection=!1,_.forEachObject(_e=>_e.selectable=_e.evented=!1),this._width=s.lineWidth,this._color=s.lineColor}doMouseDown(s){this.isDown=!0;let _=this._canvas;var _e=_.getPointer(s.e),et=[_e.x,_e.y,_e.x,_e.y];this.line=new fabric.fabric.Line(et,{strokeWidth:this._width,fill:this._color,stroke:this._color,originX:"center",originY:"center",selectable:!1,evented:!1}),_.add(this.line)}doMouseMove(s){if(!this.isDown)return;let _=this._canvas;var _e=_.getPointer(s.e);this.line.set({x2:_e.x,y2:_e.y}),this.line.setCoords(),_.renderAll()}doMouseUp(s){this.isDown=!1}doMouseOut(s){this.isDown=!1}}class Rectangle extends FabricCanvasTool{configureCanvas(s){let _=this._canvas;_.isDrawingMode=_.selection=!1,_.forEachObject(_e=>_e.selectable=_e.evented=!1),this._width=s.lineWidth,this._color=s.lineColor,this._fill=s.fillColor}doMouseDown(s){let _=this._canvas;this.isDown=!0;let _e=_.getPointer(s.e);this.startX=_e.x,this.startY=_e.y,this.rect=new fabric.fabric.Rect({left:this.startX,top:this.startY,originX:"left",originY:"top",width:_e.x-this.startX,height:_e.y-this.startY,stroke:this._color,strokeWidth:this._width,fill:this._fill,transparentCorners:!1,selectable:!1,evented:!1,strokeUniform:!0,noScaleCache:!1,angle:0}),_.add(this.rect)}doMouseMove(s){if(!this.isDown)return;let _=this._canvas,_e=_.getPointer(s.e);this.startX>_e.x&&this.rect.set({left:Math.abs(_e.x)}),this.startY>_e.y&&this.rect.set({top:Math.abs(_e.y)}),this.rect.set({width:Math.abs(this.startX-_e.x)}),this.rect.set({height:Math.abs(this.startY-_e.y)}),this.rect.setCoords(),_.renderAll()}doMouseUp(s){this.isDown=!1}}class RectangleLabelObject{constructor(s,_,_e,et){Xn(this,"update",s=>{!this._textObj||!this._rectObj||s.target===this._rectObj&&this._textObj.set({width:this._rectObj.getScaledWidth(),scaleX:1,scaleY:1,top:this._rectObj.top-this._textObj.getScaledHeight(),left:this._rectObj.left})});this._canvas=s,this._text=_,this._rectObj=new fabric.fabric.Rect(_e),this._textObj=new fabric.fabric.Textbox(_,et),s.on({"object:scaling":this.update}),s.on({"object:moving":this.update})}setText(s){this._text=s,this._textObj.set({text:s})}}class RectangleLabel extends FabricCanvasTool{configureCanvas(s){let _=this._canvas;_.isDrawingMode=_.selection=!1,_.forEachObject(_e=>_e.selectable=_e.evented=!1),this._width=s.lineWidth,this._color=s.lineColor,this._fill=s.fillColor,this._textString=s.text,this._maxFontSize=12}doMouseDown(s){let _=this._canvas;this.isDown=!0;let _e=_.getPointer(s.e);for(this.startX=_e.x,this.startY=_e.y,this.rectangleLabel=new RectangleLabelObject(_,"New drawing",{left:this.startX,top:this.startY,originX:"left",originY:"top",width:_e.x-this.startX,height:_e.y-this.startY,stroke:this._color,strokeWidth:this._width,fill:this._fill,transparentCorners:!1,selectable:!1,evented:!1,strokeUniform:!0,noScaleCache:!1,angle:0},{left:this.startX,top:this.startY-12,originX:"left",originY:"top",width:_e.x-this.startX-this._width,height:_.height/3,fontSize:this._maxFontSize,noScaleCache:!1,backgroundColor:this._color,transparentCorners:!0,hasControls:!1,angle:0}),this._objects&&this._objects.length>0?this._objects.push(this.rectangleLabel):this._objects=[this.rectangleLabel];this.rectangleLabel._textObj.height>_.height/3;)this.rectangleLabel._textObj.set({fontSize:this.rectangleLabel._textObj.fontSize-1,top:this.startY-this.rectangleLabel._textObj.fontSize-12});_.add(this.rectangleLabel._rectObj),_.add(this.rectangleLabel._textObj),_.renderAll()}doMouseMove(s){if(!this.isDown)return;let _=this._canvas,_e=_.getPointer(s.e);this.startX>_e.x&&(this.rectangleLabel._rectObj.set({left:Math.abs(_e.x)}),this.rectangleLabel._textObj.set({left:Math.abs(_e.x)})),this.startY>_e.y&&(this.rectangleLabel._rectObj.set({left:Math.abs(_e.x)}),this.rectangleLabel._textObj.set({top:Math.abs(_e.y)})),this.rectangleLabel._textObj.setCoords(),this.rectangleLabel._rectObj.set({width:Math.abs(this.startX-_e.x)}),this.rectangleLabel._textObj.set({width:this.rectangleLabel._rectObj.getScaledWidth()}),this.rectangleLabel._rectObj.set({height:Math.abs(this.startY-_e.y)}),this.rectangleLabel._rectObj.setCoords(),_.renderAll()}doMouseUp(s){this.isDown=!1,this._canvas.renderAll()}}class Circle extends FabricCanvasTool{configureCanvas(s){let _=this._canvas;_.isDrawingMode=_.selection=!1,_.forEachObject(_e=>_e.selectable=_e.evented=!1),this._width=s.lineWidth,this._color=s.lineColor,this._fill=s.fillColor}doMouseDown(s){let _=this._canvas;this.isDown=!0;let _e=_.getPointer(s.e);[this.startX,this.startY]=[_e.x,_e.y],this.circle=new fabric.fabric.Circle({left:this.startX,top:this.startY,originX:"left",originY:"center",strokeWidth:this._width,stroke:this._color,fill:this._fill,selectable:!1,evented:!1,radius:1}),_.add(this.circle)}doMouseMove(s){if(!this.isDown)return;let _=this._canvas,_e=_.getPointer(s.e);this.circle.set({radius:linearDistance({x:this.startX,y:this.startY},{x:_e.x,y:_e.y})/2,angle:Math.atan2(_e.y-this.startY,_e.x-this.startX)*180/Math.PI}),this.circle.setCoords(),_.renderAll()}doMouseUp(s){this.isDown=!1}}class Pan extends FabricCanvasTool{configureCanvas(s){let _=this._canvas;_.isDrawingMode=_.selection=!1,_.forEachObject(_e=>_e.selectable=_e.evented=!1),_.defaultCursor="move"}doMouseDown(s){let _=this._canvas;this.isDown=!0;let _e=_.getPointer(s.e);this.startX=_e.x,this.startY=_e.y}doMouseMove(s){if(!this.isDown)return;let _=this._canvas,_e=_.getPointer(s.e);_.relativePan({x:_e.x-this.startX,y:_e.y-this.startY}),_.renderAll()}doMouseUp(s){this.isDown=!1}}class Highlighter extends FabricCanvasTool{configureCanvas(s){this._canvas.isDrawingMode=!0,this._canvas.freeDrawingBrush.width=s.lineWidth,this._canvas.freeDrawingBrush.color=s.lineColor.indexOf("#")>-1?hexToRgbA(s.lineColor):hexToRgbA(colorNameToHex(s.lineColor))}}class SketchField extends react.exports.PureComponent{constructor(){super(...arguments);Xn(this,"state",{action:!0});Xn(this,"_initTools",_=>{this._tools={},this._tools[Tools.Select]=new Select(_),this._tools[Tools.Pencil]=new Pencil(_),this._tools[Tools.Line]=new Line(_),this._tools[Tools.Arrow]=new Index(_),this._tools[Tools.Rectangle]=new Rectangle(_),this._tools[Tools.RectangleLabel]=new RectangleLabel(_),this._tools[Tools.Circle]=new Circle(_),this._tools[Tools.Pan]=new Pan(_),this._tools[Tools.Highlighter]=new Highlighter(_),this._tools[Tools.DefaultTool]=new DefaultTool(_)});Xn(this,"enableTouchScroll",()=>{let _=this._fc;_.allowTouchScrolling||(_.allowTouchScrolling=!0)});Xn(this,"disableTouchScroll",()=>{let _=this._fc;_.allowTouchScrolling&&(_.allowTouchScrolling=!1)});Xn(this,"addImg",(_,_e={})=>{let et=this._fc;fabric.fabric.Image.fromURL(_,it=>{let tt={left:Math.random()*(et.getWidth()-it.width*.5),top:Math.random()*(et.getHeight()-it.height*.5),scale:.5};Object.assign(tt,_e),it.scale(tt.scale),it.set({left:tt.left,top:tt.top}),et.add(it)})});Xn(this,"_onObjectAdded",_=>{const{onObjectAdded:_e}=this.props;if(!this.state.action){this.setState({action:!0});return}let et=_.target;et.__version=1;let it=et.toJSON();et.__originalState=it;let tt=JSON.stringify(it);this._history.keep([et,tt,tt]),_e(_)});Xn(this,"_onObjectMoving",_=>{const{onObjectMoving:_e}=this.props;_e(_)});Xn(this,"_onObjectScaling",_=>{const{onObjectScaling:_e}=this.props;_e(_)});Xn(this,"_onObjectRotating",_=>{const{onObjectRotating:_e}=this.props;_e(_)});Xn(this,"_onObjectModified",_=>{const{onObjectModified:_e}=this.props;let et=_.target;et.__version+=1;let it=JSON.stringify(et.__originalState),tt=et.toJSON();et.__originalState=tt;let rt=JSON.stringify(tt);this._history.keep([et,it,rt]),_e(_)});Xn(this,"_onObjectRemoved",_=>{const{onObjectRemoved:_e}=this.props;let et=_.target;if(et.__removed){et.__version+=1;return}et.__version=0,_e(_)});Xn(this,"_onMouseDown",_=>{const{onMouseDown:_e}=this.props;this._selectedTool.doMouseDown(_),_e(_)});Xn(this,"_onMouseMove",_=>{const{onMouseMove:_e}=this.props;this._selectedTool.doMouseMove(_),_e(_)});Xn(this,"_onMouseOut",_=>{const{onMouseOut:_e}=this.props;if(this._selectedTool.doMouseOut(_),this.props.onChange){let et=this.props.onChange;setTimeout(()=>{et(_.e)},10)}_e(_)});Xn(this,"_onMouseUp",_=>{const{onMouseUp:_e}=this.props;if(this._selectedTool.doMouseUp(_),this.props.tool!==Tools.Pencil){const it=this._fc.getObjects(),tt=it[it.length-1];tt&&tt.__version===1&&(tt.__originalState=tt.toJSON())}if(this.props.onChange){let et=this.props.onChange;setTimeout(()=>{et(_.e)},10)}_e(_)});Xn(this,"_resize",(_,_e=null,et=null)=>{_&&_.preventDefault();let{widthCorrection:it,heightCorrection:tt}=this.props,rt=this._fc,{offsetWidth:nt,clientHeight:ot}=this._container,st=_e||rt.getWidth(),at=et||rt.getHeight(),lt=((nt-it)/st).toFixed(2),ct=((ot-tt)/at).toFixed(2);if(rt.setWidth(nt-it),rt.setHeight(ot-tt),rt.backgroundImage){let mt=rt.backgroundImage;mt.width=mt.width*lt,mt.height=mt.height*ct}let ht=rt.getObjects();for(let mt in ht){let dt=ht[mt],ft=dt.scaleX,ut=dt.scaleY,pt=dt.left,At=dt.top,gt=ft*lt,vt=ut*ct,yt=pt*lt,bt=At*ct;dt.scaleX=gt,dt.scaleY=vt,dt.left=yt,dt.top=bt,dt.setCoords()}rt.renderAll(),rt.calcOffset()});Xn(this,"_backgroundColor",_=>{if(!_)return;let _e=this._fc;_e.setBackgroundColor(_,()=>_e.renderAll())});Xn(this,"zoom",_=>{let _e=this._fc,et=_e.getObjects();for(let it in et)et[it].scaleX=et[it].scaleX*_,et[it].scaleY=et[it].scaleY*_,et[it].left=et[it].left*_,et[it].top=et[it].top*_,et[it].setCoords();_e.renderAll(),_e.calcOffset()});Xn(this,"undo",()=>{let _=this._history,[_e,et,it]=_.getCurrent();_.undo(),_e.__removed?this.setState({action:!1},()=>{this._fc.add(_e),_e.__version-=1,_e.__removed=!1}):_e.__version<=1?this._fc.remove(_e):(_e.__version-=1,_e.setOptions(JSON.parse(et)),_e.setCoords(),this._fc.renderAll()),this.props.onChange&&this.props.onChange()});Xn(this,"redo",()=>{let _=this._history;if(_.canRedo()){let _e=this._fc,[et,it,tt]=_.redo();et.__version===0?this.setState({action:!1},()=>{_e.add(et),et.__version=1}):(et.__version+=1,et.setOptions(JSON.parse(tt))),et.setCoords(),_e.renderAll(),this.props.onChange&&this.props.onChange()}});Xn(this,"canUndo",()=>this._history.canUndo());Xn(this,"canRedo",()=>this._history.canRedo());Xn(this,"toDataURL",_=>this._fc.toDataURL(_));Xn(this,"toJSON",_=>this._fc.toJSON(_));Xn(this,"fromJSON",_=>{if(!_)return;let _e=this._fc;setTimeout(()=>{_e.loadFromJSON(_,()=>{this.props.tool===Tools.DefaultTool&&(_e.isDrawingMode=_e.selection=!1,_e.forEachObject(et=>et.selectable=et.evented=!1)),_e.renderAll(),this.props.onChange&&this.props.onChange()})},100)});Xn(this,"clear",_=>{let _e=this.toJSON(_);return this._fc.clear(),this._history.clear(),_e});Xn(this,"hasSelection",()=>!!this._fc.getActiveObject());Xn(this,"clearSelection",()=>{let _=this._fc;_.discardActiveObject(),_.requestRenderAll()});Xn(this,"removeSelected",()=>{let _=this._fc,_e=_.getActiveObject();if(_e){let et=[];_e.type==="activeSelection"?_e.forEachObject(it=>et.push(it)):et.push(_e),et.forEach(it=>{it.__removed=!0;let tt=it.toJSON();it.__originalState=tt;let rt=JSON.stringify(tt);this._history.keep([it,rt,rt]),_.remove(it)}),_.discardActiveObject(),_.requestRenderAll()}});Xn(this,"copy",()=>{this._fc.getActiveObject().clone(_e=>this._clipboard=_e)});Xn(this,"paste",()=>{this._clipboard.clone(_=>{let _e=this._fc;_e.discardActiveObject(),_.set({left:_.left+10,top:_.top+10,evented:!0}),_.type==="activeSelection"?(_.canvas=_e,_.forEachObject(et=>_e.add(et)),_.setCoords()):_e.add(_),this._clipboard.top+=10,this._clipboard.left+=10,_e.setActiveObject(_),_e.requestRenderAll()})});Xn(this,"setBackgroundFromDataUrl",(_,_e={})=>{let et=this._fc,it=new Image;it.setAttribute("crossOrigin","anonymous");const st=_e,{stretched:tt,stretchedX:rt,stretchedY:nt}=st,ot=Ps(st,["stretched","stretchedX","stretchedY"]);it.onload=()=>{const at=new fabric.fabric.Image(it);(tt||rt)&&at.scaleToWidth(et.width),(tt||nt)&&at.scaleToHeight(et.height),et.setBackgroundImage(at,()=>et.renderAll(),ot)},it.src=_});Xn(this,"addText",(_,_e={})=>{let et=this._fc,it=new fabric.fabric.IText(_,_e),tt={left:(et.getWidth()-it.width)*.5,top:(et.getHeight()-it.height)*.5};Object.assign(_e,tt),it.set({left:_e.left,top:_e.top}),et.add(it)});Xn(this,"callEvent",(_,_e)=>{this._selectedTool&&_e(_)});Xn(this,"componentDidMount",()=>{let{tool:_,value:_e,undoSteps:et,defaultValue:it,backgroundColor:tt}=this.props,rt=this._fc=new fabric.fabric.Canvas(this._canvas);this._initTools(rt),this._backgroundColor(tt);let nt=this._tools[_];nt&&nt.configureCanvas(this.props),this._selectedTool=nt,window.addEventListener("resize",this._resize,!1),this._history=new History(et),rt.on("object:added",ot=>this.callEvent(ot,this._onObjectAdded)),rt.on("object:modified",ot=>this.callEvent(ot,this._onObjectModified)),rt.on("object:removed",ot=>this.callEvent(ot,this._onObjectRemoved)),rt.on("mouse:down",ot=>this.callEvent(ot,this._onMouseDown)),rt.on("mouse:move",ot=>this.callEvent(ot,this._onMouseMove)),rt.on("mouse:up",ot=>this.callEvent(ot,this._onMouseUp)),rt.on("mouse:out",ot=>this.callEvent(ot,this._onMouseOut)),rt.on("object:moving",ot=>this.callEvent(ot,this._onObjectMoving)),rt.on("object:scaling",ot=>this.callEvent(ot,this._onObjectScaling)),rt.on("object:rotating",ot=>this.callEvent(ot,this._onObjectRotating)),this.disableTouchScroll(),this._resize(),(_e||it)&&this.fromJSON(_e||it)});Xn(this,"componentWillUnmount",()=>window.removeEventListener("resize",this._resize));Xn(this,"componentDidUpdate",(_,_e)=>{(this.props.width!==_.width||this.props.height!==_.height)&&this._resize(),this.props.tool!==_.tool&&(this._selectedTool=this._tools[this.props.tool],this._fc.defaultCursor="default",this._selectedTool&&this._selectedTool.configureCanvas(this.props)),this.props.backgroundColor!==_.backgroundColor&&this._backgroundColor(this.props.backgroundColor),(this.props.value!==_.value||this.props.value&&this.props.forceValue)&&this.fromJSON(this.props.value)});Xn(this,"render",()=>{let{className:_,style:_e,width:et,height:it}=this.props,tt=Object.assign({},_e||{},et?{width:et}:{},it?{height:it}:{height:512});return jsx("div",{className:_,ref:rt=>this._container=rt,style:tt,children:jsx("canvas",{id:uuid4(),ref:rt=>this._canvas=rt,children:"Sorry, Canvas HTML5 element is not supported by your browser :("})})})}}Xn(SketchField,"propTypes",{lineColor:PropTypes.string,lineWidth:PropTypes.number,fillColor:PropTypes.string,backgroundColor:PropTypes.string,opacity:PropTypes.number,undoSteps:PropTypes.number,tool:PropTypes.string,imageFormat:PropTypes.string,value:PropTypes.object,forceValue:PropTypes.bool,widthCorrection:PropTypes.number,heightCorrection:PropTypes.number,onChange:PropTypes.func,defaultValue:PropTypes.object,width:PropTypes.number,height:PropTypes.number,onObjectAdded:PropTypes.func,onObjectModified:PropTypes.func,onObjectRemoved:PropTypes.func,onMouseDown:PropTypes.func,onMouseMove:PropTypes.func,onMouseUp:PropTypes.func,onMouseOut:PropTypes.func,onObjectMoving:PropTypes.func,onObjectScaling:PropTypes.func,onObjectRotating:PropTypes.func,className:PropTypes.string,style:PropTypes.object}),Xn(SketchField,"defaultProps",{lineColor:"black",lineWidth:10,fillColor:"transparent",backgroundColor:"transparent",opacity:1,undoSteps:25,tool:null,widthCorrection:0,heightCorrection:0,forceValue:!1,onObjectAdded:()=>null,onObjectModified:()=>null,onObjectRemoved:()=>null,onMouseDown:()=>null,onMouseMove:()=>null,onMouseUp:()=>null,onMouseOut:()=>null,onObjectMoving:()=>null,onObjectScaling:()=>null,onObjectRotating:()=>null});var tuiImageEditor$1="",toastuiReactImageEditor={exports:{}},tuiImageEditor={exports:{}},tuiCodeSnippet={exports:{}};/*!
 * tui-code-snippet.js
 * @version 1.5.2
 * @author NHN. FE Development Lab <dl_javascript@nhn.com>
 * @license MIT
 */(function(o,s){(function(_e,et){o.exports=et()})(commonjsGlobal,function(){return function(_){var _e={};function et(it){if(_e[it])return _e[it].exports;var tt=_e[it]={exports:{},id:it,loaded:!1};return _[it].call(tt.exports,tt,tt.exports,et),tt.loaded=!0,tt.exports}return et.m=_,et.c=_e,et.p="dist",et(0)}([function(_,_e,et){var it={},tt=et(1),rt=tt.extend;rt(it,tt),rt(it,et(3)),rt(it,et(2)),rt(it,et(4)),rt(it,et(5)),rt(it,et(6)),rt(it,et(7)),rt(it,et(8)),rt(it,et(9)),it.browser=et(10),it.popup=et(11),it.formatDate=et(12),it.defineClass=et(13),it.defineModule=et(14),it.defineNamespace=et(15),it.CustomEvents=et(16),it.Enum=et(17),it.ExMap=et(18),it.HashMap=et(20),it.Map=et(19),_.exports=it},function(_,_e,et){var it=et(2),tt=et(3),rt=0;function nt(dt,ft){var ut=Object.prototype.hasOwnProperty,pt,At,gt,vt;for(gt=1,vt=arguments.length;gt<vt;gt+=1){pt=arguments[gt];for(At in pt)ut.call(pt,At)&&(dt[At]=pt[At])}return dt}function ot(dt){return dt.__fe_id||(rt+=1,dt.__fe_id=rt),dt.__fe_id}function st(dt){return it.isExisty(mt(dt,"__fe_id"))}function at(){rt=0}function lt(dt){var ft=[],ut;for(ut in dt)dt.hasOwnProperty(ut)&&ft.push(ut);return ft}function ct(dt){var ft=arguments.length,ut=1;if(ft<1)return!0;for(;ut<ft;ut+=1)if(!ht(dt,arguments[ut]))return!1;return!0}function ht(dt,ft){var ut=[],pt=[],At;if(isNaN(dt)&&isNaN(ft)&&it.isNumber(dt)&&it.isNumber(ft)||dt===ft)return!0;if(it.isFunction(dt)&&it.isFunction(ft)||dt instanceof Date&&ft instanceof Date||dt instanceof RegExp&&ft instanceof RegExp||dt instanceof String&&ft instanceof String||dt instanceof Number&&ft instanceof Number)return dt.toString()===ft.toString();if(!(dt instanceof Object&&ft instanceof Object)||dt.isPrototypeOf(ft)||ft.isPrototypeOf(dt)||dt.constructor!==ft.constructor||dt.prototype!==ft.prototype||tt.inArray(dt,ut)>-1||tt.inArray(ft,pt)>-1)return!1;for(At in ft){if(ft.hasOwnProperty(At)!==dt.hasOwnProperty(At))return!1;if(typeof ft[At]!=typeof dt[At])return!1}for(At in dt){if(ft.hasOwnProperty(At)!==dt.hasOwnProperty(At))return!1;if(typeof ft[At]!=typeof dt[At])return!1;if(typeof dt[At]=="object"||typeof dt[At]=="function"){if(ut.push(dt),pt.push(ft),!ht(dt[At],ft[At]))return!1;ut.pop(),pt.pop()}else if(dt[At]!==ft[At])return!1}return!0}function mt(dt,ft){for(var ut=arguments,pt=ut[0],At=1,gt=ut.length;At<gt;At+=1){if(it.isUndefined(pt)||it.isNull(pt))return;pt=pt[ut[At]]}return pt}_.exports={extend:nt,stamp:ot,hasStamp:st,resetLastId:at,keys:Object.prototype.keys||lt,compareJSON:ct,pick:mt}},function(_,_e){var et=Object.prototype.toString;function it(Mt){return!tt(Mt)&&!rt(Mt)}function tt(Mt){return Mt===void 0}function rt(Mt){return Mt===null}function nt(Mt){return it(Mt)&&Mt!==!1}function ot(Mt){return!nt(Mt)}function st(Mt){var jt=it(Mt)&&(et.call(Mt)==="[object Arguments]"||!!Mt.callee);return jt}function at(Mt){return Mt instanceof Array}function lt(Mt){return Mt===Object(Mt)}function ct(Mt){return Mt instanceof Function}function ht(Mt){return typeof Mt=="number"||Mt instanceof Number}function mt(Mt){return typeof Mt=="string"||Mt instanceof String}function dt(Mt){return typeof Mt=="boolean"||Mt instanceof Boolean}function ft(Mt){return et.call(Mt)==="[object Array]"}function ut(Mt){return et.call(Mt)==="[object Function]"}function pt(Mt){return et.call(Mt)==="[object Number]"}function At(Mt){return et.call(Mt)==="[object String]"}function gt(Mt){return et.call(Mt)==="[object Boolean]"}function vt(Mt){return typeof HTMLElement=="object"?Mt&&(Mt instanceof HTMLElement||!!Mt.nodeType):!!(Mt&&Mt.nodeType)}function yt(Mt){return typeof HTMLElement=="object"?Mt&&Mt instanceof HTMLElement:!!(Mt&&Mt.nodeType&&Mt.nodeType===1)}function bt(Mt){return!it(Mt)||Ct(Mt)?!0:at(Mt)||st(Mt)?Mt.length===0:lt(Mt)&&!ct(Mt)?!xt(Mt):!0}function Ct(Mt){return mt(Mt)&&Mt===""}function xt(Mt){var jt;for(jt in Mt)if(Mt.hasOwnProperty(jt))return!0;return!1}function It(Mt){return!bt(Mt)}function St(Mt){return Mt instanceof Date}function Ot(Mt){return et.call(Mt)==="[object Date]"}_.exports={isExisty:it,isUndefined:tt,isNull:rt,isTruthy:nt,isFalsy:ot,isArguments:st,isArray:at,isArraySafe:ft,isObject:lt,isFunction:ct,isFunctionSafe:ut,isNumber:ht,isNumberSafe:pt,isDate:St,isDateSafe:Ot,isString:mt,isStringSafe:At,isBoolean:dt,isBooleanSafe:gt,isHTMLNode:vt,isHTMLTag:yt,isEmpty:bt,isNotEmpty:It}},function(_,_e,et){var it=et(4),tt=et(2),rt=Array.prototype.slice,nt,ot=function(lt,ct,ht){var mt=[],dt;for(tt.isUndefined(ct)&&(ct=lt||0,lt=0),ht=ht||1,dt=ht<0?-1:1,ct*=dt;lt*dt<ct;lt+=ht)mt.push(lt);return mt},st=function(){var lt=rt.call(arguments),ct=[];return it.forEach(lt,function(ht){it.forEach(ht,function(mt,dt){ct[dt]||(ct[dt]=[]),ct[dt].push(mt)})}),ct},at=function(lt,ct,ht){var mt,dt;if(ht=ht||0,!tt.isArray(ct))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(ct,lt,ht);for(dt=ct.length,mt=ht;ht>=0&&mt<dt;mt+=1)if(ct[mt]===lt)return mt;return-1};nt={inArray:at,range:ot,zip:st},_.exports=nt},function(_,_e,et){var it=et(2),tt=et(1);function rt(mt,dt,ft){var ut=0,pt=mt.length;for(ft=ft||null;ut<pt&&dt.call(ft,mt[ut],ut,mt)!==!1;ut+=1);}function nt(mt,dt,ft){var ut;ft=ft||null;for(ut in mt)if(mt.hasOwnProperty(ut)&&dt.call(ft,mt[ut],ut,mt)===!1)break}function ot(mt,dt,ft){it.isArray(mt)?rt(mt,dt,ft):nt(mt,dt,ft)}function st(mt,dt,ft){var ut=[];return ft=ft||null,ot(mt,function(){ut.push(dt.apply(ft,arguments))}),ut}function at(mt,dt,ft){var ut=0,pt,At,gt;for(ft=ft||null,it.isArray(mt)?(At=mt.length,gt=mt[ut]):(pt=tt.keys(mt),At=pt.length,gt=mt[pt[ut+=1]]),ut+=1;ut<At;ut+=1)gt=dt.call(ft,gt,mt[pt?pt[ut]:ut]);return gt}function lt(mt){var dt;try{dt=Array.prototype.slice.call(mt)}catch{dt=[],rt(mt,function(ut){dt.push(ut)})}return dt}function ct(mt,dt,ft){var ut,pt;if(ft=ft||null,!it.isObject(mt)||!it.isFunction(dt))throw new Error("wrong parameter");return it.isArray(mt)?(ut=[],pt=function(At,gt){At.push(gt[0])}):(ut={},pt=function(At,gt){At[gt[1]]=gt[0]}),ot(mt,function(){dt.apply(ft,arguments)&&pt(ut,arguments)},ft),ut}function ht(mt,dt){var ft=st(mt,function(ut){return ut[dt]});return ft}_.exports={forEachOwnProperties:nt,forEachArray:rt,forEach:ot,toArray:lt,map:st,reduce:at,filter:ct,pluck:ht}},function(_,_e){function et(it,tt){var rt=Array.prototype.slice,nt;return it.bind?it.bind.apply(it,rt.call(arguments,1)):(nt=rt.call(arguments,2),function(){return it.apply(tt,nt.length?nt.concat(rt.call(arguments)):arguments)})}_.exports={bind:et}},function(_,_e){function et(tt){function rt(){}return rt.prototype=tt,new rt}function it(tt,rt){var nt=et(rt.prototype);nt.constructor=tt,tt.prototype=nt}_.exports={createObject:et,inherit:it}},function(_,_e,et){var it=et(4),tt=et(1);function rt(at){var lt={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&#39;":"'","&nbsp;":" "};return at.replace(/&amp;|&lt;|&gt;|&quot;|&#39;|&nbsp;/g,function(ct){return lt[ct]?lt[ct]:ct})}function nt(at){var lt={'"':"quot","&":"amp","<":"lt",">":"gt","'":"#39"};return at.replace(/[<>&"']/g,function(ct){return lt[ct]?"&"+lt[ct]+";":ct})}function ot(at){return/[<>&"']/.test(at)}function st(at,lt){for(var ct=0,ht=at.length,mt={},dt,ft;ct<ht;ct+=1)ft=at.charAt(ct),mt[ft]=1;for(ct=0,ht=lt.length;ct<ht;ct+=1)ft=lt.charAt(ct),mt[ft]&&(mt[ft]+=1);return mt=it.filter(mt,function(ut){return ut>1}),mt=tt.keys(mt).sort(),dt=mt.join(""),dt}_.exports={decodeHTMLEntity:rt,encodeHTMLEntity:nt,hasEncodableString:ot,getDuplicatedChar:st}},function(_,_e){var et={},it=Array.prototype.slice;function tt(ot,st){var at,lt;st=st||0;function ct(){lt=it.call(arguments),window.clearTimeout(at),at=window.setTimeout(function(){ot.apply(null,lt)},st)}return ct}function rt(){return Number(new Date)}function nt(ot,st){var at,lt=!0,ct=function(pt){ot.apply(null,pt),at=null},ht,mt,dt;st=st||0,ht=et.debounce(ct,st);function ft(){if(dt=it.call(arguments),lt){ct(dt),lt=!1;return}mt=et.timestamp(),at=at||mt,ht(dt),mt-at>=st&&ct(dt)}function ut(){lt=!0,at=null}return ft.reset=ut,ft}et.timestamp=rt,et.debounce=tt,et.throttle=nt,_.exports=et},function(_,_e,et){var it=et(1),tt=et(4),rt=et(2),nt=7*24*60*60*1e3;function ot(lt){var ct=new Date().getTime();return ct-lt>nt}function st(lt,ct){var ht="https://www.google-analytics.com/collect",mt=location.hostname,dt="event",ft="use",ut="TOAST UI "+lt+" for "+mt+": Statistics",pt=window.localStorage.getItem(ut);!rt.isUndefined(window.tui)&&window.tui.usageStatistics===!1||pt&&!ot(pt)||(window.localStorage.setItem(ut,new Date().getTime()),setTimeout(function(){(document.readyState==="interactive"||document.readyState==="complete")&&at(ht,{v:1,t:dt,tid:ct,cid:mt,dp:mt,dh:lt,el:lt,ec:ft})},1e3))}function at(lt,ct){var ht=tt.map(it.keys(ct),function(dt,ft){var ut=ft===0?"":"&";return ut+dt+"="+ct[dt]}).join(""),mt=document.createElement("img");return mt.src=lt+"?"+ht,mt.style.display="none",document.body.appendChild(mt),document.body.removeChild(mt),mt}_.exports={imagePing:at,sendHostname:st}},function(_,_e){var et={chrome:!1,firefox:!1,safari:!1,msie:!1,edge:!1,others:!1,version:0};window&&window.navigator&&it();function it(){var tt=window.navigator,rt=tt.appName.replace(/\s/g,"_"),nt=tt.userAgent,ot=/MSIE\s([0-9]+[.0-9]*)/,st=/Trident.*rv:11\./,at=/Edge\/(\d+)\./,lt={firefox:/Firefox\/(\d+)\./,chrome:/Chrome\/(\d+)\./,safari:/Version\/([\d.]+).*Safari\/(\d+)/},ct,ht,mt={Microsoft_Internet_Explorer:function(){var ft=nt.match(ot);ft?(et.msie=!0,et.version=parseFloat(ft[1])):et.others=!0},Netscape:function(){var ft=!1;if(st.exec(nt))et.msie=!0,et.version=11,ft=!0;else if(at.exec(nt))et.edge=!0,et.version=nt.match(at)[1],ft=!0;else for(ct in lt)if(lt.hasOwnProperty(ct)&&(ht=nt.match(lt[ct]),ht&&ht.length>1)){et[ct]=ft=!0,et.version=parseFloat(ht[1]||0);break}ft||(et.others=!0)}},dt=mt[rt];dt&&mt[rt]()}_.exports=et},function(_,_e,et){var it=et(4),tt=et(2),rt=et(5),nt=et(10),ot=et(1),st=0;function at(){this.openedPopup={},this.closeWithParentPopup={},this.postBridgeUrl=""}at.prototype.getPopupList=function(lt){var ct;return tt.isExisty(lt)?ct=this.openedPopup[lt]:ct=this.openedPopup,ct},at.prototype.openPopup=function(lt,ct){var ht,mt,dt;if(ct=ot.extend({popupName:"popup_"+st+"_"+Number(new Date),popupOptionStr:"",useReload:!0,closeWithParent:!0,method:"get",param:{}},ct||{}),ct.method=ct.method.toUpperCase(),this.postBridgeUrl=ct.postBridgeUrl||this.postBridgeUrl,dt=ct.method==="POST"&&ct.param&&nt.msie&&nt.version===11,!tt.isExisty(lt))throw new Error("Popup#open() need popup url.");st+=1,ct.param&&(ct.method==="GET"?lt=lt+(/\?/.test(lt)?"&":"?")+this._parameterize(ct.param):ct.method==="POST"&&(dt||(mt=this.createForm(lt,ct.param,ct.method,ct.popupName),lt="about:blank"))),ht=this.openedPopup[ct.popupName],tt.isExisty(ht)?ht.closed?this.openedPopup[ct.popupName]=ht=this._open(dt,ct.param,lt,ct.popupName,ct.popupOptionStr):(ct.useReload&&ht.location.replace(lt),ht.focus()):this.openedPopup[ct.popupName]=ht=this._open(dt,ct.param,lt,ct.popupName,ct.popupOptionStr),this.closeWithParentPopup[ct.popupName]=ct.closeWithParent,(!ht||ht.closed||tt.isUndefined(ht.closed))&&alert("please enable popup windows for this website"),ct.param&&ct.method==="POST"&&!dt&&(ht&&mt.submit(),mt.parentNode&&mt.parentNode.removeChild(mt)),window.onunload=rt.bind(this.closeAllPopup,this)},at.prototype.close=function(lt,ct){var ht=ct||window;lt=tt.isExisty(lt)?lt:!1,lt&&(window.onunload=null),ht.closed||(ht.opener=window.location.href,ht.close())},at.prototype.closeAllPopup=function(lt){var ct=tt.isExisty(lt);it.forEachOwnProperties(this.openedPopup,function(ht,mt){(ct&&this.closeWithParentPopup[mt]||!ct)&&this.close(!1,ht)},this)},at.prototype.focus=function(lt){this.getPopupList(lt).focus()},at.prototype.parseQuery=function(){var lt={},ct,ht;return ct=window.location.search.substr(1),it.forEachArray(ct.split("&"),function(mt){ht=mt.split("="),lt[decodeURIComponent(ht[0])]=decodeURIComponent(ht[1])}),lt},at.prototype.createForm=function(lt,ct,ht,mt,dt){var ft=document.createElement("form"),ut;return dt=dt||document.body,ft.method=ht||"POST",ft.action=lt||"",ft.target=mt||"",ft.style.display="none",it.forEachOwnProperties(ct,function(pt,At){ut=document.createElement("input"),ut.name=At,ut.type="hidden",ut.value=pt,ft.appendChild(ut)}),dt.appendChild(ft),ft},at.prototype._parameterize=function(lt){var ct=[];return it.forEachOwnProperties(lt,function(ht,mt){ct.push(encodeURIComponent(mt)+"="+encodeURIComponent(ht))}),ct.join("&")},at.prototype._open=function(lt,ct,ht,mt,dt){var ft;return lt?(ft=window.open(this.postBridgeUrl,mt,dt),setTimeout(function(){ft.redirect(ht,ct)},100)):ft=window.open(ht,mt,dt),ft},_.exports=new at},function(_,_e,et){var it=et(2),tt=et(1),rt=/[\\]*YYYY|[\\]*YY|[\\]*MMMM|[\\]*MMM|[\\]*MM|[\\]*M|[\\]*DD|[\\]*D|[\\]*HH|[\\]*H|[\\]*A/gi,nt=["Invalid month","January","February","March","April","May","June","July","August","September","October","November","December"],ot=[0,31,28,31,30,31,30,31,31,30,31,30,31],st={M:function(ct){return Number(ct.month)},MM:function(ct){var ht=ct.month;return Number(ht)<10?"0"+ht:ht},MMM:function(ct){return nt[Number(ct.month)].substr(0,3)},MMMM:function(ct){return nt[Number(ct.month)]},D:function(ct){return Number(ct.date)},d:function(ct){return st.D(ct)},DD:function(ct){var ht=ct.date;return Number(ht)<10?"0"+ht:ht},dd:function(ct){return st.DD(ct)},YY:function(ct){return Number(ct.year)%100},yy:function(ct){return st.YY(ct)},YYYY:function(ct){var ht="20",mt=ct.year;return mt>69&&mt<100&&(ht="19"),Number(mt)<100?ht+String(mt):mt},yyyy:function(ct){return st.YYYY(ct)},A:function(ct){return ct.meridiem},a:function(ct){return ct.meridiem},hh:function(ct){var ht=ct.hour;return Number(ht)<10?"0"+ht:ht},HH:function(ct){return st.hh(ct)},h:function(ct){return String(Number(ct.hour))},H:function(ct){return st.h(ct)},m:function(ct){return String(Number(ct.minute))},mm:function(ct){var ht=ct.minute;return Number(ht)<10?"0"+ht:ht}};function at(ct,ht,mt){var dt,ft,ut,pt;return ct=Number(ct),ht=Number(ht),mt=Number(mt),dt=ct>-1&&ct<100||ct>1969&&ct<2070,ft=ht>0&&ht<13,!dt||!ft?!1:(pt=ot[ht],ht===2&&ct%4===0&&(ct%100!==0||ct%400===0)&&(pt=29),ut=mt>0&&mt<=pt,ut)}function lt(ct,ht,mt){var dt=tt.pick(mt,"meridiemSet","AM")||"AM",ft=tt.pick(mt,"meridiemSet","PM")||"PM",ut,pt,At;return it.isDate(ht)?pt={year:ht.getFullYear(),month:ht.getMonth()+1,date:ht.getDate(),hour:ht.getHours(),minute:ht.getMinutes()}:pt={year:ht.year,month:ht.month,date:ht.date,hour:ht.hour,minute:ht.minute},at(pt.year,pt.month,pt.date)?(pt.meridiem="",/([^\\]|^)[aA]\b/.test(ct)&&(ut=pt.hour>11?ft:dt,pt.hour>12&&(pt.hour%=12),pt.hour===0&&(pt.hour=12),pt.meridiem=ut),At=ct.replace(rt,function(gt){return gt.indexOf("\\")>-1?gt.replace(/\\/,""):st[gt](pt)||""}),At):!1}_.exports=lt},function(_,_e,et){var it=et(6).inherit,tt=et(1).extend;function rt(nt,ot){var st;return ot||(ot=nt,nt=null),st=ot.init||function(){},nt&&it(st,nt),ot.hasOwnProperty("static")&&(tt(st,ot.static),delete ot.static),tt(st.prototype,ot),st}_.exports=rt},function(_,_e,et){var it=et(15),tt=et(2),rt="initialize";function nt(ot,st){var at=st||{};return tt.isFunction(at[rt])&&at[rt](),it(ot,at)}_.exports=nt},function(_,_e,et){var it=et(4),tt=et(1);function rt(nt,ot,st){var at,lt,ct,ht;return at=nt.split("."),at.unshift(window),lt=it.reduce(at,function(mt,dt){return mt[dt]=mt[dt]||{},mt[dt]}),st?(ht=at.pop(),ct=tt.pick.apply(null,at),lt=ct[ht]=ot):tt.extend(lt,ot),lt}_.exports=rt},function(_,_e,et){var it=et(4),tt=et(2),rt=et(1),nt=/\s+/g;function ot(){this.events=null,this.contexts=null}ot.mixin=function(st){rt.extend(st.prototype,ot.prototype)},ot.prototype._getHandlerItem=function(st,at){var lt={handler:st};return at&&(lt.context=at),lt},ot.prototype._safeEvent=function(st){var at=this.events,lt;return at||(at=this.events={}),st&&(lt=at[st],lt||(lt=[],at[st]=lt),at=lt),at},ot.prototype._safeContext=function(){var st=this.contexts;return st||(st=this.contexts=[]),st},ot.prototype._indexOfContext=function(st){for(var at=this._safeContext(),lt=0;at[lt];){if(st===at[lt][0])return lt;lt+=1}return-1},ot.prototype._memorizeContext=function(st){var at,lt;!tt.isExisty(st)||(at=this._safeContext(),lt=this._indexOfContext(st),lt>-1?at[lt][1]+=1:at.push([st,1]))},ot.prototype._forgetContext=function(st){var at,lt;!tt.isExisty(st)||(at=this._safeContext(),lt=this._indexOfContext(st),lt>-1&&(at[lt][1]-=1,at[lt][1]<=0&&at.splice(lt,1)))},ot.prototype._bindEvent=function(st,at,lt){var ct=this._safeEvent(st);this._memorizeContext(lt),ct.push(this._getHandlerItem(at,lt))},ot.prototype.on=function(st,at,lt){var ct=this;tt.isString(st)?(st=st.split(nt),it.forEach(st,function(ht){ct._bindEvent(ht,at,lt)})):tt.isObject(st)&&(lt=at,it.forEach(st,function(ht,mt){ct.on(mt,ht,lt)}))},ot.prototype.once=function(st,at,lt){var ct=this;if(tt.isObject(st)){lt=at,it.forEach(st,function(mt,dt){ct.once(dt,mt,lt)});return}function ht(){at.apply(lt,arguments),ct.off(st,ht,lt)}this.on(st,ht,lt)},ot.prototype._spliceMatches=function(st,at){var lt=0,ct;if(!!tt.isArray(st))for(ct=st.length;lt<ct;lt+=1)at(st[lt])===!0&&(st.splice(lt,1),ct-=1,lt-=1)},ot.prototype._matchHandler=function(st){var at=this;return function(lt){var ct=st===lt.handler;return ct&&at._forgetContext(lt.context),ct}},ot.prototype._matchContext=function(st){var at=this;return function(lt){var ct=st===lt.context;return ct&&at._forgetContext(lt.context),ct}},ot.prototype._matchHandlerAndContext=function(st,at){var lt=this;return function(ct){var ht=st===ct.handler,mt=at===ct.context,dt=ht&&mt;return dt&&lt._forgetContext(ct.context),dt}},ot.prototype._offByEventName=function(st,at){var lt=this,ct=it.forEachArray,ht=tt.isFunction(at),mt=lt._matchHandler(at);st=st.split(nt),ct(st,function(dt){var ft=lt._safeEvent(dt);ht?lt._spliceMatches(ft,mt):(ct(ft,function(ut){lt._forgetContext(ut.context)}),lt.events[dt]=[])})},ot.prototype._offByHandler=function(st){var at=this,lt=this._matchHandler(st);it.forEach(this._safeEvent(),function(ct){at._spliceMatches(ct,lt)})},ot.prototype._offByObject=function(st,at){var lt=this,ct;this._indexOfContext(st)<0?it.forEach(st,function(ht,mt){lt.off(mt,ht)}):tt.isString(at)?(ct=this._matchContext(st),lt._spliceMatches(this._safeEvent(at),ct)):tt.isFunction(at)?(ct=this._matchHandlerAndContext(at,st),it.forEach(this._safeEvent(),function(ht){lt._spliceMatches(ht,ct)})):(ct=this._matchContext(st),it.forEach(this._safeEvent(),function(ht){lt._spliceMatches(ht,ct)}))},ot.prototype.off=function(st,at){tt.isString(st)?this._offByEventName(st,at):arguments.length?tt.isFunction(st)?this._offByHandler(st):tt.isObject(st)&&this._offByObject(st,at):(this.events={},this.contexts=[])},ot.prototype.fire=function(st){this.invoke.apply(this,arguments)},ot.prototype.invoke=function(st){var at,lt,ct,ht;if(!this.hasListener(st))return!0;for(at=this._safeEvent(st),lt=Array.prototype.slice.call(arguments,1),ct=0;at[ct];){if(ht=at[ct],ht.handler.apply(ht.context,lt)===!1)return!1;ct+=1}return!0},ot.prototype.hasListener=function(st){return this.getListenerLength(st)>0},ot.prototype.getListenerLength=function(st){var at=this._safeEvent(st);return at.length},_.exports=ot},function(_,_e,et){var it=et(4),tt=et(2),rt=function(){try{return Object.defineProperty({},"x",{}),!0}catch{return!1}}(),nt=0;function ot(st){st&&this.set.apply(this,arguments)}ot.prototype.set=function(st){var at=this;tt.isArray(st)||(st=it.toArray(arguments)),it.forEach(st,function(ct){at._addItem(ct)})},ot.prototype.getName=function(st){var at=this,lt;return it.forEach(this,function(ct,ht){if(at._isEnumItem(ht)&&st===ct)return lt=ht,!1}),lt},ot.prototype._addItem=function(st){var at;this.hasOwnProperty(st)||(at=this._makeEnumValue(),rt?Object.defineProperty(this,st,{enumerable:!0,configurable:!1,writable:!1,value:at}):this[st]=at)},ot.prototype._makeEnumValue=function(){var st;return st=nt,nt+=1,st},ot.prototype._isEnumItem=function(st){return tt.isNumber(this[st])},_.exports=ot},function(_,_e,et){var it=et(4),tt=et(19),rt=["get","has","forEach","keys","values","entries"],nt=["delete","clear"];function ot(st){this._map=new tt(st),this.size=this._map.size}it.forEachArray(rt,function(st){ot.prototype[st]=function(){return this._map[st].apply(this._map,arguments)}}),it.forEachArray(nt,function(st){ot.prototype[st]=function(){var at=this._map[st].apply(this._map,arguments);return this.size=this._map.size,at}}),ot.prototype.set=function(){return this._map.set.apply(this._map,arguments),this.size=this._map.size,this},ot.prototype.setObject=function(st){it.forEachOwnProperties(st,function(at,lt){this.set(lt,at)},this)},ot.prototype.deleteByKeys=function(st){it.forEachArray(st,function(at){this.delete(at)},this)},ot.prototype.merge=function(st){st.forEach(function(at,lt){this.set(lt,at)},this)},ot.prototype.filter=function(st){var at=new ot;return this.forEach(function(lt,ct){st(lt,ct)&&at.set(ct,lt)}),at},_.exports=ot},function(_,_e,et){var it=et(4),tt=et(2),rt=et(3),nt=et(10),ot=et(5),st={},at={};function lt(ht,mt){this._keys=ht,this._valueGetter=mt,this._length=this._keys.length,this._index=-1,this._done=!1}lt.prototype.next=function(){var ht={};do this._index+=1;while(tt.isUndefined(this._keys[this._index])&&this._index<this._length);return this._index>=this._length?ht.done=!0:(ht.done=!1,ht.value=this._valueGetter(this._keys[this._index],this._index)),ht};function ct(ht){this._valuesForString={},this._valuesForIndex={},this._keys=[],ht&&this._setInitData(ht),this.size=0}ct.prototype._setInitData=function(ht){if(!tt.isArray(ht))throw new Error("Only Array is supported.");it.forEachArray(ht,function(mt){this.set(mt[0],mt[1])},this)},ct.prototype._isNaN=function(ht){return typeof ht=="number"&&ht!==ht},ct.prototype._getKeyIndex=function(ht){var mt=-1,dt;return tt.isString(ht)?(dt=this._valuesForString[ht],dt&&(mt=dt.keyIndex)):mt=rt.inArray(ht,this._keys),mt},ct.prototype._getOriginKey=function(ht){var mt=ht;return ht===st?mt=void 0:ht===at&&(mt=NaN),mt},ct.prototype._getUniqueKey=function(ht){var mt=ht;return tt.isUndefined(ht)?mt=st:this._isNaN(ht)&&(mt=at),mt},ct.prototype._getValueObject=function(ht,mt){if(tt.isString(ht))return this._valuesForString[ht];if(tt.isUndefined(mt)&&(mt=this._getKeyIndex(ht)),mt>=0)return this._valuesForIndex[mt]},ct.prototype._getOriginValue=function(ht,mt){return this._getValueObject(ht,mt).origin},ct.prototype._getKeyValuePair=function(ht,mt){return[this._getOriginKey(ht),this._getOriginValue(ht,mt)]},ct.prototype._createValueObject=function(ht,mt){return{keyIndex:mt,origin:ht}},ct.prototype.set=function(ht,mt){var dt=this._getUniqueKey(ht),ft=this._getKeyIndex(dt),ut;return ft<0&&(ft=this._keys.push(dt)-1,this.size+=1),ut=this._createValueObject(mt,ft),tt.isString(ht)?this._valuesForString[ht]=ut:this._valuesForIndex[ft]=ut,this},ct.prototype.get=function(ht){var mt=this._getUniqueKey(ht),dt=this._getValueObject(mt);return dt&&dt.origin},ct.prototype.keys=function(){return new lt(this._keys,ot.bind(this._getOriginKey,this))},ct.prototype.values=function(){return new lt(this._keys,ot.bind(this._getOriginValue,this))},ct.prototype.entries=function(){return new lt(this._keys,ot.bind(this._getKeyValuePair,this))},ct.prototype.has=function(ht){return!!this._getValueObject(ht)},ct.prototype.delete=function(ht){var mt;tt.isString(ht)?this._valuesForString[ht]&&(mt=this._valuesForString[ht].keyIndex,delete this._valuesForString[ht]):(mt=this._getKeyIndex(ht),mt>=0&&delete this._valuesForIndex[mt]),mt>=0&&(delete this._keys[mt],this.size-=1)},ct.prototype.forEach=function(ht,mt){mt=mt||this,it.forEachArray(this._keys,function(dt){tt.isUndefined(dt)||ht.call(mt,this._getValueObject(dt).origin,dt,this)},this)},ct.prototype.clear=function(){ct.call(this)},function(){window.Map&&(nt.firefox&&nt.version>=37||nt.chrome&&nt.version>=42)&&(ct=window.Map)}(),_.exports=ct},function(_,_e,et){var it=et(4),tt=et(2),rt="\xE5";function nt(ot){this.length=0,ot&&this.setObject(ot)}nt.prototype.set=function(ot,st){arguments.length===2?this.setKeyValue(ot,st):this.setObject(ot)},nt.prototype.setKeyValue=function(ot,st){this.has(ot)||(this.length+=1),this[this.encodeKey(ot)]=st},nt.prototype.setObject=function(ot){var st=this;it.forEachOwnProperties(ot,function(at,lt){st.setKeyValue(lt,at)})},nt.prototype.merge=function(ot){var st=this;ot.each(function(at,lt){st.setKeyValue(lt,at)})},nt.prototype.encodeKey=function(ot){return rt+ot},nt.prototype.decodeKey=function(ot){var st=ot.split(rt);return st[st.length-1]},nt.prototype.get=function(ot){return this[this.encodeKey(ot)]},nt.prototype.has=function(ot){return this.hasOwnProperty(this.encodeKey(ot))},nt.prototype.remove=function(ot){return arguments.length>1&&(ot=it.toArray(arguments)),tt.isArray(ot)?this.removeByKeyArray(ot):this.removeByKey(ot)},nt.prototype.removeByKey=function(ot){var st=this.has(ot)?this.get(ot):null;return st!==null&&(delete this[this.encodeKey(ot)],this.length-=1),st},nt.prototype.removeByKeyArray=function(ot){var st=[],at=this;return it.forEach(ot,function(lt){st.push(at.removeByKey(lt))}),st},nt.prototype.removeAll=function(){var ot=this;this.each(function(st,at){ot.remove(at)})},nt.prototype.each=function(ot){var st=this,at;it.forEachOwnProperties(this,function(lt,ct){if(ct.charAt(0)===rt&&(at=ot(lt,st.decodeKey(ct))),at===!1)return at})},nt.prototype.keys=function(){var ot=[],st=this;return this.each(function(at,lt){ot.push(st.decodeKey(lt))}),ot},nt.prototype.find=function(ot){var st=[];return this.each(function(at,lt){ot(at,lt)&&st.push(at)}),st},nt.prototype.toArray=function(){var ot=[];return this.each(function(st){ot.push(st)}),ot},_.exports=nt}])})})(tuiCodeSnippet);var tuiColorPicker={exports:{}};/*!
 * TOAST UI Color Picker
 * @version 2.2.7
 * @author NHN FE Development Team <dl_javascript@nhn.com>
 * @license MIT
 */(function(o,s){(function(_e,et){o.exports=et()})(window,function(){return function(_){var _e={};function et(it){if(_e[it])return _e[it].exports;var tt=_e[it]={i:it,l:!1,exports:{}};return _[it].call(tt.exports,tt,tt.exports,et),tt.l=!0,tt.exports}return et.m=_,et.c=_e,et.d=function(it,tt,rt){et.o(it,tt)||Object.defineProperty(it,tt,{enumerable:!0,get:rt})},et.r=function(it){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(it,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(it,"__esModule",{value:!0})},et.t=function(it,tt){if(tt&1&&(it=et(it)),tt&8||tt&4&&typeof it=="object"&&it&&it.__esModule)return it;var rt=Object.create(null);if(et.r(rt),Object.defineProperty(rt,"default",{enumerable:!0,value:it}),tt&2&&typeof it!="string")for(var nt in it)et.d(rt,nt,function(ot){return it[ot]}.bind(null,nt));return rt},et.n=function(it){var tt=it&&it.__esModule?function(){return it.default}:function(){return it};return et.d(tt,"a",tt),tt},et.o=function(it,tt){return Object.prototype.hasOwnProperty.call(it,tt)},et.p="dist",et(et.s=33)}([function(_,_e,et){function it(tt,rt){var nt=Object.prototype.hasOwnProperty,ot,st,at,lt;for(at=1,lt=arguments.length;at<lt;at+=1){ot=arguments[at];for(st in ot)nt.call(ot,st)&&(tt[st]=ot[st])}return tt}_.exports=it},function(_,_e,et){function it(tt){return tt instanceof Array}_.exports=it},function(_,_e,et){var it=et(1),tt=et(6),rt=et(7);function nt(ot,st,at){it(ot)?tt(ot,st,at):rt(ot,st,at)}_.exports=nt},function(_,_e,et){function it(tt){return tt===void 0}_.exports=it},function(_,_e,et){var it=et(22),tt=et(2),rt=et(6),nt=et(7),ot=et(37),st=0,at={getLength:function(lt){var ct=0;return nt(lt,function(){ct+=1}),ct},map:function(lt,ct,ht){var mt=[];return tt(lt,function(){mt.push(ct.apply(ht||null,arguments))}),mt},filter:function(lt,ct,ht){var mt=[];return rt(lt,function(dt){ct.apply(ht||null,arguments)&&mt.push(dt)}),mt},generateId:function(){return st+=1,st},isOldBrowser:function(){return it.msie&&it.version<9}(),sendHostName:function(){ot("color-picker","UA-129987462-1")}};_.exports=at},function(_,_e,et){var it=et(1);function tt(rt,nt,ot){var st,at;if(ot=ot||0,!it(nt))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(nt,rt,ot);for(at=nt.length,st=ot;ot>=0&&st<at;st+=1)if(nt[st]===rt)return st;return-1}_.exports=tt},function(_,_e,et){function it(tt,rt,nt){var ot=0,st=tt.length;for(nt=nt||null;ot<st&&rt.call(nt,tt[ot],ot,tt)!==!1;ot+=1);}_.exports=it},function(_,_e,et){function it(tt,rt,nt){var ot;nt=nt||null;for(ot in tt)if(tt.hasOwnProperty(ot)&&rt.call(nt,tt[ot],ot,tt)===!1)break}_.exports=it},function(_,_e,et){var it=et(39),tt=et(13),rt=et(41),nt=et(3),ot=et(9),st=et(19),at=et(4);function lt(ct,ht){var mt=at.generateId();nt(ht)&&(ht=ot.appendHTMLElement("div")),it(ht,"tui-view-"+mt),this.id=mt,this.container=ht,this.childs=new st(function(dt){return dt.id}),this.parent=null}lt.prototype.addChild=function(ct,ht){ht&&ht.call(ct,this),ct.parent=this,this.childs.add(ct)},lt.prototype.removeChild=function(ct,ht){var mt=rt(ct)?this.childs.items[ct]:ct;ht&&ht.call(mt,this),this.childs.remove(mt.id)},lt.prototype.render=function(){this.childs.each(function(ct){ct.render()})},lt.prototype.recursive=function(ct,ht){!tt(ct)||(ht||ct(this),this.childs.each(function(mt){mt.recursive(ct)}))},lt.prototype.resize=function(){for(var ct=Array.prototype.slice.call(arguments),ht=this.parent;ht;)tt(ht._onResize)&&ht._onResize.apply(ht,ct),ht=ht.parent},lt.prototype._beforeDestroy=function(){},lt.prototype._destroy=function(){this._beforeDestroy(),this.container.innerHTML="",this.id=this.parent=this.childs=this.container=null},lt.prototype.destroy=function(ct){this.childs&&(this.childs.each(function(ht){ht.destroy(!0),ht._destroy()}),this.childs.clear()),!ct&&this._destroy()},lt.prototype.getViewBound=function(){var ct=this.container.getBoundingClientRect();return{x:ct.left,y:ct.top,width:ct.right-ct.left,height:ct.bottom-ct.top}},_.exports=lt},function(_,_e,et){var it={appendHTMLElement:function(tt,rt,nt){var ot=document.createElement(tt);return ot.className=nt||"",rt?rt.appendChild(ot):document.body.appendChild(ot),ot}};_.exports=it},function(_,_e,et){var it=et(0),tt=et(20),rt=et(11),nt=et(21),ot=et(1),st=et(13),at=et(2),lt=/\s+/g;function ct(){this.events=null,this.contexts=null}ct.mixin=function(ht){it(ht.prototype,ct.prototype)},ct.prototype._getHandlerItem=function(ht,mt){var dt={handler:ht};return mt&&(dt.context=mt),dt},ct.prototype._safeEvent=function(ht){var mt=this.events,dt;return mt||(mt=this.events={}),ht&&(dt=mt[ht],dt||(dt=[],mt[ht]=dt),mt=dt),mt},ct.prototype._safeContext=function(){var ht=this.contexts;return ht||(ht=this.contexts=[]),ht},ct.prototype._indexOfContext=function(ht){for(var mt=this._safeContext(),dt=0;mt[dt];){if(ht===mt[dt][0])return dt;dt+=1}return-1},ct.prototype._memorizeContext=function(ht){var mt,dt;!tt(ht)||(mt=this._safeContext(),dt=this._indexOfContext(ht),dt>-1?mt[dt][1]+=1:mt.push([ht,1]))},ct.prototype._forgetContext=function(ht){var mt,dt;!tt(ht)||(mt=this._safeContext(),dt=this._indexOfContext(ht),dt>-1&&(mt[dt][1]-=1,mt[dt][1]<=0&&mt.splice(dt,1)))},ct.prototype._bindEvent=function(ht,mt,dt){var ft=this._safeEvent(ht);this._memorizeContext(dt),ft.push(this._getHandlerItem(mt,dt))},ct.prototype.on=function(ht,mt,dt){var ft=this;rt(ht)?(ht=ht.split(lt),at(ht,function(ut){ft._bindEvent(ut,mt,dt)})):nt(ht)&&(dt=mt,at(ht,function(ut,pt){ft.on(pt,ut,dt)}))},ct.prototype.once=function(ht,mt,dt){var ft=this;if(nt(ht)){dt=mt,at(ht,function(pt,At){ft.once(At,pt,dt)});return}function ut(){mt.apply(dt,arguments),ft.off(ht,ut,dt)}this.on(ht,ut,dt)},ct.prototype._spliceMatches=function(ht,mt){var dt=0,ft;if(!!ot(ht))for(ft=ht.length;dt<ft;dt+=1)mt(ht[dt])===!0&&(ht.splice(dt,1),ft-=1,dt-=1)},ct.prototype._matchHandler=function(ht){var mt=this;return function(dt){var ft=ht===dt.handler;return ft&&mt._forgetContext(dt.context),ft}},ct.prototype._matchContext=function(ht){var mt=this;return function(dt){var ft=ht===dt.context;return ft&&mt._forgetContext(dt.context),ft}},ct.prototype._matchHandlerAndContext=function(ht,mt){var dt=this;return function(ft){var ut=ht===ft.handler,pt=mt===ft.context,At=ut&&pt;return At&&dt._forgetContext(ft.context),At}},ct.prototype._offByEventName=function(ht,mt){var dt=this,ft=st(mt),ut=dt._matchHandler(mt);ht=ht.split(lt),at(ht,function(pt){var At=dt._safeEvent(pt);ft?dt._spliceMatches(At,ut):(at(At,function(gt){dt._forgetContext(gt.context)}),dt.events[pt]=[])})},ct.prototype._offByHandler=function(ht){var mt=this,dt=this._matchHandler(ht);at(this._safeEvent(),function(ft){mt._spliceMatches(ft,dt)})},ct.prototype._offByObject=function(ht,mt){var dt=this,ft;this._indexOfContext(ht)<0?at(ht,function(ut,pt){dt.off(pt,ut)}):rt(mt)?(ft=this._matchContext(ht),dt._spliceMatches(this._safeEvent(mt),ft)):st(mt)?(ft=this._matchHandlerAndContext(mt,ht),at(this._safeEvent(),function(ut){dt._spliceMatches(ut,ft)})):(ft=this._matchContext(ht),at(this._safeEvent(),function(ut){dt._spliceMatches(ut,ft)}))},ct.prototype.off=function(ht,mt){rt(ht)?this._offByEventName(ht,mt):arguments.length?st(ht)?this._offByHandler(ht):nt(ht)&&this._offByObject(ht,mt):(this.events={},this.contexts=[])},ct.prototype.fire=function(ht){this.invoke.apply(this,arguments)},ct.prototype.invoke=function(ht){var mt,dt,ft,ut;if(!this.hasListener(ht))return!0;for(mt=this._safeEvent(ht),dt=Array.prototype.slice.call(arguments,1),ft=0;mt[ft];){if(ut=mt[ft],ut.handler.apply(ut.context,dt)===!1)return!1;ft+=1}return!0},ct.prototype.hasListener=function(ht){return this.getListenerLength(ht)>0},ct.prototype.getListenerLength=function(ht){var mt=this._safeEvent(ht);return mt.length},_.exports=ct},function(_,_e,et){function it(tt){return typeof tt=="string"||tt instanceof String}_.exports=it},function(_,_e,et){var it=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,tt={leadingZero:function(rt,nt){var ot="",st=0;if((rt+"").length>nt)return rt+"";for(;st<nt-1;st+=1)ot+="0";return(ot+rt).slice(nt*-1)},isValidRGB:function(rt){return it.test(rt)},hexToRGB:function(rt){var nt,ot,st;return tt.isValidRGB(rt)?(rt=rt.substring(1),nt=parseInt(rt.substr(0,2),16),ot=parseInt(rt.substr(2,2),16),st=parseInt(rt.substr(4,2),16),[nt,ot,st]):!1},rgbToHEX:function(rt,nt,ot){var st="#"+tt.leadingZero(rt.toString(16),2)+tt.leadingZero(nt.toString(16),2)+tt.leadingZero(ot.toString(16),2);return tt.isValidRGB(st)?st:!1},rgbToHSV:function(rt,nt,ot){var st,at,lt,ct,ht,mt;if(rt/=255,nt/=255,ot/=255,st=Math.max(rt,nt,ot),at=Math.min(rt,nt,ot),ht=st,mt=st-at,ct=st===0?0:mt/st,st===at)lt=0;else{switch(st){case rt:lt=(nt-ot)/mt+(nt<ot?6:0);break;case nt:lt=(ot-rt)/mt+2;break;case ot:lt=(rt-nt)/mt+4;break}lt/=6}return[Math.round(lt*360),Math.round(ct*100),Math.round(ht*100)]},hsvToRGB:function(rt,nt,ot){var st,at,lt,ct,ht,mt,dt,ft;if(rt=Math.max(0,Math.min(360,rt)),nt=Math.max(0,Math.min(100,nt)),ot=Math.max(0,Math.min(100,ot)),nt/=100,ot/=100,nt===0)return st=at=lt=ot,[Math.round(st*255),Math.round(at*255),Math.round(lt*255)];switch(rt/=60,ct=Math.floor(rt),ht=rt-ct,mt=ot*(1-nt),dt=ot*(1-nt*ht),ft=ot*(1-nt*(1-ht)),ct){case 0:st=ot,at=ft,lt=mt;break;case 1:st=dt,at=ot,lt=mt;break;case 2:st=mt,at=ot,lt=ft;break;case 3:st=mt,at=dt,lt=ot;break;case 4:st=ft,at=mt,lt=ot;break;default:st=ot,at=mt,lt=dt;break}return[Math.round(st*255),Math.round(at*255),Math.round(lt*255)]}};_.exports=tt},function(_,_e,et){function it(tt){return tt instanceof Function}_.exports=it},function(_,_e,et){var it=et(11),tt=et(2),rt=et(26);function nt(at,lt,ct,ht){if(it(lt)){tt(lt.split(/\s+/g),function(mt){ot(at,mt,ct,ht)});return}tt(lt,function(mt,dt){ot(at,dt,mt,ct)})}function ot(at,lt,ct,ht){function mt(dt){ct.call(ht||at,dt||window.event)}"addEventListener"in at?at.addEventListener(lt,mt):"attachEvent"in at&&at.attachEvent("on"+lt,mt),st(at,lt,ct,mt)}function st(at,lt,ct,ht){var mt=rt(at,lt),dt=!1;tt(mt,function(ft){return ft.handler===ct?(dt=!0,!1):!0}),dt||mt.push({handler:ct,wrappedHandler:ht})}_.exports=nt},function(_,_e,et){function it(tt){if(tt.preventDefault){tt.preventDefault();return}tt.returnValue=!1}_.exports=it},function(_,_e,et){function it(tt){return tt.replace(/([A-Z])/g,function(rt){return"-"+rt.toLowerCase()})}_.exports=it},function(_,_e,et){var it=et(11),tt=et(2),rt=et(26);function nt(at,lt,ct){if(it(lt)){tt(lt.split(/\s+/g),function(ht){ot(at,ht,ct)});return}tt(lt,function(ht,mt){ot(at,mt,ht)})}function ot(at,lt,ct){var ht=rt(at,lt),mt;ct?(tt(ht,function(dt,ft){return ct===dt.handler?(st(at,lt,dt.wrappedHandler),mt=ft,!1):!0}),ht.splice(mt,1)):(tt(ht,function(dt){st(at,lt,dt.wrappedHandler)}),ht.splice(0,ht.length))}function st(at,lt,ct){"removeEventListener"in at?at.removeEventListener(lt,ct):"detachEvent"in at&&at.detachEvent("on"+lt,ct)}_.exports=nt},function(_,_e,et){var it=et(50);function tt(rt,nt){var ot=it(nt.prototype);ot.constructor=rt,rt.prototype=ot}_.exports=tt},function(_,_e,et){var it=et(6),tt=et(7),rt=et(0),nt=et(1),ot=et(20),st=et(13),at=et(21),lt=et(4),ct=Array.prototype.slice;function ht(mt){this.items={},this.length=0,st(mt)&&(this.getItemID=mt)}ht.and=function(mt){var dt;return mt=ct.call(arguments),dt=mt.length,function(ft){for(var ut=0;ut<dt;ut+=1)if(!mt[ut].call(null,ft))return!1;return!0}},ht.or=function(mt){var dt;return mt=ct.call(arguments),dt=mt.length,function(ft){for(var ut=1,pt=mt[0].call(null,ft);ut<dt;ut+=1)pt=pt||mt[ut].call(null,ft);return pt}},ht.merge=function(mt){var dt={},ft=new ht(mt.getItemID);return it(arguments,function(ut){rt(dt,ut.items)}),ft.items=dt,ft.length=lt.getLength(ft.items),ft},ht.prototype.getItemID=function(mt){return mt._id+""},ht.prototype.add=function(mt){var dt,ft;if(arguments.length>1){it(ct.call(arguments),function(ut){this.add(ut)},this);return}dt=this.getItemID(mt),ft=this.items,ft[dt]||(this.length+=1),ft[dt]=mt},ht.prototype.remove=function(mt){var dt=[],ft,ut;return this.length?arguments.length>1?(dt=lt.map(ct.call(arguments),function(pt){return this.remove(pt)},this),dt):(ft=this.items,at(mt)&&(mt=this.getItemID(mt)),ft[mt]?(this.length-=1,ut=ft[mt],delete ft[mt],ut):dt):dt},ht.prototype.clear=function(){this.items={},this.length=0},ht.prototype.has=function(mt){var dt,ft;return this.length?(dt=st(mt),ft=!1,dt?this.each(function(ut){return mt(ut)===!0?(ft=!0,!1):!0}):(mt=at(mt)?this.getItemID(mt):mt,ft=ot(this.items[mt])),ft):!1},ht.prototype.doWhenHas=function(mt,dt,ft){var ut=this.items[mt];!ot(ut)||dt.call(ft||this,ut)},ht.prototype.find=function(mt){var dt=new ht;return this.hasOwnProperty("getItemID")&&(dt.getItemID=this.getItemID),this.each(function(ft){mt(ft)===!0&&dt.add(ft)}),dt},ht.prototype.groupBy=function(mt,dt){var ft={},ut=st(mt),pt=this.getItemID,At,gt;if(nt(mt)){if(it(mt,function(vt){ft[vt+""]=new ht(pt)}),!dt)return ft;mt=dt,ut=!0}return this.each(function(vt){ut?gt=mt(vt):(gt=vt[mt],st(gt)&&(gt=gt.apply(vt))),At=ft[gt],At||(At=ft[gt]=new ht(pt)),At.add(vt)}),ft},ht.prototype.single=function(){var mt;return this.each(function(dt){return mt=dt,!1},this),mt},ht.prototype.sort=function(mt){var dt=[];return this.each(function(ft){dt.push(ft)}),st(mt)&&(dt=dt.sort(mt)),dt},ht.prototype.each=function(mt,dt){tt(this.items,mt,dt||this)},ht.prototype.toArray=function(){return this.length?lt.map(this.items,function(mt){return mt}):[]},_.exports=ht},function(_,_e,et){var it=et(3),tt=et(36);function rt(nt){return!it(nt)&&!tt(nt)}_.exports=rt},function(_,_e,et){function it(tt){return tt===Object(tt)}_.exports=it},function(_,_e,et){var it={chrome:!1,firefox:!1,safari:!1,msie:!1,edge:!1,others:!1,version:0};typeof window!="undefined"&&window.navigator&&tt();function tt(){var rt=window.navigator,nt=rt.appName.replace(/\s/g,"_"),ot=rt.userAgent,st=/MSIE\s([0-9]+[.0-9]*)/,at=/Trident.*rv:11\./,lt=/Edge\/(\d+)\./,ct={firefox:/Firefox\/(\d+)\./,chrome:/Chrome\/(\d+)\./,safari:/Version\/([\d.]+).*Safari\/(\d+)/},ht,mt,dt={Microsoft_Internet_Explorer:function(){var ut=ot.match(st);ut?(it.msie=!0,it.version=parseFloat(ut[1])):it.others=!0},Netscape:function(){var ut=!1;if(at.exec(ot))it.msie=!0,it.version=11,ut=!0;else if(lt.exec(ot))it.edge=!0,it.version=ot.match(lt)[1],ut=!0;else for(ht in ct)if(ct.hasOwnProperty(ht)&&(mt=ot.match(ct[ht]),mt&&mt.length>1)){it[ht]=ut=!0,it.version=parseFloat(mt[1]||0);break}ut||(it.others=!0)}},ft=dt[nt];ft&&dt[nt]()}_.exports=it},function(_,_e,et){var it=et(3);function tt(rt){return!rt||!rt.className?"":it(rt.className.baseVal)?rt.className:rt.className.baseVal}_.exports=tt},function(_,_e,et){(function(it){var tt=et(10),rt=et(42),nt=et(44),ot=et(47),st=et(28),at=et(17),lt=et(14),ct=et(15),ht=et(0);function mt(dt,ft){lt(ft,"mousedown",this._onMouseDown,this),this.options=ht({distance:10},dt),this.container=ft,this._isMoved=!1,this._distance=0,this._dragStartFired=!1,this._dragStartEventData=null}mt.prototype.destroy=function(){at(this.container,"mousedown",this._onMouseDown),this.options=this.container=this._isMoved=this._distance=this._dragStartFired=this._dragStartEventData=null},mt.prototype._toggleDragEvent=function(dt){var ft=this.container;dt?(rt(ft),lt(it,"dragstart",ct),lt(it.document,{mousemove:this._onMouseMove,mouseup:this._onMouseUp},this)):(nt(ft),at(it,"dragstart",ct),at(it.document,{mousemove:this._onMouseMove,mouseup:this._onMouseUp}))},mt.prototype._getEventData=function(dt){return{target:st(dt),originEvent:dt}},mt.prototype._onMouseDown=function(dt){ot(dt)===0&&(this._distance=0,this._dragStartFired=!1,this._dragStartEventData=this._getEventData(dt),this._toggleDragEvent(!0))},mt.prototype._onMouseMove=function(dt){var ft=this.options.distance;if(ct(dt),this._isMoved=!0,this._distance<ft){this._distance+=1;return}if(!this._dragStartFired&&(this._dragStartFired=!0,!this.invoke("dragStart",this._dragStartEventData))){this._toggleDragEvent(!1);return}this.fire("drag",this._getEventData(dt))},mt.prototype._onMouseUp=function(dt){if(this._toggleDragEvent(!1),this._isMoved){this._isMoved=!1,this.fire("dragEnd",this._getEventData(dt));return}this.fire("click",this._getEventData(dt))},tt.mixin(mt),_.exports=mt}).call(this,et(25))},function(_,_e){var et;et=function(){return this}();try{et=et||new Function("return this")()}catch{typeof window=="object"&&(et=window)}_.exports=et},function(_,_e,et){var it="_feEventKey";function tt(rt,nt){var ot=rt[it],st;return ot||(ot=rt[it]={}),st=ot[nt],st||(st=ot[nt]=[]),st}_.exports=tt},function(_,_e,et){function it(tt){var rt=document.documentElement.style,nt,ot;for(nt=0,ot=tt.length;nt<ot;nt+=1)if(tt[nt]in rt)return tt[nt];return!1}_.exports=it},function(_,_e,et){function it(tt){return tt.target||tt.srcElement}_.exports=it},function(_,_e,et){var it=et(10),tt=et(28),rt=et(17),nt=et(14),ot=et(30),st=et(0),at=et(18),lt=et(9),ct=et(12),ht=et(8),mt=et(51);function dt(ft,ut){this.options=st({cssPrefix:"tui-colorpicker-",preset:["#181818","#282828","#383838","#585858","#B8B8B8","#D8D8D8","#E8E8E8","#F8F8F8","#AB4642","#DC9656","#F7CA88","#A1B56C","#86C1B9","#7CAFC2","#BA8BAF","#A16946"],detailTxt:"Detail"},ft),ut=lt.appendHTMLElement("div",ut,this.options.cssPrefix+"palette-container"),ht.call(this,ft,ut)}at(dt,ht),dt.prototype._onClick=function(ft){var ut=this.options,pt=tt(ft),At={};if(ot(pt,ut.cssPrefix+"palette-button")){At.color=pt.value,this.fire("_selectColor",At);return}ot(pt,ut.cssPrefix+"palette-toggle-slider")&&this.fire("_toggleSlider")},dt.prototype._onChange=function(ft){var ut=this.options,pt=tt(ft),At={};ot(pt,ut.cssPrefix+"palette-hex")&&(At.color=pt.value,this.fire("_selectColor",At))},dt.prototype._beforeDestroy=function(){this._toggleEvent(!1)},dt.prototype._toggleEvent=function(ft){var ut=this.options,pt=this.container,At=ft?nt:rt,gt;At(pt,"click",this._onClick,this),gt=pt.querySelector("."+ut.cssPrefix+"palette-hex",pt),gt&&At(gt,"change",this._onChange,this)},dt.prototype.render=function(ft){var ut=this.options,pt="";this._toggleEvent(!1),pt=mt({cssPrefix:ut.cssPrefix,preset:ut.preset,detailTxt:ut.detailTxt,color:ft,isValidRGB:ct.isValidRGB,getItemClass:function(At){return At?"":" "+ut.cssPrefix+"color-transparent"},isSelected:function(At){return At===ft?" "+ut.cssPrefix+"selected":""}}),this.container.innerHTML=pt,this._toggleEvent(!0)},it.mixin(dt),_.exports=dt},function(_,_e,et){var it=et(5),tt=et(23);function rt(nt,ot){var st;return nt.classList?nt.classList.contains(ot):(st=tt(nt).split(/\s+/),it(ot,st)>-1)}_.exports=rt},function(_,_e,et){var it=et(10),tt=et(53),rt=et(54),nt=et(30),ot=et(0),st=et(18),at=et(9),lt=et(32),ct=et(12),ht=et(8),mt=et(24),dt=et(57),ft=[-7,112],ut=[-3,115],pt=359.99;function At(gt,vt){vt=at.appendHTMLElement("div",vt,gt.cssPrefix+"slider-container"),vt.style.display="none",ht.call(this,gt,vt),this.options=ot({color:"#f8f8f8",cssPrefix:"tui-colorpicker-"},gt),this._dragDataCache={},this.sliderHandleElement=null,this.huebarHandleElement=null,this.baseColorElement=null,this.drag=new mt({distance:0},vt),this.drag.on({dragStart:this._onDragStart,drag:this._onDrag,dragEnd:this._onDragEnd,click:this._onClick},this)}st(At,ht),At.prototype._beforeDestroy=function(){this.drag.off(),this.drag=this.options=this._dragDataCache=this.sliderHandleElement=this.huebarHandleElement=this.baseColorElement=null},At.prototype.toggle=function(gt){this.container.style.display=gt?"block":"none"},At.prototype.isVisible=function(){return this.container.style.display==="block"},At.prototype.render=function(gt){var vt=this.container,yt=this.options,bt=dt.layout,Ct,xt;!ct.isValidRGB(gt)||(bt=bt.replace(/{{slider}}/,dt.slider),bt=bt.replace(/{{huebar}}/,dt.huebar),bt=bt.replace(/{{cssPrefix}}/g,yt.cssPrefix),bt=bt.replace(/{{id}}/g,yt.id),this.container.innerHTML=bt,this.sliderHandleElement=vt.querySelector("."+yt.cssPrefix+"slider-handle"),this.huebarHandleElement=vt.querySelector("."+yt.cssPrefix+"huebar-handle"),this.baseColorElement=vt.querySelector("."+yt.cssPrefix+"slider-basecolor"),Ct=ct.hexToRGB(gt),xt=ct.rgbToHSV.apply(null,Ct),this.moveHue(xt[0],!0),this.moveSaturationAndValue(xt[1],xt[2],!0))},At.prototype._moveColorSliderHandle=function(gt,vt,yt){var bt=this.sliderHandleElement,Ct;vt=Math.max(ft[0],vt),vt=Math.min(ft[1],vt),gt=Math.max(ft[0],gt),gt=Math.min(ft[1],gt),lt.setTranslateXY(bt,gt,vt),Ct=vt>50?"white":"black",lt.setStrokeColor(bt,Ct),yt||this.fire("_selectColor",{color:ct.rgbToHEX.apply(null,this.getRGB())})},At.prototype.moveSaturationAndValue=function(gt,vt,yt){var bt,Ct,xt,It;gt=gt||0,vt=vt||0,bt=Math.abs(ft[0]),Ct=ft[1],xt=gt*Ct/100-bt,It=Ct-vt*Ct/100-bt,this._moveColorSliderHandle(xt,It,yt)},At.prototype._moveColorSliderByPosition=function(gt,vt){var yt=ft[0];this._moveColorSliderHandle(gt+yt,vt+yt)},At.prototype.getSaturationAndValue=function(){var gt=Math.abs(ft[0]),vt=gt+ft[1],yt=lt.getTranslateXY(this.sliderHandleElement),bt,Ct;return bt=(yt[1]+gt)/vt*100,Ct=100-(yt[0]+gt)/vt*100,[bt,Ct]},At.prototype._moveHueHandle=function(gt,vt){var yt=this.huebarHandleElement,bt=this.baseColorElement,Ct,xt;gt=Math.max(ut[0],gt),gt=Math.min(ut[1],gt),lt.setTranslateY(yt,gt),Ct=ct.hsvToRGB(this.getHue(),100,100),xt=ct.rgbToHEX.apply(null,Ct),lt.setGradientColorStop(bt,xt),vt||this.fire("_selectColor",{color:ct.rgbToHEX.apply(null,this.getRGB())})},At.prototype.moveHue=function(gt,vt){var yt=0,bt,Ct;bt=Math.abs(ut[0]),Ct=bt+ut[1],gt=gt||0,yt=Ct*gt/pt-bt,this._moveHueHandle(yt,vt)},At.prototype._moveHueByPosition=function(gt){var vt=ut[0];this._moveHueHandle(gt+vt)},At.prototype.getHue=function(){var gt=this.huebarHandleElement,vt=lt.getTranslateXY(gt),yt,bt;return yt=Math.abs(ut[0]),bt=yt+ut[1],(vt[0]+yt)*pt/bt},At.prototype.getHSV=function(){var gt=this.getSaturationAndValue(),vt=this.getHue();return[vt].concat(gt)},At.prototype.getRGB=function(){return ct.hsvToRGB.apply(null,this.getHSV())},At.prototype._prepareColorSliderForMouseEvent=function(gt){var vt=this.options,yt=rt(gt.target,"."+vt.cssPrefix+"slider-part"),bt;return bt=this._dragDataCache={isColorSlider:nt(yt,vt.cssPrefix+"slider-left"),parentElement:yt},bt},At.prototype._onClick=function(gt){var vt=this._prepareColorSliderForMouseEvent(gt),yt=tt(gt.originEvent,vt.parentElement);vt.isColorSlider?this._moveColorSliderByPosition(yt[0],yt[1]):this._moveHueByPosition(yt[1]),this._dragDataCache=null},At.prototype._onDragStart=function(gt){this._prepareColorSliderForMouseEvent(gt)},At.prototype._onDrag=function(gt){var vt=this._dragDataCache,yt=tt(gt.originEvent,vt.parentElement);vt.isColorSlider?this._moveColorSliderByPosition(yt[0],yt[1]):this._moveHueByPosition(yt[1])},At.prototype._onDragEnd=function(){this._dragDataCache=null},it.mixin(At),_.exports=At},function(_,_e,et){var it=et(4).isOldBrowser,tt=/[\.\-0-9]+/g,rt=-6,nt={getTranslateXY:function(ot){var st;return it?(st=ot.style,[parseFloat(st.top),parseFloat(st.left)]):(st=ot.getAttribute("transform"),st?(st=st.match(tt),[parseFloat(st[1]),parseFloat(st[0])]):[0,0])},setTranslateXY:function(ot,st,at){it?(ot.style.left=st+"px",ot.style.top=at+"px"):ot.setAttribute("transform","translate("+st+","+at+")")},setTranslateY:function(ot,st){it?ot.style.top=st+"px":ot.setAttribute("transform","translate("+rt+","+st+")")},setStrokeColor:function(ot,st){it?ot.strokecolor=st:ot.setAttribute("stroke",st)},setGradientColorStop:function(ot,st){it?ot.color=st:ot.setAttribute("stop-color",st)}};_.exports=nt},function(_,_e,et){et(34),_.exports=et(35)},function(_,_e,et){},function(_,_e,et){var it=et(19),tt=et(8),rt=et(24),nt=et(48),ot=et(29),st=et(31),at=et(12),lt=et(32),ct={Collection:it,View:tt,Drag:rt,create:nt,Palette:ot,Slider:st,colorutil:at,svgvml:lt};_.exports=ct},function(_,_e,et){function it(tt){return tt===null}_.exports=it},function(_,_e,et){var it=et(3),tt=et(38),rt=7*24*60*60*1e3;function nt(st){var at=new Date().getTime();return at-st>rt}function ot(st,at){var lt="https://www.google-analytics.com/collect",ct=location.hostname,ht="event",mt="use",dt="TOAST UI "+st+" for "+ct+": Statistics",ft=window.localStorage.getItem(dt);!it(window.tui)&&window.tui.usageStatistics===!1||ft&&!nt(ft)||(window.localStorage.setItem(dt,new Date().getTime()),setTimeout(function(){(document.readyState==="interactive"||document.readyState==="complete")&&tt(lt,{v:1,t:ht,tid:at,cid:ct,dp:ct,dh:st,el:st,ec:mt})},1e3))}_.exports=ot},function(_,_e,et){var it=et(7);function tt(rt,nt){var ot=document.createElement("img"),st="";return it(nt,function(at,lt){st+="&"+lt+"="+at}),st=st.substring(1),ot.src=rt+"?"+st,ot.style.display="none",document.body.appendChild(ot),document.body.removeChild(ot),ot}_.exports=tt},function(_,_e,et){var it=et(2),tt=et(5),rt=et(23),nt=et(40);function ot(st){var at=Array.prototype.slice.call(arguments,1),lt=st.classList,ct=[],ht;if(lt){it(at,function(mt){st.classList.add(mt)});return}ht=rt(st),ht&&(at=[].concat(ht.split(/\s+/),at)),it(at,function(mt){tt(mt,ct)<0&&ct.push(mt)}),nt(st,ct)}_.exports=ot},function(_,_e,et){var it=et(1),tt=et(3);function rt(nt,ot){if(ot=it(ot)?ot.join(" "):ot,ot=ot.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),tt(nt.className.baseVal)){nt.className=ot;return}nt.className.baseVal=ot}_.exports=rt},function(_,_e,et){function it(tt){return typeof tt=="number"||tt instanceof Number}_.exports=it},function(_,_e,et){var it=et(14),tt=et(15),rt=et(43),nt=et(27),ot="onselectstart"in document,st="prevUserSelect",at=nt(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);function lt(ct){ct||(ct=document),ot?it(ct,"selectstart",tt):(ct=ct===document?document.documentElement:ct,rt(ct,st,ct.style[at]),ct.style[at]="none")}_.exports=lt},function(_,_e,et){var it=et(16);function tt(rt,nt,ot){if(rt.dataset){rt.dataset[nt]=ot;return}rt.setAttribute("data-"+it(nt),ot)}_.exports=tt},function(_,_e,et){var it=et(17),tt=et(15),rt=et(45),nt=et(46),ot=et(27),st="onselectstart"in document,at="prevUserSelect",lt=ot(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);function ct(ht){ht||(ht=document),st?it(ht,"selectstart",tt):(ht=ht===document?document.documentElement:ht,ht.style[lt]=rt(ht,at)||"auto",nt(ht,at))}_.exports=ct},function(_,_e,et){var it=et(16);function tt(rt,nt){return rt.dataset?rt.dataset[nt]:rt.getAttribute("data-"+it(nt))}_.exports=tt},function(_,_e,et){var it=et(16);function tt(rt,nt){if(rt.dataset){delete rt.dataset[nt];return}rt.removeAttribute("data-"+it(nt))}_.exports=tt},function(_,_e,et){var it=et(22),tt=et(5),rt=["0","1","3","5","7"],nt=["2","6"],ot=["4"];function st(lt){return it.msie&&it.version<=8?at(lt):lt.button}function at(lt){var ct=String(lt.button);return tt(ct,rt)>-1?0:tt(ct,nt)>-1?2:tt(ct,ot)>-1?1:null}_.exports=st},function(_,_e,et){var it=et(10),tt=et(0),rt=et(4),nt=et(12),ot=et(49),st=et(29),at=et(31),lt=0;function ct(){return lt+=1,lt}function ht(mt){var dt;if(!(this instanceof ht))return new ht(mt);if(mt=this.options=tt({container:null,color:"#f8f8f8",preset:["#181818","#282828","#383838","#585858","#b8b8b8","#d8d8d8","#e8e8e8","#f8f8f8","#ab4642","#dc9656","#f7ca88","#a1b56c","#86c1b9","#7cafc2","#ba8baf","#a16946"],cssPrefix:"tui-colorpicker-",detailTxt:"Detail",id:ct(),usageStatistics:!0},mt),!mt.container)throw new Error("ColorPicker(): need container option.");dt=this.layout=new ot(mt,mt.container),this.palette=new st(mt,dt.container),this.palette.on({_selectColor:this._onSelectColorInPalette,_toggleSlider:this._onToggleSlider},this),this.slider=new at(mt,dt.container),this.slider.on("_selectColor",this._onSelectColorInSlider,this),dt.addChild(this.palette),dt.addChild(this.slider),this.render(mt.color),mt.usageStatistics&&rt.sendHostName()}ht.prototype._onSelectColorInPalette=function(mt){var dt=mt.color,ft=this.options;if(!nt.isValidRGB(dt)&&dt!==""){this.render();return}this.fire("selectColor",{color:dt,origin:"palette"}),ft.color!==dt&&(ft.color=dt,this.render(dt))},ht.prototype._onToggleSlider=function(){this.slider.toggle(!this.slider.isVisible())},ht.prototype._onSelectColorInSlider=function(mt){var dt=mt.color,ft=this.options;this.fire("selectColor",{color:dt,origin:"slider"}),ft.color!==dt&&(ft.color=dt,this.palette.render(dt))},ht.prototype.setColor=function(mt){if(!nt.isValidRGB(mt))throw new Error("ColorPicker#setColor(): need valid hex string color value");this.options.color=mt,this.render(mt)},ht.prototype.getColor=function(){return this.options.color},ht.prototype.toggle=function(mt){this.layout.container.style.display=mt?"block":"none"},ht.prototype.render=function(mt){this.layout.render(mt||this.options.color)},ht.prototype.destroy=function(){this.layout.destroy(),this.options.container.innerHTML="",this.layout=this.slider=this.palette=this.options=null},it.mixin(ht),_.exports=ht},function(_,_e,et){var it=et(0),tt=et(18),rt=et(9),nt=et(8);function ot(st,at){this.options=it({cssPrefix:"tui-colorpicker-"},st),at=rt.appendHTMLElement("div",at,this.options.cssPrefix+"container"),nt.call(this,st,at),this.render()}tt(ot,nt),ot.prototype.render=function(st){this.recursive(function(at){at.render(st)},!0)},_.exports=ot},function(_,_e,et){function it(tt){function rt(){}return rt.prototype=tt,new rt}_.exports=it},function(_,_e,et){var it=et(52);_.exports=function(tt){var rt=['<li><input class="{{cssPrefix}}palette-button{{isSelected @this}}{{getItemClass @this}}" type="button"',"{{if isValidRGB @this}}",' style="background-color:{{@this}};color:{{@this}}"',"{{/if}}",' title="{{@this}}" value="{{@this}}" /></li>'].join(""),nt=['<ul class="{{cssPrefix}}clearfix">',"{{each preset}}",rt,"{{/each}}","</ul>",'<div class="{{cssPrefix}}clearfix" style="overflow:hidden">','<input type="button" class="{{cssPrefix}}palette-toggle-slider" value="{{detailTxt}}" />','<input type="text" class="{{cssPrefix}}palette-hex" value="{{color}}" maxlength="7" />','<span class="{{cssPrefix}}palette-preview" style="background-color:{{color}};color:{{color}}">{{color}}</span>',"</div>"].join(`
`);return it(nt,tt)}},function(_,_e,et){var it=et(5),tt=et(2),rt=et(1),nt=et(11),ot=et(0),st=/{{\s?|\s?}}/g,at=/^[a-zA-Z0-9_@]+\[[a-zA-Z0-9_@"']+\]$/,lt=/\[\s?|\s?\]/,ct=/^[a-zA-Z_]+\.[a-zA-Z_]+$/,ht=/\./,mt=/^["']\w+["']$/,dt=/"|'/g,ft=/^-?\d+\.?\d*$/,ut=2,pt={if:bt,each:Ct,with:xt},At="a".split(/a/).length===3,gt=function(){return At?function(Ut,Qt){return Ut.split(Qt)}:function(Ut,Qt){var Ht=[],Zt=0,Wt,$t;for(Qt.global||(Qt=new RegExp(Qt,"g")),Wt=Qt.exec(Ut);Wt!==null;)$t=Wt.index,Ht.push(Ut.slice(Zt,$t)),Zt=$t+Wt[0].length,Wt=Qt.exec(Ut);return Ht.push(Ut.slice(Zt)),Ht}}();function vt(Ut,Qt){var Ht,Zt=Qt[Ut];return Ut==="true"?Zt=!0:Ut==="false"?Zt=!1:mt.test(Ut)?Zt=Ut.replace(dt,""):at.test(Ut)?(Ht=Ut.split(lt),Zt=vt(Ht[0],Qt)[vt(Ht[1],Qt)]):ct.test(Ut)?(Ht=Ut.split(ht),Zt=vt(Ht[0],Qt)[Ht[1]]):ft.test(Ut)&&(Zt=parseFloat(Ut)),Zt}function yt(Ut,Qt){var Ht=[Ut],Zt=[],Wt=0,$t=0;return tt(Qt,function(Jt,Nt){Jt.indexOf("if")===0?Wt+=1:Jt==="/if"?Wt-=1:!Wt&&(Jt.indexOf("elseif")===0||Jt==="else")&&(Ht.push(Jt==="else"?["true"]:Jt.split(" ").slice(1)),Zt.push(Qt.slice($t,Nt)),$t=Nt+1)}),Zt.push(Qt.slice($t)),{exps:Ht,sourcesInsideIf:Zt}}function bt(Ut,Qt,Ht){var Zt=yt(Ut,Qt),Wt=!1,$t="";return tt(Zt.exps,function(Jt,Nt){return Wt=Ot(Jt,Ht),Wt&&($t=jt(Zt.sourcesInsideIf[Nt],Ht)),!Wt}),$t}function Ct(Ut,Qt,Ht){var Zt=Ot(Ut,Ht),Wt=rt(Zt)?"@index":"@key",$t={},Jt="";return tt(Zt,function(Nt,Lt){$t[Wt]=Lt,$t["@this"]=Nt,ot(Ht,$t),Jt+=jt(Qt.slice(),Ht)}),Jt}function xt(Ut,Qt,Ht){var Zt=it("as",Ut),Wt=Ut[Zt+1],$t=Ot(Ut.slice(0,Zt),Ht),Jt={};return Jt[Wt]=$t,jt(Qt,ot(Ht,Jt))||""}function It(Ut,Qt,Ht){var Zt=Ut.splice(Qt+1,Ht-Qt);return Zt.pop(),Zt}function St(Ut,Qt,Ht){for(var Zt=pt[Ut],Wt=1,$t=0,Jt,Nt=$t+ut,Lt=Qt[Nt];Wt&&nt(Lt);)Lt.indexOf(Ut)===0?Wt+=1:Lt.indexOf("/"+Ut)===0&&(Wt-=1,Jt=Nt),Nt+=ut,Lt=Qt[Nt];if(Wt)throw Error(Ut+" needs {{/"+Ut+"}} expression.");return Qt[$t]=Zt(Qt[$t].split(" ").slice(1),It(Qt,$t,Jt),Ht),Qt}function Ot(Ut,Qt){var Ht=vt(Ut[0],Qt);return Ht instanceof Function?Mt(Ht,Ut.slice(1),Qt):Ht}function Mt(Ut,Qt,Ht){var Zt=[];return tt(Qt,function(Wt){Zt.push(vt(Wt,Ht))}),Ut.apply(null,Zt)}function jt(Ut,Qt){for(var Ht=1,Zt=Ut[Ht],Wt,$t,Jt;nt(Zt);)Wt=Zt.split(" "),$t=Wt[0],pt[$t]?(Jt=St($t,Ut.splice(Ht,Ut.length-Ht),Qt),Ut=Ut.concat(Jt)):Ut[Ht]=Ot(Wt,Qt),Ht+=ut,Zt=Ut[Ht];return Ut.join("")}function Ft(Ut,Qt){return jt(gt(Ut,st),Qt)}_.exports=Ft},function(_,_e,et){var it=et(1);function tt(rt,nt){var ot=it(rt),st=ot?rt[0]:rt.clientX,at=ot?rt[1]:rt.clientY,lt;return nt?(lt=nt.getBoundingClientRect(),[st-lt.left-nt.clientLeft,at-lt.top-nt.clientTop]):[st,at]}_.exports=tt},function(_,_e,et){var it=et(55);function tt(rt,nt){var ot=rt.parentNode;if(it(rt,nt))return rt;for(;ot&&ot!==document;){if(it(ot,nt))return ot;ot=ot.parentNode}return null}_.exports=tt},function(_,_e,et){var it=et(5),tt=et(56),rt=Element.prototype,nt=rt.matches||rt.webkitMatchesSelector||rt.mozMatchesSelector||rt.msMatchesSelector||function(st){var at=this.document||this.ownerDocument;return it(this,tt(at.querySelectorAll(st)))>-1};function ot(st,at){return nt.call(st,at)}_.exports=ot},function(_,_e,et){var it=et(6);function tt(rt){var nt;try{nt=Array.prototype.slice.call(rt)}catch{nt=[],it(rt,function(st){nt.push(st)})}return nt}_.exports=tt},function(_,_e,et){(function(it){var tt=et(4).isOldBrowser,rt=['<div class="{{cssPrefix}}slider-left {{cssPrefix}}slider-part">{{slider}}</div>','<div class="{{cssPrefix}}slider-right {{cssPrefix}}slider-part">{{huebar}}</div>'].join(`
`),nt=['<svg class="{{cssPrefix}}svg {{cssPrefix}}svg-slider">',"<defs>",'<linearGradient id="{{cssPrefix}}svg-fill-color-{{id}}" x1="0%" y1="0%" x2="100%" y2="0%">','<stop offset="0%" stop-color="rgb(255,255,255)" />','<stop class="{{cssPrefix}}slider-basecolor" offset="100%" stop-color="rgb(255,0,0)" />',"</linearGradient>",'<linearGradient id="{{cssPrefix}}svn-fill-black-{{id}}" x1="0%" y1="0%" x2="0%" y2="100%">','<stop offset="0%" style="stop-color:rgb(0,0,0);stop-opacity:0" />','<stop offset="100%" style="stop-color:rgb(0,0,0);stop-opacity:1" />',"</linearGradient>","</defs>",'<rect width="100%" height="100%" fill="url(#{{cssPrefix}}svg-fill-color-{{id}})"></rect>','<rect width="100%" height="100%" fill="url(#{{cssPrefix}}svn-fill-black-{{id}})"></rect>','<path transform="translate(0,0)" class="{{cssPrefix}}slider-handle" d="M0 7.5 L15 7.5 M7.5 15 L7.5 0 M2 7 a5.5 5.5 0 1 1 0 1 Z" stroke="black" stroke-width="0.75" fill="none" />',"</svg>"].join(`
`),ot=['<div class="{{cssPrefix}}vml-slider">','<v:rect strokecolor="none" class="{{cssPrefix}}vml {{cssPrefix}}vml-slider-bg">','<v:fill class="{{cssPrefix}}vml {{cssPrefix}}slider-basecolor" type="gradient" method="none" color="#ff0000" color2="#fff" angle="90" />',"</v:rect>",'<v:rect strokecolor="#ccc" class="{{cssPrefix}}vml {{cssPrefix}}vml-slider-bg">','<v:fill type="gradient" method="none" color="black" color2="white" o:opacity2="0%" class="{{cssPrefix}}vml" />',"</v:rect>",'<v:shape class="{{cssPrefix}}vml {{cssPrefix}}slider-handle" coordsize="1 1" style="width:1px;height:1px;"path="m 0,7 l 14,7 m 7,14 l 7,0 ar 12,12 2,2 z" filled="false" stroked="true" />',"</div>"].join(`
`),st=['<svg class="{{cssPrefix}}svg {{cssPrefix}}svg-huebar">',"<defs>",'<linearGradient id="g-{{id}}" x1="0%" y1="0%" x2="0%" y2="100%">','<stop offset="0%" stop-color="rgb(255,0,0)" />','<stop offset="16.666%" stop-color="rgb(255,255,0)" />','<stop offset="33.333%" stop-color="rgb(0,255,0)" />','<stop offset="50%" stop-color="rgb(0,255,255)" />','<stop offset="66.666%" stop-color="rgb(0,0,255)" />','<stop offset="83.333%" stop-color="rgb(255,0,255)" />','<stop offset="100%" stop-color="rgb(255,0,0)" />',"</linearGradient>","</defs>",'<rect width="18px" height="100%" fill="url(#g-{{id}})"></rect>','<path transform="translate(-6,-3)" class="{{cssPrefix}}huebar-handle" d="M0 0 L4 4 L0 8 L0 0 Z" fill="black" stroke="none" />',"</svg>"].join(`
`),at=['<div class="{{cssPrefix}}vml-huebar">','<v:rect strokecolor="#ccc" class="{{cssPrefix}}vml {{cssPrefix}}vml-huebar-bg">','<v:fill type="gradient" method="none" colors="0% rgb(255,0,0), 16.666% rgb(255,255,0), 33.333% rgb(0,255,0), 50% rgb(0,255,255), 66.666% rgb(0,0,255), 83.333% rgb(255,0,255), 100% rgb(255,0,0)" angle="180" class="{{cssPrefix}}vml" />',"</v:rect>",'<v:shape class="{{cssPrefix}}vml {{cssPrefix}}huebar-handle" coordsize="1 1" style="width:1px;height:1px;position:absolute;z-index:1;right:22px;top:-3px;"path="m 0,0 l 4,4 l 0,8 l 0,0 z" filled="true" fillcolor="black" stroked="false" />',"</div>"].join(`
`);tt&&it.document.namespaces.add("v","urn:schemas-microsoft-com:vml"),_.exports={layout:rt,slider:tt?ot:nt,huebar:tt?at:st}}).call(this,et(25))}])})})(tuiColorPicker);/*!
 * TOAST UI ImageEditor
 * @version 3.15.2
 * @author NHN. FE Development Team <dl_javascript@nhn.com>
 * @license MIT
 */(function(o,s){(function(_e,et){o.exports=et(tuiCodeSnippet.exports,tuiColorPicker.exports)})(self,function(_,_e){return function(){var et={2777:function(nt,ot,st){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var at=at||{version:"4.6.0"};if(ot.fabric=at,typeof document!="undefined"&&typeof window!="undefined")document instanceof(typeof HTMLDocument!="undefined"?HTMLDocument:Document)?at.document=document:at.document=document.implementation.createHTMLDocument(""),at.window=window;else{var lt=st(4960),ct=new lt.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;at.document=ct.document,at.jsdomImplForWrapper=st(6759).implForWrapper,at.nodeCanvas=st(6272).Canvas,at.window=ct,DOMParser=at.window.DOMParser}at.isTouchSupported="ontouchstart"in at.window||"ontouchstart"in at.document||at.window&&at.window.navigator&&at.window.navigator.maxTouchPoints>0,at.isLikelyNode=typeof Buffer!="undefined"&&typeof window=="undefined",at.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],at.DPI=96,at.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",at.commaWsp="(?:\\s+,?\\s*|,\\s*)",at.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig,at.reNonWord=/[ \n\.,;!\?\-]/,at.fontPaths={},at.iMatrix=[1,0,0,1,0,0],at.svgNS="http://www.w3.org/2000/svg",at.perfLimitSizeTotal=2097152,at.maxCacheSideLimit=4096,at.minCacheSideLimit=256,at.charWidthsCache={},at.textureSize=2048,at.disableStyleCopyPaste=!1,at.enableGLFiltering=!0,at.devicePixelRatio=at.window.devicePixelRatio||at.window.webkitDevicePixelRatio||at.window.mozDevicePixelRatio||1,at.browserShadowBlurConstant=1,at.arcToSegmentsCache={},at.boundsOfCurveCache={},at.cachesBoundsOfCurve=!0,at.forceGLPutImageData=!1,at.initFilterBackend=function(){if(at.enableGLFiltering&&at.isWebglSupported&&at.isWebglSupported(at.textureSize))return console.log("max texture size: "+at.maxTextureSize),new at.WebglFilterBackend({tileSize:at.textureSize});if(at.Canvas2dFilterBackend)return new at.Canvas2dFilterBackend},typeof document!="undefined"&&typeof window!="undefined"&&(window.fabric=at),function(){function ft(yt,bt){if(!!this.__eventListeners[yt]){var Ct=this.__eventListeners[yt];bt?Ct[Ct.indexOf(bt)]=!1:at.util.array.fill(Ct,!1)}}function ut(yt,bt){if(this.__eventListeners||(this.__eventListeners={}),arguments.length===1)for(var Ct in yt)this.on(Ct,yt[Ct]);else this.__eventListeners[yt]||(this.__eventListeners[yt]=[]),this.__eventListeners[yt].push(bt);return this}function pt(yt,bt){var Ct=function(){bt.apply(this,arguments),this.off(yt,Ct)}.bind(this);this.on(yt,Ct)}function At(yt,bt){if(arguments.length===1)for(var Ct in yt)pt.call(this,Ct,yt[Ct]);else pt.call(this,yt,bt);return this}function gt(yt,bt){if(!this.__eventListeners)return this;if(arguments.length===0)for(yt in this.__eventListeners)ft.call(this,yt);else if(arguments.length===1&&typeof arguments[0]=="object")for(var Ct in yt)ft.call(this,Ct,yt[Ct]);else ft.call(this,yt,bt);return this}function vt(yt,bt){if(!this.__eventListeners)return this;var Ct=this.__eventListeners[yt];if(!Ct)return this;for(var xt=0,It=Ct.length;xt<It;xt++)Ct[xt]&&Ct[xt].call(this,bt||{});return this.__eventListeners[yt]=Ct.filter(function(St){return St!==!1}),this}at.Observable={fire:vt,on:ut,once:At,off:gt}}(),at.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var ft=0,ut=arguments.length;ft<ut;ft++)this._onObjectAdded(arguments[ft]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(ft,ut,pt){var At=this._objects;return pt?At[ut]=ft:At.splice(ut,0,ft),this._onObjectAdded&&this._onObjectAdded(ft),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var ft=this._objects,ut,pt=!1,At=0,gt=arguments.length;At<gt;At++)ut=ft.indexOf(arguments[At]),ut!==-1&&(pt=!0,ft.splice(ut,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[At]));return this.renderOnAddRemove&&pt&&this.requestRenderAll(),this},forEachObject:function(ft,ut){for(var pt=this.getObjects(),At=0,gt=pt.length;At<gt;At++)ft.call(ut,pt[At],At,pt);return this},getObjects:function(ft){return typeof ft=="undefined"?this._objects.concat():this._objects.filter(function(ut){return ut.type===ft})},item:function(ft){return this._objects[ft]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(ft,ut){return this._objects.indexOf(ft)>-1?!0:ut?this._objects.some(function(pt){return typeof pt.contains=="function"&&pt.contains(ft,!0)}):!1},complexity:function(){return this._objects.reduce(function(ft,ut){return ft+=ut.complexity?ut.complexity():0,ft},0)}},at.CommonMethods={_setOptions:function(ft){for(var ut in ft)this.set(ut,ft[ut])},_initGradient:function(ft,ut){ft&&ft.colorStops&&!(ft instanceof at.Gradient)&&this.set(ut,new at.Gradient(ft))},_initPattern:function(ft,ut,pt){ft&&ft.source&&!(ft instanceof at.Pattern)?this.set(ut,new at.Pattern(ft,pt)):pt&&pt()},_setObject:function(ft){for(var ut in ft)this._set(ut,ft[ut])},set:function(ft,ut){return typeof ft=="object"?this._setObject(ft):this._set(ft,ut),this},_set:function(ft,ut){this[ft]=ut},toggle:function(ft){var ut=this.get(ft);return typeof ut=="boolean"&&this.set(ft,!ut),this},get:function(ft){return this[ft]}},function(ft){var ut=Math.sqrt,pt=Math.atan2,At=Math.pow,gt=Math.PI/180,vt=Math.PI/2;at.util={cos:function(yt){if(yt===0)return 1;yt<0&&(yt=-yt);var bt=yt/vt;switch(bt){case 1:case 3:return 0;case 2:return-1}return Math.cos(yt)},sin:function(yt){if(yt===0)return 0;var bt=yt/vt,Ct=1;switch(yt<0&&(Ct=-1),bt){case 1:return Ct;case 2:return 0;case 3:return-Ct}return Math.sin(yt)},removeFromArray:function(yt,bt){var Ct=yt.indexOf(bt);return Ct!==-1&&yt.splice(Ct,1),yt},getRandomInt:function(yt,bt){return Math.floor(Math.random()*(bt-yt+1))+yt},degreesToRadians:function(yt){return yt*gt},radiansToDegrees:function(yt){return yt/gt},rotatePoint:function(yt,bt,Ct){var xt=new at.Point(yt.x-bt.x,yt.y-bt.y),It=at.util.rotateVector(xt,Ct);return new at.Point(It.x,It.y).addEquals(bt)},rotateVector:function(yt,bt){var Ct=at.util.sin(bt),xt=at.util.cos(bt),It=yt.x*xt-yt.y*Ct,St=yt.x*Ct+yt.y*xt;return{x:It,y:St}},transformPoint:function(yt,bt,Ct){return Ct?new at.Point(bt[0]*yt.x+bt[2]*yt.y,bt[1]*yt.x+bt[3]*yt.y):new at.Point(bt[0]*yt.x+bt[2]*yt.y+bt[4],bt[1]*yt.x+bt[3]*yt.y+bt[5])},makeBoundingBoxFromPoints:function(yt,bt){if(bt)for(var Ct=0;Ct<yt.length;Ct++)yt[Ct]=at.util.transformPoint(yt[Ct],bt);var xt=[yt[0].x,yt[1].x,yt[2].x,yt[3].x],It=at.util.array.min(xt),St=at.util.array.max(xt),Ot=St-It,Mt=[yt[0].y,yt[1].y,yt[2].y,yt[3].y],jt=at.util.array.min(Mt),Ft=at.util.array.max(Mt),Ut=Ft-jt;return{left:It,top:jt,width:Ot,height:Ut}},invertTransform:function(yt){var bt=1/(yt[0]*yt[3]-yt[1]*yt[2]),Ct=[bt*yt[3],-bt*yt[1],-bt*yt[2],bt*yt[0]],xt=at.util.transformPoint({x:yt[4],y:yt[5]},Ct,!0);return Ct[4]=-xt.x,Ct[5]=-xt.y,Ct},toFixed:function(yt,bt){return parseFloat(Number(yt).toFixed(bt))},parseUnit:function(yt,bt){var Ct=/\D{0,2}$/.exec(yt),xt=parseFloat(yt);switch(bt||(bt=at.Text.DEFAULT_SVG_FONT_SIZE),Ct[0]){case"mm":return xt*at.DPI/25.4;case"cm":return xt*at.DPI/2.54;case"in":return xt*at.DPI;case"pt":return xt*at.DPI/72;case"pc":return xt*at.DPI/72*12;case"em":return xt*bt;default:return xt}},falseFunction:function(){return!1},getKlass:function(yt,bt){return yt=at.util.string.camelize(yt.charAt(0).toUpperCase()+yt.slice(1)),at.util.resolveNamespace(bt)[yt]},getSvgAttributes:function(yt){var bt=["instantiated_by_use","style","id","class"];switch(yt){case"linearGradient":bt=bt.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":bt=bt.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":bt=bt.concat(["offset","stop-color","stop-opacity"]);break}return bt},resolveNamespace:function(yt){if(!yt)return at;var bt=yt.split("."),Ct=bt.length,xt,It=ft||at.window;for(xt=0;xt<Ct;++xt)It=It[bt[xt]];return It},loadImage:function(yt,bt,Ct,xt){if(!yt){bt&&bt.call(Ct,yt);return}var It=at.util.createImage(),St=function(){bt&&bt.call(Ct,It,!1),It=It.onload=It.onerror=null};It.onload=St,It.onerror=function(){at.log("Error loading "+It.src),bt&&bt.call(Ct,null,!0),It=It.onload=It.onerror=null},yt.indexOf("data")!==0&&xt!==void 0&&xt!==null&&(It.crossOrigin=xt),yt.substring(0,14)==="data:image/svg"&&(It.onload=null,at.util.loadImageInDom(It,St)),It.src=yt},loadImageInDom:function(yt,bt){var Ct=at.document.createElement("div");Ct.style.width=Ct.style.height="1px",Ct.style.left=Ct.style.top="-100%",Ct.style.position="absolute",Ct.appendChild(yt),at.document.querySelector("body").appendChild(Ct),yt.onload=function(){bt(),Ct.parentNode.removeChild(Ct),Ct=null}},enlivenObjects:function(yt,bt,Ct,xt){yt=yt||[];var It=[],St=0,Ot=yt.length;function Mt(){++St===Ot&&bt&&bt(It.filter(function(jt){return jt}))}if(!Ot){bt&&bt(It);return}yt.forEach(function(jt,Ft){if(!jt||!jt.type){Mt();return}var Ut=at.util.getKlass(jt.type,Ct);Ut.fromObject(jt,function(Qt,Ht){Ht||(It[Ft]=Qt),xt&&xt(jt,Qt,Ht),Mt()})})},enlivenPatterns:function(yt,bt){yt=yt||[];function Ct(){++It===St&&bt&&bt(xt)}var xt=[],It=0,St=yt.length;if(!St){bt&&bt(xt);return}yt.forEach(function(Ot,Mt){Ot&&Ot.source?new at.Pattern(Ot,function(jt){xt[Mt]=jt,Ct()}):(xt[Mt]=Ot,Ct())})},groupSVGElements:function(yt,bt,Ct){var xt;return yt&&yt.length===1?yt[0]:(bt&&(bt.width&&bt.height?bt.centerPoint={x:bt.width/2,y:bt.height/2}:(delete bt.width,delete bt.height)),xt=new at.Group(yt,bt),typeof Ct!="undefined"&&(xt.sourcePath=Ct),xt)},populateWithProperties:function(yt,bt,Ct){if(Ct&&Object.prototype.toString.call(Ct)==="[object Array]")for(var xt=0,It=Ct.length;xt<It;xt++)Ct[xt]in yt&&(bt[Ct[xt]]=yt[Ct[xt]])},drawDashedLine:function(yt,bt,Ct,xt,It,St){var Ot=xt-bt,Mt=It-Ct,jt=ut(Ot*Ot+Mt*Mt),Ft=pt(Mt,Ot),Ut=St.length,Qt=0,Ht=!0;for(yt.save(),yt.translate(bt,Ct),yt.moveTo(0,0),yt.rotate(Ft),bt=0;jt>bt;)bt+=St[Qt++%Ut],bt>jt&&(bt=jt),yt[Ht?"lineTo":"moveTo"](bt,0),Ht=!Ht;yt.restore()},createCanvasElement:function(){return at.document.createElement("canvas")},copyCanvasElement:function(yt){var bt=at.util.createCanvasElement();return bt.width=yt.width,bt.height=yt.height,bt.getContext("2d").drawImage(yt,0,0),bt},toDataURL:function(yt,bt,Ct){return yt.toDataURL("image/"+bt,Ct)},createImage:function(){return at.document.createElement("img")},multiplyTransformMatrices:function(yt,bt,Ct){return[yt[0]*bt[0]+yt[2]*bt[1],yt[1]*bt[0]+yt[3]*bt[1],yt[0]*bt[2]+yt[2]*bt[3],yt[1]*bt[2]+yt[3]*bt[3],Ct?0:yt[0]*bt[4]+yt[2]*bt[5]+yt[4],Ct?0:yt[1]*bt[4]+yt[3]*bt[5]+yt[5]]},qrDecompose:function(yt){var bt=pt(yt[1],yt[0]),Ct=At(yt[0],2)+At(yt[1],2),xt=ut(Ct),It=(yt[0]*yt[3]-yt[2]*yt[1])/xt,St=pt(yt[0]*yt[2]+yt[1]*yt[3],Ct);return{angle:bt/gt,scaleX:xt,scaleY:It,skewX:St/gt,skewY:0,translateX:yt[4],translateY:yt[5]}},calcRotateMatrix:function(yt){if(!yt.angle)return at.iMatrix.concat();var bt=at.util.degreesToRadians(yt.angle),Ct=at.util.cos(bt),xt=at.util.sin(bt);return[Ct,xt,-xt,Ct,0,0]},calcDimensionsMatrix:function(yt){var bt=typeof yt.scaleX=="undefined"?1:yt.scaleX,Ct=typeof yt.scaleY=="undefined"?1:yt.scaleY,xt=[yt.flipX?-bt:bt,0,0,yt.flipY?-Ct:Ct,0,0],It=at.util.multiplyTransformMatrices,St=at.util.degreesToRadians;return yt.skewX&&(xt=It(xt,[1,0,Math.tan(St(yt.skewX)),1],!0)),yt.skewY&&(xt=It(xt,[1,Math.tan(St(yt.skewY)),0,1],!0)),xt},composeMatrix:function(yt){var bt=[1,0,0,1,yt.translateX||0,yt.translateY||0],Ct=at.util.multiplyTransformMatrices;return yt.angle&&(bt=Ct(bt,at.util.calcRotateMatrix(yt))),(yt.scaleX!==1||yt.scaleY!==1||yt.skewX||yt.skewY||yt.flipX||yt.flipY)&&(bt=Ct(bt,at.util.calcDimensionsMatrix(yt))),bt},resetObjectTransform:function(yt){yt.scaleX=1,yt.scaleY=1,yt.skewX=0,yt.skewY=0,yt.flipX=!1,yt.flipY=!1,yt.rotate(0)},saveObjectTransform:function(yt){return{scaleX:yt.scaleX,scaleY:yt.scaleY,skewX:yt.skewX,skewY:yt.skewY,angle:yt.angle,left:yt.left,flipX:yt.flipX,flipY:yt.flipY,top:yt.top}},isTransparent:function(yt,bt,Ct,xt){xt>0&&(bt>xt?bt-=xt:bt=0,Ct>xt?Ct-=xt:Ct=0);var It=!0,St,Ot,Mt=yt.getImageData(bt,Ct,xt*2||1,xt*2||1),jt=Mt.data.length;for(St=3;St<jt&&(Ot=Mt.data[St],It=Ot<=0,It!==!1);St+=4);return Mt=null,It},parsePreserveAspectRatioAttribute:function(yt){var bt="meet",Ct="Mid",xt="Mid",It=yt.split(" "),St;return It&&It.length&&(bt=It.pop(),bt!=="meet"&&bt!=="slice"?(St=bt,bt="meet"):It.length&&(St=It.pop())),Ct=St!=="none"?St.slice(1,4):"none",xt=St!=="none"?St.slice(5,8):"none",{meetOrSlice:bt,alignX:Ct,alignY:xt}},clearFabricFontCache:function(yt){yt=(yt||"").toLowerCase(),yt?at.charWidthsCache[yt]&&delete at.charWidthsCache[yt]:at.charWidthsCache={}},limitDimsByArea:function(yt,bt){var Ct=Math.sqrt(bt*yt),xt=Math.floor(bt/Ct);return{x:Math.floor(Ct),y:xt}},capValue:function(yt,bt,Ct){return Math.max(yt,Math.min(bt,Ct))},findScaleToFit:function(yt,bt){return Math.min(bt.width/yt.width,bt.height/yt.height)},findScaleToCover:function(yt,bt){return Math.max(bt.width/yt.width,bt.height/yt.height)},matrixToSVG:function(yt){return"matrix("+yt.map(function(bt){return at.util.toFixed(bt,at.Object.NUM_FRACTION_DIGITS)}).join(" ")+")"},removeTransformFromObject:function(yt,bt){var Ct=at.util.invertTransform(bt),xt=at.util.multiplyTransformMatrices(Ct,yt.calcOwnMatrix());at.util.applyTransformToObject(yt,xt)},addTransformToObject:function(yt,bt){at.util.applyTransformToObject(yt,at.util.multiplyTransformMatrices(bt,yt.calcOwnMatrix()))},applyTransformToObject:function(yt,bt){var Ct=at.util.qrDecompose(bt),xt=new at.Point(Ct.translateX,Ct.translateY);yt.flipX=!1,yt.flipY=!1,yt.set("scaleX",Ct.scaleX),yt.set("scaleY",Ct.scaleY),yt.skewX=Ct.skewX,yt.skewY=Ct.skewY,yt.angle=Ct.angle,yt.setPositionByOrigin(xt,"center","center")},sizeAfterTransform:function(yt,bt,Ct){var xt=yt/2,It=bt/2,St=[{x:-xt,y:-It},{x:xt,y:-It},{x:-xt,y:It},{x:xt,y:It}],Ot=at.util.calcDimensionsMatrix(Ct),Mt=at.util.makeBoundingBoxFromPoints(St,Ot);return{x:Mt.width,y:Mt.height}}}}(ot),function(){var ft=Array.prototype.join,ut={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},pt={m:"l",M:"L"};function At(tn,_i,Xt,Vt,qt,rn,nn,cn,un,gn,mn){var dn=at.util.cos(tn),fn=at.util.sin(tn),sn=at.util.cos(_i),pn=at.util.sin(_i),bn=Xt*qt*sn-Vt*rn*pn+nn,An=Vt*qt*sn+Xt*rn*pn+cn,Sn=gn+un*(-Xt*qt*fn-Vt*rn*dn),En=mn+un*(-Vt*qt*fn+Xt*rn*dn),Vn=bn+un*(Xt*qt*pn+Vt*rn*sn),Rn=An+un*(Vt*qt*pn-Xt*rn*sn);return["C",Sn,En,Vn,Rn,bn,An]}function gt(tn,_i,Xt,Vt,qt,rn,nn){var cn=Math.PI,un=nn*cn/180,gn=at.util.sin(un),mn=at.util.cos(un),dn=0,fn=0;Xt=Math.abs(Xt),Vt=Math.abs(Vt);var sn=-mn*tn*.5-gn*_i*.5,pn=-mn*_i*.5+gn*tn*.5,bn=Xt*Xt,An=Vt*Vt,Sn=pn*pn,En=sn*sn,Vn=bn*An-bn*Sn-An*En,Rn=0;if(Vn<0){var In=Math.sqrt(1-Vn/(bn*An));Xt*=In,Vt*=In}else Rn=(qt===rn?-1:1)*Math.sqrt(Vn/(bn*Sn+An*En));var zn=Rn*Xt*pn/Vt,Tn=-Rn*Vt*sn/Xt,tr=mn*zn-gn*Tn+tn*.5,Qn=gn*zn+mn*Tn+_i*.5,Bn=vt(1,0,(sn-zn)/Xt,(pn-Tn)/Vt),xn=vt((sn-zn)/Xt,(pn-Tn)/Vt,(-sn-zn)/Xt,(-pn-Tn)/Vt);rn===0&&xn>0?xn-=2*cn:rn===1&&xn<0&&(xn+=2*cn);for(var Wn=Math.ceil(Math.abs(xn/cn*2)),qn=[],nr=xn/Wn,On=8/3*Math.sin(nr/4)*Math.sin(nr/4)/Math.sin(nr/2),jn=Bn+nr,Ln=0;Ln<Wn;Ln++)qn[Ln]=At(Bn,jn,mn,gn,Xt,Vt,tr,Qn,On,dn,fn),dn=qn[Ln][5],fn=qn[Ln][6],Bn=jn,jn+=nr;return qn}function vt(tn,_i,Xt,Vt){var qt=Math.atan2(_i,tn),rn=Math.atan2(Vt,Xt);return rn>=qt?rn-qt:2*Math.PI-(qt-rn)}function yt(tn,_i,Xt,Vt,qt,rn,nn,cn){var un;if(at.cachesBoundsOfCurve&&(un=ft.call(arguments),at.boundsOfCurveCache[un]))return at.boundsOfCurveCache[un];var gn=Math.sqrt,mn=Math.min,dn=Math.max,fn=Math.abs,sn=[],pn=[[],[]],bn,An,Sn,En,Vn,Rn,In,zn;An=6*tn-12*Xt+6*qt,bn=-3*tn+9*Xt-9*qt+3*nn,Sn=3*Xt-3*tn;for(var Tn=0;Tn<2;++Tn){if(Tn>0&&(An=6*_i-12*Vt+6*rn,bn=-3*_i+9*Vt-9*rn+3*cn,Sn=3*Vt-3*_i),fn(bn)<1e-12){if(fn(An)<1e-12)continue;En=-Sn/An,0<En&&En<1&&sn.push(En);continue}In=An*An-4*Sn*bn,!(In<0)&&(zn=gn(In),Vn=(-An+zn)/(2*bn),0<Vn&&Vn<1&&sn.push(Vn),Rn=(-An-zn)/(2*bn),0<Rn&&Rn<1&&sn.push(Rn))}for(var tr,Qn,Bn=sn.length,xn=Bn,Wn;Bn--;)En=sn[Bn],Wn=1-En,tr=Wn*Wn*Wn*tn+3*Wn*Wn*En*Xt+3*Wn*En*En*qt+En*En*En*nn,pn[0][Bn]=tr,Qn=Wn*Wn*Wn*_i+3*Wn*Wn*En*Vt+3*Wn*En*En*rn+En*En*En*cn,pn[1][Bn]=Qn;pn[0][xn]=tn,pn[1][xn]=_i,pn[0][xn+1]=nn,pn[1][xn+1]=cn;var qn=[{x:mn.apply(null,pn[0]),y:mn.apply(null,pn[1])},{x:dn.apply(null,pn[0]),y:dn.apply(null,pn[1])}];return at.cachesBoundsOfCurve&&(at.boundsOfCurveCache[un]=qn),qn}function bt(tn,_i,Xt){for(var Vt=Xt[1],qt=Xt[2],rn=Xt[3],nn=Xt[4],cn=Xt[5],un=Xt[6],gn=Xt[7],mn=gt(un-tn,gn-_i,Vt,qt,nn,cn,rn),dn=0,fn=mn.length;dn<fn;dn++)mn[dn][1]+=tn,mn[dn][2]+=_i,mn[dn][3]+=tn,mn[dn][4]+=_i,mn[dn][5]+=tn,mn[dn][6]+=_i;return mn}function Ct(tn){var _i=0,Xt=0,Vt=tn.length,qt=0,rn=0,nn,cn,un,gn=[],mn,dn,fn;for(cn=0;cn<Vt;++cn){switch(un=!1,nn=tn[cn].slice(0),nn[0]){case"l":nn[0]="L",nn[1]+=_i,nn[2]+=Xt;case"L":_i=nn[1],Xt=nn[2];break;case"h":nn[1]+=_i;case"H":nn[0]="L",nn[2]=Xt,_i=nn[1];break;case"v":nn[1]+=Xt;case"V":nn[0]="L",Xt=nn[1],nn[1]=_i,nn[2]=Xt;break;case"m":nn[0]="M",nn[1]+=_i,nn[2]+=Xt;case"M":_i=nn[1],Xt=nn[2],qt=nn[1],rn=nn[2];break;case"c":nn[0]="C",nn[1]+=_i,nn[2]+=Xt,nn[3]+=_i,nn[4]+=Xt,nn[5]+=_i,nn[6]+=Xt;case"C":dn=nn[3],fn=nn[4],_i=nn[5],Xt=nn[6];break;case"s":nn[0]="S",nn[1]+=_i,nn[2]+=Xt,nn[3]+=_i,nn[4]+=Xt;case"S":mn==="C"?(dn=2*_i-dn,fn=2*Xt-fn):(dn=_i,fn=Xt),_i=nn[3],Xt=nn[4],nn[0]="C",nn[5]=nn[3],nn[6]=nn[4],nn[3]=nn[1],nn[4]=nn[2],nn[1]=dn,nn[2]=fn,dn=nn[3],fn=nn[4];break;case"q":nn[0]="Q",nn[1]+=_i,nn[2]+=Xt,nn[3]+=_i,nn[4]+=Xt;case"Q":dn=nn[1],fn=nn[2],_i=nn[3],Xt=nn[4];break;case"t":nn[0]="T",nn[1]+=_i,nn[2]+=Xt;case"T":mn==="Q"?(dn=2*_i-dn,fn=2*Xt-fn):(dn=_i,fn=Xt),nn[0]="Q",_i=nn[1],Xt=nn[2],nn[1]=dn,nn[2]=fn,nn[3]=_i,nn[4]=Xt;break;case"a":nn[0]="A",nn[6]+=_i,nn[7]+=Xt;case"A":un=!0,gn=gn.concat(bt(_i,Xt,nn)),_i=nn[6],Xt=nn[7];break;case"z":case"Z":_i=qt,Xt=rn;break}un||gn.push(nn),mn=nn[0]}return gn}function xt(tn,_i,Xt,Vt){return Math.sqrt((Xt-tn)*(Xt-tn)+(Vt-_i)*(Vt-_i))}function It(tn){return tn*tn*tn}function St(tn){return 3*tn*tn*(1-tn)}function Ot(tn){return 3*tn*(1-tn)*(1-tn)}function Mt(tn){return(1-tn)*(1-tn)*(1-tn)}function jt(tn,_i,Xt,Vt,qt,rn,nn,cn){return function(un){var gn=It(un),mn=St(un),dn=Ot(un),fn=Mt(un);return{x:nn*gn+qt*mn+Xt*dn+tn*fn,y:cn*gn+rn*mn+Vt*dn+_i*fn}}}function Ft(tn,_i,Xt,Vt,qt,rn,nn,cn){return function(un){var gn=1-un,mn=3*gn*gn*(Xt-tn)+6*gn*un*(qt-Xt)+3*un*un*(nn-qt),dn=3*gn*gn*(Vt-_i)+6*gn*un*(rn-Vt)+3*un*un*(cn-rn);return Math.atan2(dn,mn)}}function Ut(tn){return tn*tn}function Qt(tn){return 2*tn*(1-tn)}function Ht(tn){return(1-tn)*(1-tn)}function Zt(tn,_i,Xt,Vt,qt,rn){return function(nn){var cn=Ut(nn),un=Qt(nn),gn=Ht(nn);return{x:qt*cn+Xt*un+tn*gn,y:rn*cn+Vt*un+_i*gn}}}function Wt(tn,_i,Xt,Vt,qt,rn){return function(nn){var cn=1-nn,un=2*cn*(Xt-tn)+2*nn*(qt-Xt),gn=2*cn*(Vt-_i)+2*nn*(rn-Vt);return Math.atan2(gn,un)}}function $t(tn,_i,Xt){var Vt={x:_i,y:Xt},qt,rn=0,nn;for(nn=1;nn<=100;nn+=1)qt=tn(nn/100),rn+=xt(Vt.x,Vt.y,qt.x,qt.y),Vt=qt;return rn}function Jt(tn,_i){for(var Xt=0,Vt=0,qt=tn.iterator,rn={x:tn.x,y:tn.y},nn,cn,un=.01,gn=tn.angleFinder,mn;Vt<_i&&Xt<=1&&un>1e-4;)nn=qt(Xt),mn=Xt,cn=xt(rn.x,rn.y,nn.x,nn.y),cn+Vt>_i?(un/=2,Xt-=un):(rn=nn,Xt+=un,Vt+=cn);return nn.angle=gn(mn),nn}function Nt(tn){for(var _i=0,Xt=tn.length,Vt,qt=0,rn=0,nn=0,cn=0,un=[],gn,mn,dn,fn=0;fn<Xt;fn++){switch(Vt=tn[fn],mn={x:qt,y:rn,command:Vt[0]},Vt[0]){case"M":mn.length=0,nn=qt=Vt[1],cn=rn=Vt[2];break;case"L":mn.length=xt(qt,rn,Vt[1],Vt[2]),qt=Vt[1],rn=Vt[2];break;case"C":gn=jt(qt,rn,Vt[1],Vt[2],Vt[3],Vt[4],Vt[5],Vt[6]),dn=Ft(qt,rn,Vt[1],Vt[2],Vt[3],Vt[4],Vt[5],Vt[6]),mn.iterator=gn,mn.angleFinder=dn,mn.length=$t(gn,qt,rn),qt=Vt[5],rn=Vt[6];break;case"Q":gn=Zt(qt,rn,Vt[1],Vt[2],Vt[3],Vt[4]),dn=Wt(qt,rn,Vt[1],Vt[2],Vt[3],Vt[4]),mn.iterator=gn,mn.angleFinder=dn,mn.length=$t(gn,qt,rn),qt=Vt[3],rn=Vt[4];break;case"Z":case"z":mn.destX=nn,mn.destY=cn,mn.length=xt(qt,rn,nn,cn),qt=nn,rn=cn;break}_i+=mn.length,un.push(mn)}return un.push({length:_i,x:qt,y:rn}),un}function Lt(tn,_i,Xt){Xt||(Xt=Nt(tn));for(var Vt=0;_i-Xt[Vt].length>0&&Vt<Xt.length-2;)_i-=Xt[Vt].length,Vt++;var qt=Xt[Vt],rn=_i/qt.length,nn=qt.command,cn=tn[Vt],un;switch(nn){case"M":return{x:qt.x,y:qt.y,angle:0};case"Z":case"z":return un=new at.Point(qt.x,qt.y).lerp(new at.Point(qt.destX,qt.destY),rn),un.angle=Math.atan2(qt.destY-qt.y,qt.destX-qt.x),un;case"L":return un=new at.Point(qt.x,qt.y).lerp(new at.Point(cn[1],cn[2]),rn),un.angle=Math.atan2(cn[2]-qt.y,cn[1]-qt.x),un;case"C":return Jt(qt,_i);case"Q":return Jt(qt,_i)}}function Kt(tn){var _i=[],Xt=[],Vt,qt,rn=at.rePathCommand,nn="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",cn="("+nn+")"+at.commaWsp,un="([01])"+at.commaWsp+"?",gn=cn+"?"+cn+"?"+cn+un+un+cn+"?("+nn+")",mn=new RegExp(gn,"g"),dn,fn,sn;if(!tn||!tn.match)return _i;sn=tn.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);for(var pn=0,bn,An=sn.length;pn<An;pn++){Vt=sn[pn],fn=Vt.slice(1).trim(),Xt.length=0;var Sn=Vt.charAt(0);if(bn=[Sn],Sn.toLowerCase()==="a")for(var En;En=mn.exec(fn);)for(var Vn=1;Vn<En.length;Vn++)Xt.push(En[Vn]);else for(;dn=rn.exec(fn);)Xt.push(dn[0]);for(var Vn=0,Rn=Xt.length;Vn<Rn;Vn++)qt=parseFloat(Xt[Vn]),isNaN(qt)||bn.push(qt);var In=ut[Sn.toLowerCase()],zn=pt[Sn]||Sn;if(bn.length-1>In)for(var Tn=1,tr=bn.length;Tn<tr;Tn+=In)_i.push([Sn].concat(bn.slice(Tn,Tn+In))),Sn=zn;else _i.push(bn)}return _i}function Pt(tn,_i){var Xt=[],Vt,qt=new at.Point(tn[0].x,tn[0].y),rn=new at.Point(tn[1].x,tn[1].y),nn=tn.length,cn=1,un=0,gn=nn>2;for(_i=_i||0,gn&&(cn=tn[2].x<rn.x?-1:tn[2].x===rn.x?0:1,un=tn[2].y<rn.y?-1:tn[2].y===rn.y?0:1),Xt.push(["M",qt.x-cn*_i,qt.y-un*_i]),Vt=1;Vt<nn;Vt++){if(!qt.eq(rn)){var mn=qt.midPointFrom(rn);Xt.push(["Q",qt.x,qt.y,mn.x,mn.y])}qt=tn[Vt],Vt+1<tn.length&&(rn=tn[Vt+1])}return gn&&(cn=qt.x>tn[Vt-2].x?1:qt.x===tn[Vt-2].x?0:-1,un=qt.y>tn[Vt-2].y?1:qt.y===tn[Vt-2].y?0:-1),Xt.push(["L",qt.x+cn*_i,qt.y+un*_i]),Xt}function ln(tn,_i,Xt){return Xt&&(_i=at.util.multiplyTransformMatrices(_i,[1,0,0,1,-Xt.x,-Xt.y])),tn.map(function(Vt){for(var qt=Vt.slice(0),rn={},nn=1;nn<Vt.length-1;nn+=2)rn.x=Vt[nn],rn.y=Vt[nn+1],rn=at.util.transformPoint(rn,_i),qt[nn]=rn.x,qt[nn+1]=rn.y;return qt})}function Gt(tn,_i,Xt,Vt,qt,rn,nn,cn,un){for(var gn=0,mn=0,dn,fn=[],sn=gt(cn-tn,un-_i,Xt,Vt,rn,nn,qt),pn=0,bn=sn.length;pn<bn;pn++)dn=yt(gn,mn,sn[pn][1],sn[pn][2],sn[pn][3],sn[pn][4],sn[pn][5],sn[pn][6]),fn.push({x:dn[0].x+tn,y:dn[0].y+_i}),fn.push({x:dn[1].x+tn,y:dn[1].y+_i}),gn=sn[pn][5],mn=sn[pn][6];return fn}function on(tn,_i,Xt,Vt){Vt=Vt.slice(0).unshift("X");var qt=bt(_i,Xt,Vt);qt.forEach(function(rn){tn.bezierCurveTo.apply(tn,rn.slice(1))})}at.util.joinPath=function(tn){return tn.map(function(_i){return _i.join(" ")}).join(" ")},at.util.parsePath=Kt,at.util.makePathSimpler=Ct,at.util.getSmoothPathFromPoints=Pt,at.util.getPathSegmentsInfo=Nt,at.util.getBoundsOfCurve=yt,at.util.getPointOnPath=Lt,at.util.transformPath=ln,at.util.fromArcToBeizers=bt,at.util.getBoundsOfArc=Gt,at.util.drawArc=on}(),function(){var ft=Array.prototype.slice;function ut(yt,bt){for(var Ct=ft.call(arguments,2),xt=[],It=0,St=yt.length;It<St;It++)xt[It]=Ct.length?yt[It][bt].apply(yt[It],Ct):yt[It][bt].call(yt[It]);return xt}function pt(yt,bt){return vt(yt,bt,function(Ct,xt){return Ct>=xt})}function At(yt,bt){return vt(yt,bt,function(Ct,xt){return Ct<xt})}function gt(yt,bt){for(var Ct=yt.length;Ct--;)yt[Ct]=bt;return yt}function vt(yt,bt,Ct){if(!(!yt||yt.length===0)){var xt=yt.length-1,It=bt?yt[xt][bt]:yt[xt];if(bt)for(;xt--;)Ct(yt[xt][bt],It)&&(It=yt[xt][bt]);else for(;xt--;)Ct(yt[xt],It)&&(It=yt[xt]);return It}}at.util.array={fill:gt,invoke:ut,min:At,max:pt}}(),function(){function ft(pt,At,gt){if(gt)if(!at.isLikelyNode&&At instanceof Element)pt=At;else if(At instanceof Array){pt=[];for(var vt=0,yt=At.length;vt<yt;vt++)pt[vt]=ft({},At[vt],gt)}else if(At&&typeof At=="object")for(var bt in At)bt==="canvas"||bt==="group"?pt[bt]=null:At.hasOwnProperty(bt)&&(pt[bt]=ft({},At[bt],gt));else pt=At;else for(var bt in At)pt[bt]=At[bt];return pt}function ut(pt,At){return ft({},pt,At)}at.util.object={extend:ft,clone:ut},at.util.object.extend(at.util,at.Observable)}(),function(){function ft(vt){return vt.replace(/-+(.)?/g,function(yt,bt){return bt?bt.toUpperCase():""})}function ut(vt,yt){return vt.charAt(0).toUpperCase()+(yt?vt.slice(1):vt.slice(1).toLowerCase())}function pt(vt){return vt.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function At(vt){var yt=0,bt,Ct=[];for(yt=0,bt;yt<vt.length;yt++)(bt=gt(vt,yt))!==!1&&Ct.push(bt);return Ct}function gt(vt,yt){var bt=vt.charCodeAt(yt);if(isNaN(bt))return"";if(bt<55296||bt>57343)return vt.charAt(yt);if(55296<=bt&&bt<=56319){if(vt.length<=yt+1)throw"High surrogate without following low surrogate";var Ct=vt.charCodeAt(yt+1);if(56320>Ct||Ct>57343)throw"High surrogate without following low surrogate";return vt.charAt(yt)+vt.charAt(yt+1)}if(yt===0)throw"Low surrogate without preceding high surrogate";var xt=vt.charCodeAt(yt-1);if(55296>xt||xt>56319)throw"Low surrogate without preceding high surrogate";return!1}at.util.string={camelize:ft,capitalize:ut,escapeXml:pt,graphemeSplit:At}}(),function(){var ft=Array.prototype.slice,ut=function(){},pt=function(){for(var bt in{toString:1})if(bt==="toString")return!1;return!0}(),At=function(bt,Ct,xt){for(var It in Ct)It in bt.prototype&&typeof bt.prototype[It]=="function"&&(Ct[It]+"").indexOf("callSuper")>-1?bt.prototype[It]=function(St){return function(){var Ot=this.constructor.superclass;this.constructor.superclass=xt;var Mt=Ct[St].apply(this,arguments);if(this.constructor.superclass=Ot,St!=="initialize")return Mt}}(It):bt.prototype[It]=Ct[It],pt&&(Ct.toString!==Object.prototype.toString&&(bt.prototype.toString=Ct.toString),Ct.valueOf!==Object.prototype.valueOf&&(bt.prototype.valueOf=Ct.valueOf))};function gt(){}function vt(bt){for(var Ct=null,xt=this;xt.constructor.superclass;){var It=xt.constructor.superclass.prototype[bt];if(xt[bt]!==It){Ct=It;break}xt=xt.constructor.superclass.prototype}return Ct?arguments.length>1?Ct.apply(this,ft.call(arguments,1)):Ct.call(this):console.log("tried to callSuper "+bt+", method not found in prototype chain",this)}function yt(){var bt=null,Ct=ft.call(arguments,0);typeof Ct[0]=="function"&&(bt=Ct.shift());function xt(){this.initialize.apply(this,arguments)}xt.superclass=bt,xt.subclasses=[],bt&&(gt.prototype=bt.prototype,xt.prototype=new gt,bt.subclasses.push(xt));for(var It=0,St=Ct.length;It<St;It++)At(xt,Ct[It],bt);return xt.prototype.initialize||(xt.prototype.initialize=ut),xt.prototype.constructor=xt,xt.prototype.callSuper=vt,xt}at.util.createClass=yt}(),function(){var ft=!!at.document.createElement("div").attachEvent,ut=["touchstart","touchmove","touchend"];at.util.addListener=function(At,gt,vt,yt){At&&At.addEventListener(gt,vt,ft?!1:yt)},at.util.removeListener=function(At,gt,vt,yt){At&&At.removeEventListener(gt,vt,ft?!1:yt)};function pt(At){var gt=At.changedTouches;return gt&&gt[0]?gt[0]:At}at.util.getPointer=function(At){var gt=At.target,vt=at.util.getScrollLeftTop(gt),yt=pt(At);return{x:yt.clientX+vt.left,y:yt.clientY+vt.top}},at.util.isTouchEvent=function(At){return ut.indexOf(At.type)>-1||At.pointerType==="touch"}}(),function(){function ft(yt,bt){var Ct=yt.style;if(!Ct)return yt;if(typeof bt=="string")return yt.style.cssText+=";"+bt,bt.indexOf("opacity")>-1?vt(yt,bt.match(/opacity:\s*(\d?\.?\d*)/)[1]):yt;for(var xt in bt)if(xt==="opacity")vt(yt,bt[xt]);else{var It=xt==="float"||xt==="cssFloat"?typeof Ct.styleFloat=="undefined"?"cssFloat":"styleFloat":xt;Ct[It]=bt[xt]}return yt}var ut=at.document.createElement("div"),pt=typeof ut.style.opacity=="string",At=typeof ut.style.filter=="string",gt=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,vt=function(yt){return yt};pt?vt=function(yt,bt){return yt.style.opacity=bt,yt}:At&&(vt=function(yt,bt){var Ct=yt.style;return yt.currentStyle&&!yt.currentStyle.hasLayout&&(Ct.zoom=1),gt.test(Ct.filter)?(bt=bt>=.9999?"":"alpha(opacity="+bt*100+")",Ct.filter=Ct.filter.replace(gt,bt)):Ct.filter+=" alpha(opacity="+bt*100+")",yt}),at.util.setStyle=ft}(),function(){var ft=Array.prototype.slice;function ut(Mt){return typeof Mt=="string"?at.document.getElementById(Mt):Mt}var pt,At=function(Mt){return ft.call(Mt,0)};try{pt=At(at.document.childNodes)instanceof Array}catch{}pt||(At=function(Mt){for(var jt=new Array(Mt.length),Ft=Mt.length;Ft--;)jt[Ft]=Mt[Ft];return jt});function gt(Mt,jt){var Ft=at.document.createElement(Mt);for(var Ut in jt)Ut==="class"?Ft.className=jt[Ut]:Ut==="for"?Ft.htmlFor=jt[Ut]:Ft.setAttribute(Ut,jt[Ut]);return Ft}function vt(Mt,jt){Mt&&(" "+Mt.className+" ").indexOf(" "+jt+" ")===-1&&(Mt.className+=(Mt.className?" ":"")+jt)}function yt(Mt,jt,Ft){return typeof jt=="string"&&(jt=gt(jt,Ft)),Mt.parentNode&&Mt.parentNode.replaceChild(jt,Mt),jt.appendChild(Mt),jt}function bt(Mt){for(var jt=0,Ft=0,Ut=at.document.documentElement,Qt=at.document.body||{scrollLeft:0,scrollTop:0};Mt&&(Mt.parentNode||Mt.host)&&(Mt=Mt.parentNode||Mt.host,Mt===at.document?(jt=Qt.scrollLeft||Ut.scrollLeft||0,Ft=Qt.scrollTop||Ut.scrollTop||0):(jt+=Mt.scrollLeft||0,Ft+=Mt.scrollTop||0),!(Mt.nodeType===1&&Mt.style.position==="fixed")););return{left:jt,top:Ft}}function Ct(Mt){var jt,Ft=Mt&&Mt.ownerDocument,Ut={left:0,top:0},Qt={left:0,top:0},Ht,Zt={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!Ft)return Qt;for(var Wt in Zt)Qt[Zt[Wt]]+=parseInt(xt(Mt,Wt),10)||0;return jt=Ft.documentElement,typeof Mt.getBoundingClientRect!="undefined"&&(Ut=Mt.getBoundingClientRect()),Ht=bt(Mt),{left:Ut.left+Ht.left-(jt.clientLeft||0)+Qt.left,top:Ut.top+Ht.top-(jt.clientTop||0)+Qt.top}}var xt;at.document.defaultView&&at.document.defaultView.getComputedStyle?xt=function(Mt,jt){var Ft=at.document.defaultView.getComputedStyle(Mt,null);return Ft?Ft[jt]:void 0}:xt=function(Mt,jt){var Ft=Mt.style[jt];return!Ft&&Mt.currentStyle&&(Ft=Mt.currentStyle[jt]),Ft},function(){var Mt=at.document.documentElement.style,jt="userSelect"in Mt?"userSelect":"MozUserSelect"in Mt?"MozUserSelect":"WebkitUserSelect"in Mt?"WebkitUserSelect":"KhtmlUserSelect"in Mt?"KhtmlUserSelect":"";function Ft(Qt){return typeof Qt.onselectstart!="undefined"&&(Qt.onselectstart=at.util.falseFunction),jt?Qt.style[jt]="none":typeof Qt.unselectable=="string"&&(Qt.unselectable="on"),Qt}function Ut(Qt){return typeof Qt.onselectstart!="undefined"&&(Qt.onselectstart=null),jt?Qt.style[jt]="":typeof Qt.unselectable=="string"&&(Qt.unselectable=""),Qt}at.util.makeElementUnselectable=Ft,at.util.makeElementSelectable=Ut}();function It(Mt){var jt=at.jsdomImplForWrapper(Mt);return jt._canvas||jt._image}function St(Mt){if(!!at.isLikelyNode){var jt=at.jsdomImplForWrapper(Mt);jt&&(jt._image=null,jt._canvas=null,jt._currentSrc=null,jt._attributes=null,jt._classList=null)}}function Ot(Mt,jt){Mt.imageSmoothingEnabled=Mt.imageSmoothingEnabled||Mt.webkitImageSmoothingEnabled||Mt.mozImageSmoothingEnabled||Mt.msImageSmoothingEnabled||Mt.oImageSmoothingEnabled,Mt.imageSmoothingEnabled=jt}at.util.setImageSmoothing=Ot,at.util.getById=ut,at.util.toArray=At,at.util.addClass=vt,at.util.makeElement=gt,at.util.wrapElement=yt,at.util.getScrollLeftTop=bt,at.util.getElementOffset=Ct,at.util.getNodeCanvas=It,at.util.cleanUpJsdomNode=St}(),function(){function ft(At,gt){return At+(/\?/.test(At)?"&":"?")+gt}function ut(){}function pt(At,gt){gt||(gt={});var vt=gt.method?gt.method.toUpperCase():"GET",yt=gt.onComplete||function(){},bt=new at.window.XMLHttpRequest,Ct=gt.body||gt.parameters;return bt.onreadystatechange=function(){bt.readyState===4&&(yt(bt),bt.onreadystatechange=ut)},vt==="GET"&&(Ct=null,typeof gt.parameters=="string"&&(At=ft(At,gt.parameters))),bt.open(vt,At,!0),(vt==="POST"||vt==="PUT")&&bt.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),bt.send(Ct),bt}at.util.request=pt}(),at.log=console.log,at.warn=console.warn,function(){function ft(){return!1}function ut(bt,Ct,xt,It){return-xt*Math.cos(bt/It*(Math.PI/2))+xt+Ct}function pt(bt){var Ct=!1;return vt(function(xt){bt||(bt={});var It=xt||+new Date,St=bt.duration||500,Ot=It+St,Mt,jt=bt.onChange||ft,Ft=bt.abort||ft,Ut=bt.onComplete||ft,Qt=bt.easing||ut,Ht="startValue"in bt?bt.startValue:0,Zt="endValue"in bt?bt.endValue:100,Wt=bt.byValue||Zt-Ht;bt.onStart&&bt.onStart(),function $t(Jt){Mt=Jt||+new Date;var Nt=Mt>Ot?St:Mt-It,Lt=Nt/St,Kt=Qt(Nt,Ht,Wt,St),Pt=Math.abs((Kt-Ht)/Wt);if(!Ct){if(Ft(Kt,Pt,Lt)){Ut(Zt,1,1);return}if(Mt>Ot){jt(Zt,1,1),Ut(Zt,1,1);return}else jt(Kt,Pt,Lt),vt($t)}}(It)}),function(){Ct=!0}}var At=at.window.requestAnimationFrame||at.window.webkitRequestAnimationFrame||at.window.mozRequestAnimationFrame||at.window.oRequestAnimationFrame||at.window.msRequestAnimationFrame||function(bt){return at.window.setTimeout(bt,1e3/60)},gt=at.window.cancelAnimationFrame||at.window.clearTimeout;function vt(){return At.apply(at.window,arguments)}function yt(){return gt.apply(at.window,arguments)}at.util.animate=pt,at.util.requestAnimFrame=vt,at.util.cancelAnimFrame=yt}(),function(){function ft(pt,At,gt){var vt="rgba("+parseInt(pt[0]+gt*(At[0]-pt[0]),10)+","+parseInt(pt[1]+gt*(At[1]-pt[1]),10)+","+parseInt(pt[2]+gt*(At[2]-pt[2]),10);return vt+=","+(pt&&At?parseFloat(pt[3]+gt*(At[3]-pt[3])):1),vt+=")",vt}function ut(pt,At,gt,vt){var yt=new at.Color(pt).getSource(),bt=new at.Color(At).getSource(),Ct=vt.onComplete,xt=vt.onChange;return vt=vt||{},at.util.animate(at.util.object.extend(vt,{duration:gt||500,startValue:yt,endValue:bt,byValue:bt,easing:function(It,St,Ot,Mt){var jt=vt.colorEasing?vt.colorEasing(It,Mt):1-Math.cos(It/Mt*(Math.PI/2));return ft(St,Ot,jt)},onComplete:function(It,St,Ot){if(Ct)return Ct(ft(bt,bt,0),St,Ot)},onChange:function(It,St,Ot){if(xt){if(Array.isArray(It))return xt(ft(It,It,0),St,Ot);xt(It,St,Ot)}}}))}at.util.animateColor=ut}(),function(){function ft(Gt,on,tn,_i){return Gt<Math.abs(on)?(Gt=on,_i=tn/4):on===0&&Gt===0?_i=tn/(2*Math.PI)*Math.asin(1):_i=tn/(2*Math.PI)*Math.asin(on/Gt),{a:Gt,c:on,p:tn,s:_i}}function ut(Gt,on,tn){return Gt.a*Math.pow(2,10*(on-=1))*Math.sin((on*tn-Gt.s)*(2*Math.PI)/Gt.p)}function pt(Gt,on,tn,_i){return tn*((Gt=Gt/_i-1)*Gt*Gt+1)+on}function At(Gt,on,tn,_i){return Gt/=_i/2,Gt<1?tn/2*Gt*Gt*Gt+on:tn/2*((Gt-=2)*Gt*Gt+2)+on}function gt(Gt,on,tn,_i){return tn*(Gt/=_i)*Gt*Gt*Gt+on}function vt(Gt,on,tn,_i){return-tn*((Gt=Gt/_i-1)*Gt*Gt*Gt-1)+on}function yt(Gt,on,tn,_i){return Gt/=_i/2,Gt<1?tn/2*Gt*Gt*Gt*Gt+on:-tn/2*((Gt-=2)*Gt*Gt*Gt-2)+on}function bt(Gt,on,tn,_i){return tn*(Gt/=_i)*Gt*Gt*Gt*Gt+on}function Ct(Gt,on,tn,_i){return tn*((Gt=Gt/_i-1)*Gt*Gt*Gt*Gt+1)+on}function xt(Gt,on,tn,_i){return Gt/=_i/2,Gt<1?tn/2*Gt*Gt*Gt*Gt*Gt+on:tn/2*((Gt-=2)*Gt*Gt*Gt*Gt+2)+on}function It(Gt,on,tn,_i){return-tn*Math.cos(Gt/_i*(Math.PI/2))+tn+on}function St(Gt,on,tn,_i){return tn*Math.sin(Gt/_i*(Math.PI/2))+on}function Ot(Gt,on,tn,_i){return-tn/2*(Math.cos(Math.PI*Gt/_i)-1)+on}function Mt(Gt,on,tn,_i){return Gt===0?on:tn*Math.pow(2,10*(Gt/_i-1))+on}function jt(Gt,on,tn,_i){return Gt===_i?on+tn:tn*(-Math.pow(2,-10*Gt/_i)+1)+on}function Ft(Gt,on,tn,_i){return Gt===0?on:Gt===_i?on+tn:(Gt/=_i/2,Gt<1?tn/2*Math.pow(2,10*(Gt-1))+on:tn/2*(-Math.pow(2,-10*--Gt)+2)+on)}function Ut(Gt,on,tn,_i){return-tn*(Math.sqrt(1-(Gt/=_i)*Gt)-1)+on}function Qt(Gt,on,tn,_i){return tn*Math.sqrt(1-(Gt=Gt/_i-1)*Gt)+on}function Ht(Gt,on,tn,_i){return Gt/=_i/2,Gt<1?-tn/2*(Math.sqrt(1-Gt*Gt)-1)+on:tn/2*(Math.sqrt(1-(Gt-=2)*Gt)+1)+on}function Zt(Gt,on,tn,_i){var Xt=1.70158,Vt=0,qt=tn;if(Gt===0)return on;if(Gt/=_i,Gt===1)return on+tn;Vt||(Vt=_i*.3);var rn=ft(qt,tn,Vt,Xt);return-ut(rn,Gt,_i)+on}function Wt(Gt,on,tn,_i){var Xt=1.70158,Vt=0,qt=tn;if(Gt===0)return on;if(Gt/=_i,Gt===1)return on+tn;Vt||(Vt=_i*.3);var rn=ft(qt,tn,Vt,Xt);return rn.a*Math.pow(2,-10*Gt)*Math.sin((Gt*_i-rn.s)*(2*Math.PI)/rn.p)+rn.c+on}function $t(Gt,on,tn,_i){var Xt=1.70158,Vt=0,qt=tn;if(Gt===0)return on;if(Gt/=_i/2,Gt===2)return on+tn;Vt||(Vt=_i*.44999999999999996);var rn=ft(qt,tn,Vt,Xt);return Gt<1?-.5*ut(rn,Gt,_i)+on:rn.a*Math.pow(2,-10*(Gt-=1))*Math.sin((Gt*_i-rn.s)*(2*Math.PI)/rn.p)*.5+rn.c+on}function Jt(Gt,on,tn,_i,Xt){return Xt===void 0&&(Xt=1.70158),tn*(Gt/=_i)*Gt*((Xt+1)*Gt-Xt)+on}function Nt(Gt,on,tn,_i,Xt){return Xt===void 0&&(Xt=1.70158),tn*((Gt=Gt/_i-1)*Gt*((Xt+1)*Gt+Xt)+1)+on}function Lt(Gt,on,tn,_i,Xt){return Xt===void 0&&(Xt=1.70158),Gt/=_i/2,Gt<1?tn/2*(Gt*Gt*(((Xt*=1.525)+1)*Gt-Xt))+on:tn/2*((Gt-=2)*Gt*(((Xt*=1.525)+1)*Gt+Xt)+2)+on}function Kt(Gt,on,tn,_i){return tn-Pt(_i-Gt,0,tn,_i)+on}function Pt(Gt,on,tn,_i){return(Gt/=_i)<.36363636363636365?tn*(7.5625*Gt*Gt)+on:Gt<.7272727272727273?tn*(7.5625*(Gt-=.5454545454545454)*Gt+.75)+on:Gt<.9090909090909091?tn*(7.5625*(Gt-=.8181818181818182)*Gt+.9375)+on:tn*(7.5625*(Gt-=.9545454545454546)*Gt+.984375)+on}function ln(Gt,on,tn,_i){return Gt<_i/2?Kt(Gt*2,0,tn,_i)*.5+on:Pt(Gt*2-_i,0,tn,_i)*.5+tn*.5+on}at.util.ease={easeInQuad:function(Gt,on,tn,_i){return tn*(Gt/=_i)*Gt+on},easeOutQuad:function(Gt,on,tn,_i){return-tn*(Gt/=_i)*(Gt-2)+on},easeInOutQuad:function(Gt,on,tn,_i){return Gt/=_i/2,Gt<1?tn/2*Gt*Gt+on:-tn/2*(--Gt*(Gt-2)-1)+on},easeInCubic:function(Gt,on,tn,_i){return tn*(Gt/=_i)*Gt*Gt+on},easeOutCubic:pt,easeInOutCubic:At,easeInQuart:gt,easeOutQuart:vt,easeInOutQuart:yt,easeInQuint:bt,easeOutQuint:Ct,easeInOutQuint:xt,easeInSine:It,easeOutSine:St,easeInOutSine:Ot,easeInExpo:Mt,easeOutExpo:jt,easeInOutExpo:Ft,easeInCirc:Ut,easeOutCirc:Qt,easeInOutCirc:Ht,easeInElastic:Zt,easeOutElastic:Wt,easeInOutElastic:$t,easeInBack:Jt,easeOutBack:Nt,easeInOutBack:Lt,easeInBounce:Kt,easeOutBounce:Pt,easeInOutBounce:ln}}(),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.extend,At=ut.util.object.clone,gt=ut.util.toFixed,vt=ut.util.parseUnit,yt=ut.util.multiplyTransformMatrices,bt=["path","circle","polygon","polyline","ellipse","rect","line","image","text"],Ct=["symbol","image","marker","pattern","view","svg"],xt=["pattern","defs","symbol","metadata","clipPath","mask","desc"],It=["symbol","g","a","svg","clipPath","defs"],St={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing"},Ot={stroke:"strokeOpacity",fill:"fillOpacity"},Mt="font-size",jt="clip-path";ut.svgValidTagNamesRegEx=Qt(bt),ut.svgViewBoxElementsRegEx=Qt(Ct),ut.svgInvalidAncestorsRegEx=Qt(xt),ut.svgValidParentsRegEx=Qt(It),ut.cssRules={},ut.gradientDefs={},ut.clipPaths={};function Ft(Vt){return Vt in St?St[Vt]:Vt}function Ut(Vt,qt,rn,nn){var cn=Object.prototype.toString.call(qt)==="[object Array]",un;if((Vt==="fill"||Vt==="stroke")&&qt==="none")qt="";else{if(Vt==="strokeUniform")return qt==="non-scaling-stroke";if(Vt==="strokeDashArray")qt==="none"?qt=null:qt=qt.replace(/,/g," ").split(/\s+/).map(parseFloat);else if(Vt==="transformMatrix")rn&&rn.transformMatrix?qt=yt(rn.transformMatrix,ut.parseTransformAttribute(qt)):qt=ut.parseTransformAttribute(qt);else if(Vt==="visible")qt=qt!=="none"&&qt!=="hidden",rn&&rn.visible===!1&&(qt=!1);else if(Vt==="opacity")qt=parseFloat(qt),rn&&typeof rn.opacity!="undefined"&&(qt*=rn.opacity);else if(Vt==="textAnchor")qt=qt==="start"?"left":qt==="end"?"right":"center";else if(Vt==="charSpacing")un=vt(qt,nn)/nn*1e3;else if(Vt==="paintFirst"){var gn=qt.indexOf("fill"),mn=qt.indexOf("stroke"),qt="fill";(gn>-1&&mn>-1&&mn<gn||gn===-1&&mn>-1)&&(qt="stroke")}else{if(Vt==="href"||Vt==="xlink:href"||Vt==="font")return qt;if(Vt==="imageSmoothing")return qt==="optimizeQuality";un=cn?qt.map(vt):vt(qt,nn)}}return!cn&&isNaN(un)?qt:un}function Qt(Vt){return new RegExp("^("+Vt.join("|")+")\\b","i")}function Ht(Vt){for(var qt in Ot)if(!(typeof Vt[Ot[qt]]=="undefined"||Vt[qt]==="")){if(typeof Vt[qt]=="undefined"){if(!ut.Object.prototype[qt])continue;Vt[qt]=ut.Object.prototype[qt]}if(Vt[qt].indexOf("url(")!==0){var rn=new ut.Color(Vt[qt]);Vt[qt]=rn.setAlpha(gt(rn.getAlpha()*Vt[Ot[qt]],2)).toRgba()}}return Vt}function Zt(Vt,qt){var rn,nn=[],cn,un,gn;for(un=0,gn=qt.length;un<gn;un++)rn=qt[un],cn=Vt.getElementsByTagName(rn),nn=nn.concat(Array.prototype.slice.call(cn));return nn}ut.parseTransformAttribute=function(){function Vt(In,zn){var Tn=ut.util.cos(zn[0]),tr=ut.util.sin(zn[0]),Qn=0,Bn=0;zn.length===3&&(Qn=zn[1],Bn=zn[2]),In[0]=Tn,In[1]=tr,In[2]=-tr,In[3]=Tn,In[4]=Qn-(Tn*Qn-tr*Bn),In[5]=Bn-(tr*Qn+Tn*Bn)}function qt(In,zn){var Tn=zn[0],tr=zn.length===2?zn[1]:zn[0];In[0]=Tn,In[3]=tr}function rn(In,zn,Tn){In[Tn]=Math.tan(ut.util.degreesToRadians(zn[0]))}function nn(In,zn){In[4]=zn[0],zn.length===2&&(In[5]=zn[1])}var cn=ut.iMatrix,un=ut.reNum,gn=ut.commaWsp,mn="(?:(skewX)\\s*\\(\\s*("+un+")\\s*\\))",dn="(?:(skewY)\\s*\\(\\s*("+un+")\\s*\\))",fn="(?:(rotate)\\s*\\(\\s*("+un+")(?:"+gn+"("+un+")"+gn+"("+un+"))?\\s*\\))",sn="(?:(scale)\\s*\\(\\s*("+un+")(?:"+gn+"("+un+"))?\\s*\\))",pn="(?:(translate)\\s*\\(\\s*("+un+")(?:"+gn+"("+un+"))?\\s*\\))",bn="(?:(matrix)\\s*\\(\\s*("+un+")"+gn+"("+un+")"+gn+"("+un+")"+gn+"("+un+")"+gn+"("+un+")"+gn+"("+un+")\\s*\\))",An="(?:"+bn+"|"+pn+"|"+sn+"|"+fn+"|"+mn+"|"+dn+")",Sn="(?:"+An+"(?:"+gn+"*"+An+")*)",En="^\\s*(?:"+Sn+"?)\\s*$",Vn=new RegExp(En),Rn=new RegExp(An,"g");return function(In){var zn=cn.concat(),Tn=[];if(!In||In&&!Vn.test(In))return zn;In.replace(Rn,function(Qn){var Bn=new RegExp(An).exec(Qn).filter(function(qn){return!!qn}),xn=Bn[1],Wn=Bn.slice(2).map(parseFloat);switch(xn){case"translate":nn(zn,Wn);break;case"rotate":Wn[0]=ut.util.degreesToRadians(Wn[0]),Vt(zn,Wn);break;case"scale":qt(zn,Wn);break;case"skewX":rn(zn,Wn,2);break;case"skewY":rn(zn,Wn,1);break;case"matrix":zn=Wn;break}Tn.push(zn.concat()),zn=cn.concat()});for(var tr=Tn[0];Tn.length>1;)Tn.shift(),tr=ut.util.multiplyTransformMatrices(tr,Tn[0]);return tr}}();function Wt(Vt,qt){var rn,nn;Vt.replace(/;\s*$/,"").split(";").forEach(function(cn){var un=cn.split(":");rn=un[0].trim().toLowerCase(),nn=un[1].trim(),qt[rn]=nn})}function $t(Vt,qt){var rn,nn;for(var cn in Vt)typeof Vt[cn]!="undefined"&&(rn=cn.toLowerCase(),nn=Vt[cn],qt[rn]=nn)}function Jt(Vt,qt){var rn={};for(var nn in ut.cssRules[qt])if(Nt(Vt,nn.split(" ")))for(var cn in ut.cssRules[qt][nn])rn[cn]=ut.cssRules[qt][nn][cn];return rn}function Nt(Vt,qt){var rn,nn=!0;return rn=Kt(Vt,qt.pop()),rn&&qt.length&&(nn=Lt(Vt,qt)),rn&&nn&&qt.length===0}function Lt(Vt,qt){for(var rn,nn=!0;Vt.parentNode&&Vt.parentNode.nodeType===1&&qt.length;)nn&&(rn=qt.pop()),Vt=Vt.parentNode,nn=Kt(Vt,rn);return qt.length===0}function Kt(Vt,qt){var rn=Vt.nodeName,nn=Vt.getAttribute("class"),cn=Vt.getAttribute("id"),un,gn;if(un=new RegExp("^"+rn,"i"),qt=qt.replace(un,""),cn&&qt.length&&(un=new RegExp("#"+cn+"(?![a-zA-Z\\-]+)","i"),qt=qt.replace(un,"")),nn&&qt.length)for(nn=nn.split(" "),gn=nn.length;gn--;)un=new RegExp("\\."+nn[gn]+"(?![a-zA-Z\\-]+)","i"),qt=qt.replace(un,"");return qt.length===0}function Pt(Vt,qt){var rn;if(Vt.getElementById&&(rn=Vt.getElementById(qt)),rn)return rn;var nn,cn,un,gn=Vt.getElementsByTagName("*");for(cn=0,un=gn.length;cn<un;cn++)if(nn=gn[cn],qt===nn.getAttribute("id"))return nn}function ln(Vt){for(var qt=Zt(Vt,["use","svg:use"]),rn=0;qt.length&&rn<qt.length;){var nn=qt[rn],cn=nn.getAttribute("xlink:href")||nn.getAttribute("href");if(cn===null)return;var un=cn.substr(1),gn=nn.getAttribute("x")||0,mn=nn.getAttribute("y")||0,dn=Pt(Vt,un).cloneNode(!0),fn=(dn.getAttribute("transform")||"")+" translate("+gn+", "+mn+")",sn,pn=qt.length,bn,An,Sn,En,Vn=ut.svgNS;if(on(dn),/^svg$/i.test(dn.nodeName)){var Rn=dn.ownerDocument.createElementNS(Vn,"g");for(An=0,Sn=dn.attributes,En=Sn.length;An<En;An++)bn=Sn.item(An),Rn.setAttributeNS(Vn,bn.nodeName,bn.nodeValue);for(;dn.firstChild;)Rn.appendChild(dn.firstChild);dn=Rn}for(An=0,Sn=nn.attributes,En=Sn.length;An<En;An++)bn=Sn.item(An),!(bn.nodeName==="x"||bn.nodeName==="y"||bn.nodeName==="xlink:href"||bn.nodeName==="href")&&(bn.nodeName==="transform"?fn=bn.nodeValue+" "+fn:dn.setAttribute(bn.nodeName,bn.nodeValue));dn.setAttribute("transform",fn),dn.setAttribute("instantiated_by_use","1"),dn.removeAttribute("id"),sn=nn.parentNode,sn.replaceChild(dn,nn),qt.length===pn&&rn++}}var Gt=new RegExp("^\\s*("+ut.reNum+"+)\\s*,?\\s*("+ut.reNum+"+)\\s*,?\\s*("+ut.reNum+"+)\\s*,?\\s*("+ut.reNum+"+)\\s*$");function on(Vt){if(!ut.svgViewBoxElementsRegEx.test(Vt.nodeName))return{};var qt=Vt.getAttribute("viewBox"),rn=1,nn=1,cn=0,un=0,gn,mn,dn,fn,sn=Vt.getAttribute("width"),pn=Vt.getAttribute("height"),bn=Vt.getAttribute("x")||0,An=Vt.getAttribute("y")||0,Sn=Vt.getAttribute("preserveAspectRatio")||"",En=!qt||!(qt=qt.match(Gt)),Vn=!sn||!pn||sn==="100%"||pn==="100%",Rn=En&&Vn,In={},zn="",Tn=0,tr=0;if(In.width=0,In.height=0,In.toBeParsed=Rn,En&&(bn||An)&&Vt.parentNode&&Vt.parentNode.nodeName!=="#document"&&(zn=" translate("+vt(bn)+" "+vt(An)+") ",dn=(Vt.getAttribute("transform")||"")+zn,Vt.setAttribute("transform",dn),Vt.removeAttribute("x"),Vt.removeAttribute("y")),Rn)return In;if(En)return In.width=vt(sn),In.height=vt(pn),In;if(cn=-parseFloat(qt[1]),un=-parseFloat(qt[2]),gn=parseFloat(qt[3]),mn=parseFloat(qt[4]),In.minX=cn,In.minY=un,In.viewBoxWidth=gn,In.viewBoxHeight=mn,Vn?(In.width=gn,In.height=mn):(In.width=vt(sn),In.height=vt(pn),rn=In.width/gn,nn=In.height/mn),Sn=ut.util.parsePreserveAspectRatioAttribute(Sn),Sn.alignX!=="none"&&(Sn.meetOrSlice==="meet"&&(nn=rn=rn>nn?nn:rn),Sn.meetOrSlice==="slice"&&(nn=rn=rn>nn?rn:nn),Tn=In.width-gn*rn,tr=In.height-mn*rn,Sn.alignX==="Mid"&&(Tn/=2),Sn.alignY==="Mid"&&(tr/=2),Sn.alignX==="Min"&&(Tn=0),Sn.alignY==="Min"&&(tr=0)),rn===1&&nn===1&&cn===0&&un===0&&bn===0&&An===0)return In;if((bn||An)&&Vt.parentNode.nodeName!=="#document"&&(zn=" translate("+vt(bn)+" "+vt(An)+") "),dn=zn+" matrix("+rn+" 0 0 "+nn+" "+(cn*rn+Tn)+" "+(un*nn+tr)+") ",Vt.nodeName==="svg"){for(fn=Vt.ownerDocument.createElementNS(ut.svgNS,"g");Vt.firstChild;)fn.appendChild(Vt.firstChild);Vt.appendChild(fn)}else fn=Vt,fn.removeAttribute("x"),fn.removeAttribute("y"),dn=fn.getAttribute("transform")+dn;return fn.setAttribute("transform",dn),In}function tn(Vt,qt){for(;Vt&&(Vt=Vt.parentNode);)if(Vt.nodeName&&qt.test(Vt.nodeName.replace("svg:",""))&&!Vt.getAttribute("instantiated_by_use"))return!0;return!1}ut.parseSVGDocument=function(Vt,qt,rn,nn){if(!!Vt){ln(Vt);var cn=ut.Object.__uid++,un,gn,mn=on(Vt),dn=ut.util.toArray(Vt.getElementsByTagName("*"));if(mn.crossOrigin=nn&&nn.crossOrigin,mn.svgUid=cn,dn.length===0&&ut.isLikelyNode){dn=Vt.selectNodes('//*[name(.)!="svg"]');var fn=[];for(un=0,gn=dn.length;un<gn;un++)fn[un]=dn[un];dn=fn}var sn=dn.filter(function(bn){return on(bn),ut.svgValidTagNamesRegEx.test(bn.nodeName.replace("svg:",""))&&!tn(bn,ut.svgInvalidAncestorsRegEx)});if(!sn||sn&&!sn.length){qt&&qt([],{});return}var pn={};dn.filter(function(bn){return bn.nodeName.replace("svg:","")==="clipPath"}).forEach(function(bn){var An=bn.getAttribute("id");pn[An]=ut.util.toArray(bn.getElementsByTagName("*")).filter(function(Sn){return ut.svgValidTagNamesRegEx.test(Sn.nodeName.replace("svg:",""))})}),ut.gradientDefs[cn]=ut.getGradientDefs(Vt),ut.cssRules[cn]=ut.getCSSRules(Vt),ut.clipPaths[cn]=pn,ut.parseElements(sn,function(bn,An){qt&&(qt(bn,mn,An,dn),delete ut.gradientDefs[cn],delete ut.cssRules[cn],delete ut.clipPaths[cn])},At(mn),rn,nn)}};function _i(Vt,qt){var rn=["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"],nn="xlink:href",cn=qt.getAttribute(nn).substr(1),un=Pt(Vt,cn);if(un&&un.getAttribute(nn)&&_i(Vt,un),rn.forEach(function(mn){un&&!qt.hasAttribute(mn)&&un.hasAttribute(mn)&&qt.setAttribute(mn,un.getAttribute(mn))}),!qt.children.length)for(var gn=un.cloneNode(!0);gn.firstChild;)qt.appendChild(gn.firstChild);qt.removeAttribute(nn)}var Xt=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+ut.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+ut.reNum+"))?\\s+(.*)");pt(ut,{parseFontDeclaration:function(Vt,qt){var rn=Vt.match(Xt);if(!!rn){var nn=rn[1],cn=rn[3],un=rn[4],gn=rn[5],mn=rn[6];nn&&(qt.fontStyle=nn),cn&&(qt.fontWeight=isNaN(parseFloat(cn))?cn:parseFloat(cn)),un&&(qt.fontSize=vt(un)),mn&&(qt.fontFamily=mn),gn&&(qt.lineHeight=gn==="normal"?1:gn)}},getGradientDefs:function(Vt){var qt=["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"],rn=Zt(Vt,qt),nn,cn=0,un={};for(cn=rn.length;cn--;)nn=rn[cn],nn.getAttribute("xlink:href")&&_i(Vt,nn),un[nn.getAttribute("id")]=nn;return un},parseAttributes:function(Vt,qt,rn){if(!!Vt){var nn,cn={},un,gn;typeof rn=="undefined"&&(rn=Vt.getAttribute("svgUid")),Vt.parentNode&&ut.svgValidParentsRegEx.test(Vt.parentNode.nodeName)&&(cn=ut.parseAttributes(Vt.parentNode,qt,rn));var mn=qt.reduce(function(Sn,En){return nn=Vt.getAttribute(En),nn&&(Sn[En]=nn),Sn},{}),dn=pt(Jt(Vt,rn),ut.parseStyleAttribute(Vt));mn=pt(mn,dn),dn[jt]&&Vt.setAttribute(jt,dn[jt]),un=gn=cn.fontSize||ut.Text.DEFAULT_SVG_FONT_SIZE,mn[Mt]&&(mn[Mt]=un=vt(mn[Mt],gn));var fn,sn,pn={};for(var bn in mn)fn=Ft(bn),sn=Ut(fn,mn[bn],cn,un),pn[fn]=sn;pn&&pn.font&&ut.parseFontDeclaration(pn.font,pn);var An=pt(cn,pn);return ut.svgValidParentsRegEx.test(Vt.nodeName)?An:Ht(An)}},parseElements:function(Vt,qt,rn,nn,cn){new ut.ElementsParser(Vt,qt,rn,nn,cn).parse()},parseStyleAttribute:function(Vt){var qt={},rn=Vt.getAttribute("style");return rn&&(typeof rn=="string"?Wt(rn,qt):$t(rn,qt)),qt},parsePointsAttribute:function(Vt){if(!Vt)return null;Vt=Vt.replace(/,/g," ").trim(),Vt=Vt.split(/\s+/);var qt=[],rn,nn;for(rn=0,nn=Vt.length;rn<nn;rn+=2)qt.push({x:parseFloat(Vt[rn]),y:parseFloat(Vt[rn+1])});return qt},getCSSRules:function(Vt){var qt=Vt.getElementsByTagName("style"),rn,nn,cn={},un;for(rn=0,nn=qt.length;rn<nn;rn++){var gn=qt[rn].textContent;gn=gn.replace(/\/\*[\s\S]*?\*\//g,""),gn.trim()!==""&&(un=gn.match(/[^{]*\{[\s\S]*?\}/g),un=un.map(function(mn){return mn.trim()}),un.forEach(function(mn){var dn=mn.match(/([\s\S]*?)\s*\{([^}]*)\}/),fn={},sn=dn[2].trim(),pn=sn.replace(/;$/,"").split(/\s*;\s*/);for(rn=0,nn=pn.length;rn<nn;rn++){var bn=pn[rn].split(/\s*:\s*/),An=bn[0],Sn=bn[1];fn[An]=Sn}mn=dn[1],mn.split(",").forEach(function(En){En=En.replace(/^svg/i,"").trim(),En!==""&&(cn[En]?ut.util.object.extend(cn[En],fn):cn[En]=ut.util.object.clone(fn))})}))}return cn},loadSVGFromURL:function(Vt,qt,rn,nn){Vt=Vt.replace(/^\n\s*/,"").trim(),new ut.util.request(Vt,{method:"get",onComplete:cn});function cn(un){var gn=un.responseXML;if(!gn||!gn.documentElement)return qt&&qt(null),!1;ut.parseSVGDocument(gn.documentElement,function(mn,dn,fn,sn){qt&&qt(mn,dn,fn,sn)},rn,nn)}},loadSVGFromString:function(Vt,qt,rn,nn){var cn=new ut.window.DOMParser,un=cn.parseFromString(Vt.trim(),"text/xml");ut.parseSVGDocument(un.documentElement,function(gn,mn,dn,fn){qt(gn,mn,dn,fn)},rn,nn)}})}(ot),at.ElementsParser=function(ft,ut,pt,At,gt,vt){this.elements=ft,this.callback=ut,this.options=pt,this.reviver=At,this.svgUid=pt&&pt.svgUid||0,this.parsingOptions=gt,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=vt},function(ft){ft.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},ft.createObjects=function(){var ut=this;this.elements.forEach(function(pt,At){pt.setAttribute("svgUid",ut.svgUid),ut.createObject(pt,At)})},ft.findTag=function(ut){return at[at.util.string.capitalize(ut.tagName.replace("svg:",""))]},ft.createObject=function(ut,pt){var At=this.findTag(ut);if(At&&At.fromElement)try{At.fromElement(ut,this.createCallback(pt,ut),this.options)}catch(gt){at.log(gt)}else this.checkIfDone()},ft.createCallback=function(ut,pt){var At=this;return function(gt){var vt;At.resolveGradient(gt,pt,"fill"),At.resolveGradient(gt,pt,"stroke"),gt instanceof at.Image&&gt._originalElement&&(vt=gt.parsePreserveAspectRatioAttribute(pt)),gt._removeTransformMatrix(vt),At.resolveClipPath(gt,pt),At.reviver&&At.reviver(pt,gt),At.instances[ut]=gt,At.checkIfDone()}},ft.extractPropertyDefinition=function(ut,pt,At){var gt=ut[pt],vt=this.regexUrl;if(!!vt.test(gt)){vt.lastIndex=0;var yt=vt.exec(gt)[1];return vt.lastIndex=0,at[At][this.svgUid][yt]}},ft.resolveGradient=function(ut,pt,At){var gt=this.extractPropertyDefinition(ut,At,"gradientDefs");if(gt){var vt=pt.getAttribute(At+"-opacity"),yt=at.Gradient.fromElement(gt,ut,vt,this.options);ut.set(At,yt)}},ft.createClipPathCallback=function(ut,pt){return function(At){At._removeTransformMatrix(),At.fillRule=At.clipRule,pt.push(At)}},ft.resolveClipPath=function(ut,pt){var At=this.extractPropertyDefinition(ut,"clipPath","clipPaths"),gt,vt,yt,bt,Ct,xt;if(At){bt=[],yt=at.util.invertTransform(ut.calcTransformMatrix());for(var It=At[0].parentNode,St=pt;St.parentNode&&St.getAttribute("clip-path")!==ut.clipPath;)St=St.parentNode;St.parentNode.appendChild(It);for(var Ot=0;Ot<At.length;Ot++)gt=At[Ot],vt=this.findTag(gt),vt.fromElement(gt,this.createClipPathCallback(ut,bt),this.options);bt.length===1?At=bt[0]:At=new at.Group(bt),Ct=at.util.multiplyTransformMatrices(yt,At.calcTransformMatrix()),At.clipPath&&this.resolveClipPath(At,St);var xt=at.util.qrDecompose(Ct);At.flipX=!1,At.flipY=!1,At.set("scaleX",xt.scaleX),At.set("scaleY",xt.scaleY),At.angle=xt.angle,At.skewX=xt.skewX,At.skewY=0,At.setPositionByOrigin({x:xt.translateX,y:xt.translateY},"center","center"),ut.clipPath=At}else delete ut.clipPath},ft.checkIfDone=function(){--this.numElements===0&&(this.instances=this.instances.filter(function(ut){return ut!=null}),this.callback(this.instances,this.elements))}}(at.ElementsParser.prototype),function(ft){var ut=ft.fabric||(ft.fabric={});if(ut.Point){ut.warn("fabric.Point is already defined");return}ut.Point=pt;function pt(At,gt){this.x=At,this.y=gt}pt.prototype={type:"point",constructor:pt,add:function(At){return new pt(this.x+At.x,this.y+At.y)},addEquals:function(At){return this.x+=At.x,this.y+=At.y,this},scalarAdd:function(At){return new pt(this.x+At,this.y+At)},scalarAddEquals:function(At){return this.x+=At,this.y+=At,this},subtract:function(At){return new pt(this.x-At.x,this.y-At.y)},subtractEquals:function(At){return this.x-=At.x,this.y-=At.y,this},scalarSubtract:function(At){return new pt(this.x-At,this.y-At)},scalarSubtractEquals:function(At){return this.x-=At,this.y-=At,this},multiply:function(At){return new pt(this.x*At,this.y*At)},multiplyEquals:function(At){return this.x*=At,this.y*=At,this},divide:function(At){return new pt(this.x/At,this.y/At)},divideEquals:function(At){return this.x/=At,this.y/=At,this},eq:function(At){return this.x===At.x&&this.y===At.y},lt:function(At){return this.x<At.x&&this.y<At.y},lte:function(At){return this.x<=At.x&&this.y<=At.y},gt:function(At){return this.x>At.x&&this.y>At.y},gte:function(At){return this.x>=At.x&&this.y>=At.y},lerp:function(At,gt){return typeof gt=="undefined"&&(gt=.5),gt=Math.max(Math.min(1,gt),0),new pt(this.x+(At.x-this.x)*gt,this.y+(At.y-this.y)*gt)},distanceFrom:function(At){var gt=this.x-At.x,vt=this.y-At.y;return Math.sqrt(gt*gt+vt*vt)},midPointFrom:function(At){return this.lerp(At)},min:function(At){return new pt(Math.min(this.x,At.x),Math.min(this.y,At.y))},max:function(At){return new pt(Math.max(this.x,At.x),Math.max(this.y,At.y))},toString:function(){return this.x+","+this.y},setXY:function(At,gt){return this.x=At,this.y=gt,this},setX:function(At){return this.x=At,this},setY:function(At){return this.y=At,this},setFromPoint:function(At){return this.x=At.x,this.y=At.y,this},swap:function(At){var gt=this.x,vt=this.y;this.x=At.x,this.y=At.y,At.x=gt,At.y=vt},clone:function(){return new pt(this.x,this.y)}}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={});if(ut.Intersection){ut.warn("fabric.Intersection is already defined");return}function pt(At){this.status=At,this.points=[]}ut.Intersection=pt,ut.Intersection.prototype={constructor:pt,appendPoint:function(At){return this.points.push(At),this},appendPoints:function(At){return this.points=this.points.concat(At),this}},ut.Intersection.intersectLineLine=function(At,gt,vt,yt){var bt,Ct=(yt.x-vt.x)*(At.y-vt.y)-(yt.y-vt.y)*(At.x-vt.x),xt=(gt.x-At.x)*(At.y-vt.y)-(gt.y-At.y)*(At.x-vt.x),It=(yt.y-vt.y)*(gt.x-At.x)-(yt.x-vt.x)*(gt.y-At.y);if(It!==0){var St=Ct/It,Ot=xt/It;0<=St&&St<=1&&0<=Ot&&Ot<=1?(bt=new pt("Intersection"),bt.appendPoint(new ut.Point(At.x+St*(gt.x-At.x),At.y+St*(gt.y-At.y)))):bt=new pt}else Ct===0||xt===0?bt=new pt("Coincident"):bt=new pt("Parallel");return bt},ut.Intersection.intersectLinePolygon=function(At,gt,vt){var yt=new pt,bt=vt.length,Ct,xt,It,St;for(St=0;St<bt;St++)Ct=vt[St],xt=vt[(St+1)%bt],It=pt.intersectLineLine(At,gt,Ct,xt),yt.appendPoints(It.points);return yt.points.length>0&&(yt.status="Intersection"),yt},ut.Intersection.intersectPolygonPolygon=function(At,gt){var vt=new pt,yt=At.length,bt;for(bt=0;bt<yt;bt++){var Ct=At[bt],xt=At[(bt+1)%yt],It=pt.intersectLinePolygon(Ct,xt,gt);vt.appendPoints(It.points)}return vt.points.length>0&&(vt.status="Intersection"),vt},ut.Intersection.intersectPolygonRectangle=function(At,gt,vt){var yt=gt.min(vt),bt=gt.max(vt),Ct=new ut.Point(bt.x,yt.y),xt=new ut.Point(yt.x,bt.y),It=pt.intersectLinePolygon(yt,Ct,At),St=pt.intersectLinePolygon(Ct,bt,At),Ot=pt.intersectLinePolygon(bt,xt,At),Mt=pt.intersectLinePolygon(xt,yt,At),jt=new pt;return jt.appendPoints(It.points),jt.appendPoints(St.points),jt.appendPoints(Ot.points),jt.appendPoints(Mt.points),jt.points.length>0&&(jt.status="Intersection"),jt}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={});if(ut.Color){ut.warn("fabric.Color is already defined.");return}function pt(gt){gt?this._tryParsingColor(gt):this.setSource([0,0,0,1])}ut.Color=pt,ut.Color.prototype={_tryParsingColor:function(gt){var vt;gt in pt.colorNameMap&&(gt=pt.colorNameMap[gt]),gt==="transparent"&&(vt=[255,255,255,0]),vt||(vt=pt.sourceFromHex(gt)),vt||(vt=pt.sourceFromRgb(gt)),vt||(vt=pt.sourceFromHsl(gt)),vt||(vt=[0,0,0,1]),vt&&this.setSource(vt)},_rgbToHsl:function(gt,vt,yt){gt/=255,vt/=255,yt/=255;var bt,Ct,xt,It=ut.util.array.max([gt,vt,yt]),St=ut.util.array.min([gt,vt,yt]);if(xt=(It+St)/2,It===St)bt=Ct=0;else{var Ot=It-St;switch(Ct=xt>.5?Ot/(2-It-St):Ot/(It+St),It){case gt:bt=(vt-yt)/Ot+(vt<yt?6:0);break;case vt:bt=(yt-gt)/Ot+2;break;case yt:bt=(gt-vt)/Ot+4;break}bt/=6}return[Math.round(bt*360),Math.round(Ct*100),Math.round(xt*100)]},getSource:function(){return this._source},setSource:function(gt){this._source=gt},toRgb:function(){var gt=this.getSource();return"rgb("+gt[0]+","+gt[1]+","+gt[2]+")"},toRgba:function(){var gt=this.getSource();return"rgba("+gt[0]+","+gt[1]+","+gt[2]+","+gt[3]+")"},toHsl:function(){var gt=this.getSource(),vt=this._rgbToHsl(gt[0],gt[1],gt[2]);return"hsl("+vt[0]+","+vt[1]+"%,"+vt[2]+"%)"},toHsla:function(){var gt=this.getSource(),vt=this._rgbToHsl(gt[0],gt[1],gt[2]);return"hsla("+vt[0]+","+vt[1]+"%,"+vt[2]+"%,"+gt[3]+")"},toHex:function(){var gt=this.getSource(),vt,yt,bt;return vt=gt[0].toString(16),vt=vt.length===1?"0"+vt:vt,yt=gt[1].toString(16),yt=yt.length===1?"0"+yt:yt,bt=gt[2].toString(16),bt=bt.length===1?"0"+bt:bt,vt.toUpperCase()+yt.toUpperCase()+bt.toUpperCase()},toHexa:function(){var gt=this.getSource(),vt;return vt=Math.round(gt[3]*255),vt=vt.toString(16),vt=vt.length===1?"0"+vt:vt,this.toHex()+vt.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(gt){var vt=this.getSource();return vt[3]=gt,this.setSource(vt),this},toGrayscale:function(){var gt=this.getSource(),vt=parseInt((gt[0]*.3+gt[1]*.59+gt[2]*.11).toFixed(0),10),yt=gt[3];return this.setSource([vt,vt,vt,yt]),this},toBlackWhite:function(gt){var vt=this.getSource(),yt=(vt[0]*.3+vt[1]*.59+vt[2]*.11).toFixed(0),bt=vt[3];return gt=gt||127,yt=Number(yt)<Number(gt)?0:255,this.setSource([yt,yt,yt,bt]),this},overlayWith:function(gt){gt instanceof pt||(gt=new pt(gt));var vt=[],yt=this.getAlpha(),bt=.5,Ct=this.getSource(),xt=gt.getSource(),It;for(It=0;It<3;It++)vt.push(Math.round(Ct[It]*(1-bt)+xt[It]*bt));return vt[3]=yt,this.setSource(vt),this}},ut.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i,ut.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,ut.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,ut.Color.colorNameMap={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"};function At(gt,vt,yt){return yt<0&&(yt+=1),yt>1&&(yt-=1),yt<.16666666666666666?gt+(vt-gt)*6*yt:yt<.5?vt:yt<.6666666666666666?gt+(vt-gt)*(.6666666666666666-yt)*6:gt}ut.Color.fromRgb=function(gt){return pt.fromSource(pt.sourceFromRgb(gt))},ut.Color.sourceFromRgb=function(gt){var vt=gt.match(pt.reRGBa);if(vt){var yt=parseInt(vt[1],10)/(/%$/.test(vt[1])?100:1)*(/%$/.test(vt[1])?255:1),bt=parseInt(vt[2],10)/(/%$/.test(vt[2])?100:1)*(/%$/.test(vt[2])?255:1),Ct=parseInt(vt[3],10)/(/%$/.test(vt[3])?100:1)*(/%$/.test(vt[3])?255:1);return[parseInt(yt,10),parseInt(bt,10),parseInt(Ct,10),vt[4]?parseFloat(vt[4]):1]}},ut.Color.fromRgba=pt.fromRgb,ut.Color.fromHsl=function(gt){return pt.fromSource(pt.sourceFromHsl(gt))},ut.Color.sourceFromHsl=function(gt){var vt=gt.match(pt.reHSLa);if(!!vt){var yt=(parseFloat(vt[1])%360+360)%360/360,bt=parseFloat(vt[2])/(/%$/.test(vt[2])?100:1),Ct=parseFloat(vt[3])/(/%$/.test(vt[3])?100:1),xt,It,St;if(bt===0)xt=It=St=Ct;else{var Ot=Ct<=.5?Ct*(bt+1):Ct+bt-Ct*bt,Mt=Ct*2-Ot;xt=At(Mt,Ot,yt+.3333333333333333),It=At(Mt,Ot,yt),St=At(Mt,Ot,yt-.3333333333333333)}return[Math.round(xt*255),Math.round(It*255),Math.round(St*255),vt[4]?parseFloat(vt[4]):1]}},ut.Color.fromHsla=pt.fromHsl,ut.Color.fromHex=function(gt){return pt.fromSource(pt.sourceFromHex(gt))},ut.Color.sourceFromHex=function(gt){if(gt.match(pt.reHex)){var vt=gt.slice(gt.indexOf("#")+1),yt=vt.length===3||vt.length===4,bt=vt.length===8||vt.length===4,Ct=yt?vt.charAt(0)+vt.charAt(0):vt.substring(0,2),xt=yt?vt.charAt(1)+vt.charAt(1):vt.substring(2,4),It=yt?vt.charAt(2)+vt.charAt(2):vt.substring(4,6),St=bt?yt?vt.charAt(3)+vt.charAt(3):vt.substring(6,8):"FF";return[parseInt(Ct,16),parseInt(xt,16),parseInt(It,16),parseFloat((parseInt(St,16)/255).toFixed(2))]}},ut.Color.fromSource=function(gt){var vt=new pt;return vt.setSource(gt),vt}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=["e","se","s","sw","w","nw","n","ne","e"],At=["ns","nesw","ew","nwse"],gt={},vt="left",yt="top",bt="right",Ct="bottom",xt="center",It={top:Ct,bottom:yt,left:bt,right:vt,center:xt},St=ut.util.radiansToDegrees,Ot=Math.sign||function(fn){return(fn>0)-(fn<0)||+fn};function Mt(fn,sn){var pn=fn.angle+St(Math.atan2(sn.y,sn.x))+360;return Math.round(pn%360/45)}function jt(fn,sn){var pn=sn.transform.target,bn=pn.canvas,An=ut.util.object.clone(sn);An.target=pn,bn&&bn.fire("object:"+fn,An),pn.fire(fn,sn)}function Ft(fn,sn){var pn=sn.canvas,bn=pn.uniScaleKey,An=fn[bn];return pn.uniformScaling&&!An||!pn.uniformScaling&&An}function Ut(fn){return fn.originX===xt&&fn.originY===xt}function Qt(fn,sn,pn){var bn=fn.lockScalingX,An=fn.lockScalingY;return!!(bn&&An||!sn&&(bn||An)&&pn||bn&&sn==="x"||An&&sn==="y")}function Ht(fn,sn,pn){var bn="not-allowed",An=Ft(fn,pn),Sn="";if(sn.x!==0&&sn.y===0?Sn="x":sn.x===0&&sn.y!==0&&(Sn="y"),Qt(pn,Sn,An))return bn;var En=Mt(pn,sn);return pt[En]+"-resize"}function Zt(fn,sn,pn){var bn="not-allowed";if(sn.x!==0&&pn.lockSkewingY||sn.y!==0&&pn.lockSkewingX)return bn;var An=Mt(pn,sn)%4;return At[An]+"-resize"}function Wt(fn,sn,pn){return fn[pn.canvas.altActionKey]?gt.skewCursorStyleHandler(fn,sn,pn):gt.scaleCursorStyleHandler(fn,sn,pn)}function $t(fn,sn,pn){var bn=fn[pn.canvas.altActionKey];if(sn.x===0)return bn?"skewX":"scaleY";if(sn.y===0)return bn?"skewY":"scaleX"}function Jt(fn,sn,pn){return pn.lockRotation?"not-allowed":sn.cursorStyle}function Nt(fn,sn,pn,bn){return{e:fn,transform:sn,pointer:{x:pn,y:bn}}}function Lt(fn){return function(sn,pn,bn,An){var Sn=pn.target,En=Sn.getCenterPoint(),Vn=Sn.translateToOriginPoint(En,pn.originX,pn.originY),Rn=fn(sn,pn,bn,An);return Sn.setPositionByOrigin(Vn,pn.originX,pn.originY),Rn}}function Kt(fn,sn){return function(pn,bn,An,Sn){var En=sn(pn,bn,An,Sn);return En&&jt(fn,Nt(pn,bn,An,Sn)),En}}function Pt(fn,sn,pn,bn,An){var Sn=fn.target,En=Sn.controls[fn.corner],Vn=Sn.canvas.getZoom(),Rn=Sn.padding/Vn,In=Sn.toLocalPoint(new ut.Point(bn,An),sn,pn);return In.x>=Rn&&(In.x-=Rn),In.x<=-Rn&&(In.x+=Rn),In.y>=Rn&&(In.y-=Rn),In.y<=Rn&&(In.y+=Rn),In.x-=En.offsetX,In.y-=En.offsetY,In}function ln(fn){return fn.flipX!==fn.flipY}function Gt(fn,sn,pn,bn,An){if(fn[sn]!==0){var Sn=fn._getTransformedDimensions()[bn],En=An/Sn*fn[pn];fn.set(pn,En)}}function on(fn,sn,pn,bn){var An=sn.target,Sn=An._getTransformedDimensions(0,An.skewY),En=Pt(sn,sn.originX,sn.originY,pn,bn),Vn=Math.abs(En.x*2)-Sn.x,Rn=An.skewX,In;Vn<2?In=0:(In=St(Math.atan2(Vn/An.scaleX,Sn.y/An.scaleY)),sn.originX===vt&&sn.originY===Ct&&(In=-In),sn.originX===bt&&sn.originY===yt&&(In=-In),ln(An)&&(In=-In));var zn=Rn!==In;if(zn){var Tn=An._getTransformedDimensions().y;An.set("skewX",In),Gt(An,"skewY","scaleY","y",Tn)}return zn}function tn(fn,sn,pn,bn){var An=sn.target,Sn=An._getTransformedDimensions(An.skewX,0),En=Pt(sn,sn.originX,sn.originY,pn,bn),Vn=Math.abs(En.y*2)-Sn.y,Rn=An.skewY,In;Vn<2?In=0:(In=St(Math.atan2(Vn/An.scaleY,Sn.x/An.scaleX)),sn.originX===vt&&sn.originY===Ct&&(In=-In),sn.originX===bt&&sn.originY===yt&&(In=-In),ln(An)&&(In=-In));var zn=Rn!==In;if(zn){var Tn=An._getTransformedDimensions().x;An.set("skewY",In),Gt(An,"skewX","scaleX","x",Tn)}return zn}function _i(fn,sn,pn,bn){var An=sn.target,Sn=An.skewX,En,Vn=sn.originY;if(An.lockSkewingX)return!1;if(Sn===0){var Rn=Pt(sn,xt,xt,pn,bn);Rn.x>0?En=vt:En=bt}else Sn>0&&(En=Vn===yt?vt:bt),Sn<0&&(En=Vn===yt?bt:vt),ln(An)&&(En=En===vt?bt:vt);sn.originX=En;var In=Kt("skewing",Lt(on));return In(fn,sn,pn,bn)}function Xt(fn,sn,pn,bn){var An=sn.target,Sn=An.skewY,En,Vn=sn.originX;if(An.lockSkewingY)return!1;if(Sn===0){var Rn=Pt(sn,xt,xt,pn,bn);Rn.y>0?En=yt:En=Ct}else Sn>0&&(En=Vn===vt?yt:Ct),Sn<0&&(En=Vn===vt?Ct:yt),ln(An)&&(En=En===yt?Ct:yt);sn.originY=En;var In=Kt("skewing",Lt(tn));return In(fn,sn,pn,bn)}function Vt(fn,sn,pn,bn){var An=sn,Sn=An.target,En=Sn.translateToOriginPoint(Sn.getCenterPoint(),An.originX,An.originY);if(Sn.lockRotation)return!1;var Vn=Math.atan2(An.ey-En.y,An.ex-En.x),Rn=Math.atan2(bn-En.y,pn-En.x),In=St(Rn-Vn+An.theta),zn=!0;if(Sn.snapAngle>0){var Tn=Sn.snapAngle,tr=Sn.snapThreshold||Tn,Qn=Math.ceil(In/Tn)*Tn,Bn=Math.floor(In/Tn)*Tn;Math.abs(In-Bn)<tr?In=Bn:Math.abs(In-Qn)<tr&&(In=Qn)}return In<0&&(In=360+In),In%=360,zn=Sn.angle!==In,Sn.angle=In,zn}function qt(fn,sn,pn,bn,An){An=An||{};var Sn=sn.target,En=Sn.lockScalingX,Vn=Sn.lockScalingY,Rn=An.by,In,zn,Tn,tr,Qn=Ft(fn,Sn),Bn=Qt(Sn,Rn,Qn),xn,Wn,qn=sn.gestureScale;if(Bn)return!1;if(qn)zn=sn.scaleX*qn,Tn=sn.scaleY*qn;else{if(In=Pt(sn,sn.originX,sn.originY,pn,bn),xn=Rn!=="y"?Ot(In.x):1,Wn=Rn!=="x"?Ot(In.y):1,sn.signX||(sn.signX=xn),sn.signY||(sn.signY=Wn),Sn.lockScalingFlip&&(sn.signX!==xn||sn.signY!==Wn))return!1;if(tr=Sn._getTransformedDimensions(),Qn&&!Rn){var nr=Math.abs(In.x)+Math.abs(In.y),On=sn.original,jn=Math.abs(tr.x*On.scaleX/Sn.scaleX)+Math.abs(tr.y*On.scaleY/Sn.scaleY),Ln=nr/jn;zn=On.scaleX*Ln,Tn=On.scaleY*Ln}else zn=Math.abs(In.x*Sn.scaleX/tr.x),Tn=Math.abs(In.y*Sn.scaleY/tr.y);Ut(sn)&&(zn*=2,Tn*=2),sn.signX!==xn&&Rn!=="y"&&(sn.originX=It[sn.originX],zn*=-1,sn.signX=xn),sn.signY!==Wn&&Rn!=="x"&&(sn.originY=It[sn.originY],Tn*=-1,sn.signY=Wn)}var Yn=Sn.scaleX,Hn=Sn.scaleY;return Rn?(Rn==="x"&&Sn.set("scaleX",zn),Rn==="y"&&Sn.set("scaleY",Tn)):(!En&&Sn.set("scaleX",zn),!Vn&&Sn.set("scaleY",Tn)),Yn!==Sn.scaleX||Hn!==Sn.scaleY}function rn(fn,sn,pn,bn){return qt(fn,sn,pn,bn)}function nn(fn,sn,pn,bn){return qt(fn,sn,pn,bn,{by:"x"})}function cn(fn,sn,pn,bn){return qt(fn,sn,pn,bn,{by:"y"})}function un(fn,sn,pn,bn){return fn[sn.target.canvas.altActionKey]?gt.skewHandlerX(fn,sn,pn,bn):gt.scalingY(fn,sn,pn,bn)}function gn(fn,sn,pn,bn){return fn[sn.target.canvas.altActionKey]?gt.skewHandlerY(fn,sn,pn,bn):gt.scalingX(fn,sn,pn,bn)}function mn(fn,sn,pn,bn){var An=sn.target,Sn=Pt(sn,sn.originX,sn.originY,pn,bn),En=An.strokeWidth/(An.strokeUniform?An.scaleX:1),Vn=Ut(sn)?2:1,Rn=An.width,In=Math.abs(Sn.x*Vn/An.scaleX)-En;return An.set("width",Math.max(In,0)),Rn!==In}function dn(fn,sn,pn,bn){var An=sn.target,Sn=pn-sn.offsetX,En=bn-sn.offsetY,Vn=!An.get("lockMovementX")&&An.left!==Sn,Rn=!An.get("lockMovementY")&&An.top!==En;return Vn&&An.set("left",Sn),Rn&&An.set("top",En),(Vn||Rn)&&jt("moving",Nt(fn,sn,pn,bn)),Vn||Rn}gt.scaleCursorStyleHandler=Ht,gt.skewCursorStyleHandler=Zt,gt.scaleSkewCursorStyleHandler=Wt,gt.rotationWithSnapping=Kt("rotating",Lt(Vt)),gt.scalingEqually=Kt("scaling",Lt(rn)),gt.scalingX=Kt("scaling",Lt(nn)),gt.scalingY=Kt("scaling",Lt(cn)),gt.scalingYOrSkewingX=un,gt.scalingXOrSkewingY=gn,gt.changeWidth=Kt("resizing",Lt(mn)),gt.skewHandlerX=_i,gt.skewHandlerY=Xt,gt.dragHandler=dn,gt.scaleOrSkewActionName=$t,gt.rotationStyleHandler=Jt,gt.fireEvent=jt,gt.wrapWithFixedAnchor=Lt,gt.wrapWithFireEvent=Kt,gt.getLocalPoint=Pt,ut.controlsUtils=gt}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.degreesToRadians,At=ut.controlsUtils;function gt(yt,bt,Ct,xt,It){xt=xt||{};var St=this.sizeX||xt.cornerSize||It.cornerSize,Ot=this.sizeY||xt.cornerSize||It.cornerSize,Mt=typeof xt.transparentCorners!="undefined"?xt.transparentCorners:It.transparentCorners,jt=Mt?"stroke":"fill",Ft=!Mt&&(xt.cornerStrokeColor||It.cornerStrokeColor),Ut=bt,Qt=Ct,Ht;yt.save(),yt.fillStyle=xt.cornerColor||It.cornerColor,yt.strokeStyle=xt.cornerStrokeColor||It.cornerStrokeColor,St>Ot?(Ht=St,yt.scale(1,Ot/St),Qt=Ct*St/Ot):Ot>St?(Ht=Ot,yt.scale(St/Ot,1),Ut=bt*Ot/St):Ht=St,yt.lineWidth=1,yt.beginPath(),yt.arc(Ut,Qt,Ht/2,0,2*Math.PI,!1),yt[jt](),Ft&&yt.stroke(),yt.restore()}function vt(yt,bt,Ct,xt,It){xt=xt||{};var St=this.sizeX||xt.cornerSize||It.cornerSize,Ot=this.sizeY||xt.cornerSize||It.cornerSize,Mt=typeof xt.transparentCorners!="undefined"?xt.transparentCorners:It.transparentCorners,jt=Mt?"stroke":"fill",Ft=!Mt&&(xt.cornerStrokeColor||It.cornerStrokeColor),Ut=St/2,Qt=Ot/2;yt.save(),yt.fillStyle=xt.cornerColor||It.cornerColor,yt.strokeStyle=xt.cornerStrokeColor||It.cornerStrokeColor,yt.lineWidth=1,yt.translate(bt,Ct),yt.rotate(pt(It.angle)),yt[jt+"Rect"](-Ut,-Qt,St,Ot),Ft&&yt.strokeRect(-Ut,-Qt,St,Ot),yt.restore()}At.renderCircleControl=gt,At.renderSquareControl=vt}(ot),function(ft){var ut=ft.fabric||(ft.fabric={});function pt(At){for(var gt in At)this[gt]=At[gt]}ut.Control=pt,ut.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(At,gt){return gt.cursorStyle},getActionName:function(At,gt){return gt.actionName},getVisibility:function(At,gt){var vt=At._controlsVisibility;return vt&&typeof vt[gt]!="undefined"?vt[gt]:this.visible},setVisibility:function(At){this.visible=At},positionHandler:function(At,gt){var vt=ut.util.transformPoint({x:this.x*At.x+this.offsetX,y:this.y*At.y+this.offsetY},gt);return vt},calcCornerCoords:function(At,gt,vt,yt,bt){var Ct,xt,It,St,Ot=bt?this.touchSizeX:this.sizeX,Mt=bt?this.touchSizeY:this.sizeY;if(Ot&&Mt&&Ot!==Mt){var jt=Math.atan2(Mt,Ot),Ft=Math.sqrt(Ot*Ot+Mt*Mt)/2,Ut=jt-ut.util.degreesToRadians(At),Qt=Math.PI/2-jt-ut.util.degreesToRadians(At);Ct=Ft*ut.util.cos(Ut),xt=Ft*ut.util.sin(Ut),It=Ft*ut.util.cos(Qt),St=Ft*ut.util.sin(Qt)}else{var Ht=Ot&&Mt?Ot:gt;Ft=Ht*.7071067812;var Ut=ut.util.degreesToRadians(45-At);Ct=It=Ft*ut.util.cos(Ut),xt=St=Ft*ut.util.sin(Ut)}return{tl:{x:vt-St,y:yt-It},tr:{x:vt+Ct,y:yt-xt},bl:{x:vt-Ct,y:yt+xt},br:{x:vt+St,y:yt+It}}},render:function(At,gt,vt,yt,bt){switch(yt=yt||{},yt.cornerStyle||bt.cornerStyle){case"circle":ut.controlsUtils.renderCircleControl.call(this,At,gt,vt,yt,bt);break;default:ut.controlsUtils.renderSquareControl.call(this,At,gt,vt,yt,bt)}}}}(ot),function(){function ft(vt,yt){var bt=vt.getAttribute("style"),Ct=vt.getAttribute("offset")||0,xt,It,St,Ot;if(Ct=parseFloat(Ct)/(/%$/.test(Ct)?100:1),Ct=Ct<0?0:Ct>1?1:Ct,bt){var Mt=bt.split(/\s*;\s*/);for(Mt[Mt.length-1]===""&&Mt.pop(),Ot=Mt.length;Ot--;){var jt=Mt[Ot].split(/\s*:\s*/),Ft=jt[0].trim(),Ut=jt[1].trim();Ft==="stop-color"?xt=Ut:Ft==="stop-opacity"&&(St=Ut)}}return xt||(xt=vt.getAttribute("stop-color")||"rgb(0,0,0)"),St||(St=vt.getAttribute("stop-opacity")),xt=new at.Color(xt),It=xt.getAlpha(),St=isNaN(parseFloat(St))?1:parseFloat(St),St*=It*yt,{offset:Ct,color:xt.toRgb(),opacity:St}}function ut(vt){return{x1:vt.getAttribute("x1")||0,y1:vt.getAttribute("y1")||0,x2:vt.getAttribute("x2")||"100%",y2:vt.getAttribute("y2")||0}}function pt(vt){return{x1:vt.getAttribute("fx")||vt.getAttribute("cx")||"50%",y1:vt.getAttribute("fy")||vt.getAttribute("cy")||"50%",r1:0,x2:vt.getAttribute("cx")||"50%",y2:vt.getAttribute("cy")||"50%",r2:vt.getAttribute("r")||"50%"}}var At=at.util.object.clone;at.Gradient=at.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(vt){vt||(vt={}),vt.coords||(vt.coords={});var yt,bt=this;Object.keys(vt).forEach(function(Ct){bt[Ct]=vt[Ct]}),this.id?this.id+="_"+at.Object.__uid++:this.id=at.Object.__uid++,yt={x1:vt.coords.x1||0,y1:vt.coords.y1||0,x2:vt.coords.x2||0,y2:vt.coords.y2||0},this.type==="radial"&&(yt.r1=vt.coords.r1||0,yt.r2=vt.coords.r2||0),this.coords=yt,this.colorStops=vt.colorStops.slice()},addColorStop:function(vt){for(var yt in vt){var bt=new at.Color(vt[yt]);this.colorStops.push({offset:parseFloat(yt),color:bt.toRgb(),opacity:bt.getAlpha()})}return this},toObject:function(vt){var yt={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return at.util.populateWithProperties(this,yt,vt),yt},toSVG:function(vt,It){var bt=At(this.coords,!0),Ct,xt,It=It||{},St,Ot,Mt=At(this.colorStops,!0),jt=bt.r1>bt.r2,Ft=this.gradientTransform?this.gradientTransform.concat():at.iMatrix.concat(),Ut=-this.offsetX,Qt=-this.offsetY,Ht=!!It.additionalTransform,Zt=this.gradientUnits==="pixels"?"userSpaceOnUse":"objectBoundingBox";if(Mt.sort(function(Lt,Kt){return Lt.offset-Kt.offset}),Zt==="objectBoundingBox"?(Ut/=vt.width,Qt/=vt.height):(Ut+=vt.width/2,Qt+=vt.height/2),vt.type==="path"&&this.gradientUnits!=="percentage"&&(Ut-=vt.pathOffset.x,Qt-=vt.pathOffset.y),Ft[4]-=Ut,Ft[5]-=Qt,Ot='id="SVGID_'+this.id+'" gradientUnits="'+Zt+'"',Ot+=' gradientTransform="'+(Ht?It.additionalTransform+" ":"")+at.util.matrixToSVG(Ft)+'" ',this.type==="linear"?St=["<linearGradient ",Ot,' x1="',bt.x1,'" y1="',bt.y1,'" x2="',bt.x2,'" y2="',bt.y2,`">
`]:this.type==="radial"&&(St=["<radialGradient ",Ot,' cx="',jt?bt.x1:bt.x2,'" cy="',jt?bt.y1:bt.y2,'" r="',jt?bt.r1:bt.r2,'" fx="',jt?bt.x2:bt.x1,'" fy="',jt?bt.y2:bt.y1,`">
`]),this.type==="radial"){if(jt)for(Mt=Mt.concat(),Mt.reverse(),Ct=0,xt=Mt.length;Ct<xt;Ct++)Mt[Ct].offset=1-Mt[Ct].offset;var Wt=Math.min(bt.r1,bt.r2);if(Wt>0){var $t=Math.max(bt.r1,bt.r2),Jt=Wt/$t;for(Ct=0,xt=Mt.length;Ct<xt;Ct++)Mt[Ct].offset+=Jt*(1-Mt[Ct].offset)}}for(Ct=0,xt=Mt.length;Ct<xt;Ct++){var Nt=Mt[Ct];St.push("<stop ",'offset="',Nt.offset*100+"%",'" style="stop-color:',Nt.color,typeof Nt.opacity!="undefined"?";stop-opacity: "+Nt.opacity:";",`"/>
`)}return St.push(this.type==="linear"?`</linearGradient>
`:`</radialGradient>
`),St.join("")},toLive:function(vt){var yt,bt=at.util.object.clone(this.coords),Ct,xt;if(!!this.type){for(this.type==="linear"?yt=vt.createLinearGradient(bt.x1,bt.y1,bt.x2,bt.y2):this.type==="radial"&&(yt=vt.createRadialGradient(bt.x1,bt.y1,bt.r1,bt.x2,bt.y2,bt.r2)),Ct=0,xt=this.colorStops.length;Ct<xt;Ct++){var It=this.colorStops[Ct].color,St=this.colorStops[Ct].opacity,Ot=this.colorStops[Ct].offset;typeof St!="undefined"&&(It=new at.Color(It).setAlpha(St).toRgba()),yt.addColorStop(Ot,It)}return yt}}}),at.util.object.extend(at.Gradient,{fromElement:function(vt,yt,bt,Ct){var xt=parseFloat(bt)/(/%$/.test(bt)?100:1);xt=xt<0?0:xt>1?1:xt,isNaN(xt)&&(xt=1);var It=vt.getElementsByTagName("stop"),St,Ot=vt.getAttribute("gradientUnits")==="userSpaceOnUse"?"pixels":"percentage",Mt=vt.getAttribute("gradientTransform")||"",jt=[],Ft,Ut,Qt=0,Ht=0,Zt;for(vt.nodeName==="linearGradient"||vt.nodeName==="LINEARGRADIENT"?(St="linear",Ft=ut(vt)):(St="radial",Ft=pt(vt)),Ut=It.length;Ut--;)jt.push(ft(It[Ut],xt));Zt=at.parseTransformAttribute(Mt),gt(yt,Ft,Ct,Ot),Ot==="pixels"&&(Qt=-yt.left,Ht=-yt.top);var Wt=new at.Gradient({id:vt.getAttribute("id"),type:St,coords:Ft,colorStops:jt,gradientUnits:Ot,gradientTransform:Zt,offsetX:Qt,offsetY:Ht});return Wt}});function gt(vt,yt,bt,Ct){var xt,It;Object.keys(yt).forEach(function(St){xt=yt[St],xt==="Infinity"?It=1:xt==="-Infinity"?It=0:(It=parseFloat(yt[St],10),typeof xt=="string"&&/^(\d+\.\d+)%|(\d+)%$/.test(xt)&&(It*=.01,Ct==="pixels"&&((St==="x1"||St==="x2"||St==="r2")&&(It*=bt.viewBoxWidth||bt.width),(St==="y1"||St==="y2")&&(It*=bt.viewBoxHeight||bt.height)))),yt[St]=It})}}(),function(){var ft=at.util.toFixed;at.Pattern=at.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(ut,pt){if(ut||(ut={}),this.id=at.Object.__uid++,this.setOptions(ut),!ut.source||ut.source&&typeof ut.source!="string"){pt&&pt(this);return}else{var At=this;this.source=at.util.createImage(),at.util.loadImage(ut.source,function(gt,vt){At.source=gt,pt&&pt(At,vt)},null,this.crossOrigin)}},toObject:function(ut){var pt=at.Object.NUM_FRACTION_DIGITS,At,gt;return typeof this.source.src=="string"?At=this.source.src:typeof this.source=="object"&&this.source.toDataURL&&(At=this.source.toDataURL()),gt={type:"pattern",source:At,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:ft(this.offsetX,pt),offsetY:ft(this.offsetY,pt),patternTransform:this.patternTransform?this.patternTransform.concat():null},at.util.populateWithProperties(this,gt,ut),gt},toSVG:function(ut){var pt=typeof this.source=="function"?this.source():this.source,At=pt.width/ut.width,gt=pt.height/ut.height,vt=this.offsetX/ut.width,yt=this.offsetY/ut.height,bt="";return(this.repeat==="repeat-x"||this.repeat==="no-repeat")&&(gt=1,yt&&(gt+=Math.abs(yt))),(this.repeat==="repeat-y"||this.repeat==="no-repeat")&&(At=1,vt&&(At+=Math.abs(vt))),pt.src?bt=pt.src:pt.toDataURL&&(bt=pt.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+vt+'" y="'+yt+'" width="'+At+'" height="'+gt+`">
<image x="0" y="0" width="`+pt.width+'" height="'+pt.height+'" xlink:href="'+bt+`"></image>
</pattern>
`},setOptions:function(ut){for(var pt in ut)this[pt]=ut[pt]},toLive:function(ut){var pt=this.source;return!pt||typeof pt.src!="undefined"&&(!pt.complete||pt.naturalWidth===0||pt.naturalHeight===0)?"":ut.createPattern(pt,this.repeat)}})}(),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.toFixed;if(ut.Shadow){ut.warn("fabric.Shadow is already defined.");return}ut.Shadow=ut.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(At){typeof At=="string"&&(At=this._parseShadow(At));for(var gt in At)this[gt]=At[gt];this.id=ut.Object.__uid++},_parseShadow:function(At){var gt=At.trim(),vt=ut.Shadow.reOffsetsAndBlur.exec(gt)||[],yt=gt.replace(ut.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)";return{color:yt.trim(),offsetX:parseFloat(vt[1],10)||0,offsetY:parseFloat(vt[2],10)||0,blur:parseFloat(vt[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(At){var gt=40,vt=40,yt=ut.Object.NUM_FRACTION_DIGITS,bt=ut.util.rotateVector({x:this.offsetX,y:this.offsetY},ut.util.degreesToRadians(-At.angle)),Ct=20,xt=new ut.Color(this.color);return At.width&&At.height&&(gt=pt((Math.abs(bt.x)+this.blur)/At.width,yt)*100+Ct,vt=pt((Math.abs(bt.y)+this.blur)/At.height,yt)*100+Ct),At.flipX&&(bt.x*=-1),At.flipY&&(bt.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+vt+'%" height="'+(100+2*vt)+'%" x="-'+gt+'%" width="'+(100+2*gt)+`%" >
	<feGaussianBlur in="SourceAlpha" stdDeviation="`+pt(this.blur?this.blur/2:0,yt)+`"></feGaussianBlur>
	<feOffset dx="`+pt(bt.x,yt)+'" dy="'+pt(bt.y,yt)+`" result="oBlur" ></feOffset>
	<feFlood flood-color="`+xt.toRgb()+'" flood-opacity="'+xt.getAlpha()+`"/>
	<feComposite in2="oBlur" operator="in" />
	<feMerge>
		<feMergeNode></feMergeNode>
		<feMergeNode in="SourceGraphic"></feMergeNode>
	</feMerge>
</filter>
`},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var At={},gt=ut.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach(function(vt){this[vt]!==gt[vt]&&(At[vt]=this[vt])},this),At}}),ut.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/}(ot),function(){if(at.StaticCanvas){at.warn("fabric.StaticCanvas is already defined.");return}var ft=at.util.object.extend,ut=at.util.getElementOffset,pt=at.util.removeFromArray,At=at.util.toFixed,gt=at.util.transformPoint,vt=at.util.invertTransform,yt=at.util.getNodeCanvas,bt=at.util.createCanvasElement,Ct=new Error("Could not initialize `canvas` element");at.StaticCanvas=at.util.createClass(at.CommonMethods,{initialize:function(xt,It){It||(It={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(xt,It)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:at.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(xt,It){var St=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(xt),this._initOptions(It),this.interactive||this._initRetinaScaling(),It.overlayImage&&this.setOverlayImage(It.overlayImage,St),It.backgroundImage&&this.setBackgroundImage(It.backgroundImage,St),It.backgroundColor&&this.setBackgroundColor(It.backgroundColor,St),It.overlayColor&&this.setOverlayColor(It.overlayColor,St),this.calcOffset()},_isRetinaScaling:function(){return at.devicePixelRatio!==1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?at.devicePixelRatio:1},_initRetinaScaling:function(){if(!!this._isRetinaScaling()){var xt=at.devicePixelRatio;this.__initRetinaScaling(xt,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(xt,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(xt,It,St){It.setAttribute("width",this.width*xt),It.setAttribute("height",this.height*xt),St.scale(xt,xt)},calcOffset:function(){return this._offset=ut(this.lowerCanvasEl),this},setOverlayImage:function(xt,It,St){return this.__setBgOverlayImage("overlayImage",xt,It,St)},setBackgroundImage:function(xt,It,St){return this.__setBgOverlayImage("backgroundImage",xt,It,St)},setOverlayColor:function(xt,It){return this.__setBgOverlayColor("overlayColor",xt,It)},setBackgroundColor:function(xt,It){return this.__setBgOverlayColor("backgroundColor",xt,It)},__setBgOverlayImage:function(xt,It,St,Ot){return typeof It=="string"?at.util.loadImage(It,function(Mt,jt){if(Mt){var Ft=new at.Image(Mt,Ot);this[xt]=Ft,Ft.canvas=this}St&&St(Mt,jt)},this,Ot&&Ot.crossOrigin):(Ot&&It.setOptions(Ot),this[xt]=It,It&&(It.canvas=this),St&&St(It,!1)),this},__setBgOverlayColor:function(xt,It,St){return this[xt]=It,this._initGradient(It,xt),this._initPattern(It,xt,St),this},_createCanvasElement:function(){var xt=bt();if(!xt||(xt.style||(xt.style={}),typeof xt.getContext=="undefined"))throw Ct;return xt},_initOptions:function(xt){var It=this.lowerCanvasEl;this._setOptions(xt),this.width=this.width||parseInt(It.width,10)||0,this.height=this.height||parseInt(It.height,10)||0,this.lowerCanvasEl.style&&(It.width=this.width,It.height=this.height,It.style.width=this.width+"px",It.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(xt){xt&&xt.getContext?this.lowerCanvasEl=xt:this.lowerCanvasEl=at.util.getById(xt)||this._createCanvasElement(),at.util.addClass(this.lowerCanvasEl,"lower-canvas"),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(xt,It){return this.setDimensions({width:xt},It)},setHeight:function(xt,It){return this.setDimensions({height:xt},It)},setDimensions:function(xt,It){var St;It=It||{};for(var Ot in xt)St=xt[Ot],It.cssOnly||(this._setBackstoreDimension(Ot,xt[Ot]),St+="px",this.hasLostContext=!0),It.backstoreOnly||this._setCssDimension(Ot,St);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(),this._initRetinaScaling(),this.calcOffset(),It.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(xt,It){return this.lowerCanvasEl[xt]=It,this.upperCanvasEl&&(this.upperCanvasEl[xt]=It),this.cacheCanvasEl&&(this.cacheCanvasEl[xt]=It),this[xt]=It,this},_setCssDimension:function(xt,It){return this.lowerCanvasEl.style[xt]=It,this.upperCanvasEl&&(this.upperCanvasEl.style[xt]=It),this.wrapperEl&&(this.wrapperEl.style[xt]=It),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(xt){var It=this._activeObject,St=this.backgroundImage,Ot=this.overlayImage,Mt,jt,Ft;for(this.viewportTransform=xt,jt=0,Ft=this._objects.length;jt<Ft;jt++)Mt=this._objects[jt],Mt.group||Mt.setCoords(!0);return It&&It.setCoords(),St&&St.setCoords(!0),Ot&&Ot.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(xt,It){var St=xt,Ot=this.viewportTransform.slice(0);xt=gt(xt,vt(this.viewportTransform)),Ot[0]=It,Ot[3]=It;var Mt=gt(xt,Ot);return Ot[4]+=St.x-Mt.x,Ot[5]+=St.y-Mt.y,this.setViewportTransform(Ot)},setZoom:function(xt){return this.zoomToPoint(new at.Point(0,0),xt),this},absolutePan:function(xt){var It=this.viewportTransform.slice(0);return It[4]=-xt.x,It[5]=-xt.y,this.setViewportTransform(It)},relativePan:function(xt){return this.absolutePan(new at.Point(-xt.x-this.viewportTransform[4],-xt.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(xt){this.stateful&&xt.setupState(),xt._set("canvas",this),xt.setCoords(),this.fire("object:added",{target:xt}),xt.fire("added")},_onObjectRemoved:function(xt){this.fire("object:removed",{target:xt}),xt.fire("removed"),delete xt.canvas},clearContext:function(xt){return xt.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var xt=this.contextContainer;return this.renderCanvas(xt,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=at.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var xt={},It=this.width,St=this.height,Ot=vt(this.viewportTransform);return xt.tl=gt({x:0,y:0},Ot),xt.br=gt({x:It,y:St},Ot),xt.tr=new at.Point(xt.br.x,xt.tl.y),xt.bl=new at.Point(xt.tl.x,xt.br.y),this.vptCoords=xt,xt},cancelRequestedRender:function(){this.isRendering&&(at.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(xt,It){var St=this.viewportTransform,Ot=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(xt),at.util.setImageSmoothing(xt,this.imageSmoothingEnabled),this.fire("before:render",{ctx:xt}),this._renderBackground(xt),xt.save(),xt.transform(St[0],St[1],St[2],St[3],St[4],St[5]),this._renderObjects(xt,It),xt.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(xt),Ot&&(Ot.canvas=this,Ot.shouldCache(),Ot._transformDone=!0,Ot.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(xt)),this._renderOverlay(xt),this.controlsAboveOverlay&&this.interactive&&this.drawControls(xt),this.fire("after:render",{ctx:xt})},drawClipPathOnCanvas:function(xt){var It=this.viewportTransform,St=this.clipPath;xt.save(),xt.transform(It[0],It[1],It[2],It[3],It[4],It[5]),xt.globalCompositeOperation="destination-in",St.transform(xt),xt.scale(1/St.zoomX,1/St.zoomY),xt.drawImage(St._cacheCanvas,-St.cacheTranslationX,-St.cacheTranslationY),xt.restore()},_renderObjects:function(xt,It){var St,Ot;for(St=0,Ot=It.length;St<Ot;++St)It[St]&&It[St].render(xt)},_renderBackgroundOrOverlay:function(xt,It){var St=this[It+"Color"],Ot=this[It+"Image"],Mt=this.viewportTransform,jt=this[It+"Vpt"];if(!(!St&&!Ot)){if(St){xt.save(),xt.beginPath(),xt.moveTo(0,0),xt.lineTo(this.width,0),xt.lineTo(this.width,this.height),xt.lineTo(0,this.height),xt.closePath(),xt.fillStyle=St.toLive?St.toLive(xt,this):St,jt&&xt.transform(Mt[0],Mt[1],Mt[2],Mt[3],Mt[4],Mt[5]),xt.transform(1,0,0,1,St.offsetX||0,St.offsetY||0);var Ft=St.gradientTransform||St.patternTransform;Ft&&xt.transform(Ft[0],Ft[1],Ft[2],Ft[3],Ft[4],Ft[5]),xt.fill(),xt.restore()}Ot&&(xt.save(),jt&&xt.transform(Mt[0],Mt[1],Mt[2],Mt[3],Mt[4],Mt[5]),Ot.render(xt),xt.restore())}},_renderBackground:function(xt){this._renderBackgroundOrOverlay(xt,"background")},_renderOverlay:function(xt){this._renderBackgroundOrOverlay(xt,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},centerObjectH:function(xt){return this._centerObject(xt,new at.Point(this.getCenter().left,xt.getCenterPoint().y))},centerObjectV:function(xt){return this._centerObject(xt,new at.Point(xt.getCenterPoint().x,this.getCenter().top))},centerObject:function(xt){var It=this.getCenter();return this._centerObject(xt,new at.Point(It.left,It.top))},viewportCenterObject:function(xt){var It=this.getVpCenter();return this._centerObject(xt,It)},viewportCenterObjectH:function(xt){var It=this.getVpCenter();return this._centerObject(xt,new at.Point(It.x,xt.getCenterPoint().y)),this},viewportCenterObjectV:function(xt){var It=this.getVpCenter();return this._centerObject(xt,new at.Point(xt.getCenterPoint().x,It.y))},getVpCenter:function(){var xt=this.getCenter(),It=vt(this.viewportTransform);return gt({x:xt.left,y:xt.top},It)},_centerObject:function(xt,It){return xt.setPositionByOrigin(It,"center","center"),xt.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(xt){return this.toDatalessObject(xt)},toObject:function(xt){return this._toObjectMethod("toObject",xt)},toDatalessObject:function(xt){return this._toObjectMethod("toDatalessObject",xt)},_toObjectMethod:function(xt,It){var St=this.clipPath,Ot={version:at.version,objects:this._toObjects(xt,It)};return St&&!St.excludeFromExport&&(Ot.clipPath=this._toObject(this.clipPath,xt,It)),ft(Ot,this.__serializeBgOverlay(xt,It)),at.util.populateWithProperties(this,Ot,It),Ot},_toObjects:function(xt,It){return this._objects.filter(function(St){return!St.excludeFromExport}).map(function(St){return this._toObject(St,xt,It)},this)},_toObject:function(xt,It,St){var Ot;this.includeDefaultValues||(Ot=xt.includeDefaultValues,xt.includeDefaultValues=!1);var Mt=xt[It](St);return this.includeDefaultValues||(xt.includeDefaultValues=Ot),Mt},__serializeBgOverlay:function(xt,It){var St={},Ot=this.backgroundImage,Mt=this.overlayImage,jt=this.backgroundColor,Ft=this.overlayColor;return jt&&jt.toObject?jt.excludeFromExport||(St.background=jt.toObject(It)):jt&&(St.background=jt),Ft&&Ft.toObject?Ft.excludeFromExport||(St.overlay=Ft.toObject(It)):Ft&&(St.overlay=Ft),Ot&&!Ot.excludeFromExport&&(St.backgroundImage=this._toObject(Ot,xt,It)),Mt&&!Mt.excludeFromExport&&(St.overlayImage=this._toObject(Mt,xt,It)),St},svgViewportTransformation:!0,toSVG:function(xt,It){xt||(xt={}),xt.reviver=It;var St=[];return this._setSVGPreamble(St,xt),this._setSVGHeader(St,xt),this.clipPath&&St.push('<g clip-path="url(#'+this.clipPath.clipPathId+`)" >
`),this._setSVGBgOverlayColor(St,"background"),this._setSVGBgOverlayImage(St,"backgroundImage",It),this._setSVGObjects(St,It),this.clipPath&&St.push(`</g>
`),this._setSVGBgOverlayColor(St,"overlay"),this._setSVGBgOverlayImage(St,"overlayImage",It),St.push("</svg>"),St.join("")},_setSVGPreamble:function(xt,It){It.suppressPreamble||xt.push('<?xml version="1.0" encoding="',It.encoding||"UTF-8",`" standalone="no" ?>
`,'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ',`"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
`)},_setSVGHeader:function(xt,It){var St=It.width||this.width,Ot=It.height||this.height,Mt,jt='viewBox="0 0 '+this.width+" "+this.height+'" ',Ft=at.Object.NUM_FRACTION_DIGITS;It.viewBox?jt='viewBox="'+It.viewBox.x+" "+It.viewBox.y+" "+It.viewBox.width+" "+It.viewBox.height+'" ':this.svgViewportTransformation&&(Mt=this.viewportTransform,jt='viewBox="'+At(-Mt[4]/Mt[0],Ft)+" "+At(-Mt[5]/Mt[3],Ft)+" "+At(this.width/Mt[0],Ft)+" "+At(this.height/Mt[3],Ft)+'" '),xt.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',St,'" ','height="',Ot,'" ',jt,`xml:space="preserve">
`,"<desc>Created with Fabric.js ",at.version,`</desc>
`,`<defs>
`,this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(It),`</defs>
`)},createSVGClipPathMarkup:function(xt){var It=this.clipPath;return It?(It.clipPathId="CLIPPATH_"+at.Object.__uid++,'<clipPath id="'+It.clipPathId+`" >
`+this.clipPath.toClipPathSVG(xt.reviver)+`</clipPath>
`):""},createSVGRefElementsMarkup:function(){var xt=this,It=["background","overlay"].map(function(St){var Ot=xt[St+"Color"];if(Ot&&Ot.toLive){var Mt=xt[St+"Vpt"],jt=xt.viewportTransform,Ft={width:xt.width/(Mt?jt[0]:1),height:xt.height/(Mt?jt[3]:1)};return Ot.toSVG(Ft,{additionalTransform:Mt?at.util.matrixToSVG(jt):""})}});return It.join("")},createSVGFontFacesMarkup:function(){var xt="",It={},St,Ot,Mt,jt,Ft,Ut,Qt,Ht,Zt,Wt=at.fontPaths,$t=[];for(this._objects.forEach(function Nt(Lt){$t.push(Lt),Lt._objects&&Lt._objects.forEach(Nt)}),Ht=0,Zt=$t.length;Ht<Zt;Ht++)if(St=$t[Ht],Ot=St.fontFamily,!(St.type.indexOf("text")===-1||It[Ot]||!Wt[Ot])&&(It[Ot]=!0,!!St.styles)){Mt=St.styles;for(Ft in Mt){jt=Mt[Ft];for(Qt in jt)Ut=jt[Qt],Ot=Ut.fontFamily,!It[Ot]&&Wt[Ot]&&(It[Ot]=!0)}}for(var Jt in It)xt+=[`		@font-face {
`,"			font-family: '",Jt,`';
`,"			src: url('",Wt[Jt],`');
`,`		}
`].join("");return xt&&(xt=['	<style type="text/css">',`<![CDATA[
`,xt,"]]>",`</style>
`].join("")),xt},_setSVGObjects:function(xt,It){var St,Ot,Mt,jt=this._objects;for(Ot=0,Mt=jt.length;Ot<Mt;Ot++)St=jt[Ot],!St.excludeFromExport&&this._setSVGObject(xt,St,It)},_setSVGObject:function(xt,It,St){xt.push(It.toSVG(St))},_setSVGBgOverlayImage:function(xt,It,St){this[It]&&!this[It].excludeFromExport&&this[It].toSVG&&xt.push(this[It].toSVG(St))},_setSVGBgOverlayColor:function(xt,It){var St=this[It+"Color"],Ot=this.viewportTransform,Mt=this.width,jt=this.height;if(!!St)if(St.toLive){var Ft=St.repeat,Ut=at.util.invertTransform(Ot),Qt=this[It+"Vpt"],Ht=Qt?at.util.matrixToSVG(Ut):"";xt.push('<rect transform="'+Ht+" translate(",Mt/2,",",jt/2,')"',' x="',St.offsetX-Mt/2,'" y="',St.offsetY-jt/2,'" ','width="',Ft==="repeat-y"||Ft==="no-repeat"?St.source.width:Mt,'" height="',Ft==="repeat-x"||Ft==="no-repeat"?St.source.height:jt,'" fill="url(#SVGID_'+St.id+')"',`></rect>
`)}else xt.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',St,'"',`></rect>
`)},sendToBack:function(xt){if(!xt)return this;var It=this._activeObject,St,Ot,Mt;if(xt===It&&xt.type==="activeSelection")for(Mt=It._objects,St=Mt.length;St--;)Ot=Mt[St],pt(this._objects,Ot),this._objects.unshift(Ot);else pt(this._objects,xt),this._objects.unshift(xt);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(xt){if(!xt)return this;var It=this._activeObject,St,Ot,Mt;if(xt===It&&xt.type==="activeSelection")for(Mt=It._objects,St=0;St<Mt.length;St++)Ot=Mt[St],pt(this._objects,Ot),this._objects.push(Ot);else pt(this._objects,xt),this._objects.push(xt);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(xt,It){if(!xt)return this;var St=this._activeObject,Ot,Mt,jt,Ft,Ut,Qt=0;if(xt===St&&xt.type==="activeSelection")for(Ut=St._objects,Ot=0;Ot<Ut.length;Ot++)Mt=Ut[Ot],jt=this._objects.indexOf(Mt),jt>0+Qt&&(Ft=jt-1,pt(this._objects,Mt),this._objects.splice(Ft,0,Mt)),Qt++;else jt=this._objects.indexOf(xt),jt!==0&&(Ft=this._findNewLowerIndex(xt,jt,It),pt(this._objects,xt),this._objects.splice(Ft,0,xt));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(xt,It,St){var Ot,Mt;if(St)for(Ot=It,Mt=It-1;Mt>=0;--Mt){var jt=xt.intersectsWithObject(this._objects[Mt])||xt.isContainedWithinObject(this._objects[Mt])||this._objects[Mt].isContainedWithinObject(xt);if(jt){Ot=Mt;break}}else Ot=It-1;return Ot},bringForward:function(xt,It){if(!xt)return this;var St=this._activeObject,Ot,Mt,jt,Ft,Ut,Qt=0;if(xt===St&&xt.type==="activeSelection")for(Ut=St._objects,Ot=Ut.length;Ot--;)Mt=Ut[Ot],jt=this._objects.indexOf(Mt),jt<this._objects.length-1-Qt&&(Ft=jt+1,pt(this._objects,Mt),this._objects.splice(Ft,0,Mt)),Qt++;else jt=this._objects.indexOf(xt),jt!==this._objects.length-1&&(Ft=this._findNewUpperIndex(xt,jt,It),pt(this._objects,xt),this._objects.splice(Ft,0,xt));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(xt,It,St){var Ot,Mt,jt;if(St)for(Ot=It,Mt=It+1,jt=this._objects.length;Mt<jt;++Mt){var Ft=xt.intersectsWithObject(this._objects[Mt])||xt.isContainedWithinObject(this._objects[Mt])||this._objects[Mt].isContainedWithinObject(xt);if(Ft){Ot=Mt;break}}else Ot=It+1;return Ot},moveTo:function(xt,It){return pt(this._objects,xt),this._objects.splice(It,0,xt),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(at.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject(function(xt){xt.dispose&&xt.dispose()}),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove("lower-canvas"),this.lowerCanvasEl.style=this._originalCanvasStyle,delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),at.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),ft(at.StaticCanvas.prototype,at.Observable),ft(at.StaticCanvas.prototype,at.Collection),ft(at.StaticCanvas.prototype,at.DataURLExporter),ft(at.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(xt){var It=bt();if(!It||!It.getContext)return null;var St=It.getContext("2d");if(!St)return null;switch(xt){case"setLineDash":return typeof St.setLineDash!="undefined";default:return null}}}),at.StaticCanvas.prototype.toJSON=at.StaticCanvas.prototype.toObject,at.isLikelyNode&&(at.StaticCanvas.prototype.createPNGStream=function(){var xt=yt(this.lowerCanvasEl);return xt&&xt.createPNGStream()},at.StaticCanvas.prototype.createJPEGStream=function(xt){var It=yt(this.lowerCanvasEl);return It&&It.createJPEGStream(xt)})}(),at.BaseBrush=at.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(){var ft=this.canvas.contextTop;ft.strokeStyle=this.color,ft.lineWidth=this.width,ft.lineCap=this.strokeLineCap,ft.miterLimit=this.strokeMiterLimit,ft.lineJoin=this.strokeLineJoin,ft.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(ft){var ut=this.canvas.viewportTransform;ft.save(),ft.transform(ut[0],ut[1],ut[2],ut[3],ut[4],ut[5])},_setShadow:function(){if(!!this.shadow){var ft=this.canvas,ut=this.shadow,pt=ft.contextTop,At=ft.getZoom();ft&&ft._isRetinaScaling()&&(At*=at.devicePixelRatio),pt.shadowColor=ut.color,pt.shadowBlur=ut.blur*At,pt.shadowOffsetX=ut.offsetX*At,pt.shadowOffsetY=ut.offsetY*At}},needsFullRender:function(){var ft=new at.Color(this.color);return ft.getAlpha()<1||!!this.shadow},_resetShadow:function(){var ft=this.canvas.contextTop;ft.shadowColor="",ft.shadowBlur=ft.shadowOffsetX=ft.shadowOffsetY=0},_isOutSideCanvas:function(ft){return ft.x<0||ft.x>this.canvas.getWidth()||ft.y<0||ft.y>this.canvas.getHeight()}}),function(){at.PencilBrush=at.util.createClass(at.BaseBrush,{decimate:.4,initialize:function(ft){this.canvas=ft,this._points=[]},_drawSegment:function(ft,ut,pt){var At=ut.midPointFrom(pt);return ft.quadraticCurveTo(ut.x,ut.y,At.x,At.y),At},onMouseDown:function(ft,ut){!this.canvas._isMainEvent(ut.e)||(this._prepareForDrawing(ft),this._captureDrawingPath(ft),this._render())},onMouseMove:function(ft,ut){if(!!this.canvas._isMainEvent(ut.e)&&!(this.limitedToCanvasSize===!0&&this._isOutSideCanvas(ft))&&this._captureDrawingPath(ft)&&this._points.length>1)if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var pt=this._points,At=pt.length,gt=this.canvas.contextTop;this._saveAndTransform(gt),this.oldEnd&&(gt.beginPath(),gt.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(gt,pt[At-2],pt[At-1],!0),gt.stroke(),gt.restore()}},onMouseUp:function(ft){return this.canvas._isMainEvent(ft.e)?(this.oldEnd=void 0,this._finalizeAndAddPath(),!1):!0},_prepareForDrawing:function(ft){var ut=new at.Point(ft.x,ft.y);this._reset(),this._addPoint(ut),this.canvas.contextTop.moveTo(ut.x,ut.y)},_addPoint:function(ft){return this._points.length>1&&ft.eq(this._points[this._points.length-1])?!1:(this._points.push(ft),!0)},_reset:function(){this._points=[],this._setBrushStyles(),this._setShadow()},_captureDrawingPath:function(ft){var ut=new at.Point(ft.x,ft.y);return this._addPoint(ut)},_render:function(){var ft=this.canvas.contextTop,ut,pt,At=this._points[0],gt=this._points[1];if(this._saveAndTransform(ft),ft.beginPath(),this._points.length===2&&At.x===gt.x&&At.y===gt.y){var vt=this.width/1e3;At=new at.Point(At.x,At.y),gt=new at.Point(gt.x,gt.y),At.x-=vt,gt.x+=vt}for(ft.moveTo(At.x,At.y),ut=1,pt=this._points.length;ut<pt;ut++)this._drawSegment(ft,At,gt),At=this._points[ut],gt=this._points[ut+1];ft.lineTo(At.x,At.y),ft.stroke(),ft.restore()},convertPointsToSVGPath:function(ft){var ut=this.width/1e3;return at.util.getSmoothPathFromPoints(ft,ut)},_isEmptySVGPath:function(ft){var ut=at.util.joinPath(ft);return ut==="M 0 0 Q 0 0 0 0 L 0 0"},createPath:function(ft){var ut=new at.Path(ft,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,ut.shadow=new at.Shadow(this.shadow)),ut},decimatePoints:function(ft,ut){if(ft.length<=2)return ft;var pt=this.canvas.getZoom(),At=Math.pow(ut/pt,2),gt,vt=ft.length-1,yt=ft[0],bt=[yt],Ct;for(gt=1;gt<vt-1;gt++)Ct=Math.pow(yt.x-ft[gt].x,2)+Math.pow(yt.y-ft[gt].y,2),Ct>=At&&(yt=ft[gt],bt.push(yt));return bt.push(ft[vt]),bt},_finalizeAndAddPath:function(){var ft=this.canvas.contextTop;ft.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var ut=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(ut)){this.canvas.requestRenderAll();return}var pt=this.createPath(ut);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:pt}),this.canvas.add(pt),this.canvas.requestRenderAll(),pt.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:pt})}})}(),at.CircleBrush=at.util.createClass(at.BaseBrush,{width:10,initialize:function(ft){this.canvas=ft,this.points=[]},drawDot:function(ft){var ut=this.addPoint(ft),pt=this.canvas.contextTop;this._saveAndTransform(pt),this.dot(pt,ut),pt.restore()},dot:function(ft,ut){ft.fillStyle=ut.fill,ft.beginPath(),ft.arc(ut.x,ut.y,ut.radius,0,Math.PI*2,!1),ft.closePath(),ft.fill()},onMouseDown:function(ft){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(ft)},_render:function(){var ft=this.canvas.contextTop,ut,pt,At=this.points;for(this._saveAndTransform(ft),ut=0,pt=At.length;ut<pt;ut++)this.dot(ft,At[ut]);ft.restore()},onMouseMove:function(ft){this.limitedToCanvasSize===!0&&this._isOutSideCanvas(ft)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(ft),this._render()):this.drawDot(ft))},onMouseUp:function(){var ft=this.canvas.renderOnAddRemove,ut,pt;this.canvas.renderOnAddRemove=!1;var At=[];for(ut=0,pt=this.points.length;ut<pt;ut++){var gt=this.points[ut],vt=new at.Circle({radius:gt.radius,left:gt.x,top:gt.y,originX:"center",originY:"center",fill:gt.fill});this.shadow&&(vt.shadow=new at.Shadow(this.shadow)),At.push(vt)}var yt=new at.Group(At);yt.canvas=this.canvas,this.canvas.fire("before:path:created",{path:yt}),this.canvas.add(yt),this.canvas.fire("path:created",{path:yt}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=ft,this.canvas.requestRenderAll()},addPoint:function(ft){var ut=new at.Point(ft.x,ft.y),pt=at.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,At=new at.Color(this.color).setAlpha(at.util.getRandomInt(0,100)/100).toRgba();return ut.radius=pt,ut.fill=At,this.points.push(ut),ut}}),at.SprayBrush=at.util.createClass(at.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(ft){this.canvas=ft,this.sprayChunks=[]},onMouseDown:function(ft){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(ft),this.render(this.sprayChunkPoints)},onMouseMove:function(ft){this.limitedToCanvasSize===!0&&this._isOutSideCanvas(ft)||(this.addSprayChunk(ft),this.render(this.sprayChunkPoints))},onMouseUp:function(){var ft=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var ut=[],pt=0,At=this.sprayChunks.length;pt<At;pt++)for(var gt=this.sprayChunks[pt],vt=0,yt=gt.length;vt<yt;vt++){var bt=new at.Rect({width:gt[vt].width,height:gt[vt].width,left:gt[vt].x+1,top:gt[vt].y+1,originX:"center",originY:"center",fill:this.color});ut.push(bt)}this.optimizeOverlapping&&(ut=this._getOptimizedRects(ut));var Ct=new at.Group(ut);this.shadow&&Ct.set("shadow",new at.Shadow(this.shadow)),this.canvas.fire("before:path:created",{path:Ct}),this.canvas.add(Ct),this.canvas.fire("path:created",{path:Ct}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=ft,this.canvas.requestRenderAll()},_getOptimizedRects:function(ft){var ut={},pt,At,gt;for(At=0,gt=ft.length;At<gt;At++)pt=ft[At].left+""+ft[At].top,ut[pt]||(ut[pt]=ft[At]);var vt=[];for(pt in ut)vt.push(ut[pt]);return vt},render:function(ft){var ut=this.canvas.contextTop,pt,At;for(ut.fillStyle=this.color,this._saveAndTransform(ut),pt=0,At=ft.length;pt<At;pt++){var gt=ft[pt];typeof gt.opacity!="undefined"&&(ut.globalAlpha=gt.opacity),ut.fillRect(gt.x,gt.y,gt.width,gt.width)}ut.restore()},_render:function(){var ft=this.canvas.contextTop,ut,pt;for(ft.fillStyle=this.color,this._saveAndTransform(ft),ut=0,pt=this.sprayChunks.length;ut<pt;ut++)this.render(this.sprayChunks[ut]);ft.restore()},addSprayChunk:function(ft){this.sprayChunkPoints=[];var ut,pt,At,gt=this.width/2,vt;for(vt=0;vt<this.density;vt++){ut=at.util.getRandomInt(ft.x-gt,ft.x+gt),pt=at.util.getRandomInt(ft.y-gt,ft.y+gt),this.dotWidthVariance?At=at.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):At=this.dotWidth;var yt=new at.Point(ut,pt);yt.width=At,this.randomOpacity&&(yt.opacity=at.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(yt)}this.sprayChunks.push(this.sprayChunkPoints)}}),at.PatternBrush=at.util.createClass(at.PencilBrush,{getPatternSrc:function(){var ft=20,ut=5,pt=at.util.createCanvasElement(),At=pt.getContext("2d");return pt.width=pt.height=ft+ut,At.fillStyle=this.color,At.beginPath(),At.arc(ft/2,ft/2,ft/2,0,Math.PI*2,!1),At.closePath(),At.fill(),pt},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(){return this.canvas.contextTop.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(){this.callSuper("_setBrushStyles"),this.canvas.contextTop.strokeStyle=this.getPattern()},createPath:function(ft){var ut=this.callSuper("createPath",ft),pt=ut._getLeftTopCoords().scalarAdd(ut.strokeWidth/2);return ut.stroke=new at.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-pt.x,offsetY:-pt.y}),ut}}),function(){var ft=at.util.getPointer,ut=at.util.degreesToRadians,pt=at.util.isTouchEvent;at.Canvas=at.util.createClass(at.StaticCanvas,{initialize:function(gt,vt){vt||(vt={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(gt,vt),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",rotationCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=at.PencilBrush&&new at.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var gt=this.getActiveObjects(),vt,yt,bt;if(gt.length>0&&!this.preserveObjectStacking){yt=[],bt=[];for(var Ct=0,xt=this._objects.length;Ct<xt;Ct++)vt=this._objects[Ct],gt.indexOf(vt)===-1?yt.push(vt):bt.push(vt);gt.length>1&&(this._activeObject._objects=bt),yt.push.apply(yt,bt)}else yt=this._objects;return yt},renderAll:function(){this.contextTopDirty&&!this._groupSelector&&!this.isDrawingMode&&(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&this.renderTopLayer(this.contextTop);var gt=this.contextContainer;return this.renderCanvas(gt,this._chooseObjectsToRender()),this},renderTopLayer:function(gt){gt.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(gt),this.contextTopDirty=!0),gt.restore()},renderTop:function(){var gt=this.contextTop;return this.clearContext(gt),this.renderTopLayer(gt),this.fire("after:render"),this},_normalizePointer:function(gt,vt){var yt=gt.calcTransformMatrix(),bt=at.util.invertTransform(yt),Ct=this.restorePointerVpt(vt);return at.util.transformPoint(Ct,bt)},isTargetTransparent:function(gt,vt,yt){if(gt.shouldCache()&&gt._cacheCanvas&&gt!==this._activeObject){var bt=this._normalizePointer(gt,{x:vt,y:yt}),Ct=Math.max(gt.cacheTranslationX+bt.x*gt.zoomX,0),xt=Math.max(gt.cacheTranslationY+bt.y*gt.zoomY,0),Mt=at.util.isTransparent(gt._cacheContext,Math.round(Ct),Math.round(xt),this.targetFindTolerance);return Mt}var It=this.contextCache,St=gt.selectionBackgroundColor,Ot=this.viewportTransform;gt.selectionBackgroundColor="",this.clearContext(It),It.save(),It.transform(Ot[0],Ot[1],Ot[2],Ot[3],Ot[4],Ot[5]),gt.render(It),It.restore(),gt.selectionBackgroundColor=St;var Mt=at.util.isTransparent(It,vt,yt,this.targetFindTolerance);return Mt},_isSelectionKeyPressed:function(gt){var vt=!1;return Object.prototype.toString.call(this.selectionKey)==="[object Array]"?vt=!!this.selectionKey.find(function(yt){return gt[yt]===!0}):vt=gt[this.selectionKey],vt},_shouldClearSelection:function(gt,vt){var yt=this.getActiveObjects(),bt=this._activeObject;return!vt||vt&&bt&&yt.length>1&&yt.indexOf(vt)===-1&&bt!==vt&&!this._isSelectionKeyPressed(gt)||vt&&!vt.evented||vt&&!vt.selectable&&bt&&bt!==vt},_shouldCenterTransform:function(gt,vt,yt){if(!!gt){var bt;return vt==="scale"||vt==="scaleX"||vt==="scaleY"||vt==="resizing"?bt=this.centeredScaling||gt.centeredScaling:vt==="rotate"&&(bt=this.centeredRotation||gt.centeredRotation),bt?!yt:yt}},_getOriginFromCorner:function(gt,vt){var yt={x:gt.originX,y:gt.originY};return vt==="ml"||vt==="tl"||vt==="bl"?yt.x="right":(vt==="mr"||vt==="tr"||vt==="br")&&(yt.x="left"),vt==="tl"||vt==="mt"||vt==="tr"?yt.y="bottom":(vt==="bl"||vt==="mb"||vt==="br")&&(yt.y="top"),yt},_getActionFromCorner:function(gt,vt,yt,bt){if(!vt||!gt)return"drag";var Ct=bt.controls[vt];return Ct.getActionName(yt,Ct,bt)},_setupCurrentTransform:function(gt,vt,yt){if(!!vt){var bt=this.getPointer(gt),Ct=vt.__corner,xt=vt.controls[Ct],It=yt&&Ct?xt.getActionHandler(gt,vt,xt):at.controlsUtils.dragHandler,St=this._getActionFromCorner(yt,Ct,gt,vt),Ot=this._getOriginFromCorner(vt,Ct),Mt=gt[this.centeredKey],jt={target:vt,action:St,actionHandler:It,corner:Ct,scaleX:vt.scaleX,scaleY:vt.scaleY,skewX:vt.skewX,skewY:vt.skewY,offsetX:bt.x-vt.left,offsetY:bt.y-vt.top,originX:Ot.x,originY:Ot.y,ex:bt.x,ey:bt.y,lastX:bt.x,lastY:bt.y,theta:ut(vt.angle),width:vt.width*vt.scaleX,shiftKey:gt.shiftKey,altKey:Mt,original:at.util.saveObjectTransform(vt)};this._shouldCenterTransform(vt,St,Mt)&&(jt.originX="center",jt.originY="center"),jt.original.originX=Ot.x,jt.original.originY=Ot.y,this._currentTransform=jt,this._beforeTransform(gt)}},setCursor:function(gt){this.upperCanvasEl.style.cursor=gt},_drawSelection:function(gt){var vt=this._groupSelector,yt=new at.Point(vt.ex,vt.ey),bt=at.util.transformPoint(yt,this.viewportTransform),Ct=new at.Point(vt.ex+vt.left,vt.ey+vt.top),xt=at.util.transformPoint(Ct,this.viewportTransform),It=Math.min(bt.x,xt.x),St=Math.min(bt.y,xt.y),Ot=Math.max(bt.x,xt.x),Mt=Math.max(bt.y,xt.y),jt=this.selectionLineWidth/2;this.selectionColor&&(gt.fillStyle=this.selectionColor,gt.fillRect(It,St,Ot-It,Mt-St)),!(!this.selectionLineWidth||!this.selectionBorderColor)&&(gt.lineWidth=this.selectionLineWidth,gt.strokeStyle=this.selectionBorderColor,It+=jt,St+=jt,Ot-=jt,Mt-=jt,at.Object.prototype._setLineDash.call(this,gt,this.selectionDashArray),gt.strokeRect(It,St,Ot-It,Mt-St))},findTarget:function(gt,vt){if(!this.skipTargetFind){var yt=!0,bt=this.getPointer(gt,yt),Ct=this._activeObject,xt=this.getActiveObjects(),It,St,Ot=pt(gt),Mt=xt.length>1&&!vt||xt.length===1;if(this.targets=[],Mt&&Ct._findTargetCorner(bt,Ot)||xt.length>1&&!vt&&Ct===this._searchPossibleTargets([Ct],bt))return Ct;if(xt.length===1&&Ct===this._searchPossibleTargets([Ct],bt))if(this.preserveObjectStacking)It=Ct,St=this.targets,this.targets=[];else return Ct;var jt=this._searchPossibleTargets(this._objects,bt);return gt[this.altSelectionKey]&&jt&&It&&jt!==It&&(jt=It,this.targets=St),jt}},_checkTarget:function(gt,vt,yt){if(vt&&vt.visible&&vt.evented&&vt.containsPoint(gt))if((this.perPixelTargetFind||vt.perPixelTargetFind)&&!vt.isEditing){var bt=this.isTargetTransparent(vt,yt.x,yt.y);if(!bt)return!0}else return!0},_searchPossibleTargets:function(gt,vt){for(var yt,bt=gt.length,Ct;bt--;){var xt=gt[bt],It=xt.group?this._normalizePointer(xt.group,vt):vt;if(this._checkTarget(It,xt,vt)){yt=gt[bt],yt.subTargetCheck&&yt instanceof at.Group&&(Ct=this._searchPossibleTargets(yt._objects,vt),Ct&&this.targets.push(Ct));break}}return yt},restorePointerVpt:function(gt){return at.util.transformPoint(gt,at.util.invertTransform(this.viewportTransform))},getPointer:function(gt,vt){if(this._absolutePointer&&!vt)return this._absolutePointer;if(this._pointer&&vt)return this._pointer;var yt=ft(gt),bt=this.upperCanvasEl,Ct=bt.getBoundingClientRect(),xt=Ct.width||0,It=Ct.height||0,St;(!xt||!It)&&("top"in Ct&&"bottom"in Ct&&(It=Math.abs(Ct.top-Ct.bottom)),"right"in Ct&&"left"in Ct&&(xt=Math.abs(Ct.right-Ct.left))),this.calcOffset(),yt.x=yt.x-this._offset.left,yt.y=yt.y-this._offset.top,vt||(yt=this.restorePointerVpt(yt));var Ot=this.getRetinaScaling();return Ot!==1&&(yt.x/=Ot,yt.y/=Ot),xt===0||It===0?St={width:1,height:1}:St={width:bt.width/xt,height:bt.height/It},{x:yt.x*St.width,y:yt.y*St.height}},_createUpperCanvas:function(){var gt=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),vt=this.lowerCanvasEl,yt=this.upperCanvasEl;yt?yt.className="":(yt=this._createCanvasElement(),this.upperCanvasEl=yt),at.util.addClass(yt,"upper-canvas "+gt),this.wrapperEl.appendChild(yt),this._copyCanvasStyle(vt,yt),this._applyCanvasStyle(yt),this.contextTop=yt.getContext("2d")},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=at.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),at.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),at.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(gt){var vt=this.width||gt.width,yt=this.height||gt.height;at.util.setStyle(gt,{position:"absolute",width:vt+"px",height:yt+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),gt.width=vt,gt.height=yt,at.util.makeElementUnselectable(gt)},_copyCanvasStyle:function(gt,vt){vt.style.cssText=gt.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var gt=this._activeObject;return gt?gt.type==="activeSelection"&&gt._objects?gt._objects.slice(0):[gt]:[]},_onObjectRemoved:function(gt){gt===this._activeObject&&(this.fire("before:selection:cleared",{target:gt}),this._discardActiveObject(),this.fire("selection:cleared",{target:gt}),gt.fire("deselected")),gt===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",gt)},_fireSelectionEvents:function(gt,vt){var yt=!1,bt=this.getActiveObjects(),Ct=[],xt=[];gt.forEach(function(It){bt.indexOf(It)===-1&&(yt=!0,It.fire("deselected",{e:vt,target:It}),xt.push(It))}),bt.forEach(function(It){gt.indexOf(It)===-1&&(yt=!0,It.fire("selected",{e:vt,target:It}),Ct.push(It))}),gt.length>0&&bt.length>0?yt&&this.fire("selection:updated",{e:vt,selected:Ct,deselected:xt,updated:Ct[0]||xt[0],target:this._activeObject}):bt.length>0?this.fire("selection:created",{e:vt,selected:Ct,target:this._activeObject}):gt.length>0&&this.fire("selection:cleared",{e:vt,deselected:xt})},setActiveObject:function(gt,vt){var yt=this.getActiveObjects();return this._setActiveObject(gt,vt),this._fireSelectionEvents(yt,vt),this},_setActiveObject:function(gt,vt){return this._activeObject===gt||!this._discardActiveObject(vt,gt)||gt.onSelect({e:vt})?!1:(this._activeObject=gt,!0)},_discardActiveObject:function(gt,vt){var yt=this._activeObject;if(yt){if(yt.onDeselect({e:gt,object:vt}))return!1;this._activeObject=null}return!0},discardActiveObject:function(gt){var vt=this.getActiveObjects(),yt=this.getActiveObject();return vt.length&&this.fire("before:selection:cleared",{target:yt,e:gt}),this._discardActiveObject(gt),this._fireSelectionEvents(vt,gt),this},dispose:function(){var gt=this.wrapperEl;return this.removeListeners(),gt.removeChild(this.upperCanvasEl),gt.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(vt){at.util.cleanUpJsdomNode(this[vt]),this[vt]=void 0}.bind(this)),gt.parentNode&&gt.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,at.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(gt){var vt=this._activeObject;vt&&vt._renderControls(gt)},_toObject:function(gt,vt,yt){var bt=this._realizeGroupTransformOnObject(gt),Ct=this.callSuper("_toObject",gt,vt,yt);return this._unwindGroupTransformOnObject(gt,bt),Ct},_realizeGroupTransformOnObject:function(gt){if(gt.group&&gt.group.type==="activeSelection"&&this._activeObject===gt.group){var vt=["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"],yt={};return vt.forEach(function(bt){yt[bt]=gt[bt]}),at.util.addTransformToObject(gt,this._activeObject.calcOwnMatrix()),yt}else return null},_unwindGroupTransformOnObject:function(gt,vt){vt&&gt.set(vt)},_setSVGObject:function(gt,vt,yt){var bt=this._realizeGroupTransformOnObject(vt);this.callSuper("_setSVGObject",gt,vt,yt),this._unwindGroupTransformOnObject(vt,bt)},setViewportTransform:function(gt){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),at.StaticCanvas.prototype.setViewportTransform.call(this,gt)}});for(var At in at.StaticCanvas)At!=="prototype"&&(at.Canvas[At]=at.StaticCanvas[At])}(),function(){var ft=at.util.addListener,ut=at.util.removeListener,pt=3,At=2,gt=1,vt={passive:!1};function yt(bt,Ct){return bt.button&&bt.button===Ct-1}at.util.object.extend(at.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(ft,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(bt,Ct){var xt=this.upperCanvasEl,It=this._getEventPrefix();bt(at.window,"resize",this._onResize),bt(xt,It+"down",this._onMouseDown),bt(xt,It+"move",this._onMouseMove,vt),bt(xt,It+"out",this._onMouseOut),bt(xt,It+"enter",this._onMouseEnter),bt(xt,"wheel",this._onMouseWheel),bt(xt,"contextmenu",this._onContextMenu),bt(xt,"dblclick",this._onDoubleClick),bt(xt,"dragover",this._onDragOver),bt(xt,"dragenter",this._onDragEnter),bt(xt,"dragleave",this._onDragLeave),bt(xt,"drop",this._onDrop),this.enablePointerEvents||bt(xt,"touchstart",this._onTouchStart,vt),typeof eventjs!="undefined"&&Ct in eventjs&&(eventjs[Ct](xt,"gesture",this._onGesture),eventjs[Ct](xt,"drag",this._onDrag),eventjs[Ct](xt,"orientation",this._onOrientationChange),eventjs[Ct](xt,"shake",this._onShake),eventjs[Ct](xt,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(ut,"remove");var bt=this._getEventPrefix();ut(at.document,bt+"up",this._onMouseUp),ut(at.document,"touchend",this._onTouchEnd,vt),ut(at.document,bt+"move",this._onMouseMove,vt),ut(at.document,"touchmove",this._onMouseMove,vt)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._simpleEventHandler.bind(this,"drop"),this.eventsBound=!0)},_onGesture:function(bt,Ct){this.__onTransformGesture&&this.__onTransformGesture(bt,Ct)},_onDrag:function(bt,Ct){this.__onDrag&&this.__onDrag(bt,Ct)},_onMouseWheel:function(bt){this.__onMouseWheel(bt)},_onMouseOut:function(bt){var Ct=this._hoveredTarget;this.fire("mouse:out",{target:Ct,e:bt}),this._hoveredTarget=null,Ct&&Ct.fire("mouseout",{e:bt});var xt=this;this._hoveredTargets.forEach(function(It){xt.fire("mouse:out",{target:Ct,e:bt}),It&&Ct.fire("mouseout",{e:bt})}),this._hoveredTargets=[],this._iTextInstances&&this._iTextInstances.forEach(function(It){It.isEditing&&It.hiddenTextarea.focus()})},_onMouseEnter:function(bt){!this._currentTransform&&!this.findTarget(bt)&&(this.fire("mouse:over",{target:null,e:bt}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(bt,Ct){this.__onOrientationChange&&this.__onOrientationChange(bt,Ct)},_onShake:function(bt,Ct){this.__onShake&&this.__onShake(bt,Ct)},_onLongPress:function(bt,Ct){this.__onLongPress&&this.__onLongPress(bt,Ct)},_onDragOver:function(bt){bt.preventDefault();var Ct=this._simpleEventHandler("dragover",bt);this._fireEnterLeaveEvents(Ct,bt)},_onContextMenu:function(bt){return this.stopContextMenu&&(bt.stopPropagation(),bt.preventDefault()),!1},_onDoubleClick:function(bt){this._cacheTransformEventData(bt),this._handleEvent(bt,"dblclick"),this._resetTransformEventData(bt)},getPointerId:function(bt){var Ct=bt.changedTouches;return Ct?Ct[0]&&Ct[0].identifier:this.enablePointerEvents?bt.pointerId:-1},_isMainEvent:function(bt){return bt.isPrimary===!0?!0:bt.isPrimary===!1?!1:bt.type==="touchend"&&bt.touches.length===0?!0:bt.changedTouches?bt.changedTouches[0].identifier===this.mainTouchId:!0},_onTouchStart:function(bt){bt.preventDefault(),this.mainTouchId===null&&(this.mainTouchId=this.getPointerId(bt)),this.__onMouseDown(bt),this._resetTransformEventData();var Ct=this.upperCanvasEl,xt=this._getEventPrefix();ft(at.document,"touchend",this._onTouchEnd,vt),ft(at.document,"touchmove",this._onMouseMove,vt),ut(Ct,xt+"down",this._onMouseDown)},_onMouseDown:function(bt){this.__onMouseDown(bt),this._resetTransformEventData();var Ct=this.upperCanvasEl,xt=this._getEventPrefix();ut(Ct,xt+"move",this._onMouseMove,vt),ft(at.document,xt+"up",this._onMouseUp),ft(at.document,xt+"move",this._onMouseMove,vt)},_onTouchEnd:function(bt){if(!(bt.touches.length>0)){this.__onMouseUp(bt),this._resetTransformEventData(),this.mainTouchId=null;var Ct=this._getEventPrefix();ut(at.document,"touchend",this._onTouchEnd,vt),ut(at.document,"touchmove",this._onMouseMove,vt);var xt=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(function(){ft(xt.upperCanvasEl,Ct+"down",xt._onMouseDown),xt._willAddMouseDown=0},400)}},_onMouseUp:function(bt){this.__onMouseUp(bt),this._resetTransformEventData();var Ct=this.upperCanvasEl,xt=this._getEventPrefix();this._isMainEvent(bt)&&(ut(at.document,xt+"up",this._onMouseUp),ut(at.document,xt+"move",this._onMouseMove,vt),ft(Ct,xt+"move",this._onMouseMove,vt))},_onMouseMove:function(bt){!this.allowTouchScrolling&&bt.preventDefault&&bt.preventDefault(),this.__onMouseMove(bt)},_onResize:function(){this.calcOffset()},_shouldRender:function(bt){var Ct=this._activeObject;return!!Ct!=!!bt||Ct&&bt&&Ct!==bt?!0:(Ct&&Ct.isEditing,!1)},__onMouseUp:function(bt){var Ct,xt=this._currentTransform,It=this._groupSelector,St=!1,Ot=!It||It.left===0&&It.top===0;if(this._cacheTransformEventData(bt),Ct=this._target,this._handleEvent(bt,"up:before"),yt(bt,pt)){this.fireRightClick&&this._handleEvent(bt,"up",pt,Ot);return}if(yt(bt,At)){this.fireMiddleClick&&this._handleEvent(bt,"up",At,Ot),this._resetTransformEventData();return}if(this.isDrawingMode&&this._isCurrentlyDrawing){this._onMouseUpInDrawingMode(bt);return}if(!!this._isMainEvent(bt)){if(xt&&(this._finalizeCurrentTransform(bt),St=xt.actionPerformed),!Ot){var Mt=Ct===this._activeObject;this._maybeGroupObjects(bt),St||(St=this._shouldRender(Ct)||!Mt&&Ct===this._activeObject)}if(Ct){if(Ct.selectable&&Ct!==this._activeObject&&Ct.activeOn==="up")this.setActiveObject(Ct,bt),St=!0;else{var jt=Ct._findTargetCorner(this.getPointer(bt,!0),at.util.isTouchEvent(bt)),Ft=Ct.controls[jt],Ut=Ft&&Ft.getMouseUpHandler(bt,Ct,Ft);if(Ut){var Qt=this.getPointer(bt);Ut(bt,xt,Qt.x,Qt.y)}}Ct.isMoving=!1}this._setCursorFromEvent(bt,Ct),this._handleEvent(bt,"up",gt,Ot),this._groupSelector=null,this._currentTransform=null,Ct&&(Ct.__corner=0),St?this.requestRenderAll():Ot||this.renderTop()}},_simpleEventHandler:function(bt,Ct){var xt=this.findTarget(Ct),It=this.targets,St={e:Ct,target:xt,subTargets:It};if(this.fire(bt,St),xt&&xt.fire(bt,St),!It)return xt;for(var Ot=0;Ot<It.length;Ot++)It[Ot].fire(bt,St);return xt},_handleEvent:function(bt,Ct,xt,It){var St=this._target,Ot=this.targets||[],Mt={e:bt,target:St,subTargets:Ot,button:xt||gt,isClick:It||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};Ct==="up"&&(Mt.currentTarget=this.findTarget(bt),Mt.currentSubTargets=this.targets),this.fire("mouse:"+Ct,Mt),St&&St.fire("mouse"+Ct,Mt);for(var jt=0;jt<Ot.length;jt++)Ot[jt].fire("mouse"+Ct,Mt)},_finalizeCurrentTransform:function(bt){var Ct=this._currentTransform,xt=Ct.target,It,St={e:bt,target:xt,transform:Ct,action:Ct.action};xt._scaling&&(xt._scaling=!1),xt.setCoords(),(Ct.actionPerformed||this.stateful&&xt.hasStateChanged())&&(Ct.actionPerformed&&(It=this._addEventOptions(St,Ct),this._fire(It,St)),this._fire("modified",St))},_addEventOptions:function(bt,Ct){var xt,It;switch(Ct.action){case"scaleX":xt="scaled",It="x";break;case"scaleY":xt="scaled",It="y";break;case"skewX":xt="skewed",It="x";break;case"skewY":xt="skewed",It="y";break;case"scale":xt="scaled",It="equally";break;case"rotate":xt="rotated";break;case"drag":xt="moved";break}return bt.by=It,xt},_onMouseDownInDrawingMode:function(bt){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(bt).requestRenderAll();var Ct=this.getPointer(bt);this.freeDrawingBrush.onMouseDown(Ct,{e:bt,pointer:Ct}),this._handleEvent(bt,"down")},_onMouseMoveInDrawingMode:function(bt){if(this._isCurrentlyDrawing){var Ct=this.getPointer(bt);this.freeDrawingBrush.onMouseMove(Ct,{e:bt,pointer:Ct})}this.setCursor(this.freeDrawingCursor),this._handleEvent(bt,"move")},_onMouseUpInDrawingMode:function(bt){var Ct=this.getPointer(bt);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:bt,pointer:Ct}),this._handleEvent(bt,"up")},__onMouseDown:function(bt){this._cacheTransformEventData(bt),this._handleEvent(bt,"down:before");var Ct=this._target;if(yt(bt,pt)){this.fireRightClick&&this._handleEvent(bt,"down",pt);return}if(yt(bt,At)){this.fireMiddleClick&&this._handleEvent(bt,"down",At);return}if(this.isDrawingMode){this._onMouseDownInDrawingMode(bt);return}if(!!this._isMainEvent(bt)&&!this._currentTransform){var xt=this._pointer;this._previousPointer=xt;var It=this._shouldRender(Ct),St=this._shouldGroup(bt,Ct);if(this._shouldClearSelection(bt,Ct)?this.discardActiveObject(bt):St&&(this._handleGrouping(bt,Ct),Ct=this._activeObject),this.selection&&(!Ct||!Ct.selectable&&!Ct.isEditing&&Ct!==this._activeObject)&&(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),Ct){var Ot=Ct===this._activeObject;Ct.selectable&&Ct.activeOn==="down"&&this.setActiveObject(Ct,bt);var Mt=Ct._findTargetCorner(this.getPointer(bt,!0),at.util.isTouchEvent(bt));if(Ct.__corner=Mt,Ct===this._activeObject&&(Mt||!St)){this._setupCurrentTransform(bt,Ct,Ot);var jt=Ct.controls[Mt],xt=this.getPointer(bt),Ft=jt&&jt.getMouseDownHandler(bt,Ct,jt);Ft&&Ft(bt,this._currentTransform,xt.x,xt.y)}}this._handleEvent(bt,"down"),(It||St)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(bt){this._resetTransformEventData(),this._pointer=this.getPointer(bt,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(bt)||null},_beforeTransform:function(bt){var Ct=this._currentTransform;this.stateful&&Ct.target.saveState(),this.fire("before:transform",{e:bt,transform:Ct})},__onMouseMove:function(bt){this._handleEvent(bt,"move:before"),this._cacheTransformEventData(bt);var Ct,xt;if(this.isDrawingMode){this._onMouseMoveInDrawingMode(bt);return}if(!!this._isMainEvent(bt)){var It=this._groupSelector;It?(xt=this._absolutePointer,It.left=xt.x-It.ex,It.top=xt.y-It.ey,this.renderTop()):this._currentTransform?this._transformObject(bt):(Ct=this.findTarget(bt)||null,this._setCursorFromEvent(bt,Ct),this._fireOverOutEvents(Ct,bt)),this._handleEvent(bt,"move"),this._resetTransformEventData()}},_fireOverOutEvents:function(bt,Ct){var xt=this._hoveredTarget,It=this._hoveredTargets,St=this.targets,Ot=Math.max(It.length,St.length);this.fireSyntheticInOutEvents(bt,Ct,{oldTarget:xt,evtOut:"mouseout",canvasEvtOut:"mouse:out",evtIn:"mouseover",canvasEvtIn:"mouse:over"});for(var Mt=0;Mt<Ot;Mt++)this.fireSyntheticInOutEvents(St[Mt],Ct,{oldTarget:It[Mt],evtOut:"mouseout",evtIn:"mouseover"});this._hoveredTarget=bt,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(bt,Ct){var xt=this._draggedoverTarget,It=this._hoveredTargets,St=this.targets,Ot=Math.max(It.length,St.length);this.fireSyntheticInOutEvents(bt,Ct,{oldTarget:xt,evtOut:"dragleave",evtIn:"dragenter"});for(var Mt=0;Mt<Ot;Mt++)this.fireSyntheticInOutEvents(St[Mt],Ct,{oldTarget:It[Mt],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=bt},fireSyntheticInOutEvents:function(bt,Ct,xt){var It,St,Ot=xt.oldTarget,Mt,jt,Ft=Ot!==bt,Ut=xt.canvasEvtIn,Qt=xt.canvasEvtOut;Ft&&(It={e:Ct,target:bt,previousTarget:Ot},St={e:Ct,target:Ot,nextTarget:bt}),jt=bt&&Ft,Mt=Ot&&Ft,Mt&&(Qt&&this.fire(Qt,St),Ot.fire(xt.evtOut,St)),jt&&(Ut&&this.fire(Ut,It),bt.fire(xt.evtIn,It))},__onMouseWheel:function(bt){this._cacheTransformEventData(bt),this._handleEvent(bt,"wheel"),this._resetTransformEventData()},_transformObject:function(bt){var Ct=this.getPointer(bt),xt=this._currentTransform;xt.reset=!1,xt.shiftKey=bt.shiftKey,xt.altKey=bt[this.centeredKey],this._performTransformAction(bt,xt,Ct),xt.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(bt,Ct,xt){var It=xt.x,St=xt.y,Ot=Ct.action,Mt=!1,jt=Ct.actionHandler;jt&&(Mt=jt(bt,Ct,It,St)),Ot==="drag"&&Mt&&(Ct.target.isMoving=!0,this.setCursor(Ct.target.moveCursor||this.moveCursor)),Ct.actionPerformed=Ct.actionPerformed||Mt},_fire:at.controlsUtils.fireEvent,_setCursorFromEvent:function(bt,Ct){if(!Ct)return this.setCursor(this.defaultCursor),!1;var xt=Ct.hoverCursor||this.hoverCursor,It=this._activeObject&&this._activeObject.type==="activeSelection"?this._activeObject:null,St=(!It||!It.contains(Ct))&&Ct._findTargetCorner(this.getPointer(bt,!0));St?this.setCursor(this.getCornerCursor(St,Ct,bt)):(Ct.subTargetCheck&&this.targets.concat().reverse().map(function(Ot){xt=Ot.hoverCursor||xt}),this.setCursor(xt))},getCornerCursor:function(bt,Ct,xt){var It=Ct.controls[bt];return It.cursorStyleHandler(xt,It,Ct)}})}(),function(){var ft=Math.min,ut=Math.max;at.util.object.extend(at.Canvas.prototype,{_shouldGroup:function(pt,At){var gt=this._activeObject;return gt&&this._isSelectionKeyPressed(pt)&&At&&At.selectable&&this.selection&&(gt!==At||gt.type==="activeSelection")&&!At.onSelect({e:pt})},_handleGrouping:function(pt,At){var gt=this._activeObject;gt.__corner||At===gt&&(At=this.findTarget(pt,!0),!At||!At.selectable)||(gt&&gt.type==="activeSelection"?this._updateActiveSelection(At,pt):this._createActiveSelection(At,pt))},_updateActiveSelection:function(pt,At){var gt=this._activeObject,vt=gt._objects.slice(0);gt.contains(pt)?(gt.removeWithUpdate(pt),this._hoveredTarget=pt,this._hoveredTargets=this.targets.concat(),gt.size()===1&&this._setActiveObject(gt.item(0),At)):(gt.addWithUpdate(pt),this._hoveredTarget=gt,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(vt,At)},_createActiveSelection:function(pt,At){var gt=this.getActiveObjects(),vt=this._createGroup(pt);this._hoveredTarget=vt,this._setActiveObject(vt,At),this._fireSelectionEvents(gt,At)},_createGroup:function(pt){var At=this._objects,gt=At.indexOf(this._activeObject)<At.indexOf(pt),vt=gt?[this._activeObject,pt]:[pt,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new at.ActiveSelection(vt,{canvas:this})},_groupSelectedObjects:function(pt){var At=this._collectObjects(pt),gt;At.length===1?this.setActiveObject(At[0],pt):At.length>1&&(gt=new at.ActiveSelection(At.reverse(),{canvas:this}),this.setActiveObject(gt,pt))},_collectObjects:function(pt){for(var At=[],gt,vt=this._groupSelector.ex,yt=this._groupSelector.ey,bt=vt+this._groupSelector.left,Ct=yt+this._groupSelector.top,xt=new at.Point(ft(vt,bt),ft(yt,Ct)),It=new at.Point(ut(vt,bt),ut(yt,Ct)),St=!this.selectionFullyContained,Ot=vt===bt&&yt===Ct,Mt=this._objects.length;Mt--&&(gt=this._objects[Mt],!(!(!gt||!gt.selectable||!gt.visible)&&(St&&gt.intersectsWithRect(xt,It,!0)||gt.isContainedWithinRect(xt,It,!0)||St&&gt.containsPoint(xt,null,!0)||St&&gt.containsPoint(It,null,!0))&&(At.push(gt),Ot))););return At.length>1&&(At=At.filter(function(jt){return!jt.onSelect({e:pt})})),At},_maybeGroupObjects:function(pt){this.selection&&this._groupSelector&&this._groupSelectedObjects(pt),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),function(){at.util.object.extend(at.StaticCanvas.prototype,{toDataURL:function(ft){ft||(ft={});var ut=ft.format||"png",pt=ft.quality||1,At=(ft.multiplier||1)*(ft.enableRetinaScaling?this.getRetinaScaling():1),gt=this.toCanvasElement(At,ft);return at.util.toDataURL(gt,ut,pt)},toCanvasElement:function(ft,ut){ft=ft||1,ut=ut||{};var pt=(ut.width||this.width)*ft,At=(ut.height||this.height)*ft,gt=this.getZoom(),vt=this.width,yt=this.height,bt=gt*ft,Ct=this.viewportTransform,xt=(Ct[4]-(ut.left||0))*ft,It=(Ct[5]-(ut.top||0))*ft,St=this.interactive,Ot=[bt,0,0,bt,xt,It],Mt=this.enableRetinaScaling,jt=at.util.createCanvasElement(),Ft=this.contextTop;return jt.width=pt,jt.height=At,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=Ot,this.width=pt,this.height=At,this.calcViewportBoundaries(),this.renderCanvas(jt.getContext("2d"),this._objects),this.viewportTransform=Ct,this.width=vt,this.height=yt,this.calcViewportBoundaries(),this.interactive=St,this.enableRetinaScaling=Mt,this.contextTop=Ft,jt}})}(),at.util.object.extend(at.StaticCanvas.prototype,{loadFromJSON:function(ft,ut,pt){if(!!ft){var At=typeof ft=="string"?JSON.parse(ft):at.util.object.clone(ft),gt=this,vt=At.clipPath,yt=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete At.clipPath,this._enlivenObjects(At.objects,function(bt){gt.clear(),gt._setBgOverlay(At,function(){vt?gt._enlivenObjects([vt],function(Ct){gt.clipPath=Ct[0],gt.__setupCanvas.call(gt,At,bt,yt,ut)}):gt.__setupCanvas.call(gt,At,bt,yt,ut)})},pt),this}},__setupCanvas:function(ft,ut,pt,At){var gt=this;ut.forEach(function(vt,yt){gt.insertAt(vt,yt)}),this.renderOnAddRemove=pt,delete ft.objects,delete ft.backgroundImage,delete ft.overlayImage,delete ft.background,delete ft.overlay,this._setOptions(ft),this.renderAll(),At&&At()},_setBgOverlay:function(ft,ut){var pt={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(!ft.backgroundImage&&!ft.overlayImage&&!ft.background&&!ft.overlay){ut&&ut();return}var At=function(){pt.backgroundImage&&pt.overlayImage&&pt.backgroundColor&&pt.overlayColor&&ut&&ut()};this.__setBgOverlay("backgroundImage",ft.backgroundImage,pt,At),this.__setBgOverlay("overlayImage",ft.overlayImage,pt,At),this.__setBgOverlay("backgroundColor",ft.background,pt,At),this.__setBgOverlay("overlayColor",ft.overlay,pt,At)},__setBgOverlay:function(ft,ut,pt,At){var gt=this;if(!ut){pt[ft]=!0,At&&At();return}ft==="backgroundImage"||ft==="overlayImage"?at.util.enlivenObjects([ut],function(vt){gt[ft]=vt[0],pt[ft]=!0,At&&At()}):this["set"+at.util.string.capitalize(ft,!0)](ut,function(){pt[ft]=!0,At&&At()})},_enlivenObjects:function(ft,ut,pt){if(!ft||ft.length===0){ut&&ut([]);return}at.util.enlivenObjects(ft,function(At){ut&&ut(At)},null,pt)},_toDataURL:function(ft,ut){this.clone(function(pt){ut(pt.toDataURL(ft))})},_toDataURLWithMultiplier:function(ft,ut,pt){this.clone(function(At){pt(At.toDataURLWithMultiplier(ft,ut))})},clone:function(ft,ut){var pt=JSON.stringify(this.toJSON(ut));this.cloneWithoutData(function(At){At.loadFromJSON(pt,function(){ft&&ft(At)})})},cloneWithoutData:function(ft){var ut=at.util.createCanvasElement();ut.width=this.width,ut.height=this.height;var pt=new at.Canvas(ut);this.backgroundImage?(pt.setBackgroundImage(this.backgroundImage.src,function(){pt.renderAll(),ft&&ft(pt)}),pt.backgroundImageOpacity=this.backgroundImageOpacity,pt.backgroundImageStretch=this.backgroundImageStretch):ft&&ft(pt)}}),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.extend,At=ut.util.object.clone,gt=ut.util.toFixed,vt=ut.util.string.capitalize,yt=ut.util.degreesToRadians,bt=!ut.isLikelyNode,Ct=2;ut.Object||(ut.Object=ut.util.createClass(ut.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgb(178,204,255)",borderDashArray:null,cornerColor:"rgb(178,204,255)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:bt,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",activeOn:"down",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),colorProperties:"fill stroke backgroundColor".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(xt){xt&&this.setOptions(xt)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=ut.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(xt){var It=ut.perfLimitSizeTotal,St=xt.width,Ot=xt.height,Mt=ut.maxCacheSideLimit,jt=ut.minCacheSideLimit;if(St<=Mt&&Ot<=Mt&&St*Ot<=It)return St<jt&&(xt.width=jt),Ot<jt&&(xt.height=jt),xt;var Ft=St/Ot,Ut=ut.util.limitDimsByArea(Ft,It),Qt=ut.util.capValue,Ht=Qt(jt,Ut.x,Mt),Zt=Qt(jt,Ut.y,Mt);return St>Ht&&(xt.zoomX/=St/Ht,xt.width=Ht,xt.capped=!0),Ot>Zt&&(xt.zoomY/=Ot/Zt,xt.height=Zt,xt.capped=!0),xt},_getCacheCanvasDimensions:function(){var xt=this.getTotalObjectScaling(),It=this._getTransformedDimensions(0,0),St=It.x*xt.scaleX/this.scaleX,Ot=It.y*xt.scaleY/this.scaleY;return{width:St+Ct,height:Ot+Ct,zoomX:xt.scaleX,zoomY:xt.scaleY,x:St,y:Ot}},_updateCacheCanvas:function(){var xt=this.canvas;if(this.noScaleCache&&xt&&xt._currentTransform){var It=xt._currentTransform.target,St=xt._currentTransform.action;if(this===It&&St.slice&&St.slice(0,5)==="scale")return!1}var Ot=this._cacheCanvas,Mt=this._limitCacheSize(this._getCacheCanvasDimensions()),jt=ut.minCacheSideLimit,Ft=Mt.width,Ut=Mt.height,Qt,Ht,Zt=Mt.zoomX,Wt=Mt.zoomY,$t=Ft!==this.cacheWidth||Ut!==this.cacheHeight,Jt=this.zoomX!==Zt||this.zoomY!==Wt,Nt=$t||Jt,Lt=0,Kt=0,Pt=!1;if($t){var ln=this._cacheCanvas.width,Gt=this._cacheCanvas.height,on=Ft>ln||Ut>Gt,tn=(Ft<ln*.9||Ut<Gt*.9)&&ln>jt&&Gt>jt;Pt=on||tn,on&&!Mt.capped&&(Ft>jt||Ut>jt)&&(Lt=Ft*.1,Kt=Ut*.1)}return this instanceof ut.Text&&this.path&&(Nt=!0,Pt=!0,Lt+=this.getHeightOfLine(0)*this.zoomX,Kt+=this.getHeightOfLine(0)*this.zoomY),Nt?(Pt?(Ot.width=Math.ceil(Ft+Lt),Ot.height=Math.ceil(Ut+Kt)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,Ot.width,Ot.height)),Qt=Mt.x/2,Ht=Mt.y/2,this.cacheTranslationX=Math.round(Ot.width/2-Qt)+Qt,this.cacheTranslationY=Math.round(Ot.height/2-Ht)+Ht,this.cacheWidth=Ft,this.cacheHeight=Ut,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(Zt,Wt),this.zoomX=Zt,this.zoomY=Wt,!0):!1},setOptions:function(xt){this._setOptions(xt),this._initGradient(xt.fill,"fill"),this._initGradient(xt.stroke,"stroke"),this._initPattern(xt.fill,"fill"),this._initPattern(xt.stroke,"stroke")},transform:function(xt){var It=this.group&&!this.group._transformDone||this.group&&this.canvas&&xt===this.canvas.contextTop,St=this.calcTransformMatrix(!It);xt.transform(St[0],St[1],St[2],St[3],St[4],St[5])},toObject:function(xt){var It=ut.Object.NUM_FRACTION_DIGITS,St={type:this.type,version:ut.version,originX:this.originX,originY:this.originY,left:gt(this.left,It),top:gt(this.top,It),width:gt(this.width,It),height:gt(this.height,It),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:gt(this.strokeWidth,It),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:gt(this.strokeMiterLimit,It),scaleX:gt(this.scaleX,It),scaleY:gt(this.scaleY,It),angle:gt(this.angle,It),flipX:this.flipX,flipY:this.flipY,opacity:gt(this.opacity,It),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:gt(this.skewX,It),skewY:gt(this.skewY,It)};return this.clipPath&&!this.clipPath.excludeFromExport&&(St.clipPath=this.clipPath.toObject(xt),St.clipPath.inverted=this.clipPath.inverted,St.clipPath.absolutePositioned=this.clipPath.absolutePositioned),ut.util.populateWithProperties(this,St,xt),this.includeDefaultValues||(St=this._removeDefaultValues(St)),St},toDatalessObject:function(xt){return this.toObject(xt)},_removeDefaultValues:function(xt){var It=ut.util.getKlass(xt.type).prototype,St=It.stateProperties;return St.forEach(function(Ot){if(!(Ot==="left"||Ot==="top")){xt[Ot]===It[Ot]&&delete xt[Ot];var Mt=Object.prototype.toString.call(xt[Ot])==="[object Array]"&&Object.prototype.toString.call(It[Ot])==="[object Array]";Mt&&xt[Ot].length===0&&It[Ot].length===0&&delete xt[Ot]}}),xt},toString:function(){return"#<fabric."+vt(this.type)+">"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var xt=ut.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(xt.scaleX),scaleY:Math.abs(xt.scaleY)}},getTotalObjectScaling:function(){var xt=this.getObjectScaling(),It=xt.scaleX,St=xt.scaleY;if(this.canvas){var Ot=this.canvas.getZoom(),Mt=this.canvas.getRetinaScaling();It*=Ot*Mt,St*=Ot*Mt}return{scaleX:It,scaleY:St}},getObjectOpacity:function(){var xt=this.opacity;return this.group&&(xt*=this.group.getObjectOpacity()),xt},_set:function(xt,It){var St=xt==="scaleX"||xt==="scaleY",Ot=this[xt]!==It,Mt=!1;return St&&(It=this._constrainScale(It)),xt==="scaleX"&&It<0?(this.flipX=!this.flipX,It*=-1):xt==="scaleY"&&It<0?(this.flipY=!this.flipY,It*=-1):xt==="shadow"&&It&&!(It instanceof ut.Shadow)?It=new ut.Shadow(It):xt==="dirty"&&this.group&&this.group.set("dirty",It),this[xt]=It,Ot&&(Mt=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(xt)>-1?(this.dirty=!0,Mt&&this.group.set("dirty",!0)):Mt&&this.stateProperties.indexOf(xt)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:ut.iMatrix.concat()},isNotVisible:function(){return this.opacity===0||!this.width&&!this.height&&this.strokeWidth===0||!this.visible},render:function(xt){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(xt.save(),this._setupCompositeOperation(xt),this.drawSelectionBackground(xt),this.transform(xt),this._setOpacity(xt),this._setShadow(xt,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(xt)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(xt),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),xt.restore())},renderCache:function(xt){xt=xt||{},this._cacheCanvas||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,xt.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&this.stroke!=="transparent"&&this.strokeWidth!==0},hasFill:function(){return this.fill&&this.fill!=="transparent"},needsItsOwnCache:function(){return!!(this.paintFirst==="stroke"&&this.hasFill()&&this.hasStroke()&&typeof this.shadow=="object"||this.clipPath)},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(this.shadow.offsetX!==0||this.shadow.offsetY!==0)},drawClipPathOnCache:function(xt){var It=this.clipPath;if(xt.save(),It.inverted?xt.globalCompositeOperation="destination-out":xt.globalCompositeOperation="destination-in",It.absolutePositioned){var St=ut.util.invertTransform(this.calcTransformMatrix());xt.transform(St[0],St[1],St[2],St[3],St[4],St[5])}It.transform(xt),xt.scale(1/It.zoomX,1/It.zoomY),xt.drawImage(It._cacheCanvas,-It.cacheTranslationX,-It.cacheTranslationY),xt.restore()},drawObject:function(xt,It){var St=this.fill,Ot=this.stroke;It?(this.fill="black",this.stroke="",this._setClippingProperties(xt)):this._renderBackground(xt),this._render(xt),this._drawClipPath(xt),this.fill=St,this.stroke=Ot},_drawClipPath:function(xt){var It=this.clipPath;!It||(It.canvas=this.canvas,It.shouldCache(),It._transformDone=!0,It.renderCache({forClipping:!0}),this.drawClipPathOnCache(xt))},drawCacheOnCanvas:function(xt){xt.scale(1/this.zoomX,1/this.zoomY),xt.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(xt){if(this.isNotVisible())return!1;if(this._cacheCanvas&&!xt&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&!xt){var It=this.cacheWidth/this.zoomX,St=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-It/2,-St/2,It,St)}return!0}return!1},_renderBackground:function(xt){if(!!this.backgroundColor){var It=this._getNonTransformedDimensions();xt.fillStyle=this.backgroundColor,xt.fillRect(-It.x/2,-It.y/2,It.x,It.y),this._removeShadow(xt)}},_setOpacity:function(xt){this.group&&!this.group._transformDone?xt.globalAlpha=this.getObjectOpacity():xt.globalAlpha*=this.opacity},_setStrokeStyles:function(xt,It){var St=It.stroke;St&&(xt.lineWidth=It.strokeWidth,xt.lineCap=It.strokeLineCap,xt.lineDashOffset=It.strokeDashOffset,xt.lineJoin=It.strokeLineJoin,xt.miterLimit=It.strokeMiterLimit,St.toLive?St.gradientUnits==="percentage"||St.gradientTransform||St.patternTransform?this._applyPatternForTransformedGradient(xt,St):(xt.strokeStyle=St.toLive(xt,this),this._applyPatternGradientTransform(xt,St)):xt.strokeStyle=It.stroke)},_setFillStyles:function(xt,It){var St=It.fill;St&&(St.toLive?(xt.fillStyle=St.toLive(xt,this),this._applyPatternGradientTransform(xt,It.fill)):xt.fillStyle=St)},_setClippingProperties:function(xt){xt.globalAlpha=1,xt.strokeStyle="transparent",xt.fillStyle="#000000"},_setLineDash:function(xt,It){!It||It.length===0||(1&It.length&&It.push.apply(It,It),xt.setLineDash(It))},_renderControls:function(xt,It){var St=this.getViewportTransform(),Ot=this.calcTransformMatrix(),Mt,jt,Ft;It=It||{},jt=typeof It.hasBorders!="undefined"?It.hasBorders:this.hasBorders,Ft=typeof It.hasControls!="undefined"?It.hasControls:this.hasControls,Ot=ut.util.multiplyTransformMatrices(St,Ot),Mt=ut.util.qrDecompose(Ot),xt.save(),xt.translate(Mt.translateX,Mt.translateY),xt.lineWidth=1*this.borderScaleFactor,this.group||(xt.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),xt.rotate(yt(Mt.angle)),It.forActiveSelection||this.group?jt&&this.drawBordersInGroup(xt,Mt,It):jt&&this.drawBorders(xt,It),Ft&&this.drawControls(xt,It),xt.restore()},_setShadow:function(xt){if(!!this.shadow){var It=this.shadow,St=this.canvas,Ot,Mt=St&&St.viewportTransform[0]||1,jt=St&&St.viewportTransform[3]||1;It.nonScaling?Ot={scaleX:1,scaleY:1}:Ot=this.getObjectScaling(),St&&St._isRetinaScaling()&&(Mt*=ut.devicePixelRatio,jt*=ut.devicePixelRatio),xt.shadowColor=It.color,xt.shadowBlur=It.blur*ut.browserShadowBlurConstant*(Mt+jt)*(Ot.scaleX+Ot.scaleY)/4,xt.shadowOffsetX=It.offsetX*Mt*Ot.scaleX,xt.shadowOffsetY=It.offsetY*jt*Ot.scaleY}},_removeShadow:function(xt){!this.shadow||(xt.shadowColor="",xt.shadowBlur=xt.shadowOffsetX=xt.shadowOffsetY=0)},_applyPatternGradientTransform:function(xt,It){if(!It||!It.toLive)return{offsetX:0,offsetY:0};var St=It.gradientTransform||It.patternTransform,Ot=-this.width/2+It.offsetX||0,Mt=-this.height/2+It.offsetY||0;return It.gradientUnits==="percentage"?xt.transform(this.width,0,0,this.height,Ot,Mt):xt.transform(1,0,0,1,Ot,Mt),St&&xt.transform(St[0],St[1],St[2],St[3],St[4],St[5]),{offsetX:Ot,offsetY:Mt}},_renderPaintInOrder:function(xt){this.paintFirst==="stroke"?(this._renderStroke(xt),this._renderFill(xt)):(this._renderFill(xt),this._renderStroke(xt))},_render:function(){},_renderFill:function(xt){!this.fill||(xt.save(),this._setFillStyles(xt,this),this.fillRule==="evenodd"?xt.fill("evenodd"):xt.fill(),xt.restore())},_renderStroke:function(xt){if(!(!this.stroke||this.strokeWidth===0)){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(xt),xt.save(),this.strokeUniform&&this.group){var It=this.getObjectScaling();xt.scale(1/It.scaleX,1/It.scaleY)}else this.strokeUniform&&xt.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(xt,this.strokeDashArray),this._setStrokeStyles(xt,this),xt.stroke(),xt.restore()}},_applyPatternForTransformedGradient:function(xt,It){var St=this._limitCacheSize(this._getCacheCanvasDimensions()),Ot=ut.util.createCanvasElement(),Mt,jt=this.canvas.getRetinaScaling(),Ft=St.x/this.scaleX/jt,Ut=St.y/this.scaleY/jt;Ot.width=Ft,Ot.height=Ut,Mt=Ot.getContext("2d"),Mt.beginPath(),Mt.moveTo(0,0),Mt.lineTo(Ft,0),Mt.lineTo(Ft,Ut),Mt.lineTo(0,Ut),Mt.closePath(),Mt.translate(Ft/2,Ut/2),Mt.scale(St.zoomX/this.scaleX/jt,St.zoomY/this.scaleY/jt),this._applyPatternGradientTransform(Mt,It),Mt.fillStyle=It.toLive(xt),Mt.fill(),xt.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),xt.scale(jt*this.scaleX/St.zoomX,jt*this.scaleY/St.zoomY),xt.strokeStyle=Mt.createPattern(Ot,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var xt=ut.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",xt.scaleX),this.set("scaleY",xt.scaleY),this.angle=xt.angle,this.skewX=xt.skewX,this.skewY=0}},_removeTransformMatrix:function(xt){var It=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),It=ut.util.transformPoint(It,this.transformMatrix)),this.transformMatrix=null,xt&&(this.scaleX*=xt.scaleX,this.scaleY*=xt.scaleY,this.cropX=xt.cropX,this.cropY=xt.cropY,It.x+=xt.offsetLeft,It.y+=xt.offsetTop,this.width=xt.width,this.height=xt.height),this.setPositionByOrigin(It,"center","center")},clone:function(xt,It){var St=this.toObject(It);this.constructor.fromObject?this.constructor.fromObject(St,xt):ut.Object._fromObject("Object",St,xt)},cloneAsImage:function(xt,It){var St=this.toCanvasElement(It);return xt&&xt(new ut.Image(St)),this},toCanvasElement:function(xt){xt||(xt={});var It=ut.util,St=It.saveObjectTransform(this),Ot=this.group,Mt=this.shadow,jt=Math.abs,Ft=(xt.multiplier||1)*(xt.enableRetinaScaling?ut.devicePixelRatio:1);delete this.group,xt.withoutTransform&&It.resetObjectTransform(this),xt.withoutShadow&&(this.shadow=null);var Ut=ut.util.createCanvasElement(),Qt=this.getBoundingRect(!0,!0),Ht=this.shadow,Zt,Wt={x:0,y:0},$t,Jt,Nt;Ht&&($t=Ht.blur,Ht.nonScaling?Zt={scaleX:1,scaleY:1}:Zt=this.getObjectScaling(),Wt.x=2*Math.round(jt(Ht.offsetX)+$t)*jt(Zt.scaleX),Wt.y=2*Math.round(jt(Ht.offsetY)+$t)*jt(Zt.scaleY)),Jt=Qt.width+Wt.x,Nt=Qt.height+Wt.y,Ut.width=Math.ceil(Jt),Ut.height=Math.ceil(Nt);var Lt=new ut.StaticCanvas(Ut,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});xt.format==="jpeg"&&(Lt.backgroundColor="#fff"),this.setPositionByOrigin(new ut.Point(Lt.width/2,Lt.height/2),"center","center");var Kt=this.canvas;Lt.add(this);var Pt=Lt.toCanvasElement(Ft||1,xt);return this.shadow=Mt,this.set("canvas",Kt),Ot&&(this.group=Ot),this.set(St).setCoords(),Lt._objects=[],Lt.dispose(),Lt=null,Pt},toDataURL:function(xt){return xt||(xt={}),ut.util.toDataURL(this.toCanvasElement(xt),xt.format||"png",xt.quality||1)},isType:function(xt){return this.type===xt},complexity:function(){return 1},toJSON:function(xt){return this.toObject(xt)},rotate:function(xt){var It=(this.originX!=="center"||this.originY!=="center")&&this.centeredRotation;return It&&this._setOriginToCenter(),this.set("angle",xt),It&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(xt,It){It=It||this.canvas.getPointer(xt);var St=new ut.Point(It.x,It.y),Ot=this._getLeftTopCoords();return this.angle&&(St=ut.util.rotatePoint(St,Ot,yt(-this.angle))),{x:St.x-Ot.x,y:St.y-Ot.y}},_setupCompositeOperation:function(xt){this.globalCompositeOperation&&(xt.globalCompositeOperation=this.globalCompositeOperation)}}),ut.util.createAccessors&&ut.util.createAccessors(ut.Object),pt(ut.Object.prototype,ut.Observable),ut.Object.NUM_FRACTION_DIGITS=2,ut.Object._fromObject=function(xt,It,St,Ot){var Mt=ut[xt];It=At(It,!0),ut.util.enlivenPatterns([It.fill,It.stroke],function(jt){typeof jt[0]!="undefined"&&(It.fill=jt[0]),typeof jt[1]!="undefined"&&(It.stroke=jt[1]),ut.util.enlivenObjects([It.clipPath],function(Ft){It.clipPath=Ft[0];var Ut=Ot?new Mt(It[Ot],It):new Mt(It);St&&St(Ut)})})},ut.Object.__uid=0)}(ot),function(){var ft=at.util.degreesToRadians,ut={left:-.5,center:0,right:.5},pt={top:-.5,center:0,bottom:.5};at.util.object.extend(at.Object.prototype,{translateToGivenOrigin:function(At,gt,vt,yt,bt){var Ct=At.x,xt=At.y,It,St,Ot;return typeof gt=="string"?gt=ut[gt]:gt-=.5,typeof yt=="string"?yt=ut[yt]:yt-=.5,It=yt-gt,typeof vt=="string"?vt=pt[vt]:vt-=.5,typeof bt=="string"?bt=pt[bt]:bt-=.5,St=bt-vt,(It||St)&&(Ot=this._getTransformedDimensions(),Ct=At.x+It*Ot.x,xt=At.y+St*Ot.y),new at.Point(Ct,xt)},translateToCenterPoint:function(At,gt,vt){var yt=this.translateToGivenOrigin(At,gt,vt,"center","center");return this.angle?at.util.rotatePoint(yt,At,ft(this.angle)):yt},translateToOriginPoint:function(At,gt,vt){var yt=this.translateToGivenOrigin(At,"center","center",gt,vt);return this.angle?at.util.rotatePoint(yt,At,ft(this.angle)):yt},getCenterPoint:function(){var At=new at.Point(this.left,this.top);return this.translateToCenterPoint(At,this.originX,this.originY)},getPointByOrigin:function(At,gt){var vt=this.getCenterPoint();return this.translateToOriginPoint(vt,At,gt)},toLocalPoint:function(At,gt,vt){var yt=this.getCenterPoint(),bt,Ct;return typeof gt!="undefined"&&typeof vt!="undefined"?bt=this.translateToGivenOrigin(yt,"center","center",gt,vt):bt=new at.Point(this.left,this.top),Ct=new at.Point(At.x,At.y),this.angle&&(Ct=at.util.rotatePoint(Ct,yt,-ft(this.angle))),Ct.subtractEquals(bt)},setPositionByOrigin:function(At,gt,vt){var yt=this.translateToCenterPoint(At,gt,vt),bt=this.translateToOriginPoint(yt,this.originX,this.originY);this.set("left",bt.x),this.set("top",bt.y)},adjustPosition:function(At){var gt=ft(this.angle),vt=this.getScaledWidth(),yt=at.util.cos(gt)*vt,bt=at.util.sin(gt)*vt,Ct,xt;typeof this.originX=="string"?Ct=ut[this.originX]:Ct=this.originX-.5,typeof At=="string"?xt=ut[At]:xt=At-.5,this.left+=yt*(xt-Ct),this.top+=bt*(xt-Ct),this.setCoords(),this.originX=At},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var At=this.getCenterPoint();this.originX="center",this.originY="center",this.left=At.x,this.top=At.y},_resetOrigin:function(){var At=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=At.x,this.top=At.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){function ft(vt){return[new at.Point(vt.tl.x,vt.tl.y),new at.Point(vt.tr.x,vt.tr.y),new at.Point(vt.br.x,vt.br.y),new at.Point(vt.bl.x,vt.bl.y)]}var ut=at.util,pt=ut.degreesToRadians,At=ut.multiplyTransformMatrices,gt=ut.transformPoint;ut.object.extend(at.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(vt,yt){return yt?vt?this.calcACoords():this.calcLineCoords():((!this.aCoords||!this.lineCoords)&&this.setCoords(!0),vt?this.aCoords:this.lineCoords)},getCoords:function(vt,yt){return ft(this._getCoords(vt,yt))},intersectsWithRect:function(vt,yt,bt,Ct){var xt=this.getCoords(bt,Ct),It=at.Intersection.intersectPolygonRectangle(xt,vt,yt);return It.status==="Intersection"},intersectsWithObject:function(vt,yt,bt){var Ct=at.Intersection.intersectPolygonPolygon(this.getCoords(yt,bt),vt.getCoords(yt,bt));return Ct.status==="Intersection"||vt.isContainedWithinObject(this,yt,bt)||this.isContainedWithinObject(vt,yt,bt)},isContainedWithinObject:function(vt,yt,bt){for(var Ct=this.getCoords(yt,bt),xt=yt?vt.aCoords:vt.lineCoords,It=0,St=vt._getImageLines(xt);It<4;It++)if(!vt.containsPoint(Ct[It],St))return!1;return!0},isContainedWithinRect:function(vt,yt,bt,Ct){var xt=this.getBoundingRect(bt,Ct);return xt.left>=vt.x&&xt.left+xt.width<=yt.x&&xt.top>=vt.y&&xt.top+xt.height<=yt.y},containsPoint:function(vt,It,bt,Ct){var xt=this._getCoords(bt,Ct),It=It||this._getImageLines(xt),St=this._findCrossPoints(vt,It);return St!==0&&St%2===1},isOnScreen:function(vt){if(!this.canvas)return!1;var yt=this.canvas.vptCoords.tl,bt=this.canvas.vptCoords.br,Ct=this.getCoords(!0,vt);return Ct.some(function(xt){return xt.x<=bt.x&&xt.x>=yt.x&&xt.y<=bt.y&&xt.y>=yt.y})||this.intersectsWithRect(yt,bt,!0,vt)?!0:this._containsCenterOfCanvas(yt,bt,vt)},_containsCenterOfCanvas:function(vt,yt,bt){var Ct={x:(vt.x+yt.x)/2,y:(vt.y+yt.y)/2};return!!this.containsPoint(Ct,null,!0,bt)},isPartiallyOnScreen:function(vt){if(!this.canvas)return!1;var yt=this.canvas.vptCoords.tl,bt=this.canvas.vptCoords.br;if(this.intersectsWithRect(yt,bt,!0,vt))return!0;var Ct=this.getCoords(!0,vt).every(function(xt){return(xt.x>=bt.x||xt.x<=yt.x)&&(xt.y>=bt.y||xt.y<=yt.y)});return Ct&&this._containsCenterOfCanvas(yt,bt,vt)},_getImageLines:function(vt){var yt={topline:{o:vt.tl,d:vt.tr},rightline:{o:vt.tr,d:vt.br},bottomline:{o:vt.br,d:vt.bl},leftline:{o:vt.bl,d:vt.tl}};return yt},_findCrossPoints:function(vt,yt){var bt,Ct,xt,It,St,Ot=0,Mt;for(var jt in yt)if(Mt=yt[jt],!(Mt.o.y<vt.y&&Mt.d.y<vt.y)&&!(Mt.o.y>=vt.y&&Mt.d.y>=vt.y)&&(Mt.o.x===Mt.d.x&&Mt.o.x>=vt.x?St=Mt.o.x:(bt=0,Ct=(Mt.d.y-Mt.o.y)/(Mt.d.x-Mt.o.x),xt=vt.y-bt*vt.x,It=Mt.o.y-Ct*Mt.o.x,St=-(xt-It)/(bt-Ct)),St>=vt.x&&(Ot+=1),Ot===2))break;return Ot},getBoundingRect:function(vt,yt){var bt=this.getCoords(vt,yt);return ut.makeBoundingBoxFromPoints(bt)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(vt){return Math.abs(vt)<this.minScaleLimit?vt<0?-this.minScaleLimit:this.minScaleLimit:vt===0?1e-4:vt},scale:function(vt){return this._set("scaleX",vt),this._set("scaleY",vt),this.setCoords()},scaleToWidth:function(vt,yt){var bt=this.getBoundingRect(yt).width/this.getScaledWidth();return this.scale(vt/this.width/bt)},scaleToHeight:function(vt,yt){var bt=this.getBoundingRect(yt).height/this.getScaledHeight();return this.scale(vt/this.height/bt)},calcCoords:function(vt){return vt?this.calcACoords():this.calcOCoords()},calcLineCoords:function(){var vt=this.getViewportTransform(),yt=this.padding,bt=pt(this.angle),Ct=ut.cos(bt),xt=ut.sin(bt),It=Ct*yt,St=xt*yt,Ot=It+St,Mt=It-St,jt=this.calcACoords(),Ft={tl:gt(jt.tl,vt),tr:gt(jt.tr,vt),bl:gt(jt.bl,vt),br:gt(jt.br,vt)};return yt&&(Ft.tl.x-=Mt,Ft.tl.y-=Ot,Ft.tr.x+=Ot,Ft.tr.y-=Mt,Ft.bl.x-=Ot,Ft.bl.y+=Mt,Ft.br.x+=Mt,Ft.br.y+=Ot),Ft},calcOCoords:function(){var vt=this._calcRotateMatrix(),yt=this._calcTranslateMatrix(),bt=this.getViewportTransform(),Ct=At(bt,yt),xt=At(Ct,vt),xt=At(xt,[1/bt[0],0,0,1/bt[3],0,0]),It=this._calculateCurrentDimensions(),St={};return this.forEachControl(function(Ot,Mt,jt){St[Mt]=Ot.positionHandler(It,xt,jt)}),St},calcACoords:function(){var vt=this._calcRotateMatrix(),yt=this._calcTranslateMatrix(),bt=At(yt,vt),Ct=this._getTransformedDimensions(),xt=Ct.x/2,It=Ct.y/2;return{tl:gt({x:-xt,y:-It},bt),tr:gt({x:xt,y:-It},bt),bl:gt({x:-xt,y:It},bt),br:gt({x:xt,y:It},bt)}},setCoords:function(vt){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),vt?this:(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords(),this)},_calcRotateMatrix:function(){return ut.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var vt=this.getCenterPoint();return[1,0,0,1,vt.x,vt.y]},transformMatrixKey:function(vt){var yt="_",bt="";return!vt&&this.group&&(bt=this.group.transformMatrixKey(vt)+yt),bt+this.top+yt+this.left+yt+this.scaleX+yt+this.scaleY+yt+this.skewX+yt+this.skewY+yt+this.angle+yt+this.originX+yt+this.originY+yt+this.width+yt+this.height+yt+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(vt){var yt=this.calcOwnMatrix();if(vt||!this.group)return yt;var bt=this.transformMatrixKey(vt),Ct=this.matrixCache||(this.matrixCache={});return Ct.key===bt?Ct.value:(this.group&&(yt=At(this.group.calcTransformMatrix(!1),yt)),Ct.key=bt,Ct.value=yt,yt)},calcOwnMatrix:function(){var vt=this.transformMatrixKey(!0),yt=this.ownMatrixCache||(this.ownMatrixCache={});if(yt.key===vt)return yt.value;var bt=this._calcTranslateMatrix(),Ct={angle:this.angle,translateX:bt[4],translateY:bt[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return yt.key=vt,yt.value=ut.composeMatrix(Ct),yt.value},_calcDimensionsTransformMatrix:function(vt,yt,bt){return ut.calcDimensionsMatrix({skewX:vt,skewY:yt,scaleX:this.scaleX*(bt&&this.flipX?-1:1),scaleY:this.scaleY*(bt&&this.flipY?-1:1)})},_getNonTransformedDimensions:function(){var vt=this.strokeWidth,yt=this.width+vt,bt=this.height+vt;return{x:yt,y:bt}},_getTransformedDimensions:function(vt,yt){typeof vt=="undefined"&&(vt=this.skewX),typeof yt=="undefined"&&(yt=this.skewY);var bt,Ct,xt,It=vt===0&&yt===0;if(this.strokeUniform?(Ct=this.width,xt=this.height):(bt=this._getNonTransformedDimensions(),Ct=bt.x,xt=bt.y),It)return this._finalizeDimensions(Ct*this.scaleX,xt*this.scaleY);var St=ut.sizeAfterTransform(Ct,xt,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:vt,skewY:yt});return this._finalizeDimensions(St.x,St.y)},_finalizeDimensions:function(vt,yt){return this.strokeUniform?{x:vt+this.strokeWidth,y:yt+this.strokeWidth}:{x:vt,y:yt}},_calculateCurrentDimensions:function(){var vt=this.getViewportTransform(),yt=this._getTransformedDimensions(),bt=gt(yt,vt,!0);return bt.scalarAdd(2*this.padding)}})}(),at.util.object.extend(at.Object.prototype,{sendToBack:function(){return this.group?at.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?at.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(ft){return this.group?at.StaticCanvas.prototype.sendBackwards.call(this.group,this,ft):this.canvas&&this.canvas.sendBackwards(this,ft),this},bringForward:function(ft){return this.group?at.StaticCanvas.prototype.bringForward.call(this.group,this,ft):this.canvas&&this.canvas.bringForward(this,ft),this},moveTo:function(ft){return this.group&&this.group.type!=="activeSelection"?at.StaticCanvas.prototype.moveTo.call(this.group,this,ft):this.canvas&&this.canvas.moveTo(this,ft),this}}),function(){function ft(pt,At){if(At){if(At.toLive)return pt+": url(#SVGID_"+At.id+"); ";var gt=new at.Color(At),vt=pt+": "+gt.toRgb()+"; ",yt=gt.getAlpha();return yt!==1&&(vt+=pt+"-opacity: "+yt.toString()+"; "),vt}else return pt+": none; "}var ut=at.util.toFixed;at.util.object.extend(at.Object.prototype,{getSvgStyles:function(pt){var At=this.fillRule?this.fillRule:"nonzero",gt=this.strokeWidth?this.strokeWidth:"0",vt=this.strokeDashArray?this.strokeDashArray.join(" "):"none",yt=this.strokeDashOffset?this.strokeDashOffset:"0",bt=this.strokeLineCap?this.strokeLineCap:"butt",Ct=this.strokeLineJoin?this.strokeLineJoin:"miter",xt=this.strokeMiterLimit?this.strokeMiterLimit:"4",It=typeof this.opacity!="undefined"?this.opacity:"1",St=this.visible?"":" visibility: hidden;",Ot=pt?"":this.getSvgFilter(),Mt=ft("fill",this.fill),jt=ft("stroke",this.stroke);return[jt,"stroke-width: ",gt,"; ","stroke-dasharray: ",vt,"; ","stroke-linecap: ",bt,"; ","stroke-dashoffset: ",yt,"; ","stroke-linejoin: ",Ct,"; ","stroke-miterlimit: ",xt,"; ",Mt,"fill-rule: ",At,"; ","opacity: ",It,";",Ot,St].join("")},getSvgSpanStyles:function(pt,At){var gt="; ",yt=pt.fontFamily?"font-family: "+(pt.fontFamily.indexOf("'")===-1&&pt.fontFamily.indexOf('"')===-1?"'"+pt.fontFamily+"'":pt.fontFamily)+gt:"",vt=pt.strokeWidth?"stroke-width: "+pt.strokeWidth+gt:"",yt=yt,bt=pt.fontSize?"font-size: "+pt.fontSize+"px"+gt:"",Ct=pt.fontStyle?"font-style: "+pt.fontStyle+gt:"",xt=pt.fontWeight?"font-weight: "+pt.fontWeight+gt:"",It=pt.fill?ft("fill",pt.fill):"",St=pt.stroke?ft("stroke",pt.stroke):"",Ot=this.getSvgTextDecoration(pt),Mt=pt.deltaY?"baseline-shift: "+-pt.deltaY+"; ":"";return Ot&&(Ot="text-decoration: "+Ot+gt),[St,vt,yt,bt,Ct,xt,Ot,It,Mt,At?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(pt){return["overline","underline","line-through"].filter(function(At){return pt[At.replace("-","")]}).join(" ")},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""},getSvgCommons:function(){return[this.id?'id="'+this.id+'" ':"",this.clipPath?'clip-path="url(#'+this.clipPath.clipPathId+')" ':""].join("")},getSvgTransform:function(pt,At){var gt=pt?this.calcTransformMatrix():this.calcOwnMatrix(),vt='transform="'+at.util.matrixToSVG(gt);return vt+(At||"")+'" '},_setSVGBg:function(pt){if(this.backgroundColor){var At=at.Object.NUM_FRACTION_DIGITS;pt.push("		<rect ",this._getFillAttributes(this.backgroundColor),' x="',ut(-this.width/2,At),'" y="',ut(-this.height/2,At),'" width="',ut(this.width,At),'" height="',ut(this.height,At),`"></rect>
`)}},toSVG:function(pt){return this._createBaseSVGMarkup(this._toSVG(pt),{reviver:pt})},toClipPathSVG:function(pt){return"	"+this._createBaseClipPathSVGMarkup(this._toSVG(pt),{reviver:pt})},_createBaseClipPathSVGMarkup:function(pt,At){At=At||{};var gt=At.reviver,vt=At.additionalTransform||"",yt=[this.getSvgTransform(!0,vt),this.getSvgCommons()].join(""),bt=pt.indexOf("COMMON_PARTS");return pt[bt]=yt,gt?gt(pt.join("")):pt.join("")},_createBaseSVGMarkup:function(pt,At){At=At||{};var gt=At.noStyle,vt=At.reviver,yt=gt?"":'style="'+this.getSvgStyles()+'" ',bt=At.withShadow?'style="'+this.getSvgFilter()+'" ':"",Ct=this.clipPath,xt=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",It=Ct&&Ct.absolutePositioned,St=this.stroke,Ot=this.fill,Mt=this.shadow,jt,Ft=[],Ut,Qt=pt.indexOf("COMMON_PARTS"),Ht=At.additionalTransform;return Ct&&(Ct.clipPathId="CLIPPATH_"+at.Object.__uid++,Ut='<clipPath id="'+Ct.clipPathId+`" >
`+Ct.toClipPathSVG(vt)+`</clipPath>
`),It&&Ft.push("<g ",bt,this.getSvgCommons(),` >
`),Ft.push("<g ",this.getSvgTransform(!1),It?"":bt+this.getSvgCommons(),` >
`),jt=[yt,xt,gt?"":this.addPaintOrder()," ",Ht?'transform="'+Ht+'" ':""].join(""),pt[Qt]=jt,Ot&&Ot.toLive&&Ft.push(Ot.toSVG(this)),St&&St.toLive&&Ft.push(St.toSVG(this)),Mt&&Ft.push(Mt.toSVG(this)),Ct&&Ft.push(Ut),Ft.push(pt.join("")),Ft.push(`</g>
`),It&&Ft.push(`</g>
`),vt?vt(Ft.join("")):Ft.join("")},addPaintOrder:function(){return this.paintFirst!=="fill"?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var ft=at.util.object.extend,ut="stateProperties";function pt(gt,vt,yt){var bt={},Ct=!0;yt.forEach(function(xt){bt[xt]=gt[xt]}),ft(gt[vt],bt,Ct)}function At(gt,vt,yt){if(gt===vt)return!0;if(Array.isArray(gt)){if(!Array.isArray(vt)||gt.length!==vt.length)return!1;for(var bt=0,Ct=gt.length;bt<Ct;bt++)if(!At(gt[bt],vt[bt]))return!1;return!0}else if(gt&&typeof gt=="object"){var xt=Object.keys(gt),It;if(!vt||typeof vt!="object"||!yt&&xt.length!==Object.keys(vt).length)return!1;for(var bt=0,Ct=xt.length;bt<Ct;bt++)if(It=xt[bt],!(It==="canvas"||It==="group")&&!At(gt[It],vt[It]))return!1;return!0}}at.util.object.extend(at.Object.prototype,{hasStateChanged:function(gt){gt=gt||ut;var vt="_"+gt;return Object.keys(this[vt]).length<this[gt].length?!0:!At(this[vt],this,!0)},saveState:function(gt){var vt=gt&&gt.propertySet||ut,yt="_"+vt;return this[yt]?(pt(this,yt,this[vt]),gt&&gt.stateProperties&&pt(this,yt,gt.stateProperties),this):this.setupState(gt)},setupState:function(gt){gt=gt||{};var vt=gt.propertySet||ut;return gt.propertySet=vt,this["_"+vt]={},this.saveState(gt),this}})}(),function(){var ft=at.util.degreesToRadians;at.util.object.extend(at.Object.prototype,{_findTargetCorner:function(ut,pt){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var At=ut.x,gt=ut.y,vt,yt,bt=Object.keys(this.oCoords),Ct=bt.length-1,xt;for(this.__corner=0;Ct>=0;Ct--)if(xt=bt[Ct],!!this.isControlVisible(xt)&&(yt=this._getImageLines(pt?this.oCoords[xt].touchCorner:this.oCoords[xt].corner),vt=this._findCrossPoints({x:At,y:gt},yt),vt!==0&&vt%2===1))return this.__corner=xt,xt;return!1},forEachControl:function(ut){for(var pt in this.controls)ut(this.controls[pt],pt,this)},_setCornerCoords:function(){var ut=this.oCoords;for(var pt in ut){var At=this.controls[pt];ut[pt].corner=At.calcCornerCoords(this.angle,this.cornerSize,ut[pt].x,ut[pt].y,!1),ut[pt].touchCorner=At.calcCornerCoords(this.angle,this.touchCornerSize,ut[pt].x,ut[pt].y,!0)}},drawSelectionBackground:function(ut){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;ut.save();var pt=this.getCenterPoint(),At=this._calculateCurrentDimensions(),gt=this.canvas.viewportTransform;return ut.translate(pt.x,pt.y),ut.scale(1/gt[0],1/gt[3]),ut.rotate(ft(this.angle)),ut.fillStyle=this.selectionBackgroundColor,ut.fillRect(-At.x/2,-At.y/2,At.x,At.y),ut.restore(),this},drawBorders:function(ut,pt){pt=pt||{};var At=this._calculateCurrentDimensions(),gt=this.borderScaleFactor,vt=At.x+gt,yt=At.y+gt,bt=typeof pt.hasControls!="undefined"?pt.hasControls:this.hasControls,Ct=!1;return ut.save(),ut.strokeStyle=pt.borderColor||this.borderColor,this._setLineDash(ut,pt.borderDashArray||this.borderDashArray),ut.strokeRect(-vt/2,-yt/2,vt,yt),bt&&(ut.beginPath(),this.forEachControl(function(xt,It,St){xt.withConnection&&xt.getVisibility(St,It)&&(Ct=!0,ut.moveTo(xt.x*vt,xt.y*yt),ut.lineTo(xt.x*vt+xt.offsetX,xt.y*yt+xt.offsetY))}),Ct&&ut.stroke()),ut.restore(),this},drawBordersInGroup:function(ut,pt,At){At=At||{};var gt=at.util.sizeAfterTransform(this.width,this.height,pt),vt=this.strokeWidth,yt=this.strokeUniform,bt=this.borderScaleFactor,Ct=gt.x+vt*(yt?this.canvas.getZoom():pt.scaleX)+bt,xt=gt.y+vt*(yt?this.canvas.getZoom():pt.scaleY)+bt;return ut.save(),this._setLineDash(ut,At.borderDashArray||this.borderDashArray),ut.strokeStyle=At.borderColor||this.borderColor,ut.strokeRect(-Ct/2,-xt/2,Ct,xt),ut.restore(),this},drawControls:function(ut,pt){pt=pt||{},ut.save();var At=this.canvas.getRetinaScaling(),gt,vt;return ut.setTransform(At,0,0,At,0,0),ut.strokeStyle=ut.fillStyle=pt.cornerColor||this.cornerColor,this.transparentCorners||(ut.strokeStyle=pt.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(ut,pt.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(gt=this.group.calcTransformMatrix()),this.forEachControl(function(yt,bt,Ct){vt=Ct.oCoords[bt],yt.getVisibility(Ct,bt)&&(gt&&(vt=at.util.transformPoint(vt,gt)),yt.render(ut,vt.x,vt.y,pt,Ct))}),ut.restore(),this},isControlVisible:function(ut){return this.controls[ut]&&this.controls[ut].getVisibility(this,ut)},setControlVisible:function(ut,pt){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[ut]=pt,this},setControlsVisibility:function(ut){ut||(ut={});for(var pt in ut)this.setControlVisible(pt,ut[pt]);return this},onDeselect:function(){},onSelect:function(){}})}(),at.util.object.extend(at.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(ft,ut){ut=ut||{};var pt=function(){},At=ut.onComplete||pt,gt=ut.onChange||pt,vt=this;return at.util.animate({startValue:ft.left,endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(yt){ft.set("left",yt),vt.requestRenderAll(),gt()},onComplete:function(){ft.setCoords(),At()}}),this},fxCenterObjectV:function(ft,ut){ut=ut||{};var pt=function(){},At=ut.onComplete||pt,gt=ut.onChange||pt,vt=this;return at.util.animate({startValue:ft.top,endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(yt){ft.set("top",yt),vt.requestRenderAll(),gt()},onComplete:function(){ft.setCoords(),At()}}),this},fxRemove:function(ft,ut){ut=ut||{};var pt=function(){},At=ut.onComplete||pt,gt=ut.onChange||pt,vt=this;return at.util.animate({startValue:ft.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(yt){ft.set("opacity",yt),vt.requestRenderAll(),gt()},onComplete:function(){vt.remove(ft),At()}}),this}}),at.util.object.extend(at.Object.prototype,{animate:function(){if(arguments[0]&&typeof arguments[0]=="object"){var ft=[],ut,pt;for(ut in arguments[0])ft.push(ut);for(var At=0,gt=ft.length;At<gt;At++)ut=ft[At],pt=At!==gt-1,this._animate(ut,arguments[0][ut],arguments[1],pt)}else this._animate.apply(this,arguments);return this},_animate:function(ft,ut,pt,At){var gt=this,vt;ut=ut.toString(),pt?pt=at.util.object.clone(pt):pt={},~ft.indexOf(".")&&(vt=ft.split("."));var yt=gt.colorProperties.indexOf(ft)>-1||vt&&gt.colorProperties.indexOf(vt[1])>-1,bt=vt?this.get(vt[0])[vt[1]]:this.get(ft);"from"in pt||(pt.from=bt),yt||(~ut.indexOf("=")?ut=bt+parseFloat(ut.replace("=","")):ut=parseFloat(ut));var Ct={startValue:pt.from,endValue:ut,byValue:pt.by,easing:pt.easing,duration:pt.duration,abort:pt.abort&&function(xt,It,St){return pt.abort.call(gt,xt,It,St)},onChange:function(xt,It,St){vt?gt[vt[0]][vt[1]]=xt:gt.set(ft,xt),!At&&pt.onChange&&pt.onChange(xt,It,St)},onComplete:function(xt,It,St){At||(gt.setCoords(),pt.onComplete&&pt.onComplete(xt,It,St))}};return yt?at.util.animateColor(Ct.startValue,Ct.endValue,Ct.duration,Ct):at.util.animate(Ct)}}),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.extend,At=ut.util.object.clone,gt={x1:1,x2:1,y1:1,y2:1};if(ut.Line){ut.warn("fabric.Line is already defined");return}ut.Line=ut.util.createClass(ut.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:ut.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(yt,bt){yt||(yt=[0,0,0,0]),this.callSuper("initialize",bt),this.set("x1",yt[0]),this.set("y1",yt[1]),this.set("x2",yt[2]),this.set("y2",yt[3]),this._setWidthHeight(bt)},_setWidthHeight:function(yt){yt||(yt={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in yt?yt.left:this._getLeftToOriginX(),this.top="top"in yt?yt.top:this._getTopToOriginY()},_set:function(yt,bt){return this.callSuper("_set",yt,bt),typeof gt[yt]!="undefined"&&this._setWidthHeight(),this},_getLeftToOriginX:vt({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:vt({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(yt){yt.beginPath();var bt=this.calcLinePoints();yt.moveTo(bt.x1,bt.y1),yt.lineTo(bt.x2,bt.y2),yt.lineWidth=this.strokeWidth;var Ct=yt.strokeStyle;yt.strokeStyle=this.stroke||yt.fillStyle,this.stroke&&this._renderStroke(yt),yt.strokeStyle=Ct},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(yt){return pt(this.callSuper("toObject",yt),this.calcLinePoints())},_getNonTransformedDimensions:function(){var yt=this.callSuper("_getNonTransformedDimensions");return this.strokeLineCap==="butt"&&(this.width===0&&(yt.y-=this.strokeWidth),this.height===0&&(yt.x-=this.strokeWidth)),yt},calcLinePoints:function(){var yt=this.x1<=this.x2?-1:1,bt=this.y1<=this.y2?-1:1,Ct=yt*this.width*.5,xt=bt*this.height*.5,It=yt*this.width*-.5,St=bt*this.height*-.5;return{x1:Ct,x2:It,y1:xt,y2:St}},_toSVG:function(){var yt=this.calcLinePoints();return["<line ","COMMON_PARTS",'x1="',yt.x1,'" y1="',yt.y1,'" x2="',yt.x2,'" y2="',yt.y2,`" />
`]}}),ut.Line.ATTRIBUTE_NAMES=ut.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),ut.Line.fromElement=function(yt,bt,Ct){Ct=Ct||{};var xt=ut.parseAttributes(yt,ut.Line.ATTRIBUTE_NAMES),It=[xt.x1||0,xt.y1||0,xt.x2||0,xt.y2||0];bt(new ut.Line(It,pt(xt,Ct)))},ut.Line.fromObject=function(yt,bt){function Ct(It){delete It.points,bt&&bt(It)}var xt=At(yt,!0);xt.points=[yt.x1,yt.y1,yt.x2,yt.y2],ut.Object._fromObject("Line",xt,Ct,"points")};function vt(yt,bt){var Ct=yt.origin,xt=yt.axis1,It=yt.axis2,St=yt.dimension,Ot=bt.nearest,Mt=bt.center,jt=bt.farthest;return function(){switch(this.get(Ct)){case Ot:return Math.min(this.get(xt),this.get(It));case Mt:return Math.min(this.get(xt),this.get(It))+.5*this.get(St);case jt:return Math.max(this.get(xt),this.get(It))}}}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=Math.PI;if(ut.Circle){ut.warn("fabric.Circle is already defined.");return}ut.Circle=ut.util.createClass(ut.Object,{type:"circle",radius:0,startAngle:0,endAngle:pt*2,cacheProperties:ut.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set:function(gt,vt){return this.callSuper("_set",gt,vt),gt==="radius"&&this.setRadius(vt),this},toObject:function(gt){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(gt))},_toSVG:function(){var gt,vt=0,yt=0,bt=(this.endAngle-this.startAngle)%(2*pt);if(bt===0)gt=["<circle ","COMMON_PARTS",'cx="'+vt+'" cy="'+yt+'" ','r="',this.radius,`" />
`];else{var Ct=ut.util.cos(this.startAngle)*this.radius,xt=ut.util.sin(this.startAngle)*this.radius,It=ut.util.cos(this.endAngle)*this.radius,St=ut.util.sin(this.endAngle)*this.radius,Ot=bt>pt?"1":"0";gt=['<path d="M '+Ct+" "+xt," A "+this.radius+" "+this.radius," 0 ",+Ot+" 1"," "+It+" "+St,'" ',"COMMON_PARTS",` />
`]}return gt},_render:function(gt){gt.beginPath(),gt.arc(0,0,this.radius,this.startAngle,this.endAngle,!1),this._renderPaintInOrder(gt)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(gt){return this.radius=gt,this.set("width",gt*2).set("height",gt*2)}}),ut.Circle.ATTRIBUTE_NAMES=ut.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),ut.Circle.fromElement=function(gt,vt){var yt=ut.parseAttributes(gt,ut.Circle.ATTRIBUTE_NAMES);if(!At(yt))throw new Error("value of `r` attribute is required and can not be negative");yt.left=(yt.left||0)-yt.radius,yt.top=(yt.top||0)-yt.radius,vt(new ut.Circle(yt))};function At(gt){return"radius"in gt&&gt.radius>=0}ut.Circle.fromObject=function(gt,vt){ut.Object._fromObject("Circle",gt,vt)}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={});if(ut.Triangle){ut.warn("fabric.Triangle is already defined");return}ut.Triangle=ut.util.createClass(ut.Object,{type:"triangle",width:100,height:100,_render:function(pt){var At=this.width/2,gt=this.height/2;pt.beginPath(),pt.moveTo(-At,gt),pt.lineTo(0,-gt),pt.lineTo(At,gt),pt.closePath(),this._renderPaintInOrder(pt)},_toSVG:function(){var pt=this.width/2,At=this.height/2,gt=[-pt+" "+At,"0 "+-At,pt+" "+At].join(",");return["<polygon ","COMMON_PARTS",'points="',gt,'" />']}}),ut.Triangle.fromObject=function(pt,At){return ut.Object._fromObject("Triangle",pt,At)}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=Math.PI*2;if(ut.Ellipse){ut.warn("fabric.Ellipse is already defined.");return}ut.Ellipse=ut.util.createClass(ut.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:ut.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(At){this.callSuper("initialize",At),this.set("rx",At&&At.rx||0),this.set("ry",At&&At.ry||0)},_set:function(At,gt){switch(this.callSuper("_set",At,gt),At){case"rx":this.rx=gt,this.set("width",gt*2);break;case"ry":this.ry=gt,this.set("height",gt*2);break}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(At){return this.callSuper("toObject",["rx","ry"].concat(At))},_toSVG:function(){return["<ellipse ","COMMON_PARTS",'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,`" />
`]},_render:function(At){At.beginPath(),At.save(),At.transform(1,0,0,this.ry/this.rx,0,0),At.arc(0,0,this.rx,0,pt,!1),At.restore(),this._renderPaintInOrder(At)}}),ut.Ellipse.ATTRIBUTE_NAMES=ut.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),ut.Ellipse.fromElement=function(At,gt){var vt=ut.parseAttributes(At,ut.Ellipse.ATTRIBUTE_NAMES);vt.left=(vt.left||0)-vt.rx,vt.top=(vt.top||0)-vt.ry,gt(new ut.Ellipse(vt))},ut.Ellipse.fromObject=function(At,gt){ut.Object._fromObject("Ellipse",At,gt)}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.extend;if(ut.Rect){ut.warn("fabric.Rect is already defined");return}ut.Rect=ut.util.createClass(ut.Object,{stateProperties:ut.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:ut.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(At){this.callSuper("initialize",At),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(At){var gt=this.rx?Math.min(this.rx,this.width/2):0,vt=this.ry?Math.min(this.ry,this.height/2):0,yt=this.width,bt=this.height,Ct=-this.width/2,xt=-this.height/2,It=gt!==0||vt!==0,St=1-.5522847498;At.beginPath(),At.moveTo(Ct+gt,xt),At.lineTo(Ct+yt-gt,xt),It&&At.bezierCurveTo(Ct+yt-St*gt,xt,Ct+yt,xt+St*vt,Ct+yt,xt+vt),At.lineTo(Ct+yt,xt+bt-vt),It&&At.bezierCurveTo(Ct+yt,xt+bt-St*vt,Ct+yt-St*gt,xt+bt,Ct+yt-gt,xt+bt),At.lineTo(Ct+gt,xt+bt),It&&At.bezierCurveTo(Ct+St*gt,xt+bt,Ct,xt+bt-St*vt,Ct,xt+bt-vt),At.lineTo(Ct,xt+vt),It&&At.bezierCurveTo(Ct,xt+St*vt,Ct+St*gt,xt,Ct+gt,xt),At.closePath(),this._renderPaintInOrder(At)},toObject:function(At){return this.callSuper("toObject",["rx","ry"].concat(At))},_toSVG:function(){var At=-this.width/2,gt=-this.height/2;return["<rect ","COMMON_PARTS",'x="',At,'" y="',gt,'" rx="',this.rx,'" ry="',this.ry,'" width="',this.width,'" height="',this.height,`" />
`]}}),ut.Rect.ATTRIBUTE_NAMES=ut.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),ut.Rect.fromElement=function(At,gt,vt){if(!At)return gt(null);vt=vt||{};var yt=ut.parseAttributes(At,ut.Rect.ATTRIBUTE_NAMES);yt.left=yt.left||0,yt.top=yt.top||0,yt.height=yt.height||0,yt.width=yt.width||0;var bt=new ut.Rect(pt(vt?ut.util.object.clone(vt):{},yt));bt.visible=bt.visible&&bt.width>0&&bt.height>0,gt(bt)},ut.Rect.fromObject=function(At,gt){return ut.Object._fromObject("Rect",At,gt)}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.extend,At=ut.util.array.min,gt=ut.util.array.max,vt=ut.util.toFixed;if(ut.Polyline){ut.warn("fabric.Polyline is already defined");return}ut.Polyline=ut.util.createClass(ut.Object,{type:"polyline",points:null,cacheProperties:ut.Object.prototype.cacheProperties.concat("points"),initialize:function(yt,bt){bt=bt||{},this.points=yt||[],this.callSuper("initialize",bt),this._setPositionDimensions(bt)},_setPositionDimensions:function(yt){var bt=this._calcDimensions(yt),Ct;this.width=bt.width,this.height=bt.height,yt.fromSVG||(Ct=this.translateToGivenOrigin({x:bt.left-this.strokeWidth/2,y:bt.top-this.strokeWidth/2},"left","top",this.originX,this.originY)),typeof yt.left=="undefined"&&(this.left=yt.fromSVG?bt.left:Ct.x),typeof yt.top=="undefined"&&(this.top=yt.fromSVG?bt.top:Ct.y),this.pathOffset={x:bt.left+this.width/2,y:bt.top+this.height/2}},_calcDimensions:function(){var yt=this.points,bt=At(yt,"x")||0,Ct=At(yt,"y")||0,xt=gt(yt,"x")||0,It=gt(yt,"y")||0,St=xt-bt,Ot=It-Ct;return{left:bt,top:Ct,width:St,height:Ot}},toObject:function(yt){return pt(this.callSuper("toObject",yt),{points:this.points.concat()})},_toSVG:function(){for(var yt=[],bt=this.pathOffset.x,Ct=this.pathOffset.y,xt=ut.Object.NUM_FRACTION_DIGITS,It=0,St=this.points.length;It<St;It++)yt.push(vt(this.points[It].x-bt,xt),",",vt(this.points[It].y-Ct,xt)," ");return["<"+this.type+" ","COMMON_PARTS",'points="',yt.join(""),`" />
`]},commonRender:function(yt){var bt,Ct=this.points.length,xt=this.pathOffset.x,It=this.pathOffset.y;if(!Ct||isNaN(this.points[Ct-1].y))return!1;yt.beginPath(),yt.moveTo(this.points[0].x-xt,this.points[0].y-It);for(var St=0;St<Ct;St++)bt=this.points[St],yt.lineTo(bt.x-xt,bt.y-It);return!0},_render:function(yt){!this.commonRender(yt)||this._renderPaintInOrder(yt)},complexity:function(){return this.get("points").length}}),ut.Polyline.ATTRIBUTE_NAMES=ut.SHARED_ATTRIBUTES.concat(),ut.Polyline.fromElementGenerator=function(yt){return function(bt,Ct,xt){if(!bt)return Ct(null);xt||(xt={});var It=ut.parsePointsAttribute(bt.getAttribute("points")),St=ut.parseAttributes(bt,ut[yt].ATTRIBUTE_NAMES);St.fromSVG=!0,Ct(new ut[yt](It,pt(St,xt)))}},ut.Polyline.fromElement=ut.Polyline.fromElementGenerator("Polyline"),ut.Polyline.fromObject=function(yt,bt){return ut.Object._fromObject("Polyline",yt,bt,"points")}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={});if(ut.Polygon){ut.warn("fabric.Polygon is already defined");return}ut.Polygon=ut.util.createClass(ut.Polyline,{type:"polygon",_render:function(pt){!this.commonRender(pt)||(pt.closePath(),this._renderPaintInOrder(pt))}}),ut.Polygon.ATTRIBUTE_NAMES=ut.SHARED_ATTRIBUTES.concat(),ut.Polygon.fromElement=ut.Polyline.fromElementGenerator("Polygon"),ut.Polygon.fromObject=function(pt,At){ut.Object._fromObject("Polygon",pt,At,"points")}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.array.min,At=ut.util.array.max,gt=ut.util.object.extend,vt=Object.prototype.toString,yt=ut.util.toFixed;if(ut.Path){ut.warn("fabric.Path is already defined");return}ut.Path=ut.util.createClass(ut.Object,{type:"path",path:null,cacheProperties:ut.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:ut.Object.prototype.stateProperties.concat("path"),initialize:function(bt,Ct){Ct=Ct||{},this.callSuper("initialize",Ct),bt||(bt=[]);var xt=vt.call(bt)==="[object Array]";this.path=ut.util.makePathSimpler(xt?bt:ut.util.parsePath(bt)),this.path&&ut.Polyline.prototype._setPositionDimensions.call(this,Ct)},_renderPathCommands:function(bt){var Ct,xt=0,It=0,St=0,Ot=0,Mt=0,jt=0,Ft=-this.pathOffset.x,Ut=-this.pathOffset.y;bt.beginPath();for(var Qt=0,Ht=this.path.length;Qt<Ht;++Qt)switch(Ct=this.path[Qt],Ct[0]){case"L":St=Ct[1],Ot=Ct[2],bt.lineTo(St+Ft,Ot+Ut);break;case"M":St=Ct[1],Ot=Ct[2],xt=St,It=Ot,bt.moveTo(St+Ft,Ot+Ut);break;case"C":St=Ct[5],Ot=Ct[6],Mt=Ct[3],jt=Ct[4],bt.bezierCurveTo(Ct[1]+Ft,Ct[2]+Ut,Mt+Ft,jt+Ut,St+Ft,Ot+Ut);break;case"Q":bt.quadraticCurveTo(Ct[1]+Ft,Ct[2]+Ut,Ct[3]+Ft,Ct[4]+Ut),St=Ct[3],Ot=Ct[4],Mt=Ct[1],jt=Ct[2];break;case"z":case"Z":St=xt,Ot=It,bt.closePath();break}},_render:function(bt){this._renderPathCommands(bt),this._renderPaintInOrder(bt)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(bt){return gt(this.callSuper("toObject",bt),{path:this.path.map(function(Ct){return Ct.slice()})})},toDatalessObject:function(bt){var Ct=this.toObject(["sourcePath"].concat(bt));return Ct.sourcePath&&delete Ct.path,Ct},_toSVG:function(){var bt=ut.util.joinPath(this.path);return["<path ","COMMON_PARTS",'d="',bt,'" stroke-linecap="round" ',`/>
`]},_getOffsetTransform:function(){var bt=ut.Object.NUM_FRACTION_DIGITS;return" translate("+yt(-this.pathOffset.x,bt)+", "+yt(-this.pathOffset.y,bt)+")"},toClipPathSVG:function(bt){var Ct=this._getOffsetTransform();return"	"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:bt,additionalTransform:Ct})},toSVG:function(bt){var Ct=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:bt,additionalTransform:Ct})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var bt=[],Ct=[],xt,It=0,St=0,Ot=0,Mt=0,jt,Ft=0,Ut=this.path.length;Ft<Ut;++Ft){switch(xt=this.path[Ft],xt[0]){case"L":Ot=xt[1],Mt=xt[2],jt=[];break;case"M":Ot=xt[1],Mt=xt[2],It=Ot,St=Mt,jt=[];break;case"C":jt=ut.util.getBoundsOfCurve(Ot,Mt,xt[1],xt[2],xt[3],xt[4],xt[5],xt[6]),Ot=xt[5],Mt=xt[6];break;case"Q":jt=ut.util.getBoundsOfCurve(Ot,Mt,xt[1],xt[2],xt[1],xt[2],xt[3],xt[4]),Ot=xt[3],Mt=xt[4];break;case"z":case"Z":Ot=It,Mt=St;break}jt.forEach(function(Nt){bt.push(Nt.x),Ct.push(Nt.y)}),bt.push(Ot),Ct.push(Mt)}var Qt=pt(bt)||0,Ht=pt(Ct)||0,Zt=At(bt)||0,Wt=At(Ct)||0,$t=Zt-Qt,Jt=Wt-Ht;return{left:Qt,top:Ht,width:$t,height:Jt}}}),ut.Path.fromObject=function(bt,Ct){if(typeof bt.sourcePath=="string"){var xt=bt.sourcePath;ut.loadSVGFromURL(xt,function(It){var St=It[0];St.setOptions(bt),Ct&&Ct(St)})}else ut.Object._fromObject("Path",bt,Ct,"path")},ut.Path.ATTRIBUTE_NAMES=ut.SHARED_ATTRIBUTES.concat(["d"]),ut.Path.fromElement=function(bt,Ct,xt){var It=ut.parseAttributes(bt,ut.Path.ATTRIBUTE_NAMES);It.fromSVG=!0,Ct(new ut.Path(It.d,gt(It,xt)))}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.array.min,At=ut.util.array.max;ut.Group||(ut.Group=ut.util.createClass(ut.Object,ut.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(gt,vt,yt){vt=vt||{},this._objects=[],yt&&this.callSuper("initialize",vt),this._objects=gt||[];for(var bt=this._objects.length;bt--;)this._objects[bt].group=this;if(yt)this._updateObjectsACoords();else{var Ct=vt&&vt.centerPoint;vt.originX!==void 0&&(this.originX=vt.originX),vt.originY!==void 0&&(this.originY=vt.originY),Ct||this._calcBounds(),this._updateObjectsCoords(Ct),delete vt.centerPoint,this.callSuper("initialize",vt)}this.setCoords()},_updateObjectsACoords:function(){for(var gt=!0,vt=this._objects.length;vt--;)this._objects[vt].setCoords(gt)},_updateObjectsCoords:function(vt){for(var vt=vt||this.getCenterPoint(),yt=this._objects.length;yt--;)this._updateObjectCoords(this._objects[yt],vt)},_updateObjectCoords:function(gt,vt){var yt=gt.left,bt=gt.top,Ct=!0;gt.set({left:yt-vt.x,top:bt-vt.y}),gt.group=this,gt.setCoords(Ct)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(gt){var vt=!!this.group;return this._restoreObjectsState(),ut.util.resetObjectTransform(this),gt&&(vt&&ut.util.removeTransformFromObject(gt,this.group.calcTransformMatrix()),this._objects.push(gt),gt.group=this,gt._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,vt?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(gt){return this._restoreObjectsState(),ut.util.resetObjectTransform(this),this.remove(gt),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(gt){this.dirty=!0,gt.group=this,gt._set("canvas",this.canvas)},_onObjectRemoved:function(gt){this.dirty=!0,delete gt.group},_set:function(gt,vt){var yt=this._objects.length;if(this.useSetOnGroup)for(;yt--;)this._objects[yt].setOnGroup(gt,vt);if(gt==="canvas")for(;yt--;)this._objects[yt]._set(gt,vt);ut.Object.prototype._set.call(this,gt,vt)},toObject:function(gt){var vt=this.includeDefaultValues,yt=this._objects.filter(function(Ct){return!Ct.excludeFromExport}).map(function(Ct){var xt=Ct.includeDefaultValues;Ct.includeDefaultValues=vt;var It=Ct.toObject(gt);return Ct.includeDefaultValues=xt,It}),bt=ut.Object.prototype.toObject.call(this,gt);return bt.objects=yt,bt},toDatalessObject:function(gt){var vt,yt=this.sourcePath;if(yt)vt=yt;else{var bt=this.includeDefaultValues;vt=this._objects.map(function(xt){var It=xt.includeDefaultValues;xt.includeDefaultValues=bt;var St=xt.toDatalessObject(gt);return xt.includeDefaultValues=It,St})}var Ct=ut.Object.prototype.toDatalessObject.call(this,gt);return Ct.objects=vt,Ct},render:function(gt){this._transformDone=!0,this.callSuper("render",gt),this._transformDone=!1},shouldCache:function(){var gt=ut.Object.prototype.shouldCache.call(this);if(gt){for(var vt=0,yt=this._objects.length;vt<yt;vt++)if(this._objects[vt].willDrawShadow())return this.ownCaching=!1,!1}return gt},willDrawShadow:function(){if(ut.Object.prototype.willDrawShadow.call(this))return!0;for(var gt=0,vt=this._objects.length;gt<vt;gt++)if(this._objects[gt].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(gt){for(var vt=0,yt=this._objects.length;vt<yt;vt++)this._objects[vt].render(gt);this._drawClipPath(gt)},isCacheDirty:function(gt){if(this.callSuper("isCacheDirty",gt))return!0;if(!this.statefullCache)return!1;for(var vt=0,yt=this._objects.length;vt<yt;vt++)if(this._objects[vt].isCacheDirty(!0)){if(this._cacheCanvas){var bt=this.cacheWidth/this.zoomX,Ct=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-bt/2,-Ct/2,bt,Ct)}return!0}return!1},_restoreObjectsState:function(){var gt=this.calcOwnMatrix();return this._objects.forEach(function(vt){ut.util.addTransformToObject(vt,gt),delete vt.group,vt.setCoords()}),this},realizeTransform:function(gt,vt){return ut.util.addTransformToObject(gt,vt),gt},destroy:function(){return this._objects.forEach(function(gt){gt.set("dirty",!0)}),this._restoreObjectsState()},toActiveSelection:function(){if(!!this.canvas){var gt=this._objects,vt=this.canvas;this._objects=[];var yt=this.toObject();delete yt.objects;var bt=new ut.ActiveSelection([]);return bt.set(yt),bt.type="activeSelection",vt.remove(this),gt.forEach(function(Ct){Ct.group=bt,Ct.dirty=!0,vt.add(Ct)}),bt.canvas=vt,bt._objects=gt,vt._activeObject=bt,bt.setCoords(),bt}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){var gt=!0;return this.forEachObject(function(vt){vt.setCoords(gt)}),this},_calcBounds:function(gt){for(var vt=[],yt=[],bt,Ct,xt,It=["tr","br","bl","tl"],St=0,Ot=this._objects.length,Mt,jt=It.length;St<Ot;++St){for(bt=this._objects[St],xt=bt.calcACoords(),Mt=0;Mt<jt;Mt++)Ct=It[Mt],vt.push(xt[Ct].x),yt.push(xt[Ct].y);bt.aCoords=xt}this._getBounds(vt,yt,gt)},_getBounds:function(gt,vt,yt){var bt=new ut.Point(pt(gt),pt(vt)),Ct=new ut.Point(At(gt),At(vt)),xt=bt.y||0,It=bt.x||0,St=Ct.x-bt.x||0,Ot=Ct.y-bt.y||0;this.width=St,this.height=Ot,yt||this.setPositionByOrigin({x:It,y:xt},"left","top")},_toSVG:function(gt){for(var vt=["<g ","COMMON_PARTS",` >
`],yt=0,bt=this._objects.length;yt<bt;yt++)vt.push("		",this._objects[yt].toSVG(gt));return vt.push(`</g>
`),vt},getSvgStyles:function(){var gt=typeof this.opacity!="undefined"&&this.opacity!==1?"opacity: "+this.opacity+";":"",vt=this.visible?"":" visibility: hidden;";return[gt,this.getSvgFilter(),vt].join("")},toClipPathSVG:function(gt){for(var vt=[],yt=0,bt=this._objects.length;yt<bt;yt++)vt.push("	",this._objects[yt].toClipPathSVG(gt));return this._createBaseClipPathSVGMarkup(vt,{reviver:gt})}}),ut.Group.fromObject=function(gt,vt){var yt=gt.objects,bt=ut.util.object.clone(gt,!0);if(delete bt.objects,typeof yt=="string"){ut.loadSVGFromURL(yt,function(Ct){var xt=ut.util.groupSVGElements(Ct,gt,yt);xt.set(bt),vt&&vt(xt)});return}ut.util.enlivenObjects(yt,function(Ct){ut.util.enlivenObjects([gt.clipPath],function(xt){var It=ut.util.object.clone(gt,!0);It.clipPath=xt[0],delete It.objects,vt&&vt(new ut.Group(Ct,It,!0))})})})}(ot),function(ft){var ut=ft.fabric||(ft.fabric={});ut.ActiveSelection||(ut.ActiveSelection=ut.util.createClass(ut.Group,{type:"activeSelection",initialize:function(pt,At){At=At||{},this._objects=pt||[];for(var gt=this._objects.length;gt--;)this._objects[gt].group=this;At.originX&&(this.originX=At.originX),At.originY&&(this.originY=At.originY),this._calcBounds(),this._updateObjectsCoords(),ut.Object.prototype.initialize.call(this,At),this.setCoords()},toGroup:function(){var pt=this._objects.concat();this._objects=[];var At=ut.Object.prototype.toObject.call(this),gt=new ut.Group([]);if(delete At.type,gt.set(At),pt.forEach(function(yt){yt.canvas.remove(yt),yt.group=gt}),gt._objects=pt,!this.canvas)return gt;var vt=this.canvas;return vt.add(gt),vt._activeObject=gt,gt.setCoords(),gt},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(pt,At,gt){pt.save(),pt.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",pt,At),gt=gt||{},typeof gt.hasControls=="undefined"&&(gt.hasControls=!1),gt.forActiveSelection=!0;for(var vt=0,yt=this._objects.length;vt<yt;vt++)this._objects[vt]._renderControls(pt,gt);pt.restore()}}),ut.ActiveSelection.fromObject=function(pt,At){ut.util.enlivenObjects(pt.objects,function(gt){delete pt.objects,At&&At(new ut.ActiveSelection(gt,pt,!0))})})}(ot),function(ft){var ut=at.util.object.extend;if(ft.fabric||(ft.fabric={}),ft.fabric.Image){at.warn("fabric.Image is already defined.");return}at.Image=at.util.createClass(at.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:at.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:at.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(pt,At){At||(At={}),this.filters=[],this.cacheKey="texture"+at.Object.__uid++,this.callSuper("initialize",At),this._initElement(pt,At)},getElement:function(){return this._element||{}},setElement:function(pt,At){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=pt,this._originalElement=pt,this._initConfig(At),this.filters.length!==0&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(pt){var At=at.filterBackend;At&&At.evictCachesForKey&&At.evictCachesForKey(pt)},dispose:function(){this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(pt){at.util.cleanUpJsdomNode(this[pt]),this[pt]=void 0}.bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var pt=this.getElement();return{width:pt.naturalWidth||pt.width,height:pt.naturalHeight||pt.height}},_stroke:function(pt){if(!(!this.stroke||this.strokeWidth===0)){var At=this.width/2,gt=this.height/2;pt.beginPath(),pt.moveTo(-At,-gt),pt.lineTo(At,-gt),pt.lineTo(At,gt),pt.lineTo(-At,gt),pt.lineTo(-At,-gt),pt.closePath()}},toObject:function(pt){var At=[];this.filters.forEach(function(vt){vt&&At.push(vt.toObject())});var gt=ut(this.callSuper("toObject",["cropX","cropY"].concat(pt)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:At});return this.resizeFilter&&(gt.resizeFilter=this.resizeFilter.toObject()),gt},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var pt=[],At=[],gt,vt=this._element,yt=-this.width/2,bt=-this.height/2,Ct="",xt="";if(!vt)return[];if(this.hasCrop()){var It=at.Object.__uid++;pt.push('<clipPath id="imageCrop_'+It+`">
`,'	<rect x="'+yt+'" y="'+bt+'" width="'+this.width+'" height="'+this.height+`" />
`,`</clipPath>
`),Ct=' clip-path="url(#imageCrop_'+It+')" '}if(this.imageSmoothing||(xt='" image-rendering="optimizeSpeed'),At.push("	<image ","COMMON_PARTS",'xlink:href="',this.getSvgSrc(!0),'" x="',yt-this.cropX,'" y="',bt-this.cropY,'" width="',vt.width||vt.naturalWidth,'" height="',vt.height||vt.height,xt,'"',Ct,`></image>
`),this.stroke||this.strokeDashArray){var St=this.fill;this.fill=null,gt=["	<rect ",'x="',yt,'" y="',bt,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),`"/>
`],this.fill=St}return this.paintFirst!=="fill"?pt=pt.concat(gt,At):pt=pt.concat(At,gt),pt},getSrc:function(pt){var At=pt?this._element:this._originalElement;return At?At.toDataURL?At.toDataURL():this.srcFromAttribute?At.getAttribute("src"):At.src:this.src||""},setSrc:function(pt,At,gt){return at.util.loadImage(pt,function(vt,yt){this.setElement(vt,gt),this._setWidthHeight(),At&&At(this,yt)},this,gt&&gt.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var pt=this.resizeFilter,At=this.minimumScaleTrigger,gt=this.getTotalObjectScaling(),vt=gt.scaleX,yt=gt.scaleY,bt=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!pt||vt>At&&yt>At){this._element=bt,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=vt,this._lastScaleY=yt;return}at.filterBackend||(at.filterBackend=at.initFilterBackend());var Ct=at.util.createCanvasElement(),xt=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,It=bt.width,St=bt.height;Ct.width=It,Ct.height=St,this._element=Ct,this._lastScaleX=pt.scaleX=vt,this._lastScaleY=pt.scaleY=yt,at.filterBackend.applyFilters([pt],bt,It,St,this._element,xt),this._filterScalingX=Ct.width/this._originalElement.width,this._filterScalingY=Ct.height/this._originalElement.height},applyFilters:function(pt){if(pt=pt||this.filters||[],pt=pt.filter(function(bt){return bt&&!bt.isNeutralState()}),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),pt.length===0)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var At=this._originalElement,gt=At.naturalWidth||At.width,vt=At.naturalHeight||At.height;if(this._element===this._originalElement){var yt=at.util.createCanvasElement();yt.width=gt,yt.height=vt,this._element=yt,this._filteredEl=yt}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,gt,vt),this._lastScaleX=1,this._lastScaleY=1;return at.filterBackend||(at.filterBackend=at.initFilterBackend()),at.filterBackend.applyFilters(pt,this._originalElement,gt,vt,this._element,this.cacheKey),(this._originalElement.width!==this._element.width||this._originalElement.height!==this._element.height)&&(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(pt){at.util.setImageSmoothing(pt,this.imageSmoothing),this.isMoving!==!0&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(pt),this._renderPaintInOrder(pt)},drawCacheOnCanvas:function(pt){at.util.setImageSmoothing(pt,this.imageSmoothing),at.Object.prototype.drawCacheOnCanvas.call(this,pt)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(pt){var At=this._element;if(!!At){var gt=this._filterScalingX,vt=this._filterScalingY,yt=this.width,bt=this.height,Ct=Math.min,xt=Math.max,It=xt(this.cropX,0),St=xt(this.cropY,0),Ot=At.naturalWidth||At.width,Mt=At.naturalHeight||At.height,jt=It*gt,Ft=St*vt,Ut=Ct(yt*gt,Ot-jt),Qt=Ct(bt*vt,Mt-Ft),Ht=-yt/2,Zt=-bt/2,Wt=Ct(yt,Ot/gt-It),$t=Ct(bt,Mt/vt-St);At&&pt.drawImage(At,jt,Ft,Ut,Qt,Ht,Zt,Wt,$t)}},_needsResize:function(){var pt=this.getTotalObjectScaling();return pt.scaleX!==this._lastScaleX||pt.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(pt,At){this.setElement(at.util.getById(pt),At),at.util.addClass(this.getElement(),at.Image.CSS_CANVAS)},_initConfig:function(pt){pt||(pt={}),this.setOptions(pt),this._setWidthHeight(pt)},_initFilters:function(pt,At){pt&&pt.length?at.util.enlivenObjects(pt,function(gt){At&&At(gt)},"fabric.Image.filters"):At&&At()},_setWidthHeight:function(pt){pt||(pt={});var At=this.getElement();this.width=pt.width||At.naturalWidth||At.width||0,this.height=pt.height||At.naturalHeight||At.height||0},parsePreserveAspectRatioAttribute:function(){var pt=at.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),At=this._element.width,gt=this._element.height,vt=1,yt=1,bt=0,Ct=0,xt=0,It=0,St,Ot=this.width,Mt=this.height,jt={width:Ot,height:Mt};return pt&&(pt.alignX!=="none"||pt.alignY!=="none")?(pt.meetOrSlice==="meet"&&(vt=yt=at.util.findScaleToFit(this._element,jt),St=(Ot-At*vt)/2,pt.alignX==="Min"&&(bt=-St),pt.alignX==="Max"&&(bt=St),St=(Mt-gt*yt)/2,pt.alignY==="Min"&&(Ct=-St),pt.alignY==="Max"&&(Ct=St)),pt.meetOrSlice==="slice"&&(vt=yt=at.util.findScaleToCover(this._element,jt),St=At-Ot/vt,pt.alignX==="Mid"&&(xt=St/2),pt.alignX==="Max"&&(xt=St),St=gt-Mt/yt,pt.alignY==="Mid"&&(It=St/2),pt.alignY==="Max"&&(It=St),At=Ot/vt,gt=Mt/yt)):(vt=Ot/At,yt=Mt/gt),{width:At,height:gt,scaleX:vt,scaleY:yt,offsetLeft:bt,offsetTop:Ct,cropX:xt,cropY:It}}}),at.Image.CSS_CANVAS="canvas-img",at.Image.prototype.getSvgSrc=at.Image.prototype.getSrc,at.Image.fromObject=function(pt,At){var gt=at.util.object.clone(pt);at.util.loadImage(gt.src,function(vt,yt){if(yt){At&&At(null,!0);return}at.Image.prototype._initFilters.call(gt,gt.filters,function(bt){gt.filters=bt||[],at.Image.prototype._initFilters.call(gt,[gt.resizeFilter],function(Ct){gt.resizeFilter=Ct[0],at.util.enlivenObjects([gt.clipPath],function(xt){gt.clipPath=xt[0];var It=new at.Image(vt,gt);At(It,!1)})})})},null,gt.crossOrigin)},at.Image.fromURL=function(pt,At,gt){at.util.loadImage(pt,function(vt,yt){At&&At(new at.Image(vt,gt),yt)},null,gt&&gt.crossOrigin)},at.Image.ATTRIBUTE_NAMES=at.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),at.Image.fromElement=function(pt,At,gt){var vt=at.parseAttributes(pt,at.Image.ATTRIBUTE_NAMES);at.Image.fromURL(vt["xlink:href"],At,ut(gt?at.util.object.clone(gt):{},vt))}}(ot),at.util.object.extend(at.Object.prototype,{_getAngleValueForStraighten:function(){var ft=this.angle%360;return ft>0?Math.round((ft-1)/90)*90:Math.round(ft/90)*90},straighten:function(){return this.rotate(this._getAngleValueForStraighten()),this},fxStraighten:function(ft){ft=ft||{};var ut=function(){},pt=ft.onComplete||ut,At=ft.onChange||ut,gt=this;return at.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(vt){gt.rotate(vt),At()},onComplete:function(){gt.setCoords(),pt()}}),this}}),at.util.object.extend(at.StaticCanvas.prototype,{straightenObject:function(ft){return ft.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(ft){return ft.fxStraighten({onChange:this.requestRenderAllBound}),this}}),function(){function ft(pt,At){var gt="precision "+At+` float;
void main(){}`,vt=pt.createShader(pt.FRAGMENT_SHADER);return pt.shaderSource(vt,gt),pt.compileShader(vt),!!pt.getShaderParameter(vt,pt.COMPILE_STATUS)}at.isWebglSupported=function(pt){if(at.isLikelyNode)return!1;pt=pt||at.WebglFilterBackend.prototype.tileSize;var At=document.createElement("canvas"),gt=At.getContext("webgl")||At.getContext("experimental-webgl"),vt=!1;if(gt){at.maxTextureSize=gt.getParameter(gt.MAX_TEXTURE_SIZE),vt=at.maxTextureSize>=pt;for(var yt=["highp","mediump","lowp"],bt=0;bt<3;bt++)if(ft(gt,yt[bt])){at.webGlPrecision=yt[bt];break}}return this.isSupported=vt,vt},at.WebglFilterBackend=ut;function ut(pt){pt&&pt.tileSize&&(this.tileSize=pt.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}ut.prototype={tileSize:2048,resources:{},setupGLContext:function(pt,At){this.dispose(),this.createWebGLCanvas(pt,At),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(pt,At)},chooseFastestCopyGLTo2DMethod:function(pt,At){var gt=typeof window.performance!="undefined",vt;try{new ImageData(1,1),vt=!0}catch{vt=!1}var yt=typeof ArrayBuffer!="undefined",bt=typeof Uint8ClampedArray!="undefined";if(!!(gt&&vt&&yt&&bt)){var Ct=at.util.createCanvasElement(),xt=new ArrayBuffer(pt*At*4);if(at.forceGLPutImageData){this.imageBuffer=xt,this.copyGLTo2D=dt;return}var It={imageBuffer:xt,destinationWidth:pt,destinationHeight:At,targetCanvas:Ct},St,Ot,Mt;Ct.width=pt,Ct.height=At,St=window.performance.now(),mt.call(It,this.gl,It),Ot=window.performance.now()-St,St=window.performance.now(),dt.call(It,this.gl,It),Mt=window.performance.now()-St,Ot>Mt?(this.imageBuffer=xt,this.copyGLTo2D=dt):this.copyGLTo2D=mt}},createWebGLCanvas:function(pt,At){var gt=at.util.createCanvasElement();gt.width=pt,gt.height=At;var vt={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},yt=gt.getContext("webgl",vt);yt||(yt=gt.getContext("experimental-webgl",vt)),yt&&(yt.clearColor(0,0,0,0),this.canvas=gt,this.gl=yt)},applyFilters:function(pt,At,gt,vt,yt,bt){var Ct=this.gl,xt;bt&&(xt=this.getCachedTexture(bt,At));var It={originalWidth:At.width||At.originalWidth,originalHeight:At.height||At.originalHeight,sourceWidth:gt,sourceHeight:vt,destinationWidth:gt,destinationHeight:vt,context:Ct,sourceTexture:this.createTexture(Ct,gt,vt,!xt&&At),targetTexture:this.createTexture(Ct,gt,vt),originalTexture:xt||this.createTexture(Ct,gt,vt,!xt&&At),passes:pt.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:yt},St=Ct.createFramebuffer();return Ct.bindFramebuffer(Ct.FRAMEBUFFER,St),pt.forEach(function(Ot){Ot&&Ot.applyTo(It)}),ht(It),this.copyGLTo2D(Ct,It),Ct.bindTexture(Ct.TEXTURE_2D,null),Ct.deleteTexture(It.sourceTexture),Ct.deleteTexture(It.targetTexture),Ct.deleteFramebuffer(St),yt.getContext("2d").setTransform(1,0,0,1,0,0),It},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(pt,At,gt,vt){var yt=pt.createTexture();return pt.bindTexture(pt.TEXTURE_2D,yt),pt.texParameteri(pt.TEXTURE_2D,pt.TEXTURE_MAG_FILTER,pt.NEAREST),pt.texParameteri(pt.TEXTURE_2D,pt.TEXTURE_MIN_FILTER,pt.NEAREST),pt.texParameteri(pt.TEXTURE_2D,pt.TEXTURE_WRAP_S,pt.CLAMP_TO_EDGE),pt.texParameteri(pt.TEXTURE_2D,pt.TEXTURE_WRAP_T,pt.CLAMP_TO_EDGE),vt?pt.texImage2D(pt.TEXTURE_2D,0,pt.RGBA,pt.RGBA,pt.UNSIGNED_BYTE,vt):pt.texImage2D(pt.TEXTURE_2D,0,pt.RGBA,At,gt,0,pt.RGBA,pt.UNSIGNED_BYTE,null),yt},getCachedTexture:function(pt,At){if(this.textureCache[pt])return this.textureCache[pt];var gt=this.createTexture(this.gl,At.width,At.height,At);return this.textureCache[pt]=gt,gt},evictCachesForKey:function(pt){this.textureCache[pt]&&(this.gl.deleteTexture(this.textureCache[pt]),delete this.textureCache[pt])},copyGLTo2D:mt,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var pt=this.gl,At={renderer:"",vendor:""};if(!pt)return At;var gt=pt.getExtension("WEBGL_debug_renderer_info");if(gt){var vt=pt.getParameter(gt.UNMASKED_RENDERER_WEBGL),yt=pt.getParameter(gt.UNMASKED_VENDOR_WEBGL);vt&&(At.renderer=vt.toLowerCase()),yt&&(At.vendor=yt.toLowerCase())}return this.gpuInfo=At,At}}}();function ht(ft){var ut=ft.targetCanvas,pt=ut.width,At=ut.height,gt=ft.destinationWidth,vt=ft.destinationHeight;(pt!==gt||At!==vt)&&(ut.width=gt,ut.height=vt)}function mt(ft,ut){var pt=ft.canvas,At=ut.targetCanvas,gt=At.getContext("2d");gt.translate(0,At.height),gt.scale(1,-1);var vt=pt.height-At.height;gt.drawImage(pt,0,vt,At.width,At.height,0,0,At.width,At.height)}function dt(ft,ut){var pt=ut.targetCanvas,At=pt.getContext("2d"),gt=ut.destinationWidth,vt=ut.destinationHeight,yt=gt*vt*4,bt=new Uint8Array(this.imageBuffer,0,yt),Ct=new Uint8ClampedArray(this.imageBuffer,0,yt);ft.readPixels(0,0,gt,vt,ft.RGBA,ft.UNSIGNED_BYTE,bt);var xt=new ImageData(Ct,gt,vt);At.putImageData(xt,0,0)}(function(){var ft=function(){};at.Canvas2dFilterBackend=ut;function ut(){}ut.prototype={evictCachesForKey:ft,dispose:ft,clearWebGLCaches:ft,resources:{},applyFilters:function(pt,At,gt,vt,yt){var bt=yt.getContext("2d");bt.drawImage(At,0,0,gt,vt);var Ct=bt.getImageData(0,0,gt,vt),xt=bt.getImageData(0,0,gt,vt),It={sourceWidth:gt,sourceHeight:vt,imageData:Ct,originalEl:At,originalImageData:xt,canvasEl:yt,ctx:bt,filterBackend:this};return pt.forEach(function(St){St.applyTo(It)}),(It.imageData.width!==gt||It.imageData.height!==vt)&&(yt.width=It.imageData.width,yt.height=It.imageData.height),bt.putImageData(It.imageData,0,0),It}}})(),at.Image=at.Image||{},at.Image.filters=at.Image.filters||{},at.Image.filters.BaseFilter=at.util.createClass({type:"BaseFilter",vertexSource:`attribute vec2 aPosition;
varying vec2 vTexCoord;
void main() {
vTexCoord = aPosition;
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
}`,fragmentSource:`precision highp float;
varying vec2 vTexCoord;
uniform sampler2D uTexture;
void main() {
gl_FragColor = texture2D(uTexture, vTexCoord);
}`,initialize:function(ft){ft&&this.setOptions(ft)},setOptions:function(ft){for(var ut in ft)this[ut]=ft[ut]},createProgram:function(ft,ut,pt){ut=ut||this.fragmentSource,pt=pt||this.vertexSource,at.webGlPrecision!=="highp"&&(ut=ut.replace(/precision highp float/g,"precision "+at.webGlPrecision+" float"));var At=ft.createShader(ft.VERTEX_SHADER);if(ft.shaderSource(At,pt),ft.compileShader(At),!ft.getShaderParameter(At,ft.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+ft.getShaderInfoLog(At));var gt=ft.createShader(ft.FRAGMENT_SHADER);if(ft.shaderSource(gt,ut),ft.compileShader(gt),!ft.getShaderParameter(gt,ft.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+ft.getShaderInfoLog(gt));var vt=ft.createProgram();if(ft.attachShader(vt,At),ft.attachShader(vt,gt),ft.linkProgram(vt),!ft.getProgramParameter(vt,ft.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+ft.getProgramInfoLog(vt));var yt=this.getAttributeLocations(ft,vt),bt=this.getUniformLocations(ft,vt)||{};return bt.uStepW=ft.getUniformLocation(vt,"uStepW"),bt.uStepH=ft.getUniformLocation(vt,"uStepH"),{program:vt,attributeLocations:yt,uniformLocations:bt}},getAttributeLocations:function(ft,ut){return{aPosition:ft.getAttribLocation(ut,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(ft,ut,pt){var At=ut.aPosition,gt=ft.createBuffer();ft.bindBuffer(ft.ARRAY_BUFFER,gt),ft.enableVertexAttribArray(At),ft.vertexAttribPointer(At,2,ft.FLOAT,!1,0,0),ft.bufferData(ft.ARRAY_BUFFER,pt,ft.STATIC_DRAW)},_setupFrameBuffer:function(ft){var ut=ft.context,pt,At;ft.passes>1?(pt=ft.destinationWidth,At=ft.destinationHeight,(ft.sourceWidth!==pt||ft.sourceHeight!==At)&&(ut.deleteTexture(ft.targetTexture),ft.targetTexture=ft.filterBackend.createTexture(ut,pt,At)),ut.framebufferTexture2D(ut.FRAMEBUFFER,ut.COLOR_ATTACHMENT0,ut.TEXTURE_2D,ft.targetTexture,0)):(ut.bindFramebuffer(ut.FRAMEBUFFER,null),ut.finish())},_swapTextures:function(ft){ft.passes--,ft.pass++;var ut=ft.targetTexture;ft.targetTexture=ft.sourceTexture,ft.sourceTexture=ut},isNeutralState:function(){var ft=this.mainParameter,ut=at.Image.filters[this.type].prototype;if(ft)if(Array.isArray(ut[ft])){for(var pt=ut[ft].length;pt--;)if(this[ft][pt]!==ut[ft][pt])return!1;return!0}else return ut[ft]===this[ft];else return!1},applyTo:function(ft){ft.webgl?(this._setupFrameBuffer(ft),this.applyToWebGL(ft),this._swapTextures(ft)):this.applyTo2d(ft)},retrieveShader:function(ft){return ft.programCache.hasOwnProperty(this.type)||(ft.programCache[this.type]=this.createProgram(ft.context)),ft.programCache[this.type]},applyToWebGL:function(ft){var ut=ft.context,pt=this.retrieveShader(ft);ft.pass===0&&ft.originalTexture?ut.bindTexture(ut.TEXTURE_2D,ft.originalTexture):ut.bindTexture(ut.TEXTURE_2D,ft.sourceTexture),ut.useProgram(pt.program),this.sendAttributeData(ut,pt.attributeLocations,ft.aPosition),ut.uniform1f(pt.uniformLocations.uStepW,1/ft.sourceWidth),ut.uniform1f(pt.uniformLocations.uStepH,1/ft.sourceHeight),this.sendUniformData(ut,pt.uniformLocations),ut.viewport(0,0,ft.destinationWidth,ft.destinationHeight),ut.drawArrays(ut.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(ft,ut,pt){ft.activeTexture(pt),ft.bindTexture(ft.TEXTURE_2D,ut),ft.activeTexture(ft.TEXTURE0)},unbindAdditionalTexture:function(ft,ut){ft.activeTexture(ut),ft.bindTexture(ft.TEXTURE_2D,null),ft.activeTexture(ft.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(ft){this[this.mainParameter]=ft},sendUniformData:function(){},createHelpLayer:function(ft){if(!ft.helpLayer){var ut=document.createElement("canvas");ut.width=ft.sourceWidth,ut.height=ft.sourceHeight,ft.helpLayer=ut}},toObject:function(){var ft={type:this.type},ut=this.mainParameter;return ut&&(ft[ut]=this[ut]),ft},toJSON:function(){return this.toObject()}}),at.Image.filters.BaseFilter.fromObject=function(ft,ut){var pt=new at.Image.filters[ft.type](ft);return ut&&ut(pt),pt},function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.ColorMatrix=At(pt.BaseFilter,{type:"ColorMatrix",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
varying vec2 vTexCoord;
uniform mat4 uColorMatrix;
uniform vec4 uConstants;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color *= uColorMatrix;
color += uConstants;
gl_FragColor = color;
}`,matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(gt){this.callSuper("initialize",gt),this.matrix=this.matrix.slice(0)},applyTo2d:function(gt){var vt=gt.imageData,yt=vt.data,bt=yt.length,Ct=this.matrix,xt,It,St,Ot,Mt,jt=this.colorsOnly;for(Mt=0;Mt<bt;Mt+=4)xt=yt[Mt],It=yt[Mt+1],St=yt[Mt+2],jt?(yt[Mt]=xt*Ct[0]+It*Ct[1]+St*Ct[2]+Ct[4]*255,yt[Mt+1]=xt*Ct[5]+It*Ct[6]+St*Ct[7]+Ct[9]*255,yt[Mt+2]=xt*Ct[10]+It*Ct[11]+St*Ct[12]+Ct[14]*255):(Ot=yt[Mt+3],yt[Mt]=xt*Ct[0]+It*Ct[1]+St*Ct[2]+Ot*Ct[3]+Ct[4]*255,yt[Mt+1]=xt*Ct[5]+It*Ct[6]+St*Ct[7]+Ot*Ct[8]+Ct[9]*255,yt[Mt+2]=xt*Ct[10]+It*Ct[11]+St*Ct[12]+Ot*Ct[13]+Ct[14]*255,yt[Mt+3]=xt*Ct[15]+It*Ct[16]+St*Ct[17]+Ot*Ct[18]+Ct[19]*255)},getUniformLocations:function(gt,vt){return{uColorMatrix:gt.getUniformLocation(vt,"uColorMatrix"),uConstants:gt.getUniformLocation(vt,"uConstants")}},sendUniformData:function(gt,vt){var yt=this.matrix,bt=[yt[0],yt[1],yt[2],yt[3],yt[5],yt[6],yt[7],yt[8],yt[10],yt[11],yt[12],yt[13],yt[15],yt[16],yt[17],yt[18]],Ct=[yt[4],yt[9],yt[14],yt[19]];gt.uniformMatrix4fv(vt.uColorMatrix,!1,bt),gt.uniform4fv(vt.uConstants,Ct)}}),ut.Image.filters.ColorMatrix.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Brightness=At(pt.BaseFilter,{type:"Brightness",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uBrightness;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color.rgb += uBrightness;
gl_FragColor = color;
}`,brightness:0,mainParameter:"brightness",applyTo2d:function(gt){if(this.brightness!==0){var vt=gt.imageData,yt=vt.data,bt,Ct=yt.length,xt=Math.round(this.brightness*255);for(bt=0;bt<Ct;bt+=4)yt[bt]=yt[bt]+xt,yt[bt+1]=yt[bt+1]+xt,yt[bt+2]=yt[bt+2]+xt}},getUniformLocations:function(gt,vt){return{uBrightness:gt.getUniformLocation(vt,"uBrightness")}},sendUniformData:function(gt,vt){gt.uniform1f(vt.uBrightness,this.brightness)}}),ut.Image.filters.Brightness.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.extend,At=ut.Image.filters,gt=ut.util.createClass;At.Convolute=gt(At.BaseFilter,{type:"Convolute",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[9];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 3.0; h+=1.0) {
for (float w = 0.0; w < 3.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];
}
}
gl_FragColor = color;
}`,Convolute_3_0:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[9];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 3.0; h+=1.0) {
for (float w = 0.0; w < 3.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,Convolute_5_1:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[25];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 5.0; h+=1.0) {
for (float w = 0.0; w < 5.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];
}
}
gl_FragColor = color;
}`,Convolute_5_0:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[25];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 5.0; h+=1.0) {
for (float w = 0.0; w < 5.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,Convolute_7_1:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[49];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 7.0; h+=1.0) {
for (float w = 0.0; w < 7.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];
}
}
gl_FragColor = color;
}`,Convolute_7_0:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[49];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 7.0; h+=1.0) {
for (float w = 0.0; w < 7.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,Convolute_9_1:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[81];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 9.0; h+=1.0) {
for (float w = 0.0; w < 9.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];
}
}
gl_FragColor = color;
}`,Convolute_9_0:`precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[81];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 9.0; h+=1.0) {
for (float w = 0.0; w < 9.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`},retrieveShader:function(vt){var yt=Math.sqrt(this.matrix.length),bt=this.type+"_"+yt+"_"+(this.opaque?1:0),Ct=this.fragmentSource[bt];return vt.programCache.hasOwnProperty(bt)||(vt.programCache[bt]=this.createProgram(vt.context,Ct)),vt.programCache[bt]},applyTo2d:function(vt){var yt=vt.imageData,bt=yt.data,Ct=this.matrix,xt=Math.round(Math.sqrt(Ct.length)),It=Math.floor(xt/2),St=yt.width,Ot=yt.height,Mt=vt.ctx.createImageData(St,Ot),jt=Mt.data,Ft=this.opaque?1:0,Ut,Qt,Ht,Zt,Wt,$t,Jt,Nt,Lt,Kt,Pt,ln,Gt;for(Pt=0;Pt<Ot;Pt++)for(Kt=0;Kt<St;Kt++){for(Wt=(Pt*St+Kt)*4,Ut=0,Qt=0,Ht=0,Zt=0,Gt=0;Gt<xt;Gt++)for(ln=0;ln<xt;ln++)Jt=Pt+Gt-It,$t=Kt+ln-It,!(Jt<0||Jt>=Ot||$t<0||$t>=St)&&(Nt=(Jt*St+$t)*4,Lt=Ct[Gt*xt+ln],Ut+=bt[Nt]*Lt,Qt+=bt[Nt+1]*Lt,Ht+=bt[Nt+2]*Lt,Ft||(Zt+=bt[Nt+3]*Lt));jt[Wt]=Ut,jt[Wt+1]=Qt,jt[Wt+2]=Ht,Ft?jt[Wt+3]=bt[Wt+3]:jt[Wt+3]=Zt}vt.imageData=Mt},getUniformLocations:function(vt,yt){return{uMatrix:vt.getUniformLocation(yt,"uMatrix"),uOpaque:vt.getUniformLocation(yt,"uOpaque"),uHalfSize:vt.getUniformLocation(yt,"uHalfSize"),uSize:vt.getUniformLocation(yt,"uSize")}},sendUniformData:function(vt,yt){vt.uniform1fv(yt.uMatrix,this.matrix)},toObject:function(){return pt(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),ut.Image.filters.Convolute.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Grayscale=At(pt.BaseFilter,{type:"Grayscale",fragmentSource:{average:`precision highp float;
uniform sampler2D uTexture;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float average = (color.r + color.b + color.g) / 3.0;
gl_FragColor = vec4(average, average, average, color.a);
}`,lightness:`precision highp float;
uniform sampler2D uTexture;
uniform int uMode;
varying vec2 vTexCoord;
void main() {
vec4 col = texture2D(uTexture, vTexCoord);
float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;
gl_FragColor = vec4(average, average, average, col.a);
}`,luminosity:`precision highp float;
uniform sampler2D uTexture;
uniform int uMode;
varying vec2 vTexCoord;
void main() {
vec4 col = texture2D(uTexture, vTexCoord);
float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;
gl_FragColor = vec4(average, average, average, col.a);
}`},mode:"average",mainParameter:"mode",applyTo2d:function(gt){var vt=gt.imageData,yt=vt.data,bt,Ct=yt.length,xt,It=this.mode;for(bt=0;bt<Ct;bt+=4)It==="average"?xt=(yt[bt]+yt[bt+1]+yt[bt+2])/3:It==="lightness"?xt=(Math.min(yt[bt],yt[bt+1],yt[bt+2])+Math.max(yt[bt],yt[bt+1],yt[bt+2]))/2:It==="luminosity"&&(xt=.21*yt[bt]+.72*yt[bt+1]+.07*yt[bt+2]),yt[bt]=xt,yt[bt+1]=xt,yt[bt+2]=xt},retrieveShader:function(gt){var vt=this.type+"_"+this.mode;if(!gt.programCache.hasOwnProperty(vt)){var yt=this.fragmentSource[this.mode];gt.programCache[vt]=this.createProgram(gt.context,yt)}return gt.programCache[vt]},getUniformLocations:function(gt,vt){return{uMode:gt.getUniformLocation(vt,"uMode")}},sendUniformData:function(gt,vt){var yt=1;gt.uniform1i(vt.uMode,yt)},isNeutralState:function(){return!1}}),ut.Image.filters.Grayscale.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Invert=At(pt.BaseFilter,{type:"Invert",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform int uInvert;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
if (uInvert == 1) {
gl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);
} else {
gl_FragColor = color;
}
}`,invert:!0,mainParameter:"invert",applyTo2d:function(gt){var vt=gt.imageData,yt=vt.data,bt,Ct=yt.length;for(bt=0;bt<Ct;bt+=4)yt[bt]=255-yt[bt],yt[bt+1]=255-yt[bt+1],yt[bt+2]=255-yt[bt+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(gt,vt){return{uInvert:gt.getUniformLocation(vt,"uInvert")}},sendUniformData:function(gt,vt){gt.uniform1i(vt.uInvert,this.invert)}}),ut.Image.filters.Invert.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.extend,At=ut.Image.filters,gt=ut.util.createClass;At.Noise=gt(At.BaseFilter,{type:"Noise",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uStepH;
uniform float uNoise;
uniform float uSeed;
varying vec2 vTexCoord;
float rand(vec2 co, float seed, float vScale) {
return fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);
}
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;
gl_FragColor = color;
}`,mainParameter:"noise",noise:0,applyTo2d:function(vt){if(this.noise!==0){var yt=vt.imageData,bt=yt.data,Ct,xt=bt.length,It=this.noise,St;for(Ct=0,xt=bt.length;Ct<xt;Ct+=4)St=(.5-Math.random())*It,bt[Ct]+=St,bt[Ct+1]+=St,bt[Ct+2]+=St}},getUniformLocations:function(vt,yt){return{uNoise:vt.getUniformLocation(yt,"uNoise"),uSeed:vt.getUniformLocation(yt,"uSeed")}},sendUniformData:function(vt,yt){vt.uniform1f(yt.uNoise,this.noise/255),vt.uniform1f(yt.uSeed,Math.random())},toObject:function(){return pt(this.callSuper("toObject"),{noise:this.noise})}}),ut.Image.filters.Noise.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Pixelate=At(pt.BaseFilter,{type:"Pixelate",blocksize:4,mainParameter:"blocksize",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uBlocksize;
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
float blockW = uBlocksize * uStepW;
float blockH = uBlocksize * uStepW;
int posX = int(vTexCoord.x / blockW);
int posY = int(vTexCoord.y / blockH);
float fposX = float(posX);
float fposY = float(posY);
vec2 squareCoords = vec2(fposX * blockW, fposY * blockH);
vec4 color = texture2D(uTexture, squareCoords);
gl_FragColor = color;
}`,applyTo2d:function(gt){var vt=gt.imageData,yt=vt.data,bt=vt.height,Ct=vt.width,xt,It,St,Ot,Mt,jt,Ft,Ut,Qt,Ht,Zt;for(It=0;It<bt;It+=this.blocksize)for(St=0;St<Ct;St+=this.blocksize)for(xt=It*4*Ct+St*4,Ot=yt[xt],Mt=yt[xt+1],jt=yt[xt+2],Ft=yt[xt+3],Ht=Math.min(It+this.blocksize,bt),Zt=Math.min(St+this.blocksize,Ct),Ut=It;Ut<Ht;Ut++)for(Qt=St;Qt<Zt;Qt++)xt=Ut*4*Ct+Qt*4,yt[xt]=Ot,yt[xt+1]=Mt,yt[xt+2]=jt,yt[xt+3]=Ft},isNeutralState:function(){return this.blocksize===1},getUniformLocations:function(gt,vt){return{uBlocksize:gt.getUniformLocation(vt,"uBlocksize"),uStepW:gt.getUniformLocation(vt,"uStepW"),uStepH:gt.getUniformLocation(vt,"uStepH")}},sendUniformData:function(gt,vt){gt.uniform1f(vt.uBlocksize,this.blocksize)}}),ut.Image.filters.Pixelate.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.extend,At=ut.Image.filters,gt=ut.util.createClass;At.RemoveColor=gt(At.BaseFilter,{type:"RemoveColor",color:"#FFFFFF",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform vec4 uLow;
uniform vec4 uHigh;
varying vec2 vTexCoord;
void main() {
gl_FragColor = texture2D(uTexture, vTexCoord);
if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {
gl_FragColor.a = 0.0;
}
}`,distance:.02,useAlpha:!1,applyTo2d:function(vt){var yt=vt.imageData,bt=yt.data,Ct,xt=this.distance*255,It,St,Ot,Mt=new ut.Color(this.color).getSource(),jt=[Mt[0]-xt,Mt[1]-xt,Mt[2]-xt],Ft=[Mt[0]+xt,Mt[1]+xt,Mt[2]+xt];for(Ct=0;Ct<bt.length;Ct+=4)It=bt[Ct],St=bt[Ct+1],Ot=bt[Ct+2],It>jt[0]&&St>jt[1]&&Ot>jt[2]&&It<Ft[0]&&St<Ft[1]&&Ot<Ft[2]&&(bt[Ct+3]=0)},getUniformLocations:function(vt,yt){return{uLow:vt.getUniformLocation(yt,"uLow"),uHigh:vt.getUniformLocation(yt,"uHigh")}},sendUniformData:function(vt,yt){var bt=new ut.Color(this.color).getSource(),Ct=parseFloat(this.distance),xt=[0+bt[0]/255-Ct,0+bt[1]/255-Ct,0+bt[2]/255-Ct,1],It=[bt[0]/255+Ct,bt[1]/255+Ct,bt[2]/255+Ct,1];vt.uniform4fv(yt.uLow,xt),vt.uniform4fv(yt.uHigh,It)},toObject:function(){return pt(this.callSuper("toObject"),{color:this.color,distance:this.distance})}}),ut.Image.filters.RemoveColor.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass,gt={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(var vt in gt)pt[vt]=At(pt.ColorMatrix,{type:vt,matrix:gt[vt],mainParameter:!1,colorsOnly:!0}),ut.Image.filters[vt].fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric,pt=ut.Image.filters,At=ut.util.createClass;pt.BlendColor=At(pt.BaseFilter,{type:"BlendColor",color:"#F95C63",mode:"multiply",alpha:1,fragmentSource:{multiply:`gl_FragColor.rgb *= uColor.rgb;
`,screen:`gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);
`,add:`gl_FragColor.rgb += uColor.rgb;
`,diff:`gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);
`,subtract:`gl_FragColor.rgb -= uColor.rgb;
`,lighten:`gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);
`,darken:`gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);
`,exclusion:`gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);
`,overlay:`if (uColor.r < 0.5) {
gl_FragColor.r *= 2.0 * uColor.r;
} else {
gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);
}
if (uColor.g < 0.5) {
gl_FragColor.g *= 2.0 * uColor.g;
} else {
gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);
}
if (uColor.b < 0.5) {
gl_FragColor.b *= 2.0 * uColor.b;
} else {
gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);
}
`,tint:`gl_FragColor.rgb *= (1.0 - uColor.a);
gl_FragColor.rgb += uColor.rgb;
`},buildSource:function(gt){return`precision highp float;
uniform sampler2D uTexture;
uniform vec4 uColor;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
gl_FragColor = color;
if (color.a > 0.0) {
`+this.fragmentSource[gt]+`}
}`},retrieveShader:function(gt){var vt=this.type+"_"+this.mode,yt;return gt.programCache.hasOwnProperty(vt)||(yt=this.buildSource(this.mode),gt.programCache[vt]=this.createProgram(gt.context,yt)),gt.programCache[vt]},applyTo2d:function(gt){var vt=gt.imageData,yt=vt.data,bt=yt.length,Ct,xt,It,St,Ot,Mt,jt,Ft=1-this.alpha;jt=new ut.Color(this.color).getSource(),Ct=jt[0]*this.alpha,xt=jt[1]*this.alpha,It=jt[2]*this.alpha;for(var Ut=0;Ut<bt;Ut+=4)switch(St=yt[Ut],Ot=yt[Ut+1],Mt=yt[Ut+2],this.mode){case"multiply":yt[Ut]=St*Ct/255,yt[Ut+1]=Ot*xt/255,yt[Ut+2]=Mt*It/255;break;case"screen":yt[Ut]=255-(255-St)*(255-Ct)/255,yt[Ut+1]=255-(255-Ot)*(255-xt)/255,yt[Ut+2]=255-(255-Mt)*(255-It)/255;break;case"add":yt[Ut]=St+Ct,yt[Ut+1]=Ot+xt,yt[Ut+2]=Mt+It;break;case"diff":case"difference":yt[Ut]=Math.abs(St-Ct),yt[Ut+1]=Math.abs(Ot-xt),yt[Ut+2]=Math.abs(Mt-It);break;case"subtract":yt[Ut]=St-Ct,yt[Ut+1]=Ot-xt,yt[Ut+2]=Mt-It;break;case"darken":yt[Ut]=Math.min(St,Ct),yt[Ut+1]=Math.min(Ot,xt),yt[Ut+2]=Math.min(Mt,It);break;case"lighten":yt[Ut]=Math.max(St,Ct),yt[Ut+1]=Math.max(Ot,xt),yt[Ut+2]=Math.max(Mt,It);break;case"overlay":yt[Ut]=Ct<128?2*St*Ct/255:255-2*(255-St)*(255-Ct)/255,yt[Ut+1]=xt<128?2*Ot*xt/255:255-2*(255-Ot)*(255-xt)/255,yt[Ut+2]=It<128?2*Mt*It/255:255-2*(255-Mt)*(255-It)/255;break;case"exclusion":yt[Ut]=Ct+St-2*Ct*St/255,yt[Ut+1]=xt+Ot-2*xt*Ot/255,yt[Ut+2]=It+Mt-2*It*Mt/255;break;case"tint":yt[Ut]=Ct+St*Ft,yt[Ut+1]=xt+Ot*Ft,yt[Ut+2]=It+Mt*Ft}},getUniformLocations:function(gt,vt){return{uColor:gt.getUniformLocation(vt,"uColor")}},sendUniformData:function(gt,vt){var yt=new ut.Color(this.color).getSource();yt[0]=this.alpha*yt[0]/255,yt[1]=this.alpha*yt[1]/255,yt[2]=this.alpha*yt[2]/255,yt[3]=this.alpha,gt.uniform4fv(vt.uColor,yt)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),ut.Image.filters.BlendColor.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric,pt=ut.Image.filters,At=ut.util.createClass;pt.BlendImage=At(pt.BaseFilter,{type:"BlendImage",image:null,mode:"multiply",alpha:1,vertexSource:`attribute vec2 aPosition;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
uniform mat3 uTransformMatrix;
void main() {
vTexCoord = aPosition;
vTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
}`,fragmentSource:{multiply:`precision highp float;
uniform sampler2D uTexture;
uniform sampler2D uImage;
uniform vec4 uColor;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec4 color2 = texture2D(uImage, vTexCoord2);
color.rgba *= color2.rgba;
gl_FragColor = color;
}`,mask:`precision highp float;
uniform sampler2D uTexture;
uniform sampler2D uImage;
uniform vec4 uColor;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec4 color2 = texture2D(uImage, vTexCoord2);
color.a = color2.a;
gl_FragColor = color;
}`},retrieveShader:function(gt){var vt=this.type+"_"+this.mode,yt=this.fragmentSource[this.mode];return gt.programCache.hasOwnProperty(vt)||(gt.programCache[vt]=this.createProgram(gt.context,yt)),gt.programCache[vt]},applyToWebGL:function(gt){var vt=gt.context,yt=this.createTexture(gt.filterBackend,this.image);this.bindAdditionalTexture(vt,yt,vt.TEXTURE1),this.callSuper("applyToWebGL",gt),this.unbindAdditionalTexture(vt,vt.TEXTURE1)},createTexture:function(gt,vt){return gt.getCachedTexture(vt.cacheKey,vt._element)},calculateMatrix:function(){var gt=this.image,vt=gt._element.width,yt=gt._element.height;return[1/gt.scaleX,0,0,0,1/gt.scaleY,0,-gt.left/vt,-gt.top/yt,1]},applyTo2d:function(gt){var vt=gt.imageData,yt=gt.filterBackend.resources,bt=vt.data,Ct=bt.length,xt=vt.width,It=vt.height,St,Ot,Mt,jt,Ft,Ut,Qt,Ht,Zt,Wt,$t=this.image,Jt;yt.blendImage||(yt.blendImage=ut.util.createCanvasElement()),Zt=yt.blendImage,Wt=Zt.getContext("2d"),Zt.width!==xt||Zt.height!==It?(Zt.width=xt,Zt.height=It):Wt.clearRect(0,0,xt,It),Wt.setTransform($t.scaleX,0,0,$t.scaleY,$t.left,$t.top),Wt.drawImage($t._element,0,0,xt,It),Jt=Wt.getImageData(0,0,xt,It).data;for(var Nt=0;Nt<Ct;Nt+=4)switch(Ft=bt[Nt],Ut=bt[Nt+1],Qt=bt[Nt+2],Ht=bt[Nt+3],St=Jt[Nt],Ot=Jt[Nt+1],Mt=Jt[Nt+2],jt=Jt[Nt+3],this.mode){case"multiply":bt[Nt]=Ft*St/255,bt[Nt+1]=Ut*Ot/255,bt[Nt+2]=Qt*Mt/255,bt[Nt+3]=Ht*jt/255;break;case"mask":bt[Nt+3]=jt;break}},getUniformLocations:function(gt,vt){return{uTransformMatrix:gt.getUniformLocation(vt,"uTransformMatrix"),uImage:gt.getUniformLocation(vt,"uImage")}},sendUniformData:function(gt,vt){var yt=this.calculateMatrix();gt.uniform1i(vt.uImage,1),gt.uniformMatrix3fv(vt.uTransformMatrix,!1,yt)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),ut.Image.filters.BlendImage.fromObject=function(gt,vt){ut.Image.fromObject(gt.image,function(yt){var bt=ut.util.object.clone(gt);bt.image=yt,vt(new ut.Image.filters.BlendImage(bt))})}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=Math.pow,At=Math.floor,gt=Math.sqrt,vt=Math.abs,yt=Math.round,bt=Math.sin,Ct=Math.ceil,xt=ut.Image.filters,It=ut.util.createClass;xt.Resize=It(xt.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(St,Ot){return{uDelta:St.getUniformLocation(Ot,"uDelta"),uTaps:St.getUniformLocation(Ot,"uTaps")}},sendUniformData:function(St,Ot){St.uniform2fv(Ot.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),St.uniform1fv(Ot.uTaps,this.taps)},retrieveShader:function(St){var Ot=this.getFilterWindow(),Mt=this.type+"_"+Ot;if(!St.programCache.hasOwnProperty(Mt)){var jt=this.generateShader(Ot);St.programCache[Mt]=this.createProgram(St.context,jt)}return St.programCache[Mt]},getFilterWindow:function(){var St=this.tempScale;return Math.ceil(this.lanczosLobes/St)},getTaps:function(){for(var St=this.lanczosCreate(this.lanczosLobes),Ot=this.tempScale,Mt=this.getFilterWindow(),jt=new Array(Mt),Ft=1;Ft<=Mt;Ft++)jt[Ft-1]=St(Ft*Ot);return jt},generateShader:function(jt){for(var Ot=new Array(jt),Mt=this.fragmentSourceTOP,jt,Ft=1;Ft<=jt;Ft++)Ot[Ft-1]=Ft+".0 * uDelta";return Mt+="uniform float uTaps["+jt+`];
`,Mt+=`void main() {
`,Mt+=`  vec4 color = texture2D(uTexture, vTexCoord);
`,Mt+=`  float sum = 1.0;
`,Ot.forEach(function(Ut,Qt){Mt+="  color += texture2D(uTexture, vTexCoord + "+Ut+") * uTaps["+Qt+`];
`,Mt+="  color += texture2D(uTexture, vTexCoord - "+Ut+") * uTaps["+Qt+`];
`,Mt+="  sum += 2.0 * uTaps["+Qt+`];
`}),Mt+=`  gl_FragColor = color / sum;
`,Mt+="}",Mt},fragmentSourceTOP:`precision highp float;
uniform sampler2D uTexture;
uniform vec2 uDelta;
varying vec2 vTexCoord;
`,applyTo:function(St){St.webgl?(St.passes++,this.width=St.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=St.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),St.destinationWidth=this.dW,this._setupFrameBuffer(St),this.applyToWebGL(St),this._swapTextures(St),St.sourceWidth=St.destinationWidth,this.height=St.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),St.destinationHeight=this.dH,this._setupFrameBuffer(St),this.applyToWebGL(St),this._swapTextures(St),St.sourceHeight=St.destinationHeight):this.applyTo2d(St)},isNeutralState:function(){return this.scaleX===1&&this.scaleY===1},lanczosCreate:function(St){return function(Ot){if(Ot>=St||Ot<=-St)return 0;if(Ot<11920929e-14&&Ot>-11920929e-14)return 1;Ot*=Math.PI;var Mt=Ot/St;return bt(Ot)/Ot*bt(Mt)/Mt}},applyTo2d:function(St){var Ot=St.imageData,Mt=this.scaleX,jt=this.scaleY;this.rcpScaleX=1/Mt,this.rcpScaleY=1/jt;var Ft=Ot.width,Ut=Ot.height,Qt=yt(Ft*Mt),Ht=yt(Ut*jt),Zt;this.resizeType==="sliceHack"?Zt=this.sliceByTwo(St,Ft,Ut,Qt,Ht):this.resizeType==="hermite"?Zt=this.hermiteFastResize(St,Ft,Ut,Qt,Ht):this.resizeType==="bilinear"?Zt=this.bilinearFiltering(St,Ft,Ut,Qt,Ht):this.resizeType==="lanczos"&&(Zt=this.lanczosResize(St,Ft,Ut,Qt,Ht)),St.imageData=Zt},sliceByTwo:function(St,Ot,Mt,jt,Ft){var Ut=St.imageData,Qt=.5,Ht=!1,Zt=!1,Wt=Ot*Qt,$t=Mt*Qt,Jt=ut.filterBackend.resources,Nt,Lt,Kt=0,Pt=0,ln=Ot,Gt=0;for(Jt.sliceByTwo||(Jt.sliceByTwo=document.createElement("canvas")),Nt=Jt.sliceByTwo,(Nt.width<Ot*1.5||Nt.height<Mt)&&(Nt.width=Ot*1.5,Nt.height=Mt),Lt=Nt.getContext("2d"),Lt.clearRect(0,0,Ot*1.5,Mt),Lt.putImageData(Ut,0,0),jt=At(jt),Ft=At(Ft);!Ht||!Zt;)Ot=Wt,Mt=$t,jt<At(Wt*Qt)?Wt=At(Wt*Qt):(Wt=jt,Ht=!0),Ft<At($t*Qt)?$t=At($t*Qt):($t=Ft,Zt=!0),Lt.drawImage(Nt,Kt,Pt,Ot,Mt,ln,Gt,Wt,$t),Kt=ln,Pt=Gt,Gt+=$t;return Lt.getImageData(Kt,Pt,jt,Ft)},lanczosResize:function(St,Ot,Mt,jt,Ft){function Ut(tn){var _i,Xt,Vt,qt,rn,nn,cn,un,gn,mn,dn;for(Gt.x=(tn+.5)*$t,on.x=At(Gt.x),_i=0;_i<Ft;_i++){for(Gt.y=(_i+.5)*Jt,on.y=At(Gt.y),rn=0,nn=0,cn=0,un=0,gn=0,Xt=on.x-Kt;Xt<=on.x+Kt;Xt++)if(!(Xt<0||Xt>=Ot)){mn=At(1e3*vt(Xt-Gt.x)),ln[mn]||(ln[mn]={});for(var fn=on.y-Pt;fn<=on.y+Pt;fn++)fn<0||fn>=Mt||(dn=At(1e3*vt(fn-Gt.y)),ln[mn][dn]||(ln[mn][dn]=Wt(gt(pt(mn*Nt,2)+pt(dn*Lt,2))/1e3)),Vt=ln[mn][dn],Vt>0&&(qt=(fn*Ot+Xt)*4,rn+=Vt,nn+=Vt*Qt[qt],cn+=Vt*Qt[qt+1],un+=Vt*Qt[qt+2],gn+=Vt*Qt[qt+3]))}qt=(_i*jt+tn)*4,Zt[qt]=nn/rn,Zt[qt+1]=cn/rn,Zt[qt+2]=un/rn,Zt[qt+3]=gn/rn}return++tn<jt?Ut(tn):Ht}var Qt=St.imageData.data,Ht=St.ctx.createImageData(jt,Ft),Zt=Ht.data,Wt=this.lanczosCreate(this.lanczosLobes),$t=this.rcpScaleX,Jt=this.rcpScaleY,Nt=2/this.rcpScaleX,Lt=2/this.rcpScaleY,Kt=Ct($t*this.lanczosLobes/2),Pt=Ct(Jt*this.lanczosLobes/2),ln={},Gt={},on={};return Ut(0)},bilinearFiltering:function(St,Ot,Mt,jt,Ft){var Ut,Qt,Ht,Zt,Wt,$t,Jt,Nt,Lt,Kt,Pt,ln,Gt=0,on,tn=this.rcpScaleX,_i=this.rcpScaleY,Xt=4*(Ot-1),Vt=St.imageData,qt=Vt.data,rn=St.ctx.createImageData(jt,Ft),nn=rn.data;for(Jt=0;Jt<Ft;Jt++)for(Nt=0;Nt<jt;Nt++)for(Wt=At(tn*Nt),$t=At(_i*Jt),Lt=tn*Nt-Wt,Kt=_i*Jt-$t,on=4*($t*Ot+Wt),Pt=0;Pt<4;Pt++)Ut=qt[on+Pt],Qt=qt[on+4+Pt],Ht=qt[on+Xt+Pt],Zt=qt[on+Xt+4+Pt],ln=Ut*(1-Lt)*(1-Kt)+Qt*Lt*(1-Kt)+Ht*Kt*(1-Lt)+Zt*Lt*Kt,nn[Gt++]=ln;return rn},hermiteFastResize:function(St,Ot,Mt,jt,Ft){for(var Ut=this.rcpScaleX,Qt=this.rcpScaleY,Ht=Ct(Ut/2),Zt=Ct(Qt/2),Wt=St.imageData,$t=Wt.data,Jt=St.ctx.createImageData(jt,Ft),Nt=Jt.data,Lt=0;Lt<Ft;Lt++)for(var Kt=0;Kt<jt;Kt++){for(var Pt=(Kt+Lt*jt)*4,ln=0,Gt=0,on=0,tn=0,_i=0,Xt=0,Vt=0,qt=(Lt+.5)*Qt,rn=At(Lt*Qt);rn<(Lt+1)*Qt;rn++)for(var nn=vt(qt-(rn+.5))/Zt,cn=(Kt+.5)*Ut,un=nn*nn,gn=At(Kt*Ut);gn<(Kt+1)*Ut;gn++){var mn=vt(cn-(gn+.5))/Ht,dn=gt(un+mn*mn);dn>1&&dn<-1||(ln=2*dn*dn*dn-3*dn*dn+1,ln>0&&(mn=4*(gn+rn*Ot),Vt+=ln*$t[mn+3],on+=ln,$t[mn+3]<255&&(ln=ln*$t[mn+3]/250),tn+=ln*$t[mn],_i+=ln*$t[mn+1],Xt+=ln*$t[mn+2],Gt+=ln))}Nt[Pt]=tn/Gt,Nt[Pt+1]=_i/Gt,Nt[Pt+2]=Xt/Gt,Nt[Pt+3]=Vt/on}return Jt},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),ut.Image.filters.Resize.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Contrast=At(pt.BaseFilter,{type:"Contrast",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uContrast;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));
color.rgb = contrastF * (color.rgb - 0.5) + 0.5;
gl_FragColor = color;
}`,contrast:0,mainParameter:"contrast",applyTo2d:function(gt){if(this.contrast!==0){var vt=gt.imageData,yt,Ct,bt=vt.data,Ct=bt.length,xt=Math.floor(this.contrast*255),It=259*(xt+255)/(255*(259-xt));for(yt=0;yt<Ct;yt+=4)bt[yt]=It*(bt[yt]-128)+128,bt[yt+1]=It*(bt[yt+1]-128)+128,bt[yt+2]=It*(bt[yt+2]-128)+128}},getUniformLocations:function(gt,vt){return{uContrast:gt.getUniformLocation(vt,"uContrast")}},sendUniformData:function(gt,vt){gt.uniform1f(vt.uContrast,this.contrast)}}),ut.Image.filters.Contrast.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Saturation=At(pt.BaseFilter,{type:"Saturation",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uSaturation;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float rgMax = max(color.r, color.g);
float rgbMax = max(rgMax, color.b);
color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;
color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;
color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;
gl_FragColor = color;
}`,saturation:0,mainParameter:"saturation",applyTo2d:function(gt){if(this.saturation!==0){var vt=gt.imageData,yt=vt.data,bt=yt.length,Ct=-this.saturation,xt,It;for(xt=0;xt<bt;xt+=4)It=Math.max(yt[xt],yt[xt+1],yt[xt+2]),yt[xt]+=It!==yt[xt]?(It-yt[xt])*Ct:0,yt[xt+1]+=It!==yt[xt+1]?(It-yt[xt+1])*Ct:0,yt[xt+2]+=It!==yt[xt+2]?(It-yt[xt+2])*Ct:0}},getUniformLocations:function(gt,vt){return{uSaturation:gt.getUniformLocation(vt,"uSaturation")}},sendUniformData:function(gt,vt){gt.uniform1f(vt.uSaturation,-this.saturation)}}),ut.Image.filters.Saturation.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Vibrance=At(pt.BaseFilter,{type:"Vibrance",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform float uVibrance;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float max = max(color.r, max(color.g, color.b));
float avg = (color.r + color.g + color.b) / 3.0;
float amt = (abs(max - avg) * 2.0) * uVibrance;
color.r += max != color.r ? (max - color.r) * amt : 0.00;
color.g += max != color.g ? (max - color.g) * amt : 0.00;
color.b += max != color.b ? (max - color.b) * amt : 0.00;
gl_FragColor = color;
}`,vibrance:0,mainParameter:"vibrance",applyTo2d:function(gt){if(this.vibrance!==0){var vt=gt.imageData,yt=vt.data,bt=yt.length,Ct=-this.vibrance,xt,It,St,Ot;for(xt=0;xt<bt;xt+=4)It=Math.max(yt[xt],yt[xt+1],yt[xt+2]),St=(yt[xt]+yt[xt+1]+yt[xt+2])/3,Ot=Math.abs(It-St)*2/255*Ct,yt[xt]+=It!==yt[xt]?(It-yt[xt])*Ot:0,yt[xt+1]+=It!==yt[xt+1]?(It-yt[xt+1])*Ot:0,yt[xt+2]+=It!==yt[xt+2]?(It-yt[xt+2])*Ot:0}},getUniformLocations:function(gt,vt){return{uVibrance:gt.getUniformLocation(vt,"uVibrance")}},sendUniformData:function(gt,vt){gt.uniform1f(vt.uVibrance,-this.vibrance)}}),ut.Image.filters.Vibrance.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Blur=At(pt.BaseFilter,{type:"Blur",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform vec2 uDelta;
varying vec2 vTexCoord;
const float nSamples = 15.0;
vec3 v3offset = vec3(12.9898, 78.233, 151.7182);
float random(vec3 scale) {
return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);
}
void main() {
vec4 color = vec4(0.0);
float total = 0.0;
float offset = random(v3offset);
for (float t = -nSamples; t <= nSamples; t++) {
float percent = (t + offset - 0.5) / nSamples;
float weight = 1.0 - abs(percent);
color += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;
total += weight;
}
gl_FragColor = color / total;
}`,blur:0,mainParameter:"blur",applyTo:function(gt){gt.webgl?(this.aspectRatio=gt.sourceWidth/gt.sourceHeight,gt.passes++,this._setupFrameBuffer(gt),this.horizontal=!0,this.applyToWebGL(gt),this._swapTextures(gt),this._setupFrameBuffer(gt),this.horizontal=!1,this.applyToWebGL(gt),this._swapTextures(gt)):this.applyTo2d(gt)},applyTo2d:function(gt){gt.imageData=this.simpleBlur(gt)},simpleBlur:function(gt){var vt=gt.filterBackend.resources,yt,bt,Ct=gt.imageData.width,xt=gt.imageData.height;vt.blurLayer1||(vt.blurLayer1=ut.util.createCanvasElement(),vt.blurLayer2=ut.util.createCanvasElement()),yt=vt.blurLayer1,bt=vt.blurLayer2,(yt.width!==Ct||yt.height!==xt)&&(bt.width=yt.width=Ct,bt.height=yt.height=xt);var It=yt.getContext("2d"),St=bt.getContext("2d"),Ot=15,Mt,jt,Ft,Ut,Qt=this.blur*.06*.5;for(It.putImageData(gt.imageData,0,0),St.clearRect(0,0,Ct,xt),Ut=-Ot;Ut<=Ot;Ut++)Mt=(Math.random()-.5)/4,jt=Ut/Ot,Ft=Qt*jt*Ct+Mt,St.globalAlpha=1-Math.abs(jt),St.drawImage(yt,Ft,Mt),It.drawImage(bt,0,0),St.globalAlpha=1,St.clearRect(0,0,bt.width,bt.height);for(Ut=-Ot;Ut<=Ot;Ut++)Mt=(Math.random()-.5)/4,jt=Ut/Ot,Ft=Qt*jt*xt+Mt,St.globalAlpha=1-Math.abs(jt),St.drawImage(yt,Mt,Ft),It.drawImage(bt,0,0),St.globalAlpha=1,St.clearRect(0,0,bt.width,bt.height);gt.ctx.drawImage(yt,0,0);var Ht=gt.ctx.getImageData(0,0,yt.width,yt.height);return It.globalAlpha=1,It.clearRect(0,0,yt.width,yt.height),Ht},getUniformLocations:function(gt,vt){return{delta:gt.getUniformLocation(vt,"uDelta")}},sendUniformData:function(gt,vt){var yt=this.chooseRightDelta();gt.uniform2fv(vt.delta,yt)},chooseRightDelta:function(){var gt=1,vt=[0,0],yt;return this.horizontal?this.aspectRatio>1&&(gt=1/this.aspectRatio):this.aspectRatio<1&&(gt=this.aspectRatio),yt=gt*this.blur*.12,this.horizontal?vt[0]=yt:vt[1]=yt,vt}}),pt.Blur.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Gamma=At(pt.BaseFilter,{type:"Gamma",fragmentSource:`precision highp float;
uniform sampler2D uTexture;
uniform vec3 uGamma;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec3 correction = (1.0 / uGamma);
color.r = pow(color.r, correction.r);
color.g = pow(color.g, correction.g);
color.b = pow(color.b, correction.b);
gl_FragColor = color;
gl_FragColor.rgb *= color.a;
}`,gamma:[1,1,1],mainParameter:"gamma",initialize:function(gt){this.gamma=[1,1,1],pt.BaseFilter.prototype.initialize.call(this,gt)},applyTo2d:function(gt){var vt=gt.imageData,yt=vt.data,bt=this.gamma,Ct=yt.length,xt=1/bt[0],It=1/bt[1],St=1/bt[2],Ot;for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),Ot=0,Ct=256;Ot<Ct;Ot++)this.rVals[Ot]=Math.pow(Ot/255,xt)*255,this.gVals[Ot]=Math.pow(Ot/255,It)*255,this.bVals[Ot]=Math.pow(Ot/255,St)*255;for(Ot=0,Ct=yt.length;Ot<Ct;Ot+=4)yt[Ot]=this.rVals[yt[Ot]],yt[Ot+1]=this.gVals[yt[Ot+1]],yt[Ot+2]=this.bVals[yt[Ot+2]]},getUniformLocations:function(gt,vt){return{uGamma:gt.getUniformLocation(vt,"uGamma")}},sendUniformData:function(gt,vt){gt.uniform3fv(vt.uGamma,this.gamma)}}),ut.Image.filters.Gamma.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.Composed=At(pt.BaseFilter,{type:"Composed",subFilters:[],initialize:function(gt){this.callSuper("initialize",gt),this.subFilters=this.subFilters.slice(0)},applyTo:function(gt){gt.passes+=this.subFilters.length-1,this.subFilters.forEach(function(vt){vt.applyTo(gt)})},toObject:function(){return ut.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map(function(gt){return gt.toObject()})})},isNeutralState:function(){return!this.subFilters.some(function(gt){return!gt.isNeutralState()})}}),ut.Image.filters.Composed.fromObject=function(gt,vt){var yt=gt.subFilters||[],bt=yt.map(function(xt){return new ut.Image.filters[xt.type](xt)}),Ct=new ut.Image.filters.Composed({subFilters:bt});return vt&&vt(Ct),Ct}}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.Image.filters,At=ut.util.createClass;pt.HueRotation=At(pt.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var gt=this.rotation*Math.PI,vt=ut.util.cos(gt),yt=ut.util.sin(gt),bt=1/3,Ct=Math.sqrt(bt)*yt,xt=1-vt;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=vt+xt/3,this.matrix[1]=bt*xt-Ct,this.matrix[2]=bt*xt+Ct,this.matrix[5]=bt*xt+Ct,this.matrix[6]=vt+bt*xt,this.matrix[7]=bt*xt-Ct,this.matrix[10]=bt*xt-Ct,this.matrix[11]=bt*xt+Ct,this.matrix[12]=vt+bt*xt},isNeutralState:function(gt){return this.calculateMatrix(),pt.BaseFilter.prototype.isNeutralState.call(this,gt)},applyTo:function(gt){this.calculateMatrix(),pt.BaseFilter.prototype.applyTo.call(this,gt)}}),ut.Image.filters.HueRotation.fromObject=ut.Image.filters.BaseFilter.fromObject}(ot),function(ft){var ut=ft.fabric||(ft.fabric={}),pt=ut.util.object.clone;if(ut.Text){ut.warn("fabric.Text is already defined");return}var At="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide".split(" ");ut.Text=ut.util.createClass(ut.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide"],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:"left",fontStyle:"normal",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:"",stateProperties:ut.Object.prototype.stateProperties.concat(At),cacheProperties:ut.Object.prototype.cacheProperties.concat(At),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:"left",_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:"ltr",_styleProperties:["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor"],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(gt,vt){this.styles=vt?vt.styles||{}:{},this.text=gt,this.__skipDimension=!0,this.callSuper("initialize",vt),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:"_dimensionAffectingProps"})},setPathInfo:function(){var gt=this.path;gt&&(gt.segmentsInfo=ut.util.getPathSegmentsInfo(gt.path))},getMeasuringContext:function(){return ut._measuringContext||(ut._measuringContext=this.canvas&&this.canvas.contextCache||ut.util.createCanvasElement().getContext("2d")),ut._measuringContext},_splitText:function(){var gt=this._splitTextIntoLines(this.text);return this.textLines=gt.lines,this._textLines=gt.graphemeLines,this._unwrappedTextLines=gt._unwrappedLines,this._text=gt.graphemeText,gt},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.saveState({propertySet:"_dimensionAffectingProps"}))},enlargeSpaces:function(){for(var gt,vt,yt,bt,Ct,xt,It,St=0,Ot=this._textLines.length;St<Ot;St++)if(!(this.textAlign!=="justify"&&(St===Ot-1||this.isEndOfWrapping(St)))&&(bt=0,Ct=this._textLines[St],vt=this.getLineWidth(St),vt<this.width&&(It=this.textLines[St].match(this._reSpacesAndTabs)))){yt=It.length,gt=(this.width-vt)/yt;for(var Mt=0,jt=Ct.length;Mt<=jt;Mt++)xt=this.__charBounds[St][Mt],this._reSpaceAndTab.test(Ct[Mt])?(xt.width+=gt,xt.kernedWidth+=gt,xt.left+=bt,bt+=gt):xt.left+=bt}},isEndOfWrapping:function(gt){return gt===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var gt=this.callSuper("_getCacheCanvasDimensions"),vt=this.fontSize;return gt.width+=vt*gt.zoomX,gt.height+=vt*gt.zoomY,gt},_render:function(gt){var vt=this.path;vt&&!vt.isNotVisible()&&vt._render(gt),this._setTextStyles(gt),this._renderTextLinesBackground(gt),this._renderTextDecoration(gt,"underline"),this._renderText(gt),this._renderTextDecoration(gt,"overline"),this._renderTextDecoration(gt,"linethrough")},_renderText:function(gt){this.paintFirst==="stroke"?(this._renderTextStroke(gt),this._renderTextFill(gt)):(this._renderTextFill(gt),this._renderTextStroke(gt))},_setTextStyles:function(gt,vt,yt){gt.textBaseline="alphabetic",gt.font=this._getFontDeclaration(vt,yt)},calcTextWidth:function(){for(var gt=this.getLineWidth(0),vt=1,yt=this._textLines.length;vt<yt;vt++){var bt=this.getLineWidth(vt);bt>gt&&(gt=bt)}return gt},_renderTextLine:function(gt,vt,yt,bt,Ct,xt){this._renderChars(gt,vt,yt,bt,Ct,xt)},_renderTextLinesBackground:function(gt){if(!(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor"))){for(var vt,yt,bt=gt.fillStyle,Ct,xt,It=this._getLeftOffset(),St=this._getTopOffset(),Ot=0,Mt=0,jt,Ft,Ut=this.path,Qt,Ht=0,Zt=this._textLines.length;Ht<Zt;Ht++){if(vt=this.getHeightOfLine(Ht),!this.textBackgroundColor&&!this.styleHas("textBackgroundColor",Ht)){St+=vt;continue}Ct=this._textLines[Ht],yt=this._getLineLeftOffset(Ht),Mt=0,Ot=0,xt=this.getValueOfPropertyAt(Ht,0,"textBackgroundColor");for(var Wt=0,$t=Ct.length;Wt<$t;Wt++)jt=this.__charBounds[Ht][Wt],Ft=this.getValueOfPropertyAt(Ht,Wt,"textBackgroundColor"),Ut?(gt.save(),gt.translate(jt.renderLeft,jt.renderTop),gt.rotate(jt.angle),gt.fillStyle=Ft,Ft&&gt.fillRect(-jt.width/2,-vt/this.lineHeight*(1-this._fontSizeFraction),jt.width,vt/this.lineHeight),gt.restore()):Ft!==xt?(Qt=It+yt+Ot,this.direction==="rtl"&&(Qt=this.width-Qt-Mt),gt.fillStyle=xt,xt&&gt.fillRect(Qt,St,Mt,vt/this.lineHeight),Ot=jt.left,Mt=jt.width,xt=Ft):Mt+=jt.kernedWidth;Ft&&!Ut&&(Qt=It+yt+Ot,this.direction==="rtl"&&(Qt=this.width-Qt-Mt),gt.fillStyle=Ft,gt.fillRect(Qt,St,Mt,vt/this.lineHeight)),St+=vt}gt.fillStyle=bt,this._removeShadow(gt)}},getFontCache:function(gt){var vt=gt.fontFamily.toLowerCase();ut.charWidthsCache[vt]||(ut.charWidthsCache[vt]={});var yt=ut.charWidthsCache[vt],bt=gt.fontStyle.toLowerCase()+"_"+(gt.fontWeight+"").toLowerCase();return yt[bt]||(yt[bt]={}),yt[bt]},_measureChar:function(gt,vt,yt,bt){var Ct=this.getFontCache(vt),xt=this._getFontDeclaration(vt),It=this._getFontDeclaration(bt),St=yt+gt,Ot=xt===It,Mt,jt,Ft,Ut=vt.fontSize/this.CACHE_FONT_SIZE,Qt;if(yt&&Ct[yt]!==void 0&&(Ft=Ct[yt]),Ct[gt]!==void 0&&(Qt=Mt=Ct[gt]),Ot&&Ct[St]!==void 0&&(jt=Ct[St],Qt=jt-Ft),Mt===void 0||Ft===void 0||jt===void 0){var Ht=this.getMeasuringContext();this._setTextStyles(Ht,vt,!0)}return Mt===void 0&&(Qt=Mt=Ht.measureText(gt).width,Ct[gt]=Mt),Ft===void 0&&Ot&&yt&&(Ft=Ht.measureText(yt).width,Ct[yt]=Ft),Ot&&jt===void 0&&(jt=Ht.measureText(St).width,Ct[St]=jt,Qt=jt-Ft),{width:Mt*Ut,kernedWidth:Qt*Ut}},getHeightOfChar:function(gt,vt){return this.getValueOfPropertyAt(gt,vt,"fontSize")},measureLine:function(gt){var vt=this._measureLine(gt);return this.charSpacing!==0&&(vt.width-=this._getWidthOfCharSpacing()),vt.width<0&&(vt.width=0),vt},_measureLine:function(gt){var vt=0,yt,bt,Ct=this._textLines[gt],xt,It,St=0,Ot=new Array(Ct.length),Mt=0,jt,Ft,Ut=this.path,Qt=this.pathSide==="right";for(this.__charBounds[gt]=Ot,yt=0;yt<Ct.length;yt++)bt=Ct[yt],It=this._getGraphemeBox(bt,gt,yt,xt),Ot[yt]=It,vt+=It.kernedWidth,xt=bt;if(Ot[yt]={left:It?It.left+It.width:0,width:0,kernedWidth:0,height:this.fontSize},Ut){switch(Ft=Ut.segmentsInfo[Ut.segmentsInfo.length-1].length,jt=ut.util.getPointOnPath(Ut.path,0,Ut.segmentsInfo),jt.x+=Ut.pathOffset.x,jt.y+=Ut.pathOffset.y,this.textAlign){case"left":Mt=Qt?Ft-vt:0;break;case"center":Mt=(Ft-vt)/2;break;case"right":Mt=Qt?0:Ft-vt;break}for(Mt+=this.pathStartOffset*(Qt?-1:1),yt=Qt?Ct.length-1:0;Qt?yt>=0:yt<Ct.length;Qt?yt--:yt++)It=Ot[yt],Mt>Ft?Mt%=Ft:Mt<0&&(Mt+=Ft),this._setGraphemeOnPath(Mt,It,jt),Mt+=It.kernedWidth}return{width:vt,numOfSpaces:St}},_setGraphemeOnPath:function(gt,vt,yt){var bt=gt+vt.kernedWidth/2,Ct=this.path,xt=ut.util.getPointOnPath(Ct.path,bt,Ct.segmentsInfo);vt.renderLeft=xt.x-yt.x,vt.renderTop=xt.y-yt.y,vt.angle=xt.angle+(this.pathSide==="right"?Math.PI:0)},_getGraphemeBox:function(gt,vt,yt,bt,Ct){var xt=this.getCompleteStyleDeclaration(vt,yt),It=bt?this.getCompleteStyleDeclaration(vt,yt-1):{},St=this._measureChar(gt,xt,bt,It),Ot=St.kernedWidth,Mt=St.width,jt;this.charSpacing!==0&&(jt=this._getWidthOfCharSpacing(),Mt+=jt,Ot+=jt);var Ft={width:Mt,left:0,height:xt.fontSize,kernedWidth:Ot,deltaY:xt.deltaY};if(yt>0&&!Ct){var Ut=this.__charBounds[vt][yt-1];Ft.left=Ut.left+Ut.width+St.kernedWidth-St.width}return Ft},getHeightOfLine:function(gt){if(this.__lineHeights[gt])return this.__lineHeights[gt];for(var vt=this._textLines[gt],yt=this.getHeightOfChar(gt,0),bt=1,Ct=vt.length;bt<Ct;bt++)yt=Math.max(this.getHeightOfChar(gt,bt),yt);return this.__lineHeights[gt]=yt*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var gt,vt=0,yt=0,bt=this._textLines.length;yt<bt;yt++)gt=this.getHeightOfLine(yt),vt+=yt===bt-1?gt/this.lineHeight:gt;return vt},_getLeftOffset:function(){return this.direction==="ltr"?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(gt,vt){gt.save();for(var yt=0,bt=this._getLeftOffset(),Ct=this._getTopOffset(),xt=0,It=this._textLines.length;xt<It;xt++){var St=this.getHeightOfLine(xt),Ot=St/this.lineHeight,Mt=this._getLineLeftOffset(xt);this._renderTextLine(vt,gt,this._textLines[xt],bt+Mt,Ct+yt+Ot,xt),yt+=St}gt.restore()},_renderTextFill:function(gt){!this.fill&&!this.styleHas("fill")||this._renderTextCommon(gt,"fillText")},_renderTextStroke:function(gt){(!this.stroke||this.strokeWidth===0)&&this.isEmptyStyles()||(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(gt),gt.save(),this._setLineDash(gt,this.strokeDashArray),gt.beginPath(),this._renderTextCommon(gt,"strokeText"),gt.closePath(),gt.restore())},_renderChars:function(gt,vt,yt,bt,Ct,xt){var It=this.getHeightOfLine(xt),St=this.textAlign.indexOf("justify")!==-1,Ot,Mt,jt="",Ft,Ut=0,Qt,Ht=this.path,Zt=!St&&this.charSpacing===0&&this.isEmptyStyles(xt)&&!Ht,Wt=this.direction==="ltr",$t=this.direction==="ltr"?1:-1,Jt;if(vt.save(),Ct-=It*this._fontSizeFraction/this.lineHeight,Zt){vt.canvas.setAttribute("dir",Wt?"ltr":"rtl"),vt.direction=Wt?"ltr":"rtl",vt.textAlign=Wt?"left":"right",this._renderChar(gt,vt,xt,0,yt.join(""),bt,Ct,It),vt.restore();return}for(var Nt=0,Lt=yt.length-1;Nt<=Lt;Nt++)Qt=Nt===Lt||this.charSpacing||Ht,jt+=yt[Nt],Ft=this.__charBounds[xt][Nt],Ut===0?(bt+=$t*(Ft.kernedWidth-Ft.width),Ut+=Ft.width):Ut+=Ft.kernedWidth,St&&!Qt&&this._reSpaceAndTab.test(yt[Nt])&&(Qt=!0),Qt||(Ot=Ot||this.getCompleteStyleDeclaration(xt,Nt),Mt=this.getCompleteStyleDeclaration(xt,Nt+1),Qt=this._hasStyleChanged(Ot,Mt)),Qt&&(Ht?(vt.save(),vt.translate(Ft.renderLeft,Ft.renderTop),vt.rotate(Ft.angle),this._renderChar(gt,vt,xt,Nt,jt,-Ut/2,0,It),vt.restore()):(Jt=bt,vt.canvas.setAttribute("dir",Wt?"ltr":"rtl"),vt.direction=Wt?"ltr":"rtl",vt.textAlign=Wt?"left":"right",this._renderChar(gt,vt,xt,Nt,jt,Jt,Ct,It)),jt="",Ot=Mt,bt+=$t*Ut,Ut=0);vt.restore()},_applyPatternGradientTransformText:function(gt){var vt=ut.util.createCanvasElement(),yt,bt=this.width+this.strokeWidth,Ct=this.height+this.strokeWidth;return vt.width=bt,vt.height=Ct,yt=vt.getContext("2d"),yt.beginPath(),yt.moveTo(0,0),yt.lineTo(bt,0),yt.lineTo(bt,Ct),yt.lineTo(0,Ct),yt.closePath(),yt.translate(bt/2,Ct/2),yt.fillStyle=gt.toLive(yt),this._applyPatternGradientTransform(yt,gt),yt.fill(),yt.createPattern(vt,"no-repeat")},handleFiller:function(gt,vt,yt){var bt,Ct;return yt.toLive?yt.gradientUnits==="percentage"||yt.gradientTransform||yt.patternTransform?(bt=-this.width/2,Ct=-this.height/2,gt.translate(bt,Ct),gt[vt]=this._applyPatternGradientTransformText(yt),{offsetX:bt,offsetY:Ct}):(gt[vt]=yt.toLive(gt,this),this._applyPatternGradientTransform(gt,yt)):(gt[vt]=yt,{offsetX:0,offsetY:0})},_setStrokeStyles:function(gt,vt){return gt.lineWidth=vt.strokeWidth,gt.lineCap=this.strokeLineCap,gt.lineDashOffset=this.strokeDashOffset,gt.lineJoin=this.strokeLineJoin,gt.miterLimit=this.strokeMiterLimit,this.handleFiller(gt,"strokeStyle",vt.stroke)},_setFillStyles:function(gt,vt){return this.handleFiller(gt,"fillStyle",vt.fill)},_renderChar:function(gt,vt,yt,bt,Ct,xt,It){var St=this._getStyleDeclaration(yt,bt),Ot=this.getCompleteStyleDeclaration(yt,bt),Mt=gt==="fillText"&&Ot.fill,jt=gt==="strokeText"&&Ot.stroke&&Ot.strokeWidth,Ft,Ut;!jt&&!Mt||(vt.save(),Mt&&(Ft=this._setFillStyles(vt,Ot)),jt&&(Ut=this._setStrokeStyles(vt,Ot)),vt.font=this._getFontDeclaration(Ot),St&&St.textBackgroundColor&&this._removeShadow(vt),St&&St.deltaY&&(It+=St.deltaY),Mt&&vt.fillText(Ct,xt-Ft.offsetX,It-Ft.offsetY),jt&&vt.strokeText(Ct,xt-Ut.offsetX,It-Ut.offsetY),vt.restore())},setSuperscript:function(gt,vt){return this._setScript(gt,vt,this.superscript)},setSubscript:function(gt,vt){return this._setScript(gt,vt,this.subscript)},_setScript:function(gt,vt,yt){var bt=this.get2DCursorLocation(gt,!0),Ct=this.getValueOfPropertyAt(bt.lineIndex,bt.charIndex,"fontSize"),xt=this.getValueOfPropertyAt(bt.lineIndex,bt.charIndex,"deltaY"),It={fontSize:Ct*yt.size,deltaY:xt+Ct*yt.baseline};return this.setSelectionStyles(It,gt,vt),this},_hasStyleChanged:function(gt,vt){return gt.fill!==vt.fill||gt.stroke!==vt.stroke||gt.strokeWidth!==vt.strokeWidth||gt.fontSize!==vt.fontSize||gt.fontFamily!==vt.fontFamily||gt.fontWeight!==vt.fontWeight||gt.fontStyle!==vt.fontStyle||gt.deltaY!==vt.deltaY},_hasStyleChangedForSvg:function(gt,vt){return this._hasStyleChanged(gt,vt)||gt.overline!==vt.overline||gt.underline!==vt.underline||gt.linethrough!==vt.linethrough},_getLineLeftOffset:function(gt){var vt=this.getLineWidth(gt),yt=this.width-vt,bt=this.textAlign,Ct=this.direction,It,xt=0,It=this.isEndOfWrapping(gt);return bt==="justify"||bt==="justify-center"&&!It||bt==="justify-right"&&!It||bt==="justify-left"&&!It?0:(bt==="center"&&(xt=yt/2),bt==="right"&&(xt=yt),bt==="justify-center"&&(xt=yt/2),bt==="justify-right"&&(xt=yt),Ct==="rtl"&&(xt-=yt),xt)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var gt=this._forceClearCache;return gt||(gt=this.hasStateChanged("_dimensionAffectingProps")),gt&&(this.dirty=!0,this._forceClearCache=!1),gt},getLineWidth:function(gt){if(this.__lineWidths[gt])return this.__lineWidths[gt];var vt,yt=this._textLines[gt],bt;return yt===""?vt=0:(bt=this.measureLine(gt),vt=bt.width),this.__lineWidths[gt]=vt,vt},_getWidthOfCharSpacing:function(){return this.charSpacing!==0?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(gt,vt,yt){var bt=this._getStyleDeclaration(gt,vt);return bt&&typeof bt[yt]!="undefined"?bt[yt]:this[yt]},_renderTextDecoration:function(gt,vt){if(!(!this[vt]&&!this.styleHas(vt))){for(var yt,bt,Ct,xt,It,St,Ot,Mt,jt=this._getLeftOffset(),Ft=this._getTopOffset(),Ut,Qt,Ht,Zt,Wt,$t,Jt,Nt,Lt=this.path,Kt=this._getWidthOfCharSpacing(),Pt=this.offsets[vt],ln=0,Gt=this._textLines.length;ln<Gt;ln++){if(yt=this.getHeightOfLine(ln),!this[vt]&&!this.styleHas(vt,ln)){Ft+=yt;continue}Ot=this._textLines[ln],$t=yt/this.lineHeight,xt=this._getLineLeftOffset(ln),Qt=0,Ht=0,Mt=this.getValueOfPropertyAt(ln,0,vt),Nt=this.getValueOfPropertyAt(ln,0,"fill"),Ut=Ft+$t*(1-this._fontSizeFraction),bt=this.getHeightOfChar(ln,0),It=this.getValueOfPropertyAt(ln,0,"deltaY");for(var on=0,tn=Ot.length;on<tn;on++)if(Zt=this.__charBounds[ln][on],Wt=this.getValueOfPropertyAt(ln,on,vt),Jt=this.getValueOfPropertyAt(ln,on,"fill"),Ct=this.getHeightOfChar(ln,on),St=this.getValueOfPropertyAt(ln,on,"deltaY"),Lt&&Wt&&Jt)gt.save(),gt.fillStyle=Nt,gt.translate(Zt.renderLeft,Zt.renderTop),gt.rotate(Zt.angle),gt.fillRect(-Zt.kernedWidth/2,Pt*Ct+St,Zt.kernedWidth,this.fontSize/15),gt.restore();else if((Wt!==Mt||Jt!==Nt||Ct!==bt||St!==It)&&Ht>0){var _i=jt+xt+Qt;this.direction==="rtl"&&(_i=this.width-_i-Ht),Mt&&Nt&&(gt.fillStyle=Nt,gt.fillRect(_i,Ut+Pt*bt+It,Ht,this.fontSize/15)),Qt=Zt.left,Ht=Zt.width,Mt=Wt,Nt=Jt,bt=Ct,It=St}else Ht+=Zt.kernedWidth;var _i=jt+xt+Qt;this.direction==="rtl"&&(_i=this.width-_i-Ht),gt.fillStyle=Jt,Wt&&Jt&&gt.fillRect(_i,Ut+Pt*bt+It,Ht-Kt,this.fontSize/15),Ft+=yt}this._removeShadow(gt)}},_getFontDeclaration:function(gt,vt){var yt=gt||this,bt=this.fontFamily,Ct=ut.Text.genericFonts.indexOf(bt.toLowerCase())>-1,xt=bt===void 0||bt.indexOf("'")>-1||bt.indexOf(",")>-1||bt.indexOf('"')>-1||Ct?yt.fontFamily:'"'+yt.fontFamily+'"';return[ut.isLikelyNode?yt.fontWeight:yt.fontStyle,ut.isLikelyNode?yt.fontStyle:yt.fontWeight,vt?this.CACHE_FONT_SIZE+"px":yt.fontSize+"px",xt].join(" ")},render:function(gt){!this.visible||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",gt))},_splitTextIntoLines:function(gt){for(var vt=gt.split(this._reNewline),yt=new Array(vt.length),bt=[`
`],Ct=[],xt=0;xt<vt.length;xt++)yt[xt]=ut.util.string.graphemeSplit(vt[xt]),Ct=Ct.concat(yt[xt],bt);return Ct.pop(),{_unwrappedLines:yt,lines:vt,graphemeText:Ct,graphemeLines:yt}},toObject:function(gt){var vt=At.concat(gt),yt=this.callSuper("toObject",vt);return yt.styles=pt(this.styles,!0),yt.path&&(yt.path=this.path.toObject()),yt},set:function(gt,vt){this.callSuper("set",gt,vt);var yt=!1,bt=!1;if(typeof gt=="object")for(var Ct in gt)Ct==="path"&&this.setPathInfo(),yt=yt||this._dimensionAffectingProps.indexOf(Ct)!==-1,bt=bt||Ct==="path";else yt=this._dimensionAffectingProps.indexOf(gt)!==-1,bt=gt==="path";return bt&&this.setPathInfo(),yt&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),ut.Text.ATTRIBUTE_NAMES=ut.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")),ut.Text.DEFAULT_SVG_FONT_SIZE=16,ut.Text.fromElement=function(gt,vt,yt){if(!gt)return vt(null);var bt=ut.parseAttributes(gt,ut.Text.ATTRIBUTE_NAMES),Ct=bt.textAnchor||"left";if(yt=ut.util.object.extend(yt?pt(yt):{},bt),yt.top=yt.top||0,yt.left=yt.left||0,bt.textDecoration){var xt=bt.textDecoration;xt.indexOf("underline")!==-1&&(yt.underline=!0),xt.indexOf("overline")!==-1&&(yt.overline=!0),xt.indexOf("line-through")!==-1&&(yt.linethrough=!0),delete yt.textDecoration}"dx"in bt&&(yt.left+=bt.dx),"dy"in bt&&(yt.top+=bt.dy),"fontSize"in yt||(yt.fontSize=ut.Text.DEFAULT_SVG_FONT_SIZE);var It="";"textContent"in gt?It=gt.textContent:"firstChild"in gt&&gt.firstChild!==null&&"data"in gt.firstChild&&gt.firstChild.data!==null&&(It=gt.firstChild.data),It=It.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var St=yt.strokeWidth;yt.strokeWidth=0;var Ot=new ut.Text(It,yt),Mt=Ot.getScaledHeight()/Ot.height,jt=(Ot.height+Ot.strokeWidth)*Ot.lineHeight-Ot.height,Ft=jt*Mt,Ut=Ot.getScaledHeight()+Ft,Qt=0;Ct==="center"&&(Qt=Ot.getScaledWidth()/2),Ct==="right"&&(Qt=Ot.getScaledWidth()),Ot.set({left:Ot.left-Qt,top:Ot.top-(Ut-Ot.fontSize*(.07+Ot._fontSizeFraction))/Ot.lineHeight,strokeWidth:typeof St!="undefined"?St:1}),vt(Ot)},ut.Text.fromObject=function(gt,vt){var yt=pt(gt),bt=gt.path;return delete yt.path,ut.Object._fromObject("Text",yt,function(Ct){bt?ut.Object._fromObject("Path",bt,function(xt){Ct.set("path",xt),vt(Ct)},"path"):vt(Ct)},"text")},ut.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],ut.util.createAccessors&&ut.util.createAccessors(ut.Text)}(ot),function(){at.util.object.extend(at.Text.prototype,{isEmptyStyles:function(ft){if(!this.styles||typeof ft!="undefined"&&!this.styles[ft])return!0;var ut=typeof ft=="undefined"?this.styles:{line:this.styles[ft]};for(var pt in ut)for(var At in ut[pt])for(var gt in ut[pt][At])return!1;return!0},styleHas:function(ft,ut){if(!this.styles||!ft||ft===""||typeof ut!="undefined"&&!this.styles[ut])return!1;var pt=typeof ut=="undefined"?this.styles:{0:this.styles[ut]};for(var At in pt)for(var gt in pt[At])if(typeof pt[At][gt][ft]!="undefined")return!0;return!1},cleanStyle:function(ft){if(!this.styles||!ft||ft==="")return!1;var ut=this.styles,pt=0,At,gt,vt=!0,yt=0,bt;for(var Ct in ut){At=0;for(var xt in ut[Ct]){var bt=ut[Ct][xt],It=bt.hasOwnProperty(ft);pt++,It?(gt?bt[ft]!==gt&&(vt=!1):gt=bt[ft],bt[ft]===this[ft]&&delete bt[ft]):vt=!1,Object.keys(bt).length!==0?At++:delete ut[Ct][xt]}At===0&&delete ut[Ct]}for(var St=0;St<this._textLines.length;St++)yt+=this._textLines[St].length;vt&&pt===yt&&(this[ft]=gt,this.removeStyle(ft))},removeStyle:function(ft){if(!(!this.styles||!ft||ft==="")){var ut=this.styles,pt,At,gt;for(At in ut){pt=ut[At];for(gt in pt)delete pt[gt][ft],Object.keys(pt[gt]).length===0&&delete pt[gt];Object.keys(pt).length===0&&delete ut[At]}}},_extendStyles:function(ft,ut){var pt=this.get2DCursorLocation(ft);this._getLineStyle(pt.lineIndex)||this._setLineStyle(pt.lineIndex),this._getStyleDeclaration(pt.lineIndex,pt.charIndex)||this._setStyleDeclaration(pt.lineIndex,pt.charIndex,{}),at.util.object.extend(this._getStyleDeclaration(pt.lineIndex,pt.charIndex),ut)},get2DCursorLocation:function(ft,ut){typeof ft=="undefined"&&(ft=this.selectionStart);for(var pt=ut?this._unwrappedTextLines:this._textLines,At=pt.length,gt=0;gt<At;gt++){if(ft<=pt[gt].length)return{lineIndex:gt,charIndex:ft};ft-=pt[gt].length+this.missingNewlineOffset(gt)}return{lineIndex:gt-1,charIndex:pt[gt-1].length<ft?pt[gt-1].length:ft}},getSelectionStyles:function(ft,ut,pt){typeof ft=="undefined"&&(ft=this.selectionStart||0),typeof ut=="undefined"&&(ut=this.selectionEnd||ft);for(var At=[],gt=ft;gt<ut;gt++)At.push(this.getStyleAtPosition(gt,pt));return At},getStyleAtPosition:function(ft,ut){var pt=this.get2DCursorLocation(ft),At=ut?this.getCompleteStyleDeclaration(pt.lineIndex,pt.charIndex):this._getStyleDeclaration(pt.lineIndex,pt.charIndex);return At||{}},setSelectionStyles:function(ft,ut,pt){typeof ut=="undefined"&&(ut=this.selectionStart||0),typeof pt=="undefined"&&(pt=this.selectionEnd||ut);for(var At=ut;At<pt;At++)this._extendStyles(At,ft);return this._forceClearCache=!0,this},_getStyleDeclaration:function(ft,ut){var pt=this.styles&&this.styles[ft];return pt?pt[ut]:null},getCompleteStyleDeclaration:function(ft,ut){for(var pt=this._getStyleDeclaration(ft,ut)||{},At={},gt,vt=0;vt<this._styleProperties.length;vt++)gt=this._styleProperties[vt],At[gt]=typeof pt[gt]=="undefined"?this[gt]:pt[gt];return At},_setStyleDeclaration:function(ft,ut,pt){this.styles[ft][ut]=pt},_deleteStyleDeclaration:function(ft,ut){delete this.styles[ft][ut]},_getLineStyle:function(ft){return!!this.styles[ft]},_setLineStyle:function(ft){this.styles[ft]={}},_deleteLineStyle:function(ft){delete this.styles[ft]}})}(),function(){function ft(ut){ut.textDecoration&&(ut.textDecoration.indexOf("underline")>-1&&(ut.underline=!0),ut.textDecoration.indexOf("line-through")>-1&&(ut.linethrough=!0),ut.textDecoration.indexOf("overline")>-1&&(ut.overline=!0),delete ut.textDecoration)}at.IText=at.util.createClass(at.Text,at.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(ut,pt){this.callSuper("initialize",ut,pt),this.initBehavior()},setSelectionStart:function(ut){ut=Math.max(ut,0),this._updateAndFire("selectionStart",ut)},setSelectionEnd:function(ut){ut=Math.min(ut,this.text.length),this._updateAndFire("selectionEnd",ut)},_updateAndFire:function(ut,pt){this[ut]!==pt&&(this._fireSelectionChanged(),this[ut]=pt),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(ut){this.clearContextTop(),this.callSuper("render",ut),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(ut){this.callSuper("_render",ut)},clearContextTop:function(ut){if(!(!this.isEditing||!this.canvas||!this.canvas.contextTop)){var pt=this.canvas.contextTop,At=this.canvas.viewportTransform;pt.save(),pt.transform(At[0],At[1],At[2],At[3],At[4],At[5]),this.transform(pt),this._clearTextArea(pt),ut||pt.restore()}},renderCursorOrSelection:function(){if(!(!this.isEditing||!this.canvas||!this.canvas.contextTop)){var ut=this._getCursorBoundaries(),pt=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(ut,pt):this.renderSelection(ut,pt),pt.restore()}},_clearTextArea:function(ut){var pt=this.width+4,At=this.height+4;ut.clearRect(-pt/2,-At/2,pt,At)},_getCursorBoundaries:function(ut){typeof ut=="undefined"&&(ut=this.selectionStart);var pt=this._getLeftOffset(),At=this._getTopOffset(),gt=this._getCursorBoundariesOffsets(ut);return{left:pt,top:At,leftOffset:gt.left,topOffset:gt.top}},_getCursorBoundariesOffsets:function(ut){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var pt,At,gt,vt=0,yt=0,bt,Ct=this.get2DCursorLocation(ut);gt=Ct.charIndex,At=Ct.lineIndex;for(var xt=0;xt<At;xt++)vt+=this.getHeightOfLine(xt);pt=this._getLineLeftOffset(At);var It=this.__charBounds[At][gt];return It&&(yt=It.left),this.charSpacing!==0&&gt===this._textLines[At].length&&(yt-=this._getWidthOfCharSpacing()),bt={top:vt,left:pt+(yt>0?yt:0)},this.direction==="rtl"&&(bt.left*=-1),this.cursorOffsetCache=bt,this.cursorOffsetCache},renderCursor:function(ut,pt){var At=this.get2DCursorLocation(),gt=At.lineIndex,vt=At.charIndex>0?At.charIndex-1:0,yt=this.getValueOfPropertyAt(gt,vt,"fontSize"),bt=this.scaleX*this.canvas.getZoom(),Ct=this.cursorWidth/bt,xt=ut.topOffset,It=this.getValueOfPropertyAt(gt,vt,"deltaY");xt+=(1-this._fontSizeFraction)*this.getHeightOfLine(gt)/this.lineHeight-yt*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(ut,pt),pt.fillStyle=this.cursorColor||this.getValueOfPropertyAt(gt,vt,"fill"),pt.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,pt.fillRect(ut.left+ut.leftOffset-Ct/2,xt+ut.top+It,Ct,yt)},renderSelection:function(ut,pt){for(var At=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,gt=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,vt=this.textAlign.indexOf("justify")!==-1,yt=this.get2DCursorLocation(At),bt=this.get2DCursorLocation(gt),Ct=yt.lineIndex,xt=bt.lineIndex,It=yt.charIndex<0?0:yt.charIndex,St=bt.charIndex<0?0:bt.charIndex,Ot=Ct;Ot<=xt;Ot++){var Mt=this._getLineLeftOffset(Ot)||0,jt=this.getHeightOfLine(Ot),Ft=0,Ut=0,Qt=0;if(Ot===Ct&&(Ut=this.__charBounds[Ct][It].left),Ot>=Ct&&Ot<xt)Qt=vt&&!this.isEndOfWrapping(Ot)?this.width:this.getLineWidth(Ot)||5;else if(Ot===xt)if(St===0)Qt=this.__charBounds[xt][St].left;else{var Ht=this._getWidthOfCharSpacing();Qt=this.__charBounds[xt][St-1].left+this.__charBounds[xt][St-1].width-Ht}Ft=jt,(this.lineHeight<1||Ot===xt&&this.lineHeight>1)&&(jt/=this.lineHeight);var Zt=ut.left+Mt+Ut,Wt=Qt-Ut,$t=jt,Jt=0;this.inCompositionMode?(pt.fillStyle=this.compositionColor||"black",$t=1,Jt=jt):pt.fillStyle=this.selectionColor,this.direction==="rtl"&&(Zt=this.width-Zt-Wt),pt.fillRect(Zt,ut.top+ut.topOffset+Jt,Wt,$t),ut.topOffset+=Ft}},getCurrentCharFontSize:function(){var ut=this._getCurrentCharIndex();return this.getValueOfPropertyAt(ut.l,ut.c,"fontSize")},getCurrentCharColor:function(){var ut=this._getCurrentCharIndex();return this.getValueOfPropertyAt(ut.l,ut.c,"fill")},_getCurrentCharIndex:function(){var ut=this.get2DCursorLocation(this.selectionStart,!0),pt=ut.charIndex>0?ut.charIndex-1:0;return{l:ut.lineIndex,c:pt}}}),at.IText.fromObject=function(ut,pt){if(ft(ut),ut.styles)for(var At in ut.styles)for(var gt in ut.styles[At])ft(ut.styles[At][gt]);at.Object._fromObject("IText",ut,pt,"text")}}(),function(){var ft=at.util.object.clone;at.util.object.extend(at.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var ut=this;this.on("added",function(){var pt=ut.canvas;pt&&(pt._hasITextHandlers||(pt._hasITextHandlers=!0,ut._initCanvasHandlers(pt)),pt._iTextInstances=pt._iTextInstances||[],pt._iTextInstances.push(ut))})},initRemovedHandler:function(){var ut=this;this.on("removed",function(){var pt=ut.canvas;pt&&(pt._iTextInstances=pt._iTextInstances||[],at.util.removeFromArray(pt._iTextInstances,ut),pt._iTextInstances.length===0&&(pt._hasITextHandlers=!1,ut._removeCanvasHandlers(pt)))})},_initCanvasHandlers:function(ut){ut._mouseUpITextHandler=function(){ut._iTextInstances&&ut._iTextInstances.forEach(function(pt){pt.__isMousedown=!1})},ut.on("mouse:up",ut._mouseUpITextHandler)},_removeCanvasHandlers:function(ut){ut.off("mouse:up",ut._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(ut,pt,At,gt){var vt;return vt={isAborted:!1,abort:function(){this.isAborted=!0}},ut.animate("_currentCursorOpacity",pt,{duration:At,onComplete:function(){vt.isAborted||ut[gt]()},onChange:function(){ut.canvas&&ut.selectionStart===ut.selectionEnd&&ut.renderCursorOrSelection()},abort:function(){return vt.isAborted}}),vt},_onTickComplete:function(){var ut=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){ut._currentTickCompleteState=ut._animateCursor(ut,0,this.cursorDuration/2,"_tick")},100)},initDelayedCursor:function(ut){var pt=this,At=ut?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout(function(){pt._tick()},At)},abortCursorAnimation:function(){var ut=this._currentTickState||this._currentTickCompleteState,pt=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,ut&&pt&&pt.clearContext(pt.contextTop||pt.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(ut){var pt=0,At=ut-1;if(this._reSpace.test(this._text[At]))for(;this._reSpace.test(this._text[At]);)pt++,At--;for(;/\S/.test(this._text[At])&&At>-1;)pt++,At--;return ut-pt},findWordBoundaryRight:function(ut){var pt=0,At=ut;if(this._reSpace.test(this._text[At]))for(;this._reSpace.test(this._text[At]);)pt++,At++;for(;/\S/.test(this._text[At])&&At<this._text.length;)pt++,At++;return ut+pt},findLineBoundaryLeft:function(ut){for(var pt=0,At=ut-1;!/\n/.test(this._text[At])&&At>-1;)pt++,At--;return ut-pt},findLineBoundaryRight:function(ut){for(var pt=0,At=ut;!/\n/.test(this._text[At])&&At<this._text.length;)pt++,At++;return ut+pt},searchWordBoundary:function(ut,pt){for(var At=this._text,gt=this._reSpace.test(At[ut])?ut-1:ut,vt=At[gt],yt=at.reNonWord;!yt.test(vt)&&gt>0&&gt<At.length;)gt+=pt,vt=At[gt];return yt.test(vt)&&(gt+=pt===1?0:1),gt},selectWord:function(ut){ut=ut||this.selectionStart;var pt=this.searchWordBoundary(ut,-1),At=this.searchWordBoundary(ut,1);this.selectionStart=pt,this.selectionEnd=At,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(ut){ut=ut||this.selectionStart;var pt=this.findLineBoundaryLeft(ut),At=this.findLineBoundaryRight(ut);return this.selectionStart=pt,this.selectionEnd=At,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(ut){if(!(this.isEditing||!this.editable))return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(ut),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this._fireSelectionChanged(),this.canvas?(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll(),this):this},exitEditingOnOthers:function(ut){ut._iTextInstances&&ut._iTextInstances.forEach(function(pt){pt.selected=!1,pt.isEditing&&pt.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(ut){if(!(!this.__isMousedown||!this.isEditing)){var pt=this.getSelectionStartFromPointer(ut.e),At=this.selectionStart,gt=this.selectionEnd;(pt!==this.__selectionStartOnMouseDown||At===gt)&&(At===pt||gt===pt)||(pt>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=pt):(this.selectionStart=pt,this.selectionEnd=this.__selectionStartOnMouseDown),(this.selectionStart!==At||this.selectionEnd!==gt)&&(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(ut,pt,At){var gt=At.slice(0,ut),vt=at.util.string.graphemeSplit(gt).length;if(ut===pt)return{selectionStart:vt,selectionEnd:vt};var yt=At.slice(ut,pt),bt=at.util.string.graphemeSplit(yt).length;return{selectionStart:vt,selectionEnd:vt+bt}},fromGraphemeToStringSelection:function(ut,pt,At){var gt=At.slice(0,ut),vt=gt.join("").length;if(ut===pt)return{selectionStart:vt,selectionEnd:vt};var yt=At.slice(ut,pt),bt=yt.join("").length;return{selectionStart:vt,selectionEnd:vt+bt}},_updateTextarea:function(){if(this.cursorOffsetCache={},!!this.hiddenTextarea){if(!this.inCompositionMode){var ut=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=ut.selectionStart,this.hiddenTextarea.selectionEnd=ut.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(!!this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var ut=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=ut.selectionEnd,this.inCompositionMode||(this.selectionStart=ut.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var ut=this._calcTextareaPosition();this.hiddenTextarea.style.left=ut.left,this.hiddenTextarea.style.top=ut.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var ut=this.inCompositionMode?this.compositionStart:this.selectionStart,pt=this._getCursorBoundaries(ut),At=this.get2DCursorLocation(ut),gt=At.lineIndex,vt=At.charIndex,yt=this.getValueOfPropertyAt(gt,vt,"fontSize")*this.lineHeight,bt=pt.leftOffset,Ct=this.calcTransformMatrix(),xt={x:pt.left+bt,y:pt.top+pt.topOffset+yt},It=this.canvas.getRetinaScaling(),St=this.canvas.upperCanvasEl,Ot=St.width/It,Mt=St.height/It,jt=Ot-yt,Ft=Mt-yt,Ut=St.clientWidth/Ot,Qt=St.clientHeight/Mt;return xt=at.util.transformPoint(xt,Ct),xt=at.util.transformPoint(xt,this.canvas.viewportTransform),xt.x*=Ut,xt.y*=Qt,xt.x<0&&(xt.x=0),xt.x>jt&&(xt.x=jt),xt.y<0&&(xt.y=0),xt.y>Ft&&(xt.y=Ft),xt.x+=this.canvas._offset.left,xt.y+=this.canvas._offset.top,{left:xt.x+"px",top:xt.y+"px",fontSize:yt+"px",charHeight:yt}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){!this._savedProps||(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var ut=this._textBeforeEdit!==this.text,pt=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,pt&&(pt.blur&&pt.blur(),pt.parentNode&&pt.parentNode.removeChild(pt)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),ut&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),ut&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var ut in this.styles)this._textLines[ut]||delete this.styles[ut]},removeStyleFromTo:function(ut,pt){var At=this.get2DCursorLocation(ut,!0),gt=this.get2DCursorLocation(pt,!0),vt=At.lineIndex,yt=At.charIndex,bt=gt.lineIndex,Ct=gt.charIndex,xt,It;if(vt!==bt){if(this.styles[vt])for(xt=yt;xt<this._unwrappedTextLines[vt].length;xt++)delete this.styles[vt][xt];if(this.styles[bt])for(xt=Ct;xt<this._unwrappedTextLines[bt].length;xt++)It=this.styles[bt][xt],It&&(this.styles[vt]||(this.styles[vt]={}),this.styles[vt][yt+xt-Ct]=It);for(xt=vt+1;xt<=bt;xt++)delete this.styles[xt];this.shiftLineStyles(bt,vt-bt)}else if(this.styles[vt]){It=this.styles[vt];var St=Ct-yt,Ot,Mt;for(xt=yt;xt<Ct;xt++)delete It[xt];for(Mt in this.styles[vt])Ot=parseInt(Mt,10),Ot>=Ct&&(It[Ot-St]=It[Mt],delete It[Mt])}},shiftLineStyles:function(ut,pt){var At=ft(this.styles);for(var gt in this.styles){var vt=parseInt(gt,10);vt>ut&&(this.styles[vt+pt]=At[vt],At[vt-pt]||delete this.styles[vt])}},restartCursorIfNeeded:function(){(!this._currentTickState||this._currentTickState.isAborted||!this._currentTickCompleteState||this._currentTickCompleteState.isAborted)&&this.initDelayedCursor()},insertNewlineStyleObject:function(ut,pt,At,gt){var vt,yt={},bt=!1,Ct=this._unwrappedTextLines[ut].length===pt;At||(At=1),this.shiftLineStyles(ut,At),this.styles[ut]&&(vt=this.styles[ut][pt===0?pt:pt-1]);for(var xt in this.styles[ut]){var It=parseInt(xt,10);It>=pt&&(bt=!0,yt[It-pt]=this.styles[ut][xt],Ct&&pt===0||delete this.styles[ut][xt])}var St=!1;for(bt&&!Ct&&(this.styles[ut+At]=yt,St=!0),St&&At--;At>0;)gt&&gt[At-1]?this.styles[ut+At]={0:ft(gt[At-1])}:vt?this.styles[ut+At]={0:ft(vt)}:delete this.styles[ut+At],At--;this._forceClearCache=!0},insertCharStyleObject:function(ut,pt,At,gt){this.styles||(this.styles={});var vt=this.styles[ut],yt=vt?ft(vt):{};At||(At=1);for(var bt in yt){var Ct=parseInt(bt,10);Ct>=pt&&(vt[Ct+At]=yt[Ct],yt[Ct-At]||delete vt[Ct])}if(this._forceClearCache=!0,gt){for(;At--;)!Object.keys(gt[At]).length||(this.styles[ut]||(this.styles[ut]={}),this.styles[ut][pt+At]=ft(gt[At]));return}if(!!vt)for(var xt=vt[pt?pt-1:1];xt&&At--;)this.styles[ut][pt+At]=ft(xt)},insertNewStyleBlock:function(ut,pt,At){for(var gt=this.get2DCursorLocation(pt,!0),vt=[0],yt=0,bt=0;bt<ut.length;bt++)ut[bt]===`
`?(yt++,vt[yt]=0):vt[yt]++;vt[0]>0&&(this.insertCharStyleObject(gt.lineIndex,gt.charIndex,vt[0],At),At=At&&At.slice(vt[0]+1)),yt&&this.insertNewlineStyleObject(gt.lineIndex,gt.charIndex+vt[0],yt);for(var bt=1;bt<yt;bt++)vt[bt]>0?this.insertCharStyleObject(gt.lineIndex+bt,0,vt[bt],At):At&&(this.styles[gt.lineIndex+bt][0]=At[0]),At=At&&At.slice(vt[bt]+1);vt[bt]>0&&this.insertCharStyleObject(gt.lineIndex+bt,0,vt[bt],At)},setSelectionStartEndWithShift:function(ut,pt,At){At<=ut?(pt===ut?this._selectionDirection="left":this._selectionDirection==="right"&&(this._selectionDirection="left",this.selectionEnd=ut),this.selectionStart=At):At>ut&&At<pt?this._selectionDirection==="right"?this.selectionEnd=At:this.selectionStart=At:(pt===ut?this._selectionDirection="right":this._selectionDirection==="left"&&(this._selectionDirection="right",this.selectionStart=pt),this.selectionEnd=At)},setSelectionInBoundaries:function(){var ut=this.text.length;this.selectionStart>ut?this.selectionStart=ut:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>ut?this.selectionEnd=ut:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),at.util.object.extend(at.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(ft){if(!!this.canvas){this.__newClickTime=+new Date;var ut=ft.pointer;this.isTripleClick(ut)&&(this.fire("tripleclick",ft),this._stopEvent(ft.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=ut,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(ft){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===ft.x&&this.__lastPointer.y===ft.y},_stopEvent:function(ft){ft.preventDefault&&ft.preventDefault(),ft.stopPropagation&&ft.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(ft){!this.isEditing||this.selectWord(this.getSelectionStartFromPointer(ft.e))},tripleClickHandler:function(ft){!this.isEditing||this.selectLine(this.getSelectionStartFromPointer(ft.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(ft){!this.canvas||!this.editable||ft.e.button&&ft.e.button!==1||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(ft.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(ft){!this.canvas||!this.editable||ft.e.button&&ft.e.button!==1||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(ft){if(this.__isMousedown=!1,!(!this.editable||this.group||ft.transform&&ft.transform.actionPerformed||ft.e.button&&ft.e.button!==1)){if(this.canvas){var ut=this.canvas._activeObject;if(ut&&ut!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(ft.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(ft){var ut=this.getSelectionStartFromPointer(ft),pt=this.selectionStart,At=this.selectionEnd;ft.shiftKey?this.setSelectionStartEndWithShift(pt,At,ut):(this.selectionStart=ut,this.selectionEnd=ut),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(ft){for(var ut=this.getLocalPointer(ft),pt=0,At=0,gt=0,vt=0,yt=0,bt,Ct,xt=0,It=this._textLines.length;xt<It&&gt<=ut.y;xt++)gt+=this.getHeightOfLine(xt)*this.scaleY,yt=xt,xt>0&&(vt+=this._textLines[xt-1].length+this.missingNewlineOffset(xt-1));bt=this._getLineLeftOffset(yt),At=bt*this.scaleX,Ct=this._textLines[yt],this.direction==="rtl"&&(ut.x=this.width*this.scaleX-ut.x+At);for(var St=0,Ot=Ct.length;St<Ot&&(pt=At,At+=this.__charBounds[yt][St].kernedWidth*this.scaleX,At<=ut.x);St++)vt++;return this._getNewSelectionStartFromOffset(ut,pt,At,vt,Ot)},_getNewSelectionStartFromOffset:function(ft,ut,pt,At,gt){var vt=ft.x-ut,yt=pt-ft.x,bt=yt>vt||yt<0?0:1,Ct=At+bt;return this.flipX&&(Ct=gt-Ct),Ct>this._text.length&&(Ct=this._text.length),Ct}}),at.util.object.extend(at.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=at.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var ft=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+ft.top+"; left: "+ft.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uFF70top: "+ft.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):at.document.body.appendChild(this.hiddenTextarea),at.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),at.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),at.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),at.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),at.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),at.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),at.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),at.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),at.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(at.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(ft){if(!!this.isEditing){var ut=this.direction==="rtl"?this.keysMapRtl:this.keysMap;if(ft.keyCode in ut)this[ut[ft.keyCode]](ft);else if(ft.keyCode in this.ctrlKeysMapDown&&(ft.ctrlKey||ft.metaKey))this[this.ctrlKeysMapDown[ft.keyCode]](ft);else return;ft.stopImmediatePropagation(),ft.preventDefault(),ft.keyCode>=33&&ft.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(ft){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(ft.keyCode in this.ctrlKeysMapUp&&(ft.ctrlKey||ft.metaKey))this[this.ctrlKeysMapUp[ft.keyCode]](ft);else return;ft.stopImmediatePropagation(),ft.preventDefault(),this.canvas&&this.canvas.requestRenderAll()},onInput:function(ft){var ut=this.fromPaste;if(this.fromPaste=!1,ft&&ft.stopPropagation(),!!this.isEditing){var pt=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,At=this._text.length,gt=pt.length,vt,yt,bt=gt-At,Ct=this.selectionStart,xt=this.selectionEnd,It=Ct!==xt,St,Ot,Mt;if(this.hiddenTextarea.value===""){this.styles={},this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll());return}var jt=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),Ft=Ct>jt.selectionStart;It?(vt=this._text.slice(Ct,xt),bt+=xt-Ct):gt<At&&(Ft?vt=this._text.slice(xt+bt,xt):vt=this._text.slice(Ct,Ct-bt)),yt=pt.slice(jt.selectionEnd-bt,jt.selectionEnd),vt&&vt.length&&(yt.length&&(St=this.getSelectionStyles(Ct,Ct+1,!1),St=yt.map(function(){return St[0]})),It?(Ot=Ct,Mt=xt):Ft?(Ot=xt-vt.length,Mt=xt):(Ot=xt,Mt=xt+vt.length),this.removeStyleFromTo(Ot,Mt)),yt.length&&(ut&&yt.join("")===at.copiedText&&!at.disableStyleCopyPaste&&(St=at.copiedTextStyle),this.insertNewStyleBlock(yt,Ct,St)),this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(ft){this.compositionStart=ft.target.selectionStart,this.compositionEnd=ft.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(at.copiedText=this.getSelectedText(),at.disableStyleCopyPaste?at.copiedTextStyle=null:at.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(ft){return ft&&ft.clipboardData||at.window.clipboardData},_getWidthBeforeCursor:function(ft,ut){var pt=this._getLineLeftOffset(ft),At;return ut>0&&(At=this.__charBounds[ft][ut-1],pt+=At.left+At.width),pt},getDownCursorOffset:function(ft,ut){var pt=this._getSelectionForOffset(ft,ut),At=this.get2DCursorLocation(pt),gt=At.lineIndex;if(gt===this._textLines.length-1||ft.metaKey||ft.keyCode===34)return this._text.length-pt;var vt=At.charIndex,yt=this._getWidthBeforeCursor(gt,vt),bt=this._getIndexOnLine(gt+1,yt),Ct=this._textLines[gt].slice(vt);return Ct.length+bt+1+this.missingNewlineOffset(gt)},_getSelectionForOffset:function(ft,ut){return ft.shiftKey&&this.selectionStart!==this.selectionEnd&&ut?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(ft,ut){var pt=this._getSelectionForOffset(ft,ut),At=this.get2DCursorLocation(pt),gt=At.lineIndex;if(gt===0||ft.metaKey||ft.keyCode===33)return-pt;var vt=At.charIndex,yt=this._getWidthBeforeCursor(gt,vt),bt=this._getIndexOnLine(gt-1,yt),Ct=this._textLines[gt].slice(0,vt),xt=this.missingNewlineOffset(gt-1);return-this._textLines[gt-1].length+bt-Ct.length+(1-xt)},_getIndexOnLine:function(ft,ut){for(var pt=this._textLines[ft],At=this._getLineLeftOffset(ft),gt=At,vt=0,yt,bt,Ct=0,xt=pt.length;Ct<xt;Ct++)if(yt=this.__charBounds[ft][Ct].width,gt+=yt,gt>ut){bt=!0;var It=gt-yt,St=gt,Ot=Math.abs(It-ut),Mt=Math.abs(St-ut);vt=Mt<Ot?Ct:Ct-1;break}return bt||(vt=pt.length-1),vt},moveCursorDown:function(ft){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",ft)},moveCursorUp:function(ft){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown("Up",ft)},_moveCursorUpOrDown:function(ft,ut){var pt="get"+ft+"CursorOffset",At=this[pt](ut,this._selectionDirection==="right");ut.shiftKey?this.moveCursorWithShift(At):this.moveCursorWithoutShift(At),At!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(ft){var ut=this._selectionDirection==="left"?this.selectionStart+ft:this.selectionEnd+ft;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,ut),ft!==0},moveCursorWithoutShift:function(ft){return ft<0?(this.selectionStart+=ft,this.selectionEnd=this.selectionStart):(this.selectionEnd+=ft,this.selectionStart=this.selectionEnd),ft!==0},moveCursorLeft:function(ft){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight("Left",ft)},_move:function(ft,ut,pt){var At;if(ft.altKey)At=this["findWordBoundary"+pt](this[ut]);else if(ft.metaKey||ft.keyCode===35||ft.keyCode===36)At=this["findLineBoundary"+pt](this[ut]);else return this[ut]+=pt==="Left"?-1:1,!0;if(typeof At!==void 0&&this[ut]!==At)return this[ut]=At,!0},_moveLeft:function(ft,ut){return this._move(ft,ut,"Left")},_moveRight:function(ft,ut){return this._move(ft,ut,"Right")},moveCursorLeftWithoutShift:function(ft){var ut=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(ut=this._moveLeft(ft,"selectionStart")),this.selectionEnd=this.selectionStart,ut},moveCursorLeftWithShift:function(ft){if(this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd)return this._moveLeft(ft,"selectionEnd");if(this.selectionStart!==0)return this._selectionDirection="left",this._moveLeft(ft,"selectionStart")},moveCursorRight:function(ft){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",ft)},_moveCursorLeftOrRight:function(ft,ut){var pt="moveCursor"+ft+"With";this._currentCursorOpacity=1,ut.shiftKey?pt+="Shift":pt+="outShift",this[pt](ut)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(ft){if(this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd)return this._moveRight(ft,"selectionStart");if(this.selectionEnd!==this._text.length)return this._selectionDirection="right",this._moveRight(ft,"selectionEnd")},moveCursorRightWithoutShift:function(ft){var ut=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(ut=this._moveRight(ft,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,ut},removeChars:function(ft,ut){typeof ut=="undefined"&&(ut=ft+1),this.removeStyleFromTo(ft,ut),this._text.splice(ft,ut-ft),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(ft,ut,pt,At){typeof At=="undefined"&&(At=pt),At>pt&&this.removeStyleFromTo(pt,At);var gt=at.util.string.graphemeSplit(ft);this.insertNewStyleBlock(gt,pt,ut),this._text=[].concat(this._text.slice(0,pt),gt,this._text.slice(At)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var ft=at.util.toFixed,ut=/  +/g;at.util.object.extend(at.Text.prototype,{_toSVG:function(){var pt=this._getSVGLeftTopOffsets(),At=this._getSVGTextAndBg(pt.textTop,pt.textLeft);return this._wrapSVGTextAndBg(At)},toSVG:function(pt){return this._createBaseSVGMarkup(this._toSVG(),{reviver:pt,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(pt){var At=!0,gt=this.getSvgTextDecoration(this);return[pt.textBgRects.join(""),'		<text xml:space="preserve" ',this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",gt?'text-decoration="'+gt+'" ':"",'style="',this.getSvgStyles(At),'"',this.addPaintOrder()," >",pt.textSpans.join(""),`</text>
`]},_getSVGTextAndBg:function(pt,At){var gt=[],vt=[],yt=pt,bt;this._setSVGBg(vt);for(var Ct=0,xt=this._textLines.length;Ct<xt;Ct++)bt=this._getLineLeftOffset(Ct),(this.textBackgroundColor||this.styleHas("textBackgroundColor",Ct))&&this._setSVGTextLineBg(vt,Ct,At+bt,yt),this._setSVGTextLineText(gt,Ct,At+bt,yt),yt+=this.getHeightOfLine(Ct);return{textSpans:gt,textBgRects:vt}},_createTextCharSpan:function(pt,At,gt,vt){var yt=pt!==pt.trim()||pt.match(ut),bt=this.getSvgSpanStyles(At,yt),Ct=bt?'style="'+bt+'"':"",xt=At.deltaY,It="",St=at.Object.NUM_FRACTION_DIGITS;return xt&&(It=' dy="'+ft(xt,St)+'" '),['<tspan x="',ft(gt,St),'" y="',ft(vt,St),'" ',It,Ct,">",at.util.string.escapeXml(pt),"</tspan>"].join("")},_setSVGTextLineText:function(pt,At,gt,vt){var yt=this.getHeightOfLine(At),bt=this.textAlign.indexOf("justify")!==-1,Ct,xt,It="",St,Ot,Mt=0,jt=this._textLines[At],Ft;vt+=yt*(1-this._fontSizeFraction)/this.lineHeight;for(var Ut=0,Qt=jt.length-1;Ut<=Qt;Ut++)Ft=Ut===Qt||this.charSpacing,It+=jt[Ut],St=this.__charBounds[At][Ut],Mt===0?(gt+=St.kernedWidth-St.width,Mt+=St.width):Mt+=St.kernedWidth,bt&&!Ft&&this._reSpaceAndTab.test(jt[Ut])&&(Ft=!0),Ft||(Ct=Ct||this.getCompleteStyleDeclaration(At,Ut),xt=this.getCompleteStyleDeclaration(At,Ut+1),Ft=this._hasStyleChangedForSvg(Ct,xt)),Ft&&(Ot=this._getStyleDeclaration(At,Ut)||{},pt.push(this._createTextCharSpan(It,Ot,gt,vt)),It="",Ct=xt,gt+=Mt,Mt=0)},_pushTextBgRect:function(pt,At,gt,vt,yt,bt){var Ct=at.Object.NUM_FRACTION_DIGITS;pt.push("		<rect ",this._getFillAttributes(At),' x="',ft(gt,Ct),'" y="',ft(vt,Ct),'" width="',ft(yt,Ct),'" height="',ft(bt,Ct),`"></rect>
`)},_setSVGTextLineBg:function(pt,At,gt,vt){for(var yt=this._textLines[At],bt=this.getHeightOfLine(At)/this.lineHeight,Ct=0,xt=0,It,St,Ot=this.getValueOfPropertyAt(At,0,"textBackgroundColor"),Mt=0,jt=yt.length;Mt<jt;Mt++)It=this.__charBounds[At][Mt],St=this.getValueOfPropertyAt(At,Mt,"textBackgroundColor"),St!==Ot?(Ot&&this._pushTextBgRect(pt,Ot,gt+xt,vt,Ct,bt),xt=It.left,Ct=It.width,Ot=St):Ct+=It.kernedWidth;St&&this._pushTextBgRect(pt,St,gt+xt,vt,Ct,bt)},_getFillAttributes:function(pt){var At=pt&&typeof pt=="string"?new at.Color(pt):"";return!At||!At.getSource()||At.getAlpha()===1?'fill="'+pt+'"':'opacity="'+At.getAlpha()+'" fill="'+At.setAlpha(1).toRgb()+'"'},_getSVGLineTopOffset:function(pt){for(var At=0,gt=0,vt=0;vt<pt;vt++)At+=this.getHeightOfLine(vt);return gt=this.getHeightOfLine(vt),{lineTop:At,offset:(this._fontSizeMult-this._fontSizeFraction)*gt/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(pt){var At=at.Object.prototype.getSvgStyles.call(this,pt);return At+" white-space: pre;"}})}(),function(ft){var ut=ft.fabric||(ft.fabric={});ut.Textbox=ut.util.createClass(ut.IText,ut.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:ut.Text.prototype._dimensionAffectingProps.concat("width"),_wordJoiners:/[ \t\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(pt){for(var At=0,gt=0,vt=0,yt={},bt=0;bt<pt.graphemeLines.length;bt++)pt.graphemeText[vt]===`
`&&bt>0?(gt=0,vt++,At++):!this.splitByGrapheme&&this._reSpaceAndTab.test(pt.graphemeText[vt])&&bt>0&&(gt++,vt++),yt[bt]={line:At,offset:gt},vt+=pt.graphemeLines[bt].length,gt+=pt.graphemeLines[bt].length;return yt},styleHas:function(pt,At){if(this._styleMap&&!this.isWrapping){var gt=this._styleMap[At];gt&&(At=gt.line)}return ut.Text.prototype.styleHas.call(this,pt,At)},isEmptyStyles:function(pt){if(!this.styles)return!0;var At=0,gt=pt+1,vt,yt,bt=!1,Ct=this._styleMap[pt],xt=this._styleMap[pt+1];Ct&&(pt=Ct.line,At=Ct.offset),xt&&(gt=xt.line,bt=gt===pt,vt=xt.offset),yt=typeof pt=="undefined"?this.styles:{line:this.styles[pt]};for(var It in yt)for(var St in yt[It])if(St>=At&&(!bt||St<vt))for(var Ot in yt[It][St])return!1;return!0},_getStyleDeclaration:function(pt,At){if(this._styleMap&&!this.isWrapping){var gt=this._styleMap[pt];if(!gt)return null;pt=gt.line,At=gt.offset+At}return this.callSuper("_getStyleDeclaration",pt,At)},_setStyleDeclaration:function(pt,At,gt){var vt=this._styleMap[pt];pt=vt.line,At=vt.offset+At,this.styles[pt][At]=gt},_deleteStyleDeclaration:function(pt,At){var gt=this._styleMap[pt];pt=gt.line,At=gt.offset+At,delete this.styles[pt][At]},_getLineStyle:function(pt){var At=this._styleMap[pt];return!!this.styles[At.line]},_setLineStyle:function(pt){var At=this._styleMap[pt];this.styles[At.line]={}},_wrapText:function(pt,At){var gt=[],vt;for(this.isWrapping=!0,vt=0;vt<pt.length;vt++)gt=gt.concat(this._wrapLine(pt[vt],vt,At));return this.isWrapping=!1,gt},_measureWord:function(pt,At,gt){var vt=0,yt,bt=!0;gt=gt||0;for(var Ct=0,xt=pt.length;Ct<xt;Ct++){var It=this._getGraphemeBox(pt[Ct],At,Ct+gt,yt,bt);vt+=It.kernedWidth,yt=pt[Ct]}return vt},_wrapLine:function(pt,At,gt,Zt){var yt=0,bt=this.splitByGrapheme,Ct=[],xt=[],It=bt?ut.util.string.graphemeSplit(pt):pt.split(this._wordJoiners),St="",Ot=0,Mt=bt?"":" ",jt=0,Ft=0,Ut=0,Qt=!0,Ht=this._getWidthOfCharSpacing(),Zt=Zt||0;It.length===0&&It.push([]),gt-=Zt;for(var Wt=0;Wt<It.length;Wt++)St=bt?It[Wt]:ut.util.string.graphemeSplit(It[Wt]),jt=this._measureWord(St,At,Ot),Ot+=St.length,yt+=Ft+jt-Ht,yt>gt&&!Qt?(Ct.push(xt),xt=[],yt=jt,Qt=!0):yt+=Ht,!Qt&&!bt&&xt.push(Mt),xt=xt.concat(St),Ft=bt?0:this._measureWord([Mt],At,Ot),Ot++,Qt=!1,jt>Ut&&(Ut=jt);return Wt&&Ct.push(xt),Ut+Zt>this.dynamicMinWidth&&(this.dynamicMinWidth=Ut-Ht+Zt),Ct},isEndOfWrapping:function(pt){return!this._styleMap[pt+1]||this._styleMap[pt+1].line!==this._styleMap[pt].line},missingNewlineOffset:function(pt){return this.splitByGrapheme?this.isEndOfWrapping(pt)?1:0:1},_splitTextIntoLines:function(pt){for(var At=ut.Text.prototype._splitTextIntoLines.call(this,pt),gt=this._wrapText(At.lines,this.width),vt=new Array(gt.length),yt=0;yt<gt.length;yt++)vt[yt]=gt[yt].join("");return At.lines=vt,At.graphemeLines=gt,At},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var pt={};for(var At in this._styleMap)this._textLines[At]&&(pt[this._styleMap[At].line]=1);for(var At in this.styles)pt[At]||delete this.styles[At]},toObject:function(pt){return this.callSuper("toObject",["minWidth","splitByGrapheme"].concat(pt))}}),ut.Textbox.fromObject=function(pt,At){return ut.Object._fromObject("Textbox",pt,At,"text")}}(ot),function(){var ft=at.controlsUtils,ut=ft.scaleSkewCursorStyleHandler,pt=ft.scaleCursorStyleHandler,At=ft.scalingEqually,gt=ft.scalingYOrSkewingX,vt=ft.scalingXOrSkewingY,yt=ft.scaleOrSkewActionName,bt=at.Object.prototype.controls;if(bt.ml=new at.Control({x:-.5,y:0,cursorStyleHandler:ut,actionHandler:vt,getActionName:yt}),bt.mr=new at.Control({x:.5,y:0,cursorStyleHandler:ut,actionHandler:vt,getActionName:yt}),bt.mb=new at.Control({x:0,y:.5,cursorStyleHandler:ut,actionHandler:gt,getActionName:yt}),bt.mt=new at.Control({x:0,y:-.5,cursorStyleHandler:ut,actionHandler:gt,getActionName:yt}),bt.tl=new at.Control({x:-.5,y:-.5,cursorStyleHandler:pt,actionHandler:At}),bt.tr=new at.Control({x:.5,y:-.5,cursorStyleHandler:pt,actionHandler:At}),bt.bl=new at.Control({x:-.5,y:.5,cursorStyleHandler:pt,actionHandler:At}),bt.br=new at.Control({x:.5,y:.5,cursorStyleHandler:pt,actionHandler:At}),bt.mtr=new at.Control({x:0,y:-.5,actionHandler:ft.rotationWithSnapping,cursorStyleHandler:ft.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),at.Textbox){var Ct=at.Textbox.prototype.controls={};Ct.mtr=bt.mtr,Ct.tr=bt.tr,Ct.br=bt.br,Ct.tl=bt.tl,Ct.bl=bt.bl,Ct.mt=bt.mt,Ct.mb=bt.mb,Ct.mr=new at.Control({x:.5,y:0,actionHandler:ft.changeWidth,cursorStyleHandler:ut,actionName:"resizing"}),Ct.ml=new at.Control({x:-.5,y:0,actionHandler:ft.changeWidth,cursorStyleHandler:ut,actionName:"resizing"})}}()},4426:function(nt,ot,st){nt.exports=st(4486)},9406:function(nt,ot,st){nt.exports=st(4877)},789:function(nt,ot,st){nt.exports=st(7178)},381:function(nt,ot,st){nt.exports=st(5603)},7636:function(nt,ot,st){nt.exports=st(1206)},1899:function(nt,ot,st){nt.exports=st(6174)},899:function(nt,ot,st){nt.exports=st(57)},8005:function(nt,ot,st){nt.exports=st(4741)},6562:function(nt,ot,st){nt.exports=st(8368)},9131:function(nt,ot,st){nt.exports=st(3739)},4383:function(nt,ot,st){nt.exports=st(172)},6065:function(nt,ot,st){nt.exports=st(4963)},1734:function(nt,ot,st){nt.exports=st(7820)},2461:function(nt,ot,st){nt.exports=st(5636)},5214:function(nt,ot,st){nt.exports=st(5059)},6397:function(nt,ot,st){nt.exports=st(3969)},8189:function(nt,ot,st){nt.exports=st(6618)},9146:function(nt,ot,st){nt.exports=st(5279)},4496:function(nt,ot,st){nt.exports=st(9562)},3972:function(nt,ot,st){nt.exports=st(652)},7172:function(nt,ot,st){nt.exports=st(2813)},1845:function(nt,ot,st){nt.exports=st(8664)},662:function(nt,ot,st){nt.exports=st(1457)},711:function(nt,ot,st){nt.exports=st(2937)},6623:function(nt,ot,st){nt.exports=st(9297)},7077:function(nt,ot,st){nt.exports=st(8026)},9856:function(nt,ot,st){nt.exports=st(2044)},4230:function(nt,ot,st){nt.exports=st(2214)},184:function(nt,ot,st){nt.exports=st(9256)},3742:function(nt,ot,st){nt.exports=st(5659)},1801:function(nt){var ot={rect:1,circle:2,triangle:1},st={rect:{w:"width",h:"height"},circle:{w:"rx",h:"ry"},triangle:{w:"width",h:"height"}};function at(ut){var pt=ut.originX,At=ut.originY,gt=pt.substring(0,1)+At.substring(0,1);ut.startPoint=ut.origins[gt]}function lt(ut,pt,At){var gt=ut.x,vt=ut.y,yt=pt.x,bt=pt.y,Ct=At*Math.PI/180,xt=(yt-gt)*Math.cos(Ct)-(bt-vt)*Math.sin(Ct)+gt,It=(yt-gt)*Math.sin(Ct)+(bt-vt)*Math.cos(Ct)+vt;return{originX:gt>xt?"right":"left",originY:vt>It?"bottom":"top"}}function ct(ut){return ut.originX==="center"&&ut.originY==="center"}function ht(ut,pt){var At=pt.getPointByOrigin("center","center"),gt=-pt.angle,vt=lt(At,ut,gt),yt=vt.originX,bt=vt.originY,Ct=pt.getPointByOrigin(yt,bt),xt=pt.left-(At.x-Ct.x),It=pt.top-(At.y-Ct.y);pt.set({originX:yt,originY:bt,left:xt,top:It}),pt.setCoords()}function mt(ut,pt){var At=pt.startPoint,gt=-pt.angle,vt=lt(At,ut,gt),yt=vt.originX,bt=vt.originY;pt.setPositionByOrigin(At,yt,bt),pt.setCoords()}function dt(ut){var pt=ut.type,At=ut.scaleX,gt=ut.scaleY,vt=st[pt],yt=ut[vt.w]*At,bt=ut[vt.h]*gt;if(ut.isRegular){var Ct=Math.max(At,gt);yt=ut[vt.w]*Ct,bt=ut[vt.h]*Ct}var xt={hasControls:!1,hasBorders:!1,scaleX:1,scaleY:1};xt[vt.w]=yt,xt[vt.h]=bt,ut.set(xt)}function ft(ut,pt){var At=pt.type,gt=pt.strokeWidth,vt=pt.startPoint,yt=ot[At],bt=st[At],Ct=pt.type==="triangle",xt={},It=Math.abs(vt.x-ut.x)/yt,St=Math.abs(vt.y-ut.y)/yt;It>gt&&(It-=gt/yt),St>gt&&(St-=gt/yt),pt.isRegular&&(It=St=Math.max(It,St),Ct&&(St=Math.sqrt(3)/2*It)),xt[bt.w]=It,xt[bt.h]=St,pt.set(xt)}nt.exports={setOrigins:function(pt){var At=pt.getPointByOrigin("left","top"),gt=pt.getPointByOrigin("right","top"),vt=pt.getPointByOrigin("right","bottom"),yt=pt.getPointByOrigin("left","bottom");pt.origins={lt:At,rt:gt,rb:vt,lb:yt}},resize:function(pt,At,gt){ct(pt)&&(ht(At,pt),at(pt)),gt?dt(pt):ft(At,pt),mt(At,pt)},adjustOriginToCenter:function(pt){var At=pt.getPointByOrigin("center","center"),gt=pt.originX,vt=pt.originY,yt=pt.getPointByOrigin(gt,vt),bt=pt.left+(At.x-yt.x),Ct=pt.top+(At.y-yt.y);pt.set({hasControls:!0,hasBorders:!0,originX:"center",originY:"center",left:bt,top:Ct}),pt.setCoords()}}},2221:function(nt,ot,st){st(5454),st(9173);var at=st(7545);nt.exports=at.Array.from},5078:function(nt,ot,st){st(8118);var at=st(7545);nt.exports=at.Array.isArray},6135:function(nt,ot,st){st(9106);var at=st(5607);nt.exports=at("Array").concat},9510:function(nt,ot,st){st(1710);var at=st(5607);nt.exports=at("Array").fill},3971:function(nt,ot,st){st(3436);var at=st(5607);nt.exports=at("Array").filter},98:function(nt,ot,st){st(9823);var at=st(5607);nt.exports=at("Array").forEach},2089:function(nt,ot,st){st(2276);var at=st(5607);nt.exports=at("Array").indexOf},6209:function(nt,ot,st){st(3838);var at=st(5607);nt.exports=at("Array").map},2671:function(nt,ot,st){st(5818);var at=st(5607);nt.exports=at("Array").slice},1375:function(nt,ot,st){st(2178);var at=st(5607);nt.exports=at("Array").splice},3528:function(nt,ot,st){st(665);var at=st(5607);nt.exports=at("Function").bind},5739:function(nt,ot,st){st(8939),st(5454);var at=st(8703);nt.exports=at},278:function(nt,ot,st){var at=st(3528),lt=Function.prototype;nt.exports=function(ct){var ht=ct.bind;return ct===lt||ct instanceof Function&&ht===lt.bind?at:ht}},1484:function(nt,ot,st){var at=st(6135),lt=Array.prototype;nt.exports=function(ct){var ht=ct.concat;return ct===lt||ct instanceof Array&&ht===lt.concat?at:ht}},7731:function(nt,ot,st){var at=st(9510),lt=Array.prototype;nt.exports=function(ct){var ht=ct.fill;return ct===lt||ct instanceof Array&&ht===lt.fill?at:ht}},3669:function(nt,ot,st){var at=st(3971),lt=Array.prototype;nt.exports=function(ct){var ht=ct.filter;return ct===lt||ct instanceof Array&&ht===lt.filter?at:ht}},2604:function(nt,ot,st){var at=st(2089),lt=Array.prototype;nt.exports=function(ct){var ht=ct.indexOf;return ct===lt||ct instanceof Array&&ht===lt.indexOf?at:ht}},263:function(nt,ot,st){var at=st(6209),lt=Array.prototype;nt.exports=function(ct){var ht=ct.map;return ct===lt||ct instanceof Array&&ht===lt.map?at:ht}},7663:function(nt,ot,st){var at=st(2671),lt=Array.prototype;nt.exports=function(ct){var ht=ct.slice;return ct===lt||ct instanceof Array&&ht===lt.slice?at:ht}},5063:function(nt,ot,st){var at=st(1375),lt=Array.prototype;nt.exports=function(ct){var ht=ct.splice;return ct===lt||ct instanceof Array&&ht===lt.splice?at:ht}},6813:function(nt,ot,st){var at=st(3842),lt=String.prototype;nt.exports=function(ct){var ht=ct.trim;return typeof ct=="string"||ct===lt||ct instanceof String&&ht===lt.trim?at:ht}},6285:function(nt,ot,st){st(2666);var at=st(7545);nt.exports=at.Number.parseInt},3213:function(nt,ot,st){st(3113);var at=st(7545),lt=at.Object;nt.exports=function(ht,mt){return lt.create(ht,mt)}},3512:function(nt,ot,st){st(297);var at=st(7545),lt=at.Object,ct=nt.exports=function(mt,dt,ft){return lt.defineProperty(mt,dt,ft)};lt.defineProperty.sham&&(ct.sham=!0)},8168:function(nt,ot,st){st(9234);var at=st(7545);nt.exports=at.Object.getPrototypeOf},8651:function(nt,ot,st){st(2647);var at=st(7545);nt.exports=at.Object.keys},3083:function(nt,ot,st){st(3222);var at=st(7545);nt.exports=at.Object.setPrototypeOf},2987:function(nt,ot,st){st(4859);var at=st(7545);nt.exports=at.parseFloat},2239:function(nt,ot,st){st(5706);var at=st(7545);nt.exports=at.parseInt},3154:function(nt,ot,st){st(4242),st(8939),st(6663),st(9021),st(7884),st(8885),st(1868),st(5454);var at=st(7545);nt.exports=at.Promise},6577:function(nt,ot,st){st(5397);var at=st(7545);nt.exports=at.Reflect.construct},3842:function(nt,ot,st){st(957);var at=st(5607);nt.exports=at("String").trim},5008:function(nt,ot,st){st(9106),st(6663),st(6187),st(9781),st(492),st(6681),st(9594),st(3665),st(9017),st(1250),st(9786),st(503),st(6565),st(9322),st(3610),st(6886),st(3514),st(8671),st(8556),st(1367);var at=st(7545);nt.exports=at.Symbol},994:function(nt,ot,st){st(8939),st(6663),st(5454),st(3665);var at=st(9207);nt.exports=at.f("iterator")},2813:function(nt,ot,st){var at=st(3822);nt.exports=at},8664:function(nt,ot,st){var at=st(1434);nt.exports=at},1457:function(nt,ot,st){var at=st(7710);nt.exports=at},2937:function(nt,ot,st){var at=st(4741);nt.exports=at},9297:function(nt,ot,st){var at=st(4963);nt.exports=at},8026:function(nt,ot,st){var at=st(7820);nt.exports=at},2044:function(nt,ot,st){var at=st(8980);nt.exports=at},2214:function(nt,ot,st){var at=st(6672);nt.exports=at},9256:function(nt,ot,st){var at=st(2285);st(177),st(9031),st(6658),st(1875),st(8658),st(4592),st(6680),nt.exports=at},5659:function(nt,ot,st){var at=st(8535);nt.exports=at},6235:function(nt,ot,st){var at=st(6447),lt=st(9288);nt.exports=function(ct){if(at(ct))return ct;throw TypeError(lt(ct)+" is not a function")}},1404:function(nt,ot,st){var at=st(2091),lt=st(9288);nt.exports=function(ct){if(at(ct))return ct;throw TypeError(lt(ct)+" is not a constructor")}},7757:function(nt,ot,st){var at=st(6447);nt.exports=function(lt){if(typeof lt=="object"||at(lt))return lt;throw TypeError("Can't set "+String(lt)+" as a prototype")}},7423:function(nt){nt.exports=function(){}},6961:function(nt){nt.exports=function(ot,st,at){if(ot instanceof st)return ot;throw TypeError("Incorrect "+(at?at+" ":"")+"invocation")}},1138:function(nt,ot,st){var at=st(5744);nt.exports=function(lt){if(at(lt))return lt;throw TypeError(String(lt)+" is not an object")}},2724:function(nt,ot,st){var at=st(1795),lt=st(7739),ct=st(4104);nt.exports=function(mt){for(var dt=at(this),ft=ct(dt),ut=arguments.length,pt=lt(ut>1?arguments[1]:void 0,ft),At=ut>2?arguments[2]:void 0,gt=At===void 0?ft:lt(At,ft);gt>pt;)dt[pt++]=mt;return dt}},7397:function(nt,ot,st){var at=st(454).forEach,lt=st(424),ct=lt("forEach");nt.exports=ct?[].forEach:function(mt){return at(this,mt,arguments.length>1?arguments[1]:void 0)}},841:function(nt,ot,st){var at=st(8043),lt=st(1795),ct=st(1635),ht=st(6109),mt=st(2091),dt=st(4104),ft=st(9361),ut=st(1669),pt=st(8703);nt.exports=function(gt){var vt=lt(gt),yt=mt(this),bt=arguments.length,Ct=bt>1?arguments[1]:void 0,xt=Ct!==void 0;xt&&(Ct=at(Ct,bt>2?arguments[2]:void 0,2));var It=pt(vt),St=0,Ot,Mt,jt,Ft,Ut,Qt;if(It&&!(this==Array&&ht(It)))for(Ft=ut(vt,It),Ut=Ft.next,Mt=yt?new this:[];!(jt=Ut.call(Ft)).done;St++)Qt=xt?ct(Ft,Ct,[jt.value,St],!0):jt.value,ft(Mt,St,Qt);else for(Ot=dt(vt),Mt=yt?new this(Ot):Array(Ot);Ot>St;St++)Qt=xt?Ct(vt[St],St):vt[St],ft(Mt,St,Qt);return Mt.length=St,Mt}},8180:function(nt,ot,st){var at=st(101),lt=st(7739),ct=st(4104),ht=function(mt){return function(dt,ft,ut){var pt=at(dt),At=ct(pt),gt=lt(ut,At),vt;if(mt&&ft!=ft){for(;At>gt;)if(vt=pt[gt++],vt!=vt)return!0}else for(;At>gt;gt++)if((mt||gt in pt)&&pt[gt]===ft)return mt||gt||0;return!mt&&-1}};nt.exports={includes:ht(!0),indexOf:ht(!1)}},454:function(nt,ot,st){var at=st(8043),lt=st(2202),ct=st(1795),ht=st(4104),mt=st(1321),dt=[].push,ft=function(ut){var pt=ut==1,At=ut==2,gt=ut==3,vt=ut==4,yt=ut==6,bt=ut==7,Ct=ut==5||yt;return function(xt,It,St,Ot){for(var Mt=ct(xt),jt=lt(Mt),Ft=at(It,St,3),Ut=ht(jt),Qt=0,Ht=Ot||mt,Zt=pt?Ht(xt,Ut):At||bt?Ht(xt,0):void 0,Wt,$t;Ut>Qt;Qt++)if((Ct||Qt in jt)&&(Wt=jt[Qt],$t=Ft(Wt,Qt,Mt),ut))if(pt)Zt[Qt]=$t;else if($t)switch(ut){case 3:return!0;case 5:return Wt;case 6:return Qt;case 2:dt.call(Zt,Wt)}else switch(ut){case 4:return!1;case 7:dt.call(Zt,Wt)}return yt?-1:gt||vt?vt:Zt}};nt.exports={forEach:ft(0),map:ft(1),filter:ft(2),some:ft(3),every:ft(4),find:ft(5),findIndex:ft(6),filterReject:ft(7)}},242:function(nt,ot,st){var at=st(6192),lt=st(8182),ct=st(4218),ht=lt("species");nt.exports=function(mt){return ct>=51||!at(function(){var dt=[],ft=dt.constructor={};return ft[ht]=function(){return{foo:1}},dt[mt](Boolean).foo!==1})}},424:function(nt,ot,st){var at=st(6192);nt.exports=function(lt,ct){var ht=[][lt];return!!ht&&at(function(){ht.call(null,ct||function(){throw 1},1)})}},3712:function(nt,ot,st){var at=st(4770),lt=st(2091),ct=st(5744),ht=st(8182),mt=ht("species");nt.exports=function(dt){var ft;return at(dt)&&(ft=dt.constructor,lt(ft)&&(ft===Array||at(ft.prototype))?ft=void 0:ct(ft)&&(ft=ft[mt],ft===null&&(ft=void 0))),ft===void 0?Array:ft}},1321:function(nt,ot,st){var at=st(3712);nt.exports=function(lt,ct){return new(at(lt))(ct===0?0:ct)}},1635:function(nt,ot,st){var at=st(1138),lt=st(6639);nt.exports=function(ct,ht,mt,dt){try{return dt?ht(at(mt)[0],mt[1]):ht(mt)}catch(ft){lt(ct,"throw",ft)}}},9770:function(nt,ot,st){var at=st(8182),lt=at("iterator"),ct=!1;try{var ht=0,mt={next:function(){return{done:!!ht++}},return:function(){ct=!0}};mt[lt]=function(){return this},Array.from(mt,function(){throw 2})}catch{}nt.exports=function(dt,ft){if(!ft&&!ct)return!1;var ut=!1;try{var pt={};pt[lt]=function(){return{next:function(){return{done:ut=!0}}}},dt(pt)}catch{}return ut}},9272:function(nt){var ot={}.toString;nt.exports=function(st){return ot.call(st).slice(8,-1)}},4696:function(nt,ot,st){var at=st(3471),lt=st(6447),ct=st(9272),ht=st(8182),mt=ht("toStringTag"),dt=ct(function(){return arguments}())=="Arguments",ft=function(ut,pt){try{return ut[pt]}catch{}};nt.exports=at?ct:function(ut){var pt,At,gt;return ut===void 0?"Undefined":ut===null?"Null":typeof(At=ft(pt=Object(ut),mt))=="string"?At:dt?ct(pt):(gt=ct(pt))=="Object"&&lt(pt.callee)?"Arguments":gt}},4635:function(nt,ot,st){var at=st(6192);nt.exports=!at(function(){function lt(){}return lt.prototype.constructor=null,Object.getPrototypeOf(new lt)!==lt.prototype})},5148:function(nt,ot,st){var at=st(4413).IteratorPrototype,lt=st(2853),ct=st(774),ht=st(1284),mt=st(7771),dt=function(){return this};nt.exports=function(ft,ut,pt){var At=ut+" Iterator";return ft.prototype=lt(at,{next:ct(1,pt)}),ht(ft,At,!1,!0),mt[At]=dt,ft}},8711:function(nt,ot,st){var at=st(69),lt=st(2760),ct=st(774);nt.exports=at?function(ht,mt,dt){return lt.f(ht,mt,ct(1,dt))}:function(ht,mt,dt){return ht[mt]=dt,ht}},774:function(nt){nt.exports=function(ot,st){return{enumerable:!(ot&1),configurable:!(ot&2),writable:!(ot&4),value:st}}},9361:function(nt,ot,st){var at=st(77),lt=st(2760),ct=st(774);nt.exports=function(ht,mt,dt){var ft=at(mt);ft in ht?lt.f(ht,ft,ct(0,dt)):ht[ft]=dt}},7218:function(nt,ot,st){var at=st(3085),lt=st(5546),ct=st(2282),ht=st(6447),mt=st(5148),dt=st(9341),ft=st(4469),ut=st(1284),pt=st(8711),At=st(9482),gt=st(8182),vt=st(7771),yt=st(4413),bt=ct.PROPER,Ct=ct.CONFIGURABLE,xt=yt.IteratorPrototype,It=yt.BUGGY_SAFARI_ITERATORS,St=gt("iterator"),Ot="keys",Mt="values",jt="entries",Ft=function(){return this};nt.exports=function(Ut,Qt,Ht,Zt,Wt,$t,Jt){mt(Ht,Qt,Zt);var Nt=function(Vt){if(Vt===Wt&&Gt)return Gt;if(!It&&Vt in Pt)return Pt[Vt];switch(Vt){case Ot:return function(){return new Ht(this,Vt)};case Mt:return function(){return new Ht(this,Vt)};case jt:return function(){return new Ht(this,Vt)}}return function(){return new Ht(this)}},Lt=Qt+" Iterator",Kt=!1,Pt=Ut.prototype,ln=Pt[St]||Pt["@@iterator"]||Wt&&Pt[Wt],Gt=!It&&ln||Nt(Wt),on=Qt=="Array"&&Pt.entries||ln,tn,_i,Xt;if(on&&(tn=dt(on.call(new Ut)),tn!==Object.prototype&&tn.next&&(!lt&&dt(tn)!==xt&&(ft?ft(tn,xt):ht(tn[St])||At(tn,St,Ft)),ut(tn,Lt,!0,!0),lt&&(vt[Lt]=Ft))),bt&&Wt==Mt&&ln&&ln.name!==Mt&&(!lt&&Ct?pt(Pt,"name",Mt):(Kt=!0,Gt=function(){return ln.call(this)})),Wt)if(_i={values:Nt(Mt),keys:$t?Gt:Nt(Ot),entries:Nt(jt)},Jt)for(Xt in _i)(It||Kt||!(Xt in Pt))&&At(Pt,Xt,_i[Xt]);else at({target:Qt,proto:!0,forced:It||Kt},_i);return(!lt||Jt)&&Pt[St]!==Gt&&At(Pt,St,Gt,{name:Wt}),vt[Qt]=Gt,_i}},1488:function(nt,ot,st){var at=st(7545),lt=st(4500),ct=st(9207),ht=st(2760).f;nt.exports=function(mt){var dt=at.Symbol||(at.Symbol={});lt(dt,mt)||ht(dt,mt,{value:ct.f(mt)})}},69:function(nt,ot,st){var at=st(6192);nt.exports=!at(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},7449:function(nt,ot,st){st(8576);var at=st(5744),lt=window.document,ct=at(lt)&&at(lt.createElement);nt.exports=function(ht){return ct?lt.createElement(ht):{}}},7365:function(nt){nt.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},2957:function(nt){nt.exports=typeof window=="object"},9347:function(nt,ot,st){var at=st(8989);st(8576),nt.exports=/ipad|iphone|ipod/i.test(at)&&window.Pebble!==void 0},9536:function(nt,ot,st){var at=st(8989);nt.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(at)},224:function(nt,ot,st){var at=st(9272);st(8576),nt.exports=at(window.process)=="process"},5914:function(nt,ot,st){var at=st(8989);nt.exports=/web0s(?!.*chrome)/i.test(at)},8989:function(nt,ot,st){var at=st(150);nt.exports=at("navigator","userAgent")||""},4218:function(nt,ot,st){st(8576);var at=st(8989),lt=window.process,ct=window.Deno,ht=lt&&lt.versions||ct&&ct.version,mt=ht&&ht.v8,dt,ft;mt?(dt=mt.split("."),ft=dt[0]<4?1:dt[0]+dt[1]):at&&(dt=at.match(/Edge\/(\d+)/),(!dt||dt[1]>=74)&&(dt=at.match(/Chrome\/(\d+)/),dt&&(ft=dt[1]))),nt.exports=ft&&+ft},5607:function(nt,ot,st){var at=st(7545);nt.exports=function(lt){return at[lt+"Prototype"]}},2952:function(nt){nt.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3085:function(nt,ot,st){st(8576);var at=st(6447),lt=st(5141).f,ct=st(9245),ht=st(7545),mt=st(8043),dt=st(8711),ft=st(4500),ut=function(pt){var At=function(gt,vt,yt){if(this instanceof pt){switch(arguments.length){case 0:return new pt;case 1:return new pt(gt);case 2:return new pt(gt,vt)}return new pt(gt,vt,yt)}return pt.apply(this,arguments)};return At.prototype=pt.prototype,At};nt.exports=function(pt,At){var gt=pt.target,vt=pt.global,yt=pt.stat,bt=pt.proto,Ct=vt?window:yt?window[gt]:(window[gt]||{}).prototype,xt=vt?ht:ht[gt]||dt(ht,gt,{})[gt],It=xt.prototype,St,Ot,Mt,jt,Ft,Ut,Qt,Ht,Zt;for(jt in At)St=ct(vt?jt:gt+(yt?".":"#")+jt,pt.forced),Ot=!St&&Ct&&ft(Ct,jt),Ut=xt[jt],Ot&&(pt.noTargetGet?(Zt=lt(Ct,jt),Qt=Zt&&Zt.value):Qt=Ct[jt]),Ft=Ot&&Qt?Qt:At[jt],!(Ot&&typeof Ut==typeof Ft)&&(pt.bind&&Ot?Ht=mt(Ft,window):pt.wrap&&Ot?Ht=ut(Ft):bt&&at(Ft)?Ht=mt(Function.call,Ft):Ht=Ft,(pt.sham||Ft&&Ft.sham||Ut&&Ut.sham)&&dt(Ht,"sham",!0),dt(xt,jt,Ht),bt&&(Mt=gt+"Prototype",ft(ht,Mt)||dt(ht,Mt,{}),dt(ht[Mt],jt,Ft),pt.real&&It&&!It[jt]&&dt(It,jt,Ft)))}},6192:function(nt){nt.exports=function(ot){try{return!!ot()}catch{return!0}}},8043:function(nt,ot,st){var at=st(6235);nt.exports=function(lt,ct,ht){if(at(lt),ct===void 0)return lt;switch(ht){case 0:return function(){return lt.call(ct)};case 1:return function(mt){return lt.call(ct,mt)};case 2:return function(mt,dt){return lt.call(ct,mt,dt)};case 3:return function(mt,dt,ft){return lt.call(ct,mt,dt,ft)}}return function(){return lt.apply(ct,arguments)}}},6782:function(nt,ot,st){var at=st(6235),lt=st(5744),ct=[].slice,ht={},mt=function(dt,ft,ut){if(!(ft in ht)){for(var pt=[],At=0;At<ft;At++)pt[At]="a["+At+"]";ht[ft]=Function("C,a","return new C("+pt.join(",")+")")}return ht[ft](dt,ut)};nt.exports=Function.bind||function(ft){var ut=at(this),pt=ct.call(arguments,1),At=function(){var vt=pt.concat(ct.call(arguments));return this instanceof At?mt(ut,vt.length,vt):ut.apply(ft,vt)};return lt(ut.prototype)&&(At.prototype=ut.prototype),At}},2282:function(nt,ot,st){var at=st(69),lt=st(4500),ct=Function.prototype,ht=at&&Object.getOwnPropertyDescriptor,mt=lt(ct,"name"),dt=mt&&function(){}.name==="something",ft=mt&&(!at||at&&ht(ct,"name").configurable);nt.exports={EXISTS:mt,PROPER:dt,CONFIGURABLE:ft}},150:function(nt,ot,st){var at=st(7545);st(8576);var lt=st(6447),ct=function(ht){return lt(ht)?ht:void 0};nt.exports=function(ht,mt){return arguments.length<2?ct(at[ht])||ct(window[ht]):at[ht]&&at[ht][mt]||window[ht]&&window[ht][mt]}},8703:function(nt,ot,st){var at=st(4696),lt=st(5037),ct=st(7771),ht=st(8182),mt=ht("iterator");nt.exports=function(dt){if(dt!=null)return lt(dt,mt)||lt(dt,"@@iterator")||ct[at(dt)]}},1669:function(nt,ot,st){var at=st(6235),lt=st(1138),ct=st(8703);nt.exports=function(ht,mt){var dt=arguments.length<2?ct(ht):mt;if(at(dt))return lt(dt.call(ht));throw TypeError(String(ht)+" is not iterable")}},5037:function(nt,ot,st){var at=st(6235);nt.exports=function(lt,ct){var ht=lt[ct];return ht==null?void 0:at(ht)}},8576:function(nt,ot,st){var at=function(lt){return lt&&lt.Math==Math&&lt};nt.exports=at(typeof globalThis=="object"&&globalThis)||at(typeof window=="object"&&window)||at(typeof self=="object"&&self)||at(typeof st.g=="object"&&st.g)||function(){return this}()||Function("return this")()},4500:function(nt,ot,st){var at=st(1795),lt={}.hasOwnProperty;nt.exports=Object.hasOwn||function(ht,mt){return lt.call(at(ht),mt)}},4535:function(nt){nt.exports={}},3681:function(nt,ot,st){st(8576),nt.exports=function(at,lt){var ct=window.console;ct&&ct.error&&(arguments.length===1?ct.error(at):ct.error(at,lt))}},7403:function(nt,ot,st){var at=st(150);nt.exports=at("document","documentElement")},188:function(nt,ot,st){var at=st(69),lt=st(6192),ct=st(7449);nt.exports=!at&&!lt(function(){return Object.defineProperty(ct("div"),"a",{get:function(){return 7}}).a!=7})},2202:function(nt,ot,st){var at=st(6192),lt=st(9272),ct="".split;nt.exports=at(function(){return!Object("z").propertyIsEnumerable(0)})?function(ht){return lt(ht)=="String"?ct.call(ht,""):Object(ht)}:Object},9516:function(nt,ot,st){var at=st(6447),lt=st(6434),ct=Function.toString;at(lt.inspectSource)||(lt.inspectSource=function(ht){return ct.call(ht)}),nt.exports=lt.inspectSource},273:function(nt,ot,st){var at=st(5744),lt=st(8711);nt.exports=function(ct,ht){at(ht)&&"cause"in ht&&lt(ct,"cause",ct.cause)}},3326:function(nt,ot,st){var at=st(8921);st(8576);var lt=st(5744),ct=st(8711),ht=st(4500),mt=st(6434),dt=st(9766),ft=st(4535),ut="Object already initialized",pt=window.WeakMap,At,gt,vt,yt=function(Mt){return vt(Mt)?gt(Mt):At(Mt,{})},bt=function(Mt){return function(jt){var Ft;if(!lt(jt)||(Ft=gt(jt)).type!==Mt)throw TypeError("Incompatible receiver, "+Mt+" required");return Ft}};if(at||mt.state){var Ct=mt.state||(mt.state=new pt),xt=Ct.get,It=Ct.has,St=Ct.set;At=function(Mt,jt){if(It.call(Ct,Mt))throw new TypeError(ut);return jt.facade=Mt,St.call(Ct,Mt,jt),jt},gt=function(Mt){return xt.call(Ct,Mt)||{}},vt=function(Mt){return It.call(Ct,Mt)}}else{var Ot=dt("state");ft[Ot]=!0,At=function(Mt,jt){if(ht(Mt,Ot))throw new TypeError(ut);return jt.facade=Mt,ct(Mt,Ot,jt),jt},gt=function(Mt){return ht(Mt,Ot)?Mt[Ot]:{}},vt=function(Mt){return ht(Mt,Ot)}}nt.exports={set:At,get:gt,has:vt,enforce:yt,getterFor:bt}},6109:function(nt,ot,st){var at=st(8182),lt=st(7771),ct=at("iterator"),ht=Array.prototype;nt.exports=function(mt){return mt!==void 0&&(lt.Array===mt||ht[ct]===mt)}},4770:function(nt,ot,st){var at=st(9272);nt.exports=Array.isArray||function(ct){return at(ct)=="Array"}},6447:function(nt){nt.exports=function(ot){return typeof ot=="function"}},2091:function(nt,ot,st){var at=st(6192),lt=st(6447),ct=st(4696),ht=st(150),mt=st(9516),dt=[],ft=ht("Reflect","construct"),ut=/^\s*(?:class|function)\b/,pt=ut.exec,At=!ut.exec(function(){}),gt=function(yt){if(!lt(yt))return!1;try{return ft(Object,dt,yt),!0}catch{return!1}},vt=function(yt){if(!lt(yt))return!1;switch(ct(yt)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return At||!!pt.call(ut,mt(yt))};nt.exports=!ft||at(function(){var yt;return gt(gt.call)||!gt(Object)||!gt(function(){yt=!0})||yt})?vt:gt},9245:function(nt,ot,st){var at=st(6192),lt=st(6447),ct=/#|\.prototype\./,ht=function(pt,At){var gt=dt[mt(pt)];return gt==ut?!0:gt==ft?!1:lt(At)?at(At):!!At},mt=ht.normalize=function(pt){return String(pt).replace(ct,".").toLowerCase()},dt=ht.data={},ft=ht.NATIVE="N",ut=ht.POLYFILL="P";nt.exports=ht},5744:function(nt,ot,st){var at=st(6447);nt.exports=function(lt){return typeof lt=="object"?lt!==null:at(lt)}},5546:function(nt){nt.exports=!0},3236:function(nt,ot,st){var at=st(6447),lt=st(150),ct=st(615);nt.exports=ct?function(ht){return typeof ht=="symbol"}:function(ht){var mt=lt("Symbol");return at(mt)&&Object(ht)instanceof mt}},3442:function(nt,ot,st){var at=st(1138),lt=st(6109),ct=st(4104),ht=st(8043),mt=st(1669),dt=st(8703),ft=st(6639),ut=function(pt,At){this.stopped=pt,this.result=At};nt.exports=function(pt,At,gt){var vt=gt&&gt.that,yt=!!(gt&&gt.AS_ENTRIES),bt=!!(gt&&gt.IS_ITERATOR),Ct=!!(gt&&gt.INTERRUPTED),xt=ht(At,vt,1+yt+Ct),It,St,Ot,Mt,jt,Ft,Ut,Qt=function(Zt){return It&&ft(It,"normal",Zt),new ut(!0,Zt)},Ht=function(Zt){return yt?(at(Zt),Ct?xt(Zt[0],Zt[1],Qt):xt(Zt[0],Zt[1])):Ct?xt(Zt,Qt):xt(Zt)};if(bt)It=pt;else{if(St=dt(pt),!St)throw TypeError(String(pt)+" is not iterable");if(lt(St)){for(Ot=0,Mt=ct(pt);Mt>Ot;Ot++)if(jt=Ht(pt[Ot]),jt&&jt instanceof ut)return jt;return new ut(!1)}It=mt(pt,St)}for(Ft=It.next;!(Ut=Ft.call(It)).done;){try{jt=Ht(Ut.value)}catch(Zt){ft(It,"throw",Zt)}if(typeof jt=="object"&&jt&&jt instanceof ut)return jt}return new ut(!1)}},6639:function(nt,ot,st){var at=st(1138),lt=st(5037);nt.exports=function(ct,ht,mt){var dt,ft;at(ct);try{if(dt=lt(ct,"return"),!dt){if(ht==="throw")throw mt;return mt}dt=dt.call(ct)}catch(ut){ft=!0,dt=ut}if(ht==="throw")throw mt;if(ft)throw dt;return at(dt),mt}},4413:function(nt,ot,st){var at=st(6192),lt=st(6447),ct=st(2853),ht=st(9341),mt=st(9482),dt=st(8182),ft=st(5546),ut=dt("iterator"),pt=!1,At,gt,vt;[].keys&&(vt=[].keys(),"next"in vt?(gt=ht(ht(vt)),gt!==Object.prototype&&(At=gt)):pt=!0);var yt=At==null||at(function(){var bt={};return At[ut].call(bt)!==bt});yt?At={}:ft&&(At=ct(At)),lt(At[ut])||mt(At,ut,function(){return this}),nt.exports={IteratorPrototype:At,BUGGY_SAFARI_ITERATORS:pt}},7771:function(nt){nt.exports={}},4104:function(nt,ot,st){var at=st(8445);nt.exports=function(lt){return at(lt.length)}},2950:function(nt,ot,st){st(8576);var at=st(5141).f,lt=st(7160).set,ct=st(9536),ht=st(9347),mt=st(5914),dt=st(224),ft=window.MutationObserver||window.WebKitMutationObserver,ut=window.document,pt=window.process,At=window.Promise,gt=at(window,"queueMicrotask"),vt=gt&&gt.value,yt,bt,Ct,xt,It,St,Ot,Mt;vt||(yt=function(){var jt,Ft;for(dt&&(jt=pt.domain)&&jt.exit();bt;){Ft=bt.fn,bt=bt.next;try{Ft()}catch(Ut){throw bt?xt():Ct=void 0,Ut}}Ct=void 0,jt&&jt.enter()},!ct&&!dt&&!mt&&ft&&ut?(It=!0,St=ut.createTextNode(""),new ft(yt).observe(St,{characterData:!0}),xt=function(){St.data=It=!It}):!ht&&At&&At.resolve?(Ot=At.resolve(void 0),Ot.constructor=At,Mt=Ot.then,xt=function(){Mt.call(Ot,yt)}):dt?xt=function(){pt.nextTick(yt)}:xt=function(){lt.call(window,yt)}),nt.exports=vt||function(jt){var Ft={fn:jt,next:void 0};Ct&&(Ct.next=Ft),bt||(bt=Ft,xt()),Ct=Ft}},4471:function(nt,ot,st){st(8576),nt.exports=window.Promise},3045:function(nt,ot,st){var at=st(4218),lt=st(6192);nt.exports=!!Object.getOwnPropertySymbols&&!lt(function(){var ct=Symbol();return!String(ct)||!(Object(ct)instanceof Symbol)||!Symbol.sham&&at&&at<41})},4551:function(nt,ot,st){var at=st(6192),lt=st(8182),ct=st(5546),ht=lt("iterator");nt.exports=!at(function(){var mt=new URL("b?a=1&b=2&c=3","http://a"),dt=mt.searchParams,ft="";return mt.pathname="c%20d",dt.forEach(function(ut,pt){dt.delete("b"),ft+=pt+ut}),ct&&!mt.toJSON||!dt.sort||mt.href!=="http://a/c%20d?a=1&c=3"||dt.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!dt[ht]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||ft!=="a1c3"||new URL("http://x",void 0).host!=="x"})},8921:function(nt,ot,st){st(8576);var at=st(6447),lt=st(9516),ct=window.WeakMap;nt.exports=at(ct)&&/native code/.test(lt(ct))},9438:function(nt,ot,st){var at=st(6235),lt=function(ct){var ht,mt;this.promise=new ct(function(dt,ft){if(ht!==void 0||mt!==void 0)throw TypeError("Bad Promise constructor");ht=dt,mt=ft}),this.resolve=at(ht),this.reject=at(mt)};nt.exports.f=function(ct){return new lt(ct)}},15:function(nt,ot,st){st(8576);var at=st(6192),lt=st(4845),ct=st(4277).trim,ht=st(1450),mt=window.parseFloat,dt=window.Symbol,ft=dt&&dt.iterator,ut=1/mt(ht+"-0")!==-1/0||ft&&!at(function(){});nt.exports=ut?function(At){var gt=ct(lt(At)),vt=mt(gt);return vt===0&&gt.charAt(0)=="-"?-0:vt}:mt},2558:function(nt,ot,st){st(8576);var at=st(6192),lt=st(4845),ct=st(4277).trim,ht=st(1450),mt=window.parseInt,dt=window.Symbol,ft=dt&&dt.iterator,ut=/^[+-]?0[Xx]/,pt=mt(ht+"08")!==8||mt(ht+"0x16")!==22||ft&&!at(function(){});nt.exports=pt?function(gt,vt){var yt=ct(lt(gt));return mt(yt,vt>>>0||(ut.test(yt)?16:10))}:mt},2503:function(nt,ot,st){var at=st(69),lt=st(6192),ct=st(7653),ht=st(4750),mt=st(6007),dt=st(1795),ft=st(2202),ut=Object.assign,pt=Object.defineProperty;nt.exports=!ut||lt(function(){if(at&&ut({b:1},ut(pt({},"a",{enumerable:!0,get:function(){pt(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var At={},gt={},vt=Symbol(),yt="abcdefghijklmnopqrst";return At[vt]=7,yt.split("").forEach(function(bt){gt[bt]=bt}),ut({},At)[vt]!=7||ct(ut({},gt)).join("")!=yt})?function(gt,vt){for(var yt=dt(gt),bt=arguments.length,Ct=1,xt=ht.f,It=mt.f;bt>Ct;)for(var St=ft(arguments[Ct++]),Ot=xt?ct(St).concat(xt(St)):ct(St),Mt=Ot.length,jt=0,Ft;Mt>jt;)Ft=Ot[jt++],(!at||It.call(St,Ft))&&(yt[Ft]=St[Ft]);return yt}:ut},2853:function(nt,ot,st){var at=st(1138),lt=st(1187),ct=st(2952),ht=st(4535),mt=st(7403),dt=st(7449),ft=st(9766),ut=">",pt="<",At="prototype",gt="script",vt=ft("IE_PROTO"),yt=function(){},bt=function(Ot){return pt+gt+ut+Ot+pt+"/"+gt+ut},Ct=function(Ot){Ot.write(bt("")),Ot.close();var Mt=Ot.parentWindow.Object;return Ot=null,Mt},xt=function(){var Ot=dt("iframe"),Mt="java"+gt+":",jt;return Ot.style.display="none",mt.appendChild(Ot),Ot.src=String(Mt),jt=Ot.contentWindow.document,jt.open(),jt.write(bt("document.F=Object")),jt.close(),jt.F},It,St=function(){try{It=new ActiveXObject("htmlfile")}catch{}St=typeof document!="undefined"?document.domain&&It?Ct(It):xt():Ct(It);for(var Ot=ct.length;Ot--;)delete St[At][ct[Ot]];return St()};ht[vt]=!0,nt.exports=Object.create||function(Mt,jt){var Ft;return Mt!==null?(yt[At]=at(Mt),Ft=new yt,yt[At]=null,Ft[vt]=Mt):Ft=St(),jt===void 0?Ft:lt(Ft,jt)}},1187:function(nt,ot,st){var at=st(69),lt=st(2760),ct=st(1138),ht=st(7653);nt.exports=at?Object.defineProperties:function(dt,ft){ct(dt);for(var ut=ht(ft),pt=ut.length,At=0,gt;pt>At;)lt.f(dt,gt=ut[At++],ft[gt]);return dt}},2760:function(nt,ot,st){var at=st(69),lt=st(188),ct=st(1138),ht=st(77),mt=Object.defineProperty;ot.f=at?mt:function(ft,ut,pt){if(ct(ft),ut=ht(ut),ct(pt),lt)try{return mt(ft,ut,pt)}catch{}if("get"in pt||"set"in pt)throw TypeError("Accessors not supported");return"value"in pt&&(ft[ut]=pt.value),ft}},5141:function(nt,ot,st){var at=st(69),lt=st(6007),ct=st(774),ht=st(101),mt=st(77),dt=st(4500),ft=st(188),ut=Object.getOwnPropertyDescriptor;ot.f=at?ut:function(At,gt){if(At=ht(At),gt=mt(gt),ft)try{return ut(At,gt)}catch{}if(dt(At,gt))return ct(!lt.f.call(At,gt),At[gt])}},4052:function(nt,ot,st){var at=st(101),lt=st(2092).f,ct={}.toString,ht=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],mt=function(dt){try{return lt(dt)}catch{return ht.slice()}};nt.exports.f=function(ft){return ht&&ct.call(ft)=="[object Window]"?mt(ft):lt(at(ft))}},2092:function(nt,ot,st){var at=st(7934),lt=st(2952),ct=lt.concat("length","prototype");ot.f=Object.getOwnPropertyNames||function(mt){return at(mt,ct)}},4750:function(nt,ot){ot.f=Object.getOwnPropertySymbols},9341:function(nt,ot,st){var at=st(4500),lt=st(6447),ct=st(1795),ht=st(9766),mt=st(4635),dt=ht("IE_PROTO"),ft=Object.prototype;nt.exports=mt?Object.getPrototypeOf:function(ut){var pt=ct(ut);if(at(pt,dt))return pt[dt];var At=pt.constructor;return lt(At)&&pt instanceof At?At.prototype:pt instanceof Object?ft:null}},7934:function(nt,ot,st){var at=st(4500),lt=st(101),ct=st(8180).indexOf,ht=st(4535);nt.exports=function(mt,dt){var ft=lt(mt),ut=0,pt=[],At;for(At in ft)!at(ht,At)&&at(ft,At)&&pt.push(At);for(;dt.length>ut;)at(ft,At=dt[ut++])&&(~ct(pt,At)||pt.push(At));return pt}},7653:function(nt,ot,st){var at=st(7934),lt=st(2952);nt.exports=Object.keys||function(ht){return at(ht,lt)}},6007:function(nt,ot){var st={}.propertyIsEnumerable,at=Object.getOwnPropertyDescriptor,lt=at&&!st.call({1:2},1);ot.f=lt?function(ht){var mt=at(this,ht);return!!mt&&mt.enumerable}:st},4469:function(nt,ot,st){var at=st(1138),lt=st(7757);nt.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var ct=!1,ht={},mt;try{mt=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,mt.call(ht,[]),ct=ht instanceof Array}catch{}return function(ft,ut){return at(ft),lt(ut),ct?mt.call(ft,ut):ft.__proto__=ut,ft}}():void 0)},158:function(nt,ot,st){var at=st(3471),lt=st(4696);nt.exports=at?{}.toString:function(){return"[object "+lt(this)+"]"}},380:function(nt,ot,st){var at=st(6447),lt=st(5744);nt.exports=function(ct,ht){var mt,dt;if(ht==="string"&&at(mt=ct.toString)&&!lt(dt=mt.call(ct))||at(mt=ct.valueOf)&&!lt(dt=mt.call(ct))||ht!=="string"&&at(mt=ct.toString)&&!lt(dt=mt.call(ct)))return dt;throw TypeError("Can't convert object to primitive value")}},7545:function(nt){nt.exports={}},892:function(nt){nt.exports=function(ot){try{return{error:!1,value:ot()}}catch(st){return{error:!0,value:st}}}},9126:function(nt,ot,st){var at=st(1138),lt=st(5744),ct=st(9438);nt.exports=function(ht,mt){if(at(ht),lt(mt)&&mt.constructor===ht)return mt;var dt=ct.f(ht),ft=dt.resolve;return ft(mt),dt.promise}},533:function(nt,ot,st){var at=st(9482);nt.exports=function(lt,ct,ht){for(var mt in ct)ht&&ht.unsafe&&lt[mt]?lt[mt]=ct[mt]:at(lt,mt,ct[mt],ht);return lt}},9482:function(nt,ot,st){var at=st(8711);nt.exports=function(lt,ct,ht,mt){mt&&mt.enumerable?lt[ct]=ht:at(lt,ct,ht)}},3209:function(nt){nt.exports=function(ot){if(ot==null)throw TypeError("Can't call method on "+ot);return ot}},7613:function(nt,ot,st){st(8576),nt.exports=function(at,lt){try{Object.defineProperty(window,at,{value:lt,configurable:!0,writable:!0})}catch{window[at]=lt}return lt}},3656:function(nt,ot,st){var at=st(150),lt=st(2760),ct=st(8182),ht=st(69),mt=ct("species");nt.exports=function(dt){var ft=at(dt),ut=lt.f;ht&&ft&&!ft[mt]&&ut(ft,mt,{configurable:!0,get:function(){return this}})}},1284:function(nt,ot,st){var at=st(3471),lt=st(2760).f,ct=st(8711),ht=st(4500),mt=st(158),dt=st(8182),ft=dt("toStringTag");nt.exports=function(ut,pt,At,gt){if(ut){var vt=At?ut:ut.prototype;ht(vt,ft)||lt(vt,ft,{configurable:!0,value:pt}),gt&&!at&&ct(vt,"toString",mt)}}},9766:function(nt,ot,st){var at=st(8717),lt=st(2759),ct=at("keys");nt.exports=function(ht){return ct[ht]||(ct[ht]=lt(ht))}},6434:function(nt,ot,st){st(8576);var at=st(7613),lt="__core-js_shared__",ct=window[lt]||at(lt,{});nt.exports=ct},8717:function(nt,ot,st){var at=st(5546),lt=st(6434);(nt.exports=function(ct,ht){return lt[ct]||(lt[ct]=ht!==void 0?ht:{})})("versions",[]).push({version:"3.18.2",mode:at?"pure":"window",copyright:"\xA9 2021 Denis Pushkarev (zloirock.ru)"})},4743:function(nt,ot,st){var at=st(1138),lt=st(1404),ct=st(8182),ht=ct("species");nt.exports=function(mt,dt){var ft=at(mt).constructor,ut;return ft===void 0||(ut=at(ft)[ht])==null?dt:lt(ut)}},863:function(nt,ot,st){var at=st(1941),lt=st(4845),ct=st(3209),ht=function(mt){return function(dt,ft){var ut=lt(ct(dt)),pt=at(ft),At=ut.length,gt,vt;return pt<0||pt>=At?mt?"":void 0:(gt=ut.charCodeAt(pt),gt<55296||gt>56319||pt+1===At||(vt=ut.charCodeAt(pt+1))<56320||vt>57343?mt?ut.charAt(pt):gt:mt?ut.slice(pt,pt+2):(gt-55296<<10)+(vt-56320)+65536)}};nt.exports={codeAt:ht(!1),charAt:ht(!0)}},7977:function(nt){var ot=2147483647,st=36,at=1,lt=26,ct=38,ht=700,mt=72,dt=128,ft="-",ut=/[^\0-\u007E]/,pt=/[.\u3002\uFF0E\uFF61]/g,At="Overflow: input needs wider integers to process",gt=st-at,vt=Math.floor,yt=String.fromCharCode,bt=function(St){for(var Ot=[],Mt=0,jt=St.length;Mt<jt;){var Ft=St.charCodeAt(Mt++);if(Ft>=55296&&Ft<=56319&&Mt<jt){var Ut=St.charCodeAt(Mt++);(Ut&64512)==56320?Ot.push(((Ft&1023)<<10)+(Ut&1023)+65536):(Ot.push(Ft),Mt--)}else Ot.push(Ft)}return Ot},Ct=function(St){return St+22+75*(St<26)},xt=function(St,Ot,Mt){var jt=0;for(St=Mt?vt(St/ht):St>>1,St+=vt(St/Ot);St>gt*lt>>1;jt+=st)St=vt(St/gt);return vt(jt+(gt+1)*St/(St+ct))},It=function(St){var Ot=[];St=bt(St);var Mt=St.length,jt=dt,Ft=0,Ut=mt,Qt,Ht;for(Qt=0;Qt<St.length;Qt++)Ht=St[Qt],Ht<128&&Ot.push(yt(Ht));var Zt=Ot.length,Wt=Zt;for(Zt&&Ot.push(ft);Wt<Mt;){var $t=ot;for(Qt=0;Qt<St.length;Qt++)Ht=St[Qt],Ht>=jt&&Ht<$t&&($t=Ht);var Jt=Wt+1;if($t-jt>vt((ot-Ft)/Jt))throw RangeError(At);for(Ft+=($t-jt)*Jt,jt=$t,Qt=0;Qt<St.length;Qt++){if(Ht=St[Qt],Ht<jt&&++Ft>ot)throw RangeError(At);if(Ht==jt){for(var Nt=Ft,Lt=st;;Lt+=st){var Kt=Lt<=Ut?at:Lt>=Ut+lt?lt:Lt-Ut;if(Nt<Kt)break;var Pt=Nt-Kt,ln=st-Kt;Ot.push(yt(Ct(Kt+Pt%ln))),Nt=vt(Pt/ln)}Ot.push(yt(Ct(Nt))),Ut=xt(Ft,Jt,Wt==Zt),Ft=0,++Wt}}++Ft,++jt}return Ot.join("")};nt.exports=function(St){var Ot=[],Mt=St.toLowerCase().replace(pt,".").split("."),jt,Ft;for(jt=0;jt<Mt.length;jt++)Ft=Mt[jt],Ot.push(ut.test(Ft)?"xn--"+It(Ft):Ft);return Ot.join(".")}},6815:function(nt,ot,st){var at=st(2282).PROPER,lt=st(6192),ct=st(1450),ht="\u200B\x85\u180E";nt.exports=function(mt){return lt(function(){return!!ct[mt]()||ht[mt]()!==ht||at&&ct[mt].name!==mt})}},4277:function(nt,ot,st){var at=st(3209),lt=st(4845),ct=st(1450),ht="["+ct+"]",mt=RegExp("^"+ht+ht+"*"),dt=RegExp(ht+ht+"*$"),ft=function(ut){return function(pt){var At=lt(at(pt));return ut&1&&(At=At.replace(mt,"")),ut&2&&(At=At.replace(dt,"")),At}};nt.exports={start:ft(1),end:ft(2),trim:ft(3)}},7160:function(nt,ot,st){st(8576);var at=st(6447),lt=st(6192),ct=st(8043),ht=st(7403),mt=st(7449),dt=st(9536),ft=st(224),ut=window.setImmediate,pt=window.clearImmediate,At=window.process,gt=window.MessageChannel,vt=window.Dispatch,yt=0,bt={},Ct="onreadystatechange",xt,It,St,Ot;try{xt=window.location}catch{}var Mt=function(Qt){if(bt.hasOwnProperty(Qt)){var Ht=bt[Qt];delete bt[Qt],Ht()}},jt=function(Qt){return function(){Mt(Qt)}},Ft=function(Qt){Mt(Qt.data)},Ut=function(Qt){window.postMessage(String(Qt),xt.protocol+"//"+xt.host)};(!ut||!pt)&&(ut=function(Ht){for(var Zt=[],Wt=arguments.length,$t=1;Wt>$t;)Zt.push(arguments[$t++]);return bt[++yt]=function(){(at(Ht)?Ht:Function(Ht)).apply(void 0,Zt)},It(yt),yt},pt=function(Ht){delete bt[Ht]},ft?It=function(Qt){At.nextTick(jt(Qt))}:vt&&vt.now?It=function(Qt){vt.now(jt(Qt))}:gt&&!dt?(St=new gt,Ot=St.port2,St.port1.onmessage=Ft,It=ct(Ot.postMessage,Ot,1)):window.addEventListener&&at(window.postMessage)&&!window.importScripts&&xt&&xt.protocol!=="file:"&&!lt(Ut)?(It=Ut,window.addEventListener("message",Ft,!1)):Ct in mt("script")?It=function(Qt){ht.appendChild(mt("script"))[Ct]=function(){ht.removeChild(this),Mt(Qt)}}:It=function(Qt){setTimeout(jt(Qt),0)}),nt.exports={set:ut,clear:pt}},7739:function(nt,ot,st){var at=st(1941),lt=Math.max,ct=Math.min;nt.exports=function(ht,mt){var dt=at(ht);return dt<0?lt(dt+mt,0):ct(dt,mt)}},101:function(nt,ot,st){var at=st(2202),lt=st(3209);nt.exports=function(ct){return at(lt(ct))}},1941:function(nt){var ot=Math.ceil,st=Math.floor;nt.exports=function(at){var lt=+at;return lt!==lt||lt===0?0:(lt>0?st:ot)(lt)}},8445:function(nt,ot,st){var at=st(1941),lt=Math.min;nt.exports=function(ct){return ct>0?lt(at(ct),9007199254740991):0}},1795:function(nt,ot,st){var at=st(3209);nt.exports=function(lt){return Object(at(lt))}},7888:function(nt,ot,st){var at=st(5744),lt=st(3236),ct=st(5037),ht=st(380),mt=st(8182),dt=mt("toPrimitive");nt.exports=function(ft,ut){if(!at(ft)||lt(ft))return ft;var pt=ct(ft,dt),At;if(pt){if(ut===void 0&&(ut="default"),At=pt.call(ft,ut),!at(At)||lt(At))return At;throw TypeError("Can't convert object to primitive value")}return ut===void 0&&(ut="number"),ht(ft,ut)}},77:function(nt,ot,st){var at=st(7888),lt=st(3236);nt.exports=function(ct){var ht=at(ct,"string");return lt(ht)?ht:String(ht)}},3471:function(nt,ot,st){var at=st(8182),lt=at("toStringTag"),ct={};ct[lt]="z",nt.exports=String(ct)==="[object z]"},4845:function(nt,ot,st){var at=st(4696);nt.exports=function(lt){if(at(lt)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return String(lt)}},9288:function(nt){nt.exports=function(ot){try{return String(ot)}catch{return"Object"}}},2759:function(nt){var ot=0,st=Math.random();nt.exports=function(at){return"Symbol("+String(at===void 0?"":at)+")_"+(++ot+st).toString(36)}},615:function(nt,ot,st){var at=st(3045);nt.exports=at&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},9207:function(nt,ot,st){var at=st(8182);ot.f=at},8182:function(nt,ot,st){st(8576);var at=st(8717),lt=st(4500),ct=st(2759),ht=st(3045),mt=st(615),dt=at("wks"),ft=window.Symbol,ut=mt?ft:ft&&ft.withoutSetter||ct;nt.exports=function(pt){return(!lt(dt,pt)||!(ht||typeof dt[pt]=="string"))&&(ht&&lt(ft,pt)?dt[pt]=ft[pt]:dt[pt]=ut("Symbol."+pt)),dt[pt]}},1450:function(nt){nt.exports=`	
\v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF`},4242:function(nt,ot,st){var at=st(3085),lt=st(9341),ct=st(4469),ht=st(2853),mt=st(8711),dt=st(774),ft=st(273),ut=st(3442),pt=st(4845),At=function(vt,yt){var bt=this,Ct=arguments.length>2?arguments[2]:void 0;if(!(bt instanceof At))return new At(vt,yt,Ct);ct&&(bt=ct(new Error(void 0),lt(bt))),yt!==void 0&&mt(bt,"message",pt(yt)),ft(bt,Ct);var xt=[];return ut(vt,xt.push,{that:xt}),mt(bt,"errors",xt),bt};At.prototype=ht(Error.prototype,{constructor:dt(5,At),message:dt(5,""),name:dt(5,"AggregateError")}),at({window:!0},{AggregateError:At})},9106:function(nt,ot,st){var at=st(3085),lt=st(6192),ct=st(4770),ht=st(5744),mt=st(1795),dt=st(4104),ft=st(9361),ut=st(1321),pt=st(242),At=st(8182),gt=st(4218),vt=At("isConcatSpreadable"),yt=9007199254740991,bt="Maximum allowed index exceeded",Ct=gt>=51||!lt(function(){var Ot=[];return Ot[vt]=!1,Ot.concat()[0]!==Ot}),xt=pt("concat"),It=function(Ot){if(!ht(Ot))return!1;var Mt=Ot[vt];return Mt!==void 0?!!Mt:ct(Ot)},St=!Ct||!xt;at({target:"Array",proto:!0,forced:St},{concat:function(Mt){var jt=mt(this),Ft=ut(jt,0),Ut=0,Qt,Ht,Zt,Wt,$t;for(Qt=-1,Zt=arguments.length;Qt<Zt;Qt++)if($t=Qt===-1?jt:arguments[Qt],It($t)){if(Wt=dt($t),Ut+Wt>yt)throw TypeError(bt);for(Ht=0;Ht<Wt;Ht++,Ut++)Ht in $t&&ft(Ft,Ut,$t[Ht])}else{if(Ut>=yt)throw TypeError(bt);ft(Ft,Ut++,$t)}return Ft.length=Ut,Ft}})},1710:function(nt,ot,st){var at=st(3085),lt=st(2724),ct=st(7423);at({target:"Array",proto:!0},{fill:lt}),ct("fill")},3436:function(nt,ot,st){var at=st(3085),lt=st(454).filter,ct=st(242),ht=ct("filter");at({target:"Array",proto:!0,forced:!ht},{filter:function(dt){return lt(this,dt,arguments.length>1?arguments[1]:void 0)}})},9823:function(nt,ot,st){var at=st(3085),lt=st(7397);at({target:"Array",proto:!0,forced:[].forEach!=lt},{forEach:lt})},9173:function(nt,ot,st){var at=st(3085),lt=st(841),ct=st(9770),ht=!ct(function(mt){Array.from(mt)});at({target:"Array",stat:!0,forced:ht},{from:lt})},2276:function(nt,ot,st){var at=st(3085),lt=st(8180).indexOf,ct=st(424),ht=[].indexOf,mt=!!ht&&1/[1].indexOf(1,-0)<0,dt=ct("indexOf");at({target:"Array",proto:!0,forced:mt||!dt},{indexOf:function(ut){return mt?ht.apply(this,arguments)||0:lt(this,ut,arguments.length>1?arguments[1]:void 0)}})},8118:function(nt,ot,st){var at=st(3085),lt=st(4770);at({target:"Array",stat:!0},{isArray:lt})},8939:function(nt,ot,st){var at=st(101),lt=st(7423),ct=st(7771),ht=st(3326),mt=st(7218),dt="Array Iterator",ft=ht.set,ut=ht.getterFor(dt);nt.exports=mt(Array,"Array",function(pt,At){ft(this,{type:dt,target:at(pt),index:0,kind:At})},function(){var pt=ut(this),At=pt.target,gt=pt.kind,vt=pt.index++;return!At||vt>=At.length?(pt.target=void 0,{value:void 0,done:!0}):gt=="keys"?{value:vt,done:!1}:gt=="values"?{value:At[vt],done:!1}:{value:[vt,At[vt]],done:!1}},"values"),ct.Arguments=ct.Array,lt("keys"),lt("values"),lt("entries")},3838:function(nt,ot,st){var at=st(3085),lt=st(454).map,ct=st(242),ht=ct("map");at({target:"Array",proto:!0,forced:!ht},{map:function(dt){return lt(this,dt,arguments.length>1?arguments[1]:void 0)}})},5818:function(nt,ot,st){var at=st(3085),lt=st(4770),ct=st(2091),ht=st(5744),mt=st(7739),dt=st(4104),ft=st(101),ut=st(9361),pt=st(8182),At=st(242),gt=At("slice"),vt=pt("species"),yt=[].slice,bt=Math.max;at({target:"Array",proto:!0,forced:!gt},{slice:function(xt,It){var St=ft(this),Ot=dt(St),Mt=mt(xt,Ot),jt=mt(It===void 0?Ot:It,Ot),Ft,Ut,Qt;if(lt(St)&&(Ft=St.constructor,ct(Ft)&&(Ft===Array||lt(Ft.prototype))?Ft=void 0:ht(Ft)&&(Ft=Ft[vt],Ft===null&&(Ft=void 0)),Ft===Array||Ft===void 0))return yt.call(St,Mt,jt);for(Ut=new(Ft===void 0?Array:Ft)(bt(jt-Mt,0)),Qt=0;Mt<jt;Mt++,Qt++)Mt in St&&ut(Ut,Qt,St[Mt]);return Ut.length=Qt,Ut}})},2178:function(nt,ot,st){var at=st(3085),lt=st(7739),ct=st(1941),ht=st(4104),mt=st(1795),dt=st(1321),ft=st(9361),ut=st(242),pt=ut("splice"),At=Math.max,gt=Math.min,vt=9007199254740991,yt="Maximum allowed length exceeded";at({target:"Array",proto:!0,forced:!pt},{splice:function(Ct,xt){var It=mt(this),St=ht(It),Ot=lt(Ct,St),Mt=arguments.length,jt,Ft,Ut,Qt,Ht,Zt;if(Mt===0?jt=Ft=0:Mt===1?(jt=0,Ft=St-Ot):(jt=Mt-2,Ft=gt(At(ct(xt),0),St-Ot)),St+jt-Ft>vt)throw TypeError(yt);for(Ut=dt(It,Ft),Qt=0;Qt<Ft;Qt++)Ht=Ot+Qt,Ht in It&&ft(Ut,Qt,It[Ht]);if(Ut.length=Ft,jt<Ft){for(Qt=Ot;Qt<St-Ft;Qt++)Ht=Qt+Ft,Zt=Qt+jt,Ht in It?It[Zt]=It[Ht]:delete It[Zt];for(Qt=St;Qt>St-Ft+jt;Qt--)delete It[Qt-1]}else if(jt>Ft)for(Qt=St-Ft;Qt>Ot;Qt--)Ht=Qt+Ft-1,Zt=Qt+jt-1,Ht in It?It[Zt]=It[Ht]:delete It[Zt];for(Qt=0;Qt<jt;Qt++)It[Qt+Ot]=arguments[Qt+2];return It.length=St-Ft+jt,Ut}})},665:function(nt,ot,st){var at=st(3085),lt=st(6782);at({target:"Function",proto:!0},{bind:lt})},8671:function(nt,ot,st){st(8576);var at=st(1284);at(window.JSON,"JSON",!0)},8556:function(){},2666:function(nt,ot,st){var at=st(3085),lt=st(2558);at({target:"Number",stat:!0,forced:Number.parseInt!=lt},{parseInt:lt})},3113:function(nt,ot,st){var at=st(3085),lt=st(69),ct=st(2853);at({target:"Object",stat:!0,sham:!lt},{create:ct})},297:function(nt,ot,st){var at=st(3085),lt=st(69),ct=st(2760);at({target:"Object",stat:!0,forced:!lt,sham:!lt},{defineProperty:ct.f})},9234:function(nt,ot,st){var at=st(3085),lt=st(6192),ct=st(1795),ht=st(9341),mt=st(4635),dt=lt(function(){ht(1)});at({target:"Object",stat:!0,forced:dt,sham:!mt},{getPrototypeOf:function(ut){return ht(ct(ut))}})},2647:function(nt,ot,st){var at=st(3085),lt=st(1795),ct=st(7653),ht=st(6192),mt=ht(function(){ct(1)});at({target:"Object",stat:!0,forced:mt},{keys:function(ft){return ct(lt(ft))}})},3222:function(nt,ot,st){var at=st(3085),lt=st(4469);at({target:"Object",stat:!0},{setPrototypeOf:lt})},6663:function(){},4859:function(nt,ot,st){var at=st(3085),lt=st(15);at({window:!0,forced:parseFloat!=lt},{parseFloat:lt})},5706:function(nt,ot,st){var at=st(3085),lt=st(2558);at({window:!0,forced:parseInt!=lt},{parseInt:lt})},7884:function(nt,ot,st){var at=st(3085),lt=st(6235),ct=st(9438),ht=st(892),mt=st(3442);at({target:"Promise",stat:!0},{allSettled:function(ft){var ut=this,pt=ct.f(ut),At=pt.resolve,gt=pt.reject,vt=ht(function(){var yt=lt(ut.resolve),bt=[],Ct=0,xt=1;mt(ft,function(It){var St=Ct++,Ot=!1;bt.push(void 0),xt++,yt.call(ut,It).then(function(Mt){Ot||(Ot=!0,bt[St]={status:"fulfilled",value:Mt},--xt||At(bt))},function(Mt){Ot||(Ot=!0,bt[St]={status:"rejected",reason:Mt},--xt||At(bt))})}),--xt||At(bt)});return vt.error&&gt(vt.value),pt.promise}})},8885:function(nt,ot,st){var at=st(3085),lt=st(6235),ct=st(150),ht=st(9438),mt=st(892),dt=st(3442),ft="No one promise resolved";at({target:"Promise",stat:!0},{any:function(pt){var At=this,gt=ht.f(At),vt=gt.resolve,yt=gt.reject,bt=mt(function(){var Ct=lt(At.resolve),xt=[],It=0,St=1,Ot=!1;dt(pt,function(Mt){var jt=It++,Ft=!1;xt.push(void 0),St++,Ct.call(At,Mt).then(function(Ut){Ft||Ot||(Ot=!0,vt(Ut))},function(Ut){Ft||Ot||(Ft=!0,xt[jt]=Ut,--St||yt(new(ct("AggregateError"))(xt,ft)))})}),--St||yt(new(ct("AggregateError"))(xt,ft))});return bt.error&&yt(bt.value),gt.promise}})},1868:function(nt,ot,st){var at=st(3085),lt=st(5546),ct=st(4471),ht=st(6192),mt=st(150),dt=st(6447),ft=st(4743),ut=st(9126),pt=st(9482),At=!!ct&&ht(function(){ct.prototype.finally.call({then:function(){}},function(){})});if(at({target:"Promise",proto:!0,real:!0,forced:At},{finally:function(vt){var yt=ft(this,mt("Promise")),bt=dt(vt);return this.then(bt?function(Ct){return ut(yt,vt()).then(function(){return Ct})}:vt,bt?function(Ct){return ut(yt,vt()).then(function(){throw Ct})}:vt)}}),!lt&&dt(ct)){var gt=mt("Promise").prototype.finally;ct.prototype.finally!==gt&&pt(ct.prototype,"finally",gt,{unsafe:!0})}},9021:function(nt,ot,st){var at=st(3085),lt=st(5546);st(8576);var ct=st(150),ht=st(4471),mt=st(9482),dt=st(533),ft=st(4469),ut=st(1284),pt=st(3656),At=st(6235),gt=st(6447),vt=st(5744),yt=st(6961),bt=st(9516),Ct=st(3442),xt=st(9770),It=st(4743),St=st(7160).set,Ot=st(2950),Mt=st(9126),jt=st(3681),Ft=st(9438),Ut=st(892),Qt=st(3326),Ht=st(9245),Zt=st(8182),Wt=st(2957),$t=st(224),Jt=st(4218),Nt=Zt("species"),Lt="Promise",Kt=Qt.get,Pt=Qt.set,ln=Qt.getterFor(Lt),Gt=ht&&ht.prototype,on=ht,tn=Gt,_i=window.TypeError,Xt=window.document,Vt=window.process,qt=Ft.f,rn=qt,nn=!!(Xt&&Xt.createEvent&&window.dispatchEvent),cn=gt(window.PromiseRejectionEvent),un="unhandledrejection",gn="rejectionhandled",mn=0,dn=1,fn=2,sn=1,pn=2,bn=!1,An,Sn,En,Vn,Rn=Ht(Lt,function(){var On=bt(on),jn=On!==String(on);if(!jn&&Jt===66||lt&&!tn.finally)return!0;if(Jt>=51&&/native code/.test(On))return!1;var Ln=new on(function(rr){rr(1)}),Yn=function(rr){rr(function(){},function(){})},Hn=Ln.constructor={};return Hn[Nt]=Yn,bn=Ln.then(function(){})instanceof Yn,bn?!jn&&Wt&&!cn:!0}),In=Rn||!xt(function(On){on.all(On).catch(function(){})}),zn=function(On){var jn;return vt(On)&&gt(jn=On.then)?jn:!1},Tn=function(On,jn){if(!On.notified){On.notified=!0;var Ln=On.reactions;Ot(function(){for(var Yn=On.value,Hn=On.state==dn,rr=0;Ln.length>rr;){var pr=Ln[rr++],mr=Hn?pr.ok:pr.fail,xr=pr.resolve,_r=pr.reject,fr=pr.domain,gr,br,Nr;try{mr?(Hn||(On.rejection===pn&&xn(On),On.rejection=sn),mr===!0?gr=Yn:(fr&&fr.enter(),gr=mr(Yn),fr&&(fr.exit(),Nr=!0)),gr===pr.promise?_r(_i("Promise-chain cycle")):(br=zn(gr))?br.call(gr,xr,_r):xr(gr)):_r(Yn)}catch(Lr){fr&&!Nr&&fr.exit(),_r(Lr)}}On.reactions=[],On.notified=!1,jn&&!On.rejection&&Qn(On)})}},tr=function(On,jn,Ln){var Yn,Hn;nn?(Yn=Xt.createEvent("Event"),Yn.promise=jn,Yn.reason=Ln,Yn.initEvent(On,!1,!0),window.dispatchEvent(Yn)):Yn={promise:jn,reason:Ln},!cn&&(Hn=window["on"+On])?Hn(Yn):On===un&&jt("Unhandled promise rejection",Ln)},Qn=function(On){St.call(window,function(){var jn=On.facade,Ln=On.value,Yn=Bn(On),Hn;if(Yn&&(Hn=Ut(function(){$t?Vt.emit("unhandledRejection",Ln,jn):tr(un,jn,Ln)}),On.rejection=$t||Bn(On)?pn:sn,Hn.error))throw Hn.value})},Bn=function(On){return On.rejection!==sn&&!On.parent},xn=function(On){St.call(window,function(){var jn=On.facade;$t?Vt.emit("rejectionHandled",jn):tr(gn,jn,On.value)})},Wn=function(On,jn,Ln){return function(Yn){On(jn,Yn,Ln)}},qn=function(On,jn,Ln){On.done||(On.done=!0,Ln&&(On=Ln),On.value=jn,On.state=fn,Tn(On,!0))},nr=function(On,jn,Ln){if(!On.done){On.done=!0,Ln&&(On=Ln);try{if(On.facade===jn)throw _i("Promise can't be resolved itself");var Yn=zn(jn);Yn?Ot(function(){var Hn={done:!1};try{Yn.call(jn,Wn(nr,Hn,On),Wn(qn,Hn,On))}catch(rr){qn(Hn,rr,On)}}):(On.value=jn,On.state=dn,Tn(On,!1))}catch(Hn){qn({done:!1},Hn,On)}}};if(Rn&&(on=function(jn){yt(this,on,Lt),At(jn),An.call(this);var Ln=Kt(this);try{jn(Wn(nr,Ln),Wn(qn,Ln))}catch(Yn){qn(Ln,Yn)}},tn=on.prototype,An=function(jn){Pt(this,{type:Lt,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:mn,value:void 0})},An.prototype=dt(tn,{then:function(jn,Ln){var Yn=ln(this),Hn=qt(It(this,on));return Hn.ok=gt(jn)?jn:!0,Hn.fail=gt(Ln)&&Ln,Hn.domain=$t?Vt.domain:void 0,Yn.parent=!0,Yn.reactions.push(Hn),Yn.state!=mn&&Tn(Yn,!1),Hn.promise},catch:function(On){return this.then(void 0,On)}}),Sn=function(){var On=new An,jn=Kt(On);this.promise=On,this.resolve=Wn(nr,jn),this.reject=Wn(qn,jn)},Ft.f=qt=function(On){return On===on||On===En?new Sn(On):rn(On)},!lt&&gt(ht)&&Gt!==Object.prototype)){Vn=Gt.then,bn||(mt(Gt,"then",function(jn,Ln){var Yn=this;return new on(function(Hn,rr){Vn.call(Yn,Hn,rr)}).then(jn,Ln)},{unsafe:!0}),mt(Gt,"catch",tn.catch,{unsafe:!0}));try{delete Gt.constructor}catch{}ft&&ft(Gt,tn)}at({window:!0,wrap:!0,forced:Rn},{Promise:on}),ut(on,Lt,!1,!0),pt(Lt),En=ct(Lt),at({target:Lt,stat:!0,forced:Rn},{reject:function(jn){var Ln=qt(this);return Ln.reject.call(void 0,jn),Ln.promise}}),at({target:Lt,stat:!0,forced:lt||Rn},{resolve:function(jn){return Mt(lt&&this===En?on:this,jn)}}),at({target:Lt,stat:!0,forced:In},{all:function(jn){var Ln=this,Yn=qt(Ln),Hn=Yn.resolve,rr=Yn.reject,pr=Ut(function(){var mr=At(Ln.resolve),xr=[],_r=0,fr=1;Ct(jn,function(gr){var br=_r++,Nr=!1;xr.push(void 0),fr++,mr.call(Ln,gr).then(function(Lr){Nr||(Nr=!0,xr[br]=Lr,--fr||Hn(xr))},rr)}),--fr||Hn(xr)});return pr.error&&rr(pr.value),Yn.promise},race:function(jn){var Ln=this,Yn=qt(Ln),Hn=Yn.reject,rr=Ut(function(){var pr=At(Ln.resolve);Ct(jn,function(mr){pr.call(Ln,mr).then(Yn.resolve,Hn)})});return rr.error&&Hn(rr.value),Yn.promise}})},5397:function(nt,ot,st){var at=st(3085),lt=st(150),ct=st(1404),ht=st(1138),mt=st(5744),dt=st(2853),ft=st(6782),ut=st(6192),pt=lt("Reflect","construct"),At=ut(function(){function yt(){}return!(pt(function(){},[],yt)instanceof yt)}),gt=!ut(function(){pt(function(){})}),vt=At||gt;at({target:"Reflect",stat:!0,forced:vt,sham:vt},{construct:function(bt,Ct){ct(bt),ht(Ct);var xt=arguments.length<3?bt:ct(arguments[2]);if(gt&&!At)return pt(bt,Ct,xt);if(bt==xt){switch(Ct.length){case 0:return new bt;case 1:return new bt(Ct[0]);case 2:return new bt(Ct[0],Ct[1]);case 3:return new bt(Ct[0],Ct[1],Ct[2]);case 4:return new bt(Ct[0],Ct[1],Ct[2],Ct[3])}var It=[null];return It.push.apply(It,Ct),new(ft.apply(bt,It))}var St=xt.prototype,Ot=dt(mt(St)?St:Object.prototype),Mt=Function.apply.call(bt,Ot,Ct);return mt(Mt)?Mt:Ot}})},1367:function(){},5454:function(nt,ot,st){var at=st(863).charAt,lt=st(4845),ct=st(3326),ht=st(7218),mt="String Iterator",dt=ct.set,ft=ct.getterFor(mt);ht(String,"String",function(ut){dt(this,{type:mt,string:lt(ut),index:0})},function(){var pt=ft(this),At=pt.string,gt=pt.index,vt;return gt>=At.length?{value:void 0,done:!0}:(vt=at(At,gt),pt.index+=vt.length,{value:vt,done:!1})})},957:function(nt,ot,st){var at=st(3085),lt=st(4277).trim,ct=st(6815);at({target:"String",proto:!0,forced:ct("trim")},{trim:function(){return lt(this)}})},9781:function(nt,ot,st){var at=st(1488);at("asyncIterator")},492:function(){},6681:function(nt,ot,st){var at=st(1488);at("hasInstance")},9594:function(nt,ot,st){var at=st(1488);at("isConcatSpreadable")},3665:function(nt,ot,st){var at=st(1488);at("iterator")},6187:function(nt,ot,st){var at=st(3085);st(8576);var lt=st(150),ct=st(5546),ht=st(69),mt=st(3045),dt=st(6192),ft=st(4500),ut=st(4770),pt=st(6447),At=st(5744),gt=st(3236),vt=st(1138),yt=st(1795),bt=st(101),Ct=st(77),xt=st(4845),It=st(774),St=st(2853),Ot=st(7653),Mt=st(2092),jt=st(4052),Ft=st(4750),Ut=st(5141),Qt=st(2760),Ht=st(6007),Zt=st(9482),Wt=st(8717),$t=st(9766),Jt=st(4535),Nt=st(2759),Lt=st(8182),Kt=st(9207),Pt=st(1488),ln=st(1284),Gt=st(3326),on=st(454).forEach,tn=$t("hidden"),_i="Symbol",Xt="prototype",Vt=Lt("toPrimitive"),qt=Gt.set,rn=Gt.getterFor(_i),nn=Object[Xt],cn=window.Symbol,un=lt("JSON","stringify"),gn=Ut.f,mn=Qt.f,dn=jt.f,fn=Ht.f,sn=Wt("symbols"),pn=Wt("op-symbols"),bn=Wt("string-to-symbol-registry"),An=Wt("symbol-to-string-registry"),Sn=Wt("wks"),En=window.QObject,Vn=!En||!En[Xt]||!En[Xt].findChild,Rn=ht&&dt(function(){return St(mn({},"a",{get:function(){return mn(this,"a",{value:7}).a}})).a!=7})?function(On,jn,Ln){var Yn=gn(nn,jn);Yn&&delete nn[jn],mn(On,jn,Ln),Yn&&On!==nn&&mn(nn,jn,Yn)}:mn,In=function(On,jn){var Ln=sn[On]=St(cn[Xt]);return qt(Ln,{type:_i,tag:On,description:jn}),ht||(Ln.description=jn),Ln},zn=function(jn,Ln,Yn){jn===nn&&zn(pn,Ln,Yn),vt(jn);var Hn=Ct(Ln);return vt(Yn),ft(sn,Hn)?(Yn.enumerable?(ft(jn,tn)&&jn[tn][Hn]&&(jn[tn][Hn]=!1),Yn=St(Yn,{enumerable:It(0,!1)})):(ft(jn,tn)||mn(jn,tn,It(1,{})),jn[tn][Hn]=!0),Rn(jn,Hn,Yn)):mn(jn,Hn,Yn)},Tn=function(jn,Ln){vt(jn);var Yn=bt(Ln),Hn=Ot(Yn).concat(Wn(Yn));return on(Hn,function(rr){(!ht||Qn.call(Yn,rr))&&zn(jn,rr,Yn[rr])}),jn},tr=function(jn,Ln){return Ln===void 0?St(jn):Tn(St(jn),Ln)},Qn=function(jn){var Ln=Ct(jn),Yn=fn.call(this,Ln);return this===nn&&ft(sn,Ln)&&!ft(pn,Ln)?!1:Yn||!ft(this,Ln)||!ft(sn,Ln)||ft(this,tn)&&this[tn][Ln]?Yn:!0},Bn=function(jn,Ln){var Yn=bt(jn),Hn=Ct(Ln);if(!(Yn===nn&&ft(sn,Hn)&&!ft(pn,Hn))){var rr=gn(Yn,Hn);return rr&&ft(sn,Hn)&&!(ft(Yn,tn)&&Yn[tn][Hn])&&(rr.enumerable=!0),rr}},xn=function(jn){var Ln=dn(bt(jn)),Yn=[];return on(Ln,function(Hn){!ft(sn,Hn)&&!ft(Jt,Hn)&&Yn.push(Hn)}),Yn},Wn=function(jn){var Ln=jn===nn,Yn=dn(Ln?pn:bt(jn)),Hn=[];return on(Yn,function(rr){ft(sn,rr)&&(!Ln||ft(nn,rr))&&Hn.push(sn[rr])}),Hn};if(mt||(cn=function(){if(this instanceof cn)throw TypeError("Symbol is not a constructor");var jn=!arguments.length||arguments[0]===void 0?void 0:xt(arguments[0]),Ln=Nt(jn),Yn=function(Hn){this===nn&&Yn.call(pn,Hn),ft(this,tn)&&ft(this[tn],Ln)&&(this[tn][Ln]=!1),Rn(this,Ln,It(1,Hn))};return ht&&Vn&&Rn(nn,Ln,{configurable:!0,set:Yn}),In(Ln,jn)},Zt(cn[Xt],"toString",function(){return rn(this).tag}),Zt(cn,"withoutSetter",function(On){return In(Nt(On),On)}),Ht.f=Qn,Qt.f=zn,Ut.f=Bn,Mt.f=jt.f=xn,Ft.f=Wn,Kt.f=function(On){return In(Lt(On),On)},ht&&(mn(cn[Xt],"description",{configurable:!0,get:function(){return rn(this).description}}),ct||Zt(nn,"propertyIsEnumerable",Qn,{unsafe:!0}))),at({window:!0,wrap:!0,forced:!mt,sham:!mt},{Symbol:cn}),on(Ot(Sn),function(On){Pt(On)}),at({target:_i,stat:!0,forced:!mt},{for:function(On){var jn=xt(On);if(ft(bn,jn))return bn[jn];var Ln=cn(jn);return bn[jn]=Ln,An[Ln]=jn,Ln},keyFor:function(jn){if(!gt(jn))throw TypeError(jn+" is not a symbol");if(ft(An,jn))return An[jn]},useSetter:function(){Vn=!0},useSimple:function(){Vn=!1}}),at({target:"Object",stat:!0,forced:!mt,sham:!ht},{create:tr,defineProperty:zn,defineProperties:Tn,getOwnPropertyDescriptor:Bn}),at({target:"Object",stat:!0,forced:!mt},{getOwnPropertyNames:xn,getOwnPropertySymbols:Wn}),at({target:"Object",stat:!0,forced:dt(function(){Ft.f(1)})},{getOwnPropertySymbols:function(jn){return Ft.f(yt(jn))}}),un){var qn=!mt||dt(function(){var On=cn();return un([On])!="[null]"||un({a:On})!="{}"||un(Object(On))!="{}"});at({target:"JSON",stat:!0,forced:qn},{stringify:function(jn,Ln,Yn){for(var Hn=[jn],rr=1,pr;arguments.length>rr;)Hn.push(arguments[rr++]);if(pr=Ln,!(!At(Ln)&&jn===void 0||gt(jn)))return ut(Ln)||(Ln=function(mr,xr){if(pt(pr)&&(xr=pr.call(this,mr,xr)),!gt(xr))return xr}),Hn[1]=Ln,un.apply(null,Hn)}})}if(!cn[Xt][Vt]){var nr=cn[Xt].valueOf;Zt(cn[Xt],Vt,function(){return nr.apply(this,arguments)})}ln(cn,_i),Jt[tn]=!0},1250:function(nt,ot,st){var at=st(1488);at("matchAll")},9017:function(nt,ot,st){var at=st(1488);at("match")},9786:function(nt,ot,st){var at=st(1488);at("replace")},503:function(nt,ot,st){var at=st(1488);at("search")},6565:function(nt,ot,st){var at=st(1488);at("species")},9322:function(nt,ot,st){var at=st(1488);at("split")},3610:function(nt,ot,st){var at=st(1488);at("toPrimitive")},6886:function(nt,ot,st){var at=st(1488);at("toStringTag")},3514:function(nt,ot,st){var at=st(1488);at("unscopables")},177:function(nt,ot,st){var at=st(1488);at("asyncDispose")},9031:function(nt,ot,st){var at=st(1488);at("dispose")},6658:function(nt,ot,st){var at=st(1488);at("matcher")},1875:function(nt,ot,st){var at=st(1488);at("metadata")},8658:function(nt,ot,st){var at=st(1488);at("observable")},4592:function(nt,ot,st){var at=st(1488);at("patternMatch")},6680:function(nt,ot,st){var at=st(1488);at("replaceAll")},162:function(nt,ot,st){st(8939);var at=st(7365);st(8576);var lt=st(4696),ct=st(8711),ht=st(7771),mt=st(8182),dt=mt("toStringTag");for(var ft in at){var ut=window[ft],pt=ut&&ut.prototype;pt&&lt(pt)!==dt&&ct(pt,dt,ft),ht[ft]=ht.Array}},2906:function(nt,ot,st){var at=st(3085);st(8576);var lt=st(6447),ct=st(8989),ht=[].slice,mt=/MSIE .\./.test(ct),dt=function(ft){return function(ut,pt){var At=arguments.length>2,gt=At?ht.call(arguments,2):void 0;return ft(At?function(){(lt(ut)?ut:Function(ut)).apply(this,gt)}:ut,pt)}};at({window:!0,bind:!0,forced:mt},{setTimeout:dt(window.setTimeout),setInterval:dt(window.setInterval)})},9336:function(nt,ot,st){st(8939);var at=st(3085),lt=st(150),ct=st(4551),ht=st(9482),mt=st(533),dt=st(1284),ft=st(5148),ut=st(3326),pt=st(6961),At=st(6447),gt=st(4500),vt=st(8043),yt=st(4696),bt=st(1138),Ct=st(5744),xt=st(4845),It=st(2853),St=st(774),Ot=st(1669),Mt=st(8703),jt=st(8182),Ft=lt("fetch"),Ut=lt("Request"),Qt=Ut&&Ut.prototype,Ht=lt("Headers"),Zt=jt("iterator"),Wt="URLSearchParams",$t=Wt+"Iterator",Jt=ut.set,Nt=ut.getterFor(Wt),Lt=ut.getterFor($t),Kt=/\+/g,Pt=Array(4),ln=function(fn){return Pt[fn-1]||(Pt[fn-1]=RegExp("((?:%[\\da-f]{2}){"+fn+"})","gi"))},Gt=function(fn){try{return decodeURIComponent(fn)}catch{return fn}},on=function(fn){var sn=fn.replace(Kt," "),pn=4;try{return decodeURIComponent(sn)}catch{for(;pn;)sn=sn.replace(ln(pn--),Gt);return sn}},tn=/[!'()~]|%20/g,_i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Xt=function(fn){return _i[fn]},Vt=function(fn){return encodeURIComponent(fn).replace(tn,Xt)},qt=function(fn,sn){if(sn)for(var pn=sn.split("&"),bn=0,An,Sn;bn<pn.length;)An=pn[bn++],An.length&&(Sn=An.split("="),fn.push({key:on(Sn.shift()),value:on(Sn.join("="))}))},rn=function(fn){this.entries.length=0,qt(this.entries,fn)},nn=function(fn,sn){if(fn<sn)throw TypeError("Not enough arguments")},cn=ft(function(sn,pn){Jt(this,{type:$t,iterator:Ot(Nt(sn).entries),kind:pn})},"Iterator",function(){var sn=Lt(this),pn=sn.kind,bn=sn.iterator.next(),An=bn.value;return bn.done||(bn.value=pn==="keys"?An.key:pn==="values"?An.value:[An.key,An.value]),bn}),un=function(){pt(this,un,Wt);var sn=arguments.length>0?arguments[0]:void 0,pn=this,bn=[],An,Sn,En,Vn,Rn,In,zn,Tn,tr;if(Jt(pn,{type:Wt,entries:bn,updateURL:function(){},updateSearchParams:rn}),sn!==void 0)if(Ct(sn))if(An=Mt(sn),An)for(Sn=Ot(sn,An),En=Sn.next;!(Vn=En.call(Sn)).done;){if(Rn=Ot(bt(Vn.value)),In=Rn.next,(zn=In.call(Rn)).done||(Tn=In.call(Rn)).done||!In.call(Rn).done)throw TypeError("Expected sequence with length 2");bn.push({key:xt(zn.value),value:xt(Tn.value)})}else for(tr in sn)gt(sn,tr)&&bn.push({key:tr,value:xt(sn[tr])});else qt(bn,typeof sn=="string"?sn.charAt(0)==="?"?sn.slice(1):sn:xt(sn))},gn=un.prototype;if(mt(gn,{append:function(sn,pn){nn(arguments.length,2);var bn=Nt(this);bn.entries.push({key:xt(sn),value:xt(pn)}),bn.updateURL()},delete:function(fn){nn(arguments.length,1);for(var sn=Nt(this),pn=sn.entries,bn=xt(fn),An=0;An<pn.length;)pn[An].key===bn?pn.splice(An,1):An++;sn.updateURL()},get:function(sn){nn(arguments.length,1);for(var pn=Nt(this).entries,bn=xt(sn),An=0;An<pn.length;An++)if(pn[An].key===bn)return pn[An].value;return null},getAll:function(sn){nn(arguments.length,1);for(var pn=Nt(this).entries,bn=xt(sn),An=[],Sn=0;Sn<pn.length;Sn++)pn[Sn].key===bn&&An.push(pn[Sn].value);return An},has:function(sn){nn(arguments.length,1);for(var pn=Nt(this).entries,bn=xt(sn),An=0;An<pn.length;)if(pn[An++].key===bn)return!0;return!1},set:function(sn,pn){nn(arguments.length,1);for(var bn=Nt(this),An=bn.entries,Sn=!1,En=xt(sn),Vn=xt(pn),Rn=0,In;Rn<An.length;Rn++)In=An[Rn],In.key===En&&(Sn?An.splice(Rn--,1):(Sn=!0,In.value=Vn));Sn||An.push({key:En,value:Vn}),bn.updateURL()},sort:function(){var sn=Nt(this),pn=sn.entries,bn=pn.slice(),An,Sn,En;for(pn.length=0,En=0;En<bn.length;En++){for(An=bn[En],Sn=0;Sn<En;Sn++)if(pn[Sn].key>An.key){pn.splice(Sn,0,An);break}Sn===En&&pn.push(An)}sn.updateURL()},forEach:function(sn){for(var pn=Nt(this).entries,bn=vt(sn,arguments.length>1?arguments[1]:void 0,3),An=0,Sn;An<pn.length;)Sn=pn[An++],bn(Sn.value,Sn.key,this)},keys:function(){return new cn(this,"keys")},values:function(){return new cn(this,"values")},entries:function(){return new cn(this,"entries")}},{enumerable:!0}),ht(gn,Zt,gn.entries,{name:"entries"}),ht(gn,"toString",function(){for(var sn=Nt(this).entries,pn=[],bn=0,An;bn<sn.length;)An=sn[bn++],pn.push(Vt(An.key)+"="+Vt(An.value));return pn.join("&")},{enumerable:!0}),dt(un,Wt),at({window:!0,forced:!ct},{URLSearchParams:un}),!ct&&At(Ht)){var mn=function(fn){if(Ct(fn)){var sn=fn.body,pn;if(yt(sn)===Wt)return pn=fn.headers?new Ht(fn.headers):new Ht,pn.has("content-type")||pn.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),It(fn,{body:St(0,String(sn)),headers:St(0,pn)})}return fn};if(At(Ft)&&at({window:!0,enumerable:!0,forced:!0},{fetch:function(sn){return Ft(sn,arguments.length>1?mn(arguments[1]):{})}}),At(Ut)){var dn=function(sn){return pt(this,dn,"Request"),new Ut(sn,arguments.length>1?mn(arguments[1]):{})};Qt.constructor=dn,dn.prototype=Qt,at({window:!0,forced:!0},{Request:dn})}}nt.exports={URLSearchParams:un,getState:Nt}},4948:function(nt,ot,st){st(5454);var at=st(3085),lt=st(69),ct=st(4551);st(8576);var ht=st(1187),mt=st(9482),dt=st(6961),ft=st(4500),ut=st(2503),pt=st(841),At=st(863).codeAt,gt=st(7977),vt=st(4845),yt=st(1284),bt=st(9336),Ct=st(3326),xt=window.URL,It=bt.URLSearchParams,St=bt.getState,Ot=Ct.set,Mt=Ct.getterFor("URL"),jt=Math.floor,Ft=Math.pow,Ut="Invalid authority",Qt="Invalid scheme",Ht="Invalid host",Zt="Invalid port",Wt=/[A-Za-z]/,$t=/[\d+-.A-Za-z]/,Jt=/\d/,Nt=/^0x/i,Lt=/^[0-7]+$/,Kt=/^\d+$/,Pt=/^[\dA-Fa-f]+$/,ln=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Gt=/[\0\t\n\r #/:<>?@[\\\]^|]/,on=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,tn=/[\t\n\r]/g,_i,Xt=function(hn,Fn){var Mn,kn,Un;if(Fn.charAt(0)=="["){if(Fn.charAt(Fn.length-1)!="]"||(Mn=qt(Fn.slice(1,-1)),!Mn))return Ht;hn.host=Mn}else if(sn(hn)){if(Fn=gt(Fn),ln.test(Fn)||(Mn=Vt(Fn),Mn===null))return Ht;hn.host=Mn}else{if(Gt.test(Fn))return Ht;for(Mn="",kn=pt(Fn),Un=0;Un<kn.length;Un++)Mn+=dn(kn[Un],cn);hn.host=Mn}},Vt=function(hn){var Fn=hn.split("."),Mn,kn,Un,ir,$n,ar,Ar;if(Fn.length&&Fn[Fn.length-1]==""&&Fn.pop(),Mn=Fn.length,Mn>4)return hn;for(kn=[],Un=0;Un<Mn;Un++){if(ir=Fn[Un],ir=="")return hn;if($n=10,ir.length>1&&ir.charAt(0)=="0"&&($n=Nt.test(ir)?16:8,ir=ir.slice($n==8?1:2)),ir==="")ar=0;else{if(!($n==10?Kt:$n==8?Lt:Pt).test(ir))return hn;ar=parseInt(ir,$n)}kn.push(ar)}for(Un=0;Un<Mn;Un++)if(ar=kn[Un],Un==Mn-1){if(ar>=Ft(256,5-Mn))return null}else if(ar>255)return null;for(Ar=kn.pop(),Un=0;Un<kn.length;Un++)Ar+=kn[Un]*Ft(256,3-Un);return Ar},qt=function(hn){var Fn=[0,0,0,0,0,0,0,0],Mn=0,kn=null,Un=0,ir,$n,ar,Ar,hr,Er,Pn,yr=function(){return hn.charAt(Un)};if(yr()==":"){if(hn.charAt(1)!=":")return;Un+=2,Mn++,kn=Mn}for(;yr();){if(Mn==8)return;if(yr()==":"){if(kn!==null)return;Un++,Mn++,kn=Mn;continue}for(ir=$n=0;$n<4&&Pt.test(yr());)ir=ir*16+parseInt(yr(),16),Un++,$n++;if(yr()=="."){if($n==0||(Un-=$n,Mn>6))return;for(ar=0;yr();){if(Ar=null,ar>0)if(yr()=="."&&ar<4)Un++;else return;if(!Jt.test(yr()))return;for(;Jt.test(yr());){if(hr=parseInt(yr(),10),Ar===null)Ar=hr;else{if(Ar==0)return;Ar=Ar*10+hr}if(Ar>255)return;Un++}Fn[Mn]=Fn[Mn]*256+Ar,ar++,(ar==2||ar==4)&&Mn++}if(ar!=4)return;break}else if(yr()==":"){if(Un++,!yr())return}else if(yr())return;Fn[Mn++]=ir}if(kn!==null)for(Er=Mn-kn,Mn=7;Mn!=0&&Er>0;)Pn=Fn[Mn],Fn[Mn--]=Fn[kn+Er-1],Fn[kn+--Er]=Pn;else if(Mn!=8)return;return Fn},rn=function(hn){for(var Fn=null,Mn=1,kn=null,Un=0,ir=0;ir<8;ir++)hn[ir]!==0?(Un>Mn&&(Fn=kn,Mn=Un),kn=null,Un=0):(kn===null&&(kn=ir),++Un);return Un>Mn&&(Fn=kn,Mn=Un),Fn},nn=function(hn){var Fn,Mn,kn,Un;if(typeof hn=="number"){for(Fn=[],Mn=0;Mn<4;Mn++)Fn.unshift(hn%256),hn=jt(hn/256);return Fn.join(".")}else if(typeof hn=="object"){for(Fn="",kn=rn(hn),Mn=0;Mn<8;Mn++)Un&&hn[Mn]===0||(Un&&(Un=!1),kn===Mn?(Fn+=Mn?":":"::",Un=!0):(Fn+=hn[Mn].toString(16),Mn<7&&(Fn+=":")));return"["+Fn+"]"}return hn},cn={},un=ut({},cn,{" ":1,'"':1,"<":1,">":1,"`":1}),gn=ut({},un,{"#":1,"?":1,"{":1,"}":1}),mn=ut({},gn,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),dn=function(hn,Fn){var Mn=At(hn,0);return Mn>32&&Mn<127&&!ft(Fn,hn)?hn:encodeURIComponent(hn)},fn={ftp:21,file:null,http:80,https:443,ws:80,wss:443},sn=function(hn){return ft(fn,hn.scheme)},pn=function(hn){return hn.username!=""||hn.password!=""},bn=function(hn){return!hn.host||hn.cannotBeABaseURL||hn.scheme=="file"},An=function(hn,Fn){var Mn;return hn.length==2&&Wt.test(hn.charAt(0))&&((Mn=hn.charAt(1))==":"||!Fn&&Mn=="|")},Sn=function(hn){var Fn;return hn.length>1&&An(hn.slice(0,2))&&(hn.length==2||(Fn=hn.charAt(2))==="/"||Fn==="\\"||Fn==="?"||Fn==="#")},En=function(hn){var Fn=hn.path,Mn=Fn.length;Mn&&(hn.scheme!="file"||Mn!=1||!An(Fn[0],!0))&&Fn.pop()},Vn=function(hn){return hn==="."||hn.toLowerCase()==="%2e"},Rn=function(hn){return hn=hn.toLowerCase(),hn===".."||hn==="%2e."||hn===".%2e"||hn==="%2e%2e"},In={},zn={},Tn={},tr={},Qn={},Bn={},xn={},Wn={},qn={},nr={},On={},jn={},Ln={},Yn={},Hn={},rr={},pr={},mr={},xr={},_r={},fr={},gr=function(hn,Fn,Mn,kn){var Un=Mn||In,ir=0,$n="",ar=!1,Ar=!1,hr=!1,Er,Pn,yr,Dr;for(Mn||(hn.scheme="",hn.username="",hn.password="",hn.host=null,hn.port=null,hn.path=[],hn.query=null,hn.fragment=null,hn.cannotBeABaseURL=!1,Fn=Fn.replace(on,"")),Fn=Fn.replace(tn,""),Er=pt(Fn);ir<=Er.length;){switch(Pn=Er[ir],Un){case In:if(Pn&&Wt.test(Pn))$n+=Pn.toLowerCase(),Un=zn;else{if(Mn)return Qt;Un=Tn;continue}break;case zn:if(Pn&&($t.test(Pn)||Pn=="+"||Pn=="-"||Pn=="."))$n+=Pn.toLowerCase();else if(Pn==":"){if(Mn&&(sn(hn)!=ft(fn,$n)||$n=="file"&&(pn(hn)||hn.port!==null)||hn.scheme=="file"&&!hn.host))return;if(hn.scheme=$n,Mn){sn(hn)&&fn[hn.scheme]==hn.port&&(hn.port=null);return}$n="",hn.scheme=="file"?Un=Yn:sn(hn)&&kn&&kn.scheme==hn.scheme?Un=tr:sn(hn)?Un=Wn:Er[ir+1]=="/"?(Un=Qn,ir++):(hn.cannotBeABaseURL=!0,hn.path.push(""),Un=xr)}else{if(Mn)return Qt;$n="",Un=Tn,ir=0;continue}break;case Tn:if(!kn||kn.cannotBeABaseURL&&Pn!="#")return Qt;if(kn.cannotBeABaseURL&&Pn=="#"){hn.scheme=kn.scheme,hn.path=kn.path.slice(),hn.query=kn.query,hn.fragment="",hn.cannotBeABaseURL=!0,Un=fr;break}Un=kn.scheme=="file"?Yn:Bn;continue;case tr:if(Pn=="/"&&Er[ir+1]=="/")Un=qn,ir++;else{Un=Bn;continue}break;case Qn:if(Pn=="/"){Un=nr;break}else{Un=mr;continue}case Bn:if(hn.scheme=kn.scheme,Pn==_i)hn.username=kn.username,hn.password=kn.password,hn.host=kn.host,hn.port=kn.port,hn.path=kn.path.slice(),hn.query=kn.query;else if(Pn=="/"||Pn=="\\"&&sn(hn))Un=xn;else if(Pn=="?")hn.username=kn.username,hn.password=kn.password,hn.host=kn.host,hn.port=kn.port,hn.path=kn.path.slice(),hn.query="",Un=_r;else if(Pn=="#")hn.username=kn.username,hn.password=kn.password,hn.host=kn.host,hn.port=kn.port,hn.path=kn.path.slice(),hn.query=kn.query,hn.fragment="",Un=fr;else{hn.username=kn.username,hn.password=kn.password,hn.host=kn.host,hn.port=kn.port,hn.path=kn.path.slice(),hn.path.pop(),Un=mr;continue}break;case xn:if(sn(hn)&&(Pn=="/"||Pn=="\\"))Un=qn;else if(Pn=="/")Un=nr;else{hn.username=kn.username,hn.password=kn.password,hn.host=kn.host,hn.port=kn.port,Un=mr;continue}break;case Wn:if(Un=qn,Pn!="/"||$n.charAt(ir+1)!="/")continue;ir++;break;case qn:if(Pn!="/"&&Pn!="\\"){Un=nr;continue}break;case nr:if(Pn=="@"){ar&&($n="%40"+$n),ar=!0,yr=pt($n);for(var ga=0;ga<yr.length;ga++){var cs=yr[ga];if(cs==":"&&!hr){hr=!0;continue}var us=dn(cs,mn);hr?hn.password+=us:hn.username+=us}$n=""}else if(Pn==_i||Pn=="/"||Pn=="?"||Pn=="#"||Pn=="\\"&&sn(hn)){if(ar&&$n=="")return Ut;ir-=pt($n).length+1,$n="",Un=On}else $n+=Pn;break;case On:case jn:if(Mn&&hn.scheme=="file"){Un=rr;continue}else if(Pn==":"&&!Ar){if($n=="")return Ht;if(Dr=Xt(hn,$n),Dr)return Dr;if($n="",Un=Ln,Mn==jn)return}else if(Pn==_i||Pn=="/"||Pn=="?"||Pn=="#"||Pn=="\\"&&sn(hn)){if(sn(hn)&&$n=="")return Ht;if(Mn&&$n==""&&(pn(hn)||hn.port!==null))return;if(Dr=Xt(hn,$n),Dr)return Dr;if($n="",Un=pr,Mn)return;continue}else Pn=="["?Ar=!0:Pn=="]"&&(Ar=!1),$n+=Pn;break;case Ln:if(Jt.test(Pn))$n+=Pn;else if(Pn==_i||Pn=="/"||Pn=="?"||Pn=="#"||Pn=="\\"&&sn(hn)||Mn){if($n!=""){var va=parseInt($n,10);if(va>65535)return Zt;hn.port=sn(hn)&&va===fn[hn.scheme]?null:va,$n=""}if(Mn)return;Un=pr;continue}else return Zt;break;case Yn:if(hn.scheme="file",Pn=="/"||Pn=="\\")Un=Hn;else if(kn&&kn.scheme=="file")if(Pn==_i)hn.host=kn.host,hn.path=kn.path.slice(),hn.query=kn.query;else if(Pn=="?")hn.host=kn.host,hn.path=kn.path.slice(),hn.query="",Un=_r;else if(Pn=="#")hn.host=kn.host,hn.path=kn.path.slice(),hn.query=kn.query,hn.fragment="",Un=fr;else{Sn(Er.slice(ir).join(""))||(hn.host=kn.host,hn.path=kn.path.slice(),En(hn)),Un=mr;continue}else{Un=mr;continue}break;case Hn:if(Pn=="/"||Pn=="\\"){Un=rr;break}kn&&kn.scheme=="file"&&!Sn(Er.slice(ir).join(""))&&(An(kn.path[0],!0)?hn.path.push(kn.path[0]):hn.host=kn.host),Un=mr;continue;case rr:if(Pn==_i||Pn=="/"||Pn=="\\"||Pn=="?"||Pn=="#"){if(!Mn&&An($n))Un=mr;else if($n==""){if(hn.host="",Mn)return;Un=pr}else{if(Dr=Xt(hn,$n),Dr)return Dr;if(hn.host=="localhost"&&(hn.host=""),Mn)return;$n="",Un=pr}continue}else $n+=Pn;break;case pr:if(sn(hn)){if(Un=mr,Pn!="/"&&Pn!="\\")continue}else if(!Mn&&Pn=="?")hn.query="",Un=_r;else if(!Mn&&Pn=="#")hn.fragment="",Un=fr;else if(Pn!=_i&&(Un=mr,Pn!="/"))continue;break;case mr:if(Pn==_i||Pn=="/"||Pn=="\\"&&sn(hn)||!Mn&&(Pn=="?"||Pn=="#")){if(Rn($n)?(En(hn),Pn!="/"&&!(Pn=="\\"&&sn(hn))&&hn.path.push("")):Vn($n)?Pn!="/"&&!(Pn=="\\"&&sn(hn))&&hn.path.push(""):(hn.scheme=="file"&&!hn.path.length&&An($n)&&(hn.host&&(hn.host=""),$n=$n.charAt(0)+":"),hn.path.push($n)),$n="",hn.scheme=="file"&&(Pn==_i||Pn=="?"||Pn=="#"))for(;hn.path.length>1&&hn.path[0]==="";)hn.path.shift();Pn=="?"?(hn.query="",Un=_r):Pn=="#"&&(hn.fragment="",Un=fr)}else $n+=dn(Pn,gn);break;case xr:Pn=="?"?(hn.query="",Un=_r):Pn=="#"?(hn.fragment="",Un=fr):Pn!=_i&&(hn.path[0]+=dn(Pn,cn));break;case _r:!Mn&&Pn=="#"?(hn.fragment="",Un=fr):Pn!=_i&&(Pn=="'"&&sn(hn)?hn.query+="%27":Pn=="#"?hn.query+="%23":hn.query+=dn(Pn,cn));break;case fr:Pn!=_i&&(hn.fragment+=dn(Pn,un));break}ir++}},br=function(Fn){var Mn=dt(this,br,"URL"),kn=arguments.length>1?arguments[1]:void 0,Un=vt(Fn),ir=Ot(Mn,{type:"URL"}),$n,ar;if(kn!==void 0){if(kn instanceof br)$n=Mt(kn);else if(ar=gr($n={},vt(kn)),ar)throw TypeError(ar)}if(ar=gr(ir,Un,null,$n),ar)throw TypeError(ar);var Ar=ir.searchParams=new It,hr=St(Ar);hr.updateSearchParams(ir.query),hr.updateURL=function(){ir.query=String(Ar)||null},lt||(Mn.href=Lr.call(Mn),Mn.origin=rs.call(Mn),Mn.protocol=as.call(Mn),Mn.username=$r.call(Mn),Mn.password=Jr.call(Mn),Mn.host=Cr.call(Mn),Mn.hostname=Kr.call(Mn),Mn.port=Zr.call(Mn),Mn.pathname=Sr.call(Mn),Mn.search=qr.call(Mn),Mn.searchParams=Wr.call(Mn),Mn.hash=ss.call(Mn))},Nr=br.prototype,Lr=function(){var hn=Mt(this),Fn=hn.scheme,Mn=hn.username,kn=hn.password,Un=hn.host,ir=hn.port,$n=hn.path,ar=hn.query,Ar=hn.fragment,hr=Fn+":";return Un!==null?(hr+="//",pn(hn)&&(hr+=Mn+(kn?":"+kn:"")+"@"),hr+=nn(Un),ir!==null&&(hr+=":"+ir)):Fn=="file"&&(hr+="//"),hr+=hn.cannotBeABaseURL?$n[0]:$n.length?"/"+$n.join("/"):"",ar!==null&&(hr+="?"+ar),Ar!==null&&(hr+="#"+Ar),hr},rs=function(){var hn=Mt(this),Fn=hn.scheme,Mn=hn.port;if(Fn=="blob")try{return new br(Fn.path[0]).origin}catch{return"null"}return Fn=="file"||!sn(hn)?"null":Fn+"://"+nn(hn.host)+(Mn!==null?":"+Mn:"")},as=function(){return Mt(this).scheme+":"},$r=function(){return Mt(this).username},Jr=function(){return Mt(this).password},Cr=function(){var hn=Mt(this),Fn=hn.host,Mn=hn.port;return Fn===null?"":Mn===null?nn(Fn):nn(Fn)+":"+Mn},Kr=function(){var hn=Mt(this).host;return hn===null?"":nn(hn)},Zr=function(){var hn=Mt(this).port;return hn===null?"":String(hn)},Sr=function(){var hn=Mt(this),Fn=hn.path;return hn.cannotBeABaseURL?Fn[0]:Fn.length?"/"+Fn.join("/"):""},qr=function(){var hn=Mt(this).query;return hn?"?"+hn:""},Wr=function(){return Mt(this).searchParams},ss=function(){var hn=Mt(this).fragment;return hn?"#"+hn:""},Ir=function(hn,Fn){return{get:hn,set:Fn,configurable:!0,enumerable:!0}};if(lt&&ht(Nr,{href:Ir(Lr,function(hn){var Fn=Mt(this),Mn=vt(hn),kn=gr(Fn,Mn);if(kn)throw TypeError(kn);St(Fn.searchParams).updateSearchParams(Fn.query)}),origin:Ir(rs),protocol:Ir(as,function(hn){var Fn=Mt(this);gr(Fn,vt(hn)+":",In)}),username:Ir($r,function(hn){var Fn=Mt(this),Mn=pt(vt(hn));if(!bn(Fn)){Fn.username="";for(var kn=0;kn<Mn.length;kn++)Fn.username+=dn(Mn[kn],mn)}}),password:Ir(Jr,function(hn){var Fn=Mt(this),Mn=pt(vt(hn));if(!bn(Fn)){Fn.password="";for(var kn=0;kn<Mn.length;kn++)Fn.password+=dn(Mn[kn],mn)}}),host:Ir(Cr,function(hn){var Fn=Mt(this);Fn.cannotBeABaseURL||gr(Fn,vt(hn),On)}),hostname:Ir(Kr,function(hn){var Fn=Mt(this);Fn.cannotBeABaseURL||gr(Fn,vt(hn),jn)}),port:Ir(Zr,function(hn){var Fn=Mt(this);bn(Fn)||(hn=vt(hn),hn==""?Fn.port=null:gr(Fn,hn,Ln))}),pathname:Ir(Sr,function(hn){var Fn=Mt(this);Fn.cannotBeABaseURL||(Fn.path=[],gr(Fn,vt(hn),pr))}),search:Ir(qr,function(hn){var Fn=Mt(this);hn=vt(hn),hn==""?Fn.query=null:(hn.charAt(0)=="?"&&(hn=hn.slice(1)),Fn.query="",gr(Fn,hn,_r)),St(Fn.searchParams).updateSearchParams(Fn.query)}),searchParams:Ir(Wr),hash:Ir(ss,function(hn){var Fn=Mt(this);if(hn=vt(hn),hn==""){Fn.fragment=null;return}hn.charAt(0)=="#"&&(hn=hn.slice(1)),Fn.fragment="",gr(Fn,hn,fr)})}),mt(Nr,"toJSON",function(){return Lr.call(this)},{enumerable:!0}),mt(Nr,"toString",function(){return Lr.call(this)},{enumerable:!0}),xt){var os=xt.createObjectURL,ls=xt.revokeObjectURL;os&&mt(br,"createObjectURL",function(Fn){return os.apply(xt,arguments)}),ls&&mt(br,"revokeObjectURL",function(Fn){return ls.apply(xt,arguments)})}yt(br,"URL"),at({window:!0,forced:!ct,sham:!lt},{URL:br})},9801:function(){},3822:function(nt,ot,st){var at=st(2221);nt.exports=at},1434:function(nt,ot,st){var at=st(5078);nt.exports=at},6899:function(nt,ot,st){var at=st(98);nt.exports=at},7710:function(nt,ot,st){var at=st(5739);st(162),nt.exports=at},4486:function(nt,ot,st){var at=st(278);nt.exports=at},4877:function(nt,ot,st){var at=st(1484);nt.exports=at},7178:function(nt,ot,st){var at=st(7731);nt.exports=at},5603:function(nt,ot,st){var at=st(3669);nt.exports=at},1206:function(nt,ot,st){st(162);var at=st(6899),lt=st(4696),ct=Array.prototype,ht={DOMTokenList:!0,NodeList:!0};nt.exports=function(mt){var dt=mt.forEach;return mt===ct||mt instanceof Array&&dt===ct.forEach||ht.hasOwnProperty(lt(mt))?at:dt}},6174:function(nt,ot,st){var at=st(2604);nt.exports=at},57:function(nt,ot,st){var at=st(263);nt.exports=at},4741:function(nt,ot,st){var at=st(7663);nt.exports=at},8368:function(nt,ot,st){var at=st(5063);nt.exports=at},3739:function(nt,ot,st){var at=st(6813);nt.exports=at},172:function(nt,ot,st){var at=st(6285);nt.exports=at},4963:function(nt,ot,st){var at=st(3213);nt.exports=at},7820:function(nt,ot,st){var at=st(3512);nt.exports=at},8980:function(nt,ot,st){var at=st(8168);nt.exports=at},5636:function(nt,ot,st){var at=st(8651);nt.exports=at},6672:function(nt,ot,st){var at=st(3083);nt.exports=at},5059:function(nt,ot,st){var at=st(2987);nt.exports=at},3969:function(nt,ot,st){var at=st(2239);nt.exports=at},6618:function(nt,ot,st){var at=st(3154);st(162),nt.exports=at},5279:function(nt,ot,st){var at=st(6577);nt.exports=at},9562:function(nt,ot,st){st(2906);var at=st(7545);nt.exports=at.setTimeout},2285:function(nt,ot,st){var at=st(5008);st(162),nt.exports=at},8535:function(nt,ot,st){var at=st(994);st(162),nt.exports=at},652:function(nt,ot,st){var at=st(5668);nt.exports=at},5668:function(nt,ot,st){st(4948),st(9801),st(9336);var at=st(7545);nt.exports=at.URL},2534:function(nt){nt.exports="data:image/svg+xml;base64, "},624:function(nt){nt.exports=_},4858:function(nt){nt.exports=_e},4960:function(){},6759:function(){},6272:function(){}},it={};function tt(nt){var ot=it[nt];if(ot!==void 0)return ot.exports;var st=it[nt]={exports:{}};return et[nt](st,st.exports,tt),st.exports}(function(){tt.n=function(nt){var ot=nt&&nt.__esModule?function(){return nt.default}:function(){return nt};return tt.d(ot,{a:ot}),ot}})(),function(){tt.d=function(nt,ot){for(var st in ot)tt.o(ot,st)&&!tt.o(nt,st)&&Object.defineProperty(nt,st,{enumerable:!0,get:ot[st]})}}(),function(){tt.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}()}(),function(){tt.o=function(nt,ot){return Object.prototype.hasOwnProperty.call(nt,ot)}}();var rt={};return function(){tt.d(rt,{default:function(){return Dv}});var nt=tt(9131),ot=tt.n(nt),st=tt(1899),at=tt.n(st),lt=tt(6562),ct=tt.n(lt),ht=tt(1734),mt=tt.n(ht),dt=tt(8005),ft=tt.n(dt),ut=tt(6065),pt=tt.n(ut),At=tt(4496),gt=tt.n(At);Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(Rt){var Bt=this;do{if(Element.prototype.matches.call(Bt,Rt))return Bt;Bt=Bt.parentElement||Bt.parentNode}while(Bt!==null&&Bt.nodeType===1);return null});/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */"document"in self&&((!("classList"in document.createElement("_"))||document.createElementNS&&!("classList"in document.createElementNS("http://www.w3.org/2000/svg","g")))&&function(Rt){if("Element"in Rt){var Bt="classList",_t="prototype",Et=Rt.Element[_t],wt=Object,Tt=ot()(String[_t])||function(){return this.replace(/^\s+|\s+$/g,"")},Dt=at()(Array[_t])||function(yn){for(var Cn=0,wn=this.length;Cn<wn;Cn++)if(Cn in this&&this[Cn]===yn)return Cn;return-1},kt=function(Cn,wn){this.name=Cn,this.code=DOMException[Cn],this.message=wn},Yt=function(Cn,wn){if(wn==="")throw new kt("SYNTAX_ERR","The token must not be empty.");if(/\s/.test(wn))throw new kt("INVALID_CHARACTER_ERR","The token must not contain space characters.");return Dt.call(Cn,wn)},zt=function(Cn){for(var wn=Tt.call(Cn.getAttribute("class")||""),_n=wn?wn.split(/\s+/):[],Nn=0,Kn=_n.length;Nn<Kn;Nn++)this.push(_n[Nn]);this._updateClassName=function(){Cn.setAttribute("class",this.toString())}},en=zt[_t]=[],an=function(){return new zt(this)};if(kt[_t]=Error[_t],en.item=function(yn){return this[yn]||null},en.contains=function(yn){return~Yt(this,yn+"")},en.add=function(){var yn=arguments,Cn=0,wn=yn.length,_n,Nn=!1;do _n=yn[Cn]+"",~Yt(this,_n)||(this.push(_n),Nn=!0);while(++Cn<wn);Nn&&this._updateClassName()},en.remove=function(){var yn=arguments,Cn=0,wn=yn.length,_n,Nn=!1,Kn;do for(_n=yn[Cn]+"",Kn=Yt(this,_n);~Kn;){var Zn;ct()(Zn=this).call(Zn,Kn,1),Nn=!0,Kn=Yt(this,_n)}while(++Cn<wn);Nn&&this._updateClassName()},en.toggle=function(yn,Cn){var wn=this.contains(yn),_n=wn?Cn!==!0&&"remove":Cn!==!1&&"add";return _n&&this[_n](yn),Cn===!0||Cn===!1?Cn:!wn},en.replace=function(yn,Cn){var wn=Yt(yn+"");if(~wn){var _n;ct()(_n=this).call(_n,wn,1,Cn),this._updateClassName()}},en.toString=function(){return this.join(" ")},mt()){var vn={get:an,enumerable:!0,configurable:!0};try{mt()(Et,Bt,vn)}catch(yn){(yn.number===void 0||yn.number===-2146823252)&&(vn.enumerable=!1,mt()(Et,Bt,vn))}}else wt[_t].__defineGetter__&&Et.__defineGetter__(Bt,an)}}(self),function(){var Rt=document.createElement("_");if(Rt.classList.add("c1","c2"),!Rt.classList.contains("c2")){var Bt=function(wt){var Tt=DOMTokenList.prototype[wt];DOMTokenList.prototype[wt]=function(Dt){var kt,Yt=arguments.length;for(kt=0;kt<Yt;kt++)Dt=arguments[kt],Tt.call(this,Dt)}};Bt("add"),Bt("remove")}if(Rt.classList.toggle("c3",!1),Rt.classList.contains("c3")){var _t=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(Et,wt){return 1 in arguments&&!this.contains(Et)==!wt?wt:_t.call(this,Et)}}"replace"in document.createElement("_").classList||(DOMTokenList.prototype.replace=function(Et,wt){var Tt=this.toString().split(" "),Dt=at()(Tt).call(Tt,Et+"");~Dt&&(Tt=ft()(Tt).call(Tt,Dt),this.remove.apply(this,Tt),this.add(wt),this.add.apply(this,ft()(Tt).call(Tt,1)))}),Rt=null}());/*!
 * @copyright Copyright (c) 2017 IcoMoon.io
 * @license   Licensed under MIT license
 *            See https://github.com/Keyamoon/svgxuse
 * @version   1.2.6
 */(function(){if(typeof window!="undefined"&&window.addEventListener){var Rt=pt()(null),Bt,_t,Et=function(){clearTimeout(_t),_t=gt()(Bt,100)},wt=function(){},Tt=function(){var en;window.addEventListener("resize",Et,!1),window.addEventListener("orientationchange",Et,!1),window.MutationObserver?(en=new MutationObserver(Et),en.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),wt=function(){try{en.disconnect(),window.removeEventListener("resize",Et,!1),window.removeEventListener("orientationchange",Et,!1)}catch{}}):(document.documentElement.addEventListener("DOMSubtreeModified",Et,!1),wt=function(){document.documentElement.removeEventListener("DOMSubtreeModified",Et,!1),window.removeEventListener("resize",Et,!1),window.removeEventListener("orientationchange",Et,!1)})},Dt=function(en){function an(wn){var _n;return wn.protocol!==void 0?_n=wn:(_n=document.createElement("a"),_n.href=wn),_n.protocol.replace(/:/g,"")+_n.host}var vn,yn,Cn;return window.XMLHttpRequest&&(vn=new XMLHttpRequest,yn=an(location),Cn=an(en),vn.withCredentials===void 0&&Cn!==""&&Cn!==yn?vn=XDomainRequest||void 0:vn=XMLHttpRequest),vn},kt="http://www.w3.org/1999/xlink";Bt=function(){var en,an,vn,yn,Cn,wn=0,_n,Nn,Kn,Zn,er;function Gn(){wn-=1,wn===0&&(wt(),Tt())}function ur(vr){return function(){Rt[vr.base]!==!0&&(vr.useEl.setAttributeNS(kt,"xlink:href","#"+vr.hash),vr.useEl.hasAttribute("href")&&vr.useEl.setAttribute("href","#"+vr.hash))}}function wr(vr){return function(){var kr=document.body,Vr=document.createElement("x"),Mr;vr.onload=null,Vr.innerHTML=vr.responseText,Mr=Vr.getElementsByTagName("svg")[0],Mr&&(Mr.setAttribute("aria-hidden","true"),Mr.style.position="absolute",Mr.style.width=0,Mr.style.height=0,Mr.style.overflow="hidden",kr.insertBefore(Mr,kr.firstChild)),Gn()}}function Br(vr){return function(){vr.onerror=null,vr.ontimeout=null,Gn()}}for(wt(),Zn=document.getElementsByTagName("use"),Cn=0;Cn<Zn.length;Cn+=1){try{an=Zn[Cn].getBoundingClientRect()}catch{an=!1}yn=Zn[Cn].getAttribute("href")||Zn[Cn].getAttributeNS(kt,"href")||Zn[Cn].getAttribute("xlink:href"),yn&&yn.split?Kn=yn.split("#"):Kn=["",""],en=Kn[0],vn=Kn[1],_n=an&&an.left===0&&an.right===0&&an.top===0&&an.bottom===0,an&&an.width===0&&an.height===0&&!_n?(Zn[Cn].hasAttribute("href")&&Zn[Cn].setAttributeNS(kt,"xlink:href",yn),en.length&&(er=Rt[en],er!==!0&&gt()(ur({useEl:Zn[Cn],base:en,hash:vn}),0),er===void 0&&(Nn=Dt(en),Nn!==void 0&&(er=new Nn,Rt[en]=er,er.onload=wr(er),er.onerror=Br(er),er.ontimeout=Br(er),er.open("GET",en),er.send(),wn+=1)))):_n?en.length&&Rt[en]&&gt()(ur({useEl:Zn[Cn],base:en,hash:vn}),0):Rt[en]===void 0?Rt[en]=!0:Rt[en].onload&&(Rt[en].abort(),delete Rt[en].onload,Rt[en]=!0)}Zn="",wn+=1,Gn()};var Yt;Yt=function(){window.removeEventListener("load",Yt,!1),_t=gt()(Bt,0)},document.readyState!=="complete"?window.addEventListener("load",Yt,!1):Yt()}})();var vt=tt(1845);function yt(Rt,Bt){(Bt==null||Bt>Rt.length)&&(Bt=Rt.length);for(var _t=0,Et=new Array(Bt);_t<Bt;_t++)Et[_t]=Rt[_t];return Et}function bt(Rt){if(vt(Rt))return yt(Rt)}var Ct=tt(184),xt=tt(662),It=tt(7172);function St(Rt){if(typeof Ct!="undefined"&&xt(Rt)!=null||Rt["@@iterator"]!=null)return It(Rt)}var Ot=tt(711);function Mt(Rt,Bt){var _t;if(!!Rt){if(typeof Rt=="string")return yt(Rt,Bt);var Et=Ot(_t=Object.prototype.toString.call(Rt)).call(_t,8,-1);if(Et==="Object"&&Rt.constructor&&(Et=Rt.constructor.name),Et==="Map"||Et==="Set")return It(Rt);if(Et==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Et))return yt(Rt,Bt)}}function jt(){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 Ft(Rt){return bt(Rt)||St(Rt)||Mt(Rt)||jt()}var Ut=tt(7077);function Qt(Rt,Bt,_t){return Bt in Rt?Ut(Rt,Bt,{value:_t,enumerable:!0,configurable:!0,writable:!0}):Rt[Bt]=_t,Rt}function Ht(Rt,Bt){if(!(Rt instanceof Bt))throw new TypeError("Cannot call a class as a function")}function Zt(Rt,Bt){for(var _t=0;_t<Bt.length;_t++){var Et=Bt[_t];Et.enumerable=Et.enumerable||!1,Et.configurable=!0,"value"in Et&&(Et.writable=!0),Ut(Rt,Et.key,Et)}}function Wt(Rt,Bt,_t){return Bt&&Zt(Rt.prototype,Bt),_t&&Zt(Rt,_t),Rt}var $t=tt(7636),Jt=tt.n($t),Nt=tt(4426),Lt=tt.n(Nt),Kt=tt(9406),Pt=tt.n(Kt),ln=tt(8189),Gt=tt.n(ln),on=tt(3972),tn=tt.n(on),_i=tt(624),Xt=tt.n(_i),Vt=tt(2777),qt=tt(2461),rn=tt.n(qt);function nn(Rt){if(vt(Rt))return Rt}function cn(Rt,Bt){var _t=Rt==null?null:typeof Ct!="undefined"&&xt(Rt)||Rt["@@iterator"];if(_t!=null){var Et=[],wt=!0,Tt=!1,Dt,kt;try{for(_t=_t.call(Rt);!(wt=(Dt=_t.next()).done)&&(Et.push(Dt.value),!(Bt&&Et.length===Bt));wt=!0);}catch(Yt){Tt=!0,kt=Yt}finally{try{!wt&&_t.return!=null&&_t.return()}finally{if(Tt)throw kt}}return Et}}function un(){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 gn(Rt,Bt){return nn(Rt)||cn(Rt,Bt)||Mt(Rt,Bt)||un()}var mn=tt(6397),dn=tt.n(mn),fn=tt(789),sn=tt.n(fn),pn,bn=["zoomIn","zoomOut","hand"],An=["history","undo","redo","reset"],Sn=["delete","deleteAll"],En=Pt()(pn=[]).call(pn,bn,An,Sn),Vn={FILTER:"filter",COLOR:"color"},Rn=["rect","circle","triangle"],In={CROPZONE:"cropzone"},zn={VINTAGE:"vintage",SEPIA2:"sepia2",REMOVE_COLOR:"removeColor",COLOR_FILTER:"colorFilter",REMOVE_WHITE:"removeWhite",BLEND_COLOR:"blendColor",BLEND:"blend"},Tn=Kr("IMAGE_LOADER","CROPPER","FLIP","ROTATION","FREE_DRAWING","LINE","TEXT","ICON","FILTER","SHAPE","ZOOM","RESIZE"),tr={lockSkewingX:!0,lockSkewingY:!0,bringForward:!0,isRegular:!1},Qn={hasRotatingPoint:!1,hasBorders:!1,lockScalingFlip:!0,lockRotation:!0,lockSkewingX:!0,lockSkewingY:!0},Bn={CLEAR_OBJECTS:"clearObjects",LOAD_IMAGE:"loadImage",FLIP_IMAGE:"flip",ROTATE_IMAGE:"rotate",ADD_OBJECT:"addObject",REMOVE_OBJECT:"removeObject",APPLY_FILTER:"applyFilter",REMOVE_FILTER:"removeFilter",ADD_ICON:"addIcon",CHANGE_ICON_COLOR:"changeIconColor",ADD_SHAPE:"addShape",CHANGE_SHAPE:"changeShape",ADD_TEXT:"addText",CHANGE_TEXT:"changeText",CHANGE_TEXT_STYLE:"changeTextStyle",ADD_IMAGE_OBJECT:"addImageObject",RESIZE_CANVAS_DIMENSION:"resizeCanvasDimension",SET_OBJECT_PROPERTIES:"setObjectProperties",SET_OBJECT_POSITION:"setObjectPosition",CHANGE_SELECTION:"changeSelection",RESIZE_IMAGE:"resize"},xn={OBJECT_ACTIVATED:"objectActivated",OBJECT_MOVED:"objectMoved",OBJECT_SCALED:"objectScaled",OBJECT_CREATED:"objectCreated",OBJECT_ROTATED:"objectRotated",OBJECT_ADDED:"objectAdded",OBJECT_MODIFIED:"objectModified",TEXT_EDITING:"textEditing",TEXT_CHANGED:"textChanged",ICON_CREATE_RESIZE:"iconCreateResize",ICON_CREATE_END:"iconCreateEnd",ADD_TEXT:"addText",ADD_OBJECT:"addObject",ADD_OBJECT_AFTER:"addObjectAfter",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_MOVE:"mousemove",REDO_STACK_CHANGED:"redoStackChanged",UNDO_STACK_CHANGED:"undoStackChanged",SELECTION_CLEARED:"selectionCleared",SELECTION_CREATED:"selectionCreated",EXECUTE_COMMAND:"executeCommand",AFTER_UNDO:"afterUndo",AFTER_REDO:"afterRedo",ZOOM_CHANGED:"zoomChanged",HAND_STARTED:"handStarted",HAND_STOPPED:"handStopped",KEY_DOWN:"keydown",KEY_UP:"keyup",INPUT_BOX_EDITING_STARTED:"inputBoxEditingStarted",INPUT_BOX_EDITING_STOPPED:"inputBoxEditingStopped",FOCUS:"focus",BLUR:"blur",IMAGE_RESIZED:"imageResized"},Wn={COLOR_PICKER_INPUT_BOX:".tui-colorpicker-palette-hex"},qn={LOAD_IMAGE:"Load",LOAD_MASK_IMAGE:"Mask",ADD_MASK_IMAGE:"Mask",ADD_IMAGE_OBJECT:"Mask",CROP:"Crop",RESIZE:"Resize",APPLY_FILTER:"Filter",REMOVE_FILTER:"Filter",CHANGE_SHAPE:"Shape",CHANGE_ICON_COLOR:"Icon",ADD_TEXT:"Text",CHANGE_TEXT_STYLE:"Text",REMOVE_OBJECT:"Delete",CLEAR_OBJECTS:"Delete"},nr=Kr("NORMAL","CROPPER","FREE_DRAWING","LINE_DRAWING","TEXT","SHAPE","ICON","ZOOM","RESIZE"),On={TEXT:"text",CROP:"crop",RESIZE:"resize",SHAPE:"shape",ZOOM:"zoom"},jn={DEFAULT:"normal",ZOOM:"zoom",HAND:"hand"},Ln={Z:90,Y:89,C:67,V:86,SHIFT:16,BACKSPACE:8,DEL:46,ARROW_DOWN:40,ARROW_UP:38,SPACE:32},Yn={SELECTION_STYLE:{borderColor:"red",cornerColor:"green",cornerSize:10,originX:"center",originY:"center",transparentCorners:!1}},Hn={addedObject:"The object is already added.",flip:"The flipX and flipY setting values are not changed.",invalidDrawingMode:"This operation is not supported in the drawing mode.",invalidParameters:"Invalid parameters.",isLock:"The executing command state is locked.",loadImage:"The background image is empty.",loadingImageFailed:"Invalid image loaded.",noActiveObject:"There is no active object.",noObject:"The object is not in canvas.",redo:"The promise of redo command is reject.",rotation:"The current angle is same the old angle.",undo:"The promise of undo command is reject.",unsupportedOperation:"Unsupported operation.",unsupportedType:"Unsupported object type."},rr={"icon-arrow":"M40 12V0l24 24-24 24V36H0V12h40z","icon-arrow-2":"M49,32 H3 V22 h46 l-18,-18 h12 l23,23 L43,50 h-12 l18,-18  z ","icon-arrow-3":"M43.349998,27 L17.354,53 H1.949999 l25.996,-26 L1.949999,1 h15.404 L43.349998,27  z ","icon-star":"M35,54.557999 l-19.912001,10.468 l3.804,-22.172001 l-16.108,-15.7 l22.26,-3.236 L35,3.746 l9.956,20.172001 l22.26,3.236 l-16.108,15.7 l3.804,22.172001  z ","icon-star-2":"M17,31.212 l-7.194,4.08 l-4.728,-6.83 l-8.234,0.524 l-1.328,-8.226 l-7.644,-3.14 l2.338,-7.992 l-5.54,-6.18 l5.54,-6.176 l-2.338,-7.994 l7.644,-3.138 l1.328,-8.226 l8.234,0.522 l4.728,-6.83 L17,-24.312 l7.194,-4.08 l4.728,6.83 l8.234,-0.522 l1.328,8.226 l7.644,3.14 l-2.338,7.992 l5.54,6.178 l-5.54,6.178 l2.338,7.992 l-7.644,3.14 l-1.328,8.226 l-8.234,-0.524 l-4.728,6.83  z ","icon-polygon":"M3,31 L19,3 h32 l16,28 l-16,28 H19  z ","icon-location":"M24 62C8 45.503 0 32.837 0 24 0 10.745 10.745 0 24 0s24 10.745 24 24c0 8.837-8 21.503-24 38zm0-28c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10z","icon-heart":"M49.994999,91.349998 l-6.96,-6.333 C18.324001,62.606995 2.01,47.829002 2.01,29.690998 C2.01,14.912998 13.619999,3.299999 28.401001,3.299999 c8.349,0 16.362,5.859 21.594,12 c5.229,-6.141 13.242001,-12 21.591,-12 c14.778,0 26.390999,11.61 26.390999,26.390999 c0,18.138 -16.314001,32.916 -41.025002,55.374001 l-6.96,6.285  z ","icon-bubble":"M44 48L34 58V48H12C5.373 48 0 42.627 0 36V12C0 5.373 5.373 0 12 0h40c6.627 0 12 5.373 12 12v24c0 6.627-5.373 12-12 12h-8z"},pr={realTimeEvent:!0,min:-360,max:360,value:0},mr={min:5,max:30,value:12},xr={realTimeEvent:!0,min:2,max:300,value:3},_r={realTimeEvent:!0,min:10,max:100,value:50},fr={tintOpacityRange:{realTimeEvent:!0,min:0,max:1,value:.7,useDecimal:!0},removewhiteDistanceRange:{realTimeEvent:!0,min:0,max:1,value:.2,useDecimal:!0},brightnessRange:{realTimeEvent:!0,min:-1,max:1,value:0,useDecimal:!0},noiseRange:{realTimeEvent:!0,min:0,max:1e3,value:100},pixelateRange:{realTimeEvent:!0,min:2,max:20,value:4},colorfilterThresholdRange:{realTimeEvent:!0,min:0,max:1,value:.2,useDecimal:!0},blurFilterRange:{value:.1}},gr={LEFT:0,TOP:0,WIDTH:.5,HEIGHT:.5},br={realTimeEvent:!0,min:32,max:4088,value:800},Nr=2,Lr="tui-image-editor-",rs=Math.min,as=Math.max,$r=!1;function Jr(Rt){return typeof Rt=="function"}function Cr(Rt,Bt,_t){if(Bt>_t){var Et=[_t,Bt];Bt=Et[0],_t=Et[1]}return as(Bt,rs(Rt,_t))}function Kr(){for(var Rt={},Bt=arguments.length,_t=new Array(Bt),Et=0;Et<Bt;Et++)_t[Et]=arguments[Et];return(0,_i.forEach)(_t,function(wt){Rt[wt]=wt}),Rt}function Zr(Rt,Bt){var _t={},Et=Bt.length,wt=0,Tt;for(wt=0;wt<Et;wt+=1)Tt=Bt[wt],_t[Tt]=Rt[Tt];return _t}function Sr(Rt){return dn()(Rt,10)}function qr(Rt){return Rt.replace(/-([a-z])/g,function(Bt,_t){return _t.toUpperCase()})}function Wr(){return!!(window.File&&window.FileList&&window.FileReader)}function ss(Rt,Bt){var _t,Et,wt;if(Rt.length===4){var Tt;Rt=Pt()(Tt="".concat(Rt)).call(Tt,ft()(Rt).call(Rt,1,4))}var Dt=dn()(ft()(Rt).call(Rt,1,3),16),kt=dn()(ft()(Rt).call(Rt,3,5),16),Yt=dn()(ft()(Rt).call(Rt,5,7),16),zt=Bt||1;return Pt()(_t=Pt()(Et=Pt()(wt="rgba(".concat(Dt,", ")).call(wt,kt,", ")).call(Et,Yt,", ")).call(_t,zt,")")}function Ir(){$r||($r=!0,(0,_i.sendHostname)("image-editor","UA-129999381-1"))}function os(Rt,Bt){var _t=document.getElementsByTagName("head"),Et=gn(_t,1),wt=Et[0],Tt=document.createElement("link"),Dt=encodeURIComponent(Rt);Bt&&(Tt.id=Bt),Tt.setAttribute("rel","stylesheet"),Tt.setAttribute("type","text/css"),Tt.setAttribute("href","data:text/css;charset=UTF-8,".concat(Dt)),wt.appendChild(Tt)}function ls(Rt){return function(Bt){return Rt.querySelector(Bt)}}function hn(Rt){var Bt=/data:(image\/.+);base64,/,_t="",Et,wt,Tt;Et=Rt.replace(Bt,function(kt,Yt){return _t=Yt,""}),Et=atob(Et);var Dt=Et.length;for(wt=new Uint8Array(Dt),Tt=0;Tt<Dt;Tt+=1)wt[Tt]=Et.charCodeAt(Tt);return new Blob([wt],{type:_t})}function Fn(Rt){return Number(Rt.toFixed(Nr))}function Mn(Rt){(0,_i.forEach)(Rt,function(Bt,_t){Rt[_t]=null})}function kn(){var Rt,Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",_t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(Bt.charAt(0)==="."){var Et;return Pt()(Et=".".concat(Lr).concat(_t)).call(Et,ft()(Bt).call(Bt,1))}return Pt()(Rt="".concat(Lr).concat(_t)).call(Rt,Bt)}function Un(Rt,Bt){var _t=Bt.originX,Et=Bt.originY,wt=Rt.getPointByOrigin(_t,Et),Tt=wt.x,Dt=wt.y;Rt.set({left:Tt,top:Dt,originX:_t,originY:Et}),Rt.setCoords()}function ir(Rt){var Bt,_t={};return Jt()(Bt=rn()(Rt)).call(Bt,function(Et){_t[Rt[Et]]=Et}),_t}function $n(Rt,Bt){Rt.customProps=Rt.customProps||{},(0,_i.extend)(Rt.customProps,Bt)}function ar(Rt,Bt){var _t={};return(0,_i.isString)(Bt)&&(Bt=[Bt]),(0,_i.forEach)(Bt,function(Et){_t[Et]=Rt.customProps[Et]}),_t}function Ar(Rt){return Rt.charAt(0).toUpperCase()+ft()(Rt).call(Rt,1)}function hr(Rt,Bt){return at()(Rt).call(Rt,Bt)>=0}function Er(){var Rt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,_i.pick)(Rt,"type")||Vn.COLOR}function Pn(Rt){var Bt=sn()(Rt),_t=Bt===void 0?{}:Bt;return _t.source?Vn.FILTER:Vn.COLOR}function yr(Rt){return(0,_i.inArray)(Rt.get("type"),Rn)>=0}function Dr(Rt){if(hr(Rn,Rt))return"Shape";switch(Rt){case"i-text":return"Text";case"path":case"line":return"Draw";case"activeSelection":return"Group";default:return $s(Rt)}}function ga(Rt){var Bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_t=Bt.useAlpha,Et=_t===void 0?!0:_t,wt=Bt.mode,Tt=zn.VINTAGE,Dt=zn.REMOVE_COLOR,kt=zn.BLEND_COLOR,Yt=zn.SEPIA2,zt=zn.COLOR_FILTER,en=zn.REMOVE_WHITE,an=zn.BLEND,vn;switch(Rt){case Tt:vn=Yt;break;case Dt:vn=Et?zt:en;break;case kt:vn=wt==="add"?an:wt;break;default:vn=Rt}return $s(vn)}function cs(Rt){var Bt=Bn.LOAD_IMAGE;return typeof Rt=="string"?Bt===Rt:Bt===Rt.name}function us(Rt){var Bt,_t,Et=Bn.FLIP_IMAGE,wt=Bn.ROTATE_IMAGE,Tt=Bn.ADD_TEXT,Dt=Bn.APPLY_FILTER,kt=Bn.REMOVE_FILTER,Yt=Bn.CHANGE_SHAPE,zt=Bn.CHANGE_ICON_COLOR,en=Bn.CHANGE_TEXT_STYLE,an=Bn.CLEAR_OBJECTS,vn=Bn.ADD_IMAGE_OBJECT,yn=Bn.REMOVE_OBJECT,Cn=Bn.RESIZE_IMAGE,wn=Rt.name,_n=Rt.args,Nn;switch(wn){case Et:Nn={name:wn,detail:_n[1]==="reset"?_n[1]:ft()(Bt=_n[1]).call(Bt,4)};break;case wt:Nn={name:wn,detail:_n[2]};break;case Dt:Nn={name:qn.APPLY_FILTER,detail:ga(_n[1],_n[2])};break;case kt:Nn={name:qn.REMOVE_FILTER,detail:"Remove"};break;case Yt:Nn={name:qn.CHANGE_SHAPE,detail:"Change"};break;case zt:Nn={name:qn.CHANGE_ICON_COLOR,detail:"Change"};break;case en:Nn={name:qn.CHANGE_TEXT_STYLE,detail:"Change"};break;case yn:Nn={name:qn.REMOVE_OBJECT,detail:_n[2]};break;case an:Nn={name:qn.CLEAR_OBJECTS,detail:"All"};break;case vn:Nn={name:qn.ADD_IMAGE_OBJECT,detail:"Add"};break;case Tt:Nn={name:qn.ADD_TEXT};break;case Cn:Nn={name:qn.RESIZE,detail:Pt()(_t="".concat(~~_n[1].width,"x")).call(_t,~~_n[1].height)};break;default:Nn={name:wn};break}return _n[1]==="mask"&&(Nn={name:qn.LOAD_MASK_IMAGE,detail:"Apply"}),Nn}function va(Rt){return Rt==="top"?"bottom":Rt==="left"?"right":Rt==="right"?"left":"top"}function $s(Rt){return Rt.replace(/[a-z]/,function(Bt){return Bt.toUpperCase()})}function vl(Rt){var Bt=Rt.left,_t=Rt.top,Et=Rt.width,wt=Rt.height,Tt=gr.LEFT,Dt=gr.TOP,kt=gr.WIDTH,Yt=gr.HEIGHT;return Bt===Tt&&_t===Dt&&Et===kt&&wt===Yt}var yl=Kr("UN_IMPLEMENTATION","NO_COMPONENT_NAME"),Js={UN_IMPLEMENTATION:"Should implement a method: ",NO_COMPONENT_NAME:"Should set a component name"},bl={UN_IMPLEMENTATION:function(Bt){return Js.UN_IMPLEMENTATION+Bt},NO_COMPONENT_NAME:function(){return Js.NO_COMPONENT_NAME}},fs={types:Xt().extend({},yl),create:function(Bt){Bt=Bt.toLowerCase();for(var _t=bl[Bt],Et=arguments.length,wt=new Array(Et>1?Et-1:0),Tt=1;Tt<Et;Tt++)wt[Tt-1]=arguments[Tt];return _t.apply(void 0,wt)}},Zs=fs.create,qs=fs.types,xl=function(){function Rt(Bt,_t){Ht(this,Rt),this.name=Bt.name,this.args=_t,this.execute=Bt.execute,this.undo=Bt.undo,this.executeCallback=Bt.executeCallback||null,this.undoCallback=Bt.undoCallback||null,this.undoData={}}return Wt(Rt,[{key:"execute",value:function(){throw new Error(Zs(qs.UN_IMPLEMENTATION,"execute"))}},{key:"undo",value:function(){throw new Error(Zs(qs.UN_IMPLEMENTATION,"undo"))}},{key:"isRedo",get:function(){return rn()(this.undoData).length>0}},{key:"setUndoData",value:function(_t,Et,wt){return Et&&(_t=Et),wt?Et||(Et=_t):(Xt().extend(this.undoData,_t),Et=null),Et}},{key:"setExecuteCallback",value:function(_t){return this.executeCallback=_t,this}},{key:"setUndoCallback",value:function(_t){return this.undoCallback=_t,this}}]),Rt}(),Cl=xl,eo={};function wl(Rt){var Bt=eo[Rt];if(Bt){for(var _t=arguments.length,Et=new Array(_t>1?_t-1:0),wt=1;wt<_t;wt++)Et[wt-1]=arguments[wt];return new Cl(Bt,Et)}return null}function _l(Rt){eo[Rt.name]=Rt}var dr={create:wl,register:_l},to=function(){function Rt(){Ht(this,Rt),this._undoStack=[],this._redoStack=[],this._isLocked=!1,this._isSilent=!1}return Wt(Rt,[{key:"_invokeExecution",value:function(_t){var Et=this,wt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.lock();var Tt=_t.args;return Tt||(Tt=[]),_t.execute.apply(_t,Ft(Tt)).then(function(Dt){return Et._isSilent||(Et.pushUndoStack(_t),Et.fire(wt?xn.AFTER_REDO:xn.EXECUTE_COMMAND,_t)),Et.unlock(),Jr(_t.executeCallback)&&_t.executeCallback(Dt),Dt}).catch(function(Dt){return Et.unlock(),Gt().reject(Dt)})}},{key:"_invokeUndo",value:function(_t){var Et=this;this.lock();var wt=_t.args;return wt||(wt=[]),_t.undo.apply(_t,Ft(wt)).then(function(Tt){return Et.pushRedoStack(_t),Et.fire(xn.AFTER_UNDO,_t),Et.unlock(),Jr(_t.undoCallback)&&_t.undoCallback(Tt),Tt}).catch(function(Tt){return Et.unlock(),Gt().reject(Tt)})}},{key:"_fireRedoStackChanged",value:function(){this.fire(xn.REDO_STACK_CHANGED,this._redoStack.length)}},{key:"_fireUndoStackChanged",value:function(){this.fire(xn.UNDO_STACK_CHANGED,this._undoStack.length)}},{key:"lock",value:function(){this._isLocked=!0}},{key:"unlock",value:function(){this._isLocked=!1}},{key:"executeSilent",value:function(){var _t=this;this._isSilent=!0;for(var Et=arguments.length,wt=new Array(Et),Tt=0;Tt<Et;Tt++)wt[Tt]=arguments[Tt];return this.execute.apply(this,Pt()(wt).call(wt,[this._isSilent])).then(function(){_t._isSilent=!1})}},{key:"execute",value:function(){var _t=this;if(this._isLocked)return Gt().reject(Hn.isLock);for(var Et=arguments.length,wt=new Array(Et),Tt=0;Tt<Et;Tt++)wt[Tt]=arguments[Tt];var Dt=wt[0];return(0,_i.isString)(Dt)&&(Dt=dr.create.apply(dr,wt)),this._invokeExecution(Dt).then(function(kt){return _t.clearRedoStack(),kt})}},{key:"undo",value:function(){var _t=this._undoStack.pop(),Et,wt="";if(_t&&this._isLocked&&(this.pushUndoStack(_t,!0),_t=null),_t)this.isEmptyUndoStack()&&this._fireUndoStackChanged(),Et=this._invokeUndo(_t);else{if(wt=Hn.undo,this._isLocked){var Tt;wt=Pt()(Tt="".concat(wt," Because ")).call(Tt,Hn.isLock)}Et=Gt().reject(wt)}return Et}},{key:"redo",value:function(){var _t=this._redoStack.pop(),Et,wt="";if(_t&&this._isLocked&&(this.pushRedoStack(_t,!0),_t=null),_t)this.isEmptyRedoStack()&&this._fireRedoStackChanged(),Et=this._invokeExecution(_t,!0);else{if(wt=Hn.redo,this._isLocked){var Tt;wt=Pt()(Tt="".concat(wt," Because ")).call(Tt,Hn.isLock)}Et=Gt().reject(wt)}return Et}},{key:"pushUndoStack",value:function(_t,Et){this._undoStack.push(_t),Et||this._fireUndoStackChanged()}},{key:"pushRedoStack",value:function(_t,Et){this._redoStack.push(_t),Et||this._fireRedoStackChanged()}},{key:"isEmptyRedoStack",value:function(){return this._redoStack.length===0}},{key:"isEmptyUndoStack",value:function(){return this._undoStack.length===0}},{key:"clearUndoStack",value:function(){this.isEmptyUndoStack()||(this._undoStack=[],this._fireUndoStackChanged())}},{key:"clearRedoStack",value:function(){this.isEmptyRedoStack()||(this._redoStack=[],this._fireRedoStackChanged())}}]),Rt}();_i.CustomEvents.mixin(to);var Sl=to,El=tt(5214),Hr=tt.n(El),Tl=function(Rt){var Bt,_t,Et,wt,Tt,Dt,kt,Yt=Rt.locale,zt=Rt.biImage,en=Rt.commonStyle,an=Rt.headerStyle,vn=Rt.loadButtonStyle,yn=Rt.downloadButtonStyle,Cn=Rt.submenuStyle;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=Pt()(Dt=Pt()(kt=`
    <div class="tui-image-editor-main-container" style="`.concat(en,`">
        <div class="tui-image-editor-header" style="`)).call(kt,an,`">
            <div class="tui-image-editor-header-logo">
                <img src="`)).call(Dt,zt,`" />
            </div>
            <div class="tui-image-editor-header-buttons">
                <div style="`)).call(Tt,vn,`">
                    `)).call(wt,Yt.localize("Load"),`
                    <input type="file" class="tui-image-editor-load-btn" />
                </div>
                <button class="tui-image-editor-download-btn" style="`)).call(Et,yn,`">
                    `)).call(_t,Yt.localize("Download"),`
                </button>
            </div>
        </div>
        <div class="tui-image-editor-main">
            <div class="tui-image-editor-submenu">
                <div class="tui-image-editor-submenu-style" style="`)).call(Bt,Cn,`"></div>
            </div>
            <div class="tui-image-editor-wrap">
                <div class="tui-image-editor-size-wrap">
                    <div class="tui-image-editor-align-wrap">
                        <div class="tui-image-editor"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
`)},Il=function(Rt){var Bt,_t,Et,wt,Tt,Dt=Rt.locale,kt=Rt.biImage,Yt=Rt.loadButtonStyle,zt=Rt.downloadButtonStyle,en=Rt.menuBarPosition;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=`
    <ul class="tui-image-editor-help-menu `.concat(va(en),`"></ul>
    <div class="tui-image-editor-controls">
        <div class="tui-image-editor-controls-logo">
            <img src="`)).call(Tt,kt,`" />
        </div>
        <ul class="tui-image-editor-menu"></ul>

        <div class="tui-image-editor-controls-buttons">
            <div style="`)).call(wt,Yt,`">
                `)).call(Et,Dt.localize("Load"),`
                <input type="file" class="tui-image-editor-load-btn" />
            </div>
            <button class="tui-image-editor-download-btn" style="`)).call(_t,zt,`">
                `)).call(Bt,Dt.localize("Download"),`
            </button>
        </div>
    </div>
`)},Bl=function(Rt){var Bt,_t,Et,wt,Tt,Dt,kt,Yt,zt,en,an,vn,yn,Cn,wn,_n,Nn,Kn,Zn,er,Gn,ur,wr,Br,vr,kr,Vr,Mr,ns,ys=Rt.subMenuLabelActive,bs=Rt.subMenuLabelNormal,xs=Rt.subMenuRangeTitle,Cs=Rt.submenuPartitionVertical,ws=Rt.submenuPartitionHorizontal,_s=Rt.submenuCheckbox,Ss=Rt.submenuRangePointer,Es=Rt.submenuRangeValue,Ts=Rt.submenuColorpickerTitle,Is=Rt.submenuColorpickerButton,Bs=Rt.submenuRangeBar,Ms=Rt.submenuRangeSubbar,Os=Rt.submenuDisabledRangePointer,Ds=Rt.submenuDisabledRangeBar,js=Rt.submenuDisabledRangeSubbar,Fs=Rt.submenuIconSize,Ns=Rt.menuIconSize,Ls=Rt.biSize,Pr=Rt.menuIconStyle,Xr=Rt.submenuIconStyle;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=Pt()(Dt=Pt()(kt=Pt()(Yt=Pt()(zt=Pt()(en=Pt()(an=Pt()(vn=Pt()(yn=Pt()(Cn=Pt()(wn=Pt()(_n=Pt()(Nn=Pt()(Kn=Pt()(Zn=Pt()(er=Pt()(Gn=Pt()(ur=Pt()(wr=Pt()(Br=Pt()(vr=Pt()(kr=Pt()(Vr=Pt()(Mr=Pt()(ns=`
    .tie-icon-add-button.icon-bubble .tui-image-editor-button[data-icontype="icon-bubble"] label,
    .tie-icon-add-button.icon-heart .tui-image-editor-button[data-icontype="icon-heart"] label,
    .tie-icon-add-button.icon-location .tui-image-editor-button[data-icontype="icon-location"] label,
    .tie-icon-add-button.icon-polygon .tui-image-editor-button[data-icontype="icon-polygon"] label,
    .tie-icon-add-button.icon-star .tui-image-editor-button[data-icontype="icon-star"] label,
    .tie-icon-add-button.icon-star-2 .tui-image-editor-button[data-icontype="icon-star-2"] label,
    .tie-icon-add-button.icon-arrow-3 .tui-image-editor-button[data-icontype="icon-arrow-3"] label,
    .tie-icon-add-button.icon-arrow-2 .tui-image-editor-button[data-icontype="icon-arrow-2"] label,
    .tie-icon-add-button.icon-arrow .tui-image-editor-button[data-icontype="icon-arrow"] label,
    .tie-icon-add-button.icon-bubble .tui-image-editor-button[data-icontype="icon-bubble"] label,
    .tie-draw-line-select-button.line .tui-image-editor-button.line label,
    .tie-draw-line-select-button.free .tui-image-editor-button.free label,
    .tie-flip-button.flipX .tui-image-editor-button.flipX label,
    .tie-flip-button.flipY .tui-image-editor-button.flipY label,
    .tie-flip-button.resetFlip .tui-image-editor-button.resetFlip label,
    .tie-crop-button .tui-image-editor-button.apply.active label,
    .tie-crop-preset-button .tui-image-editor-button.preset.active label,
    .tie-resize-button .tui-image-editor-button.apply.active label,
    .tie-resize-preset-button .tui-image-editor-button.preset.active label,
    .tie-shape-button.rect .tui-image-editor-button.rect label,
    .tie-shape-button.circle .tui-image-editor-button.circle label,
    .tie-shape-button.triangle .tui-image-editor-button.triangle label,
    .tie-text-effect-button .tui-image-editor-button.active label,
    .tie-text-align-button.tie-text-align-left .tui-image-editor-button.left label,
    .tie-text-align-button.tie-text-align-center .tui-image-editor-button.center label,
    .tie-text-align-button.tie-text-align-right .tui-image-editor-button.right label,
    .tie-mask-apply.apply.active .tui-image-editor-button.apply label,
    .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button:hover > label,
    .tui-image-editor-container .tui-image-editor-checkbox label > span {
        `.concat(ys,`
    }
    .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button > label,
    .tui-image-editor-container .tui-image-editor-range-wrap.tui-image-editor-newline.short label,
    .tui-image-editor-container .tui-image-editor-range-wrap.tui-image-editor-newline.short label > span {
        `)).call(ns,bs,`
    }
    .tui-image-editor-container .tui-image-editor-range-wrap label > span {
        `)).call(Mr,xs,`
    }
    .tui-image-editor-container .tui-image-editor-partition > div {
        `)).call(Vr,Cs,`
    }
    .tui-image-editor-container.left .tui-image-editor-submenu .tui-image-editor-partition > div,
    .tui-image-editor-container.right .tui-image-editor-submenu .tui-image-editor-partition > div {
        `)).call(kr,ws,`
    }
    .tui-image-editor-container .tui-image-editor-checkbox label > span:before {
        `)).call(vr,_s,`
    }
    .tui-image-editor-container .tui-image-editor-checkbox label > input:checked + span:before {
        border: 0;
    }
    .tui-image-editor-container .tui-image-editor-virtual-range-pointer {
        `)).call(Br,Ss,`
    }
    .tui-image-editor-container .tui-image-editor-virtual-range-bar {
        `)).call(wr,Bs,`
    }
    .tui-image-editor-container .tui-image-editor-virtual-range-subbar {
        `)).call(ur,Ms,`
    }
    .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-pointer {
        `)).call(Gn,Os,`
    }
    .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-subbar {
        `)).call(er,js,`
    }
    .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-bar {
        `)).call(Zn,Ds,`
    }
    .tui-image-editor-container .tui-image-editor-range-value {
        `)).call(Kn,Es,`
    }
    .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value + label {
        `)).call(Nn,Ts,`
    }
    .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value {
        `)).call(_n,Is,`
    }
    .tui-image-editor-container .svg_ic-menu {
        `)).call(wn,Ns,`
    }
    .tui-image-editor-container .svg_ic-submenu {
        `)).call(Cn,Fs,`
    }
    .tui-image-editor-container .tui-image-editor-controls-logo > img,
    .tui-image-editor-container .tui-image-editor-header-logo > img {
        `)).call(yn,Ls,`
    }
    .tui-image-editor-menu use.normal.use-default,
    .tui-image-editor-help-menu use.normal.use-default {
        fill-rule: evenodd;
        fill: `)).call(vn,Pr.normal.color,`;
        stroke: `)).call(an,Pr.normal.color,`;
    }
    .tui-image-editor-menu use.active.use-default,
    .tui-image-editor-help-menu use.active.use-default {
        fill-rule: evenodd;
        fill: `)).call(en,Pr.active.color,`;
        stroke: `)).call(zt,Pr.active.color,`;
    }
    .tui-image-editor-menu use.hover.use-default,
    .tui-image-editor-help-menu use.hover.use-default {
        fill-rule: evenodd;
        fill: `)).call(Yt,Pr.hover.color,`;
        stroke: `)).call(kt,Pr.hover.color,`;
    }
    .tui-image-editor-menu use.disabled.use-default,
    .tui-image-editor-help-menu use.disabled.use-default {
        fill-rule: evenodd;
        fill: `)).call(Dt,Pr.disabled.color,`;
        stroke: `)).call(Tt,Pr.disabled.color,`;
    }
    .tui-image-editor-submenu use.normal.use-default {
        fill-rule: evenodd;
        fill: `)).call(wt,Xr.normal.color,`;
        stroke: `)).call(Et,Xr.normal.color,`;
    }
    .tui-image-editor-submenu use.active.use-default {
        fill-rule: evenodd;
        fill: `)).call(_t,Xr.active.color,`;
        stroke: `)).call(Bt,Xr.active.color,`;
    }
`)},Ml={"common.bi.image":"https://uicdn.toast.com/toastui/img/tui-image-editor-bi.png","common.bisize.width":"251px","common.bisize.height":"21px","common.backgroundImage":"none","common.backgroundColor":"#1e1e1e","common.border":"0px","header.backgroundImage":"none","header.backgroundColor":"transparent","header.border":"0px","loadButton.backgroundColor":"#fff","loadButton.border":"1px solid #ddd","loadButton.color":"#222","loadButton.fontFamily":"'Noto Sans', sans-serif","loadButton.fontSize":"12px","downloadButton.backgroundColor":"#fdba3b","downloadButton.border":"1px solid #fdba3b","downloadButton.color":"#fff","downloadButton.fontFamily":"'Noto Sans', sans-serif","downloadButton.fontSize":"12px","menu.normalIcon.color":"#8a8a8a","menu.activeIcon.color":"#555555","menu.disabledIcon.color":"#434343","menu.hoverIcon.color":"#e9e9e9","submenu.normalIcon.color":"#8a8a8a","submenu.activeIcon.color":"#e9e9e9","menu.iconSize.width":"24px","menu.iconSize.height":"24px","submenu.iconSize.width":"32px","submenu.iconSize.height":"32px","submenu.backgroundColor":"#1e1e1e","submenu.partition.color":"#3c3c3c","submenu.normalLabel.color":"#8a8a8a","submenu.normalLabel.fontWeight":"lighter","submenu.activeLabel.color":"#fff","submenu.activeLabel.fontWeight":"lighter","checkbox.border":"0px","checkbox.backgroundColor":"#fff","range.pointer.color":"#fff","range.bar.color":"#666","range.subbar.color":"#d1d1d1","range.disabledPointer.color":"#414141","range.disabledBar.color":"#282828","range.disabledSubbar.color":"#414141","range.value.color":"#fff","range.value.fontWeight":"lighter","range.value.fontSize":"11px","range.value.border":"1px solid #353535","range.value.backgroundColor":"#151515","range.title.color":"#fff","range.title.fontWeight":"lighter","colorpicker.button.border":"1px solid #1e1e1e","colorpicker.title.color":"#fff"},Ol=tt(2534),Dl=function(){function Rt(Bt){Ht(this,Rt),this.styles=this._changeToObject((0,_i.extend)({},Ml,Bt)),os(this._styleMaker()),this._loadDefaultSvgIcon()}return Wt(Rt,[{key:"getStyle",value:function(_t){var Et=null,wt=_t.replace(/\..+$/,""),Tt=this.styles[_t];switch(_t){case"common.bi":Et=this.styles[_t].image;break;case"menu.icon":Et={active:this.styles["".concat(wt,".activeIcon")],normal:this.styles["".concat(wt,".normalIcon")],hover:this.styles["".concat(wt,".hoverIcon")],disabled:this.styles["".concat(wt,".disabledIcon")]};break;case"submenu.icon":Et={active:this.styles["".concat(wt,".activeIcon")],normal:this.styles["".concat(wt,".normalIcon")]};break;case"submenu.label":Et={active:this._makeCssText(this.styles["".concat(wt,".activeLabel")]),normal:this._makeCssText(this.styles["".concat(wt,".normalLabel")])};break;case"submenu.partition":Et={vertical:this._makeCssText((0,_i.extend)({},Tt,{borderLeft:"1px solid ".concat(Tt.color)})),horizontal:this._makeCssText((0,_i.extend)({},Tt,{borderBottom:"1px solid ".concat(Tt.color)}))};break;case"range.disabledPointer":case"range.disabledBar":case"range.disabledSubbar":case"range.pointer":case"range.bar":case"range.subbar":Tt.backgroundColor=Tt.color,Et=this._makeCssText(Tt);break;default:Et=this._makeCssText(Tt);break}return Et}},{key:"_styleMaker",value:function(){var _t=this.getStyle("submenu.label"),Et=this.getStyle("submenu.partition");return Bl({subMenuLabelActive:_t.active,subMenuLabelNormal:_t.normal,submenuPartitionVertical:Et.vertical,submenuPartitionHorizontal:Et.horizontal,biSize:this.getStyle("common.bisize"),subMenuRangeTitle:this.getStyle("range.title"),submenuRangePointer:this.getStyle("range.pointer"),submenuRangeBar:this.getStyle("range.bar"),submenuRangeSubbar:this.getStyle("range.subbar"),submenuDisabledRangePointer:this.getStyle("range.disabledPointer"),submenuDisabledRangeBar:this.getStyle("range.disabledBar"),submenuDisabledRangeSubbar:this.getStyle("range.disabledSubbar"),submenuRangeValue:this.getStyle("range.value"),submenuColorpickerTitle:this.getStyle("colorpicker.title"),submenuColorpickerButton:this.getStyle("colorpicker.button"),submenuCheckbox:this.getStyle("checkbox"),menuIconSize:this.getStyle("menu.iconSize"),submenuIconSize:this.getStyle("submenu.iconSize"),menuIconStyle:this.getStyle("menu.icon"),submenuIconStyle:this.getStyle("submenu.icon")})}},{key:"_changeToObject",value:function(_t){var Et={};return(0,_i.forEach)(_t,function(wt,Tt){var Dt=Tt.match(/^(.+)\.([a-z]+)$/i),kt=gn(Dt,3),Yt=kt[1],zt=kt[2];Et[Yt]||(Et[Yt]={}),Et[Yt][zt]=wt}),Et}},{key:"_makeCssText",value:function(_t){var Et=this,wt=[];return(0,_i.forEach)(_t,function(Tt,Dt){var kt,Yt;at()(kt=["backgroundImage"]).call(kt,Dt)>-1&&Tt!=="none"&&(Tt="url(".concat(Tt,")")),wt.push(Pt()(Yt="".concat(Et._toUnderScore(Dt),": ")).call(Yt,Tt))}),wt.join(";")}},{key:"_toUnderScore",value:function(_t){return _t.replace(/([A-Z])/g,function(Et,wt){return"-".concat(wt.toLowerCase())})}},{key:"_loadDefaultSvgIcon",value:function(){if(!document.getElementById("tui-image-editor-svg-default-icons")){var _t=new DOMParser,Et=Ol.replace(/data:image\/svg\+xml;base64,/,""),wt=_t.parseFromString(atob(Et),"text/xml");document.body.appendChild(wt.documentElement)}}},{key:"_makeIconClassName",value:function(_t,Et){var wt=Et?this.getStyle("submenu.icon"):this.getStyle("menu.icon"),Tt=wt[_t],Dt=Tt.path,kt=Tt.name;return Dt&&kt?_t:"".concat(_t," use-default")}},{key:"_makeSvgIconPrefix",value:function(_t,Et){var wt,Tt=Et?this.getStyle("submenu.icon"):this.getStyle("menu.icon"),Dt=Tt[_t],kt=Dt.path,Yt=Dt.name;return kt&&Yt?Pt()(wt="".concat(kt,"#")).call(wt,Yt,"-"):"#"}},{key:"_makeSvgItem",value:function(_t,Et,wt){var Tt=this;return(0,_i.map)(_t,function(Dt){var kt,Yt,zt=Tt._makeSvgIconPrefix(Dt,wt),en=Tt._toUnderScore(Et),an=Tt._makeIconClassName(Dt,wt);return Pt()(kt=Pt()(Yt='<use xlink:href="'.concat(zt,"ic-")).call(Yt,en,'" class="')).call(kt,an,'"/>')}).join("")}},{key:"makeMenSvgIconSet",value:function(_t,Et){var wt,Tt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Pt()(wt='<svg class="svg_ic-'.concat(Tt?"submenu":"menu",'">')).call(wt,this._makeSvgItem(_t,Et,Tt),"</svg>")}}]),Rt}(),jl=Dl,Fl=tt(9146),Dn=tt.n(Fl),Nl=tt(6623),io=tt(4230);function Rs(Rt,Bt){return Rs=io||function(Et,wt){return Et.__proto__=wt,Et},Rs(Rt,Bt)}function lr(Rt,Bt){if(typeof Bt!="function"&&Bt!==null)throw new TypeError("Super expression must either be null or a function");Rt.prototype=Nl(Bt&&Bt.prototype,{constructor:{value:Rt,writable:!0,configurable:!0}}),Bt&&Rs(Rt,Bt)}var Ll=tt(3742);function hs(Rt){return typeof Ct=="function"&&typeof Ll=="symbol"?hs=function(_t){return typeof _t}:hs=function(_t){return _t&&typeof Ct=="function"&&_t.constructor===Ct&&_t!==Ct.prototype?"symbol":typeof _t},hs(Rt)}function sr(Rt){if(Rt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Rt}function cr(Rt,Bt){if(Bt&&(hs(Bt)==="object"||typeof Bt=="function"))return Bt;if(Bt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sr(Rt)}var no=tt(9856);function Jn(Rt){return Jn=io?no:function(_t){return _t.__proto__||no(_t)},Jn(Rt)}var kl=tt(4858),Pl=tt.n(kl),Rl=["#000000","#2a2a2a","#545454","#7e7e7e","#a8a8a8","#d2d2d2","#ffffff","","#ff4040","#ff6518","#ffbb3b","#03bd9e","#00a9ff","#515ce6","#9e5fff","#ff5583"],ro=function(){function Rt(Bt,_t){var Et=_t.defaultColor,wt=Et===void 0?"#7e7e7e":Et,Tt=_t.toggleDirection,Dt=Tt===void 0?"up":Tt,kt=_t.usageStatistics;Ht(this,Rt),this.colorpickerElement=Bt,this.usageStatistics=kt,this._show=!1,this._colorpickerElement=Bt,this._toggleDirection=Dt,this._makePickerButtonElement(wt),this._makePickerLayerElement(Bt,Bt.getAttribute("title")),this._color=wt,this.picker=Pl().create({container:this.pickerElement,preset:Rl,color:wt,usageStatistics:this.usageStatistics}),this._addEvent()}return Wt(Rt,[{key:"destroy",value:function(){var _t=this;this._removeEvent(),this.picker.destroy(),this.colorpickerElement.innerHTML="",Jt()(Xt()).call(Xt(),this,function(Et,wt){_t[wt]=null})}},{key:"color",get:function(){return this._color},set:function(_t){this._color=_t,this._changeColorElement(_t)}},{key:"_changeColorElement",value:function(_t){_t?(this.colorElement.classList.remove("transparent"),this.colorElement.style.backgroundColor=_t):(this.colorElement.style.backgroundColor="#fff",this.colorElement.classList.add("transparent"))}},{key:"_makePickerButtonElement",value:function(_t){this.colorpickerElement.classList.add("tui-image-editor-button"),this.colorElement=document.createElement("div"),this.colorElement.className="color-picker-value",_t?this.colorElement.style.backgroundColor=_t:this.colorElement.classList.add("transparent")}},{key:"_makePickerLayerElement",value:function(_t,Et){var wt=document.createElement("label"),Tt=document.createElement("div");this.pickerControl=document.createElement("div"),this.pickerControl.className="color-picker-control",this.pickerElement=document.createElement("div"),this.pickerElement.className="color-picker",wt.innerHTML=Et,Tt.className="triangle",this.pickerControl.appendChild(this.pickerElement),this.pickerControl.appendChild(Tt),_t.appendChild(this.pickerControl),_t.appendChild(this.colorElement),_t.appendChild(wt)}},{key:"_addEvent",value:function(){var _t=this,Et;this.picker.on("selectColor",function(wt){_t._changeColorElement(wt.color),_t._color=wt.color,_t.fire("change",wt.color)}),this.eventHandler={pickerToggle:Lt()(Et=this._pickerToggleEventHandler).call(Et,this),pickerHide:function(){return _t.hide()}},this.colorpickerElement.addEventListener("click",this.eventHandler.pickerToggle),document.body.addEventListener("click",this.eventHandler.pickerHide)}},{key:"_removeEvent",value:function(){this.colorpickerElement.removeEventListener("click",this.eventHandler.pickerToggle),document.body.removeEventListener("click",this.eventHandler.pickerHide),this.picker.off()}},{key:"_pickerToggleEventHandler",value:function(_t){var Et=_t.target,wt=Et&&this._isElementInColorPickerControl(Et);(!wt||wt&&this._isPaletteButton(Et))&&(this._show=!this._show,this.pickerControl.style.display=this._show?"block":"none",this._setPickerControlPosition(),this.fire("changeShow",this)),_t.stopPropagation()}},{key:"_isPaletteButton",value:function(_t){return _t.className==="tui-colorpicker-palette-button"}},{key:"_isElementInColorPickerControl",value:function(_t){for(var Et=_t;Et!==document.body&&Et;){if(Et===this.pickerControl)return!0;Et=Et.parentNode}return!1}},{key:"hide",value:function(){this._show=!1,this.pickerControl.style.display="none"}},{key:"_setPickerControlPosition",value:function(){var _t=this.pickerControl.style,Et=this._colorpickerElement.clientWidth/2+2,wt=this.pickerControl.offsetWidth/2-Et,Tt=(this.pickerControl.offsetHeight+10)*-1;this._toggleDirection==="down"&&(Tt=30),_t.top="".concat(Tt,"px"),_t.left="-".concat(wt,"px")}}]),Rt}();Xt().CustomEvents.mixin(ro);var zr=ro,Ul=/(-?)([0-9]*)[^0-9]*([0-9]*)/g,ao=function(){function Rt(Bt){var _t,Et,wt,Tt,Dt,kt,Yt,zt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ht(this,Rt),this._value=zt.value||0,this.rangeElement=Bt.slider,this.rangeInputElement=Bt.input,this._drawRangeElement(),this.rangeWidth=this._getRangeWidth(),this._min=zt.min||0,this._max=zt.max||100,this._useDecimal=zt.useDecimal,this._absMax=this._min*-1+this._max,this.realTimeEvent=zt.realTimeEvent||!1,this.eventHandler={startChangingSlide:Lt()(_t=this._startChangingSlide).call(_t,this),stopChangingSlide:Lt()(Et=this._stopChangingSlide).call(Et,this),changeSlide:Lt()(wt=this._changeSlide).call(wt,this),changeSlideFinally:Lt()(Tt=this._changeSlideFinally).call(Tt,this),changeInput:Lt()(Dt=this._changeValueWithInput).call(Dt,this,!1),changeInputFinally:Lt()(kt=this._changeValueWithInput).call(kt,this,!0),changeInputWithArrow:Lt()(Yt=this._changeValueWithInputKeyEvent).call(Yt,this)},this._addClickEvent(),this._addDragEvent(),this._addInputEvent(),this.value=zt.value,this.trigger("change")}return Wt(Rt,[{key:"destroy",value:function(){var _t=this;this._removeClickEvent(),this._removeDragEvent(),this._removeInputEvent(),this.rangeElement.innerHTML="",Jt()(Xt()).call(Xt(),this,function(Et,wt){_t[wt]=null})}},{key:"max",get:function(){return this._max},set:function(_t){this._max=_t,this._absMax=this._min*-1+this._max,this.value=this._value}},{key:"min",get:function(){return this._min},set:function(_t){this._min=_t,this.max=this._max}},{key:"value",get:function(){return this._value},set:function(_t){_t=this._useDecimal?_t:Sr(_t);var Et=_t-this._min,wt=Et*this.rangeWidth/this._absMax;this.rangeWidth<wt&&(wt=this.rangeWidth),this.pointer.style.left="".concat(wt,"px"),this.subbar.style.right="".concat(this.rangeWidth-wt,"px"),this._value=_t,this.rangeInputElement&&(this.rangeInputElement.value=_t)}},{key:"trigger",value:function(_t){this.fire(_t,this._value)}},{key:"_getRangeWidth",value:function(){var _t=function(wt){return Sr(window.getComputedStyle(wt,null).width)};return _t(this.rangeElement)-_t(this.pointer)}},{key:"_drawRangeElement",value:function(){this.rangeElement.classList.add("tui-image-editor-range"),this.bar=document.createElement("div"),this.bar.className="tui-image-editor-virtual-range-bar",this.subbar=document.createElement("div"),this.subbar.className="tui-image-editor-virtual-range-subbar",this.pointer=document.createElement("div"),this.pointer.className="tui-image-editor-virtual-range-pointer",this.bar.appendChild(this.subbar),this.bar.appendChild(this.pointer),this.rangeElement.appendChild(this.bar)}},{key:"_addInputEvent",value:function(){this.rangeInputElement&&(this.rangeInputElement.addEventListener("keydown",this.eventHandler.changeInputWithArrow),this.rangeInputElement.addEventListener("keyup",this.eventHandler.changeInput),this.rangeInputElement.addEventListener("blur",this.eventHandler.changeInputFinally))}},{key:"_removeInputEvent",value:function(){this.rangeInputElement&&(this.rangeInputElement.removeEventListener("keydown",this.eventHandler.changeInputWithArrow),this.rangeInputElement.removeEventListener("keyup",this.eventHandler.changeInput),this.rangeInputElement.removeEventListener("blur",this.eventHandler.changeInputFinally))}},{key:"_changeValueWithInputKeyEvent",value:function(_t){var Et,wt=_t.keyCode,Tt=_t.target;if(!(at()(Et=[Ln.ARROW_UP,Ln.ARROW_DOWN]).call(Et,wt)<0)){var Dt=Number(Tt.value);Dt=this._valueUpDownForKeyEvent(Dt,wt);var kt=Dt<this._min||Dt>this._max;if(!kt){var Yt=Cr(Dt,this._min,this.max);this.value=Yt,this.fire("change",Yt,!1)}}}},{key:"_valueUpDownForKeyEvent",value:function(_t,Et){var wt=this._useDecimal?.1:1;return Et===Ln.ARROW_UP?_t+=wt:Et===Ln.ARROW_DOWN&&(_t-=wt),_t}},{key:"_changeValueWithInput",value:function(_t,Et){var wt,Tt=Et.keyCode,Dt=Et.target;if(!(at()(wt=[Ln.ARROW_UP,Ln.ARROW_DOWN]).call(wt,Tt)>=0)){var kt=this._filterForInputText(Dt.value),Yt=!kt||isNaN(kt);if(Dt.value=kt,!Yt){var zt=this._useDecimal?Number(kt):Sr(kt);zt=Cr(zt,this._min,this.max),this.value=zt,this.fire("change",zt,_t)}}}},{key:"_addClickEvent",value:function(){this.rangeElement.addEventListener("click",this.eventHandler.changeSlideFinally)}},{key:"_removeClickEvent",value:function(){this.rangeElement.removeEventListener("click",this.eventHandler.changeSlideFinally)}},{key:"_addDragEvent",value:function(){this.pointer.addEventListener("mousedown",this.eventHandler.startChangingSlide)}},{key:"_removeDragEvent",value:function(){this.pointer.removeEventListener("mousedown",this.eventHandler.startChangingSlide)}},{key:"_changeSlide",value:function(_t){var Et=_t.screenX,wt=Et-this.firstPosition,Tt=this.firstLeft+wt;Tt=Tt>this.rangeWidth?this.rangeWidth:Tt,Tt=Tt<0?0:Tt,this.pointer.style.left="".concat(Tt,"px"),this.subbar.style.right="".concat(this.rangeWidth-Tt,"px");var Dt=Tt/this.rangeWidth,kt=this._absMax*Dt+this._min,Yt=this._useDecimal?kt:Sr(kt),zt=this.value!==Yt;zt&&(this.value=Yt,this.realTimeEvent&&this.fire("change",this._value,!1))}},{key:"_changeSlideFinally",value:function(_t){if(_t.stopPropagation(),_t.target.className==="tui-image-editor-range"){var Et=_t.offsetX,wt=Et/this.rangeWidth,Tt=this._absMax*wt+this._min;this.pointer.style.left="".concat(wt*this.rangeWidth,"px"),this.subbar.style.right="".concat((1-wt)*this.rangeWidth,"px"),this.value=Tt,this.fire("change",Tt,!0)}}},{key:"_startChangingSlide",value:function(_t){this.firstPosition=_t.screenX,this.firstLeft=Sr(this.pointer.style.left)||0,document.addEventListener("mousemove",this.eventHandler.changeSlide),document.addEventListener("mouseup",this.eventHandler.stopChangingSlide)}},{key:"_stopChangingSlide",value:function(){this.fire("change",this._value,!0),document.removeEventListener("mousemove",this.eventHandler.changeSlide),document.removeEventListener("mouseup",this.eventHandler.stopChangingSlide)}},{key:"_filterForInputText",value:function(_t){return _t.replace(Ul,"$1$2$3")}}]),Rt}();Xt().CustomEvents.mixin(ao);var jr=ao,so=function(){function Rt(Bt,_t){var Et=_t.locale,wt=_t.name,Tt=_t.makeSvgIcon,Dt=_t.menuBarPosition,kt=_t.templateHtml,Yt=_t.usageStatistics;Ht(this,Rt),this.subMenuElement=Bt,this.menuBarPosition=Dt,this.toggleDirection=Dt==="top"?"down":"up",this.colorPickerControls=[],this.usageStatistics=Yt,this.eventHandler={},this._makeSubMenuElement({locale:Et,name:wt,makeSvgIcon:Tt,templateHtml:kt})}return Wt(Rt,[{key:"selector",value:function(_t){return this.subMenuElement.querySelector(_t)}},{key:"colorPickerChangeShow",value:function(_t){var Et;Jt()(Et=this.colorPickerControls).call(Et,function(wt){_t!==wt&&wt.hide()})}},{key:"getButtonType",value:function(_t,Et){return _t.className.match(RegExp("(".concat(Et.join("|"),")")))[0]}},{key:"changeClass",value:function(_t,Et,wt){_t.classList.remove(Et),_t.classList.add(wt)}},{key:"changeStandbyMode",value:function(){}},{key:"changeStartMode",value:function(){}},{key:"_makeSubMenuElement",value:function(_t){var Et=_t.locale,wt=_t.name,Tt=_t.iconStyle,Dt=_t.makeSvgIcon,kt=_t.templateHtml,Yt=document.createElement("div");Yt.className="tui-image-editor-menu-".concat(wt),Yt.innerHTML=kt({locale:Et,iconStyle:Tt,makeSvgIcon:Dt}),this.subMenuElement.appendChild(Yt)}},{key:"_onStartEditingInputBox",value:function(){this.fire(xn.INPUT_BOX_EDITING_STARTED)}},{key:"_onStopEditingInputBox",value:function(){this.fire(xn.INPUT_BOX_EDITING_STOPPED)}}]),Rt}();_i.CustomEvents.mixin(so);var Rr=so,Hl=function(Rt){var Bt,_t,Et,wt,Tt,Dt,kt,Yt,zt=Rt.locale,en=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=Pt()(Dt=Pt()(kt=Pt()(Yt=`
    <ul class="tui-image-editor-submenu-item">
        <li class="tie-shape-button">
            <div class="tui-image-editor-button rect">
                <div>
                    `.concat(en(["normal","active"],"shape-rectangle",!0),`
                </div>
                <label> `)).call(Yt,zt.localize("Rectangle"),` </label>
            </div>
            <div class="tui-image-editor-button circle">
                <div>
                    `)).call(kt,en(["normal","active"],"shape-circle",!0),`
                </div>
                <label> `)).call(Dt,zt.localize("Circle"),` </label>
            </div>
            <div class="tui-image-editor-button triangle">
                <div>
                    `)).call(Tt,en(["normal","active"],"shape-triangle",!0),`
                </div>
                <label> `)).call(wt,zt.localize("Triangle"),` </label>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li class="tie-shape-color-button">
            <div class="tie-color-fill" title="`)).call(Et,zt.localize("Fill"),`"></div>
            <div class="tie-color-stroke" title="`)).call(_t,zt.localize("Stroke"),`"></div>
        </li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tui-image-editor-newline tui-image-editor-range-wrap">
            <label class="range">`)).call(Bt,zt.localize("Stroke"),`</label>
            <div class="tie-stroke-range"></div>
            <input class="tie-stroke-range-value tui-image-editor-range-value" value="0" />
        </li>
    </ul>
`)};function zl(Rt){var Bt=Ql();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Ql(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Vl={stroke:"#ffbb3b",fill:"",strokeWidth:3},Wl=function(Rt){lr(_t,Rt);var Bt=zl(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"shape",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:Hl,usageStatistics:zt}),Tt.type=null,Tt.options=Vl,Tt._els={shapeSelectButton:Tt.selector(".tie-shape-button"),shapeColorButton:Tt.selector(".tie-shape-color-button"),strokeRange:new jr({slider:Tt.selector(".tie-stroke-range"),input:Tt.selector(".tie-stroke-range-value")},xr),fillColorpicker:new zr(Tt.selector(".tie-color-fill"),{defaultColor:"",toggleDirection:Tt.toggleDirection,usageStatistics:Tt.usageStatistics}),strokeColorpicker:new zr(Tt.selector(".tie-color-stroke"),{defaultColor:"#ffbb3b",toggleDirection:Tt.toggleDirection,usageStatistics:Tt.usageStatistics})},Tt.colorPickerControls.push(Tt._els.fillColorpicker),Tt.colorPickerControls.push(Tt._els.strokeColorpicker),Tt.colorPickerInputBoxes=[],Tt.colorPickerInputBoxes.push(Tt._els.fillColorpicker.colorpickerElement.querySelector(Wn.COLOR_PICKER_INPUT_BOX)),Tt.colorPickerInputBoxes.push(Tt._els.strokeColorpicker.colorpickerElement.querySelector(Wn.COLOR_PICKER_INPUT_BOX)),Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),this._els.strokeRange.destroy(),this._els.fillColorpicker.destroy(),this._els.strokeColorpicker.destroy(),Mn(this)}},{key:"addEvent",value:function(wt){var Tt,Dt,kt,Yt,zt,en,an=this;this.eventHandler.shapeTypeSelected=Lt()(Tt=this._changeShapeHandler).call(Tt,this),this.actions=wt,this._els.shapeSelectButton.addEventListener("click",this.eventHandler.shapeTypeSelected),this._els.strokeRange.on("change",Lt()(Dt=this._changeStrokeRangeHandler).call(Dt,this)),this._els.fillColorpicker.on("change",Lt()(kt=this._changeFillColorHandler).call(kt,this)),this._els.strokeColorpicker.on("change",Lt()(Yt=this._changeStrokeColorHandler).call(Yt,this)),this._els.fillColorpicker.on("changeShow",Lt()(zt=this.colorPickerChangeShow).call(zt,this)),this._els.strokeColorpicker.on("changeShow",Lt()(en=this.colorPickerChangeShow).call(en,this)),Xt().forEachArray(this.colorPickerInputBoxes,function(vn){var yn,Cn;vn.addEventListener(xn.FOCUS,Lt()(yn=an._onStartEditingInputBox).call(yn,an)),vn.addEventListener(xn.BLUR,Lt()(Cn=an._onStopEditingInputBox).call(Cn,an))},this)}},{key:"_removeEvent",value:function(){var wt=this;this._els.shapeSelectButton.removeEventListener("click",this.eventHandler.shapeTypeSelected),this._els.strokeRange.off(),this._els.fillColorpicker.off(),this._els.strokeColorpicker.off(),Xt().forEachArray(this.colorPickerInputBoxes,function(Tt){var Dt,kt;Tt.removeEventListener(xn.FOCUS,Lt()(Dt=wt._onStartEditingInputBox).call(Dt,wt)),Tt.removeEventListener(xn.BLUR,Lt()(kt=wt._onStopEditingInputBox).call(kt,wt))},this)}},{key:"setShapeStatus",value:function(wt){var Tt=wt.strokeWidth,Dt=wt.strokeColor,kt=wt.fillColor;this._els.strokeRange.value=Tt,this._els.strokeColorpicker.color=Dt,this._els.fillColorpicker.color=kt,this.options.stroke=Dt,this.options.fill=kt,this.options.strokeWidth=Tt,this.actions.setDrawingShape(this.type,{strokeWidth:Tt})}},{key:"changeStartMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeStandbyMode",value:function(){this.type=null,this.actions.changeSelectableAll(!0),this._els.shapeSelectButton.classList.remove("circle"),this._els.shapeSelectButton.classList.remove("triangle"),this._els.shapeSelectButton.classList.remove("rect")}},{key:"setMaxStrokeValue",value:function(wt){var Tt=wt;Tt<=0&&(Tt=xr.max),this._els.strokeRange.max=Tt}},{key:"setStrokeValue",value:function(wt){this._els.strokeRange.value=wt,this._els.strokeRange.trigger("change")}},{key:"getStrokeValue",value:function(){return this._els.strokeRange.value}},{key:"_changeShapeHandler",value:function(wt){var Tt=wt.target.closest(".tui-image-editor-button");if(Tt){this.actions.stopDrawingMode(),this.actions.discardSelection();var Dt=this.getButtonType(Tt,["circle","triangle","rect"]);if(this.type===Dt){this.changeStandbyMode();return}this.changeStandbyMode(),this.type=Dt,wt.currentTarget.classList.add(Dt),this.actions.changeSelectableAll(!1),this.actions.modeChange("shape")}}},{key:"_changeStrokeRangeHandler",value:function(wt,Tt){this.options.strokeWidth=Sr(wt),this.actions.changeShape({strokeWidth:wt},!Tt),this.actions.setDrawingShape(this.type,this.options)}},{key:"_changeFillColorHandler",value:function(wt){wt=wt||"transparent",this.options.fill=wt,this.actions.changeShape({fill:wt})}},{key:"_changeStrokeColorHandler",value:function(wt){wt=wt||"transparent",this.options.stroke=wt,this.actions.changeShape({stroke:wt})}}]),_t}(Rr),Yl=Wl,Gl=function(Rt){var Bt,_t,Et,wt,Tt,Dt,kt,Yt,zt,en,an,vn,yn,Cn,wn,_n,Nn,Kn=Rt.locale,Zn=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=Pt()(Dt=Pt()(kt=Pt()(Yt=Pt()(zt=Pt()(en=Pt()(an=Pt()(vn=Pt()(yn=Pt()(Cn=Pt()(wn=Pt()(_n=Pt()(Nn=`
    <ul class="tui-image-editor-submenu-item">
        <li class="tie-crop-preset-button">
            <div class="tui-image-editor-button preset preset-none active">
                <div>
                    `.concat(Zn(["normal","active"],"shape-rectangle",!0),`
                </div>
                <label> `)).call(Nn,Kn.localize("Custom"),` </label>
            </div>
            <div class="tui-image-editor-button preset preset-square">
                <div>
                    `)).call(_n,Zn(["normal","active"],"crop",!0),`
                </div>
                <label> `)).call(wn,Kn.localize("Square"),` </label>
            </div>
            <div class="tui-image-editor-button preset preset-3-2">
                <div>
                    `)).call(Cn,Zn(["normal","active"],"crop",!0),`
                </div>
                <label> `)).call(yn,Kn.localize("3:2"),` </label>
            </div>
            <div class="tui-image-editor-button preset preset-4-3">
                <div>
                    `)).call(vn,Zn(["normal","active"],"crop",!0),`
                </div>
                <label> `)).call(an,Kn.localize("4:3"),` </label>
            </div>
            <div class="tui-image-editor-button preset preset-5-4">
                <div>
                    `)).call(en,Zn(["normal","active"],"crop",!0),`
                </div>
                <label> `)).call(zt,Kn.localize("5:4"),` </label>
            </div>
            <div class="tui-image-editor-button preset preset-7-5">
                <div>
                    `)).call(Yt,Zn(["normal","active"],"crop",!0),`
                </div>
                <label> `)).call(kt,Kn.localize("7:5"),` </label>
            </div>
            <div class="tui-image-editor-button preset preset-16-9">
                <div>
                    `)).call(Dt,Zn(["normal","active"],"crop",!0),`
                </div>
                <label> `)).call(Tt,Kn.localize("16:9"),` </label>
            </div>
        </li>
        <li class="tui-image-editor-partition tui-image-editor-newline">
        </li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tie-crop-button action">
            <div class="tui-image-editor-button apply">
                `)).call(wt,Zn(["normal","active"],"apply"),`
                <label>
                    `)).call(Et,Kn.localize("Apply"),`
                </label>
            </div>
            <div class="tui-image-editor-button cancel">
                `)).call(_t,Zn(["normal","active"],"cancel"),`
                <label>
                    `)).call(Bt,Kn.localize("Cancel"),`
                </label>
            </div>
        </li>
    </ul>
`)};function Xl(Rt){var Bt=Kl();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Kl(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var $l=function(Rt){lr(_t,Rt);var Bt=Xl(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"crop",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:Gl,usageStatistics:zt}),Tt.status="active",Tt._els={apply:Tt.selector(".tie-crop-button .apply"),cancel:Tt.selector(".tie-crop-button .cancel"),preset:Tt.selector(".tie-crop-preset-button")},Tt.defaultPresetButton=Tt._els.preset.querySelector(".preset-none"),Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),Mn(this)}},{key:"addEvent",value:function(wt){var Tt,Dt,kt,Yt=Lt()(Tt=this._applyEventHandler).call(Tt,this),zt=Lt()(Dt=this._cancelEventHandler).call(Dt,this),en=Lt()(kt=this._cropzonePresetEventHandler).call(kt,this);this.eventHandler={apply:Yt,cancel:zt,cropzonePreset:en},this.actions=wt,this._els.apply.addEventListener("click",Yt),this._els.cancel.addEventListener("click",zt),this._els.preset.addEventListener("click",en)}},{key:"_removeEvent",value:function(){this._els.apply.removeEventListener("click",this.eventHandler.apply),this._els.cancel.removeEventListener("click",this.eventHandler.cancel),this._els.preset.removeEventListener("click",this.eventHandler.cropzonePreset)}},{key:"_applyEventHandler",value:function(){this.actions.crop(),this._els.apply.classList.remove("active")}},{key:"_cancelEventHandler",value:function(){this.actions.cancel(),this._els.apply.classList.remove("active")}},{key:"_cropzonePresetEventHandler",value:function(wt){var Tt=wt.target.closest(".tui-image-editor-button.preset");if(Tt){var Dt=Tt.className.match(/preset-[^\s]+/),kt=gn(Dt,1),Yt=kt[0];this._setPresetButtonActive(Tt),this.actions.preset(Yt)}}},{key:"changeStartMode",value:function(){this.actions.modeChange("crop")}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode(),this._setPresetButtonActive()}},{key:"changeApplyButtonStatus",value:function(wt){wt?this._els.apply.classList.add("active"):this._els.apply.classList.remove("active")}},{key:"_setPresetButtonActive",value:function(){var wt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.defaultPresetButton;Jt()(Xt()).call(Xt(),ft()([]).call(this._els.preset.querySelectorAll(".preset")),function(Tt){Tt.classList.remove("active")}),wt&&wt.classList.add("active")}}]),_t}(Rr),Jl=$l,Zl=function(Rt){var Bt,_t,Et,wt,Tt,Dt,kt=Rt.locale,Yt=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=Pt()(Dt=`
    <ul class="tui-image-editor-submenu-item">
        <li class="tui-image-editor-submenu-align">
            <div class="tui-image-editor-range-wrap tui-image-editor-newline">
                <label class="range">`.concat(kt.localize("Width"),`&nbsp;</label>
                <div class="tie-width-range"></div>
                <input class="tie-width-range-value tui-image-editor-range-value" value="0" /> <label>px</label>
                <div class="tui-image-editor-partition tui-image-editor-newline"></div>
                <label class="range">`)).call(Dt,kt.localize("Height"),`</label>
                <div class="tie-height-range"></div>
                <input class="tie-height-range-value tui-image-editor-range-value" value="0" /> <label>px</label>
            </div>
        </li>
        <li class="tui-image-editor-partition tui-image-editor-newline"></li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tui-image-editor-submenu-align">
            <div class="tui-image-editor-checkbox-wrap">
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-lock-aspect-ratio">
                        <span>`)).call(Tt,kt.localize("Lock Aspect Ratio"),`</span>
                    </label>
                </div>
            </div>
        </li>
        <li class="tui-image-editor-partition tui-image-editor-newline"></li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tui-image-editor-partition tui-image-editor-newline"></li>
        <li class="tie-resize-button action">
            <div class="tui-image-editor-button apply">
                `)).call(wt,Yt(["normal","active"],"apply"),`
                <label>
                    `)).call(Et,kt.localize("Apply"),`
                </label>
            </div>
            <div class="tui-image-editor-button cancel">
                `)).call(_t,Yt(["normal","active"],"cancel"),`
                <label>
                    `)).call(Bt,kt.localize("Cancel"),`
                </label>
            </div>
        </li>
    </ul>
`)};function ql(Rt){var Bt=_c();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function _c(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var eu=function(Rt){lr(_t,Rt);var Bt=ql(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"resize",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:Zl,usageStatistics:zt}),Tt.status="active",Tt._lockState=!1,Tt._originalDimensions=null,Tt._els={widthRange:new jr({slider:Tt.selector(".tie-width-range"),input:Tt.selector(".tie-width-range-value")},br),heightRange:new jr({slider:Tt.selector(".tie-height-range"),input:Tt.selector(".tie-height-range-value")},br),lockAspectRatio:Tt.selector(".tie-lock-aspect-ratio"),apply:Tt.selector(".tie-resize-button .apply"),cancel:Tt.selector(".tie-resize-button .cancel")},Tt}return Wt(_t,[{key:"changeStartMode",value:function(){this.actions.modeChange("resize");var wt=this.actions.getCurrentDimensions();this._originalDimensions=wt,this.setWidthValue(wt.width),this.setHeightValue(wt.height)}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode(),this.actions.reset(!0)}},{key:"setLimit",value:function(wt){this._els.widthRange.min=this.calcMinValue(wt.minWidth),this._els.heightRange.min=this.calcMinValue(wt.minHeight),this._els.widthRange.max=this.calcMaxValue(wt.maxWidth),this._els.heightRange.max=this.calcMaxValue(wt.maxHeight)}},{key:"calcMaxValue",value:function(wt){return wt<=0&&(wt=br.max),wt}},{key:"calcMinValue",value:function(wt){return wt<=0&&(wt=br.min),wt}},{key:"setWidthValue",value:function(wt){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this._els.widthRange.value=wt,Tt&&this._els.widthRange.trigger("change")}},{key:"setHeightValue",value:function(wt){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this._els.heightRange.value=wt,Tt&&this._els.heightRange.trigger("change")}},{key:"destroy",value:function(){this._removeEvent(),Mn(this)}},{key:"addEvent",value:function(wt){var Tt,Dt,kt,Yt,zt;this._els.widthRange.on("change",Lt()(Tt=this._changeWidthRangeHandler).call(Tt,this)),this._els.heightRange.on("change",Lt()(Dt=this._changeHeightRangeHandler).call(Dt,this)),this._els.lockAspectRatio.addEventListener("change",Lt()(kt=this._changeLockAspectRatio).call(kt,this));var en=Lt()(Yt=this._applyEventHandler).call(Yt,this),an=Lt()(zt=this._cancelEventHandler).call(zt,this);this.eventHandler={apply:en,cancel:an},this.actions=wt,this._els.apply.addEventListener("click",en),this._els.cancel.addEventListener("click",an)}},{key:"_changeWidthRangeHandler",value:function(wt){this.actions.preview("width",Sr(wt),this._lockState)}},{key:"_changeHeightRangeHandler",value:function(wt){this.actions.preview("height",Sr(wt),this._lockState)}},{key:"_changeLockAspectRatio",value:function(wt){this._lockState=wt.target.checked,this.actions.lockAspectRatio(this._lockState,br.min,br.max)}},{key:"_removeEvent",value:function(){this._els.apply.removeEventListener("click",this.eventHandler.apply),this._els.cancel.removeEventListener("click",this.eventHandler.cancel)}},{key:"_applyEventHandler",value:function(){this.actions.resize(),this._els.apply.classList.remove("active")}},{key:"_cancelEventHandler",value:function(){this.actions.reset(),this._els.cancel.classList.remove("active")}},{key:"changeApplyButtonStatus",value:function(wt){wt?this._els.apply.classList.add("active"):this._els.apply.classList.remove("active")}}]),_t}(Rr),tu=eu,iu=function(Rt){var Bt,_t,Et,wt,Tt,Dt=Rt.locale,kt=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=`
    <ul class="tie-flip-button tui-image-editor-submenu-item">
        <li>
            <div class="tui-image-editor-button flipX">
                <div>
                    `.concat(kt(["normal","active"],"flip-x",!0),`
                </div>
                <label>
                    `)).call(Tt,Dt.localize("Flip X"),`
                </label>
            </div>
            <div class="tui-image-editor-button flipY">
                <div>
                    `)).call(wt,kt(["normal","active"],"flip-y",!0),`
                </div>
                <label>
                    `)).call(Et,Dt.localize("Flip Y"),`
                </label>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li>
            <div class="tui-image-editor-button resetFlip">
                <div>
                    `)).call(_t,kt(["normal","active"],"flip-reset",!0),`
                </div>
                <label>
                    `)).call(Bt,Dt.localize("Reset"),`
                </label>
            </div>
        </li>
    </ul>
`)};function nu(Rt){var Bt=ru();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function ru(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var au=function(Rt){lr(_t,Rt);var Bt=nu(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"flip",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:iu,usageStatistics:zt}),Tt.flipStatus=!1,Tt._els={flipButton:Tt.selector(".tie-flip-button")},Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),Mn(this)}},{key:"addEvent",value:function(wt){var Tt;this.eventHandler.changeFlip=Lt()(Tt=this._changeFlip).call(Tt,this),this._actions=wt,this._els.flipButton.addEventListener("click",this.eventHandler.changeFlip)}},{key:"_removeEvent",value:function(){this._els.flipButton.removeEventListener("click",this.eventHandler.changeFlip)}},{key:"_changeFlip",value:function(wt){var Tt=this,Dt=wt.target.closest(".tui-image-editor-button");if(Dt){var kt=this.getButtonType(Dt,["flipX","flipY","resetFlip"]);if(!this.flipStatus&&kt==="resetFlip")return;this._actions.flip(kt).then(function(Yt){var zt=Tt._els.flipButton.classList;Tt.flipStatus=!1,zt.remove("resetFlip"),Jt()(Xt()).call(Xt(),["flipX","flipY"],function(en){zt.remove(en),Yt[en]&&(zt.add(en),zt.add("resetFlip"),Tt.flipStatus=!0)})})}}}]),_t}(Rr),su=au,ou=function(Rt){var Bt,_t,Et=Rt.locale,wt=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=`
    <ul class="tui-image-editor-submenu-item">
        <li class="tie-rotate-button">
            <div class="tui-image-editor-button clockwise">
                <div>
                    `.concat(wt(["normal","active"],"rotate-clockwise",!0),`
                </div>
                <label> 30 </label>
            </div>
            <div class="tui-image-editor-button counterclockwise">
                <div>
                    `)).call(_t,wt(["normal","active"],"rotate-counterclockwise",!0),`
                </div>
                <label> -30 </label>
            </div>
        </li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tui-image-editor-newline tui-image-editor-range-wrap">
            <label class="range">`)).call(Bt,Et.localize("Range"),`</label>
            <div class="tie-rotate-range"></div>
            <input class="tie-rotate-range-value tui-image-editor-range-value" value="0" />
        </li>
    </ul>
`)};function lu(Rt){var Bt=cu();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function cu(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var uu=30,fu=-30,hu=function(Rt){lr(_t,Rt);var Bt=lu(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"rotate",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:ou,usageStatistics:zt}),Tt._value=0,Tt._els={rotateButton:Tt.selector(".tie-rotate-button"),rotateRange:new jr({slider:Tt.selector(".tie-rotate-range"),input:Tt.selector(".tie-rotate-range-value")},pr)},Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),this._els.rotateRange.destroy(),Mn(this)}},{key:"setRangeBarAngle",value:function(wt,Tt){var Dt=Tt;wt==="rotate"&&(Dt=dn()(this._els.rotateRange.value,10)+Tt),this._setRangeBarRatio(Dt)}},{key:"_setRangeBarRatio",value:function(wt){this._els.rotateRange.value=wt}},{key:"addEvent",value:function(wt){var Tt,Dt;this.eventHandler.rotationAngleChanged=Lt()(Tt=this._changeRotateForButton).call(Tt,this),this.actions=wt,this._els.rotateButton.addEventListener("click",this.eventHandler.rotationAngleChanged),this._els.rotateRange.on("change",Lt()(Dt=this._changeRotateForRange).call(Dt,this))}},{key:"_removeEvent",value:function(){this._els.rotateButton.removeEventListener("click",this.eventHandler.rotationAngleChanged),this._els.rotateRange.off()}},{key:"_changeRotateForRange",value:function(wt,Tt){var Dt=Sr(wt);this.actions.setAngle(Dt,!Tt),this._value=Dt}},{key:"_changeRotateForButton",value:function(wt){var Tt=wt.target.closest(".tui-image-editor-button"),Dt=this._els.rotateRange.value;if(Tt){var kt=this.getButtonType(Tt,["counterclockwise","clockwise"]),Yt={clockwise:uu,counterclockwise:fu}[kt],zt=dn()(Dt,10)+Yt,en=zt>=-360&&zt<=360;en&&this.actions.rotate(Yt)}}}]),_t}(Rr),du=hu,pu=function(Rt){var Bt,_t,Et,wt,Tt,Dt,kt,Yt,zt,en,an,vn,yn,Cn=Rt.locale,wn=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=Pt()(Dt=Pt()(kt=Pt()(Yt=Pt()(zt=Pt()(en=Pt()(an=Pt()(vn=Pt()(yn=`
    <ul class="tui-image-editor-submenu-item">
        <li class="tie-text-effect-button">
            <div class="tui-image-editor-button bold">
                <div>
                    `.concat(wn(["normal","active"],"text-bold",!0),`
                </div>
                <label> `)).call(yn,Cn.localize("Bold"),` </label>
            </div>
            <div class="tui-image-editor-button italic">
                <div>
                    `)).call(vn,wn(["normal","active"],"text-italic",!0),`
                </div>
                <label> `)).call(an,Cn.localize("Italic"),` </label>
            </div>
            <div class="tui-image-editor-button underline">
                <div>
                    `)).call(en,wn(["normal","active"],"text-underline",!0),`
                </div>
                <label> `)).call(zt,Cn.localize("Underline"),` </label>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li class="tie-text-align-button">
            <div class="tui-image-editor-button left">
                <div>
                    `)).call(Yt,wn(["normal","active"],"text-align-left",!0),`
                </div>
                <label> `)).call(kt,Cn.localize("Left"),` </label>
            </div>
            <div class="tui-image-editor-button center">
                <div>
                    `)).call(Dt,wn(["normal","active"],"text-align-center",!0),`
                </div>
                <label> `)).call(Tt,Cn.localize("Center"),` </label>
            </div>
            <div class="tui-image-editor-button right">
                <div>
                    `)).call(wt,wn(["normal","active"],"text-align-right",!0),`
                </div>
                <label> `)).call(Et,Cn.localize("Right"),` </label>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li>
            <div class="tie-text-color" title="`)).call(_t,Cn.localize("Color"),`"></div>
        </li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tui-image-editor-newline tui-image-editor-range-wrap">
            <label class="range">`)).call(Bt,Cn.localize("Text size"),`</label>
            <div class="tie-text-range"></div>
            <input class="tie-text-range-value tui-image-editor-range-value" value="0" />
        </li>
    </ul>
`)};function gu(Rt){var Bt=Au();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Au(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var mu=function(Rt){lr(_t,Rt);var Bt=gu(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"text",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:pu,usageStatistics:zt}),Tt.effect={bold:!1,italic:!1,underline:!1},Tt.align="tie-text-align-left",Tt._els={textEffectButton:Tt.selector(".tie-text-effect-button"),textAlignButton:Tt.selector(".tie-text-align-button"),textColorpicker:new zr(Tt.selector(".tie-text-color"),{defaultColor:"#ffbb3b",toggleDirection:Tt.toggleDirection,usageStatistics:Tt.usageStatistics}),textRange:new jr({slider:Tt.selector(".tie-text-range"),input:Tt.selector(".tie-text-range-value")},_r)},Tt.colorPickerInputBox=Tt._els.textColorpicker.colorpickerElement.querySelector(Wn.COLOR_PICKER_INPUT_BOX),Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),this._els.textColorpicker.destroy(),this._els.textRange.destroy(),Mn(this)}},{key:"addEvent",value:function(wt){var Tt,Dt,kt,Yt,zt,en,an=Lt()(Tt=this._setTextEffectHandler).call(Tt,this),vn=Lt()(Dt=this._setTextAlignHandler).call(Dt,this);this.eventHandler={setTextEffect:an,setTextAlign:vn},this.actions=wt,this._els.textEffectButton.addEventListener("click",an),this._els.textAlignButton.addEventListener("click",vn),this._els.textRange.on("change",Lt()(kt=this._changeTextRnageHandler).call(kt,this)),this._els.textColorpicker.on("change",Lt()(Yt=this._changeColorHandler).call(Yt,this)),this.colorPickerInputBox.addEventListener(xn.FOCUS,Lt()(zt=this._onStartEditingInputBox).call(zt,this)),this.colorPickerInputBox.addEventListener(xn.BLUR,Lt()(en=this._onStopEditingInputBox).call(en,this))}},{key:"_removeEvent",value:function(){var wt,Tt,Dt=this.eventHandler,kt=Dt.setTextEffect,Yt=Dt.setTextAlign;this._els.textEffectButton.removeEventListener("click",kt),this._els.textAlignButton.removeEventListener("click",Yt),this._els.textRange.off(),this._els.textColorpicker.off(),this.colorPickerInputBox.removeEventListener(xn.FOCUS,Lt()(wt=this._onStartEditingInputBox).call(wt,this)),this.colorPickerInputBox.removeEventListener(xn.BLUR,Lt()(Tt=this._onStopEditingInputBox).call(Tt,this))}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeStartMode",value:function(){this.actions.modeChange("text")}},{key:"textColor",get:function(){return this._els.textColorpicker.color},set:function(wt){this._els.textColorpicker.color=wt}},{key:"fontSize",get:function(){return this._els.textRange.value},set:function(wt){this._els.textRange.value=wt}},{key:"fontStyle",get:function(){return this.effect.italic?"italic":"normal"}},{key:"fontWeight",get:function(){return this.effect.bold?"bold":"normal"}},{key:"underline",get:function(){return this.effect.underline}},{key:"setTextStyleStateOnAction",value:function(){var wt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Tt=sn()(wt),Dt=wt.fontSize,kt=wt.fontStyle,Yt=wt.fontWeight,zt=wt.textDecoration,en=wt.textAlign;this.textColor=Tt,this.fontSize=Dt,this.setEffectState("italic",kt),this.setEffectState("bold",Yt),this.setEffectState("underline",zt),this.setAlignState("tie-text-align-".concat(en))}},{key:"setEffectState",value:function(wt,Tt){var Dt=Tt==="italic"||Tt==="bold"||Tt==="underline",kt=this._els.textEffectButton.querySelector(".tui-image-editor-button.".concat(wt));this.effect[wt]=Dt,kt.classList[Dt?"add":"remove"]("active")}},{key:"setAlignState",value:function(wt){var Tt=this._els.textAlignButton;Tt.classList.remove(this.align),Tt.classList.add(wt),this.align=wt}},{key:"_setTextEffectHandler",value:function(wt){var Tt=wt.target.closest(".tui-image-editor-button");if(Tt){var Dt=Tt.className.match(/(bold|italic|underline)/),kt=gn(Dt,1),Yt=kt[0],zt={bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},underline:{textDecoration:"underline"}}[Yt];this.effect[Yt]=!this.effect[Yt],Tt.classList.toggle("active"),this.actions.changeTextStyle(zt)}}},{key:"_setTextAlignHandler",value:function(wt){var Tt=wt.target.closest(".tui-image-editor-button");if(Tt){var Dt=this.getButtonType(Tt,["left","center","right"]),kt="tie-text-align-".concat(Dt);wt.currentTarget.classList.remove(this.align),this.align!==kt&&wt.currentTarget.classList.add(kt),this.actions.changeTextStyle({textAlign:Dt}),this.align=kt}}},{key:"_changeTextRnageHandler",value:function(wt,Tt){this.actions.changeTextStyle({fontSize:wt},!Tt)}},{key:"_changeColorHandler",value:function(wt){wt=wt||"transparent",this.actions.changeTextStyle({fill:wt})}}]),_t}(Rr),vu=mu,yu=function(Rt){var Bt,_t,Et,wt=Rt.locale,Tt=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=Pt()(Et=`
    <ul class="tui-image-editor-submenu-item">
        <li>
            <div class="tui-image-editor-button">
                <div>
                    <input type="file" accept="image/*" class="tie-mask-image-file">
                    `.concat(Tt(["normal","active"],"mask-load",!0),`
                </div>
                <label> `)).call(Et,wt.localize("Load Mask Image"),` </label>
            </div>
        </li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tie-mask-apply tui-image-editor-newline apply" style="margin-top: 22px;margin-bottom: 5px">
            <div class="tui-image-editor-button apply">
                `)).call(_t,Tt(["normal","active"],"apply"),`
                <label>
                    `)).call(Bt,wt.localize("Apply"),`
                </label>
            </div>
        </li>
    </ul>
`)};function bu(Rt){var Bt=xu();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function xu(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Cu=function(Rt){lr(_t,Rt);var Bt=bu(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"mask",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:yu,usageStatistics:zt}),Tt._els={applyButton:Tt.selector(".tie-mask-apply"),maskImageButton:Tt.selector(".tie-mask-image-file")},Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),Mn(this)}},{key:"addEvent",value:function(wt){var Tt,Dt,kt=Lt()(Tt=this._loadMaskFile).call(Tt,this),Yt=Lt()(Dt=this._applyMask).call(Dt,this);this.eventHandler={loadMaskFile:kt,applyMask:Yt},this.actions=wt,this._els.maskImageButton.addEventListener("change",kt),this._els.applyButton.addEventListener("click",Yt)}},{key:"_removeEvent",value:function(){this._els.maskImageButton.removeEventListener("change",this.eventHandler.loadMaskFile),this._els.applyButton.removeEventListener("click",this.eventHandler.applyMask)}},{key:"_applyMask",value:function(){this.actions.applyFilter(),this._els.applyButton.classList.remove("active")}},{key:"_loadMaskFile",value:function(wt){var Tt;Wr()||alert("This browser does not support file-api");var Dt=gn(wt.target.files,1),kt=Dt[0];kt&&(Tt=tn().createObjectURL(kt),this.actions.loadImageFromURL(Tt,kt),this._els.applyButton.classList.add("active"))}}]),_t}(Rr),wu=Cu,_u=function(Rt){var Bt,_t,Et,wt,Tt,Dt,kt,Yt,zt,en,an,vn,yn,Cn,wn,_n,Nn,Kn,Zn,er,Gn=Rt.locale,ur=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=Pt()(Dt=Pt()(kt=Pt()(Yt=Pt()(zt=Pt()(en=Pt()(an=Pt()(vn=Pt()(yn=Pt()(Cn=Pt()(wn=Pt()(_n=Pt()(Nn=Pt()(Kn=Pt()(Zn=Pt()(er=`
    <ul class="tui-image-editor-submenu-item">
        <li class="tie-icon-add-button">
            <div class="tui-image-editor-button" data-icontype="icon-arrow">
                <div>
                    `.concat(ur(["normal","active"],"icon-arrow",!0),`
                </div>
                <label>
                    `)).call(er,Gn.localize("Arrow"),`
                </label>
            </div>
            <div class="tui-image-editor-button" data-icontype="icon-arrow-2">
                <div>
                    `)).call(Zn,ur(["normal","active"],"icon-arrow-2",!0),`
                </div>
                <label>
                    `)).call(Kn,Gn.localize("Arrow-2"),`
                </label>
            </div>
            <div class="tui-image-editor-button" data-icontype="icon-arrow-3">
                <div>
                    `)).call(Nn,ur(["normal","active"],"icon-arrow-3",!0),`
                </div>
                <label>
                    `)).call(_n,Gn.localize("Arrow-3"),`
                </label>
            </div>
            <div class="tui-image-editor-button" data-icontype="icon-star">
                <div>
                    `)).call(wn,ur(["normal","active"],"icon-star",!0),`
                </div>
                <label>
                    `)).call(Cn,Gn.localize("Star-1"),`
                </label>
            </div>
            <div class="tui-image-editor-button" data-icontype="icon-star-2">
                <div>
                    `)).call(yn,ur(["normal","active"],"icon-star-2",!0),`
                </div>
                <label>
                    `)).call(vn,Gn.localize("Star-2"),`
                </label>
            </div>

            <div class="tui-image-editor-button" data-icontype="icon-polygon">
                <div>
                    `)).call(an,ur(["normal","active"],"icon-polygon",!0),`
                </div>
                <label>
                    `)).call(en,Gn.localize("Polygon"),`
                </label>
            </div>

            <div class="tui-image-editor-button" data-icontype="icon-location">
                <div>
                    `)).call(zt,ur(["normal","active"],"icon-location",!0),`
                </div>
                <label>
                    `)).call(Yt,Gn.localize("Location"),`
                </label>
            </div>

            <div class="tui-image-editor-button" data-icontype="icon-heart">
                <div>
                    `)).call(kt,ur(["normal","active"],"icon-heart",!0),`
                </div>
                <label>
                    `)).call(Dt,Gn.localize("Heart"),`
                </label>
            </div>

            <div class="tui-image-editor-button" data-icontype="icon-bubble">
                <div>
                    `)).call(Tt,ur(["normal","active"],"icon-bubble",!0),`
                </div>
                <label>
                    `)).call(wt,Gn.localize("Bubble"),`
                </label>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li class="tie-icon-add-button">
            <div class="tui-image-editor-button" style="margin:0">
                <div>
                    <input type="file" accept="image/*" class="tie-icon-image-file">
                    `)).call(Et,ur(["normal","active"],"icon-load",!0),`
                </div>
                <label>
                    `)).call(_t,Gn.localize("Custom icon"),`
                </label>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li>
            <div class="tie-icon-color" title="`)).call(Bt,Gn.localize("Color"),`"></div>
        </li>
    </ul>
`)};function Su(Rt){var Bt=Eu();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Eu(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Tu=function(Rt){lr(_t,Rt);var Bt=Su(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"icon",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:_u,usageStatistics:zt}),Tt.iconType=null,Tt._iconMap={},Tt._els={registerIconButton:Tt.selector(".tie-icon-image-file"),addIconButton:Tt.selector(".tie-icon-add-button"),iconColorpicker:new zr(Tt.selector(".tie-icon-color"),{defaultColor:"#ffbb3b",toggleDirection:Tt.toggleDirection,usageStatistics:Tt.usageStatistics})},Tt.colorPickerInputBox=Tt._els.iconColorpicker.colorpickerElement.querySelector(Wn.COLOR_PICKER_INPUT_BOX),Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),this._els.iconColorpicker.destroy(),Mn(this)}},{key:"addEvent",value:function(wt){var Tt,Dt,kt,Yt,zt,en=Lt()(Tt=this._registerIconHandler).call(Tt,this),an=Lt()(Dt=this._addIconHandler).call(Dt,this);this.eventHandler={registerIcon:en,addIcon:an},this.actions=wt,this._els.iconColorpicker.on("change",Lt()(kt=this._changeColorHandler).call(kt,this)),this._els.registerIconButton.addEventListener("change",en),this._els.addIconButton.addEventListener("click",an),this.colorPickerInputBox.addEventListener(xn.FOCUS,Lt()(Yt=this._onStartEditingInputBox).call(Yt,this)),this.colorPickerInputBox.addEventListener(xn.BLUR,Lt()(zt=this._onStopEditingInputBox).call(zt,this))}},{key:"_removeEvent",value:function(){var wt,Tt;this._els.iconColorpicker.off(),this._els.registerIconButton.removeEventListener("change",this.eventHandler.registerIcon),this._els.addIconButton.removeEventListener("click",this.eventHandler.addIcon),this.colorPickerInputBox.removeEventListener(xn.FOCUS,Lt()(wt=this._onStartEditingInputBox).call(wt,this)),this.colorPickerInputBox.removeEventListener(xn.BLUR,Lt()(Tt=this._onStopEditingInputBox).call(Tt,this))}},{key:"clearIconType",value:function(){this._els.addIconButton.classList.remove(this.iconType),this.iconType=null}},{key:"registerDefaultIcon",value:function(){var wt=this;Jt()(Xt()).call(Xt(),rr,function(Tt,Dt){wt.actions.registerDefaultIcons(Dt,Tt)})}},{key:"setIconPickerColor",value:function(wt){this._els.iconColorpicker.color=wt}},{key:"changeStandbyMode",value:function(){this.clearIconType(),this.actions.cancelAddIcon()}},{key:"_changeColorHandler",value:function(wt){wt=wt||"transparent",this.actions.changeColor(wt)}},{key:"_addIconHandler",value:function(wt){var Tt=wt.target.closest(".tui-image-editor-button");if(Tt){var Dt=Tt.getAttribute("data-icontype"),kt=this._els.iconColorpicker.color;this.actions.discardSelection(),this.actions.changeSelectableAll(!1),this._els.addIconButton.classList.remove(this.iconType),this._els.addIconButton.classList.add(Dt),this.iconType===Dt?this.changeStandbyMode():(this.actions.addIcon(Dt,kt),this.iconType=Dt)}}},{key:"_registerIconHandler",value:function(wt){var Tt;Wr||alert("This browser does not support file-api");var Dt=gn(wt.target.files,1),kt=Dt[0];kt&&(Tt=tn().createObjectURL(kt),this.actions.registerCustomIcon(Tt,kt))}}]),_t}(Rr),Iu=Tu,Bu=function(Rt){var Bt,_t,Et,wt,Tt,Dt=Rt.locale,kt=Rt.makeSvgIcon;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=`
    <ul class="tui-image-editor-submenu-item">
        <li class="tie-draw-line-select-button">
            <div class="tui-image-editor-button free">
                <div>
                    `.concat(kt(["normal","active"],"draw-free",!0),`
                </div>
                <label>
                    `)).call(Tt,Dt.localize("Free"),`
                </label>
            </div>
            <div class="tui-image-editor-button line">
                <div>
                    `)).call(wt,kt(["normal","active"],"draw-line",!0),`
                </div>
                <label>
                    `)).call(Et,Dt.localize("Straight"),`
                </label>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li>
            <div class="tie-draw-color" title="`)).call(_t,Dt.localize("Color"),`"></div>
        </li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tui-image-editor-newline tui-image-editor-range-wrap">
            <label class="range">`)).call(Bt,Dt.localize("Range"),`</label>
            <div class="tie-draw-range"></div>
            <input class="tie-draw-range-value tui-image-editor-range-value" value="0" />
        </li>
    </ul>
`)};function Mu(Rt){var Bt=Ou();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Ou(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Du=.7,ju=function(Rt){lr(_t,Rt);var Bt=Mu(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon,Yt=wt.menuBarPosition,zt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"draw",makeSvgIcon:kt,menuBarPosition:Yt,templateHtml:Bu,usageStatistics:zt}),Tt._els={lineSelectButton:Tt.selector(".tie-draw-line-select-button"),drawColorPicker:new zr(Tt.selector(".tie-draw-color"),{defaultColor:"#00a9ff",toggleDirection:Tt.toggleDirection,usageStatistics:Tt.usageStatistics}),drawRange:new jr({slider:Tt.selector(".tie-draw-range"),input:Tt.selector(".tie-draw-range-value")},mr)},Tt.type=null,Tt.color=Tt._els.drawColorPicker.color,Tt.width=Tt._els.drawRange.value,Tt.colorPickerInputBox=Tt._els.drawColorPicker.colorpickerElement.querySelector(Wn.COLOR_PICKER_INPUT_BOX),Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),this._els.drawColorPicker.destroy(),this._els.drawRange.destroy(),Mn(this)}},{key:"addEvent",value:function(wt){var Tt,Dt,kt,Yt,zt;this.eventHandler.changeDrawType=Lt()(Tt=this._changeDrawType).call(Tt,this),this.actions=wt,this._els.lineSelectButton.addEventListener("click",this.eventHandler.changeDrawType),this._els.drawColorPicker.on("change",Lt()(Dt=this._changeDrawColor).call(Dt,this)),this._els.drawRange.on("change",Lt()(kt=this._changeDrawRange).call(kt,this)),this.colorPickerInputBox.addEventListener(xn.FOCUS,Lt()(Yt=this._onStartEditingInputBox).call(Yt,this)),this.colorPickerInputBox.addEventListener(xn.BLUR,Lt()(zt=this._onStopEditingInputBox).call(zt,this))}},{key:"_removeEvent",value:function(){var wt,Tt;this._els.lineSelectButton.removeEventListener("click",this.eventHandler.changeDrawType),this._els.drawColorPicker.off(),this._els.drawRange.off(),this.colorPickerInputBox.removeEventListener(xn.FOCUS,Lt()(wt=this._onStartEditingInputBox).call(wt,this)),this.colorPickerInputBox.removeEventListener(xn.BLUR,Lt()(Tt=this._onStopEditingInputBox).call(Tt,this))}},{key:"setDrawMode",value:function(){this.actions.setDrawMode(this.type,{width:this.width,color:ss(this.color,Du)})}},{key:"changeStandbyMode",value:function(){this.type=null,this.actions.stopDrawingMode(),this.actions.changeSelectableAll(!0),this._els.lineSelectButton.classList.remove("free"),this._els.lineSelectButton.classList.remove("line")}},{key:"changeStartMode",value:function(){this.type="free",this._els.lineSelectButton.classList.add("free"),this.setDrawMode()}},{key:"_changeDrawType",value:function(wt){var Tt=wt.target.closest(".tui-image-editor-button");if(Tt){var Dt=this.getButtonType(Tt,["free","line"]);if(this.actions.discardSelection(),this.type===Dt){this.changeStandbyMode();return}this.changeStandbyMode(),this.type=Dt,this._els.lineSelectButton.classList.add(Dt),this.setDrawMode()}}},{key:"_changeDrawColor",value:function(wt){this.color=wt||"transparent",this.type?this.setDrawMode():this.changeStartMode()}},{key:"_changeDrawRange",value:function(wt){this.width=wt,this.type?this.setDrawMode():this.changeStartMode()}}]),_t}(Rr),Fu=ju,Nu=function(Rt){var Bt,_t,Et,wt,Tt,Dt,kt,Yt,zt,en,an,vn,yn,Cn,wn,_n,Nn=Rt.locale;return Pt()(Bt=Pt()(_t=Pt()(Et=Pt()(wt=Pt()(Tt=Pt()(Dt=Pt()(kt=Pt()(Yt=Pt()(zt=Pt()(en=Pt()(an=Pt()(vn=Pt()(yn=Pt()(Cn=Pt()(wn=Pt()(_n=`
    <ul class="tui-image-editor-submenu-item">
        <li class="tui-image-editor-submenu-align">
            <div class="tui-image-editor-checkbox-wrap fixed-width">
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-grayscale">
                        <span>`.concat(Nn.localize("Grayscale"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-invert">
                        <span>`)).call(_n,Nn.localize("Invert"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-sepia">
                        <span>`)).call(wn,Nn.localize("Sepia"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-vintage">
                        <span>`)).call(Cn,Nn.localize("Sepia2"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-blur">
                        <span>`)).call(yn,Nn.localize("Blur"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-sharpen">
                        <span>`)).call(vn,Nn.localize("Sharpen"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-emboss">
                        <span>`)).call(an,Nn.localize("Emboss"),`</span>
                    </label>
                </div>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li class="tui-image-editor-submenu-align">
            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled" style="margin-bottom: 7px;">
                <div class="tui-image-editor-checkbox-wrap">
                    <div class="tui-image-editor-checkbox">
                        <label>
                            <input type="checkbox" class="tie-remove-white">
                            <span>`)).call(en,Nn.localize("Remove White"),`</span>
                        </label>
                    </div>
                </div>
                <div class="tui-image-editor-newline tui-image-editor-range-wrap short">
                    <label>`)).call(zt,Nn.localize("Distance"),`</label>
                    <div class="tie-removewhite-distance-range"></div>
                </div>
            </div>
            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-brightness">
                        <span>`)).call(Yt,Nn.localize("Brightness"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-range-wrap short">
                    <div class="tie-brightness-range"></div>
                </div>
            </div>
            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-noise">
                        <span>`)).call(kt,Nn.localize("Noise"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-range-wrap short">
                    <div class="tie-noise-range"></div>
                </div>
            </div>
        </li>
        <li class="tui-image-editor-partition only-left-right">
            <div></div>
        </li>
        <li class="tui-image-editor-submenu-align">
            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-pixelate">
                        <span>`)).call(Dt,Nn.localize("Pixelate"),`</span>
                    </label>
                </div>
                <div class="tui-image-editor-range-wrap short">
                    <div class="tie-pixelate-range"></div>
                </div>
            </div>
            <div class="tui-image-editor-checkbox-group tui-image-editor-disabled">
                <div class="tui-image-editor-newline tui-image-editor-checkbox-wrap">
                    <div class="tui-image-editor-checkbox">
                        <label>
                            <input type="checkbox" class="tie-color-filter">
                            <span>`)).call(Tt,Nn.localize("Color Filter"),`</span>
                        </label>
                    </div>
                </div>
                <div class="tui-image-editor-newline tui-image-editor-range-wrap short">
                    <label>`)).call(wt,Nn.localize("Threshold"),`</label>
                    <div class="tie-colorfilter-threshold-range"></div>
                </div>
            </div>
        </li>
        <li class="tui-image-editor-partition">
            <div></div>
        </li>
        <li>
            <div class="filter-color-item">
                <div class="tie-filter-tint-color" title="`)).call(Et,Nn.localize("Tint"),`"></div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-tint">
                        <span></span>
                    </label>
                </div>
            </div>
            <div class="filter-color-item">
                <div class="tie-filter-multiply-color" title="`)).call(_t,Nn.localize("Multiply"),`"></div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-multiply">
                        <span></span>
                    </label>
                </div>
            </div>
            <div class="filter-color-item">
                <div class="tie-filter-blend-color" title="`)).call(Bt,Nn.localize("Blend"),`"></div>
                <div class="tui-image-editor-checkbox">
                    <label>
                        <input type="checkbox" class="tie-blend">
                        <span></span>
                    </label>
                </div>
            </div>
        </li>
    </ul>
`)};function Lu(Rt){var Bt=ku();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function ku(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var oo="130px",Pu=["add","diff","subtract","multiply","screen","lighten","darken"],lo=["grayscale","invert","sepia","vintage","blur","sharpen","emboss","remove-white","brightness","noise","pixelate","color-filter","tint","multiply","blend"],Ru={grayscale:"grayscale",invert:"invert",sepia:"sepia",blur:"blur",sharpen:"sharpen",emboss:"emboss",removeWhite:"removeColor",brightness:"brightness",contrast:"contrast",saturation:"saturation",vintage:"vintage",polaroid:"polaroid",noise:"noise",pixelate:"pixelate",colorFilter:"removeColor",tint:"blendColor",multiply:"blendColor",blend:"blendColor",hue:"hue",gamma:"gamma"},co=["removewhiteDistanceRange","colorfilterThresholdRange","pixelateRange","noiseRange","brightnessRange","tintOpacity"],uo=["filterBlendColor","filterMultiplyColor","filterTintColor"],Uu=function(Rt){lr(_t,Rt);var Bt=Lu(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.menuBarPosition,Yt=wt.usageStatistics;return Ht(this,_t),Tt=Bt.call(this,Et,{locale:Dt,name:"filter",menuBarPosition:kt,templateHtml:Nu,usageStatistics:Yt}),Tt.selectBoxShow=!1,Tt.checkedMap={},Tt._makeControlElement(),Tt}return Wt(_t,[{key:"destroy",value:function(){this._removeEvent(),this._destroyToolInstance(),Mn(this)}},{key:"_removeEvent",value:function(){var wt=this,Tt;Jt()(Xt()).call(Xt(),lo,function(Dt){var kt=wt.selector(".tie-".concat(Dt)),Yt=qr(Dt);kt.removeEventListener("change",wt.eventHandler[Yt])}),Jt()(Xt()).call(Xt(),Pt()(Tt=[]).call(Tt,co,uo),function(Dt){wt._els[Dt].off()}),this._els.blendType.removeEventListener("change",this.eventHandler.changeBlendFilter),this._els.blendType.removeEventListener("click",this.eventHandler.changeBlendFilter),Xt().forEachArray(this.colorPickerInputBoxes,function(Dt){var kt,Yt;Dt.removeEventListener(xn.FOCUS,Lt()(kt=wt._onStartEditingInputBox).call(kt,wt)),Dt.removeEventListener(xn.BLUR,Lt()(Yt=wt._onStopEditingInputBox).call(Yt,wt))},this)}},{key:"_destroyToolInstance",value:function(){var wt,Tt=this;Jt()(Xt()).call(Xt(),Pt()(wt=[]).call(wt,co,uo),function(Dt){Tt._els[Dt].destroy()})}},{key:"addEvent",value:function(wt){var Tt=this,Dt,kt,Yt,zt=wt.applyFilter,en=function(yn){var Cn;return Lt()(Cn=Tt._changeFilterState).call(Cn,Tt,zt,yn)},an=function(yn){return function(Cn,wn){return Tt._changeFilterState(zt,yn,wn)}};this.eventHandler={changeBlendFilter:en("blend"),blandTypeClick:function(yn){return yn.stopPropagation()}},Jt()(Xt()).call(Xt(),lo,function(vn){var yn=Tt.selector(".tie-".concat(vn)),Cn=qr(vn);Tt.checkedMap[Cn]=yn,Tt.eventHandler[Cn]=en(Cn),yn.addEventListener("change",Tt.eventHandler[Cn])}),this._els.removewhiteDistanceRange.on("change",an("removeWhite")),this._els.colorfilterThresholdRange.on("change",an("colorFilter")),this._els.pixelateRange.on("change",an("pixelate")),this._els.noiseRange.on("change",an("noise")),this._els.brightnessRange.on("change",an("brightness")),this._els.filterBlendColor.on("change",this.eventHandler.changeBlendFilter),this._els.filterMultiplyColor.on("change",en("multiply")),this._els.filterTintColor.on("change",en("tint")),this._els.tintOpacity.on("change",an("tint")),this._els.filterMultiplyColor.on("changeShow",Lt()(Dt=this.colorPickerChangeShow).call(Dt,this)),this._els.filterTintColor.on("changeShow",Lt()(kt=this.colorPickerChangeShow).call(kt,this)),this._els.filterBlendColor.on("changeShow",Lt()(Yt=this.colorPickerChangeShow).call(Yt,this)),this._els.blendType.addEventListener("change",this.eventHandler.changeBlendFilter),this._els.blendType.addEventListener("click",this.eventHandler.blandTypeClick),Xt().forEachArray(this.colorPickerInputBoxes,function(vn){var yn,Cn;vn.addEventListener(xn.FOCUS,Lt()(yn=Tt._onStartEditingInputBox).call(yn,Tt)),vn.addEventListener(xn.BLUR,Lt()(Cn=Tt._onStopEditingInputBox).call(Cn,Tt))},this)}},{key:"setFilterState",value:function(wt){var Tt=wt.type,Dt=wt.options,kt=wt.action,Yt=this._getFilterNameFromOptions(Tt,Dt),zt=kt==="remove";zt||this._setFilterState(Yt,Dt),this.checkedMap[Yt].checked=!zt}},{key:"initFilterCheckBoxState",value:function(){Jt()(Xt()).call(Xt(),this.checkedMap,function(wt){wt.checked=!1},this)}},{key:"_setFilterState",value:function(wt,Tt){wt==="colorFilter"?this._els.colorfilterThresholdRange.value=Tt.distance:wt==="removeWhite"?this._els.removewhiteDistanceRange.value=Tt.distance:wt==="pixelate"?this._els.pixelateRange.value=Tt.blocksize:wt==="brightness"?this._els.brightnessRange.value=Tt.brightness:wt==="noise"?this._els.noiseRange.value=Tt.noise:wt==="tint"?(this._els.tintOpacity.value=Tt.alpha,this._els.filterTintColor.color=Tt.color):wt==="blend"?this._els.filterBlendColor.color=Tt.color:wt==="multiply"&&(this._els.filterMultiplyColor.color=Tt.color)}},{key:"_getFilterNameFromOptions",value:function(wt,Tt){var Dt=wt;return wt==="removeColor"?Dt=Xt().isExisty(Tt.useAlpha)?"removeWhite":"colorFilter":wt==="blendColor"&&(Dt={add:"blend",multiply:"multiply",tint:"tint"}[Tt.mode]),Dt}},{key:"_changeFilterState",value:function(wt,Tt){var Dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,kt=this.checkedMap[Tt].checked,Yt=Ru[Tt],zt=this.checkedMap[Tt].closest(".tui-image-editor-checkbox-group");zt&&(kt?zt.classList.remove("tui-image-editor-disabled"):zt.classList.add("tui-image-editor-disabled")),wt(kt,Yt,this._getFilterOption(Tt),!Dt)}},{key:"_getFilterOption",value:function(wt){var Tt={};switch(wt){case"removeWhite":Tt.color="#FFFFFF",Tt.useAlpha=!1,Tt.distance=Hr()(this._els.removewhiteDistanceRange.value);break;case"colorFilter":Tt.color="#FFFFFF",Tt.distance=Hr()(this._els.colorfilterThresholdRange.value);break;case"pixelate":Tt.blocksize=Sr(this._els.pixelateRange.value);break;case"noise":Tt.noise=Sr(this._els.noiseRange.value);break;case"brightness":Tt.brightness=Hr()(this._els.brightnessRange.value);break;case"blend":Tt.mode="add",Tt.color=this._els.filterBlendColor.color,Tt.mode=this._els.blendType.value;break;case"multiply":Tt.mode="multiply",Tt.color=this._els.filterMultiplyColor.color;break;case"tint":Tt.mode="tint",Tt.color=this._els.filterTintColor.color,Tt.alpha=this._els.tintOpacity.value;break;case"blur":Tt.blur=this._els.blurRange.value;break}return Tt}},{key:"_makeControlElement",value:function(){this._els={removewhiteDistanceRange:new jr({slider:this.selector(".tie-removewhite-distance-range")},fr.removewhiteDistanceRange),brightnessRange:new jr({slider:this.selector(".tie-brightness-range")},fr.brightnessRange),noiseRange:new jr({slider:this.selector(".tie-noise-range")},fr.noiseRange),pixelateRange:new jr({slider:this.selector(".tie-pixelate-range")},fr.pixelateRange),colorfilterThresholdRange:new jr({slider:this.selector(".tie-colorfilter-threshold-range")},fr.colorfilterThresholdRange),filterTintColor:new zr(this.selector(".tie-filter-tint-color"),{defaultColor:"#03bd9e",toggleDirection:this.toggleDirection,usageStatistics:this.usageStatistics}),filterMultiplyColor:new zr(this.selector(".tie-filter-multiply-color"),{defaultColor:"#515ce6",toggleDirection:this.toggleDirection,usageStatistics:this.usageStatistics}),filterBlendColor:new zr(this.selector(".tie-filter-blend-color"),{defaultColor:"#ffbb3b",toggleDirection:this.toggleDirection,usageStatistics:this.usageStatistics}),blurRange:fr.blurFilterRange},this._els.tintOpacity=this._pickerWithRange(this._els.filterTintColor.pickerControl),this._els.blendType=this._pickerWithSelectbox(this._els.filterBlendColor.pickerControl),this.colorPickerControls.push(this._els.filterTintColor),this.colorPickerControls.push(this._els.filterMultiplyColor),this.colorPickerControls.push(this._els.filterBlendColor),this.colorPickerInputBoxes=[],this.colorPickerInputBoxes.push(this._els.filterTintColor.colorpickerElement.querySelector(Wn.COLOR_PICKER_INPUT_BOX)),this.colorPickerInputBoxes.push(this._els.filterMultiplyColor.colorpickerElement.querySelector(Wn.COLOR_PICKER_INPUT_BOX)),this.colorPickerInputBoxes.push(this._els.filterBlendColor.colorpickerElement.querySelector(Wn.COLOR_PICKER_INPUT_BOX))}},{key:"_pickerWithRange",value:function(wt){var Tt=document.createElement("div"),Dt=document.createElement("label"),kt=document.createElement("div");return kt.id="tie-filter-tint-opacity",Dt.innerHTML="Opacity",Tt.appendChild(Dt),Tt.appendChild(kt),wt.appendChild(Tt),wt.style.height=oo,new jr({slider:kt},fr.tintOpacityRange)}},{key:"_pickerWithSelectbox",value:function(wt){var Tt=document.createElement("div"),Dt=document.createElement("select"),kt=document.createElement("ul");return Tt.className="tui-image-editor-selectlist-wrap",kt.className="tui-image-editor-selectlist",Tt.appendChild(Dt),Tt.appendChild(kt),this._makeSelectOptionList(Dt),wt.appendChild(Tt),wt.style.height=oo,this._drawSelectOptionList(Dt,kt),this._pickerWithSelectboxForAddEvent(Dt,kt),Dt}},{key:"_drawSelectOptionList",value:function(wt,Tt){var Dt=wt.querySelectorAll("option");Jt()(Xt()).call(Xt(),Dt,function(kt){var Yt=document.createElement("li");Yt.innerHTML=kt.innerHTML,Yt.setAttribute("data-item",kt.value),Tt.appendChild(Yt)})}},{key:"_pickerWithSelectboxForAddEvent",value:function(wt,Tt){var Dt=this;Tt.addEventListener("click",function(kt){var Yt=kt.target.getAttribute("data-item"),zt=document.createEvent("HTMLEvents");wt.querySelector('[value="'.concat(Yt,'"]')).selected=!0,zt.initEvent("change",!0,!0),wt.dispatchEvent(zt),Dt.selectBoxShow=!1,Tt.style.display="none"}),wt.addEventListener("mousedown",function(kt){kt.preventDefault(),Dt.selectBoxShow=!Dt.selectBoxShow,Tt.style.display=Dt.selectBoxShow?"block":"none",Tt.setAttribute("data-selectitem",wt.value),Tt.querySelector("[data-item='".concat(wt.value,"']")).classList.add("active")})}},{key:"_makeSelectOptionList",value:function(wt){Jt()(Xt()).call(Xt(),Pu,function(Tt){var Dt=document.createElement("option");Dt.setAttribute("value",Tt),Dt.innerHTML=Tt.replace(/^[a-z]/,function(kt){return kt.toUpperCase()}),wt.appendChild(Dt)})}}]),_t}(Rr),Hu=Uu,zu=tt(4383),Qu=tt.n(zu),Vu=function(){function Rt(Bt,_t){var Et=_t.name;Ht(this,Rt),this.name=Et,this.items=[],this.panelElement=this._makePanelElement(),this.listElement=this._makeListElement(),this.panelElement.appendChild(this.listElement),Bt.appendChild(this.panelElement)}return Wt(Rt,[{key:"_makePanelElement",value:function(){var _t=document.createElement("div");return _t.className="tie-panel-".concat(this.name),_t}},{key:"_makeListElement",value:function(){var _t=document.createElement("ol");return _t.className="".concat(this.name,"-list"),_t}},{key:"makeListItemElement",value:function(_t){var Et=document.createElement("li");return Et.innerHTML=_t,Et.className="".concat(this.name,"-item"),Et.setAttribute("data-index",this.items.length),Et}},{key:"pushListItemElement",value:function(_t){this.listElement.appendChild(_t),this.listElement.scrollTop+=_t.offsetHeight,this.items.push(_t)}},{key:"deleteListItemElement",value:function(_t,Et){for(var wt=this.items,Tt=_t;Tt<Et;Tt+=1)this.listElement.removeChild(wt[Tt]);ct()(wt).call(wt,_t,Et-_t+1)}},{key:"getListLength",value:function(){return this.items.length}},{key:"addClass",value:function(_t,Et){this.items[_t]&&this.items[_t].classList.add(Et)}},{key:"removeClass",value:function(_t,Et){this.items[_t]&&this.items[_t].classList.remove(Et)}},{key:"toggleClass",value:function(_t,Et){this.items[_t]&&this.items[_t].classList.toggle(Et)}}]),Rt}(),Wu=Vu,Yu=function(Rt){var Bt,_t,Et,wt=Rt.locale,Tt=Rt.makeSvgIcon,Dt=Rt.name,kt=Rt.detail;return Pt()(Bt=Pt()(_t=Pt()(Et=`
    <div class="tui-image-editor-history-item history">
        <div class="history-item-icon">
            `.concat(Tt(["normal","active"],"history-".concat(Dt.toLowerCase()),!0),`
        </div>
        <span>
            `)).call(Et,wt.localize(Dt),`
            `)).call(_t,kt?"(".concat(wt.localize(kt),")"):"",`
        </span>
        <div class="history-item-checkbox">
            `)).call(Bt,Tt(["normal"],"history-check",!0),`
        </div>
    </div>
`)};function Gu(Rt){var Bt=Xu();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Xu(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Ku="history-item",fo="selected-item",ho="disabled-item",$u=function(Rt){lr(_t,Rt);var Bt=Gu(_t);function _t(Et,wt){var Tt,Dt=wt.locale,kt=wt.makeSvgIcon;return Ht(this,_t),Tt=Bt.call(this,Et,{name:"history"}),Et.classList.add("enabled"),Tt.locale=Dt,Tt.makeSvgIcon=kt,Tt._eventHandler={},Tt._historyIndex=Tt.getListLength(),Tt}return Wt(_t,[{key:"add",value:function(wt){var Tt=wt.name,Dt=wt.detail;this._hasDisabledItem()&&this.deleteListItemElement(this._historyIndex+1,this.getListLength());var kt=Yu({locale:this.locale,makeSvgIcon:this.makeSvgIcon,name:Tt,detail:Dt}),Yt=this.makeListItemElement(kt);this.pushListItemElement(Yt),this._historyIndex=this.getListLength()-1,this._selectItem(this._historyIndex)}},{key:"init",value:function(){this.deleteListItemElement(1,this.getListLength()),this._historyIndex=0,this._selectItem(this._historyIndex)}},{key:"clear",value:function(){this.deleteListItemElement(0,this.getListLength()),this._historyIndex=-1}},{key:"prev",value:function(){this._historyIndex-=1,this._selectItem(this._historyIndex)}},{key:"next",value:function(){this._historyIndex+=1,this._selectItem(this._historyIndex)}},{key:"_hasDisabledItem",value:function(){return this.getListLength()-1>this._historyIndex}},{key:"_addHistoryEventListener",value:function(){var wt=this;this._eventHandler.history=function(Tt){return wt._clickHistoryItem(Tt)},this.listElement.addEventListener("click",this._eventHandler.history)}},{key:"_removeHistoryEventListener",value:function(){this.listElement.removeEventListener("click",this._eventHandler.history)}},{key:"_clickHistoryItem",value:function(wt){var Tt=wt.target,Dt=Tt.closest(".".concat(Ku));if(!!Dt){var kt=Qu()(Dt.getAttribute("data-index"),10);if(kt!==this._historyIndex){var Yt=Math.abs(kt-this._historyIndex);kt<this._historyIndex?this._actions.undo(Yt):this._actions.redo(Yt)}}}},{key:"_selectItem",value:function(wt){for(var Tt=0;Tt<this.getListLength();Tt+=1)this.removeClass(Tt,fo),this.removeClass(Tt,ho),Tt>wt&&this.addClass(Tt,ho);this.addClass(wt,fo)}},{key:"destroy",value:function(){this.removeEvent(),Mn(this)}},{key:"addEvent",value:function(wt){this._actions=wt,this._addHistoryEventListener()}},{key:"removeEvent",value:function(){this._removeHistoryEventListener()}}]),_t}(Wu),Ju=$u,Zu=function(){function Rt(Bt){Ht(this,Rt),this._locale=Bt}return Wt(Rt,[{key:"localize",value:function(_t){return this._locale[_t]||_t}}]),Rt}(),qu=Zu,_f={Shape:Yl,Crop:Jl,Resize:tu,Flip:su,Rotate:du,Text:vu,Mask:wu,Icon:Iu,Draw:Fu,Filter:Hu},_h=Xt().CustomEvents,_d="1300",po="history",ep="tie-panel-history",_a="on",es={ZOOM_IN:"zoomIn",HAND:"hand"},go=function(){function Rt(Bt,_t,Et){Ht(this,Rt),this.options=this._initializeOption(_t),this._actions=Et,this.submenu=!1,this.imageSize={},this.uiSize={},this._locale=new qu(this.options.locale),this.theme=new jl(this.options.theme),this.eventHandler={},this._submenuChangeTransection=!1,this._selectedElement=null,this._mainElement=null,this._editorElementWrap=null,this._editorElement=null,this._menuBarElement=null,this._subMenuElement=null,this._makeUiElement(Bt),this._setUiSize(),this._initMenuEvent=!1,this._makeSubMenu(),this._attachHistoryEvent(),this._attachZoomEvent()}return Wt(Rt,[{key:"destroy",value:function(){this._removeUiEvent(),this._destroyAllMenu(),this._selectedElement.innerHTML="",Mn(this)}},{key:"setUiDefaultSelectionStyle",value:function(_t){return Xt().extend({applyCropSelectionStyle:!0,applyGroupSelectionStyle:!0,selectionStyle:{cornerStyle:"circle",cornerSize:16,cornerColor:"#fff",cornerStrokeColor:"#fff",transparentCorners:!1,lineWidth:2,borderColor:"#fff"}},_t)}},{key:"resizeEditor",value:function(){var _t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Et=_t.uiSize,wt=_t.imageSize,Tt=wt===void 0?this.imageSize:wt;Tt!==this.imageSize&&(this.imageSize=Tt),Et&&this._setUiSize(Et);var Dt=this._getCanvasMaxDimension(),kt=Dt.width,Yt=Dt.height,zt=this._editorElement.style,en=this.options.menuBarPosition;zt.height="".concat(Yt,"px"),zt.width="".concat(kt,"px"),this._setEditorPosition(en),this._editorElementWrap.style.bottom="0px",this._editorElementWrap.style.top="0px",this._editorElementWrap.style.left="0px",this._editorElementWrap.style.width="100%";var an=this._selectedElement.classList;en==="top"&&this._selectedElement.offsetWidth<_d?an.add("tui-image-editor-top-optimization"):an.remove("tui-image-editor-top-optimization")}},{key:"toggleZoomButtonStatus",value:function(_t){var Et=this._buttonElements[_t].classList;Et.toggle(_a),_t===es.ZOOM_IN?this._buttonElements[es.HAND].classList.remove(_a):this._buttonElements[es.ZOOM_IN].classList.remove(_a)}},{key:"offZoomInButtonStatus",value:function(){var _t=this._buttonElements[es.ZOOM_IN].classList;_t.remove(_a)}},{key:"changeHandButtonStatus",value:function(_t){var Et=this._buttonElements[es.HAND].classList;Et[_t?"add":"remove"](_a)}},{key:"changeHelpButtonEnabled",value:function(_t,Et){var wt=this._buttonElements[_t].classList;wt[Et?"add":"remove"]("enabled")}},{key:"_initializeOption",value:function(_t){return Xt().extend({loadImage:{path:"",name:""},locale:{},menuIconPath:"",menu:["resize","crop","flip","rotate","draw","shape","icon","text","mask","filter"],initMenu:"",uiSize:{width:"100%",height:"100%"},menuBarPosition:"bottom"},_t)}},{key:"_setUiSize",value:function(){var _t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.uiSize,Et=this._selectedElement.style;Et.width=_t.width,Et.height=_t.height}},{key:"_makeSubMenu",value:function(){var _t=this;Jt()(Xt()).call(Xt(),this.options.menu,function(Et){var wt,Tt=_f[Et.replace(/^[a-z]/,function(Dt){return Dt.toUpperCase()})];_t._makeMenuElement(Et),_t._buttonElements[Et]=_t._menuBarElement.querySelector(".tie-btn-".concat(Et)),_t[Et]=new Tt(_t._subMenuElement,{locale:_t._locale,makeSvgIcon:Lt()(wt=_t.theme.makeMenSvgIconSet).call(wt,_t.theme),menuBarPosition:_t.options.menuBarPosition,usageStatistics:_t.options.usageStatistics})})}},{key:"_attachHistoryEvent",value:function(){var _t,Et,wt;this.on(xn.EXECUTE_COMMAND,Lt()(_t=this._addHistory).call(_t,this)),this.on(xn.AFTER_UNDO,Lt()(Et=this._selectPrevHistory).call(Et,this)),this.on(xn.AFTER_REDO,Lt()(wt=this._selectNextHistory).call(wt,this))}},{key:"_attachZoomEvent",value:function(){var _t=this;this.on(xn.HAND_STARTED,function(){_t.offZoomInButtonStatus(),_t.changeHandButtonStatus(!0)}),this.on(xn.HAND_STOPPED,function(){return _t.changeHandButtonStatus(!1)})}},{key:"_makeUiElement",value:function(_t){var Et,wt;window.snippet=Xt(),_t.nodeType?wt=_t:wt=document.querySelector(_t);var Tt=ls(wt);wt.classList.add("tui-image-editor-container"),wt.innerHTML=Il({locale:this._locale,biImage:this.theme.getStyle("common.bi"),loadButtonStyle:this.theme.getStyle("loadButton"),downloadButtonStyle:this.theme.getStyle("downloadButton"),menuBarPosition:this.options.menuBarPosition})+Tl({locale:this._locale,biImage:this.theme.getStyle("common.bi"),commonStyle:this.theme.getStyle("common"),headerStyle:this.theme.getStyle("header"),loadButtonStyle:this.theme.getStyle("loadButton"),downloadButtonStyle:this.theme.getStyle("downloadButton"),submenuStyle:this.theme.getStyle("submenu")}),this._selectedElement=wt,this._selectedElement.classList.add(this.options.menuBarPosition),this._mainElement=Tt(".tui-image-editor-main"),this._editorElementWrap=Tt(".tui-image-editor-wrap"),this._editorElement=Tt(".tui-image-editor"),this._helpMenuBarElement=Tt(".tui-image-editor-help-menu"),this._menuBarElement=Tt(".tui-image-editor-menu"),this._subMenuElement=Tt(".tui-image-editor-submenu"),this._buttonElements={download:this._selectedElement.querySelectorAll(".tui-image-editor-download-btn"),load:this._selectedElement.querySelectorAll(".tui-image-editor-load-btn")},this._addHelpMenus(),this._historyMenu=new Ju(this._buttonElements[po],{locale:this._locale,makeSvgIcon:Lt()(Et=this.theme.makeMenSvgIconSet).call(Et,this.theme)}),this._activateZoomMenus()}},{key:"_activateZoomMenus",value:function(){var _t=this;Jt()(Xt()).call(Xt(),bn,function(Et){_t.changeHelpButtonEnabled(Et,!0)})}},{key:"_makeHelpMenuWithPartition",value:function(){var _t;return Pt()(_t=[]).call(_t,Ft(bn),[""],Ft(An),[""],Ft(Sn))}},{key:"_addHelpMenus",value:function(){var _t=this,Et=this._makeHelpMenuWithPartition();Jt()(Xt()).call(Xt(),Et,function(wt){wt?(_t._makeMenuElement(wt,["normal","disabled","hover"],"help"),_t._buttonElements[wt]=_t._helpMenuBarElement.querySelector(".tie-btn-".concat(wt))):_t._makeMenuPartitionElement()})}},{key:"_makeMenuPartitionElement",value:function(){var _t=document.createElement("li"),Et=document.createElement("div");_t.className=kn("item"),Et.className=kn("icpartition"),_t.appendChild(Et),this._helpMenuBarElement.appendChild(_t)}},{key:"_makeMenuElement",value:function(_t){var Et,wt,Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["normal","active","hover"],Dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal",kt=document.createElement("li"),Yt=this.theme.makeMenSvgIconSet(Tt,_t);this._addTooltipAttribute(kt,_t),kt.className=Pt()(Et=Pt()(wt="tie-btn-".concat(_t," ")).call(wt,kn("item")," ")).call(Et,Dt),kt.innerHTML=Yt,Dt==="normal"?this._menuBarElement.appendChild(kt):this._helpMenuBarElement.appendChild(kt)}},{key:"_addHelpActionEvent",value:function(){var _t=this;Jt()(Xt()).call(Xt(),En,function(Et){_t.eventHandler[Et]=function(wt){return _t._actions.main[Et](wt)},_t._buttonElements[Et].addEventListener("click",_t.eventHandler[Et])})}},{key:"_removeHelpActionEvent",value:function(){var _t=this;Jt()(Xt()).call(Xt(),En,function(Et){_t._buttonElements[Et].removeEventListener("click",_t.eventHandler[Et])})}},{key:"_addHistory",value:function(_t){if(!cs(_t)){var Et=typeof _t=="string"?{name:_t}:us(_t);this._historyMenu.add(Et)}}},{key:"initHistory",value:function(){this._historyMenu.init()}},{key:"clearHistory",value:function(){this._historyMenu.clear()}},{key:"_selectPrevHistory",value:function(){this._historyMenu.prev()}},{key:"_selectNextHistory",value:function(){this._historyMenu.next()}},{key:"toggleHistoryMenu",value:function(_t){var Et=_t.target,wt=Et.closest(".".concat(ep));if(!wt){var Tt=this._buttonElements[po].classList;Tt.toggle("opened")}}},{key:"_addTooltipAttribute",value:function(_t,Et){_t.setAttribute("tooltip-content",this._locale.localize(Et.replace(/^[a-z]/g,function(wt){return wt.toUpperCase()})))}},{key:"_addDownloadEvent",value:function(){var _t=this;this.eventHandler.download=function(){return _t._actions.main.download()},Jt()(Xt()).call(Xt(),this._buttonElements.download,function(Et){Et.addEventListener("click",_t.eventHandler.download)})}},{key:"_removeDownloadEvent",value:function(){var _t=this;Jt()(Xt()).call(Xt(),this._buttonElements.download,function(Et){Et.removeEventListener("click",_t.eventHandler.download)})}},{key:"_addLoadEvent",value:function(){var _t=this;this.eventHandler.loadImage=function(Et){return _t._actions.main.load(Et.target.files[0])},Jt()(Xt()).call(Xt(),this._buttonElements.load,function(Et){Et.addEventListener("change",_t.eventHandler.loadImage)})}},{key:"_removeLoadEvent",value:function(){var _t=this;Jt()(Xt()).call(Xt(),this._buttonElements.load,function(Et){Et.removeEventListener("change",_t.eventHandler.loadImage)})}},{key:"_addMainMenuEvent",value:function(_t){var Et=this;this.eventHandler[_t]=function(){return Et.changeMenu(_t)},this._buttonElements[_t].addEventListener("click",this.eventHandler[_t])}},{key:"_addSubMenuEvent",value:function(_t){var Et=this;this[_t].addEvent(this._actions[_t]),this[_t].on(xn.INPUT_BOX_EDITING_STARTED,function(){return Et.fire(xn.INPUT_BOX_EDITING_STARTED)}),this[_t].on(xn.INPUT_BOX_EDITING_STOPPED,function(){return Et.fire(xn.INPUT_BOX_EDITING_STOPPED)})}},{key:"_addMenuEvent",value:function(){var _t=this;Jt()(Xt()).call(Xt(),this.options.menu,function(Et){_t._addMainMenuEvent(Et),_t._addSubMenuEvent(Et)})}},{key:"_removeMainMenuEvent",value:function(){var _t=this;Jt()(Xt()).call(Xt(),this.options.menu,function(Et){_t._buttonElements[Et].removeEventListener("click",_t.eventHandler[Et]),_t[Et].off(xn.INPUT_BOX_EDITING_STARTED),_t[Et].off(xn.INPUT_BOX_EDITING_STOPPED)})}},{key:"getEditorArea",value:function(){return this._editorElement}},{key:"activeMenuEvent",value:function(){this._initMenuEvent||(this._addHelpActionEvent(),this._addDownloadEvent(),this._addMenuEvent(),this._initMenu(),this._historyMenu.addEvent(this._actions.history),this._initMenuEvent=!0)}},{key:"_removeUiEvent",value:function(){this._removeHelpActionEvent(),this._removeDownloadEvent(),this._removeLoadEvent(),this._removeMainMenuEvent(),this._historyMenu.removeEvent()}},{key:"_destroyAllMenu",value:function(){var _t=this;Jt()(Xt()).call(Xt(),this.options.menu,function(Et){_t[Et].destroy()}),this._historyMenu.destroy()}},{key:"initCanvas",value:function(){var _t=this,Et=this._getLoadImage();Et.path&&this._actions.main.initLoadImage(Et.path,Et.name).then(function(){_t.activeMenuEvent()}),this._addLoadEvent();var wt=document.createElement("div");wt.className=kn("grid-visual");var Tt=`<table>
           <tr><td class="dot left-top"></td><td></td><td class="dot right-top"></td></tr>
           <tr><td></td><td></td><td></td></tr>
           <tr><td class="dot left-bottom"></td><td></td><td class="dot right-bottom"></td></tr>
         </table>`;wt.innerHTML=Tt,this._editorContainerElement=this._editorElement.querySelector(".tui-image-editor-canvas-container"),this._editorContainerElement.appendChild(wt)}},{key:"_getLoadImage",value:function(){return this.options.loadImage}},{key:"changeMenu",value:function(_t){var Et=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,wt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;this._submenuChangeTransection||(this._submenuChangeTransection=!0,this._changeMenu(_t,Et,wt),this._submenuChangeTransection=!1)}},{key:"_changeMenu",value:function(_t,Et,wt){this.submenu&&(this._buttonElements[this.submenu].classList.remove("active"),this._mainElement.classList.remove("tui-image-editor-menu-".concat(this.submenu)),wt&&this._actions.main.discardSelection(),this._actions.main.changeSelectableAll(!0),this[this.submenu].changeStandbyMode()),this.submenu===_t&&Et?this.submenu=null:(this._buttonElements[_t].classList.add("active"),this._mainElement.classList.add("tui-image-editor-menu-".concat(_t)),this.submenu=_t,this[this.submenu].changeStartMode()),this.resizeEditor()}},{key:"_initMenu",value:function(){if(this.options.initMenu){var _t=document.createEvent("MouseEvents");_t.initEvent("click",!0,!1),this._buttonElements[this.options.initMenu].dispatchEvent(_t)}this.icon&&this.icon.registerDefaultIcon()}},{key:"_getCanvasMaxDimension",value:function(){var _t=this._editorContainerElement.style,Et=_t.maxWidth,wt=_t.maxHeight,Tt=Hr()(Et),Dt=Hr()(wt);return{width:Tt,height:Dt}}},{key:"_setEditorPosition",value:function(_t){var Et=this._getCanvasMaxDimension(),wt=Et.width,Tt=Et.height,Dt=this._editorElement.style,kt=0,Yt=0;this.submenu&&(_t==="bottom"?Tt>this._editorElementWrap.scrollHeight-150?kt=(Tt-this._editorElementWrap.scrollHeight)/2:kt=150/2*-1:_t==="top"?Tt>this._editorElementWrap.offsetHeight-150?kt=150/2-(Tt-(this._editorElementWrap.offsetHeight-150))/2:kt=150/2:_t==="left"?wt>this._editorElementWrap.offsetWidth-248?Yt=248/2-(wt-(this._editorElementWrap.offsetWidth-248))/2:Yt=248/2:_t==="right"&&(wt>this._editorElementWrap.scrollWidth-248?Yt=(wt-this._editorElementWrap.scrollWidth)/2:Yt=248/2*-1)),Dt.top="".concat(kt,"px"),Dt.left="".concat(Yt,"px")}}]),Rt}();_h.mixin(go);var tp=go,ip=tt(381),ts=tt.n(ip),Ao=function(){function Rt(){Ht(this,Rt),this.versionnumber="1.2.4",this.optionpresets={default:{corsenabled:!1,ltres:1,qtres:1,pathomit:8,rightangleenhance:!0,colorsampling:2,numberofcolors:16,mincolorratio:0,colorquantcycles:3,layering:0,strokewidth:1,linefilter:!1,scale:1,roundcoords:1,viewbox:!1,desc:!1,lcpr:0,qcpr:0,blurradius:0,blurdelta:20},posterized1:{colorsampling:0,numberofcolors:2},posterized2:{numberofcolors:4,blurradius:5},curvy:{ltres:.01,linefilter:!0,rightangleenhance:!1},sharp:{qtres:.01,linefilter:!1},detailed:{pathomit:0,roundcoords:2,ltres:.5,qtres:.5,numberofcolors:64},smoothed:{blurradius:5,blurdelta:64},grayscale:{colorsampling:0,colorquantcycles:1,numberofcolors:7},fixedpalette:{colorsampling:0,colorquantcycles:1,numberofcolors:27},randomsampling1:{colorsampling:1,numberofcolors:8},randomsampling2:{colorsampling:1,numberofcolors:64},artistic1:{colorsampling:0,colorquantcycles:1,pathomit:0,blurradius:5,blurdelta:64,ltres:.01,linefilter:!0,numberofcolors:16,strokewidth:2},artistic2:{qtres:.01,colorsampling:0,colorquantcycles:1,numberofcolors:4,strokewidth:0},artistic3:{qtres:10,ltres:10,numberofcolors:8},artistic4:{qtres:10,ltres:10,numberofcolors:64,blurradius:5,blurdelta:256,strokewidth:2},posterized3:{ltres:1,qtres:1,pathomit:20,rightangleenhance:!0,colorsampling:0,numberofcolors:3,mincolorratio:0,colorquantcycles:3,blurradius:3,blurdelta:20,strokewidth:0,linefilter:!1,roundcoords:1,pal:[{r:0,g:0,b:100,a:255},{r:255,g:255,b:255,a:255}]}},this.pathscan_combined_lookup=[[[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[0,1,0,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[0,2,-1,0]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[0,1,0,-1],[0,0,1,0]],[[0,0,1,0],[-1,-1,-1,-1],[0,2,-1,0],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[0,0,1,0],[0,3,0,1],[-1,-1,-1,-1]],[[13,3,0,1],[13,2,-1,0],[7,1,0,-1],[7,0,1,0]],[[-1,-1,-1,-1],[0,1,0,-1],[-1,-1,-1,-1],[0,3,0,1]],[[0,3,0,1],[0,2,-1,0],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[0,3,0,1],[0,2,-1,0],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[0,1,0,-1],[-1,-1,-1,-1],[0,3,0,1]],[[11,1,0,-1],[14,0,1,0],[14,3,0,1],[11,2,-1,0]],[[-1,-1,-1,-1],[0,0,1,0],[0,3,0,1],[-1,-1,-1,-1]],[[0,0,1,0],[-1,-1,-1,-1],[0,2,-1,0],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[0,1,0,-1],[0,0,1,0]],[[0,1,0,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[0,2,-1,0]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1]]],this.gks=[[.27901,.44198,.27901],[.135336,.228569,.272192,.228569,.135336],[.086776,.136394,.178908,.195843,.178908,.136394,.086776],[.063327,.093095,.122589,.144599,.152781,.144599,.122589,.093095,.063327],[.049692,.069304,.089767,.107988,.120651,.125194,.120651,.107988,.089767,.069304,.049692]],this.specpalette=[{r:0,g:0,b:0,a:255},{r:128,g:128,b:128,a:255},{r:0,g:0,b:128,a:255},{r:64,g:64,b:128,a:255},{r:192,g:192,b:192,a:255},{r:255,g:255,b:255,a:255},{r:128,g:128,b:192,a:255},{r:0,g:0,b:192,a:255},{r:128,g:0,b:0,a:255},{r:128,g:64,b:64,a:255},{r:128,g:0,b:128,a:255},{r:168,g:168,b:168,a:255},{r:192,g:128,b:128,a:255},{r:192,g:0,b:0,a:255},{r:255,g:255,b:255,a:255},{r:0,g:128,b:0,a:255}]}return Wt(Rt,[{key:"imageToSVG",value:function(_t,Et,wt){var Tt=this;wt=this.checkoptions(wt),this.loadImage(_t,function(Dt){Et(Tt.imagedataToSVG(Tt.getImgdata(Dt),wt))},wt)}},{key:"imagedataToSVG",value:function(_t,Et){Et=this.checkoptions(Et);var wt=this.imagedataToTracedata(_t,Et);return this.getsvgstring(wt,Et)}},{key:"imageToTracedata",value:function(_t,Et,wt){var Tt=this;wt=this.checkoptions(wt),this.loadImage(_t,function(Dt){Et(Tt.imagedataToTracedata(Tt.getImgdata(Dt),wt))},wt)}},{key:"imagedataToTracedata",value:function(_t,Et){Et=this.checkoptions(Et);var wt=this.colorquantization(_t,Et),Tt;if(Et.layering===0){Tt={layers:[],palette:wt.palette,width:wt.array[0].length-2,height:wt.array.length-2};for(var Dt=0;Dt<wt.palette.length;Dt+=1){var kt=this.batchtracepaths(this.internodes(this.pathscan(this.layeringstep(wt,Dt),Et.pathomit),Et),Et.ltres,Et.qtres);Tt.layers.push(kt)}}else{var Yt=this.layering(wt);Et.layercontainerid&&this.drawLayers(Yt,this.specpalette,Et.scale,Et.layercontainerid);var zt=this.batchpathscan(Yt,Et.pathomit),en=this.batchinternodes(zt,Et);Tt={layers:this.batchtracelayers(en,Et.ltres,Et.qtres),palette:wt.palette,width:_t.width,height:_t.height}}return Tt}},{key:"checkoptions",value:function(_t){_t=_t||{},typeof _t=="string"&&(_t=_t.toLowerCase(),this.optionpresets[_t]?_t=this.optionpresets[_t]:_t={});for(var Et=rn()(this.optionpresets.default),wt=0;wt<Et.length;wt+=1)_t.hasOwnProperty(Et[wt])||(_t[Et[wt]]=this.optionpresets.default[Et[wt]]);return _t}},{key:"colorquantization",value:function(_t,Et){var wt=[],Tt=0,Dt,kt,Yt,zt=[],en=_t.width*_t.height,an,vn,yn,Cn,wn;for(vn=0;vn<_t.height+2;vn+=1)for(wt[vn]=[],an=0;an<_t.width+2;an+=1)wt[vn][an]=-1;for(Et.pal?wn=Et.pal:Et.colorsampling===0?wn=this.generatepalette(Et.numberofcolors):Et.colorsampling===1?wn=this.samplepalette(Et.numberofcolors,_t):wn=this.samplepalette2(Et.numberofcolors,_t),Et.blurradius>0&&(_t=this.blur(_t,Et.blurradius,Et.blurdelta)),Cn=0;Cn<Et.colorquantcycles;Cn+=1){if(Cn>0)for(yn=0;yn<wn.length;yn+=1)zt[yn].n>0&&(wn[yn]={r:Math.floor(zt[yn].r/zt[yn].n),g:Math.floor(zt[yn].g/zt[yn].n),b:Math.floor(zt[yn].b/zt[yn].n),a:Math.floor(zt[yn].a/zt[yn].n)}),zt[yn].n/en<Et.mincolorratio&&Cn<Et.colorquantcycles-1&&(wn[yn]={r:Math.floor(Math.random()*255),g:Math.floor(Math.random()*255),b:Math.floor(Math.random()*255),a:Math.floor(Math.random()*255)});for(an=0;an<wn.length;an+=1)zt[an]={r:0,g:0,b:0,a:0,n:0};for(vn=0;vn<_t.height;vn+=1)for(an=0;an<_t.width;an+=1){for(Tt=(vn*_t.width+an)*4,Yt=0,kt=1024,yn=0;yn<wn.length;yn+=1)Dt=Math.abs(wn[yn].r-_t.data[Tt])+Math.abs(wn[yn].g-_t.data[Tt+1])+Math.abs(wn[yn].b-_t.data[Tt+2])+Math.abs(wn[yn].a-_t.data[Tt+3]),Dt<kt&&(kt=Dt,Yt=yn);zt[Yt].r+=_t.data[Tt],zt[Yt].g+=_t.data[Tt+1],zt[Yt].b+=_t.data[Tt+2],zt[Yt].a+=_t.data[Tt+3],zt[Yt].n+=1,wt[vn+1][an+1]=Yt}}return{array:wt,palette:wn}}},{key:"samplepalette",value:function(_t,Et){for(var wt,Tt=[],Dt=0;Dt<_t;Dt+=1)wt=Math.floor(Math.random()*Et.data.length/4)*4,Tt.push({r:Et.data[wt],g:Et.data[wt+1],b:Et.data[wt+2],a:Et.data[wt+3]});return Tt}},{key:"samplepalette2",value:function(_t,Et){for(var wt,Tt=[],Dt=Math.ceil(Math.sqrt(_t)),kt=Math.ceil(_t/Dt),Yt=Et.width/(Dt+1),zt=Et.height/(kt+1),en=0;en<kt;en+=1)for(var an=0;an<Dt&&Tt.length!==_t;an+=1)wt=Math.floor((en+1)*zt*Et.width+(an+1)*Yt)*4,Tt.push({r:Et.data[wt],g:Et.data[wt+1],b:Et.data[wt+2],a:Et.data[wt+3]});return Tt}},{key:"generatepalette",value:function(_t){var Et=[],wt,Tt,Dt;if(_t<8)for(var kt=Math.floor(255/(_t-1)),Yt=0;Yt<_t;Yt+=1)Et.push({r:Yt*kt,g:Yt*kt,b:Yt*kt,a:255});else{var zt=Math.floor(Math.pow(_t,.3333333333333333)),en=Math.floor(255/(zt-1)),an=_t-zt*zt*zt;for(wt=0;wt<zt;wt+=1)for(Tt=0;Tt<zt;Tt+=1)for(Dt=0;Dt<zt;Dt+=1)Et.push({r:wt*en,g:Tt*en,b:Dt*en,a:255});for(wt=0;wt<an;wt+=1)Et.push({r:Math.floor(Math.random()*255),g:Math.floor(Math.random()*255),b:Math.floor(Math.random()*255),a:Math.floor(Math.random()*255)})}return Et}},{key:"layering",value:function(_t){var Et=[],wt=0,Tt=_t.array.length,Dt=_t.array[0].length,kt,Yt,zt,en,an,vn,yn,Cn,wn,_n,Nn;for(Nn=0;Nn<_t.palette.length;Nn+=1)for(Et[Nn]=[],_n=0;_n<Tt;_n+=1)for(Et[Nn][_n]=[],wn=0;wn<Dt;wn+=1)Et[Nn][_n][wn]=0;for(_n=1;_n<Tt-1;_n+=1)for(wn=1;wn<Dt-1;wn+=1)wt=_t.array[_n][wn],kt=_t.array[_n-1][wn-1]===wt?1:0,Yt=_t.array[_n-1][wn]===wt?1:0,zt=_t.array[_n-1][wn+1]===wt?1:0,en=_t.array[_n][wn-1]===wt?1:0,an=_t.array[_n][wn+1]===wt?1:0,vn=_t.array[_n+1][wn-1]===wt?1:0,yn=_t.array[_n+1][wn]===wt?1:0,Cn=_t.array[_n+1][wn+1]===wt?1:0,Et[wt][_n+1][wn+1]=1+an*2+Cn*4+yn*8,en||(Et[wt][_n+1][wn]=0+2+yn*4+vn*8),Yt||(Et[wt][_n][wn+1]=0+zt*2+an*4+8),kt||(Et[wt][_n][wn]=0+Yt*2+4+en*8);return Et}},{key:"layeringstep",value:function(_t,Et){var wt=[],Tt=_t.array.length,Dt=_t.array[0].length,kt,Yt;for(Yt=0;Yt<Tt;Yt+=1)for(wt[Yt]=[],kt=0;kt<Dt;kt+=1)wt[Yt][kt]=0;for(Yt=1;Yt<Tt;Yt+=1)for(kt=1;kt<Dt;kt+=1)wt[Yt][kt]=(_t.array[Yt-1][kt-1]===Et?1:0)+(_t.array[Yt-1][kt]===Et?2:0)+(_t.array[Yt][kt-1]===Et?8:0)+(_t.array[Yt][kt]===Et?4:0);return wt}},{key:"pathscan",value:function(_t,Et){for(var wt=[],Tt=0,Dt=0,kt=0,Yt=0,zt=_t[0].length,en=_t.length,an=0,vn=!0,yn=!1,Cn,wn=0;wn<en;wn+=1)for(var _n=0;_n<zt;_n+=1)if(_t[wn][_n]===4||_t[wn][_n]===11)for(kt=_n,Yt=wn,wt[Tt]={},wt[Tt].points=[],wt[Tt].boundingbox=[kt,Yt,kt,Yt],wt[Tt].holechildren=[],vn=!1,Dt=0,yn=_t[wn][_n]===11,an=1;!vn;){if(wt[Tt].points[Dt]={},wt[Tt].points[Dt].x=kt-1,wt[Tt].points[Dt].y=Yt-1,wt[Tt].points[Dt].t=_t[Yt][kt],kt-1<wt[Tt].boundingbox[0]&&(wt[Tt].boundingbox[0]=kt-1),kt-1>wt[Tt].boundingbox[2]&&(wt[Tt].boundingbox[2]=kt-1),Yt-1<wt[Tt].boundingbox[1]&&(wt[Tt].boundingbox[1]=Yt-1),Yt-1>wt[Tt].boundingbox[3]&&(wt[Tt].boundingbox[3]=Yt-1),Cn=this.pathscan_combined_lookup[_t[Yt][kt]][an],_t[Yt][kt]=Cn[0],an=Cn[1],kt+=Cn[2],Yt+=Cn[3],kt-1===wt[Tt].points[0].x&&Yt-1===wt[Tt].points[0].y)if(vn=!0,wt[Tt].points.length<Et)wt.pop();else{if(wt[Tt].isholepath=!!yn,yn){for(var Nn=0,Kn=[-1,-1,zt+1,en+1],Zn=0;Zn<Tt;Zn++)!wt[Zn].isholepath&&this.boundingboxincludes(wt[Zn].boundingbox,wt[Tt].boundingbox)&&this.boundingboxincludes(Kn,wt[Zn].boundingbox)&&(Nn=Zn,Kn=wt[Zn].boundingbox);wt[Nn].holechildren.push(Tt)}Tt+=1}Dt+=1}return wt}},{key:"boundingboxincludes",value:function(_t,Et){return _t[0]<Et[0]&&_t[1]<Et[1]&&_t[2]>Et[2]&&_t[3]>Et[3]}},{key:"batchpathscan",value:function(_t,Et){var wt=[];for(var Tt in _t)!_t.hasOwnProperty(Tt)||(wt[Tt]=this.pathscan(_t[Tt],Et));return wt}},{key:"internodes",value:function(_t,Et){var wt=[],Tt=0,Dt=0,kt=0,Yt=0,zt=0,en,an;for(en=0;en<_t.length;en+=1)for(wt[en]={},wt[en].points=[],wt[en].boundingbox=_t[en].boundingbox,wt[en].holechildren=_t[en].holechildren,wt[en].isholepath=_t[en].isholepath,Tt=_t[en].points.length,an=0;an<Tt;an+=1)Dt=(an+1)%Tt,kt=(an+2)%Tt,Yt=(an-1+Tt)%Tt,zt=(an-2+Tt)%Tt,Et.rightangleenhance&&this.testrightangle(_t[en],zt,Yt,an,Dt,kt)&&(wt[en].points.length>0&&(wt[en].points[wt[en].points.length-1].linesegment=this.getdirection(wt[en].points[wt[en].points.length-1].x,wt[en].points[wt[en].points.length-1].y,_t[en].points[an].x,_t[en].points[an].y)),wt[en].points.push({x:_t[en].points[an].x,y:_t[en].points[an].y,linesegment:this.getdirection(_t[en].points[an].x,_t[en].points[an].y,(_t[en].points[an].x+_t[en].points[Dt].x)/2,(_t[en].points[an].y+_t[en].points[Dt].y)/2)})),wt[en].points.push({x:(_t[en].points[an].x+_t[en].points[Dt].x)/2,y:(_t[en].points[an].y+_t[en].points[Dt].y)/2,linesegment:this.getdirection((_t[en].points[an].x+_t[en].points[Dt].x)/2,(_t[en].points[an].y+_t[en].points[Dt].y)/2,(_t[en].points[Dt].x+_t[en].points[kt].x)/2,(_t[en].points[Dt].y+_t[en].points[kt].y)/2)});return wt}},{key:"testrightangle",value:function(_t,Et,wt,Tt,Dt,kt){return _t.points[Tt].x===_t.points[Et].x&&_t.points[Tt].x===_t.points[wt].x&&_t.points[Tt].y===_t.points[Dt].y&&_t.points[Tt].y===_t.points[kt].y||_t.points[Tt].y===_t.points[Et].y&&_t.points[Tt].y===_t.points[wt].y&&_t.points[Tt].x===_t.points[Dt].x&&_t.points[Tt].x===_t.points[kt].x}},{key:"getdirection",value:function(_t,Et,wt,Tt){var Dt=8;return _t<wt?Et<Tt?Dt=1:Et>Tt?Dt=7:Dt=0:_t>wt?Et<Tt?Dt=3:Et>Tt?Dt=5:Dt=4:Et<Tt?Dt=2:Et>Tt?Dt=6:Dt=8,Dt}},{key:"batchinternodes",value:function(_t,Et){var wt=[];for(var Tt in _t)!_t.hasOwnProperty(Tt)||(wt[Tt]=this.internodes(_t[Tt],Et));return wt}},{key:"tracepath",value:function(_t,Et,wt){var Tt=0,Dt,kt,Yt,zt={};for(zt.segments=[],zt.boundingbox=_t.boundingbox,zt.holechildren=_t.holechildren,zt.isholepath=_t.isholepath;Tt<_t.points.length;){var en;for(Dt=_t.points[Tt].linesegment,kt=-1,Yt=Tt+1;(_t.points[Yt].linesegment===Dt||_t.points[Yt].linesegment===kt||kt===-1)&&Yt<_t.points.length-1;)_t.points[Yt].linesegment!==Dt&&kt===-1&&(kt=_t.points[Yt].linesegment),Yt+=1;Yt===_t.points.length-1&&(Yt=0),zt.segments=Pt()(en=zt.segments).call(en,this.fitseq(_t,Et,wt,Tt,Yt)),Yt>0?Tt=Yt:Tt=_t.points.length}return zt}},{key:"fitseq",value:function(_t,Et,wt,Tt,Dt){var kt;if(Dt>_t.points.length||Dt<0)return[];var Yt=Tt,zt=0,en=!0,an,vn,yn,Cn=Dt-Tt;Cn<0&&(Cn+=_t.points.length);for(var wn=(_t.points[Dt].x-_t.points[Tt].x)/Cn,_n=(_t.points[Dt].y-_t.points[Tt].y)/Cn,Nn=(Tt+1)%_t.points.length,Kn;Nn!=Dt;)Kn=Nn-Tt,Kn<0&&(Kn+=_t.points.length),an=_t.points[Tt].x+wn*Kn,vn=_t.points[Tt].y+_n*Kn,yn=(_t.points[Nn].x-an)*(_t.points[Nn].x-an)+(_t.points[Nn].y-vn)*(_t.points[Nn].y-vn),yn>Et&&(en=!1),yn>zt&&(Yt=Nn,zt=yn),Nn=(Nn+1)%_t.points.length;if(en)return[{type:"L",x1:_t.points[Tt].x,y1:_t.points[Tt].y,x2:_t.points[Dt].x,y2:_t.points[Dt].y}];var Zn=Yt;en=!0,zt=0;var er=(Zn-Tt)/Cn,Gn=(1-er)*(1-er),ur=2*(1-er)*er,wr=er*er,Br=(Gn*_t.points[Tt].x+wr*_t.points[Dt].x-_t.points[Zn].x)/-ur,vr=(Gn*_t.points[Tt].y+wr*_t.points[Dt].y-_t.points[Zn].y)/-ur;for(Nn=Tt+1;Nn!=Dt;)er=(Nn-Tt)/Cn,Gn=(1-er)*(1-er),ur=2*(1-er)*er,wr=er*er,an=Gn*_t.points[Tt].x+ur*Br+wr*_t.points[Dt].x,vn=Gn*_t.points[Tt].y+ur*vr+wr*_t.points[Dt].y,yn=(_t.points[Nn].x-an)*(_t.points[Nn].x-an)+(_t.points[Nn].y-vn)*(_t.points[Nn].y-vn),yn>wt&&(en=!1),yn>zt&&(Yt=Nn,zt=yn),Nn=(Nn+1)%_t.points.length;if(en)return[{type:"Q",x1:_t.points[Tt].x,y1:_t.points[Tt].y,x2:Br,y2:vr,x3:_t.points[Dt].x,y3:_t.points[Dt].y}];var kr=Zn;return Pt()(kt=this.fitseq(_t,Et,wt,Tt,kr)).call(kt,this.fitseq(_t,Et,wt,kr,Dt))}},{key:"batchtracepaths",value:function(_t,Et,wt){var Tt=[];for(var Dt in _t)!_t.hasOwnProperty(Dt)||Tt.push(this.tracepath(_t[Dt],Et,wt));return Tt}},{key:"batchtracelayers",value:function(_t,Et,wt){var Tt=[];for(var Dt in _t)!_t.hasOwnProperty(Dt)||(Tt[Dt]=this.batchtracepaths(_t[Dt],Et,wt));return Tt}},{key:"roundtodec",value:function(_t,Et){return Number(_t.toFixed(Et))}},{key:"svgpathstring",value:function(_t,Et,wt,Tt){var Dt,kt,Yt=_t.layers[Et],zt=Yt[wt],en="",an;if(Tt.linefilter&&zt.segments.length<3)return en;if(en=Pt()(Dt="<path ".concat(Tt.desc?Pt()(kt='desc="l '.concat(Et," p ")).call(kt,wt,'" '):"")).call(Dt,this.tosvgcolorstr(_t.palette[Et],Tt),'d="'),Tt.roundcoords===-1){var vn;for(en+=Pt()(vn="M ".concat(zt.segments[0].x1*Tt.scale," ")).call(vn,zt.segments[0].y1*Tt.scale," "),an=0;an<zt.segments.length;an++){var yn,Cn;if(en+=Pt()(yn=Pt()(Cn="".concat(zt.segments[an].type," ")).call(Cn,zt.segments[an].x2*Tt.scale," ")).call(yn,zt.segments[an].y2*Tt.scale," "),zt.segments[an].hasOwnProperty("x3")){var wn;en+=Pt()(wn="".concat(zt.segments[an].x3*Tt.scale," ")).call(wn,zt.segments[an].y3*Tt.scale," ")}}en+="Z "}else{var _n;for(en+=Pt()(_n="M ".concat(this.roundtodec(zt.segments[0].x1*Tt.scale,Tt.roundcoords)," ")).call(_n,this.roundtodec(zt.segments[0].y1*Tt.scale,Tt.roundcoords)," "),an=0;an<zt.segments.length;an++){var Nn,Kn;if(en+=Pt()(Nn=Pt()(Kn="".concat(zt.segments[an].type," ")).call(Kn,this.roundtodec(zt.segments[an].x2*Tt.scale,Tt.roundcoords)," ")).call(Nn,this.roundtodec(zt.segments[an].y2*Tt.scale,Tt.roundcoords)," "),zt.segments[an].hasOwnProperty("x3")){var Zn;en+=Pt()(Zn="".concat(this.roundtodec(zt.segments[an].x3*Tt.scale,Tt.roundcoords)," ")).call(Zn,this.roundtodec(zt.segments[an].y3*Tt.scale,Tt.roundcoords)," ")}}en+="Z "}for(var er=0;er<zt.holechildren.length;er++){var Gn=Yt[zt.holechildren[er]];if(Tt.roundcoords===-1){if(Gn.segments[Gn.segments.length-1].hasOwnProperty("x3")){var ur;en+=Pt()(ur="M ".concat(Gn.segments[Gn.segments.length-1].x3*Tt.scale," ")).call(ur,Gn.segments[Gn.segments.length-1].y3*Tt.scale," ")}else{var wr;en+=Pt()(wr="M ".concat(Gn.segments[Gn.segments.length-1].x2*Tt.scale," ")).call(wr,Gn.segments[Gn.segments.length-1].y2*Tt.scale," ")}for(an=Gn.segments.length-1;an>=0;an--){var Br;if(en+="".concat(Gn.segments[an].type," "),Gn.segments[an].hasOwnProperty("x3")){var vr;en+=Pt()(vr="".concat(Gn.segments[an].x2*Tt.scale," ")).call(vr,Gn.segments[an].y2*Tt.scale," ")}en+=Pt()(Br="".concat(Gn.segments[an].x1*Tt.scale," ")).call(Br,Gn.segments[an].y1*Tt.scale," ")}}else{if(Gn.segments[Gn.segments.length-1].hasOwnProperty("x3")){var kr;en+=Pt()(kr="M ".concat(this.roundtodec(Gn.segments[Gn.segments.length-1].x3*Tt.scale)," ")).call(kr,this.roundtodec(Gn.segments[Gn.segments.length-1].y3*Tt.scale)," ")}else{var Vr;en+=Pt()(Vr="M ".concat(this.roundtodec(Gn.segments[Gn.segments.length-1].x2*Tt.scale)," ")).call(Vr,this.roundtodec(Gn.segments[Gn.segments.length-1].y2*Tt.scale)," ")}for(an=Gn.segments.length-1;an>=0;an--){var Mr;if(en+="".concat(Gn.segments[an].type," "),Gn.segments[an].hasOwnProperty("x3")){var ns;en+=Pt()(ns="".concat(this.roundtodec(Gn.segments[an].x2*Tt.scale)," ")).call(ns,this.roundtodec(Gn.segments[an].y2*Tt.scale)," ")}en+=Pt()(Mr="".concat(this.roundtodec(Gn.segments[an].x1*Tt.scale)," ")).call(Mr,this.roundtodec(Gn.segments[an].y1*Tt.scale)," ")}}en+="Z "}if(en+='" />',Tt.lcpr||Tt.qcpr){for(an=0;an<zt.segments.length;an++){if(zt.segments[an].hasOwnProperty("x3")&&Tt.qcpr){var ys,bs,xs,Cs,ws,_s,Ss,Es,Ts,Is,Bs,Ms,Os,Ds;en+=Pt()(ys=Pt()(bs=Pt()(xs='<circle cx="'.concat(zt.segments[an].x2*Tt.scale,'" cy="')).call(xs,zt.segments[an].y2*Tt.scale,'" r="')).call(bs,Tt.qcpr,'" fill="cyan" stroke-width="')).call(ys,Tt.qcpr*.2,'" stroke="black" />'),en+=Pt()(Cs=Pt()(ws=Pt()(_s='<circle cx="'.concat(zt.segments[an].x3*Tt.scale,'" cy="')).call(_s,zt.segments[an].y3*Tt.scale,'" r="')).call(ws,Tt.qcpr,'" fill="white" stroke-width="')).call(Cs,Tt.qcpr*.2,'" stroke="black" />'),en+=Pt()(Ss=Pt()(Es=Pt()(Ts=Pt()(Is='<line x1="'.concat(zt.segments[an].x1*Tt.scale,'" y1="')).call(Is,zt.segments[an].y1*Tt.scale,'" x2="')).call(Ts,zt.segments[an].x2*Tt.scale,'" y2="')).call(Es,zt.segments[an].y2*Tt.scale,'" stroke-width="')).call(Ss,Tt.qcpr*.2,'" stroke="cyan" />'),en+=Pt()(Bs=Pt()(Ms=Pt()(Os=Pt()(Ds='<line x1="'.concat(zt.segments[an].x2*Tt.scale,'" y1="')).call(Ds,zt.segments[an].y2*Tt.scale,'" x2="')).call(Os,zt.segments[an].x3*Tt.scale,'" y2="')).call(Ms,zt.segments[an].y3*Tt.scale,'" stroke-width="')).call(Bs,Tt.qcpr*.2,'" stroke="cyan" />')}if(!zt.segments[an].hasOwnProperty("x3")&&Tt.lcpr){var js,Fs,Ns;en+=Pt()(js=Pt()(Fs=Pt()(Ns='<circle cx="'.concat(zt.segments[an].x2*Tt.scale,'" cy="')).call(Ns,zt.segments[an].y2*Tt.scale,'" r="')).call(Fs,Tt.lcpr,'" fill="white" stroke-width="')).call(js,Tt.lcpr*.2,'" stroke="black" />')}}for(var er=0;er<zt.holechildren.length;er++){var Gn=Yt[zt.holechildren[er]];for(an=0;an<Gn.segments.length;an++){if(Gn.segments[an].hasOwnProperty("x3")&&Tt.qcpr){var Ls,Pr,Xr,il,nl,rl,al,sl,ol,ll,cl,ul,fl,hl;en+=Pt()(Ls=Pt()(Pr=Pt()(Xr='<circle cx="'.concat(Gn.segments[an].x2*Tt.scale,'" cy="')).call(Xr,Gn.segments[an].y2*Tt.scale,'" r="')).call(Pr,Tt.qcpr,'" fill="cyan" stroke-width="')).call(Ls,Tt.qcpr*.2,'" stroke="black" />'),en+=Pt()(il=Pt()(nl=Pt()(rl='<circle cx="'.concat(Gn.segments[an].x3*Tt.scale,'" cy="')).call(rl,Gn.segments[an].y3*Tt.scale,'" r="')).call(nl,Tt.qcpr,'" fill="white" stroke-width="')).call(il,Tt.qcpr*.2,'" stroke="black" />'),en+=Pt()(al=Pt()(sl=Pt()(ol=Pt()(ll='<line x1="'.concat(Gn.segments[an].x1*Tt.scale,'" y1="')).call(ll,Gn.segments[an].y1*Tt.scale,'" x2="')).call(ol,Gn.segments[an].x2*Tt.scale,'" y2="')).call(sl,Gn.segments[an].y2*Tt.scale,'" stroke-width="')).call(al,Tt.qcpr*.2,'" stroke="cyan" />'),en+=Pt()(cl=Pt()(ul=Pt()(fl=Pt()(hl='<line x1="'.concat(Gn.segments[an].x2*Tt.scale,'" y1="')).call(hl,Gn.segments[an].y2*Tt.scale,'" x2="')).call(fl,Gn.segments[an].x3*Tt.scale,'" y2="')).call(ul,Gn.segments[an].y3*Tt.scale,'" stroke-width="')).call(cl,Tt.qcpr*.2,'" stroke="cyan" />')}if(!Gn.segments[an].hasOwnProperty("x3")&&Tt.lcpr){var dl,pl,gl;en+=Pt()(dl=Pt()(pl=Pt()(gl='<circle cx="'.concat(Gn.segments[an].x2*Tt.scale,'" cy="')).call(gl,Gn.segments[an].y2*Tt.scale,'" r="')).call(pl,Tt.lcpr,'" fill="white" stroke-width="')).call(dl,Tt.lcpr*.2,'" stroke="black" />')}}}}return en}},{key:"getsvgstring",value:function(_t,Et){var wt,Tt,Dt;Et=this.checkoptions(Et);for(var kt=_t.width*Et.scale,Yt=_t.height*Et.scale,zt=Pt()(wt="<svg ".concat(Et.viewbox?Pt()(Tt='viewBox="0 0 '.concat(kt," ")).call(Tt,Yt,'" '):Pt()(Dt='width="'.concat(kt,'" height="')).call(Dt,Yt,'" '),'version="1.1" xmlns="http://www.w3.org/2000/svg" desc="Created with imagetracer.js version ')).call(wt,this.versionnumber,'" >'),en=0;en<_t.layers.length;en+=1)for(var an=0;an<_t.layers[en].length;an+=1)_t.layers[en][an].isholepath||(zt+=this.svgpathstring(_t,en,an,Et));return zt+="</svg>",zt}},{key:"compareNumbers",value:function(_t,Et){return _t-Et}},{key:"torgbastr",value:function(_t){var Et,wt,Tt;return Pt()(Et=Pt()(wt=Pt()(Tt="rgba(".concat(_t.r,",")).call(Tt,_t.g,",")).call(wt,_t.b,",")).call(Et,_t.a,")")}},{key:"tosvgcolorstr",value:function(_t,Et){var wt,Tt,Dt,kt,Yt,zt,en;return Pt()(wt=Pt()(Tt=Pt()(Dt=Pt()(kt=Pt()(Yt=Pt()(zt=Pt()(en='fill="rgb('.concat(_t.r,",")).call(en,_t.g,",")).call(zt,_t.b,')" stroke="rgb(')).call(Yt,_t.r,",")).call(kt,_t.g,",")).call(Dt,_t.b,')" stroke-width="')).call(Tt,Et.strokewidth,'" opacity="')).call(wt,_t.a/255,'" ')}},{key:"appendSVGString",value:function(_t,Et){var wt;Et?(wt=document.getElementById(Et),wt||(wt=document.createElement("div"),wt.id=Et,document.body.appendChild(wt))):(wt=document.createElement("div"),document.body.appendChild(wt)),wt.innerHTML+=_t}},{key:"blur",value:function(_t,Et,wt){var Tt,Dt,kt,Yt,zt,en,an,vn,yn,Cn,wn={width:_t.width,height:_t.height,data:[]};if(Et=Math.floor(Et),Et<1)return _t;Et>5&&(Et=5),wt=Math.abs(wt),wt>1024&&(wt=1024);var _n=this.gks[Et-1];for(Dt=0;Dt<_t.height;Dt++)for(Tt=0;Tt<_t.width;Tt++){for(en=0,an=0,vn=0,yn=0,Cn=0,kt=-Et;kt<Et+1;kt++)Tt+kt>0&&Tt+kt<_t.width&&(zt=(Dt*_t.width+Tt+kt)*4,en+=_t.data[zt]*_n[kt+Et],an+=_t.data[zt+1]*_n[kt+Et],vn+=_t.data[zt+2]*_n[kt+Et],yn+=_t.data[zt+3]*_n[kt+Et],Cn+=_n[kt+Et]);zt=(Dt*_t.width+Tt)*4,wn.data[zt]=Math.floor(en/Cn),wn.data[zt+1]=Math.floor(an/Cn),wn.data[zt+2]=Math.floor(vn/Cn),wn.data[zt+3]=Math.floor(yn/Cn)}var Nn=new Uint8ClampedArray(wn.data);for(Dt=0;Dt<_t.height;Dt++)for(Tt=0;Tt<_t.width;Tt++){for(en=0,an=0,vn=0,yn=0,Cn=0,kt=-Et;kt<Et+1;kt++)Dt+kt>0&&Dt+kt<_t.height&&(zt=((Dt+kt)*_t.width+Tt)*4,en+=Nn[zt]*_n[kt+Et],an+=Nn[zt+1]*_n[kt+Et],vn+=Nn[zt+2]*_n[kt+Et],yn+=Nn[zt+3]*_n[kt+Et],Cn+=_n[kt+Et]);zt=(Dt*_t.width+Tt)*4,wn.data[zt]=Math.floor(en/Cn),wn.data[zt+1]=Math.floor(an/Cn),wn.data[zt+2]=Math.floor(vn/Cn),wn.data[zt+3]=Math.floor(yn/Cn)}for(Dt=0;Dt<_t.height;Dt++)for(Tt=0;Tt<_t.width;Tt++)zt=(Dt*_t.width+Tt)*4,Yt=Math.abs(wn.data[zt]-_t.data[zt])+Math.abs(wn.data[zt+1]-_t.data[zt+1])+Math.abs(wn.data[zt+2]-_t.data[zt+2])+Math.abs(wn.data[zt+3]-_t.data[zt+3]),Yt>wt&&(wn.data[zt]=_t.data[zt],wn.data[zt+1]=_t.data[zt+1],wn.data[zt+2]=_t.data[zt+2],wn.data[zt+3]=_t.data[zt+3]);return wn}},{key:"loadImage",value:function(_t,Et,wt){var Tt=new Image;wt&&wt.corsenabled&&(Tt.crossOrigin="Anonymous"),Tt.src=_t,Tt.onload=function(){var Dt=document.createElement("canvas");Dt.width=Tt.width,Dt.height=Tt.height;var kt=Dt.getContext("2d");kt.drawImage(Tt,0,0),Et(Dt)}}},{key:"getImgdata",value:function(_t){var Et=_t.getContext("2d");return Et.getImageData(0,0,_t.width,_t.height)}},{key:"drawLayers",value:function(_t,Et,wt,Tt){wt=wt||1;var Dt,kt,Yt,zt,en,an;Tt?(an=document.getElementById(Tt),an||(an=document.createElement("div"),an.id=Tt,document.body.appendChild(an))):(an=document.createElement("div"),document.body.appendChild(an));for(en in _t)if(!!_t.hasOwnProperty(en)){Dt=_t[en][0].length,kt=_t[en].length;var vn=document.createElement("canvas");vn.width=Dt*wt,vn.height=kt*wt;var yn=vn.getContext("2d");for(zt=0;zt<kt;zt+=1)for(Yt=0;Yt<Dt;Yt+=1)yn.fillStyle=this.torgbastr(Et[_t[en][zt][Yt]%Et.length]),yn.fillRect(Yt*wt,zt*wt,wt,wt);an.appendChild(vn)}}}],[{key:"tracerDefaultOption",value:function(){return{pathomit:100,ltres:.1,qtres:1,scale:1,strokewidth:5,viewbox:!1,linefilter:!0,desc:!1,rightangleenhance:!1,pal:[{r:0,g:0,b:0,a:255},{r:255,g:255,b:255,a:255}]}}}]),Rt}(),np={getActions:function(){return{main:this._mainAction(),shape:this._shapeAction(),crop:this._cropAction(),resize:this._resizeAction(),flip:this._flipAction(),rotate:this._rotateAction(),text:this._textAction(),mask:this._maskAction(),draw:this._drawAction(),icon:this._iconAction(),filter:this._filterAction(),history:this._historyAction()}},_mainAction:function(){var Bt=this,_t=function(){Bt.ui.submenu==="crop"&&(Bt.stopDrawingMode(),Bt.ui.changeMenu("crop"))},Et=function(en){Bt.ui.submenu==="rotate"&&Bt.ui.rotate.setRangeBarAngle("setAngle",en)},wt=function(en){Bt.ui.submenu==="filter"&&ts()(Bt.ui).setFilterState(en)},Tt=function(en){return Et(en),wt(en),en},Dt=function(){var en=Bt._graphics.getZoomMode();Bt.stopDrawingMode(),en!==jn.ZOOM?(Bt.startDrawingMode(nr.ZOOM),Bt._graphics.startZoomInMode()):Bt._graphics.endZoomInMode()},kt=function(){var en=Bt._graphics.getZoomMode();Bt.stopDrawingMode(),en!==jn.HAND?(Bt.startDrawingMode(nr.ZOOM),Bt._graphics.startHandMode()):Bt._graphics.endHandMode()},Yt=function(){ts()(Bt.ui)&&ts()(Bt.ui).initFilterCheckBoxState()};return(0,_i.extend)({initLoadImage:function(en,an){return Bt.loadImageFromURL(en,an).then(function(vn){_t(),Bt.ui.initializeImgUrl=en,Bt.ui.resizeEditor({imageSize:vn}),Bt.clearUndoStack(),Bt._invoker.fire(xn.EXECUTE_COMMAND,qn.LOAD_IMAGE)})},undo:function(){Bt.isEmptyUndoStack()||(_t(),Bt.deactivateAll(),Bt.undo().then(Tt))},redo:function(){Bt.isEmptyRedoStack()||(_t(),Bt.deactivateAll(),Bt.redo().then(Tt))},reset:function(){_t(),Bt.loadImageFromURL(Bt.ui.initializeImgUrl,"resetImage").then(function(en){_t(),Yt(),Bt.ui.resizeEditor({imageSize:en}),Bt.clearUndoStack(),Bt._initHistory()})},delete:function(){Bt.ui.changeHelpButtonEnabled("delete",!1),_t(),Bt.removeActiveObject(),Bt.activeObjectId=null},deleteAll:function(){_t(),Bt.clearObjects(),Bt.ui.changeHelpButtonEnabled("delete",!1),Bt.ui.changeHelpButtonEnabled("deleteAll",!1)},load:function(en){Wr()||alert("This browser does not support file-api"),Bt.ui.initializeImgUrl=tn().createObjectURL(en),Bt.loadImageFromFile(en).then(function(an){_t(),Yt(),Bt.clearUndoStack(),Bt.ui.activeMenuEvent(),Bt.ui.resizeEditor({imageSize:an}),Bt._clearHistory(),Bt._invoker.fire(xn.EXECUTE_COMMAND,qn.LOAD_IMAGE)}).catch(function(an){return Gt().reject(an)})},download:function(){var en=Bt.toDataURL(),an=Bt.getImageName(),vn,yn,Cn;Wr()&&window.saveAs?(vn=hn(en),yn=vn.type.split("/")[1],an.split(".").pop()!==yn&&(an+=".".concat(yn)),saveAs(vn,an)):(Cn=window.open(),Cn.document.body.innerHTML="<img src='".concat(en,"'>"))},history:function(en){Bt.ui.toggleHistoryMenu(en)},zoomIn:function(){Bt.ui.toggleZoomButtonStatus("zoomIn"),Bt.deactivateAll(),Dt()},zoomOut:function(){Bt._graphics.zoomOut()},hand:function(){Bt.ui.offZoomInButtonStatus(),Bt.ui.toggleZoomButtonStatus("hand"),Bt.deactivateAll(),kt()}},this._commonAction())},_iconAction:function(){var Bt=this;return(0,_i.extend)({changeColor:function(Et){Bt.activeObjectId&&Bt.changeIconColor(Bt.activeObjectId,Et)},addIcon:function(Et,wt){Bt.startDrawingMode("ICON"),Bt.setDrawingIcon(Et,wt)},cancelAddIcon:function(){Bt.ui.icon.clearIconType(),Bt.changeSelectableAll(!0),Bt.changeCursor("default"),Bt.stopDrawingMode()},registerDefaultIcons:function(Et,wt){var Tt={};Tt[Et]=wt,Bt.registerIcons(Tt)},registerCustomIcon:function(Et,wt){var Tt=new Ao;Tt.imageToSVG(Et,function(Dt){var kt=Dt.match(/path[^>]*d="([^"]*)"/),Yt=gn(kt,2),zt=Yt[1],en={};en[wt.name]=zt,Bt.registerIcons(en),Bt.addIcon(wt.name,{left:100,top:100})},Ao.tracerDefaultOption())}},this._commonAction())},_drawAction:function(){var Bt=this;return(0,_i.extend)({setDrawMode:function(Et,wt){Bt.stopDrawingMode(),Et==="free"?Bt.startDrawingMode("FREE_DRAWING",wt):Bt.startDrawingMode("LINE_DRAWING",wt)},setColor:function(Et){Bt.setBrush({color:Et})}},this._commonAction())},_maskAction:function(){var Bt=this;return(0,_i.extend)({loadImageFromURL:function(Et,wt){return Bt.loadImageFromURL(Bt.toDataURL(),"FilterImage").then(function(){Bt.addImageObject(Et).then(function(){tn().revokeObjectURL(wt)}),Bt._invoker.fire(xn.EXECUTE_COMMAND,qn.LOAD_MASK_IMAGE)})},applyFilter:function(){Bt.applyFilter("mask",{maskObjId:Bt.activeObjectId})}},this._commonAction())},_textAction:function(){var Bt=this;return(0,_i.extend)({changeTextStyle:function(Et,wt){Bt.activeObjectId&&Bt.changeTextStyle(Bt.activeObjectId,Et,wt)}},this._commonAction())},_rotateAction:function(){var Bt=this;return(0,_i.extend)({rotate:function(Et,wt){Bt.rotate(Et,wt),Bt.ui.resizeEditor(),Bt.ui.rotate.setRangeBarAngle("rotate",Et)},setAngle:function(Et,wt){Bt.setAngle(Et,wt),Bt.ui.resizeEditor(),Bt.ui.rotate.setRangeBarAngle("setAngle",Et)}},this._commonAction())},_shapeAction:function(){var Bt=this;return(0,_i.extend)({changeShape:function(Et,wt){Bt.activeObjectId&&Bt.changeShape(Bt.activeObjectId,Et,wt)},setDrawingShape:function(Et){Bt.setDrawingShape(Et)}},this._commonAction())},_cropAction:function(){var Bt=this;return(0,_i.extend)({crop:function(){var Et=Bt.getCropzoneRect();Et&&!vl(Et)&&Bt.crop(Et).then(function(){Bt.stopDrawingMode(),Bt.ui.resizeEditor(),Bt.ui.changeMenu("crop"),Bt._invoker.fire(xn.EXECUTE_COMMAND,qn.CROP)}).catch(function(wt){return Gt().reject(wt)})},cancel:function(){Bt.stopDrawingMode(),Bt.ui.changeMenu("crop")},preset:function(Et){switch(Et){case"preset-square":Bt.setCropzoneRect(1/1);break;case"preset-3-2":Bt.setCropzoneRect(3/2);break;case"preset-4-3":Bt.setCropzoneRect(4/3);break;case"preset-5-4":Bt.setCropzoneRect(5/4);break;case"preset-7-5":Bt.setCropzoneRect(7/5);break;case"preset-16-9":Bt.setCropzoneRect(16/9);break;default:Bt.setCropzoneRect(),Bt.ui.crop.changeApplyButtonStatus(!1);break}}},this._commonAction())},_resizeAction:function(){var Bt=this;return(0,_i.extend)({getCurrentDimensions:function(){return Bt._graphics.getCurrentDimensions()},preview:function(Et,wt,Tt){var Dt=Bt._graphics.getCurrentDimensions(),kt=function(){return Dt.width/Dt.height},Yt={};switch(Et){case"width":Yt.width=wt,Tt?Yt.height=wt/kt():Yt.height=Dt.height;break;case"height":Yt.height=wt,Tt?Yt.width=wt*kt():Yt.width=Dt.width;break;default:Yt=Dt}Bt._graphics.resize(Yt).then(function(){Bt.ui.resizeEditor()}),Tt&&(Bt.ui.resize.setWidthValue(Yt.width),Bt.ui.resize.setHeightValue(Yt.height))},lockAspectRatio:function(Et,wt,Tt){var Dt=Bt._graphics.getCurrentDimensions(),kt=Dt.width,Yt=Dt.height,zt=kt/Yt;if(Et)if(kt>Yt){var en=Tt/zt,an=wt*zt;Bt.ui.resize.setLimit({minWidth:an>wt?an:wt,minHeight:wt,maxWidth:Tt,maxHeight:en<Tt?en:Tt})}else{var vn=Tt*zt,yn=wt/zt;Bt.ui.resize.setLimit({minWidth:wt,minHeight:yn>wt?yn:wt,maxWidth:vn<Tt?vn:Tt,maxHeight:Tt})}else Bt.ui.resize.setLimit({minWidth:wt,minHeight:wt,maxWidth:Tt,maxHeight:Tt})},resize:function(){var Et=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;Et||(Et=Bt._graphics.getCurrentDimensions()),Bt.resize(Et).then(function(){Bt._graphics.setOriginalDimensions(Et),Bt.stopDrawingMode(),Bt.ui.resizeEditor(),Bt.ui.changeMenu("resize")}).catch(function(wt){return Gt().reject(wt)})},reset:function(){var Et=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,wt=Bt._graphics.getOriginalDimensions();Bt.ui.resize.setWidthValue(wt.width,!0),Bt.ui.resize.setHeightValue(wt.height,!0),Bt._graphics.resize(wt).then(function(){Et||(Bt.stopDrawingMode(),Bt.ui.resizeEditor(),Bt.ui.changeMenu("resize"))})}},this._commonAction())},_flipAction:function(){var Bt=this;return(0,_i.extend)({flip:function(Et){return Bt[Et]()}},this._commonAction())},_filterAction:function(){var Bt=this;return(0,_i.extend)({applyFilter:function(Et,wt,Tt,Dt){Et?Bt.applyFilter(wt,Tt,Dt):Bt.hasFilter(wt)&&Bt.removeFilter(wt)}},this._commonAction())},setReAction:function(){var Bt=this;this.on({undoStackChanged:function(Et){Et?(Bt.ui.changeHelpButtonEnabled("undo",!0),Bt.ui.changeHelpButtonEnabled("reset",!0)):(Bt.ui.changeHelpButtonEnabled("undo",!1),Bt.ui.changeHelpButtonEnabled("reset",!1)),Bt.ui.resizeEditor()},redoStackChanged:function(Et){Et?Bt.ui.changeHelpButtonEnabled("redo",!0):Bt.ui.changeHelpButtonEnabled("redo",!1),Bt.ui.resizeEditor()},objectActivated:function(Et){var wt,Tt;Bt.activeObjectId=Et.id,Bt.ui.changeHelpButtonEnabled("delete",!0),Bt.ui.changeHelpButtonEnabled("deleteAll",!0),Et.type==="cropzone"?Bt.ui.crop.changeApplyButtonStatus(!0):at()(wt=["rect","circle","triangle"]).call(wt,Et.type)>-1?(Bt.stopDrawingMode(),Bt.ui.submenu!=="shape"&&Bt.ui.changeMenu("shape",!1,!1),Bt.ui.shape.setShapeStatus({strokeColor:Et.stroke,strokeWidth:Et.strokeWidth,fillColor:sn()(Et)}),Bt.ui.shape.setMaxStrokeValue(Math.min(Et.width,Et.height))):Et.type==="path"||Et.type==="line"?Bt.ui.submenu!=="draw"&&(Bt.ui.changeMenu("draw",!1,!1),Bt.ui.draw.changeStandbyMode()):at()(Tt=["i-text","text"]).call(Tt,Et.type)>-1?(Bt.ui.submenu!=="text"&&Bt.ui.changeMenu("text",!1,!1),Bt.ui.text.setTextStyleStateOnAction(Et)):Et.type==="icon"&&(Bt.stopDrawingMode(),Bt.ui.submenu!=="icon"&&Bt.ui.changeMenu("icon",!1,!1),Bt.ui.icon.setIconPickerColor(sn()(Et)))},addText:function(Et){var wt=Bt.ui.text,Tt=wt.textColor,Dt=wt.fontSize,kt=wt.fontStyle,Yt=wt.fontWeight,zt=wt.underline,en="Noto Sans";Bt.addText("Double Click",{position:Et.originPosition,styles:{fill:Tt,fontSize:Dt,fontFamily:en,fontStyle:kt,fontWeight:Yt,underline:zt}}).then(function(){Bt.changeCursor("default")})},addObjectAfter:function(Et){var wt;Et.type==="icon"?Bt.ui.icon.changeStandbyMode():at()(wt=["rect","circle","triangle"]).call(wt,Et.type)>-1&&(Bt.ui.shape.setMaxStrokeValue(Math.min(Et.width,Et.height)),Bt.ui.shape.changeStandbyMode())},objectScaled:function(Et){var wt,Tt;if(at()(wt=["i-text","text"]).call(wt,Et.type)>-1)Bt.ui.text.fontSize=Sr(Et.fontSize);else if(at()(Tt=["rect","circle","triangle"]).call(Tt,Et.type)>=0){var Dt=Et.width,kt=Et.height,Yt=Bt.ui.shape.getStrokeValue();Dt<Yt&&Bt.ui.shape.setStrokeValue(Dt),kt<Yt&&Bt.ui.shape.setStrokeValue(kt)}},selectionCleared:function(){Bt.activeObjectId=null,Bt.ui.submenu==="text"?Bt.changeCursor("text"):hr(["draw","crop","resize"],Bt.ui.submenu)||Bt.stopDrawingMode()}})},_historyAction:function(){var Bt=this;return{undo:function(Et){return Bt.undo(Et)},redo:function(Et){return Bt.redo(Et)}}},_commonAction:function(){var Bt=this,_t,Et,wt,Tt,Dt=nr.TEXT,kt=nr.CROPPER,Yt=nr.SHAPE,zt=nr.ZOOM,en=nr.RESIZE;return{modeChange:function(vn){switch(vn){case On.TEXT:Bt._changeActivateMode(Dt);break;case On.CROP:Bt.startDrawingMode(kt);break;case On.SHAPE:Bt._changeActivateMode(Yt),Bt.setDrawingShape(Bt.ui.shape.type,Bt.ui.shape.options);break;case On.ZOOM:Bt.startDrawingMode(zt);break;case On.RESIZE:Bt.startDrawingMode(en);break}},deactivateAll:Lt()(_t=this.deactivateAll).call(_t,this),changeSelectableAll:Lt()(Et=this.changeSelectableAll).call(Et,this),discardSelection:Lt()(wt=this.discardSelection).call(wt,this),stopDrawingMode:Lt()(Tt=this.stopDrawingMode).call(Tt,this)}},mixin:function(Bt){(0,_i.extend)(Bt.prototype,this)}},rp=tt(899),Yr=tt.n(rp),ap=function(){function Rt(Bt,_t){Ht(this,Rt),this.name=Bt,this.graphics=_t}return Wt(Rt,[{key:"fire",value:function(){for(var _t=this.graphics,Et=arguments.length,wt=new Array(Et),Tt=0;Tt<Et;Tt++)wt[Tt]=arguments[Tt];return this.graphics.fire.apply(_t,wt)}},{key:"setCanvasImage",value:function(_t,Et){this.graphics.setCanvasImage(_t,Et)}},{key:"getCanvasElement",value:function(){return this.graphics.getCanvasElement()}},{key:"getCanvas",value:function(){return this.graphics.getCanvas()}},{key:"getCanvasImage",value:function(){return this.graphics.getCanvasImage()}},{key:"getImageName",value:function(){return this.graphics.getImageName()}},{key:"getEditor",value:function(){return this.graphics.getEditor()}},{key:"getName",value:function(){return this.name}},{key:"setImageProperties",value:function(_t,Et){this.graphics.setImageProperties(_t,Et)}},{key:"setCanvasCssDimension",value:function(_t){this.graphics.setCanvasCssDimension(_t)}},{key:"setCanvasBackstoreDimension",value:function(_t){this.graphics.setCanvasBackstoreDimension(_t)}},{key:"adjustCanvasDimension",value:function(){this.graphics.adjustCanvasDimension()}},{key:"adjustCanvasDimensionBase",value:function(){this.graphics.adjustCanvasDimensionBase()}}]),Rt}(),Fr=ap;function sp(Rt){var Bt=op();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function op(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var lp={padding:0,crossOrigin:"Anonymous"},cp=function(Rt){lr(_t,Rt);var Bt=sp(_t);function _t(Et){return Ht(this,_t),Bt.call(this,Tn.IMAGE_LOADER,Et)}return Wt(_t,[{key:"load",value:function(wt,Tt){var Dt=this,kt;if(!wt&&!Tt){var Yt=this.getCanvas();Yt.backgroundImage=null,Yt.renderAll(),kt=new(Gt())(function(zt){Dt.setCanvasImage("",null),zt()})}else kt=this._setBackgroundImage(Tt).then(function(zt){return Dt.setCanvasImage(wt,zt),Dt.adjustCanvasDimension(),zt});return kt}},{key:"_setBackgroundImage",value:function(wt){var Tt=this;return wt?new(Gt())(function(Dt,kt){var Yt=Tt.getCanvas();Yt.setBackgroundImage(wt,function(){var zt=Yt.backgroundImage;zt&&zt.getElement()?Dt(zt):kt(Hn.loadingImageFailed)},lp)}):Gt().reject(Hn.loadImage)}}]),_t}(Fr),up=cp,fp="tl",hp="tr",dp="mt",pp="ml",gp="mr",Ap="mb",mp="bl",vp="br",mo=[fp,hp,dp,pp,gp,Ap,mp,vp],Us=function(){};function yp(Rt){return at()(mo).call(mo,Rt)>=0}function ds(Rt,Bt){return Rt>Bt?"width":"height"}var bp=Vt.fabric.util.createClass(Vt.fabric.Rect,{initialize:function(Bt,_t,Et){_t=Xt().extend(_t,Et),_t.type="cropzone",this.callSuper("initialize",_t),this._addEventHandler(),this.canvas=Bt,this.options=_t},canvasEventDelegation:function(Bt){var _t,Et="unregistered",wt=this.canvasEventTrigger[Bt]!==Us;return wt?Et="registered":at()(_t=[xn.OBJECT_MOVED,xn.OBJECT_SCALED]).call(_t,Bt)<0&&(Et="none"),Et},canvasEventRegister:function(Bt,_t){this.canvasEventTrigger[Bt]=_t},_addEventHandler:function(){var Bt,_t,Et,wt,Tt;this.canvasEventTrigger=(Bt={},Qt(Bt,xn.OBJECT_MOVED,Us),Qt(Bt,xn.OBJECT_SCALED,Us),Bt),this.on({moving:Lt()(_t=this._onMoving).call(_t,this),scaling:Lt()(Et=this._onScaling).call(Et,this)}),Vt.fabric.util.addListener(document,"keydown",Lt()(wt=this._onKeyDown).call(wt,this)),Vt.fabric.util.addListener(document,"keyup",Lt()(Tt=this._onKeyUp).call(Tt,this))},_renderCropzone:function(Bt){var _t=7,Et=7,wt=this.flipX?-1:1,Tt=this.flipY?-1:1,Dt=wt/this.scaleX,kt=Tt/this.scaleY;Bt.scale(Dt,kt),this._fillOuterRect(Bt,"rgba(0, 0, 0, 0.5)"),this.options.lineWidth?(this._fillInnerRect(Bt),this._strokeBorder(Bt,"rgb(255, 255, 255)",{lineWidth:this.options.lineWidth})):(this._strokeBorder(Bt,"rgb(0, 0, 0)",{lineDashWidth:_t}),this._strokeBorder(Bt,"rgb(255, 255, 255)",{lineDashWidth:_t,lineDashOffset:Et})),Bt.scale(1/Dt,1/kt)},_render:function(Bt){this.callSuper("_render",Bt),this._renderCropzone(Bt)},_fillOuterRect:function(Bt,_t){var Et=this._getCoordinates(),wt=Et.x,Tt=Et.y;Bt.save(),Bt.fillStyle=_t,Bt.beginPath(),Bt.moveTo(wt[0]-1,Tt[0]-1),Bt.lineTo(wt[3]+1,Tt[0]-1),Bt.lineTo(wt[3]+1,Tt[3]+1),Bt.lineTo(wt[0]-1,Tt[3]+1),Bt.lineTo(wt[0]-1,Tt[0]-1),Bt.closePath(),Bt.moveTo(wt[1],Tt[1]),Bt.lineTo(wt[1],Tt[2]),Bt.lineTo(wt[2],Tt[2]),Bt.lineTo(wt[2],Tt[1]),Bt.lineTo(wt[1],Tt[1]),Bt.closePath(),sn()(Bt).call(Bt),Bt.restore()},_fillInnerRect:function(Bt){var _t=this._getCoordinates(),Et=_t.x,wt=_t.y,Tt=this._caculateInnerPosition(Et,(Et[2]-Et[1])/3),Dt=this._caculateInnerPosition(wt,(wt[2]-wt[1])/3);Bt.save(),Bt.strokeStyle="rgba(255, 255, 255, 0.7)",Bt.lineWidth=this.options.lineWidth,Bt.beginPath(),Bt.moveTo(Tt[0],Dt[1]),Bt.lineTo(Tt[3],Dt[1]),Bt.moveTo(Tt[0],Dt[2]),Bt.lineTo(Tt[3],Dt[2]),Bt.moveTo(Tt[1],Dt[0]),Bt.lineTo(Tt[1],Dt[3]),Bt.moveTo(Tt[2],Dt[0]),Bt.lineTo(Tt[2],Dt[3]),Bt.stroke(),Bt.closePath(),Bt.restore()},_caculateInnerPosition:function(Bt,_t){var Et=[];return Et[0]=Bt[1],Et[1]=Bt[1]+_t,Et[2]=Bt[1]+_t*2,Et[3]=Bt[2],Et},_getCoordinates:function(){var Bt=this.canvas,_t=this.width,Et=this.height,wt=this.left,Tt=this.top,Dt=_t/2,kt=Et/2,Yt=Bt.getHeight(),zt=Bt.getWidth();return{x:Yr()(Xt()).call(Xt(),[-(Dt+wt),-Dt,Dt,Dt+(zt-wt-_t)],Math.ceil),y:Yr()(Xt()).call(Xt(),[-(kt+Tt),-kt,kt,kt+(Yt-Tt-Et)],Math.ceil)}},_strokeBorder:function(Bt,_t,Et){var wt=Et.lineDashWidth,Tt=Et.lineDashOffset,Dt=Et.lineWidth,kt=this.width/2,Yt=this.height/2;Bt.save(),Bt.strokeStyle=_t,Bt.setLineDash&&Bt.setLineDash([wt,wt]),Tt&&(Bt.lineDashOffset=Tt),Dt&&(Bt.lineWidth=Dt),Bt.beginPath(),Bt.moveTo(-kt,-Yt),Bt.lineTo(kt,-Yt),Bt.lineTo(kt,Yt),Bt.lineTo(-kt,Yt),Bt.lineTo(-kt,-Yt),Bt.stroke(),Bt.restore()},_onMoving:function(){var Bt=this.height,_t=this.width,Et=this.left,wt=this.top,Tt=this.canvas.getWidth()-_t,Dt=this.canvas.getHeight()-Bt;this.left=Cr(Et,0,Tt),this.top=Cr(wt,0,Dt),this.canvasEventTrigger[xn.OBJECT_MOVED](this)},_onScaling:function(Bt){var _t=Bt.transform.corner,Et=this.canvas.getPointer(Bt.e),wt=this._calcScalingSizeFromPointer(Et,_t);this.scale(1).set(wt),this.canvasEventTrigger[xn.OBJECT_SCALED](this)},_calcScalingSizeFromPointer:function(Bt,_t){var Et=yp(_t);return Et&&this._resizeCropZone(Bt,_t)},adjustRatioCropzoneSize:function(Bt){var _t=Bt.width,Et=Bt.height,wt=Bt.leftMaker,Tt=Bt.topMaker,Dt=Bt.maxWidth,kt=Bt.maxHeight,Yt=Bt.scaleTo;if(_t=Dt?Cr(_t,1,Dt):_t,Et=kt?Cr(Et,1,kt):Et,!this.presetRatio)return this._withShiftKey&&(_t>Et?Et=_t:Et>_t&&(_t=Et)),{width:_t,height:Et,left:wt(_t),top:Tt(Et)};Yt==="width"?Et=_t/this.presetRatio:_t=Et*this.presetRatio;var zt=Math.min(Dt/_t,kt/Et);if(zt<=1){var en,an=Yr()(en=[_t,Et]).call(en,function(yn){return yn*zt}),vn=gn(an,2);_t=vn[0],Et=vn[1]}return{width:_t,height:Et,left:wt(_t),top:Tt(Et)}},_getCropzoneRectInfo:function(){var Bt=this.canvas,_t=Bt.width,Et=Bt.height,wt=this.getBoundingRect(!1,!0),Tt=wt.top,Dt=wt.left,kt=wt.width,Yt=wt.height;return{rectTop:Tt,rectLeft:Dt,rectWidth:kt,rectHeight:Yt,rectRight:Dt+kt,rectBottom:Tt+Yt,canvasWidth:_t,canvasHeight:Et}},_resizeCropZone:function(Bt,_t){var Et=Bt.x,wt=Bt.y,Tt=this._getCropzoneRectInfo(),Dt=Tt.rectWidth,kt=Tt.rectHeight,Yt=Tt.rectTop,zt=Tt.rectLeft,en=Tt.rectBottom,an=Tt.rectRight,vn=Tt.canvasWidth,yn=Tt.canvasHeight,Cn={tl:{width:an-Et,height:en-wt,leftMaker:function(_n){return an-_n},topMaker:function(_n){return en-_n},maxWidth:an,maxHeight:en,scaleTo:ds(zt-Et,Yt-wt)},tr:{width:Et-zt,height:en-wt,leftMaker:function(){return zt},topMaker:function(_n){return en-_n},maxWidth:vn-zt,maxHeight:en,scaleTo:ds(Et-an,Yt-wt)},mt:{width:Dt,height:en-wt,leftMaker:function(){return zt},topMaker:function(_n){return en-_n},maxWidth:vn-zt,maxHeight:en,scaleTo:"height"},ml:{width:an-Et,height:kt,leftMaker:function(_n){return an-_n},topMaker:function(){return Yt},maxWidth:an,maxHeight:yn-Yt,scaleTo:"width"},mr:{width:Et-zt,height:kt,leftMaker:function(){return zt},topMaker:function(){return Yt},maxWidth:vn-zt,maxHeight:yn-Yt,scaleTo:"width"},mb:{width:Dt,height:wt-Yt,leftMaker:function(){return zt},topMaker:function(){return Yt},maxWidth:vn-zt,maxHeight:yn-Yt,scaleTo:"height"},bl:{width:an-Et,height:wt-Yt,leftMaker:function(_n){return an-_n},topMaker:function(){return Yt},maxWidth:an,maxHeight:yn-Yt,scaleTo:ds(zt-Et,wt-en)},br:{width:Et-zt,height:wt-Yt,leftMaker:function(){return zt},topMaker:function(){return Yt},maxWidth:vn-zt,maxHeight:yn-Yt,scaleTo:ds(Et-an,wt-en)}};return this.adjustRatioCropzoneSize(Cn[_t])},isValid:function(){return this.left>=0&&this.top>=0&&this.width>0&&this.height>0},_onKeyDown:function(Bt){var _t=Bt.keyCode;_t===Ln.SHIFT&&(this._withShiftKey=!0)},_onKeyUp:function(Bt){var _t=Bt.keyCode;_t===Ln.SHIFT&&(this._withShiftKey=!1)}}),xp=bp;function Cp(Rt){var Bt=wp();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function wp(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var _p=10,Sp={presetRatio:null,top:-10,left:-10,height:1,width:1},Ep=function(Rt){lr(_t,Rt);var Bt=Cp(_t);function _t(Et){var wt,Tt,Dt,kt,Yt,zt;return Ht(this,_t),zt=Bt.call(this,Tn.CROPPER,Et),zt._cropzone=null,zt._startX=null,zt._startY=null,zt._withShiftKey=!1,zt._listeners={keydown:Lt()(wt=zt._onKeyDown).call(wt,sr(zt)),keyup:Lt()(Tt=zt._onKeyUp).call(Tt,sr(zt)),mousedown:Lt()(Dt=zt._onFabricMouseDown).call(Dt,sr(zt)),mousemove:Lt()(kt=zt._onFabricMouseMove).call(kt,sr(zt)),mouseup:Lt()(Yt=zt._onFabricMouseUp).call(Yt,sr(zt))},zt}return Wt(_t,[{key:"start",value:function(){if(!this._cropzone){var wt=this.getCanvas();wt.forEachObject(function(Tt){Tt.evented=!1}),this._cropzone=new xp(wt,Xt().extend({left:0,top:0,width:.5,height:.5,strokeWidth:0,cornerSize:10,cornerColor:"black",fill:"transparent"},Qn,this.graphics.cropSelectionStyle)),wt.discardActiveObject(),wt.add(this._cropzone),wt.on("mouse:down",this._listeners.mousedown),wt.selection=!1,wt.defaultCursor="crosshair",Vt.fabric.util.addListener(document,"keydown",this._listeners.keydown),Vt.fabric.util.addListener(document,"keyup",this._listeners.keyup)}}},{key:"end",value:function(){var wt=this.getCanvas(),Tt=this._cropzone;!Tt||(wt.remove(Tt),wt.selection=!0,wt.defaultCursor="default",wt.off("mouse:down",this._listeners.mousedown),wt.forEachObject(function(Dt){Dt.evented=!0}),this._cropzone=null,Vt.fabric.util.removeListener(document,"keydown",this._listeners.keydown),Vt.fabric.util.removeListener(document,"keyup",this._listeners.keyup))}},{key:"changeVisibility",value:function(wt){this._cropzone&&this._cropzone.set({visible:wt})}},{key:"_onFabricMouseDown",value:function(wt){var Tt=this.getCanvas();if(!wt.target){Tt.selection=!1;var Dt=Tt.getPointer(wt.e);this._startX=Dt.x,this._startY=Dt.y,Tt.on({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}}},{key:"_onFabricMouseMove",value:function(wt){var Tt=this.getCanvas(),Dt=Tt.getPointer(wt.e),kt=Dt.x,Yt=Dt.y,zt=this._cropzone;Math.abs(kt-this._startX)+Math.abs(Yt-this._startY)>_p&&(Tt.remove(zt),zt.set(this._calcRectDimensionFromPoint(kt,Yt)),Tt.add(zt),Tt.setActiveObject(zt))}},{key:"_calcRectDimensionFromPoint",value:function(wt,Tt){var Dt=this.getCanvas(),kt=Dt.getWidth(),Yt=Dt.getHeight(),zt=this._startX,en=this._startY,an=Cr(wt,0,zt),vn=Cr(Tt,0,en),yn=Cr(wt,zt,kt)-an,Cn=Cr(Tt,en,Yt)-vn;return this._withShiftKey&&(yn>Cn?Cn=yn:Cn>yn&&(yn=Cn),zt>=wt&&(an=zt-yn),en>=Tt&&(vn=en-Cn)),{left:an,top:vn,width:yn,height:Cn}}},{key:"_onFabricMouseUp",value:function(){var wt=this._cropzone,Tt=this._listeners,Dt=this.getCanvas();Dt.setActiveObject(wt),Dt.off({"mouse:move":Tt.mousemove,"mouse:up":Tt.mouseup})}},{key:"getCroppedImageData",value:function(wt){var Tt=this.getCanvas(),Dt=Tt.contains(this._cropzone);if(!wt)return null;Dt&&Tt.remove(this._cropzone);var kt={imageName:this.getImageName(),url:Tt.toDataURL(wt)};return Dt&&Tt.add(this._cropzone),kt}},{key:"getCropzoneRect",value:function(){var wt=this._cropzone;return wt.isValid()?{left:wt.left,top:wt.top,width:wt.width,height:wt.height}:null}},{key:"setCropzoneRect",value:function(wt){var Tt=this.getCanvas(),Dt=this._cropzone;Tt.discardActiveObject(),Tt.selection=!1,Tt.remove(Dt),Dt.set(wt?this._getPresetPropertiesForCropSize(wt):Sp),Tt.add(Dt),Tt.selection=!0,wt&&Tt.setActiveObject(Dt)}},{key:"_getPresetPropertiesForCropSize",value:function(wt){var Tt=this.getCanvas(),Dt=Tt.getWidth(),kt=Tt.getHeight(),Yt=Dt>=kt?Dt:kt,zt=function(Zn,er){return Zn>er?er/Zn:1},en=Yt*wt,an=Yt,vn=zt(en,Dt),yn=Yr()(Xt()).call(Xt(),[en,an],function(Kn){return Kn*vn}),Cn=gn(yn,2);en=Cn[0],an=Cn[1];var wn=zt(an,kt),_n=Yr()(Xt()).call(Xt(),[en,an],function(Kn){return Fn(Kn*wn)}),Nn=gn(_n,2);return en=Nn[0],an=Nn[1],{presetRatio:wt,top:(kt-an)/2,left:(Dt-en)/2,width:en,height:an}}},{key:"_onKeyDown",value:function(wt){wt.keyCode===Ln.SHIFT&&(this._withShiftKey=!0)}},{key:"_onKeyUp",value:function(wt){wt.keyCode===Ln.SHIFT&&(this._withShiftKey=!1)}}]),_t}(Fr),Tp=Ep;function Ip(Rt){var Bt=Bp();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Bp(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Mp=function(Rt){lr(_t,Rt);var Bt=Ip(_t);function _t(Et){return Ht(this,_t),Bt.call(this,Tn.FLIP,Et)}return Wt(_t,[{key:"getCurrentSetting",value:function(){var wt=this.getCanvasImage();return{flipX:wt.flipX,flipY:wt.flipY}}},{key:"set",value:function(wt){var Tt=this.getCurrentSetting(),Dt=Tt.flipX!==wt.flipX,kt=Tt.flipY!==wt.flipY;return!Dt&&!kt?Gt().reject(Hn.flip):(Xt().extend(Tt,wt),this.setImageProperties(Tt,!0),this._invertAngle(Dt,kt),this._flipObjects(Dt,kt),Gt().resolve({flipX:Tt.flipX,flipY:Tt.flipY,angle:this.getCanvasImage().angle}))}},{key:"_invertAngle",value:function(wt,Tt){var Dt=this.getCanvasImage(),kt=Dt.angle;wt&&(kt*=-1),Tt&&(kt*=-1),Dt.rotate(Hr()(kt)).setCoords()}},{key:"_flipObjects",value:function(wt,Tt){var Dt=this.getCanvas();wt&&Dt.forEachObject(function(kt){kt.set({angle:Hr()(kt.angle*-1),flipX:!kt.flipX,left:Dt.width-kt.left}).setCoords()}),Tt&&Dt.forEachObject(function(kt){kt.set({angle:Hr()(kt.angle*-1),flipY:!kt.flipY,top:Dt.height-kt.top}).setCoords()}),Dt.renderAll()}},{key:"reset",value:function(){return this.set({flipX:!1,flipY:!1})}},{key:"flipX",value:function(){var wt=this.getCurrentSetting();return this.set({flipX:!wt.flipX,flipY:wt.flipY})}},{key:"flipY",value:function(){var wt=this.getCurrentSetting();return this.set({flipX:wt.flipX,flipY:!wt.flipY})}}]),_t}(Fr),Op=Mp;function Dp(Rt){var Bt=jp();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function jp(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Fp=function(Rt){lr(_t,Rt);var Bt=Dp(_t);function _t(Et){return Ht(this,_t),Bt.call(this,Tn.ROTATION,Et)}return Wt(_t,[{key:"getCurrentAngle",value:function(){return this.getCanvasImage().angle}},{key:"setAngle",value:function(wt){var Tt=this.getCurrentAngle()%360;wt%=360;var Dt=this.getCanvasImage(),kt=Dt.getCenterPoint();Dt.set({angle:wt}).setCoords(),this.adjustCanvasDimension();var Yt=Dt.getCenterPoint();return this._rotateForEachObject(kt,Yt,wt-Tt),Gt().resolve(wt)}},{key:"_rotateForEachObject",value:function(wt,Tt,Dt){var kt=this.getCanvas(),Yt={x:wt.x-Tt.x,y:wt.y-Tt.y};kt.forEachObject(function(zt){var en=zt.getCenterPoint(),an=Vt.fabric.util.degreesToRadians(Dt),vn=Vt.fabric.util.rotatePoint(en,wt,an);zt.set({left:vn.x-Yt.x,top:vn.y-Yt.y,angle:(zt.angle+Dt)%360}),zt.setCoords()}),kt.renderAll()}},{key:"rotate",value:function(wt){var Tt=this.getCurrentAngle();return this.setAngle(Tt+wt)}}]),_t}(Fr),Np=Fp;function Lp(Rt){var Bt=kp();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function kp(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Pp=function(Rt){lr(_t,Rt);var Bt=Lp(_t);function _t(Et){var wt;return Ht(this,_t),wt=Bt.call(this,Tn.FREE_DRAWING,Et),wt.width=12,wt.oColor=new Vt.fabric.Color("rgba(0, 0, 0, 0.5)"),wt}return Wt(_t,[{key:"start",value:function(wt){var Tt=this.getCanvas();Tt.isDrawingMode=!0,this.setBrush(wt)}},{key:"setBrush",value:function(wt){var Tt=this.getCanvas().freeDrawingBrush;wt=wt||{},this.width=wt.width||this.width,wt.color&&(this.oColor=new Vt.fabric.Color(wt.color)),Tt.width=this.width,Tt.color=this.oColor.toRgba()}},{key:"end",value:function(){var wt=this.getCanvas();wt.isDrawingMode=!1}}]),_t}(Fr),Rp=Pp,vo=30,Up=2.7,Hp=1.7,yo=180,zp=Vt.fabric.util.createClass(Vt.fabric.Line,{type:"line",initialize:function(Bt){var _t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.callSuper("initialize",Bt,_t),this.arrowType=_t.arrowType},_render:function(Bt){var _t=this.calcLinePoints(),Et=_t.x1,wt=_t.y1,Tt=_t.x2,Dt=_t.y2,kt={fromX:Et,fromY:wt,toX:Tt,toY:Dt};this.ctx=Bt,Bt.lineWidth=this.strokeWidth,this._renderBasicLinePath(kt),this._drawDecoratorPath(kt),this._renderStroke(Bt)},_renderBasicLinePath:function(Bt){var _t=Bt.fromX,Et=Bt.fromY,wt=Bt.toX,Tt=Bt.toY;this.ctx.beginPath(),this.ctx.moveTo(_t,Et),this.ctx.lineTo(wt,Tt)},_drawDecoratorPath:function(Bt){this._drawDecoratorPathType("head",Bt),this._drawDecoratorPathType("tail",Bt)},_drawDecoratorPathType:function(Bt,_t){switch(this.arrowType[Bt]){case"triangle":this._drawTrianglePath(Bt,_t);break;case"chevron":this._drawChevronPath(Bt,_t);break}},_drawTrianglePath:function(Bt,_t){var Et=this.ctx.lineWidth*Hp;this._drawChevronPath(Bt,_t,Et),this.ctx.closePath()},_drawChevronPath:function(Bt,_t,Et){var wt=this,Tt=_t.fromX,Dt=_t.fromY,kt=_t.toX,Yt=_t.toY,zt=this.ctx;Et||(Et=this.ctx.lineWidth*Up);var en=Bt==="head"?[Tt,Dt]:[kt,Yt],an=gn(en,2),vn=an[0],yn=an[1],Cn=Bt==="head"?[kt,Yt]:[Tt,Dt],wn=gn(Cn,2),_n=wn[0],Nn=wn[1],Kn=Math.atan2(Nn-yn,_n-vn)*yo/Math.PI,Zn=function(Gn){return wt.getRotatePosition(Et,Gn,{x:vn,y:yn})};zt.moveTo.apply(zt,Ft(Zn(Kn+vo))),zt.lineTo(vn,yn),zt.lineTo.apply(zt,Ft(Zn(Kn-vo)))},getRotatePosition:function(Bt,_t,Et){var wt=_t*Math.PI/yo,Tt=Et.x,Dt=Et.y;return[Bt*Math.cos(wt)+Tt,Bt*Math.sin(wt)+Dt]}}),Qp=zp;function Vp(Rt){var Bt=Wp();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Wp(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Yp=function(Rt){lr(_t,Rt);var Bt=Vp(_t);function _t(Et){var wt,Tt,Dt,kt;return Ht(this,_t),kt=Bt.call(this,Tn.LINE,Et),kt._width=12,kt._oColor=new Vt.fabric.Color("rgba(0, 0, 0, 0.5)"),kt._listeners={mousedown:Lt()(wt=kt._onFabricMouseDown).call(wt,sr(kt)),mousemove:Lt()(Tt=kt._onFabricMouseMove).call(Tt,sr(kt)),mouseup:Lt()(Dt=kt._onFabricMouseUp).call(Dt,sr(kt))},kt}return Wt(_t,[{key:"setHeadOption",value:function(wt){var Tt=wt.arrowType,Dt=Tt===void 0?{head:null,tail:null}:Tt;this._arrowType=Dt}},{key:"start",value:function(){var wt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Tt=this.getCanvas();Tt.defaultCursor="crosshair",Tt.selection=!1,this.setHeadOption(wt),this.setBrush(wt),Tt.forEachObject(function(Dt){Dt.set({evented:!1})}),Tt.on({"mouse:down":this._listeners.mousedown})}},{key:"setBrush",value:function(wt){var Tt=this.getCanvas().freeDrawingBrush;wt=wt||{},this._width=wt.width||this._width,wt.color&&(this._oColor=new Vt.fabric.Color(wt.color)),Tt.width=this._width,Tt.color=this._oColor.toRgba()}},{key:"end",value:function(){var wt=this.getCanvas();wt.defaultCursor="default",wt.selection=!0,wt.forEachObject(function(Tt){Tt.set({evented:!0})}),wt.off("mouse:down",this._listeners.mousedown)}},{key:"_onFabricMouseDown",value:function(wt){var Tt=this.getCanvas(),Dt=Tt.getPointer(wt.e),kt=Dt.x,Yt=Dt.y,zt=[kt,Yt,kt,Yt];this._line=new Qp(zt,{stroke:this._oColor.toRgba(),strokeWidth:this._width,arrowType:this._arrowType,evented:!1}),this._line.set(Yn.SELECTION_STYLE),Tt.add(this._line),Tt.on({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup}),this.fire(xn.ADD_OBJECT,this._createLineEventObjectProperties())}},{key:"_onFabricMouseMove",value:function(wt){var Tt=this.getCanvas(),Dt=Tt.getPointer(wt.e);this._line.set({x2:Dt.x,y2:Dt.y}),this._line.setCoords(),Tt.renderAll()}},{key:"_onFabricMouseUp",value:function(){var wt=this.getCanvas();this.fire(xn.OBJECT_ADDED,this._createLineEventObjectProperties()),this._line=null,wt.off({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}},{key:"_createLineEventObjectProperties",value:function(){var wt=this.graphics.createObjectProperties(this._line),Tt=this._line,Dt=Tt.x1,kt=Tt.x2,Yt=Tt.y1,zt=Tt.y2;return Xt().extend({},wt,{startPosition:{x:Dt,y:Yt},endPosition:{x:kt,y:zt}})}}]),_t}(Fr),Gp=Yp;function Xp(Rt){var Bt=Kp();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Kp(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var $p={fill:"#000000",left:0,top:0},Jp={fill:"#000000",fontStyle:"normal",fontWeight:"normal",textAlign:"tie-text-align-left",underline:!1},Zp=500,qp=function(Rt){lr(_t,Rt);var Bt=Xp(_t);function _t(Et){var wt,Tt,Dt,kt,Yt,zt;return Ht(this,_t),zt=Bt.call(this,Tn.TEXT,Et),zt._defaultStyles=$p,zt._isSelected=!1,zt._selectedObj={},zt._editingObj={},zt._listeners={mousedown:Lt()(wt=zt._onFabricMouseDown).call(wt,sr(zt)),select:Lt()(Tt=zt._onFabricSelect).call(Tt,sr(zt)),selectClear:Lt()(Dt=zt._onFabricSelectClear).call(Dt,sr(zt)),scaling:Lt()(kt=zt._onFabricScaling).call(kt,sr(zt)),textChanged:Lt()(Yt=zt._onFabricTextChanged).call(Yt,sr(zt))},zt._textarea=null,zt._ratio=1,zt._lastClickTime=new Date().getTime(),zt._editingObjInfos={},zt.isPrevEditing=!1,zt}return Wt(_t,[{key:"start",value:function(){var wt=this,Tt=this.getCanvas();Tt.selection=!1,Tt.defaultCursor="text",Tt.on({"mouse:down":this._listeners.mousedown,"selection:created":this._listeners.select,"selection:updated":this._listeners.select,"before:selection:cleared":this._listeners.selectClear,"object:scaling":this._listeners.scaling,"text:changed":this._listeners.textChanged}),Tt.forEachObject(function(Dt){Dt.type==="i-text"&&wt.adjustOriginPosition(Dt,"start")}),this.setCanvasRatio()}},{key:"end",value:function(){var wt=this,Tt=this.getCanvas();Tt.selection=!0,Tt.defaultCursor="default",Tt.forEachObject(function(Dt){Dt.type==="i-text"&&(Dt.text===""?Tt.remove(Dt):wt.adjustOriginPosition(Dt,"end"))}),Tt.off({"mouse:down":this._listeners.mousedown,"selection:created":this._listeners.select,"selection:updated":this._listeners.select,"before:selection:cleared":this._listeners.selectClear,"object:selected":this._listeners.select,"object:scaling":this._listeners.scaling,"text:changed":this._listeners.textChanged})}},{key:"adjustOriginPosition",value:function(wt,Tt){var Dt="center",kt="center";Tt==="start"&&(Dt="left",kt="top");var Yt=wt.getPointByOrigin(Dt,kt),zt=Yt.x,en=Yt.y;wt.set({left:zt,top:en,originX:Dt,originY:kt}),wt.setCoords()}},{key:"add",value:function(wt,Tt){var Dt=this;return new(Gt())(function(kt){var Yt,zt=Dt.getCanvas(),en=null,an=Yn.SELECTION_STYLE,vn=Dt._defaultStyles;Dt._setInitPos(Tt.position),Tt.styles&&(vn=Xt().extend(vn,Tt.styles)),Xt().isExisty(Tt.autofocus)||(Tt.autofocus=!0),en=new Vt.fabric.IText(wt,vn),an=Xt().extend({},an,{originX:"left",originY:"top"}),en.set(an),en.on({mouseup:Lt()(Yt=Dt._onFabricMouseUp).call(Yt,Dt)}),zt.add(en),Tt.autofocus&&(en.enterEditing(),en.selectAll()),zt.getActiveObject()||zt.setActiveObject(en),Dt.isPrevEditing=!0,kt(Dt.graphics.createObjectProperties(en))})}},{key:"change",value:function(wt,Tt){var Dt=this;return new(Gt())(function(kt){wt.set("text",Tt),Dt.getCanvas().renderAll(),kt()})}},{key:"setStyle",value:function(wt,Tt){var Dt=this;return new(Gt())(function(kt){Jt()(Xt()).call(Xt(),Tt,function(Yt,zt){wt[zt]===Yt&&zt!=="fontSize"&&(Tt[zt]=Jp[zt]||"")},Dt),"textDecoration"in Tt&&Xt().extend(Tt,Dt._getTextDecorationAdaptObject(Tt.textDecoration)),wt.set(Tt),Dt.getCanvas().renderAll(),kt()})}},{key:"getText",value:function(wt){return wt.text}},{key:"setSelectedInfo",value:function(wt,Tt){this._selectedObj=wt,this._isSelected=Tt}},{key:"isSelected",value:function(){return this._isSelected}},{key:"getSelectedObj",value:function(){return this._selectedObj}},{key:"setCanvasRatio",value:function(){var wt=this.getCanvasElement(),Tt=dn()(wt.style.maxWidth,10),Dt=wt.width;this._ratio=Dt/Tt}},{key:"getCanvasRatio",value:function(){return this._ratio}},{key:"_getTextDecorationAdaptObject",value:function(wt){return{underline:wt==="underline",linethrough:wt==="line-through",overline:wt==="overline"}}},{key:"_setInitPos",value:function(wt){wt=wt||this.getCanvasImage().getCenterPoint(),this._defaultStyles.left=wt.x,this._defaultStyles.top=wt.y}},{key:"_onInput",value:function(){var wt=this.getCanvasRatio(),Tt=this._editingObj,Dt=this._textarea.style;Dt.width="".concat(Math.ceil(Tt.width/wt),"px"),Dt.height="".concat(Math.ceil(Tt.height/wt),"px")}},{key:"_onKeyDown",value:function(){var wt=this,Tt=this.getCanvasRatio(),Dt=this._editingObj,kt=this._textarea.style;gt()(function(){Dt.text(wt._textarea.value),kt.width="".concat(Math.ceil(Dt.width/Tt),"px"),kt.height="".concat(Math.ceil(Dt.height/Tt),"px")},0)}},{key:"_onBlur",value:function(){var wt=this.getCanvasRatio(),Tt=this._editingObj,Dt=this._editingObjInfos,kt=this._textarea.value,Yt=Tt.width/wt-Dt.width/wt,zt=Tt.height/wt-Dt.height/wt;if(wt===1&&(Yt/=2,zt/=2),this._textarea.style.display="none",Tt.set({left:Dt.left+Yt,top:Dt.top+zt}),kt.length){this.getCanvas().add(Tt);var en={id:Xt().stamp(Tt),type:Tt.type,text:kt};this.fire(xn.TEXT_CHANGED,en)}}},{key:"_onScroll",value:function(){this._textarea.scrollLeft=0,this._textarea.scrollTop=0}},{key:"_onFabricScaling",value:function(wt){var Tt=wt.target;Tt.fontSize=Tt.fontSize*Tt.scaleY,Tt.scaleX=1,Tt.scaleY=1}},{key:"_onFabricTextChanged",value:function(wt){this.fire(xn.TEXT_CHANGED,wt.target)}},{key:"_onFabricSelectClear",value:function(wt){var Tt=this.getSelectedObj();this.isPrevEditing=!0,this.setSelectedInfo(wt.target,!1),Tt&&Tt.text===""&&this.getCanvas().remove(Tt)}},{key:"_onFabricSelect",value:function(wt){this.isPrevEditing=!0,this.setSelectedInfo(wt.target,!0)}},{key:"_onFabricMouseDown",value:function(wt){var Tt=wt.target;if(!(Tt&&!Tt.isType("text"))){if(this.isPrevEditing){this.isPrevEditing=!1;return}this._fireAddText(wt)}}},{key:"_fireAddText",value:function(wt){var Tt=wt.target,Dt=wt.e||{},kt=this.getCanvas().getPointer(Dt);Tt||this.fire(xn.ADD_TEXT,{originPosition:{x:kt.x,y:kt.y},clientPosition:{x:Dt.clientX||0,y:Dt.clientY||0}})}},{key:"_onFabricMouseUp",value:function(wt){var Tt=wt.target,Dt=new Date().getTime();this._isDoubleClick(Dt)&&!Tt.isEditing&&Tt.enterEditing(),Tt.isEditing&&this.fire(xn.TEXT_EDITING),this._lastClickTime=Dt}},{key:"_isDoubleClick",value:function(wt){return wt-this._lastClickTime<Zp}}]),_t}(Fr),_g=qp;function eA(Rt){var Bt=tA();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function tA(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var iA={arrow:"M 0 90 H 105 V 120 L 160 60 L 105 0 V 30 H 0 Z",cancel:"M 0 30 L 30 60 L 0 90 L 30 120 L 60 90 L 90 120 L 120 90 L 90 60 L 120 30 L 90 0 L 60 30 L 30 0 Z"},nA=function(Rt){lr(_t,Rt);var Bt=eA(_t);function _t(Et){var wt,Tt,Dt,kt;return Ht(this,_t),kt=Bt.call(this,Tn.ICON,Et),kt._oColor="#000000",kt._pathMap=iA,kt._type=null,kt._iconColor=null,kt._handlers={mousedown:Lt()(wt=kt._onFabricMouseDown).call(wt,sr(kt)),mousemove:Lt()(Tt=kt._onFabricMouseMove).call(Tt,sr(kt)),mouseup:Lt()(Dt=kt._onFabricMouseUp).call(Dt,sr(kt))},kt}return Wt(_t,[{key:"setStates",value:function(wt,Tt){this._type=wt,this._iconColor=Tt}},{key:"start",value:function(){var wt=this.getCanvas();wt.selection=!1,wt.on("mouse:down",this._handlers.mousedown)}},{key:"end",value:function(){var wt=this.getCanvas();wt.selection=!0,wt.off({"mouse:down":this._handlers.mousedown})}},{key:"add",value:function(wt,Tt){var Dt=this;return new(Gt())(function(kt,Yt){var zt=Dt.getCanvas(),en=Dt._pathMap[wt],an=Yn.SELECTION_STYLE,vn=en?Dt._createIcon(en):null;Dt._icon=vn,vn||Yt(Hn.invalidParameters),vn.set(Xt().extend({type:"icon",fill:Dt._oColor},an,Tt,Dt.graphics.controlStyle)),zt.add(vn).setActiveObject(vn),kt(Dt.graphics.createObjectProperties(vn))})}},{key:"registerPaths",value:function(wt){var Tt=this;Jt()(Xt()).call(Xt(),wt,function(Dt,kt){Tt._pathMap[kt]=Dt},this)}},{key:"setColor",value:function(wt,Tt){this._oColor=wt,Tt&&Tt.get("type")==="icon"&&(Tt.set({fill:this._oColor}),this.getCanvas().renderAll())}},{key:"getColor",value:function(wt){return sn()(wt)}},{key:"_createIcon",value:function(wt){return new Vt.fabric.Path(wt)}},{key:"_onFabricMouseDown",value:function(wt){var Tt=this,Dt=this.getCanvas();this._startPoint=Dt.getPointer(wt.e);var kt=this._startPoint,Yt=kt.x,zt=kt.y;this.add(this._type,{left:Yt,top:zt,fill:this._iconColor}).then(function(){Tt.fire(xn.ADD_OBJECT,Tt.graphics.createObjectProperties(Tt._icon)),Dt.on("mouse:move",Tt._handlers.mousemove),Dt.on("mouse:up",Tt._handlers.mouseup)})}},{key:"_onFabricMouseMove",value:function(wt){var Tt=this.getCanvas();if(!!this._icon){var Dt=Tt.getPointer(wt.e),kt=(Dt.x-this._startPoint.x)/this._icon.width,Yt=(Dt.y-this._startPoint.y)/this._icon.height;this._icon.set({scaleX:Math.abs(kt*2),scaleY:Math.abs(Yt*2)}),this._icon.setCoords(),Tt.renderAll()}}},{key:"_onFabricMouseUp",value:function(){var wt=this.getCanvas();this.fire(xn.OBJECT_ADDED,this.graphics.createObjectProperties(this._icon)),this._icon=null,wt.off("mouse:down",this._handlers.mousedown),wt.off("mouse:move",this._handlers.mousemove),wt.off("mouse:up",this._handlers.mouseup)}}]),_t}(Fr),rA=nA,aA=Vt.fabric.util.createClass(Vt.fabric.Image.filters.BlendImage,{applyTo:function(Bt){if(!!this.mask){var _t=Bt.canvasEl,Et=_t.width,wt=_t.height,Tt=this._createCanvasOfMask(Et,wt),Dt=_t.getContext("2d"),kt=Tt.getContext("2d"),Yt=Dt.getImageData(0,0,Et,wt);this._drawMask(kt,_t,Dt),this._mapData(kt,Yt,Et,wt),Bt.imageData=Yt}},_createCanvasOfMask:function(Bt,_t){var Et=Vt.fabric.util.createCanvasElement();return Et.width=Bt,Et.height=_t,Et},_drawMask:function(Bt){var _t=this.mask,Et=_t.getElement(),wt=_t.angle,Tt=_t.left,Dt=_t.scaleX,kt=_t.scaleY,Yt=_t.top;Bt.save(),Bt.translate(Tt,Yt),Bt.rotate(wt*Math.PI/180),Bt.scale(Dt,kt),Bt.drawImage(Et,-Et.width/2,-Et.height/2),Bt.restore()},_mapData:function(Bt,_t,Et,wt){for(var Tt=_t.data,Dt=_t.height,kt=_t.width,Yt=Tt,zt=kt*Dt*4,en=Bt.getImageData(0,0,Et,wt).data,an=0;an<zt;an+=4)Yt[an+3]=en[an]}}),sA=aA,oA=Vt.fabric.util.createClass(Vt.fabric.Image.filters.Convolute,{type:"Sharpen",initialize:function(){this.matrix=[0,-1,0,-1,5,-1,0,-1,0]}}),lA=oA,cA=Vt.fabric.util.createClass(Vt.fabric.Image.filters.Convolute,{type:"Emboss",initialize:function(){this.matrix=[1,1,1,1,.7,-1,-1,-1,-1]}}),uA=cA,fA=Vt.fabric.util.createClass(Vt.fabric.Image.filters.BaseFilter,{type:"ColorFilter",initialize:function(Bt){Bt||(Bt={}),this.color=Bt.color||"#FFFFFF",this.threshold=Bt.threshold||45,this.x=Bt.x||null,this.y=Bt.y||null},applyTo:function(Bt){var _t=Bt.canvasEl,Et=_t.getContext("2d"),wt=Et.getImageData(0,0,_t.width,_t.height),Tt=wt.data,Dt=this.threshold,kt=Vt.fabric.Color.sourceFromHex(this.color),Yt,zt;for(this.x&&this.y&&(kt=this._getColor(wt,this.x,this.y)),Yt=0,zt=Tt.length;Yt<zt;Yt+=4)this._isOutsideThreshold(Tt[Yt],kt[0],Dt)||this._isOutsideThreshold(Tt[Yt+1],kt[1],Dt)||this._isOutsideThreshold(Tt[Yt+2],kt[2],Dt)||(Tt[Yt]=Tt[Yt+1]=Tt[Yt+2]=Tt[Yt+3]=0);Et.putImageData(wt,0,0)},_isOutsideThreshold:function(Bt,_t,Et){var wt=Bt-_t;return Math.abs(wt)>Et},_getColor:function(Bt,_t,Et){var wt=[0,0,0,0],Tt=Bt.data,Dt=Bt.width,kt=4,Yt=(Dt*Et+_t)*kt;return wt[0]=Tt[Yt],wt[1]=Tt[Yt+1],wt[2]=Tt[Yt+2],wt[3]=Tt[Yt+3],wt}}),hA=fA;function dA(Rt){var Bt=pA();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function pA(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var ps=Vt.fabric.Image.filters;ps.Mask=sA,ps.Sharpen=lA,ps.Emboss=uA,ps.ColorFilter=hA;var gA=function(Rt){lr(_t,Rt);var Bt=dA(_t);function _t(Et){return Ht(this,_t),Bt.call(this,Tn.FILTER,Et)}return Wt(_t,[{key:"add",value:function(wt,Tt){var Dt=this;return new(Gt())(function(kt,Yt){var zt=Dt._getSourceImage(),en=Dt.getCanvas(),an=Dt._getFilter(zt,wt);an||(an=Dt._createFilter(zt,wt,Tt)),an||Yt(Hn.invalidParameters),Dt._changeFilterValues(an,Tt),Dt._apply(zt,function(){en.renderAll(),kt({type:wt,action:"add",options:Tt})})})}},{key:"remove",value:function(wt){var Tt=this;return new(Gt())(function(Dt,kt){var Yt=Tt._getSourceImage(),zt=Tt.getCanvas(),en=Tt.getOptions(wt);Yt.filters.length||kt(Hn.unsupportedOperation),Tt._removeFilter(Yt,wt),Tt._apply(Yt,function(){zt.renderAll(),Dt({type:wt,action:"remove",options:en})})})}},{key:"hasFilter",value:function(wt){return!!this._getFilter(this._getSourceImage(),wt)}},{key:"getOptions",value:function(wt){var Tt=this._getSourceImage(),Dt=this._getFilter(Tt,wt);return Dt?(0,_i.extend)({},Dt.options):null}},{key:"_changeFilterValues",value:function(wt,Tt){(0,_i.forEach)(Tt,function(Dt,kt){(0,_i.isUndefined)(wt[kt])||(wt[kt]=Dt)}),(0,_i.forEach)(wt.options,function(Dt,kt){(0,_i.isUndefined)(Tt[kt])||(wt.options[kt]=Tt[kt])})}},{key:"_apply",value:function(wt,Tt){wt.filters.push();var Dt=wt.applyFilters();Dt&&Tt()}},{key:"_getSourceImage",value:function(){return this.getCanvasImage()}},{key:"_createFilter",value:function(wt,Tt,Dt){var kt,Yt=this._getFabricFilterType(Tt),zt=Vt.fabric.Image.filters[Yt];return zt&&(kt=new zt(Dt),kt.options=Dt,wt.filters.push(kt)),kt}},{key:"_getFilter",value:function(wt,Tt){var Dt=null;if(wt){var kt=this._getFabricFilterType(Tt),Yt=wt.filters.length,zt,en;for(en=0;en<Yt;en+=1)if(zt=wt.filters[en],zt.type===kt){Dt=zt;break}}return Dt}},{key:"_removeFilter",value:function(wt,Tt){var Dt=this._getFabricFilterType(Tt);wt.filters=(0,_i.filter)(wt.filters,function(kt){return kt.type!==Dt})}},{key:"_getFabricFilterType",value:function(wt){return wt.charAt(0).toUpperCase()+ft()(wt).call(wt,1)}}]),_t}(Fr),AA=gA,mA=tt(1801),Ur=tt.n(mA),bo={pixelate:"blocksize",blur:"blur"},Hs={x:"width",y:"height"},vA=ir(bo),is=null;function gs(Rt){var Bt=ar(Rt,"patternSourceCanvas"),_t=Bt.patternSourceCanvas,Et=_t.getObjects(),wt=gn(Et,1),Tt=wt[0];return Tt}function yA(Rt){var Bt=Rt.angle,_t=Rt.flipX,Et=Rt.flipY,wt=gs(Rt),Tt=jA(Rt),Dt=Tt.right,kt=Tt.bottom,Yt=Tt.width,zt=Tt.height,en=(Yt-Rt.width)/2,an=(zt-Rt.height)/2,vn=Rt.left-Rt.width/2-en,yn=Rt.top-Rt.height/2-an,Cn=Yt/2-en,wn=zt/2-an,_n=Math.max(Yt,zt)+Math.max(en,an),Nn=bA({shapeObj:Rt,left:Cn,top:wn,width:Yt,height:zt,cropX:vn,cropY:yn,flipX:_t,flipY:Et,right:Dt,bottom:kt}),Kn=gn(Nn,4);Cn=Kn[0],wn=Kn[1],Yt=Kn[2],zt=Kn[3],wt.set({angle:_t===Et?-Bt:Bt,left:Cn,top:wn,width:Yt,height:zt,cropX:vn,cropY:yn,flipX:_t,flipY:Et}),$n(wt,{fillImageMaxSize:_n})}function zs(Rt){return(0,_i.map)(Rt.filters,function(Bt){var _t=rn()(Bt),Et=gn(_t,1),wt=Et[0];return Qt({},vA[wt],Bt[wt])})}function bA(Rt){var Bt=Rt.shapeObj,_t=Rt.left,Et=Rt.top,wt=Rt.width,Tt=Rt.height,Dt=Rt.cropX,kt=Rt.cropY,Yt=Rt.flipX,zt=Rt.flipY,en=Rt.right,an=Rt.bottom,vn=function(er,Gn,ur,wr){return EA({type:er,outDistance:Gn,shapeObj:Bt,flipX:Yt,flipY:zt,left:ur,top:wr})},yn=wt,Cn=Tt,wn=CA(vn,{left:_t,top:Et,width:wt,height:Tt,cropX:Dt,cropY:kt}),_n=gn(wn,4);_t=_n[0],Et=_n[1],wt=_n[2],Tt=_n[3];var Nn=xA(vn,{left:_t,top:Et,insideCanvasRealImageWidth:wt,insideCanvasRealImageHeight:Tt,right:en,bottom:an,cropX:Dt,cropY:kt,originalWidth:yn,originalHeight:Cn}),Kn=gn(Nn,4);return _t=Kn[0],Et=Kn[1],wt=Kn[2],Tt=Kn[3],[_t,Et,wt,Tt]}function xA(Rt,Bt){var _t=Bt.left,Et=Bt.top,wt=Bt.insideCanvasRealImageWidth,Tt=Bt.insideCanvasRealImageHeight,Dt=Bt.right,kt=Bt.bottom,Yt=Bt.cropX,zt=Bt.cropY,en=Bt.originalWidth,an=Bt.originalHeight,vn=wt,yn=Tt,Cn=is,wn=Cn.width,_n=Cn.height;Dt>wn&&Yt>0&&(vn=en-Math.abs(Dt-wn)),kt>_n&&zt>0&&(yn=an-Math.abs(kt-_n));var Nn={x:(wt-vn)/2,y:(Tt-yn)/2};return(0,_i.forEach)(["x","y"],function(Kn){var Zn=Nn[Kn];if(Zn>0){var er=Rt(Kn,Zn,_t,Et),Gn=gn(er,2);_t=Gn[0],Et=Gn[1]}}),[_t,Et,vn,yn]}function CA(Rt,Bt){var _t=Bt.left,Et=Bt.top,wt=Bt.width,Tt=Bt.height,Dt=Bt.cropX,kt=Bt.cropY,Yt={width:wt,height:Tt};return(0,_i.forEach)(["x","y"],function(zt){var en=zt==="x"?Dt:kt,an=Yt[Hs[zt]],vn=is[Hs[zt]];if(an>vn){var yn=(an-vn)/2;Yt[Hs[zt]]=vn;var Cn=Rt(zt,yn,_t,Et),wn=gn(Cn,2);_t=wn[0],Et=wn[1]}if(en<0){var _n=Rt(zt,en,_t,Et),Nn=gn(_n,2);_t=Nn[0],Et=Nn[1]}}),[_t,Et,Yt.width,Yt.height]}function xo(Rt,Bt,_t){var Et=Co(Rt),wt=_o(Et,Rt.angle,Bt);_t.add(wt);var Tt={fill:new Vt.fabric.Pattern({source:_t.getElement(),repeat:"no-repeat"})};return $n(Tt,{patternSourceCanvas:_t}),Tt}function wA(Rt){var Bt=Rt.getObjects(),_t=gn(Bt,1),Et=_t[0],wt=ar(Et,"fillImageMaxSize"),Tt=wt.fillImageMaxSize;Tt=Math.max(1,Tt),Rt.setDimensions({width:Tt,height:Tt}),Rt.renderAll()}function _A(Rt,Bt){var _t=ar(Rt,"patternSourceCanvas"),Et=_t.patternSourceCanvas,wt=Et.getObjects(),Tt=gn(wt,1),Dt=Tt[0],kt=zs(Dt);Et.remove(Dt);var Yt=Co(Bt,!0),zt=_o(Yt,Bt.angle,kt);Et.add(zt)}function Co(Rt){var Bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(!is||Bt)&&(is=Rt.toCanvasElement()),is}function EA(Rt){var Bt=Rt.type,_t=Rt.shapeObj,Et=Rt.outDistance,wt=Rt.left,Tt=Rt.top,Dt=Rt.flipX,kt=Rt.flipY,Yt=wo(_t),zt=[[1,2],[0,3],[0,3],[1,2]],en=IA(Bt,Yt,zt),an=MA(Bt,Yt,en),vn=en.startPointIndex,yn=TA({outDistance:Et,startPointIndex:vn,flipX:Dt,flipY:kt,reatAngles:an});return[wt+yn.left,Tt+yn.top]}function TA(Rt){var Bt=Rt.outDistance,_t=Rt.startPointIndex,Et=Rt.flipX,wt=Rt.flipY,Tt=Rt.reatAngles,Dt=Bt*Math.cos(Tt[0]*Math.PI/180),kt=Bt*Math.cos(Tt[1]*Math.PI/180),Yt=_t===2||_t===3,zt={top:Yt?Dt:kt,left:Yt?kt:Dt};return OA(_t,Et,wt)&&(zt.left=zt.left*-1),DA(_t,Et,wt)&&(zt.top=zt.top*-1),zt}function IA(Rt,Bt,_t){var Et=0,wt=0;(0,_i.forEach)(Bt,function(Yt,zt){Yt[Rt]<Et&&(Et=Yt[Rt],wt=zt)});var Tt=gn(_t[wt],2),Dt=Tt[0],kt=Tt[1];return{startPointIndex:wt,endPointIndex1:Dt,endPointIndex2:kt}}function MA(Rt,Bt,_t){var Et=_t.startPointIndex,wt=_t.endPointIndex1,Tt=_t.endPointIndex2,Dt=Rt==="x"?180:270;return(0,_i.map)([wt,Tt],function(kt){var Yt=Bt[Et],zt=Bt[kt],en=Yt.y-zt.y,an=Yt.x-zt.x;return Math.atan2(en,an)*180/Math.PI-Dt})}function OA(Rt,Bt,_t){return(!Bt&&_t||!Bt&&!_t)&&Rt===0||(Bt&&_t||Bt&&!_t)&&Rt===1||(!Bt&&!_t||!Bt&&_t)&&Rt===2||(Bt&&!_t||Bt&&_t)&&Rt===3}function DA(Rt,Bt,_t){return(Bt&&!_t||!Bt&&!_t)&&Rt===0||(!Bt&&!_t||Bt&&!_t)&&Rt===1||(Bt&&_t||!Bt&&_t)&&Rt===2||(!Bt&&_t||Bt&&_t)&&Rt===3}function wo(Rt){return[Rt.getPointByOrigin("left","top"),Rt.getPointByOrigin("right","top"),Rt.getPointByOrigin("left","bottom"),Rt.getPointByOrigin("right","bottom")]}function jA(Rt){var Bt=wo(Rt),_t=gn(Bt,4),Et=_t[0],wt=Et.x,Tt=Et.y,Dt=_t[1],kt=Dt.x,Yt=Dt.y,zt=_t[2],en=zt.x,an=zt.y,vn=_t[3],yn=vn.x,Cn=vn.y,wn=Math.min(wt,kt,en,yn),_n=Math.min(Tt,Yt,an,Cn),Nn=Math.max(wt,kt,en,yn),Kn=Math.max(Tt,Yt,an,Cn);return{left:wn,top:_n,right:Nn,bottom:Kn,width:Nn-wn,height:Kn-_n}}function _o(Rt,Bt,_t){var Et,wt=new Vt.fabric.Image(Rt);return(0,_i.forEach)(_i.extend.apply(void 0,Pt()(Et=[{}]).call(Et,Ft(_t))),function(Tt,Dt){var kt=Ar(Dt),Yt=new Vt.fabric.Image.filters[kt](Qt({},bo[Dt],Tt));wt.filters.push(Yt)}),wt.applyFilters(),$n(wt,{originalAngle:Bt,fillImageMaxSize:Math.max(wt.width,wt.height)}),Ur().adjustOriginToCenter(wt),wt}function FA(Rt){var Bt=NA();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function NA(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var So=(0,_i.extend)({strokeWidth:1,stroke:"#000000",fill:"#ffffff",width:1,height:1,rx:0,ry:0},tr),LA="rect",kA=20,PA=20;function Eo(Rt,Bt,_t){var Et=sn()(Rt),wt=Er(sn()(Rt)),Tt=Et;Et.color&&(Tt=Et.color);var Dt=null;if(wt==="filter"){var kt=_t();Dt=xo(Bt,ts()(Et),kt)}else Dt={fill:Tt};return(0,_i.extend)({},Rt,Dt)}var RA=function(Rt){lr(_t,Rt);var Bt=FA(_t);function _t(Et){var wt,Tt,Dt,kt,Yt,zt;return Ht(this,_t),zt=Bt.call(this,Tn.SHAPE,Et),zt._shapeObj=null,zt._type=LA,zt._options=(0,_i.extend)({},So),zt._isSelected=!1,zt._startPoint={},zt._withShiftKey=!1,zt._handlers={mousedown:Lt()(wt=zt._onFabricMouseDown).call(wt,sr(zt)),mousemove:Lt()(Tt=zt._onFabricMouseMove).call(Tt,sr(zt)),mouseup:Lt()(Dt=zt._onFabricMouseUp).call(Dt,sr(zt)),keydown:Lt()(kt=zt._onKeyDown).call(kt,sr(zt)),keyup:Lt()(Yt=zt._onKeyUp).call(Yt,sr(zt))},zt}return Wt(_t,[{key:"start",value:function(){var wt=this.getCanvas();this._isSelected=!1,wt.defaultCursor="crosshair",wt.selection=!1,wt.uniformScaling=!0,wt.on({"mouse:down":this._handlers.mousedown}),Vt.fabric.util.addListener(document,"keydown",this._handlers.keydown),Vt.fabric.util.addListener(document,"keyup",this._handlers.keyup)}},{key:"end",value:function(){var wt=this.getCanvas();this._isSelected=!1,wt.defaultCursor="default",wt.selection=!0,wt.uniformScaling=!1,wt.off({"mouse:down":this._handlers.mousedown}),Vt.fabric.util.removeListener(document,"keydown",this._handlers.keydown),Vt.fabric.util.removeListener(document,"keyup",this._handlers.keyup)}},{key:"setStates",value:function(wt,Tt){this._type=wt,Tt&&(this._options=(0,_i.extend)(this._options,Tt))}},{key:"add",value:function(wt,Tt){var Dt=this;return new(Gt())(function(kt){var Yt=Dt.getCanvas(),zt=Dt._extendOptions(Tt),en=Dt._createInstance(wt,zt),an=Dt.graphics.createObjectProperties(en);Dt._bindEventOnShape(en),Yt.add(en).setActiveObject(en),Dt._resetPositionFillFilter(en),kt(an)})}},{key:"change",value:function(wt,Tt){var Dt=this;return new(Gt())(function(kt,Yt){yr(wt)||Yt(Hn.unsupportedType);var zt=Er(sn()(Tt))==="filter",en=Dt.graphics,an=en.canvasImage,vn=en.createStaticCanvas;wt.set(zt?Eo(Tt,an,vn):Tt),zt&&Dt._resetPositionFillFilter(wt),Dt.getCanvas().renderAll(),kt()})}},{key:"makeFillPropertyForUserEvent",value:function(wt){var Tt=Pn(wt),Dt={};if(Tt===Vn.FILTER){var kt=gs(wt),Yt=zs(kt);Dt.type=Tt,Dt.filter=Yt}else Dt.type=Vn.COLOR,Dt.color=sn()(wt)||"transparent";return Dt}},{key:"processForCopiedObject",value:function(wt,Tt){if(this._bindEventOnShape(wt),Pn(wt)==="filter"){var Dt=gs(Tt),kt=zs(Dt),Yt=this.graphics.createStaticCanvas();wt.set(xo(this.graphics.canvasImage,kt,Yt)),this._resetPositionFillFilter(wt)}}},{key:"_createInstance",value:function(wt,Tt){var Dt;switch(wt){case"rect":Dt=new Vt.fabric.Rect(Tt);break;case"circle":Dt=new Vt.fabric.Ellipse((0,_i.extend)({type:"circle"},Tt));break;case"triangle":Dt=new Vt.fabric.Triangle(Tt);break;default:Dt={}}return Dt}},{key:"_extendOptions",value:function(wt){var Tt=Yn.SELECTION_STYLE,Dt=this.graphics,kt=Dt.canvasImage,Yt=Dt.createStaticCanvas;return wt=(0,_i.extend)({},So,this._options,Tt,wt),Eo(wt,kt,Yt)}},{key:"_bindEventOnShape",value:function(wt){var Tt=this,Dt=this.getCanvas();wt.on({added:function(){Tt._shapeObj=this,Ur().setOrigins(Tt._shapeObj)},selected:function(){Tt._isSelected=!0,Tt._shapeObj=this,Dt.uniformScaling=!0,Dt.defaultCursor="default",Ur().setOrigins(Tt._shapeObj)},deselected:function(){Tt._isSelected=!1,Tt._shapeObj=null,Dt.defaultCursor="crosshair",Dt.uniformScaling=!1},modified:function(){var Yt=Tt._shapeObj;Ur().adjustOriginToCenter(Yt),Ur().setOrigins(Yt)},modifiedInGroup:function(Yt){Tt._fillFilterRePositionInGroupSelection(wt,Yt)},moving:function(){Tt._resetPositionFillFilter(this)},rotating:function(){Tt._resetPositionFillFilter(this)},scaling:function(Yt){var zt=Dt.getPointer(Yt.e),en=Tt._shapeObj;Dt.setCursor("crosshair"),Ur().resize(en,zt,!0),Tt._resetPositionFillFilter(this)}})}},{key:"_onFabricMouseDown",value:function(wt){if(wt.target||(this._isSelected=!1,this._shapeObj=!1),!this._isSelected&&!this._shapeObj){var Tt=this.getCanvas();this._startPoint=Tt.getPointer(wt.e),Tt.on({"mouse:move":this._handlers.mousemove,"mouse:up":this._handlers.mouseup})}}},{key:"_onFabricMouseMove",value:function(wt){var Tt=this,Dt=this.getCanvas(),kt=Dt.getPointer(wt.e),Yt=this._startPoint.x,zt=this._startPoint.y,en=Yt-kt.x,an=zt-kt.y,vn=this._shapeObj;vn?(this._shapeObj.set({isRegular:this._withShiftKey}),Ur().resize(vn,kt),Dt.renderAll(),this._resetPositionFillFilter(vn)):this.add(this._type,{left:Yt,top:zt,width:en,height:an}).then(function(yn){Tt.fire(xn.ADD_OBJECT,yn)})}},{key:"_onFabricMouseUp",value:function(){var wt=this,Tt=this.getCanvas(),Dt=this._startPoint.x,kt=this._startPoint.y,Yt=this._shapeObj;Yt?Yt&&(Ur().adjustOriginToCenter(Yt),this.fire(xn.OBJECT_ADDED,this.graphics.createObjectProperties(Yt))):this.add(this._type,{left:Dt,top:kt,width:kA,height:PA}).then(function(zt){wt.fire(xn.ADD_OBJECT,zt)}),Tt.off({"mouse:move":this._handlers.mousemove,"mouse:up":this._handlers.mouseup})}},{key:"_onKeyDown",value:function(wt){wt.keyCode===Ln.SHIFT&&(this._withShiftKey=!0,this._shapeObj&&(this._shapeObj.isRegular=!0))}},{key:"_onKeyUp",value:function(wt){wt.keyCode===Ln.SHIFT&&(this._withShiftKey=!1,this._shapeObj&&(this._shapeObj.isRegular=!1))}},{key:"_resetPositionFillFilter",value:function(wt){if(Pn(wt)==="filter"){var Tt=ar(wt,"patternSourceCanvas"),Dt=Tt.patternSourceCanvas,kt=gs(wt),Yt=ar(kt,"originalAngle"),zt=Yt.originalAngle;this.graphics.canvasImage.angle!==zt&&_A(wt,this.graphics.canvasImage);var en=wt.originX,an=wt.originY;Ur().adjustOriginToCenter(wt),wt.width*=wt.scaleX,wt.height*=wt.scaleY,wt.rx*=wt.scaleX,wt.ry*=wt.scaleY,wt.scaleX=1,wt.scaleY=1,yA(wt),Un(wt,{originX:en,originY:an}),wA(Dt)}}},{key:"_fillFilterRePositionInGroupSelection",value:function(wt,Tt){(Tt.scaleX!==1||Tt.scaleY!==1)&&Tt.addWithUpdate();var Dt=wt.angle,kt=wt.left,Yt=wt.top;Vt.fabric.util.addTransformToObject(wt,Tt.calcTransformMatrix()),this._resetPositionFillFilter(wt),wt.set({angle:Dt,left:kt,top:Yt})}}]),_t}(Fr);function UA(Rt){var Bt=HA();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function HA(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Qs=10,To={left:0,top:0,width:0,height:0,stroke:"#000000",strokeWidth:0,fill:"#000000",opacity:.4,evented:!1,selectable:!1,hoverCursor:"auto"},Vs={SIZE:.0045,MARGIN:.003,BORDER_RADIUS:.003},Ws={SIZE:.0066,MARGIN:.0044,BORDER_RADIUS:.003},As=1,Io=xn.ZOOM_CHANGED,zA=xn.ADD_TEXT,QA=xn.TEXT_EDITING,VA=xn.OBJECT_MODIFIED,Bo=xn.KEY_DOWN,Mo=xn.KEY_UP,WA=xn.HAND_STARTED,YA=xn.HAND_STOPPED,GA=function(Rt){lr(_t,Rt);var Bt=UA(_t);function _t(Et){var wt,Tt,Dt,kt,Yt,zt,en,an,vn,yn,Cn,wn,_n;Ht(this,_t),_n=Bt.call(this,Tn.ZOOM,Et),_n.zoomArea=null,_n._startPoint=null,_n._centerPoints=[],_n.zoomLevel=As,_n.zoomMode=jn.DEFAULT,_n._listeners={startZoom:Lt()(wt=_n._onMouseDownWithZoomMode).call(wt,sr(_n)),moveZoom:Lt()(Tt=_n._onMouseMoveWithZoomMode).call(Tt,sr(_n)),stopZoom:Lt()(Dt=_n._onMouseUpWithZoomMode).call(Dt,sr(_n)),startHand:Lt()(kt=_n._onMouseDownWithHandMode).call(kt,sr(_n)),moveHand:Lt()(Yt=_n._onMouseMoveWithHandMode).call(Yt,sr(_n)),stopHand:Lt()(zt=_n._onMouseUpWithHandMode).call(zt,sr(_n)),zoomChanged:Lt()(en=_n._changeScrollState).call(en,sr(_n)),keydown:Lt()(an=_n._startHandModeWithSpaceBar).call(an,sr(_n)),keyup:Lt()(vn=_n._endHandModeWithSpaceBar).call(vn,sr(_n))};var Nn=_n.getCanvas();return _n.aspectRatio=Nn.width/Nn.height,_n._verticalScroll=new Vt.fabric.Rect(To),_n._horizontalScroll=new Vt.fabric.Rect(To),Nn.on(Io,_n._listeners.zoomChanged),_n.graphics.on(zA,Lt()(yn=_n._startTextEditingHandler).call(yn,sr(_n))),_n.graphics.on(QA,Lt()(Cn=_n._startTextEditingHandler).call(Cn,sr(_n))),_n.graphics.on(VA,Lt()(wn=_n._stopTextEditingHandler).call(wn,sr(_n))),_n}return Wt(_t,[{key:"attachKeyboardZoomEvents",value:function(){Vt.fabric.util.addListener(document,Bo,this._listeners.keydown),Vt.fabric.util.addListener(document,Mo,this._listeners.keyup)}},{key:"detachKeyboardZoomEvents",value:function(){Vt.fabric.util.removeListener(document,Bo,this._listeners.keydown),Vt.fabric.util.removeListener(document,Mo,this._listeners.keyup)}},{key:"_startTextEditingHandler",value:function(){this.isTextEditing=!0}},{key:"_stopTextEditingHandler",value:function(){this.isTextEditing=!1}},{key:"_startHandModeWithSpaceBar",value:function(wt){this.withSpace||this.isTextEditing||wt.keyCode===Ln.SPACE&&(this.withSpace=!0,this.startHandMode())}},{key:"_endHandModeWithSpaceBar",value:function(wt){wt.keyCode===Ln.SPACE&&(this.withSpace=!1,this.endHandMode())}},{key:"startZoomInMode",value:function(){if(!this.zoomArea){this.endHandMode(),this.zoomMode=jn.ZOOM;var wt=this.getCanvas();this._changeObjectsEventedState(!1),this.zoomArea=new Vt.fabric.Rect({left:0,top:0,width:.5,height:.5,stroke:"black",strokeWidth:1,fill:"transparent",hoverCursor:"zoom-in"}),wt.discardActiveObject(),wt.add(this.zoomArea),wt.on("mouse:down",this._listeners.startZoom),wt.selection=!1,wt.defaultCursor="zoom-in"}}},{key:"endZoomInMode",value:function(){this.zoomMode=jn.DEFAULT;var wt=this.getCanvas(),Tt=this._listeners,Dt=Tt.startZoom,kt=Tt.moveZoom,Yt=Tt.stopZoom;wt.selection=!0,wt.defaultCursor="auto",wt.off({"mouse:down":Dt,"mouse:move":kt,"mouse:up":Yt}),this._changeObjectsEventedState(!0),wt.remove(this.zoomArea),this.zoomArea=null}},{key:"start",value:function(){this.zoomArea=null,this._startPoint=null,this._startHandPoint=null}},{key:"end",value:function(){this.endZoomInMode(),this.endHandMode()}},{key:"startHandMode",value:function(){this.endZoomInMode(),this.zoomMode=jn.HAND;var wt=this.getCanvas();this._changeObjectsEventedState(!1),wt.discardActiveObject(),wt.off("mouse:down",this._listeners.startHand),wt.on("mouse:down",this._listeners.startHand),wt.selection=!1,wt.defaultCursor="grab",wt.fire(WA)}},{key:"endHandMode",value:function(){this.zoomMode=jn.DEFAULT;var wt=this.getCanvas();this._changeObjectsEventedState(!0),wt.off("mouse:down",this._listeners.startHand),wt.selection=!0,wt.defaultCursor="auto",this._startHandPoint=null,wt.fire(YA)}},{key:"_onMouseDownWithZoomMode",value:function(wt){var Tt=wt.target,Dt=wt.e;if(!Tt){var kt=this.getCanvas();kt.selection=!1,this._startPoint=kt.getPointer(Dt),this.zoomArea.set({width:0,height:0});var Yt=this._listeners,zt=Yt.moveZoom,en=Yt.stopZoom;kt.on({"mouse:move":zt,"mouse:up":en})}}},{key:"_onMouseMoveWithZoomMode",value:function(wt){var Tt=wt.e,Dt=this.getCanvas(),kt=Dt.getPointer(Tt),Yt=kt.x,zt=kt.y,en=this.zoomArea,an=this._startPoint,vn=Math.abs(Yt-an.x),yn=Math.abs(zt-an.y);vn+yn>Qs&&(Dt.remove(en),en.set(this._calcRectDimensionFromPoint(Yt,zt)),Dt.add(en))}},{key:"_calcRectDimensionFromPoint",value:function(wt,Tt){var Dt=this.getCanvas(),kt=Dt.getWidth(),Yt=Dt.getHeight(),zt=this._startPoint,en=zt.x,an=zt.y,vn=Math.min,yn=vn(en,wt),Cn=vn(an,Tt),wn=Cr(wt,en,kt)-yn,_n=Cr(Tt,an,Yt)-Cn;return{left:yn,top:Cn,width:wn,height:_n}}},{key:"_onMouseUpWithZoomMode",value:function(){var wt=this.zoomLevel,Tt=this.zoomArea,Dt=this._listeners,kt=Dt.moveZoom,Yt=Dt.stopZoom,zt=this.getCanvas(),en=this._getCenterPoint(),an=en.x,vn=en.y;this._isMaxZoomLevel()||(this._centerPoints.push({x:an,y:vn,prevZoomLevel:wt,zoomLevel:wt+1}),wt+=1,zt.zoomToPoint({x:an,y:vn},wt),this._fireZoomChanged(zt,wt),this.zoomLevel=wt),zt.off({"mouse:move":kt,"mouse:up":Yt}),zt.remove(Tt),this._startPoint=null}},{key:"_getCenterPoint",value:function(){var wt=this.zoomArea,Tt=wt.left,Dt=wt.top,kt=wt.width,Yt=wt.height,zt=this._startPoint,en=zt.x,an=zt.y,vn=this.aspectRatio;return kt<Qs&&Yt<Qs?{x:en,y:an}:kt>Yt?{x:Tt+vn*Yt/2,y:Dt+Yt/2}:{x:Tt+kt/2,y:Dt+kt/vn/2}}},{key:"zoom",value:function(wt){for(var Tt=wt.x,Dt=wt.y,kt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.zoomLevel,Yt=this.getCanvas(),zt=this._centerPoints,en=zt.length-1;en>=0&&!(zt[en].zoomLevel<kt);en-=1){var an=zt.pop(),vn=an.x,yn=an.y,Cn=an.prevZoomLevel;Yt.zoomToPoint({x:vn,y:yn},Cn),this.zoomLevel=Cn}Yt.zoomToPoint({x:Tt,y:Dt},kt),this._isDefaultZoomLevel(kt)||this._centerPoints.push({x:Tt,y:Dt,zoomLevel:kt,prevZoomLevel:this.zoomLevel}),this.zoomLevel=kt,this._fireZoomChanged(Yt,kt)}},{key:"zoomOut",value:function(){var wt=this._centerPoints;if(!!wt.length){var Tt=this.getCanvas(),Dt=wt.pop(),kt=Dt.x,Yt=Dt.y,zt=Dt.prevZoomLevel;this._isDefaultZoomLevel(zt)?Tt.setViewportTransform([1,0,0,1,0,0]):Tt.zoomToPoint({x:kt,y:Yt},zt),this.zoomLevel=zt,this._fireZoomChanged(Tt,this.zoomLevel)}}},{key:"resetZoom",value:function(){var wt=this.getCanvas();wt.setViewportTransform([1,0,0,1,0,0]),this.zoomLevel=As,this._centerPoints=[],this._fireZoomChanged(wt,this.zoomLevel)}},{key:"_isMaxZoomLevel",value:function(){return this.zoomLevel>=5}},{key:"_movePointOfZoom",value:function(wt){var Tt=wt.x,Dt=wt.y,kt=this._centerPoints;if(!!kt.length){var Yt=this.getCanvas(),zt=this.zoomLevel,en=kt.pop(),an=en.x,vn=en.y,yn=en.prevZoomLevel,Cn=an-Tt,wn=vn-Dt;Yt.zoomToPoint({x:an,y:vn},yn),Yt.zoomToPoint({x:Cn,y:wn},zt),kt.push({x:Cn,y:wn,prevZoomLevel:yn,zoomLevel:zt}),this._fireZoomChanged(Yt,zt)}}},{key:"_onMouseDownWithHandMode",value:function(wt){var Tt=wt.target,Dt=wt.e;if(!Tt){var kt=this.getCanvas();if(!(this.zoomLevel<=As)){kt.selection=!1,this._startHandPoint=kt.getPointer(Dt);var Yt=this._listeners,zt=Yt.moveHand,en=Yt.stopHand;kt.on({"mouse:move":zt,"mouse:up":en})}}}},{key:"_onMouseMoveWithHandMode",value:function(wt){var Tt=wt.e,Dt=this.getCanvas(),kt=Dt.getPointer(Tt),Yt=kt.x,zt=kt.y,en=Yt-this._startHandPoint.x,an=zt-this._startHandPoint.y;this._movePointOfZoom({x:en,y:an})}},{key:"_onMouseUpWithHandMode",value:function(){var wt=this.getCanvas(),Tt=this._listeners,Dt=Tt.moveHand,kt=Tt.stopHand;wt.off({"mouse:move":Dt,"mouse:up":kt}),this._startHandPoint=null}},{key:"_changeScrollState",value:function(wt){var Tt=wt.viewport,Dt=wt.zoomLevel,kt=this.getCanvas();if(kt.remove(this._verticalScroll),kt.remove(this._horizontalScroll),!this._isDefaultZoomLevel(Dt)){var Yt=kt.width,zt=kt.height,en=Tt.tl,an=Tt.tr,vn=Tt.bl,yn=an.x-en.x,Cn=vn.y-en.y,wn=yn*yn/Yt,_n=Cn*Ws.SIZE,Nn=Cr(en.x+en.x/Yt*yn,en.x,an.x-wn),Kn=Cn*Ws.MARGIN,Zn=Cn*Ws.BORDER_RADIUS;this._horizontalScroll.set({left:Nn,top:vn.y-_n-Kn,width:wn,height:_n,rx:Zn,ry:Zn});var er=yn*Vs.SIZE,Gn=Cn*Cn/zt,ur=Cr(en.y+en.y/zt*Cn,an.y,vn.y-Gn),wr=yn*Vs.MARGIN,Br=yn*Vs.BORDER_RADIUS;this._verticalScroll.set({left:an.x-er-wr,top:ur,width:er,height:Gn,rx:Br,ry:Br}),this._addScrollBar()}}},{key:"_changeObjectsEventedState",value:function(){var wt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,Tt=this.getCanvas();Tt.forEachObject(function(Dt){Dt.evented=wt})}},{key:"_addScrollBar",value:function(){var wt=this,Tt=this.getCanvas();Tt.add(this._horizontalScroll),Tt.add(this._verticalScroll),this.scrollBarTid&&clearTimeout(this.scrollBarTid),this.scrollBarTid=gt()(function(){Tt.remove(wt._horizontalScroll),Tt.remove(wt._verticalScroll)},3e3)}},{key:"_isDefaultZoomLevel",value:function(wt){return wt===As}},{key:"_fireZoomChanged",value:function(wt,Tt){wt.fire(Io,{viewport:wt.calcViewportBoundaries(),zoomLevel:Tt})}},{key:"mode",get:function(){return this.zoomMode}}]),_t}(Fr),XA=GA,Oo=fs.create,Do=fs.types,KA=function(){function Rt(Bt){Ht(this,Rt),this.name=Bt}return Wt(Rt,[{key:"getName",value:function(){return this.name}},{key:"start",value:function(){throw new Error(Oo(Do.UN_IMPLEMENTATION,"start"))}},{key:"end",value:function(){throw new Error(Oo(Do.UN_IMPLEMENTATION,"stop"))}}]),Rt}(),Qr=KA;function $A(Rt){var Bt=JA();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function JA(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var ZA=function(Rt){lr(_t,Rt);var Bt=$A(_t);function _t(){return Ht(this,_t),Bt.call(this,nr.CROPPER)}return Wt(_t,[{key:"start",value:function(wt){var Tt=wt.getComponent(Tn.CROPPER);Tt.start()}},{key:"end",value:function(wt){var Tt=wt.getComponent(Tn.CROPPER);Tt.end()}}]),_t}(Qr),qA=ZA;function em(Rt){var Bt=tm();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function tm(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var im=function(Rt){lr(_t,Rt);var Bt=em(_t);function _t(){return Ht(this,_t),Bt.call(this,nr.FREE_DRAWING)}return Wt(_t,[{key:"start",value:function(wt,Tt){var Dt=wt.getComponent(Tn.FREE_DRAWING);Dt.start(Tt)}},{key:"end",value:function(wt){var Tt=wt.getComponent(Tn.FREE_DRAWING);Tt.end()}}]),_t}(Qr),nm=im;function rm(Rt){var Bt=am();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function am(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var sm=function(Rt){lr(_t,Rt);var Bt=rm(_t);function _t(){return Ht(this,_t),Bt.call(this,nr.LINE_DRAWING)}return Wt(_t,[{key:"start",value:function(wt,Tt){var Dt=wt.getComponent(Tn.LINE);Dt.start(Tt)}},{key:"end",value:function(wt){var Tt=wt.getComponent(Tn.LINE);Tt.end()}}]),_t}(Qr),om=sm;function lm(Rt){var Bt=cm();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function cm(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var um=function(Rt){lr(_t,Rt);var Bt=lm(_t);function _t(){return Ht(this,_t),Bt.call(this,nr.SHAPE)}return Wt(_t,[{key:"start",value:function(wt){var Tt=wt.getComponent(Tn.SHAPE);Tt.start()}},{key:"end",value:function(wt){var Tt=wt.getComponent(Tn.SHAPE);Tt.end()}}]),_t}(Qr),fm=um;function hm(Rt){var Bt=dm();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function dm(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var pm=function(Rt){lr(_t,Rt);var Bt=hm(_t);function _t(){return Ht(this,_t),Bt.call(this,nr.TEXT)}return Wt(_t,[{key:"start",value:function(wt){var Tt=wt.getComponent(Tn.TEXT);Tt.start()}},{key:"end",value:function(wt){var Tt=wt.getComponent(Tn.TEXT);Tt.end()}}]),_t}(Qr),gm=pm;function Am(Rt){var Bt=mm();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function mm(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var vm=function(Rt){lr(_t,Rt);var Bt=Am(_t);function _t(){return Ht(this,_t),Bt.call(this,nr.ICON)}return Wt(_t,[{key:"start",value:function(wt){var Tt=wt.getComponent(Tn.ICON);Tt.start()}},{key:"end",value:function(wt){var Tt=wt.getComponent(Tn.ICON);Tt.end()}}]),_t}(Qr),ym=vm;function bm(Rt){var Bt=xm();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function xm(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Cm=function(Rt){lr(_t,Rt);var Bt=bm(_t);function _t(){return Ht(this,_t),Bt.call(this,nr.ZOOM)}return Wt(_t,[{key:"start",value:function(wt){var Tt=wt.getComponent(Tn.ZOOM);Tt.start()}},{key:"end",value:function(wt){var Tt=wt.getComponent(Tn.ZOOM);Tt.end()}}]),_t}(Qr),wm=Cm,jo=null;function Fo(Rt){jo=Rt}function _m(){return jo}function Ys(Rt,Bt){var _t;if(Rt.type==="activeSelection"){var Et;_t=Yr()(Et=Rt.getObjects()).call(Et,function(wt){var Tt=wt.angle,Dt=wt.left,kt=wt.top,Yt=wt.scaleX,zt=wt.scaleY,en=wt.width,an=wt.height;Vt.fabric.util.addTransformToObject(wt,Rt.calcTransformMatrix());var vn=Bt(wt);return wt.set({angle:Tt,left:Dt,top:kt,width:en,height:an,scaleX:Yt,scaleY:zt}),vn})}else _t=[Bt(Rt)];return _t}function Gs(Rt,Bt,_t){return _t?{id:Rt,width:Bt.width,height:Bt.height,top:Bt.top,left:Bt.left,angle:Bt.angle,scaleX:Bt.scaleX,scaleY:Bt.scaleY}:(0,_i.extend)({id:Rt},Bt)}function Sm(Rt){var Bt=Em();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Em(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Tm=function(Rt){lr(_t,Rt);var Bt=Sm(_t);function _t(Et){var wt;return Ht(this,_t),wt=Bt.call(this,Tn.RESIZE,Et),wt._dimensions=null,wt._originalDimensions=null,wt}return Wt(_t,[{key:"getCurrentDimensions",value:function(){var wt=this.getCanvasImage();if(!this._dimensions&&wt){var Tt=wt.width,Dt=wt.height;this._dimensions={width:Tt,height:Dt}}return this._dimensions}},{key:"getOriginalDimensions",value:function(){return this._originalDimensions}},{key:"setOriginalDimensions",value:function(wt){this._originalDimensions=wt}},{key:"resize",value:function(wt){var Tt=this.getCanvasImage(),Dt=Tt.width,kt=Tt.height,Yt=Tt.scaleX,zt=Tt.scaleY,en=wt.width,an=wt.height,vn={scaleX:en?en/Dt:Yt,scaleY:an?an/kt:zt};return(Yt!==vn.scaleX||zt!==vn.scaleY)&&(Tt.set(vn).setCoords(),this._dimensions={width:Tt.width*Tt.scaleX,height:Tt.height*Tt.scaleY}),this.adjustCanvasDimensionBase(),Gt().resolve()}},{key:"start",value:function(){var wt=this.getCurrentDimensions();this.setOriginalDimensions(wt)}},{key:"end",value:function(){}}]),_t}(Fr),Im=Tm;function Bm(Rt){var Bt=Mm();return function(){var Et=Jn(Rt),wt;if(Bt){var Tt=Jn(this).constructor;wt=Dn()(Et,arguments,Tt)}else wt=Et.apply(this,arguments);return cr(this,wt)}}function Mm(){if(typeof Reflect=="undefined"||!Dn()||Dn().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Dn()(Boolean,[],function(){})),!0}catch{return!1}}var Om=function(Rt){lr(_t,Rt);var Bt=Bm(_t);function _t(){return Ht(this,_t),Bt.call(this,nr.RESIZE)}return Wt(_t,[{key:"start",value:function(wt){var Tt=wt.getComponent(Tn.RESIZE);Tt.start()}},{key:"end",value:function(wt){var Tt=wt.getComponent(Tn.RESIZE);Tt.end()}}]),_t}(Qr),Dm=Om,Gr=Xt().extend,ms=Xt().stamp,No=Xt().isArray,jm=Xt().isString,Fm=Xt().forEachArray,Nm=Xt().forEachOwnProperties,Lm=Xt().CustomEvents,km=1e3,Pm=800,vs=10,Rm={cssOnly:!0},Um={backstoreOnly:!0},Lo=function(){function Rt(Bt){var _t,Et,wt,Tt,Dt,kt,Yt,zt,en,an,vn,yn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Cn=yn.cssMaxWidth,wn=yn.cssMaxHeight;Ht(this,Rt),this.canvasImage=null,this.cssMaxWidth=Cn||km,this.cssMaxHeight=wn||Pm,this.cropSelectionStyle={},this.targetObjectForCopyPaste=null,this.imageName="",this._objects={},this._canvas=null,this._drawingMode=nr.NORMAL,this._drawingModeMap={},this._componentMap={},this._handler={onMouseDown:Lt()(_t=this._onMouseDown).call(_t,this),onObjectAdded:Lt()(Et=this._onObjectAdded).call(Et,this),onObjectRemoved:Lt()(wt=this._onObjectRemoved).call(wt,this),onObjectMoved:Lt()(Tt=this._onObjectMoved).call(Tt,this),onObjectScaled:Lt()(Dt=this._onObjectScaled).call(Dt,this),onObjectModified:Lt()(kt=this._onObjectModified).call(kt,this),onObjectRotated:Lt()(Yt=this._onObjectRotated).call(Yt,this),onObjectSelected:Lt()(zt=this._onObjectSelected).call(zt,this),onPathCreated:Lt()(en=this._onPathCreated).call(en,this),onSelectionCleared:Lt()(an=this._onSelectionCleared).call(an,this),onSelectionCreated:Lt()(vn=this._onSelectionCreated).call(vn,this)},this._setObjectCachingToFalse(),this._setCanvasElement(Bt),this._createDrawingModeInstances(),this._createComponents(),this._attachCanvasEvents(),this._attachZoomEvents()}return Wt(Rt,[{key:"destroy",value:function(){var _t=this._canvas.wrapperEl;this._canvas.clear(),_t.parentNode.removeChild(_t),this._detachZoomEvents()}},{key:"_attachZoomEvents",value:function(){var _t=this.getComponent(Tn.ZOOM);_t.attachKeyboardZoomEvents()}},{key:"_detachZoomEvents",value:function(){var _t=this.getComponent(Tn.ZOOM);_t.detachKeyboardZoomEvents()}},{key:"deactivateAll",value:function(){return this._canvas.discardActiveObject(),this}},{key:"renderAll",value:function(){return this._canvas.renderAll(),this}},{key:"add",value:function(_t){var Et,wt=[];No(_t)?wt=_t:wt.push(_t),(Et=this._canvas).add.apply(Et,Ft(wt))}},{key:"contains",value:function(_t){return this._canvas.contains(_t)}},{key:"getObjects",value:function(){var _t;return ft()(_t=this._canvas.getObjects()).call(_t)}},{key:"getObject",value:function(_t){return this._objects[_t]}},{key:"remove",value:function(_t){this._canvas.remove(_t)}},{key:"removeAll",value:function(_t){var Et,wt=this._canvas,Tt=ft()(Et=wt.getObjects()).call(Et);return wt.remove.apply(wt,Ft(this._canvas.getObjects())),_t&&wt.clear(),Tt}},{key:"removeObjectById",value:function(_t){var Et=[],wt=this._canvas,Tt=this.getObject(_t),Dt=Tt&&Tt.isType("group")&&!Tt.isEmpty();return Dt?(wt.discardActiveObject(),Tt.forEachObject(function(kt){Et.push(kt),wt.remove(kt)})):wt.contains(Tt)&&(Et.push(Tt),wt.remove(Tt)),Et}},{key:"getObjectId",value:function(_t){var Et=null;for(Et in this._objects)if(this._objects.hasOwnProperty(Et)&&_t===this._objects[Et])return Et;return null}},{key:"getActiveObject",value:function(){return this._canvas._activeObject}},{key:"getActiveObjectIdForRemove",value:function(){var _t=this.getActiveObject(),Et=_t.type,wt=_t.left,Tt=_t.top,Dt=Et==="activeSelection";if(Dt){var kt=new Vt.fabric.Group(Ft(_t.getObjects()),{left:wt,top:Tt});return this._addFabricObject(kt)}return this.getObjectId(_t)}},{key:"isReadyRemoveObject",value:function(){var _t=this.getActiveObject();return _t&&!_t.isEditing}},{key:"getActiveObjects",value:function(){var _t=this._canvas._activeObject;return _t&&_t.type==="activeSelection"?_t:null}},{key:"getActiveSelectionFromObjects",value:function(_t){var Et=this.getCanvas();return new Vt.fabric.ActiveSelection(_t,{canvas:Et})}},{key:"setActiveObject",value:function(_t){this._canvas.setActiveObject(_t)}},{key:"setCropSelectionStyle",value:function(_t){this.cropSelectionStyle=_t}},{key:"getComponent",value:function(_t){return this._componentMap[_t]}},{key:"getDrawingMode",value:function(){return this._drawingMode}},{key:"startDrawingMode",value:function(_t,Et){if(this._isSameDrawingMode(_t))return!0;this.stopDrawingMode();var wt=this._getDrawingModeInstance(_t);return wt&&wt.start&&(wt.start(this,Et),this._drawingMode=_t),!!wt}},{key:"stopDrawingMode",value:function(){if(!this._isSameDrawingMode(nr.NORMAL)){var _t=this._getDrawingModeInstance(this.getDrawingMode());_t&&_t.end&&_t.end(this),this._drawingMode=nr.NORMAL}}},{key:"zoom",value:function(_t,Et){var wt=_t.x,Tt=_t.y,Dt=this.getComponent(Tn.ZOOM);Dt.zoom({x:wt,y:Tt},Et)}},{key:"getZoomMode",value:function(){var _t=this.getComponent(Tn.ZOOM);return _t.mode}},{key:"startZoomInMode",value:function(){var _t=this.getComponent(Tn.ZOOM);_t.startZoomInMode()}},{key:"endZoomInMode",value:function(){var _t=this.getComponent(Tn.ZOOM);_t.endZoomInMode()}},{key:"zoomOut",value:function(){var _t=this.getComponent(Tn.ZOOM);_t.zoomOut()}},{key:"startHandMode",value:function(){var _t=this.getComponent(Tn.ZOOM);_t.startHandMode()}},{key:"endHandMode",value:function(){var _t=this.getComponent(Tn.ZOOM);_t.endHandMode()}},{key:"resetZoom",value:function(){var _t=this.getComponent(Tn.ZOOM);_t.resetZoom()}},{key:"toDataURL",value:function(_t){var Et=this.getComponent(Tn.CROPPER);Et.changeVisibility(!1);var wt=this._canvas&&this._canvas.toDataURL(_t);return Et.changeVisibility(!0),wt}},{key:"setCanvasImage",value:function(_t,Et){Et&&ms(Et),this.imageName=_t,this.canvasImage=Et}},{key:"setCssMaxDimension",value:function(_t){this.cssMaxWidth=_t.width||this.cssMaxWidth,this.cssMaxHeight=_t.height||this.cssMaxHeight}},{key:"adjustCanvasDimension",value:function(){this.adjustCanvasDimensionBase(this.canvasImage.scale(1))}},{key:"adjustCanvasDimensionBase",value:function(){var _t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;_t||(_t=this.canvasImage);var Et=_t.getBoundingRect(),wt=Et.width,Tt=Et.height,Dt=this._calcMaxDimension(wt,Tt);this.setCanvasCssDimension({width:"100%",height:"100%","max-width":"".concat(Dt.width,"px"),"max-height":"".concat(Dt.height,"px")}),this.setCanvasBackstoreDimension({width:wt,height:Tt}),this._canvas.centerObject(_t)}},{key:"setCanvasCssDimension",value:function(_t){this._canvas.setDimensions(_t,Rm)}},{key:"setCanvasBackstoreDimension",value:function(_t){this._canvas.setDimensions(_t,Um)}},{key:"setImageProperties",value:function(_t,Et){var wt=this.canvasImage;!wt||(wt.set(_t).setCoords(),Et&&this._canvas.renderAll())}},{key:"getCanvasElement",value:function(){return this._canvas.getElement()}},{key:"getCanvas",value:function(){return this._canvas}},{key:"getCanvasImage",value:function(){return this.canvasImage}},{key:"getImageName",value:function(){return this.imageName}},{key:"addImageObject",value:function(_t){var Et,wt=this,Tt=Lt()(Et=this._callbackAfterLoadingImageObject).call(Et,this);return new(Gt())(function(Dt){Vt.fabric.Image.fromURL(_t,function(kt){Tt(kt),Dt(wt.createObjectProperties(kt))},{crossOrigin:"Anonymous"})})}},{key:"getCenter",value:function(){return this._canvas.getCenter()}},{key:"getCropzoneRect",value:function(){return this.getComponent(Tn.CROPPER).getCropzoneRect()}},{key:"setCropzoneRect",value:function(_t){this.getComponent(Tn.CROPPER).setCropzoneRect(_t)}},{key:"getCroppedImageData",value:function(_t){return this.getComponent(Tn.CROPPER).getCroppedImageData(_t)}},{key:"setBrush",value:function(_t){var Et=this._drawingMode,wt=Tn.FREE_DRAWING;Et===nr.LINE_DRAWING&&(wt=Tn.LINE),this.getComponent(wt).setBrush(_t)}},{key:"setDrawingShape",value:function(_t,Et){this.getComponent(Tn.SHAPE).setStates(_t,Et)}},{key:"setIconStyle",value:function(_t,Et){this.getComponent(Tn.ICON).setStates(_t,Et)}},{key:"registerPaths",value:function(_t){this.getComponent(Tn.ICON).registerPaths(_t)}},{key:"changeCursor",value:function(_t){var Et=this.getCanvas();Et.defaultCursor=_t,Et.renderAll()}},{key:"hasFilter",value:function(_t){return this.getComponent(Tn.FILTER).hasFilter(_t)}},{key:"setSelectionStyle",value:function(_t){Gr(Yn.SELECTION_STYLE,_t)}},{key:"setObjectProperties",value:function(_t,Et){var wt=this.getObject(_t),Tt=Gr({},Et);return wt.set(Tt),wt.setCoords(),this.getCanvas().renderAll(),Tt}},{key:"getObjectProperties",value:function(_t,Et){var wt=this.getObject(_t),Tt={};return jm(Et)?Tt[Et]=wt[Et]:No(Et)?Fm(Et,function(Dt){Tt[Dt]=wt[Dt]}):Nm(Et,function(Dt,kt){Tt[kt]=wt[kt]}),Tt}},{key:"getObjectPosition",value:function(_t,Et,wt){var Tt=this.getObject(_t);return Tt?Tt.getPointByOrigin(Et,wt):null}},{key:"setObjectPosition",value:function(_t,Et){var wt=this.getObject(_t),Tt=Et.x,Dt=Et.y,kt=Et.originX,Yt=Et.originY;if(!wt)return!1;var zt=wt.getPointByOrigin(kt,Yt),en=wt.getPointByOrigin("center","center"),an=en.x-zt.x,vn=en.y-zt.y;return wt.set({left:Tt+an,top:Dt+vn}),wt.setCoords(),!0}},{key:"getCanvasSize",value:function(){var _t=this.getCanvasImage();return{width:_t?_t.width:0,height:_t?_t.height:0}}},{key:"createStaticCanvas",value:function(){var _t=new Vt.fabric.StaticCanvas;return _t.set({enableRetinaScaling:!1}),_t}},{key:"_getDrawingModeInstance",value:function(_t){return this._drawingModeMap[_t]}},{key:"_setObjectCachingToFalse",value:function(){Vt.fabric.Object.prototype.objectCaching=!1}},{key:"_setCanvasElement",value:function(_t){var Et,wt;_t.nodeType?Et=_t:Et=document.querySelector(_t),Et.nodeName.toUpperCase()!=="CANVAS"&&(wt=document.createElement("canvas"),Et.appendChild(wt)),this._canvas=new Vt.fabric.Canvas(wt,{containerClass:"tui-image-editor-canvas-container",enableRetinaScaling:!1})}},{key:"_createDrawingModeInstances",value:function(){this._register(this._drawingModeMap,new qA),this._register(this._drawingModeMap,new nm),this._register(this._drawingModeMap,new om),this._register(this._drawingModeMap,new fm),this._register(this._drawingModeMap,new gm),this._register(this._drawingModeMap,new ym),this._register(this._drawingModeMap,new wm),this._register(this._drawingModeMap,new Dm)}},{key:"_createComponents",value:function(){this._register(this._componentMap,new up(this)),this._register(this._componentMap,new Tp(this)),this._register(this._componentMap,new Op(this)),this._register(this._componentMap,new Np(this)),this._register(this._componentMap,new Rp(this)),this._register(this._componentMap,new Gp(this)),this._register(this._componentMap,new _g(this)),this._register(this._componentMap,new rA(this)),this._register(this._componentMap,new AA(this)),this._register(this._componentMap,new RA(this)),this._register(this._componentMap,new XA(this)),this._register(this._componentMap,new Im(this))}},{key:"_register",value:function(_t,Et){_t[Et.getName()]=Et}},{key:"_isSameDrawingMode",value:function(_t){return this.getDrawingMode()===_t}},{key:"_calcMaxDimension",value:function(_t,Et){var wt=this.cssMaxWidth/_t,Tt=this.cssMaxHeight/Et,Dt=Math.min(_t,this.cssMaxWidth),kt=Math.min(Et,this.cssMaxHeight);return wt<1&&wt<Tt?(Dt=_t*wt,kt=Et*wt):Tt<1&&Tt<wt&&(Dt=_t*Tt,kt=Et*Tt),{width:Math.floor(Dt),height:Math.floor(kt)}}},{key:"_callbackAfterLoadingImageObject",value:function(_t){var Et=this.getCanvasImage().getCenterPoint();_t.set(Yn.SELECTION_STYLE),_t.set({left:Et.x,top:Et.y,crossOrigin:"Anonymous"}),this.getCanvas().add(_t).setActiveObject(_t)}},{key:"_attachCanvasEvents",value:function(){var _t=this._canvas,Et=this._handler;_t.on({"mouse:down":Et.onMouseDown,"object:added":Et.onObjectAdded,"object:removed":Et.onObjectRemoved,"object:moving":Et.onObjectMoved,"object:scaling":Et.onObjectScaled,"object:modified":Et.onObjectModified,"object:rotating":Et.onObjectRotated,"path:created":Et.onPathCreated,"selection:cleared":Et.onSelectionCleared,"selection:created":Et.onSelectionCreated,"selection:updated":Et.onObjectSelected})}},{key:"_onMouseDown",value:function(_t){var Et=this,wt=_t.e,Tt=_t.target,Dt=this._canvas.getPointer(wt);if(Tt){var kt=Tt.type,Yt=Ys(Tt,function(zt){return Gs(Et.getObjectId(zt),zt,kt==="activeSelection")});Fo(Yt)}this.fire(xn.MOUSE_DOWN,wt,Dt)}},{key:"_onObjectAdded",value:function(_t){var Et=_t.target;Et.isType("cropzone")||this._addFabricObject(Et)}},{key:"_onObjectRemoved",value:function(_t){var Et=_t.target;this._removeFabricObject(ms(Et))}},{key:"_onObjectMoved",value:function(_t){var Et=this;this._lazyFire(xn.OBJECT_MOVED,function(wt){return Et.createObjectProperties(wt)},_t.target)}},{key:"_onObjectScaled",value:function(_t){var Et=this;this._lazyFire(xn.OBJECT_SCALED,function(wt){return Et.createObjectProperties(wt)},_t.target)}},{key:"_onObjectModified",value:function(_t){var Et=_t.target;if(Et.type==="activeSelection"){var wt=Et.getObjects();Jt()(wt).call(wt,function(Tt){return Tt.fire("modifiedInGroup",Et)})}this.fire(xn.OBJECT_MODIFIED,Et,this.getObjectId(Et))}},{key:"_onObjectRotated",value:function(_t){var Et=this;this._lazyFire(xn.OBJECT_ROTATED,function(wt){return Et.createObjectProperties(wt)},_t.target)}},{key:"_lazyFire",value:function(_t,Et,wt){var Tt=this,Dt=wt&&wt.canvasEventDelegation,kt=Dt?wt.canvasEventDelegation(_t):"none";kt==="unregistered"&&wt.canvasEventRegister(_t,function(Yt){Tt.fire(_t,Et(Yt))}),kt==="none"&&this.fire(_t,Et(wt))}},{key:"_onObjectSelected",value:function(_t){var Et=_t.target,wt=this.createObjectProperties(Et);this.fire(xn.OBJECT_ACTIVATED,wt)}},{key:"_onPathCreated",value:function(_t){var Et=_t.path.getCenterPoint(),wt=Et.x,Tt=Et.y;_t.path.set(Gr({left:wt,top:Tt},Yn.SELECTION_STYLE));var Dt=this.createObjectProperties(_t.path);this.fire(xn.ADD_OBJECT,Dt)}},{key:"_onSelectionCleared",value:function(){this.fire(xn.SELECTION_CLEARED)}},{key:"_onSelectionCreated",value:function(_t){var Et=_t.target,wt=this.createObjectProperties(Et);this.fire(xn.OBJECT_ACTIVATED,wt),this.fire(xn.SELECTION_CREATED,_t.target)}},{key:"discardSelection",value:function(){this._canvas.discardActiveObject(),this._canvas.renderAll()}},{key:"changeSelectableAll",value:function(_t){this._canvas.forEachObject(function(Et){Et.selectable=_t,Et.hoverCursor=_t?"move":"crosshair"})}},{key:"createObjectProperties",value:function(_t){var Et=["left","top","width","height","fill","stroke","strokeWidth","opacity","angle"],wt={id:ms(_t),type:_t.type};if(Gr(wt,Zr(_t,Et)),hr(["i-text","text"],_t.type))Gr(wt,this._createTextProperties(_t,wt));else if(hr(["rect","triangle","circle"],_t.type)){var Tt=this.getComponent(Tn.SHAPE);Gr(wt,{fill:Tt.makeFillPropertyForUserEvent(_t)})}return wt}},{key:"_createTextProperties",value:function(_t){var Et=["text","fontFamily","fontSize","fontStyle","textAlign","textDecoration","fontWeight"],wt={};return Gr(wt,Zr(_t,Et)),wt}},{key:"_addFabricObject",value:function(_t){var Et=ms(_t);return this._objects[Et]=_t,Et}},{key:"_removeFabricObject",value:function(_t){delete this._objects[_t]}},{key:"resetTargetObjectForCopyPaste",value:function(){var _t=this.getActiveObject();_t&&(this.targetObjectForCopyPaste=_t)}},{key:"pasteObject",value:function(){var _t=this;if(!this.targetObjectForCopyPaste)return Gt().resolve([]);var Et=this.targetObjectForCopyPaste,wt=Et.type==="activeSelection",Tt=wt?Et.getObjects():[Et],Dt=null;return this.discardSelection(),this._cloneObject(Tt).then(function(kt){if(kt.length>1)Dt=_t.getActiveSelectionFromObjects(kt);else{var Yt=gn(kt,1);Dt=Yt[0]}_t.targetObjectForCopyPaste=Dt,_t.setActiveObject(Dt)})}},{key:"_cloneObject",value:function(_t){var Et=this,wt=Yr()(Xt()).call(Xt(),_t,function(Tt){return Et._cloneObjectItem(Tt)});return Gt().all(wt)}},{key:"_cloneObjectItem",value:function(_t){var Et=this;return this._copyFabricObjectForPaste(_t).then(function(wt){var Tt=Et.createObjectProperties(wt);return Et.add(wt),Et.fire(xn.ADD_OBJECT,Tt),wt})}},{key:"_copyFabricObjectForPaste",value:function(_t){var Et=this,wt=function(Dt,kt){return kt?Dt-vs:Dt+vs};return this._copyFabricObject(_t).then(function(Tt){var Dt=Tt.left,kt=Tt.top,Yt=Tt.width,zt=Tt.height,en=Et.getCanvasSize(),an=en.width,vn=en.height,yn=Dt+Yt/2,Cn=kt+zt/2;return Tt.set(Xt().extend({left:wt(Dt,yn+vs>an),top:wt(kt,Cn+vs>vn)},Yn.SELECTION_STYLE)),Tt})}},{key:"_copyFabricObject",value:function(_t){var Et=this;return new(Gt())(function(wt){_t.clone(function(Tt){var Dt=Et.getComponent(Tn.SHAPE);yr(Tt)&&Dt.processForCopiedObject(Tt,_t),wt(Tt)})})}},{key:"getCurrentDimensions",value:function(){var _t=this.getComponent(Tn.RESIZE);return _t.getCurrentDimensions()}},{key:"getOriginalDimensions",value:function(){var _t=this.getComponent(Tn.RESIZE);return _t.getOriginalDimensions()}},{key:"setOriginalDimensions",value:function(_t){var Et=this.getComponent(Tn.RESIZE);Et.setOriginalDimensions(_t)}},{key:"resize",value:function(_t){var Et=this.getComponent(Tn.RESIZE);return Et.resize(_t)}}]),Rt}();Lm.mixin(Lo);var Hm=Lo,ko=Xt().isUndefined,zm=Jt()(Xt()),Qm=Xt().CustomEvents,Vm=xn.MOUSE_DOWN,Wm=xn.OBJECT_MOVED,Ym=xn.OBJECT_SCALED,Gm=xn.OBJECT_ACTIVATED,Xm=xn.OBJECT_ROTATED,Po=xn.OBJECT_ADDED,Km=xn.OBJECT_MODIFIED,$m=xn.ADD_TEXT,Jm=xn.ADD_OBJECT,Zm=xn.TEXT_EDITING,qm=xn.TEXT_CHANGED,ev=xn.ICON_CREATE_RESIZE,tv=xn.ICON_CREATE_END,Ro=xn.SELECTION_CLEARED,Uo=xn.SELECTION_CREATED,iv=xn.ADD_OBJECT_AFTER,Xs=function(){function Rt(Bt,_t){var Et,wt,Tt,Dt,kt,Yt,zt,en,an,vn,yn,Cn,wn,_n,Nn,Kn;if(Ht(this,Rt),_t=Xt().extend({includeUI:!1,usageStatistics:!0},_t),this.mode=null,this.activeObjectId=null,_t.includeUI){var Zn=_t.includeUI;Zn.usageStatistics=_t.usageStatistics,this.ui=new tp(Bt,Zn,this.getActions()),_t=this.ui.setUiDefaultSelectionStyle(_t)}this._invoker=new Sl,this._graphics=new Hm(this.ui?this.ui.getEditorArea():Bt,{cssMaxWidth:_t.cssMaxWidth,cssMaxHeight:_t.cssMaxHeight}),this._handlers={keydown:Lt()(Et=this._onKeyDown).call(Et,this),mousedown:Lt()(wt=this._onMouseDown).call(wt,this),objectActivated:Lt()(Tt=this._onObjectActivated).call(Tt,this),objectMoved:Lt()(Dt=this._onObjectMoved).call(Dt,this),objectScaled:Lt()(kt=this._onObjectScaled).call(kt,this),objectRotated:Lt()(Yt=this._onObjectRotated).call(Yt,this),objectAdded:Lt()(zt=this._onObjectAdded).call(zt,this),objectModified:Lt()(en=this._onObjectModified).call(en,this),createdPath:this._onCreatedPath,addText:Lt()(an=this._onAddText).call(an,this),addObject:Lt()(vn=this._onAddObject).call(vn,this),textEditing:Lt()(yn=this._onTextEditing).call(yn,this),textChanged:Lt()(Cn=this._onTextChanged).call(Cn,this),iconCreateResize:Lt()(wn=this._onIconCreateResize).call(wn,this),iconCreateEnd:Lt()(_n=this._onIconCreateEnd).call(_n,this),selectionCleared:Lt()(Nn=this._selectionCleared).call(Nn,this),selectionCreated:Lt()(Kn=this._selectionCreated).call(Kn,this)},this._attachInvokerEvents(),this._attachGraphicsEvents(),this._attachDomEvents(),this._setSelectionStyle(_t.selectionStyle,{applyCropSelectionStyle:_t.applyCropSelectionStyle,applyGroupSelectionStyle:_t.applyGroupSelectionStyle}),_t.usageStatistics&&Ir(),this.ui&&(this.ui.initCanvas(),this.setReAction(),this._attachColorPickerInputBoxEvents()),Vt.fabric.enableGLFiltering=!1}return Wt(Rt,[{key:"_attachColorPickerInputBoxEvents",value:function(){var _t=this;this.ui.on(xn.INPUT_BOX_EDITING_STARTED,function(){_t.isColorPickerInputBoxEditing=!0}),this.ui.on(xn.INPUT_BOX_EDITING_STOPPED,function(){_t.isColorPickerInputBoxEditing=!1})}},{key:"_detachColorPickerInputBoxEvents",value:function(){this.ui.off(xn.INPUT_BOX_EDITING_STARTED),this.ui.off(xn.INPUT_BOX_EDITING_STOPPED)}},{key:"_setSelectionStyle",value:function(_t,Et){var wt=Et.applyCropSelectionStyle,Tt=Et.applyGroupSelectionStyle;_t&&this._graphics.setSelectionStyle(_t),wt&&this._graphics.setCropSelectionStyle(_t),Tt&&this.on("selectionCreated",function(Dt){Dt.type==="activeSelection"&&Dt.set(_t)})}},{key:"_attachInvokerEvents",value:function(){var _t,Et,wt=this,Tt=xn.UNDO_STACK_CHANGED,Dt=xn.REDO_STACK_CHANGED,kt=xn.EXECUTE_COMMAND,Yt=xn.AFTER_UNDO,zt=xn.AFTER_REDO,en=xn.HAND_STARTED,an=xn.HAND_STOPPED;if(this._invoker.on(Tt,Lt()(_t=this.fire).call(_t,this,Tt)),this._invoker.on(Dt,Lt()(Et=this.fire).call(Et,this,Dt)),this.ui){var vn=this._graphics.getCanvas();this._invoker.on(kt,function(yn){return wt.ui.fire(kt,yn)}),this._invoker.on(Yt,function(yn){return wt.ui.fire(Yt,yn)}),this._invoker.on(zt,function(yn){return wt.ui.fire(zt,yn)}),vn.on(en,function(){return wt.ui.fire(en)}),vn.on(an,function(){return wt.ui.fire(an)})}}},{key:"_attachGraphicsEvents",value:function(){var _t;this._graphics.on((_t={},Qt(_t,Vm,this._handlers.mousedown),Qt(_t,Wm,this._handlers.objectMoved),Qt(_t,Ym,this._handlers.objectScaled),Qt(_t,Xm,this._handlers.objectRotated),Qt(_t,Gm,this._handlers.objectActivated),Qt(_t,Po,this._handlers.objectAdded),Qt(_t,Km,this._handlers.objectModified),Qt(_t,$m,this._handlers.addText),Qt(_t,Jm,this._handlers.addObject),Qt(_t,Zm,this._handlers.textEditing),Qt(_t,qm,this._handlers.textChanged),Qt(_t,ev,this._handlers.iconCreateResize),Qt(_t,tv,this._handlers.iconCreateEnd),Qt(_t,Ro,this._handlers.selectionCleared),Qt(_t,Uo,this._handlers.selectionCreated),_t))}},{key:"_attachDomEvents",value:function(){document.addEventListener("keydown",this._handlers.keydown)}},{key:"_detachDomEvents",value:function(){document.removeEventListener("keydown",this._handlers.keydown)}},{key:"_onKeyDown",value:function(_t){var Et=_t.ctrlKey,wt=_t.keyCode,Tt=_t.metaKey,Dt=Et||Tt;Dt&&(wt===Ln.C?this._graphics.resetTargetObjectForCopyPaste():wt===Ln.V?(this._graphics.pasteObject(),this.clearRedoStack()):wt===Ln.Z?this.undo().catch(function(){}):wt===Ln.Y&&this.redo().catch(function(){}));var kt=wt===Ln.BACKSPACE||wt===Ln.DEL,Yt=this._graphics.isReadyRemoveObject();!this.isColorPickerInputBoxEditing&&Yt&&kt&&(_t.preventDefault(),this.removeActiveObject())}},{key:"removeActiveObject",value:function(){var _t=this._graphics.getActiveObjectIdForRemove();this.removeObject(_t)}},{key:"_onMouseDown",value:function(_t,Et){this.fire(xn.MOUSE_DOWN,_t,Et)}},{key:"_pushAddObjectCommand",value:function(_t){var Et=dr.create(Bn.ADD_OBJECT,this._graphics,_t);this._invoker.pushUndoStack(Et)}},{key:"_pushModifyObjectCommand",value:function(_t){var Et=this,wt=_t.type,Tt=Ys(_t,function(kt){return Gs(Et._graphics.getObjectId(kt),kt,wt==="activeSelection")}),Dt=dr.create(Bn.CHANGE_SELECTION,this._graphics,Tt);Dt.execute(this._graphics,Tt),this._invoker.pushUndoStack(Dt)}},{key:"_onObjectActivated",value:function(_t){this.fire(xn.OBJECT_ACTIVATED,_t)}},{key:"_onObjectMoved",value:function(_t){this.fire(xn.OBJECT_MOVED,_t)}},{key:"_onObjectScaled",value:function(_t){this.fire(xn.OBJECT_SCALED,_t)}},{key:"_onObjectRotated",value:function(_t){this.fire(xn.OBJECT_ROTATED,_t)}},{key:"getDrawingMode",value:function(){return this._graphics.getDrawingMode()}},{key:"clearObjects",value:function(){return this.execute(Bn.CLEAR_OBJECTS)}},{key:"deactivateAll",value:function(){this._graphics.deactivateAll(),this._graphics.renderAll()}},{key:"discardSelection",value:function(){this._graphics.discardSelection()}},{key:"changeSelectableAll",value:function(_t){this._graphics.changeSelectableAll(_t)}},{key:"_initHistory",value:function(){this.ui&&this.ui.initHistory()}},{key:"_clearHistory",value:function(){this.ui&&this.ui.clearHistory()}},{key:"execute",value:function(_t){for(var Et,wt,Tt,Dt=arguments.length,kt=new Array(Dt>1?Dt-1:0),Yt=1;Yt<Dt;Yt++)kt[Yt-1]=arguments[Yt];var zt=Pt()(Et=[this._graphics]).call(Et,kt);return(wt=this._invoker).execute.apply(wt,Pt()(Tt=[_t]).call(Tt,Ft(zt)))}},{key:"executeSilent",value:function(_t){for(var Et,wt,Tt,Dt=arguments.length,kt=new Array(Dt>1?Dt-1:0),Yt=1;Yt<Dt;Yt++)kt[Yt-1]=arguments[Yt];var zt=Pt()(Et=[this._graphics]).call(Et,kt);return(wt=this._invoker).executeSilent.apply(wt,Pt()(Tt=[_t]).call(Tt,Ft(zt)))}},{key:"undo",value:function(){for(var _t=this,Et=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,wt=Gt().resolve(),Tt=0;Tt<Et;Tt+=1)wt=wt.then(function(){return _t._invoker.undo()});return wt}},{key:"redo",value:function(){for(var _t=this,Et=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,wt=Gt().resolve(),Tt=0;Tt<Et;Tt+=1)wt=wt.then(function(){return _t._invoker.redo()});return wt}},{key:"zoom",value:function(_t){var Et=_t.x,wt=_t.y,Tt=_t.zoomLevel;this._graphics.zoom({x:Et,y:wt},Tt)}},{key:"resetZoom",value:function(){this._graphics.resetZoom()}},{key:"loadImageFromFile",value:function(_t,Et){if(!_t)return Gt().reject(Hn.invalidParameters);var wt=tn().createObjectURL(_t);return Et=Et||_t.name,this.loadImageFromURL(wt,Et).then(function(Tt){return tn().revokeObjectURL(_t),Tt})}},{key:"loadImageFromURL",value:function(_t,Et){return!Et||!_t?Gt().reject(Hn.invalidParameters):this.execute(Bn.LOAD_IMAGE,Et,_t)}},{key:"addImageObject",value:function(_t){return _t?this.execute(Bn.ADD_IMAGE_OBJECT,_t):Gt().reject(Hn.invalidParameters)}},{key:"startDrawingMode",value:function(_t,Et){return this._graphics.startDrawingMode(_t,Et)}},{key:"stopDrawingMode",value:function(){this._graphics.stopDrawingMode()}},{key:"crop",value:function(_t){var Et=this._graphics.getCroppedImageData(_t);return Et?this.loadImageFromURL(Et.url,Et.imageName):Gt().reject(Hn.invalidParameters)}},{key:"getCropzoneRect",value:function(){return this._graphics.getCropzoneRect()}},{key:"setCropzoneRect",value:function(_t){this._graphics.setCropzoneRect(_t)}},{key:"_flip",value:function(_t){return this.execute(Bn.FLIP_IMAGE,_t)}},{key:"flipX",value:function(){return this._flip("flipX")}},{key:"flipY",value:function(){return this._flip("flipY")}},{key:"resetFlip",value:function(){return this._flip("reset")}},{key:"_rotate",value:function(_t,Et,wt){var Tt=null;return wt?Tt=this.executeSilent(Bn.ROTATE_IMAGE,_t,Et):Tt=this.execute(Bn.ROTATE_IMAGE,_t,Et),Tt}},{key:"rotate",value:function(_t,Et){return this._rotate("rotate",_t,Et)}},{key:"setAngle",value:function(_t,Et){return this._rotate("setAngle",_t,Et)}},{key:"setBrush",value:function(_t){this._graphics.setBrush(_t)}},{key:"setDrawingShape",value:function(_t,Et){this._graphics.setDrawingShape(_t,Et)}},{key:"setDrawingIcon",value:function(_t,Et){this._graphics.setIconStyle(_t,Et)}},{key:"addShape",value:function(_t,Et){return Et=Et||{},this._setPositions(Et),this.execute(Bn.ADD_SHAPE,_t,Et)}},{key:"changeShape",value:function(_t,Et,wt){var Tt=wt?"executeSilent":"execute";return this[Tt](Bn.CHANGE_SHAPE,_t,Et)}},{key:"addText",value:function(_t,Et){return _t=_t||"",Et=Et||{},this.execute(Bn.ADD_TEXT,_t,Et)}},{key:"changeText",value:function(_t,Et){return Et=Et||"",this.execute(Bn.CHANGE_TEXT,_t,Et)}},{key:"changeTextStyle",value:function(_t,Et,wt){var Tt=wt?"executeSilent":"execute";return this[Tt](Bn.CHANGE_TEXT_STYLE,_t,Et)}},{key:"_changeActivateMode",value:function(_t){_t!=="ICON"&&this.getDrawingMode()!==_t&&this.startDrawingMode(_t)}},{key:"_onTextChanged",value:function(_t){this.fire(xn.TEXT_CHANGED,_t)}},{key:"_onIconCreateResize",value:function(_t){this.fire(xn.ICON_CREATE_RESIZE,_t)}},{key:"_onIconCreateEnd",value:function(_t){this.fire(xn.ICON_CREATE_END,_t)}},{key:"_onTextEditing",value:function(){this.fire(xn.TEXT_EDITING)}},{key:"_onAddText",value:function(_t){this.fire(xn.ADD_TEXT,{originPosition:_t.originPosition,clientPosition:_t.clientPosition})}},{key:"_onAddObject",value:function(_t){var Et=this._graphics.getObject(_t.id);this._invoker.fire(xn.EXECUTE_COMMAND,Dr(Et.type)),this._pushAddObjectCommand(Et)}},{key:"_onObjectAdded",value:function(_t){this.fire(Po,_t),this.fire(iv,_t)}},{key:"_onObjectModified",value:function(_t){_t.type!==In.CROPZONE&&(this._invoker.fire(xn.EXECUTE_COMMAND,Dr(_t.type)),this._pushModifyObjectCommand(_t))}},{key:"_selectionCleared",value:function(){this.fire(Ro)}},{key:"_selectionCreated",value:function(_t){this.fire(Uo,_t)}},{key:"registerIcons",value:function(_t){this._graphics.registerPaths(_t)}},{key:"changeCursor",value:function(_t){this._graphics.changeCursor(_t)}},{key:"addIcon",value:function(_t,Et){return Et=Et||{},this._setPositions(Et),this.execute(Bn.ADD_ICON,_t,Et)}},{key:"changeIconColor",value:function(_t,Et){return this.execute(Bn.CHANGE_ICON_COLOR,_t,Et)}},{key:"removeObject",value:function(_t){var Et=this._graphics.getObject(_t),wt=Et.type;return this.execute(Bn.REMOVE_OBJECT,_t,Dr(wt))}},{key:"hasFilter",value:function(_t){return this._graphics.hasFilter(_t)}},{key:"removeFilter",value:function(_t){return this.execute(Bn.REMOVE_FILTER,_t)}},{key:"applyFilter",value:function(_t,Et,wt){var Tt=wt?"executeSilent":"execute";return this[Tt](Bn.APPLY_FILTER,_t,Et)}},{key:"toDataURL",value:function(_t){return this._graphics.toDataURL(_t)}},{key:"getImageName",value:function(){return this._graphics.getImageName()}},{key:"clearUndoStack",value:function(){this._invoker.clearUndoStack()}},{key:"clearRedoStack",value:function(){this._invoker.clearRedoStack()}},{key:"isEmptyUndoStack",value:function(){return this._invoker.isEmptyUndoStack()}},{key:"isEmptyRedoStack",value:function(){return this._invoker.isEmptyRedoStack()}},{key:"resizeCanvasDimension",value:function(_t){return _t?this.execute(Bn.RESIZE_CANVAS_DIMENSION,_t):Gt().reject(Hn.invalidParameters)}},{key:"destroy",value:function(){var _t=this;this.stopDrawingMode(),this._detachDomEvents(),this._graphics.destroy(),this._graphics=null,this.ui&&(this._detachColorPickerInputBoxEvents(),this.ui.destroy()),zm(this,function(Et,wt){_t[wt]=null},this)}},{key:"_setPositions",value:function(_t){var Et=this._graphics.getCenter();ko(_t.left)&&(_t.left=Et.left),ko(_t.top)&&(_t.top=Et.top)}},{key:"setObjectProperties",value:function(_t,Et){return this.execute(Bn.SET_OBJECT_PROPERTIES,_t,Et)}},{key:"setObjectPropertiesQuietly",value:function(_t,Et){this._graphics.setObjectProperties(_t,Et)}},{key:"getObjectProperties",value:function(_t,Et){var wt=this._graphics.getObject(_t);return wt?this._graphics.getObjectProperties(_t,Et):null}},{key:"getCanvasSize",value:function(){return this._graphics.getCanvasSize()}},{key:"getObjectPosition",value:function(_t,Et,wt){return this._graphics.getObjectPosition(_t,Et,wt)}},{key:"setObjectPosition",value:function(_t,Et){return this.execute(Bn.SET_OBJECT_POSITION,_t,Et)}},{key:"resize",value:function(_t){return this.execute(Bn.RESIZE_IMAGE,_t)}}]),Rt}();np.mixin(Xs),Qm.mixin(Xs);var nv=Xs,rv=Tn.ICON,av={name:Bn.ADD_ICON,execute:function(Bt,_t,Et){var wt=this,Tt=Bt.getComponent(rv);return Tt.add(_t,Et).then(function(Dt){return wt.undoData.object=Bt.getObject(Dt.id),Dt})},undo:function(Bt){return Bt.remove(this.undoData.object),Gt().resolve()}};dr.register(av);var sv={name:Bn.ADD_IMAGE_OBJECT,execute:function(Bt,_t){var Et=this;return Bt.addImageObject(_t).then(function(wt){return Et.undoData.object=Bt.getObject(wt.id),wt})},undo:function(Bt){return Bt.remove(this.undoData.object),Gt().resolve()}};dr.register(sv);var ov={name:Bn.ADD_OBJECT,execute:function(Bt,_t){return new(Gt())(function(Et,wt){Bt.contains(_t)?wt(Hn.addedObject):(Bt.add(_t),Et(_t))})},undo:function(Bt,_t){return new(Gt())(function(Et,wt){Bt.contains(_t)?(Bt.remove(_t),Et(_t)):wt(Hn.noObject)})}};dr.register(ov);var lv=Tn.SHAPE,cv={name:Bn.ADD_SHAPE,execute:function(Bt,_t,Et){var wt=this,Tt=Bt.getComponent(lv);return Tt.add(_t,Et).then(function(Dt){var kt=Dt.id;return wt.undoData.object=Bt.getObject(kt),Dt})},undo:function(Bt){return Bt.remove(this.undoData.object),Gt().resolve()}};dr.register(cv);var uv=Tn.TEXT,fv={name:Bn.ADD_TEXT,execute:function(Bt,_t,Et){var wt=this,Tt=Bt.getComponent(uv);if(this.undoData.object){var Dt=this.undoData.object;return new(Gt())(function(kt,Yt){Bt.contains(Dt)?Yt(Hn.redo):(Bt.add(Dt),kt(Dt))})}return Tt.add(_t,Et).then(function(kt){var Yt=kt.id,zt=Bt.getObject(Yt);return wt.undoData.object=zt,Fo(Ys(zt,function(){return Gs(Yt,zt,!1)})),kt})},undo:function(Bt){return Bt.remove(this.undoData.object),Gt().resolve()}};dr.register(fv);var Ho=Tn.FILTER,zo=null;function hv(Rt,Bt,_t){var Et={};return Rt==="mask"&&(Et.object=_t.mask),Et.options=Bt,Et}var dv={name:Bn.APPLY_FILTER,execute:function(Bt,_t,Et,wt){var Tt=Bt.getComponent(Ho);if(_t==="mask"){var Dt=Bt.getObject(Et.maskObjId);if(!(Dt&&Dt.isType("image")))return Gt().reject(Hn.invalidParameters);Xt().extend(Et,{mask:Dt}),Bt.remove(Et.mask)}if(!this.isRedo){var kt=Tt.getOptions(_t),Yt=hv(_t,kt,Et);zo=this.setUndoData(Yt,zo,wt)}return Tt.add(_t,Et)},undo:function(Bt,_t){var Et=Bt.getComponent(Ho);if(_t==="mask"){var wt=this.undoData.object;return Bt.add(wt),Bt.setActiveObject(wt),Et.remove(_t)}return this.undoData.options?Et.add(_t,this.undoData.options):Et.remove(_t)}};dr.register(dv);var Qo=Tn.ICON,pv={name:Bn.CHANGE_ICON_COLOR,execute:function(Bt,_t,Et){var wt=this;return new(Gt())(function(Tt,Dt){var kt=Bt.getComponent(Qo),Yt=Bt.getObject(_t);Yt||Dt(Hn.noObject),wt.undoData.object=Yt,wt.undoData.color=kt.getColor(Yt),kt.setColor(Et,Yt),Tt()})},undo:function(Bt){var _t=Bt.getComponent(Qo),Et=this.undoData,wt=Et.object,Tt=Et.color;return _t.setColor(Tt,wt),Gt().resolve()}};dr.register(pv);var Vo=Tn.SHAPE,Wo=null;function gv(Rt,Bt){var _t={object:Bt,options:{}};return Xt().forEachOwnProperties(Rt,function(Et,wt){_t.options[wt]=Bt[wt]}),_t}var Av={name:Bn.CHANGE_SHAPE,execute:function(Bt,_t,Et,wt){var Tt=Bt.getComponent(Vo),Dt=Bt.getObject(_t);if(!Dt)return Gt().reject(Hn.noObject);if(!this.isRedo){var kt=gv(Et,Dt);Wo=this.setUndoData(kt,Wo,wt)}return Tt.change(Dt,Et)},undo:function(Bt){var _t=Bt.getComponent(Vo),Et=this.undoData,wt=Et.object,Tt=Et.options;return _t.change(wt,Tt)}};dr.register(Av);var Yo=Tn.TEXT,mv={name:Bn.CHANGE_TEXT,execute:function(Bt,_t,Et){var wt=Bt.getComponent(Yo),Tt=Bt.getObject(_t);return Tt?(this.undoData.object=Tt,this.undoData.text=wt.getText(Tt),wt.change(Tt,Et)):Gt().reject(Hn.noObject)},undo:function(Bt){var _t=Bt.getComponent(Yo),Et=this.undoData,wt=Et.object,Tt=Et.text;return _t.change(wt,Tt)}};dr.register(mv);var Go=Tn.TEXT,Xo=null;function vv(Rt,Bt){var _t={object:Bt,styles:{}};return Xt().forEachOwnProperties(Rt,function(Et,wt){var Tt=Bt[wt];_t.styles[wt]=Tt}),_t}var yv={name:Bn.CHANGE_TEXT_STYLE,execute:function(Bt,_t,Et,wt){var Tt=Bt.getComponent(Go),Dt=Bt.getObject(_t);if(!Dt)return Gt().reject(Hn.noObject);if(!this.isRedo){var kt=vv(Et,Dt);Xo=this.setUndoData(kt,Xo,wt)}return Tt.setStyle(Dt,Et)},undo:function(Bt){var _t=Bt.getComponent(Go),Et=this.undoData,wt=Et.object,Tt=Et.styles;return _t.setStyle(wt,Tt)}};dr.register(yv);var bv={name:Bn.CLEAR_OBJECTS,execute:function(Bt){var _t=this;return new(Gt())(function(Et){_t.undoData.objects=Bt.removeAll(),Et()})},undo:function(Bt){return Bt.add(this.undoData.objects),Gt().resolve()}};dr.register(bv);var Ko=Tn.FLIP,xv={name:Bn.FLIP_IMAGE,execute:function(Bt,_t){var Et=Bt.getComponent(Ko);return this.undoData.setting=Et.getCurrentSetting(),Et[_t]()},undo:function(Bt){var _t=Bt.getComponent(Ko);return _t.set(this.undoData.setting)}};dr.register(xv);var $o=Tn.IMAGE_LOADER,Cv={name:Bn.LOAD_IMAGE,execute:function(Bt,_t,Et){var wt,Tt=Bt.getComponent($o),Dt=Tt.getCanvasImage(),kt=Dt?Dt.width:0,Yt=Dt?Dt.height:0,zt=ts()(wt=Bt.removeAll(!0)).call(wt,function(en){return en.type!=="cropzone"});return Jt()(zt).call(zt,function(en){en.evented=!0}),this.undoData={name:Tt.getImageName(),image:Dt,objects:zt},Tt.load(_t,Et).then(function(en){return{oldWidth:kt,oldHeight:Yt,newWidth:en.width,newHeight:en.height}})},undo:function(Bt){var _t=Bt.getComponent($o),Et=this.undoData,wt=Et.objects,Tt=Et.name,Dt=Et.image;return Bt.removeAll(!0),Bt.add(wt),_t.load(Tt,Dt)}};dr.register(Cv);var Jo=Tn.FILTER,wv={name:Bn.REMOVE_FILTER,execute:function(Bt,_t){var Et=Bt.getComponent(Jo);return this.undoData.options=Et.getOptions(_t),Et.remove(_t)},undo:function(Bt,_t){var Et=Bt.getComponent(Jo),wt=this.undoData.options;return Et.add(_t,wt)}};dr.register(wv);var _v={name:Bn.REMOVE_OBJECT,execute:function(Bt,_t){var Et=this;return new(Gt())(function(wt,Tt){Et.undoData.objects=Bt.removeObjectById(_t),Et.undoData.objects.length?wt():Tt(Hn.noObject)})},undo:function(Bt){return Bt.add(this.undoData.objects),Gt().resolve()}};dr.register(_v);var Sv={name:Bn.RESIZE_CANVAS_DIMENSION,execute:function(Bt,_t){var Et=this;return new(Gt())(function(wt){Et.undoData.size={width:Bt.cssMaxWidth,height:Bt.cssMaxHeight},Bt.setCssMaxDimension(_t),Bt.adjustCanvasDimension(),wt()})},undo:function(Bt){return Bt.setCssMaxDimension(this.undoData.size),Bt.adjustCanvasDimension(),Gt().resolve()}};dr.register(Sv);var Zo=Tn.ROTATION,qo=null;function Ev(Rt){return{angle:Rt.getCurrentAngle()}}var Tv={name:Bn.ROTATE_IMAGE,execute:function(Bt,_t,Et,wt){var Tt=Bt.getComponent(Zo);if(!this.isRedo){var Dt=Ev(Tt);qo=this.setUndoData(Dt,qo,wt)}return Tt[_t](Et)},undo:function(Bt){var _t=Bt.getComponent(Zo),Et=gn(this.args,3),wt=Et[1],Tt=Et[2];return wt==="setAngle"?_t[wt](this.undoData.angle):_t.rotate(-Tt)}};dr.register(Tv);var Iv={name:Bn.SET_OBJECT_PROPERTIES,execute:function(Bt,_t,Et){var wt=this,Tt=Bt.getObject(_t);return Tt?(this.undoData.props={},Xt().forEachOwnProperties(Et,function(Dt,kt){wt.undoData.props[kt]=Tt[kt]}),Bt.setObjectProperties(_t,Et),Gt().resolve()):Gt().reject(Hn.noObject)},undo:function(Bt,_t){var Et=this.undoData.props;return Bt.setObjectProperties(_t,Et),Gt().resolve()}};dr.register(Iv);var Bv={name:Bn.SET_OBJECT_POSITION,execute:function(Bt,_t,Et){var wt=Bt.getObject(_t);return wt?(this.undoData.objectId=_t,this.undoData.props=Bt.getObjectProperties(_t,["left","top"]),Bt.setObjectPosition(_t,Et),Bt.renderAll(),Gt().resolve()):Gt().reject(Hn.noObject)},undo:function(Bt){var _t=this.undoData,Et=_t.objectId,wt=_t.props;return Bt.setObjectProperties(Et,wt),Bt.renderAll(),Gt().resolve()}};dr.register(Bv);var Mv={name:Bn.CHANGE_SELECTION,execute:function(Bt,_t){return this.isRedo?Jt()(_t).call(_t,function(Et){Bt.setObjectProperties(Et.id,Et)}):this.undoData=_m(),Gt().resolve()},undo:function(Bt){var _t;return Jt()(_t=this.undoData).call(_t,function(Et){Bt.setObjectProperties(Et.id,Et)}),Gt().resolve()}};dr.register(Mv);var tl=Tn.RESIZE,Ov={name:Bn.RESIZE_IMAGE,execute:function(Bt,_t){var Et=Bt.getComponent(tl),wt=Et.getOriginalDimensions();return wt||(wt=Et.getCurrentDimensions()),this.undoData.dimensions=wt,Et.resize(_t)},undo:function(Bt){var _t=Bt.getComponent(tl);return _t.resize(this.undoData.dimensions)}};dr.register(Ov);var Dv=nv}(),rt=rt.default,rt}()})})(tuiImageEditor);/*! For license information please see toastui-react-image-editor.js.LICENSE.txt */(function(){var o={9406:function(et,it,tt){et.exports=tt(4877)},381:function(et,it,tt){et.exports=tt(5603)},8005:function(et,it,tt){et.exports=tt(4741)},7870:function(et,it,tt){et.exports=tt(4194)},7601:function(et,it,tt){et.exports=tt(2854)},651:function(et,it,tt){et.exports=tt(2)},2461:function(et,it,tt){et.exports=tt(5636)},9146:function(et,it,tt){et.exports=tt(5279)},6623:function(et,it,tt){et.exports=tt(9297)},7077:function(et,it,tt){et.exports=tt(8026)},9856:function(et,it,tt){et.exports=tt(2044)},4230:function(et,it,tt){et.exports=tt(2214)},184:function(et,it,tt){et.exports=tt(9256)},3742:function(et,it,tt){et.exports=tt(5659)},6135:function(et,it,tt){tt(9106);var rt=tt(5607);et.exports=rt("Array").concat},3971:function(et,it,tt){tt(3436);var rt=tt(5607);et.exports=rt("Array").filter},2671:function(et,it,tt){tt(5818);var rt=tt(5607);et.exports=rt("Array").slice},1484:function(et,it,tt){var rt=tt(6135),nt=Array.prototype;et.exports=function(ot){var st=ot.concat;return ot===nt||ot instanceof Array&&st===nt.concat?rt:st}},3669:function(et,it,tt){var rt=tt(3971),nt=Array.prototype;et.exports=function(ot){var st=ot.filter;return ot===nt||ot instanceof Array&&st===nt.filter?rt:st}},7663:function(et,it,tt){var rt=tt(2671),nt=Array.prototype;et.exports=function(ot){var st=ot.slice;return ot===nt||ot instanceof Array&&st===nt.slice?rt:st}},3213:function(et,it,tt){tt(3113);var rt=tt(7545).Object;et.exports=function(nt,ot){return rt.create(nt,ot)}},3512:function(et,it,tt){tt(297);var rt=tt(7545).Object,nt=et.exports=function(ot,st,at){return rt.defineProperty(ot,st,at)};rt.defineProperty.sham&&(nt.sham=!0)},632:function(et,it,tt){tt(9189);var rt=tt(7545).Object,nt=et.exports=function(ot,st){return rt.getOwnPropertyDescriptor(ot,st)};rt.getOwnPropertyDescriptor.sham&&(nt.sham=!0)},1056:function(et,it,tt){tt(2509);var rt=tt(7545);et.exports=rt.Object.getOwnPropertyDescriptors},2921:function(et,it,tt){tt(6187);var rt=tt(7545);et.exports=rt.Object.getOwnPropertySymbols},8168:function(et,it,tt){tt(9234);var rt=tt(7545);et.exports=rt.Object.getPrototypeOf},8651:function(et,it,tt){tt(2647);var rt=tt(7545);et.exports=rt.Object.keys},3083:function(et,it,tt){tt(3222);var rt=tt(7545);et.exports=rt.Object.setPrototypeOf},6577:function(et,it,tt){tt(5397);var rt=tt(7545);et.exports=rt.Reflect.construct},5008:function(et,it,tt){tt(9106),tt(6663),tt(6187),tt(9781),tt(492),tt(6681),tt(9594),tt(3665),tt(9017),tt(1250),tt(9786),tt(503),tt(6565),tt(9322),tt(3610),tt(6886),tt(3514),tt(8671),tt(8556),tt(1367);var rt=tt(7545);et.exports=rt.Symbol},994:function(et,it,tt){tt(8939),tt(6663),tt(5454),tt(3665);var rt=tt(9207);et.exports=rt.f("iterator")},9297:function(et,it,tt){var rt=tt(4963);et.exports=rt},8026:function(et,it,tt){var rt=tt(7820);et.exports=rt},2044:function(et,it,tt){var rt=tt(8980);et.exports=rt},2214:function(et,it,tt){var rt=tt(6672);et.exports=rt},9256:function(et,it,tt){var rt=tt(2285);tt(177),tt(9031),tt(6658),tt(1875),tt(8658),tt(4592),tt(6680),et.exports=rt},5659:function(et,it,tt){var rt=tt(8535);et.exports=rt},6235:function(et,it,tt){var rt=tt(6447),nt=tt(9288);et.exports=function(ot){if(rt(ot))return ot;throw TypeError(nt(ot)+" is not a function")}},1404:function(et,it,tt){var rt=tt(2091),nt=tt(9288);et.exports=function(ot){if(rt(ot))return ot;throw TypeError(nt(ot)+" is not a constructor")}},7757:function(et,it,tt){var rt=tt(6447);et.exports=function(nt){if(typeof nt=="object"||rt(nt))return nt;throw TypeError("Can't set "+String(nt)+" as a prototype")}},7423:function(et){et.exports=function(){}},1138:function(et,it,tt){var rt=tt(5744);et.exports=function(nt){if(rt(nt))return nt;throw TypeError(String(nt)+" is not an object")}},8180:function(et,it,tt){var rt=tt(101),nt=tt(7739),ot=tt(4104),st=function(at){return function(lt,ct,ht){var mt,dt=rt(lt),ft=ot(dt),ut=nt(ht,ft);if(at&&ct!=ct){for(;ft>ut;)if((mt=dt[ut++])!=mt)return!0}else for(;ft>ut;ut++)if((at||ut in dt)&&dt[ut]===ct)return at||ut||0;return!at&&-1}};et.exports={includes:st(!0),indexOf:st(!1)}},454:function(et,it,tt){var rt=tt(8043),nt=tt(2202),ot=tt(1795),st=tt(4104),at=tt(1321),lt=[].push,ct=function(ht){var mt=ht==1,dt=ht==2,ft=ht==3,ut=ht==4,pt=ht==6,At=ht==7,gt=ht==5||pt;return function(vt,yt,bt,Ct){for(var xt,It,St=ot(vt),Ot=nt(St),Mt=rt(yt,bt,3),jt=st(Ot),Ft=0,Ut=Ct||at,Qt=mt?Ut(vt,jt):dt||At?Ut(vt,0):void 0;jt>Ft;Ft++)if((gt||Ft in Ot)&&(It=Mt(xt=Ot[Ft],Ft,St),ht))if(mt)Qt[Ft]=It;else if(It)switch(ht){case 3:return!0;case 5:return xt;case 6:return Ft;case 2:lt.call(Qt,xt)}else switch(ht){case 4:return!1;case 7:lt.call(Qt,xt)}return pt?-1:ft||ut?ut:Qt}};et.exports={forEach:ct(0),map:ct(1),filter:ct(2),some:ct(3),every:ct(4),find:ct(5),findIndex:ct(6),filterReject:ct(7)}},242:function(et,it,tt){var rt=tt(6192),nt=tt(8182),ot=tt(4218),st=nt("species");et.exports=function(at){return ot>=51||!rt(function(){var lt=[];return(lt.constructor={})[st]=function(){return{foo:1}},lt[at](Boolean).foo!==1})}},3712:function(et,it,tt){var rt=tt(4770),nt=tt(2091),ot=tt(5744),st=tt(8182)("species");et.exports=function(at){var lt;return rt(at)&&(lt=at.constructor,(nt(lt)&&(lt===Array||rt(lt.prototype))||ot(lt)&&(lt=lt[st])===null)&&(lt=void 0)),lt===void 0?Array:lt}},1321:function(et,it,tt){var rt=tt(3712);et.exports=function(nt,ot){return new(rt(nt))(ot===0?0:ot)}},9272:function(et){var it={}.toString;et.exports=function(tt){return it.call(tt).slice(8,-1)}},4696:function(et,it,tt){var rt=tt(3471),nt=tt(6447),ot=tt(9272),st=tt(8182)("toStringTag"),at=ot(function(){return arguments}())=="Arguments";et.exports=rt?ot:function(lt){var ct,ht,mt;return lt===void 0?"Undefined":lt===null?"Null":typeof(ht=function(dt,ft){try{return dt[ft]}catch{}}(ct=Object(lt),st))=="string"?ht:at?ot(ct):(mt=ot(ct))=="Object"&&nt(ct.callee)?"Arguments":mt}},4635:function(et,it,tt){var rt=tt(6192);et.exports=!rt(function(){function nt(){}return nt.prototype.constructor=null,Object.getPrototypeOf(new nt)!==nt.prototype})},5148:function(et,it,tt){var rt=tt(4413).IteratorPrototype,nt=tt(2853),ot=tt(774),st=tt(1284),at=tt(7771),lt=function(){return this};et.exports=function(ct,ht,mt){var dt=ht+" Iterator";return ct.prototype=nt(rt,{next:ot(1,mt)}),st(ct,dt,!1,!0),at[dt]=lt,ct}},8711:function(et,it,tt){var rt=tt(69),nt=tt(2760),ot=tt(774);et.exports=rt?function(st,at,lt){return nt.f(st,at,ot(1,lt))}:function(st,at,lt){return st[at]=lt,st}},774:function(et){et.exports=function(it,tt){return{enumerable:!(1&it),configurable:!(2&it),writable:!(4&it),value:tt}}},9361:function(et,it,tt){var rt=tt(77),nt=tt(2760),ot=tt(774);et.exports=function(st,at,lt){var ct=rt(at);ct in st?nt.f(st,ct,ot(0,lt)):st[ct]=lt}},7218:function(et,it,tt){var rt=tt(3085),nt=tt(5546),ot=tt(2282),st=tt(6447),at=tt(5148),lt=tt(9341),ct=tt(4469),ht=tt(1284),mt=tt(8711),dt=tt(9482),ft=tt(8182),ut=tt(7771),pt=tt(4413),At=ot.PROPER,gt=ot.CONFIGURABLE,vt=pt.IteratorPrototype,yt=pt.BUGGY_SAFARI_ITERATORS,bt=ft("iterator"),Ct="keys",xt="values",It="entries",St=function(){return this};et.exports=function(Ot,Mt,jt,Ft,Ut,Qt,Ht){at(jt,Mt,Ft);var Zt,Wt,$t,Jt=function(on){if(on===Ut&&ln)return ln;if(!yt&&on in Kt)return Kt[on];switch(on){case Ct:case xt:case It:return function(){return new jt(this,on)}}return function(){return new jt(this)}},Nt=Mt+" Iterator",Lt=!1,Kt=Ot.prototype,Pt=Kt[bt]||Kt["@@iterator"]||Ut&&Kt[Ut],ln=!yt&&Pt||Jt(Ut),Gt=Mt=="Array"&&Kt.entries||Pt;if(Gt&&(Zt=lt(Gt.call(new Ot)))!==Object.prototype&&Zt.next&&(nt||lt(Zt)===vt||(ct?ct(Zt,vt):st(Zt[bt])||dt(Zt,bt,St)),ht(Zt,Nt,!0,!0),nt&&(ut[Nt]=St)),At&&Ut==xt&&Pt&&Pt.name!==xt&&(!nt&&gt?mt(Kt,"name",xt):(Lt=!0,ln=function(){return Pt.call(this)})),Ut)if(Wt={values:Jt(xt),keys:Qt?ln:Jt(Ct),entries:Jt(It)},Ht)for($t in Wt)(yt||Lt||!($t in Kt))&&dt(Kt,$t,Wt[$t]);else rt({target:Mt,proto:!0,forced:yt||Lt},Wt);return nt&&!Ht||Kt[bt]===ln||dt(Kt,bt,ln,{name:Ut}),ut[Mt]=ln,Wt}},1488:function(et,it,tt){var rt=tt(7545),nt=tt(4500),ot=tt(9207),st=tt(2760).f;et.exports=function(at){var lt=rt.Symbol||(rt.Symbol={});nt(lt,at)||st(lt,at,{value:ot.f(at)})}},69:function(et,it,tt){var rt=tt(6192);et.exports=!rt(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},7449:function(et,it,tt){var rt=tt(8576),nt=tt(5744),ot=rt.document,st=nt(ot)&&nt(ot.createElement);et.exports=function(at){return st?ot.createElement(at):{}}},7365:function(et){et.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8989:function(et,it,tt){var rt=tt(150);et.exports=rt("navigator","userAgent")||""},4218:function(et,it,tt){var rt,nt,ot=tt(8576),st=tt(8989),at=ot.process,lt=ot.Deno,ct=at&&at.versions||lt&&lt.version,ht=ct&&ct.v8;ht?nt=(rt=ht.split("."))[0]<4?1:rt[0]+rt[1]:st&&(!(rt=st.match(/Edge\/(\d+)/))||rt[1]>=74)&&(rt=st.match(/Chrome\/(\d+)/))&&(nt=rt[1]),et.exports=nt&&+nt},5607:function(et,it,tt){var rt=tt(7545);et.exports=function(nt){return rt[nt+"Prototype"]}},2952:function(et){et.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3085:function(et,it,tt){var rt=tt(8576),nt=tt(6447),ot=tt(5141).f,st=tt(9245),at=tt(7545),lt=tt(8043),ct=tt(8711),ht=tt(4500),mt=function(dt){var ft=function(ut,pt,At){if(this instanceof dt){switch(arguments.length){case 0:return new dt;case 1:return new dt(ut);case 2:return new dt(ut,pt)}return new dt(ut,pt,At)}return dt.apply(this,arguments)};return ft.prototype=dt.prototype,ft};et.exports=function(dt,ft){var ut,pt,At,gt,vt,yt,bt,Ct,xt=dt.target,It=dt.global,St=dt.stat,Ot=dt.proto,Mt=It?rt:St?rt[xt]:(rt[xt]||{}).prototype,jt=It?at:at[xt]||ct(at,xt,{})[xt],Ft=jt.prototype;for(At in ft)ut=!st(It?At:xt+(St?".":"#")+At,dt.forced)&&Mt&&ht(Mt,At),vt=jt[At],ut&&(yt=dt.noTargetGet?(Ct=ot(Mt,At))&&Ct.value:Mt[At]),gt=ut&&yt?yt:ft[At],ut&&typeof vt==typeof gt||(bt=dt.bind&&ut?lt(gt,rt):dt.wrap&&ut?mt(gt):Ot&&nt(gt)?lt(Function.call,gt):gt,(dt.sham||gt&&gt.sham||vt&&vt.sham)&&ct(bt,"sham",!0),ct(jt,At,bt),Ot&&(ht(at,pt=xt+"Prototype")||ct(at,pt,{}),ct(at[pt],At,gt),dt.real&&Ft&&!Ft[At]&&ct(Ft,At,gt)))}},6192:function(et){et.exports=function(it){try{return!!it()}catch{return!0}}},8043:function(et,it,tt){var rt=tt(6235);et.exports=function(nt,ot,st){if(rt(nt),ot===void 0)return nt;switch(st){case 0:return function(){return nt.call(ot)};case 1:return function(at){return nt.call(ot,at)};case 2:return function(at,lt){return nt.call(ot,at,lt)};case 3:return function(at,lt,ct){return nt.call(ot,at,lt,ct)}}return function(){return nt.apply(ot,arguments)}}},6782:function(et,it,tt){var rt=tt(6235),nt=tt(5744),ot=[].slice,st={},at=function(lt,ct,ht){if(!(ct in st)){for(var mt=[],dt=0;dt<ct;dt++)mt[dt]="a["+dt+"]";st[ct]=Function("C,a","return new C("+mt.join(",")+")")}return st[ct](lt,ht)};et.exports=Function.bind||function(lt){var ct=rt(this),ht=ot.call(arguments,1),mt=function(){var dt=ht.concat(ot.call(arguments));return this instanceof mt?at(ct,dt.length,dt):ct.apply(lt,dt)};return nt(ct.prototype)&&(mt.prototype=ct.prototype),mt}},2282:function(et,it,tt){var rt=tt(69),nt=tt(4500),ot=Function.prototype,st=rt&&Object.getOwnPropertyDescriptor,at=nt(ot,"name"),lt=at&&function(){}.name==="something",ct=at&&(!rt||rt&&st(ot,"name").configurable);et.exports={EXISTS:at,PROPER:lt,CONFIGURABLE:ct}},150:function(et,it,tt){var rt=tt(7545),nt=tt(8576),ot=tt(6447),st=function(at){return ot(at)?at:void 0};et.exports=function(at,lt){return arguments.length<2?st(rt[at])||st(nt[at]):rt[at]&&rt[at][lt]||nt[at]&&nt[at][lt]}},5037:function(et,it,tt){var rt=tt(6235);et.exports=function(nt,ot){var st=nt[ot];return st==null?void 0:rt(st)}},8576:function(et,it,tt){var rt=function(nt){return nt&&nt.Math==Math&&nt};et.exports=rt(typeof globalThis=="object"&&globalThis)||rt(typeof window=="object"&&window)||rt(typeof self=="object"&&self)||rt(typeof tt.g=="object"&&tt.g)||function(){return this}()||Function("return this")()},4500:function(et,it,tt){var rt=tt(1795),nt={}.hasOwnProperty;et.exports=Object.hasOwn||function(ot,st){return nt.call(rt(ot),st)}},4535:function(et){et.exports={}},7403:function(et,it,tt){var rt=tt(150);et.exports=rt("document","documentElement")},188:function(et,it,tt){var rt=tt(69),nt=tt(6192),ot=tt(7449);et.exports=!rt&&!nt(function(){return Object.defineProperty(ot("div"),"a",{get:function(){return 7}}).a!=7})},2202:function(et,it,tt){var rt=tt(6192),nt=tt(9272),ot="".split;et.exports=rt(function(){return!Object("z").propertyIsEnumerable(0)})?function(st){return nt(st)=="String"?ot.call(st,""):Object(st)}:Object},9516:function(et,it,tt){var rt=tt(6447),nt=tt(6434),ot=Function.toString;rt(nt.inspectSource)||(nt.inspectSource=function(st){return ot.call(st)}),et.exports=nt.inspectSource},3326:function(et,it,tt){var rt,nt,ot,st=tt(8921),at=tt(8576),lt=tt(5744),ct=tt(8711),ht=tt(4500),mt=tt(6434),dt=tt(9766),ft=tt(4535),ut="Object already initialized",pt=at.WeakMap;if(st||mt.state){var At=mt.state||(mt.state=new pt),gt=At.get,vt=At.has,yt=At.set;rt=function(Ct,xt){if(vt.call(At,Ct))throw new TypeError(ut);return xt.facade=Ct,yt.call(At,Ct,xt),xt},nt=function(Ct){return gt.call(At,Ct)||{}},ot=function(Ct){return vt.call(At,Ct)}}else{var bt=dt("state");ft[bt]=!0,rt=function(Ct,xt){if(ht(Ct,bt))throw new TypeError(ut);return xt.facade=Ct,ct(Ct,bt,xt),xt},nt=function(Ct){return ht(Ct,bt)?Ct[bt]:{}},ot=function(Ct){return ht(Ct,bt)}}et.exports={set:rt,get:nt,has:ot,enforce:function(Ct){return ot(Ct)?nt(Ct):rt(Ct,{})},getterFor:function(Ct){return function(xt){var It;if(!lt(xt)||(It=nt(xt)).type!==Ct)throw TypeError("Incompatible receiver, "+Ct+" required");return It}}}},4770:function(et,it,tt){var rt=tt(9272);et.exports=Array.isArray||function(nt){return rt(nt)=="Array"}},6447:function(et){et.exports=function(it){return typeof it=="function"}},2091:function(et,it,tt){var rt=tt(6192),nt=tt(6447),ot=tt(4696),st=tt(150),at=tt(9516),lt=[],ct=st("Reflect","construct"),ht=/^\s*(?:class|function)\b/,mt=ht.exec,dt=!ht.exec(function(){}),ft=function(ut){if(!nt(ut))return!1;try{return ct(Object,lt,ut),!0}catch{return!1}};et.exports=!ct||rt(function(){var ut;return ft(ft.call)||!ft(Object)||!ft(function(){ut=!0})||ut})?function(ut){if(!nt(ut))return!1;switch(ot(ut)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return dt||!!mt.call(ht,at(ut))}:ft},9245:function(et,it,tt){var rt=tt(6192),nt=tt(6447),ot=/#|\.prototype\./,st=function(mt,dt){var ft=lt[at(mt)];return ft==ht||ft!=ct&&(nt(dt)?rt(dt):!!dt)},at=st.normalize=function(mt){return String(mt).replace(ot,".").toLowerCase()},lt=st.data={},ct=st.NATIVE="N",ht=st.POLYFILL="P";et.exports=st},5744:function(et,it,tt){var rt=tt(6447);et.exports=function(nt){return typeof nt=="object"?nt!==null:rt(nt)}},5546:function(et){et.exports=!0},3236:function(et,it,tt){var rt=tt(6447),nt=tt(150),ot=tt(615);et.exports=ot?function(st){return typeof st=="symbol"}:function(st){var at=nt("Symbol");return rt(at)&&Object(st)instanceof at}},4413:function(et,it,tt){var rt,nt,ot,st=tt(6192),at=tt(6447),lt=tt(2853),ct=tt(9341),ht=tt(9482),mt=tt(8182),dt=tt(5546),ft=mt("iterator"),ut=!1;[].keys&&("next"in(ot=[].keys())?(nt=ct(ct(ot)))!==Object.prototype&&(rt=nt):ut=!0),rt==null||st(function(){var pt={};return rt[ft].call(pt)!==pt})?rt={}:dt&&(rt=lt(rt)),at(rt[ft])||ht(rt,ft,function(){return this}),et.exports={IteratorPrototype:rt,BUGGY_SAFARI_ITERATORS:ut}},7771:function(et){et.exports={}},4104:function(et,it,tt){var rt=tt(8445);et.exports=function(nt){return rt(nt.length)}},3045:function(et,it,tt){var rt=tt(4218),nt=tt(6192);et.exports=!!Object.getOwnPropertySymbols&&!nt(function(){var ot=Symbol();return!String(ot)||!(Object(ot)instanceof Symbol)||!Symbol.sham&&rt&&rt<41})},8921:function(et,it,tt){var rt=tt(8576),nt=tt(6447),ot=tt(9516),st=rt.WeakMap;et.exports=nt(st)&&/native code/.test(ot(st))},2853:function(et,it,tt){var rt,nt=tt(1138),ot=tt(1187),st=tt(2952),at=tt(4535),lt=tt(7403),ct=tt(7449),ht=tt(9766)("IE_PROTO"),mt=function(){},dt=function(pt){return"<script>"+pt+"<\/script>"},ft=function(pt){pt.write(dt("")),pt.close();var At=pt.parentWindow.Object;return pt=null,At},ut=function(){try{rt=new ActiveXObject("htmlfile")}catch{}var pt,At;ut=typeof document!="undefined"?document.domain&&rt?ft(rt):((At=ct("iframe")).style.display="none",lt.appendChild(At),At.src=String("javascript:"),(pt=At.contentWindow.document).open(),pt.write(dt("document.F=Object")),pt.close(),pt.F):ft(rt);for(var gt=st.length;gt--;)delete ut.prototype[st[gt]];return ut()};at[ht]=!0,et.exports=Object.create||function(pt,At){var gt;return pt!==null?(mt.prototype=nt(pt),gt=new mt,mt.prototype=null,gt[ht]=pt):gt=ut(),At===void 0?gt:ot(gt,At)}},1187:function(et,it,tt){var rt=tt(69),nt=tt(2760),ot=tt(1138),st=tt(7653);et.exports=rt?Object.defineProperties:function(at,lt){ot(at);for(var ct,ht=st(lt),mt=ht.length,dt=0;mt>dt;)nt.f(at,ct=ht[dt++],lt[ct]);return at}},2760:function(et,it,tt){var rt=tt(69),nt=tt(188),ot=tt(1138),st=tt(77),at=Object.defineProperty;it.f=rt?at:function(lt,ct,ht){if(ot(lt),ct=st(ct),ot(ht),nt)try{return at(lt,ct,ht)}catch{}if("get"in ht||"set"in ht)throw TypeError("Accessors not supported");return"value"in ht&&(lt[ct]=ht.value),lt}},5141:function(et,it,tt){var rt=tt(69),nt=tt(6007),ot=tt(774),st=tt(101),at=tt(77),lt=tt(4500),ct=tt(188),ht=Object.getOwnPropertyDescriptor;it.f=rt?ht:function(mt,dt){if(mt=st(mt),dt=at(dt),ct)try{return ht(mt,dt)}catch{}if(lt(mt,dt))return ot(!nt.f.call(mt,dt),mt[dt])}},4052:function(et,it,tt){var rt=tt(101),nt=tt(2092).f,ot={}.toString,st=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];et.exports.f=function(at){return st&&ot.call(at)=="[object Window]"?function(lt){try{return nt(lt)}catch{return st.slice()}}(at):nt(rt(at))}},2092:function(et,it,tt){var rt=tt(7934),nt=tt(2952).concat("length","prototype");it.f=Object.getOwnPropertyNames||function(ot){return rt(ot,nt)}},4750:function(et,it){it.f=Object.getOwnPropertySymbols},9341:function(et,it,tt){var rt=tt(4500),nt=tt(6447),ot=tt(1795),st=tt(9766),at=tt(4635),lt=st("IE_PROTO"),ct=Object.prototype;et.exports=at?Object.getPrototypeOf:function(ht){var mt=ot(ht);if(rt(mt,lt))return mt[lt];var dt=mt.constructor;return nt(dt)&&mt instanceof dt?dt.prototype:mt instanceof Object?ct:null}},7934:function(et,it,tt){var rt=tt(4500),nt=tt(101),ot=tt(8180).indexOf,st=tt(4535);et.exports=function(at,lt){var ct,ht=nt(at),mt=0,dt=[];for(ct in ht)!rt(st,ct)&&rt(ht,ct)&&dt.push(ct);for(;lt.length>mt;)rt(ht,ct=lt[mt++])&&(~ot(dt,ct)||dt.push(ct));return dt}},7653:function(et,it,tt){var rt=tt(7934),nt=tt(2952);et.exports=Object.keys||function(ot){return rt(ot,nt)}},6007:function(et,it){var tt={}.propertyIsEnumerable,rt=Object.getOwnPropertyDescriptor,nt=rt&&!tt.call({1:2},1);it.f=nt?function(ot){var st=rt(this,ot);return!!st&&st.enumerable}:tt},4469:function(et,it,tt){var rt=tt(1138),nt=tt(7757);et.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var ot,st=!1,at={};try{(ot=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(at,[]),st=at instanceof Array}catch{}return function(lt,ct){return rt(lt),nt(ct),st?ot.call(lt,ct):lt.__proto__=ct,lt}}():void 0)},158:function(et,it,tt){var rt=tt(3471),nt=tt(4696);et.exports=rt?{}.toString:function(){return"[object "+nt(this)+"]"}},380:function(et,it,tt){var rt=tt(6447),nt=tt(5744);et.exports=function(ot,st){var at,lt;if(st==="string"&&rt(at=ot.toString)&&!nt(lt=at.call(ot))||rt(at=ot.valueOf)&&!nt(lt=at.call(ot))||st!=="string"&&rt(at=ot.toString)&&!nt(lt=at.call(ot)))return lt;throw TypeError("Can't convert object to primitive value")}},3011:function(et,it,tt){var rt=tt(150),nt=tt(2092),ot=tt(4750),st=tt(1138);et.exports=rt("Reflect","ownKeys")||function(at){var lt=nt.f(st(at)),ct=ot.f;return ct?lt.concat(ct(at)):lt}},7545:function(et){et.exports={}},9482:function(et,it,tt){var rt=tt(8711);et.exports=function(nt,ot,st,at){at&&at.enumerable?nt[ot]=st:rt(nt,ot,st)}},3209:function(et){et.exports=function(it){if(it==null)throw TypeError("Can't call method on "+it);return it}},7613:function(et,it,tt){var rt=tt(8576);et.exports=function(nt,ot){try{Object.defineProperty(rt,nt,{value:ot,configurable:!0,writable:!0})}catch{rt[nt]=ot}return ot}},1284:function(et,it,tt){var rt=tt(3471),nt=tt(2760).f,ot=tt(8711),st=tt(4500),at=tt(158),lt=tt(8182)("toStringTag");et.exports=function(ct,ht,mt,dt){if(ct){var ft=mt?ct:ct.prototype;st(ft,lt)||nt(ft,lt,{configurable:!0,value:ht}),dt&&!rt&&ot(ft,"toString",at)}}},9766:function(et,it,tt){var rt=tt(8717),nt=tt(2759),ot=rt("keys");et.exports=function(st){return ot[st]||(ot[st]=nt(st))}},6434:function(et,it,tt){var rt=tt(8576),nt=tt(7613),ot="__core-js_shared__",st=rt[ot]||nt(ot,{});et.exports=st},8717:function(et,it,tt){var rt=tt(5546),nt=tt(6434);(et.exports=function(ot,st){return nt[ot]||(nt[ot]=st!==void 0?st:{})})("versions",[]).push({version:"3.18.2",mode:rt?"pure":"window",copyright:"\xA9 2021 Denis Pushkarev (zloirock.ru)"})},863:function(et,it,tt){var rt=tt(1941),nt=tt(4845),ot=tt(3209),st=function(at){return function(lt,ct){var ht,mt,dt=nt(ot(lt)),ft=rt(ct),ut=dt.length;return ft<0||ft>=ut?at?"":void 0:(ht=dt.charCodeAt(ft))<55296||ht>56319||ft+1===ut||(mt=dt.charCodeAt(ft+1))<56320||mt>57343?at?dt.charAt(ft):ht:at?dt.slice(ft,ft+2):mt-56320+(ht-55296<<10)+65536}};et.exports={codeAt:st(!1),charAt:st(!0)}},7739:function(et,it,tt){var rt=tt(1941),nt=Math.max,ot=Math.min;et.exports=function(st,at){var lt=rt(st);return lt<0?nt(lt+at,0):ot(lt,at)}},101:function(et,it,tt){var rt=tt(2202),nt=tt(3209);et.exports=function(ot){return rt(nt(ot))}},1941:function(et){var it=Math.ceil,tt=Math.floor;et.exports=function(rt){var nt=+rt;return nt!=nt||nt===0?0:(nt>0?tt:it)(nt)}},8445:function(et,it,tt){var rt=tt(1941),nt=Math.min;et.exports=function(ot){return ot>0?nt(rt(ot),9007199254740991):0}},1795:function(et,it,tt){var rt=tt(3209);et.exports=function(nt){return Object(rt(nt))}},7888:function(et,it,tt){var rt=tt(5744),nt=tt(3236),ot=tt(5037),st=tt(380),at=tt(8182)("toPrimitive");et.exports=function(lt,ct){if(!rt(lt)||nt(lt))return lt;var ht,mt=ot(lt,at);if(mt){if(ct===void 0&&(ct="default"),ht=mt.call(lt,ct),!rt(ht)||nt(ht))return ht;throw TypeError("Can't convert object to primitive value")}return ct===void 0&&(ct="number"),st(lt,ct)}},77:function(et,it,tt){var rt=tt(7888),nt=tt(3236);et.exports=function(ot){var st=rt(ot,"string");return nt(st)?st:String(st)}},3471:function(et,it,tt){var rt={};rt[tt(8182)("toStringTag")]="z",et.exports=String(rt)==="[object z]"},4845:function(et,it,tt){var rt=tt(4696);et.exports=function(nt){if(rt(nt)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return String(nt)}},9288:function(et){et.exports=function(it){try{return String(it)}catch{return"Object"}}},2759:function(et){var it=0,tt=Math.random();et.exports=function(rt){return"Symbol("+String(rt===void 0?"":rt)+")_"+(++it+tt).toString(36)}},615:function(et,it,tt){var rt=tt(3045);et.exports=rt&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},9207:function(et,it,tt){var rt=tt(8182);it.f=rt},8182:function(et,it,tt){var rt=tt(8576),nt=tt(8717),ot=tt(4500),st=tt(2759),at=tt(3045),lt=tt(615),ct=nt("wks"),ht=rt.Symbol,mt=lt?ht:ht&&ht.withoutSetter||st;et.exports=function(dt){return ot(ct,dt)&&(at||typeof ct[dt]=="string")||(at&&ot(ht,dt)?ct[dt]=ht[dt]:ct[dt]=mt("Symbol."+dt)),ct[dt]}},9106:function(et,it,tt){var rt=tt(3085),nt=tt(6192),ot=tt(4770),st=tt(5744),at=tt(1795),lt=tt(4104),ct=tt(9361),ht=tt(1321),mt=tt(242),dt=tt(8182),ft=tt(4218),ut=dt("isConcatSpreadable"),pt=9007199254740991,At="Maximum allowed index exceeded",gt=ft>=51||!nt(function(){var bt=[];return bt[ut]=!1,bt.concat()[0]!==bt}),vt=mt("concat"),yt=function(bt){if(!st(bt))return!1;var Ct=bt[ut];return Ct!==void 0?!!Ct:ot(bt)};rt({target:"Array",proto:!0,forced:!gt||!vt},{concat:function(bt){var Ct,xt,It,St,Ot,Mt=at(this),jt=ht(Mt,0),Ft=0;for(Ct=-1,It=arguments.length;Ct<It;Ct++)if(yt(Ot=Ct===-1?Mt:arguments[Ct])){if(Ft+(St=lt(Ot))>pt)throw TypeError(At);for(xt=0;xt<St;xt++,Ft++)xt in Ot&&ct(jt,Ft,Ot[xt])}else{if(Ft>=pt)throw TypeError(At);ct(jt,Ft++,Ot)}return jt.length=Ft,jt}})},3436:function(et,it,tt){var rt=tt(3085),nt=tt(454).filter;rt({target:"Array",proto:!0,forced:!tt(242)("filter")},{filter:function(ot){return nt(this,ot,arguments.length>1?arguments[1]:void 0)}})},8939:function(et,it,tt){var rt=tt(101),nt=tt(7423),ot=tt(7771),st=tt(3326),at=tt(7218),lt="Array Iterator",ct=st.set,ht=st.getterFor(lt);et.exports=at(Array,"Array",function(mt,dt){ct(this,{type:lt,target:rt(mt),index:0,kind:dt})},function(){var mt=ht(this),dt=mt.target,ft=mt.kind,ut=mt.index++;return!dt||ut>=dt.length?(mt.target=void 0,{value:void 0,done:!0}):ft=="keys"?{value:ut,done:!1}:ft=="values"?{value:dt[ut],done:!1}:{value:[ut,dt[ut]],done:!1}},"values"),ot.Arguments=ot.Array,nt("keys"),nt("values"),nt("entries")},5818:function(et,it,tt){var rt=tt(3085),nt=tt(4770),ot=tt(2091),st=tt(5744),at=tt(7739),lt=tt(4104),ct=tt(101),ht=tt(9361),mt=tt(8182),dt=tt(242)("slice"),ft=mt("species"),ut=[].slice,pt=Math.max;rt({target:"Array",proto:!0,forced:!dt},{slice:function(At,gt){var vt,yt,bt,Ct=ct(this),xt=lt(Ct),It=at(At,xt),St=at(gt===void 0?xt:gt,xt);if(nt(Ct)&&(vt=Ct.constructor,(ot(vt)&&(vt===Array||nt(vt.prototype))||st(vt)&&(vt=vt[ft])===null)&&(vt=void 0),vt===Array||vt===void 0))return ut.call(Ct,It,St);for(yt=new(vt===void 0?Array:vt)(pt(St-It,0)),bt=0;It<St;It++,bt++)It in Ct&&ht(yt,bt,Ct[It]);return yt.length=bt,yt}})},8671:function(et,it,tt){var rt=tt(8576);tt(1284)(rt.JSON,"JSON",!0)},8556:function(){},3113:function(et,it,tt){tt(3085)({target:"Object",stat:!0,sham:!tt(69)},{create:tt(2853)})},297:function(et,it,tt){var rt=tt(3085),nt=tt(69);rt({target:"Object",stat:!0,forced:!nt,sham:!nt},{defineProperty:tt(2760).f})},9189:function(et,it,tt){var rt=tt(3085),nt=tt(6192),ot=tt(101),st=tt(5141).f,at=tt(69),lt=nt(function(){st(1)});rt({target:"Object",stat:!0,forced:!at||lt,sham:!at},{getOwnPropertyDescriptor:function(ct,ht){return st(ot(ct),ht)}})},2509:function(et,it,tt){var rt=tt(3085),nt=tt(69),ot=tt(3011),st=tt(101),at=tt(5141),lt=tt(9361);rt({target:"Object",stat:!0,sham:!nt},{getOwnPropertyDescriptors:function(ct){for(var ht,mt,dt=st(ct),ft=at.f,ut=ot(dt),pt={},At=0;ut.length>At;)(mt=ft(dt,ht=ut[At++]))!==void 0&&lt(pt,ht,mt);return pt}})},9234:function(et,it,tt){var rt=tt(3085),nt=tt(6192),ot=tt(1795),st=tt(9341),at=tt(4635);rt({target:"Object",stat:!0,forced:nt(function(){st(1)}),sham:!at},{getPrototypeOf:function(lt){return st(ot(lt))}})},2647:function(et,it,tt){var rt=tt(3085),nt=tt(1795),ot=tt(7653);rt({target:"Object",stat:!0,forced:tt(6192)(function(){ot(1)})},{keys:function(st){return ot(nt(st))}})},3222:function(et,it,tt){tt(3085)({target:"Object",stat:!0},{setPrototypeOf:tt(4469)})},6663:function(){},5397:function(et,it,tt){var rt=tt(3085),nt=tt(150),ot=tt(1404),st=tt(1138),at=tt(5744),lt=tt(2853),ct=tt(6782),ht=tt(6192),mt=nt("Reflect","construct"),dt=ht(function(){function pt(){}return!(mt(function(){},[],pt)instanceof pt)}),ft=!ht(function(){mt(function(){})}),ut=dt||ft;rt({target:"Reflect",stat:!0,forced:ut,sham:ut},{construct:function(pt,At){ot(pt),st(At);var gt=arguments.length<3?pt:ot(arguments[2]);if(ft&&!dt)return mt(pt,At,gt);if(pt==gt){switch(At.length){case 0:return new pt;case 1:return new pt(At[0]);case 2:return new pt(At[0],At[1]);case 3:return new pt(At[0],At[1],At[2]);case 4:return new pt(At[0],At[1],At[2],At[3])}var vt=[null];return vt.push.apply(vt,At),new(ct.apply(pt,vt))}var yt=gt.prototype,bt=lt(at(yt)?yt:Object.prototype),Ct=Function.apply.call(pt,bt,At);return at(Ct)?Ct:bt}})},1367:function(){},5454:function(et,it,tt){var rt=tt(863).charAt,nt=tt(4845),ot=tt(3326),st=tt(7218),at="String Iterator",lt=ot.set,ct=ot.getterFor(at);st(String,"String",function(ht){lt(this,{type:at,string:nt(ht),index:0})},function(){var ht,mt=ct(this),dt=mt.string,ft=mt.index;return ft>=dt.length?{value:void 0,done:!0}:(ht=rt(dt,ft),mt.index+=ht.length,{value:ht,done:!1})})},9781:function(et,it,tt){tt(1488)("asyncIterator")},492:function(){},6681:function(et,it,tt){tt(1488)("hasInstance")},9594:function(et,it,tt){tt(1488)("isConcatSpreadable")},3665:function(et,it,tt){tt(1488)("iterator")},6187:function(et,it,tt){var rt=tt(3085),nt=tt(8576),ot=tt(150),st=tt(5546),at=tt(69),lt=tt(3045),ct=tt(6192),ht=tt(4500),mt=tt(4770),dt=tt(6447),ft=tt(5744),ut=tt(3236),pt=tt(1138),At=tt(1795),gt=tt(101),vt=tt(77),yt=tt(4845),bt=tt(774),Ct=tt(2853),xt=tt(7653),It=tt(2092),St=tt(4052),Ot=tt(4750),Mt=tt(5141),jt=tt(2760),Ft=tt(6007),Ut=tt(9482),Qt=tt(8717),Ht=tt(9766),Zt=tt(4535),Wt=tt(2759),$t=tt(8182),Jt=tt(9207),Nt=tt(1488),Lt=tt(1284),Kt=tt(3326),Pt=tt(454).forEach,ln=Ht("hidden"),Gt="Symbol",on=$t("toPrimitive"),tn=Kt.set,_i=Kt.getterFor(Gt),Xt=Object.prototype,Vt=nt.Symbol,qt=ot("JSON","stringify"),rn=Mt.f,nn=jt.f,cn=St.f,un=Ft.f,gn=Qt("symbols"),mn=Qt("op-symbols"),dn=Qt("string-to-symbol-registry"),fn=Qt("symbol-to-string-registry"),sn=Qt("wks"),pn=nt.QObject,bn=!pn||!pn.prototype||!pn.prototype.findChild,An=at&&ct(function(){return Ct(nn({},"a",{get:function(){return nn(this,"a",{value:7}).a}})).a!=7})?function(Qn,Bn,xn){var Wn=rn(Xt,Bn);Wn&&delete Xt[Bn],nn(Qn,Bn,xn),Wn&&Qn!==Xt&&nn(Xt,Bn,Wn)}:nn,Sn=function(Qn,Bn){var xn=gn[Qn]=Ct(Vt.prototype);return tn(xn,{type:Gt,tag:Qn,description:Bn}),at||(xn.description=Bn),xn},En=function(Qn,Bn,xn){Qn===Xt&&En(mn,Bn,xn),pt(Qn);var Wn=vt(Bn);return pt(xn),ht(gn,Wn)?(xn.enumerable?(ht(Qn,ln)&&Qn[ln][Wn]&&(Qn[ln][Wn]=!1),xn=Ct(xn,{enumerable:bt(0,!1)})):(ht(Qn,ln)||nn(Qn,ln,bt(1,{})),Qn[ln][Wn]=!0),An(Qn,Wn,xn)):nn(Qn,Wn,xn)},Vn=function(Qn,Bn){pt(Qn);var xn=gt(Bn),Wn=xt(xn).concat(Tn(xn));return Pt(Wn,function(qn){at&&!Rn.call(xn,qn)||En(Qn,qn,xn[qn])}),Qn},Rn=function(Qn){var Bn=vt(Qn),xn=un.call(this,Bn);return!(this===Xt&&ht(gn,Bn)&&!ht(mn,Bn))&&(!(xn||!ht(this,Bn)||!ht(gn,Bn)||ht(this,ln)&&this[ln][Bn])||xn)},In=function(Qn,Bn){var xn=gt(Qn),Wn=vt(Bn);if(xn!==Xt||!ht(gn,Wn)||ht(mn,Wn)){var qn=rn(xn,Wn);return!qn||!ht(gn,Wn)||ht(xn,ln)&&xn[ln][Wn]||(qn.enumerable=!0),qn}},zn=function(Qn){var Bn=cn(gt(Qn)),xn=[];return Pt(Bn,function(Wn){ht(gn,Wn)||ht(Zt,Wn)||xn.push(Wn)}),xn},Tn=function(Qn){var Bn=Qn===Xt,xn=cn(Bn?mn:gt(Qn)),Wn=[];return Pt(xn,function(qn){!ht(gn,qn)||Bn&&!ht(Xt,qn)||Wn.push(gn[qn])}),Wn};if(lt||(Vt=function(){if(this instanceof Vt)throw TypeError("Symbol is not a constructor");var Qn=arguments.length&&arguments[0]!==void 0?yt(arguments[0]):void 0,Bn=Wt(Qn),xn=function(Wn){this===Xt&&xn.call(mn,Wn),ht(this,ln)&&ht(this[ln],Bn)&&(this[ln][Bn]=!1),An(this,Bn,bt(1,Wn))};return at&&bn&&An(Xt,Bn,{configurable:!0,set:xn}),Sn(Bn,Qn)},Ut(Vt.prototype,"toString",function(){return _i(this).tag}),Ut(Vt,"withoutSetter",function(Qn){return Sn(Wt(Qn),Qn)}),Ft.f=Rn,jt.f=En,Mt.f=In,It.f=St.f=zn,Ot.f=Tn,Jt.f=function(Qn){return Sn($t(Qn),Qn)},at&&(nn(Vt.prototype,"description",{configurable:!0,get:function(){return _i(this).description}}),st||Ut(Xt,"propertyIsEnumerable",Rn,{unsafe:!0}))),rt({window:!0,wrap:!0,forced:!lt,sham:!lt},{Symbol:Vt}),Pt(xt(sn),function(Qn){Nt(Qn)}),rt({target:Gt,stat:!0,forced:!lt},{for:function(Qn){var Bn=yt(Qn);if(ht(dn,Bn))return dn[Bn];var xn=Vt(Bn);return dn[Bn]=xn,fn[xn]=Bn,xn},keyFor:function(Qn){if(!ut(Qn))throw TypeError(Qn+" is not a symbol");if(ht(fn,Qn))return fn[Qn]},useSetter:function(){bn=!0},useSimple:function(){bn=!1}}),rt({target:"Object",stat:!0,forced:!lt,sham:!at},{create:function(Qn,Bn){return Bn===void 0?Ct(Qn):Vn(Ct(Qn),Bn)},defineProperty:En,defineProperties:Vn,getOwnPropertyDescriptor:In}),rt({target:"Object",stat:!0,forced:!lt},{getOwnPropertyNames:zn,getOwnPropertySymbols:Tn}),rt({target:"Object",stat:!0,forced:ct(function(){Ot.f(1)})},{getOwnPropertySymbols:function(Qn){return Ot.f(At(Qn))}}),qt&&rt({target:"JSON",stat:!0,forced:!lt||ct(function(){var Qn=Vt();return qt([Qn])!="[null]"||qt({a:Qn})!="{}"||qt(Object(Qn))!="{}"})},{stringify:function(Qn,Bn,xn){for(var Wn,qn=[Qn],nr=1;arguments.length>nr;)qn.push(arguments[nr++]);if(Wn=Bn,(ft(Bn)||Qn!==void 0)&&!ut(Qn))return mt(Bn)||(Bn=function(On,jn){if(dt(Wn)&&(jn=Wn.call(this,On,jn)),!ut(jn))return jn}),qn[1]=Bn,qt.apply(null,qn)}}),!Vt.prototype[on]){var tr=Vt.prototype.valueOf;Ut(Vt.prototype,on,function(){return tr.apply(this,arguments)})}Lt(Vt,Gt),Zt[ln]=!0},1250:function(et,it,tt){tt(1488)("matchAll")},9017:function(et,it,tt){tt(1488)("match")},9786:function(et,it,tt){tt(1488)("replace")},503:function(et,it,tt){tt(1488)("search")},6565:function(et,it,tt){tt(1488)("species")},9322:function(et,it,tt){tt(1488)("split")},3610:function(et,it,tt){tt(1488)("toPrimitive")},6886:function(et,it,tt){tt(1488)("toStringTag")},3514:function(et,it,tt){tt(1488)("unscopables")},177:function(et,it,tt){tt(1488)("asyncDispose")},9031:function(et,it,tt){tt(1488)("dispose")},6658:function(et,it,tt){tt(1488)("matcher")},1875:function(et,it,tt){tt(1488)("metadata")},8658:function(et,it,tt){tt(1488)("observable")},4592:function(et,it,tt){tt(1488)("patternMatch")},6680:function(et,it,tt){tt(1488)("replaceAll")},162:function(et,it,tt){tt(8939);var rt=tt(7365),nt=tt(8576),ot=tt(4696),st=tt(8711),at=tt(7771),lt=tt(8182)("toStringTag");for(var ct in rt){var ht=nt[ct],mt=ht&&ht.prototype;mt&&ot(mt)!==lt&&st(mt,lt,ct),at[ct]=at.Array}},4877:function(et,it,tt){var rt=tt(1484);et.exports=rt},5603:function(et,it,tt){var rt=tt(3669);et.exports=rt},4741:function(et,it,tt){var rt=tt(7663);et.exports=rt},4963:function(et,it,tt){var rt=tt(3213);et.exports=rt},7820:function(et,it,tt){var rt=tt(3512);et.exports=rt},4194:function(et,it,tt){var rt=tt(632);et.exports=rt},2854:function(et,it,tt){var rt=tt(1056);et.exports=rt},2:function(et,it,tt){var rt=tt(2921);et.exports=rt},8980:function(et,it,tt){var rt=tt(8168);et.exports=rt},5636:function(et,it,tt){var rt=tt(8651);et.exports=rt},6672:function(et,it,tt){var rt=tt(3083);et.exports=rt},5279:function(et,it,tt){var rt=tt(6577);et.exports=rt},2285:function(et,it,tt){var rt=tt(5008);tt(162),et.exports=rt},8535:function(et,it,tt){var rt=tt(994);tt(162),et.exports=rt}},s={};function _(et){var it=s[et];if(it!==void 0)return it.exports;var tt=s[et]={exports:{}};return o[et](tt,tt.exports,_),tt.exports}_.n=function(et){var it=et&&et.__esModule?function(){return et.default}:function(){return et};return _.d(it,{a:it}),it},_.d=function(et,it){for(var tt in it)_.o(it,tt)&&!_.o(et,tt)&&Object.defineProperty(et,tt,{enumerable:!0,get:it[tt]})},_.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),_.o=function(et,it){return Object.prototype.hasOwnProperty.call(et,it)},_.r=function(et){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(et,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(et,"__esModule",{value:!0})};var _e={};(function(){_.r(_e),_.d(_e,{default:function(){return Jt}});var et=_(9146),it=_.n(et),tt=_(651),rt=_.n(tt),nt=_(7870),ot=_.n(nt),st=_(7601),at=_.n(st);function lt(Nt,Lt){if(!(Nt instanceof Lt))throw new TypeError("Cannot call a class as a function")}var ct=_(7077);function ht(Nt,Lt){for(var Kt=0;Kt<Lt.length;Kt++){var Pt=Lt[Kt];Pt.enumerable=Pt.enumerable||!1,Pt.configurable=!0,"value"in Pt&&(Pt.writable=!0),ct(Nt,Pt.key,Pt)}}function mt(Nt){if(Nt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Nt}var dt=_(6623),ft=_(4230);function ut(Nt,Lt){return ut=ft||function(Kt,Pt){return Kt.__proto__=Pt,Kt},ut(Nt,Lt)}var pt=_(184),At=_(3742);function gt(Nt){return gt=typeof pt=="function"&&typeof At=="symbol"?function(Lt){return typeof Lt}:function(Lt){return Lt&&typeof pt=="function"&&Lt.constructor===pt&&Lt!==pt.prototype?"symbol":typeof Lt},gt(Nt)}function vt(Nt,Lt){if(Lt&&(gt(Lt)==="object"||typeof Lt=="function"))return Lt;if(Lt!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mt(Nt)}var yt=_(9856);function bt(Nt){return bt=ft?yt:function(Lt){return Lt.__proto__||yt(Lt)},bt(Nt)}function Ct(Nt,Lt,Kt){return Lt in Nt?ct(Nt,Lt,{value:Kt,enumerable:!0,configurable:!0,writable:!0}):Nt[Lt]=Kt,Nt}var xt=_(9406),It=_.n(xt),St=_(381),Ot=_.n(St),Mt=_(2461),jt=_.n(Mt),Ft=_(8005),Ut=_.n(Ft),Qt=react.exports,Ht=_.n(Qt),Zt=tuiImageEditor.exports,Wt=_.n(Zt);function $t(Nt,Lt){var Kt=jt()(Nt);if(rt()){var Pt=rt()(Nt);Lt&&(Pt=Ot()(Pt).call(Pt,function(ln){return ot()(Nt,ln).enumerable})),Kt.push.apply(Kt,Pt)}return Kt}var Jt=function(Nt){(function(tn,_i){if(typeof _i!="function"&&_i!==null)throw new TypeError("Super expression must either be null or a function");tn.prototype=dt(_i&&_i.prototype,{constructor:{value:tn,writable:!0,configurable:!0}}),_i&&ut(tn,_i)})(on,Nt);var Lt,Kt,Pt,ln,Gt=(Pt=on,ln=function(){if(typeof Reflect=="undefined"||!it()||it().sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(it()(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var tn,_i=bt(Pt);if(ln){var Xt=bt(this).constructor;tn=it()(_i,arguments,Xt)}else tn=_i.apply(this,arguments);return vt(this,tn)});function on(){var tn,_i;lt(this,on);for(var Xt=arguments.length,Vt=new Array(Xt),qt=0;qt<Xt;qt++)Vt[qt]=arguments[qt];return Ct(mt(_i=Gt.call.apply(Gt,It()(tn=[this]).call(tn,Vt))),"rootEl",Ht().createRef()),Ct(mt(_i),"imageEditorInst",null),_i}return Lt=on,Kt=[{key:"componentDidMount",value:function(){this.imageEditorInst=new(Wt())(this.rootEl.current,function(tn){for(var _i=1;_i<arguments.length;_i++){var Xt=arguments[_i]!=null?arguments[_i]:{};_i%2?$t(Object(Xt),!0).forEach(function(Vt){Ct(tn,Vt,Xt[Vt])}):at()?Object.defineProperties(tn,at()(Xt)):$t(Object(Xt)).forEach(function(Vt){Object.defineProperty(tn,Vt,ot()(Xt,Vt))})}return tn}({},this.props)),this.bindEventHandlers(this.props)}},{key:"componentWillUnmount",value:function(){this.unbindEventHandlers(),this.imageEditorInst.destroy(),this.imageEditorInst=null}},{key:"shouldComponentUpdate",value:function(tn){return this.bindEventHandlers(this.props,tn),!1}},{key:"getInstance",value:function(){return this.imageEditorInst}},{key:"getRootElement",value:function(){return this.rootEl.current}},{key:"bindEventHandlers",value:function(tn,_i){var Xt,Vt=this;Ot()(Xt=jt()(tn)).call(Xt,this.isEventHandlerKeys).forEach(function(qt){var rn=qt[2].toLowerCase()+Ut()(qt).call(qt,3);_i&&_i[qt]!==tn[qt]&&Vt.imageEditorInst.off(rn),Vt.imageEditorInst.on(rn,tn[qt])})}},{key:"unbindEventHandlers",value:function(){var tn,_i=this;Ot()(tn=jt()(this.props)).call(tn,this.isEventHandlerKeys).forEach(function(Xt){var Vt=Xt[2].toLowerCase()+Ut()(Xt).call(Xt,3);_i.imageEditorInst.off(Vt)})}},{key:"isEventHandlerKeys",value:function(tn){return/on[A-Z][a-zA-Z]+/.test(tn)}},{key:"render",value:function(){return Ht().createElement("div",{ref:this.rootEl})}}],Kt&&ht(Lt.prototype,Kt),on}(Ht().Component)})(),toastuiReactImageEditor.exports=_e})();var ImageEditor=toastuiReactImageEditor.exports;/*!
 * Cropper.js v1.5.12
 * https://fengyuanchen.github.io/cropperjs
 *
 * Copyright 2015-present Chen Fengyuan
 * Released under the MIT license
 *
 * Date: 2021-06-12T08:00:17.411Z
 */function ownKeys(o,s){var _=Object.keys(o);if(Object.getOwnPropertySymbols){var _e=Object.getOwnPropertySymbols(o);s&&(_e=_e.filter(function(et){return Object.getOwnPropertyDescriptor(o,et).enumerable})),_.push.apply(_,_e)}return _}function _objectSpread2(o){for(var s=1;s<arguments.length;s++){var _=arguments[s]!=null?arguments[s]:{};s%2?ownKeys(Object(_),!0).forEach(function(_e){_defineProperty$1(o,_e,_[_e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach(function(_e){Object.defineProperty(o,_e,Object.getOwnPropertyDescriptor(_,_e))})}return o}function _typeof(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(s){return typeof s}:_typeof=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},_typeof(o)}function _classCallCheck(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}function _defineProperties(o,s){for(var _=0;_<s.length;_++){var _e=s[_];_e.enumerable=_e.enumerable||!1,_e.configurable=!0,"value"in _e&&(_e.writable=!0),Object.defineProperty(o,_e.key,_e)}}function _createClass(o,s,_){return s&&_defineProperties(o.prototype,s),_&&_defineProperties(o,_),o}function _defineProperty$1(o,s,_){return s in o?Object.defineProperty(o,s,{value:_,enumerable:!0,configurable:!0,writable:!0}):o[s]=_,o}function _toConsumableArray(o){return _arrayWithoutHoles(o)||_iterableToArray$1(o)||_unsupportedIterableToArray(o)||_nonIterableSpread()}function _arrayWithoutHoles(o){if(Array.isArray(o))return _arrayLikeToArray(o)}function _iterableToArray$1(o){if(typeof Symbol!="undefined"&&o[Symbol.iterator]!=null||o["@@iterator"]!=null)return Array.from(o)}function _unsupportedIterableToArray(o,s){if(!!o){if(typeof o=="string")return _arrayLikeToArray(o,s);var _=Object.prototype.toString.call(o).slice(8,-1);if(_==="Object"&&o.constructor&&(_=o.constructor.name),_==="Map"||_==="Set")return Array.from(o);if(_==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_))return _arrayLikeToArray(o,s)}}function _arrayLikeToArray(o,s){(s==null||s>o.length)&&(s=o.length);for(var _=0,_e=new Array(s);_<s;_++)_e[_]=o[_];return _e}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var IS_BROWSER=typeof window!="undefined"&&typeof window.document!="undefined",WINDOW=IS_BROWSER?window:{},IS_TOUCH_DEVICE=IS_BROWSER&&WINDOW.document.documentElement?"ontouchstart"in WINDOW.document.documentElement:!1,HAS_POINTER_EVENT=IS_BROWSER?"PointerEvent"in WINDOW:!1,NAMESPACE="cropper",ACTION_ALL="all",ACTION_CROP="crop",ACTION_MOVE="move",ACTION_ZOOM="zoom",ACTION_EAST="e",ACTION_WEST="w",ACTION_SOUTH="s",ACTION_NORTH="n",ACTION_NORTH_EAST="ne",ACTION_NORTH_WEST="nw",ACTION_SOUTH_EAST="se",ACTION_SOUTH_WEST="sw",CLASS_CROP="".concat(NAMESPACE,"-crop"),CLASS_DISABLED="".concat(NAMESPACE,"-disabled"),CLASS_HIDDEN="".concat(NAMESPACE,"-hidden"),CLASS_HIDE="".concat(NAMESPACE,"-hide"),CLASS_INVISIBLE="".concat(NAMESPACE,"-invisible"),CLASS_MODAL="".concat(NAMESPACE,"-modal"),CLASS_MOVE="".concat(NAMESPACE,"-move"),DATA_ACTION="".concat(NAMESPACE,"Action"),DATA_PREVIEW="".concat(NAMESPACE,"Preview"),DRAG_MODE_CROP="crop",DRAG_MODE_MOVE="move",DRAG_MODE_NONE="none",EVENT_CROP="crop",EVENT_CROP_END="cropend",EVENT_CROP_MOVE="cropmove",EVENT_CROP_START="cropstart",EVENT_DBLCLICK="dblclick",EVENT_TOUCH_START=IS_TOUCH_DEVICE?"touchstart":"mousedown",EVENT_TOUCH_MOVE=IS_TOUCH_DEVICE?"touchmove":"mousemove",EVENT_TOUCH_END=IS_TOUCH_DEVICE?"touchend touchcancel":"mouseup",EVENT_POINTER_DOWN=HAS_POINTER_EVENT?"pointerdown":EVENT_TOUCH_START,EVENT_POINTER_MOVE=HAS_POINTER_EVENT?"pointermove":EVENT_TOUCH_MOVE,EVENT_POINTER_UP=HAS_POINTER_EVENT?"pointerup pointercancel":EVENT_TOUCH_END,EVENT_READY="ready",EVENT_RESIZE="resize",EVENT_WHEEL="wheel",EVENT_ZOOM="zoom",MIME_TYPE_JPEG="image/jpeg",REGEXP_ACTIONS=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,REGEXP_DATA_URL=/^data:/,REGEXP_DATA_URL_JPEG=/^data:image\/jpeg;base64,/,REGEXP_TAG_NAME=/^img|canvas$/i,MIN_CONTAINER_WIDTH=200,MIN_CONTAINER_HEIGHT=100,DEFAULTS={viewMode:0,dragMode:DRAG_MODE_CROP,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:MIN_CONTAINER_WIDTH,minContainerHeight:MIN_CONTAINER_HEIGHT,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},TEMPLATE='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',isNaN$1=Number.isNaN||WINDOW.isNaN;function isNumber$1(o){return typeof o=="number"&&!isNaN$1(o)}var isPositiveNumber=function o(s){return s>0&&s<1/0};function isUndefined(o){return typeof o=="undefined"}function isObject$1(o){return _typeof(o)==="object"&&o!==null}var hasOwnProperty=Object.prototype.hasOwnProperty;function isPlainObject(o){if(!isObject$1(o))return!1;try{var s=o.constructor,_=s.prototype;return s&&_&&hasOwnProperty.call(_,"isPrototypeOf")}catch{return!1}}function isFunction$1(o){return typeof o=="function"}var slice=Array.prototype.slice;function toArray(o){return Array.from?Array.from(o):slice.call(o)}function forEach(o,s){return o&&isFunction$1(s)&&(Array.isArray(o)||isNumber$1(o.length)?toArray(o).forEach(function(_,_e){s.call(o,_,_e,o)}):isObject$1(o)&&Object.keys(o).forEach(function(_){s.call(o,o[_],_,o)})),o}var assign=Object.assign||function o(s){for(var _=arguments.length,_e=new Array(_>1?_-1:0),et=1;et<_;et++)_e[et-1]=arguments[et];return isObject$1(s)&&_e.length>0&&_e.forEach(function(it){isObject$1(it)&&Object.keys(it).forEach(function(tt){s[tt]=it[tt]})}),s},REGEXP_DECIMALS=/\.\d*(?:0|9){12}\d*$/;function normalizeDecimalNumber(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return REGEXP_DECIMALS.test(o)?Math.round(o*s)/s:o}var REGEXP_SUFFIX=/^width|height|left|top|marginLeft|marginTop$/;function setStyle$1(o,s){var _=o.style;forEach(s,function(_e,et){REGEXP_SUFFIX.test(et)&&isNumber$1(_e)&&(_e="".concat(_e,"px")),_[et]=_e})}function hasClass(o,s){return o.classList?o.classList.contains(s):o.className.indexOf(s)>-1}function addClass(o,s){if(!!s){if(isNumber$1(o.length)){forEach(o,function(_e){addClass(_e,s)});return}if(o.classList){o.classList.add(s);return}var _=o.className.trim();_?_.indexOf(s)<0&&(o.className="".concat(_," ").concat(s)):o.className=s}}function removeClass(o,s){if(!!s){if(isNumber$1(o.length)){forEach(o,function(_){removeClass(_,s)});return}if(o.classList){o.classList.remove(s);return}o.className.indexOf(s)>=0&&(o.className=o.className.replace(s,""))}}function toggleClass(o,s,_){if(!!s){if(isNumber$1(o.length)){forEach(o,function(_e){toggleClass(_e,s,_)});return}_?addClass(o,s):removeClass(o,s)}}var REGEXP_CAMEL_CASE=/([a-z\d])([A-Z])/g;function toParamCase(o){return o.replace(REGEXP_CAMEL_CASE,"$1-$2").toLowerCase()}function getData(o,s){return isObject$1(o[s])?o[s]:o.dataset?o.dataset[s]:o.getAttribute("data-".concat(toParamCase(s)))}function setData(o,s,_){isObject$1(_)?o[s]=_:o.dataset?o.dataset[s]=_:o.setAttribute("data-".concat(toParamCase(s)),_)}function removeData(o,s){if(isObject$1(o[s]))try{delete o[s]}catch{o[s]=void 0}else if(o.dataset)try{delete o.dataset[s]}catch{o.dataset[s]=void 0}else o.removeAttribute("data-".concat(toParamCase(s)))}var REGEXP_SPACES=/\s\s*/,onceSupported=function(){var o=!1;if(IS_BROWSER){var s=!1,_=function(){},_e=Object.defineProperty({},"once",{get:function(){return o=!0,s},set:function(it){s=it}});WINDOW.addEventListener("test",_,_e),WINDOW.removeEventListener("test",_,_e)}return o}();function removeListener$1(o,s,_){var _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},et=_;s.trim().split(REGEXP_SPACES).forEach(function(it){if(!onceSupported){var tt=o.listeners;tt&&tt[it]&&tt[it][_]&&(et=tt[it][_],delete tt[it][_],Object.keys(tt[it]).length===0&&delete tt[it],Object.keys(tt).length===0&&delete o.listeners)}o.removeEventListener(it,et,_e)})}function addListener$1(o,s,_){var _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},et=_;s.trim().split(REGEXP_SPACES).forEach(function(it){if(_e.once&&!onceSupported){var tt=o.listeners,rt=tt===void 0?{}:tt;et=function(){delete rt[it][_],o.removeEventListener(it,et,_e);for(var ot=arguments.length,st=new Array(ot),at=0;at<ot;at++)st[at]=arguments[at];_.apply(o,st)},rt[it]||(rt[it]={}),rt[it][_]&&o.removeEventListener(it,rt[it][_],_e),rt[it][_]=et,o.listeners=rt}o.addEventListener(it,et,_e)})}function dispatchEvent(o,s,_){var _e;return isFunction$1(Event)&&isFunction$1(CustomEvent)?_e=new CustomEvent(s,{detail:_,bubbles:!0,cancelable:!0}):(_e=document.createEvent("CustomEvent"),_e.initCustomEvent(s,!0,!0,_)),o.dispatchEvent(_e)}function getOffset(o){var s=o.getBoundingClientRect();return{left:s.left+(window.pageXOffset-document.documentElement.clientLeft),top:s.top+(window.pageYOffset-document.documentElement.clientTop)}}var location$1=WINDOW.location,REGEXP_ORIGINS=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function isCrossOriginURL(o){var s=o.match(REGEXP_ORIGINS);return s!==null&&(s[1]!==location$1.protocol||s[2]!==location$1.hostname||s[3]!==location$1.port)}function addTimestamp(o){var s="timestamp=".concat(new Date().getTime());return o+(o.indexOf("?")===-1?"?":"&")+s}function getTransforms(o){var s=o.rotate,_=o.scaleX,_e=o.scaleY,et=o.translateX,it=o.translateY,tt=[];isNumber$1(et)&&et!==0&&tt.push("translateX(".concat(et,"px)")),isNumber$1(it)&&it!==0&&tt.push("translateY(".concat(it,"px)")),isNumber$1(s)&&s!==0&&tt.push("rotate(".concat(s,"deg)")),isNumber$1(_)&&_!==1&&tt.push("scaleX(".concat(_,")")),isNumber$1(_e)&&_e!==1&&tt.push("scaleY(".concat(_e,")"));var rt=tt.length?tt.join(" "):"none";return{WebkitTransform:rt,msTransform:rt,transform:rt}}function getMaxZoomRatio(o){var s=_objectSpread2({},o),_=0;return forEach(o,function(_e,et){delete s[et],forEach(s,function(it){var tt=Math.abs(_e.startX-it.startX),rt=Math.abs(_e.startY-it.startY),nt=Math.abs(_e.endX-it.endX),ot=Math.abs(_e.endY-it.endY),st=Math.sqrt(tt*tt+rt*rt),at=Math.sqrt(nt*nt+ot*ot),lt=(at-st)/st;Math.abs(lt)>Math.abs(_)&&(_=lt)})}),_}function getPointer(o,s){var _=o.pageX,_e=o.pageY,et={endX:_,endY:_e};return s?et:_objectSpread2({startX:_,startY:_e},et)}function getPointersCenter(o){var s=0,_=0,_e=0;return forEach(o,function(et){var it=et.startX,tt=et.startY;s+=it,_+=tt,_e+=1}),s/=_e,_/=_e,{pageX:s,pageY:_}}function getAdjustedSizes(o){var s=o.aspectRatio,_=o.height,_e=o.width,et=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",it=isPositiveNumber(_e),tt=isPositiveNumber(_);if(it&&tt){var rt=_*s;et==="contain"&&rt>_e||et==="cover"&&rt<_e?_=_e/s:_e=_*s}else it?_=_e/s:tt&&(_e=_*s);return{width:_e,height:_}}function getRotatedSizes(o){var s=o.width,_=o.height,_e=o.degree;if(_e=Math.abs(_e)%180,_e===90)return{width:_,height:s};var et=_e%90*Math.PI/180,it=Math.sin(et),tt=Math.cos(et),rt=s*tt+_*it,nt=s*it+_*tt;return _e>90?{width:nt,height:rt}:{width:rt,height:nt}}function getSourceCanvas(o,s,_,_e){var et=s.aspectRatio,it=s.naturalWidth,tt=s.naturalHeight,rt=s.rotate,nt=rt===void 0?0:rt,ot=s.scaleX,st=ot===void 0?1:ot,at=s.scaleY,lt=at===void 0?1:at,ct=_.aspectRatio,ht=_.naturalWidth,mt=_.naturalHeight,dt=_e.fillColor,ft=dt===void 0?"transparent":dt,ut=_e.imageSmoothingEnabled,pt=ut===void 0?!0:ut,At=_e.imageSmoothingQuality,gt=At===void 0?"low":At,vt=_e.maxWidth,yt=vt===void 0?1/0:vt,bt=_e.maxHeight,Ct=bt===void 0?1/0:bt,xt=_e.minWidth,It=xt===void 0?0:xt,St=_e.minHeight,Ot=St===void 0?0:St,Mt=document.createElement("canvas"),jt=Mt.getContext("2d"),Ft=getAdjustedSizes({aspectRatio:ct,width:yt,height:Ct}),Ut=getAdjustedSizes({aspectRatio:ct,width:It,height:Ot},"cover"),Qt=Math.min(Ft.width,Math.max(Ut.width,ht)),Ht=Math.min(Ft.height,Math.max(Ut.height,mt)),Zt=getAdjustedSizes({aspectRatio:et,width:yt,height:Ct}),Wt=getAdjustedSizes({aspectRatio:et,width:It,height:Ot},"cover"),$t=Math.min(Zt.width,Math.max(Wt.width,it)),Jt=Math.min(Zt.height,Math.max(Wt.height,tt)),Nt=[-$t/2,-Jt/2,$t,Jt];return Mt.width=normalizeDecimalNumber(Qt),Mt.height=normalizeDecimalNumber(Ht),jt.fillStyle=ft,jt.fillRect(0,0,Qt,Ht),jt.save(),jt.translate(Qt/2,Ht/2),jt.rotate(nt*Math.PI/180),jt.scale(st,lt),jt.imageSmoothingEnabled=pt,jt.imageSmoothingQuality=gt,jt.drawImage.apply(jt,[o].concat(_toConsumableArray(Nt.map(function(Lt){return Math.floor(normalizeDecimalNumber(Lt))})))),jt.restore(),Mt}var fromCharCode=String.fromCharCode;function getStringFromCharCode(o,s,_){var _e="";_+=s;for(var et=s;et<_;et+=1)_e+=fromCharCode(o.getUint8(et));return _e}var REGEXP_DATA_URL_HEAD=/^data:.*,/;function dataURLToArrayBuffer(o){var s=o.replace(REGEXP_DATA_URL_HEAD,""),_=atob(s),_e=new ArrayBuffer(_.length),et=new Uint8Array(_e);return forEach(et,function(it,tt){et[tt]=_.charCodeAt(tt)}),_e}function arrayBufferToDataURL(o,s){for(var _=[],_e=8192,et=new Uint8Array(o);et.length>0;)_.push(fromCharCode.apply(null,toArray(et.subarray(0,_e)))),et=et.subarray(_e);return"data:".concat(s,";base64,").concat(btoa(_.join("")))}function resetAndGetOrientation(o){var s=new DataView(o),_;try{var _e,et,it;if(s.getUint8(0)===255&&s.getUint8(1)===216)for(var tt=s.byteLength,rt=2;rt+1<tt;){if(s.getUint8(rt)===255&&s.getUint8(rt+1)===225){et=rt;break}rt+=1}if(et){var nt=et+4,ot=et+10;if(getStringFromCharCode(s,nt,4)==="Exif"){var st=s.getUint16(ot);if(_e=st===18761,(_e||st===19789)&&s.getUint16(ot+2,_e)===42){var at=s.getUint32(ot+4,_e);at>=8&&(it=ot+at)}}}if(it){var lt=s.getUint16(it,_e),ct,ht;for(ht=0;ht<lt;ht+=1)if(ct=it+ht*12+2,s.getUint16(ct,_e)===274){ct+=8,_=s.getUint16(ct,_e),s.setUint16(ct,1,_e);break}}}catch{_=1}return _}function parseOrientation(o){var s=0,_=1,_e=1;switch(o){case 2:_=-1;break;case 3:s=-180;break;case 4:_e=-1;break;case 5:s=90,_e=-1;break;case 6:s=90;break;case 7:s=90,_=-1;break;case 8:s=-90;break}return{rotate:s,scaleX:_,scaleY:_e}}var render={render:function o(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function o(){var s=this.element,_=this.options,_e=this.container,et=this.cropper,it=Number(_.minContainerWidth),tt=Number(_.minContainerHeight);addClass(et,CLASS_HIDDEN),removeClass(s,CLASS_HIDDEN);var rt={width:Math.max(_e.offsetWidth,it>=0?it:MIN_CONTAINER_WIDTH),height:Math.max(_e.offsetHeight,tt>=0?tt:MIN_CONTAINER_HEIGHT)};this.containerData=rt,setStyle$1(et,{width:rt.width,height:rt.height}),addClass(s,CLASS_HIDDEN),removeClass(et,CLASS_HIDDEN)},initCanvas:function o(){var s=this.containerData,_=this.imageData,_e=this.options.viewMode,et=Math.abs(_.rotate)%180===90,it=et?_.naturalHeight:_.naturalWidth,tt=et?_.naturalWidth:_.naturalHeight,rt=it/tt,nt=s.width,ot=s.height;s.height*rt>s.width?_e===3?nt=s.height*rt:ot=s.width/rt:_e===3?ot=s.width/rt:nt=s.height*rt;var st={aspectRatio:rt,naturalWidth:it,naturalHeight:tt,width:nt,height:ot};this.canvasData=st,this.limited=_e===1||_e===2,this.limitCanvas(!0,!0),st.width=Math.min(Math.max(st.width,st.minWidth),st.maxWidth),st.height=Math.min(Math.max(st.height,st.minHeight),st.maxHeight),st.left=(s.width-st.width)/2,st.top=(s.height-st.height)/2,st.oldLeft=st.left,st.oldTop=st.top,this.initialCanvasData=assign({},st)},limitCanvas:function o(s,_){var _e=this.options,et=this.containerData,it=this.canvasData,tt=this.cropBoxData,rt=_e.viewMode,nt=it.aspectRatio,ot=this.cropped&&tt;if(s){var st=Number(_e.minCanvasWidth)||0,at=Number(_e.minCanvasHeight)||0;rt>1?(st=Math.max(st,et.width),at=Math.max(at,et.height),rt===3&&(at*nt>st?st=at*nt:at=st/nt)):rt>0&&(st?st=Math.max(st,ot?tt.width:0):at?at=Math.max(at,ot?tt.height:0):ot&&(st=tt.width,at=tt.height,at*nt>st?st=at*nt:at=st/nt));var lt=getAdjustedSizes({aspectRatio:nt,width:st,height:at});st=lt.width,at=lt.height,it.minWidth=st,it.minHeight=at,it.maxWidth=1/0,it.maxHeight=1/0}if(_)if(rt>(ot?0:1)){var ct=et.width-it.width,ht=et.height-it.height;it.minLeft=Math.min(0,ct),it.minTop=Math.min(0,ht),it.maxLeft=Math.max(0,ct),it.maxTop=Math.max(0,ht),ot&&this.limited&&(it.minLeft=Math.min(tt.left,tt.left+(tt.width-it.width)),it.minTop=Math.min(tt.top,tt.top+(tt.height-it.height)),it.maxLeft=tt.left,it.maxTop=tt.top,rt===2&&(it.width>=et.width&&(it.minLeft=Math.min(0,ct),it.maxLeft=Math.max(0,ct)),it.height>=et.height&&(it.minTop=Math.min(0,ht),it.maxTop=Math.max(0,ht))))}else it.minLeft=-it.width,it.minTop=-it.height,it.maxLeft=et.width,it.maxTop=et.height},renderCanvas:function o(s,_){var _e=this.canvasData,et=this.imageData;if(_){var it=getRotatedSizes({width:et.naturalWidth*Math.abs(et.scaleX||1),height:et.naturalHeight*Math.abs(et.scaleY||1),degree:et.rotate||0}),tt=it.width,rt=it.height,nt=_e.width*(tt/_e.naturalWidth),ot=_e.height*(rt/_e.naturalHeight);_e.left-=(nt-_e.width)/2,_e.top-=(ot-_e.height)/2,_e.width=nt,_e.height=ot,_e.aspectRatio=tt/rt,_e.naturalWidth=tt,_e.naturalHeight=rt,this.limitCanvas(!0,!1)}(_e.width>_e.maxWidth||_e.width<_e.minWidth)&&(_e.left=_e.oldLeft),(_e.height>_e.maxHeight||_e.height<_e.minHeight)&&(_e.top=_e.oldTop),_e.width=Math.min(Math.max(_e.width,_e.minWidth),_e.maxWidth),_e.height=Math.min(Math.max(_e.height,_e.minHeight),_e.maxHeight),this.limitCanvas(!1,!0),_e.left=Math.min(Math.max(_e.left,_e.minLeft),_e.maxLeft),_e.top=Math.min(Math.max(_e.top,_e.minTop),_e.maxTop),_e.oldLeft=_e.left,_e.oldTop=_e.top,setStyle$1(this.canvas,assign({width:_e.width,height:_e.height},getTransforms({translateX:_e.left,translateY:_e.top}))),this.renderImage(s),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function o(s){var _=this.canvasData,_e=this.imageData,et=_e.naturalWidth*(_.width/_.naturalWidth),it=_e.naturalHeight*(_.height/_.naturalHeight);assign(_e,{width:et,height:it,left:(_.width-et)/2,top:(_.height-it)/2}),setStyle$1(this.image,assign({width:_e.width,height:_e.height},getTransforms(assign({translateX:_e.left,translateY:_e.top},_e)))),s&&this.output()},initCropBox:function o(){var s=this.options,_=this.canvasData,_e=s.aspectRatio||s.initialAspectRatio,et=Number(s.autoCropArea)||.8,it={width:_.width,height:_.height};_e&&(_.height*_e>_.width?it.height=it.width/_e:it.width=it.height*_e),this.cropBoxData=it,this.limitCropBox(!0,!0),it.width=Math.min(Math.max(it.width,it.minWidth),it.maxWidth),it.height=Math.min(Math.max(it.height,it.minHeight),it.maxHeight),it.width=Math.max(it.minWidth,it.width*et),it.height=Math.max(it.minHeight,it.height*et),it.left=_.left+(_.width-it.width)/2,it.top=_.top+(_.height-it.height)/2,it.oldLeft=it.left,it.oldTop=it.top,this.initialCropBoxData=assign({},it)},limitCropBox:function o(s,_){var _e=this.options,et=this.containerData,it=this.canvasData,tt=this.cropBoxData,rt=this.limited,nt=_e.aspectRatio;if(s){var ot=Number(_e.minCropBoxWidth)||0,st=Number(_e.minCropBoxHeight)||0,at=rt?Math.min(et.width,it.width,it.width+it.left,et.width-it.left):et.width,lt=rt?Math.min(et.height,it.height,it.height+it.top,et.height-it.top):et.height;ot=Math.min(ot,et.width),st=Math.min(st,et.height),nt&&(ot&&st?st*nt>ot?st=ot/nt:ot=st*nt:ot?st=ot/nt:st&&(ot=st*nt),lt*nt>at?lt=at/nt:at=lt*nt),tt.minWidth=Math.min(ot,at),tt.minHeight=Math.min(st,lt),tt.maxWidth=at,tt.maxHeight=lt}_&&(rt?(tt.minLeft=Math.max(0,it.left),tt.minTop=Math.max(0,it.top),tt.maxLeft=Math.min(et.width,it.left+it.width)-tt.width,tt.maxTop=Math.min(et.height,it.top+it.height)-tt.height):(tt.minLeft=0,tt.minTop=0,tt.maxLeft=et.width-tt.width,tt.maxTop=et.height-tt.height))},renderCropBox:function o(){var s=this.options,_=this.containerData,_e=this.cropBoxData;(_e.width>_e.maxWidth||_e.width<_e.minWidth)&&(_e.left=_e.oldLeft),(_e.height>_e.maxHeight||_e.height<_e.minHeight)&&(_e.top=_e.oldTop),_e.width=Math.min(Math.max(_e.width,_e.minWidth),_e.maxWidth),_e.height=Math.min(Math.max(_e.height,_e.minHeight),_e.maxHeight),this.limitCropBox(!1,!0),_e.left=Math.min(Math.max(_e.left,_e.minLeft),_e.maxLeft),_e.top=Math.min(Math.max(_e.top,_e.minTop),_e.maxTop),_e.oldLeft=_e.left,_e.oldTop=_e.top,s.movable&&s.cropBoxMovable&&setData(this.face,DATA_ACTION,_e.width>=_.width&&_e.height>=_.height?ACTION_MOVE:ACTION_ALL),setStyle$1(this.cropBox,assign({width:_e.width,height:_e.height},getTransforms({translateX:_e.left,translateY:_e.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function o(){this.preview(),dispatchEvent(this.element,EVENT_CROP,this.getData())}},preview={initPreview:function o(){var s=this.element,_=this.crossOrigin,_e=this.options.preview,et=_?this.crossOriginUrl:this.url,it=s.alt||"The image to preview",tt=document.createElement("img");if(_&&(tt.crossOrigin=_),tt.src=et,tt.alt=it,this.viewBox.appendChild(tt),this.viewBoxImage=tt,!!_e){var rt=_e;typeof _e=="string"?rt=s.ownerDocument.querySelectorAll(_e):_e.querySelector&&(rt=[_e]),this.previews=rt,forEach(rt,function(nt){var ot=document.createElement("img");setData(nt,DATA_PREVIEW,{width:nt.offsetWidth,height:nt.offsetHeight,html:nt.innerHTML}),_&&(ot.crossOrigin=_),ot.src=et,ot.alt=it,ot.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',nt.innerHTML="",nt.appendChild(ot)})}},resetPreview:function o(){forEach(this.previews,function(s){var _=getData(s,DATA_PREVIEW);setStyle$1(s,{width:_.width,height:_.height}),s.innerHTML=_.html,removeData(s,DATA_PREVIEW)})},preview:function o(){var s=this.imageData,_=this.canvasData,_e=this.cropBoxData,et=_e.width,it=_e.height,tt=s.width,rt=s.height,nt=_e.left-_.left-s.left,ot=_e.top-_.top-s.top;!this.cropped||this.disabled||(setStyle$1(this.viewBoxImage,assign({width:tt,height:rt},getTransforms(assign({translateX:-nt,translateY:-ot},s)))),forEach(this.previews,function(st){var at=getData(st,DATA_PREVIEW),lt=at.width,ct=at.height,ht=lt,mt=ct,dt=1;et&&(dt=lt/et,mt=it*dt),it&&mt>ct&&(dt=ct/it,ht=et*dt,mt=ct),setStyle$1(st,{width:ht,height:mt}),setStyle$1(st.getElementsByTagName("img")[0],assign({width:tt*dt,height:rt*dt},getTransforms(assign({translateX:-nt*dt,translateY:-ot*dt},s))))}))}},events={bind:function o(){var s=this.element,_=this.options,_e=this.cropper;isFunction$1(_.cropstart)&&addListener$1(s,EVENT_CROP_START,_.cropstart),isFunction$1(_.cropmove)&&addListener$1(s,EVENT_CROP_MOVE,_.cropmove),isFunction$1(_.cropend)&&addListener$1(s,EVENT_CROP_END,_.cropend),isFunction$1(_.crop)&&addListener$1(s,EVENT_CROP,_.crop),isFunction$1(_.zoom)&&addListener$1(s,EVENT_ZOOM,_.zoom),addListener$1(_e,EVENT_POINTER_DOWN,this.onCropStart=this.cropStart.bind(this)),_.zoomable&&_.zoomOnWheel&&addListener$1(_e,EVENT_WHEEL,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),_.toggleDragModeOnDblclick&&addListener$1(_e,EVENT_DBLCLICK,this.onDblclick=this.dblclick.bind(this)),addListener$1(s.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove=this.cropMove.bind(this)),addListener$1(s.ownerDocument,EVENT_POINTER_UP,this.onCropEnd=this.cropEnd.bind(this)),_.responsive&&addListener$1(window,EVENT_RESIZE,this.onResize=this.resize.bind(this))},unbind:function o(){var s=this.element,_=this.options,_e=this.cropper;isFunction$1(_.cropstart)&&removeListener$1(s,EVENT_CROP_START,_.cropstart),isFunction$1(_.cropmove)&&removeListener$1(s,EVENT_CROP_MOVE,_.cropmove),isFunction$1(_.cropend)&&removeListener$1(s,EVENT_CROP_END,_.cropend),isFunction$1(_.crop)&&removeListener$1(s,EVENT_CROP,_.crop),isFunction$1(_.zoom)&&removeListener$1(s,EVENT_ZOOM,_.zoom),removeListener$1(_e,EVENT_POINTER_DOWN,this.onCropStart),_.zoomable&&_.zoomOnWheel&&removeListener$1(_e,EVENT_WHEEL,this.onWheel,{passive:!1,capture:!0}),_.toggleDragModeOnDblclick&&removeListener$1(_e,EVENT_DBLCLICK,this.onDblclick),removeListener$1(s.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove),removeListener$1(s.ownerDocument,EVENT_POINTER_UP,this.onCropEnd),_.responsive&&removeListener$1(window,EVENT_RESIZE,this.onResize)}},handlers={resize:function o(){if(!this.disabled){var s=this.options,_=this.container,_e=this.containerData,et=_.offsetWidth/_e.width,it=_.offsetHeight/_e.height,tt=Math.abs(et-1)>Math.abs(it-1)?et:it;if(tt!==1){var rt,nt;s.restore&&(rt=this.getCanvasData(),nt=this.getCropBoxData()),this.render(),s.restore&&(this.setCanvasData(forEach(rt,function(ot,st){rt[st]=ot*tt})),this.setCropBoxData(forEach(nt,function(ot,st){nt[st]=ot*tt})))}}},dblclick:function o(){this.disabled||this.options.dragMode===DRAG_MODE_NONE||this.setDragMode(hasClass(this.dragBox,CLASS_CROP)?DRAG_MODE_MOVE:DRAG_MODE_CROP)},wheel:function o(s){var _=this,_e=Number(this.options.wheelZoomRatio)||.1,et=1;this.disabled||(s.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){_.wheeling=!1},50),s.deltaY?et=s.deltaY>0?1:-1:s.wheelDelta?et=-s.wheelDelta/120:s.detail&&(et=s.detail>0?1:-1),this.zoom(-et*_e,s)))},cropStart:function o(s){var _=s.buttons,_e=s.button;if(!(this.disabled||(s.type==="mousedown"||s.type==="pointerdown"&&s.pointerType==="mouse")&&(isNumber$1(_)&&_!==1||isNumber$1(_e)&&_e!==0||s.ctrlKey))){var et=this.options,it=this.pointers,tt;s.changedTouches?forEach(s.changedTouches,function(rt){it[rt.identifier]=getPointer(rt)}):it[s.pointerId||0]=getPointer(s),Object.keys(it).length>1&&et.zoomable&&et.zoomOnTouch?tt=ACTION_ZOOM:tt=getData(s.target,DATA_ACTION),!!REGEXP_ACTIONS.test(tt)&&dispatchEvent(this.element,EVENT_CROP_START,{originalEvent:s,action:tt})!==!1&&(s.preventDefault(),this.action=tt,this.cropping=!1,tt===ACTION_CROP&&(this.cropping=!0,addClass(this.dragBox,CLASS_MODAL)))}},cropMove:function o(s){var _=this.action;if(!(this.disabled||!_)){var _e=this.pointers;s.preventDefault(),dispatchEvent(this.element,EVENT_CROP_MOVE,{originalEvent:s,action:_})!==!1&&(s.changedTouches?forEach(s.changedTouches,function(et){assign(_e[et.identifier]||{},getPointer(et,!0))}):assign(_e[s.pointerId||0]||{},getPointer(s,!0)),this.change(s))}},cropEnd:function o(s){if(!this.disabled){var _=this.action,_e=this.pointers;s.changedTouches?forEach(s.changedTouches,function(et){delete _e[et.identifier]}):delete _e[s.pointerId||0],_&&(s.preventDefault(),Object.keys(_e).length||(this.action=""),this.cropping&&(this.cropping=!1,toggleClass(this.dragBox,CLASS_MODAL,this.cropped&&this.options.modal)),dispatchEvent(this.element,EVENT_CROP_END,{originalEvent:s,action:_}))}}},change={change:function o(s){var _=this.options,_e=this.canvasData,et=this.containerData,it=this.cropBoxData,tt=this.pointers,rt=this.action,nt=_.aspectRatio,ot=it.left,st=it.top,at=it.width,lt=it.height,ct=ot+at,ht=st+lt,mt=0,dt=0,ft=et.width,ut=et.height,pt=!0,At;!nt&&s.shiftKey&&(nt=at&&lt?at/lt:1),this.limited&&(mt=it.minLeft,dt=it.minTop,ft=mt+Math.min(et.width,_e.width,_e.left+_e.width),ut=dt+Math.min(et.height,_e.height,_e.top+_e.height));var gt=tt[Object.keys(tt)[0]],vt={x:gt.endX-gt.startX,y:gt.endY-gt.startY},yt=function(Ct){switch(Ct){case ACTION_EAST:ct+vt.x>ft&&(vt.x=ft-ct);break;case ACTION_WEST:ot+vt.x<mt&&(vt.x=mt-ot);break;case ACTION_NORTH:st+vt.y<dt&&(vt.y=dt-st);break;case ACTION_SOUTH:ht+vt.y>ut&&(vt.y=ut-ht);break}};switch(rt){case ACTION_ALL:ot+=vt.x,st+=vt.y;break;case ACTION_EAST:if(vt.x>=0&&(ct>=ft||nt&&(st<=dt||ht>=ut))){pt=!1;break}yt(ACTION_EAST),at+=vt.x,at<0&&(rt=ACTION_WEST,at=-at,ot-=at),nt&&(lt=at/nt,st+=(it.height-lt)/2);break;case ACTION_NORTH:if(vt.y<=0&&(st<=dt||nt&&(ot<=mt||ct>=ft))){pt=!1;break}yt(ACTION_NORTH),lt-=vt.y,st+=vt.y,lt<0&&(rt=ACTION_SOUTH,lt=-lt,st-=lt),nt&&(at=lt*nt,ot+=(it.width-at)/2);break;case ACTION_WEST:if(vt.x<=0&&(ot<=mt||nt&&(st<=dt||ht>=ut))){pt=!1;break}yt(ACTION_WEST),at-=vt.x,ot+=vt.x,at<0&&(rt=ACTION_EAST,at=-at,ot-=at),nt&&(lt=at/nt,st+=(it.height-lt)/2);break;case ACTION_SOUTH:if(vt.y>=0&&(ht>=ut||nt&&(ot<=mt||ct>=ft))){pt=!1;break}yt(ACTION_SOUTH),lt+=vt.y,lt<0&&(rt=ACTION_NORTH,lt=-lt,st-=lt),nt&&(at=lt*nt,ot+=(it.width-at)/2);break;case ACTION_NORTH_EAST:if(nt){if(vt.y<=0&&(st<=dt||ct>=ft)){pt=!1;break}yt(ACTION_NORTH),lt-=vt.y,st+=vt.y,at=lt*nt}else yt(ACTION_NORTH),yt(ACTION_EAST),vt.x>=0?ct<ft?at+=vt.x:vt.y<=0&&st<=dt&&(pt=!1):at+=vt.x,vt.y<=0?st>dt&&(lt-=vt.y,st+=vt.y):(lt-=vt.y,st+=vt.y);at<0&&lt<0?(rt=ACTION_SOUTH_WEST,lt=-lt,at=-at,st-=lt,ot-=at):at<0?(rt=ACTION_NORTH_WEST,at=-at,ot-=at):lt<0&&(rt=ACTION_SOUTH_EAST,lt=-lt,st-=lt);break;case ACTION_NORTH_WEST:if(nt){if(vt.y<=0&&(st<=dt||ot<=mt)){pt=!1;break}yt(ACTION_NORTH),lt-=vt.y,st+=vt.y,at=lt*nt,ot+=it.width-at}else yt(ACTION_NORTH),yt(ACTION_WEST),vt.x<=0?ot>mt?(at-=vt.x,ot+=vt.x):vt.y<=0&&st<=dt&&(pt=!1):(at-=vt.x,ot+=vt.x),vt.y<=0?st>dt&&(lt-=vt.y,st+=vt.y):(lt-=vt.y,st+=vt.y);at<0&&lt<0?(rt=ACTION_SOUTH_EAST,lt=-lt,at=-at,st-=lt,ot-=at):at<0?(rt=ACTION_NORTH_EAST,at=-at,ot-=at):lt<0&&(rt=ACTION_SOUTH_WEST,lt=-lt,st-=lt);break;case ACTION_SOUTH_WEST:if(nt){if(vt.x<=0&&(ot<=mt||ht>=ut)){pt=!1;break}yt(ACTION_WEST),at-=vt.x,ot+=vt.x,lt=at/nt}else yt(ACTION_SOUTH),yt(ACTION_WEST),vt.x<=0?ot>mt?(at-=vt.x,ot+=vt.x):vt.y>=0&&ht>=ut&&(pt=!1):(at-=vt.x,ot+=vt.x),vt.y>=0?ht<ut&&(lt+=vt.y):lt+=vt.y;at<0&&lt<0?(rt=ACTION_NORTH_EAST,lt=-lt,at=-at,st-=lt,ot-=at):at<0?(rt=ACTION_SOUTH_EAST,at=-at,ot-=at):lt<0&&(rt=ACTION_NORTH_WEST,lt=-lt,st-=lt);break;case ACTION_SOUTH_EAST:if(nt){if(vt.x>=0&&(ct>=ft||ht>=ut)){pt=!1;break}yt(ACTION_EAST),at+=vt.x,lt=at/nt}else yt(ACTION_SOUTH),yt(ACTION_EAST),vt.x>=0?ct<ft?at+=vt.x:vt.y>=0&&ht>=ut&&(pt=!1):at+=vt.x,vt.y>=0?ht<ut&&(lt+=vt.y):lt+=vt.y;at<0&&lt<0?(rt=ACTION_NORTH_WEST,lt=-lt,at=-at,st-=lt,ot-=at):at<0?(rt=ACTION_SOUTH_WEST,at=-at,ot-=at):lt<0&&(rt=ACTION_NORTH_EAST,lt=-lt,st-=lt);break;case ACTION_MOVE:this.move(vt.x,vt.y),pt=!1;break;case ACTION_ZOOM:this.zoom(getMaxZoomRatio(tt),s),pt=!1;break;case ACTION_CROP:if(!vt.x||!vt.y){pt=!1;break}At=getOffset(this.cropper),ot=gt.startX-At.left,st=gt.startY-At.top,at=it.minWidth,lt=it.minHeight,vt.x>0?rt=vt.y>0?ACTION_SOUTH_EAST:ACTION_NORTH_EAST:vt.x<0&&(ot-=at,rt=vt.y>0?ACTION_SOUTH_WEST:ACTION_NORTH_WEST),vt.y<0&&(st-=lt),this.cropped||(removeClass(this.cropBox,CLASS_HIDDEN),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}pt&&(it.width=at,it.height=lt,it.left=ot,it.top=st,this.action=rt,this.renderCropBox()),forEach(tt,function(bt){bt.startX=bt.endX,bt.startY=bt.endY})}},methods={crop:function o(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&addClass(this.dragBox,CLASS_MODAL),removeClass(this.cropBox,CLASS_HIDDEN),this.setCropBoxData(this.initialCropBoxData)),this},reset:function o(){return this.ready&&!this.disabled&&(this.imageData=assign({},this.initialImageData),this.canvasData=assign({},this.initialCanvasData),this.cropBoxData=assign({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function o(){return this.cropped&&!this.disabled&&(assign(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),removeClass(this.dragBox,CLASS_MODAL),addClass(this.cropBox,CLASS_HIDDEN)),this},replace:function o(s){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&s&&(this.isImg&&(this.element.src=s),_?(this.url=s,this.image.src=s,this.ready&&(this.viewBoxImage.src=s,forEach(this.previews,function(_e){_e.getElementsByTagName("img")[0].src=s}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(s))),this},enable:function o(){return this.ready&&this.disabled&&(this.disabled=!1,removeClass(this.cropper,CLASS_DISABLED)),this},disable:function o(){return this.ready&&!this.disabled&&(this.disabled=!0,addClass(this.cropper,CLASS_DISABLED)),this},destroy:function o(){var s=this.element;return s[NAMESPACE]?(s[NAMESPACE]=void 0,this.isImg&&this.replaced&&(s.src=this.originalUrl),this.uncreate(),this):this},move:function o(s){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,_e=this.canvasData,et=_e.left,it=_e.top;return this.moveTo(isUndefined(s)?s:et+Number(s),isUndefined(_)?_:it+Number(_))},moveTo:function o(s){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,_e=this.canvasData,et=!1;return s=Number(s),_=Number(_),this.ready&&!this.disabled&&this.options.movable&&(isNumber$1(s)&&(_e.left=s,et=!0),isNumber$1(_)&&(_e.top=_,et=!0),et&&this.renderCanvas(!0)),this},zoom:function o(s,_){var _e=this.canvasData;return s=Number(s),s<0?s=1/(1-s):s=1+s,this.zoomTo(_e.width*s/_e.naturalWidth,null,_)},zoomTo:function o(s,_,_e){var et=this.options,it=this.canvasData,tt=it.width,rt=it.height,nt=it.naturalWidth,ot=it.naturalHeight;if(s=Number(s),s>=0&&this.ready&&!this.disabled&&et.zoomable){var st=nt*s,at=ot*s;if(dispatchEvent(this.element,EVENT_ZOOM,{ratio:s,oldRatio:tt/nt,originalEvent:_e})===!1)return this;if(_e){var lt=this.pointers,ct=getOffset(this.cropper),ht=lt&&Object.keys(lt).length?getPointersCenter(lt):{pageX:_e.pageX,pageY:_e.pageY};it.left-=(st-tt)*((ht.pageX-ct.left-it.left)/tt),it.top-=(at-rt)*((ht.pageY-ct.top-it.top)/rt)}else isPlainObject(_)&&isNumber$1(_.x)&&isNumber$1(_.y)?(it.left-=(st-tt)*((_.x-it.left)/tt),it.top-=(at-rt)*((_.y-it.top)/rt)):(it.left-=(st-tt)/2,it.top-=(at-rt)/2);it.width=st,it.height=at,this.renderCanvas(!0)}return this},rotate:function o(s){return this.rotateTo((this.imageData.rotate||0)+Number(s))},rotateTo:function o(s){return s=Number(s),isNumber$1(s)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=s%360,this.renderCanvas(!0,!0)),this},scaleX:function o(s){var _=this.imageData.scaleY;return this.scale(s,isNumber$1(_)?_:1)},scaleY:function o(s){var _=this.imageData.scaleX;return this.scale(isNumber$1(_)?_:1,s)},scale:function o(s){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,_e=this.imageData,et=!1;return s=Number(s),_=Number(_),this.ready&&!this.disabled&&this.options.scalable&&(isNumber$1(s)&&(_e.scaleX=s,et=!0),isNumber$1(_)&&(_e.scaleY=_,et=!0),et&&this.renderCanvas(!0,!0)),this},getData:function o(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,_=this.options,_e=this.imageData,et=this.canvasData,it=this.cropBoxData,tt;if(this.ready&&this.cropped){tt={x:it.left-et.left,y:it.top-et.top,width:it.width,height:it.height};var rt=_e.width/_e.naturalWidth;if(forEach(tt,function(st,at){tt[at]=st/rt}),s){var nt=Math.round(tt.y+tt.height),ot=Math.round(tt.x+tt.width);tt.x=Math.round(tt.x),tt.y=Math.round(tt.y),tt.width=ot-tt.x,tt.height=nt-tt.y}}else tt={x:0,y:0,width:0,height:0};return _.rotatable&&(tt.rotate=_e.rotate||0),_.scalable&&(tt.scaleX=_e.scaleX||1,tt.scaleY=_e.scaleY||1),tt},setData:function o(s){var _=this.options,_e=this.imageData,et=this.canvasData,it={};if(this.ready&&!this.disabled&&isPlainObject(s)){var tt=!1;_.rotatable&&isNumber$1(s.rotate)&&s.rotate!==_e.rotate&&(_e.rotate=s.rotate,tt=!0),_.scalable&&(isNumber$1(s.scaleX)&&s.scaleX!==_e.scaleX&&(_e.scaleX=s.scaleX,tt=!0),isNumber$1(s.scaleY)&&s.scaleY!==_e.scaleY&&(_e.scaleY=s.scaleY,tt=!0)),tt&&this.renderCanvas(!0,!0);var rt=_e.width/_e.naturalWidth;isNumber$1(s.x)&&(it.left=s.x*rt+et.left),isNumber$1(s.y)&&(it.top=s.y*rt+et.top),isNumber$1(s.width)&&(it.width=s.width*rt),isNumber$1(s.height)&&(it.height=s.height*rt),this.setCropBoxData(it)}return this},getContainerData:function o(){return this.ready?assign({},this.containerData):{}},getImageData:function o(){return this.sized?assign({},this.imageData):{}},getCanvasData:function o(){var s=this.canvasData,_={};return this.ready&&forEach(["left","top","width","height","naturalWidth","naturalHeight"],function(_e){_[_e]=s[_e]}),_},setCanvasData:function o(s){var _=this.canvasData,_e=_.aspectRatio;return this.ready&&!this.disabled&&isPlainObject(s)&&(isNumber$1(s.left)&&(_.left=s.left),isNumber$1(s.top)&&(_.top=s.top),isNumber$1(s.width)?(_.width=s.width,_.height=s.width/_e):isNumber$1(s.height)&&(_.height=s.height,_.width=s.height*_e),this.renderCanvas(!0)),this},getCropBoxData:function o(){var s=this.cropBoxData,_;return this.ready&&this.cropped&&(_={left:s.left,top:s.top,width:s.width,height:s.height}),_||{}},setCropBoxData:function o(s){var _=this.cropBoxData,_e=this.options.aspectRatio,et,it;return this.ready&&this.cropped&&!this.disabled&&isPlainObject(s)&&(isNumber$1(s.left)&&(_.left=s.left),isNumber$1(s.top)&&(_.top=s.top),isNumber$1(s.width)&&s.width!==_.width&&(et=!0,_.width=s.width),isNumber$1(s.height)&&s.height!==_.height&&(it=!0,_.height=s.height),_e&&(et?_.height=_.width/_e:it&&(_.width=_.height*_e)),this.renderCropBox()),this},getCroppedCanvas:function o(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var _=this.canvasData,_e=getSourceCanvas(this.image,this.imageData,_,s);if(!this.cropped)return _e;var et=this.getData(),it=et.x,tt=et.y,rt=et.width,nt=et.height,ot=_e.width/Math.floor(_.naturalWidth);ot!==1&&(it*=ot,tt*=ot,rt*=ot,nt*=ot);var st=rt/nt,at=getAdjustedSizes({aspectRatio:st,width:s.maxWidth||1/0,height:s.maxHeight||1/0}),lt=getAdjustedSizes({aspectRatio:st,width:s.minWidth||0,height:s.minHeight||0},"cover"),ct=getAdjustedSizes({aspectRatio:st,width:s.width||(ot!==1?_e.width:rt),height:s.height||(ot!==1?_e.height:nt)}),ht=ct.width,mt=ct.height;ht=Math.min(at.width,Math.max(lt.width,ht)),mt=Math.min(at.height,Math.max(lt.height,mt));var dt=document.createElement("canvas"),ft=dt.getContext("2d");dt.width=normalizeDecimalNumber(ht),dt.height=normalizeDecimalNumber(mt),ft.fillStyle=s.fillColor||"transparent",ft.fillRect(0,0,ht,mt);var ut=s.imageSmoothingEnabled,pt=ut===void 0?!0:ut,At=s.imageSmoothingQuality;ft.imageSmoothingEnabled=pt,At&&(ft.imageSmoothingQuality=At);var gt=_e.width,vt=_e.height,yt=it,bt=tt,Ct,xt,It,St,Ot,Mt;yt<=-rt||yt>gt?(yt=0,Ct=0,It=0,Ot=0):yt<=0?(It=-yt,yt=0,Ct=Math.min(gt,rt+yt),Ot=Ct):yt<=gt&&(It=0,Ct=Math.min(rt,gt-yt),Ot=Ct),Ct<=0||bt<=-nt||bt>vt?(bt=0,xt=0,St=0,Mt=0):bt<=0?(St=-bt,bt=0,xt=Math.min(vt,nt+bt),Mt=xt):bt<=vt&&(St=0,xt=Math.min(nt,vt-bt),Mt=xt);var jt=[yt,bt,Ct,xt];if(Ot>0&&Mt>0){var Ft=ht/rt;jt.push(It*Ft,St*Ft,Ot*Ft,Mt*Ft)}return ft.drawImage.apply(ft,[_e].concat(_toConsumableArray(jt.map(function(Ut){return Math.floor(normalizeDecimalNumber(Ut))})))),dt},setAspectRatio:function o(s){var _=this.options;return!this.disabled&&!isUndefined(s)&&(_.aspectRatio=Math.max(0,s)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function o(s){var _=this.options,_e=this.dragBox,et=this.face;if(this.ready&&!this.disabled){var it=s===DRAG_MODE_CROP,tt=_.movable&&s===DRAG_MODE_MOVE;s=it||tt?s:DRAG_MODE_NONE,_.dragMode=s,setData(_e,DATA_ACTION,s),toggleClass(_e,CLASS_CROP,it),toggleClass(_e,CLASS_MOVE,tt),_.cropBoxMovable||(setData(et,DATA_ACTION,s),toggleClass(et,CLASS_CROP,it),toggleClass(et,CLASS_MOVE,tt))}return this}},AnotherCropper=WINDOW.Cropper,Cropper=function(){function o(s){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(_classCallCheck(this,o),!s||!REGEXP_TAG_NAME.test(s.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=s,this.options=assign({},DEFAULTS,isPlainObject(_)&&_),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return _createClass(o,[{key:"init",value:function(){var _=this.element,_e=_.tagName.toLowerCase(),et;if(!_[NAMESPACE]){if(_[NAMESPACE]=this,_e==="img"){if(this.isImg=!0,et=_.getAttribute("src")||"",this.originalUrl=et,!et)return;et=_.src}else _e==="canvas"&&window.HTMLCanvasElement&&(et=_.toDataURL());this.load(et)}}},{key:"load",value:function(_){var _e=this;if(!!_){this.url=_,this.imageData={};var et=this.element,it=this.options;if(!it.rotatable&&!it.scalable&&(it.checkOrientation=!1),!it.checkOrientation||!window.ArrayBuffer){this.clone();return}if(REGEXP_DATA_URL.test(_)){REGEXP_DATA_URL_JPEG.test(_)?this.read(dataURLToArrayBuffer(_)):this.clone();return}var tt=new XMLHttpRequest,rt=this.clone.bind(this);this.reloading=!0,this.xhr=tt,tt.onabort=rt,tt.onerror=rt,tt.ontimeout=rt,tt.onprogress=function(){tt.getResponseHeader("content-type")!==MIME_TYPE_JPEG&&tt.abort()},tt.onload=function(){_e.read(tt.response)},tt.onloadend=function(){_e.reloading=!1,_e.xhr=null},it.checkCrossOrigin&&isCrossOriginURL(_)&&et.crossOrigin&&(_=addTimestamp(_)),tt.open("GET",_,!0),tt.responseType="arraybuffer",tt.withCredentials=et.crossOrigin==="use-credentials",tt.send()}}},{key:"read",value:function(_){var _e=this.options,et=this.imageData,it=resetAndGetOrientation(_),tt=0,rt=1,nt=1;if(it>1){this.url=arrayBufferToDataURL(_,MIME_TYPE_JPEG);var ot=parseOrientation(it);tt=ot.rotate,rt=ot.scaleX,nt=ot.scaleY}_e.rotatable&&(et.rotate=tt),_e.scalable&&(et.scaleX=rt,et.scaleY=nt),this.clone()}},{key:"clone",value:function(){var _=this.element,_e=this.url,et=_.crossOrigin,it=_e;this.options.checkCrossOrigin&&isCrossOriginURL(_e)&&(et||(et="anonymous"),it=addTimestamp(_e)),this.crossOrigin=et,this.crossOriginUrl=it;var tt=document.createElement("img");et&&(tt.crossOrigin=et),tt.src=it||_e,tt.alt=_.alt||"The image to crop",this.image=tt,tt.onload=this.start.bind(this),tt.onerror=this.stop.bind(this),addClass(tt,CLASS_HIDE),_.parentNode.insertBefore(tt,_.nextSibling)}},{key:"start",value:function(){var _=this,_e=this.image;_e.onload=null,_e.onerror=null,this.sizing=!0;var et=WINDOW.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent),it=function(ot,st){assign(_.imageData,{naturalWidth:ot,naturalHeight:st,aspectRatio:ot/st}),_.initialImageData=assign({},_.imageData),_.sizing=!1,_.sized=!0,_.build()};if(_e.naturalWidth&&!et){it(_e.naturalWidth,_e.naturalHeight);return}var tt=document.createElement("img"),rt=document.body||document.documentElement;this.sizingImage=tt,tt.onload=function(){it(tt.width,tt.height),et||rt.removeChild(tt)},tt.src=_e.src,et||(tt.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",rt.appendChild(tt))}},{key:"stop",value:function(){var _=this.image;_.onload=null,_.onerror=null,_.parentNode.removeChild(_),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var _=this.element,_e=this.options,et=this.image,it=_.parentNode,tt=document.createElement("div");tt.innerHTML=TEMPLATE;var rt=tt.querySelector(".".concat(NAMESPACE,"-container")),nt=rt.querySelector(".".concat(NAMESPACE,"-canvas")),ot=rt.querySelector(".".concat(NAMESPACE,"-drag-box")),st=rt.querySelector(".".concat(NAMESPACE,"-crop-box")),at=st.querySelector(".".concat(NAMESPACE,"-face"));this.container=it,this.cropper=rt,this.canvas=nt,this.dragBox=ot,this.cropBox=st,this.viewBox=rt.querySelector(".".concat(NAMESPACE,"-view-box")),this.face=at,nt.appendChild(et),addClass(_,CLASS_HIDDEN),it.insertBefore(rt,_.nextSibling),this.isImg||removeClass(et,CLASS_HIDE),this.initPreview(),this.bind(),_e.initialAspectRatio=Math.max(0,_e.initialAspectRatio)||NaN,_e.aspectRatio=Math.max(0,_e.aspectRatio)||NaN,_e.viewMode=Math.max(0,Math.min(3,Math.round(_e.viewMode)))||0,addClass(st,CLASS_HIDDEN),_e.guides||addClass(st.getElementsByClassName("".concat(NAMESPACE,"-dashed")),CLASS_HIDDEN),_e.center||addClass(st.getElementsByClassName("".concat(NAMESPACE,"-center")),CLASS_HIDDEN),_e.background&&addClass(rt,"".concat(NAMESPACE,"-bg")),_e.highlight||addClass(at,CLASS_INVISIBLE),_e.cropBoxMovable&&(addClass(at,CLASS_MOVE),setData(at,DATA_ACTION,ACTION_ALL)),_e.cropBoxResizable||(addClass(st.getElementsByClassName("".concat(NAMESPACE,"-line")),CLASS_HIDDEN),addClass(st.getElementsByClassName("".concat(NAMESPACE,"-point")),CLASS_HIDDEN)),this.render(),this.ready=!0,this.setDragMode(_e.dragMode),_e.autoCrop&&this.crop(),this.setData(_e.data),isFunction$1(_e.ready)&&addListener$1(_,EVENT_READY,_e.ready,{once:!0}),dispatchEvent(_,EVENT_READY)}}},{key:"unbuild",value:function(){!this.ready||(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),removeClass(this.element,CLASS_HIDDEN))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=AnotherCropper,o}},{key:"setDefaults",value:function(_){assign(DEFAULTS,isPlainObject(_)&&_)}}]),o}();assign(Cropper.prototype,render,preview,events,handlers,change,methods);var __assign=function(){return __assign=Object.assign||function(s){for(var _,_e=1,et=arguments.length;_e<et;_e++){_=arguments[_e];for(var it in _)Object.prototype.hasOwnProperty.call(_,it)&&(s[it]=_[it])}return s},__assign.apply(this,arguments)};function __rest(o,s){var _={};for(var _e in o)Object.prototype.hasOwnProperty.call(o,_e)&&s.indexOf(_e)<0&&(_[_e]=o[_e]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,_e=Object.getOwnPropertySymbols(o);et<_e.length;et++)s.indexOf(_e[et])<0&&Object.prototype.propertyIsEnumerable.call(o,_e[et])&&(_[_e[et]]=o[_e[et]]);return _}var applyDefaultOptions=function(o,s){s===void 0&&(s={});var _=s.enable,_e=_===void 0?!0:_,et=s.scaleX,it=et===void 0?1:et,tt=s.scaleY,rt=tt===void 0?1:tt,nt=s.zoomTo,ot=nt===void 0?0:nt,st=s.rotateTo;_e?o.enable():o.disable(),o.scaleX(it),o.scaleY(rt),st!==void 0&&o.rotateTo(st),ot>0&&o.zoomTo(ot)},useCombinedRefs=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var _=react.exports.useRef(null);return React.useEffect(function(){o.forEach(function(_e){!_e||(typeof _e=="function"?_e(_.current):_e.current=_.current)})},[o]),_},ReactCropper=React.forwardRef(function(o,s){var _=__rest(o,[]),_e=_.dragMode,et=_e===void 0?"crop":_e,it=_.src,tt=_.style,rt=_.className,nt=_.crossOrigin,ot=_.scaleX,st=_.scaleY,at=_.enable,lt=_.zoomTo,ct=_.rotateTo,ht=_.alt,mt=ht===void 0?"picture":ht,dt=_.ready,ft=_.onInitialized,ut=__rest(_,["dragMode","src","style","className","crossOrigin","scaleX","scaleY","enable","zoomTo","rotateTo","alt","ready","onInitialized"]),pt={scaleY:st,scaleX:ot,enable:at,zoomTo:lt,rotateTo:ct},At=react.exports.useRef(null),gt=useCombinedRefs(s,At);return react.exports.useEffect(function(){var vt;((vt=gt.current)===null||vt===void 0?void 0:vt.cropper)&&typeof lt=="number"&&gt.current.cropper.zoomTo(lt)},[_.zoomTo]),react.exports.useEffect(function(){var vt;((vt=gt.current)===null||vt===void 0?void 0:vt.cropper)&&typeof it!="undefined"&&gt.current.cropper.reset().clear().replace(it)},[it]),react.exports.useEffect(function(){if(gt.current!==null){var vt=new Cropper(gt.current,__assign(__assign({dragMode:et},ut),{ready:function(yt){yt.currentTarget!==null&&applyDefaultOptions(yt.currentTarget.cropper,pt),dt&&dt(yt)}}));ft&&ft(vt)}return function(){var yt,bt;(bt=(yt=gt.current)===null||yt===void 0?void 0:yt.cropper)===null||bt===void 0||bt.destroy()}},[gt]),jsx("div",{style:tt,className:rt,children:jsx("img",{crossOrigin:nt,src:it,alt:mt,style:{opacity:0,maxWidth:"100%"},ref:gt})})}),cropper="";class ImageInput extends BaseComponent{constructor(_){super(_);Xn(this,"onCrop",()=>{const _=this.cropperRef.current.cropper.getCroppedCanvas().toDataURL();this.handleChange({src:this.props.value.src,crop:_})});this.handleChange=this.handleChange.bind(this),this.uploader=React.createRef(),this.openFileUpload=this.openFileUpload.bind(this),this.onImgLoad=this.onImgLoad.bind(this),this.load_preview_from_files=this.load_preview_from_files.bind(this),this.load_preview_from_upload=this.load_preview_from_upload.bind(this),this.load_preview_from_drop=this.load_preview_from_drop.bind(this),this.saveEditor=this.saveEditor.bind(this),this.cancelEditor=this.cancelEditor.bind(this),this.snapshot=this.snapshot.bind(this),this.getSketch=this.getSketch.bind(this),this.openEditor=this.openEditor.bind(this),this.imgRef=React.createRef(),this.webcamRef=React.createRef(),this.sketchRef=React.createRef(),this.editorRef=React.createRef(),this.cropperRef=React.createRef(),this.sketchKey=0,this.state={editorMode:!1}}handleChange(_){this.props.handleChange(_)}openFileUpload(){this.uploader.current.click()}snapshot(){let _=this.webcamRef.current.getScreenshot();this.handleChange({src:_,crop:null})}getSketch(){let _=this.sketchRef.current.toDataURL();this.handleChange({src:_,crop:null})}cancelEditor(){this.setState({editorMode:!1})}saveEditor(){const _=this.editorRef.current.getInstance();this.handleChange({src:_.toDataURL(),crop:null}),this.setState({editorMode:!1})}onImgLoad({target:_}){this.setState({dimensions:{height:_.offsetHeight,width:_.offsetWidth}})}openEditor(){this.setState({editorMode:!0})}render(){let _=_e=>{_e.preventDefault(),_e.stopPropagation()};if(this.props.value!==null&&this.props.source!=="canvas"){let _e=!1;if(this.props.interpretation!==null){let et=this.imgRef.current,it=getObjectFitSize(!0,et.width,et.height,et.naturalWidth,et.naturalHeight);this.props.shape&&(it=getObjectFitSize(!0,it.width,it.height,this.props.shape[0],this.props.shape[1]));let tt=it.width,rt=it.height,nt=document.createElement("canvas");nt.setAttribute("height",rt),nt.setAttribute("width",tt),paintSaliency(this.props.interpretation,nt.getContext("2d"),tt,rt),_e=jsx("div",{className:"interpretation",children:jsx("img",{src:nt.toDataURL()})})}return jsxs("div",{className:"input_image",children:[jsxs("div",{className:"image_preview_holder",children:[this.props.tool==="editor"?this.state.editorMode?jsxs("div",{className:"image_editor",children:[jsxs("div",{className:"image_editor_buttons",children:[jsx("button",{onClick:this.saveEditor,children:"Save"}),jsx("button",{onClick:this.cancelEditor,children:"Cancel"})]}),jsx(ImageEditor,{ref:this.editorRef,includeUI:{loadImage:{path:this.props.value.src,name:"value"},uiSize:{width:"800px",height:"600px"},menuBarPosition:"left"},cssMaxHeight:500,cssMaxWidth:700,usageStatistics:!1})]}):jsxs("div",{className:"edit_buttons",children:[jsx("button",{className:"edit_button",onClick:this.openEditor,children:jsx("img",{src:edit_icon})}),jsx("button",{className:"clear_button",onClick:this.handleChange.bind(this,null),children:jsx("img",{src:clear_icon})})]}):!1,this.props.tool==="select"?jsx(ReactCropper,{src:this.props.value.src,style:{height:"100%",width:"100%"},ref:this.cropperRef,crop:this.onCrop,autoCropArea:1}):jsx("img",{ref:this.imgRef,onLoad:this.onImgLoad,className:"image_preview",alt:"",src:this.props.value.src})]}),_e]})}else{if(this.props.source==="upload")return jsxs("div",{className:"input_image",onDrag:_,onDragStart:_,onDragEnd:_,onDragOver:_,onDragEnter:_,onDragLeave:_,onDrop:_,children:[jsxs("div",{className:"upload_zone",onClick:this.openFileUpload,onDrop:this.load_preview_from_drop,children:["Drop Image Here",jsx("br",{}),"- or -",jsx("br",{}),"Click to Upload"]}),jsx("input",{className:"hidden_upload",type:"file",ref:this.uploader,onChange:this.load_preview_from_upload,accept:"image/x-png,image/gif,image/jpeg",style:{display:"none"}})]});if(this.props.source==="webcam")return jsx("div",{className:"input_image",children:jsxs("div",{className:"image_preview_holder",children:[jsx(Webcam,{ref:this.webcamRef}),jsx("div",{className:"snapshot",children:jsx("button",{onClick:this.snapshot,children:"Click to Take Snapshot"})})]})});if(this.props.source==="canvas")return this.props.value===null&&this.sketchRef&&this.sketchRef.current&&(this.sketchKey+=1),jsx("div",{className:"input_image",children:jsx("div",{className:"image_preview_holder sketch",children:jsx(SketchField,{ref:this.sketchRef,width:"320px",height:"100%",tool:Tools.Pencil,lineColor:"black",lineWidth:20,backgroundColor:"white",onChange:this.getSketch},this.sketchKey)})})}}load_preview_from_drop(_){this.load_preview_from_files(_.dataTransfer.files)}load_preview_from_upload(_){this.load_preview_from_files(_.target.files)}load_preview_from_files(_){if(!(!_.length||!window.FileReader||!/^image/.test(_[0].type))){var _e=this,et=new FileReader;et.readAsDataURL(_[0]),et.onloadend=function(){_e.props.handleChange({src:this.result,crop:null})}}}}Xn(ImageInput,"memo",(_,_e)=>_.interpretation!=_e.interpretation?!1:_.value===null&&_e.value===null?!0:_.value===null||_e.value===null?!1:_.value.src===_e.value.src),Xn(ImageInput,"postprocess",_=>_===null?null:_.crop===null?_.src:_.crop);class ImageInputExample extends DataURLComponentExample{static async preprocess(s,_){return{src:await DataURLComponentExample.preprocess(s,_),crop:null}}render(){return jsx("img",{className:"input_image_example",src:this.props.examples_dir+"/"+this.props.value,alt:""})}}class NumberInput extends BaseComponent{constructor(s){super(s),this.handleChange=this.handleChange.bind(this)}handleChange(s){let _=s.target.value,_e=["","-",".","-."];(!isNaN(parseFloat(_))||_e.includes(_))&&this.props.handleChange(s.target.value)}render(){return jsx("div",{className:"input_number",children:this.props.interpretation===null?jsx("input",{type:"text",onChange:this.handleChange,value:this.props.value===null?"":this.props.value}):jsx("div",{className:"interpretation",children:this.props.interpretation.map((s,_)=>jsx("div",{className:"interpretation_box",style:{backgroundColor:getSaliencyColor(s[1])},children:s[0]},_))})})}}class NumberInputExample extends ComponentExample{render(){return jsx("div",{className:"input_number_example",children:this.props.value})}}class RadioInput extends BaseComponent{constructor(s){super(s),this.handleChange=this.handleChange.bind(this)}handleChange(s){this.props.handleChange(s)}render(){return jsx("div",{className:"input_radio",children:this.props.choices.map((s,_)=>jsx("div",{children:jsxs("div",{className:classNames("radio_item",{selected:s===this.props.value}),onClick:this.handleChange.bind(this,s),children:[this.props.interpretation===null?jsx("div",{className:"radio_circle"}):jsx("div",{className:"radio_circle",style:{backgroundColor:getSaliencyColor(this.props.interpretation[_])}}),s]})},_))})}}class RadioInputExample extends ComponentExample{render(){return jsx("div",{className:"input_radio_example",children:this.props.value})}}class SliderInput extends BaseComponent{constructor(s){super(s),this.handleChange=this.handleChange.bind(this)}handleChange(s){this.props.handleChange(parseFloat(s.target.value))}render(){return jsx("div",{className:"input_slider",children:this.props.interpretation===null?jsxs(Fragment,{children:[jsx("input",{type:"range",className:"range",onChange:this.handleChange,value:this.props.value,min:this.props.minimum,max:this.props.maximum,step:this.props.step}),jsx("div",{className:"value",children:this.props.value})]}):jsx("div",{className:"interpret_range",children:this.props.interpretation.map(s=>jsx("div",{style:{"background-color":getSaliencyColor(s)}}))})})}}class SliderInputExample extends ComponentExample{render(){return jsx("div",{className:"input_slider_example",children:this.props.value})}}class TextboxInput extends BaseComponent{constructor(s){super(s),this.handleChange=this.handleChange.bind(this)}handleChange(s){this.props.handleChange(s.target.value)}render(){return this.props.interpretation!==null?jsx("div",{className:"input_text",children:jsx("div",{className:"interpretation",children:this.props.interpretation.map((s,_)=>jsx("div",{className:"interpretation_box",style:{backgroundColor:getSaliencyColor(s[1])},children:s[0]},_))})}):this.props.lines>1?jsx("div",{className:"input_text",children:jsx("textarea",{value:this.props.value||"",rows:this.props.lines,onChange:this.handleChange,placeholder:this.props.placeholder||""})}):jsx("div",{className:"input_text",children:jsx("input",{type:"text",onChange:this.handleChange,value:this.props.value||"",placeholder:this.props.placeholder||""})})}}class TextboxInputExample extends ComponentExample{render(){return jsx("div",{className:"input_textbox_example",children:this.props.value})}}/*!
 * Chart.js v3.7.0
 * https://www.chartjs.org
 * (c) 2021 Chart.js Contributors
 * Released under the MIT License
 */const requestAnimFrame=function(){return typeof window=="undefined"?function(o){return o()}:window.requestAnimationFrame}();function throttled(o,s,_){const _e=_||(tt=>Array.prototype.slice.call(tt));let et=!1,it=[];return function(...tt){it=_e(tt),et||(et=!0,requestAnimFrame.call(window,()=>{et=!1,o.apply(s,it)}))}}function debounce(o,s){let _;return function(..._e){return s?(clearTimeout(_),_=setTimeout(o,s,_e)):o.apply(this,_e),s}}const _toLeftRightCenter=o=>o==="start"?"left":o==="end"?"right":"center",_alignStartEnd=(o,s,_)=>o==="start"?s:o==="end"?_:(s+_)/2,_textX=(o,s,_,_e)=>o===(_e?"left":"right")?_:o==="center"?(s+_)/2:s;function noop(){}const uid=function(){let o=0;return function(){return o++}}();function isNullOrUndef(o){return o===null||typeof o=="undefined"}function isArray(o){if(Array.isArray&&Array.isArray(o))return!0;const s=Object.prototype.toString.call(o);return s.substr(0,7)==="[object"&&s.substr(-6)==="Array]"}function isObject(o){return o!==null&&Object.prototype.toString.call(o)==="[object Object]"}const isNumberFinite=o=>(typeof o=="number"||o instanceof Number)&&isFinite(+o);function finiteOrDefault(o,s){return isNumberFinite(o)?o:s}function valueOrDefault(o,s){return typeof o=="undefined"?s:o}const toPercentage=(o,s)=>typeof o=="string"&&o.endsWith("%")?parseFloat(o)/100:o/s,toDimension=(o,s)=>typeof o=="string"&&o.endsWith("%")?parseFloat(o)/100*s:+o;function callback(o,s,_){if(o&&typeof o.call=="function")return o.apply(_,s)}function each(o,s,_,_e){let et,it,tt;if(isArray(o))if(it=o.length,_e)for(et=it-1;et>=0;et--)s.call(_,o[et],et);else for(et=0;et<it;et++)s.call(_,o[et],et);else if(isObject(o))for(tt=Object.keys(o),it=tt.length,et=0;et<it;et++)s.call(_,o[tt[et]],tt[et])}function _elementsEqual(o,s){let _,_e,et,it;if(!o||!s||o.length!==s.length)return!1;for(_=0,_e=o.length;_<_e;++_)if(et=o[_],it=s[_],et.datasetIndex!==it.datasetIndex||et.index!==it.index)return!1;return!0}function clone$1(o){if(isArray(o))return o.map(clone$1);if(isObject(o)){const s=Object.create(null),_=Object.keys(o),_e=_.length;let et=0;for(;et<_e;++et)s[_[et]]=clone$1(o[_[et]]);return s}return o}function isValidKey(o){return["__proto__","prototype","constructor"].indexOf(o)===-1}function _merger(o,s,_,_e){if(!isValidKey(o))return;const et=s[o],it=_[o];isObject(et)&&isObject(it)?merge(et,it,_e):s[o]=clone$1(it)}function merge(o,s,_){const _e=isArray(s)?s:[s],et=_e.length;if(!isObject(o))return o;_=_||{};const it=_.merger||_merger;for(let tt=0;tt<et;++tt){if(s=_e[tt],!isObject(s))continue;const rt=Object.keys(s);for(let nt=0,ot=rt.length;nt<ot;++nt)it(rt[nt],o,s,_)}return o}function mergeIf(o,s){return merge(o,s,{merger:_mergerIf})}function _mergerIf(o,s,_){if(!isValidKey(o))return;const _e=s[o],et=_[o];isObject(_e)&&isObject(et)?mergeIf(_e,et):Object.prototype.hasOwnProperty.call(s,o)||(s[o]=clone$1(et))}const emptyString="",dot=".";function indexOfDotOrLength(o,s){const _=o.indexOf(dot,s);return _===-1?o.length:_}function resolveObjectKey(o,s){if(s===emptyString)return o;let _=0,_e=indexOfDotOrLength(s,_);for(;o&&_e>_;)o=o[s.substr(_,_e-_)],_=_e+1,_e=indexOfDotOrLength(s,_);return o}function _capitalize(o){return o.charAt(0).toUpperCase()+o.slice(1)}const defined=o=>typeof o!="undefined",isFunction=o=>typeof o=="function",setsEqual=(o,s)=>{if(o.size!==s.size)return!1;for(const _ of o)if(!s.has(_))return!1;return!0};function _isClickEvent(o){return o.type==="mouseup"||o.type==="click"||o.type==="contextmenu"}const PI=Math.PI,TAU=2*PI,PITAU=TAU+PI,INFINITY=Number.POSITIVE_INFINITY,RAD_PER_DEG=PI/180,HALF_PI=PI/2,QUARTER_PI=PI/4,TWO_THIRDS_PI=PI*2/3,log10=Math.log10,sign=Math.sign;function niceNum(o){const s=Math.round(o);o=almostEquals(o,s,o/1e3)?s:o;const _=Math.pow(10,Math.floor(log10(o))),_e=o/_;return(_e<=1?1:_e<=2?2:_e<=5?5:10)*_}function _factorize(o){const s=[],_=Math.sqrt(o);let _e;for(_e=1;_e<_;_e++)o%_e===0&&(s.push(_e),s.push(o/_e));return _===(_|0)&&s.push(_),s.sort((et,it)=>et-it).pop(),s}function isNumber(o){return!isNaN(parseFloat(o))&&isFinite(o)}function almostEquals(o,s,_){return Math.abs(o-s)<_}function almostWhole(o,s){const _=Math.round(o);return _-s<=o&&_+s>=o}function _setMinAndMaxByKey(o,s,_){let _e,et,it;for(_e=0,et=o.length;_e<et;_e++)it=o[_e][_],isNaN(it)||(s.min=Math.min(s.min,it),s.max=Math.max(s.max,it))}function toRadians(o){return o*(PI/180)}function toDegrees(o){return o*(180/PI)}function _decimalPlaces(o){if(!isNumberFinite(o))return;let s=1,_=0;for(;Math.round(o*s)/s!==o;)s*=10,_++;return _}function getAngleFromPoint(o,s){const _=s.x-o.x,_e=s.y-o.y,et=Math.sqrt(_*_+_e*_e);let it=Math.atan2(_e,_);return it<-.5*PI&&(it+=TAU),{angle:it,distance:et}}function distanceBetweenPoints(o,s){return Math.sqrt(Math.pow(s.x-o.x,2)+Math.pow(s.y-o.y,2))}function _angleDiff(o,s){return(o-s+PITAU)%TAU-PI}function _normalizeAngle(o){return(o%TAU+TAU)%TAU}function _angleBetween(o,s,_,_e){const et=_normalizeAngle(o),it=_normalizeAngle(s),tt=_normalizeAngle(_),rt=_normalizeAngle(it-et),nt=_normalizeAngle(tt-et),ot=_normalizeAngle(et-it),st=_normalizeAngle(et-tt);return et===it||et===tt||_e&&it===tt||rt>nt&&ot<st}function _limitValue(o,s,_){return Math.max(s,Math.min(_,o))}function _int16Range(o){return _limitValue(o,-32768,32767)}function _isBetween(o,s,_,_e=1e-6){return o>=Math.min(s,_)-_e&&o<=Math.max(s,_)+_e}const atEdge=o=>o===0||o===1,elasticIn=(o,s,_)=>-(Math.pow(2,10*(o-=1))*Math.sin((o-s)*TAU/_)),elasticOut=(o,s,_)=>Math.pow(2,-10*o)*Math.sin((o-s)*TAU/_)+1,effects={linear:o=>o,easeInQuad:o=>o*o,easeOutQuad:o=>-o*(o-2),easeInOutQuad:o=>(o/=.5)<1?.5*o*o:-.5*(--o*(o-2)-1),easeInCubic:o=>o*o*o,easeOutCubic:o=>(o-=1)*o*o+1,easeInOutCubic:o=>(o/=.5)<1?.5*o*o*o:.5*((o-=2)*o*o+2),easeInQuart:o=>o*o*o*o,easeOutQuart:o=>-((o-=1)*o*o*o-1),easeInOutQuart:o=>(o/=.5)<1?.5*o*o*o*o:-.5*((o-=2)*o*o*o-2),easeInQuint:o=>o*o*o*o*o,easeOutQuint:o=>(o-=1)*o*o*o*o+1,easeInOutQuint:o=>(o/=.5)<1?.5*o*o*o*o*o:.5*((o-=2)*o*o*o*o+2),easeInSine:o=>-Math.cos(o*HALF_PI)+1,easeOutSine:o=>Math.sin(o*HALF_PI),easeInOutSine:o=>-.5*(Math.cos(PI*o)-1),easeInExpo:o=>o===0?0:Math.pow(2,10*(o-1)),easeOutExpo:o=>o===1?1:-Math.pow(2,-10*o)+1,easeInOutExpo:o=>atEdge(o)?o:o<.5?.5*Math.pow(2,10*(o*2-1)):.5*(-Math.pow(2,-10*(o*2-1))+2),easeInCirc:o=>o>=1?o:-(Math.sqrt(1-o*o)-1),easeOutCirc:o=>Math.sqrt(1-(o-=1)*o),easeInOutCirc:o=>(o/=.5)<1?-.5*(Math.sqrt(1-o*o)-1):.5*(Math.sqrt(1-(o-=2)*o)+1),easeInElastic:o=>atEdge(o)?o:elasticIn(o,.075,.3),easeOutElastic:o=>atEdge(o)?o:elasticOut(o,.075,.3),easeInOutElastic(o){return atEdge(o)?o:o<.5?.5*elasticIn(o*2,.1125,.45):.5+.5*elasticOut(o*2-1,.1125,.45)},easeInBack(o){return o*o*((1.70158+1)*o-1.70158)},easeOutBack(o){return(o-=1)*o*((1.70158+1)*o+1.70158)+1},easeInOutBack(o){let s=1.70158;return(o/=.5)<1?.5*(o*o*(((s*=1.525)+1)*o-s)):.5*((o-=2)*o*(((s*=1.525)+1)*o+s)+2)},easeInBounce:o=>1-effects.easeOutBounce(1-o),easeOutBounce(o){return o<1/2.75?7.5625*o*o:o<2/2.75?7.5625*(o-=1.5/2.75)*o+.75:o<2.5/2.75?7.5625*(o-=2.25/2.75)*o+.9375:7.5625*(o-=2.625/2.75)*o+.984375},easeInOutBounce:o=>o<.5?effects.easeInBounce(o*2)*.5:effects.easeOutBounce(o*2-1)*.5+.5};/*!
 * @kurkle/color v0.1.9
 * https://github.com/kurkle/color#readme
 * (c) 2020 Jukka Kurkela
 * Released under the MIT License
 */const map$1={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},hex="0123456789ABCDEF",h1=o=>hex[o&15],h2=o=>hex[(o&240)>>4]+hex[o&15],eq=o=>(o&240)>>4===(o&15);function isShort(o){return eq(o.r)&&eq(o.g)&&eq(o.b)&&eq(o.a)}function hexParse(o){var s=o.length,_;return o[0]==="#"&&(s===4||s===5?_={r:255&map$1[o[1]]*17,g:255&map$1[o[2]]*17,b:255&map$1[o[3]]*17,a:s===5?map$1[o[4]]*17:255}:(s===7||s===9)&&(_={r:map$1[o[1]]<<4|map$1[o[2]],g:map$1[o[3]]<<4|map$1[o[4]],b:map$1[o[5]]<<4|map$1[o[6]],a:s===9?map$1[o[7]]<<4|map$1[o[8]]:255})),_}function hexString(o){var s=isShort(o)?h1:h2;return o&&"#"+s(o.r)+s(o.g)+s(o.b)+(o.a<255?s(o.a):"")}function round(o){return o+.5|0}const lim=(o,s,_)=>Math.max(Math.min(o,_),s);function p2b(o){return lim(round(o*2.55),0,255)}function n2b(o){return lim(round(o*255),0,255)}function b2n(o){return lim(round(o/2.55)/100,0,1)}function n2p(o){return lim(round(o*100),0,100)}const RGB_RE=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function rgbParse(o){const s=RGB_RE.exec(o);let _=255,_e,et,it;if(!!s){if(s[7]!==_e){const tt=+s[7];_=255&(s[8]?p2b(tt):tt*255)}return _e=+s[1],et=+s[3],it=+s[5],_e=255&(s[2]?p2b(_e):_e),et=255&(s[4]?p2b(et):et),it=255&(s[6]?p2b(it):it),{r:_e,g:et,b:it,a:_}}}function rgbString(o){return o&&(o.a<255?`rgba(${o.r}, ${o.g}, ${o.b}, ${b2n(o.a)})`:`rgb(${o.r}, ${o.g}, ${o.b})`)}const HUE_RE=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function hsl2rgbn(o,s,_){const _e=s*Math.min(_,1-_),et=(it,tt=(it+o/30)%12)=>_-_e*Math.max(Math.min(tt-3,9-tt,1),-1);return[et(0),et(8),et(4)]}function hsv2rgbn(o,s,_){const _e=(et,it=(et+o/60)%6)=>_-_*s*Math.max(Math.min(it,4-it,1),0);return[_e(5),_e(3),_e(1)]}function hwb2rgbn(o,s,_){const _e=hsl2rgbn(o,1,.5);let et;for(s+_>1&&(et=1/(s+_),s*=et,_*=et),et=0;et<3;et++)_e[et]*=1-s-_,_e[et]+=s;return _e}function rgb2hsl(o){const _=o.r/255,_e=o.g/255,et=o.b/255,it=Math.max(_,_e,et),tt=Math.min(_,_e,et),rt=(it+tt)/2;let nt,ot,st;return it!==tt&&(st=it-tt,ot=rt>.5?st/(2-it-tt):st/(it+tt),nt=it===_?(_e-et)/st+(_e<et?6:0):it===_e?(et-_)/st+2:(_-_e)/st+4,nt=nt*60+.5),[nt|0,ot||0,rt]}function calln(o,s,_,_e){return(Array.isArray(s)?o(s[0],s[1],s[2]):o(s,_,_e)).map(n2b)}function hsl2rgb(o,s,_){return calln(hsl2rgbn,o,s,_)}function hwb2rgb(o,s,_){return calln(hwb2rgbn,o,s,_)}function hsv2rgb(o,s,_){return calln(hsv2rgbn,o,s,_)}function hue(o){return(o%360+360)%360}function hueParse(o){const s=HUE_RE.exec(o);let _=255,_e;if(!s)return;s[5]!==_e&&(_=s[6]?p2b(+s[5]):n2b(+s[5]));const et=hue(+s[2]),it=+s[3]/100,tt=+s[4]/100;return s[1]==="hwb"?_e=hwb2rgb(et,it,tt):s[1]==="hsv"?_e=hsv2rgb(et,it,tt):_e=hsl2rgb(et,it,tt),{r:_e[0],g:_e[1],b:_e[2],a:_}}function rotate(o,s){var _=rgb2hsl(o);_[0]=hue(_[0]+s),_=hsl2rgb(_),o.r=_[0],o.g=_[1],o.b=_[2]}function hslString(o){if(!o)return;const s=rgb2hsl(o),_=s[0],_e=n2p(s[1]),et=n2p(s[2]);return o.a<255?`hsla(${_}, ${_e}%, ${et}%, ${b2n(o.a)})`:`hsl(${_}, ${_e}%, ${et}%)`}const map$1$1={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},names={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function unpack(){const o={},s=Object.keys(names),_=Object.keys(map$1$1);let _e,et,it,tt,rt;for(_e=0;_e<s.length;_e++){for(tt=rt=s[_e],et=0;et<_.length;et++)it=_[et],rt=rt.replace(it,map$1$1[it]);it=parseInt(names[tt],16),o[rt]=[it>>16&255,it>>8&255,it&255]}return o}let names$1;function nameParse(o){names$1||(names$1=unpack(),names$1.transparent=[0,0,0,0]);const s=names$1[o.toLowerCase()];return s&&{r:s[0],g:s[1],b:s[2],a:s.length===4?s[3]:255}}function modHSL(o,s,_){if(o){let _e=rgb2hsl(o);_e[s]=Math.max(0,Math.min(_e[s]+_e[s]*_,s===0?360:1)),_e=hsl2rgb(_e),o.r=_e[0],o.g=_e[1],o.b=_e[2]}}function clone(o,s){return o&&Object.assign(s||{},o)}function fromObject(o){var s={r:0,g:0,b:0,a:255};return Array.isArray(o)?o.length>=3&&(s={r:o[0],g:o[1],b:o[2],a:255},o.length>3&&(s.a=n2b(o[3]))):(s=clone(o,{r:0,g:0,b:0,a:1}),s.a=n2b(s.a)),s}function functionParse(o){return o.charAt(0)==="r"?rgbParse(o):hueParse(o)}class Color{constructor(s){if(s instanceof Color)return s;const _=typeof s;let _e;_==="object"?_e=fromObject(s):_==="string"&&(_e=hexParse(s)||nameParse(s)||functionParse(s)),this._rgb=_e,this._valid=!!_e}get valid(){return this._valid}get rgb(){var s=clone(this._rgb);return s&&(s.a=b2n(s.a)),s}set rgb(s){this._rgb=fromObject(s)}rgbString(){return this._valid?rgbString(this._rgb):this._rgb}hexString(){return this._valid?hexString(this._rgb):this._rgb}hslString(){return this._valid?hslString(this._rgb):this._rgb}mix(s,_){const _e=this;if(s){const et=_e.rgb,it=s.rgb;let tt;const rt=_===tt?.5:_,nt=2*rt-1,ot=et.a-it.a,st=((nt*ot===-1?nt:(nt+ot)/(1+nt*ot))+1)/2;tt=1-st,et.r=255&st*et.r+tt*it.r+.5,et.g=255&st*et.g+tt*it.g+.5,et.b=255&st*et.b+tt*it.b+.5,et.a=rt*et.a+(1-rt)*it.a,_e.rgb=et}return _e}clone(){return new Color(this.rgb)}alpha(s){return this._rgb.a=n2b(s),this}clearer(s){const _=this._rgb;return _.a*=1-s,this}greyscale(){const s=this._rgb,_=round(s.r*.3+s.g*.59+s.b*.11);return s.r=s.g=s.b=_,this}opaquer(s){const _=this._rgb;return _.a*=1+s,this}negate(){const s=this._rgb;return s.r=255-s.r,s.g=255-s.g,s.b=255-s.b,this}lighten(s){return modHSL(this._rgb,2,s),this}darken(s){return modHSL(this._rgb,2,-s),this}saturate(s){return modHSL(this._rgb,1,s),this}desaturate(s){return modHSL(this._rgb,1,-s),this}rotate(s){return rotate(this._rgb,s),this}}function index_esm(o){return new Color(o)}const isPatternOrGradient=o=>o instanceof CanvasGradient||o instanceof CanvasPattern;function color(o){return isPatternOrGradient(o)?o:index_esm(o)}function getHoverColor(o){return isPatternOrGradient(o)?o:index_esm(o).saturate(.5).darken(.1).hexString()}const overrides=Object.create(null),descriptors=Object.create(null);function getScope$1(o,s){if(!s)return o;const _=s.split(".");for(let _e=0,et=_.length;_e<et;++_e){const it=_[_e];o=o[it]||(o[it]=Object.create(null))}return o}function set(o,s,_){return typeof s=="string"?merge(getScope$1(o,s),_):merge(getScope$1(o,""),s)}class Defaults{constructor(s){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=_=>_.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(_,_e)=>getHoverColor(_e.backgroundColor),this.hoverBorderColor=(_,_e)=>getHoverColor(_e.borderColor),this.hoverColor=(_,_e)=>getHoverColor(_e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(s)}set(s,_){return set(this,s,_)}get(s){return getScope$1(this,s)}describe(s,_){return set(descriptors,s,_)}override(s,_){return set(overrides,s,_)}route(s,_,_e,et){const it=getScope$1(this,s),tt=getScope$1(this,_e),rt="_"+_;Object.defineProperties(it,{[rt]:{value:it[_],writable:!0},[_]:{enumerable:!0,get(){const nt=this[rt],ot=tt[et];return isObject(nt)?Object.assign({},ot,nt):valueOrDefault(nt,ot)},set(nt){this[rt]=nt}}})}}var defaults=new Defaults({_scriptable:o=>!o.startsWith("on"),_indexable:o=>o!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function toFontString(o){return!o||isNullOrUndef(o.size)||isNullOrUndef(o.family)?null:(o.style?o.style+" ":"")+(o.weight?o.weight+" ":"")+o.size+"px "+o.family}function _measureText(o,s,_,_e,et){let it=s[et];return it||(it=s[et]=o.measureText(et).width,_.push(et)),it>_e&&(_e=it),_e}function _longestText(o,s,_,_e){_e=_e||{};let et=_e.data=_e.data||{},it=_e.garbageCollect=_e.garbageCollect||[];_e.font!==s&&(et=_e.data={},it=_e.garbageCollect=[],_e.font=s),o.save(),o.font=s;let tt=0;const rt=_.length;let nt,ot,st,at,lt;for(nt=0;nt<rt;nt++)if(at=_[nt],at!=null&&isArray(at)!==!0)tt=_measureText(o,et,it,tt,at);else if(isArray(at))for(ot=0,st=at.length;ot<st;ot++)lt=at[ot],lt!=null&&!isArray(lt)&&(tt=_measureText(o,et,it,tt,lt));o.restore();const ct=it.length/2;if(ct>_.length){for(nt=0;nt<ct;nt++)delete et[it[nt]];it.splice(0,ct)}return tt}function _alignPixel(o,s,_){const _e=o.currentDevicePixelRatio,et=_!==0?Math.max(_/2,.5):0;return Math.round((s-et)*_e)/_e+et}function clearCanvas(o,s){s=s||o.getContext("2d"),s.save(),s.resetTransform(),s.clearRect(0,0,o.width,o.height),s.restore()}function drawPoint(o,s,_,_e){let et,it,tt,rt,nt;const ot=s.pointStyle,st=s.rotation,at=s.radius;let lt=(st||0)*RAD_PER_DEG;if(ot&&typeof ot=="object"&&(et=ot.toString(),et==="[object HTMLImageElement]"||et==="[object HTMLCanvasElement]")){o.save(),o.translate(_,_e),o.rotate(lt),o.drawImage(ot,-ot.width/2,-ot.height/2,ot.width,ot.height),o.restore();return}if(!(isNaN(at)||at<=0)){switch(o.beginPath(),ot){default:o.arc(_,_e,at,0,TAU),o.closePath();break;case"triangle":o.moveTo(_+Math.sin(lt)*at,_e-Math.cos(lt)*at),lt+=TWO_THIRDS_PI,o.lineTo(_+Math.sin(lt)*at,_e-Math.cos(lt)*at),lt+=TWO_THIRDS_PI,o.lineTo(_+Math.sin(lt)*at,_e-Math.cos(lt)*at),o.closePath();break;case"rectRounded":nt=at*.516,rt=at-nt,it=Math.cos(lt+QUARTER_PI)*rt,tt=Math.sin(lt+QUARTER_PI)*rt,o.arc(_-it,_e-tt,nt,lt-PI,lt-HALF_PI),o.arc(_+tt,_e-it,nt,lt-HALF_PI,lt),o.arc(_+it,_e+tt,nt,lt,lt+HALF_PI),o.arc(_-tt,_e+it,nt,lt+HALF_PI,lt+PI),o.closePath();break;case"rect":if(!st){rt=Math.SQRT1_2*at,o.rect(_-rt,_e-rt,2*rt,2*rt);break}lt+=QUARTER_PI;case"rectRot":it=Math.cos(lt)*at,tt=Math.sin(lt)*at,o.moveTo(_-it,_e-tt),o.lineTo(_+tt,_e-it),o.lineTo(_+it,_e+tt),o.lineTo(_-tt,_e+it),o.closePath();break;case"crossRot":lt+=QUARTER_PI;case"cross":it=Math.cos(lt)*at,tt=Math.sin(lt)*at,o.moveTo(_-it,_e-tt),o.lineTo(_+it,_e+tt),o.moveTo(_+tt,_e-it),o.lineTo(_-tt,_e+it);break;case"star":it=Math.cos(lt)*at,tt=Math.sin(lt)*at,o.moveTo(_-it,_e-tt),o.lineTo(_+it,_e+tt),o.moveTo(_+tt,_e-it),o.lineTo(_-tt,_e+it),lt+=QUARTER_PI,it=Math.cos(lt)*at,tt=Math.sin(lt)*at,o.moveTo(_-it,_e-tt),o.lineTo(_+it,_e+tt),o.moveTo(_+tt,_e-it),o.lineTo(_-tt,_e+it);break;case"line":it=Math.cos(lt)*at,tt=Math.sin(lt)*at,o.moveTo(_-it,_e-tt),o.lineTo(_+it,_e+tt);break;case"dash":o.moveTo(_,_e),o.lineTo(_+Math.cos(lt)*at,_e+Math.sin(lt)*at);break}o.fill(),s.borderWidth>0&&o.stroke()}}function _isPointInArea(o,s,_){return _=_||.5,!s||o&&o.x>s.left-_&&o.x<s.right+_&&o.y>s.top-_&&o.y<s.bottom+_}function clipArea(o,s){o.save(),o.beginPath(),o.rect(s.left,s.top,s.right-s.left,s.bottom-s.top),o.clip()}function unclipArea(o){o.restore()}function _steppedLineTo(o,s,_,_e,et){if(!s)return o.lineTo(_.x,_.y);if(et==="middle"){const it=(s.x+_.x)/2;o.lineTo(it,s.y),o.lineTo(it,_.y)}else et==="after"!=!!_e?o.lineTo(s.x,_.y):o.lineTo(_.x,s.y);o.lineTo(_.x,_.y)}function _bezierCurveTo(o,s,_,_e){if(!s)return o.lineTo(_.x,_.y);o.bezierCurveTo(_e?s.cp1x:s.cp2x,_e?s.cp1y:s.cp2y,_e?_.cp2x:_.cp1x,_e?_.cp2y:_.cp1y,_.x,_.y)}function renderText(o,s,_,_e,et,it={}){const tt=isArray(s)?s:[s],rt=it.strokeWidth>0&&it.strokeColor!=="";let nt,ot;for(o.save(),o.font=et.string,setRenderOpts(o,it),nt=0;nt<tt.length;++nt)ot=tt[nt],rt&&(it.strokeColor&&(o.strokeStyle=it.strokeColor),isNullOrUndef(it.strokeWidth)||(o.lineWidth=it.strokeWidth),o.strokeText(ot,_,_e,it.maxWidth)),o.fillText(ot,_,_e,it.maxWidth),decorateText(o,_,_e,ot,it),_e+=et.lineHeight;o.restore()}function setRenderOpts(o,s){s.translation&&o.translate(s.translation[0],s.translation[1]),isNullOrUndef(s.rotation)||o.rotate(s.rotation),s.color&&(o.fillStyle=s.color),s.textAlign&&(o.textAlign=s.textAlign),s.textBaseline&&(o.textBaseline=s.textBaseline)}function decorateText(o,s,_,_e,et){if(et.strikethrough||et.underline){const it=o.measureText(_e),tt=s-it.actualBoundingBoxLeft,rt=s+it.actualBoundingBoxRight,nt=_-it.actualBoundingBoxAscent,ot=_+it.actualBoundingBoxDescent,st=et.strikethrough?(nt+ot)/2:ot;o.strokeStyle=o.fillStyle,o.beginPath(),o.lineWidth=et.decorationWidth||2,o.moveTo(tt,st),o.lineTo(rt,st),o.stroke()}}function addRoundedRectPath(o,s){const{x:_,y:_e,w:et,h:it,radius:tt}=s;o.arc(_+tt.topLeft,_e+tt.topLeft,tt.topLeft,-HALF_PI,PI,!0),o.lineTo(_,_e+it-tt.bottomLeft),o.arc(_+tt.bottomLeft,_e+it-tt.bottomLeft,tt.bottomLeft,PI,HALF_PI,!0),o.lineTo(_+et-tt.bottomRight,_e+it),o.arc(_+et-tt.bottomRight,_e+it-tt.bottomRight,tt.bottomRight,HALF_PI,0,!0),o.lineTo(_+et,_e+tt.topRight),o.arc(_+et-tt.topRight,_e+tt.topRight,tt.topRight,0,-HALF_PI,!0),o.lineTo(_+tt.topLeft,_e)}const LINE_HEIGHT=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),FONT_STYLE=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function toLineHeight(o,s){const _=(""+o).match(LINE_HEIGHT);if(!_||_[1]==="normal")return s*1.2;switch(o=+_[2],_[3]){case"px":return o;case"%":o/=100;break}return s*o}const numberOrZero=o=>+o||0;function _readValueToProps(o,s){const _={},_e=isObject(s),et=_e?Object.keys(s):s,it=isObject(o)?_e?tt=>valueOrDefault(o[tt],o[s[tt]]):tt=>o[tt]:()=>o;for(const tt of et)_[tt]=numberOrZero(it(tt));return _}function toTRBL(o){return _readValueToProps(o,{top:"y",right:"x",bottom:"y",left:"x"})}function toTRBLCorners(o){return _readValueToProps(o,["topLeft","topRight","bottomLeft","bottomRight"])}function toPadding(o){const s=toTRBL(o);return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function toFont(o,s){o=o||{},s=s||defaults.font;let _=valueOrDefault(o.size,s.size);typeof _=="string"&&(_=parseInt(_,10));let _e=valueOrDefault(o.style,s.style);_e&&!(""+_e).match(FONT_STYLE)&&(console.warn('Invalid font style specified: "'+_e+'"'),_e="");const et={family:valueOrDefault(o.family,s.family),lineHeight:toLineHeight(valueOrDefault(o.lineHeight,s.lineHeight),_),size:_,style:_e,weight:valueOrDefault(o.weight,s.weight),string:""};return et.string=toFontString(et),et}function resolve(o,s,_,_e){let et=!0,it,tt,rt;for(it=0,tt=o.length;it<tt;++it)if(rt=o[it],rt!==void 0&&(s!==void 0&&typeof rt=="function"&&(rt=rt(s),et=!1),_!==void 0&&isArray(rt)&&(rt=rt[_%rt.length],et=!1),rt!==void 0))return _e&&!et&&(_e.cacheable=!1),rt}function _addGrace(o,s,_){const{min:_e,max:et}=o,it=toDimension(s,(et-_e)/2),tt=(rt,nt)=>_&&rt===0?0:rt+nt;return{min:tt(_e,-Math.abs(it)),max:tt(et,it)}}function createContext(o,s){return Object.assign(Object.create(o),s)}function _lookup(o,s,_){_=_||(tt=>o[tt]<s);let _e=o.length-1,et=0,it;for(;_e-et>1;)it=et+_e>>1,_(it)?et=it:_e=it;return{lo:et,hi:_e}}const _lookupByKey=(o,s,_)=>_lookup(o,_,_e=>o[_e][s]<_),_rlookupByKey=(o,s,_)=>_lookup(o,_,_e=>o[_e][s]>=_);function _filterBetween(o,s,_){let _e=0,et=o.length;for(;_e<et&&o[_e]<s;)_e++;for(;et>_e&&o[et-1]>_;)et--;return _e>0||et<o.length?o.slice(_e,et):o}const arrayEvents=["push","pop","shift","splice","unshift"];function listenArrayEvents(o,s){if(o._chartjs){o._chartjs.listeners.push(s);return}Object.defineProperty(o,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[s]}}),arrayEvents.forEach(_=>{const _e="_onData"+_capitalize(_),et=o[_];Object.defineProperty(o,_,{configurable:!0,enumerable:!1,value(...it){const tt=et.apply(this,it);return o._chartjs.listeners.forEach(rt=>{typeof rt[_e]=="function"&&rt[_e](...it)}),tt}})})}function unlistenArrayEvents(o,s){const _=o._chartjs;if(!_)return;const _e=_.listeners,et=_e.indexOf(s);et!==-1&&_e.splice(et,1),!(_e.length>0)&&(arrayEvents.forEach(it=>{delete o[it]}),delete o._chartjs)}function _arrayUnique(o){const s=new Set;let _,_e;for(_=0,_e=o.length;_<_e;++_)s.add(o[_]);return s.size===_e?o:Array.from(s)}function _createResolver(o,s=[""],_=o,_e,et=()=>o[0]){defined(_e)||(_e=_resolve("_fallback",o));const it={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:o,_rootScopes:_,_fallback:_e,_getTarget:et,override:tt=>_createResolver([tt,...o],s,_,_e)};return new Proxy(it,{deleteProperty(tt,rt){return delete tt[rt],delete tt._keys,delete o[0][rt],!0},get(tt,rt){return _cached(tt,rt,()=>_resolveWithPrefixes(rt,s,o,tt))},getOwnPropertyDescriptor(tt,rt){return Reflect.getOwnPropertyDescriptor(tt._scopes[0],rt)},getPrototypeOf(){return Reflect.getPrototypeOf(o[0])},has(tt,rt){return getKeysFromAllScopes(tt).includes(rt)},ownKeys(tt){return getKeysFromAllScopes(tt)},set(tt,rt,nt){const ot=tt._storage||(tt._storage=et());return tt[rt]=ot[rt]=nt,delete tt._keys,!0}})}function _attachContext(o,s,_,_e){const et={_cacheable:!1,_proxy:o,_context:s,_subProxy:_,_stack:new Set,_descriptors:_descriptors(o,_e),setContext:it=>_attachContext(o,it,_,_e),override:it=>_attachContext(o.override(it),s,_,_e)};return new Proxy(et,{deleteProperty(it,tt){return delete it[tt],delete o[tt],!0},get(it,tt,rt){return _cached(it,tt,()=>_resolveWithContext(it,tt,rt))},getOwnPropertyDescriptor(it,tt){return it._descriptors.allKeys?Reflect.has(o,tt)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(o,tt)},getPrototypeOf(){return Reflect.getPrototypeOf(o)},has(it,tt){return Reflect.has(o,tt)},ownKeys(){return Reflect.ownKeys(o)},set(it,tt,rt){return o[tt]=rt,delete it[tt],!0}})}function _descriptors(o,s={scriptable:!0,indexable:!0}){const{_scriptable:_=s.scriptable,_indexable:_e=s.indexable,_allKeys:et=s.allKeys}=o;return{allKeys:et,scriptable:_,indexable:_e,isScriptable:isFunction(_)?_:()=>_,isIndexable:isFunction(_e)?_e:()=>_e}}const readKey=(o,s)=>o?o+_capitalize(s):s,needsSubResolver=(o,s)=>isObject(s)&&o!=="adapters"&&(Object.getPrototypeOf(s)===null||s.constructor===Object);function _cached(o,s,_){if(Object.prototype.hasOwnProperty.call(o,s))return o[s];const _e=_();return o[s]=_e,_e}function _resolveWithContext(o,s,_){const{_proxy:_e,_context:et,_subProxy:it,_descriptors:tt}=o;let rt=_e[s];return isFunction(rt)&&tt.isScriptable(s)&&(rt=_resolveScriptable(s,rt,o,_)),isArray(rt)&&rt.length&&(rt=_resolveArray(s,rt,o,tt.isIndexable)),needsSubResolver(s,rt)&&(rt=_attachContext(rt,et,it&&it[s],tt)),rt}function _resolveScriptable(o,s,_,_e){const{_proxy:et,_context:it,_subProxy:tt,_stack:rt}=_;if(rt.has(o))throw new Error("Recursion detected: "+Array.from(rt).join("->")+"->"+o);return rt.add(o),s=s(it,tt||_e),rt.delete(o),needsSubResolver(o,s)&&(s=createSubResolver(et._scopes,et,o,s)),s}function _resolveArray(o,s,_,_e){const{_proxy:et,_context:it,_subProxy:tt,_descriptors:rt}=_;if(defined(it.index)&&_e(o))s=s[it.index%s.length];else if(isObject(s[0])){const nt=s,ot=et._scopes.filter(st=>st!==nt);s=[];for(const st of nt){const at=createSubResolver(ot,et,o,st);s.push(_attachContext(at,it,tt&&tt[o],rt))}}return s}function resolveFallback(o,s,_){return isFunction(o)?o(s,_):o}const getScope=(o,s)=>o===!0?s:typeof o=="string"?resolveObjectKey(s,o):void 0;function addScopes(o,s,_,_e,et){for(const it of s){const tt=getScope(_,it);if(tt){o.add(tt);const rt=resolveFallback(tt._fallback,_,et);if(defined(rt)&&rt!==_&&rt!==_e)return rt}else if(tt===!1&&defined(_e)&&_!==_e)return null}return!1}function createSubResolver(o,s,_,_e){const et=s._rootScopes,it=resolveFallback(s._fallback,_,_e),tt=[...o,...et],rt=new Set;rt.add(_e);let nt=addScopesFromKey(rt,tt,_,it||_,_e);return nt===null||defined(it)&&it!==_&&(nt=addScopesFromKey(rt,tt,it,nt,_e),nt===null)?!1:_createResolver(Array.from(rt),[""],et,it,()=>subGetTarget(s,_,_e))}function addScopesFromKey(o,s,_,_e,et){for(;_;)_=addScopes(o,s,_,_e,et);return _}function subGetTarget(o,s,_){const _e=o._getTarget();s in _e||(_e[s]={});const et=_e[s];return isArray(et)&&isObject(_)?_:et}function _resolveWithPrefixes(o,s,_,_e){let et;for(const it of s)if(et=_resolve(readKey(it,o),_),defined(et))return needsSubResolver(o,et)?createSubResolver(_,_e,o,et):et}function _resolve(o,s){for(const _ of s){if(!_)continue;const _e=_[o];if(defined(_e))return _e}}function getKeysFromAllScopes(o){let s=o._keys;return s||(s=o._keys=resolveKeysFromAllScopes(o._scopes)),s}function resolveKeysFromAllScopes(o){const s=new Set;for(const _ of o)for(const _e of Object.keys(_).filter(et=>!et.startsWith("_")))s.add(_e);return Array.from(s)}const EPSILON=Number.EPSILON||1e-14,getPoint=(o,s)=>s<o.length&&!o[s].skip&&o[s],getValueAxis=o=>o==="x"?"y":"x";function splineCurve(o,s,_,_e){const et=o.skip?s:o,it=s,tt=_.skip?s:_,rt=distanceBetweenPoints(it,et),nt=distanceBetweenPoints(tt,it);let ot=rt/(rt+nt),st=nt/(rt+nt);ot=isNaN(ot)?0:ot,st=isNaN(st)?0:st;const at=_e*ot,lt=_e*st;return{previous:{x:it.x-at*(tt.x-et.x),y:it.y-at*(tt.y-et.y)},next:{x:it.x+lt*(tt.x-et.x),y:it.y+lt*(tt.y-et.y)}}}function monotoneAdjust(o,s,_){const _e=o.length;let et,it,tt,rt,nt,ot=getPoint(o,0);for(let st=0;st<_e-1;++st)if(nt=ot,ot=getPoint(o,st+1),!(!nt||!ot)){if(almostEquals(s[st],0,EPSILON)){_[st]=_[st+1]=0;continue}et=_[st]/s[st],it=_[st+1]/s[st],rt=Math.pow(et,2)+Math.pow(it,2),!(rt<=9)&&(tt=3/Math.sqrt(rt),_[st]=et*tt*s[st],_[st+1]=it*tt*s[st])}}function monotoneCompute(o,s,_="x"){const _e=getValueAxis(_),et=o.length;let it,tt,rt,nt=getPoint(o,0);for(let ot=0;ot<et;++ot){if(tt=rt,rt=nt,nt=getPoint(o,ot+1),!rt)continue;const st=rt[_],at=rt[_e];tt&&(it=(st-tt[_])/3,rt[`cp1${_}`]=st-it,rt[`cp1${_e}`]=at-it*s[ot]),nt&&(it=(nt[_]-st)/3,rt[`cp2${_}`]=st+it,rt[`cp2${_e}`]=at+it*s[ot])}}function splineCurveMonotone(o,s="x"){const _=getValueAxis(s),_e=o.length,et=Array(_e).fill(0),it=Array(_e);let tt,rt,nt,ot=getPoint(o,0);for(tt=0;tt<_e;++tt)if(rt=nt,nt=ot,ot=getPoint(o,tt+1),!!nt){if(ot){const st=ot[s]-nt[s];et[tt]=st!==0?(ot[_]-nt[_])/st:0}it[tt]=rt?ot?sign(et[tt-1])!==sign(et[tt])?0:(et[tt-1]+et[tt])/2:et[tt-1]:et[tt]}monotoneAdjust(o,et,it),monotoneCompute(o,it,s)}function capControlPoint(o,s,_){return Math.max(Math.min(o,_),s)}function capBezierPoints(o,s){let _,_e,et,it,tt,rt=_isPointInArea(o[0],s);for(_=0,_e=o.length;_<_e;++_)tt=it,it=rt,rt=_<_e-1&&_isPointInArea(o[_+1],s),it&&(et=o[_],tt&&(et.cp1x=capControlPoint(et.cp1x,s.left,s.right),et.cp1y=capControlPoint(et.cp1y,s.top,s.bottom)),rt&&(et.cp2x=capControlPoint(et.cp2x,s.left,s.right),et.cp2y=capControlPoint(et.cp2y,s.top,s.bottom)))}function _updateBezierControlPoints(o,s,_,_e,et){let it,tt,rt,nt;if(s.spanGaps&&(o=o.filter(ot=>!ot.skip)),s.cubicInterpolationMode==="monotone")splineCurveMonotone(o,et);else{let ot=_e?o[o.length-1]:o[0];for(it=0,tt=o.length;it<tt;++it)rt=o[it],nt=splineCurve(ot,rt,o[Math.min(it+1,tt-(_e?0:1))%tt],s.tension),rt.cp1x=nt.previous.x,rt.cp1y=nt.previous.y,rt.cp2x=nt.next.x,rt.cp2y=nt.next.y,ot=rt}s.capBezierPoints&&capBezierPoints(o,_)}function _isDomSupported(){return typeof window!="undefined"&&typeof document!="undefined"}function _getParentNode(o){let s=o.parentNode;return s&&s.toString()==="[object ShadowRoot]"&&(s=s.host),s}function parseMaxStyle(o,s,_){let _e;return typeof o=="string"?(_e=parseInt(o,10),o.indexOf("%")!==-1&&(_e=_e/100*s.parentNode[_])):_e=o,_e}const getComputedStyle$1=o=>window.getComputedStyle(o,null);function getStyle(o,s){return getComputedStyle$1(o).getPropertyValue(s)}const positions=["top","right","bottom","left"];function getPositionedStyle(o,s,_){const _e={};_=_?"-"+_:"";for(let et=0;et<4;et++){const it=positions[et];_e[it]=parseFloat(o[s+"-"+it+_])||0}return _e.width=_e.left+_e.right,_e.height=_e.top+_e.bottom,_e}const useOffsetPos=(o,s,_)=>(o>0||s>0)&&(!_||!_.shadowRoot);function getCanvasPosition(o,s){const _=o.native||o,_e=_.touches,et=_e&&_e.length?_e[0]:_,{offsetX:it,offsetY:tt}=et;let rt=!1,nt,ot;if(useOffsetPos(it,tt,_.target))nt=it,ot=tt;else{const st=s.getBoundingClientRect();nt=et.clientX-st.left,ot=et.clientY-st.top,rt=!0}return{x:nt,y:ot,box:rt}}function getRelativePosition$1(o,s){const{canvas:_,currentDevicePixelRatio:_e}=s,et=getComputedStyle$1(_),it=et.boxSizing==="border-box",tt=getPositionedStyle(et,"padding"),rt=getPositionedStyle(et,"border","width"),{x:nt,y:ot,box:st}=getCanvasPosition(o,_),at=tt.left+(st&&rt.left),lt=tt.top+(st&&rt.top);let{width:ct,height:ht}=s;return it&&(ct-=tt.width+rt.width,ht-=tt.height+rt.height),{x:Math.round((nt-at)/ct*_.width/_e),y:Math.round((ot-lt)/ht*_.height/_e)}}function getContainerSize(o,s,_){let _e,et;if(s===void 0||_===void 0){const it=_getParentNode(o);if(!it)s=o.clientWidth,_=o.clientHeight;else{const tt=it.getBoundingClientRect(),rt=getComputedStyle$1(it),nt=getPositionedStyle(rt,"border","width"),ot=getPositionedStyle(rt,"padding");s=tt.width-ot.width-nt.width,_=tt.height-ot.height-nt.height,_e=parseMaxStyle(rt.maxWidth,it,"clientWidth"),et=parseMaxStyle(rt.maxHeight,it,"clientHeight")}}return{width:s,height:_,maxWidth:_e||INFINITY,maxHeight:et||INFINITY}}const round1=o=>Math.round(o*10)/10;function getMaximumSize(o,s,_,_e){const et=getComputedStyle$1(o),it=getPositionedStyle(et,"margin"),tt=parseMaxStyle(et.maxWidth,o,"clientWidth")||INFINITY,rt=parseMaxStyle(et.maxHeight,o,"clientHeight")||INFINITY,nt=getContainerSize(o,s,_);let{width:ot,height:st}=nt;if(et.boxSizing==="content-box"){const at=getPositionedStyle(et,"border","width"),lt=getPositionedStyle(et,"padding");ot-=lt.width+at.width,st-=lt.height+at.height}return ot=Math.max(0,ot-it.width),st=Math.max(0,_e?Math.floor(ot/_e):st-it.height),ot=round1(Math.min(ot,tt,nt.maxWidth)),st=round1(Math.min(st,rt,nt.maxHeight)),ot&&!st&&(st=round1(ot/2)),{width:ot,height:st}}function retinaScale(o,s,_){const _e=s||1,et=Math.floor(o.height*_e),it=Math.floor(o.width*_e);o.height=et/_e,o.width=it/_e;const tt=o.canvas;return tt.style&&(_||!tt.style.height&&!tt.style.width)&&(tt.style.height=`${o.height}px`,tt.style.width=`${o.width}px`),o.currentDevicePixelRatio!==_e||tt.height!==et||tt.width!==it?(o.currentDevicePixelRatio=_e,tt.height=et,tt.width=it,o.ctx.setTransform(_e,0,0,_e,0,0),!0):!1}const supportsEventListenerOptions=function(){let o=!1;try{const s={get passive(){return o=!0,!1}};window.addEventListener("test",null,s),window.removeEventListener("test",null,s)}catch{}return o}();function readUsedSize(o,s){const _=getStyle(o,s),_e=_&&_.match(/^(\d+)(\.\d+)?px$/);return _e?+_e[1]:void 0}function _pointInLine(o,s,_,_e){return{x:o.x+_*(s.x-o.x),y:o.y+_*(s.y-o.y)}}function _steppedInterpolation(o,s,_,_e){return{x:o.x+_*(s.x-o.x),y:_e==="middle"?_<.5?o.y:s.y:_e==="after"?_<1?o.y:s.y:_>0?s.y:o.y}}function _bezierInterpolation(o,s,_,_e){const et={x:o.cp2x,y:o.cp2y},it={x:s.cp1x,y:s.cp1y},tt=_pointInLine(o,et,_),rt=_pointInLine(et,it,_),nt=_pointInLine(it,s,_),ot=_pointInLine(tt,rt,_),st=_pointInLine(rt,nt,_);return _pointInLine(ot,st,_)}const intlCache=new Map;function getNumberFormat(o,s){s=s||{};const _=o+JSON.stringify(s);let _e=intlCache.get(_);return _e||(_e=new Intl.NumberFormat(o,s),intlCache.set(_,_e)),_e}function formatNumber(o,s,_){return getNumberFormat(s,_).format(o)}const getRightToLeftAdapter=function(o,s){return{x(_){return o+o+s-_},setWidth(_){s=_},textAlign(_){return _==="center"?_:_==="right"?"left":"right"},xPlus(_,_e){return _-_e},leftForLtr(_,_e){return _-_e}}},getLeftToRightAdapter=function(){return{x(o){return o},setWidth(o){},textAlign(o){return o},xPlus(o,s){return o+s},leftForLtr(o,s){return o}}};function getRtlAdapter(o,s,_){return o?getRightToLeftAdapter(s,_):getLeftToRightAdapter()}function overrideTextDirection(o,s){let _,_e;(s==="ltr"||s==="rtl")&&(_=o.canvas.style,_e=[_.getPropertyValue("direction"),_.getPropertyPriority("direction")],_.setProperty("direction",s,"important"),o.prevTextDirection=_e)}function restoreTextDirection(o,s){s!==void 0&&(delete o.prevTextDirection,o.canvas.style.setProperty("direction",s[0],s[1]))}function propertyFn(o){return o==="angle"?{between:_angleBetween,compare:_angleDiff,normalize:_normalizeAngle}:{between:_isBetween,compare:(s,_)=>s-_,normalize:s=>s}}function normalizeSegment({start:o,end:s,count:_,loop:_e,style:et}){return{start:o%_,end:s%_,loop:_e&&(s-o+1)%_===0,style:et}}function getSegment(o,s,_){const{property:_e,start:et,end:it}=_,{between:tt,normalize:rt}=propertyFn(_e),nt=s.length;let{start:ot,end:st,loop:at}=o,lt,ct;if(at){for(ot+=nt,st+=nt,lt=0,ct=nt;lt<ct&&tt(rt(s[ot%nt][_e]),et,it);++lt)ot--,st--;ot%=nt,st%=nt}return st<ot&&(st+=nt),{start:ot,end:st,loop:at,style:o.style}}function _boundSegment(o,s,_){if(!_)return[o];const{property:_e,start:et,end:it}=_,tt=s.length,{compare:rt,between:nt,normalize:ot}=propertyFn(_e),{start:st,end:at,loop:lt,style:ct}=getSegment(o,s,_),ht=[];let mt=!1,dt=null,ft,ut,pt;const At=()=>nt(et,pt,ft)&&rt(et,pt)!==0,gt=()=>rt(it,ft)===0||nt(it,pt,ft),vt=()=>mt||At(),yt=()=>!mt||gt();for(let bt=st,Ct=st;bt<=at;++bt)ut=s[bt%tt],!ut.skip&&(ft=ot(ut[_e]),ft!==pt&&(mt=nt(ft,et,it),dt===null&&vt()&&(dt=rt(ft,et)===0?bt:Ct),dt!==null&&yt()&&(ht.push(normalizeSegment({start:dt,end:bt,loop:lt,count:tt,style:ct})),dt=null),Ct=bt,pt=ft));return dt!==null&&ht.push(normalizeSegment({start:dt,end:at,loop:lt,count:tt,style:ct})),ht}function _boundSegments(o,s){const _=[],_e=o.segments;for(let et=0;et<_e.length;et++){const it=_boundSegment(_e[et],o.points,s);it.length&&_.push(...it)}return _}function findStartAndEnd(o,s,_,_e){let et=0,it=s-1;if(_&&!_e)for(;et<s&&!o[et].skip;)et++;for(;et<s&&o[et].skip;)et++;for(et%=s,_&&(it+=et);it>et&&o[it%s].skip;)it--;return it%=s,{start:et,end:it}}function solidSegments(o,s,_,_e){const et=o.length,it=[];let tt=s,rt=o[s],nt;for(nt=s+1;nt<=_;++nt){const ot=o[nt%et];ot.skip||ot.stop?rt.skip||(_e=!1,it.push({start:s%et,end:(nt-1)%et,loop:_e}),s=tt=ot.stop?nt:null):(tt=nt,rt.skip&&(s=nt)),rt=ot}return tt!==null&&it.push({start:s%et,end:tt%et,loop:_e}),it}function _computeSegments(o,s){const _=o.points,_e=o.options.spanGaps,et=_.length;if(!et)return[];const it=!!o._loop,{start:tt,end:rt}=findStartAndEnd(_,et,it,_e);if(_e===!0)return splitByStyles(o,[{start:tt,end:rt,loop:it}],_,s);const nt=rt<tt?rt+et:rt,ot=!!o._fullLoop&&tt===0&&rt===et-1;return splitByStyles(o,solidSegments(_,tt,nt,ot),_,s)}function splitByStyles(o,s,_,_e){return!_e||!_e.setContext||!_?s:doSplitByStyles(o,s,_,_e)}function doSplitByStyles(o,s,_,_e){const et=o._chart.getContext(),it=readStyle(o.options),{_datasetIndex:tt,options:{spanGaps:rt}}=o,nt=_.length,ot=[];let st=it,at=s[0].start,lt=at;function ct(ht,mt,dt,ft){const ut=rt?-1:1;if(ht!==mt){for(ht+=nt;_[ht%nt].skip;)ht-=ut;for(;_[mt%nt].skip;)mt+=ut;ht%nt!==mt%nt&&(ot.push({start:ht%nt,end:mt%nt,loop:dt,style:ft}),st=ft,at=mt%nt)}}for(const ht of s){at=rt?at:ht.start;let mt=_[at%nt],dt;for(lt=at+1;lt<=ht.end;lt++){const ft=_[lt%nt];dt=readStyle(_e.setContext(createContext(et,{type:"segment",p0:mt,p1:ft,p0DataIndex:(lt-1)%nt,p1DataIndex:lt%nt,datasetIndex:tt}))),styleChanged(dt,st)&&ct(at,lt-1,ht.loop,st),mt=ft,st=dt}at<lt-1&&ct(at,lt-1,ht.loop,st)}return ot}function readStyle(o){return{backgroundColor:o.backgroundColor,borderCapStyle:o.borderCapStyle,borderDash:o.borderDash,borderDashOffset:o.borderDashOffset,borderJoinStyle:o.borderJoinStyle,borderWidth:o.borderWidth,borderColor:o.borderColor}}function styleChanged(o,s){return s&&JSON.stringify(o)!==JSON.stringify(s)}/*!
 * Chart.js v3.7.0
 * https://www.chartjs.org
 * (c) 2021 Chart.js Contributors
 * Released under the MIT License
 */class Animator{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(s,_,_e,et){const it=_.listeners[et],tt=_.duration;it.forEach(rt=>rt({chart:s,initial:_.initial,numSteps:tt,currentStep:Math.min(_e-_.start,tt)}))}_refresh(){this._request||(this._running=!0,this._request=requestAnimFrame.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(s=Date.now()){let _=0;this._charts.forEach((_e,et)=>{if(!_e.running||!_e.items.length)return;const it=_e.items;let tt=it.length-1,rt=!1,nt;for(;tt>=0;--tt)nt=it[tt],nt._active?(nt._total>_e.duration&&(_e.duration=nt._total),nt.tick(s),rt=!0):(it[tt]=it[it.length-1],it.pop());rt&&(et.draw(),this._notify(et,_e,s,"progress")),it.length||(_e.running=!1,this._notify(et,_e,s,"complete"),_e.initial=!1),_+=it.length}),this._lastDate=s,_===0&&(this._running=!1)}_getAnims(s){const _=this._charts;let _e=_.get(s);return _e||(_e={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},_.set(s,_e)),_e}listen(s,_,_e){this._getAnims(s).listeners[_].push(_e)}add(s,_){!_||!_.length||this._getAnims(s).items.push(..._)}has(s){return this._getAnims(s).items.length>0}start(s){const _=this._charts.get(s);!_||(_.running=!0,_.start=Date.now(),_.duration=_.items.reduce((_e,et)=>Math.max(_e,et._duration),0),this._refresh())}running(s){if(!this._running)return!1;const _=this._charts.get(s);return!(!_||!_.running||!_.items.length)}stop(s){const _=this._charts.get(s);if(!_||!_.items.length)return;const _e=_.items;let et=_e.length-1;for(;et>=0;--et)_e[et].cancel();_.items=[],this._notify(s,_,Date.now(),"complete")}remove(s){return this._charts.delete(s)}}var animator=new Animator;const transparent="transparent",interpolators={boolean(o,s,_){return _>.5?s:o},color(o,s,_){const _e=color(o||transparent),et=_e.valid&&color(s||transparent);return et&&et.valid?et.mix(_e,_).hexString():s},number(o,s,_){return o+(s-o)*_}};class Animation{constructor(s,_,_e,et){const it=_[_e];et=resolve([s.to,et,it,s.from]);const tt=resolve([s.from,it,et]);this._active=!0,this._fn=s.fn||interpolators[s.type||typeof tt],this._easing=effects[s.easing]||effects.linear,this._start=Math.floor(Date.now()+(s.delay||0)),this._duration=this._total=Math.floor(s.duration),this._loop=!!s.loop,this._target=_,this._prop=_e,this._from=tt,this._to=et,this._promises=void 0}active(){return this._active}update(s,_,_e){if(this._active){this._notify(!1);const et=this._target[this._prop],it=_e-this._start,tt=this._duration-it;this._start=_e,this._duration=Math.floor(Math.max(tt,s.duration)),this._total+=it,this._loop=!!s.loop,this._to=resolve([s.to,_,et,s.from]),this._from=resolve([s.from,et,_])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(s){const _=s-this._start,_e=this._duration,et=this._prop,it=this._from,tt=this._loop,rt=this._to;let nt;if(this._active=it!==rt&&(tt||_<_e),!this._active){this._target[et]=rt,this._notify(!0);return}if(_<0){this._target[et]=it;return}nt=_/_e%2,nt=tt&&nt>1?2-nt:nt,nt=this._easing(Math.min(1,Math.max(0,nt))),this._target[et]=this._fn(it,rt,nt)}wait(){const s=this._promises||(this._promises=[]);return new Promise((_,_e)=>{s.push({res:_,rej:_e})})}_notify(s){const _=s?"res":"rej",_e=this._promises||[];for(let et=0;et<_e.length;et++)_e[et][_]()}}const numbers=["x","y","borderWidth","radius","tension"],colors=["color","borderColor","backgroundColor"];defaults.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const animationOptions=Object.keys(defaults.animation);defaults.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:o=>o!=="onProgress"&&o!=="onComplete"&&o!=="fn"});defaults.set("animations",{colors:{type:"color",properties:colors},numbers:{type:"number",properties:numbers}});defaults.describe("animations",{_fallback:"animation"});defaults.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:o=>o|0}}}});class Animations{constructor(s,_){this._chart=s,this._properties=new Map,this.configure(_)}configure(s){if(!isObject(s))return;const _=this._properties;Object.getOwnPropertyNames(s).forEach(_e=>{const et=s[_e];if(!isObject(et))return;const it={};for(const tt of animationOptions)it[tt]=et[tt];(isArray(et.properties)&&et.properties||[_e]).forEach(tt=>{(tt===_e||!_.has(tt))&&_.set(tt,it)})})}_animateOptions(s,_){const _e=_.options,et=resolveTargetOptions(s,_e);if(!et)return[];const it=this._createAnimations(et,_e);return _e.$shared&&awaitAll(s.options.$animations,_e).then(()=>{s.options=_e},()=>{}),it}_createAnimations(s,_){const _e=this._properties,et=[],it=s.$animations||(s.$animations={}),tt=Object.keys(_),rt=Date.now();let nt;for(nt=tt.length-1;nt>=0;--nt){const ot=tt[nt];if(ot.charAt(0)==="$")continue;if(ot==="options"){et.push(...this._animateOptions(s,_));continue}const st=_[ot];let at=it[ot];const lt=_e.get(ot);if(at)if(lt&&at.active()){at.update(lt,st,rt);continue}else at.cancel();if(!lt||!lt.duration){s[ot]=st;continue}it[ot]=at=new Animation(lt,s,ot,st),et.push(at)}return et}update(s,_){if(this._properties.size===0){Object.assign(s,_);return}const _e=this._createAnimations(s,_);if(_e.length)return animator.add(this._chart,_e),!0}}function awaitAll(o,s){const _=[],_e=Object.keys(s);for(let et=0;et<_e.length;et++){const it=o[_e[et]];it&&it.active()&&_.push(it.wait())}return Promise.all(_)}function resolveTargetOptions(o,s){if(!s)return;let _=o.options;if(!_){o.options=s;return}return _.$shared&&(o.options=_=Object.assign({},_,{$shared:!1,$animations:{}})),_}function scaleClip(o,s){const _=o&&o.options||{},_e=_.reverse,et=_.min===void 0?s:0,it=_.max===void 0?s:0;return{start:_e?it:et,end:_e?et:it}}function defaultClip(o,s,_){if(_===!1)return!1;const _e=scaleClip(o,_),et=scaleClip(s,_);return{top:et.end,right:_e.end,bottom:et.start,left:_e.start}}function toClip(o){let s,_,_e,et;return isObject(o)?(s=o.top,_=o.right,_e=o.bottom,et=o.left):s=_=_e=et=o,{top:s,right:_,bottom:_e,left:et,disabled:o===!1}}function getSortedDatasetIndices(o,s){const _=[],_e=o._getSortedDatasetMetas(s);let et,it;for(et=0,it=_e.length;et<it;++et)_.push(_e[et].index);return _}function applyStack(o,s,_,_e={}){const et=o.keys,it=_e.mode==="single";let tt,rt,nt,ot;if(s!==null){for(tt=0,rt=et.length;tt<rt;++tt){if(nt=+et[tt],nt===_){if(_e.all)continue;break}ot=o.values[nt],isNumberFinite(ot)&&(it||s===0||sign(s)===sign(ot))&&(s+=ot)}return s}}function convertObjectDataToArray(o){const s=Object.keys(o),_=new Array(s.length);let _e,et,it;for(_e=0,et=s.length;_e<et;++_e)it=s[_e],_[_e]={x:it,y:o[it]};return _}function isStacked(o,s){const _=o&&o.options.stacked;return _||_===void 0&&s.stack!==void 0}function getStackKey(o,s,_){return`${o.id}.${s.id}.${_.stack||_.type}`}function getUserBounds(o){const{min:s,max:_,minDefined:_e,maxDefined:et}=o.getUserBounds();return{min:_e?s:Number.NEGATIVE_INFINITY,max:et?_:Number.POSITIVE_INFINITY}}function getOrCreateStack(o,s,_){const _e=o[s]||(o[s]={});return _e[_]||(_e[_]={})}function getLastIndexInStack(o,s,_,_e){for(const et of s.getMatchingVisibleMetas(_e).reverse()){const it=o[et.index];if(_&&it>0||!_&&it<0)return et.index}return null}function updateStacks(o,s){const{chart:_,_cachedMeta:_e}=o,et=_._stacks||(_._stacks={}),{iScale:it,vScale:tt,index:rt}=_e,nt=it.axis,ot=tt.axis,st=getStackKey(it,tt,_e),at=s.length;let lt;for(let ct=0;ct<at;++ct){const ht=s[ct],{[nt]:mt,[ot]:dt}=ht,ft=ht._stacks||(ht._stacks={});lt=ft[ot]=getOrCreateStack(et,st,mt),lt[rt]=dt,lt._top=getLastIndexInStack(lt,tt,!0,_e.type),lt._bottom=getLastIndexInStack(lt,tt,!1,_e.type)}}function getFirstScaleId(o,s){const _=o.scales;return Object.keys(_).filter(_e=>_[_e].axis===s).shift()}function createDatasetContext(o,s){return createContext(o,{active:!1,dataset:void 0,datasetIndex:s,index:s,mode:"default",type:"dataset"})}function createDataContext(o,s,_){return createContext(o,{active:!1,dataIndex:s,parsed:void 0,raw:void 0,element:_,index:s,mode:"default",type:"data"})}function clearStacks(o,s){const _=o.controller.index,_e=o.vScale&&o.vScale.axis;if(!!_e){s=s||o._parsed;for(const et of s){const it=et._stacks;if(!it||it[_e]===void 0||it[_e][_]===void 0)return;delete it[_e][_]}}}const isDirectUpdateMode=o=>o==="reset"||o==="none",cloneIfNotShared=(o,s)=>s?o:Object.assign({},o),createStack=(o,s,_)=>o&&!s.hidden&&s._stacked&&{keys:getSortedDatasetIndices(_,!0),values:null};class DatasetController{constructor(s,_){this.chart=s,this._ctx=s.ctx,this.index=_,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const s=this._cachedMeta;this.configure(),this.linkScales(),s._stacked=isStacked(s.vScale,s),this.addElements()}updateIndex(s){this.index!==s&&clearStacks(this._cachedMeta),this.index=s}linkScales(){const s=this.chart,_=this._cachedMeta,_e=this.getDataset(),et=(at,lt,ct,ht)=>at==="x"?lt:at==="r"?ht:ct,it=_.xAxisID=valueOrDefault(_e.xAxisID,getFirstScaleId(s,"x")),tt=_.yAxisID=valueOrDefault(_e.yAxisID,getFirstScaleId(s,"y")),rt=_.rAxisID=valueOrDefault(_e.rAxisID,getFirstScaleId(s,"r")),nt=_.indexAxis,ot=_.iAxisID=et(nt,it,tt,rt),st=_.vAxisID=et(nt,tt,it,rt);_.xScale=this.getScaleForId(it),_.yScale=this.getScaleForId(tt),_.rScale=this.getScaleForId(rt),_.iScale=this.getScaleForId(ot),_.vScale=this.getScaleForId(st)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(s){return this.chart.scales[s]}_getOtherScale(s){const _=this._cachedMeta;return s===_.iScale?_.vScale:_.iScale}reset(){this._update("reset")}_destroy(){const s=this._cachedMeta;this._data&&unlistenArrayEvents(this._data,this),s._stacked&&clearStacks(s)}_dataCheck(){const s=this.getDataset(),_=s.data||(s.data=[]),_e=this._data;if(isObject(_))this._data=convertObjectDataToArray(_);else if(_e!==_){if(_e){unlistenArrayEvents(_e,this);const et=this._cachedMeta;clearStacks(et),et._parsed=[]}_&&Object.isExtensible(_)&&listenArrayEvents(_,this),this._syncList=[],this._data=_}}addElements(){const s=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(s.dataset=new this.datasetElementType)}buildOrUpdateElements(s){const _=this._cachedMeta,_e=this.getDataset();let et=!1;this._dataCheck();const it=_._stacked;_._stacked=isStacked(_.vScale,_),_.stack!==_e.stack&&(et=!0,clearStacks(_),_.stack=_e.stack),this._resyncElements(s),(et||it!==_._stacked)&&updateStacks(this,_._parsed)}configure(){const s=this.chart.config,_=s.datasetScopeKeys(this._type),_e=s.getOptionScopes(this.getDataset(),_,!0);this.options=s.createResolver(_e,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(s,_){const{_cachedMeta:_e,_data:et}=this,{iScale:it,_stacked:tt}=_e,rt=it.axis;let nt=s===0&&_===et.length?!0:_e._sorted,ot=s>0&&_e._parsed[s-1],st,at,lt;if(this._parsing===!1)_e._parsed=et,_e._sorted=!0,lt=et;else{isArray(et[s])?lt=this.parseArrayData(_e,et,s,_):isObject(et[s])?lt=this.parseObjectData(_e,et,s,_):lt=this.parsePrimitiveData(_e,et,s,_);const ct=()=>at[rt]===null||ot&&at[rt]<ot[rt];for(st=0;st<_;++st)_e._parsed[st+s]=at=lt[st],nt&&(ct()&&(nt=!1),ot=at);_e._sorted=nt}tt&&updateStacks(this,lt)}parsePrimitiveData(s,_,_e,et){const{iScale:it,vScale:tt}=s,rt=it.axis,nt=tt.axis,ot=it.getLabels(),st=it===tt,at=new Array(et);let lt,ct,ht;for(lt=0,ct=et;lt<ct;++lt)ht=lt+_e,at[lt]={[rt]:st||it.parse(ot[ht],ht),[nt]:tt.parse(_[ht],ht)};return at}parseArrayData(s,_,_e,et){const{xScale:it,yScale:tt}=s,rt=new Array(et);let nt,ot,st,at;for(nt=0,ot=et;nt<ot;++nt)st=nt+_e,at=_[st],rt[nt]={x:it.parse(at[0],st),y:tt.parse(at[1],st)};return rt}parseObjectData(s,_,_e,et){const{xScale:it,yScale:tt}=s,{xAxisKey:rt="x",yAxisKey:nt="y"}=this._parsing,ot=new Array(et);let st,at,lt,ct;for(st=0,at=et;st<at;++st)lt=st+_e,ct=_[lt],ot[st]={x:it.parse(resolveObjectKey(ct,rt),lt),y:tt.parse(resolveObjectKey(ct,nt),lt)};return ot}getParsed(s){return this._cachedMeta._parsed[s]}getDataElement(s){return this._cachedMeta.data[s]}applyStack(s,_,_e){const et=this.chart,it=this._cachedMeta,tt=_[s.axis],rt={keys:getSortedDatasetIndices(et,!0),values:_._stacks[s.axis]};return applyStack(rt,tt,it.index,{mode:_e})}updateRangeFromParsed(s,_,_e,et){const it=_e[_.axis];let tt=it===null?NaN:it;const rt=et&&_e._stacks[_.axis];et&&rt&&(et.values=rt,tt=applyStack(et,it,this._cachedMeta.index)),s.min=Math.min(s.min,tt),s.max=Math.max(s.max,tt)}getMinMax(s,_){const _e=this._cachedMeta,et=_e._parsed,it=_e._sorted&&s===_e.iScale,tt=et.length,rt=this._getOtherScale(s),nt=createStack(_,_e,this.chart),ot={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:st,max:at}=getUserBounds(rt);let lt,ct;function ht(){ct=et[lt];const mt=ct[rt.axis];return!isNumberFinite(ct[s.axis])||st>mt||at<mt}for(lt=0;lt<tt&&!(!ht()&&(this.updateRangeFromParsed(ot,s,ct,nt),it));++lt);if(it){for(lt=tt-1;lt>=0;--lt)if(!ht()){this.updateRangeFromParsed(ot,s,ct,nt);break}}return ot}getAllParsedValues(s){const _=this._cachedMeta._parsed,_e=[];let et,it,tt;for(et=0,it=_.length;et<it;++et)tt=_[et][s.axis],isNumberFinite(tt)&&_e.push(tt);return _e}getMaxOverflow(){return!1}getLabelAndValue(s){const _=this._cachedMeta,_e=_.iScale,et=_.vScale,it=this.getParsed(s);return{label:_e?""+_e.getLabelForValue(it[_e.axis]):"",value:et?""+et.getLabelForValue(it[et.axis]):""}}_update(s){const _=this._cachedMeta;this.update(s||"default"),_._clip=toClip(valueOrDefault(this.options.clip,defaultClip(_.xScale,_.yScale,this.getMaxOverflow())))}update(s){}draw(){const s=this._ctx,_=this.chart,_e=this._cachedMeta,et=_e.data||[],it=_.chartArea,tt=[],rt=this._drawStart||0,nt=this._drawCount||et.length-rt,ot=this.options.drawActiveElementsOnTop;let st;for(_e.dataset&&_e.dataset.draw(s,it,rt,nt),st=rt;st<rt+nt;++st){const at=et[st];at.hidden||(at.active&&ot?tt.push(at):at.draw(s,it))}for(st=0;st<tt.length;++st)tt[st].draw(s,it)}getStyle(s,_){const _e=_?"active":"default";return s===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(_e):this.resolveDataElementOptions(s||0,_e)}getContext(s,_,_e){const et=this.getDataset();let it;if(s>=0&&s<this._cachedMeta.data.length){const tt=this._cachedMeta.data[s];it=tt.$context||(tt.$context=createDataContext(this.getContext(),s,tt)),it.parsed=this.getParsed(s),it.raw=et.data[s],it.index=it.dataIndex=s}else it=this.$context||(this.$context=createDatasetContext(this.chart.getContext(),this.index)),it.dataset=et,it.index=it.datasetIndex=this.index;return it.active=!!_,it.mode=_e,it}resolveDatasetElementOptions(s){return this._resolveElementOptions(this.datasetElementType.id,s)}resolveDataElementOptions(s,_){return this._resolveElementOptions(this.dataElementType.id,_,s)}_resolveElementOptions(s,_="default",_e){const et=_==="active",it=this._cachedDataOpts,tt=s+"-"+_,rt=it[tt],nt=this.enableOptionSharing&&defined(_e);if(rt)return cloneIfNotShared(rt,nt);const ot=this.chart.config,st=ot.datasetElementScopeKeys(this._type,s),at=et?[`${s}Hover`,"hover",s,""]:[s,""],lt=ot.getOptionScopes(this.getDataset(),st),ct=Object.keys(defaults.elements[s]),ht=()=>this.getContext(_e,et),mt=ot.resolveNamedOptions(lt,ct,ht,at);return mt.$shared&&(mt.$shared=nt,it[tt]=Object.freeze(cloneIfNotShared(mt,nt))),mt}_resolveAnimations(s,_,_e){const et=this.chart,it=this._cachedDataOpts,tt=`animation-${_}`,rt=it[tt];if(rt)return rt;let nt;if(et.options.animation!==!1){const st=this.chart.config,at=st.datasetAnimationScopeKeys(this._type,_),lt=st.getOptionScopes(this.getDataset(),at);nt=st.createResolver(lt,this.getContext(s,_e,_))}const ot=new Animations(et,nt&&nt.animations);return nt&&nt._cacheable&&(it[tt]=Object.freeze(ot)),ot}getSharedOptions(s){if(!!s.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},s))}includeOptions(s,_){return!_||isDirectUpdateMode(s)||this.chart._animationsDisabled}updateElement(s,_,_e,et){isDirectUpdateMode(et)?Object.assign(s,_e):this._resolveAnimations(_,et).update(s,_e)}updateSharedOptions(s,_,_e){s&&!isDirectUpdateMode(_)&&this._resolveAnimations(void 0,_).update(s,_e)}_setStyle(s,_,_e,et){s.active=et;const it=this.getStyle(_,et);this._resolveAnimations(_,_e,et).update(s,{options:!et&&this.getSharedOptions(it)||it})}removeHoverStyle(s,_,_e){this._setStyle(s,_e,"active",!1)}setHoverStyle(s,_,_e){this._setStyle(s,_e,"active",!0)}_removeDatasetHoverStyle(){const s=this._cachedMeta.dataset;s&&this._setStyle(s,void 0,"active",!1)}_setDatasetHoverStyle(){const s=this._cachedMeta.dataset;s&&this._setStyle(s,void 0,"active",!0)}_resyncElements(s){const _=this._data,_e=this._cachedMeta.data;for(const[rt,nt,ot]of this._syncList)this[rt](nt,ot);this._syncList=[];const et=_e.length,it=_.length,tt=Math.min(it,et);tt&&this.parse(0,tt),it>et?this._insertElements(et,it-et,s):it<et&&this._removeElements(it,et-it)}_insertElements(s,_,_e=!0){const et=this._cachedMeta,it=et.data,tt=s+_;let rt;const nt=ot=>{for(ot.length+=_,rt=ot.length-1;rt>=tt;rt--)ot[rt]=ot[rt-_]};for(nt(it),rt=s;rt<tt;++rt)it[rt]=new this.dataElementType;this._parsing&&nt(et._parsed),this.parse(s,_),_e&&this.updateElements(it,s,_,"reset")}updateElements(s,_,_e,et){}_removeElements(s,_){const _e=this._cachedMeta;if(this._parsing){const et=_e._parsed.splice(s,_);_e._stacked&&clearStacks(_e,et)}_e.data.splice(s,_)}_sync(s){if(this._parsing)this._syncList.push(s);else{const[_,_e,et]=s;this[_](_e,et)}this.chart._dataChanges.push([this.index,...s])}_onDataPush(){const s=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-s,s])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(s,_){_&&this._sync(["_removeElements",s,_]);const _e=arguments.length-2;_e&&this._sync(["_insertElements",s,_e])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}DatasetController.defaults={};DatasetController.prototype.datasetElementType=null;DatasetController.prototype.dataElementType=null;function getAllScaleValues(o,s){if(!o._cache.$bar){const _=o.getMatchingVisibleMetas(s);let _e=[];for(let et=0,it=_.length;et<it;et++)_e=_e.concat(_[et].controller.getAllParsedValues(o));o._cache.$bar=_arrayUnique(_e.sort((et,it)=>et-it))}return o._cache.$bar}function computeMinSampleSize(o){const s=o.iScale,_=getAllScaleValues(s,o.type);let _e=s._length,et,it,tt,rt;const nt=()=>{tt===32767||tt===-32768||(defined(rt)&&(_e=Math.min(_e,Math.abs(tt-rt)||_e)),rt=tt)};for(et=0,it=_.length;et<it;++et)tt=s.getPixelForValue(_[et]),nt();for(rt=void 0,et=0,it=s.ticks.length;et<it;++et)tt=s.getPixelForTick(et),nt();return _e}function computeFitCategoryTraits(o,s,_,_e){const et=_.barThickness;let it,tt;return isNullOrUndef(et)?(it=s.min*_.categoryPercentage,tt=_.barPercentage):(it=et*_e,tt=1),{chunk:it/_e,ratio:tt,start:s.pixels[o]-it/2}}function computeFlexCategoryTraits(o,s,_,_e){const et=s.pixels,it=et[o];let tt=o>0?et[o-1]:null,rt=o<et.length-1?et[o+1]:null;const nt=_.categoryPercentage;tt===null&&(tt=it-(rt===null?s.end-s.start:rt-it)),rt===null&&(rt=it+it-tt);const ot=it-(it-Math.min(tt,rt))/2*nt;return{chunk:Math.abs(rt-tt)/2*nt/_e,ratio:_.barPercentage,start:ot}}function parseFloatBar(o,s,_,_e){const et=_.parse(o[0],_e),it=_.parse(o[1],_e),tt=Math.min(et,it),rt=Math.max(et,it);let nt=tt,ot=rt;Math.abs(tt)>Math.abs(rt)&&(nt=rt,ot=tt),s[_.axis]=ot,s._custom={barStart:nt,barEnd:ot,start:et,end:it,min:tt,max:rt}}function parseValue(o,s,_,_e){return isArray(o)?parseFloatBar(o,s,_,_e):s[_.axis]=_.parse(o,_e),s}function parseArrayOrPrimitive(o,s,_,_e){const et=o.iScale,it=o.vScale,tt=et.getLabels(),rt=et===it,nt=[];let ot,st,at,lt;for(ot=_,st=_+_e;ot<st;++ot)lt=s[ot],at={},at[et.axis]=rt||et.parse(tt[ot],ot),nt.push(parseValue(lt,at,it,ot));return nt}function isFloatBar(o){return o&&o.barStart!==void 0&&o.barEnd!==void 0}function barSign(o,s,_){return o!==0?sign(o):(s.isHorizontal()?1:-1)*(s.min>=_?1:-1)}function borderProps(o){let s,_,_e,et,it;return o.horizontal?(s=o.base>o.x,_="left",_e="right"):(s=o.base<o.y,_="bottom",_e="top"),s?(et="end",it="start"):(et="start",it="end"),{start:_,end:_e,reverse:s,top:et,bottom:it}}function setBorderSkipped(o,s,_,_e){let et=s.borderSkipped;const it={};if(!et){o.borderSkipped=it;return}const{start:tt,end:rt,reverse:nt,top:ot,bottom:st}=borderProps(o);et==="middle"&&_&&(o.enableBorderRadius=!0,(_._top||0)===_e?et=ot:(_._bottom||0)===_e?et=st:(it[parseEdge(st,tt,rt,nt)]=!0,et=ot)),it[parseEdge(et,tt,rt,nt)]=!0,o.borderSkipped=it}function parseEdge(o,s,_,_e){return _e?(o=swap(o,s,_),o=startEnd(o,_,s)):o=startEnd(o,s,_),o}function swap(o,s,_){return o===s?_:o===_?s:o}function startEnd(o,s,_){return o==="start"?s:o==="end"?_:o}function setInflateAmount(o,{inflateAmount:s},_){o.inflateAmount=s==="auto"?_===1?.33:0:s}class BarController extends DatasetController{parsePrimitiveData(s,_,_e,et){return parseArrayOrPrimitive(s,_,_e,et)}parseArrayData(s,_,_e,et){return parseArrayOrPrimitive(s,_,_e,et)}parseObjectData(s,_,_e,et){const{iScale:it,vScale:tt}=s,{xAxisKey:rt="x",yAxisKey:nt="y"}=this._parsing,ot=it.axis==="x"?rt:nt,st=tt.axis==="x"?rt:nt,at=[];let lt,ct,ht,mt;for(lt=_e,ct=_e+et;lt<ct;++lt)mt=_[lt],ht={},ht[it.axis]=it.parse(resolveObjectKey(mt,ot),lt),at.push(parseValue(resolveObjectKey(mt,st),ht,tt,lt));return at}updateRangeFromParsed(s,_,_e,et){super.updateRangeFromParsed(s,_,_e,et);const it=_e._custom;it&&_===this._cachedMeta.vScale&&(s.min=Math.min(s.min,it.min),s.max=Math.max(s.max,it.max))}getMaxOverflow(){return 0}getLabelAndValue(s){const _=this._cachedMeta,{iScale:_e,vScale:et}=_,it=this.getParsed(s),tt=it._custom,rt=isFloatBar(tt)?"["+tt.start+", "+tt.end+"]":""+et.getLabelForValue(it[et.axis]);return{label:""+_e.getLabelForValue(it[_e.axis]),value:rt}}initialize(){this.enableOptionSharing=!0,super.initialize();const s=this._cachedMeta;s.stack=this.getDataset().stack}update(s){const _=this._cachedMeta;this.updateElements(_.data,0,_.data.length,s)}updateElements(s,_,_e,et){const it=et==="reset",{index:tt,_cachedMeta:{vScale:rt}}=this,nt=rt.getBasePixel(),ot=rt.isHorizontal(),st=this._getRuler(),at=this.resolveDataElementOptions(_,et),lt=this.getSharedOptions(at),ct=this.includeOptions(et,lt);this.updateSharedOptions(lt,et,at);for(let ht=_;ht<_+_e;ht++){const mt=this.getParsed(ht),dt=it||isNullOrUndef(mt[rt.axis])?{base:nt,head:nt}:this._calculateBarValuePixels(ht),ft=this._calculateBarIndexPixels(ht,st),ut=(mt._stacks||{})[rt.axis],pt={horizontal:ot,base:dt.base,enableBorderRadius:!ut||isFloatBar(mt._custom)||tt===ut._top||tt===ut._bottom,x:ot?dt.head:ft.center,y:ot?ft.center:dt.head,height:ot?ft.size:Math.abs(dt.size),width:ot?Math.abs(dt.size):ft.size};ct&&(pt.options=lt||this.resolveDataElementOptions(ht,s[ht].active?"active":et));const At=pt.options||s[ht].options;setBorderSkipped(pt,At,ut,tt),setInflateAmount(pt,At,st.ratio),this.updateElement(s[ht],ht,pt,et)}}_getStacks(s,_){const et=this._cachedMeta.iScale,it=et.getMatchingVisibleMetas(this._type),tt=et.options.stacked,rt=it.length,nt=[];let ot,st;for(ot=0;ot<rt;++ot)if(st=it[ot],!!st.controller.options.grouped){if(typeof _!="undefined"){const at=st.controller.getParsed(_)[st.controller._cachedMeta.vScale.axis];if(isNullOrUndef(at)||isNaN(at))continue}if((tt===!1||nt.indexOf(st.stack)===-1||tt===void 0&&st.stack===void 0)&&nt.push(st.stack),st.index===s)break}return nt.length||nt.push(void 0),nt}_getStackCount(s){return this._getStacks(void 0,s).length}_getStackIndex(s,_,_e){const et=this._getStacks(s,_e),it=_!==void 0?et.indexOf(_):-1;return it===-1?et.length-1:it}_getRuler(){const s=this.options,_=this._cachedMeta,_e=_.iScale,et=[];let it,tt;for(it=0,tt=_.data.length;it<tt;++it)et.push(_e.getPixelForValue(this.getParsed(it)[_e.axis],it));const rt=s.barThickness;return{min:rt||computeMinSampleSize(_),pixels:et,start:_e._startPixel,end:_e._endPixel,stackCount:this._getStackCount(),scale:_e,grouped:s.grouped,ratio:rt?1:s.categoryPercentage*s.barPercentage}}_calculateBarValuePixels(s){const{_cachedMeta:{vScale:_,_stacked:_e},options:{base:et,minBarLength:it}}=this,tt=et||0,rt=this.getParsed(s),nt=rt._custom,ot=isFloatBar(nt);let st=rt[_.axis],at=0,lt=_e?this.applyStack(_,rt,_e):st,ct,ht;lt!==st&&(at=lt-st,lt=st),ot&&(st=nt.barStart,lt=nt.barEnd-nt.barStart,st!==0&&sign(st)!==sign(nt.barEnd)&&(at=0),at+=st);const mt=!isNullOrUndef(et)&&!ot?et:at;let dt=_.getPixelForValue(mt);if(this.chart.getDataVisibility(s)?ct=_.getPixelForValue(at+lt):ct=dt,ht=ct-dt,Math.abs(ht)<it&&(ht=barSign(ht,_,tt)*it,st===tt&&(dt-=ht/2),ct=dt+ht),dt===_.getPixelForValue(tt)){const ft=sign(ht)*_.getLineWidthForValue(tt)/2;dt+=ft,ht-=ft}return{size:ht,base:dt,head:ct,center:ct+ht/2}}_calculateBarIndexPixels(s,_){const _e=_.scale,et=this.options,it=et.skipNull,tt=valueOrDefault(et.maxBarThickness,1/0);let rt,nt;if(_.grouped){const ot=it?this._getStackCount(s):_.stackCount,st=et.barThickness==="flex"?computeFlexCategoryTraits(s,_,et,ot):computeFitCategoryTraits(s,_,et,ot),at=this._getStackIndex(this.index,this._cachedMeta.stack,it?s:void 0);rt=st.start+st.chunk*at+st.chunk/2,nt=Math.min(tt,st.chunk*st.ratio)}else rt=_e.getPixelForValue(this.getParsed(s)[_e.axis],s),nt=Math.min(tt,_.min*_.ratio);return{base:rt-nt/2,head:rt+nt/2,center:rt,size:nt}}draw(){const s=this._cachedMeta,_=s.vScale,_e=s.data,et=_e.length;let it=0;for(;it<et;++it)this.getParsed(it)[_.axis]!==null&&_e[it].draw(this._ctx)}}BarController.id="bar";BarController.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};BarController.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class BubbleController extends DatasetController{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(s,_,_e,et){const it=super.parsePrimitiveData(s,_,_e,et);for(let tt=0;tt<it.length;tt++)it[tt]._custom=this.resolveDataElementOptions(tt+_e).radius;return it}parseArrayData(s,_,_e,et){const it=super.parseArrayData(s,_,_e,et);for(let tt=0;tt<it.length;tt++){const rt=_[_e+tt];it[tt]._custom=valueOrDefault(rt[2],this.resolveDataElementOptions(tt+_e).radius)}return it}parseObjectData(s,_,_e,et){const it=super.parseObjectData(s,_,_e,et);for(let tt=0;tt<it.length;tt++){const rt=_[_e+tt];it[tt]._custom=valueOrDefault(rt&&rt.r&&+rt.r,this.resolveDataElementOptions(tt+_e).radius)}return it}getMaxOverflow(){const s=this._cachedMeta.data;let _=0;for(let _e=s.length-1;_e>=0;--_e)_=Math.max(_,s[_e].size(this.resolveDataElementOptions(_e))/2);return _>0&&_}getLabelAndValue(s){const _=this._cachedMeta,{xScale:_e,yScale:et}=_,it=this.getParsed(s),tt=_e.getLabelForValue(it.x),rt=et.getLabelForValue(it.y),nt=it._custom;return{label:_.label,value:"("+tt+", "+rt+(nt?", "+nt:"")+")"}}update(s){const _=this._cachedMeta.data;this.updateElements(_,0,_.length,s)}updateElements(s,_,_e,et){const it=et==="reset",{iScale:tt,vScale:rt}=this._cachedMeta,nt=this.resolveDataElementOptions(_,et),ot=this.getSharedOptions(nt),st=this.includeOptions(et,ot),at=tt.axis,lt=rt.axis;for(let ct=_;ct<_+_e;ct++){const ht=s[ct],mt=!it&&this.getParsed(ct),dt={},ft=dt[at]=it?tt.getPixelForDecimal(.5):tt.getPixelForValue(mt[at]),ut=dt[lt]=it?rt.getBasePixel():rt.getPixelForValue(mt[lt]);dt.skip=isNaN(ft)||isNaN(ut),st&&(dt.options=this.resolveDataElementOptions(ct,ht.active?"active":et),it&&(dt.options.radius=0)),this.updateElement(ht,ct,dt,et)}this.updateSharedOptions(ot,et,nt)}resolveDataElementOptions(s,_){const _e=this.getParsed(s);let et=super.resolveDataElementOptions(s,_);et.$shared&&(et=Object.assign({},et,{$shared:!1}));const it=et.radius;return _!=="active"&&(et.radius=0),et.radius+=valueOrDefault(_e&&_e._custom,it),et}}BubbleController.id="bubble";BubbleController.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};BubbleController.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title(){return""}}}}};function getRatioAndOffset(o,s,_){let _e=1,et=1,it=0,tt=0;if(s<TAU){const rt=o,nt=rt+s,ot=Math.cos(rt),st=Math.sin(rt),at=Math.cos(nt),lt=Math.sin(nt),ct=(pt,At,gt)=>_angleBetween(pt,rt,nt,!0)?1:Math.max(At,At*_,gt,gt*_),ht=(pt,At,gt)=>_angleBetween(pt,rt,nt,!0)?-1:Math.min(At,At*_,gt,gt*_),mt=ct(0,ot,at),dt=ct(HALF_PI,st,lt),ft=ht(PI,ot,at),ut=ht(PI+HALF_PI,st,lt);_e=(mt-ft)/2,et=(dt-ut)/2,it=-(mt+ft)/2,tt=-(dt+ut)/2}return{ratioX:_e,ratioY:et,offsetX:it,offsetY:tt}}class DoughnutController extends DatasetController{constructor(s,_){super(s,_),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(s,_){const _e=this.getDataset().data,et=this._cachedMeta;if(this._parsing===!1)et._parsed=_e;else{let it=nt=>+_e[nt];if(isObject(_e[s])){const{key:nt="value"}=this._parsing;it=ot=>+resolveObjectKey(_e[ot],nt)}let tt,rt;for(tt=s,rt=s+_;tt<rt;++tt)et._parsed[tt]=it(tt)}}_getRotation(){return toRadians(this.options.rotation-90)}_getCircumference(){return toRadians(this.options.circumference)}_getRotationExtents(){let s=TAU,_=-TAU;for(let _e=0;_e<this.chart.data.datasets.length;++_e)if(this.chart.isDatasetVisible(_e)){const et=this.chart.getDatasetMeta(_e).controller,it=et._getRotation(),tt=et._getCircumference();s=Math.min(s,it),_=Math.max(_,it+tt)}return{rotation:s,circumference:_-s}}update(s){const _=this.chart,{chartArea:_e}=_,et=this._cachedMeta,it=et.data,tt=this.getMaxBorderWidth()+this.getMaxOffset(it)+this.options.spacing,rt=Math.max((Math.min(_e.width,_e.height)-tt)/2,0),nt=Math.min(toPercentage(this.options.cutout,rt),1),ot=this._getRingWeight(this.index),{circumference:st,rotation:at}=this._getRotationExtents(),{ratioX:lt,ratioY:ct,offsetX:ht,offsetY:mt}=getRatioAndOffset(at,st,nt),dt=(_e.width-tt)/lt,ft=(_e.height-tt)/ct,ut=Math.max(Math.min(dt,ft)/2,0),pt=toDimension(this.options.radius,ut),At=Math.max(pt*nt,0),gt=(pt-At)/this._getVisibleDatasetWeightTotal();this.offsetX=ht*pt,this.offsetY=mt*pt,et.total=this.calculateTotal(),this.outerRadius=pt-gt*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-gt*ot,0),this.updateElements(it,0,it.length,s)}_circumference(s,_){const _e=this.options,et=this._cachedMeta,it=this._getCircumference();return _&&_e.animation.animateRotate||!this.chart.getDataVisibility(s)||et._parsed[s]===null||et.data[s].hidden?0:this.calculateCircumference(et._parsed[s]*it/TAU)}updateElements(s,_,_e,et){const it=et==="reset",tt=this.chart,rt=tt.chartArea,ot=tt.options.animation,st=(rt.left+rt.right)/2,at=(rt.top+rt.bottom)/2,lt=it&&ot.animateScale,ct=lt?0:this.innerRadius,ht=lt?0:this.outerRadius,mt=this.resolveDataElementOptions(_,et),dt=this.getSharedOptions(mt),ft=this.includeOptions(et,dt);let ut=this._getRotation(),pt;for(pt=0;pt<_;++pt)ut+=this._circumference(pt,it);for(pt=_;pt<_+_e;++pt){const At=this._circumference(pt,it),gt=s[pt],vt={x:st+this.offsetX,y:at+this.offsetY,startAngle:ut,endAngle:ut+At,circumference:At,outerRadius:ht,innerRadius:ct};ft&&(vt.options=dt||this.resolveDataElementOptions(pt,gt.active?"active":et)),ut+=At,this.updateElement(gt,pt,vt,et)}this.updateSharedOptions(dt,et,mt)}calculateTotal(){const s=this._cachedMeta,_=s.data;let _e=0,et;for(et=0;et<_.length;et++){const it=s._parsed[et];it!==null&&!isNaN(it)&&this.chart.getDataVisibility(et)&&!_[et].hidden&&(_e+=Math.abs(it))}return _e}calculateCircumference(s){const _=this._cachedMeta.total;return _>0&&!isNaN(s)?TAU*(Math.abs(s)/_):0}getLabelAndValue(s){const _=this._cachedMeta,_e=this.chart,et=_e.data.labels||[],it=formatNumber(_._parsed[s],_e.options.locale);return{label:et[s]||"",value:it}}getMaxBorderWidth(s){let _=0;const _e=this.chart;let et,it,tt,rt,nt;if(!s){for(et=0,it=_e.data.datasets.length;et<it;++et)if(_e.isDatasetVisible(et)){tt=_e.getDatasetMeta(et),s=tt.data,rt=tt.controller;break}}if(!s)return 0;for(et=0,it=s.length;et<it;++et)nt=rt.resolveDataElementOptions(et),nt.borderAlign!=="inner"&&(_=Math.max(_,nt.borderWidth||0,nt.hoverBorderWidth||0));return _}getMaxOffset(s){let _=0;for(let _e=0,et=s.length;_e<et;++_e){const it=this.resolveDataElementOptions(_e);_=Math.max(_,it.offset||0,it.hoverOffset||0)}return _}_getRingWeightOffset(s){let _=0;for(let _e=0;_e<s;++_e)this.chart.isDatasetVisible(_e)&&(_+=this._getRingWeight(_e));return _}_getRingWeight(s){return Math.max(valueOrDefault(this.chart.data.datasets[s].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}DoughnutController.id="doughnut";DoughnutController.defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};DoughnutController.descriptors={_scriptable:o=>o!=="spacing",_indexable:o=>o!=="spacing"};DoughnutController.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(o){const s=o.data;if(s.labels.length&&s.datasets.length){const{labels:{pointStyle:_}}=o.legend.options;return s.labels.map((_e,et)=>{const tt=o.getDatasetMeta(0).controller.getStyle(et);return{text:_e,fillStyle:tt.backgroundColor,strokeStyle:tt.borderColor,lineWidth:tt.borderWidth,pointStyle:_,hidden:!o.getDataVisibility(et),index:et}})}return[]}},onClick(o,s,_){_.chart.toggleDataVisibility(s.index),_.chart.update()}},tooltip:{callbacks:{title(){return""},label(o){let s=o.label;const _=": "+o.formattedValue;return isArray(s)?(s=s.slice(),s[0]+=_):s+=_,s}}}}};class LineController extends DatasetController{initialize(){this.enableOptionSharing=!0,super.initialize()}update(s){const _=this._cachedMeta,{dataset:_e,data:et=[],_dataset:it}=_,tt=this.chart._animationsDisabled;let{start:rt,count:nt}=getStartAndCountOfVisiblePoints(_,et,tt);this._drawStart=rt,this._drawCount=nt,scaleRangesChanged(_)&&(rt=0,nt=et.length),_e._chart=this.chart,_e._datasetIndex=this.index,_e._decimated=!!it._decimated,_e.points=et;const ot=this.resolveDatasetElementOptions(s);this.options.showLine||(ot.borderWidth=0),ot.segment=this.options.segment,this.updateElement(_e,void 0,{animated:!tt,options:ot},s),this.updateElements(et,rt,nt,s)}updateElements(s,_,_e,et){const it=et==="reset",{iScale:tt,vScale:rt,_stacked:nt,_dataset:ot}=this._cachedMeta,st=this.resolveDataElementOptions(_,et),at=this.getSharedOptions(st),lt=this.includeOptions(et,at),ct=tt.axis,ht=rt.axis,{spanGaps:mt,segment:dt}=this.options,ft=isNumber(mt)?mt:Number.POSITIVE_INFINITY,ut=this.chart._animationsDisabled||it||et==="none";let pt=_>0&&this.getParsed(_-1);for(let At=_;At<_+_e;++At){const gt=s[At],vt=this.getParsed(At),yt=ut?gt:{},bt=isNullOrUndef(vt[ht]),Ct=yt[ct]=tt.getPixelForValue(vt[ct],At),xt=yt[ht]=it||bt?rt.getBasePixel():rt.getPixelForValue(nt?this.applyStack(rt,vt,nt):vt[ht],At);yt.skip=isNaN(Ct)||isNaN(xt)||bt,yt.stop=At>0&&vt[ct]-pt[ct]>ft,dt&&(yt.parsed=vt,yt.raw=ot.data[At]),lt&&(yt.options=at||this.resolveDataElementOptions(At,gt.active?"active":et)),ut||this.updateElement(gt,At,yt,et),pt=vt}this.updateSharedOptions(at,et,st)}getMaxOverflow(){const s=this._cachedMeta,_=s.dataset,_e=_.options&&_.options.borderWidth||0,et=s.data||[];if(!et.length)return _e;const it=et[0].size(this.resolveDataElementOptions(0)),tt=et[et.length-1].size(this.resolveDataElementOptions(et.length-1));return Math.max(_e,it,tt)/2}draw(){const s=this._cachedMeta;s.dataset.updateControlPoints(this.chart.chartArea,s.iScale.axis),super.draw()}}LineController.id="line";LineController.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};LineController.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};function getStartAndCountOfVisiblePoints(o,s,_){const _e=s.length;let et=0,it=_e;if(o._sorted){const{iScale:tt,_parsed:rt}=o,nt=tt.axis,{min:ot,max:st,minDefined:at,maxDefined:lt}=tt.getUserBounds();at&&(et=_limitValue(Math.min(_lookupByKey(rt,tt.axis,ot).lo,_?_e:_lookupByKey(s,nt,tt.getPixelForValue(ot)).lo),0,_e-1)),lt?it=_limitValue(Math.max(_lookupByKey(rt,tt.axis,st).hi+1,_?0:_lookupByKey(s,nt,tt.getPixelForValue(st)).hi+1),et,_e)-et:it=_e-et}return{start:et,count:it}}function scaleRangesChanged(o){const{xScale:s,yScale:_,_scaleRanges:_e}=o,et={xmin:s.min,xmax:s.max,ymin:_.min,ymax:_.max};if(!_e)return o._scaleRanges=et,!0;const it=_e.xmin!==s.min||_e.xmax!==s.max||_e.ymin!==_.min||_e.ymax!==_.max;return Object.assign(_e,et),it}class PolarAreaController extends DatasetController{constructor(s,_){super(s,_),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(s){const _=this._cachedMeta,_e=this.chart,et=_e.data.labels||[],it=formatNumber(_._parsed[s].r,_e.options.locale);return{label:et[s]||"",value:it}}update(s){const _=this._cachedMeta.data;this._updateRadius(),this.updateElements(_,0,_.length,s)}_updateRadius(){const s=this.chart,_=s.chartArea,_e=s.options,et=Math.min(_.right-_.left,_.bottom-_.top),it=Math.max(et/2,0),tt=Math.max(_e.cutoutPercentage?it/100*_e.cutoutPercentage:1,0),rt=(it-tt)/s.getVisibleDatasetCount();this.outerRadius=it-rt*this.index,this.innerRadius=this.outerRadius-rt}updateElements(s,_,_e,et){const it=et==="reset",tt=this.chart,rt=this.getDataset(),ot=tt.options.animation,st=this._cachedMeta.rScale,at=st.xCenter,lt=st.yCenter,ct=st.getIndexAngle(0)-.5*PI;let ht=ct,mt;const dt=360/this.countVisibleElements();for(mt=0;mt<_;++mt)ht+=this._computeAngle(mt,et,dt);for(mt=_;mt<_+_e;mt++){const ft=s[mt];let ut=ht,pt=ht+this._computeAngle(mt,et,dt),At=tt.getDataVisibility(mt)?st.getDistanceFromCenterForValue(rt.data[mt]):0;ht=pt,it&&(ot.animateScale&&(At=0),ot.animateRotate&&(ut=pt=ct));const gt={x:at,y:lt,innerRadius:0,outerRadius:At,startAngle:ut,endAngle:pt,options:this.resolveDataElementOptions(mt,ft.active?"active":et)};this.updateElement(ft,mt,gt,et)}}countVisibleElements(){const s=this.getDataset(),_=this._cachedMeta;let _e=0;return _.data.forEach((et,it)=>{!isNaN(s.data[it])&&this.chart.getDataVisibility(it)&&_e++}),_e}_computeAngle(s,_,_e){return this.chart.getDataVisibility(s)?toRadians(this.resolveDataElementOptions(s,_).angle||_e):0}}PolarAreaController.id="polarArea";PolarAreaController.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};PolarAreaController.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(o){const s=o.data;if(s.labels.length&&s.datasets.length){const{labels:{pointStyle:_}}=o.legend.options;return s.labels.map((_e,et)=>{const tt=o.getDatasetMeta(0).controller.getStyle(et);return{text:_e,fillStyle:tt.backgroundColor,strokeStyle:tt.borderColor,lineWidth:tt.borderWidth,pointStyle:_,hidden:!o.getDataVisibility(et),index:et}})}return[]}},onClick(o,s,_){_.chart.toggleDataVisibility(s.index),_.chart.update()}},tooltip:{callbacks:{title(){return""},label(o){return o.chart.data.labels[o.dataIndex]+": "+o.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class PieController extends DoughnutController{}PieController.id="pie";PieController.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class RadarController extends DatasetController{getLabelAndValue(s){const _=this._cachedMeta.vScale,_e=this.getParsed(s);return{label:_.getLabels()[s],value:""+_.getLabelForValue(_e[_.axis])}}update(s){const _=this._cachedMeta,_e=_.dataset,et=_.data||[],it=_.iScale.getLabels();if(_e.points=et,s!=="resize"){const tt=this.resolveDatasetElementOptions(s);this.options.showLine||(tt.borderWidth=0);const rt={_loop:!0,_fullLoop:it.length===et.length,options:tt};this.updateElement(_e,void 0,rt,s)}this.updateElements(et,0,et.length,s)}updateElements(s,_,_e,et){const it=this.getDataset(),tt=this._cachedMeta.rScale,rt=et==="reset";for(let nt=_;nt<_+_e;nt++){const ot=s[nt],st=this.resolveDataElementOptions(nt,ot.active?"active":et),at=tt.getPointPositionForValue(nt,it.data[nt]),lt=rt?tt.xCenter:at.x,ct=rt?tt.yCenter:at.y,ht={x:lt,y:ct,angle:at.angle,skip:isNaN(lt)||isNaN(ct),options:st};this.updateElement(ot,nt,ht,et)}}}RadarController.id="radar";RadarController.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};RadarController.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class ScatterController extends LineController{}ScatterController.id="scatter";ScatterController.defaults={showLine:!1,fill:!1};ScatterController.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(o){return"("+o.label+", "+o.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var controllers=Object.freeze({__proto__:null,BarController,BubbleController,DoughnutController,LineController,PolarAreaController,PieController,RadarController,ScatterController});function abstract(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class DateAdapter{constructor(s){this.options=s||{}}formats(){return abstract()}parse(s,_){return abstract()}format(s,_){return abstract()}add(s,_,_e){return abstract()}diff(s,_,_e){return abstract()}startOf(s,_,_e){return abstract()}endOf(s,_){return abstract()}}DateAdapter.override=function(o){Object.assign(DateAdapter.prototype,o)};var adapters={_date:DateAdapter};function getRelativePosition(o,s){return"native"in o?{x:o.x,y:o.y}:getRelativePosition$1(o,s)}function evaluateAllVisibleItems(o,s){const _=o.getSortedVisibleDatasetMetas();let _e,et,it;for(let tt=0,rt=_.length;tt<rt;++tt){({index:_e,data:et}=_[tt]);for(let nt=0,ot=et.length;nt<ot;++nt)it=et[nt],it.skip||s(it,_e,nt)}}function binarySearch(o,s,_,_e){const{controller:et,data:it,_sorted:tt}=o,rt=et._cachedMeta.iScale;if(rt&&s===rt.axis&&s!=="r"&&tt&&it.length){const nt=rt._reversePixels?_rlookupByKey:_lookupByKey;if(_e){if(et._sharedOptions){const ot=it[0],st=typeof ot.getRange=="function"&&ot.getRange(s);if(st){const at=nt(it,s,_-st),lt=nt(it,s,_+st);return{lo:at.lo,hi:lt.hi}}}}else return nt(it,s,_)}return{lo:0,hi:it.length-1}}function optimizedEvaluateItems(o,s,_,_e,et){const it=o.getSortedVisibleDatasetMetas(),tt=_[s];for(let rt=0,nt=it.length;rt<nt;++rt){const{index:ot,data:st}=it[rt],{lo:at,hi:lt}=binarySearch(it[rt],s,tt,et);for(let ct=at;ct<=lt;++ct){const ht=st[ct];ht.skip||_e(ht,ot,ct)}}}function getDistanceMetricForAxis(o){const s=o.indexOf("x")!==-1,_=o.indexOf("y")!==-1;return function(_e,et){const it=s?Math.abs(_e.x-et.x):0,tt=_?Math.abs(_e.y-et.y):0;return Math.sqrt(Math.pow(it,2)+Math.pow(tt,2))}}function getIntersectItems(o,s,_,_e){const et=[];return _isPointInArea(s,o.chartArea,o._minPadding)&&optimizedEvaluateItems(o,_,s,function(tt,rt,nt){tt.inRange(s.x,s.y,_e)&&et.push({element:tt,datasetIndex:rt,index:nt})},!0),et}function getNearestRadialItems(o,s,_,_e){let et=[];function it(tt,rt,nt){const{startAngle:ot,endAngle:st}=tt.getProps(["startAngle","endAngle"],_e),{angle:at}=getAngleFromPoint(tt,{x:s.x,y:s.y});_angleBetween(at,ot,st)&&et.push({element:tt,datasetIndex:rt,index:nt})}return optimizedEvaluateItems(o,_,s,it),et}function getNearestCartesianItems(o,s,_,_e,et){let it=[];const tt=getDistanceMetricForAxis(_);let rt=Number.POSITIVE_INFINITY;function nt(ot,st,at){const lt=ot.inRange(s.x,s.y,et);if(_e&&!lt)return;const ct=ot.getCenterPoint(et);if(!_isPointInArea(ct,o.chartArea,o._minPadding)&&!lt)return;const mt=tt(s,ct);mt<rt?(it=[{element:ot,datasetIndex:st,index:at}],rt=mt):mt===rt&&it.push({element:ot,datasetIndex:st,index:at})}return optimizedEvaluateItems(o,_,s,nt),it}function getNearestItems(o,s,_,_e,et){return _isPointInArea(s,o.chartArea,o._minPadding)?_==="r"&&!_e?getNearestRadialItems(o,s,_,et):getNearestCartesianItems(o,s,_,_e,et):[]}function getAxisItems(o,s,_,_e){const et=getRelativePosition(s,o),it=[],tt=_.axis,rt=tt==="x"?"inXRange":"inYRange";let nt=!1;return evaluateAllVisibleItems(o,(ot,st,at)=>{ot[rt](et[tt],_e)&&it.push({element:ot,datasetIndex:st,index:at}),ot.inRange(et.x,et.y,_e)&&(nt=!0)}),_.intersect&&!nt?[]:it}var Interaction={modes:{index(o,s,_,_e){const et=getRelativePosition(s,o),it=_.axis||"x",tt=_.intersect?getIntersectItems(o,et,it,_e):getNearestItems(o,et,it,!1,_e),rt=[];return tt.length?(o.getSortedVisibleDatasetMetas().forEach(nt=>{const ot=tt[0].index,st=nt.data[ot];st&&!st.skip&&rt.push({element:st,datasetIndex:nt.index,index:ot})}),rt):[]},dataset(o,s,_,_e){const et=getRelativePosition(s,o),it=_.axis||"xy";let tt=_.intersect?getIntersectItems(o,et,it,_e):getNearestItems(o,et,it,!1,_e);if(tt.length>0){const rt=tt[0].datasetIndex,nt=o.getDatasetMeta(rt).data;tt=[];for(let ot=0;ot<nt.length;++ot)tt.push({element:nt[ot],datasetIndex:rt,index:ot})}return tt},point(o,s,_,_e){const et=getRelativePosition(s,o),it=_.axis||"xy";return getIntersectItems(o,et,it,_e)},nearest(o,s,_,_e){const et=getRelativePosition(s,o),it=_.axis||"xy";return getNearestItems(o,et,it,_.intersect,_e)},x(o,s,_,_e){return getAxisItems(o,s,{axis:"x",intersect:_.intersect},_e)},y(o,s,_,_e){return getAxisItems(o,s,{axis:"y",intersect:_.intersect},_e)}}};const STATIC_POSITIONS=["left","top","right","bottom"];function filterByPosition(o,s){return o.filter(_=>_.pos===s)}function filterDynamicPositionByAxis(o,s){return o.filter(_=>STATIC_POSITIONS.indexOf(_.pos)===-1&&_.box.axis===s)}function sortByWeight(o,s){return o.sort((_,_e)=>{const et=s?_e:_,it=s?_:_e;return et.weight===it.weight?et.index-it.index:et.weight-it.weight})}function wrapBoxes(o){const s=[];let _,_e,et,it,tt,rt;for(_=0,_e=(o||[]).length;_<_e;++_)et=o[_],{position:it,options:{stack:tt,stackWeight:rt=1}}=et,s.push({index:_,box:et,pos:it,horizontal:et.isHorizontal(),weight:et.weight,stack:tt&&it+tt,stackWeight:rt});return s}function buildStacks(o){const s={};for(const _ of o){const{stack:_e,pos:et,stackWeight:it}=_;if(!_e||!STATIC_POSITIONS.includes(et))continue;const tt=s[_e]||(s[_e]={count:0,placed:0,weight:0,size:0});tt.count++,tt.weight+=it}return s}function setLayoutDims(o,s){const _=buildStacks(o),{vBoxMaxWidth:_e,hBoxMaxHeight:et}=s;let it,tt,rt;for(it=0,tt=o.length;it<tt;++it){rt=o[it];const{fullSize:nt}=rt.box,ot=_[rt.stack],st=ot&&rt.stackWeight/ot.weight;rt.horizontal?(rt.width=st?st*_e:nt&&s.availableWidth,rt.height=et):(rt.width=_e,rt.height=st?st*et:nt&&s.availableHeight)}return _}function buildLayoutBoxes(o){const s=wrapBoxes(o),_=sortByWeight(s.filter(ot=>ot.box.fullSize),!0),_e=sortByWeight(filterByPosition(s,"left"),!0),et=sortByWeight(filterByPosition(s,"right")),it=sortByWeight(filterByPosition(s,"top"),!0),tt=sortByWeight(filterByPosition(s,"bottom")),rt=filterDynamicPositionByAxis(s,"x"),nt=filterDynamicPositionByAxis(s,"y");return{fullSize:_,leftAndTop:_e.concat(it),rightAndBottom:et.concat(nt).concat(tt).concat(rt),chartArea:filterByPosition(s,"chartArea"),vertical:_e.concat(et).concat(nt),horizontal:it.concat(tt).concat(rt)}}function getCombinedMax(o,s,_,_e){return Math.max(o[_],s[_])+Math.max(o[_e],s[_e])}function updateMaxPadding(o,s){o.top=Math.max(o.top,s.top),o.left=Math.max(o.left,s.left),o.bottom=Math.max(o.bottom,s.bottom),o.right=Math.max(o.right,s.right)}function updateDims(o,s,_,_e){const{pos:et,box:it}=_,tt=o.maxPadding;if(!isObject(et)){_.size&&(o[et]-=_.size);const at=_e[_.stack]||{size:0,count:1};at.size=Math.max(at.size,_.horizontal?it.height:it.width),_.size=at.size/at.count,o[et]+=_.size}it.getPadding&&updateMaxPadding(tt,it.getPadding());const rt=Math.max(0,s.outerWidth-getCombinedMax(tt,o,"left","right")),nt=Math.max(0,s.outerHeight-getCombinedMax(tt,o,"top","bottom")),ot=rt!==o.w,st=nt!==o.h;return o.w=rt,o.h=nt,_.horizontal?{same:ot,other:st}:{same:st,other:ot}}function handleMaxPadding(o){const s=o.maxPadding;function _(_e){const et=Math.max(s[_e]-o[_e],0);return o[_e]+=et,et}o.y+=_("top"),o.x+=_("left"),_("right"),_("bottom")}function getMargins(o,s){const _=s.maxPadding;function _e(et){const it={left:0,top:0,right:0,bottom:0};return et.forEach(tt=>{it[tt]=Math.max(s[tt],_[tt])}),it}return _e(o?["left","right"]:["top","bottom"])}function fitBoxes(o,s,_,_e){const et=[];let it,tt,rt,nt,ot,st;for(it=0,tt=o.length,ot=0;it<tt;++it){rt=o[it],nt=rt.box,nt.update(rt.width||s.w,rt.height||s.h,getMargins(rt.horizontal,s));const{same:at,other:lt}=updateDims(s,_,rt,_e);ot|=at&&et.length,st=st||lt,nt.fullSize||et.push(rt)}return ot&&fitBoxes(et,s,_,_e)||st}function setBoxDims(o,s,_,_e,et){o.top=_,o.left=s,o.right=s+_e,o.bottom=_+et,o.width=_e,o.height=et}function placeBoxes(o,s,_,_e){const et=_.padding;let{x:it,y:tt}=s;for(const rt of o){const nt=rt.box,ot=_e[rt.stack]||{count:1,placed:0,weight:1},st=rt.stackWeight/ot.weight||1;if(rt.horizontal){const at=s.w*st,lt=ot.size||nt.height;defined(ot.start)&&(tt=ot.start),nt.fullSize?setBoxDims(nt,et.left,tt,_.outerWidth-et.right-et.left,lt):setBoxDims(nt,s.left+ot.placed,tt,at,lt),ot.start=tt,ot.placed+=at,tt=nt.bottom}else{const at=s.h*st,lt=ot.size||nt.width;defined(ot.start)&&(it=ot.start),nt.fullSize?setBoxDims(nt,it,et.top,lt,_.outerHeight-et.bottom-et.top):setBoxDims(nt,it,s.top+ot.placed,lt,at),ot.start=it,ot.placed+=at,it=nt.right}}s.x=it,s.y=tt}defaults.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var layouts={addBox(o,s){o.boxes||(o.boxes=[]),s.fullSize=s.fullSize||!1,s.position=s.position||"top",s.weight=s.weight||0,s._layers=s._layers||function(){return[{z:0,draw(_){s.draw(_)}}]},o.boxes.push(s)},removeBox(o,s){const _=o.boxes?o.boxes.indexOf(s):-1;_!==-1&&o.boxes.splice(_,1)},configure(o,s,_){s.fullSize=_.fullSize,s.position=_.position,s.weight=_.weight},update(o,s,_,_e){if(!o)return;const et=toPadding(o.options.layout.padding),it=Math.max(s-et.width,0),tt=Math.max(_-et.height,0),rt=buildLayoutBoxes(o.boxes),nt=rt.vertical,ot=rt.horizontal;each(o.boxes,mt=>{typeof mt.beforeLayout=="function"&&mt.beforeLayout()});const st=nt.reduce((mt,dt)=>dt.box.options&&dt.box.options.display===!1?mt:mt+1,0)||1,at=Object.freeze({outerWidth:s,outerHeight:_,padding:et,availableWidth:it,availableHeight:tt,vBoxMaxWidth:it/2/st,hBoxMaxHeight:tt/2}),lt=Object.assign({},et);updateMaxPadding(lt,toPadding(_e));const ct=Object.assign({maxPadding:lt,w:it,h:tt,x:et.left,y:et.top},et),ht=setLayoutDims(nt.concat(ot),at);fitBoxes(rt.fullSize,ct,at,ht),fitBoxes(nt,ct,at,ht),fitBoxes(ot,ct,at,ht)&&fitBoxes(nt,ct,at,ht),handleMaxPadding(ct),placeBoxes(rt.leftAndTop,ct,at,ht),ct.x+=ct.w,ct.y+=ct.h,placeBoxes(rt.rightAndBottom,ct,at,ht),o.chartArea={left:ct.left,top:ct.top,right:ct.left+ct.w,bottom:ct.top+ct.h,height:ct.h,width:ct.w},each(rt.chartArea,mt=>{const dt=mt.box;Object.assign(dt,o.chartArea),dt.update(ct.w,ct.h,{left:0,top:0,right:0,bottom:0})})}};class BasePlatform{acquireContext(s,_){}releaseContext(s){return!1}addEventListener(s,_,_e){}removeEventListener(s,_,_e){}getDevicePixelRatio(){return 1}getMaximumSize(s,_,_e,et){return _=Math.max(0,_||s.width),_e=_e||s.height,{width:_,height:Math.max(0,et?Math.floor(_/et):_e)}}isAttached(s){return!0}updateConfig(s){}}class BasicPlatform extends BasePlatform{acquireContext(s){return s&&s.getContext&&s.getContext("2d")||null}updateConfig(s){s.options.animation=!1}}const EXPANDO_KEY="$chartjs",EVENT_TYPES={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=o=>o===null||o==="";function initCanvas(o,s){const _=o.style,_e=o.getAttribute("height"),et=o.getAttribute("width");if(o[EXPANDO_KEY]={initial:{height:_e,width:et,style:{display:_.display,height:_.height,width:_.width}}},_.display=_.display||"block",_.boxSizing=_.boxSizing||"border-box",isNullOrEmpty(et)){const it=readUsedSize(o,"width");it!==void 0&&(o.width=it)}if(isNullOrEmpty(_e))if(o.style.height==="")o.height=o.width/(s||2);else{const it=readUsedSize(o,"height");it!==void 0&&(o.height=it)}return o}const eventListenerOptions=supportsEventListenerOptions?{passive:!0}:!1;function addListener(o,s,_){o.addEventListener(s,_,eventListenerOptions)}function removeListener(o,s,_){o.canvas.removeEventListener(s,_,eventListenerOptions)}function fromNativeEvent(o,s){const _=EVENT_TYPES[o.type]||o.type,{x:_e,y:et}=getRelativePosition$1(o,s);return{type:_,chart:s,native:o,x:_e!==void 0?_e:null,y:et!==void 0?et:null}}function nodeListContains(o,s){for(const _ of o)if(_===s||_.contains(s))return!0}function createAttachObserver(o,s,_){const _e=o.canvas,et=new MutationObserver(it=>{let tt=!1;for(const rt of it)tt=tt||nodeListContains(rt.addedNodes,_e),tt=tt&&!nodeListContains(rt.removedNodes,_e);tt&&_()});return et.observe(document,{childList:!0,subtree:!0}),et}function createDetachObserver(o,s,_){const _e=o.canvas,et=new MutationObserver(it=>{let tt=!1;for(const rt of it)tt=tt||nodeListContains(rt.removedNodes,_e),tt=tt&&!nodeListContains(rt.addedNodes,_e);tt&&_()});return et.observe(document,{childList:!0,subtree:!0}),et}const drpListeningCharts=new Map;let oldDevicePixelRatio=0;function onWindowResize(){const o=window.devicePixelRatio;o!==oldDevicePixelRatio&&(oldDevicePixelRatio=o,drpListeningCharts.forEach((s,_)=>{_.currentDevicePixelRatio!==o&&s()}))}function listenDevicePixelRatioChanges(o,s){drpListeningCharts.size||window.addEventListener("resize",onWindowResize),drpListeningCharts.set(o,s)}function unlistenDevicePixelRatioChanges(o){drpListeningCharts.delete(o),drpListeningCharts.size||window.removeEventListener("resize",onWindowResize)}function createResizeObserver(o,s,_){const _e=o.canvas,et=_e&&_getParentNode(_e);if(!et)return;const it=throttled((rt,nt)=>{const ot=et.clientWidth;_(rt,nt),ot<et.clientWidth&&_()},window),tt=new ResizeObserver(rt=>{const nt=rt[0],ot=nt.contentRect.width,st=nt.contentRect.height;ot===0&&st===0||it(ot,st)});return tt.observe(et),listenDevicePixelRatioChanges(o,it),tt}function releaseObserver(o,s,_){_&&_.disconnect(),s==="resize"&&unlistenDevicePixelRatioChanges(o)}function createProxyAndListen(o,s,_){const _e=o.canvas,et=throttled(it=>{o.ctx!==null&&_(fromNativeEvent(it,o))},o,it=>{const tt=it[0];return[tt,tt.offsetX,tt.offsetY]});return addListener(_e,s,et),et}class DomPlatform extends BasePlatform{acquireContext(s,_){const _e=s&&s.getContext&&s.getContext("2d");return _e&&_e.canvas===s?(initCanvas(s,_),_e):null}releaseContext(s){const _=s.canvas;if(!_[EXPANDO_KEY])return!1;const _e=_[EXPANDO_KEY].initial;["height","width"].forEach(it=>{const tt=_e[it];isNullOrUndef(tt)?_.removeAttribute(it):_.setAttribute(it,tt)});const et=_e.style||{};return Object.keys(et).forEach(it=>{_.style[it]=et[it]}),_.width=_.width,delete _[EXPANDO_KEY],!0}addEventListener(s,_,_e){this.removeEventListener(s,_);const et=s.$proxies||(s.$proxies={}),tt={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[_]||createProxyAndListen;et[_]=tt(s,_,_e)}removeEventListener(s,_){const _e=s.$proxies||(s.$proxies={}),et=_e[_];if(!et)return;({attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[_]||removeListener)(s,_,et),_e[_]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(s,_,_e,et){return getMaximumSize(s,_,_e,et)}isAttached(s){const _=_getParentNode(s);return!!(_&&_.isConnected)}}function _detectPlatform(o){return!_isDomSupported()||typeof OffscreenCanvas!="undefined"&&o instanceof OffscreenCanvas?BasicPlatform:DomPlatform}class Element$1{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(s){const{x:_,y:_e}=this.getProps(["x","y"],s);return{x:_,y:_e}}hasValue(){return isNumber(this.x)&&isNumber(this.y)}getProps(s,_){const _e=this.$animations;if(!_||!_e)return this;const et={};return s.forEach(it=>{et[it]=_e[it]&&_e[it].active()?_e[it]._to:this[it]}),et}}Element$1.defaults={};Element$1.defaultRoutes=void 0;const formatters={values(o){return isArray(o)?o:""+o},numeric(o,s,_){if(o===0)return"0";const _e=this.chart.options.locale;let et,it=o;if(_.length>1){const ot=Math.max(Math.abs(_[0].value),Math.abs(_[_.length-1].value));(ot<1e-4||ot>1e15)&&(et="scientific"),it=calculateDelta(o,_)}const tt=log10(Math.abs(it)),rt=Math.max(Math.min(-1*Math.floor(tt),20),0),nt={notation:et,minimumFractionDigits:rt,maximumFractionDigits:rt};return Object.assign(nt,this.options.ticks.format),formatNumber(o,_e,nt)},logarithmic(o,s,_){if(o===0)return"0";const _e=o/Math.pow(10,Math.floor(log10(o)));return _e===1||_e===2||_e===5?formatters.numeric.call(this,o,s,_):""}};function calculateDelta(o,s){let _=s.length>3?s[2].value-s[1].value:s[1].value-s[0].value;return Math.abs(_)>=1&&o!==Math.floor(o)&&(_=o-Math.floor(o)),_}var Ticks={formatters};defaults.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(o,s)=>s.lineWidth,tickColor:(o,s)=>s.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ticks.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});defaults.route("scale.ticks","color","","color");defaults.route("scale.grid","color","","borderColor");defaults.route("scale.grid","borderColor","","borderColor");defaults.route("scale.title","color","","color");defaults.describe("scale",{_fallback:!1,_scriptable:o=>!o.startsWith("before")&&!o.startsWith("after")&&o!=="callback"&&o!=="parser",_indexable:o=>o!=="borderDash"&&o!=="tickBorderDash"});defaults.describe("scales",{_fallback:"scale"});defaults.describe("scale.ticks",{_scriptable:o=>o!=="backdropPadding"&&o!=="callback",_indexable:o=>o!=="backdropPadding"});function autoSkip(o,s){const _=o.options.ticks,_e=_.maxTicksLimit||determineMaxTicks(o),et=_.major.enabled?getMajorIndices(s):[],it=et.length,tt=et[0],rt=et[it-1],nt=[];if(it>_e)return skipMajors(s,nt,et,it/_e),nt;const ot=calculateSpacing(et,s,_e);if(it>0){let st,at;const lt=it>1?Math.round((rt-tt)/(it-1)):null;for(skip(s,nt,ot,isNullOrUndef(lt)?0:tt-lt,tt),st=0,at=it-1;st<at;st++)skip(s,nt,ot,et[st],et[st+1]);return skip(s,nt,ot,rt,isNullOrUndef(lt)?s.length:rt+lt),nt}return skip(s,nt,ot),nt}function determineMaxTicks(o){const s=o.options.offset,_=o._tickSize(),_e=o._length/_+(s?0:1),et=o._maxLength/_;return Math.floor(Math.min(_e,et))}function calculateSpacing(o,s,_){const _e=getEvenSpacing(o),et=s.length/_;if(!_e)return Math.max(et,1);const it=_factorize(_e);for(let tt=0,rt=it.length-1;tt<rt;tt++){const nt=it[tt];if(nt>et)return nt}return Math.max(et,1)}function getMajorIndices(o){const s=[];let _,_e;for(_=0,_e=o.length;_<_e;_++)o[_].major&&s.push(_);return s}function skipMajors(o,s,_,_e){let et=0,it=_[0],tt;for(_e=Math.ceil(_e),tt=0;tt<o.length;tt++)tt===it&&(s.push(o[tt]),et++,it=_[et*_e])}function skip(o,s,_,_e,et){const it=valueOrDefault(_e,0),tt=Math.min(valueOrDefault(et,o.length),o.length);let rt=0,nt,ot,st;for(_=Math.ceil(_),et&&(nt=et-_e,_=nt/Math.floor(nt/_)),st=it;st<0;)rt++,st=Math.round(it+rt*_);for(ot=Math.max(it,0);ot<tt;ot++)ot===st&&(s.push(o[ot]),rt++,st=Math.round(it+rt*_))}function getEvenSpacing(o){const s=o.length;let _,_e;if(s<2)return!1;for(_e=o[0],_=1;_<s;++_)if(o[_]-o[_-1]!==_e)return!1;return _e}const reverseAlign=o=>o==="left"?"right":o==="right"?"left":o,offsetFromEdge=(o,s,_)=>s==="top"||s==="left"?o[s]+_:o[s]-_;function sample(o,s){const _=[],_e=o.length/s,et=o.length;let it=0;for(;it<et;it+=_e)_.push(o[Math.floor(it)]);return _}function getPixelForGridLine(o,s,_){const _e=o.ticks.length,et=Math.min(s,_e-1),it=o._startPixel,tt=o._endPixel,rt=1e-6;let nt=o.getPixelForTick(et),ot;if(!(_&&(_e===1?ot=Math.max(nt-it,tt-nt):s===0?ot=(o.getPixelForTick(1)-nt)/2:ot=(nt-o.getPixelForTick(et-1))/2,nt+=et<s?ot:-ot,nt<it-rt||nt>tt+rt)))return nt}function garbageCollect(o,s){each(o,_=>{const _e=_.gc,et=_e.length/2;let it;if(et>s){for(it=0;it<et;++it)delete _.data[_e[it]];_e.splice(0,et)}})}function getTickMarkLength(o){return o.drawTicks?o.tickLength:0}function getTitleHeight(o,s){if(!o.display)return 0;const _=toFont(o.font,s),_e=toPadding(o.padding);return(isArray(o.text)?o.text.length:1)*_.lineHeight+_e.height}function createScaleContext(o,s){return createContext(o,{scale:s,type:"scale"})}function createTickContext(o,s,_){return createContext(o,{tick:_,index:s,type:"tick"})}function titleAlign(o,s,_){let _e=_toLeftRightCenter(o);return(_&&s!=="right"||!_&&s==="right")&&(_e=reverseAlign(_e)),_e}function titleArgs(o,s,_,_e){const{top:et,left:it,bottom:tt,right:rt,chart:nt}=o,{chartArea:ot,scales:st}=nt;let at=0,lt,ct,ht;const mt=tt-et,dt=rt-it;if(o.isHorizontal()){if(ct=_alignStartEnd(_e,it,rt),isObject(_)){const ft=Object.keys(_)[0],ut=_[ft];ht=st[ft].getPixelForValue(ut)+mt-s}else _==="center"?ht=(ot.bottom+ot.top)/2+mt-s:ht=offsetFromEdge(o,_,s);lt=rt-it}else{if(isObject(_)){const ft=Object.keys(_)[0],ut=_[ft];ct=st[ft].getPixelForValue(ut)-dt+s}else _==="center"?ct=(ot.left+ot.right)/2-dt+s:ct=offsetFromEdge(o,_,s);ht=_alignStartEnd(_e,tt,et),at=_==="left"?-HALF_PI:HALF_PI}return{titleX:ct,titleY:ht,maxWidth:lt,rotation:at}}class Scale extends Element$1{constructor(s){super(),this.id=s.id,this.type=s.type,this.options=void 0,this.ctx=s.ctx,this.chart=s.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(s){this.options=s.setContext(this.getContext()),this.axis=s.axis,this._userMin=this.parse(s.min),this._userMax=this.parse(s.max),this._suggestedMin=this.parse(s.suggestedMin),this._suggestedMax=this.parse(s.suggestedMax)}parse(s,_){return s}getUserBounds(){let{_userMin:s,_userMax:_,_suggestedMin:_e,_suggestedMax:et}=this;return s=finiteOrDefault(s,Number.POSITIVE_INFINITY),_=finiteOrDefault(_,Number.NEGATIVE_INFINITY),_e=finiteOrDefault(_e,Number.POSITIVE_INFINITY),et=finiteOrDefault(et,Number.NEGATIVE_INFINITY),{min:finiteOrDefault(s,_e),max:finiteOrDefault(_,et),minDefined:isNumberFinite(s),maxDefined:isNumberFinite(_)}}getMinMax(s){let{min:_,max:_e,minDefined:et,maxDefined:it}=this.getUserBounds(),tt;if(et&&it)return{min:_,max:_e};const rt=this.getMatchingVisibleMetas();for(let nt=0,ot=rt.length;nt<ot;++nt)tt=rt[nt].controller.getMinMax(this,s),et||(_=Math.min(_,tt.min)),it||(_e=Math.max(_e,tt.max));return _=it&&_>_e?_e:_,_e=et&&_>_e?_:_e,{min:finiteOrDefault(_,finiteOrDefault(_e,_)),max:finiteOrDefault(_e,finiteOrDefault(_,_e))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const s=this.chart.data;return this.options.labels||(this.isHorizontal()?s.xLabels:s.yLabels)||s.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){callback(this.options.beforeUpdate,[this])}update(s,_,_e){const{beginAtZero:et,grace:it,ticks:tt}=this.options,rt=tt.sampleSize;this.beforeUpdate(),this.maxWidth=s,this.maxHeight=_,this._margins=_e=Object.assign({left:0,right:0,top:0,bottom:0},_e),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+_e.left+_e.right:this.height+_e.top+_e.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=_addGrace(this,it,et),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const nt=rt<this.ticks.length;this._convertTicksToLabels(nt?sample(this.ticks,rt):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),tt.display&&(tt.autoSkip||tt.source==="auto")&&(this.ticks=autoSkip(this,this.ticks),this._labelSizes=null),nt&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let s=this.options.reverse,_,_e;this.isHorizontal()?(_=this.left,_e=this.right):(_=this.top,_e=this.bottom,s=!s),this._startPixel=_,this._endPixel=_e,this._reversePixels=s,this._length=_e-_,this._alignToPixels=this.options.alignToPixels}afterUpdate(){callback(this.options.afterUpdate,[this])}beforeSetDimensions(){callback(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){callback(this.options.afterSetDimensions,[this])}_callHooks(s){this.chart.notifyPlugins(s,this.getContext()),callback(this.options[s],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){callback(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(s){const _=this.options.ticks;let _e,et,it;for(_e=0,et=s.length;_e<et;_e++)it=s[_e],it.label=callback(_.callback,[it.value,_e,s],this)}afterTickToLabelConversion(){callback(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){callback(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const s=this.options,_=s.ticks,_e=this.ticks.length,et=_.minRotation||0,it=_.maxRotation;let tt=et,rt,nt,ot;if(!this._isVisible()||!_.display||et>=it||_e<=1||!this.isHorizontal()){this.labelRotation=et;return}const st=this._getLabelSizes(),at=st.widest.width,lt=st.highest.height,ct=_limitValue(this.chart.width-at,0,this.maxWidth);rt=s.offset?this.maxWidth/_e:ct/(_e-1),at+6>rt&&(rt=ct/(_e-(s.offset?.5:1)),nt=this.maxHeight-getTickMarkLength(s.grid)-_.padding-getTitleHeight(s.title,this.chart.options.font),ot=Math.sqrt(at*at+lt*lt),tt=toDegrees(Math.min(Math.asin(_limitValue((st.highest.height+6)/rt,-1,1)),Math.asin(_limitValue(nt/ot,-1,1))-Math.asin(_limitValue(lt/ot,-1,1)))),tt=Math.max(et,Math.min(it,tt))),this.labelRotation=tt}afterCalculateLabelRotation(){callback(this.options.afterCalculateLabelRotation,[this])}beforeFit(){callback(this.options.beforeFit,[this])}fit(){const s={width:0,height:0},{chart:_,options:{ticks:_e,title:et,grid:it}}=this,tt=this._isVisible(),rt=this.isHorizontal();if(tt){const nt=getTitleHeight(et,_.options.font);if(rt?(s.width=this.maxWidth,s.height=getTickMarkLength(it)+nt):(s.height=this.maxHeight,s.width=getTickMarkLength(it)+nt),_e.display&&this.ticks.length){const{first:ot,last:st,widest:at,highest:lt}=this._getLabelSizes(),ct=_e.padding*2,ht=toRadians(this.labelRotation),mt=Math.cos(ht),dt=Math.sin(ht);if(rt){const ft=_e.mirror?0:dt*at.width+mt*lt.height;s.height=Math.min(this.maxHeight,s.height+ft+ct)}else{const ft=_e.mirror?0:mt*at.width+dt*lt.height;s.width=Math.min(this.maxWidth,s.width+ft+ct)}this._calculatePadding(ot,st,dt,mt)}}this._handleMargins(),rt?(this.width=this._length=_.width-this._margins.left-this._margins.right,this.height=s.height):(this.width=s.width,this.height=this._length=_.height-this._margins.top-this._margins.bottom)}_calculatePadding(s,_,_e,et){const{ticks:{align:it,padding:tt},position:rt}=this.options,nt=this.labelRotation!==0,ot=rt!=="top"&&this.axis==="x";if(this.isHorizontal()){const st=this.getPixelForTick(0)-this.left,at=this.right-this.getPixelForTick(this.ticks.length-1);let lt=0,ct=0;nt?ot?(lt=et*s.width,ct=_e*_.height):(lt=_e*s.height,ct=et*_.width):it==="start"?ct=_.width:it==="end"?lt=s.width:(lt=s.width/2,ct=_.width/2),this.paddingLeft=Math.max((lt-st+tt)*this.width/(this.width-st),0),this.paddingRight=Math.max((ct-at+tt)*this.width/(this.width-at),0)}else{let st=_.height/2,at=s.height/2;it==="start"?(st=0,at=s.height):it==="end"&&(st=_.height,at=0),this.paddingTop=st+tt,this.paddingBottom=at+tt}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){callback(this.options.afterFit,[this])}isHorizontal(){const{axis:s,position:_}=this.options;return _==="top"||_==="bottom"||s==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(s){this.beforeTickToLabelConversion(),this.generateTickLabels(s);let _,_e;for(_=0,_e=s.length;_<_e;_++)isNullOrUndef(s[_].label)&&(s.splice(_,1),_e--,_--);this.afterTickToLabelConversion()}_getLabelSizes(){let s=this._labelSizes;if(!s){const _=this.options.ticks.sampleSize;let _e=this.ticks;_<_e.length&&(_e=sample(_e,_)),this._labelSizes=s=this._computeLabelSizes(_e,_e.length)}return s}_computeLabelSizes(s,_){const{ctx:_e,_longestTextCache:et}=this,it=[],tt=[];let rt=0,nt=0,ot,st,at,lt,ct,ht,mt,dt,ft,ut,pt;for(ot=0;ot<_;++ot){if(lt=s[ot].label,ct=this._resolveTickFontOptions(ot),_e.font=ht=ct.string,mt=et[ht]=et[ht]||{data:{},gc:[]},dt=ct.lineHeight,ft=ut=0,!isNullOrUndef(lt)&&!isArray(lt))ft=_measureText(_e,mt.data,mt.gc,ft,lt),ut=dt;else if(isArray(lt))for(st=0,at=lt.length;st<at;++st)pt=lt[st],!isNullOrUndef(pt)&&!isArray(pt)&&(ft=_measureText(_e,mt.data,mt.gc,ft,pt),ut+=dt);it.push(ft),tt.push(ut),rt=Math.max(ft,rt),nt=Math.max(ut,nt)}garbageCollect(et,_);const At=it.indexOf(rt),gt=tt.indexOf(nt),vt=yt=>({width:it[yt]||0,height:tt[yt]||0});return{first:vt(0),last:vt(_-1),widest:vt(At),highest:vt(gt),widths:it,heights:tt}}getLabelForValue(s){return s}getPixelForValue(s,_){return NaN}getValueForPixel(s){}getPixelForTick(s){const _=this.ticks;return s<0||s>_.length-1?null:this.getPixelForValue(_[s].value)}getPixelForDecimal(s){this._reversePixels&&(s=1-s);const _=this._startPixel+s*this._length;return _int16Range(this._alignToPixels?_alignPixel(this.chart,_,0):_)}getDecimalForPixel(s){const _=(s-this._startPixel)/this._length;return this._reversePixels?1-_:_}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:s,max:_}=this;return s<0&&_<0?_:s>0&&_>0?s:0}getContext(s){const _=this.ticks||[];if(s>=0&&s<_.length){const _e=_[s];return _e.$context||(_e.$context=createTickContext(this.getContext(),s,_e))}return this.$context||(this.$context=createScaleContext(this.chart.getContext(),this))}_tickSize(){const s=this.options.ticks,_=toRadians(this.labelRotation),_e=Math.abs(Math.cos(_)),et=Math.abs(Math.sin(_)),it=this._getLabelSizes(),tt=s.autoSkipPadding||0,rt=it?it.widest.width+tt:0,nt=it?it.highest.height+tt:0;return this.isHorizontal()?nt*_e>rt*et?rt/_e:nt/et:nt*et<rt*_e?nt/_e:rt/et}_isVisible(){const s=this.options.display;return s!=="auto"?!!s:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(s){const _=this.axis,_e=this.chart,et=this.options,{grid:it,position:tt}=et,rt=it.offset,nt=this.isHorizontal(),st=this.ticks.length+(rt?1:0),at=getTickMarkLength(it),lt=[],ct=it.setContext(this.getContext()),ht=ct.drawBorder?ct.borderWidth:0,mt=ht/2,dt=function(jt){return _alignPixel(_e,jt,ht)};let ft,ut,pt,At,gt,vt,yt,bt,Ct,xt,It,St;if(tt==="top")ft=dt(this.bottom),vt=this.bottom-at,bt=ft-mt,xt=dt(s.top)+mt,St=s.bottom;else if(tt==="bottom")ft=dt(this.top),xt=s.top,St=dt(s.bottom)-mt,vt=ft+mt,bt=this.top+at;else if(tt==="left")ft=dt(this.right),gt=this.right-at,yt=ft-mt,Ct=dt(s.left)+mt,It=s.right;else if(tt==="right")ft=dt(this.left),Ct=s.left,It=dt(s.right)-mt,gt=ft+mt,yt=this.left+at;else if(_==="x"){if(tt==="center")ft=dt((s.top+s.bottom)/2+.5);else if(isObject(tt)){const jt=Object.keys(tt)[0],Ft=tt[jt];ft=dt(this.chart.scales[jt].getPixelForValue(Ft))}xt=s.top,St=s.bottom,vt=ft+mt,bt=vt+at}else if(_==="y"){if(tt==="center")ft=dt((s.left+s.right)/2);else if(isObject(tt)){const jt=Object.keys(tt)[0],Ft=tt[jt];ft=dt(this.chart.scales[jt].getPixelForValue(Ft))}gt=ft-mt,yt=gt-at,Ct=s.left,It=s.right}const Ot=valueOrDefault(et.ticks.maxTicksLimit,st),Mt=Math.max(1,Math.ceil(st/Ot));for(ut=0;ut<st;ut+=Mt){const jt=it.setContext(this.getContext(ut)),Ft=jt.lineWidth,Ut=jt.color,Qt=it.borderDash||[],Ht=jt.borderDashOffset,Zt=jt.tickWidth,Wt=jt.tickColor,$t=jt.tickBorderDash||[],Jt=jt.tickBorderDashOffset;pt=getPixelForGridLine(this,ut,rt),pt!==void 0&&(At=_alignPixel(_e,pt,Ft),nt?gt=yt=Ct=It=At:vt=bt=xt=St=At,lt.push({tx1:gt,ty1:vt,tx2:yt,ty2:bt,x1:Ct,y1:xt,x2:It,y2:St,width:Ft,color:Ut,borderDash:Qt,borderDashOffset:Ht,tickWidth:Zt,tickColor:Wt,tickBorderDash:$t,tickBorderDashOffset:Jt}))}return this._ticksLength=st,this._borderValue=ft,lt}_computeLabelItems(s){const _=this.axis,_e=this.options,{position:et,ticks:it}=_e,tt=this.isHorizontal(),rt=this.ticks,{align:nt,crossAlign:ot,padding:st,mirror:at}=it,lt=getTickMarkLength(_e.grid),ct=lt+st,ht=at?-st:ct,mt=-toRadians(this.labelRotation),dt=[];let ft,ut,pt,At,gt,vt,yt,bt,Ct,xt,It,St,Ot="middle";if(et==="top")vt=this.bottom-ht,yt=this._getXAxisLabelAlignment();else if(et==="bottom")vt=this.top+ht,yt=this._getXAxisLabelAlignment();else if(et==="left"){const jt=this._getYAxisLabelAlignment(lt);yt=jt.textAlign,gt=jt.x}else if(et==="right"){const jt=this._getYAxisLabelAlignment(lt);yt=jt.textAlign,gt=jt.x}else if(_==="x"){if(et==="center")vt=(s.top+s.bottom)/2+ct;else if(isObject(et)){const jt=Object.keys(et)[0],Ft=et[jt];vt=this.chart.scales[jt].getPixelForValue(Ft)+ct}yt=this._getXAxisLabelAlignment()}else if(_==="y"){if(et==="center")gt=(s.left+s.right)/2-ct;else if(isObject(et)){const jt=Object.keys(et)[0],Ft=et[jt];gt=this.chart.scales[jt].getPixelForValue(Ft)}yt=this._getYAxisLabelAlignment(lt).textAlign}_==="y"&&(nt==="start"?Ot="top":nt==="end"&&(Ot="bottom"));const Mt=this._getLabelSizes();for(ft=0,ut=rt.length;ft<ut;++ft){pt=rt[ft],At=pt.label;const jt=it.setContext(this.getContext(ft));bt=this.getPixelForTick(ft)+it.labelOffset,Ct=this._resolveTickFontOptions(ft),xt=Ct.lineHeight,It=isArray(At)?At.length:1;const Ft=It/2,Ut=jt.color,Qt=jt.textStrokeColor,Ht=jt.textStrokeWidth;tt?(gt=bt,et==="top"?ot==="near"||mt!==0?St=-It*xt+xt/2:ot==="center"?St=-Mt.highest.height/2-Ft*xt+xt:St=-Mt.highest.height+xt/2:ot==="near"||mt!==0?St=xt/2:ot==="center"?St=Mt.highest.height/2-Ft*xt:St=Mt.highest.height-It*xt,at&&(St*=-1)):(vt=bt,St=(1-It)*xt/2);let Zt;if(jt.showLabelBackdrop){const Wt=toPadding(jt.backdropPadding),$t=Mt.heights[ft],Jt=Mt.widths[ft];let Nt=vt+St-Wt.top,Lt=gt-Wt.left;switch(Ot){case"middle":Nt-=$t/2;break;case"bottom":Nt-=$t;break}switch(yt){case"center":Lt-=Jt/2;break;case"right":Lt-=Jt;break}Zt={left:Lt,top:Nt,width:Jt+Wt.width,height:$t+Wt.height,color:jt.backdropColor}}dt.push({rotation:mt,label:At,font:Ct,color:Ut,strokeColor:Qt,strokeWidth:Ht,textOffset:St,textAlign:yt,textBaseline:Ot,translation:[gt,vt],backdrop:Zt})}return dt}_getXAxisLabelAlignment(){const{position:s,ticks:_}=this.options;if(-toRadians(this.labelRotation))return s==="top"?"left":"right";let et="center";return _.align==="start"?et="left":_.align==="end"&&(et="right"),et}_getYAxisLabelAlignment(s){const{position:_,ticks:{crossAlign:_e,mirror:et,padding:it}}=this.options,tt=this._getLabelSizes(),rt=s+it,nt=tt.widest.width;let ot,st;return _==="left"?et?(st=this.right+it,_e==="near"?ot="left":_e==="center"?(ot="center",st+=nt/2):(ot="right",st+=nt)):(st=this.right-rt,_e==="near"?ot="right":_e==="center"?(ot="center",st-=nt/2):(ot="left",st=this.left)):_==="right"?et?(st=this.left+it,_e==="near"?ot="right":_e==="center"?(ot="center",st-=nt/2):(ot="left",st-=nt)):(st=this.left+rt,_e==="near"?ot="left":_e==="center"?(ot="center",st+=nt/2):(ot="right",st=this.right)):ot="right",{textAlign:ot,x:st}}_computeLabelArea(){if(this.options.ticks.mirror)return;const s=this.chart,_=this.options.position;if(_==="left"||_==="right")return{top:0,left:this.left,bottom:s.height,right:this.right};if(_==="top"||_==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:s.width}}drawBackground(){const{ctx:s,options:{backgroundColor:_},left:_e,top:et,width:it,height:tt}=this;_&&(s.save(),s.fillStyle=_,s.fillRect(_e,et,it,tt),s.restore())}getLineWidthForValue(s){const _=this.options.grid;if(!this._isVisible()||!_.display)return 0;const et=this.ticks.findIndex(it=>it.value===s);return et>=0?_.setContext(this.getContext(et)).lineWidth:0}drawGrid(s){const _=this.options.grid,_e=this.ctx,et=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(s));let it,tt;const rt=(nt,ot,st)=>{!st.width||!st.color||(_e.save(),_e.lineWidth=st.width,_e.strokeStyle=st.color,_e.setLineDash(st.borderDash||[]),_e.lineDashOffset=st.borderDashOffset,_e.beginPath(),_e.moveTo(nt.x,nt.y),_e.lineTo(ot.x,ot.y),_e.stroke(),_e.restore())};if(_.display)for(it=0,tt=et.length;it<tt;++it){const nt=et[it];_.drawOnChartArea&&rt({x:nt.x1,y:nt.y1},{x:nt.x2,y:nt.y2},nt),_.drawTicks&&rt({x:nt.tx1,y:nt.ty1},{x:nt.tx2,y:nt.ty2},{color:nt.tickColor,width:nt.tickWidth,borderDash:nt.tickBorderDash,borderDashOffset:nt.tickBorderDashOffset})}}drawBorder(){const{chart:s,ctx:_,options:{grid:_e}}=this,et=_e.setContext(this.getContext()),it=_e.drawBorder?et.borderWidth:0;if(!it)return;const tt=_e.setContext(this.getContext(0)).lineWidth,rt=this._borderValue;let nt,ot,st,at;this.isHorizontal()?(nt=_alignPixel(s,this.left,it)-it/2,ot=_alignPixel(s,this.right,tt)+tt/2,st=at=rt):(st=_alignPixel(s,this.top,it)-it/2,at=_alignPixel(s,this.bottom,tt)+tt/2,nt=ot=rt),_.save(),_.lineWidth=et.borderWidth,_.strokeStyle=et.borderColor,_.beginPath(),_.moveTo(nt,st),_.lineTo(ot,at),_.stroke(),_.restore()}drawLabels(s){if(!this.options.ticks.display)return;const _e=this.ctx,et=this._computeLabelArea();et&&clipArea(_e,et);const it=this._labelItems||(this._labelItems=this._computeLabelItems(s));let tt,rt;for(tt=0,rt=it.length;tt<rt;++tt){const nt=it[tt],ot=nt.font,st=nt.label;nt.backdrop&&(_e.fillStyle=nt.backdrop.color,_e.fillRect(nt.backdrop.left,nt.backdrop.top,nt.backdrop.width,nt.backdrop.height));let at=nt.textOffset;renderText(_e,st,0,at,ot,nt)}et&&unclipArea(_e)}drawTitle(){const{ctx:s,options:{position:_,title:_e,reverse:et}}=this;if(!_e.display)return;const it=toFont(_e.font),tt=toPadding(_e.padding),rt=_e.align;let nt=it.lineHeight/2;_==="bottom"||_==="center"||isObject(_)?(nt+=tt.bottom,isArray(_e.text)&&(nt+=it.lineHeight*(_e.text.length-1))):nt+=tt.top;const{titleX:ot,titleY:st,maxWidth:at,rotation:lt}=titleArgs(this,nt,_,rt);renderText(s,_e.text,0,0,it,{color:_e.color,maxWidth:at,rotation:lt,textAlign:titleAlign(rt,_,et),textBaseline:"middle",translation:[ot,st]})}draw(s){!this._isVisible()||(this.drawBackground(),this.drawGrid(s),this.drawBorder(),this.drawTitle(),this.drawLabels(s))}_layers(){const s=this.options,_=s.ticks&&s.ticks.z||0,_e=valueOrDefault(s.grid&&s.grid.z,-1);return!this._isVisible()||this.draw!==Scale.prototype.draw?[{z:_,draw:et=>{this.draw(et)}}]:[{z:_e,draw:et=>{this.drawBackground(),this.drawGrid(et),this.drawTitle()}},{z:_e+1,draw:()=>{this.drawBorder()}},{z:_,draw:et=>{this.drawLabels(et)}}]}getMatchingVisibleMetas(s){const _=this.chart.getSortedVisibleDatasetMetas(),_e=this.axis+"AxisID",et=[];let it,tt;for(it=0,tt=_.length;it<tt;++it){const rt=_[it];rt[_e]===this.id&&(!s||rt.type===s)&&et.push(rt)}return et}_resolveTickFontOptions(s){const _=this.options.ticks.setContext(this.getContext(s));return toFont(_.font)}_maxDigits(){const s=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/s}}class TypedRegistry{constructor(s,_,_e){this.type=s,this.scope=_,this.override=_e,this.items=Object.create(null)}isForType(s){return Object.prototype.isPrototypeOf.call(this.type.prototype,s.prototype)}register(s){const _=Object.getPrototypeOf(s);let _e;isIChartComponent(_)&&(_e=this.register(_));const et=this.items,it=s.id,tt=this.scope+"."+it;if(!it)throw new Error("class does not have id: "+s);return it in et||(et[it]=s,registerDefaults(s,tt,_e),this.override&&defaults.override(s.id,s.overrides)),tt}get(s){return this.items[s]}unregister(s){const _=this.items,_e=s.id,et=this.scope;_e in _&&delete _[_e],et&&_e in defaults[et]&&(delete defaults[et][_e],this.override&&delete overrides[_e])}}function registerDefaults(o,s,_){const _e=merge(Object.create(null),[_?defaults.get(_):{},defaults.get(s),o.defaults]);defaults.set(s,_e),o.defaultRoutes&&routeDefaults(s,o.defaultRoutes),o.descriptors&&defaults.describe(s,o.descriptors)}function routeDefaults(o,s){Object.keys(s).forEach(_=>{const _e=_.split("."),et=_e.pop(),it=[o].concat(_e).join("."),tt=s[_].split("."),rt=tt.pop(),nt=tt.join(".");defaults.route(it,et,nt,rt)})}function isIChartComponent(o){return"id"in o&&"defaults"in o}class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element$1,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...s){this._each("register",s)}remove(...s){this._each("unregister",s)}addControllers(...s){this._each("register",s,this.controllers)}addElements(...s){this._each("register",s,this.elements)}addPlugins(...s){this._each("register",s,this.plugins)}addScales(...s){this._each("register",s,this.scales)}getController(s){return this._get(s,this.controllers,"controller")}getElement(s){return this._get(s,this.elements,"element")}getPlugin(s){return this._get(s,this.plugins,"plugin")}getScale(s){return this._get(s,this.scales,"scale")}removeControllers(...s){this._each("unregister",s,this.controllers)}removeElements(...s){this._each("unregister",s,this.elements)}removePlugins(...s){this._each("unregister",s,this.plugins)}removeScales(...s){this._each("unregister",s,this.scales)}_each(s,_,_e){[..._].forEach(et=>{const it=_e||this._getRegistryForType(et);_e||it.isForType(et)||it===this.plugins&&et.id?this._exec(s,it,et):each(et,tt=>{const rt=_e||this._getRegistryForType(tt);this._exec(s,rt,tt)})})}_exec(s,_,_e){const et=_capitalize(s);callback(_e["before"+et],[],_e),_[s](_e),callback(_e["after"+et],[],_e)}_getRegistryForType(s){for(let _=0;_<this._typedRegistries.length;_++){const _e=this._typedRegistries[_];if(_e.isForType(s))return _e}return this.plugins}_get(s,_,_e){const et=_.get(s);if(et===void 0)throw new Error('"'+s+'" is not a registered '+_e+".");return et}}var registry=new Registry;class PluginService{constructor(){this._init=[]}notify(s,_,_e,et){_==="beforeInit"&&(this._init=this._createDescriptors(s,!0),this._notify(this._init,s,"install"));const it=et?this._descriptors(s).filter(et):this._descriptors(s),tt=this._notify(it,s,_,_e);return _==="afterDestroy"&&(this._notify(it,s,"stop"),this._notify(this._init,s,"uninstall")),tt}_notify(s,_,_e,et){et=et||{};for(const it of s){const tt=it.plugin,rt=tt[_e],nt=[_,et,it.options];if(callback(rt,nt,tt)===!1&&et.cancelable)return!1}return!0}invalidate(){isNullOrUndef(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(s){if(this._cache)return this._cache;const _=this._cache=this._createDescriptors(s);return this._notifyStateChanges(s),_}_createDescriptors(s,_){const _e=s&&s.config,et=valueOrDefault(_e.options&&_e.options.plugins,{}),it=allPlugins(_e);return et===!1&&!_?[]:createDescriptors(s,it,et,_)}_notifyStateChanges(s){const _=this._oldCache||[],_e=this._cache,et=(it,tt)=>it.filter(rt=>!tt.some(nt=>rt.plugin.id===nt.plugin.id));this._notify(et(_,_e),s,"stop"),this._notify(et(_e,_),s,"start")}}function allPlugins(o){const s=[],_=Object.keys(registry.plugins.items);for(let et=0;et<_.length;et++)s.push(registry.getPlugin(_[et]));const _e=o.plugins||[];for(let et=0;et<_e.length;et++){const it=_e[et];s.indexOf(it)===-1&&s.push(it)}return s}function getOpts(o,s){return!s&&o===!1?null:o===!0?{}:o}function createDescriptors(o,s,_,_e){const et=[],it=o.getContext();for(let tt=0;tt<s.length;tt++){const rt=s[tt],nt=rt.id,ot=getOpts(_[nt],_e);ot!==null&&et.push({plugin:rt,options:pluginOpts(o.config,rt,ot,it)})}return et}function pluginOpts(o,s,_,_e){const et=o.pluginScopeKeys(s),it=o.getOptionScopes(_,et);return o.createResolver(it,_e,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function getIndexAxis(o,s){const _=defaults.datasets[o]||{};return((s.datasets||{})[o]||{}).indexAxis||s.indexAxis||_.indexAxis||"x"}function getAxisFromDefaultScaleID(o,s){let _=o;return o==="_index_"?_=s:o==="_value_"&&(_=s==="x"?"y":"x"),_}function getDefaultScaleIDFromAxis(o,s){return o===s?"_index_":"_value_"}function axisFromPosition(o){if(o==="top"||o==="bottom")return"x";if(o==="left"||o==="right")return"y"}function determineAxis(o,s){return o==="x"||o==="y"?o:s.axis||axisFromPosition(s.position)||o.charAt(0).toLowerCase()}function mergeScaleConfig(o,s){const _=overrides[o.type]||{scales:{}},_e=s.scales||{},et=getIndexAxis(o.type,s),it=Object.create(null),tt=Object.create(null);return Object.keys(_e).forEach(rt=>{const nt=_e[rt];if(!isObject(nt))return console.error(`Invalid scale configuration for scale: ${rt}`);if(nt._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${rt}`);const ot=determineAxis(rt,nt),st=getDefaultScaleIDFromAxis(ot,et),at=_.scales||{};it[ot]=it[ot]||rt,tt[rt]=mergeIf(Object.create(null),[{axis:ot},nt,at[ot],at[st]])}),o.data.datasets.forEach(rt=>{const nt=rt.type||o.type,ot=rt.indexAxis||getIndexAxis(nt,s),at=(overrides[nt]||{}).scales||{};Object.keys(at).forEach(lt=>{const ct=getAxisFromDefaultScaleID(lt,ot),ht=rt[ct+"AxisID"]||it[ct]||ct;tt[ht]=tt[ht]||Object.create(null),mergeIf(tt[ht],[{axis:ct},_e[ht],at[lt]])})}),Object.keys(tt).forEach(rt=>{const nt=tt[rt];mergeIf(nt,[defaults.scales[nt.type],defaults.scale])}),tt}function initOptions(o){const s=o.options||(o.options={});s.plugins=valueOrDefault(s.plugins,{}),s.scales=mergeScaleConfig(o,s)}function initData(o){return o=o||{},o.datasets=o.datasets||[],o.labels=o.labels||[],o}function initConfig(o){return o=o||{},o.data=initData(o.data),initOptions(o),o}const keyCache=new Map,keysCached=new Set;function cachedKeys(o,s){let _=keyCache.get(o);return _||(_=s(),keyCache.set(o,_),keysCached.add(_)),_}const addIfFound=(o,s,_)=>{const _e=resolveObjectKey(s,_);_e!==void 0&&o.add(_e)};class Config{constructor(s){this._config=initConfig(s),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(s){this._config.type=s}get data(){return this._config.data}set data(s){this._config.data=initData(s)}get options(){return this._config.options}set options(s){this._config.options=s}get plugins(){return this._config.plugins}update(){const s=this._config;this.clearCache(),initOptions(s)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(s){return cachedKeys(s,()=>[[`datasets.${s}`,""]])}datasetAnimationScopeKeys(s,_){return cachedKeys(`${s}.transition.${_}`,()=>[[`datasets.${s}.transitions.${_}`,`transitions.${_}`],[`datasets.${s}`,""]])}datasetElementScopeKeys(s,_){return cachedKeys(`${s}-${_}`,()=>[[`datasets.${s}.elements.${_}`,`datasets.${s}`,`elements.${_}`,""]])}pluginScopeKeys(s){const _=s.id,_e=this.type;return cachedKeys(`${_e}-plugin-${_}`,()=>[[`plugins.${_}`,...s.additionalOptionScopes||[]]])}_cachedScopes(s,_){const _e=this._scopeCache;let et=_e.get(s);return(!et||_)&&(et=new Map,_e.set(s,et)),et}getOptionScopes(s,_,_e){const{options:et,type:it}=this,tt=this._cachedScopes(s,_e),rt=tt.get(_);if(rt)return rt;const nt=new Set;_.forEach(st=>{s&&(nt.add(s),st.forEach(at=>addIfFound(nt,s,at))),st.forEach(at=>addIfFound(nt,et,at)),st.forEach(at=>addIfFound(nt,overrides[it]||{},at)),st.forEach(at=>addIfFound(nt,defaults,at)),st.forEach(at=>addIfFound(nt,descriptors,at))});const ot=Array.from(nt);return ot.length===0&&ot.push(Object.create(null)),keysCached.has(_)&&tt.set(_,ot),ot}chartOptionScopes(){const{options:s,type:_}=this;return[s,overrides[_]||{},defaults.datasets[_]||{},{type:_},defaults,descriptors]}resolveNamedOptions(s,_,_e,et=[""]){const it={$shared:!0},{resolver:tt,subPrefixes:rt}=getResolver(this._resolverCache,s,et);let nt=tt;if(needContext(tt,_)){it.$shared=!1,_e=isFunction(_e)?_e():_e;const ot=this.createResolver(s,_e,rt);nt=_attachContext(tt,_e,ot)}for(const ot of _)it[ot]=nt[ot];return it}createResolver(s,_,_e=[""],et){const{resolver:it}=getResolver(this._resolverCache,s,_e);return isObject(_)?_attachContext(it,_,void 0,et):it}}function getResolver(o,s,_){let _e=o.get(s);_e||(_e=new Map,o.set(s,_e));const et=_.join();let it=_e.get(et);return it||(it={resolver:_createResolver(s,_),subPrefixes:_.filter(rt=>!rt.toLowerCase().includes("hover"))},_e.set(et,it)),it}const hasFunction=o=>isObject(o)&&Object.getOwnPropertyNames(o).reduce((s,_)=>s||isFunction(o[_]),!1);function needContext(o,s){const{isScriptable:_,isIndexable:_e}=_descriptors(o);for(const et of s){const it=_(et),tt=_e(et),rt=(tt||it)&&o[et];if(it&&(isFunction(rt)||hasFunction(rt))||tt&&isArray(rt))return!0}return!1}var version="3.7.0";const KNOWN_POSITIONS=["top","bottom","left","right","chartArea"];function positionIsHorizontal(o,s){return o==="top"||o==="bottom"||KNOWN_POSITIONS.indexOf(o)===-1&&s==="x"}function compare2Level(o,s){return function(_,_e){return _[o]===_e[o]?_[s]-_e[s]:_[o]-_e[o]}}function onAnimationsComplete(o){const s=o.chart,_=s.options.animation;s.notifyPlugins("afterRender"),callback(_&&_.onComplete,[o],s)}function onAnimationProgress(o){const s=o.chart,_=s.options.animation;callback(_&&_.onProgress,[o],s)}function getCanvas(o){return _isDomSupported()&&typeof o=="string"?o=document.getElementById(o):o&&o.length&&(o=o[0]),o&&o.canvas&&(o=o.canvas),o}const instances={},getChart=o=>{const s=getCanvas(o);return Object.values(instances).filter(_=>_.canvas===s).pop()};function moveNumericKeys(o,s,_){const _e=Object.keys(o);for(const et of _e){const it=+et;if(it>=s){const tt=o[et];delete o[et],(_>0||it>s)&&(o[it+_]=tt)}}}function determineLastEvent(o,s,_,_e){return!_||o.type==="mouseout"?null:_e?s:o}class Chart$1{constructor(s,_){const _e=this.config=new Config(_),et=getCanvas(s),it=getChart(et);if(it)throw new Error("Canvas is already in use. Chart with ID '"+it.id+"' must be destroyed before the canvas can be reused.");const tt=_e.createResolver(_e.chartOptionScopes(),this.getContext());this.platform=new(_e.platform||_detectPlatform(et)),this.platform.updateConfig(_e);const rt=this.platform.acquireContext(et,tt.aspectRatio),nt=rt&&rt.canvas,ot=nt&&nt.height,st=nt&&nt.width;if(this.id=uid(),this.ctx=rt,this.canvas=nt,this.width=st,this.height=ot,this._options=tt,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=debounce(at=>this.update(at),tt.resizeDelay||0),this._dataChanges=[],instances[this.id]=this,!rt||!nt){console.error("Failed to create chart: can't acquire context from the given item");return}animator.listen(this,"complete",onAnimationsComplete),animator.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:s,maintainAspectRatio:_},width:_e,height:et,_aspectRatio:it}=this;return isNullOrUndef(s)?_&&it?it:et?_e/et:null:s}get data(){return this.config.data}set data(s){this.config.data=s}get options(){return this._options}set options(s){this.config.options=s}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return clearCanvas(this.canvas,this.ctx),this}stop(){return animator.stop(this),this}resize(s,_){animator.running(this)?this._resizeBeforeDraw={width:s,height:_}:this._resize(s,_)}_resize(s,_){const _e=this.options,et=this.canvas,it=_e.maintainAspectRatio&&this.aspectRatio,tt=this.platform.getMaximumSize(et,s,_,it),rt=_e.devicePixelRatio||this.platform.getDevicePixelRatio(),nt=this.width?"resize":"attach";this.width=tt.width,this.height=tt.height,this._aspectRatio=this.aspectRatio,retinaScale(this,rt,!0)&&(this.notifyPlugins("resize",{size:tt}),callback(_e.onResize,[this,tt],this),this.attached&&this._doResize(nt)&&this.render())}ensureScalesHaveIDs(){const _=this.options.scales||{};each(_,(_e,et)=>{_e.id=et})}buildOrUpdateScales(){const s=this.options,_=s.scales,_e=this.scales,et=Object.keys(_e).reduce((tt,rt)=>(tt[rt]=!1,tt),{});let it=[];_&&(it=it.concat(Object.keys(_).map(tt=>{const rt=_[tt],nt=determineAxis(tt,rt),ot=nt==="r",st=nt==="x";return{options:rt,dposition:ot?"chartArea":st?"bottom":"left",dtype:ot?"radialLinear":st?"category":"linear"}}))),each(it,tt=>{const rt=tt.options,nt=rt.id,ot=determineAxis(nt,rt),st=valueOrDefault(rt.type,tt.dtype);(rt.position===void 0||positionIsHorizontal(rt.position,ot)!==positionIsHorizontal(tt.dposition))&&(rt.position=tt.dposition),et[nt]=!0;let at=null;if(nt in _e&&_e[nt].type===st)at=_e[nt];else{const lt=registry.getScale(st);at=new lt({id:nt,type:st,ctx:this.ctx,chart:this}),_e[at.id]=at}at.init(rt,s)}),each(et,(tt,rt)=>{tt||delete _e[rt]}),each(_e,tt=>{layouts.configure(this,tt,tt.options),layouts.addBox(this,tt)})}_updateMetasets(){const s=this._metasets,_=this.data.datasets.length,_e=s.length;if(s.sort((et,it)=>et.index-it.index),_e>_){for(let et=_;et<_e;++et)this._destroyDatasetMeta(et);s.splice(_,_e-_)}this._sortedMetasets=s.slice(0).sort(compare2Level("order","index"))}_removeUnreferencedMetasets(){const{_metasets:s,data:{datasets:_}}=this;s.length>_.length&&delete this._stacks,s.forEach((_e,et)=>{_.filter(it=>it===_e._dataset).length===0&&this._destroyDatasetMeta(et)})}buildOrUpdateControllers(){const s=[],_=this.data.datasets;let _e,et;for(this._removeUnreferencedMetasets(),_e=0,et=_.length;_e<et;_e++){const it=_[_e];let tt=this.getDatasetMeta(_e);const rt=it.type||this.config.type;if(tt.type&&tt.type!==rt&&(this._destroyDatasetMeta(_e),tt=this.getDatasetMeta(_e)),tt.type=rt,tt.indexAxis=it.indexAxis||getIndexAxis(rt,this.options),tt.order=it.order||0,tt.index=_e,tt.label=""+it.label,tt.visible=this.isDatasetVisible(_e),tt.controller)tt.controller.updateIndex(_e),tt.controller.linkScales();else{const nt=registry.getController(rt),{datasetElementType:ot,dataElementType:st}=defaults.datasets[rt];Object.assign(nt.prototype,{dataElementType:registry.getElement(st),datasetElementType:ot&&registry.getElement(ot)}),tt.controller=new nt(this,_e),s.push(tt.controller)}}return this._updateMetasets(),s}_resetElements(){each(this.data.datasets,(s,_)=>{this.getDatasetMeta(_).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(s){const _=this.config;_.update();const _e=this._options=_.createResolver(_.chartOptionScopes(),this.getContext()),et=this._animationsDisabled=!_e.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:s,cancelable:!0})===!1)return;const it=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let tt=0;for(let ot=0,st=this.data.datasets.length;ot<st;ot++){const{controller:at}=this.getDatasetMeta(ot),lt=!et&&it.indexOf(at)===-1;at.buildOrUpdateElements(lt),tt=Math.max(+at.getMaxOverflow(),tt)}tt=this._minPadding=_e.layout.autoPadding?tt:0,this._updateLayout(tt),et||each(it,ot=>{ot.reset()}),this._updateDatasets(s),this.notifyPlugins("afterUpdate",{mode:s}),this._layers.sort(compare2Level("z","_idx"));const{_active:rt,_lastEvent:nt}=this;nt?this._eventHandler(nt,!0):rt.length&&this._updateHoverStyles(rt,rt,!0),this.render()}_updateScales(){each(this.scales,s=>{layouts.removeBox(this,s)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const s=this.options,_=new Set(Object.keys(this._listeners)),_e=new Set(s.events);(!setsEqual(_,_e)||!!this._responsiveListeners!==s.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:s}=this,_=this._getUniformDataChanges()||[];for(const{method:_e,start:et,count:it}of _){const tt=_e==="_removeElements"?-it:it;moveNumericKeys(s,et,tt)}}_getUniformDataChanges(){const s=this._dataChanges;if(!s||!s.length)return;this._dataChanges=[];const _=this.data.datasets.length,_e=it=>new Set(s.filter(tt=>tt[0]===it).map((tt,rt)=>rt+","+tt.splice(1).join(","))),et=_e(0);for(let it=1;it<_;it++)if(!setsEqual(et,_e(it)))return;return Array.from(et).map(it=>it.split(",")).map(it=>({method:it[1],start:+it[2],count:+it[3]}))}_updateLayout(s){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;layouts.update(this,this.width,this.height,s);const _=this.chartArea,_e=_.width<=0||_.height<=0;this._layers=[],each(this.boxes,et=>{_e&&et.position==="chartArea"||(et.configure&&et.configure(),this._layers.push(...et._layers()))},this),this._layers.forEach((et,it)=>{et._idx=it}),this.notifyPlugins("afterLayout")}_updateDatasets(s){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:s,cancelable:!0})!==!1){for(let _=0,_e=this.data.datasets.length;_<_e;++_)this.getDatasetMeta(_).controller.configure();for(let _=0,_e=this.data.datasets.length;_<_e;++_)this._updateDataset(_,isFunction(s)?s({datasetIndex:_}):s);this.notifyPlugins("afterDatasetsUpdate",{mode:s})}}_updateDataset(s,_){const _e=this.getDatasetMeta(s),et={meta:_e,index:s,mode:_,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",et)!==!1&&(_e.controller._update(_),et.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",et))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(animator.has(this)?this.attached&&!animator.running(this)&&animator.start(this):(this.draw(),onAnimationsComplete({chart:this})))}draw(){let s;if(this._resizeBeforeDraw){const{width:_e,height:et}=this._resizeBeforeDraw;this._resize(_e,et),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const _=this._layers;for(s=0;s<_.length&&_[s].z<=0;++s)_[s].draw(this.chartArea);for(this._drawDatasets();s<_.length;++s)_[s].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(s){const _=this._sortedMetasets,_e=[];let et,it;for(et=0,it=_.length;et<it;++et){const tt=_[et];(!s||tt.visible)&&_e.push(tt)}return _e}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const s=this.getSortedVisibleDatasetMetas();for(let _=s.length-1;_>=0;--_)this._drawDataset(s[_]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(s){const _=this.ctx,_e=s._clip,et=!_e.disabled,it=this.chartArea,tt={meta:s,index:s.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",tt)!==!1&&(et&&clipArea(_,{left:_e.left===!1?0:it.left-_e.left,right:_e.right===!1?this.width:it.right+_e.right,top:_e.top===!1?0:it.top-_e.top,bottom:_e.bottom===!1?this.height:it.bottom+_e.bottom}),s.controller.draw(),et&&unclipArea(_),tt.cancelable=!1,this.notifyPlugins("afterDatasetDraw",tt))}getElementsAtEventForMode(s,_,_e,et){const it=Interaction.modes[_];return typeof it=="function"?it(this,s,_e,et):[]}getDatasetMeta(s){const _=this.data.datasets[s],_e=this._metasets;let et=_e.filter(it=>it&&it._dataset===_).pop();return et||(et={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:_&&_.order||0,index:s,_dataset:_,_parsed:[],_sorted:!1},_e.push(et)),et}getContext(){return this.$context||(this.$context=createContext(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(s){const _=this.data.datasets[s];if(!_)return!1;const _e=this.getDatasetMeta(s);return typeof _e.hidden=="boolean"?!_e.hidden:!_.hidden}setDatasetVisibility(s,_){const _e=this.getDatasetMeta(s);_e.hidden=!_}toggleDataVisibility(s){this._hiddenIndices[s]=!this._hiddenIndices[s]}getDataVisibility(s){return!this._hiddenIndices[s]}_updateVisibility(s,_,_e){const et=_e?"show":"hide",it=this.getDatasetMeta(s),tt=it.controller._resolveAnimations(void 0,et);defined(_)?(it.data[_].hidden=!_e,this.update()):(this.setDatasetVisibility(s,_e),tt.update(it,{visible:_e}),this.update(rt=>rt.datasetIndex===s?et:void 0))}hide(s,_){this._updateVisibility(s,_,!1)}show(s,_){this._updateVisibility(s,_,!0)}_destroyDatasetMeta(s){const _=this._metasets[s];_&&_.controller&&_.controller._destroy(),delete this._metasets[s]}_stop(){let s,_;for(this.stop(),animator.remove(this),s=0,_=this.data.datasets.length;s<_;++s)this._destroyDatasetMeta(s)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:s,ctx:_}=this;this._stop(),this.config.clearCache(),s&&(this.unbindEvents(),clearCanvas(s,_),this.platform.releaseContext(_),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete instances[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...s){return this.canvas.toDataURL(...s)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const s=this._listeners,_=this.platform,_e=(it,tt)=>{_.addEventListener(this,it,tt),s[it]=tt},et=(it,tt,rt)=>{it.offsetX=tt,it.offsetY=rt,this._eventHandler(it)};each(this.options.events,it=>_e(it,et))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const s=this._responsiveListeners,_=this.platform,_e=(nt,ot)=>{_.addEventListener(this,nt,ot),s[nt]=ot},et=(nt,ot)=>{s[nt]&&(_.removeEventListener(this,nt,ot),delete s[nt])},it=(nt,ot)=>{this.canvas&&this.resize(nt,ot)};let tt;const rt=()=>{et("attach",rt),this.attached=!0,this.resize(),_e("resize",it),_e("detach",tt)};tt=()=>{this.attached=!1,et("resize",it),this._stop(),this._resize(0,0),_e("attach",rt)},_.isAttached(this.canvas)?rt():tt()}unbindEvents(){each(this._listeners,(s,_)=>{this.platform.removeEventListener(this,_,s)}),this._listeners={},each(this._responsiveListeners,(s,_)=>{this.platform.removeEventListener(this,_,s)}),this._responsiveListeners=void 0}updateHoverStyle(s,_,_e){const et=_e?"set":"remove";let it,tt,rt,nt;for(_==="dataset"&&(it=this.getDatasetMeta(s[0].datasetIndex),it.controller["_"+et+"DatasetHoverStyle"]()),rt=0,nt=s.length;rt<nt;++rt){tt=s[rt];const ot=tt&&this.getDatasetMeta(tt.datasetIndex).controller;ot&&ot[et+"HoverStyle"](tt.element,tt.datasetIndex,tt.index)}}getActiveElements(){return this._active||[]}setActiveElements(s){const _=this._active||[],_e=s.map(({datasetIndex:it,index:tt})=>{const rt=this.getDatasetMeta(it);if(!rt)throw new Error("No dataset found at index "+it);return{datasetIndex:it,element:rt.data[tt],index:tt}});!_elementsEqual(_e,_)&&(this._active=_e,this._lastEvent=null,this._updateHoverStyles(_e,_))}notifyPlugins(s,_,_e){return this._plugins.notify(this,s,_,_e)}_updateHoverStyles(s,_,_e){const et=this.options.hover,it=(nt,ot)=>nt.filter(st=>!ot.some(at=>st.datasetIndex===at.datasetIndex&&st.index===at.index)),tt=it(_,s),rt=_e?s:it(s,_);tt.length&&this.updateHoverStyle(tt,et.mode,!1),rt.length&&et.mode&&this.updateHoverStyle(rt,et.mode,!0)}_eventHandler(s,_){const _e={event:s,replay:_,cancelable:!0,inChartArea:_isPointInArea(s,this.chartArea,this._minPadding)},et=tt=>(tt.options.events||this.options.events).includes(s.native.type);if(this.notifyPlugins("beforeEvent",_e,et)===!1)return;const it=this._handleEvent(s,_,_e.inChartArea);return _e.cancelable=!1,this.notifyPlugins("afterEvent",_e,et),(it||_e.changed)&&this.render(),this}_handleEvent(s,_,_e){const{_active:et=[],options:it}=this,tt=_,rt=this._getActiveElements(s,et,_e,tt),nt=_isClickEvent(s),ot=determineLastEvent(s,this._lastEvent,_e,nt);_e&&(this._lastEvent=null,callback(it.onHover,[s,rt,this],this),nt&&callback(it.onClick,[s,rt,this],this));const st=!_elementsEqual(rt,et);return(st||_)&&(this._active=rt,this._updateHoverStyles(rt,et,_)),this._lastEvent=ot,st}_getActiveElements(s,_,_e,et){if(s.type==="mouseout")return[];if(!_e)return _;const it=this.options.hover;return this.getElementsAtEventForMode(s,it.mode,it,et)}}const invalidatePlugins=()=>each(Chart$1.instances,o=>o._plugins.invalidate()),enumerable=!0;Object.defineProperties(Chart$1,{defaults:{enumerable,value:defaults},instances:{enumerable,value:instances},overrides:{enumerable,value:overrides},registry:{enumerable,value:registry},version:{enumerable,value:version},getChart:{enumerable,value:getChart},register:{enumerable,value:(...o)=>{registry.add(...o),invalidatePlugins()}},unregister:{enumerable,value:(...o)=>{registry.remove(...o),invalidatePlugins()}}});function clipArc(o,s,_){const{startAngle:_e,pixelMargin:et,x:it,y:tt,outerRadius:rt,innerRadius:nt}=s;let ot=et/rt;o.beginPath(),o.arc(it,tt,rt,_e-ot,_+ot),nt>et?(ot=et/nt,o.arc(it,tt,nt,_+ot,_e-ot,!0)):o.arc(it,tt,et,_+HALF_PI,_e-HALF_PI),o.closePath(),o.clip()}function toRadiusCorners(o){return _readValueToProps(o,["outerStart","outerEnd","innerStart","innerEnd"])}function parseBorderRadius$1(o,s,_,_e){const et=toRadiusCorners(o.options.borderRadius),it=(_-s)/2,tt=Math.min(it,_e*s/2),rt=nt=>{const ot=(_-Math.min(it,nt))*_e/2;return _limitValue(nt,0,Math.min(it,ot))};return{outerStart:rt(et.outerStart),outerEnd:rt(et.outerEnd),innerStart:_limitValue(et.innerStart,0,tt),innerEnd:_limitValue(et.innerEnd,0,tt)}}function rThetaToXY(o,s,_,_e){return{x:_+o*Math.cos(s),y:_e+o*Math.sin(s)}}function pathArc(o,s,_,_e,et){const{x:it,y:tt,startAngle:rt,pixelMargin:nt,innerRadius:ot}=s,st=Math.max(s.outerRadius+_e+_-nt,0),at=ot>0?ot+_e+_+nt:0;let lt=0;const ct=et-rt;if(_e){const Ft=ot>0?ot-_e:0,Ut=st>0?st-_e:0,Qt=(Ft+Ut)/2,Ht=Qt!==0?ct*Qt/(Qt+_e):ct;lt=(ct-Ht)/2}const ht=Math.max(.001,ct*st-_/PI)/st,mt=(ct-ht)/2,dt=rt+mt+lt,ft=et-mt-lt,{outerStart:ut,outerEnd:pt,innerStart:At,innerEnd:gt}=parseBorderRadius$1(s,at,st,ft-dt),vt=st-ut,yt=st-pt,bt=dt+ut/vt,Ct=ft-pt/yt,xt=at+At,It=at+gt,St=dt+At/xt,Ot=ft-gt/It;if(o.beginPath(),o.arc(it,tt,st,bt,Ct),pt>0){const Ft=rThetaToXY(yt,Ct,it,tt);o.arc(Ft.x,Ft.y,pt,Ct,ft+HALF_PI)}const Mt=rThetaToXY(It,ft,it,tt);if(o.lineTo(Mt.x,Mt.y),gt>0){const Ft=rThetaToXY(It,Ot,it,tt);o.arc(Ft.x,Ft.y,gt,ft+HALF_PI,Ot+Math.PI)}if(o.arc(it,tt,at,ft-gt/at,dt+At/at,!0),At>0){const Ft=rThetaToXY(xt,St,it,tt);o.arc(Ft.x,Ft.y,At,St+Math.PI,dt-HALF_PI)}const jt=rThetaToXY(vt,dt,it,tt);if(o.lineTo(jt.x,jt.y),ut>0){const Ft=rThetaToXY(vt,bt,it,tt);o.arc(Ft.x,Ft.y,ut,dt-HALF_PI,bt)}o.closePath()}function drawArc(o,s,_,_e){const{fullCircles:et,startAngle:it,circumference:tt}=s;let rt=s.endAngle;if(et){pathArc(o,s,_,_e,it+TAU);for(let nt=0;nt<et;++nt)o.fill();isNaN(tt)||(rt=it+tt%TAU,tt%TAU===0&&(rt+=TAU))}return pathArc(o,s,_,_e,rt),o.fill(),rt}function drawFullCircleBorders(o,s,_){const{x:_e,y:et,startAngle:it,pixelMargin:tt,fullCircles:rt}=s,nt=Math.max(s.outerRadius-tt,0),ot=s.innerRadius+tt;let st;for(_&&clipArc(o,s,it+TAU),o.beginPath(),o.arc(_e,et,ot,it+TAU,it,!0),st=0;st<rt;++st)o.stroke();for(o.beginPath(),o.arc(_e,et,nt,it,it+TAU),st=0;st<rt;++st)o.stroke()}function drawBorder(o,s,_,_e,et){const{options:it}=s,{borderWidth:tt,borderJoinStyle:rt}=it,nt=it.borderAlign==="inner";!tt||(nt?(o.lineWidth=tt*2,o.lineJoin=rt||"round"):(o.lineWidth=tt,o.lineJoin=rt||"bevel"),s.fullCircles&&drawFullCircleBorders(o,s,nt),nt&&clipArc(o,s,et),pathArc(o,s,_,_e,et),o.stroke())}class ArcElement extends Element$1{constructor(s){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,s&&Object.assign(this,s)}inRange(s,_,_e){const et=this.getProps(["x","y"],_e),{angle:it,distance:tt}=getAngleFromPoint(et,{x:s,y:_}),{startAngle:rt,endAngle:nt,innerRadius:ot,outerRadius:st,circumference:at}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],_e),lt=this.options.spacing/2,ht=valueOrDefault(at,nt-rt)>=TAU||_angleBetween(it,rt,nt),mt=_isBetween(tt,ot+lt,st+lt);return ht&&mt}getCenterPoint(s){const{x:_,y:_e,startAngle:et,endAngle:it,innerRadius:tt,outerRadius:rt}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],s),{offset:nt,spacing:ot}=this.options,st=(et+it)/2,at=(tt+rt+ot+nt)/2;return{x:_+Math.cos(st)*at,y:_e+Math.sin(st)*at}}tooltipPosition(s){return this.getCenterPoint(s)}draw(s){const{options:_,circumference:_e}=this,et=(_.offset||0)/2,it=(_.spacing||0)/2;if(this.pixelMargin=_.borderAlign==="inner"?.33:0,this.fullCircles=_e>TAU?Math.floor(_e/TAU):0,_e===0||this.innerRadius<0||this.outerRadius<0)return;s.save();let tt=0;if(et){tt=et/2;const nt=(this.startAngle+this.endAngle)/2;s.translate(Math.cos(nt)*tt,Math.sin(nt)*tt),this.circumference>=PI&&(tt=et)}s.fillStyle=_.backgroundColor,s.strokeStyle=_.borderColor;const rt=drawArc(s,this,tt,it);drawBorder(s,this,tt,it,rt),s.restore()}}ArcElement.id="arc";ArcElement.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0};ArcElement.defaultRoutes={backgroundColor:"backgroundColor"};function setStyle(o,s,_=s){o.lineCap=valueOrDefault(_.borderCapStyle,s.borderCapStyle),o.setLineDash(valueOrDefault(_.borderDash,s.borderDash)),o.lineDashOffset=valueOrDefault(_.borderDashOffset,s.borderDashOffset),o.lineJoin=valueOrDefault(_.borderJoinStyle,s.borderJoinStyle),o.lineWidth=valueOrDefault(_.borderWidth,s.borderWidth),o.strokeStyle=valueOrDefault(_.borderColor,s.borderColor)}function lineTo(o,s,_){o.lineTo(_.x,_.y)}function getLineMethod(o){return o.stepped?_steppedLineTo:o.tension||o.cubicInterpolationMode==="monotone"?_bezierCurveTo:lineTo}function pathVars(o,s,_={}){const _e=o.length,{start:et=0,end:it=_e-1}=_,{start:tt,end:rt}=s,nt=Math.max(et,tt),ot=Math.min(it,rt),st=et<tt&&it<tt||et>rt&&it>rt;return{count:_e,start:nt,loop:s.loop,ilen:ot<nt&&!st?_e+ot-nt:ot-nt}}function pathSegment(o,s,_,_e){const{points:et,options:it}=s,{count:tt,start:rt,loop:nt,ilen:ot}=pathVars(et,_,_e),st=getLineMethod(it);let{move:at=!0,reverse:lt}=_e||{},ct,ht,mt;for(ct=0;ct<=ot;++ct)ht=et[(rt+(lt?ot-ct:ct))%tt],!ht.skip&&(at?(o.moveTo(ht.x,ht.y),at=!1):st(o,mt,ht,lt,it.stepped),mt=ht);return nt&&(ht=et[(rt+(lt?ot:0))%tt],st(o,mt,ht,lt,it.stepped)),!!nt}function fastPathSegment(o,s,_,_e){const et=s.points,{count:it,start:tt,ilen:rt}=pathVars(et,_,_e),{move:nt=!0,reverse:ot}=_e||{};let st=0,at=0,lt,ct,ht,mt,dt,ft;const ut=At=>(tt+(ot?rt-At:At))%it,pt=()=>{mt!==dt&&(o.lineTo(st,dt),o.lineTo(st,mt),o.lineTo(st,ft))};for(nt&&(ct=et[ut(0)],o.moveTo(ct.x,ct.y)),lt=0;lt<=rt;++lt){if(ct=et[ut(lt)],ct.skip)continue;const At=ct.x,gt=ct.y,vt=At|0;vt===ht?(gt<mt?mt=gt:gt>dt&&(dt=gt),st=(at*st+At)/++at):(pt(),o.lineTo(At,gt),ht=vt,at=0,mt=dt=gt),ft=gt}pt()}function _getSegmentMethod(o){const s=o.options,_=s.borderDash&&s.borderDash.length;return!o._decimated&&!o._loop&&!s.tension&&s.cubicInterpolationMode!=="monotone"&&!s.stepped&&!_?fastPathSegment:pathSegment}function _getInterpolationMethod(o){return o.stepped?_steppedInterpolation:o.tension||o.cubicInterpolationMode==="monotone"?_bezierInterpolation:_pointInLine}function strokePathWithCache(o,s,_,_e){let et=s._path;et||(et=s._path=new Path2D,s.path(et,_,_e)&&et.closePath()),setStyle(o,s.options),o.stroke(et)}function strokePathDirect(o,s,_,_e){const{segments:et,options:it}=s,tt=_getSegmentMethod(s);for(const rt of et)setStyle(o,it,rt.style),o.beginPath(),tt(o,s,rt,{start:_,end:_+_e-1})&&o.closePath(),o.stroke()}const usePath2D=typeof Path2D=="function";function draw(o,s,_,_e){usePath2D&&!s.options.segment?strokePathWithCache(o,s,_,_e):strokePathDirect(o,s,_,_e)}class LineElement extends Element$1{constructor(s){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,s&&Object.assign(this,s)}updateControlPoints(s,_){const _e=this.options;if((_e.tension||_e.cubicInterpolationMode==="monotone")&&!_e.stepped&&!this._pointsUpdated){const et=_e.spanGaps?this._loop:this._fullLoop;_updateBezierControlPoints(this._points,_e,s,et,_),this._pointsUpdated=!0}}set points(s){this._points=s,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=_computeSegments(this,this.options.segment))}first(){const s=this.segments,_=this.points;return s.length&&_[s[0].start]}last(){const s=this.segments,_=this.points,_e=s.length;return _e&&_[s[_e-1].end]}interpolate(s,_){const _e=this.options,et=s[_],it=this.points,tt=_boundSegments(this,{property:_,start:et,end:et});if(!tt.length)return;const rt=[],nt=_getInterpolationMethod(_e);let ot,st;for(ot=0,st=tt.length;ot<st;++ot){const{start:at,end:lt}=tt[ot],ct=it[at],ht=it[lt];if(ct===ht){rt.push(ct);continue}const mt=Math.abs((et-ct[_])/(ht[_]-ct[_])),dt=nt(ct,ht,mt,_e.stepped);dt[_]=s[_],rt.push(dt)}return rt.length===1?rt[0]:rt}pathSegment(s,_,_e){return _getSegmentMethod(this)(s,this,_,_e)}path(s,_,_e){const et=this.segments,it=_getSegmentMethod(this);let tt=this._loop;_=_||0,_e=_e||this.points.length-_;for(const rt of et)tt&=it(s,this,rt,{start:_,end:_+_e-1});return!!tt}draw(s,_,_e,et){const it=this.options||{};(this.points||[]).length&&it.borderWidth&&(s.save(),draw(s,this,_e,et),s.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}LineElement.id="line";LineElement.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};LineElement.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};LineElement.descriptors={_scriptable:!0,_indexable:o=>o!=="borderDash"&&o!=="fill"};function inRange$1(o,s,_,_e){const et=o.options,{[_]:it}=o.getProps([_],_e);return Math.abs(s-it)<et.radius+et.hitRadius}class PointElement extends Element$1{constructor(s){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,s&&Object.assign(this,s)}inRange(s,_,_e){const et=this.options,{x:it,y:tt}=this.getProps(["x","y"],_e);return Math.pow(s-it,2)+Math.pow(_-tt,2)<Math.pow(et.hitRadius+et.radius,2)}inXRange(s,_){return inRange$1(this,s,"x",_)}inYRange(s,_){return inRange$1(this,s,"y",_)}getCenterPoint(s){const{x:_,y:_e}=this.getProps(["x","y"],s);return{x:_,y:_e}}size(s){s=s||this.options||{};let _=s.radius||0;_=Math.max(_,_&&s.hoverRadius||0);const _e=_&&s.borderWidth||0;return(_+_e)*2}draw(s,_){const _e=this.options;this.skip||_e.radius<.1||!_isPointInArea(this,_,this.size(_e)/2)||(s.strokeStyle=_e.borderColor,s.lineWidth=_e.borderWidth,s.fillStyle=_e.backgroundColor,drawPoint(s,_e,this.x,this.y))}getRange(){const s=this.options||{};return s.radius+s.hitRadius}}PointElement.id="point";PointElement.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};PointElement.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};function getBarBounds(o,s){const{x:_,y:_e,base:et,width:it,height:tt}=o.getProps(["x","y","base","width","height"],s);let rt,nt,ot,st,at;return o.horizontal?(at=tt/2,rt=Math.min(_,et),nt=Math.max(_,et),ot=_e-at,st=_e+at):(at=it/2,rt=_-at,nt=_+at,ot=Math.min(_e,et),st=Math.max(_e,et)),{left:rt,top:ot,right:nt,bottom:st}}function skipOrLimit(o,s,_,_e){return o?0:_limitValue(s,_,_e)}function parseBorderWidth(o,s,_){const _e=o.options.borderWidth,et=o.borderSkipped,it=toTRBL(_e);return{t:skipOrLimit(et.top,it.top,0,_),r:skipOrLimit(et.right,it.right,0,s),b:skipOrLimit(et.bottom,it.bottom,0,_),l:skipOrLimit(et.left,it.left,0,s)}}function parseBorderRadius(o,s,_){const{enableBorderRadius:_e}=o.getProps(["enableBorderRadius"]),et=o.options.borderRadius,it=toTRBLCorners(et),tt=Math.min(s,_),rt=o.borderSkipped,nt=_e||isObject(et);return{topLeft:skipOrLimit(!nt||rt.top||rt.left,it.topLeft,0,tt),topRight:skipOrLimit(!nt||rt.top||rt.right,it.topRight,0,tt),bottomLeft:skipOrLimit(!nt||rt.bottom||rt.left,it.bottomLeft,0,tt),bottomRight:skipOrLimit(!nt||rt.bottom||rt.right,it.bottomRight,0,tt)}}function boundingRects(o){const s=getBarBounds(o),_=s.right-s.left,_e=s.bottom-s.top,et=parseBorderWidth(o,_/2,_e/2),it=parseBorderRadius(o,_/2,_e/2);return{outer:{x:s.left,y:s.top,w:_,h:_e,radius:it},inner:{x:s.left+et.l,y:s.top+et.t,w:_-et.l-et.r,h:_e-et.t-et.b,radius:{topLeft:Math.max(0,it.topLeft-Math.max(et.t,et.l)),topRight:Math.max(0,it.topRight-Math.max(et.t,et.r)),bottomLeft:Math.max(0,it.bottomLeft-Math.max(et.b,et.l)),bottomRight:Math.max(0,it.bottomRight-Math.max(et.b,et.r))}}}}function inRange(o,s,_,_e){const et=s===null,it=_===null,rt=o&&!(et&&it)&&getBarBounds(o,_e);return rt&&(et||_isBetween(s,rt.left,rt.right))&&(it||_isBetween(_,rt.top,rt.bottom))}function hasRadius(o){return o.topLeft||o.topRight||o.bottomLeft||o.bottomRight}function addNormalRectPath(o,s){o.rect(s.x,s.y,s.w,s.h)}function inflateRect(o,s,_={}){const _e=o.x!==_.x?-s:0,et=o.y!==_.y?-s:0,it=(o.x+o.w!==_.x+_.w?s:0)-_e,tt=(o.y+o.h!==_.y+_.h?s:0)-et;return{x:o.x+_e,y:o.y+et,w:o.w+it,h:o.h+tt,radius:o.radius}}class BarElement extends Element$1{constructor(s){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,s&&Object.assign(this,s)}draw(s){const{inflateAmount:_,options:{borderColor:_e,backgroundColor:et}}=this,{inner:it,outer:tt}=boundingRects(this),rt=hasRadius(tt.radius)?addRoundedRectPath:addNormalRectPath;s.save(),(tt.w!==it.w||tt.h!==it.h)&&(s.beginPath(),rt(s,inflateRect(tt,_,it)),s.clip(),rt(s,inflateRect(it,-_,tt)),s.fillStyle=_e,s.fill("evenodd")),s.beginPath(),rt(s,inflateRect(it,_)),s.fillStyle=et,s.fill(),s.restore()}inRange(s,_,_e){return inRange(this,s,_,_e)}inXRange(s,_){return inRange(this,s,null,_)}inYRange(s,_){return inRange(this,null,s,_)}getCenterPoint(s){const{x:_,y:_e,base:et,horizontal:it}=this.getProps(["x","y","base","horizontal"],s);return{x:it?(_+et)/2:_,y:it?_e:(_e+et)/2}}getRange(s){return s==="x"?this.width/2:this.height/2}}BarElement.id="bar";BarElement.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};BarElement.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var elements=Object.freeze({__proto__:null,ArcElement,LineElement,PointElement,BarElement});function lttbDecimation(o,s,_,_e,et){const it=et.samples||_e;if(it>=_)return o.slice(s,s+_);const tt=[],rt=(_-2)/(it-2);let nt=0;const ot=s+_-1;let st=s,at,lt,ct,ht,mt;for(tt[nt++]=o[st],at=0;at<it-2;at++){let dt=0,ft=0,ut;const pt=Math.floor((at+1)*rt)+1+s,At=Math.min(Math.floor((at+2)*rt)+1,_)+s,gt=At-pt;for(ut=pt;ut<At;ut++)dt+=o[ut].x,ft+=o[ut].y;dt/=gt,ft/=gt;const vt=Math.floor(at*rt)+1+s,yt=Math.min(Math.floor((at+1)*rt)+1,_)+s,{x:bt,y:Ct}=o[st];for(ct=ht=-1,ut=vt;ut<yt;ut++)ht=.5*Math.abs((bt-dt)*(o[ut].y-Ct)-(bt-o[ut].x)*(ft-Ct)),ht>ct&&(ct=ht,lt=o[ut],mt=ut);tt[nt++]=lt,st=mt}return tt[nt++]=o[ot],tt}function minMaxDecimation(o,s,_,_e){let et=0,it=0,tt,rt,nt,ot,st,at,lt,ct,ht,mt;const dt=[],ft=s+_-1,ut=o[s].x,At=o[ft].x-ut;for(tt=s;tt<s+_;++tt){rt=o[tt],nt=(rt.x-ut)/At*_e,ot=rt.y;const gt=nt|0;if(gt===st)ot<ht?(ht=ot,at=tt):ot>mt&&(mt=ot,lt=tt),et=(it*et+rt.x)/++it;else{const vt=tt-1;if(!isNullOrUndef(at)&&!isNullOrUndef(lt)){const yt=Math.min(at,lt),bt=Math.max(at,lt);yt!==ct&&yt!==vt&&dt.push(Tr(or({},o[yt]),{x:et})),bt!==ct&&bt!==vt&&dt.push(Tr(or({},o[bt]),{x:et}))}tt>0&&vt!==ct&&dt.push(o[vt]),dt.push(rt),st=gt,it=0,ht=mt=ot,at=lt=ct=tt}}return dt}function cleanDecimatedDataset(o){if(o._decimated){const s=o._data;delete o._decimated,delete o._data,Object.defineProperty(o,"data",{value:s})}}function cleanDecimatedData(o){o.data.datasets.forEach(s=>{cleanDecimatedDataset(s)})}function getStartAndCountOfVisiblePointsSimplified(o,s){const _=s.length;let _e=0,et;const{iScale:it}=o,{min:tt,max:rt,minDefined:nt,maxDefined:ot}=it.getUserBounds();return nt&&(_e=_limitValue(_lookupByKey(s,it.axis,tt).lo,0,_-1)),ot?et=_limitValue(_lookupByKey(s,it.axis,rt).hi+1,_e,_)-_e:et=_-_e,{start:_e,count:et}}var plugin_decimation={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(o,s,_)=>{if(!_.enabled){cleanDecimatedData(o);return}const _e=o.width;o.data.datasets.forEach((et,it)=>{const{_data:tt,indexAxis:rt}=et,nt=o.getDatasetMeta(it),ot=tt||et.data;if(resolve([rt,o.options.indexAxis])==="y"||nt.type!=="line")return;const st=o.scales[nt.xAxisID];if(st.type!=="linear"&&st.type!=="time"||o.options.parsing)return;let{start:at,count:lt}=getStartAndCountOfVisiblePointsSimplified(nt,ot);const ct=_.threshold||4*_e;if(lt<=ct){cleanDecimatedDataset(et);return}isNullOrUndef(tt)&&(et._data=ot,delete et.data,Object.defineProperty(et,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(mt){this._data=mt}}));let ht;switch(_.algorithm){case"lttb":ht=lttbDecimation(ot,at,lt,_e,_);break;case"min-max":ht=minMaxDecimation(ot,at,lt,_e);break;default:throw new Error(`Unsupported decimation algorithm '${_.algorithm}'`)}et._decimated=ht})},destroy(o){cleanDecimatedData(o)}};function getLineByIndex(o,s){const _=o.getDatasetMeta(s);return _&&o.isDatasetVisible(s)?_.dataset:null}function parseFillOption(o){const s=o.options,_=s.fill;let _e=valueOrDefault(_&&_.target,_);return _e===void 0&&(_e=!!s.backgroundColor),_e===!1||_e===null?!1:_e===!0?"origin":_e}function decodeFill(o,s,_){const _e=parseFillOption(o);if(isObject(_e))return isNaN(_e.value)?!1:_e;let et=parseFloat(_e);return isNumberFinite(et)&&Math.floor(et)===et?((_e[0]==="-"||_e[0]==="+")&&(et=s+et),et===s||et<0||et>=_?!1:et):["origin","start","end","stack","shape"].indexOf(_e)>=0&&_e}function computeLinearBoundary(o){const{scale:s={},fill:_}=o;let _e=null,et;return _==="start"?_e=s.bottom:_==="end"?_e=s.top:isObject(_)?_e=s.getPixelForValue(_.value):s.getBasePixel&&(_e=s.getBasePixel()),isNumberFinite(_e)?(et=s.isHorizontal(),{x:et?_e:null,y:et?null:_e}):null}class simpleArc{constructor(s){this.x=s.x,this.y=s.y,this.radius=s.radius}pathSegment(s,_,_e){const{x:et,y:it,radius:tt}=this;return _=_||{start:0,end:TAU},s.arc(et,it,tt,_.end,_.start,!0),!_e.bounds}interpolate(s){const{x:_,y:_e,radius:et}=this,it=s.angle;return{x:_+Math.cos(it)*et,y:_e+Math.sin(it)*et,angle:it}}}function computeCircularBoundary(o){const{scale:s,fill:_}=o,_e=s.options,et=s.getLabels().length,it=[],tt=_e.reverse?s.max:s.min,rt=_e.reverse?s.min:s.max;let nt,ot,st;if(_==="start"?st=tt:_==="end"?st=rt:isObject(_)?st=_.value:st=s.getBaseValue(),_e.grid.circular)return ot=s.getPointPositionForValue(0,tt),new simpleArc({x:ot.x,y:ot.y,radius:s.getDistanceFromCenterForValue(st)});for(nt=0;nt<et;++nt)it.push(s.getPointPositionForValue(nt,st));return it}function computeBoundary(o){return(o.scale||{}).getPointPositionForValue?computeCircularBoundary(o):computeLinearBoundary(o)}function findSegmentEnd(o,s,_){for(;s>o;s--){const _e=_[s];if(!isNaN(_e.x)&&!isNaN(_e.y))break}return s}function pointsFromSegments(o,s){const{x:_=null,y:_e=null}=o||{},et=s.points,it=[];return s.segments.forEach(({start:tt,end:rt})=>{rt=findSegmentEnd(tt,rt,et);const nt=et[tt],ot=et[rt];_e!==null?(it.push({x:nt.x,y:_e}),it.push({x:ot.x,y:_e})):_!==null&&(it.push({x:_,y:nt.y}),it.push({x:_,y:ot.y}))}),it}function buildStackLine(o){const{scale:s,index:_,line:_e}=o,et=[],it=_e.segments,tt=_e.points,rt=getLinesBelow(s,_);rt.push(createBoundaryLine({x:null,y:s.bottom},_e));for(let nt=0;nt<it.length;nt++){const ot=it[nt];for(let st=ot.start;st<=ot.end;st++)addPointsBelow(et,tt[st],rt)}return new LineElement({points:et,options:{}})}function getLinesBelow(o,s){const _=[],_e=o.getMatchingVisibleMetas("line");for(let et=0;et<_e.length;et++){const it=_e[et];if(it.index===s)break;it.hidden||_.unshift(it.dataset)}return _}function addPointsBelow(o,s,_){const _e=[];for(let et=0;et<_.length;et++){const it=_[et],{first:tt,last:rt,point:nt}=findPoint(it,s,"x");if(!(!nt||tt&&rt)){if(tt)_e.unshift(nt);else if(o.push(nt),!rt)break}}o.push(..._e)}function findPoint(o,s,_){const _e=o.interpolate(s,_);if(!_e)return{};const et=_e[_],it=o.segments,tt=o.points;let rt=!1,nt=!1;for(let ot=0;ot<it.length;ot++){const st=it[ot],at=tt[st.start][_],lt=tt[st.end][_];if(_isBetween(et,at,lt)){rt=et===at,nt=et===lt;break}}return{first:rt,last:nt,point:_e}}function getTarget(o){const{chart:s,fill:_,line:_e}=o;if(isNumberFinite(_))return getLineByIndex(s,_);if(_==="stack")return buildStackLine(o);if(_==="shape")return!0;const et=computeBoundary(o);return et instanceof simpleArc?et:createBoundaryLine(et,_e)}function createBoundaryLine(o,s){let _=[],_e=!1;return isArray(o)?(_e=!0,_=o):_=pointsFromSegments(o,s),_.length?new LineElement({points:_,options:{tension:0},_loop:_e,_fullLoop:_e}):null}function resolveTarget(o,s,_){let et=o[s].fill;const it=[s];let tt;if(!_)return et;for(;et!==!1&&it.indexOf(et)===-1;){if(!isNumberFinite(et))return et;if(tt=o[et],!tt)return!1;if(tt.visible)return et;it.push(et),et=tt.fill}return!1}function _clip(o,s,_){o.beginPath(),s.path(o),o.lineTo(s.last().x,_),o.lineTo(s.first().x,_),o.closePath(),o.clip()}function getBounds(o,s,_,_e){if(_e)return;let et=s[o],it=_[o];return o==="angle"&&(et=_normalizeAngle(et),it=_normalizeAngle(it)),{property:o,start:et,end:it}}function _getEdge(o,s,_,_e){return o&&s?_e(o[_],s[_]):o?o[_]:s?s[_]:0}function _segments(o,s,_){const _e=o.segments,et=o.points,it=s.points,tt=[];for(const rt of _e){let{start:nt,end:ot}=rt;ot=findSegmentEnd(nt,ot,et);const st=getBounds(_,et[nt],et[ot],rt.loop);if(!s.segments){tt.push({source:rt,target:st,start:et[nt],end:et[ot]});continue}const at=_boundSegments(s,st);for(const lt of at){const ct=getBounds(_,it[lt.start],it[lt.end],lt.loop),ht=_boundSegment(rt,et,ct);for(const mt of ht)tt.push({source:mt,target:lt,start:{[_]:_getEdge(st,ct,"start",Math.max)},end:{[_]:_getEdge(st,ct,"end",Math.min)}})}}return tt}function clipBounds(o,s,_){const{top:_e,bottom:et}=s.chart.chartArea,{property:it,start:tt,end:rt}=_||{};it==="x"&&(o.beginPath(),o.rect(tt,_e,rt-tt,et-_e),o.clip())}function interpolatedLineTo(o,s,_,_e){const et=s.interpolate(_,_e);et&&o.lineTo(et.x,et.y)}function _fill(o,s){const{line:_,target:_e,property:et,color:it,scale:tt}=s,rt=_segments(_,_e,et);for(const{source:nt,target:ot,start:st,end:at}of rt){const{style:{backgroundColor:lt=it}={}}=nt,ct=_e!==!0;o.save(),o.fillStyle=lt,clipBounds(o,tt,ct&&getBounds(et,st,at)),o.beginPath();const ht=!!_.pathSegment(o,nt);let mt;if(ct){ht?o.closePath():interpolatedLineTo(o,_e,at,et);const dt=!!_e.pathSegment(o,ot,{move:ht,reverse:!0});mt=ht&&dt,mt||interpolatedLineTo(o,_e,st,et)}o.closePath(),o.fill(mt?"evenodd":"nonzero"),o.restore()}}function doFill(o,s){const{line:_,target:_e,above:et,below:it,area:tt,scale:rt}=s,nt=_._loop?"angle":s.axis;o.save(),nt==="x"&&it!==et&&(_clip(o,_e,tt.top),_fill(o,{line:_,target:_e,color:et,scale:rt,property:nt}),o.restore(),o.save(),_clip(o,_e,tt.bottom)),_fill(o,{line:_,target:_e,color:it,scale:rt,property:nt}),o.restore()}function drawfill(o,s,_){const _e=getTarget(s),{line:et,scale:it,axis:tt}=s,rt=et.options,nt=rt.fill,ot=rt.backgroundColor,{above:st=ot,below:at=ot}=nt||{};_e&&et.points.length&&(clipArea(o,_),doFill(o,{line:et,target:_e,above:st,below:at,area:_,scale:it,axis:tt}),unclipArea(o))}var plugin_filler={id:"filler",afterDatasetsUpdate(o,s,_){const _e=(o.data.datasets||[]).length,et=[];let it,tt,rt,nt;for(tt=0;tt<_e;++tt)it=o.getDatasetMeta(tt),rt=it.dataset,nt=null,rt&&rt.options&&rt instanceof LineElement&&(nt={visible:o.isDatasetVisible(tt),index:tt,fill:decodeFill(rt,tt,_e),chart:o,axis:it.controller.options.indexAxis,scale:it.vScale,line:rt}),it.$filler=nt,et.push(nt);for(tt=0;tt<_e;++tt)nt=et[tt],!(!nt||nt.fill===!1)&&(nt.fill=resolveTarget(et,tt,_.propagate))},beforeDraw(o,s,_){const _e=_.drawTime==="beforeDraw",et=o.getSortedVisibleDatasetMetas(),it=o.chartArea;for(let tt=et.length-1;tt>=0;--tt){const rt=et[tt].$filler;!rt||(rt.line.updateControlPoints(it,rt.axis),_e&&drawfill(o.ctx,rt,it))}},beforeDatasetsDraw(o,s,_){if(_.drawTime!=="beforeDatasetsDraw")return;const _e=o.getSortedVisibleDatasetMetas();for(let et=_e.length-1;et>=0;--et){const it=_e[et].$filler;it&&drawfill(o.ctx,it,o.chartArea)}},beforeDatasetDraw(o,s,_){const _e=s.meta.$filler;!_e||_e.fill===!1||_.drawTime!=="beforeDatasetDraw"||drawfill(o.ctx,_e,o.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const getBoxSize=(o,s)=>{let{boxHeight:_=s,boxWidth:_e=s}=o;return o.usePointStyle&&(_=Math.min(_,s),_e=Math.min(_e,s)),{boxWidth:_e,boxHeight:_,itemHeight:Math.max(s,_)}},itemsEqual=(o,s)=>o!==null&&s!==null&&o.datasetIndex===s.datasetIndex&&o.index===s.index;class Legend extends Element$1{constructor(s){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=s.chart,this.options=s.options,this.ctx=s.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(s,_,_e){this.maxWidth=s,this.maxHeight=_,this._margins=_e,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const s=this.options.labels||{};let _=callback(s.generateLabels,[this.chart],this)||[];s.filter&&(_=_.filter(_e=>s.filter(_e,this.chart.data))),s.sort&&(_=_.sort((_e,et)=>s.sort(_e,et,this.chart.data))),this.options.reverse&&_.reverse(),this.legendItems=_}fit(){const{options:s,ctx:_}=this;if(!s.display){this.width=this.height=0;return}const _e=s.labels,et=toFont(_e.font),it=et.size,tt=this._computeTitleHeight(),{boxWidth:rt,itemHeight:nt}=getBoxSize(_e,it);let ot,st;_.font=et.string,this.isHorizontal()?(ot=this.maxWidth,st=this._fitRows(tt,it,rt,nt)+10):(st=this.maxHeight,ot=this._fitCols(tt,it,rt,nt)+10),this.width=Math.min(ot,s.maxWidth||this.maxWidth),this.height=Math.min(st,s.maxHeight||this.maxHeight)}_fitRows(s,_,_e,et){const{ctx:it,maxWidth:tt,options:{labels:{padding:rt}}}=this,nt=this.legendHitBoxes=[],ot=this.lineWidths=[0],st=et+rt;let at=s;it.textAlign="left",it.textBaseline="middle";let lt=-1,ct=-st;return this.legendItems.forEach((ht,mt)=>{const dt=_e+_/2+it.measureText(ht.text).width;(mt===0||ot[ot.length-1]+dt+2*rt>tt)&&(at+=st,ot[ot.length-(mt>0?0:1)]=0,ct+=st,lt++),nt[mt]={left:0,top:ct,row:lt,width:dt,height:et},ot[ot.length-1]+=dt+rt}),at}_fitCols(s,_,_e,et){const{ctx:it,maxHeight:tt,options:{labels:{padding:rt}}}=this,nt=this.legendHitBoxes=[],ot=this.columnSizes=[],st=tt-s;let at=rt,lt=0,ct=0,ht=0,mt=0;return this.legendItems.forEach((dt,ft)=>{const ut=_e+_/2+it.measureText(dt.text).width;ft>0&&ct+et+2*rt>st&&(at+=lt+rt,ot.push({width:lt,height:ct}),ht+=lt+rt,mt++,lt=ct=0),nt[ft]={left:ht,top:ct,col:mt,width:ut,height:et},lt=Math.max(lt,ut),ct+=et+rt}),at+=lt,ot.push({width:lt,height:ct}),at}adjustHitBoxes(){if(!this.options.display)return;const s=this._computeTitleHeight(),{legendHitBoxes:_,options:{align:_e,labels:{padding:et},rtl:it}}=this,tt=getRtlAdapter(it,this.left,this.width);if(this.isHorizontal()){let rt=0,nt=_alignStartEnd(_e,this.left+et,this.right-this.lineWidths[rt]);for(const ot of _)rt!==ot.row&&(rt=ot.row,nt=_alignStartEnd(_e,this.left+et,this.right-this.lineWidths[rt])),ot.top+=this.top+s+et,ot.left=tt.leftForLtr(tt.x(nt),ot.width),nt+=ot.width+et}else{let rt=0,nt=_alignStartEnd(_e,this.top+s+et,this.bottom-this.columnSizes[rt].height);for(const ot of _)ot.col!==rt&&(rt=ot.col,nt=_alignStartEnd(_e,this.top+s+et,this.bottom-this.columnSizes[rt].height)),ot.top=nt,ot.left+=this.left+et,ot.left=tt.leftForLtr(tt.x(ot.left),ot.width),nt+=ot.height+et}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const s=this.ctx;clipArea(s,this),this._draw(),unclipArea(s)}}_draw(){const{options:s,columnSizes:_,lineWidths:_e,ctx:et}=this,{align:it,labels:tt}=s,rt=defaults.color,nt=getRtlAdapter(s.rtl,this.left,this.width),ot=toFont(tt.font),{color:st,padding:at}=tt,lt=ot.size,ct=lt/2;let ht;this.drawTitle(),et.textAlign=nt.textAlign("left"),et.textBaseline="middle",et.lineWidth=.5,et.font=ot.string;const{boxWidth:mt,boxHeight:dt,itemHeight:ft}=getBoxSize(tt,lt),ut=function(yt,bt,Ct){if(isNaN(mt)||mt<=0||isNaN(dt)||dt<0)return;et.save();const xt=valueOrDefault(Ct.lineWidth,1);if(et.fillStyle=valueOrDefault(Ct.fillStyle,rt),et.lineCap=valueOrDefault(Ct.lineCap,"butt"),et.lineDashOffset=valueOrDefault(Ct.lineDashOffset,0),et.lineJoin=valueOrDefault(Ct.lineJoin,"miter"),et.lineWidth=xt,et.strokeStyle=valueOrDefault(Ct.strokeStyle,rt),et.setLineDash(valueOrDefault(Ct.lineDash,[])),tt.usePointStyle){const It={radius:mt*Math.SQRT2/2,pointStyle:Ct.pointStyle,rotation:Ct.rotation,borderWidth:xt},St=nt.xPlus(yt,mt/2),Ot=bt+ct;drawPoint(et,It,St,Ot)}else{const It=bt+Math.max((lt-dt)/2,0),St=nt.leftForLtr(yt,mt),Ot=toTRBLCorners(Ct.borderRadius);et.beginPath(),Object.values(Ot).some(Mt=>Mt!==0)?addRoundedRectPath(et,{x:St,y:It,w:mt,h:dt,radius:Ot}):et.rect(St,It,mt,dt),et.fill(),xt!==0&&et.stroke()}et.restore()},pt=function(yt,bt,Ct){renderText(et,Ct.text,yt,bt+ft/2,ot,{strikethrough:Ct.hidden,textAlign:nt.textAlign(Ct.textAlign)})},At=this.isHorizontal(),gt=this._computeTitleHeight();At?ht={x:_alignStartEnd(it,this.left+at,this.right-_e[0]),y:this.top+at+gt,line:0}:ht={x:this.left+at,y:_alignStartEnd(it,this.top+gt+at,this.bottom-_[0].height),line:0},overrideTextDirection(this.ctx,s.textDirection);const vt=ft+at;this.legendItems.forEach((yt,bt)=>{et.strokeStyle=yt.fontColor||st,et.fillStyle=yt.fontColor||st;const Ct=et.measureText(yt.text).width,xt=nt.textAlign(yt.textAlign||(yt.textAlign=tt.textAlign)),It=mt+ct+Ct;let St=ht.x,Ot=ht.y;nt.setWidth(this.width),At?bt>0&&St+It+at>this.right&&(Ot=ht.y+=vt,ht.line++,St=ht.x=_alignStartEnd(it,this.left+at,this.right-_e[ht.line])):bt>0&&Ot+vt>this.bottom&&(St=ht.x=St+_[ht.line].width+at,ht.line++,Ot=ht.y=_alignStartEnd(it,this.top+gt+at,this.bottom-_[ht.line].height));const Mt=nt.x(St);ut(Mt,Ot,yt),St=_textX(xt,St+mt+ct,At?St+It:this.right,s.rtl),pt(nt.x(St),Ot,yt),At?ht.x+=It+at:ht.y+=vt}),restoreTextDirection(this.ctx,s.textDirection)}drawTitle(){const s=this.options,_=s.title,_e=toFont(_.font),et=toPadding(_.padding);if(!_.display)return;const it=getRtlAdapter(s.rtl,this.left,this.width),tt=this.ctx,rt=_.position,nt=_e.size/2,ot=et.top+nt;let st,at=this.left,lt=this.width;if(this.isHorizontal())lt=Math.max(...this.lineWidths),st=this.top+ot,at=_alignStartEnd(s.align,at,this.right-lt);else{const ht=this.columnSizes.reduce((mt,dt)=>Math.max(mt,dt.height),0);st=ot+_alignStartEnd(s.align,this.top,this.bottom-ht-s.labels.padding-this._computeTitleHeight())}const ct=_alignStartEnd(rt,at,at+lt);tt.textAlign=it.textAlign(_toLeftRightCenter(rt)),tt.textBaseline="middle",tt.strokeStyle=_.color,tt.fillStyle=_.color,tt.font=_e.string,renderText(tt,_.text,ct,st,_e)}_computeTitleHeight(){const s=this.options.title,_=toFont(s.font),_e=toPadding(s.padding);return s.display?_.lineHeight+_e.height:0}_getLegendItemAt(s,_){let _e,et,it;if(_isBetween(s,this.left,this.right)&&_isBetween(_,this.top,this.bottom)){for(it=this.legendHitBoxes,_e=0;_e<it.length;++_e)if(et=it[_e],_isBetween(s,et.left,et.left+et.width)&&_isBetween(_,et.top,et.top+et.height))return this.legendItems[_e]}return null}handleEvent(s){const _=this.options;if(!isListened(s.type,_))return;const _e=this._getLegendItemAt(s.x,s.y);if(s.type==="mousemove"){const et=this._hoveredItem,it=itemsEqual(et,_e);et&&!it&&callback(_.onLeave,[s,et,this],this),this._hoveredItem=_e,_e&&!it&&callback(_.onHover,[s,_e,this],this)}else _e&&callback(_.onClick,[s,_e,this],this)}}function isListened(o,s){return!!(o==="mousemove"&&(s.onHover||s.onLeave)||s.onClick&&(o==="click"||o==="mouseup"))}var plugin_legend={id:"legend",_element:Legend,start(o,s,_){const _e=o.legend=new Legend({ctx:o.ctx,options:_,chart:o});layouts.configure(o,_e,_),layouts.addBox(o,_e)},stop(o){layouts.removeBox(o,o.legend),delete o.legend},beforeUpdate(o,s,_){const _e=o.legend;layouts.configure(o,_e,_),_e.options=_},afterUpdate(o){const s=o.legend;s.buildLabels(),s.adjustHitBoxes()},afterEvent(o,s){s.replay||o.legend.handleEvent(s.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(o,s,_){const _e=s.datasetIndex,et=_.chart;et.isDatasetVisible(_e)?(et.hide(_e),s.hidden=!0):(et.show(_e),s.hidden=!1)},onHover:null,onLeave:null,labels:{color:o=>o.chart.options.color,boxWidth:40,padding:10,generateLabels(o){const s=o.data.datasets,{labels:{usePointStyle:_,pointStyle:_e,textAlign:et,color:it}}=o.legend.options;return o._getSortedDatasetMetas().map(tt=>{const rt=tt.controller.getStyle(_?0:void 0),nt=toPadding(rt.borderWidth);return{text:s[tt.index].label,fillStyle:rt.backgroundColor,fontColor:it,hidden:!tt.visible,lineCap:rt.borderCapStyle,lineDash:rt.borderDash,lineDashOffset:rt.borderDashOffset,lineJoin:rt.borderJoinStyle,lineWidth:(nt.width+nt.height)/4,strokeStyle:rt.borderColor,pointStyle:_e||rt.pointStyle,rotation:rt.rotation,textAlign:et||rt.textAlign,borderRadius:0,datasetIndex:tt.index}},this)}},title:{color:o=>o.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:o=>!o.startsWith("on"),labels:{_scriptable:o=>!["generateLabels","filter","sort"].includes(o)}}};class Title extends Element$1{constructor(s){super(),this.chart=s.chart,this.options=s.options,this.ctx=s.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(s,_){const _e=this.options;if(this.left=0,this.top=0,!_e.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=s,this.height=this.bottom=_;const et=isArray(_e.text)?_e.text.length:1;this._padding=toPadding(_e.padding);const it=et*toFont(_e.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=it:this.width=it}isHorizontal(){const s=this.options.position;return s==="top"||s==="bottom"}_drawArgs(s){const{top:_,left:_e,bottom:et,right:it,options:tt}=this,rt=tt.align;let nt=0,ot,st,at;return this.isHorizontal()?(st=_alignStartEnd(rt,_e,it),at=_+s,ot=it-_e):(tt.position==="left"?(st=_e+s,at=_alignStartEnd(rt,et,_),nt=PI*-.5):(st=it-s,at=_alignStartEnd(rt,_,et),nt=PI*.5),ot=et-_),{titleX:st,titleY:at,maxWidth:ot,rotation:nt}}draw(){const s=this.ctx,_=this.options;if(!_.display)return;const _e=toFont(_.font),it=_e.lineHeight/2+this._padding.top,{titleX:tt,titleY:rt,maxWidth:nt,rotation:ot}=this._drawArgs(it);renderText(s,_.text,0,0,_e,{color:_.color,maxWidth:nt,rotation:ot,textAlign:_toLeftRightCenter(_.align),textBaseline:"middle",translation:[tt,rt]})}}function createTitle(o,s){const _=new Title({ctx:o.ctx,options:s,chart:o});layouts.configure(o,_,s),layouts.addBox(o,_),o.titleBlock=_}var plugin_title={id:"title",_element:Title,start(o,s,_){createTitle(o,_)},stop(o){const s=o.titleBlock;layouts.removeBox(o,s),delete o.titleBlock},beforeUpdate(o,s,_){const _e=o.titleBlock;layouts.configure(o,_e,_),_e.options=_},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const map=new WeakMap;var plugin_subtitle={id:"subtitle",start(o,s,_){const _e=new Title({ctx:o.ctx,options:_,chart:o});layouts.configure(o,_e,_),layouts.addBox(o,_e),map.set(o,_e)},stop(o){layouts.removeBox(o,map.get(o)),map.delete(o)},beforeUpdate(o,s,_){const _e=map.get(o);layouts.configure(o,_e,_),_e.options=_},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const positioners={average(o){if(!o.length)return!1;let s,_,_e=0,et=0,it=0;for(s=0,_=o.length;s<_;++s){const tt=o[s].element;if(tt&&tt.hasValue()){const rt=tt.tooltipPosition();_e+=rt.x,et+=rt.y,++it}}return{x:_e/it,y:et/it}},nearest(o,s){if(!o.length)return!1;let _=s.x,_e=s.y,et=Number.POSITIVE_INFINITY,it,tt,rt;for(it=0,tt=o.length;it<tt;++it){const nt=o[it].element;if(nt&&nt.hasValue()){const ot=nt.getCenterPoint(),st=distanceBetweenPoints(s,ot);st<et&&(et=st,rt=nt)}}if(rt){const nt=rt.tooltipPosition();_=nt.x,_e=nt.y}return{x:_,y:_e}}};function pushOrConcat(o,s){return s&&(isArray(s)?Array.prototype.push.apply(o,s):o.push(s)),o}function splitNewlines(o){return(typeof o=="string"||o instanceof String)&&o.indexOf(`
`)>-1?o.split(`
`):o}function createTooltipItem(o,s){const{element:_,datasetIndex:_e,index:et}=s,it=o.getDatasetMeta(_e).controller,{label:tt,value:rt}=it.getLabelAndValue(et);return{chart:o,label:tt,parsed:it.getParsed(et),raw:o.data.datasets[_e].data[et],formattedValue:rt,dataset:it.getDataset(),dataIndex:et,datasetIndex:_e,element:_}}function getTooltipSize(o,s){const _=o.chart.ctx,{body:_e,footer:et,title:it}=o,{boxWidth:tt,boxHeight:rt}=s,nt=toFont(s.bodyFont),ot=toFont(s.titleFont),st=toFont(s.footerFont),at=it.length,lt=et.length,ct=_e.length,ht=toPadding(s.padding);let mt=ht.height,dt=0,ft=_e.reduce((At,gt)=>At+gt.before.length+gt.lines.length+gt.after.length,0);if(ft+=o.beforeBody.length+o.afterBody.length,at&&(mt+=at*ot.lineHeight+(at-1)*s.titleSpacing+s.titleMarginBottom),ft){const At=s.displayColors?Math.max(rt,nt.lineHeight):nt.lineHeight;mt+=ct*At+(ft-ct)*nt.lineHeight+(ft-1)*s.bodySpacing}lt&&(mt+=s.footerMarginTop+lt*st.lineHeight+(lt-1)*s.footerSpacing);let ut=0;const pt=function(At){dt=Math.max(dt,_.measureText(At).width+ut)};return _.save(),_.font=ot.string,each(o.title,pt),_.font=nt.string,each(o.beforeBody.concat(o.afterBody),pt),ut=s.displayColors?tt+2+s.boxPadding:0,each(_e,At=>{each(At.before,pt),each(At.lines,pt),each(At.after,pt)}),ut=0,_.font=st.string,each(o.footer,pt),_.restore(),dt+=ht.width,{width:dt,height:mt}}function determineYAlign(o,s){const{y:_,height:_e}=s;return _<_e/2?"top":_>o.height-_e/2?"bottom":"center"}function doesNotFitWithAlign(o,s,_,_e){const{x:et,width:it}=_e,tt=_.caretSize+_.caretPadding;if(o==="left"&&et+it+tt>s.width||o==="right"&&et-it-tt<0)return!0}function determineXAlign(o,s,_,_e){const{x:et,width:it}=_,{width:tt,chartArea:{left:rt,right:nt}}=o;let ot="center";return _e==="center"?ot=et<=(rt+nt)/2?"left":"right":et<=it/2?ot="left":et>=tt-it/2&&(ot="right"),doesNotFitWithAlign(ot,o,s,_)&&(ot="center"),ot}function determineAlignment(o,s,_){const _e=_.yAlign||s.yAlign||determineYAlign(o,_);return{xAlign:_.xAlign||s.xAlign||determineXAlign(o,s,_,_e),yAlign:_e}}function alignX(o,s){let{x:_,width:_e}=o;return s==="right"?_-=_e:s==="center"&&(_-=_e/2),_}function alignY(o,s,_){let{y:_e,height:et}=o;return s==="top"?_e+=_:s==="bottom"?_e-=et+_:_e-=et/2,_e}function getBackgroundPoint(o,s,_,_e){const{caretSize:et,caretPadding:it,cornerRadius:tt}=o,{xAlign:rt,yAlign:nt}=_,ot=et+it,{topLeft:st,topRight:at,bottomLeft:lt,bottomRight:ct}=toTRBLCorners(tt);let ht=alignX(s,rt);const mt=alignY(s,nt,ot);return nt==="center"?rt==="left"?ht+=ot:rt==="right"&&(ht-=ot):rt==="left"?ht-=Math.max(st,lt)+et:rt==="right"&&(ht+=Math.max(at,ct)+et),{x:_limitValue(ht,0,_e.width-s.width),y:_limitValue(mt,0,_e.height-s.height)}}function getAlignedX(o,s,_){const _e=toPadding(_.padding);return s==="center"?o.x+o.width/2:s==="right"?o.x+o.width-_e.right:o.x+_e.left}function getBeforeAfterBodyLines(o){return pushOrConcat([],splitNewlines(o))}function createTooltipContext(o,s,_){return createContext(o,{tooltip:s,tooltipItems:_,type:"tooltip"})}function overrideCallbacks(o,s){const _=s&&s.dataset&&s.dataset.tooltip&&s.dataset.tooltip.callbacks;return _?o.override(_):o}class Tooltip extends Element$1{constructor(s){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=s.chart||s._chart,this._chart=this.chart,this.options=s.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(s){this.options=s,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const s=this._cachedAnimations;if(s)return s;const _=this.chart,_e=this.options.setContext(this.getContext()),et=_e.enabled&&_.options.animation&&_e.animations,it=new Animations(this.chart,et);return et._cacheable&&(this._cachedAnimations=Object.freeze(it)),it}getContext(){return this.$context||(this.$context=createTooltipContext(this.chart.getContext(),this,this._tooltipItems))}getTitle(s,_){const{callbacks:_e}=_,et=_e.beforeTitle.apply(this,[s]),it=_e.title.apply(this,[s]),tt=_e.afterTitle.apply(this,[s]);let rt=[];return rt=pushOrConcat(rt,splitNewlines(et)),rt=pushOrConcat(rt,splitNewlines(it)),rt=pushOrConcat(rt,splitNewlines(tt)),rt}getBeforeBody(s,_){return getBeforeAfterBodyLines(_.callbacks.beforeBody.apply(this,[s]))}getBody(s,_){const{callbacks:_e}=_,et=[];return each(s,it=>{const tt={before:[],lines:[],after:[]},rt=overrideCallbacks(_e,it);pushOrConcat(tt.before,splitNewlines(rt.beforeLabel.call(this,it))),pushOrConcat(tt.lines,rt.label.call(this,it)),pushOrConcat(tt.after,splitNewlines(rt.afterLabel.call(this,it))),et.push(tt)}),et}getAfterBody(s,_){return getBeforeAfterBodyLines(_.callbacks.afterBody.apply(this,[s]))}getFooter(s,_){const{callbacks:_e}=_,et=_e.beforeFooter.apply(this,[s]),it=_e.footer.apply(this,[s]),tt=_e.afterFooter.apply(this,[s]);let rt=[];return rt=pushOrConcat(rt,splitNewlines(et)),rt=pushOrConcat(rt,splitNewlines(it)),rt=pushOrConcat(rt,splitNewlines(tt)),rt}_createItems(s){const _=this._active,_e=this.chart.data,et=[],it=[],tt=[];let rt=[],nt,ot;for(nt=0,ot=_.length;nt<ot;++nt)rt.push(createTooltipItem(this.chart,_[nt]));return s.filter&&(rt=rt.filter((st,at,lt)=>s.filter(st,at,lt,_e))),s.itemSort&&(rt=rt.sort((st,at)=>s.itemSort(st,at,_e))),each(rt,st=>{const at=overrideCallbacks(s.callbacks,st);et.push(at.labelColor.call(this,st)),it.push(at.labelPointStyle.call(this,st)),tt.push(at.labelTextColor.call(this,st))}),this.labelColors=et,this.labelPointStyles=it,this.labelTextColors=tt,this.dataPoints=rt,rt}update(s,_){const _e=this.options.setContext(this.getContext()),et=this._active;let it,tt=[];if(!et.length)this.opacity!==0&&(it={opacity:0});else{const rt=positioners[_e.position].call(this,et,this._eventPosition);tt=this._createItems(_e),this.title=this.getTitle(tt,_e),this.beforeBody=this.getBeforeBody(tt,_e),this.body=this.getBody(tt,_e),this.afterBody=this.getAfterBody(tt,_e),this.footer=this.getFooter(tt,_e);const nt=this._size=getTooltipSize(this,_e),ot=Object.assign({},rt,nt),st=determineAlignment(this.chart,_e,ot),at=getBackgroundPoint(_e,ot,st,this.chart);this.xAlign=st.xAlign,this.yAlign=st.yAlign,it={opacity:1,x:at.x,y:at.y,width:nt.width,height:nt.height,caretX:rt.x,caretY:rt.y}}this._tooltipItems=tt,this.$context=void 0,it&&this._resolveAnimations().update(this,it),s&&_e.external&&_e.external.call(this,{chart:this.chart,tooltip:this,replay:_})}drawCaret(s,_,_e,et){const it=this.getCaretPosition(s,_e,et);_.lineTo(it.x1,it.y1),_.lineTo(it.x2,it.y2),_.lineTo(it.x3,it.y3)}getCaretPosition(s,_,_e){const{xAlign:et,yAlign:it}=this,{caretSize:tt,cornerRadius:rt}=_e,{topLeft:nt,topRight:ot,bottomLeft:st,bottomRight:at}=toTRBLCorners(rt),{x:lt,y:ct}=s,{width:ht,height:mt}=_;let dt,ft,ut,pt,At,gt;return it==="center"?(At=ct+mt/2,et==="left"?(dt=lt,ft=dt-tt,pt=At+tt,gt=At-tt):(dt=lt+ht,ft=dt+tt,pt=At-tt,gt=At+tt),ut=dt):(et==="left"?ft=lt+Math.max(nt,st)+tt:et==="right"?ft=lt+ht-Math.max(ot,at)-tt:ft=this.caretX,it==="top"?(pt=ct,At=pt-tt,dt=ft-tt,ut=ft+tt):(pt=ct+mt,At=pt+tt,dt=ft+tt,ut=ft-tt),gt=pt),{x1:dt,x2:ft,x3:ut,y1:pt,y2:At,y3:gt}}drawTitle(s,_,_e){const et=this.title,it=et.length;let tt,rt,nt;if(it){const ot=getRtlAdapter(_e.rtl,this.x,this.width);for(s.x=getAlignedX(this,_e.titleAlign,_e),_.textAlign=ot.textAlign(_e.titleAlign),_.textBaseline="middle",tt=toFont(_e.titleFont),rt=_e.titleSpacing,_.fillStyle=_e.titleColor,_.font=tt.string,nt=0;nt<it;++nt)_.fillText(et[nt],ot.x(s.x),s.y+tt.lineHeight/2),s.y+=tt.lineHeight+rt,nt+1===it&&(s.y+=_e.titleMarginBottom-rt)}}_drawColorBox(s,_,_e,et,it){const tt=this.labelColors[_e],rt=this.labelPointStyles[_e],{boxHeight:nt,boxWidth:ot,boxPadding:st}=it,at=toFont(it.bodyFont),lt=getAlignedX(this,"left",it),ct=et.x(lt),ht=nt<at.lineHeight?(at.lineHeight-nt)/2:0,mt=_.y+ht;if(it.usePointStyle){const dt={radius:Math.min(ot,nt)/2,pointStyle:rt.pointStyle,rotation:rt.rotation,borderWidth:1},ft=et.leftForLtr(ct,ot)+ot/2,ut=mt+nt/2;s.strokeStyle=it.multiKeyBackground,s.fillStyle=it.multiKeyBackground,drawPoint(s,dt,ft,ut),s.strokeStyle=tt.borderColor,s.fillStyle=tt.backgroundColor,drawPoint(s,dt,ft,ut)}else{s.lineWidth=tt.borderWidth||1,s.strokeStyle=tt.borderColor,s.setLineDash(tt.borderDash||[]),s.lineDashOffset=tt.borderDashOffset||0;const dt=et.leftForLtr(ct,ot-st),ft=et.leftForLtr(et.xPlus(ct,1),ot-st-2),ut=toTRBLCorners(tt.borderRadius);Object.values(ut).some(pt=>pt!==0)?(s.beginPath(),s.fillStyle=it.multiKeyBackground,addRoundedRectPath(s,{x:dt,y:mt,w:ot,h:nt,radius:ut}),s.fill(),s.stroke(),s.fillStyle=tt.backgroundColor,s.beginPath(),addRoundedRectPath(s,{x:ft,y:mt+1,w:ot-2,h:nt-2,radius:ut}),s.fill()):(s.fillStyle=it.multiKeyBackground,s.fillRect(dt,mt,ot,nt),s.strokeRect(dt,mt,ot,nt),s.fillStyle=tt.backgroundColor,s.fillRect(ft,mt+1,ot-2,nt-2))}s.fillStyle=this.labelTextColors[_e]}drawBody(s,_,_e){const{body:et}=this,{bodySpacing:it,bodyAlign:tt,displayColors:rt,boxHeight:nt,boxWidth:ot,boxPadding:st}=_e,at=toFont(_e.bodyFont);let lt=at.lineHeight,ct=0;const ht=getRtlAdapter(_e.rtl,this.x,this.width),mt=function(bt){_.fillText(bt,ht.x(s.x+ct),s.y+lt/2),s.y+=lt+it},dt=ht.textAlign(tt);let ft,ut,pt,At,gt,vt,yt;for(_.textAlign=tt,_.textBaseline="middle",_.font=at.string,s.x=getAlignedX(this,dt,_e),_.fillStyle=_e.bodyColor,each(this.beforeBody,mt),ct=rt&&dt!=="right"?tt==="center"?ot/2+st:ot+2+st:0,At=0,vt=et.length;At<vt;++At){for(ft=et[At],ut=this.labelTextColors[At],_.fillStyle=ut,each(ft.before,mt),pt=ft.lines,rt&&pt.length&&(this._drawColorBox(_,s,At,ht,_e),lt=Math.max(at.lineHeight,nt)),gt=0,yt=pt.length;gt<yt;++gt)mt(pt[gt]),lt=at.lineHeight;each(ft.after,mt)}ct=0,lt=at.lineHeight,each(this.afterBody,mt),s.y-=it}drawFooter(s,_,_e){const et=this.footer,it=et.length;let tt,rt;if(it){const nt=getRtlAdapter(_e.rtl,this.x,this.width);for(s.x=getAlignedX(this,_e.footerAlign,_e),s.y+=_e.footerMarginTop,_.textAlign=nt.textAlign(_e.footerAlign),_.textBaseline="middle",tt=toFont(_e.footerFont),_.fillStyle=_e.footerColor,_.font=tt.string,rt=0;rt<it;++rt)_.fillText(et[rt],nt.x(s.x),s.y+tt.lineHeight/2),s.y+=tt.lineHeight+_e.footerSpacing}}drawBackground(s,_,_e,et){const{xAlign:it,yAlign:tt}=this,{x:rt,y:nt}=s,{width:ot,height:st}=_e,{topLeft:at,topRight:lt,bottomLeft:ct,bottomRight:ht}=toTRBLCorners(et.cornerRadius);_.fillStyle=et.backgroundColor,_.strokeStyle=et.borderColor,_.lineWidth=et.borderWidth,_.beginPath(),_.moveTo(rt+at,nt),tt==="top"&&this.drawCaret(s,_,_e,et),_.lineTo(rt+ot-lt,nt),_.quadraticCurveTo(rt+ot,nt,rt+ot,nt+lt),tt==="center"&&it==="right"&&this.drawCaret(s,_,_e,et),_.lineTo(rt+ot,nt+st-ht),_.quadraticCurveTo(rt+ot,nt+st,rt+ot-ht,nt+st),tt==="bottom"&&this.drawCaret(s,_,_e,et),_.lineTo(rt+ct,nt+st),_.quadraticCurveTo(rt,nt+st,rt,nt+st-ct),tt==="center"&&it==="left"&&this.drawCaret(s,_,_e,et),_.lineTo(rt,nt+at),_.quadraticCurveTo(rt,nt,rt+at,nt),_.closePath(),_.fill(),et.borderWidth>0&&_.stroke()}_updateAnimationTarget(s){const _=this.chart,_e=this.$animations,et=_e&&_e.x,it=_e&&_e.y;if(et||it){const tt=positioners[s.position].call(this,this._active,this._eventPosition);if(!tt)return;const rt=this._size=getTooltipSize(this,s),nt=Object.assign({},tt,this._size),ot=determineAlignment(_,s,nt),st=getBackgroundPoint(s,nt,ot,_);(et._to!==st.x||it._to!==st.y)&&(this.xAlign=ot.xAlign,this.yAlign=ot.yAlign,this.width=rt.width,this.height=rt.height,this.caretX=tt.x,this.caretY=tt.y,this._resolveAnimations().update(this,st))}}draw(s){const _=this.options.setContext(this.getContext());let _e=this.opacity;if(!_e)return;this._updateAnimationTarget(_);const et={width:this.width,height:this.height},it={x:this.x,y:this.y};_e=Math.abs(_e)<.001?0:_e;const tt=toPadding(_.padding),rt=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;_.enabled&&rt&&(s.save(),s.globalAlpha=_e,this.drawBackground(it,s,et,_),overrideTextDirection(s,_.textDirection),it.y+=tt.top,this.drawTitle(it,s,_),this.drawBody(it,s,_),this.drawFooter(it,s,_),restoreTextDirection(s,_.textDirection),s.restore())}getActiveElements(){return this._active||[]}setActiveElements(s,_){const _e=this._active,et=s.map(({datasetIndex:rt,index:nt})=>{const ot=this.chart.getDatasetMeta(rt);if(!ot)throw new Error("Cannot find a dataset at index "+rt);return{datasetIndex:rt,element:ot.data[nt],index:nt}}),it=!_elementsEqual(_e,et),tt=this._positionChanged(et,_);(it||tt)&&(this._active=et,this._eventPosition=_,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(s,_,_e=!0){if(_&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const et=this.options,it=this._active||[],tt=this._getActiveElements(s,it,_,_e),rt=this._positionChanged(tt,s),nt=_||!_elementsEqual(tt,it)||rt;return nt&&(this._active=tt,(et.enabled||et.external)&&(this._eventPosition={x:s.x,y:s.y},this.update(!0,_))),nt}_getActiveElements(s,_,_e,et){const it=this.options;if(s.type==="mouseout")return[];if(!et)return _;const tt=this.chart.getElementsAtEventForMode(s,it.mode,it,_e);return it.reverse&&tt.reverse(),tt}_positionChanged(s,_){const{caretX:_e,caretY:et,options:it}=this,tt=positioners[it.position].call(this,s,_);return tt!==!1&&(_e!==tt.x||et!==tt.y)}}Tooltip.positioners=positioners;var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners,afterInit(o,s,_){_&&(o.tooltip=new Tooltip({chart:o,options:_}))},beforeUpdate(o,s,_){o.tooltip&&o.tooltip.initialize(_)},reset(o,s,_){o.tooltip&&o.tooltip.initialize(_)},afterDraw(o){const s=o.tooltip,_={tooltip:s};o.notifyPlugins("beforeTooltipDraw",_)!==!1&&(s&&s.draw(o.ctx),o.notifyPlugins("afterTooltipDraw",_))},afterEvent(o,s){if(o.tooltip){const _=s.replay;o.tooltip.handleEvent(s.event,_,s.inChartArea)&&(s.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(o,s)=>s.bodyFont.size,boxWidth:(o,s)=>s.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:noop,title(o){if(o.length>0){const s=o[0],_=s.chart.data.labels,_e=_?_.length:0;if(this&&this.options&&this.options.mode==="dataset")return s.dataset.label||"";if(s.label)return s.label;if(_e>0&&s.dataIndex<_e)return _[s.dataIndex]}return""},afterTitle:noop,beforeBody:noop,beforeLabel:noop,label(o){if(this&&this.options&&this.options.mode==="dataset")return o.label+": "+o.formattedValue||o.formattedValue;let s=o.dataset.label||"";s&&(s+=": ");const _=o.formattedValue;return isNullOrUndef(_)||(s+=_),s},labelColor(o){const _=o.chart.getDatasetMeta(o.datasetIndex).controller.getStyle(o.dataIndex);return{borderColor:_.borderColor,backgroundColor:_.backgroundColor,borderWidth:_.borderWidth,borderDash:_.borderDash,borderDashOffset:_.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(o){const _=o.chart.getDatasetMeta(o.datasetIndex).controller.getStyle(o.dataIndex);return{pointStyle:_.pointStyle,rotation:_.rotation}},afterLabel:noop,afterBody:noop,beforeFooter:noop,footer:noop,afterFooter:noop}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:o=>o!=="filter"&&o!=="itemSort"&&o!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},plugins=Object.freeze({__proto__:null,Decimation:plugin_decimation,Filler:plugin_filler,Legend:plugin_legend,SubTitle:plugin_subtitle,Title:plugin_title,Tooltip:plugin_tooltip});const addIfString=(o,s,_,_e)=>(typeof s=="string"?(_=o.push(s)-1,_e.unshift({index:_,label:s})):isNaN(s)&&(_=null),_);function findOrAddLabel(o,s,_,_e){const et=o.indexOf(s);if(et===-1)return addIfString(o,s,_,_e);const it=o.lastIndexOf(s);return et!==it?_:et}const validIndex=(o,s)=>o===null?null:_limitValue(Math.round(o),0,s);class CategoryScale extends Scale{constructor(s){super(s),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(s){const _=this._addedLabels;if(_.length){const _e=this.getLabels();for(const{index:et,label:it}of _)_e[et]===it&&_e.splice(et,1);this._addedLabels=[]}super.init(s)}parse(s,_){if(isNullOrUndef(s))return null;const _e=this.getLabels();return _=isFinite(_)&&_e[_]===s?_:findOrAddLabel(_e,s,valueOrDefault(_,s),this._addedLabels),validIndex(_,_e.length-1)}determineDataLimits(){const{minDefined:s,maxDefined:_}=this.getUserBounds();let{min:_e,max:et}=this.getMinMax(!0);this.options.bounds==="ticks"&&(s||(_e=0),_||(et=this.getLabels().length-1)),this.min=_e,this.max=et}buildTicks(){const s=this.min,_=this.max,_e=this.options.offset,et=[];let it=this.getLabels();it=s===0&&_===it.length-1?it:it.slice(s,_+1),this._valueRange=Math.max(it.length-(_e?0:1),1),this._startValue=this.min-(_e?.5:0);for(let tt=s;tt<=_;tt++)et.push({value:tt});return et}getLabelForValue(s){const _=this.getLabels();return s>=0&&s<_.length?_[s]:s}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(s){return typeof s!="number"&&(s=this.parse(s)),s===null?NaN:this.getPixelForDecimal((s-this._startValue)/this._valueRange)}getPixelForTick(s){const _=this.ticks;return s<0||s>_.length-1?null:this.getPixelForValue(_[s].value)}getValueForPixel(s){return Math.round(this._startValue+this.getDecimalForPixel(s)*this._valueRange)}getBasePixel(){return this.bottom}}CategoryScale.id="category";CategoryScale.defaults={ticks:{callback:CategoryScale.prototype.getLabelForValue}};function generateTicks$1(o,s){const _=[],{bounds:et,step:it,min:tt,max:rt,precision:nt,count:ot,maxTicks:st,maxDigits:at,includeBounds:lt}=o,ct=it||1,ht=st-1,{min:mt,max:dt}=s,ft=!isNullOrUndef(tt),ut=!isNullOrUndef(rt),pt=!isNullOrUndef(ot),At=(dt-mt)/(at+1);let gt=niceNum((dt-mt)/ht/ct)*ct,vt,yt,bt,Ct;if(gt<1e-14&&!ft&&!ut)return[{value:mt},{value:dt}];Ct=Math.ceil(dt/gt)-Math.floor(mt/gt),Ct>ht&&(gt=niceNum(Ct*gt/ht/ct)*ct),isNullOrUndef(nt)||(vt=Math.pow(10,nt),gt=Math.ceil(gt*vt)/vt),et==="ticks"?(yt=Math.floor(mt/gt)*gt,bt=Math.ceil(dt/gt)*gt):(yt=mt,bt=dt),ft&&ut&&it&&almostWhole((rt-tt)/it,gt/1e3)?(Ct=Math.round(Math.min((rt-tt)/gt,st)),gt=(rt-tt)/Ct,yt=tt,bt=rt):pt?(yt=ft?tt:yt,bt=ut?rt:bt,Ct=ot-1,gt=(bt-yt)/Ct):(Ct=(bt-yt)/gt,almostEquals(Ct,Math.round(Ct),gt/1e3)?Ct=Math.round(Ct):Ct=Math.ceil(Ct));const xt=Math.max(_decimalPlaces(gt),_decimalPlaces(yt));vt=Math.pow(10,isNullOrUndef(nt)?xt:nt),yt=Math.round(yt*vt)/vt,bt=Math.round(bt*vt)/vt;let It=0;for(ft&&(lt&&yt!==tt?(_.push({value:tt}),yt<tt&&It++,almostEquals(Math.round((yt+It*gt)*vt)/vt,tt,relativeLabelSize(tt,At,o))&&It++):yt<tt&&It++);It<Ct;++It)_.push({value:Math.round((yt+It*gt)*vt)/vt});return ut&&lt&&bt!==rt?_.length&&almostEquals(_[_.length-1].value,rt,relativeLabelSize(rt,At,o))?_[_.length-1].value=rt:_.push({value:rt}):(!ut||bt===rt)&&_.push({value:bt}),_}function relativeLabelSize(o,s,{horizontal:_,minRotation:_e}){const et=toRadians(_e),it=(_?Math.sin(et):Math.cos(et))||.001,tt=.75*s*(""+o).length;return Math.min(s/it,tt)}class LinearScaleBase extends Scale{constructor(s){super(s),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(s,_){return isNullOrUndef(s)||(typeof s=="number"||s instanceof Number)&&!isFinite(+s)?null:+s}handleTickRangeOptions(){const{beginAtZero:s}=this.options,{minDefined:_,maxDefined:_e}=this.getUserBounds();let{min:et,max:it}=this;const tt=nt=>et=_?et:nt,rt=nt=>it=_e?it:nt;if(s){const nt=sign(et),ot=sign(it);nt<0&&ot<0?rt(0):nt>0&&ot>0&&tt(0)}if(et===it){let nt=1;(it>=Number.MAX_SAFE_INTEGER||et<=Number.MIN_SAFE_INTEGER)&&(nt=Math.abs(it*.05)),rt(it+nt),s||tt(et-nt)}this.min=et,this.max=it}getTickLimit(){const s=this.options.ticks;let{maxTicksLimit:_,stepSize:_e}=s,et;return _e?(et=Math.ceil(this.max/_e)-Math.floor(this.min/_e)+1,et>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${_e} would result generating up to ${et} ticks. Limiting to 1000.`),et=1e3)):(et=this.computeTickLimit(),_=_||11),_&&(et=Math.min(_,et)),et}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const s=this.options,_=s.ticks;let _e=this.getTickLimit();_e=Math.max(2,_e);const et={maxTicks:_e,bounds:s.bounds,min:s.min,max:s.max,precision:_.precision,step:_.stepSize,count:_.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:_.minRotation||0,includeBounds:_.includeBounds!==!1},it=this._range||this,tt=generateTicks$1(et,it);return s.bounds==="ticks"&&_setMinAndMaxByKey(tt,this,"value"),s.reverse?(tt.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),tt}configure(){const s=this.ticks;let _=this.min,_e=this.max;if(super.configure(),this.options.offset&&s.length){const et=(_e-_)/Math.max(s.length-1,1)/2;_-=et,_e+=et}this._startValue=_,this._endValue=_e,this._valueRange=_e-_}getLabelForValue(s){return formatNumber(s,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{determineDataLimits(){const{min:s,max:_}=this.getMinMax(!0);this.min=isNumberFinite(s)?s:0,this.max=isNumberFinite(_)?_:1,this.handleTickRangeOptions()}computeTickLimit(){const s=this.isHorizontal(),_=s?this.width:this.height,_e=toRadians(this.options.ticks.minRotation),et=(s?Math.sin(_e):Math.cos(_e))||.001,it=this._resolveTickFontOptions(0);return Math.ceil(_/Math.min(40,it.lineHeight/et))}getPixelForValue(s){return s===null?NaN:this.getPixelForDecimal((s-this._startValue)/this._valueRange)}getValueForPixel(s){return this._startValue+this.getDecimalForPixel(s)*this._valueRange}}LinearScale.id="linear";LinearScale.defaults={ticks:{callback:Ticks.formatters.numeric}};function isMajor(o){return o/Math.pow(10,Math.floor(log10(o)))===1}function generateTicks(o,s){const _=Math.floor(log10(s.max)),_e=Math.ceil(s.max/Math.pow(10,_)),et=[];let it=finiteOrDefault(o.min,Math.pow(10,Math.floor(log10(s.min)))),tt=Math.floor(log10(it)),rt=Math.floor(it/Math.pow(10,tt)),nt=tt<0?Math.pow(10,Math.abs(tt)):1;do et.push({value:it,major:isMajor(it)}),++rt,rt===10&&(rt=1,++tt,nt=tt>=0?1:nt),it=Math.round(rt*Math.pow(10,tt)*nt)/nt;while(tt<_||tt===_&&rt<_e);const ot=finiteOrDefault(o.max,it);return et.push({value:ot,major:isMajor(it)}),et}class LogarithmicScale extends Scale{constructor(s){super(s),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(s,_){const _e=LinearScaleBase.prototype.parse.apply(this,[s,_]);if(_e===0){this._zero=!0;return}return isNumberFinite(_e)&&_e>0?_e:null}determineDataLimits(){const{min:s,max:_}=this.getMinMax(!0);this.min=isNumberFinite(s)?Math.max(0,s):null,this.max=isNumberFinite(_)?Math.max(0,_):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:s,maxDefined:_}=this.getUserBounds();let _e=this.min,et=this.max;const it=nt=>_e=s?_e:nt,tt=nt=>et=_?et:nt,rt=(nt,ot)=>Math.pow(10,Math.floor(log10(nt))+ot);_e===et&&(_e<=0?(it(1),tt(10)):(it(rt(_e,-1)),tt(rt(et,1)))),_e<=0&&it(rt(et,-1)),et<=0&&tt(rt(_e,1)),this._zero&&this.min!==this._suggestedMin&&_e===rt(this.min,0)&&it(rt(_e,-1)),this.min=_e,this.max=et}buildTicks(){const s=this.options,_={min:this._userMin,max:this._userMax},_e=generateTicks(_,this);return s.bounds==="ticks"&&_setMinAndMaxByKey(_e,this,"value"),s.reverse?(_e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),_e}getLabelForValue(s){return s===void 0?"0":formatNumber(s,this.chart.options.locale,this.options.ticks.format)}configure(){const s=this.min;super.configure(),this._startValue=log10(s),this._valueRange=log10(this.max)-log10(s)}getPixelForValue(s){return(s===void 0||s===0)&&(s=this.min),s===null||isNaN(s)?NaN:this.getPixelForDecimal(s===this.min?0:(log10(s)-this._startValue)/this._valueRange)}getValueForPixel(s){const _=this.getDecimalForPixel(s);return Math.pow(10,this._startValue+_*this._valueRange)}}LogarithmicScale.id="logarithmic";LogarithmicScale.defaults={ticks:{callback:Ticks.formatters.logarithmic,major:{enabled:!0}}};function getTickBackdropHeight(o){const s=o.ticks;if(s.display&&o.display){const _=toPadding(s.backdropPadding);return valueOrDefault(s.font&&s.font.size,defaults.font.size)+_.height}return 0}function measureLabelSize(o,s,_){return _=isArray(_)?_:[_],{w:_longestText(o,s.string,_),h:_.length*s.lineHeight}}function determineLimits(o,s,_,_e,et){return o===_e||o===et?{start:s-_/2,end:s+_/2}:o<_e||o>et?{start:s-_,end:s}:{start:s,end:s+_}}function fitWithPointLabels(o){const s={l:o.left+o._padding.left,r:o.right-o._padding.right,t:o.top+o._padding.top,b:o.bottom-o._padding.bottom},_=Object.assign({},s),_e=[],et=[],it=o._pointLabels.length,tt=o.options.pointLabels,rt=tt.centerPointLabels?PI/it:0;for(let nt=0;nt<it;nt++){const ot=tt.setContext(o.getPointLabelContext(nt));et[nt]=ot.padding;const st=o.getPointPosition(nt,o.drawingArea+et[nt],rt),at=toFont(ot.font),lt=measureLabelSize(o.ctx,at,o._pointLabels[nt]);_e[nt]=lt;const ct=_normalizeAngle(o.getIndexAngle(nt)+rt),ht=Math.round(toDegrees(ct)),mt=determineLimits(ht,st.x,lt.w,0,180),dt=determineLimits(ht,st.y,lt.h,90,270);updateLimits(_,s,ct,mt,dt)}o.setCenterPoint(s.l-_.l,_.r-s.r,s.t-_.t,_.b-s.b),o._pointLabelItems=buildPointLabelItems(o,_e,et)}function updateLimits(o,s,_,_e,et){const it=Math.abs(Math.sin(_)),tt=Math.abs(Math.cos(_));let rt=0,nt=0;_e.start<s.l?(rt=(s.l-_e.start)/it,o.l=Math.min(o.l,s.l-rt)):_e.end>s.r&&(rt=(_e.end-s.r)/it,o.r=Math.max(o.r,s.r+rt)),et.start<s.t?(nt=(s.t-et.start)/tt,o.t=Math.min(o.t,s.t-nt)):et.end>s.b&&(nt=(et.end-s.b)/tt,o.b=Math.max(o.b,s.b+nt))}function buildPointLabelItems(o,s,_){const _e=[],et=o._pointLabels.length,it=o.options,tt=getTickBackdropHeight(it)/2,rt=o.drawingArea,nt=it.pointLabels.centerPointLabels?PI/et:0;for(let ot=0;ot<et;ot++){const st=o.getPointPosition(ot,rt+tt+_[ot],nt),at=Math.round(toDegrees(_normalizeAngle(st.angle+HALF_PI))),lt=s[ot],ct=yForAngle(st.y,lt.h,at),ht=getTextAlignForAngle(at),mt=leftForTextAlign(st.x,lt.w,ht);_e.push({x:st.x,y:ct,textAlign:ht,left:mt,top:ct,right:mt+lt.w,bottom:ct+lt.h})}return _e}function getTextAlignForAngle(o){return o===0||o===180?"center":o<180?"left":"right"}function leftForTextAlign(o,s,_){return _==="right"?o-=s:_==="center"&&(o-=s/2),o}function yForAngle(o,s,_){return _===90||_===270?o-=s/2:(_>270||_<90)&&(o-=s),o}function drawPointLabels(o,s){const{ctx:_,options:{pointLabels:_e}}=o;for(let et=s-1;et>=0;et--){const it=_e.setContext(o.getPointLabelContext(et)),tt=toFont(it.font),{x:rt,y:nt,textAlign:ot,left:st,top:at,right:lt,bottom:ct}=o._pointLabelItems[et],{backdropColor:ht}=it;if(!isNullOrUndef(ht)){const mt=toPadding(it.backdropPadding);_.fillStyle=ht,_.fillRect(st-mt.left,at-mt.top,lt-st+mt.width,ct-at+mt.height)}renderText(_,o._pointLabels[et],rt,nt+tt.lineHeight/2,tt,{color:it.color,textAlign:ot,textBaseline:"middle"})}}function pathRadiusLine(o,s,_,_e){const{ctx:et}=o;if(_)et.arc(o.xCenter,o.yCenter,s,0,TAU);else{let it=o.getPointPosition(0,s);et.moveTo(it.x,it.y);for(let tt=1;tt<_e;tt++)it=o.getPointPosition(tt,s),et.lineTo(it.x,it.y)}}function drawRadiusLine(o,s,_,_e){const et=o.ctx,it=s.circular,{color:tt,lineWidth:rt}=s;!it&&!_e||!tt||!rt||_<0||(et.save(),et.strokeStyle=tt,et.lineWidth=rt,et.setLineDash(s.borderDash),et.lineDashOffset=s.borderDashOffset,et.beginPath(),pathRadiusLine(o,_,it,_e),et.closePath(),et.stroke(),et.restore())}function createPointLabelContext(o,s,_){return createContext(o,{label:_,index:s,type:"pointLabel"})}class RadialLinearScale extends LinearScaleBase{constructor(s){super(s),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const s=this._padding=toPadding(getTickBackdropHeight(this.options)/2),_=this.width=this.maxWidth-s.width,_e=this.height=this.maxHeight-s.height;this.xCenter=Math.floor(this.left+_/2+s.left),this.yCenter=Math.floor(this.top+_e/2+s.top),this.drawingArea=Math.floor(Math.min(_,_e)/2)}determineDataLimits(){const{min:s,max:_}=this.getMinMax(!1);this.min=isNumberFinite(s)&&!isNaN(s)?s:0,this.max=isNumberFinite(_)&&!isNaN(_)?_:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/getTickBackdropHeight(this.options))}generateTickLabels(s){LinearScaleBase.prototype.generateTickLabels.call(this,s),this._pointLabels=this.getLabels().map((_,_e)=>{const et=callback(this.options.pointLabels.callback,[_,_e],this);return et||et===0?et:""}).filter((_,_e)=>this.chart.getDataVisibility(_e))}fit(){const s=this.options;s.display&&s.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(s,_,_e,et){this.xCenter+=Math.floor((s-_)/2),this.yCenter+=Math.floor((_e-et)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(s,_,_e,et))}getIndexAngle(s){const _=TAU/(this._pointLabels.length||1),_e=this.options.startAngle||0;return _normalizeAngle(s*_+toRadians(_e))}getDistanceFromCenterForValue(s){if(isNullOrUndef(s))return NaN;const _=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-s)*_:(s-this.min)*_}getValueForDistanceFromCenter(s){if(isNullOrUndef(s))return NaN;const _=s/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-_:this.min+_}getPointLabelContext(s){const _=this._pointLabels||[];if(s>=0&&s<_.length){const _e=_[s];return createPointLabelContext(this.getContext(),s,_e)}}getPointPosition(s,_,_e=0){const et=this.getIndexAngle(s)-HALF_PI+_e;return{x:Math.cos(et)*_+this.xCenter,y:Math.sin(et)*_+this.yCenter,angle:et}}getPointPositionForValue(s,_){return this.getPointPosition(s,this.getDistanceFromCenterForValue(_))}getBasePosition(s){return this.getPointPositionForValue(s||0,this.getBaseValue())}getPointLabelPosition(s){const{left:_,top:_e,right:et,bottom:it}=this._pointLabelItems[s];return{left:_,top:_e,right:et,bottom:it}}drawBackground(){const{backgroundColor:s,grid:{circular:_}}=this.options;if(s){const _e=this.ctx;_e.save(),_e.beginPath(),pathRadiusLine(this,this.getDistanceFromCenterForValue(this._endValue),_,this._pointLabels.length),_e.closePath(),_e.fillStyle=s,_e.fill(),_e.restore()}}drawGrid(){const s=this.ctx,_=this.options,{angleLines:_e,grid:et}=_,it=this._pointLabels.length;let tt,rt,nt;if(_.pointLabels.display&&drawPointLabels(this,it),et.display&&this.ticks.forEach((ot,st)=>{if(st!==0){rt=this.getDistanceFromCenterForValue(ot.value);const at=et.setContext(this.getContext(st-1));drawRadiusLine(this,at,rt,it)}}),_e.display){for(s.save(),tt=it-1;tt>=0;tt--){const ot=_e.setContext(this.getPointLabelContext(tt)),{color:st,lineWidth:at}=ot;!at||!st||(s.lineWidth=at,s.strokeStyle=st,s.setLineDash(ot.borderDash),s.lineDashOffset=ot.borderDashOffset,rt=this.getDistanceFromCenterForValue(_.ticks.reverse?this.min:this.max),nt=this.getPointPosition(tt,rt),s.beginPath(),s.moveTo(this.xCenter,this.yCenter),s.lineTo(nt.x,nt.y),s.stroke())}s.restore()}}drawBorder(){}drawLabels(){const s=this.ctx,_=this.options,_e=_.ticks;if(!_e.display)return;const et=this.getIndexAngle(0);let it,tt;s.save(),s.translate(this.xCenter,this.yCenter),s.rotate(et),s.textAlign="center",s.textBaseline="middle",this.ticks.forEach((rt,nt)=>{if(nt===0&&!_.reverse)return;const ot=_e.setContext(this.getContext(nt)),st=toFont(ot.font);if(it=this.getDistanceFromCenterForValue(this.ticks[nt].value),ot.showLabelBackdrop){s.font=st.string,tt=s.measureText(rt.label).width,s.fillStyle=ot.backdropColor;const at=toPadding(ot.backdropPadding);s.fillRect(-tt/2-at.left,-it-st.size/2-at.top,tt+at.width,st.size+at.height)}renderText(s,rt.label,0,-it,st,{color:ot.color})}),s.restore()}drawTitle(){}}RadialLinearScale.id="radialLinear";RadialLinearScale.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(o){return o},padding:5,centerPointLabels:!1}};RadialLinearScale.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};RadialLinearScale.descriptors={angleLines:{_fallback:"grid"}};const INTERVALS={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},UNITS=Object.keys(INTERVALS);function sorter(o,s){return o-s}function parse(o,s){if(isNullOrUndef(s))return null;const _=o._adapter,{parser:_e,round:et,isoWeekday:it}=o._parseOpts;let tt=s;return typeof _e=="function"&&(tt=_e(tt)),isNumberFinite(tt)||(tt=typeof _e=="string"?_.parse(tt,_e):_.parse(tt)),tt===null?null:(et&&(tt=et==="week"&&(isNumber(it)||it===!0)?_.startOf(tt,"isoWeek",it):_.startOf(tt,et)),+tt)}function determineUnitForAutoTicks(o,s,_,_e){const et=UNITS.length;for(let it=UNITS.indexOf(o);it<et-1;++it){const tt=INTERVALS[UNITS[it]],rt=tt.steps?tt.steps:Number.MAX_SAFE_INTEGER;if(tt.common&&Math.ceil((_-s)/(rt*tt.size))<=_e)return UNITS[it]}return UNITS[et-1]}function determineUnitForFormatting(o,s,_,_e,et){for(let it=UNITS.length-1;it>=UNITS.indexOf(_);it--){const tt=UNITS[it];if(INTERVALS[tt].common&&o._adapter.diff(et,_e,tt)>=s-1)return tt}return UNITS[_?UNITS.indexOf(_):0]}function determineMajorUnit(o){for(let s=UNITS.indexOf(o)+1,_=UNITS.length;s<_;++s)if(INTERVALS[UNITS[s]].common)return UNITS[s]}function addTick(o,s,_){if(!_)o[s]=!0;else if(_.length){const{lo:_e,hi:et}=_lookup(_,s),it=_[_e]>=s?_[_e]:_[et];o[it]=!0}}function setMajorTicks(o,s,_,_e){const et=o._adapter,it=+et.startOf(s[0].value,_e),tt=s[s.length-1].value;let rt,nt;for(rt=it;rt<=tt;rt=+et.add(rt,1,_e))nt=_[rt],nt>=0&&(s[nt].major=!0);return s}function ticksFromTimestamps(o,s,_){const _e=[],et={},it=s.length;let tt,rt;for(tt=0;tt<it;++tt)rt=s[tt],et[rt]=tt,_e.push({value:rt,major:!1});return it===0||!_?_e:setMajorTicks(o,_e,et,_)}class TimeScale extends Scale{constructor(s){super(s),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(s,_){const _e=s.time||(s.time={}),et=this._adapter=new adapters._date(s.adapters.date);mergeIf(_e.displayFormats,et.formats()),this._parseOpts={parser:_e.parser,round:_e.round,isoWeekday:_e.isoWeekday},super.init(s),this._normalized=_.normalized}parse(s,_){return s===void 0?null:parse(this,s)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const s=this.options,_=this._adapter,_e=s.time.unit||"day";let{min:et,max:it,minDefined:tt,maxDefined:rt}=this.getUserBounds();function nt(ot){!tt&&!isNaN(ot.min)&&(et=Math.min(et,ot.min)),!rt&&!isNaN(ot.max)&&(it=Math.max(it,ot.max))}(!tt||!rt)&&(nt(this._getLabelBounds()),(s.bounds!=="ticks"||s.ticks.source!=="labels")&&nt(this.getMinMax(!1))),et=isNumberFinite(et)&&!isNaN(et)?et:+_.startOf(Date.now(),_e),it=isNumberFinite(it)&&!isNaN(it)?it:+_.endOf(Date.now(),_e)+1,this.min=Math.min(et,it-1),this.max=Math.max(et+1,it)}_getLabelBounds(){const s=this.getLabelTimestamps();let _=Number.POSITIVE_INFINITY,_e=Number.NEGATIVE_INFINITY;return s.length&&(_=s[0],_e=s[s.length-1]),{min:_,max:_e}}buildTicks(){const s=this.options,_=s.time,_e=s.ticks,et=_e.source==="labels"?this.getLabelTimestamps():this._generate();s.bounds==="ticks"&&et.length&&(this.min=this._userMin||et[0],this.max=this._userMax||et[et.length-1]);const it=this.min,tt=this.max,rt=_filterBetween(et,it,tt);return this._unit=_.unit||(_e.autoSkip?determineUnitForAutoTicks(_.minUnit,this.min,this.max,this._getLabelCapacity(it)):determineUnitForFormatting(this,rt.length,_.minUnit,this.min,this.max)),this._majorUnit=!_e.major.enabled||this._unit==="year"?void 0:determineMajorUnit(this._unit),this.initOffsets(et),s.reverse&&rt.reverse(),ticksFromTimestamps(this,rt,this._majorUnit)}initOffsets(s){let _=0,_e=0,et,it;this.options.offset&&s.length&&(et=this.getDecimalForValue(s[0]),s.length===1?_=1-et:_=(this.getDecimalForValue(s[1])-et)/2,it=this.getDecimalForValue(s[s.length-1]),s.length===1?_e=it:_e=(it-this.getDecimalForValue(s[s.length-2]))/2);const tt=s.length<3?.5:.25;_=_limitValue(_,0,tt),_e=_limitValue(_e,0,tt),this._offsets={start:_,end:_e,factor:1/(_+1+_e)}}_generate(){const s=this._adapter,_=this.min,_e=this.max,et=this.options,it=et.time,tt=it.unit||determineUnitForAutoTicks(it.minUnit,_,_e,this._getLabelCapacity(_)),rt=valueOrDefault(it.stepSize,1),nt=tt==="week"?it.isoWeekday:!1,ot=isNumber(nt)||nt===!0,st={};let at=_,lt,ct;if(ot&&(at=+s.startOf(at,"isoWeek",nt)),at=+s.startOf(at,ot?"day":tt),s.diff(_e,_,tt)>1e5*rt)throw new Error(_+" and "+_e+" are too far apart with stepSize of "+rt+" "+tt);const ht=et.ticks.source==="data"&&this.getDataTimestamps();for(lt=at,ct=0;lt<_e;lt=+s.add(lt,rt,tt),ct++)addTick(st,lt,ht);return(lt===_e||et.bounds==="ticks"||ct===1)&&addTick(st,lt,ht),Object.keys(st).sort((mt,dt)=>mt-dt).map(mt=>+mt)}getLabelForValue(s){const _=this._adapter,_e=this.options.time;return _e.tooltipFormat?_.format(s,_e.tooltipFormat):_.format(s,_e.displayFormats.datetime)}_tickFormatFunction(s,_,_e,et){const it=this.options,tt=it.time.displayFormats,rt=this._unit,nt=this._majorUnit,ot=rt&&tt[rt],st=nt&&tt[nt],at=_e[_],lt=nt&&st&&at&&at.major,ct=this._adapter.format(s,et||(lt?st:ot)),ht=it.ticks.callback;return ht?callback(ht,[ct,_,_e],this):ct}generateTickLabels(s){let _,_e,et;for(_=0,_e=s.length;_<_e;++_)et=s[_],et.label=this._tickFormatFunction(et.value,_,s)}getDecimalForValue(s){return s===null?NaN:(s-this.min)/(this.max-this.min)}getPixelForValue(s){const _=this._offsets,_e=this.getDecimalForValue(s);return this.getPixelForDecimal((_.start+_e)*_.factor)}getValueForPixel(s){const _=this._offsets,_e=this.getDecimalForPixel(s)/_.factor-_.end;return this.min+_e*(this.max-this.min)}_getLabelSize(s){const _=this.options.ticks,_e=this.ctx.measureText(s).width,et=toRadians(this.isHorizontal()?_.maxRotation:_.minRotation),it=Math.cos(et),tt=Math.sin(et),rt=this._resolveTickFontOptions(0).size;return{w:_e*it+rt*tt,h:_e*tt+rt*it}}_getLabelCapacity(s){const _=this.options.time,_e=_.displayFormats,et=_e[_.unit]||_e.millisecond,it=this._tickFormatFunction(s,0,ticksFromTimestamps(this,[s],this._majorUnit),et),tt=this._getLabelSize(it),rt=Math.floor(this.isHorizontal()?this.width/tt.w:this.height/tt.h)-1;return rt>0?rt:1}getDataTimestamps(){let s=this._cache.data||[],_,_e;if(s.length)return s;const et=this.getMatchingVisibleMetas();if(this._normalized&&et.length)return this._cache.data=et[0].controller.getAllParsedValues(this);for(_=0,_e=et.length;_<_e;++_)s=s.concat(et[_].controller.getAllParsedValues(this));return this._cache.data=this.normalize(s)}getLabelTimestamps(){const s=this._cache.labels||[];let _,_e;if(s.length)return s;const et=this.getLabels();for(_=0,_e=et.length;_<_e;++_)s.push(parse(this,et[_]));return this._cache.labels=this._normalized?s:this.normalize(s)}normalize(s){return _arrayUnique(s.sort(sorter))}}TimeScale.id="time";TimeScale.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};function interpolate(o,s,_){let _e=0,et=o.length-1,it,tt,rt,nt;_?(s>=o[_e].pos&&s<=o[et].pos&&({lo:_e,hi:et}=_lookupByKey(o,"pos",s)),{pos:it,time:rt}=o[_e],{pos:tt,time:nt}=o[et]):(s>=o[_e].time&&s<=o[et].time&&({lo:_e,hi:et}=_lookupByKey(o,"time",s)),{time:it,pos:rt}=o[_e],{time:tt,pos:nt}=o[et]);const ot=tt-it;return ot?rt+(nt-rt)*(s-it)/ot:rt}class TimeSeriesScale extends TimeScale{constructor(s){super(s),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const s=this._getTimestampsForTable(),_=this._table=this.buildLookupTable(s);this._minPos=interpolate(_,this.min),this._tableRange=interpolate(_,this.max)-this._minPos,super.initOffsets(s)}buildLookupTable(s){const{min:_,max:_e}=this,et=[],it=[];let tt,rt,nt,ot,st;for(tt=0,rt=s.length;tt<rt;++tt)ot=s[tt],ot>=_&&ot<=_e&&et.push(ot);if(et.length<2)return[{time:_,pos:0},{time:_e,pos:1}];for(tt=0,rt=et.length;tt<rt;++tt)st=et[tt+1],nt=et[tt-1],ot=et[tt],Math.round((st+nt)/2)!==ot&&it.push({time:ot,pos:tt/(rt-1)});return it}_getTimestampsForTable(){let s=this._cache.all||[];if(s.length)return s;const _=this.getDataTimestamps(),_e=this.getLabelTimestamps();return _.length&&_e.length?s=this.normalize(_.concat(_e)):s=_.length?_:_e,s=this._cache.all=s,s}getDecimalForValue(s){return(interpolate(this._table,s)-this._minPos)/this._tableRange}getValueForPixel(s){const _=this._offsets,_e=this.getDecimalForPixel(s)/_.factor-_.end;return interpolate(this._table,_e*this._tableRange+this._minPos,!0)}}TimeSeriesScale.id="timeseries";TimeSeriesScale.defaults=TimeScale.defaults;var scales=Object.freeze({__proto__:null,CategoryScale,LinearScale,LogarithmicScale,RadialLinearScale,TimeScale,TimeSeriesScale});const registerables=[controllers,elements,plugins,scales];Chart$1.register(...registerables);function _arrayWithHoles(o){if(Array.isArray(o))return o}function _iterableToArray(o){if(Symbol.iterator in Object(o)||Object.prototype.toString.call(o)==="[object Arguments]")return Array.from(o)}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _defineProperty(o,s,_){return s in o?Object.defineProperty(o,s,{value:_,enumerable:!0,configurable:!0,writable:!0}):o[s]=_,o}function _objectSpread(o){for(var s=arguments,_=function(et){var it=s[et]!=null?s[et]:{},tt=Object.keys(it);typeof Object.getOwnPropertySymbols=="function"&&(tt=tt.concat(Object.getOwnPropertySymbols(it).filter(function(rt){return Object.getOwnPropertyDescriptor(it,rt).enumerable}))),tt.forEach(function(rt){_defineProperty(o,rt,it[rt])})},_e=1;_e<arguments.length;_e++)_(_e);return o}function _objectWithoutPropertiesLoose(o,s){if(o==null)return{};var _={},_e=Object.keys(o),et,it;for(it=0;it<_e.length;it++)et=_e[it],!(s.indexOf(et)>=0)&&(_[et]=o[et]);return _}function _objectWithoutProperties(o,s){if(o==null)return{};var _=_objectWithoutPropertiesLoose(o,s),_e,et;if(Object.getOwnPropertySymbols){var it=Object.getOwnPropertySymbols(o);for(et=0;et<it.length;et++)_e=it[et],!(s.indexOf(_e)>=0)&&(!Object.prototype.propertyIsEnumerable.call(o,_e)||(_[_e]=o[_e]))}return _}function _slicedToArray(o,s){return _arrayWithHoles(o)||_iterableToArray(o)||_nonIterableRest()}function reforwardRef(o,s){typeof o=="function"?o(s):o&&(o.current=s)}function setOptions(o,s){o.options=_objectSpread({},s)}function setLabels(o,s){o.labels=s}function setDatasets(o,s){o.datasets=s.map(function(_){var _e=o.datasets.find(function(et){return et.label===_.label&&et.type===_.type});return!_e||!_.data?_objectSpread({},_):(Object.assign(_e,_),_e)})}function cloneData(o){var s={labels:[],datasets:[]};return setLabels(s,o.labels),setDatasets(s,o.datasets),s}var noopData={datasets:[]};function ChartComponent(o,s){var _=o.height,_e=_===void 0?150:_,et=o.width,it=et===void 0?300:et,tt=o.redraw,rt=tt===void 0?!1:tt,nt=o.type,ot=o.data,st=o.options,at=o.plugins,lt=at===void 0?[]:at,ct=o.getDatasetAtEvent,ht=o.getElementAtEvent,mt=o.getElementsAtEvent,dt=o.fallbackContent,ft=o.onClick,ut=_objectWithoutProperties(o,["height","width","redraw","type","data","options","plugins","getDatasetAtEvent","getElementAtEvent","getElementsAtEvent","fallbackContent","onClick"]),pt=react.exports.useRef(null),At=react.exports.useRef(),gt=_slicedToArray(react.exports.useState()),vt=gt[0],yt=gt[1],bt=vt||(typeof ot=="function"?noopData:ot),Ct=function(){!pt.current||(At.current=new Chart$1(pt.current,{type:nt,data:cloneData(bt),options:st,plugins:lt}),reforwardRef(s,At.current))},xt=function(){reforwardRef(s,null),At.current&&(At.current.destroy(),At.current=null)},It=function(St){ft&&ft(St);var Ot=At.current;!Ot||(ct&&ct(Ot.getElementsAtEventForMode(St.nativeEvent,"dataset",{intersect:!0},!1),St),ht&&ht(Ot.getElementsAtEventForMode(St.nativeEvent,"nearest",{intersect:!0},!1),St),mt&&mt(Ot.getElementsAtEventForMode(St.nativeEvent,"index",{intersect:!0},!1),St))};return react.exports.useEffect(function(){typeof ot=="function"&&pt.current&&yt(ot(pt.current))},[ot]),react.exports.useEffect(function(){!rt&&At.current&&st&&setOptions(At.current,st)},[rt,st]),react.exports.useEffect(function(){!rt&&At.current&&setLabels(At.current.config.data,bt.labels)},[rt,bt.labels]),react.exports.useEffect(function(){!rt&&At.current&&bt.datasets&&setDatasets(At.current.config.data,bt.datasets)},[rt,bt.datasets]),react.exports.useEffect(function(){!At.current||(rt?(xt(),setTimeout(Ct)):At.current.update())},[rt,st,bt.labels,bt.datasets]),react.exports.useEffect(function(){return Ct(),function(){return xt()}},[]),jsx("canvas",Tr(or({},Object.assign({ref:pt,role:"img",height:_e,width:it,onClick:It},ut)),{children:dt}))}var Chart=react.exports.forwardRef(ChartComponent);function createTypedChart(o){return react.exports.forwardRef(function(s,_){return jsx(Chart,or({},Object.assign({},s,{ref:_,type:o})))})}var Scatter=createTypedChart("scatter");class TimeseriesInput extends BaseComponent{constructor(_){super(_);Xn(this,"handleChange",_=>{this.props.handleChange(_)});Xn(this,"openFileUpload",()=>{this.uploader.current.click()});Xn(this,"render",()=>{let _=_e=>{_e.preventDefault(),_e.stopPropagation()};return this.props.value!==null?jsx("div",{className:"input_timeseries",children:jsx(Scatter,{data:{datasets:this.props.y.map((_e,et)=>({label:_e,borderColor:getNextColor(et),showLine:!0,fill:!0,backgroundColor:getNextColor(et,.25),data:this.props.value.data.map(it=>({x:it[0],y:it[et+1]}))}))}})}):jsxs("div",{className:"input_timeseries",onDrag:_,onDragStart:_,onDragEnd:_,onDragOver:_,onDragEnter:_,onDragLeave:_,onDrop:_,children:[jsxs("div",{className:"upload_zone",onClick:this.openFileUpload,onDrop:this.load_preview_from_drop,children:["Upload Timeseries CSV",this.props.x!==null?jsxs(Fragment,{children:[jsx("br",{}),"X Column: ",this.props.x,jsx("br",{}),"Y Column: ",this.props.y.join(", ")]}):!1]}),jsx("input",{className:"hidden_upload",type:"file",multiple:this.props.file_count==="multiple",webkitdirectory:this.props.file_count==="directory",mozdirectory:this.props.file_count==="directory",ref:this.uploader,onChange:this.load_preview_from_upload,style:{display:"none"}})]})});Xn(this,"load_preview_from_drop",_=>{this.load_preview_from_files(_.dataTransfer.files)});Xn(this,"load_preview_from_upload",_=>{this.load_preview_from_files(_.target.files)});Xn(this,"load_file",_=>{let _e=_.result;this.handleChange(load_data(_e,this.props.x,this.props.y))});Xn(this,"load_preview_from_files",_=>{if(!(!_.length||!window.FileReader)){this.file_data=[];for(let _e of _){let et=new FileReader;et.readAsBinaryString(_e),et.onloadend=this.load_file.bind(this,et)}}});this.uploader=React.createRef()}}Xn(TimeseriesInput,"memo",(_,_e)=>_.value instanceof Object&&_e.value instanceof Object?_.value.data===_e.value.data&&_.value.headers===_e.value.headers:_===_e);class TimeseriesInputExample extends ComponentExample{static async preprocess(s,_,_e){let et=_+"/"+s,it=await fetch(et);return it=await it.text(),load_data(it,_e.x,_e.y)}render(){return jsx("div",{className:"input_file_example",children:this.props.value})}}var load_data=(o,s,_)=>{let _e=null,et=null,it=CSVToArray(o);if(it.length!==0){if(s===null)et=it;else{let tt=it[0].indexOf(s),rt=_.map(nt=>it[0].indexOf(nt));if(tt===-1){alert("Missing x column: "+s);return}if(rt.includes(-1)){alert("Missing y column: "+_[rt.indexOf(-1)]);return}it=it.map(nt=>[nt[tt]].concat(rt.map(ot=>nt[ot]))),_e=it[0],et=it.slice(1)}return{headers:_e,data:et,range:null}}};class VideoInput extends BaseComponent{constructor(_){super(_);Xn(this,"record",async()=>{if(this.state.recording){this.media_recorder.stop();let _e=new Blob(this.blobs_recorded,{type:this.mimeType});var _=new FileReader;_.onload=function(et){let it="sample."+this.mimeType.substring(6);this.props.handleChange({name:it,data:et.target.result,is_example:!1})}.bind(this),_.readAsDataURL(_e),this.setState({recording:!1})}else{this.blobs_recorded=[],this.camera_stream=await navigator.mediaDevices.getUserMedia({video:!0,audio:!0}),this.videoRecorder.current.srcObject=this.camera_stream,this.videoRecorder.current.volume=0;let _e=null,et=["video/webm","video/mp4"];for(let it of et)if(MediaRecorder.isTypeSupported(it)){_e=it;break}if(_e===null){console.error("No supported MediaRecorder mimeType");return}this.media_recorder=new MediaRecorder(this.camera_stream,{mimeType:_e}),this.mimeType=_e,this.media_recorder.addEventListener("dataavailable",function(it){this.blobs_recorded.push(it.data)}.bind(this)),this.media_recorder.start(200),this.videoRecorder.current.play(),this.setState({recording:!0})}});this.handleChange=this.handleChange.bind(this),this.uploader=React.createRef(),this.videoRecorder=React.createRef(),this.openFileUpload=this.openFileUpload.bind(this),this.load_preview_from_files=this.load_preview_from_files.bind(this),this.load_preview_from_upload=this.load_preview_from_upload.bind(this),this.load_preview_from_drop=this.load_preview_from_drop.bind(this),this.camera_stream=null,this.state={recording:!1}}handleChange(_){this.props.handleChange(_.target.value)}openFileUpload(){this.uploader.current.click()}render(){let _=_e=>{_e.preventDefault(),_e.stopPropagation()};if(this.props.value!=null)return jsxs("div",{className:"input_video",children:[jsx("div",{className:"edit_buttons",children:jsx("button",{className:"clear_button",onClick:this.props.handleChange.bind(this,null),children:jsx("img",{src:clear_icon})})}),isPlayable("video",this.props.value.name)?jsx("div",{className:"video_preview_holder",children:jsx("video",{className:"video_preview",controls:!0,playsInline:!0,preload:!0,src:this.props.value.data})}):jsx("div",{className:"video_file_holder",children:this.props.value.name})]});if(this.props.source=="upload")return jsxs("div",{className:"input_video",onDrag:_,onDragStart:_,onDragEnd:_,onDragOver:_,onDragEnter:_,onDragLeave:_,onDrop:_,children:[jsxs("div",{className:"upload_zone",onClick:this.openFileUpload,onDrop:this.load_preview_from_drop,children:["Drop Video Here",jsx("br",{}),"- or -",jsx("br",{}),"Click to Upload"]}),jsx("input",{className:"hidden_upload",type:"file",ref:this.uploader,onChange:this.load_preview_from_upload,accept:"video/mp4,video/x-m4v,video/*",style:{display:"none"}})]});if(this.props.source=="webcam")return jsxs("div",{className:"input_video",children:[jsx("video",{ref:this.videoRecorder,className:"video_recorder",autoPlay:!0,playsInline:!0,muted:!0}),jsxs("div",{className:"record_holder",children:[jsx("div",{className:"record_message",children:this.state.recording?jsx(Fragment,{children:"Stop Recording"}):jsx(Fragment,{children:"Click to Record"})}),jsx("button",{className:"record",onClick:this.record})]})]})}load_preview_from_drop(_){this.load_preview_from_files(_.dataTransfer.files)}load_preview_from_upload(_){this.load_preview_from_files(_.target.files)}load_preview_from_files(_){if(!_.length||!window.FileReader||!/^video/.test(_[0].type))return;var _e=this,et=new FileReader;let it=_[0];et.readAsDataURL(it),et.onloadend=function(){_e.props.handleChange({name:it.name,data:this.result,is_example:!1})}}}class VideoInputExample extends FileComponentExample{constructor(s){super(s),this.video=React.createRef()}render(){return isPlayable("video",this.props.value)?jsx("div",{className:"input_video_example",children:jsx("div",{className:"video_holder",children:jsx("video",{ref:this.video,className:"video_preview",onMouseOver:()=>{this.video.current.play()},onMouseOut:()=>{this.video.current.pause()},preload:"metadata",children:jsx("source",{src:this.props.examples_dir+"/"+this.props.value})})})}):jsx("div",{className:"input_video_example",children:this.props.value})}}class AudioOutput extends BaseComponent{constructor(s){super(s),this.src=null,this.key=0}render(){return this.props.value!==this.src&&(this.key+=1,this.src=this.props.value),this.props.value?jsx("div",{className:"output_audio",children:jsx("audio",{controls:!0,children:jsx("source",{src:this.props.value})},this.key)}):!1}}class AudioOutputExample extends ComponentExample{render(){return jsx("div",{className:"output_audio_example",children:this.props.value})}}class CarouselOutput extends BaseComponent{constructor(s){super(s),this.next=this.next.bind(this),this.previous=this.previous.bind(this),this.state={carousel_index:0}}previous(){this.setState({carousel_index:(this.state.carousel_index-1+this.props.value.length)%this.props.value.length})}next(){this.setState({carousel_index:(this.state.carousel_index+1+this.props.value.length)%this.props.value.length})}render(){return this.props.value===null?(this.state.carousel_index!==0&&this.setState({carousel_index:0}),!1):jsxs("div",{className:"output_carousel",children:[this.props.components.map((s,_)=>{let _e=output_component_set.find(et=>et.name===s.name).memoized_component;return jsxs("div",{className:"component",children:[s.label?jsx("div",{className:"panel_header",children:s.label}):!1,react.exports.createElement(_e,Tr(or({},s),{value:this.props.value[this.state.carousel_index][_],key:_}))]},_)}),jsxs("div",{className:"carousel_control",children:[jsx("button",{onClick:this.previous,children:jsx("svg",{className:"caret",viewBox:"0 0 9.1457395 15.999842",children:jsx("path",{d:"M 0.32506616,7.2360106 7.1796187,0.33129769 c 0.4360247,-0.439451 1.1455702,-0.442056 1.5845974,-0.0058 0.4390612,0.435849 0.441666,1.14535901 0.00582,1.58438501 l -6.064985,6.1096644 6.10968,6.0646309 c 0.4390618,0.436026 0.4416664,1.145465 0.00582,1.584526 -0.4358485,0.439239 -1.1453586,0.441843 -1.5845975,0.0058 L 0.33088256,8.8203249 C 0.11135166,8.6022941 0.00105996,8.3161928 7.554975e-6,8.0295489 -0.00104244,7.7427633 0.10735446,7.4556467 0.32524356,7.2361162"})})}),jsxs("div",{className:"carousel_index",children:[this.state.carousel_index+1," / ",this.props.value.length]}),jsx("button",{onClick:this.next,children:jsx("svg",{className:"caret",viewBox:"0 0 9.1457395 15.999842",transform:"scale(-1, 1)",children:jsx("path",{d:"M 0.32506616,7.2360106 7.1796187,0.33129769 c 0.4360247,-0.439451 1.1455702,-0.442056 1.5845974,-0.0058 0.4390612,0.435849 0.441666,1.14535901 0.00582,1.58438501 l -6.064985,6.1096644 6.10968,6.0646309 c 0.4390618,0.436026 0.4416664,1.145465 0.00582,1.584526 -0.4358485,0.439239 -1.1453586,0.441843 -1.5845975,0.0058 L 0.33088256,8.8203249 C 0.11135166,8.6022941 0.00105996,8.3161928 7.554975e-6,8.0295489 -0.00104244,7.7427633 0.10735446,7.4556467 0.32524356,7.2361162"})})})]})]})}static load_example_preview(s){return s.length>20?s.substring(0,20)+"...":s}}class CarouselOutputExample extends ComponentExample{render(){return jsx("div",{className:"output_carousel_example",children:"..."})}}class DataframeOutput extends BaseComponent{constructor(s){super(s),this.state=this.constructor.get_default_state()}static get_default_state(){return{page:0,sort_by:null,sort_descending:!1}}static getDerivedStateFromProps(s,_){if(_.data===void 0||!array_compare(s.value.data,_.data)){let _e=DataframeOutput.get_default_state();return _e.data=s.value.data,_e}return null}set_page(s){this.setState({page:s})}sort_table(s){this.state.sort_by===s?this.setState({sort_descending:!this.state.sort_descending,page:0}):this.setState({sort_by:s,sort_descending:!1,page:0})}render(){if(this.props.value.data.length===0)return null;let s=this.props.headers||this.props.value.headers,_=this.props.value.data.length,_e=this.props.value.data[0].length,et=this.props.value.data.slice();this.state.sort_by!==null&&(et.sort(function(tt){return function(rt,nt){return rt[tt]===nt[tt]?0:rt[tt]<nt[tt]?-1:1}}(this.state.sort_by)),this.state.sort_descending&&et.reverse());let it=null;if(this.props.max_rows!==null&&_>this.props.max_rows)if(this.props.overflow_row_behaviour==="paginate"){et=et.slice(this.state.page*this.props.max_rows,(this.state.page+1)*this.props.max_rows);let tt=Math.ceil(_/this.props.max_rows);it=[],[0,this.state.page,tt-1].forEach(rt=>{for(let nt=rt-2;nt<=rt+2;nt++)nt>=0&&nt<tt&&!it.includes(nt)&&(it.length>0&&nt-it[it.length-1]>1&&it.push(null),it.push(nt))})}else et=et.slice(0,Math.ceil(this.props.max_rows/2)).concat([Array(_e).fill("...")],et.slice(_-Math.floor(this.props.max_rows/2)));if(this.props.max_cols!==null&&_e>this.props.max_cols){let[tt,rt]=[Math.ceil(this.props.max_cols/2),_e-Math.floor(this.props.max_cols/2)-1];s=s.slice(0,tt)+["..."]+s.slice(rt),et=et.map(nt=>nt.slice(0,tt)+["..."]+nt.slice(rt))}return jsxs("div",{className:"output_dataframe",children:[jsxs("table",{children:[s?jsx("thead",{children:s.map((tt,rt)=>jsxs("th",{onClick:this.sort_table.bind(this,rt),children:[tt,this.state.sort_by===rt?jsxs("svg",{className:"caret",viewBox:"0 0 20 20",transform:this.state.sort_descending?"scale(1, -1)":"",children:[jsx("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})," "]}):!1]},rt))}):!1,jsx("tbody",{children:et.map(tt=>jsx("tr",{children:tt.map(rt=>jsx("td",{children:rt}))}))})]}),it!==null?jsxs("div",{className:"pages",children:["Pages:"," ",it.map(tt=>tt===null?jsx("div",{children:"..."}):jsx("button",{className:classNames("page",{selected:tt===this.state.page}),onClick:this.set_page.bind(this,tt),children:tt+1},tt))]}):!1]})}}class DataframeOutputExample extends ComponentExample{render(){let s=[];for(let _ of this.props.value.slice(0,3)){let _e=_.slice(0,3);_.length>3&&_e.push("..."),s.push(_e)}if(this.props.value.length>3){let _=Array(s[0].length).fill("...");s.push(_)}return jsx("table",{className:"input_dataframe_example",children:jsx("tbody",{children:s.map(_=>jsx("tr",{children:_.map(_e=>jsx("td",{children:_e}))}))})})}}class FileOutput extends BaseComponent{render(){return this.props.value?jsx("div",{className:"output_file",children:jsxs("a",{className:"file_display",href:this.props.value.data,download:this.props.value.name,children:[jsx("div",{className:"file_name",children:this.props.value.name}),jsx("div",{className:"file_size",children:isNaN(this.props.value.size)?"":prettyBytes(this.props.value.size)})]})}):!1}}class FileOutputExample extends ComponentExample{render(){return jsx("div",{className:"output_file_example",children:this.props.value})}}class HighlightedTextOutput extends BaseComponent{constructor(s){super(s),this.color_map=this.props.color_map||{},this.new_category_index=0}generate_category_legend(s){for(let _ in s){if(_ in this.color_map)continue;let _e=s[_];_e||(_e=getNextColor(this.new_category_index),this.new_category_index++),this.color_map[_]=_e}}render(){if(this.props.value===null||this.props.value.length===0)return!1;let s=null;for(let _ of this.props.value)if(_[1]!==null){s=_[1];break}if(typeof s=="string"){let _={};for(let _e of this.props.value){let et=_e[1];et!=null&&(_[et]=null)}return this.generate_category_legend(_),jsxs("div",{className:"output_highlightedtext",children:[this.props.show_legend?jsx("div",{className:"category_legend",children:Object.entries(this.color_map).map(([_e,et])=>jsx("div",{className:"category-label",style:{"background-color":et},children:_e}))}):!1,jsx("div",{className:"textfield",children:this.props.value.map(_e=>{let et=_e[1],it={};return et!==null&&(it.color=this.color_map[et],it.backgroundColor=it.color.replace("1)","var(--tw-bg-opacity))")),jsxs("span",{className:"textspan",title:et,style:it,children:[jsx("span",{className:"text",children:_e[0]}),this.props.show_legend||_e[1]===null?!1:jsx("span",{className:"inline_label",style:{backgroundColor:it.color},children:_e[1]})]})})})]})}else return jsxs("div",{className:"output_highlightedtext",children:[this.props.show_legend?jsxs("div",{className:"color_legend",children:[jsx("span",{children:"-1"}),jsx("span",{children:"0"}),jsx("span",{children:"+1"})]}):!1,jsx("div",{className:"textfield",children:this.props.value.map(_=>{let[_e,et]=_,it="";return et<0?it="141, 131, 214,"+-et:it="235, 77, 75,"+et,jsx("span",{className:"textspan",title:et,style:{backgroundColor:`rgba(${it})`},children:jsx("span",{className:"text",children:_e})})})})]})}}class HighlightedTextOutputExample extends ComponentExample{render(){let s="";for(const _ of this.props.value)s+=_[0];return s.length>20&&(s=s.substring(0,20)+"..."),jsx("div",{className:"output_highlighted_text_example",children:s})}}class HTMLOutput extends BaseComponent{render(){return this.props.value?jsx("div",{className:"output_html",dangerouslySetInnerHTML:{__html:this.props.value}}):!1}}class HTMLOutputExample extends ComponentExample{render(){return jsx("div",{className:"output_html_example",children:"[HTML]"})}}class ImageOutput extends BaseComponent{render(){return this.props.value?jsx("div",{className:"output_image",children:jsx("div",{className:"image_preview_holder",children:jsx("img",{className:"image_preview",alt:"",src:this.props.value})})}):!1}}class ImageOutputExample extends ComponentExample{render(){return jsx("img",{className:"output_image_example",src:this.props.value,alt:""})}}class JSONNode extends React.Component{constructor(_){super(_);Xn(this,"open",()=>{this.setState({collapsed:!1})});Xn(this,"close",()=>{this.setState({collapsed:!0})});this.state={collapsed:this.props.depth>5}}render(){var _=null,_e=null;return this.props.value instanceof Array?this.state.collapsed?_=jsxs("button",{onClick:this.open,children:["[+",this.props.value.length," children]"]}):(_=jsxs(Fragment,{children:["[",jsx("div",{className:"json_children",children:this.props.value.map((et,it)=>jsxs("div",{className:"json_item",children:[it,": ",jsx(JSONNode,{value:et,depth:this.props.depth+1}),","]}))}),"]"]}),_e="array"):this.props.value instanceof Object?this.state.collapsed?_=jsxs("button",{onClick:this.open,children:["{+",Object.keys(this.props.value).length," items}"]}):(_=jsxs(Fragment,{children:["{",jsx("div",{className:"json_children",children:Object.entries(this.props.value).map(et=>jsxs("div",{className:"json_item",children:[et[0],": ",jsx(JSONNode,{value:et[1],depth:this.props.depth+1}),","]}))}),"}"]}),_e="object"):this.props.value===null?(_="null",_e="null"):(_=this.props.value,_e=typeof this.props.value,_e==="string"?_='"'+_+'"':_e==="boolean"&&(_=_.toLocaleString())),jsx("div",{type:_e,className:"json_node",children:_})}}class JSONOutput extends BaseComponent{render(){return this.props.value?jsx("div",{className:"output_json",children:jsx(JSONNode,{value:this.props.value,depth:1})}):!1}}class JSONOutputExample extends ComponentExample{render(){let s=JSON.stringify(this.props.value);return s.length>20&&(s=s.substring(0,20)+"..."),jsx("div",{className:"output_json_example",children:s})}}class KeyValuesOutput extends BaseComponent{render(){return this.props.value?jsx("div",{className:"output_keyvalues",children:jsxs("table",{children:[jsxs("thead",{children:[jsx("th",{children:"Property"}),jsx("th",{children:"Value"})]}),jsx("tbody",{children:this.props.value.map(([s,_])=>jsxs("tr",{children:[jsx("td",{children:s}),jsx("td",{children:_})]}))})]})}):!1}}class KeyValuesOutputExample extends ComponentExample{render(){return jsxs("div",{className:"output_key_values_example",children:[this.props.value.map(([s,_])=>jsxs("div",{children:[s,": ",_]})),this.props.value.length>3?jsx("div",{children:'"..."'}):!1,";"]})}}class LabelOutput extends BaseComponent{render(){if(this.props.value==null)return!1;let[s,_]=[[],[]];if("confidences"in this.props.value){for(let _e of this.props.value.confidences){let et=Math.round(_e.confidence*100)+"%";s.push(jsx("div",{className:"label",title:_e.label,children:_e.label})),_.push(jsx("div",{className:"confidence",title:et,style:{minWidth:"calc("+et+" - 12px)"},children:et}))}return jsxs("div",{className:"output_label",children:[jsx("div",{className:"output_class",children:this.props.value.label}),jsxs("div",{className:"confidence_intervals",children:[jsx("div",{className:"labels",style:{maxWidth:"120px"},children:s}),jsx("div",{className:"confidences",children:_})]})]})}return jsx("div",{className:"output_label",children:jsx("div",{className:"output_class_without_confidences",children:this.props.value.label})})}}class LabelOutputExample extends ComponentExample{convert_example_to_output(s){if(typeof s=="string")try{s=JSON.parse(s)}catch{return{label:s}}let[_,_e]=["",0],et={confidences:[]};for(let[it,tt]of Object.entries(s))et.confidences.push({label:it,confidence:tt}),tt>_e&&(_e=tt,_=it);return et.label=_,et}render(){return jsx("div",{className:"output_label_example",children:((_,_e)=>{if("confidences"in _e){if(typeof _=="string")try{_=JSON.parse(_)}catch{return _e.label}return _e.label+" ("+(100*_[_e.label]).toFixed(2)+"%)"}return _e.label})(this.props.value,this.convert_example_to_output(this.props.value))})}}class TextboxOutput extends BaseComponent{render(){return jsx("div",{className:"output_text",children:this.props.value===null?jsx("span",{children:"\xA0"}):this.props.value})}static load_example_preview(s){return s.length>20?s.substring(0,20)+"...":s}}class TextboxOutputExample extends ComponentExample{render(){return jsx("div",{className:"output_textbox_example",children:this.props.value})}}class TimeseriesOutput extends BaseComponent{constructor(s){super(s)}render(){if(this.props.value!==null){let s=this.props.y.map(_e=>this.props.value.headers.indexOf(_e)),_=this.props.value.headers.indexOf(this.props.x);return jsx("div",{className:"output_timeseries",children:jsx(Scatter,{data:{datasets:s.map((_e,et)=>({label:this.props.value.headers[_e],borderColor:getNextColor(et),showLine:!0,fill:!0,backgroundColor:getNextColor(et,.25),data:this.props.value.data.map(it=>({x:it[_],y:it[_e]}))}))}})})}else return!1}}Xn(TimeseriesOutput,"memo",(s,_)=>s.value instanceof Object&&_.value instanceof Object?s.value.data===_.value.data&&s.value.headers===_.value.headers:s===_);class TimeseriesOutputExample extends ComponentExample{render(){return jsx("div",{className:"input_file_example",children:this.props.value})}}class VideoOutput extends BaseComponent{render(){return this.props.value?isPlayable("video",this.props.value.name)?jsx("div",{className:"output_video",children:jsx("video",{controls:!0,playsInline:!0,preload:!0,src:this.props.value.data})}):jsx("div",{className:"output_video",children:jsx("a",{href:this.props.value.data,download:this.props.value.name,className:"video_file_holder",children:this.props.value.name})}):!1}}class VideoOutputExample extends ComponentExample{render(){return jsx("div",{className:"output_video_example",children:this.props.value})}}let input_component_set=[{name:"audio",component:AudioInput,memoized_component:null,example_component:AudioInputExample},{name:"checkboxgroup",component:CheckboxGroupInput,memoized_component:null,example_component:CheckboxGroupInputExample},{name:"checkbox",component:CheckboxInput,memoized_component:null,example_component:CheckboxInputExample},{name:"dataframe",component:DataframeInput,memoized_component:null,example_component:DataframeInputExample},{name:"dropdown",component:DropdownInput,memoized_component:null,example_component:DropdownInputExample},{name:"file",component:FileInput,memoized_component:null,example_component:FileInputExample},{name:"image",component:ImageInput,memoized_component:null,example_component:ImageInputExample},{name:"number",component:NumberInput,memoized_component:null,example_component:NumberInputExample},{name:"radio",component:RadioInput,memoized_component:null,example_component:RadioInputExample},{name:"slider",component:SliderInput,memoized_component:null,example_component:SliderInputExample},{name:"textbox",component:TextboxInput,memoized_component:null,example_component:TextboxInputExample},{name:"timeseries",component:TimeseriesInput,memoized_component:null,example_component:TimeseriesInputExample},{name:"video",component:VideoInput,example_component:VideoInputExample}],output_component_set=[{name:"audio",component:AudioOutput,memoized_component:null,example_component:AudioOutputExample},{name:"carousel",component:CarouselOutput,memoized_component:null,example_component:CarouselOutputExample},{name:"dataframe",component:DataframeOutput,memoized_component:null,example_component:DataframeOutputExample},{name:"file",component:FileOutput,memoized_component:null,example_component:FileOutputExample},{name:"highlightedtext",component:HighlightedTextOutput,memoized_component:null,example_component:HighlightedTextOutputExample},{name:"html",component:HTMLOutput,memoized_component:null,example_component:HTMLOutputExample},{name:"image",component:ImageOutput,memoized_component:null,example_component:ImageOutputExample},{name:"json",component:JSONOutput,memoized_component:null,example_component:JSONOutputExample},{name:"keyvalues",component:KeyValuesOutput,memoized_component:null,example_component:KeyValuesOutputExample},{name:"label",component:LabelOutput,memoized_component:null,example_component:LabelOutputExample},{name:"textbox",component:TextboxOutput,memoized_component:null,example_component:TextboxOutputExample},{name:"timeseries",component:TimeseriesOutput,memoized_component:null,example_component:TimeseriesOutputExample},{name:"video",component:VideoOutput,memoized_component:null,example_component:VideoOutputExample}];for(let o of[input_component_set,output_component_set])for(let s of o)s.memoized_component=React.memo(s.component,s.component.memo);__vitePreload(()=>Promise.resolve({}),["assets/base.e4f5dae2.css"]);__vitePreload(()=>Promise.resolve({}),["assets/default.aa9f0da0.css"]);__vitePreload(()=>Promise.resolve({}),["assets/huggingface.015b638f.css"]);__vitePreload(()=>Promise.resolve({}),["assets/seafoam.b1fb20bd.css"]);__vitePreload(()=>Promise.resolve({}),["assets/grass.003b092f.css"]);__vitePreload(()=>Promise.resolve({}),["assets/peach.dfed2a06.css"]);class GradioBaseInterface extends React.Component{constructor(_){super(_);Xn(this,"get_default_state",()=>{let _={};for(let[_e,et]of this.component_list.entries())_[_e]=et.default||null;return _.submitting=!1,_.error=!1,_.complete=!1,_.last_duration=null,_.interpretation=null,_.just_flagged=!1,_.has_changed=!1,_.example_id=null,_.flag_index=null,_.queue_index=null,_.initial_queue_index=null,_});Xn(this,"clear",()=>{this.pending_response=!1,this.setState(this.get_default_state())});Xn(this,"handleChange",(_,_e,et)=>{let it={[_]:_e,has_changed:!0,example_id:et===void 0?null:et};this.props.live&&!this.state.submitting?this.setState(it,this.submit):this.setState(it)});this.state=this.get_default_state(),this.pending_response=!1,this.state.examples_page=0,this.state.avg_duration=Array.isArray(this.props.avg_durations)?this.props.avg_durations[0]:null}}class GradioExamples extends React.Component{constructor(s){super(s),this.state={page:0}}set_page(s){this.setState({page:s})}render(){let s=this.props.examples.slice(),_=this.props.examples.length,_e=_>this.props.examples_per_page,et=1,it=[];return _e&&(s=s.slice(this.state.page*this.props.examples_per_page,(this.state.page+1)*this.props.examples_per_page),et=Math.ceil(_/this.props.examples_per_page),[0,this.state.page,et-1].forEach(tt=>{for(let rt=tt-2;rt<=tt+2;rt++)rt>=0&&rt<et&&!it.includes(rt)&&(it.length>0&&rt-it[it.length-1]>1&&it.push(null),it.push(rt))})),jsxs("div",{className:"examples",children:[jsx("h4",{children:"Examples"}),jsx("div",{className:classNames("examples_table_holder",{gallery:this.props.input_components.length===1}),children:jsxs("table",{className:"examples_table",children:[jsx("thead",{children:jsxs("tr",{children:[this.props.input_components.map((tt,rt)=>jsx("th",{children:tt.label},rt)),this.props.examples[0].length>this.props.input_components.length?this.props.output_components.map((tt,rt)=>jsx("th",{children:tt.label},rt+this.props.input_components.length)):!1]})}),jsx("tbody",{children:s.map((tt,rt)=>{let nt=rt+this.state.page*this.props.examples_per_page;return jsx("tr",{className:classNames({selected:nt===this.props.example_id}),onClick:()=>this.props.handleExampleChange(nt),children:tt.map((ot,st)=>{let at=input_component_set.find(lt=>lt.name===this.props.input_components[st].name).example_component;return jsx("td",{children:jsx(at,{examples_dir:this.props.examples_dir,value:ot},st)})})},nt)})})]})}),_e?jsxs("div",{className:"pages",children:["Pages:",it.map(tt=>tt===null?jsx("div",{children:"..."}):jsx("button",{className:classNames("page",{selected:tt===this.state.page}),onClick:this.set_page.bind(this,tt),children:tt+1},tt))]}):!1]})}}class GradioInputInterface extends GradioBaseInterface{constructor(){super(...arguments);Xn(this,"submit",()=>{let _=[];for(let[et,it]of this.props.input_components.entries()){if(this.state[et]===null&&this.props.input_components[et].optional!==!0)return;let tt=input_component_set.find(rt=>rt.name===it.name).component;_[et]=tt.postprocess(this.state[et])}let _e={data:_};this.setState({submitting:!0,has_changed:!1,error:!1,flag_index:null}),Streamlit.setComponentValue(_e)});Xn(this,"handleExample",_=>{this.setState(Tr(or({},this.props.examples[_]),{example_id:_}))})}get component_list(){return this.props.input_components}render(){return jsxs("div",{className:classNames("panel",{flex:this.props.layout==="horizontal","flex-col":this.props.layout==="horizontal"}),children:[jsx("div",{className:"description",children:"Input"}),jsx("div",{className:"component_set",children:this.props.input_components.map((_,_e)=>{const et=input_component_set.find(it=>it.name===_.name).memoized_component;return jsxs("div",{className:"component",children:[jsx("div",{className:"panel_header",children:_.label}),jsx(et,Tr(or({},_),{handleChange:this.handleChange.bind(this,_e),value:this.state[_e],interpretation:this.state.interpretation===null?null:this.state.interpretation[_e]}),_e)]},_e)})}),jsxs("div",{className:"panel_buttons",children:[jsx("button",{className:"panel_button",onClick:this.clear,children:"Clear"}),this.props.live?!1:jsx("button",{className:"panel_button submit",onClick:this.submit,children:"Submit"})]}),this.props.examples&&jsx(GradioExamples,Tr(or({},this.props),{handleExampleChange:_=>this.handleExample(_)}))]})}}class GradioOutputInterface extends GradioBaseInterface{constructor(_){super(_);Xn(this,"setOutput",()=>{let _=this.props.output;_.error!=null&&console.error("Error:",_.error),_.durations?this.state.last_duration=_.durations[0]:this.state.last_duration=null,_.avg_duration&&(this.state.avg_duration=_.avg_durations[0]);for(let[_e,et]of _.data.entries())this.state[_e]=et;_.flag_index!==null&&(this.state.flag_index=_.flag_index),this.state.submitting=!1,this.state.complete=!0});this.props.output&&this.setOutput()}get component_list(){return this.props.output_components}render(){return jsx(Fragment,{children:jsxs("div",{className:classNames("panel",{flex:this.props.layout==="horizontal","flex-col":this.props.layout==="horizontal"}),children:[jsx("div",{className:"description",children:"Output"}),jsx("div",{className:classNames("component_set","relative",{"opacity-50":this.pending_response&&!this.props.live||this.state.error}),children:this.props.output_components.map((_,_e)=>{const et=output_component_set.find(tt=>tt.name===_.name).memoized_component,it=_e;return this.state[it]===null?!1:jsxs("div",{className:"component",children:[jsx("div",{className:"panel_header",children:_.label}),jsx(et,Tr(or({},_),{handleChange:this.handleChange.bind(this,it),value:this.state[it]}))]},it)})})]})})}}const GradioComponent=o=>{switch(o.componentType){case"input":return jsx(GradioInputInterface,or({},o));case"output":return jsx(GradioOutputInterface,or({},o));default:return"Invalid type"}};class GradioPage extends React.Component{render(){let s=this.props.space!==void 0,_=this.props.space;if(s){let _e=_.indexOf("/");_=_[_e+1].toUpperCase()+_.substring(_e+2)}return jsx("div",{className:"gradio_bg",theme:this.props.theme,is_embedded:s.toString(),children:jsx("div",{className:"gradio_page gradio_interface",children:jsx(GradioComponent,or({},this.props))})})}}class App extends StreamlitComponentBase{constructor(_){super(_);Xn(this,"componentDidUpdate",()=>{});Xn(this,"render",()=>jsx(GradioPage,Tr(or({},this.state.config),{theme:this.state.theme,output:this.state.output})));const _e=_.args.config;_e.selected_example=_.args.selected_example||null;const et=_.args.output||null;if(_e.css!==null){var it=document.head||document.getElementsByTagName("head")[0],tt=document.createElement("style");it.appendChild(tt),tt.appendChild(document.createTextNode(_e.css))}let rt=_e.theme;_e.theme!==null&&_e.theme.startsWith("dark")&&(document.documentElement.add("dark"),_e.theme==="dark"?rt="default":rt=_e.theme.substring(5)),window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&document.documentElement.classList.add("dark"),this.state={config:_e,output:et,theme:rt}}}const resizeObserver=new ResizeObserver(o=>{Streamlit.setFrameHeight(o[0].contentRect.height)});resizeObserver.observe(document.documentElement);const StApp=withStreamlitConnection(App);ReactDOM.render(jsx(React.StrictMode,{children:jsx(StApp,{})}),document.getElementById("root"));
