@netless/appliance-plugin 1.1.23 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/cdn.js +1 -1
- package/cdn/{fullWorker-ZK5NZY.js → fullWorker-CvY8jJ.js} +19 -19
- package/cdn/{subWorker-BiAuBO.js → subWorker-BXxVx2.js} +19 -19
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/fullWorker.js +19 -19
- package/dist/{index-KFAuNRB0.mjs → index-B0SzWigt.mjs} +2 -2
- package/dist/{index-ANWwhC4x.mjs → index-BH_o7eOU.mjs} +1 -1
- package/dist/{index-CWK75u1P.js → index-CQhmRvRP.js} +1 -1
- package/dist/{index-BVb1IYUU.js → index-D1N3tpY5.js} +1 -1
- package/dist/subWorker.js +19 -19
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded=["toolsType"],_excluded2=["callback"],_excluded3=["render"],_excluded4=["render"];function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)o=s[r],t.includes(o)||{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.includes(n))continue;t[n]=r[n];}return t;}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _superPropSet(t,e,o,r,p,f){return _set(_getPrototypeOf(f?t.prototype:t),e,o,r,p);}function set(e,r,t,o){return set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,r,t,o){var f,i=_superPropBase(e,r);if(i){if((f=Object.getOwnPropertyDescriptor(i,r)).set)return f.set.call(o,t),!0;if(!f.writable)return!1;}if(f=Object.getOwnPropertyDescriptor(o,r)){if(!f.writable)return!1;f.value=t,Object.defineProperty(o,r,f);}else _defineProperty(o,r,t);return!0;},set(e,r,t,o);}function _set(e,r,t,o,f){if(!set(e,r,t,o||e)&&f)throw new TypeError("failed to set property");return t;}function _wrapNativeSuper(t){var r="function"==typeof Map?new Map():void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper);}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor);}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t);},_wrapNativeSuper(t);}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o))();return r&&_setPrototypeOf(p,r.prototype),p;}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]");}catch(n){return"function"==typeof t;}}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _toArray(r){return _arrayWithHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableRest();}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n8=0,F=function F(){};return{s:F,n:function n(){return _n8>=r.length?{done:!0}:{done:!1,value:r[_n8++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _asyncIterator(r){var n,t,o,e=2;for("undefined"!=typeof Symbol&&(t=Symbol.asyncIterator,o=Symbol.iterator);e--;){if(t&&null!=(n=r[t]))return n.call(r);if(o&&null!=(n=r[o]))return new AsyncFromSyncIterator(n.call(r));t="@@asyncIterator",o="@@iterator";}throw new TypeError("Object is not async iterable");}function AsyncFromSyncIterator(r){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var n=r.done;return Promise.resolve(r.value).then(function(r){return{value:r,done:n};});}return AsyncFromSyncIterator=function AsyncFromSyncIterator(r){this.s=r,this.n=r.next;},AsyncFromSyncIterator.prototype={s:null,n:null,next:function next(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments));},"return":function _return(r){var n=this.s["return"];return void 0===n?Promise.resolve({value:r,done:!0}):AsyncFromSyncIteratorContinuation(n.apply(this.s,arguments));},"throw":function _throw(r){var n=this.s["return"];return void 0===n?Promise.reject(r):AsyncFromSyncIteratorContinuation(n.apply(this.s,arguments));}},new AsyncFromSyncIterator(r);}var Jy=Object.defineProperty;var Qy=function Qy(i,e,t){return e in i?Jy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;};var dt=function dt(i,e,t){return Qy(i,_typeof(e)!="symbol"?e+"":e,t);};var be=/******/function(i){var e={};function t(r){if(e[r])return e[r].exports;var n=e[r]={/******/i:r,/******/l:!1,/******/exports:{}/******/};return i[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports;}return t.m=i,t.c=e,t.d=function(r,n,s){t.o(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:s});},t.r=function(r){(typeof Symbol==="undefined"?"undefined":_typeof(Symbol))<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0});},t.t=function(r,n){if(n&1&&(r=t(r)),n&8||n&4&&_typeof(r)=="object"&&r&&r.__esModule)return r;var s=/* @__PURE__ */Object.create(null);if(t.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:r}),n&2&&typeof r!="string")for(var c in r)t.d(s,c,function(l){return r[l];}.bind(null,c));return s;},t.n=function(r){var n=r&&r.__esModule?(/******/function(){return r["default"];}):(/******/function(){return r;});return t.d(n,"a",n),n;},t.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n);},t.p="/js/",t(t.s=0);}([/* 0 *//***/function(i,e,t){t.r(e),t.d(e,"version",function(){return tt;}),t.d(e,"helpers",function(){return G;}),t.d(e,"createElement",function(){return Y;}),t.d(e,"isSpriteNode",function(){return B;}),t.d(e,"registerNode",function(){return N;});var r=t(12);t.d(e,"ENV",function(){return r.ENV;});var n=t(68);t.d(e,"requestAnimationFrame",function(){return n.requestAnimationFrame;}),t.d(e,"cancelAnimationFrame",function(){return n.cancelAnimationFrame;});var s=t(70);t.d(e,"Node",function(){return s["default"];});var c=t(217);t.d(e,"Cloud",function(){return c["default"];});var l=t(219);t.d(e,"Block",function(){return l["default"];});var f=t(224);t.d(e,"Sprite",function(){return f["default"];});var h=t(226);t.d(e,"Path",function(){return h["default"];});var m=t(229);t.d(e,"Rect",function(){return m["default"];});var u=t(231);t.d(e,"Triangle",function(){return u["default"];});var y=t(236);t.d(e,"Parallel",function(){return y["default"];});var T=t(238);t.d(e,"Regular",function(){return T["default"];});var E=t(240);t.d(e,"Star",function(){return E["default"];});var C=t(242);t.d(e,"Ellipse",function(){return C["default"];});var x=t(244);t.d(e,"Arc",function(){return x["default"];});var I=t(246);t.d(e,"Ring",function(){return I["default"];});var d=t(232);t.d(e,"Polyline",function(){return d["default"];});var v=t(248);t.d(e,"Label",function(){return v["default"];});var p=t(250);t.d(e,"Group",function(){return p["default"];});var S=t(286);t.d(e,"Layer",function(){return S["default"];});var A=t(287);t.d(e,"SpriteSvg",function(){return A["default"];});var R=t(289);t.d(e,"LayerWorker",function(){return R["default"];});var D=t(290);t.d(e,"Scene",function(){return D["default"];});var U=t(213),M=t(221);t.d(e,"Color",function(){return M.Color;}),t.d(e,"Gradient",function(){return M.Gradient;});var W=t(72);t(1).glMatrix.setMatrixArrayType(Array);var Y=U["default"].createElement,B=U["default"].isSpriteNode,N=U["default"].registerNode,G={parseColor:M.parseColor,sizeToPixel:W.sizeToPixel,toArray:W.toArray,toString:W.toString,toNumber:W.toNumber};var J;J="3.8.3";var tt=J;},/* 1 *//***/function(i,e,t){t.r(e);var r=t(2);t.d(e,"glMatrix",function(){return r;});var n=t(3);t.d(e,"mat2",function(){return n;});var s=t(4);t.d(e,"mat2d",function(){return s;});var c=t(5);t.d(e,"mat3",function(){return c;});var l=t(6);t.d(e,"mat4",function(){return l;});var f=t(7);t.d(e,"quat",function(){return f;});var h=t(10);t.d(e,"quat2",function(){return h;});var m=t(11);t.d(e,"vec2",function(){return m;});var u=t(8);t.d(e,"vec3",function(){return u;});var y=t(9);t.d(e,"vec4",function(){return y;});},/* 2 *//***/function(i,e,t){t.r(e),t.d(e,"EPSILON",function(){return r;}),t.d(e,"ARRAY_TYPE",function(){return n;}),t.d(e,"RANDOM",function(){return s;}),t.d(e,"setMatrixArrayType",function(){return c;}),t.d(e,"toRadian",function(){return f;}),t.d(e,"equals",function(){return h;});var r=1e-6,n=(typeof Float32Array==="undefined"?"undefined":_typeof(Float32Array))<"u"?Float32Array:Array,s=Math.random;function c(m){n=m;}var l=Math.PI/180;function f(m){return m*l;}function h(m,u){return Math.abs(m-u)<=r*Math.max(1,Math.abs(m),Math.abs(u));}Math.hypot||(Math.hypot=function(){for(var m=0,u=arguments.length;u--;)m+=arguments[u]*arguments[u];return Math.sqrt(m);});},/* 3 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"copy",function(){return c;}),t.d(e,"identity",function(){return l;}),t.d(e,"fromValues",function(){return f;}),t.d(e,"set",function(){return h;}),t.d(e,"transpose",function(){return m;}),t.d(e,"invert",function(){return u;}),t.d(e,"adjoint",function(){return y;}),t.d(e,"determinant",function(){return T;}),t.d(e,"multiply",function(){return E;}),t.d(e,"rotate",function(){return C;}),t.d(e,"scale",function(){return x;}),t.d(e,"fromRotation",function(){return I;}),t.d(e,"fromScaling",function(){return d;}),t.d(e,"str",function(){return v;}),t.d(e,"frob",function(){return p;}),t.d(e,"LDU",function(){return S;}),t.d(e,"add",function(){return A;}),t.d(e,"subtract",function(){return R;}),t.d(e,"exactEquals",function(){return D;}),t.d(e,"equals",function(){return U;}),t.d(e,"multiplyScalar",function(){return M;}),t.d(e,"multiplyScalarAndAdd",function(){return W;}),t.d(e,"mul",function(){return Y;}),t.d(e,"sub",function(){return B;});var r=t(2);function n(){var N=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(N[1]=0,N[2]=0),N[0]=1,N[3]=1,N;}function s(N){var G=new r.ARRAY_TYPE(4);return G[0]=N[0],G[1]=N[1],G[2]=N[2],G[3]=N[3],G;}function c(N,G){return N[0]=G[0],N[1]=G[1],N[2]=G[2],N[3]=G[3],N;}function l(N){return N[0]=1,N[1]=0,N[2]=0,N[3]=1,N;}function f(N,G,J,tt){var at=new r.ARRAY_TYPE(4);return at[0]=N,at[1]=G,at[2]=J,at[3]=tt,at;}function h(N,G,J,tt,at){return N[0]=G,N[1]=J,N[2]=tt,N[3]=at,N;}function m(N,G){if(N===G){var J=G[1];N[1]=G[2],N[2]=J;}else N[0]=G[0],N[1]=G[2],N[2]=G[1],N[3]=G[3];return N;}function u(N,G){var J=G[0],tt=G[1],at=G[2],ut=G[3],K=J*ut-at*tt;return K?(K=1/K,N[0]=ut*K,N[1]=-tt*K,N[2]=-at*K,N[3]=J*K,N):null;}function y(N,G){var J=G[0];return N[0]=G[3],N[1]=-G[1],N[2]=-G[2],N[3]=J,N;}function T(N){return N[0]*N[3]-N[2]*N[1];}function E(N,G,J){var tt=G[0],at=G[1],ut=G[2],K=G[3],Q=J[0],ft=J[1],gt=J[2],mt=J[3];return N[0]=tt*Q+ut*ft,N[1]=at*Q+K*ft,N[2]=tt*gt+ut*mt,N[3]=at*gt+K*mt,N;}function C(N,G,J){var tt=G[0],at=G[1],ut=G[2],K=G[3],Q=Math.sin(J),ft=Math.cos(J);return N[0]=tt*ft+ut*Q,N[1]=at*ft+K*Q,N[2]=tt*-Q+ut*ft,N[3]=at*-Q+K*ft,N;}function x(N,G,J){var tt=G[0],at=G[1],ut=G[2],K=G[3],Q=J[0],ft=J[1];return N[0]=tt*Q,N[1]=at*Q,N[2]=ut*ft,N[3]=K*ft,N;}function I(N,G){var J=Math.sin(G),tt=Math.cos(G);return N[0]=tt,N[1]=J,N[2]=-J,N[3]=tt,N;}function d(N,G){return N[0]=G[0],N[1]=0,N[2]=0,N[3]=G[1],N;}function v(N){return"mat2("+N[0]+", "+N[1]+", "+N[2]+", "+N[3]+")";}function p(N){return Math.hypot(N[0],N[1],N[2],N[3]);}function S(N,G,J,tt){return N[2]=tt[2]/tt[0],J[0]=tt[0],J[1]=tt[1],J[3]=tt[3]-N[2]*J[1],[N,G,J];}function A(N,G,J){return N[0]=G[0]+J[0],N[1]=G[1]+J[1],N[2]=G[2]+J[2],N[3]=G[3]+J[3],N;}function R(N,G,J){return N[0]=G[0]-J[0],N[1]=G[1]-J[1],N[2]=G[2]-J[2],N[3]=G[3]-J[3],N;}function D(N,G){return N[0]===G[0]&&N[1]===G[1]&&N[2]===G[2]&&N[3]===G[3];}function U(N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=G[0],Q=G[1],ft=G[2],gt=G[3];return Math.abs(J-K)<=r.EPSILON*Math.max(1,Math.abs(J),Math.abs(K))&&Math.abs(tt-Q)<=r.EPSILON*Math.max(1,Math.abs(tt),Math.abs(Q))&&Math.abs(at-ft)<=r.EPSILON*Math.max(1,Math.abs(at),Math.abs(ft))&&Math.abs(ut-gt)<=r.EPSILON*Math.max(1,Math.abs(ut),Math.abs(gt));}function M(N,G,J){return N[0]=G[0]*J,N[1]=G[1]*J,N[2]=G[2]*J,N[3]=G[3]*J,N;}function W(N,G,J,tt){return N[0]=G[0]+J[0]*tt,N[1]=G[1]+J[1]*tt,N[2]=G[2]+J[2]*tt,N[3]=G[3]+J[3]*tt,N;}var Y=E,B=R;},/* 4 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"copy",function(){return c;}),t.d(e,"identity",function(){return l;}),t.d(e,"fromValues",function(){return f;}),t.d(e,"set",function(){return h;}),t.d(e,"invert",function(){return m;}),t.d(e,"determinant",function(){return u;}),t.d(e,"multiply",function(){return y;}),t.d(e,"rotate",function(){return T;}),t.d(e,"scale",function(){return E;}),t.d(e,"translate",function(){return C;}),t.d(e,"fromRotation",function(){return x;}),t.d(e,"fromScaling",function(){return I;}),t.d(e,"fromTranslation",function(){return d;}),t.d(e,"str",function(){return v;}),t.d(e,"frob",function(){return p;}),t.d(e,"add",function(){return S;}),t.d(e,"subtract",function(){return A;}),t.d(e,"multiplyScalar",function(){return R;}),t.d(e,"multiplyScalarAndAdd",function(){return D;}),t.d(e,"exactEquals",function(){return U;}),t.d(e,"equals",function(){return M;}),t.d(e,"mul",function(){return W;}),t.d(e,"sub",function(){return Y;});var r=t(2);function n(){var B=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(B[1]=0,B[2]=0,B[4]=0,B[5]=0),B[0]=1,B[3]=1,B;}function s(B){var N=new r.ARRAY_TYPE(6);return N[0]=B[0],N[1]=B[1],N[2]=B[2],N[3]=B[3],N[4]=B[4],N[5]=B[5],N;}function c(B,N){return B[0]=N[0],B[1]=N[1],B[2]=N[2],B[3]=N[3],B[4]=N[4],B[5]=N[5],B;}function l(B){return B[0]=1,B[1]=0,B[2]=0,B[3]=1,B[4]=0,B[5]=0,B;}function f(B,N,G,J,tt,at){var ut=new r.ARRAY_TYPE(6);return ut[0]=B,ut[1]=N,ut[2]=G,ut[3]=J,ut[4]=tt,ut[5]=at,ut;}function h(B,N,G,J,tt,at,ut){return B[0]=N,B[1]=G,B[2]=J,B[3]=tt,B[4]=at,B[5]=ut,B;}function m(B,N){var G=N[0],J=N[1],tt=N[2],at=N[3],ut=N[4],K=N[5],Q=G*at-J*tt;return Q?(Q=1/Q,B[0]=at*Q,B[1]=-J*Q,B[2]=-tt*Q,B[3]=G*Q,B[4]=(tt*K-at*ut)*Q,B[5]=(J*ut-G*K)*Q,B):null;}function u(B){return B[0]*B[3]-B[1]*B[2];}function y(B,N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=N[4],Q=N[5],ft=G[0],gt=G[1],mt=G[2],wt=G[3],ht=G[4],Nt=G[5];return B[0]=J*ft+at*gt,B[1]=tt*ft+ut*gt,B[2]=J*mt+at*wt,B[3]=tt*mt+ut*wt,B[4]=J*ht+at*Nt+K,B[5]=tt*ht+ut*Nt+Q,B;}function T(B,N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=N[4],Q=N[5],ft=Math.sin(G),gt=Math.cos(G);return B[0]=J*gt+at*ft,B[1]=tt*gt+ut*ft,B[2]=J*-ft+at*gt,B[3]=tt*-ft+ut*gt,B[4]=K,B[5]=Q,B;}function E(B,N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=N[4],Q=N[5],ft=G[0],gt=G[1];return B[0]=J*ft,B[1]=tt*ft,B[2]=at*gt,B[3]=ut*gt,B[4]=K,B[5]=Q,B;}function C(B,N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=N[4],Q=N[5],ft=G[0],gt=G[1];return B[0]=J,B[1]=tt,B[2]=at,B[3]=ut,B[4]=J*ft+at*gt+K,B[5]=tt*ft+ut*gt+Q,B;}function x(B,N){var G=Math.sin(N),J=Math.cos(N);return B[0]=J,B[1]=G,B[2]=-G,B[3]=J,B[4]=0,B[5]=0,B;}function I(B,N){return B[0]=N[0],B[1]=0,B[2]=0,B[3]=N[1],B[4]=0,B[5]=0,B;}function d(B,N){return B[0]=1,B[1]=0,B[2]=0,B[3]=1,B[4]=N[0],B[5]=N[1],B;}function v(B){return"mat2d("+B[0]+", "+B[1]+", "+B[2]+", "+B[3]+", "+B[4]+", "+B[5]+")";}function p(B){return Math.hypot(B[0],B[1],B[2],B[3],B[4],B[5],1);}function S(B,N,G){return B[0]=N[0]+G[0],B[1]=N[1]+G[1],B[2]=N[2]+G[2],B[3]=N[3]+G[3],B[4]=N[4]+G[4],B[5]=N[5]+G[5],B;}function A(B,N,G){return B[0]=N[0]-G[0],B[1]=N[1]-G[1],B[2]=N[2]-G[2],B[3]=N[3]-G[3],B[4]=N[4]-G[4],B[5]=N[5]-G[5],B;}function R(B,N,G){return B[0]=N[0]*G,B[1]=N[1]*G,B[2]=N[2]*G,B[3]=N[3]*G,B[4]=N[4]*G,B[5]=N[5]*G,B;}function D(B,N,G,J){return B[0]=N[0]+G[0]*J,B[1]=N[1]+G[1]*J,B[2]=N[2]+G[2]*J,B[3]=N[3]+G[3]*J,B[4]=N[4]+G[4]*J,B[5]=N[5]+G[5]*J,B;}function U(B,N){return B[0]===N[0]&&B[1]===N[1]&&B[2]===N[2]&&B[3]===N[3]&&B[4]===N[4]&&B[5]===N[5];}function M(B,N){var G=B[0],J=B[1],tt=B[2],at=B[3],ut=B[4],K=B[5],Q=N[0],ft=N[1],gt=N[2],mt=N[3],wt=N[4],ht=N[5];return Math.abs(G-Q)<=r.EPSILON*Math.max(1,Math.abs(G),Math.abs(Q))&&Math.abs(J-ft)<=r.EPSILON*Math.max(1,Math.abs(J),Math.abs(ft))&&Math.abs(tt-gt)<=r.EPSILON*Math.max(1,Math.abs(tt),Math.abs(gt))&&Math.abs(at-mt)<=r.EPSILON*Math.max(1,Math.abs(at),Math.abs(mt))&&Math.abs(ut-wt)<=r.EPSILON*Math.max(1,Math.abs(ut),Math.abs(wt))&&Math.abs(K-ht)<=r.EPSILON*Math.max(1,Math.abs(K),Math.abs(ht));}var W=y,Y=A;},/* 5 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"fromMat4",function(){return s;}),t.d(e,"clone",function(){return c;}),t.d(e,"copy",function(){return l;}),t.d(e,"fromValues",function(){return f;}),t.d(e,"set",function(){return h;}),t.d(e,"identity",function(){return m;}),t.d(e,"transpose",function(){return u;}),t.d(e,"invert",function(){return y;}),t.d(e,"adjoint",function(){return T;}),t.d(e,"determinant",function(){return E;}),t.d(e,"multiply",function(){return C;}),t.d(e,"translate",function(){return x;}),t.d(e,"rotate",function(){return I;}),t.d(e,"scale",function(){return d;}),t.d(e,"fromTranslation",function(){return v;}),t.d(e,"fromRotation",function(){return p;}),t.d(e,"fromScaling",function(){return S;}),t.d(e,"fromMat2d",function(){return A;}),t.d(e,"fromQuat",function(){return R;}),t.d(e,"normalFromMat4",function(){return D;}),t.d(e,"projection",function(){return U;}),t.d(e,"str",function(){return M;}),t.d(e,"frob",function(){return W;}),t.d(e,"add",function(){return Y;}),t.d(e,"subtract",function(){return B;}),t.d(e,"multiplyScalar",function(){return N;}),t.d(e,"multiplyScalarAndAdd",function(){return G;}),t.d(e,"exactEquals",function(){return J;}),t.d(e,"equals",function(){return tt;}),t.d(e,"mul",function(){return at;}),t.d(e,"sub",function(){return ut;});var r=t(2);function n(){var K=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(K[1]=0,K[2]=0,K[3]=0,K[5]=0,K[6]=0,K[7]=0),K[0]=1,K[4]=1,K[8]=1,K;}function s(K,Q){return K[0]=Q[0],K[1]=Q[1],K[2]=Q[2],K[3]=Q[4],K[4]=Q[5],K[5]=Q[6],K[6]=Q[8],K[7]=Q[9],K[8]=Q[10],K;}function c(K){var Q=new r.ARRAY_TYPE(9);return Q[0]=K[0],Q[1]=K[1],Q[2]=K[2],Q[3]=K[3],Q[4]=K[4],Q[5]=K[5],Q[6]=K[6],Q[7]=K[7],Q[8]=K[8],Q;}function l(K,Q){return K[0]=Q[0],K[1]=Q[1],K[2]=Q[2],K[3]=Q[3],K[4]=Q[4],K[5]=Q[5],K[6]=Q[6],K[7]=Q[7],K[8]=Q[8],K;}function f(K,Q,ft,gt,mt,wt,ht,Nt,Rt){var X=new r.ARRAY_TYPE(9);return X[0]=K,X[1]=Q,X[2]=ft,X[3]=gt,X[4]=mt,X[5]=wt,X[6]=ht,X[7]=Nt,X[8]=Rt,X;}function h(K,Q,ft,gt,mt,wt,ht,Nt,Rt,X){return K[0]=Q,K[1]=ft,K[2]=gt,K[3]=mt,K[4]=wt,K[5]=ht,K[6]=Nt,K[7]=Rt,K[8]=X,K;}function m(K){return K[0]=1,K[1]=0,K[2]=0,K[3]=0,K[4]=1,K[5]=0,K[6]=0,K[7]=0,K[8]=1,K;}function u(K,Q){if(K===Q){var ft=Q[1],gt=Q[2],mt=Q[5];K[1]=Q[3],K[2]=Q[6],K[3]=ft,K[5]=Q[7],K[6]=gt,K[7]=mt;}else K[0]=Q[0],K[1]=Q[3],K[2]=Q[6],K[3]=Q[1],K[4]=Q[4],K[5]=Q[7],K[6]=Q[2],K[7]=Q[5],K[8]=Q[8];return K;}function y(K,Q){var ft=Q[0],gt=Q[1],mt=Q[2],wt=Q[3],ht=Q[4],Nt=Q[5],Rt=Q[6],X=Q[7],z=Q[8],q=z*ht-Nt*X,nt=-z*wt+Nt*Rt,j=X*wt-ht*Rt,Z=ft*q+gt*nt+mt*j;return Z?(Z=1/Z,K[0]=q*Z,K[1]=(-z*gt+mt*X)*Z,K[2]=(Nt*gt-mt*ht)*Z,K[3]=nt*Z,K[4]=(z*ft-mt*Rt)*Z,K[5]=(-Nt*ft+mt*wt)*Z,K[6]=j*Z,K[7]=(-X*ft+gt*Rt)*Z,K[8]=(ht*ft-gt*wt)*Z,K):null;}function T(K,Q){var ft=Q[0],gt=Q[1],mt=Q[2],wt=Q[3],ht=Q[4],Nt=Q[5],Rt=Q[6],X=Q[7],z=Q[8];return K[0]=ht*z-Nt*X,K[1]=mt*X-gt*z,K[2]=gt*Nt-mt*ht,K[3]=Nt*Rt-wt*z,K[4]=ft*z-mt*Rt,K[5]=mt*wt-ft*Nt,K[6]=wt*X-ht*Rt,K[7]=gt*Rt-ft*X,K[8]=ft*ht-gt*wt,K;}function E(K){var Q=K[0],ft=K[1],gt=K[2],mt=K[3],wt=K[4],ht=K[5],Nt=K[6],Rt=K[7],X=K[8];return Q*(X*wt-ht*Rt)+ft*(-X*mt+ht*Nt)+gt*(Rt*mt-wt*Nt);}function C(K,Q,ft){var gt=Q[0],mt=Q[1],wt=Q[2],ht=Q[3],Nt=Q[4],Rt=Q[5],X=Q[6],z=Q[7],q=Q[8],nt=ft[0],j=ft[1],Z=ft[2],O=ft[3],L=ft[4],$=ft[5],V=ft[6],rt=ft[7],it=ft[8];return K[0]=nt*gt+j*ht+Z*X,K[1]=nt*mt+j*Nt+Z*z,K[2]=nt*wt+j*Rt+Z*q,K[3]=O*gt+L*ht+$*X,K[4]=O*mt+L*Nt+$*z,K[5]=O*wt+L*Rt+$*q,K[6]=V*gt+rt*ht+it*X,K[7]=V*mt+rt*Nt+it*z,K[8]=V*wt+rt*Rt+it*q,K;}function x(K,Q,ft){var gt=Q[0],mt=Q[1],wt=Q[2],ht=Q[3],Nt=Q[4],Rt=Q[5],X=Q[6],z=Q[7],q=Q[8],nt=ft[0],j=ft[1];return K[0]=gt,K[1]=mt,K[2]=wt,K[3]=ht,K[4]=Nt,K[5]=Rt,K[6]=nt*gt+j*ht+X,K[7]=nt*mt+j*Nt+z,K[8]=nt*wt+j*Rt+q,K;}function I(K,Q,ft){var gt=Q[0],mt=Q[1],wt=Q[2],ht=Q[3],Nt=Q[4],Rt=Q[5],X=Q[6],z=Q[7],q=Q[8],nt=Math.sin(ft),j=Math.cos(ft);return K[0]=j*gt+nt*ht,K[1]=j*mt+nt*Nt,K[2]=j*wt+nt*Rt,K[3]=j*ht-nt*gt,K[4]=j*Nt-nt*mt,K[5]=j*Rt-nt*wt,K[6]=X,K[7]=z,K[8]=q,K;}function d(K,Q,ft){var gt=ft[0],mt=ft[1];return K[0]=gt*Q[0],K[1]=gt*Q[1],K[2]=gt*Q[2],K[3]=mt*Q[3],K[4]=mt*Q[4],K[5]=mt*Q[5],K[6]=Q[6],K[7]=Q[7],K[8]=Q[8],K;}function v(K,Q){return K[0]=1,K[1]=0,K[2]=0,K[3]=0,K[4]=1,K[5]=0,K[6]=Q[0],K[7]=Q[1],K[8]=1,K;}function p(K,Q){var ft=Math.sin(Q),gt=Math.cos(Q);return K[0]=gt,K[1]=ft,K[2]=0,K[3]=-ft,K[4]=gt,K[5]=0,K[6]=0,K[7]=0,K[8]=1,K;}function S(K,Q){return K[0]=Q[0],K[1]=0,K[2]=0,K[3]=0,K[4]=Q[1],K[5]=0,K[6]=0,K[7]=0,K[8]=1,K;}function A(K,Q){return K[0]=Q[0],K[1]=Q[1],K[2]=0,K[3]=Q[2],K[4]=Q[3],K[5]=0,K[6]=Q[4],K[7]=Q[5],K[8]=1,K;}function R(K,Q){var ft=Q[0],gt=Q[1],mt=Q[2],wt=Q[3],ht=ft+ft,Nt=gt+gt,Rt=mt+mt,X=ft*ht,z=gt*ht,q=gt*Nt,nt=mt*ht,j=mt*Nt,Z=mt*Rt,O=wt*ht,L=wt*Nt,$=wt*Rt;return K[0]=1-q-Z,K[3]=z-$,K[6]=nt+L,K[1]=z+$,K[4]=1-X-Z,K[7]=j-O,K[2]=nt-L,K[5]=j+O,K[8]=1-X-q,K;}function D(K,Q){var ft=Q[0],gt=Q[1],mt=Q[2],wt=Q[3],ht=Q[4],Nt=Q[5],Rt=Q[6],X=Q[7],z=Q[8],q=Q[9],nt=Q[10],j=Q[11],Z=Q[12],O=Q[13],L=Q[14],$=Q[15],V=ft*Nt-gt*ht,rt=ft*Rt-mt*ht,it=ft*X-wt*ht,ct=gt*Rt-mt*Nt,St=gt*X-wt*Nt,Ct=mt*X-wt*Rt,Mt=z*O-q*Z,Dt=z*L-nt*Z,At=z*$-j*Z,Ot=q*L-nt*O,Lt=q*$-j*O,Yt=nt*$-j*L,zt=V*Yt-rt*Lt+it*Ot+ct*At-St*Dt+Ct*Mt;return zt?(zt=1/zt,K[0]=(Nt*Yt-Rt*Lt+X*Ot)*zt,K[1]=(Rt*At-ht*Yt-X*Dt)*zt,K[2]=(ht*Lt-Nt*At+X*Mt)*zt,K[3]=(mt*Lt-gt*Yt-wt*Ot)*zt,K[4]=(ft*Yt-mt*At+wt*Dt)*zt,K[5]=(gt*At-ft*Lt-wt*Mt)*zt,K[6]=(O*Ct-L*St+$*ct)*zt,K[7]=(L*it-Z*Ct-$*rt)*zt,K[8]=(Z*St-O*it+$*V)*zt,K):null;}function U(K,Q,ft){return K[0]=2/Q,K[1]=0,K[2]=0,K[3]=0,K[4]=-2/ft,K[5]=0,K[6]=-1,K[7]=1,K[8]=1,K;}function M(K){return"mat3("+K[0]+", "+K[1]+", "+K[2]+", "+K[3]+", "+K[4]+", "+K[5]+", "+K[6]+", "+K[7]+", "+K[8]+")";}function W(K){return Math.hypot(K[0],K[1],K[2],K[3],K[4],K[5],K[6],K[7],K[8]);}function Y(K,Q,ft){return K[0]=Q[0]+ft[0],K[1]=Q[1]+ft[1],K[2]=Q[2]+ft[2],K[3]=Q[3]+ft[3],K[4]=Q[4]+ft[4],K[5]=Q[5]+ft[5],K[6]=Q[6]+ft[6],K[7]=Q[7]+ft[7],K[8]=Q[8]+ft[8],K;}function B(K,Q,ft){return K[0]=Q[0]-ft[0],K[1]=Q[1]-ft[1],K[2]=Q[2]-ft[2],K[3]=Q[3]-ft[3],K[4]=Q[4]-ft[4],K[5]=Q[5]-ft[5],K[6]=Q[6]-ft[6],K[7]=Q[7]-ft[7],K[8]=Q[8]-ft[8],K;}function N(K,Q,ft){return K[0]=Q[0]*ft,K[1]=Q[1]*ft,K[2]=Q[2]*ft,K[3]=Q[3]*ft,K[4]=Q[4]*ft,K[5]=Q[5]*ft,K[6]=Q[6]*ft,K[7]=Q[7]*ft,K[8]=Q[8]*ft,K;}function G(K,Q,ft,gt){return K[0]=Q[0]+ft[0]*gt,K[1]=Q[1]+ft[1]*gt,K[2]=Q[2]+ft[2]*gt,K[3]=Q[3]+ft[3]*gt,K[4]=Q[4]+ft[4]*gt,K[5]=Q[5]+ft[5]*gt,K[6]=Q[6]+ft[6]*gt,K[7]=Q[7]+ft[7]*gt,K[8]=Q[8]+ft[8]*gt,K;}function J(K,Q){return K[0]===Q[0]&&K[1]===Q[1]&&K[2]===Q[2]&&K[3]===Q[3]&&K[4]===Q[4]&&K[5]===Q[5]&&K[6]===Q[6]&&K[7]===Q[7]&&K[8]===Q[8];}function tt(K,Q){var ft=K[0],gt=K[1],mt=K[2],wt=K[3],ht=K[4],Nt=K[5],Rt=K[6],X=K[7],z=K[8],q=Q[0],nt=Q[1],j=Q[2],Z=Q[3],O=Q[4],L=Q[5],$=Q[6],V=Q[7],rt=Q[8];return Math.abs(ft-q)<=r.EPSILON*Math.max(1,Math.abs(ft),Math.abs(q))&&Math.abs(gt-nt)<=r.EPSILON*Math.max(1,Math.abs(gt),Math.abs(nt))&&Math.abs(mt-j)<=r.EPSILON*Math.max(1,Math.abs(mt),Math.abs(j))&&Math.abs(wt-Z)<=r.EPSILON*Math.max(1,Math.abs(wt),Math.abs(Z))&&Math.abs(ht-O)<=r.EPSILON*Math.max(1,Math.abs(ht),Math.abs(O))&&Math.abs(Nt-L)<=r.EPSILON*Math.max(1,Math.abs(Nt),Math.abs(L))&&Math.abs(Rt-$)<=r.EPSILON*Math.max(1,Math.abs(Rt),Math.abs($))&&Math.abs(X-V)<=r.EPSILON*Math.max(1,Math.abs(X),Math.abs(V))&&Math.abs(z-rt)<=r.EPSILON*Math.max(1,Math.abs(z),Math.abs(rt));}var at=C,ut=B;},/* 6 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"copy",function(){return c;}),t.d(e,"fromValues",function(){return l;}),t.d(e,"set",function(){return f;}),t.d(e,"identity",function(){return h;}),t.d(e,"transpose",function(){return m;}),t.d(e,"invert",function(){return u;}),t.d(e,"adjoint",function(){return y;}),t.d(e,"determinant",function(){return T;}),t.d(e,"multiply",function(){return E;}),t.d(e,"translate",function(){return C;}),t.d(e,"scale",function(){return x;}),t.d(e,"rotate",function(){return I;}),t.d(e,"rotateX",function(){return d;}),t.d(e,"rotateY",function(){return v;}),t.d(e,"rotateZ",function(){return p;}),t.d(e,"fromTranslation",function(){return S;}),t.d(e,"fromScaling",function(){return A;}),t.d(e,"fromRotation",function(){return R;}),t.d(e,"fromXRotation",function(){return D;}),t.d(e,"fromYRotation",function(){return U;}),t.d(e,"fromZRotation",function(){return M;}),t.d(e,"fromRotationTranslation",function(){return W;}),t.d(e,"fromQuat2",function(){return Y;}),t.d(e,"getTranslation",function(){return B;}),t.d(e,"getScaling",function(){return N;}),t.d(e,"getRotation",function(){return G;}),t.d(e,"fromRotationTranslationScale",function(){return J;}),t.d(e,"fromRotationTranslationScaleOrigin",function(){return tt;}),t.d(e,"fromQuat",function(){return at;}),t.d(e,"frustum",function(){return ut;}),t.d(e,"perspective",function(){return K;}),t.d(e,"perspectiveFromFieldOfView",function(){return Q;}),t.d(e,"ortho",function(){return ft;}),t.d(e,"lookAt",function(){return gt;}),t.d(e,"targetTo",function(){return mt;}),t.d(e,"str",function(){return wt;}),t.d(e,"frob",function(){return ht;}),t.d(e,"add",function(){return Nt;}),t.d(e,"subtract",function(){return Rt;}),t.d(e,"multiplyScalar",function(){return X;}),t.d(e,"multiplyScalarAndAdd",function(){return z;}),t.d(e,"exactEquals",function(){return q;}),t.d(e,"equals",function(){return nt;}),t.d(e,"mul",function(){return j;}),t.d(e,"sub",function(){return Z;});var r=t(2);function n(){var O=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[11]=0,O[12]=0,O[13]=0,O[14]=0),O[0]=1,O[5]=1,O[10]=1,O[15]=1,O;}function s(O){var L=new r.ARRAY_TYPE(16);return L[0]=O[0],L[1]=O[1],L[2]=O[2],L[3]=O[3],L[4]=O[4],L[5]=O[5],L[6]=O[6],L[7]=O[7],L[8]=O[8],L[9]=O[9],L[10]=O[10],L[11]=O[11],L[12]=O[12],L[13]=O[13],L[14]=O[14],L[15]=O[15],L;}function c(O,L){return O[0]=L[0],O[1]=L[1],O[2]=L[2],O[3]=L[3],O[4]=L[4],O[5]=L[5],O[6]=L[6],O[7]=L[7],O[8]=L[8],O[9]=L[9],O[10]=L[10],O[11]=L[11],O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15],O;}function l(O,L,$,V,rt,it,ct,St,Ct,Mt,Dt,At,Ot,Lt,Yt,zt){var Wt=new r.ARRAY_TYPE(16);return Wt[0]=O,Wt[1]=L,Wt[2]=$,Wt[3]=V,Wt[4]=rt,Wt[5]=it,Wt[6]=ct,Wt[7]=St,Wt[8]=Ct,Wt[9]=Mt,Wt[10]=Dt,Wt[11]=At,Wt[12]=Ot,Wt[13]=Lt,Wt[14]=Yt,Wt[15]=zt,Wt;}function f(O,L,$,V,rt,it,ct,St,Ct,Mt,Dt,At,Ot,Lt,Yt,zt,Wt){return O[0]=L,O[1]=$,O[2]=V,O[3]=rt,O[4]=it,O[5]=ct,O[6]=St,O[7]=Ct,O[8]=Mt,O[9]=Dt,O[10]=At,O[11]=Ot,O[12]=Lt,O[13]=Yt,O[14]=zt,O[15]=Wt,O;}function h(O){return O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=1,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=1,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function m(O,L){if(O===L){var $=L[1],V=L[2],rt=L[3],it=L[6],ct=L[7],St=L[11];O[1]=L[4],O[2]=L[8],O[3]=L[12],O[4]=$,O[6]=L[9],O[7]=L[13],O[8]=V,O[9]=it,O[11]=L[14],O[12]=rt,O[13]=ct,O[14]=St;}else O[0]=L[0],O[1]=L[4],O[2]=L[8],O[3]=L[12],O[4]=L[1],O[5]=L[5],O[6]=L[9],O[7]=L[13],O[8]=L[2],O[9]=L[6],O[10]=L[10],O[11]=L[14],O[12]=L[3],O[13]=L[7],O[14]=L[11],O[15]=L[15];return O;}function u(O,L){var $=L[0],V=L[1],rt=L[2],it=L[3],ct=L[4],St=L[5],Ct=L[6],Mt=L[7],Dt=L[8],At=L[9],Ot=L[10],Lt=L[11],Yt=L[12],zt=L[13],Wt=L[14],Qt=L[15],ue=$*St-V*ct,ie=$*Ct-rt*ct,ne=$*Mt-it*ct,ae=V*Ct-rt*St,se=V*Mt-it*St,je=rt*Mt-it*Ct,We=Dt*zt-At*Yt,Xe=Dt*Wt-Ot*Yt,Fe=Dt*Qt-Lt*Yt,Ge=At*Wt-Ot*zt,Ke=At*Qt-Lt*zt,Je=Ot*Qt-Lt*Wt,Ie=ue*Je-ie*Ke+ne*Ge+ae*Fe-se*Xe+je*We;return Ie?(Ie=1/Ie,O[0]=(St*Je-Ct*Ke+Mt*Ge)*Ie,O[1]=(rt*Ke-V*Je-it*Ge)*Ie,O[2]=(zt*je-Wt*se+Qt*ae)*Ie,O[3]=(Ot*se-At*je-Lt*ae)*Ie,O[4]=(Ct*Fe-ct*Je-Mt*Xe)*Ie,O[5]=($*Je-rt*Fe+it*Xe)*Ie,O[6]=(Wt*ne-Yt*je-Qt*ie)*Ie,O[7]=(Dt*je-Ot*ne+Lt*ie)*Ie,O[8]=(ct*Ke-St*Fe+Mt*We)*Ie,O[9]=(V*Fe-$*Ke-it*We)*Ie,O[10]=(Yt*se-zt*ne+Qt*ue)*Ie,O[11]=(At*ne-Dt*se-Lt*ue)*Ie,O[12]=(St*Xe-ct*Ge-Ct*We)*Ie,O[13]=($*Ge-V*Xe+rt*We)*Ie,O[14]=(zt*ie-Yt*ae-Wt*ue)*Ie,O[15]=(Dt*ae-At*ie+Ot*ue)*Ie,O):null;}function y(O,L){var $=L[0],V=L[1],rt=L[2],it=L[3],ct=L[4],St=L[5],Ct=L[6],Mt=L[7],Dt=L[8],At=L[9],Ot=L[10],Lt=L[11],Yt=L[12],zt=L[13],Wt=L[14],Qt=L[15];return O[0]=St*(Ot*Qt-Lt*Wt)-At*(Ct*Qt-Mt*Wt)+zt*(Ct*Lt-Mt*Ot),O[1]=-(V*(Ot*Qt-Lt*Wt)-At*(rt*Qt-it*Wt)+zt*(rt*Lt-it*Ot)),O[2]=V*(Ct*Qt-Mt*Wt)-St*(rt*Qt-it*Wt)+zt*(rt*Mt-it*Ct),O[3]=-(V*(Ct*Lt-Mt*Ot)-St*(rt*Lt-it*Ot)+At*(rt*Mt-it*Ct)),O[4]=-(ct*(Ot*Qt-Lt*Wt)-Dt*(Ct*Qt-Mt*Wt)+Yt*(Ct*Lt-Mt*Ot)),O[5]=$*(Ot*Qt-Lt*Wt)-Dt*(rt*Qt-it*Wt)+Yt*(rt*Lt-it*Ot),O[6]=-($*(Ct*Qt-Mt*Wt)-ct*(rt*Qt-it*Wt)+Yt*(rt*Mt-it*Ct)),O[7]=$*(Ct*Lt-Mt*Ot)-ct*(rt*Lt-it*Ot)+Dt*(rt*Mt-it*Ct),O[8]=ct*(At*Qt-Lt*zt)-Dt*(St*Qt-Mt*zt)+Yt*(St*Lt-Mt*At),O[9]=-($*(At*Qt-Lt*zt)-Dt*(V*Qt-it*zt)+Yt*(V*Lt-it*At)),O[10]=$*(St*Qt-Mt*zt)-ct*(V*Qt-it*zt)+Yt*(V*Mt-it*St),O[11]=-($*(St*Lt-Mt*At)-ct*(V*Lt-it*At)+Dt*(V*Mt-it*St)),O[12]=-(ct*(At*Wt-Ot*zt)-Dt*(St*Wt-Ct*zt)+Yt*(St*Ot-Ct*At)),O[13]=$*(At*Wt-Ot*zt)-Dt*(V*Wt-rt*zt)+Yt*(V*Ot-rt*At),O[14]=-($*(St*Wt-Ct*zt)-ct*(V*Wt-rt*zt)+Yt*(V*Ct-rt*St)),O[15]=$*(St*Ot-Ct*At)-ct*(V*Ot-rt*At)+Dt*(V*Ct-rt*St),O;}function T(O){var L=O[0],$=O[1],V=O[2],rt=O[3],it=O[4],ct=O[5],St=O[6],Ct=O[7],Mt=O[8],Dt=O[9],At=O[10],Ot=O[11],Lt=O[12],Yt=O[13],zt=O[14],Wt=O[15],Qt=L*ct-$*it,ue=L*St-V*it,ie=L*Ct-rt*it,ne=$*St-V*ct,ae=$*Ct-rt*ct,se=V*Ct-rt*St,je=Mt*Yt-Dt*Lt,We=Mt*zt-At*Lt,Xe=Mt*Wt-Ot*Lt,Fe=Dt*zt-At*Yt,Ge=Dt*Wt-Ot*Yt,Ke=At*Wt-Ot*zt;return Qt*Ke-ue*Ge+ie*Fe+ne*Xe-ae*We+se*je;}function E(O,L,$){var V=L[0],rt=L[1],it=L[2],ct=L[3],St=L[4],Ct=L[5],Mt=L[6],Dt=L[7],At=L[8],Ot=L[9],Lt=L[10],Yt=L[11],zt=L[12],Wt=L[13],Qt=L[14],ue=L[15],ie=$[0],ne=$[1],ae=$[2],se=$[3];return O[0]=ie*V+ne*St+ae*At+se*zt,O[1]=ie*rt+ne*Ct+ae*Ot+se*Wt,O[2]=ie*it+ne*Mt+ae*Lt+se*Qt,O[3]=ie*ct+ne*Dt+ae*Yt+se*ue,ie=$[4],ne=$[5],ae=$[6],se=$[7],O[4]=ie*V+ne*St+ae*At+se*zt,O[5]=ie*rt+ne*Ct+ae*Ot+se*Wt,O[6]=ie*it+ne*Mt+ae*Lt+se*Qt,O[7]=ie*ct+ne*Dt+ae*Yt+se*ue,ie=$[8],ne=$[9],ae=$[10],se=$[11],O[8]=ie*V+ne*St+ae*At+se*zt,O[9]=ie*rt+ne*Ct+ae*Ot+se*Wt,O[10]=ie*it+ne*Mt+ae*Lt+se*Qt,O[11]=ie*ct+ne*Dt+ae*Yt+se*ue,ie=$[12],ne=$[13],ae=$[14],se=$[15],O[12]=ie*V+ne*St+ae*At+se*zt,O[13]=ie*rt+ne*Ct+ae*Ot+se*Wt,O[14]=ie*it+ne*Mt+ae*Lt+se*Qt,O[15]=ie*ct+ne*Dt+ae*Yt+se*ue,O;}function C(O,L,$){var V=$[0],rt=$[1],it=$[2],ct,St,Ct,Mt,Dt,At,Ot,Lt,Yt,zt,Wt,Qt;return L===O?(O[12]=L[0]*V+L[4]*rt+L[8]*it+L[12],O[13]=L[1]*V+L[5]*rt+L[9]*it+L[13],O[14]=L[2]*V+L[6]*rt+L[10]*it+L[14],O[15]=L[3]*V+L[7]*rt+L[11]*it+L[15]):(ct=L[0],St=L[1],Ct=L[2],Mt=L[3],Dt=L[4],At=L[5],Ot=L[6],Lt=L[7],Yt=L[8],zt=L[9],Wt=L[10],Qt=L[11],O[0]=ct,O[1]=St,O[2]=Ct,O[3]=Mt,O[4]=Dt,O[5]=At,O[6]=Ot,O[7]=Lt,O[8]=Yt,O[9]=zt,O[10]=Wt,O[11]=Qt,O[12]=ct*V+Dt*rt+Yt*it+L[12],O[13]=St*V+At*rt+zt*it+L[13],O[14]=Ct*V+Ot*rt+Wt*it+L[14],O[15]=Mt*V+Lt*rt+Qt*it+L[15]),O;}function x(O,L,$){var V=$[0],rt=$[1],it=$[2];return O[0]=L[0]*V,O[1]=L[1]*V,O[2]=L[2]*V,O[3]=L[3]*V,O[4]=L[4]*rt,O[5]=L[5]*rt,O[6]=L[6]*rt,O[7]=L[7]*rt,O[8]=L[8]*it,O[9]=L[9]*it,O[10]=L[10]*it,O[11]=L[11]*it,O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15],O;}function I(O,L,$,V){var rt=V[0],it=V[1],ct=V[2],St=Math.hypot(rt,it,ct),Ct,Mt,Dt,At,Ot,Lt,Yt,zt,Wt,Qt,ue,ie,ne,ae,se,je,We,Xe,Fe,Ge,Ke,Je,Ie,cr;return St<r.EPSILON?null:(St=1/St,rt*=St,it*=St,ct*=St,Ct=Math.sin($),Mt=Math.cos($),Dt=1-Mt,At=L[0],Ot=L[1],Lt=L[2],Yt=L[3],zt=L[4],Wt=L[5],Qt=L[6],ue=L[7],ie=L[8],ne=L[9],ae=L[10],se=L[11],je=rt*rt*Dt+Mt,We=it*rt*Dt+ct*Ct,Xe=ct*rt*Dt-it*Ct,Fe=rt*it*Dt-ct*Ct,Ge=it*it*Dt+Mt,Ke=ct*it*Dt+rt*Ct,Je=rt*ct*Dt+it*Ct,Ie=it*ct*Dt-rt*Ct,cr=ct*ct*Dt+Mt,O[0]=At*je+zt*We+ie*Xe,O[1]=Ot*je+Wt*We+ne*Xe,O[2]=Lt*je+Qt*We+ae*Xe,O[3]=Yt*je+ue*We+se*Xe,O[4]=At*Fe+zt*Ge+ie*Ke,O[5]=Ot*Fe+Wt*Ge+ne*Ke,O[6]=Lt*Fe+Qt*Ge+ae*Ke,O[7]=Yt*Fe+ue*Ge+se*Ke,O[8]=At*Je+zt*Ie+ie*cr,O[9]=Ot*Je+Wt*Ie+ne*cr,O[10]=Lt*Je+Qt*Ie+ae*cr,O[11]=Yt*Je+ue*Ie+se*cr,L!==O&&(O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15]),O);}function d(O,L,$){var V=Math.sin($),rt=Math.cos($),it=L[4],ct=L[5],St=L[6],Ct=L[7],Mt=L[8],Dt=L[9],At=L[10],Ot=L[11];return L!==O&&(O[0]=L[0],O[1]=L[1],O[2]=L[2],O[3]=L[3],O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15]),O[4]=it*rt+Mt*V,O[5]=ct*rt+Dt*V,O[6]=St*rt+At*V,O[7]=Ct*rt+Ot*V,O[8]=Mt*rt-it*V,O[9]=Dt*rt-ct*V,O[10]=At*rt-St*V,O[11]=Ot*rt-Ct*V,O;}function v(O,L,$){var V=Math.sin($),rt=Math.cos($),it=L[0],ct=L[1],St=L[2],Ct=L[3],Mt=L[8],Dt=L[9],At=L[10],Ot=L[11];return L!==O&&(O[4]=L[4],O[5]=L[5],O[6]=L[6],O[7]=L[7],O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15]),O[0]=it*rt-Mt*V,O[1]=ct*rt-Dt*V,O[2]=St*rt-At*V,O[3]=Ct*rt-Ot*V,O[8]=it*V+Mt*rt,O[9]=ct*V+Dt*rt,O[10]=St*V+At*rt,O[11]=Ct*V+Ot*rt,O;}function p(O,L,$){var V=Math.sin($),rt=Math.cos($),it=L[0],ct=L[1],St=L[2],Ct=L[3],Mt=L[4],Dt=L[5],At=L[6],Ot=L[7];return L!==O&&(O[8]=L[8],O[9]=L[9],O[10]=L[10],O[11]=L[11],O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15]),O[0]=it*rt+Mt*V,O[1]=ct*rt+Dt*V,O[2]=St*rt+At*V,O[3]=Ct*rt+Ot*V,O[4]=Mt*rt-it*V,O[5]=Dt*rt-ct*V,O[6]=At*rt-St*V,O[7]=Ot*rt-Ct*V,O;}function S(O,L){return O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=1,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=1,O[11]=0,O[12]=L[0],O[13]=L[1],O[14]=L[2],O[15]=1,O;}function A(O,L){return O[0]=L[0],O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=L[1],O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=L[2],O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function R(O,L,$){var V=$[0],rt=$[1],it=$[2],ct=Math.hypot(V,rt,it),St,Ct,Mt;return ct<r.EPSILON?null:(ct=1/ct,V*=ct,rt*=ct,it*=ct,St=Math.sin(L),Ct=Math.cos(L),Mt=1-Ct,O[0]=V*V*Mt+Ct,O[1]=rt*V*Mt+it*St,O[2]=it*V*Mt-rt*St,O[3]=0,O[4]=V*rt*Mt-it*St,O[5]=rt*rt*Mt+Ct,O[6]=it*rt*Mt+V*St,O[7]=0,O[8]=V*it*Mt+rt*St,O[9]=rt*it*Mt-V*St,O[10]=it*it*Mt+Ct,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O);}function D(O,L){var $=Math.sin(L),V=Math.cos(L);return O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=V,O[6]=$,O[7]=0,O[8]=0,O[9]=-$,O[10]=V,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function U(O,L){var $=Math.sin(L),V=Math.cos(L);return O[0]=V,O[1]=0,O[2]=-$,O[3]=0,O[4]=0,O[5]=1,O[6]=0,O[7]=0,O[8]=$,O[9]=0,O[10]=V,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function M(O,L){var $=Math.sin(L),V=Math.cos(L);return O[0]=V,O[1]=$,O[2]=0,O[3]=0,O[4]=-$,O[5]=V,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=1,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function W(O,L,$){var V=L[0],rt=L[1],it=L[2],ct=L[3],St=V+V,Ct=rt+rt,Mt=it+it,Dt=V*St,At=V*Ct,Ot=V*Mt,Lt=rt*Ct,Yt=rt*Mt,zt=it*Mt,Wt=ct*St,Qt=ct*Ct,ue=ct*Mt;return O[0]=1-(Lt+zt),O[1]=At+ue,O[2]=Ot-Qt,O[3]=0,O[4]=At-ue,O[5]=1-(Dt+zt),O[6]=Yt+Wt,O[7]=0,O[8]=Ot+Qt,O[9]=Yt-Wt,O[10]=1-(Dt+Lt),O[11]=0,O[12]=$[0],O[13]=$[1],O[14]=$[2],O[15]=1,O;}function Y(O,L){var $=new r.ARRAY_TYPE(3),V=-L[0],rt=-L[1],it=-L[2],ct=L[3],St=L[4],Ct=L[5],Mt=L[6],Dt=L[7],At=V*V+rt*rt+it*it+ct*ct;return At>0?($[0]=(St*ct+Dt*V+Ct*it-Mt*rt)*2/At,$[1]=(Ct*ct+Dt*rt+Mt*V-St*it)*2/At,$[2]=(Mt*ct+Dt*it+St*rt-Ct*V)*2/At):($[0]=(St*ct+Dt*V+Ct*it-Mt*rt)*2,$[1]=(Ct*ct+Dt*rt+Mt*V-St*it)*2,$[2]=(Mt*ct+Dt*it+St*rt-Ct*V)*2),W(O,L,$),O;}function B(O,L){return O[0]=L[12],O[1]=L[13],O[2]=L[14],O;}function N(O,L){var $=L[0],V=L[1],rt=L[2],it=L[4],ct=L[5],St=L[6],Ct=L[8],Mt=L[9],Dt=L[10];return O[0]=Math.hypot($,V,rt),O[1]=Math.hypot(it,ct,St),O[2]=Math.hypot(Ct,Mt,Dt),O;}function G(O,L){var $=new r.ARRAY_TYPE(3);N($,L);var V=1/$[0],rt=1/$[1],it=1/$[2],ct=L[0]*V,St=L[1]*rt,Ct=L[2]*it,Mt=L[4]*V,Dt=L[5]*rt,At=L[6]*it,Ot=L[8]*V,Lt=L[9]*rt,Yt=L[10]*it,zt=ct+Dt+Yt,Wt=0;return zt>0?(Wt=Math.sqrt(zt+1)*2,O[3]=0.25*Wt,O[0]=(At-Lt)/Wt,O[1]=(Ot-Ct)/Wt,O[2]=(St-Mt)/Wt):ct>Dt&&ct>Yt?(Wt=Math.sqrt(1+ct-Dt-Yt)*2,O[3]=(At-Lt)/Wt,O[0]=0.25*Wt,O[1]=(St+Mt)/Wt,O[2]=(Ot+Ct)/Wt):Dt>Yt?(Wt=Math.sqrt(1+Dt-ct-Yt)*2,O[3]=(Ot-Ct)/Wt,O[0]=(St+Mt)/Wt,O[1]=0.25*Wt,O[2]=(At+Lt)/Wt):(Wt=Math.sqrt(1+Yt-ct-Dt)*2,O[3]=(St-Mt)/Wt,O[0]=(Ot+Ct)/Wt,O[1]=(At+Lt)/Wt,O[2]=0.25*Wt),O;}function J(O,L,$,V){var rt=L[0],it=L[1],ct=L[2],St=L[3],Ct=rt+rt,Mt=it+it,Dt=ct+ct,At=rt*Ct,Ot=rt*Mt,Lt=rt*Dt,Yt=it*Mt,zt=it*Dt,Wt=ct*Dt,Qt=St*Ct,ue=St*Mt,ie=St*Dt,ne=V[0],ae=V[1],se=V[2];return O[0]=(1-(Yt+Wt))*ne,O[1]=(Ot+ie)*ne,O[2]=(Lt-ue)*ne,O[3]=0,O[4]=(Ot-ie)*ae,O[5]=(1-(At+Wt))*ae,O[6]=(zt+Qt)*ae,O[7]=0,O[8]=(Lt+ue)*se,O[9]=(zt-Qt)*se,O[10]=(1-(At+Yt))*se,O[11]=0,O[12]=$[0],O[13]=$[1],O[14]=$[2],O[15]=1,O;}function tt(O,L,$,V,rt){var it=L[0],ct=L[1],St=L[2],Ct=L[3],Mt=it+it,Dt=ct+ct,At=St+St,Ot=it*Mt,Lt=it*Dt,Yt=it*At,zt=ct*Dt,Wt=ct*At,Qt=St*At,ue=Ct*Mt,ie=Ct*Dt,ne=Ct*At,ae=V[0],se=V[1],je=V[2],We=rt[0],Xe=rt[1],Fe=rt[2],Ge=(1-(zt+Qt))*ae,Ke=(Lt+ne)*ae,Je=(Yt-ie)*ae,Ie=(Lt-ne)*se,cr=(1-(Ot+Qt))*se,Kr=(Wt+ue)*se,tn=(Yt+ie)*je,Gn=(Wt-ue)*je,Hn=(1-(Ot+zt))*je;return O[0]=Ge,O[1]=Ke,O[2]=Je,O[3]=0,O[4]=Ie,O[5]=cr,O[6]=Kr,O[7]=0,O[8]=tn,O[9]=Gn,O[10]=Hn,O[11]=0,O[12]=$[0]+We-(Ge*We+Ie*Xe+tn*Fe),O[13]=$[1]+Xe-(Ke*We+cr*Xe+Gn*Fe),O[14]=$[2]+Fe-(Je*We+Kr*Xe+Hn*Fe),O[15]=1,O;}function at(O,L){var $=L[0],V=L[1],rt=L[2],it=L[3],ct=$+$,St=V+V,Ct=rt+rt,Mt=$*ct,Dt=V*ct,At=V*St,Ot=rt*ct,Lt=rt*St,Yt=rt*Ct,zt=it*ct,Wt=it*St,Qt=it*Ct;return O[0]=1-At-Yt,O[1]=Dt+Qt,O[2]=Ot-Wt,O[3]=0,O[4]=Dt-Qt,O[5]=1-Mt-Yt,O[6]=Lt+zt,O[7]=0,O[8]=Ot+Wt,O[9]=Lt-zt,O[10]=1-Mt-At,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function ut(O,L,$,V,rt,it,ct){var St=1/($-L),Ct=1/(rt-V),Mt=1/(it-ct);return O[0]=it*2*St,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=it*2*Ct,O[6]=0,O[7]=0,O[8]=($+L)*St,O[9]=(rt+V)*Ct,O[10]=(ct+it)*Mt,O[11]=-1,O[12]=0,O[13]=0,O[14]=ct*it*2*Mt,O[15]=0,O;}function K(O,L,$,V,rt){var it=1/Math.tan(L/2),ct;return O[0]=it/$,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=it,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[11]=-1,O[12]=0,O[13]=0,O[15]=0,rt!=null&&rt!==1/0?(ct=1/(V-rt),O[10]=(rt+V)*ct,O[14]=2*rt*V*ct):(O[10]=-1,O[14]=-2*V),O;}function Q(O,L,$,V){var rt=Math.tan(L.upDegrees*Math.PI/180),it=Math.tan(L.downDegrees*Math.PI/180),ct=Math.tan(L.leftDegrees*Math.PI/180),St=Math.tan(L.rightDegrees*Math.PI/180),Ct=2/(ct+St),Mt=2/(rt+it);return O[0]=Ct,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=Mt,O[6]=0,O[7]=0,O[8]=-((ct-St)*Ct*0.5),O[9]=(rt-it)*Mt*0.5,O[10]=V/($-V),O[11]=-1,O[12]=0,O[13]=0,O[14]=V*$/($-V),O[15]=0,O;}function ft(O,L,$,V,rt,it,ct){var St=1/(L-$),Ct=1/(V-rt),Mt=1/(it-ct);return O[0]=-2*St,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=-2*Ct,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=2*Mt,O[11]=0,O[12]=(L+$)*St,O[13]=(rt+V)*Ct,O[14]=(ct+it)*Mt,O[15]=1,O;}function gt(O,L,$,V){var rt,it,ct,St,Ct,Mt,Dt,At,Ot,Lt,Yt=L[0],zt=L[1],Wt=L[2],Qt=V[0],ue=V[1],ie=V[2],ne=$[0],ae=$[1],se=$[2];return Math.abs(Yt-ne)<r.EPSILON&&Math.abs(zt-ae)<r.EPSILON&&Math.abs(Wt-se)<r.EPSILON?h(O):(Dt=Yt-ne,At=zt-ae,Ot=Wt-se,Lt=1/Math.hypot(Dt,At,Ot),Dt*=Lt,At*=Lt,Ot*=Lt,rt=ue*Ot-ie*At,it=ie*Dt-Qt*Ot,ct=Qt*At-ue*Dt,Lt=Math.hypot(rt,it,ct),Lt?(Lt=1/Lt,rt*=Lt,it*=Lt,ct*=Lt):(rt=0,it=0,ct=0),St=At*ct-Ot*it,Ct=Ot*rt-Dt*ct,Mt=Dt*it-At*rt,Lt=Math.hypot(St,Ct,Mt),Lt?(Lt=1/Lt,St*=Lt,Ct*=Lt,Mt*=Lt):(St=0,Ct=0,Mt=0),O[0]=rt,O[1]=St,O[2]=Dt,O[3]=0,O[4]=it,O[5]=Ct,O[6]=At,O[7]=0,O[8]=ct,O[9]=Mt,O[10]=Ot,O[11]=0,O[12]=-(rt*Yt+it*zt+ct*Wt),O[13]=-(St*Yt+Ct*zt+Mt*Wt),O[14]=-(Dt*Yt+At*zt+Ot*Wt),O[15]=1,O);}function mt(O,L,$,V){var rt=L[0],it=L[1],ct=L[2],St=V[0],Ct=V[1],Mt=V[2],Dt=rt-$[0],At=it-$[1],Ot=ct-$[2],Lt=Dt*Dt+At*At+Ot*Ot;Lt>0&&(Lt=1/Math.sqrt(Lt),Dt*=Lt,At*=Lt,Ot*=Lt);var Yt=Ct*Ot-Mt*At,zt=Mt*Dt-St*Ot,Wt=St*At-Ct*Dt;return Lt=Yt*Yt+zt*zt+Wt*Wt,Lt>0&&(Lt=1/Math.sqrt(Lt),Yt*=Lt,zt*=Lt,Wt*=Lt),O[0]=Yt,O[1]=zt,O[2]=Wt,O[3]=0,O[4]=At*Wt-Ot*zt,O[5]=Ot*Yt-Dt*Wt,O[6]=Dt*zt-At*Yt,O[7]=0,O[8]=Dt,O[9]=At,O[10]=Ot,O[11]=0,O[12]=rt,O[13]=it,O[14]=ct,O[15]=1,O;}function wt(O){return"mat4("+O[0]+", "+O[1]+", "+O[2]+", "+O[3]+", "+O[4]+", "+O[5]+", "+O[6]+", "+O[7]+", "+O[8]+", "+O[9]+", "+O[10]+", "+O[11]+", "+O[12]+", "+O[13]+", "+O[14]+", "+O[15]+")";}function ht(O){return Math.hypot(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],O[8],O[9],O[10],O[11],O[12],O[13],O[14],O[15]);}function Nt(O,L,$){return O[0]=L[0]+$[0],O[1]=L[1]+$[1],O[2]=L[2]+$[2],O[3]=L[3]+$[3],O[4]=L[4]+$[4],O[5]=L[5]+$[5],O[6]=L[6]+$[6],O[7]=L[7]+$[7],O[8]=L[8]+$[8],O[9]=L[9]+$[9],O[10]=L[10]+$[10],O[11]=L[11]+$[11],O[12]=L[12]+$[12],O[13]=L[13]+$[13],O[14]=L[14]+$[14],O[15]=L[15]+$[15],O;}function Rt(O,L,$){return O[0]=L[0]-$[0],O[1]=L[1]-$[1],O[2]=L[2]-$[2],O[3]=L[3]-$[3],O[4]=L[4]-$[4],O[5]=L[5]-$[5],O[6]=L[6]-$[6],O[7]=L[7]-$[7],O[8]=L[8]-$[8],O[9]=L[9]-$[9],O[10]=L[10]-$[10],O[11]=L[11]-$[11],O[12]=L[12]-$[12],O[13]=L[13]-$[13],O[14]=L[14]-$[14],O[15]=L[15]-$[15],O;}function X(O,L,$){return O[0]=L[0]*$,O[1]=L[1]*$,O[2]=L[2]*$,O[3]=L[3]*$,O[4]=L[4]*$,O[5]=L[5]*$,O[6]=L[6]*$,O[7]=L[7]*$,O[8]=L[8]*$,O[9]=L[9]*$,O[10]=L[10]*$,O[11]=L[11]*$,O[12]=L[12]*$,O[13]=L[13]*$,O[14]=L[14]*$,O[15]=L[15]*$,O;}function z(O,L,$,V){return O[0]=L[0]+$[0]*V,O[1]=L[1]+$[1]*V,O[2]=L[2]+$[2]*V,O[3]=L[3]+$[3]*V,O[4]=L[4]+$[4]*V,O[5]=L[5]+$[5]*V,O[6]=L[6]+$[6]*V,O[7]=L[7]+$[7]*V,O[8]=L[8]+$[8]*V,O[9]=L[9]+$[9]*V,O[10]=L[10]+$[10]*V,O[11]=L[11]+$[11]*V,O[12]=L[12]+$[12]*V,O[13]=L[13]+$[13]*V,O[14]=L[14]+$[14]*V,O[15]=L[15]+$[15]*V,O;}function q(O,L){return O[0]===L[0]&&O[1]===L[1]&&O[2]===L[2]&&O[3]===L[3]&&O[4]===L[4]&&O[5]===L[5]&&O[6]===L[6]&&O[7]===L[7]&&O[8]===L[8]&&O[9]===L[9]&&O[10]===L[10]&&O[11]===L[11]&&O[12]===L[12]&&O[13]===L[13]&&O[14]===L[14]&&O[15]===L[15];}function nt(O,L){var $=O[0],V=O[1],rt=O[2],it=O[3],ct=O[4],St=O[5],Ct=O[6],Mt=O[7],Dt=O[8],At=O[9],Ot=O[10],Lt=O[11],Yt=O[12],zt=O[13],Wt=O[14],Qt=O[15],ue=L[0],ie=L[1],ne=L[2],ae=L[3],se=L[4],je=L[5],We=L[6],Xe=L[7],Fe=L[8],Ge=L[9],Ke=L[10],Je=L[11],Ie=L[12],cr=L[13],Kr=L[14],tn=L[15];return Math.abs($-ue)<=r.EPSILON*Math.max(1,Math.abs($),Math.abs(ue))&&Math.abs(V-ie)<=r.EPSILON*Math.max(1,Math.abs(V),Math.abs(ie))&&Math.abs(rt-ne)<=r.EPSILON*Math.max(1,Math.abs(rt),Math.abs(ne))&&Math.abs(it-ae)<=r.EPSILON*Math.max(1,Math.abs(it),Math.abs(ae))&&Math.abs(ct-se)<=r.EPSILON*Math.max(1,Math.abs(ct),Math.abs(se))&&Math.abs(St-je)<=r.EPSILON*Math.max(1,Math.abs(St),Math.abs(je))&&Math.abs(Ct-We)<=r.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(We))&&Math.abs(Mt-Xe)<=r.EPSILON*Math.max(1,Math.abs(Mt),Math.abs(Xe))&&Math.abs(Dt-Fe)<=r.EPSILON*Math.max(1,Math.abs(Dt),Math.abs(Fe))&&Math.abs(At-Ge)<=r.EPSILON*Math.max(1,Math.abs(At),Math.abs(Ge))&&Math.abs(Ot-Ke)<=r.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(Ke))&&Math.abs(Lt-Je)<=r.EPSILON*Math.max(1,Math.abs(Lt),Math.abs(Je))&&Math.abs(Yt-Ie)<=r.EPSILON*Math.max(1,Math.abs(Yt),Math.abs(Ie))&&Math.abs(zt-cr)<=r.EPSILON*Math.max(1,Math.abs(zt),Math.abs(cr))&&Math.abs(Wt-Kr)<=r.EPSILON*Math.max(1,Math.abs(Wt),Math.abs(Kr))&&Math.abs(Qt-tn)<=r.EPSILON*Math.max(1,Math.abs(Qt),Math.abs(tn));}var j=E,Z=Rt;},/* 7 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return l;}),t.d(e,"identity",function(){return f;}),t.d(e,"setAxisAngle",function(){return h;}),t.d(e,"getAxisAngle",function(){return m;}),t.d(e,"getAngle",function(){return u;}),t.d(e,"multiply",function(){return y;}),t.d(e,"rotateX",function(){return T;}),t.d(e,"rotateY",function(){return E;}),t.d(e,"rotateZ",function(){return C;}),t.d(e,"calculateW",function(){return x;}),t.d(e,"exp",function(){return I;}),t.d(e,"ln",function(){return d;}),t.d(e,"pow",function(){return v;}),t.d(e,"slerp",function(){return p;}),t.d(e,"random",function(){return S;}),t.d(e,"invert",function(){return A;}),t.d(e,"conjugate",function(){return R;}),t.d(e,"fromMat3",function(){return D;}),t.d(e,"fromEuler",function(){return U;}),t.d(e,"str",function(){return M;}),t.d(e,"clone",function(){return W;}),t.d(e,"fromValues",function(){return Y;}),t.d(e,"copy",function(){return B;}),t.d(e,"set",function(){return N;}),t.d(e,"add",function(){return G;}),t.d(e,"mul",function(){return J;}),t.d(e,"scale",function(){return tt;}),t.d(e,"dot",function(){return at;}),t.d(e,"lerp",function(){return ut;}),t.d(e,"length",function(){return K;}),t.d(e,"len",function(){return Q;}),t.d(e,"squaredLength",function(){return ft;}),t.d(e,"sqrLen",function(){return gt;}),t.d(e,"normalize",function(){return mt;}),t.d(e,"exactEquals",function(){return wt;}),t.d(e,"equals",function(){return ht;}),t.d(e,"rotationTo",function(){return Nt;}),t.d(e,"sqlerp",function(){return Rt;}),t.d(e,"setAxes",function(){return X;});var r=t(2),n=t(5),s=t(8),c=t(9);function l(){var z=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(z[0]=0,z[1]=0,z[2]=0),z[3]=1,z;}function f(z){return z[0]=0,z[1]=0,z[2]=0,z[3]=1,z;}function h(z,q,nt){nt=nt*0.5;var j=Math.sin(nt);return z[0]=j*q[0],z[1]=j*q[1],z[2]=j*q[2],z[3]=Math.cos(nt),z;}function m(z,q){var nt=Math.acos(q[3])*2,j=Math.sin(nt/2);return j>r.EPSILON?(z[0]=q[0]/j,z[1]=q[1]/j,z[2]=q[2]/j):(z[0]=1,z[1]=0,z[2]=0),nt;}function u(z,q){var nt=at(z,q);return Math.acos(2*nt*nt-1);}function y(z,q,nt){var j=q[0],Z=q[1],O=q[2],L=q[3],$=nt[0],V=nt[1],rt=nt[2],it=nt[3];return z[0]=j*it+L*$+Z*rt-O*V,z[1]=Z*it+L*V+O*$-j*rt,z[2]=O*it+L*rt+j*V-Z*$,z[3]=L*it-j*$-Z*V-O*rt,z;}function T(z,q,nt){nt*=0.5;var j=q[0],Z=q[1],O=q[2],L=q[3],$=Math.sin(nt),V=Math.cos(nt);return z[0]=j*V+L*$,z[1]=Z*V+O*$,z[2]=O*V-Z*$,z[3]=L*V-j*$,z;}function E(z,q,nt){nt*=0.5;var j=q[0],Z=q[1],O=q[2],L=q[3],$=Math.sin(nt),V=Math.cos(nt);return z[0]=j*V-O*$,z[1]=Z*V+L*$,z[2]=O*V+j*$,z[3]=L*V-Z*$,z;}function C(z,q,nt){nt*=0.5;var j=q[0],Z=q[1],O=q[2],L=q[3],$=Math.sin(nt),V=Math.cos(nt);return z[0]=j*V+Z*$,z[1]=Z*V-j*$,z[2]=O*V+L*$,z[3]=L*V-O*$,z;}function x(z,q){var nt=q[0],j=q[1],Z=q[2];return z[0]=nt,z[1]=j,z[2]=Z,z[3]=Math.sqrt(Math.abs(1-nt*nt-j*j-Z*Z)),z;}function I(z,q){var nt=q[0],j=q[1],Z=q[2],O=q[3],L=Math.sqrt(nt*nt+j*j+Z*Z),$=Math.exp(O),V=L>0?$*Math.sin(L)/L:0;return z[0]=nt*V,z[1]=j*V,z[2]=Z*V,z[3]=$*Math.cos(L),z;}function d(z,q){var nt=q[0],j=q[1],Z=q[2],O=q[3],L=Math.sqrt(nt*nt+j*j+Z*Z),$=L>0?Math.atan2(L,O)/L:0;return z[0]=nt*$,z[1]=j*$,z[2]=Z*$,z[3]=0.5*Math.log(nt*nt+j*j+Z*Z+O*O),z;}function v(z,q,nt){return d(z,q),tt(z,z,nt),I(z,z),z;}function p(z,q,nt,j){var Z=q[0],O=q[1],L=q[2],$=q[3],V=nt[0],rt=nt[1],it=nt[2],ct=nt[3],St,Ct,Mt,Dt,At;return Ct=Z*V+O*rt+L*it+$*ct,Ct<0&&(Ct=-Ct,V=-V,rt=-rt,it=-it,ct=-ct),1-Ct>r.EPSILON?(St=Math.acos(Ct),Mt=Math.sin(St),Dt=Math.sin((1-j)*St)/Mt,At=Math.sin(j*St)/Mt):(Dt=1-j,At=j),z[0]=Dt*Z+At*V,z[1]=Dt*O+At*rt,z[2]=Dt*L+At*it,z[3]=Dt*$+At*ct,z;}function S(z){var q=r.RANDOM(),nt=r.RANDOM(),j=r.RANDOM(),Z=Math.sqrt(1-q),O=Math.sqrt(q);return z[0]=Z*Math.sin(2*Math.PI*nt),z[1]=Z*Math.cos(2*Math.PI*nt),z[2]=O*Math.sin(2*Math.PI*j),z[3]=O*Math.cos(2*Math.PI*j),z;}function A(z,q){var nt=q[0],j=q[1],Z=q[2],O=q[3],L=nt*nt+j*j+Z*Z+O*O,$=L?1/L:0;return z[0]=-nt*$,z[1]=-j*$,z[2]=-Z*$,z[3]=O*$,z;}function R(z,q){return z[0]=-q[0],z[1]=-q[1],z[2]=-q[2],z[3]=q[3],z;}function D(z,q){var nt=q[0]+q[4]+q[8],j;if(nt>0)j=Math.sqrt(nt+1),z[3]=0.5*j,j=0.5/j,z[0]=(q[5]-q[7])*j,z[1]=(q[6]-q[2])*j,z[2]=(q[1]-q[3])*j;else{var Z=0;q[4]>q[0]&&(Z=1),q[8]>q[Z*3+Z]&&(Z=2);var O=(Z+1)%3,L=(Z+2)%3;j=Math.sqrt(q[Z*3+Z]-q[O*3+O]-q[L*3+L]+1),z[Z]=0.5*j,j=0.5/j,z[3]=(q[O*3+L]-q[L*3+O])*j,z[O]=(q[O*3+Z]+q[Z*3+O])*j,z[L]=(q[L*3+Z]+q[Z*3+L])*j;}return z;}function U(z,q,nt,j){var Z=0.5*Math.PI/180;q*=Z,nt*=Z,j*=Z;var O=Math.sin(q),L=Math.cos(q),$=Math.sin(nt),V=Math.cos(nt),rt=Math.sin(j),it=Math.cos(j);return z[0]=O*V*it-L*$*rt,z[1]=L*$*it+O*V*rt,z[2]=L*V*rt-O*$*it,z[3]=L*V*it+O*$*rt,z;}function M(z){return"quat("+z[0]+", "+z[1]+", "+z[2]+", "+z[3]+")";}var W=c.clone,Y=c.fromValues,B=c.copy,N=c.set,G=c.add,J=y,tt=c.scale,at=c.dot,ut=c.lerp,K=c.length,Q=K,ft=c.squaredLength,gt=ft,mt=c.normalize,wt=c.exactEquals,ht=c.equals,Nt=function(){var z=s.create(),q=s.fromValues(1,0,0),nt=s.fromValues(0,1,0);return function(j,Z,O){var L=s.dot(Z,O);return L<-0.999999?(s.cross(z,q,Z),s.len(z)<1e-6&&s.cross(z,nt,Z),s.normalize(z,z),h(j,z,Math.PI),j):L>0.999999?(j[0]=0,j[1]=0,j[2]=0,j[3]=1,j):(s.cross(z,Z,O),j[0]=z[0],j[1]=z[1],j[2]=z[2],j[3]=1+L,mt(j,j));};}(),Rt=function(){var z=l(),q=l();return function(nt,j,Z,O,L,$){return p(z,j,L,$),p(q,Z,O,$),p(nt,z,q,2*$*(1-$)),nt;};}(),X=function(){var z=n.create();return function(q,nt,j,Z){return z[0]=j[0],z[3]=j[1],z[6]=j[2],z[1]=Z[0],z[4]=Z[1],z[7]=Z[2],z[2]=-nt[0],z[5]=-nt[1],z[8]=-nt[2],mt(q,D(q,z));};}();},/* 8 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"length",function(){return c;}),t.d(e,"fromValues",function(){return l;}),t.d(e,"copy",function(){return f;}),t.d(e,"set",function(){return h;}),t.d(e,"add",function(){return m;}),t.d(e,"subtract",function(){return u;}),t.d(e,"multiply",function(){return y;}),t.d(e,"divide",function(){return T;}),t.d(e,"ceil",function(){return E;}),t.d(e,"floor",function(){return C;}),t.d(e,"min",function(){return x;}),t.d(e,"max",function(){return I;}),t.d(e,"round",function(){return d;}),t.d(e,"scale",function(){return v;}),t.d(e,"scaleAndAdd",function(){return p;}),t.d(e,"distance",function(){return S;}),t.d(e,"squaredDistance",function(){return A;}),t.d(e,"squaredLength",function(){return R;}),t.d(e,"negate",function(){return D;}),t.d(e,"inverse",function(){return U;}),t.d(e,"normalize",function(){return M;}),t.d(e,"dot",function(){return W;}),t.d(e,"cross",function(){return Y;}),t.d(e,"lerp",function(){return B;}),t.d(e,"hermite",function(){return N;}),t.d(e,"bezier",function(){return G;}),t.d(e,"random",function(){return J;}),t.d(e,"transformMat4",function(){return tt;}),t.d(e,"transformMat3",function(){return at;}),t.d(e,"transformQuat",function(){return ut;}),t.d(e,"rotateX",function(){return K;}),t.d(e,"rotateY",function(){return Q;}),t.d(e,"rotateZ",function(){return ft;}),t.d(e,"angle",function(){return gt;}),t.d(e,"zero",function(){return mt;}),t.d(e,"str",function(){return wt;}),t.d(e,"exactEquals",function(){return ht;}),t.d(e,"equals",function(){return Nt;}),t.d(e,"sub",function(){return Rt;}),t.d(e,"mul",function(){return X;}),t.d(e,"div",function(){return z;}),t.d(e,"dist",function(){return q;}),t.d(e,"sqrDist",function(){return nt;}),t.d(e,"len",function(){return j;}),t.d(e,"sqrLen",function(){return Z;}),t.d(e,"forEach",function(){return O;});var r=t(2);function n(){var L=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(L[0]=0,L[1]=0,L[2]=0),L;}function s(L){var $=new r.ARRAY_TYPE(3);return $[0]=L[0],$[1]=L[1],$[2]=L[2],$;}function c(L){var $=L[0],V=L[1],rt=L[2];return Math.hypot($,V,rt);}function l(L,$,V){var rt=new r.ARRAY_TYPE(3);return rt[0]=L,rt[1]=$,rt[2]=V,rt;}function f(L,$){return L[0]=$[0],L[1]=$[1],L[2]=$[2],L;}function h(L,$,V,rt){return L[0]=$,L[1]=V,L[2]=rt,L;}function m(L,$,V){return L[0]=$[0]+V[0],L[1]=$[1]+V[1],L[2]=$[2]+V[2],L;}function u(L,$,V){return L[0]=$[0]-V[0],L[1]=$[1]-V[1],L[2]=$[2]-V[2],L;}function y(L,$,V){return L[0]=$[0]*V[0],L[1]=$[1]*V[1],L[2]=$[2]*V[2],L;}function T(L,$,V){return L[0]=$[0]/V[0],L[1]=$[1]/V[1],L[2]=$[2]/V[2],L;}function E(L,$){return L[0]=Math.ceil($[0]),L[1]=Math.ceil($[1]),L[2]=Math.ceil($[2]),L;}function C(L,$){return L[0]=Math.floor($[0]),L[1]=Math.floor($[1]),L[2]=Math.floor($[2]),L;}function x(L,$,V){return L[0]=Math.min($[0],V[0]),L[1]=Math.min($[1],V[1]),L[2]=Math.min($[2],V[2]),L;}function I(L,$,V){return L[0]=Math.max($[0],V[0]),L[1]=Math.max($[1],V[1]),L[2]=Math.max($[2],V[2]),L;}function d(L,$){return L[0]=Math.round($[0]),L[1]=Math.round($[1]),L[2]=Math.round($[2]),L;}function v(L,$,V){return L[0]=$[0]*V,L[1]=$[1]*V,L[2]=$[2]*V,L;}function p(L,$,V,rt){return L[0]=$[0]+V[0]*rt,L[1]=$[1]+V[1]*rt,L[2]=$[2]+V[2]*rt,L;}function S(L,$){var V=$[0]-L[0],rt=$[1]-L[1],it=$[2]-L[2];return Math.hypot(V,rt,it);}function A(L,$){var V=$[0]-L[0],rt=$[1]-L[1],it=$[2]-L[2];return V*V+rt*rt+it*it;}function R(L){var $=L[0],V=L[1],rt=L[2];return $*$+V*V+rt*rt;}function D(L,$){return L[0]=-$[0],L[1]=-$[1],L[2]=-$[2],L;}function U(L,$){return L[0]=1/$[0],L[1]=1/$[1],L[2]=1/$[2],L;}function M(L,$){var V=$[0],rt=$[1],it=$[2],ct=V*V+rt*rt+it*it;return ct>0&&(ct=1/Math.sqrt(ct)),L[0]=$[0]*ct,L[1]=$[1]*ct,L[2]=$[2]*ct,L;}function W(L,$){return L[0]*$[0]+L[1]*$[1]+L[2]*$[2];}function Y(L,$,V){var rt=$[0],it=$[1],ct=$[2],St=V[0],Ct=V[1],Mt=V[2];return L[0]=it*Mt-ct*Ct,L[1]=ct*St-rt*Mt,L[2]=rt*Ct-it*St,L;}function B(L,$,V,rt){var it=$[0],ct=$[1],St=$[2];return L[0]=it+rt*(V[0]-it),L[1]=ct+rt*(V[1]-ct),L[2]=St+rt*(V[2]-St),L;}function N(L,$,V,rt,it,ct){var St=ct*ct,Ct=St*(2*ct-3)+1,Mt=St*(ct-2)+ct,Dt=St*(ct-1),At=St*(3-2*ct);return L[0]=$[0]*Ct+V[0]*Mt+rt[0]*Dt+it[0]*At,L[1]=$[1]*Ct+V[1]*Mt+rt[1]*Dt+it[1]*At,L[2]=$[2]*Ct+V[2]*Mt+rt[2]*Dt+it[2]*At,L;}function G(L,$,V,rt,it,ct){var St=1-ct,Ct=St*St,Mt=ct*ct,Dt=Ct*St,At=3*ct*Ct,Ot=3*Mt*St,Lt=Mt*ct;return L[0]=$[0]*Dt+V[0]*At+rt[0]*Ot+it[0]*Lt,L[1]=$[1]*Dt+V[1]*At+rt[1]*Ot+it[1]*Lt,L[2]=$[2]*Dt+V[2]*At+rt[2]*Ot+it[2]*Lt,L;}function J(L,$){$=$||1;var V=r.RANDOM()*2*Math.PI,rt=r.RANDOM()*2-1,it=Math.sqrt(1-rt*rt)*$;return L[0]=Math.cos(V)*it,L[1]=Math.sin(V)*it,L[2]=rt*$,L;}function tt(L,$,V){var rt=$[0],it=$[1],ct=$[2],St=V[3]*rt+V[7]*it+V[11]*ct+V[15];return St=St||1,L[0]=(V[0]*rt+V[4]*it+V[8]*ct+V[12])/St,L[1]=(V[1]*rt+V[5]*it+V[9]*ct+V[13])/St,L[2]=(V[2]*rt+V[6]*it+V[10]*ct+V[14])/St,L;}function at(L,$,V){var rt=$[0],it=$[1],ct=$[2];return L[0]=rt*V[0]+it*V[3]+ct*V[6],L[1]=rt*V[1]+it*V[4]+ct*V[7],L[2]=rt*V[2]+it*V[5]+ct*V[8],L;}function ut(L,$,V){var rt=V[0],it=V[1],ct=V[2],St=V[3],Ct=$[0],Mt=$[1],Dt=$[2],At=it*Dt-ct*Mt,Ot=ct*Ct-rt*Dt,Lt=rt*Mt-it*Ct,Yt=it*Lt-ct*Ot,zt=ct*At-rt*Lt,Wt=rt*Ot-it*At,Qt=St*2;return At*=Qt,Ot*=Qt,Lt*=Qt,Yt*=2,zt*=2,Wt*=2,L[0]=Ct+At+Yt,L[1]=Mt+Ot+zt,L[2]=Dt+Lt+Wt,L;}function K(L,$,V,rt){var it=[],ct=[];return it[0]=$[0]-V[0],it[1]=$[1]-V[1],it[2]=$[2]-V[2],ct[0]=it[0],ct[1]=it[1]*Math.cos(rt)-it[2]*Math.sin(rt),ct[2]=it[1]*Math.sin(rt)+it[2]*Math.cos(rt),L[0]=ct[0]+V[0],L[1]=ct[1]+V[1],L[2]=ct[2]+V[2],L;}function Q(L,$,V,rt){var it=[],ct=[];return it[0]=$[0]-V[0],it[1]=$[1]-V[1],it[2]=$[2]-V[2],ct[0]=it[2]*Math.sin(rt)+it[0]*Math.cos(rt),ct[1]=it[1],ct[2]=it[2]*Math.cos(rt)-it[0]*Math.sin(rt),L[0]=ct[0]+V[0],L[1]=ct[1]+V[1],L[2]=ct[2]+V[2],L;}function ft(L,$,V,rt){var it=[],ct=[];return it[0]=$[0]-V[0],it[1]=$[1]-V[1],it[2]=$[2]-V[2],ct[0]=it[0]*Math.cos(rt)-it[1]*Math.sin(rt),ct[1]=it[0]*Math.sin(rt)+it[1]*Math.cos(rt),ct[2]=it[2],L[0]=ct[0]+V[0],L[1]=ct[1]+V[1],L[2]=ct[2]+V[2],L;}function gt(L,$){var V=L[0],rt=L[1],it=L[2],ct=$[0],St=$[1],Ct=$[2],Mt=Math.sqrt(V*V+rt*rt+it*it),Dt=Math.sqrt(ct*ct+St*St+Ct*Ct),At=Mt*Dt,Ot=At&&W(L,$)/At;return Math.acos(Math.min(Math.max(Ot,-1),1));}function mt(L){return L[0]=0,L[1]=0,L[2]=0,L;}function wt(L){return"vec3("+L[0]+", "+L[1]+", "+L[2]+")";}function ht(L,$){return L[0]===$[0]&&L[1]===$[1]&&L[2]===$[2];}function Nt(L,$){var V=L[0],rt=L[1],it=L[2],ct=$[0],St=$[1],Ct=$[2];return Math.abs(V-ct)<=r.EPSILON*Math.max(1,Math.abs(V),Math.abs(ct))&&Math.abs(rt-St)<=r.EPSILON*Math.max(1,Math.abs(rt),Math.abs(St))&&Math.abs(it-Ct)<=r.EPSILON*Math.max(1,Math.abs(it),Math.abs(Ct));}var Rt=u,X=y,z=T,q=S,nt=A,j=c,Z=R,O=function(){var L=n();return function($,V,rt,it,ct,St){var Ct,Mt;for(V||(V=3),rt||(rt=0),it?Mt=Math.min(it*V+rt,$.length):Mt=$.length,Ct=rt;Ct<Mt;Ct+=V)L[0]=$[Ct],L[1]=$[Ct+1],L[2]=$[Ct+2],ct(L,L,St),$[Ct]=L[0],$[Ct+1]=L[1],$[Ct+2]=L[2];return $;};}();},/* 9 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"fromValues",function(){return c;}),t.d(e,"copy",function(){return l;}),t.d(e,"set",function(){return f;}),t.d(e,"add",function(){return h;}),t.d(e,"subtract",function(){return m;}),t.d(e,"multiply",function(){return u;}),t.d(e,"divide",function(){return y;}),t.d(e,"ceil",function(){return T;}),t.d(e,"floor",function(){return E;}),t.d(e,"min",function(){return C;}),t.d(e,"max",function(){return x;}),t.d(e,"round",function(){return I;}),t.d(e,"scale",function(){return d;}),t.d(e,"scaleAndAdd",function(){return v;}),t.d(e,"distance",function(){return p;}),t.d(e,"squaredDistance",function(){return S;}),t.d(e,"length",function(){return A;}),t.d(e,"squaredLength",function(){return R;}),t.d(e,"negate",function(){return D;}),t.d(e,"inverse",function(){return U;}),t.d(e,"normalize",function(){return M;}),t.d(e,"dot",function(){return W;}),t.d(e,"cross",function(){return Y;}),t.d(e,"lerp",function(){return B;}),t.d(e,"random",function(){return N;}),t.d(e,"transformMat4",function(){return G;}),t.d(e,"transformQuat",function(){return J;}),t.d(e,"zero",function(){return tt;}),t.d(e,"str",function(){return at;}),t.d(e,"exactEquals",function(){return ut;}),t.d(e,"equals",function(){return K;}),t.d(e,"sub",function(){return Q;}),t.d(e,"mul",function(){return ft;}),t.d(e,"div",function(){return gt;}),t.d(e,"dist",function(){return mt;}),t.d(e,"sqrDist",function(){return wt;}),t.d(e,"len",function(){return ht;}),t.d(e,"sqrLen",function(){return Nt;}),t.d(e,"forEach",function(){return Rt;});var r=t(2);function n(){var X=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(X[0]=0,X[1]=0,X[2]=0,X[3]=0),X;}function s(X){var z=new r.ARRAY_TYPE(4);return z[0]=X[0],z[1]=X[1],z[2]=X[2],z[3]=X[3],z;}function c(X,z,q,nt){var j=new r.ARRAY_TYPE(4);return j[0]=X,j[1]=z,j[2]=q,j[3]=nt,j;}function l(X,z){return X[0]=z[0],X[1]=z[1],X[2]=z[2],X[3]=z[3],X;}function f(X,z,q,nt,j){return X[0]=z,X[1]=q,X[2]=nt,X[3]=j,X;}function h(X,z,q){return X[0]=z[0]+q[0],X[1]=z[1]+q[1],X[2]=z[2]+q[2],X[3]=z[3]+q[3],X;}function m(X,z,q){return X[0]=z[0]-q[0],X[1]=z[1]-q[1],X[2]=z[2]-q[2],X[3]=z[3]-q[3],X;}function u(X,z,q){return X[0]=z[0]*q[0],X[1]=z[1]*q[1],X[2]=z[2]*q[2],X[3]=z[3]*q[3],X;}function y(X,z,q){return X[0]=z[0]/q[0],X[1]=z[1]/q[1],X[2]=z[2]/q[2],X[3]=z[3]/q[3],X;}function T(X,z){return X[0]=Math.ceil(z[0]),X[1]=Math.ceil(z[1]),X[2]=Math.ceil(z[2]),X[3]=Math.ceil(z[3]),X;}function E(X,z){return X[0]=Math.floor(z[0]),X[1]=Math.floor(z[1]),X[2]=Math.floor(z[2]),X[3]=Math.floor(z[3]),X;}function C(X,z,q){return X[0]=Math.min(z[0],q[0]),X[1]=Math.min(z[1],q[1]),X[2]=Math.min(z[2],q[2]),X[3]=Math.min(z[3],q[3]),X;}function x(X,z,q){return X[0]=Math.max(z[0],q[0]),X[1]=Math.max(z[1],q[1]),X[2]=Math.max(z[2],q[2]),X[3]=Math.max(z[3],q[3]),X;}function I(X,z){return X[0]=Math.round(z[0]),X[1]=Math.round(z[1]),X[2]=Math.round(z[2]),X[3]=Math.round(z[3]),X;}function d(X,z,q){return X[0]=z[0]*q,X[1]=z[1]*q,X[2]=z[2]*q,X[3]=z[3]*q,X;}function v(X,z,q,nt){return X[0]=z[0]+q[0]*nt,X[1]=z[1]+q[1]*nt,X[2]=z[2]+q[2]*nt,X[3]=z[3]+q[3]*nt,X;}function p(X,z){var q=z[0]-X[0],nt=z[1]-X[1],j=z[2]-X[2],Z=z[3]-X[3];return Math.hypot(q,nt,j,Z);}function S(X,z){var q=z[0]-X[0],nt=z[1]-X[1],j=z[2]-X[2],Z=z[3]-X[3];return q*q+nt*nt+j*j+Z*Z;}function A(X){var z=X[0],q=X[1],nt=X[2],j=X[3];return Math.hypot(z,q,nt,j);}function R(X){var z=X[0],q=X[1],nt=X[2],j=X[3];return z*z+q*q+nt*nt+j*j;}function D(X,z){return X[0]=-z[0],X[1]=-z[1],X[2]=-z[2],X[3]=-z[3],X;}function U(X,z){return X[0]=1/z[0],X[1]=1/z[1],X[2]=1/z[2],X[3]=1/z[3],X;}function M(X,z){var q=z[0],nt=z[1],j=z[2],Z=z[3],O=q*q+nt*nt+j*j+Z*Z;return O>0&&(O=1/Math.sqrt(O)),X[0]=q*O,X[1]=nt*O,X[2]=j*O,X[3]=Z*O,X;}function W(X,z){return X[0]*z[0]+X[1]*z[1]+X[2]*z[2]+X[3]*z[3];}function Y(X,z,q,nt){var j=q[0]*nt[1]-q[1]*nt[0],Z=q[0]*nt[2]-q[2]*nt[0],O=q[0]*nt[3]-q[3]*nt[0],L=q[1]*nt[2]-q[2]*nt[1],$=q[1]*nt[3]-q[3]*nt[1],V=q[2]*nt[3]-q[3]*nt[2],rt=z[0],it=z[1],ct=z[2],St=z[3];return X[0]=it*V-ct*$+St*L,X[1]=-(rt*V)+ct*O-St*Z,X[2]=rt*$-it*O+St*j,X[3]=-(rt*L)+it*Z-ct*j,X;}function B(X,z,q,nt){var j=z[0],Z=z[1],O=z[2],L=z[3];return X[0]=j+nt*(q[0]-j),X[1]=Z+nt*(q[1]-Z),X[2]=O+nt*(q[2]-O),X[3]=L+nt*(q[3]-L),X;}function N(X,z){z=z||1;var q,nt,j,Z,O,L;do q=r.RANDOM()*2-1,nt=r.RANDOM()*2-1,O=q*q+nt*nt;while(O>=1);do j=r.RANDOM()*2-1,Z=r.RANDOM()*2-1,L=j*j+Z*Z;while(L>=1);var $=Math.sqrt((1-O)/L);return X[0]=z*q,X[1]=z*nt,X[2]=z*j*$,X[3]=z*Z*$,X;}function G(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=z[3];return X[0]=q[0]*nt+q[4]*j+q[8]*Z+q[12]*O,X[1]=q[1]*nt+q[5]*j+q[9]*Z+q[13]*O,X[2]=q[2]*nt+q[6]*j+q[10]*Z+q[14]*O,X[3]=q[3]*nt+q[7]*j+q[11]*Z+q[15]*O,X;}function J(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=q[0],L=q[1],$=q[2],V=q[3],rt=V*nt+L*Z-$*j,it=V*j+$*nt-O*Z,ct=V*Z+O*j-L*nt,St=-O*nt-L*j-$*Z;return X[0]=rt*V+St*-O+it*-$-ct*-L,X[1]=it*V+St*-L+ct*-O-rt*-$,X[2]=ct*V+St*-$+rt*-L-it*-O,X[3]=z[3],X;}function tt(X){return X[0]=0,X[1]=0,X[2]=0,X[3]=0,X;}function at(X){return"vec4("+X[0]+", "+X[1]+", "+X[2]+", "+X[3]+")";}function ut(X,z){return X[0]===z[0]&&X[1]===z[1]&&X[2]===z[2]&&X[3]===z[3];}function K(X,z){var q=X[0],nt=X[1],j=X[2],Z=X[3],O=z[0],L=z[1],$=z[2],V=z[3];return Math.abs(q-O)<=r.EPSILON*Math.max(1,Math.abs(q),Math.abs(O))&&Math.abs(nt-L)<=r.EPSILON*Math.max(1,Math.abs(nt),Math.abs(L))&&Math.abs(j-$)<=r.EPSILON*Math.max(1,Math.abs(j),Math.abs($))&&Math.abs(Z-V)<=r.EPSILON*Math.max(1,Math.abs(Z),Math.abs(V));}var Q=m,ft=u,gt=y,mt=p,wt=S,ht=A,Nt=R,Rt=function(){var X=n();return function(z,q,nt,j,Z,O){var L,$;for(q||(q=4),nt||(nt=0),j?$=Math.min(j*q+nt,z.length):$=z.length,L=nt;L<$;L+=q)X[0]=z[L],X[1]=z[L+1],X[2]=z[L+2],X[3]=z[L+3],Z(X,X,O),z[L]=X[0],z[L+1]=X[1],z[L+2]=X[2],z[L+3]=X[3];return z;};}();},/* 10 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return c;}),t.d(e,"clone",function(){return l;}),t.d(e,"fromValues",function(){return f;}),t.d(e,"fromRotationTranslationValues",function(){return h;}),t.d(e,"fromRotationTranslation",function(){return m;}),t.d(e,"fromTranslation",function(){return u;}),t.d(e,"fromRotation",function(){return y;}),t.d(e,"fromMat4",function(){return T;}),t.d(e,"copy",function(){return E;}),t.d(e,"identity",function(){return C;}),t.d(e,"set",function(){return x;}),t.d(e,"getReal",function(){return I;}),t.d(e,"getDual",function(){return d;}),t.d(e,"setReal",function(){return v;}),t.d(e,"setDual",function(){return p;}),t.d(e,"getTranslation",function(){return S;}),t.d(e,"translate",function(){return A;}),t.d(e,"rotateX",function(){return R;}),t.d(e,"rotateY",function(){return D;}),t.d(e,"rotateZ",function(){return U;}),t.d(e,"rotateByQuatAppend",function(){return M;}),t.d(e,"rotateByQuatPrepend",function(){return W;}),t.d(e,"rotateAroundAxis",function(){return Y;}),t.d(e,"add",function(){return B;}),t.d(e,"multiply",function(){return N;}),t.d(e,"mul",function(){return G;}),t.d(e,"scale",function(){return J;}),t.d(e,"dot",function(){return tt;}),t.d(e,"lerp",function(){return at;}),t.d(e,"invert",function(){return ut;}),t.d(e,"conjugate",function(){return K;}),t.d(e,"length",function(){return Q;}),t.d(e,"len",function(){return ft;}),t.d(e,"squaredLength",function(){return gt;}),t.d(e,"sqrLen",function(){return mt;}),t.d(e,"normalize",function(){return wt;}),t.d(e,"str",function(){return ht;}),t.d(e,"exactEquals",function(){return Nt;}),t.d(e,"equals",function(){return Rt;});var r=t(2),n=t(7),s=t(6);function c(){var X=new r.ARRAY_TYPE(8);return r.ARRAY_TYPE!=Float32Array&&(X[0]=0,X[1]=0,X[2]=0,X[4]=0,X[5]=0,X[6]=0,X[7]=0),X[3]=1,X;}function l(X){var z=new r.ARRAY_TYPE(8);return z[0]=X[0],z[1]=X[1],z[2]=X[2],z[3]=X[3],z[4]=X[4],z[5]=X[5],z[6]=X[6],z[7]=X[7],z;}function f(X,z,q,nt,j,Z,O,L){var $=new r.ARRAY_TYPE(8);return $[0]=X,$[1]=z,$[2]=q,$[3]=nt,$[4]=j,$[5]=Z,$[6]=O,$[7]=L,$;}function h(X,z,q,nt,j,Z,O){var L=new r.ARRAY_TYPE(8);L[0]=X,L[1]=z,L[2]=q,L[3]=nt;var $=j*0.5,V=Z*0.5,rt=O*0.5;return L[4]=$*nt+V*q-rt*z,L[5]=V*nt+rt*X-$*q,L[6]=rt*nt+$*z-V*X,L[7]=-$*X-V*z-rt*q,L;}function m(X,z,q){var nt=q[0]*0.5,j=q[1]*0.5,Z=q[2]*0.5,O=z[0],L=z[1],$=z[2],V=z[3];return X[0]=O,X[1]=L,X[2]=$,X[3]=V,X[4]=nt*V+j*$-Z*L,X[5]=j*V+Z*O-nt*$,X[6]=Z*V+nt*L-j*O,X[7]=-nt*O-j*L-Z*$,X;}function u(X,z){return X[0]=0,X[1]=0,X[2]=0,X[3]=1,X[4]=z[0]*0.5,X[5]=z[1]*0.5,X[6]=z[2]*0.5,X[7]=0,X;}function y(X,z){return X[0]=z[0],X[1]=z[1],X[2]=z[2],X[3]=z[3],X[4]=0,X[5]=0,X[6]=0,X[7]=0,X;}function T(X,z){var q=n.create();s.getRotation(q,z);var nt=new r.ARRAY_TYPE(3);return s.getTranslation(nt,z),m(X,q,nt),X;}function E(X,z){return X[0]=z[0],X[1]=z[1],X[2]=z[2],X[3]=z[3],X[4]=z[4],X[5]=z[5],X[6]=z[6],X[7]=z[7],X;}function C(X){return X[0]=0,X[1]=0,X[2]=0,X[3]=1,X[4]=0,X[5]=0,X[6]=0,X[7]=0,X;}function x(X,z,q,nt,j,Z,O,L,$){return X[0]=z,X[1]=q,X[2]=nt,X[3]=j,X[4]=Z,X[5]=O,X[6]=L,X[7]=$,X;}var I=n.copy;function d(X,z){return X[0]=z[4],X[1]=z[5],X[2]=z[6],X[3]=z[7],X;}var v=n.copy;function p(X,z){return X[4]=z[0],X[5]=z[1],X[6]=z[2],X[7]=z[3],X;}function S(X,z){var q=z[4],nt=z[5],j=z[6],Z=z[7],O=-z[0],L=-z[1],$=-z[2],V=z[3];return X[0]=(q*V+Z*O+nt*$-j*L)*2,X[1]=(nt*V+Z*L+j*O-q*$)*2,X[2]=(j*V+Z*$+q*L-nt*O)*2,X;}function A(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=z[3],L=q[0]*0.5,$=q[1]*0.5,V=q[2]*0.5,rt=z[4],it=z[5],ct=z[6],St=z[7];return X[0]=nt,X[1]=j,X[2]=Z,X[3]=O,X[4]=O*L+j*V-Z*$+rt,X[5]=O*$+Z*L-nt*V+it,X[6]=O*V+nt*$-j*L+ct,X[7]=-nt*L-j*$-Z*V+St,X;}function R(X,z,q){var nt=-z[0],j=-z[1],Z=-z[2],O=z[3],L=z[4],$=z[5],V=z[6],rt=z[7],it=L*O+rt*nt+$*Z-V*j,ct=$*O+rt*j+V*nt-L*Z,St=V*O+rt*Z+L*j-$*nt,Ct=rt*O-L*nt-$*j-V*Z;return n.rotateX(X,z,q),nt=X[0],j=X[1],Z=X[2],O=X[3],X[4]=it*O+Ct*nt+ct*Z-St*j,X[5]=ct*O+Ct*j+St*nt-it*Z,X[6]=St*O+Ct*Z+it*j-ct*nt,X[7]=Ct*O-it*nt-ct*j-St*Z,X;}function D(X,z,q){var nt=-z[0],j=-z[1],Z=-z[2],O=z[3],L=z[4],$=z[5],V=z[6],rt=z[7],it=L*O+rt*nt+$*Z-V*j,ct=$*O+rt*j+V*nt-L*Z,St=V*O+rt*Z+L*j-$*nt,Ct=rt*O-L*nt-$*j-V*Z;return n.rotateY(X,z,q),nt=X[0],j=X[1],Z=X[2],O=X[3],X[4]=it*O+Ct*nt+ct*Z-St*j,X[5]=ct*O+Ct*j+St*nt-it*Z,X[6]=St*O+Ct*Z+it*j-ct*nt,X[7]=Ct*O-it*nt-ct*j-St*Z,X;}function U(X,z,q){var nt=-z[0],j=-z[1],Z=-z[2],O=z[3],L=z[4],$=z[5],V=z[6],rt=z[7],it=L*O+rt*nt+$*Z-V*j,ct=$*O+rt*j+V*nt-L*Z,St=V*O+rt*Z+L*j-$*nt,Ct=rt*O-L*nt-$*j-V*Z;return n.rotateZ(X,z,q),nt=X[0],j=X[1],Z=X[2],O=X[3],X[4]=it*O+Ct*nt+ct*Z-St*j,X[5]=ct*O+Ct*j+St*nt-it*Z,X[6]=St*O+Ct*Z+it*j-ct*nt,X[7]=Ct*O-it*nt-ct*j-St*Z,X;}function M(X,z,q){var nt=q[0],j=q[1],Z=q[2],O=q[3],L=z[0],$=z[1],V=z[2],rt=z[3];return X[0]=L*O+rt*nt+$*Z-V*j,X[1]=$*O+rt*j+V*nt-L*Z,X[2]=V*O+rt*Z+L*j-$*nt,X[3]=rt*O-L*nt-$*j-V*Z,L=z[4],$=z[5],V=z[6],rt=z[7],X[4]=L*O+rt*nt+$*Z-V*j,X[5]=$*O+rt*j+V*nt-L*Z,X[6]=V*O+rt*Z+L*j-$*nt,X[7]=rt*O-L*nt-$*j-V*Z,X;}function W(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=z[3],L=q[0],$=q[1],V=q[2],rt=q[3];return X[0]=nt*rt+O*L+j*V-Z*$,X[1]=j*rt+O*$+Z*L-nt*V,X[2]=Z*rt+O*V+nt*$-j*L,X[3]=O*rt-nt*L-j*$-Z*V,L=q[4],$=q[5],V=q[6],rt=q[7],X[4]=nt*rt+O*L+j*V-Z*$,X[5]=j*rt+O*$+Z*L-nt*V,X[6]=Z*rt+O*V+nt*$-j*L,X[7]=O*rt-nt*L-j*$-Z*V,X;}function Y(X,z,q,nt){if(Math.abs(nt)<r.EPSILON)return E(X,z);var j=Math.hypot(q[0],q[1],q[2]);nt=nt*0.5;var Z=Math.sin(nt),O=Z*q[0]/j,L=Z*q[1]/j,$=Z*q[2]/j,V=Math.cos(nt),rt=z[0],it=z[1],ct=z[2],St=z[3];X[0]=rt*V+St*O+it*$-ct*L,X[1]=it*V+St*L+ct*O-rt*$,X[2]=ct*V+St*$+rt*L-it*O,X[3]=St*V-rt*O-it*L-ct*$;var Ct=z[4],Mt=z[5],Dt=z[6],At=z[7];return X[4]=Ct*V+At*O+Mt*$-Dt*L,X[5]=Mt*V+At*L+Dt*O-Ct*$,X[6]=Dt*V+At*$+Ct*L-Mt*O,X[7]=At*V-Ct*O-Mt*L-Dt*$,X;}function B(X,z,q){return X[0]=z[0]+q[0],X[1]=z[1]+q[1],X[2]=z[2]+q[2],X[3]=z[3]+q[3],X[4]=z[4]+q[4],X[5]=z[5]+q[5],X[6]=z[6]+q[6],X[7]=z[7]+q[7],X;}function N(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=z[3],L=q[4],$=q[5],V=q[6],rt=q[7],it=z[4],ct=z[5],St=z[6],Ct=z[7],Mt=q[0],Dt=q[1],At=q[2],Ot=q[3];return X[0]=nt*Ot+O*Mt+j*At-Z*Dt,X[1]=j*Ot+O*Dt+Z*Mt-nt*At,X[2]=Z*Ot+O*At+nt*Dt-j*Mt,X[3]=O*Ot-nt*Mt-j*Dt-Z*At,X[4]=nt*rt+O*L+j*V-Z*$+it*Ot+Ct*Mt+ct*At-St*Dt,X[5]=j*rt+O*$+Z*L-nt*V+ct*Ot+Ct*Dt+St*Mt-it*At,X[6]=Z*rt+O*V+nt*$-j*L+St*Ot+Ct*At+it*Dt-ct*Mt,X[7]=O*rt-nt*L-j*$-Z*V+Ct*Ot-it*Mt-ct*Dt-St*At,X;}var G=N;function J(X,z,q){return X[0]=z[0]*q,X[1]=z[1]*q,X[2]=z[2]*q,X[3]=z[3]*q,X[4]=z[4]*q,X[5]=z[5]*q,X[6]=z[6]*q,X[7]=z[7]*q,X;}var tt=n.dot;function at(X,z,q,nt){var j=1-nt;return tt(z,q)<0&&(nt=-nt),X[0]=z[0]*j+q[0]*nt,X[1]=z[1]*j+q[1]*nt,X[2]=z[2]*j+q[2]*nt,X[3]=z[3]*j+q[3]*nt,X[4]=z[4]*j+q[4]*nt,X[5]=z[5]*j+q[5]*nt,X[6]=z[6]*j+q[6]*nt,X[7]=z[7]*j+q[7]*nt,X;}function ut(X,z){var q=gt(z);return X[0]=-z[0]/q,X[1]=-z[1]/q,X[2]=-z[2]/q,X[3]=z[3]/q,X[4]=-z[4]/q,X[5]=-z[5]/q,X[6]=-z[6]/q,X[7]=z[7]/q,X;}function K(X,z){return X[0]=-z[0],X[1]=-z[1],X[2]=-z[2],X[3]=z[3],X[4]=-z[4],X[5]=-z[5],X[6]=-z[6],X[7]=z[7],X;}var Q=n.length,ft=Q,gt=n.squaredLength,mt=gt;function wt(X,z){var q=gt(z);if(q>0){q=Math.sqrt(q);var nt=z[0]/q,j=z[1]/q,Z=z[2]/q,O=z[3]/q,L=z[4],$=z[5],V=z[6],rt=z[7],it=nt*L+j*$+Z*V+O*rt;X[0]=nt,X[1]=j,X[2]=Z,X[3]=O,X[4]=(L-nt*it)/q,X[5]=($-j*it)/q,X[6]=(V-Z*it)/q,X[7]=(rt-O*it)/q;}return X;}function ht(X){return"quat2("+X[0]+", "+X[1]+", "+X[2]+", "+X[3]+", "+X[4]+", "+X[5]+", "+X[6]+", "+X[7]+")";}function Nt(X,z){return X[0]===z[0]&&X[1]===z[1]&&X[2]===z[2]&&X[3]===z[3]&&X[4]===z[4]&&X[5]===z[5]&&X[6]===z[6]&&X[7]===z[7];}function Rt(X,z){var q=X[0],nt=X[1],j=X[2],Z=X[3],O=X[4],L=X[5],$=X[6],V=X[7],rt=z[0],it=z[1],ct=z[2],St=z[3],Ct=z[4],Mt=z[5],Dt=z[6],At=z[7];return Math.abs(q-rt)<=r.EPSILON*Math.max(1,Math.abs(q),Math.abs(rt))&&Math.abs(nt-it)<=r.EPSILON*Math.max(1,Math.abs(nt),Math.abs(it))&&Math.abs(j-ct)<=r.EPSILON*Math.max(1,Math.abs(j),Math.abs(ct))&&Math.abs(Z-St)<=r.EPSILON*Math.max(1,Math.abs(Z),Math.abs(St))&&Math.abs(O-Ct)<=r.EPSILON*Math.max(1,Math.abs(O),Math.abs(Ct))&&Math.abs(L-Mt)<=r.EPSILON*Math.max(1,Math.abs(L),Math.abs(Mt))&&Math.abs($-Dt)<=r.EPSILON*Math.max(1,Math.abs($),Math.abs(Dt))&&Math.abs(V-At)<=r.EPSILON*Math.max(1,Math.abs(V),Math.abs(At));}},/* 11 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"fromValues",function(){return c;}),t.d(e,"copy",function(){return l;}),t.d(e,"set",function(){return f;}),t.d(e,"add",function(){return h;}),t.d(e,"subtract",function(){return m;}),t.d(e,"multiply",function(){return u;}),t.d(e,"divide",function(){return y;}),t.d(e,"ceil",function(){return T;}),t.d(e,"floor",function(){return E;}),t.d(e,"min",function(){return C;}),t.d(e,"max",function(){return x;}),t.d(e,"round",function(){return I;}),t.d(e,"scale",function(){return d;}),t.d(e,"scaleAndAdd",function(){return v;}),t.d(e,"distance",function(){return p;}),t.d(e,"squaredDistance",function(){return S;}),t.d(e,"length",function(){return A;}),t.d(e,"squaredLength",function(){return R;}),t.d(e,"negate",function(){return D;}),t.d(e,"inverse",function(){return U;}),t.d(e,"normalize",function(){return M;}),t.d(e,"dot",function(){return W;}),t.d(e,"cross",function(){return Y;}),t.d(e,"lerp",function(){return B;}),t.d(e,"random",function(){return N;}),t.d(e,"transformMat2",function(){return G;}),t.d(e,"transformMat2d",function(){return J;}),t.d(e,"transformMat3",function(){return tt;}),t.d(e,"transformMat4",function(){return at;}),t.d(e,"rotate",function(){return ut;}),t.d(e,"angle",function(){return K;}),t.d(e,"zero",function(){return Q;}),t.d(e,"str",function(){return ft;}),t.d(e,"exactEquals",function(){return gt;}),t.d(e,"equals",function(){return mt;}),t.d(e,"len",function(){return wt;}),t.d(e,"sub",function(){return ht;}),t.d(e,"mul",function(){return Nt;}),t.d(e,"div",function(){return Rt;}),t.d(e,"dist",function(){return X;}),t.d(e,"sqrDist",function(){return z;}),t.d(e,"sqrLen",function(){return q;}),t.d(e,"forEach",function(){return nt;});var r=t(2);function n(){var j=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(j[0]=0,j[1]=0),j;}function s(j){var Z=new r.ARRAY_TYPE(2);return Z[0]=j[0],Z[1]=j[1],Z;}function c(j,Z){var O=new r.ARRAY_TYPE(2);return O[0]=j,O[1]=Z,O;}function l(j,Z){return j[0]=Z[0],j[1]=Z[1],j;}function f(j,Z,O){return j[0]=Z,j[1]=O,j;}function h(j,Z,O){return j[0]=Z[0]+O[0],j[1]=Z[1]+O[1],j;}function m(j,Z,O){return j[0]=Z[0]-O[0],j[1]=Z[1]-O[1],j;}function u(j,Z,O){return j[0]=Z[0]*O[0],j[1]=Z[1]*O[1],j;}function y(j,Z,O){return j[0]=Z[0]/O[0],j[1]=Z[1]/O[1],j;}function T(j,Z){return j[0]=Math.ceil(Z[0]),j[1]=Math.ceil(Z[1]),j;}function E(j,Z){return j[0]=Math.floor(Z[0]),j[1]=Math.floor(Z[1]),j;}function C(j,Z,O){return j[0]=Math.min(Z[0],O[0]),j[1]=Math.min(Z[1],O[1]),j;}function x(j,Z,O){return j[0]=Math.max(Z[0],O[0]),j[1]=Math.max(Z[1],O[1]),j;}function I(j,Z){return j[0]=Math.round(Z[0]),j[1]=Math.round(Z[1]),j;}function d(j,Z,O){return j[0]=Z[0]*O,j[1]=Z[1]*O,j;}function v(j,Z,O,L){return j[0]=Z[0]+O[0]*L,j[1]=Z[1]+O[1]*L,j;}function p(j,Z){var O=Z[0]-j[0],L=Z[1]-j[1];return Math.hypot(O,L);}function S(j,Z){var O=Z[0]-j[0],L=Z[1]-j[1];return O*O+L*L;}function A(j){var Z=j[0],O=j[1];return Math.hypot(Z,O);}function R(j){var Z=j[0],O=j[1];return Z*Z+O*O;}function D(j,Z){return j[0]=-Z[0],j[1]=-Z[1],j;}function U(j,Z){return j[0]=1/Z[0],j[1]=1/Z[1],j;}function M(j,Z){var O=Z[0],L=Z[1],$=O*O+L*L;return $>0&&($=1/Math.sqrt($)),j[0]=Z[0]*$,j[1]=Z[1]*$,j;}function W(j,Z){return j[0]*Z[0]+j[1]*Z[1];}function Y(j,Z,O){var L=Z[0]*O[1]-Z[1]*O[0];return j[0]=j[1]=0,j[2]=L,j;}function B(j,Z,O,L){var $=Z[0],V=Z[1];return j[0]=$+L*(O[0]-$),j[1]=V+L*(O[1]-V),j;}function N(j,Z){Z=Z||1;var O=r.RANDOM()*2*Math.PI;return j[0]=Math.cos(O)*Z,j[1]=Math.sin(O)*Z,j;}function G(j,Z,O){var L=Z[0],$=Z[1];return j[0]=O[0]*L+O[2]*$,j[1]=O[1]*L+O[3]*$,j;}function J(j,Z,O){var L=Z[0],$=Z[1];return j[0]=O[0]*L+O[2]*$+O[4],j[1]=O[1]*L+O[3]*$+O[5],j;}function tt(j,Z,O){var L=Z[0],$=Z[1];return j[0]=O[0]*L+O[3]*$+O[6],j[1]=O[1]*L+O[4]*$+O[7],j;}function at(j,Z,O){var L=Z[0],$=Z[1];return j[0]=O[0]*L+O[4]*$+O[12],j[1]=O[1]*L+O[5]*$+O[13],j;}function ut(j,Z,O,L){var $=Z[0]-O[0],V=Z[1]-O[1],rt=Math.sin(L),it=Math.cos(L);return j[0]=$*it-V*rt+O[0],j[1]=$*rt+V*it+O[1],j;}function K(j,Z){var O=j[0],L=j[1],$=Z[0],V=Z[1],rt=Math.sqrt(O*O+L*L)*Math.sqrt($*$+V*V),it=rt&&(O*$+L*V)/rt;return Math.acos(Math.min(Math.max(it,-1),1));}function Q(j){return j[0]=0,j[1]=0,j;}function ft(j){return"vec2("+j[0]+", "+j[1]+")";}function gt(j,Z){return j[0]===Z[0]&&j[1]===Z[1];}function mt(j,Z){var O=j[0],L=j[1],$=Z[0],V=Z[1];return Math.abs(O-$)<=r.EPSILON*Math.max(1,Math.abs(O),Math.abs($))&&Math.abs(L-V)<=r.EPSILON*Math.max(1,Math.abs(L),Math.abs(V));}var wt=A,ht=m,Nt=u,Rt=y,X=p,z=S,q=R,nt=function(){var j=n();return function(Z,O,L,$,V,rt){var it,ct;for(O||(O=2),L||(L=0),$?ct=Math.min($*O+L,Z.length):ct=Z.length,it=L;it<ct;it+=O)j[0]=Z[it],j[1]=Z[it+1],V(j,j,rt),Z[it]=j[0],Z[it+1]=j[1];return Z;};}();},/* 12 *//***/function(i,e,t){t.r(e);var r=t(13);t.d(e,"Renderer",function(){return r["default"];});var n=t(40);t.d(e,"Figure2D",function(){return n["default"];});var s=t(56);t.d(e,"Mesh2D",function(){return s["default"];});var c=t(29);t.d(e,"MeshCloud",function(){return c["default"];});var l=t(23);t.d(e,"parseFont",function(){return l["default"];});var f=t(31);t.d(e,"parseColor",function(){return f["default"];});var h=t(21);t.d(e,"ENV",function(){return h["default"];}),t(1).glMatrix.setMatrixArrayType(Array);},/* 13 *//***/function(i,e,t){t.r(e),t.d(e,"default",function(){return U;});var r=t(14),n=t(1),s=t(20),c=t(27),l=t(25),f=t(40),h=t(56),m=t(29),u=t(59),y=t(21),T=t(63);t(1).glMatrix.setMatrixArrayType(Array);var E={autoUpdate:!1,// premultipliedAlpha: true,
|
|
1
|
+
var _excluded=["toolsType"],_excluded2=["callback"],_excluded3=["render"],_excluded4=["render"];function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)o=s[r],t.includes(o)||{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.includes(n))continue;t[n]=r[n];}return t;}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _superPropSet(t,e,o,r,p,f){return _set(_getPrototypeOf(f?t.prototype:t),e,o,r,p);}function set(e,r,t,o){return set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,r,t,o){var f,i=_superPropBase(e,r);if(i){if((f=Object.getOwnPropertyDescriptor(i,r)).set)return f.set.call(o,t),!0;if(!f.writable)return!1;}if(f=Object.getOwnPropertyDescriptor(o,r)){if(!f.writable)return!1;f.value=t,Object.defineProperty(o,r,f);}else _defineProperty(o,r,t);return!0;},set(e,r,t,o);}function _set(e,r,t,o,f){if(!set(e,r,t,o||e)&&f)throw new TypeError("failed to set property");return t;}function _wrapNativeSuper(t){var r="function"==typeof Map?new Map():void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper);}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor);}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t);},_wrapNativeSuper(t);}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o))();return r&&_setPrototypeOf(p,r.prototype),p;}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]");}catch(n){return"function"==typeof t;}}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _toArray(r){return _arrayWithHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableRest();}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n8=0,F=function F(){};return{s:F,n:function n(){return _n8>=r.length?{done:!0}:{done:!1,value:r[_n8++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _asyncIterator(r){var n,t,o,e=2;for("undefined"!=typeof Symbol&&(t=Symbol.asyncIterator,o=Symbol.iterator);e--;){if(t&&null!=(n=r[t]))return n.call(r);if(o&&null!=(n=r[o]))return new AsyncFromSyncIterator(n.call(r));t="@@asyncIterator",o="@@iterator";}throw new TypeError("Object is not async iterable");}function AsyncFromSyncIterator(r){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var n=r.done;return Promise.resolve(r.value).then(function(r){return{value:r,done:n};});}return AsyncFromSyncIterator=function AsyncFromSyncIterator(r){this.s=r,this.n=r.next;},AsyncFromSyncIterator.prototype={s:null,n:null,next:function next(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments));},"return":function _return(r){var n=this.s["return"];return void 0===n?Promise.resolve({value:r,done:!0}):AsyncFromSyncIteratorContinuation(n.apply(this.s,arguments));},"throw":function _throw(r){var n=this.s["return"];return void 0===n?Promise.reject(r):AsyncFromSyncIteratorContinuation(n.apply(this.s,arguments));}},new AsyncFromSyncIterator(r);}var Jy=Object.defineProperty;var Qy=function Qy(i,e,t){return e in i?Jy(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;};var dt=function dt(i,e,t){return Qy(i,_typeof(e)!="symbol"?e+"":e,t);};var be=/******/function(i){var e={};function t(r){if(e[r])return e[r].exports;var n=e[r]={/******/i:r,/******/l:!1,/******/exports:{}/******/};return i[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports;}return t.m=i,t.c=e,t.d=function(r,n,s){t.o(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:s});},t.r=function(r){(typeof Symbol==="undefined"?"undefined":_typeof(Symbol))<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0});},t.t=function(r,n){if(n&1&&(r=t(r)),n&8||n&4&&_typeof(r)=="object"&&r&&r.__esModule)return r;var s=/* @__PURE__ */Object.create(null);if(t.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:r}),n&2&&typeof r!="string")for(var c in r)t.d(s,c,function(l){return r[l];}.bind(null,c));return s;},t.n=function(r){var n=r&&r.__esModule?(/******/function(){return r["default"];}):(/******/function(){return r;});return t.d(n,"a",n),n;},t.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n);},t.p="/js/",t(t.s=0);}([/* 0 *//***/function(i,e,t){t.r(e),t.d(e,"version",function(){return tt;}),t.d(e,"helpers",function(){return G;}),t.d(e,"createElement",function(){return Y;}),t.d(e,"isSpriteNode",function(){return B;}),t.d(e,"registerNode",function(){return N;});var r=t(12);t.d(e,"ENV",function(){return r.ENV;});var n=t(68);t.d(e,"requestAnimationFrame",function(){return n.requestAnimationFrame;}),t.d(e,"cancelAnimationFrame",function(){return n.cancelAnimationFrame;});var s=t(70);t.d(e,"Node",function(){return s["default"];});var c=t(217);t.d(e,"Cloud",function(){return c["default"];});var l=t(219);t.d(e,"Block",function(){return l["default"];});var f=t(224);t.d(e,"Sprite",function(){return f["default"];});var h=t(226);t.d(e,"Path",function(){return h["default"];});var m=t(229);t.d(e,"Rect",function(){return m["default"];});var u=t(231);t.d(e,"Triangle",function(){return u["default"];});var y=t(236);t.d(e,"Parallel",function(){return y["default"];});var T=t(238);t.d(e,"Regular",function(){return T["default"];});var E=t(240);t.d(e,"Star",function(){return E["default"];});var C=t(242);t.d(e,"Ellipse",function(){return C["default"];});var x=t(244);t.d(e,"Arc",function(){return x["default"];});var I=t(246);t.d(e,"Ring",function(){return I["default"];});var d=t(232);t.d(e,"Polyline",function(){return d["default"];});var v=t(248);t.d(e,"Label",function(){return v["default"];});var p=t(250);t.d(e,"Group",function(){return p["default"];});var S=t(286);t.d(e,"Layer",function(){return S["default"];});var A=t(287);t.d(e,"SpriteSvg",function(){return A["default"];});var R=t(289);t.d(e,"LayerWorker",function(){return R["default"];});var D=t(290);t.d(e,"Scene",function(){return D["default"];});var U=t(213),M=t(221);t.d(e,"Color",function(){return M.Color;}),t.d(e,"Gradient",function(){return M.Gradient;});var W=t(72);t(1).glMatrix.setMatrixArrayType(Array);var Y=U["default"].createElement,B=U["default"].isSpriteNode,N=U["default"].registerNode,G={parseColor:M.parseColor,sizeToPixel:W.sizeToPixel,toArray:W.toArray,toString:W.toString,toNumber:W.toNumber};var J;J="3.8.3";var tt=J;},/* 1 *//***/function(i,e,t){t.r(e);var r=t(2);t.d(e,"glMatrix",function(){return r;});var n=t(3);t.d(e,"mat2",function(){return n;});var s=t(4);t.d(e,"mat2d",function(){return s;});var c=t(5);t.d(e,"mat3",function(){return c;});var l=t(6);t.d(e,"mat4",function(){return l;});var f=t(7);t.d(e,"quat",function(){return f;});var h=t(10);t.d(e,"quat2",function(){return h;});var m=t(11);t.d(e,"vec2",function(){return m;});var u=t(8);t.d(e,"vec3",function(){return u;});var y=t(9);t.d(e,"vec4",function(){return y;});},/* 2 *//***/function(i,e,t){t.r(e),t.d(e,"EPSILON",function(){return r;}),t.d(e,"ARRAY_TYPE",function(){return n;}),t.d(e,"RANDOM",function(){return s;}),t.d(e,"setMatrixArrayType",function(){return c;}),t.d(e,"toRadian",function(){return f;}),t.d(e,"equals",function(){return h;});var r=1e-6,n=(typeof Float32Array==="undefined"?"undefined":_typeof(Float32Array))<"u"?Float32Array:Array,s=Math.random;function c(m){n=m;}var l=Math.PI/180;function f(m){return m*l;}function h(m,u){return Math.abs(m-u)<=r*Math.max(1,Math.abs(m),Math.abs(u));}Math.hypot||(Math.hypot=function(){for(var m=0,u=arguments.length;u--;)m+=arguments[u]*arguments[u];return Math.sqrt(m);});},/* 3 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"copy",function(){return c;}),t.d(e,"identity",function(){return l;}),t.d(e,"fromValues",function(){return f;}),t.d(e,"set",function(){return h;}),t.d(e,"transpose",function(){return m;}),t.d(e,"invert",function(){return u;}),t.d(e,"adjoint",function(){return y;}),t.d(e,"determinant",function(){return T;}),t.d(e,"multiply",function(){return E;}),t.d(e,"rotate",function(){return C;}),t.d(e,"scale",function(){return x;}),t.d(e,"fromRotation",function(){return I;}),t.d(e,"fromScaling",function(){return d;}),t.d(e,"str",function(){return v;}),t.d(e,"frob",function(){return p;}),t.d(e,"LDU",function(){return S;}),t.d(e,"add",function(){return A;}),t.d(e,"subtract",function(){return R;}),t.d(e,"exactEquals",function(){return D;}),t.d(e,"equals",function(){return U;}),t.d(e,"multiplyScalar",function(){return M;}),t.d(e,"multiplyScalarAndAdd",function(){return W;}),t.d(e,"mul",function(){return Y;}),t.d(e,"sub",function(){return B;});var r=t(2);function n(){var N=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(N[1]=0,N[2]=0),N[0]=1,N[3]=1,N;}function s(N){var G=new r.ARRAY_TYPE(4);return G[0]=N[0],G[1]=N[1],G[2]=N[2],G[3]=N[3],G;}function c(N,G){return N[0]=G[0],N[1]=G[1],N[2]=G[2],N[3]=G[3],N;}function l(N){return N[0]=1,N[1]=0,N[2]=0,N[3]=1,N;}function f(N,G,J,tt){var at=new r.ARRAY_TYPE(4);return at[0]=N,at[1]=G,at[2]=J,at[3]=tt,at;}function h(N,G,J,tt,at){return N[0]=G,N[1]=J,N[2]=tt,N[3]=at,N;}function m(N,G){if(N===G){var J=G[1];N[1]=G[2],N[2]=J;}else N[0]=G[0],N[1]=G[2],N[2]=G[1],N[3]=G[3];return N;}function u(N,G){var J=G[0],tt=G[1],at=G[2],ut=G[3],K=J*ut-at*tt;return K?(K=1/K,N[0]=ut*K,N[1]=-tt*K,N[2]=-at*K,N[3]=J*K,N):null;}function y(N,G){var J=G[0];return N[0]=G[3],N[1]=-G[1],N[2]=-G[2],N[3]=J,N;}function T(N){return N[0]*N[3]-N[2]*N[1];}function E(N,G,J){var tt=G[0],at=G[1],ut=G[2],K=G[3],Q=J[0],ft=J[1],gt=J[2],mt=J[3];return N[0]=tt*Q+ut*ft,N[1]=at*Q+K*ft,N[2]=tt*gt+ut*mt,N[3]=at*gt+K*mt,N;}function C(N,G,J){var tt=G[0],at=G[1],ut=G[2],K=G[3],Q=Math.sin(J),ft=Math.cos(J);return N[0]=tt*ft+ut*Q,N[1]=at*ft+K*Q,N[2]=tt*-Q+ut*ft,N[3]=at*-Q+K*ft,N;}function x(N,G,J){var tt=G[0],at=G[1],ut=G[2],K=G[3],Q=J[0],ft=J[1];return N[0]=tt*Q,N[1]=at*Q,N[2]=ut*ft,N[3]=K*ft,N;}function I(N,G){var J=Math.sin(G),tt=Math.cos(G);return N[0]=tt,N[1]=J,N[2]=-J,N[3]=tt,N;}function d(N,G){return N[0]=G[0],N[1]=0,N[2]=0,N[3]=G[1],N;}function v(N){return"mat2("+N[0]+", "+N[1]+", "+N[2]+", "+N[3]+")";}function p(N){return Math.hypot(N[0],N[1],N[2],N[3]);}function S(N,G,J,tt){return N[2]=tt[2]/tt[0],J[0]=tt[0],J[1]=tt[1],J[3]=tt[3]-N[2]*J[1],[N,G,J];}function A(N,G,J){return N[0]=G[0]+J[0],N[1]=G[1]+J[1],N[2]=G[2]+J[2],N[3]=G[3]+J[3],N;}function R(N,G,J){return N[0]=G[0]-J[0],N[1]=G[1]-J[1],N[2]=G[2]-J[2],N[3]=G[3]-J[3],N;}function D(N,G){return N[0]===G[0]&&N[1]===G[1]&&N[2]===G[2]&&N[3]===G[3];}function U(N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=G[0],Q=G[1],ft=G[2],gt=G[3];return Math.abs(J-K)<=r.EPSILON*Math.max(1,Math.abs(J),Math.abs(K))&&Math.abs(tt-Q)<=r.EPSILON*Math.max(1,Math.abs(tt),Math.abs(Q))&&Math.abs(at-ft)<=r.EPSILON*Math.max(1,Math.abs(at),Math.abs(ft))&&Math.abs(ut-gt)<=r.EPSILON*Math.max(1,Math.abs(ut),Math.abs(gt));}function M(N,G,J){return N[0]=G[0]*J,N[1]=G[1]*J,N[2]=G[2]*J,N[3]=G[3]*J,N;}function W(N,G,J,tt){return N[0]=G[0]+J[0]*tt,N[1]=G[1]+J[1]*tt,N[2]=G[2]+J[2]*tt,N[3]=G[3]+J[3]*tt,N;}var Y=E,B=R;},/* 4 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"copy",function(){return c;}),t.d(e,"identity",function(){return l;}),t.d(e,"fromValues",function(){return f;}),t.d(e,"set",function(){return h;}),t.d(e,"invert",function(){return m;}),t.d(e,"determinant",function(){return u;}),t.d(e,"multiply",function(){return y;}),t.d(e,"rotate",function(){return T;}),t.d(e,"scale",function(){return E;}),t.d(e,"translate",function(){return C;}),t.d(e,"fromRotation",function(){return x;}),t.d(e,"fromScaling",function(){return I;}),t.d(e,"fromTranslation",function(){return d;}),t.d(e,"str",function(){return v;}),t.d(e,"frob",function(){return p;}),t.d(e,"add",function(){return S;}),t.d(e,"subtract",function(){return A;}),t.d(e,"multiplyScalar",function(){return R;}),t.d(e,"multiplyScalarAndAdd",function(){return D;}),t.d(e,"exactEquals",function(){return U;}),t.d(e,"equals",function(){return M;}),t.d(e,"mul",function(){return W;}),t.d(e,"sub",function(){return Y;});var r=t(2);function n(){var B=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(B[1]=0,B[2]=0,B[4]=0,B[5]=0),B[0]=1,B[3]=1,B;}function s(B){var N=new r.ARRAY_TYPE(6);return N[0]=B[0],N[1]=B[1],N[2]=B[2],N[3]=B[3],N[4]=B[4],N[5]=B[5],N;}function c(B,N){return B[0]=N[0],B[1]=N[1],B[2]=N[2],B[3]=N[3],B[4]=N[4],B[5]=N[5],B;}function l(B){return B[0]=1,B[1]=0,B[2]=0,B[3]=1,B[4]=0,B[5]=0,B;}function f(B,N,G,J,tt,at){var ut=new r.ARRAY_TYPE(6);return ut[0]=B,ut[1]=N,ut[2]=G,ut[3]=J,ut[4]=tt,ut[5]=at,ut;}function h(B,N,G,J,tt,at,ut){return B[0]=N,B[1]=G,B[2]=J,B[3]=tt,B[4]=at,B[5]=ut,B;}function m(B,N){var G=N[0],J=N[1],tt=N[2],at=N[3],ut=N[4],K=N[5],Q=G*at-J*tt;return Q?(Q=1/Q,B[0]=at*Q,B[1]=-J*Q,B[2]=-tt*Q,B[3]=G*Q,B[4]=(tt*K-at*ut)*Q,B[5]=(J*ut-G*K)*Q,B):null;}function u(B){return B[0]*B[3]-B[1]*B[2];}function y(B,N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=N[4],Q=N[5],ft=G[0],gt=G[1],mt=G[2],wt=G[3],ht=G[4],Nt=G[5];return B[0]=J*ft+at*gt,B[1]=tt*ft+ut*gt,B[2]=J*mt+at*wt,B[3]=tt*mt+ut*wt,B[4]=J*ht+at*Nt+K,B[5]=tt*ht+ut*Nt+Q,B;}function T(B,N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=N[4],Q=N[5],ft=Math.sin(G),gt=Math.cos(G);return B[0]=J*gt+at*ft,B[1]=tt*gt+ut*ft,B[2]=J*-ft+at*gt,B[3]=tt*-ft+ut*gt,B[4]=K,B[5]=Q,B;}function E(B,N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=N[4],Q=N[5],ft=G[0],gt=G[1];return B[0]=J*ft,B[1]=tt*ft,B[2]=at*gt,B[3]=ut*gt,B[4]=K,B[5]=Q,B;}function C(B,N,G){var J=N[0],tt=N[1],at=N[2],ut=N[3],K=N[4],Q=N[5],ft=G[0],gt=G[1];return B[0]=J,B[1]=tt,B[2]=at,B[3]=ut,B[4]=J*ft+at*gt+K,B[5]=tt*ft+ut*gt+Q,B;}function x(B,N){var G=Math.sin(N),J=Math.cos(N);return B[0]=J,B[1]=G,B[2]=-G,B[3]=J,B[4]=0,B[5]=0,B;}function I(B,N){return B[0]=N[0],B[1]=0,B[2]=0,B[3]=N[1],B[4]=0,B[5]=0,B;}function d(B,N){return B[0]=1,B[1]=0,B[2]=0,B[3]=1,B[4]=N[0],B[5]=N[1],B;}function v(B){return"mat2d("+B[0]+", "+B[1]+", "+B[2]+", "+B[3]+", "+B[4]+", "+B[5]+")";}function p(B){return Math.hypot(B[0],B[1],B[2],B[3],B[4],B[5],1);}function S(B,N,G){return B[0]=N[0]+G[0],B[1]=N[1]+G[1],B[2]=N[2]+G[2],B[3]=N[3]+G[3],B[4]=N[4]+G[4],B[5]=N[5]+G[5],B;}function A(B,N,G){return B[0]=N[0]-G[0],B[1]=N[1]-G[1],B[2]=N[2]-G[2],B[3]=N[3]-G[3],B[4]=N[4]-G[4],B[5]=N[5]-G[5],B;}function R(B,N,G){return B[0]=N[0]*G,B[1]=N[1]*G,B[2]=N[2]*G,B[3]=N[3]*G,B[4]=N[4]*G,B[5]=N[5]*G,B;}function D(B,N,G,J){return B[0]=N[0]+G[0]*J,B[1]=N[1]+G[1]*J,B[2]=N[2]+G[2]*J,B[3]=N[3]+G[3]*J,B[4]=N[4]+G[4]*J,B[5]=N[5]+G[5]*J,B;}function U(B,N){return B[0]===N[0]&&B[1]===N[1]&&B[2]===N[2]&&B[3]===N[3]&&B[4]===N[4]&&B[5]===N[5];}function M(B,N){var G=B[0],J=B[1],tt=B[2],at=B[3],ut=B[4],K=B[5],Q=N[0],ft=N[1],gt=N[2],mt=N[3],wt=N[4],ht=N[5];return Math.abs(G-Q)<=r.EPSILON*Math.max(1,Math.abs(G),Math.abs(Q))&&Math.abs(J-ft)<=r.EPSILON*Math.max(1,Math.abs(J),Math.abs(ft))&&Math.abs(tt-gt)<=r.EPSILON*Math.max(1,Math.abs(tt),Math.abs(gt))&&Math.abs(at-mt)<=r.EPSILON*Math.max(1,Math.abs(at),Math.abs(mt))&&Math.abs(ut-wt)<=r.EPSILON*Math.max(1,Math.abs(ut),Math.abs(wt))&&Math.abs(K-ht)<=r.EPSILON*Math.max(1,Math.abs(K),Math.abs(ht));}var W=y,Y=A;},/* 5 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"fromMat4",function(){return s;}),t.d(e,"clone",function(){return c;}),t.d(e,"copy",function(){return l;}),t.d(e,"fromValues",function(){return f;}),t.d(e,"set",function(){return h;}),t.d(e,"identity",function(){return m;}),t.d(e,"transpose",function(){return u;}),t.d(e,"invert",function(){return y;}),t.d(e,"adjoint",function(){return T;}),t.d(e,"determinant",function(){return E;}),t.d(e,"multiply",function(){return C;}),t.d(e,"translate",function(){return x;}),t.d(e,"rotate",function(){return I;}),t.d(e,"scale",function(){return d;}),t.d(e,"fromTranslation",function(){return v;}),t.d(e,"fromRotation",function(){return p;}),t.d(e,"fromScaling",function(){return S;}),t.d(e,"fromMat2d",function(){return A;}),t.d(e,"fromQuat",function(){return R;}),t.d(e,"normalFromMat4",function(){return D;}),t.d(e,"projection",function(){return U;}),t.d(e,"str",function(){return M;}),t.d(e,"frob",function(){return W;}),t.d(e,"add",function(){return Y;}),t.d(e,"subtract",function(){return B;}),t.d(e,"multiplyScalar",function(){return N;}),t.d(e,"multiplyScalarAndAdd",function(){return G;}),t.d(e,"exactEquals",function(){return J;}),t.d(e,"equals",function(){return tt;}),t.d(e,"mul",function(){return at;}),t.d(e,"sub",function(){return ut;});var r=t(2);function n(){var K=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(K[1]=0,K[2]=0,K[3]=0,K[5]=0,K[6]=0,K[7]=0),K[0]=1,K[4]=1,K[8]=1,K;}function s(K,Q){return K[0]=Q[0],K[1]=Q[1],K[2]=Q[2],K[3]=Q[4],K[4]=Q[5],K[5]=Q[6],K[6]=Q[8],K[7]=Q[9],K[8]=Q[10],K;}function c(K){var Q=new r.ARRAY_TYPE(9);return Q[0]=K[0],Q[1]=K[1],Q[2]=K[2],Q[3]=K[3],Q[4]=K[4],Q[5]=K[5],Q[6]=K[6],Q[7]=K[7],Q[8]=K[8],Q;}function l(K,Q){return K[0]=Q[0],K[1]=Q[1],K[2]=Q[2],K[3]=Q[3],K[4]=Q[4],K[5]=Q[5],K[6]=Q[6],K[7]=Q[7],K[8]=Q[8],K;}function f(K,Q,ft,gt,mt,wt,ht,Nt,Rt){var X=new r.ARRAY_TYPE(9);return X[0]=K,X[1]=Q,X[2]=ft,X[3]=gt,X[4]=mt,X[5]=wt,X[6]=ht,X[7]=Nt,X[8]=Rt,X;}function h(K,Q,ft,gt,mt,wt,ht,Nt,Rt,X){return K[0]=Q,K[1]=ft,K[2]=gt,K[3]=mt,K[4]=wt,K[5]=ht,K[6]=Nt,K[7]=Rt,K[8]=X,K;}function m(K){return K[0]=1,K[1]=0,K[2]=0,K[3]=0,K[4]=1,K[5]=0,K[6]=0,K[7]=0,K[8]=1,K;}function u(K,Q){if(K===Q){var ft=Q[1],gt=Q[2],mt=Q[5];K[1]=Q[3],K[2]=Q[6],K[3]=ft,K[5]=Q[7],K[6]=gt,K[7]=mt;}else K[0]=Q[0],K[1]=Q[3],K[2]=Q[6],K[3]=Q[1],K[4]=Q[4],K[5]=Q[7],K[6]=Q[2],K[7]=Q[5],K[8]=Q[8];return K;}function y(K,Q){var ft=Q[0],gt=Q[1],mt=Q[2],wt=Q[3],ht=Q[4],Nt=Q[5],Rt=Q[6],X=Q[7],z=Q[8],q=z*ht-Nt*X,nt=-z*wt+Nt*Rt,j=X*wt-ht*Rt,Z=ft*q+gt*nt+mt*j;return Z?(Z=1/Z,K[0]=q*Z,K[1]=(-z*gt+mt*X)*Z,K[2]=(Nt*gt-mt*ht)*Z,K[3]=nt*Z,K[4]=(z*ft-mt*Rt)*Z,K[5]=(-Nt*ft+mt*wt)*Z,K[6]=j*Z,K[7]=(-X*ft+gt*Rt)*Z,K[8]=(ht*ft-gt*wt)*Z,K):null;}function T(K,Q){var ft=Q[0],gt=Q[1],mt=Q[2],wt=Q[3],ht=Q[4],Nt=Q[5],Rt=Q[6],X=Q[7],z=Q[8];return K[0]=ht*z-Nt*X,K[1]=mt*X-gt*z,K[2]=gt*Nt-mt*ht,K[3]=Nt*Rt-wt*z,K[4]=ft*z-mt*Rt,K[5]=mt*wt-ft*Nt,K[6]=wt*X-ht*Rt,K[7]=gt*Rt-ft*X,K[8]=ft*ht-gt*wt,K;}function E(K){var Q=K[0],ft=K[1],gt=K[2],mt=K[3],wt=K[4],ht=K[5],Nt=K[6],Rt=K[7],X=K[8];return Q*(X*wt-ht*Rt)+ft*(-X*mt+ht*Nt)+gt*(Rt*mt-wt*Nt);}function C(K,Q,ft){var gt=Q[0],mt=Q[1],wt=Q[2],ht=Q[3],Nt=Q[4],Rt=Q[5],X=Q[6],z=Q[7],q=Q[8],nt=ft[0],j=ft[1],Z=ft[2],O=ft[3],L=ft[4],$=ft[5],V=ft[6],rt=ft[7],it=ft[8];return K[0]=nt*gt+j*ht+Z*X,K[1]=nt*mt+j*Nt+Z*z,K[2]=nt*wt+j*Rt+Z*q,K[3]=O*gt+L*ht+$*X,K[4]=O*mt+L*Nt+$*z,K[5]=O*wt+L*Rt+$*q,K[6]=V*gt+rt*ht+it*X,K[7]=V*mt+rt*Nt+it*z,K[8]=V*wt+rt*Rt+it*q,K;}function x(K,Q,ft){var gt=Q[0],mt=Q[1],wt=Q[2],ht=Q[3],Nt=Q[4],Rt=Q[5],X=Q[6],z=Q[7],q=Q[8],nt=ft[0],j=ft[1];return K[0]=gt,K[1]=mt,K[2]=wt,K[3]=ht,K[4]=Nt,K[5]=Rt,K[6]=nt*gt+j*ht+X,K[7]=nt*mt+j*Nt+z,K[8]=nt*wt+j*Rt+q,K;}function I(K,Q,ft){var gt=Q[0],mt=Q[1],wt=Q[2],ht=Q[3],Nt=Q[4],Rt=Q[5],X=Q[6],z=Q[7],q=Q[8],nt=Math.sin(ft),j=Math.cos(ft);return K[0]=j*gt+nt*ht,K[1]=j*mt+nt*Nt,K[2]=j*wt+nt*Rt,K[3]=j*ht-nt*gt,K[4]=j*Nt-nt*mt,K[5]=j*Rt-nt*wt,K[6]=X,K[7]=z,K[8]=q,K;}function d(K,Q,ft){var gt=ft[0],mt=ft[1];return K[0]=gt*Q[0],K[1]=gt*Q[1],K[2]=gt*Q[2],K[3]=mt*Q[3],K[4]=mt*Q[4],K[5]=mt*Q[5],K[6]=Q[6],K[7]=Q[7],K[8]=Q[8],K;}function v(K,Q){return K[0]=1,K[1]=0,K[2]=0,K[3]=0,K[4]=1,K[5]=0,K[6]=Q[0],K[7]=Q[1],K[8]=1,K;}function p(K,Q){var ft=Math.sin(Q),gt=Math.cos(Q);return K[0]=gt,K[1]=ft,K[2]=0,K[3]=-ft,K[4]=gt,K[5]=0,K[6]=0,K[7]=0,K[8]=1,K;}function S(K,Q){return K[0]=Q[0],K[1]=0,K[2]=0,K[3]=0,K[4]=Q[1],K[5]=0,K[6]=0,K[7]=0,K[8]=1,K;}function A(K,Q){return K[0]=Q[0],K[1]=Q[1],K[2]=0,K[3]=Q[2],K[4]=Q[3],K[5]=0,K[6]=Q[4],K[7]=Q[5],K[8]=1,K;}function R(K,Q){var ft=Q[0],gt=Q[1],mt=Q[2],wt=Q[3],ht=ft+ft,Nt=gt+gt,Rt=mt+mt,X=ft*ht,z=gt*ht,q=gt*Nt,nt=mt*ht,j=mt*Nt,Z=mt*Rt,O=wt*ht,L=wt*Nt,$=wt*Rt;return K[0]=1-q-Z,K[3]=z-$,K[6]=nt+L,K[1]=z+$,K[4]=1-X-Z,K[7]=j-O,K[2]=nt-L,K[5]=j+O,K[8]=1-X-q,K;}function D(K,Q){var ft=Q[0],gt=Q[1],mt=Q[2],wt=Q[3],ht=Q[4],Nt=Q[5],Rt=Q[6],X=Q[7],z=Q[8],q=Q[9],nt=Q[10],j=Q[11],Z=Q[12],O=Q[13],L=Q[14],$=Q[15],V=ft*Nt-gt*ht,rt=ft*Rt-mt*ht,it=ft*X-wt*ht,ct=gt*Rt-mt*Nt,St=gt*X-wt*Nt,Ct=mt*X-wt*Rt,Mt=z*O-q*Z,Dt=z*L-nt*Z,At=z*$-j*Z,Ot=q*L-nt*O,Lt=q*$-j*O,Yt=nt*$-j*L,zt=V*Yt-rt*Lt+it*Ot+ct*At-St*Dt+Ct*Mt;return zt?(zt=1/zt,K[0]=(Nt*Yt-Rt*Lt+X*Ot)*zt,K[1]=(Rt*At-ht*Yt-X*Dt)*zt,K[2]=(ht*Lt-Nt*At+X*Mt)*zt,K[3]=(mt*Lt-gt*Yt-wt*Ot)*zt,K[4]=(ft*Yt-mt*At+wt*Dt)*zt,K[5]=(gt*At-ft*Lt-wt*Mt)*zt,K[6]=(O*Ct-L*St+$*ct)*zt,K[7]=(L*it-Z*Ct-$*rt)*zt,K[8]=(Z*St-O*it+$*V)*zt,K):null;}function U(K,Q,ft){return K[0]=2/Q,K[1]=0,K[2]=0,K[3]=0,K[4]=-2/ft,K[5]=0,K[6]=-1,K[7]=1,K[8]=1,K;}function M(K){return"mat3("+K[0]+", "+K[1]+", "+K[2]+", "+K[3]+", "+K[4]+", "+K[5]+", "+K[6]+", "+K[7]+", "+K[8]+")";}function W(K){return Math.hypot(K[0],K[1],K[2],K[3],K[4],K[5],K[6],K[7],K[8]);}function Y(K,Q,ft){return K[0]=Q[0]+ft[0],K[1]=Q[1]+ft[1],K[2]=Q[2]+ft[2],K[3]=Q[3]+ft[3],K[4]=Q[4]+ft[4],K[5]=Q[5]+ft[5],K[6]=Q[6]+ft[6],K[7]=Q[7]+ft[7],K[8]=Q[8]+ft[8],K;}function B(K,Q,ft){return K[0]=Q[0]-ft[0],K[1]=Q[1]-ft[1],K[2]=Q[2]-ft[2],K[3]=Q[3]-ft[3],K[4]=Q[4]-ft[4],K[5]=Q[5]-ft[5],K[6]=Q[6]-ft[6],K[7]=Q[7]-ft[7],K[8]=Q[8]-ft[8],K;}function N(K,Q,ft){return K[0]=Q[0]*ft,K[1]=Q[1]*ft,K[2]=Q[2]*ft,K[3]=Q[3]*ft,K[4]=Q[4]*ft,K[5]=Q[5]*ft,K[6]=Q[6]*ft,K[7]=Q[7]*ft,K[8]=Q[8]*ft,K;}function G(K,Q,ft,gt){return K[0]=Q[0]+ft[0]*gt,K[1]=Q[1]+ft[1]*gt,K[2]=Q[2]+ft[2]*gt,K[3]=Q[3]+ft[3]*gt,K[4]=Q[4]+ft[4]*gt,K[5]=Q[5]+ft[5]*gt,K[6]=Q[6]+ft[6]*gt,K[7]=Q[7]+ft[7]*gt,K[8]=Q[8]+ft[8]*gt,K;}function J(K,Q){return K[0]===Q[0]&&K[1]===Q[1]&&K[2]===Q[2]&&K[3]===Q[3]&&K[4]===Q[4]&&K[5]===Q[5]&&K[6]===Q[6]&&K[7]===Q[7]&&K[8]===Q[8];}function tt(K,Q){var ft=K[0],gt=K[1],mt=K[2],wt=K[3],ht=K[4],Nt=K[5],Rt=K[6],X=K[7],z=K[8],q=Q[0],nt=Q[1],j=Q[2],Z=Q[3],O=Q[4],L=Q[5],$=Q[6],V=Q[7],rt=Q[8];return Math.abs(ft-q)<=r.EPSILON*Math.max(1,Math.abs(ft),Math.abs(q))&&Math.abs(gt-nt)<=r.EPSILON*Math.max(1,Math.abs(gt),Math.abs(nt))&&Math.abs(mt-j)<=r.EPSILON*Math.max(1,Math.abs(mt),Math.abs(j))&&Math.abs(wt-Z)<=r.EPSILON*Math.max(1,Math.abs(wt),Math.abs(Z))&&Math.abs(ht-O)<=r.EPSILON*Math.max(1,Math.abs(ht),Math.abs(O))&&Math.abs(Nt-L)<=r.EPSILON*Math.max(1,Math.abs(Nt),Math.abs(L))&&Math.abs(Rt-$)<=r.EPSILON*Math.max(1,Math.abs(Rt),Math.abs($))&&Math.abs(X-V)<=r.EPSILON*Math.max(1,Math.abs(X),Math.abs(V))&&Math.abs(z-rt)<=r.EPSILON*Math.max(1,Math.abs(z),Math.abs(rt));}var at=C,ut=B;},/* 6 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"copy",function(){return c;}),t.d(e,"fromValues",function(){return l;}),t.d(e,"set",function(){return f;}),t.d(e,"identity",function(){return h;}),t.d(e,"transpose",function(){return m;}),t.d(e,"invert",function(){return u;}),t.d(e,"adjoint",function(){return y;}),t.d(e,"determinant",function(){return T;}),t.d(e,"multiply",function(){return E;}),t.d(e,"translate",function(){return C;}),t.d(e,"scale",function(){return x;}),t.d(e,"rotate",function(){return I;}),t.d(e,"rotateX",function(){return d;}),t.d(e,"rotateY",function(){return v;}),t.d(e,"rotateZ",function(){return p;}),t.d(e,"fromTranslation",function(){return S;}),t.d(e,"fromScaling",function(){return A;}),t.d(e,"fromRotation",function(){return R;}),t.d(e,"fromXRotation",function(){return D;}),t.d(e,"fromYRotation",function(){return U;}),t.d(e,"fromZRotation",function(){return M;}),t.d(e,"fromRotationTranslation",function(){return W;}),t.d(e,"fromQuat2",function(){return Y;}),t.d(e,"getTranslation",function(){return B;}),t.d(e,"getScaling",function(){return N;}),t.d(e,"getRotation",function(){return G;}),t.d(e,"fromRotationTranslationScale",function(){return J;}),t.d(e,"fromRotationTranslationScaleOrigin",function(){return tt;}),t.d(e,"fromQuat",function(){return at;}),t.d(e,"frustum",function(){return ut;}),t.d(e,"perspective",function(){return K;}),t.d(e,"perspectiveFromFieldOfView",function(){return Q;}),t.d(e,"ortho",function(){return ft;}),t.d(e,"lookAt",function(){return gt;}),t.d(e,"targetTo",function(){return mt;}),t.d(e,"str",function(){return wt;}),t.d(e,"frob",function(){return ht;}),t.d(e,"add",function(){return Nt;}),t.d(e,"subtract",function(){return Rt;}),t.d(e,"multiplyScalar",function(){return X;}),t.d(e,"multiplyScalarAndAdd",function(){return z;}),t.d(e,"exactEquals",function(){return q;}),t.d(e,"equals",function(){return nt;}),t.d(e,"mul",function(){return j;}),t.d(e,"sub",function(){return Z;});var r=t(2);function n(){var O=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[11]=0,O[12]=0,O[13]=0,O[14]=0),O[0]=1,O[5]=1,O[10]=1,O[15]=1,O;}function s(O){var L=new r.ARRAY_TYPE(16);return L[0]=O[0],L[1]=O[1],L[2]=O[2],L[3]=O[3],L[4]=O[4],L[5]=O[5],L[6]=O[6],L[7]=O[7],L[8]=O[8],L[9]=O[9],L[10]=O[10],L[11]=O[11],L[12]=O[12],L[13]=O[13],L[14]=O[14],L[15]=O[15],L;}function c(O,L){return O[0]=L[0],O[1]=L[1],O[2]=L[2],O[3]=L[3],O[4]=L[4],O[5]=L[5],O[6]=L[6],O[7]=L[7],O[8]=L[8],O[9]=L[9],O[10]=L[10],O[11]=L[11],O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15],O;}function l(O,L,$,V,rt,it,ct,St,Ct,Mt,Dt,At,Ot,Lt,Yt,zt){var Wt=new r.ARRAY_TYPE(16);return Wt[0]=O,Wt[1]=L,Wt[2]=$,Wt[3]=V,Wt[4]=rt,Wt[5]=it,Wt[6]=ct,Wt[7]=St,Wt[8]=Ct,Wt[9]=Mt,Wt[10]=Dt,Wt[11]=At,Wt[12]=Ot,Wt[13]=Lt,Wt[14]=Yt,Wt[15]=zt,Wt;}function f(O,L,$,V,rt,it,ct,St,Ct,Mt,Dt,At,Ot,Lt,Yt,zt,Wt){return O[0]=L,O[1]=$,O[2]=V,O[3]=rt,O[4]=it,O[5]=ct,O[6]=St,O[7]=Ct,O[8]=Mt,O[9]=Dt,O[10]=At,O[11]=Ot,O[12]=Lt,O[13]=Yt,O[14]=zt,O[15]=Wt,O;}function h(O){return O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=1,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=1,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function m(O,L){if(O===L){var $=L[1],V=L[2],rt=L[3],it=L[6],ct=L[7],St=L[11];O[1]=L[4],O[2]=L[8],O[3]=L[12],O[4]=$,O[6]=L[9],O[7]=L[13],O[8]=V,O[9]=it,O[11]=L[14],O[12]=rt,O[13]=ct,O[14]=St;}else O[0]=L[0],O[1]=L[4],O[2]=L[8],O[3]=L[12],O[4]=L[1],O[5]=L[5],O[6]=L[9],O[7]=L[13],O[8]=L[2],O[9]=L[6],O[10]=L[10],O[11]=L[14],O[12]=L[3],O[13]=L[7],O[14]=L[11],O[15]=L[15];return O;}function u(O,L){var $=L[0],V=L[1],rt=L[2],it=L[3],ct=L[4],St=L[5],Ct=L[6],Mt=L[7],Dt=L[8],At=L[9],Ot=L[10],Lt=L[11],Yt=L[12],zt=L[13],Wt=L[14],Qt=L[15],ue=$*St-V*ct,ie=$*Ct-rt*ct,ne=$*Mt-it*ct,ae=V*Ct-rt*St,se=V*Mt-it*St,je=rt*Mt-it*Ct,We=Dt*zt-At*Yt,Xe=Dt*Wt-Ot*Yt,Fe=Dt*Qt-Lt*Yt,Ge=At*Wt-Ot*zt,Ke=At*Qt-Lt*zt,Je=Ot*Qt-Lt*Wt,Ie=ue*Je-ie*Ke+ne*Ge+ae*Fe-se*Xe+je*We;return Ie?(Ie=1/Ie,O[0]=(St*Je-Ct*Ke+Mt*Ge)*Ie,O[1]=(rt*Ke-V*Je-it*Ge)*Ie,O[2]=(zt*je-Wt*se+Qt*ae)*Ie,O[3]=(Ot*se-At*je-Lt*ae)*Ie,O[4]=(Ct*Fe-ct*Je-Mt*Xe)*Ie,O[5]=($*Je-rt*Fe+it*Xe)*Ie,O[6]=(Wt*ne-Yt*je-Qt*ie)*Ie,O[7]=(Dt*je-Ot*ne+Lt*ie)*Ie,O[8]=(ct*Ke-St*Fe+Mt*We)*Ie,O[9]=(V*Fe-$*Ke-it*We)*Ie,O[10]=(Yt*se-zt*ne+Qt*ue)*Ie,O[11]=(At*ne-Dt*se-Lt*ue)*Ie,O[12]=(St*Xe-ct*Ge-Ct*We)*Ie,O[13]=($*Ge-V*Xe+rt*We)*Ie,O[14]=(zt*ie-Yt*ae-Wt*ue)*Ie,O[15]=(Dt*ae-At*ie+Ot*ue)*Ie,O):null;}function y(O,L){var $=L[0],V=L[1],rt=L[2],it=L[3],ct=L[4],St=L[5],Ct=L[6],Mt=L[7],Dt=L[8],At=L[9],Ot=L[10],Lt=L[11],Yt=L[12],zt=L[13],Wt=L[14],Qt=L[15];return O[0]=St*(Ot*Qt-Lt*Wt)-At*(Ct*Qt-Mt*Wt)+zt*(Ct*Lt-Mt*Ot),O[1]=-(V*(Ot*Qt-Lt*Wt)-At*(rt*Qt-it*Wt)+zt*(rt*Lt-it*Ot)),O[2]=V*(Ct*Qt-Mt*Wt)-St*(rt*Qt-it*Wt)+zt*(rt*Mt-it*Ct),O[3]=-(V*(Ct*Lt-Mt*Ot)-St*(rt*Lt-it*Ot)+At*(rt*Mt-it*Ct)),O[4]=-(ct*(Ot*Qt-Lt*Wt)-Dt*(Ct*Qt-Mt*Wt)+Yt*(Ct*Lt-Mt*Ot)),O[5]=$*(Ot*Qt-Lt*Wt)-Dt*(rt*Qt-it*Wt)+Yt*(rt*Lt-it*Ot),O[6]=-($*(Ct*Qt-Mt*Wt)-ct*(rt*Qt-it*Wt)+Yt*(rt*Mt-it*Ct)),O[7]=$*(Ct*Lt-Mt*Ot)-ct*(rt*Lt-it*Ot)+Dt*(rt*Mt-it*Ct),O[8]=ct*(At*Qt-Lt*zt)-Dt*(St*Qt-Mt*zt)+Yt*(St*Lt-Mt*At),O[9]=-($*(At*Qt-Lt*zt)-Dt*(V*Qt-it*zt)+Yt*(V*Lt-it*At)),O[10]=$*(St*Qt-Mt*zt)-ct*(V*Qt-it*zt)+Yt*(V*Mt-it*St),O[11]=-($*(St*Lt-Mt*At)-ct*(V*Lt-it*At)+Dt*(V*Mt-it*St)),O[12]=-(ct*(At*Wt-Ot*zt)-Dt*(St*Wt-Ct*zt)+Yt*(St*Ot-Ct*At)),O[13]=$*(At*Wt-Ot*zt)-Dt*(V*Wt-rt*zt)+Yt*(V*Ot-rt*At),O[14]=-($*(St*Wt-Ct*zt)-ct*(V*Wt-rt*zt)+Yt*(V*Ct-rt*St)),O[15]=$*(St*Ot-Ct*At)-ct*(V*Ot-rt*At)+Dt*(V*Ct-rt*St),O;}function T(O){var L=O[0],$=O[1],V=O[2],rt=O[3],it=O[4],ct=O[5],St=O[6],Ct=O[7],Mt=O[8],Dt=O[9],At=O[10],Ot=O[11],Lt=O[12],Yt=O[13],zt=O[14],Wt=O[15],Qt=L*ct-$*it,ue=L*St-V*it,ie=L*Ct-rt*it,ne=$*St-V*ct,ae=$*Ct-rt*ct,se=V*Ct-rt*St,je=Mt*Yt-Dt*Lt,We=Mt*zt-At*Lt,Xe=Mt*Wt-Ot*Lt,Fe=Dt*zt-At*Yt,Ge=Dt*Wt-Ot*Yt,Ke=At*Wt-Ot*zt;return Qt*Ke-ue*Ge+ie*Fe+ne*Xe-ae*We+se*je;}function E(O,L,$){var V=L[0],rt=L[1],it=L[2],ct=L[3],St=L[4],Ct=L[5],Mt=L[6],Dt=L[7],At=L[8],Ot=L[9],Lt=L[10],Yt=L[11],zt=L[12],Wt=L[13],Qt=L[14],ue=L[15],ie=$[0],ne=$[1],ae=$[2],se=$[3];return O[0]=ie*V+ne*St+ae*At+se*zt,O[1]=ie*rt+ne*Ct+ae*Ot+se*Wt,O[2]=ie*it+ne*Mt+ae*Lt+se*Qt,O[3]=ie*ct+ne*Dt+ae*Yt+se*ue,ie=$[4],ne=$[5],ae=$[6],se=$[7],O[4]=ie*V+ne*St+ae*At+se*zt,O[5]=ie*rt+ne*Ct+ae*Ot+se*Wt,O[6]=ie*it+ne*Mt+ae*Lt+se*Qt,O[7]=ie*ct+ne*Dt+ae*Yt+se*ue,ie=$[8],ne=$[9],ae=$[10],se=$[11],O[8]=ie*V+ne*St+ae*At+se*zt,O[9]=ie*rt+ne*Ct+ae*Ot+se*Wt,O[10]=ie*it+ne*Mt+ae*Lt+se*Qt,O[11]=ie*ct+ne*Dt+ae*Yt+se*ue,ie=$[12],ne=$[13],ae=$[14],se=$[15],O[12]=ie*V+ne*St+ae*At+se*zt,O[13]=ie*rt+ne*Ct+ae*Ot+se*Wt,O[14]=ie*it+ne*Mt+ae*Lt+se*Qt,O[15]=ie*ct+ne*Dt+ae*Yt+se*ue,O;}function C(O,L,$){var V=$[0],rt=$[1],it=$[2],ct,St,Ct,Mt,Dt,At,Ot,Lt,Yt,zt,Wt,Qt;return L===O?(O[12]=L[0]*V+L[4]*rt+L[8]*it+L[12],O[13]=L[1]*V+L[5]*rt+L[9]*it+L[13],O[14]=L[2]*V+L[6]*rt+L[10]*it+L[14],O[15]=L[3]*V+L[7]*rt+L[11]*it+L[15]):(ct=L[0],St=L[1],Ct=L[2],Mt=L[3],Dt=L[4],At=L[5],Ot=L[6],Lt=L[7],Yt=L[8],zt=L[9],Wt=L[10],Qt=L[11],O[0]=ct,O[1]=St,O[2]=Ct,O[3]=Mt,O[4]=Dt,O[5]=At,O[6]=Ot,O[7]=Lt,O[8]=Yt,O[9]=zt,O[10]=Wt,O[11]=Qt,O[12]=ct*V+Dt*rt+Yt*it+L[12],O[13]=St*V+At*rt+zt*it+L[13],O[14]=Ct*V+Ot*rt+Wt*it+L[14],O[15]=Mt*V+Lt*rt+Qt*it+L[15]),O;}function x(O,L,$){var V=$[0],rt=$[1],it=$[2];return O[0]=L[0]*V,O[1]=L[1]*V,O[2]=L[2]*V,O[3]=L[3]*V,O[4]=L[4]*rt,O[5]=L[5]*rt,O[6]=L[6]*rt,O[7]=L[7]*rt,O[8]=L[8]*it,O[9]=L[9]*it,O[10]=L[10]*it,O[11]=L[11]*it,O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15],O;}function I(O,L,$,V){var rt=V[0],it=V[1],ct=V[2],St=Math.hypot(rt,it,ct),Ct,Mt,Dt,At,Ot,Lt,Yt,zt,Wt,Qt,ue,ie,ne,ae,se,je,We,Xe,Fe,Ge,Ke,Je,Ie,cr;return St<r.EPSILON?null:(St=1/St,rt*=St,it*=St,ct*=St,Ct=Math.sin($),Mt=Math.cos($),Dt=1-Mt,At=L[0],Ot=L[1],Lt=L[2],Yt=L[3],zt=L[4],Wt=L[5],Qt=L[6],ue=L[7],ie=L[8],ne=L[9],ae=L[10],se=L[11],je=rt*rt*Dt+Mt,We=it*rt*Dt+ct*Ct,Xe=ct*rt*Dt-it*Ct,Fe=rt*it*Dt-ct*Ct,Ge=it*it*Dt+Mt,Ke=ct*it*Dt+rt*Ct,Je=rt*ct*Dt+it*Ct,Ie=it*ct*Dt-rt*Ct,cr=ct*ct*Dt+Mt,O[0]=At*je+zt*We+ie*Xe,O[1]=Ot*je+Wt*We+ne*Xe,O[2]=Lt*je+Qt*We+ae*Xe,O[3]=Yt*je+ue*We+se*Xe,O[4]=At*Fe+zt*Ge+ie*Ke,O[5]=Ot*Fe+Wt*Ge+ne*Ke,O[6]=Lt*Fe+Qt*Ge+ae*Ke,O[7]=Yt*Fe+ue*Ge+se*Ke,O[8]=At*Je+zt*Ie+ie*cr,O[9]=Ot*Je+Wt*Ie+ne*cr,O[10]=Lt*Je+Qt*Ie+ae*cr,O[11]=Yt*Je+ue*Ie+se*cr,L!==O&&(O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15]),O);}function d(O,L,$){var V=Math.sin($),rt=Math.cos($),it=L[4],ct=L[5],St=L[6],Ct=L[7],Mt=L[8],Dt=L[9],At=L[10],Ot=L[11];return L!==O&&(O[0]=L[0],O[1]=L[1],O[2]=L[2],O[3]=L[3],O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15]),O[4]=it*rt+Mt*V,O[5]=ct*rt+Dt*V,O[6]=St*rt+At*V,O[7]=Ct*rt+Ot*V,O[8]=Mt*rt-it*V,O[9]=Dt*rt-ct*V,O[10]=At*rt-St*V,O[11]=Ot*rt-Ct*V,O;}function v(O,L,$){var V=Math.sin($),rt=Math.cos($),it=L[0],ct=L[1],St=L[2],Ct=L[3],Mt=L[8],Dt=L[9],At=L[10],Ot=L[11];return L!==O&&(O[4]=L[4],O[5]=L[5],O[6]=L[6],O[7]=L[7],O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15]),O[0]=it*rt-Mt*V,O[1]=ct*rt-Dt*V,O[2]=St*rt-At*V,O[3]=Ct*rt-Ot*V,O[8]=it*V+Mt*rt,O[9]=ct*V+Dt*rt,O[10]=St*V+At*rt,O[11]=Ct*V+Ot*rt,O;}function p(O,L,$){var V=Math.sin($),rt=Math.cos($),it=L[0],ct=L[1],St=L[2],Ct=L[3],Mt=L[4],Dt=L[5],At=L[6],Ot=L[7];return L!==O&&(O[8]=L[8],O[9]=L[9],O[10]=L[10],O[11]=L[11],O[12]=L[12],O[13]=L[13],O[14]=L[14],O[15]=L[15]),O[0]=it*rt+Mt*V,O[1]=ct*rt+Dt*V,O[2]=St*rt+At*V,O[3]=Ct*rt+Ot*V,O[4]=Mt*rt-it*V,O[5]=Dt*rt-ct*V,O[6]=At*rt-St*V,O[7]=Ot*rt-Ct*V,O;}function S(O,L){return O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=1,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=1,O[11]=0,O[12]=L[0],O[13]=L[1],O[14]=L[2],O[15]=1,O;}function A(O,L){return O[0]=L[0],O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=L[1],O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=L[2],O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function R(O,L,$){var V=$[0],rt=$[1],it=$[2],ct=Math.hypot(V,rt,it),St,Ct,Mt;return ct<r.EPSILON?null:(ct=1/ct,V*=ct,rt*=ct,it*=ct,St=Math.sin(L),Ct=Math.cos(L),Mt=1-Ct,O[0]=V*V*Mt+Ct,O[1]=rt*V*Mt+it*St,O[2]=it*V*Mt-rt*St,O[3]=0,O[4]=V*rt*Mt-it*St,O[5]=rt*rt*Mt+Ct,O[6]=it*rt*Mt+V*St,O[7]=0,O[8]=V*it*Mt+rt*St,O[9]=rt*it*Mt-V*St,O[10]=it*it*Mt+Ct,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O);}function D(O,L){var $=Math.sin(L),V=Math.cos(L);return O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=V,O[6]=$,O[7]=0,O[8]=0,O[9]=-$,O[10]=V,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function U(O,L){var $=Math.sin(L),V=Math.cos(L);return O[0]=V,O[1]=0,O[2]=-$,O[3]=0,O[4]=0,O[5]=1,O[6]=0,O[7]=0,O[8]=$,O[9]=0,O[10]=V,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function M(O,L){var $=Math.sin(L),V=Math.cos(L);return O[0]=V,O[1]=$,O[2]=0,O[3]=0,O[4]=-$,O[5]=V,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=1,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function W(O,L,$){var V=L[0],rt=L[1],it=L[2],ct=L[3],St=V+V,Ct=rt+rt,Mt=it+it,Dt=V*St,At=V*Ct,Ot=V*Mt,Lt=rt*Ct,Yt=rt*Mt,zt=it*Mt,Wt=ct*St,Qt=ct*Ct,ue=ct*Mt;return O[0]=1-(Lt+zt),O[1]=At+ue,O[2]=Ot-Qt,O[3]=0,O[4]=At-ue,O[5]=1-(Dt+zt),O[6]=Yt+Wt,O[7]=0,O[8]=Ot+Qt,O[9]=Yt-Wt,O[10]=1-(Dt+Lt),O[11]=0,O[12]=$[0],O[13]=$[1],O[14]=$[2],O[15]=1,O;}function Y(O,L){var $=new r.ARRAY_TYPE(3),V=-L[0],rt=-L[1],it=-L[2],ct=L[3],St=L[4],Ct=L[5],Mt=L[6],Dt=L[7],At=V*V+rt*rt+it*it+ct*ct;return At>0?($[0]=(St*ct+Dt*V+Ct*it-Mt*rt)*2/At,$[1]=(Ct*ct+Dt*rt+Mt*V-St*it)*2/At,$[2]=(Mt*ct+Dt*it+St*rt-Ct*V)*2/At):($[0]=(St*ct+Dt*V+Ct*it-Mt*rt)*2,$[1]=(Ct*ct+Dt*rt+Mt*V-St*it)*2,$[2]=(Mt*ct+Dt*it+St*rt-Ct*V)*2),W(O,L,$),O;}function B(O,L){return O[0]=L[12],O[1]=L[13],O[2]=L[14],O;}function N(O,L){var $=L[0],V=L[1],rt=L[2],it=L[4],ct=L[5],St=L[6],Ct=L[8],Mt=L[9],Dt=L[10];return O[0]=Math.hypot($,V,rt),O[1]=Math.hypot(it,ct,St),O[2]=Math.hypot(Ct,Mt,Dt),O;}function G(O,L){var $=new r.ARRAY_TYPE(3);N($,L);var V=1/$[0],rt=1/$[1],it=1/$[2],ct=L[0]*V,St=L[1]*rt,Ct=L[2]*it,Mt=L[4]*V,Dt=L[5]*rt,At=L[6]*it,Ot=L[8]*V,Lt=L[9]*rt,Yt=L[10]*it,zt=ct+Dt+Yt,Wt=0;return zt>0?(Wt=Math.sqrt(zt+1)*2,O[3]=0.25*Wt,O[0]=(At-Lt)/Wt,O[1]=(Ot-Ct)/Wt,O[2]=(St-Mt)/Wt):ct>Dt&&ct>Yt?(Wt=Math.sqrt(1+ct-Dt-Yt)*2,O[3]=(At-Lt)/Wt,O[0]=0.25*Wt,O[1]=(St+Mt)/Wt,O[2]=(Ot+Ct)/Wt):Dt>Yt?(Wt=Math.sqrt(1+Dt-ct-Yt)*2,O[3]=(Ot-Ct)/Wt,O[0]=(St+Mt)/Wt,O[1]=0.25*Wt,O[2]=(At+Lt)/Wt):(Wt=Math.sqrt(1+Yt-ct-Dt)*2,O[3]=(St-Mt)/Wt,O[0]=(Ot+Ct)/Wt,O[1]=(At+Lt)/Wt,O[2]=0.25*Wt),O;}function J(O,L,$,V){var rt=L[0],it=L[1],ct=L[2],St=L[3],Ct=rt+rt,Mt=it+it,Dt=ct+ct,At=rt*Ct,Ot=rt*Mt,Lt=rt*Dt,Yt=it*Mt,zt=it*Dt,Wt=ct*Dt,Qt=St*Ct,ue=St*Mt,ie=St*Dt,ne=V[0],ae=V[1],se=V[2];return O[0]=(1-(Yt+Wt))*ne,O[1]=(Ot+ie)*ne,O[2]=(Lt-ue)*ne,O[3]=0,O[4]=(Ot-ie)*ae,O[5]=(1-(At+Wt))*ae,O[6]=(zt+Qt)*ae,O[7]=0,O[8]=(Lt+ue)*se,O[9]=(zt-Qt)*se,O[10]=(1-(At+Yt))*se,O[11]=0,O[12]=$[0],O[13]=$[1],O[14]=$[2],O[15]=1,O;}function tt(O,L,$,V,rt){var it=L[0],ct=L[1],St=L[2],Ct=L[3],Mt=it+it,Dt=ct+ct,At=St+St,Ot=it*Mt,Lt=it*Dt,Yt=it*At,zt=ct*Dt,Wt=ct*At,Qt=St*At,ue=Ct*Mt,ie=Ct*Dt,ne=Ct*At,ae=V[0],se=V[1],je=V[2],We=rt[0],Xe=rt[1],Fe=rt[2],Ge=(1-(zt+Qt))*ae,Ke=(Lt+ne)*ae,Je=(Yt-ie)*ae,Ie=(Lt-ne)*se,cr=(1-(Ot+Qt))*se,Kr=(Wt+ue)*se,tn=(Yt+ie)*je,Hn=(Wt-ue)*je,kn=(1-(Ot+zt))*je;return O[0]=Ge,O[1]=Ke,O[2]=Je,O[3]=0,O[4]=Ie,O[5]=cr,O[6]=Kr,O[7]=0,O[8]=tn,O[9]=Hn,O[10]=kn,O[11]=0,O[12]=$[0]+We-(Ge*We+Ie*Xe+tn*Fe),O[13]=$[1]+Xe-(Ke*We+cr*Xe+Hn*Fe),O[14]=$[2]+Fe-(Je*We+Kr*Xe+kn*Fe),O[15]=1,O;}function at(O,L){var $=L[0],V=L[1],rt=L[2],it=L[3],ct=$+$,St=V+V,Ct=rt+rt,Mt=$*ct,Dt=V*ct,At=V*St,Ot=rt*ct,Lt=rt*St,Yt=rt*Ct,zt=it*ct,Wt=it*St,Qt=it*Ct;return O[0]=1-At-Yt,O[1]=Dt+Qt,O[2]=Ot-Wt,O[3]=0,O[4]=Dt-Qt,O[5]=1-Mt-Yt,O[6]=Lt+zt,O[7]=0,O[8]=Ot+Wt,O[9]=Lt-zt,O[10]=1-Mt-At,O[11]=0,O[12]=0,O[13]=0,O[14]=0,O[15]=1,O;}function ut(O,L,$,V,rt,it,ct){var St=1/($-L),Ct=1/(rt-V),Mt=1/(it-ct);return O[0]=it*2*St,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=it*2*Ct,O[6]=0,O[7]=0,O[8]=($+L)*St,O[9]=(rt+V)*Ct,O[10]=(ct+it)*Mt,O[11]=-1,O[12]=0,O[13]=0,O[14]=ct*it*2*Mt,O[15]=0,O;}function K(O,L,$,V,rt){var it=1/Math.tan(L/2),ct;return O[0]=it/$,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=it,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[11]=-1,O[12]=0,O[13]=0,O[15]=0,rt!=null&&rt!==1/0?(ct=1/(V-rt),O[10]=(rt+V)*ct,O[14]=2*rt*V*ct):(O[10]=-1,O[14]=-2*V),O;}function Q(O,L,$,V){var rt=Math.tan(L.upDegrees*Math.PI/180),it=Math.tan(L.downDegrees*Math.PI/180),ct=Math.tan(L.leftDegrees*Math.PI/180),St=Math.tan(L.rightDegrees*Math.PI/180),Ct=2/(ct+St),Mt=2/(rt+it);return O[0]=Ct,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=Mt,O[6]=0,O[7]=0,O[8]=-((ct-St)*Ct*0.5),O[9]=(rt-it)*Mt*0.5,O[10]=V/($-V),O[11]=-1,O[12]=0,O[13]=0,O[14]=V*$/($-V),O[15]=0,O;}function ft(O,L,$,V,rt,it,ct){var St=1/(L-$),Ct=1/(V-rt),Mt=1/(it-ct);return O[0]=-2*St,O[1]=0,O[2]=0,O[3]=0,O[4]=0,O[5]=-2*Ct,O[6]=0,O[7]=0,O[8]=0,O[9]=0,O[10]=2*Mt,O[11]=0,O[12]=(L+$)*St,O[13]=(rt+V)*Ct,O[14]=(ct+it)*Mt,O[15]=1,O;}function gt(O,L,$,V){var rt,it,ct,St,Ct,Mt,Dt,At,Ot,Lt,Yt=L[0],zt=L[1],Wt=L[2],Qt=V[0],ue=V[1],ie=V[2],ne=$[0],ae=$[1],se=$[2];return Math.abs(Yt-ne)<r.EPSILON&&Math.abs(zt-ae)<r.EPSILON&&Math.abs(Wt-se)<r.EPSILON?h(O):(Dt=Yt-ne,At=zt-ae,Ot=Wt-se,Lt=1/Math.hypot(Dt,At,Ot),Dt*=Lt,At*=Lt,Ot*=Lt,rt=ue*Ot-ie*At,it=ie*Dt-Qt*Ot,ct=Qt*At-ue*Dt,Lt=Math.hypot(rt,it,ct),Lt?(Lt=1/Lt,rt*=Lt,it*=Lt,ct*=Lt):(rt=0,it=0,ct=0),St=At*ct-Ot*it,Ct=Ot*rt-Dt*ct,Mt=Dt*it-At*rt,Lt=Math.hypot(St,Ct,Mt),Lt?(Lt=1/Lt,St*=Lt,Ct*=Lt,Mt*=Lt):(St=0,Ct=0,Mt=0),O[0]=rt,O[1]=St,O[2]=Dt,O[3]=0,O[4]=it,O[5]=Ct,O[6]=At,O[7]=0,O[8]=ct,O[9]=Mt,O[10]=Ot,O[11]=0,O[12]=-(rt*Yt+it*zt+ct*Wt),O[13]=-(St*Yt+Ct*zt+Mt*Wt),O[14]=-(Dt*Yt+At*zt+Ot*Wt),O[15]=1,O);}function mt(O,L,$,V){var rt=L[0],it=L[1],ct=L[2],St=V[0],Ct=V[1],Mt=V[2],Dt=rt-$[0],At=it-$[1],Ot=ct-$[2],Lt=Dt*Dt+At*At+Ot*Ot;Lt>0&&(Lt=1/Math.sqrt(Lt),Dt*=Lt,At*=Lt,Ot*=Lt);var Yt=Ct*Ot-Mt*At,zt=Mt*Dt-St*Ot,Wt=St*At-Ct*Dt;return Lt=Yt*Yt+zt*zt+Wt*Wt,Lt>0&&(Lt=1/Math.sqrt(Lt),Yt*=Lt,zt*=Lt,Wt*=Lt),O[0]=Yt,O[1]=zt,O[2]=Wt,O[3]=0,O[4]=At*Wt-Ot*zt,O[5]=Ot*Yt-Dt*Wt,O[6]=Dt*zt-At*Yt,O[7]=0,O[8]=Dt,O[9]=At,O[10]=Ot,O[11]=0,O[12]=rt,O[13]=it,O[14]=ct,O[15]=1,O;}function wt(O){return"mat4("+O[0]+", "+O[1]+", "+O[2]+", "+O[3]+", "+O[4]+", "+O[5]+", "+O[6]+", "+O[7]+", "+O[8]+", "+O[9]+", "+O[10]+", "+O[11]+", "+O[12]+", "+O[13]+", "+O[14]+", "+O[15]+")";}function ht(O){return Math.hypot(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],O[8],O[9],O[10],O[11],O[12],O[13],O[14],O[15]);}function Nt(O,L,$){return O[0]=L[0]+$[0],O[1]=L[1]+$[1],O[2]=L[2]+$[2],O[3]=L[3]+$[3],O[4]=L[4]+$[4],O[5]=L[5]+$[5],O[6]=L[6]+$[6],O[7]=L[7]+$[7],O[8]=L[8]+$[8],O[9]=L[9]+$[9],O[10]=L[10]+$[10],O[11]=L[11]+$[11],O[12]=L[12]+$[12],O[13]=L[13]+$[13],O[14]=L[14]+$[14],O[15]=L[15]+$[15],O;}function Rt(O,L,$){return O[0]=L[0]-$[0],O[1]=L[1]-$[1],O[2]=L[2]-$[2],O[3]=L[3]-$[3],O[4]=L[4]-$[4],O[5]=L[5]-$[5],O[6]=L[6]-$[6],O[7]=L[7]-$[7],O[8]=L[8]-$[8],O[9]=L[9]-$[9],O[10]=L[10]-$[10],O[11]=L[11]-$[11],O[12]=L[12]-$[12],O[13]=L[13]-$[13],O[14]=L[14]-$[14],O[15]=L[15]-$[15],O;}function X(O,L,$){return O[0]=L[0]*$,O[1]=L[1]*$,O[2]=L[2]*$,O[3]=L[3]*$,O[4]=L[4]*$,O[5]=L[5]*$,O[6]=L[6]*$,O[7]=L[7]*$,O[8]=L[8]*$,O[9]=L[9]*$,O[10]=L[10]*$,O[11]=L[11]*$,O[12]=L[12]*$,O[13]=L[13]*$,O[14]=L[14]*$,O[15]=L[15]*$,O;}function z(O,L,$,V){return O[0]=L[0]+$[0]*V,O[1]=L[1]+$[1]*V,O[2]=L[2]+$[2]*V,O[3]=L[3]+$[3]*V,O[4]=L[4]+$[4]*V,O[5]=L[5]+$[5]*V,O[6]=L[6]+$[6]*V,O[7]=L[7]+$[7]*V,O[8]=L[8]+$[8]*V,O[9]=L[9]+$[9]*V,O[10]=L[10]+$[10]*V,O[11]=L[11]+$[11]*V,O[12]=L[12]+$[12]*V,O[13]=L[13]+$[13]*V,O[14]=L[14]+$[14]*V,O[15]=L[15]+$[15]*V,O;}function q(O,L){return O[0]===L[0]&&O[1]===L[1]&&O[2]===L[2]&&O[3]===L[3]&&O[4]===L[4]&&O[5]===L[5]&&O[6]===L[6]&&O[7]===L[7]&&O[8]===L[8]&&O[9]===L[9]&&O[10]===L[10]&&O[11]===L[11]&&O[12]===L[12]&&O[13]===L[13]&&O[14]===L[14]&&O[15]===L[15];}function nt(O,L){var $=O[0],V=O[1],rt=O[2],it=O[3],ct=O[4],St=O[5],Ct=O[6],Mt=O[7],Dt=O[8],At=O[9],Ot=O[10],Lt=O[11],Yt=O[12],zt=O[13],Wt=O[14],Qt=O[15],ue=L[0],ie=L[1],ne=L[2],ae=L[3],se=L[4],je=L[5],We=L[6],Xe=L[7],Fe=L[8],Ge=L[9],Ke=L[10],Je=L[11],Ie=L[12],cr=L[13],Kr=L[14],tn=L[15];return Math.abs($-ue)<=r.EPSILON*Math.max(1,Math.abs($),Math.abs(ue))&&Math.abs(V-ie)<=r.EPSILON*Math.max(1,Math.abs(V),Math.abs(ie))&&Math.abs(rt-ne)<=r.EPSILON*Math.max(1,Math.abs(rt),Math.abs(ne))&&Math.abs(it-ae)<=r.EPSILON*Math.max(1,Math.abs(it),Math.abs(ae))&&Math.abs(ct-se)<=r.EPSILON*Math.max(1,Math.abs(ct),Math.abs(se))&&Math.abs(St-je)<=r.EPSILON*Math.max(1,Math.abs(St),Math.abs(je))&&Math.abs(Ct-We)<=r.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(We))&&Math.abs(Mt-Xe)<=r.EPSILON*Math.max(1,Math.abs(Mt),Math.abs(Xe))&&Math.abs(Dt-Fe)<=r.EPSILON*Math.max(1,Math.abs(Dt),Math.abs(Fe))&&Math.abs(At-Ge)<=r.EPSILON*Math.max(1,Math.abs(At),Math.abs(Ge))&&Math.abs(Ot-Ke)<=r.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(Ke))&&Math.abs(Lt-Je)<=r.EPSILON*Math.max(1,Math.abs(Lt),Math.abs(Je))&&Math.abs(Yt-Ie)<=r.EPSILON*Math.max(1,Math.abs(Yt),Math.abs(Ie))&&Math.abs(zt-cr)<=r.EPSILON*Math.max(1,Math.abs(zt),Math.abs(cr))&&Math.abs(Wt-Kr)<=r.EPSILON*Math.max(1,Math.abs(Wt),Math.abs(Kr))&&Math.abs(Qt-tn)<=r.EPSILON*Math.max(1,Math.abs(Qt),Math.abs(tn));}var j=E,Z=Rt;},/* 7 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return l;}),t.d(e,"identity",function(){return f;}),t.d(e,"setAxisAngle",function(){return h;}),t.d(e,"getAxisAngle",function(){return m;}),t.d(e,"getAngle",function(){return u;}),t.d(e,"multiply",function(){return y;}),t.d(e,"rotateX",function(){return T;}),t.d(e,"rotateY",function(){return E;}),t.d(e,"rotateZ",function(){return C;}),t.d(e,"calculateW",function(){return x;}),t.d(e,"exp",function(){return I;}),t.d(e,"ln",function(){return d;}),t.d(e,"pow",function(){return v;}),t.d(e,"slerp",function(){return p;}),t.d(e,"random",function(){return S;}),t.d(e,"invert",function(){return A;}),t.d(e,"conjugate",function(){return R;}),t.d(e,"fromMat3",function(){return D;}),t.d(e,"fromEuler",function(){return U;}),t.d(e,"str",function(){return M;}),t.d(e,"clone",function(){return W;}),t.d(e,"fromValues",function(){return Y;}),t.d(e,"copy",function(){return B;}),t.d(e,"set",function(){return N;}),t.d(e,"add",function(){return G;}),t.d(e,"mul",function(){return J;}),t.d(e,"scale",function(){return tt;}),t.d(e,"dot",function(){return at;}),t.d(e,"lerp",function(){return ut;}),t.d(e,"length",function(){return K;}),t.d(e,"len",function(){return Q;}),t.d(e,"squaredLength",function(){return ft;}),t.d(e,"sqrLen",function(){return gt;}),t.d(e,"normalize",function(){return mt;}),t.d(e,"exactEquals",function(){return wt;}),t.d(e,"equals",function(){return ht;}),t.d(e,"rotationTo",function(){return Nt;}),t.d(e,"sqlerp",function(){return Rt;}),t.d(e,"setAxes",function(){return X;});var r=t(2),n=t(5),s=t(8),c=t(9);function l(){var z=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(z[0]=0,z[1]=0,z[2]=0),z[3]=1,z;}function f(z){return z[0]=0,z[1]=0,z[2]=0,z[3]=1,z;}function h(z,q,nt){nt=nt*0.5;var j=Math.sin(nt);return z[0]=j*q[0],z[1]=j*q[1],z[2]=j*q[2],z[3]=Math.cos(nt),z;}function m(z,q){var nt=Math.acos(q[3])*2,j=Math.sin(nt/2);return j>r.EPSILON?(z[0]=q[0]/j,z[1]=q[1]/j,z[2]=q[2]/j):(z[0]=1,z[1]=0,z[2]=0),nt;}function u(z,q){var nt=at(z,q);return Math.acos(2*nt*nt-1);}function y(z,q,nt){var j=q[0],Z=q[1],O=q[2],L=q[3],$=nt[0],V=nt[1],rt=nt[2],it=nt[3];return z[0]=j*it+L*$+Z*rt-O*V,z[1]=Z*it+L*V+O*$-j*rt,z[2]=O*it+L*rt+j*V-Z*$,z[3]=L*it-j*$-Z*V-O*rt,z;}function T(z,q,nt){nt*=0.5;var j=q[0],Z=q[1],O=q[2],L=q[3],$=Math.sin(nt),V=Math.cos(nt);return z[0]=j*V+L*$,z[1]=Z*V+O*$,z[2]=O*V-Z*$,z[3]=L*V-j*$,z;}function E(z,q,nt){nt*=0.5;var j=q[0],Z=q[1],O=q[2],L=q[3],$=Math.sin(nt),V=Math.cos(nt);return z[0]=j*V-O*$,z[1]=Z*V+L*$,z[2]=O*V+j*$,z[3]=L*V-Z*$,z;}function C(z,q,nt){nt*=0.5;var j=q[0],Z=q[1],O=q[2],L=q[3],$=Math.sin(nt),V=Math.cos(nt);return z[0]=j*V+Z*$,z[1]=Z*V-j*$,z[2]=O*V+L*$,z[3]=L*V-O*$,z;}function x(z,q){var nt=q[0],j=q[1],Z=q[2];return z[0]=nt,z[1]=j,z[2]=Z,z[3]=Math.sqrt(Math.abs(1-nt*nt-j*j-Z*Z)),z;}function I(z,q){var nt=q[0],j=q[1],Z=q[2],O=q[3],L=Math.sqrt(nt*nt+j*j+Z*Z),$=Math.exp(O),V=L>0?$*Math.sin(L)/L:0;return z[0]=nt*V,z[1]=j*V,z[2]=Z*V,z[3]=$*Math.cos(L),z;}function d(z,q){var nt=q[0],j=q[1],Z=q[2],O=q[3],L=Math.sqrt(nt*nt+j*j+Z*Z),$=L>0?Math.atan2(L,O)/L:0;return z[0]=nt*$,z[1]=j*$,z[2]=Z*$,z[3]=0.5*Math.log(nt*nt+j*j+Z*Z+O*O),z;}function v(z,q,nt){return d(z,q),tt(z,z,nt),I(z,z),z;}function p(z,q,nt,j){var Z=q[0],O=q[1],L=q[2],$=q[3],V=nt[0],rt=nt[1],it=nt[2],ct=nt[3],St,Ct,Mt,Dt,At;return Ct=Z*V+O*rt+L*it+$*ct,Ct<0&&(Ct=-Ct,V=-V,rt=-rt,it=-it,ct=-ct),1-Ct>r.EPSILON?(St=Math.acos(Ct),Mt=Math.sin(St),Dt=Math.sin((1-j)*St)/Mt,At=Math.sin(j*St)/Mt):(Dt=1-j,At=j),z[0]=Dt*Z+At*V,z[1]=Dt*O+At*rt,z[2]=Dt*L+At*it,z[3]=Dt*$+At*ct,z;}function S(z){var q=r.RANDOM(),nt=r.RANDOM(),j=r.RANDOM(),Z=Math.sqrt(1-q),O=Math.sqrt(q);return z[0]=Z*Math.sin(2*Math.PI*nt),z[1]=Z*Math.cos(2*Math.PI*nt),z[2]=O*Math.sin(2*Math.PI*j),z[3]=O*Math.cos(2*Math.PI*j),z;}function A(z,q){var nt=q[0],j=q[1],Z=q[2],O=q[3],L=nt*nt+j*j+Z*Z+O*O,$=L?1/L:0;return z[0]=-nt*$,z[1]=-j*$,z[2]=-Z*$,z[3]=O*$,z;}function R(z,q){return z[0]=-q[0],z[1]=-q[1],z[2]=-q[2],z[3]=q[3],z;}function D(z,q){var nt=q[0]+q[4]+q[8],j;if(nt>0)j=Math.sqrt(nt+1),z[3]=0.5*j,j=0.5/j,z[0]=(q[5]-q[7])*j,z[1]=(q[6]-q[2])*j,z[2]=(q[1]-q[3])*j;else{var Z=0;q[4]>q[0]&&(Z=1),q[8]>q[Z*3+Z]&&(Z=2);var O=(Z+1)%3,L=(Z+2)%3;j=Math.sqrt(q[Z*3+Z]-q[O*3+O]-q[L*3+L]+1),z[Z]=0.5*j,j=0.5/j,z[3]=(q[O*3+L]-q[L*3+O])*j,z[O]=(q[O*3+Z]+q[Z*3+O])*j,z[L]=(q[L*3+Z]+q[Z*3+L])*j;}return z;}function U(z,q,nt,j){var Z=0.5*Math.PI/180;q*=Z,nt*=Z,j*=Z;var O=Math.sin(q),L=Math.cos(q),$=Math.sin(nt),V=Math.cos(nt),rt=Math.sin(j),it=Math.cos(j);return z[0]=O*V*it-L*$*rt,z[1]=L*$*it+O*V*rt,z[2]=L*V*rt-O*$*it,z[3]=L*V*it+O*$*rt,z;}function M(z){return"quat("+z[0]+", "+z[1]+", "+z[2]+", "+z[3]+")";}var W=c.clone,Y=c.fromValues,B=c.copy,N=c.set,G=c.add,J=y,tt=c.scale,at=c.dot,ut=c.lerp,K=c.length,Q=K,ft=c.squaredLength,gt=ft,mt=c.normalize,wt=c.exactEquals,ht=c.equals,Nt=function(){var z=s.create(),q=s.fromValues(1,0,0),nt=s.fromValues(0,1,0);return function(j,Z,O){var L=s.dot(Z,O);return L<-0.999999?(s.cross(z,q,Z),s.len(z)<1e-6&&s.cross(z,nt,Z),s.normalize(z,z),h(j,z,Math.PI),j):L>0.999999?(j[0]=0,j[1]=0,j[2]=0,j[3]=1,j):(s.cross(z,Z,O),j[0]=z[0],j[1]=z[1],j[2]=z[2],j[3]=1+L,mt(j,j));};}(),Rt=function(){var z=l(),q=l();return function(nt,j,Z,O,L,$){return p(z,j,L,$),p(q,Z,O,$),p(nt,z,q,2*$*(1-$)),nt;};}(),X=function(){var z=n.create();return function(q,nt,j,Z){return z[0]=j[0],z[3]=j[1],z[6]=j[2],z[1]=Z[0],z[4]=Z[1],z[7]=Z[2],z[2]=-nt[0],z[5]=-nt[1],z[8]=-nt[2],mt(q,D(q,z));};}();},/* 8 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"length",function(){return c;}),t.d(e,"fromValues",function(){return l;}),t.d(e,"copy",function(){return f;}),t.d(e,"set",function(){return h;}),t.d(e,"add",function(){return m;}),t.d(e,"subtract",function(){return u;}),t.d(e,"multiply",function(){return y;}),t.d(e,"divide",function(){return T;}),t.d(e,"ceil",function(){return E;}),t.d(e,"floor",function(){return C;}),t.d(e,"min",function(){return x;}),t.d(e,"max",function(){return I;}),t.d(e,"round",function(){return d;}),t.d(e,"scale",function(){return v;}),t.d(e,"scaleAndAdd",function(){return p;}),t.d(e,"distance",function(){return S;}),t.d(e,"squaredDistance",function(){return A;}),t.d(e,"squaredLength",function(){return R;}),t.d(e,"negate",function(){return D;}),t.d(e,"inverse",function(){return U;}),t.d(e,"normalize",function(){return M;}),t.d(e,"dot",function(){return W;}),t.d(e,"cross",function(){return Y;}),t.d(e,"lerp",function(){return B;}),t.d(e,"hermite",function(){return N;}),t.d(e,"bezier",function(){return G;}),t.d(e,"random",function(){return J;}),t.d(e,"transformMat4",function(){return tt;}),t.d(e,"transformMat3",function(){return at;}),t.d(e,"transformQuat",function(){return ut;}),t.d(e,"rotateX",function(){return K;}),t.d(e,"rotateY",function(){return Q;}),t.d(e,"rotateZ",function(){return ft;}),t.d(e,"angle",function(){return gt;}),t.d(e,"zero",function(){return mt;}),t.d(e,"str",function(){return wt;}),t.d(e,"exactEquals",function(){return ht;}),t.d(e,"equals",function(){return Nt;}),t.d(e,"sub",function(){return Rt;}),t.d(e,"mul",function(){return X;}),t.d(e,"div",function(){return z;}),t.d(e,"dist",function(){return q;}),t.d(e,"sqrDist",function(){return nt;}),t.d(e,"len",function(){return j;}),t.d(e,"sqrLen",function(){return Z;}),t.d(e,"forEach",function(){return O;});var r=t(2);function n(){var L=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(L[0]=0,L[1]=0,L[2]=0),L;}function s(L){var $=new r.ARRAY_TYPE(3);return $[0]=L[0],$[1]=L[1],$[2]=L[2],$;}function c(L){var $=L[0],V=L[1],rt=L[2];return Math.hypot($,V,rt);}function l(L,$,V){var rt=new r.ARRAY_TYPE(3);return rt[0]=L,rt[1]=$,rt[2]=V,rt;}function f(L,$){return L[0]=$[0],L[1]=$[1],L[2]=$[2],L;}function h(L,$,V,rt){return L[0]=$,L[1]=V,L[2]=rt,L;}function m(L,$,V){return L[0]=$[0]+V[0],L[1]=$[1]+V[1],L[2]=$[2]+V[2],L;}function u(L,$,V){return L[0]=$[0]-V[0],L[1]=$[1]-V[1],L[2]=$[2]-V[2],L;}function y(L,$,V){return L[0]=$[0]*V[0],L[1]=$[1]*V[1],L[2]=$[2]*V[2],L;}function T(L,$,V){return L[0]=$[0]/V[0],L[1]=$[1]/V[1],L[2]=$[2]/V[2],L;}function E(L,$){return L[0]=Math.ceil($[0]),L[1]=Math.ceil($[1]),L[2]=Math.ceil($[2]),L;}function C(L,$){return L[0]=Math.floor($[0]),L[1]=Math.floor($[1]),L[2]=Math.floor($[2]),L;}function x(L,$,V){return L[0]=Math.min($[0],V[0]),L[1]=Math.min($[1],V[1]),L[2]=Math.min($[2],V[2]),L;}function I(L,$,V){return L[0]=Math.max($[0],V[0]),L[1]=Math.max($[1],V[1]),L[2]=Math.max($[2],V[2]),L;}function d(L,$){return L[0]=Math.round($[0]),L[1]=Math.round($[1]),L[2]=Math.round($[2]),L;}function v(L,$,V){return L[0]=$[0]*V,L[1]=$[1]*V,L[2]=$[2]*V,L;}function p(L,$,V,rt){return L[0]=$[0]+V[0]*rt,L[1]=$[1]+V[1]*rt,L[2]=$[2]+V[2]*rt,L;}function S(L,$){var V=$[0]-L[0],rt=$[1]-L[1],it=$[2]-L[2];return Math.hypot(V,rt,it);}function A(L,$){var V=$[0]-L[0],rt=$[1]-L[1],it=$[2]-L[2];return V*V+rt*rt+it*it;}function R(L){var $=L[0],V=L[1],rt=L[2];return $*$+V*V+rt*rt;}function D(L,$){return L[0]=-$[0],L[1]=-$[1],L[2]=-$[2],L;}function U(L,$){return L[0]=1/$[0],L[1]=1/$[1],L[2]=1/$[2],L;}function M(L,$){var V=$[0],rt=$[1],it=$[2],ct=V*V+rt*rt+it*it;return ct>0&&(ct=1/Math.sqrt(ct)),L[0]=$[0]*ct,L[1]=$[1]*ct,L[2]=$[2]*ct,L;}function W(L,$){return L[0]*$[0]+L[1]*$[1]+L[2]*$[2];}function Y(L,$,V){var rt=$[0],it=$[1],ct=$[2],St=V[0],Ct=V[1],Mt=V[2];return L[0]=it*Mt-ct*Ct,L[1]=ct*St-rt*Mt,L[2]=rt*Ct-it*St,L;}function B(L,$,V,rt){var it=$[0],ct=$[1],St=$[2];return L[0]=it+rt*(V[0]-it),L[1]=ct+rt*(V[1]-ct),L[2]=St+rt*(V[2]-St),L;}function N(L,$,V,rt,it,ct){var St=ct*ct,Ct=St*(2*ct-3)+1,Mt=St*(ct-2)+ct,Dt=St*(ct-1),At=St*(3-2*ct);return L[0]=$[0]*Ct+V[0]*Mt+rt[0]*Dt+it[0]*At,L[1]=$[1]*Ct+V[1]*Mt+rt[1]*Dt+it[1]*At,L[2]=$[2]*Ct+V[2]*Mt+rt[2]*Dt+it[2]*At,L;}function G(L,$,V,rt,it,ct){var St=1-ct,Ct=St*St,Mt=ct*ct,Dt=Ct*St,At=3*ct*Ct,Ot=3*Mt*St,Lt=Mt*ct;return L[0]=$[0]*Dt+V[0]*At+rt[0]*Ot+it[0]*Lt,L[1]=$[1]*Dt+V[1]*At+rt[1]*Ot+it[1]*Lt,L[2]=$[2]*Dt+V[2]*At+rt[2]*Ot+it[2]*Lt,L;}function J(L,$){$=$||1;var V=r.RANDOM()*2*Math.PI,rt=r.RANDOM()*2-1,it=Math.sqrt(1-rt*rt)*$;return L[0]=Math.cos(V)*it,L[1]=Math.sin(V)*it,L[2]=rt*$,L;}function tt(L,$,V){var rt=$[0],it=$[1],ct=$[2],St=V[3]*rt+V[7]*it+V[11]*ct+V[15];return St=St||1,L[0]=(V[0]*rt+V[4]*it+V[8]*ct+V[12])/St,L[1]=(V[1]*rt+V[5]*it+V[9]*ct+V[13])/St,L[2]=(V[2]*rt+V[6]*it+V[10]*ct+V[14])/St,L;}function at(L,$,V){var rt=$[0],it=$[1],ct=$[2];return L[0]=rt*V[0]+it*V[3]+ct*V[6],L[1]=rt*V[1]+it*V[4]+ct*V[7],L[2]=rt*V[2]+it*V[5]+ct*V[8],L;}function ut(L,$,V){var rt=V[0],it=V[1],ct=V[2],St=V[3],Ct=$[0],Mt=$[1],Dt=$[2],At=it*Dt-ct*Mt,Ot=ct*Ct-rt*Dt,Lt=rt*Mt-it*Ct,Yt=it*Lt-ct*Ot,zt=ct*At-rt*Lt,Wt=rt*Ot-it*At,Qt=St*2;return At*=Qt,Ot*=Qt,Lt*=Qt,Yt*=2,zt*=2,Wt*=2,L[0]=Ct+At+Yt,L[1]=Mt+Ot+zt,L[2]=Dt+Lt+Wt,L;}function K(L,$,V,rt){var it=[],ct=[];return it[0]=$[0]-V[0],it[1]=$[1]-V[1],it[2]=$[2]-V[2],ct[0]=it[0],ct[1]=it[1]*Math.cos(rt)-it[2]*Math.sin(rt),ct[2]=it[1]*Math.sin(rt)+it[2]*Math.cos(rt),L[0]=ct[0]+V[0],L[1]=ct[1]+V[1],L[2]=ct[2]+V[2],L;}function Q(L,$,V,rt){var it=[],ct=[];return it[0]=$[0]-V[0],it[1]=$[1]-V[1],it[2]=$[2]-V[2],ct[0]=it[2]*Math.sin(rt)+it[0]*Math.cos(rt),ct[1]=it[1],ct[2]=it[2]*Math.cos(rt)-it[0]*Math.sin(rt),L[0]=ct[0]+V[0],L[1]=ct[1]+V[1],L[2]=ct[2]+V[2],L;}function ft(L,$,V,rt){var it=[],ct=[];return it[0]=$[0]-V[0],it[1]=$[1]-V[1],it[2]=$[2]-V[2],ct[0]=it[0]*Math.cos(rt)-it[1]*Math.sin(rt),ct[1]=it[0]*Math.sin(rt)+it[1]*Math.cos(rt),ct[2]=it[2],L[0]=ct[0]+V[0],L[1]=ct[1]+V[1],L[2]=ct[2]+V[2],L;}function gt(L,$){var V=L[0],rt=L[1],it=L[2],ct=$[0],St=$[1],Ct=$[2],Mt=Math.sqrt(V*V+rt*rt+it*it),Dt=Math.sqrt(ct*ct+St*St+Ct*Ct),At=Mt*Dt,Ot=At&&W(L,$)/At;return Math.acos(Math.min(Math.max(Ot,-1),1));}function mt(L){return L[0]=0,L[1]=0,L[2]=0,L;}function wt(L){return"vec3("+L[0]+", "+L[1]+", "+L[2]+")";}function ht(L,$){return L[0]===$[0]&&L[1]===$[1]&&L[2]===$[2];}function Nt(L,$){var V=L[0],rt=L[1],it=L[2],ct=$[0],St=$[1],Ct=$[2];return Math.abs(V-ct)<=r.EPSILON*Math.max(1,Math.abs(V),Math.abs(ct))&&Math.abs(rt-St)<=r.EPSILON*Math.max(1,Math.abs(rt),Math.abs(St))&&Math.abs(it-Ct)<=r.EPSILON*Math.max(1,Math.abs(it),Math.abs(Ct));}var Rt=u,X=y,z=T,q=S,nt=A,j=c,Z=R,O=function(){var L=n();return function($,V,rt,it,ct,St){var Ct,Mt;for(V||(V=3),rt||(rt=0),it?Mt=Math.min(it*V+rt,$.length):Mt=$.length,Ct=rt;Ct<Mt;Ct+=V)L[0]=$[Ct],L[1]=$[Ct+1],L[2]=$[Ct+2],ct(L,L,St),$[Ct]=L[0],$[Ct+1]=L[1],$[Ct+2]=L[2];return $;};}();},/* 9 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"fromValues",function(){return c;}),t.d(e,"copy",function(){return l;}),t.d(e,"set",function(){return f;}),t.d(e,"add",function(){return h;}),t.d(e,"subtract",function(){return m;}),t.d(e,"multiply",function(){return u;}),t.d(e,"divide",function(){return y;}),t.d(e,"ceil",function(){return T;}),t.d(e,"floor",function(){return E;}),t.d(e,"min",function(){return C;}),t.d(e,"max",function(){return x;}),t.d(e,"round",function(){return I;}),t.d(e,"scale",function(){return d;}),t.d(e,"scaleAndAdd",function(){return v;}),t.d(e,"distance",function(){return p;}),t.d(e,"squaredDistance",function(){return S;}),t.d(e,"length",function(){return A;}),t.d(e,"squaredLength",function(){return R;}),t.d(e,"negate",function(){return D;}),t.d(e,"inverse",function(){return U;}),t.d(e,"normalize",function(){return M;}),t.d(e,"dot",function(){return W;}),t.d(e,"cross",function(){return Y;}),t.d(e,"lerp",function(){return B;}),t.d(e,"random",function(){return N;}),t.d(e,"transformMat4",function(){return G;}),t.d(e,"transformQuat",function(){return J;}),t.d(e,"zero",function(){return tt;}),t.d(e,"str",function(){return at;}),t.d(e,"exactEquals",function(){return ut;}),t.d(e,"equals",function(){return K;}),t.d(e,"sub",function(){return Q;}),t.d(e,"mul",function(){return ft;}),t.d(e,"div",function(){return gt;}),t.d(e,"dist",function(){return mt;}),t.d(e,"sqrDist",function(){return wt;}),t.d(e,"len",function(){return ht;}),t.d(e,"sqrLen",function(){return Nt;}),t.d(e,"forEach",function(){return Rt;});var r=t(2);function n(){var X=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(X[0]=0,X[1]=0,X[2]=0,X[3]=0),X;}function s(X){var z=new r.ARRAY_TYPE(4);return z[0]=X[0],z[1]=X[1],z[2]=X[2],z[3]=X[3],z;}function c(X,z,q,nt){var j=new r.ARRAY_TYPE(4);return j[0]=X,j[1]=z,j[2]=q,j[3]=nt,j;}function l(X,z){return X[0]=z[0],X[1]=z[1],X[2]=z[2],X[3]=z[3],X;}function f(X,z,q,nt,j){return X[0]=z,X[1]=q,X[2]=nt,X[3]=j,X;}function h(X,z,q){return X[0]=z[0]+q[0],X[1]=z[1]+q[1],X[2]=z[2]+q[2],X[3]=z[3]+q[3],X;}function m(X,z,q){return X[0]=z[0]-q[0],X[1]=z[1]-q[1],X[2]=z[2]-q[2],X[3]=z[3]-q[3],X;}function u(X,z,q){return X[0]=z[0]*q[0],X[1]=z[1]*q[1],X[2]=z[2]*q[2],X[3]=z[3]*q[3],X;}function y(X,z,q){return X[0]=z[0]/q[0],X[1]=z[1]/q[1],X[2]=z[2]/q[2],X[3]=z[3]/q[3],X;}function T(X,z){return X[0]=Math.ceil(z[0]),X[1]=Math.ceil(z[1]),X[2]=Math.ceil(z[2]),X[3]=Math.ceil(z[3]),X;}function E(X,z){return X[0]=Math.floor(z[0]),X[1]=Math.floor(z[1]),X[2]=Math.floor(z[2]),X[3]=Math.floor(z[3]),X;}function C(X,z,q){return X[0]=Math.min(z[0],q[0]),X[1]=Math.min(z[1],q[1]),X[2]=Math.min(z[2],q[2]),X[3]=Math.min(z[3],q[3]),X;}function x(X,z,q){return X[0]=Math.max(z[0],q[0]),X[1]=Math.max(z[1],q[1]),X[2]=Math.max(z[2],q[2]),X[3]=Math.max(z[3],q[3]),X;}function I(X,z){return X[0]=Math.round(z[0]),X[1]=Math.round(z[1]),X[2]=Math.round(z[2]),X[3]=Math.round(z[3]),X;}function d(X,z,q){return X[0]=z[0]*q,X[1]=z[1]*q,X[2]=z[2]*q,X[3]=z[3]*q,X;}function v(X,z,q,nt){return X[0]=z[0]+q[0]*nt,X[1]=z[1]+q[1]*nt,X[2]=z[2]+q[2]*nt,X[3]=z[3]+q[3]*nt,X;}function p(X,z){var q=z[0]-X[0],nt=z[1]-X[1],j=z[2]-X[2],Z=z[3]-X[3];return Math.hypot(q,nt,j,Z);}function S(X,z){var q=z[0]-X[0],nt=z[1]-X[1],j=z[2]-X[2],Z=z[3]-X[3];return q*q+nt*nt+j*j+Z*Z;}function A(X){var z=X[0],q=X[1],nt=X[2],j=X[3];return Math.hypot(z,q,nt,j);}function R(X){var z=X[0],q=X[1],nt=X[2],j=X[3];return z*z+q*q+nt*nt+j*j;}function D(X,z){return X[0]=-z[0],X[1]=-z[1],X[2]=-z[2],X[3]=-z[3],X;}function U(X,z){return X[0]=1/z[0],X[1]=1/z[1],X[2]=1/z[2],X[3]=1/z[3],X;}function M(X,z){var q=z[0],nt=z[1],j=z[2],Z=z[3],O=q*q+nt*nt+j*j+Z*Z;return O>0&&(O=1/Math.sqrt(O)),X[0]=q*O,X[1]=nt*O,X[2]=j*O,X[3]=Z*O,X;}function W(X,z){return X[0]*z[0]+X[1]*z[1]+X[2]*z[2]+X[3]*z[3];}function Y(X,z,q,nt){var j=q[0]*nt[1]-q[1]*nt[0],Z=q[0]*nt[2]-q[2]*nt[0],O=q[0]*nt[3]-q[3]*nt[0],L=q[1]*nt[2]-q[2]*nt[1],$=q[1]*nt[3]-q[3]*nt[1],V=q[2]*nt[3]-q[3]*nt[2],rt=z[0],it=z[1],ct=z[2],St=z[3];return X[0]=it*V-ct*$+St*L,X[1]=-(rt*V)+ct*O-St*Z,X[2]=rt*$-it*O+St*j,X[3]=-(rt*L)+it*Z-ct*j,X;}function B(X,z,q,nt){var j=z[0],Z=z[1],O=z[2],L=z[3];return X[0]=j+nt*(q[0]-j),X[1]=Z+nt*(q[1]-Z),X[2]=O+nt*(q[2]-O),X[3]=L+nt*(q[3]-L),X;}function N(X,z){z=z||1;var q,nt,j,Z,O,L;do q=r.RANDOM()*2-1,nt=r.RANDOM()*2-1,O=q*q+nt*nt;while(O>=1);do j=r.RANDOM()*2-1,Z=r.RANDOM()*2-1,L=j*j+Z*Z;while(L>=1);var $=Math.sqrt((1-O)/L);return X[0]=z*q,X[1]=z*nt,X[2]=z*j*$,X[3]=z*Z*$,X;}function G(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=z[3];return X[0]=q[0]*nt+q[4]*j+q[8]*Z+q[12]*O,X[1]=q[1]*nt+q[5]*j+q[9]*Z+q[13]*O,X[2]=q[2]*nt+q[6]*j+q[10]*Z+q[14]*O,X[3]=q[3]*nt+q[7]*j+q[11]*Z+q[15]*O,X;}function J(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=q[0],L=q[1],$=q[2],V=q[3],rt=V*nt+L*Z-$*j,it=V*j+$*nt-O*Z,ct=V*Z+O*j-L*nt,St=-O*nt-L*j-$*Z;return X[0]=rt*V+St*-O+it*-$-ct*-L,X[1]=it*V+St*-L+ct*-O-rt*-$,X[2]=ct*V+St*-$+rt*-L-it*-O,X[3]=z[3],X;}function tt(X){return X[0]=0,X[1]=0,X[2]=0,X[3]=0,X;}function at(X){return"vec4("+X[0]+", "+X[1]+", "+X[2]+", "+X[3]+")";}function ut(X,z){return X[0]===z[0]&&X[1]===z[1]&&X[2]===z[2]&&X[3]===z[3];}function K(X,z){var q=X[0],nt=X[1],j=X[2],Z=X[3],O=z[0],L=z[1],$=z[2],V=z[3];return Math.abs(q-O)<=r.EPSILON*Math.max(1,Math.abs(q),Math.abs(O))&&Math.abs(nt-L)<=r.EPSILON*Math.max(1,Math.abs(nt),Math.abs(L))&&Math.abs(j-$)<=r.EPSILON*Math.max(1,Math.abs(j),Math.abs($))&&Math.abs(Z-V)<=r.EPSILON*Math.max(1,Math.abs(Z),Math.abs(V));}var Q=m,ft=u,gt=y,mt=p,wt=S,ht=A,Nt=R,Rt=function(){var X=n();return function(z,q,nt,j,Z,O){var L,$;for(q||(q=4),nt||(nt=0),j?$=Math.min(j*q+nt,z.length):$=z.length,L=nt;L<$;L+=q)X[0]=z[L],X[1]=z[L+1],X[2]=z[L+2],X[3]=z[L+3],Z(X,X,O),z[L]=X[0],z[L+1]=X[1],z[L+2]=X[2],z[L+3]=X[3];return z;};}();},/* 10 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return c;}),t.d(e,"clone",function(){return l;}),t.d(e,"fromValues",function(){return f;}),t.d(e,"fromRotationTranslationValues",function(){return h;}),t.d(e,"fromRotationTranslation",function(){return m;}),t.d(e,"fromTranslation",function(){return u;}),t.d(e,"fromRotation",function(){return y;}),t.d(e,"fromMat4",function(){return T;}),t.d(e,"copy",function(){return E;}),t.d(e,"identity",function(){return C;}),t.d(e,"set",function(){return x;}),t.d(e,"getReal",function(){return I;}),t.d(e,"getDual",function(){return d;}),t.d(e,"setReal",function(){return v;}),t.d(e,"setDual",function(){return p;}),t.d(e,"getTranslation",function(){return S;}),t.d(e,"translate",function(){return A;}),t.d(e,"rotateX",function(){return R;}),t.d(e,"rotateY",function(){return D;}),t.d(e,"rotateZ",function(){return U;}),t.d(e,"rotateByQuatAppend",function(){return M;}),t.d(e,"rotateByQuatPrepend",function(){return W;}),t.d(e,"rotateAroundAxis",function(){return Y;}),t.d(e,"add",function(){return B;}),t.d(e,"multiply",function(){return N;}),t.d(e,"mul",function(){return G;}),t.d(e,"scale",function(){return J;}),t.d(e,"dot",function(){return tt;}),t.d(e,"lerp",function(){return at;}),t.d(e,"invert",function(){return ut;}),t.d(e,"conjugate",function(){return K;}),t.d(e,"length",function(){return Q;}),t.d(e,"len",function(){return ft;}),t.d(e,"squaredLength",function(){return gt;}),t.d(e,"sqrLen",function(){return mt;}),t.d(e,"normalize",function(){return wt;}),t.d(e,"str",function(){return ht;}),t.d(e,"exactEquals",function(){return Nt;}),t.d(e,"equals",function(){return Rt;});var r=t(2),n=t(7),s=t(6);function c(){var X=new r.ARRAY_TYPE(8);return r.ARRAY_TYPE!=Float32Array&&(X[0]=0,X[1]=0,X[2]=0,X[4]=0,X[5]=0,X[6]=0,X[7]=0),X[3]=1,X;}function l(X){var z=new r.ARRAY_TYPE(8);return z[0]=X[0],z[1]=X[1],z[2]=X[2],z[3]=X[3],z[4]=X[4],z[5]=X[5],z[6]=X[6],z[7]=X[7],z;}function f(X,z,q,nt,j,Z,O,L){var $=new r.ARRAY_TYPE(8);return $[0]=X,$[1]=z,$[2]=q,$[3]=nt,$[4]=j,$[5]=Z,$[6]=O,$[7]=L,$;}function h(X,z,q,nt,j,Z,O){var L=new r.ARRAY_TYPE(8);L[0]=X,L[1]=z,L[2]=q,L[3]=nt;var $=j*0.5,V=Z*0.5,rt=O*0.5;return L[4]=$*nt+V*q-rt*z,L[5]=V*nt+rt*X-$*q,L[6]=rt*nt+$*z-V*X,L[7]=-$*X-V*z-rt*q,L;}function m(X,z,q){var nt=q[0]*0.5,j=q[1]*0.5,Z=q[2]*0.5,O=z[0],L=z[1],$=z[2],V=z[3];return X[0]=O,X[1]=L,X[2]=$,X[3]=V,X[4]=nt*V+j*$-Z*L,X[5]=j*V+Z*O-nt*$,X[6]=Z*V+nt*L-j*O,X[7]=-nt*O-j*L-Z*$,X;}function u(X,z){return X[0]=0,X[1]=0,X[2]=0,X[3]=1,X[4]=z[0]*0.5,X[5]=z[1]*0.5,X[6]=z[2]*0.5,X[7]=0,X;}function y(X,z){return X[0]=z[0],X[1]=z[1],X[2]=z[2],X[3]=z[3],X[4]=0,X[5]=0,X[6]=0,X[7]=0,X;}function T(X,z){var q=n.create();s.getRotation(q,z);var nt=new r.ARRAY_TYPE(3);return s.getTranslation(nt,z),m(X,q,nt),X;}function E(X,z){return X[0]=z[0],X[1]=z[1],X[2]=z[2],X[3]=z[3],X[4]=z[4],X[5]=z[5],X[6]=z[6],X[7]=z[7],X;}function C(X){return X[0]=0,X[1]=0,X[2]=0,X[3]=1,X[4]=0,X[5]=0,X[6]=0,X[7]=0,X;}function x(X,z,q,nt,j,Z,O,L,$){return X[0]=z,X[1]=q,X[2]=nt,X[3]=j,X[4]=Z,X[5]=O,X[6]=L,X[7]=$,X;}var I=n.copy;function d(X,z){return X[0]=z[4],X[1]=z[5],X[2]=z[6],X[3]=z[7],X;}var v=n.copy;function p(X,z){return X[4]=z[0],X[5]=z[1],X[6]=z[2],X[7]=z[3],X;}function S(X,z){var q=z[4],nt=z[5],j=z[6],Z=z[7],O=-z[0],L=-z[1],$=-z[2],V=z[3];return X[0]=(q*V+Z*O+nt*$-j*L)*2,X[1]=(nt*V+Z*L+j*O-q*$)*2,X[2]=(j*V+Z*$+q*L-nt*O)*2,X;}function A(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=z[3],L=q[0]*0.5,$=q[1]*0.5,V=q[2]*0.5,rt=z[4],it=z[5],ct=z[6],St=z[7];return X[0]=nt,X[1]=j,X[2]=Z,X[3]=O,X[4]=O*L+j*V-Z*$+rt,X[5]=O*$+Z*L-nt*V+it,X[6]=O*V+nt*$-j*L+ct,X[7]=-nt*L-j*$-Z*V+St,X;}function R(X,z,q){var nt=-z[0],j=-z[1],Z=-z[2],O=z[3],L=z[4],$=z[5],V=z[6],rt=z[7],it=L*O+rt*nt+$*Z-V*j,ct=$*O+rt*j+V*nt-L*Z,St=V*O+rt*Z+L*j-$*nt,Ct=rt*O-L*nt-$*j-V*Z;return n.rotateX(X,z,q),nt=X[0],j=X[1],Z=X[2],O=X[3],X[4]=it*O+Ct*nt+ct*Z-St*j,X[5]=ct*O+Ct*j+St*nt-it*Z,X[6]=St*O+Ct*Z+it*j-ct*nt,X[7]=Ct*O-it*nt-ct*j-St*Z,X;}function D(X,z,q){var nt=-z[0],j=-z[1],Z=-z[2],O=z[3],L=z[4],$=z[5],V=z[6],rt=z[7],it=L*O+rt*nt+$*Z-V*j,ct=$*O+rt*j+V*nt-L*Z,St=V*O+rt*Z+L*j-$*nt,Ct=rt*O-L*nt-$*j-V*Z;return n.rotateY(X,z,q),nt=X[0],j=X[1],Z=X[2],O=X[3],X[4]=it*O+Ct*nt+ct*Z-St*j,X[5]=ct*O+Ct*j+St*nt-it*Z,X[6]=St*O+Ct*Z+it*j-ct*nt,X[7]=Ct*O-it*nt-ct*j-St*Z,X;}function U(X,z,q){var nt=-z[0],j=-z[1],Z=-z[2],O=z[3],L=z[4],$=z[5],V=z[6],rt=z[7],it=L*O+rt*nt+$*Z-V*j,ct=$*O+rt*j+V*nt-L*Z,St=V*O+rt*Z+L*j-$*nt,Ct=rt*O-L*nt-$*j-V*Z;return n.rotateZ(X,z,q),nt=X[0],j=X[1],Z=X[2],O=X[3],X[4]=it*O+Ct*nt+ct*Z-St*j,X[5]=ct*O+Ct*j+St*nt-it*Z,X[6]=St*O+Ct*Z+it*j-ct*nt,X[7]=Ct*O-it*nt-ct*j-St*Z,X;}function M(X,z,q){var nt=q[0],j=q[1],Z=q[2],O=q[3],L=z[0],$=z[1],V=z[2],rt=z[3];return X[0]=L*O+rt*nt+$*Z-V*j,X[1]=$*O+rt*j+V*nt-L*Z,X[2]=V*O+rt*Z+L*j-$*nt,X[3]=rt*O-L*nt-$*j-V*Z,L=z[4],$=z[5],V=z[6],rt=z[7],X[4]=L*O+rt*nt+$*Z-V*j,X[5]=$*O+rt*j+V*nt-L*Z,X[6]=V*O+rt*Z+L*j-$*nt,X[7]=rt*O-L*nt-$*j-V*Z,X;}function W(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=z[3],L=q[0],$=q[1],V=q[2],rt=q[3];return X[0]=nt*rt+O*L+j*V-Z*$,X[1]=j*rt+O*$+Z*L-nt*V,X[2]=Z*rt+O*V+nt*$-j*L,X[3]=O*rt-nt*L-j*$-Z*V,L=q[4],$=q[5],V=q[6],rt=q[7],X[4]=nt*rt+O*L+j*V-Z*$,X[5]=j*rt+O*$+Z*L-nt*V,X[6]=Z*rt+O*V+nt*$-j*L,X[7]=O*rt-nt*L-j*$-Z*V,X;}function Y(X,z,q,nt){if(Math.abs(nt)<r.EPSILON)return E(X,z);var j=Math.hypot(q[0],q[1],q[2]);nt=nt*0.5;var Z=Math.sin(nt),O=Z*q[0]/j,L=Z*q[1]/j,$=Z*q[2]/j,V=Math.cos(nt),rt=z[0],it=z[1],ct=z[2],St=z[3];X[0]=rt*V+St*O+it*$-ct*L,X[1]=it*V+St*L+ct*O-rt*$,X[2]=ct*V+St*$+rt*L-it*O,X[3]=St*V-rt*O-it*L-ct*$;var Ct=z[4],Mt=z[5],Dt=z[6],At=z[7];return X[4]=Ct*V+At*O+Mt*$-Dt*L,X[5]=Mt*V+At*L+Dt*O-Ct*$,X[6]=Dt*V+At*$+Ct*L-Mt*O,X[7]=At*V-Ct*O-Mt*L-Dt*$,X;}function B(X,z,q){return X[0]=z[0]+q[0],X[1]=z[1]+q[1],X[2]=z[2]+q[2],X[3]=z[3]+q[3],X[4]=z[4]+q[4],X[5]=z[5]+q[5],X[6]=z[6]+q[6],X[7]=z[7]+q[7],X;}function N(X,z,q){var nt=z[0],j=z[1],Z=z[2],O=z[3],L=q[4],$=q[5],V=q[6],rt=q[7],it=z[4],ct=z[5],St=z[6],Ct=z[7],Mt=q[0],Dt=q[1],At=q[2],Ot=q[3];return X[0]=nt*Ot+O*Mt+j*At-Z*Dt,X[1]=j*Ot+O*Dt+Z*Mt-nt*At,X[2]=Z*Ot+O*At+nt*Dt-j*Mt,X[3]=O*Ot-nt*Mt-j*Dt-Z*At,X[4]=nt*rt+O*L+j*V-Z*$+it*Ot+Ct*Mt+ct*At-St*Dt,X[5]=j*rt+O*$+Z*L-nt*V+ct*Ot+Ct*Dt+St*Mt-it*At,X[6]=Z*rt+O*V+nt*$-j*L+St*Ot+Ct*At+it*Dt-ct*Mt,X[7]=O*rt-nt*L-j*$-Z*V+Ct*Ot-it*Mt-ct*Dt-St*At,X;}var G=N;function J(X,z,q){return X[0]=z[0]*q,X[1]=z[1]*q,X[2]=z[2]*q,X[3]=z[3]*q,X[4]=z[4]*q,X[5]=z[5]*q,X[6]=z[6]*q,X[7]=z[7]*q,X;}var tt=n.dot;function at(X,z,q,nt){var j=1-nt;return tt(z,q)<0&&(nt=-nt),X[0]=z[0]*j+q[0]*nt,X[1]=z[1]*j+q[1]*nt,X[2]=z[2]*j+q[2]*nt,X[3]=z[3]*j+q[3]*nt,X[4]=z[4]*j+q[4]*nt,X[5]=z[5]*j+q[5]*nt,X[6]=z[6]*j+q[6]*nt,X[7]=z[7]*j+q[7]*nt,X;}function ut(X,z){var q=gt(z);return X[0]=-z[0]/q,X[1]=-z[1]/q,X[2]=-z[2]/q,X[3]=z[3]/q,X[4]=-z[4]/q,X[5]=-z[5]/q,X[6]=-z[6]/q,X[7]=z[7]/q,X;}function K(X,z){return X[0]=-z[0],X[1]=-z[1],X[2]=-z[2],X[3]=z[3],X[4]=-z[4],X[5]=-z[5],X[6]=-z[6],X[7]=z[7],X;}var Q=n.length,ft=Q,gt=n.squaredLength,mt=gt;function wt(X,z){var q=gt(z);if(q>0){q=Math.sqrt(q);var nt=z[0]/q,j=z[1]/q,Z=z[2]/q,O=z[3]/q,L=z[4],$=z[5],V=z[6],rt=z[7],it=nt*L+j*$+Z*V+O*rt;X[0]=nt,X[1]=j,X[2]=Z,X[3]=O,X[4]=(L-nt*it)/q,X[5]=($-j*it)/q,X[6]=(V-Z*it)/q,X[7]=(rt-O*it)/q;}return X;}function ht(X){return"quat2("+X[0]+", "+X[1]+", "+X[2]+", "+X[3]+", "+X[4]+", "+X[5]+", "+X[6]+", "+X[7]+")";}function Nt(X,z){return X[0]===z[0]&&X[1]===z[1]&&X[2]===z[2]&&X[3]===z[3]&&X[4]===z[4]&&X[5]===z[5]&&X[6]===z[6]&&X[7]===z[7];}function Rt(X,z){var q=X[0],nt=X[1],j=X[2],Z=X[3],O=X[4],L=X[5],$=X[6],V=X[7],rt=z[0],it=z[1],ct=z[2],St=z[3],Ct=z[4],Mt=z[5],Dt=z[6],At=z[7];return Math.abs(q-rt)<=r.EPSILON*Math.max(1,Math.abs(q),Math.abs(rt))&&Math.abs(nt-it)<=r.EPSILON*Math.max(1,Math.abs(nt),Math.abs(it))&&Math.abs(j-ct)<=r.EPSILON*Math.max(1,Math.abs(j),Math.abs(ct))&&Math.abs(Z-St)<=r.EPSILON*Math.max(1,Math.abs(Z),Math.abs(St))&&Math.abs(O-Ct)<=r.EPSILON*Math.max(1,Math.abs(O),Math.abs(Ct))&&Math.abs(L-Mt)<=r.EPSILON*Math.max(1,Math.abs(L),Math.abs(Mt))&&Math.abs($-Dt)<=r.EPSILON*Math.max(1,Math.abs($),Math.abs(Dt))&&Math.abs(V-At)<=r.EPSILON*Math.max(1,Math.abs(V),Math.abs(At));}},/* 11 *//***/function(i,e,t){t.r(e),t.d(e,"create",function(){return n;}),t.d(e,"clone",function(){return s;}),t.d(e,"fromValues",function(){return c;}),t.d(e,"copy",function(){return l;}),t.d(e,"set",function(){return f;}),t.d(e,"add",function(){return h;}),t.d(e,"subtract",function(){return m;}),t.d(e,"multiply",function(){return u;}),t.d(e,"divide",function(){return y;}),t.d(e,"ceil",function(){return T;}),t.d(e,"floor",function(){return E;}),t.d(e,"min",function(){return C;}),t.d(e,"max",function(){return x;}),t.d(e,"round",function(){return I;}),t.d(e,"scale",function(){return d;}),t.d(e,"scaleAndAdd",function(){return v;}),t.d(e,"distance",function(){return p;}),t.d(e,"squaredDistance",function(){return S;}),t.d(e,"length",function(){return A;}),t.d(e,"squaredLength",function(){return R;}),t.d(e,"negate",function(){return D;}),t.d(e,"inverse",function(){return U;}),t.d(e,"normalize",function(){return M;}),t.d(e,"dot",function(){return W;}),t.d(e,"cross",function(){return Y;}),t.d(e,"lerp",function(){return B;}),t.d(e,"random",function(){return N;}),t.d(e,"transformMat2",function(){return G;}),t.d(e,"transformMat2d",function(){return J;}),t.d(e,"transformMat3",function(){return tt;}),t.d(e,"transformMat4",function(){return at;}),t.d(e,"rotate",function(){return ut;}),t.d(e,"angle",function(){return K;}),t.d(e,"zero",function(){return Q;}),t.d(e,"str",function(){return ft;}),t.d(e,"exactEquals",function(){return gt;}),t.d(e,"equals",function(){return mt;}),t.d(e,"len",function(){return wt;}),t.d(e,"sub",function(){return ht;}),t.d(e,"mul",function(){return Nt;}),t.d(e,"div",function(){return Rt;}),t.d(e,"dist",function(){return X;}),t.d(e,"sqrDist",function(){return z;}),t.d(e,"sqrLen",function(){return q;}),t.d(e,"forEach",function(){return nt;});var r=t(2);function n(){var j=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(j[0]=0,j[1]=0),j;}function s(j){var Z=new r.ARRAY_TYPE(2);return Z[0]=j[0],Z[1]=j[1],Z;}function c(j,Z){var O=new r.ARRAY_TYPE(2);return O[0]=j,O[1]=Z,O;}function l(j,Z){return j[0]=Z[0],j[1]=Z[1],j;}function f(j,Z,O){return j[0]=Z,j[1]=O,j;}function h(j,Z,O){return j[0]=Z[0]+O[0],j[1]=Z[1]+O[1],j;}function m(j,Z,O){return j[0]=Z[0]-O[0],j[1]=Z[1]-O[1],j;}function u(j,Z,O){return j[0]=Z[0]*O[0],j[1]=Z[1]*O[1],j;}function y(j,Z,O){return j[0]=Z[0]/O[0],j[1]=Z[1]/O[1],j;}function T(j,Z){return j[0]=Math.ceil(Z[0]),j[1]=Math.ceil(Z[1]),j;}function E(j,Z){return j[0]=Math.floor(Z[0]),j[1]=Math.floor(Z[1]),j;}function C(j,Z,O){return j[0]=Math.min(Z[0],O[0]),j[1]=Math.min(Z[1],O[1]),j;}function x(j,Z,O){return j[0]=Math.max(Z[0],O[0]),j[1]=Math.max(Z[1],O[1]),j;}function I(j,Z){return j[0]=Math.round(Z[0]),j[1]=Math.round(Z[1]),j;}function d(j,Z,O){return j[0]=Z[0]*O,j[1]=Z[1]*O,j;}function v(j,Z,O,L){return j[0]=Z[0]+O[0]*L,j[1]=Z[1]+O[1]*L,j;}function p(j,Z){var O=Z[0]-j[0],L=Z[1]-j[1];return Math.hypot(O,L);}function S(j,Z){var O=Z[0]-j[0],L=Z[1]-j[1];return O*O+L*L;}function A(j){var Z=j[0],O=j[1];return Math.hypot(Z,O);}function R(j){var Z=j[0],O=j[1];return Z*Z+O*O;}function D(j,Z){return j[0]=-Z[0],j[1]=-Z[1],j;}function U(j,Z){return j[0]=1/Z[0],j[1]=1/Z[1],j;}function M(j,Z){var O=Z[0],L=Z[1],$=O*O+L*L;return $>0&&($=1/Math.sqrt($)),j[0]=Z[0]*$,j[1]=Z[1]*$,j;}function W(j,Z){return j[0]*Z[0]+j[1]*Z[1];}function Y(j,Z,O){var L=Z[0]*O[1]-Z[1]*O[0];return j[0]=j[1]=0,j[2]=L,j;}function B(j,Z,O,L){var $=Z[0],V=Z[1];return j[0]=$+L*(O[0]-$),j[1]=V+L*(O[1]-V),j;}function N(j,Z){Z=Z||1;var O=r.RANDOM()*2*Math.PI;return j[0]=Math.cos(O)*Z,j[1]=Math.sin(O)*Z,j;}function G(j,Z,O){var L=Z[0],$=Z[1];return j[0]=O[0]*L+O[2]*$,j[1]=O[1]*L+O[3]*$,j;}function J(j,Z,O){var L=Z[0],$=Z[1];return j[0]=O[0]*L+O[2]*$+O[4],j[1]=O[1]*L+O[3]*$+O[5],j;}function tt(j,Z,O){var L=Z[0],$=Z[1];return j[0]=O[0]*L+O[3]*$+O[6],j[1]=O[1]*L+O[4]*$+O[7],j;}function at(j,Z,O){var L=Z[0],$=Z[1];return j[0]=O[0]*L+O[4]*$+O[12],j[1]=O[1]*L+O[5]*$+O[13],j;}function ut(j,Z,O,L){var $=Z[0]-O[0],V=Z[1]-O[1],rt=Math.sin(L),it=Math.cos(L);return j[0]=$*it-V*rt+O[0],j[1]=$*rt+V*it+O[1],j;}function K(j,Z){var O=j[0],L=j[1],$=Z[0],V=Z[1],rt=Math.sqrt(O*O+L*L)*Math.sqrt($*$+V*V),it=rt&&(O*$+L*V)/rt;return Math.acos(Math.min(Math.max(it,-1),1));}function Q(j){return j[0]=0,j[1]=0,j;}function ft(j){return"vec2("+j[0]+", "+j[1]+")";}function gt(j,Z){return j[0]===Z[0]&&j[1]===Z[1];}function mt(j,Z){var O=j[0],L=j[1],$=Z[0],V=Z[1];return Math.abs(O-$)<=r.EPSILON*Math.max(1,Math.abs(O),Math.abs($))&&Math.abs(L-V)<=r.EPSILON*Math.max(1,Math.abs(L),Math.abs(V));}var wt=A,ht=m,Nt=u,Rt=y,X=p,z=S,q=R,nt=function(){var j=n();return function(Z,O,L,$,V,rt){var it,ct;for(O||(O=2),L||(L=0),$?ct=Math.min($*O+L,Z.length):ct=Z.length,it=L;it<ct;it+=O)j[0]=Z[it],j[1]=Z[it+1],V(j,j,rt),Z[it]=j[0],Z[it+1]=j[1];return Z;};}();},/* 12 *//***/function(i,e,t){t.r(e);var r=t(13);t.d(e,"Renderer",function(){return r["default"];});var n=t(40);t.d(e,"Figure2D",function(){return n["default"];});var s=t(56);t.d(e,"Mesh2D",function(){return s["default"];});var c=t(29);t.d(e,"MeshCloud",function(){return c["default"];});var l=t(23);t.d(e,"parseFont",function(){return l["default"];});var f=t(31);t.d(e,"parseColor",function(){return f["default"];});var h=t(21);t.d(e,"ENV",function(){return h["default"];}),t(1).glMatrix.setMatrixArrayType(Array);},/* 13 *//***/function(i,e,t){t.r(e),t.d(e,"default",function(){return U;});var r=t(14),n=t(1),s=t(20),c=t(27),l=t(25),f=t(40),h=t(56),m=t(29),u=t(59),y=t(21),T=t(63);t(1).glMatrix.setMatrixArrayType(Array);var E={autoUpdate:!1,// premultipliedAlpha: true,
|
|
2
2
|
preserveDrawingBuffer:!1,// depth: false,
|
|
3
3
|
// antialias: false,
|
|
4
4
|
bufferSize:1500},C="attribute vec3 a_vertexPosition;\nattribute vec3 a_vertexTextureCoord;\nvarying vec3 vTextureCoord;\nuniform mat3 viewMatrix;\nuniform mat3 projectionMatrix;\n\nvoid main() {\n gl_PointSize = 1.0;\n vec3 pos = projectionMatrix * viewMatrix * vec3(a_vertexPosition.xy, 1.0);\n gl_Position = vec4(pos.xy, 1.0, 1.0); \n vTextureCoord = a_vertexTextureCoord; \n}\n",x="precision mediump float;\nvarying vec3 vTextureCoord;\nuniform sampler2D u_texSampler;\nvoid main() {\n gl_FragColor = texture2D(u_texSampler, vTextureCoord.xy);\n}\n",I=Symbol("glRenderer"),d=Symbol("canvasRenderer"),v=Symbol("options"),p=Symbol("globalTransform"),S=Symbol("applyGlobalTransform"),A=Symbol("canvas");function R(M){var W=M.gl,Y=M.fbo;Y&&W.bindFramebuffer(W.FRAMEBUFFER,Y),M._draw(),Y&&W.bindFramebuffer(W.FRAMEBUFFER,null);}function D(M,W,Y,B){var N=M.createTexture(W.canvas),G=[[[0,0],[Y,0],[Y,B],[0,B],[0,0]]];G.closed=!0;var J=new h["default"]({contours:G});J.setTexture(N),M.setMeshData([J.meshData]),R(M),N["delete"](),W.clearRect(0,0,Y,B),delete W._filter;}var U=/*#__PURE__*/function(){function U(W){var Y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,U);var B=Y.contextType;if(B||(typeof WebGL2RenderingContext=="function"?B="webgl2":typeof WebGLRenderingContext=="function"?B="webgl":B="2d"),!W.getContext){var N=W;W={getContext:function getContext(){return N;},width:Y.width,height:Y.height},N.canvas=W,B="2d";}if(this[A]=W,B!=="webgl"&&B!=="webgl2"&&B!=="2d")throw new Error("Unknown context type ".concat(B));if(Y.contextType=B,this[v]=Object.assign({},E,Y),B==="webgl"||B==="webgl2"){B==="webgl2"&&(this[v].webgl2=!0);var _N=new r["default"](W,this[v]);B==="webgl2"&&!_N.isWebGL2&&(Y.contextType="webgl"),Object(T.createShaders)(_N),Object(T.applyShader)(_N),Object(T.createCloudShaders)(_N);var G=_N.gl;G.clearColor(0,0,0,0),G.blendFuncSeparate(G.SRC_ALPHA,G.ONE_MINUS_SRC_ALPHA,G.ONE,G.ONE_MINUS_SRC_ALPHA),this[I]=_N;}else this[d]=new s["default"](W,this[v]);this[p]=[1,0,0,0,1,0,0,0,1],this.updateResolution();}return _createClass(U,[{key:"canvas",get:function get(){return this[A];}},{key:"canvasRenderer",get:function get(){return this[d];}},{key:"glRenderer",get:function get(){return this[I];}},{key:"isWebGL2",get:function get(){return this[I]&&this[I].isWebGL2;}},{key:"options",get:function get(){return this[v];}},{key:"globalTransformMatrix",get:function get(){var W=this[p];return[W[0],W[1],W[3],W[4],W[6],W[7]];}},{key:"viewMatrix",get:function get(){return this[p];}},{key:S,value:function value(){var W=this[I]||this[d];if(this[I]){var _this$canvas=this.canvas,Y=_this$canvas.width,B=_this$canvas.height;W.uniforms.viewMatrix=this.viewMatrix,W.uniforms.projectionMatrix=this.projectionMatrix,W.uniforms.u_resolution=[Y,B];}}},{key:"updateResolution",value:function updateResolution(){var _this$canvas2=this.canvas,W=_this$canvas2.width,Y=_this$canvas2.height,B=[// translation
|
|
@@ -362,7 +362,7 @@ _inherits(l,_r$default22);return _createClass(l,[{key:"texture",get:function get
|
|
|
362
362
|
height
|
|
363
363
|
mode: 'static', 'scale', 'stickyWidth', 'stickyHeight', 'stickyTop', 'stickyBottom', 'stickyLeft', 'stickyRight'
|
|
364
364
|
*/function A(){var _this44;var D=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,A);if(_this44=_callSuper(this,A),!D.container)if(typeof n.ENV.Container=="function")D.container=new n.ENV.Container(D.width||300,D.height||150);else throw new Error("No container specified.");if(_this44.container=D.container,_this44.container.style&&(_this44.container.style.overflow||(_this44.container.style.overflow="hidden"),_this44.container.style.position||(_this44.container.style.position="relative")),_this44.options=D,D.displayRatio=D.displayRatio||1,D.mode=D.mode||"scale",D.left=0,D.top=0,D.autoResize=D.autoResize!==!1,D.autoResize){var U;if((typeof globalThis==="undefined"?"undefined":_typeof(globalThis))<"u"?U=globalThis:U=(typeof window==="undefined"?"undefined":_typeof(window))<"u"?window:r,U.addEventListener){var M=_this44;U.addEventListener("resize",function W(){(typeof document==="undefined"?"undefined":_typeof(document))<"u"&&document.contains(M.container)?M.resize():U.removeEventListener("resize",W);});}}_this44[E]=/* @__PURE__ */new Set(),_this44.setResolution(D),v(_this44),_this44[S]=0;return _this44;}_inherits(A,_h$default);return _createClass(A,[{key:"hasOffscreenCanvas",get:function get(){return this[S]>0;}},{key:"displayRatio",get:function get(){return this.options.displayRatio;},set:function set(D){this.options.displayRatio!==D&&(this.options.displayRatio=D,this.resize());}},{key:"height",get:function get(){return this.options.height;},set:function set(D){this.options.height!==D&&(this.options.height=D,this.resize());}},{key:"mode",get:function get(){return this.options.mode;},set:function set(D){this.options.mode!==D&&(this.options.mode=D,this.resize());}},{key:"width",get:function get(){return this.options.width;}/* override */,set:function set(D){this.options.width!==D&&(this.options.width=D,this.resize());}},{key:"appendChild",value:function appendChild(D){!(D instanceof l["default"])&&!(D instanceof f["default"])&&C(D);var U=_superPropGet(A,"appendChild",this,3)([D]),M=D.canvas;return D.offscreen?this[S]++:this.container.appendChild(M),p(this.options,M),D.setResolution(this.getResolution()),U;}/* override */},{key:"forceUpdate",value:function forceUpdate(){var _this45=this;this.hasOffscreenCanvas&&!this._requestID&&(this._requestID=Object(s.requestAnimationFrame)(function(){delete _this45._requestID,_this45.render();}));}/* override */},{key:"insertBefore",value:function insertBefore(D,U){!(D instanceof l["default"])&&!(D instanceof f["default"])&&C(D);var M=_superPropGet(A,"insertBefore",this,3)([D,U]),W=D.canvas;if(!D.offscreen){var Y=x(this,D);this.container.insertBefore(W,Y);}return p(this.options,W),D.setResolution(this.getResolution()),M;}},{key:"layer",value:function layer(){var D=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"default";var U=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};U=Object.assign({},this.options,U),U.id=D;var M=this.orderedChildren;for(var B=0;B<M.length;B++)if(M[B].id===D)return M[B];var W=U.worker;var Y;return W?Y=new f["default"](U):Y=new l["default"](U),this.appendChild(Y),Y;}},{key:"preload",value:function(){var _preload=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(){var _this46=this;var _len13,D,_key13,U,M,W,_loop2,Y,_args11=arguments;return _regeneratorRuntime().wrap(function _callee10$(_context11){while(1)switch(_context11.prev=_context11.next){case 0:for(_len13=_args11.length,D=new Array(_len13),_key13=0;_key13<_len13;_key13++){D[_key13]=_args11[_key13];}U=[],M=[],W=[];_loop2=/*#__PURE__*/_regeneratorRuntime().mark(function _loop2(Y){var B,N,G,J;return _regeneratorRuntime().wrap(function _loop2$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:B=D[Y];if(typeof B=="string")N=Object(y.loadTexture)(B);else if(Array.isArray(B))N=Object(y.loadFrames).apply(void 0,_toConsumableArray(B));else{G=B.id,J=B.src;N=Object(y.loadTexture)(J,G);}N instanceof Promise||(N=Promise.resolve(N)),M.push(N.then(function(G){U.push(G),W[Y]=G;var J=new u["default"]({type:"preload",detail:{current:G,loaded:U,resources:D}});_this46.dispatchEvent(J);}));case 3:case"end":return _context10.stop();}},_loop2);});Y=0;case 4:if(!(Y<D.length)){_context11.next=9;break;}return _context11.delegateYield(_loop2(Y),"t0",6);case 6:Y++;_context11.next=4;break;case 9:_context11.next=11;return Promise.all(M);case 11:return _context11.abrupt("return",W);case 12:case"end":return _context11.stop();}},_callee10);}));function preload(){return _preload.apply(this,arguments);}return preload;}()/* override */},{key:"removeChild",value:function removeChild(D){var U=_superPropGet(A,"removeChild",this,3)([D]);if(U){D._prepareRenderFinished&&D._prepareRenderFinished();var M=D.canvas;M&&M.remove&&M.remove(),D.offscreen&&this[S]--;}return U;}// for offscreen mode rendering
|
|
365
|
-
},{key:"render",value:function render(){var D=this.orderedChildren;var U=null;var M=[];for(var W=0;W<D.length;W++){var Y=D[W],B=M.length>0;if(Y instanceof l["default"]&&!Y.offscreen){if(!Y.autoRender)B&&(console.warn("Some offscreen canvas will not be rendered."),M.length=0);else if(U=Y,B){Y.renderer.clear();for(var N=0;N<M.length;N++){var G=M[N];G.render(),I(Y,G);}M.length=0,Y.render({clear:!1});}else Y.prepareRender&&Y.render();}else Y.offscreen?U?(Y.prepareRender&&Y.render(),I(U,Y)):M.push(Y):Y instanceof f["default"]&&B&&(console.warn("Some offscreen canvas will not be rendered."),M.length=0);}}/* override */},{key:"replaceChild",value:function replaceChild(D,U){var M=_superPropGet(A,"replaceChild",this,3)([D,U]);U.canvas.remove&&U.canvas.remove(),U.offscreen&&this[S]--;var W=D.canvas;if(!D.offscreen){var Y=x(this,D);this.container.insertBefore(W,Y);}return p(this.options,W),D.setResolution(this.getResolution()),M;}},{key:"resize",value:function resize(){var D=this.options;this.children.forEach(function(U){p(D,U.canvas);}),this.setResolution(D),this.dispatchEvent({type:"resize"});}/* override */},{key:"setResolution",value:function setResolution(){var _D4,_U10;var _ref160=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},D=_ref160.width,U=_ref160.height;var M=this.container,W=M.clientWidth,Y=M.clientHeight;(D==null||U==null)&&(D=(_D4=D)!==null&&_D4!==void 0?_D4:W,U=(_U10=U)!==null&&_U10!==void 0?_U10:Y);var _this$options=this.options,B=_this$options.mode,N=_this$options.displayRatio;if(D*=N,U*=N,this.options.left=0,this.options.top=0,B==="stickyHeight"||B==="stickyLeft"||B==="stickyRight"){var G=D;D=W*U/Y,B==="stickyHeight"&&(this.options.left=0.5*(D-G)),B==="stickyRight"&&(this.options.left=D-G);}else if(B==="stickyWidth"||B==="stickyTop"||B==="stickyBottom"){var _G4=U;U=Y*D/W,B==="stickyWidth"&&(this.options.top=0.5*(U-_G4)),B==="stickyBottom"&&(this.options.top=U-_G4);}_superPropGet(A,"setResolution",this,3)([{width:D,height:U}]);}},{key:"snapshot",value:function snapshot(){var _ref161=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref161$offscreen=_ref161.offscreen,D=_ref161$offscreen===void 0?!1:_ref161$offscreen,U=_ref161.layers;var M=D?"snapshotOffScreenCanvas":"snapshotCanvas",_this$getResolution9=this.getResolution(),W=_this$getResolution9.width,Y=_this$getResolution9.height;this[M]=this[M]||n.ENV.createCanvas(W,Y,{offscreen:D});var B=this[M].getContext("2d");U=U||this.orderedChildren,this[M].width=W,this[M].height=Y;for(var N=0;N<U.length;N++){var G=U[N];if(!G.options.ignoreSnapshot){G.render&&G.render();var J=G.canvas;J&&J!==G&&B.drawImage(J,0,0,W,Y);}}return this[M];}}]);}(h["default"]);(typeof document==="undefined"?"undefined":_typeof(document))<"u"&&(A.prototype.layer3d=function(R){var _this47=this;var D=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var U=D.url||"https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.min.js";return new Promise(function(M,W){var Y=document.createElement("script");Y.async=!1,Y.src=U,Y.onload=function(){try{M(_this47.layer3d(R,D));}catch(B){W(B);}},document.documentElement.appendChild(Y);});}),T["default"].registerNode(A,"scene");}.call(this,t(22));},/* 291 *//***/function(i,e,t){t.r(e),t.d(e,"default",function(){return n;});var r=t(214);t(1).glMatrix.setMatrixArrayType(Array);function n(s){var _ref162=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref162$offsetTop=_ref162.offsetTop,c=_ref162$offsetTop===void 0?0:_ref162$offsetTop,_ref162$offsetLeft=_ref162.offsetLeft,l=_ref162$offsetLeft===void 0?0:_ref162$offsetLeft,_ref162$displayRatio=_ref162.displayRatio,f=_ref162$displayRatio===void 0?1:_ref162$displayRatio;var h,m;var u=[],_s$target$getBounding=s.target.getBoundingClientRect(),y=_s$target$getBounding.left,T=_s$target$getBounding.top,E=_s$target$getBounding.width,C=_s$target$getBounding.height,x=s.target.width,I=s.target.height,d=s.changedTouches||[s];for(var p=0;p<d.length;p++){var S=d[p],A=S.identifier,R=S.clientX,D=S.clientY;R!=null&&D!=null&&u.push({x:Math.round((R|0)-y),y:Math.round((D|0)-T),identifier:A});}u.length<=0&&u.push({x:h,y:m});var v=[];return u.forEach(function(p){p.x!=null&&p.y!=null&&(h=(p.x*x/E-l)/f,m=(p.y*I/C-c)/f);var S=new r["default"](s);Object.defineProperties(S,{layerX:{value:h,configurable:!0},layerY:{value:m,configurable:!0},originalX:{value:p.x},originalY:{value:p.y},x:{value:h,configurable:!0},y:{value:m,configurable:!0},identifier:{value:p.identifier}}),v.push(S);}),v;}}/******/]);be.version;be.Arc;be.Block;be.Cloud;be.Color;var qy=be.Ellipse;be.Gradient;var mr=be.Group,_y=be.Label,el=be.Layer;be.LayerWorker;be.Node;be.Parallel;var Mn=be.Path,dn=be.Polyline,zc=be.Rect;be.Regular;be.Ring;var Uu=be.Scene,Yu=be.Sprite;be.SpriteSvg;be.Star;be.Triangle;be.helpers;be.createElement;be.isSpriteNode;be.registerNode;be.requestAnimationFrame;be.cancelAnimationFrame;be.ENV;var we=/* @__PURE__ */function(i){return i.Normal="Normal",i.Stroke="Stroke",i.Dotted="Dotted",i.LongDotted="LongDotted",i;}(we||{}),he=/* @__PURE__ */function(i){return i.None="None",i.ShowFloatBar="ShowFloatBar",i.ZIndexFloatBar="ZIndexFloatBar",i.DeleteNode="DeleteNode",i.CopyNode="CopyNode",i.ZIndexActive="ZIndexActive",i.ZIndexNode="ZIndexNode",i.RotateNode="RotateNode",i.SetColorNode="SetColorNode",i.TranslateNode="TranslateNode",i.ScaleNode="ScaleNode",i.OriginalEvent="OriginalEvent",i.CreateScene="CreateScene",i.ActiveCursor="ActiveCursor",i.MoveCursor="MoveCursor",i.CommandEditor="CommandEditor",i.SetEditorData="SetEditorData",i.SetFontStyle="SetFontStyle",i.SetPoint="SetPoint",i.SetLock="SetLock",i.SetShapeOpt="SetShapeOpt",i.CameraChange="CameraChange",i.ActiveMethod="ActiveMethod",i.HidFloatBarBtn="HidFloatBarBtn",i;}(he||{}),Tt=/* @__PURE__ */function(i){return i[i.Pencil=1]="Pencil",i[i.Eraser=2]="Eraser",i[i.PencilEraser=3]="PencilEraser",i[i.BitMapEraser=4]="BitMapEraser",i[i.Selector=5]="Selector",i[i.Clicker=6]="Clicker",i[i.Arrow=7]="Arrow",i[i.Hand=8]="Hand",i[i.LaserPen=9]="LaserPen",i[i.Text=10]="Text",i[i.Straight=11]="Straight",i[i.Rectangle=12]="Rectangle",i[i.Ellipse=13]="Ellipse",i[i.Star=14]="Star",i[i.Triangle=15]="Triangle",i[i.Rhombus=16]="Rhombus",i[i.Polygon=17]="Polygon",i[i.SpeechBalloon=18]="SpeechBalloon",i[i.Image=19]="Image",i;}(Tt||{}),Vt=/* @__PURE__ */function(i){return i[i.Local=1]="Local",i[i.Service=2]="Service",i[i.Worker=3]="Worker",i;}(Vt||{}),te=/* @__PURE__ */function(i){return i[i.Pending=0]="Pending",i[i.Start=1]="Start",i[i.Doing=2]="Doing",i[i.Done=3]="Done",i[i.Unwritable=4]="Unwritable",i;}(te||{}),xt=/* @__PURE__ */function(i){return i[i.None=0]="None",i[i.Init=1]="Init",i[i.UpdateCamera=2]="UpdateCamera",i[i.UpdateTools=3]="UpdateTools",i[i.CreateWork=4]="CreateWork",i[i.DrawWork=5]="DrawWork",i[i.FullWork=6]="FullWork",i[i.UpdateNode=7]="UpdateNode",i[i.RemoveNode=8]="RemoveNode",i[i.Clear=9]="Clear",i[i.Select=10]="Select",i[i.Destroy=11]="Destroy",i[i.Snapshot=12]="Snapshot",i[i.BoundingBox=13]="BoundingBox",i[i.Cursor=14]="Cursor",i[i.TextUpdate=15]="TextUpdate",i[i.GetTextActive=16]="GetTextActive",i[i.TasksQueue=17]="TasksQueue",i[i.CursorHover=18]="CursorHover",i[i.CursorBlur=19]="CursorBlur",i[i.Console=20]="Console",i[i.GetImageBitMap=23]="GetImageBitMap",i[i.AuthWriter=24]="AuthWriter",i[i.AuthReader=25]="AuthReader",i[i.AuthClear=26]="AuthClear",i[i.AuthPage=27]="AuthPage",i[i.GetVNodeInfo=28]="GetVNodeInfo",i[i.UpdateDpr=29]="UpdateDpr",i[i.SetFontFace=30]="SetFontFace",i;}(xt||{}),Ut=/* @__PURE__ */function(i){return i[i.None=0]="None",i[i.Bg=1]="Bg",i[i.ServiceFloat=2]="ServiceFloat",i[i.Float=3]="Float",i[i.TopFloat=4]="TopFloat",i;}(Ut||{}),Ae=/* @__PURE__ */function(i){return i[i.none=1]="none",i[i.all=2]="all",i[i.both=3]="both",i[i.proportional=4]="proportional",i;}(Ae||{}),Tr=/* @__PURE__ */function(i){return i[i.inside=0]="inside",i[i.outside=1]="outside",i[i.intersect=2]="intersect",i;}(Tr||{}),cl=/* @__PURE__ */function(i){return i.Image="image",i.Iconify="iconify",i;}(cl||{});var kr=/*#__PURE__*/function(){function kr(){_classCallCheck(this,kr);dt(this,"localWork");dt(this,"serviceWork");dt(this,"threadEngine");}return _createClass(kr,[{key:"registerForWorker",value:function registerForWorker(e){return this.threadEngine=e,this.localWork=e.localWork,this.serviceWork=e.serviceWork,this;}}]);}();var t1=/*#__PURE__*/function(_kr){function t1(){var _this48;_classCallCheck(this,t1);_this48=_callSuper(this,t1,arguments);dt(_this48,"emitEventType",he.CopyNode);return _this48;}_inherits(t1,_kr);return _createClass(t1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.FullWork&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(t){var n,r;return _regeneratorRuntime().wrap(function _callee11$(_context12){while(1)switch(_context12.prev=_context12.next){case 0:r=t.workId;_context12.t0=r;if(!_context12.t0){_context12.next=5;break;}_context12.next=5;return(n=this.localWork)==null?void 0:n.consumeFull(t);case 5:case"end":return _context12.stop();}},_callee11,this);}));function consumeForLocalWorker(_x24){return _consumeForLocalWorker.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(kr);var mi="++",Me="selector",e1="all";var r1=/*#__PURE__*/function(_kr2){function r1(){var _this49;_classCallCheck(this,r1);_this49=_callSuper(this,r1,arguments);dt(_this49,"emitEventType",he.SetColorNode);return _this49;}_inherits(r1,_kr2);return _createClass(r1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(t){var h,r,n,s,c,l,f;return _regeneratorRuntime().wrap(function _callee12$(_context13){while(1)switch(_context13.prev=_context13.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.textUpdateForWoker;_context13.t0=r===Me&&n;if(!_context13.t0){_context13.next=5;break;}_context13.next=5;return(h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,callback:this.updateSelectorCallback});case 5:case"end":return _context13.stop();}},_callee12,this);}));function consumeForLocalWorker(_x25){return _consumeForLocalWorker2.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=r.willSyncService,l=r.isSync,f=r.textUpdateForWoker,h=n.render||[],m=n.sp||[];if(c){var _iterator3=_createForOfIteratorHelper(s.entries()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),u=_step3$value[0],y=_step3$value[1];f&&y.toolsType===Tt.Text?m.push(_objectSpread(_objectSpread({},y),{},{workId:u,type:xt.TextUpdate,dataType:Vt.Local,willSyncService:!0})):m.push(_objectSpread(_objectSpread({},y),{},{workId:u,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}return{render:h,sp:m};}}]);}(kr);var n1=/*#__PURE__*/function(_kr3){function n1(){var _this50;_classCallCheck(this,n1);_this50=_callSuper(this,n1,arguments);dt(_this50,"emitEventType",he.ZIndexNode);return _this50;}_inherits(n1,_kr3);return _createClass(n1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(t){var f,r,n,s,c,l;return _regeneratorRuntime().wrap(function _callee13$(_context14){while(1)switch(_context14.prev=_context14.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData;_context14.t0=r===Me&&n;if(!_context14.t0){_context14.next=5;break;}_context14.next=5;return(f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback});case 5:case"end":return _context14.stop();}},_callee13,this);}));function consumeForLocalWorker(_x26){return _consumeForLocalWorker3.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=r.willSyncService,l=r.isSync,f=n.render||[],h=n.sp||[];if(c&&h){var _iterator4=_createForOfIteratorHelper(s.entries()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _step4$value=_slicedToArray(_step4.value,2),m=_step4$value[0],u=_step4$value[1];h.push(_objectSpread(_objectSpread({},u),{},{workId:m,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}return{render:f,sp:h};}}]);}(kr);var i1=/*#__PURE__*/function(_kr4){function i1(){var _this51;_classCallCheck(this,i1);_this51=_callSuper(this,i1,arguments);dt(_this51,"emitEventType",he.TranslateNode);return _this51;}_inherits(i1,_kr4);return _createClass(i1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(t){var u,y,r,n,s,c,l,f,h,m;return _regeneratorRuntime().wrap(function _callee14$(_context15){while(1)switch(_context15.prev=_context15.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.textUpdateForWoker,h=t.emitEventType,m=t.smoothSync;_context15.t0=r===Me&&n;if(!_context15.t0){_context15.next=9;break;}if(!(n.workState===te.Done&&n!=null&&n.translate&&(n.translate[0]||n.translate[1])||n.workState!==te.Done)){_context15.next=8;break;}_context15.next=6;return(u=this.localWork)==null?void 0:u.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,isSync:!0,textUpdateForWoker:f,emitEventType:h,callback:this.updateSelectorCallback,smoothSync:m});case 6:_context15.next=9;break;case 8:n.workState===te.Done&&((y=this.localWork)==null||y.vNodes.deleteLastTarget());case 9:case"end":return _context15.stop();}},_callee14,this);}));function consumeForLocalWorker(_x27){return _consumeForLocalWorker4.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=t.workShapeNode,l=t.res,f=t.smoothSync,h=r.willSyncService,m=r.isSync,u=r.updateSelectorOpt,y=r.textUpdateForWoker,T=u.workState,E=n.render||[],C=n.sp||[];if(T===te.Start)return{sp:[],render:[]};var x=l==null?void 0:l.selectRect;if(h){C.push({type:xt.Select,selectIds:c.selectIds,selectRect:x,willSyncService:T===te.Done?!0:f,isSync:!0,points:T===te.Done&&c.getChildrenPoints()||void 0,textOpt:c.textOpt});var _I29={useAnimation:u.useAnimation||!1};u.uid&&(_I29.uid=u.uid);var _iterator5=_createForOfIteratorHelper(s.entries()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_slicedToArray(_step5.value,2),_d27=_step5$value[0],v=_step5$value[1];y&&v.toolsType===Tt.Text?C.push(_objectSpread(_objectSpread({},v),{},{workId:_d27,type:xt.TextUpdate,dataType:Vt.Local,willSyncService:T===te.Done?!0:f,updateNodeOpt:_I29})):(f||T===te.Done)&&C.push(_objectSpread(_objectSpread({},v),{},{workId:_d27,type:xt.UpdateNode,updateNodeOpt:_I29,isSync:m}));}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}return{render:E,sp:C};}}]);}(kr);var s1=/*#__PURE__*/function(_kr5){function s1(){var _this52;_classCallCheck(this,s1);_this52=_callSuper(this,s1,arguments);dt(_this52,"emitEventType",he.DeleteNode);return _this52;}_inherits(s1,_kr5);return _createClass(s1,[{key:"consume",value:function consume(){return!1;}}]);}(kr);var o1=/*#__PURE__*/function(_kr6){function o1(){var _this53;_classCallCheck(this,o1);_this53=_callSuper(this,o1,arguments);dt(_this53,"emitEventType",he.ScaleNode);return _this53;}_inherits(o1,_kr6);return _createClass(o1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(t){var f,r,n,s,c,l;return _regeneratorRuntime().wrap(function _callee15$(_context16){while(1)switch(_context16.prev=_context16.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willSyncService,c=t.willSerializeData,l=t.smoothSync;_context16.t0=r===Me&&n;if(!_context16.t0){_context16.next=5;break;}_context16.next=5;return(f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willSyncService:s,willSerializeData:c,isSync:!0,callback:this.updateSelectorCallback.bind(this),smoothSync:l});case 5:case"end":return _context16.stop();}},_callee15,this);}));function consumeForLocalWorker(_x28){return _consumeForLocalWorker5.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.workShapeNode,c=t.res,l=t.newServiceStore,f=t.smoothSync,h=r.updateSelectorOpt,m=r.willSyncService,u=h.workState,y=n.render||[],T=n.sp||[],E=c==null?void 0:c.selectRect;if(u===te.Start)return{sp:[],render:[]};if(m){T.push({type:xt.Select,selectIds:s.selectIds,selectRect:E,willSyncService:u===te.Done?!0:f,isSync:!0,points:u===te.Done&&s.getChildrenPoints()||void 0,textOpt:s.textOpt});var C={useAnimation:h.useAnimation||!1};h.uid&&(C.uid=h.uid);var _iterator6=_createForOfIteratorHelper(l.entries()),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _step6$value=_slicedToArray(_step6.value,2),x=_step6$value[0],_I30=_step6$value[1];_I30.toolsType===Tt.Text?T.push(_objectSpread(_objectSpread({},_I30),{},{workId:x,type:xt.TextUpdate,dataType:Vt.Local,willSyncService:u===te.Done?!0:f,updateNodeOpt:C})):(f||u===te.Done)&&T.push(_objectSpread(_objectSpread({},_I30),{},{workId:x,type:xt.UpdateNode,updateNodeOpt:C,isSync:!0}));}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}return{render:y,sp:T};}}]);}(kr);var a1=/*#__PURE__*/function(_kr7){function a1(){var _this54;_classCallCheck(this,a1);_this54=_callSuper(this,a1,arguments);dt(_this54,"emitEventType",he.RotateNode);return _this54;}_inherits(a1,_kr7);return _createClass(a1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(t){var m,r,n,s,c,l,f,h;return _regeneratorRuntime().wrap(function _callee16$(_context17){while(1)switch(_context17.prev=_context17.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.emitEventType,h=t.smoothSync;_context17.t0=r===Me&&n;if(!_context17.t0){_context17.next=5;break;}_context17.next=5;return(m=this.localWork)==null?void 0:m.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,emitEventType:f,isSync:!0,callback:this.updateSelectorCallback,smoothSync:h});case 5:case"end":return _context17.stop();}},_callee16,this);}));function consumeForLocalWorker(_x29){return _consumeForLocalWorker6.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.workShapeNode,c=t.res,l=t.newServiceStore,f=t.smoothSync,h=r.updateSelectorOpt,m=r.willSyncService,u=r.willSerializeData,y=r.isSync,T=h.workState,E=n.render||[],C=n.sp||[],x=c==null?void 0:c.selectRect;if(m){u&&T===te.Done&&C.push({type:xt.Select,selectIds:s.selectIds,selectRect:x,willSyncService:!0,isSync:y,points:s.getChildrenPoints(),textOpt:s.textOpt,selectorColor:s.selectorColor,strokeColor:s.strokeColor,fillColor:s.fillColor,canTextEdit:s.canTextEdit,canRotate:s.canRotate,scaleType:s.scaleType,opt:s.getWorkOptions()||void 0,canLock:s.canLock,isLocked:s.isLocked,toolsTypes:s.toolsTypes,shapeOpt:s.shapeOpt,thickness:s.thickness,useStroke:s.useStroke,strokeType:s.strokeType});var _I31={useAnimation:h.useAnimation||!1};if(h.uid&&(_I31.uid=h.uid),f||T===te.Done){var _iterator7=_createForOfIteratorHelper(l.entries()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _step7$value=_slicedToArray(_step7.value,2),_d28=_step7$value[0],v=_step7$value[1];C.push(_objectSpread(_objectSpread({},v),{},{workId:_d28,type:xt.UpdateNode,updateNodeOpt:_I31,isSync:y}));}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}}return{render:E,sp:C};}}]);}(kr);var l1=/*#__PURE__*/function(_kr8){function l1(){var _this55;_classCallCheck(this,l1);_this55=_callSuper(this,l1,arguments);dt(_this55,"emitEventType",he.SetFontStyle);return _this55;}_inherits(l1,_kr8);return _createClass(l1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(t){var h,r,n,s,c,l,f;return _regeneratorRuntime().wrap(function _callee17$(_context18){while(1)switch(_context18.prev=_context18.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.textUpdateForWoker;_context18.t0=r===Me&&n;if(!_context18.t0){_context18.next=5;break;}_context18.next=5;return(h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,callback:this.updateSelectorCallback});case 5:case"end":return _context18.stop();}},_callee17,this);}));function consumeForLocalWorker(_x30){return _consumeForLocalWorker7.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=t.workShapeNode,l=t.res,f=r.willSyncService,h=r.isSync,m=r.updateSelectorOpt,u=r.textUpdateForWoker,y=n.render||[],T=n.sp||[],E=l==null?void 0:l.selectRect;if(f&&T){m.fontSize&&T.push({type:xt.Select,selectIds:c.selectIds,selectRect:E,willSyncService:f,isSync:h,points:c.getChildrenPoints()});var _iterator8=_createForOfIteratorHelper(s.entries()),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _step8$value=_slicedToArray(_step8.value,2),C=_step8$value[0],x=_step8$value[1];u&&x.toolsType===Tt.Text?T.push(_objectSpread(_objectSpread({},x),{},{workId:C,type:xt.TextUpdate,dataType:Vt.Local,willSyncService:!0})):T.push(_objectSpread(_objectSpread({},x),{},{workId:C,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h}));}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}return{render:y,sp:T};}}]);}(kr);var f1=/*#__PURE__*/function(_kr9){function f1(){var _this56;_classCallCheck(this,f1);_this56=_callSuper(this,f1,arguments);dt(_this56,"emitEventType",he.SetPoint);return _this56;}_inherits(f1,_kr9);return _createClass(f1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(t){var h,r,n,s,c,l,f;return _regeneratorRuntime().wrap(function _callee18$(_context19){while(1)switch(_context19.prev=_context19.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.textUpdateForWoker;_context19.t0=r===Me&&n;if(!_context19.t0){_context19.next=5;break;}_context19.next=5;return(h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,emitEventType:this.emitEventType,willSerializeData:l,isSync:!0,textUpdateForWoker:f,callback:this.updateSelectorCallback});case 5:case"end":return _context19.stop();}},_callee18,this);}));function consumeForLocalWorker(_x31){return _consumeForLocalWorker8.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=t.workShapeNode,l=t.res,f=r.willSyncService,h=r.isSync,m=n.render||[],u=n.sp||[],y=l==null?void 0:l.selectRect;if(f&&u){var _iterator9=_createForOfIteratorHelper(s.entries()),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _step9$value=_slicedToArray(_step9.value,2),T=_step9$value[0],E=_step9$value[1];u.push(_objectSpread(_objectSpread({},E),{},{workId:T,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h}));}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}u.push({type:xt.Select,selectIds:c.selectIds,selectRect:y,willSyncService:f,isSync:h,points:c.getChildrenPoints()});}return{render:m,sp:u};}}]);}(kr);var c1=/*#__PURE__*/function(_kr10){function c1(){var _this57;_classCallCheck(this,c1);_this57=_callSuper(this,c1,arguments);dt(_this57,"emitEventType",he.SetLock);return _this57;}_inherits(c1,_kr10);return _createClass(c1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(t){var f,r,n,s,c,l;return _regeneratorRuntime().wrap(function _callee19$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData;_context20.t0=r===Me&&n;if(!_context20.t0){_context20.next=5;break;}_context20.next=5;return(f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback});case 5:case"end":return _context20.stop();}},_callee19,this);}));function consumeForLocalWorker(_x32){return _consumeForLocalWorker9.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=t.workShapeNode,l=t.res,f=r.willSyncService,h=r.isSync,m=r.updateSelectorOpt,u=n.render||[],y=n.sp||[],T=l==null?void 0:l.selectRect;if(f&&y){var _iterator10=_createForOfIteratorHelper(s.entries()),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _step10$value=_slicedToArray(_step10.value,2),E=_step10$value[0],C=_step10$value[1];y.push(_objectSpread(_objectSpread({},C),{},{workId:E,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h}));}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}y.push({isLocked:m.isLocked,selectorColor:c.selectorColor,scaleType:c.scaleType,canRotate:c.canRotate,type:xt.Select,selectIds:c.selectIds,selectRect:T,willSyncService:f,isSync:h});}return{render:u,sp:y};}}]);}(kr);var u1=/*#__PURE__*/function(_kr11){function u1(){var _this58;_classCallCheck(this,u1);_this58=_callSuper(this,u1,arguments);dt(_this58,"emitEventType",he.SetShapeOpt);return _this58;}_inherits(u1,_kr11);return _createClass(u1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker10=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(t){var f,r,n,s,c,l;return _regeneratorRuntime().wrap(function _callee20$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData;_context21.t0=r===Me&&n;if(!_context21.t0){_context21.next=5;break;}_context21.next=5;return(f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback});case 5:case"end":return _context21.stop();}},_callee20,this);}));function consumeForLocalWorker(_x33){return _consumeForLocalWorker10.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=r.willSyncService,l=r.isSync,f=n.render||[],h=n.sp||[];if(c&&h){var _iterator11=_createForOfIteratorHelper(s.entries()),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var _step11$value=_slicedToArray(_step11.value,2),m=_step11$value[0],u=_step11$value[1];h.push(_objectSpread(_objectSpread({},u),{},{workId:m,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}return{render:f,sp:h};}}]);}(kr);var Xu=/*#__PURE__*/function(){function Xu(e){var _this59=this;_classCallCheck(this,Xu);dt(this,"builders",/* @__PURE__ */new Map());this.builders=new Map(e.map(function(t){return[t,_this59.build(t)];}));}return _createClass(Xu,[{key:"build",value:function build(e){switch(e){case he.TranslateNode:return new i1();case he.ZIndexNode:return new n1();case he.CopyNode:return new t1();case he.SetColorNode:return new r1();case he.DeleteNode:return new s1();case he.ScaleNode:return new o1();case he.RotateNode:return new a1();case he.SetFontStyle:return new l1();case he.SetPoint:return new f1();case he.SetLock:return new c1();case he.SetShapeOpt:return new u1();}}},{key:"registerForWorker",value:function registerForWorker(e){return this.builders.forEach(function(t){t&&t.registerForWorker(e);}),this;}},{key:"consumeForWorker",value:function consumeForWorker(e){var _iterator12=_createForOfIteratorHelper(this.builders.values()),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var t=_step12.value;if(t!=null&&t.consume(e))return!0;}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}return!1;}}]);}();var h1={linear:function linear(i){return i;},easeInQuad:function easeInQuad(i){return i*i;},easeOutQuad:function easeOutQuad(i){return i*(2-i);},easeInOutQuad:function easeInOutQuad(i){return i<0.5?2*i*i:-1+(4-2*i)*i;},easeInCubic:function easeInCubic(i){return i*i*i;},easeOutCubic:function easeOutCubic(i){return--i*i*i+1;},easeInOutCubic:function easeInOutCubic(i){return i<0.5?4*i*i*i:(i-1)*(2*i-2)*(2*i-2)+1;},easeInQuart:function easeInQuart(i){return i*i*i*i;},easeOutQuart:function easeOutQuart(i){return 1- --i*i*i*i;},easeInOutQuart:function easeInOutQuart(i){return i<0.5?8*i*i*i*i:1-8*--i*i*i*i;},easeInQuint:function easeInQuint(i){return i*i*i*i*i;},easeOutQuint:function easeOutQuint(i){return 1+--i*i*i*i*i;},easeInOutQuint:function easeInOutQuint(i){return i<0.5?16*i*i*i*i*i:1+16*--i*i*i*i*i;},easeInSine:function easeInSine(i){return 1-Math.cos(i*Math.PI/2);},easeOutSine:function easeOutSine(i){return Math.sin(i*Math.PI/2);},easeInOutSine:function easeInOutSine(i){return-(Math.cos(Math.PI*i)-1)/2;},easeInExpo:function easeInExpo(i){return i<=0?0:Math.pow(2,10*i-10);},easeOutExpo:function easeOutExpo(i){return i>=1?1:1-Math.pow(2,-10*i);},easeInOutExpo:function easeInOutExpo(i){return i<=0?0:i>=1?1:i<0.5?Math.pow(2,20*i-10)/2:(2-Math.pow(2,-20*i+10))/2;}};var pt=/*#__PURE__*/function(){function pt(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;_classCallCheck(this,pt);this.x=e,this.y=t,this.z=r;}return _createClass(pt,[{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setz",value:function setz(e){return this.z=e,this;}},{key:"setXY",value:function setXY(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;return this.x=e,this.y=t,this;}},{key:"set",value:function set(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;return this.x=e,this.y=t,this.z=r,this;}},{key:"setTo",value:function setTo(_ref163){var _ref163$x=_ref163.x,e=_ref163$x===void 0?0:_ref163$x,_ref163$y=_ref163.y,t=_ref163$y===void 0?0:_ref163$y,_ref163$z=_ref163.z,r=_ref163$z===void 0?1:_ref163$z;return this.x=e,this.y=t,this.z=r,this;}},{key:"rot",value:function rot(e){if(e===0)return this;var t=this.x,r=this.y,n=Math.sin(e),s=Math.cos(e);return this.x=t*s-r*n,this.y=t*n+r*s,this;}},{key:"rotWith",value:function rotWith(e,t){if(t===0)return this;var r=this.x-e.x,n=this.y-e.y,s=Math.sin(t),c=Math.cos(t);return this.x=e.x+(r*c-n*s),this.y=e.y+(r*s+n*c),this;}},{key:"clone",value:function clone(){var e=this.x,t=this.y,r=this.z;return new pt(e,t,r);}},{key:"sub",value:function sub(e){return this.x-=e.x,this.y-=e.y,this;}},{key:"subXY",value:function subXY(e,t){return this.x-=e,this.y-=t,this;}},{key:"subScalar",value:function subScalar(e){return this.x-=e,this.y-=e,this;}},{key:"add",value:function add(e){return this.x+=e.x,this.y+=e.y,this;}},{key:"addXY",value:function addXY(e,t){return this.x+=e,this.y+=t,this;}},{key:"addScalar",value:function addScalar(e){return this.x+=e,this.y+=e,this;}},{key:"clamp",value:function clamp(e,t){return this.x=Math.max(this.x,e),this.y=Math.max(this.y,e),t!==void 0&&(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)),this;}},{key:"div",value:function div(e){return this.x/=e,this.y/=e,this;}},{key:"divV",value:function divV(e){return this.x/=e.x,this.y/=e.y,this;}},{key:"mul",value:function mul(e){return this.x*=e,this.y*=e,this;}},{key:"mulV",value:function mulV(e){return this.x*=e.x,this.y*=e.y,this;}},{key:"abs",value:function abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this;}},{key:"nudge",value:function nudge(e,t){var r=pt.Tan(e,this);return this.add(r.mul(t));}},{key:"neg",value:function neg(){return this.x*=-1,this.y*=-1,this;}},{key:"cross",value:function cross(e){return this.x=this.y*e.z-this.z*e.y,this.y=this.z*e.x-this.x*e.z,this;}},{key:"dpr",value:function dpr(e){return pt.Dpr(this,e);}},{key:"cpr",value:function cpr(e){return pt.Cpr(this,e);}},{key:"len2",value:function len2(){return pt.Len2(this);}},{key:"len",value:function len(){return pt.Len(this);}},{key:"pry",value:function pry(e){return pt.Pry(this,e);}},{key:"per",value:function per(){var e=this.x,t=this.y;return this.x=t,this.y=-e,this;}},{key:"uni",value:function uni(){return pt.Uni(this);}},{key:"tan",value:function tan(e){return pt.Tan(this,e);}},{key:"dist",value:function dist(e){return pt.Dist(this,e);}},{key:"distanceToLineSegment",value:function distanceToLineSegment(e,t){return pt.DistanceToLineSegment(e,t,this);}},{key:"slope",value:function slope(e){return pt.Slope(this,e);}},{key:"snapToGrid",value:function snapToGrid(e){return this.x=Math.round(this.x/e)*e,this.y=Math.round(this.y/e)*e,this;}},{key:"angle",value:function angle(e){return pt.Angle(this,e);}},{key:"toAngle",value:function toAngle(){return pt.ToAngle(this);}},{key:"lrp",value:function lrp(e,t){return this.x=this.x+(e.x-this.x)*t,this.y=this.y+(e.y-this.y)*t,this;}},{key:"equals",value:function equals(e,t){return pt.Equals(this,e,t);}},{key:"equalsXY",value:function equalsXY(e,t){return pt.EqualsXY(this,e,t);}},{key:"norm",value:function norm(){var e=this.len();return this.x=e===0?0:this.x/e,this.y=e===0?0:this.y/e,this;}},{key:"toFixed",value:function toFixed(){return pt.ToFixed(this);}},{key:"toString",value:function toString(){return pt.ToString(pt.ToFixed(this));}},{key:"toJson",value:function toJson(){return pt.ToJson(this);}},{key:"toArray",value:function toArray(){return pt.ToArray(this);}}],[{key:"Add",value:function Add(e,t){return new pt(e.x+t.x,e.y+t.y);}},{key:"AddXY",value:function AddXY(e,t,r){return new pt(e.x+t,e.y+r);}},{key:"Sub",value:function Sub(e,t){return new pt(e.x-t.x,e.y-t.y);}},{key:"SubXY",value:function SubXY(e,t,r){return new pt(e.x-t,e.y-r);}},{key:"AddScalar",value:function AddScalar(e,t){return new pt(e.x+t,e.y+t);}},{key:"SubScalar",value:function SubScalar(e,t){return new pt(e.x-t,e.y-t);}},{key:"Div",value:function Div(e,t){return new pt(e.x/t,e.y/t);}},{key:"Mul",value:function Mul(e,t){return new pt(e.x*t,e.y*t);}},{key:"DivV",value:function DivV(e,t){return new pt(e.x/t.x,e.y/t.y);}},{key:"MulV",value:function MulV(e,t){return new pt(e.x*t.x,e.y*t.y);}},{key:"Neg",value:function Neg(e){return new pt(-e.x,-e.y);}},{key:"Per",value:function Per(e){return new pt(e.y,-e.x);}},{key:"Dist2",value:function Dist2(e,t){return pt.Sub(e,t).len2();}},{key:"Abs",value:function Abs(e){return new pt(Math.abs(e.x),Math.abs(e.y));}},{key:"Dist",value:function Dist(e,t){return Math.hypot(e.y-t.y,e.x-t.x);}},{key:"Dpr",value:function Dpr(e,t){return e.x*t.x+e.y*t.y;}},{key:"Cross",value:function Cross(e,t){return new pt(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z// A.z = A.x * V.y - A.y * V.x
|
|
365
|
+
},{key:"render",value:function render(){var D=this.orderedChildren;var U=null;var M=[];for(var W=0;W<D.length;W++){var Y=D[W],B=M.length>0;if(Y instanceof l["default"]&&!Y.offscreen){if(!Y.autoRender)B&&(console.warn("Some offscreen canvas will not be rendered."),M.length=0);else if(U=Y,B){Y.renderer.clear();for(var N=0;N<M.length;N++){var G=M[N];G.render(),I(Y,G);}M.length=0,Y.render({clear:!1});}else Y.prepareRender&&Y.render();}else Y.offscreen?U?(Y.prepareRender&&Y.render(),I(U,Y)):M.push(Y):Y instanceof f["default"]&&B&&(console.warn("Some offscreen canvas will not be rendered."),M.length=0);}}/* override */},{key:"replaceChild",value:function replaceChild(D,U){var M=_superPropGet(A,"replaceChild",this,3)([D,U]);U.canvas.remove&&U.canvas.remove(),U.offscreen&&this[S]--;var W=D.canvas;if(!D.offscreen){var Y=x(this,D);this.container.insertBefore(W,Y);}return p(this.options,W),D.setResolution(this.getResolution()),M;}},{key:"resize",value:function resize(){var D=this.options;this.children.forEach(function(U){p(D,U.canvas);}),this.setResolution(D),this.dispatchEvent({type:"resize"});}/* override */},{key:"setResolution",value:function setResolution(){var _D4,_U10;var _ref160=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},D=_ref160.width,U=_ref160.height;var M=this.container,W=M.clientWidth,Y=M.clientHeight;(D==null||U==null)&&(D=(_D4=D)!==null&&_D4!==void 0?_D4:W,U=(_U10=U)!==null&&_U10!==void 0?_U10:Y);var _this$options=this.options,B=_this$options.mode,N=_this$options.displayRatio;if(D*=N,U*=N,this.options.left=0,this.options.top=0,B==="stickyHeight"||B==="stickyLeft"||B==="stickyRight"){var G=D;D=W*U/Y,B==="stickyHeight"&&(this.options.left=0.5*(D-G)),B==="stickyRight"&&(this.options.left=D-G);}else if(B==="stickyWidth"||B==="stickyTop"||B==="stickyBottom"){var _G4=U;U=Y*D/W,B==="stickyWidth"&&(this.options.top=0.5*(U-_G4)),B==="stickyBottom"&&(this.options.top=U-_G4);}_superPropGet(A,"setResolution",this,3)([{width:D,height:U}]);}},{key:"snapshot",value:function snapshot(){var _ref161=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref161$offscreen=_ref161.offscreen,D=_ref161$offscreen===void 0?!1:_ref161$offscreen,U=_ref161.layers;var M=D?"snapshotOffScreenCanvas":"snapshotCanvas",_this$getResolution9=this.getResolution(),W=_this$getResolution9.width,Y=_this$getResolution9.height;this[M]=this[M]||n.ENV.createCanvas(W,Y,{offscreen:D});var B=this[M].getContext("2d");U=U||this.orderedChildren,this[M].width=W,this[M].height=Y;for(var N=0;N<U.length;N++){var G=U[N];if(!G.options.ignoreSnapshot){G.render&&G.render();var J=G.canvas;J&&J!==G&&B.drawImage(J,0,0,W,Y);}}return this[M];}}]);}(h["default"]);(typeof document==="undefined"?"undefined":_typeof(document))<"u"&&(A.prototype.layer3d=function(R){var _this47=this;var D=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var U=D.url||"https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.min.js";return new Promise(function(M,W){var Y=document.createElement("script");Y.async=!1,Y.src=U,Y.onload=function(){try{M(_this47.layer3d(R,D));}catch(B){W(B);}},document.documentElement.appendChild(Y);});}),T["default"].registerNode(A,"scene");}.call(this,t(22));},/* 291 *//***/function(i,e,t){t.r(e),t.d(e,"default",function(){return n;});var r=t(214);t(1).glMatrix.setMatrixArrayType(Array);function n(s){var _ref162=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref162$offsetTop=_ref162.offsetTop,c=_ref162$offsetTop===void 0?0:_ref162$offsetTop,_ref162$offsetLeft=_ref162.offsetLeft,l=_ref162$offsetLeft===void 0?0:_ref162$offsetLeft,_ref162$displayRatio=_ref162.displayRatio,f=_ref162$displayRatio===void 0?1:_ref162$displayRatio;var h,m;var u=[],_s$target$getBounding=s.target.getBoundingClientRect(),y=_s$target$getBounding.left,T=_s$target$getBounding.top,E=_s$target$getBounding.width,C=_s$target$getBounding.height,x=s.target.width,I=s.target.height,d=s.changedTouches||[s];for(var p=0;p<d.length;p++){var S=d[p],A=S.identifier,R=S.clientX,D=S.clientY;R!=null&&D!=null&&u.push({x:Math.round((R|0)-y),y:Math.round((D|0)-T),identifier:A});}u.length<=0&&u.push({x:h,y:m});var v=[];return u.forEach(function(p){p.x!=null&&p.y!=null&&(h=(p.x*x/E-l)/f,m=(p.y*I/C-c)/f);var S=new r["default"](s);Object.defineProperties(S,{layerX:{value:h,configurable:!0},layerY:{value:m,configurable:!0},originalX:{value:p.x},originalY:{value:p.y},x:{value:h,configurable:!0},y:{value:m,configurable:!0},identifier:{value:p.identifier}}),v.push(S);}),v;}}/******/]);be.version;be.Arc;be.Block;be.Cloud;be.Color;var qy=be.Ellipse;be.Gradient;var mr=be.Group,_y=be.Label,el=be.Layer;be.LayerWorker;be.Node;be.Parallel;var Mn=be.Path,dn=be.Polyline,zc=be.Rect;be.Regular;be.Ring;var Uu=be.Scene,Yu=be.Sprite;be.SpriteSvg;be.Star;be.Triangle;be.helpers;be.createElement;be.isSpriteNode;be.registerNode;be.requestAnimationFrame;be.cancelAnimationFrame;be.ENV;var we=/* @__PURE__ */function(i){return i.Normal="Normal",i.Stroke="Stroke",i.Dotted="Dotted",i.LongDotted="LongDotted",i;}(we||{}),he=/* @__PURE__ */function(i){return i.None="None",i.ShowFloatBar="ShowFloatBar",i.ZIndexFloatBar="ZIndexFloatBar",i.DeleteNode="DeleteNode",i.CopyNode="CopyNode",i.ZIndexActive="ZIndexActive",i.ZIndexNode="ZIndexNode",i.RotateNode="RotateNode",i.SetColorNode="SetColorNode",i.TranslateNode="TranslateNode",i.ScaleNode="ScaleNode",i.OriginalEvent="OriginalEvent",i.CreateScene="CreateScene",i.ActiveCursor="ActiveCursor",i.MoveCursor="MoveCursor",i.CommandEditor="CommandEditor",i.SetEditorData="SetEditorData",i.SetFontStyle="SetFontStyle",i.SetPoint="SetPoint",i.SetLock="SetLock",i.SetShapeOpt="SetShapeOpt",i.CameraChange="CameraChange",i.ActiveMethod="ActiveMethod",i.HidFloatBarBtn="HidFloatBarBtn",i;}(he||{}),Tt=/* @__PURE__ */function(i){return i[i.Pencil=1]="Pencil",i[i.Eraser=2]="Eraser",i[i.PencilEraser=3]="PencilEraser",i[i.BitMapEraser=4]="BitMapEraser",i[i.Selector=5]="Selector",i[i.Clicker=6]="Clicker",i[i.Arrow=7]="Arrow",i[i.Hand=8]="Hand",i[i.LaserPen=9]="LaserPen",i[i.Text=10]="Text",i[i.Straight=11]="Straight",i[i.Rectangle=12]="Rectangle",i[i.Ellipse=13]="Ellipse",i[i.Star=14]="Star",i[i.Triangle=15]="Triangle",i[i.Rhombus=16]="Rhombus",i[i.Polygon=17]="Polygon",i[i.SpeechBalloon=18]="SpeechBalloon",i[i.Image=19]="Image",i;}(Tt||{}),Vt=/* @__PURE__ */function(i){return i[i.Local=1]="Local",i[i.Service=2]="Service",i[i.Worker=3]="Worker",i;}(Vt||{}),te=/* @__PURE__ */function(i){return i[i.Pending=0]="Pending",i[i.Start=1]="Start",i[i.Doing=2]="Doing",i[i.Done=3]="Done",i[i.Unwritable=4]="Unwritable",i;}(te||{}),xt=/* @__PURE__ */function(i){return i[i.None=0]="None",i[i.Init=1]="Init",i[i.UpdateCamera=2]="UpdateCamera",i[i.UpdateTools=3]="UpdateTools",i[i.CreateWork=4]="CreateWork",i[i.DrawWork=5]="DrawWork",i[i.FullWork=6]="FullWork",i[i.UpdateNode=7]="UpdateNode",i[i.RemoveNode=8]="RemoveNode",i[i.Clear=9]="Clear",i[i.Select=10]="Select",i[i.Destroy=11]="Destroy",i[i.Snapshot=12]="Snapshot",i[i.BoundingBox=13]="BoundingBox",i[i.Cursor=14]="Cursor",i[i.TextUpdate=15]="TextUpdate",i[i.GetTextActive=16]="GetTextActive",i[i.TasksQueue=17]="TasksQueue",i[i.CursorHover=18]="CursorHover",i[i.CursorBlur=19]="CursorBlur",i[i.Console=20]="Console",i[i.GetImageBitMap=23]="GetImageBitMap",i[i.AuthWriter=24]="AuthWriter",i[i.AuthReader=25]="AuthReader",i[i.AuthClear=26]="AuthClear",i[i.AuthPage=27]="AuthPage",i[i.GetVNodeInfo=28]="GetVNodeInfo",i[i.UpdateDpr=29]="UpdateDpr",i[i.SetFontFace=30]="SetFontFace",i;}(xt||{}),Ut=/* @__PURE__ */function(i){return i[i.None=0]="None",i[i.Bg=1]="Bg",i[i.ServiceFloat=2]="ServiceFloat",i[i.Float=3]="Float",i[i.TopFloat=4]="TopFloat",i;}(Ut||{}),Ae=/* @__PURE__ */function(i){return i[i.none=1]="none",i[i.all=2]="all",i[i.both=3]="both",i[i.proportional=4]="proportional",i;}(Ae||{}),Tr=/* @__PURE__ */function(i){return i[i.inside=0]="inside",i[i.outside=1]="outside",i[i.intersect=2]="intersect",i;}(Tr||{}),cl=/* @__PURE__ */function(i){return i.Image="image",i.Iconify="iconify",i;}(cl||{});var kr=/*#__PURE__*/function(){function kr(){_classCallCheck(this,kr);dt(this,"localWork");dt(this,"serviceWork");dt(this,"threadEngine");}return _createClass(kr,[{key:"registerForWorker",value:function registerForWorker(e){return this.threadEngine=e,this.localWork=e.localWork,this.serviceWork=e.serviceWork,this;}}]);}();var t1=/*#__PURE__*/function(_kr){function t1(){var _this48;_classCallCheck(this,t1);_this48=_callSuper(this,t1,arguments);dt(_this48,"emitEventType",he.CopyNode);return _this48;}_inherits(t1,_kr);return _createClass(t1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.FullWork&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(t){var n,r;return _regeneratorRuntime().wrap(function _callee11$(_context12){while(1)switch(_context12.prev=_context12.next){case 0:r=t.workId;_context12.t0=r;if(!_context12.t0){_context12.next=5;break;}_context12.next=5;return(n=this.localWork)==null?void 0:n.consumeFull(t);case 5:case"end":return _context12.stop();}},_callee11,this);}));function consumeForLocalWorker(_x24){return _consumeForLocalWorker.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(kr);var yi="++",Me="selector",e1="all";var r1=/*#__PURE__*/function(_kr2){function r1(){var _this49;_classCallCheck(this,r1);_this49=_callSuper(this,r1,arguments);dt(_this49,"emitEventType",he.SetColorNode);return _this49;}_inherits(r1,_kr2);return _createClass(r1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(t){var h,r,n,s,c,l,f;return _regeneratorRuntime().wrap(function _callee12$(_context13){while(1)switch(_context13.prev=_context13.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.textUpdateForWoker;_context13.t0=r===Me&&n;if(!_context13.t0){_context13.next=5;break;}_context13.next=5;return(h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,callback:this.updateSelectorCallback});case 5:case"end":return _context13.stop();}},_callee12,this);}));function consumeForLocalWorker(_x25){return _consumeForLocalWorker2.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=r.willSyncService,l=r.isSync,f=r.textUpdateForWoker,h=n.render||[],m=n.sp||[];if(c){var _iterator3=_createForOfIteratorHelper(s.entries()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),u=_step3$value[0],y=_step3$value[1];f&&y.toolsType===Tt.Text?m.push(_objectSpread(_objectSpread({},y),{},{workId:u,type:xt.TextUpdate,dataType:Vt.Local,willSyncService:!0})):m.push(_objectSpread(_objectSpread({},y),{},{workId:u,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}return{render:h,sp:m};}}]);}(kr);var n1=/*#__PURE__*/function(_kr3){function n1(){var _this50;_classCallCheck(this,n1);_this50=_callSuper(this,n1,arguments);dt(_this50,"emitEventType",he.ZIndexNode);return _this50;}_inherits(n1,_kr3);return _createClass(n1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(t){var f,r,n,s,c,l;return _regeneratorRuntime().wrap(function _callee13$(_context14){while(1)switch(_context14.prev=_context14.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData;_context14.t0=r===Me&&n;if(!_context14.t0){_context14.next=5;break;}_context14.next=5;return(f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback});case 5:case"end":return _context14.stop();}},_callee13,this);}));function consumeForLocalWorker(_x26){return _consumeForLocalWorker3.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=r.willSyncService,l=r.isSync,f=n.render||[],h=n.sp||[];if(c&&h){var _iterator4=_createForOfIteratorHelper(s.entries()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _step4$value=_slicedToArray(_step4.value,2),m=_step4$value[0],u=_step4$value[1];h.push(_objectSpread(_objectSpread({},u),{},{workId:m,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}return{render:f,sp:h};}}]);}(kr);var i1=/*#__PURE__*/function(_kr4){function i1(){var _this51;_classCallCheck(this,i1);_this51=_callSuper(this,i1,arguments);dt(_this51,"emitEventType",he.TranslateNode);return _this51;}_inherits(i1,_kr4);return _createClass(i1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(t){var u,y,r,n,s,c,l,f,h,m;return _regeneratorRuntime().wrap(function _callee14$(_context15){while(1)switch(_context15.prev=_context15.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.textUpdateForWoker,h=t.emitEventType,m=t.smoothSync;_context15.t0=r===Me&&n;if(!_context15.t0){_context15.next=9;break;}if(!(n.workState===te.Done&&n!=null&&n.translate&&(n.translate[0]||n.translate[1])||n.workState!==te.Done)){_context15.next=8;break;}_context15.next=6;return(u=this.localWork)==null?void 0:u.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,isSync:!0,textUpdateForWoker:f,emitEventType:h,callback:this.updateSelectorCallback,smoothSync:m});case 6:_context15.next=9;break;case 8:n.workState===te.Done&&((y=this.localWork)==null||y.vNodes.deleteLastTarget());case 9:case"end":return _context15.stop();}},_callee14,this);}));function consumeForLocalWorker(_x27){return _consumeForLocalWorker4.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=t.workShapeNode,l=t.res,f=t.smoothSync,h=r.willSyncService,m=r.isSync,u=r.updateSelectorOpt,y=r.textUpdateForWoker,T=u.workState,E=n.render||[],C=n.sp||[];if(T===te.Start)return{sp:[],render:[]};var x=l==null?void 0:l.selectRect;if(h){C.push({type:xt.Select,selectIds:c.selectIds,selectRect:x,willSyncService:T===te.Done?!0:f,isSync:!0,points:T===te.Done&&c.getChildrenPoints()||void 0,textOpt:c.textOpt});var _I29={useAnimation:u.useAnimation||!1};u.uid&&(_I29.uid=u.uid);var _iterator5=_createForOfIteratorHelper(s.entries()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_slicedToArray(_step5.value,2),_d27=_step5$value[0],v=_step5$value[1];y&&v.toolsType===Tt.Text?C.push(_objectSpread(_objectSpread({},v),{},{workId:_d27,type:xt.TextUpdate,dataType:Vt.Local,willSyncService:T===te.Done?!0:f,updateNodeOpt:_I29})):(f||T===te.Done)&&C.push(_objectSpread(_objectSpread({},v),{},{workId:_d27,type:xt.UpdateNode,updateNodeOpt:_I29,isSync:m}));}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}return{render:E,sp:C};}}]);}(kr);var s1=/*#__PURE__*/function(_kr5){function s1(){var _this52;_classCallCheck(this,s1);_this52=_callSuper(this,s1,arguments);dt(_this52,"emitEventType",he.DeleteNode);return _this52;}_inherits(s1,_kr5);return _createClass(s1,[{key:"consume",value:function consume(){return!1;}}]);}(kr);var o1=/*#__PURE__*/function(_kr6){function o1(){var _this53;_classCallCheck(this,o1);_this53=_callSuper(this,o1,arguments);dt(_this53,"emitEventType",he.ScaleNode);return _this53;}_inherits(o1,_kr6);return _createClass(o1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(t){var f,r,n,s,c,l;return _regeneratorRuntime().wrap(function _callee15$(_context16){while(1)switch(_context16.prev=_context16.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willSyncService,c=t.willSerializeData,l=t.smoothSync;_context16.t0=r===Me&&n;if(!_context16.t0){_context16.next=5;break;}_context16.next=5;return(f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willSyncService:s,willSerializeData:c,isSync:!0,callback:this.updateSelectorCallback.bind(this),smoothSync:l});case 5:case"end":return _context16.stop();}},_callee15,this);}));function consumeForLocalWorker(_x28){return _consumeForLocalWorker5.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.workShapeNode,c=t.res,l=t.newServiceStore,f=t.smoothSync,h=r.updateSelectorOpt,m=r.willSyncService,u=h.workState,y=n.render||[],T=n.sp||[],E=c==null?void 0:c.selectRect;if(u===te.Start)return{sp:[],render:[]};if(m){T.push({type:xt.Select,selectIds:s.selectIds,selectRect:E,willSyncService:u===te.Done?!0:f,isSync:!0,points:u===te.Done&&s.getChildrenPoints()||void 0,textOpt:s.textOpt});var C={useAnimation:h.useAnimation||!1};h.uid&&(C.uid=h.uid);var _iterator6=_createForOfIteratorHelper(l.entries()),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _step6$value=_slicedToArray(_step6.value,2),x=_step6$value[0],_I30=_step6$value[1];_I30.toolsType===Tt.Text?T.push(_objectSpread(_objectSpread({},_I30),{},{workId:x,type:xt.TextUpdate,dataType:Vt.Local,willSyncService:u===te.Done?!0:f,updateNodeOpt:C})):(f||u===te.Done)&&T.push(_objectSpread(_objectSpread({},_I30),{},{workId:x,type:xt.UpdateNode,updateNodeOpt:C,isSync:!0}));}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}return{render:y,sp:T};}}]);}(kr);var a1=/*#__PURE__*/function(_kr7){function a1(){var _this54;_classCallCheck(this,a1);_this54=_callSuper(this,a1,arguments);dt(_this54,"emitEventType",he.RotateNode);return _this54;}_inherits(a1,_kr7);return _createClass(a1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(t){var m,r,n,s,c,l,f,h;return _regeneratorRuntime().wrap(function _callee16$(_context17){while(1)switch(_context17.prev=_context17.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.emitEventType,h=t.smoothSync;_context17.t0=r===Me&&n;if(!_context17.t0){_context17.next=5;break;}_context17.next=5;return(m=this.localWork)==null?void 0:m.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,emitEventType:f,isSync:!0,callback:this.updateSelectorCallback,smoothSync:h});case 5:case"end":return _context17.stop();}},_callee16,this);}));function consumeForLocalWorker(_x29){return _consumeForLocalWorker6.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.workShapeNode,c=t.res,l=t.newServiceStore,f=t.smoothSync,h=r.updateSelectorOpt,m=r.willSyncService,u=r.willSerializeData,y=r.isSync,T=h.workState,E=n.render||[],C=n.sp||[],x=c==null?void 0:c.selectRect;if(m){u&&T===te.Done&&C.push({type:xt.Select,selectIds:s.selectIds,selectRect:x,willSyncService:!0,isSync:y,points:s.getChildrenPoints(),textOpt:s.textOpt,selectorColor:s.selectorColor,strokeColor:s.strokeColor,fillColor:s.fillColor,canTextEdit:s.canTextEdit,canRotate:s.canRotate,scaleType:s.scaleType,opt:s.getWorkOptions()||void 0,canLock:s.canLock,isLocked:s.isLocked,toolsTypes:s.toolsTypes,shapeOpt:s.shapeOpt,thickness:s.thickness,useStroke:s.useStroke,strokeType:s.strokeType});var _I31={useAnimation:h.useAnimation||!1};if(h.uid&&(_I31.uid=h.uid),f||T===te.Done){var _iterator7=_createForOfIteratorHelper(l.entries()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _step7$value=_slicedToArray(_step7.value,2),_d28=_step7$value[0],v=_step7$value[1];C.push(_objectSpread(_objectSpread({},v),{},{workId:_d28,type:xt.UpdateNode,updateNodeOpt:_I31,isSync:y}));}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}}return{render:E,sp:C};}}]);}(kr);var l1=/*#__PURE__*/function(_kr8){function l1(){var _this55;_classCallCheck(this,l1);_this55=_callSuper(this,l1,arguments);dt(_this55,"emitEventType",he.SetFontStyle);return _this55;}_inherits(l1,_kr8);return _createClass(l1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(t){var h,r,n,s,c,l,f;return _regeneratorRuntime().wrap(function _callee17$(_context18){while(1)switch(_context18.prev=_context18.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.textUpdateForWoker;_context18.t0=r===Me&&n;if(!_context18.t0){_context18.next=5;break;}_context18.next=5;return(h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,textUpdateForWoker:f,callback:this.updateSelectorCallback});case 5:case"end":return _context18.stop();}},_callee17,this);}));function consumeForLocalWorker(_x30){return _consumeForLocalWorker7.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=t.workShapeNode,l=t.res,f=r.willSyncService,h=r.isSync,m=r.updateSelectorOpt,u=r.textUpdateForWoker,y=n.render||[],T=n.sp||[],E=l==null?void 0:l.selectRect;if(f&&T){m.fontSize&&T.push({type:xt.Select,selectIds:c.selectIds,selectRect:E,willSyncService:f,isSync:h,points:c.getChildrenPoints()});var _iterator8=_createForOfIteratorHelper(s.entries()),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _step8$value=_slicedToArray(_step8.value,2),C=_step8$value[0],x=_step8$value[1];u&&x.toolsType===Tt.Text?T.push(_objectSpread(_objectSpread({},x),{},{workId:C,type:xt.TextUpdate,dataType:Vt.Local,willSyncService:!0})):T.push(_objectSpread(_objectSpread({},x),{},{workId:C,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h}));}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}return{render:y,sp:T};}}]);}(kr);var f1=/*#__PURE__*/function(_kr9){function f1(){var _this56;_classCallCheck(this,f1);_this56=_callSuper(this,f1,arguments);dt(_this56,"emitEventType",he.SetPoint);return _this56;}_inherits(f1,_kr9);return _createClass(f1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(t){var h,r,n,s,c,l,f;return _regeneratorRuntime().wrap(function _callee18$(_context19){while(1)switch(_context19.prev=_context19.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData,f=t.textUpdateForWoker;_context19.t0=r===Me&&n;if(!_context19.t0){_context19.next=5;break;}_context19.next=5;return(h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,emitEventType:this.emitEventType,willSerializeData:l,isSync:!0,textUpdateForWoker:f,callback:this.updateSelectorCallback});case 5:case"end":return _context19.stop();}},_callee18,this);}));function consumeForLocalWorker(_x31){return _consumeForLocalWorker8.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=t.workShapeNode,l=t.res,f=r.willSyncService,h=r.isSync,m=n.render||[],u=n.sp||[],y=l==null?void 0:l.selectRect;if(f&&u){var _iterator9=_createForOfIteratorHelper(s.entries()),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _step9$value=_slicedToArray(_step9.value,2),T=_step9$value[0],E=_step9$value[1];u.push(_objectSpread(_objectSpread({},E),{},{workId:T,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h}));}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}u.push({type:xt.Select,selectIds:c.selectIds,selectRect:y,willSyncService:f,isSync:h,points:c.getChildrenPoints()});}return{render:m,sp:u};}}]);}(kr);var c1=/*#__PURE__*/function(_kr10){function c1(){var _this57;_classCallCheck(this,c1);_this57=_callSuper(this,c1,arguments);dt(_this57,"emitEventType",he.SetLock);return _this57;}_inherits(c1,_kr10);return _createClass(c1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(t){var f,r,n,s,c,l;return _regeneratorRuntime().wrap(function _callee19$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData;_context20.t0=r===Me&&n;if(!_context20.t0){_context20.next=5;break;}_context20.next=5;return(f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback});case 5:case"end":return _context20.stop();}},_callee19,this);}));function consumeForLocalWorker(_x32){return _consumeForLocalWorker9.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=t.workShapeNode,l=t.res,f=r.willSyncService,h=r.isSync,m=r.updateSelectorOpt,u=n.render||[],y=n.sp||[],T=l==null?void 0:l.selectRect;if(f&&y){var _iterator10=_createForOfIteratorHelper(s.entries()),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _step10$value=_slicedToArray(_step10.value,2),E=_step10$value[0],C=_step10$value[1];y.push(_objectSpread(_objectSpread({},C),{},{workId:E,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h}));}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}y.push({isLocked:m.isLocked,selectorColor:c.selectorColor,scaleType:c.scaleType,canRotate:c.canRotate,type:xt.Select,selectIds:c.selectIds,selectRect:T,willSyncService:f,isSync:h});}return{render:u,sp:y};}}]);}(kr);var u1=/*#__PURE__*/function(_kr11){function u1(){var _this58;_classCallCheck(this,u1);_this58=_callSuper(this,u1,arguments);dt(_this58,"emitEventType",he.SetShapeOpt);return _this58;}_inherits(u1,_kr11);return _createClass(u1,[{key:"consume",value:function consume(t){var r=t.msgType,n=t.dataType,s=t.emitEventType;if(r===xt.UpdateNode&&n===Vt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker10=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(t){var f,r,n,s,c,l;return _regeneratorRuntime().wrap(function _callee20$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:r=t.workId,n=t.updateNodeOpt,s=t.willRefreshSelector,c=t.willSyncService,l=t.willSerializeData;_context21.t0=r===Me&&n;if(!_context21.t0){_context21.next=5;break;}_context21.next=5;return(f=this.localWork)==null?void 0:f.updateSelector({updateSelectorOpt:n,willRefreshSelector:s,willSyncService:c,willSerializeData:l,callback:this.updateSelectorCallback});case 5:case"end":return _context21.stop();}},_callee20,this);}));function consumeForLocalWorker(_x33){return _consumeForLocalWorker10.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var r=t.param,n=t.postData,s=t.newServiceStore,c=r.willSyncService,l=r.isSync,f=n.render||[],h=n.sp||[];if(c&&h){var _iterator11=_createForOfIteratorHelper(s.entries()),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var _step11$value=_slicedToArray(_step11.value,2),m=_step11$value[0],u=_step11$value[1];h.push(_objectSpread(_objectSpread({},u),{},{workId:m,type:xt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}return{render:f,sp:h};}}]);}(kr);var Xu=/*#__PURE__*/function(){function Xu(e){var _this59=this;_classCallCheck(this,Xu);dt(this,"builders",/* @__PURE__ */new Map());this.builders=new Map(e.map(function(t){return[t,_this59.build(t)];}));}return _createClass(Xu,[{key:"build",value:function build(e){switch(e){case he.TranslateNode:return new i1();case he.ZIndexNode:return new n1();case he.CopyNode:return new t1();case he.SetColorNode:return new r1();case he.DeleteNode:return new s1();case he.ScaleNode:return new o1();case he.RotateNode:return new a1();case he.SetFontStyle:return new l1();case he.SetPoint:return new f1();case he.SetLock:return new c1();case he.SetShapeOpt:return new u1();}}},{key:"registerForWorker",value:function registerForWorker(e){return this.builders.forEach(function(t){t&&t.registerForWorker(e);}),this;}},{key:"consumeForWorker",value:function consumeForWorker(e){var _iterator12=_createForOfIteratorHelper(this.builders.values()),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var t=_step12.value;if(t!=null&&t.consume(e))return!0;}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}return!1;}}]);}();var h1={linear:function linear(i){return i;},easeInQuad:function easeInQuad(i){return i*i;},easeOutQuad:function easeOutQuad(i){return i*(2-i);},easeInOutQuad:function easeInOutQuad(i){return i<0.5?2*i*i:-1+(4-2*i)*i;},easeInCubic:function easeInCubic(i){return i*i*i;},easeOutCubic:function easeOutCubic(i){return--i*i*i+1;},easeInOutCubic:function easeInOutCubic(i){return i<0.5?4*i*i*i:(i-1)*(2*i-2)*(2*i-2)+1;},easeInQuart:function easeInQuart(i){return i*i*i*i;},easeOutQuart:function easeOutQuart(i){return 1- --i*i*i*i;},easeInOutQuart:function easeInOutQuart(i){return i<0.5?8*i*i*i*i:1-8*--i*i*i*i;},easeInQuint:function easeInQuint(i){return i*i*i*i*i;},easeOutQuint:function easeOutQuint(i){return 1+--i*i*i*i*i;},easeInOutQuint:function easeInOutQuint(i){return i<0.5?16*i*i*i*i*i:1+16*--i*i*i*i*i;},easeInSine:function easeInSine(i){return 1-Math.cos(i*Math.PI/2);},easeOutSine:function easeOutSine(i){return Math.sin(i*Math.PI/2);},easeInOutSine:function easeInOutSine(i){return-(Math.cos(Math.PI*i)-1)/2;},easeInExpo:function easeInExpo(i){return i<=0?0:Math.pow(2,10*i-10);},easeOutExpo:function easeOutExpo(i){return i>=1?1:1-Math.pow(2,-10*i);},easeInOutExpo:function easeInOutExpo(i){return i<=0?0:i>=1?1:i<0.5?Math.pow(2,20*i-10)/2:(2-Math.pow(2,-20*i+10))/2;}};var pt=/*#__PURE__*/function(){function pt(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;_classCallCheck(this,pt);this.x=e,this.y=t,this.z=r;}return _createClass(pt,[{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setz",value:function setz(e){return this.z=e,this;}},{key:"setXY",value:function setXY(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;return this.x=e,this.y=t,this;}},{key:"set",value:function set(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;return this.x=e,this.y=t,this.z=r,this;}},{key:"setTo",value:function setTo(_ref163){var _ref163$x=_ref163.x,e=_ref163$x===void 0?0:_ref163$x,_ref163$y=_ref163.y,t=_ref163$y===void 0?0:_ref163$y,_ref163$z=_ref163.z,r=_ref163$z===void 0?1:_ref163$z;return this.x=e,this.y=t,this.z=r,this;}},{key:"rot",value:function rot(e){if(e===0)return this;var t=this.x,r=this.y,n=Math.sin(e),s=Math.cos(e);return this.x=t*s-r*n,this.y=t*n+r*s,this;}},{key:"rotWith",value:function rotWith(e,t){if(t===0)return this;var r=this.x-e.x,n=this.y-e.y,s=Math.sin(t),c=Math.cos(t);return this.x=e.x+(r*c-n*s),this.y=e.y+(r*s+n*c),this;}},{key:"clone",value:function clone(){var e=this.x,t=this.y,r=this.z;return new pt(e,t,r);}},{key:"sub",value:function sub(e){return this.x-=e.x,this.y-=e.y,this;}},{key:"subXY",value:function subXY(e,t){return this.x-=e,this.y-=t,this;}},{key:"subScalar",value:function subScalar(e){return this.x-=e,this.y-=e,this;}},{key:"add",value:function add(e){return this.x+=e.x,this.y+=e.y,this;}},{key:"addXY",value:function addXY(e,t){return this.x+=e,this.y+=t,this;}},{key:"addScalar",value:function addScalar(e){return this.x+=e,this.y+=e,this;}},{key:"clamp",value:function clamp(e,t){return this.x=Math.max(this.x,e),this.y=Math.max(this.y,e),t!==void 0&&(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)),this;}},{key:"div",value:function div(e){return this.x/=e,this.y/=e,this;}},{key:"divV",value:function divV(e){return this.x/=e.x,this.y/=e.y,this;}},{key:"mul",value:function mul(e){return this.x*=e,this.y*=e,this;}},{key:"mulV",value:function mulV(e){return this.x*=e.x,this.y*=e.y,this;}},{key:"abs",value:function abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this;}},{key:"nudge",value:function nudge(e,t){var r=pt.Tan(e,this);return this.add(r.mul(t));}},{key:"neg",value:function neg(){return this.x*=-1,this.y*=-1,this;}},{key:"cross",value:function cross(e){return this.x=this.y*e.z-this.z*e.y,this.y=this.z*e.x-this.x*e.z,this;}},{key:"dpr",value:function dpr(e){return pt.Dpr(this,e);}},{key:"cpr",value:function cpr(e){return pt.Cpr(this,e);}},{key:"len2",value:function len2(){return pt.Len2(this);}},{key:"len",value:function len(){return pt.Len(this);}},{key:"pry",value:function pry(e){return pt.Pry(this,e);}},{key:"per",value:function per(){var e=this.x,t=this.y;return this.x=t,this.y=-e,this;}},{key:"uni",value:function uni(){return pt.Uni(this);}},{key:"tan",value:function tan(e){return pt.Tan(this,e);}},{key:"dist",value:function dist(e){return pt.Dist(this,e);}},{key:"distanceToLineSegment",value:function distanceToLineSegment(e,t){return pt.DistanceToLineSegment(e,t,this);}},{key:"slope",value:function slope(e){return pt.Slope(this,e);}},{key:"snapToGrid",value:function snapToGrid(e){return this.x=Math.round(this.x/e)*e,this.y=Math.round(this.y/e)*e,this;}},{key:"angle",value:function angle(e){return pt.Angle(this,e);}},{key:"toAngle",value:function toAngle(){return pt.ToAngle(this);}},{key:"lrp",value:function lrp(e,t){return this.x=this.x+(e.x-this.x)*t,this.y=this.y+(e.y-this.y)*t,this;}},{key:"equals",value:function equals(e,t){return pt.Equals(this,e,t);}},{key:"equalsXY",value:function equalsXY(e,t){return pt.EqualsXY(this,e,t);}},{key:"norm",value:function norm(){var e=this.len();return this.x=e===0?0:this.x/e,this.y=e===0?0:this.y/e,this;}},{key:"toFixed",value:function toFixed(){return pt.ToFixed(this);}},{key:"toString",value:function toString(){return pt.ToString(pt.ToFixed(this));}},{key:"toJson",value:function toJson(){return pt.ToJson(this);}},{key:"toArray",value:function toArray(){return pt.ToArray(this);}}],[{key:"Add",value:function Add(e,t){return new pt(e.x+t.x,e.y+t.y);}},{key:"AddXY",value:function AddXY(e,t,r){return new pt(e.x+t,e.y+r);}},{key:"Sub",value:function Sub(e,t){return new pt(e.x-t.x,e.y-t.y);}},{key:"SubXY",value:function SubXY(e,t,r){return new pt(e.x-t,e.y-r);}},{key:"AddScalar",value:function AddScalar(e,t){return new pt(e.x+t,e.y+t);}},{key:"SubScalar",value:function SubScalar(e,t){return new pt(e.x-t,e.y-t);}},{key:"Div",value:function Div(e,t){return new pt(e.x/t,e.y/t);}},{key:"Mul",value:function Mul(e,t){return new pt(e.x*t,e.y*t);}},{key:"DivV",value:function DivV(e,t){return new pt(e.x/t.x,e.y/t.y);}},{key:"MulV",value:function MulV(e,t){return new pt(e.x*t.x,e.y*t.y);}},{key:"Neg",value:function Neg(e){return new pt(-e.x,-e.y);}},{key:"Per",value:function Per(e){return new pt(e.y,-e.x);}},{key:"Dist2",value:function Dist2(e,t){return pt.Sub(e,t).len2();}},{key:"Abs",value:function Abs(e){return new pt(Math.abs(e.x),Math.abs(e.y));}},{key:"Dist",value:function Dist(e,t){return Math.hypot(e.y-t.y,e.x-t.x);}},{key:"Dpr",value:function Dpr(e,t){return e.x*t.x+e.y*t.y;}},{key:"Cross",value:function Cross(e,t){return new pt(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z// A.z = A.x * V.y - A.y * V.x
|
|
366
366
|
);}},{key:"Cpr",value:function Cpr(e,t){return e.x*t.y-t.x*e.y;}},{key:"Len2",value:function Len2(e){return e.x*e.x+e.y*e.y;}},{key:"Len",value:function Len(e){return Math.hypot(e.x,e.y);}},{key:"Pry",value:function Pry(e,t){return pt.Dpr(e,t)/pt.Len(t);}},{key:"Uni",value:function Uni(e){return pt.Div(e,pt.Len(e));}},{key:"Tan",value:function Tan(e,t){return pt.Uni(pt.Sub(e,t));}},{key:"Min",value:function Min(e,t){return new pt(Math.min(e.x,t.x),Math.min(e.y,t.y));}},{key:"Max",value:function Max(e,t){return new pt(Math.max(e.x,t.x),Math.max(e.y,t.y));}},{key:"From",value:function From(e){return new pt().add(e);}},{key:"FromArray",value:function FromArray(e){return new pt(e[0],e[1]);}},{key:"Rot",value:function Rot(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=Math.sin(t),n=Math.cos(t);return new pt(e.x*n-e.y*r,e.x*r+e.y*n);}},{key:"RotWith",value:function RotWith(e,t,r){var n=e.x-t.x,s=e.y-t.y,c=Math.sin(r),l=Math.cos(r);return new pt(t.x+(n*l-s*c),t.y+(n*c+s*l));}/**
|
|
367
367
|
* Get the nearest point on a line with a known unit vector that passes through point A
|
|
368
368
|
*
|
|
@@ -392,20 +392,20 @@ _inherits(l,_r$default22);return _createClass(l,[{key:"texture",get:function get
|
|
|
392
392
|
* @param radian 1,逆时针180度 -1,顺时针
|
|
393
393
|
* @param average 均分数
|
|
394
394
|
* @returns
|
|
395
|
-
*/},{key:"GetSemicircleStroke",value:function GetSemicircleStroke(e,t){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:8;var s=r*(Math.PI+1e-3),c=[];for(var l=1/n,f=l;f<=1;f+=l)c.push(Jt.RotWith(t,e,s*f));return c;}}]);}(pt);var hn=(typeof globalThis==="undefined"?"undefined":_typeof(globalThis))<"u"?globalThis:(typeof window==="undefined"?"undefined":_typeof(window))<"u"?window:(typeof global==="undefined"?"undefined":_typeof(global))<"u"?global:(typeof self==="undefined"?"undefined":_typeof(self))<"u"?self:{};function Ln(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i["default"]:i;}var p1=_typeof(hn)=="object"&&hn&&hn.Object===Object&&hn,zu=p1,v1=zu,g1=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self,m1=v1||g1||Function("return this")(),_r=m1,y1=_r,P1=y1.Symbol,Ji=P1,$c=Ji,$u=Object.prototype,S1=$u.hasOwnProperty,x1=$u.toString
|
|
395
|
+
*/},{key:"GetSemicircleStroke",value:function GetSemicircleStroke(e,t){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:8;var s=r*(Math.PI+1e-3),c=[];for(var l=1/n,f=l;f<=1;f+=l)c.push(Jt.RotWith(t,e,s*f));return c;}}]);}(pt);var hn=(typeof globalThis==="undefined"?"undefined":_typeof(globalThis))<"u"?globalThis:(typeof window==="undefined"?"undefined":_typeof(window))<"u"?window:(typeof global==="undefined"?"undefined":_typeof(global))<"u"?global:(typeof self==="undefined"?"undefined":_typeof(self))<"u"?self:{};function Ln(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i["default"]:i;}var p1=_typeof(hn)=="object"&&hn&&hn.Object===Object&&hn,zu=p1,v1=zu,g1=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self,m1=v1||g1||Function("return this")(),_r=m1,y1=_r,P1=y1.Symbol,Ji=P1,$c=Ji,$u=Object.prototype,S1=$u.hasOwnProperty,x1=$u.toString,ji=$c?$c.toStringTag:void 0;function T1(i){var e=S1.call(i,ji),t=i[ji];try{i[ji]=void 0;var r=!0;}catch(_unused18){}var n=x1.call(i);return r&&(e?i[ji]=t:delete i[ji]),n;}var C1=T1,I1=Object.prototype,O1=I1.toString;function w1(i){return O1.call(i);}var A1=w1,jc=Ji,E1=C1,M1=A1,L1="[object Null]",R1="[object Undefined]",Gc=jc?jc.toStringTag:void 0;function b1(i){return i==null?i===void 0?R1:L1:Gc&&Gc in Object(i)?E1(i):M1(i);}var Si=b1;function D1(i){return i!=null&&_typeof(i)=="object";}var pn=D1,N1=Si,B1=pn,W1="[object Number]";function F1(i){return typeof i=="number"||B1(i)&&N1(i)==W1;}var U1=F1,er=/* @__PURE__ */Ln(U1);function Y1(){this.__data__=[],this.size=0;}var X1=Y1;function z1(i,e){return i===e||i!==i&&e!==e;}var ul=z1,$1=ul;function j1(i,e){for(var t=i.length;t--;)if($1(i[t][0],e))return t;return-1;}var po=j1,G1=po,H1=Array.prototype,k1=H1.splice;function K1(i){var e=this.__data__,t=G1(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():k1.call(e,t,1),--this.size,!0;}var V1=K1,Z1=po;function J1(i){var e=this.__data__,t=Z1(e,i);return t<0?void 0:e[t][1];}var Q1=J1,q1=po;function _1(i){return q1(this.__data__,i)>-1;}var tP=_1,eP=po;function rP(i,e){var t=this.__data__,r=eP(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this;}var nP=rP,iP=X1,sP=V1,oP=Q1,aP=tP,lP=nP;function xi(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1]);}}xi.prototype.clear=iP;xi.prototype["delete"]=sP;xi.prototype.get=oP;xi.prototype.has=aP;xi.prototype.set=lP;var vo=xi,fP=vo;function cP(){this.__data__=new fP(),this.size=0;}var uP=cP;function hP(i){var e=this.__data__,t=e["delete"](i);return this.size=e.size,t;}var dP=hP;function pP(i){return this.__data__.get(i);}var vP=pP;function gP(i){return this.__data__.has(i);}var mP=gP;function yP(i){var e=_typeof(i);return i!=null&&(e=="object"||e=="function");}var Qi=yP,PP=Si,SP=Qi,xP="[object AsyncFunction]",TP="[object Function]",CP="[object GeneratorFunction]",IP="[object Proxy]";function OP(i){if(!SP(i))return!1;var e=PP(i);return e==TP||e==CP||e==xP||e==IP;}var ju=OP,wP=_r,AP=wP["__core-js_shared__"],EP=AP,Qa=EP,Hc=function(){var i=/[^.]+$/.exec(Qa&&Qa.keys&&Qa.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:"";}();function MP(i){return!!Hc&&Hc in i;}var LP=MP,RP=Function.prototype,bP=RP.toString;function DP(i){if(i!=null){try{return bP.call(i);}catch(_unused19){}try{return i+"";}catch(_unused20){}}return"";}var Gu=DP,NP=ju,BP=LP,WP=Qi,FP=Gu,UP=/[\\^$.*+?()[\]{}|]/g,YP=/^\[object .+?Constructor\]$/,XP=Function.prototype,zP=Object.prototype,$P=XP.toString,jP=zP.hasOwnProperty,GP=RegExp("^"+$P.call(jP).replace(UP,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function HP(i){if(!WP(i)||BP(i))return!1;var e=NP(i)?GP:YP;return e.test(FP(i));}var kP=HP;function KP(i,e){return i==null?void 0:i[e];}var VP=KP,ZP=kP,JP=VP;function QP(i,e){var t=JP(i,e);return ZP(t)?t:void 0;}var jn=QP,qP=jn,_P=_r,tS=qP(_P,"Map"),hl=tS,eS=jn,rS=eS(Object,"create"),go=rS,kc=go;function nS(){this.__data__=kc?kc(null):{},this.size=0;}var iS=nS;function sS(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e;}var oS=sS,aS=go,lS="__lodash_hash_undefined__",fS=Object.prototype,cS=fS.hasOwnProperty;function uS(i){var e=this.__data__;if(aS){var t=e[i];return t===lS?void 0:t;}return cS.call(e,i)?e[i]:void 0;}var hS=uS,dS=go,pS=Object.prototype,vS=pS.hasOwnProperty;function gS(i){var e=this.__data__;return dS?e[i]!==void 0:vS.call(e,i);}var mS=gS,yS=go,PS="__lodash_hash_undefined__";function SS(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=yS&&e===void 0?PS:e,this;}var xS=SS,TS=iS,CS=oS,IS=hS,OS=mS,wS=xS;function Ti(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1]);}}Ti.prototype.clear=TS;Ti.prototype["delete"]=CS;Ti.prototype.get=IS;Ti.prototype.has=OS;Ti.prototype.set=wS;var AS=Ti,Kc=AS,ES=vo,MS=hl;function LS(){this.size=0,this.__data__={hash:new Kc(),map:new(MS||ES)(),string:new Kc()};}var RS=LS;function bS(i){var e=_typeof(i);return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null;}var DS=bS,NS=DS;function BS(i,e){var t=i.__data__;return NS(e)?t[typeof e=="string"?"string":"hash"]:t.map;}var mo=BS,WS=mo;function FS(i){var e=WS(this,i)["delete"](i);return this.size-=e?1:0,e;}var US=FS,YS=mo;function XS(i){return YS(this,i).get(i);}var zS=XS,$S=mo;function jS(i){return $S(this,i).has(i);}var GS=jS,HS=mo;function kS(i,e){var t=HS(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this;}var KS=kS,VS=RS,ZS=US,JS=zS,QS=GS,qS=KS;function Ci(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1]);}}Ci.prototype.clear=VS;Ci.prototype["delete"]=ZS;Ci.prototype.get=JS;Ci.prototype.has=QS;Ci.prototype.set=qS;var Hu=Ci,_S=vo,tx=hl,ex=Hu,rx=200;function nx(i,e){var t=this.__data__;if(t instanceof _S){var r=t.__data__;if(!tx||r.length<rx-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new ex(r);}return t.set(i,e),this.size=t.size,this;}var ix=nx,sx=vo,ox=uP,ax=dP,lx=vP,fx=mP,cx=ix;function Ii(i){var e=this.__data__=new sx(i);this.size=e.size;}Ii.prototype.clear=ox;Ii.prototype["delete"]=ax;Ii.prototype.get=lx;Ii.prototype.has=fx;Ii.prototype.set=cx;var ku=Ii;function ux(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i;}var hx=ux,dx=jn,px=function(){try{var i=dx(Object,"defineProperty");return i({},"",{}),i;}catch(_unused21){}}(),Ku=px,Vc=Ku;function vx(i,e,t){e=="__proto__"&&Vc?Vc(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t;}var Vu=vx,gx=Vu,mx=ul,yx=Object.prototype,Px=yx.hasOwnProperty;function Sx(i,e,t){var r=i[e];(!(Px.call(i,e)&&mx(r,t))||t===void 0&&!(e in i))&&gx(i,e,t);}var Zu=Sx,xx=Zu,Tx=Vu;function Cx(i,e,t,r){var n=!t;t||(t={});for(var s=-1,c=e.length;++s<c;){var l=e[s],f=r?r(t[l],i[l],l,t,i):void 0;f===void 0&&(f=i[l]),n?Tx(t,l,f):xx(t,l,f);}return t;}var yo=Cx;function Ix(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r;}var Ox=Ix,wx=Si,Ax=pn,Ex="[object Arguments]";function Mx(i){return Ax(i)&&wx(i)==Ex;}var Lx=Mx,Zc=Lx,Rx=pn,Ju=Object.prototype,bx=Ju.hasOwnProperty,Dx=Ju.propertyIsEnumerable,Nx=Zc(/* @__PURE__ */function(){return arguments;}())?Zc:function(i){return Rx(i)&&bx.call(i,"callee")&&!Dx.call(i,"callee");},Qu=Nx,Bx=Array.isArray,qi=Bx,to={exports:{}};function Wx(){return!1;}var Fx=Wx;to.exports;(function(i,e){var t=_r,r=Fx,n=e&&!e.nodeType&&e,s=n&&!0&&i&&!i.nodeType&&i,c=s&&s.exports===n,l=c?t.Buffer:void 0,f=l?l.isBuffer:void 0,h=f||r;i.exports=h;})(to,to.exports);var dl=to.exports,Ux=9007199254740991,Yx=/^(?:0|[1-9]\d*)$/;function Xx(i,e){var _e2;var t=_typeof(i);return e=(_e2=e)!==null&&_e2!==void 0?_e2:Ux,!!e&&(t=="number"||t!="symbol"&&Yx.test(i))&&i>-1&&i%1==0&&i<e;}var zx=Xx,$x=9007199254740991;function jx(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=$x;}var qu=jx,Gx=Si,Hx=qu,kx=pn,Kx="[object Arguments]",Vx="[object Array]",Zx="[object Boolean]",Jx="[object Date]",Qx="[object Error]",qx="[object Function]",_x="[object Map]",tT="[object Number]",eT="[object Object]",rT="[object RegExp]",nT="[object Set]",iT="[object String]",sT="[object WeakMap]",oT="[object ArrayBuffer]",aT="[object DataView]",lT="[object Float32Array]",fT="[object Float64Array]",cT="[object Int8Array]",uT="[object Int16Array]",hT="[object Int32Array]",dT="[object Uint8Array]",pT="[object Uint8ClampedArray]",vT="[object Uint16Array]",gT="[object Uint32Array]",$e={};$e[lT]=$e[fT]=$e[cT]=$e[uT]=$e[hT]=$e[dT]=$e[pT]=$e[vT]=$e[gT]=!0;$e[Kx]=$e[Vx]=$e[oT]=$e[Zx]=$e[aT]=$e[Jx]=$e[Qx]=$e[qx]=$e[_x]=$e[tT]=$e[eT]=$e[rT]=$e[nT]=$e[iT]=$e[sT]=!1;function mT(i){return kx(i)&&Hx(i.length)&&!!$e[Gx(i)];}var yT=mT;function PT(i){return function(e){return i(e);};}var Po=PT,eo={exports:{}};eo.exports;(function(i,e){var t=zu,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s&&t.process,l=function(){try{var f=n&&n.require&&n.require("util").types;return f||c&&c.binding&&c.binding("util");}catch(_unused22){}}();i.exports=l;})(eo,eo.exports);var pl=eo.exports,ST=yT,xT=Po,Jc=pl,Qc=Jc&&Jc.isTypedArray,TT=Qc?xT(Qc):ST,_u=TT,CT=Ox,IT=Qu,OT=qi,wT=dl,AT=zx,ET=_u,MT=Object.prototype,LT=MT.hasOwnProperty;function RT(i,e){var t=OT(i),r=!t&&IT(i),n=!t&&!r&&wT(i),s=!t&&!r&&!n&&ET(i),c=t||r||n||s,l=c?CT(i.length,String):[],f=l.length;for(var h in i)(e||LT.call(i,h))&&!(c&&(// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
396
396
|
h=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
397
397
|
n&&(h=="offset"||h=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
398
398
|
s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||// Skip index properties.
|
|
399
|
-
AT(h,f)))&&l.push(h);return l;}var th=RT,bT=Object.prototype;function DT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||bT;return i===t;}var vl=DT;function NT(i,e){return function(t){return i(e(t));};}var eh=NT,BT=eh,WT=BT(Object.keys,Object),FT=WT,UT=vl,YT=FT,XT=Object.prototype,zT=XT.hasOwnProperty;function $T(i){if(!UT(i))return YT(i);var e=[];for(var t in Object(i))zT.call(i,t)&&t!="constructor"&&e.push(t);return e;}var jT=$T,GT=ju,HT=qu;function kT(i){return i!=null&&HT(i.length)&&!GT(i);}var gl=kT,KT=th,VT=jT,ZT=gl;function JT(i){return ZT(i)?KT(i):VT(i);}var ml=JT,QT=yo,qT=ml;function _T(i,e){return i&&QT(e,qT(e),i);}var tC=_T;function eC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var rC=eC,nC=Qi,iC=vl,sC=rC,oC=Object.prototype,aC=oC.hasOwnProperty;function lC(i){if(!nC(i))return sC(i);var e=iC(i),t=[];for(var r in i)r=="constructor"&&(e||!aC.call(i,r))||t.push(r);return t;}var fC=lC,cC=th,uC=fC,hC=gl;function dC(i){return hC(i)?cC(i,!0):uC(i);}var yl=dC,pC=yo,vC=yl;function gC(i,e){return i&&pC(e,vC(e),i);}var mC=gC,ro={exports:{}};ro.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(ro,ro.exports);var yC=ro.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var SC=PC;function xC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var rh=xC;function TC(){return[];}var nh=TC,CC=rh,IC=nh,OC=Object.prototype,wC=OC.propertyIsEnumerable,qc=Object.getOwnPropertySymbols,AC=qc?function(i){return i==null?[]:(i=Object(i),CC(qc(i),function(e){return wC.call(i,e);}));}:IC,Pl=AC,EC=yo,MC=Pl;function LC(i,e){return EC(i,MC(i),e);}var RC=LC;function bC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Sl=bC,DC=eh,NC=DC(Object.getPrototypeOf,Object),ih=NC,BC=Sl,WC=ih,FC=Pl,UC=nh,YC=Object.getOwnPropertySymbols,XC=YC?function(i){for(var e=[];i;)BC(e,FC(i)),i=WC(i);return e;}:UC,sh=XC,zC=yo,$C=sh;function jC(i,e){return zC(i,$C(i),e);}var GC=jC,HC=Sl,kC=qi;function KC(i,e,t){var r=e(i);return kC(i)?r:HC(r,t(i));}var oh=KC,VC=oh,ZC=Pl,JC=ml;function QC(i){return VC(i,JC,ZC);}var ah=QC,qC=oh,_C=sh,tI=yl;function eI(i){return qC(i,tI,_C);}var rI=eI,nI=$n,iI=_r,sI=nI(iI,"DataView"),oI=sI,aI=$n,lI=_r,fI=aI(lI,"Promise"),cI=fI,uI=$n,hI=_r,dI=uI(hI,"Set"),lh=dI,pI=$n,vI=_r,gI=pI(vI,"WeakMap"),mI=gI,rl=oI,nl=hl,il=cI,sl=lh,ol=mI,fh=Pi,Ii=Gu,_c="[object Map]",yI="[object Object]",tu="[object Promise]",eu="[object Set]",ru="[object WeakMap]",nu="[object DataView]",PI=Ii(rl),SI=Ii(nl),xI=Ii(il),TI=Ii(sl),CI=Ii(ol),zn=fh;(rl&&zn(new rl(new ArrayBuffer(1)))!=nu||nl&&zn(new nl())!=_c||il&&zn(il.resolve())!=tu||sl&&zn(new sl())!=eu||ol&&zn(new ol())!=ru)&&(zn=function zn(i){var e=fh(i),t=e==yI?i.constructor:void 0,r=t?Ii(t):"";if(r)switch(r){case PI:return nu;case SI:return _c;case xI:return tu;case TI:return eu;case CI:return ru;}return e;});var So=zn,II=Object.prototype,OI=II.hasOwnProperty;function wI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var AI=wI,EI=_r,MI=EI.Uint8Array,ch=MI,iu=ch;function LI(i){var e=new i.constructor(i.byteLength);return new iu(e).set(new iu(i)),e;}var xl=LI,RI=xl;function bI(i,e){var t=e?RI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var DI=bI,NI=/\w*$/;function BI(i){var e=new i.constructor(i.source,NI.exec(i));return e.lastIndex=i.lastIndex,e;}var WI=BI,su=Ji,ou=su?su.prototype:void 0,au=ou?ou.valueOf:void 0;function FI(i){return au?Object(au.call(i)):{};}var UI=FI,YI=xl;function XI(i,e){var t=e?YI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var zI=XI,$I=xl,jI=DI,GI=WI,HI=UI,kI=zI,KI="[object Boolean]",VI="[object Date]",ZI="[object Map]",JI="[object Number]",QI="[object RegExp]",qI="[object Set]",_I="[object String]",tO="[object Symbol]",eO="[object ArrayBuffer]",rO="[object DataView]",nO="[object Float32Array]",iO="[object Float64Array]",sO="[object Int8Array]",oO="[object Int16Array]",aO="[object Int32Array]",lO="[object Uint8Array]",fO="[object Uint8ClampedArray]",cO="[object Uint16Array]",uO="[object Uint32Array]";function hO(i,e,t){var r=i.constructor;switch(e){case eO:return $I(i);case KI:case VI:return new r(+i);case rO:return jI(i,t);case nO:case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:return kI(i,t);case ZI:return new r();case JI:case _I:return new r(i);case QI:return GI(i);case qI:return new r();case tO:return HI(i);}}var dO=hO,pO=Qi,lu=Object.create,vO=/* @__PURE__ */function(){function i(){}return function(e){if(!pO(e))return{};if(lu)return lu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),gO=vO,mO=gO,yO=ih,PO=vl;function SO(i){return typeof i.constructor=="function"&&!PO(i)?mO(yO(i)):{};}var xO=SO,TO=So,CO=pn,IO="[object Map]";function OO(i){return CO(i)&&TO(i)==IO;}var wO=OO,AO=wO,EO=Po,fu=pl,cu=fu&&fu.isMap,MO=cu?EO(cu):AO,LO=MO,RO=So,bO=pn,DO="[object Set]";function NO(i){return bO(i)&&RO(i)==DO;}var BO=NO,WO=BO,FO=Po,uu=pl,hu=uu&&uu.isSet,UO=hu?FO(hu):WO,uh=UO,YO=/* @__PURE__ */Ln(uh),XO=ku,zO=hx,$O=Zu,jO=tC,GO=mC,HO=yC,kO=SC,KO=RC,VO=GC,ZO=ah,JO=rI,QO=So,qO=AI,_O=dO,t2=xO,e2=qi,r2=dl,n2=LO,i2=Qi,s2=uh,o2=ml,a2=yl,l2=1,f2=2,c2=4,hh="[object Arguments]",u2="[object Array]",h2="[object Boolean]",d2="[object Date]",p2="[object Error]",dh="[object Function]",v2="[object GeneratorFunction]",g2="[object Map]",m2="[object Number]",ph="[object Object]",y2="[object RegExp]",P2="[object Set]",S2="[object String]",x2="[object Symbol]",T2="[object WeakMap]",C2="[object ArrayBuffer]",I2="[object DataView]",O2="[object Float32Array]",w2="[object Float64Array]",A2="[object Int8Array]",E2="[object Int16Array]",M2="[object Int32Array]",L2="[object Uint8Array]",R2="[object Uint8ClampedArray]",b2="[object Uint16Array]",D2="[object Uint32Array]",Ye={};Ye[hh]=Ye[u2]=Ye[C2]=Ye[I2]=Ye[h2]=Ye[d2]=Ye[O2]=Ye[w2]=Ye[A2]=Ye[E2]=Ye[M2]=Ye[g2]=Ye[m2]=Ye[ph]=Ye[y2]=Ye[P2]=Ye[S2]=Ye[x2]=Ye[L2]=Ye[R2]=Ye[b2]=Ye[D2]=!0;Ye[p2]=Ye[dh]=Ye[T2]=!1;function qs(i,e,t,r,n,s){var c,l=e&l2,f=e&f2,h=e&c2;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!i2(i))return i;var m=e2(i);if(m){if(c=qO(i),!l)return kO(i,c);}else{var u=QO(i),y=u==dh||u==v2;if(r2(i))return HO(i,l);if(u==ph||u==hh||y&&!n){if(c=f||y?{}:t2(i),!l)return f?VO(i,GO(c,i)):KO(i,jO(c,i));}else{if(!Ye[u])return n?i:{};c=_O(i,u,l);}}s||(s=new XO());var T=s.get(i);if(T)return T;s.set(i,c),s2(i)?i.forEach(function(x){c.add(qs(x,e,t,x,i,s));}):n2(i)&&i.forEach(function(x,I){c.set(I,qs(x,e,t,I,i,s));});var E=h?f?JO:ZO:f?a2:o2,C=m?void 0:E(i);return zO(C||i,function(x,I){C&&(I=x,x=i[I]),$O(c,I,qs(x,e,t,I,i,s));}),c;}var N2=qs,B2=N2,W2=1,F2=4;function U2(i){return B2(i,W2|F2);}var Y2=U2,fr=/* @__PURE__ */Ln(Y2);var vh="1.1.23",X2="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(X2,"@").concat(vh),window.__netlessUA=i;}var vr={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(fi(r),"L").concat(fi(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ci(r,n);return e?"M".concat(ci(i[0],i[1]),"Q").concat(fi(i[1])).concat(ci(i[1],i[2]),"T").concat(s).concat(ci(i[t-1],i[0])).concat(ci(i[0],i[1]),"Z"):"M".concat(fi(i[0]),"Q").concat(fi(i[1])).concat(ci(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(fi(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",vr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",vr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};er(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var E=l==null?void 0:l.getBoundingClientRect();return E&&(t=Zt(t,{x:Math.floor(E.x-Mr.SafeBorderPadding),y:Math.floor(E.y-Mr.SafeBorderPadding),w:Math.floor(E.width+Mr.SafeBorderPadding*2),h:Math.floor(E.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var E=c.getAttribute("scale");E=[E[0]*T,E[1]*T];var C=c.parent.parent,x=c.getAttribute("translate"),_I32=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),C,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},E,x),_d29=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d29,n,s,!1),_I32.appendChild(_d29);var v=_I32.parent;v.render();var p=_I32.renderer.canvasRenderer,S=p.context;if(!S)return;var A=p.options.displayRatio,R=_d29.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:C.width,h:C.height};if(Zi(D,U)===Tr.outside){Lr(_d29,v),C.removeChild(v),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,C.width)-W.x,W.h=Math.min(D.y+D.h,C.height)-W.y;var Y=this.getGroupRect(W,A),B=Y.x,N=Y.y,G=Y.w,J=Y.h;var tt=S.getImageData(B,N,G,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d29,v),C.removeChild(v),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_I32.worldScaling});ut&&r.append(ut),Lr(_d29,v),C.removeChild(v),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(E,C){return C%2?E-r[1]:E-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var E=_ref164.detail;var C=E.context;n?C.blendFuncSeparate(C.ZERO,C.ZERO,C.ZERO,C.ZERO):C.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var E=_ref165.detail;var C=E.context;n?C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA):C.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Yu(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this61=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?iE(r,c,e):(c.remove(),_pr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_pr(l,(f=_this61.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_pr(l,_this61.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_pr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,E=r.thickness;var C;var x=c&&fr(c)||n.get(t.name);if(!x)return;er(l)&&(t.setAttribute("zIndex",l),x.opt.zIndex=l);var I=t.parent;if(I){if(m&&y&&c){var v=[x.op[0],x.op[1]];Ll(x.op,u,y,f);var p=[x.op[0],x.op[1]],S=[p[0]-v[0],p[1]-v[1]];if(x.centerPos=[x.centerPos[0]+S[0],x.centerPos[1]+S[1]],x.opt.translate=void 0,x.opt.scale=void 0,x.opt.eraserlines)for(var A=0;A<x.opt.eraserlines.length;A++){var _x$opt$eraserlines$A=x.opt.eraserlines[A],R=_x$opt$eraserlines$A.op,D=_x$opt$eraserlines$A.thickness;x.opt.eraserlines[A].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Rl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),x.opt.translate=f,c){var _v6=[f[0]*I.worldScaling[0],f[1]*I.worldScaling[1]];C=Vi(x.rect,_v6),x.rect=C;}else{var _v7=Mr.getRectFromLayer(I,t.name);x.rect=_v7||x.rect;}}else if(er(h))if(t.setAttribute("rotate",h),x.opt.rotate=h,c)C=kh(x.rect,h),x.rect=C;else{var _v8=Mr.getRectFromLayer(I,t.name);x.rect=_v8||x.rect;}if(T){var _v9=T.get(t.name);if(_v9)for(var _p10=0,_S10=0;_p10<x.op.length;_p10+=3,_S10++)x.op[_p10]=_v9[_S10][0],x.op[_p10+1]=_v9[_S10][1];}if(E&&(d=x==null?void 0:x.opt)!=null&&d.thickness&&(x.opt.thickness=E),s&&!(m&&y&&c)){if(f){var _v10=x.op.map(function(p,S){var A=S%3;return A===0?p+f[0]:A===1?p+f[1]:p;});if(x.op=_v10,x.centerPos=[x.centerPos[0]+f[0],x.centerPos[1]+f[1]],x!=null&&x.opt&&(x.opt.translate=void 0),x.opt.eraserlines)for(var _p11=0;_p11<x.opt.eraserlines.length;_p11++){var _S11=x.opt.eraserlines[_p11].op;for(var _A7=0;_A7<_S11.length;_A7++){var _R3=_S11[_A7].map(function(D,U){return U%2?D+f[1]:D+f[0];});x.opt.eraserlines[_p11].op[_A7]=_R3;}}}else if(er(h)){var _v11=x.op;if(JA(_v11,x.centerPos,h),x.op=_v11,x!=null&&x.opt&&(x.opt.rotate=void 0),x.opt.eraserlines)for(var _p12=0;_p12<x.opt.eraserlines.length;_p12++){var _S12=x.opt.eraserlines[_p12].op;for(var _A8=0;_A8<_S12.length;_A8++)QA(_S12[_A8],x.centerPos,h);}}}x&&n.setInfo(t.name,x);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===Tt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===Tt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&s.type===cl.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var $t=Mr;var Tl=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Cl={exports:{}};Cl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
399
|
+
AT(h,f)))&&l.push(h);return l;}var th=RT,bT=Object.prototype;function DT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||bT;return i===t;}var vl=DT;function NT(i,e){return function(t){return i(e(t));};}var eh=NT,BT=eh,WT=BT(Object.keys,Object),FT=WT,UT=vl,YT=FT,XT=Object.prototype,zT=XT.hasOwnProperty;function $T(i){if(!UT(i))return YT(i);var e=[];for(var t in Object(i))zT.call(i,t)&&t!="constructor"&&e.push(t);return e;}var jT=$T,GT=ju,HT=qu;function kT(i){return i!=null&&HT(i.length)&&!GT(i);}var gl=kT,KT=th,VT=jT,ZT=gl;function JT(i){return ZT(i)?KT(i):VT(i);}var ml=JT,QT=yo,qT=ml;function _T(i,e){return i&&QT(e,qT(e),i);}var tC=_T;function eC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var rC=eC,nC=Qi,iC=vl,sC=rC,oC=Object.prototype,aC=oC.hasOwnProperty;function lC(i){if(!nC(i))return sC(i);var e=iC(i),t=[];for(var r in i)r=="constructor"&&(e||!aC.call(i,r))||t.push(r);return t;}var fC=lC,cC=th,uC=fC,hC=gl;function dC(i){return hC(i)?cC(i,!0):uC(i);}var yl=dC,pC=yo,vC=yl;function gC(i,e){return i&&pC(e,vC(e),i);}var mC=gC,ro={exports:{}};ro.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(ro,ro.exports);var yC=ro.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var SC=PC;function xC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var rh=xC;function TC(){return[];}var nh=TC,CC=rh,IC=nh,OC=Object.prototype,wC=OC.propertyIsEnumerable,qc=Object.getOwnPropertySymbols,AC=qc?function(i){return i==null?[]:(i=Object(i),CC(qc(i),function(e){return wC.call(i,e);}));}:IC,Pl=AC,EC=yo,MC=Pl;function LC(i,e){return EC(i,MC(i),e);}var RC=LC;function bC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Sl=bC,DC=eh,NC=DC(Object.getPrototypeOf,Object),ih=NC,BC=Sl,WC=ih,FC=Pl,UC=nh,YC=Object.getOwnPropertySymbols,XC=YC?function(i){for(var e=[];i;)BC(e,FC(i)),i=WC(i);return e;}:UC,sh=XC,zC=yo,$C=sh;function jC(i,e){return zC(i,$C(i),e);}var GC=jC,HC=Sl,kC=qi;function KC(i,e,t){var r=e(i);return kC(i)?r:HC(r,t(i));}var oh=KC,VC=oh,ZC=Pl,JC=ml;function QC(i){return VC(i,JC,ZC);}var ah=QC,qC=oh,_C=sh,tI=yl;function eI(i){return qC(i,tI,_C);}var rI=eI,nI=jn,iI=_r,sI=nI(iI,"DataView"),oI=sI,aI=jn,lI=_r,fI=aI(lI,"Promise"),cI=fI,uI=jn,hI=_r,dI=uI(hI,"Set"),lh=dI,pI=jn,vI=_r,gI=pI(vI,"WeakMap"),mI=gI,rl=oI,nl=hl,il=cI,sl=lh,ol=mI,fh=Si,Oi=Gu,_c="[object Map]",yI="[object Object]",tu="[object Promise]",eu="[object Set]",ru="[object WeakMap]",nu="[object DataView]",PI=Oi(rl),SI=Oi(nl),xI=Oi(il),TI=Oi(sl),CI=Oi(ol),zn=fh;(rl&&zn(new rl(new ArrayBuffer(1)))!=nu||nl&&zn(new nl())!=_c||il&&zn(il.resolve())!=tu||sl&&zn(new sl())!=eu||ol&&zn(new ol())!=ru)&&(zn=function zn(i){var e=fh(i),t=e==yI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return nu;case SI:return _c;case xI:return tu;case TI:return eu;case CI:return ru;}return e;});var So=zn,II=Object.prototype,OI=II.hasOwnProperty;function wI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var AI=wI,EI=_r,MI=EI.Uint8Array,ch=MI,iu=ch;function LI(i){var e=new i.constructor(i.byteLength);return new iu(e).set(new iu(i)),e;}var xl=LI,RI=xl;function bI(i,e){var t=e?RI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var DI=bI,NI=/\w*$/;function BI(i){var e=new i.constructor(i.source,NI.exec(i));return e.lastIndex=i.lastIndex,e;}var WI=BI,su=Ji,ou=su?su.prototype:void 0,au=ou?ou.valueOf:void 0;function FI(i){return au?Object(au.call(i)):{};}var UI=FI,YI=xl;function XI(i,e){var t=e?YI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var zI=XI,$I=xl,jI=DI,GI=WI,HI=UI,kI=zI,KI="[object Boolean]",VI="[object Date]",ZI="[object Map]",JI="[object Number]",QI="[object RegExp]",qI="[object Set]",_I="[object String]",tO="[object Symbol]",eO="[object ArrayBuffer]",rO="[object DataView]",nO="[object Float32Array]",iO="[object Float64Array]",sO="[object Int8Array]",oO="[object Int16Array]",aO="[object Int32Array]",lO="[object Uint8Array]",fO="[object Uint8ClampedArray]",cO="[object Uint16Array]",uO="[object Uint32Array]";function hO(i,e,t){var r=i.constructor;switch(e){case eO:return $I(i);case KI:case VI:return new r(+i);case rO:return jI(i,t);case nO:case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:return kI(i,t);case ZI:return new r();case JI:case _I:return new r(i);case QI:return GI(i);case qI:return new r();case tO:return HI(i);}}var dO=hO,pO=Qi,lu=Object.create,vO=/* @__PURE__ */function(){function i(){}return function(e){if(!pO(e))return{};if(lu)return lu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),gO=vO,mO=gO,yO=ih,PO=vl;function SO(i){return typeof i.constructor=="function"&&!PO(i)?mO(yO(i)):{};}var xO=SO,TO=So,CO=pn,IO="[object Map]";function OO(i){return CO(i)&&TO(i)==IO;}var wO=OO,AO=wO,EO=Po,fu=pl,cu=fu&&fu.isMap,MO=cu?EO(cu):AO,LO=MO,RO=So,bO=pn,DO="[object Set]";function NO(i){return bO(i)&&RO(i)==DO;}var BO=NO,WO=BO,FO=Po,uu=pl,hu=uu&&uu.isSet,UO=hu?FO(hu):WO,uh=UO,YO=/* @__PURE__ */Ln(uh),XO=ku,zO=hx,$O=Zu,jO=tC,GO=mC,HO=yC,kO=SC,KO=RC,VO=GC,ZO=ah,JO=rI,QO=So,qO=AI,_O=dO,t2=xO,e2=qi,r2=dl,n2=LO,i2=Qi,s2=uh,o2=ml,a2=yl,l2=1,f2=2,c2=4,hh="[object Arguments]",u2="[object Array]",h2="[object Boolean]",d2="[object Date]",p2="[object Error]",dh="[object Function]",v2="[object GeneratorFunction]",g2="[object Map]",m2="[object Number]",ph="[object Object]",y2="[object RegExp]",P2="[object Set]",S2="[object String]",x2="[object Symbol]",T2="[object WeakMap]",C2="[object ArrayBuffer]",I2="[object DataView]",O2="[object Float32Array]",w2="[object Float64Array]",A2="[object Int8Array]",E2="[object Int16Array]",M2="[object Int32Array]",L2="[object Uint8Array]",R2="[object Uint8ClampedArray]",b2="[object Uint16Array]",D2="[object Uint32Array]",Ye={};Ye[hh]=Ye[u2]=Ye[C2]=Ye[I2]=Ye[h2]=Ye[d2]=Ye[O2]=Ye[w2]=Ye[A2]=Ye[E2]=Ye[M2]=Ye[g2]=Ye[m2]=Ye[ph]=Ye[y2]=Ye[P2]=Ye[S2]=Ye[x2]=Ye[L2]=Ye[R2]=Ye[b2]=Ye[D2]=!0;Ye[p2]=Ye[dh]=Ye[T2]=!1;function qs(i,e,t,r,n,s){var c,l=e&l2,f=e&f2,h=e&c2;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!i2(i))return i;var m=e2(i);if(m){if(c=qO(i),!l)return kO(i,c);}else{var u=QO(i),y=u==dh||u==v2;if(r2(i))return HO(i,l);if(u==ph||u==hh||y&&!n){if(c=f||y?{}:t2(i),!l)return f?VO(i,GO(c,i)):KO(i,jO(c,i));}else{if(!Ye[u])return n?i:{};c=_O(i,u,l);}}s||(s=new XO());var T=s.get(i);if(T)return T;s.set(i,c),s2(i)?i.forEach(function(x){c.add(qs(x,e,t,x,i,s));}):n2(i)&&i.forEach(function(x,I){c.set(I,qs(x,e,t,I,i,s));});var E=h?f?JO:ZO:f?a2:o2,C=m?void 0:E(i);return zO(C||i,function(x,I){C&&(I=x,x=i[I]),$O(c,I,qs(x,e,t,I,i,s));}),c;}var N2=qs,B2=N2,W2=1,F2=4;function U2(i){return B2(i,W2|F2);}var Y2=U2,fr=/* @__PURE__ */Ln(Y2);var vh="1.1.24",X2="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(X2,"@").concat(vh),window.__netlessUA=i;}var vr={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ci(r),"L").concat(ci(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ui(r,n);return e?"M".concat(ui(i[0],i[1]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2]),"T").concat(s).concat(ui(i[t-1],i[0])).concat(ui(i[0],i[1]),"Z"):"M".concat(ci(i[0]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ci(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",vr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",vr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};er(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var E=l==null?void 0:l.getBoundingClientRect();return E&&(t=Zt(t,{x:Math.floor(E.x-Mr.SafeBorderPadding),y:Math.floor(E.y-Mr.SafeBorderPadding),w:Math.floor(E.width+Mr.SafeBorderPadding*2),h:Math.floor(E.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var E=c.getAttribute("scale");E=[E[0]*T,E[1]*T];var C=c.parent.parent,x=c.getAttribute("translate"),_I32=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),C,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},E,x),_d29=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d29,n,s,!1),_I32.appendChild(_d29);var v=_I32.parent;v.render();var p=_I32.renderer.canvasRenderer,S=p.context;if(!S)return;var A=p.options.displayRatio,R=_d29.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:C.width,h:C.height};if(Zi(D,U)===Tr.outside){Lr(_d29,v),C.removeChild(v),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,C.width)-W.x,W.h=Math.min(D.y+D.h,C.height)-W.y;var Y=this.getGroupRect(W,A),B=Y.x,N=Y.y,G=Y.w,J=Y.h;var tt=S.getImageData(B,N,G,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d29,v),C.removeChild(v),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_I32.worldScaling});ut&&r.append(ut),Lr(_d29,v),C.removeChild(v),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(E,C){return C%2?E-r[1]:E-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var E=_ref164.detail;var C=E.context;n?C.blendFuncSeparate(C.ZERO,C.ZERO,C.ZERO,C.ZERO):C.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var E=_ref165.detail;var C=E.context;n?C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA):C.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Yu(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this61=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?iE(r,c,e):(c.remove(),_pr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_pr(l,(f=_this61.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_pr(l,_this61.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_pr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,E=r.thickness;var C;var x=c&&fr(c)||n.get(t.name);if(!x)return;er(l)&&(t.setAttribute("zIndex",l),x.opt.zIndex=l);var I=t.parent;if(I){if(m&&y&&c){var v=[x.op[0],x.op[1]];Ll(x.op,u,y,f);var p=[x.op[0],x.op[1]],S=[p[0]-v[0],p[1]-v[1]];if(x.centerPos=[x.centerPos[0]+S[0],x.centerPos[1]+S[1]],x.opt.translate=void 0,x.opt.scale=void 0,x.opt.eraserlines)for(var A=0;A<x.opt.eraserlines.length;A++){var _x$opt$eraserlines$A=x.opt.eraserlines[A],R=_x$opt$eraserlines$A.op,D=_x$opt$eraserlines$A.thickness;x.opt.eraserlines[A].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Rl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),x.opt.translate=f,c){var _v6=[f[0]*I.worldScaling[0],f[1]*I.worldScaling[1]];C=Vi(x.rect,_v6),x.rect=C;}else{var _v7=Mr.getRectFromLayer(I,t.name);x.rect=_v7||x.rect;}}else if(er(h))if(t.setAttribute("rotate",h),x.opt.rotate=h,c)C=kh(x.rect,h),x.rect=C;else{var _v8=Mr.getRectFromLayer(I,t.name);x.rect=_v8||x.rect;}if(T){var _v9=T.get(t.name);if(_v9)for(var _p10=0,_S10=0;_p10<x.op.length;_p10+=3,_S10++)x.op[_p10]=_v9[_S10][0],x.op[_p10+1]=_v9[_S10][1];}if(E&&(d=x==null?void 0:x.opt)!=null&&d.thickness&&(x.opt.thickness=E),s&&!(m&&y&&c)){if(f){var _v10=x.op.map(function(p,S){var A=S%3;return A===0?p+f[0]:A===1?p+f[1]:p;});if(x.op=_v10,x.centerPos=[x.centerPos[0]+f[0],x.centerPos[1]+f[1]],x!=null&&x.opt&&(x.opt.translate=void 0),x.opt.eraserlines)for(var _p11=0;_p11<x.opt.eraserlines.length;_p11++){var _S11=x.opt.eraserlines[_p11].op;for(var _A7=0;_A7<_S11.length;_A7++){var _R3=_S11[_A7].map(function(D,U){return U%2?D+f[1]:D+f[0];});x.opt.eraserlines[_p11].op[_A7]=_R3;}}}else if(er(h)){var _v11=x.op;if(JA(_v11,x.centerPos,h),x.op=_v11,x!=null&&x.opt&&(x.opt.rotate=void 0),x.opt.eraserlines)for(var _p12=0;_p12<x.opt.eraserlines.length;_p12++){var _S12=x.opt.eraserlines[_p12].op;for(var _A8=0;_A8<_S12.length;_A8++)QA(_S12[_A8],x.centerPos,h);}}}x&&n.setInfo(t.name,x);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===Tt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===Tt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&s.type===cl.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var $t=Mr;var Tl=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Cl={exports:{}};Cl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
400
400
|
compressToUint8Array:function compressToUint8Array(f){for(var h=l.compress(f),m=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);m[u*2]=T>>>8,m[u*2+1]=T%256;}return m;},//decompress from uint8array (UCS-2 big endian format)
|
|
401
401
|
decompressFromUint8Array:function decompressFromUint8Array(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),m=0,u=h.length;m<u;m++)h[m]=f[m*2]*256+f[m*2+1];var y=[];return h.forEach(function(T){y.push(t(T));}),l.decompress(y.join(""));},//compress into a string that is already URI encoded
|
|
402
402
|
compressToEncodedURIComponent:function compressToEncodedURIComponent(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h);});},//decompress from an output of compressToEncodedURIComponent
|
|
403
|
-
decompressFromEncodedURIComponent:function decompressFromEncodedURIComponent(f){return f==null?"":f==""?null:(f=f.replace(/ /g,"+"),l._decompress(f.length,32,function(h){return c(n,f.charAt(h));}));},compress:function compress(f){return l._compress(f,16,function(h){return t(h);});},_compress:function _compress(f,h,m){if(f==null)return"";var u,y,T={},E={},C="",x="",I="",d=2,v=3,p=2,S=[],A=0,R=0,D;for(D=0;D<f.length;D+=1)if(C=f.charAt(D),Object.prototype.hasOwnProperty.call(T,C)||(T[C]=v++,E[C]=!0),x=I+C,Object.prototype.hasOwnProperty.call(T,x))I=x;else{if(Object.prototype.hasOwnProperty.call(E,I)){if(I.charCodeAt(0)<256){for(u=0;u<p;u++)A=A<<1,R==h-1?(R=0,S.push(m(A)),A=0):R++;for(y=I.charCodeAt(0),u=0;u<8;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;}else{for(y=1,u=0;u<p;u++)A=A<<1|y,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=0;for(y=I.charCodeAt(0),u=0;u<16;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;}d--,d==0&&(d=Math.pow(2,p),p++),delete E[I];}else for(y=T[I],u=0;u<p;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;d--,d==0&&(d=Math.pow(2,p),p++),T[x]=v++,I=String(C);}if(I!==""){if(Object.prototype.hasOwnProperty.call(E,I)){if(I.charCodeAt(0)<256){for(u=0;u<p;u++)A=A<<1,R==h-1?(R=0,S.push(m(A)),A=0):R++;for(y=I.charCodeAt(0),u=0;u<8;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;}else{for(y=1,u=0;u<p;u++)A=A<<1|y,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=0;for(y=I.charCodeAt(0),u=0;u<16;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;}d--,d==0&&(d=Math.pow(2,p),p++),delete E[I];}else for(y=T[I],u=0;u<p;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;d--,d==0&&(d=Math.pow(2,p),p++);}for(y=2,u=0;u<p;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;for(;;)if(A=A<<1,R==h-1){S.push(m(A));break;}else R++;return S.join("");},decompress:function decompress(f){return f==null?"":f==""?null:l._decompress(f.length,32768,function(h){return f.charCodeAt(h);});},_decompress:function _decompress(f,h,m){var u=[],y=4,T=4,E=3,C="",x=[],I,d,v,p,S,A,R,D={val:m(0),position:h,index:1};for(I=0;I<3;I+=1)u[I]=I;for(v=0,S=Math.pow(2,2),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;switch(v){case 0:for(v=0,S=Math.pow(2,8),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;R=t(v);break;case 1:for(v=0,S=Math.pow(2,16),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;R=t(v);break;case 2:return"";}for(u[3]=R,d=R,x.push(R);;){if(D.index>f)return"";for(v=0,S=Math.pow(2,E),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;switch(R=v){case 0:for(v=0,S=Math.pow(2,8),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;u[T++]=t(v),R=T-1,y--;break;case 1:for(v=0,S=Math.pow(2,16),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;u[T++]=t(v),R=T-1,y--;break;case 2:return x.join("");}if(y==0&&(y=Math.pow(2,E),E++),u[R])C=u[R];else if(R===T)C=d+d.charAt(0);else return null;x.push(C),u[T++]=d+C.charAt(0),y--,d=C,y==0&&(y=Math.pow(2,E),E++);}}};return l;}();i!=null?i.exports=e:(typeof angular==="undefined"?"undefined":_typeof(angular))<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e;});})(Cl);var gh=Cl.exports;function yi(i){return JSON.parse(gh.decompress(i));}function gr(i){return gh.compress(JSON.stringify(i));}var mh={exports:{}};(function(i){(function(){var e={};e.version="6.4.2.2",e.use_lines=!0,e.use_xyz=!1;var t=!1;i.exports?(i.exports=e,t=!0):(typeof document==="undefined"?"undefined":_typeof(document))<"u"?window.ClipperLib=e:self.ClipperLib=e;var r;if(t){var n="chrome";r="Netscape";}else{var n=navigator.userAgent.toString().toLowerCase();r=navigator.appName;}var s={};n.indexOf("chrome")!=-1&&n.indexOf("chromium")==-1?s.chrome=1:s.chrome=0,n.indexOf("chromium")!=-1?s.chromium=1:s.chromium=0,n.indexOf("safari")!=-1&&n.indexOf("chrome")==-1&&n.indexOf("chromium")==-1?s.safari=1:s.safari=0,n.indexOf("firefox")!=-1?s.firefox=1:s.firefox=0,n.indexOf("firefox/17")!=-1?s.firefox17=1:s.firefox17=0,n.indexOf("firefox/15")!=-1?s.firefox15=1:s.firefox15=0,n.indexOf("firefox/3")!=-1?s.firefox3=1:s.firefox3=0,n.indexOf("opera")!=-1?s.opera=1:s.opera=0,n.indexOf("msie 10")!=-1?s.msie10=1:s.msie10=0,n.indexOf("msie 9")!=-1?s.msie9=1:s.msie9=0,n.indexOf("msie 8")!=-1?s.msie8=1:s.msie8=0,n.indexOf("msie 7")!=-1?s.msie7=1:s.msie7=0,n.indexOf("msie ")!=-1?s.msie=1:s.msie=0,e.biginteger_used=null;var c;function l(a,P,w){e.biginteger_used=1,a!=null&&(typeof a=="number"&&_typeof(P)>"u"?this.fromInt(a):typeof a=="number"?this.fromNumber(a,P,w):P==null&&typeof a!="string"?this.fromString(a,256):this.fromString(a,P));}function f(){return new l(null,void 0,void 0);}function h(a,P,w,F,H,_){for(;--_>=0;){var st=P*this[a++]+w[F]+H;H=Math.floor(st/67108864),w[F++]=st&67108863;}return H;}function m(a,P,w,F,H,_){for(var st=P&32767,yt=P>>15;--_>=0;){var Pt=this[a]&32767,Bt=this[a++]>>15,kt=yt*Pt+Bt*st;Pt=st*Pt+((kt&32767)<<15)+w[F]+(H&1073741823),H=(Pt>>>30)+(kt>>>15)+yt*Bt+(H>>>30),w[F++]=Pt&1073741823;}return H;}function u(a,P,w,F,H,_){for(var st=P&16383,yt=P>>14;--_>=0;){var Pt=this[a]&16383,Bt=this[a++]>>14,kt=yt*Pt+Bt*st;Pt=st*Pt+((kt&16383)<<14)+w[F]+H,H=(Pt>>28)+(kt>>14)+yt*Bt,w[F++]=Pt&268435455;}return H;}r=="Microsoft Internet Explorer"?(l.prototype.am=m,c=30):r!="Netscape"?(l.prototype.am=h,c=26):(l.prototype.am=u,c=28),l.prototype.DB=c,l.prototype.DM=(1<<c)-1,l.prototype.DV=1<<c;var y=52;l.prototype.FV=Math.pow(2,y),l.prototype.F1=y-c,l.prototype.F2=2*c-y;var T="0123456789abcdefghijklmnopqrstuvwxyz",E=new Array(),C,x;for(C=48,x=0;x<=9;++x)E[C++]=x;for(C=97,x=10;x<36;++x)E[C++]=x;for(C=65,x=10;x<36;++x)E[C++]=x;function I(a){return T.charAt(a);}function d(a,P){var w=E[a.charCodeAt(P)];return w!==null&&w!==void 0?w:-1;}function v(a){for(var P=this.t-1;P>=0;--P)a[P]=this[P];a.t=this.t,a.s=this.s;}function p(a){this.t=1,this.s=a<0?-1:0,a>0?this[0]=a:a<-1?this[0]=a+this.DV:this.t=0;}function S(a){var P=f();return P.fromInt(a),P;}function A(a,P){var w;if(P==16)w=4;else if(P==8)w=3;else if(P==256)w=8;else if(P==2)w=1;else if(P==32)w=5;else if(P==4)w=2;else{this.fromRadix(a,P);return;}this.t=0,this.s=0;for(var F=a.length,H=!1,_=0;--F>=0;){var st=w==8?a[F]&255:d(a,F);if(st<0){a.charAt(F)=="-"&&(H=!0);continue;}H=!1,_==0?this[this.t++]=st:_+w>this.DB?(this[this.t-1]|=(st&(1<<this.DB-_)-1)<<_,this[this.t++]=st>>this.DB-_):this[this.t-1]|=st<<_,_+=w,_>=this.DB&&(_-=this.DB);}w==8&&a[0]&128&&(this.s=-1,_>0&&(this[this.t-1]|=(1<<this.DB-_)-1<<_)),this.clamp(),H&&l.ZERO.subTo(this,this);}function R(){for(var a=this.s&this.DM;this.t>0&&this[this.t-1]==a;)--this.t;}function D(a){if(this.s<0)return"-"+this.negate().toString(a);var P;if(a==16)P=4;else if(a==8)P=3;else if(a==2)P=1;else if(a==32)P=5;else if(a==4)P=2;else return this.toRadix(a);var w=(1<<P)-1,F,H=!1,_="",st=this.t,yt=this.DB-st*this.DB%P;if(st-->0)for(yt<this.DB&&(F=this[st]>>yt)>0&&(H=!0,_=I(F));st>=0;)yt<P?(F=(this[st]&(1<<yt)-1)<<P-yt,F|=this[--st]>>(yt+=this.DB-P)):(F=this[st]>>(yt-=P)&w,yt<=0&&(yt+=this.DB,--st)),F>0&&(H=!0),H&&(_+=I(F));return H?_:"0";}function U(){var a=f();return l.ZERO.subTo(this,a),a;}function M(){return this.s<0?this.negate():this;}function W(a){var P=this.s-a.s;if(P!=0)return P;var w=this.t;if(P=w-a.t,P!=0)return this.s<0?-P:P;for(;--w>=0;)if((P=this[w]-a[w])!=0)return P;return 0;}function Y(a){var P=1,w;return(w=a>>>16)!=0&&(a=w,P+=16),(w=a>>8)!=0&&(a=w,P+=8),(w=a>>4)!=0&&(a=w,P+=4),(w=a>>2)!=0&&(a=w,P+=2),(w=a>>1)!=0&&(a=w,P+=1),P;}function B(){return this.t<=0?0:this.DB*(this.t-1)+Y(this[this.t-1]^this.s&this.DM);}function N(a,P){var w;for(w=this.t-1;w>=0;--w)P[w+a]=this[w];for(w=a-1;w>=0;--w)P[w]=0;P.t=this.t+a,P.s=this.s;}function G(a,P){for(var w=a;w<this.t;++w)P[w-a]=this[w];P.t=Math.max(this.t-a,0),P.s=this.s;}function J(a,P){var w=a%this.DB,F=this.DB-w,H=(1<<F)-1,_=Math.floor(a/this.DB),st=this.s<<w&this.DM,yt;for(yt=this.t-1;yt>=0;--yt)P[yt+_+1]=this[yt]>>F|st,st=(this[yt]&H)<<w;for(yt=_-1;yt>=0;--yt)P[yt]=0;P[_]=st,P.t=this.t+_+1,P.s=this.s,P.clamp();}function tt(a,P){P.s=this.s;var w=Math.floor(a/this.DB);if(w>=this.t){P.t=0;return;}var F=a%this.DB,H=this.DB-F,_=(1<<F)-1;P[0]=this[w]>>F;for(var st=w+1;st<this.t;++st)P[st-w-1]|=(this[st]&_)<<H,P[st-w]=this[st]>>F;F>0&&(P[this.t-w-1]|=(this.s&_)<<H),P.t=this.t-w,P.clamp();}function at(a,P){for(var w=0,F=0,H=Math.min(a.t,this.t);w<H;)F+=this[w]-a[w],P[w++]=F&this.DM,F>>=this.DB;if(a.t<this.t){for(F-=a.s;w<this.t;)F+=this[w],P[w++]=F&this.DM,F>>=this.DB;F+=this.s;}else{for(F+=this.s;w<a.t;)F-=a[w],P[w++]=F&this.DM,F>>=this.DB;F-=a.s;}P.s=F<0?-1:0,F<-1?P[w++]=this.DV+F:F>0&&(P[w++]=F),P.t=w,P.clamp();}function ut(a,P){var w=this.abs(),F=a.abs(),H=w.t;for(P.t=H+F.t;--H>=0;)P[H]=0;for(H=0;H<F.t;++H)P[H+w.t]=w.am(0,F[H],P,H,0,w.t);P.s=0,P.clamp(),this.s!=a.s&&l.ZERO.subTo(P,P);}function K(a){for(var P=this.abs(),w=a.t=2*P.t;--w>=0;)a[w]=0;for(w=0;w<P.t-1;++w){var F=P.am(w,P[w],a,2*w,0,1);(a[w+P.t]+=P.am(w+1,2*P[w],a,2*w+1,F,P.t-w-1))>=P.DV&&(a[w+P.t]-=P.DV,a[w+P.t+1]=1);}a.t>0&&(a[a.t-1]+=P.am(w,P[w],a,2*w,0,1)),a.s=0,a.clamp();}function Q(a,P,w){var F=a.abs();if(!(F.t<=0)){var H=this.abs();if(H.t<F.t){P!=null&&P.fromInt(0),w!=null&&this.copyTo(w);return;}w==null&&(w=f());var _=f(),st=this.s,yt=a.s,Pt=this.DB-Y(F[F.t-1]);Pt>0?(F.lShiftTo(Pt,_),H.lShiftTo(Pt,w)):(F.copyTo(_),H.copyTo(w));var Bt=_.t,kt=_[Bt-1];if(kt!=0){var jt=kt*(1<<this.F1)+(Bt>1?_[Bt-2]>>this.F2:0),qt=this.FV/jt,oe=(1<<this.F1)/jt,me=1<<this.F2,Pe=w.t,De=Pe-Bt,or=P!==null&&P!==void 0?P:f();for(_.dlShiftTo(De,or),w.compareTo(or)>=0&&(w[w.t++]=1,w.subTo(or,w)),l.ONE.dlShiftTo(Bt,or),or.subTo(_,_);_.t<Bt;)_[_.t++]=0;for(;--De>=0;){var Rr=w[--Pe]==kt?this.DM:Math.floor(w[Pe]*qt+(w[Pe-1]+me)*oe);if((w[Pe]+=_.am(0,Rr,w,De,0,Bt))<Rr)for(_.dlShiftTo(De,or),w.subTo(or,w);w[Pe]<--Rr;)w.subTo(or,w);}P!=null&&(w.drShiftTo(Bt,P),st!=yt&&l.ZERO.subTo(P,P)),w.t=Bt,w.clamp(),Pt>0&&w.rShiftTo(Pt,w),st<0&&l.ZERO.subTo(w,w);}}}function ft(a){var P=f();return this.abs().divRemTo(a,null,P),this.s<0&&P.compareTo(l.ZERO)>0&&a.subTo(P,P),P;}function gt(a){this.m=a;}function mt(a){return a.s<0||a.compareTo(this.m)>=0?a.mod(this.m):a;}function wt(a){return a;}function ht(a){a.divRemTo(this.m,null,a);}function Nt(a,P,w){a.multiplyTo(P,w),this.reduce(w);}function Rt(a,P){a.squareTo(P),this.reduce(P);}gt.prototype.convert=mt,gt.prototype.revert=wt,gt.prototype.reduce=ht,gt.prototype.mulTo=Nt,gt.prototype.sqrTo=Rt;function X(){if(this.t<1)return 0;var a=this[0];if(!(a&1))return 0;var P=a&3;return P=P*(2-(a&15)*P)&15,P=P*(2-(a&255)*P)&255,P=P*(2-((a&65535)*P&65535))&65535,P=P*(2-a*P%this.DV)%this.DV,P>0?this.DV-P:-P;}function z(a){this.m=a,this.mp=a.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<a.DB-15)-1,this.mt2=2*a.t;}function q(a){var P=f();return a.abs().dlShiftTo(this.m.t,P),P.divRemTo(this.m,null,P),a.s<0&&P.compareTo(l.ZERO)>0&&this.m.subTo(P,P),P;}function nt(a){var P=f();return a.copyTo(P),this.reduce(P),P;}function j(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var P=0;P<this.m.t;++P){var w=a[P]&32767,F=w*this.mpl+((w*this.mph+(a[P]>>15)*this.mpl&this.um)<<15)&a.DM;for(w=P+this.m.t,a[w]+=this.m.am(0,F,a,P,0,this.m.t);a[w]>=a.DV;)a[w]-=a.DV,a[++w]++;}a.clamp(),a.drShiftTo(this.m.t,a),a.compareTo(this.m)>=0&&a.subTo(this.m,a);}function Z(a,P){a.squareTo(P),this.reduce(P);}function O(a,P,w){a.multiplyTo(P,w),this.reduce(w);}z.prototype.convert=q,z.prototype.revert=nt,z.prototype.reduce=j,z.prototype.mulTo=O,z.prototype.sqrTo=Z;function L(){return(this.t>0?this[0]&1:this.s)==0;}function $(a,P){if(a>4294967295||a<1)return l.ONE;var w=f(),F=f(),H=P.convert(this),_=Y(a)-1;for(H.copyTo(w);--_>=0;)if(P.sqrTo(w,F),(a&1<<_)>0)P.mulTo(F,H,w);else{var st=w;w=F,F=st;}return P.revert(w);}function V(a,P){var w;return a<256||P.isEven()?w=new gt(P):w=new z(P),this.exp(a,w);}l.prototype.copyTo=v,l.prototype.fromInt=p,l.prototype.fromString=A,l.prototype.clamp=R,l.prototype.dlShiftTo=N,l.prototype.drShiftTo=G,l.prototype.lShiftTo=J,l.prototype.rShiftTo=tt,l.prototype.subTo=at,l.prototype.multiplyTo=ut,l.prototype.squareTo=K,l.prototype.divRemTo=Q,l.prototype.invDigit=X,l.prototype.isEven=L,l.prototype.exp=$,l.prototype.toString=D,l.prototype.negate=U,l.prototype.abs=M,l.prototype.compareTo=W,l.prototype.bitLength=B,l.prototype.mod=ft,l.prototype.modPowInt=V,l.ZERO=S(0),l.ONE=S(1);function rt(){var a=f();return this.copyTo(a),a;}function it(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1;}else{if(this.t==1)return this[0];if(this.t==0)return 0;}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0];}function ct(){return this.t==0?this.s:this[0]<<24>>24;}function St(){return this.t==0?this.s:this[0]<<16>>16;}function Ct(a){return Math.floor(Math.LN2*this.DB/Math.log(a));}function Mt(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1;}function Dt(a){if(a==null&&(a=10),this.signum()==0||a<2||a>36)return"0";var P=this.chunkSize(a),w=Math.pow(a,P),F=S(w),H=f(),_=f(),st="";for(this.divRemTo(F,H,_);H.signum()>0;)st=(w+_.intValue()).toString(a).substr(1)+st,H.divRemTo(F,H,_);return _.intValue().toString(a)+st;}function At(a,P){this.fromInt(0),P==null&&(P=10);for(var w=this.chunkSize(P),F=Math.pow(P,w),H=!1,_=0,st=0,yt=0;yt<a.length;++yt){var Pt=d(a,yt);if(Pt<0){a.charAt(yt)=="-"&&this.signum()==0&&(H=!0);continue;}st=P*st+Pt,++_>=w&&(this.dMultiply(F),this.dAddOffset(st,0),_=0,st=0);}_>0&&(this.dMultiply(Math.pow(P,_)),this.dAddOffset(st,0)),H&&l.ZERO.subTo(this,this);}function Ot(a,P,w){if(typeof P=="number"){if(a<2)this.fromInt(1);else for(this.fromNumber(a,w),this.testBit(a-1)||this.bitwiseTo(l.ONE.shiftLeft(a-1),ne,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(P);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(l.ONE.shiftLeft(a-1),this);}else{var F=new Array(),H=a&7;F.length=(a>>3)+1,P.nextBytes(F),H>0?F[0]&=(1<<H)-1:F[0]=0,this.fromString(F,256);}}function Lt(){var a=this.t,P=new Array();P[0]=this.s;var w=this.DB-a*this.DB%8,F,H=0;if(a-->0)for(w<this.DB&&(F=this[a]>>w)!=(this.s&this.DM)>>w&&(P[H++]=F|this.s<<this.DB-w);a>=0;)w<8?(F=(this[a]&(1<<w)-1)<<8-w,F|=this[--a]>>(w+=this.DB-8)):(F=this[a]>>(w-=8)&255,w<=0&&(w+=this.DB,--a)),F&128&&(F|=-256),H==0&&(this.s&128)!=(F&128)&&++H,(H>0||F!=this.s)&&(P[H++]=F);return P;}function Yt(a){return this.compareTo(a)==0;}function zt(a){return this.compareTo(a)<0?this:a;}function Wt(a){return this.compareTo(a)>0?this:a;}function Qt(a,P,w){var F,H,_=Math.min(a.t,this.t);for(F=0;F<_;++F)w[F]=P(this[F],a[F]);if(a.t<this.t){for(H=a.s&this.DM,F=_;F<this.t;++F)w[F]=P(this[F],H);w.t=this.t;}else{for(H=this.s&this.DM,F=_;F<a.t;++F)w[F]=P(H,a[F]);w.t=a.t;}w.s=P(this.s,a.s),w.clamp();}function ue(a,P){return a&P;}function ie(a){var P=f();return this.bitwiseTo(a,ue,P),P;}function ne(a,P){return a|P;}function ae(a){var P=f();return this.bitwiseTo(a,ne,P),P;}function se(a,P){return a^P;}function je(a){var P=f();return this.bitwiseTo(a,se,P),P;}function We(a,P){return a&~P;}function Xe(a){var P=f();return this.bitwiseTo(a,We,P),P;}function Fe(){for(var a=f(),P=0;P<this.t;++P)a[P]=this.DM&~this[P];return a.t=this.t,a.s=~this.s,a;}function Ge(a){var P=f();return a<0?this.rShiftTo(-a,P):this.lShiftTo(a,P),P;}function Ke(a){var P=f();return a<0?this.lShiftTo(-a,P):this.rShiftTo(a,P),P;}function Je(a){if(a==0)return-1;var P=0;return a&65535||(a>>=16,P+=16),a&255||(a>>=8,P+=8),a&15||(a>>=4,P+=4),a&3||(a>>=2,P+=2),a&1||++P,P;}function Ie(){for(var a=0;a<this.t;++a)if(this[a]!=0)return a*this.DB+Je(this[a]);return this.s<0?this.t*this.DB:-1;}function cr(a){for(var P=0;a!=0;)a&=a-1,++P;return P;}function Kr(){for(var a=0,P=this.s&this.DM,w=0;w<this.t;++w)a+=cr(this[w]^P);return a;}function tn(a){var P=Math.floor(a/this.DB);return P>=this.t?this.s!=0:(this[P]&1<<a%this.DB)!=0;}function Gn(a,P){var w=l.ONE.shiftLeft(a);return this.bitwiseTo(w,P,w),w;}function Hn(a){return this.changeBit(a,ne);}function Oi(a){return this.changeBit(a,We);}function Co(a){return this.changeBit(a,se);}function wi(a,P){for(var w=0,F=0,H=Math.min(a.t,this.t);w<H;)F+=this[w]+a[w],P[w++]=F&this.DM,F>>=this.DB;if(a.t<this.t){for(F+=a.s;w<this.t;)F+=this[w],P[w++]=F&this.DM,F>>=this.DB;F+=this.s;}else{for(F+=this.s;w<a.t;)F+=a[w],P[w++]=F&this.DM,F>>=this.DB;F+=a.s;}P.s=F<0?-1:0,F>0?P[w++]=F:F<-1&&(P[w++]=this.DV+F),P.t=w,P.clamp();}function Io(a){var P=f();return this.addTo(a,P),P;}function Oo(a){var P=f();return this.subTo(a,P),P;}function wo(a){var P=f();return this.multiplyTo(a,P),P;}function Ao(){var a=f();return this.squareTo(a),a;}function Eo(a){var P=f();return this.divRemTo(a,P,null),P;}function Mo(a){var P=f();return this.divRemTo(a,null,P),P;}function Lo(a){var P=f(),w=f();return this.divRemTo(a,P,w),new Array(P,w);}function Ro(a){this[this.t]=this.am(0,a-1,this,0,0,this.t),++this.t,this.clamp();}function _i(a,P){if(a!=0){for(;this.t<=P;)this[this.t++]=0;for(this[P]+=a;this[P]>=this.DV;)this[P]-=this.DV,++P>=this.t&&(this[this.t++]=0),++this[P];}}function Rn(){}function ts(a){return a;}function bo(a,P,w){a.multiplyTo(P,w);}function Do(a,P){a.squareTo(P);}Rn.prototype.convert=ts,Rn.prototype.revert=ts,Rn.prototype.mulTo=bo,Rn.prototype.sqrTo=Do;function No(a){return this.exp(a,new Rn());}function Bo(a,P,w){var F=Math.min(this.t+a.t,P);for(w.s=0,w.t=F;F>0;)w[--F]=0;var H;for(H=w.t-this.t;F<H;++F)w[F+this.t]=this.am(0,a[F],w,F,0,this.t);for(H=Math.min(a.t,P);F<H;++F)this.am(0,a[F],w,F,0,P-F);w.clamp();}function kn(a,P,w){--P;var F=w.t=this.t+a.t-P;for(w.s=0;--F>=0;)w[F]=0;for(F=Math.max(P-this.t,0);F<a.t;++F)w[this.t+F-P]=this.am(P-F,a[F],w,0,0,this.t+F-P);w.clamp(),w.drShiftTo(1,w);}function vn(a){this.r2=f(),this.q3=f(),l.ONE.dlShiftTo(2*a.t,this.r2),this.mu=this.r2.divide(a),this.m=a;}function Kn(a){if(a.s<0||a.t>2*this.m.t)return a.mod(this.m);if(a.compareTo(this.m)<0)return a;var P=f();return a.copyTo(P),this.reduce(P),P;}function Wo(a){return a;}function Fo(a){for(a.drShiftTo(this.m.t-1,this.r2),a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);a.compareTo(this.r2)<0;)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);a.compareTo(this.m)>=0;)a.subTo(this.m,a);}function Uo(a,P){a.squareTo(P),this.reduce(P);}function es(a,P,w){a.multiplyTo(P,w),this.reduce(w);}vn.prototype.convert=Kn,vn.prototype.revert=Wo,vn.prototype.reduce=Fo,vn.prototype.mulTo=es,vn.prototype.sqrTo=Uo;function rs(a,P){var w=a.bitLength(),F,H=S(1),_;if(w<=0)return H;w<18?F=1:w<48?F=3:w<144?F=4:w<768?F=5:F=6,w<8?_=new gt(P):P.isEven()?_=new vn(P):_=new z(P);var st=new Array(),yt=3,Pt=F-1,Bt=(1<<F)-1;if(st[1]=_.convert(this),F>1){var kt=f();for(_.sqrTo(st[1],kt);yt<=Bt;)st[yt]=f(),_.mulTo(kt,st[yt-2],st[yt]),yt+=2;}var jt=a.t-1,qt,oe=!0,me=f(),Pe;for(w=Y(a[jt])-1;jt>=0;){for(w>=Pt?qt=a[jt]>>w-Pt&Bt:(qt=(a[jt]&(1<<w+1)-1)<<Pt-w,jt>0&&(qt|=a[jt-1]>>this.DB+w-Pt)),yt=F;!(qt&1);)qt>>=1,--yt;if((w-=yt)<0&&(w+=this.DB,--jt),oe)st[qt].copyTo(H),oe=!1;else{for(;yt>1;)_.sqrTo(H,me),_.sqrTo(me,H),yt-=2;yt>0?_.sqrTo(H,me):(Pe=H,H=me,me=Pe),_.mulTo(me,st[qt],H);}for(;jt>=0&&!(a[jt]&1<<w);)_.sqrTo(H,me),Pe=H,H=me,me=Pe,--w<0&&(w=this.DB-1,--jt);}return _.revert(H);}function ns(a){var P=this.s<0?this.negate():this.clone(),w=a.s<0?a.negate():a.clone();if(P.compareTo(w)<0){var F=P;P=w,w=F;}var H=P.getLowestSetBit(),_=w.getLowestSetBit();if(_<0)return P;for(H<_&&(_=H),_>0&&(P.rShiftTo(_,P),w.rShiftTo(_,w));P.signum()>0;)(H=P.getLowestSetBit())>0&&P.rShiftTo(H,P),(H=w.getLowestSetBit())>0&&w.rShiftTo(H,w),P.compareTo(w)>=0?(P.subTo(w,P),P.rShiftTo(1,P)):(w.subTo(P,w),w.rShiftTo(1,w));return _>0&&w.lShiftTo(_,w),w;}function Yo(a){if(a<=0)return 0;var P=this.DV%a,w=this.s<0?a-1:0;if(this.t>0)if(P==0)w=this[0]%a;else for(var F=this.t-1;F>=0;--F)w=(P*w+this[F])%a;return w;}function Xo(a){var P=a.isEven();if(this.isEven()&&P||a.signum()==0)return l.ZERO;for(var w=a.clone(),F=this.clone(),H=S(1),_=S(0),st=S(0),yt=S(1);w.signum()!=0;){for(;w.isEven();)w.rShiftTo(1,w),P?((!H.isEven()||!_.isEven())&&(H.addTo(this,H),_.subTo(a,_)),H.rShiftTo(1,H)):_.isEven()||_.subTo(a,_),_.rShiftTo(1,_);for(;F.isEven();)F.rShiftTo(1,F),P?((!st.isEven()||!yt.isEven())&&(st.addTo(this,st),yt.subTo(a,yt)),st.rShiftTo(1,st)):yt.isEven()||yt.subTo(a,yt),yt.rShiftTo(1,yt);w.compareTo(F)>=0?(w.subTo(F,w),P&&H.subTo(st,H),_.subTo(yt,_)):(F.subTo(w,F),P&&st.subTo(H,st),yt.subTo(_,yt));}if(F.compareTo(l.ONE)!=0)return l.ZERO;if(yt.compareTo(a)>=0)return yt.subtract(a);if(yt.signum()<0)yt.addTo(a,yt);else return yt;return yt.signum()<0?yt.add(a):yt;}var nr=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],zo=(1<<26)/nr[nr.length-1];function is(a){var P,w=this.abs();if(w.t==1&&w[0]<=nr[nr.length-1]){for(P=0;P<nr.length;++P)if(w[0]==nr[P])return!0;return!1;}if(w.isEven())return!1;for(P=1;P<nr.length;){for(var F=nr[P],H=P+1;H<nr.length&&F<zo;)F*=nr[H++];for(F=w.modInt(F);P<H;)if(F%nr[P++]==0)return!1;}return w.millerRabin(a);}function ss(a){var P=this.subtract(l.ONE),w=P.getLowestSetBit();if(w<=0)return!1;var F=P.shiftRight(w);a=a+1>>1,a>nr.length&&(a=nr.length);for(var H=f(),_=0;_<a;++_){H.fromInt(nr[Math.floor(Math.random()*nr.length)]);var st=H.modPow(F,this);if(st.compareTo(l.ONE)!=0&&st.compareTo(P)!=0){for(var yt=1;yt++<w&&st.compareTo(P)!=0;)if(st=st.modPowInt(2,this),st.compareTo(l.ONE)==0)return!1;if(st.compareTo(P)!=0)return!1;}}return!0;}l.prototype.chunkSize=Ct,l.prototype.toRadix=Dt,l.prototype.fromRadix=At,l.prototype.fromNumber=Ot,l.prototype.bitwiseTo=Qt,l.prototype.changeBit=Gn,l.prototype.addTo=wi,l.prototype.dMultiply=Ro,l.prototype.dAddOffset=_i,l.prototype.multiplyLowerTo=Bo,l.prototype.multiplyUpperTo=kn,l.prototype.modInt=Yo,l.prototype.millerRabin=ss,l.prototype.clone=rt,l.prototype.intValue=it,l.prototype.byteValue=ct,l.prototype.shortValue=St,l.prototype.signum=Mt,l.prototype.toByteArray=Lt,l.prototype.equals=Yt,l.prototype.min=zt,l.prototype.max=Wt,l.prototype.and=ie,l.prototype.or=ae,l.prototype.xor=je,l.prototype.andNot=Xe,l.prototype.not=Fe,l.prototype.shiftLeft=Ge,l.prototype.shiftRight=Ke,l.prototype.getLowestSetBit=Ie,l.prototype.bitCount=Kr,l.prototype.testBit=tn,l.prototype.setBit=Hn,l.prototype.clearBit=Oi,l.prototype.flipBit=Co,l.prototype.add=Io,l.prototype.subtract=Oo,l.prototype.multiply=wo,l.prototype.divide=Eo,l.prototype.remainder=Mo,l.prototype.divideAndRemainder=Lo,l.prototype.modPow=rs,l.prototype.modInverse=Xo,l.prototype.pow=No,l.prototype.gcd=ns,l.prototype.isProbablePrime=is,l.prototype.square=Ao;var ge=l;ge.prototype.IsNegative=function(){return this.compareTo(ge.ZERO)==-1;},ge.op_Equality=function(a,P){return a.compareTo(P)==0;},ge.op_Inequality=function(a,P){return a.compareTo(P)!=0;},ge.op_GreaterThan=function(a,P){return a.compareTo(P)>0;},ge.op_LessThan=function(a,P){return a.compareTo(P)<0;},ge.op_Addition=function(a,P){return new ge(a,void 0,void 0).add(new ge(P,void 0,void 0));},ge.op_Subtraction=function(a,P){return new ge(a,void 0,void 0).subtract(new ge(P,void 0,void 0));},ge.Int128Mul=function(a,P){return new ge(a,void 0,void 0).multiply(new ge(P,void 0,void 0));},ge.op_Division=function(a,P){return a.divide(P);},ge.prototype.ToDouble=function(){return parseFloat(this.toString());};var Vn=function Vn(a,P){var w;if(_typeof(Object.getOwnPropertyNames)>"u"){for(w in P.prototype)(_typeof(a.prototype[w])>"u"||a.prototype[w]===Object.prototype[w])&&(a.prototype[w]=P.prototype[w]);for(w in P)_typeof(a[w])>"u"&&(a[w]=P[w]);a.$baseCtor=P;}else{for(var F=Object.getOwnPropertyNames(P.prototype),H=0;H<F.length;H++)_typeof(Object.getOwnPropertyDescriptor(a.prototype,F[H]))>"u"&&Object.defineProperty(a.prototype,F[H],Object.getOwnPropertyDescriptor(P.prototype,F[H]));for(w in P)_typeof(a[w])>"u"&&(a[w]=P[w]);a.$baseCtor=P;}};e.Path=function(){return[];},e.Path.prototype.push=Array.prototype.push,e.Paths=function(){return[];},e.Paths.prototype.push=Array.prototype.push,e.DoublePoint=function(){var a=arguments;this.X=0,this.Y=0,a.length===1?(this.X=a[0].X,this.Y=a[0].Y):a.length===2&&(this.X=a[0],this.Y=a[1]);},e.DoublePoint0=function(){this.X=0,this.Y=0;},e.DoublePoint0.prototype=e.DoublePoint.prototype,e.DoublePoint1=function(a){this.X=a.X,this.Y=a.Y;},e.DoublePoint1.prototype=e.DoublePoint.prototype,e.DoublePoint2=function(a,P){this.X=a,this.Y=P;},e.DoublePoint2.prototype=e.DoublePoint.prototype,e.PolyNode=function(){this.m_Parent=null,this.m_polygon=new e.Path(),this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1;},e.PolyNode.prototype.IsHoleNode=function(){for(var a=!0,P=this.m_Parent;P!==null;)a=!a,P=P.m_Parent;return a;},e.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length;},e.PolyNode.prototype.Contour=function(){return this.m_polygon;},e.PolyNode.prototype.AddChild=function(a){var P=this.m_Childs.length;this.m_Childs.push(a),a.m_Parent=this,a.m_Index=P;},e.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp();},e.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1];},e.PolyNode.prototype.Childs=function(){return this.m_Childs;},e.PolyNode.prototype.Parent=function(){return this.m_Parent;},e.PolyNode.prototype.IsHole=function(){return this.IsHoleNode();},e.PolyTree=function(){this.m_AllPolys=[],e.PolyNode.call(this);},e.PolyTree.prototype.Clear=function(){for(var a=0,P=this.m_AllPolys.length;a<P;a++)this.m_AllPolys[a]=null;this.m_AllPolys.length=0,this.m_Childs.length=0;},e.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null;},e.PolyTree.prototype.Total=function(){var a=this.m_AllPolys.length;return a>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&a--,a;},Vn(e.PolyTree,e.PolyNode),e.Math_Abs_Int64=e.Math_Abs_Int32=e.Math_Abs_Double=function(a){return Math.abs(a);},e.Math_Max_Int32_Int32=function(a,P){return Math.max(a,P);},s.msie||s.opera||s.safari?e.Cast_Int32=function(a){return a|0;}:e.Cast_Int32=function(a){return~~a;},_typeof(Number.toInteger)>"u"&&(Number.toInteger=null),s.chrome?e.Cast_Int64=function(a){return a<-2147483648||a>2147483647?a<0?Math.ceil(a):Math.floor(a):~~a;}:s.firefox&&typeof Number.toInteger=="function"?e.Cast_Int64=function(a){return Number.toInteger(a);}:s.msie7||s.msie8?e.Cast_Int64=function(a){return parseInt(a,10);}:s.msie?e.Cast_Int64=function(a){return a<-2147483648||a>2147483647?a<0?Math.ceil(a):Math.floor(a):a|0;}:e.Cast_Int64=function(a){return a<0?Math.ceil(a):Math.floor(a);},e.Clear=function(a){a.length=0;},e.PI=3.141592653589793,e.PI2=2*3.141592653589793,e.IntPoint=function(){var a=arguments,P=a.length;if(this.X=0,this.Y=0,e.use_xyz){if(this.Z=0,P===3)this.X=a[0],this.Y=a[1],this.Z=a[2];else if(P===2)this.X=a[0],this.Y=a[1],this.Z=0;else if(P===1){if(a[0]instanceof e.DoublePoint){var w=a[0];this.X=e.Clipper.Round(w.X),this.Y=e.Clipper.Round(w.Y),this.Z=0;}else{var F=a[0];_typeof(F.Z)>"u"&&(F.Z=0),this.X=F.X,this.Y=F.Y,this.Z=F.Z;}}else this.X=0,this.Y=0,this.Z=0;}else if(P===2)this.X=a[0],this.Y=a[1];else if(P===1){if(a[0]instanceof e.DoublePoint){var w=a[0];this.X=e.Clipper.Round(w.X),this.Y=e.Clipper.Round(w.Y);}else{var F=a[0];this.X=F.X,this.Y=F.Y;}}else this.X=0,this.Y=0;},e.IntPoint.op_Equality=function(a,P){return a.X===P.X&&a.Y===P.Y;},e.IntPoint.op_Inequality=function(a,P){return a.X!==P.X||a.Y!==P.Y;},e.IntPoint0=function(){this.X=0,this.Y=0,e.use_xyz&&(this.Z=0);},e.IntPoint0.prototype=e.IntPoint.prototype,e.IntPoint1=function(a){this.X=a.X,this.Y=a.Y,e.use_xyz&&(_typeof(a.Z)>"u"?this.Z=0:this.Z=a.Z);},e.IntPoint1.prototype=e.IntPoint.prototype,e.IntPoint1dp=function(a){this.X=e.Clipper.Round(a.X),this.Y=e.Clipper.Round(a.Y),e.use_xyz&&(this.Z=0);},e.IntPoint1dp.prototype=e.IntPoint.prototype,e.IntPoint2=function(a,P,w){this.X=a,this.Y=P,e.use_xyz&&(_typeof(w)>"u"?this.Z=0:this.Z=w);},e.IntPoint2.prototype=e.IntPoint.prototype,e.IntRect=function(){var a=arguments,P=a.length;if(P===4)this.left=a[0],this.top=a[1],this.right=a[2],this.bottom=a[3];else if(P===1){var w=a[0];this.left=w.left,this.top=w.top,this.right=w.right,this.bottom=w.bottom;}else this.left=0,this.top=0,this.right=0,this.bottom=0;},e.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0;},e.IntRect0.prototype=e.IntRect.prototype,e.IntRect1=function(a){this.left=a.left,this.top=a.top,this.right=a.right,this.bottom=a.bottom;},e.IntRect1.prototype=e.IntRect.prototype,e.IntRect4=function(a,P,w,F){this.left=a,this.top=P,this.right=w,this.bottom=F;},e.IntRect4.prototype=e.IntRect.prototype,e.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},e.PolyType={ptSubject:0,ptClip:1},e.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},e.JoinType={jtSquare:0,jtRound:1,jtMiter:2},e.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},e.EdgeSide={esLeft:0,esRight:1},e.Direction={dRightToLeft:0,dLeftToRight:1},e.TEdge=function(){this.Bot=new e.IntPoint0(),this.Curr=new e.IntPoint0(),this.Top=new e.IntPoint0(),this.Delta=new e.IntPoint0(),this.Dx=0,this.PolyTyp=e.PolyType.ptSubject,this.Side=e.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null;},e.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new e.IntPoint0();},e.MyIntersectNodeSort=function(){},e.MyIntersectNodeSort.Compare=function(a,P){var w=P.Pt.Y-a.Pt.Y;return w>0?1:w<0?-1:0;},e.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null;},e.Scanbeam=function(){this.Y=0,this.Next=null;},e.Maxima=function(){this.X=0,this.Next=null,this.Prev=null;},e.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null;},e.OutPt=function(){this.Idx=0,this.Pt=new e.IntPoint0(),this.Next=null,this.Prev=null;},e.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new e.IntPoint0();},e.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array(),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null;},e.ClipperBase.horizontal=-9007199254740992,e.ClipperBase.Skip=-2,e.ClipperBase.Unassigned=-1,e.ClipperBase.tolerance=1e-20,e.ClipperBase.loRange=47453132,e.ClipperBase.hiRange=4503599627370495,e.ClipperBase.near_zero=function(a){return a>-e.ClipperBase.tolerance&&a<e.ClipperBase.tolerance;},e.ClipperBase.IsHorizontal=function(a){return a.Delta.Y===0;},e.ClipperBase.prototype.PointIsVertex=function(a,P){var w=P;do{if(e.IntPoint.op_Equality(w.Pt,a))return!0;w=w.Next;}while(w!==P);return!1;},e.ClipperBase.prototype.PointOnLineSegment=function(a,P,w,F){return F?a.X===P.X&&a.Y===P.Y||a.X===w.X&&a.Y===w.Y||a.X>P.X==a.X<w.X&&a.Y>P.Y==a.Y<w.Y&&ge.op_Equality(ge.Int128Mul(a.X-P.X,w.Y-P.Y),ge.Int128Mul(w.X-P.X,a.Y-P.Y)):a.X===P.X&&a.Y===P.Y||a.X===w.X&&a.Y===w.Y||a.X>P.X==a.X<w.X&&a.Y>P.Y==a.Y<w.Y&&(a.X-P.X)*(w.Y-P.Y)===(w.X-P.X)*(a.Y-P.Y);},e.ClipperBase.prototype.PointOnPolygon=function(a,P,w){for(var F=P;;){if(this.PointOnLineSegment(a,F.Pt,F.Next.Pt,w))return!0;if(F=F.Next,F===P)break;}return!1;},e.ClipperBase.prototype.SlopesEqual=e.ClipperBase.SlopesEqual=function(){var a=arguments,P=a.length,w,F,H,_,st,yt,Pt;return P===3?(w=a[0],F=a[1],Pt=a[2],Pt?ge.op_Equality(ge.Int128Mul(w.Delta.Y,F.Delta.X),ge.Int128Mul(w.Delta.X,F.Delta.Y)):e.Cast_Int64(w.Delta.Y*F.Delta.X)===e.Cast_Int64(w.Delta.X*F.Delta.Y)):P===4?(H=a[0],_=a[1],st=a[2],Pt=a[3],Pt?ge.op_Equality(ge.Int128Mul(H.Y-_.Y,_.X-st.X),ge.Int128Mul(H.X-_.X,_.Y-st.Y)):e.Cast_Int64((H.Y-_.Y)*(_.X-st.X))-e.Cast_Int64((H.X-_.X)*(_.Y-st.Y))===0):(H=a[0],_=a[1],st=a[2],yt=a[3],Pt=a[4],Pt?ge.op_Equality(ge.Int128Mul(H.Y-_.Y,st.X-yt.X),ge.Int128Mul(H.X-_.X,st.Y-yt.Y)):e.Cast_Int64((H.Y-_.Y)*(st.X-yt.X))-e.Cast_Int64((H.X-_.X)*(st.Y-yt.Y))===0);},e.ClipperBase.SlopesEqual3=function(a,P,w){return w?ge.op_Equality(ge.Int128Mul(a.Delta.Y,P.Delta.X),ge.Int128Mul(a.Delta.X,P.Delta.Y)):e.Cast_Int64(a.Delta.Y*P.Delta.X)===e.Cast_Int64(a.Delta.X*P.Delta.Y);},e.ClipperBase.SlopesEqual4=function(a,P,w,F){return F?ge.op_Equality(ge.Int128Mul(a.Y-P.Y,P.X-w.X),ge.Int128Mul(a.X-P.X,P.Y-w.Y)):e.Cast_Int64((a.Y-P.Y)*(P.X-w.X))-e.Cast_Int64((a.X-P.X)*(P.Y-w.Y))===0;},e.ClipperBase.SlopesEqual5=function(a,P,w,F,H){return H?ge.op_Equality(ge.Int128Mul(a.Y-P.Y,w.X-F.X),ge.Int128Mul(a.X-P.X,w.Y-F.Y)):e.Cast_Int64((a.Y-P.Y)*(w.X-F.X))-e.Cast_Int64((a.X-P.X)*(w.Y-F.Y))===0;},e.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var a=0,P=this.m_edges.length;a<P;++a){for(var w=0,F=this.m_edges[a].length;w<F;++w)this.m_edges[a][w]=null;e.Clear(this.m_edges[a]);}e.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1;},e.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var a=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=a;}this.m_CurrentLM=null;},e.ClipperBase.prototype.RangeTest=function(a,P){P.Value?(a.X>e.ClipperBase.hiRange||a.Y>e.ClipperBase.hiRange||-a.X>e.ClipperBase.hiRange||-a.Y>e.ClipperBase.hiRange)&&e.Error("Coordinate outside allowed range in RangeTest()."):(a.X>e.ClipperBase.loRange||a.Y>e.ClipperBase.loRange||-a.X>e.ClipperBase.loRange||-a.Y>e.ClipperBase.loRange)&&(P.Value=!0,this.RangeTest(a,P));},e.ClipperBase.prototype.InitEdge=function(a,P,w,F){a.Next=P,a.Prev=w,a.Curr.X=F.X,a.Curr.Y=F.Y,e.use_xyz&&(a.Curr.Z=F.Z),a.OutIdx=-1;},e.ClipperBase.prototype.InitEdge2=function(a,P){a.Curr.Y>=a.Next.Curr.Y?(a.Bot.X=a.Curr.X,a.Bot.Y=a.Curr.Y,e.use_xyz&&(a.Bot.Z=a.Curr.Z),a.Top.X=a.Next.Curr.X,a.Top.Y=a.Next.Curr.Y,e.use_xyz&&(a.Top.Z=a.Next.Curr.Z)):(a.Top.X=a.Curr.X,a.Top.Y=a.Curr.Y,e.use_xyz&&(a.Top.Z=a.Curr.Z),a.Bot.X=a.Next.Curr.X,a.Bot.Y=a.Next.Curr.Y,e.use_xyz&&(a.Bot.Z=a.Next.Curr.Z)),this.SetDx(a),a.PolyTyp=P;},e.ClipperBase.prototype.FindNextLocMin=function(a){for(var P;;){for(;e.IntPoint.op_Inequality(a.Bot,a.Prev.Bot)||e.IntPoint.op_Equality(a.Curr,a.Top);)a=a.Next;if(a.Dx!==e.ClipperBase.horizontal&&a.Prev.Dx!==e.ClipperBase.horizontal)break;for(;a.Prev.Dx===e.ClipperBase.horizontal;)a=a.Prev;for(P=a;a.Dx===e.ClipperBase.horizontal;)a=a.Next;if(a.Top.Y!==a.Prev.Bot.Y){P.Prev.Bot.X<a.Bot.X&&(a=P);break;}}return a;},e.ClipperBase.prototype.ProcessBound=function(a,P){var w,F=a,H;if(F.OutIdx===e.ClipperBase.Skip){if(a=F,P){for(;a.Top.Y===a.Next.Bot.Y;)a=a.Next;for(;a!==F&&a.Dx===e.ClipperBase.horizontal;)a=a.Prev;}else{for(;a.Top.Y===a.Prev.Bot.Y;)a=a.Prev;for(;a!==F&&a.Dx===e.ClipperBase.horizontal;)a=a.Next;}if(a===F)P?F=a.Next:F=a.Prev;else{P?a=F.Next:a=F.Prev;var _=new e.LocalMinima();_.Next=null,_.Y=a.Bot.Y,_.LeftBound=null,_.RightBound=a,a.WindDelta=0,F=this.ProcessBound(a,P),this.InsertLocalMinima(_);}return F;}if(a.Dx===e.ClipperBase.horizontal&&(P?w=a.Prev:w=a.Next,w.Dx===e.ClipperBase.horizontal?w.Bot.X!==a.Bot.X&&w.Top.X!==a.Bot.X&&this.ReverseHorizontal(a):w.Bot.X!==a.Bot.X&&this.ReverseHorizontal(a)),w=a,P){for(;F.Top.Y===F.Next.Bot.Y&&F.Next.OutIdx!==e.ClipperBase.Skip;)F=F.Next;if(F.Dx===e.ClipperBase.horizontal&&F.Next.OutIdx!==e.ClipperBase.Skip){for(H=F;H.Prev.Dx===e.ClipperBase.horizontal;)H=H.Prev;H.Prev.Top.X>F.Next.Top.X&&(F=H.Prev);}for(;a!==F;)a.NextInLML=a.Next,a.Dx===e.ClipperBase.horizontal&&a!==w&&a.Bot.X!==a.Prev.Top.X&&this.ReverseHorizontal(a),a=a.Next;a.Dx===e.ClipperBase.horizontal&&a!==w&&a.Bot.X!==a.Prev.Top.X&&this.ReverseHorizontal(a),F=F.Next;}else{for(;F.Top.Y===F.Prev.Bot.Y&&F.Prev.OutIdx!==e.ClipperBase.Skip;)F=F.Prev;if(F.Dx===e.ClipperBase.horizontal&&F.Prev.OutIdx!==e.ClipperBase.Skip){for(H=F;H.Next.Dx===e.ClipperBase.horizontal;)H=H.Next;(H.Next.Top.X===F.Prev.Top.X||H.Next.Top.X>F.Prev.Top.X)&&(F=H.Next);}for(;a!==F;)a.NextInLML=a.Prev,a.Dx===e.ClipperBase.horizontal&&a!==w&&a.Bot.X!==a.Next.Top.X&&this.ReverseHorizontal(a),a=a.Prev;a.Dx===e.ClipperBase.horizontal&&a!==w&&a.Bot.X!==a.Next.Top.X&&this.ReverseHorizontal(a),F=F.Prev;}return F;},e.ClipperBase.prototype.AddPath=function(a,P,w){e.use_lines?!w&&P===e.PolyType.ptClip&&e.Error("AddPath: Open paths must be subject."):w||e.Error("AddPath: Open paths have been disabled.");var F=a.length-1;if(w)for(;F>0&&e.IntPoint.op_Equality(a[F],a[0]);)--F;for(;F>0&&e.IntPoint.op_Equality(a[F],a[F-1]);)--F;if(w&&F<2||!w&&F<1)return!1;for(var H=new Array(),_=0;_<=F;_++)H.push(new e.TEdge());var st=!0;H[1].Curr.X=a[1].X,H[1].Curr.Y=a[1].Y,e.use_xyz&&(H[1].Curr.Z=a[1].Z);var yt={Value:this.m_UseFullRange};this.RangeTest(a[0],yt),this.m_UseFullRange=yt.Value,yt.Value=this.m_UseFullRange,this.RangeTest(a[F],yt),this.m_UseFullRange=yt.Value,this.InitEdge(H[0],H[1],H[F],a[0]),this.InitEdge(H[F],H[0],H[F-1],a[F]);for(var _=F-1;_>=1;--_)yt.Value=this.m_UseFullRange,this.RangeTest(a[_],yt),this.m_UseFullRange=yt.Value,this.InitEdge(H[_],H[_+1],H[_-1],a[_]);for(var Pt=H[0],Bt=Pt,kt=Pt;;){if(Bt.Curr===Bt.Next.Curr&&(w||Bt.Next!==Pt)){if(Bt===Bt.Next)break;Bt===Pt&&(Pt=Bt.Next),Bt=this.RemoveEdge(Bt),kt=Bt;continue;}if(Bt.Prev===Bt.Next)break;if(w&&e.ClipperBase.SlopesEqual4(Bt.Prev.Curr,Bt.Curr,Bt.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(Bt.Prev.Curr,Bt.Curr,Bt.Next.Curr))){Bt===Pt&&(Pt=Bt.Next),Bt=this.RemoveEdge(Bt),Bt=Bt.Prev,kt=Bt;continue;}if(Bt=Bt.Next,Bt===kt||!w&&Bt.Next===Pt)break;}if(!w&&Bt===Bt.Next||w&&Bt.Prev===Bt.Next)return!1;w||(this.m_HasOpenPaths=!0,Pt.Prev.OutIdx=e.ClipperBase.Skip),Bt=Pt;do this.InitEdge2(Bt,P),Bt=Bt.Next,st&&Bt.Curr.Y!==Pt.Curr.Y&&(st=!1);while(Bt!==Pt);if(st){if(w)return!1;Bt.Prev.OutIdx=e.ClipperBase.Skip;var jt=new e.LocalMinima();for(jt.Next=null,jt.Y=Bt.Bot.Y,jt.LeftBound=null,jt.RightBound=Bt,jt.RightBound.Side=e.EdgeSide.esRight,jt.RightBound.WindDelta=0;Bt.Bot.X!==Bt.Prev.Top.X&&this.ReverseHorizontal(Bt),Bt.Next.OutIdx!==e.ClipperBase.Skip;)Bt.NextInLML=Bt.Next,Bt=Bt.Next;return this.InsertLocalMinima(jt),this.m_edges.push(H),!0;}this.m_edges.push(H);var qt,oe=null;for(e.IntPoint.op_Equality(Bt.Prev.Bot,Bt.Prev.Top)&&(Bt=Bt.Next);Bt=this.FindNextLocMin(Bt),Bt!==oe;){oe===null&&(oe=Bt);var jt=new e.LocalMinima();jt.Next=null,jt.Y=Bt.Bot.Y,Bt.Dx<Bt.Prev.Dx?(jt.LeftBound=Bt.Prev,jt.RightBound=Bt,qt=!1):(jt.LeftBound=Bt,jt.RightBound=Bt.Prev,qt=!0),jt.LeftBound.Side=e.EdgeSide.esLeft,jt.RightBound.Side=e.EdgeSide.esRight,w?jt.LeftBound.Next===jt.RightBound?jt.LeftBound.WindDelta=-1:jt.LeftBound.WindDelta=1:jt.LeftBound.WindDelta=0,jt.RightBound.WindDelta=-jt.LeftBound.WindDelta,Bt=this.ProcessBound(jt.LeftBound,qt),Bt.OutIdx===e.ClipperBase.Skip&&(Bt=this.ProcessBound(Bt,qt));var me=this.ProcessBound(jt.RightBound,!qt);me.OutIdx===e.ClipperBase.Skip&&(me=this.ProcessBound(me,!qt)),jt.LeftBound.OutIdx===e.ClipperBase.Skip?jt.LeftBound=null:jt.RightBound.OutIdx===e.ClipperBase.Skip&&(jt.RightBound=null),this.InsertLocalMinima(jt),qt||(Bt=me);}return!0;},e.ClipperBase.prototype.AddPaths=function(a,P,w){for(var F=!1,H=0,_=a.length;H<_;++H)this.AddPath(a[H],P,w)&&(F=!0);return F;},e.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(a,P,w){return e.IntPoint.op_Equality(a,w)||e.IntPoint.op_Equality(a,P)||e.IntPoint.op_Equality(w,P)?!1:a.X!==w.X?P.X>a.X==P.X<w.X:P.Y>a.Y==P.Y<w.Y;},e.ClipperBase.prototype.RemoveEdge=function(a){a.Prev.Next=a.Next,a.Next.Prev=a.Prev;var P=a.Next;return a.Prev=null,P;},e.ClipperBase.prototype.SetDx=function(a){a.Delta.X=a.Top.X-a.Bot.X,a.Delta.Y=a.Top.Y-a.Bot.Y,a.Delta.Y===0?a.Dx=e.ClipperBase.horizontal:a.Dx=a.Delta.X/a.Delta.Y;},e.ClipperBase.prototype.InsertLocalMinima=function(a){if(this.m_MinimaList===null)this.m_MinimaList=a;else if(a.Y>=this.m_MinimaList.Y)a.Next=this.m_MinimaList,this.m_MinimaList=a;else{for(var P=this.m_MinimaList;P.Next!==null&&a.Y<P.Next.Y;)P=P.Next;a.Next=P.Next,P.Next=a;}},e.ClipperBase.prototype.PopLocalMinima=function(a,P){return P.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===a?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1;},e.ClipperBase.prototype.ReverseHorizontal=function(a){var P=a.Top.X;a.Top.X=a.Bot.X,a.Bot.X=P,e.use_xyz&&(P=a.Top.Z,a.Top.Z=a.Bot.Z,a.Bot.Z=P);},e.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var a=this.m_MinimaList;a!==null;){this.InsertScanbeam(a.Y);var P=a.LeftBound;P!==null&&(P.Curr.X=P.Bot.X,P.Curr.Y=P.Bot.Y,e.use_xyz&&(P.Curr.Z=P.Bot.Z),P.OutIdx=e.ClipperBase.Unassigned),P=a.RightBound,P!==null&&(P.Curr.X=P.Bot.X,P.Curr.Y=P.Bot.Y,e.use_xyz&&(P.Curr.Z=P.Bot.Z),P.OutIdx=e.ClipperBase.Unassigned),a=a.Next;}this.m_ActiveEdges=null;}},e.ClipperBase.prototype.InsertScanbeam=function(a){if(this.m_Scanbeam===null)this.m_Scanbeam=new e.Scanbeam(),this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=a;else if(a>this.m_Scanbeam.Y){var P=new e.Scanbeam();P.Y=a,P.Next=this.m_Scanbeam,this.m_Scanbeam=P;}else{for(var w=this.m_Scanbeam;w.Next!==null&&a<=w.Next.Y;)w=w.Next;if(a===w.Y)return;var F=new e.Scanbeam();F.Y=a,F.Next=w.Next,w.Next=F;}},e.ClipperBase.prototype.PopScanbeam=function(a){return this.m_Scanbeam===null?(a.v=0,!1):(a.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0);},e.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null;},e.ClipperBase.prototype.CreateOutRec=function(){var a=new e.OutRec();return a.Idx=e.ClipperBase.Unassigned,a.IsHole=!1,a.IsOpen=!1,a.FirstLeft=null,a.Pts=null,a.BottomPt=null,a.PolyNode=null,this.m_PolyOuts.push(a),a.Idx=this.m_PolyOuts.length-1,a;},e.ClipperBase.prototype.DisposeOutRec=function(a){var P=this.m_PolyOuts[a];P.Pts=null,P=null,this.m_PolyOuts[a]=null;},e.ClipperBase.prototype.UpdateEdgeIntoAEL=function(a){a.NextInLML===null&&e.Error("UpdateEdgeIntoAEL: invalid call");var P=a.PrevInAEL,w=a.NextInAEL;return a.NextInLML.OutIdx=a.OutIdx,P!==null?P.NextInAEL=a.NextInLML:this.m_ActiveEdges=a.NextInLML,w!==null&&(w.PrevInAEL=a.NextInLML),a.NextInLML.Side=a.Side,a.NextInLML.WindDelta=a.WindDelta,a.NextInLML.WindCnt=a.WindCnt,a.NextInLML.WindCnt2=a.WindCnt2,a=a.NextInLML,a.Curr.X=a.Bot.X,a.Curr.Y=a.Bot.Y,a.PrevInAEL=P,a.NextInAEL=w,e.ClipperBase.IsHorizontal(a)||this.InsertScanbeam(a.Top.Y),a;},e.ClipperBase.prototype.SwapPositionsInAEL=function(a,P){if(!(a.NextInAEL===a.PrevInAEL||P.NextInAEL===P.PrevInAEL)){if(a.NextInAEL===P){var w=P.NextInAEL;w!==null&&(w.PrevInAEL=a);var F=a.PrevInAEL;F!==null&&(F.NextInAEL=P),P.PrevInAEL=F,P.NextInAEL=a,a.PrevInAEL=P,a.NextInAEL=w;}else if(P.NextInAEL===a){var H=a.NextInAEL;H!==null&&(H.PrevInAEL=P);var _=P.PrevInAEL;_!==null&&(_.NextInAEL=a),a.PrevInAEL=_,a.NextInAEL=P,P.PrevInAEL=a,P.NextInAEL=H;}else{var st=a.NextInAEL,yt=a.PrevInAEL;a.NextInAEL=P.NextInAEL,a.NextInAEL!==null&&(a.NextInAEL.PrevInAEL=a),a.PrevInAEL=P.PrevInAEL,a.PrevInAEL!==null&&(a.PrevInAEL.NextInAEL=a),P.NextInAEL=st,P.NextInAEL!==null&&(P.NextInAEL.PrevInAEL=P),P.PrevInAEL=yt,P.PrevInAEL!==null&&(P.PrevInAEL.NextInAEL=P);}a.PrevInAEL===null?this.m_ActiveEdges=a:P.PrevInAEL===null&&(this.m_ActiveEdges=P);}},e.ClipperBase.prototype.DeleteFromAEL=function(a){var P=a.PrevInAEL,w=a.NextInAEL;P===null&&w===null&&a!==this.m_ActiveEdges||(P!==null?P.NextInAEL=w:this.m_ActiveEdges=w,w!==null&&(w.PrevInAEL=P),a.NextInAEL=null,a.PrevInAEL=null);},e.Clipper=function(a){_typeof(a)>"u"&&(a=0),this.m_PolyOuts=null,this.m_ClipType=e.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=e.PolyFillType.pftEvenOdd,this.m_SubjFillType=e.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,e.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array(),this.m_IntersectNodeComparer=e.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array(),this.m_Joins=new Array(),this.m_GhostJoins=new Array(),this.ReverseSolution=(1&a)!==0,this.StrictlySimple=(2&a)!==0,this.PreserveCollinear=(4&a)!==0,e.use_xyz&&(this.ZFillFunction=null);},e.Clipper.ioReverseSolution=1,e.Clipper.ioStrictlySimple=2,e.Clipper.ioPreserveCollinear=4,e.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),e.ClipperBase.prototype.Clear.call(this));},e.Clipper.prototype.InsertMaxima=function(a){var P=new e.Maxima();if(P.X=a,this.m_Maxima===null)this.m_Maxima=P,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(a<this.m_Maxima.X)P.Next=this.m_Maxima,P.Prev=null,this.m_Maxima=P;else{for(var w=this.m_Maxima;w.Next!==null&&a>=w.Next.X;)w=w.Next;if(a===w.X)return;P.Next=w.Next,P.Prev=w,w.Next!==null&&(w.Next.Prev=P),w.Next=P;}},e.Clipper.prototype.Execute=function(){var a=arguments,P=a.length,w=a[1]instanceof e.PolyTree;if(P===4&&!w){var F=a[0],H=a[1],_=a[2],st=a[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&e.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,e.Clear(H),this.m_SubjFillType=_,this.m_ClipFillType=st,this.m_ClipType=F,this.m_UsingPolyTree=!1;try{var yt=this.ExecuteInternal();yt&&this.BuildResult(H);}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1;}return yt;}else if(P===4&&w){var F=a[0],Pt=a[1],_=a[2],st=a[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=_,this.m_ClipFillType=st,this.m_ClipType=F,this.m_UsingPolyTree=!0;try{var yt=this.ExecuteInternal();yt&&this.BuildResult2(Pt);}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1;}return yt;}else if(P===2&&!w){var F=a[0],H=a[1];return this.Execute(F,H,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd);}else if(P===2&&w){var F=a[0],Pt=a[1];return this.Execute(F,Pt,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd);}},e.Clipper.prototype.FixHoleLinkage=function(a){if(!(a.FirstLeft===null||a.IsHole!==a.FirstLeft.IsHole&&a.FirstLeft.Pts!==null)){for(var P=a.FirstLeft;P!==null&&(P.IsHole===a.IsHole||P.Pts===null);)P=P.FirstLeft;a.FirstLeft=P;}},e.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var a={},P={};if(!this.PopScanbeam(a))return!1;for(this.InsertLocalMinimaIntoAEL(a.v);this.PopScanbeam(P)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(P.v))return!1;this.ProcessEdgesAtTopOfScanbeam(P.v),a.v=P.v,this.InsertLocalMinimaIntoAEL(a.v);}var w,F,H;for(F=0,H=this.m_PolyOuts.length;F<H;F++)w=this.m_PolyOuts[F],!(w.Pts===null||w.IsOpen)&&(w.IsHole^this.ReverseSolution)==this.Area$1(w)>0&&this.ReversePolyPtLinks(w.Pts);for(this.JoinCommonEdges(),F=0,H=this.m_PolyOuts.length;F<H;F++)w=this.m_PolyOuts[F],w.Pts!==null&&(w.IsOpen?this.FixupOutPolyline(w):this.FixupOutPolygon(w));return this.StrictlySimple&&this.DoSimplePolygons(),!0;}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0;}},e.Clipper.prototype.DisposeAllPolyPts=function(){for(var a=0,P=this.m_PolyOuts.length;a<P;++a)this.DisposeOutRec(a);e.Clear(this.m_PolyOuts);},e.Clipper.prototype.AddJoin=function(a,P,w){var F=new e.Join();F.OutPt1=a,F.OutPt2=P,F.OffPt.X=w.X,F.OffPt.Y=w.Y,e.use_xyz&&(F.OffPt.Z=w.Z),this.m_Joins.push(F);},e.Clipper.prototype.AddGhostJoin=function(a,P){var w=new e.Join();w.OutPt1=a,w.OffPt.X=P.X,w.OffPt.Y=P.Y,e.use_xyz&&(w.OffPt.Z=P.Z),this.m_GhostJoins.push(w);},e.Clipper.prototype.SetZ=function(a,P,w){if(this.ZFillFunction!==null){if(a.Z!==0||this.ZFillFunction===null)return;e.IntPoint.op_Equality(a,P.Bot)?a.Z=P.Bot.Z:e.IntPoint.op_Equality(a,P.Top)?a.Z=P.Top.Z:e.IntPoint.op_Equality(a,w.Bot)?a.Z=w.Bot.Z:e.IntPoint.op_Equality(a,w.Top)?a.Z=w.Top.Z:this.ZFillFunction(P.Bot,P.Top,w.Bot,w.Top,a);}},e.Clipper.prototype.InsertLocalMinimaIntoAEL=function(a){for(var P={},w,F;this.PopLocalMinima(a,P);){w=P.v.LeftBound,F=P.v.RightBound;var H=null;if(w===null?(this.InsertEdgeIntoAEL(F,null),this.SetWindingCount(F),this.IsContributing(F)&&(H=this.AddOutPt(F,F.Bot))):F===null?(this.InsertEdgeIntoAEL(w,null),this.SetWindingCount(w),this.IsContributing(w)&&(H=this.AddOutPt(w,w.Bot)),this.InsertScanbeam(w.Top.Y)):(this.InsertEdgeIntoAEL(w,null),this.InsertEdgeIntoAEL(F,w),this.SetWindingCount(w),F.WindCnt=w.WindCnt,F.WindCnt2=w.WindCnt2,this.IsContributing(w)&&(H=this.AddLocalMinPoly(w,F,w.Bot)),this.InsertScanbeam(w.Top.Y)),F!==null&&(e.ClipperBase.IsHorizontal(F)?(F.NextInLML!==null&&this.InsertScanbeam(F.NextInLML.Top.Y),this.AddEdgeToSEL(F)):this.InsertScanbeam(F.Top.Y)),!(w===null||F===null)){if(H!==null&&e.ClipperBase.IsHorizontal(F)&&this.m_GhostJoins.length>0&&F.WindDelta!==0)for(var _=0,st=this.m_GhostJoins.length;_<st;_++){var yt=this.m_GhostJoins[_];this.HorzSegmentsOverlap(yt.OutPt1.Pt.X,yt.OffPt.X,F.Bot.X,F.Top.X)&&this.AddJoin(yt.OutPt1,H,yt.OffPt);}if(w.OutIdx>=0&&w.PrevInAEL!==null&&w.PrevInAEL.Curr.X===w.Bot.X&&w.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(w.PrevInAEL.Curr,w.PrevInAEL.Top,w.Curr,w.Top,this.m_UseFullRange)&&w.WindDelta!==0&&w.PrevInAEL.WindDelta!==0){var Pt=this.AddOutPt(w.PrevInAEL,w.Bot);this.AddJoin(H,Pt,w.Top);}if(w.NextInAEL!==F){if(F.OutIdx>=0&&F.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(F.PrevInAEL.Curr,F.PrevInAEL.Top,F.Curr,F.Top,this.m_UseFullRange)&&F.WindDelta!==0&&F.PrevInAEL.WindDelta!==0){var Pt=this.AddOutPt(F.PrevInAEL,F.Bot);this.AddJoin(H,Pt,F.Top);}var Bt=w.NextInAEL;if(Bt!==null)for(;Bt!==F;)this.IntersectEdges(F,Bt,w.Curr),Bt=Bt.NextInAEL;}}}},e.Clipper.prototype.InsertEdgeIntoAEL=function(a,P){if(this.m_ActiveEdges===null)a.PrevInAEL=null,a.NextInAEL=null,this.m_ActiveEdges=a;else if(P===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,a))a.PrevInAEL=null,a.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=a,this.m_ActiveEdges=a;else{for(P===null&&(P=this.m_ActiveEdges);P.NextInAEL!==null&&!this.E2InsertsBeforeE1(P.NextInAEL,a);)P=P.NextInAEL;a.NextInAEL=P.NextInAEL,P.NextInAEL!==null&&(P.NextInAEL.PrevInAEL=a),a.PrevInAEL=P,P.NextInAEL=a;}},e.Clipper.prototype.E2InsertsBeforeE1=function(a,P){return P.Curr.X===a.Curr.X?P.Top.Y>a.Top.Y?P.Top.X<e.Clipper.TopX(a,P.Top.Y):a.Top.X>e.Clipper.TopX(P,a.Top.Y):P.Curr.X<a.Curr.X;},e.Clipper.prototype.IsEvenOddFillType=function(a){return a.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType===e.PolyFillType.pftEvenOdd:this.m_ClipFillType===e.PolyFillType.pftEvenOdd;},e.Clipper.prototype.IsEvenOddAltFillType=function(a){return a.PolyTyp===e.PolyType.ptSubject?this.m_ClipFillType===e.PolyFillType.pftEvenOdd:this.m_SubjFillType===e.PolyFillType.pftEvenOdd;},e.Clipper.prototype.IsContributing=function(a){var P,w;switch(a.PolyTyp===e.PolyType.ptSubject?(P=this.m_SubjFillType,w=this.m_ClipFillType):(P=this.m_ClipFillType,w=this.m_SubjFillType),P){case e.PolyFillType.pftEvenOdd:if(a.WindDelta===0&&a.WindCnt!==1)return!1;break;case e.PolyFillType.pftNonZero:if(Math.abs(a.WindCnt)!==1)return!1;break;case e.PolyFillType.pftPositive:if(a.WindCnt!==1)return!1;break;default:if(a.WindCnt!==-1)return!1;break;}switch(this.m_ClipType){case e.ClipType.ctIntersection:switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2!==0;case e.PolyFillType.pftPositive:return a.WindCnt2>0;default:return a.WindCnt2<0;}case e.ClipType.ctUnion:switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0;}case e.ClipType.ctDifference:if(a.PolyTyp===e.PolyType.ptSubject)switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0;}else switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2!==0;case e.PolyFillType.pftPositive:return a.WindCnt2>0;default:return a.WindCnt2<0;}case e.ClipType.ctXor:if(a.WindDelta===0)switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0;}else return!0;}return!0;},e.Clipper.prototype.SetWindingCount=function(a){for(var P=a.PrevInAEL;P!==null&&(P.PolyTyp!==a.PolyTyp||P.WindDelta===0);)P=P.PrevInAEL;if(P===null){var w=a.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;a.WindDelta===0?a.WindCnt=w===e.PolyFillType.pftNegative?-1:1:a.WindCnt=a.WindDelta,a.WindCnt2=0,P=this.m_ActiveEdges;}else if(a.WindDelta===0&&this.m_ClipType!==e.ClipType.ctUnion)a.WindCnt=1,a.WindCnt2=P.WindCnt2,P=P.NextInAEL;else if(this.IsEvenOddFillType(a)){if(a.WindDelta===0){for(var F=!0,H=P.PrevInAEL;H!==null;)H.PolyTyp===P.PolyTyp&&H.WindDelta!==0&&(F=!F),H=H.PrevInAEL;a.WindCnt=F?0:1;}else a.WindCnt=a.WindDelta;a.WindCnt2=P.WindCnt2,P=P.NextInAEL;}else P.WindCnt*P.WindDelta<0?Math.abs(P.WindCnt)>1?P.WindDelta*a.WindDelta<0?a.WindCnt=P.WindCnt:a.WindCnt=P.WindCnt+a.WindDelta:a.WindCnt=a.WindDelta===0?1:a.WindDelta:a.WindDelta===0?a.WindCnt=P.WindCnt<0?P.WindCnt-1:P.WindCnt+1:P.WindDelta*a.WindDelta<0?a.WindCnt=P.WindCnt:a.WindCnt=P.WindCnt+a.WindDelta,a.WindCnt2=P.WindCnt2,P=P.NextInAEL;if(this.IsEvenOddAltFillType(a))for(;P!==a;)P.WindDelta!==0&&(a.WindCnt2=a.WindCnt2===0?1:0),P=P.NextInAEL;else for(;P!==a;)a.WindCnt2+=P.WindDelta,P=P.NextInAEL;},e.Clipper.prototype.AddEdgeToSEL=function(a){this.m_SortedEdges===null?(this.m_SortedEdges=a,a.PrevInSEL=null,a.NextInSEL=null):(a.NextInSEL=this.m_SortedEdges,a.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=a,this.m_SortedEdges=a);},e.Clipper.prototype.PopEdgeFromSEL=function(a){if(a.v=this.m_SortedEdges,a.v===null)return!1;var P=a.v;return this.m_SortedEdges=a.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),P.NextInSEL=null,P.PrevInSEL=null,!0;},e.Clipper.prototype.CopyAELToSEL=function(){var a=this.m_ActiveEdges;for(this.m_SortedEdges=a;a!==null;)a.PrevInSEL=a.PrevInAEL,a.NextInSEL=a.NextInAEL,a=a.NextInAEL;},e.Clipper.prototype.SwapPositionsInSEL=function(a,P){if(!(a.NextInSEL===null&&a.PrevInSEL===null)&&!(P.NextInSEL===null&&P.PrevInSEL===null)){if(a.NextInSEL===P){var w=P.NextInSEL;w!==null&&(w.PrevInSEL=a);var F=a.PrevInSEL;F!==null&&(F.NextInSEL=P),P.PrevInSEL=F,P.NextInSEL=a,a.PrevInSEL=P,a.NextInSEL=w;}else if(P.NextInSEL===a){var w=a.NextInSEL;w!==null&&(w.PrevInSEL=P);var F=P.PrevInSEL;F!==null&&(F.NextInSEL=a),a.PrevInSEL=F,a.NextInSEL=P,P.PrevInSEL=a,P.NextInSEL=w;}else{var w=a.NextInSEL,F=a.PrevInSEL;a.NextInSEL=P.NextInSEL,a.NextInSEL!==null&&(a.NextInSEL.PrevInSEL=a),a.PrevInSEL=P.PrevInSEL,a.PrevInSEL!==null&&(a.PrevInSEL.NextInSEL=a),P.NextInSEL=w,P.NextInSEL!==null&&(P.NextInSEL.PrevInSEL=P),P.PrevInSEL=F,P.PrevInSEL!==null&&(P.PrevInSEL.NextInSEL=P);}a.PrevInSEL===null?this.m_SortedEdges=a:P.PrevInSEL===null&&(this.m_SortedEdges=P);}},e.Clipper.prototype.AddLocalMaxPoly=function(a,P,w){this.AddOutPt(a,w),P.WindDelta===0&&this.AddOutPt(P,w),a.OutIdx===P.OutIdx?(a.OutIdx=-1,P.OutIdx=-1):a.OutIdx<P.OutIdx?this.AppendPolygon(a,P):this.AppendPolygon(P,a);},e.Clipper.prototype.AddLocalMinPoly=function(a,P,w){var F,H,_;if(e.ClipperBase.IsHorizontal(P)||a.Dx>P.Dx?(F=this.AddOutPt(a,w),P.OutIdx=a.OutIdx,a.Side=e.EdgeSide.esLeft,P.Side=e.EdgeSide.esRight,H=a,H.PrevInAEL===P?_=P.PrevInAEL:_=H.PrevInAEL):(F=this.AddOutPt(P,w),a.OutIdx=P.OutIdx,a.Side=e.EdgeSide.esRight,P.Side=e.EdgeSide.esLeft,H=P,H.PrevInAEL===a?_=a.PrevInAEL:_=H.PrevInAEL),_!==null&&_.OutIdx>=0&&_.Top.Y<w.Y&&H.Top.Y<w.Y){var st=e.Clipper.TopX(_,w.Y),yt=e.Clipper.TopX(H,w.Y);if(st===yt&&H.WindDelta!==0&&_.WindDelta!==0&&e.ClipperBase.SlopesEqual5(new e.IntPoint2(st,w.Y),_.Top,new e.IntPoint2(yt,w.Y),H.Top,this.m_UseFullRange)){var Pt=this.AddOutPt(_,w);this.AddJoin(F,Pt,H.Top);}}return F;},e.Clipper.prototype.AddOutPt=function(a,P){if(a.OutIdx<0){var w=this.CreateOutRec();w.IsOpen=a.WindDelta===0;var F=new e.OutPt();return w.Pts=F,F.Idx=w.Idx,F.Pt.X=P.X,F.Pt.Y=P.Y,e.use_xyz&&(F.Pt.Z=P.Z),F.Next=F,F.Prev=F,w.IsOpen||this.SetHoleState(a,w),a.OutIdx=w.Idx,F;}else{var w=this.m_PolyOuts[a.OutIdx],H=w.Pts,_=a.Side===e.EdgeSide.esLeft;if(_&&e.IntPoint.op_Equality(P,H.Pt))return H;if(!_&&e.IntPoint.op_Equality(P,H.Prev.Pt))return H.Prev;var F=new e.OutPt();return F.Idx=w.Idx,F.Pt.X=P.X,F.Pt.Y=P.Y,e.use_xyz&&(F.Pt.Z=P.Z),F.Next=H,F.Prev=H.Prev,F.Prev.Next=F,H.Prev=F,_&&(w.Pts=F),F;}},e.Clipper.prototype.GetLastOutPt=function(a){var P=this.m_PolyOuts[a.OutIdx];return a.Side===e.EdgeSide.esLeft?P.Pts:P.Pts.Prev;},e.Clipper.prototype.SwapPoints=function(a,P){var w=new e.IntPoint1(a.Value);a.Value.X=P.Value.X,a.Value.Y=P.Value.Y,e.use_xyz&&(a.Value.Z=P.Value.Z),P.Value.X=w.X,P.Value.Y=w.Y,e.use_xyz&&(P.Value.Z=w.Z);},e.Clipper.prototype.HorzSegmentsOverlap=function(a,P,w,F){var H;return a>P&&(H=a,a=P,P=H),w>F&&(H=w,w=F,F=H),a<F&&w<P;},e.Clipper.prototype.SetHoleState=function(a,P){for(var w=a.PrevInAEL,F=null;w!==null;)w.OutIdx>=0&&w.WindDelta!==0&&(F===null?F=w:F.OutIdx===w.OutIdx&&(F=null)),w=w.PrevInAEL;F===null?(P.FirstLeft=null,P.IsHole=!1):(P.FirstLeft=this.m_PolyOuts[F.OutIdx],P.IsHole=!P.FirstLeft.IsHole);},e.Clipper.prototype.GetDx=function(a,P){return a.Y===P.Y?e.ClipperBase.horizontal:(P.X-a.X)/(P.Y-a.Y);},e.Clipper.prototype.FirstIsBottomPt=function(a,P){for(var w=a.Prev;e.IntPoint.op_Equality(w.Pt,a.Pt)&&w!==a;)w=w.Prev;var F=Math.abs(this.GetDx(a.Pt,w.Pt));for(w=a.Next;e.IntPoint.op_Equality(w.Pt,a.Pt)&&w!==a;)w=w.Next;var H=Math.abs(this.GetDx(a.Pt,w.Pt));for(w=P.Prev;e.IntPoint.op_Equality(w.Pt,P.Pt)&&w!==P;)w=w.Prev;var _=Math.abs(this.GetDx(P.Pt,w.Pt));for(w=P.Next;e.IntPoint.op_Equality(w.Pt,P.Pt)&&w!==P;)w=w.Next;var st=Math.abs(this.GetDx(P.Pt,w.Pt));return Math.max(F,H)===Math.max(_,st)&&Math.min(F,H)===Math.min(_,st)?this.Area(a)>0:F>=_&&F>=st||H>=_&&H>=st;},e.Clipper.prototype.GetBottomPt=function(a){for(var P=null,w=a.Next;w!==a;)w.Pt.Y>a.Pt.Y?(a=w,P=null):w.Pt.Y===a.Pt.Y&&w.Pt.X<=a.Pt.X&&(w.Pt.X<a.Pt.X?(P=null,a=w):w.Next!==a&&w.Prev!==a&&(P=w)),w=w.Next;if(P!==null)for(;P!==w;)for(this.FirstIsBottomPt(w,P)||(a=P),P=P.Next;e.IntPoint.op_Inequality(P.Pt,a.Pt);)P=P.Next;return a;},e.Clipper.prototype.GetLowermostRec=function(a,P){a.BottomPt===null&&(a.BottomPt=this.GetBottomPt(a.Pts)),P.BottomPt===null&&(P.BottomPt=this.GetBottomPt(P.Pts));var w=a.BottomPt,F=P.BottomPt;return w.Pt.Y>F.Pt.Y?a:w.Pt.Y<F.Pt.Y?P:w.Pt.X<F.Pt.X?a:w.Pt.X>F.Pt.X||w.Next===w?P:F.Next===F||this.FirstIsBottomPt(w,F)?a:P;},e.Clipper.prototype.OutRec1RightOfOutRec2=function(a,P){do if(a=a.FirstLeft,a===P)return!0;while(a!==null);return!1;},e.Clipper.prototype.GetOutRec=function(a){for(var P=this.m_PolyOuts[a];P!==this.m_PolyOuts[P.Idx];)P=this.m_PolyOuts[P.Idx];return P;},e.Clipper.prototype.AppendPolygon=function(a,P){var w=this.m_PolyOuts[a.OutIdx],F=this.m_PolyOuts[P.OutIdx],H;this.OutRec1RightOfOutRec2(w,F)?H=F:this.OutRec1RightOfOutRec2(F,w)?H=w:H=this.GetLowermostRec(w,F);var _=w.Pts,st=_.Prev,yt=F.Pts,Pt=yt.Prev;a.Side===e.EdgeSide.esLeft?P.Side===e.EdgeSide.esLeft?(this.ReversePolyPtLinks(yt),yt.Next=_,_.Prev=yt,st.Next=Pt,Pt.Prev=st,w.Pts=Pt):(Pt.Next=_,_.Prev=Pt,yt.Prev=st,st.Next=yt,w.Pts=yt):P.Side===e.EdgeSide.esRight?(this.ReversePolyPtLinks(yt),st.Next=Pt,Pt.Prev=st,yt.Next=_,_.Prev=yt):(st.Next=yt,yt.Prev=st,_.Prev=Pt,Pt.Next=_),w.BottomPt=null,H===F&&(F.FirstLeft!==w&&(w.FirstLeft=F.FirstLeft),w.IsHole=F.IsHole),F.Pts=null,F.BottomPt=null,F.FirstLeft=w;var Bt=a.OutIdx,kt=P.OutIdx;a.OutIdx=-1,P.OutIdx=-1;for(var jt=this.m_ActiveEdges;jt!==null;){if(jt.OutIdx===kt){jt.OutIdx=Bt,jt.Side=a.Side;break;}jt=jt.NextInAEL;}F.Idx=w.Idx;},e.Clipper.prototype.ReversePolyPtLinks=function(a){if(a!==null){var P,w;P=a;do w=P.Next,P.Next=P.Prev,P.Prev=w,P=w;while(P!==a);}},e.Clipper.SwapSides=function(a,P){var w=a.Side;a.Side=P.Side,P.Side=w;},e.Clipper.SwapPolyIndexes=function(a,P){var w=a.OutIdx;a.OutIdx=P.OutIdx,P.OutIdx=w;},e.Clipper.prototype.IntersectEdges=function(a,P,w){var F=a.OutIdx>=0,H=P.OutIdx>=0;if(e.use_xyz&&this.SetZ(w,a,P),e.use_lines&&(a.WindDelta===0||P.WindDelta===0)){if(a.WindDelta===0&&P.WindDelta===0)return;a.PolyTyp===P.PolyTyp&&a.WindDelta!==P.WindDelta&&this.m_ClipType===e.ClipType.ctUnion?a.WindDelta===0?H&&(this.AddOutPt(a,w),F&&(a.OutIdx=-1)):F&&(this.AddOutPt(P,w),H&&(P.OutIdx=-1)):a.PolyTyp!==P.PolyTyp&&(a.WindDelta===0&&Math.abs(P.WindCnt)===1&&(this.m_ClipType!==e.ClipType.ctUnion||P.WindCnt2===0)?(this.AddOutPt(a,w),F&&(a.OutIdx=-1)):P.WindDelta===0&&Math.abs(a.WindCnt)===1&&(this.m_ClipType!==e.ClipType.ctUnion||a.WindCnt2===0)&&(this.AddOutPt(P,w),H&&(P.OutIdx=-1)));return;}if(a.PolyTyp===P.PolyTyp){if(this.IsEvenOddFillType(a)){var _=a.WindCnt;a.WindCnt=P.WindCnt,P.WindCnt=_;}else a.WindCnt+P.WindDelta===0?a.WindCnt=-a.WindCnt:a.WindCnt+=P.WindDelta,P.WindCnt-a.WindDelta===0?P.WindCnt=-P.WindCnt:P.WindCnt-=a.WindDelta;}else this.IsEvenOddFillType(P)?a.WindCnt2=a.WindCnt2===0?1:0:a.WindCnt2+=P.WindDelta,this.IsEvenOddFillType(a)?P.WindCnt2=P.WindCnt2===0?1:0:P.WindCnt2-=a.WindDelta;var st,yt,Pt,Bt;a.PolyTyp===e.PolyType.ptSubject?(st=this.m_SubjFillType,Pt=this.m_ClipFillType):(st=this.m_ClipFillType,Pt=this.m_SubjFillType),P.PolyTyp===e.PolyType.ptSubject?(yt=this.m_SubjFillType,Bt=this.m_ClipFillType):(yt=this.m_ClipFillType,Bt=this.m_SubjFillType);var kt,jt;switch(st){case e.PolyFillType.pftPositive:kt=a.WindCnt;break;case e.PolyFillType.pftNegative:kt=-a.WindCnt;break;default:kt=Math.abs(a.WindCnt);break;}switch(yt){case e.PolyFillType.pftPositive:jt=P.WindCnt;break;case e.PolyFillType.pftNegative:jt=-P.WindCnt;break;default:jt=Math.abs(P.WindCnt);break;}if(F&&H)kt!==0&&kt!==1||jt!==0&&jt!==1||a.PolyTyp!==P.PolyTyp&&this.m_ClipType!==e.ClipType.ctXor?this.AddLocalMaxPoly(a,P,w):(this.AddOutPt(a,w),this.AddOutPt(P,w),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if(F)(jt===0||jt===1)&&(this.AddOutPt(a,w),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if(H)(kt===0||kt===1)&&(this.AddOutPt(P,w),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if((kt===0||kt===1)&&(jt===0||jt===1)){var qt,oe;switch(Pt){case e.PolyFillType.pftPositive:qt=a.WindCnt2;break;case e.PolyFillType.pftNegative:qt=-a.WindCnt2;break;default:qt=Math.abs(a.WindCnt2);break;}switch(Bt){case e.PolyFillType.pftPositive:oe=P.WindCnt2;break;case e.PolyFillType.pftNegative:oe=-P.WindCnt2;break;default:oe=Math.abs(P.WindCnt2);break;}if(a.PolyTyp!==P.PolyTyp)this.AddLocalMinPoly(a,P,w);else if(kt===1&&jt===1)switch(this.m_ClipType){case e.ClipType.ctIntersection:qt>0&&oe>0&&this.AddLocalMinPoly(a,P,w);break;case e.ClipType.ctUnion:qt<=0&&oe<=0&&this.AddLocalMinPoly(a,P,w);break;case e.ClipType.ctDifference:(a.PolyTyp===e.PolyType.ptClip&&qt>0&&oe>0||a.PolyTyp===e.PolyType.ptSubject&&qt<=0&&oe<=0)&&this.AddLocalMinPoly(a,P,w);break;case e.ClipType.ctXor:this.AddLocalMinPoly(a,P,w);break;}else e.Clipper.SwapSides(a,P);}},e.Clipper.prototype.DeleteFromSEL=function(a){var P=a.PrevInSEL,w=a.NextInSEL;P===null&&w===null&&a!==this.m_SortedEdges||(P!==null?P.NextInSEL=w:this.m_SortedEdges=w,w!==null&&(w.PrevInSEL=P),a.NextInSEL=null,a.PrevInSEL=null);},e.Clipper.prototype.ProcessHorizontals=function(){for(var a={};this.PopEdgeFromSEL(a);)this.ProcessHorizontal(a.v);},e.Clipper.prototype.GetHorzDirection=function(a,P){a.Bot.X<a.Top.X?(P.Left=a.Bot.X,P.Right=a.Top.X,P.Dir=e.Direction.dLeftToRight):(P.Left=a.Top.X,P.Right=a.Bot.X,P.Dir=e.Direction.dRightToLeft);},e.Clipper.prototype.ProcessHorizontal=function(a){var P={Dir:null,Left:null,Right:null};this.GetHorzDirection(a,P);for(var w=P.Dir,F=P.Left,H=P.Right,_=a.WindDelta===0,st=a,yt=null;st.NextInLML!==null&&e.ClipperBase.IsHorizontal(st.NextInLML);)st=st.NextInLML;st.NextInLML===null&&(yt=this.GetMaximaPair(st));var Pt=this.m_Maxima;if(Pt!==null)if(w===e.Direction.dLeftToRight){for(;Pt!==null&&Pt.X<=a.Bot.X;)Pt=Pt.Next;Pt!==null&&Pt.X>=st.Top.X&&(Pt=null);}else{for(;Pt.Next!==null&&Pt.Next.X<a.Bot.X;)Pt=Pt.Next;Pt.X<=st.Top.X&&(Pt=null);}for(var Bt=null;;){for(var kt=a===st,jt=this.GetNextInAEL(a,w);jt!==null;){if(Pt!==null)if(w===e.Direction.dLeftToRight)for(;Pt!==null&&Pt.X<jt.Curr.X;)a.OutIdx>=0&&!_&&this.AddOutPt(a,new e.IntPoint2(Pt.X,a.Bot.Y)),Pt=Pt.Next;else for(;Pt!==null&&Pt.X>jt.Curr.X;)a.OutIdx>=0&&!_&&this.AddOutPt(a,new e.IntPoint2(Pt.X,a.Bot.Y)),Pt=Pt.Prev;if(w===e.Direction.dLeftToRight&&jt.Curr.X>H||w===e.Direction.dRightToLeft&&jt.Curr.X<F||jt.Curr.X===a.Top.X&&a.NextInLML!==null&&jt.Dx<a.NextInLML.Dx)break;if(a.OutIdx>=0&&!_){e.use_xyz&&(w===e.Direction.dLeftToRight?this.SetZ(jt.Curr,a,jt):this.SetZ(jt.Curr,jt,a)),Bt=this.AddOutPt(a,jt.Curr);for(var qt=this.m_SortedEdges;qt!==null;){if(qt.OutIdx>=0&&this.HorzSegmentsOverlap(a.Bot.X,a.Top.X,qt.Bot.X,qt.Top.X)){var oe=this.GetLastOutPt(qt);this.AddJoin(oe,Bt,qt.Top);}qt=qt.NextInSEL;}this.AddGhostJoin(Bt,a.Bot);}if(jt===yt&&kt){a.OutIdx>=0&&this.AddLocalMaxPoly(a,yt,a.Top),this.DeleteFromAEL(a),this.DeleteFromAEL(yt);return;}if(w===e.Direction.dLeftToRight){var me=new e.IntPoint2(jt.Curr.X,a.Curr.Y);this.IntersectEdges(a,jt,me);}else{var me=new e.IntPoint2(jt.Curr.X,a.Curr.Y);this.IntersectEdges(jt,a,me);}var Pe=this.GetNextInAEL(jt,w);this.SwapPositionsInAEL(a,jt),jt=Pe;}if(a.NextInLML===null||!e.ClipperBase.IsHorizontal(a.NextInLML))break;a=this.UpdateEdgeIntoAEL(a),a.OutIdx>=0&&this.AddOutPt(a,a.Bot),P={Dir:w,Left:F,Right:H},this.GetHorzDirection(a,P),w=P.Dir,F=P.Left,H=P.Right;}if(a.OutIdx>=0&&Bt===null){Bt=this.GetLastOutPt(a);for(var qt=this.m_SortedEdges;qt!==null;){if(qt.OutIdx>=0&&this.HorzSegmentsOverlap(a.Bot.X,a.Top.X,qt.Bot.X,qt.Top.X)){var oe=this.GetLastOutPt(qt);this.AddJoin(oe,Bt,qt.Top);}qt=qt.NextInSEL;}this.AddGhostJoin(Bt,a.Top);}if(a.NextInLML!==null){if(a.OutIdx>=0){if(Bt=this.AddOutPt(a,a.Top),a=this.UpdateEdgeIntoAEL(a),a.WindDelta===0)return;var De=a.PrevInAEL,Pe=a.NextInAEL;if(De!==null&&De.Curr.X===a.Bot.X&&De.Curr.Y===a.Bot.Y&&De.WindDelta===0&&De.OutIdx>=0&&De.Curr.Y>De.Top.Y&&e.ClipperBase.SlopesEqual3(a,De,this.m_UseFullRange)){var oe=this.AddOutPt(De,a.Bot);this.AddJoin(Bt,oe,a.Top);}else if(Pe!==null&&Pe.Curr.X===a.Bot.X&&Pe.Curr.Y===a.Bot.Y&&Pe.WindDelta!==0&&Pe.OutIdx>=0&&Pe.Curr.Y>Pe.Top.Y&&e.ClipperBase.SlopesEqual3(a,Pe,this.m_UseFullRange)){var oe=this.AddOutPt(Pe,a.Bot);this.AddJoin(Bt,oe,a.Top);}}else a=this.UpdateEdgeIntoAEL(a);}else a.OutIdx>=0&&this.AddOutPt(a,a.Top),this.DeleteFromAEL(a);},e.Clipper.prototype.GetNextInAEL=function(a,P){return P===e.Direction.dLeftToRight?a.NextInAEL:a.PrevInAEL;},e.Clipper.prototype.IsMinima=function(a){return a!==null&&a.Prev.NextInLML!==a&&a.Next.NextInLML!==a;},e.Clipper.prototype.IsMaxima=function(a,P){return a!==null&&a.Top.Y===P&&a.NextInLML===null;},e.Clipper.prototype.IsIntermediate=function(a,P){return a.Top.Y===P&&a.NextInLML!==null;},e.Clipper.prototype.GetMaximaPair=function(a){return e.IntPoint.op_Equality(a.Next.Top,a.Top)&&a.Next.NextInLML===null?a.Next:e.IntPoint.op_Equality(a.Prev.Top,a.Top)&&a.Prev.NextInLML===null?a.Prev:null;},e.Clipper.prototype.GetMaximaPairEx=function(a){var P=this.GetMaximaPair(a);return P===null||P.OutIdx===e.ClipperBase.Skip||P.NextInAEL===P.PrevInAEL&&!e.ClipperBase.IsHorizontal(P)?null:P;},e.Clipper.prototype.ProcessIntersections=function(a){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(a),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1;}catch(_unused23){this.m_SortedEdges=null,this.m_IntersectList.length=0,e.Error("ProcessIntersections error");}return this.m_SortedEdges=null,!0;},e.Clipper.prototype.BuildIntersectList=function(a){if(this.m_ActiveEdges!==null){var P=this.m_ActiveEdges;for(this.m_SortedEdges=P;P!==null;)P.PrevInSEL=P.PrevInAEL,P.NextInSEL=P.NextInAEL,P.Curr.X=e.Clipper.TopX(P,a),P=P.NextInAEL;for(var w=!0;w&&this.m_SortedEdges!==null;){for(w=!1,P=this.m_SortedEdges;P.NextInSEL!==null;){var F=P.NextInSEL,H=new e.IntPoint0();if(P.Curr.X>F.Curr.X){this.IntersectPoint(P,F,H),H.Y<a&&(H=new e.IntPoint2(e.Clipper.TopX(P,a),a));var _=new e.IntersectNode();_.Edge1=P,_.Edge2=F,_.Pt.X=H.X,_.Pt.Y=H.Y,e.use_xyz&&(_.Pt.Z=H.Z),this.m_IntersectList.push(_),this.SwapPositionsInSEL(P,F),w=!0;}else P=F;}if(P.PrevInSEL!==null)P.PrevInSEL.NextInSEL=null;else break;}this.m_SortedEdges=null;}},e.Clipper.prototype.EdgesAdjacent=function(a){return a.Edge1.NextInSEL===a.Edge2||a.Edge1.PrevInSEL===a.Edge2;},e.Clipper.IntersectNodeSort=function(a,P){return P.Pt.Y-a.Pt.Y;},e.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var a=this.m_IntersectList.length,P=0;P<a;P++){if(!this.EdgesAdjacent(this.m_IntersectList[P])){for(var w=P+1;w<a&&!this.EdgesAdjacent(this.m_IntersectList[w]);)w++;if(w===a)return!1;var F=this.m_IntersectList[P];this.m_IntersectList[P]=this.m_IntersectList[w],this.m_IntersectList[w]=F;}this.SwapPositionsInSEL(this.m_IntersectList[P].Edge1,this.m_IntersectList[P].Edge2);}return!0;},e.Clipper.prototype.ProcessIntersectList=function(){for(var a=0,P=this.m_IntersectList.length;a<P;a++){var w=this.m_IntersectList[a];this.IntersectEdges(w.Edge1,w.Edge2,w.Pt),this.SwapPositionsInAEL(w.Edge1,w.Edge2);}this.m_IntersectList.length=0;};var $o=function $o(a){return a<0?Math.ceil(a-0.5):Math.round(a);},os=function os(a){return a<0?Math.ceil(a-0.5):Math.floor(a+0.5);},Zn=function Zn(a){return a<0?-Math.round(Math.abs(a)):Math.round(a);},as=function as(a){return a<0?(a-=0.5,a<-2147483648?Math.ceil(a):a|0):(a+=0.5,a>2147483647?Math.floor(a):a|0);};s.msie?e.Clipper.Round=$o:s.chromium?e.Clipper.Round=Zn:s.safari?e.Clipper.Round=as:e.Clipper.Round=os,e.Clipper.TopX=function(a,P){return P===a.Top.Y?a.Top.X:a.Bot.X+e.Clipper.Round(a.Dx*(P-a.Bot.Y));},e.Clipper.prototype.IntersectPoint=function(a,P,w){w.X=0,w.Y=0;var F,H;if(a.Dx===P.Dx){w.Y=a.Curr.Y,w.X=e.Clipper.TopX(a,w.Y);return;}if(a.Delta.X===0)w.X=a.Bot.X,e.ClipperBase.IsHorizontal(P)?w.Y=P.Bot.Y:(H=P.Bot.Y-P.Bot.X/P.Dx,w.Y=e.Clipper.Round(w.X/P.Dx+H));else if(P.Delta.X===0)w.X=P.Bot.X,e.ClipperBase.IsHorizontal(a)?w.Y=a.Bot.Y:(F=a.Bot.Y-a.Bot.X/a.Dx,w.Y=e.Clipper.Round(w.X/a.Dx+F));else{F=a.Bot.X-a.Bot.Y*a.Dx,H=P.Bot.X-P.Bot.Y*P.Dx;var _=(H-F)/(a.Dx-P.Dx);w.Y=e.Clipper.Round(_),Math.abs(a.Dx)<Math.abs(P.Dx)?w.X=e.Clipper.Round(a.Dx*_+F):w.X=e.Clipper.Round(P.Dx*_+H);}if(w.Y<a.Top.Y||w.Y<P.Top.Y){if(a.Top.Y>P.Top.Y)return w.Y=a.Top.Y,w.X=e.Clipper.TopX(P,a.Top.Y),w.X<a.Top.X;w.Y=P.Top.Y,Math.abs(a.Dx)<Math.abs(P.Dx)?w.X=e.Clipper.TopX(a,w.Y):w.X=e.Clipper.TopX(P,w.Y);}w.Y>a.Curr.Y&&(w.Y=a.Curr.Y,Math.abs(a.Dx)>Math.abs(P.Dx)?w.X=e.Clipper.TopX(P,w.Y):w.X=e.Clipper.TopX(a,w.Y));},e.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(a){for(var P=this.m_ActiveEdges;P!==null;){var w=this.IsMaxima(P,a);if(w){var F=this.GetMaximaPairEx(P);w=F===null||!e.ClipperBase.IsHorizontal(F);}if(w){this.StrictlySimple&&this.InsertMaxima(P.Top.X);var H=P.PrevInAEL;this.DoMaxima(P),H===null?P=this.m_ActiveEdges:P=H.NextInAEL;}else{if(this.IsIntermediate(P,a)&&e.ClipperBase.IsHorizontal(P.NextInLML)?(P=this.UpdateEdgeIntoAEL(P),P.OutIdx>=0&&this.AddOutPt(P,P.Bot),this.AddEdgeToSEL(P)):(P.Curr.X=e.Clipper.TopX(P,a),P.Curr.Y=a),e.use_xyz&&(P.Top.Y===a?P.Curr.Z=P.Top.Z:P.Bot.Y===a?P.Curr.Z=P.Bot.Z:P.Curr.Z=0),this.StrictlySimple){var H=P.PrevInAEL;if(P.OutIdx>=0&&P.WindDelta!==0&&H!==null&&H.OutIdx>=0&&H.Curr.X===P.Curr.X&&H.WindDelta!==0){var _=new e.IntPoint1(P.Curr);e.use_xyz&&this.SetZ(_,H,P);var st=this.AddOutPt(H,_),yt=this.AddOutPt(P,_);this.AddJoin(st,yt,_);}}P=P.NextInAEL;}}for(this.ProcessHorizontals(),this.m_Maxima=null,P=this.m_ActiveEdges;P!==null;){if(this.IsIntermediate(P,a)){var st=null;P.OutIdx>=0&&(st=this.AddOutPt(P,P.Top)),P=this.UpdateEdgeIntoAEL(P);var H=P.PrevInAEL,Pt=P.NextInAEL;if(H!==null&&H.Curr.X===P.Bot.X&&H.Curr.Y===P.Bot.Y&&st!==null&&H.OutIdx>=0&&H.Curr.Y===H.Top.Y&&e.ClipperBase.SlopesEqual5(P.Curr,P.Top,H.Curr,H.Top,this.m_UseFullRange)&&P.WindDelta!==0&&H.WindDelta!==0){var yt=this.AddOutPt(ePrev2,P.Bot);this.AddJoin(st,yt,P.Top);}else if(Pt!==null&&Pt.Curr.X===P.Bot.X&&Pt.Curr.Y===P.Bot.Y&&st!==null&&Pt.OutIdx>=0&&Pt.Curr.Y===Pt.Top.Y&&e.ClipperBase.SlopesEqual5(P.Curr,P.Top,Pt.Curr,Pt.Top,this.m_UseFullRange)&&P.WindDelta!==0&&Pt.WindDelta!==0){var yt=this.AddOutPt(Pt,P.Bot);this.AddJoin(st,yt,P.Top);}}P=P.NextInAEL;}},e.Clipper.prototype.DoMaxima=function(a){var P=this.GetMaximaPairEx(a);if(P===null){a.OutIdx>=0&&this.AddOutPt(a,a.Top),this.DeleteFromAEL(a);return;}for(var w=a.NextInAEL;w!==null&&w!==P;)this.IntersectEdges(a,w,a.Top),this.SwapPositionsInAEL(a,w),w=a.NextInAEL;a.OutIdx===-1&&P.OutIdx===-1?(this.DeleteFromAEL(a),this.DeleteFromAEL(P)):a.OutIdx>=0&&P.OutIdx>=0?(a.OutIdx>=0&&this.AddLocalMaxPoly(a,P,a.Top),this.DeleteFromAEL(a),this.DeleteFromAEL(P)):e.use_lines&&a.WindDelta===0?(a.OutIdx>=0&&(this.AddOutPt(a,a.Top),a.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(a),P.OutIdx>=0&&(this.AddOutPt(P,a.Top),P.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(P)):e.Error("DoMaxima error");},e.Clipper.ReversePaths=function(a){for(var P=0,w=a.length;P<w;P++)a[P].reverse();},e.Clipper.Orientation=function(a){return e.Clipper.Area(a)>=0;},e.Clipper.prototype.PointCount=function(a){if(a===null)return 0;var P=0,w=a;do P++,w=w.Next;while(w!==a);return P;},e.Clipper.prototype.BuildResult=function(a){e.Clear(a);for(var P=0,w=this.m_PolyOuts.length;P<w;P++){var F=this.m_PolyOuts[P];if(F.Pts!==null){var H=F.Pts.Prev,_=this.PointCount(H);if(!(_<2)){for(var st=new Array(_),yt=0;yt<_;yt++)st[yt]=H.Pt,H=H.Prev;a.push(st);}}}},e.Clipper.prototype.BuildResult2=function(a){a.Clear();for(var P=0,w=this.m_PolyOuts.length;P<w;P++){var F=this.m_PolyOuts[P],H=this.PointCount(F.Pts);if(!(F.IsOpen&&H<2||!F.IsOpen&&H<3)){this.FixHoleLinkage(F);var _=new e.PolyNode();a.m_AllPolys.push(_),F.PolyNode=_,_.m_polygon.length=H;for(var st=F.Pts.Prev,yt=0;yt<H;yt++)_.m_polygon[yt]=st.Pt,st=st.Prev;}}for(var P=0,w=this.m_PolyOuts.length;P<w;P++){var F=this.m_PolyOuts[P];F.PolyNode!==null&&(F.IsOpen?(F.PolyNode.IsOpen=!0,a.AddChild(F.PolyNode)):F.FirstLeft!==null&&F.FirstLeft.PolyNode!==null?F.FirstLeft.PolyNode.AddChild(F.PolyNode):a.AddChild(F.PolyNode));}},e.Clipper.prototype.FixupOutPolyline=function(a){for(var P=a.Pts,w=P.Prev;P!==w;)if(P=P.Next,e.IntPoint.op_Equality(P.Pt,P.Prev.Pt)){P===w&&(w=P.Prev);var F=P.Prev;F.Next=P.Next,P.Next.Prev=F,P=F;}P===P.Prev&&(a.Pts=null);},e.Clipper.prototype.FixupOutPolygon=function(a){var P=null;a.BottomPt=null;for(var w=a.Pts,F=this.PreserveCollinear||this.StrictlySimple;;){if(w.Prev===w||w.Prev===w.Next){a.Pts=null;return;}if(e.IntPoint.op_Equality(w.Pt,w.Next.Pt)||e.IntPoint.op_Equality(w.Pt,w.Prev.Pt)||e.ClipperBase.SlopesEqual4(w.Prev.Pt,w.Pt,w.Next.Pt,this.m_UseFullRange)&&(!F||!this.Pt2IsBetweenPt1AndPt3(w.Prev.Pt,w.Pt,w.Next.Pt)))P=null,w.Prev.Next=w.Next,w.Next.Prev=w.Prev,w=w.Prev;else{if(w===P)break;P===null&&(P=w),w=w.Next;}}a.Pts=w;},e.Clipper.prototype.DupOutPt=function(a,P){var w=new e.OutPt();return w.Pt.X=a.Pt.X,w.Pt.Y=a.Pt.Y,e.use_xyz&&(w.Pt.Z=a.Pt.Z),w.Idx=a.Idx,P?(w.Next=a.Next,w.Prev=a,a.Next.Prev=w,a.Next=w):(w.Prev=a.Prev,w.Next=a,a.Prev.Next=w,a.Prev=w),w;},e.Clipper.prototype.GetOverlap=function(a,P,w,F,H){return a<P?w<F?(H.Left=Math.max(a,w),H.Right=Math.min(P,F)):(H.Left=Math.max(a,F),H.Right=Math.min(P,w)):w<F?(H.Left=Math.max(P,w),H.Right=Math.min(a,F)):(H.Left=Math.max(P,F),H.Right=Math.min(a,w)),H.Left<H.Right;},e.Clipper.prototype.JoinHorz=function(a,P,w,F,H,_){var st=a.Pt.X>P.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight,yt=w.Pt.X>F.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight;if(st===yt)return!1;if(st===e.Direction.dLeftToRight){for(;a.Next.Pt.X<=H.X&&a.Next.Pt.X>=a.Pt.X&&a.Next.Pt.Y===H.Y;)a=a.Next;_&&a.Pt.X!==H.X&&(a=a.Next),P=this.DupOutPt(a,!_),e.IntPoint.op_Inequality(P.Pt,H)&&(a=P,a.Pt.X=H.X,a.Pt.Y=H.Y,e.use_xyz&&(a.Pt.Z=H.Z),P=this.DupOutPt(a,!_));}else{for(;a.Next.Pt.X>=H.X&&a.Next.Pt.X<=a.Pt.X&&a.Next.Pt.Y===H.Y;)a=a.Next;!_&&a.Pt.X!==H.X&&(a=a.Next),P=this.DupOutPt(a,_),e.IntPoint.op_Inequality(P.Pt,H)&&(a=P,a.Pt.X=H.X,a.Pt.Y=H.Y,e.use_xyz&&(a.Pt.Z=H.Z),P=this.DupOutPt(a,_));}if(yt===e.Direction.dLeftToRight){for(;w.Next.Pt.X<=H.X&&w.Next.Pt.X>=w.Pt.X&&w.Next.Pt.Y===H.Y;)w=w.Next;_&&w.Pt.X!==H.X&&(w=w.Next),F=this.DupOutPt(w,!_),e.IntPoint.op_Inequality(F.Pt,H)&&(w=F,w.Pt.X=H.X,w.Pt.Y=H.Y,e.use_xyz&&(w.Pt.Z=H.Z),F=this.DupOutPt(w,!_));}else{for(;w.Next.Pt.X>=H.X&&w.Next.Pt.X<=w.Pt.X&&w.Next.Pt.Y===H.Y;)w=w.Next;!_&&w.Pt.X!==H.X&&(w=w.Next),F=this.DupOutPt(w,_),e.IntPoint.op_Inequality(F.Pt,H)&&(w=F,w.Pt.X=H.X,w.Pt.Y=H.Y,e.use_xyz&&(w.Pt.Z=H.Z),F=this.DupOutPt(w,_));}return st===e.Direction.dLeftToRight===_?(a.Prev=w,w.Next=a,P.Next=F,F.Prev=P):(a.Next=w,w.Prev=a,P.Prev=F,F.Next=P),!0;},e.Clipper.prototype.JoinPoints=function(a,P,w){var F=a.OutPt1,H=new e.OutPt(),_=a.OutPt2,st=new e.OutPt(),yt=a.OutPt1.Pt.Y===a.OffPt.Y;if(yt&&e.IntPoint.op_Equality(a.OffPt,a.OutPt1.Pt)&&e.IntPoint.op_Equality(a.OffPt,a.OutPt2.Pt)){if(P!==w)return!1;for(H=a.OutPt1.Next;H!==F&&e.IntPoint.op_Equality(H.Pt,a.OffPt);)H=H.Next;var Pt=H.Pt.Y>a.OffPt.Y;for(st=a.OutPt2.Next;st!==_&&e.IntPoint.op_Equality(st.Pt,a.OffPt);)st=st.Next;var Bt=st.Pt.Y>a.OffPt.Y;return Pt===Bt?!1:Pt?(H=this.DupOutPt(F,!1),st=this.DupOutPt(_,!0),F.Prev=_,_.Next=F,H.Next=st,st.Prev=H,a.OutPt1=F,a.OutPt2=H,!0):(H=this.DupOutPt(F,!0),st=this.DupOutPt(_,!1),F.Next=_,_.Prev=F,H.Prev=st,st.Next=H,a.OutPt1=F,a.OutPt2=H,!0);}else if(yt){for(H=F;F.Prev.Pt.Y===F.Pt.Y&&F.Prev!==H&&F.Prev!==_;)F=F.Prev;for(;H.Next.Pt.Y===H.Pt.Y&&H.Next!==F&&H.Next!==_;)H=H.Next;if(H.Next===F||H.Next===_)return!1;for(st=_;_.Prev.Pt.Y===_.Pt.Y&&_.Prev!==st&&_.Prev!==H;)_=_.Prev;for(;st.Next.Pt.Y===st.Pt.Y&&st.Next!==_&&st.Next!==F;)st=st.Next;if(st.Next===_||st.Next===F)return!1;var kt={Left:null,Right:null};if(!this.GetOverlap(F.Pt.X,H.Pt.X,_.Pt.X,st.Pt.X,kt))return!1;var jt=kt.Left,qt=kt.Right,oe=new e.IntPoint0(),me;return F.Pt.X>=jt&&F.Pt.X<=qt?(oe.X=F.Pt.X,oe.Y=F.Pt.Y,e.use_xyz&&(oe.Z=F.Pt.Z),me=F.Pt.X>H.Pt.X):_.Pt.X>=jt&&_.Pt.X<=qt?(oe.X=_.Pt.X,oe.Y=_.Pt.Y,e.use_xyz&&(oe.Z=_.Pt.Z),me=_.Pt.X>st.Pt.X):H.Pt.X>=jt&&H.Pt.X<=qt?(oe.X=H.Pt.X,oe.Y=H.Pt.Y,e.use_xyz&&(oe.Z=H.Pt.Z),me=H.Pt.X>F.Pt.X):(oe.X=st.Pt.X,oe.Y=st.Pt.Y,e.use_xyz&&(oe.Z=st.Pt.Z),me=st.Pt.X>_.Pt.X),a.OutPt1=F,a.OutPt2=_,this.JoinHorz(F,H,_,st,oe,me);}else{for(H=F.Next;e.IntPoint.op_Equality(H.Pt,F.Pt)&&H!==F;)H=H.Next;var Pe=H.Pt.Y>F.Pt.Y||!e.ClipperBase.SlopesEqual4(F.Pt,H.Pt,a.OffPt,this.m_UseFullRange);if(Pe){for(H=F.Prev;e.IntPoint.op_Equality(H.Pt,F.Pt)&&H!==F;)H=H.Prev;if(H.Pt.Y>F.Pt.Y||!e.ClipperBase.SlopesEqual4(F.Pt,H.Pt,a.OffPt,this.m_UseFullRange))return!1;}for(st=_.Next;e.IntPoint.op_Equality(st.Pt,_.Pt)&&st!==_;)st=st.Next;var De=st.Pt.Y>_.Pt.Y||!e.ClipperBase.SlopesEqual4(_.Pt,st.Pt,a.OffPt,this.m_UseFullRange);if(De){for(st=_.Prev;e.IntPoint.op_Equality(st.Pt,_.Pt)&&st!==_;)st=st.Prev;if(st.Pt.Y>_.Pt.Y||!e.ClipperBase.SlopesEqual4(_.Pt,st.Pt,a.OffPt,this.m_UseFullRange))return!1;}return H===F||st===_||H===st||P===w&&Pe===De?!1:Pe?(H=this.DupOutPt(F,!1),st=this.DupOutPt(_,!0),F.Prev=_,_.Next=F,H.Next=st,st.Prev=H,a.OutPt1=F,a.OutPt2=H,!0):(H=this.DupOutPt(F,!0),st=this.DupOutPt(_,!1),F.Next=_,_.Prev=F,H.Prev=st,st.Next=H,a.OutPt1=F,a.OutPt2=H,!0);}},e.Clipper.GetBounds=function(a){for(var P=0,w=a.length;P<w&&a[P].length===0;)P++;if(P===w)return new e.IntRect(0,0,0,0);var F=new e.IntRect();for(F.left=a[P][0].X,F.right=F.left,F.top=a[P][0].Y,F.bottom=F.top;P<w;P++)for(var H=0,_=a[P].length;H<_;H++)a[P][H].X<F.left?F.left=a[P][H].X:a[P][H].X>F.right&&(F.right=a[P][H].X),a[P][H].Y<F.top?F.top=a[P][H].Y:a[P][H].Y>F.bottom&&(F.bottom=a[P][H].Y);return F;},e.Clipper.prototype.GetBounds2=function(a){var P=a,w=new e.IntRect();for(w.left=a.Pt.X,w.right=a.Pt.X,w.top=a.Pt.Y,w.bottom=a.Pt.Y,a=a.Next;a!==P;)a.Pt.X<w.left&&(w.left=a.Pt.X),a.Pt.X>w.right&&(w.right=a.Pt.X),a.Pt.Y<w.top&&(w.top=a.Pt.Y),a.Pt.Y>w.bottom&&(w.bottom=a.Pt.Y),a=a.Next;return w;},e.Clipper.PointInPolygon=function(a,P){var w=0,F=P.length;if(F<3)return 0;for(var H=P[0],_=1;_<=F;++_){var st=_===F?P[0]:P[_];if(st.Y===a.Y&&(st.X===a.X||H.Y===a.Y&&st.X>a.X==H.X<a.X))return-1;if(H.Y<a.Y!=st.Y<a.Y){if(H.X>=a.X){if(st.X>a.X)w=1-w;else{var yt=(H.X-a.X)*(st.Y-a.Y)-(st.X-a.X)*(H.Y-a.Y);if(yt===0)return-1;yt>0==st.Y>H.Y&&(w=1-w);}}else if(st.X>a.X){var yt=(H.X-a.X)*(st.Y-a.Y)-(st.X-a.X)*(H.Y-a.Y);if(yt===0)return-1;yt>0==st.Y>H.Y&&(w=1-w);}}H=st;}return w;},e.Clipper.prototype.PointInPolygon=function(a,P){var w=0,F=P,H=a.X,_=a.Y,st=P.Pt.X,yt=P.Pt.Y;do{P=P.Next;var Pt=P.Pt.X,Bt=P.Pt.Y;if(Bt===_&&(Pt===H||yt===_&&Pt>H==st<H))return-1;if(yt<_!=Bt<_){if(st>=H){if(Pt>H)w=1-w;else{var kt=(st-H)*(Bt-_)-(Pt-H)*(yt-_);if(kt===0)return-1;kt>0==Bt>yt&&(w=1-w);}}else if(Pt>H){var kt=(st-H)*(Bt-_)-(Pt-H)*(yt-_);if(kt===0)return-1;kt>0==Bt>yt&&(w=1-w);}}st=Pt,yt=Bt;}while(F!==P);return w;},e.Clipper.prototype.Poly2ContainsPoly1=function(a,P){var w=a;do{var F=this.PointInPolygon(w.Pt,P);if(F>=0)return F>0;w=w.Next;}while(w!==a);return!0;},e.Clipper.prototype.FixupFirstLefts1=function(a,P){for(var w,F,H=0,_=this.m_PolyOuts.length;H<_;H++)w=this.m_PolyOuts[H],F=e.Clipper.ParseFirstLeft(w.FirstLeft),w.Pts!==null&&F===a&&this.Poly2ContainsPoly1(w.Pts,P.Pts)&&(w.FirstLeft=P);},e.Clipper.prototype.FixupFirstLefts2=function(a,P){for(var w=P.FirstLeft,F,H,_=0,st=this.m_PolyOuts.length;_<st;_++)F=this.m_PolyOuts[_],!(F.Pts===null||F===P||F===a)&&(H=e.Clipper.ParseFirstLeft(F.FirstLeft),!(H!==w&&H!==a&&H!==P)&&(this.Poly2ContainsPoly1(F.Pts,a.Pts)?F.FirstLeft=a:this.Poly2ContainsPoly1(F.Pts,P.Pts)?F.FirstLeft=P:(F.FirstLeft===a||F.FirstLeft===P)&&(F.FirstLeft=w)));},e.Clipper.prototype.FixupFirstLefts3=function(a,P){for(var w,F,H=0,_=this.m_PolyOuts.length;H<_;H++)w=this.m_PolyOuts[H],F=e.Clipper.ParseFirstLeft(w.FirstLeft),w.Pts!==null&&F===a&&(w.FirstLeft=P);},e.Clipper.ParseFirstLeft=function(a){for(;a!==null&&a.Pts===null;)a=a.FirstLeft;return a;},e.Clipper.prototype.JoinCommonEdges=function(){for(var a=0,P=this.m_Joins.length;a<P;a++){var w=this.m_Joins[a],F=this.GetOutRec(w.OutPt1.Idx),H=this.GetOutRec(w.OutPt2.Idx);if(!(F.Pts===null||H.Pts===null)&&!(F.IsOpen||H.IsOpen)){var _;F===H?_=F:this.OutRec1RightOfOutRec2(F,H)?_=H:this.OutRec1RightOfOutRec2(H,F)?_=F:_=this.GetLowermostRec(F,H),this.JoinPoints(w,F,H)&&(F===H?(F.Pts=w.OutPt1,F.BottomPt=null,H=this.CreateOutRec(),H.Pts=w.OutPt2,this.UpdateOutPtIdxs(H),this.Poly2ContainsPoly1(H.Pts,F.Pts)?(H.IsHole=!F.IsHole,H.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts2(H,F),(H.IsHole^this.ReverseSolution)==this.Area$1(H)>0&&this.ReversePolyPtLinks(H.Pts)):this.Poly2ContainsPoly1(F.Pts,H.Pts)?(H.IsHole=F.IsHole,F.IsHole=!H.IsHole,H.FirstLeft=F.FirstLeft,F.FirstLeft=H,this.m_UsingPolyTree&&this.FixupFirstLefts2(F,H),(F.IsHole^this.ReverseSolution)==this.Area$1(F)>0&&this.ReversePolyPtLinks(F.Pts)):(H.IsHole=F.IsHole,H.FirstLeft=F.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(F,H))):(H.Pts=null,H.BottomPt=null,H.Idx=F.Idx,F.IsHole=_.IsHole,_===H&&(F.FirstLeft=H.FirstLeft),H.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts3(H,F)));}}},e.Clipper.prototype.UpdateOutPtIdxs=function(a){var P=a.Pts;do P.Idx=a.Idx,P=P.Prev;while(P!==a.Pts);},e.Clipper.prototype.DoSimplePolygons=function(){for(var a=0;a<this.m_PolyOuts.length;){var P=this.m_PolyOuts[a++],w=P.Pts;if(!(w===null||P.IsOpen))do{for(var F=w.Next;F!==P.Pts;){if(e.IntPoint.op_Equality(w.Pt,F.Pt)&&F.Next!==w&&F.Prev!==w){var H=w.Prev,_=F.Prev;w.Prev=_,_.Next=w,F.Prev=H,H.Next=F,P.Pts=w;var st=this.CreateOutRec();st.Pts=F,this.UpdateOutPtIdxs(st),this.Poly2ContainsPoly1(st.Pts,P.Pts)?(st.IsHole=!P.IsHole,st.FirstLeft=P,this.m_UsingPolyTree&&this.FixupFirstLefts2(st,P)):this.Poly2ContainsPoly1(P.Pts,st.Pts)?(st.IsHole=P.IsHole,P.IsHole=!st.IsHole,st.FirstLeft=P.FirstLeft,P.FirstLeft=st,this.m_UsingPolyTree&&this.FixupFirstLefts2(P,st)):(st.IsHole=P.IsHole,st.FirstLeft=P.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(P,st)),F=w;}F=F.Next;}w=w.Next;}while(w!==P.Pts);}},e.Clipper.Area=function(a){if(!Array.isArray(a))return 0;var P=a.length;if(P<3)return 0;for(var w=0,F=0,H=P-1;F<P;++F)w+=(a[H].X+a[F].X)*(a[H].Y-a[F].Y),H=F;return-w*0.5;},e.Clipper.prototype.Area=function(a){var P=a;if(a===null)return 0;var w=0;do w=w+(a.Prev.Pt.X+a.Pt.X)*(a.Prev.Pt.Y-a.Pt.Y),a=a.Next;while(a!==P);return w*0.5;},e.Clipper.prototype.Area$1=function(a){return this.Area(a.Pts);},e.Clipper.SimplifyPolygon=function(a,P){var w=new Array(),F=new e.Clipper(0);return F.StrictlySimple=!0,F.AddPath(a,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,w,P,P),w;},e.Clipper.SimplifyPolygons=function(a,P){_typeof(P)>"u"&&(P=e.PolyFillType.pftEvenOdd);var w=new Array(),F=new e.Clipper(0);return F.StrictlySimple=!0,F.AddPaths(a,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,w,P,P),w;},e.Clipper.DistanceSqrd=function(a,P){var w=a.X-P.X,F=a.Y-P.Y;return w*w+F*F;},e.Clipper.DistanceFromLineSqrd=function(a,P,w){var F=P.Y-w.Y,H=w.X-P.X,_=F*P.X+H*P.Y;return _=F*a.X+H*a.Y-_,_*_/(F*F+H*H);},e.Clipper.SlopesNearCollinear=function(a,P,w,F){return Math.abs(a.X-P.X)>Math.abs(a.Y-P.Y)?a.X>P.X==a.X<w.X?e.Clipper.DistanceFromLineSqrd(a,P,w)<F:P.X>a.X==P.X<w.X?e.Clipper.DistanceFromLineSqrd(P,a,w)<F:e.Clipper.DistanceFromLineSqrd(w,a,P)<F:a.Y>P.Y==a.Y<w.Y?e.Clipper.DistanceFromLineSqrd(a,P,w)<F:P.Y>a.Y==P.Y<w.Y?e.Clipper.DistanceFromLineSqrd(P,a,w)<F:e.Clipper.DistanceFromLineSqrd(w,a,P)<F;},e.Clipper.PointsAreClose=function(a,P,w){var F=a.X-P.X,H=a.Y-P.Y;return F*F+H*H<=w;},e.Clipper.ExcludeOp=function(a){var P=a.Prev;return P.Next=a.Next,a.Next.Prev=P,P.Idx=0,P;},e.Clipper.CleanPolygon=function(a,P){_typeof(P)>"u"&&(P=1.415);var w=a.length;if(w===0)return new Array();for(var F=new Array(w),H=0;H<w;++H)F[H]=new e.OutPt();for(var H=0;H<w;++H)F[H].Pt=a[H],F[H].Next=F[(H+1)%w],F[H].Next.Prev=F[H],F[H].Idx=0;for(var _=P*P,st=F[0];st.Idx===0&&st.Next!==st.Prev;)e.Clipper.PointsAreClose(st.Pt,st.Prev.Pt,_)?(st=e.Clipper.ExcludeOp(st),w--):e.Clipper.PointsAreClose(st.Prev.Pt,st.Next.Pt,_)?(e.Clipper.ExcludeOp(st.Next),st=e.Clipper.ExcludeOp(st),w-=2):e.Clipper.SlopesNearCollinear(st.Prev.Pt,st.Pt,st.Next.Pt,_)?(st=e.Clipper.ExcludeOp(st),w--):(st.Idx=1,st=st.Next);w<3&&(w=0);for(var yt=new Array(w),H=0;H<w;++H)yt[H]=new e.IntPoint1(st.Pt),st=st.Next;return F=null,yt;},e.Clipper.CleanPolygons=function(a,P){for(var w=new Array(a.length),F=0,H=a.length;F<H;F++)w[F]=e.Clipper.CleanPolygon(a[F],P);return w;},e.Clipper.Minkowski=function(a,P,w,F){var H=F?1:0,_=a.length,st=P.length,yt=new Array();if(w)for(var Pt=0;Pt<st;Pt++){for(var Bt=new Array(_),kt=0,jt=a.length,qt=a[kt];kt<jt;kt++,qt=a[kt])Bt[kt]=new e.IntPoint2(P[Pt].X+qt.X,P[Pt].Y+qt.Y);yt.push(Bt);}else for(var Pt=0;Pt<st;Pt++){for(var Bt=new Array(_),kt=0,jt=a.length,qt=a[kt];kt<jt;kt++,qt=a[kt])Bt[kt]=new e.IntPoint2(P[Pt].X-qt.X,P[Pt].Y-qt.Y);yt.push(Bt);}for(var oe=new Array(),Pt=0;Pt<st-1+H;Pt++)for(var kt=0;kt<_;kt++){var me=new Array();me.push(yt[Pt%st][kt%_]),me.push(yt[(Pt+1)%st][kt%_]),me.push(yt[(Pt+1)%st][(kt+1)%_]),me.push(yt[Pt%st][(kt+1)%_]),e.Clipper.Orientation(me)||me.reverse(),oe.push(me);}return oe;},e.Clipper.MinkowskiSum=function(a,P,w){if(P[0]instanceof Array){for(var H=P,st=new e.Paths(),_=new e.Clipper(),yt=0;yt<H.length;++yt){var Pt=e.Clipper.Minkowski(a,H[yt],!0,w);if(_.AddPaths(Pt,e.PolyType.ptSubject,!0),w){var F=e.Clipper.TranslatePath(H[yt],a[0]);_.AddPath(F,e.PolyType.ptClip,!0);}}return _.Execute(e.ClipType.ctUnion,st,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),st;}else{var F=P,H=e.Clipper.Minkowski(a,F,!0,w),_=new e.Clipper();return _.AddPaths(H,e.PolyType.ptSubject,!0),_.Execute(e.ClipType.ctUnion,H,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),H;}},e.Clipper.TranslatePath=function(a,P){for(var w=new e.Path(),F=0;F<a.length;F++)w.push(new e.IntPoint2(a[F].X+P.X,a[F].Y+P.Y));return w;},e.Clipper.MinkowskiDiff=function(a,P){var w=e.Clipper.Minkowski(a,P,!1,!0),F=new e.Clipper();return F.AddPaths(w,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),w;},e.Clipper.PolyTreeToPaths=function(a){var P=new Array();return e.Clipper.AddPolyNodeToPaths(a,e.Clipper.NodeType.ntAny,P),P;},e.Clipper.AddPolyNodeToPaths=function(a,P,w){var F=!0;switch(P){case e.Clipper.NodeType.ntOpen:return;case e.Clipper.NodeType.ntClosed:F=!a.IsOpen;break;}a.m_polygon.length>0&&F&&w.push(a.m_polygon);for(var H=0,_=a.Childs(),st=_.length,yt=_[H];H<st;H++,yt=_[H])e.Clipper.AddPolyNodeToPaths(yt,P,w);},e.Clipper.OpenPathsFromPolyTree=function(a){for(var P=new e.Paths(),w=0,F=a.ChildCount();w<F;w++)a.Childs()[w].IsOpen&&P.push(a.Childs()[w].m_polygon);return P;},e.Clipper.ClosedPathsFromPolyTree=function(a){var P=new e.Paths();return e.Clipper.AddPolyNodeToPaths(a,e.Clipper.NodeType.ntClosed,P),P;},Vn(e.Clipper,e.ClipperBase),e.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},e.ClipperOffset=function(a,P){_typeof(a)>"u"&&(a=2),_typeof(P)>"u"&&(P=e.ClipperOffset.def_arc_tolerance),this.m_destPolys=new e.Paths(),this.m_srcPoly=new e.Path(),this.m_destPoly=new e.Path(),this.m_normals=new Array(),this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new e.IntPoint0(),this.m_polyNodes=new e.PolyNode(),this.MiterLimit=a,this.ArcTolerance=P,this.m_lowest.X=-1;},e.ClipperOffset.two_pi=6.28318530717959,e.ClipperOffset.def_arc_tolerance=0.25,e.ClipperOffset.prototype.Clear=function(){e.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1;},e.ClipperOffset.Round=e.Clipper.Round,e.ClipperOffset.prototype.AddPath=function(a,P,w){var F=a.length-1;if(!(F<0)){var H=new e.PolyNode();if(H.m_jointype=P,H.m_endtype=w,w===e.EndType.etClosedLine||w===e.EndType.etClosedPolygon)for(;F>0&&e.IntPoint.op_Equality(a[0],a[F]);)F--;H.m_polygon.push(a[0]);for(var _=0,st=0,yt=1;yt<=F;yt++)e.IntPoint.op_Inequality(H.m_polygon[_],a[yt])&&(_++,H.m_polygon.push(a[yt]),(a[yt].Y>H.m_polygon[st].Y||a[yt].Y===H.m_polygon[st].Y&&a[yt].X<H.m_polygon[st].X)&&(st=_));if(!(w===e.EndType.etClosedPolygon&&_<2)&&(this.m_polyNodes.AddChild(H),w===e.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new e.IntPoint2(this.m_polyNodes.ChildCount()-1,st);else{var Pt=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(H.m_polygon[st].Y>Pt.Y||H.m_polygon[st].Y===Pt.Y&&H.m_polygon[st].X<Pt.X)&&(this.m_lowest=new e.IntPoint2(this.m_polyNodes.ChildCount()-1,st));}}},e.ClipperOffset.prototype.AddPaths=function(a,P,w){for(var F=0,H=a.length;F<H;F++)this.AddPath(a[F],P,w);},e.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!e.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var a=0;a<this.m_polyNodes.ChildCount();a++){var P=this.m_polyNodes.Childs()[a];(P.m_endtype===e.EndType.etClosedPolygon||P.m_endtype===e.EndType.etClosedLine&&e.Clipper.Orientation(P.m_polygon))&&P.m_polygon.reverse();}else for(var a=0;a<this.m_polyNodes.ChildCount();a++){var P=this.m_polyNodes.Childs()[a];P.m_endtype===e.EndType.etClosedLine&&!e.Clipper.Orientation(P.m_polygon)&&P.m_polygon.reverse();}},e.ClipperOffset.GetUnitNormal=function(a,P){var w=P.X-a.X,F=P.Y-a.Y;if(w===0&&F===0)return new e.DoublePoint2(0,0);var H=1/Math.sqrt(w*w+F*F);return w*=H,F*=H,new e.DoublePoint2(F,-w);},e.ClipperOffset.prototype.DoOffset=function(a){if(this.m_destPolys=new Array(),this.m_delta=a,e.ClipperBase.near_zero(a)){for(var P=0;P<this.m_polyNodes.ChildCount();P++){var w=this.m_polyNodes.Childs()[P];w.m_endtype===e.EndType.etClosedPolygon&&this.m_destPolys.push(w.m_polygon);}return;}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=0.5;var F;this.ArcTolerance<=0?F=e.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(a)*e.ClipperOffset.def_arc_tolerance?F=Math.abs(a)*e.ClipperOffset.def_arc_tolerance:F=this.ArcTolerance;var H=3.14159265358979/Math.acos(1-F/Math.abs(a));this.m_sin=Math.sin(e.ClipperOffset.two_pi/H),this.m_cos=Math.cos(e.ClipperOffset.two_pi/H),this.m_StepsPerRad=H/e.ClipperOffset.two_pi,a<0&&(this.m_sin=-this.m_sin);for(var P=0;P<this.m_polyNodes.ChildCount();P++){var w=this.m_polyNodes.Childs()[P];this.m_srcPoly=w.m_polygon;var _=this.m_srcPoly.length;if(!(_===0||a<=0&&(_<3||w.m_endtype!==e.EndType.etClosedPolygon))){if(this.m_destPoly=new Array(),_===1){if(w.m_jointype===e.JoinType.jtRound)for(var st=1,yt=0,Pt=1;Pt<=H;Pt++){this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+st*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+yt*a)));var Bt=st;st=st*this.m_cos-this.m_sin*yt,yt=Bt*this.m_sin+yt*this.m_cos;}else for(var st=-1,yt=-1,Pt=0;Pt<4;++Pt)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+st*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+yt*a))),st<0?st=1:yt<0?yt=1:st=-1;this.m_destPolys.push(this.m_destPoly);continue;}this.m_normals.length=0;for(var Pt=0;Pt<_-1;Pt++)this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[Pt],this.m_srcPoly[Pt+1]));if(w.m_endtype===e.EndType.etClosedLine||w.m_endtype===e.EndType.etClosedPolygon?this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[_-1],this.m_srcPoly[0])):this.m_normals.push(new e.DoublePoint1(this.m_normals[_-2])),w.m_endtype===e.EndType.etClosedPolygon){for(var kt=_-1,Pt=0;Pt<_;Pt++)kt=this.OffsetPoint(Pt,kt,w.m_jointype);this.m_destPolys.push(this.m_destPoly);}else if(w.m_endtype===e.EndType.etClosedLine){for(var kt=_-1,Pt=0;Pt<_;Pt++)kt=this.OffsetPoint(Pt,kt,w.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array();for(var jt=this.m_normals[_-1],Pt=_-1;Pt>0;Pt--)this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt-1].X,-this.m_normals[Pt-1].Y);this.m_normals[0]=new e.DoublePoint2(-jt.X,-jt.Y),kt=0;for(var Pt=_-1;Pt>=0;Pt--)kt=this.OffsetPoint(Pt,kt,w.m_jointype);this.m_destPolys.push(this.m_destPoly);}else{for(var kt=0,Pt=1;Pt<_-1;++Pt)kt=this.OffsetPoint(Pt,kt,w.m_jointype);var qt;if(w.m_endtype===e.EndType.etOpenButt){var Pt=_-1;qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[Pt].X+this.m_normals[Pt].X*a),e.ClipperOffset.Round(this.m_srcPoly[Pt].Y+this.m_normals[Pt].Y*a)),this.m_destPoly.push(qt),qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[Pt].X-this.m_normals[Pt].X*a),e.ClipperOffset.Round(this.m_srcPoly[Pt].Y-this.m_normals[Pt].Y*a)),this.m_destPoly.push(qt);}else{var Pt=_-1;kt=_-2,this.m_sinA=0,this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt].X,-this.m_normals[Pt].Y),w.m_endtype===e.EndType.etOpenSquare?this.DoSquare(Pt,kt):this.DoRound(Pt,kt);}for(var Pt=_-1;Pt>0;Pt--)this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt-1].X,-this.m_normals[Pt-1].Y);this.m_normals[0]=new e.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),kt=_-1;for(var Pt=kt-1;Pt>0;--Pt)kt=this.OffsetPoint(Pt,kt,w.m_jointype);w.m_endtype===e.EndType.etOpenButt?(qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*a)),this.m_destPoly.push(qt),qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*a)),this.m_destPoly.push(qt)):(kt=1,this.m_sinA=0,w.m_endtype===e.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly);}}}},e.ClipperOffset.prototype.Execute=function(){var a=arguments,P=a[0]instanceof e.PolyTree;if(P){var w=a[0],F=a[1];w.Clear(),this.FixOrientations(),this.DoOffset(F);var H=new e.Clipper(0);if(H.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),F>0)H.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var _=e.Clipper.GetBounds(this.m_destPolys),st=new e.Path();if(st.push(new e.IntPoint2(_.left-10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.top-10)),st.push(new e.IntPoint2(_.left-10,_.top-10)),H.AddPath(st,e.PolyType.ptSubject,!0),H.ReverseSolution=!0,H.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),w.ChildCount()===1&&w.Childs()[0].ChildCount()>0){var yt=w.Childs()[0];w.Childs()[0]=yt.Childs()[0],w.Childs()[0].m_Parent=w;for(var Pt=1;Pt<yt.ChildCount();Pt++)w.AddChild(yt.Childs()[Pt]);}else w.Clear();}}else{var w=a[0],F=a[1];e.Clear(w),this.FixOrientations(),this.DoOffset(F);var H=new e.Clipper(0);if(H.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),F>0)H.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var _=e.Clipper.GetBounds(this.m_destPolys),st=new e.Path();st.push(new e.IntPoint2(_.left-10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.top-10)),st.push(new e.IntPoint2(_.left-10,_.top-10)),H.AddPath(st,e.PolyType.ptSubject,!0),H.ReverseSolution=!0,H.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),w.length>0&&w.splice(0,1);}}},e.ClipperOffset.prototype.OffsetPoint=function(a,P,w){if(this.m_sinA=this.m_normals[P].X*this.m_normals[a].Y-this.m_normals[a].X*this.m_normals[P].Y,Math.abs(this.m_sinA*this.m_delta)<1){var F=this.m_normals[P].X*this.m_normals[a].X+this.m_normals[a].Y*this.m_normals[P].Y;if(F>0)return this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[P].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[P].Y*this.m_delta))),P;}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[P].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[P].Y*this.m_delta))),this.m_destPoly.push(new e.IntPoint1(this.m_srcPoly[a])),this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[a].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[a].Y*this.m_delta)));else switch(w){case e.JoinType.jtMiter:{var H=1+(this.m_normals[a].X*this.m_normals[P].X+this.m_normals[a].Y*this.m_normals[P].Y);H>=this.m_miterLim?this.DoMiter(a,P,H):this.DoSquare(a,P);break;}case e.JoinType.jtSquare:this.DoSquare(a,P);break;case e.JoinType.jtRound:this.DoRound(a,P);break;}return P=a,P;},e.ClipperOffset.prototype.DoSquare=function(a,P){var w=Math.tan(Math.atan2(this.m_sinA,this.m_normals[P].X*this.m_normals[a].X+this.m_normals[P].Y*this.m_normals[a].Y)/4);this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_delta*(this.m_normals[P].X-this.m_normals[P].Y*w)),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_delta*(this.m_normals[P].Y+this.m_normals[P].X*w)))),this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_delta*(this.m_normals[a].X+this.m_normals[a].Y*w)),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_delta*(this.m_normals[a].Y-this.m_normals[a].X*w))));},e.ClipperOffset.prototype.DoMiter=function(a,P,w){var F=this.m_delta/w;this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+(this.m_normals[P].X+this.m_normals[a].X)*F),e.ClipperOffset.Round(this.m_srcPoly[a].Y+(this.m_normals[P].Y+this.m_normals[a].Y)*F)));},e.ClipperOffset.prototype.DoRound=function(a,P){for(var w=Math.atan2(this.m_sinA,this.m_normals[P].X*this.m_normals[a].X+this.m_normals[P].Y*this.m_normals[a].Y),F=Math.max(e.Cast_Int32(e.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(w))),1),H=this.m_normals[P].X,_=this.m_normals[P].Y,st,yt=0;yt<F;++yt)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+H*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+_*this.m_delta))),st=H,H=H*this.m_cos-this.m_sin*_,_=st*this.m_sin+_*this.m_cos;this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[a].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[a].Y*this.m_delta)));},e.Error=function(a){try{throw new Error(a);}catch(P){alert(P.message);}},e.JS={},e.JS.AreaOfPolygon=function(a,P){return P||(P=1),e.Clipper.Area(a)/(P*P);},e.JS.AreaOfPolygons=function(a,P){P||(P=1);for(var w=0,F=0;F<a.length;F++)w+=e.Clipper.Area(a[F]);return w/(P*P);},e.JS.BoundsOfPath=function(a,P){return e.JS.BoundsOfPaths([a],P);},e.JS.BoundsOfPaths=function(a,P){P||(P=1);var w=e.Clipper.GetBounds(a);return w.left/=P,w.bottom/=P,w.right/=P,w.top/=P,w;},e.JS.Clean=function(F,P){if(!(F instanceof Array))return[];var w=F[0]instanceof Array,F=e.JS.Clone(F);if(typeof P!="number"||P===null)return e.Error("Delta is not a number in Clean()."),F;if(F.length===0||F.length===1&&F[0].length===0||P<0)return F;w||(F=[F]);for(var H=F.length,_,st,yt,Pt,Bt,kt,jt,qt=[],oe=0;oe<H;oe++)if(st=F[oe],_=st.length,_!==0){if(_<3){yt=st,qt.push(yt);continue;}for(yt=st,Pt=P*P,Bt=st[0],kt=1,jt=1;jt<_;jt++)(st[jt].X-Bt.X)*(st[jt].X-Bt.X)+(st[jt].Y-Bt.Y)*(st[jt].Y-Bt.Y)<=Pt||(yt[kt]=st[jt],Bt=st[jt],kt++);Bt=st[kt-1],(st[0].X-Bt.X)*(st[0].X-Bt.X)+(st[0].Y-Bt.Y)*(st[0].Y-Bt.Y)<=Pt&&kt--,kt<_&&yt.splice(kt,_-kt),yt.length&&qt.push(yt);}return!w&&qt.length?qt=qt[0]:!w&&qt.length===0?qt=[]:w&&qt.length===0&&(qt=[[]]),qt;},e.JS.Clone=function(a){if(!(a instanceof Array))return[];if(a.length===0)return[];if(a.length===1&&a[0].length===0)return[[]];var P=a[0]instanceof Array;P||(a=[a]);var w=a.length,F,H,_,st,yt=new Array(w);for(H=0;H<w;H++){for(F=a[H].length,st=new Array(F),_=0;_<F;_++)st[_]={X:a[H][_].X,Y:a[H][_].Y};yt[H]=st;}return P||(yt=yt[0]),yt;},e.JS.Lighten=function(a,P){if(!(a instanceof Array))return[];if(typeof P!="number"||P===null)return e.Error("Tolerance is not a number in Lighten()."),e.JS.Clone(a);if(a.length===0||a.length===1&&a[0].length===0||P<0)return e.JS.Clone(a);var w=a[0]instanceof Array;w||(a=[a]);var F,H,_,st,yt,Pt,Bt,kt,jt,qt,oe,me,Pe,De,or,Rr,en,jo=a.length,Go=P*P,gn=[];for(F=0;F<jo;F++)if(_=a[F],Pt=_.length,Pt!==0){for(st=0;st<1e6;st++){for(yt=[],Pt=_.length,_[Pt-1].X!==_[0].X||_[Pt-1].Y!==_[0].Y?(me=1,_.push({X:_[0].X,Y:_[0].Y}),Pt=_.length):me=0,oe=[],H=0;H<Pt-2;H++)Bt=_[H],jt=_[H+1],kt=_[H+2],Rr=Bt.X,en=Bt.Y,Pe=kt.X-Rr,De=kt.Y-en,(Pe!==0||De!==0)&&(or=((jt.X-Rr)*Pe+(jt.Y-en)*De)/(Pe*Pe+De*De),or>1?(Rr=kt.X,en=kt.Y):or>0&&(Rr+=Pe*or,en+=De*or)),Pe=jt.X-Rr,De=jt.Y-en,qt=Pe*Pe+De*De,qt<=Go&&(oe[H+1]=1,H++);for(yt.push({X:_[0].X,Y:_[0].Y}),H=1;H<Pt-1;H++)oe[H]||yt.push({X:_[H].X,Y:_[H].Y});if(yt.push({X:_[Pt-1].X,Y:_[Pt-1].Y}),me&&_.pop(),oe.length)_=yt;else break;}Pt=yt.length,yt[Pt-1].X===yt[0].X&&yt[Pt-1].Y===yt[0].Y&&yt.pop(),yt.length>2&&gn.push(yt);}return w||(gn=gn[0]),_typeof(gn)>"u"&&(gn=[]),gn;},e.JS.PerimeterOfPath=function(a,P,w){if(_typeof(a)>"u")return 0;var F=Math.sqrt,H=0,_,st,yt=0,Pt=0,Bt=0,kt=0,jt=a.length;if(jt<2)return 0;for(P&&(a[jt]=a[0],jt++);--jt;)_=a[jt],yt=_.X,Pt=_.Y,st=a[jt-1],Bt=st.X,kt=st.Y,H+=F((yt-Bt)*(yt-Bt)+(Pt-kt)*(Pt-kt));return P&&a.pop(),H/w;},e.JS.PerimeterOfPaths=function(a,P,w){w||(w=1);for(var F=0,H=0;H<a.length;H++)F+=e.JS.PerimeterOfPath(a[H],P,w);return F;},e.JS.ScaleDownPath=function(a,P){var w,F;for(P||(P=1),w=a.length;w--;)F=a[w],F.X=F.X/P,F.Y=F.Y/P;},e.JS.ScaleDownPaths=function(a,P){var w,F,H;for(P||(P=1),w=a.length;w--;)for(F=a[w].length;F--;)H=a[w][F],H.X=H.X/P,H.Y=H.Y/P;},e.JS.ScaleUpPath=function(a,P){var w,F,H=Math.round;for(P||(P=1),w=a.length;w--;)F=a[w],F.X=H(F.X*P),F.Y=H(F.Y*P);},e.JS.ScaleUpPaths=function(a,P){var w,F,H,_=Math.round;for(P||(P=1),w=a.length;w--;)for(F=a[w].length;F--;)H=a[w][F],H.X=_(H.X*P),H.Y=_(H.Y*P);},e.ExPolygons=function(){return[];},e.ExPolygon=function(){this.outer=null,this.holes=null;},e.JS.AddOuterPolyNodeToExPolygons=function(a,P){var w=new e.ExPolygon();w.outer=a.Contour();var F=a.Childs(),H=F.length;w.holes=new Array(H);var _,st,yt,Pt,Bt,kt;for(yt=0;yt<H;yt++)for(_=F[yt],w.holes[yt]=_.Contour(),Pt=0,Bt=_.Childs(),kt=Bt.length;Pt<kt;Pt++)st=Bt[Pt],e.JS.AddOuterPolyNodeToExPolygons(st,P);P.push(w);},e.JS.ExPolygonsToPaths=function(a){var P,w,F,H,_=new e.Paths();for(P=0,F=a.length;P<F;P++)for(_.push(a[P].outer),w=0,H=a[P].holes.length;w<H;w++)_.push(a[P].holes[w]);return _;},e.JS.PolyTreeToExPolygons=function(a){var P=new e.ExPolygons(),w,F,H,_;for(F=0,H=a.Childs(),_=H.length;F<_;F++)w=H[F],e.JS.AddOuterPolyNodeToExPolygons(w,P);return P;};})();})(mh);var z2=mh.exports,Qr=/* @__PURE__ */Ln(z2);function yh(i,e){var t=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0.01;return Math.abs(i[0]-e[0])<t&&Math.abs(i[1]-e[1])<t;}function $2(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(i.length===0)return[];var t=[[i[0][0],i[0][1]]];for(var r=1;r<i.length;r++)yh([i[r][0],i[r][1]],t[t.length-1],e)||t.push([i[r][0],i[r][1]]);return t;}function j2(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(i.length<=2)return i;var t=i[0],r=i[i.length-1];return yh(t,r,e)?i.slice(0,-1):i;}function G2(i){var e=i.reduce(function(r,n){return r+n[0];},0)/i.length,t=i.reduce(function(r,n){return r+n[1];},0)/i.length;return[e,t];}function du(i,e){return Math.atan2(e[1]-i[1],e[0]-i[0]);}function H2(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(i.length<=2)return i;var t=[];var _iterator16=_createForOfIteratorHelper(i),_step16;try{var _loop3=function _loop3(){var n=_step16.value;t.some(function(c){return Math.abs(c[0]-n[0])<e&&Math.abs(c[1]-n[1])<e;})||t.push([n[0],n[1]]);};for(_iterator16.s();!(_step16=_iterator16.n()).done;){_loop3();}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}var r=G2(t);return t.sort(function(n,s){var c=du(r,n),l=du(r,s);return c-l;});}function k2(i,e){var t=e[0].x<e[e.length-1].x;return i.map(function(n){var c=n.map(function(l){var f=-1,h=1/0,m=0;for(var u=0;u<e.length;u++){var y=e[u],T=Math.sqrt(Math.pow(y.x-l[0],2)+Math.pow(y.y-l[1],2));T<h&&(h=T,f=u,m=y.z);}return{point:l,index:f,bestZ:m};}).sort(function(l,f){return l.index-f.index;}).map(function(l){return[].concat(_toConsumableArray(l.point),[l.bestZ]);});return t&&c[0][0]>c[c.length-1][0]||!t&&c[0][0]<c[c.length-1][0]?c.reverse():c;}).sort(function(n,s){var c=n[0][0],l=s[0][0];return t?c-l:l-c;});}function K2(i,e){var t=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0.01;var n=i.map(function(u){return[u.x,u.y];}),s=function s(u,y){return u.map(function(_ref166){var _ref167=_slicedToArray(_ref166,2),T=_ref167[0],E=_ref167[1];return{X:Math.round(T*y),Y:Math.round(E*y)};});},c=new Qr.ClipperOffset();c.AddPath(s(n,1e3),Qr.JoinType.jtRound,Qr.EndType.etOpenButt);var l=[];c.Execute(l,1);var f=new Qr.Clipper();f.AddPaths(l,Qr.PolyType.ptSubject,!0),e.forEach(function(u){f.AddPath(s(u,1e3),Qr.PolyType.ptClip,!0);});var h=new Qr.Paths();f.Execute(Qr.ClipType.ctDifference,h,Qr.PolyFillType.pftNonZero,Qr.PolyFillType.pftNonZero);var m=h.map(function(u){return j2(H2($2(u.map(function(y){return[y.X/1e3,y.Y/1e3];}),t),t),t);}).filter(function(u){return u.length>=2;});return k2(m,i);}var Ph=/*#__PURE__*/function(_$t){function Ph(t){var _this62;_classCallCheck(this,Ph);_this62=_callSuper(this,Ph,[t]);dt(_this62,"canRotate",!0);dt(_this62,"scaleType",Ae.all);dt(_this62,"toolsType",Tt.Pencil);dt(_this62,"syncTimestamp");dt(_this62,"syncIndex",0);dt(_this62,"tmpPoints",[]);dt(_this62,"MAX_REPEAR",10);/** 合并原始点的灵敏度 */dt(_this62,"uniThickness");dt(_this62,"workOptions");dt(_this62,"centerPos",[0,0]);_this62.workOptions=t.toolsOpt,_this62.uniThickness=_this62.MAX_REPEAR/_this62.workOptions.thickness/10,_this62.syncTimestamp=0;return _this62;}/** 批量合并消费本地数据,返回绘制结果 */_inherits(Ph,_$t);return _createClass(Ph,[{key:"combineConsume",value:function combineConsume(){var l;var t=(l=this.workId)==null?void 0:l.toString();if(this.tmpPoints.length<2)return{type:xt.None};var r=this.transformDataAll(!0),n={name:t};var s;var c=this.drawLayer||this.fullLayer;return r.length&&(s=this.draw({attrs:n,tasks:r,replaceId:t,layer:c})),{rect:s,type:xt.DrawWork,dataType:Vt.Local};}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(Ph,"setWorkOptions",this,3)([t]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(t){var _this63=this;var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.drawCount,f=t.removeDrawCount,h=t.isSimpleWorker,m=r.workId,u=r.syncUnitTime;u&&(this.syncUnitTime=u);var _this$transformData=this.transformData(r,!1),y=_this$transformData.tasks,T=_this$transformData.effects,E=_this$transformData.consumeIndex;this.syncIndex=Math.min(this.syncIndex,E,Math.max(0,this.tmpPoints.length-2));var C={name:m,id:er(l)&&l.toString()||void 0};var x,I=!1;var d=this.syncIndex;if(this.syncTimestamp===0&&(this.syncTimestamp=Date.now()),y.length&&(y[0].taskId-this.syncTimestamp>this.syncUnitTime&&(I=!0,this.syncTimestamp=y[0].taskId,this.syncIndex=this.tmpPoints.length),s||c||h)){var p=n?this.fullLayer:this.drawLayer||this.fullLayer;x=this.draw({attrs:C,tasks:y,effects:T,layer:p,removeDrawCount:f});}if(h){var _p13=[];return this.tmpPoints.slice(d).forEach(function(S){_p13.push(S.x,S.y,_this63.computRadius(S.z,_this63.workOptions.thickness));}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.DrawWork,dataType:Vt.Local,op:I?_p13:void 0,index:I?d*3:void 0,rect:x,updateNodeOpt:{useAnimation:!0}});}if(s)return E>10&&this.tmpPoints.splice(0,E-10),{rect:x,type:xt.DrawWork,dataType:Vt.Local};var v=[];return this.tmpPoints.slice(d).forEach(function(p){v.push(p.x,p.y,_this63.computRadius(p.z,_this63.workOptions.thickness));}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.DrawWork,dataType:Vt.Local,rect:x,op:I?v:void 0,index:I?d*3:void 0,updateNodeOpt:{useAnimation:!0}});}},{key:"consumeAll",value:function consumeAll(t){var m;var r=this.workId;if(t.data){var _t$data=t.data,u=_t$data.op,y=_t$data.workState;u!=null&&u.length&&y===te.Done&&this.workOptions.strokeType===we.Stroke&&this.updateTempPointsWithPressureWhenDone(u);}var n=this.transformDataAll(!0),s={name:r};var c;var l=this.fullLayer;if(n.length&&(c=this.draw({attrs:s,tasks:n,replaceId:r,layer:l})),this.tmpPoints.length<2)return this.replace(l,r),{type:xt.RemoveNode,removeIds:[r],rect:c};var f=[];this.tmpPoints.map(function(u){f.push(u.x,u.y,u.z);}),this.syncTimestamp=0,delete this.workOptions.syncUnitTime;var h=gr(f);return(m=this.vNodes)==null||m.setInfo(r,{rect:c,op:f,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:c&&$t.getCenterPos(c,l)}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{rect:c,type:xt.FullWork,dataType:Vt.Local,ops:h,updateNodeOpt:{pos:this.centerPos,useAnimation:!0}});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0;}},{key:"consumeService",value:function consumeService(t){var u,y;var r=t.op,n=t.isFullWork,s=t.replaceId,_t$workState=t.workState,c=_t$workState===void 0?te.Done:_t$workState;this.tmpPoints.length=0;for(var T=0;T<r.length;T+=3){var E=new Jt(r[T],r[T+1],r[T+2]);if(this.tmpPoints.length>0){var C=this.tmpPoints[this.tmpPoints.length-1],x=pt.Sub(E,C).uni();E.setv(x);}this.tmpPoints.push(E);}if(this.tmpPoints.length<2)return;var l=this.transformDataAll(!0),f=(u=this.workId)==null?void 0:u.toString(),h={name:f};var m;if(f&&l.length){var _T9=n?this.fullLayer:this.drawLayer||this.fullLayer;m=this.draw({attrs:h,tasks:l,replaceId:s,layer:_T9,isDrawEraserlines:c===te.Done}),(y=this.vNodes)==null||y.setInfo(f,{rect:m,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:m&&$t.getCenterPos(m,_T9)});}return m;}},{key:"computPencilPoints",value:function computPencilPoints(t){var _this64=this;var r=[],n=t.op,s=t.eraserPolylines,c=t.eraserThickness;this.tmpPoints.length=0;for(var f=0;f<n.length;f+=3){var h=new Jt(n[f],n[f+1],n[f+2]);if(this.tmpPoints.length>0){var m=this.tmpPoints[this.tmpPoints.length-1],u=pt.Sub(h,m).uni();h.setv(u);}this.tmpPoints.push(h);}if(this.tmpPoints.length<2)return;var l=this.transformDataAll(!0);if(l.length){var _loop4=function _loop4(){var _l$_f=l[_f5],h=_l$_f.pos,m=_l$_f.points,u=m.map(function(E){return E.point.addXY(h[0],h[1]);}),y=[];var _iterator17=_createForOfIteratorHelper(s),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var E=_step17.value;var C=[];for(var _I33=0;_I33<E.length;_I33+=2){var _d30=new Jt(E[_I33],E[_I33+1]);if(C.length>0){var v=C[C.length-1].point,p=pt.Sub(_d30,v).uni();_d30.setv(p);}C.push({point:_d30,radius:c});}var _this64$computStroke=_this64.computStroke(C,!1),x=_this64$computStroke.ps;y.push(x.map(function(I){return I.XY;}));}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}K2(u,y,0.01).forEach(function(E){r.push(E.map(function(C){return[C[0],C[1],C[2]];}).flat(1));});};for(var _f5=0;_f5<l.length;_f5++){_loop4();}}return r;}},{key:"transformDataAll",value:function transformDataAll(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.getTaskPoints(this.tmpPoints,t&&this.workOptions.thickness||void 0);}},{key:"draw",value:function draw(t){var _this65=this;var r=t.attrs,n=t.tasks,s=t.replaceId,c=t.effects,l=t.layer,f=t.removeDrawCount,_t$isDrawEraserlines=t.isDrawEraserlines,h=_t$isDrawEraserlines===void 0?!0:_t$isDrawEraserlines,_this$workOptions=this.workOptions,m=_this$workOptions.strokeColor,u=_this$workOptions.strokeType,y=_this$workOptions.thickness,T=_this$workOptions.zIndex,E=_this$workOptions.scale,C=_this$workOptions.rotate,x=_this$workOptions.translate,I=_this$workOptions.eraserlines,d=_this$workOptions.lineCap,v=_this$workOptions.lineDash;c!=null&&c.size&&(c.forEach(function(U){var M;(M=l.getElementById(U+""))==null||M.remove();}),c.clear()),f&&this.removeDrawCountNodes(l,f);var p;var S=[],A=l.worldPosition,R=l.worldScaling;for(var U=0;U<n.length;U++){var _n$U=n[U],M=_n$U.pos,W=_n$U.points,_this$computDrawPoint=this.computDrawPoints(W),Y=_this$computDrawPoint.ps,B=_this$computDrawPoint.rect;var N=void 0;var G=W.length===1;u===we.Stroke||G?N=En(Y,!0):N=En(Y,!1);var J={pos:M,d:N,fillColor:u===we.Stroke||G?m:void 0,lineDash:G?void 0:u===we.Dotted?[v&&v[0]||1,(v&&v[1]||2)*y]:u===we.LongDotted?[(v&&v[0]||1)*y,(v&&v[1]||2)*y]:void 0,strokeColor:m,lineCap:G?void 0:d,lineWidth:u===we.Stroke||G?0:y};p=Zt(p,{x:Math.floor((B.x+M[0])*R[0]+A[0]-$t.SafeBorderPadding),y:Math.floor((B.y+M[1])*R[1]+A[1]-$t.SafeBorderPadding),w:Math.floor(B.w*R[0]+2*$t.SafeBorderPadding),h:Math.floor(B.h*R[1]+2*$t.SafeBorderPadding)}),S.push(J);}E&&(r.scale=E),C&&(r.rotate=C),x&&(r.translate=x);var D=new mr();if(p){this.centerPos=$t.getCenterPos(p,l);var _U11=u===we.Stroke&&!I;D.attr(_objectSpread(_objectSpread({},r),{},{normalize:!0,anchor:[0.5,0.5],bgcolor:_U11?m:void 0,pos:this.centerPos,size:[(p.w-2*$t.SafeBorderPadding)/R[0],(p.h-2*$t.SafeBorderPadding)/R[1]],zIndex:T}));var _M9=S.map(function(W){return W.pos=[W.pos[0]-_this65.centerPos[0],W.pos[1]-_this65.centerPos[1]],new Mn(W);});D.append.apply(D,_toConsumableArray(_M9)),_U11&&D.seal(),I&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:D,eraserlines:I,pos:this.centerPos,layer:l},h)),this.replace(l,s,D);}if(E||C||x){var _U12=D==null?void 0:D.getBoundingClientRect();_U12&&(p={x:Math.floor(_U12.x-$t.SafeBorderPadding),y:Math.floor(_U12.y-$t.SafeBorderPadding),w:Math.floor(_U12.width+$t.SafeBorderPadding*2),h:Math.floor(_U12.height+$t.SafeBorderPadding*2)});}return this.isDelete&&D.setAttribute("opacity",0),p;}},{key:"computDrawPoints",value:function computDrawPoints(t){return this.workOptions.strokeType===we.Stroke||t.length===1?this.computStroke(t):this.computNomal(t);}},{key:"computNomal",value:function computNomal(t){var r=this.workOptions.thickness;var n=t.map(function(s){return r=Math.max(r,s.radius),s.point;});return{ps:n,rect:Re(n,r)};}},{key:"computStroke",value:function computStroke(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return t.length===1?this.computDotStroke(t[0]):this.computLineStroke(t,r);}},{key:"computLineStroke",value:function computLineStroke(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var n=[],s=[];for(var f=0;f<t.length;f++){var _t$f=t[f],h=_t$f.point,m=_t$f.radius;var u=h.v;f===0&&t.length>1&&(u=t[f+1].point.v);var y=pt.Per(u).mul(m);n.push(Jt.Sub(h,y)),s.push(Jt.Add(h,y));}var c=t[t.length-1];if(r){var _f6=Jt.GetSemicircleStroke(c.point,n[n.length-1],-1,8),_h4=Jt.GetSemicircleStroke(t[0].point,s[0],-1,8),_m7=n.concat(_f6,s.reverse(),_h4);return{ps:_m7,rect:Re(_m7)};}var l=n.concat(s.reverse());return{ps:l,rect:Re(l)};}},{key:"computDotStroke",value:function computDotStroke(t){var r=t.point,n=t.radius,s={x:r.x-n,y:r.y-n,w:n*2,h:n*2};return{ps:Jt.GetDotStroke(r,n,8),rect:s};}},{key:"transformData",value:function transformData(t,r){var n=t.op,s=t.workState;var c=this.tmpPoints.length-1,l=[];if(n!=null&&n.length&&s){var _this$workOptions2=this.workOptions,f=_this$workOptions2.strokeType,h=_this$workOptions2.thickness,m=/* @__PURE__ */new Set();c=f===we.Stroke?this.updateTempPointsWithPressure(n,h,m):this.updateTempPoints(n,h,m);var u=r?this.tmpPoints:this.tmpPoints.slice(c);return l=this.getTaskPoints(u,h),{tasks:l,effects:m,consumeIndex:c};}return{tasks:l,consumeIndex:c};}/** 压力渐变公式 */},{key:"computRadius",value:function computRadius(t,r){return t*0.03*r+r*0.5;}},{key:"getMinZ",value:function getMinZ(t,r){return((r||Math.max(1,Math.floor(t*0.3)))-t*0.5)*100/t/3;}},{key:"getTaskPoints",value:function getTaskPoints(t,r){var u;var n=[];if(t.length===0)return[];var s=0,c=t[0].x,l=t[0].y,f=[c,l],h=[],m=t[0].t;for(;s<t.length;){var y=t[s],T=y.x-c,E=y.y-l,C=y.z,x=r?this.computRadius(C,r):C;if(h.push({point:new Jt(T,E,C,t[s].v),radius:x}),s>0&&s<t.length-1){var _I34=t[s].getAngleByPoints(t[s-1],t[s+1]);if(_I34<60||_I34>300){var _d31=(u=h.pop())==null?void 0:u.point.clone();_d31&&n.push({taskId:m,pos:f,points:[].concat(_toConsumableArray(h),[{point:_d31,radius:x}])}),c=t[s].x,l=t[s].y,f=[c,l];var v=y.x-c,p=y.y-l;h=[{point:new Jt(v,p,C),radius:x}],m=Date.now();}}s++;}return n.push({taskId:m,pos:f,points:h}),n;}},{key:"updateTempPointsWithPressure",value:function updateTempPointsWithPressure(t,r,n){var s=Date.now(),c=this.tmpPoints.length;var l=c;for(var h=0;h<t.length;h+=2){l=Math.min(l,c);var m=this.tmpPoints.length,u=new Jt(t[h],t[h+1]);if(m===0){this.tmpPoints.push(u);continue;}var y=m-1,T=this.tmpPoints[y],E=pt.Sub(u,T).uni();if(u.isNear(T,r)){if(T.z<this.MAX_REPEAR){if(T.setz(Math.min(T.z+1,this.MAX_REPEAR)),l=Math.min(l,y),m>1){var _I35=m-1;for(;_I35>0;){var _d32=this.tmpPoints[_I35].distance(this.tmpPoints[_I35-1]),v=Math.max(this.tmpPoints[_I35].z-this.uniThickness*_d32,0);if(this.tmpPoints[_I35-1].z>=v)break;this.tmpPoints[_I35-1].setz(v),l=Math.min(l,_I35-1),_I35--;}}}else l=1/0;continue;}u.setv(E);var C=u.distance(T),x=Math.max(T.z-this.uniThickness*C,0);m>1&&pt.Equals(E,T.v,0.02)&&(x>0||T.z<=0)&&(n&&T.t&&n.add(T.t),this.tmpPoints.pop(),l=Math.min(y,l)),u.setz(x),this.tmpPoints.push(u);}if(l===1/0)return this.tmpPoints.length;var f=c;if(l===c){f=Math.max(f-1,0);var _h5=this.tmpPoints[f].t;_h5&&(n==null||n.add(_h5));}else{var _h6=c-1;for(f=l;_h6>=0;){var _m8=this.tmpPoints[_h6].t;if(_m8&&(n==null||n.add(_m8),_h6<=l)){f=_h6,_h6=-1;break;}_h6--;}}return this.tmpPoints[f].setT(s),f;}},{key:"updateTempPoints",value:function updateTempPoints(t,r,n){var h;var s=Date.now(),c=this.tmpPoints.length;var l=c;for(var m=0;m<t.length;m+=2){var u=this.tmpPoints.length,y=new Jt(t[m],t[m+1]);if(u===0){this.tmpPoints.push(y);continue;}var T=u-1,E=this.tmpPoints[T],C=pt.Sub(y,E).uni();if(y.isNear(E,r/2)){l=Math.min(T,l);continue;}pt.Equals(C,E.v,0.02)&&(n&&E.t&&n.add(E.t),this.tmpPoints.pop(),l=Math.min(T,l)),y.setv(C),this.tmpPoints.push(y);}var f=c;if(l===c){f=Math.max(f-1,0);var _m9=this.tmpPoints[f].t;_m9&&(n==null||n.add(_m9));}else{var _m10=Math.min(c-1,l);for(f=l;_m10>=0;){var _u4=(h=this.tmpPoints[_m10])==null?void 0:h.t;if(_u4&&(n==null||n.add(_u4),_m10<=l)){f=_m10,_m10=-1;break;}_m10--;}}return this.tmpPoints[f].setT(s),f;}},{key:"updateTempPointsWithPressureWhenDone",value:function updateTempPointsWithPressureWhenDone(t){var r=this.workOptions.thickness,n=t.length,s=this.getMinZ(r);for(var c=0;c<n;c+=2){var l=this.tmpPoints.length,f=new Jt(t[c],t[c+1]);if(l===0){this.tmpPoints.push(f);continue;}var h=l-1,m=this.tmpPoints[h],u=pt.Sub(f,m).uni(),y=f.distance(m);if(l>1&&m.z===s)break;if(f.isNear(m,r/2)){if(n<3&&m.z<this.MAX_REPEAR&&(m.setz(Math.min(m.z+1,this.MAX_REPEAR)),l>1)){var E=l-1;for(;E>0;){var C=this.tmpPoints[E].distance(this.tmpPoints[E-1]),x=Math.max(this.tmpPoints[E].z-this.uniThickness*C,-r/4);if(this.tmpPoints[E-1].z>=x)break;this.tmpPoints[E-1].setz(x),E--;}}continue;}f.setv(u);var T=Math.max(m.z-this.uniThickness*y,s);l>1&&pt.Equals(u,m.v,0.02)&&m.z<=0&&this.tmpPoints.pop(),f.setz(T),this.tmpPoints.push(f);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var h,m;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.strokeType,f=s.get(r.name);return c&&(r.tagName==="GROUP"?nE(r)?r.setAttribute("bgcolor",c):r.children.forEach(function(u){u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c);}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&f!=null&&f.opt&&(m=f.opt)!=null&&m.strokeType&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),$t.updateNodeOpt(t);}}]);}($t);var Sh=/*#__PURE__*/function(_$t2){function Sh(t){var _this66;_classCallCheck(this,Sh);_this66=_callSuper(this,Sh,[t]);dt(_this66,"toolsType",Tt.LaserPen);dt(_this66,"canRotate",!1);dt(_this66,"scaleType",Ae.none);dt(_this66,"syncTimestamp");dt(_this66,"syncIndex",0);dt(_this66,"tmpPoints",[]);dt(_this66,"workOptions");dt(_this66,"consumeIndex",0);_this66.workOptions=t.toolsOpt,_this66.syncTimestamp=0;return _this66;}_inherits(Sh,_$t2);return _createClass(Sh,[{key:"combineConsume",value:function combineConsume(){}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(Sh,"setWorkOptions",this,3)([t]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(t){var r=t.data,n=t.isSubWorker,s=r.workId,c=r.op,l=r.syncUnitTime;if((c==null?void 0:c.length)===0)return{type:xt.None};if(l&&(this.syncUnitTime=l),this.updateTempPoints(c||[]),this.consumeIndex>this.tmpPoints.length-4)return{type:xt.None};var _this$workOptions3=this.workOptions,f=_this$workOptions3.strokeColor,h=_this$workOptions3.thickness,m=_this$workOptions3.strokeType,u=_this$workOptions3.lineDash,y=_this$workOptions3.lineCap,T=Re(this.tmpPoints,h);var E=!1;var C=this.syncIndex,x=this.tmpPoints.slice(this.consumeIndex);this.consumeIndex=this.tmpPoints.length-1,this.syncTimestamp===0&&(this.syncTimestamp=Date.now());var I={name:s==null?void 0:s.toString(),opacity:1,lineDash:m===we.Dotted?[u&&u[0]||1,(u&&u[1]||2)*h]:m===we.LongDotted?[(u&&u[0]||1)*h,(u&&u[1]||2)*h]:void 0,strokeColor:f,lineCap:y,lineWidth:h,anchor:[0.5,0.5]},d=this.getTaskPoints(x);if(d.length){var p=Date.now();p-this.syncTimestamp>this.syncUnitTime&&(E=!0,this.syncTimestamp=p,this.syncIndex=this.tmpPoints.length),n&&this.draw({attrs:I,tasks:d,isDot:!1,layer:this.drawLayer||this.fullLayer});}var v=[];return this.tmpPoints.slice(C).forEach(function(p){v.push(p.x,p.y);}),_objectSpread({rect:{x:T.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:T.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:T.w*this.fullLayer.worldScaling[0],h:T.h*this.fullLayer.worldScaling[1]},type:xt.DrawWork,dataType:Vt.Local,op:E?v:void 0,index:E?C*2:void 0},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var c;var t=(c=this.workId)==null?void 0:c.toString();var r;if(this.tmpPoints.length-1>this.consumeIndex){var l=this.tmpPoints.slice(this.consumeIndex);var f=l.length===1,_this$workOptions4=this.workOptions,h=_this$workOptions4.strokeColor,m=_this$workOptions4.thickness,u=_this$workOptions4.strokeType;if(f){var E=this.computDotStroke({point:l[0],radius:m/2});l=E.ps,r=E.rect;}else r=Re(this.tmpPoints,m);var y={name:t==null?void 0:t.toString(),fillColor:f?h:void 0,opacity:1,lineDash:u===we.Dotted&&!f?[1,m*2]:u===we.LongDotted&&!f?[m,m*2]:void 0,strokeColor:h,lineCap:f?void 0:"round",lineWidth:f?0:m,anchor:[0.5,0.5]},T=this.getTaskPoints(l);T.length&&this.draw({attrs:y,tasks:T,isDot:f,layer:this.drawLayer||this.fullLayer});}var n=[];this.tmpPoints.forEach(function(l){n.push(l.x,l.y);});var s=gr(n);return _objectSpread({rect:r&&{x:r.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:r.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:r.w*this.fullLayer.worldScaling[0],h:r.h*this.fullLayer.worldScaling[1]},type:xt.FullWork,dataType:Vt.Local,ops:s,index:this.syncIndex*2},this.baseConsumeResult);}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0;}},{key:"consumeService",value:function consumeService(t){var C;var r=t.op,n=t.replaceId,s=t.isFullWork,_this$workOptions5=this.workOptions,c=_this$workOptions5.strokeColor,l=_this$workOptions5.thickness,f=_this$workOptions5.strokeType;if(!r.length){var x=Re(this.tmpPoints,l);return{x:x.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:x.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:x.w*this.fullLayer.worldScaling[0],h:x.h*this.fullLayer.worldScaling[1]};}var h=Math.max(0,this.tmpPoints.length-1);this.updateTempPoints(r||[]);var m,u=this.tmpPoints.slice(h);var y=u.length===1;if(y){var _x34=this.computDotStroke({point:u[0],radius:l/2});u=_x34.ps,m=_x34.rect;}else m=Re(this.tmpPoints,l);var T={name:(C=this.workId)==null?void 0:C.toString(),fillColor:y?c:void 0,opacity:1,lineDash:f===we.Dotted&&!y?[1,l*2]:f===we.LongDotted&&!y?[l,l*2]:void 0,strokeColor:c,lineCap:y?void 0:"round",lineWidth:y?0:l,anchor:[0.5,0.5]},E=this.getTaskPoints(u);if(E.length){var _x35=s?this.fullLayer:this.drawLayer||this.fullLayer;this.draw({attrs:T,tasks:E,isDot:y,replaceId:n,layer:_x35});}return{x:m.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:m.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:m.w*this.fullLayer.worldScaling[0],h:m.h*this.fullLayer.worldScaling[1]};}},{key:"computDotStroke",value:function computDotStroke(t){var r=t.point,n=t.radius,s={x:r.x-n,y:r.y-n,w:n*2,h:n*2};return{ps:Jt.GetDotStroke(r,n,8),rect:s};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=this.tmpPoints.length;for(var n=0;n<t.length;n+=2){if(r){var s=this.tmpPoints.slice(-1)[0];s&&s.x===t[n]&&s.y===t[n+1]&&this.tmpPoints.pop();}this.tmpPoints.push(new Jt(t[n],t[n+1]));}}},{key:"draw",value:function(){var _draw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(t){var _this67=this;var r,n,s,c,l,_iterator18,_step18,_loop5;return _regeneratorRuntime().wrap(function _callee21$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:r=t.attrs,n=t.tasks,s=t.isDot,c=t.layer,l=this.workOptions.duration;_iterator18=_createForOfIteratorHelper(n);_context23.prev=2;_loop5=/*#__PURE__*/_regeneratorRuntime().mark(function _loop5(){var f,h,m,u,y,_this67$workOptions,T,E,C,_c$getResolution,x,_I36;return _regeneratorRuntime().wrap(function _loop5$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:f=_step18.value;h=new Mn(),m=f.pos,u=f.points;s?y=En(u,!0):y=En(u,!1),h.attr(_objectSpread(_objectSpread({},r),{},{pos:m,d:y}));_this67$workOptions=_this67.workOptions,T=_this67$workOptions.vertex,E=_this67$workOptions.fragment;if(T&&E){C=c.renderer.createProgram({vertex:T,fragment:E}),_c$getResolution=c.getResolution(),x=_c$getResolution.width,_I36=_c$getResolution.height;h.setUniforms({u_time:0,u_resolution:[x,_I36]}),h.setProgram(C);}c.appendChild(h),h.transition(l).attr({scale:s?[0.1,0.1]:[1,1],lineWidth:s?0:1}).then(function(){h.remove();});case 6:case"end":return _context22.stop();}},_loop5);});_iterator18.s();case 5:if((_step18=_iterator18.n()).done){_context23.next=9;break;}return _context23.delegateYield(_loop5(),"t0",7);case 7:_context23.next=5;break;case 9:_context23.next=14;break;case 11:_context23.prev=11;_context23.t1=_context23["catch"](2);_iterator18.e(_context23.t1);case 14:_context23.prev=14;_iterator18.f();return _context23.finish(14);case 17:case"end":return _context23.stop();}},_callee21,this,[[2,11,14,17]]);}));function draw(_x36){return _draw2.apply(this,arguments);}return draw;}()},{key:"getTaskPoints",value:function getTaskPoints(t){var h;var r=[];if(t.length===0)return[];var n=0,s=t[0].x,c=t[0].y,l=[s,c],f=[];for(;n<t.length;){var m=t[n],u=m.x-s,y=m.y-c;if(f.push(new Jt(u,y)),n>0&&n<t.length-1){var T=t[n].getAngleByPoints(t[n-1],t[n+1]);if(T<60||T>300){var E=(h=f.pop())==null?void 0:h.clone();E&&r.push({pos:l,points:[].concat(_toConsumableArray(f),[E])}),s=t[n].x,c=t[n].y,l=[s,c];var C=m.x-s,x=m.y-c;f=[new Jt(C,x)];}}n++;}return r.push({pos:l,points:f}),r;}},{key:"removeLocal",value:function removeLocal(){}},{key:"removeService",value:function removeService(t){var r;var n=[];return this.fullLayer.getElementsByName(t).forEach(function(s){if(s.name===t){var c=s.getBoundingClientRect();r=Zt(r,{x:c.x,y:c.y,w:c.width,h:c.height}),n.push(s);}}),n.length&&n.forEach(function(s){return s.remove();}),r;}}]);}($t);var V2=no;no.polyline=no;no.polygon=Z2;function no(i,e,t){var r=i.length,n=ui(i[0],e),s=[],c,l,f,h,m;for(t||(t=[]),c=1;c<r;c++){for(l=i[c-1],f=i[c],h=m=ui(f,e);;)if(n|h){if(n&h)break;n?(l=al(l,f,n,e),n=ui(l,e)):(f=al(l,f,h,e),h=ui(f,e));}else{s.push(l),h!==m?(s.push(f),c<r-1&&(t.push(s),s=[])):c===r-1&&s.push(f);break;}n=m;}return s.length&&t.push(s),t;}function Z2(i,e){var t,r,n,s,c,l,f;for(r=1;r<=8;r*=2){for(t=[],n=i[i.length-1],s=!(ui(n,e)&r),c=0;c<i.length;c++)l=i[c],f=!(ui(l,e)&r),f!==s&&t.push(al(n,l,r,e)),f&&t.push(l),n=l,s=f;if(i=t,!i.length)break;}return t;}function al(i,e,t,r){return t&8?[i[0]+(e[0]-i[0])*(r[3]-i[1])/(e[1]-i[1]),r[3]]:// top
|
|
403
|
+
decompressFromEncodedURIComponent:function decompressFromEncodedURIComponent(f){return f==null?"":f==""?null:(f=f.replace(/ /g,"+"),l._decompress(f.length,32,function(h){return c(n,f.charAt(h));}));},compress:function compress(f){return l._compress(f,16,function(h){return t(h);});},_compress:function _compress(f,h,m){if(f==null)return"";var u,y,T={},E={},C="",x="",I="",d=2,v=3,p=2,S=[],A=0,R=0,D;for(D=0;D<f.length;D+=1)if(C=f.charAt(D),Object.prototype.hasOwnProperty.call(T,C)||(T[C]=v++,E[C]=!0),x=I+C,Object.prototype.hasOwnProperty.call(T,x))I=x;else{if(Object.prototype.hasOwnProperty.call(E,I)){if(I.charCodeAt(0)<256){for(u=0;u<p;u++)A=A<<1,R==h-1?(R=0,S.push(m(A)),A=0):R++;for(y=I.charCodeAt(0),u=0;u<8;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;}else{for(y=1,u=0;u<p;u++)A=A<<1|y,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=0;for(y=I.charCodeAt(0),u=0;u<16;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;}d--,d==0&&(d=Math.pow(2,p),p++),delete E[I];}else for(y=T[I],u=0;u<p;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;d--,d==0&&(d=Math.pow(2,p),p++),T[x]=v++,I=String(C);}if(I!==""){if(Object.prototype.hasOwnProperty.call(E,I)){if(I.charCodeAt(0)<256){for(u=0;u<p;u++)A=A<<1,R==h-1?(R=0,S.push(m(A)),A=0):R++;for(y=I.charCodeAt(0),u=0;u<8;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;}else{for(y=1,u=0;u<p;u++)A=A<<1|y,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=0;for(y=I.charCodeAt(0),u=0;u<16;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;}d--,d==0&&(d=Math.pow(2,p),p++),delete E[I];}else for(y=T[I],u=0;u<p;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;d--,d==0&&(d=Math.pow(2,p),p++);}for(y=2,u=0;u<p;u++)A=A<<1|y&1,R==h-1?(R=0,S.push(m(A)),A=0):R++,y=y>>1;for(;;)if(A=A<<1,R==h-1){S.push(m(A));break;}else R++;return S.join("");},decompress:function decompress(f){return f==null?"":f==""?null:l._decompress(f.length,32768,function(h){return f.charCodeAt(h);});},_decompress:function _decompress(f,h,m){var u=[],y=4,T=4,E=3,C="",x=[],I,d,v,p,S,A,R,D={val:m(0),position:h,index:1};for(I=0;I<3;I+=1)u[I]=I;for(v=0,S=Math.pow(2,2),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;switch(v){case 0:for(v=0,S=Math.pow(2,8),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;R=t(v);break;case 1:for(v=0,S=Math.pow(2,16),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;R=t(v);break;case 2:return"";}for(u[3]=R,d=R,x.push(R);;){if(D.index>f)return"";for(v=0,S=Math.pow(2,E),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;switch(R=v){case 0:for(v=0,S=Math.pow(2,8),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;u[T++]=t(v),R=T-1,y--;break;case 1:for(v=0,S=Math.pow(2,16),A=1;A!=S;)p=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=m(D.index++)),v|=(p>0?1:0)*A,A<<=1;u[T++]=t(v),R=T-1,y--;break;case 2:return x.join("");}if(y==0&&(y=Math.pow(2,E),E++),u[R])C=u[R];else if(R===T)C=d+d.charAt(0);else return null;x.push(C),u[T++]=d+C.charAt(0),y--,d=C,y==0&&(y=Math.pow(2,E),E++);}}};return l;}();i!=null?i.exports=e:(typeof angular==="undefined"?"undefined":_typeof(angular))<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e;});})(Cl);var gh=Cl.exports;function Pi(i){return JSON.parse(gh.decompress(i));}function gr(i){return gh.compress(JSON.stringify(i));}var mh={exports:{}};(function(i){(function(){var e={};e.version="6.4.2.2",e.use_lines=!0,e.use_xyz=!1;var t=!1;i.exports?(i.exports=e,t=!0):(typeof document==="undefined"?"undefined":_typeof(document))<"u"?window.ClipperLib=e:self.ClipperLib=e;var r;if(t){var n="chrome";r="Netscape";}else{var n=navigator.userAgent.toString().toLowerCase();r=navigator.appName;}var s={};n.indexOf("chrome")!=-1&&n.indexOf("chromium")==-1?s.chrome=1:s.chrome=0,n.indexOf("chromium")!=-1?s.chromium=1:s.chromium=0,n.indexOf("safari")!=-1&&n.indexOf("chrome")==-1&&n.indexOf("chromium")==-1?s.safari=1:s.safari=0,n.indexOf("firefox")!=-1?s.firefox=1:s.firefox=0,n.indexOf("firefox/17")!=-1?s.firefox17=1:s.firefox17=0,n.indexOf("firefox/15")!=-1?s.firefox15=1:s.firefox15=0,n.indexOf("firefox/3")!=-1?s.firefox3=1:s.firefox3=0,n.indexOf("opera")!=-1?s.opera=1:s.opera=0,n.indexOf("msie 10")!=-1?s.msie10=1:s.msie10=0,n.indexOf("msie 9")!=-1?s.msie9=1:s.msie9=0,n.indexOf("msie 8")!=-1?s.msie8=1:s.msie8=0,n.indexOf("msie 7")!=-1?s.msie7=1:s.msie7=0,n.indexOf("msie ")!=-1?s.msie=1:s.msie=0,e.biginteger_used=null;var c;function l(a,P,w){e.biginteger_used=1,a!=null&&(typeof a=="number"&&_typeof(P)>"u"?this.fromInt(a):typeof a=="number"?this.fromNumber(a,P,w):P==null&&typeof a!="string"?this.fromString(a,256):this.fromString(a,P));}function f(){return new l(null,void 0,void 0);}function h(a,P,w,F,H,_){for(;--_>=0;){var st=P*this[a++]+w[F]+H;H=Math.floor(st/67108864),w[F++]=st&67108863;}return H;}function m(a,P,w,F,H,_){for(var st=P&32767,yt=P>>15;--_>=0;){var Pt=this[a]&32767,Bt=this[a++]>>15,kt=yt*Pt+Bt*st;Pt=st*Pt+((kt&32767)<<15)+w[F]+(H&1073741823),H=(Pt>>>30)+(kt>>>15)+yt*Bt+(H>>>30),w[F++]=Pt&1073741823;}return H;}function u(a,P,w,F,H,_){for(var st=P&16383,yt=P>>14;--_>=0;){var Pt=this[a]&16383,Bt=this[a++]>>14,kt=yt*Pt+Bt*st;Pt=st*Pt+((kt&16383)<<14)+w[F]+H,H=(Pt>>28)+(kt>>14)+yt*Bt,w[F++]=Pt&268435455;}return H;}r=="Microsoft Internet Explorer"?(l.prototype.am=m,c=30):r!="Netscape"?(l.prototype.am=h,c=26):(l.prototype.am=u,c=28),l.prototype.DB=c,l.prototype.DM=(1<<c)-1,l.prototype.DV=1<<c;var y=52;l.prototype.FV=Math.pow(2,y),l.prototype.F1=y-c,l.prototype.F2=2*c-y;var T="0123456789abcdefghijklmnopqrstuvwxyz",E=new Array(),C,x;for(C=48,x=0;x<=9;++x)E[C++]=x;for(C=97,x=10;x<36;++x)E[C++]=x;for(C=65,x=10;x<36;++x)E[C++]=x;function I(a){return T.charAt(a);}function d(a,P){var w=E[a.charCodeAt(P)];return w!==null&&w!==void 0?w:-1;}function v(a){for(var P=this.t-1;P>=0;--P)a[P]=this[P];a.t=this.t,a.s=this.s;}function p(a){this.t=1,this.s=a<0?-1:0,a>0?this[0]=a:a<-1?this[0]=a+this.DV:this.t=0;}function S(a){var P=f();return P.fromInt(a),P;}function A(a,P){var w;if(P==16)w=4;else if(P==8)w=3;else if(P==256)w=8;else if(P==2)w=1;else if(P==32)w=5;else if(P==4)w=2;else{this.fromRadix(a,P);return;}this.t=0,this.s=0;for(var F=a.length,H=!1,_=0;--F>=0;){var st=w==8?a[F]&255:d(a,F);if(st<0){a.charAt(F)=="-"&&(H=!0);continue;}H=!1,_==0?this[this.t++]=st:_+w>this.DB?(this[this.t-1]|=(st&(1<<this.DB-_)-1)<<_,this[this.t++]=st>>this.DB-_):this[this.t-1]|=st<<_,_+=w,_>=this.DB&&(_-=this.DB);}w==8&&a[0]&128&&(this.s=-1,_>0&&(this[this.t-1]|=(1<<this.DB-_)-1<<_)),this.clamp(),H&&l.ZERO.subTo(this,this);}function R(){for(var a=this.s&this.DM;this.t>0&&this[this.t-1]==a;)--this.t;}function D(a){if(this.s<0)return"-"+this.negate().toString(a);var P;if(a==16)P=4;else if(a==8)P=3;else if(a==2)P=1;else if(a==32)P=5;else if(a==4)P=2;else return this.toRadix(a);var w=(1<<P)-1,F,H=!1,_="",st=this.t,yt=this.DB-st*this.DB%P;if(st-->0)for(yt<this.DB&&(F=this[st]>>yt)>0&&(H=!0,_=I(F));st>=0;)yt<P?(F=(this[st]&(1<<yt)-1)<<P-yt,F|=this[--st]>>(yt+=this.DB-P)):(F=this[st]>>(yt-=P)&w,yt<=0&&(yt+=this.DB,--st)),F>0&&(H=!0),H&&(_+=I(F));return H?_:"0";}function U(){var a=f();return l.ZERO.subTo(this,a),a;}function M(){return this.s<0?this.negate():this;}function W(a){var P=this.s-a.s;if(P!=0)return P;var w=this.t;if(P=w-a.t,P!=0)return this.s<0?-P:P;for(;--w>=0;)if((P=this[w]-a[w])!=0)return P;return 0;}function Y(a){var P=1,w;return(w=a>>>16)!=0&&(a=w,P+=16),(w=a>>8)!=0&&(a=w,P+=8),(w=a>>4)!=0&&(a=w,P+=4),(w=a>>2)!=0&&(a=w,P+=2),(w=a>>1)!=0&&(a=w,P+=1),P;}function B(){return this.t<=0?0:this.DB*(this.t-1)+Y(this[this.t-1]^this.s&this.DM);}function N(a,P){var w;for(w=this.t-1;w>=0;--w)P[w+a]=this[w];for(w=a-1;w>=0;--w)P[w]=0;P.t=this.t+a,P.s=this.s;}function G(a,P){for(var w=a;w<this.t;++w)P[w-a]=this[w];P.t=Math.max(this.t-a,0),P.s=this.s;}function J(a,P){var w=a%this.DB,F=this.DB-w,H=(1<<F)-1,_=Math.floor(a/this.DB),st=this.s<<w&this.DM,yt;for(yt=this.t-1;yt>=0;--yt)P[yt+_+1]=this[yt]>>F|st,st=(this[yt]&H)<<w;for(yt=_-1;yt>=0;--yt)P[yt]=0;P[_]=st,P.t=this.t+_+1,P.s=this.s,P.clamp();}function tt(a,P){P.s=this.s;var w=Math.floor(a/this.DB);if(w>=this.t){P.t=0;return;}var F=a%this.DB,H=this.DB-F,_=(1<<F)-1;P[0]=this[w]>>F;for(var st=w+1;st<this.t;++st)P[st-w-1]|=(this[st]&_)<<H,P[st-w]=this[st]>>F;F>0&&(P[this.t-w-1]|=(this.s&_)<<H),P.t=this.t-w,P.clamp();}function at(a,P){for(var w=0,F=0,H=Math.min(a.t,this.t);w<H;)F+=this[w]-a[w],P[w++]=F&this.DM,F>>=this.DB;if(a.t<this.t){for(F-=a.s;w<this.t;)F+=this[w],P[w++]=F&this.DM,F>>=this.DB;F+=this.s;}else{for(F+=this.s;w<a.t;)F-=a[w],P[w++]=F&this.DM,F>>=this.DB;F-=a.s;}P.s=F<0?-1:0,F<-1?P[w++]=this.DV+F:F>0&&(P[w++]=F),P.t=w,P.clamp();}function ut(a,P){var w=this.abs(),F=a.abs(),H=w.t;for(P.t=H+F.t;--H>=0;)P[H]=0;for(H=0;H<F.t;++H)P[H+w.t]=w.am(0,F[H],P,H,0,w.t);P.s=0,P.clamp(),this.s!=a.s&&l.ZERO.subTo(P,P);}function K(a){for(var P=this.abs(),w=a.t=2*P.t;--w>=0;)a[w]=0;for(w=0;w<P.t-1;++w){var F=P.am(w,P[w],a,2*w,0,1);(a[w+P.t]+=P.am(w+1,2*P[w],a,2*w+1,F,P.t-w-1))>=P.DV&&(a[w+P.t]-=P.DV,a[w+P.t+1]=1);}a.t>0&&(a[a.t-1]+=P.am(w,P[w],a,2*w,0,1)),a.s=0,a.clamp();}function Q(a,P,w){var F=a.abs();if(!(F.t<=0)){var H=this.abs();if(H.t<F.t){P!=null&&P.fromInt(0),w!=null&&this.copyTo(w);return;}w==null&&(w=f());var _=f(),st=this.s,yt=a.s,Pt=this.DB-Y(F[F.t-1]);Pt>0?(F.lShiftTo(Pt,_),H.lShiftTo(Pt,w)):(F.copyTo(_),H.copyTo(w));var Bt=_.t,kt=_[Bt-1];if(kt!=0){var jt=kt*(1<<this.F1)+(Bt>1?_[Bt-2]>>this.F2:0),qt=this.FV/jt,oe=(1<<this.F1)/jt,me=1<<this.F2,Pe=w.t,De=Pe-Bt,or=P!==null&&P!==void 0?P:f();for(_.dlShiftTo(De,or),w.compareTo(or)>=0&&(w[w.t++]=1,w.subTo(or,w)),l.ONE.dlShiftTo(Bt,or),or.subTo(_,_);_.t<Bt;)_[_.t++]=0;for(;--De>=0;){var Rr=w[--Pe]==kt?this.DM:Math.floor(w[Pe]*qt+(w[Pe-1]+me)*oe);if((w[Pe]+=_.am(0,Rr,w,De,0,Bt))<Rr)for(_.dlShiftTo(De,or),w.subTo(or,w);w[Pe]<--Rr;)w.subTo(or,w);}P!=null&&(w.drShiftTo(Bt,P),st!=yt&&l.ZERO.subTo(P,P)),w.t=Bt,w.clamp(),Pt>0&&w.rShiftTo(Pt,w),st<0&&l.ZERO.subTo(w,w);}}}function ft(a){var P=f();return this.abs().divRemTo(a,null,P),this.s<0&&P.compareTo(l.ZERO)>0&&a.subTo(P,P),P;}function gt(a){this.m=a;}function mt(a){return a.s<0||a.compareTo(this.m)>=0?a.mod(this.m):a;}function wt(a){return a;}function ht(a){a.divRemTo(this.m,null,a);}function Nt(a,P,w){a.multiplyTo(P,w),this.reduce(w);}function Rt(a,P){a.squareTo(P),this.reduce(P);}gt.prototype.convert=mt,gt.prototype.revert=wt,gt.prototype.reduce=ht,gt.prototype.mulTo=Nt,gt.prototype.sqrTo=Rt;function X(){if(this.t<1)return 0;var a=this[0];if(!(a&1))return 0;var P=a&3;return P=P*(2-(a&15)*P)&15,P=P*(2-(a&255)*P)&255,P=P*(2-((a&65535)*P&65535))&65535,P=P*(2-a*P%this.DV)%this.DV,P>0?this.DV-P:-P;}function z(a){this.m=a,this.mp=a.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<a.DB-15)-1,this.mt2=2*a.t;}function q(a){var P=f();return a.abs().dlShiftTo(this.m.t,P),P.divRemTo(this.m,null,P),a.s<0&&P.compareTo(l.ZERO)>0&&this.m.subTo(P,P),P;}function nt(a){var P=f();return a.copyTo(P),this.reduce(P),P;}function j(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var P=0;P<this.m.t;++P){var w=a[P]&32767,F=w*this.mpl+((w*this.mph+(a[P]>>15)*this.mpl&this.um)<<15)&a.DM;for(w=P+this.m.t,a[w]+=this.m.am(0,F,a,P,0,this.m.t);a[w]>=a.DV;)a[w]-=a.DV,a[++w]++;}a.clamp(),a.drShiftTo(this.m.t,a),a.compareTo(this.m)>=0&&a.subTo(this.m,a);}function Z(a,P){a.squareTo(P),this.reduce(P);}function O(a,P,w){a.multiplyTo(P,w),this.reduce(w);}z.prototype.convert=q,z.prototype.revert=nt,z.prototype.reduce=j,z.prototype.mulTo=O,z.prototype.sqrTo=Z;function L(){return(this.t>0?this[0]&1:this.s)==0;}function $(a,P){if(a>4294967295||a<1)return l.ONE;var w=f(),F=f(),H=P.convert(this),_=Y(a)-1;for(H.copyTo(w);--_>=0;)if(P.sqrTo(w,F),(a&1<<_)>0)P.mulTo(F,H,w);else{var st=w;w=F,F=st;}return P.revert(w);}function V(a,P){var w;return a<256||P.isEven()?w=new gt(P):w=new z(P),this.exp(a,w);}l.prototype.copyTo=v,l.prototype.fromInt=p,l.prototype.fromString=A,l.prototype.clamp=R,l.prototype.dlShiftTo=N,l.prototype.drShiftTo=G,l.prototype.lShiftTo=J,l.prototype.rShiftTo=tt,l.prototype.subTo=at,l.prototype.multiplyTo=ut,l.prototype.squareTo=K,l.prototype.divRemTo=Q,l.prototype.invDigit=X,l.prototype.isEven=L,l.prototype.exp=$,l.prototype.toString=D,l.prototype.negate=U,l.prototype.abs=M,l.prototype.compareTo=W,l.prototype.bitLength=B,l.prototype.mod=ft,l.prototype.modPowInt=V,l.ZERO=S(0),l.ONE=S(1);function rt(){var a=f();return this.copyTo(a),a;}function it(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1;}else{if(this.t==1)return this[0];if(this.t==0)return 0;}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0];}function ct(){return this.t==0?this.s:this[0]<<24>>24;}function St(){return this.t==0?this.s:this[0]<<16>>16;}function Ct(a){return Math.floor(Math.LN2*this.DB/Math.log(a));}function Mt(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1;}function Dt(a){if(a==null&&(a=10),this.signum()==0||a<2||a>36)return"0";var P=this.chunkSize(a),w=Math.pow(a,P),F=S(w),H=f(),_=f(),st="";for(this.divRemTo(F,H,_);H.signum()>0;)st=(w+_.intValue()).toString(a).substr(1)+st,H.divRemTo(F,H,_);return _.intValue().toString(a)+st;}function At(a,P){this.fromInt(0),P==null&&(P=10);for(var w=this.chunkSize(P),F=Math.pow(P,w),H=!1,_=0,st=0,yt=0;yt<a.length;++yt){var Pt=d(a,yt);if(Pt<0){a.charAt(yt)=="-"&&this.signum()==0&&(H=!0);continue;}st=P*st+Pt,++_>=w&&(this.dMultiply(F),this.dAddOffset(st,0),_=0,st=0);}_>0&&(this.dMultiply(Math.pow(P,_)),this.dAddOffset(st,0)),H&&l.ZERO.subTo(this,this);}function Ot(a,P,w){if(typeof P=="number"){if(a<2)this.fromInt(1);else for(this.fromNumber(a,w),this.testBit(a-1)||this.bitwiseTo(l.ONE.shiftLeft(a-1),ne,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(P);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(l.ONE.shiftLeft(a-1),this);}else{var F=new Array(),H=a&7;F.length=(a>>3)+1,P.nextBytes(F),H>0?F[0]&=(1<<H)-1:F[0]=0,this.fromString(F,256);}}function Lt(){var a=this.t,P=new Array();P[0]=this.s;var w=this.DB-a*this.DB%8,F,H=0;if(a-->0)for(w<this.DB&&(F=this[a]>>w)!=(this.s&this.DM)>>w&&(P[H++]=F|this.s<<this.DB-w);a>=0;)w<8?(F=(this[a]&(1<<w)-1)<<8-w,F|=this[--a]>>(w+=this.DB-8)):(F=this[a]>>(w-=8)&255,w<=0&&(w+=this.DB,--a)),F&128&&(F|=-256),H==0&&(this.s&128)!=(F&128)&&++H,(H>0||F!=this.s)&&(P[H++]=F);return P;}function Yt(a){return this.compareTo(a)==0;}function zt(a){return this.compareTo(a)<0?this:a;}function Wt(a){return this.compareTo(a)>0?this:a;}function Qt(a,P,w){var F,H,_=Math.min(a.t,this.t);for(F=0;F<_;++F)w[F]=P(this[F],a[F]);if(a.t<this.t){for(H=a.s&this.DM,F=_;F<this.t;++F)w[F]=P(this[F],H);w.t=this.t;}else{for(H=this.s&this.DM,F=_;F<a.t;++F)w[F]=P(H,a[F]);w.t=a.t;}w.s=P(this.s,a.s),w.clamp();}function ue(a,P){return a&P;}function ie(a){var P=f();return this.bitwiseTo(a,ue,P),P;}function ne(a,P){return a|P;}function ae(a){var P=f();return this.bitwiseTo(a,ne,P),P;}function se(a,P){return a^P;}function je(a){var P=f();return this.bitwiseTo(a,se,P),P;}function We(a,P){return a&~P;}function Xe(a){var P=f();return this.bitwiseTo(a,We,P),P;}function Fe(){for(var a=f(),P=0;P<this.t;++P)a[P]=this.DM&~this[P];return a.t=this.t,a.s=~this.s,a;}function Ge(a){var P=f();return a<0?this.rShiftTo(-a,P):this.lShiftTo(a,P),P;}function Ke(a){var P=f();return a<0?this.lShiftTo(-a,P):this.rShiftTo(a,P),P;}function Je(a){if(a==0)return-1;var P=0;return a&65535||(a>>=16,P+=16),a&255||(a>>=8,P+=8),a&15||(a>>=4,P+=4),a&3||(a>>=2,P+=2),a&1||++P,P;}function Ie(){for(var a=0;a<this.t;++a)if(this[a]!=0)return a*this.DB+Je(this[a]);return this.s<0?this.t*this.DB:-1;}function cr(a){for(var P=0;a!=0;)a&=a-1,++P;return P;}function Kr(){for(var a=0,P=this.s&this.DM,w=0;w<this.t;++w)a+=cr(this[w]^P);return a;}function tn(a){var P=Math.floor(a/this.DB);return P>=this.t?this.s!=0:(this[P]&1<<a%this.DB)!=0;}function Hn(a,P){var w=l.ONE.shiftLeft(a);return this.bitwiseTo(w,P,w),w;}function kn(a){return this.changeBit(a,ne);}function wi(a){return this.changeBit(a,We);}function Co(a){return this.changeBit(a,se);}function Ai(a,P){for(var w=0,F=0,H=Math.min(a.t,this.t);w<H;)F+=this[w]+a[w],P[w++]=F&this.DM,F>>=this.DB;if(a.t<this.t){for(F+=a.s;w<this.t;)F+=this[w],P[w++]=F&this.DM,F>>=this.DB;F+=this.s;}else{for(F+=this.s;w<a.t;)F+=a[w],P[w++]=F&this.DM,F>>=this.DB;F+=a.s;}P.s=F<0?-1:0,F>0?P[w++]=F:F<-1&&(P[w++]=this.DV+F),P.t=w,P.clamp();}function Io(a){var P=f();return this.addTo(a,P),P;}function Oo(a){var P=f();return this.subTo(a,P),P;}function wo(a){var P=f();return this.multiplyTo(a,P),P;}function Ao(){var a=f();return this.squareTo(a),a;}function Eo(a){var P=f();return this.divRemTo(a,P,null),P;}function Mo(a){var P=f();return this.divRemTo(a,null,P),P;}function Lo(a){var P=f(),w=f();return this.divRemTo(a,P,w),new Array(P,w);}function Ro(a){this[this.t]=this.am(0,a-1,this,0,0,this.t),++this.t,this.clamp();}function _i(a,P){if(a!=0){for(;this.t<=P;)this[this.t++]=0;for(this[P]+=a;this[P]>=this.DV;)this[P]-=this.DV,++P>=this.t&&(this[this.t++]=0),++this[P];}}function Rn(){}function ts(a){return a;}function bo(a,P,w){a.multiplyTo(P,w);}function Do(a,P){a.squareTo(P);}Rn.prototype.convert=ts,Rn.prototype.revert=ts,Rn.prototype.mulTo=bo,Rn.prototype.sqrTo=Do;function No(a){return this.exp(a,new Rn());}function Bo(a,P,w){var F=Math.min(this.t+a.t,P);for(w.s=0,w.t=F;F>0;)w[--F]=0;var H;for(H=w.t-this.t;F<H;++F)w[F+this.t]=this.am(0,a[F],w,F,0,this.t);for(H=Math.min(a.t,P);F<H;++F)this.am(0,a[F],w,F,0,P-F);w.clamp();}function Kn(a,P,w){--P;var F=w.t=this.t+a.t-P;for(w.s=0;--F>=0;)w[F]=0;for(F=Math.max(P-this.t,0);F<a.t;++F)w[this.t+F-P]=this.am(P-F,a[F],w,0,0,this.t+F-P);w.clamp(),w.drShiftTo(1,w);}function vn(a){this.r2=f(),this.q3=f(),l.ONE.dlShiftTo(2*a.t,this.r2),this.mu=this.r2.divide(a),this.m=a;}function Vn(a){if(a.s<0||a.t>2*this.m.t)return a.mod(this.m);if(a.compareTo(this.m)<0)return a;var P=f();return a.copyTo(P),this.reduce(P),P;}function Wo(a){return a;}function Fo(a){for(a.drShiftTo(this.m.t-1,this.r2),a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);a.compareTo(this.r2)<0;)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);a.compareTo(this.m)>=0;)a.subTo(this.m,a);}function Uo(a,P){a.squareTo(P),this.reduce(P);}function es(a,P,w){a.multiplyTo(P,w),this.reduce(w);}vn.prototype.convert=Vn,vn.prototype.revert=Wo,vn.prototype.reduce=Fo,vn.prototype.mulTo=es,vn.prototype.sqrTo=Uo;function rs(a,P){var w=a.bitLength(),F,H=S(1),_;if(w<=0)return H;w<18?F=1:w<48?F=3:w<144?F=4:w<768?F=5:F=6,w<8?_=new gt(P):P.isEven()?_=new vn(P):_=new z(P);var st=new Array(),yt=3,Pt=F-1,Bt=(1<<F)-1;if(st[1]=_.convert(this),F>1){var kt=f();for(_.sqrTo(st[1],kt);yt<=Bt;)st[yt]=f(),_.mulTo(kt,st[yt-2],st[yt]),yt+=2;}var jt=a.t-1,qt,oe=!0,me=f(),Pe;for(w=Y(a[jt])-1;jt>=0;){for(w>=Pt?qt=a[jt]>>w-Pt&Bt:(qt=(a[jt]&(1<<w+1)-1)<<Pt-w,jt>0&&(qt|=a[jt-1]>>this.DB+w-Pt)),yt=F;!(qt&1);)qt>>=1,--yt;if((w-=yt)<0&&(w+=this.DB,--jt),oe)st[qt].copyTo(H),oe=!1;else{for(;yt>1;)_.sqrTo(H,me),_.sqrTo(me,H),yt-=2;yt>0?_.sqrTo(H,me):(Pe=H,H=me,me=Pe),_.mulTo(me,st[qt],H);}for(;jt>=0&&!(a[jt]&1<<w);)_.sqrTo(H,me),Pe=H,H=me,me=Pe,--w<0&&(w=this.DB-1,--jt);}return _.revert(H);}function ns(a){var P=this.s<0?this.negate():this.clone(),w=a.s<0?a.negate():a.clone();if(P.compareTo(w)<0){var F=P;P=w,w=F;}var H=P.getLowestSetBit(),_=w.getLowestSetBit();if(_<0)return P;for(H<_&&(_=H),_>0&&(P.rShiftTo(_,P),w.rShiftTo(_,w));P.signum()>0;)(H=P.getLowestSetBit())>0&&P.rShiftTo(H,P),(H=w.getLowestSetBit())>0&&w.rShiftTo(H,w),P.compareTo(w)>=0?(P.subTo(w,P),P.rShiftTo(1,P)):(w.subTo(P,w),w.rShiftTo(1,w));return _>0&&w.lShiftTo(_,w),w;}function Yo(a){if(a<=0)return 0;var P=this.DV%a,w=this.s<0?a-1:0;if(this.t>0)if(P==0)w=this[0]%a;else for(var F=this.t-1;F>=0;--F)w=(P*w+this[F])%a;return w;}function Xo(a){var P=a.isEven();if(this.isEven()&&P||a.signum()==0)return l.ZERO;for(var w=a.clone(),F=this.clone(),H=S(1),_=S(0),st=S(0),yt=S(1);w.signum()!=0;){for(;w.isEven();)w.rShiftTo(1,w),P?((!H.isEven()||!_.isEven())&&(H.addTo(this,H),_.subTo(a,_)),H.rShiftTo(1,H)):_.isEven()||_.subTo(a,_),_.rShiftTo(1,_);for(;F.isEven();)F.rShiftTo(1,F),P?((!st.isEven()||!yt.isEven())&&(st.addTo(this,st),yt.subTo(a,yt)),st.rShiftTo(1,st)):yt.isEven()||yt.subTo(a,yt),yt.rShiftTo(1,yt);w.compareTo(F)>=0?(w.subTo(F,w),P&&H.subTo(st,H),_.subTo(yt,_)):(F.subTo(w,F),P&&st.subTo(H,st),yt.subTo(_,yt));}if(F.compareTo(l.ONE)!=0)return l.ZERO;if(yt.compareTo(a)>=0)return yt.subtract(a);if(yt.signum()<0)yt.addTo(a,yt);else return yt;return yt.signum()<0?yt.add(a):yt;}var nr=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],zo=(1<<26)/nr[nr.length-1];function is(a){var P,w=this.abs();if(w.t==1&&w[0]<=nr[nr.length-1]){for(P=0;P<nr.length;++P)if(w[0]==nr[P])return!0;return!1;}if(w.isEven())return!1;for(P=1;P<nr.length;){for(var F=nr[P],H=P+1;H<nr.length&&F<zo;)F*=nr[H++];for(F=w.modInt(F);P<H;)if(F%nr[P++]==0)return!1;}return w.millerRabin(a);}function ss(a){var P=this.subtract(l.ONE),w=P.getLowestSetBit();if(w<=0)return!1;var F=P.shiftRight(w);a=a+1>>1,a>nr.length&&(a=nr.length);for(var H=f(),_=0;_<a;++_){H.fromInt(nr[Math.floor(Math.random()*nr.length)]);var st=H.modPow(F,this);if(st.compareTo(l.ONE)!=0&&st.compareTo(P)!=0){for(var yt=1;yt++<w&&st.compareTo(P)!=0;)if(st=st.modPowInt(2,this),st.compareTo(l.ONE)==0)return!1;if(st.compareTo(P)!=0)return!1;}}return!0;}l.prototype.chunkSize=Ct,l.prototype.toRadix=Dt,l.prototype.fromRadix=At,l.prototype.fromNumber=Ot,l.prototype.bitwiseTo=Qt,l.prototype.changeBit=Hn,l.prototype.addTo=Ai,l.prototype.dMultiply=Ro,l.prototype.dAddOffset=_i,l.prototype.multiplyLowerTo=Bo,l.prototype.multiplyUpperTo=Kn,l.prototype.modInt=Yo,l.prototype.millerRabin=ss,l.prototype.clone=rt,l.prototype.intValue=it,l.prototype.byteValue=ct,l.prototype.shortValue=St,l.prototype.signum=Mt,l.prototype.toByteArray=Lt,l.prototype.equals=Yt,l.prototype.min=zt,l.prototype.max=Wt,l.prototype.and=ie,l.prototype.or=ae,l.prototype.xor=je,l.prototype.andNot=Xe,l.prototype.not=Fe,l.prototype.shiftLeft=Ge,l.prototype.shiftRight=Ke,l.prototype.getLowestSetBit=Ie,l.prototype.bitCount=Kr,l.prototype.testBit=tn,l.prototype.setBit=kn,l.prototype.clearBit=wi,l.prototype.flipBit=Co,l.prototype.add=Io,l.prototype.subtract=Oo,l.prototype.multiply=wo,l.prototype.divide=Eo,l.prototype.remainder=Mo,l.prototype.divideAndRemainder=Lo,l.prototype.modPow=rs,l.prototype.modInverse=Xo,l.prototype.pow=No,l.prototype.gcd=ns,l.prototype.isProbablePrime=is,l.prototype.square=Ao;var ge=l;ge.prototype.IsNegative=function(){return this.compareTo(ge.ZERO)==-1;},ge.op_Equality=function(a,P){return a.compareTo(P)==0;},ge.op_Inequality=function(a,P){return a.compareTo(P)!=0;},ge.op_GreaterThan=function(a,P){return a.compareTo(P)>0;},ge.op_LessThan=function(a,P){return a.compareTo(P)<0;},ge.op_Addition=function(a,P){return new ge(a,void 0,void 0).add(new ge(P,void 0,void 0));},ge.op_Subtraction=function(a,P){return new ge(a,void 0,void 0).subtract(new ge(P,void 0,void 0));},ge.Int128Mul=function(a,P){return new ge(a,void 0,void 0).multiply(new ge(P,void 0,void 0));},ge.op_Division=function(a,P){return a.divide(P);},ge.prototype.ToDouble=function(){return parseFloat(this.toString());};var Zn=function Zn(a,P){var w;if(_typeof(Object.getOwnPropertyNames)>"u"){for(w in P.prototype)(_typeof(a.prototype[w])>"u"||a.prototype[w]===Object.prototype[w])&&(a.prototype[w]=P.prototype[w]);for(w in P)_typeof(a[w])>"u"&&(a[w]=P[w]);a.$baseCtor=P;}else{for(var F=Object.getOwnPropertyNames(P.prototype),H=0;H<F.length;H++)_typeof(Object.getOwnPropertyDescriptor(a.prototype,F[H]))>"u"&&Object.defineProperty(a.prototype,F[H],Object.getOwnPropertyDescriptor(P.prototype,F[H]));for(w in P)_typeof(a[w])>"u"&&(a[w]=P[w]);a.$baseCtor=P;}};e.Path=function(){return[];},e.Path.prototype.push=Array.prototype.push,e.Paths=function(){return[];},e.Paths.prototype.push=Array.prototype.push,e.DoublePoint=function(){var a=arguments;this.X=0,this.Y=0,a.length===1?(this.X=a[0].X,this.Y=a[0].Y):a.length===2&&(this.X=a[0],this.Y=a[1]);},e.DoublePoint0=function(){this.X=0,this.Y=0;},e.DoublePoint0.prototype=e.DoublePoint.prototype,e.DoublePoint1=function(a){this.X=a.X,this.Y=a.Y;},e.DoublePoint1.prototype=e.DoublePoint.prototype,e.DoublePoint2=function(a,P){this.X=a,this.Y=P;},e.DoublePoint2.prototype=e.DoublePoint.prototype,e.PolyNode=function(){this.m_Parent=null,this.m_polygon=new e.Path(),this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1;},e.PolyNode.prototype.IsHoleNode=function(){for(var a=!0,P=this.m_Parent;P!==null;)a=!a,P=P.m_Parent;return a;},e.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length;},e.PolyNode.prototype.Contour=function(){return this.m_polygon;},e.PolyNode.prototype.AddChild=function(a){var P=this.m_Childs.length;this.m_Childs.push(a),a.m_Parent=this,a.m_Index=P;},e.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp();},e.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1];},e.PolyNode.prototype.Childs=function(){return this.m_Childs;},e.PolyNode.prototype.Parent=function(){return this.m_Parent;},e.PolyNode.prototype.IsHole=function(){return this.IsHoleNode();},e.PolyTree=function(){this.m_AllPolys=[],e.PolyNode.call(this);},e.PolyTree.prototype.Clear=function(){for(var a=0,P=this.m_AllPolys.length;a<P;a++)this.m_AllPolys[a]=null;this.m_AllPolys.length=0,this.m_Childs.length=0;},e.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null;},e.PolyTree.prototype.Total=function(){var a=this.m_AllPolys.length;return a>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&a--,a;},Zn(e.PolyTree,e.PolyNode),e.Math_Abs_Int64=e.Math_Abs_Int32=e.Math_Abs_Double=function(a){return Math.abs(a);},e.Math_Max_Int32_Int32=function(a,P){return Math.max(a,P);},s.msie||s.opera||s.safari?e.Cast_Int32=function(a){return a|0;}:e.Cast_Int32=function(a){return~~a;},_typeof(Number.toInteger)>"u"&&(Number.toInteger=null),s.chrome?e.Cast_Int64=function(a){return a<-2147483648||a>2147483647?a<0?Math.ceil(a):Math.floor(a):~~a;}:s.firefox&&typeof Number.toInteger=="function"?e.Cast_Int64=function(a){return Number.toInteger(a);}:s.msie7||s.msie8?e.Cast_Int64=function(a){return parseInt(a,10);}:s.msie?e.Cast_Int64=function(a){return a<-2147483648||a>2147483647?a<0?Math.ceil(a):Math.floor(a):a|0;}:e.Cast_Int64=function(a){return a<0?Math.ceil(a):Math.floor(a);},e.Clear=function(a){a.length=0;},e.PI=3.141592653589793,e.PI2=2*3.141592653589793,e.IntPoint=function(){var a=arguments,P=a.length;if(this.X=0,this.Y=0,e.use_xyz){if(this.Z=0,P===3)this.X=a[0],this.Y=a[1],this.Z=a[2];else if(P===2)this.X=a[0],this.Y=a[1],this.Z=0;else if(P===1){if(a[0]instanceof e.DoublePoint){var w=a[0];this.X=e.Clipper.Round(w.X),this.Y=e.Clipper.Round(w.Y),this.Z=0;}else{var F=a[0];_typeof(F.Z)>"u"&&(F.Z=0),this.X=F.X,this.Y=F.Y,this.Z=F.Z;}}else this.X=0,this.Y=0,this.Z=0;}else if(P===2)this.X=a[0],this.Y=a[1];else if(P===1){if(a[0]instanceof e.DoublePoint){var w=a[0];this.X=e.Clipper.Round(w.X),this.Y=e.Clipper.Round(w.Y);}else{var F=a[0];this.X=F.X,this.Y=F.Y;}}else this.X=0,this.Y=0;},e.IntPoint.op_Equality=function(a,P){return a.X===P.X&&a.Y===P.Y;},e.IntPoint.op_Inequality=function(a,P){return a.X!==P.X||a.Y!==P.Y;},e.IntPoint0=function(){this.X=0,this.Y=0,e.use_xyz&&(this.Z=0);},e.IntPoint0.prototype=e.IntPoint.prototype,e.IntPoint1=function(a){this.X=a.X,this.Y=a.Y,e.use_xyz&&(_typeof(a.Z)>"u"?this.Z=0:this.Z=a.Z);},e.IntPoint1.prototype=e.IntPoint.prototype,e.IntPoint1dp=function(a){this.X=e.Clipper.Round(a.X),this.Y=e.Clipper.Round(a.Y),e.use_xyz&&(this.Z=0);},e.IntPoint1dp.prototype=e.IntPoint.prototype,e.IntPoint2=function(a,P,w){this.X=a,this.Y=P,e.use_xyz&&(_typeof(w)>"u"?this.Z=0:this.Z=w);},e.IntPoint2.prototype=e.IntPoint.prototype,e.IntRect=function(){var a=arguments,P=a.length;if(P===4)this.left=a[0],this.top=a[1],this.right=a[2],this.bottom=a[3];else if(P===1){var w=a[0];this.left=w.left,this.top=w.top,this.right=w.right,this.bottom=w.bottom;}else this.left=0,this.top=0,this.right=0,this.bottom=0;},e.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0;},e.IntRect0.prototype=e.IntRect.prototype,e.IntRect1=function(a){this.left=a.left,this.top=a.top,this.right=a.right,this.bottom=a.bottom;},e.IntRect1.prototype=e.IntRect.prototype,e.IntRect4=function(a,P,w,F){this.left=a,this.top=P,this.right=w,this.bottom=F;},e.IntRect4.prototype=e.IntRect.prototype,e.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},e.PolyType={ptSubject:0,ptClip:1},e.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},e.JoinType={jtSquare:0,jtRound:1,jtMiter:2},e.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},e.EdgeSide={esLeft:0,esRight:1},e.Direction={dRightToLeft:0,dLeftToRight:1},e.TEdge=function(){this.Bot=new e.IntPoint0(),this.Curr=new e.IntPoint0(),this.Top=new e.IntPoint0(),this.Delta=new e.IntPoint0(),this.Dx=0,this.PolyTyp=e.PolyType.ptSubject,this.Side=e.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null;},e.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new e.IntPoint0();},e.MyIntersectNodeSort=function(){},e.MyIntersectNodeSort.Compare=function(a,P){var w=P.Pt.Y-a.Pt.Y;return w>0?1:w<0?-1:0;},e.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null;},e.Scanbeam=function(){this.Y=0,this.Next=null;},e.Maxima=function(){this.X=0,this.Next=null,this.Prev=null;},e.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null;},e.OutPt=function(){this.Idx=0,this.Pt=new e.IntPoint0(),this.Next=null,this.Prev=null;},e.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new e.IntPoint0();},e.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array(),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null;},e.ClipperBase.horizontal=-9007199254740992,e.ClipperBase.Skip=-2,e.ClipperBase.Unassigned=-1,e.ClipperBase.tolerance=1e-20,e.ClipperBase.loRange=47453132,e.ClipperBase.hiRange=4503599627370495,e.ClipperBase.near_zero=function(a){return a>-e.ClipperBase.tolerance&&a<e.ClipperBase.tolerance;},e.ClipperBase.IsHorizontal=function(a){return a.Delta.Y===0;},e.ClipperBase.prototype.PointIsVertex=function(a,P){var w=P;do{if(e.IntPoint.op_Equality(w.Pt,a))return!0;w=w.Next;}while(w!==P);return!1;},e.ClipperBase.prototype.PointOnLineSegment=function(a,P,w,F){return F?a.X===P.X&&a.Y===P.Y||a.X===w.X&&a.Y===w.Y||a.X>P.X==a.X<w.X&&a.Y>P.Y==a.Y<w.Y&&ge.op_Equality(ge.Int128Mul(a.X-P.X,w.Y-P.Y),ge.Int128Mul(w.X-P.X,a.Y-P.Y)):a.X===P.X&&a.Y===P.Y||a.X===w.X&&a.Y===w.Y||a.X>P.X==a.X<w.X&&a.Y>P.Y==a.Y<w.Y&&(a.X-P.X)*(w.Y-P.Y)===(w.X-P.X)*(a.Y-P.Y);},e.ClipperBase.prototype.PointOnPolygon=function(a,P,w){for(var F=P;;){if(this.PointOnLineSegment(a,F.Pt,F.Next.Pt,w))return!0;if(F=F.Next,F===P)break;}return!1;},e.ClipperBase.prototype.SlopesEqual=e.ClipperBase.SlopesEqual=function(){var a=arguments,P=a.length,w,F,H,_,st,yt,Pt;return P===3?(w=a[0],F=a[1],Pt=a[2],Pt?ge.op_Equality(ge.Int128Mul(w.Delta.Y,F.Delta.X),ge.Int128Mul(w.Delta.X,F.Delta.Y)):e.Cast_Int64(w.Delta.Y*F.Delta.X)===e.Cast_Int64(w.Delta.X*F.Delta.Y)):P===4?(H=a[0],_=a[1],st=a[2],Pt=a[3],Pt?ge.op_Equality(ge.Int128Mul(H.Y-_.Y,_.X-st.X),ge.Int128Mul(H.X-_.X,_.Y-st.Y)):e.Cast_Int64((H.Y-_.Y)*(_.X-st.X))-e.Cast_Int64((H.X-_.X)*(_.Y-st.Y))===0):(H=a[0],_=a[1],st=a[2],yt=a[3],Pt=a[4],Pt?ge.op_Equality(ge.Int128Mul(H.Y-_.Y,st.X-yt.X),ge.Int128Mul(H.X-_.X,st.Y-yt.Y)):e.Cast_Int64((H.Y-_.Y)*(st.X-yt.X))-e.Cast_Int64((H.X-_.X)*(st.Y-yt.Y))===0);},e.ClipperBase.SlopesEqual3=function(a,P,w){return w?ge.op_Equality(ge.Int128Mul(a.Delta.Y,P.Delta.X),ge.Int128Mul(a.Delta.X,P.Delta.Y)):e.Cast_Int64(a.Delta.Y*P.Delta.X)===e.Cast_Int64(a.Delta.X*P.Delta.Y);},e.ClipperBase.SlopesEqual4=function(a,P,w,F){return F?ge.op_Equality(ge.Int128Mul(a.Y-P.Y,P.X-w.X),ge.Int128Mul(a.X-P.X,P.Y-w.Y)):e.Cast_Int64((a.Y-P.Y)*(P.X-w.X))-e.Cast_Int64((a.X-P.X)*(P.Y-w.Y))===0;},e.ClipperBase.SlopesEqual5=function(a,P,w,F,H){return H?ge.op_Equality(ge.Int128Mul(a.Y-P.Y,w.X-F.X),ge.Int128Mul(a.X-P.X,w.Y-F.Y)):e.Cast_Int64((a.Y-P.Y)*(w.X-F.X))-e.Cast_Int64((a.X-P.X)*(w.Y-F.Y))===0;},e.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var a=0,P=this.m_edges.length;a<P;++a){for(var w=0,F=this.m_edges[a].length;w<F;++w)this.m_edges[a][w]=null;e.Clear(this.m_edges[a]);}e.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1;},e.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var a=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=a;}this.m_CurrentLM=null;},e.ClipperBase.prototype.RangeTest=function(a,P){P.Value?(a.X>e.ClipperBase.hiRange||a.Y>e.ClipperBase.hiRange||-a.X>e.ClipperBase.hiRange||-a.Y>e.ClipperBase.hiRange)&&e.Error("Coordinate outside allowed range in RangeTest()."):(a.X>e.ClipperBase.loRange||a.Y>e.ClipperBase.loRange||-a.X>e.ClipperBase.loRange||-a.Y>e.ClipperBase.loRange)&&(P.Value=!0,this.RangeTest(a,P));},e.ClipperBase.prototype.InitEdge=function(a,P,w,F){a.Next=P,a.Prev=w,a.Curr.X=F.X,a.Curr.Y=F.Y,e.use_xyz&&(a.Curr.Z=F.Z),a.OutIdx=-1;},e.ClipperBase.prototype.InitEdge2=function(a,P){a.Curr.Y>=a.Next.Curr.Y?(a.Bot.X=a.Curr.X,a.Bot.Y=a.Curr.Y,e.use_xyz&&(a.Bot.Z=a.Curr.Z),a.Top.X=a.Next.Curr.X,a.Top.Y=a.Next.Curr.Y,e.use_xyz&&(a.Top.Z=a.Next.Curr.Z)):(a.Top.X=a.Curr.X,a.Top.Y=a.Curr.Y,e.use_xyz&&(a.Top.Z=a.Curr.Z),a.Bot.X=a.Next.Curr.X,a.Bot.Y=a.Next.Curr.Y,e.use_xyz&&(a.Bot.Z=a.Next.Curr.Z)),this.SetDx(a),a.PolyTyp=P;},e.ClipperBase.prototype.FindNextLocMin=function(a){for(var P;;){for(;e.IntPoint.op_Inequality(a.Bot,a.Prev.Bot)||e.IntPoint.op_Equality(a.Curr,a.Top);)a=a.Next;if(a.Dx!==e.ClipperBase.horizontal&&a.Prev.Dx!==e.ClipperBase.horizontal)break;for(;a.Prev.Dx===e.ClipperBase.horizontal;)a=a.Prev;for(P=a;a.Dx===e.ClipperBase.horizontal;)a=a.Next;if(a.Top.Y!==a.Prev.Bot.Y){P.Prev.Bot.X<a.Bot.X&&(a=P);break;}}return a;},e.ClipperBase.prototype.ProcessBound=function(a,P){var w,F=a,H;if(F.OutIdx===e.ClipperBase.Skip){if(a=F,P){for(;a.Top.Y===a.Next.Bot.Y;)a=a.Next;for(;a!==F&&a.Dx===e.ClipperBase.horizontal;)a=a.Prev;}else{for(;a.Top.Y===a.Prev.Bot.Y;)a=a.Prev;for(;a!==F&&a.Dx===e.ClipperBase.horizontal;)a=a.Next;}if(a===F)P?F=a.Next:F=a.Prev;else{P?a=F.Next:a=F.Prev;var _=new e.LocalMinima();_.Next=null,_.Y=a.Bot.Y,_.LeftBound=null,_.RightBound=a,a.WindDelta=0,F=this.ProcessBound(a,P),this.InsertLocalMinima(_);}return F;}if(a.Dx===e.ClipperBase.horizontal&&(P?w=a.Prev:w=a.Next,w.Dx===e.ClipperBase.horizontal?w.Bot.X!==a.Bot.X&&w.Top.X!==a.Bot.X&&this.ReverseHorizontal(a):w.Bot.X!==a.Bot.X&&this.ReverseHorizontal(a)),w=a,P){for(;F.Top.Y===F.Next.Bot.Y&&F.Next.OutIdx!==e.ClipperBase.Skip;)F=F.Next;if(F.Dx===e.ClipperBase.horizontal&&F.Next.OutIdx!==e.ClipperBase.Skip){for(H=F;H.Prev.Dx===e.ClipperBase.horizontal;)H=H.Prev;H.Prev.Top.X>F.Next.Top.X&&(F=H.Prev);}for(;a!==F;)a.NextInLML=a.Next,a.Dx===e.ClipperBase.horizontal&&a!==w&&a.Bot.X!==a.Prev.Top.X&&this.ReverseHorizontal(a),a=a.Next;a.Dx===e.ClipperBase.horizontal&&a!==w&&a.Bot.X!==a.Prev.Top.X&&this.ReverseHorizontal(a),F=F.Next;}else{for(;F.Top.Y===F.Prev.Bot.Y&&F.Prev.OutIdx!==e.ClipperBase.Skip;)F=F.Prev;if(F.Dx===e.ClipperBase.horizontal&&F.Prev.OutIdx!==e.ClipperBase.Skip){for(H=F;H.Next.Dx===e.ClipperBase.horizontal;)H=H.Next;(H.Next.Top.X===F.Prev.Top.X||H.Next.Top.X>F.Prev.Top.X)&&(F=H.Next);}for(;a!==F;)a.NextInLML=a.Prev,a.Dx===e.ClipperBase.horizontal&&a!==w&&a.Bot.X!==a.Next.Top.X&&this.ReverseHorizontal(a),a=a.Prev;a.Dx===e.ClipperBase.horizontal&&a!==w&&a.Bot.X!==a.Next.Top.X&&this.ReverseHorizontal(a),F=F.Prev;}return F;},e.ClipperBase.prototype.AddPath=function(a,P,w){e.use_lines?!w&&P===e.PolyType.ptClip&&e.Error("AddPath: Open paths must be subject."):w||e.Error("AddPath: Open paths have been disabled.");var F=a.length-1;if(w)for(;F>0&&e.IntPoint.op_Equality(a[F],a[0]);)--F;for(;F>0&&e.IntPoint.op_Equality(a[F],a[F-1]);)--F;if(w&&F<2||!w&&F<1)return!1;for(var H=new Array(),_=0;_<=F;_++)H.push(new e.TEdge());var st=!0;H[1].Curr.X=a[1].X,H[1].Curr.Y=a[1].Y,e.use_xyz&&(H[1].Curr.Z=a[1].Z);var yt={Value:this.m_UseFullRange};this.RangeTest(a[0],yt),this.m_UseFullRange=yt.Value,yt.Value=this.m_UseFullRange,this.RangeTest(a[F],yt),this.m_UseFullRange=yt.Value,this.InitEdge(H[0],H[1],H[F],a[0]),this.InitEdge(H[F],H[0],H[F-1],a[F]);for(var _=F-1;_>=1;--_)yt.Value=this.m_UseFullRange,this.RangeTest(a[_],yt),this.m_UseFullRange=yt.Value,this.InitEdge(H[_],H[_+1],H[_-1],a[_]);for(var Pt=H[0],Bt=Pt,kt=Pt;;){if(Bt.Curr===Bt.Next.Curr&&(w||Bt.Next!==Pt)){if(Bt===Bt.Next)break;Bt===Pt&&(Pt=Bt.Next),Bt=this.RemoveEdge(Bt),kt=Bt;continue;}if(Bt.Prev===Bt.Next)break;if(w&&e.ClipperBase.SlopesEqual4(Bt.Prev.Curr,Bt.Curr,Bt.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(Bt.Prev.Curr,Bt.Curr,Bt.Next.Curr))){Bt===Pt&&(Pt=Bt.Next),Bt=this.RemoveEdge(Bt),Bt=Bt.Prev,kt=Bt;continue;}if(Bt=Bt.Next,Bt===kt||!w&&Bt.Next===Pt)break;}if(!w&&Bt===Bt.Next||w&&Bt.Prev===Bt.Next)return!1;w||(this.m_HasOpenPaths=!0,Pt.Prev.OutIdx=e.ClipperBase.Skip),Bt=Pt;do this.InitEdge2(Bt,P),Bt=Bt.Next,st&&Bt.Curr.Y!==Pt.Curr.Y&&(st=!1);while(Bt!==Pt);if(st){if(w)return!1;Bt.Prev.OutIdx=e.ClipperBase.Skip;var jt=new e.LocalMinima();for(jt.Next=null,jt.Y=Bt.Bot.Y,jt.LeftBound=null,jt.RightBound=Bt,jt.RightBound.Side=e.EdgeSide.esRight,jt.RightBound.WindDelta=0;Bt.Bot.X!==Bt.Prev.Top.X&&this.ReverseHorizontal(Bt),Bt.Next.OutIdx!==e.ClipperBase.Skip;)Bt.NextInLML=Bt.Next,Bt=Bt.Next;return this.InsertLocalMinima(jt),this.m_edges.push(H),!0;}this.m_edges.push(H);var qt,oe=null;for(e.IntPoint.op_Equality(Bt.Prev.Bot,Bt.Prev.Top)&&(Bt=Bt.Next);Bt=this.FindNextLocMin(Bt),Bt!==oe;){oe===null&&(oe=Bt);var jt=new e.LocalMinima();jt.Next=null,jt.Y=Bt.Bot.Y,Bt.Dx<Bt.Prev.Dx?(jt.LeftBound=Bt.Prev,jt.RightBound=Bt,qt=!1):(jt.LeftBound=Bt,jt.RightBound=Bt.Prev,qt=!0),jt.LeftBound.Side=e.EdgeSide.esLeft,jt.RightBound.Side=e.EdgeSide.esRight,w?jt.LeftBound.Next===jt.RightBound?jt.LeftBound.WindDelta=-1:jt.LeftBound.WindDelta=1:jt.LeftBound.WindDelta=0,jt.RightBound.WindDelta=-jt.LeftBound.WindDelta,Bt=this.ProcessBound(jt.LeftBound,qt),Bt.OutIdx===e.ClipperBase.Skip&&(Bt=this.ProcessBound(Bt,qt));var me=this.ProcessBound(jt.RightBound,!qt);me.OutIdx===e.ClipperBase.Skip&&(me=this.ProcessBound(me,!qt)),jt.LeftBound.OutIdx===e.ClipperBase.Skip?jt.LeftBound=null:jt.RightBound.OutIdx===e.ClipperBase.Skip&&(jt.RightBound=null),this.InsertLocalMinima(jt),qt||(Bt=me);}return!0;},e.ClipperBase.prototype.AddPaths=function(a,P,w){for(var F=!1,H=0,_=a.length;H<_;++H)this.AddPath(a[H],P,w)&&(F=!0);return F;},e.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(a,P,w){return e.IntPoint.op_Equality(a,w)||e.IntPoint.op_Equality(a,P)||e.IntPoint.op_Equality(w,P)?!1:a.X!==w.X?P.X>a.X==P.X<w.X:P.Y>a.Y==P.Y<w.Y;},e.ClipperBase.prototype.RemoveEdge=function(a){a.Prev.Next=a.Next,a.Next.Prev=a.Prev;var P=a.Next;return a.Prev=null,P;},e.ClipperBase.prototype.SetDx=function(a){a.Delta.X=a.Top.X-a.Bot.X,a.Delta.Y=a.Top.Y-a.Bot.Y,a.Delta.Y===0?a.Dx=e.ClipperBase.horizontal:a.Dx=a.Delta.X/a.Delta.Y;},e.ClipperBase.prototype.InsertLocalMinima=function(a){if(this.m_MinimaList===null)this.m_MinimaList=a;else if(a.Y>=this.m_MinimaList.Y)a.Next=this.m_MinimaList,this.m_MinimaList=a;else{for(var P=this.m_MinimaList;P.Next!==null&&a.Y<P.Next.Y;)P=P.Next;a.Next=P.Next,P.Next=a;}},e.ClipperBase.prototype.PopLocalMinima=function(a,P){return P.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===a?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1;},e.ClipperBase.prototype.ReverseHorizontal=function(a){var P=a.Top.X;a.Top.X=a.Bot.X,a.Bot.X=P,e.use_xyz&&(P=a.Top.Z,a.Top.Z=a.Bot.Z,a.Bot.Z=P);},e.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var a=this.m_MinimaList;a!==null;){this.InsertScanbeam(a.Y);var P=a.LeftBound;P!==null&&(P.Curr.X=P.Bot.X,P.Curr.Y=P.Bot.Y,e.use_xyz&&(P.Curr.Z=P.Bot.Z),P.OutIdx=e.ClipperBase.Unassigned),P=a.RightBound,P!==null&&(P.Curr.X=P.Bot.X,P.Curr.Y=P.Bot.Y,e.use_xyz&&(P.Curr.Z=P.Bot.Z),P.OutIdx=e.ClipperBase.Unassigned),a=a.Next;}this.m_ActiveEdges=null;}},e.ClipperBase.prototype.InsertScanbeam=function(a){if(this.m_Scanbeam===null)this.m_Scanbeam=new e.Scanbeam(),this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=a;else if(a>this.m_Scanbeam.Y){var P=new e.Scanbeam();P.Y=a,P.Next=this.m_Scanbeam,this.m_Scanbeam=P;}else{for(var w=this.m_Scanbeam;w.Next!==null&&a<=w.Next.Y;)w=w.Next;if(a===w.Y)return;var F=new e.Scanbeam();F.Y=a,F.Next=w.Next,w.Next=F;}},e.ClipperBase.prototype.PopScanbeam=function(a){return this.m_Scanbeam===null?(a.v=0,!1):(a.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0);},e.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null;},e.ClipperBase.prototype.CreateOutRec=function(){var a=new e.OutRec();return a.Idx=e.ClipperBase.Unassigned,a.IsHole=!1,a.IsOpen=!1,a.FirstLeft=null,a.Pts=null,a.BottomPt=null,a.PolyNode=null,this.m_PolyOuts.push(a),a.Idx=this.m_PolyOuts.length-1,a;},e.ClipperBase.prototype.DisposeOutRec=function(a){var P=this.m_PolyOuts[a];P.Pts=null,P=null,this.m_PolyOuts[a]=null;},e.ClipperBase.prototype.UpdateEdgeIntoAEL=function(a){a.NextInLML===null&&e.Error("UpdateEdgeIntoAEL: invalid call");var P=a.PrevInAEL,w=a.NextInAEL;return a.NextInLML.OutIdx=a.OutIdx,P!==null?P.NextInAEL=a.NextInLML:this.m_ActiveEdges=a.NextInLML,w!==null&&(w.PrevInAEL=a.NextInLML),a.NextInLML.Side=a.Side,a.NextInLML.WindDelta=a.WindDelta,a.NextInLML.WindCnt=a.WindCnt,a.NextInLML.WindCnt2=a.WindCnt2,a=a.NextInLML,a.Curr.X=a.Bot.X,a.Curr.Y=a.Bot.Y,a.PrevInAEL=P,a.NextInAEL=w,e.ClipperBase.IsHorizontal(a)||this.InsertScanbeam(a.Top.Y),a;},e.ClipperBase.prototype.SwapPositionsInAEL=function(a,P){if(!(a.NextInAEL===a.PrevInAEL||P.NextInAEL===P.PrevInAEL)){if(a.NextInAEL===P){var w=P.NextInAEL;w!==null&&(w.PrevInAEL=a);var F=a.PrevInAEL;F!==null&&(F.NextInAEL=P),P.PrevInAEL=F,P.NextInAEL=a,a.PrevInAEL=P,a.NextInAEL=w;}else if(P.NextInAEL===a){var H=a.NextInAEL;H!==null&&(H.PrevInAEL=P);var _=P.PrevInAEL;_!==null&&(_.NextInAEL=a),a.PrevInAEL=_,a.NextInAEL=P,P.PrevInAEL=a,P.NextInAEL=H;}else{var st=a.NextInAEL,yt=a.PrevInAEL;a.NextInAEL=P.NextInAEL,a.NextInAEL!==null&&(a.NextInAEL.PrevInAEL=a),a.PrevInAEL=P.PrevInAEL,a.PrevInAEL!==null&&(a.PrevInAEL.NextInAEL=a),P.NextInAEL=st,P.NextInAEL!==null&&(P.NextInAEL.PrevInAEL=P),P.PrevInAEL=yt,P.PrevInAEL!==null&&(P.PrevInAEL.NextInAEL=P);}a.PrevInAEL===null?this.m_ActiveEdges=a:P.PrevInAEL===null&&(this.m_ActiveEdges=P);}},e.ClipperBase.prototype.DeleteFromAEL=function(a){var P=a.PrevInAEL,w=a.NextInAEL;P===null&&w===null&&a!==this.m_ActiveEdges||(P!==null?P.NextInAEL=w:this.m_ActiveEdges=w,w!==null&&(w.PrevInAEL=P),a.NextInAEL=null,a.PrevInAEL=null);},e.Clipper=function(a){_typeof(a)>"u"&&(a=0),this.m_PolyOuts=null,this.m_ClipType=e.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=e.PolyFillType.pftEvenOdd,this.m_SubjFillType=e.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,e.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array(),this.m_IntersectNodeComparer=e.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array(),this.m_Joins=new Array(),this.m_GhostJoins=new Array(),this.ReverseSolution=(1&a)!==0,this.StrictlySimple=(2&a)!==0,this.PreserveCollinear=(4&a)!==0,e.use_xyz&&(this.ZFillFunction=null);},e.Clipper.ioReverseSolution=1,e.Clipper.ioStrictlySimple=2,e.Clipper.ioPreserveCollinear=4,e.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),e.ClipperBase.prototype.Clear.call(this));},e.Clipper.prototype.InsertMaxima=function(a){var P=new e.Maxima();if(P.X=a,this.m_Maxima===null)this.m_Maxima=P,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(a<this.m_Maxima.X)P.Next=this.m_Maxima,P.Prev=null,this.m_Maxima=P;else{for(var w=this.m_Maxima;w.Next!==null&&a>=w.Next.X;)w=w.Next;if(a===w.X)return;P.Next=w.Next,P.Prev=w,w.Next!==null&&(w.Next.Prev=P),w.Next=P;}},e.Clipper.prototype.Execute=function(){var a=arguments,P=a.length,w=a[1]instanceof e.PolyTree;if(P===4&&!w){var F=a[0],H=a[1],_=a[2],st=a[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&e.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,e.Clear(H),this.m_SubjFillType=_,this.m_ClipFillType=st,this.m_ClipType=F,this.m_UsingPolyTree=!1;try{var yt=this.ExecuteInternal();yt&&this.BuildResult(H);}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1;}return yt;}else if(P===4&&w){var F=a[0],Pt=a[1],_=a[2],st=a[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=_,this.m_ClipFillType=st,this.m_ClipType=F,this.m_UsingPolyTree=!0;try{var yt=this.ExecuteInternal();yt&&this.BuildResult2(Pt);}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1;}return yt;}else if(P===2&&!w){var F=a[0],H=a[1];return this.Execute(F,H,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd);}else if(P===2&&w){var F=a[0],Pt=a[1];return this.Execute(F,Pt,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd);}},e.Clipper.prototype.FixHoleLinkage=function(a){if(!(a.FirstLeft===null||a.IsHole!==a.FirstLeft.IsHole&&a.FirstLeft.Pts!==null)){for(var P=a.FirstLeft;P!==null&&(P.IsHole===a.IsHole||P.Pts===null);)P=P.FirstLeft;a.FirstLeft=P;}},e.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var a={},P={};if(!this.PopScanbeam(a))return!1;for(this.InsertLocalMinimaIntoAEL(a.v);this.PopScanbeam(P)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(P.v))return!1;this.ProcessEdgesAtTopOfScanbeam(P.v),a.v=P.v,this.InsertLocalMinimaIntoAEL(a.v);}var w,F,H;for(F=0,H=this.m_PolyOuts.length;F<H;F++)w=this.m_PolyOuts[F],!(w.Pts===null||w.IsOpen)&&(w.IsHole^this.ReverseSolution)==this.Area$1(w)>0&&this.ReversePolyPtLinks(w.Pts);for(this.JoinCommonEdges(),F=0,H=this.m_PolyOuts.length;F<H;F++)w=this.m_PolyOuts[F],w.Pts!==null&&(w.IsOpen?this.FixupOutPolyline(w):this.FixupOutPolygon(w));return this.StrictlySimple&&this.DoSimplePolygons(),!0;}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0;}},e.Clipper.prototype.DisposeAllPolyPts=function(){for(var a=0,P=this.m_PolyOuts.length;a<P;++a)this.DisposeOutRec(a);e.Clear(this.m_PolyOuts);},e.Clipper.prototype.AddJoin=function(a,P,w){var F=new e.Join();F.OutPt1=a,F.OutPt2=P,F.OffPt.X=w.X,F.OffPt.Y=w.Y,e.use_xyz&&(F.OffPt.Z=w.Z),this.m_Joins.push(F);},e.Clipper.prototype.AddGhostJoin=function(a,P){var w=new e.Join();w.OutPt1=a,w.OffPt.X=P.X,w.OffPt.Y=P.Y,e.use_xyz&&(w.OffPt.Z=P.Z),this.m_GhostJoins.push(w);},e.Clipper.prototype.SetZ=function(a,P,w){if(this.ZFillFunction!==null){if(a.Z!==0||this.ZFillFunction===null)return;e.IntPoint.op_Equality(a,P.Bot)?a.Z=P.Bot.Z:e.IntPoint.op_Equality(a,P.Top)?a.Z=P.Top.Z:e.IntPoint.op_Equality(a,w.Bot)?a.Z=w.Bot.Z:e.IntPoint.op_Equality(a,w.Top)?a.Z=w.Top.Z:this.ZFillFunction(P.Bot,P.Top,w.Bot,w.Top,a);}},e.Clipper.prototype.InsertLocalMinimaIntoAEL=function(a){for(var P={},w,F;this.PopLocalMinima(a,P);){w=P.v.LeftBound,F=P.v.RightBound;var H=null;if(w===null?(this.InsertEdgeIntoAEL(F,null),this.SetWindingCount(F),this.IsContributing(F)&&(H=this.AddOutPt(F,F.Bot))):F===null?(this.InsertEdgeIntoAEL(w,null),this.SetWindingCount(w),this.IsContributing(w)&&(H=this.AddOutPt(w,w.Bot)),this.InsertScanbeam(w.Top.Y)):(this.InsertEdgeIntoAEL(w,null),this.InsertEdgeIntoAEL(F,w),this.SetWindingCount(w),F.WindCnt=w.WindCnt,F.WindCnt2=w.WindCnt2,this.IsContributing(w)&&(H=this.AddLocalMinPoly(w,F,w.Bot)),this.InsertScanbeam(w.Top.Y)),F!==null&&(e.ClipperBase.IsHorizontal(F)?(F.NextInLML!==null&&this.InsertScanbeam(F.NextInLML.Top.Y),this.AddEdgeToSEL(F)):this.InsertScanbeam(F.Top.Y)),!(w===null||F===null)){if(H!==null&&e.ClipperBase.IsHorizontal(F)&&this.m_GhostJoins.length>0&&F.WindDelta!==0)for(var _=0,st=this.m_GhostJoins.length;_<st;_++){var yt=this.m_GhostJoins[_];this.HorzSegmentsOverlap(yt.OutPt1.Pt.X,yt.OffPt.X,F.Bot.X,F.Top.X)&&this.AddJoin(yt.OutPt1,H,yt.OffPt);}if(w.OutIdx>=0&&w.PrevInAEL!==null&&w.PrevInAEL.Curr.X===w.Bot.X&&w.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(w.PrevInAEL.Curr,w.PrevInAEL.Top,w.Curr,w.Top,this.m_UseFullRange)&&w.WindDelta!==0&&w.PrevInAEL.WindDelta!==0){var Pt=this.AddOutPt(w.PrevInAEL,w.Bot);this.AddJoin(H,Pt,w.Top);}if(w.NextInAEL!==F){if(F.OutIdx>=0&&F.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(F.PrevInAEL.Curr,F.PrevInAEL.Top,F.Curr,F.Top,this.m_UseFullRange)&&F.WindDelta!==0&&F.PrevInAEL.WindDelta!==0){var Pt=this.AddOutPt(F.PrevInAEL,F.Bot);this.AddJoin(H,Pt,F.Top);}var Bt=w.NextInAEL;if(Bt!==null)for(;Bt!==F;)this.IntersectEdges(F,Bt,w.Curr),Bt=Bt.NextInAEL;}}}},e.Clipper.prototype.InsertEdgeIntoAEL=function(a,P){if(this.m_ActiveEdges===null)a.PrevInAEL=null,a.NextInAEL=null,this.m_ActiveEdges=a;else if(P===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,a))a.PrevInAEL=null,a.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=a,this.m_ActiveEdges=a;else{for(P===null&&(P=this.m_ActiveEdges);P.NextInAEL!==null&&!this.E2InsertsBeforeE1(P.NextInAEL,a);)P=P.NextInAEL;a.NextInAEL=P.NextInAEL,P.NextInAEL!==null&&(P.NextInAEL.PrevInAEL=a),a.PrevInAEL=P,P.NextInAEL=a;}},e.Clipper.prototype.E2InsertsBeforeE1=function(a,P){return P.Curr.X===a.Curr.X?P.Top.Y>a.Top.Y?P.Top.X<e.Clipper.TopX(a,P.Top.Y):a.Top.X>e.Clipper.TopX(P,a.Top.Y):P.Curr.X<a.Curr.X;},e.Clipper.prototype.IsEvenOddFillType=function(a){return a.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType===e.PolyFillType.pftEvenOdd:this.m_ClipFillType===e.PolyFillType.pftEvenOdd;},e.Clipper.prototype.IsEvenOddAltFillType=function(a){return a.PolyTyp===e.PolyType.ptSubject?this.m_ClipFillType===e.PolyFillType.pftEvenOdd:this.m_SubjFillType===e.PolyFillType.pftEvenOdd;},e.Clipper.prototype.IsContributing=function(a){var P,w;switch(a.PolyTyp===e.PolyType.ptSubject?(P=this.m_SubjFillType,w=this.m_ClipFillType):(P=this.m_ClipFillType,w=this.m_SubjFillType),P){case e.PolyFillType.pftEvenOdd:if(a.WindDelta===0&&a.WindCnt!==1)return!1;break;case e.PolyFillType.pftNonZero:if(Math.abs(a.WindCnt)!==1)return!1;break;case e.PolyFillType.pftPositive:if(a.WindCnt!==1)return!1;break;default:if(a.WindCnt!==-1)return!1;break;}switch(this.m_ClipType){case e.ClipType.ctIntersection:switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2!==0;case e.PolyFillType.pftPositive:return a.WindCnt2>0;default:return a.WindCnt2<0;}case e.ClipType.ctUnion:switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0;}case e.ClipType.ctDifference:if(a.PolyTyp===e.PolyType.ptSubject)switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0;}else switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2!==0;case e.PolyFillType.pftPositive:return a.WindCnt2>0;default:return a.WindCnt2<0;}case e.ClipType.ctXor:if(a.WindDelta===0)switch(w){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return a.WindCnt2===0;case e.PolyFillType.pftPositive:return a.WindCnt2<=0;default:return a.WindCnt2>=0;}else return!0;}return!0;},e.Clipper.prototype.SetWindingCount=function(a){for(var P=a.PrevInAEL;P!==null&&(P.PolyTyp!==a.PolyTyp||P.WindDelta===0);)P=P.PrevInAEL;if(P===null){var w=a.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;a.WindDelta===0?a.WindCnt=w===e.PolyFillType.pftNegative?-1:1:a.WindCnt=a.WindDelta,a.WindCnt2=0,P=this.m_ActiveEdges;}else if(a.WindDelta===0&&this.m_ClipType!==e.ClipType.ctUnion)a.WindCnt=1,a.WindCnt2=P.WindCnt2,P=P.NextInAEL;else if(this.IsEvenOddFillType(a)){if(a.WindDelta===0){for(var F=!0,H=P.PrevInAEL;H!==null;)H.PolyTyp===P.PolyTyp&&H.WindDelta!==0&&(F=!F),H=H.PrevInAEL;a.WindCnt=F?0:1;}else a.WindCnt=a.WindDelta;a.WindCnt2=P.WindCnt2,P=P.NextInAEL;}else P.WindCnt*P.WindDelta<0?Math.abs(P.WindCnt)>1?P.WindDelta*a.WindDelta<0?a.WindCnt=P.WindCnt:a.WindCnt=P.WindCnt+a.WindDelta:a.WindCnt=a.WindDelta===0?1:a.WindDelta:a.WindDelta===0?a.WindCnt=P.WindCnt<0?P.WindCnt-1:P.WindCnt+1:P.WindDelta*a.WindDelta<0?a.WindCnt=P.WindCnt:a.WindCnt=P.WindCnt+a.WindDelta,a.WindCnt2=P.WindCnt2,P=P.NextInAEL;if(this.IsEvenOddAltFillType(a))for(;P!==a;)P.WindDelta!==0&&(a.WindCnt2=a.WindCnt2===0?1:0),P=P.NextInAEL;else for(;P!==a;)a.WindCnt2+=P.WindDelta,P=P.NextInAEL;},e.Clipper.prototype.AddEdgeToSEL=function(a){this.m_SortedEdges===null?(this.m_SortedEdges=a,a.PrevInSEL=null,a.NextInSEL=null):(a.NextInSEL=this.m_SortedEdges,a.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=a,this.m_SortedEdges=a);},e.Clipper.prototype.PopEdgeFromSEL=function(a){if(a.v=this.m_SortedEdges,a.v===null)return!1;var P=a.v;return this.m_SortedEdges=a.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),P.NextInSEL=null,P.PrevInSEL=null,!0;},e.Clipper.prototype.CopyAELToSEL=function(){var a=this.m_ActiveEdges;for(this.m_SortedEdges=a;a!==null;)a.PrevInSEL=a.PrevInAEL,a.NextInSEL=a.NextInAEL,a=a.NextInAEL;},e.Clipper.prototype.SwapPositionsInSEL=function(a,P){if(!(a.NextInSEL===null&&a.PrevInSEL===null)&&!(P.NextInSEL===null&&P.PrevInSEL===null)){if(a.NextInSEL===P){var w=P.NextInSEL;w!==null&&(w.PrevInSEL=a);var F=a.PrevInSEL;F!==null&&(F.NextInSEL=P),P.PrevInSEL=F,P.NextInSEL=a,a.PrevInSEL=P,a.NextInSEL=w;}else if(P.NextInSEL===a){var w=a.NextInSEL;w!==null&&(w.PrevInSEL=P);var F=P.PrevInSEL;F!==null&&(F.NextInSEL=a),a.PrevInSEL=F,a.NextInSEL=P,P.PrevInSEL=a,P.NextInSEL=w;}else{var w=a.NextInSEL,F=a.PrevInSEL;a.NextInSEL=P.NextInSEL,a.NextInSEL!==null&&(a.NextInSEL.PrevInSEL=a),a.PrevInSEL=P.PrevInSEL,a.PrevInSEL!==null&&(a.PrevInSEL.NextInSEL=a),P.NextInSEL=w,P.NextInSEL!==null&&(P.NextInSEL.PrevInSEL=P),P.PrevInSEL=F,P.PrevInSEL!==null&&(P.PrevInSEL.NextInSEL=P);}a.PrevInSEL===null?this.m_SortedEdges=a:P.PrevInSEL===null&&(this.m_SortedEdges=P);}},e.Clipper.prototype.AddLocalMaxPoly=function(a,P,w){this.AddOutPt(a,w),P.WindDelta===0&&this.AddOutPt(P,w),a.OutIdx===P.OutIdx?(a.OutIdx=-1,P.OutIdx=-1):a.OutIdx<P.OutIdx?this.AppendPolygon(a,P):this.AppendPolygon(P,a);},e.Clipper.prototype.AddLocalMinPoly=function(a,P,w){var F,H,_;if(e.ClipperBase.IsHorizontal(P)||a.Dx>P.Dx?(F=this.AddOutPt(a,w),P.OutIdx=a.OutIdx,a.Side=e.EdgeSide.esLeft,P.Side=e.EdgeSide.esRight,H=a,H.PrevInAEL===P?_=P.PrevInAEL:_=H.PrevInAEL):(F=this.AddOutPt(P,w),a.OutIdx=P.OutIdx,a.Side=e.EdgeSide.esRight,P.Side=e.EdgeSide.esLeft,H=P,H.PrevInAEL===a?_=a.PrevInAEL:_=H.PrevInAEL),_!==null&&_.OutIdx>=0&&_.Top.Y<w.Y&&H.Top.Y<w.Y){var st=e.Clipper.TopX(_,w.Y),yt=e.Clipper.TopX(H,w.Y);if(st===yt&&H.WindDelta!==0&&_.WindDelta!==0&&e.ClipperBase.SlopesEqual5(new e.IntPoint2(st,w.Y),_.Top,new e.IntPoint2(yt,w.Y),H.Top,this.m_UseFullRange)){var Pt=this.AddOutPt(_,w);this.AddJoin(F,Pt,H.Top);}}return F;},e.Clipper.prototype.AddOutPt=function(a,P){if(a.OutIdx<0){var w=this.CreateOutRec();w.IsOpen=a.WindDelta===0;var F=new e.OutPt();return w.Pts=F,F.Idx=w.Idx,F.Pt.X=P.X,F.Pt.Y=P.Y,e.use_xyz&&(F.Pt.Z=P.Z),F.Next=F,F.Prev=F,w.IsOpen||this.SetHoleState(a,w),a.OutIdx=w.Idx,F;}else{var w=this.m_PolyOuts[a.OutIdx],H=w.Pts,_=a.Side===e.EdgeSide.esLeft;if(_&&e.IntPoint.op_Equality(P,H.Pt))return H;if(!_&&e.IntPoint.op_Equality(P,H.Prev.Pt))return H.Prev;var F=new e.OutPt();return F.Idx=w.Idx,F.Pt.X=P.X,F.Pt.Y=P.Y,e.use_xyz&&(F.Pt.Z=P.Z),F.Next=H,F.Prev=H.Prev,F.Prev.Next=F,H.Prev=F,_&&(w.Pts=F),F;}},e.Clipper.prototype.GetLastOutPt=function(a){var P=this.m_PolyOuts[a.OutIdx];return a.Side===e.EdgeSide.esLeft?P.Pts:P.Pts.Prev;},e.Clipper.prototype.SwapPoints=function(a,P){var w=new e.IntPoint1(a.Value);a.Value.X=P.Value.X,a.Value.Y=P.Value.Y,e.use_xyz&&(a.Value.Z=P.Value.Z),P.Value.X=w.X,P.Value.Y=w.Y,e.use_xyz&&(P.Value.Z=w.Z);},e.Clipper.prototype.HorzSegmentsOverlap=function(a,P,w,F){var H;return a>P&&(H=a,a=P,P=H),w>F&&(H=w,w=F,F=H),a<F&&w<P;},e.Clipper.prototype.SetHoleState=function(a,P){for(var w=a.PrevInAEL,F=null;w!==null;)w.OutIdx>=0&&w.WindDelta!==0&&(F===null?F=w:F.OutIdx===w.OutIdx&&(F=null)),w=w.PrevInAEL;F===null?(P.FirstLeft=null,P.IsHole=!1):(P.FirstLeft=this.m_PolyOuts[F.OutIdx],P.IsHole=!P.FirstLeft.IsHole);},e.Clipper.prototype.GetDx=function(a,P){return a.Y===P.Y?e.ClipperBase.horizontal:(P.X-a.X)/(P.Y-a.Y);},e.Clipper.prototype.FirstIsBottomPt=function(a,P){for(var w=a.Prev;e.IntPoint.op_Equality(w.Pt,a.Pt)&&w!==a;)w=w.Prev;var F=Math.abs(this.GetDx(a.Pt,w.Pt));for(w=a.Next;e.IntPoint.op_Equality(w.Pt,a.Pt)&&w!==a;)w=w.Next;var H=Math.abs(this.GetDx(a.Pt,w.Pt));for(w=P.Prev;e.IntPoint.op_Equality(w.Pt,P.Pt)&&w!==P;)w=w.Prev;var _=Math.abs(this.GetDx(P.Pt,w.Pt));for(w=P.Next;e.IntPoint.op_Equality(w.Pt,P.Pt)&&w!==P;)w=w.Next;var st=Math.abs(this.GetDx(P.Pt,w.Pt));return Math.max(F,H)===Math.max(_,st)&&Math.min(F,H)===Math.min(_,st)?this.Area(a)>0:F>=_&&F>=st||H>=_&&H>=st;},e.Clipper.prototype.GetBottomPt=function(a){for(var P=null,w=a.Next;w!==a;)w.Pt.Y>a.Pt.Y?(a=w,P=null):w.Pt.Y===a.Pt.Y&&w.Pt.X<=a.Pt.X&&(w.Pt.X<a.Pt.X?(P=null,a=w):w.Next!==a&&w.Prev!==a&&(P=w)),w=w.Next;if(P!==null)for(;P!==w;)for(this.FirstIsBottomPt(w,P)||(a=P),P=P.Next;e.IntPoint.op_Inequality(P.Pt,a.Pt);)P=P.Next;return a;},e.Clipper.prototype.GetLowermostRec=function(a,P){a.BottomPt===null&&(a.BottomPt=this.GetBottomPt(a.Pts)),P.BottomPt===null&&(P.BottomPt=this.GetBottomPt(P.Pts));var w=a.BottomPt,F=P.BottomPt;return w.Pt.Y>F.Pt.Y?a:w.Pt.Y<F.Pt.Y?P:w.Pt.X<F.Pt.X?a:w.Pt.X>F.Pt.X||w.Next===w?P:F.Next===F||this.FirstIsBottomPt(w,F)?a:P;},e.Clipper.prototype.OutRec1RightOfOutRec2=function(a,P){do if(a=a.FirstLeft,a===P)return!0;while(a!==null);return!1;},e.Clipper.prototype.GetOutRec=function(a){for(var P=this.m_PolyOuts[a];P!==this.m_PolyOuts[P.Idx];)P=this.m_PolyOuts[P.Idx];return P;},e.Clipper.prototype.AppendPolygon=function(a,P){var w=this.m_PolyOuts[a.OutIdx],F=this.m_PolyOuts[P.OutIdx],H;this.OutRec1RightOfOutRec2(w,F)?H=F:this.OutRec1RightOfOutRec2(F,w)?H=w:H=this.GetLowermostRec(w,F);var _=w.Pts,st=_.Prev,yt=F.Pts,Pt=yt.Prev;a.Side===e.EdgeSide.esLeft?P.Side===e.EdgeSide.esLeft?(this.ReversePolyPtLinks(yt),yt.Next=_,_.Prev=yt,st.Next=Pt,Pt.Prev=st,w.Pts=Pt):(Pt.Next=_,_.Prev=Pt,yt.Prev=st,st.Next=yt,w.Pts=yt):P.Side===e.EdgeSide.esRight?(this.ReversePolyPtLinks(yt),st.Next=Pt,Pt.Prev=st,yt.Next=_,_.Prev=yt):(st.Next=yt,yt.Prev=st,_.Prev=Pt,Pt.Next=_),w.BottomPt=null,H===F&&(F.FirstLeft!==w&&(w.FirstLeft=F.FirstLeft),w.IsHole=F.IsHole),F.Pts=null,F.BottomPt=null,F.FirstLeft=w;var Bt=a.OutIdx,kt=P.OutIdx;a.OutIdx=-1,P.OutIdx=-1;for(var jt=this.m_ActiveEdges;jt!==null;){if(jt.OutIdx===kt){jt.OutIdx=Bt,jt.Side=a.Side;break;}jt=jt.NextInAEL;}F.Idx=w.Idx;},e.Clipper.prototype.ReversePolyPtLinks=function(a){if(a!==null){var P,w;P=a;do w=P.Next,P.Next=P.Prev,P.Prev=w,P=w;while(P!==a);}},e.Clipper.SwapSides=function(a,P){var w=a.Side;a.Side=P.Side,P.Side=w;},e.Clipper.SwapPolyIndexes=function(a,P){var w=a.OutIdx;a.OutIdx=P.OutIdx,P.OutIdx=w;},e.Clipper.prototype.IntersectEdges=function(a,P,w){var F=a.OutIdx>=0,H=P.OutIdx>=0;if(e.use_xyz&&this.SetZ(w,a,P),e.use_lines&&(a.WindDelta===0||P.WindDelta===0)){if(a.WindDelta===0&&P.WindDelta===0)return;a.PolyTyp===P.PolyTyp&&a.WindDelta!==P.WindDelta&&this.m_ClipType===e.ClipType.ctUnion?a.WindDelta===0?H&&(this.AddOutPt(a,w),F&&(a.OutIdx=-1)):F&&(this.AddOutPt(P,w),H&&(P.OutIdx=-1)):a.PolyTyp!==P.PolyTyp&&(a.WindDelta===0&&Math.abs(P.WindCnt)===1&&(this.m_ClipType!==e.ClipType.ctUnion||P.WindCnt2===0)?(this.AddOutPt(a,w),F&&(a.OutIdx=-1)):P.WindDelta===0&&Math.abs(a.WindCnt)===1&&(this.m_ClipType!==e.ClipType.ctUnion||a.WindCnt2===0)&&(this.AddOutPt(P,w),H&&(P.OutIdx=-1)));return;}if(a.PolyTyp===P.PolyTyp){if(this.IsEvenOddFillType(a)){var _=a.WindCnt;a.WindCnt=P.WindCnt,P.WindCnt=_;}else a.WindCnt+P.WindDelta===0?a.WindCnt=-a.WindCnt:a.WindCnt+=P.WindDelta,P.WindCnt-a.WindDelta===0?P.WindCnt=-P.WindCnt:P.WindCnt-=a.WindDelta;}else this.IsEvenOddFillType(P)?a.WindCnt2=a.WindCnt2===0?1:0:a.WindCnt2+=P.WindDelta,this.IsEvenOddFillType(a)?P.WindCnt2=P.WindCnt2===0?1:0:P.WindCnt2-=a.WindDelta;var st,yt,Pt,Bt;a.PolyTyp===e.PolyType.ptSubject?(st=this.m_SubjFillType,Pt=this.m_ClipFillType):(st=this.m_ClipFillType,Pt=this.m_SubjFillType),P.PolyTyp===e.PolyType.ptSubject?(yt=this.m_SubjFillType,Bt=this.m_ClipFillType):(yt=this.m_ClipFillType,Bt=this.m_SubjFillType);var kt,jt;switch(st){case e.PolyFillType.pftPositive:kt=a.WindCnt;break;case e.PolyFillType.pftNegative:kt=-a.WindCnt;break;default:kt=Math.abs(a.WindCnt);break;}switch(yt){case e.PolyFillType.pftPositive:jt=P.WindCnt;break;case e.PolyFillType.pftNegative:jt=-P.WindCnt;break;default:jt=Math.abs(P.WindCnt);break;}if(F&&H)kt!==0&&kt!==1||jt!==0&&jt!==1||a.PolyTyp!==P.PolyTyp&&this.m_ClipType!==e.ClipType.ctXor?this.AddLocalMaxPoly(a,P,w):(this.AddOutPt(a,w),this.AddOutPt(P,w),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if(F)(jt===0||jt===1)&&(this.AddOutPt(a,w),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if(H)(kt===0||kt===1)&&(this.AddOutPt(P,w),e.Clipper.SwapSides(a,P),e.Clipper.SwapPolyIndexes(a,P));else if((kt===0||kt===1)&&(jt===0||jt===1)){var qt,oe;switch(Pt){case e.PolyFillType.pftPositive:qt=a.WindCnt2;break;case e.PolyFillType.pftNegative:qt=-a.WindCnt2;break;default:qt=Math.abs(a.WindCnt2);break;}switch(Bt){case e.PolyFillType.pftPositive:oe=P.WindCnt2;break;case e.PolyFillType.pftNegative:oe=-P.WindCnt2;break;default:oe=Math.abs(P.WindCnt2);break;}if(a.PolyTyp!==P.PolyTyp)this.AddLocalMinPoly(a,P,w);else if(kt===1&&jt===1)switch(this.m_ClipType){case e.ClipType.ctIntersection:qt>0&&oe>0&&this.AddLocalMinPoly(a,P,w);break;case e.ClipType.ctUnion:qt<=0&&oe<=0&&this.AddLocalMinPoly(a,P,w);break;case e.ClipType.ctDifference:(a.PolyTyp===e.PolyType.ptClip&&qt>0&&oe>0||a.PolyTyp===e.PolyType.ptSubject&&qt<=0&&oe<=0)&&this.AddLocalMinPoly(a,P,w);break;case e.ClipType.ctXor:this.AddLocalMinPoly(a,P,w);break;}else e.Clipper.SwapSides(a,P);}},e.Clipper.prototype.DeleteFromSEL=function(a){var P=a.PrevInSEL,w=a.NextInSEL;P===null&&w===null&&a!==this.m_SortedEdges||(P!==null?P.NextInSEL=w:this.m_SortedEdges=w,w!==null&&(w.PrevInSEL=P),a.NextInSEL=null,a.PrevInSEL=null);},e.Clipper.prototype.ProcessHorizontals=function(){for(var a={};this.PopEdgeFromSEL(a);)this.ProcessHorizontal(a.v);},e.Clipper.prototype.GetHorzDirection=function(a,P){a.Bot.X<a.Top.X?(P.Left=a.Bot.X,P.Right=a.Top.X,P.Dir=e.Direction.dLeftToRight):(P.Left=a.Top.X,P.Right=a.Bot.X,P.Dir=e.Direction.dRightToLeft);},e.Clipper.prototype.ProcessHorizontal=function(a){var P={Dir:null,Left:null,Right:null};this.GetHorzDirection(a,P);for(var w=P.Dir,F=P.Left,H=P.Right,_=a.WindDelta===0,st=a,yt=null;st.NextInLML!==null&&e.ClipperBase.IsHorizontal(st.NextInLML);)st=st.NextInLML;st.NextInLML===null&&(yt=this.GetMaximaPair(st));var Pt=this.m_Maxima;if(Pt!==null)if(w===e.Direction.dLeftToRight){for(;Pt!==null&&Pt.X<=a.Bot.X;)Pt=Pt.Next;Pt!==null&&Pt.X>=st.Top.X&&(Pt=null);}else{for(;Pt.Next!==null&&Pt.Next.X<a.Bot.X;)Pt=Pt.Next;Pt.X<=st.Top.X&&(Pt=null);}for(var Bt=null;;){for(var kt=a===st,jt=this.GetNextInAEL(a,w);jt!==null;){if(Pt!==null)if(w===e.Direction.dLeftToRight)for(;Pt!==null&&Pt.X<jt.Curr.X;)a.OutIdx>=0&&!_&&this.AddOutPt(a,new e.IntPoint2(Pt.X,a.Bot.Y)),Pt=Pt.Next;else for(;Pt!==null&&Pt.X>jt.Curr.X;)a.OutIdx>=0&&!_&&this.AddOutPt(a,new e.IntPoint2(Pt.X,a.Bot.Y)),Pt=Pt.Prev;if(w===e.Direction.dLeftToRight&&jt.Curr.X>H||w===e.Direction.dRightToLeft&&jt.Curr.X<F||jt.Curr.X===a.Top.X&&a.NextInLML!==null&&jt.Dx<a.NextInLML.Dx)break;if(a.OutIdx>=0&&!_){e.use_xyz&&(w===e.Direction.dLeftToRight?this.SetZ(jt.Curr,a,jt):this.SetZ(jt.Curr,jt,a)),Bt=this.AddOutPt(a,jt.Curr);for(var qt=this.m_SortedEdges;qt!==null;){if(qt.OutIdx>=0&&this.HorzSegmentsOverlap(a.Bot.X,a.Top.X,qt.Bot.X,qt.Top.X)){var oe=this.GetLastOutPt(qt);this.AddJoin(oe,Bt,qt.Top);}qt=qt.NextInSEL;}this.AddGhostJoin(Bt,a.Bot);}if(jt===yt&&kt){a.OutIdx>=0&&this.AddLocalMaxPoly(a,yt,a.Top),this.DeleteFromAEL(a),this.DeleteFromAEL(yt);return;}if(w===e.Direction.dLeftToRight){var me=new e.IntPoint2(jt.Curr.X,a.Curr.Y);this.IntersectEdges(a,jt,me);}else{var me=new e.IntPoint2(jt.Curr.X,a.Curr.Y);this.IntersectEdges(jt,a,me);}var Pe=this.GetNextInAEL(jt,w);this.SwapPositionsInAEL(a,jt),jt=Pe;}if(a.NextInLML===null||!e.ClipperBase.IsHorizontal(a.NextInLML))break;a=this.UpdateEdgeIntoAEL(a),a.OutIdx>=0&&this.AddOutPt(a,a.Bot),P={Dir:w,Left:F,Right:H},this.GetHorzDirection(a,P),w=P.Dir,F=P.Left,H=P.Right;}if(a.OutIdx>=0&&Bt===null){Bt=this.GetLastOutPt(a);for(var qt=this.m_SortedEdges;qt!==null;){if(qt.OutIdx>=0&&this.HorzSegmentsOverlap(a.Bot.X,a.Top.X,qt.Bot.X,qt.Top.X)){var oe=this.GetLastOutPt(qt);this.AddJoin(oe,Bt,qt.Top);}qt=qt.NextInSEL;}this.AddGhostJoin(Bt,a.Top);}if(a.NextInLML!==null){if(a.OutIdx>=0){if(Bt=this.AddOutPt(a,a.Top),a=this.UpdateEdgeIntoAEL(a),a.WindDelta===0)return;var De=a.PrevInAEL,Pe=a.NextInAEL;if(De!==null&&De.Curr.X===a.Bot.X&&De.Curr.Y===a.Bot.Y&&De.WindDelta===0&&De.OutIdx>=0&&De.Curr.Y>De.Top.Y&&e.ClipperBase.SlopesEqual3(a,De,this.m_UseFullRange)){var oe=this.AddOutPt(De,a.Bot);this.AddJoin(Bt,oe,a.Top);}else if(Pe!==null&&Pe.Curr.X===a.Bot.X&&Pe.Curr.Y===a.Bot.Y&&Pe.WindDelta!==0&&Pe.OutIdx>=0&&Pe.Curr.Y>Pe.Top.Y&&e.ClipperBase.SlopesEqual3(a,Pe,this.m_UseFullRange)){var oe=this.AddOutPt(Pe,a.Bot);this.AddJoin(Bt,oe,a.Top);}}else a=this.UpdateEdgeIntoAEL(a);}else a.OutIdx>=0&&this.AddOutPt(a,a.Top),this.DeleteFromAEL(a);},e.Clipper.prototype.GetNextInAEL=function(a,P){return P===e.Direction.dLeftToRight?a.NextInAEL:a.PrevInAEL;},e.Clipper.prototype.IsMinima=function(a){return a!==null&&a.Prev.NextInLML!==a&&a.Next.NextInLML!==a;},e.Clipper.prototype.IsMaxima=function(a,P){return a!==null&&a.Top.Y===P&&a.NextInLML===null;},e.Clipper.prototype.IsIntermediate=function(a,P){return a.Top.Y===P&&a.NextInLML!==null;},e.Clipper.prototype.GetMaximaPair=function(a){return e.IntPoint.op_Equality(a.Next.Top,a.Top)&&a.Next.NextInLML===null?a.Next:e.IntPoint.op_Equality(a.Prev.Top,a.Top)&&a.Prev.NextInLML===null?a.Prev:null;},e.Clipper.prototype.GetMaximaPairEx=function(a){var P=this.GetMaximaPair(a);return P===null||P.OutIdx===e.ClipperBase.Skip||P.NextInAEL===P.PrevInAEL&&!e.ClipperBase.IsHorizontal(P)?null:P;},e.Clipper.prototype.ProcessIntersections=function(a){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(a),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1;}catch(_unused23){this.m_SortedEdges=null,this.m_IntersectList.length=0,e.Error("ProcessIntersections error");}return this.m_SortedEdges=null,!0;},e.Clipper.prototype.BuildIntersectList=function(a){if(this.m_ActiveEdges!==null){var P=this.m_ActiveEdges;for(this.m_SortedEdges=P;P!==null;)P.PrevInSEL=P.PrevInAEL,P.NextInSEL=P.NextInAEL,P.Curr.X=e.Clipper.TopX(P,a),P=P.NextInAEL;for(var w=!0;w&&this.m_SortedEdges!==null;){for(w=!1,P=this.m_SortedEdges;P.NextInSEL!==null;){var F=P.NextInSEL,H=new e.IntPoint0();if(P.Curr.X>F.Curr.X){this.IntersectPoint(P,F,H),H.Y<a&&(H=new e.IntPoint2(e.Clipper.TopX(P,a),a));var _=new e.IntersectNode();_.Edge1=P,_.Edge2=F,_.Pt.X=H.X,_.Pt.Y=H.Y,e.use_xyz&&(_.Pt.Z=H.Z),this.m_IntersectList.push(_),this.SwapPositionsInSEL(P,F),w=!0;}else P=F;}if(P.PrevInSEL!==null)P.PrevInSEL.NextInSEL=null;else break;}this.m_SortedEdges=null;}},e.Clipper.prototype.EdgesAdjacent=function(a){return a.Edge1.NextInSEL===a.Edge2||a.Edge1.PrevInSEL===a.Edge2;},e.Clipper.IntersectNodeSort=function(a,P){return P.Pt.Y-a.Pt.Y;},e.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var a=this.m_IntersectList.length,P=0;P<a;P++){if(!this.EdgesAdjacent(this.m_IntersectList[P])){for(var w=P+1;w<a&&!this.EdgesAdjacent(this.m_IntersectList[w]);)w++;if(w===a)return!1;var F=this.m_IntersectList[P];this.m_IntersectList[P]=this.m_IntersectList[w],this.m_IntersectList[w]=F;}this.SwapPositionsInSEL(this.m_IntersectList[P].Edge1,this.m_IntersectList[P].Edge2);}return!0;},e.Clipper.prototype.ProcessIntersectList=function(){for(var a=0,P=this.m_IntersectList.length;a<P;a++){var w=this.m_IntersectList[a];this.IntersectEdges(w.Edge1,w.Edge2,w.Pt),this.SwapPositionsInAEL(w.Edge1,w.Edge2);}this.m_IntersectList.length=0;};var $o=function $o(a){return a<0?Math.ceil(a-0.5):Math.round(a);},os=function os(a){return a<0?Math.ceil(a-0.5):Math.floor(a+0.5);},Jn=function Jn(a){return a<0?-Math.round(Math.abs(a)):Math.round(a);},as=function as(a){return a<0?(a-=0.5,a<-2147483648?Math.ceil(a):a|0):(a+=0.5,a>2147483647?Math.floor(a):a|0);};s.msie?e.Clipper.Round=$o:s.chromium?e.Clipper.Round=Jn:s.safari?e.Clipper.Round=as:e.Clipper.Round=os,e.Clipper.TopX=function(a,P){return P===a.Top.Y?a.Top.X:a.Bot.X+e.Clipper.Round(a.Dx*(P-a.Bot.Y));},e.Clipper.prototype.IntersectPoint=function(a,P,w){w.X=0,w.Y=0;var F,H;if(a.Dx===P.Dx){w.Y=a.Curr.Y,w.X=e.Clipper.TopX(a,w.Y);return;}if(a.Delta.X===0)w.X=a.Bot.X,e.ClipperBase.IsHorizontal(P)?w.Y=P.Bot.Y:(H=P.Bot.Y-P.Bot.X/P.Dx,w.Y=e.Clipper.Round(w.X/P.Dx+H));else if(P.Delta.X===0)w.X=P.Bot.X,e.ClipperBase.IsHorizontal(a)?w.Y=a.Bot.Y:(F=a.Bot.Y-a.Bot.X/a.Dx,w.Y=e.Clipper.Round(w.X/a.Dx+F));else{F=a.Bot.X-a.Bot.Y*a.Dx,H=P.Bot.X-P.Bot.Y*P.Dx;var _=(H-F)/(a.Dx-P.Dx);w.Y=e.Clipper.Round(_),Math.abs(a.Dx)<Math.abs(P.Dx)?w.X=e.Clipper.Round(a.Dx*_+F):w.X=e.Clipper.Round(P.Dx*_+H);}if(w.Y<a.Top.Y||w.Y<P.Top.Y){if(a.Top.Y>P.Top.Y)return w.Y=a.Top.Y,w.X=e.Clipper.TopX(P,a.Top.Y),w.X<a.Top.X;w.Y=P.Top.Y,Math.abs(a.Dx)<Math.abs(P.Dx)?w.X=e.Clipper.TopX(a,w.Y):w.X=e.Clipper.TopX(P,w.Y);}w.Y>a.Curr.Y&&(w.Y=a.Curr.Y,Math.abs(a.Dx)>Math.abs(P.Dx)?w.X=e.Clipper.TopX(P,w.Y):w.X=e.Clipper.TopX(a,w.Y));},e.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(a){for(var P=this.m_ActiveEdges;P!==null;){var w=this.IsMaxima(P,a);if(w){var F=this.GetMaximaPairEx(P);w=F===null||!e.ClipperBase.IsHorizontal(F);}if(w){this.StrictlySimple&&this.InsertMaxima(P.Top.X);var H=P.PrevInAEL;this.DoMaxima(P),H===null?P=this.m_ActiveEdges:P=H.NextInAEL;}else{if(this.IsIntermediate(P,a)&&e.ClipperBase.IsHorizontal(P.NextInLML)?(P=this.UpdateEdgeIntoAEL(P),P.OutIdx>=0&&this.AddOutPt(P,P.Bot),this.AddEdgeToSEL(P)):(P.Curr.X=e.Clipper.TopX(P,a),P.Curr.Y=a),e.use_xyz&&(P.Top.Y===a?P.Curr.Z=P.Top.Z:P.Bot.Y===a?P.Curr.Z=P.Bot.Z:P.Curr.Z=0),this.StrictlySimple){var H=P.PrevInAEL;if(P.OutIdx>=0&&P.WindDelta!==0&&H!==null&&H.OutIdx>=0&&H.Curr.X===P.Curr.X&&H.WindDelta!==0){var _=new e.IntPoint1(P.Curr);e.use_xyz&&this.SetZ(_,H,P);var st=this.AddOutPt(H,_),yt=this.AddOutPt(P,_);this.AddJoin(st,yt,_);}}P=P.NextInAEL;}}for(this.ProcessHorizontals(),this.m_Maxima=null,P=this.m_ActiveEdges;P!==null;){if(this.IsIntermediate(P,a)){var st=null;P.OutIdx>=0&&(st=this.AddOutPt(P,P.Top)),P=this.UpdateEdgeIntoAEL(P);var H=P.PrevInAEL,Pt=P.NextInAEL;if(H!==null&&H.Curr.X===P.Bot.X&&H.Curr.Y===P.Bot.Y&&st!==null&&H.OutIdx>=0&&H.Curr.Y===H.Top.Y&&e.ClipperBase.SlopesEqual5(P.Curr,P.Top,H.Curr,H.Top,this.m_UseFullRange)&&P.WindDelta!==0&&H.WindDelta!==0){var yt=this.AddOutPt(ePrev2,P.Bot);this.AddJoin(st,yt,P.Top);}else if(Pt!==null&&Pt.Curr.X===P.Bot.X&&Pt.Curr.Y===P.Bot.Y&&st!==null&&Pt.OutIdx>=0&&Pt.Curr.Y===Pt.Top.Y&&e.ClipperBase.SlopesEqual5(P.Curr,P.Top,Pt.Curr,Pt.Top,this.m_UseFullRange)&&P.WindDelta!==0&&Pt.WindDelta!==0){var yt=this.AddOutPt(Pt,P.Bot);this.AddJoin(st,yt,P.Top);}}P=P.NextInAEL;}},e.Clipper.prototype.DoMaxima=function(a){var P=this.GetMaximaPairEx(a);if(P===null){a.OutIdx>=0&&this.AddOutPt(a,a.Top),this.DeleteFromAEL(a);return;}for(var w=a.NextInAEL;w!==null&&w!==P;)this.IntersectEdges(a,w,a.Top),this.SwapPositionsInAEL(a,w),w=a.NextInAEL;a.OutIdx===-1&&P.OutIdx===-1?(this.DeleteFromAEL(a),this.DeleteFromAEL(P)):a.OutIdx>=0&&P.OutIdx>=0?(a.OutIdx>=0&&this.AddLocalMaxPoly(a,P,a.Top),this.DeleteFromAEL(a),this.DeleteFromAEL(P)):e.use_lines&&a.WindDelta===0?(a.OutIdx>=0&&(this.AddOutPt(a,a.Top),a.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(a),P.OutIdx>=0&&(this.AddOutPt(P,a.Top),P.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(P)):e.Error("DoMaxima error");},e.Clipper.ReversePaths=function(a){for(var P=0,w=a.length;P<w;P++)a[P].reverse();},e.Clipper.Orientation=function(a){return e.Clipper.Area(a)>=0;},e.Clipper.prototype.PointCount=function(a){if(a===null)return 0;var P=0,w=a;do P++,w=w.Next;while(w!==a);return P;},e.Clipper.prototype.BuildResult=function(a){e.Clear(a);for(var P=0,w=this.m_PolyOuts.length;P<w;P++){var F=this.m_PolyOuts[P];if(F.Pts!==null){var H=F.Pts.Prev,_=this.PointCount(H);if(!(_<2)){for(var st=new Array(_),yt=0;yt<_;yt++)st[yt]=H.Pt,H=H.Prev;a.push(st);}}}},e.Clipper.prototype.BuildResult2=function(a){a.Clear();for(var P=0,w=this.m_PolyOuts.length;P<w;P++){var F=this.m_PolyOuts[P],H=this.PointCount(F.Pts);if(!(F.IsOpen&&H<2||!F.IsOpen&&H<3)){this.FixHoleLinkage(F);var _=new e.PolyNode();a.m_AllPolys.push(_),F.PolyNode=_,_.m_polygon.length=H;for(var st=F.Pts.Prev,yt=0;yt<H;yt++)_.m_polygon[yt]=st.Pt,st=st.Prev;}}for(var P=0,w=this.m_PolyOuts.length;P<w;P++){var F=this.m_PolyOuts[P];F.PolyNode!==null&&(F.IsOpen?(F.PolyNode.IsOpen=!0,a.AddChild(F.PolyNode)):F.FirstLeft!==null&&F.FirstLeft.PolyNode!==null?F.FirstLeft.PolyNode.AddChild(F.PolyNode):a.AddChild(F.PolyNode));}},e.Clipper.prototype.FixupOutPolyline=function(a){for(var P=a.Pts,w=P.Prev;P!==w;)if(P=P.Next,e.IntPoint.op_Equality(P.Pt,P.Prev.Pt)){P===w&&(w=P.Prev);var F=P.Prev;F.Next=P.Next,P.Next.Prev=F,P=F;}P===P.Prev&&(a.Pts=null);},e.Clipper.prototype.FixupOutPolygon=function(a){var P=null;a.BottomPt=null;for(var w=a.Pts,F=this.PreserveCollinear||this.StrictlySimple;;){if(w.Prev===w||w.Prev===w.Next){a.Pts=null;return;}if(e.IntPoint.op_Equality(w.Pt,w.Next.Pt)||e.IntPoint.op_Equality(w.Pt,w.Prev.Pt)||e.ClipperBase.SlopesEqual4(w.Prev.Pt,w.Pt,w.Next.Pt,this.m_UseFullRange)&&(!F||!this.Pt2IsBetweenPt1AndPt3(w.Prev.Pt,w.Pt,w.Next.Pt)))P=null,w.Prev.Next=w.Next,w.Next.Prev=w.Prev,w=w.Prev;else{if(w===P)break;P===null&&(P=w),w=w.Next;}}a.Pts=w;},e.Clipper.prototype.DupOutPt=function(a,P){var w=new e.OutPt();return w.Pt.X=a.Pt.X,w.Pt.Y=a.Pt.Y,e.use_xyz&&(w.Pt.Z=a.Pt.Z),w.Idx=a.Idx,P?(w.Next=a.Next,w.Prev=a,a.Next.Prev=w,a.Next=w):(w.Prev=a.Prev,w.Next=a,a.Prev.Next=w,a.Prev=w),w;},e.Clipper.prototype.GetOverlap=function(a,P,w,F,H){return a<P?w<F?(H.Left=Math.max(a,w),H.Right=Math.min(P,F)):(H.Left=Math.max(a,F),H.Right=Math.min(P,w)):w<F?(H.Left=Math.max(P,w),H.Right=Math.min(a,F)):(H.Left=Math.max(P,F),H.Right=Math.min(a,w)),H.Left<H.Right;},e.Clipper.prototype.JoinHorz=function(a,P,w,F,H,_){var st=a.Pt.X>P.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight,yt=w.Pt.X>F.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight;if(st===yt)return!1;if(st===e.Direction.dLeftToRight){for(;a.Next.Pt.X<=H.X&&a.Next.Pt.X>=a.Pt.X&&a.Next.Pt.Y===H.Y;)a=a.Next;_&&a.Pt.X!==H.X&&(a=a.Next),P=this.DupOutPt(a,!_),e.IntPoint.op_Inequality(P.Pt,H)&&(a=P,a.Pt.X=H.X,a.Pt.Y=H.Y,e.use_xyz&&(a.Pt.Z=H.Z),P=this.DupOutPt(a,!_));}else{for(;a.Next.Pt.X>=H.X&&a.Next.Pt.X<=a.Pt.X&&a.Next.Pt.Y===H.Y;)a=a.Next;!_&&a.Pt.X!==H.X&&(a=a.Next),P=this.DupOutPt(a,_),e.IntPoint.op_Inequality(P.Pt,H)&&(a=P,a.Pt.X=H.X,a.Pt.Y=H.Y,e.use_xyz&&(a.Pt.Z=H.Z),P=this.DupOutPt(a,_));}if(yt===e.Direction.dLeftToRight){for(;w.Next.Pt.X<=H.X&&w.Next.Pt.X>=w.Pt.X&&w.Next.Pt.Y===H.Y;)w=w.Next;_&&w.Pt.X!==H.X&&(w=w.Next),F=this.DupOutPt(w,!_),e.IntPoint.op_Inequality(F.Pt,H)&&(w=F,w.Pt.X=H.X,w.Pt.Y=H.Y,e.use_xyz&&(w.Pt.Z=H.Z),F=this.DupOutPt(w,!_));}else{for(;w.Next.Pt.X>=H.X&&w.Next.Pt.X<=w.Pt.X&&w.Next.Pt.Y===H.Y;)w=w.Next;!_&&w.Pt.X!==H.X&&(w=w.Next),F=this.DupOutPt(w,_),e.IntPoint.op_Inequality(F.Pt,H)&&(w=F,w.Pt.X=H.X,w.Pt.Y=H.Y,e.use_xyz&&(w.Pt.Z=H.Z),F=this.DupOutPt(w,_));}return st===e.Direction.dLeftToRight===_?(a.Prev=w,w.Next=a,P.Next=F,F.Prev=P):(a.Next=w,w.Prev=a,P.Prev=F,F.Next=P),!0;},e.Clipper.prototype.JoinPoints=function(a,P,w){var F=a.OutPt1,H=new e.OutPt(),_=a.OutPt2,st=new e.OutPt(),yt=a.OutPt1.Pt.Y===a.OffPt.Y;if(yt&&e.IntPoint.op_Equality(a.OffPt,a.OutPt1.Pt)&&e.IntPoint.op_Equality(a.OffPt,a.OutPt2.Pt)){if(P!==w)return!1;for(H=a.OutPt1.Next;H!==F&&e.IntPoint.op_Equality(H.Pt,a.OffPt);)H=H.Next;var Pt=H.Pt.Y>a.OffPt.Y;for(st=a.OutPt2.Next;st!==_&&e.IntPoint.op_Equality(st.Pt,a.OffPt);)st=st.Next;var Bt=st.Pt.Y>a.OffPt.Y;return Pt===Bt?!1:Pt?(H=this.DupOutPt(F,!1),st=this.DupOutPt(_,!0),F.Prev=_,_.Next=F,H.Next=st,st.Prev=H,a.OutPt1=F,a.OutPt2=H,!0):(H=this.DupOutPt(F,!0),st=this.DupOutPt(_,!1),F.Next=_,_.Prev=F,H.Prev=st,st.Next=H,a.OutPt1=F,a.OutPt2=H,!0);}else if(yt){for(H=F;F.Prev.Pt.Y===F.Pt.Y&&F.Prev!==H&&F.Prev!==_;)F=F.Prev;for(;H.Next.Pt.Y===H.Pt.Y&&H.Next!==F&&H.Next!==_;)H=H.Next;if(H.Next===F||H.Next===_)return!1;for(st=_;_.Prev.Pt.Y===_.Pt.Y&&_.Prev!==st&&_.Prev!==H;)_=_.Prev;for(;st.Next.Pt.Y===st.Pt.Y&&st.Next!==_&&st.Next!==F;)st=st.Next;if(st.Next===_||st.Next===F)return!1;var kt={Left:null,Right:null};if(!this.GetOverlap(F.Pt.X,H.Pt.X,_.Pt.X,st.Pt.X,kt))return!1;var jt=kt.Left,qt=kt.Right,oe=new e.IntPoint0(),me;return F.Pt.X>=jt&&F.Pt.X<=qt?(oe.X=F.Pt.X,oe.Y=F.Pt.Y,e.use_xyz&&(oe.Z=F.Pt.Z),me=F.Pt.X>H.Pt.X):_.Pt.X>=jt&&_.Pt.X<=qt?(oe.X=_.Pt.X,oe.Y=_.Pt.Y,e.use_xyz&&(oe.Z=_.Pt.Z),me=_.Pt.X>st.Pt.X):H.Pt.X>=jt&&H.Pt.X<=qt?(oe.X=H.Pt.X,oe.Y=H.Pt.Y,e.use_xyz&&(oe.Z=H.Pt.Z),me=H.Pt.X>F.Pt.X):(oe.X=st.Pt.X,oe.Y=st.Pt.Y,e.use_xyz&&(oe.Z=st.Pt.Z),me=st.Pt.X>_.Pt.X),a.OutPt1=F,a.OutPt2=_,this.JoinHorz(F,H,_,st,oe,me);}else{for(H=F.Next;e.IntPoint.op_Equality(H.Pt,F.Pt)&&H!==F;)H=H.Next;var Pe=H.Pt.Y>F.Pt.Y||!e.ClipperBase.SlopesEqual4(F.Pt,H.Pt,a.OffPt,this.m_UseFullRange);if(Pe){for(H=F.Prev;e.IntPoint.op_Equality(H.Pt,F.Pt)&&H!==F;)H=H.Prev;if(H.Pt.Y>F.Pt.Y||!e.ClipperBase.SlopesEqual4(F.Pt,H.Pt,a.OffPt,this.m_UseFullRange))return!1;}for(st=_.Next;e.IntPoint.op_Equality(st.Pt,_.Pt)&&st!==_;)st=st.Next;var De=st.Pt.Y>_.Pt.Y||!e.ClipperBase.SlopesEqual4(_.Pt,st.Pt,a.OffPt,this.m_UseFullRange);if(De){for(st=_.Prev;e.IntPoint.op_Equality(st.Pt,_.Pt)&&st!==_;)st=st.Prev;if(st.Pt.Y>_.Pt.Y||!e.ClipperBase.SlopesEqual4(_.Pt,st.Pt,a.OffPt,this.m_UseFullRange))return!1;}return H===F||st===_||H===st||P===w&&Pe===De?!1:Pe?(H=this.DupOutPt(F,!1),st=this.DupOutPt(_,!0),F.Prev=_,_.Next=F,H.Next=st,st.Prev=H,a.OutPt1=F,a.OutPt2=H,!0):(H=this.DupOutPt(F,!0),st=this.DupOutPt(_,!1),F.Next=_,_.Prev=F,H.Prev=st,st.Next=H,a.OutPt1=F,a.OutPt2=H,!0);}},e.Clipper.GetBounds=function(a){for(var P=0,w=a.length;P<w&&a[P].length===0;)P++;if(P===w)return new e.IntRect(0,0,0,0);var F=new e.IntRect();for(F.left=a[P][0].X,F.right=F.left,F.top=a[P][0].Y,F.bottom=F.top;P<w;P++)for(var H=0,_=a[P].length;H<_;H++)a[P][H].X<F.left?F.left=a[P][H].X:a[P][H].X>F.right&&(F.right=a[P][H].X),a[P][H].Y<F.top?F.top=a[P][H].Y:a[P][H].Y>F.bottom&&(F.bottom=a[P][H].Y);return F;},e.Clipper.prototype.GetBounds2=function(a){var P=a,w=new e.IntRect();for(w.left=a.Pt.X,w.right=a.Pt.X,w.top=a.Pt.Y,w.bottom=a.Pt.Y,a=a.Next;a!==P;)a.Pt.X<w.left&&(w.left=a.Pt.X),a.Pt.X>w.right&&(w.right=a.Pt.X),a.Pt.Y<w.top&&(w.top=a.Pt.Y),a.Pt.Y>w.bottom&&(w.bottom=a.Pt.Y),a=a.Next;return w;},e.Clipper.PointInPolygon=function(a,P){var w=0,F=P.length;if(F<3)return 0;for(var H=P[0],_=1;_<=F;++_){var st=_===F?P[0]:P[_];if(st.Y===a.Y&&(st.X===a.X||H.Y===a.Y&&st.X>a.X==H.X<a.X))return-1;if(H.Y<a.Y!=st.Y<a.Y){if(H.X>=a.X){if(st.X>a.X)w=1-w;else{var yt=(H.X-a.X)*(st.Y-a.Y)-(st.X-a.X)*(H.Y-a.Y);if(yt===0)return-1;yt>0==st.Y>H.Y&&(w=1-w);}}else if(st.X>a.X){var yt=(H.X-a.X)*(st.Y-a.Y)-(st.X-a.X)*(H.Y-a.Y);if(yt===0)return-1;yt>0==st.Y>H.Y&&(w=1-w);}}H=st;}return w;},e.Clipper.prototype.PointInPolygon=function(a,P){var w=0,F=P,H=a.X,_=a.Y,st=P.Pt.X,yt=P.Pt.Y;do{P=P.Next;var Pt=P.Pt.X,Bt=P.Pt.Y;if(Bt===_&&(Pt===H||yt===_&&Pt>H==st<H))return-1;if(yt<_!=Bt<_){if(st>=H){if(Pt>H)w=1-w;else{var kt=(st-H)*(Bt-_)-(Pt-H)*(yt-_);if(kt===0)return-1;kt>0==Bt>yt&&(w=1-w);}}else if(Pt>H){var kt=(st-H)*(Bt-_)-(Pt-H)*(yt-_);if(kt===0)return-1;kt>0==Bt>yt&&(w=1-w);}}st=Pt,yt=Bt;}while(F!==P);return w;},e.Clipper.prototype.Poly2ContainsPoly1=function(a,P){var w=a;do{var F=this.PointInPolygon(w.Pt,P);if(F>=0)return F>0;w=w.Next;}while(w!==a);return!0;},e.Clipper.prototype.FixupFirstLefts1=function(a,P){for(var w,F,H=0,_=this.m_PolyOuts.length;H<_;H++)w=this.m_PolyOuts[H],F=e.Clipper.ParseFirstLeft(w.FirstLeft),w.Pts!==null&&F===a&&this.Poly2ContainsPoly1(w.Pts,P.Pts)&&(w.FirstLeft=P);},e.Clipper.prototype.FixupFirstLefts2=function(a,P){for(var w=P.FirstLeft,F,H,_=0,st=this.m_PolyOuts.length;_<st;_++)F=this.m_PolyOuts[_],!(F.Pts===null||F===P||F===a)&&(H=e.Clipper.ParseFirstLeft(F.FirstLeft),!(H!==w&&H!==a&&H!==P)&&(this.Poly2ContainsPoly1(F.Pts,a.Pts)?F.FirstLeft=a:this.Poly2ContainsPoly1(F.Pts,P.Pts)?F.FirstLeft=P:(F.FirstLeft===a||F.FirstLeft===P)&&(F.FirstLeft=w)));},e.Clipper.prototype.FixupFirstLefts3=function(a,P){for(var w,F,H=0,_=this.m_PolyOuts.length;H<_;H++)w=this.m_PolyOuts[H],F=e.Clipper.ParseFirstLeft(w.FirstLeft),w.Pts!==null&&F===a&&(w.FirstLeft=P);},e.Clipper.ParseFirstLeft=function(a){for(;a!==null&&a.Pts===null;)a=a.FirstLeft;return a;},e.Clipper.prototype.JoinCommonEdges=function(){for(var a=0,P=this.m_Joins.length;a<P;a++){var w=this.m_Joins[a],F=this.GetOutRec(w.OutPt1.Idx),H=this.GetOutRec(w.OutPt2.Idx);if(!(F.Pts===null||H.Pts===null)&&!(F.IsOpen||H.IsOpen)){var _;F===H?_=F:this.OutRec1RightOfOutRec2(F,H)?_=H:this.OutRec1RightOfOutRec2(H,F)?_=F:_=this.GetLowermostRec(F,H),this.JoinPoints(w,F,H)&&(F===H?(F.Pts=w.OutPt1,F.BottomPt=null,H=this.CreateOutRec(),H.Pts=w.OutPt2,this.UpdateOutPtIdxs(H),this.Poly2ContainsPoly1(H.Pts,F.Pts)?(H.IsHole=!F.IsHole,H.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts2(H,F),(H.IsHole^this.ReverseSolution)==this.Area$1(H)>0&&this.ReversePolyPtLinks(H.Pts)):this.Poly2ContainsPoly1(F.Pts,H.Pts)?(H.IsHole=F.IsHole,F.IsHole=!H.IsHole,H.FirstLeft=F.FirstLeft,F.FirstLeft=H,this.m_UsingPolyTree&&this.FixupFirstLefts2(F,H),(F.IsHole^this.ReverseSolution)==this.Area$1(F)>0&&this.ReversePolyPtLinks(F.Pts)):(H.IsHole=F.IsHole,H.FirstLeft=F.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(F,H))):(H.Pts=null,H.BottomPt=null,H.Idx=F.Idx,F.IsHole=_.IsHole,_===H&&(F.FirstLeft=H.FirstLeft),H.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts3(H,F)));}}},e.Clipper.prototype.UpdateOutPtIdxs=function(a){var P=a.Pts;do P.Idx=a.Idx,P=P.Prev;while(P!==a.Pts);},e.Clipper.prototype.DoSimplePolygons=function(){for(var a=0;a<this.m_PolyOuts.length;){var P=this.m_PolyOuts[a++],w=P.Pts;if(!(w===null||P.IsOpen))do{for(var F=w.Next;F!==P.Pts;){if(e.IntPoint.op_Equality(w.Pt,F.Pt)&&F.Next!==w&&F.Prev!==w){var H=w.Prev,_=F.Prev;w.Prev=_,_.Next=w,F.Prev=H,H.Next=F,P.Pts=w;var st=this.CreateOutRec();st.Pts=F,this.UpdateOutPtIdxs(st),this.Poly2ContainsPoly1(st.Pts,P.Pts)?(st.IsHole=!P.IsHole,st.FirstLeft=P,this.m_UsingPolyTree&&this.FixupFirstLefts2(st,P)):this.Poly2ContainsPoly1(P.Pts,st.Pts)?(st.IsHole=P.IsHole,P.IsHole=!st.IsHole,st.FirstLeft=P.FirstLeft,P.FirstLeft=st,this.m_UsingPolyTree&&this.FixupFirstLefts2(P,st)):(st.IsHole=P.IsHole,st.FirstLeft=P.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(P,st)),F=w;}F=F.Next;}w=w.Next;}while(w!==P.Pts);}},e.Clipper.Area=function(a){if(!Array.isArray(a))return 0;var P=a.length;if(P<3)return 0;for(var w=0,F=0,H=P-1;F<P;++F)w+=(a[H].X+a[F].X)*(a[H].Y-a[F].Y),H=F;return-w*0.5;},e.Clipper.prototype.Area=function(a){var P=a;if(a===null)return 0;var w=0;do w=w+(a.Prev.Pt.X+a.Pt.X)*(a.Prev.Pt.Y-a.Pt.Y),a=a.Next;while(a!==P);return w*0.5;},e.Clipper.prototype.Area$1=function(a){return this.Area(a.Pts);},e.Clipper.SimplifyPolygon=function(a,P){var w=new Array(),F=new e.Clipper(0);return F.StrictlySimple=!0,F.AddPath(a,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,w,P,P),w;},e.Clipper.SimplifyPolygons=function(a,P){_typeof(P)>"u"&&(P=e.PolyFillType.pftEvenOdd);var w=new Array(),F=new e.Clipper(0);return F.StrictlySimple=!0,F.AddPaths(a,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,w,P,P),w;},e.Clipper.DistanceSqrd=function(a,P){var w=a.X-P.X,F=a.Y-P.Y;return w*w+F*F;},e.Clipper.DistanceFromLineSqrd=function(a,P,w){var F=P.Y-w.Y,H=w.X-P.X,_=F*P.X+H*P.Y;return _=F*a.X+H*a.Y-_,_*_/(F*F+H*H);},e.Clipper.SlopesNearCollinear=function(a,P,w,F){return Math.abs(a.X-P.X)>Math.abs(a.Y-P.Y)?a.X>P.X==a.X<w.X?e.Clipper.DistanceFromLineSqrd(a,P,w)<F:P.X>a.X==P.X<w.X?e.Clipper.DistanceFromLineSqrd(P,a,w)<F:e.Clipper.DistanceFromLineSqrd(w,a,P)<F:a.Y>P.Y==a.Y<w.Y?e.Clipper.DistanceFromLineSqrd(a,P,w)<F:P.Y>a.Y==P.Y<w.Y?e.Clipper.DistanceFromLineSqrd(P,a,w)<F:e.Clipper.DistanceFromLineSqrd(w,a,P)<F;},e.Clipper.PointsAreClose=function(a,P,w){var F=a.X-P.X,H=a.Y-P.Y;return F*F+H*H<=w;},e.Clipper.ExcludeOp=function(a){var P=a.Prev;return P.Next=a.Next,a.Next.Prev=P,P.Idx=0,P;},e.Clipper.CleanPolygon=function(a,P){_typeof(P)>"u"&&(P=1.415);var w=a.length;if(w===0)return new Array();for(var F=new Array(w),H=0;H<w;++H)F[H]=new e.OutPt();for(var H=0;H<w;++H)F[H].Pt=a[H],F[H].Next=F[(H+1)%w],F[H].Next.Prev=F[H],F[H].Idx=0;for(var _=P*P,st=F[0];st.Idx===0&&st.Next!==st.Prev;)e.Clipper.PointsAreClose(st.Pt,st.Prev.Pt,_)?(st=e.Clipper.ExcludeOp(st),w--):e.Clipper.PointsAreClose(st.Prev.Pt,st.Next.Pt,_)?(e.Clipper.ExcludeOp(st.Next),st=e.Clipper.ExcludeOp(st),w-=2):e.Clipper.SlopesNearCollinear(st.Prev.Pt,st.Pt,st.Next.Pt,_)?(st=e.Clipper.ExcludeOp(st),w--):(st.Idx=1,st=st.Next);w<3&&(w=0);for(var yt=new Array(w),H=0;H<w;++H)yt[H]=new e.IntPoint1(st.Pt),st=st.Next;return F=null,yt;},e.Clipper.CleanPolygons=function(a,P){for(var w=new Array(a.length),F=0,H=a.length;F<H;F++)w[F]=e.Clipper.CleanPolygon(a[F],P);return w;},e.Clipper.Minkowski=function(a,P,w,F){var H=F?1:0,_=a.length,st=P.length,yt=new Array();if(w)for(var Pt=0;Pt<st;Pt++){for(var Bt=new Array(_),kt=0,jt=a.length,qt=a[kt];kt<jt;kt++,qt=a[kt])Bt[kt]=new e.IntPoint2(P[Pt].X+qt.X,P[Pt].Y+qt.Y);yt.push(Bt);}else for(var Pt=0;Pt<st;Pt++){for(var Bt=new Array(_),kt=0,jt=a.length,qt=a[kt];kt<jt;kt++,qt=a[kt])Bt[kt]=new e.IntPoint2(P[Pt].X-qt.X,P[Pt].Y-qt.Y);yt.push(Bt);}for(var oe=new Array(),Pt=0;Pt<st-1+H;Pt++)for(var kt=0;kt<_;kt++){var me=new Array();me.push(yt[Pt%st][kt%_]),me.push(yt[(Pt+1)%st][kt%_]),me.push(yt[(Pt+1)%st][(kt+1)%_]),me.push(yt[Pt%st][(kt+1)%_]),e.Clipper.Orientation(me)||me.reverse(),oe.push(me);}return oe;},e.Clipper.MinkowskiSum=function(a,P,w){if(P[0]instanceof Array){for(var H=P,st=new e.Paths(),_=new e.Clipper(),yt=0;yt<H.length;++yt){var Pt=e.Clipper.Minkowski(a,H[yt],!0,w);if(_.AddPaths(Pt,e.PolyType.ptSubject,!0),w){var F=e.Clipper.TranslatePath(H[yt],a[0]);_.AddPath(F,e.PolyType.ptClip,!0);}}return _.Execute(e.ClipType.ctUnion,st,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),st;}else{var F=P,H=e.Clipper.Minkowski(a,F,!0,w),_=new e.Clipper();return _.AddPaths(H,e.PolyType.ptSubject,!0),_.Execute(e.ClipType.ctUnion,H,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),H;}},e.Clipper.TranslatePath=function(a,P){for(var w=new e.Path(),F=0;F<a.length;F++)w.push(new e.IntPoint2(a[F].X+P.X,a[F].Y+P.Y));return w;},e.Clipper.MinkowskiDiff=function(a,P){var w=e.Clipper.Minkowski(a,P,!1,!0),F=new e.Clipper();return F.AddPaths(w,e.PolyType.ptSubject,!0),F.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftNonZero,e.PolyFillType.pftNonZero),w;},e.Clipper.PolyTreeToPaths=function(a){var P=new Array();return e.Clipper.AddPolyNodeToPaths(a,e.Clipper.NodeType.ntAny,P),P;},e.Clipper.AddPolyNodeToPaths=function(a,P,w){var F=!0;switch(P){case e.Clipper.NodeType.ntOpen:return;case e.Clipper.NodeType.ntClosed:F=!a.IsOpen;break;}a.m_polygon.length>0&&F&&w.push(a.m_polygon);for(var H=0,_=a.Childs(),st=_.length,yt=_[H];H<st;H++,yt=_[H])e.Clipper.AddPolyNodeToPaths(yt,P,w);},e.Clipper.OpenPathsFromPolyTree=function(a){for(var P=new e.Paths(),w=0,F=a.ChildCount();w<F;w++)a.Childs()[w].IsOpen&&P.push(a.Childs()[w].m_polygon);return P;},e.Clipper.ClosedPathsFromPolyTree=function(a){var P=new e.Paths();return e.Clipper.AddPolyNodeToPaths(a,e.Clipper.NodeType.ntClosed,P),P;},Zn(e.Clipper,e.ClipperBase),e.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},e.ClipperOffset=function(a,P){_typeof(a)>"u"&&(a=2),_typeof(P)>"u"&&(P=e.ClipperOffset.def_arc_tolerance),this.m_destPolys=new e.Paths(),this.m_srcPoly=new e.Path(),this.m_destPoly=new e.Path(),this.m_normals=new Array(),this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new e.IntPoint0(),this.m_polyNodes=new e.PolyNode(),this.MiterLimit=a,this.ArcTolerance=P,this.m_lowest.X=-1;},e.ClipperOffset.two_pi=6.28318530717959,e.ClipperOffset.def_arc_tolerance=0.25,e.ClipperOffset.prototype.Clear=function(){e.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1;},e.ClipperOffset.Round=e.Clipper.Round,e.ClipperOffset.prototype.AddPath=function(a,P,w){var F=a.length-1;if(!(F<0)){var H=new e.PolyNode();if(H.m_jointype=P,H.m_endtype=w,w===e.EndType.etClosedLine||w===e.EndType.etClosedPolygon)for(;F>0&&e.IntPoint.op_Equality(a[0],a[F]);)F--;H.m_polygon.push(a[0]);for(var _=0,st=0,yt=1;yt<=F;yt++)e.IntPoint.op_Inequality(H.m_polygon[_],a[yt])&&(_++,H.m_polygon.push(a[yt]),(a[yt].Y>H.m_polygon[st].Y||a[yt].Y===H.m_polygon[st].Y&&a[yt].X<H.m_polygon[st].X)&&(st=_));if(!(w===e.EndType.etClosedPolygon&&_<2)&&(this.m_polyNodes.AddChild(H),w===e.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new e.IntPoint2(this.m_polyNodes.ChildCount()-1,st);else{var Pt=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(H.m_polygon[st].Y>Pt.Y||H.m_polygon[st].Y===Pt.Y&&H.m_polygon[st].X<Pt.X)&&(this.m_lowest=new e.IntPoint2(this.m_polyNodes.ChildCount()-1,st));}}},e.ClipperOffset.prototype.AddPaths=function(a,P,w){for(var F=0,H=a.length;F<H;F++)this.AddPath(a[F],P,w);},e.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!e.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var a=0;a<this.m_polyNodes.ChildCount();a++){var P=this.m_polyNodes.Childs()[a];(P.m_endtype===e.EndType.etClosedPolygon||P.m_endtype===e.EndType.etClosedLine&&e.Clipper.Orientation(P.m_polygon))&&P.m_polygon.reverse();}else for(var a=0;a<this.m_polyNodes.ChildCount();a++){var P=this.m_polyNodes.Childs()[a];P.m_endtype===e.EndType.etClosedLine&&!e.Clipper.Orientation(P.m_polygon)&&P.m_polygon.reverse();}},e.ClipperOffset.GetUnitNormal=function(a,P){var w=P.X-a.X,F=P.Y-a.Y;if(w===0&&F===0)return new e.DoublePoint2(0,0);var H=1/Math.sqrt(w*w+F*F);return w*=H,F*=H,new e.DoublePoint2(F,-w);},e.ClipperOffset.prototype.DoOffset=function(a){if(this.m_destPolys=new Array(),this.m_delta=a,e.ClipperBase.near_zero(a)){for(var P=0;P<this.m_polyNodes.ChildCount();P++){var w=this.m_polyNodes.Childs()[P];w.m_endtype===e.EndType.etClosedPolygon&&this.m_destPolys.push(w.m_polygon);}return;}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=0.5;var F;this.ArcTolerance<=0?F=e.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(a)*e.ClipperOffset.def_arc_tolerance?F=Math.abs(a)*e.ClipperOffset.def_arc_tolerance:F=this.ArcTolerance;var H=3.14159265358979/Math.acos(1-F/Math.abs(a));this.m_sin=Math.sin(e.ClipperOffset.two_pi/H),this.m_cos=Math.cos(e.ClipperOffset.two_pi/H),this.m_StepsPerRad=H/e.ClipperOffset.two_pi,a<0&&(this.m_sin=-this.m_sin);for(var P=0;P<this.m_polyNodes.ChildCount();P++){var w=this.m_polyNodes.Childs()[P];this.m_srcPoly=w.m_polygon;var _=this.m_srcPoly.length;if(!(_===0||a<=0&&(_<3||w.m_endtype!==e.EndType.etClosedPolygon))){if(this.m_destPoly=new Array(),_===1){if(w.m_jointype===e.JoinType.jtRound)for(var st=1,yt=0,Pt=1;Pt<=H;Pt++){this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+st*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+yt*a)));var Bt=st;st=st*this.m_cos-this.m_sin*yt,yt=Bt*this.m_sin+yt*this.m_cos;}else for(var st=-1,yt=-1,Pt=0;Pt<4;++Pt)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+st*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+yt*a))),st<0?st=1:yt<0?yt=1:st=-1;this.m_destPolys.push(this.m_destPoly);continue;}this.m_normals.length=0;for(var Pt=0;Pt<_-1;Pt++)this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[Pt],this.m_srcPoly[Pt+1]));if(w.m_endtype===e.EndType.etClosedLine||w.m_endtype===e.EndType.etClosedPolygon?this.m_normals.push(e.ClipperOffset.GetUnitNormal(this.m_srcPoly[_-1],this.m_srcPoly[0])):this.m_normals.push(new e.DoublePoint1(this.m_normals[_-2])),w.m_endtype===e.EndType.etClosedPolygon){for(var kt=_-1,Pt=0;Pt<_;Pt++)kt=this.OffsetPoint(Pt,kt,w.m_jointype);this.m_destPolys.push(this.m_destPoly);}else if(w.m_endtype===e.EndType.etClosedLine){for(var kt=_-1,Pt=0;Pt<_;Pt++)kt=this.OffsetPoint(Pt,kt,w.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array();for(var jt=this.m_normals[_-1],Pt=_-1;Pt>0;Pt--)this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt-1].X,-this.m_normals[Pt-1].Y);this.m_normals[0]=new e.DoublePoint2(-jt.X,-jt.Y),kt=0;for(var Pt=_-1;Pt>=0;Pt--)kt=this.OffsetPoint(Pt,kt,w.m_jointype);this.m_destPolys.push(this.m_destPoly);}else{for(var kt=0,Pt=1;Pt<_-1;++Pt)kt=this.OffsetPoint(Pt,kt,w.m_jointype);var qt;if(w.m_endtype===e.EndType.etOpenButt){var Pt=_-1;qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[Pt].X+this.m_normals[Pt].X*a),e.ClipperOffset.Round(this.m_srcPoly[Pt].Y+this.m_normals[Pt].Y*a)),this.m_destPoly.push(qt),qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[Pt].X-this.m_normals[Pt].X*a),e.ClipperOffset.Round(this.m_srcPoly[Pt].Y-this.m_normals[Pt].Y*a)),this.m_destPoly.push(qt);}else{var Pt=_-1;kt=_-2,this.m_sinA=0,this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt].X,-this.m_normals[Pt].Y),w.m_endtype===e.EndType.etOpenSquare?this.DoSquare(Pt,kt):this.DoRound(Pt,kt);}for(var Pt=_-1;Pt>0;Pt--)this.m_normals[Pt]=new e.DoublePoint2(-this.m_normals[Pt-1].X,-this.m_normals[Pt-1].Y);this.m_normals[0]=new e.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),kt=_-1;for(var Pt=kt-1;Pt>0;--Pt)kt=this.OffsetPoint(Pt,kt,w.m_jointype);w.m_endtype===e.EndType.etOpenButt?(qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*a)),this.m_destPoly.push(qt),qt=new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*a),e.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*a)),this.m_destPoly.push(qt)):(kt=1,this.m_sinA=0,w.m_endtype===e.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly);}}}},e.ClipperOffset.prototype.Execute=function(){var a=arguments,P=a[0]instanceof e.PolyTree;if(P){var w=a[0],F=a[1];w.Clear(),this.FixOrientations(),this.DoOffset(F);var H=new e.Clipper(0);if(H.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),F>0)H.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var _=e.Clipper.GetBounds(this.m_destPolys),st=new e.Path();if(st.push(new e.IntPoint2(_.left-10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.top-10)),st.push(new e.IntPoint2(_.left-10,_.top-10)),H.AddPath(st,e.PolyType.ptSubject,!0),H.ReverseSolution=!0,H.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),w.ChildCount()===1&&w.Childs()[0].ChildCount()>0){var yt=w.Childs()[0];w.Childs()[0]=yt.Childs()[0],w.Childs()[0].m_Parent=w;for(var Pt=1;Pt<yt.ChildCount();Pt++)w.AddChild(yt.Childs()[Pt]);}else w.Clear();}}else{var w=a[0],F=a[1];e.Clear(w),this.FixOrientations(),this.DoOffset(F);var H=new e.Clipper(0);if(H.AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),F>0)H.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var _=e.Clipper.GetBounds(this.m_destPolys),st=new e.Path();st.push(new e.IntPoint2(_.left-10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.bottom+10)),st.push(new e.IntPoint2(_.right+10,_.top-10)),st.push(new e.IntPoint2(_.left-10,_.top-10)),H.AddPath(st,e.PolyType.ptSubject,!0),H.ReverseSolution=!0,H.Execute(e.ClipType.ctUnion,w,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),w.length>0&&w.splice(0,1);}}},e.ClipperOffset.prototype.OffsetPoint=function(a,P,w){if(this.m_sinA=this.m_normals[P].X*this.m_normals[a].Y-this.m_normals[a].X*this.m_normals[P].Y,Math.abs(this.m_sinA*this.m_delta)<1){var F=this.m_normals[P].X*this.m_normals[a].X+this.m_normals[a].Y*this.m_normals[P].Y;if(F>0)return this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[P].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[P].Y*this.m_delta))),P;}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[P].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[P].Y*this.m_delta))),this.m_destPoly.push(new e.IntPoint1(this.m_srcPoly[a])),this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[a].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[a].Y*this.m_delta)));else switch(w){case e.JoinType.jtMiter:{var H=1+(this.m_normals[a].X*this.m_normals[P].X+this.m_normals[a].Y*this.m_normals[P].Y);H>=this.m_miterLim?this.DoMiter(a,P,H):this.DoSquare(a,P);break;}case e.JoinType.jtSquare:this.DoSquare(a,P);break;case e.JoinType.jtRound:this.DoRound(a,P);break;}return P=a,P;},e.ClipperOffset.prototype.DoSquare=function(a,P){var w=Math.tan(Math.atan2(this.m_sinA,this.m_normals[P].X*this.m_normals[a].X+this.m_normals[P].Y*this.m_normals[a].Y)/4);this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_delta*(this.m_normals[P].X-this.m_normals[P].Y*w)),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_delta*(this.m_normals[P].Y+this.m_normals[P].X*w)))),this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_delta*(this.m_normals[a].X+this.m_normals[a].Y*w)),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_delta*(this.m_normals[a].Y-this.m_normals[a].X*w))));},e.ClipperOffset.prototype.DoMiter=function(a,P,w){var F=this.m_delta/w;this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+(this.m_normals[P].X+this.m_normals[a].X)*F),e.ClipperOffset.Round(this.m_srcPoly[a].Y+(this.m_normals[P].Y+this.m_normals[a].Y)*F)));},e.ClipperOffset.prototype.DoRound=function(a,P){for(var w=Math.atan2(this.m_sinA,this.m_normals[P].X*this.m_normals[a].X+this.m_normals[P].Y*this.m_normals[a].Y),F=Math.max(e.Cast_Int32(e.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(w))),1),H=this.m_normals[P].X,_=this.m_normals[P].Y,st,yt=0;yt<F;++yt)this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+H*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+_*this.m_delta))),st=H,H=H*this.m_cos-this.m_sin*_,_=st*this.m_sin+_*this.m_cos;this.m_destPoly.push(new e.IntPoint2(e.ClipperOffset.Round(this.m_srcPoly[a].X+this.m_normals[a].X*this.m_delta),e.ClipperOffset.Round(this.m_srcPoly[a].Y+this.m_normals[a].Y*this.m_delta)));},e.Error=function(a){try{throw new Error(a);}catch(P){alert(P.message);}},e.JS={},e.JS.AreaOfPolygon=function(a,P){return P||(P=1),e.Clipper.Area(a)/(P*P);},e.JS.AreaOfPolygons=function(a,P){P||(P=1);for(var w=0,F=0;F<a.length;F++)w+=e.Clipper.Area(a[F]);return w/(P*P);},e.JS.BoundsOfPath=function(a,P){return e.JS.BoundsOfPaths([a],P);},e.JS.BoundsOfPaths=function(a,P){P||(P=1);var w=e.Clipper.GetBounds(a);return w.left/=P,w.bottom/=P,w.right/=P,w.top/=P,w;},e.JS.Clean=function(F,P){if(!(F instanceof Array))return[];var w=F[0]instanceof Array,F=e.JS.Clone(F);if(typeof P!="number"||P===null)return e.Error("Delta is not a number in Clean()."),F;if(F.length===0||F.length===1&&F[0].length===0||P<0)return F;w||(F=[F]);for(var H=F.length,_,st,yt,Pt,Bt,kt,jt,qt=[],oe=0;oe<H;oe++)if(st=F[oe],_=st.length,_!==0){if(_<3){yt=st,qt.push(yt);continue;}for(yt=st,Pt=P*P,Bt=st[0],kt=1,jt=1;jt<_;jt++)(st[jt].X-Bt.X)*(st[jt].X-Bt.X)+(st[jt].Y-Bt.Y)*(st[jt].Y-Bt.Y)<=Pt||(yt[kt]=st[jt],Bt=st[jt],kt++);Bt=st[kt-1],(st[0].X-Bt.X)*(st[0].X-Bt.X)+(st[0].Y-Bt.Y)*(st[0].Y-Bt.Y)<=Pt&&kt--,kt<_&&yt.splice(kt,_-kt),yt.length&&qt.push(yt);}return!w&&qt.length?qt=qt[0]:!w&&qt.length===0?qt=[]:w&&qt.length===0&&(qt=[[]]),qt;},e.JS.Clone=function(a){if(!(a instanceof Array))return[];if(a.length===0)return[];if(a.length===1&&a[0].length===0)return[[]];var P=a[0]instanceof Array;P||(a=[a]);var w=a.length,F,H,_,st,yt=new Array(w);for(H=0;H<w;H++){for(F=a[H].length,st=new Array(F),_=0;_<F;_++)st[_]={X:a[H][_].X,Y:a[H][_].Y};yt[H]=st;}return P||(yt=yt[0]),yt;},e.JS.Lighten=function(a,P){if(!(a instanceof Array))return[];if(typeof P!="number"||P===null)return e.Error("Tolerance is not a number in Lighten()."),e.JS.Clone(a);if(a.length===0||a.length===1&&a[0].length===0||P<0)return e.JS.Clone(a);var w=a[0]instanceof Array;w||(a=[a]);var F,H,_,st,yt,Pt,Bt,kt,jt,qt,oe,me,Pe,De,or,Rr,en,jo=a.length,Go=P*P,gn=[];for(F=0;F<jo;F++)if(_=a[F],Pt=_.length,Pt!==0){for(st=0;st<1e6;st++){for(yt=[],Pt=_.length,_[Pt-1].X!==_[0].X||_[Pt-1].Y!==_[0].Y?(me=1,_.push({X:_[0].X,Y:_[0].Y}),Pt=_.length):me=0,oe=[],H=0;H<Pt-2;H++)Bt=_[H],jt=_[H+1],kt=_[H+2],Rr=Bt.X,en=Bt.Y,Pe=kt.X-Rr,De=kt.Y-en,(Pe!==0||De!==0)&&(or=((jt.X-Rr)*Pe+(jt.Y-en)*De)/(Pe*Pe+De*De),or>1?(Rr=kt.X,en=kt.Y):or>0&&(Rr+=Pe*or,en+=De*or)),Pe=jt.X-Rr,De=jt.Y-en,qt=Pe*Pe+De*De,qt<=Go&&(oe[H+1]=1,H++);for(yt.push({X:_[0].X,Y:_[0].Y}),H=1;H<Pt-1;H++)oe[H]||yt.push({X:_[H].X,Y:_[H].Y});if(yt.push({X:_[Pt-1].X,Y:_[Pt-1].Y}),me&&_.pop(),oe.length)_=yt;else break;}Pt=yt.length,yt[Pt-1].X===yt[0].X&&yt[Pt-1].Y===yt[0].Y&&yt.pop(),yt.length>2&&gn.push(yt);}return w||(gn=gn[0]),_typeof(gn)>"u"&&(gn=[]),gn;},e.JS.PerimeterOfPath=function(a,P,w){if(_typeof(a)>"u")return 0;var F=Math.sqrt,H=0,_,st,yt=0,Pt=0,Bt=0,kt=0,jt=a.length;if(jt<2)return 0;for(P&&(a[jt]=a[0],jt++);--jt;)_=a[jt],yt=_.X,Pt=_.Y,st=a[jt-1],Bt=st.X,kt=st.Y,H+=F((yt-Bt)*(yt-Bt)+(Pt-kt)*(Pt-kt));return P&&a.pop(),H/w;},e.JS.PerimeterOfPaths=function(a,P,w){w||(w=1);for(var F=0,H=0;H<a.length;H++)F+=e.JS.PerimeterOfPath(a[H],P,w);return F;},e.JS.ScaleDownPath=function(a,P){var w,F;for(P||(P=1),w=a.length;w--;)F=a[w],F.X=F.X/P,F.Y=F.Y/P;},e.JS.ScaleDownPaths=function(a,P){var w,F,H;for(P||(P=1),w=a.length;w--;)for(F=a[w].length;F--;)H=a[w][F],H.X=H.X/P,H.Y=H.Y/P;},e.JS.ScaleUpPath=function(a,P){var w,F,H=Math.round;for(P||(P=1),w=a.length;w--;)F=a[w],F.X=H(F.X*P),F.Y=H(F.Y*P);},e.JS.ScaleUpPaths=function(a,P){var w,F,H,_=Math.round;for(P||(P=1),w=a.length;w--;)for(F=a[w].length;F--;)H=a[w][F],H.X=_(H.X*P),H.Y=_(H.Y*P);},e.ExPolygons=function(){return[];},e.ExPolygon=function(){this.outer=null,this.holes=null;},e.JS.AddOuterPolyNodeToExPolygons=function(a,P){var w=new e.ExPolygon();w.outer=a.Contour();var F=a.Childs(),H=F.length;w.holes=new Array(H);var _,st,yt,Pt,Bt,kt;for(yt=0;yt<H;yt++)for(_=F[yt],w.holes[yt]=_.Contour(),Pt=0,Bt=_.Childs(),kt=Bt.length;Pt<kt;Pt++)st=Bt[Pt],e.JS.AddOuterPolyNodeToExPolygons(st,P);P.push(w);},e.JS.ExPolygonsToPaths=function(a){var P,w,F,H,_=new e.Paths();for(P=0,F=a.length;P<F;P++)for(_.push(a[P].outer),w=0,H=a[P].holes.length;w<H;w++)_.push(a[P].holes[w]);return _;},e.JS.PolyTreeToExPolygons=function(a){var P=new e.ExPolygons(),w,F,H,_;for(F=0,H=a.Childs(),_=H.length;F<_;F++)w=H[F],e.JS.AddOuterPolyNodeToExPolygons(w,P);return P;};})();})(mh);var z2=mh.exports,Qr=/* @__PURE__ */Ln(z2);function yh(i,e){var t=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0.01;return Math.abs(i[0]-e[0])<t&&Math.abs(i[1]-e[1])<t;}function $2(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(i.length===0)return[];var t=[[i[0][0],i[0][1]]];for(var r=1;r<i.length;r++)yh([i[r][0],i[r][1]],t[t.length-1],e)||t.push([i[r][0],i[r][1]]);return t;}function j2(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(i.length<=2)return i;var t=i[0],r=i[i.length-1];return yh(t,r,e)?i.slice(0,-1):i;}function G2(i){var e=i.reduce(function(r,n){return r+n[0];},0)/i.length,t=i.reduce(function(r,n){return r+n[1];},0)/i.length;return[e,t];}function du(i,e){return Math.atan2(e[1]-i[1],e[0]-i[0]);}function H2(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(i.length<=2)return i;var t=[];var _iterator16=_createForOfIteratorHelper(i),_step16;try{var _loop3=function _loop3(){var n=_step16.value;t.some(function(c){return Math.abs(c[0]-n[0])<e&&Math.abs(c[1]-n[1])<e;})||t.push([n[0],n[1]]);};for(_iterator16.s();!(_step16=_iterator16.n()).done;){_loop3();}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}var r=G2(t);return t.sort(function(n,s){var c=du(r,n),l=du(r,s);return c-l;});}function k2(i,e){var t=e[0].x<e[e.length-1].x;return i.map(function(n){var c=n.map(function(l){var f=-1,h=1/0,m=0;for(var u=0;u<e.length;u++){var y=e[u],T=Math.sqrt(Math.pow(y.x-l[0],2)+Math.pow(y.y-l[1],2));T<h&&(h=T,f=u,m=y.z);}return{point:l,index:f,bestZ:m};}).sort(function(l,f){return l.index-f.index;}).map(function(l){return[].concat(_toConsumableArray(l.point),[l.bestZ]);});return t&&c[0][0]>c[c.length-1][0]||!t&&c[0][0]<c[c.length-1][0]?c.reverse():c;}).sort(function(n,s){var c=n[0][0],l=s[0][0];return t?c-l:l-c;});}function K2(i,e){var t=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0.01;var n=i.map(function(u){return[u.x,u.y];}),s=function s(u,y){return u.map(function(_ref166){var _ref167=_slicedToArray(_ref166,2),T=_ref167[0],E=_ref167[1];return{X:Math.round(T*y),Y:Math.round(E*y)};});},c=new Qr.ClipperOffset();c.AddPath(s(n,1e3),Qr.JoinType.jtRound,Qr.EndType.etOpenButt);var l=[];c.Execute(l,1);var f=new Qr.Clipper();f.AddPaths(l,Qr.PolyType.ptSubject,!0),e.forEach(function(u){f.AddPath(s(u,1e3),Qr.PolyType.ptClip,!0);});var h=new Qr.Paths();f.Execute(Qr.ClipType.ctDifference,h,Qr.PolyFillType.pftNonZero,Qr.PolyFillType.pftNonZero);var m=h.map(function(u){return j2(H2($2(u.map(function(y){return[y.X/1e3,y.Y/1e3];}),t),t),t);}).filter(function(u){return u.length>=2;});return k2(m,i);}var Ph=/*#__PURE__*/function(_$t){function Ph(t){var _this62;_classCallCheck(this,Ph);_this62=_callSuper(this,Ph,[t]);dt(_this62,"canRotate",!0);dt(_this62,"scaleType",Ae.all);dt(_this62,"toolsType",Tt.Pencil);dt(_this62,"syncTimestamp");dt(_this62,"syncIndex",0);dt(_this62,"tmpPoints",[]);dt(_this62,"MAX_REPEAR",10);/** 合并原始点的灵敏度 */dt(_this62,"uniThickness");dt(_this62,"workOptions");dt(_this62,"centerPos",[0,0]);_this62.workOptions=t.toolsOpt,_this62.uniThickness=_this62.MAX_REPEAR/_this62.workOptions.thickness/10,_this62.syncTimestamp=0;return _this62;}/** 批量合并消费本地数据,返回绘制结果 */_inherits(Ph,_$t);return _createClass(Ph,[{key:"combineConsume",value:function combineConsume(){var l;var t=(l=this.workId)==null?void 0:l.toString();if(this.tmpPoints.length<2)return{type:xt.None};var r=this.transformDataAll(!0),n={name:t};var s;var c=this.drawLayer||this.fullLayer;return r.length&&(s=this.draw({attrs:n,tasks:r,replaceId:t,layer:c})),{rect:s,type:xt.DrawWork,dataType:Vt.Local};}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(Ph,"setWorkOptions",this,3)([t]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(t){var _this63=this;var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.drawCount,f=t.removeDrawCount,h=t.isSimpleWorker,m=r.workId,u=r.syncUnitTime;u&&(this.syncUnitTime=u);var _this$transformData=this.transformData(r,!1),y=_this$transformData.tasks,T=_this$transformData.effects,E=_this$transformData.consumeIndex;this.syncIndex=Math.min(this.syncIndex,E,Math.max(0,this.tmpPoints.length-2));var C={name:m,id:er(l)&&l.toString()||void 0};var x,I=!1;var d=this.syncIndex;if(this.syncTimestamp===0&&(this.syncTimestamp=Date.now()),y.length&&(y[0].taskId-this.syncTimestamp>this.syncUnitTime&&(I=!0,this.syncTimestamp=y[0].taskId,this.syncIndex=this.tmpPoints.length),s||c||h)){var p=n?this.fullLayer:this.drawLayer||this.fullLayer;x=this.draw({attrs:C,tasks:y,effects:T,layer:p,removeDrawCount:f});}if(h){var _p13=[];return this.tmpPoints.slice(d).forEach(function(S){_p13.push(S.x,S.y,_this63.computRadius(S.z,_this63.workOptions.thickness));}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.DrawWork,dataType:Vt.Local,op:I?_p13:void 0,index:I?d*3:void 0,rect:x,updateNodeOpt:{useAnimation:!0}});}if(s)return E>10&&this.tmpPoints.splice(0,E-10),{rect:x,type:xt.DrawWork,dataType:Vt.Local};var v=[];return this.tmpPoints.slice(d).forEach(function(p){v.push(p.x,p.y,_this63.computRadius(p.z,_this63.workOptions.thickness));}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.DrawWork,dataType:Vt.Local,rect:x,op:I?v:void 0,index:I?d*3:void 0,updateNodeOpt:{useAnimation:!0}});}},{key:"consumeAll",value:function consumeAll(t){var m;var r=this.workId;if(t.data){var _t$data=t.data,u=_t$data.op,y=_t$data.workState;u!=null&&u.length&&y===te.Done&&this.workOptions.strokeType===we.Stroke&&this.updateTempPointsWithPressureWhenDone(u);}var n=this.transformDataAll(!0),s={name:r};var c;var l=this.fullLayer;if(n.length&&(c=this.draw({attrs:s,tasks:n,replaceId:r,layer:l})),this.tmpPoints.length<2)return this.replace(l,r),{type:xt.RemoveNode,removeIds:[r],rect:c};var f=[];this.tmpPoints.map(function(u){f.push(u.x,u.y,u.z);}),this.syncTimestamp=0,delete this.workOptions.syncUnitTime;var h=gr(f);return(m=this.vNodes)==null||m.setInfo(r,{rect:c,op:f,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:c&&$t.getCenterPos(c,l)}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{rect:c,type:xt.FullWork,dataType:Vt.Local,ops:h,updateNodeOpt:{pos:this.centerPos,useAnimation:!0}});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0;}},{key:"consumeService",value:function consumeService(t){var u,y;var r=t.op,n=t.isFullWork,s=t.replaceId,_t$workState=t.workState,c=_t$workState===void 0?te.Done:_t$workState;this.tmpPoints.length=0;for(var T=0;T<r.length;T+=3){var E=new Jt(r[T],r[T+1],r[T+2]);if(this.tmpPoints.length>0){var C=this.tmpPoints[this.tmpPoints.length-1],x=pt.Sub(E,C).uni();E.setv(x);}this.tmpPoints.push(E);}if(this.tmpPoints.length<2)return;var l=this.transformDataAll(!0),f=(u=this.workId)==null?void 0:u.toString(),h={name:f};var m;if(f&&l.length){var _T9=n?this.fullLayer:this.drawLayer||this.fullLayer;m=this.draw({attrs:h,tasks:l,replaceId:s,layer:_T9,isDrawEraserlines:c===te.Done}),(y=this.vNodes)==null||y.setInfo(f,{rect:m,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:m&&$t.getCenterPos(m,_T9)});}return m;}},{key:"computPencilPoints",value:function computPencilPoints(t){var _this64=this;var r=[],n=t.op,s=t.eraserPolylines,c=t.eraserThickness;this.tmpPoints.length=0;for(var f=0;f<n.length;f+=3){var h=new Jt(n[f],n[f+1],n[f+2]);if(this.tmpPoints.length>0){var m=this.tmpPoints[this.tmpPoints.length-1],u=pt.Sub(h,m).uni();h.setv(u);}this.tmpPoints.push(h);}if(this.tmpPoints.length<2)return;var l=this.transformDataAll(!0);if(l.length){var _loop4=function _loop4(){var _l$_f=l[_f5],h=_l$_f.pos,m=_l$_f.points,u=m.map(function(E){return E.point.addXY(h[0],h[1]);}),y=[];var _iterator17=_createForOfIteratorHelper(s),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var E=_step17.value;var C=[];for(var _I33=0;_I33<E.length;_I33+=2){var _d30=new Jt(E[_I33],E[_I33+1]);if(C.length>0){var v=C[C.length-1].point,p=pt.Sub(_d30,v).uni();_d30.setv(p);}C.push({point:_d30,radius:c});}var _this64$computStroke=_this64.computStroke(C,!1),x=_this64$computStroke.ps;y.push(x.map(function(I){return I.XY;}));}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}K2(u,y,0.01).forEach(function(E){r.push(E.map(function(C){return[C[0],C[1],C[2]];}).flat(1));});};for(var _f5=0;_f5<l.length;_f5++){_loop4();}}return r;}},{key:"transformDataAll",value:function transformDataAll(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.getTaskPoints(this.tmpPoints,t&&this.workOptions.thickness||void 0);}},{key:"draw",value:function draw(t){var _this65=this;var r=t.attrs,n=t.tasks,s=t.replaceId,c=t.effects,l=t.layer,f=t.removeDrawCount,_t$isDrawEraserlines=t.isDrawEraserlines,h=_t$isDrawEraserlines===void 0?!0:_t$isDrawEraserlines,_this$workOptions=this.workOptions,m=_this$workOptions.strokeColor,u=_this$workOptions.strokeType,y=_this$workOptions.thickness,T=_this$workOptions.zIndex,E=_this$workOptions.scale,C=_this$workOptions.rotate,x=_this$workOptions.translate,I=_this$workOptions.eraserlines,d=_this$workOptions.lineCap,v=_this$workOptions.lineDash;c!=null&&c.size&&(c.forEach(function(U){var M;(M=l.getElementById(U+""))==null||M.remove();}),c.clear()),f&&this.removeDrawCountNodes(l,f);var p;var S=[],A=l.worldPosition,R=l.worldScaling;for(var U=0;U<n.length;U++){var _n$U=n[U],M=_n$U.pos,W=_n$U.points,_this$computDrawPoint=this.computDrawPoints(W),Y=_this$computDrawPoint.ps,B=_this$computDrawPoint.rect;var N=void 0;var G=W.length===1;u===we.Stroke||G?N=En(Y,!0):N=En(Y,!1);var J={pos:M,d:N,fillColor:u===we.Stroke||G?m:void 0,lineDash:G?void 0:u===we.Dotted?[v&&v[0]||1,(v&&v[1]||2)*y]:u===we.LongDotted?[(v&&v[0]||1)*y,(v&&v[1]||2)*y]:void 0,strokeColor:m,lineCap:G?void 0:d,lineWidth:u===we.Stroke||G?0:y};p=Zt(p,{x:Math.floor((B.x+M[0])*R[0]+A[0]-$t.SafeBorderPadding),y:Math.floor((B.y+M[1])*R[1]+A[1]-$t.SafeBorderPadding),w:Math.floor(B.w*R[0]+2*$t.SafeBorderPadding),h:Math.floor(B.h*R[1]+2*$t.SafeBorderPadding)}),S.push(J);}E&&(r.scale=E),C&&(r.rotate=C),x&&(r.translate=x);var D=new mr();if(p){this.centerPos=$t.getCenterPos(p,l);var _U11=u===we.Stroke&&!I;D.attr(_objectSpread(_objectSpread({},r),{},{normalize:!0,anchor:[0.5,0.5],bgcolor:_U11?m:void 0,pos:this.centerPos,size:[(p.w-2*$t.SafeBorderPadding)/R[0],(p.h-2*$t.SafeBorderPadding)/R[1]],zIndex:T}));var _M9=S.map(function(W){return W.pos=[W.pos[0]-_this65.centerPos[0],W.pos[1]-_this65.centerPos[1]],new Mn(W);});D.append.apply(D,_toConsumableArray(_M9)),_U11&&D.seal(),I&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:D,eraserlines:I,pos:this.centerPos,layer:l},h)),this.replace(l,s,D);}if(E||C||x){var _U12=D==null?void 0:D.getBoundingClientRect();_U12&&(p={x:Math.floor(_U12.x-$t.SafeBorderPadding),y:Math.floor(_U12.y-$t.SafeBorderPadding),w:Math.floor(_U12.width+$t.SafeBorderPadding*2),h:Math.floor(_U12.height+$t.SafeBorderPadding*2)});}return this.isDelete&&D.setAttribute("opacity",0),p;}},{key:"computDrawPoints",value:function computDrawPoints(t){return this.workOptions.strokeType===we.Stroke||t.length===1?this.computStroke(t):this.computNomal(t);}},{key:"computNomal",value:function computNomal(t){var r=this.workOptions.thickness;var n=t.map(function(s){return r=Math.max(r,s.radius),s.point;});return{ps:n,rect:Re(n,r)};}},{key:"computStroke",value:function computStroke(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return t.length===1?this.computDotStroke(t[0]):this.computLineStroke(t,r);}},{key:"computLineStroke",value:function computLineStroke(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var n=[],s=[];for(var f=0;f<t.length;f++){var _t$f=t[f],h=_t$f.point,m=_t$f.radius;var u=h.v;f===0&&t.length>1&&(u=t[f+1].point.v);var y=pt.Per(u).mul(m);n.push(Jt.Sub(h,y)),s.push(Jt.Add(h,y));}var c=t[t.length-1];if(r){var _f6=Jt.GetSemicircleStroke(c.point,n[n.length-1],-1,8),_h4=Jt.GetSemicircleStroke(t[0].point,s[0],-1,8),_m7=n.concat(_f6,s.reverse(),_h4);return{ps:_m7,rect:Re(_m7)};}var l=n.concat(s.reverse());return{ps:l,rect:Re(l)};}},{key:"computDotStroke",value:function computDotStroke(t){var r=t.point,n=t.radius,s={x:r.x-n,y:r.y-n,w:n*2,h:n*2};return{ps:Jt.GetDotStroke(r,n,8),rect:s};}},{key:"transformData",value:function transformData(t,r){var n=t.op,s=t.workState;var c=this.tmpPoints.length-1,l=[];if(n!=null&&n.length&&s){var _this$workOptions2=this.workOptions,f=_this$workOptions2.strokeType,h=_this$workOptions2.thickness,m=/* @__PURE__ */new Set();c=f===we.Stroke?this.updateTempPointsWithPressure(n,h,m):this.updateTempPoints(n,h,m);var u=r?this.tmpPoints:this.tmpPoints.slice(c);return l=this.getTaskPoints(u,h),{tasks:l,effects:m,consumeIndex:c};}return{tasks:l,consumeIndex:c};}/** 压力渐变公式 */},{key:"computRadius",value:function computRadius(t,r){return t*0.03*r+r*0.5;}},{key:"getMinZ",value:function getMinZ(t,r){return((r||Math.max(1,Math.floor(t*0.3)))-t*0.5)*100/t/3;}},{key:"getTaskPoints",value:function getTaskPoints(t,r){var u;var n=[];if(t.length===0)return[];var s=0,c=t[0].x,l=t[0].y,f=[c,l],h=[],m=t[0].t;for(;s<t.length;){var y=t[s],T=y.x-c,E=y.y-l,C=y.z,x=r?this.computRadius(C,r):C;if(h.push({point:new Jt(T,E,C,t[s].v),radius:x}),s>0&&s<t.length-1){var _I34=t[s].getAngleByPoints(t[s-1],t[s+1]);if(_I34<60||_I34>300){var _d31=(u=h.pop())==null?void 0:u.point.clone();_d31&&n.push({taskId:m,pos:f,points:[].concat(_toConsumableArray(h),[{point:_d31,radius:x}])}),c=t[s].x,l=t[s].y,f=[c,l];var v=y.x-c,p=y.y-l;h=[{point:new Jt(v,p,C),radius:x}],m=Date.now();}}s++;}return n.push({taskId:m,pos:f,points:h}),n;}},{key:"updateTempPointsWithPressure",value:function updateTempPointsWithPressure(t,r,n){var s=Date.now(),c=this.tmpPoints.length;var l=c;for(var h=0;h<t.length;h+=2){l=Math.min(l,c);var m=this.tmpPoints.length,u=new Jt(t[h],t[h+1]);if(m===0){this.tmpPoints.push(u);continue;}var y=m-1,T=this.tmpPoints[y],E=pt.Sub(u,T).uni();if(u.isNear(T,r)){if(T.z<this.MAX_REPEAR){if(T.setz(Math.min(T.z+1,this.MAX_REPEAR)),l=Math.min(l,y),m>1){var _I35=m-1;for(;_I35>0;){var _d32=this.tmpPoints[_I35].distance(this.tmpPoints[_I35-1]),v=Math.max(this.tmpPoints[_I35].z-this.uniThickness*_d32,0);if(this.tmpPoints[_I35-1].z>=v)break;this.tmpPoints[_I35-1].setz(v),l=Math.min(l,_I35-1),_I35--;}}}else l=1/0;continue;}u.setv(E);var C=u.distance(T),x=Math.max(T.z-this.uniThickness*C,0);m>1&&pt.Equals(E,T.v,0.02)&&(x>0||T.z<=0)&&(n&&T.t&&n.add(T.t),this.tmpPoints.pop(),l=Math.min(y,l)),u.setz(x),this.tmpPoints.push(u);}if(l===1/0)return this.tmpPoints.length;var f=c;if(l===c){f=Math.max(f-1,0);var _h5=this.tmpPoints[f].t;_h5&&(n==null||n.add(_h5));}else{var _h6=c-1;for(f=l;_h6>=0;){var _m8=this.tmpPoints[_h6].t;if(_m8&&(n==null||n.add(_m8),_h6<=l)){f=_h6,_h6=-1;break;}_h6--;}}return this.tmpPoints[f].setT(s),f;}},{key:"updateTempPoints",value:function updateTempPoints(t,r,n){var h;var s=Date.now(),c=this.tmpPoints.length;var l=c;for(var m=0;m<t.length;m+=2){var u=this.tmpPoints.length,y=new Jt(t[m],t[m+1]);if(u===0){this.tmpPoints.push(y);continue;}var T=u-1,E=this.tmpPoints[T],C=pt.Sub(y,E).uni();if(y.isNear(E,r/2)){l=Math.min(T,l);continue;}pt.Equals(C,E.v,0.02)&&(n&&E.t&&n.add(E.t),this.tmpPoints.pop(),l=Math.min(T,l)),y.setv(C),this.tmpPoints.push(y);}var f=c;if(l===c){f=Math.max(f-1,0);var _m9=this.tmpPoints[f].t;_m9&&(n==null||n.add(_m9));}else{var _m10=Math.min(c-1,l);for(f=l;_m10>=0;){var _u4=(h=this.tmpPoints[_m10])==null?void 0:h.t;if(_u4&&(n==null||n.add(_u4),_m10<=l)){f=_m10,_m10=-1;break;}_m10--;}}return this.tmpPoints[f].setT(s),f;}},{key:"updateTempPointsWithPressureWhenDone",value:function updateTempPointsWithPressureWhenDone(t){var r=this.workOptions.thickness,n=t.length,s=this.getMinZ(r);for(var c=0;c<n;c+=2){var l=this.tmpPoints.length,f=new Jt(t[c],t[c+1]);if(l===0){this.tmpPoints.push(f);continue;}var h=l-1,m=this.tmpPoints[h],u=pt.Sub(f,m).uni(),y=f.distance(m);if(l>1&&m.z===s)break;if(f.isNear(m,r/2)){if(n<3&&m.z<this.MAX_REPEAR&&(m.setz(Math.min(m.z+1,this.MAX_REPEAR)),l>1)){var E=l-1;for(;E>0;){var C=this.tmpPoints[E].distance(this.tmpPoints[E-1]),x=Math.max(this.tmpPoints[E].z-this.uniThickness*C,-r/4);if(this.tmpPoints[E-1].z>=x)break;this.tmpPoints[E-1].setz(x),E--;}}continue;}f.setv(u);var T=Math.max(m.z-this.uniThickness*y,s);l>1&&pt.Equals(u,m.v,0.02)&&m.z<=0&&this.tmpPoints.pop(),f.setz(T),this.tmpPoints.push(f);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var h,m;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.strokeType,f=s.get(r.name);return c&&(r.tagName==="GROUP"?nE(r)?r.setAttribute("bgcolor",c):r.children.forEach(function(u){u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c);}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&f!=null&&f.opt&&(m=f.opt)!=null&&m.strokeType&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),$t.updateNodeOpt(t);}}]);}($t);var Sh=/*#__PURE__*/function(_$t2){function Sh(t){var _this66;_classCallCheck(this,Sh);_this66=_callSuper(this,Sh,[t]);dt(_this66,"toolsType",Tt.LaserPen);dt(_this66,"canRotate",!1);dt(_this66,"scaleType",Ae.none);dt(_this66,"syncTimestamp");dt(_this66,"syncIndex",0);dt(_this66,"tmpPoints",[]);dt(_this66,"workOptions");dt(_this66,"consumeIndex",0);_this66.workOptions=t.toolsOpt,_this66.syncTimestamp=0;return _this66;}_inherits(Sh,_$t2);return _createClass(Sh,[{key:"combineConsume",value:function combineConsume(){}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(Sh,"setWorkOptions",this,3)([t]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(t){var r=t.data,n=t.isSubWorker,s=r.workId,c=r.op,l=r.syncUnitTime;if((c==null?void 0:c.length)===0)return{type:xt.None};if(l&&(this.syncUnitTime=l),this.updateTempPoints(c||[]),this.consumeIndex>this.tmpPoints.length-4)return{type:xt.None};var _this$workOptions3=this.workOptions,f=_this$workOptions3.strokeColor,h=_this$workOptions3.thickness,m=_this$workOptions3.strokeType,u=_this$workOptions3.lineDash,y=_this$workOptions3.lineCap,T=Re(this.tmpPoints,h);var E=!1;var C=this.syncIndex,x=this.tmpPoints.slice(this.consumeIndex);this.consumeIndex=this.tmpPoints.length-1,this.syncTimestamp===0&&(this.syncTimestamp=Date.now());var I={name:s==null?void 0:s.toString(),opacity:1,lineDash:m===we.Dotted?[u&&u[0]||1,(u&&u[1]||2)*h]:m===we.LongDotted?[(u&&u[0]||1)*h,(u&&u[1]||2)*h]:void 0,strokeColor:f,lineCap:y,lineWidth:h,anchor:[0.5,0.5]},d=this.getTaskPoints(x);if(d.length){var p=Date.now();p-this.syncTimestamp>this.syncUnitTime&&(E=!0,this.syncTimestamp=p,this.syncIndex=this.tmpPoints.length),n&&this.draw({attrs:I,tasks:d,isDot:!1,layer:this.drawLayer||this.fullLayer});}var v=[];return this.tmpPoints.slice(C).forEach(function(p){v.push(p.x,p.y);}),_objectSpread({rect:{x:T.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:T.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:T.w*this.fullLayer.worldScaling[0],h:T.h*this.fullLayer.worldScaling[1]},type:xt.DrawWork,dataType:Vt.Local,op:E?v:void 0,index:E?C*2:void 0},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var c;var t=(c=this.workId)==null?void 0:c.toString();var r;if(this.tmpPoints.length-1>this.consumeIndex){var l=this.tmpPoints.slice(this.consumeIndex);var f=l.length===1,_this$workOptions4=this.workOptions,h=_this$workOptions4.strokeColor,m=_this$workOptions4.thickness,u=_this$workOptions4.strokeType;if(f){var E=this.computDotStroke({point:l[0],radius:m/2});l=E.ps,r=E.rect;}else r=Re(this.tmpPoints,m);var y={name:t==null?void 0:t.toString(),fillColor:f?h:void 0,opacity:1,lineDash:u===we.Dotted&&!f?[1,m*2]:u===we.LongDotted&&!f?[m,m*2]:void 0,strokeColor:h,lineCap:f?void 0:"round",lineWidth:f?0:m,anchor:[0.5,0.5]},T=this.getTaskPoints(l);T.length&&this.draw({attrs:y,tasks:T,isDot:f,layer:this.drawLayer||this.fullLayer});}var n=[];this.tmpPoints.forEach(function(l){n.push(l.x,l.y);});var s=gr(n);return _objectSpread({rect:r&&{x:r.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:r.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:r.w*this.fullLayer.worldScaling[0],h:r.h*this.fullLayer.worldScaling[1]},type:xt.FullWork,dataType:Vt.Local,ops:s,index:this.syncIndex*2},this.baseConsumeResult);}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0;}},{key:"consumeService",value:function consumeService(t){var C;var r=t.op,n=t.replaceId,s=t.isFullWork,_this$workOptions5=this.workOptions,c=_this$workOptions5.strokeColor,l=_this$workOptions5.thickness,f=_this$workOptions5.strokeType;if(!r.length){var x=Re(this.tmpPoints,l);return{x:x.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:x.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:x.w*this.fullLayer.worldScaling[0],h:x.h*this.fullLayer.worldScaling[1]};}var h=Math.max(0,this.tmpPoints.length-1);this.updateTempPoints(r||[]);var m,u=this.tmpPoints.slice(h);var y=u.length===1;if(y){var _x34=this.computDotStroke({point:u[0],radius:l/2});u=_x34.ps,m=_x34.rect;}else m=Re(this.tmpPoints,l);var T={name:(C=this.workId)==null?void 0:C.toString(),fillColor:y?c:void 0,opacity:1,lineDash:f===we.Dotted&&!y?[1,l*2]:f===we.LongDotted&&!y?[l,l*2]:void 0,strokeColor:c,lineCap:y?void 0:"round",lineWidth:y?0:l,anchor:[0.5,0.5]},E=this.getTaskPoints(u);if(E.length){var _x35=s?this.fullLayer:this.drawLayer||this.fullLayer;this.draw({attrs:T,tasks:E,isDot:y,replaceId:n,layer:_x35});}return{x:m.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:m.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:m.w*this.fullLayer.worldScaling[0],h:m.h*this.fullLayer.worldScaling[1]};}},{key:"computDotStroke",value:function computDotStroke(t){var r=t.point,n=t.radius,s={x:r.x-n,y:r.y-n,w:n*2,h:n*2};return{ps:Jt.GetDotStroke(r,n,8),rect:s};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=this.tmpPoints.length;for(var n=0;n<t.length;n+=2){if(r){var s=this.tmpPoints.slice(-1)[0];s&&s.x===t[n]&&s.y===t[n+1]&&this.tmpPoints.pop();}this.tmpPoints.push(new Jt(t[n],t[n+1]));}}},{key:"draw",value:function(){var _draw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(t){var _this67=this;var r,n,s,c,l,_iterator18,_step18,_loop5;return _regeneratorRuntime().wrap(function _callee21$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:r=t.attrs,n=t.tasks,s=t.isDot,c=t.layer,l=this.workOptions.duration;_iterator18=_createForOfIteratorHelper(n);_context23.prev=2;_loop5=/*#__PURE__*/_regeneratorRuntime().mark(function _loop5(){var f,h,m,u,y,_this67$workOptions,T,E,C,_c$getResolution,x,_I36;return _regeneratorRuntime().wrap(function _loop5$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:f=_step18.value;h=new Mn(),m=f.pos,u=f.points;s?y=En(u,!0):y=En(u,!1),h.attr(_objectSpread(_objectSpread({},r),{},{pos:m,d:y}));_this67$workOptions=_this67.workOptions,T=_this67$workOptions.vertex,E=_this67$workOptions.fragment;if(T&&E){C=c.renderer.createProgram({vertex:T,fragment:E}),_c$getResolution=c.getResolution(),x=_c$getResolution.width,_I36=_c$getResolution.height;h.setUniforms({u_time:0,u_resolution:[x,_I36]}),h.setProgram(C);}c.appendChild(h),h.transition(l).attr({scale:s?[0.1,0.1]:[1,1],lineWidth:s?0:1}).then(function(){h.remove();});case 6:case"end":return _context22.stop();}},_loop5);});_iterator18.s();case 5:if((_step18=_iterator18.n()).done){_context23.next=9;break;}return _context23.delegateYield(_loop5(),"t0",7);case 7:_context23.next=5;break;case 9:_context23.next=14;break;case 11:_context23.prev=11;_context23.t1=_context23["catch"](2);_iterator18.e(_context23.t1);case 14:_context23.prev=14;_iterator18.f();return _context23.finish(14);case 17:case"end":return _context23.stop();}},_callee21,this,[[2,11,14,17]]);}));function draw(_x36){return _draw2.apply(this,arguments);}return draw;}()},{key:"getTaskPoints",value:function getTaskPoints(t){var h;var r=[];if(t.length===0)return[];var n=0,s=t[0].x,c=t[0].y,l=[s,c],f=[];for(;n<t.length;){var m=t[n],u=m.x-s,y=m.y-c;if(f.push(new Jt(u,y)),n>0&&n<t.length-1){var T=t[n].getAngleByPoints(t[n-1],t[n+1]);if(T<60||T>300){var E=(h=f.pop())==null?void 0:h.clone();E&&r.push({pos:l,points:[].concat(_toConsumableArray(f),[E])}),s=t[n].x,c=t[n].y,l=[s,c];var C=m.x-s,x=m.y-c;f=[new Jt(C,x)];}}n++;}return r.push({pos:l,points:f}),r;}},{key:"removeLocal",value:function removeLocal(){}},{key:"removeService",value:function removeService(t){var r;var n=[];return this.fullLayer.getElementsByName(t).forEach(function(s){if(s.name===t){var c=s.getBoundingClientRect();r=Zt(r,{x:c.x,y:c.y,w:c.width,h:c.height}),n.push(s);}}),n.length&&n.forEach(function(s){return s.remove();}),r;}}]);}($t);var V2=no;no.polyline=no;no.polygon=Z2;function no(i,e,t){var r=i.length,n=hi(i[0],e),s=[],c,l,f,h,m;for(t||(t=[]),c=1;c<r;c++){for(l=i[c-1],f=i[c],h=m=hi(f,e);;)if(n|h){if(n&h)break;n?(l=al(l,f,n,e),n=hi(l,e)):(f=al(l,f,h,e),h=hi(f,e));}else{s.push(l),h!==m?(s.push(f),c<r-1&&(t.push(s),s=[])):c===r-1&&s.push(f);break;}n=m;}return s.length&&t.push(s),t;}function Z2(i,e){var t,r,n,s,c,l,f;for(r=1;r<=8;r*=2){for(t=[],n=i[i.length-1],s=!(hi(n,e)&r),c=0;c<i.length;c++)l=i[c],f=!(hi(l,e)&r),f!==s&&t.push(al(n,l,r,e)),f&&t.push(l),n=l,s=f;if(i=t,!i.length)break;}return t;}function al(i,e,t,r){return t&8?[i[0]+(e[0]-i[0])*(r[3]-i[1])/(e[1]-i[1]),r[3]]:// top
|
|
404
404
|
t&4?[i[0]+(e[0]-i[0])*(r[1]-i[1])/(e[1]-i[1]),r[1]]:// bottom
|
|
405
405
|
t&2?[r[2],i[1]+(e[1]-i[1])*(r[2]-i[0])/(e[0]-i[0])]:// right
|
|
406
406
|
t&1?[r[0],i[1]+(e[1]-i[1])*(r[0]-i[0])/(e[0]-i[0])]:// left
|
|
407
|
-
null;}function
|
|
408
|
-
dt(pi,"eraserSizes",Tl);var io=pi;var J2="__lodash_hash_undefined__";function Q2(i){return this.__data__.set(i,J2),this;}var q2=Q2;function _2(i){return this.__data__.has(i);}var tw=_2,ew=Hu,rw=q2,nw=tw;function so(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new ew();++e<t;)this.add(i[e]);}so.prototype.add=so.prototype.push=rw;so.prototype.has=nw;var Ol=so;function iw(i,e){for(var t=-1,r=i==null?0:i.length;++t<r;)if(e(i[t],t,i))return!0;return!1;}var sw=iw;function ow(i,e){return i.has(e);}var wl=ow,aw=Ol,lw=sw,fw=wl,cw=1,uw=2;function hw(i,e,t,r,n,s){var c=t&cw,l=i.length,f=e.length;if(l!=f&&!(c&&f>l))return!1;var h=s.get(i),m=s.get(e);if(h&&m)return h==e&&m==i;var u=-1,y=!0,T=t&uw?new aw():void 0;for(s.set(i,e),s.set(e,i);++u<l;){var E=i[u],C=e[u];if(r)var x=c?r(C,E,u,e,i,s):r(E,C,u,i,e,s);if(x!==void 0){if(x)continue;y=!1;break;}if(T){if(!lw(e,function(I,d){if(!fw(T,d)&&(E===I||n(E,I,t,r,s)))return T.push(d);})){y=!1;break;}}else if(!(E===C||n(E,C,t,r,s))){y=!1;break;}}return s["delete"](i),s["delete"](e),y;}var xh=hw;function dw(i){var e=-1,t=Array(i.size);return i.forEach(function(r,n){t[++e]=[n,r];}),t;}var pw=dw;function vw(i){var e=-1,t=Array(i.size);return i.forEach(function(r){t[++e]=r;}),t;}var Al=vw,pu=Ji,vu=ch,gw=ul,mw=xh,yw=pw,Pw=Al,Sw=1,xw=2,Tw="[object Boolean]",Cw="[object Date]",Iw="[object Error]",Ow="[object Map]",ww="[object Number]",Aw="[object RegExp]",Ew="[object Set]",Mw="[object String]",Lw="[object Symbol]",Rw="[object ArrayBuffer]",bw="[object DataView]",gu=pu?pu.prototype:void 0,qa=gu?gu.valueOf:void 0;function Dw(i,e,t,r,n,s,c){switch(t){case bw:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case Rw:return!(i.byteLength!=e.byteLength||!s(new vu(i),new vu(e)));case Tw:case Cw:case ww:return gw(+i,+e);case Iw:return i.name==e.name&&i.message==e.message;case Aw:case Mw:return i==e+"";case Ow:var l=yw;case Ew:var f=r&Sw;if(l||(l=Pw),i.size!=e.size&&!f)return!1;var h=c.get(i);if(h)return h==e;r|=xw,c.set(i,e);var m=mw(l(i),l(e),r,n,s,c);return c["delete"](i),m;case Lw:if(qa)return qa.call(i)==qa.call(e);}return!1;}var Nw=Dw,mu=ah,Bw=1,Ww=Object.prototype,Fw=Ww.hasOwnProperty;function Uw(i,e,t,r,n,s){var c=t&Bw,l=mu(i),f=l.length,h=mu(e),m=h.length;if(f!=m&&!c)return!1;for(var u=f;u--;){var y=l[u];if(!(c?y in e:Fw.call(e,y)))return!1;}var T=s.get(i),E=s.get(e);if(T&&E)return T==e&&E==i;var C=!0;s.set(i,e),s.set(e,i);for(var x=c;++u<f;){y=l[u];var I=i[y],d=e[y];if(r)var v=c?r(d,I,y,e,i,s):r(I,d,y,i,e,s);if(!(v===void 0?I===d||n(I,d,t,r,s):v)){C=!1;break;}x||(x=y=="constructor");}if(C&&!x){var p=i.constructor,S=e.constructor;p!=S&&"constructor"in i&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof S=="function"&&S instanceof S)&&(C=!1);}return s["delete"](i),s["delete"](e),C;}var Yw=Uw,_a=ku,Xw=xh,zw=Nw,$w=Yw,yu=So,Pu=qi,Su=dl,jw=_u,Gw=1,xu="[object Arguments]",Tu="[object Array]",Ks="[object Object]",Hw=Object.prototype,Cu=Hw.hasOwnProperty;function kw(i,e,t,r,n,s){var c=Pu(i),l=Pu(e),f=c?Tu:yu(i),h=l?Tu:yu(e);f=f==xu?Ks:f,h=h==xu?Ks:h;var m=f==Ks,u=h==Ks,y=f==h;if(y&&Su(i)){if(!Su(e))return!1;c=!0,m=!1;}if(y&&!m)return s||(s=new _a()),c||jw(i)?Xw(i,e,t,r,n,s):zw(i,e,f,t,r,n,s);if(!(t&Gw)){var T=m&&Cu.call(i,"__wrapped__"),E=u&&Cu.call(e,"__wrapped__");if(T||E){var C=T?i.value():i,x=E?e.value():e;return s||(s=new _a()),n(C,x,t,r,s);}}return y?(s||(s=new _a()),$w(i,e,t,r,n,s)):!1;}var Kw=kw,Vw=Kw,Iu=pn;function Th(i,e,t,r,n){return i===e?!0:i==null||e==null||!Iu(i)&&!Iu(e)?i!==i&&e!==e:Vw(i,e,t,r,Th,n);}var Zw=Th,Jw=Zw;function Qw(i,e){return Jw(i,e);}var qw=Qw,qr=/* @__PURE__ */Ln(qw);function Ou(i,e,t){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;return"rgba(".concat(i,",").concat(e,",").concat(t,",").concat(r,")");}function _w(i){var e=i.split(","),t=parseInt(e[0].split("(")[1]),r=parseInt(e[1]),n=parseInt(e[2]),s=Number(e[3].split(")")[0]);return[t,r,n,s];}var ho=/*#__PURE__*/function(_$t4){function ho(t){var _this70;_classCallCheck(this,ho);_this70=_callSuper(this,ho,[t]);dt(_this70,"toolsType",Tt.Selector);dt(_this70,"tmpPoints",[]);dt(_this70,"subTmpPoints",[]);dt(_this70,"workOptions");dt(_this70,"vNodes");dt(_this70,"selectIds");dt(_this70,"selectorColor");dt(_this70,"strokeColor");dt(_this70,"fillColor");dt(_this70,"oldSelectRect");dt(_this70,"oldSubSelectRect");dt(_this70,"canRotate",!1);dt(_this70,"canTextEdit",!1);dt(_this70,"canLock",!1);dt(_this70,"scaleType",Ae.all);dt(_this70,"toolsTypes");dt(_this70,"shapeOpt");dt(_this70,"textOpt");dt(_this70,"isLocked");dt(_this70,"thickness");dt(_this70,"strokeType");dt(_this70,"useStroke");_this70.workOptions=t.toolsOpt,_this70.vNodes=t.vNodes;return _this70;}_inherits(ho,_$t4);return _createClass(ho,[{key:"computSelector",value:function computSelector(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var r=Re(this.tmpPoints);if(r.w===0||r.h===0)return{selectIds:[],intersectRect:void 0,subNodeMap:/* @__PURE__ */new Map()};var _this$vNodes$getRectI=this.vNodes.getRectIntersectRange(r,t),n=_this$vNodes$getRectI.rectRange,s=_this$vNodes$getRectI.nodeRange;return{selectIds:_toConsumableArray(s.keys()),intersectRect:n,subNodeMap:s};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=this.tmpPoints.length,n=t.length;if(n>1){var s=new Jt(t[n-2]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[n-1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]);r===2?this.tmpPoints.splice(1,1,s):this.tmpPoints.push(s);}}},{key:"drawSelector",value:function drawSelector(t){var _this71=this;var r=t.drawRect,n=t.subNodeMap,s=t.selectorId,c=t.layer,l=t.isService,f=new mr({pos:[r.x,r.y],anchor:[0,0],size:[r.w,r.h],id:s,name:s,zIndex:9999}),h=[];if(l){var m=new zc({normalize:!0,pos:[r.w/2,r.h/2],lineWidth:1,strokeColor:this.selectorColor||this.workOptions.strokeColor,width:r.w,height:r.h,name:ho.selectorBorderId});h.push(m);}n.forEach(function(m,u){var y=[m.rect.x+m.rect.w/2-r.x,m.rect.y+m.rect.h/2-r.y],T=new zc({normalize:!0,pos:y,lineWidth:1,strokeColor:n.size>1?_this71.selectorColor||_this71.workOptions.strokeColor:void 0,width:m.rect.w,height:m.rect.h,id:"selector-".concat(u),name:"selector-".concat(u)});h.push(T);}),h&&f.append.apply(f,h),(c==null?void 0:c.parent).appendChild(f);}},{key:"draw",value:function draw(t,r,n){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var f,h;var c=n.intersectRect,l=n.subNodeMap;(h=(f=r.parent)==null?void 0:f.getElementById(t))==null||h.remove(),c&&this.drawSelector({drawRect:c,subNodeMap:l,selectorId:t,layer:r,isService:s});}},{key:"getSelecteorInfo",value:function getSelecteorInfo(t){this.scaleType=Ae.all,this.canRotate=!1,this.textOpt=void 0,this.strokeColor=void 0,this.fillColor=void 0,this.canTextEdit=!1,this.canLock=!1,this.isLocked=!1,this.toolsTypes=void 0,this.shapeOpt=void 0,this.thickness=void 0,this.strokeType=void 0,this.useStroke=!1;var r=/* @__PURE__ */new Set();var n,s=!0;var _iterator23=_createForOfIteratorHelper(t.values()),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var c=_step23.value;var l=c.opt,f=c.canRotate,h=c.scaleType,m=c.toolsType;this.selectorColor=this.workOptions.strokeColor,l.strokeColor&&(this.strokeColor=l.strokeColor),l.fillColor&&(this.fillColor=l.fillColor),l.textOpt&&(this.textOpt=l.textOpt),l.thickness&&(this.thickness=l.thickness),m!==Tt.Pencil&&(s=!1),l.strokeType&&(this.strokeType=l.strokeType),m===Tt.SpeechBalloon&&(r.add(m),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.placement=l.placement),m===Tt.Polygon&&(r.add(m),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=l.vertices),m===Tt.Star&&(r.add(m),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=l.vertices,this.shapeOpt.innerRatio=l.innerRatio,this.shapeOpt.innerVerticeStep=l.innerVerticeStep),m===Tt.Text&&(this.textOpt=l),t.size===1&&(this.textOpt&&(this.canTextEdit=!0),this.canRotate=f,this.scaleType=h),m===Tt.Image&&(n=c),(h===Ae.proportional&&this.scaleType!==Ae.none||h===Ae.none)&&(this.scaleType=h);}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}s&&(this.useStroke=!0),r.size&&(this.toolsTypes=_toConsumableArray(r)),n&&(t.size===1?(this.canLock=!0,n.opt.locked&&(this.isLocked=!0,this.scaleType=Ae.none,this.canRotate=!1,this.textOpt=void 0,this.fillColor=void 0,this.selectorColor="rgb(177,177,177)",this.strokeColor=void 0,this.canTextEdit=!1,this.thickness=void 0,this.strokeType=void 0,this.useStroke=void 0)):t.size>1&&!n.opt.locked&&(this.canLock=!1,this.canRotate=!1));}},{key:"getChildrenPoints",value:function getChildrenPoints(){var t,r;if(this.scaleType===Ae.both&&((t=this.selectIds)==null?void 0:t.length)===1){var n=this.selectIds[0],s=(r=this.vNodes.get(n))==null?void 0:r.op;if(s){var c=[];for(var l=0;l<s.length;l+=3)c.push([s[l],s[l+1]]);return c;}}}},{key:"consume",value:function consume(t){if(t.isSubWorker)return this.subWorkerConsume(t);var r=_objectSpread({type:xt.Select,dataType:Vt.Local},this.baseConsumeResult);if(t.isSimpleWorker){var m=this.subWorkerConsume(t);r.subRect=m.rect;}var _t$data3=t.data,n=_t$data3.op,s=_t$data3.workState;var c=this.oldSelectRect;if(s===te.Start&&(c=this.unSelectedAllIds()),!(n!=null&&n.length)||!this.vNodes.curNodeMap.size)return t.isSimpleWorker?r:{type:xt.None};this.updateTempPoints(n);var l=this.computSelector();if(this.selectIds&&qr(this.selectIds,l.selectIds))return t.isSimpleWorker?r:{type:xt.None};this.selectIds=l.selectIds;var f=l.intersectRect;this.getSelecteorInfo(l.subNodeMap),this.draw(Me,this.fullLayer,l),this.oldSelectRect=f;var h=this.getChildrenPoints();return r=_objectSpread(_objectSpread({},r),{},{rect:Zt(f,c),selectIds:l.selectIds,selectRect:f,selectorColor:this.selectorColor,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:h,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType}),r;}},{key:"consumeAll",value:function consumeAll(){var r,n;var t=this.oldSelectRect;if(!((r=this.selectIds)!=null&&r.length)&&this.tmpPoints[0]&&this.selectSingleTool(this.tmpPoints[0].XY,Me,!1),(n=this.selectIds)!=null&&n.length&&(t=this.selectedByIds(this.selectIds)),t){var s=this.getChildrenPoints();return _objectSpread({type:xt.Select,dataType:Vt.Local,rect:this.oldSelectRect,selectIds:this.selectIds,selectorColor:this.selectorColor,selectRect:this.oldSelectRect,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:s,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},this.baseConsumeResult);}return{type:xt.None};}},{key:"consumeService",value:function consumeService(){}},{key:"updateTempPointsForSubWorker",value:function updateTempPointsForSubWorker(t){var r=t.slice(-2),n=new Jt(r[0],r[1]);if(this.subTmpPoints[0].isNear(n,1))return!1;if(this.subTmpPoints.length===2){if(n.isNear(this.subTmpPoints[1],1))return!1;this.subTmpPoints[1]=n;}else this.subTmpPoints.push(n);return!0;}},{key:"computDrawPoints",value:function computDrawPoints(t){var r=this.workOptions.thickness,n=[];var _iterator24=_createForOfIteratorHelper(t),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var l=_step24.value;n.push(_construct(pt,_toConsumableArray(l)));}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}var s=Re(n,r),c=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:c,points:n.map(function(l){return l.XY;}).flat(1)};}},{key:"drawForSubWorker",value:function drawForSubWorker(t){var r=t.workId,n=t.layer,s=t.ps,_this$workOptions6=this.workOptions,c=_this$workOptions6.strokeColor,l=_this$workOptions6.scale,f=_this$workOptions6.rotate,h=_this$workOptions6.translate,m=n.worldPosition,u=n.worldScaling,_this$computDrawPoint2=this.computDrawPoints(s),y=_this$computDrawPoint2.points,T=_this$computDrawPoint2.rect,E=_this$computDrawPoint2.pos,C=1/n.worldScaling[0],x=c&&_w(c)||[0,0,0,0],I={close:!0,normalize:!0,points:y,lineWidth:C,fillColor:Ou(x[0],x[1],x[2],0.1),strokeColor:Ou(x[0],x[1],x[2],1),lineJoin:"round",lineCap:"round"};var d={x:Math.floor(T.x*u[0]+m[0]-$t.SafeBorderPadding),y:Math.floor(T.y*u[1]+m[1]-$t.SafeBorderPadding),w:Math.floor(T.w*u[0]+2*$t.SafeBorderPadding),h:Math.floor(T.h*u[0]+2*$t.SafeBorderPadding)};var v=new mr({name:r,id:r,pos:E,anchor:[0.5,0.5],size:[T.w,T.h],scale:l,rotate:f,translate:h}),p=new dn(_objectSpread(_objectSpread({},I),{},{pos:[0,0]}));if(v.appendChild(p),this.replace(n,r,v),l||f||h){var S=v.getBoundingClientRect();d={x:Math.floor(S.x-$t.SafeBorderPadding),y:Math.floor(S.y-$t.SafeBorderPadding),w:Math.floor(S.width+2*$t.SafeBorderPadding),h:Math.floor(S.height+2*$t.SafeBorderPadding)};}return d;}},{key:"transformData",value:function transformData(t){var r=Re(t);return[[r.x,r.y,0],[r.x+r.w,r.y,0],[r.x+r.w,r.y+r.h,0],[r.x,r.y+r.h,0]];}},{key:"subWorkerConsume",value:function subWorkerConsume(t){var r=t.data,n=t.isFullWork,s=r.op,c=r.syncUnitTime;c&&(this.syncUnitTime=c);var l=s==null?void 0:s.length;if(!l||l<2)return{type:xt.None,rect:void 0};var f;if(this.subTmpPoints.length===0?(this.subTmpPoints=[new Jt(s[0],s[1])],f=!1):f=this.updateTempPointsForSubWorker(s),!f)return{type:xt.None,rect:void 0};var h=this.transformData(this.subTmpPoints),m=n?this.fullLayer:this.drawLayer||this.fullLayer,u=this.drawForSubWorker({ps:h,workId:this.workId,layer:m}),y=Zt(u,this.oldSubSelectRect);return this.oldSubSelectRect=u,_objectSpread({rect:y,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"subWorkerConsumeAll",value:function subWorkerConsumeAll(t){var r=t.isFullWork,n=r?this.fullLayer:this.drawLayer||this.fullLayer;return this.replace(n,this.workId),_objectSpread({rect:this.oldSelectRect,type:xt.FullWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"clearSubTmpPoints",value:function clearSubTmpPoints(){this.subTmpPoints.length=0;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.clearSubTmpPoints();}},{key:"clearSubSelectData",value:function clearSubSelectData(){this.oldSubSelectRect=void 0;}},{key:"clearSelectData",value:function clearSelectData(){this.selectIds=void 0,this.oldSelectRect=void 0,this.clearSubSelectData();}},{key:"selectSingleTool",value:function selectSingleTool(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Me;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;if(t.length===2){var s=t[0],c=t[1];var l;var _this$vNodes$getRectI2=this.vNodes.getRectIntersectRange({x:s,y:c,w:0,h:0},!1),f=_this$vNodes$getRectI2.nodeRange,h=_toConsumableArray(f.values()).sort(function(m,u){return(u.opt.zIndex||0)-(m.opt.zIndex||0);});var _iterator25=_createForOfIteratorHelper(h),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _m11=_step25.value;var _u5=this.fullLayer.getElementsByName(_m11.name);if(Hh(_u5).find(function(T){return T.isPointCollision(s,c);})){l=_m11;break;}}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}if(l){var m=l.name;if(!qr(this.oldSelectRect,l.rect)){var u=/* @__PURE__ */new Map([[m,l]]);this.getSelecteorInfo(u),this.draw(r,this.fullLayer,{intersectRect:l.rect,subNodeMap:u,selectIds:this.selectIds||[]},n);}this.selectIds=[m],this.oldSelectRect=l.rect;}}}},{key:"unSelectedAllIds",value:function unSelectedAllIds(){var t;var _iterator26=_createForOfIteratorHelper(this.vNodes.curNodeMap.entries()),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var _step26$value=_slicedToArray(_step26.value,2),r=_step26$value[0],n=_step26$value[1];n.isSelected&&(t=Zt(t,n.rect),this.vNodes.unSelected(r));}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}return t;}},{key:"unSelectedByIds",value:function unSelectedByIds(t){var r;var _iterator27=_createForOfIteratorHelper(t),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var n=_step27.value;var s=this.vNodes.get(n);s&&s.isSelected&&(r=Zt(r,s.rect),this.vNodes.unSelected(n));}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}return r;}},{key:"selectedByIds",value:function selectedByIds(t){var r;var _iterator28=_createForOfIteratorHelper(t),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var n=_step28.value;var s=this.vNodes.get(n);s&&(r=Zt(r,s.rect),this.vNodes.selected(n));}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}return r;}},{key:"getSelectorRect",value:function getSelectorRect(t,r){var l;var n;var s=(l=t.parent)==null?void 0:l.getElementById(r),c=s==null?void 0:s.getBoundingClientRect();return c&&(n=Zt(n,{x:Math.floor(c.x),y:Math.floor(c.y),w:Math.floor(c.width+1),h:Math.floor(c.height+1)})),n;}},{key:"isCanFillColor",value:function isCanFillColor(t){return t===Tt.Ellipse||t===Tt.Triangle||t===Tt.Rectangle||t===Tt.Polygon||t===Tt.Star||t===Tt.SpeechBalloon;}},{key:"updateSelector",value:function(){var _updateSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(t){var r,n,s,c,l,f,h,m,u,y,T,E,C,x,I,d,_iterator29,_step29,S,A,R,D,U,M,W,Y,B,N,G,v,_S13,_A9,_R4,p;return _regeneratorRuntime().wrap(function _callee22$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:r=t.updateSelectorOpt,n=t.selectIds,s=t.vNodes,c=t.willSerializeData,l=t.worker,f=t.offset,h=this.fullLayer;if(h){_context24.next=3;break;}return _context24.abrupt("return");case 3:u=/* @__PURE__ */new Map(),y=r.originPoint,T=r.workState,E=r.angle,C=r.translate,x=r.dir,I=r.scale;f&&(C?r.translate=[C[0]+f[0],C[1]+f[1]]:r.translate=f);if(!(y||C||er(E))){_context24.next=10;break;}if(!(T===te.Start&&n)){_context24.next=8;break;}return _context24.abrupt("return",(s.setTargetAssignKeys(n),{type:xt.Select,dataType:Vt.Local,selectRect:this.oldSelectRect,rect:this.oldSelectRect}));case 8:if(!(d=s.getLastTarget(),!d)){_context24.next=10;break;}return _context24.abrupt("return");case 10:if(!n){_context24.next=62;break;}_iterator29=_createForOfIteratorHelper(n);_context24.prev=12;_iterator29.s();case 14:if((_step29=_iterator29.n()).done){_context24.next=54;break;}S=_step29.value;A=s.get(S);if(!A){_context24.next=52;break;}R=A.toolsType,D=A.opt,U=(h==null?void 0:h.getElementsByName(S))[0];if(!U){_context24.next=52;break;}M=_objectSpread({},r);W=void 0;Y=$t.isWillRefresh({toolsType:R,opt:D,updateOpt:M,vNodes:s,node:U,willSerializeData:c});if(!R){_context24.next=52;break;}W=d==null?void 0:d.get(S);B=Gh(R);if(!(B==null||B.updateNodeOpt({node:U,opt:M,vNodes:s,willSerializeData:c,targetNode:W}),A&&l&&Y)){_context24.next=51;break;}N=l.createWorkShapeNode({workId:S,toolsType:R,toolsOpt:A.opt});N==null||N.setWorkId(S);G=void 0;if(!(R===Tt.Image)){_context24.next=36;break;}_context24.next=33;return N.consumeServiceAsync({isFullWork:!0,replaceId:S,worker:l});case 33:G=_context24.sent;_context24.next=50;break;case 36:if(!(R===Tt.Text)){_context24.next=42;break;}_context24.next=39;return N.consumeServiceAsync({isFullWork:!0,replaceId:S,isDrawLabel:!0});case 39:G=_context24.sent;_context24.next=50;break;case 42:_context24.prev=42;G=N==null?void 0:N.consumeService({op:A.op,isFullWork:!0,replaceId:S,workState:T});_context24.next=50;break;case 46:_context24.prev=46;_context24.t0=_context24["catch"](42);console.error("consumeService error",_context24.t0);return _context24.abrupt("continue",52);case 50:G&&(A.rect=G);case 51:A&&(u.set(S,A),m=Zt(m,A.rect));case 52:_context24.next=14;break;case 54:_context24.next=59;break;case 56:_context24.prev=56;_context24.t1=_context24["catch"](12);_iterator29.e(_context24.t1);case 59:_context24.prev=59;_iterator29.f();return _context24.finish(59);case 62:d&&T===te.Done&&(s.deleteLastTarget(),d=void 0);v=m;if(!(y&&C&&I&&x&&v&&!f)){_context24.next=82;break;}_S13=[[v.x,v.y],[v.x+v.w,v.y],[v.x+v.w,v.y+v.h],[v.x,v.y+v.h]];_context24.t2=x;_context24.next=_context24.t2==="top"?69:_context24.t2==="topLeft"?69:_context24.t2==="left"?69:_context24.t2==="topRight"?71:_context24.t2==="right"?73:_context24.t2==="bottomRight"?73:_context24.t2==="bottom"?73:_context24.t2==="bottomLeft"?75:77;break;case 69:C[0]>0&&C[1]>0?_A9=_S13[0]:C[0]>0?_A9=_S13[3]:C[1]>0?_A9=_S13[1]:_A9=_S13[2];return _context24.abrupt("break",77);case 71:C[0]<0&&C[1]>0?_A9=_S13[1]:C[0]<0?_A9=_S13[2]:C[1]>0?_A9=_S13[0]:_A9=_S13[3];return _context24.abrupt("break",77);case 73:C[0]<0&&C[1]<0?_A9=_S13[2]:C[0]<0?_A9=_S13[1]:C[1]<0?_A9=_S13[3]:_A9=_S13[0];return _context24.abrupt("break",77);case 75:C[0]>0&&C[1]<0?_A9=_S13[3]:C[0]>0?_A9=_S13[0]:C[1]<0?_A9=_S13[2]:_A9=_S13[1];return _context24.abrupt("break",77);case 77:_R4=_A9&&[y[0]-_A9[0],y[1]-_A9[1]]||[0,0];if(qr(_R4,[0,0])){_context24.next=82;break;}_context24.next=81;return this.updateSelector(_objectSpread(_objectSpread({},t),{},{updateSelectorOpt:{workState:T},offset:_R4}));case 81:return _context24.abrupt("return",_context24.sent);case 82:this.getSelecteorInfo(u),this.draw(Me,h,{selectIds:n||[],subNodeMap:u,intersectRect:v});p=Zt(this.oldSelectRect,v);return _context24.abrupt("return",(this.oldSelectRect=v,{type:xt.Select,dataType:Vt.Local,selectRect:v,renderRect:m,rect:Zt(p,v),selectIds:n}));case 85:case"end":return _context24.stop();}},_callee22,this,[[12,56,59,62],[42,46]]);}));function updateSelector(_x37){return _updateSelector.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function blurSelector(){var t=this.unSelectedAllIds();return{type:xt.Select,dataType:Vt.Local,rect:t,selectIds:[],willSyncService:!0};}},{key:"getRightServiceId",value:function getRightServiceId(t){return t.replace(mi,"-");}},{key:"selectServiceNode",value:function selectServiceNode(t,r,n){var _this72=this;var s=r.selectIds,c=this.getRightServiceId(t),l=this.getSelectorRect(this.fullLayer,c);var f;var h=/* @__PURE__ */new Map();return s==null||s.forEach(function(m){var u=_this72.vNodes.get(m);u&&(f=Zt(f,u.rect),h.set(m,u));}),this.getSelecteorInfo(h),this.draw(c,this.fullLayer,{intersectRect:f,selectIds:s||[],subNodeMap:h},n),Zt(f,l);}},{key:"reRenderSelector",value:function reRenderSelector(){var _this73=this;var n;var t;var r=/* @__PURE__ */new Map();return(n=this.selectIds)==null||n.forEach(function(s){var c=_this73.vNodes.get(s);c&&(t=Zt(t,c.rect),r.set(s,c));},this),this.getSelecteorInfo(r),this.draw(Me,this.fullLayer,{intersectRect:t,subNodeMap:r,selectIds:this.selectIds||[]}),this.oldSelectRect=t,t;}},{key:"updateSelectIds",value:function updateSelectIds(t){var c;var r;var n=(c=this.selectIds)==null?void 0:c.filter(function(l){return!t.includes(l);});if(n!=null&&n.length&&(r=this.unSelectedByIds(n)),t.length){var l=this.selectedByIds(t);r=Zt(r,l);}this.selectIds=t;var s=this.reRenderSelector();return{bgRect:r,selectRect:s};}},{key:"cursorHover",value:function cursorHover(t){var c,l;var r=this.oldSelectRect;this.selectIds=[];var n=(c=this.workId)==null?void 0:c.toString(),s=[t[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]];if(this.selectSingleTool(s,n,!0),this.oldSelectRect&&!qr(r,this.oldSelectRect))return{type:xt.CursorHover,dataType:Vt.Local,rect:Zt(r,this.oldSelectRect),selectorColor:this.selectorColor,willSyncService:!1};if((l=this.selectIds)!=null&&l.length||(this.oldSelectRect=void 0),r&&!this.oldSelectRect)return this.cursorBlur(),{type:xt.CursorHover,dataType:Vt.Local,rect:r,selectorColor:this.selectorColor,willSyncService:!1};}},{key:"cursorBlur",value:function cursorBlur(){var r,n;this.selectIds=[];var t=(r=this.workId)==null?void 0:r.toString();((n=this.fullLayer)==null?void 0:n.parent).children.forEach(function(s){s.name===t&&s.remove();});}}]);}($t);dt(ho,"selectorBorderId","selector-border");var Gi=ho;var Ch=/*#__PURE__*/function(_$t5){function Ch(t){var _this74;_classCallCheck(this,Ch);_this74=_callSuper(this,Ch,[t]);dt(_this74,"canRotate",!1);dt(_this74,"scaleType",Ae.both);dt(_this74,"toolsType",Tt.Arrow);dt(_this74,"tmpPoints",[]);dt(_this74,"workOptions");dt(_this74,"oldRect");dt(_this74,"arrowTipWidth");dt(_this74,"syncTimestamp");_this74.workOptions=t.toolsOpt,_this74.arrowTipWidth=_this74.workOptions.thickness*4,_this74.syncTimestamp=0,_this74.syncUnitTime=50;return _this74;}_inherits(Ch,_$t5);return _createClass(Ch,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=r.syncUnitTime;u&&(this.syncUnitTime=u);var y=m==null?void 0:m.length;if(!y||y<2)return{type:xt.None};var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],T=!1):T=this.updateTempPoints(m),!T)return{type:xt.None};var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:h,layer:x});}if(f){var _x38=Zt(E,this.oldRect);this.oldRect=E;var _I37=_objectSpread({rect:_x38,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d33=Date.now();_d33-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d33,_I37.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I37.index=0,_I37.isSync=!0);}return _I37;}if(!s&&l){var _x39=Date.now();return _x39-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x39,_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread(_objectSpread({rect:C},this.baseConsumeResult),{},{type:xt.DrawWork,dataType:Vt.Local});}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n},this.baseConsumeResult),{},{type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawEraserlines,_this$workOptions7=this.workOptions,c=_this$workOptions7.strokeColor,l=_this$workOptions7.thickness,f=_this$workOptions7.zIndex,h=_this$workOptions7.scale,m=_this$workOptions7.rotate,u=_this$workOptions7.translate,y=_this$workOptions7.strokeType,T=_this$workOptions7.eraserlines,E=_this$workOptions7.lineDash,C=_this$workOptions7.lineCap,x=n.worldPosition,I=n.worldScaling,_this$computDrawPoint3=this.computDrawPoints(l),d=_this$computDrawPoint3.points,v=_this$computDrawPoint3.pos,p=_this$computDrawPoint3.rect,S=_this$computDrawPoint3.isTriangle,A=_this$computDrawPoint3.trianglePoints,R=_this$computDrawPoint3.trianglePos,D=[p.x+p.w/2,p.y+p.h/2],U={pos:D,name:r,id:r,zIndex:f,anchor:[0.5,0.5],size:[p.w,p.h]};h&&(U.scale=h),m&&(U.rotate=m),u&&(U.translate=u);var M=new mr(U),W={points:A,pos:[R[0]-D[0],R[1]-D[1]],fillColor:c,strokeColor:c,lineWidth:0,normalize:!1},Y=new dn(W);if(M.append(Y),!S&&d&&v){var N={points:d,pos:[v[0]-D[0],v[1]-D[1]],fillColor:c,strokeColor:c,lineDash:y===we.Dotted?[E&&E[0]||1,(E&&E[1]||2)*l]:y===we.LongDotted?[(E&&E[0]||1)*l,(E&&E[1]||2)*l]:void 0,lineCap:y===we.Normal?void 0:C,lineWidth:l,normalize:!1},G=new dn(N);M.append(G);}T&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:M,eraserlines:T,pos:D,layer:n},s)),this.replace(n,r,M);var B={x:Math.floor(p.x*I[0]+x[0]-$t.SafeBorderPadding),y:Math.floor(p.y*I[1]+x[1]-$t.SafeBorderPadding),w:Math.floor(p.w*I[0]+2*$t.SafeBorderPadding),h:Math.floor(p.h*I[1]+2*$t.SafeBorderPadding)};if(h||m||u){var _N8=M.getBoundingClientRect();B={x:Math.floor(_N8.x-$t.SafeBorderPadding),y:Math.floor(_N8.y-$t.SafeBorderPadding),w:Math.floor(_N8.width+$t.SafeBorderPadding*2),h:Math.floor(_N8.height+$t.SafeBorderPadding*2)};}return this.isDelete&&M.setAttribute("opacity",0),B;}},{key:"computDrawPoints",value:function computDrawPoints(t){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.arrowTipWidth?this.computFullArrowPoints(t):this.computTrianglePoints();}},{key:"computFullArrowPoints",value:function computFullArrowPoints(t){var _this75=this;var r=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),n=pt.Per(r).mul(t/2),s=Jt.Sub(this.tmpPoints[0],n),c=Jt.Add(this.tmpPoints[0],n),l=pt.Mul(r,this.arrowTipWidth),f=pt.Sub(this.tmpPoints[1],l),h=Jt.Sub(f,n),m=Jt.Add(f,n),u=pt.Per(r).mul(t*1.5),y=Jt.Sub(f,u),T=Jt.Add(f,u),E=[this.tmpPoints[0],f],C=[y,this.tmpPoints[1],T],x=[s,c].concat(C,[h,m]);return{trianglePoints:C.map(function(I){return Jt.Sub(I,_this75.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,points:E.map(function(I){return Jt.Sub(I,_this75.tmpPoints[0]).XY;}).flat(1),rect:Re(x),isTriangle:!1,pos:this.tmpPoints[0].XY};}},{key:"computTrianglePoints",value:function computTrianglePoints(){var _this76=this;var t=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),r=this.tmpPoints[1].distance(this.tmpPoints[0]),n=pt.Per(t).mul(Math.floor(r*3/8)),s=Jt.Sub(this.tmpPoints[0],n),c=Jt.Add(this.tmpPoints[0],n),l=[s,this.tmpPoints[1],c];return{trianglePoints:l.map(function(f){return Jt.Sub(f,_this76.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,rect:Re(l),isTriangle:!0};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState2=t.workState,s=_t$workState2===void 0?te.Done:_t$workState2,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var h,m;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.strokeType,f=s.get(r.name);return c&&(r.tagName==="GROUP"?r.children.forEach(function(u){u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c);}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&f!=null&&f.opt&&(m=f.opt)!=null&&m.strokeType&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),$t.updateNodeOpt(t);}}]);}($t);var Ih=/*#__PURE__*/function(_$t6){function Ih(t){var _this77;_classCallCheck(this,Ih);_this77=_callSuper(this,Ih,[t]);dt(_this77,"canRotate",!1);dt(_this77,"scaleType",Ae.all);dt(_this77,"toolsType",Tt.Ellipse);dt(_this77,"tmpPoints",[]);dt(_this77,"workOptions");dt(_this77,"oldRect");dt(_this77,"syncTimestamp");_this77.workOptions=t.toolsOpt,_this77.syncTimestamp=0,_this77.syncUnitTime=50;return _this77;}_inherits(Ih,_$t6);return _createClass(Ih,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=r.syncUnitTime;u&&(this.syncUnitTime=u);var y=m==null?void 0:m.length;if(!y||y<2)return{type:xt.None};var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],T=!1):T=this.updateTempPoints(m),!T)return{type:xt.None};var E;if(s||c||f){var C=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:h,layer:C,isDrawing:!0});var x=C.parent.parent,_I38={x:0,y:0,w:Math.floor(x.width),h:Math.floor(x.height)},_d34=_objectSpread({type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(Zi(E,_I38)!==Tr.outside){var p=Zt(E,this.oldRect);if(this.oldRect=E,_d34.rect=p,!f)return _d34;}if(f){var _p14=Date.now();return _p14-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_p14,_d34.op=this.tmpPoints.map(function(S){return[].concat(_toConsumableArray(S.XY),[0]);}).flat(1),_d34.index=0,_d34.isSync=!0),_d34;}return{type:xt.None};}if(!s&&!c&&!f&&l){var _C4=Date.now();return _C4-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_C4,_objectSpread(_objectSpread({type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult),{},{op:this.tmpPoints.map(function(x){return[].concat(_toConsumableArray(x.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:xt.None};}return{type:xt.None};}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local},this.baseConsumeResult),{},{ops:c,isSync:!0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawing,c=t.isDrawEraserlines,_this$workOptions8=this.workOptions,l=_this$workOptions8.strokeColor,f=_this$workOptions8.fillColor,h=_this$workOptions8.thickness,m=_this$workOptions8.zIndex,u=_this$workOptions8.scale,y=_this$workOptions8.rotate,T=_this$workOptions8.translate,E=_this$workOptions8.strokeType,C=_this$workOptions8.eraserlines,x=_this$workOptions8.lineDash,I=_this$workOptions8.lineCap,d=n.worldScaling,_this$computDrawPoint4=this.computDrawPoints(h),v=_this$computDrawPoint4.radius,p=_this$computDrawPoint4.rect,S=_this$computDrawPoint4.pos,A={closeType:"normal",radius:v,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:I,lineDash:E===we.Dotted?[x&&x[0]||1,(x&&x[1]||2)*h]:E===we.LongDotted?[(x&&x[0]||1)*h,(x&&x[1]||2)*h]:void 0},R={name:r,id:r,zIndex:m,pos:S,anchor:[0.5,0.5],size:[p.w,p.h]};u&&(R.scale=u),y&&(R.rotate=y),T&&(R.translate=T);var D=new mr(R);if(s){var W=new Mn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/d[0],1/d[1]]});D.append(W);}var U=new qy(_objectSpread(_objectSpread({},A),{},{pos:[0,0]}));D.append(U),C&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:D,eraserlines:C,pos:S,layer:n},c)),this.replace(n,r,D);var M=D.getBoundingClientRect();return this.isDelete&&D.setAttribute("opacity",0),{x:Math.floor(M.x-$t.SafeBorderPadding),y:Math.floor(M.y-$t.SafeBorderPadding),w:Math.floor(M.width+$t.SafeBorderPadding*2),h:Math.floor(M.height+$t.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t){var r=Re(this.tmpPoints),n=Re(this.tmpPoints,t),s=[Math.floor(r.x+r.w/2),Math.floor(r.y+r.h/2)];return{rect:n,pos:s,radius:[Math.floor(r.w/2),Math.floor(r.h/2)]};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState3=t.workState,s=_t$workState3===void 0?te.Done:_t$workState3,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var u,y,T;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.strokeType,h=s.get(r.name);var m=r;return r.tagName==="GROUP"&&(m=r.children[0]),c&&(m.setAttribute("strokeColor",c),(u=h==null?void 0:h.opt)!=null&&u.strokeColor&&(h.opt.strokeColor=c)),l&&(l==="transparent"?m.setAttribute("fillColor","rgba(0,0,0,0)"):m.setAttribute("fillColor",l),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=l)),f&&h!=null&&h.opt&&(T=h.opt)!=null&&T.strokeType&&(h.opt.strokeType=f),h&&s.setInfo(r.name,h),$t.updateNodeOpt(t);}}]);}($t);var Oh=/*#__PURE__*/function(_$t7){function Oh(t){var _this78;_classCallCheck(this,Oh);_this78=_callSuper(this,Oh,[t]);dt(_this78,"canRotate",!0);dt(_this78,"scaleType",Ae.all);dt(_this78,"toolsType",Tt.Rectangle);dt(_this78,"tmpPoints",[]);dt(_this78,"workOptions");dt(_this78,"oldRect");dt(_this78,"syncTimestamp");_this78.workOptions=t.toolsOpt,_this78.syncTimestamp=0,_this78.syncUnitTime=50;return _this78;}_inherits(Oh,_$t7);return _createClass(Oh,[{key:"transformData",value:function transformData(){var t=Re(this.tmpPoints);return[[t.x,t.y,0],[t.x+t.w,t.y,0],[t.x+t.w,t.y+t.h,0],[t.x,t.y+t.h,0]];}},{key:"computDrawPoints",value:function computDrawPoints(t){var r=this.workOptions.thickness,n=[];var _iterator30=_createForOfIteratorHelper(t),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var l=_step30.value;n.push(_construct(pt,_toConsumableArray(l)));}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}var s=Re(n,r),c=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:c,points:n.map(function(l){return l.XY;}).flat(1)};}},{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=m==null?void 0:m.length;if(!u||u<2)return{type:xt.None};var y;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],y=!1):y=this.updateTempPoints(m),!y)return{type:xt.None};var T=this.transformData();var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({ps:T,workId:h,layer:x,isDrawing:!0});}if(f){var _x40=Zt(E,this.oldRect);this.oldRect=E;var _I39=_objectSpread({rect:_x40,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d35=Date.now();_d35-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d35,_I39.op=T.flat(1),_I39.index=0,_I39.isSync=!0);}return _I39;}if(!s&&l){var _x41=Date.now();return _x41-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x41,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:T.flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread({rect:C,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var f;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.transformData(),n=this.fullLayer,s=this.draw({ps:r,workId:t,layer:n,isDrawing:!1});this.oldRect=s;var c=r.flat(1),l=gr(c);return(f=this.vNodes)==null||f.setInfo(t,{rect:s,op:c,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&$t.getCenterPos(s,n)}),_objectSpread(_objectSpread({rect:s,type:xt.FullWork,dataType:Vt.Local,ops:l,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawing,c=t.ps,l=t.replaceId,_t$isDrawEraserlines2=t.isDrawEraserlines,f=_t$isDrawEraserlines2===void 0?!0:_t$isDrawEraserlines2,_this$workOptions9=this.workOptions,h=_this$workOptions9.strokeColor,m=_this$workOptions9.fillColor,u=_this$workOptions9.thickness,y=_this$workOptions9.zIndex,T=_this$workOptions9.scale,E=_this$workOptions9.rotate,C=_this$workOptions9.translate,x=_this$workOptions9.strokeType,I=_this$workOptions9.eraserlines,d=_this$workOptions9.lineCap,v=_this$workOptions9.lineDash,p=n.worldPosition,S=n.worldScaling,_this$computDrawPoint5=this.computDrawPoints(c),A=_this$computDrawPoint5.points,R=_this$computDrawPoint5.rect,D=_this$computDrawPoint5.pos,U={close:!0,normalize:!0,points:A,lineWidth:u,fillColor:m!=="transparent"&&m||void 0,strokeColor:h,lineCap:d,lineDash:x===we.Dotted?[v&&v[0]||1,(v&&v[1]||2)*u]:x===we.LongDotted?[(v&&v[0]||1)*u,(v&&v[1]||2)*u]:void 0};var M={x:Math.floor(R.x*S[0]+p[0]-$t.SafeBorderPadding),y:Math.floor(R.y*S[1]+p[1]-$t.SafeBorderPadding),w:Math.floor(R.w*S[0]+2*$t.SafeBorderPadding),h:Math.floor(R.h*S[0]+2*$t.SafeBorderPadding)};var W=new mr({name:r,id:r,zIndex:y,pos:D,anchor:[0.5,0.5],size:[R.w,R.h],scale:T,rotate:E,translate:C}),Y=new dn(_objectSpread(_objectSpread({},U),{},{pos:[0,0]}));if(W.appendChild(Y),s){var B=new Mn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:h,lineWidth:1,scale:[1/S[0],1/S[1]]});W.appendChild(B);}if(I&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:W,eraserlines:I,pos:D,layer:n},f)),this.replace(n,l||r,W),T||E||C){var _B4=W.getBoundingClientRect();M={x:Math.floor(_B4.x-$t.SafeBorderPadding),y:Math.floor(_B4.y-$t.SafeBorderPadding),w:Math.floor(_B4.width+2*$t.SafeBorderPadding),h:Math.floor(_B4.height+2*$t.SafeBorderPadding)};}return this.isDelete&&W.setAttribute("opacity",0),M;}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var u,y;var r=t.op,n=t.isFullWork,s=t.replaceId,_t$workState4=t.workState,c=_t$workState4===void 0?te.Done:_t$workState4,l=(u=this.workId)==null?void 0:u.toString();if(!l)return;var f=[];for(var T=0;T<r.length;T+=3)f.push([r[T],r[T+1],r[T+2]]);var h=n?this.fullLayer:this.drawLayer||this.fullLayer,m=this.draw({ps:f,workId:l,layer:h,isDrawing:!1,replaceId:s,isDrawEraserlines:c===te.Done});return this.oldRect=m,(y=this.vNodes)==null||y.setInfo(l,{rect:m,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:m&&$t.getCenterPos(m,h)}),m;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var u,y,T;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.strokeType,h=s.get(r.name);var m=r;return r.tagName==="GROUP"&&(m=r.children[0]),c&&(m.setAttribute("strokeColor",c),(u=h==null?void 0:h.opt)!=null&&u.strokeColor&&(h.opt.strokeColor=c)),l&&(l==="transparent"?m.setAttribute("fillColor","rgba(0,0,0,0)"):m.setAttribute("fillColor",l),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=l)),f&&h!=null&&h.opt&&(T=h.opt)!=null&&T.strokeType&&(h.opt.strokeType=f),h&&s.setInfo(r.name,h),$t.updateNodeOpt(t);}}]);}($t);var wh=/*#__PURE__*/function(_$t8){function wh(t){var _this79;_classCallCheck(this,wh);_this79=_callSuper(this,wh,[t]);dt(_this79,"canRotate",!1);dt(_this79,"scaleType",Ae.all);dt(_this79,"toolsType",Tt.Star);dt(_this79,"tmpPoints",[]);dt(_this79,"workOptions");dt(_this79,"oldRect");dt(_this79,"syncTimestamp");_this79.workOptions=t.toolsOpt,_this79.syncTimestamp=0,_this79.syncUnitTime=50;return _this79;}_inherits(wh,_$t8);return _createClass(wh,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=r.syncUnitTime,y=m==null?void 0:m.length;if(!y||y<2)return{type:xt.None};u&&(this.syncUnitTime=u);var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],T=!1):T=this.updateTempPoints(m),!T)return{type:xt.None};var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:h,layer:x,isDrawing:!0});}if(f){var _x42=Zt(E,this.oldRect);this.oldRect=E;var _I40=_objectSpread({rect:_x42,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d36=Date.now();_d36-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d36,_I40.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I40.index=0,_I40.isSync=!0);}return _I40;}if(!s&&l){var _x43=Date.now();return _x43-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x43,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread({rect:C,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawing,_t$isDrawEraserlines3=t.isDrawEraserlines,c=_t$isDrawEraserlines3===void 0?!0:_t$isDrawEraserlines3,_this$workOptions10=this.workOptions,l=_this$workOptions10.strokeColor,f=_this$workOptions10.fillColor,h=_this$workOptions10.thickness,m=_this$workOptions10.zIndex,u=_this$workOptions10.vertices,y=_this$workOptions10.innerVerticeStep,T=_this$workOptions10.innerRatio,E=_this$workOptions10.scale,C=_this$workOptions10.rotate,x=_this$workOptions10.translate,I=_this$workOptions10.strokeType,d=_this$workOptions10.eraserlines,v=_this$workOptions10.lineDash,p=_this$workOptions10.lineCap,S=n.worldScaling,_this$computDrawPoint6=this.computDrawPoints(h,u,y,T),A=_this$computDrawPoint6.rect,R=_this$computDrawPoint6.pos,D=_this$computDrawPoint6.points,U={close:!0,points:D,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:p,lineDash:I===we.Dotted?[v&&v[0]||1,(v&&v[1]||2)*h]:I===we.LongDotted?[(v&&v[0]||1)*h,(v&&v[1]||2)*h]:void 0},M={name:r,id:r,zIndex:m,pos:R,anchor:[0.5,0.5],size:[A.w,A.h]};E&&(M.scale=E),C&&(M.rotate=C),x&&(M.translate=x);var W=new mr(M);if(s){var N=new Mn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/S[0],1/S[1]]});W.append(N);}var Y=new dn(_objectSpread(_objectSpread({},U),{},{pos:[0,0]}));W.append(Y),d&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:W,eraserlines:d,pos:R,layer:n},c)),this.replace(n,r,W);var B=W.getBoundingClientRect();return this.isDelete&&W.setAttribute("opacity",0),{x:Math.floor(B.x-$t.SafeBorderPadding),y:Math.floor(B.y-$t.SafeBorderPadding),w:Math.floor(B.width+$t.SafeBorderPadding*2),h:Math.floor(B.height+$t.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t,r,n,s){var c=Re(this.tmpPoints),l=[Math.floor(c.x+c.w/2),Math.floor(c.y+c.h/2)],f=Vh(c.w,c.h),h=Math.floor(Math.min(c.w,c.h)/2),m=s*h,u=[],y=2*Math.PI/r;for(var E=0;E<r;E++){var C=E*y-0.5*Math.PI;var x=void 0,_I41=void 0;E%n===1?(x=m*f[0]*Math.cos(C),_I41=m*f[1]*Math.sin(C)):(x=h*f[0]*Math.cos(C),_I41=h*f[1]*Math.sin(C),u.push(x,_I41)),u.push(x,_I41);}return{rect:Re(this.tmpPoints,t),pos:l,points:u};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState5=t.workState,s=_t$workState5===void 0?te.Done:_t$workState5,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var x;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.toolsType,h=n.vertices,m=n.innerVerticeStep,u=n.innerRatio,y=n.strokeType,T=s.get(r.name),E=T==null?void 0:T.opt;var C=r;return r.tagName==="GROUP"&&(C=r.children[0]),c&&(C.setAttribute("strokeColor",c),E!=null&&E.strokeColor&&(E.strokeColor=c)),l&&(l==="transparent"?C.setAttribute("fillColor","rgba(0,0,0,0)"):C.setAttribute("fillColor",l),E!=null&&E.fillColor&&(E.fillColor=l)),f===Tt.Star&&(h&&(E.vertices=h),m&&(E.innerVerticeStep=m),u&&(E.innerRatio=u)),y&&T!=null&&T.opt&&(x=T.opt)!=null&&x.strokeType&&(T.opt.strokeType=y),T&&s.setInfo(r.name,_objectSpread(_objectSpread({},T),{},{opt:E})),$t.updateNodeOpt(t);}}]);}($t);var Ah=/*#__PURE__*/function(_$t9){function Ah(t){var _this80;_classCallCheck(this,Ah);_this80=_callSuper(this,Ah,[t]);dt(_this80,"canRotate",!1);dt(_this80,"scaleType",Ae.all);dt(_this80,"toolsType",Tt.Polygon);dt(_this80,"tmpPoints",[]);dt(_this80,"workOptions");dt(_this80,"oldRect");dt(_this80,"syncTimestamp");_this80.workOptions=t.toolsOpt,_this80.syncTimestamp=0,_this80.syncUnitTime=50;return _this80;}_inherits(Ah,_$t9);return _createClass(Ah,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=r.op,m=r.syncUnitTime;m&&(this.syncUnitTime=m);var u=this.workId,y=h==null?void 0:h.length;if(!y||y<2)return{type:xt.None};var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(h[0],h[1])],T=!1):T=this.updateTempPoints(h),!T)return{type:xt.None};var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:u,layer:x,isDrawing:!0});}if(f){var _x44=Zt(E,this.oldRect);this.oldRect=E;var _I42=_objectSpread({type:xt.DrawWork,rect:_x44,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d37=Date.now();_d37-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d37,_I42.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I42.index=0,_I42.isSync=!0);}return _I42;}if(!s&&l){var _x45=Date.now();return _x45-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x45,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread({rect:C,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawing,_t$isDrawEraserlines4=t.isDrawEraserlines,c=_t$isDrawEraserlines4===void 0?!0:_t$isDrawEraserlines4,_this$workOptions11=this.workOptions,l=_this$workOptions11.strokeColor,f=_this$workOptions11.fillColor,h=_this$workOptions11.thickness,m=_this$workOptions11.zIndex,u=_this$workOptions11.vertices,y=_this$workOptions11.scale,T=_this$workOptions11.rotate,E=_this$workOptions11.translate,C=_this$workOptions11.strokeType,x=_this$workOptions11.eraserlines,I=_this$workOptions11.lineCap,d=_this$workOptions11.lineDash,v=n.worldScaling,_this$computDrawPoint7=this.computDrawPoints(h,u),p=_this$computDrawPoint7.rect,S=_this$computDrawPoint7.pos,A=_this$computDrawPoint7.points,R={close:!0,points:A,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:I,lineDash:C===we.Dotted?[d&&d[0]||1,(d&&d[1]||2)*h]:C===we.LongDotted?[(d&&d[0]||1)*h,(d&&d[1]||2)*h]:void 0},D={name:r,id:r,zIndex:m,pos:S,anchor:[0.5,0.5],size:[p.w,p.h]};y&&(D.scale=y),T&&(D.rotate=T),E&&(D.translate=E);var U=new mr(D);if(s){var Y=new Mn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/v[0],1/v[1]]});U.append(Y);}var M=new dn(_objectSpread(_objectSpread({},R),{},{pos:[0,0]}));U.append(M),x&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:U,eraserlines:x,pos:S,layer:n},c)),this.replace(n,r,U);var W=U.getBoundingClientRect();return this.isDelete&&U.setAttribute("opacity",0),{x:Math.floor(W.x-$t.SafeBorderPadding),y:Math.floor(W.y-$t.SafeBorderPadding),w:Math.floor(W.width+$t.SafeBorderPadding*2),h:Math.floor(W.height+$t.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t,r){var n=Re(this.tmpPoints),s=[Math.floor(n.x+n.w/2),Math.floor(n.y+n.h/2)],c=Vh(n.w,n.h),l=Math.floor(Math.min(n.w,n.h)/2),f=[],h=2*Math.PI/r;for(var u=0;u<r;u++){var y=u*h-0.5*Math.PI,T=l*c[0]*Math.cos(y),E=l*c[1]*Math.sin(y);f.push(T,E);}return{rect:Re(this.tmpPoints,t),pos:s,points:f};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState6=t.workState,s=_t$workState6===void 0?te.Done:_t$workState6,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var E;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.toolsType,h=n.vertices,m=n.strokeType,u=s.get(r.name),y=u==null?void 0:u.opt;var T=r;return r.tagName==="GROUP"&&(T=r.children[0]),c&&(T.setAttribute("strokeColor",c),y!=null&&y.strokeColor&&(y.strokeColor=c)),l&&(l==="transparent"?T.setAttribute("fillColor","rgba(0,0,0,0)"):T.setAttribute("fillColor",l),y!=null&&y.fillColor&&(y.fillColor=l)),f===Tt.Polygon&&h&&(y.vertices=h),m&&u!=null&&u.opt&&(E=u.opt)!=null&&E.strokeType&&(u.opt.strokeType=m),u&&s.setInfo(r.name,_objectSpread(_objectSpread({},u),{},{opt:y})),$t.updateNodeOpt(t);}}]);}($t);var Hr=/*#__PURE__*/function(){function Hr(){_classCallCheck(this,Hr);}return _createClass(Hr,null,[{key:"bezier",value:function bezier(e,t){var r=[];for(var n=0;n<t.length;n+=4){var s=t[n],c=t[n+1],l=t[n+2],f=t[n+3];s&&c&&l&&f?r.push.apply(r,_toConsumableArray(Hr.getBezierPoints(e,s,c,l,f))):s&&c&&l?r.push.apply(r,_toConsumableArray(Hr.getBezierPoints(e,s,c,l))):s&&c?r.push.apply(r,_toConsumableArray(Hr.getBezierPoints(e,s,c))):s&&r.push(s);}return r;}/**
|
|
407
|
+
null;}function hi(i,e){var t=0;return i[0]<e[0]?t|=1:i[0]>e[2]&&(t|=2),i[1]<e[1]?t|=4:i[1]>e[3]&&(t|=8),t;}var Il=/* @__PURE__ */Ln(V2);var vi=/*#__PURE__*/function(_$t3){function vi(t,r){var _this68;_classCallCheck(this,vi);_this68=_callSuper(this,vi,[t]);dt(_this68,"canRotate",!1);dt(_this68,"scaleType",Ae.none);dt(_this68,"toolsType",Tt.Eraser);dt(_this68,"serviceWork");dt(_this68,"tmpPoints",[]);dt(_this68,"workOptions");dt(_this68,"worldPosition");dt(_this68,"worldScaling");dt(_this68,"eraserRect");dt(_this68,"eraserPolyline");_this68.serviceWork=r,_this68.workOptions=t.toolsOpt,_this68.worldPosition=_this68.fullLayer.worldPosition,_this68.worldScaling=_this68.fullLayer.worldScaling;return _this68;}_inherits(vi,_$t3);return _createClass(vi,[{key:"combineConsume",value:function combineConsume(){}},{key:"consumeService",value:function consumeService(){}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(vi,"setWorkOptions",this,3)([t]);}},{key:"createEraserRect",value:function createEraserRect(t){var r=t[0]*this.worldScaling[0]+this.worldPosition[0],n=t[1]*this.worldScaling[1]+this.worldPosition[1],_vi$eraserSizes$this$=vi.eraserSizes[this.workOptions.thickness],s=_vi$eraserSizes$this$.width,c=_vi$eraserSizes$this$.height;this.eraserRect={x:r-s*0.5,y:n-c*0.5,w:s,h:c},this.eraserPolyline=[this.eraserRect.x,this.eraserRect.y,this.eraserRect.x+this.eraserRect.w,this.eraserRect.y+this.eraserRect.h];}},{key:"computRectCenterPoints",value:function computRectCenterPoints(){var t=this.tmpPoints.slice(-2);if(this.tmpPoints.length===4){var r=new pt(this.tmpPoints[0],this.tmpPoints[1]),n=new pt(this.tmpPoints[2],this.tmpPoints[3]),s=pt.Sub(n,r).uni(),c=pt.Dist(r,n),_vi$eraserSizes$this$2=vi.eraserSizes[this.workOptions.thickness],l=_vi$eraserSizes$this$2.width,f=_vi$eraserSizes$this$2.height,h=Math.min(l,f),m=Math.round(c/h);if(m>1){var u=[];for(var y=0;y<m;y++){var T=pt.Mul(s,y*h);u.push(this.tmpPoints[0]+T.x,this.tmpPoints[1]+T.y);}return u.concat(t);}}return t;}},{key:"isNear",value:function isNear(t,r){var n=new pt(t[0],t[1]),s=new pt(r[0],r[1]),_vi$eraserSizes$this$3=vi.eraserSizes[this.workOptions.thickness],c=_vi$eraserSizes$this$3.width,l=_vi$eraserSizes$this$3.height;return pt.Dist(n,s)<Math.hypot(c,l)*0.5;}},{key:"remove",value:function remove(t){var _this69=this;var r=t.curNodeMap,n=t.removeIds;var s;var _iterator19=_createForOfIteratorHelper(r.values()),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var c=_step19.value;if(c.rect&&this.eraserRect&&this.eraserPolyline&&fl(this.eraserRect,c.rect)){var l=c.op,f=[],h=[];for(var u=0;u<l.length;u+=3){var y=new pt(l[u]*this.worldScaling[0]+this.worldPosition[0],l[u+1]*this.worldScaling[1]+this.worldPosition[1],l[u+2]);h.push(y),f.push(new Jt(y.x,y.y));}var m=f.length&&Re(f)||c.rect;fl(m,this.eraserRect)&&(h.length>1?Il.polyline(h.map(function(y){return y.XY;}),this.eraserPolyline).length&&n.add(c.name):n.add(c.name),s=Zt(s,c.rect||m));}}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}return n.forEach(function(c){var f;var l=_this69.fullLayer.getElementsByName(c);l[0]&&(l[0].remove(),_pr(l[0],_this69.fullLayer.parent),(f=_this69.vNodes)==null||f["delete"](c));}),s&&(s.x-=$t.SafeBorderPadding,s.y-=$t.SafeBorderPadding,s.w+=$t.SafeBorderPadding*2,s.h+=$t.SafeBorderPadding*2),s;}},{key:"consume",value:function consume(t){var _t$data2=t.data,r=_t$data2.op,n=_t$data2.disableEraseImage,s=_t$data2.disableEraseText;if(!r||r.length===0)return _objectSpread({type:xt.None},this.baseConsumeResult);var c=this.tmpPoints.length;if(c>1&&this.isNear([r[0],r[1]],[this.tmpPoints[c-2],this.tmpPoints[c-1]]))return _objectSpread({type:xt.None},this.baseConsumeResult);c<3?this.tmpPoints.push(r[0],r[1]):this.tmpPoints.splice(2,2,r[0],r[1]);var l=this.computRectCenterPoints();var f;var h=/* @__PURE__ */new Set();if(!this.vNodes)return _objectSpread({type:xt.None},this.baseConsumeResult);var m=this.getCanEraserNodeMap(this.vNodes.getCanEraserNodes(this.vNodes.curNodeMap,{disableEraseImage:n,disableEraseText:s}));for(var u=0;u<l.length-1;u+=2){this.createEraserRect(l.slice(u,u+2));var y=this.remove({curNodeMap:m,removeIds:h});f=Zt(f,y);}return f&&h.size?{type:xt.RemoveNode,rect:f,removeIds:_toConsumableArray(h)}:_objectSpread({type:xt.None},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(t){return this.consume(t);}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}},{key:"getCanEraserNodeMap",value:function getCanEraserNodeMap(t){var r;if(this.serviceWork){var n=new Map(t),s=this.serviceWork.selectorWorkShapes,c=this.serviceWork.workShapes;var _iterator20=_createForOfIteratorHelper(s.values()),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var l=_step20.value;if((r=l.selectIds)!=null&&r.length){var _iterator22=_createForOfIteratorHelper(l.selectIds),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var f=_step22.value;n["delete"](f);}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}}}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}var _iterator21=_createForOfIteratorHelper(c.keys()),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _l4=_step21.value;n["delete"](_l4);}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}return n;}return t;}}]);}($t);// 来源于white-sdk
|
|
408
|
+
dt(vi,"eraserSizes",Tl);var io=vi;var J2="__lodash_hash_undefined__";function Q2(i){return this.__data__.set(i,J2),this;}var q2=Q2;function _2(i){return this.__data__.has(i);}var tw=_2,ew=Hu,rw=q2,nw=tw;function so(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new ew();++e<t;)this.add(i[e]);}so.prototype.add=so.prototype.push=rw;so.prototype.has=nw;var Ol=so;function iw(i,e){for(var t=-1,r=i==null?0:i.length;++t<r;)if(e(i[t],t,i))return!0;return!1;}var sw=iw;function ow(i,e){return i.has(e);}var wl=ow,aw=Ol,lw=sw,fw=wl,cw=1,uw=2;function hw(i,e,t,r,n,s){var c=t&cw,l=i.length,f=e.length;if(l!=f&&!(c&&f>l))return!1;var h=s.get(i),m=s.get(e);if(h&&m)return h==e&&m==i;var u=-1,y=!0,T=t&uw?new aw():void 0;for(s.set(i,e),s.set(e,i);++u<l;){var E=i[u],C=e[u];if(r)var x=c?r(C,E,u,e,i,s):r(E,C,u,i,e,s);if(x!==void 0){if(x)continue;y=!1;break;}if(T){if(!lw(e,function(I,d){if(!fw(T,d)&&(E===I||n(E,I,t,r,s)))return T.push(d);})){y=!1;break;}}else if(!(E===C||n(E,C,t,r,s))){y=!1;break;}}return s["delete"](i),s["delete"](e),y;}var xh=hw;function dw(i){var e=-1,t=Array(i.size);return i.forEach(function(r,n){t[++e]=[n,r];}),t;}var pw=dw;function vw(i){var e=-1,t=Array(i.size);return i.forEach(function(r){t[++e]=r;}),t;}var Al=vw,pu=Ji,vu=ch,gw=ul,mw=xh,yw=pw,Pw=Al,Sw=1,xw=2,Tw="[object Boolean]",Cw="[object Date]",Iw="[object Error]",Ow="[object Map]",ww="[object Number]",Aw="[object RegExp]",Ew="[object Set]",Mw="[object String]",Lw="[object Symbol]",Rw="[object ArrayBuffer]",bw="[object DataView]",gu=pu?pu.prototype:void 0,qa=gu?gu.valueOf:void 0;function Dw(i,e,t,r,n,s,c){switch(t){case bw:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case Rw:return!(i.byteLength!=e.byteLength||!s(new vu(i),new vu(e)));case Tw:case Cw:case ww:return gw(+i,+e);case Iw:return i.name==e.name&&i.message==e.message;case Aw:case Mw:return i==e+"";case Ow:var l=yw;case Ew:var f=r&Sw;if(l||(l=Pw),i.size!=e.size&&!f)return!1;var h=c.get(i);if(h)return h==e;r|=xw,c.set(i,e);var m=mw(l(i),l(e),r,n,s,c);return c["delete"](i),m;case Lw:if(qa)return qa.call(i)==qa.call(e);}return!1;}var Nw=Dw,mu=ah,Bw=1,Ww=Object.prototype,Fw=Ww.hasOwnProperty;function Uw(i,e,t,r,n,s){var c=t&Bw,l=mu(i),f=l.length,h=mu(e),m=h.length;if(f!=m&&!c)return!1;for(var u=f;u--;){var y=l[u];if(!(c?y in e:Fw.call(e,y)))return!1;}var T=s.get(i),E=s.get(e);if(T&&E)return T==e&&E==i;var C=!0;s.set(i,e),s.set(e,i);for(var x=c;++u<f;){y=l[u];var I=i[y],d=e[y];if(r)var v=c?r(d,I,y,e,i,s):r(I,d,y,i,e,s);if(!(v===void 0?I===d||n(I,d,t,r,s):v)){C=!1;break;}x||(x=y=="constructor");}if(C&&!x){var p=i.constructor,S=e.constructor;p!=S&&"constructor"in i&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof S=="function"&&S instanceof S)&&(C=!1);}return s["delete"](i),s["delete"](e),C;}var Yw=Uw,_a=ku,Xw=xh,zw=Nw,$w=Yw,yu=So,Pu=qi,Su=dl,jw=_u,Gw=1,xu="[object Arguments]",Tu="[object Array]",Ks="[object Object]",Hw=Object.prototype,Cu=Hw.hasOwnProperty;function kw(i,e,t,r,n,s){var c=Pu(i),l=Pu(e),f=c?Tu:yu(i),h=l?Tu:yu(e);f=f==xu?Ks:f,h=h==xu?Ks:h;var m=f==Ks,u=h==Ks,y=f==h;if(y&&Su(i)){if(!Su(e))return!1;c=!0,m=!1;}if(y&&!m)return s||(s=new _a()),c||jw(i)?Xw(i,e,t,r,n,s):zw(i,e,f,t,r,n,s);if(!(t&Gw)){var T=m&&Cu.call(i,"__wrapped__"),E=u&&Cu.call(e,"__wrapped__");if(T||E){var C=T?i.value():i,x=E?e.value():e;return s||(s=new _a()),n(C,x,t,r,s);}}return y?(s||(s=new _a()),$w(i,e,t,r,n,s)):!1;}var Kw=kw,Vw=Kw,Iu=pn;function Th(i,e,t,r,n){return i===e?!0:i==null||e==null||!Iu(i)&&!Iu(e)?i!==i&&e!==e:Vw(i,e,t,r,Th,n);}var Zw=Th,Jw=Zw;function Qw(i,e){return Jw(i,e);}var qw=Qw,qr=/* @__PURE__ */Ln(qw);function Ou(i,e,t){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;return"rgba(".concat(i,",").concat(e,",").concat(t,",").concat(r,")");}function _w(i){var e=i.split(","),t=parseInt(e[0].split("(")[1]),r=parseInt(e[1]),n=parseInt(e[2]),s=Number(e[3].split(")")[0]);return[t,r,n,s];}var ho=/*#__PURE__*/function(_$t4){function ho(t){var _this70;_classCallCheck(this,ho);_this70=_callSuper(this,ho,[t]);dt(_this70,"toolsType",Tt.Selector);dt(_this70,"tmpPoints",[]);dt(_this70,"subTmpPoints",[]);dt(_this70,"workOptions");dt(_this70,"vNodes");dt(_this70,"selectIds");dt(_this70,"selectorColor");dt(_this70,"strokeColor");dt(_this70,"fillColor");dt(_this70,"oldSelectRect");dt(_this70,"oldSubSelectRect");dt(_this70,"canRotate",!1);dt(_this70,"canTextEdit",!1);dt(_this70,"canLock",!1);dt(_this70,"scaleType",Ae.all);dt(_this70,"toolsTypes");dt(_this70,"shapeOpt");dt(_this70,"textOpt");dt(_this70,"isLocked");dt(_this70,"thickness");dt(_this70,"strokeType");dt(_this70,"useStroke");_this70.workOptions=t.toolsOpt,_this70.vNodes=t.vNodes;return _this70;}_inherits(ho,_$t4);return _createClass(ho,[{key:"computSelector",value:function computSelector(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var r=Re(this.tmpPoints);if(r.w===0||r.h===0)return{selectIds:[],intersectRect:void 0,subNodeMap:/* @__PURE__ */new Map()};var _this$vNodes$getRectI=this.vNodes.getRectIntersectRange(r,t),n=_this$vNodes$getRectI.rectRange,s=_this$vNodes$getRectI.nodeRange;return{selectIds:_toConsumableArray(s.keys()),intersectRect:n,subNodeMap:s};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=this.tmpPoints.length,n=t.length;if(n>1){var s=new Jt(t[n-2]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[n-1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]);r===2?this.tmpPoints.splice(1,1,s):this.tmpPoints.push(s);}}},{key:"drawSelector",value:function drawSelector(t){var _this71=this;var r=t.drawRect,n=t.subNodeMap,s=t.selectorId,c=t.layer,l=t.isService,f=new mr({pos:[r.x,r.y],anchor:[0,0],size:[r.w,r.h],id:s,name:s,zIndex:9999}),h=[];if(l){var m=new zc({normalize:!0,pos:[r.w/2,r.h/2],lineWidth:1,strokeColor:this.selectorColor||this.workOptions.strokeColor,width:r.w,height:r.h,name:ho.selectorBorderId});h.push(m);}n.forEach(function(m,u){var y=[m.rect.x+m.rect.w/2-r.x,m.rect.y+m.rect.h/2-r.y],T=new zc({normalize:!0,pos:y,lineWidth:1,strokeColor:n.size>1?_this71.selectorColor||_this71.workOptions.strokeColor:void 0,width:m.rect.w,height:m.rect.h,id:"selector-".concat(u),name:"selector-".concat(u)});h.push(T);}),h&&f.append.apply(f,h),(c==null?void 0:c.parent).appendChild(f);}},{key:"draw",value:function draw(t,r,n){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var f,h;var c=n.intersectRect,l=n.subNodeMap;(h=(f=r.parent)==null?void 0:f.getElementById(t))==null||h.remove(),c&&this.drawSelector({drawRect:c,subNodeMap:l,selectorId:t,layer:r,isService:s});}},{key:"getSelecteorInfo",value:function getSelecteorInfo(t){this.scaleType=Ae.all,this.canRotate=!1,this.textOpt=void 0,this.strokeColor=void 0,this.fillColor=void 0,this.canTextEdit=!1,this.canLock=!1,this.isLocked=!1,this.toolsTypes=void 0,this.shapeOpt=void 0,this.thickness=void 0,this.strokeType=void 0,this.useStroke=!1;var r=/* @__PURE__ */new Set();var n,s=!0;var _iterator23=_createForOfIteratorHelper(t.values()),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var c=_step23.value;var l=c.opt,f=c.canRotate,h=c.scaleType,m=c.toolsType;this.selectorColor=this.workOptions.strokeColor,l.strokeColor&&(this.strokeColor=l.strokeColor),l.fillColor&&(this.fillColor=l.fillColor),l.textOpt&&(this.textOpt=l.textOpt),l.thickness&&(this.thickness=l.thickness),m!==Tt.Pencil&&(s=!1),l.strokeType&&(this.strokeType=l.strokeType),m===Tt.SpeechBalloon&&(r.add(m),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.placement=l.placement),m===Tt.Polygon&&(r.add(m),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=l.vertices),m===Tt.Star&&(r.add(m),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=l.vertices,this.shapeOpt.innerRatio=l.innerRatio,this.shapeOpt.innerVerticeStep=l.innerVerticeStep),m===Tt.Text&&(this.textOpt=l),t.size===1&&(this.textOpt&&(this.canTextEdit=!0),this.canRotate=f,this.scaleType=h),m===Tt.Image&&(n=c),(h===Ae.proportional&&this.scaleType!==Ae.none||h===Ae.none)&&(this.scaleType=h);}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}s&&(this.useStroke=!0),r.size&&(this.toolsTypes=_toConsumableArray(r)),n&&(t.size===1?(this.canLock=!0,n.opt.locked&&(this.isLocked=!0,this.scaleType=Ae.none,this.canRotate=!1,this.textOpt=void 0,this.fillColor=void 0,this.selectorColor="rgb(177,177,177)",this.strokeColor=void 0,this.canTextEdit=!1,this.thickness=void 0,this.strokeType=void 0,this.useStroke=void 0)):t.size>1&&!n.opt.locked&&(this.canLock=!1,this.canRotate=!1));}},{key:"getChildrenPoints",value:function getChildrenPoints(){var t,r;if(this.scaleType===Ae.both&&((t=this.selectIds)==null?void 0:t.length)===1){var n=this.selectIds[0],s=(r=this.vNodes.get(n))==null?void 0:r.op;if(s){var c=[];for(var l=0;l<s.length;l+=3)c.push([s[l],s[l+1]]);return c;}}}},{key:"consume",value:function consume(t){if(t.isSubWorker)return this.subWorkerConsume(t);var r=_objectSpread({type:xt.Select,dataType:Vt.Local},this.baseConsumeResult);if(t.isSimpleWorker){var m=this.subWorkerConsume(t);r.subRect=m.rect;}var _t$data3=t.data,n=_t$data3.op,s=_t$data3.workState;var c=this.oldSelectRect;if(s===te.Start&&(c=this.unSelectedAllIds()),!(n!=null&&n.length)||!this.vNodes.curNodeMap.size)return t.isSimpleWorker?r:{type:xt.None};this.updateTempPoints(n);var l=this.computSelector();if(this.selectIds&&qr(this.selectIds,l.selectIds))return t.isSimpleWorker?r:{type:xt.None};this.selectIds=l.selectIds;var f=l.intersectRect;this.getSelecteorInfo(l.subNodeMap),this.draw(Me,this.fullLayer,l),this.oldSelectRect=f;var h=this.getChildrenPoints();return r=_objectSpread(_objectSpread({},r),{},{rect:Zt(f,c),selectIds:l.selectIds,selectRect:f,selectorColor:this.selectorColor,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:h,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType}),r;}},{key:"consumeAll",value:function consumeAll(){var r,n;var t=this.oldSelectRect;if(!((r=this.selectIds)!=null&&r.length)&&this.tmpPoints[0]&&this.selectSingleTool(this.tmpPoints[0].XY,Me,!1),(n=this.selectIds)!=null&&n.length&&(t=this.selectedByIds(this.selectIds)),t){var s=this.getChildrenPoints();return _objectSpread({type:xt.Select,dataType:Vt.Local,rect:this.oldSelectRect,selectIds:this.selectIds,selectorColor:this.selectorColor,selectRect:this.oldSelectRect,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:s,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},this.baseConsumeResult);}return{type:xt.None};}},{key:"consumeService",value:function consumeService(){}},{key:"updateTempPointsForSubWorker",value:function updateTempPointsForSubWorker(t){var r=t.slice(-2),n=new Jt(r[0],r[1]);if(this.subTmpPoints[0].isNear(n,1))return!1;if(this.subTmpPoints.length===2){if(n.isNear(this.subTmpPoints[1],1))return!1;this.subTmpPoints[1]=n;}else this.subTmpPoints.push(n);return!0;}},{key:"computDrawPoints",value:function computDrawPoints(t){var r=this.workOptions.thickness,n=[];var _iterator24=_createForOfIteratorHelper(t),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var l=_step24.value;n.push(_construct(pt,_toConsumableArray(l)));}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}var s=Re(n,r),c=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:c,points:n.map(function(l){return l.XY;}).flat(1)};}},{key:"drawForSubWorker",value:function drawForSubWorker(t){var r=t.workId,n=t.layer,s=t.ps,_this$workOptions6=this.workOptions,c=_this$workOptions6.strokeColor,l=_this$workOptions6.scale,f=_this$workOptions6.rotate,h=_this$workOptions6.translate,m=n.worldPosition,u=n.worldScaling,_this$computDrawPoint2=this.computDrawPoints(s),y=_this$computDrawPoint2.points,T=_this$computDrawPoint2.rect,E=_this$computDrawPoint2.pos,C=1/n.worldScaling[0],x=c&&_w(c)||[0,0,0,0],I={close:!0,normalize:!0,points:y,lineWidth:C,fillColor:Ou(x[0],x[1],x[2],0.1),strokeColor:Ou(x[0],x[1],x[2],1),lineJoin:"round",lineCap:"round"};var d={x:Math.floor(T.x*u[0]+m[0]-$t.SafeBorderPadding),y:Math.floor(T.y*u[1]+m[1]-$t.SafeBorderPadding),w:Math.floor(T.w*u[0]+2*$t.SafeBorderPadding),h:Math.floor(T.h*u[0]+2*$t.SafeBorderPadding)};var v=new mr({name:r,id:r,pos:E,anchor:[0.5,0.5],size:[T.w,T.h],scale:l,rotate:f,translate:h}),p=new dn(_objectSpread(_objectSpread({},I),{},{pos:[0,0]}));if(v.appendChild(p),this.replace(n,r,v),l||f||h){var S=v.getBoundingClientRect();d={x:Math.floor(S.x-$t.SafeBorderPadding),y:Math.floor(S.y-$t.SafeBorderPadding),w:Math.floor(S.width+2*$t.SafeBorderPadding),h:Math.floor(S.height+2*$t.SafeBorderPadding)};}return d;}},{key:"transformData",value:function transformData(t){var r=Re(t);return[[r.x,r.y,0],[r.x+r.w,r.y,0],[r.x+r.w,r.y+r.h,0],[r.x,r.y+r.h,0]];}},{key:"subWorkerConsume",value:function subWorkerConsume(t){var r=t.data,n=t.isFullWork,s=r.op,c=r.syncUnitTime;c&&(this.syncUnitTime=c);var l=s==null?void 0:s.length;if(!l||l<2)return{type:xt.None,rect:void 0};var f;if(this.subTmpPoints.length===0?(this.subTmpPoints=[new Jt(s[0],s[1])],f=!1):f=this.updateTempPointsForSubWorker(s),!f)return{type:xt.None,rect:void 0};var h=this.transformData(this.subTmpPoints),m=n?this.fullLayer:this.drawLayer||this.fullLayer,u=this.drawForSubWorker({ps:h,workId:this.workId,layer:m}),y=Zt(u,this.oldSubSelectRect);return this.oldSubSelectRect=u,_objectSpread({rect:y,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"subWorkerConsumeAll",value:function subWorkerConsumeAll(t){var r=t.isFullWork,n=r?this.fullLayer:this.drawLayer||this.fullLayer;return this.replace(n,this.workId),_objectSpread({rect:this.oldSelectRect,type:xt.FullWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"clearSubTmpPoints",value:function clearSubTmpPoints(){this.subTmpPoints.length=0;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.clearSubTmpPoints();}},{key:"clearSubSelectData",value:function clearSubSelectData(){this.oldSubSelectRect=void 0;}},{key:"clearSelectData",value:function clearSelectData(){this.selectIds=void 0,this.oldSelectRect=void 0,this.clearSubSelectData();}},{key:"selectSingleTool",value:function selectSingleTool(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Me;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;if(t.length===2){var s=t[0],c=t[1];var l;var _this$vNodes$getRectI2=this.vNodes.getRectIntersectRange({x:s,y:c,w:0,h:0},!1),f=_this$vNodes$getRectI2.nodeRange,h=_toConsumableArray(f.values()).sort(function(m,u){return(u.opt.zIndex||0)-(m.opt.zIndex||0);});var _iterator25=_createForOfIteratorHelper(h),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _m11=_step25.value;var _u5=this.fullLayer.getElementsByName(_m11.name);if(Hh(_u5).find(function(T){return T.isPointCollision(s,c);})){l=_m11;break;}}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}if(l){var m=l.name;if(!qr(this.oldSelectRect,l.rect)){var u=/* @__PURE__ */new Map([[m,l]]);this.getSelecteorInfo(u),this.draw(r,this.fullLayer,{intersectRect:l.rect,subNodeMap:u,selectIds:this.selectIds||[]},n);}this.selectIds=[m],this.oldSelectRect=l.rect;}}}},{key:"unSelectedAllIds",value:function unSelectedAllIds(){var t;var _iterator26=_createForOfIteratorHelper(this.vNodes.curNodeMap.entries()),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var _step26$value=_slicedToArray(_step26.value,2),r=_step26$value[0],n=_step26$value[1];n.isSelected&&(t=Zt(t,n.rect),this.vNodes.unSelected(r));}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}return t;}},{key:"unSelectedByIds",value:function unSelectedByIds(t){var r;var _iterator27=_createForOfIteratorHelper(t),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var n=_step27.value;var s=this.vNodes.get(n);s&&s.isSelected&&(r=Zt(r,s.rect),this.vNodes.unSelected(n));}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}return r;}},{key:"selectedByIds",value:function selectedByIds(t){var r;var _iterator28=_createForOfIteratorHelper(t),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var n=_step28.value;var s=this.vNodes.get(n);s&&(r=Zt(r,s.rect),this.vNodes.selected(n));}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}return r;}},{key:"getSelectorRect",value:function getSelectorRect(t,r){var l;var n;var s=(l=t.parent)==null?void 0:l.getElementById(r),c=s==null?void 0:s.getBoundingClientRect();return c&&(n=Zt(n,{x:Math.floor(c.x),y:Math.floor(c.y),w:Math.floor(c.width+1),h:Math.floor(c.height+1)})),n;}},{key:"isCanFillColor",value:function isCanFillColor(t){return t===Tt.Ellipse||t===Tt.Triangle||t===Tt.Rectangle||t===Tt.Polygon||t===Tt.Star||t===Tt.SpeechBalloon;}},{key:"updateSelector",value:function(){var _updateSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(t){var r,n,s,c,l,f,h,m,u,y,T,E,C,x,I,d,_iterator29,_step29,S,A,R,D,U,M,W,Y,B,N,G,v,_S13,_A9,_R4,p;return _regeneratorRuntime().wrap(function _callee22$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:r=t.updateSelectorOpt,n=t.selectIds,s=t.vNodes,c=t.willSerializeData,l=t.worker,f=t.offset,h=this.fullLayer;if(h){_context24.next=3;break;}return _context24.abrupt("return");case 3:u=/* @__PURE__ */new Map(),y=r.originPoint,T=r.workState,E=r.angle,C=r.translate,x=r.dir,I=r.scale;f&&(C?r.translate=[C[0]+f[0],C[1]+f[1]]:r.translate=f);if(!(y||C||er(E))){_context24.next=10;break;}if(!(T===te.Start&&n)){_context24.next=8;break;}return _context24.abrupt("return",(s.setTargetAssignKeys(n),{type:xt.Select,dataType:Vt.Local,selectRect:this.oldSelectRect,rect:this.oldSelectRect}));case 8:if(!(d=s.getLastTarget(),!d)){_context24.next=10;break;}return _context24.abrupt("return");case 10:if(!n){_context24.next=62;break;}_iterator29=_createForOfIteratorHelper(n);_context24.prev=12;_iterator29.s();case 14:if((_step29=_iterator29.n()).done){_context24.next=54;break;}S=_step29.value;A=s.get(S);if(!A){_context24.next=52;break;}R=A.toolsType,D=A.opt,U=(h==null?void 0:h.getElementsByName(S))[0];if(!U){_context24.next=52;break;}M=_objectSpread({},r);W=void 0;Y=$t.isWillRefresh({toolsType:R,opt:D,updateOpt:M,vNodes:s,node:U,willSerializeData:c});if(!R){_context24.next=52;break;}W=d==null?void 0:d.get(S);B=Gh(R);if(!(B==null||B.updateNodeOpt({node:U,opt:M,vNodes:s,willSerializeData:c,targetNode:W}),A&&l&&Y)){_context24.next=51;break;}N=l.createWorkShapeNode({workId:S,toolsType:R,toolsOpt:A.opt});N==null||N.setWorkId(S);G=void 0;if(!(R===Tt.Image)){_context24.next=36;break;}_context24.next=33;return N.consumeServiceAsync({isFullWork:!0,replaceId:S,worker:l});case 33:G=_context24.sent;_context24.next=50;break;case 36:if(!(R===Tt.Text)){_context24.next=42;break;}_context24.next=39;return N.consumeServiceAsync({isFullWork:!0,replaceId:S,isDrawLabel:!0});case 39:G=_context24.sent;_context24.next=50;break;case 42:_context24.prev=42;G=N==null?void 0:N.consumeService({op:A.op,isFullWork:!0,replaceId:S,workState:T});_context24.next=50;break;case 46:_context24.prev=46;_context24.t0=_context24["catch"](42);console.error("consumeService error",_context24.t0);return _context24.abrupt("continue",52);case 50:G&&(A.rect=G);case 51:A&&(u.set(S,A),m=Zt(m,A.rect));case 52:_context24.next=14;break;case 54:_context24.next=59;break;case 56:_context24.prev=56;_context24.t1=_context24["catch"](12);_iterator29.e(_context24.t1);case 59:_context24.prev=59;_iterator29.f();return _context24.finish(59);case 62:d&&T===te.Done&&(s.deleteLastTarget(),d=void 0);v=m;if(!(y&&C&&I&&x&&v&&!f)){_context24.next=82;break;}_S13=[[v.x,v.y],[v.x+v.w,v.y],[v.x+v.w,v.y+v.h],[v.x,v.y+v.h]];_context24.t2=x;_context24.next=_context24.t2==="top"?69:_context24.t2==="topLeft"?69:_context24.t2==="left"?69:_context24.t2==="topRight"?71:_context24.t2==="right"?73:_context24.t2==="bottomRight"?73:_context24.t2==="bottom"?73:_context24.t2==="bottomLeft"?75:77;break;case 69:C[0]>0&&C[1]>0?_A9=_S13[0]:C[0]>0?_A9=_S13[3]:C[1]>0?_A9=_S13[1]:_A9=_S13[2];return _context24.abrupt("break",77);case 71:C[0]<0&&C[1]>0?_A9=_S13[1]:C[0]<0?_A9=_S13[2]:C[1]>0?_A9=_S13[0]:_A9=_S13[3];return _context24.abrupt("break",77);case 73:C[0]<0&&C[1]<0?_A9=_S13[2]:C[0]<0?_A9=_S13[1]:C[1]<0?_A9=_S13[3]:_A9=_S13[0];return _context24.abrupt("break",77);case 75:C[0]>0&&C[1]<0?_A9=_S13[3]:C[0]>0?_A9=_S13[0]:C[1]<0?_A9=_S13[2]:_A9=_S13[1];return _context24.abrupt("break",77);case 77:_R4=_A9&&[y[0]-_A9[0],y[1]-_A9[1]]||[0,0];if(qr(_R4,[0,0])){_context24.next=82;break;}_context24.next=81;return this.updateSelector(_objectSpread(_objectSpread({},t),{},{updateSelectorOpt:{workState:T},offset:_R4}));case 81:return _context24.abrupt("return",_context24.sent);case 82:this.getSelecteorInfo(u),this.draw(Me,h,{selectIds:n||[],subNodeMap:u,intersectRect:v});p=Zt(this.oldSelectRect,v);return _context24.abrupt("return",(this.oldSelectRect=v,{type:xt.Select,dataType:Vt.Local,selectRect:v,renderRect:m,rect:Zt(p,v),selectIds:n}));case 85:case"end":return _context24.stop();}},_callee22,this,[[12,56,59,62],[42,46]]);}));function updateSelector(_x37){return _updateSelector.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function blurSelector(){var t=this.unSelectedAllIds();return{type:xt.Select,dataType:Vt.Local,rect:t,selectIds:[],willSyncService:!0};}},{key:"getRightServiceId",value:function getRightServiceId(t){return t.replace(yi,"-");}},{key:"selectServiceNode",value:function selectServiceNode(t,r,n){var _this72=this;var s=r.selectIds,c=this.getRightServiceId(t),l=this.getSelectorRect(this.fullLayer,c);var f;var h=/* @__PURE__ */new Map();return s==null||s.forEach(function(m){var u=_this72.vNodes.get(m);u&&(f=Zt(f,u.rect),h.set(m,u));}),this.getSelecteorInfo(h),this.draw(c,this.fullLayer,{intersectRect:f,selectIds:s||[],subNodeMap:h},n),Zt(f,l);}},{key:"reRenderSelector",value:function reRenderSelector(){var _this73=this;var n;var t;var r=/* @__PURE__ */new Map();return(n=this.selectIds)==null||n.forEach(function(s){var c=_this73.vNodes.get(s);c&&(t=Zt(t,c.rect),r.set(s,c));},this),this.getSelecteorInfo(r),this.draw(Me,this.fullLayer,{intersectRect:t,subNodeMap:r,selectIds:this.selectIds||[]}),this.oldSelectRect=t,t;}},{key:"updateSelectIds",value:function updateSelectIds(t){var c;var r;var n=(c=this.selectIds)==null?void 0:c.filter(function(l){return!t.includes(l);});if(n!=null&&n.length&&(r=this.unSelectedByIds(n)),t.length){var l=this.selectedByIds(t);r=Zt(r,l);}this.selectIds=t;var s=this.reRenderSelector();return{bgRect:r,selectRect:s};}},{key:"cursorHover",value:function cursorHover(t){var c,l;var r=this.oldSelectRect;this.selectIds=[];var n=(c=this.workId)==null?void 0:c.toString(),s=[t[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]];if(this.selectSingleTool(s,n,!0),this.oldSelectRect&&!qr(r,this.oldSelectRect))return{type:xt.CursorHover,dataType:Vt.Local,rect:Zt(r,this.oldSelectRect),selectorColor:this.selectorColor,willSyncService:!1};if((l=this.selectIds)!=null&&l.length||(this.oldSelectRect=void 0),r&&!this.oldSelectRect)return this.cursorBlur(),{type:xt.CursorHover,dataType:Vt.Local,rect:r,selectorColor:this.selectorColor,willSyncService:!1};}},{key:"cursorBlur",value:function cursorBlur(){var r,n;this.selectIds=[];var t=(r=this.workId)==null?void 0:r.toString();((n=this.fullLayer)==null?void 0:n.parent).children.forEach(function(s){s.name===t&&s.remove();});}}]);}($t);dt(ho,"selectorBorderId","selector-border");var Hi=ho;var Ch=/*#__PURE__*/function(_$t5){function Ch(t){var _this74;_classCallCheck(this,Ch);_this74=_callSuper(this,Ch,[t]);dt(_this74,"canRotate",!1);dt(_this74,"scaleType",Ae.both);dt(_this74,"toolsType",Tt.Arrow);dt(_this74,"tmpPoints",[]);dt(_this74,"workOptions");dt(_this74,"oldRect");dt(_this74,"arrowTipWidth");dt(_this74,"syncTimestamp");_this74.workOptions=t.toolsOpt,_this74.arrowTipWidth=_this74.workOptions.thickness*4,_this74.syncTimestamp=0,_this74.syncUnitTime=50;return _this74;}_inherits(Ch,_$t5);return _createClass(Ch,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=r.syncUnitTime;u&&(this.syncUnitTime=u);var y=m==null?void 0:m.length;if(!y||y<2)return{type:xt.None};var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],T=!1):T=this.updateTempPoints(m),!T)return{type:xt.None};var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:h,layer:x});}if(f){var _x38=Zt(E,this.oldRect);this.oldRect=E;var _I37=_objectSpread({rect:_x38,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d33=Date.now();_d33-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d33,_I37.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I37.index=0,_I37.isSync=!0);}return _I37;}if(!s&&l){var _x39=Date.now();return _x39-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x39,_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread(_objectSpread({rect:C},this.baseConsumeResult),{},{type:xt.DrawWork,dataType:Vt.Local});}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n},this.baseConsumeResult),{},{type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawEraserlines,_this$workOptions7=this.workOptions,c=_this$workOptions7.strokeColor,l=_this$workOptions7.thickness,f=_this$workOptions7.zIndex,h=_this$workOptions7.scale,m=_this$workOptions7.rotate,u=_this$workOptions7.translate,y=_this$workOptions7.strokeType,T=_this$workOptions7.eraserlines,E=_this$workOptions7.lineDash,C=_this$workOptions7.lineCap,x=n.worldPosition,I=n.worldScaling,_this$computDrawPoint3=this.computDrawPoints(l),d=_this$computDrawPoint3.points,v=_this$computDrawPoint3.pos,p=_this$computDrawPoint3.rect,S=_this$computDrawPoint3.isTriangle,A=_this$computDrawPoint3.trianglePoints,R=_this$computDrawPoint3.trianglePos,D=[p.x+p.w/2,p.y+p.h/2],U={pos:D,name:r,id:r,zIndex:f,anchor:[0.5,0.5],size:[p.w,p.h]};h&&(U.scale=h),m&&(U.rotate=m),u&&(U.translate=u);var M=new mr(U),W={points:A,pos:[R[0]-D[0],R[1]-D[1]],fillColor:c,strokeColor:c,lineWidth:0,normalize:!1},Y=new dn(W);if(M.append(Y),!S&&d&&v){var N={points:d,pos:[v[0]-D[0],v[1]-D[1]],fillColor:c,strokeColor:c,lineDash:y===we.Dotted?[E&&E[0]||1,(E&&E[1]||2)*l]:y===we.LongDotted?[(E&&E[0]||1)*l,(E&&E[1]||2)*l]:void 0,lineCap:y===we.Normal?void 0:C,lineWidth:l,normalize:!1},G=new dn(N);M.append(G);}T&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:M,eraserlines:T,pos:D,layer:n},s)),this.replace(n,r,M);var B={x:Math.floor(p.x*I[0]+x[0]-$t.SafeBorderPadding),y:Math.floor(p.y*I[1]+x[1]-$t.SafeBorderPadding),w:Math.floor(p.w*I[0]+2*$t.SafeBorderPadding),h:Math.floor(p.h*I[1]+2*$t.SafeBorderPadding)};if(h||m||u){var _N8=M.getBoundingClientRect();B={x:Math.floor(_N8.x-$t.SafeBorderPadding),y:Math.floor(_N8.y-$t.SafeBorderPadding),w:Math.floor(_N8.width+$t.SafeBorderPadding*2),h:Math.floor(_N8.height+$t.SafeBorderPadding*2)};}return this.isDelete&&M.setAttribute("opacity",0),B;}},{key:"computDrawPoints",value:function computDrawPoints(t){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.arrowTipWidth?this.computFullArrowPoints(t):this.computTrianglePoints();}},{key:"computFullArrowPoints",value:function computFullArrowPoints(t){var _this75=this;var r=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),n=pt.Per(r).mul(t/2),s=Jt.Sub(this.tmpPoints[0],n),c=Jt.Add(this.tmpPoints[0],n),l=pt.Mul(r,this.arrowTipWidth),f=pt.Sub(this.tmpPoints[1],l),h=Jt.Sub(f,n),m=Jt.Add(f,n),u=pt.Per(r).mul(t*1.5),y=Jt.Sub(f,u),T=Jt.Add(f,u),E=[this.tmpPoints[0],f],C=[y,this.tmpPoints[1],T],x=[s,c].concat(C,[h,m]);return{trianglePoints:C.map(function(I){return Jt.Sub(I,_this75.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,points:E.map(function(I){return Jt.Sub(I,_this75.tmpPoints[0]).XY;}).flat(1),rect:Re(x),isTriangle:!1,pos:this.tmpPoints[0].XY};}},{key:"computTrianglePoints",value:function computTrianglePoints(){var _this76=this;var t=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),r=this.tmpPoints[1].distance(this.tmpPoints[0]),n=pt.Per(t).mul(Math.floor(r*3/8)),s=Jt.Sub(this.tmpPoints[0],n),c=Jt.Add(this.tmpPoints[0],n),l=[s,this.tmpPoints[1],c];return{trianglePoints:l.map(function(f){return Jt.Sub(f,_this76.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,rect:Re(l),isTriangle:!0};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState2=t.workState,s=_t$workState2===void 0?te.Done:_t$workState2,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var h,m;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.strokeType,f=s.get(r.name);return c&&(r.tagName==="GROUP"?r.children.forEach(function(u){u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c);}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&f!=null&&f.opt&&(m=f.opt)!=null&&m.strokeType&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),$t.updateNodeOpt(t);}}]);}($t);var Ih=/*#__PURE__*/function(_$t6){function Ih(t){var _this77;_classCallCheck(this,Ih);_this77=_callSuper(this,Ih,[t]);dt(_this77,"canRotate",!1);dt(_this77,"scaleType",Ae.all);dt(_this77,"toolsType",Tt.Ellipse);dt(_this77,"tmpPoints",[]);dt(_this77,"workOptions");dt(_this77,"oldRect");dt(_this77,"syncTimestamp");_this77.workOptions=t.toolsOpt,_this77.syncTimestamp=0,_this77.syncUnitTime=50;return _this77;}_inherits(Ih,_$t6);return _createClass(Ih,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=r.syncUnitTime;u&&(this.syncUnitTime=u);var y=m==null?void 0:m.length;if(!y||y<2)return{type:xt.None};var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],T=!1):T=this.updateTempPoints(m),!T)return{type:xt.None};var E;if(s||c||f){var C=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:h,layer:C,isDrawing:!0});var x=C.parent.parent,_I38={x:0,y:0,w:Math.floor(x.width),h:Math.floor(x.height)},_d34=_objectSpread({type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(Zi(E,_I38)!==Tr.outside){var p=Zt(E,this.oldRect);if(this.oldRect=E,_d34.rect=p,!f)return _d34;}if(f){var _p14=Date.now();return _p14-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_p14,_d34.op=this.tmpPoints.map(function(S){return[].concat(_toConsumableArray(S.XY),[0]);}).flat(1),_d34.index=0,_d34.isSync=!0),_d34;}return{type:xt.None};}if(!s&&!c&&!f&&l){var _C4=Date.now();return _C4-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_C4,_objectSpread(_objectSpread({type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult),{},{op:this.tmpPoints.map(function(x){return[].concat(_toConsumableArray(x.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:xt.None};}return{type:xt.None};}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local},this.baseConsumeResult),{},{ops:c,isSync:!0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawing,c=t.isDrawEraserlines,_this$workOptions8=this.workOptions,l=_this$workOptions8.strokeColor,f=_this$workOptions8.fillColor,h=_this$workOptions8.thickness,m=_this$workOptions8.zIndex,u=_this$workOptions8.scale,y=_this$workOptions8.rotate,T=_this$workOptions8.translate,E=_this$workOptions8.strokeType,C=_this$workOptions8.eraserlines,x=_this$workOptions8.lineDash,I=_this$workOptions8.lineCap,d=n.worldScaling,_this$computDrawPoint4=this.computDrawPoints(h),v=_this$computDrawPoint4.radius,p=_this$computDrawPoint4.rect,S=_this$computDrawPoint4.pos,A={closeType:"normal",radius:v,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:I,lineDash:E===we.Dotted?[x&&x[0]||1,(x&&x[1]||2)*h]:E===we.LongDotted?[(x&&x[0]||1)*h,(x&&x[1]||2)*h]:void 0},R={name:r,id:r,zIndex:m,pos:S,anchor:[0.5,0.5],size:[p.w,p.h]};u&&(R.scale=u),y&&(R.rotate=y),T&&(R.translate=T);var D=new mr(R);if(s){var W=new Mn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/d[0],1/d[1]]});D.append(W);}var U=new qy(_objectSpread(_objectSpread({},A),{},{pos:[0,0]}));D.append(U),C&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:D,eraserlines:C,pos:S,layer:n},c)),this.replace(n,r,D);var M=D.getBoundingClientRect();return this.isDelete&&D.setAttribute("opacity",0),{x:Math.floor(M.x-$t.SafeBorderPadding),y:Math.floor(M.y-$t.SafeBorderPadding),w:Math.floor(M.width+$t.SafeBorderPadding*2),h:Math.floor(M.height+$t.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t){var r=Re(this.tmpPoints),n=Re(this.tmpPoints,t),s=[Math.floor(r.x+r.w/2),Math.floor(r.y+r.h/2)];return{rect:n,pos:s,radius:[Math.floor(r.w/2),Math.floor(r.h/2)]};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState3=t.workState,s=_t$workState3===void 0?te.Done:_t$workState3,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var u,y,T;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.strokeType,h=s.get(r.name);var m=r;return r.tagName==="GROUP"&&(m=r.children[0]),c&&(m.setAttribute("strokeColor",c),(u=h==null?void 0:h.opt)!=null&&u.strokeColor&&(h.opt.strokeColor=c)),l&&(l==="transparent"?m.setAttribute("fillColor","rgba(0,0,0,0)"):m.setAttribute("fillColor",l),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=l)),f&&h!=null&&h.opt&&(T=h.opt)!=null&&T.strokeType&&(h.opt.strokeType=f),h&&s.setInfo(r.name,h),$t.updateNodeOpt(t);}}]);}($t);var Oh=/*#__PURE__*/function(_$t7){function Oh(t){var _this78;_classCallCheck(this,Oh);_this78=_callSuper(this,Oh,[t]);dt(_this78,"canRotate",!0);dt(_this78,"scaleType",Ae.all);dt(_this78,"toolsType",Tt.Rectangle);dt(_this78,"tmpPoints",[]);dt(_this78,"workOptions");dt(_this78,"oldRect");dt(_this78,"syncTimestamp");_this78.workOptions=t.toolsOpt,_this78.syncTimestamp=0,_this78.syncUnitTime=50;return _this78;}_inherits(Oh,_$t7);return _createClass(Oh,[{key:"transformData",value:function transformData(){var t=Re(this.tmpPoints);return[[t.x,t.y,0],[t.x+t.w,t.y,0],[t.x+t.w,t.y+t.h,0],[t.x,t.y+t.h,0]];}},{key:"computDrawPoints",value:function computDrawPoints(t){var r=this.workOptions.thickness,n=[];var _iterator30=_createForOfIteratorHelper(t),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var l=_step30.value;n.push(_construct(pt,_toConsumableArray(l)));}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}var s=Re(n,r),c=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:c,points:n.map(function(l){return l.XY;}).flat(1)};}},{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=m==null?void 0:m.length;if(!u||u<2)return{type:xt.None};var y;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],y=!1):y=this.updateTempPoints(m),!y)return{type:xt.None};var T=this.transformData();var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({ps:T,workId:h,layer:x,isDrawing:!0});}if(f){var _x40=Zt(E,this.oldRect);this.oldRect=E;var _I39=_objectSpread({rect:_x40,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d35=Date.now();_d35-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d35,_I39.op=T.flat(1),_I39.index=0,_I39.isSync=!0);}return _I39;}if(!s&&l){var _x41=Date.now();return _x41-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x41,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:T.flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread({rect:C,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var f;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.transformData(),n=this.fullLayer,s=this.draw({ps:r,workId:t,layer:n,isDrawing:!1});this.oldRect=s;var c=r.flat(1),l=gr(c);return(f=this.vNodes)==null||f.setInfo(t,{rect:s,op:c,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&$t.getCenterPos(s,n)}),_objectSpread(_objectSpread({rect:s,type:xt.FullWork,dataType:Vt.Local,ops:l,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawing,c=t.ps,l=t.replaceId,_t$isDrawEraserlines2=t.isDrawEraserlines,f=_t$isDrawEraserlines2===void 0?!0:_t$isDrawEraserlines2,_this$workOptions9=this.workOptions,h=_this$workOptions9.strokeColor,m=_this$workOptions9.fillColor,u=_this$workOptions9.thickness,y=_this$workOptions9.zIndex,T=_this$workOptions9.scale,E=_this$workOptions9.rotate,C=_this$workOptions9.translate,x=_this$workOptions9.strokeType,I=_this$workOptions9.eraserlines,d=_this$workOptions9.lineCap,v=_this$workOptions9.lineDash,p=n.worldPosition,S=n.worldScaling,_this$computDrawPoint5=this.computDrawPoints(c),A=_this$computDrawPoint5.points,R=_this$computDrawPoint5.rect,D=_this$computDrawPoint5.pos,U={close:!0,normalize:!0,points:A,lineWidth:u,fillColor:m!=="transparent"&&m||void 0,strokeColor:h,lineCap:d,lineDash:x===we.Dotted?[v&&v[0]||1,(v&&v[1]||2)*u]:x===we.LongDotted?[(v&&v[0]||1)*u,(v&&v[1]||2)*u]:void 0};var M={x:Math.floor(R.x*S[0]+p[0]-$t.SafeBorderPadding),y:Math.floor(R.y*S[1]+p[1]-$t.SafeBorderPadding),w:Math.floor(R.w*S[0]+2*$t.SafeBorderPadding),h:Math.floor(R.h*S[0]+2*$t.SafeBorderPadding)};var W=new mr({name:r,id:r,zIndex:y,pos:D,anchor:[0.5,0.5],size:[R.w,R.h],scale:T,rotate:E,translate:C}),Y=new dn(_objectSpread(_objectSpread({},U),{},{pos:[0,0]}));if(W.appendChild(Y),s){var B=new Mn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:h,lineWidth:1,scale:[1/S[0],1/S[1]]});W.appendChild(B);}if(I&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:W,eraserlines:I,pos:D,layer:n},f)),this.replace(n,l||r,W),T||E||C){var _B4=W.getBoundingClientRect();M={x:Math.floor(_B4.x-$t.SafeBorderPadding),y:Math.floor(_B4.y-$t.SafeBorderPadding),w:Math.floor(_B4.width+2*$t.SafeBorderPadding),h:Math.floor(_B4.height+2*$t.SafeBorderPadding)};}return this.isDelete&&W.setAttribute("opacity",0),M;}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var u,y;var r=t.op,n=t.isFullWork,s=t.replaceId,_t$workState4=t.workState,c=_t$workState4===void 0?te.Done:_t$workState4,l=(u=this.workId)==null?void 0:u.toString();if(!l)return;var f=[];for(var T=0;T<r.length;T+=3)f.push([r[T],r[T+1],r[T+2]]);var h=n?this.fullLayer:this.drawLayer||this.fullLayer,m=this.draw({ps:f,workId:l,layer:h,isDrawing:!1,replaceId:s,isDrawEraserlines:c===te.Done});return this.oldRect=m,(y=this.vNodes)==null||y.setInfo(l,{rect:m,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:m&&$t.getCenterPos(m,h)}),m;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var u,y,T;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.strokeType,h=s.get(r.name);var m=r;return r.tagName==="GROUP"&&(m=r.children[0]),c&&(m.setAttribute("strokeColor",c),(u=h==null?void 0:h.opt)!=null&&u.strokeColor&&(h.opt.strokeColor=c)),l&&(l==="transparent"?m.setAttribute("fillColor","rgba(0,0,0,0)"):m.setAttribute("fillColor",l),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=l)),f&&h!=null&&h.opt&&(T=h.opt)!=null&&T.strokeType&&(h.opt.strokeType=f),h&&s.setInfo(r.name,h),$t.updateNodeOpt(t);}}]);}($t);var wh=/*#__PURE__*/function(_$t8){function wh(t){var _this79;_classCallCheck(this,wh);_this79=_callSuper(this,wh,[t]);dt(_this79,"canRotate",!1);dt(_this79,"scaleType",Ae.all);dt(_this79,"toolsType",Tt.Star);dt(_this79,"tmpPoints",[]);dt(_this79,"workOptions");dt(_this79,"oldRect");dt(_this79,"syncTimestamp");_this79.workOptions=t.toolsOpt,_this79.syncTimestamp=0,_this79.syncUnitTime=50;return _this79;}_inherits(wh,_$t8);return _createClass(wh,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=r.syncUnitTime,y=m==null?void 0:m.length;if(!y||y<2)return{type:xt.None};u&&(this.syncUnitTime=u);var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],T=!1):T=this.updateTempPoints(m),!T)return{type:xt.None};var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:h,layer:x,isDrawing:!0});}if(f){var _x42=Zt(E,this.oldRect);this.oldRect=E;var _I40=_objectSpread({rect:_x42,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d36=Date.now();_d36-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d36,_I40.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I40.index=0,_I40.isSync=!0);}return _I40;}if(!s&&l){var _x43=Date.now();return _x43-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x43,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread({rect:C,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawing,_t$isDrawEraserlines3=t.isDrawEraserlines,c=_t$isDrawEraserlines3===void 0?!0:_t$isDrawEraserlines3,_this$workOptions10=this.workOptions,l=_this$workOptions10.strokeColor,f=_this$workOptions10.fillColor,h=_this$workOptions10.thickness,m=_this$workOptions10.zIndex,u=_this$workOptions10.vertices,y=_this$workOptions10.innerVerticeStep,T=_this$workOptions10.innerRatio,E=_this$workOptions10.scale,C=_this$workOptions10.rotate,x=_this$workOptions10.translate,I=_this$workOptions10.strokeType,d=_this$workOptions10.eraserlines,v=_this$workOptions10.lineDash,p=_this$workOptions10.lineCap,S=n.worldScaling,_this$computDrawPoint6=this.computDrawPoints(h,u,y,T),A=_this$computDrawPoint6.rect,R=_this$computDrawPoint6.pos,D=_this$computDrawPoint6.points,U={close:!0,points:D,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:p,lineDash:I===we.Dotted?[v&&v[0]||1,(v&&v[1]||2)*h]:I===we.LongDotted?[(v&&v[0]||1)*h,(v&&v[1]||2)*h]:void 0},M={name:r,id:r,zIndex:m,pos:R,anchor:[0.5,0.5],size:[A.w,A.h]};E&&(M.scale=E),C&&(M.rotate=C),x&&(M.translate=x);var W=new mr(M);if(s){var N=new Mn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/S[0],1/S[1]]});W.append(N);}var Y=new dn(_objectSpread(_objectSpread({},U),{},{pos:[0,0]}));W.append(Y),d&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:W,eraserlines:d,pos:R,layer:n},c)),this.replace(n,r,W);var B=W.getBoundingClientRect();return this.isDelete&&W.setAttribute("opacity",0),{x:Math.floor(B.x-$t.SafeBorderPadding),y:Math.floor(B.y-$t.SafeBorderPadding),w:Math.floor(B.width+$t.SafeBorderPadding*2),h:Math.floor(B.height+$t.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t,r,n,s){var c=Re(this.tmpPoints),l=[Math.floor(c.x+c.w/2),Math.floor(c.y+c.h/2)],f=Vh(c.w,c.h),h=Math.floor(Math.min(c.w,c.h)/2),m=s*h,u=[],y=2*Math.PI/r;for(var E=0;E<r;E++){var C=E*y-0.5*Math.PI;var x=void 0,_I41=void 0;E%n===1?(x=m*f[0]*Math.cos(C),_I41=m*f[1]*Math.sin(C)):(x=h*f[0]*Math.cos(C),_I41=h*f[1]*Math.sin(C),u.push(x,_I41)),u.push(x,_I41);}return{rect:Re(this.tmpPoints,t),pos:l,points:u};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState5=t.workState,s=_t$workState5===void 0?te.Done:_t$workState5,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var x;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.toolsType,h=n.vertices,m=n.innerVerticeStep,u=n.innerRatio,y=n.strokeType,T=s.get(r.name),E=T==null?void 0:T.opt;var C=r;return r.tagName==="GROUP"&&(C=r.children[0]),c&&(C.setAttribute("strokeColor",c),E!=null&&E.strokeColor&&(E.strokeColor=c)),l&&(l==="transparent"?C.setAttribute("fillColor","rgba(0,0,0,0)"):C.setAttribute("fillColor",l),E!=null&&E.fillColor&&(E.fillColor=l)),f===Tt.Star&&(h&&(E.vertices=h),m&&(E.innerVerticeStep=m),u&&(E.innerRatio=u)),y&&T!=null&&T.opt&&(x=T.opt)!=null&&x.strokeType&&(T.opt.strokeType=y),T&&s.setInfo(r.name,_objectSpread(_objectSpread({},T),{},{opt:E})),$t.updateNodeOpt(t);}}]);}($t);var Ah=/*#__PURE__*/function(_$t9){function Ah(t){var _this80;_classCallCheck(this,Ah);_this80=_callSuper(this,Ah,[t]);dt(_this80,"canRotate",!1);dt(_this80,"scaleType",Ae.all);dt(_this80,"toolsType",Tt.Polygon);dt(_this80,"tmpPoints",[]);dt(_this80,"workOptions");dt(_this80,"oldRect");dt(_this80,"syncTimestamp");_this80.workOptions=t.toolsOpt,_this80.syncTimestamp=0,_this80.syncUnitTime=50;return _this80;}_inherits(Ah,_$t9);return _createClass(Ah,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=r.op,m=r.syncUnitTime;m&&(this.syncUnitTime=m);var u=this.workId,y=h==null?void 0:h.length;if(!y||y<2)return{type:xt.None};var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(h[0],h[1])],T=!1):T=this.updateTempPoints(h),!T)return{type:xt.None};var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:u,layer:x,isDrawing:!0});}if(f){var _x44=Zt(E,this.oldRect);this.oldRect=E;var _I42=_objectSpread({type:xt.DrawWork,rect:_x44,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d37=Date.now();_d37-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d37,_I42.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I42.index=0,_I42.isSync=!0);}return _I42;}if(!s&&l){var _x45=Date.now();return _x45-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x45,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread({rect:C,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,s=t.isDrawing,_t$isDrawEraserlines4=t.isDrawEraserlines,c=_t$isDrawEraserlines4===void 0?!0:_t$isDrawEraserlines4,_this$workOptions11=this.workOptions,l=_this$workOptions11.strokeColor,f=_this$workOptions11.fillColor,h=_this$workOptions11.thickness,m=_this$workOptions11.zIndex,u=_this$workOptions11.vertices,y=_this$workOptions11.scale,T=_this$workOptions11.rotate,E=_this$workOptions11.translate,C=_this$workOptions11.strokeType,x=_this$workOptions11.eraserlines,I=_this$workOptions11.lineCap,d=_this$workOptions11.lineDash,v=n.worldScaling,_this$computDrawPoint7=this.computDrawPoints(h,u),p=_this$computDrawPoint7.rect,S=_this$computDrawPoint7.pos,A=_this$computDrawPoint7.points,R={close:!0,points:A,lineWidth:h,fillColor:f!=="transparent"&&f||void 0,strokeColor:l,normalize:!0,lineCap:I,lineDash:C===we.Dotted?[d&&d[0]||1,(d&&d[1]||2)*h]:C===we.LongDotted?[(d&&d[0]||1)*h,(d&&d[1]||2)*h]:void 0},D={name:r,id:r,zIndex:m,pos:S,anchor:[0.5,0.5],size:[p.w,p.h]};y&&(D.scale=y),T&&(D.rotate=T),E&&(D.translate=E);var U=new mr(D);if(s){var Y=new Mn({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:l,lineWidth:1,scale:[1/v[0],1/v[1]]});U.append(Y);}var M=new dn(_objectSpread(_objectSpread({},R),{},{pos:[0,0]}));U.append(M),x&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:U,eraserlines:x,pos:S,layer:n},c)),this.replace(n,r,U);var W=U.getBoundingClientRect();return this.isDelete&&U.setAttribute("opacity",0),{x:Math.floor(W.x-$t.SafeBorderPadding),y:Math.floor(W.y-$t.SafeBorderPadding),w:Math.floor(W.width+$t.SafeBorderPadding*2),h:Math.floor(W.height+$t.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t,r){var n=Re(this.tmpPoints),s=[Math.floor(n.x+n.w/2),Math.floor(n.y+n.h/2)],c=Vh(n.w,n.h),l=Math.floor(Math.min(n.w,n.h)/2),f=[],h=2*Math.PI/r;for(var u=0;u<r;u++){var y=u*h-0.5*Math.PI,T=l*c[0]*Math.cos(y),E=l*c[1]*Math.sin(y);f.push(T,E);}return{rect:Re(this.tmpPoints,t),pos:s,points:f};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState6=t.workState,s=_t$workState6===void 0?te.Done:_t$workState6,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var E;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.toolsType,h=n.vertices,m=n.strokeType,u=s.get(r.name),y=u==null?void 0:u.opt;var T=r;return r.tagName==="GROUP"&&(T=r.children[0]),c&&(T.setAttribute("strokeColor",c),y!=null&&y.strokeColor&&(y.strokeColor=c)),l&&(l==="transparent"?T.setAttribute("fillColor","rgba(0,0,0,0)"):T.setAttribute("fillColor",l),y!=null&&y.fillColor&&(y.fillColor=l)),f===Tt.Polygon&&h&&(y.vertices=h),m&&u!=null&&u.opt&&(E=u.opt)!=null&&E.strokeType&&(u.opt.strokeType=m),u&&s.setInfo(r.name,_objectSpread(_objectSpread({},u),{},{opt:y})),$t.updateNodeOpt(t);}}]);}($t);var Hr=/*#__PURE__*/function(){function Hr(){_classCallCheck(this,Hr);}return _createClass(Hr,null,[{key:"bezier",value:function bezier(e,t){var r=[];for(var n=0;n<t.length;n+=4){var s=t[n],c=t[n+1],l=t[n+2],f=t[n+3];s&&c&&l&&f?r.push.apply(r,_toConsumableArray(Hr.getBezierPoints(e,s,c,l,f))):s&&c&&l?r.push.apply(r,_toConsumableArray(Hr.getBezierPoints(e,s,c,l))):s&&c?r.push.apply(r,_toConsumableArray(Hr.getBezierPoints(e,s,c))):s&&r.push(s);}return r;}/**
|
|
409
409
|
* @desc 获取点,这里可以设置点的个数
|
|
410
410
|
* @param {number} num 点个数
|
|
411
411
|
* @param {Vec2d} p1 点坐标
|
|
@@ -433,16 +433,16 @@ dt(pi,"eraserSizes",Tl);var io=pi;var J2="__lodash_hash_undefined__";function Q2
|
|
|
433
433
|
* @param {Array} p2 终点坐标
|
|
434
434
|
* @param {Array} cp1 控制点1
|
|
435
435
|
* @param {Array} cp2 控制点2
|
|
436
|
-
*/},{key:"threeBezier",value:function threeBezier(e,t,r,n,s){var c=t.x*(1-e)*(1-e)*(1-e)+3*r.x*e*(1-e)*(1-e)+3*n.x*e*e*(1-e)+s.x*e*e*e,l=t.y*(1-e)*(1-e)*(1-e)+3*r.y*e*(1-e)*(1-e)+3*n.y*e*e*(1-e)+s.y*e*e*e;return new pt(c,l);}}]);}();var Eh=/*#__PURE__*/function(_$t10){function Eh(t){var _this81;_classCallCheck(this,Eh);_this81=_callSuper(this,Eh,[t]);dt(_this81,"canRotate",!1);dt(_this81,"scaleType",Ae.all);dt(_this81,"toolsType",Tt.SpeechBalloon);dt(_this81,"ratio",0.8);dt(_this81,"tmpPoints",[]);dt(_this81,"workOptions");dt(_this81,"oldRect");dt(_this81,"syncTimestamp");_this81.workOptions=t.toolsOpt,_this81.syncTimestamp=0,_this81.syncUnitTime=50;return _this81;}_inherits(Eh,_$t10);return _createClass(Eh,[{key:"consume",value:function consume(t){var C;var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=(C=r==null?void 0:r.workId)==null?void 0:C.toString();if(!h)return{type:xt.None};var m=r.op,u=m==null?void 0:m.length;if(!u||u<2)return{type:xt.None};var y;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],y=!1):y=this.updateTempPoints(m),!y)return{type:xt.None};var T;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;T=this.draw({workId:h,layer:x,isDrawing:!0});}if(f){var _x46=Zt(T,this.oldRect);this.oldRect=T;var _I43=_objectSpread({rect:_x46,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d38=Date.now();_d38-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d38,_I43.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I43.index=0,_I43.isSync=!0);}return _I43;}if(!s&&l){var _x47=Date.now();return _x47-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x47,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var E=Zt(T,this.oldRect);return this.oldRect=T,_objectSpread({rect:E,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,_t$isDrawEraserlines5=t.isDrawEraserlines,s=_t$isDrawEraserlines5===void 0?!0:_t$isDrawEraserlines5,_this$workOptions12=this.workOptions,c=_this$workOptions12.strokeColor,l=_this$workOptions12.fillColor,f=_this$workOptions12.thickness,h=_this$workOptions12.zIndex,m=_this$workOptions12.placement,u=_this$workOptions12.scale,y=_this$workOptions12.rotate,T=_this$workOptions12.translate,E=_this$workOptions12.strokeType,C=_this$workOptions12.eraserlines,x=_this$workOptions12.lineDash,I=_this$workOptions12.lineCap,_this$computDrawPoint8=this.computDrawPoints(f,m),d=_this$computDrawPoint8.rect,v=_this$computDrawPoint8.pos,p=_this$computDrawPoint8.points,S={points:p.map(function(M){return M.XY;}),lineWidth:f,fillColor:l!=="transparent"&&l||void 0,strokeColor:c,normalize:!0,className:"".concat(v[0],",").concat(v[1]),close:!0,lineCap:I,lineDash:E===we.Dotted?[x&&x[0]||1,(x&&x[1]||2)*f]:E===we.LongDotted?[(x&&x[0]||1)*f,(x&&x[1]||2)*f]:void 0},A={name:r,id:r,zIndex:h,pos:v,anchor:[0.5,0.5],size:[d.w,d.h]};u&&(A.scale=u),y&&(A.rotate=y),T&&(A.translate=T);var R=new mr(A),D=new dn(_objectSpread(_objectSpread({},S),{},{pos:[0,0]}));R.append(D),C&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:R,eraserlines:C,pos:v,layer:n},s)),this.replace(n,r,R);var U=R.getBoundingClientRect();return this.isDelete&&R.setAttribute("opacity",0),{x:Math.floor(U.x-$t.SafeBorderPadding),y:Math.floor(U.y-$t.SafeBorderPadding),w:Math.floor(U.width+$t.SafeBorderPadding*2),h:Math.floor(U.height+$t.SafeBorderPadding*2)};}},{key:"transformControlPoints",value:function transformControlPoints(t){var r=Re(this.tmpPoints);switch(t){case"bottom":case"bottomLeft":case"bottomRight":{var n=r.y+r.h*this.ratio;return[new pt(r.x,r.y,0),new pt(r.x+r.w,r.y,0),new pt(r.x+r.w,n,0),new pt(r.x,n,0)];}case"top":case"topLeft":case"topRight":{var _n4=r.y+r.h*(1-this.ratio);return[new pt(r.x,_n4,0),new pt(r.x+r.w,_n4,0),new pt(r.x+r.w,r.y+r.h,0),new pt(r.x,r.y+r.h,0)];}case"left":case"leftBottom":case"leftTop":{var _n5=r.x+r.w*(1-this.ratio);return[new pt(_n5,r.y,0),new pt(r.x+r.w,r.y,0),new pt(r.x+r.w,r.y+r.h,0),new pt(_n5,r.y+r.h,0)];}case"right":case"rightBottom":case"rightTop":{var _n6=r.x+r.w*this.ratio;return[new pt(r.x,r.y,0),new pt(_n6,r.y,0),new pt(_n6,r.y+r.h,0),new pt(r.x,r.y+r.h,0)];}}}},{key:"computDrawPoints",value:function computDrawPoints(t,r){var n=Re(this.tmpPoints),s=this.transformControlPoints(r),c=Math.floor(n.w*0.1),l=Math.floor(n.h*0.1),f=[],h=pt.Add(s[0],new pt(0,l,0)),m=pt.Add(s[0],new pt(c,0,0)),u=Hr.getBezierPoints(10,h,s[0],m),y=pt.Sub(s[1],new pt(c,0,0)),T=pt.Add(s[1],new pt(0,l,0)),E=Hr.getBezierPoints(10,y,s[1],T),C=pt.Sub(s[2],new pt(0,l,0)),x=pt.Sub(s[2],new pt(c,0,0)),I=Hr.getBezierPoints(10,C,s[2],x),d=pt.Add(s[3],new pt(c,0,0)),v=pt.Sub(s[3],new pt(0,l,0)),p=Hr.getBezierPoints(10,d,s[3],v),S=c*(1-this.ratio)*10,A=l*(1-this.ratio)*10;switch(r){case"bottom":{var U=pt.Sub(s[2],new pt(c*5-S/2,0,0)),M=pt.Sub(s[2],new pt(c*5,-A,0)),W=pt.Sub(s[2],new pt(c*5+S/2,0,0));f.push.apply(f,[M,W].concat(_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),[U]));break;}case"bottomRight":{var _U13=pt.Sub(s[2],new pt(c*1.1,0,0)),_M10=pt.Sub(s[2],new pt(c*1.1+S/2,-A,0)),_W8=pt.Sub(s[2],new pt(c*1.1+S,0,0));f.push.apply(f,[_M10,_W8].concat(_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),[_U13]));break;}case"bottomLeft":{var _U14=pt.Add(s[3],new pt(c*1.1+S,0,0)),_M11=pt.Add(s[3],new pt(c*1.1+S/2,A,0)),_W9=pt.Add(s[3],new pt(c*1.1,0,0));f.push.apply(f,[_M11,_W9].concat(_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),[_U14]));break;}case"top":{var _U15=pt.Sub(s[1],new pt(c*5-S/2,0,0)),_M12=pt.Sub(s[1],new pt(c*5,A,0)),_W10=pt.Sub(s[1],new pt(c*5+S/2,0,0));f.push.apply(f,[_M12,_U15].concat(_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),[_W10]));break;}case"topRight":{var _U16=pt.Sub(s[1],new pt(c*1.1,0,0)),_M13=pt.Sub(s[1],new pt(c*1.1+S/2,A,0)),_W11=pt.Sub(s[1],new pt(c*1.1+S,0,0));f.push.apply(f,[_M13,_U16].concat(_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),[_W11]));break;}case"topLeft":{var _U17=pt.Add(s[0],new pt(c*1.1+S,0,0)),_M14=pt.Add(s[0],new pt(c*1.1+S/2,-A,0)),_W12=pt.Add(s[0],new pt(c*1.1,0,0));f.push.apply(f,[_M14,_U17].concat(_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),[_W12]));break;}case"left":{var _U18=pt.Add(s[0],new pt(0,l*5-A/2,0)),_M15=pt.Add(s[0],new pt(-S,l*5,0)),_W13=pt.Add(s[0],new pt(0,l*5+A/2,0));f.push.apply(f,[_M15,_U18].concat(_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),[_W13]));break;}case"leftTop":{var _U19=pt.Add(s[0],new pt(0,l*1.1,0)),_M16=pt.Add(s[0],new pt(-S,l*1.1+A/2,0)),_W14=pt.Add(s[0],new pt(0,l*1.1+A,0));f.push.apply(f,[_M16,_U19].concat(_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),[_W14]));break;}case"leftBottom":{var _U20=pt.Sub(s[3],new pt(0,l*1.1+A,0)),_M17=pt.Sub(s[3],new pt(S,l*1.1+A/2,0)),_W15=pt.Sub(s[3],new pt(0,l*1.1,0));f.push.apply(f,[_M17,_U20].concat(_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),[_W15]));break;}case"right":{var _U21=pt.Add(s[1],new pt(0,l*5-A/2,0)),_M18=pt.Add(s[1],new pt(S,l*5,0)),_W16=pt.Add(s[1],new pt(0,l*5+A/2,0));f.push.apply(f,[_M18,_W16].concat(_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),[_U21]));break;}case"rightTop":{var _U22=pt.Add(s[1],new pt(0,l*1.1,0)),_M19=pt.Add(s[1],new pt(S,l*1.1+A/2,0)),_W17=pt.Add(s[1],new pt(0,l*1.1+A,0));f.push.apply(f,[_M19,_W17].concat(_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),[_U22]));break;}case"rightBottom":{var _U23=pt.Sub(s[2],new pt(0,l*1.1+A,0)),_M20=pt.Sub(s[2],new pt(-S,l*1.1+A/2,0)),_W18=pt.Sub(s[2],new pt(0,l*1.1,0));f.push.apply(f,[_M20,_W18].concat(_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),[_U23]));break;}}var R=Re(this.tmpPoints,t),D=[Math.floor(R.x+R.w/2),Math.floor(R.y+R.h/2)];return{rect:R,pos:D,points:f};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState7=t.workState,s=_t$workState7===void 0?te.Done:_t$workState7,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var E;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.toolsType,h=n.placement,m=n.strokeType,u=s.get(r.name),y=u==null?void 0:u.opt;var T=r;return r.tagName==="GROUP"&&(T=r.children[0]),c&&(T.setAttribute("strokeColor",c),y!=null&&y.strokeColor&&(y.strokeColor=c)),l&&(l==="transparent"?T.setAttribute("fillColor","rgba(0,0,0,0)"):T.setAttribute("fillColor",l),y!=null&&y.fillColor&&(y.fillColor=l)),f===Tt.SpeechBalloon&&h&&(y.placement=h),m&&u!=null&&u.opt&&(E=u.opt)!=null&&E.strokeType&&(u.opt.strokeType=m),u&&s.setInfo(r.name,_objectSpread(_objectSpread({},u),{},{opt:y})),$t.updateNodeOpt(t);}}]);}($t);var tA=Pi,eA=pn,rA="[object Boolean]";function nA(i){return i===!0||i===!1||eA(i)&&tA(i)==rA;}var iA=nA,hi=/* @__PURE__ */Ln(iA);var Hi=/*#__PURE__*/function(_$t11){function Hi(t){var _this82;_classCallCheck(this,Hi);_this82=_callSuper(this,Hi,[t]);dt(_this82,"canRotate",!0);dt(_this82,"scaleType",Ae.all);dt(_this82,"toolsType",Tt.Image);dt(_this82,"tmpPoints",[]);dt(_this82,"workOptions");dt(_this82,"oldRect");_this82.workOptions=t.toolsOpt,_this82.scaleType=Hi.getScaleType(_this82.workOptions);return _this82;}_inherits(Hi,_$t11);return _createClass(Hi,[{key:"consume",value:function consume(){return{type:xt.None};}},{key:"consumeAll",value:function consumeAll(){return{type:xt.None};}},{key:"draw",value:function draw(t){var r=t.layer,n=t.workId,s=t.replaceId,c=t.imageBitmap,_this$workOptions13=this.workOptions,l=_this$workOptions13.centerX,f=_this$workOptions13.centerY,h=_this$workOptions13.width,m=_this$workOptions13.height,u=_this$workOptions13.rotate,y=_this$workOptions13.zIndex,T=_this$workOptions13.eraserlines,E=new mr({anchor:[0.5,0.5],pos:[l,f],name:n,size:[h,m],zIndex:y,rotate:u}),C={anchor:[0.5,0.5],pos:[0,0],size:[h,m],texture:c};c||(C.bgcolor="rgba(0,0,0,0.3)");var x=new Yu(C);E.append(x),T&&this.drawEraserlines({group:E,eraserlines:T,pos:[l,f],layer:r}),this.replace(r,s||n,E);var I=E.getBoundingClientRect();if(I)return{x:Math.floor(I.x-$t.SafeBorderPadding),y:Math.floor(I.y-$t.SafeBorderPadding),w:Math.floor(I.width+$t.SafeBorderPadding*2),h:Math.floor(I.height+$t.SafeBorderPadding*2)};}},{key:"consumeService",value:function consumeService(){}},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(t){var m,u,y,T,r,n,s,_this$workOptions14,c,l,f,h,E,C;return _regeneratorRuntime().wrap(function _callee23$(_context25){while(1)switch(_context25.prev=_context25.next){case 0:r=t.isFullWork,n=t.replaceId,s=t.worker,_this$workOptions14=this.workOptions,c=_this$workOptions14.src,l=_this$workOptions14.uuid,f=((m=this.workId)==null?void 0:m.toString())||l,h=r?this.fullLayer:this.drawLayer||this.fullLayer;if(!c){_context25.next=8;break;}_context25.next=4;return s.loadImageBitMap({toolsType:this.toolsType,opt:this.workOptions,workId:f,isSubWorker:s instanceof id});case 4:E=_context25.sent;if(!E){_context25.next=8;break;}C=this.draw({workId:f,layer:h,replaceId:n,imageBitmap:E});return _context25.abrupt("return",(this.oldRect=f&&((y=(u=this.vNodes)==null?void 0:u.get(f))==null?void 0:y.rect)||void 0,(T=this.vNodes)==null||T.setInfo(f,{rect:C,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:C&&$t.getCenterPos(C,h)}),C));case 8:case"end":return _context25.stop();}},_callee23,this);}));function consumeServiceAsync(_x48){return _consumeServiceAsync.apply(this,arguments);}return consumeServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"getScaleType",value:function getScaleType(t){var r=t.uniformScale,n=t.rotate;return r!==!1||n&&Math.abs(n)%90>0?Ae.proportional:Ae.all;}},{key:"updateNodeOpt",value:function updateNodeOpt(t){var r=t.node,n=t.opt,s=t.vNodes,c=t.targetNode,l=n.translate,f=n.originPoint,h=n.scenePoint,m=n.scale,u=n.angle,y=n.isLocked,T=n.zIndex,E=n.strokeColor,C=c&&fr(c)||s.get(r.name);if(!C)return;var x=r.parent;if(x){if(E&&(C.opt.strokeColor=E),er(T)&&(r.setAttribute("zIndex",T),C.opt.zIndex=T),hi(y)&&(C.opt.locked=y),f&&h&&m&&l){var _C$opt=C.opt,_I44=_C$opt.centerX,_d39=_C$opt.centerY,v=_C$opt.width,p=_C$opt.height,S=_C$opt.uniformScale,A=S!==!1?[m[0],m[0]]:m,R=[_I44,_d39],D=[_I44,_d39];Ll(D,h,A,l);var U=[D[0]-R[0],D[1]-R[1]];if(C.centerPos=[C.centerPos[0]+U[0],C.centerPos[1]+U[1]],C.opt.width=Math.round(v*A[0]),C.opt.height=Math.round(p*A[1]),C.opt.centerX=D[0],C.opt.centerY=D[1],C.opt.eraserlines){var _iterator31=_createForOfIteratorHelper(C.opt.eraserlines),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var M=_step31.value;var W=M.op,Y=M.thickness;M.thickness=Math.round(Y*Math.max(m[0],m[1]));for(var B=0;B<W.length;B++)Rl(W[B],h,m,l);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}}else if(l){if(C.opt.centerX=C.opt.centerX+l[0],C.opt.centerY=C.opt.centerY+l[1],C.centerPos=[C.centerPos[0]+l[0],C.centerPos[1]+l[1]],C.opt.eraserlines){var _iterator32=_createForOfIteratorHelper(C.opt.eraserlines),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _I45=_step32.value;var _d40=_I45.op;for(var _v12=0;_v12<_d40.length;_v12++){var _p15=_d40[_v12].map(function(S,A){return A%2?S+l[1]:S+l[0];});_I45.op[_v12]=_p15;}}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}}}else if(er(u))if(C.opt.rotate=u,C.scaleType=Hi.getScaleType(C.opt),c){var _I46=kh(C.rect,u);C.rect=_I46;}else{var _I47=$t.getRectFromLayer(x,r.name);C.rect=_I47||C.rect;}return C&&s.setInfo(r.name,C),C==null?void 0:C.rect;}}}]);}($t);var Mh=/*#__PURE__*/function(_$t12){function Mh(t){var _this83;_classCallCheck(this,Mh);_this83=_callSuper(this,Mh,[t]);dt(_this83,"canRotate",!1);dt(_this83,"scaleType",Ae.both);dt(_this83,"toolsType",Tt.Straight);dt(_this83,"tmpPoints",[]);dt(_this83,"workOptions");dt(_this83,"oldRect");dt(_this83,"straightTipWidth");dt(_this83,"syncTimestamp");_this83.workOptions=t.toolsOpt,_this83.straightTipWidth=_this83.workOptions.thickness/2,_this83.syncTimestamp=0,_this83.syncUnitTime=50;return _this83;}_inherits(Mh,_$t12);return _createClass(Mh,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=r.syncUnitTime,y=m==null?void 0:m.length;if(!y||y<2)return{type:xt.None};u&&(this.syncUnitTime=u);var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],T=!1):T=this.updateTempPoints(m),!T)return{type:xt.None};var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:h,layer:x});}if(f){var _x49=Zt(E,this.oldRect);this.oldRect=E;var _I48=_objectSpread({rect:_x49,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d41=Date.now();_d41-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d41,_I48.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I48.index=0,_I48.isSync=!0);}return _I48;}if(!s&&l){var _x50=Date.now();return _x50-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x50,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread({rect:C,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,_t$isDrawEraserlines6=t.isDrawEraserlines,s=_t$isDrawEraserlines6===void 0?!0:_t$isDrawEraserlines6,_this$workOptions15=this.workOptions,c=_this$workOptions15.strokeColor,l=_this$workOptions15.thickness,f=_this$workOptions15.zIndex,h=_this$workOptions15.scale,m=_this$workOptions15.rotate,u=_this$workOptions15.translate,y=_this$workOptions15.strokeType,T=_this$workOptions15.eraserlines,E=_this$workOptions15.lineCap,C=_this$workOptions15.lineDash,x=n.worldPosition,I=n.worldScaling,_this$computDrawPoint9=this.computDrawPoints(l,y),d=_this$computDrawPoint9.d,v=_this$computDrawPoint9.rect,p=_this$computDrawPoint9.isDot,S=[v.x+v.w/2,v.y+v.h/2],A=new mr({pos:S,anchor:[0.5,0.5],size:[v.w,v.h],name:r,id:r,normalize:!0,zIndex:f}),R={pos:[0,0],normalize:!0,d:d,fillColor:c,strokeColor:c,lineDash:p?void 0:y===we.Dotted?[C&&C[0]||1,(C&&C[1]||2)*l]:y===we.LongDotted?[(C&&C[0]||1)*l,(C&&C[1]||2)*l]:void 0,lineCap:p?void 0:E,lineWidth:y===we.Normal||p?0:l};h&&(R.scale=h),m&&(R.rotate=m),u&&(R.translate=u);var D=new Mn(R);A.append(D),T&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:A,eraserlines:T,pos:S,layer:n},s)),this.replace(n,r,A);var U={x:Math.floor(v.x*I[0]+x[0]-$t.SafeBorderPadding),y:Math.floor(v.y*I[1]+x[1]-$t.SafeBorderPadding),w:Math.floor(v.w*I[0]+2*$t.SafeBorderPadding),h:Math.floor(v.h*I[1]+2*$t.SafeBorderPadding)};if(m||h||u){var M=D.getBoundingClientRect();U={x:Math.floor(M.x-$t.SafeBorderPadding),y:Math.floor(M.y-$t.SafeBorderPadding),w:Math.floor(M.width+$t.SafeBorderPadding*2),h:Math.floor(M.height+$t.SafeBorderPadding*2)};}return this.isDelete&&A.setAttribute("opacity",0),U;}},{key:"computDrawPoints",value:function computDrawPoints(t,r){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.straightTipWidth?this.computFullPoints(t,r):this.computDotPoints(t);}},{key:"computFullPoints",value:function computFullPoints(t,r){var n=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),s=pt.Per(n).mul(t/2),c=Jt.Sub(this.tmpPoints[0],s),l=Jt.Add(this.tmpPoints[0],s),f=Jt.Sub(this.tmpPoints[1],s),h=Jt.Add(this.tmpPoints[1],s),m=Jt.GetSemicircleStroke(this.tmpPoints[1],f,-1,8),u=Jt.GetSemicircleStroke(this.tmpPoints[0],l,-1,8),y=[c,f].concat(_toConsumableArray(m),[h,l],_toConsumableArray(u));var T;return r!==we.Normal?T=En(this.tmpPoints,!1):T=En(y,!0),{d:T,rect:Re(y),isDot:!1,pos:this.tmpPoints[0].XY};}},{key:"computDotPoints",value:function computDotPoints(t){var r=Jt.GetDotStroke(this.tmpPoints[0],t/2,8);return{d:En(r,!0),rect:Re(r),isDot:!0,pos:this.tmpPoints[0].XY};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState8=t.workState,s=_t$workState8===void 0?te.Done:_t$workState8,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var h,m;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.strokeType,f=s.get(r.name);return c&&(r.tagName==="GROUP"?r.children.forEach(function(u){u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c);}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&f!=null&&f.opt&&(m=f.opt)!=null&&m.strokeType&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),$t.updateNodeOpt(t);}}]);}($t);var di="cursorhover",wu=20,ki="mainView";var Au={exports:{}},ke={},ll={exports:{}},jn={};function Lh(){var i={};return i["align-content"]=!1,i["align-items"]=!1,i["align-self"]=!1,i["alignment-adjust"]=!1,i["alignment-baseline"]=!1,i.all=!1,i["anchor-point"]=!1,i.animation=!1,i["animation-delay"]=!1,i["animation-direction"]=!1,i["animation-duration"]=!1,i["animation-fill-mode"]=!1,i["animation-iteration-count"]=!1,i["animation-name"]=!1,i["animation-play-state"]=!1,i["animation-timing-function"]=!1,i.azimuth=!1,i["backface-visibility"]=!1,i.background=!0,i["background-attachment"]=!0,i["background-clip"]=!0,i["background-color"]=!0,i["background-image"]=!0,i["background-origin"]=!0,i["background-position"]=!0,i["background-repeat"]=!0,i["background-size"]=!0,i["baseline-shift"]=!1,i.binding=!1,i.bleed=!1,i["bookmark-label"]=!1,i["bookmark-level"]=!1,i["bookmark-state"]=!1,i.border=!0,i["border-bottom"]=!0,i["border-bottom-color"]=!0,i["border-bottom-left-radius"]=!0,i["border-bottom-right-radius"]=!0,i["border-bottom-style"]=!0,i["border-bottom-width"]=!0,i["border-collapse"]=!0,i["border-color"]=!0,i["border-image"]=!0,i["border-image-outset"]=!0,i["border-image-repeat"]=!0,i["border-image-slice"]=!0,i["border-image-source"]=!0,i["border-image-width"]=!0,i["border-left"]=!0,i["border-left-color"]=!0,i["border-left-style"]=!0,i["border-left-width"]=!0,i["border-radius"]=!0,i["border-right"]=!0,i["border-right-color"]=!0,i["border-right-style"]=!0,i["border-right-width"]=!0,i["border-spacing"]=!0,i["border-style"]=!0,i["border-top"]=!0,i["border-top-color"]=!0,i["border-top-left-radius"]=!0,i["border-top-right-radius"]=!0,i["border-top-style"]=!0,i["border-top-width"]=!0,i["border-width"]=!0,i.bottom=!1,i["box-decoration-break"]=!0,i["box-shadow"]=!0,i["box-sizing"]=!0,i["box-snap"]=!0,i["box-suppress"]=!0,i["break-after"]=!0,i["break-before"]=!0,i["break-inside"]=!0,i["caption-side"]=!1,i.chains=!1,i.clear=!0,i.clip=!1,i["clip-path"]=!1,i["clip-rule"]=!1,i.color=!0,i["color-interpolation-filters"]=!0,i["column-count"]=!1,i["column-fill"]=!1,i["column-gap"]=!1,i["column-rule"]=!1,i["column-rule-color"]=!1,i["column-rule-style"]=!1,i["column-rule-width"]=!1,i["column-span"]=!1,i["column-width"]=!1,i.columns=!1,i.contain=!1,i.content=!1,i["counter-increment"]=!1,i["counter-reset"]=!1,i["counter-set"]=!1,i.crop=!1,i.cue=!1,i["cue-after"]=!1,i["cue-before"]=!1,i.cursor=!1,i.direction=!1,i.display=!0,i["display-inside"]=!0,i["display-list"]=!0,i["display-outside"]=!0,i["dominant-baseline"]=!1,i.elevation=!1,i["empty-cells"]=!1,i.filter=!1,i.flex=!1,i["flex-basis"]=!1,i["flex-direction"]=!1,i["flex-flow"]=!1,i["flex-grow"]=!1,i["flex-shrink"]=!1,i["flex-wrap"]=!1,i["float"]=!1,i["float-offset"]=!1,i["flood-color"]=!1,i["flood-opacity"]=!1,i["flow-from"]=!1,i["flow-into"]=!1,i.font=!0,i["font-family"]=!0,i["font-feature-settings"]=!0,i["font-kerning"]=!0,i["font-language-override"]=!0,i["font-size"]=!0,i["font-size-adjust"]=!0,i["font-stretch"]=!0,i["font-style"]=!0,i["font-synthesis"]=!0,i["font-variant"]=!0,i["font-variant-alternates"]=!0,i["font-variant-caps"]=!0,i["font-variant-east-asian"]=!0,i["font-variant-ligatures"]=!0,i["font-variant-numeric"]=!0,i["font-variant-position"]=!0,i["font-weight"]=!0,i.grid=!1,i["grid-area"]=!1,i["grid-auto-columns"]=!1,i["grid-auto-flow"]=!1,i["grid-auto-rows"]=!1,i["grid-column"]=!1,i["grid-column-end"]=!1,i["grid-column-start"]=!1,i["grid-row"]=!1,i["grid-row-end"]=!1,i["grid-row-start"]=!1,i["grid-template"]=!1,i["grid-template-areas"]=!1,i["grid-template-columns"]=!1,i["grid-template-rows"]=!1,i["hanging-punctuation"]=!1,i.height=!0,i.hyphens=!1,i.icon=!1,i["image-orientation"]=!1,i["image-resolution"]=!1,i["ime-mode"]=!1,i["initial-letters"]=!1,i["inline-box-align"]=!1,i["justify-content"]=!1,i["justify-items"]=!1,i["justify-self"]=!1,i.left=!1,i["letter-spacing"]=!0,i["lighting-color"]=!0,i["line-box-contain"]=!1,i["line-break"]=!1,i["line-grid"]=!1,i["line-height"]=!1,i["line-snap"]=!1,i["line-stacking"]=!1,i["line-stacking-ruby"]=!1,i["line-stacking-shift"]=!1,i["line-stacking-strategy"]=!1,i["list-style"]=!0,i["list-style-image"]=!0,i["list-style-position"]=!0,i["list-style-type"]=!0,i.margin=!0,i["margin-bottom"]=!0,i["margin-left"]=!0,i["margin-right"]=!0,i["margin-top"]=!0,i["marker-offset"]=!1,i["marker-side"]=!1,i.marks=!1,i.mask=!1,i["mask-box"]=!1,i["mask-box-outset"]=!1,i["mask-box-repeat"]=!1,i["mask-box-slice"]=!1,i["mask-box-source"]=!1,i["mask-box-width"]=!1,i["mask-clip"]=!1,i["mask-image"]=!1,i["mask-origin"]=!1,i["mask-position"]=!1,i["mask-repeat"]=!1,i["mask-size"]=!1,i["mask-source-type"]=!1,i["mask-type"]=!1,i["max-height"]=!0,i["max-lines"]=!1,i["max-width"]=!0,i["min-height"]=!0,i["min-width"]=!0,i["move-to"]=!1,i["nav-down"]=!1,i["nav-index"]=!1,i["nav-left"]=!1,i["nav-right"]=!1,i["nav-up"]=!1,i["object-fit"]=!1,i["object-position"]=!1,i.opacity=!1,i.order=!1,i.orphans=!1,i.outline=!1,i["outline-color"]=!1,i["outline-offset"]=!1,i["outline-style"]=!1,i["outline-width"]=!1,i.overflow=!1,i["overflow-wrap"]=!1,i["overflow-x"]=!1,i["overflow-y"]=!1,i.padding=!0,i["padding-bottom"]=!0,i["padding-left"]=!0,i["padding-right"]=!0,i["padding-top"]=!0,i.page=!1,i["page-break-after"]=!1,i["page-break-before"]=!1,i["page-break-inside"]=!1,i["page-policy"]=!1,i.pause=!1,i["pause-after"]=!1,i["pause-before"]=!1,i.perspective=!1,i["perspective-origin"]=!1,i.pitch=!1,i["pitch-range"]=!1,i["play-during"]=!1,i.position=!1,i["presentation-level"]=!1,i.quotes=!1,i["region-fragment"]=!1,i.resize=!1,i.rest=!1,i["rest-after"]=!1,i["rest-before"]=!1,i.richness=!1,i.right=!1,i.rotation=!1,i["rotation-point"]=!1,i["ruby-align"]=!1,i["ruby-merge"]=!1,i["ruby-position"]=!1,i["shape-image-threshold"]=!1,i["shape-outside"]=!1,i["shape-margin"]=!1,i.size=!1,i.speak=!1,i["speak-as"]=!1,i["speak-header"]=!1,i["speak-numeral"]=!1,i["speak-punctuation"]=!1,i["speech-rate"]=!1,i.stress=!1,i["string-set"]=!1,i["tab-size"]=!1,i["table-layout"]=!1,i["text-align"]=!0,i["text-align-last"]=!0,i["text-combine-upright"]=!0,i["text-decoration"]=!0,i["text-decoration-color"]=!0,i["text-decoration-line"]=!0,i["text-decoration-skip"]=!0,i["text-decoration-style"]=!0,i["text-emphasis"]=!0,i["text-emphasis-color"]=!0,i["text-emphasis-position"]=!0,i["text-emphasis-style"]=!0,i["text-height"]=!0,i["text-indent"]=!0,i["text-justify"]=!0,i["text-orientation"]=!0,i["text-overflow"]=!0,i["text-shadow"]=!0,i["text-space-collapse"]=!0,i["text-transform"]=!0,i["text-underline-position"]=!0,i["text-wrap"]=!0,i.top=!1,i.transform=!1,i["transform-origin"]=!1,i["transform-style"]=!1,i.transition=!1,i["transition-delay"]=!1,i["transition-duration"]=!1,i["transition-property"]=!1,i["transition-timing-function"]=!1,i["unicode-bidi"]=!1,i["vertical-align"]=!1,i.visibility=!1,i["voice-balance"]=!1,i["voice-duration"]=!1,i["voice-family"]=!1,i["voice-pitch"]=!1,i["voice-range"]=!1,i["voice-rate"]=!1,i["voice-stress"]=!1,i["voice-volume"]=!1,i.volume=!1,i["white-space"]=!1,i.widows=!1,i.width=!0,i["will-change"]=!1,i["word-break"]=!0,i["word-spacing"]=!0,i["word-wrap"]=!0,i["wrap-flow"]=!1,i["wrap-through"]=!1,i["writing-mode"]=!1,i["z-index"]=!1,i;}function sA(i,e,t){}function oA(i,e,t){}var aA=/javascript\s*\:/img;function lA(i,e){return aA.test(e)?"":e;}jn.whiteList=Lh();jn.getDefaultWhiteList=Lh;jn.onAttr=sA;jn.onIgnoreAttr=oA;jn.safeAttrValue=lA;var fA={indexOf:function indexOf(i,e){var t,r;if(Array.prototype.indexOf)return i.indexOf(e);for(t=0,r=i.length;t<r;t++)if(i[t]===e)return t;return-1;},forEach:function forEach(i,e,t){var r,n;if(Array.prototype.forEach)return i.forEach(e,t);for(r=0,n=i.length;r<n;r++)e.call(t,i[r],r,i);},trim:function trim(i){return String.prototype.trim?i.trim():i.replace(/(^\s*)|(\s*$)/g,"");},trimRight:function trimRight(i){return String.prototype.trimRight?i.trimRight():i.replace(/(\s*$)/g,"");}},ji=fA;function cA(i,e){i=ji.trimRight(i),i[i.length-1]!==";"&&(i+=";");var t=i.length,r=!1,n=0,s=0,c="";function l(){if(!r){var m=ji.trim(i.slice(n,s)),u=m.indexOf(":");if(u!==-1){var y=ji.trim(m.slice(0,u)),T=ji.trim(m.slice(u+1));if(y){var E=e(n,c.length,y,T,m);E&&(c+=E+"; ");}}}n=s+1;}for(;s<t;s++){var f=i[s];if(f==="/"&&i[s+1]==="*"){var h=i.indexOf("*/",s+2);if(h===-1)break;s=h+1,n=s+1,r=!1;}else f==="("?r=!0:f===")"?r=!1:f===";"?r||l():f==="\n"&&l();}return ji.trim(c);}var uA=cA,Vs=jn,hA=uA;function Eu(i){return i==null;}function dA(i){var e={};for(var t in i)e[t]=i[t];return e;}function Rh(i){i=dA(i||{}),i.whiteList=i.whiteList||Vs.whiteList,i.onAttr=i.onAttr||Vs.onAttr,i.onIgnoreAttr=i.onIgnoreAttr||Vs.onIgnoreAttr,i.safeAttrValue=i.safeAttrValue||Vs.safeAttrValue,this.options=i;}Rh.prototype.process=function(i){if(i=i||"",i=i.toString(),!i)return"";var e=this,t=e.options,r=t.whiteList,n=t.onAttr,s=t.onIgnoreAttr,c=t.safeAttrValue,l=hA(i,function(f,h,m,u,y){var T=r[m],E=!1;if(T===!0?E=T:typeof T=="function"?E=T(u):T instanceof RegExp&&(E=T.test(u)),E!==!0&&(E=!1),u=c(m,u),!!u){var C={position:h,sourcePosition:f,source:y,isWhite:E};if(E){var x=n(m,u,C);return Eu(x)?m+":"+u:x;}else{var x=s(m,u,C);if(!Eu(x))return x;}}});return l;};var pA=Rh;(function(i,e){var t=jn,r=pA;function n(c,l){var f=new r(l);return f.process(c);}e=i.exports=n,e.FilterCSS=r;for(var s in t)e[s]=t[s];(typeof window==="undefined"?"undefined":_typeof(window))<"u"&&(window.filterCSS=i.exports);})(ll,ll.exports);var El=ll.exports,Ml={indexOf:function indexOf(i,e){var t,r;if(Array.prototype.indexOf)return i.indexOf(e);for(t=0,r=i.length;t<r;t++)if(i[t]===e)return t;return-1;},forEach:function forEach(i,e,t){var r,n;if(Array.prototype.forEach)return i.forEach(e,t);for(r=0,n=i.length;r<n;r++)e.call(t,i[r],r,i);},trim:function trim(i){return String.prototype.trim?i.trim():i.replace(/(^\s*)|(\s*$)/g,"");},spaceIndex:function spaceIndex(i){var e=/\s|\n|\t/,t=e.exec(i);return t?t.index:-1;}},vA=El.FilterCSS,gA=El.getDefaultWhiteList,oo=Ml;function bh(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height","loading"],ins:["datetime"],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]};}var Dh=new vA();function mA(i,e,t){}function yA(i,e,t){}function PA(i,e,t){}function SA(i,e,t){}function Nh(i){return i.replace(TA,"<").replace(CA,">");}function xA(i,e,t,r){if(t=Xh(t),e==="href"||e==="src"){if(t=oo.trim(t),t==="#")return"#";if(!(t.substr(0,7)==="http://"||t.substr(0,8)==="https://"||t.substr(0,7)==="mailto:"||t.substr(0,4)==="tel:"||t.substr(0,11)==="data:image/"||t.substr(0,6)==="ftp://"||t.substr(0,2)==="./"||t.substr(0,3)==="../"||t[0]==="#"||t[0]==="/"))return"";}else if(e==="background"){if(Zs.lastIndex=0,Zs.test(t))return"";}else if(e==="style"){if(Mu.lastIndex=0,Mu.test(t)||(Lu.lastIndex=0,Lu.test(t)&&(Zs.lastIndex=0,Zs.test(t))))return"";r!==!1&&(r=r||Dh,t=r.process(t));}return t=zh(t),t;}var TA=/</g,CA=/>/g,IA=/"/g,OA=/"/g,wA=/&#([a-zA-Z0-9]*);?/gim,AA=/:?/gim,EA=/&newline;?/gim,Zs=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,Mu=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,Lu=/u\s*r\s*l\s*\(.*/gi;function Bh(i){return i.replace(IA,""");}function Wh(i){return i.replace(OA,'"');}function Fh(i){return i.replace(wA,function(t,r){return r[0]==="x"||r[0]==="X"?String.fromCharCode(parseInt(r.substr(1),16)):String.fromCharCode(parseInt(r,10));});}function Uh(i){return i.replace(AA,":").replace(EA," ");}function Yh(i){for(var e="",t=0,r=i.length;t<r;t++)e+=i.charCodeAt(t)<32?" ":i.charAt(t);return oo.trim(e);}function Xh(i){return i=Wh(i),i=Fh(i),i=Uh(i),i=Yh(i),i;}function zh(i){return i=Bh(i),i=Nh(i),i;}function MA(){return"";}function LA(i,e){typeof e!="function"&&(e=function e(){});var t=!Array.isArray(i);function r(c){return t?!0:oo.indexOf(i,c)!==-1;}var n=[],s=!1;return{onIgnoreTag:function onIgnoreTag(c,l,f){if(r(c)){if(f.isClosing){var h="[/removed]",m=f.position+h.length;return n.push([s!==!1?s:f.position,m]),s=!1,h;}else return s||(s=f.position),"[removed]";}else return e(c,l,f);},remove:function remove(c){var l="",f=0;return oo.forEach(n,function(h){l+=c.slice(f,h[0]),f=h[1];}),l+=c.slice(f),l;}};}function RA(i){for(var e="",t=0;t<i.length;){var r=i.indexOf("<!--",t);if(r===-1){e+=i.slice(t);break;}e+=i.slice(t,r);var n=i.indexOf("-->",r);if(n===-1)break;t=n+3;}return e;}function bA(i){var e=i.split("");return e=e.filter(function(t){var r=t.charCodeAt(0);return r===127?!1:r<=31?r===10||r===13:!0;}),e.join("");}ke.whiteList=bh();ke.getDefaultWhiteList=bh;ke.onTag=mA;ke.onIgnoreTag=yA;ke.onTagAttr=PA;ke.onIgnoreTagAttr=SA;ke.safeAttrValue=xA;ke.escapeHtml=Nh;ke.escapeQuote=Bh;ke.unescapeQuote=Wh;ke.escapeHtmlEntities=Fh;ke.escapeDangerHtml5Entities=Uh;ke.clearNonPrintableCharacter=Yh;ke.friendlyAttrValue=Xh;ke.escapeAttrValue=zh;ke.onIgnoreTagStripAll=MA;ke.StripTagBody=LA;ke.stripCommentTag=RA;ke.stripBlankChar=bA;ke.attributeWrapSign='"';ke.cssFilter=Dh;ke.getDefaultCSSWhiteList=gA;var xo={},wn=Ml;function DA(i){var e=wn.spaceIndex(i),t;return e===-1?t=i.slice(1,-1):t=i.slice(1,e+1),t=wn.trim(t).toLowerCase(),t.slice(0,1)==="/"&&(t=t.slice(1)),t.slice(-1)==="/"&&(t=t.slice(0,-1)),t;}function NA(i){return i.slice(0,2)==="</";}function BA(i,e,t){var r="",n=0,s=!1,c=!1,l=0,f=i.length,h="",m="";t:for(l=0;l<f;l++){var u=i.charAt(l);if(s===!1){if(u==="<"){s=l;continue;}}else if(c===!1){if(u==="<"){r+=t(i.slice(n,l)),s=l,n=l;continue;}if(u===">"||l===f-1){r+=t(i.slice(n,s)),m=i.slice(s,l+1),h=DA(m),r+=e(s,r.length,h,m,NA(m)),n=l+1,s=!1;continue;}if(u==='"'||u==="'")for(var y=1,T=i.charAt(l-y);T.trim()===""||T==="=";){if(T==="="){c=u;continue t;}T=i.charAt(l-++y);}}else if(u===c){c=!1;continue;}}return n<f&&(r+=t(i.substr(n))),r;}var WA=/[^a-zA-Z0-9\\_:.-]/gim;function FA(i,e){var t=0,r=0,n=[],s=!1,c=i.length;function l(y,T){if(y=wn.trim(y),y=y.replace(WA,"").toLowerCase(),!(y.length<1)){var E=e(y,T||"");E&&n.push(E);}}for(var f=0;f<c;f++){var h=i.charAt(f),m,u;if(s===!1&&h==="="){s=i.slice(t,f),t=f+1,r=i.charAt(t)==='"'||i.charAt(t)==="'"?t:YA(i,f+1);continue;}if(s!==!1&&f===r){if(u=i.indexOf(h,f+1),u===-1)break;m=wn.trim(i.slice(r+1,u)),l(s,m),s=!1,f=u,t=f+1;continue;}if(/\s|\n|\t/.test(h))if(i=i.replace(/\s|\n|\t/g," "),s===!1){if(u=UA(i,f),u===-1){m=wn.trim(i.slice(t,f)),l(m),s=!1,t=f+1;continue;}else{f=u-1;continue;}}else if(u=XA(i,f-1),u===-1){m=wn.trim(i.slice(t,f)),m=Ru(m),l(s,m),s=!1,t=f+1;continue;}else continue;}return t<i.length&&(s===!1?l(i.slice(t)):l(s,Ru(wn.trim(i.slice(t))))),wn.trim(n.join(" "));}function UA(i,e){for(;e<i.length;e++){var t=i[e];if(t!==" ")return t==="="?e:-1;}}function YA(i,e){for(;e<i.length;e++){var t=i[e];if(t!==" ")return t==="'"||t==='"'?e:-1;}}function XA(i,e){for(;e>0;e--){var t=i[e];if(t!==" ")return t==="="?e:-1;}}function zA(i){return i[0]==='"'&&i[i.length-1]==='"'||i[0]==="'"&&i[i.length-1]==="'";}function Ru(i){return zA(i)?i.substr(1,i.length-2):i;}xo.parseTag=BA;xo.parseAttr=FA;var $A=El.FilterCSS,Xr=ke,$h=xo,jA=$h.parseTag,GA=$h.parseAttr,_s=Ml;function Js(i){return i==null;}function HA(i){var e=_s.spaceIndex(i);if(e===-1)return{html:"",closing:i[i.length-2]==="/"};i=_s.trim(i.slice(e+1,-1));var t=i[i.length-1]==="/";return t&&(i=_s.trim(i.slice(0,-1))),{html:i,closing:t};}function kA(i){var e={};for(var t in i)e[t]=i[t];return e;}function KA(i){var e={};for(var t in i)Array.isArray(i[t])?e[t.toLowerCase()]=i[t].map(function(r){return r.toLowerCase();}):e[t.toLowerCase()]=i[t];return e;}function jh(i){i=kA(i||{}),i.stripIgnoreTag&&(i.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),i.onIgnoreTag=Xr.onIgnoreTagStripAll),i.whiteList||i.allowList?i.whiteList=KA(i.whiteList||i.allowList):i.whiteList=Xr.whiteList,this.attributeWrapSign=i.singleQuotedAttributeValue===!0?"'":Xr.attributeWrapSign,i.onTag=i.onTag||Xr.onTag,i.onTagAttr=i.onTagAttr||Xr.onTagAttr,i.onIgnoreTag=i.onIgnoreTag||Xr.onIgnoreTag,i.onIgnoreTagAttr=i.onIgnoreTagAttr||Xr.onIgnoreTagAttr,i.safeAttrValue=i.safeAttrValue||Xr.safeAttrValue,i.escapeHtml=i.escapeHtml||Xr.escapeHtml,this.options=i,i.css===!1?this.cssFilter=!1:(i.css=i.css||{},this.cssFilter=new $A(i.css));}jh.prototype.process=function(i){if(i=i||"",i=i.toString(),!i)return"";var e=this,t=e.options,r=t.whiteList,n=t.onTag,s=t.onIgnoreTag,c=t.onTagAttr,l=t.onIgnoreTagAttr,f=t.safeAttrValue,h=t.escapeHtml,m=e.attributeWrapSign,u=e.cssFilter;t.stripBlankChar&&(i=Xr.stripBlankChar(i)),t.allowCommentTag||(i=Xr.stripCommentTag(i));var y=!1;t.stripIgnoreTagBody&&(y=Xr.StripTagBody(t.stripIgnoreTagBody,s),s=y.onIgnoreTag);var T=jA(i,function(E,C,x,I,d){var v={sourcePosition:E,position:C,isClosing:d,isWhite:Object.prototype.hasOwnProperty.call(r,x)},p=n(x,I,v);if(!Js(p))return p;if(v.isWhite){if(v.isClosing)return"</"+x+">";var S=HA(I),A=r[x],R=GA(S.html,function(D,U){var M=_s.indexOf(A,D)!==-1,W=c(x,D,U,M);return Js(W)?M?(U=f(x,D,U,u),U?D+"="+m+U+m:D):(W=l(x,D,U,M),Js(W)?void 0:W):W;});return I="<"+x,R&&(I+=" "+R),S.closing&&(I+=" /"),I+=">",I;}else return p=s(x,I,v),Js(p)?h(I):p;},h);return y&&(T=y.remove(T)),T;};var VA=jh;(function(i,e){var t=ke,r=xo,n=VA;function s(l,f){var h=new n(f);return h.process(l);}e=i.exports=s,e.filterXSS=s,e.FilterXSS=n,function(){for(var l in t)e[l]=t[l];for(var f in r)e[f]=r[f];}(),(typeof window==="undefined"?"undefined":_typeof(window))<"u"&&(window.filterXSS=i.exports);function c(){return(typeof self==="undefined"?"undefined":_typeof(self))<"u"&&(typeof DedicatedWorkerGlobalScope==="undefined"?"undefined":_typeof(DedicatedWorkerGlobalScope))<"u"&&self instanceof DedicatedWorkerGlobalScope;}c()&&(self.filterXSS=i.exports);})(Au,Au.exports);var ao={exports:{}};/**
|
|
436
|
+
*/},{key:"threeBezier",value:function threeBezier(e,t,r,n,s){var c=t.x*(1-e)*(1-e)*(1-e)+3*r.x*e*(1-e)*(1-e)+3*n.x*e*e*(1-e)+s.x*e*e*e,l=t.y*(1-e)*(1-e)*(1-e)+3*r.y*e*(1-e)*(1-e)+3*n.y*e*e*(1-e)+s.y*e*e*e;return new pt(c,l);}}]);}();var Eh=/*#__PURE__*/function(_$t10){function Eh(t){var _this81;_classCallCheck(this,Eh);_this81=_callSuper(this,Eh,[t]);dt(_this81,"canRotate",!1);dt(_this81,"scaleType",Ae.all);dt(_this81,"toolsType",Tt.SpeechBalloon);dt(_this81,"ratio",0.8);dt(_this81,"tmpPoints",[]);dt(_this81,"workOptions");dt(_this81,"oldRect");dt(_this81,"syncTimestamp");_this81.workOptions=t.toolsOpt,_this81.syncTimestamp=0,_this81.syncUnitTime=50;return _this81;}_inherits(Eh,_$t10);return _createClass(Eh,[{key:"consume",value:function consume(t){var C;var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=(C=r==null?void 0:r.workId)==null?void 0:C.toString();if(!h)return{type:xt.None};var m=r.op,u=m==null?void 0:m.length;if(!u||u<2)return{type:xt.None};var y;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],y=!1):y=this.updateTempPoints(m),!y)return{type:xt.None};var T;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;T=this.draw({workId:h,layer:x,isDrawing:!0});}if(f){var _x46=Zt(T,this.oldRect);this.oldRect=T;var _I43=_objectSpread({rect:_x46,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d38=Date.now();_d38-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d38,_I43.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I43.index=0,_I43.isSync=!0);}return _I43;}if(!s&&l){var _x47=Date.now();return _x47-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x47,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var E=Zt(T,this.oldRect);return this.oldRect=T,_objectSpread({rect:E,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r,isDrawing:!1});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,_t$isDrawEraserlines5=t.isDrawEraserlines,s=_t$isDrawEraserlines5===void 0?!0:_t$isDrawEraserlines5,_this$workOptions12=this.workOptions,c=_this$workOptions12.strokeColor,l=_this$workOptions12.fillColor,f=_this$workOptions12.thickness,h=_this$workOptions12.zIndex,m=_this$workOptions12.placement,u=_this$workOptions12.scale,y=_this$workOptions12.rotate,T=_this$workOptions12.translate,E=_this$workOptions12.strokeType,C=_this$workOptions12.eraserlines,x=_this$workOptions12.lineDash,I=_this$workOptions12.lineCap,_this$computDrawPoint8=this.computDrawPoints(f,m),d=_this$computDrawPoint8.rect,v=_this$computDrawPoint8.pos,p=_this$computDrawPoint8.points,S={points:p.map(function(M){return M.XY;}),lineWidth:f,fillColor:l!=="transparent"&&l||void 0,strokeColor:c,normalize:!0,className:"".concat(v[0],",").concat(v[1]),close:!0,lineCap:I,lineDash:E===we.Dotted?[x&&x[0]||1,(x&&x[1]||2)*f]:E===we.LongDotted?[(x&&x[0]||1)*f,(x&&x[1]||2)*f]:void 0},A={name:r,id:r,zIndex:h,pos:v,anchor:[0.5,0.5],size:[d.w,d.h]};u&&(A.scale=u),y&&(A.rotate=y),T&&(A.translate=T);var R=new mr(A),D=new dn(_objectSpread(_objectSpread({},S),{},{pos:[0,0]}));R.append(D),C&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:R,eraserlines:C,pos:v,layer:n},s)),this.replace(n,r,R);var U=R.getBoundingClientRect();return this.isDelete&&R.setAttribute("opacity",0),{x:Math.floor(U.x-$t.SafeBorderPadding),y:Math.floor(U.y-$t.SafeBorderPadding),w:Math.floor(U.width+$t.SafeBorderPadding*2),h:Math.floor(U.height+$t.SafeBorderPadding*2)};}},{key:"transformControlPoints",value:function transformControlPoints(t){var r=Re(this.tmpPoints);switch(t){case"bottom":case"bottomLeft":case"bottomRight":{var n=r.y+r.h*this.ratio;return[new pt(r.x,r.y,0),new pt(r.x+r.w,r.y,0),new pt(r.x+r.w,n,0),new pt(r.x,n,0)];}case"top":case"topLeft":case"topRight":{var _n4=r.y+r.h*(1-this.ratio);return[new pt(r.x,_n4,0),new pt(r.x+r.w,_n4,0),new pt(r.x+r.w,r.y+r.h,0),new pt(r.x,r.y+r.h,0)];}case"left":case"leftBottom":case"leftTop":{var _n5=r.x+r.w*(1-this.ratio);return[new pt(_n5,r.y,0),new pt(r.x+r.w,r.y,0),new pt(r.x+r.w,r.y+r.h,0),new pt(_n5,r.y+r.h,0)];}case"right":case"rightBottom":case"rightTop":{var _n6=r.x+r.w*this.ratio;return[new pt(r.x,r.y,0),new pt(_n6,r.y,0),new pt(_n6,r.y+r.h,0),new pt(r.x,r.y+r.h,0)];}}}},{key:"computDrawPoints",value:function computDrawPoints(t,r){var n=Re(this.tmpPoints),s=this.transformControlPoints(r),c=Math.floor(n.w*0.1),l=Math.floor(n.h*0.1),f=[],h=pt.Add(s[0],new pt(0,l,0)),m=pt.Add(s[0],new pt(c,0,0)),u=Hr.getBezierPoints(10,h,s[0],m),y=pt.Sub(s[1],new pt(c,0,0)),T=pt.Add(s[1],new pt(0,l,0)),E=Hr.getBezierPoints(10,y,s[1],T),C=pt.Sub(s[2],new pt(0,l,0)),x=pt.Sub(s[2],new pt(c,0,0)),I=Hr.getBezierPoints(10,C,s[2],x),d=pt.Add(s[3],new pt(c,0,0)),v=pt.Sub(s[3],new pt(0,l,0)),p=Hr.getBezierPoints(10,d,s[3],v),S=c*(1-this.ratio)*10,A=l*(1-this.ratio)*10;switch(r){case"bottom":{var U=pt.Sub(s[2],new pt(c*5-S/2,0,0)),M=pt.Sub(s[2],new pt(c*5,-A,0)),W=pt.Sub(s[2],new pt(c*5+S/2,0,0));f.push.apply(f,[M,W].concat(_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),[U]));break;}case"bottomRight":{var _U13=pt.Sub(s[2],new pt(c*1.1,0,0)),_M10=pt.Sub(s[2],new pt(c*1.1+S/2,-A,0)),_W8=pt.Sub(s[2],new pt(c*1.1+S,0,0));f.push.apply(f,[_M10,_W8].concat(_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),[_U13]));break;}case"bottomLeft":{var _U14=pt.Add(s[3],new pt(c*1.1+S,0,0)),_M11=pt.Add(s[3],new pt(c*1.1+S/2,A,0)),_W9=pt.Add(s[3],new pt(c*1.1,0,0));f.push.apply(f,[_M11,_W9].concat(_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),[_U14]));break;}case"top":{var _U15=pt.Sub(s[1],new pt(c*5-S/2,0,0)),_M12=pt.Sub(s[1],new pt(c*5,A,0)),_W10=pt.Sub(s[1],new pt(c*5+S/2,0,0));f.push.apply(f,[_M12,_U15].concat(_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),[_W10]));break;}case"topRight":{var _U16=pt.Sub(s[1],new pt(c*1.1,0,0)),_M13=pt.Sub(s[1],new pt(c*1.1+S/2,A,0)),_W11=pt.Sub(s[1],new pt(c*1.1+S,0,0));f.push.apply(f,[_M13,_U16].concat(_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),[_W11]));break;}case"topLeft":{var _U17=pt.Add(s[0],new pt(c*1.1+S,0,0)),_M14=pt.Add(s[0],new pt(c*1.1+S/2,-A,0)),_W12=pt.Add(s[0],new pt(c*1.1,0,0));f.push.apply(f,[_M14,_U17].concat(_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),[_W12]));break;}case"left":{var _U18=pt.Add(s[0],new pt(0,l*5-A/2,0)),_M15=pt.Add(s[0],new pt(-S,l*5,0)),_W13=pt.Add(s[0],new pt(0,l*5+A/2,0));f.push.apply(f,[_M15,_U18].concat(_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),[_W13]));break;}case"leftTop":{var _U19=pt.Add(s[0],new pt(0,l*1.1,0)),_M16=pt.Add(s[0],new pt(-S,l*1.1+A/2,0)),_W14=pt.Add(s[0],new pt(0,l*1.1+A,0));f.push.apply(f,[_M16,_U19].concat(_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),[_W14]));break;}case"leftBottom":{var _U20=pt.Sub(s[3],new pt(0,l*1.1+A,0)),_M17=pt.Sub(s[3],new pt(S,l*1.1+A/2,0)),_W15=pt.Sub(s[3],new pt(0,l*1.1,0));f.push.apply(f,[_M17,_U20].concat(_toConsumableArray(u),_toConsumableArray(E),_toConsumableArray(I),_toConsumableArray(p),[_W15]));break;}case"right":{var _U21=pt.Add(s[1],new pt(0,l*5-A/2,0)),_M18=pt.Add(s[1],new pt(S,l*5,0)),_W16=pt.Add(s[1],new pt(0,l*5+A/2,0));f.push.apply(f,[_M18,_W16].concat(_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),[_U21]));break;}case"rightTop":{var _U22=pt.Add(s[1],new pt(0,l*1.1,0)),_M19=pt.Add(s[1],new pt(S,l*1.1+A/2,0)),_W17=pt.Add(s[1],new pt(0,l*1.1+A,0));f.push.apply(f,[_M19,_W17].concat(_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),[_U22]));break;}case"rightBottom":{var _U23=pt.Sub(s[2],new pt(0,l*1.1+A,0)),_M20=pt.Sub(s[2],new pt(-S,l*1.1+A/2,0)),_W18=pt.Sub(s[2],new pt(0,l*1.1,0));f.push.apply(f,[_M20,_W18].concat(_toConsumableArray(I),_toConsumableArray(p),_toConsumableArray(u),_toConsumableArray(E),[_U23]));break;}}var R=Re(this.tmpPoints,t),D=[Math.floor(R.x+R.w/2),Math.floor(R.y+R.h/2)];return{rect:R,pos:D,points:f};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c)||Jt.Sub(s,n).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState7=t.workState,s=_t$workState7===void 0?te.Done:_t$workState7,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var E;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.fillColor,f=n.toolsType,h=n.placement,m=n.strokeType,u=s.get(r.name),y=u==null?void 0:u.opt;var T=r;return r.tagName==="GROUP"&&(T=r.children[0]),c&&(T.setAttribute("strokeColor",c),y!=null&&y.strokeColor&&(y.strokeColor=c)),l&&(l==="transparent"?T.setAttribute("fillColor","rgba(0,0,0,0)"):T.setAttribute("fillColor",l),y!=null&&y.fillColor&&(y.fillColor=l)),f===Tt.SpeechBalloon&&h&&(y.placement=h),m&&u!=null&&u.opt&&(E=u.opt)!=null&&E.strokeType&&(u.opt.strokeType=m),u&&s.setInfo(r.name,_objectSpread(_objectSpread({},u),{},{opt:y})),$t.updateNodeOpt(t);}}]);}($t);var tA=Si,eA=pn,rA="[object Boolean]";function nA(i){return i===!0||i===!1||eA(i)&&tA(i)==rA;}var iA=nA,di=/* @__PURE__ */Ln(iA);var ki=/*#__PURE__*/function(_$t11){function ki(t){var _this82;_classCallCheck(this,ki);_this82=_callSuper(this,ki,[t]);dt(_this82,"canRotate",!0);dt(_this82,"scaleType",Ae.all);dt(_this82,"toolsType",Tt.Image);dt(_this82,"tmpPoints",[]);dt(_this82,"workOptions");dt(_this82,"oldRect");_this82.workOptions=t.toolsOpt,_this82.scaleType=ki.getScaleType(_this82.workOptions);return _this82;}_inherits(ki,_$t11);return _createClass(ki,[{key:"consume",value:function consume(){return{type:xt.None};}},{key:"consumeAll",value:function consumeAll(){return{type:xt.None};}},{key:"draw",value:function draw(t){var r=t.layer,n=t.workId,s=t.replaceId,c=t.imageBitmap,_this$workOptions13=this.workOptions,l=_this$workOptions13.centerX,f=_this$workOptions13.centerY,h=_this$workOptions13.width,m=_this$workOptions13.height,u=_this$workOptions13.rotate,y=_this$workOptions13.zIndex,T=_this$workOptions13.eraserlines,E=new mr({anchor:[0.5,0.5],pos:[l,f],name:n,size:[h,m],zIndex:y,rotate:u}),C={anchor:[0.5,0.5],pos:[0,0],size:[h,m],texture:c};c||(C.bgcolor="rgba(0,0,0,0.3)");var x=new Yu(C);E.append(x),T&&this.drawEraserlines({group:E,eraserlines:T,pos:[l,f],layer:r}),this.replace(r,s||n,E);var I=E.getBoundingClientRect();if(I)return{x:Math.floor(I.x-$t.SafeBorderPadding),y:Math.floor(I.y-$t.SafeBorderPadding),w:Math.floor(I.width+$t.SafeBorderPadding*2),h:Math.floor(I.height+$t.SafeBorderPadding*2)};}},{key:"consumeService",value:function consumeService(){}},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(t){var m,u,y,T,r,n,s,_this$workOptions14,c,l,f,h,E,C;return _regeneratorRuntime().wrap(function _callee23$(_context25){while(1)switch(_context25.prev=_context25.next){case 0:r=t.isFullWork,n=t.replaceId,s=t.worker,_this$workOptions14=this.workOptions,c=_this$workOptions14.src,l=_this$workOptions14.uuid,f=((m=this.workId)==null?void 0:m.toString())||l,h=r?this.fullLayer:this.drawLayer||this.fullLayer;if(!c){_context25.next=8;break;}_context25.next=4;return s.loadImageBitMap({toolsType:this.toolsType,opt:this.workOptions,workId:f,isSubWorker:s instanceof id});case 4:E=_context25.sent;if(!E){_context25.next=8;break;}C=this.draw({workId:f,layer:h,replaceId:n,imageBitmap:E});return _context25.abrupt("return",(this.oldRect=f&&((y=(u=this.vNodes)==null?void 0:u.get(f))==null?void 0:y.rect)||void 0,(T=this.vNodes)==null||T.setInfo(f,{rect:C,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:C&&$t.getCenterPos(C,h)}),C));case 8:case"end":return _context25.stop();}},_callee23,this);}));function consumeServiceAsync(_x48){return _consumeServiceAsync.apply(this,arguments);}return consumeServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"getScaleType",value:function getScaleType(t){var r=t.uniformScale,n=t.rotate;return r!==!1||n&&Math.abs(n)%90>0?Ae.proportional:Ae.all;}},{key:"updateNodeOpt",value:function updateNodeOpt(t){var r=t.node,n=t.opt,s=t.vNodes,c=t.targetNode,l=n.translate,f=n.originPoint,h=n.scenePoint,m=n.scale,u=n.angle,y=n.isLocked,T=n.zIndex,E=n.strokeColor,C=c&&fr(c)||s.get(r.name);if(!C)return;var x=r.parent;if(x){if(E&&(C.opt.strokeColor=E),er(T)&&(r.setAttribute("zIndex",T),C.opt.zIndex=T),di(y)&&(C.opt.locked=y),f&&h&&m&&l){var _C$opt=C.opt,_I44=_C$opt.centerX,_d39=_C$opt.centerY,v=_C$opt.width,p=_C$opt.height,S=_C$opt.uniformScale,A=S!==!1?[m[0],m[0]]:m,R=[_I44,_d39],D=[_I44,_d39];Ll(D,h,A,l);var U=[D[0]-R[0],D[1]-R[1]];if(C.centerPos=[C.centerPos[0]+U[0],C.centerPos[1]+U[1]],C.opt.width=Math.round(v*A[0]),C.opt.height=Math.round(p*A[1]),C.opt.centerX=D[0],C.opt.centerY=D[1],C.opt.eraserlines){var _iterator31=_createForOfIteratorHelper(C.opt.eraserlines),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var M=_step31.value;var W=M.op,Y=M.thickness;M.thickness=Math.round(Y*Math.max(m[0],m[1]));for(var B=0;B<W.length;B++)Rl(W[B],h,m,l);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}}else if(l){if(C.opt.centerX=C.opt.centerX+l[0],C.opt.centerY=C.opt.centerY+l[1],C.centerPos=[C.centerPos[0]+l[0],C.centerPos[1]+l[1]],C.opt.eraserlines){var _iterator32=_createForOfIteratorHelper(C.opt.eraserlines),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _I45=_step32.value;var _d40=_I45.op;for(var _v12=0;_v12<_d40.length;_v12++){var _p15=_d40[_v12].map(function(S,A){return A%2?S+l[1]:S+l[0];});_I45.op[_v12]=_p15;}}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}}}else if(er(u))if(C.opt.rotate=u,C.scaleType=ki.getScaleType(C.opt),c){var _I46=kh(C.rect,u);C.rect=_I46;}else{var _I47=$t.getRectFromLayer(x,r.name);C.rect=_I47||C.rect;}return C&&s.setInfo(r.name,C),C==null?void 0:C.rect;}}}]);}($t);var Mh=/*#__PURE__*/function(_$t12){function Mh(t){var _this83;_classCallCheck(this,Mh);_this83=_callSuper(this,Mh,[t]);dt(_this83,"canRotate",!1);dt(_this83,"scaleType",Ae.both);dt(_this83,"toolsType",Tt.Straight);dt(_this83,"tmpPoints",[]);dt(_this83,"workOptions");dt(_this83,"oldRect");dt(_this83,"straightTipWidth");dt(_this83,"syncTimestamp");_this83.workOptions=t.toolsOpt,_this83.straightTipWidth=_this83.workOptions.thickness/2,_this83.syncTimestamp=0,_this83.syncUnitTime=50;return _this83;}_inherits(Mh,_$t12);return _createClass(Mh,[{key:"consume",value:function consume(t){var r=t.data,n=t.isFullWork,s=t.isSubWorker,c=t.isMainThread,l=t.smoothSync,f=t.isSimpleWorker,h=this.workId,m=r.op,u=r.syncUnitTime,y=m==null?void 0:m.length;if(!y||y<2)return{type:xt.None};u&&(this.syncUnitTime=u);var T;if(this.tmpPoints.length===0?(this.tmpPoints=[new Jt(m[0],m[1])],T=!1):T=this.updateTempPoints(m),!T)return{type:xt.None};var E;if(s||c||f){var x=n?this.fullLayer:this.drawLayer||this.fullLayer;E=this.draw({workId:h,layer:x});}if(f){var _x49=Zt(E,this.oldRect);this.oldRect=E;var _I48=_objectSpread({rect:_x49,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);if(l){var _d41=Date.now();_d41-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_d41,_I48.op=this.tmpPoints.map(function(v){return[].concat(_toConsumableArray(v.XY),[0]);}).flat(1),_I48.index=0,_I48.isSync=!0);}return _I48;}if(!s&&l){var _x50=Date.now();return _x50-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_x50,_objectSpread({type:xt.DrawWork,dataType:Vt.Local,op:this.tmpPoints.map(function(I){return[].concat(_toConsumableArray(I.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:xt.None};}var C=Zt(E,this.oldRect);return this.oldRect=E,_objectSpread({rect:C,type:xt.DrawWork,dataType:Vt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var l;var t=this.workId;if(this.tmpPoints.length<2)return{type:xt.RemoveNode,removeIds:[t]};var r=this.fullLayer,n=this.draw({workId:t,layer:r});this.oldRect=n;var s=this.tmpPoints.map(function(f){return[].concat(_toConsumableArray(f.XY),[0]);}).flat(1),c=gr(s);return(l=this.vNodes)==null||l.setInfo(t,{rect:n,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&$t.getCenterPos(n,r)}),_objectSpread(_objectSpread({rect:n,type:xt.FullWork,dataType:Vt.Local,ops:c,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var r=t.workId,n=t.layer,_t$isDrawEraserlines6=t.isDrawEraserlines,s=_t$isDrawEraserlines6===void 0?!0:_t$isDrawEraserlines6,_this$workOptions15=this.workOptions,c=_this$workOptions15.strokeColor,l=_this$workOptions15.thickness,f=_this$workOptions15.zIndex,h=_this$workOptions15.scale,m=_this$workOptions15.rotate,u=_this$workOptions15.translate,y=_this$workOptions15.strokeType,T=_this$workOptions15.eraserlines,E=_this$workOptions15.lineCap,C=_this$workOptions15.lineDash,x=n.worldPosition,I=n.worldScaling,_this$computDrawPoint9=this.computDrawPoints(l,y),d=_this$computDrawPoint9.d,v=_this$computDrawPoint9.rect,p=_this$computDrawPoint9.isDot,S=[v.x+v.w/2,v.y+v.h/2],A=new mr({pos:S,anchor:[0.5,0.5],size:[v.w,v.h],name:r,id:r,normalize:!0,zIndex:f}),R={pos:[0,0],normalize:!0,d:d,fillColor:c,strokeColor:c,lineDash:p?void 0:y===we.Dotted?[C&&C[0]||1,(C&&C[1]||2)*l]:y===we.LongDotted?[(C&&C[0]||1)*l,(C&&C[1]||2)*l]:void 0,lineCap:p?void 0:E,lineWidth:y===we.Normal||p?0:l};h&&(R.scale=h),m&&(R.rotate=m),u&&(R.translate=u);var D=new Mn(R);A.append(D),T&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:A,eraserlines:T,pos:S,layer:n},s)),this.replace(n,r,A);var U={x:Math.floor(v.x*I[0]+x[0]-$t.SafeBorderPadding),y:Math.floor(v.y*I[1]+x[1]-$t.SafeBorderPadding),w:Math.floor(v.w*I[0]+2*$t.SafeBorderPadding),h:Math.floor(v.h*I[1]+2*$t.SafeBorderPadding)};if(m||h||u){var M=D.getBoundingClientRect();U={x:Math.floor(M.x-$t.SafeBorderPadding),y:Math.floor(M.y-$t.SafeBorderPadding),w:Math.floor(M.width+$t.SafeBorderPadding*2),h:Math.floor(M.height+$t.SafeBorderPadding*2)};}return this.isDelete&&A.setAttribute("opacity",0),U;}},{key:"computDrawPoints",value:function computDrawPoints(t,r){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.straightTipWidth?this.computFullPoints(t,r):this.computDotPoints(t);}},{key:"computFullPoints",value:function computFullPoints(t,r){var n=pt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),s=pt.Per(n).mul(t/2),c=Jt.Sub(this.tmpPoints[0],s),l=Jt.Add(this.tmpPoints[0],s),f=Jt.Sub(this.tmpPoints[1],s),h=Jt.Add(this.tmpPoints[1],s),m=Jt.GetSemicircleStroke(this.tmpPoints[1],f,-1,8),u=Jt.GetSemicircleStroke(this.tmpPoints[0],l,-1,8),y=[c,f].concat(_toConsumableArray(m),[h,l],_toConsumableArray(u));var T;return r!==we.Normal?T=En(this.tmpPoints,!1):T=En(y,!0),{d:T,rect:Re(y),isDot:!1,pos:this.tmpPoints[0].XY};}},{key:"computDotPoints",value:function computDotPoints(t){var r=Jt.GetDotStroke(this.tmpPoints[0],t/2,8);return{d:En(r,!0),rect:Re(r),isDot:!0,pos:this.tmpPoints[0].XY};}},{key:"updateTempPoints",value:function updateTempPoints(t){var r=t.slice(-2),n=new Jt(r[0],r[1]),s=this.tmpPoints[0],c=this.workOptions.thickness;if(s.isNear(n,c))return!1;if(this.tmpPoints.length===2){if(n.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=n;}else this.tmpPoints.push(n);return!0;}},{key:"consumeService",value:function consumeService(t){var h,m;var r=t.op,n=t.isFullWork,_t$workState8=t.workState,s=_t$workState8===void 0?te.Done:_t$workState8,c=(h=this.workId)==null?void 0:h.toString();if(!c)return;this.tmpPoints.length=0;for(var u=0;u<r.length;u+=3)this.tmpPoints.push(new Jt(r[u],r[u+1],r[u+2]));var l=n?this.fullLayer:this.drawLayer||this.fullLayer,f=this.draw({workId:c,layer:l,isDrawEraserlines:s===te.Done});return this.oldRect=f,(m=this.vNodes)==null||m.setInfo(c,{rect:f,op:r,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:f&&$t.getCenterPos(f,l)}),f;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var h,m;var r=t.node,n=t.opt,s=t.vNodes,c=n.strokeColor,l=n.strokeType,f=s.get(r.name);return c&&(r.tagName==="GROUP"?r.children.forEach(function(u){u.setAttribute("strokeColor",c),u.getAttribute("fillColor")&&u.setAttribute("fillColor",c);}):(r.setAttribute("strokeColor",c),r.setAttribute("fillColor",c)),(h=f==null?void 0:f.opt)!=null&&h.strokeColor&&(f.opt.strokeColor=c)),l&&f!=null&&f.opt&&(m=f.opt)!=null&&m.strokeType&&(f.opt.strokeType=l),f&&s.setInfo(r.name,f),$t.updateNodeOpt(t);}}]);}($t);var pi="cursorhover",wu=20,$n="mainView";var Au={exports:{}},ke={},ll={exports:{}},Gn={};function Lh(){var i={};return i["align-content"]=!1,i["align-items"]=!1,i["align-self"]=!1,i["alignment-adjust"]=!1,i["alignment-baseline"]=!1,i.all=!1,i["anchor-point"]=!1,i.animation=!1,i["animation-delay"]=!1,i["animation-direction"]=!1,i["animation-duration"]=!1,i["animation-fill-mode"]=!1,i["animation-iteration-count"]=!1,i["animation-name"]=!1,i["animation-play-state"]=!1,i["animation-timing-function"]=!1,i.azimuth=!1,i["backface-visibility"]=!1,i.background=!0,i["background-attachment"]=!0,i["background-clip"]=!0,i["background-color"]=!0,i["background-image"]=!0,i["background-origin"]=!0,i["background-position"]=!0,i["background-repeat"]=!0,i["background-size"]=!0,i["baseline-shift"]=!1,i.binding=!1,i.bleed=!1,i["bookmark-label"]=!1,i["bookmark-level"]=!1,i["bookmark-state"]=!1,i.border=!0,i["border-bottom"]=!0,i["border-bottom-color"]=!0,i["border-bottom-left-radius"]=!0,i["border-bottom-right-radius"]=!0,i["border-bottom-style"]=!0,i["border-bottom-width"]=!0,i["border-collapse"]=!0,i["border-color"]=!0,i["border-image"]=!0,i["border-image-outset"]=!0,i["border-image-repeat"]=!0,i["border-image-slice"]=!0,i["border-image-source"]=!0,i["border-image-width"]=!0,i["border-left"]=!0,i["border-left-color"]=!0,i["border-left-style"]=!0,i["border-left-width"]=!0,i["border-radius"]=!0,i["border-right"]=!0,i["border-right-color"]=!0,i["border-right-style"]=!0,i["border-right-width"]=!0,i["border-spacing"]=!0,i["border-style"]=!0,i["border-top"]=!0,i["border-top-color"]=!0,i["border-top-left-radius"]=!0,i["border-top-right-radius"]=!0,i["border-top-style"]=!0,i["border-top-width"]=!0,i["border-width"]=!0,i.bottom=!1,i["box-decoration-break"]=!0,i["box-shadow"]=!0,i["box-sizing"]=!0,i["box-snap"]=!0,i["box-suppress"]=!0,i["break-after"]=!0,i["break-before"]=!0,i["break-inside"]=!0,i["caption-side"]=!1,i.chains=!1,i.clear=!0,i.clip=!1,i["clip-path"]=!1,i["clip-rule"]=!1,i.color=!0,i["color-interpolation-filters"]=!0,i["column-count"]=!1,i["column-fill"]=!1,i["column-gap"]=!1,i["column-rule"]=!1,i["column-rule-color"]=!1,i["column-rule-style"]=!1,i["column-rule-width"]=!1,i["column-span"]=!1,i["column-width"]=!1,i.columns=!1,i.contain=!1,i.content=!1,i["counter-increment"]=!1,i["counter-reset"]=!1,i["counter-set"]=!1,i.crop=!1,i.cue=!1,i["cue-after"]=!1,i["cue-before"]=!1,i.cursor=!1,i.direction=!1,i.display=!0,i["display-inside"]=!0,i["display-list"]=!0,i["display-outside"]=!0,i["dominant-baseline"]=!1,i.elevation=!1,i["empty-cells"]=!1,i.filter=!1,i.flex=!1,i["flex-basis"]=!1,i["flex-direction"]=!1,i["flex-flow"]=!1,i["flex-grow"]=!1,i["flex-shrink"]=!1,i["flex-wrap"]=!1,i["float"]=!1,i["float-offset"]=!1,i["flood-color"]=!1,i["flood-opacity"]=!1,i["flow-from"]=!1,i["flow-into"]=!1,i.font=!0,i["font-family"]=!0,i["font-feature-settings"]=!0,i["font-kerning"]=!0,i["font-language-override"]=!0,i["font-size"]=!0,i["font-size-adjust"]=!0,i["font-stretch"]=!0,i["font-style"]=!0,i["font-synthesis"]=!0,i["font-variant"]=!0,i["font-variant-alternates"]=!0,i["font-variant-caps"]=!0,i["font-variant-east-asian"]=!0,i["font-variant-ligatures"]=!0,i["font-variant-numeric"]=!0,i["font-variant-position"]=!0,i["font-weight"]=!0,i.grid=!1,i["grid-area"]=!1,i["grid-auto-columns"]=!1,i["grid-auto-flow"]=!1,i["grid-auto-rows"]=!1,i["grid-column"]=!1,i["grid-column-end"]=!1,i["grid-column-start"]=!1,i["grid-row"]=!1,i["grid-row-end"]=!1,i["grid-row-start"]=!1,i["grid-template"]=!1,i["grid-template-areas"]=!1,i["grid-template-columns"]=!1,i["grid-template-rows"]=!1,i["hanging-punctuation"]=!1,i.height=!0,i.hyphens=!1,i.icon=!1,i["image-orientation"]=!1,i["image-resolution"]=!1,i["ime-mode"]=!1,i["initial-letters"]=!1,i["inline-box-align"]=!1,i["justify-content"]=!1,i["justify-items"]=!1,i["justify-self"]=!1,i.left=!1,i["letter-spacing"]=!0,i["lighting-color"]=!0,i["line-box-contain"]=!1,i["line-break"]=!1,i["line-grid"]=!1,i["line-height"]=!1,i["line-snap"]=!1,i["line-stacking"]=!1,i["line-stacking-ruby"]=!1,i["line-stacking-shift"]=!1,i["line-stacking-strategy"]=!1,i["list-style"]=!0,i["list-style-image"]=!0,i["list-style-position"]=!0,i["list-style-type"]=!0,i.margin=!0,i["margin-bottom"]=!0,i["margin-left"]=!0,i["margin-right"]=!0,i["margin-top"]=!0,i["marker-offset"]=!1,i["marker-side"]=!1,i.marks=!1,i.mask=!1,i["mask-box"]=!1,i["mask-box-outset"]=!1,i["mask-box-repeat"]=!1,i["mask-box-slice"]=!1,i["mask-box-source"]=!1,i["mask-box-width"]=!1,i["mask-clip"]=!1,i["mask-image"]=!1,i["mask-origin"]=!1,i["mask-position"]=!1,i["mask-repeat"]=!1,i["mask-size"]=!1,i["mask-source-type"]=!1,i["mask-type"]=!1,i["max-height"]=!0,i["max-lines"]=!1,i["max-width"]=!0,i["min-height"]=!0,i["min-width"]=!0,i["move-to"]=!1,i["nav-down"]=!1,i["nav-index"]=!1,i["nav-left"]=!1,i["nav-right"]=!1,i["nav-up"]=!1,i["object-fit"]=!1,i["object-position"]=!1,i.opacity=!1,i.order=!1,i.orphans=!1,i.outline=!1,i["outline-color"]=!1,i["outline-offset"]=!1,i["outline-style"]=!1,i["outline-width"]=!1,i.overflow=!1,i["overflow-wrap"]=!1,i["overflow-x"]=!1,i["overflow-y"]=!1,i.padding=!0,i["padding-bottom"]=!0,i["padding-left"]=!0,i["padding-right"]=!0,i["padding-top"]=!0,i.page=!1,i["page-break-after"]=!1,i["page-break-before"]=!1,i["page-break-inside"]=!1,i["page-policy"]=!1,i.pause=!1,i["pause-after"]=!1,i["pause-before"]=!1,i.perspective=!1,i["perspective-origin"]=!1,i.pitch=!1,i["pitch-range"]=!1,i["play-during"]=!1,i.position=!1,i["presentation-level"]=!1,i.quotes=!1,i["region-fragment"]=!1,i.resize=!1,i.rest=!1,i["rest-after"]=!1,i["rest-before"]=!1,i.richness=!1,i.right=!1,i.rotation=!1,i["rotation-point"]=!1,i["ruby-align"]=!1,i["ruby-merge"]=!1,i["ruby-position"]=!1,i["shape-image-threshold"]=!1,i["shape-outside"]=!1,i["shape-margin"]=!1,i.size=!1,i.speak=!1,i["speak-as"]=!1,i["speak-header"]=!1,i["speak-numeral"]=!1,i["speak-punctuation"]=!1,i["speech-rate"]=!1,i.stress=!1,i["string-set"]=!1,i["tab-size"]=!1,i["table-layout"]=!1,i["text-align"]=!0,i["text-align-last"]=!0,i["text-combine-upright"]=!0,i["text-decoration"]=!0,i["text-decoration-color"]=!0,i["text-decoration-line"]=!0,i["text-decoration-skip"]=!0,i["text-decoration-style"]=!0,i["text-emphasis"]=!0,i["text-emphasis-color"]=!0,i["text-emphasis-position"]=!0,i["text-emphasis-style"]=!0,i["text-height"]=!0,i["text-indent"]=!0,i["text-justify"]=!0,i["text-orientation"]=!0,i["text-overflow"]=!0,i["text-shadow"]=!0,i["text-space-collapse"]=!0,i["text-transform"]=!0,i["text-underline-position"]=!0,i["text-wrap"]=!0,i.top=!1,i.transform=!1,i["transform-origin"]=!1,i["transform-style"]=!1,i.transition=!1,i["transition-delay"]=!1,i["transition-duration"]=!1,i["transition-property"]=!1,i["transition-timing-function"]=!1,i["unicode-bidi"]=!1,i["vertical-align"]=!1,i.visibility=!1,i["voice-balance"]=!1,i["voice-duration"]=!1,i["voice-family"]=!1,i["voice-pitch"]=!1,i["voice-range"]=!1,i["voice-rate"]=!1,i["voice-stress"]=!1,i["voice-volume"]=!1,i.volume=!1,i["white-space"]=!1,i.widows=!1,i.width=!0,i["will-change"]=!1,i["word-break"]=!0,i["word-spacing"]=!0,i["word-wrap"]=!0,i["wrap-flow"]=!1,i["wrap-through"]=!1,i["writing-mode"]=!1,i["z-index"]=!1,i;}function sA(i,e,t){}function oA(i,e,t){}var aA=/javascript\s*\:/img;function lA(i,e){return aA.test(e)?"":e;}Gn.whiteList=Lh();Gn.getDefaultWhiteList=Lh;Gn.onAttr=sA;Gn.onIgnoreAttr=oA;Gn.safeAttrValue=lA;var fA={indexOf:function indexOf(i,e){var t,r;if(Array.prototype.indexOf)return i.indexOf(e);for(t=0,r=i.length;t<r;t++)if(i[t]===e)return t;return-1;},forEach:function forEach(i,e,t){var r,n;if(Array.prototype.forEach)return i.forEach(e,t);for(r=0,n=i.length;r<n;r++)e.call(t,i[r],r,i);},trim:function trim(i){return String.prototype.trim?i.trim():i.replace(/(^\s*)|(\s*$)/g,"");},trimRight:function trimRight(i){return String.prototype.trimRight?i.trimRight():i.replace(/(\s*$)/g,"");}},Gi=fA;function cA(i,e){i=Gi.trimRight(i),i[i.length-1]!==";"&&(i+=";");var t=i.length,r=!1,n=0,s=0,c="";function l(){if(!r){var m=Gi.trim(i.slice(n,s)),u=m.indexOf(":");if(u!==-1){var y=Gi.trim(m.slice(0,u)),T=Gi.trim(m.slice(u+1));if(y){var E=e(n,c.length,y,T,m);E&&(c+=E+"; ");}}}n=s+1;}for(;s<t;s++){var f=i[s];if(f==="/"&&i[s+1]==="*"){var h=i.indexOf("*/",s+2);if(h===-1)break;s=h+1,n=s+1,r=!1;}else f==="("?r=!0:f===")"?r=!1:f===";"?r||l():f==="\n"&&l();}return Gi.trim(c);}var uA=cA,Vs=Gn,hA=uA;function Eu(i){return i==null;}function dA(i){var e={};for(var t in i)e[t]=i[t];return e;}function Rh(i){i=dA(i||{}),i.whiteList=i.whiteList||Vs.whiteList,i.onAttr=i.onAttr||Vs.onAttr,i.onIgnoreAttr=i.onIgnoreAttr||Vs.onIgnoreAttr,i.safeAttrValue=i.safeAttrValue||Vs.safeAttrValue,this.options=i;}Rh.prototype.process=function(i){if(i=i||"",i=i.toString(),!i)return"";var e=this,t=e.options,r=t.whiteList,n=t.onAttr,s=t.onIgnoreAttr,c=t.safeAttrValue,l=hA(i,function(f,h,m,u,y){var T=r[m],E=!1;if(T===!0?E=T:typeof T=="function"?E=T(u):T instanceof RegExp&&(E=T.test(u)),E!==!0&&(E=!1),u=c(m,u),!!u){var C={position:h,sourcePosition:f,source:y,isWhite:E};if(E){var x=n(m,u,C);return Eu(x)?m+":"+u:x;}else{var x=s(m,u,C);if(!Eu(x))return x;}}});return l;};var pA=Rh;(function(i,e){var t=Gn,r=pA;function n(c,l){var f=new r(l);return f.process(c);}e=i.exports=n,e.FilterCSS=r;for(var s in t)e[s]=t[s];(typeof window==="undefined"?"undefined":_typeof(window))<"u"&&(window.filterCSS=i.exports);})(ll,ll.exports);var El=ll.exports,Ml={indexOf:function indexOf(i,e){var t,r;if(Array.prototype.indexOf)return i.indexOf(e);for(t=0,r=i.length;t<r;t++)if(i[t]===e)return t;return-1;},forEach:function forEach(i,e,t){var r,n;if(Array.prototype.forEach)return i.forEach(e,t);for(r=0,n=i.length;r<n;r++)e.call(t,i[r],r,i);},trim:function trim(i){return String.prototype.trim?i.trim():i.replace(/(^\s*)|(\s*$)/g,"");},spaceIndex:function spaceIndex(i){var e=/\s|\n|\t/,t=e.exec(i);return t?t.index:-1;}},vA=El.FilterCSS,gA=El.getDefaultWhiteList,oo=Ml;function bh(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height","loading"],ins:["datetime"],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]};}var Dh=new vA();function mA(i,e,t){}function yA(i,e,t){}function PA(i,e,t){}function SA(i,e,t){}function Nh(i){return i.replace(TA,"<").replace(CA,">");}function xA(i,e,t,r){if(t=Xh(t),e==="href"||e==="src"){if(t=oo.trim(t),t==="#")return"#";if(!(t.substr(0,7)==="http://"||t.substr(0,8)==="https://"||t.substr(0,7)==="mailto:"||t.substr(0,4)==="tel:"||t.substr(0,11)==="data:image/"||t.substr(0,6)==="ftp://"||t.substr(0,2)==="./"||t.substr(0,3)==="../"||t[0]==="#"||t[0]==="/"))return"";}else if(e==="background"){if(Zs.lastIndex=0,Zs.test(t))return"";}else if(e==="style"){if(Mu.lastIndex=0,Mu.test(t)||(Lu.lastIndex=0,Lu.test(t)&&(Zs.lastIndex=0,Zs.test(t))))return"";r!==!1&&(r=r||Dh,t=r.process(t));}return t=zh(t),t;}var TA=/</g,CA=/>/g,IA=/"/g,OA=/"/g,wA=/&#([a-zA-Z0-9]*);?/gim,AA=/:?/gim,EA=/&newline;?/gim,Zs=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,Mu=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,Lu=/u\s*r\s*l\s*\(.*/gi;function Bh(i){return i.replace(IA,""");}function Wh(i){return i.replace(OA,'"');}function Fh(i){return i.replace(wA,function(t,r){return r[0]==="x"||r[0]==="X"?String.fromCharCode(parseInt(r.substr(1),16)):String.fromCharCode(parseInt(r,10));});}function Uh(i){return i.replace(AA,":").replace(EA," ");}function Yh(i){for(var e="",t=0,r=i.length;t<r;t++)e+=i.charCodeAt(t)<32?" ":i.charAt(t);return oo.trim(e);}function Xh(i){return i=Wh(i),i=Fh(i),i=Uh(i),i=Yh(i),i;}function zh(i){return i=Bh(i),i=Nh(i),i;}function MA(){return"";}function LA(i,e){typeof e!="function"&&(e=function e(){});var t=!Array.isArray(i);function r(c){return t?!0:oo.indexOf(i,c)!==-1;}var n=[],s=!1;return{onIgnoreTag:function onIgnoreTag(c,l,f){if(r(c)){if(f.isClosing){var h="[/removed]",m=f.position+h.length;return n.push([s!==!1?s:f.position,m]),s=!1,h;}else return s||(s=f.position),"[removed]";}else return e(c,l,f);},remove:function remove(c){var l="",f=0;return oo.forEach(n,function(h){l+=c.slice(f,h[0]),f=h[1];}),l+=c.slice(f),l;}};}function RA(i){for(var e="",t=0;t<i.length;){var r=i.indexOf("<!--",t);if(r===-1){e+=i.slice(t);break;}e+=i.slice(t,r);var n=i.indexOf("-->",r);if(n===-1)break;t=n+3;}return e;}function bA(i){var e=i.split("");return e=e.filter(function(t){var r=t.charCodeAt(0);return r===127?!1:r<=31?r===10||r===13:!0;}),e.join("");}ke.whiteList=bh();ke.getDefaultWhiteList=bh;ke.onTag=mA;ke.onIgnoreTag=yA;ke.onTagAttr=PA;ke.onIgnoreTagAttr=SA;ke.safeAttrValue=xA;ke.escapeHtml=Nh;ke.escapeQuote=Bh;ke.unescapeQuote=Wh;ke.escapeHtmlEntities=Fh;ke.escapeDangerHtml5Entities=Uh;ke.clearNonPrintableCharacter=Yh;ke.friendlyAttrValue=Xh;ke.escapeAttrValue=zh;ke.onIgnoreTagStripAll=MA;ke.StripTagBody=LA;ke.stripCommentTag=RA;ke.stripBlankChar=bA;ke.attributeWrapSign='"';ke.cssFilter=Dh;ke.getDefaultCSSWhiteList=gA;var xo={},wn=Ml;function DA(i){var e=wn.spaceIndex(i),t;return e===-1?t=i.slice(1,-1):t=i.slice(1,e+1),t=wn.trim(t).toLowerCase(),t.slice(0,1)==="/"&&(t=t.slice(1)),t.slice(-1)==="/"&&(t=t.slice(0,-1)),t;}function NA(i){return i.slice(0,2)==="</";}function BA(i,e,t){var r="",n=0,s=!1,c=!1,l=0,f=i.length,h="",m="";t:for(l=0;l<f;l++){var u=i.charAt(l);if(s===!1){if(u==="<"){s=l;continue;}}else if(c===!1){if(u==="<"){r+=t(i.slice(n,l)),s=l,n=l;continue;}if(u===">"||l===f-1){r+=t(i.slice(n,s)),m=i.slice(s,l+1),h=DA(m),r+=e(s,r.length,h,m,NA(m)),n=l+1,s=!1;continue;}if(u==='"'||u==="'")for(var y=1,T=i.charAt(l-y);T.trim()===""||T==="=";){if(T==="="){c=u;continue t;}T=i.charAt(l-++y);}}else if(u===c){c=!1;continue;}}return n<f&&(r+=t(i.substr(n))),r;}var WA=/[^a-zA-Z0-9\\_:.-]/gim;function FA(i,e){var t=0,r=0,n=[],s=!1,c=i.length;function l(y,T){if(y=wn.trim(y),y=y.replace(WA,"").toLowerCase(),!(y.length<1)){var E=e(y,T||"");E&&n.push(E);}}for(var f=0;f<c;f++){var h=i.charAt(f),m,u;if(s===!1&&h==="="){s=i.slice(t,f),t=f+1,r=i.charAt(t)==='"'||i.charAt(t)==="'"?t:YA(i,f+1);continue;}if(s!==!1&&f===r){if(u=i.indexOf(h,f+1),u===-1)break;m=wn.trim(i.slice(r+1,u)),l(s,m),s=!1,f=u,t=f+1;continue;}if(/\s|\n|\t/.test(h))if(i=i.replace(/\s|\n|\t/g," "),s===!1){if(u=UA(i,f),u===-1){m=wn.trim(i.slice(t,f)),l(m),s=!1,t=f+1;continue;}else{f=u-1;continue;}}else if(u=XA(i,f-1),u===-1){m=wn.trim(i.slice(t,f)),m=Ru(m),l(s,m),s=!1,t=f+1;continue;}else continue;}return t<i.length&&(s===!1?l(i.slice(t)):l(s,Ru(wn.trim(i.slice(t))))),wn.trim(n.join(" "));}function UA(i,e){for(;e<i.length;e++){var t=i[e];if(t!==" ")return t==="="?e:-1;}}function YA(i,e){for(;e<i.length;e++){var t=i[e];if(t!==" ")return t==="'"||t==='"'?e:-1;}}function XA(i,e){for(;e>0;e--){var t=i[e];if(t!==" ")return t==="="?e:-1;}}function zA(i){return i[0]==='"'&&i[i.length-1]==='"'||i[0]==="'"&&i[i.length-1]==="'";}function Ru(i){return zA(i)?i.substr(1,i.length-2):i;}xo.parseTag=BA;xo.parseAttr=FA;var $A=El.FilterCSS,Xr=ke,$h=xo,jA=$h.parseTag,GA=$h.parseAttr,_s=Ml;function Js(i){return i==null;}function HA(i){var e=_s.spaceIndex(i);if(e===-1)return{html:"",closing:i[i.length-2]==="/"};i=_s.trim(i.slice(e+1,-1));var t=i[i.length-1]==="/";return t&&(i=_s.trim(i.slice(0,-1))),{html:i,closing:t};}function kA(i){var e={};for(var t in i)e[t]=i[t];return e;}function KA(i){var e={};for(var t in i)Array.isArray(i[t])?e[t.toLowerCase()]=i[t].map(function(r){return r.toLowerCase();}):e[t.toLowerCase()]=i[t];return e;}function jh(i){i=kA(i||{}),i.stripIgnoreTag&&(i.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),i.onIgnoreTag=Xr.onIgnoreTagStripAll),i.whiteList||i.allowList?i.whiteList=KA(i.whiteList||i.allowList):i.whiteList=Xr.whiteList,this.attributeWrapSign=i.singleQuotedAttributeValue===!0?"'":Xr.attributeWrapSign,i.onTag=i.onTag||Xr.onTag,i.onTagAttr=i.onTagAttr||Xr.onTagAttr,i.onIgnoreTag=i.onIgnoreTag||Xr.onIgnoreTag,i.onIgnoreTagAttr=i.onIgnoreTagAttr||Xr.onIgnoreTagAttr,i.safeAttrValue=i.safeAttrValue||Xr.safeAttrValue,i.escapeHtml=i.escapeHtml||Xr.escapeHtml,this.options=i,i.css===!1?this.cssFilter=!1:(i.css=i.css||{},this.cssFilter=new $A(i.css));}jh.prototype.process=function(i){if(i=i||"",i=i.toString(),!i)return"";var e=this,t=e.options,r=t.whiteList,n=t.onTag,s=t.onIgnoreTag,c=t.onTagAttr,l=t.onIgnoreTagAttr,f=t.safeAttrValue,h=t.escapeHtml,m=e.attributeWrapSign,u=e.cssFilter;t.stripBlankChar&&(i=Xr.stripBlankChar(i)),t.allowCommentTag||(i=Xr.stripCommentTag(i));var y=!1;t.stripIgnoreTagBody&&(y=Xr.StripTagBody(t.stripIgnoreTagBody,s),s=y.onIgnoreTag);var T=jA(i,function(E,C,x,I,d){var v={sourcePosition:E,position:C,isClosing:d,isWhite:Object.prototype.hasOwnProperty.call(r,x)},p=n(x,I,v);if(!Js(p))return p;if(v.isWhite){if(v.isClosing)return"</"+x+">";var S=HA(I),A=r[x],R=GA(S.html,function(D,U){var M=_s.indexOf(A,D)!==-1,W=c(x,D,U,M);return Js(W)?M?(U=f(x,D,U,u),U?D+"="+m+U+m:D):(W=l(x,D,U,M),Js(W)?void 0:W):W;});return I="<"+x,R&&(I+=" "+R),S.closing&&(I+=" /"),I+=">",I;}else return p=s(x,I,v),Js(p)?h(I):p;},h);return y&&(T=y.remove(T)),T;};var VA=jh;(function(i,e){var t=ke,r=xo,n=VA;function s(l,f){var h=new n(f);return h.process(l);}e=i.exports=s,e.filterXSS=s,e.FilterXSS=n,function(){for(var l in t)e[l]=t[l];for(var f in r)e[f]=r[f];}(),(typeof window==="undefined"?"undefined":_typeof(window))<"u"&&(window.filterXSS=i.exports);function c(){return(typeof self==="undefined"?"undefined":_typeof(self))<"u"&&(typeof DedicatedWorkerGlobalScope==="undefined"?"undefined":_typeof(DedicatedWorkerGlobalScope))<"u"&&self instanceof DedicatedWorkerGlobalScope;}c()&&(self.filterXSS=i.exports);})(Au,Au.exports);var ao={exports:{}};/**
|
|
437
437
|
* @license
|
|
438
438
|
* Lodash <https://lodash.com/>
|
|
439
439
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
440
440
|
* Released under MIT license <https://lodash.com/license>
|
|
441
441
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
442
442
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
443
|
-
*/ao.exports;(function(i,e){(function(){var t,r="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",u=1,y=2,T=4,E=1,C=2,x=1,I=2,d=4,v=8,p=16,S=32,A=64,R=128,D=256,U=512,M=30,W="...",Y=800,B=16,N=1,G=2,J=3,tt=1/0,at=9007199254740991,ut=17976931348623157e292,K=NaN,Q=4294967295,ft=Q-1,gt=Q>>>1,mt=[["ary",R],["bind",x],["bindKey",I],["curry",v],["curryRight",p],["flip",U],["partial",S],["partialRight",A],["rearg",D]],wt="[object Arguments]",ht="[object Array]",Nt="[object AsyncFunction]",Rt="[object Boolean]",X="[object Date]",z="[object DOMException]",q="[object Error]",nt="[object Function]",j="[object GeneratorFunction]",Z="[object Map]",O="[object Number]",L="[object Null]",$="[object Object]",V="[object Promise]",rt="[object Proxy]",it="[object RegExp]",ct="[object Set]",St="[object String]",Ct="[object Symbol]",Mt="[object Undefined]",Dt="[object WeakMap]",At="[object WeakSet]",Ot="[object ArrayBuffer]",Lt="[object DataView]",Yt="[object Float32Array]",zt="[object Float64Array]",Wt="[object Int8Array]",Qt="[object Int16Array]",ue="[object Int32Array]",ie="[object Uint8Array]",ne="[object Uint8ClampedArray]",ae="[object Uint16Array]",se="[object Uint32Array]",je=/\b__p \+= '';/g,We=/\b(__p \+=) '' \+/g,Xe=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Fe=/&(?:amp|lt|gt|quot|#39);/g,Ge=/[&<>"']/g,Ke=RegExp(Fe.source),Je=RegExp(Ge.source),Ie=/<%-([\s\S]+?)%>/g,cr=/<%([\s\S]+?)%>/g,Kr=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
443
|
+
*/ao.exports;(function(i,e){(function(){var t,r="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",u=1,y=2,T=4,E=1,C=2,x=1,I=2,d=4,v=8,p=16,S=32,A=64,R=128,D=256,U=512,M=30,W="...",Y=800,B=16,N=1,G=2,J=3,tt=1/0,at=9007199254740991,ut=17976931348623157e292,K=NaN,Q=4294967295,ft=Q-1,gt=Q>>>1,mt=[["ary",R],["bind",x],["bindKey",I],["curry",v],["curryRight",p],["flip",U],["partial",S],["partialRight",A],["rearg",D]],wt="[object Arguments]",ht="[object Array]",Nt="[object AsyncFunction]",Rt="[object Boolean]",X="[object Date]",z="[object DOMException]",q="[object Error]",nt="[object Function]",j="[object GeneratorFunction]",Z="[object Map]",O="[object Number]",L="[object Null]",$="[object Object]",V="[object Promise]",rt="[object Proxy]",it="[object RegExp]",ct="[object Set]",St="[object String]",Ct="[object Symbol]",Mt="[object Undefined]",Dt="[object WeakMap]",At="[object WeakSet]",Ot="[object ArrayBuffer]",Lt="[object DataView]",Yt="[object Float32Array]",zt="[object Float64Array]",Wt="[object Int8Array]",Qt="[object Int16Array]",ue="[object Int32Array]",ie="[object Uint8Array]",ne="[object Uint8ClampedArray]",ae="[object Uint16Array]",se="[object Uint32Array]",je=/\b__p \+= '';/g,We=/\b(__p \+=) '' \+/g,Xe=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Fe=/&(?:amp|lt|gt|quot|#39);/g,Ge=/[&<>"']/g,Ke=RegExp(Fe.source),Je=RegExp(Ge.source),Ie=/<%-([\s\S]+?)%>/g,cr=/<%([\s\S]+?)%>/g,Kr=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hn=/^\w*$/,kn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wi=/[\\^$.*+?()[\]{}|]/g,Co=RegExp(wi.source),Ai=/^\s+/,Io=/\s/,Oo=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,wo=/\{\n\/\* \[wrapped with (.+)\] \*/,Ao=/,? & /,Eo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Mo=/[()=,{}\[\]\/\s]/,Lo=/\\(\\)?/g,Ro=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_i=/\w*$/,Rn=/^[-+]0x[0-9a-f]+$/i,ts=/^0b[01]+$/i,bo=/^\[object .+?Constructor\]$/,Do=/^0o[0-7]+$/i,No=/^(?:0|[1-9]\d*)$/,Bo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kn=/($^)/,vn=/['\n\r\u2028\u2029\\]/g,Vn="\\ud800-\\udfff",Wo="\\u0300-\\u036f",Fo="\\ufe20-\\ufe2f",Uo="\\u20d0-\\u20ff",es=Wo+Fo+Uo,rs="\\u2700-\\u27bf",ns="a-z\\xdf-\\xf6\\xf8-\\xff",Yo="\\xac\\xb1\\xd7\\xf7",Xo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",nr="\\u2000-\\u206f",zo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",is="A-Z\\xc0-\\xd6\\xd8-\\xde",ss="\\ufe0e\\ufe0f",ge=Yo+Xo+nr+zo,Zn="['’]",$o="["+Vn+"]",os="["+ge+"]",Jn="["+es+"]",as="\\d+",a="["+rs+"]",P="["+ns+"]",w="[^"+Vn+ge+as+rs+ns+is+"]",F="\\ud83c[\\udffb-\\udfff]",H="(?:"+Jn+"|"+F+")",_="[^"+Vn+"]",st="(?:\\ud83c[\\udde6-\\uddff]){2}",yt="[\\ud800-\\udbff][\\udc00-\\udfff]",Pt="["+is+"]",Bt="\\u200d",kt="(?:"+P+"|"+w+")",jt="(?:"+Pt+"|"+w+")",qt="(?:"+Zn+"(?:d|ll|m|re|s|t|ve))?",oe="(?:"+Zn+"(?:D|LL|M|RE|S|T|VE))?",me=H+"?",Pe="["+ss+"]?",De="(?:"+Bt+"(?:"+[_,st,yt].join("|")+")"+Pe+me+")*",or="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Rr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",en=Pe+me+De,jo="(?:"+[a,st,yt].join("|")+")"+en,Go="(?:"+[_+Jn+"?",Jn,st,yt,$o].join("|")+")",gn=RegExp(Zn,"g"),od=RegExp(Jn,"g"),Ho=RegExp(F+"(?="+F+")|"+Go+en,"g"),ad=RegExp([Pt+"?"+P+"+"+qt+"(?="+[os,Pt,"$"].join("|")+")",jt+"+"+oe+"(?="+[os,Pt+kt,"$"].join("|")+")",Pt+"?"+kt+"+"+qt,Pt+"+"+oe,Rr,or,as,jo].join("|"),"g"),ld=RegExp("["+Bt+Vn+es+ss+"]"),fd=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,cd=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ud=-1,ze={};ze[Yt]=ze[zt]=ze[Wt]=ze[Qt]=ze[ue]=ze[ie]=ze[ne]=ze[ae]=ze[se]=!0,ze[wt]=ze[ht]=ze[Ot]=ze[Rt]=ze[Lt]=ze[X]=ze[q]=ze[nt]=ze[Z]=ze[O]=ze[$]=ze[it]=ze[ct]=ze[St]=ze[Dt]=!1;var Ue={};Ue[wt]=Ue[ht]=Ue[Ot]=Ue[Lt]=Ue[Rt]=Ue[X]=Ue[Yt]=Ue[zt]=Ue[Wt]=Ue[Qt]=Ue[ue]=Ue[Z]=Ue[O]=Ue[$]=Ue[it]=Ue[ct]=Ue[St]=Ue[Ct]=Ue[ie]=Ue[ne]=Ue[ae]=Ue[se]=!0,Ue[q]=Ue[nt]=Ue[Dt]=!1;var hd={// Latin-1 Supplement block.
|
|
444
444
|
À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",// Latin Extended-A block.
|
|
445
|
-
Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},dd={"&":"&","<":"<",">":">",'"':""","'":"'"},pd={"&":"&","<":"<",">":">",""":'"',"'":"'"},vd={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},gd=parseFloat,md=parseInt,Dl=_typeof(hn)=="object"&&hn&&hn.Object===Object&&hn,yd=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self,ir=Dl||yd||Function("return this")(),ko=e&&!e.nodeType&&e,bn=ko&&!0&&i&&!i.nodeType&&i,Nl=bn&&bn.exports===ko,Ko=Nl&&Dl.process,br=function(){try{var Et=bn&&bn.require&&bn.require("util").types;return Et||Ko&&Ko.binding&&Ko.binding("util");}catch(_unused24){}}(),Bl=br&&br.isArrayBuffer,Wl=br&&br.isDate,Fl=br&&br.isMap,Ul=br&&br.isRegExp,Yl=br&&br.isSet,Xl=br&&br.isTypedArray;function Cr(Et,Xt,Ft){switch(Ft.length){case 0:return Et.call(Xt);case 1:return Et.call(Xt,Ft[0]);case 2:return Et.call(Xt,Ft[0],Ft[1]);case 3:return Et.call(Xt,Ft[0],Ft[1],Ft[2]);}return Et.apply(Xt,Ft);}function Pd(Et,Xt,Ft,ee){for(var de=-1,Ee=Et==null?0:Et.length;++de<Ee;){var _e=Et[de];Xt(ee,_e,Ft(_e),Et);}return ee;}function Dr(Et,Xt){for(var Ft=-1,ee=Et==null?0:Et.length;++Ft<ee&&Xt(Et[Ft],Ft,Et)!==!1;);return Et;}function Sd(Et,Xt){for(var Ft=Et==null?0:Et.length;Ft--&&Xt(Et[Ft],Ft,Et)!==!1;);return Et;}function zl(Et,Xt){for(var Ft=-1,ee=Et==null?0:Et.length;++Ft<ee;)if(!Xt(Et[Ft],Ft,Et))return!1;return!0;}function mn(Et,Xt){for(var Ft=-1,ee=Et==null?0:Et.length,de=0,Ee=[];++Ft<ee;){var _e=Et[Ft];Xt(_e,Ft,Et)&&(Ee[de++]=_e);}return Ee;}function ls(Et,Xt){var Ft=Et==null?0:Et.length;return!!Ft&&
|
|
445
|
+
Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},dd={"&":"&","<":"<",">":">",'"':""","'":"'"},pd={"&":"&","<":"<",">":">",""":'"',"'":"'"},vd={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},gd=parseFloat,md=parseInt,Dl=_typeof(hn)=="object"&&hn&&hn.Object===Object&&hn,yd=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self,ir=Dl||yd||Function("return this")(),ko=e&&!e.nodeType&&e,bn=ko&&!0&&i&&!i.nodeType&&i,Nl=bn&&bn.exports===ko,Ko=Nl&&Dl.process,br=function(){try{var Et=bn&&bn.require&&bn.require("util").types;return Et||Ko&&Ko.binding&&Ko.binding("util");}catch(_unused24){}}(),Bl=br&&br.isArrayBuffer,Wl=br&&br.isDate,Fl=br&&br.isMap,Ul=br&&br.isRegExp,Yl=br&&br.isSet,Xl=br&&br.isTypedArray;function Cr(Et,Xt,Ft){switch(Ft.length){case 0:return Et.call(Xt);case 1:return Et.call(Xt,Ft[0]);case 2:return Et.call(Xt,Ft[0],Ft[1]);case 3:return Et.call(Xt,Ft[0],Ft[1],Ft[2]);}return Et.apply(Xt,Ft);}function Pd(Et,Xt,Ft,ee){for(var de=-1,Ee=Et==null?0:Et.length;++de<Ee;){var _e=Et[de];Xt(ee,_e,Ft(_e),Et);}return ee;}function Dr(Et,Xt){for(var Ft=-1,ee=Et==null?0:Et.length;++Ft<ee&&Xt(Et[Ft],Ft,Et)!==!1;);return Et;}function Sd(Et,Xt){for(var Ft=Et==null?0:Et.length;Ft--&&Xt(Et[Ft],Ft,Et)!==!1;);return Et;}function zl(Et,Xt){for(var Ft=-1,ee=Et==null?0:Et.length;++Ft<ee;)if(!Xt(Et[Ft],Ft,Et))return!1;return!0;}function mn(Et,Xt){for(var Ft=-1,ee=Et==null?0:Et.length,de=0,Ee=[];++Ft<ee;){var _e=Et[Ft];Xt(_e,Ft,Et)&&(Ee[de++]=_e);}return Ee;}function ls(Et,Xt){var Ft=Et==null?0:Et.length;return!!Ft&&Qn(Et,Xt,0)>-1;}function Vo(Et,Xt,Ft){for(var ee=-1,de=Et==null?0:Et.length;++ee<de;)if(Ft(Xt,Et[ee]))return!0;return!1;}function He(Et,Xt){for(var Ft=-1,ee=Et==null?0:Et.length,de=Array(ee);++Ft<ee;)de[Ft]=Xt(Et[Ft],Ft,Et);return de;}function yn(Et,Xt){for(var Ft=-1,ee=Xt.length,de=Et.length;++Ft<ee;)Et[de+Ft]=Xt[Ft];return Et;}function Zo(Et,Xt,Ft,ee){var de=-1,Ee=Et==null?0:Et.length;for(ee&&Ee&&(Ft=Et[++de]);++de<Ee;)Ft=Xt(Ft,Et[de],de,Et);return Ft;}function xd(Et,Xt,Ft,ee){var de=Et==null?0:Et.length;for(ee&&de&&(Ft=Et[--de]);de--;)Ft=Xt(Ft,Et[de],de,Et);return Ft;}function Jo(Et,Xt){for(var Ft=-1,ee=Et==null?0:Et.length;++Ft<ee;)if(Xt(Et[Ft],Ft,Et))return!0;return!1;}var Td=Qo("length");function Cd(Et){return Et.split("");}function Id(Et){return Et.match(Eo)||[];}function $l(Et,Xt,Ft){var ee;return Ft(Et,function(de,Ee,_e){if(Xt(de,Ee,_e))return ee=Ee,!1;}),ee;}function fs(Et,Xt,Ft,ee){for(var de=Et.length,Ee=Ft+(ee?1:-1);ee?Ee--:++Ee<de;)if(Xt(Et[Ee],Ee,Et))return Ee;return-1;}function Qn(Et,Xt,Ft){return Xt===Xt?Wd(Et,Xt,Ft):fs(Et,jl,Ft);}function Od(Et,Xt,Ft,ee){for(var de=Ft-1,Ee=Et.length;++de<Ee;)if(ee(Et[de],Xt))return de;return-1;}function jl(Et){return Et!==Et;}function Gl(Et,Xt){var Ft=Et==null?0:Et.length;return Ft?_o(Et,Xt)/Ft:K;}function Qo(Et){return function(Xt){return Xt==null?t:Xt[Et];};}function qo(Et){return function(Xt){return Et==null?t:Et[Xt];};}function Hl(Et,Xt,Ft,ee,de){return de(Et,function(Ee,_e,Be){Ft=ee?(ee=!1,Ee):Xt(Ft,Ee,_e,Be);}),Ft;}function wd(Et,Xt){var Ft=Et.length;for(Et.sort(Xt);Ft--;)Et[Ft]=Et[Ft].value;return Et;}function _o(Et,Xt){for(var Ft,ee=-1,de=Et.length;++ee<de;){var Ee=Xt(Et[ee]);Ee!==t&&(Ft=Ft===t?Ee:Ft+Ee);}return Ft;}function ta(Et,Xt){for(var Ft=-1,ee=Array(Et);++Ft<Et;)ee[Ft]=Xt(Ft);return ee;}function Ad(Et,Xt){return He(Xt,function(Ft){return[Ft,Et[Ft]];});}function kl(Et){return Et&&Et.slice(0,Jl(Et)+1).replace(Ai,"");}function Ir(Et){return function(Xt){return Et(Xt);};}function ea(Et,Xt){return He(Xt,function(Ft){return Et[Ft];});}function Ei(Et,Xt){return Et.has(Xt);}function Kl(Et,Xt){for(var Ft=-1,ee=Et.length;++Ft<ee&&Qn(Xt,Et[Ft],0)>-1;);return Ft;}function Vl(Et,Xt){for(var Ft=Et.length;Ft--&&Qn(Xt,Et[Ft],0)>-1;);return Ft;}function Ed(Et,Xt){for(var Ft=Et.length,ee=0;Ft--;)Et[Ft]===Xt&&++ee;return ee;}var Md=qo(hd),Ld=qo(dd);function Rd(Et){return"\\"+vd[Et];}function bd(Et,Xt){return Et==null?t:Et[Xt];}function qn(Et){return ld.test(Et);}function Dd(Et){return fd.test(Et);}function Nd(Et){for(var Xt,Ft=[];!(Xt=Et.next()).done;)Ft.push(Xt.value);return Ft;}function ra(Et){var Xt=-1,Ft=Array(Et.size);return Et.forEach(function(ee,de){Ft[++Xt]=[de,ee];}),Ft;}function Zl(Et,Xt){return function(Ft){return Et(Xt(Ft));};}function Pn(Et,Xt){for(var Ft=-1,ee=Et.length,de=0,Ee=[];++Ft<ee;){var _e=Et[Ft];(_e===Xt||_e===m)&&(Et[Ft]=m,Ee[de++]=Ft);}return Ee;}function cs(Et){var Xt=-1,Ft=Array(Et.size);return Et.forEach(function(ee){Ft[++Xt]=ee;}),Ft;}function Bd(Et){var Xt=-1,Ft=Array(Et.size);return Et.forEach(function(ee){Ft[++Xt]=[ee,ee];}),Ft;}function Wd(Et,Xt,Ft){for(var ee=Ft-1,de=Et.length;++ee<de;)if(Et[ee]===Xt)return ee;return-1;}function Fd(Et,Xt,Ft){for(var ee=Ft+1;ee--;)if(Et[ee]===Xt)return ee;return ee;}function _n(Et){return qn(Et)?Yd(Et):Td(Et);}function zr(Et){return qn(Et)?Xd(Et):Cd(Et);}function Jl(Et){for(var Xt=Et.length;Xt--&&Io.test(Et.charAt(Xt)););return Xt;}var Ud=qo(pd);function Yd(Et){for(var Xt=Ho.lastIndex=0;Ho.test(Et);)++Xt;return Xt;}function Xd(Et){return Et.match(Ho)||[];}function zd(Et){return Et.match(ad)||[];}var $d=function Et(Xt){Xt=Xt==null?ir:ti.defaults(ir.Object(),Xt,ti.pick(ir,cd));var Ft=Xt.Array,ee=Xt.Date,de=Xt.Error,Ee=Xt.Function,_e=Xt.Math,Be=Xt.Object,na=Xt.RegExp,jd=Xt.String,Nr=Xt.TypeError,us=Ft.prototype,Gd=Ee.prototype,ei=Be.prototype,hs=Xt["__core-js_shared__"],ds=Gd.toString,Ne=ei.hasOwnProperty,Hd=0,Ql=function(){var o=/[^.]+$/.exec(hs&&hs.keys&&hs.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:"";}(),ps=ei.toString,kd=ds.call(Be),Kd=ir._,Vd=na("^"+ds.call(Ne).replace(wi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vs=Nl?Xt.Buffer:t,Sn=Xt.Symbol,gs=Xt.Uint8Array,ql=vs?vs.allocUnsafe:t,ms=Zl(Be.getPrototypeOf,Be),_l=Be.create,tf=ei.propertyIsEnumerable,ys=us.splice,ef=Sn?Sn.isConcatSpreadable:t,Mi=Sn?Sn.iterator:t,Dn=Sn?Sn.toStringTag:t,Ps=function(){try{var o=Un(Be,"defineProperty");return o({},"",{}),o;}catch(_unused25){}}(),Zd=Xt.clearTimeout!==ir.clearTimeout&&Xt.clearTimeout,Jd=ee&&ee.now!==ir.Date.now&&ee.now,Qd=Xt.setTimeout!==ir.setTimeout&&Xt.setTimeout,Ss=_e.ceil,xs=_e.floor,ia=Be.getOwnPropertySymbols,qd=vs?vs.isBuffer:t,rf=Xt.isFinite,_d=us.join,tp=Zl(Be.keys,Be),tr=_e.max,ar=_e.min,ep=ee.now,rp=Xt.parseInt,nf=_e.random,np=us.reverse,sa=Un(Xt,"DataView"),Li=Un(Xt,"Map"),oa=Un(Xt,"Promise"),ri=Un(Xt,"Set"),Ri=Un(Xt,"WeakMap"),bi=Un(Be,"create"),Ts=Ri&&new Ri(),ni={},ip=Yn(sa),sp=Yn(Li),op=Yn(oa),ap=Yn(ri),lp=Yn(Ri),Cs=Sn?Sn.prototype:t,Di=Cs?Cs.valueOf:t,sf=Cs?Cs.toString:t;function ot(o){if(Ze(o)&&!pe(o)&&!(o instanceof Ce)){if(o instanceof Br)return o;if(Ne.call(o,"__wrapped__"))return oc(o);}return new Br(o);}var ii=/* @__PURE__ */function(){function o(){}return function(g){if(!Ve(g))return{};if(_l)return _l(g);o.prototype=g;var b=new o();return o.prototype=t,b;};}();function Is(){}function Br(o,g){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!g,this.__index__=0,this.__values__=t;}ot.templateSettings={/**
|
|
446
446
|
* Used to detect `data` property values to be HTML-escaped.
|
|
447
447
|
*
|
|
448
448
|
* @memberOf _.templateSettings
|
|
@@ -472,15 +472,15 @@ dt(pi,"eraserSizes",Tl);var io=pi;var J2="__lodash_hash_undefined__";function Q2
|
|
|
472
472
|
*
|
|
473
473
|
* @memberOf _.templateSettings.imports
|
|
474
474
|
* @type {Function}
|
|
475
|
-
*/_:ot}},ot.prototype=Is.prototype,ot.prototype.constructor=ot,Br.prototype=
|
|
475
|
+
*/_:ot}},ot.prototype=Is.prototype,ot.prototype.constructor=ot,Br.prototype=ii(Is.prototype),Br.prototype.constructor=Br;function Ce(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Q,this.__views__=[];}function fp(){var o=new Ce(this.__wrapped__);return o.__actions__=yr(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=yr(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=yr(this.__views__),o;}function cp(){if(this.__filtered__){var o=new Ce(this);o.__dir__=-1,o.__filtered__=!0;}else o=this.clone(),o.__dir__*=-1;return o;}function up(){var o=this.__wrapped__.value(),g=this.__dir__,b=pe(o),k=g<0,et=b?o.length:0,lt=C0(0,et,this.__views__),vt=lt.start,It=lt.end,bt=It-vt,Gt=k?It:vt-1,Ht=this.__iteratees__,Kt=Ht.length,_t=0,re=ar(bt,this.__takeCount__);if(!b||!k&&et==bt&&re==bt)return Mf(o,this.__actions__);var fe=[];t:for(;bt--&&_t<re;){Gt+=g;for(var Se=-1,ce=o[Gt];++Se<Kt;){var Te=Ht[Se],Oe=Te.iteratee,Ar=Te.type,dr=Oe(ce);if(Ar==G)ce=dr;else if(!dr){if(Ar==N)continue t;break t;}}fe[_t++]=ce;}return fe;}Ce.prototype=ii(Is.prototype),Ce.prototype.constructor=Ce;function Nn(o){var g=-1,b=o==null?0:o.length;for(this.clear();++g<b;){var k=o[g];this.set(k[0],k[1]);}}function hp(){this.__data__=bi?bi(null):{},this.size=0;}function dp(o){var g=this.has(o)&&delete this.__data__[o];return this.size-=g?1:0,g;}function pp(o){var g=this.__data__;if(bi){var b=g[o];return b===f?t:b;}return Ne.call(g,o)?g[o]:t;}function vp(o){var g=this.__data__;return bi?g[o]!==t:Ne.call(g,o);}function gp(o,g){var b=this.__data__;return this.size+=this.has(o)?0:1,b[o]=bi&&g===t?f:g,this;}Nn.prototype.clear=hp,Nn.prototype["delete"]=dp,Nn.prototype.get=pp,Nn.prototype.has=vp,Nn.prototype.set=gp;function rn(o){var g=-1,b=o==null?0:o.length;for(this.clear();++g<b;){var k=o[g];this.set(k[0],k[1]);}}function mp(){this.__data__=[],this.size=0;}function yp(o){var g=this.__data__,b=Os(g,o);if(b<0)return!1;var k=g.length-1;return b==k?g.pop():ys.call(g,b,1),--this.size,!0;}function Pp(o){var g=this.__data__,b=Os(g,o);return b<0?t:g[b][1];}function Sp(o){return Os(this.__data__,o)>-1;}function xp(o,g){var b=this.__data__,k=Os(b,o);return k<0?(++this.size,b.push([o,g])):b[k][1]=g,this;}rn.prototype.clear=mp,rn.prototype["delete"]=yp,rn.prototype.get=Pp,rn.prototype.has=Sp,rn.prototype.set=xp;function nn(o){var g=-1,b=o==null?0:o.length;for(this.clear();++g<b;){var k=o[g];this.set(k[0],k[1]);}}function Tp(){this.size=0,this.__data__={hash:new Nn(),map:new(Li||rn)(),string:new Nn()};}function Cp(o){var g=Fs(this,o)["delete"](o);return this.size-=g?1:0,g;}function Ip(o){return Fs(this,o).get(o);}function Op(o){return Fs(this,o).has(o);}function wp(o,g){var b=Fs(this,o),k=b.size;return b.set(o,g),this.size+=b.size==k?0:1,this;}nn.prototype.clear=Tp,nn.prototype["delete"]=Cp,nn.prototype.get=Ip,nn.prototype.has=Op,nn.prototype.set=wp;function Bn(o){var g=-1,b=o==null?0:o.length;for(this.__data__=new nn();++g<b;)this.add(o[g]);}function Ap(o){return this.__data__.set(o,f),this;}function Ep(o){return this.__data__.has(o);}Bn.prototype.add=Bn.prototype.push=Ap,Bn.prototype.has=Ep;function $r(o){var g=this.__data__=new rn(o);this.size=g.size;}function Mp(){this.__data__=new rn(),this.size=0;}function Lp(o){var g=this.__data__,b=g["delete"](o);return this.size=g.size,b;}function Rp(o){return this.__data__.get(o);}function bp(o){return this.__data__.has(o);}function Dp(o,g){var b=this.__data__;if(b instanceof rn){var k=b.__data__;if(!Li||k.length<n-1)return k.push([o,g]),this.size=++b.size,this;b=this.__data__=new nn(k);}return b.set(o,g),this.size=b.size,this;}$r.prototype.clear=Mp,$r.prototype["delete"]=Lp,$r.prototype.get=Rp,$r.prototype.has=bp,$r.prototype.set=Dp;function of(o,g){var b=pe(o),k=!b&&Xn(o),et=!b&&!k&&On(o),lt=!b&&!k&&!et&&li(o),vt=b||k||et||lt,It=vt?ta(o.length,jd):[],bt=It.length;for(var Gt in o)(g||Ne.call(o,Gt))&&!(vt&&(// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
476
476
|
Gt=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
477
477
|
et&&(Gt=="offset"||Gt=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
478
478
|
lt&&(Gt=="buffer"||Gt=="byteLength"||Gt=="byteOffset")||// Skip index properties.
|
|
479
|
-
ln(Gt,bt)))&&It.push(Gt);return It;}function af(o){var g=o.length;return g?o[ma(0,g-1)]:t;}function Np(o,g){return Us(yr(o),Wn(g,0,o.length));}function Bp(o){return Us(yr(o));}function aa(o,g,b){(b!==t&&!jr(o[g],b)||b===t&&!(g in o))&&sn(o,g,b);}function Di(o,g,b){var k=o[g];(!(Ne.call(o,g)&&jr(k,b))||b===t&&!(g in o))&&sn(o,g,b);}function Os(o,g){for(var b=o.length;b--;)if(jr(o[b][0],g))return b;return-1;}function Wp(o,g,b,k){return xn(o,function(et,lt,vt){g(k,et,b(et),vt);}),k;}function lf(o,g){return o&&Zr(g,rr(g),o);}function Fp(o,g){return o&&Zr(g,Sr(g),o);}function sn(o,g,b){g=="__proto__"&&Ps?Ps(o,g,{configurable:!0,enumerable:!0,value:b,writable:!0}):o[g]=b;}function la(o,g){for(var b=-1,k=g.length,et=Ft(k),lt=o==null;++b<k;)et[b]=lt?t:$a(o,g[b]);return et;}function Wn(o,g,b){return o===o&&(b!==t&&(o=o<=b?o:b),g!==t&&(o=o>=g?o:g)),o;}function Wr(o,g,b,k,et,lt){var vt,It=g&u,bt=g&y,Gt=g&T;if(b&&(vt=et?b(o,k,et,lt):b(o)),vt!==t)return vt;if(!Ve(o))return o;var Ht=pe(o);if(Ht){if(vt=O0(o),!It)return yr(o,vt);}else{var Kt=lr(o),_t=Kt==nt||Kt==j;if(On(o))return bf(o,It);if(Kt==$||Kt==wt||_t&&!et){if(vt=bt||_t?{}:Qf(o),!It)return bt?p0(o,Fp(vt,o)):d0(o,lf(vt,o));}else{if(!Ue[Kt])return et?o:{};vt=w0(o,Kt,It);}}lt||(lt=new $r());var re=lt.get(o);if(re)return re;lt.set(o,vt),wc(o)?o.forEach(function(ce){vt.add(Wr(ce,g,b,ce,o,lt));}):Ic(o)&&o.forEach(function(ce,Te){vt.set(Te,Wr(ce,g,b,Te,o,lt));});var fe=Gt?bt?Ea:Aa:bt?Sr:rr,Se=Ht?t:fe(o);return Dr(Se||o,function(ce,Te){Se&&(Te=ce,ce=o[Te]),Di(vt,Te,Wr(ce,g,b,Te,o,lt));}),vt;}function Up(o){var g=rr(o);return function(b){return ff(b,o,g);};}function ff(o,g,b){var k=b.length;if(o==null)return!k;for(o=Be(o);k--;){var et=b[k],lt=g[et],vt=o[et];if(vt===t&&!(et in o)||!lt(vt))return!1;}return!0;}function cf(o,g,b){if(typeof o!="function")throw new Nr(c);return Xi(function(){o.apply(t,b);},g);}function Ni(o,g,b,k){var et=-1,lt=ls,vt=!0,It=o.length,bt=[],Gt=g.length;if(!It)return bt;b&&(g=He(g,Ir(b))),k?(lt=Vo,vt=!1):g.length>=n&&(lt=Ai,vt=!1,g=new Bn(g));t:for(;++et<It;){var Ht=o[et],Kt=b==null?Ht:b(Ht);if(Ht=k||Ht!==0?Ht:0,vt&&Kt===Kt){for(var _t=Gt;_t--;)if(g[_t]===Kt)continue t;bt.push(Ht);}else lt(g,Kt,k)||bt.push(Ht);}return bt;}var xn=Ff(Vr),uf=Ff(ca,!0);function Yp(o,g){var b=!0;return xn(o,function(k,et,lt){return b=!!g(k,et,lt),b;}),b;}function ws(o,g,b){for(var k=-1,et=o.length;++k<et;){var lt=o[k],vt=g(lt);if(vt!=null&&(It===t?vt===vt&&!wr(vt):b(vt,It)))var It=vt,bt=lt;}return bt;}function Xp(o,g,b,k){var et=o.length;for(b=ye(b),b<0&&(b=-b>et?0:et+b),k=k===t||k>et?et:ye(k),k<0&&(k+=et),k=b>k?0:Ec(k);b<k;)o[b++]=g;return o;}function hf(o,g){var b=[];return xn(o,function(k,et,lt){g(k,et,lt)&&b.push(k);}),b;}function sr(o,g,b,k,et){var lt=-1,vt=o.length;for(b||(b=E0),et||(et=[]);++lt<vt;){var It=o[lt];g>0&&b(It)?g>1?sr(It,g-1,b,k,et):yn(et,It):k||(et[et.length]=It);}return et;}var fa=Uf(),df=Uf(!0);function Vr(o,g){return o&&fa(o,g,rr);}function ca(o,g){return o&&df(o,g,rr);}function As(o,g){return mn(g,function(b){return fn(o[b]);});}function Fn(o,g){g=Cn(g,o);for(var b=0,k=g.length;o!=null&&b<k;)o=o[Jr(g[b++])];return b&&b==k?o:t;}function pf(o,g,b){var k=g(o);return pe(o)?k:yn(k,b(o));}function ur(o){return o==null?o===t?Mt:L:Dn&&Dn in Be(o)?T0(o):B0(o);}function ua(o,g){return o>g;}function zp(o,g){return o!=null&&Ne.call(o,g);}function $p(o,g){return o!=null&&g in Be(o);}function jp(o,g,b){return o>=ar(g,b)&&o<tr(g,b);}function ha(o,g,b){for(var k=b?Vo:ls,et=o[0].length,lt=o.length,vt=lt,It=Ft(lt),bt=1/0,Gt=[];vt--;){var Ht=o[vt];vt&&g&&(Ht=He(Ht,Ir(g))),bt=ar(Ht.length,bt),It[vt]=!b&&(g||et>=120&&Ht.length>=120)?new Bn(vt&&Ht):t;}Ht=o[0];var Kt=-1,_t=It[0];t:for(;++Kt<et&&Gt.length<bt;){var re=Ht[Kt],fe=g?g(re):re;if(re=b||re!==0?re:0,!(_t?Ai(_t,fe):k(Gt,fe,b))){for(vt=lt;--vt;){var Se=It[vt];if(!(Se?Ai(Se,fe):k(o[vt],fe,b)))continue t;}_t&&_t.push(fe),Gt.push(re);}}return Gt;}function Gp(o,g,b,k){return Vr(o,function(et,lt,vt){g(k,b(et),lt,vt);}),k;}function Bi(o,g,b){g=Cn(g,o),o=ec(o,g);var k=o==null?o:o[Jr(Ur(g))];return k==null?t:Cr(k,o,b);}function vf(o){return Ze(o)&&ur(o)==wt;}function Hp(o){return Ze(o)&&ur(o)==Ot;}function kp(o){return Ze(o)&&ur(o)==X;}function Wi(o,g,b,k,et){return o===g?!0:o==null||g==null||!Ze(o)&&!Ze(g)?o!==o&&g!==g:Kp(o,g,b,k,Wi,et);}function Kp(o,g,b,k,et,lt){var vt=pe(o),It=pe(g),bt=vt?ht:lr(o),Gt=It?ht:lr(g);bt=bt==wt?$:bt,Gt=Gt==wt?$:Gt;var Ht=bt==$,Kt=Gt==$,_t=bt==Gt;if(_t&&On(o)){if(!On(g))return!1;vt=!0,Ht=!1;}if(_t&&!Ht)return lt||(lt=new $r()),vt||ai(o)?Vf(o,g,b,k,et,lt):S0(o,g,bt,b,k,et,lt);if(!(b&E)){var re=Ht&&Ne.call(o,"__wrapped__"),fe=Kt&&Ne.call(g,"__wrapped__");if(re||fe){var Se=re?o.value():o,ce=fe?g.value():g;return lt||(lt=new $r()),et(Se,ce,b,k,lt);}}return _t?(lt||(lt=new $r()),x0(o,g,b,k,et,lt)):!1;}function Vp(o){return Ze(o)&&lr(o)==Z;}function da(o,g,b,k){var et=b.length,lt=et,vt=!k;if(o==null)return!lt;for(o=Be(o);et--;){var It=b[et];if(vt&&It[2]?It[1]!==o[It[0]]:!(It[0]in o))return!1;}for(;++et<lt;){It=b[et];var bt=It[0],Gt=o[bt],Ht=It[1];if(vt&&It[2]){if(Gt===t&&!(bt in o))return!1;}else{var Kt=new $r();if(k)var _t=k(Gt,Ht,bt,o,g,Kt);if(!(_t===t?Wi(Ht,Gt,E|C,k,Kt):_t))return!1;}}return!0;}function gf(o){if(!Ve(o)||L0(o))return!1;var g=fn(o)?Vd:bo;return g.test(Yn(o));}function Zp(o){return Ze(o)&&ur(o)==it;}function Jp(o){return Ze(o)&&lr(o)==ct;}function Qp(o){return Ze(o)&&Gs(o.length)&&!!ze[ur(o)];}function mf(o){return typeof o=="function"?o:o==null?xr:_typeof(o)=="object"?pe(o)?Sf(o[0],o[1]):Pf(o):Yc(o);}function pa(o){if(!Yi(o))return tp(o);var g=[];for(var b in Be(o))Ne.call(o,b)&&b!="constructor"&&g.push(b);return g;}function qp(o){if(!Ve(o))return N0(o);var g=Yi(o),b=[];for(var k in o)k=="constructor"&&(g||!Ne.call(o,k))||b.push(k);return b;}function va(o,g){return o<g;}function yf(o,g){var b=-1,k=Pr(o)?Ft(o.length):[];return xn(o,function(et,lt,vt){k[++b]=g(et,lt,vt);}),k;}function Pf(o){var g=La(o);return g.length==1&&g[0][2]?_f(g[0][0],g[0][1]):function(b){return b===o||da(b,o,g);};}function Sf(o,g){return ba(o)&&qf(g)?_f(Jr(o),g):function(b){var k=$a(b,o);return k===t&&k===g?ja(b,o):Wi(g,k,E|C);};}function Es(o,g,b,k,et){o!==g&&fa(g,function(lt,vt){if(et||(et=new $r()),Ve(lt))_p(o,g,vt,b,Es,k,et);else{var It=k?k(Na(o,vt),lt,vt+"",o,g,et):t;It===t&&(It=lt),aa(o,vt,It);}},Sr);}function _p(o,g,b,k,et,lt,vt){var It=Na(o,b),bt=Na(g,b),Gt=vt.get(bt);if(Gt){aa(o,b,Gt);return;}var Ht=lt?lt(It,bt,b+"",o,g,vt):t,Kt=Ht===t;if(Kt){var _t=pe(bt),re=!_t&&On(bt),fe=!_t&&!re&&ai(bt);Ht=bt,_t||re||fe?pe(It)?Ht=It:Qe(It)?Ht=yr(It):re?(Kt=!1,Ht=bf(bt,!0)):fe?(Kt=!1,Ht=Df(bt,!0)):Ht=[]:zi(bt)||Xn(bt)?(Ht=It,Xn(It)?Ht=Mc(It):(!Ve(It)||fn(It))&&(Ht=Qf(bt))):Kt=!1;}Kt&&(vt.set(bt,Ht),et(Ht,bt,k,lt,vt),vt["delete"](bt)),aa(o,b,Ht);}function xf(o,g){var b=o.length;if(b)return g+=g<0?b:0,ln(g,b)?o[g]:t;}function Tf(o,g,b){g.length?g=He(g,function(lt){return pe(lt)?function(vt){return Fn(vt,lt.length===1?lt[0]:lt);}:lt;}):g=[xr];var k=-1;g=He(g,Ir(le()));var et=yf(o,function(lt,vt,It){var bt=He(g,function(Gt){return Gt(lt);});return{criteria:bt,index:++k,value:lt};});return wd(et,function(lt,vt){return h0(lt,vt,b);});}function t0(o,g){return Cf(o,g,function(b,k){return ja(o,k);});}function Cf(o,g,b){for(var k=-1,et=g.length,lt={};++k<et;){var vt=g[k],It=Fn(o,vt);b(It,vt)&&Fi(lt,Cn(vt,o),It);}return lt;}function e0(o){return function(g){return Fn(g,o);};}function ga(o,g,b,k){var et=k?Od:Jn,lt=-1,vt=g.length,It=o;for(o===g&&(g=yr(g)),b&&(It=He(o,Ir(b)));++lt<vt;)for(var bt=0,Gt=g[lt],Ht=b?b(Gt):Gt;(bt=et(It,Ht,bt,k))>-1;)It!==o&&ys.call(It,bt,1),ys.call(o,bt,1);return o;}function If(o,g){for(var b=o?g.length:0,k=b-1;b--;){var et=g[b];if(b==k||et!==lt){var lt=et;ln(et)?ys.call(o,et,1):Sa(o,et);}}return o;}function ma(o,g){return o+xs(nf()*(g-o+1));}function r0(o,g,b,k){for(var et=-1,lt=tr(Ss((g-o)/(b||1)),0),vt=Ft(lt);lt--;)vt[k?lt:++et]=o,o+=b;return vt;}function ya(o,g){var b="";if(!o||g<1||g>at)return b;do g%2&&(b+=o),g=xs(g/2),g&&(o+=o);while(g);return b;}function xe(o,g){return Ba(tc(o,g,xr),o+"");}function n0(o){return af(li(o));}function i0(o,g){var b=li(o);return Us(b,Wn(g,0,b.length));}function Fi(o,g,b,k){if(!Ve(o))return o;g=Cn(g,o);for(var et=-1,lt=g.length,vt=lt-1,It=o;It!=null&&++et<lt;){var bt=Jr(g[et]),Gt=b;if(bt==="__proto__"||bt==="constructor"||bt==="prototype")return o;if(et!=vt){var Ht=It[bt];Gt=k?k(Ht,bt,It):t,Gt===t&&(Gt=Ve(Ht)?Ht:ln(g[et+1])?[]:{});}Di(It,bt,Gt),It=It[bt];}return o;}var Of=Ts?function(o,g){return Ts.set(o,g),o;}:xr,s0=Ps?function(o,g){return Ps(o,"toString",{configurable:!0,enumerable:!1,value:Ha(g),writable:!0});}:xr;function o0(o){return Us(li(o));}function Fr(o,g,b){var k=-1,et=o.length;g<0&&(g=-g>et?0:et+g),b=b>et?et:b,b<0&&(b+=et),et=g>b?0:b-g>>>0,g>>>=0;for(var lt=Ft(et);++k<et;)lt[k]=o[k+g];return lt;}function a0(o,g){var b;return xn(o,function(k,et,lt){return b=g(k,et,lt),!b;}),!!b;}function Ms(o,g,b){var k=0,et=o==null?k:o.length;if(typeof g=="number"&&g===g&&et<=gt){for(;k<et;){var lt=k+et>>>1,vt=o[lt];vt!==null&&!wr(vt)&&(b?vt<=g:vt<g)?k=lt+1:et=lt;}return et;}return Pa(o,g,xr,b);}function Pa(o,g,b,k){var et=0,lt=o==null?0:o.length;if(lt===0)return 0;g=b(g);for(var vt=g!==g,It=g===null,bt=wr(g),Gt=g===t;et<lt;){var Ht=xs((et+lt)/2),Kt=b(o[Ht]),_t=Kt!==t,re=Kt===null,fe=Kt===Kt,Se=wr(Kt);if(vt)var ce=k||fe;else Gt?ce=fe&&(k||_t):It?ce=fe&&_t&&(k||!re):bt?ce=fe&&_t&&!re&&(k||!Se):re||Se?ce=!1:ce=k?Kt<=g:Kt<g;ce?et=Ht+1:lt=Ht;}return ar(lt,ft);}function wf(o,g){for(var b=-1,k=o.length,et=0,lt=[];++b<k;){var vt=o[b],It=g?g(vt):vt;if(!b||!jr(It,bt)){var bt=It;lt[et++]=vt===0?0:vt;}}return lt;}function Af(o){return typeof o=="number"?o:wr(o)?K:+o;}function Or(o){if(typeof o=="string")return o;if(pe(o))return He(o,Or)+"";if(wr(o))return sf?sf.call(o):"";var g=o+"";return g=="0"&&1/o==-tt?"-0":g;}function Tn(o,g,b){var k=-1,et=ls,lt=o.length,vt=!0,It=[],bt=It;if(b)vt=!1,et=Vo;else if(lt>=n){var Gt=g?null:y0(o);if(Gt)return cs(Gt);vt=!1,et=Ai,bt=new Bn();}else bt=g?[]:It;t:for(;++k<lt;){var Ht=o[k],Kt=g?g(Ht):Ht;if(Ht=b||Ht!==0?Ht:0,vt&&Kt===Kt){for(var _t=bt.length;_t--;)if(bt[_t]===Kt)continue t;g&&bt.push(Kt),It.push(Ht);}else et(bt,Kt,b)||(bt!==It&&bt.push(Kt),It.push(Ht));}return It;}function Sa(o,g){return g=Cn(g,o),o=ec(o,g),o==null||delete o[Jr(Ur(g))];}function Ef(o,g,b,k){return Fi(o,g,b(Fn(o,g)),k);}function Ls(o,g,b,k){for(var et=o.length,lt=k?et:-1;(k?lt--:++lt<et)&&g(o[lt],lt,o););return b?Fr(o,k?0:lt,k?lt+1:et):Fr(o,k?lt+1:0,k?et:lt);}function Mf(o,g){var b=o;return b instanceof Ce&&(b=b.value()),Zo(g,function(k,et){return et.func.apply(et.thisArg,yn([k],et.args));},b);}function xa(o,g,b){var k=o.length;if(k<2)return k?Tn(o[0]):[];for(var et=-1,lt=Ft(k);++et<k;)for(var vt=o[et],It=-1;++It<k;)It!=et&&(lt[et]=Ni(lt[et]||vt,o[It],g,b));return Tn(sr(lt,1),g,b);}function Lf(o,g,b){for(var k=-1,et=o.length,lt=g.length,vt={};++k<et;){var It=k<lt?g[k]:t;b(vt,o[k],It);}return vt;}function Ta(o){return Qe(o)?o:[];}function Ca(o){return typeof o=="function"?o:xr;}function Cn(o,g){return pe(o)?o:ba(o,g)?[o]:sc(Le(o));}var l0=xe;function In(o,g,b){var k=o.length;return b=b===t?k:b,!g&&b>=k?o:Fr(o,g,b);}var Rf=Zd||function(o){return ir.clearTimeout(o);};function bf(o,g){if(g)return o.slice();var b=o.length,k=ql?ql(b):new o.constructor(b);return o.copy(k),k;}function Ia(o){var g=new o.constructor(o.byteLength);return new gs(g).set(new gs(o)),g;}function f0(o,g){var b=g?Ia(o.buffer):o.buffer;return new o.constructor(b,o.byteOffset,o.byteLength);}function c0(o){var g=new o.constructor(o.source,_i.exec(o));return g.lastIndex=o.lastIndex,g;}function u0(o){return bi?Be(bi.call(o)):{};}function Df(o,g){var b=g?Ia(o.buffer):o.buffer;return new o.constructor(b,o.byteOffset,o.length);}function Nf(o,g){if(o!==g){var b=o!==t,k=o===null,et=o===o,lt=wr(o),vt=g!==t,It=g===null,bt=g===g,Gt=wr(g);if(!It&&!Gt&&!lt&&o>g||lt&&vt&&bt&&!It&&!Gt||k&&vt&&bt||!b&&bt||!et)return 1;if(!k&&!lt&&!Gt&&o<g||Gt&&b&&et&&!k&&!lt||It&&b&&et||!vt&&et||!bt)return-1;}return 0;}function h0(o,g,b){for(var k=-1,et=o.criteria,lt=g.criteria,vt=et.length,It=b.length;++k<vt;){var bt=Nf(et[k],lt[k]);if(bt){if(k>=It)return bt;var Gt=b[k];return bt*(Gt=="desc"?-1:1);}}return o.index-g.index;}function Bf(o,g,b,k){for(var et=-1,lt=o.length,vt=b.length,It=-1,bt=g.length,Gt=tr(lt-vt,0),Ht=Ft(bt+Gt),Kt=!k;++It<bt;)Ht[It]=g[It];for(;++et<vt;)(Kt||et<lt)&&(Ht[b[et]]=o[et]);for(;Gt--;)Ht[It++]=o[et++];return Ht;}function Wf(o,g,b,k){for(var et=-1,lt=o.length,vt=-1,It=b.length,bt=-1,Gt=g.length,Ht=tr(lt-It,0),Kt=Ft(Ht+Gt),_t=!k;++et<Ht;)Kt[et]=o[et];for(var re=et;++bt<Gt;)Kt[re+bt]=g[bt];for(;++vt<It;)(_t||et<lt)&&(Kt[re+b[vt]]=o[et++]);return Kt;}function yr(o,g){var b=-1,k=o.length;for(g||(g=Ft(k));++b<k;)g[b]=o[b];return g;}function Zr(o,g,b,k){var et=!b;b||(b={});for(var lt=-1,vt=g.length;++lt<vt;){var It=g[lt],bt=k?k(b[It],o[It],It,b,o):t;bt===t&&(bt=o[It]),et?sn(b,It,bt):Di(b,It,bt);}return b;}function d0(o,g){return Zr(o,Ra(o),g);}function p0(o,g){return Zr(o,Zf(o),g);}function Rs(o,g){return function(b,k){var et=pe(b)?Pd:Wp,lt=g?g():{};return et(b,o,le(k,2),lt);};}function ii(o){return xe(function(g,b){var k=-1,et=b.length,lt=et>1?b[et-1]:t,vt=et>2?b[2]:t;for(lt=o.length>3&&typeof lt=="function"?(et--,lt):t,vt&&hr(b[0],b[1],vt)&&(lt=et<3?t:lt,et=1),g=Be(g);++k<et;){var It=b[k];It&&o(g,It,k,lt);}return g;});}function Ff(o,g){return function(b,k){if(b==null)return b;if(!Pr(b))return o(b,k);for(var et=b.length,lt=g?et:-1,vt=Be(b);(g?lt--:++lt<et)&&k(vt[lt],lt,vt)!==!1;);return b;};}function Uf(o){return function(g,b,k){for(var et=-1,lt=Be(g),vt=k(g),It=vt.length;It--;){var bt=vt[o?It:++et];if(b(lt[bt],bt,lt)===!1)break;}return g;};}function v0(o,g,b){var k=g&x,et=Ui(o);function lt(){var vt=this&&this!==ir&&this instanceof lt?et:o;return vt.apply(k?b:this,arguments);}return lt;}function Yf(o){return function(g){g=Le(g);var b=Qn(g)?zr(g):t,k=b?b[0]:g.charAt(0),et=b?In(b,1).join(""):g.slice(1);return k[o]()+et;};}function si(o){return function(g){return Zo(Fc(Wc(g).replace(gn,"")),o,"");};}function Ui(o){return function(){var g=arguments;switch(g.length){case 0:return new o();case 1:return new o(g[0]);case 2:return new o(g[0],g[1]);case 3:return new o(g[0],g[1],g[2]);case 4:return new o(g[0],g[1],g[2],g[3]);case 5:return new o(g[0],g[1],g[2],g[3],g[4]);case 6:return new o(g[0],g[1],g[2],g[3],g[4],g[5]);case 7:return new o(g[0],g[1],g[2],g[3],g[4],g[5],g[6]);}var b=ni(o.prototype),k=o.apply(b,g);return Ve(k)?k:b;};}function g0(o,g,b){var k=Ui(o);function et(){for(var lt=arguments.length,vt=Ft(lt),It=lt,bt=oi(et);It--;)vt[It]=arguments[It];var Gt=lt<3&&vt[0]!==bt&&vt[lt-1]!==bt?[]:Pn(vt,bt);if(lt-=Gt.length,lt<b)return Gf(o,g,bs,et.placeholder,t,vt,Gt,t,t,b-lt);var Ht=this&&this!==ir&&this instanceof et?k:o;return Cr(Ht,this,vt);}return et;}function Xf(o){return function(g,b,k){var et=Be(g);if(!Pr(g)){var lt=le(b,3);g=rr(g),b=function b(It){return lt(et[It],It,et);};}var vt=o(g,b,k);return vt>-1?et[lt?g[vt]:vt]:t;};}function zf(o){return an(function(g){var b=g.length,k=b,et=Br.prototype.thru;for(o&&g.reverse();k--;){var lt=g[k];if(typeof lt!="function")throw new Nr(c);if(et&&!vt&&Ws(lt)=="wrapper")var vt=new Br([],!0);}for(k=vt?k:b;++k<b;){lt=g[k];var It=Ws(lt),bt=It=="wrapper"?Ma(lt):t;bt&&Da(bt[0])&&bt[1]==(R|v|S|D)&&!bt[4].length&&bt[9]==1?vt=vt[Ws(bt[0])].apply(vt,bt[3]):vt=lt.length==1&&Da(lt)?vt[It]():vt.thru(lt);}return function(){var Gt=arguments,Ht=Gt[0];if(vt&&Gt.length==1&&pe(Ht))return vt.plant(Ht).value();for(var Kt=0,_t=b?g[Kt].apply(this,Gt):Ht;++Kt<b;)_t=g[Kt].call(this,_t);return _t;};});}function bs(o,g,b,k,et,lt,vt,It,bt,Gt){var Ht=g&R,Kt=g&x,_t=g&I,re=g&(v|p),fe=g&U,Se=_t?t:Ui(o);function ce(){for(var Te=arguments.length,Oe=Ft(Te),Ar=Te;Ar--;)Oe[Ar]=arguments[Ar];if(re)var dr=oi(ce),Er=Ed(Oe,dr);if(k&&(Oe=Bf(Oe,k,et,re)),lt&&(Oe=Wf(Oe,lt,vt,re)),Te-=Er,re&&Te<Gt){var qe=Pn(Oe,dr);return Gf(o,g,bs,ce.placeholder,b,Oe,qe,It,bt,Gt-Te);}var Gr=Kt?b:this,un=_t?Gr[o]:o;return Te=Oe.length,It?Oe=W0(Oe,It):fe&&Te>1&&Oe.reverse(),Ht&&bt<Te&&(Oe.length=bt),this&&this!==ir&&this instanceof ce&&(un=Se||Ui(un)),un.apply(Gr,Oe);}return ce;}function $f(o,g){return function(b,k){return Gp(b,o,g(k),{});};}function Ds(o,g){return function(b,k){var et;if(b===t&&k===t)return g;if(b!==t&&(et=b),k!==t){if(et===t)return k;typeof b=="string"||typeof k=="string"?(b=Or(b),k=Or(k)):(b=Af(b),k=Af(k)),et=o(b,k);}return et;};}function Oa(o){return an(function(g){return g=He(g,Ir(le())),xe(function(b){var k=this;return o(g,function(et){return Cr(et,k,b);});});});}function Ns(o,g){g=g===t?" ":Or(g);var b=g.length;if(b<2)return b?ya(g,o):g;var k=ya(g,Ss(o/qn(g)));return Qn(g)?In(zr(k),0,o).join(""):k.slice(0,o);}function m0(o,g,b,k){var et=g&x,lt=Ui(o);function vt(){for(var It=-1,bt=arguments.length,Gt=-1,Ht=k.length,Kt=Ft(Ht+bt),_t=this&&this!==ir&&this instanceof vt?lt:o;++Gt<Ht;)Kt[Gt]=k[Gt];for(;bt--;)Kt[Gt++]=arguments[++It];return Cr(_t,et?b:this,Kt);}return vt;}function jf(o){return function(g,b,k){return k&&typeof k!="number"&&hr(g,b,k)&&(b=k=t),g=cn(g),b===t?(b=g,g=0):b=cn(b),k=k===t?g<b?1:-1:cn(k),r0(g,b,k,o);};}function Bs(o){return function(g,b){return typeof g=="string"&&typeof b=="string"||(g=Yr(g),b=Yr(b)),o(g,b);};}function Gf(o,g,b,k,et,lt,vt,It,bt,Gt){var Ht=g&v,Kt=Ht?vt:t,_t=Ht?t:vt,re=Ht?lt:t,fe=Ht?t:lt;g|=Ht?S:A,g&=~(Ht?A:S),g&d||(g&=~(x|I));var Se=[o,g,et,re,Kt,fe,_t,It,bt,Gt],ce=b.apply(t,Se);return Da(o)&&rc(ce,Se),ce.placeholder=k,nc(ce,o,g);}function wa(o){var g=_e[o];return function(b,k){if(b=Yr(b),k=k==null?0:ar(ye(k),292),k&&rf(b)){var et=(Le(b)+"e").split("e"),lt=g(et[0]+"e"+(+et[1]+k));return et=(Le(lt)+"e").split("e"),+(et[0]+"e"+(+et[1]-k));}return g(b);};}var y0=ei&&1/cs(new ei([,-0]))[1]==tt?function(o){return new ei(o);}:Va;function Hf(o){return function(g){var b=lr(g);return b==Z?ra(g):b==ct?Bd(g):Ad(g,o(g));};}function on(o,g,b,k,et,lt,vt,It){var bt=g&I;if(!bt&&typeof o!="function")throw new Nr(c);var Gt=k?k.length:0;if(Gt||(g&=~(S|A),k=et=t),vt=vt===t?vt:tr(ye(vt),0),It=It===t?It:ye(It),Gt-=et?et.length:0,g&A){var Ht=k,Kt=et;k=et=t;}var _t=bt?t:Ma(o),re=[o,g,b,k,et,Ht,Kt,lt,vt,It];if(_t&&D0(re,_t),o=re[0],g=re[1],b=re[2],k=re[3],et=re[4],It=re[9]=re[9]===t?bt?0:o.length:tr(re[9]-Gt,0),!It&&g&(v|p)&&(g&=~(v|p)),!g||g==x)var fe=v0(o,g,b);else g==v||g==p?fe=g0(o,g,It):(g==S||g==(x|S))&&!et.length?fe=m0(o,g,b,k):fe=bs.apply(t,re);var Se=_t?Of:rc;return nc(Se(fe,re),o,g);}function kf(o,g,b,k){return o===t||jr(o,ti[b])&&!Ne.call(k,b)?g:o;}function Kf(o,g,b,k,et,lt){return Ve(o)&&Ve(g)&&(lt.set(g,o),Es(o,g,t,Kf,lt),lt["delete"](g)),o;}function P0(o){return zi(o)?t:o;}function Vf(o,g,b,k,et,lt){var vt=b&E,It=o.length,bt=g.length;if(It!=bt&&!(vt&&bt>It))return!1;var Gt=lt.get(o),Ht=lt.get(g);if(Gt&&Ht)return Gt==g&&Ht==o;var Kt=-1,_t=!0,re=b&C?new Bn():t;for(lt.set(o,g),lt.set(g,o);++Kt<It;){var fe=o[Kt],Se=g[Kt];if(k)var ce=vt?k(Se,fe,Kt,g,o,lt):k(fe,Se,Kt,o,g,lt);if(ce!==t){if(ce)continue;_t=!1;break;}if(re){if(!Jo(g,function(Te,Oe){if(!Ai(re,Oe)&&(fe===Te||et(fe,Te,b,k,lt)))return re.push(Oe);})){_t=!1;break;}}else if(!(fe===Se||et(fe,Se,b,k,lt))){_t=!1;break;}}return lt["delete"](o),lt["delete"](g),_t;}function S0(o,g,b,k,et,lt,vt){switch(b){case Lt:if(o.byteLength!=g.byteLength||o.byteOffset!=g.byteOffset)return!1;o=o.buffer,g=g.buffer;case Ot:return!(o.byteLength!=g.byteLength||!lt(new gs(o),new gs(g)));case Rt:case X:case O:return jr(+o,+g);case q:return o.name==g.name&&o.message==g.message;case it:case St:return o==g+"";case Z:var It=ra;case ct:var bt=k&E;if(It||(It=cs),o.size!=g.size&&!bt)return!1;var Gt=vt.get(o);if(Gt)return Gt==g;k|=C,vt.set(o,g);var Ht=Vf(It(o),It(g),k,et,lt,vt);return vt["delete"](o),Ht;case Ct:if(bi)return bi.call(o)==bi.call(g);}return!1;}function x0(o,g,b,k,et,lt){var vt=b&E,It=Aa(o),bt=It.length,Gt=Aa(g),Ht=Gt.length;if(bt!=Ht&&!vt)return!1;for(var Kt=bt;Kt--;){var _t=It[Kt];if(!(vt?_t in g:Ne.call(g,_t)))return!1;}var re=lt.get(o),fe=lt.get(g);if(re&&fe)return re==g&&fe==o;var Se=!0;lt.set(o,g),lt.set(g,o);for(var ce=vt;++Kt<bt;){_t=It[Kt];var Te=o[_t],Oe=g[_t];if(k)var Ar=vt?k(Oe,Te,_t,g,o,lt):k(Te,Oe,_t,o,g,lt);if(!(Ar===t?Te===Oe||et(Te,Oe,b,k,lt):Ar)){Se=!1;break;}ce||(ce=_t=="constructor");}if(Se&&!ce){var dr=o.constructor,Er=g.constructor;dr!=Er&&"constructor"in o&&"constructor"in g&&!(typeof dr=="function"&&dr instanceof dr&&typeof Er=="function"&&Er instanceof Er)&&(Se=!1);}return lt["delete"](o),lt["delete"](g),Se;}function an(o){return Ba(tc(o,t,fc),o+"");}function Aa(o){return pf(o,rr,Ra);}function Ea(o){return pf(o,Sr,Zf);}var Ma=Ts?function(o){return Ts.get(o);}:Va;function Ws(o){for(var g=o.name+"",b=ri[g],k=Ne.call(ri,g)?b.length:0;k--;){var et=b[k],lt=et.func;if(lt==null||lt==o)return et.name;}return g;}function oi(o){var g=Ne.call(ot,"placeholder")?ot:o;return g.placeholder;}function le(){var o=ot.iteratee||ka;return o=o===ka?mf:o,arguments.length?o(arguments[0],arguments[1]):o;}function Fs(o,g){var b=o.__data__;return M0(g)?b[typeof g=="string"?"string":"hash"]:b.map;}function La(o){for(var g=rr(o),b=g.length;b--;){var k=g[b],et=o[k];g[b]=[k,et,qf(et)];}return g;}function Un(o,g){var b=bd(o,g);return gf(b)?b:t;}function T0(o){var g=Ne.call(o,Dn),b=o[Dn];try{o[Dn]=t;var k=!0;}catch(_unused26){}var et=ps.call(o);return k&&(g?o[Dn]=b:delete o[Dn]),et;}var Ra=ia?function(o){return o==null?[]:(o=Be(o),mn(ia(o),function(g){return tf.call(o,g);}));}:Za,Zf=ia?function(o){for(var g=[];o;)yn(g,Ra(o)),o=ms(o);return g;}:Za,lr=ur;(sa&&lr(new sa(new ArrayBuffer(1)))!=Lt||Mi&&lr(new Mi())!=Z||oa&&lr(oa.resolve())!=V||ei&&lr(new ei())!=ct||Li&&lr(new Li())!=Dt)&&(lr=function lr(o){var g=ur(o),b=g==$?o.constructor:t,k=b?Yn(b):"";if(k)switch(k){case ip:return Lt;case sp:return Z;case op:return V;case ap:return ct;case lp:return Dt;}return g;});function C0(o,g,b){for(var k=-1,et=b.length;++k<et;){var lt=b[k],vt=lt.size;switch(lt.type){case"drop":o+=vt;break;case"dropRight":g-=vt;break;case"take":g=ar(g,o+vt);break;case"takeRight":o=tr(o,g-vt);break;}}return{start:o,end:g};}function I0(o){var g=o.match(wo);return g?g[1].split(Ao):[];}function Jf(o,g,b){g=Cn(g,o);for(var k=-1,et=g.length,lt=!1;++k<et;){var vt=Jr(g[k]);if(!(lt=o!=null&&b(o,vt)))break;o=o[vt];}return lt||++k!=et?lt:(et=o==null?0:o.length,!!et&&Gs(et)&&ln(vt,et)&&(pe(o)||Xn(o)));}function O0(o){var g=o.length,b=new o.constructor(g);return g&&typeof o[0]=="string"&&Ne.call(o,"index")&&(b.index=o.index,b.input=o.input),b;}function Qf(o){return typeof o.constructor=="function"&&!Yi(o)?ni(ms(o)):{};}function w0(o,g,b){var k=o.constructor;switch(g){case Ot:return Ia(o);case Rt:case X:return new k(+o);case Lt:return f0(o,b);case Yt:case zt:case Wt:case Qt:case ue:case ie:case ne:case ae:case se:return Df(o,b);case Z:return new k();case O:case St:return new k(o);case it:return c0(o);case ct:return new k();case Ct:return u0(o);}}function A0(o,g){var b=g.length;if(!b)return o;var k=b-1;return g[k]=(b>1?"& ":"")+g[k],g=g.join(b>2?", ":" "),o.replace(Oo,"{\n/* [wrapped with "+g+"] */\n");}function E0(o){return pe(o)||Xn(o)||!!(ef&&o&&o[ef]);}function ln(o,g){var _g2;var b=_typeof(o);return g=(_g2=g)!==null&&_g2!==void 0?_g2:at,!!g&&(b=="number"||b!="symbol"&&No.test(o))&&o>-1&&o%1==0&&o<g;}function hr(o,g,b){if(!Ve(b))return!1;var k=_typeof(g);return(k=="number"?Pr(b)&&ln(g,b.length):k=="string"&&g in b)?jr(b[g],o):!1;}function ba(o,g){if(pe(o))return!1;var b=_typeof(o);return b=="number"||b=="symbol"||b=="boolean"||o==null||wr(o)?!0:Gn.test(o)||!tn.test(o)||g!=null&&o in Be(g);}function M0(o){var g=_typeof(o);return g=="string"||g=="number"||g=="symbol"||g=="boolean"?o!=="__proto__":o===null;}function Da(o){var g=Ws(o),b=ot[g];if(typeof b!="function"||!(g in Ce.prototype))return!1;if(o===b)return!0;var k=Ma(b);return!!k&&o===k[0];}function L0(o){return!!Ql&&Ql in o;}var R0=hs?fn:Ja;function Yi(o){var g=o&&o.constructor,b=typeof g=="function"&&g.prototype||ti;return o===b;}function qf(o){return o===o&&!Ve(o);}function _f(o,g){return function(b){return b==null?!1:b[o]===g&&(g!==t||o in Be(b));};}function b0(o){var g=$s(o,function(k){return b.size===h&&b.clear(),k;}),b=g.cache;return g;}function D0(o,g){var b=o[1],k=g[1],et=b|k,lt=et<(x|I|R),vt=k==R&&b==v||k==R&&b==D&&o[7].length<=g[8]||k==(R|D)&&g[7].length<=g[8]&&b==v;if(!(lt||vt))return o;k&x&&(o[2]=g[2],et|=b&x?0:d);var It=g[3];if(It){var bt=o[3];o[3]=bt?Bf(bt,It,g[4]):It,o[4]=bt?Pn(o[3],m):g[4];}return It=g[5],It&&(bt=o[5],o[5]=bt?Wf(bt,It,g[6]):It,o[6]=bt?Pn(o[5],m):g[6]),It=g[7],It&&(o[7]=It),k&R&&(o[8]=o[8]==null?g[8]:ar(o[8],g[8])),o[9]==null&&(o[9]=g[9]),o[0]=g[0],o[1]=et,o;}function N0(o){var g=[];if(o!=null)for(var b in Be(o))g.push(b);return g;}function B0(o){return ps.call(o);}function tc(o,g,b){return g=tr(g===t?o.length-1:g,0),function(){for(var k=arguments,et=-1,lt=tr(k.length-g,0),vt=Ft(lt);++et<lt;)vt[et]=k[g+et];et=-1;for(var It=Ft(g+1);++et<g;)It[et]=k[et];return It[g]=b(vt),Cr(o,this,It);};}function ec(o,g){return g.length<2?o:Fn(o,Fr(g,0,-1));}function W0(o,g){for(var b=o.length,k=ar(g.length,b),et=yr(o);k--;){var lt=g[k];o[k]=ln(lt,b)?et[lt]:t;}return o;}function Na(o,g){if(!(g==="constructor"&&typeof o[g]=="function")&&g!="__proto__")return o[g];}var rc=ic(Of),Xi=Qd||function(o,g){return ir.setTimeout(o,g);},Ba=ic(s0);function nc(o,g,b){var k=g+"";return Ba(o,A0(k,F0(I0(k),b)));}function ic(o){var g=0,b=0;return function(){var k=ep(),et=B-(k-b);if(b=k,et>0){if(++g>=Y)return arguments[0];}else g=0;return o.apply(t,arguments);};}function Us(o,g){var b=-1,k=o.length,et=k-1;for(g=g===t?k:g;++b<g;){var lt=ma(b,et),vt=o[lt];o[lt]=o[b],o[b]=vt;}return o.length=g,o;}var sc=b0(function(o){var g=[];return o.charCodeAt(0)===46&&g.push(""),o.replace(Hn,function(b,k,et,lt){g.push(et?lt.replace(Lo,"$1"):k||b);}),g;});function Jr(o){if(typeof o=="string"||wr(o))return o;var g=o+"";return g=="0"&&1/o==-tt?"-0":g;}function Yn(o){if(o!=null){try{return ds.call(o);}catch(_unused27){}try{return o+"";}catch(_unused28){}}return"";}function F0(o,g){return Dr(mt,function(b){var k="_."+b[0];g&b[1]&&!ls(o,k)&&o.push(k);}),o.sort();}function oc(o){if(o instanceof Ce)return o.clone();var g=new Br(o.__wrapped__,o.__chain__);return g.__actions__=yr(o.__actions__),g.__index__=o.__index__,g.__values__=o.__values__,g;}function U0(o,g,b){(b?hr(o,g,b):g===t)?g=1:g=tr(ye(g),0);var k=o==null?0:o.length;if(!k||g<1)return[];for(var et=0,lt=0,vt=Ft(Ss(k/g));et<k;)vt[lt++]=Fr(o,et,et+=g);return vt;}function Y0(o){for(var g=-1,b=o==null?0:o.length,k=0,et=[];++g<b;){var lt=o[g];lt&&(et[k++]=lt);}return et;}function X0(){var o=arguments.length;if(!o)return[];for(var g=Ft(o-1),b=arguments[0],k=o;k--;)g[k-1]=arguments[k];return yn(pe(b)?yr(b):[b],sr(g,1));}var z0=xe(function(o,g){return Qe(o)?Ni(o,sr(g,1,Qe,!0)):[];}),$0=xe(function(o,g){var b=Ur(g);return Qe(b)&&(b=t),Qe(o)?Ni(o,sr(g,1,Qe,!0),le(b,2)):[];}),j0=xe(function(o,g){var b=Ur(g);return Qe(b)&&(b=t),Qe(o)?Ni(o,sr(g,1,Qe,!0),t,b):[];});function G0(o,g,b){var k=o==null?0:o.length;return k?(g=b||g===t?1:ye(g),Fr(o,g<0?0:g,k)):[];}function H0(o,g,b){var k=o==null?0:o.length;return k?(g=b||g===t?1:ye(g),g=k-g,Fr(o,0,g<0?0:g)):[];}function k0(o,g){return o&&o.length?Ls(o,le(g,3),!0,!0):[];}function K0(o,g){return o&&o.length?Ls(o,le(g,3),!0):[];}function V0(o,g,b,k){var et=o==null?0:o.length;return et?(b&&typeof b!="number"&&hr(o,g,b)&&(b=0,k=et),Xp(o,g,b,k)):[];}function ac(o,g,b){var k=o==null?0:o.length;if(!k)return-1;var et=b==null?0:ye(b);return et<0&&(et=tr(k+et,0)),fs(o,le(g,3),et);}function lc(o,g,b){var k=o==null?0:o.length;if(!k)return-1;var et=k-1;return b!==t&&(et=ye(b),et=b<0?tr(k+et,0):ar(et,k-1)),fs(o,le(g,3),et,!0);}function fc(o){var g=o==null?0:o.length;return g?sr(o,1):[];}function Z0(o){var g=o==null?0:o.length;return g?sr(o,tt):[];}function J0(o,g){var b=o==null?0:o.length;return b?(g=g===t?1:ye(g),sr(o,g)):[];}function Q0(o){for(var g=-1,b=o==null?0:o.length,k={};++g<b;){var et=o[g];k[et[0]]=et[1];}return k;}function cc(o){return o&&o.length?o[0]:t;}function q0(o,g,b){var k=o==null?0:o.length;if(!k)return-1;var et=b==null?0:ye(b);return et<0&&(et=tr(k+et,0)),Jn(o,g,et);}function _0(o){var g=o==null?0:o.length;return g?Fr(o,0,-1):[];}var tv=xe(function(o){var g=He(o,Ta);return g.length&&g[0]===o[0]?ha(g):[];}),ev=xe(function(o){var g=Ur(o),b=He(o,Ta);return g===Ur(b)?g=t:b.pop(),b.length&&b[0]===o[0]?ha(b,le(g,2)):[];}),rv=xe(function(o){var g=Ur(o),b=He(o,Ta);return g=typeof g=="function"?g:t,g&&b.pop(),b.length&&b[0]===o[0]?ha(b,t,g):[];});function nv(o,g){return o==null?"":_d.call(o,g);}function Ur(o){var g=o==null?0:o.length;return g?o[g-1]:t;}function iv(o,g,b){var k=o==null?0:o.length;if(!k)return-1;var et=k;return b!==t&&(et=ye(b),et=et<0?tr(k+et,0):ar(et,k-1)),g===g?Fd(o,g,et):fs(o,jl,et,!0);}function sv(o,g){return o&&o.length?xf(o,ye(g)):t;}var ov=xe(uc);function uc(o,g){return o&&o.length&&g&&g.length?ga(o,g):o;}function av(o,g,b){return o&&o.length&&g&&g.length?ga(o,g,le(b,2)):o;}function lv(o,g,b){return o&&o.length&&g&&g.length?ga(o,g,t,b):o;}var fv=an(function(o,g){var b=o==null?0:o.length,k=la(o,g);return If(o,He(g,function(et){return ln(et,b)?+et:et;}).sort(Nf)),k;});function cv(o,g){var b=[];if(!(o&&o.length))return b;var k=-1,et=[],lt=o.length;for(g=le(g,3);++k<lt;){var vt=o[k];g(vt,k,o)&&(b.push(vt),et.push(k));}return If(o,et),b;}function Wa(o){return o==null?o:np.call(o);}function uv(o,g,b){var k=o==null?0:o.length;return k?(b&&typeof b!="number"&&hr(o,g,b)?(g=0,b=k):(g=g==null?0:ye(g),b=b===t?k:ye(b)),Fr(o,g,b)):[];}function hv(o,g){return Ms(o,g);}function dv(o,g,b){return Pa(o,g,le(b,2));}function pv(o,g){var b=o==null?0:o.length;if(b){var k=Ms(o,g);if(k<b&&jr(o[k],g))return k;}return-1;}function vv(o,g){return Ms(o,g,!0);}function gv(o,g,b){return Pa(o,g,le(b,2),!0);}function mv(o,g){var b=o==null?0:o.length;if(b){var k=Ms(o,g,!0)-1;if(jr(o[k],g))return k;}return-1;}function yv(o){return o&&o.length?wf(o):[];}function Pv(o,g){return o&&o.length?wf(o,le(g,2)):[];}function Sv(o){var g=o==null?0:o.length;return g?Fr(o,1,g):[];}function xv(o,g,b){return o&&o.length?(g=b||g===t?1:ye(g),Fr(o,0,g<0?0:g)):[];}function Tv(o,g,b){var k=o==null?0:o.length;return k?(g=b||g===t?1:ye(g),g=k-g,Fr(o,g<0?0:g,k)):[];}function Cv(o,g){return o&&o.length?Ls(o,le(g,3),!1,!0):[];}function Iv(o,g){return o&&o.length?Ls(o,le(g,3)):[];}var Ov=xe(function(o){return Tn(sr(o,1,Qe,!0));}),wv=xe(function(o){var g=Ur(o);return Qe(g)&&(g=t),Tn(sr(o,1,Qe,!0),le(g,2));}),Av=xe(function(o){var g=Ur(o);return g=typeof g=="function"?g:t,Tn(sr(o,1,Qe,!0),t,g);});function Ev(o){return o&&o.length?Tn(o):[];}function Mv(o,g){return o&&o.length?Tn(o,le(g,2)):[];}function Lv(o,g){return g=typeof g=="function"?g:t,o&&o.length?Tn(o,t,g):[];}function Fa(o){if(!(o&&o.length))return[];var g=0;return o=mn(o,function(b){if(Qe(b))return g=tr(b.length,g),!0;}),ta(g,function(b){return He(o,Qo(b));});}function hc(o,g){if(!(o&&o.length))return[];var b=Fa(o);return g==null?b:He(b,function(k){return Cr(g,t,k);});}var Rv=xe(function(o,g){return Qe(o)?Ni(o,g):[];}),bv=xe(function(o){return xa(mn(o,Qe));}),Dv=xe(function(o){var g=Ur(o);return Qe(g)&&(g=t),xa(mn(o,Qe),le(g,2));}),Nv=xe(function(o){var g=Ur(o);return g=typeof g=="function"?g:t,xa(mn(o,Qe),t,g);}),Bv=xe(Fa);function Wv(o,g){return Lf(o||[],g||[],Di);}function Fv(o,g){return Lf(o||[],g||[],Fi);}var Uv=xe(function(o){var g=o.length,b=g>1?o[g-1]:t;return b=typeof b=="function"?(o.pop(),b):t,hc(o,b);});function dc(o){var g=ot(o);return g.__chain__=!0,g;}function Yv(o,g){return g(o),o;}function Ys(o,g){return g(o);}var Xv=an(function(o){var g=o.length,b=g?o[0]:0,k=this.__wrapped__,et=function et(lt){return la(lt,o);};return g>1||this.__actions__.length||!(k instanceof Ce)||!ln(b)?this.thru(et):(k=k.slice(b,+b+(g?1:0)),k.__actions__.push({func:Ys,args:[et],thisArg:t}),new Br(k,this.__chain__).thru(function(lt){return g&&!lt.length&<.push(t),lt;}));});function zv(){return dc(this);}function $v(){return new Br(this.value(),this.__chain__);}function jv(){this.__values__===t&&(this.__values__=Ac(this.value()));var o=this.__index__>=this.__values__.length,g=o?t:this.__values__[this.__index__++];return{done:o,value:g};}function Gv(){return this;}function Hv(o){for(var g,b=this;b instanceof Is;){var k=oc(b);k.__index__=0,k.__values__=t,g?et.__wrapped__=k:g=k;var et=k;b=b.__wrapped__;}return et.__wrapped__=o,g;}function kv(){var o=this.__wrapped__;if(o instanceof Ce){var g=o;return this.__actions__.length&&(g=new Ce(this)),g=g.reverse(),g.__actions__.push({func:Ys,args:[Wa],thisArg:t}),new Br(g,this.__chain__);}return this.thru(Wa);}function Kv(){return Mf(this.__wrapped__,this.__actions__);}var Vv=Rs(function(o,g,b){Ne.call(o,b)?++o[b]:sn(o,b,1);});function Zv(o,g,b){var k=pe(o)?zl:Yp;return b&&hr(o,g,b)&&(g=t),k(o,le(g,3));}function Jv(o,g){var b=pe(o)?mn:hf;return b(o,le(g,3));}var Qv=Xf(ac),qv=Xf(lc);function _v(o,g){return sr(Xs(o,g),1);}function tg(o,g){return sr(Xs(o,g),tt);}function eg(o,g,b){return b=b===t?1:ye(b),sr(Xs(o,g),b);}function pc(o,g){var b=pe(o)?Dr:xn;return b(o,le(g,3));}function vc(o,g){var b=pe(o)?Sd:uf;return b(o,le(g,3));}var rg=Rs(function(o,g,b){Ne.call(o,b)?o[b].push(g):sn(o,b,[g]);});function ng(o,g,b,k){o=Pr(o)?o:li(o),b=b&&!k?ye(b):0;var et=o.length;return b<0&&(b=tr(et+b,0)),Hs(o)?b<=et&&o.indexOf(g,b)>-1:!!et&&Jn(o,g,b)>-1;}var ig=xe(function(o,g,b){var k=-1,et=typeof g=="function",lt=Pr(o)?Ft(o.length):[];return xn(o,function(vt){lt[++k]=et?Cr(g,vt,b):Bi(vt,g,b);}),lt;}),sg=Rs(function(o,g,b){sn(o,b,g);});function Xs(o,g){var b=pe(o)?He:yf;return b(o,le(g,3));}function og(o,g,b,k){return o==null?[]:(pe(g)||(g=g==null?[]:[g]),b=k?t:b,pe(b)||(b=b==null?[]:[b]),Tf(o,g,b));}var ag=Rs(function(o,g,b){o[b?0:1].push(g);},function(){return[[],[]];});function lg(o,g,b){var k=pe(o)?Zo:Hl,et=arguments.length<3;return k(o,le(g,4),b,et,xn);}function fg(o,g,b){var k=pe(o)?xd:Hl,et=arguments.length<3;return k(o,le(g,4),b,et,uf);}function cg(o,g){var b=pe(o)?mn:hf;return b(o,js(le(g,3)));}function ug(o){var g=pe(o)?af:n0;return g(o);}function hg(o,g,b){(b?hr(o,g,b):g===t)?g=1:g=ye(g);var k=pe(o)?Np:i0;return k(o,g);}function dg(o){var g=pe(o)?Bp:o0;return g(o);}function pg(o){if(o==null)return 0;if(Pr(o))return Hs(o)?qn(o):o.length;var g=lr(o);return g==Z||g==ct?o.size:pa(o).length;}function vg(o,g,b){var k=pe(o)?Jo:a0;return b&&hr(o,g,b)&&(g=t),k(o,le(g,3));}var gg=xe(function(o,g){if(o==null)return[];var b=g.length;return b>1&&hr(o,g[0],g[1])?g=[]:b>2&&hr(g[0],g[1],g[2])&&(g=[g[0]]),Tf(o,sr(g,1),[]);}),zs=Jd||function(){return ir.Date.now();};function mg(o,g){if(typeof g!="function")throw new Nr(c);return o=ye(o),function(){if(--o<1)return g.apply(this,arguments);};}function gc(o,g,b){return g=b?t:g,g=o&&g==null?o.length:g,on(o,R,t,t,t,t,g);}function mc(o,g){var b;if(typeof g!="function")throw new Nr(c);return o=ye(o),function(){return--o>0&&(b=g.apply(this,arguments)),o<=1&&(g=t),b;};}var Ua=xe(function(o,g,b){var k=x;if(b.length){var et=Pn(b,oi(Ua));k|=S;}return on(o,k,g,b,et);}),yc=xe(function(o,g,b){var k=x|I;if(b.length){var et=Pn(b,oi(yc));k|=S;}return on(g,k,o,b,et);});function Pc(o,g,b){g=b?t:g;var k=on(o,v,t,t,t,t,t,g);return k.placeholder=Pc.placeholder,k;}function Sc(o,g,b){g=b?t:g;var k=on(o,p,t,t,t,t,t,g);return k.placeholder=Sc.placeholder,k;}function xc(o,g,b){var k,et,lt,vt,It,bt,Gt=0,Ht=!1,Kt=!1,_t=!0;if(typeof o!="function")throw new Nr(c);g=Yr(g)||0,Ve(b)&&(Ht=!!b.leading,Kt="maxWait"in b,lt=Kt?tr(Yr(b.maxWait)||0,g):lt,_t="trailing"in b?!!b.trailing:_t);function re(qe){var Gr=k,un=et;return k=et=t,Gt=qe,vt=o.apply(un,Gr),vt;}function fe(qe){return Gt=qe,It=Xi(Te,g),Ht?re(qe):vt;}function Se(qe){var Gr=qe-bt,un=qe-Gt,Xc=g-Gr;return Kt?ar(Xc,lt-un):Xc;}function ce(qe){var Gr=qe-bt,un=qe-Gt;return bt===t||Gr>=g||Gr<0||Kt&&un>=lt;}function Te(){var qe=zs();if(ce(qe))return Oe(qe);It=Xi(Te,Se(qe));}function Oe(qe){return It=t,_t&&k?re(qe):(k=et=t,vt);}function Ar(){It!==t&&Rf(It),Gt=0,k=bt=et=It=t;}function dr(){return It===t?vt:Oe(zs());}function Er(){var qe=zs(),Gr=ce(qe);if(k=arguments,et=this,bt=qe,Gr){if(It===t)return fe(bt);if(Kt)return Rf(It),It=Xi(Te,g),re(bt);}return It===t&&(It=Xi(Te,g)),vt;}return Er.cancel=Ar,Er.flush=dr,Er;}var yg=xe(function(o,g){return cf(o,1,g);}),Pg=xe(function(o,g,b){return cf(o,Yr(g)||0,b);});function Sg(o){return on(o,U);}function $s(o,g){if(typeof o!="function"||g!=null&&typeof g!="function")throw new Nr(c);var _b=function b(){var k=arguments,et=g?g.apply(this,k):k[0],lt=_b.cache;if(lt.has(et))return lt.get(et);var vt=o.apply(this,k);return _b.cache=lt.set(et,vt)||lt,vt;};return _b.cache=new($s.Cache||nn)(),_b;}$s.Cache=nn;function js(o){if(typeof o!="function")throw new Nr(c);return function(){var g=arguments;switch(g.length){case 0:return!o.call(this);case 1:return!o.call(this,g[0]);case 2:return!o.call(this,g[0],g[1]);case 3:return!o.call(this,g[0],g[1],g[2]);}return!o.apply(this,g);};}function xg(o){return mc(2,o);}var Tg=l0(function(o,g){g=g.length==1&&pe(g[0])?He(g[0],Ir(le())):He(sr(g,1),Ir(le()));var b=g.length;return xe(function(k){for(var et=-1,lt=ar(k.length,b);++et<lt;)k[et]=g[et].call(this,k[et]);return Cr(o,this,k);});}),Ya=xe(function(o,g){var b=Pn(g,oi(Ya));return on(o,S,t,g,b);}),Tc=xe(function(o,g){var b=Pn(g,oi(Tc));return on(o,A,t,g,b);}),Cg=an(function(o,g){return on(o,D,t,t,t,g);});function Ig(o,g){if(typeof o!="function")throw new Nr(c);return g=g===t?g:ye(g),xe(o,g);}function Og(o,g){if(typeof o!="function")throw new Nr(c);return g=g==null?0:tr(ye(g),0),xe(function(b){var k=b[g],et=In(b,0,g);return k&&yn(et,k),Cr(o,this,et);});}function wg(o,g,b){var k=!0,et=!0;if(typeof o!="function")throw new Nr(c);return Ve(b)&&(k="leading"in b?!!b.leading:k,et="trailing"in b?!!b.trailing:et),xc(o,g,{leading:k,maxWait:g,trailing:et});}function Ag(o){return gc(o,1);}function Eg(o,g){return Ya(Ca(g),o);}function Mg(){if(!arguments.length)return[];var o=arguments[0];return pe(o)?o:[o];}function Lg(o){return Wr(o,T);}function Rg(o,g){return g=typeof g=="function"?g:t,Wr(o,T,g);}function bg(o){return Wr(o,u|T);}function Dg(o,g){return g=typeof g=="function"?g:t,Wr(o,u|T,g);}function Ng(o,g){return g==null||ff(o,g,rr(g));}function jr(o,g){return o===g||o!==o&&g!==g;}var Bg=Bs(ua),Wg=Bs(function(o,g){return o>=g;}),Xn=vf(/* @__PURE__ */function(){return arguments;}())?vf:function(o){return Ze(o)&&Ne.call(o,"callee")&&!tf.call(o,"callee");},pe=Ft.isArray,Fg=Bl?Ir(Bl):Hp;function Pr(o){return o!=null&&Gs(o.length)&&!fn(o);}function Qe(o){return Ze(o)&&Pr(o);}function Ug(o){return o===!0||o===!1||Ze(o)&&ur(o)==Rt;}var On=qd||Ja,Yg=Wl?Ir(Wl):kp;function Xg(o){return Ze(o)&&o.nodeType===1&&!zi(o);}function zg(o){if(o==null)return!0;if(Pr(o)&&(pe(o)||typeof o=="string"||typeof o.splice=="function"||On(o)||ai(o)||Xn(o)))return!o.length;var g=lr(o);if(g==Z||g==ct)return!o.size;if(Yi(o))return!pa(o).length;for(var b in o)if(Ne.call(o,b))return!1;return!0;}function $g(o,g){return Wi(o,g);}function jg(o,g,b){b=typeof b=="function"?b:t;var k=b?b(o,g):t;return k===t?Wi(o,g,t,b):!!k;}function Xa(o){if(!Ze(o))return!1;var g=ur(o);return g==q||g==z||typeof o.message=="string"&&typeof o.name=="string"&&!zi(o);}function Gg(o){return typeof o=="number"&&rf(o);}function fn(o){if(!Ve(o))return!1;var g=ur(o);return g==nt||g==j||g==Nt||g==rt;}function Cc(o){return typeof o=="number"&&o==ye(o);}function Gs(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=at;}function Ve(o){var g=_typeof(o);return o!=null&&(g=="object"||g=="function");}function Ze(o){return o!=null&&_typeof(o)=="object";}var Ic=Fl?Ir(Fl):Vp;function Hg(o,g){return o===g||da(o,g,La(g));}function kg(o,g,b){return b=typeof b=="function"?b:t,da(o,g,La(g),b);}function Kg(o){return Oc(o)&&o!=+o;}function Vg(o){if(R0(o))throw new de(s);return gf(o);}function Zg(o){return o===null;}function Jg(o){return o==null;}function Oc(o){return typeof o=="number"||Ze(o)&&ur(o)==O;}function zi(o){if(!Ze(o)||ur(o)!=$)return!1;var g=ms(o);if(g===null)return!0;var b=Ne.call(g,"constructor")&&g.constructor;return typeof b=="function"&&b instanceof b&&ds.call(b)==kd;}var za=Ul?Ir(Ul):Zp;function Qg(o){return Cc(o)&&o>=-at&&o<=at;}var wc=Yl?Ir(Yl):Jp;function Hs(o){return typeof o=="string"||!pe(o)&&Ze(o)&&ur(o)==St;}function wr(o){return _typeof(o)=="symbol"||Ze(o)&&ur(o)==Ct;}var ai=Xl?Ir(Xl):Qp;function qg(o){return o===t;}function _g(o){return Ze(o)&&lr(o)==Dt;}function tm(o){return Ze(o)&&ur(o)==At;}var em=Bs(va),rm=Bs(function(o,g){return o<=g;});function Ac(o){if(!o)return[];if(Pr(o))return Hs(o)?zr(o):yr(o);if(Ei&&o[Ei])return Nd(o[Ei]());var g=lr(o),b=g==Z?ra:g==ct?cs:li;return b(o);}function cn(o){if(!o)return o===0?o:0;if(o=Yr(o),o===tt||o===-tt){var g=o<0?-1:1;return g*ut;}return o===o?o:0;}function ye(o){var g=cn(o),b=g%1;return g===g?b?g-b:g:0;}function Ec(o){return o?Wn(ye(o),0,Q):0;}function Yr(o){if(typeof o=="number")return o;if(wr(o))return K;if(Ve(o)){var g=typeof o.valueOf=="function"?o.valueOf():o;o=Ve(g)?g+"":g;}if(typeof o!="string")return o===0?o:+o;o=kl(o);var b=ts.test(o);return b||Do.test(o)?md(o.slice(2),b?2:8):Rn.test(o)?K:+o;}function Mc(o){return Zr(o,Sr(o));}function nm(o){return o?Wn(ye(o),-at,at):o===0?o:0;}function Le(o){return o==null?"":Or(o);}var im=ii(function(o,g){if(Yi(g)||Pr(g)){Zr(g,rr(g),o);return;}for(var b in g)Ne.call(g,b)&&Di(o,b,g[b]);}),Lc=ii(function(o,g){Zr(g,Sr(g),o);}),ks=ii(function(o,g,b,k){Zr(g,Sr(g),o,k);}),sm=ii(function(o,g,b,k){Zr(g,rr(g),o,k);}),om=an(la);function am(o,g){var b=ni(o);return g==null?b:lf(b,g);}var lm=xe(function(o,g){o=Be(o);var b=-1,k=g.length,et=k>2?g[2]:t;for(et&&hr(g[0],g[1],et)&&(k=1);++b<k;)for(var lt=g[b],vt=Sr(lt),It=-1,bt=vt.length;++It<bt;){var Gt=vt[It],Ht=o[Gt];(Ht===t||jr(Ht,ti[Gt])&&!Ne.call(o,Gt))&&(o[Gt]=lt[Gt]);}return o;}),fm=xe(function(o){return o.push(t,Kf),Cr(Rc,t,o);});function cm(o,g){return $l(o,le(g,3),Vr);}function um(o,g){return $l(o,le(g,3),ca);}function hm(o,g){return o==null?o:fa(o,le(g,3),Sr);}function dm(o,g){return o==null?o:df(o,le(g,3),Sr);}function pm(o,g){return o&&Vr(o,le(g,3));}function vm(o,g){return o&&ca(o,le(g,3));}function gm(o){return o==null?[]:As(o,rr(o));}function mm(o){return o==null?[]:As(o,Sr(o));}function $a(o,g,b){var k=o==null?t:Fn(o,g);return k===t?b:k;}function ym(o,g){return o!=null&&Jf(o,g,zp);}function ja(o,g){return o!=null&&Jf(o,g,$p);}var Pm=$f(function(o,g,b){g!=null&&typeof g.toString!="function"&&(g=ps.call(g)),o[g]=b;},Ha(xr)),Sm=$f(function(o,g,b){g!=null&&typeof g.toString!="function"&&(g=ps.call(g)),Ne.call(o,g)?o[g].push(b):o[g]=[b];},le),xm=xe(Bi);function rr(o){return Pr(o)?of(o):pa(o);}function Sr(o){return Pr(o)?of(o,!0):qp(o);}function Tm(o,g){var b={};return g=le(g,3),Vr(o,function(k,et,lt){sn(b,g(k,et,lt),k);}),b;}function Cm(o,g){var b={};return g=le(g,3),Vr(o,function(k,et,lt){sn(b,et,g(k,et,lt));}),b;}var Im=ii(function(o,g,b){Es(o,g,b);}),Rc=ii(function(o,g,b,k){Es(o,g,b,k);}),Om=an(function(o,g){var b={};if(o==null)return b;var k=!1;g=He(g,function(lt){return lt=Cn(lt,o),k||(k=lt.length>1),lt;}),Zr(o,Ea(o),b),k&&(b=Wr(b,u|y|T,P0));for(var et=g.length;et--;)Sa(b,g[et]);return b;});function wm(o,g){return bc(o,js(le(g)));}var Am=an(function(o,g){return o==null?{}:t0(o,g);});function bc(o,g){if(o==null)return{};var b=He(Ea(o),function(k){return[k];});return g=le(g),Cf(o,b,function(k,et){return g(k,et[0]);});}function Em(o,g,b){g=Cn(g,o);var k=-1,et=g.length;for(et||(et=1,o=t);++k<et;){var lt=o==null?t:o[Jr(g[k])];lt===t&&(k=et,lt=b),o=fn(lt)?lt.call(o):lt;}return o;}function Mm(o,g,b){return o==null?o:Fi(o,g,b);}function Lm(o,g,b,k){return k=typeof k=="function"?k:t,o==null?o:Fi(o,g,b,k);}var Dc=Hf(rr),Nc=Hf(Sr);function Rm(o,g,b){var k=pe(o),et=k||On(o)||ai(o);if(g=le(g,4),b==null){var lt=o&&o.constructor;et?b=k?new lt():[]:Ve(o)?b=fn(lt)?ni(ms(o)):{}:b={};}return(et?Dr:Vr)(o,function(vt,It,bt){return g(b,vt,It,bt);}),b;}function bm(o,g){return o==null?!0:Sa(o,g);}function Dm(o,g,b){return o==null?o:Ef(o,g,Ca(b));}function Nm(o,g,b,k){return k=typeof k=="function"?k:t,o==null?o:Ef(o,g,Ca(b),k);}function li(o){return o==null?[]:ea(o,rr(o));}function Bm(o){return o==null?[]:ea(o,Sr(o));}function Wm(o,g,b){return b===t&&(b=g,g=t),b!==t&&(b=Yr(b),b=b===b?b:0),g!==t&&(g=Yr(g),g=g===g?g:0),Wn(Yr(o),g,b);}function Fm(o,g,b){return g=cn(g),b===t?(b=g,g=0):b=cn(b),o=Yr(o),jp(o,g,b);}function Um(o,g,b){if(b&&typeof b!="boolean"&&hr(o,g,b)&&(g=b=t),b===t&&(typeof g=="boolean"?(b=g,g=t):typeof o=="boolean"&&(b=o,o=t)),o===t&&g===t?(o=0,g=1):(o=cn(o),g===t?(g=o,o=0):g=cn(g)),o>g){var k=o;o=g,g=k;}if(b||o%1||g%1){var et=nf();return ar(o+et*(g-o+gd("1e-"+((et+"").length-1))),g);}return ma(o,g);}var Ym=si(function(o,g,b){return g=g.toLowerCase(),o+(b?Bc(g):g);});function Bc(o){return Ga(Le(o).toLowerCase());}function Wc(o){return o=Le(o),o&&o.replace(Bo,Md).replace(od,"");}function Xm(o,g,b){o=Le(o),g=Or(g);var k=o.length;b=b===t?k:Wn(ye(b),0,k);var et=b;return b-=g.length,b>=0&&o.slice(b,et)==g;}function zm(o){return o=Le(o),o&&Je.test(o)?o.replace(Ge,Ld):o;}function $m(o){return o=Le(o),o&&Co.test(o)?o.replace(Oi,"\\$&"):o;}var jm=si(function(o,g,b){return o+(b?"-":"")+g.toLowerCase();}),Gm=si(function(o,g,b){return o+(b?" ":"")+g.toLowerCase();}),Hm=Yf("toLowerCase");function km(o,g,b){o=Le(o),g=ye(g);var k=g?qn(o):0;if(!g||k>=g)return o;var et=(g-k)/2;return Ns(xs(et),b)+o+Ns(Ss(et),b);}function Km(o,g,b){o=Le(o),g=ye(g);var k=g?qn(o):0;return g&&k<g?o+Ns(g-k,b):o;}function Vm(o,g,b){o=Le(o),g=ye(g);var k=g?qn(o):0;return g&&k<g?Ns(g-k,b)+o:o;}function Zm(o,g,b){return b||g==null?g=0:g&&(g=+g),rp(Le(o).replace(wi,""),g||0);}function Jm(o,g,b){return(b?hr(o,g,b):g===t)?g=1:g=ye(g),ya(Le(o),g);}function Qm(){var o=arguments,g=Le(o[0]);return o.length<3?g:g.replace(o[1],o[2]);}var qm=si(function(o,g,b){return o+(b?"_":"")+g.toLowerCase();});function _m(o,g,b){return b&&typeof b!="number"&&hr(o,g,b)&&(g=b=t),b=b===t?Q:b>>>0,b?(o=Le(o),o&&(typeof g=="string"||g!=null&&!za(g))&&(g=Or(g),!g&&Qn(o))?In(zr(o),0,b):o.split(g,b)):[];}var ty=si(function(o,g,b){return o+(b?" ":"")+Ga(g);});function ey(o,g,b){return o=Le(o),b=b==null?0:Wn(ye(b),0,o.length),g=Or(g),o.slice(b,b+g.length)==g;}function ry(o,g,b){var k=ot.templateSettings;b&&hr(o,g,b)&&(g=t),o=Le(o),g=ks({},g,k,kf);var et=ks({},g.imports,k.imports,kf),lt=rr(et),vt=ea(et,lt),It,bt,Gt=0,Ht=g.interpolate||kn,Kt="__p += '",_t=na((g.escape||kn).source+"|"+Ht.source+"|"+(Ht===Kr?Ro:kn).source+"|"+(g.evaluate||kn).source+"|$","g"),re="//# sourceURL="+(Ne.call(g,"sourceURL")?(g.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ud+"]")+"\n";o.replace(_t,function(ce,Te,Oe,Ar,dr,Er){return Oe||(Oe=Ar),Kt+=o.slice(Gt,Er).replace(vn,Rd),Te&&(It=!0,Kt+="' +\n__e("+Te+") +\n'"),dr&&(bt=!0,Kt+="';\n"+dr+";\n__p += '"),Oe&&(Kt+="' +\n((__t = ("+Oe+")) == null ? '' : __t) +\n'"),Gt=Er+ce.length,ce;}),Kt+="';\n";var fe=Ne.call(g,"variable")&&g.variable;if(!fe)Kt="with (obj) {\n"+Kt+"\n}\n";else if(Mo.test(fe))throw new de(l);Kt=(bt?Kt.replace(je,""):Kt).replace(We,"$1").replace(Xe,"$1;"),Kt="function("+(fe||"obj")+") {\n"+(fe?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(It?", __e = _.escape":"")+(bt?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+Kt+"return __p\n}";var Se=Uc(function(){return Ee(lt,re+"return "+Kt).apply(t,vt);});if(Se.source=Kt,Xa(Se))throw Se;return Se;}function ny(o){return Le(o).toLowerCase();}function iy(o){return Le(o).toUpperCase();}function sy(o,g,b){if(o=Le(o),o&&(b||g===t))return kl(o);if(!o||!(g=Or(g)))return o;var k=zr(o),et=zr(g),lt=Kl(k,et),vt=Vl(k,et)+1;return In(k,lt,vt).join("");}function oy(o,g,b){if(o=Le(o),o&&(b||g===t))return o.slice(0,Jl(o)+1);if(!o||!(g=Or(g)))return o;var k=zr(o),et=Vl(k,zr(g))+1;return In(k,0,et).join("");}function ay(o,g,b){if(o=Le(o),o&&(b||g===t))return o.replace(wi,"");if(!o||!(g=Or(g)))return o;var k=zr(o),et=Kl(k,zr(g));return In(k,et).join("");}function ly(o,g){var b=M,k=W;if(Ve(g)){var et="separator"in g?g.separator:et;b="length"in g?ye(g.length):b,k="omission"in g?Or(g.omission):k;}o=Le(o);var lt=o.length;if(Qn(o)){var vt=zr(o);lt=vt.length;}if(b>=lt)return o;var It=b-qn(k);if(It<1)return k;var bt=vt?In(vt,0,It).join(""):o.slice(0,It);if(et===t)return bt+k;if(vt&&(It+=bt.length-It),za(et)){if(o.slice(It).search(et)){var Gt,Ht=bt;for(et.global||(et=na(et.source,Le(_i.exec(et))+"g")),et.lastIndex=0;Gt=et.exec(Ht);)var Kt=Gt.index;bt=bt.slice(0,Kt===t?It:Kt);}}else if(o.indexOf(Or(et),It)!=It){var _t=bt.lastIndexOf(et);_t>-1&&(bt=bt.slice(0,_t));}return bt+k;}function fy(o){return o=Le(o),o&&Ke.test(o)?o.replace(Fe,Ud):o;}var cy=si(function(o,g,b){return o+(b?" ":"")+g.toUpperCase();}),Ga=Yf("toUpperCase");function Fc(o,g,b){return o=Le(o),g=b?t:g,g===t?Dd(o)?zd(o):Id(o):o.match(g)||[];}var Uc=xe(function(o,g){try{return Cr(o,t,g);}catch(b){return Xa(b)?b:new de(b);}}),uy=an(function(o,g){return Dr(g,function(b){b=Jr(b),sn(o,b,Ua(o[b],o));}),o;});function hy(o){var g=o==null?0:o.length,b=le();return o=g?He(o,function(k){if(typeof k[1]!="function")throw new Nr(c);return[b(k[0]),k[1]];}):[],xe(function(k){for(var et=-1;++et<g;){var lt=o[et];if(Cr(lt[0],this,k))return Cr(lt[1],this,k);}});}function dy(o){return Up(Wr(o,u));}function Ha(o){return function(){return o;};}function py(o,g){return o==null||o!==o?g:o;}var vy=zf(),gy=zf(!0);function xr(o){return o;}function ka(o){return mf(typeof o=="function"?o:Wr(o,u));}function my(o){return Pf(Wr(o,u));}function yy(o,g){return Sf(o,Wr(g,u));}var Py=xe(function(o,g){return function(b){return Bi(b,o,g);};}),Sy=xe(function(o,g){return function(b){return Bi(o,b,g);};});function Ka(o,g,b){var k=rr(g),et=As(g,k);b==null&&!(Ve(g)&&(et.length||!k.length))&&(b=g,g=o,o=this,et=As(g,rr(g)));var lt=!(Ve(b)&&"chain"in b)||!!b.chain,vt=fn(o);return Dr(et,function(It){var bt=g[It];o[It]=bt,vt&&(o.prototype[It]=function(){var Gt=this.__chain__;if(lt||Gt){var Ht=o(this.__wrapped__),Kt=Ht.__actions__=yr(this.__actions__);return Kt.push({func:bt,args:arguments,thisArg:o}),Ht.__chain__=Gt,Ht;}return bt.apply(o,yn([this.value()],arguments));});}),o;}function xy(){return ir._===this&&(ir._=Kd),this;}function Va(){}function Ty(o){return o=ye(o),xe(function(g){return xf(g,o);});}var Cy=Oa(He),Iy=Oa(zl),Oy=Oa(Jo);function Yc(o){return ba(o)?Qo(Jr(o)):e0(o);}function wy(o){return function(g){return o==null?t:Fn(o,g);};}var Ay=jf(),Ey=jf(!0);function Za(){return[];}function Ja(){return!1;}function My(){return{};}function Ly(){return"";}function Ry(){return!0;}function by(o,g){if(o=ye(o),o<1||o>at)return[];var b=Q,k=ar(o,Q);g=le(g),o-=Q;for(var et=ta(k,g);++b<o;)g(b);return et;}function Dy(o){return pe(o)?He(o,Jr):wr(o)?[o]:yr(sc(Le(o)));}function Ny(o){var g=++Hd;return Le(o)+g;}var By=Ds(function(o,g){return o+g;},0),Wy=wa("ceil"),Fy=Ds(function(o,g){return o/g;},1),Uy=wa("floor");function Yy(o){return o&&o.length?ws(o,xr,ua):t;}function Xy(o,g){return o&&o.length?ws(o,le(g,2),ua):t;}function zy(o){return Gl(o,xr);}function $y(o,g){return Gl(o,le(g,2));}function jy(o){return o&&o.length?ws(o,xr,va):t;}function Gy(o,g){return o&&o.length?ws(o,le(g,2),va):t;}var Hy=Ds(function(o,g){return o*g;},1),ky=wa("round"),Ky=Ds(function(o,g){return o-g;},0);function Vy(o){return o&&o.length?_o(o,xr):0;}function Zy(o,g){return o&&o.length?_o(o,le(g,2)):0;}return ot.after=mg,ot.ary=gc,ot.assign=im,ot.assignIn=Lc,ot.assignInWith=ks,ot.assignWith=sm,ot.at=om,ot.before=mc,ot.bind=Ua,ot.bindAll=uy,ot.bindKey=yc,ot.castArray=Mg,ot.chain=dc,ot.chunk=U0,ot.compact=Y0,ot.concat=X0,ot.cond=hy,ot.conforms=dy,ot.constant=Ha,ot.countBy=Vv,ot.create=am,ot.curry=Pc,ot.curryRight=Sc,ot.debounce=xc,ot.defaults=lm,ot.defaultsDeep=fm,ot.defer=yg,ot.delay=Pg,ot.difference=z0,ot.differenceBy=$0,ot.differenceWith=j0,ot.drop=G0,ot.dropRight=H0,ot.dropRightWhile=k0,ot.dropWhile=K0,ot.fill=V0,ot.filter=Jv,ot.flatMap=_v,ot.flatMapDeep=tg,ot.flatMapDepth=eg,ot.flatten=fc,ot.flattenDeep=Z0,ot.flattenDepth=J0,ot.flip=Sg,ot.flow=vy,ot.flowRight=gy,ot.fromPairs=Q0,ot.functions=gm,ot.functionsIn=mm,ot.groupBy=rg,ot.initial=_0,ot.intersection=tv,ot.intersectionBy=ev,ot.intersectionWith=rv,ot.invert=Pm,ot.invertBy=Sm,ot.invokeMap=ig,ot.iteratee=ka,ot.keyBy=sg,ot.keys=rr,ot.keysIn=Sr,ot.map=Xs,ot.mapKeys=Tm,ot.mapValues=Cm,ot.matches=my,ot.matchesProperty=yy,ot.memoize=$s,ot.merge=Im,ot.mergeWith=Rc,ot.method=Py,ot.methodOf=Sy,ot.mixin=Ka,ot.negate=js,ot.nthArg=Ty,ot.omit=Om,ot.omitBy=wm,ot.once=xg,ot.orderBy=og,ot.over=Cy,ot.overArgs=Tg,ot.overEvery=Iy,ot.overSome=Oy,ot.partial=Ya,ot.partialRight=Tc,ot.partition=ag,ot.pick=Am,ot.pickBy=bc,ot.property=Yc,ot.propertyOf=wy,ot.pull=ov,ot.pullAll=uc,ot.pullAllBy=av,ot.pullAllWith=lv,ot.pullAt=fv,ot.range=Ay,ot.rangeRight=Ey,ot.rearg=Cg,ot.reject=cg,ot.remove=cv,ot.rest=Ig,ot.reverse=Wa,ot.sampleSize=hg,ot.set=Mm,ot.setWith=Lm,ot.shuffle=dg,ot.slice=uv,ot.sortBy=gg,ot.sortedUniq=yv,ot.sortedUniqBy=Pv,ot.split=_m,ot.spread=Og,ot.tail=Sv,ot.take=xv,ot.takeRight=Tv,ot.takeRightWhile=Cv,ot.takeWhile=Iv,ot.tap=Yv,ot.throttle=wg,ot.thru=Ys,ot.toArray=Ac,ot.toPairs=Dc,ot.toPairsIn=Nc,ot.toPath=Dy,ot.toPlainObject=Mc,ot.transform=Rm,ot.unary=Ag,ot.union=Ov,ot.unionBy=wv,ot.unionWith=Av,ot.uniq=Ev,ot.uniqBy=Mv,ot.uniqWith=Lv,ot.unset=bm,ot.unzip=Fa,ot.unzipWith=hc,ot.update=Dm,ot.updateWith=Nm,ot.values=li,ot.valuesIn=Bm,ot.without=Rv,ot.words=Fc,ot.wrap=Eg,ot.xor=bv,ot.xorBy=Dv,ot.xorWith=Nv,ot.zip=Bv,ot.zipObject=Wv,ot.zipObjectDeep=Fv,ot.zipWith=Uv,ot.entries=Dc,ot.entriesIn=Nc,ot.extend=Lc,ot.extendWith=ks,Ka(ot,ot),ot.add=By,ot.attempt=Uc,ot.camelCase=Ym,ot.capitalize=Bc,ot.ceil=Wy,ot.clamp=Wm,ot.clone=Lg,ot.cloneDeep=bg,ot.cloneDeepWith=Dg,ot.cloneWith=Rg,ot.conformsTo=Ng,ot.deburr=Wc,ot.defaultTo=py,ot.divide=Fy,ot.endsWith=Xm,ot.eq=jr,ot.escape=zm,ot.escapeRegExp=$m,ot.every=Zv,ot.find=Qv,ot.findIndex=ac,ot.findKey=cm,ot.findLast=qv,ot.findLastIndex=lc,ot.findLastKey=um,ot.floor=Uy,ot.forEach=pc,ot.forEachRight=vc,ot.forIn=hm,ot.forInRight=dm,ot.forOwn=pm,ot.forOwnRight=vm,ot.get=$a,ot.gt=Bg,ot.gte=Wg,ot.has=ym,ot.hasIn=ja,ot.head=cc,ot.identity=xr,ot.includes=ng,ot.indexOf=q0,ot.inRange=Fm,ot.invoke=xm,ot.isArguments=Xn,ot.isArray=pe,ot.isArrayBuffer=Fg,ot.isArrayLike=Pr,ot.isArrayLikeObject=Qe,ot.isBoolean=Ug,ot.isBuffer=On,ot.isDate=Yg,ot.isElement=Xg,ot.isEmpty=zg,ot.isEqual=$g,ot.isEqualWith=jg,ot.isError=Xa,ot.isFinite=Gg,ot.isFunction=fn,ot.isInteger=Cc,ot.isLength=Gs,ot.isMap=Ic,ot.isMatch=Hg,ot.isMatchWith=kg,ot.isNaN=Kg,ot.isNative=Vg,ot.isNil=Jg,ot.isNull=Zg,ot.isNumber=Oc,ot.isObject=Ve,ot.isObjectLike=Ze,ot.isPlainObject=zi,ot.isRegExp=za,ot.isSafeInteger=Qg,ot.isSet=wc,ot.isString=Hs,ot.isSymbol=wr,ot.isTypedArray=ai,ot.isUndefined=qg,ot.isWeakMap=_g,ot.isWeakSet=tm,ot.join=nv,ot.kebabCase=jm,ot.last=Ur,ot.lastIndexOf=iv,ot.lowerCase=Gm,ot.lowerFirst=Hm,ot.lt=em,ot.lte=rm,ot.max=Yy,ot.maxBy=Xy,ot.mean=zy,ot.meanBy=$y,ot.min=jy,ot.minBy=Gy,ot.stubArray=Za,ot.stubFalse=Ja,ot.stubObject=My,ot.stubString=Ly,ot.stubTrue=Ry,ot.multiply=Hy,ot.nth=sv,ot.noConflict=xy,ot.noop=Va,ot.now=zs,ot.pad=km,ot.padEnd=Km,ot.padStart=Vm,ot.parseInt=Zm,ot.random=Um,ot.reduce=lg,ot.reduceRight=fg,ot.repeat=Jm,ot.replace=Qm,ot.result=Em,ot.round=ky,ot.runInContext=Et,ot.sample=ug,ot.size=pg,ot.snakeCase=qm,ot.some=vg,ot.sortedIndex=hv,ot.sortedIndexBy=dv,ot.sortedIndexOf=pv,ot.sortedLastIndex=vv,ot.sortedLastIndexBy=gv,ot.sortedLastIndexOf=mv,ot.startCase=ty,ot.startsWith=ey,ot.subtract=Ky,ot.sum=Vy,ot.sumBy=Zy,ot.template=ry,ot.times=by,ot.toFinite=cn,ot.toInteger=ye,ot.toLength=Ec,ot.toLower=ny,ot.toNumber=Yr,ot.toSafeInteger=nm,ot.toString=Le,ot.toUpper=iy,ot.trim=sy,ot.trimEnd=oy,ot.trimStart=ay,ot.truncate=ly,ot.unescape=fy,ot.uniqueId=Ny,ot.upperCase=cy,ot.upperFirst=Ga,ot.each=pc,ot.eachRight=vc,ot.first=cc,Ka(ot,function(){var o={};return Vr(ot,function(g,b){Ne.call(ot.prototype,b)||(o[b]=g);}),o;}(),{chain:!1}),ot.VERSION=r,Dr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){ot[o].placeholder=ot;}),Dr(["drop","take"],function(o,g){Ce.prototype[o]=function(b){b=b===t?1:tr(ye(b),0);var k=this.__filtered__&&!g?new Ce(this):this.clone();return k.__filtered__?k.__takeCount__=ar(b,k.__takeCount__):k.__views__.push({size:ar(b,Q),type:o+(k.__dir__<0?"Right":"")}),k;},Ce.prototype[o+"Right"]=function(b){return this.reverse()[o](b).reverse();};}),Dr(["filter","map","takeWhile"],function(o,g){var b=g+1,k=b==N||b==J;Ce.prototype[o]=function(et){var lt=this.clone();return lt.__iteratees__.push({iteratee:le(et,3),type:b}),lt.__filtered__=lt.__filtered__||k,lt;};}),Dr(["head","last"],function(o,g){var b="take"+(g?"Right":"");Ce.prototype[o]=function(){return this[b](1).value()[0];};}),Dr(["initial","tail"],function(o,g){var b="drop"+(g?"":"Right");Ce.prototype[o]=function(){return this.__filtered__?new Ce(this):this[b](1);};}),Ce.prototype.compact=function(){return this.filter(xr);},Ce.prototype.find=function(o){return this.filter(o).head();},Ce.prototype.findLast=function(o){return this.reverse().find(o);},Ce.prototype.invokeMap=xe(function(o,g){return typeof o=="function"?new Ce(this):this.map(function(b){return Bi(b,o,g);});}),Ce.prototype.reject=function(o){return this.filter(js(le(o)));},Ce.prototype.slice=function(o,g){o=ye(o);var b=this;return b.__filtered__&&(o>0||g<0)?new Ce(b):(o<0?b=b.takeRight(-o):o&&(b=b.drop(o)),g!==t&&(g=ye(g),b=g<0?b.dropRight(-g):b.take(g-o)),b);},Ce.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse();},Ce.prototype.toArray=function(){return this.take(Q);},Vr(Ce.prototype,function(o,g){var b=/^(?:filter|find|map|reject)|While$/.test(g),k=/^(?:head|last)$/.test(g),et=ot[k?"take"+(g=="last"?"Right":""):g],lt=k||/^find/.test(g);et&&(ot.prototype[g]=function(){var vt=this.__wrapped__,It=k?[1]:arguments,bt=vt instanceof Ce,Gt=It[0],Ht=bt||pe(vt),Kt=function Kt(Te){var Oe=et.apply(ot,yn([Te],It));return k&&_t?Oe[0]:Oe;};Ht&&b&&typeof Gt=="function"&&Gt.length!=1&&(bt=Ht=!1);var _t=this.__chain__,re=!!this.__actions__.length,fe=lt&&!_t,Se=bt&&!re;if(!lt&&Ht){vt=Se?vt:new Ce(this);var ce=o.apply(vt,It);return ce.__actions__.push({func:Ys,args:[Kt],thisArg:t}),new Br(ce,_t);}return fe&&Se?o.apply(this,It):(ce=this.thru(Kt),fe?k?ce.value()[0]:ce.value():ce);});}),Dr(["pop","push","shift","sort","splice","unshift"],function(o){var g=us[o],b=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",k=/^(?:pop|shift)$/.test(o);ot.prototype[o]=function(){var et=arguments;if(k&&!this.__chain__){var lt=this.value();return g.apply(pe(lt)?lt:[],et);}return this[b](function(vt){return g.apply(pe(vt)?vt:[],et);});};}),Vr(Ce.prototype,function(o,g){var b=ot[g];if(b){var k=b.name+"";Ne.call(ri,k)||(ri[k]=[]),ri[k].push({name:g,func:b});}}),ri[bs(t,I).name]=[{name:"wrapper",func:t}],Ce.prototype.clone=fp,Ce.prototype.reverse=cp,Ce.prototype.value=up,ot.prototype.at=Xv,ot.prototype.chain=zv,ot.prototype.commit=$v,ot.prototype.next=jv,ot.prototype.plant=Hv,ot.prototype.reverse=kv,ot.prototype.toJSON=ot.prototype.valueOf=ot.prototype.value=Kv,ot.prototype.first=ot.prototype.head,Ei&&(ot.prototype[Ei]=Gv),ot;},_n=$d();bn?((bn.exports=_n)._=_n,ko._=_n):ir._=_n;}).call(hn);})(ao,ao.exports);ao.exports;var Qs=5,An=/*#__PURE__*/function(_$t13){function An(t){var _this84;_classCallCheck(this,An);_this84=_callSuper(this,An,[t]);dt(_this84,"canRotate",!1);dt(_this84,"scaleType",Ae.proportional);dt(_this84,"toolsType",Tt.Text);dt(_this84,"tmpPoints",[]);dt(_this84,"workOptions");dt(_this84,"oldRect");_this84.workOptions=t.toolsOpt;return _this84;}_inherits(An,_$t13);return _createClass(An,[{key:"consume",value:function consume(){return{type:xt.None};}},{key:"consumeAll",value:function consumeAll(){return{type:xt.None};}},{key:"consumeService",value:function consumeService(){}},{key:"draw",value:function(){var _draw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(t){var r,n,s,c,_this$workOptions16,l,f,h,m,u,y,T,E,C,x,_I49,_d42,v;return _regeneratorRuntime().wrap(function _callee24$(_context26){while(1)switch(_context26.prev=_context26.next){case 0:r=t.workId,n=t.layer,s=t.isDrawLabel,c=t.boxRect,_this$workOptions16=this.workOptions,l=_this$workOptions16.boxSize,f=_this$workOptions16.boxPoint,h=_this$workOptions16.zIndex,m=n.worldPosition,u=n.worldScaling;if(!(!f||!l)){_context26.next=3;break;}return _context26.abrupt("return");case 3:y={name:r,id:r,pos:[f[0]-Qs,f[1]-Qs],anchor:[0,0],size:l,zIndex:h},T=new mr(y),E={x:f[0]-Qs,y:f[1]-Qs,w:l[0],h:l[1]},C={x:Math.floor(E.x*u[0]+m[0]),y:Math.floor(E.y*u[1]+m[1]),w:Math.floor(E.w*u[0])+2,h:Math.floor(E.h*u[1])+2};this.replace(n,r,T);if(!(c&&(x=Zi(C,c)),(s||c&&x!==Tr.outside)&&n&&this.workOptions.text)){_context26.next=12;break;}_context26.next=8;return An.createLabels(this.workOptions,n,C);case 8:_I49=_context26.sent;_d42=_I49.labels;v=_I49.maxWidth;T.append.apply(T,_toConsumableArray(_d42)),C.w=Math.ceil(Math.max(v*n.worldScaling[0],C.w));case 12:return _context26.abrupt("return",C);case 13:case"end":return _context26.stop();}},_callee24,this);}));function draw(_x51){return _draw3.apply(this,arguments);}return draw;}()},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(t){var m,u,y,T,r,n,s,c,l,f,h;return _regeneratorRuntime().wrap(function _callee25$(_context27){while(1)switch(_context27.prev=_context27.next){case 0:r=(m=this.workId)==null?void 0:m.toString();if(r){_context27.next=3;break;}return _context27.abrupt("return");case 3:n=t.isFullWork,s=t.replaceId,c=t.isDrawLabel,l=t.boxRect;this.oldRect=s&&((y=(u=this.vNodes)==null?void 0:u.get(s))==null?void 0:y.rect)||void 0;f=n?this.fullLayer:this.drawLayer||this.fullLayer;_context27.next=8;return this.draw({workId:r,layer:f,isDrawLabel:_typeof(c)>"u"&&this.workOptions.workState===te.Done||c,boxRect:l});case 8:h=_context27.sent;return _context27.abrupt("return",((T=this.vNodes)==null||T.setInfo(r,{rect:h,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:h&&$t.getCenterPos(h,f)}),h));case 10:case"end":return _context27.stop();}},_callee25,this);}));function consumeServiceAsync(_x52){return _consumeServiceAsync2.apply(this,arguments);}return consumeServiceAsync;}()},{key:"updataOptService",value:function updataOptService(){}},{key:"updataOptServiceAsync",value:function(){var _updataOptServiceAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(t,r,n){var C,x,s,c,l,f,h,m,u,y,T,E;return _regeneratorRuntime().wrap(function _callee26$(_context28){while(1)switch(_context28.prev=_context28.next){case 0:if(this.workId){_context28.next=2;break;}return _context28.abrupt("return");case 2:s=this.workId.toString(),c=t.fontColor,l=t.fontBgColor,f=t.bold,h=t.italic,m=t.lineThrough,u=t.underline,y=t.zIndex,T=(C=this.vNodes)==null?void 0:C.get(s);if(T){_context28.next=5;break;}return _context28.abrupt("return");case 5:c&&(T.opt.fontColor=c),l&&(T.opt.fontBgColor=l),f&&(T.opt.bold=f),h&&(T.opt.italic=h),hi(m)&&(T.opt.lineThrough=m),hi(u)&&(T.opt.underline=u),er(y)&&(T.opt.zIndex=y),this.oldRect=T.rect;_context28.next=8;return this.draw({workId:s,layer:this.fullLayer,isDrawLabel:_typeof(r)>"u"&&this.workOptions.workState===te.Done||r,boxRect:n});case 8:E=_context28.sent;return _context28.abrupt("return",((x=this.vNodes)==null||x.setInfo(s,{rect:E,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:E&&$t.getCenterPos(E,this.fullLayer)}),E));case 10:case"end":return _context28.stop();}},_callee26,this);}));function updataOptServiceAsync(_x53,_x54,_x55){return _updataOptServiceAsync.apply(this,arguments);}return updataOptServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"getSafetySnippetRatio",value:function getSafetySnippetRatio(t){var r=(t==null?void 0:t.parent).displayRatio||1,n=Math.ceil(t.worldScaling[0]*10)/10;var s=n;return n<=2?s=n*r*2:n>2&&n<=3?s=n*r*1.6:n>3&&n<=4?s=n*r*1.2:n>4&&(s=n*r),Math.floor(s*1e3)/1e3;}},{key:"getSafetySnippetFontLength",value:function getSafetySnippetFontLength(t){return Math.floor(An.textImageSnippetSize*3/4/t)||1;}},{key:"createLabels",value:function(){var _createLabels=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(t,r,n){var W,s,c,l,_ref168,f,h,m,u,y,T,E,C,x,I,d,v,p,S,A,R,D,U,M,Y,B,N,G,J,tt,at,ut,K,Q,ft,mt,wt,ht,Nt,Rt,X,z,q,nt,gt,_ht2,_Nt,_Rt,_ht3,_Nt2,_mt3,_wt2;return _regeneratorRuntime().wrap(function _callee27$(_context29){while(1)switch(_context29.prev=_context29.next){case 0:s=[],c=n.x,l=n.y,_ref168=(W=r.parent)==null?void 0:W.parent,f=_ref168.width,h=_ref168.height,m=yi(t.text),u=m.length,y=t.fontSize,T=t.lineHeight,E=t.bold,C=t.textAlign,x=t.italic,I=t.fontFamily,d=t.verticalAlign,v=t.fontColor,p=t.fontBgColor,S=t.underline,A=t.lineThrough,R=An.getSafetySnippetRatio(r)||1,D=Math.floor(y*R),U=An.getSafetySnippetFontLength(D);M=0;Y=0;case 3:if(!(Y<u)){_context29.next=33;break;}B=m[Y],N=T||D*1.5;if(!B){_context29.next=30;break;}G=sE(B),J=[0,0],tt=[0,y*1.2];d==="middle"&&(J[1]=Math.floor(Y*y*1.2+6+y*(1.1-1)));at=[0,Math.floor(-y*0.15)];J[0]=6;ut=Math.sin(Math.PI/180*20);K=0;Q=[];ft=0;case 14:if(!(ft<G)){_context29.next=27;break;}C==="left"&&(at[0]=K),ft===0&&x==="italic"&&(at[0]=at[0]-ut/2*y);mt=B.slice(ft,ft+U);wt={anchor:[0,0],pos:at,text:mt,fontFamily:I,fontSize:D,lineHeight:N,strokeColor:v,fontWeight:E,fillColor:v,textAlign:C,fontStyle:x,scale:[1/R,1/R]};ht=new _y(wt);_context29.next=21;return ht.textImageReady;case 21:Nt=_context29.sent;Rt=!0;if(Nt){X=Nt.rect&&Nt.rect[2],z=Nt.rect&&Nt.rect[3];if(X&&z){q=X/R,nt=z/R;K=q+K,x==="italic"&&(E==="bold"?K=K-ut*y*1.2:K=K-ut*y),((at[0]+J[0]+q)*r.worldScaling[0]+c<=0||(at[0]+J[0])*r.worldScaling[0]+c>=f||(at[1]+J[1]+nt)*r.worldScaling[1]+l<=0||(at[1]+J[1])*r.worldScaling[1]+l>=h)&&(ht.disconnect(),Rt=!1),Rt&&Q.push(ht);}}ft+=U;case 25:_context29.next=14;break;case 27:tt[0]=K,x==="italic"&&(tt[0]=tt[0]+ut*y),M=Math.max(M,tt[0]);gt=!0;if(((J[0]+tt[0])*r.worldScaling[0]+c<=0||J[0]*r.worldScaling[0]+c>=f||(J[1]+tt[1])*r.worldScaling[0]+l<=0||J[1]*r.worldScaling[1]+l>=h)&&(gt=!1),gt){if(S){_ht2=Math.floor(y/10),_Nt={normalize:!1,pos:[0,y*1.1+_ht2/2],lineWidth:_ht2,points:[0,0,Math.ceil(tt[0]),0],strokeColor:v,className:"underline"},_Rt=new dn(_Nt);Q.push(_Rt);}if(A){_ht3={normalize:!1,pos:[0,y*1.2/2],lineWidth:Math.floor(y/10),points:[0,0,Math.ceil(tt[0]),0],strokeColor:v,className:"lineThrough"},_Nt2=new dn(_ht3);Q.push(_Nt2);}_mt3={pos:J,anchor:[0,0],size:tt,bgcolor:p},_wt2=new mr(_mt3);_wt2.append.apply(_wt2,Q),s.push(_wt2);}case 30:Y++;_context29.next=3;break;case 33:return _context29.abrupt("return",{labels:s,maxWidth:M});case 34:case"end":return _context29.stop();}},_callee27);}));function createLabels(_x56,_x57,_x58){return _createLabels.apply(this,arguments);}return createLabels;}()},{key:"updateNodeOpt",value:function updateNodeOpt(t){var r=t.node,n=t.opt,s=t.vNodes,c=t.targetNode,l=n.fontBgColor,f=n.fontColor,h=n.translate,m=n.originPoint,u=n.scenePoint,y=n.scale,T=n.bold,E=n.italic,C=n.lineThrough,x=n.underline,I=n.fontSize,d=n.textInfos,v=n.zIndex,p=c&&fr(c)||s.get(r.name);if(!p||!r.parent)return;var A=p.opt;if(er(v)&&(r.setAttribute("zIndex",v),p.opt.zIndex=v),f&&A.fontColor&&(A.fontColor=f,r.children.forEach(function(R){R.tagName==="GROUP"&&R.children.forEach(function(D){D.tagName==="LABEL"?(D.setAttribute("fillColor",f),D.setAttribute("strokeColor",f)):D.tagName==="POLYLINE"&&D.setAttribute("strokeColor",f);});})),l&&A.fontBgColor&&(A.fontBgColor=l,r.children.forEach(function(R){R.tagName==="GROUP"&&R.setAttribute("bgcolor",l);})),T&&(A.bold=T),E&&(A.italic=E),hi(C)&&(A.lineThrough=C),hi(x)&&(A.underline=x),I&&(A.fontSize=I),m&&u&&y&&c&&A.boxPoint){var R=d==null?void 0:d.get(r.name);if(R){var W=R.fontSize,Y=R.boxSize;A.boxSize=Y||A.boxSize,A.fontSize=W||A.fontSize;}var D=[A.boxPoint[0],A.boxPoint[1]];Ll(A.boxPoint,u,y,h);var U=[p.op[0],p.op[1]],M=[U[0]-D[0],U[1]-D[1]];if(p.centerPos=[p.centerPos[0]+M[0],p.centerPos[1]+M[1]],p.opt.eraserlines){var _iterator33=_createForOfIteratorHelper(p.opt.eraserlines),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _W19=_step33.value;var _Y9=_W19.op,B=_W19.thickness;_W19.thickness=Math.round(B*Math.max(y[0],y[1]));for(var N=0;N<_Y9.length;N++)Rl(_Y9[N],u,y,h);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}}}else if(h&&A.boxPoint&&(A.boxPoint=[Math.round(A.boxPoint[0]+h[0]),Math.round(A.boxPoint[1]+h[1])],p.centerPos=[p.centerPos[0]+h[0],p.centerPos[1]+h[1]],p.opt.eraserlines)){var _iterator34=_createForOfIteratorHelper(p.opt.eraserlines),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _R5=_step34.value;var _D5=_R5.op;for(var _U24=0;_U24<_D5.length;_U24++){var _M21=_D5[_U24].map(function(W,Y){return Y%2?W+h[1]:W+h[0];});_R5.op[_U24]=_M21;}}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}}return p&&s.setInfo(r.name,p),p==null?void 0:p.rect;}},{key:"getRectFromLayer",value:function getRectFromLayer(t,r){var n=t.getElementsByName(r)[0];if(n){var s=n.getBoundingClientRect();var c={x:Math.floor(s.x),y:Math.floor(s.y),w:Math.floor(s.width+2),h:Math.floor(s.height+2)};return n.children.forEach(function(l){if(l.tagName==="GROUP"){var f=n.getBoundingClientRect();c=Zt(c,{x:Math.floor(f.x),y:Math.floor(f.y),w:Math.floor(f.width+2),h:Math.floor(f.height+2)});}}),c;}}}]);}($t);// 4k
|
|
480
|
-
dt(An,"textImageSnippetSize",1024*4),dt(An,"SafeBorderPadding",30);var Ki=An;var
|
|
481
|
-
dt(
|
|
482
|
-
dt(gi,"eraserSizes",Tl);var fo=gi;function Gh(i){switch(i){case Tt.Arrow:return Ch;case Tt.Pencil:return Ph;case Tt.Straight:return Mh;case Tt.Ellipse:return Ih;case Tt.Polygon:case Tt.Triangle:return Ah;case Tt.Star:case Tt.Rhombus:return wh;case Tt.Rectangle:return Oh;case Tt.SpeechBalloon:return Eh;case Tt.Text:return Ki;case Tt.LaserPen:return Sh;case Tt.Eraser:return io;case Tt.PencilEraser:return lo;case Tt.BitMapEraser:return fo;case Tt.Selector:return Gi;case Tt.Image:return Hi;}}function To(i,e){var t=i.toolsType,r=_objectWithoutProperties(i,_excluded);switch(t){case Tt.Arrow:return new Ch(r);case Tt.Pencil:return new Ph(r);case Tt.Straight:return new Mh(r);case Tt.Ellipse:return new Ih(r);case Tt.Polygon:case Tt.Triangle:return new Ah(r);case Tt.Star:case Tt.Rhombus:return new wh(r);case Tt.Rectangle:return new Oh(r);case Tt.SpeechBalloon:return new Eh(r);case Tt.Text:return new Ki(r);case Tt.LaserPen:return new Sh(r);case Tt.Eraser:return new io(r,e);case Tt.BitMapEraser:return new fo(r);case Tt.PencilEraser:return new lo(r);case Tt.Selector:return r.vNodes?new Gi(_objectSpread(_objectSpread({},r),{},{vNodes:r.vNodes,drawLayer:r.fullLayer})):void 0;case Tt.Image:return new Hi(r);default:return;}}function Hh(i){var e=[],t=["PATH","SPRITE","POLYLINE","RECT","ELLIPSE","LABEL"];var _iterator41=_createForOfIteratorHelper(i),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var r=_step41.value;if(r.tagName==="GROUP"&&r.children.length){var n=Hh(r.children);e.push.apply(e,_toConsumableArray(n));}r.tagName&&t.includes(r.tagName)&&e.push(r);}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return e;}function Zt(i,e){if(i&&e){var t=Math.min(i.x,e.x),r=Math.min(i.y,e.y),n=Math.max(i.x+i.w,e.x+e.w),s=Math.max(i.y+i.h,e.y+e.h),c=n-t,l=s-r;return{x:t,y:r,w:c,h:l};}return e||i;}function Re(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var t={x:0,y:0,w:0,h:0};var r=1/0,n=1/0,s=-1/0,c=-1/0;return i.forEach(function(l){var _l$XY=_slicedToArray(l.XY,2),f=_l$XY[0],h=_l$XY[1];r=Math.min(r,f-e),n=Math.min(n,h-e),s=Math.max(s,f+e),c=Math.max(c,h+e);}),t.x=r,t.y=n,t.w=s-r,t.h=c-n,t;}function fl(i,e){return!(i.x+i.w<e.x||i.x>e.x+e.w||i.y+i.h<e.y||i.y>e.y+e.h);}function ve(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:10;return{x:Math.floor(i.x-e),y:Math.floor(i.y-e),w:Math.ceil(i.w+e*2),h:Math.ceil(i.h+e*2)};}function Vi(i,e){return{x:i.x+e[0],y:i.y+e[1],w:i.w,h:i.h};}function ZA(i,e){var t=new pt(i.x,i.y),r=new pt(i.x+i.w,i.y),n=new pt(i.x+i.w,i.y+i.h),s=new pt(i.x,i.y+i.h),c=new pt(i.x+i.w/2,i.y+i.h/2),l=Math.PI*e/180,f=pt.RotWith(t,c,l),h=pt.RotWith(r,c,l),m=pt.RotWith(n,c,l),u=pt.RotWith(s,c,l);return[f,h,m,u];}function kh(i,e){var t=ZA(i,e);return Re(t);}function Kh(i,e,t){var r=new pt(i.x,i.y),n=new pt(i.x+i.w,i.y),s=new pt(i.x+i.w,i.y+i.h),c=new pt(i.x,i.y+i.h),l=new pt(t[0],t[1]),f=new pt(e[0],e[1]),h=pt.ScaleWOrigin(r,f,l),m=pt.ScaleWOrigin(n,f,l),u=pt.ScaleWOrigin(s,f,l),y=pt.ScaleWOrigin(c,f,l);return Re([h,m,u,y]);}function JA(i,e,t){var r=new pt(e[0],e[1]);for(var n=0;n<i.length;n+=3){var s=new pt(i[n],i[n+1]),c=Math.PI*t/180,l=pt.RotWith(s,r,c);i[n]=l.x,i[n+1]=l.y;}}function QA(i,e,t){var r=new pt(e[0],e[1]);for(var n=0;n<i.length;n+=2){var s=new pt(i[n],i[n+1]),c=Math.PI*t/180,l=pt.RotWith(s,r,c);i[n]=l.x,i[n+1]=l.y;}}function Ll(i,e,t){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var n=new pt(e[0],e[1]);for(var s=0;s<i.length;s+=3){var c=new pt(i[s],i[s+1]),l=new pt(t[0],t[1]),f=pt.ScaleWOrigin(c,l,n);i[s]=f.x+r[0],i[s+1]=f.y+r[1];}}function Rl(i,e,t){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var n=new pt(e[0],e[1]);for(var s=0;s<i.length;s+=2){var c=new pt(i[s],i[s+1]),l=new pt(t[0],t[1]),f=pt.ScaleWOrigin(c,l,n);i[s]=f.x+r[0],i[s+1]=f.y+r[1];}}function qA(i,e){return i[0]>=e.x&&i[0]<=e.x+e.w&&i[1]>=e.y&&i[1]<=e.y+e.h;}function Vh(i,e){var t=i<=e?1:i/e,r=e<=i?1:e/i;return[t,r];}function _A(i){var _iterator42=_createForOfIteratorHelper(i),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _e3=_step42.value;if(isNaN(_e3)||_e3===1/0||_e3===-1/0)return!1;}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return!0;}function tE(i){return i!==Math.floor(i);}function eE(i){var e=i.toString();return e.indexOf(".")!==-1?e.split(".")[1].length:0;}function rE(i,e){for(;e!==0;){var _ref169=[e,i%e];i=_ref169[0];e=_ref169[1];}return i;}var nE=function nE(i){if(i.tagName==="GROUP"){var _e4=Object.getOwnPropertySymbols(i).find(function(t){return t.toString()==="Symbol(sealed)";});if(_e4&&i[_e4])return!0;}return!1;},_pr=function pr(i,e){if(i.mesh&&i.mesh.texture&&i.name==="eraserTexture"){var t=i.mesh.texture.image;e.deleteTexture(t);}else if(i.tagName==="GROUP"&&i&&i.children){var _iterator43=_createForOfIteratorHelper(i.children),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _t3=_step43.value;_pr(_t3,e);}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}}},Lr=function Lr(i,e){_pr(i,e),i.removeAllChildren();},iE=function iE(i,e,t){var r=t.parent;if(e){var n=e.children;if(n){var _iterator44=_createForOfIteratorHelper(n),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var s=_step44.value;if(_pr(s,r),s.tagName==="GROUP"){var _iterator45=_createForOfIteratorHelper(s.children),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var c=_step45.value;_pr(c,r);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}}}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}}e.parent.replaceChild(i,e);},Zh=function Zh(i,e,t){if(i.w+i.x<=0||i.h+i.y<=0||i.w<=0||i.h<=0)return;var r=e.width,n=e.height,s={x:Math.floor(Math.max(0,i.x)),y:Math.floor(Math.max(0,i.y)),w:Math.floor(Math.min(r,i.w)),h:Math.floor(Math.min(n,i.h))};if(s.x+s.w>r&&(s.w=Math.floor(r-s.x)),s.y+s.h>n&&(s.h=Math.floor(n-s.y)),tE(t)){var c=eE(t),l=Math.pow(10,c),f=rE(l,t*l),h=s.x%f,m=s.x-h;m>=0?(s.x=m,s.w=s.w+h):(s.x=0,s.w=s.w+h-m);var u=s.y%f,y=s.y-u;y>=0?(s.y=y,s.h=s.h+u):(s.y=0,s.h=s.h+u-y);}return s;};function fi(i){return"".concat(co(i.x),",").concat(co(i.y)," ");}function ci(i,e){return"".concat(co((i.x+e.x)/2),",").concat(co((i.y+e.y)/2)," ");}function co(i){return+i.toFixed(4);}var Zi=function Zi(i,e){return i.x+i.w<e.x||i.x>e.x+e.w||i.y+i.h<e.y||i.y>e.y+e.h?Tr.outside:i.x>=e.x&&i.y>=e.y&&i.x+i.w<=e.x+e.w&&i.y+i.h<=e.y+e.h?Tr.inside:Tr.intersect;};function sE(i){var e=0;for(var t=0;t<i.length;t++){var r=i.charCodeAt(t);r>=1&&r<=126||65376<=r&&r<=65439?e++:e+=2;}return e;}var oE=/*#__PURE__*/function(){function oE(e,t){_classCallCheck(this,oE);dt(this,"viewId");dt(this,"scene");dt(this,"fullLayer");dt(this,"curNodeMap",/* @__PURE__ */new Map());dt(this,"targetNodeMap",[]);dt(this,"highLevelIds");dt(this,"canClearUids");dt(this,"localUid");this.viewId=e,this.scene=t;}return _createClass(oE,[{key:"init",value:function init(e){this.fullLayer=e;}},{key:"get",value:function get(e){return this.curNodeMap.get(e);}},{key:"setLocalUid",value:function setLocalUid(e){this.localUid=e;}},{key:"getLocalUid",value:function getLocalUid(){return this.localUid;}},{key:"setCanClearUids",value:function setCanClearUids(e){this.canClearUids=e;}},{key:"getCanClearUids",value:function getCanClearUids(){return this.canClearUids;}},{key:"getCanEraserNodes",value:function getCanEraserNodes(e,t){var r=/* @__PURE__ */new Map();var _iterator46=_createForOfIteratorHelper(e.entries()),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _step46$value=_slicedToArray(_step46.value,2),n=_step46$value[0],s=_step46$value[1];s.toolsType===Tt.Image&&(s.opt.locked||t&&t.disableEraseImage)||s.toolsType===Tt.Text&&(s.opt.workState===te.Doing||s.opt.workState===te.Start||t&&t.disableEraseText)||this.isCanClearWorkId(n)&&r.set(n,s);}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}return r;}},{key:"getNodesByType",value:function getNodesByType(e){var t=/* @__PURE__ */new Map();return this.curNodeMap.forEach(function(r,n){r.toolsType===e&&t.set(n,r);}),t;}},{key:"gethasEraserNodes",value:function gethasEraserNodes(){var e=/* @__PURE__ */new Map();return this.curNodeMap.forEach(function(t,r){var n;(n=t.opt.eraserlines)!=null&&n.length&&e.set(r,t);}),e;}},{key:"hasRenderNodes",value:function hasRenderNodes(){return!0;}},{key:"has",value:function has(e){return this.curNodeMap.has(e);}},{key:"setInfo",value:function setInfo(e,t){var r=this.curNodeMap.get(e)||{name:e,rect:t.rect};t.rect&&(r.rect=fr(t.rect)),t.op&&_A(t.op)&&(r.op=fr(t.op)),t.canRotate&&(r.canRotate=t.canRotate),t.scaleType&&(r.scaleType=t.scaleType),t.opt&&(r.opt=fr(t.opt)),t.toolsType&&(r.toolsType=t.toolsType),t.centerPos&&(r.centerPos=fr(t.centerPos)),hi(t.isSelected)&&(r.isSelected=t.isSelected),r.rect?this.curNodeMap.set(e,r):this.curNodeMap["delete"](e);}},{key:"selected",value:function selected(e){this.setInfo(e,{isSelected:!0});}},{key:"unSelected",value:function unSelected(e){this.setInfo(e,{isSelected:!1});}},{key:"delete",value:function _delete(e){this.curNodeMap["delete"](e);}},{key:"clear",value:function clear(){this.curNodeMap.clear(),this.targetNodeMap.length=0;}},{key:"getRectIntersectRange",value:function getRectIntersectRange(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var n;var s=/* @__PURE__ */new Map();var _iterator47=_createForOfIteratorHelper(this.curNodeMap.entries()),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _step47$value=_slicedToArray(_step47.value,2),c=_step47$value[0],l=_step47$value[1];if(fl(e,l.rect)){if(t&&l.toolsType===Tt.Image&&l.opt.locked||r&&l.toolsType===Tt.Text&&(l.opt.workState===te.Doing||l.opt.workState===te.Start))continue;n=Zt(n,l.rect),s.set(c,l);}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}return{rectRange:n,nodeRange:s};}},{key:"getNodeRectFormShape",value:function getNodeRectFormShape(e,t){var r=Gh(t.toolsType);return this.fullLayer&&(r==null?void 0:r.getRectFromLayer(this.fullLayer,e));}},{key:"updateNodeRect",value:function updateNodeRect(e){var t=this.curNodeMap.get(e);if(t){var r=this.getNodeRectFormShape(e,t);if(!r){this.curNodeMap["delete"](e);return;}t.rect=r,this.curNodeMap.set(e,t);}}},{key:"updateHighLevelNodesRect",value:function updateHighLevelNodesRect(e){this.highLevelIds=e;var _iterator48=_createForOfIteratorHelper(this.highLevelIds.keys()),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var t=_step48.value;this.updateNodeRect(t);}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}},{key:"updateLowLevelNodesRect",value:function updateLowLevelNodesRect(){var e;var _iterator49=_createForOfIteratorHelper(this.curNodeMap.keys()),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var t=_step49.value;(e=this.highLevelIds)!=null&&e.has(t)||this.updateNodeRect(t);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}}},{key:"clearHighLevelIds",value:function clearHighLevelIds(){this.highLevelIds=void 0;}},{key:"setTargetAssignKeys",value:function setTargetAssignKeys(e){var t=/* @__PURE__ */new Map();var _iterator50=_createForOfIteratorHelper(e),_step50;try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){var r=_step50.value;var n=this.curNodeMap.get(r);n&&t.set(r,fr(n));}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}return this.targetNodeMap.push(fr(t)),this.targetNodeMap.length-1;}},{key:"setTarget",value:function setTarget(){return this.targetNodeMap.push(fr(this.curNodeMap)),this.targetNodeMap.length-1;}},{key:"getLastTarget",value:function getLastTarget(){return this.targetNodeMap[this.targetNodeMap.length-1];}},{key:"deleteLastTarget",value:function deleteLastTarget(){this.targetNodeMap.length&&(this.targetNodeMap.length=this.targetNodeMap.length-1);}},{key:"getTarget",value:function getTarget(e){return this.targetNodeMap[e];}},{key:"deleteTarget",value:function deleteTarget(e){this.targetNodeMap.length=e;}},{key:"clearTarget",value:function clearTarget(){this.targetNodeMap.length=0;}},{key:"isLocalWorkId",value:function isLocalWorkId(e){return e.split(mi).length===1;}},{key:"isCanClearWorkId",value:function isCanClearWorkId(e){if(this.canClearUids===void 0||this.canClearUids===!0)return!0;if(YO(this.canClearUids)){var t=e.split(mi);if(t.length===1)return this.canClearUids.has("localSelf")||this.localUid&&this.canClearUids.has(this.localUid);if(t.length===2)return this.canClearUids.has(t[0]);}return!1;}}]);}();var Jh=/*#__PURE__*/function(){function Jh(e,t,r){_classCallCheck(this,Jh);dt(this,"viewId");dt(this,"type");dt(this,"scene");dt(this,"fullLayer");dt(this,"vNodes");dt(this,"dpr");dt(this,"contextType");dt(this,"opt");dt(this,"cameraOpt");dt(this,"isSafari",!1);dt(this,"combinePostMsg",/* @__PURE__ */new Set());dt(this,"workerTaskId");dt(this,"protectedTask");// protected hasPriorityDraw: boolean = true;
|
|
483
|
-
dt(this,"delayPostDoneResolve");dt(this,"cacheImages",/* @__PURE__ */new Map());dt(this,"imageResolveMap",/* @__PURE__ */new Map());dt(this,"taskUpdateCameraId");dt(this,"debounceUpdateCameraId");var n,s;if(this.viewId=e,this.type=r,this.opt=t,this.dpr=t.dpr,this.contextType=this.getSupportContextType(r,(n=t==null?void 0:t.offscreenCanvasOpt)==null?void 0:n.contextType),!this.contextType)throw new Error("Sorry, your browser doesn't support canvas context type 2d or webgl");try{this.scene=this.createScene(t),this.createRenderLayer(this.scene,t);}catch(c){if(this.contextType!=="2d")this.contextType="2d",(s=this.scene)==null||s.disconnect(),this.scene=this.createScene(t),this.createRenderLayer(this.scene,t);else throw c;}this.vNodes=new oE(e,this.scene);}return _createClass(Jh,[{key:"createRenderLayer",value:function createRenderLayer(e,t){var r=vr.bufferSize.full,n=vr.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",e,_objectSpread(_objectSpread({},t.layerOpt),{},{bufferSize:this.viewId===ki?r:n*2}));}},{key:"updateDpr",value:function(){var _updateDpr=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e){return _regeneratorRuntime().wrap(function _callee28$(_context30){while(1)switch(_context30.prev=_context30.next){case 0:this.dpr=e,this.scene.displayRatio=e;case 1:case"end":return _context30.stop();}},_callee28,this);}));function updateDpr(_x59){return _updateDpr.apply(this,arguments);}return updateDpr;}()},{key:"getCachedImages",value:function getCachedImages(e){var t;return(t=this.cacheImages.get(e))==null?void 0:t.imageBitmap;}},{key:"getCachedImagesByWorkId",value:function getCachedImagesByWorkId(e){var _iterator51=_createForOfIteratorHelper(this.cacheImages.entries()),_step51;try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){var _step51$value=_slicedToArray(_step51.value,2),t=_step51$value[0],r=_step51$value[1];if(t===e&&r.imageBitmap)return r.imageBitmap;}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}}},{key:"deleteCachedImagesByWorkId",value:function deleteCachedImagesByWorkId(e,t){var _iterator52=_createForOfIteratorHelper(this.cacheImages.entries()),_step52;try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){var _step52$value=_slicedToArray(_step52.value,2),r=_step52$value[0],n=_step52$value[1];t&&r===t||n.workId===e&&(n.imageBitmap.close(),this.cacheImages["delete"](r));}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}}},{key:"clearCacheImages",value:function clearCacheImages(){this.cacheImages.forEach(function(e){return e.imageBitmap.close();}),this.cacheImages.clear();}},{key:"clearImageResolveMap",value:function clearImageResolveMap(){this.imageResolveMap.forEach(function(_ref170){var e=_ref170.timer;e&&clearTimeout(e);}),this.imageResolveMap.clear();}},{key:"setIsSafari",value:function setIsSafari(e){this.isSafari=e;}},{key:"on",value:function(){var _on=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e){var t,r,n,s,c,l,f,h,_h7,m,u,y;return _regeneratorRuntime().wrap(function _callee29$(_context31){while(1)switch(_context31.prev=_context31.next){case 0:t=e.msgType,r=e.toolsType,n=e.opt,s=e.imageSrc,c=e.imageBitmap,l=e.workId,f=e.dpr;_context31.t0=t;_context31.next=_context31.t0===xt.UpdateDpr?4:_context31.t0===xt.UpdateCamera?9:_context31.t0===xt.Destroy?12:_context31.t0===xt.Clear?14:_context31.t0===xt.UpdateTools?17:_context31.t0===xt.GetImageBitMap?19:21;break;case 4:_context31.t1=er(f);if(!_context31.t1){_context31.next=8;break;}_context31.next=8;return this.updateDpr(f);case 8:return _context31.abrupt("break",21);case 9:_context31.next=11;return this.updateCamera(e);case 11:return _context31.abrupt("break",21);case 12:this.destroy();return _context31.abrupt("break",21);case 14:_context31.next=16;return this.clearAll();case 16:return _context31.abrupt("break",21);case 17:if(r&&n){h={toolsType:r,toolsOpt:n,combineUnitTime:e.combineUnitTime,maxCombineEraserTime:e.maxCombineEraserTime};this.localWork.setToolsOpt(h);}return _context31.abrupt("break",21);case 19:if(s&&c&&l){_h7=l.toString();this.cacheImages.set(s,{imageBitmap:c,workId:_h7});m=this.imageResolveMap.get(s);if(m){u=m.resolve,y=m.timer;y&&clearTimeout(y),u&&u(s);}this.deleteCachedImagesByWorkId(_h7,s);}return _context31.abrupt("break",21);case 21:case"end":return _context31.stop();}},_callee29,this);}));function on(_x60){return _on.apply(this,arguments);}return on;}()},{key:"getIconSize",value:function getIconSize(e,t,r){var n=e*r,s=t*r;return n<=50||s<=50?[50,50]:n<=100||s<=100?[100,100]:n<=200||s<=200?[200,200]:n<=400||s<=400?[400,400]:n<=800||s<=800?[800,800]:[1600,1600];}},{key:"loadImageBitMap",value:function(){var _loadImageBitMap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e){var _this88=this;var t,r,n,s,c,l,f,h,m,u,y,_this$getIconSize,_this$getIconSize2,x,_I54,_x62,_x63,C;return _regeneratorRuntime().wrap(function _callee30$(_context32){while(1)switch(_context32.prev=_context32.next){case 0:t=e.toolsType,r=e.opt,n=e.workId,s=e.isSubWorker;if(!(t===Tt.Image&&r&&n)){_context32.next=19;break;}c=n.toString(),l=r.src,f=r.type,h=r.width,m=r.height,u=r.strokeColor;if(!(!l||!f||!h||!m)){_context32.next=5;break;}return _context32.abrupt("return");case 5:y=l;if(f===cl.Iconify){_this$getIconSize=this.getIconSize(h,m,this.dpr),_this$getIconSize2=_slicedToArray(_this$getIconSize,2),x=_this$getIconSize2[0],_I54=_this$getIconSize2[1];y="".concat(l,"?width=").concat(x,"&height=").concat(_I54,"&color=").concat(u);}if(!this.cacheImages.has(y)){_context32.next=11;break;}_x62=this.getCachedImages(y);if(!_x62){_context32.next=11;break;}return _context32.abrupt("return",_x62);case 11:if(!this.imageResolveMap.has(y)){_context32.next=15;break;}_x63=this.getCachedImagesByWorkId(c);if(!_x63){_context32.next=15;break;}return _context32.abrupt("return",_x63);case 15:_context32.next=17;return new Promise(function(x){var I=_this88.imageResolveMap.get(y)||{resolve:void 0,timer:void 0};I.timer&&clearTimeout(I.timer),I.resolve=x,I.timer=setTimeout(function(){var d=_this88.imageResolveMap.get(y);d!=null&&d.resolve&&d.resolve(y);},5e3),_this88.imageResolveMap.set(y,I),_this88._post({sp:[{imageSrc:y,workId:c,viewId:_this88.viewId,isgl:!!_this88.fullLayer.parent.gl,isSubWorker:s,type:xt.GetImageBitMap}]});});case 17:C=_context32.sent;return _context32.abrupt("return",(this.imageResolveMap["delete"](C),this.getCachedImages(y)));case 19:case"end":return _context32.stop();}},_callee30,this);}));function loadImageBitMap(_x61){return _loadImageBitMap.apply(this,arguments);}return loadImageBitMap;}()},{key:"createLocalWork",value:function createLocalWork(e){var t=e.workId,r=e.opt,n=e.toolsType;t&&r&&(!this.localWork.getToolsOpt()&&n&&this.setToolsOpt({toolsType:n,toolsOpt:r}),this.setWorkOpt({workId:t,toolsOpt:r}));}},{key:"updateScene",value:function updateScene(e,t,r){e.attr(_objectSpread({},t));var n=t.width,s=t.height;e.container.width=n,e.container.height=s,e.width=n,e.height=s,this.updateLayer({width:n,height:s},r);}},{key:"updateLayer",value:function updateLayer(e,t){var r=e.width,n=e.height,s=t||this.fullLayer;s&&(s.parent.setAttribute("width",r),s.parent.setAttribute("height",n),s.setAttribute("size",[r,n]),s.setAttribute("pos",[r*0.5,n*0.5]));}},{key:"getSupportContextType",value:function getSupportContextType(e,t){var r=new OffscreenCanvas(100,100);var n=["2d"];e===uo.Full&&this.viewId===ki&&(n=["webgl2","webgl","2d"],t&&n.unshift(t));for(var _i3=0,_n7=n;_i3<_n7.length;_i3++){var s=_n7[_i3];try{if(r.getContext(s))return s;}catch(c){throw c;}}}},{key:"createScene",value:function createScene(e){var t=e.offscreenCanvasOpt,r=t.width,n=t.height,s=new OffscreenCanvas(r,n);t.contextType&&delete t.contextType;var c=new Uu(_objectSpread(_objectSpread({container:s,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},t),{},{contextType:this.contextType,id:this.viewId}));return c.setAttribute("id",this.viewId),c;}},{key:"createLayer",value:function createLayer(e,t,r,n){var s="offscreen-".concat(e),c=r.width,l=r.height;n&&(r.offscreen=!0,r.canvas=n);var f=t.layer(s,r),h=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return f.append(h),h;}},{key:"clearAll",value:function(){var _clearAll=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(){var e;return _regeneratorRuntime().wrap(function _callee31$(_context33){while(1)switch(_context33.prev=_context33.next){case 0:this.fullLayer&&(this.fullLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),Lr(this.fullLayer,this.fullLayer.parent)),this.taskUpdateCameraId&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0),this.debounceUpdateCameraId&&(clearTimeout(this.debounceUpdateCameraId),this.debounceUpdateCameraId=void 0),this.clearCacheImages(),this.clearImageResolveMap(),this.localWork.destroy(),(e=this.serviceWork)==null||e.destroy();case 1:case"end":return _context33.stop();}},_callee31,this);}));function clearAll(){return _clearAll.apply(this,arguments);}return clearAll;}()},{key:"setToolsOpt",value:function setToolsOpt(e){this.localWork.setToolsOpt(e);}},{key:"setWorkOpt",value:function setWorkOpt(e){var t=e.workId,r=e.toolsOpt;t&&r&&this.localWork.setWorkOptions(t.toString(),r);}},{key:"destroy",value:function destroy(){var e;this.vNodes.clear(),this.fullLayer.remove(),_pr(this.fullLayer,this.fullLayer.parent),this.clearCacheImages(),this.clearImageResolveMap(),this.scene.remove(),this.localWork.destroy(),(e=this.serviceWork)==null||e.destroy();}},{key:"post",value:function(){var _post=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e){return _regeneratorRuntime().wrap(function _callee32$(_context34){while(1)switch(_context34.prev=_context34.next){case 0:this.combinePostMsg.add(e);_context34.next=3;return this.runBatchPostData();case 3:case"end":return _context34.stop();}},_callee32,this);}));function post(_x64){return _post.apply(this,arguments);}return post;}()},{key:"runBatchPostData",value:function(){var _runBatchPostData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(){var _this89=this;return _regeneratorRuntime().wrap(function _callee33$(_context35){while(1)switch(_context35.prev=_context35.next){case 0:this.workerTaskId||(this.workerTaskId=setTimeout(function(){_this89.workerTaskId=void 0,_this89.combinePost();},16));_context35.t0=this.type===uo.Full&&!this.delayPostDoneResolve;if(!_context35.t0){_context35.next=6;break;}_context35.next=5;return new Promise(function(t){_this89.delayPostDoneResolve=t;});case 5:_context35.t0=_context35.sent;case 6:_context35.t1=_context35.t0;if(!_context35.t1){_context35.next=9;break;}this.delayPostDoneResolve=void 0;case 9:case"end":return _context35.stop();}},_callee33,this);}));function runBatchPostData(){return _runBatchPostData.apply(this,arguments);}return runBatchPostData;}()},{key:"combinePostData",value:function combinePostData(){var l,f;this.workerTaskId=void 0;var e=[],t=[];var r,n,s;var c=/* @__PURE__ */new Set();var _iterator53=_createForOfIteratorHelper(this.combinePostMsg.values()),_step53;try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var h=_step53.value;if((l=h.render)!=null&&l.length){var _iterator54=_createForOfIteratorHelper(h.render),_step54;try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var m=_step54.value;var u=!1;if(m.workId&&c.add(m.workId),m.isClearAll&&(m.rect=this.getSceneRect(),m.isClear=!0,delete m.isClearAll),m.drawCanvas){var y=this.getLayer(m.drawCanvas);if(!y||!(y.parent instanceof el))continue;if(y.parent.render(),m.isDrawAll){var T=this.getSceneRect();m.rect=T,delete m.isDrawAll;}}var _iterator55=_createForOfIteratorHelper(e),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var _y3=_step55.value;if(m.viewId===_y3.viewId){m.isClear&&_y3.clearCanvas&&_y3.isClear&&_y3.clearCanvas===m.clearCanvas&&(_y3.rect=Zt(_y3.rect,m.rect),u=!0),_y3.drawCanvas&&_y3.drawCanvas===m.drawCanvas&&(_y3.rect=Zt(_y3.rect,m.rect),u=!0);continue;}}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}u||(m.isClear&&!m.drawCanvas?e.unshift(m):e.push(m));}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}}if((f=h.sp)!=null&&f.length){var _iterator56=_createForOfIteratorHelper(h.sp),_step56;try{for(_iterator56.s();!(_step56=_iterator56.n()).done;){var _m12=_step56.value;var _u6=!1;var _iterator57=_createForOfIteratorHelper(t),_step57;try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var _y4=_step57.value;if(qr(_m12,_y4)){_u6=!0;break;}}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}_u6||t.push(_m12);}}catch(err){_iterator56.e(err);}finally{_iterator56.f();}}er(h.fullWorkerDrawCount)&&(r=h.fullWorkerDrawCount),er(h.subWorkerDrawCount)&&(n=h.subWorkerDrawCount),er(h.consumeCount)&&(s=h.consumeCount);}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}return this.combinePostMsg.clear(),{render:e,sp:t,fullWorkerDrawCount:r,subWorkerDrawCount:n,consumeCount:s,workIds:c,viewId:this.viewId};}},{key:"getSceneRect",value:function getSceneRect(){var _this$scene=this.scene,e=_this$scene.width,t=_this$scene.height;return{x:0,y:0,w:Math.floor(e),h:Math.floor(t)};}}]);}();var bl=/*#__PURE__*/function(){function bl(e){_classCallCheck(this,bl);dt(this,"viewId");dt(this,"vNodes");dt(this,"thread");dt(this,"fullLayer");dt(this,"drawLayer");dt(this,"_post");dt(this,"tmpOpt");dt(this,"workShapes",/* @__PURE__ */new Map());dt(this,"drawCount",0);dt(this,"consumeCount",0);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"combineUnitTime",vr.bezier.combineUnitTime);dt(this,"maxCombineEraserTime",vr.pencilEraser.maxCombineTime);this.thread=e.thread,this.viewId=e.viewId,this.vNodes=e.vNodes,this.fullLayer=e.fullLayer,this.drawLayer=e.drawLayer,this._post=this.thread.post.bind(e.thread);}return _createClass(bl,[{key:"setmaxCombineEraserTime",value:function setmaxCombineEraserTime(e){this.maxCombineEraserTime=e;}},{key:"setCombineUnitTime",value:function setCombineUnitTime(e){this.combineUnitTime=e;}},{key:"setSyncUnitTime",value:function setSyncUnitTime(e){this.syncUnitTime=e;}},{key:"destroy",value:function destroy(){this.workShapes.clear();}},{key:"getWorkShapes",value:function getWorkShapes(){return this.workShapes;}},{key:"getWorkShape",value:function getWorkShape(e){return this.workShapes.get(e);}},{key:"createWorkShape",value:function createWorkShape(e,t){if(e&&this.tmpOpt){var r={toolsType:this.tmpOpt.toolsType,toolsOpt:t||this.tmpOpt.toolsOpt},n=this.createWorkShapeNode(_objectSpread(_objectSpread({},r),{},{workId:e}));n&&this.workShapes.set(e,n);}}},{key:"setWorkOptions",value:function setWorkOptions(e,t){var r=this.getWorkShape(e);r||this.createWorkShape(e,t),r==null||r.setWorkOptions(t);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(e){var t;return To(_objectSpread(_objectSpread({},e),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(t=this.thread)==null?void 0:t.serviceWork);}},{key:"setToolsOpt",value:function setToolsOpt(e){var t,r,n;((t=this.tmpOpt)==null?void 0:t.toolsType)!==e.toolsType&&(r=this.tmpOpt)!=null&&r.toolsType&&this.clearAllWorkShapesCache(),this.tmpOpt=e,(n=e.toolsOpt)!=null&&n.syncUnitTime&&(this.syncUnitTime=e.toolsOpt.syncUnitTime),e.combineUnitTime&&(this.combineUnitTime=e.combineUnitTime),e.maxCombineEraserTime&&(this.maxCombineEraserTime=e.maxCombineEraserTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"clearWorkShapeNodeCache",value:function clearWorkShapeNodeCache(e){var t;(t=this.getWorkShape(e))==null||t.clearTmpPoints(),this.workShapes["delete"](e);}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.workShapes.forEach(function(e){return e.clearTmpPoints();}),this.workShapes.clear();}},{key:"setFullWork",value:function setFullWork(e){var t=e.workId,r=e.opt,n=e.toolsType;if(t&&r&&n){var s=t.toString();var c;return t&&this.workShapes.has(s)?(c=this.workShapes.get(s),c==null||c.setWorkOptions(r)):c=this.createWorkShapeNode({toolsOpt:r,toolsType:n,workId:s}),c?(this.workShapes.set(s,c),c):void 0;}}}]);}();function aE(i){return i;}var Qh=aE;function lE(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2]);}return i.apply(e,t);}var fE=lE,cE=fE,bu=Math.max;function uE(i,e,t){return e=bu(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=bu(r.length-e,0),c=Array(s);++n<s;)c[n]=r[e+n];n=-1;for(var l=Array(e+1);++n<e;)l[n]=r[n];return l[e]=t(c),cE(i,this,l);};}var hE=uE;function dE(i){return function(){return i;};}var pE=dE,vE=pE,Du=Ku,gE=Qh,mE=Du?function(i,e){return Du(i,"toString",{configurable:!0,enumerable:!1,value:vE(e),writable:!0});}:gE,yE=mE,PE=800,SE=16,xE=Date.now;function TE(i){var e=0,t=0;return function(){var r=xE(),n=SE-(r-t);if(t=r,n>0){if(++e>=PE)return arguments[0];}else e=0;return i.apply(void 0,arguments);};}var CE=TE,IE=yE,OE=CE,wE=OE(IE),AE=wE,EE=Qh,ME=hE,LE=AE;function RE(i,e){return LE(ME(i,e,EE),i+"");}var bE=RE;function DE(i,e,t,r){for(var n=i.length,s=t+(r?1:-1);r?s--:++s<n;)if(e(i[s],s,i))return s;return-1;}var NE=DE;function BE(i){return i!==i;}var WE=BE;function FE(i,e,t){for(var r=t-1,n=i.length;++r<n;)if(i[r]===e)return r;return-1;}var UE=FE,YE=NE,XE=WE,zE=UE;function $E(i,e,t){return e===e?zE(i,e,t):YE(i,XE,t);}var jE=$E,GE=jE;function HE(i,e){var t=i==null?0:i.length;return!!t&&GE(i,e,0)>-1;}var qh=HE;function kE(i,e,t){for(var r=-1,n=i==null?0:i.length;++r<n;)if(t(e,i[r]))return!0;return!1;}var _h=kE;function KE(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n;}var VE=KE,ZE=Ol,JE=qh,QE=_h,qE=VE,_E=Po,tM=wl,eM=200;function rM(i,e,t,r){var n=-1,s=JE,c=!0,l=i.length,f=[],h=e.length;if(!l)return f;t&&(e=qE(e,_E(t))),r?(s=QE,c=!1):e.length>=eM&&(s=tM,c=!1,e=new ZE(e));t:for(;++n<l;){var m=i[n],u=t==null?m:t(m);if(m=r||m!==0?m:0,c&&u===u){for(var y=h;y--;)if(e[y]===u)continue t;f.push(m);}else s(e,u,r)||f.push(m);}return f;}var nM=rM,Nu=Ji,iM=Qu,sM=qi,Bu=Nu?Nu.isConcatSpreadable:void 0;function oM(i){return sM(i)||iM(i)||!!(Bu&&i&&i[Bu]);}var aM=oM,lM=Sl,fM=aM;function td(i,e,t,r,n){var s=-1,c=i.length;for(t||(t=fM),n||(n=[]);++s<c;){var l=i[s];e>0&&t(l)?e>1?td(l,e-1,t,r,n):lM(n,l):r||(n[n.length]=l);}return n;}var cM=td;function uM(){}var hM=uM,tl=lh,dM=hM,pM=Al,vM=1/0,gM=tl&&1/pM(new tl([,-0]))[1]==vM?function(i){return new tl(i);}:dM,mM=gM,yM=Ol,PM=qh,SM=_h,xM=wl,TM=mM,CM=Al,IM=200;function OM(i,e,t){var r=-1,n=PM,s=i.length,c=!0,l=[],f=l;if(t)c=!1,n=SM;else if(s>=IM){var h=e?null:TM(i);if(h)return CM(h);c=!1,n=xM,f=new yM();}else f=e?[]:l;t:for(;++r<s;){var m=i[r],u=e?e(m):m;if(m=t||m!==0?m:0,c&&u===u){for(var y=f.length;y--;)if(f[y]===u)continue t;e&&f.push(u),l.push(m);}else n(f,u,t)||(f!==l&&f.push(u),l.push(m));}return l;}var wM=OM,AM=nM,EM=cM,Wu=wM;function MM(i,e,t){var r=i.length;if(r<2)return r?Wu(i[0]):[];for(var n=-1,s=Array(r);++n<r;)for(var c=i[n],l=-1;++l<r;)l!=n&&(s[n]=AM(s[n]||c,i[l],e,t));return Wu(EM(s,1),e,t);}var LM=MM,RM=gl,bM=pn;function DM(i){return bM(i)&&RM(i);}var NM=DM,BM=rh,WM=bE,FM=LM,UM=NM,YM=WM(function(i){return FM(BM(i,UM));}),XM=YM,zM=/* @__PURE__ */Ln(XM);var ed=/*#__PURE__*/function(_bl){function ed(t){var _this90;_classCallCheck(this,ed);_this90=_callSuper(this,ed,[t]);dt(_this90,"_type","full");dt(_this90,"combineTimerId");dt(_this90,"combineDrawResolve");dt(_this90,"combineDrawActiveId");dt(_this90,"drawWorkActiveId");dt(_this90,"effectSelectNodeData",/* @__PURE__ */new Set());return _this90;}_inherits(ed,_bl);return _createClass(ed,[{key:"loadImageBitMap",value:function(){var _loadImageBitMap2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(t){return _regeneratorRuntime().wrap(function _callee34$(_context36){while(1)switch(_context36.prev=_context36.next){case 0:_context36.next=2;return this.thread.loadImageBitMap(t);case 2:return _context36.abrupt("return",_context36.sent);case 3:case"end":return _context36.stop();}},_callee34,this);}));function loadImageBitMap(_x65){return _loadImageBitMap2.apply(this,arguments);}return loadImageBitMap;}()},{key:"consumeDraw",value:function(){var _consumeDraw=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(t,r){var _this91=this;var n,s,c,l,f,h,m,u,y;return _regeneratorRuntime().wrap(function _callee35$(_context37){while(1)switch(_context37.prev=_context37.next){case 0:n=t.op,s=t.workId,c=t.scenePath,l=t.postCount,f=t.smoothSync;if(!(n!=null&&n.length&&s)){_context37.next=48;break;}h=s.toString(),m=this.getWorkShape(h);if(m){_context37.next=5;break;}return _context37.abrupt("return");case 5:u=m.toolsType;if(!(u===Tt.LaserPen)){_context37.next=8;break;}return _context37.abrupt("return");case 8:_context37.t0=this.combineDrawActiveId&&this.combineDrawActiveId!==h;if(!_context37.t0){_context37.next=13;break;}this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);_context37.next=13;return this.consumeDrawAll({workId:this.combineDrawActiveId,scenePath:c,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local},r);case 13:_context37.t1=this.drawWorkActiveId&&this.drawWorkActiveId!==h;if(!_context37.t1){_context37.next=18;break;}_context37.next=17;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:c,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local},r);case 17:this.drawWorkActiveId=void 0;case 18:!this.drawWorkActiveId&&h!==Me&&(this.drawWorkActiveId=h);er(l)&&(this.consumeCount=l);y=m.consume({data:t,isFullWork:!0,smoothSync:f});_context37.t2=u;_context37.next=_context37.t2===Tt.Selector?24:_context37.t2===Tt.PencilEraser?30:_context37.t2===Tt.BitMapEraser?30:_context37.t2===Tt.Eraser?32:_context37.t2===Tt.Arrow?35:_context37.t2===Tt.Straight?35:_context37.t2===Tt.Ellipse?35:_context37.t2===Tt.Rectangle?35:_context37.t2===Tt.Star?35:_context37.t2===Tt.Polygon?35:_context37.t2===Tt.SpeechBalloon?35:_context37.t2===Tt.Pencil?41:48;break;case 24:_context37.t3=y.type===xt.Select;if(!_context37.t3){_context37.next=29;break;}y.selectIds&&r.runReverseSelectWork(y.selectIds);_context37.next=29;return this.drawSelector(y);case 29:return _context37.abrupt("break",48);case 30:this.drawCount++,this.combineTimerId||(this.combineTimerId=1,this.combineDrawActiveId=h,this.drawEraserCombine(h,this.drawCount).then(function(){_this91.combineTimerId=void 0;}));return _context37.abrupt("break",48);case 32:_context37.next=34;return this.drawEraser(y);case 34:return _context37.abrupt("break",48);case 35:_context37.t4=y;if(!_context37.t4){_context37.next=40;break;}this.drawCount++;_context37.next=40;return this.drawShape(y);case 40:return _context37.abrupt("break",48);case 41:this.drawCount++;!this.combineTimerId&&this.combineUnitTime!==1/0&&new Promise(function(T){_this91.combineDrawActiveId=h,_this91.combineDrawResolve=T,_this91.combineTimerId=setTimeout(function(){_this91.combineTimerId=void 0,_this91.combineDrawResolve&&_this91.combineDrawResolve(!0);},_this91.combineUnitTime);}).then(function(T){T&&_this91.drawPencilCombine(h,_this91.drawCount),_this91.combineDrawResolve=void 0;});_context37.t5=y;if(!_context37.t5){_context37.next=47;break;}_context37.next=47;return this.drawPencil(y);case 47:return _context37.abrupt("break",48);case 48:case"end":return _context37.stop();}},_callee35,this);}));function consumeDraw(_x66,_x67){return _consumeDraw.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(t,r){var l,f,h,n,s,c,m,u,y,T,E,C;return _regeneratorRuntime().wrap(function _callee36$(_context38){while(1)switch(_context38.prev=_context38.next){case 0:this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);n=t.workId,s=t.scenePath,c=t.isLockSentEventCursor;if(!n){_context38.next=38;break;}m=n.toString();this.drawWorkActiveId===m&&(this.drawWorkActiveId=void 0);u=this.workShapes.get(m);if(u){_context38.next=8;break;}return _context38.abrupt("return");case 8:y=u.toolsType;if(!(y===Tt.LaserPen)){_context38.next=11;break;}return _context38.abrupt("return");case 11:T=this.workShapes.get(di),E=(l=T==null?void 0:T.selectIds)==null?void 0:l[0],C=u.consumeAll({data:t,workerEngine:this});_context38.t0=y;_context38.next=_context38.t0===Tt.Selector?15:_context38.t0===Tt.PencilEraser?21:_context38.t0===Tt.BitMapEraser?21:_context38.t0===Tt.Eraser?26:_context38.t0===Tt.Arrow?28:_context38.t0===Tt.Straight?28:_context38.t0===Tt.Ellipse?28:_context38.t0===Tt.Rectangle?28:_context38.t0===Tt.Star?28:_context38.t0===Tt.Polygon?28:_context38.t0===Tt.SpeechBalloon?28:_context38.t0===Tt.Pencil?33:38;break;case 15:C.selectIds&&E&&(f=C.selectIds)!=null&&f.includes(E)&&T.cursorBlur();C.selectIds&&r.runReverseSelectWork(C.selectIds);_context38.next=19;return this.drawSelector(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 19:(h=u.selectIds)!=null&&h.length?u.clearTmpPoints():this.clearWorkShapeNodeCache(m);return _context38.abrupt("break",38);case 21:_context38.next=23;return this.drawEraserFull(u,_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 23:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context38.abrupt("break",38);case 26:this.drawEraser(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c),u.clearTmpPoints();return _context38.abrupt("break",38);case 28:_context38.next=30;return this.drawPencilFull(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 30:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context38.abrupt("break",38);case 33:_context38.next=35;return this.drawPencilFull(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 35:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context38.abrupt("break",38);case 38:case"end":return _context38.stop();}},_callee36,this);}));function consumeDrawAll(_x68,_x69){return _consumeDrawAll.apply(this,arguments);}return consumeDrawAll;}()},{key:"workShapesDone",value:function(){var _workShapesDone=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(t,r){var _iterator58,_step58,n;return _regeneratorRuntime().wrap(function _callee37$(_context39){while(1)switch(_context39.prev=_context39.next){case 0:_iterator58=_createForOfIteratorHelper(this.workShapes.keys());_context39.prev=1;_iterator58.s();case 3:if((_step58=_iterator58.n()).done){_context39.next=9;break;}n=_step58.value;_context39.next=7;return this.consumeDrawAll({workId:n,scenePath:t,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local},r);case 7:_context39.next=3;break;case 9:_context39.next=14;break;case 11:_context39.prev=11;_context39.t0=_context39["catch"](1);_iterator58.e(_context39.t0);case 14:_context39.prev=14;_iterator58.f();return _context39.finish(14);case 17:case"end":return _context39.stop();}},_callee37,this,[[1,11,14,17]]);}));function workShapesDone(_x70,_x71){return _workShapesDone.apply(this,arguments);}return workShapesDone;}()},{key:"consumeFull",value:function(){var _consumeFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(t){var s,c,r,n,l,f,h,m,u,y,T;return _regeneratorRuntime().wrap(function _callee38$(_context40){while(1)switch(_context40.prev=_context40.next){case 0:r=this.setFullWork(t),n=t.ops&&yi(t.ops)||t.op;if(!r){_context40.next=26;break;}l=(s=t.workId)==null?void 0:s.toString();if(l){_context40.next=5;break;}return _context40.abrupt("return");case 5:f=(c=this.vNodes.get(l))==null?void 0:c.rect;if(!(r.toolsType===Tt.Image)){_context40.next=13;break;}_context40.next=9;return r.consumeServiceAsync({isFullWork:!0,replaceId:l,worker:this});case 9:h=_context40.sent;m=(t==null?void 0:t.updateNodeOpt)&&r.updataOptService(t.updateNodeOpt);_context40.next=20;break;case 13:if(!(r.toolsType===Tt.Text)){_context40.next=19;break;}_context40.next=16;return r.consumeServiceAsync({isFullWork:!0,replaceId:l,boxRect:this.thread.getSceneRect()});case 16:h=_context40.sent;_context40.next=20;break;case 19:h=r.consumeService({op:n,isFullWork:!0,replaceId:l}),m=(t==null?void 0:t.updateNodeOpt)&&r.updataOptService(t.updateNodeOpt);case 20:h=Zt(h,m);u=[],y=[];if(!(t.workId&&this.workShapes["delete"](t.workId.toString()),h&&t.willRefresh&&(f&&(u.push({rect:ve(f),isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId}),h=Zt(h,f)),u.push({rect:ve(h),drawCanvas:Ut.Bg,viewId:this.viewId})),t.willSyncService&&y.push({opt:t.opt,toolsType:t.toolsType,type:xt.FullWork,workId:t.workId,ops:t.ops,updateNodeOpt:t.updateNodeOpt,viewId:this.viewId}),u.length||y.length)){_context40.next=26;break;}T={render:u,sp:y};_context40.next=26;return this._post(T);case 26:case"end":return _context40.stop();}},_callee38,this);}));function consumeFull(_x72){return _consumeFull.apply(this,arguments);}return consumeFull;}()},{key:"commandDeleteText",value:function commandDeleteText(t){var r=this.vNodes.get(t);if(r&&r.toolsType===Tt.Text)return{type:xt.TextUpdate,toolsType:Tt.Text,workId:t,dataType:Vt.Local};}},{key:"removeSelector",value:function(){var _removeSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(t,r){var n,s,c,l,f,h,_iterator59,_step59,m,T,y;return _regeneratorRuntime().wrap(function _callee39$(_context41){while(1)switch(_context41.prev=_context41.next){case 0:n=t.willSyncService,s=[],c=[],l=[],f=this.workShapes.get(Me);if(f){_context41.next=3;break;}return _context41.abrupt("return");case 3:h=f.selectIds&&_toConsumableArray(f.selectIds)||[];_iterator59=_createForOfIteratorHelper(h);try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){m=_step59.value;if(this.vNodes.get(m)){T=this.commandDeleteText(m);T&&s.push(T);}y=this._removeWork(m);y.length&&c.push.apply(c,_toConsumableArray(y)),r==null||r.deleteCachedImagesByWorkId(m),l.push(m);}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}l.length&&s.push({type:xt.RemoveNode,removeIds:l});s.push({type:xt.Select,selectIds:[],willSyncService:n});_context41.next=10;return this.blurSelector();case 10:_context41.t0=c.length||s.length;if(!_context41.t0){_context41.next=14;break;}_context41.next=14;return this._post({render:c,sp:s});case 14:case"end":return _context41.stop();}},_callee39,this);}));function removeSelector(_x73,_x74){return _removeSelector.apply(this,arguments);}return removeSelector;}()},{key:"removeWork",value:function(){var _removeWork2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(t){var r,n,s;return _regeneratorRuntime().wrap(function _callee40$(_context42){while(1)switch(_context42.prev=_context42.next){case 0:r=t.workId,n=r==null?void 0:r.toString();if(!n){_context42.next=7;break;}s=this._removeWork(n);_context42.t0=s.length;if(!_context42.t0){_context42.next=7;break;}_context42.next=7;return this._post({render:s});case 7:case"end":return _context42.stop();}},_callee40,this);}));function removeWork(_x75){return _removeWork2.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(t){var _this92=this;var s,c,l;var r=this.vNodes.get(t);r&&((s=this.fullLayer)==null||s.getElementsByName(t).forEach(function(f){f.remove(),_pr(f,_this92.fullLayer.parent);}),this.vNodes["delete"](t));var n=this.drawLayer&&$t.getRectFromLayer(this.drawLayer,t);if(n){var f=(c=this.drawLayer)==null?void 0:c.getElementsByName(t)[0];f&&(f.remove(),_pr(f,(l=this.drawLayer)==null?void 0:l.parent));}return this.getWorkShape(t)&&this.clearWorkShapeNodeCache(t),{fullRect:r==null?void 0:r.rect,drawRect:n};}},{key:"_removeWork",value:function _removeWork(t){var _this$removeNode=this.removeNode(t),r=_this$removeNode.fullRect,n=_this$removeNode.drawRect,s=[];return r&&s.push({rect:ve(r),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(r),drawCanvas:Ut.Bg,viewId:this.viewId}),n&&s.push({rect:ve(n),clearCanvas:Ut.Float,isClear:!0,viewId:this.viewId},{rect:ve(n),drawCanvas:Ut.Float,viewId:this.viewId}),s;}},{key:"checkTextActive",value:function(){var _checkTextActive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(t){var r,n,s,c,l,f,h,_iterator60,_step60,_m13,u,y,T,E,m;return _regeneratorRuntime().wrap(function _callee41$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:r=t.op,n=t.viewId,s=t.dataType;if(!(r!=null&&r.length)){_context43.next=32;break;}f=r[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],h=r[1]*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1];_iterator60=_createForOfIteratorHelper(this.vNodes.curNodeMap.values());_context43.prev=4;_iterator60.s();case 6:if((_step60=_iterator60.n()).done){_context43.next=14;break;}_m13=_step60.value;u=_m13.rect,y=_m13.name,T=_m13.toolsType,E=_m13.opt;if(!(T===Tt.Text&&E.workState===te.Done&&qA([f,h],u))){_context43.next=12;break;}c=y,l=this.setFullWork({workId:y,toolsType:T,opt:E});return _context43.abrupt("break",14);case 12:_context43.next=6;break;case 14:_context43.next=19;break;case 16:_context43.prev=16;_context43.t0=_context43["catch"](4);_iterator60.e(_context43.t0);case 19:_context43.prev=19;_iterator60.f();return _context43.finish(19);case 22:if(!c){_context43.next=32;break;}_context43.t1=l;if(!_context43.t1){_context43.next=28;break;}_context43.next=27;return l.consumeServiceAsync({isFullWork:!0,replaceId:l.getWorkId(),boxRect:this.thread.getSceneRect()});case 27:m=_context43.sent;case 28:_context43.next=30;return this.blurSelector({viewId:n,msgType:xt.Select,dataType:s,isSync:!0});case 30:_context43.next=32;return this._post({render:m&&[{rect:ve(m),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(m),drawCanvas:Ut.Bg,viewId:this.viewId}],sp:[{type:xt.GetTextActive,toolsType:Tt.Text,workId:c}]});case 32:case"end":return _context43.stop();}},_callee41,this,[[4,16,19,22]]);}));function checkTextActive(_x76){return _checkTextActive.apply(this,arguments);}return checkTextActive;}()},{key:"colloctEffectSelectWork",value:function(){var _colloctEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(t){var _this93=this;var r,n,s;return _regeneratorRuntime().wrap(function _callee42$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:r=this.workShapes.get(Me),n=t.workId,s=t.msgType;if(!(r&&n&&r.selectIds&&r.selectIds.includes(n.toString()))){_context44.next=6;break;}s===xt.RemoveNode?r.selectIds=r.selectIds.filter(function(c){return c!==n.toString();}):this.effectSelectNodeData.add(t);_context44.next=5;return this.runEffectSelectWork(!0).then(function(){var c;(c=_this93.effectSelectNodeData)==null||c.clear();});case 5:return _context44.abrupt("return");case 6:return _context44.abrupt("return",t);case 7:case"end":return _context44.stop();}},_callee42,this);}));function colloctEffectSelectWork(_x77){return _colloctEffectSelectWork.apply(this,arguments);}return colloctEffectSelectWork;}()},{key:"updateSelector",value:function(){var _updateSelector2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(t){var _this94=this;var C,r,n,s,c,l,f,h,m,u,y,T,E;return _regeneratorRuntime().wrap(function _callee43$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:r=this.workShapes.get(Me);if((C=r==null?void 0:r.selectIds)!=null&&C.length){_context45.next=3;break;}return _context45.abrupt("return");case 3:n=t.callback;s=_objectWithoutProperties(t,_excluded2);c=s.updateSelectorOpt;l=s.willSerializeData;f=s.smoothSync;_context45.next=10;return r==null?void 0:r.updateSelector({updateSelectorOpt:c,selectIds:fr(r.selectIds),vNodes:this.vNodes,willSerializeData:l,worker:this});case 10:h=_context45.sent;m=/* @__PURE__ */new Map();h!=null&&h.selectIds&&(u=zM(r.selectIds,h.selectIds),h.selectIds.forEach(function(x){var I=_this94.vNodes.get(x);if(I){var _d46=I.toolsType,v=I.op,p=I.opt;m.set(x,{opt:p,toolsType:_d46,ops:(v==null?void 0:v.length)&&gr(v)||void 0});}}),r.selectIds=h.selectIds);y=[],T=[];h!=null&&h.rect&&y.push({rect:ve(h.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(h.rect),drawCanvas:Ut.Bg,viewId:this.viewId});E=n&&n({res:h,workShapeNode:r,param:s,postData:{render:y,sp:T},newServiceStore:m,smoothSync:f})||{render:y,sp:T};u&&E.sp.push({type:xt.RemoveNode,removeIds:u,viewId:this.viewId});_context45.t0=E.render.length||E.sp.length;if(!_context45.t0){_context45.next=21;break;}_context45.next=21;return this._post(E);case 21:case"end":return _context45.stop();}},_callee43,this);}));function updateSelector(_x78){return _updateSelector2.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function(){var _blurSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(t){var s,r,n,c;return _regeneratorRuntime().wrap(function _callee44$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:r=this.workShapes.get(Me),n=r==null?void 0:r.blurSelector();if(!(this.clearWorkShapeNodeCache(Me),((s=this.fullLayer)==null?void 0:s.parent).children.forEach(function(c){c.name===Me&&c.remove();}),n)){_context46.next=6;break;}c=[];c.push(_objectSpread(_objectSpread({},n),{},{isSync:t==null?void 0:t.isSync}));_context46.next=6;return this._post({render:(n==null?void 0:n.rect)&&[{rect:ve(n.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(n.rect),drawCanvas:Ut.Bg,viewId:this.viewId}],sp:c});case 6:case"end":return _context46.stop();}},_callee44,this);}));function blurSelector(_x79){return _blurSelector.apply(this,arguments);}return blurSelector;}()},{key:"hasSelector",value:function hasSelector(){return this.workShapes.has(Me);}},{key:"getSelector",value:function getSelector(){return this.workShapes.get(Me);}},{key:"reRenderSelector",value:function(){var _reRenderSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(){var t,c,r,n,s,l,_args47=arguments;return _regeneratorRuntime().wrap(function _callee45$(_context47){while(1)switch(_context47.prev=_context47.next){case 0:t=_args47.length>0&&_args47[0]!==undefined?_args47[0]:!1;r=this.workShapes.get(Me);if(r){_context47.next=4;break;}return _context47.abrupt("return");case 4:if(!(r&&!((c=r.selectIds)!=null&&c.length))){_context47.next=8;break;}_context47.next=7;return this.blurSelector();case 7:return _context47.abrupt("return");case 8:n=r.oldSelectRect,s=r.reRenderSelector();if(!s){_context47.next=13;break;}l=Zt(n,s)||s;_context47.next=13;return this._post({render:[{rect:ve(l),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(l),drawCanvas:Ut.Bg,viewId:this.viewId}],sp:[{type:xt.Select,selectIds:r.selectIds,selectRect:s,willSyncService:t,viewId:this.viewId,points:r.getChildrenPoints(),textOpt:r.textOpt,selectorColor:r.selectorColor,strokeColor:r.strokeColor,fillColor:r.fillColor,canTextEdit:r.canTextEdit,canRotate:r.canRotate,scaleType:r.scaleType,opt:r.getWorkOptions()||void 0,canLock:r.canLock,isLocked:r.isLocked,toolsTypes:r.toolsTypes,shapeOpt:r.shapeOpt,thickness:r.thickness,useStroke:r.useStroke,strokeType:r.strokeType}]});case 13:case"end":return _context47.stop();}},_callee45,this);}));function reRenderSelector(){return _reRenderSelector.apply(this,arguments);}return reRenderSelector;}()},{key:"updateFullSelectWork",value:function(){var _updateFullSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(t){var s,c,l,f,h,m,u,r,n,_r$updateSelectIds,y,T,E;return _regeneratorRuntime().wrap(function _callee46$(_context48){while(1)switch(_context48.prev=_context48.next){case 0:r=this.workShapes.get(Me),n=t.selectIds;if(n!=null&&n.length){_context48.next=5;break;}_context48.next=4;return this.blurSelector(t);case 4:return _context48.abrupt("return");case 5:if(r){_context48.next=10;break;}!this.setFullWork(t)&&t.workId&&((s=this.tmpOpt)==null?void 0:s.toolsType)===Tt.Selector&&this.createWorkShape(t.workId.toString());_context48.next=9;return this.updateFullSelectWork(t);case 9:return _context48.abrupt("return");case 10:if(!(r&&n!=null&&n.length)){_context48.next=16;break;}_r$updateSelectIds=r.updateSelectIds(n),y=_r$updateSelectIds.bgRect,T=_r$updateSelectIds.selectRect,E={render:[],sp:[]};y&&((c=E.render)==null||c.push({rect:ve(y),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(y),drawCanvas:Ut.Bg,viewId:this.viewId}));(u=E.sp)==null||u.push(_objectSpread(_objectSpread({},t),{},{selectorColor:((l=t.opt)==null?void 0:l.strokeColor)||r.selectorColor,strokeColor:((f=t.opt)==null?void 0:f.strokeColor)||r.strokeColor,fillColor:((h=t.opt)==null?void 0:h.fillColor)||r.fillColor,textOpt:((m=t.opt)==null?void 0:m.textOpt)||r.textOpt,canTextEdit:r.canTextEdit,canRotate:r.canRotate,scaleType:r.scaleType,type:xt.Select,selectRect:T,points:r.getChildrenPoints(),willSyncService:(t==null?void 0:t.willSyncService)||!1,opt:(t==null?void 0:t.willSyncService)&&r.getWorkOptions()||void 0,canLock:r.canLock,isLocked:r.isLocked,toolsTypes:r.toolsTypes,shapeOpt:r.shapeOpt,thickness:r.thickness,useStroke:r.useStroke,strokeType:r.strokeType}));_context48.next=16;return this._post(E);case 16:case"end":return _context48.stop();}},_callee46,this);}));function updateFullSelectWork(_x80){return _updateFullSelectWork.apply(this,arguments);}return updateFullSelectWork;}()},{key:"destroy",value:function destroy(){this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1)),_superPropGet(ed,"destroy",this,3)([]),this.effectSelectNodeData.clear();}},{key:"drawEraserCombine",value:function(){var _drawEraserCombine=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(t,r){var s,c,l,f,n,h,m,u,y,_iterator61,_step61,_step61$value,_y5,T;return _regeneratorRuntime().wrap(function _callee47$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:n=(s=this.workShapes.get(t))==null?void 0:s.combineConsume({workerEngine:this});if(!n){_context49.next=7;break;}h=n.willDeleteNodes,m=n.willNewNodes,u={render:[],fullWorkerDrawCount:r,sp:[]};if(n!=null&&n.rect){y=ve(n.rect);(c=u.render)==null||c.push({rect:y,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:y,drawCanvas:Ut.Bg,viewId:this.viewId});}if(h!=null&&h.size&&((l=u.sp)==null||l.push({type:xt.RemoveNode,removeIds:_toConsumableArray(h),viewId:this.thread.viewId})),m!=null&&m.size){_iterator61=_createForOfIteratorHelper(m);try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){_step61$value=_slicedToArray(_step61.value,2),_y5=_step61$value[0],T=_step61$value[1];(f=u.sp)==null||f.push({type:xt.FullWork,dataType:Vt.Local,toolsType:Tt.Pencil,ops:gr(T.op),opt:T.opt,workId:_y5,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}}_context49.next=7;return this._post(u);case 7:case"end":return _context49.stop();}},_callee47,this);}));function drawEraserCombine(_x81,_x82){return _drawEraserCombine.apply(this,arguments);}return drawEraserCombine;}()},{key:"drawPencilCombine",value:function(){var _drawPencilCombine=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(t,r){var s,c,l,n,f,h;return _regeneratorRuntime().wrap(function _callee48$(_context50){while(1)switch(_context50.prev=_context50.next){case 0:n=(s=this.workShapes.get(t))==null?void 0:s.combineConsume();if(!n){_context50.next=6;break;}f={render:[],fullWorkerDrawCount:r};if(n!=null&&n.rect){h=ve(n.rect);(c=f.render)==null||c.push({rect:h,isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId}),(l=f.render)==null||l.push({rect:h,drawCanvas:Ut.Float,viewId:this.viewId});}_context50.next=6;return this._post(f);case 6:case"end":return _context50.stop();}},_callee48,this);}));function drawPencilCombine(_x83,_x84){return _drawPencilCombine.apply(this,arguments);}return drawPencilCombine;}()},{key:"drawSelector",value:function(){var _drawSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(t,r){var s,c,n;return _regeneratorRuntime().wrap(function _callee49$(_context51){while(1)switch(_context51.prev=_context51.next){case 0:n={render:[],sp:[t]};r&&((s=n.sp)==null||s.push({type:xt.None,isLockSentEventCursor:r}));t.rect&&((c=n.render)==null||c.push({rect:ve(t.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(t.rect),drawCanvas:Ut.Bg,viewId:this.viewId}));_context51.next=5;return this._post(n);case 5:case"end":return _context51.stop();}},_callee49,this);}));function drawSelector(_x85,_x86){return _drawSelector.apply(this,arguments);}return drawSelector;}()},{key:"drawPencilFull",value:function(){var _drawPencilFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(t,r){var s,c,n;return _regeneratorRuntime().wrap(function _callee50$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:n={fullWorkerDrawCount:1/0,render:[],sp:[t]};r&&((s=n.sp)==null||s.push({type:xt.None,isLockSentEventCursor:r}));t!=null&&t.rect&&((c=n.render)==null||c.push({isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:t.rect,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:t.rect,drawCanvas:Ut.Bg,viewId:this.viewId}));_context52.next=5;return this._post(n);case 5:case"end":return _context52.stop();}},_callee50,this);}));function drawPencilFull(_x87,_x88){return _drawPencilFull.apply(this,arguments);}return drawPencilFull;}()},{key:"drawEraserFull",value:function(){var _drawEraserFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(t,r,n){var s,c,l,f,h,m,_iterator62,_step62,_step62$value,y,T,_iterator63,_step63,_step63$value,_y6,_T10,u;return _regeneratorRuntime().wrap(function _callee51$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:s=r.rect,c=r.willUpdateNodes,l=r.willDeleteNodes,f=r.willNewNodes,h=t.getWorkId(),m=[{type:xt.RemoveNode,removeIds:[h],viewId:this.viewId}];if(n&&m.push({type:xt.None,isLockSentEventCursor:n}),c!=null&&c.size||l!=null&&l.size||f!=null&&f.size){if(c!=null&&c.size){_iterator62=_createForOfIteratorHelper(c);try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){_step62$value=_slicedToArray(_step62.value,2),y=_step62$value[0],T=_step62$value[1];m.push({type:xt.UpdateNode,dataType:Vt.Local,opt:T.opt,workId:y,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}}if(l!=null&&l.size&&m.push({type:xt.RemoveNode,removeIds:_toConsumableArray(l),viewId:this.thread.viewId}),f!=null&&f.size){_iterator63=_createForOfIteratorHelper(f);try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){_step63$value=_slicedToArray(_step63.value,2),_y6=_step63$value[0],_T10=_step63$value[1];m.push({type:xt.FullWork,dataType:Vt.Local,toolsType:_T10.toolsType,ops:gr(_T10.op),opt:_T10.opt,workId:_y6,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}}}u=[{isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}];s&&u.push({rect:s,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:s,drawCanvas:Ut.Bg,viewId:this.viewId});_context53.next=6;return this._post({sp:m,render:u,fullWorkerDrawCount:1/0});case 6:case"end":return _context53.stop();}},_callee51,this);}));function drawEraserFull(_x89,_x90,_x91){return _drawEraserFull.apply(this,arguments);}return drawEraserFull;}()},{key:"drawEraser",value:function(){var _drawEraser=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(t,r){var n,s;return _regeneratorRuntime().wrap(function _callee52$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:n=[],s=[];r&&n.push({type:xt.None,isLockSentEventCursor:r});t.removeIds&&n.push(t);t.rect&&s.push({rect:t.rect,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:t.rect,drawCanvas:Ut.Bg,viewId:this.viewId});_context54.next=6;return this._post({sp:n,render:s,consumeCount:this.consumeCount});case 6:case"end":return _context54.stop();}},_callee52,this);}));function drawEraser(_x92,_x93){return _drawEraser.apply(this,arguments);}return drawEraser;}()},{key:"drawShape",value:function(){var _drawShape=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(t){return _regeneratorRuntime().wrap(function _callee53$(_context55){while(1)switch(_context55.prev=_context55.next){case 0:_context55.next=2;return this._post({fullWorkerDrawCount:this.drawCount,sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context55.stop();}},_callee53,this);}));function drawShape(_x94){return _drawShape.apply(this,arguments);}return drawShape;}()},{key:"drawPencil",value:function(){var _drawPencil=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(t){return _regeneratorRuntime().wrap(function _callee54$(_context56){while(1)switch(_context56.prev=_context56.next){case 0:_context56.next=2;return this._post({sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context56.stop();}},_callee54,this);}));function drawPencil(_x95){return _drawPencil.apply(this,arguments);}return drawPencil;}()},{key:"runEffectSelectWork",value:function(){var _runEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(t){var r,_iterator64,_step64,n,s,c,l;return _regeneratorRuntime().wrap(function _callee55$(_context57){while(1)switch(_context57.prev=_context57.next){case 0:_iterator64=_createForOfIteratorHelper(this.effectSelectNodeData.values());_context57.prev=1;_iterator64.s();case 3:if((_step64=_iterator64.n()).done){_context57.next=23;break;}n=_step64.value;s=this.setFullWork(n);if(!s){_context57.next=21;break;}c=(r=s.getWorkId())==null?void 0:r.toString();if(!(s.toolsType===Tt.Image)){_context57.next=13;break;}_context57.next=11;return s.consumeServiceAsync({isFullWork:!0,replaceId:c,worker:this});case 11:_context57.next=20;break;case 13:if(!(s.toolsType===Tt.Text)){_context57.next=18;break;}_context57.next=16;return s.consumeServiceAsync({isFullWork:!0,replaceId:c,boxRect:this.thread.getSceneRect()});case 16:_context57.next=20;break;case 18:l=n.ops&&yi(n.ops);s.consumeService({op:l,isFullWork:!0,replaceId:c}),n!=null&&n.updateNodeOpt&&s.updataOptService(n.updateNodeOpt);case 20:n.workId&&this.workShapes["delete"](n.workId.toString());case 21:_context57.next=3;break;case 23:_context57.next=28;break;case 25:_context57.prev=25;_context57.t0=_context57["catch"](1);_iterator64.e(_context57.t0);case 28:_context57.prev=28;_iterator64.f();return _context57.finish(28);case 31:_context57.next=33;return this.reRenderSelector(t);case 33:case"end":return _context57.stop();}},_callee55,this,[[1,25,28,31]]);}));function runEffectSelectWork(_x96){return _runEffectSelectWork.apply(this,arguments);}return runEffectSelectWork;}()},{key:"cursorHover",value:function(){var _cursorHover=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(t){var l,r,n,s,c,f,h;return _regeneratorRuntime().wrap(function _callee56$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:r=t.opt,n=t.toolsType,s=t.point,c=this.setFullWork({workId:di,toolsType:n,opt:r});if(!(c&&s)){_context58.next=8;break;}f=c.cursorHover(s),h={render:[]};_context58.t0=f&&f.type===xt.CursorHover&&f.rect;if(!_context58.t0){_context58.next=8;break;}(l=h.render)==null||l.push({rect:ve(f.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(f.rect),drawCanvas:Ut.Bg,viewId:this.viewId});_context58.next=8;return this._post(h);case 8:case"end":return _context58.stop();}},_callee56,this);}));function cursorHover(_x97){return _cursorHover.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(){var n,t,r;return _regeneratorRuntime().wrap(function _callee57$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:t=this.getWorkShape(di);_context59.t0=t&&(n=t.selectIds)!=null&&n.length;if(!_context59.t0){_context59.next=10;break;}r=t.oldSelectRect;t.cursorBlur();this.clearWorkShapeNodeCache(di);_context59.t1=r;if(!_context59.t1){_context59.next=10;break;}_context59.next=10;return this._post({render:[{rect:ve(r),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(r),drawCanvas:Ut.Bg,viewId:this.viewId}]});case 10:this.fullLayer.parent.children.forEach(function(s){s.name==="Cursor_Hover_Id"&&s.remove();});case 11:case"end":return _context59.stop();}},_callee57,this);}));function cursorBlur(){return _cursorBlur.apply(this,arguments);}return cursorBlur;}()}]);}(bl);var rd=/*#__PURE__*/function(){function rd(e){_classCallCheck(this,rd);dt(this,"viewId");dt(this,"vNodes");dt(this,"fullLayer");dt(this,"drawLayer");dt(this,"workShapes",/* @__PURE__ */new Map());dt(this,"selectorWorkShapes",/* @__PURE__ */new Map());dt(this,"thread");dt(this,"animationId");dt(this,"willRunEffectSelectorIds",/* @__PURE__ */new Set());dt(this,"runEffectId");dt(this,"noAnimationRect");dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"post");this.viewId=e.viewId,this.vNodes=e.vNodes,this.fullLayer=e.fullLayer,this.drawLayer=e.drawLayer,this.thread=e.thread,this.post=e.thread.post.bind(e.thread);}return _createClass(rd,[{key:"destroy",value:function destroy(){this.workShapes.clear(),this.selectorWorkShapes.clear(),this.willRunEffectSelectorIds.clear();}},{key:"consumeDraw",value:function(){var _consumeDraw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e){return _regeneratorRuntime().wrap(function _callee58$(_context60){while(1)switch(_context60.prev=_context60.next){case 0:this.activeWorkShape(e),this.runAnimation();case 1:case"end":return _context60.stop();}},_callee58,this);}));function consumeDraw(_x98){return _consumeDraw2.apply(this,arguments);}return consumeDraw;}()},{key:"consumeFull",value:function consumeFull(e){this.activeWorkShape(e),this.runAnimation();}},{key:"runSelectWork",value:function runSelectWork(e){this.activeSelectorShape(e);var t=e.workId,r=t==null?void 0:t.toString();r&&this.willRunEffectSelectorIds.add(r),this.runEffect();}},{key:"setNodeKey",value:function setNodeKey(e,t,r,n){return t.toolsType=r,t.node=To({workId:e,toolsType:r,toolsOpt:n,vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer},this),t;}},{key:"runReverseSelectWork",value:function runReverseSelectWork(e){var _this95=this;e.forEach(function(t){_this95.selectorWorkShapes.forEach(function(r,n){var s;if((s=r.selectIds)!=null&&s.length){var c=r.selectIds.indexOf(t);c>-1&&(r.selectIds.splice(c,1),_this95.willRunEffectSelectorIds.add(n));}});}),this.willRunEffectSelectorIds.size&&this.runEffect();}},{key:"removeWork",value:function(){var _removeWork3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e){var t,r,n;return _regeneratorRuntime().wrap(function _callee59$(_context61){while(1)switch(_context61.prev=_context61.next){case 0:t=e.workId,r=t==null?void 0:t.toString();if(!r){_context61.next=10;break;}n=this.workShapes.get(r);if(!n){_context61.next=8;break;}this.workShapes["delete"](r);_context61.next=7;return this.removeNode(r,e,n==null?void 0:n.totalRect,!1);case 7:return _context61.abrupt("return");case 8:_context61.next=10;return this.removeNode(r,e);case 10:case"end":return _context61.stop();}},_callee59,this);}));function removeWork(_x99){return _removeWork3.apply(this,arguments);}return removeWork;}()},{key:"removeSelectWork",value:function removeSelectWork(e){var t=e.workId,r=t==null?void 0:t.toString();r&&(this.activeSelectorShape(e),this.willRunEffectSelectorIds.add(r)),this.runEffect();}},{key:"removeNode",value:function(){var _removeNode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e,t,r){var _this96=this;var n,h,s,c,l,f,_args62=arguments;return _regeneratorRuntime().wrap(function _callee60$(_context62){while(1)switch(_context62.prev=_context62.next){case 0:n=_args62.length>3&&_args62[3]!==undefined?_args62[3]:!0;e.indexOf(Me)>-1&&this.removeSelectWork(t);s=r;c=(h=this.vNodes.get(e))==null?void 0:h.rect;c&&(s=Zt(c,s));l=this.fullLayer&&$t.getRectFromLayer(this.fullLayer,e);s=Zt(s,l);f=this.drawLayer&&$t.getRectFromLayer(this.drawLayer,e);s=Zt(s,f);this.fullLayer.getElementsByName(e).forEach(function(m){m.remove(),_pr(m,_this96.fullLayer.parent);});this.drawLayer.getElementsByName(e).forEach(function(m){m.remove(),_pr(m,_this96.drawLayer.parent);});this.vNodes["delete"](e);_context62.t0=s;if(!_context62.t0){_context62.next=16;break;}_context62.next=16;return this.post({render:[{rect:ve(s),isClear:!0,clearCanvas:n?Ut.Bg:Ut.ServiceFloat,workerType:n?void 0:Vt.Service,viewId:this.viewId},{rect:ve(s),drawCanvas:n?Ut.Bg:Ut.ServiceFloat,workerType:n?void 0:Vt.Service,viewId:this.viewId}]});case 16:case"end":return _context62.stop();}},_callee60,this);}));function removeNode(_x100,_x101,_x102){return _removeNode.apply(this,arguments);}return removeNode;}()},{key:"activeWorkShape",value:function activeWorkShape(e){var E,C,x,I;var t=e.workId,r=e.opt,n=e.toolsType,s=e.type,c=e.updateNodeOpt,l=e.ops,f=e.op,h=e.useAnimation,m=e.isEnableCursor;if(!t)return;var u=t.toString(),y=(E=this.vNodes.get(u))==null?void 0:E.rect;if(!((C=this.workShapes)!=null&&C.has(u))){var _d47={toolsType:n,animationWorkData:f||[],animationIndex:0,type:s,updateNodeOpt:c,ops:l,useAnimation:_typeof(h)<"u"?h:_typeof(c==null?void 0:c.useAnimation)<"u"?c==null?void 0:c.useAnimation:!0,oldRect:y,isDiff:!1,isEnableCursor:m};n&&r&&(_d47=this.setNodeKey(u,_d47,n,r)),(x=this.workShapes)==null||x.set(u,_d47);}var T=(I=this.workShapes)==null?void 0:I.get(u);T.isEnableCursor=m,s&&(T.type=s),l&&(T.animationWorkData=yi(l),T.ops=l),c&&(T.updateNodeOpt=c),f&&(T.isDiff=this.hasDiffData(T.animationWorkData||[],f,T.toolsType),T.animationWorkData=f),T.node&&T.node.getWorkId()!==u&&T.node.setWorkId(u),y&&(T.oldRect=y),n&&r&&(r.syncUnitTime&&(this.syncUnitTime=r.syncUnitTime),T.toolsType!==n&&n&&r&&this.setNodeKey(u,T,n,r),T.node&&T.node.setWorkOptions(r));}},{key:"hasDiffData",value:function hasDiffData(e,t,r){var n=e.length;if(t.length<n)return!0;switch(r){case Tt.Pencil:{for(var s=0;s<n;s+=3)if(t[s]!==e[s]||t[s+1]!==e[s+1])return!0;break;}case Tt.LaserPen:{for(var _s2=0;_s2<n;_s2+=2)if(t[_s2]!==e[_s2]||t[_s2+1]!==e[_s2+1])return!0;break;}}return!1;}},{key:"animationDraw",value:function(){var _animationDraw=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(){var _this97=this;var n,s,c,l,f,h,m,u,y,T,E,C,x,I,d,v,p,S,A,R,D,U,M,W,Y,B,N,G,J,tt,at,ut,K,Q,ft,gt,mt,wt,ht,Nt,e,t,r,_iterator65,_step65,_loop6;return _regeneratorRuntime().wrap(function _callee61$(_context64){while(1)switch(_context64.prev=_context64.next){case 0:this.animationId=void 0;e=!1;t={render:[]},r=/* @__PURE__ */new Map();_iterator65=_createForOfIteratorHelper(this.workShapes.entries());_context64.prev=4;_loop6=/*#__PURE__*/_regeneratorRuntime().mark(function _loop6(){var _step65$value,Rt,X,z,q,_z,_q,_z2,_q2,nt,j,_z3,_q3,_nt,_j2,Z,O,L,_O2,_z4,_q4,_nt2,_j3;return _regeneratorRuntime().wrap(function _loop6$(_context63){while(1)switch(_context63.prev=_context63.next){case 0:_step65$value=_slicedToArray(_step65.value,2),Rt=_step65$value[0],X=_step65$value[1];_context63.t0=X.toolsType;_context63.next=_context63.t0===Tt.Image?4:_context63.t0===Tt.Text?11:_context63.t0===Tt.Arrow?19:_context63.t0===Tt.Straight?19:_context63.t0===Tt.Rectangle?19:_context63.t0===Tt.Ellipse?19:_context63.t0===Tt.Star?19:_context63.t0===Tt.Polygon?19:_context63.t0===Tt.SpeechBalloon?19:_context63.t0===Tt.Pencil?22:38;break;case 4:z=X.oldRect;z&&((n=t.render)==null||n.push({rect:z,isClear:!0,clearCanvas:Ut.Bg,viewId:_this97.viewId}),(s=t.render)==null||s.push({rect:z,drawCanvas:Ut.Bg,viewId:_this97.viewId}));_context63.next=8;return(c=X.node)==null?void 0:c.consumeServiceAsync({isFullWork:!0,worker:_this97.thread});case 8:q=_context63.sent;_this97.selectorWorkShapes.forEach(function(nt,j){var Z;(Z=nt.selectIds)!=null&&Z.includes(Rt)&&(_this97.willRunEffectSelectorIds.add(j),_this97.noAnimationRect=Zt(_this97.noAnimationRect,z),_this97.noAnimationRect=Zt(_this97.noAnimationRect,q),_this97.runEffect());}),_this97.workShapes["delete"](Rt),(l=t.render)==null||l.push({rect:q,drawCanvas:Ut.Bg,viewId:_this97.viewId});return _context63.abrupt("break",38);case 11:if(!X.node){_context63.next=18;break;}_z=X.oldRect;_z&&((f=t.render)==null||f.push({rect:_z,isClear:!0,clearCanvas:Ut.Bg,viewId:_this97.viewId}),(h=t.render)==null||h.push({rect:_z,drawCanvas:Ut.Bg,viewId:_this97.viewId}));_context63.next=16;return X.node.consumeServiceAsync({isFullWork:!0,replaceId:Rt,boxRect:_this97.thread.getSceneRect()});case 16:_q=_context63.sent;_this97.selectorWorkShapes.forEach(function(nt,j){var Z;(Z=nt.selectIds)!=null&&Z.includes(Rt)&&(_this97.willRunEffectSelectorIds.add(j),_this97.noAnimationRect=Zt(_this97.noAnimationRect,_z),_this97.noAnimationRect=Zt(_this97.noAnimationRect,_q),_this97.runEffect());}),(m=X.node)==null||m.clearTmpPoints(),_this97.workShapes["delete"](Rt),(u=t.render)==null||u.push({rect:_q,drawCanvas:Ut.Bg,viewId:_this97.viewId});case 18:return _context63.abrupt("break",38);case 19:_z2=!!X.ops;if((y=X.animationWorkData)!=null&&y.length){_q2=X.oldRect,nt=X.node.oldRect;_q2&&((T=t.render)==null||T.push({rect:_q2,isClear:!0,clearCanvas:Ut.Bg,viewId:_this97.viewId}),(E=t.render)==null||E.push({rect:_q2,drawCanvas:Ut.Bg,viewId:_this97.viewId})),nt&&((C=t.render)==null||C.push({rect:nt,isClear:!0,clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId}));j=(x=X.node)==null?void 0:x.consumeService({op:X.animationWorkData,isFullWork:_z2});X.isEnableCursor?r.set(Rt,{workState:_q2?X.ops?te.Done:te.Doing:te.Start,op:X.animationWorkData.slice(-3,-1)}):_z2&&!X.useAnimation&&(I=X.updateNodeOpt)!=null&&I.useAnimation&&r.set(Rt,{workState:te.Done,op:X.animationWorkData.slice(-3,-1),uid:(d=X.updateNodeOpt)==null?void 0:d.uid}),_z2?(_this97.selectorWorkShapes.forEach(function(Z,O){var L;(L=Z.selectIds)!=null&&L.includes(Rt)&&(_this97.willRunEffectSelectorIds.add(O),_this97.noAnimationRect=Zt(_this97.noAnimationRect,_q2),_this97.noAnimationRect=Zt(_this97.noAnimationRect,nt),_this97.noAnimationRect=Zt(_this97.noAnimationRect,j),_this97.runEffect());}),(v=X.node)==null||v.clearTmpPoints(),_this97.workShapes["delete"](Rt),(p=t.render)==null||p.push({rect:j,drawCanvas:Ut.Bg,viewId:_this97.viewId})):(S=t.render)==null||S.push({rect:j,drawCanvas:Ut.ServiceFloat,workerType:_z2?void 0:Vt.Service,viewId:_this97.viewId}),X.animationWorkData.length=0;}return _context63.abrupt("break",38);case 22:if(!X.useAnimation){_context63.next=33;break;}if(!X.useAnimation){_context63.next=31;break;}if(!X.isDel){_context63.next=27;break;}(at=X.node)==null||at.clearTmpPoints(),_this97.workShapes["delete"](Rt);return _context63.abrupt("break",38);case 27:_z3=3,_q3=_this97.computNextAnimationIndex(X,_z3),_nt=X.isDiff?0:Math.max(0,(X.animationIndex||0)-_z3),_j2=(X.animationWorkData||[]).slice(0,_q3),Z=(K=(ut=X.node)==null?void 0:ut.getWorkId())==null?void 0:K.toString();if((X.animationIndex||0)<_q3||X.isDiff){O=(Q=X.node)==null?void 0:Q.consumeService({op:_j2,isFullWork:!1,replaceId:Z});if((ft=t.render)==null||ft.push({isClear:!0,rect:O,clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),(gt=t.render)==null||gt.push({rect:O,drawCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),X.animationIndex=_q3,X.isDiff&&(X.isDiff=!1),_j2.length&&X.isEnableCursor){L=_j2.slice(-3,-1);r.set(Rt,{workState:_nt===0?te.Start:_q3===((mt=X.animationWorkData)==null?void 0:mt.length)?te.Done:te.Doing,op:L});}}else if(X.ops){_O2=(wt=X.node)==null?void 0:wt.consumeService({op:X.animationWorkData||[],isFullWork:!0,replaceId:Z});X.isDel=!0,(ht=t.render)==null||ht.push({isClear:!0,rect:_O2,clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId},{rect:_O2,drawCanvas:Ut.ServiceFloat,viewId:_this97.viewId},{isClear:!0,rect:_O2,clearCanvas:Ut.Bg,viewId:_this97.viewId},{rect:_O2,drawCanvas:Ut.Bg,viewId:_this97.viewId}),X.isEnableCursor&&r.set(Rt,{workState:te.Done,op:_j2.slice(-3,-1)});}e=!0;return _context63.abrupt("break",38);case 31:_context63.next=37;break;case 33:_z4=!!X.ops;_q4=(A=X.node)==null?void 0:A.consumeService({op:X.animationWorkData||[],isFullWork:_z4,replaceId:Rt});_nt2=(R=X.node)==null?void 0:R.updataOptService(X.updateNodeOpt);if(_z4){if(_q4=Zt(_q4,_nt2),(D=t.render)==null||D.push({isClear:!0,rect:Zt(X.oldRect,_q4),clearCanvas:Ut.Bg,viewId:_this97.viewId}),(U=t.render)==null||U.push({rect:Zt(X.oldRect,_q4),drawCanvas:Ut.Bg,viewId:_this97.viewId}),(M=X.updateNodeOpt)!=null&&M.useAnimation&&((W=t.render)==null||W.push({isClear:!0,rect:Zt(X.oldRect,_q4),clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),(Y=t.render)==null||Y.push({rect:Zt(X.oldRect,_q4),drawCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),!X.isEnableCursor&&(B=X.animationWorkData)!=null&&B.length)){_j3=X.animationWorkData.slice(-3,-1);r.set(Rt,{workState:te.Done,op:_j3,uid:(N=X.updateNodeOpt)==null?void 0:N.uid});}_this97.selectorWorkShapes.forEach(function(j,Z){var O;(O=j.selectIds)!=null&&O.includes(Rt)&&(_this97.willRunEffectSelectorIds.add(Z),_this97.noAnimationRect=Zt(_this97.noAnimationRect,_q4),_this97.runEffect());}),(G=X.node)==null||G.clearTmpPoints(),_this97.workShapes["delete"](Rt);}else _q4=Zt(_q4,_nt2),(J=t.render)==null||J.push({isClear:!0,rect:Zt(X.oldRect,_q4),clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),(tt=t.render)==null||tt.push({rect:Zt(X.oldRect,_q4),drawCanvas:Ut.ServiceFloat,viewId:_this97.viewId});case 37:return _context63.abrupt("break",38);case 38:case"end":return _context63.stop();}},_loop6);});_iterator65.s();case 7:if((_step65=_iterator65.n()).done){_context64.next=11;break;}return _context64.delegateYield(_loop6(),"t0",9);case 9:_context64.next=7;break;case 11:_context64.next=16;break;case 13:_context64.prev=13;_context64.t1=_context64["catch"](4);_iterator65.e(_context64.t1);case 16:_context64.prev=16;_iterator65.f();return _context64.finish(16);case 19:e&&this.runAnimation();r.size&&(t.sp=[],r.forEach(function(Rt,X){var z;(z=t.sp)==null||z.push({type:xt.Cursor,uid:Rt.uid||X.split(mi)[0],op:Rt.op,workState:Rt.workState,viewId:_this97.viewId});}));_context64.t2=(Nt=t.render)!=null&&Nt.length;if(!_context64.t2){_context64.next=25;break;}_context64.next=25;return this.post(t);case 25:case"end":return _context64.stop();}},_callee61,this,[[4,13,16,19]]);}));function animationDraw(){return _animationDraw.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var _this98=this;this.animationId||(this.animationId=setTimeout(function(){_this98.animationId=void 0,_this98.animationDraw();},16));}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(e,t){var r=Math.floor((e.animationWorkData||[]).slice(e.animationIndex).length*48/t/this.syncUnitTime)*t;return Math.min((e.animationIndex||0)+(r||t),(e.animationWorkData||[]).length);}},{key:"runEffect",value:function runEffect(){this.runEffectId||(this.runEffectId=setTimeout(this.effectRunSelector.bind(this),0));}},{key:"effectRunSelector",value:function(){var _effectRunSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(){var _this99=this;var e;return _regeneratorRuntime().wrap(function _callee62$(_context65){while(1)switch(_context65.prev=_context65.next){case 0:this.runEffectId=void 0;e=this.noAnimationRect;this.willRunEffectSelectorIds.forEach(function(t){var s,c;var r=_this99.selectorWorkShapes.get(t),n=r&&r.selectIds&&((s=r.node)==null?void 0:s.selectServiceNode(t,r,!0));e=Zt(e,n),(c=r==null?void 0:r.selectIds)!=null&&c.length||_this99.selectorWorkShapes["delete"](t);});_context65.t0=e;if(!_context65.t0){_context65.next=7;break;}_context65.next=7;return this.post({render:[{rect:ve(e),isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:ve(e),drawCanvas:Ut.Bg,viewId:this.viewId}]});case 7:this.willRunEffectSelectorIds.clear();this.noAnimationRect=void 0;case 9:case"end":return _context65.stop();}},_callee62,this);}));function effectRunSelector(){return _effectRunSelector.apply(this,arguments);}return effectRunSelector;}()},{key:"activeSelectorShape",value:function activeSelectorShape(e){var m,u,y;var t=e.workId,r=e.opt,n=e.toolsType,s=e.type,c=e.selectIds,l=e.imageBitmap;if(!t)return;var f=t.toString();if(!((m=this.selectorWorkShapes)!=null&&m.has(f))){var T={toolsType:n,selectIds:c,type:s,opt:r,imageBitmap:l};n&&r&&(T=this.setNodeKey(f,T,n,r)),(u=this.selectorWorkShapes)==null||u.set(f,T);}var h=(y=this.selectorWorkShapes)==null?void 0:y.get(f);s&&(h.type=s),h.node&&h.node.getWorkId()!==f&&h.node.setWorkId(f),l&&(h.imageBitmap=l),h.selectIds=c||[];}}]);}();var $M=/*#__PURE__*/function(_bl2){function $M(t){var _this100;_classCallCheck(this,$M);_this100=_callSuper(this,$M,[t]);dt(_this100,"drawWorkActiveId");return _this100;}// async runFullWork(data: IWorkerMessage): Promise<IRectType | undefined> {
|
|
479
|
+
ln(Gt,bt)))&&It.push(Gt);return It;}function af(o){var g=o.length;return g?o[ma(0,g-1)]:t;}function Np(o,g){return Us(yr(o),Wn(g,0,o.length));}function Bp(o){return Us(yr(o));}function aa(o,g,b){(b!==t&&!jr(o[g],b)||b===t&&!(g in o))&&sn(o,g,b);}function Ni(o,g,b){var k=o[g];(!(Ne.call(o,g)&&jr(k,b))||b===t&&!(g in o))&&sn(o,g,b);}function Os(o,g){for(var b=o.length;b--;)if(jr(o[b][0],g))return b;return-1;}function Wp(o,g,b,k){return xn(o,function(et,lt,vt){g(k,et,b(et),vt);}),k;}function lf(o,g){return o&&Zr(g,rr(g),o);}function Fp(o,g){return o&&Zr(g,Sr(g),o);}function sn(o,g,b){g=="__proto__"&&Ps?Ps(o,g,{configurable:!0,enumerable:!0,value:b,writable:!0}):o[g]=b;}function la(o,g){for(var b=-1,k=g.length,et=Ft(k),lt=o==null;++b<k;)et[b]=lt?t:$a(o,g[b]);return et;}function Wn(o,g,b){return o===o&&(b!==t&&(o=o<=b?o:b),g!==t&&(o=o>=g?o:g)),o;}function Wr(o,g,b,k,et,lt){var vt,It=g&u,bt=g&y,Gt=g&T;if(b&&(vt=et?b(o,k,et,lt):b(o)),vt!==t)return vt;if(!Ve(o))return o;var Ht=pe(o);if(Ht){if(vt=O0(o),!It)return yr(o,vt);}else{var Kt=lr(o),_t=Kt==nt||Kt==j;if(On(o))return bf(o,It);if(Kt==$||Kt==wt||_t&&!et){if(vt=bt||_t?{}:Qf(o),!It)return bt?p0(o,Fp(vt,o)):d0(o,lf(vt,o));}else{if(!Ue[Kt])return et?o:{};vt=w0(o,Kt,It);}}lt||(lt=new $r());var re=lt.get(o);if(re)return re;lt.set(o,vt),wc(o)?o.forEach(function(ce){vt.add(Wr(ce,g,b,ce,o,lt));}):Ic(o)&&o.forEach(function(ce,Te){vt.set(Te,Wr(ce,g,b,Te,o,lt));});var fe=Gt?bt?Ea:Aa:bt?Sr:rr,Se=Ht?t:fe(o);return Dr(Se||o,function(ce,Te){Se&&(Te=ce,ce=o[Te]),Ni(vt,Te,Wr(ce,g,b,Te,o,lt));}),vt;}function Up(o){var g=rr(o);return function(b){return ff(b,o,g);};}function ff(o,g,b){var k=b.length;if(o==null)return!k;for(o=Be(o);k--;){var et=b[k],lt=g[et],vt=o[et];if(vt===t&&!(et in o)||!lt(vt))return!1;}return!0;}function cf(o,g,b){if(typeof o!="function")throw new Nr(c);return zi(function(){o.apply(t,b);},g);}function Bi(o,g,b,k){var et=-1,lt=ls,vt=!0,It=o.length,bt=[],Gt=g.length;if(!It)return bt;b&&(g=He(g,Ir(b))),k?(lt=Vo,vt=!1):g.length>=n&&(lt=Ei,vt=!1,g=new Bn(g));t:for(;++et<It;){var Ht=o[et],Kt=b==null?Ht:b(Ht);if(Ht=k||Ht!==0?Ht:0,vt&&Kt===Kt){for(var _t=Gt;_t--;)if(g[_t]===Kt)continue t;bt.push(Ht);}else lt(g,Kt,k)||bt.push(Ht);}return bt;}var xn=Ff(Vr),uf=Ff(ca,!0);function Yp(o,g){var b=!0;return xn(o,function(k,et,lt){return b=!!g(k,et,lt),b;}),b;}function ws(o,g,b){for(var k=-1,et=o.length;++k<et;){var lt=o[k],vt=g(lt);if(vt!=null&&(It===t?vt===vt&&!wr(vt):b(vt,It)))var It=vt,bt=lt;}return bt;}function Xp(o,g,b,k){var et=o.length;for(b=ye(b),b<0&&(b=-b>et?0:et+b),k=k===t||k>et?et:ye(k),k<0&&(k+=et),k=b>k?0:Ec(k);b<k;)o[b++]=g;return o;}function hf(o,g){var b=[];return xn(o,function(k,et,lt){g(k,et,lt)&&b.push(k);}),b;}function sr(o,g,b,k,et){var lt=-1,vt=o.length;for(b||(b=E0),et||(et=[]);++lt<vt;){var It=o[lt];g>0&&b(It)?g>1?sr(It,g-1,b,k,et):yn(et,It):k||(et[et.length]=It);}return et;}var fa=Uf(),df=Uf(!0);function Vr(o,g){return o&&fa(o,g,rr);}function ca(o,g){return o&&df(o,g,rr);}function As(o,g){return mn(g,function(b){return fn(o[b]);});}function Fn(o,g){g=Cn(g,o);for(var b=0,k=g.length;o!=null&&b<k;)o=o[Jr(g[b++])];return b&&b==k?o:t;}function pf(o,g,b){var k=g(o);return pe(o)?k:yn(k,b(o));}function ur(o){return o==null?o===t?Mt:L:Dn&&Dn in Be(o)?T0(o):B0(o);}function ua(o,g){return o>g;}function zp(o,g){return o!=null&&Ne.call(o,g);}function $p(o,g){return o!=null&&g in Be(o);}function jp(o,g,b){return o>=ar(g,b)&&o<tr(g,b);}function ha(o,g,b){for(var k=b?Vo:ls,et=o[0].length,lt=o.length,vt=lt,It=Ft(lt),bt=1/0,Gt=[];vt--;){var Ht=o[vt];vt&&g&&(Ht=He(Ht,Ir(g))),bt=ar(Ht.length,bt),It[vt]=!b&&(g||et>=120&&Ht.length>=120)?new Bn(vt&&Ht):t;}Ht=o[0];var Kt=-1,_t=It[0];t:for(;++Kt<et&&Gt.length<bt;){var re=Ht[Kt],fe=g?g(re):re;if(re=b||re!==0?re:0,!(_t?Ei(_t,fe):k(Gt,fe,b))){for(vt=lt;--vt;){var Se=It[vt];if(!(Se?Ei(Se,fe):k(o[vt],fe,b)))continue t;}_t&&_t.push(fe),Gt.push(re);}}return Gt;}function Gp(o,g,b,k){return Vr(o,function(et,lt,vt){g(k,b(et),lt,vt);}),k;}function Wi(o,g,b){g=Cn(g,o),o=ec(o,g);var k=o==null?o:o[Jr(Ur(g))];return k==null?t:Cr(k,o,b);}function vf(o){return Ze(o)&&ur(o)==wt;}function Hp(o){return Ze(o)&&ur(o)==Ot;}function kp(o){return Ze(o)&&ur(o)==X;}function Fi(o,g,b,k,et){return o===g?!0:o==null||g==null||!Ze(o)&&!Ze(g)?o!==o&&g!==g:Kp(o,g,b,k,Fi,et);}function Kp(o,g,b,k,et,lt){var vt=pe(o),It=pe(g),bt=vt?ht:lr(o),Gt=It?ht:lr(g);bt=bt==wt?$:bt,Gt=Gt==wt?$:Gt;var Ht=bt==$,Kt=Gt==$,_t=bt==Gt;if(_t&&On(o)){if(!On(g))return!1;vt=!0,Ht=!1;}if(_t&&!Ht)return lt||(lt=new $r()),vt||li(o)?Vf(o,g,b,k,et,lt):S0(o,g,bt,b,k,et,lt);if(!(b&E)){var re=Ht&&Ne.call(o,"__wrapped__"),fe=Kt&&Ne.call(g,"__wrapped__");if(re||fe){var Se=re?o.value():o,ce=fe?g.value():g;return lt||(lt=new $r()),et(Se,ce,b,k,lt);}}return _t?(lt||(lt=new $r()),x0(o,g,b,k,et,lt)):!1;}function Vp(o){return Ze(o)&&lr(o)==Z;}function da(o,g,b,k){var et=b.length,lt=et,vt=!k;if(o==null)return!lt;for(o=Be(o);et--;){var It=b[et];if(vt&&It[2]?It[1]!==o[It[0]]:!(It[0]in o))return!1;}for(;++et<lt;){It=b[et];var bt=It[0],Gt=o[bt],Ht=It[1];if(vt&&It[2]){if(Gt===t&&!(bt in o))return!1;}else{var Kt=new $r();if(k)var _t=k(Gt,Ht,bt,o,g,Kt);if(!(_t===t?Fi(Ht,Gt,E|C,k,Kt):_t))return!1;}}return!0;}function gf(o){if(!Ve(o)||L0(o))return!1;var g=fn(o)?Vd:bo;return g.test(Yn(o));}function Zp(o){return Ze(o)&&ur(o)==it;}function Jp(o){return Ze(o)&&lr(o)==ct;}function Qp(o){return Ze(o)&&Gs(o.length)&&!!ze[ur(o)];}function mf(o){return typeof o=="function"?o:o==null?xr:_typeof(o)=="object"?pe(o)?Sf(o[0],o[1]):Pf(o):Yc(o);}function pa(o){if(!Xi(o))return tp(o);var g=[];for(var b in Be(o))Ne.call(o,b)&&b!="constructor"&&g.push(b);return g;}function qp(o){if(!Ve(o))return N0(o);var g=Xi(o),b=[];for(var k in o)k=="constructor"&&(g||!Ne.call(o,k))||b.push(k);return b;}function va(o,g){return o<g;}function yf(o,g){var b=-1,k=Pr(o)?Ft(o.length):[];return xn(o,function(et,lt,vt){k[++b]=g(et,lt,vt);}),k;}function Pf(o){var g=La(o);return g.length==1&&g[0][2]?_f(g[0][0],g[0][1]):function(b){return b===o||da(b,o,g);};}function Sf(o,g){return ba(o)&&qf(g)?_f(Jr(o),g):function(b){var k=$a(b,o);return k===t&&k===g?ja(b,o):Fi(g,k,E|C);};}function Es(o,g,b,k,et){o!==g&&fa(g,function(lt,vt){if(et||(et=new $r()),Ve(lt))_p(o,g,vt,b,Es,k,et);else{var It=k?k(Na(o,vt),lt,vt+"",o,g,et):t;It===t&&(It=lt),aa(o,vt,It);}},Sr);}function _p(o,g,b,k,et,lt,vt){var It=Na(o,b),bt=Na(g,b),Gt=vt.get(bt);if(Gt){aa(o,b,Gt);return;}var Ht=lt?lt(It,bt,b+"",o,g,vt):t,Kt=Ht===t;if(Kt){var _t=pe(bt),re=!_t&&On(bt),fe=!_t&&!re&&li(bt);Ht=bt,_t||re||fe?pe(It)?Ht=It:Qe(It)?Ht=yr(It):re?(Kt=!1,Ht=bf(bt,!0)):fe?(Kt=!1,Ht=Df(bt,!0)):Ht=[]:$i(bt)||Xn(bt)?(Ht=It,Xn(It)?Ht=Mc(It):(!Ve(It)||fn(It))&&(Ht=Qf(bt))):Kt=!1;}Kt&&(vt.set(bt,Ht),et(Ht,bt,k,lt,vt),vt["delete"](bt)),aa(o,b,Ht);}function xf(o,g){var b=o.length;if(b)return g+=g<0?b:0,ln(g,b)?o[g]:t;}function Tf(o,g,b){g.length?g=He(g,function(lt){return pe(lt)?function(vt){return Fn(vt,lt.length===1?lt[0]:lt);}:lt;}):g=[xr];var k=-1;g=He(g,Ir(le()));var et=yf(o,function(lt,vt,It){var bt=He(g,function(Gt){return Gt(lt);});return{criteria:bt,index:++k,value:lt};});return wd(et,function(lt,vt){return h0(lt,vt,b);});}function t0(o,g){return Cf(o,g,function(b,k){return ja(o,k);});}function Cf(o,g,b){for(var k=-1,et=g.length,lt={};++k<et;){var vt=g[k],It=Fn(o,vt);b(It,vt)&&Ui(lt,Cn(vt,o),It);}return lt;}function e0(o){return function(g){return Fn(g,o);};}function ga(o,g,b,k){var et=k?Od:Qn,lt=-1,vt=g.length,It=o;for(o===g&&(g=yr(g)),b&&(It=He(o,Ir(b)));++lt<vt;)for(var bt=0,Gt=g[lt],Ht=b?b(Gt):Gt;(bt=et(It,Ht,bt,k))>-1;)It!==o&&ys.call(It,bt,1),ys.call(o,bt,1);return o;}function If(o,g){for(var b=o?g.length:0,k=b-1;b--;){var et=g[b];if(b==k||et!==lt){var lt=et;ln(et)?ys.call(o,et,1):Sa(o,et);}}return o;}function ma(o,g){return o+xs(nf()*(g-o+1));}function r0(o,g,b,k){for(var et=-1,lt=tr(Ss((g-o)/(b||1)),0),vt=Ft(lt);lt--;)vt[k?lt:++et]=o,o+=b;return vt;}function ya(o,g){var b="";if(!o||g<1||g>at)return b;do g%2&&(b+=o),g=xs(g/2),g&&(o+=o);while(g);return b;}function xe(o,g){return Ba(tc(o,g,xr),o+"");}function n0(o){return af(fi(o));}function i0(o,g){var b=fi(o);return Us(b,Wn(g,0,b.length));}function Ui(o,g,b,k){if(!Ve(o))return o;g=Cn(g,o);for(var et=-1,lt=g.length,vt=lt-1,It=o;It!=null&&++et<lt;){var bt=Jr(g[et]),Gt=b;if(bt==="__proto__"||bt==="constructor"||bt==="prototype")return o;if(et!=vt){var Ht=It[bt];Gt=k?k(Ht,bt,It):t,Gt===t&&(Gt=Ve(Ht)?Ht:ln(g[et+1])?[]:{});}Ni(It,bt,Gt),It=It[bt];}return o;}var Of=Ts?function(o,g){return Ts.set(o,g),o;}:xr,s0=Ps?function(o,g){return Ps(o,"toString",{configurable:!0,enumerable:!1,value:Ha(g),writable:!0});}:xr;function o0(o){return Us(fi(o));}function Fr(o,g,b){var k=-1,et=o.length;g<0&&(g=-g>et?0:et+g),b=b>et?et:b,b<0&&(b+=et),et=g>b?0:b-g>>>0,g>>>=0;for(var lt=Ft(et);++k<et;)lt[k]=o[k+g];return lt;}function a0(o,g){var b;return xn(o,function(k,et,lt){return b=g(k,et,lt),!b;}),!!b;}function Ms(o,g,b){var k=0,et=o==null?k:o.length;if(typeof g=="number"&&g===g&&et<=gt){for(;k<et;){var lt=k+et>>>1,vt=o[lt];vt!==null&&!wr(vt)&&(b?vt<=g:vt<g)?k=lt+1:et=lt;}return et;}return Pa(o,g,xr,b);}function Pa(o,g,b,k){var et=0,lt=o==null?0:o.length;if(lt===0)return 0;g=b(g);for(var vt=g!==g,It=g===null,bt=wr(g),Gt=g===t;et<lt;){var Ht=xs((et+lt)/2),Kt=b(o[Ht]),_t=Kt!==t,re=Kt===null,fe=Kt===Kt,Se=wr(Kt);if(vt)var ce=k||fe;else Gt?ce=fe&&(k||_t):It?ce=fe&&_t&&(k||!re):bt?ce=fe&&_t&&!re&&(k||!Se):re||Se?ce=!1:ce=k?Kt<=g:Kt<g;ce?et=Ht+1:lt=Ht;}return ar(lt,ft);}function wf(o,g){for(var b=-1,k=o.length,et=0,lt=[];++b<k;){var vt=o[b],It=g?g(vt):vt;if(!b||!jr(It,bt)){var bt=It;lt[et++]=vt===0?0:vt;}}return lt;}function Af(o){return typeof o=="number"?o:wr(o)?K:+o;}function Or(o){if(typeof o=="string")return o;if(pe(o))return He(o,Or)+"";if(wr(o))return sf?sf.call(o):"";var g=o+"";return g=="0"&&1/o==-tt?"-0":g;}function Tn(o,g,b){var k=-1,et=ls,lt=o.length,vt=!0,It=[],bt=It;if(b)vt=!1,et=Vo;else if(lt>=n){var Gt=g?null:y0(o);if(Gt)return cs(Gt);vt=!1,et=Ei,bt=new Bn();}else bt=g?[]:It;t:for(;++k<lt;){var Ht=o[k],Kt=g?g(Ht):Ht;if(Ht=b||Ht!==0?Ht:0,vt&&Kt===Kt){for(var _t=bt.length;_t--;)if(bt[_t]===Kt)continue t;g&&bt.push(Kt),It.push(Ht);}else et(bt,Kt,b)||(bt!==It&&bt.push(Kt),It.push(Ht));}return It;}function Sa(o,g){return g=Cn(g,o),o=ec(o,g),o==null||delete o[Jr(Ur(g))];}function Ef(o,g,b,k){return Ui(o,g,b(Fn(o,g)),k);}function Ls(o,g,b,k){for(var et=o.length,lt=k?et:-1;(k?lt--:++lt<et)&&g(o[lt],lt,o););return b?Fr(o,k?0:lt,k?lt+1:et):Fr(o,k?lt+1:0,k?et:lt);}function Mf(o,g){var b=o;return b instanceof Ce&&(b=b.value()),Zo(g,function(k,et){return et.func.apply(et.thisArg,yn([k],et.args));},b);}function xa(o,g,b){var k=o.length;if(k<2)return k?Tn(o[0]):[];for(var et=-1,lt=Ft(k);++et<k;)for(var vt=o[et],It=-1;++It<k;)It!=et&&(lt[et]=Bi(lt[et]||vt,o[It],g,b));return Tn(sr(lt,1),g,b);}function Lf(o,g,b){for(var k=-1,et=o.length,lt=g.length,vt={};++k<et;){var It=k<lt?g[k]:t;b(vt,o[k],It);}return vt;}function Ta(o){return Qe(o)?o:[];}function Ca(o){return typeof o=="function"?o:xr;}function Cn(o,g){return pe(o)?o:ba(o,g)?[o]:sc(Le(o));}var l0=xe;function In(o,g,b){var k=o.length;return b=b===t?k:b,!g&&b>=k?o:Fr(o,g,b);}var Rf=Zd||function(o){return ir.clearTimeout(o);};function bf(o,g){if(g)return o.slice();var b=o.length,k=ql?ql(b):new o.constructor(b);return o.copy(k),k;}function Ia(o){var g=new o.constructor(o.byteLength);return new gs(g).set(new gs(o)),g;}function f0(o,g){var b=g?Ia(o.buffer):o.buffer;return new o.constructor(b,o.byteOffset,o.byteLength);}function c0(o){var g=new o.constructor(o.source,_i.exec(o));return g.lastIndex=o.lastIndex,g;}function u0(o){return Di?Be(Di.call(o)):{};}function Df(o,g){var b=g?Ia(o.buffer):o.buffer;return new o.constructor(b,o.byteOffset,o.length);}function Nf(o,g){if(o!==g){var b=o!==t,k=o===null,et=o===o,lt=wr(o),vt=g!==t,It=g===null,bt=g===g,Gt=wr(g);if(!It&&!Gt&&!lt&&o>g||lt&&vt&&bt&&!It&&!Gt||k&&vt&&bt||!b&&bt||!et)return 1;if(!k&&!lt&&!Gt&&o<g||Gt&&b&&et&&!k&&!lt||It&&b&&et||!vt&&et||!bt)return-1;}return 0;}function h0(o,g,b){for(var k=-1,et=o.criteria,lt=g.criteria,vt=et.length,It=b.length;++k<vt;){var bt=Nf(et[k],lt[k]);if(bt){if(k>=It)return bt;var Gt=b[k];return bt*(Gt=="desc"?-1:1);}}return o.index-g.index;}function Bf(o,g,b,k){for(var et=-1,lt=o.length,vt=b.length,It=-1,bt=g.length,Gt=tr(lt-vt,0),Ht=Ft(bt+Gt),Kt=!k;++It<bt;)Ht[It]=g[It];for(;++et<vt;)(Kt||et<lt)&&(Ht[b[et]]=o[et]);for(;Gt--;)Ht[It++]=o[et++];return Ht;}function Wf(o,g,b,k){for(var et=-1,lt=o.length,vt=-1,It=b.length,bt=-1,Gt=g.length,Ht=tr(lt-It,0),Kt=Ft(Ht+Gt),_t=!k;++et<Ht;)Kt[et]=o[et];for(var re=et;++bt<Gt;)Kt[re+bt]=g[bt];for(;++vt<It;)(_t||et<lt)&&(Kt[re+b[vt]]=o[et++]);return Kt;}function yr(o,g){var b=-1,k=o.length;for(g||(g=Ft(k));++b<k;)g[b]=o[b];return g;}function Zr(o,g,b,k){var et=!b;b||(b={});for(var lt=-1,vt=g.length;++lt<vt;){var It=g[lt],bt=k?k(b[It],o[It],It,b,o):t;bt===t&&(bt=o[It]),et?sn(b,It,bt):Ni(b,It,bt);}return b;}function d0(o,g){return Zr(o,Ra(o),g);}function p0(o,g){return Zr(o,Zf(o),g);}function Rs(o,g){return function(b,k){var et=pe(b)?Pd:Wp,lt=g?g():{};return et(b,o,le(k,2),lt);};}function si(o){return xe(function(g,b){var k=-1,et=b.length,lt=et>1?b[et-1]:t,vt=et>2?b[2]:t;for(lt=o.length>3&&typeof lt=="function"?(et--,lt):t,vt&&hr(b[0],b[1],vt)&&(lt=et<3?t:lt,et=1),g=Be(g);++k<et;){var It=b[k];It&&o(g,It,k,lt);}return g;});}function Ff(o,g){return function(b,k){if(b==null)return b;if(!Pr(b))return o(b,k);for(var et=b.length,lt=g?et:-1,vt=Be(b);(g?lt--:++lt<et)&&k(vt[lt],lt,vt)!==!1;);return b;};}function Uf(o){return function(g,b,k){for(var et=-1,lt=Be(g),vt=k(g),It=vt.length;It--;){var bt=vt[o?It:++et];if(b(lt[bt],bt,lt)===!1)break;}return g;};}function v0(o,g,b){var k=g&x,et=Yi(o);function lt(){var vt=this&&this!==ir&&this instanceof lt?et:o;return vt.apply(k?b:this,arguments);}return lt;}function Yf(o){return function(g){g=Le(g);var b=qn(g)?zr(g):t,k=b?b[0]:g.charAt(0),et=b?In(b,1).join(""):g.slice(1);return k[o]()+et;};}function oi(o){return function(g){return Zo(Fc(Wc(g).replace(gn,"")),o,"");};}function Yi(o){return function(){var g=arguments;switch(g.length){case 0:return new o();case 1:return new o(g[0]);case 2:return new o(g[0],g[1]);case 3:return new o(g[0],g[1],g[2]);case 4:return new o(g[0],g[1],g[2],g[3]);case 5:return new o(g[0],g[1],g[2],g[3],g[4]);case 6:return new o(g[0],g[1],g[2],g[3],g[4],g[5]);case 7:return new o(g[0],g[1],g[2],g[3],g[4],g[5],g[6]);}var b=ii(o.prototype),k=o.apply(b,g);return Ve(k)?k:b;};}function g0(o,g,b){var k=Yi(o);function et(){for(var lt=arguments.length,vt=Ft(lt),It=lt,bt=ai(et);It--;)vt[It]=arguments[It];var Gt=lt<3&&vt[0]!==bt&&vt[lt-1]!==bt?[]:Pn(vt,bt);if(lt-=Gt.length,lt<b)return Gf(o,g,bs,et.placeholder,t,vt,Gt,t,t,b-lt);var Ht=this&&this!==ir&&this instanceof et?k:o;return Cr(Ht,this,vt);}return et;}function Xf(o){return function(g,b,k){var et=Be(g);if(!Pr(g)){var lt=le(b,3);g=rr(g),b=function b(It){return lt(et[It],It,et);};}var vt=o(g,b,k);return vt>-1?et[lt?g[vt]:vt]:t;};}function zf(o){return an(function(g){var b=g.length,k=b,et=Br.prototype.thru;for(o&&g.reverse();k--;){var lt=g[k];if(typeof lt!="function")throw new Nr(c);if(et&&!vt&&Ws(lt)=="wrapper")var vt=new Br([],!0);}for(k=vt?k:b;++k<b;){lt=g[k];var It=Ws(lt),bt=It=="wrapper"?Ma(lt):t;bt&&Da(bt[0])&&bt[1]==(R|v|S|D)&&!bt[4].length&&bt[9]==1?vt=vt[Ws(bt[0])].apply(vt,bt[3]):vt=lt.length==1&&Da(lt)?vt[It]():vt.thru(lt);}return function(){var Gt=arguments,Ht=Gt[0];if(vt&&Gt.length==1&&pe(Ht))return vt.plant(Ht).value();for(var Kt=0,_t=b?g[Kt].apply(this,Gt):Ht;++Kt<b;)_t=g[Kt].call(this,_t);return _t;};});}function bs(o,g,b,k,et,lt,vt,It,bt,Gt){var Ht=g&R,Kt=g&x,_t=g&I,re=g&(v|p),fe=g&U,Se=_t?t:Yi(o);function ce(){for(var Te=arguments.length,Oe=Ft(Te),Ar=Te;Ar--;)Oe[Ar]=arguments[Ar];if(re)var dr=ai(ce),Er=Ed(Oe,dr);if(k&&(Oe=Bf(Oe,k,et,re)),lt&&(Oe=Wf(Oe,lt,vt,re)),Te-=Er,re&&Te<Gt){var qe=Pn(Oe,dr);return Gf(o,g,bs,ce.placeholder,b,Oe,qe,It,bt,Gt-Te);}var Gr=Kt?b:this,un=_t?Gr[o]:o;return Te=Oe.length,It?Oe=W0(Oe,It):fe&&Te>1&&Oe.reverse(),Ht&&bt<Te&&(Oe.length=bt),this&&this!==ir&&this instanceof ce&&(un=Se||Yi(un)),un.apply(Gr,Oe);}return ce;}function $f(o,g){return function(b,k){return Gp(b,o,g(k),{});};}function Ds(o,g){return function(b,k){var et;if(b===t&&k===t)return g;if(b!==t&&(et=b),k!==t){if(et===t)return k;typeof b=="string"||typeof k=="string"?(b=Or(b),k=Or(k)):(b=Af(b),k=Af(k)),et=o(b,k);}return et;};}function Oa(o){return an(function(g){return g=He(g,Ir(le())),xe(function(b){var k=this;return o(g,function(et){return Cr(et,k,b);});});});}function Ns(o,g){g=g===t?" ":Or(g);var b=g.length;if(b<2)return b?ya(g,o):g;var k=ya(g,Ss(o/_n(g)));return qn(g)?In(zr(k),0,o).join(""):k.slice(0,o);}function m0(o,g,b,k){var et=g&x,lt=Yi(o);function vt(){for(var It=-1,bt=arguments.length,Gt=-1,Ht=k.length,Kt=Ft(Ht+bt),_t=this&&this!==ir&&this instanceof vt?lt:o;++Gt<Ht;)Kt[Gt]=k[Gt];for(;bt--;)Kt[Gt++]=arguments[++It];return Cr(_t,et?b:this,Kt);}return vt;}function jf(o){return function(g,b,k){return k&&typeof k!="number"&&hr(g,b,k)&&(b=k=t),g=cn(g),b===t?(b=g,g=0):b=cn(b),k=k===t?g<b?1:-1:cn(k),r0(g,b,k,o);};}function Bs(o){return function(g,b){return typeof g=="string"&&typeof b=="string"||(g=Yr(g),b=Yr(b)),o(g,b);};}function Gf(o,g,b,k,et,lt,vt,It,bt,Gt){var Ht=g&v,Kt=Ht?vt:t,_t=Ht?t:vt,re=Ht?lt:t,fe=Ht?t:lt;g|=Ht?S:A,g&=~(Ht?A:S),g&d||(g&=~(x|I));var Se=[o,g,et,re,Kt,fe,_t,It,bt,Gt],ce=b.apply(t,Se);return Da(o)&&rc(ce,Se),ce.placeholder=k,nc(ce,o,g);}function wa(o){var g=_e[o];return function(b,k){if(b=Yr(b),k=k==null?0:ar(ye(k),292),k&&rf(b)){var et=(Le(b)+"e").split("e"),lt=g(et[0]+"e"+(+et[1]+k));return et=(Le(lt)+"e").split("e"),+(et[0]+"e"+(+et[1]-k));}return g(b);};}var y0=ri&&1/cs(new ri([,-0]))[1]==tt?function(o){return new ri(o);}:Va;function Hf(o){return function(g){var b=lr(g);return b==Z?ra(g):b==ct?Bd(g):Ad(g,o(g));};}function on(o,g,b,k,et,lt,vt,It){var bt=g&I;if(!bt&&typeof o!="function")throw new Nr(c);var Gt=k?k.length:0;if(Gt||(g&=~(S|A),k=et=t),vt=vt===t?vt:tr(ye(vt),0),It=It===t?It:ye(It),Gt-=et?et.length:0,g&A){var Ht=k,Kt=et;k=et=t;}var _t=bt?t:Ma(o),re=[o,g,b,k,et,Ht,Kt,lt,vt,It];if(_t&&D0(re,_t),o=re[0],g=re[1],b=re[2],k=re[3],et=re[4],It=re[9]=re[9]===t?bt?0:o.length:tr(re[9]-Gt,0),!It&&g&(v|p)&&(g&=~(v|p)),!g||g==x)var fe=v0(o,g,b);else g==v||g==p?fe=g0(o,g,It):(g==S||g==(x|S))&&!et.length?fe=m0(o,g,b,k):fe=bs.apply(t,re);var Se=_t?Of:rc;return nc(Se(fe,re),o,g);}function kf(o,g,b,k){return o===t||jr(o,ei[b])&&!Ne.call(k,b)?g:o;}function Kf(o,g,b,k,et,lt){return Ve(o)&&Ve(g)&&(lt.set(g,o),Es(o,g,t,Kf,lt),lt["delete"](g)),o;}function P0(o){return $i(o)?t:o;}function Vf(o,g,b,k,et,lt){var vt=b&E,It=o.length,bt=g.length;if(It!=bt&&!(vt&&bt>It))return!1;var Gt=lt.get(o),Ht=lt.get(g);if(Gt&&Ht)return Gt==g&&Ht==o;var Kt=-1,_t=!0,re=b&C?new Bn():t;for(lt.set(o,g),lt.set(g,o);++Kt<It;){var fe=o[Kt],Se=g[Kt];if(k)var ce=vt?k(Se,fe,Kt,g,o,lt):k(fe,Se,Kt,o,g,lt);if(ce!==t){if(ce)continue;_t=!1;break;}if(re){if(!Jo(g,function(Te,Oe){if(!Ei(re,Oe)&&(fe===Te||et(fe,Te,b,k,lt)))return re.push(Oe);})){_t=!1;break;}}else if(!(fe===Se||et(fe,Se,b,k,lt))){_t=!1;break;}}return lt["delete"](o),lt["delete"](g),_t;}function S0(o,g,b,k,et,lt,vt){switch(b){case Lt:if(o.byteLength!=g.byteLength||o.byteOffset!=g.byteOffset)return!1;o=o.buffer,g=g.buffer;case Ot:return!(o.byteLength!=g.byteLength||!lt(new gs(o),new gs(g)));case Rt:case X:case O:return jr(+o,+g);case q:return o.name==g.name&&o.message==g.message;case it:case St:return o==g+"";case Z:var It=ra;case ct:var bt=k&E;if(It||(It=cs),o.size!=g.size&&!bt)return!1;var Gt=vt.get(o);if(Gt)return Gt==g;k|=C,vt.set(o,g);var Ht=Vf(It(o),It(g),k,et,lt,vt);return vt["delete"](o),Ht;case Ct:if(Di)return Di.call(o)==Di.call(g);}return!1;}function x0(o,g,b,k,et,lt){var vt=b&E,It=Aa(o),bt=It.length,Gt=Aa(g),Ht=Gt.length;if(bt!=Ht&&!vt)return!1;for(var Kt=bt;Kt--;){var _t=It[Kt];if(!(vt?_t in g:Ne.call(g,_t)))return!1;}var re=lt.get(o),fe=lt.get(g);if(re&&fe)return re==g&&fe==o;var Se=!0;lt.set(o,g),lt.set(g,o);for(var ce=vt;++Kt<bt;){_t=It[Kt];var Te=o[_t],Oe=g[_t];if(k)var Ar=vt?k(Oe,Te,_t,g,o,lt):k(Te,Oe,_t,o,g,lt);if(!(Ar===t?Te===Oe||et(Te,Oe,b,k,lt):Ar)){Se=!1;break;}ce||(ce=_t=="constructor");}if(Se&&!ce){var dr=o.constructor,Er=g.constructor;dr!=Er&&"constructor"in o&&"constructor"in g&&!(typeof dr=="function"&&dr instanceof dr&&typeof Er=="function"&&Er instanceof Er)&&(Se=!1);}return lt["delete"](o),lt["delete"](g),Se;}function an(o){return Ba(tc(o,t,fc),o+"");}function Aa(o){return pf(o,rr,Ra);}function Ea(o){return pf(o,Sr,Zf);}var Ma=Ts?function(o){return Ts.get(o);}:Va;function Ws(o){for(var g=o.name+"",b=ni[g],k=Ne.call(ni,g)?b.length:0;k--;){var et=b[k],lt=et.func;if(lt==null||lt==o)return et.name;}return g;}function ai(o){var g=Ne.call(ot,"placeholder")?ot:o;return g.placeholder;}function le(){var o=ot.iteratee||ka;return o=o===ka?mf:o,arguments.length?o(arguments[0],arguments[1]):o;}function Fs(o,g){var b=o.__data__;return M0(g)?b[typeof g=="string"?"string":"hash"]:b.map;}function La(o){for(var g=rr(o),b=g.length;b--;){var k=g[b],et=o[k];g[b]=[k,et,qf(et)];}return g;}function Un(o,g){var b=bd(o,g);return gf(b)?b:t;}function T0(o){var g=Ne.call(o,Dn),b=o[Dn];try{o[Dn]=t;var k=!0;}catch(_unused26){}var et=ps.call(o);return k&&(g?o[Dn]=b:delete o[Dn]),et;}var Ra=ia?function(o){return o==null?[]:(o=Be(o),mn(ia(o),function(g){return tf.call(o,g);}));}:Za,Zf=ia?function(o){for(var g=[];o;)yn(g,Ra(o)),o=ms(o);return g;}:Za,lr=ur;(sa&&lr(new sa(new ArrayBuffer(1)))!=Lt||Li&&lr(new Li())!=Z||oa&&lr(oa.resolve())!=V||ri&&lr(new ri())!=ct||Ri&&lr(new Ri())!=Dt)&&(lr=function lr(o){var g=ur(o),b=g==$?o.constructor:t,k=b?Yn(b):"";if(k)switch(k){case ip:return Lt;case sp:return Z;case op:return V;case ap:return ct;case lp:return Dt;}return g;});function C0(o,g,b){for(var k=-1,et=b.length;++k<et;){var lt=b[k],vt=lt.size;switch(lt.type){case"drop":o+=vt;break;case"dropRight":g-=vt;break;case"take":g=ar(g,o+vt);break;case"takeRight":o=tr(o,g-vt);break;}}return{start:o,end:g};}function I0(o){var g=o.match(wo);return g?g[1].split(Ao):[];}function Jf(o,g,b){g=Cn(g,o);for(var k=-1,et=g.length,lt=!1;++k<et;){var vt=Jr(g[k]);if(!(lt=o!=null&&b(o,vt)))break;o=o[vt];}return lt||++k!=et?lt:(et=o==null?0:o.length,!!et&&Gs(et)&&ln(vt,et)&&(pe(o)||Xn(o)));}function O0(o){var g=o.length,b=new o.constructor(g);return g&&typeof o[0]=="string"&&Ne.call(o,"index")&&(b.index=o.index,b.input=o.input),b;}function Qf(o){return typeof o.constructor=="function"&&!Xi(o)?ii(ms(o)):{};}function w0(o,g,b){var k=o.constructor;switch(g){case Ot:return Ia(o);case Rt:case X:return new k(+o);case Lt:return f0(o,b);case Yt:case zt:case Wt:case Qt:case ue:case ie:case ne:case ae:case se:return Df(o,b);case Z:return new k();case O:case St:return new k(o);case it:return c0(o);case ct:return new k();case Ct:return u0(o);}}function A0(o,g){var b=g.length;if(!b)return o;var k=b-1;return g[k]=(b>1?"& ":"")+g[k],g=g.join(b>2?", ":" "),o.replace(Oo,"{\n/* [wrapped with "+g+"] */\n");}function E0(o){return pe(o)||Xn(o)||!!(ef&&o&&o[ef]);}function ln(o,g){var _g2;var b=_typeof(o);return g=(_g2=g)!==null&&_g2!==void 0?_g2:at,!!g&&(b=="number"||b!="symbol"&&No.test(o))&&o>-1&&o%1==0&&o<g;}function hr(o,g,b){if(!Ve(b))return!1;var k=_typeof(g);return(k=="number"?Pr(b)&&ln(g,b.length):k=="string"&&g in b)?jr(b[g],o):!1;}function ba(o,g){if(pe(o))return!1;var b=_typeof(o);return b=="number"||b=="symbol"||b=="boolean"||o==null||wr(o)?!0:Hn.test(o)||!tn.test(o)||g!=null&&o in Be(g);}function M0(o){var g=_typeof(o);return g=="string"||g=="number"||g=="symbol"||g=="boolean"?o!=="__proto__":o===null;}function Da(o){var g=Ws(o),b=ot[g];if(typeof b!="function"||!(g in Ce.prototype))return!1;if(o===b)return!0;var k=Ma(b);return!!k&&o===k[0];}function L0(o){return!!Ql&&Ql in o;}var R0=hs?fn:Ja;function Xi(o){var g=o&&o.constructor,b=typeof g=="function"&&g.prototype||ei;return o===b;}function qf(o){return o===o&&!Ve(o);}function _f(o,g){return function(b){return b==null?!1:b[o]===g&&(g!==t||o in Be(b));};}function b0(o){var g=$s(o,function(k){return b.size===h&&b.clear(),k;}),b=g.cache;return g;}function D0(o,g){var b=o[1],k=g[1],et=b|k,lt=et<(x|I|R),vt=k==R&&b==v||k==R&&b==D&&o[7].length<=g[8]||k==(R|D)&&g[7].length<=g[8]&&b==v;if(!(lt||vt))return o;k&x&&(o[2]=g[2],et|=b&x?0:d);var It=g[3];if(It){var bt=o[3];o[3]=bt?Bf(bt,It,g[4]):It,o[4]=bt?Pn(o[3],m):g[4];}return It=g[5],It&&(bt=o[5],o[5]=bt?Wf(bt,It,g[6]):It,o[6]=bt?Pn(o[5],m):g[6]),It=g[7],It&&(o[7]=It),k&R&&(o[8]=o[8]==null?g[8]:ar(o[8],g[8])),o[9]==null&&(o[9]=g[9]),o[0]=g[0],o[1]=et,o;}function N0(o){var g=[];if(o!=null)for(var b in Be(o))g.push(b);return g;}function B0(o){return ps.call(o);}function tc(o,g,b){return g=tr(g===t?o.length-1:g,0),function(){for(var k=arguments,et=-1,lt=tr(k.length-g,0),vt=Ft(lt);++et<lt;)vt[et]=k[g+et];et=-1;for(var It=Ft(g+1);++et<g;)It[et]=k[et];return It[g]=b(vt),Cr(o,this,It);};}function ec(o,g){return g.length<2?o:Fn(o,Fr(g,0,-1));}function W0(o,g){for(var b=o.length,k=ar(g.length,b),et=yr(o);k--;){var lt=g[k];o[k]=ln(lt,b)?et[lt]:t;}return o;}function Na(o,g){if(!(g==="constructor"&&typeof o[g]=="function")&&g!="__proto__")return o[g];}var rc=ic(Of),zi=Qd||function(o,g){return ir.setTimeout(o,g);},Ba=ic(s0);function nc(o,g,b){var k=g+"";return Ba(o,A0(k,F0(I0(k),b)));}function ic(o){var g=0,b=0;return function(){var k=ep(),et=B-(k-b);if(b=k,et>0){if(++g>=Y)return arguments[0];}else g=0;return o.apply(t,arguments);};}function Us(o,g){var b=-1,k=o.length,et=k-1;for(g=g===t?k:g;++b<g;){var lt=ma(b,et),vt=o[lt];o[lt]=o[b],o[b]=vt;}return o.length=g,o;}var sc=b0(function(o){var g=[];return o.charCodeAt(0)===46&&g.push(""),o.replace(kn,function(b,k,et,lt){g.push(et?lt.replace(Lo,"$1"):k||b);}),g;});function Jr(o){if(typeof o=="string"||wr(o))return o;var g=o+"";return g=="0"&&1/o==-tt?"-0":g;}function Yn(o){if(o!=null){try{return ds.call(o);}catch(_unused27){}try{return o+"";}catch(_unused28){}}return"";}function F0(o,g){return Dr(mt,function(b){var k="_."+b[0];g&b[1]&&!ls(o,k)&&o.push(k);}),o.sort();}function oc(o){if(o instanceof Ce)return o.clone();var g=new Br(o.__wrapped__,o.__chain__);return g.__actions__=yr(o.__actions__),g.__index__=o.__index__,g.__values__=o.__values__,g;}function U0(o,g,b){(b?hr(o,g,b):g===t)?g=1:g=tr(ye(g),0);var k=o==null?0:o.length;if(!k||g<1)return[];for(var et=0,lt=0,vt=Ft(Ss(k/g));et<k;)vt[lt++]=Fr(o,et,et+=g);return vt;}function Y0(o){for(var g=-1,b=o==null?0:o.length,k=0,et=[];++g<b;){var lt=o[g];lt&&(et[k++]=lt);}return et;}function X0(){var o=arguments.length;if(!o)return[];for(var g=Ft(o-1),b=arguments[0],k=o;k--;)g[k-1]=arguments[k];return yn(pe(b)?yr(b):[b],sr(g,1));}var z0=xe(function(o,g){return Qe(o)?Bi(o,sr(g,1,Qe,!0)):[];}),$0=xe(function(o,g){var b=Ur(g);return Qe(b)&&(b=t),Qe(o)?Bi(o,sr(g,1,Qe,!0),le(b,2)):[];}),j0=xe(function(o,g){var b=Ur(g);return Qe(b)&&(b=t),Qe(o)?Bi(o,sr(g,1,Qe,!0),t,b):[];});function G0(o,g,b){var k=o==null?0:o.length;return k?(g=b||g===t?1:ye(g),Fr(o,g<0?0:g,k)):[];}function H0(o,g,b){var k=o==null?0:o.length;return k?(g=b||g===t?1:ye(g),g=k-g,Fr(o,0,g<0?0:g)):[];}function k0(o,g){return o&&o.length?Ls(o,le(g,3),!0,!0):[];}function K0(o,g){return o&&o.length?Ls(o,le(g,3),!0):[];}function V0(o,g,b,k){var et=o==null?0:o.length;return et?(b&&typeof b!="number"&&hr(o,g,b)&&(b=0,k=et),Xp(o,g,b,k)):[];}function ac(o,g,b){var k=o==null?0:o.length;if(!k)return-1;var et=b==null?0:ye(b);return et<0&&(et=tr(k+et,0)),fs(o,le(g,3),et);}function lc(o,g,b){var k=o==null?0:o.length;if(!k)return-1;var et=k-1;return b!==t&&(et=ye(b),et=b<0?tr(k+et,0):ar(et,k-1)),fs(o,le(g,3),et,!0);}function fc(o){var g=o==null?0:o.length;return g?sr(o,1):[];}function Z0(o){var g=o==null?0:o.length;return g?sr(o,tt):[];}function J0(o,g){var b=o==null?0:o.length;return b?(g=g===t?1:ye(g),sr(o,g)):[];}function Q0(o){for(var g=-1,b=o==null?0:o.length,k={};++g<b;){var et=o[g];k[et[0]]=et[1];}return k;}function cc(o){return o&&o.length?o[0]:t;}function q0(o,g,b){var k=o==null?0:o.length;if(!k)return-1;var et=b==null?0:ye(b);return et<0&&(et=tr(k+et,0)),Qn(o,g,et);}function _0(o){var g=o==null?0:o.length;return g?Fr(o,0,-1):[];}var tv=xe(function(o){var g=He(o,Ta);return g.length&&g[0]===o[0]?ha(g):[];}),ev=xe(function(o){var g=Ur(o),b=He(o,Ta);return g===Ur(b)?g=t:b.pop(),b.length&&b[0]===o[0]?ha(b,le(g,2)):[];}),rv=xe(function(o){var g=Ur(o),b=He(o,Ta);return g=typeof g=="function"?g:t,g&&b.pop(),b.length&&b[0]===o[0]?ha(b,t,g):[];});function nv(o,g){return o==null?"":_d.call(o,g);}function Ur(o){var g=o==null?0:o.length;return g?o[g-1]:t;}function iv(o,g,b){var k=o==null?0:o.length;if(!k)return-1;var et=k;return b!==t&&(et=ye(b),et=et<0?tr(k+et,0):ar(et,k-1)),g===g?Fd(o,g,et):fs(o,jl,et,!0);}function sv(o,g){return o&&o.length?xf(o,ye(g)):t;}var ov=xe(uc);function uc(o,g){return o&&o.length&&g&&g.length?ga(o,g):o;}function av(o,g,b){return o&&o.length&&g&&g.length?ga(o,g,le(b,2)):o;}function lv(o,g,b){return o&&o.length&&g&&g.length?ga(o,g,t,b):o;}var fv=an(function(o,g){var b=o==null?0:o.length,k=la(o,g);return If(o,He(g,function(et){return ln(et,b)?+et:et;}).sort(Nf)),k;});function cv(o,g){var b=[];if(!(o&&o.length))return b;var k=-1,et=[],lt=o.length;for(g=le(g,3);++k<lt;){var vt=o[k];g(vt,k,o)&&(b.push(vt),et.push(k));}return If(o,et),b;}function Wa(o){return o==null?o:np.call(o);}function uv(o,g,b){var k=o==null?0:o.length;return k?(b&&typeof b!="number"&&hr(o,g,b)?(g=0,b=k):(g=g==null?0:ye(g),b=b===t?k:ye(b)),Fr(o,g,b)):[];}function hv(o,g){return Ms(o,g);}function dv(o,g,b){return Pa(o,g,le(b,2));}function pv(o,g){var b=o==null?0:o.length;if(b){var k=Ms(o,g);if(k<b&&jr(o[k],g))return k;}return-1;}function vv(o,g){return Ms(o,g,!0);}function gv(o,g,b){return Pa(o,g,le(b,2),!0);}function mv(o,g){var b=o==null?0:o.length;if(b){var k=Ms(o,g,!0)-1;if(jr(o[k],g))return k;}return-1;}function yv(o){return o&&o.length?wf(o):[];}function Pv(o,g){return o&&o.length?wf(o,le(g,2)):[];}function Sv(o){var g=o==null?0:o.length;return g?Fr(o,1,g):[];}function xv(o,g,b){return o&&o.length?(g=b||g===t?1:ye(g),Fr(o,0,g<0?0:g)):[];}function Tv(o,g,b){var k=o==null?0:o.length;return k?(g=b||g===t?1:ye(g),g=k-g,Fr(o,g<0?0:g,k)):[];}function Cv(o,g){return o&&o.length?Ls(o,le(g,3),!1,!0):[];}function Iv(o,g){return o&&o.length?Ls(o,le(g,3)):[];}var Ov=xe(function(o){return Tn(sr(o,1,Qe,!0));}),wv=xe(function(o){var g=Ur(o);return Qe(g)&&(g=t),Tn(sr(o,1,Qe,!0),le(g,2));}),Av=xe(function(o){var g=Ur(o);return g=typeof g=="function"?g:t,Tn(sr(o,1,Qe,!0),t,g);});function Ev(o){return o&&o.length?Tn(o):[];}function Mv(o,g){return o&&o.length?Tn(o,le(g,2)):[];}function Lv(o,g){return g=typeof g=="function"?g:t,o&&o.length?Tn(o,t,g):[];}function Fa(o){if(!(o&&o.length))return[];var g=0;return o=mn(o,function(b){if(Qe(b))return g=tr(b.length,g),!0;}),ta(g,function(b){return He(o,Qo(b));});}function hc(o,g){if(!(o&&o.length))return[];var b=Fa(o);return g==null?b:He(b,function(k){return Cr(g,t,k);});}var Rv=xe(function(o,g){return Qe(o)?Bi(o,g):[];}),bv=xe(function(o){return xa(mn(o,Qe));}),Dv=xe(function(o){var g=Ur(o);return Qe(g)&&(g=t),xa(mn(o,Qe),le(g,2));}),Nv=xe(function(o){var g=Ur(o);return g=typeof g=="function"?g:t,xa(mn(o,Qe),t,g);}),Bv=xe(Fa);function Wv(o,g){return Lf(o||[],g||[],Ni);}function Fv(o,g){return Lf(o||[],g||[],Ui);}var Uv=xe(function(o){var g=o.length,b=g>1?o[g-1]:t;return b=typeof b=="function"?(o.pop(),b):t,hc(o,b);});function dc(o){var g=ot(o);return g.__chain__=!0,g;}function Yv(o,g){return g(o),o;}function Ys(o,g){return g(o);}var Xv=an(function(o){var g=o.length,b=g?o[0]:0,k=this.__wrapped__,et=function et(lt){return la(lt,o);};return g>1||this.__actions__.length||!(k instanceof Ce)||!ln(b)?this.thru(et):(k=k.slice(b,+b+(g?1:0)),k.__actions__.push({func:Ys,args:[et],thisArg:t}),new Br(k,this.__chain__).thru(function(lt){return g&&!lt.length&<.push(t),lt;}));});function zv(){return dc(this);}function $v(){return new Br(this.value(),this.__chain__);}function jv(){this.__values__===t&&(this.__values__=Ac(this.value()));var o=this.__index__>=this.__values__.length,g=o?t:this.__values__[this.__index__++];return{done:o,value:g};}function Gv(){return this;}function Hv(o){for(var g,b=this;b instanceof Is;){var k=oc(b);k.__index__=0,k.__values__=t,g?et.__wrapped__=k:g=k;var et=k;b=b.__wrapped__;}return et.__wrapped__=o,g;}function kv(){var o=this.__wrapped__;if(o instanceof Ce){var g=o;return this.__actions__.length&&(g=new Ce(this)),g=g.reverse(),g.__actions__.push({func:Ys,args:[Wa],thisArg:t}),new Br(g,this.__chain__);}return this.thru(Wa);}function Kv(){return Mf(this.__wrapped__,this.__actions__);}var Vv=Rs(function(o,g,b){Ne.call(o,b)?++o[b]:sn(o,b,1);});function Zv(o,g,b){var k=pe(o)?zl:Yp;return b&&hr(o,g,b)&&(g=t),k(o,le(g,3));}function Jv(o,g){var b=pe(o)?mn:hf;return b(o,le(g,3));}var Qv=Xf(ac),qv=Xf(lc);function _v(o,g){return sr(Xs(o,g),1);}function tg(o,g){return sr(Xs(o,g),tt);}function eg(o,g,b){return b=b===t?1:ye(b),sr(Xs(o,g),b);}function pc(o,g){var b=pe(o)?Dr:xn;return b(o,le(g,3));}function vc(o,g){var b=pe(o)?Sd:uf;return b(o,le(g,3));}var rg=Rs(function(o,g,b){Ne.call(o,b)?o[b].push(g):sn(o,b,[g]);});function ng(o,g,b,k){o=Pr(o)?o:fi(o),b=b&&!k?ye(b):0;var et=o.length;return b<0&&(b=tr(et+b,0)),Hs(o)?b<=et&&o.indexOf(g,b)>-1:!!et&&Qn(o,g,b)>-1;}var ig=xe(function(o,g,b){var k=-1,et=typeof g=="function",lt=Pr(o)?Ft(o.length):[];return xn(o,function(vt){lt[++k]=et?Cr(g,vt,b):Wi(vt,g,b);}),lt;}),sg=Rs(function(o,g,b){sn(o,b,g);});function Xs(o,g){var b=pe(o)?He:yf;return b(o,le(g,3));}function og(o,g,b,k){return o==null?[]:(pe(g)||(g=g==null?[]:[g]),b=k?t:b,pe(b)||(b=b==null?[]:[b]),Tf(o,g,b));}var ag=Rs(function(o,g,b){o[b?0:1].push(g);},function(){return[[],[]];});function lg(o,g,b){var k=pe(o)?Zo:Hl,et=arguments.length<3;return k(o,le(g,4),b,et,xn);}function fg(o,g,b){var k=pe(o)?xd:Hl,et=arguments.length<3;return k(o,le(g,4),b,et,uf);}function cg(o,g){var b=pe(o)?mn:hf;return b(o,js(le(g,3)));}function ug(o){var g=pe(o)?af:n0;return g(o);}function hg(o,g,b){(b?hr(o,g,b):g===t)?g=1:g=ye(g);var k=pe(o)?Np:i0;return k(o,g);}function dg(o){var g=pe(o)?Bp:o0;return g(o);}function pg(o){if(o==null)return 0;if(Pr(o))return Hs(o)?_n(o):o.length;var g=lr(o);return g==Z||g==ct?o.size:pa(o).length;}function vg(o,g,b){var k=pe(o)?Jo:a0;return b&&hr(o,g,b)&&(g=t),k(o,le(g,3));}var gg=xe(function(o,g){if(o==null)return[];var b=g.length;return b>1&&hr(o,g[0],g[1])?g=[]:b>2&&hr(g[0],g[1],g[2])&&(g=[g[0]]),Tf(o,sr(g,1),[]);}),zs=Jd||function(){return ir.Date.now();};function mg(o,g){if(typeof g!="function")throw new Nr(c);return o=ye(o),function(){if(--o<1)return g.apply(this,arguments);};}function gc(o,g,b){return g=b?t:g,g=o&&g==null?o.length:g,on(o,R,t,t,t,t,g);}function mc(o,g){var b;if(typeof g!="function")throw new Nr(c);return o=ye(o),function(){return--o>0&&(b=g.apply(this,arguments)),o<=1&&(g=t),b;};}var Ua=xe(function(o,g,b){var k=x;if(b.length){var et=Pn(b,ai(Ua));k|=S;}return on(o,k,g,b,et);}),yc=xe(function(o,g,b){var k=x|I;if(b.length){var et=Pn(b,ai(yc));k|=S;}return on(g,k,o,b,et);});function Pc(o,g,b){g=b?t:g;var k=on(o,v,t,t,t,t,t,g);return k.placeholder=Pc.placeholder,k;}function Sc(o,g,b){g=b?t:g;var k=on(o,p,t,t,t,t,t,g);return k.placeholder=Sc.placeholder,k;}function xc(o,g,b){var k,et,lt,vt,It,bt,Gt=0,Ht=!1,Kt=!1,_t=!0;if(typeof o!="function")throw new Nr(c);g=Yr(g)||0,Ve(b)&&(Ht=!!b.leading,Kt="maxWait"in b,lt=Kt?tr(Yr(b.maxWait)||0,g):lt,_t="trailing"in b?!!b.trailing:_t);function re(qe){var Gr=k,un=et;return k=et=t,Gt=qe,vt=o.apply(un,Gr),vt;}function fe(qe){return Gt=qe,It=zi(Te,g),Ht?re(qe):vt;}function Se(qe){var Gr=qe-bt,un=qe-Gt,Xc=g-Gr;return Kt?ar(Xc,lt-un):Xc;}function ce(qe){var Gr=qe-bt,un=qe-Gt;return bt===t||Gr>=g||Gr<0||Kt&&un>=lt;}function Te(){var qe=zs();if(ce(qe))return Oe(qe);It=zi(Te,Se(qe));}function Oe(qe){return It=t,_t&&k?re(qe):(k=et=t,vt);}function Ar(){It!==t&&Rf(It),Gt=0,k=bt=et=It=t;}function dr(){return It===t?vt:Oe(zs());}function Er(){var qe=zs(),Gr=ce(qe);if(k=arguments,et=this,bt=qe,Gr){if(It===t)return fe(bt);if(Kt)return Rf(It),It=zi(Te,g),re(bt);}return It===t&&(It=zi(Te,g)),vt;}return Er.cancel=Ar,Er.flush=dr,Er;}var yg=xe(function(o,g){return cf(o,1,g);}),Pg=xe(function(o,g,b){return cf(o,Yr(g)||0,b);});function Sg(o){return on(o,U);}function $s(o,g){if(typeof o!="function"||g!=null&&typeof g!="function")throw new Nr(c);var _b=function b(){var k=arguments,et=g?g.apply(this,k):k[0],lt=_b.cache;if(lt.has(et))return lt.get(et);var vt=o.apply(this,k);return _b.cache=lt.set(et,vt)||lt,vt;};return _b.cache=new($s.Cache||nn)(),_b;}$s.Cache=nn;function js(o){if(typeof o!="function")throw new Nr(c);return function(){var g=arguments;switch(g.length){case 0:return!o.call(this);case 1:return!o.call(this,g[0]);case 2:return!o.call(this,g[0],g[1]);case 3:return!o.call(this,g[0],g[1],g[2]);}return!o.apply(this,g);};}function xg(o){return mc(2,o);}var Tg=l0(function(o,g){g=g.length==1&&pe(g[0])?He(g[0],Ir(le())):He(sr(g,1),Ir(le()));var b=g.length;return xe(function(k){for(var et=-1,lt=ar(k.length,b);++et<lt;)k[et]=g[et].call(this,k[et]);return Cr(o,this,k);});}),Ya=xe(function(o,g){var b=Pn(g,ai(Ya));return on(o,S,t,g,b);}),Tc=xe(function(o,g){var b=Pn(g,ai(Tc));return on(o,A,t,g,b);}),Cg=an(function(o,g){return on(o,D,t,t,t,g);});function Ig(o,g){if(typeof o!="function")throw new Nr(c);return g=g===t?g:ye(g),xe(o,g);}function Og(o,g){if(typeof o!="function")throw new Nr(c);return g=g==null?0:tr(ye(g),0),xe(function(b){var k=b[g],et=In(b,0,g);return k&&yn(et,k),Cr(o,this,et);});}function wg(o,g,b){var k=!0,et=!0;if(typeof o!="function")throw new Nr(c);return Ve(b)&&(k="leading"in b?!!b.leading:k,et="trailing"in b?!!b.trailing:et),xc(o,g,{leading:k,maxWait:g,trailing:et});}function Ag(o){return gc(o,1);}function Eg(o,g){return Ya(Ca(g),o);}function Mg(){if(!arguments.length)return[];var o=arguments[0];return pe(o)?o:[o];}function Lg(o){return Wr(o,T);}function Rg(o,g){return g=typeof g=="function"?g:t,Wr(o,T,g);}function bg(o){return Wr(o,u|T);}function Dg(o,g){return g=typeof g=="function"?g:t,Wr(o,u|T,g);}function Ng(o,g){return g==null||ff(o,g,rr(g));}function jr(o,g){return o===g||o!==o&&g!==g;}var Bg=Bs(ua),Wg=Bs(function(o,g){return o>=g;}),Xn=vf(/* @__PURE__ */function(){return arguments;}())?vf:function(o){return Ze(o)&&Ne.call(o,"callee")&&!tf.call(o,"callee");},pe=Ft.isArray,Fg=Bl?Ir(Bl):Hp;function Pr(o){return o!=null&&Gs(o.length)&&!fn(o);}function Qe(o){return Ze(o)&&Pr(o);}function Ug(o){return o===!0||o===!1||Ze(o)&&ur(o)==Rt;}var On=qd||Ja,Yg=Wl?Ir(Wl):kp;function Xg(o){return Ze(o)&&o.nodeType===1&&!$i(o);}function zg(o){if(o==null)return!0;if(Pr(o)&&(pe(o)||typeof o=="string"||typeof o.splice=="function"||On(o)||li(o)||Xn(o)))return!o.length;var g=lr(o);if(g==Z||g==ct)return!o.size;if(Xi(o))return!pa(o).length;for(var b in o)if(Ne.call(o,b))return!1;return!0;}function $g(o,g){return Fi(o,g);}function jg(o,g,b){b=typeof b=="function"?b:t;var k=b?b(o,g):t;return k===t?Fi(o,g,t,b):!!k;}function Xa(o){if(!Ze(o))return!1;var g=ur(o);return g==q||g==z||typeof o.message=="string"&&typeof o.name=="string"&&!$i(o);}function Gg(o){return typeof o=="number"&&rf(o);}function fn(o){if(!Ve(o))return!1;var g=ur(o);return g==nt||g==j||g==Nt||g==rt;}function Cc(o){return typeof o=="number"&&o==ye(o);}function Gs(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=at;}function Ve(o){var g=_typeof(o);return o!=null&&(g=="object"||g=="function");}function Ze(o){return o!=null&&_typeof(o)=="object";}var Ic=Fl?Ir(Fl):Vp;function Hg(o,g){return o===g||da(o,g,La(g));}function kg(o,g,b){return b=typeof b=="function"?b:t,da(o,g,La(g),b);}function Kg(o){return Oc(o)&&o!=+o;}function Vg(o){if(R0(o))throw new de(s);return gf(o);}function Zg(o){return o===null;}function Jg(o){return o==null;}function Oc(o){return typeof o=="number"||Ze(o)&&ur(o)==O;}function $i(o){if(!Ze(o)||ur(o)!=$)return!1;var g=ms(o);if(g===null)return!0;var b=Ne.call(g,"constructor")&&g.constructor;return typeof b=="function"&&b instanceof b&&ds.call(b)==kd;}var za=Ul?Ir(Ul):Zp;function Qg(o){return Cc(o)&&o>=-at&&o<=at;}var wc=Yl?Ir(Yl):Jp;function Hs(o){return typeof o=="string"||!pe(o)&&Ze(o)&&ur(o)==St;}function wr(o){return _typeof(o)=="symbol"||Ze(o)&&ur(o)==Ct;}var li=Xl?Ir(Xl):Qp;function qg(o){return o===t;}function _g(o){return Ze(o)&&lr(o)==Dt;}function tm(o){return Ze(o)&&ur(o)==At;}var em=Bs(va),rm=Bs(function(o,g){return o<=g;});function Ac(o){if(!o)return[];if(Pr(o))return Hs(o)?zr(o):yr(o);if(Mi&&o[Mi])return Nd(o[Mi]());var g=lr(o),b=g==Z?ra:g==ct?cs:fi;return b(o);}function cn(o){if(!o)return o===0?o:0;if(o=Yr(o),o===tt||o===-tt){var g=o<0?-1:1;return g*ut;}return o===o?o:0;}function ye(o){var g=cn(o),b=g%1;return g===g?b?g-b:g:0;}function Ec(o){return o?Wn(ye(o),0,Q):0;}function Yr(o){if(typeof o=="number")return o;if(wr(o))return K;if(Ve(o)){var g=typeof o.valueOf=="function"?o.valueOf():o;o=Ve(g)?g+"":g;}if(typeof o!="string")return o===0?o:+o;o=kl(o);var b=ts.test(o);return b||Do.test(o)?md(o.slice(2),b?2:8):Rn.test(o)?K:+o;}function Mc(o){return Zr(o,Sr(o));}function nm(o){return o?Wn(ye(o),-at,at):o===0?o:0;}function Le(o){return o==null?"":Or(o);}var im=si(function(o,g){if(Xi(g)||Pr(g)){Zr(g,rr(g),o);return;}for(var b in g)Ne.call(g,b)&&Ni(o,b,g[b]);}),Lc=si(function(o,g){Zr(g,Sr(g),o);}),ks=si(function(o,g,b,k){Zr(g,Sr(g),o,k);}),sm=si(function(o,g,b,k){Zr(g,rr(g),o,k);}),om=an(la);function am(o,g){var b=ii(o);return g==null?b:lf(b,g);}var lm=xe(function(o,g){o=Be(o);var b=-1,k=g.length,et=k>2?g[2]:t;for(et&&hr(g[0],g[1],et)&&(k=1);++b<k;)for(var lt=g[b],vt=Sr(lt),It=-1,bt=vt.length;++It<bt;){var Gt=vt[It],Ht=o[Gt];(Ht===t||jr(Ht,ei[Gt])&&!Ne.call(o,Gt))&&(o[Gt]=lt[Gt]);}return o;}),fm=xe(function(o){return o.push(t,Kf),Cr(Rc,t,o);});function cm(o,g){return $l(o,le(g,3),Vr);}function um(o,g){return $l(o,le(g,3),ca);}function hm(o,g){return o==null?o:fa(o,le(g,3),Sr);}function dm(o,g){return o==null?o:df(o,le(g,3),Sr);}function pm(o,g){return o&&Vr(o,le(g,3));}function vm(o,g){return o&&ca(o,le(g,3));}function gm(o){return o==null?[]:As(o,rr(o));}function mm(o){return o==null?[]:As(o,Sr(o));}function $a(o,g,b){var k=o==null?t:Fn(o,g);return k===t?b:k;}function ym(o,g){return o!=null&&Jf(o,g,zp);}function ja(o,g){return o!=null&&Jf(o,g,$p);}var Pm=$f(function(o,g,b){g!=null&&typeof g.toString!="function"&&(g=ps.call(g)),o[g]=b;},Ha(xr)),Sm=$f(function(o,g,b){g!=null&&typeof g.toString!="function"&&(g=ps.call(g)),Ne.call(o,g)?o[g].push(b):o[g]=[b];},le),xm=xe(Wi);function rr(o){return Pr(o)?of(o):pa(o);}function Sr(o){return Pr(o)?of(o,!0):qp(o);}function Tm(o,g){var b={};return g=le(g,3),Vr(o,function(k,et,lt){sn(b,g(k,et,lt),k);}),b;}function Cm(o,g){var b={};return g=le(g,3),Vr(o,function(k,et,lt){sn(b,et,g(k,et,lt));}),b;}var Im=si(function(o,g,b){Es(o,g,b);}),Rc=si(function(o,g,b,k){Es(o,g,b,k);}),Om=an(function(o,g){var b={};if(o==null)return b;var k=!1;g=He(g,function(lt){return lt=Cn(lt,o),k||(k=lt.length>1),lt;}),Zr(o,Ea(o),b),k&&(b=Wr(b,u|y|T,P0));for(var et=g.length;et--;)Sa(b,g[et]);return b;});function wm(o,g){return bc(o,js(le(g)));}var Am=an(function(o,g){return o==null?{}:t0(o,g);});function bc(o,g){if(o==null)return{};var b=He(Ea(o),function(k){return[k];});return g=le(g),Cf(o,b,function(k,et){return g(k,et[0]);});}function Em(o,g,b){g=Cn(g,o);var k=-1,et=g.length;for(et||(et=1,o=t);++k<et;){var lt=o==null?t:o[Jr(g[k])];lt===t&&(k=et,lt=b),o=fn(lt)?lt.call(o):lt;}return o;}function Mm(o,g,b){return o==null?o:Ui(o,g,b);}function Lm(o,g,b,k){return k=typeof k=="function"?k:t,o==null?o:Ui(o,g,b,k);}var Dc=Hf(rr),Nc=Hf(Sr);function Rm(o,g,b){var k=pe(o),et=k||On(o)||li(o);if(g=le(g,4),b==null){var lt=o&&o.constructor;et?b=k?new lt():[]:Ve(o)?b=fn(lt)?ii(ms(o)):{}:b={};}return(et?Dr:Vr)(o,function(vt,It,bt){return g(b,vt,It,bt);}),b;}function bm(o,g){return o==null?!0:Sa(o,g);}function Dm(o,g,b){return o==null?o:Ef(o,g,Ca(b));}function Nm(o,g,b,k){return k=typeof k=="function"?k:t,o==null?o:Ef(o,g,Ca(b),k);}function fi(o){return o==null?[]:ea(o,rr(o));}function Bm(o){return o==null?[]:ea(o,Sr(o));}function Wm(o,g,b){return b===t&&(b=g,g=t),b!==t&&(b=Yr(b),b=b===b?b:0),g!==t&&(g=Yr(g),g=g===g?g:0),Wn(Yr(o),g,b);}function Fm(o,g,b){return g=cn(g),b===t?(b=g,g=0):b=cn(b),o=Yr(o),jp(o,g,b);}function Um(o,g,b){if(b&&typeof b!="boolean"&&hr(o,g,b)&&(g=b=t),b===t&&(typeof g=="boolean"?(b=g,g=t):typeof o=="boolean"&&(b=o,o=t)),o===t&&g===t?(o=0,g=1):(o=cn(o),g===t?(g=o,o=0):g=cn(g)),o>g){var k=o;o=g,g=k;}if(b||o%1||g%1){var et=nf();return ar(o+et*(g-o+gd("1e-"+((et+"").length-1))),g);}return ma(o,g);}var Ym=oi(function(o,g,b){return g=g.toLowerCase(),o+(b?Bc(g):g);});function Bc(o){return Ga(Le(o).toLowerCase());}function Wc(o){return o=Le(o),o&&o.replace(Bo,Md).replace(od,"");}function Xm(o,g,b){o=Le(o),g=Or(g);var k=o.length;b=b===t?k:Wn(ye(b),0,k);var et=b;return b-=g.length,b>=0&&o.slice(b,et)==g;}function zm(o){return o=Le(o),o&&Je.test(o)?o.replace(Ge,Ld):o;}function $m(o){return o=Le(o),o&&Co.test(o)?o.replace(wi,"\\$&"):o;}var jm=oi(function(o,g,b){return o+(b?"-":"")+g.toLowerCase();}),Gm=oi(function(o,g,b){return o+(b?" ":"")+g.toLowerCase();}),Hm=Yf("toLowerCase");function km(o,g,b){o=Le(o),g=ye(g);var k=g?_n(o):0;if(!g||k>=g)return o;var et=(g-k)/2;return Ns(xs(et),b)+o+Ns(Ss(et),b);}function Km(o,g,b){o=Le(o),g=ye(g);var k=g?_n(o):0;return g&&k<g?o+Ns(g-k,b):o;}function Vm(o,g,b){o=Le(o),g=ye(g);var k=g?_n(o):0;return g&&k<g?Ns(g-k,b)+o:o;}function Zm(o,g,b){return b||g==null?g=0:g&&(g=+g),rp(Le(o).replace(Ai,""),g||0);}function Jm(o,g,b){return(b?hr(o,g,b):g===t)?g=1:g=ye(g),ya(Le(o),g);}function Qm(){var o=arguments,g=Le(o[0]);return o.length<3?g:g.replace(o[1],o[2]);}var qm=oi(function(o,g,b){return o+(b?"_":"")+g.toLowerCase();});function _m(o,g,b){return b&&typeof b!="number"&&hr(o,g,b)&&(g=b=t),b=b===t?Q:b>>>0,b?(o=Le(o),o&&(typeof g=="string"||g!=null&&!za(g))&&(g=Or(g),!g&&qn(o))?In(zr(o),0,b):o.split(g,b)):[];}var ty=oi(function(o,g,b){return o+(b?" ":"")+Ga(g);});function ey(o,g,b){return o=Le(o),b=b==null?0:Wn(ye(b),0,o.length),g=Or(g),o.slice(b,b+g.length)==g;}function ry(o,g,b){var k=ot.templateSettings;b&&hr(o,g,b)&&(g=t),o=Le(o),g=ks({},g,k,kf);var et=ks({},g.imports,k.imports,kf),lt=rr(et),vt=ea(et,lt),It,bt,Gt=0,Ht=g.interpolate||Kn,Kt="__p += '",_t=na((g.escape||Kn).source+"|"+Ht.source+"|"+(Ht===Kr?Ro:Kn).source+"|"+(g.evaluate||Kn).source+"|$","g"),re="//# sourceURL="+(Ne.call(g,"sourceURL")?(g.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ud+"]")+"\n";o.replace(_t,function(ce,Te,Oe,Ar,dr,Er){return Oe||(Oe=Ar),Kt+=o.slice(Gt,Er).replace(vn,Rd),Te&&(It=!0,Kt+="' +\n__e("+Te+") +\n'"),dr&&(bt=!0,Kt+="';\n"+dr+";\n__p += '"),Oe&&(Kt+="' +\n((__t = ("+Oe+")) == null ? '' : __t) +\n'"),Gt=Er+ce.length,ce;}),Kt+="';\n";var fe=Ne.call(g,"variable")&&g.variable;if(!fe)Kt="with (obj) {\n"+Kt+"\n}\n";else if(Mo.test(fe))throw new de(l);Kt=(bt?Kt.replace(je,""):Kt).replace(We,"$1").replace(Xe,"$1;"),Kt="function("+(fe||"obj")+") {\n"+(fe?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(It?", __e = _.escape":"")+(bt?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+Kt+"return __p\n}";var Se=Uc(function(){return Ee(lt,re+"return "+Kt).apply(t,vt);});if(Se.source=Kt,Xa(Se))throw Se;return Se;}function ny(o){return Le(o).toLowerCase();}function iy(o){return Le(o).toUpperCase();}function sy(o,g,b){if(o=Le(o),o&&(b||g===t))return kl(o);if(!o||!(g=Or(g)))return o;var k=zr(o),et=zr(g),lt=Kl(k,et),vt=Vl(k,et)+1;return In(k,lt,vt).join("");}function oy(o,g,b){if(o=Le(o),o&&(b||g===t))return o.slice(0,Jl(o)+1);if(!o||!(g=Or(g)))return o;var k=zr(o),et=Vl(k,zr(g))+1;return In(k,0,et).join("");}function ay(o,g,b){if(o=Le(o),o&&(b||g===t))return o.replace(Ai,"");if(!o||!(g=Or(g)))return o;var k=zr(o),et=Kl(k,zr(g));return In(k,et).join("");}function ly(o,g){var b=M,k=W;if(Ve(g)){var et="separator"in g?g.separator:et;b="length"in g?ye(g.length):b,k="omission"in g?Or(g.omission):k;}o=Le(o);var lt=o.length;if(qn(o)){var vt=zr(o);lt=vt.length;}if(b>=lt)return o;var It=b-_n(k);if(It<1)return k;var bt=vt?In(vt,0,It).join(""):o.slice(0,It);if(et===t)return bt+k;if(vt&&(It+=bt.length-It),za(et)){if(o.slice(It).search(et)){var Gt,Ht=bt;for(et.global||(et=na(et.source,Le(_i.exec(et))+"g")),et.lastIndex=0;Gt=et.exec(Ht);)var Kt=Gt.index;bt=bt.slice(0,Kt===t?It:Kt);}}else if(o.indexOf(Or(et),It)!=It){var _t=bt.lastIndexOf(et);_t>-1&&(bt=bt.slice(0,_t));}return bt+k;}function fy(o){return o=Le(o),o&&Ke.test(o)?o.replace(Fe,Ud):o;}var cy=oi(function(o,g,b){return o+(b?" ":"")+g.toUpperCase();}),Ga=Yf("toUpperCase");function Fc(o,g,b){return o=Le(o),g=b?t:g,g===t?Dd(o)?zd(o):Id(o):o.match(g)||[];}var Uc=xe(function(o,g){try{return Cr(o,t,g);}catch(b){return Xa(b)?b:new de(b);}}),uy=an(function(o,g){return Dr(g,function(b){b=Jr(b),sn(o,b,Ua(o[b],o));}),o;});function hy(o){var g=o==null?0:o.length,b=le();return o=g?He(o,function(k){if(typeof k[1]!="function")throw new Nr(c);return[b(k[0]),k[1]];}):[],xe(function(k){for(var et=-1;++et<g;){var lt=o[et];if(Cr(lt[0],this,k))return Cr(lt[1],this,k);}});}function dy(o){return Up(Wr(o,u));}function Ha(o){return function(){return o;};}function py(o,g){return o==null||o!==o?g:o;}var vy=zf(),gy=zf(!0);function xr(o){return o;}function ka(o){return mf(typeof o=="function"?o:Wr(o,u));}function my(o){return Pf(Wr(o,u));}function yy(o,g){return Sf(o,Wr(g,u));}var Py=xe(function(o,g){return function(b){return Wi(b,o,g);};}),Sy=xe(function(o,g){return function(b){return Wi(o,b,g);};});function Ka(o,g,b){var k=rr(g),et=As(g,k);b==null&&!(Ve(g)&&(et.length||!k.length))&&(b=g,g=o,o=this,et=As(g,rr(g)));var lt=!(Ve(b)&&"chain"in b)||!!b.chain,vt=fn(o);return Dr(et,function(It){var bt=g[It];o[It]=bt,vt&&(o.prototype[It]=function(){var Gt=this.__chain__;if(lt||Gt){var Ht=o(this.__wrapped__),Kt=Ht.__actions__=yr(this.__actions__);return Kt.push({func:bt,args:arguments,thisArg:o}),Ht.__chain__=Gt,Ht;}return bt.apply(o,yn([this.value()],arguments));});}),o;}function xy(){return ir._===this&&(ir._=Kd),this;}function Va(){}function Ty(o){return o=ye(o),xe(function(g){return xf(g,o);});}var Cy=Oa(He),Iy=Oa(zl),Oy=Oa(Jo);function Yc(o){return ba(o)?Qo(Jr(o)):e0(o);}function wy(o){return function(g){return o==null?t:Fn(o,g);};}var Ay=jf(),Ey=jf(!0);function Za(){return[];}function Ja(){return!1;}function My(){return{};}function Ly(){return"";}function Ry(){return!0;}function by(o,g){if(o=ye(o),o<1||o>at)return[];var b=Q,k=ar(o,Q);g=le(g),o-=Q;for(var et=ta(k,g);++b<o;)g(b);return et;}function Dy(o){return pe(o)?He(o,Jr):wr(o)?[o]:yr(sc(Le(o)));}function Ny(o){var g=++Hd;return Le(o)+g;}var By=Ds(function(o,g){return o+g;},0),Wy=wa("ceil"),Fy=Ds(function(o,g){return o/g;},1),Uy=wa("floor");function Yy(o){return o&&o.length?ws(o,xr,ua):t;}function Xy(o,g){return o&&o.length?ws(o,le(g,2),ua):t;}function zy(o){return Gl(o,xr);}function $y(o,g){return Gl(o,le(g,2));}function jy(o){return o&&o.length?ws(o,xr,va):t;}function Gy(o,g){return o&&o.length?ws(o,le(g,2),va):t;}var Hy=Ds(function(o,g){return o*g;},1),ky=wa("round"),Ky=Ds(function(o,g){return o-g;},0);function Vy(o){return o&&o.length?_o(o,xr):0;}function Zy(o,g){return o&&o.length?_o(o,le(g,2)):0;}return ot.after=mg,ot.ary=gc,ot.assign=im,ot.assignIn=Lc,ot.assignInWith=ks,ot.assignWith=sm,ot.at=om,ot.before=mc,ot.bind=Ua,ot.bindAll=uy,ot.bindKey=yc,ot.castArray=Mg,ot.chain=dc,ot.chunk=U0,ot.compact=Y0,ot.concat=X0,ot.cond=hy,ot.conforms=dy,ot.constant=Ha,ot.countBy=Vv,ot.create=am,ot.curry=Pc,ot.curryRight=Sc,ot.debounce=xc,ot.defaults=lm,ot.defaultsDeep=fm,ot.defer=yg,ot.delay=Pg,ot.difference=z0,ot.differenceBy=$0,ot.differenceWith=j0,ot.drop=G0,ot.dropRight=H0,ot.dropRightWhile=k0,ot.dropWhile=K0,ot.fill=V0,ot.filter=Jv,ot.flatMap=_v,ot.flatMapDeep=tg,ot.flatMapDepth=eg,ot.flatten=fc,ot.flattenDeep=Z0,ot.flattenDepth=J0,ot.flip=Sg,ot.flow=vy,ot.flowRight=gy,ot.fromPairs=Q0,ot.functions=gm,ot.functionsIn=mm,ot.groupBy=rg,ot.initial=_0,ot.intersection=tv,ot.intersectionBy=ev,ot.intersectionWith=rv,ot.invert=Pm,ot.invertBy=Sm,ot.invokeMap=ig,ot.iteratee=ka,ot.keyBy=sg,ot.keys=rr,ot.keysIn=Sr,ot.map=Xs,ot.mapKeys=Tm,ot.mapValues=Cm,ot.matches=my,ot.matchesProperty=yy,ot.memoize=$s,ot.merge=Im,ot.mergeWith=Rc,ot.method=Py,ot.methodOf=Sy,ot.mixin=Ka,ot.negate=js,ot.nthArg=Ty,ot.omit=Om,ot.omitBy=wm,ot.once=xg,ot.orderBy=og,ot.over=Cy,ot.overArgs=Tg,ot.overEvery=Iy,ot.overSome=Oy,ot.partial=Ya,ot.partialRight=Tc,ot.partition=ag,ot.pick=Am,ot.pickBy=bc,ot.property=Yc,ot.propertyOf=wy,ot.pull=ov,ot.pullAll=uc,ot.pullAllBy=av,ot.pullAllWith=lv,ot.pullAt=fv,ot.range=Ay,ot.rangeRight=Ey,ot.rearg=Cg,ot.reject=cg,ot.remove=cv,ot.rest=Ig,ot.reverse=Wa,ot.sampleSize=hg,ot.set=Mm,ot.setWith=Lm,ot.shuffle=dg,ot.slice=uv,ot.sortBy=gg,ot.sortedUniq=yv,ot.sortedUniqBy=Pv,ot.split=_m,ot.spread=Og,ot.tail=Sv,ot.take=xv,ot.takeRight=Tv,ot.takeRightWhile=Cv,ot.takeWhile=Iv,ot.tap=Yv,ot.throttle=wg,ot.thru=Ys,ot.toArray=Ac,ot.toPairs=Dc,ot.toPairsIn=Nc,ot.toPath=Dy,ot.toPlainObject=Mc,ot.transform=Rm,ot.unary=Ag,ot.union=Ov,ot.unionBy=wv,ot.unionWith=Av,ot.uniq=Ev,ot.uniqBy=Mv,ot.uniqWith=Lv,ot.unset=bm,ot.unzip=Fa,ot.unzipWith=hc,ot.update=Dm,ot.updateWith=Nm,ot.values=fi,ot.valuesIn=Bm,ot.without=Rv,ot.words=Fc,ot.wrap=Eg,ot.xor=bv,ot.xorBy=Dv,ot.xorWith=Nv,ot.zip=Bv,ot.zipObject=Wv,ot.zipObjectDeep=Fv,ot.zipWith=Uv,ot.entries=Dc,ot.entriesIn=Nc,ot.extend=Lc,ot.extendWith=ks,Ka(ot,ot),ot.add=By,ot.attempt=Uc,ot.camelCase=Ym,ot.capitalize=Bc,ot.ceil=Wy,ot.clamp=Wm,ot.clone=Lg,ot.cloneDeep=bg,ot.cloneDeepWith=Dg,ot.cloneWith=Rg,ot.conformsTo=Ng,ot.deburr=Wc,ot.defaultTo=py,ot.divide=Fy,ot.endsWith=Xm,ot.eq=jr,ot.escape=zm,ot.escapeRegExp=$m,ot.every=Zv,ot.find=Qv,ot.findIndex=ac,ot.findKey=cm,ot.findLast=qv,ot.findLastIndex=lc,ot.findLastKey=um,ot.floor=Uy,ot.forEach=pc,ot.forEachRight=vc,ot.forIn=hm,ot.forInRight=dm,ot.forOwn=pm,ot.forOwnRight=vm,ot.get=$a,ot.gt=Bg,ot.gte=Wg,ot.has=ym,ot.hasIn=ja,ot.head=cc,ot.identity=xr,ot.includes=ng,ot.indexOf=q0,ot.inRange=Fm,ot.invoke=xm,ot.isArguments=Xn,ot.isArray=pe,ot.isArrayBuffer=Fg,ot.isArrayLike=Pr,ot.isArrayLikeObject=Qe,ot.isBoolean=Ug,ot.isBuffer=On,ot.isDate=Yg,ot.isElement=Xg,ot.isEmpty=zg,ot.isEqual=$g,ot.isEqualWith=jg,ot.isError=Xa,ot.isFinite=Gg,ot.isFunction=fn,ot.isInteger=Cc,ot.isLength=Gs,ot.isMap=Ic,ot.isMatch=Hg,ot.isMatchWith=kg,ot.isNaN=Kg,ot.isNative=Vg,ot.isNil=Jg,ot.isNull=Zg,ot.isNumber=Oc,ot.isObject=Ve,ot.isObjectLike=Ze,ot.isPlainObject=$i,ot.isRegExp=za,ot.isSafeInteger=Qg,ot.isSet=wc,ot.isString=Hs,ot.isSymbol=wr,ot.isTypedArray=li,ot.isUndefined=qg,ot.isWeakMap=_g,ot.isWeakSet=tm,ot.join=nv,ot.kebabCase=jm,ot.last=Ur,ot.lastIndexOf=iv,ot.lowerCase=Gm,ot.lowerFirst=Hm,ot.lt=em,ot.lte=rm,ot.max=Yy,ot.maxBy=Xy,ot.mean=zy,ot.meanBy=$y,ot.min=jy,ot.minBy=Gy,ot.stubArray=Za,ot.stubFalse=Ja,ot.stubObject=My,ot.stubString=Ly,ot.stubTrue=Ry,ot.multiply=Hy,ot.nth=sv,ot.noConflict=xy,ot.noop=Va,ot.now=zs,ot.pad=km,ot.padEnd=Km,ot.padStart=Vm,ot.parseInt=Zm,ot.random=Um,ot.reduce=lg,ot.reduceRight=fg,ot.repeat=Jm,ot.replace=Qm,ot.result=Em,ot.round=ky,ot.runInContext=Et,ot.sample=ug,ot.size=pg,ot.snakeCase=qm,ot.some=vg,ot.sortedIndex=hv,ot.sortedIndexBy=dv,ot.sortedIndexOf=pv,ot.sortedLastIndex=vv,ot.sortedLastIndexBy=gv,ot.sortedLastIndexOf=mv,ot.startCase=ty,ot.startsWith=ey,ot.subtract=Ky,ot.sum=Vy,ot.sumBy=Zy,ot.template=ry,ot.times=by,ot.toFinite=cn,ot.toInteger=ye,ot.toLength=Ec,ot.toLower=ny,ot.toNumber=Yr,ot.toSafeInteger=nm,ot.toString=Le,ot.toUpper=iy,ot.trim=sy,ot.trimEnd=oy,ot.trimStart=ay,ot.truncate=ly,ot.unescape=fy,ot.uniqueId=Ny,ot.upperCase=cy,ot.upperFirst=Ga,ot.each=pc,ot.eachRight=vc,ot.first=cc,Ka(ot,function(){var o={};return Vr(ot,function(g,b){Ne.call(ot.prototype,b)||(o[b]=g);}),o;}(),{chain:!1}),ot.VERSION=r,Dr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){ot[o].placeholder=ot;}),Dr(["drop","take"],function(o,g){Ce.prototype[o]=function(b){b=b===t?1:tr(ye(b),0);var k=this.__filtered__&&!g?new Ce(this):this.clone();return k.__filtered__?k.__takeCount__=ar(b,k.__takeCount__):k.__views__.push({size:ar(b,Q),type:o+(k.__dir__<0?"Right":"")}),k;},Ce.prototype[o+"Right"]=function(b){return this.reverse()[o](b).reverse();};}),Dr(["filter","map","takeWhile"],function(o,g){var b=g+1,k=b==N||b==J;Ce.prototype[o]=function(et){var lt=this.clone();return lt.__iteratees__.push({iteratee:le(et,3),type:b}),lt.__filtered__=lt.__filtered__||k,lt;};}),Dr(["head","last"],function(o,g){var b="take"+(g?"Right":"");Ce.prototype[o]=function(){return this[b](1).value()[0];};}),Dr(["initial","tail"],function(o,g){var b="drop"+(g?"":"Right");Ce.prototype[o]=function(){return this.__filtered__?new Ce(this):this[b](1);};}),Ce.prototype.compact=function(){return this.filter(xr);},Ce.prototype.find=function(o){return this.filter(o).head();},Ce.prototype.findLast=function(o){return this.reverse().find(o);},Ce.prototype.invokeMap=xe(function(o,g){return typeof o=="function"?new Ce(this):this.map(function(b){return Wi(b,o,g);});}),Ce.prototype.reject=function(o){return this.filter(js(le(o)));},Ce.prototype.slice=function(o,g){o=ye(o);var b=this;return b.__filtered__&&(o>0||g<0)?new Ce(b):(o<0?b=b.takeRight(-o):o&&(b=b.drop(o)),g!==t&&(g=ye(g),b=g<0?b.dropRight(-g):b.take(g-o)),b);},Ce.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse();},Ce.prototype.toArray=function(){return this.take(Q);},Vr(Ce.prototype,function(o,g){var b=/^(?:filter|find|map|reject)|While$/.test(g),k=/^(?:head|last)$/.test(g),et=ot[k?"take"+(g=="last"?"Right":""):g],lt=k||/^find/.test(g);et&&(ot.prototype[g]=function(){var vt=this.__wrapped__,It=k?[1]:arguments,bt=vt instanceof Ce,Gt=It[0],Ht=bt||pe(vt),Kt=function Kt(Te){var Oe=et.apply(ot,yn([Te],It));return k&&_t?Oe[0]:Oe;};Ht&&b&&typeof Gt=="function"&&Gt.length!=1&&(bt=Ht=!1);var _t=this.__chain__,re=!!this.__actions__.length,fe=lt&&!_t,Se=bt&&!re;if(!lt&&Ht){vt=Se?vt:new Ce(this);var ce=o.apply(vt,It);return ce.__actions__.push({func:Ys,args:[Kt],thisArg:t}),new Br(ce,_t);}return fe&&Se?o.apply(this,It):(ce=this.thru(Kt),fe?k?ce.value()[0]:ce.value():ce);});}),Dr(["pop","push","shift","sort","splice","unshift"],function(o){var g=us[o],b=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",k=/^(?:pop|shift)$/.test(o);ot.prototype[o]=function(){var et=arguments;if(k&&!this.__chain__){var lt=this.value();return g.apply(pe(lt)?lt:[],et);}return this[b](function(vt){return g.apply(pe(vt)?vt:[],et);});};}),Vr(Ce.prototype,function(o,g){var b=ot[g];if(b){var k=b.name+"";Ne.call(ni,k)||(ni[k]=[]),ni[k].push({name:g,func:b});}}),ni[bs(t,I).name]=[{name:"wrapper",func:t}],Ce.prototype.clone=fp,Ce.prototype.reverse=cp,Ce.prototype.value=up,ot.prototype.at=Xv,ot.prototype.chain=zv,ot.prototype.commit=$v,ot.prototype.next=jv,ot.prototype.plant=Hv,ot.prototype.reverse=kv,ot.prototype.toJSON=ot.prototype.valueOf=ot.prototype.value=Kv,ot.prototype.first=ot.prototype.head,Mi&&(ot.prototype[Mi]=Gv),ot;},ti=$d();bn?((bn.exports=ti)._=ti,ko._=ti):ir._=ti;}).call(hn);})(ao,ao.exports);ao.exports;var Qs=5,An=/*#__PURE__*/function(_$t13){function An(t){var _this84;_classCallCheck(this,An);_this84=_callSuper(this,An,[t]);dt(_this84,"canRotate",!1);dt(_this84,"scaleType",Ae.proportional);dt(_this84,"toolsType",Tt.Text);dt(_this84,"tmpPoints",[]);dt(_this84,"workOptions");dt(_this84,"oldRect");_this84.workOptions=t.toolsOpt;return _this84;}_inherits(An,_$t13);return _createClass(An,[{key:"consume",value:function consume(){return{type:xt.None};}},{key:"consumeAll",value:function consumeAll(){return{type:xt.None};}},{key:"consumeService",value:function consumeService(){}},{key:"draw",value:function(){var _draw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(t){var r,n,s,c,_this$workOptions16,l,f,h,m,u,y,T,E,C,x,_I49,_d42,v;return _regeneratorRuntime().wrap(function _callee24$(_context26){while(1)switch(_context26.prev=_context26.next){case 0:r=t.workId,n=t.layer,s=t.isDrawLabel,c=t.boxRect,_this$workOptions16=this.workOptions,l=_this$workOptions16.boxSize,f=_this$workOptions16.boxPoint,h=_this$workOptions16.zIndex,m=n.worldPosition,u=n.worldScaling;if(!(!f||!l)){_context26.next=3;break;}return _context26.abrupt("return");case 3:y={name:r,id:r,pos:[f[0]-Qs,f[1]-Qs],anchor:[0,0],size:l,zIndex:h},T=new mr(y),E={x:f[0]-Qs,y:f[1]-Qs,w:l[0],h:l[1]},C={x:Math.floor(E.x*u[0]+m[0]),y:Math.floor(E.y*u[1]+m[1]),w:Math.floor(E.w*u[0])+2,h:Math.floor(E.h*u[1])+2};this.replace(n,r,T);if(!(c&&(x=Zi(C,c)),(s||c&&x!==Tr.outside)&&n&&this.workOptions.text)){_context26.next=12;break;}_context26.next=8;return An.createLabels(this.workOptions,n,C);case 8:_I49=_context26.sent;_d42=_I49.labels;v=_I49.maxWidth;T.append.apply(T,_toConsumableArray(_d42)),C.w=Math.ceil(Math.max(v*n.worldScaling[0],C.w));case 12:return _context26.abrupt("return",C);case 13:case"end":return _context26.stop();}},_callee24,this);}));function draw(_x51){return _draw3.apply(this,arguments);}return draw;}()},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(t){var m,u,y,T,r,n,s,c,l,f,h;return _regeneratorRuntime().wrap(function _callee25$(_context27){while(1)switch(_context27.prev=_context27.next){case 0:r=(m=this.workId)==null?void 0:m.toString();if(r){_context27.next=3;break;}return _context27.abrupt("return");case 3:n=t.isFullWork,s=t.replaceId,c=t.isDrawLabel,l=t.boxRect;this.oldRect=s&&((y=(u=this.vNodes)==null?void 0:u.get(s))==null?void 0:y.rect)||void 0;f=n?this.fullLayer:this.drawLayer||this.fullLayer;_context27.next=8;return this.draw({workId:r,layer:f,isDrawLabel:_typeof(c)>"u"&&this.workOptions.workState===te.Done||c,boxRect:l});case 8:h=_context27.sent;return _context27.abrupt("return",((T=this.vNodes)==null||T.setInfo(r,{rect:h,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:h&&$t.getCenterPos(h,f)}),h));case 10:case"end":return _context27.stop();}},_callee25,this);}));function consumeServiceAsync(_x52){return _consumeServiceAsync2.apply(this,arguments);}return consumeServiceAsync;}()},{key:"updataOptService",value:function updataOptService(){}},{key:"updataOptServiceAsync",value:function(){var _updataOptServiceAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(t,r,n){var C,x,s,c,l,f,h,m,u,y,T,E;return _regeneratorRuntime().wrap(function _callee26$(_context28){while(1)switch(_context28.prev=_context28.next){case 0:if(this.workId){_context28.next=2;break;}return _context28.abrupt("return");case 2:s=this.workId.toString(),c=t.fontColor,l=t.fontBgColor,f=t.bold,h=t.italic,m=t.lineThrough,u=t.underline,y=t.zIndex,T=(C=this.vNodes)==null?void 0:C.get(s);if(T){_context28.next=5;break;}return _context28.abrupt("return");case 5:c&&(T.opt.fontColor=c),l&&(T.opt.fontBgColor=l),f&&(T.opt.bold=f),h&&(T.opt.italic=h),di(m)&&(T.opt.lineThrough=m),di(u)&&(T.opt.underline=u),er(y)&&(T.opt.zIndex=y),this.oldRect=T.rect;_context28.next=8;return this.draw({workId:s,layer:this.fullLayer,isDrawLabel:_typeof(r)>"u"&&this.workOptions.workState===te.Done||r,boxRect:n});case 8:E=_context28.sent;return _context28.abrupt("return",((x=this.vNodes)==null||x.setInfo(s,{rect:E,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:E&&$t.getCenterPos(E,this.fullLayer)}),E));case 10:case"end":return _context28.stop();}},_callee26,this);}));function updataOptServiceAsync(_x53,_x54,_x55){return _updataOptServiceAsync.apply(this,arguments);}return updataOptServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"getSafetySnippetRatio",value:function getSafetySnippetRatio(t){var r=(t==null?void 0:t.parent).displayRatio||1,n=Math.ceil(t.worldScaling[0]*10)/10;var s=n;return n<=2?s=n*r*2:n>2&&n<=3?s=n*r*1.6:n>3&&n<=4?s=n*r*1.2:n>4&&(s=n*r),Math.floor(s*1e3)/1e3;}},{key:"getSafetySnippetFontLength",value:function getSafetySnippetFontLength(t){return Math.floor(An.textImageSnippetSize*3/4/t)||1;}},{key:"createLabels",value:function(){var _createLabels=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(t,r,n){var W,s,c,l,_ref168,f,h,m,u,y,T,E,C,x,I,d,v,p,S,A,R,D,U,M,Y,B,N,G,J,tt,at,ut,K,Q,ft,mt,wt,ht,Nt,Rt,X,z,q,nt,gt,_ht2,_Nt,_Rt,_ht3,_Nt2,_mt3,_wt2;return _regeneratorRuntime().wrap(function _callee27$(_context29){while(1)switch(_context29.prev=_context29.next){case 0:s=[],c=n.x,l=n.y,_ref168=(W=r.parent)==null?void 0:W.parent,f=_ref168.width,h=_ref168.height,m=Pi(t.text),u=m.length,y=t.fontSize,T=t.lineHeight,E=t.bold,C=t.textAlign,x=t.italic,I=t.fontFamily,d=t.verticalAlign,v=t.fontColor,p=t.fontBgColor,S=t.underline,A=t.lineThrough,R=An.getSafetySnippetRatio(r)||1,D=Math.floor(y*R),U=An.getSafetySnippetFontLength(D);M=0;Y=0;case 3:if(!(Y<u)){_context29.next=33;break;}B=m[Y],N=T||D*1.5;if(!B){_context29.next=30;break;}G=sE(B),J=[0,0],tt=[0,y*1.2];d==="middle"&&(J[1]=Math.floor(Y*y*1.2+6+y*(1.1-1)));at=[0,Math.floor(-y*0.15)];J[0]=6;ut=Math.sin(Math.PI/180*20);K=0;Q=[];ft=0;case 14:if(!(ft<G)){_context29.next=27;break;}C==="left"&&(at[0]=K),ft===0&&x==="italic"&&(at[0]=at[0]-ut/2*y);mt=B.slice(ft,ft+U);wt={anchor:[0,0],pos:at,text:mt,fontFamily:I,fontSize:D,lineHeight:N,strokeColor:v,fontWeight:E,fillColor:v,textAlign:C,fontStyle:x,scale:[1/R,1/R]};ht=new _y(wt);_context29.next=21;return ht.textImageReady;case 21:Nt=_context29.sent;Rt=!0;if(Nt){X=Nt.rect&&Nt.rect[2],z=Nt.rect&&Nt.rect[3];if(X&&z){q=X/R,nt=z/R;K=q+K,x==="italic"&&(E==="bold"?K=K-ut*y*1.2:K=K-ut*y),((at[0]+J[0]+q)*r.worldScaling[0]+c<=0||(at[0]+J[0])*r.worldScaling[0]+c>=f||(at[1]+J[1]+nt)*r.worldScaling[1]+l<=0||(at[1]+J[1])*r.worldScaling[1]+l>=h)&&(ht.disconnect(),Rt=!1),Rt&&Q.push(ht);}}ft+=U;case 25:_context29.next=14;break;case 27:tt[0]=K,x==="italic"&&(tt[0]=tt[0]+ut*y),M=Math.max(M,tt[0]);gt=!0;if(((J[0]+tt[0])*r.worldScaling[0]+c<=0||J[0]*r.worldScaling[0]+c>=f||(J[1]+tt[1])*r.worldScaling[0]+l<=0||J[1]*r.worldScaling[1]+l>=h)&&(gt=!1),gt){if(S){_ht2=Math.floor(y/10),_Nt={normalize:!1,pos:[0,y*1.1+_ht2/2],lineWidth:_ht2,points:[0,0,Math.ceil(tt[0]),0],strokeColor:v,className:"underline"},_Rt=new dn(_Nt);Q.push(_Rt);}if(A){_ht3={normalize:!1,pos:[0,y*1.2/2],lineWidth:Math.floor(y/10),points:[0,0,Math.ceil(tt[0]),0],strokeColor:v,className:"lineThrough"},_Nt2=new dn(_ht3);Q.push(_Nt2);}_mt3={pos:J,anchor:[0,0],size:tt,bgcolor:p},_wt2=new mr(_mt3);_wt2.append.apply(_wt2,Q),s.push(_wt2);}case 30:Y++;_context29.next=3;break;case 33:return _context29.abrupt("return",{labels:s,maxWidth:M});case 34:case"end":return _context29.stop();}},_callee27);}));function createLabels(_x56,_x57,_x58){return _createLabels.apply(this,arguments);}return createLabels;}()},{key:"updateNodeOpt",value:function updateNodeOpt(t){var r=t.node,n=t.opt,s=t.vNodes,c=t.targetNode,l=n.fontBgColor,f=n.fontColor,h=n.translate,m=n.originPoint,u=n.scenePoint,y=n.scale,T=n.bold,E=n.italic,C=n.lineThrough,x=n.underline,I=n.fontSize,d=n.textInfos,v=n.zIndex,p=c&&fr(c)||s.get(r.name);if(!p||!r.parent)return;var A=p.opt;if(er(v)&&(r.setAttribute("zIndex",v),p.opt.zIndex=v),f&&A.fontColor&&(A.fontColor=f,r.children.forEach(function(R){R.tagName==="GROUP"&&R.children.forEach(function(D){D.tagName==="LABEL"?(D.setAttribute("fillColor",f),D.setAttribute("strokeColor",f)):D.tagName==="POLYLINE"&&D.setAttribute("strokeColor",f);});})),l&&A.fontBgColor&&(A.fontBgColor=l,r.children.forEach(function(R){R.tagName==="GROUP"&&R.setAttribute("bgcolor",l);})),T&&(A.bold=T),E&&(A.italic=E),di(C)&&(A.lineThrough=C),di(x)&&(A.underline=x),I&&(A.fontSize=I),m&&u&&y&&c&&A.boxPoint){var R=d==null?void 0:d.get(r.name);if(R){var W=R.fontSize,Y=R.boxSize;A.boxSize=Y||A.boxSize,A.fontSize=W||A.fontSize;}var D=[A.boxPoint[0],A.boxPoint[1]];Ll(A.boxPoint,u,y,h);var U=[p.op[0],p.op[1]],M=[U[0]-D[0],U[1]-D[1]];if(p.centerPos=[p.centerPos[0]+M[0],p.centerPos[1]+M[1]],p.opt.eraserlines){var _iterator33=_createForOfIteratorHelper(p.opt.eraserlines),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _W19=_step33.value;var _Y9=_W19.op,B=_W19.thickness;_W19.thickness=Math.round(B*Math.max(y[0],y[1]));for(var N=0;N<_Y9.length;N++)Rl(_Y9[N],u,y,h);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}}}else if(h&&A.boxPoint&&(A.boxPoint=[Math.round(A.boxPoint[0]+h[0]),Math.round(A.boxPoint[1]+h[1])],p.centerPos=[p.centerPos[0]+h[0],p.centerPos[1]+h[1]],p.opt.eraserlines)){var _iterator34=_createForOfIteratorHelper(p.opt.eraserlines),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _R5=_step34.value;var _D5=_R5.op;for(var _U24=0;_U24<_D5.length;_U24++){var _M21=_D5[_U24].map(function(W,Y){return Y%2?W+h[1]:W+h[0];});_R5.op[_U24]=_M21;}}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}}return p&&s.setInfo(r.name,p),p==null?void 0:p.rect;}},{key:"getRectFromLayer",value:function getRectFromLayer(t,r){var n=t.getElementsByName(r)[0];if(n){var s=n.getBoundingClientRect();var c={x:Math.floor(s.x),y:Math.floor(s.y),w:Math.floor(s.width+2),h:Math.floor(s.height+2)};return n.children.forEach(function(l){if(l.tagName==="GROUP"){var f=n.getBoundingClientRect();c=Zt(c,{x:Math.floor(f.x),y:Math.floor(f.y),w:Math.floor(f.width+2),h:Math.floor(f.height+2)});}}),c;}}}]);}($t);// 4k
|
|
480
|
+
dt(An,"textImageSnippetSize",1024*4),dt(An,"SafeBorderPadding",30);var Ki=An;var gi=/*#__PURE__*/function(_$t14){function gi(t){var _this85;_classCallCheck(this,gi);_this85=_callSuper(this,gi,[t]);dt(_this85,"canRotate",!1);dt(_this85,"scaleType",Ae.none);dt(_this85,"toolsType",Tt.PencilEraser);dt(_this85,"tmpPoints",[]);dt(_this85,"workOptions");dt(_this85,"worldPosition");dt(_this85,"worldScaling");dt(_this85,"eraserRect");dt(_this85,"eraserPolyline");_this85.workOptions=t.toolsOpt,_this85.worldPosition=_this85.fullLayer.worldPosition,_this85.worldScaling=_this85.fullLayer.worldScaling;return _this85;}/** 批量合并消费本地数据,返回绘制结果 */_inherits(gi,_$t14);return _createClass(gi,[{key:"combineConsume",value:function combineConsume(t){var r=t.workerEngine;if(this.tmpPoints.length<2)return{type:xt.None};var n=this.workOptions.thickness,_gi$eraserSizes$n=gi.eraserSizes[n],s=_gi$eraserSizes$n.width,c=_gi$eraserSizes$n.height,l=Math.round(Math.max(s,c)/this.worldScaling[0]),_this$getChangeNodes=this.getChangeNodes(l,r),f=_this$getChangeNodes.rect,h=_this$getChangeNodes.willNewNodes,m=_this$getChangeNodes.willDeleteNodes;return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.DrawWork,rect:f,willNewNodes:h,willDeleteNodes:m});}},{key:"consumeService",value:function consumeService(){}},{key:"updateTempPoints",value:function updateTempPoints(t,r){var n=this.tmpPoints.length-1;var s=Date.now();for(var c=0;c<t.length;c+=2){var l=this.tmpPoints.length,f=new Jt(t[c],t[c+1]);if(l===0){this.tmpPoints.push(f);continue;}var h=l-1,m=this.tmpPoints[h],u=pt.Sub(f,m).uni();f.isNear(m,r/2)||(pt.Equals(u,m.v,0.02)&&(this.tmpPoints.pop(),n--),f.setv(u),f.setT(s),this.tmpPoints.push(f));}return Math.max(n,0);}},{key:"getChangeNodes",value:function getChangeNodes(t,r){var n=/* @__PURE__ */new Map(),s=/* @__PURE__ */new Set();var c;if(!this.vNodes)return{willDeleteNodes:s,willNewNodes:n,rect:c};var l=this.worldPosition;var f=Re(this.tmpPoints,t);f=Vi(f,l),f=Kh(f,this.worldScaling,l);var _this$vNodes$getRectI3=this.vNodes.getRectIntersectRange(f),h=_this$vNodes$getRectI3.nodeRange;if(!h.size)return{willDeleteNodes:s,willNewNodes:n,rect:c};var m=this.computEraserPointLines(this.tmpPoints,90);var _iterator35=_createForOfIteratorHelper(h.entries()),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _step35$value=_slicedToArray(_step35.value,2),u=_step35$value[0],y=_step35$value[1];if(y.toolsType!==Tt.Pencil)continue;var T=Vi(y.rect,[-l[0],-l[1]]);T={x:T.x/this.worldScaling[0],y:T.y/this.worldScaling[1],w:T.w/this.worldScaling[0],h:T.h/this.worldScaling[1]};var E=[T.x,T.y,T.x+T.w,T.y+T.h],C=[],x=[];var _iterator36=_createForOfIteratorHelper(m),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _I52=_step36.value;Il.polyline(_I52,E,C);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}if(C.length&&y.opt){var _iterator37=_createForOfIteratorHelper(C),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _I50=_step37.value;var _d43=[];for(var v=0;v<_I50.length;v++)v!==0&&qr(_I50[v],_I50[v-1])||_d43.push.apply(_d43,_toConsumableArray(_I50[v]));x.push(_d43);}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}}if(x.length&&r){var _I51=r.createWorkShapeNode({workId:u,toolsType:Tt.Pencil,toolsOpt:y.opt});_I51.setWorkId(u);var _d44=_I51==null?void 0:_I51.computPencilPoints({op:y.op,eraserPolylines:x,eraserThickness:t});if(c=Zt(c,y.rect),s.add(u),r.removeNode(u),_d44.length)for(var _v13=0;_v13<_d44.length;_v13++){var p="".concat(u,"_").concat(Date.now(),"_").concat(_v13),S=p,R=r.setFullWork({workId:S,opt:y.opt,toolsType:Tt.Pencil}).consumeService({op:_d44[_v13],isFullWork:!0,replaceId:S});r.clearWorkShapeNodeCache(S),c=Zt(c,R),n.set(p,_objectSpread(_objectSpread({},y),{},{toolsType:Tt.Pencil,rect:R!==null&&R!==void 0?R:y.rect,name:p,op:_d44[_v13]}));}}}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}return{willNewNodes:n,willDeleteNodes:s,rect:c};}},{key:"consume",value:function consume(t){var r=t.data,n=r.op;if(!n||n.length===0)return _objectSpread({type:xt.None},this.baseConsumeResult);var s=this.workOptions.thickness,_gi$eraserSizes$s=gi.eraserSizes[s],c=_gi$eraserSizes$s.width,l=_gi$eraserSizes$s.height,f=Math.max(c,l)/this.worldScaling[0];return this.updateTempPoints(n,f),_objectSpread({type:xt.None},this.baseConsumeResult);}},{key:"computEraserPointLines",value:function computEraserPointLines(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:60;var n=[];var s=0;var c=360-r;for(var l=1;l<t.length;l++){var f=t[l-1],h=t[l];if(l===1&&s===0&&(n[s]=[f.XY]),n[s].push(h.XY),l<t.length-1){var m=h.getAngleByPoints(f,t[l+1]);(m<r||m>c)&&(s++,n[s]=[h.XY]);}}return t.length===1&&n.length===0&&n.push([t[0].XY,t[0].XY]),n;}},{key:"consumeAll",value:function consumeAll(t){var r=t.workerEngine;if(this.replace(this.fullLayer,this.workId),!this.tmpPoints.length)return _objectSpread({type:xt.None},this.baseConsumeResult);var n=this.workOptions.thickness,_gi$eraserSizes$n2=gi.eraserSizes[n],s=_gi$eraserSizes$n2.width,c=_gi$eraserSizes$n2.height,l=Math.max(s,c)/this.worldScaling[0],_this$getChangeNodes2=this.getChangeNodes(l,r),f=_this$getChangeNodes2.willDeleteNodes,h=_this$getChangeNodes2.willNewNodes,m=_this$getChangeNodes2.rect;if(f.size===0&&h.size===0)return _objectSpread(_objectSpread({type:xt.FullWork},this.baseConsumeResult),{},{rect:m});var u=[];this.tmpPoints.map(function(T){u.push(T.x,T.y,l/2);});var y=gr(u);return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.FullWork,dataType:Vt.Local,rect:m,ops:y,willNewNodes:h,willDeleteNodes:f});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}]);}($t);// 来源于white-sdk
|
|
481
|
+
dt(gi,"eraserSizes",Tl);var lo=gi;var mi=/*#__PURE__*/function(_$t15){function mi(t){var _this86;_classCallCheck(this,mi);_this86=_callSuper(this,mi,[t]);dt(_this86,"canRotate",!1);dt(_this86,"scaleType",Ae.none);dt(_this86,"toolsType",Tt.BitMapEraser);dt(_this86,"tmpPoints",[]);dt(_this86,"workOptions");dt(_this86,"worldPosition");dt(_this86,"worldScaling");dt(_this86,"eraserRect");dt(_this86,"eraserPolyline");dt(_this86,"oldRect");_this86.workOptions=t.toolsOpt,_this86.worldPosition=_this86.fullLayer.worldPosition,_this86.worldScaling=_this86.fullLayer.worldScaling;return _this86;}/** 批量合并消费本地数据,返回绘制结果 */_inherits(mi,_$t15);return _createClass(mi,[{key:"combineConsume",value:function combineConsume(t){var r=t.workerEngine;if(this.tmpPoints.length<2)return{type:xt.None};var n=this.workOptions.thickness,_mi$eraserSizes$n=mi.eraserSizes[n],s=_mi$eraserSizes$n.width,c=_mi$eraserSizes$n.height,l=Math.round(Math.max(s,c)/this.worldScaling[0]),_this$getChangeNodes3=this.getChangeNodes(l,r),f=_this$getChangeNodes3.willDeleteNodes,h=_this$getChangeNodes3.rect;return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.DrawWork,rect:h,willDeleteNodes:f});}},{key:"consumeService",value:function consumeService(){}},{key:"updateTempPoints",value:function updateTempPoints(t,r){var n=this.tmpPoints.length-1;var s=Date.now();for(var c=0;c<t.length;c+=2){var l=this.tmpPoints.length,f=new Jt(t[c],t[c+1]);if(l===0){this.tmpPoints.push(f);continue;}var h=l-1,m=this.tmpPoints[h],u=pt.Sub(f,m).uni();f.isNear(m,r/2)||(pt.Equals(u,m.v,0.02)&&(this.tmpPoints.pop(),n--),f.setv(u),f.setT(s),this.tmpPoints.push(f));}return Math.max(n,0);}},{key:"getChangeNodes",value:function getChangeNodes(t,r){var _this87=this;var n=/* @__PURE__ */new Map(),s=/* @__PURE__ */new Set();var c;if(!this.vNodes)return{willDeleteNodes:s,willUpdateNodes:n,rect:c};var l=this.worldPosition;var f=Re(this.tmpPoints,t);f=Vi(f,l),f=Kh(f,this.worldScaling,l);var _this$vNodes$getRectI4=this.vNodes.getRectIntersectRange(f),h=_this$vNodes$getRectI4.nodeRange;if(!h.size)return{willDeleteNodes:s,willUpdateNodes:n,rect:c};var m=this.computEraserPointLines(this.tmpPoints,120);var _iterator38=_createForOfIteratorHelper(h.entries()),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _step38$value=_slicedToArray(_step38.value,2),u=_step38$value[0],y=_step38$value[1];if(y.toolsType===Tt.Text||y.toolsType===Tt.Image)continue;var T=Vi(y.rect,[-l[0],-l[1]]);T={x:T.x/this.worldScaling[0],y:T.y/this.worldScaling[1],w:T.w/this.worldScaling[0],h:T.h/this.worldScaling[1]};var E=[T.x,T.y,T.x+T.w,T.y+T.h],C=[],x=[];var _iterator39=_createForOfIteratorHelper(m),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _v15=_step39.value;Il.polyline(_v15,E,C);}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}if(C.length&&y.opt){var _iterator40=_createForOfIteratorHelper(C),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var v=_step40.value;var p=[];for(var S=0;S<v.length&&!(isNaN(v[S][0])||isNaN(v[S][1]));S++){var A=v[S].map(function(R){return Math.round(R*100)/100;});if(S!==0){var R=v[S-1].map(function(D){return Math.round(D*100)/100;});if(qr(A,R))continue;}p.push.apply(p,_toConsumableArray(A));}p.length!==0&&x.push(p);}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}if(!x.length)continue;var _I53=y.opt.eraserlines?y.opt.eraserlines:[],_d45=_I53.find(function(v){return v.workId===_this87.workId;});if(_d45?_d45.op=x:_I53.push({workId:this.workId,op:x,thickness:t}),y.opt.eraserlines=_I53,r){var _v14=y.toolsType,_p16=r.createWorkShapeNode({workId:u,toolsType:_v14,toolsOpt:y.opt});_p16==null||_p16.setWorkId(u);var _S14=_p16==null?void 0:_p16.consumeService({op:y.op,isFullWork:!0,replaceId:u});if(c=Zt(c,_S14),_p16!=null&&_p16.isDelete){r.removeNode(u),s.add(u);continue;}}n.set(u,y);}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return{willUpdateNodes:n,willDeleteNodes:s,rect:c};}},{key:"consume",value:function consume(t){var r=t.data,n=r.op;if(!n||n.length===0)return _objectSpread({type:xt.None},this.baseConsumeResult);var s=this.workOptions.thickness,_mi$eraserSizes$s=mi.eraserSizes[s],c=_mi$eraserSizes$s.width,l=_mi$eraserSizes$s.height,f=Math.round(Math.max(c,l)/this.worldScaling[0]);return this.updateTempPoints(n,f),_objectSpread({type:xt.None},this.baseConsumeResult);}},{key:"computEraserPointLines",value:function computEraserPointLines(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:60;var n=[];var s=0;var c=360-r;for(var l=1;l<t.length;l++){var f=t[l-1],h=t[l];if(l===1&&s===0&&(n[s]=[f.XY]),n[s].push(h.XY),l<t.length-1){var m=h.getAngleByPoints(f,t[l+1]);(m<r||m>c)&&(s++,n[s]=[h.XY]);}}return t.length===1&&n.length===0&&n.push([t[0].XY,t[0].XY]),n;}},{key:"consumeAll",value:function consumeAll(t){var r=t.workerEngine;if(this.replace(this.fullLayer,this.workId),!this.tmpPoints.length)return _objectSpread({type:xt.None},this.baseConsumeResult);var n=this.workOptions.thickness,_mi$eraserSizes$n2=mi.eraserSizes[n],s=_mi$eraserSizes$n2.width,c=_mi$eraserSizes$n2.height,l=Math.round(Math.max(s,c)/this.worldScaling[0]),_this$getChangeNodes4=this.getChangeNodes(l,r),f=_this$getChangeNodes4.willDeleteNodes,h=_this$getChangeNodes4.willUpdateNodes,m=_this$getChangeNodes4.rect;if(f.size===0&&h.size===0)return _objectSpread(_objectSpread({type:xt.FullWork},this.baseConsumeResult),{},{rect:m});var u=[];this.tmpPoints.map(function(T){u.push(T.x,T.y,l/2);});var y=gr(u);return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:xt.FullWork,dataType:Vt.Local,rect:m,ops:y,willUpdateNodes:h,willDeleteNodes:f});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}]);}($t);// 来源于white-sdk
|
|
482
|
+
dt(mi,"eraserSizes",Tl);var fo=mi;function Gh(i){switch(i){case Tt.Arrow:return Ch;case Tt.Pencil:return Ph;case Tt.Straight:return Mh;case Tt.Ellipse:return Ih;case Tt.Polygon:case Tt.Triangle:return Ah;case Tt.Star:case Tt.Rhombus:return wh;case Tt.Rectangle:return Oh;case Tt.SpeechBalloon:return Eh;case Tt.Text:return Ki;case Tt.LaserPen:return Sh;case Tt.Eraser:return io;case Tt.PencilEraser:return lo;case Tt.BitMapEraser:return fo;case Tt.Selector:return Hi;case Tt.Image:return ki;}}function To(i,e){var t=i.toolsType,r=_objectWithoutProperties(i,_excluded);switch(t){case Tt.Arrow:return new Ch(r);case Tt.Pencil:return new Ph(r);case Tt.Straight:return new Mh(r);case Tt.Ellipse:return new Ih(r);case Tt.Polygon:case Tt.Triangle:return new Ah(r);case Tt.Star:case Tt.Rhombus:return new wh(r);case Tt.Rectangle:return new Oh(r);case Tt.SpeechBalloon:return new Eh(r);case Tt.Text:return new Ki(r);case Tt.LaserPen:return new Sh(r);case Tt.Eraser:return new io(r,e);case Tt.BitMapEraser:return new fo(r);case Tt.PencilEraser:return new lo(r);case Tt.Selector:return r.vNodes?new Hi(_objectSpread(_objectSpread({},r),{},{vNodes:r.vNodes,drawLayer:r.fullLayer})):void 0;case Tt.Image:return new ki(r);default:return;}}function Hh(i){var e=[],t=["PATH","SPRITE","POLYLINE","RECT","ELLIPSE","LABEL"];var _iterator41=_createForOfIteratorHelper(i),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var r=_step41.value;if(r.tagName==="GROUP"&&r.children.length){var n=Hh(r.children);e.push.apply(e,_toConsumableArray(n));}r.tagName&&t.includes(r.tagName)&&e.push(r);}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return e;}function Zt(i,e){if(i&&e){var t=Math.min(i.x,e.x),r=Math.min(i.y,e.y),n=Math.max(i.x+i.w,e.x+e.w),s=Math.max(i.y+i.h,e.y+e.h),c=n-t,l=s-r;return{x:t,y:r,w:c,h:l};}return e||i;}function Re(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var t={x:0,y:0,w:0,h:0};var r=1/0,n=1/0,s=-1/0,c=-1/0;return i.forEach(function(l){var _l$XY=_slicedToArray(l.XY,2),f=_l$XY[0],h=_l$XY[1];r=Math.min(r,f-e),n=Math.min(n,h-e),s=Math.max(s,f+e),c=Math.max(c,h+e);}),t.x=r,t.y=n,t.w=s-r,t.h=c-n,t;}function fl(i,e){return!(i.x+i.w<e.x||i.x>e.x+e.w||i.y+i.h<e.y||i.y>e.y+e.h);}function ve(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:10;return{x:Math.floor(i.x-e),y:Math.floor(i.y-e),w:Math.ceil(i.w+e*2),h:Math.ceil(i.h+e*2)};}function Vi(i,e){return{x:i.x+e[0],y:i.y+e[1],w:i.w,h:i.h};}function ZA(i,e){var t=new pt(i.x,i.y),r=new pt(i.x+i.w,i.y),n=new pt(i.x+i.w,i.y+i.h),s=new pt(i.x,i.y+i.h),c=new pt(i.x+i.w/2,i.y+i.h/2),l=Math.PI*e/180,f=pt.RotWith(t,c,l),h=pt.RotWith(r,c,l),m=pt.RotWith(n,c,l),u=pt.RotWith(s,c,l);return[f,h,m,u];}function kh(i,e){var t=ZA(i,e);return Re(t);}function Kh(i,e,t){var r=new pt(i.x,i.y),n=new pt(i.x+i.w,i.y),s=new pt(i.x+i.w,i.y+i.h),c=new pt(i.x,i.y+i.h),l=new pt(t[0],t[1]),f=new pt(e[0],e[1]),h=pt.ScaleWOrigin(r,f,l),m=pt.ScaleWOrigin(n,f,l),u=pt.ScaleWOrigin(s,f,l),y=pt.ScaleWOrigin(c,f,l);return Re([h,m,u,y]);}function JA(i,e,t){var r=new pt(e[0],e[1]);for(var n=0;n<i.length;n+=3){var s=new pt(i[n],i[n+1]),c=Math.PI*t/180,l=pt.RotWith(s,r,c);i[n]=l.x,i[n+1]=l.y;}}function QA(i,e,t){var r=new pt(e[0],e[1]);for(var n=0;n<i.length;n+=2){var s=new pt(i[n],i[n+1]),c=Math.PI*t/180,l=pt.RotWith(s,r,c);i[n]=l.x,i[n+1]=l.y;}}function Ll(i,e,t){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var n=new pt(e[0],e[1]);for(var s=0;s<i.length;s+=3){var c=new pt(i[s],i[s+1]),l=new pt(t[0],t[1]),f=pt.ScaleWOrigin(c,l,n);i[s]=f.x+r[0],i[s+1]=f.y+r[1];}}function Rl(i,e,t){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var n=new pt(e[0],e[1]);for(var s=0;s<i.length;s+=2){var c=new pt(i[s],i[s+1]),l=new pt(t[0],t[1]),f=pt.ScaleWOrigin(c,l,n);i[s]=f.x+r[0],i[s+1]=f.y+r[1];}}function qA(i,e){return i[0]>=e.x&&i[0]<=e.x+e.w&&i[1]>=e.y&&i[1]<=e.y+e.h;}function Vh(i,e){var t=i<=e?1:i/e,r=e<=i?1:e/i;return[t,r];}function _A(i){var _iterator42=_createForOfIteratorHelper(i),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _e3=_step42.value;if(isNaN(_e3)||_e3===1/0||_e3===-1/0)return!1;}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return!0;}function tE(i){return i!==Math.floor(i);}function eE(i){var e=i.toString();return e.indexOf(".")!==-1?e.split(".")[1].length:0;}function rE(i,e){for(;e!==0;){var _ref169=[e,i%e];i=_ref169[0];e=_ref169[1];}return i;}var nE=function nE(i){if(i.tagName==="GROUP"){var _e4=Object.getOwnPropertySymbols(i).find(function(t){return t.toString()==="Symbol(sealed)";});if(_e4&&i[_e4])return!0;}return!1;},_pr=function pr(i,e){if(i.mesh&&i.mesh.texture&&i.name==="eraserTexture"){var t=i.mesh.texture.image;e.deleteTexture(t);}else if(i.tagName==="GROUP"&&i&&i.children){var _iterator43=_createForOfIteratorHelper(i.children),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _t3=_step43.value;_pr(_t3,e);}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}}},Lr=function Lr(i,e){_pr(i,e),i.removeAllChildren();},iE=function iE(i,e,t){var r=t.parent;if(e){var n=e.children;if(n){var _iterator44=_createForOfIteratorHelper(n),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var s=_step44.value;if(_pr(s,r),s.tagName==="GROUP"){var _iterator45=_createForOfIteratorHelper(s.children),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var c=_step45.value;_pr(c,r);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}}}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}}e.parent.replaceChild(i,e);},Zh=function Zh(i,e,t){if(i.w+i.x<=0||i.h+i.y<=0||i.w<=0||i.h<=0)return;var r=e.width,n=e.height,s={x:Math.floor(Math.max(0,i.x)),y:Math.floor(Math.max(0,i.y)),w:Math.floor(Math.min(r,i.w)),h:Math.floor(Math.min(n,i.h))};if(s.x+s.w>r&&(s.w=Math.floor(r-s.x)),s.y+s.h>n&&(s.h=Math.floor(n-s.y)),tE(t)){var c=eE(t),l=Math.pow(10,c),f=rE(l,t*l),h=s.x%f,m=s.x-h;m>=0?(s.x=m,s.w=s.w+h):(s.x=0,s.w=s.w+h-m);var u=s.y%f,y=s.y-u;y>=0?(s.y=y,s.h=s.h+u):(s.y=0,s.h=s.h+u-y);}return s;};function ci(i){return"".concat(co(i.x),",").concat(co(i.y)," ");}function ui(i,e){return"".concat(co((i.x+e.x)/2),",").concat(co((i.y+e.y)/2)," ");}function co(i){return+i.toFixed(4);}var Zi=function Zi(i,e){return i.x+i.w<e.x||i.x>e.x+e.w||i.y+i.h<e.y||i.y>e.y+e.h?Tr.outside:i.x>=e.x&&i.y>=e.y&&i.x+i.w<=e.x+e.w&&i.y+i.h<=e.y+e.h?Tr.inside:Tr.intersect;};function sE(i){var e=0;for(var t=0;t<i.length;t++){var r=i.charCodeAt(t);r>=1&&r<=126||65376<=r&&r<=65439?e++:e+=2;}return e;}var oE=/*#__PURE__*/function(){function oE(e,t){_classCallCheck(this,oE);dt(this,"viewId");dt(this,"scene");dt(this,"fullLayer");dt(this,"curNodeMap",/* @__PURE__ */new Map());dt(this,"targetNodeMap",[]);dt(this,"highLevelIds");dt(this,"canClearUids");dt(this,"localUid");this.viewId=e,this.scene=t;}return _createClass(oE,[{key:"init",value:function init(e){this.fullLayer=e;}},{key:"get",value:function get(e){return this.curNodeMap.get(e);}},{key:"setLocalUid",value:function setLocalUid(e){this.localUid=e;}},{key:"getLocalUid",value:function getLocalUid(){return this.localUid;}},{key:"setCanClearUids",value:function setCanClearUids(e){this.canClearUids=e;}},{key:"getCanClearUids",value:function getCanClearUids(){return this.canClearUids;}},{key:"getCanEraserNodes",value:function getCanEraserNodes(e,t){var r=/* @__PURE__ */new Map();var _iterator46=_createForOfIteratorHelper(e.entries()),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _step46$value=_slicedToArray(_step46.value,2),n=_step46$value[0],s=_step46$value[1];s.toolsType===Tt.Image&&(s.opt.locked||t&&t.disableEraseImage)||s.toolsType===Tt.Text&&(s.opt.workState===te.Doing||s.opt.workState===te.Start||t&&t.disableEraseText)||this.isCanClearWorkId(n)&&r.set(n,s);}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}return r;}},{key:"getNodesByType",value:function getNodesByType(e){var t=/* @__PURE__ */new Map();return this.curNodeMap.forEach(function(r,n){r.toolsType===e&&t.set(n,r);}),t;}},{key:"gethasEraserNodes",value:function gethasEraserNodes(){var e=/* @__PURE__ */new Map();return this.curNodeMap.forEach(function(t,r){var n;(n=t.opt.eraserlines)!=null&&n.length&&e.set(r,t);}),e;}},{key:"hasRenderNodes",value:function hasRenderNodes(){return!0;}},{key:"has",value:function has(e){return this.curNodeMap.has(e);}},{key:"setInfo",value:function setInfo(e,t){var r=this.curNodeMap.get(e)||{name:e,rect:t.rect};t.rect&&(r.rect=fr(t.rect)),t.op&&_A(t.op)&&(r.op=fr(t.op)),t.canRotate&&(r.canRotate=t.canRotate),t.scaleType&&(r.scaleType=t.scaleType),t.opt&&(r.opt=fr(t.opt)),t.toolsType&&(r.toolsType=t.toolsType),t.centerPos&&(r.centerPos=fr(t.centerPos)),di(t.isSelected)&&(r.isSelected=t.isSelected),r.rect?this.curNodeMap.set(e,r):this.curNodeMap["delete"](e);}},{key:"selected",value:function selected(e){this.setInfo(e,{isSelected:!0});}},{key:"unSelected",value:function unSelected(e){this.setInfo(e,{isSelected:!1});}},{key:"delete",value:function _delete(e){this.curNodeMap["delete"](e);}},{key:"clear",value:function clear(){this.curNodeMap.clear(),this.targetNodeMap.length=0;}},{key:"getRectIntersectRange",value:function getRectIntersectRange(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var n;var s=/* @__PURE__ */new Map();var _iterator47=_createForOfIteratorHelper(this.curNodeMap.entries()),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _step47$value=_slicedToArray(_step47.value,2),c=_step47$value[0],l=_step47$value[1];if(fl(e,l.rect)){if(t&&l.toolsType===Tt.Image&&l.opt.locked||r&&l.toolsType===Tt.Text&&(l.opt.workState===te.Doing||l.opt.workState===te.Start))continue;n=Zt(n,l.rect),s.set(c,l);}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}return{rectRange:n,nodeRange:s};}},{key:"getNodeRectFormShape",value:function getNodeRectFormShape(e,t){var r=Gh(t.toolsType);return this.fullLayer&&(r==null?void 0:r.getRectFromLayer(this.fullLayer,e));}},{key:"updateNodeRect",value:function updateNodeRect(e){var t=this.curNodeMap.get(e);if(t){var r=this.getNodeRectFormShape(e,t);if(!r){this.curNodeMap["delete"](e);return;}t.rect=r,this.curNodeMap.set(e,t);}}},{key:"updateHighLevelNodesRect",value:function updateHighLevelNodesRect(e){this.highLevelIds=e;var _iterator48=_createForOfIteratorHelper(this.highLevelIds.keys()),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var t=_step48.value;this.updateNodeRect(t);}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}},{key:"updateLowLevelNodesRect",value:function updateLowLevelNodesRect(){var e;var _iterator49=_createForOfIteratorHelper(this.curNodeMap.keys()),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var t=_step49.value;(e=this.highLevelIds)!=null&&e.has(t)||this.updateNodeRect(t);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}}},{key:"clearHighLevelIds",value:function clearHighLevelIds(){this.highLevelIds=void 0;}},{key:"setTargetAssignKeys",value:function setTargetAssignKeys(e){var t=/* @__PURE__ */new Map();var _iterator50=_createForOfIteratorHelper(e),_step50;try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){var r=_step50.value;var n=this.curNodeMap.get(r);n&&t.set(r,fr(n));}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}return this.targetNodeMap.push(fr(t)),this.targetNodeMap.length-1;}},{key:"setTarget",value:function setTarget(){return this.targetNodeMap.push(fr(this.curNodeMap)),this.targetNodeMap.length-1;}},{key:"getLastTarget",value:function getLastTarget(){return this.targetNodeMap[this.targetNodeMap.length-1];}},{key:"deleteLastTarget",value:function deleteLastTarget(){this.targetNodeMap.length&&(this.targetNodeMap.length=this.targetNodeMap.length-1);}},{key:"getTarget",value:function getTarget(e){return this.targetNodeMap[e];}},{key:"deleteTarget",value:function deleteTarget(e){this.targetNodeMap.length=e;}},{key:"clearTarget",value:function clearTarget(){this.targetNodeMap.length=0;}},{key:"isLocalWorkId",value:function isLocalWorkId(e){return e.split(yi).length===1;}},{key:"isCanClearWorkId",value:function isCanClearWorkId(e){if(this.canClearUids===void 0||this.canClearUids===!0)return!0;if(YO(this.canClearUids)){var t=e.split(yi);if(t.length===1)return this.canClearUids.has("localSelf")||this.localUid&&this.canClearUids.has(this.localUid);if(t.length===2)return this.canClearUids.has(t[0]);}return!1;}}]);}();var Jh=/*#__PURE__*/function(){function Jh(e,t,r){_classCallCheck(this,Jh);dt(this,"viewId");dt(this,"type");dt(this,"scene");dt(this,"fullLayer");dt(this,"vNodes");dt(this,"dpr");dt(this,"contextType");dt(this,"opt");dt(this,"cameraOpt");dt(this,"isSafari",!1);dt(this,"combinePostMsg",/* @__PURE__ */new Set());dt(this,"workerTaskId");dt(this,"protectedTask");// protected hasPriorityDraw: boolean = true;
|
|
483
|
+
dt(this,"delayPostDoneResolve");dt(this,"cacheImages",/* @__PURE__ */new Map());dt(this,"imageResolveMap",/* @__PURE__ */new Map());dt(this,"taskUpdateCameraId");dt(this,"debounceUpdateCameraId");var n,s;if(this.viewId=e,this.type=r,this.opt=t,this.dpr=t.dpr,this.contextType=this.getSupportContextType(r,(n=t==null?void 0:t.offscreenCanvasOpt)==null?void 0:n.contextType),!this.contextType)throw new Error("Sorry, your browser doesn't support canvas context type 2d or webgl");try{this.scene=this.createScene(t),this.createRenderLayer(this.scene,t);}catch(c){if(this.contextType!=="2d")this.contextType="2d",(s=this.scene)==null||s.disconnect(),this.scene=this.createScene(t),this.createRenderLayer(this.scene,t);else throw c;}this.vNodes=new oE(e,this.scene);}return _createClass(Jh,[{key:"createRenderLayer",value:function createRenderLayer(e,t){var r=vr.bufferSize.full,n=vr.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",e,_objectSpread(_objectSpread({},t.layerOpt),{},{bufferSize:this.viewId===$n?r:n*2}));}},{key:"updateDpr",value:function(){var _updateDpr=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e){return _regeneratorRuntime().wrap(function _callee28$(_context30){while(1)switch(_context30.prev=_context30.next){case 0:this.dpr=e,this.scene.displayRatio=e;case 1:case"end":return _context30.stop();}},_callee28,this);}));function updateDpr(_x59){return _updateDpr.apply(this,arguments);}return updateDpr;}()},{key:"getCachedImages",value:function getCachedImages(e){var t;return(t=this.cacheImages.get(e))==null?void 0:t.imageBitmap;}},{key:"getCachedImagesByWorkId",value:function getCachedImagesByWorkId(e){var _iterator51=_createForOfIteratorHelper(this.cacheImages.entries()),_step51;try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){var _step51$value=_slicedToArray(_step51.value,2),t=_step51$value[0],r=_step51$value[1];if(t===e&&r.imageBitmap)return r.imageBitmap;}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}}},{key:"deleteCachedImagesByWorkId",value:function deleteCachedImagesByWorkId(e,t){var _iterator52=_createForOfIteratorHelper(this.cacheImages.entries()),_step52;try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){var _step52$value=_slicedToArray(_step52.value,2),r=_step52$value[0],n=_step52$value[1];t&&r===t||n.workId===e&&(n.imageBitmap.close(),this.cacheImages["delete"](r));}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}}},{key:"clearCacheImages",value:function clearCacheImages(){this.cacheImages.forEach(function(e){return e.imageBitmap.close();}),this.cacheImages.clear();}},{key:"clearImageResolveMap",value:function clearImageResolveMap(){this.imageResolveMap.forEach(function(_ref170){var e=_ref170.timer;e&&clearTimeout(e);}),this.imageResolveMap.clear();}},{key:"setIsSafari",value:function setIsSafari(e){this.isSafari=e;}},{key:"on",value:function(){var _on=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e){var t,r,n,s,c,l,f,h,_h7,m,u,y;return _regeneratorRuntime().wrap(function _callee29$(_context31){while(1)switch(_context31.prev=_context31.next){case 0:t=e.msgType,r=e.toolsType,n=e.opt,s=e.imageSrc,c=e.imageBitmap,l=e.workId,f=e.dpr;_context31.t0=t;_context31.next=_context31.t0===xt.UpdateDpr?4:_context31.t0===xt.UpdateCamera?9:_context31.t0===xt.Destroy?12:_context31.t0===xt.Clear?14:_context31.t0===xt.UpdateTools?17:_context31.t0===xt.GetImageBitMap?19:21;break;case 4:_context31.t1=er(f);if(!_context31.t1){_context31.next=8;break;}_context31.next=8;return this.updateDpr(f);case 8:return _context31.abrupt("break",21);case 9:_context31.next=11;return this.updateCamera(e);case 11:return _context31.abrupt("break",21);case 12:this.destroy();return _context31.abrupt("break",21);case 14:_context31.next=16;return this.clearAll();case 16:return _context31.abrupt("break",21);case 17:if(r&&n){h={toolsType:r,toolsOpt:n,combineUnitTime:e.combineUnitTime,maxCombineEraserTime:e.maxCombineEraserTime};this.localWork.setToolsOpt(h);}return _context31.abrupt("break",21);case 19:if(s&&c&&l){_h7=l.toString();this.cacheImages.set(s,{imageBitmap:c,workId:_h7});m=this.imageResolveMap.get(s);if(m){u=m.resolve,y=m.timer;y&&clearTimeout(y),u&&u(s);}this.deleteCachedImagesByWorkId(_h7,s);}return _context31.abrupt("break",21);case 21:case"end":return _context31.stop();}},_callee29,this);}));function on(_x60){return _on.apply(this,arguments);}return on;}()},{key:"getIconSize",value:function getIconSize(e,t,r){var n=e*r,s=t*r;return n<=50||s<=50?[50,50]:n<=100||s<=100?[100,100]:n<=200||s<=200?[200,200]:n<=400||s<=400?[400,400]:n<=800||s<=800?[800,800]:[1600,1600];}},{key:"loadImageBitMap",value:function(){var _loadImageBitMap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e){var _this88=this;var t,r,n,s,c,l,f,h,m,u,y,_this$getIconSize,_this$getIconSize2,x,_I54,_x62,_x63,C;return _regeneratorRuntime().wrap(function _callee30$(_context32){while(1)switch(_context32.prev=_context32.next){case 0:t=e.toolsType,r=e.opt,n=e.workId,s=e.isSubWorker;if(!(t===Tt.Image&&r&&n)){_context32.next=19;break;}c=n.toString(),l=r.src,f=r.type,h=r.width,m=r.height,u=r.strokeColor;if(!(!l||!f||!h||!m)){_context32.next=5;break;}return _context32.abrupt("return");case 5:y=l;if(f===cl.Iconify){_this$getIconSize=this.getIconSize(h,m,this.dpr),_this$getIconSize2=_slicedToArray(_this$getIconSize,2),x=_this$getIconSize2[0],_I54=_this$getIconSize2[1];y="".concat(l,"?width=").concat(x,"&height=").concat(_I54,"&color=").concat(u);}if(!this.cacheImages.has(y)){_context32.next=11;break;}_x62=this.getCachedImages(y);if(!_x62){_context32.next=11;break;}return _context32.abrupt("return",_x62);case 11:if(!this.imageResolveMap.has(y)){_context32.next=15;break;}_x63=this.getCachedImagesByWorkId(c);if(!_x63){_context32.next=15;break;}return _context32.abrupt("return",_x63);case 15:_context32.next=17;return new Promise(function(x){var I=_this88.imageResolveMap.get(y)||{resolve:void 0,timer:void 0};I.timer&&clearTimeout(I.timer),I.resolve=x,I.timer=setTimeout(function(){var d=_this88.imageResolveMap.get(y);d!=null&&d.resolve&&d.resolve(y);},5e3),_this88.imageResolveMap.set(y,I),_this88._post({sp:[{imageSrc:y,workId:c,viewId:_this88.viewId,isgl:!!_this88.fullLayer.parent.gl,isSubWorker:s,type:xt.GetImageBitMap}]});});case 17:C=_context32.sent;return _context32.abrupt("return",(this.imageResolveMap["delete"](C),this.getCachedImages(y)));case 19:case"end":return _context32.stop();}},_callee30,this);}));function loadImageBitMap(_x61){return _loadImageBitMap.apply(this,arguments);}return loadImageBitMap;}()},{key:"createLocalWork",value:function createLocalWork(e){var t=e.workId,r=e.opt,n=e.toolsType;t&&r&&(!this.localWork.getToolsOpt()&&n&&this.setToolsOpt({toolsType:n,toolsOpt:r}),this.setWorkOpt({workId:t,toolsOpt:r}));}},{key:"updateScene",value:function updateScene(e,t,r){e.attr(_objectSpread({},t));var n=t.width,s=t.height;e.container.width=n,e.container.height=s,e.width=n,e.height=s,this.updateLayer({width:n,height:s},r);}},{key:"updateLayer",value:function updateLayer(e,t){var r=e.width,n=e.height,s=t||this.fullLayer;s&&(s.parent.setAttribute("width",r),s.parent.setAttribute("height",n),s.setAttribute("size",[r,n]),s.setAttribute("pos",[r*0.5,n*0.5]));}},{key:"getSupportContextType",value:function getSupportContextType(e,t){var r=new OffscreenCanvas(100,100);var n=["2d"];e===uo.Full&&this.viewId===$n&&(n=["webgl2","webgl","2d"],t&&n.unshift(t));for(var _i3=0,_n7=n;_i3<_n7.length;_i3++){var s=_n7[_i3];try{if(r.getContext(s))return s;}catch(c){throw c;}}}},{key:"createScene",value:function createScene(e){var t=e.offscreenCanvasOpt,r=t.width,n=t.height,s=new OffscreenCanvas(r,n);t.contextType&&delete t.contextType;var c=new Uu(_objectSpread(_objectSpread({container:s,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},t),{},{contextType:this.contextType,id:this.viewId}));return c.setAttribute("id",this.viewId),c;}},{key:"createLayer",value:function createLayer(e,t,r,n){var s="offscreen-".concat(e),c=r.width,l=r.height;n&&(r.offscreen=!0,r.canvas=n);var f=t.layer(s,r),h=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return f.append(h),h;}},{key:"clearAll",value:function(){var _clearAll=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(){var e;return _regeneratorRuntime().wrap(function _callee31$(_context33){while(1)switch(_context33.prev=_context33.next){case 0:this.fullLayer&&(this.fullLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),Lr(this.fullLayer,this.fullLayer.parent)),this.taskUpdateCameraId&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0),this.debounceUpdateCameraId&&(clearTimeout(this.debounceUpdateCameraId),this.debounceUpdateCameraId=void 0),this.clearCacheImages(),this.clearImageResolveMap(),this.localWork.destroy(),(e=this.serviceWork)==null||e.destroy();case 1:case"end":return _context33.stop();}},_callee31,this);}));function clearAll(){return _clearAll.apply(this,arguments);}return clearAll;}()},{key:"setToolsOpt",value:function setToolsOpt(e){this.localWork.setToolsOpt(e);}},{key:"setWorkOpt",value:function setWorkOpt(e){var t=e.workId,r=e.toolsOpt;t&&r&&this.localWork.setWorkOptions(t.toString(),r);}},{key:"destroy",value:function destroy(){var e;this.vNodes.clear(),this.fullLayer.remove(),_pr(this.fullLayer,this.fullLayer.parent),this.clearCacheImages(),this.clearImageResolveMap(),this.scene.remove(),this.localWork.destroy(),(e=this.serviceWork)==null||e.destroy();}},{key:"post",value:function(){var _post=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e){return _regeneratorRuntime().wrap(function _callee32$(_context34){while(1)switch(_context34.prev=_context34.next){case 0:this.combinePostMsg.add(e);_context34.next=3;return this.runBatchPostData();case 3:case"end":return _context34.stop();}},_callee32,this);}));function post(_x64){return _post.apply(this,arguments);}return post;}()},{key:"runBatchPostData",value:function(){var _runBatchPostData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(){var _this89=this;return _regeneratorRuntime().wrap(function _callee33$(_context35){while(1)switch(_context35.prev=_context35.next){case 0:this.workerTaskId||(this.workerTaskId=setTimeout(function(){_this89.workerTaskId=void 0,_this89.combinePost();},16));_context35.t0=this.type===uo.Full&&!this.delayPostDoneResolve;if(!_context35.t0){_context35.next=6;break;}_context35.next=5;return new Promise(function(t){_this89.delayPostDoneResolve=t;});case 5:_context35.t0=_context35.sent;case 6:_context35.t1=_context35.t0;if(!_context35.t1){_context35.next=9;break;}this.delayPostDoneResolve=void 0;case 9:case"end":return _context35.stop();}},_callee33,this);}));function runBatchPostData(){return _runBatchPostData.apply(this,arguments);}return runBatchPostData;}()},{key:"combinePostData",value:function combinePostData(){var l,f;this.workerTaskId=void 0;var e=[],t=[];var r,n,s;var c=/* @__PURE__ */new Set();var _iterator53=_createForOfIteratorHelper(this.combinePostMsg.values()),_step53;try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var h=_step53.value;if((l=h.render)!=null&&l.length){var _iterator54=_createForOfIteratorHelper(h.render),_step54;try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var m=_step54.value;var u=!1;if(m.workId&&c.add(m.workId),m.isClearAll&&(m.rect=this.getSceneRect(),m.isClear=!0,delete m.isClearAll),m.drawCanvas){var y=this.getLayer(m.drawCanvas);if(!y||!(y.parent instanceof el))continue;if(y.parent.render(),m.isDrawAll){var T=this.getSceneRect();m.rect=T,delete m.isDrawAll;}}var _iterator55=_createForOfIteratorHelper(e),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var _y3=_step55.value;if(m.viewId===_y3.viewId){m.isClear&&_y3.clearCanvas&&_y3.isClear&&_y3.clearCanvas===m.clearCanvas&&(_y3.rect=Zt(_y3.rect,m.rect),u=!0),_y3.drawCanvas&&_y3.drawCanvas===m.drawCanvas&&(_y3.rect=Zt(_y3.rect,m.rect),u=!0);continue;}}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}u||(m.isClear&&!m.drawCanvas?e.unshift(m):e.push(m));}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}}if((f=h.sp)!=null&&f.length){var _iterator56=_createForOfIteratorHelper(h.sp),_step56;try{for(_iterator56.s();!(_step56=_iterator56.n()).done;){var _m12=_step56.value;var _u6=!1;var _iterator57=_createForOfIteratorHelper(t),_step57;try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var _y4=_step57.value;if(qr(_m12,_y4)){_u6=!0;break;}}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}_u6||t.push(_m12);}}catch(err){_iterator56.e(err);}finally{_iterator56.f();}}er(h.fullWorkerDrawCount)&&(r=h.fullWorkerDrawCount),er(h.subWorkerDrawCount)&&(n=h.subWorkerDrawCount),er(h.consumeCount)&&(s=h.consumeCount);}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}return this.combinePostMsg.clear(),{render:e,sp:t,fullWorkerDrawCount:r,subWorkerDrawCount:n,consumeCount:s,workIds:c,viewId:this.viewId};}},{key:"getSceneRect",value:function getSceneRect(){var _this$scene=this.scene,e=_this$scene.width,t=_this$scene.height;return{x:0,y:0,w:Math.floor(e),h:Math.floor(t)};}}]);}();var bl=/*#__PURE__*/function(){function bl(e){_classCallCheck(this,bl);dt(this,"viewId");dt(this,"vNodes");dt(this,"thread");dt(this,"fullLayer");dt(this,"drawLayer");dt(this,"_post");dt(this,"tmpOpt");dt(this,"workShapes",/* @__PURE__ */new Map());dt(this,"drawCount",0);dt(this,"consumeCount",0);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"combineUnitTime",vr.bezier.combineUnitTime);dt(this,"maxCombineEraserTime",vr.pencilEraser.maxCombineTime);this.thread=e.thread,this.viewId=e.viewId,this.vNodes=e.vNodes,this.fullLayer=e.fullLayer,this.drawLayer=e.drawLayer,this._post=this.thread.post.bind(e.thread);}return _createClass(bl,[{key:"setmaxCombineEraserTime",value:function setmaxCombineEraserTime(e){this.maxCombineEraserTime=e;}},{key:"setCombineUnitTime",value:function setCombineUnitTime(e){this.combineUnitTime=e;}},{key:"setSyncUnitTime",value:function setSyncUnitTime(e){this.syncUnitTime=e;}},{key:"destroy",value:function destroy(){this.workShapes.clear();}},{key:"getWorkShapes",value:function getWorkShapes(){return this.workShapes;}},{key:"getWorkShape",value:function getWorkShape(e){return this.workShapes.get(e);}},{key:"createWorkShape",value:function createWorkShape(e,t){if(e&&this.tmpOpt){var r={toolsType:this.tmpOpt.toolsType,toolsOpt:t||this.tmpOpt.toolsOpt},n=this.createWorkShapeNode(_objectSpread(_objectSpread({},r),{},{workId:e}));n&&this.workShapes.set(e,n);}}},{key:"setWorkOptions",value:function setWorkOptions(e,t){var r=this.getWorkShape(e);r||this.createWorkShape(e,t),r==null||r.setWorkOptions(t);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(e){var t;return To(_objectSpread(_objectSpread({},e),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(t=this.thread)==null?void 0:t.serviceWork);}},{key:"setToolsOpt",value:function setToolsOpt(e){var t,r,n;((t=this.tmpOpt)==null?void 0:t.toolsType)!==e.toolsType&&(r=this.tmpOpt)!=null&&r.toolsType&&this.clearAllWorkShapesCache(),this.tmpOpt=e,(n=e.toolsOpt)!=null&&n.syncUnitTime&&(this.syncUnitTime=e.toolsOpt.syncUnitTime),e.combineUnitTime&&(this.combineUnitTime=e.combineUnitTime),e.maxCombineEraserTime&&(this.maxCombineEraserTime=e.maxCombineEraserTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"clearWorkShapeNodeCache",value:function clearWorkShapeNodeCache(e){var t;(t=this.getWorkShape(e))==null||t.clearTmpPoints(),this.workShapes["delete"](e);}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.workShapes.forEach(function(e){return e.clearTmpPoints();}),this.workShapes.clear();}},{key:"setFullWork",value:function setFullWork(e){var t=e.workId,r=e.opt,n=e.toolsType;if(t&&r&&n){var s=t.toString();var c;return t&&this.workShapes.has(s)?(c=this.workShapes.get(s),c==null||c.setWorkOptions(r)):c=this.createWorkShapeNode({toolsOpt:r,toolsType:n,workId:s}),c?(this.workShapes.set(s,c),c):void 0;}}}]);}();function aE(i){return i;}var Qh=aE;function lE(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2]);}return i.apply(e,t);}var fE=lE,cE=fE,bu=Math.max;function uE(i,e,t){return e=bu(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=bu(r.length-e,0),c=Array(s);++n<s;)c[n]=r[e+n];n=-1;for(var l=Array(e+1);++n<e;)l[n]=r[n];return l[e]=t(c),cE(i,this,l);};}var hE=uE;function dE(i){return function(){return i;};}var pE=dE,vE=pE,Du=Ku,gE=Qh,mE=Du?function(i,e){return Du(i,"toString",{configurable:!0,enumerable:!1,value:vE(e),writable:!0});}:gE,yE=mE,PE=800,SE=16,xE=Date.now;function TE(i){var e=0,t=0;return function(){var r=xE(),n=SE-(r-t);if(t=r,n>0){if(++e>=PE)return arguments[0];}else e=0;return i.apply(void 0,arguments);};}var CE=TE,IE=yE,OE=CE,wE=OE(IE),AE=wE,EE=Qh,ME=hE,LE=AE;function RE(i,e){return LE(ME(i,e,EE),i+"");}var bE=RE;function DE(i,e,t,r){for(var n=i.length,s=t+(r?1:-1);r?s--:++s<n;)if(e(i[s],s,i))return s;return-1;}var NE=DE;function BE(i){return i!==i;}var WE=BE;function FE(i,e,t){for(var r=t-1,n=i.length;++r<n;)if(i[r]===e)return r;return-1;}var UE=FE,YE=NE,XE=WE,zE=UE;function $E(i,e,t){return e===e?zE(i,e,t):YE(i,XE,t);}var jE=$E,GE=jE;function HE(i,e){var t=i==null?0:i.length;return!!t&&GE(i,e,0)>-1;}var qh=HE;function kE(i,e,t){for(var r=-1,n=i==null?0:i.length;++r<n;)if(t(e,i[r]))return!0;return!1;}var _h=kE;function KE(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n;}var VE=KE,ZE=Ol,JE=qh,QE=_h,qE=VE,_E=Po,tM=wl,eM=200;function rM(i,e,t,r){var n=-1,s=JE,c=!0,l=i.length,f=[],h=e.length;if(!l)return f;t&&(e=qE(e,_E(t))),r?(s=QE,c=!1):e.length>=eM&&(s=tM,c=!1,e=new ZE(e));t:for(;++n<l;){var m=i[n],u=t==null?m:t(m);if(m=r||m!==0?m:0,c&&u===u){for(var y=h;y--;)if(e[y]===u)continue t;f.push(m);}else s(e,u,r)||f.push(m);}return f;}var nM=rM,Nu=Ji,iM=Qu,sM=qi,Bu=Nu?Nu.isConcatSpreadable:void 0;function oM(i){return sM(i)||iM(i)||!!(Bu&&i&&i[Bu]);}var aM=oM,lM=Sl,fM=aM;function td(i,e,t,r,n){var s=-1,c=i.length;for(t||(t=fM),n||(n=[]);++s<c;){var l=i[s];e>0&&t(l)?e>1?td(l,e-1,t,r,n):lM(n,l):r||(n[n.length]=l);}return n;}var cM=td;function uM(){}var hM=uM,tl=lh,dM=hM,pM=Al,vM=1/0,gM=tl&&1/pM(new tl([,-0]))[1]==vM?function(i){return new tl(i);}:dM,mM=gM,yM=Ol,PM=qh,SM=_h,xM=wl,TM=mM,CM=Al,IM=200;function OM(i,e,t){var r=-1,n=PM,s=i.length,c=!0,l=[],f=l;if(t)c=!1,n=SM;else if(s>=IM){var h=e?null:TM(i);if(h)return CM(h);c=!1,n=xM,f=new yM();}else f=e?[]:l;t:for(;++r<s;){var m=i[r],u=e?e(m):m;if(m=t||m!==0?m:0,c&&u===u){for(var y=f.length;y--;)if(f[y]===u)continue t;e&&f.push(u),l.push(m);}else n(f,u,t)||(f!==l&&f.push(u),l.push(m));}return l;}var wM=OM,AM=nM,EM=cM,Wu=wM;function MM(i,e,t){var r=i.length;if(r<2)return r?Wu(i[0]):[];for(var n=-1,s=Array(r);++n<r;)for(var c=i[n],l=-1;++l<r;)l!=n&&(s[n]=AM(s[n]||c,i[l],e,t));return Wu(EM(s,1),e,t);}var LM=MM,RM=gl,bM=pn;function DM(i){return bM(i)&&RM(i);}var NM=DM,BM=rh,WM=bE,FM=LM,UM=NM,YM=WM(function(i){return FM(BM(i,UM));}),XM=YM,zM=/* @__PURE__ */Ln(XM);var ed=/*#__PURE__*/function(_bl){function ed(t){var _this90;_classCallCheck(this,ed);_this90=_callSuper(this,ed,[t]);dt(_this90,"_type","full");dt(_this90,"combineTimerId");dt(_this90,"combineDrawResolve");dt(_this90,"combineDrawActiveId");dt(_this90,"drawWorkActiveId");dt(_this90,"effectSelectNodeData",/* @__PURE__ */new Set());return _this90;}_inherits(ed,_bl);return _createClass(ed,[{key:"loadImageBitMap",value:function(){var _loadImageBitMap2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(t){return _regeneratorRuntime().wrap(function _callee34$(_context36){while(1)switch(_context36.prev=_context36.next){case 0:_context36.next=2;return this.thread.loadImageBitMap(t);case 2:return _context36.abrupt("return",_context36.sent);case 3:case"end":return _context36.stop();}},_callee34,this);}));function loadImageBitMap(_x65){return _loadImageBitMap2.apply(this,arguments);}return loadImageBitMap;}()},{key:"consumeDraw",value:function(){var _consumeDraw=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(t,r){var _this91=this;var n,s,c,l,f,h,m,u,y;return _regeneratorRuntime().wrap(function _callee35$(_context37){while(1)switch(_context37.prev=_context37.next){case 0:n=t.op,s=t.workId,c=t.scenePath,l=t.postCount,f=t.smoothSync;if(!(n!=null&&n.length&&s)){_context37.next=48;break;}h=s.toString(),m=this.getWorkShape(h);if(m){_context37.next=5;break;}return _context37.abrupt("return");case 5:u=m.toolsType;if(!(u===Tt.LaserPen)){_context37.next=8;break;}return _context37.abrupt("return");case 8:_context37.t0=this.combineDrawActiveId&&this.combineDrawActiveId!==h;if(!_context37.t0){_context37.next=13;break;}this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);_context37.next=13;return this.consumeDrawAll({workId:this.combineDrawActiveId,scenePath:c,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local},r);case 13:_context37.t1=this.drawWorkActiveId&&this.drawWorkActiveId!==h;if(!_context37.t1){_context37.next=18;break;}_context37.next=17;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:c,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local},r);case 17:this.drawWorkActiveId=void 0;case 18:!this.drawWorkActiveId&&h!==Me&&(this.drawWorkActiveId=h);er(l)&&(this.consumeCount=l);y=m.consume({data:t,isFullWork:!0,smoothSync:f});_context37.t2=u;_context37.next=_context37.t2===Tt.Selector?24:_context37.t2===Tt.PencilEraser?30:_context37.t2===Tt.BitMapEraser?30:_context37.t2===Tt.Eraser?32:_context37.t2===Tt.Arrow?35:_context37.t2===Tt.Straight?35:_context37.t2===Tt.Ellipse?35:_context37.t2===Tt.Rectangle?35:_context37.t2===Tt.Star?35:_context37.t2===Tt.Polygon?35:_context37.t2===Tt.SpeechBalloon?35:_context37.t2===Tt.Pencil?41:48;break;case 24:_context37.t3=y.type===xt.Select;if(!_context37.t3){_context37.next=29;break;}y.selectIds&&r.runReverseSelectWork(y.selectIds);_context37.next=29;return this.drawSelector(y);case 29:return _context37.abrupt("break",48);case 30:this.drawCount++,this.combineTimerId||(this.combineTimerId=1,this.combineDrawActiveId=h,this.drawEraserCombine(h,this.drawCount).then(function(){_this91.combineTimerId=void 0;}));return _context37.abrupt("break",48);case 32:_context37.next=34;return this.drawEraser(y);case 34:return _context37.abrupt("break",48);case 35:_context37.t4=y;if(!_context37.t4){_context37.next=40;break;}this.drawCount++;_context37.next=40;return this.drawShape(y);case 40:return _context37.abrupt("break",48);case 41:this.drawCount++;!this.combineTimerId&&this.combineUnitTime!==1/0&&new Promise(function(T){_this91.combineDrawActiveId=h,_this91.combineDrawResolve=T,_this91.combineTimerId=setTimeout(function(){_this91.combineTimerId=void 0,_this91.combineDrawResolve&&_this91.combineDrawResolve(!0);},_this91.combineUnitTime);}).then(function(T){T&&_this91.drawPencilCombine(h,_this91.drawCount),_this91.combineDrawResolve=void 0;});_context37.t5=y;if(!_context37.t5){_context37.next=47;break;}_context37.next=47;return this.drawPencil(y);case 47:return _context37.abrupt("break",48);case 48:case"end":return _context37.stop();}},_callee35,this);}));function consumeDraw(_x66,_x67){return _consumeDraw.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(t,r){var l,f,h,n,s,c,m,u,y,T,E,C;return _regeneratorRuntime().wrap(function _callee36$(_context38){while(1)switch(_context38.prev=_context38.next){case 0:this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);n=t.workId,s=t.scenePath,c=t.isLockSentEventCursor;if(!n){_context38.next=38;break;}m=n.toString();this.drawWorkActiveId===m&&(this.drawWorkActiveId=void 0);u=this.workShapes.get(m);if(u){_context38.next=8;break;}return _context38.abrupt("return");case 8:y=u.toolsType;if(!(y===Tt.LaserPen)){_context38.next=11;break;}return _context38.abrupt("return");case 11:T=this.workShapes.get(pi),E=(l=T==null?void 0:T.selectIds)==null?void 0:l[0],C=u.consumeAll({data:t,workerEngine:this});_context38.t0=y;_context38.next=_context38.t0===Tt.Selector?15:_context38.t0===Tt.PencilEraser?21:_context38.t0===Tt.BitMapEraser?21:_context38.t0===Tt.Eraser?26:_context38.t0===Tt.Arrow?28:_context38.t0===Tt.Straight?28:_context38.t0===Tt.Ellipse?28:_context38.t0===Tt.Rectangle?28:_context38.t0===Tt.Star?28:_context38.t0===Tt.Polygon?28:_context38.t0===Tt.SpeechBalloon?28:_context38.t0===Tt.Pencil?33:38;break;case 15:C.selectIds&&E&&(f=C.selectIds)!=null&&f.includes(E)&&T.cursorBlur();C.selectIds&&r.runReverseSelectWork(C.selectIds);_context38.next=19;return this.drawSelector(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 19:(h=u.selectIds)!=null&&h.length?u.clearTmpPoints():this.clearWorkShapeNodeCache(m);return _context38.abrupt("break",38);case 21:_context38.next=23;return this.drawEraserFull(u,_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 23:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context38.abrupt("break",38);case 26:this.drawEraser(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c),u.clearTmpPoints();return _context38.abrupt("break",38);case 28:_context38.next=30;return this.drawPencilFull(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 30:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context38.abrupt("break",38);case 33:_context38.next=35;return this.drawPencilFull(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 35:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context38.abrupt("break",38);case 38:case"end":return _context38.stop();}},_callee36,this);}));function consumeDrawAll(_x68,_x69){return _consumeDrawAll.apply(this,arguments);}return consumeDrawAll;}()},{key:"workShapesDone",value:function(){var _workShapesDone=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(t,r){var _iterator58,_step58,n;return _regeneratorRuntime().wrap(function _callee37$(_context39){while(1)switch(_context39.prev=_context39.next){case 0:_iterator58=_createForOfIteratorHelper(this.workShapes.keys());_context39.prev=1;_iterator58.s();case 3:if((_step58=_iterator58.n()).done){_context39.next=9;break;}n=_step58.value;_context39.next=7;return this.consumeDrawAll({workId:n,scenePath:t,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local},r);case 7:_context39.next=3;break;case 9:_context39.next=14;break;case 11:_context39.prev=11;_context39.t0=_context39["catch"](1);_iterator58.e(_context39.t0);case 14:_context39.prev=14;_iterator58.f();return _context39.finish(14);case 17:case"end":return _context39.stop();}},_callee37,this,[[1,11,14,17]]);}));function workShapesDone(_x70,_x71){return _workShapesDone.apply(this,arguments);}return workShapesDone;}()},{key:"consumeFull",value:function(){var _consumeFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(t){var s,c,r,n,l,f,h,m,u,y,T;return _regeneratorRuntime().wrap(function _callee38$(_context40){while(1)switch(_context40.prev=_context40.next){case 0:r=this.setFullWork(t),n=t.ops&&Pi(t.ops)||t.op;if(!r){_context40.next=26;break;}l=(s=t.workId)==null?void 0:s.toString();if(l){_context40.next=5;break;}return _context40.abrupt("return");case 5:f=(c=this.vNodes.get(l))==null?void 0:c.rect;if(!(r.toolsType===Tt.Image)){_context40.next=13;break;}_context40.next=9;return r.consumeServiceAsync({isFullWork:!0,replaceId:l,worker:this});case 9:h=_context40.sent;m=(t==null?void 0:t.updateNodeOpt)&&r.updataOptService(t.updateNodeOpt);_context40.next=20;break;case 13:if(!(r.toolsType===Tt.Text)){_context40.next=19;break;}_context40.next=16;return r.consumeServiceAsync({isFullWork:!0,replaceId:l,boxRect:this.thread.getSceneRect()});case 16:h=_context40.sent;_context40.next=20;break;case 19:h=r.consumeService({op:n,isFullWork:!0,replaceId:l}),m=(t==null?void 0:t.updateNodeOpt)&&r.updataOptService(t.updateNodeOpt);case 20:h=Zt(h,m);u=[],y=[];if(!(t.workId&&this.workShapes["delete"](t.workId.toString()),h&&t.willRefresh&&(f&&(u.push({rect:ve(f),isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId}),h=Zt(h,f)),u.push({rect:ve(h),drawCanvas:Ut.Bg,viewId:this.viewId})),t.willSyncService&&y.push({opt:t.opt,toolsType:t.toolsType,type:xt.FullWork,workId:t.workId,ops:t.ops,updateNodeOpt:t.updateNodeOpt,viewId:this.viewId}),u.length||y.length)){_context40.next=26;break;}T={render:u,sp:y};_context40.next=26;return this._post(T);case 26:case"end":return _context40.stop();}},_callee38,this);}));function consumeFull(_x72){return _consumeFull.apply(this,arguments);}return consumeFull;}()},{key:"commandDeleteText",value:function commandDeleteText(t){var r=this.vNodes.get(t);if(r&&r.toolsType===Tt.Text)return{type:xt.TextUpdate,toolsType:Tt.Text,workId:t,dataType:Vt.Local};}},{key:"removeSelector",value:function(){var _removeSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(t,r){var n,s,c,l,f,h,_iterator59,_step59,m,T,y;return _regeneratorRuntime().wrap(function _callee39$(_context41){while(1)switch(_context41.prev=_context41.next){case 0:n=t.willSyncService,s=[],c=[],l=[],f=this.workShapes.get(Me);if(f){_context41.next=3;break;}return _context41.abrupt("return");case 3:h=f.selectIds&&_toConsumableArray(f.selectIds)||[];_iterator59=_createForOfIteratorHelper(h);try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){m=_step59.value;if(this.vNodes.get(m)){T=this.commandDeleteText(m);T&&s.push(T);}y=this._removeWork(m);y.length&&c.push.apply(c,_toConsumableArray(y)),r==null||r.deleteCachedImagesByWorkId(m),l.push(m);}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}l.length&&s.push({type:xt.RemoveNode,removeIds:l});s.push({type:xt.Select,selectIds:[],willSyncService:n});_context41.next=10;return this.blurSelector();case 10:_context41.t0=c.length||s.length;if(!_context41.t0){_context41.next=14;break;}_context41.next=14;return this._post({render:c,sp:s});case 14:case"end":return _context41.stop();}},_callee39,this);}));function removeSelector(_x73,_x74){return _removeSelector.apply(this,arguments);}return removeSelector;}()},{key:"removeWork",value:function(){var _removeWork2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(t){var r,n,s;return _regeneratorRuntime().wrap(function _callee40$(_context42){while(1)switch(_context42.prev=_context42.next){case 0:r=t.workId,n=r==null?void 0:r.toString();if(!n){_context42.next=7;break;}s=this._removeWork(n);_context42.t0=s.length;if(!_context42.t0){_context42.next=7;break;}_context42.next=7;return this._post({render:s});case 7:case"end":return _context42.stop();}},_callee40,this);}));function removeWork(_x75){return _removeWork2.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(t){var _this92=this;var s,c,l;var r=this.vNodes.get(t);r&&((s=this.fullLayer)==null||s.getElementsByName(t).forEach(function(f){f.remove(),_pr(f,_this92.fullLayer.parent);}),this.vNodes["delete"](t));var n=this.drawLayer&&$t.getRectFromLayer(this.drawLayer,t);if(n){var f=(c=this.drawLayer)==null?void 0:c.getElementsByName(t)[0];f&&(f.remove(),_pr(f,(l=this.drawLayer)==null?void 0:l.parent));}return this.getWorkShape(t)&&this.clearWorkShapeNodeCache(t),{fullRect:r==null?void 0:r.rect,drawRect:n};}},{key:"_removeWork",value:function _removeWork(t){var _this$removeNode=this.removeNode(t),r=_this$removeNode.fullRect,n=_this$removeNode.drawRect,s=[];return r&&s.push({rect:ve(r),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(r),drawCanvas:Ut.Bg,viewId:this.viewId}),n&&s.push({rect:ve(n),clearCanvas:Ut.Float,isClear:!0,viewId:this.viewId},{rect:ve(n),drawCanvas:Ut.Float,viewId:this.viewId}),s;}},{key:"checkTextActive",value:function(){var _checkTextActive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(t){var r,n,s,c,l,f,h,_iterator60,_step60,_m13,u,y,T,E,m;return _regeneratorRuntime().wrap(function _callee41$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:r=t.op,n=t.viewId,s=t.dataType;if(!(r!=null&&r.length)){_context43.next=32;break;}f=r[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],h=r[1]*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1];_iterator60=_createForOfIteratorHelper(this.vNodes.curNodeMap.values());_context43.prev=4;_iterator60.s();case 6:if((_step60=_iterator60.n()).done){_context43.next=14;break;}_m13=_step60.value;u=_m13.rect,y=_m13.name,T=_m13.toolsType,E=_m13.opt;if(!(T===Tt.Text&&E.workState===te.Done&&qA([f,h],u))){_context43.next=12;break;}c=y,l=this.setFullWork({workId:y,toolsType:T,opt:E});return _context43.abrupt("break",14);case 12:_context43.next=6;break;case 14:_context43.next=19;break;case 16:_context43.prev=16;_context43.t0=_context43["catch"](4);_iterator60.e(_context43.t0);case 19:_context43.prev=19;_iterator60.f();return _context43.finish(19);case 22:if(!c){_context43.next=32;break;}_context43.t1=l;if(!_context43.t1){_context43.next=28;break;}_context43.next=27;return l.consumeServiceAsync({isFullWork:!0,replaceId:l.getWorkId(),boxRect:this.thread.getSceneRect()});case 27:m=_context43.sent;case 28:_context43.next=30;return this.blurSelector({viewId:n,msgType:xt.Select,dataType:s,isSync:!0});case 30:_context43.next=32;return this._post({render:m&&[{rect:ve(m),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(m),drawCanvas:Ut.Bg,viewId:this.viewId}],sp:[{type:xt.GetTextActive,toolsType:Tt.Text,workId:c}]});case 32:case"end":return _context43.stop();}},_callee41,this,[[4,16,19,22]]);}));function checkTextActive(_x76){return _checkTextActive.apply(this,arguments);}return checkTextActive;}()},{key:"colloctEffectSelectWork",value:function(){var _colloctEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(t){var _this93=this;var r,n,s;return _regeneratorRuntime().wrap(function _callee42$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:r=this.workShapes.get(Me),n=t.workId,s=t.msgType;if(!(r&&n&&r.selectIds&&r.selectIds.includes(n.toString()))){_context44.next=6;break;}s===xt.RemoveNode?r.selectIds=r.selectIds.filter(function(c){return c!==n.toString();}):this.effectSelectNodeData.add(t);_context44.next=5;return this.runEffectSelectWork(!0).then(function(){var c;(c=_this93.effectSelectNodeData)==null||c.clear();});case 5:return _context44.abrupt("return");case 6:return _context44.abrupt("return",t);case 7:case"end":return _context44.stop();}},_callee42,this);}));function colloctEffectSelectWork(_x77){return _colloctEffectSelectWork.apply(this,arguments);}return colloctEffectSelectWork;}()},{key:"updateSelector",value:function(){var _updateSelector2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(t){var _this94=this;var C,r,n,s,c,l,f,h,m,u,y,T,E;return _regeneratorRuntime().wrap(function _callee43$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:r=this.workShapes.get(Me);if((C=r==null?void 0:r.selectIds)!=null&&C.length){_context45.next=3;break;}return _context45.abrupt("return");case 3:n=t.callback;s=_objectWithoutProperties(t,_excluded2);c=s.updateSelectorOpt;l=s.willSerializeData;f=s.smoothSync;_context45.next=10;return r==null?void 0:r.updateSelector({updateSelectorOpt:c,selectIds:fr(r.selectIds),vNodes:this.vNodes,willSerializeData:l,worker:this});case 10:h=_context45.sent;m=/* @__PURE__ */new Map();h!=null&&h.selectIds&&(u=zM(r.selectIds,h.selectIds),h.selectIds.forEach(function(x){var I=_this94.vNodes.get(x);if(I){var _d46=I.toolsType,v=I.op,p=I.opt;m.set(x,{opt:p,toolsType:_d46,ops:(v==null?void 0:v.length)&&gr(v)||void 0});}}),r.selectIds=h.selectIds);y=[],T=[];h!=null&&h.rect&&y.push({rect:ve(h.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(h.rect),drawCanvas:Ut.Bg,viewId:this.viewId});E=n&&n({res:h,workShapeNode:r,param:s,postData:{render:y,sp:T},newServiceStore:m,smoothSync:f})||{render:y,sp:T};u&&E.sp.push({type:xt.RemoveNode,removeIds:u,viewId:this.viewId});_context45.t0=E.render.length||E.sp.length;if(!_context45.t0){_context45.next=21;break;}_context45.next=21;return this._post(E);case 21:case"end":return _context45.stop();}},_callee43,this);}));function updateSelector(_x78){return _updateSelector2.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function(){var _blurSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(t){var s,r,n,c;return _regeneratorRuntime().wrap(function _callee44$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:r=this.workShapes.get(Me),n=r==null?void 0:r.blurSelector();if(!(this.clearWorkShapeNodeCache(Me),((s=this.fullLayer)==null?void 0:s.parent).children.forEach(function(c){c.name===Me&&c.remove();}),n)){_context46.next=6;break;}c=[];c.push(_objectSpread(_objectSpread({},n),{},{isSync:t==null?void 0:t.isSync}));_context46.next=6;return this._post({render:(n==null?void 0:n.rect)&&[{rect:ve(n.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(n.rect),drawCanvas:Ut.Bg,viewId:this.viewId}],sp:c});case 6:case"end":return _context46.stop();}},_callee44,this);}));function blurSelector(_x79){return _blurSelector.apply(this,arguments);}return blurSelector;}()},{key:"hasSelector",value:function hasSelector(){return this.workShapes.has(Me);}},{key:"getSelector",value:function getSelector(){return this.workShapes.get(Me);}},{key:"reRenderSelector",value:function(){var _reRenderSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(){var t,c,r,n,s,l,_args47=arguments;return _regeneratorRuntime().wrap(function _callee45$(_context47){while(1)switch(_context47.prev=_context47.next){case 0:t=_args47.length>0&&_args47[0]!==undefined?_args47[0]:!1;r=this.workShapes.get(Me);if(r){_context47.next=4;break;}return _context47.abrupt("return");case 4:if(!(r&&!((c=r.selectIds)!=null&&c.length))){_context47.next=8;break;}_context47.next=7;return this.blurSelector();case 7:return _context47.abrupt("return");case 8:n=r.oldSelectRect,s=r.reRenderSelector();if(!s){_context47.next=13;break;}l=Zt(n,s)||s;_context47.next=13;return this._post({render:[{rect:ve(l),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(l),drawCanvas:Ut.Bg,viewId:this.viewId}],sp:[{type:xt.Select,selectIds:r.selectIds,selectRect:s,willSyncService:t,viewId:this.viewId,points:r.getChildrenPoints(),textOpt:r.textOpt,selectorColor:r.selectorColor,strokeColor:r.strokeColor,fillColor:r.fillColor,canTextEdit:r.canTextEdit,canRotate:r.canRotate,scaleType:r.scaleType,opt:r.getWorkOptions()||void 0,canLock:r.canLock,isLocked:r.isLocked,toolsTypes:r.toolsTypes,shapeOpt:r.shapeOpt,thickness:r.thickness,useStroke:r.useStroke,strokeType:r.strokeType}]});case 13:case"end":return _context47.stop();}},_callee45,this);}));function reRenderSelector(){return _reRenderSelector.apply(this,arguments);}return reRenderSelector;}()},{key:"updateFullSelectWork",value:function(){var _updateFullSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(t){var s,c,l,f,h,m,u,r,n,_r$updateSelectIds,y,T,E;return _regeneratorRuntime().wrap(function _callee46$(_context48){while(1)switch(_context48.prev=_context48.next){case 0:r=this.workShapes.get(Me),n=t.selectIds;if(n!=null&&n.length){_context48.next=5;break;}_context48.next=4;return this.blurSelector(t);case 4:return _context48.abrupt("return");case 5:if(r){_context48.next=10;break;}!this.setFullWork(t)&&t.workId&&((s=this.tmpOpt)==null?void 0:s.toolsType)===Tt.Selector&&this.createWorkShape(t.workId.toString());_context48.next=9;return this.updateFullSelectWork(t);case 9:return _context48.abrupt("return");case 10:if(!(r&&n!=null&&n.length)){_context48.next=16;break;}_r$updateSelectIds=r.updateSelectIds(n),y=_r$updateSelectIds.bgRect,T=_r$updateSelectIds.selectRect,E={render:[],sp:[]};y&&((c=E.render)==null||c.push({rect:ve(y),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(y),drawCanvas:Ut.Bg,viewId:this.viewId}));(u=E.sp)==null||u.push(_objectSpread(_objectSpread({},t),{},{selectorColor:((l=t.opt)==null?void 0:l.strokeColor)||r.selectorColor,strokeColor:((f=t.opt)==null?void 0:f.strokeColor)||r.strokeColor,fillColor:((h=t.opt)==null?void 0:h.fillColor)||r.fillColor,textOpt:((m=t.opt)==null?void 0:m.textOpt)||r.textOpt,canTextEdit:r.canTextEdit,canRotate:r.canRotate,scaleType:r.scaleType,type:xt.Select,selectRect:T,points:r.getChildrenPoints(),willSyncService:(t==null?void 0:t.willSyncService)||!1,opt:(t==null?void 0:t.willSyncService)&&r.getWorkOptions()||void 0,canLock:r.canLock,isLocked:r.isLocked,toolsTypes:r.toolsTypes,shapeOpt:r.shapeOpt,thickness:r.thickness,useStroke:r.useStroke,strokeType:r.strokeType}));_context48.next=16;return this._post(E);case 16:case"end":return _context48.stop();}},_callee46,this);}));function updateFullSelectWork(_x80){return _updateFullSelectWork.apply(this,arguments);}return updateFullSelectWork;}()},{key:"destroy",value:function destroy(){this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1)),_superPropGet(ed,"destroy",this,3)([]),this.effectSelectNodeData.clear();}},{key:"drawEraserCombine",value:function(){var _drawEraserCombine=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(t,r){var s,c,l,f,n,h,m,u,y,_iterator61,_step61,_step61$value,_y5,T;return _regeneratorRuntime().wrap(function _callee47$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:n=(s=this.workShapes.get(t))==null?void 0:s.combineConsume({workerEngine:this});if(!n){_context49.next=7;break;}h=n.willDeleteNodes,m=n.willNewNodes,u={render:[],fullWorkerDrawCount:r,sp:[]};if(n!=null&&n.rect){y=ve(n.rect);(c=u.render)==null||c.push({rect:y,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:y,drawCanvas:Ut.Bg,viewId:this.viewId});}if(h!=null&&h.size&&((l=u.sp)==null||l.push({type:xt.RemoveNode,removeIds:_toConsumableArray(h),viewId:this.thread.viewId})),m!=null&&m.size){_iterator61=_createForOfIteratorHelper(m);try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){_step61$value=_slicedToArray(_step61.value,2),_y5=_step61$value[0],T=_step61$value[1];(f=u.sp)==null||f.push({type:xt.FullWork,dataType:Vt.Local,toolsType:Tt.Pencil,ops:gr(T.op),opt:T.opt,workId:_y5,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}}_context49.next=7;return this._post(u);case 7:case"end":return _context49.stop();}},_callee47,this);}));function drawEraserCombine(_x81,_x82){return _drawEraserCombine.apply(this,arguments);}return drawEraserCombine;}()},{key:"drawPencilCombine",value:function(){var _drawPencilCombine=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(t,r){var s,c,l,n,f,h;return _regeneratorRuntime().wrap(function _callee48$(_context50){while(1)switch(_context50.prev=_context50.next){case 0:n=(s=this.workShapes.get(t))==null?void 0:s.combineConsume();if(!n){_context50.next=6;break;}f={render:[],fullWorkerDrawCount:r};if(n!=null&&n.rect){h=ve(n.rect);(c=f.render)==null||c.push({rect:h,isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId}),(l=f.render)==null||l.push({rect:h,drawCanvas:Ut.Float,viewId:this.viewId});}_context50.next=6;return this._post(f);case 6:case"end":return _context50.stop();}},_callee48,this);}));function drawPencilCombine(_x83,_x84){return _drawPencilCombine.apply(this,arguments);}return drawPencilCombine;}()},{key:"drawSelector",value:function(){var _drawSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(t,r){var s,c,n;return _regeneratorRuntime().wrap(function _callee49$(_context51){while(1)switch(_context51.prev=_context51.next){case 0:n={render:[],sp:[t]};r&&((s=n.sp)==null||s.push({type:xt.None,isLockSentEventCursor:r}));t.rect&&((c=n.render)==null||c.push({rect:ve(t.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(t.rect),drawCanvas:Ut.Bg,viewId:this.viewId}));_context51.next=5;return this._post(n);case 5:case"end":return _context51.stop();}},_callee49,this);}));function drawSelector(_x85,_x86){return _drawSelector.apply(this,arguments);}return drawSelector;}()},{key:"drawPencilFull",value:function(){var _drawPencilFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(t,r){var s,c,n;return _regeneratorRuntime().wrap(function _callee50$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:n={fullWorkerDrawCount:1/0,render:[],sp:[t]};r&&((s=n.sp)==null||s.push({type:xt.None,isLockSentEventCursor:r}));t!=null&&t.rect&&((c=n.render)==null||c.push({isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:t.rect,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:t.rect,drawCanvas:Ut.Bg,viewId:this.viewId}));_context52.next=5;return this._post(n);case 5:case"end":return _context52.stop();}},_callee50,this);}));function drawPencilFull(_x87,_x88){return _drawPencilFull.apply(this,arguments);}return drawPencilFull;}()},{key:"drawEraserFull",value:function(){var _drawEraserFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(t,r,n){var s,c,l,f,h,m,_iterator62,_step62,_step62$value,y,T,_iterator63,_step63,_step63$value,_y6,_T10,u;return _regeneratorRuntime().wrap(function _callee51$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:s=r.rect,c=r.willUpdateNodes,l=r.willDeleteNodes,f=r.willNewNodes,h=t.getWorkId(),m=[{type:xt.RemoveNode,removeIds:[h],viewId:this.viewId}];if(n&&m.push({type:xt.None,isLockSentEventCursor:n}),c!=null&&c.size||l!=null&&l.size||f!=null&&f.size){if(c!=null&&c.size){_iterator62=_createForOfIteratorHelper(c);try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){_step62$value=_slicedToArray(_step62.value,2),y=_step62$value[0],T=_step62$value[1];m.push({type:xt.UpdateNode,dataType:Vt.Local,opt:T.opt,workId:y,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}}if(l!=null&&l.size&&m.push({type:xt.RemoveNode,removeIds:_toConsumableArray(l),viewId:this.thread.viewId}),f!=null&&f.size){_iterator63=_createForOfIteratorHelper(f);try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){_step63$value=_slicedToArray(_step63.value,2),_y6=_step63$value[0],_T10=_step63$value[1];m.push({type:xt.FullWork,dataType:Vt.Local,toolsType:_T10.toolsType,ops:gr(_T10.op),opt:_T10.opt,workId:_y6,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}}}u=[{isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}];s&&u.push({rect:s,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:s,drawCanvas:Ut.Bg,viewId:this.viewId});_context53.next=6;return this._post({sp:m,render:u,fullWorkerDrawCount:1/0});case 6:case"end":return _context53.stop();}},_callee51,this);}));function drawEraserFull(_x89,_x90,_x91){return _drawEraserFull.apply(this,arguments);}return drawEraserFull;}()},{key:"drawEraser",value:function(){var _drawEraser=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(t,r){var n,s;return _regeneratorRuntime().wrap(function _callee52$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:n=[],s=[];r&&n.push({type:xt.None,isLockSentEventCursor:r});t.removeIds&&n.push(t);t.rect&&s.push({rect:t.rect,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:t.rect,drawCanvas:Ut.Bg,viewId:this.viewId});_context54.next=6;return this._post({sp:n,render:s,consumeCount:this.consumeCount});case 6:case"end":return _context54.stop();}},_callee52,this);}));function drawEraser(_x92,_x93){return _drawEraser.apply(this,arguments);}return drawEraser;}()},{key:"drawShape",value:function(){var _drawShape=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(t){return _regeneratorRuntime().wrap(function _callee53$(_context55){while(1)switch(_context55.prev=_context55.next){case 0:_context55.next=2;return this._post({fullWorkerDrawCount:this.drawCount,sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context55.stop();}},_callee53,this);}));function drawShape(_x94){return _drawShape.apply(this,arguments);}return drawShape;}()},{key:"drawPencil",value:function(){var _drawPencil=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(t){return _regeneratorRuntime().wrap(function _callee54$(_context56){while(1)switch(_context56.prev=_context56.next){case 0:_context56.next=2;return this._post({sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context56.stop();}},_callee54,this);}));function drawPencil(_x95){return _drawPencil.apply(this,arguments);}return drawPencil;}()},{key:"runEffectSelectWork",value:function(){var _runEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(t){var r,_iterator64,_step64,n,s,c,l;return _regeneratorRuntime().wrap(function _callee55$(_context57){while(1)switch(_context57.prev=_context57.next){case 0:_iterator64=_createForOfIteratorHelper(this.effectSelectNodeData.values());_context57.prev=1;_iterator64.s();case 3:if((_step64=_iterator64.n()).done){_context57.next=23;break;}n=_step64.value;s=this.setFullWork(n);if(!s){_context57.next=21;break;}c=(r=s.getWorkId())==null?void 0:r.toString();if(!(s.toolsType===Tt.Image)){_context57.next=13;break;}_context57.next=11;return s.consumeServiceAsync({isFullWork:!0,replaceId:c,worker:this});case 11:_context57.next=20;break;case 13:if(!(s.toolsType===Tt.Text)){_context57.next=18;break;}_context57.next=16;return s.consumeServiceAsync({isFullWork:!0,replaceId:c,boxRect:this.thread.getSceneRect()});case 16:_context57.next=20;break;case 18:l=n.ops&&Pi(n.ops);s.consumeService({op:l,isFullWork:!0,replaceId:c}),n!=null&&n.updateNodeOpt&&s.updataOptService(n.updateNodeOpt);case 20:n.workId&&this.workShapes["delete"](n.workId.toString());case 21:_context57.next=3;break;case 23:_context57.next=28;break;case 25:_context57.prev=25;_context57.t0=_context57["catch"](1);_iterator64.e(_context57.t0);case 28:_context57.prev=28;_iterator64.f();return _context57.finish(28);case 31:_context57.next=33;return this.reRenderSelector(t);case 33:case"end":return _context57.stop();}},_callee55,this,[[1,25,28,31]]);}));function runEffectSelectWork(_x96){return _runEffectSelectWork.apply(this,arguments);}return runEffectSelectWork;}()},{key:"cursorHover",value:function(){var _cursorHover=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(t){var l,r,n,s,c,f,h;return _regeneratorRuntime().wrap(function _callee56$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:r=t.opt,n=t.toolsType,s=t.point,c=this.setFullWork({workId:pi,toolsType:n,opt:r});if(!(c&&s)){_context58.next=8;break;}f=c.cursorHover(s),h={render:[]};_context58.t0=f&&f.type===xt.CursorHover&&f.rect;if(!_context58.t0){_context58.next=8;break;}(l=h.render)==null||l.push({rect:ve(f.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(f.rect),drawCanvas:Ut.Bg,viewId:this.viewId});_context58.next=8;return this._post(h);case 8:case"end":return _context58.stop();}},_callee56,this);}));function cursorHover(_x97){return _cursorHover.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(){var n,t,r;return _regeneratorRuntime().wrap(function _callee57$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:t=this.getWorkShape(pi);_context59.t0=t&&(n=t.selectIds)!=null&&n.length;if(!_context59.t0){_context59.next=10;break;}r=t.oldSelectRect;t.cursorBlur();this.clearWorkShapeNodeCache(pi);_context59.t1=r;if(!_context59.t1){_context59.next=10;break;}_context59.next=10;return this._post({render:[{rect:ve(r),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(r),drawCanvas:Ut.Bg,viewId:this.viewId}]});case 10:this.fullLayer.parent.children.forEach(function(s){s.name==="Cursor_Hover_Id"&&s.remove();});case 11:case"end":return _context59.stop();}},_callee57,this);}));function cursorBlur(){return _cursorBlur.apply(this,arguments);}return cursorBlur;}()}]);}(bl);var rd=/*#__PURE__*/function(){function rd(e){_classCallCheck(this,rd);dt(this,"viewId");dt(this,"vNodes");dt(this,"fullLayer");dt(this,"drawLayer");dt(this,"workShapes",/* @__PURE__ */new Map());dt(this,"selectorWorkShapes",/* @__PURE__ */new Map());dt(this,"thread");dt(this,"animationId");dt(this,"willRunEffectSelectorIds",/* @__PURE__ */new Set());dt(this,"runEffectId");dt(this,"noAnimationRect");dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"post");this.viewId=e.viewId,this.vNodes=e.vNodes,this.fullLayer=e.fullLayer,this.drawLayer=e.drawLayer,this.thread=e.thread,this.post=e.thread.post.bind(e.thread);}return _createClass(rd,[{key:"destroy",value:function destroy(){this.workShapes.clear(),this.selectorWorkShapes.clear(),this.willRunEffectSelectorIds.clear();}},{key:"consumeDraw",value:function(){var _consumeDraw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e){return _regeneratorRuntime().wrap(function _callee58$(_context60){while(1)switch(_context60.prev=_context60.next){case 0:this.activeWorkShape(e),this.runAnimation();case 1:case"end":return _context60.stop();}},_callee58,this);}));function consumeDraw(_x98){return _consumeDraw2.apply(this,arguments);}return consumeDraw;}()},{key:"consumeFull",value:function consumeFull(e){this.activeWorkShape(e),this.runAnimation();}},{key:"runSelectWork",value:function runSelectWork(e){this.activeSelectorShape(e);var t=e.workId,r=t==null?void 0:t.toString();r&&this.willRunEffectSelectorIds.add(r),this.runEffect();}},{key:"setNodeKey",value:function setNodeKey(e,t,r,n){return t.toolsType=r,t.node=To({workId:e,toolsType:r,toolsOpt:n,vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer},this),t;}},{key:"runReverseSelectWork",value:function runReverseSelectWork(e){var _this95=this;e.forEach(function(t){_this95.selectorWorkShapes.forEach(function(r,n){var s;if((s=r.selectIds)!=null&&s.length){var c=r.selectIds.indexOf(t);c>-1&&(r.selectIds.splice(c,1),_this95.willRunEffectSelectorIds.add(n));}});}),this.willRunEffectSelectorIds.size&&this.runEffect();}},{key:"removeWork",value:function(){var _removeWork3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e){var t,r,n;return _regeneratorRuntime().wrap(function _callee59$(_context61){while(1)switch(_context61.prev=_context61.next){case 0:t=e.workId,r=t==null?void 0:t.toString();if(!r){_context61.next=10;break;}n=this.workShapes.get(r);if(!n){_context61.next=8;break;}this.workShapes["delete"](r);_context61.next=7;return this.removeNode(r,e,n==null?void 0:n.totalRect,!1);case 7:return _context61.abrupt("return");case 8:_context61.next=10;return this.removeNode(r,e);case 10:case"end":return _context61.stop();}},_callee59,this);}));function removeWork(_x99){return _removeWork3.apply(this,arguments);}return removeWork;}()},{key:"removeSelectWork",value:function removeSelectWork(e){var t=e.workId,r=t==null?void 0:t.toString();r&&(this.activeSelectorShape(e),this.willRunEffectSelectorIds.add(r)),this.runEffect();}},{key:"removeNode",value:function(){var _removeNode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e,t,r){var _this96=this;var n,h,s,c,l,f,_args62=arguments;return _regeneratorRuntime().wrap(function _callee60$(_context62){while(1)switch(_context62.prev=_context62.next){case 0:n=_args62.length>3&&_args62[3]!==undefined?_args62[3]:!0;e.indexOf(Me)>-1&&this.removeSelectWork(t);s=r;c=(h=this.vNodes.get(e))==null?void 0:h.rect;c&&(s=Zt(c,s));l=this.fullLayer&&$t.getRectFromLayer(this.fullLayer,e);s=Zt(s,l);f=this.drawLayer&&$t.getRectFromLayer(this.drawLayer,e);s=Zt(s,f);this.fullLayer.getElementsByName(e).forEach(function(m){m.remove(),_pr(m,_this96.fullLayer.parent);});this.drawLayer.getElementsByName(e).forEach(function(m){m.remove(),_pr(m,_this96.drawLayer.parent);});this.vNodes["delete"](e);_context62.t0=s;if(!_context62.t0){_context62.next=16;break;}_context62.next=16;return this.post({render:[{rect:ve(s),isClear:!0,clearCanvas:n?Ut.Bg:Ut.ServiceFloat,workerType:n?void 0:Vt.Service,viewId:this.viewId},{rect:ve(s),drawCanvas:n?Ut.Bg:Ut.ServiceFloat,workerType:n?void 0:Vt.Service,viewId:this.viewId}]});case 16:case"end":return _context62.stop();}},_callee60,this);}));function removeNode(_x100,_x101,_x102){return _removeNode.apply(this,arguments);}return removeNode;}()},{key:"activeWorkShape",value:function activeWorkShape(e){var E,C,x,I;var t=e.workId,r=e.opt,n=e.toolsType,s=e.type,c=e.updateNodeOpt,l=e.ops,f=e.op,h=e.useAnimation,m=e.isEnableCursor;if(!t)return;var u=t.toString(),y=(E=this.vNodes.get(u))==null?void 0:E.rect;if(!((C=this.workShapes)!=null&&C.has(u))){var _d47={toolsType:n,animationWorkData:f||[],animationIndex:0,type:s,updateNodeOpt:c,ops:l,useAnimation:_typeof(h)<"u"?h:_typeof(c==null?void 0:c.useAnimation)<"u"?c==null?void 0:c.useAnimation:!0,oldRect:y,isDiff:!1,isEnableCursor:m};n&&r&&(_d47=this.setNodeKey(u,_d47,n,r)),(x=this.workShapes)==null||x.set(u,_d47);}var T=(I=this.workShapes)==null?void 0:I.get(u);T.isEnableCursor=m,s&&(T.type=s),l&&(T.animationWorkData=Pi(l),T.ops=l),c&&(T.updateNodeOpt=c),f&&(T.isDiff=this.hasDiffData(T.animationWorkData||[],f,T.toolsType),T.animationWorkData=f),T.node&&T.node.getWorkId()!==u&&T.node.setWorkId(u),y&&(T.oldRect=y),n&&r&&(r.syncUnitTime&&(this.syncUnitTime=r.syncUnitTime),T.toolsType!==n&&n&&r&&this.setNodeKey(u,T,n,r),T.node&&T.node.setWorkOptions(r));}},{key:"hasDiffData",value:function hasDiffData(e,t,r){var n=e.length;if(t.length<n)return!0;switch(r){case Tt.Pencil:{for(var s=0;s<n;s+=3)if(t[s]!==e[s]||t[s+1]!==e[s+1])return!0;break;}case Tt.LaserPen:{for(var _s2=0;_s2<n;_s2+=2)if(t[_s2]!==e[_s2]||t[_s2+1]!==e[_s2+1])return!0;break;}}return!1;}},{key:"animationDraw",value:function(){var _animationDraw=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(){var _this97=this;var n,s,c,l,f,h,m,u,y,T,E,C,x,I,d,v,p,S,A,R,D,U,M,W,Y,B,N,G,J,tt,at,ut,K,Q,ft,gt,mt,wt,ht,Nt,e,t,r,_iterator65,_step65,_loop6;return _regeneratorRuntime().wrap(function _callee61$(_context64){while(1)switch(_context64.prev=_context64.next){case 0:this.animationId=void 0;e=!1;t={render:[]},r=/* @__PURE__ */new Map();_iterator65=_createForOfIteratorHelper(this.workShapes.entries());_context64.prev=4;_loop6=/*#__PURE__*/_regeneratorRuntime().mark(function _loop6(){var _step65$value,Rt,X,z,q,_z,_q,_z2,_q2,nt,j,_z3,_q3,_nt,_j2,Z,O,L,_O2,_z4,_q4,_nt2,_j3;return _regeneratorRuntime().wrap(function _loop6$(_context63){while(1)switch(_context63.prev=_context63.next){case 0:_step65$value=_slicedToArray(_step65.value,2),Rt=_step65$value[0],X=_step65$value[1];_context63.t0=X.toolsType;_context63.next=_context63.t0===Tt.Image?4:_context63.t0===Tt.Text?11:_context63.t0===Tt.Arrow?19:_context63.t0===Tt.Straight?19:_context63.t0===Tt.Rectangle?19:_context63.t0===Tt.Ellipse?19:_context63.t0===Tt.Star?19:_context63.t0===Tt.Polygon?19:_context63.t0===Tt.SpeechBalloon?19:_context63.t0===Tt.Pencil?22:38;break;case 4:z=X.oldRect;z&&((n=t.render)==null||n.push({rect:z,isClear:!0,clearCanvas:Ut.Bg,viewId:_this97.viewId}),(s=t.render)==null||s.push({rect:z,drawCanvas:Ut.Bg,viewId:_this97.viewId}));_context63.next=8;return(c=X.node)==null?void 0:c.consumeServiceAsync({isFullWork:!0,worker:_this97.thread});case 8:q=_context63.sent;_this97.selectorWorkShapes.forEach(function(nt,j){var Z;(Z=nt.selectIds)!=null&&Z.includes(Rt)&&(_this97.willRunEffectSelectorIds.add(j),_this97.noAnimationRect=Zt(_this97.noAnimationRect,z),_this97.noAnimationRect=Zt(_this97.noAnimationRect,q),_this97.runEffect());}),_this97.workShapes["delete"](Rt),(l=t.render)==null||l.push({rect:q,drawCanvas:Ut.Bg,viewId:_this97.viewId});return _context63.abrupt("break",38);case 11:if(!X.node){_context63.next=18;break;}_z=X.oldRect;_z&&((f=t.render)==null||f.push({rect:_z,isClear:!0,clearCanvas:Ut.Bg,viewId:_this97.viewId}),(h=t.render)==null||h.push({rect:_z,drawCanvas:Ut.Bg,viewId:_this97.viewId}));_context63.next=16;return X.node.consumeServiceAsync({isFullWork:!0,replaceId:Rt,boxRect:_this97.thread.getSceneRect()});case 16:_q=_context63.sent;_this97.selectorWorkShapes.forEach(function(nt,j){var Z;(Z=nt.selectIds)!=null&&Z.includes(Rt)&&(_this97.willRunEffectSelectorIds.add(j),_this97.noAnimationRect=Zt(_this97.noAnimationRect,_z),_this97.noAnimationRect=Zt(_this97.noAnimationRect,_q),_this97.runEffect());}),(m=X.node)==null||m.clearTmpPoints(),_this97.workShapes["delete"](Rt),(u=t.render)==null||u.push({rect:_q,drawCanvas:Ut.Bg,viewId:_this97.viewId});case 18:return _context63.abrupt("break",38);case 19:_z2=!!X.ops;if((y=X.animationWorkData)!=null&&y.length){_q2=X.oldRect,nt=X.node.oldRect;_q2&&((T=t.render)==null||T.push({rect:_q2,isClear:!0,clearCanvas:Ut.Bg,viewId:_this97.viewId}),(E=t.render)==null||E.push({rect:_q2,drawCanvas:Ut.Bg,viewId:_this97.viewId})),nt&&((C=t.render)==null||C.push({rect:nt,isClear:!0,clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId}));j=(x=X.node)==null?void 0:x.consumeService({op:X.animationWorkData,isFullWork:_z2});X.isEnableCursor?r.set(Rt,{workState:_q2?X.ops?te.Done:te.Doing:te.Start,op:X.animationWorkData.slice(-3,-1)}):_z2&&!X.useAnimation&&(I=X.updateNodeOpt)!=null&&I.useAnimation&&r.set(Rt,{workState:te.Done,op:X.animationWorkData.slice(-3,-1),uid:(d=X.updateNodeOpt)==null?void 0:d.uid}),_z2?(_this97.selectorWorkShapes.forEach(function(Z,O){var L;(L=Z.selectIds)!=null&&L.includes(Rt)&&(_this97.willRunEffectSelectorIds.add(O),_this97.noAnimationRect=Zt(_this97.noAnimationRect,_q2),_this97.noAnimationRect=Zt(_this97.noAnimationRect,nt),_this97.noAnimationRect=Zt(_this97.noAnimationRect,j),_this97.runEffect());}),(v=X.node)==null||v.clearTmpPoints(),_this97.workShapes["delete"](Rt),(p=t.render)==null||p.push({rect:j,drawCanvas:Ut.Bg,viewId:_this97.viewId})):(S=t.render)==null||S.push({rect:j,drawCanvas:Ut.ServiceFloat,workerType:_z2?void 0:Vt.Service,viewId:_this97.viewId}),X.animationWorkData.length=0;}return _context63.abrupt("break",38);case 22:if(!X.useAnimation){_context63.next=33;break;}if(!X.useAnimation){_context63.next=31;break;}if(!X.isDel){_context63.next=27;break;}(at=X.node)==null||at.clearTmpPoints(),_this97.workShapes["delete"](Rt);return _context63.abrupt("break",38);case 27:_z3=3,_q3=_this97.computNextAnimationIndex(X,_z3),_nt=X.isDiff?0:Math.max(0,(X.animationIndex||0)-_z3),_j2=(X.animationWorkData||[]).slice(0,_q3),Z=(K=(ut=X.node)==null?void 0:ut.getWorkId())==null?void 0:K.toString();if((X.animationIndex||0)<_q3||X.isDiff){O=(Q=X.node)==null?void 0:Q.consumeService({op:_j2,isFullWork:!1,replaceId:Z});if((ft=t.render)==null||ft.push({isClear:!0,rect:O,clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),(gt=t.render)==null||gt.push({rect:O,drawCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),X.animationIndex=_q3,X.isDiff&&(X.isDiff=!1),_j2.length&&X.isEnableCursor){L=_j2.slice(-3,-1);r.set(Rt,{workState:_nt===0?te.Start:_q3===((mt=X.animationWorkData)==null?void 0:mt.length)?te.Done:te.Doing,op:L});}}else if(X.ops){_O2=(wt=X.node)==null?void 0:wt.consumeService({op:X.animationWorkData||[],isFullWork:!0,replaceId:Z});X.isDel=!0,(ht=t.render)==null||ht.push({isClear:!0,rect:_O2,clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId},{rect:_O2,drawCanvas:Ut.ServiceFloat,viewId:_this97.viewId},{isClear:!0,rect:_O2,clearCanvas:Ut.Bg,viewId:_this97.viewId},{rect:_O2,drawCanvas:Ut.Bg,viewId:_this97.viewId}),X.isEnableCursor&&r.set(Rt,{workState:te.Done,op:_j2.slice(-3,-1)});}e=!0;return _context63.abrupt("break",38);case 31:_context63.next=37;break;case 33:_z4=!!X.ops;_q4=(A=X.node)==null?void 0:A.consumeService({op:X.animationWorkData||[],isFullWork:_z4,replaceId:Rt});_nt2=(R=X.node)==null?void 0:R.updataOptService(X.updateNodeOpt);if(_z4){if(_q4=Zt(_q4,_nt2),(D=t.render)==null||D.push({isClear:!0,rect:Zt(X.oldRect,_q4),clearCanvas:Ut.Bg,viewId:_this97.viewId}),(U=t.render)==null||U.push({rect:Zt(X.oldRect,_q4),drawCanvas:Ut.Bg,viewId:_this97.viewId}),(M=X.updateNodeOpt)!=null&&M.useAnimation&&((W=t.render)==null||W.push({isClear:!0,rect:Zt(X.oldRect,_q4),clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),(Y=t.render)==null||Y.push({rect:Zt(X.oldRect,_q4),drawCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),!X.isEnableCursor&&(B=X.animationWorkData)!=null&&B.length)){_j3=X.animationWorkData.slice(-3,-1);r.set(Rt,{workState:te.Done,op:_j3,uid:(N=X.updateNodeOpt)==null?void 0:N.uid});}_this97.selectorWorkShapes.forEach(function(j,Z){var O;(O=j.selectIds)!=null&&O.includes(Rt)&&(_this97.willRunEffectSelectorIds.add(Z),_this97.noAnimationRect=Zt(_this97.noAnimationRect,_q4),_this97.runEffect());}),(G=X.node)==null||G.clearTmpPoints(),_this97.workShapes["delete"](Rt);}else _q4=Zt(_q4,_nt2),(J=t.render)==null||J.push({isClear:!0,rect:Zt(X.oldRect,_q4),clearCanvas:Ut.ServiceFloat,viewId:_this97.viewId}),(tt=t.render)==null||tt.push({rect:Zt(X.oldRect,_q4),drawCanvas:Ut.ServiceFloat,viewId:_this97.viewId});case 37:return _context63.abrupt("break",38);case 38:case"end":return _context63.stop();}},_loop6);});_iterator65.s();case 7:if((_step65=_iterator65.n()).done){_context64.next=11;break;}return _context64.delegateYield(_loop6(),"t0",9);case 9:_context64.next=7;break;case 11:_context64.next=16;break;case 13:_context64.prev=13;_context64.t1=_context64["catch"](4);_iterator65.e(_context64.t1);case 16:_context64.prev=16;_iterator65.f();return _context64.finish(16);case 19:e&&this.runAnimation();r.size&&(t.sp=[],r.forEach(function(Rt,X){var z;(z=t.sp)==null||z.push({type:xt.Cursor,uid:Rt.uid||X.split(yi)[0],op:Rt.op,workState:Rt.workState,viewId:_this97.viewId});}));_context64.t2=(Nt=t.render)!=null&&Nt.length;if(!_context64.t2){_context64.next=25;break;}_context64.next=25;return this.post(t);case 25:case"end":return _context64.stop();}},_callee61,this,[[4,13,16,19]]);}));function animationDraw(){return _animationDraw.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var _this98=this;this.animationId||(this.animationId=setTimeout(function(){_this98.animationId=void 0,_this98.animationDraw();},16));}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(e,t){var r=Math.floor((e.animationWorkData||[]).slice(e.animationIndex).length*48/t/this.syncUnitTime)*t;return Math.min((e.animationIndex||0)+(r||t),(e.animationWorkData||[]).length);}},{key:"runEffect",value:function runEffect(){this.runEffectId||(this.runEffectId=setTimeout(this.effectRunSelector.bind(this),0));}},{key:"effectRunSelector",value:function(){var _effectRunSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(){var _this99=this;var e;return _regeneratorRuntime().wrap(function _callee62$(_context65){while(1)switch(_context65.prev=_context65.next){case 0:this.runEffectId=void 0;e=this.noAnimationRect;this.willRunEffectSelectorIds.forEach(function(t){var s,c;var r=_this99.selectorWorkShapes.get(t),n=r&&r.selectIds&&((s=r.node)==null?void 0:s.selectServiceNode(t,r,!0));e=Zt(e,n),(c=r==null?void 0:r.selectIds)!=null&&c.length||_this99.selectorWorkShapes["delete"](t);});_context65.t0=e;if(!_context65.t0){_context65.next=7;break;}_context65.next=7;return this.post({render:[{rect:ve(e),isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:ve(e),drawCanvas:Ut.Bg,viewId:this.viewId}]});case 7:this.willRunEffectSelectorIds.clear();this.noAnimationRect=void 0;case 9:case"end":return _context65.stop();}},_callee62,this);}));function effectRunSelector(){return _effectRunSelector.apply(this,arguments);}return effectRunSelector;}()},{key:"activeSelectorShape",value:function activeSelectorShape(e){var m,u,y;var t=e.workId,r=e.opt,n=e.toolsType,s=e.type,c=e.selectIds,l=e.imageBitmap;if(!t)return;var f=t.toString();if(!((m=this.selectorWorkShapes)!=null&&m.has(f))){var T={toolsType:n,selectIds:c,type:s,opt:r,imageBitmap:l};n&&r&&(T=this.setNodeKey(f,T,n,r)),(u=this.selectorWorkShapes)==null||u.set(f,T);}var h=(y=this.selectorWorkShapes)==null?void 0:y.get(f);s&&(h.type=s),h.node&&h.node.getWorkId()!==f&&h.node.setWorkId(f),l&&(h.imageBitmap=l),h.selectIds=c||[];}}]);}();var $M=/*#__PURE__*/function(_bl2){function $M(t){var _this100;_classCallCheck(this,$M);_this100=_callSuper(this,$M,[t]);dt(_this100,"drawWorkActiveId");return _this100;}// async runFullWork(data: IWorkerMessage): Promise<IRectType | undefined> {
|
|
484
484
|
// const workShape = this.setFullWork(data);
|
|
485
485
|
// const op = data.ops && transformToNormalData(data.ops);
|
|
486
486
|
// if (workShape) {
|
|
@@ -511,7 +511,7 @@ dt(this,"delayPostDoneResolve");dt(this,"cacheImages",/* @__PURE__ */new Map());
|
|
|
511
511
|
// return computRect(rect, updataOptRect);
|
|
512
512
|
// }
|
|
513
513
|
// }
|
|
514
|
-
_inherits($M,_bl2);return _createClass($M,[{key:"runSelectWork",value:function runSelectWork(t){var n;var r=this.setFullWork(t);r&&(n=t.selectIds)!=null&&n.length&&t.workId&&r.selectServiceNode(t.workId.toString(),{selectIds:t.selectIds},!1);}},{key:"workShapesDone",value:function workShapesDone(){var _iterator66=_createForOfIteratorHelper(this.workShapes.keys()),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var t=_step66.value;this.clearWorkShapeNodeCache(t);}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}Lr(this.fullLayer,this.fullLayer.parent);}},{key:"consumeDraw",value:function(){var _consumeDraw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee63(t){var r,n,s,c,l,f,h;return _regeneratorRuntime().wrap(function _callee63$(_context66){while(1)switch(_context66.prev=_context66.next){case 0:r=t.workId,n=t.fullWorkerDrawCount,s=t.postCount,c=r==null?void 0:r.toString(),l=c&&this.workShapes.get(c);if(l){_context66.next=3;break;}return _context66.abrupt("return");case 3:_context66.t0=this.drawWorkActiveId&&this.drawWorkActiveId!==c;if(!_context66.t0){_context66.next=8;break;}_context66.next=7;return this.consumeDrawAll({workId:this.drawWorkActiveId,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local});case 7:this.drawWorkActiveId=void 0;case 8:!this.drawWorkActiveId&&c!==Me&&(this.drawWorkActiveId=c);f=l.toolsType;er(s)&&(this.consumeCount=s);h=l.consume({data:t,drawCount:this.drawCount,isFullWork:!0,isSubWorker:!0,removeDrawCount:n});_context66.t1=f;_context66.next=_context66.t1===Tt.Selector?15:_context66.t1===Tt.Ellipse?21:_context66.t1===Tt.Arrow?21:_context66.t1===Tt.Straight?21:_context66.t1===Tt.Rectangle?21:_context66.t1===Tt.Star?21:_context66.t1===Tt.Polygon?21:_context66.t1===Tt.SpeechBalloon?21:_context66.t1===Tt.Pencil?27:_context66.t1===Tt.BitMapEraser?33:_context66.t1===Tt.PencilEraser?33:39;break;case 15:_context66.t2=h;if(!_context66.t2){_context66.next=20;break;}this.drawCount++;_context66.next=20;return this.drawSelector(h);case 20:return _context66.abrupt("break",39);case 21:_context66.t3=h;if(!_context66.t3){_context66.next=26;break;}this.drawCount++;_context66.next=26;return this.drawShape(h);case 26:return _context66.abrupt("break",39);case 27:_context66.t4=h;if(!_context66.t4){_context66.next=32;break;}this.drawCount++;_context66.next=32;return this.drawPencil(h,r==null?void 0:r.toString());case 32:return _context66.abrupt("break",39);case 33:_context66.t5=h;if(!_context66.t5){_context66.next=38;break;}this.drawCount++;_context66.next=38;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount});case 38:return _context66.abrupt("break",39);case 39:case"end":return _context66.stop();}},_callee63,this);}));function consumeDraw(_x103){return _consumeDraw3.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee64(t){var r,n,s;return _regeneratorRuntime().wrap(function _callee64$(_context67){while(1)switch(_context67.prev=_context67.next){case 0:r=t.workId;if(!r){_context67.next=14;break;}n=r.toString();this.drawWorkActiveId===n&&(this.drawWorkActiveId=void 0);s=this.workShapes.get(n);if(s){_context67.next=7;break;}return _context67.abrupt("return");case 7:_context67.t0=s.toolsType;_context67.next=_context67.t0===Tt.Selector?10:_context67.t0===Tt.Arrow?12:_context67.t0===Tt.Straight?12:_context67.t0===Tt.Ellipse?12:_context67.t0===Tt.Pencil?12:_context67.t0===Tt.Rectangle?12:_context67.t0===Tt.Star?12:_context67.t0===Tt.Polygon?12:_context67.t0===Tt.SpeechBalloon?12:_context67.t0===Tt.BitMapEraser?12:_context67.t0===Tt.PencilEraser?12:14;break;case 10:this.drawCount=0,Lr(this.fullLayer,this.fullLayer.parent),this.clearWorkShapeNodeCache(n),this._post({render:[{isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}]});return _context67.abrupt("break",14);case 12:this.drawCount=0,Lr(this.fullLayer,this.fullLayer.parent),this.clearWorkShapeNodeCache(n);return _context67.abrupt("break",14);case 14:case"end":return _context67.stop();}},_callee64,this);}));function consumeDrawAll(_x104){return _consumeDrawAll2.apply(this,arguments);}return consumeDrawAll;}()},{key:"removeWork",value:function(){var _removeWork4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee65(t){var r,n,s,c;return _regeneratorRuntime().wrap(function _callee65$(_context68){while(1)switch(_context68.prev=_context68.next){case 0:r=t.workId,n=r==null?void 0:r.toString();if(!n){_context68.next=8;break;}s=this.removeNode(n);if(!s){_context68.next=8;break;}c=[];c.push({rect:ve(s),clearCanvas:Ut.Float,isClear:!0,viewId:this.viewId},{rect:ve(s),drawCanvas:Ut.Float,viewId:this.viewId});_context68.next=8;return this._post({render:c});case 8:case"end":return _context68.stop();}},_callee65,this);}));function removeWork(_x105){return _removeWork4.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(t){var _this101=this;var r=this.workShapes.has(t);var n;return r&&(this.fullLayer.getElementsByName(t).forEach(function(s){var c=s.getBoundingClientRect();n=Zt(n,{x:c.x-$t.SafeBorderPadding,y:c.y-$t.SafeBorderPadding,w:c.width+$t.SafeBorderPadding*2,h:c.height+$t.SafeBorderPadding*2}),s.remove(),_pr(s,_this101.fullLayer.parent);}),n&&this.clearWorkShapeNodeCache(t)),n;}},{key:"drawPencil",value:function(){var _drawPencil2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(t,r){return _regeneratorRuntime().wrap(function _callee66$(_context69){while(1)switch(_context69.prev=_context69.next){case 0:_context69.next=2;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:t==null?void 0:t.rect,workId:r,drawCanvas:Ut.Float,viewId:this.viewId}],sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context69.stop();}},_callee66,this);}));function drawPencil(_x106,_x107){return _drawPencil2.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(t){return _regeneratorRuntime().wrap(function _callee67$(_context70){while(1)switch(_context70.prev=_context70.next){case 0:_context70.next=2;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:(t==null?void 0:t.rect)&&ve(t.rect),isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:(t==null?void 0:t.rect)&&ve(t.rect),drawCanvas:Ut.Float,viewId:this.viewId}]});case 2:case"end":return _context70.stop();}},_callee67,this);}));function drawShape(_x108){return _drawShape2.apply(this,arguments);}return drawShape;}()},{key:"drawSelector",value:function(){var _drawSelector2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee68(t){return _regeneratorRuntime().wrap(function _callee68$(_context71){while(1)switch(_context71.prev=_context71.next){case 0:_context71.next=2;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:(t==null?void 0:t.rect)&&ve(t.rect),isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:(t==null?void 0:t.rect)&&ve(t.rect),drawCanvas:Ut.Float,viewId:this.viewId}]});case 2:case"end":return _context71.stop();}},_callee68,this);}));function drawSelector(_x109){return _drawSelector2.apply(this,arguments);}return drawSelector;}()}]);}(bl);var jM=/*#__PURE__*/function(){function jM(e){_classCallCheck(this,jM);dt(this,"viewId");dt(this,"vNodes");dt(this,"topLayer");dt(this,"thread");dt(this,"post");dt(this,"serviceWorkShapes",/* @__PURE__ */new Map());dt(this,"localWorkShapes",/* @__PURE__ */new Map());dt(this,"tmpOpt");dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"animationId");this.viewId=e.viewId,this.vNodes=e.vNodes,this.topLayer=e.topLayer,this.thread=e.thread,this.post=e.thread.post.bind(e.thread);}return _createClass(jM,[{key:"canUseTopLayer",value:function canUseTopLayer(e){return e===Tt.LaserPen;}},{key:"getWorkShape",value:function getWorkShape(e){return this.localWorkShapes.get(e);}},{key:"createWorkShape",value:function createWorkShape(e,t){if(e&&this.tmpOpt){var r={toolsType:this.tmpOpt.toolsType,toolsOpt:t||this.tmpOpt.toolsOpt},n=this.createWorkShapeNode(_objectSpread(_objectSpread({},r),{},{workId:e}));return n&&this.localWorkShapes.set(e,{node:n,toolsType:n.toolsType,workState:te.Start}),n;}}},{key:"setWorkOptions",value:function setWorkOptions(e,t){var n;var r=(n=this.localWorkShapes.get(e))==null?void 0:n.node;r||this.createWorkShape(e,t),r==null||r.setWorkOptions(t);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(e){var t=e.toolsType;if(t===Tt.LaserPen)return To(_objectSpread(_objectSpread({},e),{},{vNodes:this.vNodes,fullLayer:this.topLayer,drawLayer:this.topLayer}));}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.localWorkShapes.forEach(function(e){var t;return(t=e.node)==null?void 0:t.clearTmpPoints();}),this.localWorkShapes.clear();}},{key:"setToolsOpt",value:function setToolsOpt(e){var t;this.tmpOpt=e,(t=e.toolsOpt)!=null&&t.syncUnitTime&&(this.syncUnitTime=e.toolsOpt.syncUnitTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"consumeDraw",value:function consumeDraw(e){var t=e.workId,r=e.dataType;if(r===Vt.Service)this.activeServiceWorkShape(e);else{var n=t==null?void 0:t.toString(),s=n&&this.localWorkShapes.get(n);if(!s)return;var c=s.node.consume({data:e,isFullWork:!1,isSubWorker:!0});c.rect&&(s.totalRect=Zt(c.rect,s.totalRect),s.result=c,s.workState=te.Doing,n&&this.localWorkShapes.set(n,s));}this.runAnimation();}},{key:"consumeDrawAll",value:function consumeDrawAll(e){var t=e.workId,r=e.dataType;if(r===Vt.Service)this.activeServiceWorkShape(e);else{var n=t==null?void 0:t.toString(),s=n&&this.localWorkShapes.get(n);if(!s)return;var c=s.node.consumeAll({data:e});s.totalRect=Zt(c.rect,s.totalRect),s.result=c,s.workState=te.Done,n&&this.localWorkShapes.set(n,s);}this.runAnimation();}},{key:"destroy",value:function destroy(){this.serviceWorkShapes.clear(),this.localWorkShapes.clear();}},{key:"setNodeKey",value:function setNodeKey(e,t,r,n){return t.toolsType=r,t.node=this.createWorkShapeNode({workId:e,toolsType:r,toolsOpt:n}),t;}},{key:"activeServiceWorkShape",value:function activeServiceWorkShape(e){var y,T;var t=e.workId,r=e.opt,n=e.toolsType,s=e.type,c=e.updateNodeOpt,l=e.ops,f=e.op;if(!t)return;var h=t.toString(),m=(y=this.vNodes.get(h))==null?void 0:y.rect;if(!((T=this.serviceWorkShapes)!=null&&T.has(h))){var E={toolsType:n,animationWorkData:f||[],animationIndex:0,type:s,updateNodeOpt:c,ops:l,oldRect:m};n&&r&&(E=this.setNodeKey(h,E,n,r)),this.serviceWorkShapes.set(h,E);}var u=this.serviceWorkShapes.get(h);s&&(u.type=s),l&&(u.animationWorkData=yi(l),u.ops=l),c&&(u.updateNodeOpt=c),f&&(u.animationWorkData=f),u.node&&u.node.getWorkId()!==h&&u.node.setWorkId(h),m&&(u.oldRect=m),n&&r&&(u.toolsType!==n&&n&&r&&this.setNodeKey(h,u,n,r),u.node&&u.node.setWorkOptions(r));}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(e,t){var r=Math.floor((e.animationWorkData||[]).slice(e.animationIndex).length*32/t/this.syncUnitTime)*t;return Math.min((e.animationIndex||0)+(r||t),(e.animationWorkData||[]).length);}},{key:"animationDraw",value:function(){var _animationDraw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee69(){var _this102=this;var c,l,f,h,e,t,r,n,s,_iterator67,_step67,_step67$value,m,u,T,E,C,x,_iterator68,_step68,_step68$value,_m14,_u7,y,_T11,_E3,_C5,_x110;return _regeneratorRuntime().wrap(function _callee69$(_context72){while(1)switch(_context72.prev=_context72.next){case 0:this.animationId=void 0;e=!1;t=/* @__PURE__ */new Map(),r=[],n=[],s=[];_iterator67=_createForOfIteratorHelper(this.serviceWorkShapes.entries());_context72.prev=4;_iterator67.s();case 6:if((_step67=_iterator67.n()).done){_context72.next=20;break;}_step67$value=_slicedToArray(_step67.value,2),m=_step67$value[0],u=_step67$value[1];_context72.t0=u.toolsType;_context72.next=_context72.t0===Tt.LaserPen?11:18;break;case 11:T=this.computNextAnimationIndex(u,8),E=Math.max(0,u.animationIndex||0),C=(u.animationWorkData||[]).slice(E,T);if((u.animationIndex||0)<T){x=(c=u.node)==null?void 0:c.consumeService({op:C,isFullWork:!1});u.totalRect=Zt(u.totalRect,x),u.animationIndex=T,C.length&&t.set(m,{workState:E===0?te.Start:T===((l=u.animationWorkData)==null?void 0:l.length)?te.Done:te.Doing,op:C.slice(-2)});}if(!(n.push({isClear:!0,rect:u.totalRect,clearCanvas:Ut.TopFloat,viewId:this.viewId}),r.push({rect:u.totalRect,drawCanvas:Ut.TopFloat,viewId:this.viewId}),u.isDel)){_context72.next=16;break;}(f=u.node)==null||f.clearTmpPoints(),this.serviceWorkShapes["delete"](m);return _context72.abrupt("break",18);case 16:u.ops&&u.animationIndex===((h=u.animationWorkData)==null?void 0:h.length)&&!u.isDel&&(this.topLayer.getElementsByName(m.toString())[0]||(u.isDel=!0,this.serviceWorkShapes.set(m,u))),e=!0;return _context72.abrupt("break",18);case 18:_context72.next=6;break;case 20:_context72.next=25;break;case 22:_context72.prev=22;_context72.t1=_context72["catch"](4);_iterator67.e(_context72.t1);case 25:_context72.prev=25;_iterator67.f();return _context72.finish(25);case 28:_iterator68=_createForOfIteratorHelper(this.localWorkShapes.entries());_context72.prev=29;_iterator68.s();case 31:if((_step68=_iterator68.n()).done){_context72.next=44;break;}_step68$value=_slicedToArray(_step68.value,2),_m14=_step68$value[0],_u7=_step68$value[1];y=_u7.result,_T11=_u7.toolsType,_E3=_u7.totalRect,_C5=_u7.isDel,_x110=_u7.workState;_context72.t2=_T11;_context72.next=_context72.t2===Tt.LaserPen?37:42;break;case 37:if(!(_E3&&(n.push({isClear:!0,rect:_E3,clearCanvas:Ut.TopFloat,viewId:this.viewId}),r.push({rect:_E3,drawCanvas:Ut.TopFloat,viewId:this.viewId})),_C5)){_context72.next=40;break;}_u7.node.clearTmpPoints(),this.localWorkShapes["delete"](_m14),s.push({removeIds:[_m14.toString()],viewId:this.viewId,type:xt.RemoveNode});return _context72.abrupt("break",42);case 40:y&&((y.op||y.ops)&&s.push(y),_u7.result=void 0),!this.topLayer.getElementsByName(_m14.toString())[0]&&_x110===te.Done&&(_u7.isDel=!0,this.localWorkShapes.set(_m14,_u7)),e=!0;return _context72.abrupt("break",42);case 42:_context72.next=31;break;case 44:_context72.next=49;break;case 46:_context72.prev=46;_context72.t3=_context72["catch"](29);_iterator68.e(_context72.t3);case 49:_context72.prev=49;_iterator68.f();return _context72.finish(49);case 52:e&&this.runAnimation(),t.size&&t.forEach(function(m,u){s.push({type:xt.Cursor,uid:u.split(mi)[0],op:m.op,workState:m.workState,viewId:_this102.viewId});}),(r.length||n.length||s.length)&&this.post({render:[].concat(n,r),sp:s});case 53:case"end":return _context72.stop();}},_callee69,this,[[4,22,25,28],[29,46,49,52]]);}));function animationDraw(){return _animationDraw2.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var _this103=this;this.animationId||(this.animationId=setTimeout(function(){_this103.animationId=void 0,_this103.animationDraw();},16));}}]);}();var GM=/*#__PURE__*/function(_ed){function GM(t){var _this104;_classCallCheck(this,GM);_this104=_callSuper(this,GM,[t]);dt(_this104,"_type","simple");return _this104;}_inherits(GM,_ed);return _createClass(GM,[{key:"createWorkShapeNode",value:function createWorkShapeNode(t){var n;var r=t.toolsType;return r===Tt.Selector?this.vNodes?new Gi(_objectSpread(_objectSpread({},t),{},{fullLayer:this.fullLayer,vNodes:this.vNodes,drawLayer:this.drawLayer})):void 0:To(_objectSpread(_objectSpread({},t),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(n=this.thread)==null?void 0:n.serviceWork);}},{key:"drawPencil",value:function(){var _drawPencil3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70(t,r){return _regeneratorRuntime().wrap(function _callee70$(_context73){while(1)switch(_context73.prev=_context73.next){case 0:_context73.next=2;return this._post({consumeCount:this.consumeCount,render:[{rect:t==null?void 0:t.rect,workId:r,drawCanvas:Ut.Float,viewId:this.viewId}],sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context73.stop();}},_callee70,this);}));function drawPencil(_x111,_x112){return _drawPencil3.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee71(t){return _regeneratorRuntime().wrap(function _callee71$(_context74){while(1)switch(_context74.prev=_context74.next){case 0:_context74.next=2;return this._post({consumeCount:this.consumeCount,sp:(t==null?void 0:t.op)&&[t],render:[{rect:(t==null?void 0:t.rect)&&ve(t.rect),isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:(t==null?void 0:t.rect)&&ve(t.rect),drawCanvas:Ut.Float,viewId:this.viewId}]});case 2:case"end":return _context74.stop();}},_callee71,this);}));function drawShape(_x113){return _drawShape3.apply(this,arguments);}return drawShape;}()},{key:"drawSelector",value:function(){var _drawSelector3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee72(t,r){var n,c,l,f,s,_args75=arguments;return _regeneratorRuntime().wrap(function _callee72$(_context75){while(1)switch(_context75.prev=_context75.next){case 0:n=_args75.length>2&&_args75[2]!==undefined?_args75[2]:[];s={render:n,sp:[t],consumeCount:this.consumeCount};r&&((c=s.sp)==null||c.push({type:xt.None,isLockSentEventCursor:r}));t.subRect&&((l=s.render)==null||l.push({rect:ve(t.subRect),isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:ve(t.subRect),drawCanvas:Ut.Float,viewId:this.viewId}));t.rect&&((f=s.render)==null||f.push({rect:ve(t.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(t.rect),drawCanvas:Ut.Bg,viewId:this.viewId}));_context75.next=7;return this._post(s);case 7:case"end":return _context75.stop();}},_callee72,this);}));function drawSelector(_x114,_x115){return _drawSelector3.apply(this,arguments);}return drawSelector;}()},{key:"drawEraserCombine",value:function(){var _drawEraserCombine2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee73(t){var n,s,c,l,r,f,h,m,u,_iterator69,_step69,_step69$value,_u8,y;return _regeneratorRuntime().wrap(function _callee73$(_context76){while(1)switch(_context76.prev=_context76.next){case 0:r=(n=this.workShapes.get(t))==null?void 0:n.combineConsume({workerEngine:this});if(!r){_context76.next=7;break;}f=r.willDeleteNodes,h=r.willNewNodes,m={render:[],sp:[]};if(r!=null&&r.rect){u=ve(r.rect);(s=m.render)==null||s.push({rect:u,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:u,drawCanvas:Ut.Bg,viewId:this.viewId});}if(f!=null&&f.size&&((c=m.sp)==null||c.push({type:xt.RemoveNode,removeIds:_toConsumableArray(f),viewId:this.thread.viewId})),h!=null&&h.size){_iterator69=_createForOfIteratorHelper(h);try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){_step69$value=_slicedToArray(_step69.value,2),_u8=_step69$value[0],y=_step69$value[1];(l=m.sp)==null||l.push({type:xt.FullWork,dataType:Vt.Local,toolsType:Tt.Pencil,ops:gr(y.op),opt:y.opt,workId:_u8,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}}_context76.next=7;return this._post(m);case 7:case"end":return _context76.stop();}},_callee73,this);}));function drawEraserCombine(_x116){return _drawEraserCombine2.apply(this,arguments);}return drawEraserCombine;}()},{key:"consumeDraw",value:function(){var _consumeDraw4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee74(t,r){var _this105=this;var n,s,c,l,f,h,m,u,y;return _regeneratorRuntime().wrap(function _callee74$(_context77){while(1)switch(_context77.prev=_context77.next){case 0:n=t.op,s=t.workId,c=t.scenePath,l=t.postCount,f=t.smoothSync;if(!(n!=null&&n.length&&s)){_context77.next=42;break;}h=s.toString(),m=this.getWorkShape(h);if(m){_context77.next=5;break;}return _context77.abrupt("return");case 5:u=m.toolsType;if(!(u===Tt.LaserPen)){_context77.next=8;break;}return _context77.abrupt("return");case 8:_context77.t0=this.drawWorkActiveId&&this.drawWorkActiveId!==h;if(!_context77.t0){_context77.next=13;break;}_context77.next=12;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:c,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local},r);case 12:this.drawWorkActiveId=void 0;case 13:!this.drawWorkActiveId&&h!==Me&&(this.drawWorkActiveId=h);er(l)&&(this.consumeCount=l);y=m.consume({data:t,isSimpleWorker:!0,smoothSync:f});_context77.t1=u;_context77.next=_context77.t1===Tt.Selector?19:_context77.t1===Tt.PencilEraser?24:_context77.t1===Tt.BitMapEraser?24:_context77.t1===Tt.Eraser?29:_context77.t1===Tt.Arrow?32:_context77.t1===Tt.Straight?32:_context77.t1===Tt.Ellipse?32:_context77.t1===Tt.Rectangle?32:_context77.t1===Tt.Star?32:_context77.t1===Tt.Polygon?32:_context77.t1===Tt.SpeechBalloon?32:_context77.t1===Tt.Pencil?38:42;break;case 19:this.drawCount++;y.type===xt.Select&&y.selectIds&&r.runReverseSelectWork(y.selectIds);_context77.next=23;return this.drawSelector(y);case 23:return _context77.abrupt("break",42);case 24:this.drawCount++;this.combineTimerId||(this.combineTimerId=1,this.combineDrawActiveId=h,this.drawEraserCombine(h).then(function(){_this105.combineTimerId=void 0;}));_context77.next=28;return this._post({consumeCount:this.consumeCount});case 28:return _context77.abrupt("break",42);case 29:_context77.next=31;return this.drawEraser(y);case 31:return _context77.abrupt("break",42);case 32:_context77.t2=y;if(!_context77.t2){_context77.next=37;break;}this.drawCount++;_context77.next=37;return this.drawShape(y);case 37:return _context77.abrupt("break",42);case 38:this.drawCount++;_context77.next=41;return this.drawPencil(y,h);case 41:return _context77.abrupt("break",42);case 42:case"end":return _context77.stop();}},_callee74,this);}));function consumeDraw(_x117,_x118){return _consumeDraw4.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee75(t,r){var l,f,h,n,s,c,m,u,y,T,E,C,x;return _regeneratorRuntime().wrap(function _callee75$(_context78){while(1)switch(_context78.prev=_context78.next){case 0:this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);n=t.workId,s=t.scenePath,c=t.isLockSentEventCursor;if(!n){_context78.next=40;break;}m=n.toString();this.drawWorkActiveId===m&&(this.drawWorkActiveId=void 0);u=this.workShapes.get(m);if(u){_context78.next=8;break;}return _context78.abrupt("return");case 8:y=u.toolsType;if(!(y===Tt.LaserPen)){_context78.next=11;break;}return _context78.abrupt("return");case 11:T=this.workShapes.get(di),E=(l=T==null?void 0:T.selectIds)==null?void 0:l[0],C=u.consumeAll({data:t,workerEngine:this});_context78.t0=y;_context78.next=_context78.t0===Tt.Selector?15:_context78.t0===Tt.PencilEraser?23:_context78.t0===Tt.BitMapEraser?23:_context78.t0===Tt.Eraser?28:_context78.t0===Tt.Arrow?30:_context78.t0===Tt.Straight?30:_context78.t0===Tt.Ellipse?30:_context78.t0===Tt.Rectangle?30:_context78.t0===Tt.Star?30:_context78.t0===Tt.Polygon?30:_context78.t0===Tt.SpeechBalloon?30:_context78.t0===Tt.Pencil?35:40;break;case 15:x=[];this.drawLayer&&(this.drawCount=0,Lr(this.drawLayer,this.drawLayer.parent),this.getWorkShape(m).clearSubTmpPoints(),x.push({isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}));C.selectIds&&E&&(f=C.selectIds)!=null&&f.includes(E)&&T.cursorBlur();C.selectIds&&r.runReverseSelectWork(C.selectIds);_context78.next=21;return this.drawSelector(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c,x);case 21:(h=u.selectIds)!=null&&h.length?u.clearTmpPoints():this.clearWorkShapeNodeCache(m);return _context78.abrupt("break",40);case 23:_context78.next=25;return this.drawEraserFull(u,_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 25:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context78.abrupt("break",40);case 28:this.drawEraser(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c),u.clearTmpPoints();return _context78.abrupt("break",40);case 30:_context78.next=32;return this.drawPencilFull(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 32:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context78.abrupt("break",40);case 35:_context78.next=37;return this.drawPencilFull(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 37:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context78.abrupt("break",40);case 40:case"end":return _context78.stop();}},_callee75,this);}));function consumeDrawAll(_x119,_x120){return _consumeDrawAll3.apply(this,arguments);}return consumeDrawAll;}()}]);}(ed);var HM=/*#__PURE__*/function(_rd){function HM(t){var _this106;_classCallCheck(this,HM);_this106=_callSuper(this,HM,[t]);dt(_this106,"_type","simple");return _this106;}_inherits(HM,_rd);return _createClass(HM,[{key:"animationDraw",value:function(){var _animationDraw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee76(){var _this107=this;var s,c,l,f,h,m,u,y,T,E,C,x,I,d,v,p,S,A,R,D,U,M,W,Y,B,N,G,J,tt,at,ut,K,Q,ft,gt,mt,wt,ht,Nt,Rt,t,r,n,_iterator70,_step70,_loop7;return _regeneratorRuntime().wrap(function _callee76$(_context80){while(1)switch(_context80.prev=_context80.next){case 0:this.animationId=void 0;t=!1;r={render:[]},n=/* @__PURE__ */new Map();_iterator70=_createForOfIteratorHelper(this.workShapes.entries());_context80.prev=4;_loop7=/*#__PURE__*/_regeneratorRuntime().mark(function _loop7(){var _step70$value,X,z,q,nt,_q5,_nt3,_q6,_nt4,j,Z,_q7,_nt5,_j4,_Z3,O,L,$,_L,_q8,_nt6,_j5,_Z4;return _regeneratorRuntime().wrap(function _loop7$(_context79){while(1)switch(_context79.prev=_context79.next){case 0:_step70$value=_slicedToArray(_step70.value,2),X=_step70$value[0],z=_step70$value[1];_context79.t0=z.toolsType;_context79.next=_context79.t0===Tt.Image?4:_context79.t0===Tt.Text?11:_context79.t0===Tt.Arrow?19:_context79.t0===Tt.Straight?19:_context79.t0===Tt.Rectangle?19:_context79.t0===Tt.Ellipse?19:_context79.t0===Tt.Star?19:_context79.t0===Tt.Polygon?19:_context79.t0===Tt.SpeechBalloon?19:_context79.t0===Tt.Pencil?22:38;break;case 4:q=z.oldRect;q&&((s=r.render)==null||s.push({rect:q,isClear:!0,clearCanvas:Ut.Bg,viewId:_this107.viewId}),(c=r.render)==null||c.push({rect:q,drawCanvas:Ut.Bg,viewId:_this107.viewId}));_context79.next=8;return(l=z.node)==null?void 0:l.consumeServiceAsync({isFullWork:!0,worker:_this107.thread});case 8:nt=_context79.sent;_this107.selectorWorkShapes.forEach(function(j,Z){var O;(O=j.selectIds)!=null&&O.includes(X)&&(_this107.willRunEffectSelectorIds.add(Z),_this107.noAnimationRect=Zt(_this107.noAnimationRect,q),_this107.noAnimationRect=Zt(_this107.noAnimationRect,nt),_this107.runEffect());}),_this107.workShapes["delete"](X),(f=r.render)==null||f.push({rect:nt,drawCanvas:Ut.Bg,viewId:_this107.viewId});return _context79.abrupt("break",38);case 11:if(!z.node){_context79.next=18;break;}_q5=z.oldRect;_q5&&((h=r.render)==null||h.push({rect:_q5,isClear:!0,clearCanvas:Ut.Bg,viewId:_this107.viewId}),(m=r.render)==null||m.push({rect:_q5,drawCanvas:Ut.Bg,viewId:_this107.viewId}));_context79.next=16;return z.node.consumeServiceAsync({isFullWork:!0,replaceId:X,boxRect:_this107.thread.getSceneRect()});case 16:_nt3=_context79.sent;_this107.selectorWorkShapes.forEach(function(j,Z){var O;(O=j.selectIds)!=null&&O.includes(X)&&(_this107.willRunEffectSelectorIds.add(Z),_this107.noAnimationRect=Zt(_this107.noAnimationRect,_q5),_this107.noAnimationRect=Zt(_this107.noAnimationRect,_nt3),_this107.runEffect());}),(u=z.node)==null||u.clearTmpPoints(),_this107.workShapes["delete"](X),(y=r.render)==null||y.push({rect:_nt3,drawCanvas:Ut.Bg,viewId:_this107.viewId});case 18:return _context79.abrupt("break",38);case 19:_q6=!!z.ops;if((T=z.animationWorkData)!=null&&T.length){_nt4=z.oldRect,j=z.node.oldRect;_nt4&&((E=r.render)==null||E.push({rect:_nt4,isClear:!0,clearCanvas:Ut.Bg,viewId:_this107.viewId}),(C=r.render)==null||C.push({rect:_nt4,drawCanvas:Ut.Bg,viewId:_this107.viewId})),j&&((x=r.render)==null||x.push({rect:j,isClear:!0,clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId}));Z=(I=z.node)==null?void 0:I.consumeService({op:z.animationWorkData,isFullWork:_q6});z.isEnableCursor?n.set(X,{workState:_nt4?z.ops?te.Done:te.Doing:te.Start,op:z.animationWorkData.slice(-3,-1)}):_q6&&!z.useAnimation&&(d=z.updateNodeOpt)!=null&&d.useAnimation&&n.set(X,{workState:te.Done,op:z.animationWorkData.slice(-3,-1),uid:(v=z.updateNodeOpt)==null?void 0:v.uid}),_q6?(_this107.selectorWorkShapes.forEach(function(O,L){var $;($=O.selectIds)!=null&&$.includes(X)&&(_this107.willRunEffectSelectorIds.add(L),_this107.noAnimationRect=Zt(_this107.noAnimationRect,_nt4),_this107.noAnimationRect=Zt(_this107.noAnimationRect,j),_this107.noAnimationRect=Zt(_this107.noAnimationRect,Z),_this107.runEffect());}),(p=z.node)==null||p.clearTmpPoints(),_this107.workShapes["delete"](X),(S=r.render)==null||S.push({rect:Z,drawCanvas:Ut.Bg,viewId:_this107.viewId})):(A=r.render)==null||A.push({rect:Z,drawCanvas:Ut.ServiceFloat,workerType:_q6?void 0:Vt.Service,viewId:_this107.viewId}),z.animationWorkData.length=0;}return _context79.abrupt("break",38);case 22:if(!z.useAnimation){_context79.next=33;break;}if(!z.useAnimation){_context79.next=31;break;}if(!z.isDel){_context79.next=27;break;}(ut=z.node)==null||ut.clearTmpPoints(),_this107.workShapes["delete"](X);return _context79.abrupt("break",38);case 27:_q7=3,_nt5=_this107.computNextAnimationIndex(z,_q7),_j4=z.isDiff?0:Math.max(0,(z.animationIndex||0)-_q7),_Z3=(z.animationWorkData||[]).slice(0,_nt5),O=(Q=(K=z.node)==null?void 0:K.getWorkId())==null?void 0:Q.toString();if((z.animationIndex||0)<_nt5||z.isDiff){L=(ft=z.node)==null?void 0:ft.consumeService({op:_Z3,isFullWork:!1,replaceId:O});if((gt=r.render)==null||gt.push({isClear:!0,rect:L,clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),(mt=r.render)==null||mt.push({rect:L,drawCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),z.animationIndex=_nt5,z.isDiff&&(z.isDiff=!1),_Z3.length&&z.isEnableCursor){$=_Z3.slice(-3,-1);n.set(X,{workState:_j4===0?te.Start:_nt5===((wt=z.animationWorkData)==null?void 0:wt.length)?te.Done:te.Doing,op:$});}}else if(z.ops){_L=(ht=z.node)==null?void 0:ht.consumeService({op:z.animationWorkData||[],isFullWork:!0,replaceId:O});z.isDel=!0,(Nt=r.render)==null||Nt.push({isClear:!0,rect:_L,clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId},{rect:_L,drawCanvas:Ut.ServiceFloat,viewId:_this107.viewId},{isClear:!0,rect:_L,clearCanvas:Ut.Bg,viewId:_this107.viewId},{rect:_L,drawCanvas:Ut.Bg,viewId:_this107.viewId}),z.isEnableCursor&&n.set(X,{workState:te.Done,op:_Z3.slice(-3,-1)});}t=!0;return _context79.abrupt("break",38);case 31:_context79.next=37;break;case 33:_q8=!!z.ops;_nt6=(R=z.node)==null?void 0:R.consumeService({op:z.animationWorkData||[],isFullWork:_q8,replaceId:X});_j5=(D=z.node)==null?void 0:D.updataOptService(z.updateNodeOpt);if(_q8){if(_nt6=Zt(_nt6,_j5),(U=r.render)==null||U.push({isClear:!0,rect:Zt(z.oldRect,_nt6),clearCanvas:Ut.Bg,viewId:_this107.viewId}),(M=r.render)==null||M.push({rect:Zt(z.oldRect,_nt6),drawCanvas:Ut.Bg,viewId:_this107.viewId}),(W=z.updateNodeOpt)!=null&&W.useAnimation&&((Y=r.render)==null||Y.push({isClear:!0,rect:Zt(z.oldRect,_nt6),clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),(B=r.render)==null||B.push({rect:Zt(z.oldRect,_nt6),drawCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),!z.isEnableCursor&&(N=z.animationWorkData)!=null&&N.length)){_Z4=z.animationWorkData.slice(-3,-1);n.set(X,{workState:te.Done,op:_Z4,uid:(G=z.updateNodeOpt)==null?void 0:G.uid});}_this107.selectorWorkShapes.forEach(function(Z,O){var L;(L=Z.selectIds)!=null&&L.includes(X)&&(_this107.willRunEffectSelectorIds.add(O),_this107.noAnimationRect=Zt(_this107.noAnimationRect,_nt6),_this107.runEffect());}),(J=z.node)==null||J.clearTmpPoints(),_this107.workShapes["delete"](X);}else _nt6=Zt(_nt6,_j5),(tt=r.render)==null||tt.push({isClear:!0,rect:Zt(z.oldRect,_nt6),clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),(at=r.render)==null||at.push({rect:Zt(z.oldRect,_nt6),drawCanvas:Ut.ServiceFloat,viewId:_this107.viewId});case 37:return _context79.abrupt("break",38);case 38:case"end":return _context79.stop();}},_loop7);});_iterator70.s();case 7:if((_step70=_iterator70.n()).done){_context80.next=11;break;}return _context80.delegateYield(_loop7(),"t0",9);case 9:_context80.next=7;break;case 11:_context80.next=16;break;case 13:_context80.prev=13;_context80.t1=_context80["catch"](4);_iterator70.e(_context80.t1);case 16:_context80.prev=16;_iterator70.f();return _context80.finish(16);case 19:t&&this.runAnimation();n.size&&(r.sp=[],n.forEach(function(X,z){var q;(q=r.sp)==null||q.push({type:xt.Cursor,uid:X.uid||z.split(mi)[0],op:X.op,workState:X.workState,viewId:_this107.viewId});}));_context80.t2=(Rt=r.render)!=null&&Rt.length;if(!_context80.t2){_context80.next=25;break;}_context80.next=25;return this.post(r);case 25:case"end":return _context80.stop();}},_callee76,this,[[4,13,16,19]]);}));function animationDraw(){return _animationDraw3.apply(this,arguments);}return animationDraw;}()}]);}(rd);var nd=/*#__PURE__*/function(_bl3){function nd(t){var _this108;_classCallCheck(this,nd);_this108=_callSuper(this,nd,[t]);dt(_this108,"opt");dt(_this108,"scene");dt(_this108,"cameraOpt");dt(_this108,"vNodes");_this108.opt=t,_this108.vNodes=void 0;return _this108;}_inherits(nd,_bl3);return _createClass(nd,[{key:"createSnapshotFullLayer",value:function createSnapshotFullLayer(t,r){this.scene=this.opt.createScene(t),this.fullLayer=this.opt.createLayer("snapshotFullLayer",this.scene,r);}},{key:"destroySnapshotFullLayer",value:function destroySnapshotFullLayer(){var t,r,n;Lr(this.fullLayer,this.fullLayer.parent),(t=this.fullLayer)==null||t.disconnect(),(r=this.fullLayer)==null||r.remove(),(n=this.scene)==null||n.remove(),this.scene=void 0;}},{key:"updateScene",value:function updateScene(t){if(!this.scene)throw new Error("SnapshotWork scene is not initialized");this.scene.attr(_objectSpread({},t));var r=t.width,n=t.height;this.scene.width=r,this.scene.height=n,this.updateLayer({width:r,height:n});}},{key:"updateLayer",value:function updateLayer(t){if(!this.fullLayer)throw new Error("SnapshotWork snapshotFullLayer is not initialized");var r=t.width,n=t.height;this.fullLayer.parent.setAttribute("width",r),this.fullLayer.parent.setAttribute("height",n),this.fullLayer.setAttribute("size",[r,n]),this.fullLayer.setAttribute("pos",[r*0.5,n*0.5]);}},{key:"setCameraOpt",value:function setCameraOpt(t){this.cameraOpt=t;var r=t.scale,n=t.centerX,s=t.centerY,c=t.width,l=t.height;if(!this.scene)throw new Error("SnapshotWork scene is not initialized");if(!this.fullLayer)throw new Error("SnapshotWork snapshotFullLayer is not initialized");(c!==this.scene.width||l!==this.scene.height)&&this.updateScene({width:c,height:l}),this.fullLayer.setAttribute("scale",[r,r]),this.fullLayer.setAttribute("translate",[-n,-s]);}},{key:"getOffscreen",value:function getOffscreen(){var r;return((r=this.fullLayer)==null?void 0:r.parent).canvas;}},{key:"getRectImageBitmap",value:function getRectImageBitmap(t,r){var n=t.rect,s=this.thread.dpr,c=Math.floor(n.x*s),l=Math.floor(n.y*s),f=Math.floor(n.w*s),h=Math.floor(n.h*s);return createImageBitmap(this.getOffscreen(),c,l,f,h,r);}},{key:"getSnapshot",value:function(){var _getSnapshot=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee77(t){var r,n,s,c,l,f,_i4,_Object$entries,_Object$entries$_i,m,u,y,T,E,h;return _regeneratorRuntime().wrap(function _callee77$(_context81){while(1)switch(_context81.prev=_context81.next){case 0:r=t.scenePath,n=t.scenes,s=t.cameraOpt,c=t.w,l=t.h;if(!(r&&n&&s&&this.fullLayer)){_context81.next=23;break;}this.setCameraOpt(s);_i4=0,_Object$entries=Object.entries(n);case 4:if(!(_i4<_Object$entries.length)){_context81.next=20;break;}_Object$entries$_i=_slicedToArray(_Object$entries[_i4],2),m=_Object$entries$_i[0],u=_Object$entries$_i[1];if(!(u!=null&&u.type)){_context81.next=17;break;}_context81.t0=u==null?void 0:u.type;_context81.next=_context81.t0===xt.UpdateNode?10:_context81.t0===xt.FullWork?10:17;break;case 10:y=u.opt;T=_objectSpread(_objectSpread({},u),{},{opt:y,workId:m,msgType:xt.FullWork,dataType:Vt.Service,viewId:this.viewId});_context81.next=14;return this.runFullWork(T);case 14:E=_context81.sent;f=Zt(f,E);return _context81.abrupt("break",17);case 17:_i4++;_context81.next=4;break;case 20:c&&l&&(h={resizeWidth:c,resizeHeight:l});_context81.next=23;return this.getSnapshotRender({scenePath:r,options:h});case 23:case"end":return _context81.stop();}},_callee77,this);}));function getSnapshot(_x121){return _getSnapshot.apply(this,arguments);}return getSnapshot;}()},{key:"runFullWork",value:function(){var _runFullWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee78(t){var s,r,n,c,l,f;return _regeneratorRuntime().wrap(function _callee78$(_context82){while(1)switch(_context82.prev=_context82.next){case 0:r=this.setFullWork(t),n=t.ops&&yi(t.ops);if(!r){_context82.next=18;break;}f=(s=r.getWorkId())==null?void 0:s.toString();if(!(r.toolsType===Tt.Image)){_context82.next=9;break;}_context82.next=6;return r.consumeServiceAsync({isFullWork:!0,worker:this.thread});case 6:c=_context82.sent;_context82.next=16;break;case 9:if(!(r.toolsType===Tt.Text)){_context82.next=15;break;}_context82.next=12;return r.consumeServiceAsync({isFullWork:!0,replaceId:f,isDrawLabel:!0});case 12:c=_context82.sent;_context82.next=16;break;case 15:c=r.consumeService({op:n,isFullWork:!0,replaceId:f}),l=(t==null?void 0:t.updateNodeOpt)&&r.updataOptService(t.updateNodeOpt);case 16:t.workId&&this.workShapes["delete"](t.workId.toString());return _context82.abrupt("return",Zt(c,l));case 18:case"end":return _context82.stop();}},_callee78,this);}));function runFullWork(_x122){return _runFullWork.apply(this,arguments);}return runFullWork;}()},{key:"getSceneRect",value:function getSceneRect(){if(!this.scene)throw new Error("SnapshotWork scene is not initialized");var _this$scene2=this.scene,t=_this$scene2.width,r=_this$scene2.height;return{x:0,y:0,w:Math.floor(t),h:Math.floor(r)};}},{key:"getSnapshotRender",value:function(){var _getSnapshotRender=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee79(t){var c,r,n,s;return _regeneratorRuntime().wrap(function _callee79$(_context83){while(1)switch(_context83.prev=_context83.next){case 0:r=t.scenePath,n=t.options;((c=this.fullLayer)==null?void 0:c.parent).render();_context83.next=4;return this.getRectImageBitmap({rect:this.getSceneRect(),drawCanvas:Ut.None},n);case 4:s=_context83.sent;s&&(this.thread._post({sp:[{type:xt.Snapshot,scenePath:r,imageBitmap:s,viewId:this.viewId}]},[s]),s.close());case 6:case"end":return _context83.stop();}},_callee79,this);}));function getSnapshotRender(_x123){return _getSnapshotRender.apply(this,arguments);}return getSnapshotRender;}()},{key:"getBoundingRect",value:function(){var _getBoundingRect=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee80(t){var r,n,s,c,_i5,_Object$entries2,_Object$entries2$_i,l,f,h;return _regeneratorRuntime().wrap(function _callee80$(_context84){while(1)switch(_context84.prev=_context84.next){case 0:r=t.scenePath,n=t.scenes,s=t.cameraOpt;if(!(r&&n&&s&&this.fullLayer)){_context84.next=19;break;}this.setCameraOpt(s);_i5=0,_Object$entries2=Object.entries(n);case 4:if(!(_i5<_Object$entries2.length)){_context84.next=18;break;}_Object$entries2$_i=_slicedToArray(_Object$entries2[_i5],2),l=_Object$entries2$_i[0],f=_Object$entries2$_i[1];if(!(f!=null&&f.type)){_context84.next=15;break;}_context84.t0=f==null?void 0:f.type;_context84.next=_context84.t0===xt.UpdateNode?10:_context84.t0===xt.FullWork?10:15;break;case 10:_context84.next=12;return this.runFullWork(_objectSpread(_objectSpread({},f),{},{workId:l,msgType:xt.FullWork,dataType:Vt.Service,viewId:this.viewId}));case 12:h=_context84.sent;c=Zt(c,h);return _context84.abrupt("break",15);case 15:_i5++;_context84.next=4;break;case 18:c&&this.thread._post({sp:[{type:xt.BoundingBox,scenePath:r,rect:c,viewId:this.viewId}]});case 19:case"end":return _context84.stop();}},_callee80,this);}));function getBoundingRect(_x124){return _getBoundingRect.apply(this,arguments);}return getBoundingRect;}()}]);}(bl);var uo=/* @__PURE__ */function(i){return i.Full="full",i.Sub="sub",i;}(uo||{});var kM=/*#__PURE__*/function(){function kM(e,t){var _this109=this;_classCallCheck(this,kM);dt(this,"_self");dt(this,"version",vh);dt(this,"type");// protected hasPriorityDraw: boolean = true;
|
|
514
|
+
_inherits($M,_bl2);return _createClass($M,[{key:"runSelectWork",value:function runSelectWork(t){var n;var r=this.setFullWork(t);r&&(n=t.selectIds)!=null&&n.length&&t.workId&&r.selectServiceNode(t.workId.toString(),{selectIds:t.selectIds},!1);}},{key:"workShapesDone",value:function workShapesDone(){var _iterator66=_createForOfIteratorHelper(this.workShapes.keys()),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var t=_step66.value;this.clearWorkShapeNodeCache(t);}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}Lr(this.fullLayer,this.fullLayer.parent);}},{key:"consumeDraw",value:function(){var _consumeDraw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee63(t){var r,n,s,c,l,f,h;return _regeneratorRuntime().wrap(function _callee63$(_context66){while(1)switch(_context66.prev=_context66.next){case 0:r=t.workId,n=t.fullWorkerDrawCount,s=t.postCount,c=r==null?void 0:r.toString(),l=c&&this.workShapes.get(c);if(l){_context66.next=3;break;}return _context66.abrupt("return");case 3:_context66.t0=this.drawWorkActiveId&&this.drawWorkActiveId!==c;if(!_context66.t0){_context66.next=8;break;}_context66.next=7;return this.consumeDrawAll({workId:this.drawWorkActiveId,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local});case 7:this.drawWorkActiveId=void 0;case 8:!this.drawWorkActiveId&&c!==Me&&(this.drawWorkActiveId=c);f=l.toolsType;er(s)&&(this.consumeCount=s);h=l.consume({data:t,drawCount:this.drawCount,isFullWork:!0,isSubWorker:!0,removeDrawCount:n});_context66.t1=f;_context66.next=_context66.t1===Tt.Selector?15:_context66.t1===Tt.Ellipse?21:_context66.t1===Tt.Arrow?21:_context66.t1===Tt.Straight?21:_context66.t1===Tt.Rectangle?21:_context66.t1===Tt.Star?21:_context66.t1===Tt.Polygon?21:_context66.t1===Tt.SpeechBalloon?21:_context66.t1===Tt.Pencil?27:_context66.t1===Tt.BitMapEraser?33:_context66.t1===Tt.PencilEraser?33:39;break;case 15:_context66.t2=h;if(!_context66.t2){_context66.next=20;break;}this.drawCount++;_context66.next=20;return this.drawSelector(h);case 20:return _context66.abrupt("break",39);case 21:_context66.t3=h;if(!_context66.t3){_context66.next=26;break;}this.drawCount++;_context66.next=26;return this.drawShape(h);case 26:return _context66.abrupt("break",39);case 27:_context66.t4=h;if(!_context66.t4){_context66.next=32;break;}this.drawCount++;_context66.next=32;return this.drawPencil(h,r==null?void 0:r.toString());case 32:return _context66.abrupt("break",39);case 33:_context66.t5=h;if(!_context66.t5){_context66.next=38;break;}this.drawCount++;_context66.next=38;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount});case 38:return _context66.abrupt("break",39);case 39:case"end":return _context66.stop();}},_callee63,this);}));function consumeDraw(_x103){return _consumeDraw3.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee64(t){var r,n,s;return _regeneratorRuntime().wrap(function _callee64$(_context67){while(1)switch(_context67.prev=_context67.next){case 0:r=t.workId;if(!r){_context67.next=14;break;}n=r.toString();this.drawWorkActiveId===n&&(this.drawWorkActiveId=void 0);s=this.workShapes.get(n);if(s){_context67.next=7;break;}return _context67.abrupt("return");case 7:_context67.t0=s.toolsType;_context67.next=_context67.t0===Tt.Selector?10:_context67.t0===Tt.Arrow?12:_context67.t0===Tt.Straight?12:_context67.t0===Tt.Ellipse?12:_context67.t0===Tt.Pencil?12:_context67.t0===Tt.Rectangle?12:_context67.t0===Tt.Star?12:_context67.t0===Tt.Polygon?12:_context67.t0===Tt.SpeechBalloon?12:_context67.t0===Tt.BitMapEraser?12:_context67.t0===Tt.PencilEraser?12:14;break;case 10:this.drawCount=0,Lr(this.fullLayer,this.fullLayer.parent),this.clearWorkShapeNodeCache(n),this._post({render:[{isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}]});return _context67.abrupt("break",14);case 12:this.drawCount=0,Lr(this.fullLayer,this.fullLayer.parent),this.clearWorkShapeNodeCache(n);return _context67.abrupt("break",14);case 14:case"end":return _context67.stop();}},_callee64,this);}));function consumeDrawAll(_x104){return _consumeDrawAll2.apply(this,arguments);}return consumeDrawAll;}()},{key:"removeWork",value:function(){var _removeWork4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee65(t){var r,n,s,c;return _regeneratorRuntime().wrap(function _callee65$(_context68){while(1)switch(_context68.prev=_context68.next){case 0:r=t.workId,n=r==null?void 0:r.toString();if(!n){_context68.next=8;break;}s=this.removeNode(n);if(!s){_context68.next=8;break;}c=[];c.push({rect:ve(s),clearCanvas:Ut.Float,isClear:!0,viewId:this.viewId},{rect:ve(s),drawCanvas:Ut.Float,viewId:this.viewId});_context68.next=8;return this._post({render:c});case 8:case"end":return _context68.stop();}},_callee65,this);}));function removeWork(_x105){return _removeWork4.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(t){var _this101=this;var r=this.workShapes.has(t);var n;return r&&(this.fullLayer.getElementsByName(t).forEach(function(s){var c=s.getBoundingClientRect();n=Zt(n,{x:c.x-$t.SafeBorderPadding,y:c.y-$t.SafeBorderPadding,w:c.width+$t.SafeBorderPadding*2,h:c.height+$t.SafeBorderPadding*2}),s.remove(),_pr(s,_this101.fullLayer.parent);}),n&&this.clearWorkShapeNodeCache(t)),n;}},{key:"drawPencil",value:function(){var _drawPencil2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(t,r){return _regeneratorRuntime().wrap(function _callee66$(_context69){while(1)switch(_context69.prev=_context69.next){case 0:_context69.next=2;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:t==null?void 0:t.rect,workId:r,drawCanvas:Ut.Float,viewId:this.viewId}],sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context69.stop();}},_callee66,this);}));function drawPencil(_x106,_x107){return _drawPencil2.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(t){return _regeneratorRuntime().wrap(function _callee67$(_context70){while(1)switch(_context70.prev=_context70.next){case 0:_context70.next=2;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:(t==null?void 0:t.rect)&&ve(t.rect),isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:(t==null?void 0:t.rect)&&ve(t.rect),drawCanvas:Ut.Float,viewId:this.viewId}]});case 2:case"end":return _context70.stop();}},_callee67,this);}));function drawShape(_x108){return _drawShape2.apply(this,arguments);}return drawShape;}()},{key:"drawSelector",value:function(){var _drawSelector2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee68(t){return _regeneratorRuntime().wrap(function _callee68$(_context71){while(1)switch(_context71.prev=_context71.next){case 0:_context71.next=2;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:(t==null?void 0:t.rect)&&ve(t.rect),isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:(t==null?void 0:t.rect)&&ve(t.rect),drawCanvas:Ut.Float,viewId:this.viewId}]});case 2:case"end":return _context71.stop();}},_callee68,this);}));function drawSelector(_x109){return _drawSelector2.apply(this,arguments);}return drawSelector;}()}]);}(bl);var jM=/*#__PURE__*/function(){function jM(e){_classCallCheck(this,jM);dt(this,"viewId");dt(this,"vNodes");dt(this,"topLayer");dt(this,"thread");dt(this,"post");dt(this,"serviceWorkShapes",/* @__PURE__ */new Map());dt(this,"localWorkShapes",/* @__PURE__ */new Map());dt(this,"tmpOpt");dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"animationId");this.viewId=e.viewId,this.vNodes=e.vNodes,this.topLayer=e.topLayer,this.thread=e.thread,this.post=e.thread.post.bind(e.thread);}return _createClass(jM,[{key:"canUseTopLayer",value:function canUseTopLayer(e){return e===Tt.LaserPen;}},{key:"getWorkShape",value:function getWorkShape(e){return this.localWorkShapes.get(e);}},{key:"createWorkShape",value:function createWorkShape(e,t){if(e&&this.tmpOpt){var r={toolsType:this.tmpOpt.toolsType,toolsOpt:t||this.tmpOpt.toolsOpt},n=this.createWorkShapeNode(_objectSpread(_objectSpread({},r),{},{workId:e}));return n&&this.localWorkShapes.set(e,{node:n,toolsType:n.toolsType,workState:te.Start}),n;}}},{key:"setWorkOptions",value:function setWorkOptions(e,t){var n;var r=(n=this.localWorkShapes.get(e))==null?void 0:n.node;r||this.createWorkShape(e,t),r==null||r.setWorkOptions(t);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(e){var t=e.toolsType;if(t===Tt.LaserPen)return To(_objectSpread(_objectSpread({},e),{},{vNodes:this.vNodes,fullLayer:this.topLayer,drawLayer:this.topLayer}));}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.localWorkShapes.forEach(function(e){var t;return(t=e.node)==null?void 0:t.clearTmpPoints();}),this.localWorkShapes.clear();}},{key:"setToolsOpt",value:function setToolsOpt(e){var t;this.tmpOpt=e,(t=e.toolsOpt)!=null&&t.syncUnitTime&&(this.syncUnitTime=e.toolsOpt.syncUnitTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"consumeDraw",value:function consumeDraw(e){var t=e.workId,r=e.dataType;if(r===Vt.Service)this.activeServiceWorkShape(e);else{var n=t==null?void 0:t.toString(),s=n&&this.localWorkShapes.get(n);if(!s)return;var c=s.node.consume({data:e,isFullWork:!1,isSubWorker:!0});c.rect&&(s.totalRect=Zt(c.rect,s.totalRect),s.result=c,s.workState=te.Doing,n&&this.localWorkShapes.set(n,s));}this.runAnimation();}},{key:"consumeDrawAll",value:function consumeDrawAll(e){var t=e.workId,r=e.dataType;if(r===Vt.Service)this.activeServiceWorkShape(e);else{var n=t==null?void 0:t.toString(),s=n&&this.localWorkShapes.get(n);if(!s)return;var c=s.node.consumeAll({data:e});s.totalRect=Zt(c.rect,s.totalRect),s.result=c,s.workState=te.Done,n&&this.localWorkShapes.set(n,s);}this.runAnimation();}},{key:"destroy",value:function destroy(){this.serviceWorkShapes.clear(),this.localWorkShapes.clear();}},{key:"setNodeKey",value:function setNodeKey(e,t,r,n){return t.toolsType=r,t.node=this.createWorkShapeNode({workId:e,toolsType:r,toolsOpt:n}),t;}},{key:"activeServiceWorkShape",value:function activeServiceWorkShape(e){var y,T;var t=e.workId,r=e.opt,n=e.toolsType,s=e.type,c=e.updateNodeOpt,l=e.ops,f=e.op;if(!t)return;var h=t.toString(),m=(y=this.vNodes.get(h))==null?void 0:y.rect;if(!((T=this.serviceWorkShapes)!=null&&T.has(h))){var E={toolsType:n,animationWorkData:f||[],animationIndex:0,type:s,updateNodeOpt:c,ops:l,oldRect:m};n&&r&&(E=this.setNodeKey(h,E,n,r)),this.serviceWorkShapes.set(h,E);}var u=this.serviceWorkShapes.get(h);s&&(u.type=s),l&&(u.animationWorkData=Pi(l),u.ops=l),c&&(u.updateNodeOpt=c),f&&(u.animationWorkData=f),u.node&&u.node.getWorkId()!==h&&u.node.setWorkId(h),m&&(u.oldRect=m),n&&r&&(u.toolsType!==n&&n&&r&&this.setNodeKey(h,u,n,r),u.node&&u.node.setWorkOptions(r));}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(e,t){var r=Math.floor((e.animationWorkData||[]).slice(e.animationIndex).length*32/t/this.syncUnitTime)*t;return Math.min((e.animationIndex||0)+(r||t),(e.animationWorkData||[]).length);}},{key:"animationDraw",value:function(){var _animationDraw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee69(){var _this102=this;var c,l,f,h,e,t,r,n,s,_iterator67,_step67,_step67$value,m,u,T,E,C,x,_iterator68,_step68,_step68$value,_m14,_u7,y,_T11,_E3,_C5,_x110;return _regeneratorRuntime().wrap(function _callee69$(_context72){while(1)switch(_context72.prev=_context72.next){case 0:this.animationId=void 0;e=!1;t=/* @__PURE__ */new Map(),r=[],n=[],s=[];_iterator67=_createForOfIteratorHelper(this.serviceWorkShapes.entries());_context72.prev=4;_iterator67.s();case 6:if((_step67=_iterator67.n()).done){_context72.next=20;break;}_step67$value=_slicedToArray(_step67.value,2),m=_step67$value[0],u=_step67$value[1];_context72.t0=u.toolsType;_context72.next=_context72.t0===Tt.LaserPen?11:18;break;case 11:T=this.computNextAnimationIndex(u,8),E=Math.max(0,u.animationIndex||0),C=(u.animationWorkData||[]).slice(E,T);if((u.animationIndex||0)<T){x=(c=u.node)==null?void 0:c.consumeService({op:C,isFullWork:!1});u.totalRect=Zt(u.totalRect,x),u.animationIndex=T,C.length&&t.set(m,{workState:E===0?te.Start:T===((l=u.animationWorkData)==null?void 0:l.length)?te.Done:te.Doing,op:C.slice(-2)});}if(!(n.push({isClear:!0,rect:u.totalRect,clearCanvas:Ut.TopFloat,viewId:this.viewId}),r.push({rect:u.totalRect,drawCanvas:Ut.TopFloat,viewId:this.viewId}),u.isDel)){_context72.next=16;break;}(f=u.node)==null||f.clearTmpPoints(),this.serviceWorkShapes["delete"](m);return _context72.abrupt("break",18);case 16:u.ops&&u.animationIndex===((h=u.animationWorkData)==null?void 0:h.length)&&!u.isDel&&(this.topLayer.getElementsByName(m.toString())[0]||(u.isDel=!0,this.serviceWorkShapes.set(m,u))),e=!0;return _context72.abrupt("break",18);case 18:_context72.next=6;break;case 20:_context72.next=25;break;case 22:_context72.prev=22;_context72.t1=_context72["catch"](4);_iterator67.e(_context72.t1);case 25:_context72.prev=25;_iterator67.f();return _context72.finish(25);case 28:_iterator68=_createForOfIteratorHelper(this.localWorkShapes.entries());_context72.prev=29;_iterator68.s();case 31:if((_step68=_iterator68.n()).done){_context72.next=44;break;}_step68$value=_slicedToArray(_step68.value,2),_m14=_step68$value[0],_u7=_step68$value[1];y=_u7.result,_T11=_u7.toolsType,_E3=_u7.totalRect,_C5=_u7.isDel,_x110=_u7.workState;_context72.t2=_T11;_context72.next=_context72.t2===Tt.LaserPen?37:42;break;case 37:if(!(_E3&&(n.push({isClear:!0,rect:_E3,clearCanvas:Ut.TopFloat,viewId:this.viewId}),r.push({rect:_E3,drawCanvas:Ut.TopFloat,viewId:this.viewId})),_C5)){_context72.next=40;break;}_u7.node.clearTmpPoints(),this.localWorkShapes["delete"](_m14),s.push({removeIds:[_m14.toString()],viewId:this.viewId,type:xt.RemoveNode});return _context72.abrupt("break",42);case 40:y&&((y.op||y.ops)&&s.push(y),_u7.result=void 0),!this.topLayer.getElementsByName(_m14.toString())[0]&&_x110===te.Done&&(_u7.isDel=!0,this.localWorkShapes.set(_m14,_u7)),e=!0;return _context72.abrupt("break",42);case 42:_context72.next=31;break;case 44:_context72.next=49;break;case 46:_context72.prev=46;_context72.t3=_context72["catch"](29);_iterator68.e(_context72.t3);case 49:_context72.prev=49;_iterator68.f();return _context72.finish(49);case 52:e&&this.runAnimation(),t.size&&t.forEach(function(m,u){s.push({type:xt.Cursor,uid:u.split(yi)[0],op:m.op,workState:m.workState,viewId:_this102.viewId});}),(r.length||n.length||s.length)&&this.post({render:[].concat(n,r),sp:s});case 53:case"end":return _context72.stop();}},_callee69,this,[[4,22,25,28],[29,46,49,52]]);}));function animationDraw(){return _animationDraw2.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var _this103=this;this.animationId||(this.animationId=setTimeout(function(){_this103.animationId=void 0,_this103.animationDraw();},16));}}]);}();var GM=/*#__PURE__*/function(_ed){function GM(t){var _this104;_classCallCheck(this,GM);_this104=_callSuper(this,GM,[t]);dt(_this104,"_type","simple");return _this104;}_inherits(GM,_ed);return _createClass(GM,[{key:"createWorkShapeNode",value:function createWorkShapeNode(t){var n;var r=t.toolsType;return r===Tt.Selector?this.vNodes?new Hi(_objectSpread(_objectSpread({},t),{},{fullLayer:this.fullLayer,vNodes:this.vNodes,drawLayer:this.drawLayer})):void 0:To(_objectSpread(_objectSpread({},t),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(n=this.thread)==null?void 0:n.serviceWork);}},{key:"drawPencil",value:function(){var _drawPencil3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70(t,r){return _regeneratorRuntime().wrap(function _callee70$(_context73){while(1)switch(_context73.prev=_context73.next){case 0:_context73.next=2;return this._post({consumeCount:this.consumeCount,render:[{rect:t==null?void 0:t.rect,workId:r,drawCanvas:Ut.Float,viewId:this.viewId}],sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context73.stop();}},_callee70,this);}));function drawPencil(_x111,_x112){return _drawPencil3.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee71(t){return _regeneratorRuntime().wrap(function _callee71$(_context74){while(1)switch(_context74.prev=_context74.next){case 0:_context74.next=2;return this._post({consumeCount:this.consumeCount,sp:(t==null?void 0:t.op)&&[t],render:[{rect:(t==null?void 0:t.rect)&&ve(t.rect),isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:(t==null?void 0:t.rect)&&ve(t.rect),drawCanvas:Ut.Float,viewId:this.viewId}]});case 2:case"end":return _context74.stop();}},_callee71,this);}));function drawShape(_x113){return _drawShape3.apply(this,arguments);}return drawShape;}()},{key:"drawSelector",value:function(){var _drawSelector3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee72(t,r){var n,c,l,f,s,_args75=arguments;return _regeneratorRuntime().wrap(function _callee72$(_context75){while(1)switch(_context75.prev=_context75.next){case 0:n=_args75.length>2&&_args75[2]!==undefined?_args75[2]:[];s={render:n,sp:[t],consumeCount:this.consumeCount};r&&((c=s.sp)==null||c.push({type:xt.None,isLockSentEventCursor:r}));t.subRect&&((l=s.render)==null||l.push({rect:ve(t.subRect),isClear:!0,clearCanvas:Ut.Float,viewId:this.viewId},{rect:ve(t.subRect),drawCanvas:Ut.Float,viewId:this.viewId}));t.rect&&((f=s.render)==null||f.push({rect:ve(t.rect),clearCanvas:Ut.Bg,isClear:!0,viewId:this.viewId},{rect:ve(t.rect),drawCanvas:Ut.Bg,viewId:this.viewId}));_context75.next=7;return this._post(s);case 7:case"end":return _context75.stop();}},_callee72,this);}));function drawSelector(_x114,_x115){return _drawSelector3.apply(this,arguments);}return drawSelector;}()},{key:"drawEraserCombine",value:function(){var _drawEraserCombine2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee73(t){var n,s,c,l,r,f,h,m,u,_iterator69,_step69,_step69$value,_u8,y;return _regeneratorRuntime().wrap(function _callee73$(_context76){while(1)switch(_context76.prev=_context76.next){case 0:r=(n=this.workShapes.get(t))==null?void 0:n.combineConsume({workerEngine:this});if(!r){_context76.next=7;break;}f=r.willDeleteNodes,h=r.willNewNodes,m={render:[],sp:[]};if(r!=null&&r.rect){u=ve(r.rect);(s=m.render)==null||s.push({rect:u,isClear:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{rect:u,drawCanvas:Ut.Bg,viewId:this.viewId});}if(f!=null&&f.size&&((c=m.sp)==null||c.push({type:xt.RemoveNode,removeIds:_toConsumableArray(f),viewId:this.thread.viewId})),h!=null&&h.size){_iterator69=_createForOfIteratorHelper(h);try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){_step69$value=_slicedToArray(_step69.value,2),_u8=_step69$value[0],y=_step69$value[1];(l=m.sp)==null||l.push({type:xt.FullWork,dataType:Vt.Local,toolsType:Tt.Pencil,ops:gr(y.op),opt:y.opt,workId:_u8,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}}_context76.next=7;return this._post(m);case 7:case"end":return _context76.stop();}},_callee73,this);}));function drawEraserCombine(_x116){return _drawEraserCombine2.apply(this,arguments);}return drawEraserCombine;}()},{key:"consumeDraw",value:function(){var _consumeDraw4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee74(t,r){var _this105=this;var n,s,c,l,f,h,m,u,y;return _regeneratorRuntime().wrap(function _callee74$(_context77){while(1)switch(_context77.prev=_context77.next){case 0:n=t.op,s=t.workId,c=t.scenePath,l=t.postCount,f=t.smoothSync;if(!(n!=null&&n.length&&s)){_context77.next=42;break;}h=s.toString(),m=this.getWorkShape(h);if(m){_context77.next=5;break;}return _context77.abrupt("return");case 5:u=m.toolsType;if(!(u===Tt.LaserPen)){_context77.next=8;break;}return _context77.abrupt("return");case 8:_context77.t0=this.drawWorkActiveId&&this.drawWorkActiveId!==h;if(!_context77.t0){_context77.next=13;break;}_context77.next=12;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:c,viewId:this.viewId,msgType:xt.DrawWork,dataType:Vt.Local},r);case 12:this.drawWorkActiveId=void 0;case 13:!this.drawWorkActiveId&&h!==Me&&(this.drawWorkActiveId=h);er(l)&&(this.consumeCount=l);y=m.consume({data:t,isSimpleWorker:!0,smoothSync:f});_context77.t1=u;_context77.next=_context77.t1===Tt.Selector?19:_context77.t1===Tt.PencilEraser?24:_context77.t1===Tt.BitMapEraser?24:_context77.t1===Tt.Eraser?29:_context77.t1===Tt.Arrow?32:_context77.t1===Tt.Straight?32:_context77.t1===Tt.Ellipse?32:_context77.t1===Tt.Rectangle?32:_context77.t1===Tt.Star?32:_context77.t1===Tt.Polygon?32:_context77.t1===Tt.SpeechBalloon?32:_context77.t1===Tt.Pencil?38:42;break;case 19:this.drawCount++;y.type===xt.Select&&y.selectIds&&r.runReverseSelectWork(y.selectIds);_context77.next=23;return this.drawSelector(y);case 23:return _context77.abrupt("break",42);case 24:this.drawCount++;this.combineTimerId||(this.combineTimerId=1,this.combineDrawActiveId=h,this.drawEraserCombine(h).then(function(){_this105.combineTimerId=void 0;}));_context77.next=28;return this._post({consumeCount:this.consumeCount});case 28:return _context77.abrupt("break",42);case 29:_context77.next=31;return this.drawEraser(y);case 31:return _context77.abrupt("break",42);case 32:_context77.t2=y;if(!_context77.t2){_context77.next=37;break;}this.drawCount++;_context77.next=37;return this.drawShape(y);case 37:return _context77.abrupt("break",42);case 38:this.drawCount++;_context77.next=41;return this.drawPencil(y,h);case 41:return _context77.abrupt("break",42);case 42:case"end":return _context77.stop();}},_callee74,this);}));function consumeDraw(_x117,_x118){return _consumeDraw4.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee75(t,r){var l,f,h,n,s,c,m,u,y,T,E,C,x;return _regeneratorRuntime().wrap(function _callee75$(_context78){while(1)switch(_context78.prev=_context78.next){case 0:this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);n=t.workId,s=t.scenePath,c=t.isLockSentEventCursor;if(!n){_context78.next=40;break;}m=n.toString();this.drawWorkActiveId===m&&(this.drawWorkActiveId=void 0);u=this.workShapes.get(m);if(u){_context78.next=8;break;}return _context78.abrupt("return");case 8:y=u.toolsType;if(!(y===Tt.LaserPen)){_context78.next=11;break;}return _context78.abrupt("return");case 11:T=this.workShapes.get(pi),E=(l=T==null?void 0:T.selectIds)==null?void 0:l[0],C=u.consumeAll({data:t,workerEngine:this});_context78.t0=y;_context78.next=_context78.t0===Tt.Selector?15:_context78.t0===Tt.PencilEraser?23:_context78.t0===Tt.BitMapEraser?23:_context78.t0===Tt.Eraser?28:_context78.t0===Tt.Arrow?30:_context78.t0===Tt.Straight?30:_context78.t0===Tt.Ellipse?30:_context78.t0===Tt.Rectangle?30:_context78.t0===Tt.Star?30:_context78.t0===Tt.Polygon?30:_context78.t0===Tt.SpeechBalloon?30:_context78.t0===Tt.Pencil?35:40;break;case 15:x=[];this.drawLayer&&(this.drawCount=0,Lr(this.drawLayer,this.drawLayer.parent),this.getWorkShape(m).clearSubTmpPoints(),x.push({isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}));C.selectIds&&E&&(f=C.selectIds)!=null&&f.includes(E)&&T.cursorBlur();C.selectIds&&r.runReverseSelectWork(C.selectIds);_context78.next=21;return this.drawSelector(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c,x);case 21:(h=u.selectIds)!=null&&h.length?u.clearTmpPoints():this.clearWorkShapeNodeCache(m);return _context78.abrupt("break",40);case 23:_context78.next=25;return this.drawEraserFull(u,_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 25:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context78.abrupt("break",40);case 28:this.drawEraser(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c),u.clearTmpPoints();return _context78.abrupt("break",40);case 30:_context78.next=32;return this.drawPencilFull(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 32:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context78.abrupt("break",40);case 35:_context78.next=37;return this.drawPencilFull(_objectSpread(_objectSpread({},C),{},{scenePath:s}),c);case 37:this.drawCount=0;this.clearWorkShapeNodeCache(m);return _context78.abrupt("break",40);case 40:case"end":return _context78.stop();}},_callee75,this);}));function consumeDrawAll(_x119,_x120){return _consumeDrawAll3.apply(this,arguments);}return consumeDrawAll;}()}]);}(ed);var HM=/*#__PURE__*/function(_rd){function HM(t){var _this106;_classCallCheck(this,HM);_this106=_callSuper(this,HM,[t]);dt(_this106,"_type","simple");return _this106;}_inherits(HM,_rd);return _createClass(HM,[{key:"animationDraw",value:function(){var _animationDraw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee76(){var _this107=this;var s,c,l,f,h,m,u,y,T,E,C,x,I,d,v,p,S,A,R,D,U,M,W,Y,B,N,G,J,tt,at,ut,K,Q,ft,gt,mt,wt,ht,Nt,Rt,t,r,n,_iterator70,_step70,_loop7;return _regeneratorRuntime().wrap(function _callee76$(_context80){while(1)switch(_context80.prev=_context80.next){case 0:this.animationId=void 0;t=!1;r={render:[]},n=/* @__PURE__ */new Map();_iterator70=_createForOfIteratorHelper(this.workShapes.entries());_context80.prev=4;_loop7=/*#__PURE__*/_regeneratorRuntime().mark(function _loop7(){var _step70$value,X,z,q,nt,_q5,_nt3,_q6,_nt4,j,Z,_q7,_nt5,_j4,_Z3,O,L,$,_L,_q8,_nt6,_j5,_Z4;return _regeneratorRuntime().wrap(function _loop7$(_context79){while(1)switch(_context79.prev=_context79.next){case 0:_step70$value=_slicedToArray(_step70.value,2),X=_step70$value[0],z=_step70$value[1];_context79.t0=z.toolsType;_context79.next=_context79.t0===Tt.Image?4:_context79.t0===Tt.Text?11:_context79.t0===Tt.Arrow?19:_context79.t0===Tt.Straight?19:_context79.t0===Tt.Rectangle?19:_context79.t0===Tt.Ellipse?19:_context79.t0===Tt.Star?19:_context79.t0===Tt.Polygon?19:_context79.t0===Tt.SpeechBalloon?19:_context79.t0===Tt.Pencil?22:38;break;case 4:q=z.oldRect;q&&((s=r.render)==null||s.push({rect:q,isClear:!0,clearCanvas:Ut.Bg,viewId:_this107.viewId}),(c=r.render)==null||c.push({rect:q,drawCanvas:Ut.Bg,viewId:_this107.viewId}));_context79.next=8;return(l=z.node)==null?void 0:l.consumeServiceAsync({isFullWork:!0,worker:_this107.thread});case 8:nt=_context79.sent;_this107.selectorWorkShapes.forEach(function(j,Z){var O;(O=j.selectIds)!=null&&O.includes(X)&&(_this107.willRunEffectSelectorIds.add(Z),_this107.noAnimationRect=Zt(_this107.noAnimationRect,q),_this107.noAnimationRect=Zt(_this107.noAnimationRect,nt),_this107.runEffect());}),_this107.workShapes["delete"](X),(f=r.render)==null||f.push({rect:nt,drawCanvas:Ut.Bg,viewId:_this107.viewId});return _context79.abrupt("break",38);case 11:if(!z.node){_context79.next=18;break;}_q5=z.oldRect;_q5&&((h=r.render)==null||h.push({rect:_q5,isClear:!0,clearCanvas:Ut.Bg,viewId:_this107.viewId}),(m=r.render)==null||m.push({rect:_q5,drawCanvas:Ut.Bg,viewId:_this107.viewId}));_context79.next=16;return z.node.consumeServiceAsync({isFullWork:!0,replaceId:X,boxRect:_this107.thread.getSceneRect()});case 16:_nt3=_context79.sent;_this107.selectorWorkShapes.forEach(function(j,Z){var O;(O=j.selectIds)!=null&&O.includes(X)&&(_this107.willRunEffectSelectorIds.add(Z),_this107.noAnimationRect=Zt(_this107.noAnimationRect,_q5),_this107.noAnimationRect=Zt(_this107.noAnimationRect,_nt3),_this107.runEffect());}),(u=z.node)==null||u.clearTmpPoints(),_this107.workShapes["delete"](X),(y=r.render)==null||y.push({rect:_nt3,drawCanvas:Ut.Bg,viewId:_this107.viewId});case 18:return _context79.abrupt("break",38);case 19:_q6=!!z.ops;if((T=z.animationWorkData)!=null&&T.length){_nt4=z.oldRect,j=z.node.oldRect;_nt4&&((E=r.render)==null||E.push({rect:_nt4,isClear:!0,clearCanvas:Ut.Bg,viewId:_this107.viewId}),(C=r.render)==null||C.push({rect:_nt4,drawCanvas:Ut.Bg,viewId:_this107.viewId})),j&&((x=r.render)==null||x.push({rect:j,isClear:!0,clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId}));Z=(I=z.node)==null?void 0:I.consumeService({op:z.animationWorkData,isFullWork:_q6});z.isEnableCursor?n.set(X,{workState:_nt4?z.ops?te.Done:te.Doing:te.Start,op:z.animationWorkData.slice(-3,-1)}):_q6&&!z.useAnimation&&(d=z.updateNodeOpt)!=null&&d.useAnimation&&n.set(X,{workState:te.Done,op:z.animationWorkData.slice(-3,-1),uid:(v=z.updateNodeOpt)==null?void 0:v.uid}),_q6?(_this107.selectorWorkShapes.forEach(function(O,L){var $;($=O.selectIds)!=null&&$.includes(X)&&(_this107.willRunEffectSelectorIds.add(L),_this107.noAnimationRect=Zt(_this107.noAnimationRect,_nt4),_this107.noAnimationRect=Zt(_this107.noAnimationRect,j),_this107.noAnimationRect=Zt(_this107.noAnimationRect,Z),_this107.runEffect());}),(p=z.node)==null||p.clearTmpPoints(),_this107.workShapes["delete"](X),(S=r.render)==null||S.push({rect:Z,drawCanvas:Ut.Bg,viewId:_this107.viewId})):(A=r.render)==null||A.push({rect:Z,drawCanvas:Ut.ServiceFloat,workerType:_q6?void 0:Vt.Service,viewId:_this107.viewId}),z.animationWorkData.length=0;}return _context79.abrupt("break",38);case 22:if(!z.useAnimation){_context79.next=33;break;}if(!z.useAnimation){_context79.next=31;break;}if(!z.isDel){_context79.next=27;break;}(ut=z.node)==null||ut.clearTmpPoints(),_this107.workShapes["delete"](X);return _context79.abrupt("break",38);case 27:_q7=3,_nt5=_this107.computNextAnimationIndex(z,_q7),_j4=z.isDiff?0:Math.max(0,(z.animationIndex||0)-_q7),_Z3=(z.animationWorkData||[]).slice(0,_nt5),O=(Q=(K=z.node)==null?void 0:K.getWorkId())==null?void 0:Q.toString();if((z.animationIndex||0)<_nt5||z.isDiff){L=(ft=z.node)==null?void 0:ft.consumeService({op:_Z3,isFullWork:!1,replaceId:O});if((gt=r.render)==null||gt.push({isClear:!0,rect:L,clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),(mt=r.render)==null||mt.push({rect:L,drawCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),z.animationIndex=_nt5,z.isDiff&&(z.isDiff=!1),_Z3.length&&z.isEnableCursor){$=_Z3.slice(-3,-1);n.set(X,{workState:_j4===0?te.Start:_nt5===((wt=z.animationWorkData)==null?void 0:wt.length)?te.Done:te.Doing,op:$});}}else if(z.ops){_L=(ht=z.node)==null?void 0:ht.consumeService({op:z.animationWorkData||[],isFullWork:!0,replaceId:O});z.isDel=!0,(Nt=r.render)==null||Nt.push({isClear:!0,rect:_L,clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId},{rect:_L,drawCanvas:Ut.ServiceFloat,viewId:_this107.viewId},{isClear:!0,rect:_L,clearCanvas:Ut.Bg,viewId:_this107.viewId},{rect:_L,drawCanvas:Ut.Bg,viewId:_this107.viewId}),z.isEnableCursor&&n.set(X,{workState:te.Done,op:_Z3.slice(-3,-1)});}t=!0;return _context79.abrupt("break",38);case 31:_context79.next=37;break;case 33:_q8=!!z.ops;_nt6=(R=z.node)==null?void 0:R.consumeService({op:z.animationWorkData||[],isFullWork:_q8,replaceId:X});_j5=(D=z.node)==null?void 0:D.updataOptService(z.updateNodeOpt);if(_q8){if(_nt6=Zt(_nt6,_j5),(U=r.render)==null||U.push({isClear:!0,rect:Zt(z.oldRect,_nt6),clearCanvas:Ut.Bg,viewId:_this107.viewId}),(M=r.render)==null||M.push({rect:Zt(z.oldRect,_nt6),drawCanvas:Ut.Bg,viewId:_this107.viewId}),(W=z.updateNodeOpt)!=null&&W.useAnimation&&((Y=r.render)==null||Y.push({isClear:!0,rect:Zt(z.oldRect,_nt6),clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),(B=r.render)==null||B.push({rect:Zt(z.oldRect,_nt6),drawCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),!z.isEnableCursor&&(N=z.animationWorkData)!=null&&N.length)){_Z4=z.animationWorkData.slice(-3,-1);n.set(X,{workState:te.Done,op:_Z4,uid:(G=z.updateNodeOpt)==null?void 0:G.uid});}_this107.selectorWorkShapes.forEach(function(Z,O){var L;(L=Z.selectIds)!=null&&L.includes(X)&&(_this107.willRunEffectSelectorIds.add(O),_this107.noAnimationRect=Zt(_this107.noAnimationRect,_nt6),_this107.runEffect());}),(J=z.node)==null||J.clearTmpPoints(),_this107.workShapes["delete"](X);}else _nt6=Zt(_nt6,_j5),(tt=r.render)==null||tt.push({isClear:!0,rect:Zt(z.oldRect,_nt6),clearCanvas:Ut.ServiceFloat,viewId:_this107.viewId}),(at=r.render)==null||at.push({rect:Zt(z.oldRect,_nt6),drawCanvas:Ut.ServiceFloat,viewId:_this107.viewId});case 37:return _context79.abrupt("break",38);case 38:case"end":return _context79.stop();}},_loop7);});_iterator70.s();case 7:if((_step70=_iterator70.n()).done){_context80.next=11;break;}return _context80.delegateYield(_loop7(),"t0",9);case 9:_context80.next=7;break;case 11:_context80.next=16;break;case 13:_context80.prev=13;_context80.t1=_context80["catch"](4);_iterator70.e(_context80.t1);case 16:_context80.prev=16;_iterator70.f();return _context80.finish(16);case 19:t&&this.runAnimation();n.size&&(r.sp=[],n.forEach(function(X,z){var q;(q=r.sp)==null||q.push({type:xt.Cursor,uid:X.uid||z.split(yi)[0],op:X.op,workState:X.workState,viewId:_this107.viewId});}));_context80.t2=(Rt=r.render)!=null&&Rt.length;if(!_context80.t2){_context80.next=25;break;}_context80.next=25;return this.post(r);case 25:case"end":return _context80.stop();}},_callee76,this,[[4,13,16,19]]);}));function animationDraw(){return _animationDraw3.apply(this,arguments);}return animationDraw;}()}]);}(rd);var nd=/*#__PURE__*/function(_bl3){function nd(t){var _this108;_classCallCheck(this,nd);_this108=_callSuper(this,nd,[t]);dt(_this108,"opt");dt(_this108,"scene");dt(_this108,"cameraOpt");dt(_this108,"vNodes");_this108.opt=t,_this108.vNodes=void 0;return _this108;}_inherits(nd,_bl3);return _createClass(nd,[{key:"createSnapshotFullLayer",value:function createSnapshotFullLayer(t,r){this.scene=this.opt.createScene(t),this.fullLayer=this.opt.createLayer("snapshotFullLayer",this.scene,r);}},{key:"destroySnapshotFullLayer",value:function destroySnapshotFullLayer(){var t,r,n;Lr(this.fullLayer,this.fullLayer.parent),(t=this.fullLayer)==null||t.disconnect(),(r=this.fullLayer)==null||r.remove(),(n=this.scene)==null||n.remove(),this.scene=void 0;}},{key:"updateScene",value:function updateScene(t){if(!this.scene)throw new Error("SnapshotWork scene is not initialized");this.scene.attr(_objectSpread({},t));var r=t.width,n=t.height;this.scene.width=r,this.scene.height=n,this.updateLayer({width:r,height:n});}},{key:"updateLayer",value:function updateLayer(t){if(!this.fullLayer)throw new Error("SnapshotWork snapshotFullLayer is not initialized");var r=t.width,n=t.height;this.fullLayer.parent.setAttribute("width",r),this.fullLayer.parent.setAttribute("height",n),this.fullLayer.setAttribute("size",[r,n]),this.fullLayer.setAttribute("pos",[r*0.5,n*0.5]);}},{key:"setCameraOpt",value:function setCameraOpt(t){this.cameraOpt=t;var r=t.scale,n=t.centerX,s=t.centerY,c=t.width,l=t.height;if(!this.scene)throw new Error("SnapshotWork scene is not initialized");if(!this.fullLayer)throw new Error("SnapshotWork snapshotFullLayer is not initialized");(c!==this.scene.width||l!==this.scene.height)&&this.updateScene({width:c,height:l}),this.fullLayer.setAttribute("scale",[r,r]),this.fullLayer.setAttribute("translate",[-n,-s]);}},{key:"getOffscreen",value:function getOffscreen(){var r;return((r=this.fullLayer)==null?void 0:r.parent).canvas;}},{key:"getRectImageBitmap",value:function getRectImageBitmap(t,r){var n=t.rect,s=this.thread.dpr,c=Math.floor(n.x*s),l=Math.floor(n.y*s),f=Math.floor(n.w*s),h=Math.floor(n.h*s);return createImageBitmap(this.getOffscreen(),c,l,f,h,r);}},{key:"getSnapshot",value:function(){var _getSnapshot=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee77(t){var r,n,s,c,l,f,_i4,_Object$entries,_Object$entries$_i,m,u,y,T,E,h;return _regeneratorRuntime().wrap(function _callee77$(_context81){while(1)switch(_context81.prev=_context81.next){case 0:r=t.scenePath,n=t.scenes,s=t.cameraOpt,c=t.w,l=t.h;if(!(r&&n&&s&&this.fullLayer)){_context81.next=23;break;}this.setCameraOpt(s);_i4=0,_Object$entries=Object.entries(n);case 4:if(!(_i4<_Object$entries.length)){_context81.next=20;break;}_Object$entries$_i=_slicedToArray(_Object$entries[_i4],2),m=_Object$entries$_i[0],u=_Object$entries$_i[1];if(!(u!=null&&u.type)){_context81.next=17;break;}_context81.t0=u==null?void 0:u.type;_context81.next=_context81.t0===xt.UpdateNode?10:_context81.t0===xt.FullWork?10:17;break;case 10:y=u.opt;T=_objectSpread(_objectSpread({},u),{},{opt:y,workId:m,msgType:xt.FullWork,dataType:Vt.Service,viewId:this.viewId});_context81.next=14;return this.runFullWork(T);case 14:E=_context81.sent;f=Zt(f,E);return _context81.abrupt("break",17);case 17:_i4++;_context81.next=4;break;case 20:c&&l&&(h={resizeWidth:c,resizeHeight:l});_context81.next=23;return this.getSnapshotRender({scenePath:r,options:h});case 23:case"end":return _context81.stop();}},_callee77,this);}));function getSnapshot(_x121){return _getSnapshot.apply(this,arguments);}return getSnapshot;}()},{key:"runFullWork",value:function(){var _runFullWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee78(t){var s,r,n,c,l,f;return _regeneratorRuntime().wrap(function _callee78$(_context82){while(1)switch(_context82.prev=_context82.next){case 0:r=this.setFullWork(t),n=t.ops&&Pi(t.ops);if(!r){_context82.next=18;break;}f=(s=r.getWorkId())==null?void 0:s.toString();if(!(r.toolsType===Tt.Image)){_context82.next=9;break;}_context82.next=6;return r.consumeServiceAsync({isFullWork:!0,worker:this.thread});case 6:c=_context82.sent;_context82.next=16;break;case 9:if(!(r.toolsType===Tt.Text)){_context82.next=15;break;}_context82.next=12;return r.consumeServiceAsync({isFullWork:!0,replaceId:f,isDrawLabel:!0});case 12:c=_context82.sent;_context82.next=16;break;case 15:c=r.consumeService({op:n,isFullWork:!0,replaceId:f}),l=(t==null?void 0:t.updateNodeOpt)&&r.updataOptService(t.updateNodeOpt);case 16:t.workId&&this.workShapes["delete"](t.workId.toString());return _context82.abrupt("return",Zt(c,l));case 18:case"end":return _context82.stop();}},_callee78,this);}));function runFullWork(_x122){return _runFullWork.apply(this,arguments);}return runFullWork;}()},{key:"getSceneRect",value:function getSceneRect(){if(!this.scene)throw new Error("SnapshotWork scene is not initialized");var _this$scene2=this.scene,t=_this$scene2.width,r=_this$scene2.height;return{x:0,y:0,w:Math.floor(t),h:Math.floor(r)};}},{key:"getSnapshotRender",value:function(){var _getSnapshotRender=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee79(t){var c,r,n,s;return _regeneratorRuntime().wrap(function _callee79$(_context83){while(1)switch(_context83.prev=_context83.next){case 0:r=t.scenePath,n=t.options;((c=this.fullLayer)==null?void 0:c.parent).render();_context83.next=4;return this.getRectImageBitmap({rect:this.getSceneRect(),drawCanvas:Ut.None},n);case 4:s=_context83.sent;s&&(this.thread._post({sp:[{type:xt.Snapshot,scenePath:r,imageBitmap:s,viewId:this.viewId}]},[s]),s.close());case 6:case"end":return _context83.stop();}},_callee79,this);}));function getSnapshotRender(_x123){return _getSnapshotRender.apply(this,arguments);}return getSnapshotRender;}()},{key:"getBoundingRect",value:function(){var _getBoundingRect=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee80(t){var r,n,s,c,_i5,_Object$entries2,_Object$entries2$_i,l,f,h;return _regeneratorRuntime().wrap(function _callee80$(_context84){while(1)switch(_context84.prev=_context84.next){case 0:r=t.scenePath,n=t.scenes,s=t.cameraOpt;if(!(r&&n&&s&&this.fullLayer)){_context84.next=19;break;}this.setCameraOpt(s);_i5=0,_Object$entries2=Object.entries(n);case 4:if(!(_i5<_Object$entries2.length)){_context84.next=18;break;}_Object$entries2$_i=_slicedToArray(_Object$entries2[_i5],2),l=_Object$entries2$_i[0],f=_Object$entries2$_i[1];if(!(f!=null&&f.type)){_context84.next=15;break;}_context84.t0=f==null?void 0:f.type;_context84.next=_context84.t0===xt.UpdateNode?10:_context84.t0===xt.FullWork?10:15;break;case 10:_context84.next=12;return this.runFullWork(_objectSpread(_objectSpread({},f),{},{workId:l,msgType:xt.FullWork,dataType:Vt.Service,viewId:this.viewId}));case 12:h=_context84.sent;c=Zt(c,h);return _context84.abrupt("break",15);case 15:_i5++;_context84.next=4;break;case 18:c&&this.thread._post({sp:[{type:xt.BoundingBox,scenePath:r,rect:c,viewId:this.viewId}]});case 19:case"end":return _context84.stop();}},_callee80,this);}));function getBoundingRect(_x124){return _getBoundingRect.apply(this,arguments);}return getBoundingRect;}()}]);}(bl);var uo=/* @__PURE__ */function(i){return i.Full="full",i.Sub="sub",i;}(uo||{});var kM=/*#__PURE__*/function(){function kM(e,t){var _this109=this;_classCallCheck(this,kM);dt(this,"_self");dt(this,"version",vh);dt(this,"type");// protected hasPriorityDraw: boolean = true;
|
|
515
515
|
dt(this,"workThreadMap",/* @__PURE__ */new Map());dt(this,"post",function(e,t){t?_this109._self.postMessage(e,t):_this109._self.postMessage(e);});this._self=e,this.type=t,this.register();}return _createClass(kM,[{key:"init",value:function init(e){var t=e.viewId,r=e.dpr,n=e.offscreenCanvasOpt,s=e.layerOpt,c=e.isSafari,l=e.combineUnitTime,f=e.syncUnitTime,h=e.maxCombineEraserTime,m=e.offscreenCanvas,u=e.isUseSimple;if(!r||!n||!s)return;var y;this.type==="full"&&(u?y=new KM(t,{dpr:r,offscreenCanvasOpt:n,layerOpt:s,combineUnitTime:l,syncUnitTime:f,maxCombineEraserTime:h,offscreenCanvas:m},this.post):y=new sd(t,{dpr:r,offscreenCanvasOpt:n,layerOpt:s,combineUnitTime:l,syncUnitTime:f,maxCombineEraserTime:h},this.post)),this.type==="sub"&&!u&&(y=new id(t,{dpr:r,offscreenCanvasOpt:n,layerOpt:s,isUseSimple:u},this.post)),y&&c&&y.setIsSafari(c),y&&e.cameraOpt&&y.setCameraOpt(e.cameraOpt),y&&this.workThreadMap.set(t,y);}},{key:"setFontFaces",value:function(){var _setFontFaces=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee81(e){var _this110=this;var t,r,_iterator71,_step71,_loop8;return _regeneratorRuntime().wrap(function _callee81$(_context86){while(1)switch(_context86.prev=_context86.next){case 0:t=[],r=[];_iterator71=_createForOfIteratorHelper(e);_context86.prev=2;_loop8=/*#__PURE__*/_regeneratorRuntime().mark(function _loop8(){var n,s,c,l,f,h,m,u,y;return _regeneratorRuntime().wrap(function _loop8$(_context85){while(1)switch(_context85.prev=_context85.next){case 0:n=_step71.value;s=n.fontFamily,c=n.buffer;_context85.prev=2;if(!(!c||c.byteLength===0)){_context85.next=5;break;}throw new Error("Invalid font data for ".concat(s,": empty buffer"));case 5:try{l=new FontFace(s,c);}catch(_unused29){f=new Uint8Array(c);l=new FontFace(s,f);}_context85.next=8;return _this110._self.fonts.add(l);case 8:_context85.prev=8;_context85.next=11;return l.loaded;case 11:t.push(s);_context85.next=49;break;case 14:_context85.prev=14;_context85.t0=_context85["catch"](8);h=_this110._self.fonts;if(!(h&&typeof h.load=="function")){_context85.next=42;break;}_context85.prev=18;m=h.load(s);u=new Promise(function(T,E){return setTimeout(function(){return E(new Error("Font load timeout for ".concat(s)));},5e3);});_context85.next=23;return Promise.race([m,u]);case 23:y=_context85.sent;if(!(y&&y.length>0)){_context85.next=28;break;}t.push(s);_context85.next=29;break;case 28:throw new Error("Font ".concat(s," load returned empty result"));case 29:_context85.next=40;break;case 31:_context85.prev=31;_context85.t1=_context85["catch"](18);_context85.next=35;return _this110.isFontAvailable(s);case 35:if(!_context85.sent){_context85.next=39;break;}t.push(s);_context85.next=40;break;case 39:throw _context85.t1;case 40:_context85.next=49;break;case 42:_context85.next=44;return _this110.isFontAvailable(s);case 44:if(!_context85.sent){_context85.next=48;break;}t.push(s);_context85.next=49;break;case 48:throw _context85.t0;case 49:_context85.next=54;break;case 51:_context85.prev=51;_context85.t2=_context85["catch"](2);console.error("Font ".concat(s," load error: ").concat(_context85.t2)),r.push(s);case 54:case"end":return _context85.stop();}},_loop8,null,[[2,51],[8,14],[18,31]]);});_iterator71.s();case 5:if((_step71=_iterator71.n()).done){_context86.next=9;break;}return _context86.delegateYield(_loop8(),"t0",7);case 7:_context86.next=5;break;case 9:_context86.next=14;break;case 11:_context86.prev=11;_context86.t1=_context86["catch"](2);_iterator71.e(_context86.t1);case 14:_context86.prev=14;_iterator71.f();return _context86.finish(14);case 17:this.post({sp:[{type:xt.SetFontFace,setFontFaceResult:!0,failedFonts:r.length>0?r:void 0}]});case 18:case"end":return _context86.stop();}},_callee81,this,[[2,11,14,17]]);}));function setFontFaces(_x125){return _setFontFaces.apply(this,arguments);}return setFontFaces;}()// 检查字体是否可用
|
|
516
|
-
},{key:"isFontAvailable",value:function(){var _isFontAvailable=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e){var t,r,n,_iterator72,_step72,_s3,s;return _regeneratorRuntime().wrap(function _callee82$(_context87){while(1)switch(_context87.prev=_context87.next){case 0:_context87.prev=0;t=this._self.fonts;if(t){_context87.next=4;break;}return _context87.abrupt("return",!1);case 4:r=!1,n=null;_iterator72=_createForOfIteratorHelper(t);_context87.prev=6;_iterator72.s();case 8:if((_step72=_iterator72.n()).done){_context87.next=15;break;}_s3=_step72.value;if(!(_s3.family===e)){_context87.next=13;break;}r=!0,n=_s3;return _context87.abrupt("break",15);case 13:_context87.next=8;break;case 15:_context87.next=20;break;case 17:_context87.prev=17;_context87.t0=_context87["catch"](6);_iterator72.e(_context87.t0);case 20:_context87.prev=20;_iterator72.f();return _context87.finish(20);case 23:if(!(!r||!n)){_context87.next=25;break;}return _context87.abrupt("return",!1);case 25:if(!(n.status==="loaded")){_context87.next=27;break;}return _context87.abrupt("return",!0);case 27:_context87.prev=27;_context87.next=30;return n.loaded;case 30:return _context87.abrupt("return",!0);case 33:_context87.prev=33;_context87.t1=_context87["catch"](27);if(!(t&&typeof t.load=="function")){_context87.next=48;break;}_context87.prev=36;_context87.next=39;return t.load(e);case 39:s=_context87.sent;return _context87.abrupt("return",s&&s.length>0);case 43:_context87.prev=43;_context87.t2=_context87["catch"](36);return _context87.abrupt("return",!1);case 46:_context87.next=49;break;case 48:return _context87.abrupt("return",!0);case 49:_context87.next=54;break;case 51:_context87.prev=51;_context87.t3=_context87["catch"](0);return _context87.abrupt("return",!1);case 54:case"end":return _context87.stop();}},_callee82,this,[[0,51],[6,17,20,23],[27,33],[36,43]]);}));function isFontAvailable(_x126){return _isFontAvailable.apply(this,arguments);}return isFontAvailable;}()},{key:"register",value:function register(){var _this111=this;onmessage=/*#__PURE__*/function(){var _ref171=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e){var t,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,r,n,s,c,l,f,_iterator73,_step73,_step73$value,m,u,y,_iterator74,_step74,_m15,h;return _regeneratorRuntime().wrap(function _callee83$(_context88){while(1)switch(_context88.prev=_context88.next){case 0:t=e.data;if(!t){_context88.next=54;break;}_iteratorAbruptCompletion=false;_didIteratorError=false;_context88.prev=4;_iterator=_asyncIterator(t.values());case 6:_context88.next=8;return _iterator.next();case 8:if(!(_iteratorAbruptCompletion=!(_step=_context88.sent).done)){_context88.next=38;break;}r=_step.value;n=r.msgType,s=r.viewId,c=r.tasksqueue,l=r.mainTasksqueueCount,f=r.fontBuffers;if(!f){_context88.next=14;break;}_this111.setFontFaces(f);return _context88.abrupt("continue",35);case 14:if(!(n===xt.Console)){_context88.next=17;break;}console.log(_this111);return _context88.abrupt("continue",35);case 17:if(!(n===xt.Init)){_context88.next=20;break;}_this111.init(r);return _context88.abrupt("continue",35);case 20:if(!(n===xt.TasksQueue&&c!=null&&c.size)){_context88.next=25;break;}_iterator73=_createForOfIteratorHelper(_this111.workThreadMap.entries());try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){_step73$value=_slicedToArray(_step73.value,2),m=_step73$value[0],u=_step73$value[1];y=c.get(m);y&&u.on(y);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}_this111.type==="full"&&er(l)&&_this111.post({workerTasksqueueCount:l});return _context88.abrupt("continue",35);case 25:if(!(s===e1)){_context88.next=29;break;}_iterator74=_createForOfIteratorHelper(_this111.workThreadMap.values());try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){_m15=_step74.value;_m15.on(r),n===xt.Destroy&&_this111.workThreadMap["delete"](s);}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}return _context88.abrupt("continue",35);case 29:h=_this111.workThreadMap.get(s);_context88.t0=h;if(!_context88.t0){_context88.next=35;break;}_context88.next=34;return h.on(r);case 34:n===xt.Destroy&&_this111.workThreadMap["delete"](s);case 35:_iteratorAbruptCompletion=false;_context88.next=6;break;case 38:_context88.next=44;break;case 40:_context88.prev=40;_context88.t1=_context88["catch"](4);_didIteratorError=true;_iteratorError=_context88.t1;case 44:_context88.prev=44;_context88.prev=45;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context88.next=49;break;}_context88.next=49;return _iterator["return"]();case 49:_context88.prev=49;if(!_didIteratorError){_context88.next=52;break;}throw _iteratorError;case 52:return _context88.finish(49);case 53:return _context88.finish(44);case 54:case"end":return _context88.stop();}},_callee83,null,[[4,40,44,54],[45,,49,53]]);}));return function onmessage(_x127){return _ref171.apply(this,arguments);};}();}}]);}();var id=/*#__PURE__*/function(_Jh){function id(t,r,n){var _this112;_classCallCheck(this,id);_this112=_callSuper(this,id,[t,r,"sub"/* Sub */]);dt(_this112,"type","sub");dt(_this112,"_post");dt(_this112,"topLayer");dt(_this112,"serviceWork");dt(_this112,"localWork");dt(_this112,"topLayerWork");dt(_this112,"snapshotWork");_this112._post=n;var s=vr.bufferSize.sub;_this112.topLayer=r.isUseSimple?void 0:_this112.createLayer("topLayer",_this112.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:s,contextType:"2d"}));var c={thread:_this112,viewId:_this112.viewId,vNodes:_this112.vNodes,fullLayer:_this112.fullLayer,topLayer:_this112.topLayer,isUseSimple:r.isUseSimple};_this112.localWork=new $M(c),r.isUseSimple||(_this112.topLayerWork=new jM(c)),_this112.snapshotWork=new nd(_objectSpread(_objectSpread({},c),{},{createScene:_this112.createScene.bind(_this112),createLayer:_this112.createLayer.bind(_this112)})),_this112.vNodes.init(_this112.fullLayer);return _this112;}_inherits(id,_Jh);return _createClass(id,[{key:"combinePost",value:function(){var _combinePost=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee84(){var _this113=this;var c,l,_this$combinePostData,t,r,n,f,_iterator75,_step75,h,m,s;return _regeneratorRuntime().wrap(function _callee84$(_context89){while(1)switch(_context89.prev=_context89.next){case 0:_this$combinePostData=this.combinePostData(),t=_this$combinePostData.render,r=_objectWithoutProperties(_this$combinePostData,_excluded3);if(!(t!=null&&t.length)){_context89.next=28;break;}f=[];_iterator75=_createForOfIteratorHelper(t);_context89.prev=4;_iterator75.s();case 6:if((_step75=_iterator75.n()).done){_context89.next=19;break;}h=_step75.value;if(!h.rect){_context89.next=17;break;}if(!(h.rect=Zh(fr(h.rect),this.scene,this.dpr),!h.rect)){_context89.next=11;break;}return _context89.abrupt("continue",17);case 11:if(!(h.drawCanvas&&h.rect&&h.rect.w>0&&h.rect.h>0)){_context89.next=16;break;}_context89.next=14;return this.getRectImageBitmap(h);case 14:m=_context89.sent;h.imageBitmap=m,n||(n=[]),n.push(m);case 16:f.push(h);case 17:_context89.next=6;break;case 19:_context89.next=24;break;case 21:_context89.prev=21;_context89.t0=_context89["catch"](4);_iterator75.e(_context89.t0);case 24:_context89.prev=24;_iterator75.f();return _context89.finish(24);case 27:r.render=f;case 28:s=(c=r.sp)==null?void 0:c.filter(function(f){return f.type!==xt.None||f.isLockSentEventCursor;});s!=null&&s.length?r.sp=s.map(function(f){return _objectSpread(_objectSpread({},f),{},{viewId:_this113.viewId});}):delete r.sp,r.consumeCount===void 0&&delete r.consumeCount,r.subWorkerDrawCount===void 0&&delete r.subWorkerDrawCount,(s!=null&&s.length||r.consumeCount||r.subWorkerDrawCount||(l=r==null?void 0:r.render)!=null&&l.length)&&this._post(r,n),this.delayPostDoneResolve&&this.delayPostDoneResolve(!0);case 30:case"end":return _context89.stop();}},_callee84,this,[[4,21,24,27]]);}));function combinePost(){return _combinePost.apply(this,arguments);}return combinePost;}()},{key:"on",value:function(){var _on2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee85(t){var h,m,r,n,s,c,l,f,u;return _regeneratorRuntime().wrap(function _callee85$(_context90){while(1)switch(_context90.prev=_context90.next){case 0:r=t.msgType,n=t.toolsType,s=t.opt,c=t.dataType,l=t.workState,f=t.isLockSentEventCursor;_context90.t0=r;_context90.next=_context90.t0===xt.UpdateTools?4:_context90.t0===xt.CreateWork?9:_context90.t0===xt.DrawWork?11:_context90.t0===xt.RemoveNode?19:_context90.t0===xt.FullWork?22:_context90.t0===xt.Snapshot?27:_context90.t0===xt.BoundingBox?32:37;break;case 4:if(!(n&&(h=this.topLayerWork)!=null&&h.canUseTopLayer(n)&&s)){_context90.next=8;break;}u={toolsType:n,toolsOpt:s};this.topLayerWork.setToolsOpt(u);return _context90.abrupt("return");case 8:return _context90.abrupt("break",37);case 9:this.createLocalWork(t);return _context90.abrupt("return");case 11:if(!(l===te.Done&&c===Vt.Local)){_context90.next=17;break;}_context90.next=14;return this.consumeDrawAll(c,t);case 14:n===Tt.LaserPen&&f&&this.post({sp:[{type:xt.None,isLockSentEventCursor:f}]});_context90.next=18;break;case 17:this.consumeDraw(c,t);case 18:return _context90.abrupt("return");case 19:_context90.next=21;return this.removeNode(t);case 21:return _context90.abrupt("return");case 22:_context90.t1=n&&(m=this.topLayerWork)!=null&&m.canUseTopLayer(n);if(!_context90.t1){_context90.next=26;break;}_context90.next=26;return this.consumeDrawAll(c,t);case 26:return _context90.abrupt("return");case 27:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===ki?6e3:3e3,contextType:"2d"}));_context90.next=30;return this.snapshotWork.getSnapshot(t);case 30:this.snapshotWork.destroySnapshotFullLayer();return _context90.abrupt("return");case 32:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===ki?6e3:3e3,contextType:"2d"}));_context90.next=35;return this.snapshotWork.getBoundingRect(t);case 35:this.snapshotWork.destroySnapshotFullLayer();return _context90.abrupt("return");case 37:_context90.next=39;return _superPropGet(id,"on",this,3)([t]);case 39:case"end":return _context90.stop();}},_callee85,this);}));function on(_x128){return _on2.apply(this,arguments);}return on;}()},{key:"createLocalWork",value:function createLocalWork(t){var c;var r=t.workId,n=t.toolsType,s=t.opt;if(n&&(c=this.topLayerWork)!=null&&c.canUseTopLayer(n)&&r&&s){this.topLayerWork.getToolsOpt()||this.topLayerWork.setToolsOpt({toolsType:n,toolsOpt:s}),this.topLayerWork.setWorkOptions(r.toString(),s);return;}n&&_superPropGet(id,"createLocalWork",this,3)([t]);}},{key:"removeNode",value:function(){var _removeNode2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee86(t){var r;return _regeneratorRuntime().wrap(function _callee86$(_context91){while(1)switch(_context91.prev=_context91.next){case 0:r=t.dataType;_context91.t0=r===Vt.Local;if(!_context91.t0){_context91.next=5;break;}_context91.next=5;return this.localWork.removeWork(t);case 5:case"end":return _context91.stop();}},_callee86,this);}));function removeNode(_x129){return _removeNode2.apply(this,arguments);}return removeNode;}()},{key:"getLayer",value:function getLayer(t){switch(t){case Ut.TopFloat:return this.topLayer||this.fullLayer;default:return this.fullLayer;}}},{key:"getOffscreen",value:function getOffscreen(t){var n;return((n=this.getLayer(t))==null?void 0:n.parent).canvas;}},{key:"consumeDraw",value:function(){var _consumeDraw5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee87(t,r){var c,n,s;return _regeneratorRuntime().wrap(function _callee87$(_context92){while(1)switch(_context92.prev=_context92.next){case 0:n=r.workId,s=r.toolsType;if(!n){_context92.next=11;break;}if(!(s&&(c=this.topLayerWork)!=null&&c.canUseTopLayer(s))){_context92.next=5;break;}t===Vt.Local&&(this.topLayerWork.getWorkShape(n.toString())||this.createLocalWork(r)),this.topLayerWork.consumeDraw(r);return _context92.abrupt("return");case 5:_context92.t0=s;if(!_context92.t0){_context92.next=10;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(r);_context92.next=10;return this.localWork.consumeDraw(r);case 10:return _context92.abrupt("return");case 11:case"end":return _context92.stop();}},_callee87,this);}));function consumeDraw(_x130,_x131){return _consumeDraw5.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee88(t,r){var l,n,s,c,f;return _regeneratorRuntime().wrap(function _callee88$(_context93){while(1)switch(_context93.prev=_context93.next){case 0:n=r.workId,s=r.toolsType,c=r.dataType;if(!n){_context93.next=8;break;}f=n.toString();if(!(s&&(l=this.topLayerWork)!=null&&l.canUseTopLayer(s))){_context93.next=6;break;}c===Vt.Local&&(this.topLayerWork.getWorkShape(f)||this.createLocalWork(r)),this.topLayerWork.consumeDrawAll(r);return _context93.abrupt("return");case 6:s&&(this.localWork.getWorkShape(f)||_superPropGet(id,"createLocalWork",this,3)([r]),this.localWork.consumeDrawAll(r));return _context93.abrupt("return");case 8:case"end":return _context93.stop();}},_callee88,this);}));function consumeDrawAll(_x132,_x133){return _consumeDrawAll4.apply(this,arguments);}return consumeDrawAll;}()},{key:"clearAll",value:function(){var _clearAll2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee89(){return _regeneratorRuntime().wrap(function _callee89$(_context94){while(1)switch(_context94.prev=_context94.next){case 0:this.vNodes.clear();_superPropGet(id,"clearAll",this,3)([]);this.topLayer&&(this.topLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),Lr(this.topLayer,this.topLayer.parent));_context94.next=5;return this.post({render:[{isClearAll:!0,clearCanvas:Ut.TopFloat,viewId:this.viewId}],sp:[{type:xt.Clear}]});case 5:case"end":return _context94.stop();}},_callee89,this);}));function clearAll(){return _clearAll2.apply(this,arguments);}return clearAll;}()},{key:"getRectImageBitmap",value:function getRectImageBitmap(t,r){var n=t.rect,s=t.drawCanvas,c=Math.floor(n.x*this.dpr),l=Math.floor(n.y*this.dpr),f=Math.floor(n.w*this.dpr||1),h=Math.floor(n.h*this.dpr||1);return createImageBitmap(this.getOffscreen(s),c,l,f,h,r);}},{key:"updateLayer",value:function updateLayer(t){var r=t.width,n=t.height;_superPropGet(id,"updateLayer",this,3)([t]),this.topLayer&&(this.topLayer.parent.setAttribute("width",r),this.topLayer.parent.setAttribute("height",n),this.topLayer.setAttribute("size",[r,n]),this.topLayer.setAttribute("pos",[r*0.5,n*0.5]));}},{key:"updateDpr",value:function(){var _updateDpr2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee90(t){var r,n,s;return _regeneratorRuntime().wrap(function _callee90$(_context95){while(1)switch(_context95.prev=_context95.next){case 0:_superPropGet(id,"updateDpr",this,3)([t]);r=this.topLayerWork&&!!this.topLayerWork.localWorkShapes.size||!1,n=!!this.localWork.getWorkShapes().size,s=[];n&&s.push({isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId});r&&s.push({isClearAll:!0,clearCanvas:Ut.TopFloat,viewId:this.viewId});_context95.t0=s.length;if(!_context95.t0){_context95.next=8;break;}_context95.next=8;return this.post({render:s});case 8:case"end":return _context95.stop();}},_callee90,this);}));function updateDpr(_x134){return _updateDpr2.apply(this,arguments);}return updateDpr;}()},{key:"updateCamera",value:function(){var _updateCamera=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee91(t){var _this114=this;var s,r,n,c,l,_iterator76,_step76,_loop9;return _regeneratorRuntime().wrap(function _callee91$(_context97){while(1)switch(_context97.prev=_context97.next){case 0:r=[],n=t.cameraOpt;if(!(n&&!qr(this.cameraOpt,n))){_context97.next=25;break;}c=this.topLayerWork&&!!this.topLayerWork.localWorkShapes.size||!1,l=!!this.localWork.getWorkShapes().size;if(!(l&&this.localWork.workShapesDone(),this.setCameraOpt(n),l&&r.push({isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}),c&&this.topLayerWork)){_context97.next=21;break;}r.push({isClearAll:!0,clearCanvas:Ut.TopFloat,viewId:this.viewId});_iterator76=_createForOfIteratorHelper(this.topLayerWork.localWorkShapes.entries()||[]);_context97.prev=6;_loop9=/*#__PURE__*/_regeneratorRuntime().mark(function _loop9(){var _step76$value,f,h,m;return _regeneratorRuntime().wrap(function _loop9$(_context96){while(1)switch(_context96.prev=_context96.next){case 0:_step76$value=_slicedToArray(_step76.value,2),f=_step76$value[0],h=_step76$value[1];if(h.totalRect){(s=_this114.topLayer)==null||s.getElementsByName(f.toString()).forEach(function(u){var y=u.getBoundingClientRect(),T=ve({x:y.x,y:y.y,w:y.width,h:y.height});m=Zt(m,T);}),h.totalRect=m,_this114.topLayerWork.localWorkShapes.set(f,h);}case 2:case"end":return _context96.stop();}},_loop9);});_iterator76.s();case 9:if((_step76=_iterator76.n()).done){_context97.next=13;break;}return _context97.delegateYield(_loop9(),"t0",11);case 11:_context97.next=9;break;case 13:_context97.next=18;break;case 15:_context97.prev=15;_context97.t1=_context97["catch"](6);_iterator76.e(_context97.t1);case 18:_context97.prev=18;_iterator76.f();return _context97.finish(18);case 21:_context97.t2=r.length;if(!_context97.t2){_context97.next=25;break;}_context97.next=25;return this.post({render:r});case 25:case"end":return _context97.stop();}},_callee91,this,[[6,15,18,21]]);}));function updateCamera(_x135){return _updateCamera.apply(this,arguments);}return updateCamera;}()},{key:"setCameraOpt",value:function setCameraOpt(t,r){var h,m;this.cameraOpt=t;var n=t.scale,s=t.centerX,c=t.centerY,l=t.width,f=t.height;(l!==this.scene.width||f!==this.scene.height)&&this.updateScene(this.scene,{width:l,height:f}),r?(r.setAttribute("scale",[n,n]),r.setAttribute("translate",[-s,-c])):(this.fullLayer.setAttribute("scale",[n,n]),this.fullLayer.setAttribute("translate",[-s,-c]),(h=this.topLayer)==null||h.setAttribute("scale",[n,n]),(m=this.topLayer)==null||m.setAttribute("translate",[-s,-c]));}}]);}(Jh);var sd=/*#__PURE__*/function(_Jh2){function sd(t,r,n){var _this115;_classCallCheck(this,sd);_this115=_callSuper(this,sd,[t,r,"full"/* Full */]);dt(_this115,"serviceDrawLayer");dt(_this115,"localDrawLayer");dt(_this115,"snapshotFullLayer");dt(_this115,"methodBuilder");dt(_this115,"localWork");dt(_this115,"serviceWork");dt(_this115,"_post");dt(_this115,"debounceUpdateCache",/* @__PURE__ */new Set());_this115._post=n;var s=vr.bufferSize.sub;_this115.serviceDrawLayer=_this115.createLayer("serviceDrawLayer",_this115.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:s,contextType:"2d"})),_this115.localDrawLayer=_this115.createLayer("localDrawLayer",_this115.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:s,contextType:"2d"}));var c={thread:_this115,viewId:_this115.viewId,vNodes:_this115.vNodes,fullLayer:_this115.fullLayer};_this115.localWork=new ed(_objectSpread(_objectSpread({},c),{},{drawLayer:_this115.localDrawLayer})),r.combineUnitTime&&_this115.localWork.setCombineUnitTime(r.combineUnitTime),r.maxCombineEraserTime&&_this115.localWork.setmaxCombineEraserTime(r.maxCombineEraserTime),r.syncUnitTime&&_this115.localWork.setSyncUnitTime(r.syncUnitTime),_this115.serviceWork=new rd(_objectSpread(_objectSpread({},c),{},{drawLayer:_this115.serviceDrawLayer})),_this115.methodBuilder=new Xu([he.CopyNode,he.SetColorNode,he.DeleteNode,he.RotateNode,he.ScaleNode,he.TranslateNode,he.ZIndexNode,he.SetFontStyle,he.SetPoint,he.SetLock,he.SetShapeOpt]).registerForWorker(_this115),_this115.vNodes.init(_this115.fullLayer);return _this115;}_inherits(sd,_Jh2);return _createClass(sd,[{key:"combinePost",value:function(){var _combinePost2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee92(){var _this116=this;var c,l,_this$combinePostData2,t,r,n,f,_iterator77,_step77,h,m,s;return _regeneratorRuntime().wrap(function _callee92$(_context98){while(1)switch(_context98.prev=_context98.next){case 0:_this$combinePostData2=this.combinePostData(),t=_this$combinePostData2.render,r=_objectWithoutProperties(_this$combinePostData2,_excluded4);if(!(t!=null&&t.length)){_context98.next=28;break;}f=[];_iterator77=_createForOfIteratorHelper(t);_context98.prev=4;_iterator77.s();case 6:if((_step77=_iterator77.n()).done){_context98.next=19;break;}h=_step77.value;if(!h.rect){_context98.next=17;break;}if(!(h.rect=Zh(fr(h.rect),this.scene,this.dpr),!h.rect)){_context98.next=11;break;}return _context98.abrupt("continue",17);case 11:if(!(h.drawCanvas&&h.rect&&h.rect.w>0&&h.rect.h>0)){_context98.next=16;break;}_context98.next=14;return this.getRectImageBitmap(h);case 14:m=_context98.sent;h.imageBitmap=m,n||(n=[]),n.push(m);case 16:f.push(h);case 17:_context98.next=6;break;case 19:_context98.next=24;break;case 21:_context98.prev=21;_context98.t0=_context98["catch"](4);_iterator77.e(_context98.t0);case 24:_context98.prev=24;_iterator77.f();return _context98.finish(24);case 27:r.render=f;case 28:s=(c=r.sp)==null?void 0:c.filter(function(f){return f.type!==xt.None||f.isLockSentEventCursor;});s!=null&&s.length?r.sp=s.map(function(f){return _objectSpread(_objectSpread({},f),{},{viewId:_this116.viewId});}):delete r.sp,r.fullWorkerDrawCount===void 0&&delete r.fullWorkerDrawCount,r.consumeCount===void 0&&delete r.consumeCount,(r!=null&&r.fullWorkerDrawCount||r.consumeCount||s!=null&&s.length||(l=r.render)!=null&&l.length)&&this._post(r,n),this.delayPostDoneResolve&&this.delayPostDoneResolve(!0);case 30:case"end":return _context98.stop();}},_callee92,this,[[4,21,24,27]]);}));function combinePost(){return _combinePost2.apply(this,arguments);}return combinePost;}()},{key:"on",value:function(){var _on3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee93(t){var _this117=this;var r,n,s,c,l,f,h,m,_h8;return _regeneratorRuntime().wrap(function _callee93$(_context99){while(1)switch(_context99.prev=_context99.next){case 0:if(!this.methodBuilder.consumeForWorker(t)){_context99.next=2;break;}return _context99.abrupt("return");case 2:r=t.msgType,n=t.dataType,s=t.workId,c=t.toolsType,l=t.workState,f=t.workIds;_context99.t0=r;_context99.next=_context99.t0===xt.AuthClear?6:_context99.t0===xt.CreateWork?9:_context99.t0===xt.DrawWork?11:_context99.t0===xt.Select?20:_context99.t0===xt.UpdateNode?27:_context99.t0===xt.FullWork?27:_context99.t0===xt.RemoveNode?29:_context99.t0===xt.GetTextActive?32:_context99.t0===xt.CursorHover?35:_context99.t0===xt.CursorBlur?38:_context99.t0===xt.GetVNodeInfo?41:43;break;case 6:h=t.clearUids,m=t.localUid;this.vNodes.setCanClearUids(h),this.vNodes.setLocalUid(m);return _context99.abrupt("break",43);case 9:c!==Tt.LaserPen&&this.createLocalWork(t);return _context99.abrupt("break",43);case 11:_context99.t1=c!==Tt.LaserPen;if(!_context99.t1){_context99.next=19;break;}if(!(l===te.Done&&n===Vt.Local)){_context99.next=18;break;}_context99.next=16;return this.consumeDrawAll(n,t);case 16:_context99.next=19;break;case 18:this.consumeDraw(n,t);case 19:return _context99.abrupt("break",43);case 20:if(!(s===Me)){_context99.next=25;break;}_context99.next=23;return this.localWork.updateFullSelectWork(t);case 23:_context99.next=26;break;case 25:this.serviceWork.runSelectWork(t);case 26:return _context99.abrupt("return");case 27:this.consumeFull(n,t);return _context99.abrupt("return");case 29:_context99.next=31;return this.removeNode(t);case 31:return _context99.abrupt("return");case 32:_context99.next=34;return this.checkTextActive(t);case 34:return _context99.abrupt("return");case 35:_context99.next=37;return this.cursorHover(t);case 37:return _context99.abrupt("return");case 38:_context99.next=40;return this.cursorBlur();case 40:return _context99.abrupt("return");case 41:if(s&&f){_h8=f.map(function(m){return _this117.vNodes.get(m);});this.post({sp:[{type:xt.GetVNodeInfo,dataType:Vt.Worker,workId:s,vInfo:_h8}]});}return _context99.abrupt("break",43);case 43:_context99.next=45;return _superPropGet(sd,"on",this,3)([t]);case 45:case"end":return _context99.stop();}},_callee93,this);}));function on(_x136){return _on3.apply(this,arguments);}return on;}()},{key:"removeNode",value:function(){var _removeNode3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee94(t){var _this118=this;var r,n,s,c,l,_iterator78,_step78,_loop10;return _regeneratorRuntime().wrap(function _callee94$(_context101){while(1)switch(_context101.prev=_context101.next){case 0:r=t.dataType,n=t.workId,s=t.removeIds,c=[],l=s||[];if(!(n&&l.push(n.toString()),l.length)){_context101.next=20;break;}_iterator78=_createForOfIteratorHelper(l);_context101.prev=3;_loop10=/*#__PURE__*/_regeneratorRuntime().mark(function _loop10(){var f;return _regeneratorRuntime().wrap(function _loop10$(_context100){while(1)switch(_context100.prev=_context100.next){case 0:f=_step78.value;f===Me?c.push(_this118.localWork.removeSelector(t,_this118)):r===Vt.Local?c.push(_this118.localWork.removeWork(t).then(function(){_this118.localWork.colloctEffectSelectWork(t),_this118.deleteCachedImagesByWorkId(f);})):r===Vt.Service&&c.push(_this118.serviceWork.removeWork(t).then(function(){_this118.localWork.colloctEffectSelectWork(t),_this118.deleteCachedImagesByWorkId(f);}));case 2:case"end":return _context100.stop();}},_loop10);});_iterator78.s();case 6:if((_step78=_iterator78.n()).done){_context101.next=10;break;}return _context101.delegateYield(_loop10(),"t0",8);case 8:_context101.next=6;break;case 10:_context101.next=15;break;case 12:_context101.prev=12;_context101.t1=_context101["catch"](3);_iterator78.e(_context101.t1);case 15:_context101.prev=15;_iterator78.f();return _context101.finish(15);case 18:_context101.next=20;return Promise.all(c);case 20:case"end":return _context101.stop();}},_callee94,null,[[3,12,15,18]]);}));function removeNode(_x137){return _removeNode3.apply(this,arguments);}return removeNode;}()},{key:"checkTextActive",value:function(){var _checkTextActive2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee95(t){var r;return _regeneratorRuntime().wrap(function _callee95$(_context102){while(1)switch(_context102.prev=_context102.next){case 0:r=t.dataType;_context102.t0=r===Vt.Local;if(!_context102.t0){_context102.next=5;break;}_context102.next=5;return this.localWork.checkTextActive(t);case 5:case"end":return _context102.stop();}},_callee95,this);}));function checkTextActive(_x138){return _checkTextActive2.apply(this,arguments);}return checkTextActive;}()},{key:"clearAll",value:function(){var _clearAll3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee96(){return _regeneratorRuntime().wrap(function _callee96$(_context103){while(1)switch(_context103.prev=_context103.next){case 0:this.vNodes.clear();_superPropGet(sd,"clearAll",this,3)([]);this.localDrawLayer&&(this.localDrawLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),Lr(this.localDrawLayer,this.localDrawLayer.parent));this.serviceDrawLayer&&(this.serviceDrawLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),Lr(this.serviceDrawLayer,this.serviceDrawLayer.parent));_context103.next=6;return this.post({render:[{isClearAll:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{isClearAll:!0,clearCanvas:Ut.ServiceFloat,viewId:this.viewId},{isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}],sp:[{type:xt.Clear}]});case 6:case"end":return _context103.stop();}},_callee96,this);}));function clearAll(){return _clearAll3.apply(this,arguments);}return clearAll;}()},{key:"updateLayer",value:function updateLayer(t){var r=t.width,n=t.height;_superPropGet(sd,"updateLayer",this,3)([t]),this.localDrawLayer&&(this.localDrawLayer.parent.setAttribute("width",r),this.localDrawLayer.parent.setAttribute("height",n),this.localDrawLayer.setAttribute("size",[r,n]),this.localDrawLayer.setAttribute("pos",[r*0.5,n*0.5])),this.serviceDrawLayer&&(this.serviceDrawLayer.parent.setAttribute("width",r),this.serviceDrawLayer.parent.setAttribute("height",n),this.serviceDrawLayer.setAttribute("size",[r,n]),this.serviceDrawLayer.setAttribute("pos",[r*0.5,n*0.5]));}},{key:"setCameraOpt",value:function setCameraOpt(t){this.cameraOpt=t;var r=t.scale,n=t.centerX,s=t.centerY,c=t.width,l=t.height;(c!==this.scene.width||l!==this.scene.height)&&this.updateScene(this.scene,{width:c,height:l}),this.fullLayer&&(this.fullLayer.setAttribute("scale",[r,r]),this.fullLayer.setAttribute("translate",[-n,-s])),this.localDrawLayer&&(this.localDrawLayer.setAttribute("scale",[r,r]),this.localDrawLayer.setAttribute("translate",[-n,-s])),this.serviceDrawLayer&&(this.serviceDrawLayer.setAttribute("scale",[r,r]),this.serviceDrawLayer.setAttribute("translate",[-n,-s]));}},{key:"getLayer",value:function getLayer(t){switch(t){case Ut.Bg:return this.fullLayer;case Ut.ServiceFloat:return this.serviceDrawLayer;case Ut.Float:return this.localDrawLayer;}}},{key:"getOffscreen",value:function getOffscreen(t){return this.getLayer(t).parent.canvas;}},{key:"consumeFull",value:function(){var _consumeFull2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee97(t,r){var n;return _regeneratorRuntime().wrap(function _callee97$(_context104){while(1)switch(_context104.prev=_context104.next){case 0:_context104.next=2;return this.localWork.colloctEffectSelectWork(r);case 2:n=_context104.sent;_context104.t0=n&&t===Vt.Local;if(!_context104.t0){_context104.next=7;break;}_context104.next=7;return this.localWork.consumeFull(n);case 7:n&&t===Vt.Service&&this.serviceWork.consumeFull(n);case 8:case"end":return _context104.stop();}},_callee97,this);}));function consumeFull(_x139,_x140){return _consumeFull2.apply(this,arguments);}return consumeFull;}()},{key:"consumeDraw",value:function(){var _consumeDraw6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee98(t,r){var n;return _regeneratorRuntime().wrap(function _callee98$(_context105){while(1)switch(_context105.prev=_context105.next){case 0:n=r.workId;_context105.t0=t===Vt.Local&&n;if(!_context105.t0){_context105.next=6;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(r);_context105.next=6;return this.localWork.consumeDraw(r,this.serviceWork);case 6:t===Vt.Service&&this.serviceWork.consumeDraw(r);case 7:case"end":return _context105.stop();}},_callee98,this);}));function consumeDraw(_x141,_x142){return _consumeDraw6.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee99(t,r){var n;return _regeneratorRuntime().wrap(function _callee99$(_context106){while(1)switch(_context106.prev=_context106.next){case 0:n=r.workId;_context106.t0=t===Vt.Local&&n;if(!_context106.t0){_context106.next=6;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(r);_context106.next=6;return this.localWork.consumeDrawAll(r,this.serviceWork);case 6:case"end":return _context106.stop();}},_callee99,this);}));function consumeDrawAll(_x143,_x144){return _consumeDrawAll5.apply(this,arguments);}return consumeDrawAll;}()},{key:"updateDpr",value:function(){var _updateDpr3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee100(t){return _regeneratorRuntime().wrap(function _callee100$(_context107){while(1)switch(_context107.prev=_context107.next){case 0:_superPropGet(sd,"updateDpr",this,3)([t]);_context107.next=3;return this.post({render:[{isClearAll:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{isDrawAll:!0,drawCanvas:Ut.Bg,viewId:this.viewId}]});case 3:case"end":return _context107.stop();}},_callee100,this);}));function updateDpr(_x145){return _updateDpr3.apply(this,arguments);}return updateDpr;}()},{key:"updateCamera",value:function(){var _updateCamera2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee101(t){var _this119=this;var c,l,f,h,m,r,n,s,u,x,_iterator79,_step79,_step79$value,_I55,_d48,y,_iterator80,_step80,_step80$value,_x151,_I60,_d51,_iterator81,_step81,_step81$value,_x152,_I61,_d52,T,E,_x147,_iterator82,_step82,_I56,C,_iterator83,_step83,_x148,_I57,_iterator84,_step84,_d49,_iterator85,_step85,_step85$value,_x150,_step85$value$,_I59,_d50,v,p,S,A,R,D,U,M,W,Y,_iterator86,_step86,_step86$value,_x149,_I58;return _regeneratorRuntime().wrap(function _callee101$(_context108){while(1)switch(_context108.prev=_context108.next){case 0:r=[],n=t.cameraOpt,s=t.scenePath;if(!(n&&!qr(this.cameraOpt,n))){_context108.next=42;break;}this.taskUpdateCameraId&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0);u=!!this.serviceDrawLayer.children.length;if(!s){_context108.next=30;break;}x=!1;_iterator79=_createForOfIteratorHelper(this.localWork.getWorkShapes().entries());_context108.prev=7;_iterator79.s();case 9:if((_step79=_iterator79.n()).done){_context108.next=19;break;}_step79$value=_slicedToArray(_step79.value,2),_I55=_step79$value[0],_d48=_step79$value[1];_context108.t0=_d48.toolsType;_context108.next=_context108.t0===Tt.Text?14:_context108.t0===Tt.PencilEraser?14:_context108.t0===Tt.Eraser?14:_context108.t0===Tt.Selector?14:_context108.t0===Tt.LaserPen?14:15;break;case 14:return _context108.abrupt("break",17);case 15:_I55!==di&&_I55!==Me&&(x=!0);return _context108.abrupt("break",17);case 17:_context108.next=9;break;case 19:_context108.next=24;break;case 21:_context108.prev=21;_context108.t1=_context108["catch"](7);_iterator79.e(_context108.t1);case 24:_context108.prev=24;_iterator79.f();return _context108.finish(24);case 27:if(!x){_context108.next=30;break;}this.taskUpdateCameraId=setTimeout(function(){_this119.taskUpdateCameraId=void 0,_this119.updateCamera(t);},wu);return _context108.abrupt("return");case 30:y=/* @__PURE__ */new Map();_iterator80=_createForOfIteratorHelper(this.vNodes.getNodesByType(Tt.Text).entries());try{for(_iterator80.s();!(_step80=_iterator80.n()).done;){_step80$value=_slicedToArray(_step80.value,2),_x151=_step80$value[0],_I60=_step80$value[1];_d51=_I60.rect;y.set(_x151,{rect:fr(_d51),scale:(c=this.cameraOpt)==null?void 0:c.scale});}}catch(err){_iterator80.e(err);}finally{_iterator80.f();}_iterator81=_createForOfIteratorHelper(this.vNodes.gethasEraserNodes().entries());try{for(_iterator81.s();!(_step81=_iterator81.n()).done;){_step81$value=_slicedToArray(_step81.value,2),_x152=_step81$value[0],_I61=_step81$value[1];_d52=_I61.rect;y.set(_x152,{rect:fr(_d52),scale:(l=this.cameraOpt)==null?void 0:l.scale});}}catch(err){_iterator81.e(err);}finally{_iterator81.f();}T=new Set(y.keys());E=!1;if(this.localWork.hasSelector()){_x147=(f=this.localWork.getSelector())==null?void 0:f.selectIds;if(_x147){E=!0;_iterator82=_createForOfIteratorHelper(_x147);try{for(_iterator82.s();!(_step82=_iterator82.n()).done;){_I56=_step82.value;T.add(_I56);}}catch(err){_iterator82.e(err);}finally{_iterator82.f();}}}C=!1;if(this.serviceWork.selectorWorkShapes.size){_iterator83=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.values());try{for(_iterator83.s();!(_step83=_iterator83.n()).done;){_x148=_step83.value;_I57=_x148.selectIds;if(_I57){C=!0;_iterator84=_createForOfIteratorHelper(_I57);try{for(_iterator84.s();!(_step84=_iterator84.n()).done;){_d49=_step84.value;T.add(_d49);}}catch(err){_iterator84.e(err);}finally{_iterator84.f();}}}}catch(err){_iterator83.e(err);}finally{_iterator83.f();}}if(this.setCameraOpt(n),this.vNodes.curNodeMap.size){this.vNodes.clearTarget(),this.vNodes.updateHighLevelNodesRect(T),this.debounceUpdateCameraId&&clearTimeout(this.debounceUpdateCameraId);_iterator85=_createForOfIteratorHelper(y.entries());try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){_step85$value=_slicedToArray(_step85.value,2),_x150=_step85$value[0],_step85$value$=_step85$value[1],_I59=_step85$value$.rect,_d50=_step85$value$.scale;v=this.vNodes.get(_x150);if(v){p=_I59,S=v.rect,A=this.getSceneRect(),R=Zi(p,A),D=Zi(S,A),U=v.toolsType,M=v.opt;W=!1;(R!==D||p.w!==S.w||p.h!==S.h||D===Tr.intersect)&&(W=!0),U===Tt.Text&&// (opt as TextOptions).workState === EvevtWorkState.Done &&
|
|
517
|
-
W&&this.debounceUpdateCache.add(_x150);Y=!1;_d50&&(h=this.cameraOpt)!=null&&h.scale&&_d50>this.cameraOpt.scale?D!==Tr.outside&&R!==Tr.inside&&(Y=!0):_d50&&(m=this.cameraOpt)!=null&&m.scale&&_d50===this.cameraOpt.scale&&(p.x!==S.x||p.y!==S.y)&&(D===Tr.inside&&R!==Tr.inside||D===Tr.intersect&&R===Tr.intersect)&&(Y=!0),M.eraserlines&&M.eraserlines.length&&Y&&!this.debounceUpdateCache.has(_x150)&&this.debounceUpdateCache.add(_x150);}}}catch(err){_iterator85.e(err);}finally{_iterator85.f();}if(E&&this.localWork.reRenderSelector(),C){_iterator86=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.entries());try{for(_iterator86.s();!(_step86=_iterator86.n()).done;){_step86$value=_slicedToArray(_step86.value,2),_x149=_step86$value[0],_I58=_step86$value[1];this.serviceWork.runSelectWork({workId:_x149,selectIds:_I58.selectIds,msgType:xt.Select,dataType:Vt.Service,viewId:this.viewId});}}catch(err){_iterator86.e(err);}finally{_iterator86.f();}}this.debounceUpdateCameraId=setTimeout(function(){var I;_this119.debounceUpdateCameraId=void 0;var x=[];var _iterator87=_createForOfIteratorHelper(_this119.debounceUpdateCache.values()),_step87;try{var _loop11=function _loop11(){var d=_step87.value;var v=_this119.vNodes.get(d);if(v){var p=v.toolsType,S=v.opt,A=v.op,R=_this119.localWork.setFullWork({toolsType:p,opt:S,workId:d});R&&(p===Tt.Text?(I=_this119.fullLayer)!=null&&I.getElementsByName(d)[0]&&R instanceof Ki&&x.push(R.consumeServiceAsync({isFullWork:!0,replaceId:d,boxRect:_this119.getSceneRect()})):S.eraserlines&&S.eraserlines.length&&x.push(new Promise(function(D){var U=R.consumeService({op:A,isFullWork:!0,replaceId:d,workState:te.Done});_this119.localWork.clearWorkShapeNodeCache(d),D(U);})));}_this119.debounceUpdateCache["delete"](d);};for(_iterator87.s();!(_step87=_iterator87.n()).done;){_loop11();}}catch(err){_iterator87.e(err);}finally{_iterator87.f();}x.length?Promise.all(x).then(function(){var d=[];d.push({isClearAll:!0,clearCanvas:Ut.Bg,viewId:_this119.viewId},{isDrawAll:!0,drawCanvas:Ut.Bg,viewId:_this119.viewId}),d.length&&_this119.post({render:d}),_this119.vNodes.updateLowLevelNodesRect(),_this119.vNodes.clearHighLevelIds();}):(_this119.vNodes.updateLowLevelNodesRect(),_this119.vNodes.clearHighLevelIds());},wu*5);}u&&r.push({isClearAll:!0,clearCanvas:Ut.ServiceFloat,viewId:this.viewId}),this.vNodes.hasRenderNodes()&&r.push({isClearAll:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{isDrawAll:!0,drawCanvas:Ut.Bg,viewId:this.viewId}),r.length&&this.post({render:r});case 42:case"end":return _context108.stop();}},_callee101,this,[[7,21,24,27]]);}));function updateCamera(_x146){return _updateCamera2.apply(this,arguments);}return updateCamera;}()},{key:"getRectImageBitmap",value:function getRectImageBitmap(t){var r=t.rect,n=t.drawCanvas,s=Math.floor(r.x*this.dpr),c=Math.floor(r.y*this.dpr),l=Math.floor(r.w*this.dpr||1),f=Math.floor(r.h*this.dpr||1);return createImageBitmap(this.getOffscreen(n),s,c,l,f,{resizeQuality:"low"});}},{key:"cursorHover",value:function(){var _cursorHover2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee102(t){return _regeneratorRuntime().wrap(function _callee102$(_context109){while(1)switch(_context109.prev=_context109.next){case 0:_context109.next=2;return this.localWork.cursorHover(t);case 2:case"end":return _context109.stop();}},_callee102,this);}));function cursorHover(_x153){return _cursorHover2.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee103(){return _regeneratorRuntime().wrap(function _callee103$(_context110){while(1)switch(_context110.prev=_context110.next){case 0:_context110.next=2;return this.localWork.cursorBlur();case 2:case"end":return _context110.stop();}},_callee103,this);}));function cursorBlur(){return _cursorBlur2.apply(this,arguments);}return cursorBlur;}()},{key:"destroy",value:function destroy(){_superPropGet(sd,"destroy",this,3)([]);}}]);}(Jh);var KM=/*#__PURE__*/function(_sd){function KM(t,r,n){var _this120;_classCallCheck(this,KM);var c,l,f,h;_this120=_callSuper(this,KM,[t,r,n]);dt(_this120,"snapshotWork");dt(_this120,"localDrawScene");dt(_this120,"serviceDrawScene");dt(_this120,"offscreenCanvas");dt(_this120,"localWork");dt(_this120,"serviceWork");if(_this120._post=n,r.offscreenCanvas){_this120.offscreenCanvas=r.offscreenCanvas,_this120.localDrawScene=_this120.createScene(r,(c=_this120.offscreenCanvas)==null?void 0:c.localCanvas),_this120.serviceDrawScene=_this120.createScene(r,(l=_this120.offscreenCanvas)==null?void 0:l.serviceCanvas);var m=vr.bufferSize.sub;_this120.serviceDrawLayer=_this120.createLayer("serviceDrawLayer",_this120.serviceDrawScene||_this120.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:m,contextType:"2d"}),(f=_this120.offscreenCanvas)==null?void 0:f.serviceCanvas),_this120.localDrawLayer=_this120.createLayer("localDrawLayer",_this120.localDrawScene||_this120.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:m,contextType:"2d"}),(h=_this120.offscreenCanvas)==null?void 0:h.localCanvas);}var s={thread:_this120,viewId:_this120.viewId,vNodes:_this120.vNodes,fullLayer:_this120.fullLayer};_this120.localWork=new GM(_objectSpread(_objectSpread({},s),{},{drawLayer:_this120.localDrawLayer})),r.combineUnitTime&&_this120.localWork.setCombineUnitTime(r.combineUnitTime),r.maxCombineEraserTime&&_this120.localWork.setmaxCombineEraserTime(r.maxCombineEraserTime),r.syncUnitTime&&_this120.localWork.setSyncUnitTime(r.syncUnitTime),_this120.serviceWork=new HM(_objectSpread(_objectSpread({},s),{},{drawLayer:_this120.serviceDrawLayer})),_this120.snapshotWork=new nd(_objectSpread(_objectSpread({},s),{},{createScene:_this120.createScene.bind(_this120),createLayer:_this120.createLayer.bind(_this120)})),_this120.methodBuilder=new Xu([he.CopyNode,he.SetColorNode,he.DeleteNode,he.RotateNode,he.ScaleNode,he.TranslateNode,he.ZIndexNode,he.SetFontStyle,he.SetPoint,he.SetLock,he.SetShapeOpt]).registerForWorker(_this120);return _this120;}_inherits(KM,_sd);return _createClass(KM,[{key:"createRenderLayer",value:function createRenderLayer(t,r,n){var l;var s=vr.bufferSize.full,c=vr.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",t,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:this.viewId===ki?s:c*2}),n||((l=r.offscreenCanvas)==null?void 0:l.bgCanvas));}},{key:"createScene",value:function createScene(t,r){var n=t.offscreenCanvas,s=t.offscreenCanvasOpt,c=s.width,l=s.height,f=r||(n==null?void 0:n.bgCanvas)||new OffscreenCanvas(c,l);s.contextType&&delete s.contextType;var h=new Uu(_objectSpread(_objectSpread({container:f,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},s),{},{contextType:this.contextType,id:this.viewId}));return h.setAttribute("id",this.viewId),h;}},{key:"combinePostData",value:function combinePostData(){var c,l;this.workerTaskId=void 0;var t=[],r=[];var n;var s=/* @__PURE__ */new Set();var _iterator88=_createForOfIteratorHelper(this.combinePostMsg.values()),_step88;try{for(_iterator88.s();!(_step88=_iterator88.n()).done;){var f=_step88.value;if((c=f.render)!=null&&c.length)if(this.offscreenCanvas){var _iterator89=_createForOfIteratorHelper(f.render),_step89;try{for(_iterator89.s();!(_step89=_iterator89.n()).done;){var h=_step89.value;h.workId&&s.add(h.workId);var m=h.drawCanvas||h.clearCanvas;if(m){var u=this.getLayer(m);if(!u||!(u.parent instanceof el))continue;u.parent.render();}}}catch(err){_iterator89.e(err);}finally{_iterator89.f();}}else{var _iterator90=_createForOfIteratorHelper(f.render),_step90;try{for(_iterator90.s();!(_step90=_iterator90.n()).done;){var _h9=_step90.value;var _m16=!1;if(_h9.workId&&s.add(_h9.workId),_h9.isClearAll&&(_h9.rect=this.getSceneRect(),_h9.isClear=!0,delete _h9.isClearAll),_h9.drawCanvas){var _u9=this.getLayer(_h9.drawCanvas);if(!_u9||!(_u9.parent instanceof el))continue;if(_u9.parent.render(),_h9.isDrawAll){var y=this.getSceneRect();_h9.rect=y,delete _h9.isDrawAll;}}var _iterator91=_createForOfIteratorHelper(t),_step91;try{for(_iterator91.s();!(_step91=_iterator91.n()).done;){var _u10=_step91.value;if(_h9.viewId===_u10.viewId){_h9.isClear&&_u10.clearCanvas&&_u10.isClear&&_u10.clearCanvas===_h9.clearCanvas&&(_u10.rect=Zt(_u10.rect,_h9.rect),_m16=!0),_u10.drawCanvas&&_u10.drawCanvas===_h9.drawCanvas&&(_u10.rect=Zt(_u10.rect,_h9.rect),_m16=!0);continue;}}}catch(err){_iterator91.e(err);}finally{_iterator91.f();}_m16||(_h9.isClear&&!_h9.drawCanvas?t.unshift(_h9):t.push(_h9));}}catch(err){_iterator90.e(err);}finally{_iterator90.f();}}if((l=f.sp)!=null&&l.length){var _iterator92=_createForOfIteratorHelper(f.sp),_step92;try{for(_iterator92.s();!(_step92=_iterator92.n()).done;){var _h10=_step92.value;var _m17=!1;var _iterator93=_createForOfIteratorHelper(r),_step93;try{for(_iterator93.s();!(_step93=_iterator93.n()).done;){var _u11=_step93.value;if(qr(_h10,_u11)){_m17=!0;break;}}}catch(err){_iterator93.e(err);}finally{_iterator93.f();}_m17||r.push(_h10);}}catch(err){_iterator92.e(err);}finally{_iterator92.f();}}er(f.consumeCount)&&(n=f.consumeCount);}}catch(err){_iterator88.e(err);}finally{_iterator88.f();}return this.combinePostMsg.clear(),{render:t,sp:r,consumeCount:n,workIds:s,viewId:this.viewId};}},{key:"on",value:function(){var _on4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee104(t){var r;return _regeneratorRuntime().wrap(function _callee104$(_context111){while(1)switch(_context111.prev=_context111.next){case 0:if(!this.methodBuilder.consumeForWorker(t)){_context111.next=2;break;}return _context111.abrupt("return");case 2:r=t.msgType;_context111.t0=r;_context111.next=_context111.t0===xt.Snapshot?6:_context111.t0===xt.BoundingBox?11:16;break;case 6:this.snapshotWork.createSnapshotFullLayer(this.opt,this.opt.layerOpt);_context111.next=9;return this.snapshotWork.getSnapshot(t);case 9:this.snapshotWork.destroySnapshotFullLayer();return _context111.abrupt("return");case 11:this.snapshotWork.createSnapshotFullLayer(this.opt,this.opt.layerOpt);_context111.next=14;return this.snapshotWork.getBoundingRect(t);case 14:this.snapshotWork.destroySnapshotFullLayer();return _context111.abrupt("return");case 16:_context111.next=18;return _superPropGet(KM,"on",this,3)([t]);case 18:case"end":return _context111.stop();}},_callee104,this);}));function on(_x154){return _on4.apply(this,arguments);}return on;}()},{key:"setCameraOpt",value:function setCameraOpt(t){if(this.localDrawScene&&this.serviceDrawScene){var r=t.width,n=t.height;(r!==this.localDrawScene.width||n!==this.localDrawScene.height)&&this.updateScene(this.localDrawScene,{width:r,height:n},this.localDrawLayer),(r!==this.serviceDrawScene.width||n!==this.serviceDrawScene.height)&&this.updateScene(this.serviceDrawScene,{width:r,height:n},this.serviceDrawLayer);}_superPropGet(KM,"setCameraOpt",this,3)([t]);}},{key:"updateDpr",value:function(){var _updateDpr4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee105(t){return _regeneratorRuntime().wrap(function _callee105$(_context112){while(1)switch(_context112.prev=_context112.next){case 0:this.localDrawScene&&this.serviceDrawScene&&(this.localDrawScene.displayRatio=t,this.serviceDrawScene.displayRatio=t),_superPropGet(KM,"updateDpr",this,3)([t]);case 1:case"end":return _context112.stop();}},_callee105,this);}));function updateDpr(_x155){return _updateDpr4.apply(this,arguments);}return updateDpr;}()}]);}(sd);var Fu=self;Fu.full=new kM(Fu,uo.Full);
|
|
516
|
+
},{key:"isFontAvailable",value:function(){var _isFontAvailable=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e){var t,r,n,_iterator72,_step72,_s3,s;return _regeneratorRuntime().wrap(function _callee82$(_context87){while(1)switch(_context87.prev=_context87.next){case 0:_context87.prev=0;t=this._self.fonts;if(t){_context87.next=4;break;}return _context87.abrupt("return",!1);case 4:r=!1,n=null;_iterator72=_createForOfIteratorHelper(t);_context87.prev=6;_iterator72.s();case 8:if((_step72=_iterator72.n()).done){_context87.next=15;break;}_s3=_step72.value;if(!(_s3.family===e)){_context87.next=13;break;}r=!0,n=_s3;return _context87.abrupt("break",15);case 13:_context87.next=8;break;case 15:_context87.next=20;break;case 17:_context87.prev=17;_context87.t0=_context87["catch"](6);_iterator72.e(_context87.t0);case 20:_context87.prev=20;_iterator72.f();return _context87.finish(20);case 23:if(!(!r||!n)){_context87.next=25;break;}return _context87.abrupt("return",!1);case 25:if(!(n.status==="loaded")){_context87.next=27;break;}return _context87.abrupt("return",!0);case 27:_context87.prev=27;_context87.next=30;return n.loaded;case 30:return _context87.abrupt("return",!0);case 33:_context87.prev=33;_context87.t1=_context87["catch"](27);if(!(t&&typeof t.load=="function")){_context87.next=48;break;}_context87.prev=36;_context87.next=39;return t.load(e);case 39:s=_context87.sent;return _context87.abrupt("return",s&&s.length>0);case 43:_context87.prev=43;_context87.t2=_context87["catch"](36);return _context87.abrupt("return",!1);case 46:_context87.next=49;break;case 48:return _context87.abrupt("return",!0);case 49:_context87.next=54;break;case 51:_context87.prev=51;_context87.t3=_context87["catch"](0);return _context87.abrupt("return",!1);case 54:case"end":return _context87.stop();}},_callee82,this,[[0,51],[6,17,20,23],[27,33],[36,43]]);}));function isFontAvailable(_x126){return _isFontAvailable.apply(this,arguments);}return isFontAvailable;}()},{key:"register",value:function register(){var _this111=this;onmessage=/*#__PURE__*/function(){var _ref171=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e){var t,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,r,n,s,c,l,f,_iterator73,_step73,_step73$value,m,u,y,_iterator74,_step74,_m15,h;return _regeneratorRuntime().wrap(function _callee83$(_context88){while(1)switch(_context88.prev=_context88.next){case 0:t=e.data;if(!t){_context88.next=54;break;}_iteratorAbruptCompletion=false;_didIteratorError=false;_context88.prev=4;_iterator=_asyncIterator(t.values());case 6:_context88.next=8;return _iterator.next();case 8:if(!(_iteratorAbruptCompletion=!(_step=_context88.sent).done)){_context88.next=38;break;}r=_step.value;n=r.msgType,s=r.viewId,c=r.tasksqueue,l=r.mainTasksqueueCount,f=r.fontBuffers;if(!f){_context88.next=14;break;}_this111.setFontFaces(f);return _context88.abrupt("continue",35);case 14:if(!(n===xt.Console)){_context88.next=17;break;}console.log(_this111);return _context88.abrupt("continue",35);case 17:if(!(n===xt.Init)){_context88.next=20;break;}_this111.init(r);return _context88.abrupt("continue",35);case 20:if(!(n===xt.TasksQueue&&c!=null&&c.size)){_context88.next=25;break;}_iterator73=_createForOfIteratorHelper(_this111.workThreadMap.entries());try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){_step73$value=_slicedToArray(_step73.value,2),m=_step73$value[0],u=_step73$value[1];y=c.get(m);y&&u.on(y);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}_this111.type==="full"&&er(l)&&_this111.post({workerTasksqueueCount:l});return _context88.abrupt("continue",35);case 25:if(!(s===e1)){_context88.next=29;break;}_iterator74=_createForOfIteratorHelper(_this111.workThreadMap.values());try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){_m15=_step74.value;_m15.on(r),n===xt.Destroy&&_this111.workThreadMap["delete"](s);}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}return _context88.abrupt("continue",35);case 29:h=_this111.workThreadMap.get(s);_context88.t0=h;if(!_context88.t0){_context88.next=35;break;}_context88.next=34;return h.on(r);case 34:n===xt.Destroy&&_this111.workThreadMap["delete"](s);case 35:_iteratorAbruptCompletion=false;_context88.next=6;break;case 38:_context88.next=44;break;case 40:_context88.prev=40;_context88.t1=_context88["catch"](4);_didIteratorError=true;_iteratorError=_context88.t1;case 44:_context88.prev=44;_context88.prev=45;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context88.next=49;break;}_context88.next=49;return _iterator["return"]();case 49:_context88.prev=49;if(!_didIteratorError){_context88.next=52;break;}throw _iteratorError;case 52:return _context88.finish(49);case 53:return _context88.finish(44);case 54:case"end":return _context88.stop();}},_callee83,null,[[4,40,44,54],[45,,49,53]]);}));return function onmessage(_x127){return _ref171.apply(this,arguments);};}();}}]);}();var id=/*#__PURE__*/function(_Jh){function id(t,r,n){var _this112;_classCallCheck(this,id);_this112=_callSuper(this,id,[t,r,"sub"/* Sub */]);dt(_this112,"type","sub");dt(_this112,"_post");dt(_this112,"topLayer");dt(_this112,"serviceWork");dt(_this112,"localWork");dt(_this112,"topLayerWork");dt(_this112,"snapshotWork");_this112._post=n;var s=vr.bufferSize.sub;_this112.topLayer=r.isUseSimple?void 0:_this112.createLayer("topLayer",_this112.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:s,contextType:"2d"}));var c={thread:_this112,viewId:_this112.viewId,vNodes:_this112.vNodes,fullLayer:_this112.fullLayer,topLayer:_this112.topLayer,isUseSimple:r.isUseSimple};_this112.localWork=new $M(c),r.isUseSimple||(_this112.topLayerWork=new jM(c)),_this112.snapshotWork=new nd(_objectSpread(_objectSpread({},c),{},{createScene:_this112.createScene.bind(_this112),createLayer:_this112.createLayer.bind(_this112)})),_this112.vNodes.init(_this112.fullLayer);return _this112;}_inherits(id,_Jh);return _createClass(id,[{key:"combinePost",value:function(){var _combinePost=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee84(){var _this113=this;var c,l,_this$combinePostData,t,r,n,f,_iterator75,_step75,h,m,s;return _regeneratorRuntime().wrap(function _callee84$(_context89){while(1)switch(_context89.prev=_context89.next){case 0:_this$combinePostData=this.combinePostData(),t=_this$combinePostData.render,r=_objectWithoutProperties(_this$combinePostData,_excluded3);if(!(t!=null&&t.length)){_context89.next=28;break;}f=[];_iterator75=_createForOfIteratorHelper(t);_context89.prev=4;_iterator75.s();case 6:if((_step75=_iterator75.n()).done){_context89.next=19;break;}h=_step75.value;if(!h.rect){_context89.next=17;break;}if(!(h.rect=Zh(fr(h.rect),this.scene,this.dpr),!h.rect)){_context89.next=11;break;}return _context89.abrupt("continue",17);case 11:if(!(h.drawCanvas&&h.rect&&h.rect.w>0&&h.rect.h>0)){_context89.next=16;break;}_context89.next=14;return this.getRectImageBitmap(h);case 14:m=_context89.sent;h.imageBitmap=m,n||(n=[]),n.push(m);case 16:f.push(h);case 17:_context89.next=6;break;case 19:_context89.next=24;break;case 21:_context89.prev=21;_context89.t0=_context89["catch"](4);_iterator75.e(_context89.t0);case 24:_context89.prev=24;_iterator75.f();return _context89.finish(24);case 27:r.render=f;case 28:s=(c=r.sp)==null?void 0:c.filter(function(f){return f.type!==xt.None||f.isLockSentEventCursor;});s!=null&&s.length?r.sp=s.map(function(f){return _objectSpread(_objectSpread({},f),{},{viewId:_this113.viewId});}):delete r.sp,r.consumeCount===void 0&&delete r.consumeCount,r.subWorkerDrawCount===void 0&&delete r.subWorkerDrawCount,(s!=null&&s.length||r.consumeCount||r.subWorkerDrawCount||(l=r==null?void 0:r.render)!=null&&l.length)&&this._post(r,n),this.delayPostDoneResolve&&this.delayPostDoneResolve(!0);case 30:case"end":return _context89.stop();}},_callee84,this,[[4,21,24,27]]);}));function combinePost(){return _combinePost.apply(this,arguments);}return combinePost;}()},{key:"on",value:function(){var _on2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee85(t){var h,m,r,n,s,c,l,f,u;return _regeneratorRuntime().wrap(function _callee85$(_context90){while(1)switch(_context90.prev=_context90.next){case 0:r=t.msgType,n=t.toolsType,s=t.opt,c=t.dataType,l=t.workState,f=t.isLockSentEventCursor;_context90.t0=r;_context90.next=_context90.t0===xt.UpdateTools?4:_context90.t0===xt.CreateWork?9:_context90.t0===xt.DrawWork?11:_context90.t0===xt.RemoveNode?19:_context90.t0===xt.FullWork?22:_context90.t0===xt.Snapshot?27:_context90.t0===xt.BoundingBox?32:37;break;case 4:if(!(n&&(h=this.topLayerWork)!=null&&h.canUseTopLayer(n)&&s)){_context90.next=8;break;}u={toolsType:n,toolsOpt:s};this.topLayerWork.setToolsOpt(u);return _context90.abrupt("return");case 8:return _context90.abrupt("break",37);case 9:this.createLocalWork(t);return _context90.abrupt("return");case 11:if(!(l===te.Done&&c===Vt.Local)){_context90.next=17;break;}_context90.next=14;return this.consumeDrawAll(c,t);case 14:n===Tt.LaserPen&&f&&this.post({sp:[{type:xt.None,isLockSentEventCursor:f}]});_context90.next=18;break;case 17:this.consumeDraw(c,t);case 18:return _context90.abrupt("return");case 19:_context90.next=21;return this.removeNode(t);case 21:return _context90.abrupt("return");case 22:_context90.t1=n&&(m=this.topLayerWork)!=null&&m.canUseTopLayer(n);if(!_context90.t1){_context90.next=26;break;}_context90.next=26;return this.consumeDrawAll(c,t);case 26:return _context90.abrupt("return");case 27:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===$n?6e3:3e3,contextType:"2d"}));_context90.next=30;return this.snapshotWork.getSnapshot(t);case 30:this.snapshotWork.destroySnapshotFullLayer();return _context90.abrupt("return");case 32:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===$n?6e3:3e3,contextType:"2d"}));_context90.next=35;return this.snapshotWork.getBoundingRect(t);case 35:this.snapshotWork.destroySnapshotFullLayer();return _context90.abrupt("return");case 37:_context90.next=39;return _superPropGet(id,"on",this,3)([t]);case 39:case"end":return _context90.stop();}},_callee85,this);}));function on(_x128){return _on2.apply(this,arguments);}return on;}()},{key:"createLocalWork",value:function createLocalWork(t){var c;var r=t.workId,n=t.toolsType,s=t.opt;if(n&&(c=this.topLayerWork)!=null&&c.canUseTopLayer(n)&&r&&s){this.topLayerWork.getToolsOpt()||this.topLayerWork.setToolsOpt({toolsType:n,toolsOpt:s}),this.topLayerWork.setWorkOptions(r.toString(),s);return;}n&&_superPropGet(id,"createLocalWork",this,3)([t]);}},{key:"removeNode",value:function(){var _removeNode2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee86(t){var r;return _regeneratorRuntime().wrap(function _callee86$(_context91){while(1)switch(_context91.prev=_context91.next){case 0:r=t.dataType;_context91.t0=r===Vt.Local;if(!_context91.t0){_context91.next=5;break;}_context91.next=5;return this.localWork.removeWork(t);case 5:case"end":return _context91.stop();}},_callee86,this);}));function removeNode(_x129){return _removeNode2.apply(this,arguments);}return removeNode;}()},{key:"getLayer",value:function getLayer(t){switch(t){case Ut.TopFloat:return this.topLayer||this.fullLayer;default:return this.fullLayer;}}},{key:"getOffscreen",value:function getOffscreen(t){var n;return((n=this.getLayer(t))==null?void 0:n.parent).canvas;}},{key:"consumeDraw",value:function(){var _consumeDraw5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee87(t,r){var c,n,s;return _regeneratorRuntime().wrap(function _callee87$(_context92){while(1)switch(_context92.prev=_context92.next){case 0:n=r.workId,s=r.toolsType;if(!n){_context92.next=11;break;}if(!(s&&(c=this.topLayerWork)!=null&&c.canUseTopLayer(s))){_context92.next=5;break;}t===Vt.Local&&(this.topLayerWork.getWorkShape(n.toString())||this.createLocalWork(r)),this.topLayerWork.consumeDraw(r);return _context92.abrupt("return");case 5:_context92.t0=s;if(!_context92.t0){_context92.next=10;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(r);_context92.next=10;return this.localWork.consumeDraw(r);case 10:return _context92.abrupt("return");case 11:case"end":return _context92.stop();}},_callee87,this);}));function consumeDraw(_x130,_x131){return _consumeDraw5.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee88(t,r){var l,n,s,c,f;return _regeneratorRuntime().wrap(function _callee88$(_context93){while(1)switch(_context93.prev=_context93.next){case 0:n=r.workId,s=r.toolsType,c=r.dataType;if(!n){_context93.next=8;break;}f=n.toString();if(!(s&&(l=this.topLayerWork)!=null&&l.canUseTopLayer(s))){_context93.next=6;break;}c===Vt.Local&&(this.topLayerWork.getWorkShape(f)||this.createLocalWork(r)),this.topLayerWork.consumeDrawAll(r);return _context93.abrupt("return");case 6:s&&(this.localWork.getWorkShape(f)||_superPropGet(id,"createLocalWork",this,3)([r]),this.localWork.consumeDrawAll(r));return _context93.abrupt("return");case 8:case"end":return _context93.stop();}},_callee88,this);}));function consumeDrawAll(_x132,_x133){return _consumeDrawAll4.apply(this,arguments);}return consumeDrawAll;}()},{key:"clearAll",value:function(){var _clearAll2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee89(){return _regeneratorRuntime().wrap(function _callee89$(_context94){while(1)switch(_context94.prev=_context94.next){case 0:this.vNodes.clear();_superPropGet(id,"clearAll",this,3)([]);this.topLayer&&(this.topLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),Lr(this.topLayer,this.topLayer.parent));_context94.next=5;return this.post({render:[{isClearAll:!0,clearCanvas:Ut.TopFloat,viewId:this.viewId}],sp:[{type:xt.Clear}]});case 5:case"end":return _context94.stop();}},_callee89,this);}));function clearAll(){return _clearAll2.apply(this,arguments);}return clearAll;}()},{key:"getRectImageBitmap",value:function getRectImageBitmap(t,r){var n=t.rect,s=t.drawCanvas,c=Math.floor(n.x*this.dpr),l=Math.floor(n.y*this.dpr),f=Math.floor(n.w*this.dpr||1),h=Math.floor(n.h*this.dpr||1);return createImageBitmap(this.getOffscreen(s),c,l,f,h,r);}},{key:"updateLayer",value:function updateLayer(t){var r=t.width,n=t.height;_superPropGet(id,"updateLayer",this,3)([t]),this.topLayer&&(this.topLayer.parent.setAttribute("width",r),this.topLayer.parent.setAttribute("height",n),this.topLayer.setAttribute("size",[r,n]),this.topLayer.setAttribute("pos",[r*0.5,n*0.5]));}},{key:"updateDpr",value:function(){var _updateDpr2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee90(t){var r,n,s;return _regeneratorRuntime().wrap(function _callee90$(_context95){while(1)switch(_context95.prev=_context95.next){case 0:_superPropGet(id,"updateDpr",this,3)([t]);r=this.topLayerWork&&!!this.topLayerWork.localWorkShapes.size||!1,n=!!this.localWork.getWorkShapes().size,s=[];n&&s.push({isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId});r&&s.push({isClearAll:!0,clearCanvas:Ut.TopFloat,viewId:this.viewId});_context95.t0=s.length;if(!_context95.t0){_context95.next=8;break;}_context95.next=8;return this.post({render:s});case 8:case"end":return _context95.stop();}},_callee90,this);}));function updateDpr(_x134){return _updateDpr2.apply(this,arguments);}return updateDpr;}()},{key:"updateCamera",value:function(){var _updateCamera=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee91(t){var _this114=this;var s,r,n,c,l,_iterator76,_step76,_loop9;return _regeneratorRuntime().wrap(function _callee91$(_context97){while(1)switch(_context97.prev=_context97.next){case 0:r=[],n=t.cameraOpt;if(!(n&&!qr(this.cameraOpt,n))){_context97.next=25;break;}c=this.topLayerWork&&!!this.topLayerWork.localWorkShapes.size||!1,l=!!this.localWork.getWorkShapes().size;if(!(l&&this.localWork.workShapesDone(),this.setCameraOpt(n),l&&r.push({isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}),c&&this.topLayerWork)){_context97.next=21;break;}r.push({isClearAll:!0,clearCanvas:Ut.TopFloat,viewId:this.viewId});_iterator76=_createForOfIteratorHelper(this.topLayerWork.localWorkShapes.entries()||[]);_context97.prev=6;_loop9=/*#__PURE__*/_regeneratorRuntime().mark(function _loop9(){var _step76$value,f,h,m;return _regeneratorRuntime().wrap(function _loop9$(_context96){while(1)switch(_context96.prev=_context96.next){case 0:_step76$value=_slicedToArray(_step76.value,2),f=_step76$value[0],h=_step76$value[1];if(h.totalRect){(s=_this114.topLayer)==null||s.getElementsByName(f.toString()).forEach(function(u){var y=u.getBoundingClientRect(),T=ve({x:y.x,y:y.y,w:y.width,h:y.height});m=Zt(m,T);}),h.totalRect=m,_this114.topLayerWork.localWorkShapes.set(f,h);}case 2:case"end":return _context96.stop();}},_loop9);});_iterator76.s();case 9:if((_step76=_iterator76.n()).done){_context97.next=13;break;}return _context97.delegateYield(_loop9(),"t0",11);case 11:_context97.next=9;break;case 13:_context97.next=18;break;case 15:_context97.prev=15;_context97.t1=_context97["catch"](6);_iterator76.e(_context97.t1);case 18:_context97.prev=18;_iterator76.f();return _context97.finish(18);case 21:_context97.t2=r.length;if(!_context97.t2){_context97.next=25;break;}_context97.next=25;return this.post({render:r});case 25:case"end":return _context97.stop();}},_callee91,this,[[6,15,18,21]]);}));function updateCamera(_x135){return _updateCamera.apply(this,arguments);}return updateCamera;}()},{key:"setCameraOpt",value:function setCameraOpt(t,r){var h,m;this.cameraOpt=t;var n=t.scale,s=t.centerX,c=t.centerY,l=t.width,f=t.height;(l!==this.scene.width||f!==this.scene.height)&&this.updateScene(this.scene,{width:l,height:f}),r?(r.setAttribute("scale",[n,n]),r.setAttribute("translate",[-s,-c])):(this.fullLayer.setAttribute("scale",[n,n]),this.fullLayer.setAttribute("translate",[-s,-c]),(h=this.topLayer)==null||h.setAttribute("scale",[n,n]),(m=this.topLayer)==null||m.setAttribute("translate",[-s,-c]));}}]);}(Jh);var sd=/*#__PURE__*/function(_Jh2){function sd(t,r,n){var _this115;_classCallCheck(this,sd);_this115=_callSuper(this,sd,[t,r,"full"/* Full */]);dt(_this115,"serviceDrawLayer");dt(_this115,"localDrawLayer");dt(_this115,"snapshotFullLayer");dt(_this115,"methodBuilder");dt(_this115,"localWork");dt(_this115,"serviceWork");dt(_this115,"_post");dt(_this115,"debounceUpdateCache",/* @__PURE__ */new Set());_this115._post=n;var s=vr.bufferSize.sub;_this115.serviceDrawLayer=_this115.createLayer("serviceDrawLayer",_this115.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:s,contextType:"2d"})),_this115.localDrawLayer=_this115.createLayer("localDrawLayer",_this115.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:s,contextType:"2d"}));var c={thread:_this115,viewId:_this115.viewId,vNodes:_this115.vNodes,fullLayer:_this115.fullLayer};_this115.localWork=new ed(_objectSpread(_objectSpread({},c),{},{drawLayer:_this115.localDrawLayer})),r.combineUnitTime&&_this115.localWork.setCombineUnitTime(r.combineUnitTime),r.maxCombineEraserTime&&_this115.localWork.setmaxCombineEraserTime(r.maxCombineEraserTime),r.syncUnitTime&&_this115.localWork.setSyncUnitTime(r.syncUnitTime),_this115.serviceWork=new rd(_objectSpread(_objectSpread({},c),{},{drawLayer:_this115.serviceDrawLayer})),_this115.methodBuilder=new Xu([he.CopyNode,he.SetColorNode,he.DeleteNode,he.RotateNode,he.ScaleNode,he.TranslateNode,he.ZIndexNode,he.SetFontStyle,he.SetPoint,he.SetLock,he.SetShapeOpt]).registerForWorker(_this115),_this115.vNodes.init(_this115.fullLayer);return _this115;}_inherits(sd,_Jh2);return _createClass(sd,[{key:"combinePost",value:function(){var _combinePost2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee92(){var _this116=this;var c,l,_this$combinePostData2,t,r,n,f,_iterator77,_step77,h,m,s;return _regeneratorRuntime().wrap(function _callee92$(_context98){while(1)switch(_context98.prev=_context98.next){case 0:_this$combinePostData2=this.combinePostData(),t=_this$combinePostData2.render,r=_objectWithoutProperties(_this$combinePostData2,_excluded4);if(!(t!=null&&t.length)){_context98.next=28;break;}f=[];_iterator77=_createForOfIteratorHelper(t);_context98.prev=4;_iterator77.s();case 6:if((_step77=_iterator77.n()).done){_context98.next=19;break;}h=_step77.value;if(!h.rect){_context98.next=17;break;}if(!(h.rect=Zh(fr(h.rect),this.scene,this.dpr),!h.rect)){_context98.next=11;break;}return _context98.abrupt("continue",17);case 11:if(!(h.drawCanvas&&h.rect&&h.rect.w>0&&h.rect.h>0)){_context98.next=16;break;}_context98.next=14;return this.getRectImageBitmap(h);case 14:m=_context98.sent;h.imageBitmap=m,n||(n=[]),n.push(m);case 16:f.push(h);case 17:_context98.next=6;break;case 19:_context98.next=24;break;case 21:_context98.prev=21;_context98.t0=_context98["catch"](4);_iterator77.e(_context98.t0);case 24:_context98.prev=24;_iterator77.f();return _context98.finish(24);case 27:r.render=f;case 28:s=(c=r.sp)==null?void 0:c.filter(function(f){return f.type!==xt.None||f.isLockSentEventCursor;});s!=null&&s.length?r.sp=s.map(function(f){return _objectSpread(_objectSpread({},f),{},{viewId:_this116.viewId});}):delete r.sp,r.fullWorkerDrawCount===void 0&&delete r.fullWorkerDrawCount,r.consumeCount===void 0&&delete r.consumeCount,(r!=null&&r.fullWorkerDrawCount||r.consumeCount||s!=null&&s.length||(l=r.render)!=null&&l.length)&&this._post(r,n),this.delayPostDoneResolve&&this.delayPostDoneResolve(!0);case 30:case"end":return _context98.stop();}},_callee92,this,[[4,21,24,27]]);}));function combinePost(){return _combinePost2.apply(this,arguments);}return combinePost;}()},{key:"on",value:function(){var _on3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee93(t){var _this117=this;var r,n,s,c,l,f,h,m,_h8;return _regeneratorRuntime().wrap(function _callee93$(_context99){while(1)switch(_context99.prev=_context99.next){case 0:if(!this.methodBuilder.consumeForWorker(t)){_context99.next=2;break;}return _context99.abrupt("return");case 2:r=t.msgType,n=t.dataType,s=t.workId,c=t.toolsType,l=t.workState,f=t.workIds;_context99.t0=r;_context99.next=_context99.t0===xt.AuthClear?6:_context99.t0===xt.CreateWork?9:_context99.t0===xt.DrawWork?11:_context99.t0===xt.Select?20:_context99.t0===xt.UpdateNode?27:_context99.t0===xt.FullWork?27:_context99.t0===xt.RemoveNode?29:_context99.t0===xt.GetTextActive?32:_context99.t0===xt.CursorHover?35:_context99.t0===xt.CursorBlur?38:_context99.t0===xt.GetVNodeInfo?41:43;break;case 6:h=t.clearUids,m=t.localUid;this.vNodes.setCanClearUids(h),this.vNodes.setLocalUid(m);return _context99.abrupt("break",43);case 9:c!==Tt.LaserPen&&this.createLocalWork(t);return _context99.abrupt("break",43);case 11:_context99.t1=c!==Tt.LaserPen;if(!_context99.t1){_context99.next=19;break;}if(!(l===te.Done&&n===Vt.Local)){_context99.next=18;break;}_context99.next=16;return this.consumeDrawAll(n,t);case 16:_context99.next=19;break;case 18:this.consumeDraw(n,t);case 19:return _context99.abrupt("break",43);case 20:if(!(s===Me)){_context99.next=25;break;}_context99.next=23;return this.localWork.updateFullSelectWork(t);case 23:_context99.next=26;break;case 25:this.serviceWork.runSelectWork(t);case 26:return _context99.abrupt("return");case 27:this.consumeFull(n,t);return _context99.abrupt("return");case 29:_context99.next=31;return this.removeNode(t);case 31:return _context99.abrupt("return");case 32:_context99.next=34;return this.checkTextActive(t);case 34:return _context99.abrupt("return");case 35:_context99.next=37;return this.cursorHover(t);case 37:return _context99.abrupt("return");case 38:_context99.next=40;return this.cursorBlur();case 40:return _context99.abrupt("return");case 41:if(s&&f){_h8=f.map(function(m){return _this117.vNodes.get(m);});this.post({sp:[{type:xt.GetVNodeInfo,dataType:Vt.Worker,workId:s,vInfo:_h8}]});}return _context99.abrupt("break",43);case 43:_context99.next=45;return _superPropGet(sd,"on",this,3)([t]);case 45:case"end":return _context99.stop();}},_callee93,this);}));function on(_x136){return _on3.apply(this,arguments);}return on;}()},{key:"removeNode",value:function(){var _removeNode3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee94(t){var _this118=this;var r,n,s,c,l,_iterator78,_step78,_loop10;return _regeneratorRuntime().wrap(function _callee94$(_context101){while(1)switch(_context101.prev=_context101.next){case 0:r=t.dataType,n=t.workId,s=t.removeIds,c=[],l=s||[];if(!(n&&l.push(n.toString()),l.length)){_context101.next=20;break;}_iterator78=_createForOfIteratorHelper(l);_context101.prev=3;_loop10=/*#__PURE__*/_regeneratorRuntime().mark(function _loop10(){var f;return _regeneratorRuntime().wrap(function _loop10$(_context100){while(1)switch(_context100.prev=_context100.next){case 0:f=_step78.value;f===Me?c.push(_this118.localWork.removeSelector(t,_this118)):r===Vt.Local?c.push(_this118.localWork.removeWork(t).then(function(){_this118.localWork.colloctEffectSelectWork(t),_this118.deleteCachedImagesByWorkId(f);})):r===Vt.Service&&c.push(_this118.serviceWork.removeWork(t).then(function(){_this118.localWork.colloctEffectSelectWork(t),_this118.deleteCachedImagesByWorkId(f);}));case 2:case"end":return _context100.stop();}},_loop10);});_iterator78.s();case 6:if((_step78=_iterator78.n()).done){_context101.next=10;break;}return _context101.delegateYield(_loop10(),"t0",8);case 8:_context101.next=6;break;case 10:_context101.next=15;break;case 12:_context101.prev=12;_context101.t1=_context101["catch"](3);_iterator78.e(_context101.t1);case 15:_context101.prev=15;_iterator78.f();return _context101.finish(15);case 18:_context101.next=20;return Promise.all(c);case 20:case"end":return _context101.stop();}},_callee94,null,[[3,12,15,18]]);}));function removeNode(_x137){return _removeNode3.apply(this,arguments);}return removeNode;}()},{key:"checkTextActive",value:function(){var _checkTextActive2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee95(t){var r;return _regeneratorRuntime().wrap(function _callee95$(_context102){while(1)switch(_context102.prev=_context102.next){case 0:r=t.dataType;_context102.t0=r===Vt.Local;if(!_context102.t0){_context102.next=5;break;}_context102.next=5;return this.localWork.checkTextActive(t);case 5:case"end":return _context102.stop();}},_callee95,this);}));function checkTextActive(_x138){return _checkTextActive2.apply(this,arguments);}return checkTextActive;}()},{key:"clearAll",value:function(){var _clearAll3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee96(){return _regeneratorRuntime().wrap(function _callee96$(_context103){while(1)switch(_context103.prev=_context103.next){case 0:this.vNodes.clear();_superPropGet(sd,"clearAll",this,3)([]);this.localDrawLayer&&(this.localDrawLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),Lr(this.localDrawLayer,this.localDrawLayer.parent));this.serviceDrawLayer&&(this.serviceDrawLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),Lr(this.serviceDrawLayer,this.serviceDrawLayer.parent));_context103.next=6;return this.post({render:[{isClearAll:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{isClearAll:!0,clearCanvas:Ut.ServiceFloat,viewId:this.viewId},{isClearAll:!0,clearCanvas:Ut.Float,viewId:this.viewId}],sp:[{type:xt.Clear}]});case 6:case"end":return _context103.stop();}},_callee96,this);}));function clearAll(){return _clearAll3.apply(this,arguments);}return clearAll;}()},{key:"updateLayer",value:function updateLayer(t){var r=t.width,n=t.height;_superPropGet(sd,"updateLayer",this,3)([t]),this.localDrawLayer&&(this.localDrawLayer.parent.setAttribute("width",r),this.localDrawLayer.parent.setAttribute("height",n),this.localDrawLayer.setAttribute("size",[r,n]),this.localDrawLayer.setAttribute("pos",[r*0.5,n*0.5])),this.serviceDrawLayer&&(this.serviceDrawLayer.parent.setAttribute("width",r),this.serviceDrawLayer.parent.setAttribute("height",n),this.serviceDrawLayer.setAttribute("size",[r,n]),this.serviceDrawLayer.setAttribute("pos",[r*0.5,n*0.5]));}},{key:"setCameraOpt",value:function setCameraOpt(t){this.cameraOpt=t;var r=t.scale,n=t.centerX,s=t.centerY,c=t.width,l=t.height;(c!==this.scene.width||l!==this.scene.height)&&this.updateScene(this.scene,{width:c,height:l}),this.fullLayer&&(this.fullLayer.setAttribute("scale",[r,r]),this.fullLayer.setAttribute("translate",[-n,-s])),this.localDrawLayer&&(this.localDrawLayer.setAttribute("scale",[r,r]),this.localDrawLayer.setAttribute("translate",[-n,-s])),this.serviceDrawLayer&&(this.serviceDrawLayer.setAttribute("scale",[r,r]),this.serviceDrawLayer.setAttribute("translate",[-n,-s]));}},{key:"getLayer",value:function getLayer(t){switch(t){case Ut.Bg:return this.fullLayer;case Ut.ServiceFloat:return this.serviceDrawLayer;case Ut.Float:return this.localDrawLayer;}}},{key:"getOffscreen",value:function getOffscreen(t){return this.getLayer(t).parent.canvas;}},{key:"consumeFull",value:function(){var _consumeFull2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee97(t,r){var n;return _regeneratorRuntime().wrap(function _callee97$(_context104){while(1)switch(_context104.prev=_context104.next){case 0:_context104.next=2;return this.localWork.colloctEffectSelectWork(r);case 2:n=_context104.sent;_context104.t0=n&&t===Vt.Local;if(!_context104.t0){_context104.next=7;break;}_context104.next=7;return this.localWork.consumeFull(n);case 7:n&&t===Vt.Service&&this.serviceWork.consumeFull(n);case 8:case"end":return _context104.stop();}},_callee97,this);}));function consumeFull(_x139,_x140){return _consumeFull2.apply(this,arguments);}return consumeFull;}()},{key:"consumeDraw",value:function(){var _consumeDraw6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee98(t,r){var n;return _regeneratorRuntime().wrap(function _callee98$(_context105){while(1)switch(_context105.prev=_context105.next){case 0:n=r.workId;_context105.t0=t===Vt.Local&&n;if(!_context105.t0){_context105.next=6;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(r);_context105.next=6;return this.localWork.consumeDraw(r,this.serviceWork);case 6:t===Vt.Service&&this.serviceWork.consumeDraw(r);case 7:case"end":return _context105.stop();}},_callee98,this);}));function consumeDraw(_x141,_x142){return _consumeDraw6.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee99(t,r){var n;return _regeneratorRuntime().wrap(function _callee99$(_context106){while(1)switch(_context106.prev=_context106.next){case 0:n=r.workId;_context106.t0=t===Vt.Local&&n;if(!_context106.t0){_context106.next=6;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(r);_context106.next=6;return this.localWork.consumeDrawAll(r,this.serviceWork);case 6:case"end":return _context106.stop();}},_callee99,this);}));function consumeDrawAll(_x143,_x144){return _consumeDrawAll5.apply(this,arguments);}return consumeDrawAll;}()},{key:"updateDpr",value:function(){var _updateDpr3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee100(t){return _regeneratorRuntime().wrap(function _callee100$(_context107){while(1)switch(_context107.prev=_context107.next){case 0:_superPropGet(sd,"updateDpr",this,3)([t]);_context107.next=3;return this.post({render:[{isClearAll:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{isDrawAll:!0,drawCanvas:Ut.Bg,viewId:this.viewId}]});case 3:case"end":return _context107.stop();}},_callee100,this);}));function updateDpr(_x145){return _updateDpr3.apply(this,arguments);}return updateDpr;}()},{key:"updateCamera",value:function(){var _updateCamera2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee101(t){var _this119=this;var c,l,f,h,m,r,n,s,u,x,_iterator79,_step79,_step79$value,_I55,_d48,y,_iterator80,_step80,_step80$value,_x151,_I60,_d51,_iterator81,_step81,_step81$value,_x152,_I61,_d52,T,E,_x147,_iterator82,_step82,_I56,C,_iterator83,_step83,_x148,_I57,_iterator84,_step84,_d49,_iterator85,_step85,_step85$value,_x150,_step85$value$,_I59,_d50,v,p,S,A,R,D,U,M,W,Y,_iterator86,_step86,_step86$value,_x149,_I58;return _regeneratorRuntime().wrap(function _callee101$(_context108){while(1)switch(_context108.prev=_context108.next){case 0:r=[],n=t.cameraOpt,s=t.scenePath;if(!(n&&!qr(this.cameraOpt,n))){_context108.next=42;break;}this.taskUpdateCameraId&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0);u=!!this.serviceDrawLayer.children.length;if(!s){_context108.next=30;break;}x=!1;_iterator79=_createForOfIteratorHelper(this.localWork.getWorkShapes().entries());_context108.prev=7;_iterator79.s();case 9:if((_step79=_iterator79.n()).done){_context108.next=19;break;}_step79$value=_slicedToArray(_step79.value,2),_I55=_step79$value[0],_d48=_step79$value[1];_context108.t0=_d48.toolsType;_context108.next=_context108.t0===Tt.Text?14:_context108.t0===Tt.PencilEraser?14:_context108.t0===Tt.Eraser?14:_context108.t0===Tt.Selector?14:_context108.t0===Tt.LaserPen?14:15;break;case 14:return _context108.abrupt("break",17);case 15:_I55!==pi&&_I55!==Me&&(x=!0);return _context108.abrupt("break",17);case 17:_context108.next=9;break;case 19:_context108.next=24;break;case 21:_context108.prev=21;_context108.t1=_context108["catch"](7);_iterator79.e(_context108.t1);case 24:_context108.prev=24;_iterator79.f();return _context108.finish(24);case 27:if(!x){_context108.next=30;break;}this.taskUpdateCameraId=setTimeout(function(){_this119.taskUpdateCameraId=void 0,_this119.updateCamera(t);},wu);return _context108.abrupt("return");case 30:y=/* @__PURE__ */new Map();_iterator80=_createForOfIteratorHelper(this.vNodes.getNodesByType(Tt.Text).entries());try{for(_iterator80.s();!(_step80=_iterator80.n()).done;){_step80$value=_slicedToArray(_step80.value,2),_x151=_step80$value[0],_I60=_step80$value[1];_d51=_I60.rect;y.set(_x151,{rect:fr(_d51),scale:(c=this.cameraOpt)==null?void 0:c.scale});}}catch(err){_iterator80.e(err);}finally{_iterator80.f();}_iterator81=_createForOfIteratorHelper(this.vNodes.gethasEraserNodes().entries());try{for(_iterator81.s();!(_step81=_iterator81.n()).done;){_step81$value=_slicedToArray(_step81.value,2),_x152=_step81$value[0],_I61=_step81$value[1];_d52=_I61.rect;y.set(_x152,{rect:fr(_d52),scale:(l=this.cameraOpt)==null?void 0:l.scale});}}catch(err){_iterator81.e(err);}finally{_iterator81.f();}T=new Set(y.keys());E=!1;if(this.localWork.hasSelector()){_x147=(f=this.localWork.getSelector())==null?void 0:f.selectIds;if(_x147){E=!0;_iterator82=_createForOfIteratorHelper(_x147);try{for(_iterator82.s();!(_step82=_iterator82.n()).done;){_I56=_step82.value;T.add(_I56);}}catch(err){_iterator82.e(err);}finally{_iterator82.f();}}}C=!1;if(this.serviceWork.selectorWorkShapes.size){_iterator83=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.values());try{for(_iterator83.s();!(_step83=_iterator83.n()).done;){_x148=_step83.value;_I57=_x148.selectIds;if(_I57){C=!0;_iterator84=_createForOfIteratorHelper(_I57);try{for(_iterator84.s();!(_step84=_iterator84.n()).done;){_d49=_step84.value;T.add(_d49);}}catch(err){_iterator84.e(err);}finally{_iterator84.f();}}}}catch(err){_iterator83.e(err);}finally{_iterator83.f();}}if(this.setCameraOpt(n),this.vNodes.curNodeMap.size){this.vNodes.clearTarget(),this.vNodes.updateHighLevelNodesRect(T),this.debounceUpdateCameraId&&clearTimeout(this.debounceUpdateCameraId);_iterator85=_createForOfIteratorHelper(y.entries());try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){_step85$value=_slicedToArray(_step85.value,2),_x150=_step85$value[0],_step85$value$=_step85$value[1],_I59=_step85$value$.rect,_d50=_step85$value$.scale;v=this.vNodes.get(_x150);if(v){p=_I59,S=v.rect,A=this.getSceneRect(),R=Zi(p,A),D=Zi(S,A),U=v.toolsType,M=v.opt;W=!1;(R!==D||p.w!==S.w||p.h!==S.h||D===Tr.intersect)&&(W=!0),U===Tt.Text&&// (opt as TextOptions).workState === EvevtWorkState.Done &&
|
|
517
|
+
W&&this.debounceUpdateCache.add(_x150);Y=!1;_d50&&(h=this.cameraOpt)!=null&&h.scale&&_d50>this.cameraOpt.scale?D!==Tr.outside&&R!==Tr.inside&&(Y=!0):_d50&&(m=this.cameraOpt)!=null&&m.scale&&_d50===this.cameraOpt.scale&&(p.x!==S.x||p.y!==S.y)&&(D===Tr.inside&&R!==Tr.inside||D===Tr.intersect&&R===Tr.intersect)&&(Y=!0),M.eraserlines&&M.eraserlines.length&&Y&&!this.debounceUpdateCache.has(_x150)&&this.debounceUpdateCache.add(_x150);}}}catch(err){_iterator85.e(err);}finally{_iterator85.f();}if(E&&this.localWork.reRenderSelector(),C){_iterator86=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.entries());try{for(_iterator86.s();!(_step86=_iterator86.n()).done;){_step86$value=_slicedToArray(_step86.value,2),_x149=_step86$value[0],_I58=_step86$value[1];this.serviceWork.runSelectWork({workId:_x149,selectIds:_I58.selectIds,msgType:xt.Select,dataType:Vt.Service,viewId:this.viewId});}}catch(err){_iterator86.e(err);}finally{_iterator86.f();}}this.debounceUpdateCameraId=setTimeout(function(){var I;_this119.debounceUpdateCameraId=void 0;var x=[];var _iterator87=_createForOfIteratorHelper(_this119.debounceUpdateCache.values()),_step87;try{var _loop11=function _loop11(){var d=_step87.value;var v=_this119.vNodes.get(d);if(v){var p=v.toolsType,S=v.opt,A=v.op,R=_this119.localWork.setFullWork({toolsType:p,opt:S,workId:d});R&&(p===Tt.Text?(I=_this119.fullLayer)!=null&&I.getElementsByName(d)[0]&&R instanceof Ki&&x.push(R.consumeServiceAsync({isFullWork:!0,replaceId:d,boxRect:_this119.getSceneRect()})):S.eraserlines&&S.eraserlines.length&&x.push(new Promise(function(D){var U=R.consumeService({op:A,isFullWork:!0,replaceId:d,workState:te.Done});_this119.localWork.clearWorkShapeNodeCache(d),D(U);})));}_this119.debounceUpdateCache["delete"](d);};for(_iterator87.s();!(_step87=_iterator87.n()).done;){_loop11();}}catch(err){_iterator87.e(err);}finally{_iterator87.f();}x.length?Promise.all(x).then(function(){var d=[];d.push({isClearAll:!0,clearCanvas:Ut.Bg,viewId:_this119.viewId},{isDrawAll:!0,drawCanvas:Ut.Bg,viewId:_this119.viewId}),d.length&&_this119.post({render:d}),_this119.vNodes.updateLowLevelNodesRect(),_this119.vNodes.clearHighLevelIds();}):(_this119.vNodes.updateLowLevelNodesRect(),_this119.vNodes.clearHighLevelIds());},wu*5);}u&&r.push({isClearAll:!0,clearCanvas:Ut.ServiceFloat,viewId:this.viewId}),this.vNodes.hasRenderNodes()&&r.push({isClearAll:!0,clearCanvas:Ut.Bg,viewId:this.viewId},{isDrawAll:!0,drawCanvas:Ut.Bg,viewId:this.viewId}),r.length&&this.post({render:r});case 42:case"end":return _context108.stop();}},_callee101,this,[[7,21,24,27]]);}));function updateCamera(_x146){return _updateCamera2.apply(this,arguments);}return updateCamera;}()},{key:"getRectImageBitmap",value:function getRectImageBitmap(t){var r=t.rect,n=t.drawCanvas,s=Math.floor(r.x*this.dpr),c=Math.floor(r.y*this.dpr),l=Math.floor(r.w*this.dpr||1),f=Math.floor(r.h*this.dpr||1);return createImageBitmap(this.getOffscreen(n),s,c,l,f,{resizeQuality:"low"});}},{key:"cursorHover",value:function(){var _cursorHover2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee102(t){return _regeneratorRuntime().wrap(function _callee102$(_context109){while(1)switch(_context109.prev=_context109.next){case 0:_context109.next=2;return this.localWork.cursorHover(t);case 2:case"end":return _context109.stop();}},_callee102,this);}));function cursorHover(_x153){return _cursorHover2.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee103(){return _regeneratorRuntime().wrap(function _callee103$(_context110){while(1)switch(_context110.prev=_context110.next){case 0:_context110.next=2;return this.localWork.cursorBlur();case 2:case"end":return _context110.stop();}},_callee103,this);}));function cursorBlur(){return _cursorBlur2.apply(this,arguments);}return cursorBlur;}()},{key:"destroy",value:function destroy(){_superPropGet(sd,"destroy",this,3)([]);}}]);}(Jh);var KM=/*#__PURE__*/function(_sd){function KM(t,r,n){var _this120;_classCallCheck(this,KM);var c,l,f,h;_this120=_callSuper(this,KM,[t,r,n]);dt(_this120,"snapshotWork");dt(_this120,"localDrawScene");dt(_this120,"serviceDrawScene");dt(_this120,"offscreenCanvas");dt(_this120,"localWork");dt(_this120,"serviceWork");if(_this120._post=n,r.offscreenCanvas){_this120.offscreenCanvas=r.offscreenCanvas,_this120.localDrawScene=_this120.createScene(r,(c=_this120.offscreenCanvas)==null?void 0:c.localCanvas),_this120.serviceDrawScene=_this120.createScene(r,(l=_this120.offscreenCanvas)==null?void 0:l.serviceCanvas);var m=vr.bufferSize.sub;_this120.serviceDrawLayer=_this120.createLayer("serviceDrawLayer",_this120.serviceDrawScene||_this120.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:m,contextType:"2d"}),(f=_this120.offscreenCanvas)==null?void 0:f.serviceCanvas),_this120.localDrawLayer=_this120.createLayer("localDrawLayer",_this120.localDrawScene||_this120.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:m,contextType:"2d"}),(h=_this120.offscreenCanvas)==null?void 0:h.localCanvas);}var s={thread:_this120,viewId:_this120.viewId,vNodes:_this120.vNodes,fullLayer:_this120.fullLayer};_this120.localWork=new GM(_objectSpread(_objectSpread({},s),{},{drawLayer:_this120.localDrawLayer})),r.combineUnitTime&&_this120.localWork.setCombineUnitTime(r.combineUnitTime),r.maxCombineEraserTime&&_this120.localWork.setmaxCombineEraserTime(r.maxCombineEraserTime),r.syncUnitTime&&_this120.localWork.setSyncUnitTime(r.syncUnitTime),_this120.serviceWork=new HM(_objectSpread(_objectSpread({},s),{},{drawLayer:_this120.serviceDrawLayer})),_this120.snapshotWork=new nd(_objectSpread(_objectSpread({},s),{},{createScene:_this120.createScene.bind(_this120),createLayer:_this120.createLayer.bind(_this120)})),_this120.methodBuilder=new Xu([he.CopyNode,he.SetColorNode,he.DeleteNode,he.RotateNode,he.ScaleNode,he.TranslateNode,he.ZIndexNode,he.SetFontStyle,he.SetPoint,he.SetLock,he.SetShapeOpt]).registerForWorker(_this120);return _this120;}_inherits(KM,_sd);return _createClass(KM,[{key:"createRenderLayer",value:function createRenderLayer(t,r,n){var l;var s=vr.bufferSize.full,c=vr.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",t,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:this.viewId===$n?s:c*2}),n||((l=r.offscreenCanvas)==null?void 0:l.bgCanvas));}},{key:"createScene",value:function createScene(t,r){var n=t.offscreenCanvas,s=t.offscreenCanvasOpt,c=s.width,l=s.height,f=r||(n==null?void 0:n.bgCanvas)||new OffscreenCanvas(c,l);s.contextType&&delete s.contextType;var h=new Uu(_objectSpread(_objectSpread({container:f,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},s),{},{contextType:this.contextType,id:this.viewId}));return h.setAttribute("id",this.viewId),h;}},{key:"combinePostData",value:function combinePostData(){var c,l;this.workerTaskId=void 0;var t=[],r=[];var n;var s=/* @__PURE__ */new Set();var _iterator88=_createForOfIteratorHelper(this.combinePostMsg.values()),_step88;try{for(_iterator88.s();!(_step88=_iterator88.n()).done;){var f=_step88.value;if((c=f.render)!=null&&c.length)if(this.offscreenCanvas){var _iterator89=_createForOfIteratorHelper(f.render),_step89;try{for(_iterator89.s();!(_step89=_iterator89.n()).done;){var h=_step89.value;h.workId&&s.add(h.workId);var m=h.drawCanvas||h.clearCanvas;if(m){var u=this.getLayer(m);if(!u||!(u.parent instanceof el))continue;u.parent.render();}}}catch(err){_iterator89.e(err);}finally{_iterator89.f();}}else{var _iterator90=_createForOfIteratorHelper(f.render),_step90;try{for(_iterator90.s();!(_step90=_iterator90.n()).done;){var _h9=_step90.value;var _m16=!1;if(_h9.workId&&s.add(_h9.workId),_h9.isClearAll&&(_h9.rect=this.getSceneRect(),_h9.isClear=!0,delete _h9.isClearAll),_h9.drawCanvas){var _u9=this.getLayer(_h9.drawCanvas);if(!_u9||!(_u9.parent instanceof el))continue;if(_u9.parent.render(),_h9.isDrawAll){var y=this.getSceneRect();_h9.rect=y,delete _h9.isDrawAll;}}var _iterator91=_createForOfIteratorHelper(t),_step91;try{for(_iterator91.s();!(_step91=_iterator91.n()).done;){var _u10=_step91.value;if(_h9.viewId===_u10.viewId){_h9.isClear&&_u10.clearCanvas&&_u10.isClear&&_u10.clearCanvas===_h9.clearCanvas&&(_u10.rect=Zt(_u10.rect,_h9.rect),_m16=!0),_u10.drawCanvas&&_u10.drawCanvas===_h9.drawCanvas&&(_u10.rect=Zt(_u10.rect,_h9.rect),_m16=!0);continue;}}}catch(err){_iterator91.e(err);}finally{_iterator91.f();}_m16||(_h9.isClear&&!_h9.drawCanvas?t.unshift(_h9):t.push(_h9));}}catch(err){_iterator90.e(err);}finally{_iterator90.f();}}if((l=f.sp)!=null&&l.length){var _iterator92=_createForOfIteratorHelper(f.sp),_step92;try{for(_iterator92.s();!(_step92=_iterator92.n()).done;){var _h10=_step92.value;var _m17=!1;var _iterator93=_createForOfIteratorHelper(r),_step93;try{for(_iterator93.s();!(_step93=_iterator93.n()).done;){var _u11=_step93.value;if(qr(_h10,_u11)){_m17=!0;break;}}}catch(err){_iterator93.e(err);}finally{_iterator93.f();}_m17||r.push(_h10);}}catch(err){_iterator92.e(err);}finally{_iterator92.f();}}er(f.consumeCount)&&(n=f.consumeCount);}}catch(err){_iterator88.e(err);}finally{_iterator88.f();}return this.combinePostMsg.clear(),{render:t,sp:r,consumeCount:n,workIds:s,viewId:this.viewId};}},{key:"on",value:function(){var _on4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee104(t){var r;return _regeneratorRuntime().wrap(function _callee104$(_context111){while(1)switch(_context111.prev=_context111.next){case 0:if(!this.methodBuilder.consumeForWorker(t)){_context111.next=2;break;}return _context111.abrupt("return");case 2:r=t.msgType;_context111.t0=r;_context111.next=_context111.t0===xt.Snapshot?6:_context111.t0===xt.BoundingBox?11:16;break;case 6:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===$n?6e3:3e3,contextType:"2d"}));_context111.next=9;return this.snapshotWork.getSnapshot(t);case 9:this.snapshotWork.destroySnapshotFullLayer();return _context111.abrupt("return");case 11:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===$n?6e3:3e3,contextType:"2d"}));_context111.next=14;return this.snapshotWork.getBoundingRect(t);case 14:this.snapshotWork.destroySnapshotFullLayer();return _context111.abrupt("return");case 16:_context111.next=18;return _superPropGet(KM,"on",this,3)([t]);case 18:case"end":return _context111.stop();}},_callee104,this);}));function on(_x154){return _on4.apply(this,arguments);}return on;}()},{key:"setCameraOpt",value:function setCameraOpt(t){if(this.localDrawScene&&this.serviceDrawScene){var r=t.width,n=t.height;(r!==this.localDrawScene.width||n!==this.localDrawScene.height)&&this.updateScene(this.localDrawScene,{width:r,height:n},this.localDrawLayer),(r!==this.serviceDrawScene.width||n!==this.serviceDrawScene.height)&&this.updateScene(this.serviceDrawScene,{width:r,height:n},this.serviceDrawLayer);}_superPropGet(KM,"setCameraOpt",this,3)([t]);}},{key:"updateDpr",value:function(){var _updateDpr4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee105(t){return _regeneratorRuntime().wrap(function _callee105$(_context112){while(1)switch(_context112.prev=_context112.next){case 0:this.localDrawScene&&this.serviceDrawScene&&(this.localDrawScene.displayRatio=t,this.serviceDrawScene.displayRatio=t),_superPropGet(KM,"updateDpr",this,3)([t]);case 1:case"end":return _context112.stop();}},_callee105,this);}));function updateDpr(_x155){return _updateDpr4.apply(this,arguments);}return updateDpr;}()}]);}(sd);var Fu=self;Fu.full=new kM(Fu,uo.Full);
|